codex-mobile-re 0.1.129 → 0.1.130
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.
- package/dist/assets/{AutomationsPanel-DNsTBfFe.js → AutomationsPanel-BNvu7EM1.js} +1 -1
- package/dist/assets/{DirectoryHub-DjzGaPq6.js → DirectoryHub-DttPWXKw.js} +1 -1
- package/dist/assets/{QueuedMessages-DNVDZvsM.js → QueuedMessages-CxPRR-jw.js} +1 -1
- package/dist/assets/ReviewPane-CjYAzq9l.js +1 -0
- package/dist/assets/{RightFilePreview-DIz4AIh6.js → RightFilePreview-CGeKHIfD.js} +1 -1
- package/dist/assets/{RightFilesPanel-C7leH782.js → RightFilesPanel-DHKw1OdD.js} +1 -1
- package/dist/assets/{RightGitPanel-BaFysyCQ.js → RightGitPanel-C3iEraeJ.js} +2 -2
- package/dist/assets/{SettingsDialog-BRMjc7tX.js → SettingsDialog-CEgc9uDb.js} +3 -3
- package/dist/assets/ThreadConversation-BhhCq0PN.js +39 -0
- package/dist/assets/{ThreadConversation-BEc1XQXz.css → ThreadConversation-D1JHRys4.css} +1 -1
- package/dist/assets/ThreadPendingRequestPanel-GN61XTlE.js +1 -0
- package/dist/assets/{ThreadTerminalPanel-BPYLKihX.js → ThreadTerminalPanel-DcGHG7Mb.js} +1 -1
- package/dist/assets/index-Bcgrj03j.js +83 -0
- package/dist/assets/{index-DI_rCYF6.css → index-DthBwStG.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/ReviewPane-DLogJNGk.js +0 -1
- package/dist/assets/ThreadConversation-BB19p4J3.js +0 -39
- package/dist/assets/ThreadPendingRequestPanel-rVtQUq_G.js +0 -1
- package/dist/assets/index-rc4ZsEIH.js +0 -83
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-BB19p4J3.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-BEc1XQXz.css","assets/ThreadTerminalPanel-BPYLKihX.js","assets/ThreadTerminalPanel-DkX7vTl_.css","assets/ReviewPane-DLogJNGk.js","assets/ReviewPane-BFBDQWlW.css","assets/DirectoryHub-DjzGaPq6.js","assets/DirectoryHub-DcMzIMOW.css","assets/AutomationsPanel-DNsTBfFe.js","assets/AutomationsPanel-Dz1E0PMi.css","assets/SettingsDialog-BRMjc7tX.js","assets/SettingsDialog-C6mYdSFF.css","assets/RightGitPanel-BaFysyCQ.js","assets/RightGitPanel-CQgG9pXB.css","assets/RightFilesPanel-C7leH782.js","assets/RightFilesPanel-ev__hRb5.css","assets/RightFilePreview-DIz4AIh6.js","assets/RightFilePreview-DNZDBkBr.css","assets/ThreadPendingRequestPanel-rVtQUq_G.js","assets/ThreadPendingRequestPanel-BlBoJVzv.css","assets/QueuedMessages-DNVDZvsM.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 r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();/**
|
|
3
|
-
* @vue/shared v3.5.40
|
|
4
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
-
* @license MIT
|
|
6
|
-
**/function If(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Bt={},Yi=[],ma=()=>{},wv=()=>!1,cc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),dc=e=>e.startsWith("onUpdate:"),mn=Object.assign,Af=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},BT=Object.prototype.hasOwnProperty,Nt=(e,t)=>BT.call(e,t),ot=Array.isArray,Ji=e=>eu(e)==="[object Map]",fc=e=>eu(e)==="[object Set]",Jp=e=>eu(e)==="[object Date]",pt=e=>typeof e=="function",Kt=e=>typeof e=="string",Rr=e=>typeof e=="symbol",Ot=e=>e!==null&&typeof e=="object",bv=e=>(Ot(e)||pt(e))&&pt(e.then)&&pt(e.catch),Tv=Object.prototype.toString,eu=e=>Tv.call(e),UT=e=>eu(e).slice(8,-1),Sv=e=>eu(e)==="[object Object]",_f=e=>Kt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Dl=If(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),pc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},zT=/-\w/g,fo=pc(e=>e.replace(zT,t=>t.slice(1).toUpperCase())),HT=/\B([A-Z])/g,zs=pc(e=>e.replace(HT,"-$1").toLowerCase()),hc=pc(e=>e.charAt(0).toUpperCase()+e.slice(1)),id=pc(e=>e?`on${hc(e)}`:""),Ir=(e,t)=>!Object.is(e,t),Bu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Cv=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},Pf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},qT=e=>{const t=Kt(e)?Number(e):NaN;return isNaN(t)?e:t};let Qp;const mc=()=>Qp||(Qp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function or(e){if(ot(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=Kt(o)?KT(o):or(o);if(r)for(const a in r)t[a]=r[a]}return t}else if(Kt(e)||Ot(e))return e}const WT=/;(?![^(]*\))/g,GT=/:([^]+)/,VT=/\/\*[^]*?\*\//g;function KT(e){const t={};return e.replace(VT,"").split(WT).forEach(n=>{if(n){const o=n.split(GT);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function ut(e){let t="";if(Kt(e))t=e;else if(ot(e))for(let n=0;n<e.length;n++){const o=ut(e[n]);o&&(t+=o+" ")}else if(Ot(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const YT="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",JT=If(YT);function xv(e){return!!e||e===""}function QT(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=tu(e[o],t[o]);return n}function tu(e,t){if(e===t)return!0;let n=Jp(e),o=Jp(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=Rr(e),o=Rr(t),n||o)return e===t;if(n=ot(e),o=ot(t),n||o)return n&&o?QT(e,t):!1;if(n=Ot(e),o=Ot(t),n||o){if(!n||!o)return!1;const r=Object.keys(e).length,a=Object.keys(t).length;if(r!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!tu(e[s],t[s]))return!1}}return String(e)===String(t)}function kv(e,t){return e.findIndex(n=>tu(n,t))}const Iv=e=>!!(e&&e.__v_isRef===!0),F=e=>Kt(e)?e:e==null?"":ot(e)||Ot(e)&&(e.toString===Tv||!pt(e.toString))?Iv(e)?F(e.value):JSON.stringify(e,Av,2):String(e),Av=(e,t)=>Iv(t)?Av(e,t.value):Ji(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],a)=>(n[ld(o,a)+" =>"]=r,n),{})}:fc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ld(n))}:Rr(t)?ld(t):Ot(t)&&!ot(t)&&!Sv(t)?String(t):t,ld=(e,t="")=>{var n;return Rr(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 Fn;class XT{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&&Fn&&(Fn.active?(this.parent=Fn,this.index=(Fn.scopes||(Fn.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 o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[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 r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}const o=this.effects.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}}run(t){if(this._active){const n=Fn;try{return Fn=this,t()}finally{Fn=n}}}on(){++this._on===1&&(this.prevScope=Fn,Fn=this)}off(){if(this._on>0&&--this._on===0){if(Fn===this)Fn=this.prevScope;else{let t=Fn;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,o;for(n=0,o=this.effects.length;n<o;n++)this.effects[n].stop();for(this.effects.length=0,n=0,o=this.cleanups.length;n<o;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const r=this.scopes.slice();for(n=0,o=r.length;n<o;n++)r[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function ZT(){return Fn}let Ht;const ud=new WeakSet;class _v{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Fn&&(Fn.active?Fn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ud.has(this)&&(ud.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ev(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Xp(this),Rv(this);const t=Ht,n=Pr;Ht=this,Pr=!0;try{return this.fn()}finally{Mv(this),Ht=t,Pr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Mf(t);this.deps=this.depsTail=void 0,Xp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ud.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){zd(this)&&this.run()}get dirty(){return zd(this)}}let Pv=0,Fl,Bl;function Ev(e,t=!1){if(e.flags|=8,t){e.next=Bl,Bl=e;return}e.next=Fl,Fl=e}function Ef(){Pv++}function Rf(){if(--Pv>0)return;if(Bl){let t=Bl;for(Bl=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Fl;){let t=Fl;for(Fl=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}t=n}}if(e)throw e}function Rv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Mv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),Mf(o),eS(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function zd(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(jv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function jv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Gl)||(e.globalVersion=Gl,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!zd(e))))return;e.flags|=2;const t=e.dep,n=Ht,o=Pr;Ht=e,Pr=!0;try{Rv(e);const r=e.fn(e._value);(t.version===0||Ir(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Ht=n,Pr=o,Mv(e),e.flags&=-3}}function Mf(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Mf(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function eS(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Pr=!0;const Lv=[];function Ka(){Lv.push(Pr),Pr=!1}function Ya(){const e=Lv.pop();Pr=e===void 0?!0:e}function Xp(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ht;Ht=void 0;try{t()}finally{Ht=n}}}let Gl=0;class tS{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 jf{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(!Ht||!Pr||Ht===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ht)n=this.activeLink=new tS(Ht,this),Ht.deps?(n.prevDep=Ht.depsTail,Ht.depsTail.nextDep=n,Ht.depsTail=n):Ht.deps=Ht.depsTail=n,Nv(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const o=n.nextDep;o.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=o),n.prevDep=Ht.depsTail,n.nextDep=void 0,Ht.depsTail.nextDep=n,Ht.depsTail=n,Ht.deps===n&&(Ht.deps=o)}return n}trigger(t){this.version++,Gl++,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 Nv(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let o=t.deps;o;o=o.nextDep)Nv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Hd=new WeakMap,vi=Symbol(""),qd=Symbol(""),Vl=Symbol("");function Qn(e,t,n){if(Pr&&Ht){let o=Hd.get(e);o||Hd.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new jf),r.map=o,r.key=n),r.track()}}function Ha(e,t,n,o,r,a){const s=Hd.get(e);if(!s){Gl++;return}const i=l=>{l&&l.trigger()};if(Ef(),t==="clear")s.forEach(i);else{const l=ot(e),c=l&&_f(n);if(l&&n==="length"){const d=Number(o);s.forEach((v,f)=>{(f==="length"||f===Vl||!Rr(f)&&f>=d)&&i(v)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),c&&i(s.get(Vl)),t){case"add":l?c&&i(s.get("length")):(i(s.get(vi)),Ji(e)&&i(s.get(qd)));break;case"delete":l||(i(s.get(vi)),Ji(e)&&i(s.get(qd)));break;case"set":Ji(e)&&i(s.get(vi));break}}Rf()}function Bi(e){const t=Rt(e);return t===e?t:(Qn(t,"iterate",Vl),rr(e)?t:t.map(Mr))}function vc(e){return Qn(e=Rt(e),"iterate",Vl),e}function fa(e,t){return Ja(e)?al(gi(e)?Mr(t):t):Mr(t)}const nS={__proto__:null,[Symbol.iterator](){return cd(this,Symbol.iterator,e=>fa(this,e))},concat(...e){return Bi(this).concat(...e.map(t=>ot(t)?Bi(t):t))},entries(){return cd(this,"entries",e=>(e[1]=fa(this,e[1]),e))},every(e,t){return $a(this,"every",e,t,void 0,arguments)},filter(e,t){return $a(this,"filter",e,t,n=>n.map(o=>fa(this,o)),arguments)},find(e,t){return $a(this,"find",e,t,n=>fa(this,n),arguments)},findIndex(e,t){return $a(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return $a(this,"findLast",e,t,n=>fa(this,n),arguments)},findLastIndex(e,t){return $a(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return $a(this,"forEach",e,t,void 0,arguments)},includes(...e){return dd(this,"includes",e)},indexOf(...e){return dd(this,"indexOf",e)},join(e){return Bi(this).join(e)},lastIndexOf(...e){return dd(this,"lastIndexOf",e)},map(e,t){return $a(this,"map",e,t,void 0,arguments)},pop(){return Pl(this,"pop")},push(...e){return Pl(this,"push",e)},reduce(e,...t){return Zp(this,"reduce",e,t)},reduceRight(e,...t){return Zp(this,"reduceRight",e,t)},shift(){return Pl(this,"shift")},some(e,t){return $a(this,"some",e,t,void 0,arguments)},splice(...e){return Pl(this,"splice",e)},toReversed(){return Bi(this).toReversed()},toSorted(e){return Bi(this).toSorted(e)},toSpliced(...e){return Bi(this).toSpliced(...e)},unshift(...e){return Pl(this,"unshift",e)},values(){return cd(this,"values",e=>fa(this,e))}};function cd(e,t,n){const o=vc(e),r=o[t]();return o!==e&&!rr(e)&&(r._next=r.next,r.next=()=>{const a=r._next();return a.done||(a.value=n(a.value)),a}),r}const oS=Array.prototype;function $a(e,t,n,o,r,a){const s=vc(e),i=s!==e&&!rr(e),l=s[t];if(l!==oS[t]){const v=l.apply(e,a);return i?Mr(v):v}let c=n;s!==e&&(i?c=function(v,f){return n.call(this,fa(e,v),f,e)}:n.length>2&&(c=function(v,f){return n.call(this,v,f,e)}));const d=l.call(s,c,o);return i&&r?r(d):d}function Zp(e,t,n,o){const r=vc(e),a=r!==e&&!rr(e);let s=n,i=!1;r!==e&&(a?(i=o.length===0,s=function(c,d,v){return i&&(i=!1,c=fa(e,c)),n.call(this,c,fa(e,d),v,e)}):n.length>3&&(s=function(c,d,v){return n.call(this,c,d,v,e)}));const l=r[t](s,...o);return i?fa(e,l):l}function dd(e,t,n){const o=Rt(e);Qn(o,"iterate",Vl);const r=o[t](...n);return(r===-1||r===!1)&&Of(n[0])?(n[0]=Rt(n[0]),o[t](...n)):r}function Pl(e,t,n=[]){Ka(),Ef();const o=Rt(e)[t].apply(e,n);return Rf(),Ya(),o}const rS=If("__proto__,__v_isRef,__isVue"),Ov=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Rr));function aS(e){Rr(e)||(e=String(e));const t=Rt(this);return Qn(t,"has",e),t.hasOwnProperty(e)}class $v{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return o===(r?a?mS:Uv:a?Bv:Fv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const s=ot(t);if(!r){let l;if(s&&(l=nS[n]))return l;if(n==="hasOwnProperty")return aS}const i=Reflect.get(t,n,jn(t)?t:o);if((Rr(n)?Ov.has(n):rS(n))||(r||Qn(t,"get",n),a))return i;if(jn(i)){const l=s&&_f(n)?i:i.value;return r&&Ot(l)?Gd(l):l}return Ot(i)?r?Gd(i):gc(i):i}}class Dv extends $v{constructor(t=!1){super(!1,t)}set(t,n,o,r){let a=t[n];const s=ot(t)&&_f(n);if(!this._isShallow){const c=Ja(a);if(!rr(o)&&!Ja(o)&&(a=Rt(a),o=Rt(o)),!s&&jn(a)&&!jn(o))return c||(a.value=o),!0}const i=s?Number(n)<t.length:Nt(t,n),l=Reflect.set(t,n,o,jn(t)?t:r);return t===Rt(r)&&l&&(i?Ir(o,a)&&Ha(t,"set",n,o):Ha(t,"add",n,o)),l}deleteProperty(t,n){const o=Nt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&Ha(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!Rr(n)||!Ov.has(n))&&Qn(t,"has",n),o}ownKeys(t){return Qn(t,"iterate",ot(t)?"length":vi),Reflect.ownKeys(t)}}class sS extends $v{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const iS=new Dv,lS=new sS,uS=new Dv(!0);const Wd=e=>e,xu=e=>Reflect.getPrototypeOf(e);function cS(e,t,n){return function(...o){const r=this.__v_raw,a=Rt(r),s=Ji(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=r[e](...o),d=n?Wd:t?al:Mr;return!t&&Qn(a,"iterate",l?qd:vi),mn(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 ku(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function dS(e,t){const n={get(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);e||(Ir(r,i)&&Qn(s,"get",r),Qn(s,"get",i));const{has:l}=xu(s),c=t?Wd:e?al:Mr;if(l.call(s,r))return c(a.get(r));if(l.call(s,i))return c(a.get(i));a!==s&&a.get(r)},get size(){const r=this.__v_raw;return!e&&Qn(Rt(r),"iterate",vi),r.size},has(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);return e||(Ir(r,i)&&Qn(s,"has",r),Qn(s,"has",i)),r===i?a.has(r):a.has(r)||a.has(i)},forEach(r,a){const s=this,i=s.__v_raw,l=Rt(i),c=t?Wd:e?al:Mr;return!e&&Qn(l,"iterate",vi),i.forEach((d,v)=>r.call(a,c(d),c(v),s))}};return mn(n,e?{add:ku("add"),set:ku("set"),delete:ku("delete"),clear:ku("clear")}:{add(r){const a=Rt(this),s=xu(a),i=Rt(r),l=!t&&!rr(r)&&!Ja(r)?i:r;return s.has.call(a,l)||Ir(r,l)&&s.has.call(a,r)||Ir(i,l)&&s.has.call(a,i)||(a.add(l),Ha(a,"add",l,l)),this},set(r,a){!t&&!rr(a)&&!Ja(a)&&(a=Rt(a));const s=Rt(this),{has:i,get:l}=xu(s);let c=i.call(s,r);c||(r=Rt(r),c=i.call(s,r));const d=l.call(s,r);return s.set(r,a),c?Ir(a,d)&&Ha(s,"set",r,a):Ha(s,"add",r,a),this},delete(r){const a=Rt(this),{has:s,get:i}=xu(a);let l=s.call(a,r);l||(r=Rt(r),l=s.call(a,r)),i&&i.call(a,r);const c=a.delete(r);return l&&Ha(a,"delete",r,void 0),c},clear(){const r=Rt(this),a=r.size!==0,s=r.clear();return a&&Ha(r,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=cS(r,e,t)}),n}function Lf(e,t){const n=dS(e,t);return(o,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Nt(n,r)&&r in o?n:o,r,a)}const fS={get:Lf(!1,!1)},pS={get:Lf(!1,!0)},hS={get:Lf(!0,!1)};const Fv=new WeakMap,Bv=new WeakMap,Uv=new WeakMap,mS=new WeakMap;function vS(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function gc(e){return Ja(e)?e:Nf(e,!1,iS,fS,Fv)}function zv(e){return Nf(e,!1,uS,pS,Bv)}function Gd(e){return Nf(e,!0,lS,hS,Uv)}function Nf(e,t,n,o,r){if(!Ot(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=r.get(e);if(a)return a;const s=vS(UT(e));if(s===0)return e;const i=new Proxy(e,s===2?o:n);return r.set(e,i),i}function gi(e){return Ja(e)?gi(e.__v_raw):!!(e&&e.__v_isReactive)}function Ja(e){return!!(e&&e.__v_isReadonly)}function rr(e){return!!(e&&e.__v_isShallow)}function Of(e){return e?!!e.__v_raw:!1}function Rt(e){const t=e&&e.__v_raw;return t?Rt(t):e}function gS(e){return!Nt(e,"__v_skip")&&Object.isExtensible(e)&&Cv(e,"__v_skip",!0),e}const Mr=e=>Ot(e)?gc(e):e,al=e=>Ot(e)?Gd(e):e;function jn(e){return e?e.__v_isRef===!0:!1}function T(e){return Hv(e,!1)}function yS(e){return Hv(e,!0)}function Hv(e,t){return jn(e)?e:new wS(e,t)}class wS{constructor(t,n){this.dep=new jf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Rt(t),this._value=n?t:Mr(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||rr(t)||Ja(t);t=o?t:Rt(t),Ir(t,n)&&(this._rawValue=t,this._value=o?t:Mr(t),this.dep.trigger())}}function m(e){return jn(e)?e.value:e}const bS={get:(e,t,n)=>t==="__v_raw"?e:m(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return jn(r)&&!jn(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function qv(e){return gi(e)?e:new Proxy(e,bS)}class TS{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new jf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Gl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&Ht!==this)return Ev(this,!0),!0}get value(){const t=this.dep.track();return jv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function SS(e,t,n=!1){let o,r;return pt(e)?o=e:(o=e.get,r=e.set),new TS(o,r,n)}const Iu={},Gu=new WeakMap;let ci;function CS(e,t=!1,n=ci){if(n){let o=Gu.get(n);o||Gu.set(n,o=[]),o.push(e)}}function xS(e,t,n=Bt){const{immediate:o,deep:r,once:a,scheduler:s,augmentJob:i,call:l}=n,c=M=>r?M:rr(M)||r===!1||r===0?qa(M,1):qa(M);let d,v,f,y,S=!1,I=!1;if(jn(e)?(v=()=>e.value,S=rr(e)):gi(e)?(v=()=>c(e),S=!0):ot(e)?(I=!0,S=e.some(M=>gi(M)||rr(M)),v=()=>e.map(M=>{if(jn(M))return M.value;if(gi(M))return c(M);if(pt(M))return l?l(M,2):M()})):pt(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Ka();try{f()}finally{Ya()}}const M=ci;ci=d;try{return l?l(e,3,[y]):e(y)}finally{ci=M}}:v=ma,t&&r){const M=v,pe=r===!0?1/0:r;v=()=>qa(M(),pe)}const U=ZT(),O=()=>{d.stop(),U&&U.active&&Af(U.effects,d)};if(a&&t){const M=t;t=(...pe)=>{const ue=M(...pe);return O(),ue}}let $=I?new Array(e.length).fill(Iu):Iu;const q=M=>{if(!(!(d.flags&1)||!d.dirty&&!M))if(t){const pe=d.run();if(M||r||S||(I?pe.some((ue,V)=>Ir(ue,$[V])):Ir(pe,$))){f&&f();const ue=ci;ci=d;try{const V=[pe,$===Iu?void 0:I&&$[0]===Iu?[]:$,y];$=pe,l?l(t,3,V):t(...V)}finally{ci=ue}}}else d.run()};return i&&i(q),d=new _v(v),d.scheduler=s?()=>s(q,!1):q,y=M=>CS(M,!1,d),f=d.onStop=()=>{const M=Gu.get(d);if(M){if(l)l(M,4);else for(const pe of M)pe();Gu.delete(d)}},t?o?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||!Ot(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,jn(e))qa(e.value,t,n);else if(ot(e))for(let o=0;o<e.length;o++)qa(e[o],t,n);else if(fc(e)||Ji(e))e.forEach(o=>{qa(o,t,n)});else if(Sv(e)){for(const o in e)qa(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&qa(e[o],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 nu(e,t,n,o){try{return o?e(...o):e()}catch(r){ou(r,t,n)}}function sr(e,t,n,o){if(pt(e)){const r=nu(e,t,n,o);return r&&bv(r)&&r.catch(a=>{ou(a,t,n)}),r}if(ot(e)){const r=[];for(let a=0;a<e.length;a++)r.push(sr(e[a],t,n,o));return r}}function ou(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Bt;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){Ka(),nu(a,null,10,[e,l,c]),Ya();return}}kS(e,n,r,o,s)}function kS(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const uo=[];let da=-1;const Qi=[];let js=null,qi=0;const Wv=Promise.resolve();let Vu=null;function Dt(e){const t=Vu||Wv;return e?t.then(this?e.bind(this):e):t}function IS(e){let t=da+1,n=uo.length;for(;t<n;){const o=t+n>>>1,r=uo[o],a=Kl(r);a<e||a===e&&r.flags&2?t=o+1:n=o}return t}function $f(e){if(!(e.flags&1)){const t=Kl(e),n=uo[uo.length-1];!n||!(e.flags&2)&&t>=Kl(n)?uo.push(e):uo.splice(IS(t),0,e),e.flags|=1,Gv()}}function Gv(){Vu||(Vu=Wv.then(Kv))}function AS(e){ot(e)?Qi.push(...e):js&&e.id===-1?js.splice(qi+1,0,e):e.flags&1||(Qi.push(e),e.flags|=1),Gv()}function eh(e,t,n=da+1){for(;n<uo.length;n++){const o=uo[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;uo.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function Vv(e){if(Qi.length){const t=[...new Set(Qi)].sort((n,o)=>Kl(n)-Kl(o));if(Qi.length=0,js){js.push(...t);return}for(js=t,qi=0;qi<js.length;qi++){const n=js[qi];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}js=null,qi=0}}const Kl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Kv(e){try{for(da=0;da<uo.length;da++){const t=uo[da];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),nu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;da<uo.length;da++){const t=uo[da];t&&(t.flags&=-2)}da=-1,uo.length=0,Vv(),Vu=null,(uo.length||Qi.length)&&Kv()}}let Hn=null,Yv=null;function Ku(e){const t=Hn;return Hn=e,Yv=e&&e.type.__scopeId||null,t}function ft(e,t=Hn,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&Qu(-1);const a=Ku(t),s=Ga.length;let i;try{i=e(...r)}finally{for(let l=Ga.length;l>s;l--)Hf();Ku(a),o._d&&Qu(1)}return i};return o._n=!0,o._c=!0,o._d=!0,o}function Mn(e,t){if(Hn===null)return e;const n=Tc(Hn),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[a,s,i,l=Bt]=t[r];a&&(pt(a)&&(a={mounted:a,updated:a}),a.deep&&qa(s),o.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function ai(e,t,n,o){const r=e.dirs,a=t&&t.dirs;for(let s=0;s<r.length;s++){const i=r[s];a&&(i.oldValue=a[s].value);let l=i.dir[o];l&&(Ka(),sr(l,n,8,[e.el,i,e,t]),Ya())}}function Uu(e,t){if(zn){let n=zn.provides;const o=zn.parent&&zn.parent.provides;o===n&&(n=zn.provides=Object.create(o)),n[e]=t}}function Er(e,t,n=!1){const o=Wf();if(o||Zi){let r=Zi?Zi._context.provides:o?o.parent==null||o.ce?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&pt(t)?t.call(o&&o.proxy):t}}const _S=Symbol.for("v-scx"),PS=()=>Er(_S);function nt(e,t,n){return Jv(e,t,n)}function Jv(e,t,n=Bt){const{immediate:o,deep:r,flush:a,once:s}=n,i=mn({},n),l=t&&o||!t&&a!=="post";let c;if(ll){if(a==="sync"){const y=PS();c=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=ma,y.resume=ma,y.pause=ma,y}}const d=zn;i.call=(y,S,I)=>sr(y,d,S,I);let v=!1;a==="post"?i.scheduler=y=>{io(y,d&&d.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(y,S)=>{S?y():$f(y)}),i.augmentJob=y=>{t&&(y.flags|=4),v&&(y.flags|=2,d&&(y.id=d.uid,y.i=d))};const f=xS(e,t,i);return ll&&(c?c.push(f):l&&f()),f}function ES(e,t,n){const o=this.proxy,r=Kt(e)?e.includes(".")?Qv(o,e):()=>o[e]:e.bind(o,o);let a;pt(t)?a=t:(a=t.handler,n=t);const s=su(this),i=Jv(r,a.bind(o),n);return s(),i}function Qv(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r<n.length&&o;r++)o=o[n[r]];return o}}const Es=new WeakMap,Xv=Symbol("_vte"),Zv=e=>e.__isTeleport,fi=e=>e&&(e.disabled||e.disabled===""),RS=e=>e&&(e.defer||e.defer===""),th=e=>typeof SVGElement<"u"&&e instanceof SVGElement,nh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Vd=(e,t)=>{const n=e&&e.to;return Kt(n)?t?t(n):null:n},MS={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,a,s,i,l,c){const{mc:d,pc:v,pbc:f,o:{insert:y,querySelector:S,createText:I,createComment:U,parentNode:O}}=c,$=fi(t.props);let{dynamicChildren:q}=t;const M=(V,ie,ye)=>{V.shapeFlag&16&&d(V.children,ie,ye,r,a,s,i,l)},pe=(V=t)=>{const ie=fi(V.props),ye=V.target=Vd(V.props,S),Pe=Kd(ye,V,I,y);ye&&(s!=="svg"&&th(ye)?s="svg":s!=="mathml"&&nh(ye)&&(s="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(ye),ie||(M(V,ye,Pe),Ll(V,!1)))},ue=V=>{const ie=()=>{if(Es.get(V)===ie){if(Es.delete(V),fi(V.props)){const ye=O(V.el)||n;M(V,ye,V.anchor),Ll(V,!0)}pe(V)}};Es.set(V,ie),io(ie,a)};if(e==null){const V=t.el=I(""),ie=t.anchor=I("");if(y(V,n,o),y(ie,n,o),RS(t.props)||a&&a.pendingBranch){ue(t);return}$&&(M(t,n,ie),Ll(t,!0)),pe()}else{t.el=e.el;const V=t.anchor=e.anchor,ie=Es.get(e);if(ie){ie.flags|=8,Es.delete(e),ue(t);return}t.targetStart=e.targetStart;const ye=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,ge=fi(e.props),Z=ge?n:ye,me=ge?V:Pe;if(s==="svg"||th(ye)?s="svg":(s==="mathml"||nh(ye))&&(s="mathml"),q?(f(e.dynamicChildren,q,Z,r,a,s,i),zf(e,t,!0)):l||v(e,t,Z,me,r,a,s,i,!1),$)ge?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Au(t,n,V,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const oe=Vd(t.props,S);oe&&(t.target=oe,Au(t,oe,null,c,0))}else ge&&Au(t,ye,Pe,c,1);Ll(t,$)}},remove(e,t,n,{um:o,o:{remove:r}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:c,targetAnchor:d,target:v,props:f}=e,y=fi(f),S=a||!y,I=Es.get(e);if(I&&(I.flags|=8,Es.delete(e)),v&&(r(c),r(d)),a&&r(l),!I&&(y||v)&&s&16)for(let U=0;U<i.length;U++){const O=i[U];o(O,t,n,S,!!O.dynamicChildren)}},move:Au,hydrate:jS};function Au(e,t,n,{o:{insert:o},m:r},a=2){a===0&&o(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:c,props:d}=e,v=a===2;if(v&&o(s,t,n),!Es.has(e)&&(!v||fi(d))&&l&16)for(let f=0;f<c.length;f++)r(c[f],t,n,2);v&&o(i,t,n)}function jS(e,t,n,o,r,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,o,r,a)}const S=t.target=Vd(t.props,l),I=fi(t.props);if(S){const U=S._lpa||S.firstChild;t.shapeFlag&16&&(I?(y(e,t),f(S,U),t.targetAnchor||Kd(S,t,d,c,i(e)===S?e:null)):(t.anchor=s(e),f(S,U),t.targetAnchor||Kd(S,t,d,c),v(U&&s(U),t,S,n,o,r,a))),Ll(t,I)}else I&&t.shapeFlag&16&&(y(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const sl=MS;function Ll(e,t){const n=e.ctx;if(n&&n.ut){let o,r;for(t?(o=e.el,r=e.anchor):(o=e.targetStart,r=e.targetAnchor);o&&o!==r;)o.nodeType===1&&o.setAttribute("data-v-owner",n.uid),o=o.nextSibling;n.ut()}}function Kd(e,t,n,o,r=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[Xv]=s,e&&(o(a,e,r),o(s,e,r)),s}const nr=Symbol("_leaveCb"),El=Symbol("_enterCb");function LS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ti(()=>{e.isMounted=!0}),Hs(()=>{e.isUnmounting=!0}),e}const tr=[Function,Array],eg={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:tr,onEnter:tr,onAfterEnter:tr,onEnterCancelled:tr,onBeforeLeave:tr,onLeave:tr,onAfterLeave:tr,onLeaveCancelled:tr,onBeforeAppear:tr,onAppear:tr,onAfterAppear:tr,onAppearCancelled:tr},tg=e=>{const t=e.subTree;return t.component?tg(t.component):t},NS={name:"BaseTransition",props:eg,setup(e,{slots:t}){const n=Wf(),o=LS();return()=>{const r=t.default&&rg(t.default(),!0),a=r&&r.length?ng(r):n.subTree?ve():void 0;if(!a)return;const s=Rt(e),{mode:i}=s;if(o.isLeaving)return fd(a);const l=oh(a);if(!l)return fd(a);let c=Yd(l,s,o,n,v=>c=v);l.type!==Xn&&Yl(l,c);let d=n.subTree&&oh(n.subTree);if(d&&d.type!==Xn&&!pi(d,l)&&tg(n).type!==Xn){let v=Yd(d,s,o,n);if(Yl(d,v),i==="out-in"&&l.type!==Xn)return o.isLeaving=!0,v.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,d=void 0},fd(a);i==="in-out"&&l.type!==Xn?v.delayLeave=(f,y,S)=>{const I=og(o,d);I[String(d.key)]=d,f[nr]=()=>{y(),f[nr]=void 0,delete c.delayedLeave,d=void 0},c.delayedLeave=()=>{S(),delete c.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return a}}};function ng(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Xn){t=n;break}}return t}const OS=NS;function og(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function Yd(e,t,n,o,r){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:v,onBeforeLeave:f,onLeave:y,onAfterLeave:S,onLeaveCancelled:I,onBeforeAppear:U,onAppear:O,onAfterAppear:$,onAppearCancelled:q}=t,M=String(e.key),pe=og(n,e),ue=(ye,Pe)=>{ye&&sr(ye,o,9,Pe)},V=(ye,Pe)=>{const ge=Pe[1];ue(ye,Pe),ot(ye)?ye.every(Z=>Z.length<=1)&&ge():ye.length<=1&&ge()},ie={mode:s,persisted:i,beforeEnter(ye){let Pe=l;if(!n.isMounted)if(a)Pe=U||l;else return;ye[nr]&&ye[nr](!0);const ge=pe[M];ge&&pi(e,ge)&&ge.el[nr]&&ge.el[nr](),ue(Pe,[ye])},enter(ye){if(pe[M]===e)return;let Pe=c,ge=d,Z=v;if(!n.isMounted)if(a)Pe=O||c,ge=$||d,Z=q||v;else return;let me=!1;ye[El]=Ae=>{me||(me=!0,Ae?ue(Z,[ye]):ue(ge,[ye]),ie.delayedLeave&&ie.delayedLeave(),ye[El]=void 0)};const oe=ye[El].bind(null,!1);Pe?V(Pe,[ye,oe]):oe()},leave(ye,Pe){const ge=String(e.key);if(ye[El]&&ye[El](!0),n.isUnmounting)return Pe();ue(f,[ye]);let Z=!1;ye[nr]=oe=>{Z||(Z=!0,Pe(),oe?ue(I,[ye]):ue(S,[ye]),ye[nr]=void 0,pe[ge]===e&&delete pe[ge])};const me=ye[nr].bind(null,!1);pe[ge]=e,y?V(y,[ye,me]):me()},clone(ye){const Pe=Yd(ye,t,n,o,r);return r&&r(Pe),Pe}};return ie}function fd(e){if(ru(e))return e=Us(e),e.children=null,e}function oh(e){if(!ru(e))return Zv(e.type)&&e.children?ng(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&&pt(n.default))return n.default()}}function Yl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Yl(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 rg(e,t=!1,n){let o=[],r=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===ct?(s.patchFlag&128&&r++,o=o.concat(rg(s.children,t,i))):(t||s.type!==Xn)&&o.push(i!=null?Us(s,{key:i}):s)}if(r>1)for(let a=0;a<o.length;a++)o[a].patchFlag=-2;return o}function vn(e,t){return pt(e)?mn({name:e.name},t,{setup:e}):e}function Df(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function rh(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Yu=new WeakMap;function Ul(e,t,n,o,r=!1){if(ot(e)){e.forEach((I,U)=>Ul(I,t&&(ot(t)?t[U]:t),n,o,r));return}if(Xi(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&Ul(e,t,n,o.component.subTree);return}const a=o.shapeFlag&4?Tc(o.component):o.el,s=r?null:a,{i,r:l}=e,c=t&&t.r,d=i.refs===Bt?i.refs={}:i.refs,v=i.setupState,f=Rt(v),y=v===Bt?wv:I=>rh(d,I)?!1:Nt(f,I),S=(I,U)=>!(U&&rh(d,U));if(c!=null&&c!==l){if(ah(t),Kt(c))d[c]=null,y(c)&&(v[c]=null);else if(jn(c)){const I=t;S(c,I.k)&&(c.value=null),I.k&&(d[I.k]=null)}}if(pt(l))nu(l,i,12,[s,d]);else{const I=Kt(l),U=jn(l);if(I||U){const O=()=>{if(e.f){const $=I?y(l)?v[l]:d[l]:S()||!e.k?l.value:d[e.k];if(r)ot($)&&Af($,a);else if(ot($))$.includes(a)||$.push(a);else if(I)d[l]=[a],y(l)&&(v[l]=d[l]);else{const q=[a];S(l,e.k)&&(l.value=q),e.k&&(d[e.k]=q)}}else I?(d[l]=s,y(l)&&(v[l]=s)):U&&(S(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const $=()=>{O(),Yu.delete(e)};$.id=-1,Yu.set(e,$),io($,n)}else ah(e),O()}}}function ah(e){const t=Yu.get(e);t&&(t.flags|=8,Yu.delete(e))}const sh=e=>e.nodeType===8;mc().requestIdleCallback;mc().cancelIdleCallback;function $S(e,t){if(sh(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(sh(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const Xi=e=>!!e.type.__asyncLoader;function Cr(e){pt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=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 S;return c||(S=c=t().catch(I=>{if(I=I instanceof Error?I:new Error(String(I)),l)return new Promise((U,O)=>{l(I,()=>U(f()),()=>O(I),v+1)});throw I}).then(I=>S!==c&&c?c:(I&&(I.__esModule||I[Symbol.toStringTag]==="Module")&&(I=I.default),d=I,I)))};return vn({name:"AsyncComponentWrapper",__asyncLoader:y,__asyncHydrate(S,I,U){const O=S.isConnected;let $=!1;(I.bu||(I.bu=[])).push(()=>$=!0);const q=()=>{$||!S.parentNode||O&&!S.isConnected||U()},M=a?()=>{const pe=a(q,ue=>$S(S,ue));pe&&(I.bum||(I.bum=[])).push(pe)}:q;d?M():y().then(()=>!I.isUnmounted&&M())},get __asyncResolved(){return d},setup(){const S=zn;if(Df(S),d)return()=>_u(d,S);const I=pe=>{c=null,ou(pe,S,13,!o)};if(i&&S.suspense||ll)return y().then(pe=>()=>_u(pe,S)).catch(pe=>(I(pe),()=>o?Be(o,{error:pe}):null));const U=T(!1),O=T(),$=T(!!r);let q,M;return au(()=>{q!=null&&clearTimeout(q),M!=null&&clearTimeout(M)}),r&&(M=setTimeout(()=>{S.isUnmounted||($.value=!1)},r)),s!=null&&(q=setTimeout(()=>{if(!S.isUnmounted&&!U.value&&!O.value){const pe=new Error(`Async component timed out after ${s}ms.`);I(pe),O.value=pe}},s)),y().then(()=>{S.isUnmounted||(U.value=!0,S.parent&&ru(S.parent.vnode)&&S.parent.update())}).catch(pe=>{if(S.isUnmounted){c=null;return}I(pe),O.value=pe}),()=>{if(U.value&&d)return _u(d,S);if(O.value&&o)return Be(o,{error:O.value});if(n&&!$.value)return _u(n,S)}}})}function _u(e,t){const{ref:n,props:o,children:r,ce:a}=t.vnode,s=Be(e,o,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const ru=e=>e.type.__isKeepAlive;function DS(e,t){ag(e,"a",t)}function FS(e,t){ag(e,"da",t)}function ag(e,t,n=zn){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(yc(t,o,n),n){let r=n.parent;for(;r&&r.parent;)ru(r.parent.vnode)&&BS(o,t,n,r),r=r.parent}}function BS(e,t,n,o){const r=yc(t,e,o,!0);au(()=>{Af(o[t],r)},n)}function yc(e,t,n=zn,o=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Ka();const i=su(n),l=sr(t,n,e,s);return i(),Ya(),l});return o?r.unshift(a):r.push(a),a}}const Xa=e=>(t,n=zn)=>{(!ll||e==="sp")&&yc(e,(...o)=>t(...o),n)},US=Xa("bm"),Ti=Xa("m"),zS=Xa("bu"),HS=Xa("u"),Hs=Xa("bum"),au=Xa("um"),qS=Xa("sp"),WS=Xa("rtg"),GS=Xa("rtc");function VS(e,t=zn){yc("ec",e,t)}const KS="components",sg=Symbol.for("v-ndc");function Ff(e){return Kt(e)?YS(KS,e,!1)||e:e||sg}function YS(e,t,n=!0,o=!1){const r=Hn||zn;if(r){const a=r.type;{const i=M0(a,!1);if(i&&(i===t||i===fo(t)||i===hc(fo(t))))return a}const s=ih(r[e]||a[e],t)||ih(r.appContext[e],t);return!s&&o?a:s}}function ih(e,t){return e&&(e[t]||e[fo(t)]||e[hc(fo(t))])}function on(e,t,n,o){let r;const a=n,s=ot(e);if(s||Kt(e)){const i=s&&gi(e);let l=!1,c=!1;i&&(l=!rr(e),c=Ja(e),e=vc(e)),r=new Array(e.length);for(let d=0,v=e.length;d<v;d++)r[d]=t(l?c?al(Mr(e[d])):Mr(e[d]):e[d],d,void 0,a)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,a)}else if(Ot(e))if(e[Symbol.iterator])r=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);r=new Array(i.length);for(let l=0,c=i.length;l<c;l++){const d=i[l];r[l]=t(e[d],d,l,a)}}else r=[];return r}function Co(e,t,n={},o,r,a){if(Hn.ce||Hn.parent&&Xi(Hn.parent)&&Hn.parent.ce){const c=a!=null&&n.key==null?mn({},n,{key:a}):n,d=Object.keys(c).length>0;return t!=="default"&&(c.name=t),P(),et(ct,null,[Be("slot",c,o)],d?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=Ga.length;P();let l;try{const c=s&&ig(s(n)),d=n.key||a||c&&c.key;l=et(ct,{key:(d&&!Rr(d)?d:`_${t}`)+(!c&&o?"_fb":"")},c||(o?o():[]),c&&e._===1?64:-2)}catch(c){for(let d=Ga.length;d>i;d--)Hf();throw c}finally{s&&s._c&&(s._d=!0)}return l}function ig(e){return e.some(t=>Jl(t)?!(t.type===Xn||t.type===ct&&!ig(t.children)):!0)?e:null}const Jd=e=>e?Ig(e)?Tc(e):Jd(e.parent):null,zl=mn(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=>Jd(e.parent),$root:e=>Jd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ug(e),$forceUpdate:e=>e.f||(e.f=()=>{$f(e.update)}),$nextTick:e=>e.n||(e.n=Dt.bind(e.proxy)),$watch:e=>ES.bind(e)}),pd=(e,t)=>e!==Bt&&!e.__isScriptSetup&&Nt(e,t),JS={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,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 o[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(pd(o,t))return s[t]=1,o[t];if(r!==Bt&&Nt(r,t))return s[t]=2,r[t];if(Nt(a,t))return s[t]=3,a[t];if(n!==Bt&&Nt(n,t))return s[t]=4,n[t];Qd&&(s[t]=0)}}const c=zl[t];let d,v;if(c)return t==="$attrs"&&Qn(e.attrs,"get",""),c(e);if((d=i.__cssModules)&&(d=d[t]))return d;if(n!==Bt&&Nt(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Nt(v,t))return v[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:a}=e;return pd(r,t)?(r[t]=n,!0):o!==Bt&&Nt(o,t)?(o[t]=n,!0):Nt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:a,type:s}},i){let l;return!!(n[i]||e!==Bt&&i[0]!=="$"&&Nt(e,i)||pd(t,i)||Nt(a,i)||Nt(o,i)||Nt(zl,i)||Nt(r.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Nt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function QS(){return XS().slots}function XS(e){const t=Wf();return t.setupContext||(t.setupContext=_g(t))}function lh(e){return ot(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Qd=!0;function ZS(e){const t=ug(e),n=e.proxy,o=e.ctx;Qd=!1,t.beforeCreate&&uh(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:i,provide:l,inject:c,created:d,beforeMount:v,mounted:f,beforeUpdate:y,updated:S,activated:I,deactivated:U,beforeDestroy:O,beforeUnmount:$,destroyed:q,unmounted:M,render:pe,renderTracked:ue,renderTriggered:V,errorCaptured:ie,serverPrefetch:ye,expose:Pe,inheritAttrs:ge,components:Z,directives:me,filters:oe}=t;if(c&&e0(c,o,null),s)for(const Ne in s){const Le=s[Ne];pt(Le)&&(o[Ne]=Le.bind(n))}if(r){const Ne=r.call(n,n);Ot(Ne)&&(e.data=gc(Ne))}if(Qd=!0,a)for(const Ne in a){const Le=a[Ne],Ce=pt(Le)?Le.bind(n,n):pt(Le.get)?Le.get.bind(n,n):ma,Se=!pt(Le)&&pt(Le.set)?Le.set.bind(n):ma,xe=K({get:Ce,set:Se});Object.defineProperty(o,Ne,{enumerable:!0,configurable:!0,get:()=>xe.value,set:Re=>xe.value=Re})}if(i)for(const Ne in i)lg(i[Ne],o,n,Ne);if(l){const Ne=pt(l)?l.call(n):l;Reflect.ownKeys(Ne).forEach(Le=>{Uu(Le,Ne[Le])})}d&&uh(d,e,"c");function De(Ne,Le){ot(Le)?Le.forEach(Ce=>Ne(Ce.bind(n))):Le&&Ne(Le.bind(n))}if(De(US,v),De(Ti,f),De(zS,y),De(HS,S),De(DS,I),De(FS,U),De(VS,ie),De(GS,ue),De(WS,V),De(Hs,$),De(au,M),De(qS,ye),ot(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===ma&&(e.render=pe),ge!=null&&(e.inheritAttrs=ge),Z&&(e.components=Z),me&&(e.directives=me),ye&&Df(e)}function e0(e,t,n=ma){ot(e)&&(e=Xd(e));for(const o in e){const r=e[o];let a;Ot(r)?"default"in r?a=Er(r.from||o,r.default,!0):a=Er(r.from||o):a=Er(r),jn(a)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[o]=a}}function uh(e,t,n){sr(ot(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function lg(e,t,n,o){let r=o.includes(".")?Qv(n,o):()=>n[o];if(Kt(e)){const a=t[e];pt(a)&&nt(r,a)}else if(pt(e))nt(r,e.bind(n));else if(Ot(e))if(ot(e))e.forEach(a=>lg(a,t,n,o));else{const a=pt(e.handler)?e.handler.bind(n):t[e.handler];pt(a)&&nt(r,a,e)}}function ug(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!r.length&&!n&&!o?l=t:(l={},r.length&&r.forEach(c=>Ju(l,c,s,!0)),Ju(l,t,s)),Ot(t)&&a.set(t,l),l}function Ju(e,t,n,o=!1){const{mixins:r,extends:a}=t;a&&Ju(e,a,n,!0),r&&r.forEach(s=>Ju(e,s,n,!0));for(const s in t)if(!(o&&s==="expose")){const i=t0[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const t0={data:ch,props:dh,emits:dh,methods:Nl,computed:Nl,beforeCreate:so,created:so,beforeMount:so,mounted:so,beforeUpdate:so,updated:so,beforeDestroy:so,beforeUnmount:so,destroyed:so,unmounted:so,activated:so,deactivated:so,errorCaptured:so,serverPrefetch:so,components:Nl,directives:Nl,watch:o0,provide:ch,inject:n0};function ch(e,t){return t?e?function(){return mn(pt(e)?e.call(this,this):e,pt(t)?t.call(this,this):t)}:t:e}function n0(e,t){return Nl(Xd(e),Xd(t))}function Xd(e){if(ot(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function so(e,t){return e?[...new Set([].concat(e,t))]:t}function Nl(e,t){return e?mn(Object.create(null),e,t):t}function dh(e,t){return e?ot(e)&&ot(t)?[...new Set([...e,...t])]:mn(Object.create(null),lh(e),lh(t??{})):t}function o0(e,t){if(!e)return t;if(!t)return e;const n=mn(Object.create(null),e);for(const o in t)n[o]=so(e[o],t[o]);return n}function cg(){return{app:null,config:{isNativeTag:wv,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 r0=0;function a0(e,t){return function(o,r=null){pt(o)||(o=mn({},o)),r!=null&&!Ot(r)&&(r=null);const a=cg(),s=new WeakSet,i=[];let l=!1;const c=a.app={_uid:r0++,_component:o,_props:r,_container:null,_context:a,_instance:null,version:N0,get config(){return a.config},set config(d){},use(d,...v){return s.has(d)||(d&&pt(d.install)?(s.add(d),d.install(c,...v)):pt(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||Be(o,r);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,Tc(y.component)}},onUnmount(d){i.push(d)},unmount(){l&&(sr(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=Zi;Zi=c;try{return d()}finally{Zi=v}}};return c}}let Zi=null;const s0=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${fo(t)}Modifiers`]||e[`${zs(t)}Modifiers`];function i0(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Bt;let r=n;const a=t.startsWith("update:"),s=a&&s0(o,t.slice(7));s&&(s.trim&&(r=n.map(d=>Kt(d)?d.trim():d)),s.number&&(r=n.map(Pf)));let i,l=o[i=id(t)]||o[i=id(fo(t))];!l&&a&&(l=o[i=id(zs(t))]),l&&sr(l,e,6,r);const c=o[i+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,sr(c,e,6,r)}}const l0=new WeakMap;function dg(e,t,n=!1){const o=n?l0:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const a=e.emits;let s={},i=!1;if(!pt(e)){const l=c=>{const d=dg(c,t,!0);d&&(i=!0,mn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(Ot(e)&&o.set(e,null),null):(ot(a)?a.forEach(l=>s[l]=null):mn(s,a),Ot(e)&&o.set(e,s),s)}function wc(e,t){return!e||!cc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Nt(e,t[0].toLowerCase()+t.slice(1))||Nt(e,zs(t))||Nt(e,t))}function fh(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[a],slots:s,attrs:i,emit:l,render:c,renderCache:d,props:v,data:f,setupState:y,ctx:S,inheritAttrs:I}=e,U=Ku(e);let O,$;try{if(n.shapeFlag&4){const M=r||o,pe=M;O=pa(c.call(pe,M,d,v,y,f,S)),$=i}else{const M=t;O=pa(M.length>1?M(v,{attrs:i,slots:s,emit:l}):M(v,null)),$=t.props?i:u0(i)}}catch(M){Ga.length=0,ou(M,e,1),O=Be(Xn)}let q=O;if($&&I!==!1){const M=Object.keys($),{shapeFlag:pe}=q;M.length&&pe&7&&(a&&M.some(dc)&&($=c0($,a)),q=Us(q,$,!1,!0))}return n.dirs&&(q=Us(q,null,!1,!0),q.dirs=q.dirs?q.dirs.concat(n.dirs):n.dirs),n.transition&&Yl(q,n.transition),O=q,Ku(U),O}const u0=e=>{let t;for(const n in e)(n==="class"||n==="style"||cc(n))&&((t||(t={}))[n]=e[n]);return t},c0=(e,t)=>{const n={};for(const o in e)(!dc(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function d0(e,t,n){const{props:o,children:r,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 o?ph(o,s,c):!!s;if(l&8){const d=t.dynamicProps;for(let v=0;v<d.length;v++){const f=d[v];if(fg(s,o,f)&&!wc(c,f))return!0}}}else return(r||i)&&(!i||!i.$stable)?!0:o===s?!1:o?s?ph(o,s,c):!0:!!s;return!1}function ph(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const a=o[r];if(fg(t,e,a)&&!wc(n,a))return!0}return!1}function fg(e,t,n){const o=e[n],r=t[n];return n==="style"&&Ot(o)&&Ot(r)?!tu(o,r):o!==r}function f0({vnode:e,parent:t,suspense:n},o){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=o,e=r),r===e)(e=t.vnode).el=o,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=o)}const pg={},hg=()=>Object.create(pg),mg=e=>Object.getPrototypeOf(e)===pg;function p0(e,t,n,o=!1){const r={},a=hg();e.propsDefaults=Object.create(null),vg(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=o?r:zv(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function h0(e,t,n,o){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,i=Rt(r),[l]=e.propsOptions;let c=!1;if((o||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(wc(e.emitsOptions,f))continue;const y=t[f];if(l)if(Nt(a,f))y!==a[f]&&(a[f]=y,c=!0);else{const S=fo(f);r[S]=Zd(l,i,S,y,e,!1)}else y!==a[f]&&(a[f]=y,c=!0)}}}else{vg(e,t,r,a)&&(c=!0);let d;for(const v in i)(!t||!Nt(t,v)&&((d=zs(v))===v||!Nt(t,d)))&&(l?n&&(n[v]!==void 0||n[d]!==void 0)&&(r[v]=Zd(l,i,v,void 0,e,!0)):delete r[v]);if(a!==i)for(const v in a)(!t||!Nt(t,v))&&(delete a[v],c=!0)}c&&Ha(e.attrs,"set","")}function vg(e,t,n,o){const[r,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Dl(l))continue;const c=t[l];let d;r&&Nt(r,d=fo(l))?!a||!a.includes(d)?n[d]=c:(i||(i={}))[d]=c:wc(e.emitsOptions,l)||(!(l in o)||c!==o[l])&&(o[l]=c,s=!0)}if(a){const l=Rt(n),c=i||Bt;for(let d=0;d<a.length;d++){const v=a[d];n[v]=Zd(r,l,v,c[v],e,!Nt(c,v))}}return s}function Zd(e,t,n,o,r,a){const s=e[n];if(s!=null){const i=Nt(s,"default");if(i&&o===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&pt(l)){const{propsDefaults:c}=r;if(n in c)o=c[n];else{const d=su(r);o=c[n]=l.call(null,t),d()}}else o=l;r.ce&&r.ce._setProp(n,o)}s[0]&&(a&&!i?o=!1:s[1]&&(o===""||o===zs(n))&&(o=!0))}return o}const m0=new WeakMap;function gg(e,t,n=!1){const o=n?m0:t.propsCache,r=o.get(e);if(r)return r;const a=e.props,s={},i=[];let l=!1;if(!pt(e)){const d=v=>{l=!0;const[f,y]=gg(v,t,!0);mn(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 Ot(e)&&o.set(e,Yi),Yi;if(ot(a))for(let d=0;d<a.length;d++){const v=fo(a[d]);hh(v)&&(s[v]=Bt)}else if(a)for(const d in a){const v=fo(d);if(hh(v)){const f=a[d],y=s[v]=ot(f)||pt(f)?{type:f}:mn({},f),S=y.type;let I=!1,U=!0;if(ot(S))for(let O=0;O<S.length;++O){const $=S[O],q=pt($)&&$.name;if(q==="Boolean"){I=!0;break}else q==="String"&&(U=!1)}else I=pt(S)&&S.name==="Boolean";y[0]=I,y[1]=U,(I||Nt(y,"default"))&&i.push(v)}}const c=[s,i];return Ot(e)&&o.set(e,c),c}function hh(e){return e[0]!=="$"&&!Dl(e)}const Bf=e=>e==="_"||e==="_ctx"||e==="$stable",Uf=e=>ot(e)?e.map(pa):[pa(e)],v0=(e,t,n)=>{if(t._n)return t;const o=ft((...r)=>Uf(t(...r)),n);return o._c=!1,o},yg=(e,t,n)=>{const o=e._ctx;for(const r in e){if(Bf(r))continue;const a=e[r];if(pt(a))t[r]=v0(r,a,o);else if(a!=null){const s=Uf(a);t[r]=()=>s}}},wg=(e,t)=>{const n=Uf(t);e.slots.default=()=>n},bg=(e,t,n)=>{for(const o in t)(n||!Bf(o))&&(e[o]=t[o])},g0=(e,t,n)=>{const o=e.slots=hg();if(e.vnode.shapeFlag&32){const r=t._;r?(bg(o,t,n),n&&Cv(o,"_",r,!0)):yg(t,o)}else t&&wg(e,t)},y0=(e,t,n)=>{const{vnode:o,slots:r}=e;let a=!0,s=Bt;if(o.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:bg(r,t,n):(a=!t.$stable,yg(t,r)),s=t}else t&&(wg(e,t),s={default:1});if(a)for(const i in r)!Bf(i)&&s[i]==null&&delete r[i]},io=C0;function w0(e){return b0(e)}function b0(e,t){const n=mc();n.__VUE__=!0;const{insert:o,remove:r,patchProp:a,createElement:s,createText:i,createComment:l,setText:c,setElementText:d,parentNode:v,nextSibling:f,setScopeId:y=ma,insertStaticContent:S}=e,I=(_,R,H,le=null,ne=null,ae=null,_e=void 0,Oe=null,Ie=!!R.dynamicChildren)=>{if(_===R)return;_&&!pi(_,R)&&(le=N(_),Re(_,ne,ae,!0),_=null),R.patchFlag===-2&&(Ie=!1,R.dynamicChildren=null);const{type:he,ref:Ke,shapeFlag:$e}=R;switch(he){case bc:U(_,R,H,le);break;case Xn:O(_,R,H,le);break;case md:_==null&&$(R,H,le,_e);break;case ct:Z(_,R,H,le,ne,ae,_e,Oe,Ie);break;default:$e&1?pe(_,R,H,le,ne,ae,_e,Oe,Ie):$e&6?me(_,R,H,le,ne,ae,_e,Oe,Ie):($e&64||$e&128)&&he.process(_,R,H,le,ne,ae,_e,Oe,Ie,je)}Ke!=null&&ne?Ul(Ke,_&&_.ref,ae,R||_,!R):Ke==null&&_&&_.ref!=null&&Ul(_.ref,null,ae,_,!0)},U=(_,R,H,le)=>{if(_==null)o(R.el=i(R.children),H,le);else{const ne=R.el=_.el;R.children!==_.children&&c(ne,R.children)}},O=(_,R,H,le)=>{_==null?o(R.el=l(R.children||""),H,le):R.el=_.el},$=(_,R,H,le)=>{[_.el,_.anchor]=S(_.children,R,H,le,_.el,_.anchor)},q=({el:_,anchor:R},H,le)=>{let ne;for(;_&&_!==R;)ne=f(_),o(_,H,le),_=ne;o(R,H,le)},M=({el:_,anchor:R})=>{let H;for(;_&&_!==R;)H=f(_),r(_),_=H;r(R)},pe=(_,R,H,le,ne,ae,_e,Oe,Ie)=>{if(R.type==="svg"?_e="svg":R.type==="math"&&(_e="mathml"),_==null)ue(R,H,le,ne,ae,_e,Oe,Ie);else{const he=_.el&&_.el._isVueCE?_.el:null;try{he&&he._beginPatch(),ye(_,R,ne,ae,_e,Oe,Ie)}finally{he&&he._endPatch()}}},ue=(_,R,H,le,ne,ae,_e,Oe)=>{let Ie,he;const{props:Ke,shapeFlag:$e,transition:We,dirs:Ge}=_;if(Ie=_.el=s(_.type,ae,Ke&&Ke.is,Ke),$e&8?d(Ie,_.children):$e&16&&ie(_.children,Ie,null,le,ne,hd(_,ae),_e,Oe),Ge&&ai(_,null,le,"created"),V(Ie,_,_.scopeId,_e,le),Ke){for(const wt in Ke)wt!=="value"&&!Dl(wt)&&a(Ie,wt,null,Ke[wt],ae,le);"value"in Ke&&a(Ie,"value",null,Ke.value,ae),(he=Ke.onVnodeBeforeMount)&&ca(he,le,_)}Ge&&ai(_,null,le,"beforeMount");const dt=T0(ne,We);dt&&We.beforeEnter(Ie),o(Ie,R,H),((he=Ke&&Ke.onVnodeMounted)||dt||Ge)&&io(()=>{try{he&&ca(he,le,_),dt&&We.enter(Ie),Ge&&ai(_,null,le,"mounted")}finally{}},ne)},V=(_,R,H,le,ne)=>{if(H&&y(_,H),le)for(let ae=0;ae<le.length;ae++)y(_,le[ae]);if(ne){let ae=ne.subTree;if(R===ae||Cg(ae.type)&&(ae.ssContent===R||ae.ssFallback===R)){const _e=ne.vnode;V(_,_e,_e.scopeId,_e.slotScopeIds,ne.parent)}}},ie=(_,R,H,le,ne,ae,_e,Oe,Ie=0)=>{for(let he=Ie;he<_.length;he++){const Ke=_[he]=Oe?za(_[he]):pa(_[he]);I(null,Ke,R,H,le,ne,ae,_e,Oe)}},ye=(_,R,H,le,ne,ae,_e)=>{const Oe=R.el=_.el;let{patchFlag:Ie,dynamicChildren:he,dirs:Ke}=R;Ie|=_.patchFlag&16;const $e=_.props||Bt,We=R.props||Bt;let Ge;if(H&&si(H,!1),(Ge=We.onVnodeBeforeUpdate)&&ca(Ge,H,R,_),Ke&&ai(R,_,H,"beforeUpdate"),H&&si(H,!0),he&&(!_.dynamicChildren||_.dynamicChildren.length!==he.length)&&(Ie=0,_e=!1,he=null),($e.innerHTML&&We.innerHTML==null||$e.textContent&&We.textContent==null)&&d(Oe,""),he?Pe(_.dynamicChildren,he,Oe,H,le,hd(R,ne),ae):_e||Le(_,R,Oe,null,H,le,hd(R,ne),ae,!1),Ie>0){if(Ie&16)ge(Oe,$e,We,H,ne);else if(Ie&2&&$e.class!==We.class&&a(Oe,"class",null,We.class,ne),Ie&4&&a(Oe,"style",$e.style,We.style,ne),Ie&8){const dt=R.dynamicProps;for(let wt=0;wt<dt.length;wt++){const tt=dt[wt],st=$e[tt],Y=We[tt];(Y!==st||tt==="value")&&a(Oe,tt,st,Y,ne,H)}}Ie&1&&_.children!==R.children&&d(Oe,R.children)}else!_e&&he==null&&ge(Oe,$e,We,H,ne);((Ge=We.onVnodeUpdated)||Ke)&&io(()=>{Ge&&ca(Ge,H,R,_),Ke&&ai(R,_,H,"updated")},le)},Pe=(_,R,H,le,ne,ae,_e)=>{for(let Oe=0;Oe<R.length;Oe++){const Ie=_[Oe],he=R[Oe],Ke=Ie.el&&(Ie.type===ct||!pi(Ie,he)||Ie.shapeFlag&198)?v(Ie.el):H;I(Ie,he,Ke,null,le,ne,ae,_e,!0)}},ge=(_,R,H,le,ne)=>{if(R!==H){if(R!==Bt)for(const ae in R)!Dl(ae)&&!(ae in H)&&a(_,ae,R[ae],null,ne,le);for(const ae in H){if(Dl(ae))continue;const _e=H[ae],Oe=R[ae];_e!==Oe&&ae!=="value"&&a(_,ae,Oe,_e,ne,le)}"value"in H&&a(_,"value",R.value,H.value,ne)}},Z=(_,R,H,le,ne,ae,_e,Oe,Ie)=>{const he=R.el=_?_.el:i(""),Ke=R.anchor=_?_.anchor:i("");let{patchFlag:$e,dynamicChildren:We,slotScopeIds:Ge}=R;Ge&&(Oe=Oe?Oe.concat(Ge):Ge),_==null?(o(he,H,le),o(Ke,H,le),ie(R.children||[],H,Ke,ne,ae,_e,Oe,Ie)):$e>0&&$e&64&&We&&_.dynamicChildren&&_.dynamicChildren.length===We.length?(Pe(_.dynamicChildren,We,H,ne,ae,_e,Oe),(R.key!=null||ne&&R===ne.subTree)&&zf(_,R,!0)):Le(_,R,H,Ke,ne,ae,_e,Oe,Ie)},me=(_,R,H,le,ne,ae,_e,Oe,Ie)=>{R.slotScopeIds=Oe,_==null?R.shapeFlag&512?ne.ctx.activate(R,H,le,_e,Ie):oe(R,H,le,ne,ae,_e,Ie):Ae(_,R,Ie)},oe=(_,R,H,le,ne,ae,_e)=>{const Oe=_.component=_0(_,le,ne);if(ru(_)&&(Oe.ctx.renderer=je),P0(Oe,!1,_e),Oe.asyncDep){if(ne&&ne.registerDep(Oe,De,_e),!_.el){const Ie=Oe.subTree=Be(Xn);O(null,Ie,R,H),_.placeholder=Ie.el}}else De(Oe,_,R,H,ne,ae,_e)},Ae=(_,R,H)=>{const le=R.component=_.component;if(d0(_,R,H))if(le.asyncDep&&!le.asyncResolved){Ne(le,R,H);return}else le.next=R,le.update();else R.el=_.el,le.vnode=R},De=(_,R,H,le,ne,ae,_e)=>{const Oe=()=>{if(_.isMounted){let{next:$e,bu:We,u:Ge,parent:dt,vnode:wt}=_;{const Te=Tg(_);if(Te){$e&&($e.el=wt.el,Ne(_,$e,_e)),Te.asyncDep.then(()=>{io(()=>{_.isUnmounted||he()},ne)});return}}let tt=$e,st;si(_,!1),$e?($e.el=wt.el,Ne(_,$e,_e)):$e=wt,We&&Bu(We),(st=$e.props&&$e.props.onVnodeBeforeUpdate)&&ca(st,dt,$e,wt),si(_,!0);const Y=fh(_),de=_.subTree;_.subTree=Y,I(de,Y,v(de.el),N(de),_,ne,ae),$e.el=Y.el,tt===null&&f0(_,Y.el),Ge&&io(Ge,ne),(st=$e.props&&$e.props.onVnodeUpdated)&&io(()=>ca(st,dt,$e,wt),ne)}else{let $e;const{el:We,props:Ge}=R,{bm:dt,m:wt,parent:tt,root:st,type:Y}=_,de=Xi(R);si(_,!1),dt&&Bu(dt),!de&&($e=Ge&&Ge.onVnodeBeforeMount)&&ca($e,tt,R),si(_,!0);{st.ce&&st.ce._hasShadowRoot()&&st.ce._injectChildStyle(Y,_.parent?_.parent.type:void 0);const Te=_.subTree=fh(_);I(null,Te,H,le,_,ne,ae),R.el=Te.el}if(wt&&io(wt,ne),!de&&($e=Ge&&Ge.onVnodeMounted)){const Te=R;io(()=>ca($e,tt,Te),ne)}(R.shapeFlag&256||tt&&Xi(tt.vnode)&&tt.vnode.shapeFlag&256)&&_.a&&io(_.a,ne),_.isMounted=!0,R=H=le=null}};_.scope.on();const Ie=_.effect=new _v(Oe);_.scope.off();const he=_.update=Ie.run.bind(Ie),Ke=_.job=Ie.runIfDirty.bind(Ie);Ke.i=_,Ke.id=_.uid,Ie.scheduler=()=>$f(Ke),si(_,!0),he()},Ne=(_,R,H)=>{R.component=_;const le=_.vnode.props;_.vnode=R,_.next=null,h0(_,R.props,le,H),y0(_,R.children,H),Ka(),eh(_),Ya()},Le=(_,R,H,le,ne,ae,_e,Oe,Ie=!1)=>{const he=_&&_.children,Ke=_?_.shapeFlag:0,$e=R.children,{patchFlag:We,shapeFlag:Ge}=R;if(We>0){if(We&128){Se(he,$e,H,le,ne,ae,_e,Oe,Ie);return}else if(We&256){Ce(he,$e,H,le,ne,ae,_e,Oe,Ie);return}}Ge&8?(Ke&16&&ce(he,ne,ae),$e!==he&&d(H,$e)):Ke&16?Ge&16?Se(he,$e,H,le,ne,ae,_e,Oe,Ie):ce(he,ne,ae,!0):(Ke&8&&d(H,""),Ge&16&&ie($e,H,le,ne,ae,_e,Oe,Ie))},Ce=(_,R,H,le,ne,ae,_e,Oe,Ie)=>{_=_||Yi,R=R||Yi;const he=_.length,Ke=R.length,$e=Math.min(he,Ke);let We;for(We=0;We<$e;We++){const Ge=R[We]=Ie?za(R[We]):pa(R[We]);I(_[We],Ge,H,null,ne,ae,_e,Oe,Ie)}he>Ke?ce(_,ne,ae,!0,!1,$e):ie(R,H,le,ne,ae,_e,Oe,Ie,$e)},Se=(_,R,H,le,ne,ae,_e,Oe,Ie)=>{let he=0;const Ke=R.length;let $e=_.length-1,We=Ke-1;for(;he<=$e&&he<=We;){const Ge=_[he],dt=R[he]=Ie?za(R[he]):pa(R[he]);if(pi(Ge,dt))I(Ge,dt,H,null,ne,ae,_e,Oe,Ie);else break;he++}for(;he<=$e&&he<=We;){const Ge=_[$e],dt=R[We]=Ie?za(R[We]):pa(R[We]);if(pi(Ge,dt))I(Ge,dt,H,null,ne,ae,_e,Oe,Ie);else break;$e--,We--}if(he>$e){if(he<=We){const Ge=We+1,dt=Ge<Ke?R[Ge].el:le;for(;he<=We;)I(null,R[he]=Ie?za(R[he]):pa(R[he]),H,dt,ne,ae,_e,Oe,Ie),he++}}else if(he>We)for(;he<=$e;)Re(_[he],ne,ae,!0),he++;else{const Ge=he,dt=he,wt=new Map;for(he=dt;he<=We;he++){const yt=R[he]=Ie?za(R[he]):pa(R[he]);yt.key!=null&&wt.set(yt.key,he)}let tt,st=0;const Y=We-dt+1;let de=!1,Te=0;const ze=new Array(Y);for(he=0;he<Y;he++)ze[he]=0;for(he=Ge;he<=$e;he++){const yt=_[he];if(st>=Y){Re(yt,ne,ae,!0);continue}let $t;if(yt.key!=null)$t=wt.get(yt.key);else for(tt=dt;tt<=We;tt++)if(ze[tt-dt]===0&&pi(yt,R[tt])){$t=tt;break}$t===void 0?Re(yt,ne,ae,!0):(ze[$t-dt]=he+1,$t>=Te?Te=$t:de=!0,I(yt,R[$t],H,null,ne,ae,_e,Oe,Ie),st++)}const bt=de?S0(ze):Yi;for(tt=bt.length-1,he=Y-1;he>=0;he--){const yt=dt+he,$t=R[yt],Lr=R[yt+1],Qt=yt+1<Ke?Lr.el||Sg(Lr):le;ze[he]===0?I(null,$t,H,Qt,ne,ae,_e,Oe,Ie):de&&(tt<0||he!==bt[tt]?xe($t,H,Qt,2):tt--)}}},xe=(_,R,H,le,ne=null)=>{const{el:ae,type:_e,transition:Oe,children:Ie,shapeFlag:he}=_;if(he&6){xe(_.component.subTree,R,H,le);return}if(he&128){_.suspense.move(R,H,le);return}if(he&64){_e.move(_,R,H,je);return}if(_e===ct){o(ae,R,H);for(let $e=0;$e<Ie.length;$e++)xe(Ie[$e],R,H,le);o(_.anchor,R,H);return}if(_e===md){q(_,R,H);return}if(le!==2&&he&1&&Oe)if(le===0)Oe.persisted&&!ae[nr]?o(ae,R,H):(Oe.beforeEnter(ae),o(ae,R,H),io(()=>Oe.enter(ae),ne));else{const{leave:$e,delayLeave:We,afterLeave:Ge}=Oe,dt=()=>{_.ctx.isUnmounted?r(ae):o(ae,R,H)},wt=()=>{const tt=ae._isLeaving||!!ae[nr];ae._isLeaving&&ae[nr](!0),Oe.persisted&&!tt?dt():$e(ae,()=>{dt(),Ge&&Ge()})};We?We(ae,dt,wt):wt()}else o(ae,R,H)},Re=(_,R,H,le=!1,ne=!1)=>{const{type:ae,props:_e,ref:Oe,children:Ie,dynamicChildren:he,shapeFlag:Ke,patchFlag:$e,dirs:We,cacheIndex:Ge,memo:dt}=_;if($e===-2&&(ne=!1),Oe!=null&&(Ka(),Ul(Oe,null,H,_,!0),Ya()),Ge!=null&&(R.renderCache[Ge]=void 0),Ke&256){R.ctx.deactivate(_);return}const wt=Ke&1&&We,tt=!Xi(_);let st;if(tt&&(st=_e&&_e.onVnodeBeforeUnmount)&&ca(st,R,_),Ke&6)at(_.component,H,le);else{if(Ke&128){_.suspense.unmount(H,le);return}wt&&ai(_,null,R,"beforeUnmount"),Ke&64?_.type.remove(_,R,H,je,le):he&&!he.hasOnce&&(ae!==ct||$e>0&&$e&64)?ce(he,R,H,!1,!0):(ae===ct&&$e&384||!ne&&Ke&16)&&ce(Ie,R,H),le&&Je(_)}const Y=dt!=null&&Ge==null;(tt&&(st=_e&&_e.onVnodeUnmounted)||wt||Y)&&io(()=>{st&&ca(st,R,_),wt&&ai(_,null,R,"unmounted"),Y&&(_.el=null)},H)},Je=_=>{const{type:R,el:H,anchor:le,transition:ne}=_;if(R===ct){Xe(H,le);return}if(R===md){M(_);return}const ae=()=>{r(H),ne&&!ne.persisted&&ne.afterLeave&&ne.afterLeave()};if(_.shapeFlag&1&&ne&&!ne.persisted){const{leave:_e,delayLeave:Oe}=ne,Ie=()=>_e(H,ae);Oe?Oe(_.el,ae,Ie):Ie()}else ae()},Xe=(_,R)=>{let H;for(;_!==R;)H=f(_),r(_),_=H;r(R)},at=(_,R,H)=>{const{bum:le,scope:ne,job:ae,subTree:_e,um:Oe,m:Ie,a:he}=_;mh(Ie),mh(he),le&&Bu(le),ne.stop(),ae&&(ae.flags|=8,Re(_e,_,R,H)),Oe&&io(Oe,R),io(()=>{_.isUnmounted=!0},R)},ce=(_,R,H,le=!1,ne=!1,ae=0)=>{for(let _e=ae;_e<_.length;_e++)Re(_[_e],R,H,le,ne)},N=_=>{if(_.shapeFlag&6)return N(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const R=f(_.anchor||_.el),H=R&&R[Xv];return H?f(H):R};let re=!1;const se=(_,R,H)=>{let le;_==null?R._vnode&&(Re(R._vnode,null,null,!0),le=R._vnode.component):I(R._vnode||null,_,R,null,null,null,H),R._vnode=_,re||(re=!0,eh(le),Vv(),re=!1)},je={p:I,um:Re,m:xe,r:Je,mt:oe,mc:ie,pc:Le,pbc:Pe,n:N,o:e};return{render:se,hydrate:void 0,createApp:a0(se)}}function hd({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 si({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function T0(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function zf(e,t,n=!1){const o=e.children,r=t.children;if(ot(o)&&ot(r))for(let a=0;a<o.length;a++){const s=o[a];let i=r[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=r[a]=za(r[a]),i.el=s.el),!n&&i.patchFlag!==-2&&zf(s,i)),i.type===bc&&(i.patchFlag===-1&&(i=r[a]=za(i)),i.el=s.el),i.type===Xn&&!i.el&&(i.el=s.el)}}function S0(e){const t=e.slice(),n=[0];let o,r,a,s,i;const l=e.length;for(o=0;o<l;o++){const c=e[o];if(c!==0){if(r=n[n.length-1],e[r]<c){t[o]=r,n.push(o);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[o]=n[a-1]),n[a]=o)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function Tg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Tg(t)}function mh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Sg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Sg(t.subTree):null}const Cg=e=>e.__isSuspense;function C0(e,t){t&&t.pendingBranch?ot(e)?t.effects.push(...e):t.effects.push(e):AS(e)}const ct=Symbol.for("v-fgt"),bc=Symbol.for("v-txt"),Xn=Symbol.for("v-cmt"),md=Symbol.for("v-stc"),Ga=[];let co=null;function P(e=!1){Ga.push(co=e?null:[])}function Hf(){Ga.pop(),co=Ga[Ga.length-1]||null}let il=1;function Qu(e,t=!1){il+=e,e<0&&co&&t&&(co.hasOnce=!0)}function xg(e){return e.dynamicChildren=il>0?co||Yi:null,Hf(),il>0&&co&&co.push(e),e}function B(e,t,n,o,r,a){return xg(w(e,t,n,o,r,a,!0))}function et(e,t,n,o,r){return xg(Be(e,t,n,o,r,!0))}function Jl(e){return e?e.__v_isVNode===!0:!1}function pi(e,t){return e.type===t.type&&e.key===t.key}const kg=({key:e})=>e??null,zu=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Kt(e)||jn(e)||pt(e)?{i:Hn,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,o=0,r=null,a=e===ct?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&kg(t),ref:t&&zu(t),scopeId:Yv,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:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Hn};return i?(Xu(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Kt(n)?8:16),il>0&&!s&&co&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&co.push(l),l}const Be=x0;function x0(e,t=null,n=null,o=0,r=null,a=!1){if((!e||e===sg)&&(e=Xn),Jl(e)){const i=Us(e,t,!0);return n&&Xu(i,n),il>0&&!a&&co&&(i.shapeFlag&6?co[co.indexOf(e)]=i:co.push(i)),i.patchFlag=-2,i}if(j0(e)&&(e=e.__vccOpts),t){t=k0(t);let{class:i,style:l}=t;i&&!Kt(i)&&(t.class=ut(i)),Ot(l)&&(Of(l)&&!ot(l)&&(l=mn({},l)),t.style=or(l))}const s=Kt(e)?1:Cg(e)?128:Zv(e)?64:Ot(e)?4:pt(e)?2:0;return w(e,t,n,o,r,s,a,!0)}function k0(e){return e?Of(e)||mg(e)?mn({},e):e:null}function Us(e,t,n=!1,o=!1){const{props:r,ref:a,patchFlag:s,children:i,transition:l}=e,c=t?qf(r||{},t):r,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&kg(c),ref:t&&t.ref?n&&a?ot(a)?a.concat(zu(t)):[a,zu(t)]:zu(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!==ct?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&&Us(e.ssContent),ssFallback:e.ssFallback&&Us(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&o&&Yl(d,l.clone(d)),d}function Os(e=" ",t=0){return Be(bc,null,e,t)}function ve(e="",t=!1){return t?(P(),et(Xn,null,e)):Be(Xn,null,e)}function pa(e){return e==null||typeof e=="boolean"?Be(Xn):ot(e)?Be(ct,null,e.slice()):Jl(e)?za(e):Be(bc,null,String(e))}function za(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Us(e)}function Xu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(ot(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Xu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!mg(t)?t._ctx=Hn:r===3&&Hn&&(Hn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(pt(t)){if(o&65){Xu(e,{default:t});return}t={default:t,_ctx:Hn},n=32}else t=String(t),o&64?(n=16,t=[Os(t)]):n=8;e.children=t,e.shapeFlag|=n}function qf(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const r in o)if(r==="class")t.class!==o.class&&(t.class=ut([t.class,o.class]));else if(r==="style")t.style=or([t.style,o.style]);else if(cc(r)){const a=t[r],s=o[r];s&&a!==s&&!(ot(a)&&a.includes(s))?t[r]=a?[].concat(a,s):s:s==null&&a==null&&!dc(r)&&(t[r]=s)}else r!==""&&(t[r]=o[r])}return t}function ca(e,t,n,o=null){sr(e,t,7,[n,o])}const I0=cg();let A0=0;function _0(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||I0,a={uid:A0++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new XT(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:gg(o,r),emitsOptions:dg(o,r),emit:null,emitted:null,propsDefaults:Bt,inheritAttrs:o.inheritAttrs,ctx:Bt,data:Bt,props:Bt,attrs:Bt,slots:Bt,refs:Bt,setupState:Bt,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=i0.bind(null,a),e.ce&&e.ce(a),a}let zn=null;const Wf=()=>zn||Hn;let Zu,ef;{const e=mc(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};Zu=t("__VUE_INSTANCE_SETTERS__",n=>zn=n),ef=t("__VUE_SSR_SETTERS__",n=>ll=n)}const su=e=>{const t=zn;return Zu(e),e.scope.on(),()=>{e.scope.off(),Zu(t)}},vh=()=>{zn&&zn.scope.off(),Zu(null)};function Ig(e){return e.vnode.shapeFlag&4}let ll=!1;function P0(e,t=!1,n=!1){t&&ef(t);const{props:o,children:r}=e.vnode,a=Ig(e);p0(e,o,a,t),g0(e,r,n||t);const s=a?E0(e,t):void 0;return t&&ef(!1),s}function E0(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,JS);const{setup:o}=n;if(o){Ka();const r=e.setupContext=o.length>1?_g(e):null,a=su(e),s=nu(o,e,0,[e.props,r]),i=bv(s);if(Ya(),a(),(i||e.sp)&&!Xi(e)&&Df(e),i){if(s.then(vh,vh),t)return s.then(l=>{gh(e,l)}).catch(l=>{ou(l,e,0)});e.asyncDep=s}else gh(e,s)}else Ag(e)}function gh(e,t,n){pt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ot(t)&&(e.setupState=qv(t)),Ag(e)}function Ag(e,t,n){const o=e.type;e.render||(e.render=o.render||ma);{const r=su(e);Ka();try{ZS(e)}finally{Ya(),r()}}}const R0={get(e,t){return Qn(e,"get",""),e[t]}};function _g(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,R0),slots:e.slots,emit:e.emit,expose:t}}function Tc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(qv(gS(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in zl)return zl[n](e)},has(t,n){return n in t||n in zl}})):e.proxy}function M0(e,t=!0){return pt(e)?e.displayName||e.name:e.name||t&&e.__name}function j0(e){return pt(e)&&"__vccOpts"in e}const K=(e,t)=>SS(e,t,ll);function Gf(e,t,n){try{Qu(-1);const o=arguments.length;return o===2?Ot(t)&&!ot(t)?Jl(t)?Be(e,null,[t]):Be(e,t):Be(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Jl(n)&&(n=[n]),Be(e,t,n))}finally{Qu(1)}}function bF(e,t,n,o){const r=n[o];if(r&&L0(r,e))return r;const a=t();return a.memo=e.slice(),a.cacheIndex=o,n[o]=a}function L0(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(Ir(n[o],t[o]))return!1;return il>0&&co&&co.push(e),!0}const N0="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 tf;const yh=typeof window<"u"&&window.trustedTypes;if(yh)try{tf=yh.createPolicy("vue",{createHTML:e=>e})}catch{}const Pg=tf?e=>tf.createHTML(e):e=>e,O0="http://www.w3.org/2000/svg",$0="http://www.w3.org/1998/Math/MathML",Ua=typeof document<"u"?document:null,wh=Ua&&Ua.createElement("template"),D0={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r=t==="svg"?Ua.createElementNS(O0,e):t==="mathml"?Ua.createElementNS($0,e):n?Ua.createElement(e,{is:n}):Ua.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>Ua.createTextNode(e),createComment:e=>Ua.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ua.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{wh.innerHTML=Pg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const i=wh.content;if(o==="svg"||o==="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]}},_s="transition",Rl="animation",Ql=Symbol("_vtc"),Eg={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},F0=mn({},eg,Eg),B0=e=>(e.displayName="Transition",e.props=F0,e),iu=B0((e,{slots:t})=>Gf(OS,U0(e),t)),ii=(e,t=[])=>{ot(e)?e.forEach(n=>n(...t)):e&&e(...t)},bh=e=>e?ot(e)?e.some(t=>t.length>1):e.length>1:!1;function U0(e){const t={};for(const Z in e)Z in Eg||(t[Z]=e[Z]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,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,S=z0(r),I=S&&S[0],U=S&&S[1],{onBeforeEnter:O,onEnter:$,onEnterCancelled:q,onLeave:M,onLeaveCancelled:pe,onBeforeAppear:ue=O,onAppear:V=$,onAppearCancelled:ie=q}=t,ye=(Z,me,oe,Ae)=>{Z._enterCancelled=Ae,li(Z,me?d:i),li(Z,me?c:s),oe&&oe()},Pe=(Z,me)=>{Z._isLeaving=!1,li(Z,v),li(Z,y),li(Z,f),me&&me()},ge=Z=>(me,oe)=>{const Ae=Z?V:$,De=()=>ye(me,Z,oe);ii(Ae,[me,De]),Th(()=>{li(me,Z?l:a),Da(me,Z?d:i),bh(Ae)||Sh(me,o,I,De)})};return mn(t,{onBeforeEnter(Z){ii(O,[Z]),Da(Z,a),Da(Z,s)},onBeforeAppear(Z){ii(ue,[Z]),Da(Z,l),Da(Z,c)},onEnter:ge(!1),onAppear:ge(!0),onLeave(Z,me){Z._isLeaving=!0;const oe=()=>Pe(Z,me);Da(Z,v),Z._enterCancelled?(Da(Z,f),kh(Z)):(kh(Z),Da(Z,f)),Th(()=>{Z._isLeaving&&(li(Z,v),Da(Z,y),bh(M)||Sh(Z,o,U,oe))}),ii(M,[Z,oe])},onEnterCancelled(Z){ye(Z,!1,void 0,!0),ii(q,[Z])},onAppearCancelled(Z){ye(Z,!0,void 0,!0),ii(ie,[Z])},onLeaveCancelled(Z){Pe(Z),ii(pe,[Z])}})}function z0(e){if(e==null)return null;if(Ot(e))return[vd(e.enter),vd(e.leave)];{const t=vd(e);return[t,t]}}function vd(e){return qT(e)}function Da(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ql]||(e[Ql]=new Set)).add(t)}function li(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[Ql];n&&(n.delete(t),n.size||(e[Ql]=void 0))}function Th(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let H0=0;function Sh(e,t,n,o){const r=e._endId=++H0,a=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=q0(e,t);if(!s)return o();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 q0(e,t){const n=window.getComputedStyle(e),o=S=>(n[S]||"").split(", "),r=o(`${_s}Delay`),a=o(`${_s}Duration`),s=Ch(r,a),i=o(`${Rl}Delay`),l=o(`${Rl}Duration`),c=Ch(i,l);let d=null,v=0,f=0;t===_s?s>0&&(d=_s,v=s,f=a.length):t===Rl?c>0&&(d=Rl,v=c,f=l.length):(v=Math.max(s,c),d=v>0?s>c?_s:Rl:null,f=d?d===_s?a.length:l.length:0);const y=d===_s&&/\b(?:transform|all)(?:,|$)/.test(o(`${_s}Property`).toString());return{type:d,timeout:v,propCount:f,hasTransform:y}}function Ch(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>xh(n)+xh(e[o])))}function xh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function kh(e){return(e?e.ownerDocument:document).body.offsetHeight}function W0(e,t,n){const o=e[Ql];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ec=Symbol("_vod"),Rg=Symbol("_vsh"),TF={name:"show",beforeMount(e,{value:t},{transition:n}){e[ec]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Ml(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),Ml(e,!0),o.enter(e)):o.leave(e,()=>{Ml(e,!1)}):Ml(e,t))},beforeUnmount(e,{value:t}){Ml(e,t)}};function Ml(e,t){e.style.display=t?e[ec]:"none",e[Rg]=!t}const G0=Symbol(""),V0=/(?:^|;)\s*display\s*:/;function K0(e,t,n){const o=e.style,r=Kt(n);let a=!1;if(n&&!r){if(t)if(Kt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Ol(o,i,"")}else for(const s in t)n[s]==null&&Ol(o,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?J0(e,s,!Kt(t)&&t?t[s]:void 0,i)||Ol(o,s,i):Ol(o,s,"")}}else if(r){if(t!==n){const s=o[G0];s&&(n+=";"+s),o.cssText=n,a=V0.test(n)}}else t&&e.removeAttribute("style");ec in e&&(e[ec]=a?o.display:"",e[Rg]&&(o.display="none"))}const Ih=/\s*!important$/;function Ol(e,t,n){if(ot(n))n.forEach(o=>Ol(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=Y0(e,t);Ih.test(n)?e.setProperty(zs(o),n.replace(Ih,""),"important"):e[o]=n}}const Ah=["Webkit","Moz","ms"],gd={};function Y0(e,t){const n=gd[t];if(n)return n;let o=fo(t);if(o!=="filter"&&o in e)return gd[t]=o;o=hc(o);for(let r=0;r<Ah.length;r++){const a=Ah[r]+o;if(a in e)return gd[t]=a}return t}function J0(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Kt(o)&&n===o}const _h="http://www.w3.org/1999/xlink";function Ph(e,t,n,o,r,a=JT(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(_h,t.slice(6,t.length)):e.setAttributeNS(_h,t,n):n==null||a&&!xv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":Rr(n)?String(n):n)}function Eh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Pg(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=xv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(r||t)}function hi(e,t,n,o){e.addEventListener(t,n,o)}function Q0(e,t,n,o){e.removeEventListener(t,n,o)}const Rh=Symbol("_vei");function X0(e,t,n,o,r=null){const a=e[Rh]||(e[Rh]={}),s=a[t];if(o&&s)s.value=o;else{const[i,l]=tC(t);if(o){const c=a[t]=rC(o,r);hi(e,i,c,l)}else s&&(Q0(e,i,s,l),a[t]=void 0)}}const Z0=/(Once|Passive|Capture)$/,eC=/^on:?(?:Once|Passive|Capture)$/;function tC(e){let t,n;for(;(n=e.match(Z0))&&!eC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):zs(e.slice(2)),t]}let yd=0;const nC=Promise.resolve(),oC=()=>yd||(nC.then(()=>yd=0),yd=Date.now());function rC(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(ot(r)){const a=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{a.call(o),o._stopped=!0};const s=r.slice(),i=[o];for(let l=0;l<s.length&&!o._stopped;l++){const c=s[l];c&&sr(c,t,5,i)}}else sr(r,t,5,[o])};return n.value=e,n.attached=oC(),n}const Mh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,aC=(e,t,n,o,r,a)=>{const s=r==="svg";t==="class"?W0(e,o,s):t==="style"?K0(e,n,o):cc(t)?dc(t)||X0(e,t,n,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):sC(e,t,o,s))?(Eh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ph(e,t,o,s,a,t!=="value")):e._isVueCE&&(iC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Kt(o)))?Eh(e,fo(t),o,a,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),Ph(e,t,o,s))};function sC(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Mh(t)&&pt(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 r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Mh(t)&&Kt(n)?!1:t in e}function iC(e,t){const n=e._def.props;if(!n)return!1;const o=fo(t);return Array.isArray(n)?n.some(r=>fo(r)===o):Object.keys(n).some(r=>fo(r)===o)}const tc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ot(t)?n=>Bu(t,n):t};function lC(e){e.target.composing=!0}function jh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const el=Symbol("_assign");function Lh(e,t,n){return t&&(e=e.trim()),n&&(e=Pf(e)),e}const Un={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[el]=tc(r);const a=o||r.props&&r.props.type==="number";hi(e,t?"change":"input",s=>{s.target.composing||e[el](Lh(e.value,n,a))}),(n||a)&&hi(e,"change",()=>{e.value=Lh(e.value,n,a)}),t||(hi(e,"compositionstart",lC),hi(e,"compositionend",jh),hi(e,"change",jh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:a}},s){if(e[el]=tc(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?Pf(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"&&(o&&t===n||r&&e.value.trim()===l)||(e.value=l)}},uC={deep:!0,created(e,t,n){e[el]=tc(n),hi(e,"change",()=>{const o=e._modelValue,r=cC(e),a=e.checked,s=e[el];if(ot(o)){const i=kv(o,r),l=i!==-1;if(a&&!l)s(o.concat(r));else if(!a&&l){const c=[...o];c.splice(i,1),s(c)}}else if(fc(o)){const i=new Set(o);a?i.add(r):i.delete(r),s(i)}else s(Mg(e,a))})},mounted:Nh,beforeUpdate(e,t,n){e[el]=tc(n),Nh(e,t,n)}};function Nh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(ot(t))r=kv(t,o.props.value)>-1;else if(fc(t))r=t.has(o.props.value);else{if(t===n)return;r=tu(t,Mg(e,!0))}e.checked!==r&&(e.checked=r)}function cC(e){return"_value"in e?e._value:e.value}function Mg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const dC=["ctrl","shift","alt","meta"],fC={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)=>dC.some(n=>e[`${n}Key`]&&!t.includes(n))},gt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...a)=>{for(let s=0;s<t.length;s++){const i=fC[t[s]];if(i&&i(r,t))return}return e(r,...a)})},pC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},So=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const a=zs(r.key);if(t.some(s=>s===a||pC[s]===a))return e(r)})},hC=mn({patchProp:aC},D0);let Oh;function mC(){return Oh||(Oh=w0(hC))}const vC=(...e)=>{const t=mC().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=yC(o);if(!r)return;const a=t._component;!pt(a)&&!a.render&&!a.template&&(a.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const s=n(r,!1,gC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),s},t};function gC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function yC(e){return Kt(e)?document.querySelector(e):e}const wC="modulepreload",bC=function(e){return"/"+e},$h={},xr=function(t,n,o){let r=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"));r=s(n.map(c=>{if(c=bC(c),c in $h)return;$h[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":wC,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((y,S)=>{f.addEventListener("load",y),f.addEventListener("error",()=>S(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 r.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 Wi=typeof document<"u";function jg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function TC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&jg(e.default)}const Lt=Object.assign;function wd(e,t){const n={};for(const o in t){const r=t[o];n[o]=jr(r)?r.map(e):e(r)}return n}const Hl=()=>{},jr=Array.isArray;function Dh(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const Lg=/#/g,SC=/&/g,CC=/\//g,xC=/=/g,kC=/\?/g,Ng=/\+/g,IC=/%5B/g,AC=/%5D/g,Og=/%5E/g,_C=/%60/g,$g=/%7B/g,PC=/%7C/g,Dg=/%7D/g,EC=/%20/g;function Vf(e){return e==null?"":encodeURI(""+e).replace(PC,"|").replace(IC,"[").replace(AC,"]")}function RC(e){return Vf(e).replace($g,"{").replace(Dg,"}").replace(Og,"^")}function nf(e){return Vf(e).replace(Ng,"%2B").replace(EC,"+").replace(Lg,"%23").replace(SC,"%26").replace(_C,"`").replace($g,"{").replace(Dg,"}").replace(Og,"^")}function MC(e){return nf(e).replace(xC,"%3D")}function jC(e){return Vf(e).replace(Lg,"%23").replace(kC,"%3F")}function LC(e){return jC(e).replace(CC,"%2F")}function Xl(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const NC=/\/$/,OC=e=>e.replace(NC,"");function bd(e,t,n="/"){let o,r={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(o=t.slice(0,l),a=t.slice(l,i>0?i:t.length),r=e(a.slice(1))),i>=0&&(o=o||t.slice(0,i),s=t.slice(i,t.length)),o=BC(o??t,n),{fullPath:o+a+s,path:o,query:r,hash:Xl(s)}}function $C(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Fh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function DC(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&ul(t.matched[o],n.matched[r])&&Fg(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ul(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Fg(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!FC(e[n],t[n]))return!1;return!0}function FC(e,t){return jr(e)?Bh(e,t):jr(t)?Bh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Bh(e,t){return jr(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function BC(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),r=o[o.length-1];(r===".."||r===".")&&o.push("");let a=n.length-1,s,i;for(s=0;s<o.length;s++)if(i=o[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(s).join("/")}const Ps={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}({}),Td=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function UC(e){if(!e)if(Wi){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),OC(e)}const zC=/^[^#]+#/;function HC(e,t){return e.replace(zC,"#")+t}function qC(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Sc=()=>({left:window.scrollX,top:window.scrollY});function WC(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=qC(r,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 Uh(e,t){return(history.state?history.state.position-t:-1)+e}const rf=new Map;function GC(e,t){rf.set(e,t)}function VC(e){const t=rf.get(e);return rf.delete(e),t}function KC(e){return typeof e=="string"||e&&typeof e=="object"}function Bg(e){return typeof e=="string"||typeof e=="symbol"}let an=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 Ug=Symbol("");an.MATCHER_NOT_FOUND+"",an.NAVIGATION_GUARD_REDIRECT+"",an.NAVIGATION_ABORTED+"",an.NAVIGATION_CANCELLED+"",an.NAVIGATION_DUPLICATED+"";function cl(e,t){return Lt(new Error,{type:e,[Ug]:!0},t)}function Fa(e,t){return e instanceof Error&&Ug in e&&(t==null||!!(e.type&t))}const YC=["params","query","hash"];function JC(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of YC)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function QC(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;o<n.length;++o){const r=n[o].replace(Ng," "),a=r.indexOf("="),s=Xl(a<0?r:r.slice(0,a)),i=a<0?null:Xl(r.slice(a+1));if(s in t){let l=t[s];jr(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function zh(e){let t="";for(let n in e){const o=e[n];if(n=MC(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(jr(o)?o.map(r=>r&&nf(r)):[o&&nf(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function XC(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=jr(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const ZC=Symbol(""),Hh=Symbol(""),Cc=Symbol(""),Kf=Symbol(""),af=Symbol("");function jl(){let e=[];function t(o){return e.push(o),()=>{const r=e.indexOf(o);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Ls(e,t,n,o,r,a=s=>s()){const s=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((i,l)=>{const c=f=>{f===!1?l(cl(an.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):KC(f)?l(cl(an.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&o.enterCallbacks[r]===s&&typeof f=="function"&&s.push(f),i())},d=a(()=>e.call(o&&o.instances[r],t,n,c));let v=Promise.resolve(d);e.length<3&&(v=v.then(c)),v.catch(f=>l(f))})}function Sd(e,t,n,o,r=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(jg(l)){const c=(l.__vccOpts||l)[t];c&&a.push(Ls(c,n,o,s,i,r))}else{let c=l();a.push(()=>c.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const v=TC(d)?d.default:d;s.mods[i]=d,s.components[i]=v;const f=(v.__vccOpts||v)[t];return f&&Ls(f,n,o,s,i,r)()}))}}return a}function ex(e,t){const n=[],o=[],r=[],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=>ul(c,i))?o.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(c=>ul(c,l))||r.push(l))}return[n,o,r]}/*!
|
|
23
|
-
* vue-router v4.6.4
|
|
24
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
-
* @license MIT
|
|
26
|
-
*/let tx=()=>location.protocol+"//"+location.host;function zg(e,t){const{pathname:n,search:o,hash:r}=t,a=e.indexOf("#");if(a>-1){let s=r.includes(e.slice(a))?e.slice(a).length:1,i=r.slice(s);return i[0]!=="/"&&(i="/"+i),Fh(i,"")}return Fh(n,e)+o+r}function nx(e,t,n,o){let r=[],a=[],s=null;const i=({state:f})=>{const y=zg(e,location),S=n.value,I=t.value;let U=0;if(f){if(n.value=y,t.value=f,s&&s===S){s=null;return}U=I?f.position-I.position:0}else o(y);r.forEach(O=>{O(n.value,S,{delta:U,type:of.pop,direction:U?U>0?Td.forward:Td.back:Td.unknown})})};function l(){s=n.value}function c(f){r.push(f);const y=()=>{const S=r.indexOf(f);S>-1&&r.splice(S,1)};return a.push(y),y}function d(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Lt({},f.state,{scroll:Sc()}),"")}}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 qh(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?Sc():null}}function ox(e){const{history:t,location:n}=window,o={value:zg(e,n)},r={value:t.state};r.value||a(o.value,{back:null,current:o.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:tx()+e+l;try{t[d?"replaceState":"pushState"](c,"",f),r.value=c}catch(y){console.error(y),n[d?"replace":"assign"](f)}}function s(l,c){a(l,Lt({},t.state,qh(r.value.back,l,r.value.forward,!0),c,{position:r.value.position}),!0),o.value=l}function i(l,c){const d=Lt({},r.value,t.state,{forward:l,scroll:Sc()});a(d.current,d,!0),a(l,Lt({},qh(o.value,l,null),{position:d.position+1},c),!1),o.value=l}return{location:o,state:r,push:i,replace:s}}function rx(e){e=UC(e);const t=ox(e),n=nx(e,t.state,t.location,t.replace);function o(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=Lt({location:"",base:e,go:o,createHref:HC.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}function ax(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),rx(e)}let mi=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var kn=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}(kn||{});const sx={type:mi.Static,value:""},ix=/[a-zA-Z0-9_]/;function lx(e){if(!e)return[[]];if(e==="/")return[[sx]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${n})/"${c}": ${y}`)}let n=kn.Static,o=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let i=0,l,c="",d="";function v(){c&&(n===kn.Static?a.push({type:mi.Static,value:c}):n===kn.Param||n===kn.ParamRegExp||n===kn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),a.push({type:mi.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!==kn.ParamRegExp){o=n,n=kn.EscapeNext;continue}switch(n){case kn.Static:l==="/"?(c&&v(),s()):l===":"?(v(),n=kn.Param):f();break;case kn.EscapeNext:f(),n=o;break;case kn.Param:l==="("?n=kn.ParamRegExp:ix.test(l)?f():(v(),n=kn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case kn.ParamRegExp:l===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+l:n=kn.ParamRegExpEnd:d+=l;break;case kn.ParamRegExpEnd:v(),n=kn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,d="";break;default:t("Unknown state");break}}return n===kn.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),v(),s(),r}const Wh="[^/]+?",ux={sensitive:!1,strict:!1,start:!0,end:!0};var lo=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}(lo||{});const cx=/[.+*?^${}()[\]/\\]/g;function dx(e,t){const n=Lt({},ux,t),o=[];let r=n.start?"^":"";const a=[];for(const c of e){const d=c.length?[]:[lo.Root];n.strict&&!c.length&&(r+="/");for(let v=0;v<c.length;v++){const f=c[v];let y=lo.Segment+(n.sensitive?lo.BonusCaseSensitive:0);if(f.type===mi.Static)v||(r+="/"),r+=f.value.replace(cx,"\\$&"),y+=lo.Static;else if(f.type===mi.Param){const{value:S,repeatable:I,optional:U,regexp:O}=f;a.push({name:S,repeatable:I,optional:U});const $=O||Wh;if($!==Wh){y+=lo.BonusCustomRegExp;try{`${$}`}catch(M){throw new Error(`Invalid custom RegExp for param "${S}" (${$}): `+M.message)}}let q=I?`((?:${$})(?:/(?:${$}))*)`:`(${$})`;v||(q=U&&c.length<2?`(?:/${q})`:"/"+q),U&&(q+="?"),r+=q,y+=lo.Dynamic,U&&(y+=lo.BonusOptional),I&&(y+=lo.BonusRepeatable),$===".*"&&(y+=lo.BonusWildcard)}d.push(y)}o.push(d)}if(n.strict&&n.end){const c=o.length-1;o[c][o[c].length-1]+=lo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const s=new RegExp(r,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]||"",S=a[f-1];v[S.name]=y&&S.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===mi.Static)d+=y.value;else if(y.type===mi.Param){const{value:S,repeatable:I,optional:U}=y,O=S in c?c[S]:"";if(jr(O)&&!I)throw new Error(`Provided param "${S}" is an array but it is not repeatable (* or + modifiers)`);const $=jr(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 "${S}"`);d+=$}}return d||"/"}return{re:s,score:o,keys:a,parse:i,stringify:l}}function fx(e,t){let n=0;for(;n<e.length&&n<t.length;){const o=t[n]-e[n];if(o)return o;n++}return e.length<t.length?e.length===1&&e[0]===lo.Static+lo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===lo.Static+lo.Segment?1:-1:0}function Hg(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const a=fx(o[n],r[n]);if(a)return a;n++}if(Math.abs(r.length-o.length)===1){if(Gh(o))return 1;if(Gh(r))return-1}return r.length-o.length}function Gh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const px={strict:!1,end:!0,sensitive:!1};function hx(e,t,n){const o=dx(lx(e.path),n),r=Lt(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function mx(e,t){const n=[],o=new Map;t=Dh(px,t);function r(v){return o.get(v)}function a(v,f,y){const S=!y,I=Kh(v);I.aliasOf=y&&y.record;const U=Dh(t,v),O=[I];if("alias"in v){const M=typeof v.alias=="string"?[v.alias]:v.alias;for(const pe of M)O.push(Kh(Lt({},I,{components:y?y.record.components:I.components,path:pe,aliasOf:y?y.record:I})))}let $,q;for(const M of O){const{path:pe}=M;if(f&&pe[0]!=="/"){const ue=f.record.path,V=ue[ue.length-1]==="/"?"":"/";M.path=f.record.path+(pe&&V+pe)}if($=hx(M,f,U),y?y.alias.push($):(q=q||$,q!==$&&q.alias.push($),S&&v.name&&!Yh($)&&s(v.name)),qg($)&&l($),I.children){const ue=I.children;for(let V=0;V<ue.length;V++)a(ue[V],$,y&&y.children[V])}y=y||$}return q?()=>{s(q)}:Hl}function s(v){if(Bg(v)){const f=o.get(v);f&&(o.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&&o.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=yx(v,n);n.splice(f,0,v),v.record.name&&!Yh(v)&&o.set(v.record.name,v)}function c(v,f){let y,S={},I,U;if("name"in v&&v.name){if(y=o.get(v.name),!y)throw cl(an.MATCHER_NOT_FOUND,{location:v});U=y.record.name,S=Lt(Vh(f.params,y.keys.filter(q=>!q.optional).concat(y.parent?y.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),v.params&&Vh(v.params,y.keys.map(q=>q.name))),I=y.stringify(S)}else if(v.path!=null)I=v.path,y=n.find(q=>q.re.test(I)),y&&(S=y.parse(I),U=y.record.name);else{if(y=f.name?o.get(f.name):n.find(q=>q.re.test(f.path)),!y)throw cl(an.MATCHER_NOT_FOUND,{location:v,currentLocation:f});U=y.record.name,S=Lt({},f.params,v.params),I=y.stringify(S)}const O=[];let $=y;for(;$;)O.unshift($.record),$=$.parent;return{name:U,path:I,params:S,matched:O,meta:gx(O)}}e.forEach(v=>a(v));function d(){n.length=0,o.clear()}return{addRoute:a,resolve:c,removeRoute:s,clearRoutes:d,getRoutes:i,getRecordMatcher:r}}function Vh(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function Kh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:vx(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 vx(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function Yh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function gx(e){return e.reduce((t,n)=>Lt(t,n.meta),{})}function yx(e,t){let n=0,o=t.length;for(;n!==o;){const a=n+o>>1;Hg(e,t[a])<0?o=a:n=a+1}const r=wx(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function wx(e){let t=e;for(;t=t.parent;)if(qg(t)&&Hg(e,t)===0)return t}function qg({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Jh(e){const t=Er(Cc),n=Er(Kf),o=K(()=>{const l=m(e.to);return t.resolve(l)}),r=K(()=>{const{matched:l}=o.value,{length:c}=l,d=l[c-1],v=n.matched;if(!d||!v.length)return-1;const f=v.findIndex(ul.bind(null,d));if(f>-1)return f;const y=Qh(l[c-2]);return c>1&&Qh(d)===y&&v[v.length-1].path!==y?v.findIndex(ul.bind(null,l[c-2])):f}),a=K(()=>r.value>-1&&xx(n.params,o.value.params)),s=K(()=>r.value>-1&&r.value===n.matched.length-1&&Fg(n.params,o.value.params));function i(l={}){if(Cx(l)){const c=t[m(e.replace)?"replace":"push"](m(e.to)).catch(Hl);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:o,href:K(()=>o.value.href),isActive:a,isExactActive:s,navigate:i}}function bx(e){return e.length===1?e[0]:e}const Tx=vn({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:Jh,setup(e,{slots:t}){const n=gc(Jh(e)),{options:o}=Er(Cc),r=K(()=>({[Xh(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Xh(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&bx(t.default(n));return e.custom?a:Gf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),Sx=Tx;function Cx(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 xx(e,t){for(const n in t){const o=t[n],r=e[n];if(typeof o=="string"){if(o!==r)return!1}else if(!jr(r)||r.length!==o.length||o.some((a,s)=>a.valueOf()!==r[s].valueOf()))return!1}return!0}function Qh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xh=(e,t,n)=>e??t??n,kx=vn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Er(af),r=K(()=>e.route||o.value),a=Er(Hh,0),s=K(()=>{let c=m(a);const{matched:d}=r.value;let v;for(;(v=d[c])&&!v.components;)c++;return c}),i=K(()=>r.value.matched[s.value]);Uu(Hh,K(()=>s.value+1)),Uu(ZC,i),Uu(af,r);const l=T();return nt(()=>[l.value,i.value,e.name],([c,d,v],[f,y,S])=>{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||!ul(d,y)||!f)&&(d.enterCallbacks[v]||[]).forEach(I=>I(c))},{flush:"post"}),()=>{const c=r.value,d=e.name,v=i.value,f=v&&v.components[d];if(!f)return Zh(n.default,{Component:f,route:c});const y=v.props[d],S=y?y===!0?c.params:typeof y=="function"?y(c):y:null,U=Gf(f,Lt({},S,t,{onVnodeUnmounted:O=>{O.component.isUnmounted&&(v.instances[d]=null)},ref:l}));return Zh(n.default,{Component:U,route:c})||U}}});function Zh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ix=kx;function Ax(e){const t=mx(e.routes,e),n=e.parseQuery||QC,o=e.stringifyQuery||zh,r=e.history,a=jl(),s=jl(),i=jl(),l=yS(Ps);let c=Ps;Wi&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=wd.bind(null,N=>""+N),v=wd.bind(null,LC),f=wd.bind(null,Xl);function y(N,re){let se,je;return Bg(N)?(se=t.getRecordMatcher(N),je=re):je=N,t.addRoute(je,se)}function S(N){const re=t.getRecordMatcher(N);re&&t.removeRoute(re)}function I(){return t.getRoutes().map(N=>N.record)}function U(N){return!!t.getRecordMatcher(N)}function O(N,re){if(re=Lt({},re||l.value),typeof N=="string"){const H=bd(n,N,re.path),le=t.resolve({path:H.path},re),ne=r.createHref(H.fullPath);return Lt(H,le,{params:f(le.params),hash:Xl(H.hash),redirectedFrom:void 0,href:ne})}let se;if(N.path!=null)se=Lt({},N,{path:bd(n,N.path,re.path).path});else{const H=Lt({},N.params);for(const le in H)H[le]==null&&delete H[le];se=Lt({},N,{params:v(H)}),re.params=v(re.params)}const je=t.resolve(se,re),qe=N.hash||"";je.params=d(f(je.params));const _=$C(o,Lt({},N,{hash:RC(qe),path:je.path})),R=r.createHref(_);return Lt({fullPath:_,hash:qe,query:o===zh?XC(N.query):N.query||{}},je,{redirectedFrom:void 0,href:R})}function $(N){return typeof N=="string"?bd(n,N,l.value.path):Lt({},N)}function q(N,re){if(c!==N)return cl(an.NAVIGATION_CANCELLED,{from:re,to:N})}function M(N){return V(N)}function pe(N){return M(Lt($(N),{replace:!0}))}function ue(N,re){const se=N.matched[N.matched.length-1];if(se&&se.redirect){const{redirect:je}=se;let qe=typeof je=="function"?je(N,re):je;return typeof qe=="string"&&(qe=qe.includes("?")||qe.includes("#")?qe=$(qe):{path:qe},qe.params={}),Lt({query:N.query,hash:N.hash,params:qe.path!=null?{}:N.params},qe)}}function V(N,re){const se=c=O(N),je=l.value,qe=N.state,_=N.force,R=N.replace===!0,H=ue(se,je);if(H)return V(Lt($(H),{state:typeof H=="object"?Lt({},qe,H.state):qe,force:_,replace:R}),re||se);const le=se;le.redirectedFrom=re;let ne;return!_&&DC(o,je,se)&&(ne=cl(an.NAVIGATION_DUPLICATED,{to:le,from:je}),xe(je,je,!0,!1)),(ne?Promise.resolve(ne):Pe(le,je)).catch(ae=>Fa(ae)?Fa(ae,an.NAVIGATION_GUARD_REDIRECT)?ae:Se(ae):Le(ae,le,je)).then(ae=>{if(ae){if(Fa(ae,an.NAVIGATION_GUARD_REDIRECT))return V(Lt({replace:R},$(ae.to),{state:typeof ae.to=="object"?Lt({},qe,ae.to.state):qe,force:_}),re||le)}else ae=Z(le,je,!0,R,qe);return ge(le,je,ae),ae})}function ie(N,re){const se=q(N,re);return se?Promise.reject(se):Promise.resolve()}function ye(N){const re=Xe.values().next().value;return re&&typeof re.runWithContext=="function"?re.runWithContext(N):N()}function Pe(N,re){let se;const[je,qe,_]=ex(N,re);se=Sd(je.reverse(),"beforeRouteLeave",N,re);for(const H of je)H.leaveGuards.forEach(le=>{se.push(Ls(le,N,re))});const R=ie.bind(null,N,re);return se.push(R),ce(se).then(()=>{se=[];for(const H of a.list())se.push(Ls(H,N,re));return se.push(R),ce(se)}).then(()=>{se=Sd(qe,"beforeRouteUpdate",N,re);for(const H of qe)H.updateGuards.forEach(le=>{se.push(Ls(le,N,re))});return se.push(R),ce(se)}).then(()=>{se=[];for(const H of _)if(H.beforeEnter)if(jr(H.beforeEnter))for(const le of H.beforeEnter)se.push(Ls(le,N,re));else se.push(Ls(H.beforeEnter,N,re));return se.push(R),ce(se)}).then(()=>(N.matched.forEach(H=>H.enterCallbacks={}),se=Sd(_,"beforeRouteEnter",N,re,ye),se.push(R),ce(se))).then(()=>{se=[];for(const H of s.list())se.push(Ls(H,N,re));return se.push(R),ce(se)}).catch(H=>Fa(H,an.NAVIGATION_CANCELLED)?H:Promise.reject(H))}function ge(N,re,se){i.list().forEach(je=>ye(()=>je(N,re,se)))}function Z(N,re,se,je,qe){const _=q(N,re);if(_)return _;const R=re===Ps,H=Wi?history.state:{};se&&(je||R?r.replace(N.fullPath,Lt({scroll:R&&H&&H.scroll},qe)):r.push(N.fullPath,qe)),l.value=N,xe(N,re,se,R),Se()}let me;function oe(){me||(me=r.listen((N,re,se)=>{if(!at.listening)return;const je=O(N),qe=ue(je,at.currentRoute.value);if(qe){V(Lt(qe,{replace:!0,force:!0}),je).catch(Hl);return}c=je;const _=l.value;Wi&&GC(Uh(_.fullPath,se.delta),Sc()),Pe(je,_).catch(R=>Fa(R,an.NAVIGATION_ABORTED|an.NAVIGATION_CANCELLED)?R:Fa(R,an.NAVIGATION_GUARD_REDIRECT)?(V(Lt($(R.to),{force:!0}),je).then(H=>{Fa(H,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===of.pop&&r.go(-1,!1)}).catch(Hl),Promise.reject()):(se.delta&&r.go(-se.delta,!1),Le(R,je,_))).then(R=>{R=R||Z(je,_,!1),R&&(se.delta&&!Fa(R,an.NAVIGATION_CANCELLED)?r.go(-se.delta,!1):se.type===of.pop&&Fa(R,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),ge(je,_,R)}).catch(Hl)}))}let Ae=jl(),De=jl(),Ne;function Le(N,re,se){Se(N);const je=De.list();return je.length?je.forEach(qe=>qe(N,re,se)):console.error(N),Promise.reject(N)}function Ce(){return Ne&&l.value!==Ps?Promise.resolve():new Promise((N,re)=>{Ae.add([N,re])})}function Se(N){return Ne||(Ne=!N,oe(),Ae.list().forEach(([re,se])=>N?se(N):re()),Ae.reset()),N}function xe(N,re,se,je){const{scrollBehavior:qe}=e;if(!Wi||!qe)return Promise.resolve();const _=!se&&VC(Uh(N.fullPath,0))||(je||!se)&&history.state&&history.state.scroll||null;return Dt().then(()=>qe(N,re,_)).then(R=>R&&WC(R)).catch(R=>Le(R,N,re))}const Re=N=>r.go(N);let Je;const Xe=new Set,at={currentRoute:l,listening:!0,addRoute:y,removeRoute:S,clearRoutes:t.clearRoutes,hasRoute:U,getRoutes:I,resolve:O,options:e,push:M,replace:pe,go:Re,back:()=>Re(-1),forward:()=>Re(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:De.add,isReady:Ce,install(N){N.component("RouterLink",Sx),N.component("RouterView",Ix),N.config.globalProperties.$router=at,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>m(l)}),Wi&&!Je&&l.value===Ps&&(Je=!0,M(r.location).catch(je=>{}));const re={};for(const je in Ps)Object.defineProperty(re,je,{get:()=>l.value[je],enumerable:!0});N.provide(Cc,at),N.provide(Kf,zv(re)),N.provide(af,l);const se=N.unmount;Xe.add(N),N.unmount=function(){Xe.delete(N),Xe.size<1&&(c=Ps,me&&me(),me=null,l.value=Ps,Je=!1,Ne=!1),se()}}};function ce(N){return N.reduce((re,se)=>re.then(()=>ye(se)),Promise.resolve())}return at}function _x(){return Er(Cc)}function Px(e){return Er(Kf)}const em=768;function Yf(){const e=T(typeof window<"u"?window.innerWidth<em:!1);let t=null;function n(o){e.value=o.matches}return Ti(()=>{t=window.matchMedia(`(max-width: ${em-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),au(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Ex={key:0,class:"desktop-sidebar"},Rx={class:"desktop-main"},tm="codex-web-local.sidebar-width.v1",Mx=260,jx=620,nm=320,Lx=vn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Yf();function o(c){return Math.min(jx,Math.max(Mx,c))}function r(){if(typeof window>"u")return nm;const c=window.localStorage.getItem(tm),d=Number(c);return Number.isFinite(d)?o(d):nm}const a=T(r()),s=K(()=>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(tm,String(c))}function l(c){c.preventDefault();const d=c.clientX,v=a.value,f=S=>{const I=S.clientX-d;a.value=o(v+I)},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:ut(["desktop-layout",{"is-mobile":m(n)}]),style:or(s.value)},[m(n)?(P(),et(sl,{key:0,to:"body"},[Be(iu,{name:"drawer"},{default:ft(()=>[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"]))},[Co(c.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ve("",!0),m(n)?ve("",!0):(P(),B(ct,{key:1},[e.isSidebarCollapsed?ve("",!0):(P(),B("aside",Ex,[Co(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",Rx,[Co(c.$slots,"content",{},void 0)])],6))}}),Ct=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},Nx=Ct(Lx,[["__scopeId","data-v-336d0207"]]);function om(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Oo extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function lr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=om(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=om(o);return r&&typeof r.message=="string"&&r.message.length>0?r.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function ir(e,t,n){return e instanceof Oo?e:e instanceof Error?new Oo(e.message||t,{code:"unknown_error",method:n}):new Oo(t,{code:"unknown_error",method:n})}function Wg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function Ox(e,t){const n={method:e,params:t??null};let o;try{o=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Oo(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,a=null;try{a=await o.text(),r=JSON.parse(a)}catch{r=null}if(!o.ok){const i=lr(r,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${o.status}`;throw new Oo(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:o.status})}const s=r;if(!s||typeof s!="object"||!("result"in s))throw new Oo(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return s.result}async function $x(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Oo(lr(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 Dx(e){const t=Wg(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 rm(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Fx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},a=(c,d)=>{if(n||o!==null)return;const v=Math.min(1e3*2**d,1e4);o=window.setTimeout(()=>{o=null,!n&&c()},v)},s=c=>{const d=Dx(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};rm(e,y)}catch{rm(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,S=window.setTimeout(()=>{f||n||y||(y=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,r(),S!==null&&(window.clearTimeout(S),S=null)},v.onmessage=I=>{try{s(JSON.parse(String(I.data)))}catch{}},v.onerror=()=>{},v.onclose=()=>{if(S!==null&&(window.clearTimeout(S),S=null),!(n||y)){if(!f){i();return}a(()=>l(c+1),c)}},t=()=>{y=!0,S!==null&&(window.clearTimeout(S),S=null),v.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,r(),t==null||t()}}async function Bx(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(o){throw new Oo(o instanceof Error?o.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 Oo(lr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Ux(){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 Oo(lr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Wg(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}async function rt(e,t){try{return await Ox(e,t)}catch(n){throw ir(n,`RPC ${e} failed`,e)}}function Jt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=n.message;if(typeof o=="string"&&o.trim().length>0)return o;const r=n.error;return typeof r=="string"&&r.trim().length>0?r: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 Zn(e){return typeof e=="boolean"?e:null}function Ar(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Si(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 nc(e){const t=Ye(e);if(!t)return null;const n=te(t.id),o=te(t.kind),r=te(t.name),a=te(t.prompt),s=te(t.rrule),i=te(t.status);return!n||!r||!a||!s||o!=="heartbeat"&&o!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:o,name:r,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 Gg(e){if(Array.isArray(e))return e.flatMap(n=>{const o=nc(n);return o?[o]:[]});const t=nc(e);return t?[t]:[]}async function zx(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(lr(t,"Failed to load thread automations"));const n=Ye((r=Ye(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Gg(s);i.length>0&&(o[a]=i)}return o}async function Hx(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(lr(t,"Failed to load project automations"));const n=Ye((r=Ye(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Gg(s);i.length>0&&(o[a]=i)}return o}async function qx(e){var r;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(lr(n,"Failed to save thread automation"));const o=nc((r=Ye(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function Wx(e){var r;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(lr(n,"Failed to save project automation"));const o=nc((r=Ye(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function am(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(lr(r,"Failed to delete thread automation"))}async function Vg(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(lr(r,"Failed to delete project automation"))}async function Gx(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})}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(lr(o,"Failed to run thread automation"))}const Vx=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Kg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||Vx.has(n))}function Kx(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],o=[];for(const r of n){if(!r||typeof r!="object"||Array.isArray(r))continue;const s=r.path,i=typeof s=="string"?s.trim():"";!i||Kg(i)||o.push({path:i})}return o}async function Yx(e,t){await rt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function Jx(e,t){await rt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function Qx(e){await rt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function sm(e,t,n=20){const o=e.trim();if(!o)return[];const r=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:o,query:t.trim(),limit:n})}),a=await r.json();if(!r.ok){const c=Jt(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||Kg(f)||l.push({path:f})}return l}async function Xx(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})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to search threads");return o.data??{threadIds:[],indexedThreadCount:0}}function Zx(e){const t=Ye(e);if(!t)return null;const n=te(t.id),o=te(t.threadId),r=te(t.cwd),a=te(t.shell);return!n||!o||!r||!a?null:{id:n,threadId:o,cwd:r,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Zn(t.truncated)??!1}}async function hl(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(lr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function SF(e){var o;const t=await hl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=Zx((o=Ye(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function ek(){const e=await hl("/codex-api/thread-terminal/status"),t=Ye(e);return{available:Zn(t==null?void 0:t.available)??!1,reason:te(t==null?void 0:t.reason)||null}}async function CF(e){const t=await hl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ye(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const a=Ye(r),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 xF(e,t){await hl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function kF(e,t,n){await hl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function IF(e){await hl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}function tk(e,t=[],n=[]){if(e.trim().length>0)return e;const o=t.map(r=>(r.label??"").trim()).find(r=>r.length>0);return o||(n.some(r=>(r??"").trim().length>0)?"[Image]":"[Attachment]")}const Yg=["none","minimal","low","medium","high","xhigh","max","ultra"];function dl(e){return typeof e=="string"&&Yg.some(t=>t===e)}function nk(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Ze(e){return nk(e)}function Jg(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function ok(e){const t=Ze(e);return t.startsWith("/")||Jg(t)}function rk(e){const t=Ze(e).replace(/[\\/]+/gu,"/");return Jg(t)?t.toLowerCase():t}function No(e){const t=Ze(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function tl(e){const t=Ze(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function ar(e){return No(e)||Ze(e)||"Projectless"}function oc(e){const t=Ze(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function im(e){return new Date(e*1e3).toISOString()}function ak(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 sk(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ik(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const lk=/^##\s+(.+?):\s+(.+?)\s*$/,uk=/^#\s*files mentioned by the user\s*:?\s*$/i;function ck(e){var r,a;const t=e.split(`
|
|
27
|
-
`).findIndex(s=>uk.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
-
`).slice(t+1),o=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(lk);if(!l)break;const c=(r=l[1])==null?void 0:r.trim(),d=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");c&&d&&o.push({label:c,path:d})}return o}function dk(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 o=n.at(-1);if(!o||typeof o.index!="number")return e.trim();const r=o.index+o[0].length;return e.slice(r).trim()}const fk=new Set(["text","image","localImage","audio","localAudio","skill","mention"]);function Qg(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function pk(e){return`/codex-local-file?path=${encodeURIComponent(e)}`}function hk(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 mk(e){const t=e.aggregatedOutputSpill;if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,o=typeof n.ref=="string"?n.ref.trim():"",r=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?Math.trunc(i):0,a=r(n.totalBytes),s=r(n.omittedBytes);if(!(s<=0))return{ref:o,totalBytes:a,omittedBytes:s}}function vk(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function Cd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?vk(n[1].trim()):""}function gk(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Cd(t,"current_time_iso"),o=Cd(t,"instructions");return!n||!o?null:{automationId:Cd(t,"automation_id"),currentTimeIso:n,instructions:o}}function yk(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],imageAttachmentIds:[],audioSources:[],mentions:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],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&&o.push(y.url.trim()),y.type==="image"&&!("url"in y)&&"fileId"in y&&typeof y.fileId=="string"&&y.fileId.trim().length>0&&r.push(y.fileId.trim()),y.type==="localImage"&&typeof y.path=="string"&&y.path.trim().length>0&&o.push(Qg(y.path.trim())),y.type==="skill"){const I=typeof y.name=="string"?y.name.trim():"",U=typeof y.path=="string"?y.path.trim():"";I&&U&&i.push({name:I,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(pk(y.path.trim())),y.type==="mention"){const I=typeof y.name=="string"?y.name.trim():"",U=typeof y.path=="string"?y.path.trim():"";I&&s.push({name:I,path:U})}const S=y.type;fk.has(S)||l.push({id:`${e}:user-content:${f}`,role:"user",text:"",messageType:`userContent.${S}`,rawPayload:sk(y),isUnhandled:!0})}const c=n.join(`
|
|
29
|
-
`),d=ck(c),v=gk(c);return{text:(v==null?void 0:v.instructions)??dk(c),images:o,skills:i,fileAttachments:d,imageAttachmentIds:r,audioSources:a,mentions:s,rawBlocks:l,isAutomationRun:v!==null,automationDisplayName:(v==null?void 0:v.automationId)||null}}function wk(e){var a;const t=e.replace(/\r\n/g,`
|
|
30
|
-
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
-
`),o=[],r=[];for(const s of n){const i=s.trim();if(!i){o.length===0&&r.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"),o.push({step:d,status:v});continue}r.push(i)}return o.length===0?null:{explanation:r.join(`
|
|
32
|
-
`).trim()||void 0,steps:o}}function lm(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 bk(e){let t=0,n=0;for(const o of e.replace(/\r\n/g,`
|
|
36
|
-
`).split(`
|
|
37
|
-
`))if(o&&!(o.startsWith("+++")||o.startsWith("---")||o.startsWith("@@"))){if(o.startsWith("+")){t+=1;continue}o.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function Xg(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function sf(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){const r=o,a=typeof r.path=="string"?r.path:"",s=typeof r.diff=="string"?r.diff:"",i=r.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"?bk(s):l==="add"?{addedLineCount:lm(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:lm(s)};n.push({path:a,operation:l,movedToPath:c,diff:s,...d})}return n}function Tk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=yk(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,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:[Qg(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?hk(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"):[],o=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],r=n.join(`
|
|
38
|
-
`).trim(),s=o.join(`
|
|
39
|
-
`).trim()||r;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:o}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",o=typeof t.tool=="string"?t.tool:"";if(!n&&!o)return[];const r=t.status;let a="completed";const s=typeof r=="string"?r:r==null?void 0:r.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:o,messageType:"toolCall",toolCall:{server:n,tool:o,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:wk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Sk(t.status),o=typeof t.command=="string"?t.command:"",r=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:o,messageType:"commandExecution",commandExecution:{command:o,cwd:r,status:n,aggregatedOutput:a,exitCode:s,outputSpill:mk(t)}}]}if(e.type==="fileChange"){const t=sf(e.changes),n=Xg(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 Sk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Ck(e){const t=e,n=[t.name,t.title,e.preview];for(const o of n)if(typeof o=="string"&&o.trim().length>0)return o.trim();return""}function xk(e){const t=Ck(e);return t.length>0?t:"Untitled thread"}function Jf(e){return(e==null?void 0:e.status)==="inProgress"}function Qf(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const o=n,r=typeof o.origin=="string"&&o.origin.trim().length>0?o.origin.trim():"";return r?{origin:r,active:o.active===!0,lastWriteAt:typeof o.lastWriteAt=="string"?o.lastWriteAt:null}:null}function kk(e){var t;return((t=Qf(e))==null?void 0:t.active)===!0}function Zg(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 r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Jf(r)||kk(e)}function ey(e){const t=e,n=Ze(typeof t.cwd=="string"?t.cwd:e.cwd),o=rk(n),r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||o.includes("/.codex/worktrees/")||o.includes("/.git/worktrees/");return{id:e.id,title:xk(e),projectName:ar(n),cwd:n,hasWorktree:r,createdAtIso:im(e.createdAt),updatedAtIso:im(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:Zg(e),externalSession:Qf(e)}}function Ik(e){return ey(e.thread)}function Ak(e){const t=new Map;for(const n of e){const o=t.get(n.projectName);o?o.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,o])=>({projectName:n,threads:o.sort((r,a)=>new Date(a.updatedAtIso).getTime()-new Date(r.updatedAtIso).getTime())})).sort((n,o)=>{var s,i;const r=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=o.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-r})}function _k(e){const t=e.data.map(ey);return Ak(t)}function lu(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o=[];for(let r=0;r<n.length;r++){const a=t+r,s=n[r],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=ak(s==null?void 0:s.startedAt),v=[];for(const y of c)for(const S of Tk(y))v.push({...S,turnId:l,turnIndex:a,turnStartedAtIso:d??void 0});const f=ik(s);if(s.status==="failed"&&f){const y=l??`turn-${a}`;v.push({id:`${y}-error`,role:"system",text:f,messageType:"turnError",turnId:l,turnIndex:a,turnStartedAtIso:d??void 0})}o.push(...v)}return Ek(Pk(o))}function Pk(e){var n;let t=-1;for(let o=e.length-1;o>=0;o-=1)if(((n=e[o])==null?void 0:n.messageType)==="compaction.done"){t=o;break}return t<0?e:e.filter((o,r)=>o.messageType!=="compaction.done"||r===t)}function Ek(e){var s,i,l;let t=-1;for(let c=0;c<e.length;c+=1)if(((s=e[c])==null?void 0:s.messageType)==="compaction.done"){t=c;break}if(t<0)return e;const n=e[t],o=n.turnIndex;let r=-1;for(let c=0;c<e.length;c+=1)if(((i=e[c])==null?void 0:i.turnIndex)===o&&((l=e[c])==null?void 0:l.role)==="user"){r=c;break}if(r<0||t<=r)return e;const a=e.filter((c,d)=>d!==t);return a.splice(r+1,0,n),a}function Xf(e){if(Zg(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Jf(t.at(-1))}function ty(e){return Qf(e.thread)}function Zf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const o=t[n];if(Jf(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const Rk=50,Mk=3e4,Ui=new Map,jk=5e3;function xd(e){return e&&e.length>0?e:null}function kd(e){return e&&e.length>0?e:null}function Lk(e){return dl(e)?e:""}function Nk(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function ep(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o={};for(let r=0;r<n.length;r+=1){const a=t+r,s=n[r];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(o[s.id]=a)}return o}function tp(e){const t=Ye(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function lf(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.id;if(typeof o=="string"&&o.length>0)return o}return""}function Ok(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.cwd;if(typeof o=="string"&&o.length>0)return o}return""}function Zl(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function xc(e){var r,a;const t=Ye(e);if(!t)return"";const n=((r=te(t.modelProvider))==null?void 0:r.trim())??"";if(n)return n;const o=Ye(t.thread);return((a=te(o==null?void 0:o.modelProvider))==null?void 0:a.trim())??""}function um(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const o=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return o.length>0?o:null}catch{return null}}function $k(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
40
|
-
`;for(const o of t)n+=`
|
|
41
|
-
## ${o.label}: ${o.path}
|
|
42
|
-
`;return`${n}
|
|
43
|
-
## My request for Codex:
|
|
44
|
-
|
|
45
|
-
${e}
|
|
46
|
-
`}function Dk(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function Fk(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",o=await fetch(n,{signal:AbortSignal.timeout(jk)});let r=null;try{r=await o.json()}catch{r=null}if(o.ok&&Array.isArray(r==null?void 0:r.data))return{ids:r.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:r.exclusive===!0}}catch{}return null}function Bk(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 o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return dl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:dl(a)?a:null}}function cm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Uk(e={}){const t=e.includeProviderModels!==!1,n=t?await Fk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(cm);const o=await rt("model/list",{}),r=[];for(const a of o.data){const s=Bk(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(cm(a));return r}async function zk(e={}){return(await Uk(e)).map(t=>t.id)}async function Hk(){const e=await rt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=Lk(e.config.model_reasoning_effort),r=Nk(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}async function qk(e,t,n){var l;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?xd(n):kd(n)};let r=null;try{r=await Hk()}catch{r=null}const a=(r==null?void 0:r.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?xd(n??(r==null?void 0:r.reasoningEffort)):kd(n??(r==null?void 0:r.reasoningEffort))};let s=[];try{s=await zk()}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"?xd(n??(r==null?void 0:r.reasoningEffort)):kd(n??(r==null?void 0:r.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function Wk(e,t){const n=await rt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:_k(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function Gk(e){const t=await rt("thread/read",{threadId:e,includeTurns:!1});return Ik(t)}async function Vk(e){const t=await rt("thread/read",{threadId:e,includeTurns:!0}),n=tp(t),o=lu(t,n);return{model:Zl(t),modelProvider:xc(t),messages:o,inProgress:Xf(t),activeTurnId:Zf(t),hasMoreOlder:n>0,turnIndexByTurnId:ep(t,n),externalSession:ty(t)}}async function Kk(e,t,n=10){const o=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),r=await fetch(`/codex-api/thread-turn-page?${o.toString()}`);if(!r.ok)throw new Error(`Older thread page request failed with ${r.status}`);const a=await r.json();if(a.olderTurnsUnavailable===!0)throw new Oo("当前 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:lu(a.result,s),inProgress:Xf(a.result),activeTurnId:Zf(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:ep(a.result,s)}}async function dm(e=null,t=Rk){try{return await Wk(e,t)}catch(n){throw ir(n,"Failed to load thread groups","thread/list")}}async function Yk(e){try{return await Gk(e)}catch(t){throw ir(t,`Failed to load thread ${e}`,"thread/read")}}async function uf(e){try{return await Vk(e)}catch(t){throw ir(t,`Failed to load thread ${e}`,"thread/read")}}async function Jk(e,t,n){try{return await Kk(e,t,n)}catch(o){throw ir(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function AF(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 o=await n.json();return typeof o.text=="string"?o.text:""}async function cf(e){const t=Ui.get(e);if(t)return t;const n=(async()=>{const r=await rt("thread/resume",{threadId:e}),a=tp(r),s=lu(r,a);return{model:Zl(r),modelProvider:xc(r),messages:s,inProgress:Xf(r),activeTurnId:Zf(r),hasMoreOlder:a>0,turnIndexByTurnId:ep(r,a),externalSession:ty(r)}})();Ui.set(e,n);const o=globalThis.setTimeout(()=>{Ui.get(e)===n&&Ui.delete(e)},Mk);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{Ui.get(e)===n&&Ui.delete(e)},2e3)}).catch(()=>{}),n}async function Qk(e){await rt("thread/archive",{threadId:e})}async function Xk(e){await rt("thread/unarchive",{threadId:e})}async function Zk(e){await rt("thread/compact/start",{threadId:e})}async function eI(e,t){await rt("thread/name/set",{threadId:e,name:t})}async function Id(e,t){const n=await rt("thread/revert",{threadId:e,beforeTurnId:t});if(!n.turnsBackwardsCursor)return[];const o=await rt("thread/turns/list",{threadId:e,cursor:n.turnsBackwardsCursor,sortDirection:"desc",limit:200,itemsView:"full"});return lu({thread:{...n.thread,turns:[...o.data].reverse()}},0)}async function fm(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 o=await rt("thread/start",n),r=lf(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:Zl(o),modelProvider:xc(o)}}catch(n){throw ir(n,"Failed to start a new thread","thread/start")}}async function pm(e,t,n){if(arguments.length<=1)try{const o=await rt("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=lf(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:Ok(o),model:Zl(o),messages:lu(o,tp(o))}}catch(o){throw ir(o,`Failed to fork thread ${e}`,"thread/fork")}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const r={threadId:o};typeof t=="string"&&t.trim().length>0&&(r.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(r.model=n.trim());const a=await rt("thread/fork",r),s=lf(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:Zl(a),modelProvider:xc(a)}}catch(o){throw ir(o,`Failed to fork thread ${e}`,"thread/fork")}}function ny(e,t,n,o=[]){const r=[];for(const c of t){const d=um(c.trim());d&&r.push({label:Dk(d),path:d,fsPath:d})}const a=[...o,...r],s=a.filter((c,d)=>a.findIndex(v=>v.fsPath===c.fsPath)===d),l=[{type:"text",text:$k(tk(e,s,t),s)}];for(const c of t){const d=c.trim();if(!d)continue;const v=um(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}}async function Ad(e,t,n=[],o,r,a,s=[],i){var l;try{const c=(o==null?void 0:o.trim())??"",{input:d,dedupedFileAttachments:v}=ny(t,n,a,s),f=v.map(I=>({label:I.label,path:I.path,fsPath:I.fsPath})),y={threadId:e,input:d};if(f.length>0&&(y.attachments=f),c&&(y.model=c),typeof r=="string"&&r.length>0&&(y.effort=r),i){const I=await qk(i,c,r);y.collaborationMode={mode:i,settings:{model:I.model,reasoning_effort:I.reasoningEffort,developer_instructions:null}}}const S=await rt("turn/start",y);return typeof((l=S==null?void 0:S.turn)==null?void 0:l.id)=="string"?S.turn.id.trim():""}catch(c){throw ir(c,`Failed to start turn for thread ${e}`,"turn/start")}}async function tI(e,t,n,o=[],r,a=[]){const s=e.trim(),i=t.trim();try{const{input:l}=ny(n,o,r,a),c=await rt("turn/steer",{threadId:s,input:l,expectedTurnId:i});return typeof(c==null?void 0:c.turnId)=="string"&&c.turnId.trim().length>0?c.turnId.trim():i}catch(l){throw ir(l,`Failed to steer turn for thread ${s}`,"turn/steer")}}async function nI(e,t){const n=e.trim(),o=(t==null?void 0:t.trim())||"";if(n)try{if(!o)throw new Error("turn/interrupt requires turnId");await rt("turn/interrupt",{threadId:n,turnId:o})}catch(r){throw ir(r,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const oI=5e3,rI=3e4,hm=new Map,_d=new Map,mm=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function aI(e){return dl(e)?e:""}function sI(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function iI(e){const t=e==="fast"?"fast":"standard";await rt("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 vm(){return await(await fetch("/codex-api/free-mode/status")).json()}async function gm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function ym(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 zi(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 lI(e){const t=(e==null?void 0:e.trim())??"",n=t,o=hm.get(n);if(o&&Date.now()-o.fetchedAt<rI)return o.result;const r=_d.get(n);if(r)return r;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(oI)});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 hm.set(n,{fetchedAt:Date.now(),result:s}),s})();_d.set(n,a);try{return await a}finally{_d.delete(n)}}function uI(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 o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return dl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:dl(a)?a:null}}function wm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function cI(e={}){const t=e.includeProviderModels!==!1,n=t?await lI(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(wm);const o=await rt("model/list",{}),r=[];for(const a of o.data){const s=uI(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(wm(a));return r}async function dI(){const e=await rt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=aI(e.config.model_reasoning_effort),r=sI(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function fI(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function pI(){try{const e=await rt("collaborationMode/list",{}),t=new Set,n=[];for(const o of e.data){const r=o.mode;r!=="default"&&r!=="plan"&&r!=="execplans"||t.has(r)||(t.add(r),n.push({value:r,label:fI(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of mm)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return mm}async function hI(){return $x()}function mI(e){const t=Ye(e);if(!t)return null;const n=te(t.event??t.name??t.hookName),o=te(t.command??t.cmd);return!n||!o?null:{event:n,command:o,timeout:qt(t.timeout??t.timeout_ms),enabled:Zn(t.enabled??t.active)}}async function vI(){const e=await rt("hooks/list",{}),t=[];for(const n of e.data??[]){const o=Ye(n);o&&t.push({cwd:te(o.cwd)??"",hooks:Array.isArray(o.hooks)?o.hooks.map(mI).filter(r=>r!==null):[],warnings:Ar(o.warnings),errors:Ar(o.errors)})}return t}async function _F(e){await rt("marketplace/add",{source:e})}async function PF(e){await rt("marketplace/remove",{marketplaceName:e})}async function EF(){const e=await rt("marketplace/upgrade",{});return{selectedMarketplaces:Ar(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:Ar(e.upgradedRoots??e.upgraded_roots),errors:Ar(e.errors)}}function gI(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 RF(e){const t=await rt("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 MF(){const e=await rt("plugin/share/list",{});return(e.data??e.shares??[]).map(gI).filter(n=>n!==null)}async function jF(e){await rt("plugin/share/delete",{remotePluginId:e})}async function LF(e){await rt("plugin/share/checkout",{remotePluginId:e})}function oy(e){const t=Ye(e);if(!t)return null;const n=te(t.id),o=te(t.name);return!n||!o?null:{id:n,name:o,description:te(t.description)??"",installUrl:te(t.installUrl??t.install_url)??"",needsAuth:Zn(t.needsAuth??t.needs_auth)??!1}}function yI(e){const t=Ye(e);if(!t)return null;const n=te(t.name),o=te(t.path);if(!n||!o)return null;const r=Ye(t.interface);return{name:n,path:o,description:te(t.description)??"",enabled:Zn(t.enabled)??!0,displayName:te((r==null?void 0:r.displayName)??(r==null?void 0:r.display_name))??n,shortDescription:te(t.shortDescription??t.short_description)??""}}function ry(e,t={}){const n=Ye(e);if(!n)return null;const o=te(n.id),r=te(n.name);if(!o||!r)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))??r,y=te((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),S=te((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:o,name:r,displayName:f,description:y??S,longDescription:S,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:Zn(n.installed)??!1,enabled:Zn(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:Ar(a==null?void 0:a.capabilities),defaultPrompt:Ar((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:Ar((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:Ar(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 wI(e,t=0){const n=Ye(e);if(!n)return null;const o=te(n.id),r=te(n.name);if(!o||!r)return null;const a=Ye(n.branding),s=Ye(n.appMetadata??n.app_metadata);return{id:o,name:r,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:Zn(n.isAccessible??n.is_accessible)??!1,isEnabled:Zn(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Ar(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 bI(e){const t=Ye(e);if(!t)return null;const n=te(t.name);if(!n)return null;const o=Ye(t.tools)??{},r=Object.entries(o).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:r,resources:a,resourceTemplates:i}}async function NF(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await rt("plugin/list",t),o=[];for(const r of n.marketplaces??[]){const a=Ye(r);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=ry(c,i);d&&o.push(d)}}return o}async function OF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await rt("plugin/read",t),o=Ye(n.plugin);if(!o)throw new Error("Plugin detail response is empty");const r=ry(o.summary,{name:te(o.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:te(o.marketplacePath)??e.marketplacePath})??e;return{summary:r,description:te(o.description)??r.longDescription,apps:Array.isArray(o.apps)?o.apps.map(oy).filter(a=>a!==null):[],skills:Array.isArray(o.skills)?o.skills.map(yI).filter(a=>a!==null):[],mcpServers:Ar(o.mcpServers??o.mcp_servers)}}async function $F(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await rt("plugin/install",t),o=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:te(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:o.map(oy).filter(r=>r!==null)}}async function DF(e){await rt("plugin/uninstall",{pluginId:e})}async function FF(e,t){await rt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function BF(e){const t=[];let n=null,o=0;do{const r={limit:100};n&&(r.cursor=n),e&&(r.threadId=e);const a=await rt("app/list",r);for(const s of a.data??[]){const i=wI(s,o);i&&t.push(i),o+=1}n=te(a.nextCursor??a.next_cursor)}while(n);return t}async function UF(e,t){await rt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function zF(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const o=await rt("mcpServerStatus/list",n);for(const r of o.data??[]){const a=bI(r);a&&e.push(a)}t=te(o.nextCursor??o.next_cursor)}while(t);return e}async function HF(){await rt("config/mcpServer/reload",{})}async function qF(e){const t=await rt("mcpServer/oauth/login",{name:e});return{authorizationUrl:te(t.authorizationUrl??t.authorization_url)??""}}async function WF(){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 GF(e="",t=null,n=50){const o=new URLSearchParams;e.trim()&&o.set("query",e.trim()),t&&o.set("cursor",t),n&&Number.isFinite(n)&&o.set("limit",String(Math.max(1,Math.floor(n))));const r=o.toString(),a=await fetch(`/codex-api/composio/connectors${r?`?${r}`:""}`);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 VF(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 KF(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 YF(){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 JF(){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 bm(e){const t=Ye(e);if(!t)return null;const n=qt(t.usedPercent??t.used_percent);if(n===null)return null;const o=qt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:qt(t.resetsAt??t.resets_at)}}function TI(e){const t=Ye(e);if(!t)return null;const n=Zn(t.hasCredits??t.has_credits),o=Zn(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:te(t.balance)}}function Tm(e){const t=Ye(e);if(!t)return null;const n=bm(t.primary),o=bm(t.secondary),r=TI(t.credits);return!n&&!o&&!r?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:te(t.planType??t.plan_type)}}function ay(e){const t=Ye(e);if(!t)return null;const n=Ye(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=Tm(n==null?void 0:n.codex);return o||Tm(t.rateLimits??t.rate_limits)}const SI=100;function CI(){return SI}function xI(e){return Fx(e)}async function kI(e,t){await Bx({id:e,...t})}async function Sm(){return Ux()}function II(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 o=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],r=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:o,skills:r,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function sy(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();if(!r||!Array.isArray(o))continue;const a=o.flatMap(s=>{const i=II(s);return i?[i]:[]});a.length>0&&(t[r]=a)}return t}async function Cm(){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 sy(n.data)}async function AI(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(sy(e))})).ok)throw new Error("Failed to save thread queue state")}async function _I(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})}),o=await n.json();if(!n.ok){const r=Jt(o,"Failed to connect Telegram bot");throw new Error(r)}}async function PI(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Jt(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},r=Array.isArray(o.allowedUserIds)?o.allowedUserIds:[],a=[];for(const s of r){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof o.botToken=="string"?o.botToken:"",allowedUserIds:a}}async function EI(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const r=Jt(t,"Failed to load Telegram status");throw new Error(r)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:o.configured===!0,active:o.active===!0,mappedChats:typeof o.mappedChats=="number"?o.mappedChats:0,mappedThreads:typeof o.mappedThreads=="number"?o.mappedThreads:0,allowedUsers:typeof o.allowedUsers=="number"?o.allowedUsers:0,allowAllUsers:o.allowAllUsers===!0,lastError:typeof o.lastError=="string"?o.lastError:""}}async function RI(){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 rc(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 MI(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function jI(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 LI(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function NI(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 OI(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function $I(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function DI(){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 FI(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 BI(e,t){var n;try{return((n=(await rt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function df(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function UI(e,t){const n=df(e),o=n.split("/").filter(Boolean);if(o.length<2)return null;const r=o.lastIndexOf("skills");if(r>=2){const l=o[r-2]??"";if(l){const c=`/${[...o.slice(0,r+1),l,"SKILL.md"].join("/")}`;if(t.has(c))return{rootPath:c,rootName:l,isNested:c!==n}}}const a=o.indexOf("skills");if(a<0||a+1>=o.length-1)return null;const s=o[a+1]??"";if(!s)return null;const i=`/${[...o.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 zI(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await rt("skills/list",t),o=n.data.flatMap(s=>s.skills),r=new Set(o.map(s=>df(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=UI(i.path,r),c=df(i.path),v=!!(l!=null&&l.isNested&&r.has(l.rootPath))?l.rootPath:c,f=c===v,y=a.get(v),S={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,S);continue}if(y.enabled=y.enabled||i.enabled,!y.__hasRoot&&f){a.set(v,S);continue}!y.displayName&&S.displayName&&(y.displayName=S.displayName),!y.description&&S.description&&(y.description=S.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const HI=6e4;async function Pu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),HI);try{const o=new FormData;o.append("file",e);const r=await fetch("/codex-api/upload-file",{method:"POST",body:o,signal:t.signal});return r.ok?(await r.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function qI(e){return e==="payment_required"?e:null}function WI(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function xm(e){const t=Ye(e);if(!t)return null;const n=qt(t.usedPercent??t.used_percent);if(n===null)return null;const o=qt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:qt(t.resetsAt??t.resets_at)}}function GI(e){const t=Ye(e);if(!t)return null;const n=Zn(t.hasCredits??t.has_credits),o=Zn(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:te(t.balance)}}function VI(e){const t=Ye(e);if(!t)return null;const n=xm(t.primary),o=xm(t.secondary),r=GI(t.credits);return!n&&!o&&!r?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:te(t.planType??t.plan_type)}}function iy(e,t=null,n=null){const o=Ye(e);if(!o)return null;const r=te(o.accountId),a=te(o.storageId)??r,s=te(o.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,storageId:a??r,userId:te(o.userId),authMode:te(o.authMode),email:te(o.email),planType:te(o.planType),lastRefreshedAtIso:te(o.lastRefreshedAtIso)??"",lastActivatedAtIso:te(o.lastActivatedAtIso),quotaSnapshot:VI(o.quotaSnapshot),quotaUpdatedAtIso:te(o.quotaUpdatedAtIso),quotaStatus:i,quotaError:te(o.quotaError),unavailableReason:qI(o.unavailableReason)??(WI(te(o.quotaError))?"payment_required":null),isActive:Zn(o.isActive)??(a===n||r===t)}:null}function ly(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 KI(){const e=await rt("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:Zn(e.enabled)??!1,clients:t.map(ly).filter(n=>n!==null)}}async function YI(){var o;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((o=t.data)==null?void 0:o.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function JI(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 QI(e){await rt(e?"remoteControl/enable":"remoteControl/disable",{})}async function XI(){const e=await rt("remoteControl/pairing/start",{});return{pairingCode:te(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:te(e.expiresAt??e.expires_at)}}async function ZI(){const e=await rt("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(ly).filter(n=>n!==null)}async function eA(e){await rt("remoteControl/client/revoke",{clientId:e})}async function tA(){try{const e=await rt("account/rateLimits/read");return ay(e)}catch(e){throw ir(e,"Failed to load account rate limits","account/rateLimits/read")}}function kc(e){const t=Ye(e),n=te(t==null?void 0:t.activeAccountId),o=te(t==null?void 0:t.activeStorageId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:o,importedAccountId:te(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:te(t==null?void 0:t.importedStorageId)??void 0,accounts:r.map(a=>iy(a,n,o)).filter(a=>a!==null)}}async function nA(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Jt(t,"Failed to load accounts"));const n=Ye(t);return kc(n==null?void 0:n.data)}async function km(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Jt(t,"Failed to refresh accounts"));const n=Ye(t);return kc(n==null?void 0:n.data)}async function oA(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Jt(t,"Failed to start Codex login"));const n=Ye(t),o=Ye(n==null?void 0:n.data),r=te(o==null?void 0:o.loginUrl);if(!r)throw new Error("Failed to start Codex login");return r}async function rA(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(Jt(n,"Failed to complete Codex login"));const o=Ye(n);return kc(o==null?void 0:o.data)}async function aA(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(Jt(n,"Failed to switch account"));const o=Ye(n),r=Ye(o==null?void 0:o.data),a=iy(r==null?void 0:r.account,te(r==null?void 0:r.activeAccountId),te(r==null?void 0:r.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function sA(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(Jt(n,"Failed to remove account"));const o=Ye(n);return kc(o==null?void 0:o.data)}let Eu=null,ql=null;function iA(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},o=t.labels,r={};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[a,s]of Object.entries(o)){const i=typeof a=="string"?Ze(a):"";i.length>0&&typeof s=="string"&&(r[i]=s)}return{order:n(t.order).map(a=>Ze(a)),labels:r,active:n(t.active).map(a=>Ze(a)),projectOrder:n(t.projectOrder).map(a=>Ze(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"?Ze(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function Ki(){return ql?ff(ql):(Eu||(Eu=lA().then(e=>(ql=e,e)).finally(()=>{Eu=null})),ff(await Eu))}async function lA(){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 iA(n.data)}function ff(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 np(){ql=null}async function uA(e,t){const n=(t??"").trim(),o=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),r=await o.json();if(!o.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:Ze(r.data.cwd),gitRoot:Ze(r.data.gitRoot)}}async function cA(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})}),o=await n.json();if(!n.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:Ze(o.data.cwd),gitRoot:Ze(o.data.gitRoot)}}async function dA(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),o=await fetch(`/codex-api/worktree/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load branches");const a=Array.isArray(r.data)?r.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 fA(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}),o=await fetch(`/codex-api/git/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load Git branch state");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.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,S=a.gitRoot,I=uy(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 S=="string"?Ze(S):"",options:c,changedFiles:I}}function uy(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){if(!o||typeof o!="object"||Array.isArray(o))continue;const r=o,a=r.path,s=typeof a=="string"?Ze(a.trim()):"";if(!s)continue;const i=r.status,l=typeof i=="string"?i.trim():"",c=r.label,d=typeof c=="string"&&c.trim()?c.trim():l;n.push({path:s,previousPath:typeof r.previousPath=="string"&&r.previousPath.trim()?Ze(r.previousPath.trim()):null,status:l,label:d,addedLineCount:typeof r.addedLineCount=="number"?r.addedLineCount:null,removedLineCount:typeof r.removedLineCount=="number"?r.removedLineCount:null})}return n}async function pA(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),o=await fetch(`/codex-api/git/repository-status?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to read Git repository status");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?Ze(a.gitRoot):""}}async function hA(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()})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to switch branch");const r=(a=o.data)==null?void 0:a.currentBranch;return typeof r=="string"&&r.trim()?r.trim():null}async function mA(e,t,n={}){const o=e.trim(),r=t.trim();if(!o||!r)return[];const a=new URLSearchParams({cwd:o,branch:r,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():"",S=typeof d.date=="string"?d.date.trim():"";return!v||!f?[]:[{sha:v,shortSha:f,subject:y||f,date:S}]})}async function vA(e,t){const n=e.trim(),o=t.trim();if(!n||!o)return[];const r=new URLSearchParams({cwd:n,sha:o}),a=await fetch(`/codex-api/git/commit-files?${r.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():"",S=typeof c.addedLineCount=="number"&&Number.isFinite(c.addedLineCount)?c.addedLineCount:null,I=typeof c.removedLineCount=="number"&&Number.isFinite(c.removedLineCount)?c.removedLineCount:null;return!d||!f?[]:[{path:d,previousPath:v,status:f,label:y||f,addedLineCount:S,removedLineCount:I}]})}async function gA(e,t,n){const o=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()})}),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to reset branch to commit");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.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"?Ze(a.gitRoot):"",options:[],changedFiles:uy(a.changedFiles)}}async function Pd(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");ql=ff(e)}async function Ru(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)??""})}),o=await n.json();if(!n.ok){const i=Jt(o,"Failed to open project root");throw new Error(i)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=typeof a.path=="string"?Ze(a.path):"";return np(),s}function yA(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function wA(e,t){var a;const n=e.headers.get("content-disposition")??"",o=n.match(/filename\*=UTF-8''([^;]+)/iu);if(o!=null&&o[1])try{return decodeURIComponent(o[1])}catch{return o[1]}const r=n.match(/filename="?([^";]+)"?/iu);return((a=r==null?void 0:r[1])==null?void 0:a.trim())||t}async function bA(e,t){var d;const n=await fetch(yA(e));if(!n.ok){const v=await n.json().catch(()=>null),f="Failed to export project",y=Jt(v,f),S=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),I=y!==f?y:S?`Failed to export project: ${S}`:f;throw new Error(I)}const o=Number(n.headers.get("content-length")??""),r=Number.isFinite(o)&&o>0?o:null,a=wA(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||r}),{blob:v,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:r});;){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:r}))}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 TA(e,t){const n=new URLSearchParams({parent:t}),o=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),r=await Si(o);if(!o.ok){const l=Jt(r,"Failed to import project");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?Ze(s.path):"";return i&&np(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function Im(){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:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof o.path=="string"?o.path.trim():""}async function SA(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const o=await fetch(`/codex-local-directories?${n.toString()}`),r=await Si(o);if(!o.ok){const l=Jt(r,"Failed to load local directories");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},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"?Ze(s.path):"",parentPath:typeof s.parentPath=="string"?Ze(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"?Ze(c.path):"";return d&&v?[{name:d,path:v}]:[]})}}async function QF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await Si(n);if(!n.ok){const i=Jt(o,"Failed to load workspace files");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).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"?Ze(l.path):"",d=typeof l.relativePath=="string"?l.relativePath.trim():"";return!c||!d?[]:[{path:c,relativePath:d,isDirectory:l.isDirectory===!0}]})}async function XF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await Si(n);if(!n.ok){const i=Jt(o,"Failed to preview file");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).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 CA(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Si(t);if(!t.ok){const s=Jt(n,"Failed to create local directory");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.path=="string"?Ze(r.path):"";return a&&np(),a}async function xA(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),o=await Si(n);if(!n.ok){const s=Jt(o,"Failed to clone GitHub repository");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof a.path=="string"?Ze(a.path):""}async function kA(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 Si(t);if(!t.ok){const s=Jt(n,"Failed to create new chat folder");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.cwd=="string"?Ze(r.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof r.outputDirectory=="string"?Ze(r.outputDirectory):a,workspaceRoot:typeof r.workspaceRoot=="string"?Ze(r.workspaceRoot):""}}async function IA(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),o=await n.json();if(!n.ok){const s=Jt(o,"Failed to suggest project name");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?Ze(a.path):""}}function AA(e){const t=Ye(e);if(!t)return null;const n=te(t.key),o=typeof t.text=="string"?t.text:"",r=te(t.kind);return!n||!r||r!=="meta"&&r!=="hunk"&&r!=="add"&&r!=="remove"&&r!=="context"?null:{key:n,kind:r,text:o,oldLine:qt(t.oldLine),newLine:qt(t.newLine)}}function _A(e){const t=Ye(e);if(!t)return null;const n=te(t.id),o=typeof t.header=="string"?t.header:"",r=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:o,patch:r,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=>AA(a)).filter(a=>a!==null):[]}:null}function PA(e){const t=Ye(e);if(!t)return null;const n=te(t.id),o=te(t.path),r=te(t.absolutePath),a=te(t.operation);return!n||!o||!r||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:o,absolutePath:r,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=>_A(s)).filter(s=>s!==null):[]}}function cy(e){const t=Ye(e),n=Ye(t==null?void 0:t.data),o=Ye(n==null?void 0:n.summary),r=te(n==null?void 0:n.scope),a=r==="baseBranch"||r==="commit"?r:"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:Zn(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(o==null?void 0:o.fileCount)??0,addedLineCount:qt(o==null?void 0:o.addedLineCount)??0,removedLineCount:qt(o==null?void 0:o.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>PA(i)).filter(i=>i!==null):[]}}function EA(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 ZF(e,t,n,o,r){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});o&&o.trim()&&a.set("baseBranch",o.trim()),r&&r.trim()&&a.set("commitSha",r.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(Jt(i,"Failed to load review snapshot"));return cy(i)}async function RA(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),o=await fetch(`/codex-api/review/summary?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(Jt(r,"Failed to load review summary"));return EA(r)}async function eB(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(Jt(n,"Failed to apply review action"));return cy(n)}async function tB(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(Jt(n,"Failed to initialize Git"))}async function MA(e,t,n,o,r,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:o,patchIds:r,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 jA(e,t,n){const o=await MA(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}const LA={},NA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function OA(e,t){return P(),B("svg",NA,[...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 Fs=Ct(LA,[["render",OA]]),$A={},DA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function FA(e,t){return P(),B("svg",DA,[...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 Mu=Ct($A,[["render",FA]]),BA={},UA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function zA(e,t){return P(),B("svg",UA,[...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 pf=Ct(BA,[["render",zA]]),HA={},qA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function WA(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 fl=Ct(HA,[["render",WA]]),GA={},VA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function KA(e,t){return P(),B("svg",VA,[...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(GA,[["render",KA]]),YA={},JA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function QA(e,t){return P(),B("svg",JA,[...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 XA=Ct(YA,[["render",QA]]),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:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const Ic=Ct(ZA,[["render",t_]]),dy="codex-web-local.ui-language.v1",n_={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":"上下文已压缩","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.":"请通过线程或项目菜单添加自动化。"},Am={en:"English","zh-CN":"简体中文"};function o_(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(dy))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Ac=T(o_());function fy(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}fy(Ac.value);function r_(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function a_(e){Ac.value=e,fy(e),typeof window<"u"&&window.localStorage.setItem(dy,e)}function py(e,t){const n=Ac.value==="zh-CN"?n_[e]??e:e;return r_(n,t)}function va(){return{uiLanguage:Ac,uiLanguageOptions:[{value:"en",label:Am.en},{value:"zh-CN",label:Am["zh-CN"]}],t:py,setUiLanguage:a_}}const hy="brutalstrikedevs@gmail.com",s_=20,i_=6500,_m=1800,Ed=12,Pm=240,Em=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,nl=T([]);let Rm=!1,Rd=!1,Md=null;function $l(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 l_(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function u_(e,t){var o;const n=(o=t==null?void 0:t.method)==null?void 0:o.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function my(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Mm(e){return encodeURIComponent(e)}function c_(){return`mailto:${hy}`}function d_(){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>_m?`${e.slice(0,_m)}
|
|
50
|
-
...[truncated]`:e:"No visible page text captured."}function f_(e,t){const n=t.replace(/\r\n/g,`
|
|
51
|
-
`).replace(/[ \t]+/g," ").trim();return n?Em.test(e)||Em.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Pm?`${n.slice(0,Pm)}...[truncated, ${n.length} chars total]`:n:""}function jm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,Ed);for(let a=0;a<o;a+=1){const s=e.key(a);s&&n.push(`${s}=${f_(s,e.getItem(s)??"")}`)}const r=e.length>Ed?`
|
|
52
|
-
...${e.length-Ed} more item(s)`:"";return`${t}:
|
|
53
|
-
${n.join(`
|
|
54
|
-
`)||"empty"}${r}`}catch(n){return`${t}: unavailable (${my($l(n))})`}}function p_(){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}`,jm(window.localStorage,"localStorage"),jm(window.sessionStorage,"sessionStorage")].join(`
|
|
55
|
-
`)}function di(e){const t=e.message.trim();if(!t)return;const n=nl.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 o={...e,message:t,atIso:e.atIso??new Date().toISOString()};nl.value=[o,...nl.value].slice(0,s_)}function vy(e=nl.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,o=typeof navigator>"u"?"unknown":navigator.userAgent,r="0.1.129",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: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${a}`,"","Browser/app state",p_(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",d_()].join(`
|
|
57
|
-
`).slice(0,i_),l=`Codex Web feedback: ${my((c=e[0])==null?void 0:c.message)}`;return`mailto:${hy}?subject=${Mm(l)}&body=${Mm(i)}`}function h_(){typeof window>"u"||(window.location.href=vy())}function m_(){if(!(typeof window>"u")&&(Rm||(Rm=!0,window.addEventListener("error",e=>{di({kind:"window-error",message:e.error?$l(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{di({kind:"unhandled-rejection",message:$l(e.reason),url:window.location.href})})),!Rd)){if(typeof window.fetch!="function"){di({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{Md=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=l_(e),o=u_(e,t);try{const r=await Md(e,t);return r.ok||di({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${r.status}`,url:n,method:o,status:r.status,statusText:r.statusText}),r}catch(r){throw di({kind:"fetch-error",message:$l(r),url:n,method:o}),r}},Rd=!0}catch(e){Md=null,Rd=!1;try{di({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${$l(e)}`,url:window.location.href})}catch{}}}}function gy(){const e=K(()=>nl.value.length>0);function t(n,o){di({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:nl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:h_,buildFeedbackMailto:vy,feedbackMailtoBase:c_}}const yy="codex-web-local.recycle-bin.v1";function wy(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(yy);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 Lm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yy,JSON.stringify(e))}catch{}}const Ba=T(wy());function v_(){function e(){Ba.value=wy()}function t(r){Ba.value=[{...r,archivedAtIso:new Date().toISOString()},...Ba.value.filter(a=>a.id!==r.id)],Lm(Ba.value)}function n(r){Ba.value=Ba.value.filter(a=>a.id!==r),Lm(Ba.value)}async function o(r){if(!Ba.value.some(a=>a.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await Xk(r),n(r),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Ba,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}function Nm(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function g_(e){let t=!1;const n=e.map(o=>{const r=[],a=new Map;for(const s of o.threads){const i=a.get(s.id);if(i===void 0){a.set(s.id,r.length),r.push(s);continue}t=!0,Nm(s)>Nm(r[i])&&(r[i]=s)}return r.length===o.threads.length?o:{...o,threads:r}});return t?n:e}const y_=["title","aria-label","disabled"],w_={key:1,class:"composer-dropdown-value"},b_={key:0,class:"composer-dropdown-search-wrap"},T_=["placeholder","onKeydown"],S_={class:"composer-dropdown-options",role:"listbox"},C_=["onClick"],x_={key:0,class:"composer-dropdown-empty"},k_=vn({__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,o=t,r=T(null),a=T(null),s=T(null),i=T(null),l=T(!1),c=T(""),d=T({});let v=!1;const f=K(()=>{var Ae;const oe=n.options.find(De=>De.value===n.modelValue);return oe?oe.label:((Ae=n.placeholder)==null?void 0:Ae.trim())||""}),y=K(()=>n.openDirection??"down"),S=K(()=>n.menuAlign??"start"),I=K(()=>n.iconOnly===!0),U=K(()=>n.enableSearch===!0),O=K(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),$=K(()=>{var oe;return((oe=n.searchPlaceholder)==null?void 0:oe.trim())||"Quick search projects"}),q=K(()=>{var oe;return((oe=n.emptyLabel)==null?void 0:oe.trim())||"No results"}),M=K(()=>{var oe;return f.value||((oe=n.placeholder)==null?void 0:oe.trim())||"Select option"}),pe=K(()=>{const oe=c.value.trim().toLowerCase();return oe?n.options.filter(Ae=>Ae.label.toLowerCase().includes(oe)||Ae.value.toLowerCase().includes(oe)):n.options});function ue(){n.disabled||(l.value=!l.value)}function V(oe,Ae,De){return Math.min(De,Math.max(Ae,oe))}function ie(){var re,se,je,qe;if(!l.value)return;const oe=r.value;if(!oe||typeof window>"u")return;const Ae=oe.getBoundingClientRect(),De=window.innerWidth,Ne=window.innerHeight,Le=8,Ce=8,Se=Math.max(0,De-Le*2),xe=((re=s.value)==null?void 0:re.offsetWidth)??((se=a.value)==null?void 0:se.offsetWidth)??224,Re=((je=s.value)==null?void 0:je.offsetHeight)??((qe=a.value)==null?void 0:qe.offsetHeight)??0,Je=Math.min(xe,Se),Xe=Math.max(Le,De-Je-Le),at=S.value==="end"?Ae.right-Je:Ae.left,ce=V(at,Le,Xe);let N=y.value==="up"?Ae.top-Re-Ce:Ae.bottom+Ce;Re>0&&N+Re>Ne-Le&&(N=Ne-Re-Le),N=Math.max(Le,N),d.value={position:"fixed",left:`${ce}px`,right:"auto",top:`${N}px`,bottom:"auto",width:`${Je}px`}}function ye(){v||typeof window>"u"||(window.addEventListener("resize",ie),window.addEventListener("scroll",ie,!0),v=!0)}function Pe(){!v||typeof window>"u"||(window.removeEventListener("resize",ie),window.removeEventListener("scroll",ie,!0),v=!1)}function ge(oe){o("update:modelValue",oe),l.value=!1,c.value=""}function Z(){if(c.value.length>0){c.value="";return}l.value=!1}function me(oe){if(!l.value)return;const Ae=r.value;if(!Ae)return;const De=oe.target;De instanceof Node&&(Ae.contains(De)||(l.value=!1,c.value=""))}return nt(l,oe=>{if(!oe){Pe(),d.value={};return}ye(),Dt(()=>{var Ae;ie(),window.requestAnimationFrame(ie),U.value&&((Ae=i.value)==null||Ae.focus())})}),Ti(()=>{window.addEventListener("pointerdown",me)}),Hs(()=>{window.removeEventListener("pointerdown",me),Pe()}),(oe,Ae)=>(P(),B("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[w("button",{class:ut(["composer-dropdown-trigger",O.value]),type:"button",title:M.value,"aria-label":M.value,disabled:e.disabled,onClick:ue},[e.selectedPrefixIcon?(P(),et(Ff(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),I.value?ve("",!0):(P(),B("span",w_,F(f.value),1)),Be(Fs,{class:"composer-dropdown-chevron"})],10,y_),l.value?(P(),B("div",{key:0,ref_key:"menuWrapRef",ref:a,class:ut(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":y.value==="up","composer-dropdown-menu-wrap-down":y.value==="down"}]),style:or(d.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[U.value?(P(),B("div",b_,[Mn(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":Ae[0]||(Ae[0]=De=>c.value=De),class:"composer-dropdown-search-input",type:"text",placeholder:$.value,onKeydown:So(gt(Z,["prevent"]),["esc"])},null,40,T_),[[Un,c.value]])])):ve("",!0),w("ul",S_,[(P(!0),B(ct,null,on(pe.value,De=>(P(),B("li",{key:De.value},[w("button",{class:ut(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:Ne=>ge(De.value)},F(De.label),11,C_)]))),128)),pe.value.length===0?(P(),B("li",x_,F(q.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),yi=Ct(k_,[["__scopeId","data-v-58b5aa2e"]]),I_={},A_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function __(e,t){return P(),B("svg",A_,[...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 hf=Ct(I_,[["render",__]]),P_=["aria-label","onKeydown"],E_={class:"app-dialog-header"},R_={class:"app-dialog-title-wrap"},M_={class:"app-dialog-title"},j_={key:0,class:"app-dialog-subtitle"},L_=["aria-label","title"],N_={class:"app-dialog-body"},O_={key:0,class:"app-dialog-footer"},$_=vn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:r}=va();function a(){o("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return nt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),Hs(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(P(),et(sl,{to:"body"},[e.open?(P(),B("div",{key:0,class:"app-dialog-overlay",onClick:gt(a,["self"])},[w("div",{class:ut(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:So(gt(a,["prevent"]),["esc"])},[w("div",E_,[w("div",R_,[w("h3",M_,F(e.title),1),e.subtitle?(P(),B("p",j_,F(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":m(r)("Close"),title:m(r)("Close"),onClick:a},[Be(hf,{class:"app-dialog-close-icon"})],8,L_)]),w("div",N_,[Co(i.$slots,"default",{},void 0)]),i.$slots.footer?(P(),B("div",O_,[Co(i.$slots,"footer",{},void 0)])):ve("",!0)],42,P_)])):ve("",!0)]))}}),jd=Ct($_,[["__scopeId","data-v-3405af9b"]]),D_={key:0,class:"sidebar-menu-row-left"},F_={class:"sidebar-menu-row-main"},B_={key:1,class:"sidebar-menu-row-right"},U_={key:0,class:"sidebar-menu-row-right-default"},z_={key:1,class:"sidebar-menu-row-right-hover"},H_=vn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=QS(),o=K(()=>!!n.left),r=K(()=>!!n.right),a=K(()=>!!n["right-hover"]),s=K(()=>r.value||a.value);return(i,l)=>(P(),et(Ff(t.as),qf({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:ft(()=>[o.value?(P(),B("span",D_,[Co(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",F_,[Co(i.$slots,"default",{},void 0,!0)]),s.value?(P(),B("span",B_,[r.value?(P(),B("span",U_,[Co(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(P(),B("span",z_,[Co(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"]))}}),Rs=Ct(H_,[["__scopeId","data-v-06eaad4c"]]),q_={},W_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function G_(e,t){return P(),B("svg",W_,[...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 ac=Ct(q_,[["render",G_]]),V_={},K_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Y_(e,t){return P(),B("svg",K_,[...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 by=Ct(V_,[["render",Y_]]),J_=["data-menu-open"],Q_={class:"thread-left-stack"},X_=["data-state"],Z_=["data-confirming","title"],eP={key:0,class:"thread-delete-confirm-label"},tP=["title"],nP={class:"thread-row-title-wrap"},oP={class:"thread-row-title-line"},rP={class:"thread-row-title"},aP={key:0,class:"thread-row-originator"},sP=["title"],iP={key:0,class:"thread-row-automation-count"},lP=["data-state"],uP={class:"thread-row-time"},cP=vn({__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,o=t,r=K(()=>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"},[Be(Rs,{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=>o("select")),onMouseleave:i[4]||(i[4]=l=>o("row-leave",l)),onContextmenu:i[5]||(i[5]=l=>o("row-contextmenu",l))},{left:ft(()=>[w("span",Q_,[n.showStatusIndicator?(P(),B("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,X_)):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=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(P(),B("span",eP,F(n.confirmLabel),1)):(P(),et(by,{key:1,class:"thread-icon"}))],8,Z_)])]),right:ft(()=>[w("span",uP,F(n.relativeTime),1)]),"right-hover":ft(()=>[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=>o("menu-toggle"),["stop"]))},[Be(pf,{class:"thread-icon"})])])]),default:ft(()=>[w("button",{class:"thread-main-button",type:"button",title:r.value,onClick:i[1]||(i[1]=gt(l=>o("select"),["stop"]))},[w("span",nP,[w("span",oP,[w("span",rP,F(n.thread.title),1),n.thread.originator?(P(),B("span",aP,F(n.thread.originator),1)):ve("",!0),n.thread.hasWorktree?(P(),et(ac,{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},[Be(Ic,{class:"thread-row-automation-icon"}),n.automationCount>1?(P(),B("span",iP,F(n.automationCount),1)):ve("",!0)],8,sP)):ve("",!0),n.thread.pendingRequestState?(P(),B("span",{key:3,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},F(n.requestLabel),9,lP)):ve("",!0)])])],8,tP)]),_:1},8,["data-thread-id","data-active","data-live","data-pinned","data-menu-open","force-right-hover"])],8,J_))}}),ju=Ct(cP,[["__scopeId","data-v-d01c8f46"]]);function dP(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}function fP(e){const{getGroups:t,t:n}=e,o=T({}),r=T({}),a=T(!1),s=T("thread"),i=T(""),l=T(""),c=T(""),d=T("create"),v=T(!1),f=T("thread"),y=T(""),S=T(""),I=T(""),U=T(""),O=T(!1),$=T(!1),q=T({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),M=T({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),pe=K(()=>{if(s.value==="project"){const de=l.value;return de?r.value[de]??[]:[]}const Y=i.value;return Y?o.value[Y]??[]:[]}),ue=K(()=>ce(q.value.rrule)),V=K(()=>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.")),ie=K(()=>{var de;const Y=[];for(const Te of t())for(const ze of Te.threads){const bt=((de=ze.title)==null?void 0:de.trim())||ze.id,yt=e.getProjectDisplayName(Te.projectName);Y.push({value:ze.id,label:`${bt} · ${yt}`,searchText:`${bt} ${yt} ${ze.id}`.toLowerCase()})}return Y}),ye=K(()=>{const Y=[];for(const de of t()){const Te=e.getProjectAutomationKey(de.projectName);if(!Te)continue;const ze=e.getProjectDisplayName(de.projectName);Y.push({value:Te,label:ze,searchText:`${ze} ${Te}`.toLowerCase()})}return Y}),Pe=K(()=>(f.value==="project"?ye.value:ie.value).map(de=>({value:de.value,label:de.label}))),ge=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],Z=K(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);nt(Pe,Y=>{var de;v.value&&(Y.some(Te=>Te.value===y.value)||(y.value=((de=Y[0])==null?void 0:de.value)??""))});function me(Y){var de;return((de=o.value[Y])==null?void 0:de.length)??0}function oe(Y){return me(Y)>0}function Ae(Y){var Te;const de=e.getProjectAutomationKey(Y);return de?((Te=r.value[de])==null?void 0:Te.length)??0:0}function De(Y){return Ae(Y)>0}function Ne(Y){if(Y.length===0)return"";if(Y.length>1){const ze=Y.filter(bt=>bt.status==="ACTIVE").length;return`${Y.length} ${n("automations")} • ${ze} ${n("active")}`}const[de]=Y,Te=de.status==="PAUSED"?"-":de.nextRunAtMs?new Date(de.nextRunAtMs).toLocaleString():n("Not scheduled");return`${de.name} • ${n("Next run")}: ${Te}`}function Le(Y){return Ne(o.value[Y]??[])}function Ce(Y){const de=e.getProjectAutomationKey(Y);return Ne(de?r.value[de]??[]:[])}function Se(Y){return String(Math.max(0,Y)).padStart(2,"0")}function xe(Y,de){const Te=typeof Y=="number"?Y:Number(Y);return Number.isFinite(Te)?Math.max(1,Math.floor(Te)):de}function Re(Y){const[de,Te]=Y.split(":"),ze=Math.min(23,Math.max(0,Number(de)||0)),bt=Math.min(59,Math.max(0,Number(Te)||0));return`FREQ=DAILY;BYHOUR=${ze};BYMINUTE=${bt}`}function Je(Y,de){const Te=xe(Y,1);return de==="minutes"?`FREQ=MINUTELY;INTERVAL=${Te}`:de==="hours"?`FREQ=HOURLY;INTERVAL=${Te}`:`FREQ=DAILY;INTERVAL=${Te}`}function Xe(Y){return Object.fromEntries(Y.split(";").map(de=>de.trim()).filter(Boolean).map(de=>{const[Te,...ze]=de.split("=");return[Te.toUpperCase(),ze.join("=").trim()]}).filter(([de,Te])=>de&&Te))}function at(Y){var bt;const de=Xe(Y),Te=(bt=de.FREQ)==null?void 0:bt.toUpperCase(),ze=xe(de.INTERVAL,1);if(Te==="DAILY"&&de.BYHOUR!==void 0&&de.BYMINUTE!==void 0&&ze===1){const yt=Math.min(23,Math.max(0,Number(de.BYHOUR)||0)),$t=Math.min(59,Math.max(0,Number(de.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Se(yt)}:${Se($t)}`,interval:1,intervalUnit:"hours"}}return Te==="MINUTELY"||Te==="HOURLY"||Te==="DAILY"&&de.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:ze,intervalUnit:Te==="MINUTELY"?"minutes":Te==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function ce(Y){var bt;const de=Xe(Y),Te=(bt=de.FREQ)==null?void 0:bt.toUpperCase(),ze=xe(de.INTERVAL,1);if(Te==="DAILY"&&de.BYHOUR!==void 0&&de.BYMINUTE!==void 0&&ze===1){const yt=Math.min(23,Math.max(0,Number(de.BYHOUR)||0)),$t=Math.min(59,Math.max(0,Number(de.BYMINUTE)||0));return`${n("RRULE")}: ${Y} · ${n("runs daily at")} ${Se(yt)}:${Se($t)}`}return Te==="MINUTELY"?`${n("RRULE")}: ${Y} · ${n("runs every")} ${ze} ${n("minute(s)")}`:Te==="HOURLY"?`${n("RRULE")}: ${Y} · ${n("runs every")} ${ze} ${n("hour(s)")}`:Te==="DAILY"&&de.INTERVAL!==void 0?`${n("RRULE")}: ${Y} · ${n("runs every")} ${ze} ${n("day(s)")}`:Y?`${n("RRULE")}: ${Y}`:n("RRULE is required.")}function N(){const Y=M.value;Y.mode==="daily"?q.value.rrule=Re(Y.dailyTime):Y.mode==="interval"&&(q.value.rrule=Je(Y.interval,Y.intervalUnit))}function re(Y){Y!=="minutes"&&Y!=="hours"&&Y!=="days"||(M.value={...M.value,intervalUnit:Y},N())}function se(Y){Y!=="ACTIVE"&&Y!=="PAUSED"||(q.value={...q.value,status:Y})}function je(){M.value=at(q.value.rrule)}function qe(Y){M.value={...M.value,mode:Y},N()}function _(Y){var Te;s.value="thread",i.value=Y,l.value="",v.value=!1,S.value="",I.value="";const de=(Te=o.value[Y])==null?void 0:Te[0];de?_e(de.id):ae(),a.value=!0,e.closeThreadMenu()}function R(Y){var ze;const de=e.getProjectAutomationKey(Y);if(!de){s.value="project",i.value="",l.value="",v.value=!1,S.value=n("Project automation requires a resolved absolute project path."),I.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=de,v.value=!1,S.value="",I.value="";const Te=(ze=r.value[de])==null?void 0:ze[0];Te?_e(Te.id):ae(),a.value=!0,e.closeProjectMenu()}function H(Y){s.value=Y.scope,i.value=Y.scope==="thread"?Y.target:"",l.value=Y.scope==="project"?Y.target:"",v.value=!1,S.value="",I.value="",Y.scope==="project"?r.value=We(r.value,Y.target,Y.automation):o.value=he(o.value,Y.target,Y.automation),_e(Y.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function le(){var Y;v.value=!0,f.value="thread",y.value=((Y=ie.value[0])==null?void 0:Y.value)??"",s.value="thread",i.value="",l.value="",S.value="",I.value="",ae(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ne(Y){var de;f.value=Y,y.value="",s.value=Y==="project"?"project":"thread",y.value=((de=Pe.value[0])==null?void 0:de.value)??""}function ae(){c.value="",d.value="create",S.value="",I.value="",q.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},M.value=at(q.value.rrule)}function _e(Y){const de=pe.value.find(Te=>Te.id===Y);de&&(c.value=de.id,d.value="edit",S.value="",I.value="",q.value={name:de.name,prompt:de.prompt,rrule:de.rrule,status:de.status},M.value=at(de.rrule))}function Oe(){a.value=!1,s.value="thread",i.value="",l.value="",c.value="",S.value="",I.value="",O.value=!1,$.value=!1}function Ie(Y,de){return Object.fromEntries(Object.entries(Y).filter(([Te])=>Te!==de))}function he(Y,de,Te){const ze=Y[de]??[],bt=ze.findIndex($t=>$t.id===Te.id),yt=[...ze];return bt>=0?yt.splice(bt,1,Te):yt.push(Te),{...Y,[de]:yt}}function Ke(Y,de,Te){const ze=(Y[de]??[]).filter(bt=>bt.id!==Te);return ze.length>0?{...Y,[de]:ze}:Ie(Y,de)}function $e(Y,de){return Object.fromEntries(Object.entries(Y).filter(([Te])=>Te!==de))}function We(Y,de,Te){const ze=Y[de]??[],bt=ze.findIndex($t=>$t.id===Te.id),yt=[...ze];return bt>=0?yt.splice(bt,1,Te):yt.push(Te),{...Y,[de]:yt}}async function Ge(){r.value=await Hx()}async function dt(Y){await am(Y).catch(()=>{}),o.value=Ie(o.value,Y)}async function wt(){let Y=i.value,de=l.value;O.value=!0,S.value="",I.value="";try{if(N(),v.value&&d.value==="create"&&(f.value==="thread"?(Y=y.value,de="",s.value="thread",i.value=Y,l.value=""):(de=y.value,Y="",s.value="project",i.value="",l.value=de)),s.value==="thread"&&!Y)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!de)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},ze=s.value==="project"?await Wx({...Te,projectName:de}):await qx({...Te,threadId:Y});s.value==="project"?await Ge():o.value=he(o.value,Y,ze),e.onAutomationsChanged(),_e(ze.id),I.value=n("Automation saved."),O.value=!1}catch(Te){S.value=Te instanceof Error?Te.message:n("Failed to save automation"),O.value=!1}}async function tt(){const Y=i.value,de=l.value,Te=c.value;if(Te&&!(s.value==="thread"&&!Y)&&!(s.value==="project"&&!de)){O.value=!0,S.value="",I.value="";try{s.value==="project"?(await Vg(de,Te),await Ge()):(await am(Y,Te),o.value=Ke(o.value,Y,Te));const ze=pe.value[0];ze?_e(ze.id):ae(),e.onAutomationsChanged(),O.value=!1}catch(ze){S.value=ze instanceof Error?ze.message:n("Failed to remove automation"),O.value=!1}}}async function st(){const Y=i.value,de=c.value;if(!(!Y||!de)){$.value=!0,S.value="",I.value="";try{await Gx(Y,de),I.value=n("Automation run queued.")}catch(Te){S.value=Te instanceof Error?Te.message:n("Failed to run automation")}finally{$.value=!1}}}return{automationByThreadId:o,automationByProjectName:r,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:c,automationDialogMode:d,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:y,automationDialogError:S,automationDialogNotice:I,projectAutomationActionError:U,isSavingAutomation:O,isRunningAutomation:$,automationDraft:q,automationScheduleDraft:M,automationDialogAutomations:pe,automationSchedulePreview:ue,automationDialogSubtitle:V,automationThreadTargetOptions:ie,automationProjectTargetOptions:ye,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:ge,automationStatusOptions:Z,threadAutomationCount:me,threadHasAutomation:oe,projectAutomationCount:Ae,projectHasAutomation:De,threadAutomationTooltip:Le,projectAutomationTooltip:Ce,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:re,onAutomationStatusChange:se,syncAutomationScheduleDraftFromRrule:je,setAutomationScheduleMode:qe,openAutomationDialog:_,openProjectAutomationDialog:R,openAutomationEditorFromPanel:H,openAutomationCreatorFromPanel:le,setAutomationTargetMode:ne,startNewAutomationDraft:ae,selectAutomationForEditing:_e,closeAutomationDialog:Oe,omitAutomationProject:$e,reloadProjectAutomations:Ge,removeAutomationsForThread:dt,submitAutomationDialog:wt,onDeleteAutomationFromDialog:tt,onRunAutomationFromDialog:st}}const pP=4,Om=6;function hP(e,t,n){if(e===null||n===0)return null;const o=Math.max(0,Math.min(e,n)),r=o>t?o-1:o,a=Math.max(0,Math.min(r,n-1));return a===t?null:a}function mP(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:o,isCollapsed:r,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=T(null),c=T(null),d=T(null);let v=null,f=null;const y=T(""),S=T({}),I=new Map,U=new WeakMap,O=typeof window<"u"?new ResizeObserver(ce=>{for(const N of ce){const re=N.target,se=U.get(re);se&&q(se,re)}}):null,$=()=>{var ce,N;return((ce=d.value)==null?void 0:ce.projectName)??((N=c.value)==null?void 0:N.projectName)??""};function q(ce,N){const re=N.getBoundingClientRect().height;if(!Number.isFinite(re)||re<=0)return;const se=S.value[ce];se!==void 0&&Math.abs(se-re)<.5||(S.value={...S.value,[ce]:re})}function M(ce,N){const re=I.get(ce);re&&re!==N&&O&&O.unobserve(re);const se=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(se){I.set(ce,se),U.set(se,ce),q(ce,se),O==null||O.observe(se);return}re&&(O==null||O.unobserve(re)),I.delete(ce)}function pe(ce){const N=S.value[ce]??0,re=d.value,je=((re==null?void 0:re.projectName)===ce?re.groupHeight:null)??N,qe=r(ce)?0:Om;return Math.max(0,je+qe)}const ue=K(()=>{const ce=d.value;return ce?hP(ce.dropTargetIndexFull,ce.fromIndex,t().length):null}),V=K(()=>{const N=(o()?n():t()).map(_=>_.projectName),re=d.value,se=ue.value;if(!re||se===null)return N;const je=[...N],[qe]=je.splice(re.fromIndex,1);return qe?(je.splice(se,0,qe),je):N}),ie=K(()=>{const ce={};let N=0;for(const re of V.value)ce[re]=N,N+=pe(re);return ce}),ye=K(()=>{let ce=0;for(const N of V.value)ce+=pe(N);return{height:`${Math.max(0,ce)}px`}});function Pe(ce,N){if(ce.button!==0||o()||c.value||d.value)return;const se=t().findIndex(R=>R.projectName===N),je=I.get(N);if(se<0||!je)return;const qe=je.getBoundingClientRect(),_=r(N)?0:Om;c.value={projectName:N,fromIndex:se,startClientX:ce.clientX,startClientY:ce.clientY,pointerOffsetY:ce.clientY-qe.top,groupLeft:qe.left,groupWidth:qe.width,groupHeight:qe.height,groupOuterHeight:qe.height+_},ce.preventDefault(),ge()}function ge(){window.addEventListener("mousemove",me),window.addEventListener("mouseup",oe),window.addEventListener("keydown",Ae)}function Z(){window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",oe),window.removeEventListener("keydown",Ae)}function me(ce){v={clientX:ce.clientX,clientY:ce.clientY},Ne()}function oe(ce){Le({clientX:ce.clientX,clientY:ce.clientY});const N=d.value;if(N&&ue.value!==null){const re=t().findIndex(se=>se.projectName===N.projectName);if(re>=0){const se=ue.value;se!==re&&s(N.projectName,se)}}De({preserveToggleSuppression:!!N})}function Ae(ce){ce.key==="Escape"&&(!c.value&&!d.value||(ce.preventDefault(),De()))}function De(ce={}){f!==null&&(window.cancelAnimationFrame(f),f=null),v=null,c.value=null,d.value=null,ce.preserveToggleSuppression||(y.value=""),Z()}function Ne(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!v)return;const ce=v;v=null,Le(ce)}))}function Le(ce){const N=c.value;if(!d.value&&N){const re=ce.clientX-N.startClientX,se=ce.clientY-N.startClientY;if(Math.hypot(re,se)<pP)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:ce.clientY-N.pointerOffsetY,dropTargetIndexFull:null}}d.value&&Ce(ce)}function Ce(ce){const N=d.value;if(!N)return;if(N.ghostTop=ce.clientY-N.pointerOffsetY,!Se(ce)){N.dropTargetIndexFull=null;return}const re=ce.clientY,se=l.value;if(!se){N.dropTargetIndexFull=null;return}const je=t(),qe=se.getBoundingClientRect(),_=new Map(je.map((ne,ae)=>[ne.projectName,ae])),R=je.map(ne=>ne.projectName).filter(ne=>ne!==N.projectName);let H=0,le=je.length;for(const ne of R){const ae=_.get(ne);if(ae===void 0)continue;const _e=pe(ne),Oe=qe.top+H+_e/2;if(re<Oe){le=ae;break}H+=_e}N.dropTargetIndexFull=le}function Se(ce){const N=l.value;if(!N)return!1;const re=N.getBoundingClientRect(),se=ce.clientX>=re.left&&ce.clientX<=re.right,je=ce.clientY>=re.top-32&&ce.clientY<=re.bottom+32;return se&&je}function xe(ce){var N;return((N=d.value)==null?void 0:N.projectName)===ce}function Re(ce){const N=d.value,re=ie.value[ce]??0,se=a()===ce;return!N||N.projectName!==ce?{position:"absolute",top:"0",left:"0",right:"0",zIndex:se?"40":"1",transform:`translate3d(0, ${re}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(ce){return y.value===ce?(y.value="",!0):!1}function Xe(ce){const N=$();N&&!ce.includes(N)&&De();const re=new Set(ce),se=Object.fromEntries(Object.entries(S.value).filter(([je])=>re.has(je)));Object.keys(se).length!==Object.keys(S.value).length&&(S.value=se)}function at(){for(const ce of I.values())O==null||O.unobserve(ce);I.clear(),De()}return{groupsContainerRef:l,groupsContainerStyle:ye,setProjectGroupRef:M,isDraggingProject:xe,projectGroupStyle:Re,onProjectHandleMouseDown:Pe,takeToggleSuppression:Je,pruneProjectGroups:Xe,dispose:at}}const vP={key:0,class:"pinned-section"},gP={class:"thread-tree-header"},yP={key:0,class:"thread-list"},wP={class:"projects-section"},bP={class:"thread-tree-header"},TP=["aria-expanded","aria-label","title"],SP={class:"organize-menu-title"},CP=["data-active"],xP={key:0},kP=["data-active"],IP={key:0},AP=["data-active"],_P={key:0},PP={class:"organize-menu-title"},EP=["data-active"],RP={key:0},MP=["data-active"],jP={key:0},LP={key:0,class:"thread-tree-action-error"},NP={key:1,class:"thread-tree-no-results"},OP={key:2,class:"thread-tree-loading"},$P={key:3,class:"thread-list thread-list-global"},DP=["data-project-name","data-expanded","data-dragging"],FP={class:"project-icon-stack"},BP={class:"project-icon-folder"},UP={class:"project-icon-chevron"},zP=["data-dragging-handle","onMousedown"],HP=["title"],qP=["title"],WP={key:0,class:"thread-row-automation-count"},GP={class:"project-hover-controls"},VP=["onClick"],KP=["data-open-direction"],YP=["onClick"],JP=["onClick"],QP=["onClick"],XP=["onClick"],ZP=["onClick"],eE=["onClick"],tE={class:"project-menu-label"},nE=["onInput"],oE=["aria-label","title","onClick"],rE={key:0,class:"thread-list"},aE={class:"project-empty"},sE=["onClick"],iE={class:"chats-section"},lE={class:"thread-tree-header"},uE={class:"chats-section-actions"},cE=["aria-label","title"],dE={key:0,class:"thread-tree-no-results"},fE={key:1,class:"thread-list thread-list-global"},pE=["data-open-direction"],hE=["disabled","title"],mE=["placeholder","onKeydown"],vE={class:"recycle-bin-content"},gE={key:0,class:"recycle-bin-empty"},yE={key:1,class:"recycle-bin-list"},wE={class:"recycle-bin-item-copy"},bE={class:"recycle-bin-item-title"},TE={key:0,class:"recycle-bin-item-meta"},SE={class:"recycle-bin-item-time"},CE={class:"recycle-bin-item-actions"},xE=["disabled","onClick"],kE=["onClick"],IE={key:2,class:"recycle-bin-error",role:"alert"},AE=["aria-label"],_E={class:"rename-thread-title"},PE={class:"rename-thread-subtitle"},EE={key:0,class:"automation-target-picker"},RE={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},ME={class:"automation-target-dropdown"},jE=["aria-label"],LE=["onClick"],NE={class:"automation-thread-field"},OE={class:"automation-thread-label"},$E=["placeholder"],DE={class:"automation-thread-field"},FE={class:"automation-thread-label"},BE=["placeholder"],UE={class:"automation-thread-field"},zE={class:"automation-thread-label"},HE={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},qE={key:0,class:"automation-schedule-row"},WE={class:"automation-schedule-copy"},GE={key:1,class:"automation-schedule-row"},VE={class:"automation-schedule-copy"},KE={class:"automation-schedule-preview"},YE={class:"automation-thread-field"},JE={class:"automation-thread-label"},QE={key:2,class:"rename-thread-subtitle automation-thread-error"},XE={key:3,class:"rename-thread-subtitle automation-thread-notice"},ZE={class:"rename-thread-actions"},eR=["disabled"],tR=["disabled"],nR=["disabled"],oR=["disabled"],$m="codex-web-local.sidebar-section-expansion.v1",Dm="codex-web-local.sidebar-chats-first.v1",Fm="codex-web-local.sidebar-chat-sort-mode.v1",Bm="codex-web-local.thread-view-mode.v1",Um="codex-web-local.collapsed-projects.v1",rR=vn({__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 o=e,{t:r}=va(),{recordVisibleFailure:a}=gy(),s=n,{records:i,loadRecords:l,recordArchivedThread:c,removeArchivedRecord:d,restoreArchivedThread:v}=v_(),f=T(!1),y=T(""),S=T("");function I(){ln.value=!1,y.value="",l(),f.value=!0}async function U(C){if(!S.value){S.value=C,y.value="";try{const E=await v(C);E.ok?s("restore-thread",C):y.value=E.error??"Failed to restore thread"}finally{S.value=""}}}const O=T({}),$=T({}),q=T(!0),M=T(!0),pe=T(!0),ue=T(!1),V=T(pr(Dm,!1)),ie=T(no());let ye=!1;const Pe=T([]),ge=T({}),Z=T(""),me=T([]),oe=T(""),Ae=T(""),De=T("hover"),Ne=T({}),Le=T({}),Ce=T({}),Se=T("actions"),xe=T(""),Re=T(!1),Je=T(""),Xe=T(""),at=T(null),ce=T(!1),N=T(""),re=T(""),se=fP({getGroups:()=>o.groups,t:r,getProjectDisplayName:_n,getProjectAutomationKey:xi,closeThreadMenu:He,closeProjectMenu:en,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:je,automationByProjectName:qe,automationDialogVisible:_,automationDialogScope:R,automationDialogAutomationId:H,automationDialogMode:le,automationTargetPickerVisible:ne,automationTargetMode:ae,automationTargetValue:_e,automationDialogError:Oe,automationDialogNotice:Ie,projectAutomationActionError:he,isSavingAutomation:Ke,isRunningAutomation:$e,automationDraft:We,automationScheduleDraft:Ge,automationDialogAutomations:dt,automationSchedulePreview:wt,automationDialogSubtitle:tt,automationTargetDropdownOptions:st,automationIntervalUnitOptions:Y,automationStatusOptions:de,threadAutomationCount:Te,threadHasAutomation:ze,projectAutomationCount:bt,projectHasAutomation:yt,threadAutomationTooltip:$t,projectAutomationTooltip:Lr,syncAutomationRruleFromScheduleDraft:Qt,onAutomationIntervalUnitChange:ur,onAutomationStatusChange:eo,syncAutomationScheduleDraftFromRrule:ga,setAutomationScheduleMode:cr,openAutomationDialog:qs,openProjectAutomationDialog:ya,openAutomationEditorFromPanel:Za,openAutomationCreatorFromPanel:$o,setAutomationTargetMode:es,startNewAutomationDraft:Do,selectAutomationForEditing:Nr,closeAutomationDialog:Or,omitAutomationProject:Ws,reloadProjectAutomations:$r,removeAutomationsForThread:Fo,submitAutomationDialog:ts,onDeleteAutomationFromDialog:wa,onRunAutomationFromDialog:Dr}=se,dr=mP({getGroups:()=>o.groups,getFilteredGroups:()=>hr.value,isSearchActive:()=>In.value,isCollapsed:jt,getElevatedProjectName:()=>oe.value?oe.value:Ae.value?Wt.value.get(Ae.value)??"":"",onReorderProject:(C,E)=>s("reorder-project",{projectName:C,toIndex:E}),closeProjectMenu:en}),{groupsContainerRef:fr,groupsContainerStyle:xo,setProjectGroupRef:ns,isDraggingProject:os,projectGroupStyle:vt,onProjectHandleMouseDown:xt,takeToggleSuppression:It,pruneProjectGroups:cn,dispose:qn}=dr,sn=new Map,ko=new Map,po=T(null),Fr=T(null),ln=T(!1),to=T(Et());function Io(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(Um);if(!C)return{};const E=JSON.parse(C);return!E||typeof E!="object"||Array.isArray(E)?{}:E}catch{return{}}}function Et(){return typeof window>"u"?"project":window.localStorage.getItem(Bm)==="chronological"?"chronological":"project"}function pr(C,E){if(typeof window>"u")return E;const x=window.localStorage.getItem(C);return x==="true"?!0:x==="false"?!1:E}function no(){return typeof window>"u"?"updated":window.localStorage.getItem(Fm)==="created"?"created":"updated"}$.value=Io();function gn(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem($m)||"{}");typeof C.pinned=="boolean"&&(q.value=C.pinned),typeof C.projects=="boolean"&&(M.value=C.projects),typeof C.chats=="boolean"&&(pe.value=C.chats)}catch{}}function Bo(){typeof window>"u"||window.localStorage.setItem($m,JSON.stringify({pinned:q.value,projects:M.value,chats:pe.value}))}gn(),nt($,C=>{typeof window>"u"||window.localStorage.setItem(Um,JSON.stringify(C))},{deep:!0}),nt(to,C=>{typeof window>"u"||window.localStorage.setItem(Bm,C)}),nt(V,C=>{typeof window>"u"||window.localStorage.setItem(Dm,String(C))}),nt(ie,C=>{typeof window>"u"||window.localStorage.setItem(Fm,C)}),nt([q,M,pe],Bo);const Ln=K(()=>o.searchQuery.trim().toLowerCase()),In=K(()=>Ln.value.length>0),yn=K(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),ba=K(()=>new Set(Pe.value)),ho=K(()=>new Set(me.value));function Uo(C){if(ho.value.has(C.id))return!1;if(!In.value)return!0;if(yn.value)return yn.value.has(C.id);const E=Ln.value;return C.title.toLowerCase().includes(E)||C.preview.toLowerCase().includes(E)}const Ft=K(()=>g_(o.groups)),hr=K(()=>Ft.value.flatMap(C=>{const E=C.threads.filter(x=>!oc(x.cwd)&&Uo(x));return E.length>0?[{...C,threads:E}]:!In.value&&C.threads.length===0?[{...C,threads:E}]:[]})),Br=K(()=>to.value==="chronological"),Ur=K(()=>{const C=[];for(const E of Ft.value)for(const x of E.threads)ba.value.has(x.id)||Uo(x)&&C.push(x);return C.sort((E,x)=>{const Q=new Date(E.updatedAtIso||E.createdAtIso).getTime();return new Date(x.updatedAtIso||x.createdAtIso).getTime()-Q})}),wn=K(()=>{const C=Ur.value.filter(x=>oc(x.cwd)),E=ie.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((x,Q)=>{const Qe=new Date(x[E]||x.updatedAtIso||x.createdAtIso).getTime();return new Date(Q[E]||Q.updatedAtIso||Q.createdAtIso).getTime()-Qe})}),Yt=K(()=>In.value||ue.value?wn.value:wn.value.slice(0,10)),mo=K(()=>In.value?!1:wn.value.length>10),un=K(()=>{const C=new Map;for(const E of Ft.value)for(const x of E.threads)ho.value.has(x.id)||C.set(x.id,x);return C});nt(Pe,C=>{ye&&$I(C)}),nt([un,()=>o.isThreadListFullyLoaded],([C])=>{const E=dP(Pe.value,new Set(C.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(E.length===Pe.value.length)return;const x=new Set(E),Q=Object.fromEntries(Object.entries(ge.value).filter(([Qe])=>x.has(Qe)));ge.value=Q,Pe.value=E});let zr=0;async function Xt(){if(o.isLoading)return;const C=Pe.value.filter(Qe=>!un.value.has(Qe)&&!ge.value[Qe]);if(C.length===0)return;const E=zr+=1,x=await Promise.all(C.map(async Qe=>{try{return await Yk(Qe)}catch{return null}}));if(E!==zr)return;const Q={...ge.value};for(const Qe of x)Qe&&(Q[Qe.id]=Qe);ge.value=Q}nt([Pe,un,()=>o.isLoading],()=>{ye&&Xt()}),Ti(async()=>{const{threadIds:C}=await OI(),E=Array.isArray(C)?C.filter(x=>typeof x=="string").map(x=>x.trim()).filter((x,Q,Qe)=>x.length>0&&Qe.indexOf(x)===Q):[];E.length>0&&(Pe.value=E);try{je.value=await zx()}catch{je.value={}}try{await $r()}catch{qe.value={}}ye=!0,Xt()});const zo=K(()=>ze(N.value)),Ta=K(()=>{const C=re.value;return zo.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:C}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:C})}),Wt=K(()=>{const C=new Map;for(const E of o.groups)for(const x of E.threads)C.set(x.id,E.projectName);return C}),Hr=K(()=>{const C=new Map;for(const E of o.groups){const x=E.threads.filter(Q=>!ba.value.has(Q.id)&&!ho.value.has(Q.id));C.set(E.projectName,x)}return C}),qr=K(()=>{const C=new Map;for(const E of o.groups)for(const x of E.threads){const Q=new Date(x.updatedAtIso||x.createdAtIso).getTime();C.set(x.id,Q)}return C}),At=K(()=>{const C=Ae.value;return C?un.value.get(C)??null:null}),bn=K(()=>Pe.value.map(C=>un.value.get(C)??ge.value[C]??null).filter(C=>C!==null).filter(Uo));function Wr(){q.value=!q.value}function Ao(){M.value=!M.value}function _o(){pe.value=!pe.value}function Gr(C){if(Number.isNaN(C))return"n/a";const E=Math.abs(Date.now()-C);if(E<6e4)return r("now");const x=Math.floor(E/6e4);if(x<60)return`${x}m`;const Q=Math.floor(x/60);return Q<24?`${Q}h`:`${Math.floor(Q/24)}d`}function Ho(C){const E=qr.value.get(C.id);return Gr(typeof E=="number"?E:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function Vr(C){const E=new Date(C).getTime();return Number.isNaN(E)?"":new Date(E).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function oo(C){return ba.value.has(C)}function mr(C){if(oo(C)){Pe.value=Pe.value.filter(E=>E!==C);return}Pe.value=[C,...Pe.value]}function Kr(C){mr(C),He()}function Po(C){Z.value="",s("select",C)}function ht(C){C===o.selectedThreadId&&(s("copy-thread-chat",C),He())}function An(C){s("fork-thread",C),He()}function Tn(C){return`${r("start new thread")} ${_n(C)}`}function Sa(C){s("start-new-thread",C)}function Wn(C){s("browse-thread-files",C),He()}function k(C){s("save-thread-project",C),He()}async function j(C){var x,Q;const E=((Q=(x=un.value.get(C))==null?void 0:x.cwd)==null?void 0:Q.trim())??"";if(He(),!(!E||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(E)}catch{}}function G(C,E){if(Ae.value===C&&De.value==="hover"){if(E){const x=E.relatedTarget,Q=Fr.value;if(x instanceof Node&&Q&&Q.contains(x))return}He()}}function be(C){return Ae.value===C}function He(){Ae.value="",De.value="hover",Ce.value={}}function Mt(C){if(Z.value="",Ae.value===C){He();return}De.value="hover",en(),ln.value=!1,Ae.value=C,Dt(()=>{Ko(C)})}function _t(C,E){C.preventDefault(),Z.value="",De.value="contextmenu",Ae.value=E}function Zt(C,E){Je.value=C,Xe.value=E,Re.value=!0,He(),Dt(()=>{var x,Q;(x=at.value)==null||x.focus(),(Q=at.value)==null||Q.select()})}function Gt(){Re.value=!1,Je.value="",Xe.value=""}function qo(){const C=Je.value,E=Xe.value.trim();!C||!E||(s("rename-thread",{threadId:C,title:E}),Gt())}function Ca(C,E){Z.value="",N.value=C,re.value=E,ce.value=!0,He()}function rs(){ce.value=!1,N.value="",re.value=""}async function dn(){const C=N.value;C&&(Gs(C),rs())}function xa(C){return Z.value===C}function ka(C){if(Z.value!==C){Z.value=C,He();return}Gs(C),Z.value=""}function Gs(C){var x,Q;const E=un.value.get(C)??null;ho.value.has(C)||(me.value=[C,...me.value]),Z.value="",He(),c({id:C,title:((x=E==null?void 0:E.title)==null?void 0:x.trim())||"(untitled)",cwd:((Q=E==null?void 0:E.cwd)==null?void 0:Q.trim())??"",projectName:Wt.value.get(C)??""}),Pe.value=Pe.value.filter(Qe=>Qe!==C),s("archive",C),ze(C)&&Fo(C)}function _n(C){return o.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:Za,openAutomationCreatorFromPanel:$o,openRenameThreadDialog:Zt,openRecycleBin:I});function as(C){return C.includes("/")||C.includes("\\")}function Vs(C){return as(C)?C:_n(C)}function ss(C){const E=No(C);if(!E)return!1;let x=0;for(const Q of o.groups)if(as(Q.projectName)&&No(Q.projectName)===E&&(x+=1,x>1))return!0;return!1}function Ia(C){const E=o.projectDisplayNameById[C.projectName],x=_n(C.projectName),Q=C.projectName;if(E&&!as(Q)&&Q!==x)return x.includes(Q)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(Q)?x:`${x} ${Q}`;if(E&&as(Q)){const Kn=No(Q),yo=No(tl(Q)),tn=ss(Q)?yo:Kn;return tn&&tn!==x?`${x} ${tn}`:x}if(!x.includes("/")&&!x.includes("\\"))return x;const Qe=No(x)||x,Ut=No(tl(x));return Ut.startsWith(".")&&Ut!==Qe?`${Qe} ${Ut}`:C.threads.length>0||!ss(Q)?Qe:Ut?`${Qe} ${Ut}`:Qe}function Yr(C){return oe.value===C}function en(){oe.value="",Se.value="actions",xe.value=""}function Jr(){const C=!ln.value;C&&(en(),He()),ln.value=C}function Wo(C){to.value=C,ln.value=!1}function fn(){V.value=!V.value}function vr(C){ie.value=C}function gr(C){s("request-project-git-status",C),Dt(()=>{Zr(C)})}function is(C){if(oe.value===C){en();return}He(),ln.value=!1,oe.value=C,Se.value="actions",xe.value=_n(C),gr(C)}function rn(C){He(),ln.value=!1,oe.value=C,Se.value="actions",xe.value=_n(C),gr(C)}function Ci(C){return o.projectDisplayNameById[C.projectName]??Ia(C)}function pn(C){He();const E=C.projectName;oe.value=E,Se.value="rename",xe.value=Ci(C),Dt(()=>{Zr(E)})}function Ks(C){s("browse-project-files",C),en()}function ro(C){s("save-project",C),en()}function ls(C){s("create-project-worktree",C),en()}function us(C){s("rename-project",{projectName:C,displayName:xe.value})}function ml(C){const E=xi(C);if(s("remove-project",C),E&&yt(C)){he.value="";const x=qe.value;qe.value=Ws(qe.value,E),Vg(E).then($r).catch(async Q=>{qe.value=x;const Qe=Q instanceof Error?Q.message:r("Failed to delete project automation");he.value=Qe,a(Qe);try{await $r()}catch{qe.value=x}}).finally(()=>{s("automations-changed")})}en()}function xi(C){var x;const E=((x=o.projectCwdByName[C])==null?void 0:x.trim())??"";return ok(E)?E:""}function Ys(C,E){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const x=o.groups.findIndex(Ut=>Ut.projectName===E);if(x<0)return;const Q=C.key==="ArrowUp"?-1:1,Qe=Math.max(0,Math.min(x+Q,o.groups.length-1));Qe!==x&&(C.preventDefault(),s("reorder-project",{projectName:E,toIndex:Qe}))}function Pt(C){return O.value[C]===!0}function jt(C){return $.value[C]===!0}function cs(C){O.value={...O.value,[C]:!Pt(C)}}function Eo(){ue.value=!ue.value}function Gn(C){It(C)||($.value={...$.value,[C]:!jt(C)})}function Go(C,E){const x=E instanceof HTMLElement?E:E&&"$el"in E&&E.$el instanceof HTMLElement?E.$el:null;if(x){sn.set(C,x);return}sn.delete(C)}function Qr(C,E){const x=E instanceof HTMLElement?E:E&&"$el"in E&&E.$el instanceof HTMLElement?E.$el:null;if(x){ko.set(C,x);return}ko.delete(C)}function Vn(C){let E=C.parentElement;for(;E;){const x=window.getComputedStyle(E),Q=x.overflowY||x.overflow;if(Q==="auto"||Q==="scroll"||Q==="hidden"||Q==="clip")return E.getBoundingClientRect();E=E.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Xr(C,E){const x=C.getBoundingClientRect(),Q=Vn(C),Qe=6,Ut=Q.bottom-x.bottom,Kn=x.top-Q.top;return Ut>=E+Qe?"down":Kn>Ut?"up":"down"}function yr(C,E){const x=ko.get(C);if(!x)return"down";const Q=Xr(x,E);return Le.value={...Le.value,[C]:Q},Q}function Aa(C){return Le.value[C]??"down"}function Zr(C){const E=sn.get(C);if(!E)return;const x=E.querySelector(".project-menu-panel"),Q=(x==null?void 0:x.getBoundingClientRect().height)??0;Ne.value={...Ne.value,[C]:Xr(E,Q)}}function Vo(C,E,x){return Math.min(Math.max(C,E),x)}function Ko(C){const E=ko.get(C);if(!E)return;const x=Fr.value,Q=x==null?void 0:x.getBoundingClientRect(),Qe=(Q==null?void 0:Q.height)||(x==null?void 0:x.offsetHeight)||112,Ut=(Q==null?void 0:Q.width)||(x==null?void 0:x.offsetWidth)||160,Kn=yr(C,Qe),yo=E.getBoundingClientRect(),tn=8,Mo=4,_a=Math.max(tn,window.innerWidth-Ut-tn),na=Vo(yo.right-Ut,tn,_a),ms=Vo(Kn==="up"?yo.top-Qe-Mo:yo.bottom+Mo,tn,Math.max(tn,window.innerHeight-Qe-tn));Ce.value={left:`${Math.round(na)}px`,top:`${Math.round(ms)}px`}}function Yo(){const C=Ae.value;C&&Ko(C)}function ki(){window.addEventListener("resize",Yo),document.addEventListener("scroll",Yo,!0)}function Ii(){window.removeEventListener("resize",Yo),document.removeEventListener("scroll",Yo,!0)}function ds(C){const E=oe.value;if(!E)return!1;const x=sn.get(E);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 Jo(C){const E=Ae.value;if(!E)return!1;const x=ko.get(E);if(!x)return!1;const Q=typeof C.composedPath=="function"?C.composedPath():[];if(Q.includes(x))return!0;const Qe=Fr.value;if(Qe&&Q.includes(Qe))return!0;const Ut=C.target;return Ut instanceof Node?!!(x.contains(Ut)||Qe&&Qe.contains(Ut)):!1}function ea(C){if(ln.value){const E=po.value,x=typeof C.composedPath=="function"?C.composedPath():[];!!E&&(x.includes(E)||C.target instanceof Node&&E.contains(C.target))||(ln.value=!1)}oe.value&&(ds(C)||en(),Ae.value&&(Jo(C)||He()))}function fs(C){oe.value&&!ds(C)&&en(),Ae.value&&!Jo(C)&&He()}function ps(){ln.value&&(ln.value=!1),oe.value&&en(),Ae.value&&He()}function Ai(){window.addEventListener("pointerdown",ea,{capture:!0}),window.addEventListener("focusin",fs,{capture:!0}),window.addEventListener("blur",ps)}function Js(){window.removeEventListener("pointerdown",ea,{capture:!0}),window.removeEventListener("focusin",fs,{capture:!0}),window.removeEventListener("blur",ps)}function hs(C){return Hr.value.get(C.projectName)??[]}function vl(C){if(In.value)return hs(C);if(jt(C.projectName))return[];const E=hs(C);return Pt(C.projectName)?E:E.slice(0,10)}function ao(C){return In.value?!1:!jt(C.projectName)&&hs(C).length>10}function vo(C){return hs(C).length>0}function Ro(C){var E;return!!C.pendingRequestState||C.inProgress||C.unread||((E=C.externalSession)==null?void 0:E.active)===!0}function Qo(C){return C.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function go(C){var E;return((E=C.externalSession)==null?void 0:E.active)===!0?"external":C.pendingRequestState==="approval"?"awaiting-approval":C.pendingRequestState==="response"?"awaiting-response":C.inProgress?"working":C.unread?"unread":"idle"}nt(()=>o.groups.map(C=>C.projectName),C=>{cn(C)}),nt(()=>{const C=oe.value;return C?o.projectGitRepoByName[C]:void 0},()=>{const C=oe.value;C&&Dt(()=>{oe.value===C&&Zr(C)})});const ta=K(()=>ln.value||oe.value!==""||Ae.value!=="");return nt(ta,C=>{if(C){Ai();return}Js()}),nt(Ae,C=>{if(!C){Ii();return}ki(),Dt(()=>{Ko(C)})}),Hs(()=>{sn.clear(),Ii(),Js(),qn()}),(C,E)=>(P(),B("section",{class:ut(["thread-tree-root",{"chats-first":V.value}])},[bn.value.length>0?(P(),B("section",vP,[Be(Rs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":q.value,onClick:Wr},{left:ft(()=>[q.value?(P(),et(Fs,{key:1,class:"thread-icon"})):(P(),et(Mu,{key:0,class:"thread-icon"}))]),default:ft(()=>[w("span",gP,F(m(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),q.value?(P(),B("ul",yP,[(P(!0),B(ct,null,on(bn.value,x=>(P(),et(ju,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:oo(x.id),"menu-open":be(x.id),"show-status-indicator":Ro(x),"thread-state":go(x),"inline-delete-confirming":xa(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m($t)(x.id),"request-label":Qo(x),"relative-time":Ho(x),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":Q=>Qr(x.id,Q),onSelect:Q=>Po(x.id),onInlineDelete:Q=>ka(x.id),onMenuToggle:Q=>Mt(x.id),onRowLeave:Q=>G(x.id,Q),onRowContextmenu:Q=>_t(Q,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",wP,[Be(Rs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":M.value,onClick:Ao},{left:ft(()=>[M.value?(P(),et(Fs,{key:1,class:"thread-icon"})):(P(),et(Mu,{key:0,class:"thread-icon"}))]),right:ft(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:po,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":ln.value,"aria-label":m(r)("Organize threads"),title:m(r)("Organize threads"),onClick:gt(Jr,["stop"])},[Be(pf,{class:"thread-icon"})],8,TP),ln.value?(P(),B("div",{key:0,class:"organize-menu-panel",onClick:E[4]||(E[4]=gt(()=>{},["stop"]))},[w("p",SP,F(m(r)("Organize")),1),w("button",{class:"organize-menu-item","data-active":to.value==="project",type:"button",onClick:E[0]||(E[0]=x=>Wo("project"))},[w("span",null,F(m(r)("By project")),1),to.value==="project"?(P(),B("span",xP,"✓")):ve("",!0)],8,CP),w("button",{class:"organize-menu-item","data-active":to.value==="chronological",type:"button",onClick:E[1]||(E[1]=x=>Wo("chronological"))},[w("span",null,F(m(r)("Chronological list")),1),to.value==="chronological"?(P(),B("span",IP,"✓")):ve("",!0)],8,kP),w("button",{class:"organize-menu-item","data-active":V.value,type:"button",onClick:fn},[w("span",null,F(m(r)("Chats first")),1),V.value?(P(),B("span",_P,"✓")):ve("",!0)],8,AP),E[40]||(E[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",PP,F(m(r)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":ie.value==="created",type:"button",onClick:E[2]||(E[2]=x=>vr("created"))},[w("span",null,F(m(r)("Created")),1),ie.value==="created"?(P(),B("span",RP,"✓")):ve("",!0)],8,EP),w("button",{class:"organize-menu-item","data-active":ie.value==="updated",type:"button",onClick:E[3]||(E[3]=x=>vr("updated"))},[w("span",null,F(m(r)("Updated")),1),ie.value==="updated"?(P(),B("span",jP,"✓")):ve("",!0)],8,MP),E[41]||(E[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:I},[w("span",null,F(m(r)("Recycle bin")),1)])])):ve("",!0)],512)]),default:ft(()=>[w("span",bP,F(m(r)("Projects")),1)]),_:1},8,["aria-expanded"]),M.value?(P(),B(ct,{key:0},[m(he)?(P(),B("p",LP,F(m(he)),1)):ve("",!0),In.value&&hr.value.length===0?(P(),B("p",NP,F(m(r)("No matching threads. Clear the search to see all threads.")),1)):e.isLoading&&e.groups.length===0?(P(),B("p",OP,F(m(r)("Loading threads...")),1)):Br.value?(P(),B("ul",$P,[(P(!0),B(ct,null,on(Ur.value,x=>(P(),et(ju,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:oo(x.id),"menu-open":be(x.id),"show-status-indicator":Ro(x),"thread-state":go(x),"inline-delete-confirming":xa(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m($t)(x.id),"request-label":Qo(x),"relative-time":Ho(x),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":Q=>Qr(x.id,Q),onSelect:Q=>Po(x.id),onInlineDelete:Q=>ka(x.id),onMenuToggle:Q=>Mt(x.id),onRowLeave:Q=>G(x.id,Q),onRowContextmenu:Q=>_t(Q,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:fr,class:"thread-tree-groups",style:or(m(xo))},[(P(!0),B(ct,null,on(hr.value,x=>(P(),B("article",{key:x.projectName,ref_for:!0,ref:Q=>m(ns)(x.projectName,Q),class:"project-group","data-project-name":x.projectName,"data-expanded":!jt(x.projectName),"data-dragging":m(os)(x.projectName),style:or(m(vt)(x.projectName))},[Be(Rs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Q=>Gn(x.projectName),onContextmenu:gt(Q=>rn(x.projectName),["prevent"]),onKeydown:[Q=>Ys(Q,x.projectName),So(gt(Q=>Gn(x.projectName),["prevent"]),["enter"]),So(gt(Q=>Gn(x.projectName),["prevent"]),["space"])]},{left:ft(()=>[w("span",FP,[w("span",BP,[jt(x.projectName)?(P(),et(op,{key:0,class:"thread-icon"})):(P(),et(XA,{key:1,class:"thread-icon"}))]),w("span",UP,[jt(x.projectName)?(P(),et(Mu,{key:0,class:"thread-icon"})):(P(),et(Fs,{key:1,class:"thread-icon"}))])])]),right:ft(()=>[w("div",GP,[w("div",{ref_for:!0,ref:Q=>Go(x.projectName,Q),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:gt(Q=>is(x.projectName),["stop"])},[Be(pf,{class:"thread-icon"})],8,VP),Yr(x.projectName)?(P(),B("div",{key:0,class:"project-menu-panel","data-open-direction":Ne.value[x.projectName]??"down",onClick:E[6]||(E[6]=gt(()=>{},["stop"]))},[Se.value==="actions"?(P(),B(ct,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:Q=>Ks(x.projectName)},F(m(r)("Browse files")),9,YP),w("button",{class:"project-menu-item",type:"button",onClick:Q=>ro(x.projectName)},F(m(r)("Export Project")),9,JP),w("button",{class:"project-menu-item",type:"button",onClick:Q=>m(ya)(x.projectName)},F(m(yt)(x.projectName)?m(r)("Manage automations…"):m(r)("Add automation…")),9,QP),e.projectGitRepoByName[x.projectName]?(P(),B("button",{key:0,class:"project-menu-item",type:"button",onClick:Q=>ls(x.projectName)},F(m(r)("New worktree")),9,XP)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:Q=>pn(x)},F(m(r)("Rename project")),9,ZP),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Q=>ml(x.projectName)},F(m(r)("Remove")),9,eE)],64)):(P(),B(ct,{key:1},[w("label",tE,F(m(r)("Project name")),1),Mn(w("input",{"onUpdate:modelValue":E[5]||(E[5]=Q=>xe.value=Q),class:"project-menu-input",type:"text",onInput:Q=>us(x.projectName)},null,40,nE),[[Un,xe.value]])],64))],8,KP)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":Tn(x.projectName),title:Tn(x.projectName),onClick:gt(Q=>Sa(x.projectName),["stop"])},[Be(fl,{class:"thread-icon"})],8,oE)])]),default:ft(()=>[w("span",{class:"project-main-button","data-dragging-handle":m(os)(x.projectName),onMousedown:gt(Q=>m(xt)(Q,x.projectName),["left"])},[w("span",{class:"project-title",title:Vs(x.projectName)},F(Ia(x)),9,HP),m(yt)(x.projectName)?(P(),B("span",{key:0,class:"thread-row-automation-chip",title:m(Lr)(x.projectName)},[Be(Ic,{class:"thread-row-automation-icon"}),m(bt)(x.projectName)>1?(P(),B("span",WP,F(m(bt)(x.projectName)),1)):ve("",!0)],8,qP)):ve("",!0)],40,zP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),vo(x)?(P(),B("ul",rE,[(P(!0),B(ct,null,on(vl(x),Q=>(P(),et(ju,{key:Q.id,thread:Q,selected:Q.id===e.selectedThreadId,pinned:oo(Q.id),"menu-open":be(Q.id),"show-status-indicator":Ro(Q),"thread-state":go(Q),"inline-delete-confirming":xa(Q.id),"automation-count":m(Te)(Q.id),"automation-tooltip":m($t)(Q.id),"request-label":Qo(Q),"relative-time":Ho(Q),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":Qe=>Qr(Q.id,Qe),onSelect:Qe=>Po(Q.id),onInlineDelete:Qe=>ka(Q.id),onMenuToggle:Qe=>Mt(Q.id),onRowLeave:Qe=>G(Q.id,Qe),onRowContextmenu:Qe=>_t(Qe,Q.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(),et(Rs,{key:1,as:"p",class:"project-empty-row"},{left:ft(()=>[...E[42]||(E[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:ft(()=>[w("span",aE,F(m(r)("No threads yet. Start a new thread to begin.")),1)]),_:1})),ao(x)?(P(),et(Rs,{key:2,class:"thread-show-more-row"},{left:ft(()=>[...E[43]||(E[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ft(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Q=>cs(x.projectName)},F(Pt(x.projectName)?"Show less":"Show more"),9,sE)]),_:2},1024)):ve("",!0)],12,DP))),128))],4))],64)):ve("",!0)]),w("section",iE,[Be(Rs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":pe.value,onClick:_o},{left:ft(()=>[pe.value?(P(),et(Fs,{key:1,class:"thread-icon"})):(P(),et(Mu,{key:0,class:"thread-icon"}))]),right:ft(()=>[w("div",uE,[w("button",{class:"chats-section-action",type:"button","aria-label":m(r)("New chat"),title:m(r)("New chat"),onClick:E[7]||(E[7]=gt(x=>C.$emit("start-new-chat"),["stop"]))},[Be(fl,{class:"thread-icon"})],8,cE)])]),default:ft(()=>[w("span",lE,F(m(r)("Chats")),1)]),_:1},8,["aria-expanded"]),pe.value&&wn.value.length===0?(P(),B("p",dE,F(m(r)("No chats")),1)):pe.value?(P(),B("ul",fE,[(P(!0),B(ct,null,on(Yt.value,x=>(P(),et(ju,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:oo(x.id),"menu-open":be(x.id),"show-status-indicator":Ro(x),"thread-state":go(x),"inline-delete-confirming":xa(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m($t)(x.id),"request-label":Qo(x),"relative-time":Ho(x),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":Q=>Qr(x.id,Q),onSelect:Q=>Po(x.id),onInlineDelete:Q=>ka(x.id),onMenuToggle:Q=>Mt(x.id),onRowLeave:Q=>G(x.id,Q),onRowContextmenu:Q=>_t(Q,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&&mo.value?(P(),et(Rs,{key:2,class:"thread-show-more-row"},{left:ft(()=>[...E[44]||(E[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ft(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Eo},F(ue.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(P(),et(sl,{to:"body"},[At.value?(P(),B("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Fr,class:"thread-menu-panel thread-menu-panel-fixed",style:or(Ce.value),"data-open-direction":Aa(At.value.id),onClick:E[17]||(E[17]=gt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:E[8]||(E[8]=x=>m(qs)(At.value.id))},F(m(ze)(At.value.id)?m(r)("Manage automations…"):m(r)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[9]||(E[9]=x=>Wn(At.value.id))},F(m(r)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[10]||(E[10]=x=>k(At.value.id))},F(m(r)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[11]||(E[11]=x=>j(At.value.id))},F(m(r)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:At.value.id!==e.selectedThreadId,title:At.value.id===e.selectedThreadId?m(r)("Copy chat"):m(r)("Open this chat before copying"),onClick:E[12]||(E[12]=x=>ht(At.value.id))},F(m(r)("Copy chat")),9,hE),w("button",{class:"thread-menu-item",type:"button",onClick:E[13]||(E[13]=x=>An(At.value.id))},F(m(r)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[14]||(E[14]=x=>Kr(At.value.id))},F(oo(At.value.id)?m(r)("Unpin thread"):m(r)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[15]||(E[15]=x=>Zt(At.value.id,At.value.title))},F(m(r)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:E[16]||(E[16]=x=>Ca(At.value.id,At.value.title))},F(m(r)("Delete thread")),1)],12,pE)):ve("",!0)])),Be(jd,{open:Re.value,title:m(r)("Rename thread"),subtitle:m(r)("Make it short and recognizable."),onClose:Gt},{footer:ft(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Gt},F(m(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:qo},F(m(r)("Save")),1)]),default:ft(()=>[Mn(w("input",{ref_key:"renameThreadInputRef",ref:at,"onUpdate:modelValue":E[18]||(E[18]=x=>Xe.value=x),class:"rename-thread-input",type:"text",placeholder:m(r)("Add title..."),onKeydown:So(gt(qo,["prevent"]),["enter"])},null,40,mE),[[Un,Xe.value]])]),_:1},8,["open","title","subtitle"]),Be(jd,{open:ce.value,title:zo.value?m(r)("Archive chat and remove automations?"):m(r)("Delete thread?"),subtitle:Ta.value,onClose:rs},{footer:ft(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:rs},F(m(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:dn},F(zo.value?m(r)("Archive and remove"):m(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Be(jd,{open:f.value,title:m(r)("Recycle bin"),subtitle:m(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:E[19]||(E[19]=x=>f.value=!1)},{default:ft(()=>[w("div",vE,[m(i).length===0?(P(),B("div",gE,F(m(r)("Recycle bin is empty.")),1)):(P(),B("ul",yE,[(P(!0),B(ct,null,on(m(i),x=>(P(),B("li",{key:x.id,class:"recycle-bin-item"},[w("div",wE,[w("span",bE,F(x.title),1),x.projectName?(P(),B("span",TE,F(x.projectName),1)):ve("",!0),w("span",SE,F(Vr(x.archivedAtIso)),1)]),w("div",CE,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:S.value===x.id,onClick:Q=>U(x.id)},F(S.value===x.id?m(r)("Restoring…"):m(r)("Restore")),9,xE),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:Q=>m(d)(x.id)},F(m(r)("Delete permanently")),9,kE)])]))),128))])),y.value?(P(),B("p",IE,F(y.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(P(),et(sl,{to:"body"},[m(_)?(P(),B("div",{key:0,class:"rename-thread-overlay",onClick:E[39]||(E[39]=gt((...x)=>m(Or)&&m(Or)(...x),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":m(R)==="project"?m(r)("Project automation"):m(r)("Thread automation")},[w("h3",_E,F(m(le)==="edit"?m(r)("Edit automation"):m(r)("Add automation")),1),w("p",PE,F(m(tt)),1),m(ne)&&m(le)==="create"?(P(),B("div",EE,[E[45]||(E[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",RE,[w("button",{class:ut(["automation-target-mode",{"is-active":m(ae)==="thread"}]),type:"button",onClick:E[20]||(E[20]=x=>m(es)("thread"))}," Existing chat ",2),w("button",{class:ut(["automation-target-mode",{"is-active":m(ae)==="project"}]),type:"button",onClick:E[21]||(E[21]=x=>m(es)("project"))}," Project ",2)]),w("div",ME,[Be(yi,{modelValue:m(_e),"onUpdate:modelValue":E[22]||(E[22]=x=>jn(_e)?_e.value=x:null),class:"automation-thread-dropdown",options:m(st),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(dt).length>0?(P(),B("div",{key:1,class:"automation-thread-list","aria-label":m(R)==="project"?"Project automations":"Thread automations"},[(P(!0),B(ct,null,on(m(dt),x=>(P(),B("button",{key:x.id,class:ut(["automation-thread-list-item",{"is-active":x.id===m(H)}]),type:"button",onClick:Q=>m(Nr)(x.id)},[w("span",null,F(x.name),1),w("small",null,F(x.status==="PAUSED"?"Paused":"Active"),1)],10,LE))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:E[23]||(E[23]=(...x)=>m(Do)&&m(Do)(...x))},F(m(r)("Add another automation")),1)],8,jE)):ve("",!0),w("label",NE,[w("span",OE,F(m(r)("Name")),1),Mn(w("input",{"onUpdate:modelValue":E[24]||(E[24]=x=>m(We).name=x),class:"rename-thread-input",type:"text",placeholder:m(r)("Automation name")},null,8,$E),[[Un,m(We).name]])]),w("label",DE,[w("span",FE,F(m(r)("Prompt")),1),Mn(w("textarea",{"onUpdate:modelValue":E[25]||(E[25]=x=>m(We).prompt=x),class:"automation-thread-textarea",rows:"6",placeholder:m(r)("Describe what the automation should do")},null,8,BE),[[Un,m(We).prompt]])]),w("div",UE,[w("span",zE,F(m(r)("Schedule")),1),w("div",HE,[w("button",{class:ut(["automation-schedule-mode",{"is-active":m(Ge).mode==="daily"}]),type:"button",onClick:E[26]||(E[26]=x=>m(cr)("daily"))},F(m(r)("Daily")),3),w("button",{class:ut(["automation-schedule-mode",{"is-active":m(Ge).mode==="interval"}]),type:"button",onClick:E[27]||(E[27]=x=>m(cr)("interval"))},F(m(r)("Interval")),3),w("button",{class:ut(["automation-schedule-mode",{"is-active":m(Ge).mode==="advanced"}]),type:"button",onClick:E[28]||(E[28]=x=>m(cr)("advanced"))}," RRULE ",2)]),m(Ge).mode==="daily"?(P(),B("div",qE,[w("span",WE,F(m(r)("Run every day at")),1),Mn(w("input",{"onUpdate:modelValue":E[29]||(E[29]=x=>m(Ge).dailyTime=x),class:"automation-schedule-time",type:"time",onInput:E[30]||(E[30]=(...x)=>m(Qt)&&m(Qt)(...x))},null,544),[[Un,m(Ge).dailyTime]])])):m(Ge).mode==="interval"?(P(),B("div",GE,[w("span",VE,F(m(r)("Run every")),1),Mn(w("input",{"onUpdate:modelValue":E[31]||(E[31]=x=>m(Ge).interval=x),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:E[32]||(E[32]=(...x)=>m(Qt)&&m(Qt)(...x))},null,544),[[Un,m(Ge).interval,void 0,{number:!0}]]),Be(yi,{class:"automation-schedule-unit-dropdown","model-value":m(Ge).intervalUnit,options:m(Y),placeholder:m(r)("Unit"),"onUpdate:modelValue":m(ur)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ve("",!0),m(Ge).mode==="advanced"?Mn((P(),B("input",{key:2,"onUpdate:modelValue":E[33]||(E[33]=x=>m(We).rrule=x),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:E[34]||(E[34]=(...x)=>m(ga)&&m(ga)(...x))},null,544)),[[Un,m(We).rrule]]):ve("",!0),w("p",KE,F(m(wt)),1)]),w("div",YE,[w("span",JE,F(m(r)("Status")),1),Be(yi,{class:"automation-thread-dropdown","model-value":m(We).status,options:m(de),placeholder:m(r)("Status"),"onUpdate:modelValue":m(eo)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),m(Oe)?(P(),B("p",QE,F(m(Oe)),1)):m(Ie)?(P(),B("p",XE,F(m(Ie)),1)):ve("",!0),w("div",ZE,[m(le)==="edit"&&m(R)==="thread"?(P(),B("button",{key:0,class:"rename-thread-button",type:"button",disabled:m(Ke)||m($e),onClick:E[35]||(E[35]=(...x)=>m(Dr)&&m(Dr)(...x))},F(m($e)?m(r)("Running…"):m(r)("Run now")),9,eR)):ve("",!0),m(le)==="edit"?(P(),B("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:m(Ke)||m($e),onClick:E[36]||(E[36]=(...x)=>m(wa)&&m(wa)(...x))},F(m(r)("Remove")),9,tR)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:m(Ke)||m($e),onClick:E[37]||(E[37]=(...x)=>m(Or)&&m(Or)(...x))},F(m(r)("Cancel")),9,nR),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:m(Ke)||m($e),onClick:E[38]||(E[38]=(...x)=>m(ts)&&m(ts)(...x))},F(m(Ke)?m(r)("Saving…"):m(r)("Save")),9,oR)])],8,AE)])):ve("",!0)]))],2))}}),aR=Ct(rR,[["__scopeId","data-v-0b490210"]]),sR={class:"content-header"},iR=["title"],lR={class:"content-actions"},uR=vn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(P(),B("header",sR,[w("div",{class:ut(["content-leading",{"is-accent":e.accent}])},[Co(t.$slots,"leading",{},void 0)],2),w("h1",{class:ut(["content-title",{"is-accent":e.accent}]),title:e.title},F(e.title),11,iR),w("div",lR,[Co(t.$slots,"actions",{},void 0)])]))}}),cR=Ct(uR,[["__scopeId","data-v-413c4c2d"]]),zm=.0025,Ld=3,Hm=2,dR=256;function fR(e){var ge;const t=T("idle"),n=T(typeof navigator<"u"&&!!((ge=navigator.mediaDevices)!=null&&ge.getUserMedia)),o=T(0),r=T(null);let a=null,s=null,i=[],l=null,c=null,d=null,v=null,f=[],y=!1,S=!1,I=null;function U(){I&&(I.abort(),I=null),t.value==="transcribing"&&(t.value="idle")}function O(){const Z=r.value;if(!Z||typeof window>"u")return;const me=Z.getContext("2d");if(!me)return;const oe=Math.max(1,Math.floor(Z.clientWidth)),Ae=Math.max(1,Math.floor(Z.clientHeight||36)),De=window.devicePixelRatio||1,Ne=Math.max(1,Math.floor(oe*De)),Le=Math.max(1,Math.floor(Ae*De));(Z.width!==Ne||Z.height!==Le)&&(Z.width=Ne,Z.height=Le),me.setTransform(De,0,0,De,0,0),me.clearRect(0,0,oe,Ae);const Ce=Math.max(12,Math.floor(oe/(Ld+Hm))),Se=f.slice(-Ce),xe=Math.max(0,Ce-Se.length),Re=Ae/2,Je=getComputedStyle(Z).color||"#000000";for(let Xe=0;Xe<Ce;Xe+=1){const at=Se[Xe-xe]??0,N=Math.max(.08,Math.min(1,at*18))*Re,re=Xe*(Ld+Hm);me.globalAlpha=at<=zm?.35:1,me.fillStyle=Je,me.fillRect(re,Re-N,Ld,N*2)}me.globalAlpha=1}function $(){f=[],o.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 M(Z){if(typeof window>"u")return;const me=window.webkitAudioContext,oe=window.AudioContext??me;oe&&(q(),$(),l=new oe,c=l.createMediaStreamSource(Z),d=l.createScriptProcessor(2048,1,1),v=performance.now(),d.onaudioprocess=Ae=>{const De=Ae.inputBuffer.getChannelData(0);let Ne=0;for(let Le=0;Le<De.length;Le+=1){const Ce=Math.abs(De[Le]??0);Ne+=Ce<zm?0:Ce}f.push(Ne/De.length),f.length>dR&&f.shift(),v!==null&&(o.value=Math.max(0,performance.now()-v)),O()},c.connect(d),d.connect(l.destination),O())}async function pe(){var Z;if(t.value==="transcribing"&&U(),!(t.value!=="idle"||!n.value||y)){y=!0,S=!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 Ae;const me=i,oe=(a==null?void 0:a.mimeType)||((Ae=me[0])==null?void 0:Ae.type)||"audio/webm";ye(),ie(me,oe)},M(s),a.start(250),t.value="recording",S&&ue()}catch(me){ye(),t.value="idle",(Z=e.onError)==null||Z.call(e,me)}finally{y=!1}}}function ue(){if(y&&t.value==="idle"){S=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function V(){S=!1,U(),ye(),t.value="idle"}async function ie(Z,me){var De,Ne,Le,Ce,Se;if(Z.length===0){(De=e.onEmpty)==null||De.call(e),t.value="idle";return}const oe=new Blob(Z,{type:me});t.value="transcribing";let Ae=null;try{const xe=me.split(/[/;]/)[1]??"webm",Re=new FormData;Re.append("file",oe,`codex.${xe}`);const Je=((Ne=e.getLanguage)==null?void 0:Ne.call(e).trim())??"";Je&&Je.toLowerCase()!=="auto"&&Re.append("language",Je),Ae=new AbortController,I=Ae;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:Re,signal:Ae.signal}),at=await Xe.text();let ce=null;try{ce=at.trim()?JSON.parse(at):null}catch{ce=null}if(!Xe.ok){const re=(Le=ce==null?void 0:ce.error)==null?void 0:Le.trim(),se=at.trim();throw new Error(re||se||`Transcription failed: ${Xe.status}`)}const N=((ce==null?void 0:ce.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{Ae&&I===Ae&&(I=null),t.value==="transcribing"&&(t.value="idle")}}function ye(){q(),$(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(Z=>Z.stop()),s=null),i=[]}Hs(()=>{V()});function Pe(){if(t.value==="recording"){ue();return}(t.value==="idle"||t.value==="transcribing")&&pe()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:pe,stopRecording:ue,toggleRecording:Pe,cancel:V}}const pR={},hR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mR(e,t){return P(),B("svg",hR,[...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 vR=Ct(pR,[["render",mR]]),gR={},yR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function wR(e,t){return P(),B("svg",yR,[...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 bR=Ct(gR,[["render",wR]]),TR={},SR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function CR(e,t){return P(),B("svg",SR,[...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 xR=Ct(TR,[["render",CR]]),kR={},IR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function AR(e,t){return P(),B("svg",IR,[...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 _R=Ct(kR,[["render",AR]]),PR=["aria-label"],ER=8,ui=8,RR=vn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,a=T(null),s=T(null),i=T({});let l=!1;const c=K(()=>o.open),d=K(()=>o.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,M=window.innerHeight,pe=Math.max(0,q-ui*2),ue=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,pe),V=((ge=s.value)==null?void 0:ge.offsetHeight)??0;let ie;o.align==="end"?ie=$.right-ue:o.align==="center"?ie=$.left+($.width-ue)/2:ie=$.left,ie=v(ie,ui,Math.max(ui,q-ue-ui));let ye=$.top-V-ER;ye=v(ye,ui,Math.max(ui,M-V-ui)),i.value={position:"fixed",left:`${ie}px`,right:"auto",top:`${ye}px`,bottom:"auto",width:`${ue}px`}}function y(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function S(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}nt(c,O=>{if(!O){S(),i.value={};return}y(),Dt(()=>{var $;($=s.value)==null||$.focus(),f(),window.requestAnimationFrame(f)})}),Hs(()=>{S()});function I(){r("update:open",!o.open)}function U(O){var V,ie,ye;if(O.key==="Escape"){r("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(),(V=q[0])==null||V.focus();return}if(O.key==="End"){O.preventDefault(),(ie=q[q.length-1])==null||ie.focus();return}if(O.key!=="ArrowDown"&&O.key!=="ArrowUp")return;O.preventDefault();let M=q.findIndex(Pe=>Pe===document.activeElement);M<0&&(M=O.key==="ArrowDown"?-1:0);const pe=O.key==="ArrowDown"?1:-1,ue=(M+pe+q.length)%q.length;(ye=q[ue])==null||ye.focus()}return t({root:a}),(O,$)=>(P(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[Co(O.$slots,"trigger",{toggle:I,isOpen:c.value},void 0),Be(iu,{name:"composer-popover"},{default:ft(()=>[c.value?(P(),B("div",{key:0,ref_key:"panelRef",ref:s,class:ut(["composer-popover-panel",[d.value,e.panelClass]]),style:or(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:U},[Co(O.$slots,"default",{},void 0,!0)],46,PR)):ve("",!0)]),_:3})],512))}}),sc=Ct(RR,[["__scopeId","data-v-1fb1570a"]]),MR=["aria-label"],jR={class:"composer-popover-group-label"},LR=["aria-selected","onMousedown"],NR={class:"thread-composer-slash-body"},OR={class:"thread-composer-slash-name"},$R={class:"thread-composer-slash-desc"},DR={class:"thread-composer-slash-kind"},FR={class:"composer-popover-group-label composer-popover-group-label--skills"},BR=["aria-selected","onMousedown"],UR=["aria-label","title"],zR={class:"thread-composer-slash-body thread-composer-slash-body--skill"},HR={class:"thread-composer-slash-skill-name"},qR={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},WR=vn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=va(),a=T(null),s=K(()=>n.commands.filter(v=>v.group!=="skill")),i=K(()=>n.commands.filter(v=>v.group==="skill"));nt(()=>n.highlightedIndex,async()=>{var v,f;await Dt(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return r(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 r(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(r)("Commands")},[s.value.length>0?(P(),B(ct,{key:0},[w("div",jR,F(m(r)("Commands")),1),(P(!0),B(ct,null,on(s.value,(y,S)=>(P(),B("button",{key:y.id,class:ut(["thread-composer-slash-row",{"is-active":S===e.highlightedIndex}]),type:"button",role:"option","aria-selected":S===e.highlightedIndex,onMousedown:gt(I=>o("select",y),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",NR,[w("span",OR,F(y.id),1),w("span",$R,F(m(r)(y.description)),1)]),w("span",DR,F(l(y.kind)),1)],42,LR))),128))],64)):ve("",!0),i.value.length>0?(P(),B(ct,{key:1},[w("div",FR,F(m(r)("Skills")),1),(P(!0),B(ct,null,on(i.value,(y,S)=>(P(),B("button",{key:y.skillPath||y.id,class:ut(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+S===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+S===e.highlightedIndex,onMousedown:gt(I=>o("select",y),["prevent"])},[w("span",{class:ut(["thread-composer-slash-skill-icon",`is-${y.scope||"user"}`]),"aria-label":d(y.scope),title:d(y.scope)},F(c(y.scope)),11,UR),w("span",zR,[w("span",HR,F(y.displayName||y.id),1),w("span",qR,F(y.description),1)])],42,BR))),128))],64)):ve("",!0)],8,MR))}}),GR=Ct(WR,[["__scopeId","data-v-bc518c3f"]]),VR=["data-streaming"],KR=["aria-expanded"],YR={class:"thread-composer-plan-panel-title"},JR={key:0,class:"thread-composer-plan-panel-badge"},QR={class:"thread-composer-plan-panel-progress"},XR=["title"],ZR=["data-status"],eM={class:"thread-composer-plan-panel-latest-text"},tM={class:"thread-composer-plan-panel-popover-content"},nM={class:"thread-composer-plan-panel-popover-scroll"},oM={class:"thread-composer-plan-panel-popover-head"},rM={class:"thread-composer-plan-panel-title"},aM={class:"thread-composer-plan-panel-progress"},sM={key:0,class:"thread-composer-plan-panel-popover-section"},iM={class:"thread-composer-plan-panel-section-label"},lM=["title"],uM={class:"thread-composer-plan-panel-popover-section"},cM={class:"thread-composer-plan-panel-section-label"},dM={class:"thread-composer-plan-panel-steps"},fM=["data-status"],pM=["data-status"],hM=["title"],mM={class:"thread-composer-plan-panel-popover-footer"},vM=["disabled","data-state"],gM=vn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=va(),a=T(!1),s=K(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(y=>y.status==="completed").length}),i=K(()=>{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 S=v[y];if(S.status==="inProgress")return S}return v[v.length-1]}),l=K(()=>{var S,I,U;const v=((I=(S=n.planPanel)==null?void 0:S.explanation)==null?void 0:I.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,o("implement-plan")}return(v,f)=>(P(),B("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Be(sc,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":m(r)("Plan"),"onUpdate:open":f[1]||(f[1]=y=>a.value=y)},{trigger:ft(()=>{var y,S;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=I=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",YR,F(m(r)("Plan")),1),e.planPanel.streaming?(P(),B("span",JR,F(m(r)("Updating")),1)):ve("",!0),w("span",QR,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,ZR)):ve("",!0),w("span",eM,F(((S=i.value)==null?void 0:S.step)??""),1)],8,XR),Be(Fs,{class:"thread-composer-plan-panel-chevron"})],8,KR)]}),default:ft(()=>[w("div",tM,[w("div",nM,[w("header",oM,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",rM,F(m(r)("Plan")),1),w("span",aM,F(s.value)+"/"+F(e.planPanel.steps.length),1)]),e.planPanel.explanation?(P(),B("section",sM,[w("p",iM,F(m(r)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},F(l.value),9,lM)])):ve("",!0),w("section",uM,[w("p",cM,F(m(r)("Steps"))+" ("+F(e.planPanel.steps.length)+")",1),w("ol",dM,[(P(!0),B(ct,null,on(e.planPanel.steps,(y,S)=>(P(),B("li",{key:`composer-plan-${e.planPanel.id}-${S}`,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,pM),w("span",{class:"thread-composer-plan-panel-step-text",title:y.step},F(y.step),9,hM)],8,fM))),128))])])]),w("footer",mM,[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(r)("Plan executed"):e.planPanel.streaming?m(r)("Implementing…"):m(r)("Implement plan")),9,vM)])])]),_:1},8,["open","aria-label"])],8,VR))}}),yM=Ct(gM,[["__scopeId","data-v-970a9351"]]),wM={key:0,class:"thread-composer-attachments"},bM=["src"],TM=["src","alt"],SM=["aria-label","disabled","onClick"],CM={key:1,class:"thread-composer-folder-chips"},xM=["title"],kM={class:"thread-composer-folder-chip-meta"},IM=["aria-label","disabled","onClick"],AM={key:2,class:"thread-composer-file-chips"},_M=["title"],PM=["aria-label","disabled","onClick"],EM={key:3,class:"thread-composer-skill-chips"},RM=["title","aria-label","onClick"],MM=["aria-label","onClick"],jM=vn({__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,o=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function r(l){const c=l.trim();return c?!!(/^video\/|^data:video\//i.test(c)||o.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(ct,null,[e.selectedImages.length>0?(P(),B("div",wM,[(P(!0),B(ct,null,on(e.selectedImages,d=>(P(),B("div",{key:d.id,class:"thread-composer-attachment"},[r(d.url)?(P(),B("video",{key:0,class:"thread-composer-attachment-image",src:d.url,controls:"",preload:"metadata"},null,8,bM)):(P(),B("img",{key:1,class:"thread-composer-attachment-image",src:d.url,alt:d.name||"Selected image"},null,8,TM)),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,SM)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(P(),B("div",CM,[(P(!0),B(ct,null,on(e.folderUploadGroups,d=>(P(),B("span",{key:d.id,class:"thread-composer-folder-chip"},[Be(op,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:d.name},F(d.name),9,xM),w("span",kM,[d.isUploading?(P(),B(ct,{key:0},[Os(F(a(d))+"% uploading ("+F(d.processed)+"/"+F(d.total)+") ",1)],64)):(P(),B(ct,{key:1},[Os(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,IM)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(P(),B("div",AM,[(P(!0),B(ct,null,on(e.standaloneFileAttachments,d=>(P(),B("span",{key:d.fsPath,class:"thread-composer-file-chip"},[Be(fl,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:d.fsPath},F(d.label),9,_M),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,PM)]))),128))])):ve("",!0),e.selectedSkills.length>0?(P(),B("div",EM,[(P(!0),B(ct,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,RM),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,MM)]))),128))])):ve("",!0)],64))}}),LM=Ct(jM,[["__scopeId","data-v-7ba5474c"]]),NM=vn({__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,o=t,{t:r}=va(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=K(()=>{var U;const S=(U=n.modelReasoningEfforts)==null?void 0:U[n.selectedModel];if(S===void 0)return a;const I=new Set(S);return a.filter(O=>I.has(O.value))});function i(S){return S.trim().replace(/^gpt/i,"GPT")}const l=K(()=>n.models.map(S=>({value:S,label:i(S)}))),c=K(()=>n.disabled||!n.activeThreadId),d=K(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=K(()=>n.selectedSpeedMode==="fast"&&d.value);function f(S){o("update:selected-model",S)}function y(S){o("update:selected-reasoning-effort",S)}return(S,I)=>(P(),B(ct,null,[Be(yi,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?Ic:null,placeholder:m(r)("Model"),"open-direction":"up",variant:"pill",disabled:c.value||e.models.length===0,"enable-search":"","search-placeholder":m(r)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Be(yi,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:m(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:c.value||s.value.length===0,"onUpdate:modelValue":y},null,8,["model-value","options","placeholder","disabled"])],64))}}),OM=Ct(NM,[["__scopeId","data-v-245f3391"]]),$M=["aria-label","disabled"],DM=["disabled"],FM=["disabled"],BM=["disabled"],UM={class:"thread-composer-attach-mode"},zM={class:"thread-composer-attach-mode-label"},HM={class:"thread-composer-attach-mode-buttons"},qM=["disabled"],WM=["disabled"],GM={class:"thread-composer-attach-mode"},VM={class:"thread-composer-attach-mode-label"},KM={class:"thread-composer-attach-mode-buttons"},YM=["disabled","onClick"],JM={class:"thread-composer-attach-mode"},QM={class:"thread-composer-attach-mode-label"},XM={class:"thread-composer-attach-mode-buttons"},ZM=["disabled","onClick"],e1={key:0,class:"thread-composer-menu-error",role:"alert"},t1={key:0,class:"thread-composer-approval-tip",role:"status"},n1=vn({__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:o}=va();function r(){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(),et(sc,{open:e.open,align:"start",width:"lg","aria-label":m(o)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=y=>n("update:open",y))},{trigger:ft(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":m(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,$M)]),default:ft(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},F(m(o)("Add photos & files")),9,DM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},F(m(o)("Add folder")),9,FM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},F(m(o)("Take photo")),9,BM),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",UM,[w("span",zM,F(m(o)("In-progress send")),1),w("div",HM,[w("button",{class:ut(["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(o)("Steer")),11,qM),w("button",{class:ut(["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(o)("Queue")),11,WM)])]),e.isMobile?(P(),B(ct,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",GM,[w("span",VM,F(m(o)("Plan mode")),1),w("div",KM,[(P(!0),B(ct,null,on(e.collaborationModeChoices,y=>(P(),B("button",{key:`mobile-plan-${y.value}`,class:ut(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===y.value}]),type:"button",disabled:y.disabled||e.isComposerConfigDisabled,onClick:S=>c(y.value)},F(m(o)(y.labelKey)),11,YM))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",JM,[w("span",QM,F(m(o)("Approval policy")),1),w("div",XM,[(P(!0),B(ct,null,on(e.approvalPolicyChoices,y=>(P(),B("button",{key:`mobile-approval-${y.value}`,class:ut(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===y.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:S=>d(y.value)},F(m(o)(y.label)),11,ZM))),128))])]),e.approvalPolicyError?(P(),B("p",e1,F(e.approvalPolicyError),1)):ve("",!0),Be(iu,{name:"approval-tip"},{default:ft(()=>[e.approvalPolicyNotice?(P(),B("span",t1,F(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),o1=Ct(n1,[["__scopeId","data-v-4d71ea67"]]),r1=/(^|\s)(\/[a-zA-Z]*)$/,qm=[{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 a1(e){var o,r,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:((o=s.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((r=s.displayName)==null?void 0:r.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 s1(e){const t=e.match(r1);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function i1(e,t){const n=t.trim().toLowerCase();if(!n)return e;const o=e.filter(r=>r.id===n);return o.length>0?o:e.filter(r=>r.id.startsWith(n))}const l1={class:"thread-composer-main"},u1={class:"thread-composer-input-row"},c1={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},d1={class:"thread-composer-drop-overlay-copy"},f1={key:1,class:"composer-popover"},p1=["onMousedown"],h1={key:1,class:"thread-composer-file-mention-icon-markdown"},m1={class:"thread-composer-file-mention-text"},v1={class:"thread-composer-file-mention-name"},g1={key:0,class:"thread-composer-file-mention-dir"},y1={key:1,class:"thread-composer-file-mention-empty"},w1={key:2,class:"thread-composer-file-mention-empty"},b1=["placeholder","disabled"],T1=["aria-label","title","disabled"],S1={class:"thread-composer-actions"},C1=["aria-label","title","disabled"],x1={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},k1=["aria-label","title","disabled"],I1={key:0,class:"thread-composer-secondary"},A1=["aria-label","disabled"],_1={class:"thread-composer-plan-trigger-label"},P1=["aria-checked","disabled","onClick"],E1={class:"thread-composer-menu-item-copy"},R1={class:"thread-composer-menu-item-title"},M1={key:0,class:"thread-composer-menu-item-sub"},j1={key:1,class:"thread-composer-menu-item-hint"},L1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},N1=["aria-label","disabled"],O1={class:"thread-composer-approval-trigger-label"},$1=["aria-checked","disabled","onClick"],D1={class:"thread-composer-menu-item-copy"},F1={class:"thread-composer-menu-item-title"},B1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},U1={key:0,class:"thread-composer-menu-error",role:"alert"},z1={key:0,class:"thread-composer-approval-tip",role:"status"},H1=["title","aria-label"],q1={class:"thread-composer-context-usage-value"},W1={key:0,class:"thread-composer-context-usage-compact"},G1=["disabled"],V1=["disabled"],K1=["disabled"],Nd=12e3,Y1=2e3,J1="codex-web-local.thread-draft.v1.",Q1=vn({__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 o=e,r=n,{t:a}=va(),s=T(""),i=T([]),l=T([]),c=T([]),d=T([]),v=T(""),f=T(0),y=T(null),S=T(!1),{state:I,cancel:U}=fR({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:k=>{if(s.value=s.value?`${s.value}
|
|
58
|
-
${k}`:k,v.value="",o.dictationAutoSend!==!1){const j=o.isTurnInProgress?$e.value:"steer";Qt(j);return}Dt(()=>{var j;return(j=M.value)==null?void 0:j.focus()})},onEmpty:()=>{v.value=o.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=T(null),$=T(null),q=T(null),M=T(null),{isMobile:pe}=Yf(),ue=T(!1),V=T(!1),ie=T(!1),ye=T(null),Pe=T(""),ge=T([]),Z=T(!1),me=T(0),oe=T(!1),Ae=T(null),De=T(""),Ne=T(0),Le=T(qm),Ce=K(()=>[...qm,...a1(o.skills??[])]),Se=T(!1),xe=T(!1);let Re=!1;const Je=T(0);let Xe=0,at=null,ce="",N=!1,re=0,se=0;const je=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let qe="";const _=K(()=>{const k=new Set((o.collaborationModes??[]).map(j=>j.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")}]}),R=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],H=K(()=>{const k=_.value.find(j=>j.value===o.selectedCollaborationMode);return a(k?k.labelKey:"Plan mode")}),le=K(()=>{const k=R.find(j=>j.value===o.approvalPolicy);return a(k?k.label:"Approval policy")}),ne=K(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),ae=K(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||ne.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||c.value.length>0),_e=K(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||c.value.length>0||d.value.length>0),Oe=K(()=>{const k=new Set;for(const j of d.value)for(const G of j.filePaths)k.add(G);return c.value.filter(j=>!k.has(j.fsPath))}),Ie=K(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),he=K(()=>o.disabled||!o.activeThreadId),Ke=K(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),$e=T(Ke.value),We=K(()=>I.value==="recording"),Ge=K(()=>o.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")),dt=K(()=>s.value.trim().length>0||i.value.length>0||c.value.length>0),wt=K(()=>s.value.split(`
|
|
59
|
-
`).length),tt=K(()=>Se.value||wt.value>=6||xe.value),st=K(()=>Lr(o.threadTokenUsage??null)),Y=K(()=>{var k;return((k=st.value)==null?void 0:k.summaryText)??""}),de=K(()=>{var k;return((k=st.value)==null?void 0:k.tooltipText)??""}),Te=K(()=>{var k;return((k=st.value)==null?void 0:k.tone)??"healthy"});function ze(){Te.value!=="healthy"&&r("compact-context")}function bt(k){if(!Number.isFinite(k))return"0";const j=Math.abs(k);return j>=1e6?`${(j>=1e7?(k/1e6).toFixed(0):(k/1e6).toFixed(1)).replace(/\.0$/,"")}M`:j>=1e3?`${(j>=1e5?(k/1e3).toFixed(0):(k/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(k))}function yt(k){const j=Math.max(0,k.inputTokens-k.cachedInputTokens),G=[`${bt(k.totalTokens)} ${a("total")}`,`${bt(j)} ${a("input")}`];return k.cachedInputTokens>0&&G.push(`${bt(k.cachedInputTokens)} ${a("cached")}`),k.outputTokens>0&&G.push(`${bt(k.outputTokens)} ${a("output")}`),k.reasoningOutputTokens>0&&G.push(`${bt(k.reasoningOutputTokens)} ${a("reasoning")}`),G.join(" · ")}function $t(k,j){if(!Number.isFinite(k)||!Number.isFinite(j)||j<=0)return 0;if(j<=Nd){const Mt=Math.max(0,j-Math.max(0,k));return Math.max(0,Math.min(100,Math.round(Mt/j*100)))}const G=j-Nd,be=Math.max(0,k-Nd),He=Math.max(0,G-be);return Math.max(0,Math.min(100,Math.round(He/G*100)))}function Lr(k){if(!k)return null;const j=k.modelContextWindow??null;if(typeof j!="number"||!Number.isFinite(j)||j<=0)return null;const G=Math.max(0,k.last.totalTokens),be=$t(G,j),He=Math.max(0,Math.min(100,100-be)),Mt=be<=15?"danger":be<=35?"warning":"healthy";return{summaryText:`${be}% · ${bt(G)} / ${bt(j)}`,tooltipText:[`${a("Context window")}: ${be}% ${a("left")} (${He}% ${a("used")})`,`${a("In context")}: ${G.toLocaleString()} / ${j.toLocaleString()} tokens`,`${a("Last turn")}: ${yt(k.last)}`,`${a("Session total")}: ${yt(k.total)}`].join(`
|
|
60
|
-
`),percentRemaining:be,tone:Mt}}function Qt(k="steer"){var G;const j=s.value.trim();if(ae.value){if(r("submit",{text:j,imageUrls:i.value.map(be=>be.url),fileAttachments:[...c.value],skills:l.value.map(be=>({name:be.name,path:be.path})),mode:k}),Za(o.activeThreadId),ga(),Se.value=!1,d.value=[],ue.value=!1,bn(),je||pe.value){(G=M.value)==null||G.blur();return}Dt(()=>{var be;return(be=M.value)==null?void 0:be.focus()})}}function ur(k){$e.value=k}function eo(k){Je.value+=1,s.value=k.text,i.value=k.imageUrls.map((j,G)=>({id:`queued-${Date.now()}-${G}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${G+1}`,url:j})),l.value=k.skills.map(j=>(o.skills??[]).find(G=>G.path===j.path)??{name:j.name,displayName:void 0,description:"",path:j.path}),c.value=k.fileAttachments.map(j=>({...j})),d.value=[],v.value="",y.value=null,f.value=0,ue.value=!1,bn(),Ao(),se+=1}function ga(){eo({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Se.value=!1}function cr(k){return`${J1}${k}`}function qs(k){if(typeof window>"u")return null;const j=k.trim();if(!j)return null;try{const G=window.localStorage.getItem(cr(j));if(!G)return null;const be=JSON.parse(G);return typeof be=="string"?{text:be,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof be.text=="string"?be.text:"",imageUrls:Array.isArray(be.imageUrls)?be.imageUrls.filter(He=>typeof He=="string"):[],fileAttachments:Array.isArray(be.fileAttachments)?be.fileAttachments.filter(He=>!!He&&typeof He.label=="string"&&typeof He.path=="string"&&typeof He.fsPath=="string"):[],skills:Array.isArray(be.skills)?be.skills.filter(He=>!!He&&typeof He.name=="string"&&typeof He.path=="string"):[]}}catch{return null}}function ya(k,j){if(typeof window>"u")return;const G=k.trim();if(G)try{if(j.text.trim().length>0||j.imageUrls.length>0||j.fileAttachments.length>0||j.skills.length>0){window.localStorage.setItem(cr(G),JSON.stringify(j));return}window.localStorage.removeItem(cr(G))}catch{}}function Za(k){ya(k,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function $o(){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 es(){r("interrupt")}function Do(){const k=M.value;if(!k){xe.value=!1;return}xe.value=k.scrollHeight>k.clientHeight+2}function Nr(){Re||(Re=!0,Dt(()=>{Re=!1,Do()}))}function Or(){Ie.value||(Se.value=!Se.value,Nr(),Dt(()=>{var k;return(k=M.value)==null?void 0:k.focus()}))}function Ws(k){r("update:selected-model",k)}function $r(k){if(k===o.selectedCollaborationMode){V.value=!1;return}r("update:selected-collaboration-mode",k),V.value=!1}function Fo(k){if(k===o.selectedCollaborationMode){ue.value=!1;return}r("update:selected-collaboration-mode",k),ue.value=!1}function ts(k){r("update:selected-reasoning-effort",k)}function wa(k){o.approvalPolicy===k||o.isApprovalPolicySaving===!0||(r("update:approval-policy",k),r("save-approval-policy"))}function Dr(){o.dictationClickToToggle}function dr(){Ie.value||(ue.value=!ue.value,V.value=!1,ie.value=!1)}function fr(){he.value||(V.value=!V.value,ue.value=!1,ie.value=!1)}function xo(){he.value||(ie.value=!ie.value,ue.value=!1,V.value=!1)}function ns(){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 j=i.value.find(G=>G.id===k);if(j&&ln(j.url)){const G=to(j.url);G&&cn(G)}i.value=i.value.filter(G=>G.id!==k)}function It(k){l.value=l.value.filter(j=>j.path!==k)}function cn(k){c.value=c.value.filter(j=>j.fsPath!==k)}function qn(k){const j=d.value.find(be=>be.id===k);if(!j)return;const G=new Set(j.filePaths);c.value=c.value.filter(be=>!G.has(be.fsPath)),d.value=d.value.filter(be=>be.id!==k)}function sn(k,j){const G=k.replace(/\\/g,"/");if(c.value.some(Mt=>Mt.fsPath===G))return;const be=G.split("/").filter(Boolean),He=(j==null?void 0:j.trim())||be[be.length-1]||G;c.value=[...c.value,{label:He,path:G,fsPath:G}]}function ko(k){return k.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(k.name)}const po=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Fr(k){return k.type.startsWith("video/")?!0:po.test(k.name)}function ln(k){const j=k.trim();if(!j)return!1;if(j.startsWith("data:video/"))return!0;try{const G=new URL(j,window.location.href);return po.test(G.pathname)?!0:G.pathname==="/codex-local-image"?po.test(G.searchParams.get("path")??""):!1}catch{return po.test(j)}}function to(k){try{const j=new URL(k,window.location.href);return j.pathname!=="/codex-local-image"?"":decodeURIComponent(j.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function Io(k){return k?Array.from(k):[]}function Et(k){return k!==se?!1:(f.value+=1,!0)}function pr(k){k===se&&(f.value=Math.max(0,f.value-1))}function no(k){if(k<=0)return;const j=y.value,G=j?j.succeeded+j.failed:0;if(!j||G>=j.total){y.value={total:k,succeeded:0,failed:0};return}y.value={...j,total:j.total+k}}function gn(k){const j=y.value;j&&(y.value={...j,succeeded:j.succeeded+(k==="success"?1:0),failed:j.failed+(k==="failure"?1:0)})}function Bo(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ln(k){const j=new Date,G=[j.getFullYear(),String(j.getMonth()+1).padStart(2,"0"),String(j.getDate()).padStart(2,"0"),String(j.getHours()).padStart(2,"0"),String(j.getMinutes()).padStart(2,"0"),String(j.getSeconds()).padStart(2,"0")].join("-"),be=k.type.startsWith("image/")&&k.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${G}.${be}`}function In(){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 yn(k){return k.name.trim()?k:new File([k],Ln(k),{type:k.type||"image/png",lastModified:Date.now()})}async function ba(k,j){if(Et(j))try{const G=yn(k),be=await Pu(G);if(j!==se)return;if(!be){gn("failure");return}i.value=[...i.value,{id:Bo(),name:G.name,url:`/codex-local-image?path=${encodeURIComponent(be)}`}],gn("success")}catch{j===se&&gn("failure")}finally{pr(j)}}async function ho(k,j){if(Et(j))try{const G=await Pu(k);if(j!==se)return;if(!G){gn("failure");return}sn(G),gn("success")}catch{j===se&&gn("failure")}finally{pr(j)}}async function Uo(k,j){if(Et(j))try{const G=yn(k),be=await Pu(G);if(j!==se)return;if(!be){gn("failure");return}const He=be.replace(/\\/g,"/");i.value=[...i.value,{id:Bo(),name:G.name,url:`/codex-local-image?path=${encodeURIComponent(He)}`}],sn(He),gn("success")}catch{j===se&&gn("failure")}finally{pr(j)}}function Ft(k){const j=Io(k);if(j.length===0)return;no(j.length),ue.value=!1,bn();const G=se;for(const be of j)ko(be)?ba(be,G):Fr(be)?Uo(be,G):ho(be,G)}function hr(){re=0,S.value=!1}function Br(k){return k?Array.from(k.types??[]).includes("Files"):!1}async function Ur(k){if(!k||k.length===0)return;const j=Je.value,G=Array.from(k),He=(G[0].webkitRelativePath||G[0].name).split("/").filter(Boolean)[0]||"Folder",Mt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:Mt,name:He,total:G.length,processed:0,filePaths:[],isUploading:!0}];const _t=Zt=>{j===Je.value&&(d.value=d.value.map(Gt=>Gt.id===Mt?Zt(Gt):Gt))};for(const Zt of G)try{const Gt=await Pu(Zt);if(j!==Je.value)return;if(Gt){const qo=Zt.webkitRelativePath||Zt.name;sn(Gt,qo),_t(Ca=>({...Ca,processed:Ca.processed+1,filePaths:[...Ca.filePaths,Gt]}));continue}_t(qo=>({...qo,processed:qo.processed+1}))}catch{_t(Gt=>({...Gt,processed:Gt.processed+1}))}_t(Zt=>({...Zt,isUploading:!1}))}function wn(k){k&&(k.value="")}function Yt(k){const j=k.target;Ft((j==null?void 0:j.files)??null),wn(j),ue.value=!1}function mo(k){const j=k.target;Ft((j==null?void 0:j.files)??null),wn(j),ue.value=!1}function un(k){const j=k.target;Ur((j==null?void 0:j.files)??null),wn(j),ue.value=!1}function zr(k){Ie.value||!Br(k.dataTransfer)||(k.preventDefault(),re+=1,S.value=!0)}function Xt(k){Ie.value||!Br(k.dataTransfer)||(k.preventDefault(),k.dataTransfer&&(k.dataTransfer.dropEffect="copy"),S.value=!0)}function zo(k){S.value&&(k.preventDefault(),re=Math.max(0,re-1),re===0&&hr())}function Ta(k){var j;Ie.value||!Br(k.dataTransfer)||(k.preventDefault(),hr(),Ft(((j=k.dataTransfer)==null?void 0:j.files)??null))}function Wt(){!S.value&&re===0||hr()}function Hr(k){var Mt,_t;if(Ie.value)return;const j=((Mt=k.clipboardData)==null?void 0:Mt.getData("text/plain"))??"";if(j.length>=Y1){k.preventDefault();const Zt=new File([j],In(),{type:"text/plain",lastModified:Date.now()});Ft([Zt]);return}const G=Array.from(((_t=k.clipboardData)==null?void 0:_t.items)??[]);if(G.length===0)return;const be=j.length>0,He=G.filter(Zt=>Zt.kind==="file"&&Zt.type.startsWith("image/")).map(Zt=>Zt.getAsFile()).filter(Zt=>Zt instanceof File);He.length!==0&&(be||k.preventDefault(),Ft(He))}function qr(){v.value&&(v.value=""),Nr(),Wr(),_o()}function At(k){if(k.isComposing||k.keyCode===229)return;if(Z.value){if(k.key==="Escape"){k.preventDefault(),bn();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 G=ge.value.length;me.value=(me.value+G-1)%G}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const G=ge.value[me.value];G?Vr(G):bn();return}}if(oe.value){if(k.key==="Escape"){k.preventDefault(),Ao();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 G=Le.value.length;Ne.value=(Ne.value+G-1)%G}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const G=Le.value[Ne.value];G?Gr(G):Ao();return}}if(o.sendWithEnter!==!1?k.key==="Enter"&&!k.shiftKey:k.key==="Enter"&&(k.metaKey||k.ctrlKey)){k.preventDefault(),Qt(o.isTurnInProgress?$e.value:"steer");return}}function bn(){if(Z.value=!1,ye.value=null,Pe.value="",ge.value=[],me.value=0,N=!1,ce){const k=ce;ce="",Qx(k)}}function Wr(){const k=M.value;if(!k){bn();return}const j=k.selectionStart??s.value.length,be=s.value.slice(0,j).match(/(^|\s)(@[^\s@]*)$/);if(!be){bn();return}const He=be[2]??"",Mt=He.length,_t=j-Mt;oe.value&&Ao(),ye.value=_t,Pe.value=He.slice(1),Z.value=!0,Ho()}function Ao(){oe.value=!1,Ae.value=null,De.value="",Ne.value=0,Le.value=Ce.value}function _o(){const k=M.value;if(!k){Ao();return}const j=k.selectionStart??s.value.length,G=s.value.slice(0,j),be=s1(G);if(!be){Ao();return}Z.value&&bn(),Ae.value=be.startIndex,De.value=be.query,Le.value=i1(Ce.value,be.query),Ne.value=0,oe.value=!0}function Gr(k){const j=M.value,G=Ae.value;if(G!==null&&j){const be=j.selectionStart??s.value.length;s.value=`${s.value.slice(0,G)}${s.value.slice(be)}`}if(Ao(),k.kind==="skill"){const be=(o.skills??[]).find(Mt=>Mt.path===k.skillPath||Mt.name===k.id);be&&!l.value.some(Mt=>Mt.path===be.path)&&(l.value=[...l.value,{...be}]);const He=s.value.trim();s.value=He.length>0?`${He} (Use the ${k.id} skill.)`:`Use the ${k.id} skill.`,Dt(()=>{j==null||j.focus(),Do()});return}if(k.kind==="rpc"){r("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=""),Dt(()=>{j==null||j.focus(),Do()})}async function Ho(){if(!Z.value)return;const k=(o.cwd??"").trim();if(!k){ge.value=[],N=!0;return}N=!1,at&&clearTimeout(at);const j=++Xe;at=setTimeout(async()=>{const G=`composer-${j}`,be=Pe.value;try{if(ce||(await Yx([k],G),ce=G,r("register-fuzzy-session",G)),await Jx(ce,be),!Z.value||j!==Xe)return;if(ge.value=(o.fuzzyFileSearchResults??[]).map(He=>({path:He.path})),me.value=0,ge.value.length===0)try{const He=await sm(k,be,20);if(!Z.value||j!==Xe)return;ge.value=He,me.value=0}catch{if(!Z.value||j!==Xe)return;ge.value=[]}}catch{if(!Z.value||j!==Xe)return;ce="";try{const He=await sm(k,be,20);if(!Z.value||j!==Xe)return;ge.value=He,me.value=0}catch{if(!Z.value||j!==Xe)return;ge.value=[]}}},120)}function Vr(k){const j=M.value,G=ye.value;if(G!==null&&j){const be=j.selectionStart??s.value.length;s.value=`${s.value.slice(0,G)}${s.value.slice(be)}`.trimEnd()}sn(k.path),bn(),Dt(()=>j==null?void 0:j.focus())}function oo(k){U(),eo(k),Dt(()=>{var j;(j=M.value)==null||j.focus(),Do()})}function mr(k){const j=k.trim();j&&(s.value=s.value.trim()?`${s.value.trim()}
|
|
61
|
-
${j}`:j,Dt(()=>{var G;(G=M.value)==null||G.focus(),Do()}))}function Kr(k){const j=k.lastIndexOf("/");return j<0?k:k.slice(j+1)}function Po(k){const j=k.lastIndexOf("/");return j<=0?"":k.slice(0,j)}function ht(k){const j=Kr(k),G=j.lastIndexOf(".");return G<=0?"":j.slice(G+1).toLowerCase()}function An(k){const j=ht(k);return j==="ts"?"TS":j==="tsx"?"TSX":j==="js"?"JS":j==="jsx"?"JSX":j==="json"?"{}":""}function Tn(k){const j=ht(k);return j.startsWith("ts")?"ts":j.startsWith("js")?"js":j==="json"?"json":"default"}function Sa(k){const j=ht(k);return j==="md"||j==="mdx"}function Wn(k){if(!ue.value&&!V.value&&!ie.value)return;const j=k.target;j&&(typeof j.closest=="function"&&j.closest(".composer-popover-anchor")||(ue.value=!1,V.value=!1,ie.value=!1))}return Ti(()=>{document.addEventListener("click",Wn),window.addEventListener("drop",Wt),window.addEventListener("dragend",Wt),window.addEventListener("blur",Wt),Nr()}),t({hydrateDraft:oo,appendTextToDraft:mr,hasUnsavedDraft:()=>_e.value}),Hs(()=>{document.removeEventListener("click",Wn),window.removeEventListener("drop",Wt),window.removeEventListener("dragend",Wt),window.removeEventListener("blur",Wt),window.removeEventListener("pointerup",Dr),window.removeEventListener("pointercancel",Dr),window.removeEventListener("blur",Dr),at&&clearTimeout(at)}),nt(()=>o.activeThreadId,k=>{U(),qe&&ya(qe,$o()),ga();const j=qs(k);j&&(eo(j),qr()),qe=k.trim()},{immediate:!0}),nt([s,i,c,l],()=>{qe&&ya(qe,$o())},{deep:!0}),nt(s,()=>{Nr()}),nt(()=>o.cwd,()=>{Z.value&&Ho()}),nt(()=>o.fuzzyFileSearchResults,k=>{!Z.value||!ce||(ge.value=(k??[]).map(j=>({path:j.path})),me.value=0)}),nt(Ke,k=>{$e.value=k}),(k,j)=>(P(),B("form",{class:"thread-composer",onSubmit:j[6]||(j[6]=gt(G=>Qt(e.isTurnInProgress?$e.value:"steer"),["prevent"]))},[w("div",{class:ut(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":S.value}])},[e.planPanel?(P(),et(yM,{key:0,"plan-panel":e.planPanel,onImplementPlan:j[0]||(j[0]=G=>k.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Be(LM,{"selected-images":i.value,"folder-upload-groups":d.value,"standalone-file-attachments":Oe.value,"selected-skills":l.value,"is-interaction-disabled":Ie.value,onRemoveImage:xt,onRemoveFolder:qn,onRemoveFile:cn,onRemoveSkill:It},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",l1,[w("div",u1,[w("div",{class:ut(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":S.value,"thread-composer-input-wrap--expanded":Se.value}]),onDragenter:zr,onDragover:Xt,onDragleave:zo,onDrop:Ta},[S.value?(P(),B("div",c1,[w("span",d1,F(m(a)("Drop images or files")),1)])):ve("",!0),Z.value?(P(),B("div",f1,[ge.value.length>0?(P(!0),B(ct,{key:0},on(ge.value,(G,be)=>(P(),B("button",{key:G.path,class:ut(["thread-composer-file-mention-row",{"is-active":be===me.value}]),type:"button",onMousedown:gt(He=>Vr(G),["prevent"])},[An(G.path)?(P(),B("span",{key:0,class:ut(["thread-composer-file-mention-icon-badge",`is-${Tn(G.path)}`])},F(An(G.path)),3)):Sa(G.path)?(P(),B("span",h1,"↓")):(P(),et(fl,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",m1,[w("span",v1,F(Kr(G.path)),1),Po(G.path)?(P(),B("span",g1,F(Po(G.path)),1)):ve("",!0)])],42,p1))),128)):m(N)?(P(),B("div",y1,F(m(a)("No searchable directory for this thread")),1)):(P(),B("div",w1,F(m(a)("No matching files")),1))])):ve("",!0),oe.value?(P(),et(GR,{key:2,commands:Le.value,"highlighted-index":Ne.value,onSelect:Gr},null,8,["commands","highlighted-index"])):ve("",!0),Mn(w("textarea",{ref_key:"inputRef",ref:M,"onUpdate:modelValue":j[1]||(j[1]=G=>s.value=G),class:"thread-composer-input",placeholder:Ge.value,disabled:Ie.value,onInput:qr,onKeydown:At,onPaste:Hr},null,40,b1),[[Un,s.value]]),tt.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:Ie.value,onClick:Or},[Se.value?(P(),et(xR,{key:0,class:"thread-composer-expand-icon"})):(P(),et(bR,{key:1,class:"thread-composer-expand-icon"}))],8,T1)):ve("",!0)],34),w("div",S1,[e.isTurnInProgress&&!dt.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:es},[e.isStopPending?(P(),B("span",x1)):(P(),et(_R,{key:1,class:"thread-composer-stop-icon"}))],8,C1)):(P(),B("button",{key:1,class:ut(["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:j[2]||(j[2]=G=>Qt(e.isTurnInProgress?$e.value:"steer"))},[Be(vR,{class:"thread-composer-submit-icon"})],10,k1))])]),w("div",{class:ut(["thread-composer-controls",{"thread-composer-controls--recording":We.value}])},[Be(o1,{open:ue.value,"is-mobile":m(pe),"is-interaction-disabled":Ie.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":R,"active-in-progress-mode":$e.value,"onUpdate:open":j[3]||(j[3]=G=>ue.value=G),onToggle:dr,onSetActiveMode:ur,onSelectPhoto:ns,onSelectFolder:vt,onCaptureCamera:os,onSelectCollaborationMode:Fo,onSelectApprovalPolicy:wa},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"]),Be(OM,{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":Ws,"onUpdate:selectedReasoningEffort":ts},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",I1,[Be(sc,{open:V.value,align:"start",width:"md","aria-label":m(a)("Plan mode"),"onUpdate:open":j[4]||(j[4]=G=>V.value=G)},{trigger:ft(()=>[w("button",{class:ut(["thread-composer-plan-trigger",{"is-active":V.value}]),type:"button","aria-label":m(a)("Plan mode"),disabled:he.value,onClick:fr},[w("span",_1,F(H.value),1),Be(Fs,{class:"thread-composer-plan-trigger-chevron"})],10,A1)]),default:ft(()=>[(P(!0),B(ct,null,on(_.value,G=>(P(),B("button",{key:G.value,class:ut(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===G.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===G.value,disabled:G.disabled||he.value,onClick:be=>$r(G.value)},[w("span",E1,[w("span",R1,F(m(a)(G.labelKey)),1),G.subLabel?(P(),B("span",M1,F(G.subLabel),1)):ve("",!0),G.disabled?(P(),B("span",j1,F(m(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===G.value?(P(),B("span",L1,"✓")):ve("",!0)],10,P1))),128))]),_:1},8,["open","aria-label"]),Be(sc,{open:ie.value,align:"center",width:"md","aria-label":m(a)("Approval policy"),"onUpdate:open":j[5]||(j[5]=G=>ie.value=G)},{trigger:ft(()=>[w("button",{class:ut(["thread-composer-approval-trigger",{"is-active":ie.value}]),type:"button","aria-label":m(a)("Approval policy"),disabled:he.value,onClick:xo},[w("span",O1,F(le.value),1),Be(Fs,{class:"thread-composer-approval-trigger-chevron"})],10,N1)]),default:ft(()=>[(P(),B(ct,null,on(R,G=>w("button",{key:G.value,class:ut(["thread-composer-menu-item",{"is-active":e.approvalPolicy===G.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===G.value,disabled:e.isApprovalPolicySaving,onClick:be=>wa(G.value)},[w("span",D1,[w("span",F1,F(m(a)(G.label)),1)]),e.approvalPolicy===G.value?(P(),B("span",B1,"✓")):ve("",!0)],10,$1)),64)),e.approvalPolicyError?(P(),B("p",U1,F(e.approvalPolicyError),1)):ve("",!0),Be(iu,{name:"approval-tip"},{default:ft(()=>[e.approvalPolicyNotice?(P(),B("span",z1,F(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])])),st.value?(P(),B("button",{key:1,type:"button",class:ut(["thread-composer-context-usage-inline",{"is-warning":Te.value==="warning","is-danger":Te.value==="danger"}]),title:de.value,"aria-label":m(a)("Context"),onClick:ze},[w("span",q1,F(Y.value),1),Te.value!=="healthy"?(P(),B("span",W1,F(m(a)("Compact")),1)):ve("",!0)],10,H1)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:O,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ie.value,onChange:Yt},null,40,G1),w("input",{ref_key:"cameraCaptureInputRef",ref:$,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ie.value,onChange:mo},null,40,V1),w("input",{ref_key:"folderPickerInputRef",ref:q,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ie.value,onChange:un},null,40,K1)],32))}}),Wm=Ct(Q1,[["__scopeId","data-v-c87250dc"]]),X1=["aria-label"],Z1=["aria-checked","onClick"],ej={class:"runtime-toggle-option-label"},tj=vn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=va(),r=[{value:"local",label:o("Local project"),icon:op},{value:"worktree",label:o("New worktree"),icon:ac}];function a(s){n("update:modelValue",s)}return(s,i)=>(P(),B("div",{class:"runtime-toggle",role:"radiogroup","aria-label":m(o)("Continue in")},[(P(),B(ct,null,on(r,l=>w("button",{key:l.value,class:ut(["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(),et(Ff(l.icon),{class:"runtime-toggle-option-icon"})),w("span",ej,F(l.label),1)],10,Z1)),64))],8,X1))}}),nj=Ct(tj,[["__scopeId","data-v-b3c220d3"]]),oj={},rj={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 aj(e,t){return P(),B("svg",rj,[...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 Ty=Ct(oj,[["render",aj]]),sj={},ij={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function lj(e,t){return P(),B("svg",ij,[...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 uj=Ct(sj,[["render",lj]]),cj={class:"sidebar-thread-controls"},dj=["aria-label","title"],fj=["aria-label","title"],pj=vn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=va();return(n,o)=>(P(),B("div",cj,[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:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(P(),et(uj,{key:0,class:"sidebar-thread-controls-icon"})):(P(),et(Ty,{key:1,class:"sidebar-thread-controls-icon"}))],8,dj),Co(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:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Be(fl,{class:"sidebar-thread-controls-icon"})],8,fj)):ve("",!0)]))}}),Gm=Ct(pj,[["__scopeId","data-v-de38b7ee"]]),hj={},mj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vj(e,t){return P(),B("svg",mj,[...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 Vm=Ct(hj,[["render",vj]]),gj={},yj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wj(e,t){return P(),B("svg",yj,[...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 Km=Ct(gj,[["render",wj]]),bj={},Tj={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function Sj(e,t){return P(),B("svg",Tj,[...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 Ym=Ct(bj,[["render",Sj]]),Cj={},xj={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function kj(e,t){return P(),B("svg",xj,[...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 Ij=Ct(Cj,[["render",kj]]),Aj={},_j={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function Pj(e,t){return P(),B("svg",_j,[...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 Ej=Ct(Aj,[["render",Pj]]),Rj={},Mj={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function jj(e,t){return P(),B("svg",Mj,[...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 Jm=Ct(Rj,[["render",jj]]);function Sy(e){var r;const t=e.replace(/\r\n/g,`
|
|
62
|
-
`).trim();if(!t)return null;const n=[],o=[];for(const a of t.split(`
|
|
63
|
-
`)){const s=a.trim();if(!s){n.length===0&&o.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:((r=i[2])==null?void 0:r.trim())??"",status:c});continue}o.push(s)}if(n.length===0){const a=Lj(t);return a||null}return{explanation:o.join(`
|
|
64
|
-
`).trim(),steps:n.filter(a=>a.step.length>0)}}function Lj(e){var a,s;const t=[],n=[],o=[];for(const i of e.split(`
|
|
65
|
-
`)){const l=i.trim();if(!l){t.length===0&&n.length===0&&o.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}o.push(l)}const r=t.length>0?t:n;return r.length===0?null:{explanation:Nj(o.join(`
|
|
66
|
-
`)),steps:r.filter(i=>i.step.length>0)}}function Nj(e){return e.split(`
|
|
67
|
-
`).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
|
|
68
|
-
`).trim()}function Qm(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}:Sy(e.text)}const Cy="modelSwitch",xy=20;function Oj(e){return e.messageType===Cy}const ha="__new-thread__",ky="__new-thread-provider__::";function Iy(e){return e==="plan"?"plan":"default"}function wi(e){return typeof e=="string"?e.trim():""}function _r(){return Object.create(null)}function Hu(e){const t=_r();for(const[n,o]of Object.entries(e))t[n]=o;return t}function Wl(e,t){if(!(t in e))return e;const n=_r();for(const[o,r]of Object.entries(e))o!==t&&(n[o]=r);return n}function Ay(e,t){let n=!1;const o=_r();for(const[r,a]of Object.entries(e)){if(r===ha||r.startsWith(ky)||t.has(r)){o[r]=a;continue}n=!0}return n?o:e}function Ms(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function $j(e){return e===ha}function Lu(e){const t=Ms(e);return t?`${ky}${t}`:""}function Wa(e){return e.trim()||ha}function Od(e,t){const n=Wa(t),o=wi(e[n]);return o||wi(e[ha])}function $d(e,t){const n=Wa(t);return Iy(e[n])}function Xm(e,t,n){const o=Wa(t);if($j(o))return Wl(e,o);if(n==="plan"){const r=Hu(e);return r[o]="plan",r}return Wl(e,o)}function Dj(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Jn(e){return e.flatMap(t=>t.threads)}function Fj(e,t){var o,r;const n=e.findIndex(a=>a.id===t);return n<0?"":((o=e[n+1])==null?void 0:o.id)??((r=e[n-1])==null?void 0:r.id)??""}function _y(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function Bj(e){if(e instanceof Oo&&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 Uj(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),o=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(o)?!1:n>o}function zj(e,t,n){return Uj(e,t??n)}function Py(e,t,n){return Math.min(Math.max(e,t),n)}function Gi(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 Zm(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Gi(t.totalTokens)??0,inputTokens:Gi(t.inputTokens)??0,cachedInputTokens:Gi(t.cachedInputTokens)??0,outputTokens:Gi(t.outputTokens)??0,reasoningOutputTokens:Gi(t.reasoningOutputTokens)??0}}function Hj(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Zm(t.total),o=Zm(t.last);if(!n||!o)return null;const r=Gi(t.modelContextWindow),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?Py(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function Vi(e,t){const n=[];for(const o of e)n.includes(o)||n.push(o);for(const o of t)n.includes(o.projectName)||n.push(o.projectName);return Va(e,n)?e:n}function mf(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>n.get(r)??null).filter(r=>r!==null);for(const r of e)t.includes(r.projectName)||o.push(r);return o}function Va(e,t){const n=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1)if(n[r]!==o[r])return!1;return!0}function qj(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const o=[...e],[r]=o.splice(t,1);return o.splice(n,0,r),o}function Wj(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function Gj(e=[],t=[]){var n,o,r,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)!==((o=t[s])==null?void 0:o.step)||((r=e[s])==null?void 0:r.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function Vj(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&Gj(e.steps,t.steps)}function Nu(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 vf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Va(e.images,t.images)&&Kj(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&Wj(e.commandExecution,t.commandExecution)&&Vj(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function pl(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 ev(e,t,n={}){var S;const o=new Map(e.map(I=>[I.id,I])),r=new Map(t.map(I=>[I.id,I])),a=t.map(I=>{const U=o.get(I.id);return U&&vf(U,I)?U:I});if(n.preserveMissing!==!0)return pl(e,a)?e:a;const s=e.map(I=>{const U=r.get(I.id);return!U||vf(I,U)?I:U}).filter(I=>!ol(I)||!tv(I,t)),i=new Set(e.map(I=>I.id)),l=a.filter(I=>!i.has(I.id)),c=e.filter(ol);let d=[],v=l;if(c.length>0){const I=a.findIndex(U=>c.some(O=>tv(O,[U])));if(I>=0){const U=l.findIndex(O=>O.id===a[I].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 M=((S=q.turnId)==null?void 0:S.trim())??"";M!==""&&U.has(M)?O.push(q):$.push(q)}d=O,v=$}}}const f=s.findIndex(ol),y=f>=0?[...s.slice(0,f),...d,...s.slice(f),...v]:[...s,...d,...v];return pl(e,y)?e:y}function Kj(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 o=e[n],r=t[n];if(o.path!==r.path||o.operation!==r.operation||o.movedToPath!==r.movedToPath||o.diff!==r.diff||o.addedLineCount!==r.addedLineCount||o.removedLineCount!==r.removedLineCount)return!1}return!0}function Qa(e){return e.replace(/\s+/gu," ").trim()}function ol(e){return e.messageType==="userMessage.optimistic"}function Yj(e){return e.some(ol)}function tv(e,t){if(e.role!=="user")return!1;const n=Qa(e.text),o=Array.isArray(e.images)?e.images:[],r=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||s.role!=="user"||ol(s))return!1;const i=Qa(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&&Va(l,o)&&c===r&&d===a})}function Jj(e){const t=[];let n=new Map;for(const o of e){if(!(o.role==="assistant"&&typeof o.messageType=="string"&&(o.messageType==="agentMessage"||o.messageType==="agentMessage.live"))){o.role==="user"&&(n=new Map),t.push(o);continue}const a=Qa(o.text);if(a.length===0){t.push(o);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(o)}else n.set(a,t.length),t.push(o)}return t}function Qj(e,t){const n=new Set(t.map(a=>a.id)),o=new Set(t.filter(a=>a.role==="assistant").map(a=>Qa(a.text)).filter(a=>a.length>0));if(o.size===0)return e;const r=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Qa(a.text);return s.length===0?!1:!o.has(s)});return r.length===e.length?e:r}function _c(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const o=e[n];if(vf(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const rp="worked";function $s(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function Xj(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];n>0&&a.push(`${n}h`),(o>0||n>0)&&a.push(`${o}m`);const s=r>0||a.length===0?r:0;return a.push(`${s}s`),a.join(" ")}function Zj(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function eL(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 Ey(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${Xj(e.durationMs)}`,messageType:rp,turnId:e.turnId,durationMs:e.durationMs}}function tL(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function nL(e,t){const n=Ey(t),o=e.filter(s=>s.messageType!==rp),r=tL(o);if(r<0)return[...o,n];const a=[...o];return a.splice(r,0,n),a}function oL(e,t){if(!t)return e;const n=new Set;for(const r of e)r.messageType===rp&&r.turnId&&n.add(r.turnId);const o=[];for(const[r,a]of Object.entries(t))!r||n.has(r)||typeof a!="number"||!Number.isFinite(a)||a<=0||(o.push(Ey({turnId:r,durationMs:Math.round(a)})),n.add(r));return o.length===0?e:[...e,...o]}function Tt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function rL(e,t){if(t.size===0)return e;let n=!1;const o={};for(const[r,a]of Object.entries(e)){if(t.has(r)){n=!0;continue}o[r]=a}return n?o:e}function aL(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 sL(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 iL(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 nn(e,t){const n=Object.entries(e).filter(([o])=>t.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Ry(e,t){const n=t.trim();if(!n)return e;let o=!1;const r=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(o=!0),s.length>0?r.push(i?{...a,threads:s}:a):a.threads.length===0&&r.push(a)}return o?r:e}function ic(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>{const a=n.get(r.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=r.threads.map(l=>{const c=s.get(l.id);return c&&aL(c,l)?c:l});return a&&a.projectName===r.projectName&&sL(a.threads,i)?a:{projectName:r.projectName,threads:i}});return iL(e,o)?e:o}function lL(e,t,n){const o=new Set(Jn(t).map(i=>i.id)),r=Jn(e).filter(i=>n[i.id]===!0&&!o.has(i.id));if(r.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 r){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 bi(e){return ar(e)}function uL(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||ar(e.remotePath),n=uL(e.hostId);return n?`${t} ${n}`:t}function My(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function Pc(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(r=>r.id)),o=e.projectOrder.filter(r=>t.has(r)||n.has(r));for(const r of e.order)o.includes(r)||o.push(r);for(const r of n)o.includes(r)||o.push(r);return o}function gf(e,t){const n=My(e);return Pc(e).map(o=>{if(n.has(o))return o;const r=Ze(o).trim(),a=bi(r);return t.has(a)?r:a})}function qu(e,t){return Ze(e).trim()===t||bi(e)===t}function dL(e,t){const n=new Set;for(const o of e.order)qu(o,t)&&n.add(o);for(const o of e.active)qu(o,t)&&n.add(o);for(const o of Object.keys(e.labels))qu(o,t)&&n.add(o);return n}function fL(e,t,n){var c,d;const o=new Set((e.remoteProjects??[]).map(v=>v.id)),r=new Map;for(const v of e.order){const f=bi(v);r.has(f)||r.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&&r.set(v.projectName,f)}const a=[],s=v=>{v&&!a.includes(v)&&a.push(v)};for(const v of t){if(o.has(v)){s(v);continue}const f=r.get(v);f&&s(f)}for(const v of Pc(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 pL(e,t,n){const o=gf(t,n);if(o.length===0)return e;const r=new Map(o.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(bf(a)||bf(s))return 0;const i=r.get(a.projectName)??Number.POSITIVE_INFINITY,l=r.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function yf(e,t){const n=new Map,o=new Map,r=s=>{const i=Ze(s).trim();if(!i)return;const l=ar(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=Ze(s).trim();if(!i)continue;const l=ar(i);lc(i)||o.set(l,(o.get(l)??0)+1),r(s)}for(const s of e)for(const i of s.threads){const l=Ze(i.cwd).trim(),c=ar(l),d=(t==null?void 0:t.order.some(v=>Ze(v).trim()===l))===!0;lc(l)&&!d&&o.get(c)===1||r(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function lc(e){return e.includes("/.codex/worktrees/")}function hL(e,t){const n=yf(e,t);if(n.size===0)return e;const o=new Set,r=new Set,a=new Map,s=new Set;for(const c of(t==null?void 0:t.order)??[]){const d=Ze(c).trim();if(!d||(s.add(d),lc(d)))continue;const v=ar(d);o.has(v)?(o.delete(v),r.add(v),a.delete(v)):r.has(v)||(o.add(v),a.set(v,d))}const i=[],l=new Map;for(const c of e)for(const d of c.threads){const v=Ze(d.cwd).trim(),f=ar(v),y=s.has(v),S=lc(v)&&!y&&o.has(f);let I=c.projectName;S&&n.has(f)?I=a.get(f)??c.projectName:v&&n.has(f)&&(I=v);const U=d.projectName===I?d:{...d,projectName:I},O=l.get(I);if(O)O.threads.push(U);else{const $={projectName:I,threads:[U]};l.set(I,$),i.push($)}}return i}function mL(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const o=new Set(e.map(s=>s.projectName)),r=[...e],a=My(t);for(const s of Pc(t)){if(a.has(s)){if(o.has(s))continue;r.push({projectName:s,threads:[]}),o.add(s);continue}const i=Ze(s).trim();if(!i)continue;const l=bi(i),c=n.has(l)?i:l;o.has(c)||(r.push({projectName:c,threads:[]}),o.add(c))}return r}const wf=20;function Ns(e){const t=e.split(`
|
|
69
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,wf):"Untitled thread"}function vL(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function bf(e){return e.threads.some(t=>t.cwd.trim().length===0||oc(t.cwd))}const Bs=new Map;let Wu=0;function Dd(e,t){const n=`${e}:${t.id}`,o=Bs.get(n);return o!==void 0?o:(Wu+=1,Bs.set(n,Wu),Wu)}function gL(e){const t=`${e}:`;for(const n of[...Bs.keys()])n.startsWith(t)&&Bs.delete(n)}function yL(){Bs.clear(),Wu=0}function wL(e){if(Bs.size!==0)for(const t of[...Bs.keys()]){const n=t.indexOf(":"),o=n>0?t.slice(0,n):"";e.has(o)||Bs.delete(t)}}function nv(e,t){const n=t.trim();if(!n)return-1;const o=e.findIndex(i=>i.id===n);if(o>=0)return o;const r=`session-cmd-${n}`,a=e.findIndex(i=>i.id===r);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 bL(e,t){var a,s;if(t.length===0)return e;const n=[...e],o=[],r=new Map;for(const i of t){const l=((a=i.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(l&&nv(n,l)>=0)continue;const c=i.turnIndex;if(typeof c!="number"||!Number.isFinite(c))continue;const d=r.get(c)??[];d.push(i),r.set(c,d)}for(const i of[...t].reverse()){const l=((s=i.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(l){const S=nv(n,l);if(S>=0){n.splice(S+1,0,i);continue}}const c=i.turnIndex;if(typeof c!="number"||!Number.isFinite(c)){o.push(i);continue}let d=-1,v=-1;const f=[];for(let S=0;S<n.length;S+=1)n[S].turnIndex===c&&(v=S,n[S].role==="user"?d=S:n[S].messageType!=="reasoning"&&f.push(S));if(f.some(S=>{const I=n[S].messageType;return I==="commandExecution"||I==="toolCall"||I==="fileChange"||I==="worked"})){const I=(r.get(c)??[]).indexOf(i),U=I>=0?I: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 o.length>0?[...n,...o.reverse()]:n}function TL(e,t,n){const o=new Set(n.map(s=>s.id)),r=new Map;for(const s of t)for(const i of s)o.has(i.id)||r.has(i.id)||r.set(i.id,i);const a=Array.from(r.values());for(const s of a)Dd(e,s);return a.sort((s,i)=>Dd(e,s)-Dd(e,i))}function SL(e,t,n,o,r){const a=TL(e,o,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const y=t[f];y.role!=="user"||!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(ol);s.set(i,f>=0?f:t.length)}const l=new Map,c=[];for(const f of a){const y=f.turnIndex,S=Number.isInteger(y)&&y>=0?s.get(y):void 0;if(S===void 0){c.push(f);continue}const I=l.get(S);I?I.push(f):l.set(S,[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=Jj(d);return[...bL(v,n),...r]}const jy="codex-web-local.thread-read-state.v1",ov="codex-web-local.thread-unread-cutoff.v1",Ly="codex-web-local.thread-token-usage.v1",Ny="codex-web-local.thread-reasoning.v1",Tf="codex-web-local.thread-turn-durations.v1",Oy="codex-web-local.thread-last-plan.v1",$y="codex-web-local.live-reasoning-snapshot.v1",Dy="codex-web-local.thread-terminal-open.v1",Sf="codex-web-local.selected-thread-id.v1",Cf="codex-web-local.selected-model-by-context.v1",Fy="codex-web-local.selected-model-id.v1",By="codex-web-local.project-order.v1",Uy="codex-web-local.project-display-name.v1",xf="codex-web-local.collaboration-mode-by-context.v1",CL="codex-web-local.collaboration-mode.v1";function xL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(jy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function rv(e){typeof window>"u"||window.localStorage.setItem(jy,JSON.stringify(e))}function kL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ny);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Fd(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Ny,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&jI(t,n)}}function IL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Tf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!r||typeof r!="object"||Array.isArray(r))continue;const a={};for(const[s,i]of Object.entries(r))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[o]=a)}return n}catch{return{}}}let zy={};function Hy(e){const t={};for(const[n,o]of Object.entries(e))n&&Object.keys(o).length>0&&(t[n]={...o});zy=t}function av(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(Tf):window.localStorage.setItem(Tf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e)){if(!t)continue;const o=zy[t]??{};for(const[r,a]of Object.entries(n))!r||typeof a!="number"||a<=0||o[r]!==a&&NI(t,r,a)}Hy(e)}}function AL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Oy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function qy(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Oy,JSON.stringify(e))}catch{}}function _L(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($y);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=r;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[o]={text:a.text,ts:a.ts})}return n}catch{return{}}}function PL(){if(typeof window>"u")return"";const e=window.localStorage.getItem(ov);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(ov,t),t}function EL(){if(typeof window>"u")return _r();try{const n=window.localStorage.getItem(Cf);if(n){const o=JSON.parse(n);if(!o||typeof o!="object"||Array.isArray(o))return _r();const r=_r();for(const[a,s]of Object.entries(o)){if(typeof a!="string"||a.length===0)continue;const i=wi(s);i&&(r[a]=i)}return r}}catch{}const e=wi(window.localStorage.getItem(Fy)),t=_r();return e&&(t[ha]=e),t}function Ou(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Cf):window.localStorage.setItem(Cf,JSON.stringify(e)),window.localStorage.removeItem(Fy)}catch{}}function RL(){if(typeof window>"u")return _r();try{const e=window.localStorage.getItem(xf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return _r();const n=_r();for(const[o,r]of Object.entries(t)){if(typeof o!="string"||o.length===0)continue;const a=Iy(r);a==="plan"&&(n[o]=a)}return n}}catch{}return _r()}function Bd(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(CL)}catch{}}function ML(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ly);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o)continue;const a=Hj(r);a&&(n[o]=a)}return n}catch{return{}}}function Ud(e){typeof window>"u"||window.localStorage.setItem(Ly,JSON.stringify(e))}const kf="codex-web-local.thread-model-switch-markers.v1";function jL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(kf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&Oj(s)).slice(0,xy);a.length>0&&(n[o]=a)}return n}catch{return{}}}function LL(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(kf):window.localStorage.setItem(kf,JSON.stringify(e))}catch{}}function NL(){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[o,r]of Object.entries(t))o&&typeof r=="boolean"&&(n[o]=r);return n}catch{return{}}}function OL(e){typeof window>"u"||window.localStorage.setItem(Dy,JSON.stringify(e))}function $L(){return typeof window>"u"?"":window.localStorage.getItem(Sf)??""}function DL(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Sf);return}window.localStorage.setItem(Sf,e)}}function FL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(By);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const o of t){if(typeof o!="string"||o.length===0)continue;const r=ar(o);r.length>0&&!n.includes(r)&&n.push(r)}return n}catch{return[]}}function BL(e){typeof window>"u"||window.localStorage.setItem(By,JSON.stringify(e))}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[o,r]of Object.entries(t)){const a=typeof o=="string"?ar(o):"";a.length>0&&typeof r=="string"&&(n[a]=r)}return n}catch{return{}}}function zL(e){typeof window>"u"||window.localStorage.setItem(Uy,JSON.stringify(e))}function HL(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function qL(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const o of e.steps){const r=o.status==="completed"?"x":o.status==="inProgress"?"~":" ";t.push(`- [${r}] ${o.step}`)}return t.join(`
|
|
70
|
-
`).trim()}function Ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Me(e){return typeof e=="string"?e:""}function Ds(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function sv(e){const t=Ve(e);if(!t)return null;const n=Ds(t.totalTokens??t.total_tokens),o=Ds(t.inputTokens??t.input_tokens),r=Ds(t.cachedInputTokens??t.cached_input_tokens),a=Ds(t.outputTokens??t.output_tokens),s=Ds(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||o===null||r===null||a===null||s===null?null:{totalTokens:n,inputTokens:o,cachedInputTokens:r,outputTokens:a,reasoningOutputTokens:s}}function WL(e){const t=Ve(e);if(!t)return null;const n=sv(t.total),o=sv(t.last);if(!n||!o)return null;const r=Ds(t.modelContextWindow??t.model_context_window),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?Py(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function GL(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ve(e.params),n=Bn(e),o=WL((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!o?null:{threadId:n,usage:o}}function Bn(e){const t=Ve(e.params);if(!t)return"";const n=Me(t.threadId);if(n)return n;const o=Me(t.thread_id);if(o)return o;const r=Me(t.conversationId);if(r)return r;const a=Me(t.conversation_id);if(a)return a;const s=Ve(t.thread),i=Me(s==null?void 0:s.id);if(i)return i;const l=Ve(t.turn),c=Me(l==null?void 0:l.threadId);if(c)return c;const d=Me(l==null?void 0:l.thread_id);return d||""}function VL(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 o=Ve(n.error);return Me(o==null?void 0:o.message)}function KL(e){var o;if(e.method!=="error")return null;const t=Ve(e.params),n=Me(t==null?void 0:t.message)||Me((o=Ve(t==null?void 0:t.error))==null?void 0:o.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function YL(e){const t=Bn(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),o=Ve(n==null?void 0:n.item),r=Me(o==null?void 0:o.type).toLowerCase();if(r==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(r==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(r==="commandexecution"){const a=Me(o==null?void 0:o.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(r==="filechange"){const s=(Array.isArray(o==null?void 0:o.changes)?o.changes:[])[0],i=Me(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 JL(e){if(e.method!=="turn/started")return null;const t=Ve(e.params);if(!t)return null;const n=Bn(e);if(!n)return null;const o=Ve(t.turn),r=Me(o==null?void 0:o.id)||Me(t.turnId)||`${n}:unknown`;if(!r)return null;const a=$s(Me(o==null?void 0:o.startedAt))??$s(Me(t.startedAt))??$s(e.atIso)??Date.now();return{threadId:n,turnId:r,startedAtMs:a}}function QL(e){if(e.method!=="turn/completed")return null;const t=Ve(e.params);if(!t)return null;const n=Bn(e);if(!n)return null;const o=Ve(t.turn),r=Me(o==null?void 0:o.id)||Me(t.turnId)||`${n}:unknown`;if(!r)return null;const a=$s(Me(o==null?void 0:o.completedAt))??$s(Me(t.completedAt))??$s(e.atIso)??Date.now(),s=$s(Me(o==null?void 0:o.startedAt))??$s(Me(t.startedAt))??void 0;return{threadId:n,turnId:r,completedAtMs:a,startedAtMs:s}}function uc(e){return`${e}:live-reasoning`}function XL(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":Me(n.id)}return""}function ZL(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{messageId:uc(n),itemId:n,delta:o}}if(e.method==="item/reasoning/textDelta"){const n=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{messageId:uc(n),itemId:n,delta:o}}return null}function eN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Me(t.itemId);return n?uc(n):""}return""}function tN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":uc(Me(n.id))}return""}function nN(e){var n;const t=[];for(const o of["content","summary"]){const r=Array.isArray(e[o])?e[o]:[];for(const a of r){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 oN(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||Me(n.type).toLowerCase()!=="reasoning")return null;const o=Me(n.id);return o?{itemId:o,text:nN(n)}:null}function rN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="agentMessage"?"":Me(n.id)}return""}function aN(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Me(t.itemId),o=Me(t.delta);if(!n||!o)return null;const r=Me(t.turnId)||Me(t.turn_id);return{messageId:n,delta:o,turnId:r||void 0}}return null}function sN(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 o=Me(n.id),r=Me(n.text);if(!o||!r)return null;const a=Me(t.turnId)||Me(t.turn_id);return{id:o,role:"assistant",text:r,messageType:"agentMessage",turnId:a||void 0}}return null}function iN(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function lN(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 uN(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 o=Me(n.id);if(!o)return null;if(n.type==="imageView"){const s=Me(n.path);return s?{id:o,role:"assistant",text:"",images:[iN(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const r=Me(n.result),a=r?lN(r):"";return a?{id:o,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=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{itemId:n,delta:o}}const rl="__global__";function dN(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function Wy(e){const t=Ve(e);if(!t)return null;const n=t.id,o=Me(t.method),r=t.params;if(typeof n!="number"||!Number.isInteger(n)||!o)return null;const a=Ve(r),s=fN(o,a),i=Me(a==null?void 0:a.threadId)||Me(a==null?void 0:a.thread_id)||Me(a==null?void 0:a.conversationId)||Me(a==null?void 0:a.conversation_id)||rl,l=Me(a==null?void 0:a.turnId)||Me(a==null?void 0:a.turn_id),c=Me(a==null?void 0:a.itemId)||Me(a==null?void 0:a.item_id)||Me(a==null?void 0:a.callId)||Me(a==null?void 0:a.call_id),d=Me(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:c,receivedAtIso:d,params:r??null}}function fN(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||pN(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||hN(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||mN(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||gN(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||yN(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||vN(t)?"item/tool/call":n)}function pN(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 hN(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 mN(e){return!!(e&&Array.isArray(e.questions))}function vN(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function gN(e){if(!e)return!1;const t=Me(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function yN(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ve(e.permissions)!==null:!1}function wN(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ve(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],o=[];for(const r of n){const a=Ve(r),s=Me(a==null?void 0:a.id).trim();s&&o.push(s)}return o}function bN(e,t){const n=t.threadId||rl,o=e.pendingServerRequestsByThreadId.value[n]??[],r=o.findIndex(s=>s.id===t.id),a=[...o];r>=0?a.splice(r,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function TN(e,t){const n={};for(const[o,r]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=r.filter(s=>s.id!==t);a.length>0&&(n[o]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=Tt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function SN(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function CN(e,t){const n={},o=new Set;for(const a of t){const s=a.threadId||rl,i=n[s]??[];i.push(a),n[s]=i,o.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const r={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))o.has(Number(a))&&(r[a]=s);e.pendingReplyErrorByRequestId.value=r}function Gy(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];pl(o,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function xN(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=Tt(e.liveAgentMessagesByThreadId.value,t))}function kN(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[];pl(o,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function IN(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},qy(e.lastPlanByThreadId.value))}function AN(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[],r=_c(o,n);kN(e,t,r),IN(e,t,n)}function _N(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[],r=_c(o,n);ap(e,t,r)}function PN(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];let r=_c(o,n);const a=Qa(n.text);if(n.role==="assistant"&&a.length>0){const s=r.filter(i=>i.id===n.id||Qa(i.text)!==a);s.length!==r.length&&(r=s)}Gy(e,t,r)}function ap(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[];pl(o,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function EN(e,t,n){const o=e.liveCommandsByThreadId.value[t]??[],r=_c(o,n);r!==o&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:r})}function RN(e,t,n){const o=e.liveCommandsByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(s=>s.id)),a=o.filter(s=>!r.has(s.id));a.length!==o.length&&(a.length===0?e.liveCommandsByThreadId.value=Tt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function MN(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o||o.length===0)return;const r=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=o.filter(l=>!r.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==o.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=Tt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function jN(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...r];s[a]={...s[a],fileChanges:o},ap(e,t,s)}function LN(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...r],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:o}))},ap(e,t,s)}function NN(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let o=-1;for(const r of n)typeof r.turnIndex=="number"&&Number.isFinite(r.turnIndex)&&(o=Math.max(o,r.turnIndex));return o+1}function ON(e,t,n,o){if(!t||!n||!Number.isInteger(o)||o<0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};r[n]!==o&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...r,[n]:o}})}function $N(e,t,n){const o=e.turnIndexByTurnIdByThreadId.value[t]??{},r=Object.entries(o),a=Object.entries(n);r.length===a.length&&r.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function DN(e,t,n){var r;if(!t||!n)return;const o=(r=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:r[n];return typeof o=="number"?o:void 0}function FN(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};let r=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=o[s.turnId];return typeof i!="number"?s:(r=!0,{...s,turnIndex:i})});r&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const iv=8e3,BN=1500,UN=15*60*1e3;function zN(e){let t=_L(),n=!1,o=null;function r(){o===null&&(o=setTimeout(()=>{if(o=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem($y,JSON.stringify(t))}catch{}n&&r()},BN))}function a(d,v){if(!d||e.inProgressById.value[d]!==!0)return;const f=v.length>iv?v.slice(-iv):v;t[d]={text:f,ts:Date.now()},n=!0,r()}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=Tt(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>UN||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f.text}))}function c(d){d&&d in t&&(delete t[d],n=!0,r())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:c}}function HN(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function qN(e,t,n=!1){var l;if(!t)return;const o=e.liveReasoningTextByThreadId.value[t];if(o===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const r=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=r?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[r]:void 0,s=YN(e,t),i=r||void 0;s.length>0?GN(e,t,s,i,a):n||WN(e,t,o,i,a),e.liveReasoningTextByThreadId.value=Tt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function WN(e,t,n,o,r){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:o||void 0,turnIndex:typeof r=="number"?r:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function GN(e,t,n,o,r){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,S=typeof r=="number"?r:f.turnIndex;if(f.text===c&&f.turnIndex===S&&f.reasoningAnchorMessageId===y)continue;s[v]={...f,text:c,reasoning:{summary:[],content:[c]},turnId:o||f.turnId,turnIndex:S,reasoningAnchorMessageId:y};continue}s.some(f=>f.text===c)||s.push({id:d,role:"system",text:c,messageType:"reasoning",reasoning:{summary:[],content:[c]},turnId:o||void 0,turnIndex:typeof r=="number"?r: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 VN(e,t,n,o){if(!t||!o)return;o.trim()&&e.reasoningItemTextByItemId.set(n,o.trim());const r=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(r.endsWith(o)||a&&o===a){e.reasoningAppendedTextByItemId.set(n,o);return}if(a&&o.startsWith(a)){const i=o.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,o);return}const s=r.length>0&&!r.endsWith(`
|
|
72
|
-
`)?`
|
|
73
|
-
|
|
74
|
-
`:"";e.appendLiveReasoningText(t,`${s}${o}`),e.reasoningAppendedTextByItemId.set(n,o)}function KN(e,t){const n=Ve(t.params);if(!n)return;const o=t.method==="item/started"||t.method==="item/completed",r=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!o&&!r)return;const a=Ve(n.item),s=Me(r?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Bn(t);if(!i)return;const l=r||Me(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 YN(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],o=[];let r="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&o.push({text:i,anchorMessageId:r,itemId:s.itemId})}else r=s.itemId;return o}function JN(e,t,n){if(!t||!n)return;const o=e.reasoningItemTextByItemId.get(t)??"";o.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${o}${n}`)}function lv(e){e.reasoningItemTextByItemId.clear()}const kr="gpt-5.4-mini",Vy="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",QN="big-pickle",XN=Yg;function ZN(e){const t=T([]),n=T({}),o=T({}),r=T(EL()),a=T(Od(r.value,e.selectedThreadId.value)),s=T("medium"),i=T("standard"),l=T(""),c=T(""),d=T(!1),v=T({});let f=!1;function y(Ce){if(Wa(Ce)===ha){const xe=Ms(l.value),Re=Lu(xe),Je=Re?wi(r.value[Re]):"";if(Je)return Je}return Od(r.value,Ce).trim()}function S(Ce){const Se=Ce.trim();return Ms(Se?v.value[Se]??l.value:l.value)}function I(Ce){const Se=Ce.trim();return!Se||Wa(Se)===ha?!1:Od(r.value,Se).trim().length>0}function U(Ce){const Se=Ce.trim();if(!Se)return!1;const xe=Wa(Se);return xe===ha?!1:wi(r.value[xe]).length>0}function O(Ce){return n.value[Ce.trim()]??XN}function $(Ce,Se=s.value){const xe=Ce.trim(),Re=O(xe);if(Se&&Re.includes(Se))return Se;if(Re.includes("medium"))return"medium";const Je=o.value[xe];return Je&&Re.includes(Je)?Je:Re[0]??""}function q(Ce){s.value=$(Ce)}function M(Ce){const Se={},xe={};for(const Re of Ce)Re.supportedReasoningEfforts!==null&&(Se[Re.id]=[...Re.supportedReasoningEfforts]),Re.defaultReasoningEffort&&(xe[Re.id]=Re.defaultReasoningEffort);n.value=Se,o.value=xe}function pe(...Ce){const Se=[...t.value];for(const xe of Ce){const Re=xe.trim();Re&&!Se.includes(Re)&&Se.push(Re)}Va(t.value,Se)||(t.value=Se)}function ue(Ce){const Se=Ce.trim();return t.value.length===0||Se&&t.value.includes(Se)?Se:t.value[0]??""}function V(Ce,Se){const xe=Se.trim(),Re=Wa(Ce),Je=Ms(l.value),Xe=Re===ha?Lu(Je):"",at=Xe||Re;if(xe){const ce=Hu(r.value);ce[at]=xe,Xe&&delete ce[Re],r.value=ce}else{let ce=Wl(r.value,at);Xe&&(ce=Wl(ce,Re)),r.value=ce}Re===Wa(e.selectedThreadId.value)?(a.value=y(e.selectedThreadId.value),pe(a.value),q(a.value)):pe(xe),Ou(r.value)}function ie(Ce){V(e.selectedThreadId.value,Ce)}function ye(Ce,Se){const xe=Ce.trim();if(!xe)return;const Re=Se.trim();if(Re){const Je=Hu(r.value);Je[xe]=Re,r.value=Je}else r.value=Wl(r.value,xe);pe(Re),e.selectedThreadId.value===xe&&(a.value=y(e.selectedThreadId.value),q(a.value)),Ou(r.value)}function Pe(Ce,Se){const xe=Ce.trim();if(!xe)return;const Re=Ms(Se);Re?v.value={...v.value,[xe]:Re}:v.value[xe]&&(v.value=Tt(v.value,xe))}function ge(Ce,Se,xe){const Re=Se.trim();if(Ms(xe)!=="opencode-zen")return Re;const Xe=y(Ce).trim();return Xe&&!/^gpt-/i.test(Xe)?Xe:Re&&!/^gpt-/i.test(Re)?Re:QN}async function Z(Ce=e.selectedThreadId.value){var xe;const Se=Ce.trim();Se?(ye(Se,kr),(xe=e.onThreadModelChanged)==null||xe.call(e,Se)):ie(kr),pe(kr)}function me(Ce){Ce&&!O(a.value).includes(Ce)||(f=!0,s.value=Ce)}async function oe(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 iI(Se)}catch(Re){i.value=xe,e.error.value=Re instanceof Error?Re.message:"Failed to update Fast mode"}finally{d.value=!1}}function Ae(Ce,Se,xe){const Re=Ce.trim()||"default",Je=Se||"default",Xe=xe==="plan"?"Plan":"Default",at=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Xe}`,`Model: ${Re}`,`Thinking: ${Je}`,`Speed: ${at}`]}async function De(Ce){c.value="";try{const Se=await dI(),xe=Se.model.trim(),Re=Ms(Se.providerId);l.value=Re;const Je=S(e.selectedThreadId.value),Xe=Je!=="codex"&&Je!=="custom",at=y(e.selectedThreadId.value),ce=await cI({includeProviderModels:Xe||(Ce==null?void 0:Ce.includeProviderModels)!==!1,requireProviderModels:Xe,providerId:Xe?Je:void 0}),N=ce.map(_=>_.id);M(ce);const re=Lu(Je),se=re?wi(r.value[re]):"",je=[...N];!(Ce!=null&&Ce.providerChanged)&&Xe&&Je===Re&&xe&&!je.includes(xe)&&je.push(xe),t.value=je;const qe=at&&N.includes(at);if(!at||!qe||Ce!=null&&Ce.providerChanged?Ce!=null&&Ce.providerChanged&&je.length>0?se&&N.includes(se)?ie(se):Je===Re&&xe&&je.includes(xe)?ie(xe):ie(je[0]):Je===Re&&xe&&je.includes(xe)?ie(Se.model):je.length>0?ie(je[0]):ie(""):a.value.trim()!==at&&ie(at),re&&a.value.trim().length>0){const _=Hu(r.value);_[re]=a.value.trim();const R=Lu(Re);R&&R!==re&&xe&&(_[R]=xe),r.value=_,Ou(r.value)}s.value=$(a.value,f?s.value:"medium"),i.value=Se.speedMode}catch(Se){c.value=_y(Se)?Vy:""}}function Ne(Ce){a.value=ue(y(Ce)),q(a.value)}function Le(Ce){const Se=Ay(r.value,Ce);Se!==r.value&&(r.value=Se,Ne(e.selectedThreadId.value),Ou(Se)),v.value=nn(v.value,Ce)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:c,isUpdatingSpeedMode:d,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:Z,buildPendingTurnDetails:Ae,hasThreadModelSelection:I,hasThreadOwnModelSelection:U,pruneThreadModelState:Le,readModelIdForThread:y,refreshModelPreferences:De,resolveThreadModelForProvider:ge,setSelectedModelId:ie,setSelectedModelIdForThread:V,setSelectedReasoningEffort:me,setThreadModelId:ye,setThreadModelProviderId:Pe,syncSelectedThreadModel:Ne,updateSelectedSpeedMode:oe}}function eO(e){const t=T([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=T(RL()),o=T($d(n.value,e.value));function r(c){const d=c==="plan"?"plan":"default",v=Wa(e.value);$d(n.value,e.value)===d&&o.value===d||(o.value=d,n.value=Xm(n.value,v,d),Bd(n.value))}function a(c,d){const v=d==="plan"?"plan":"default";n.value=Xm(n.value,c,v),c.trim()===e.value&&(o.value=v),Bd(n.value)}function s(c){o.value=$d(n.value,c)}function i(c){const d=Ay(n.value,c);d!==n.value&&(n.value=d,s(e.value),Bd(d))}async function l(){try{const c=await pI();t.value=c,c.some(d=>d.value===o.value)||r("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:o,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:r,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const tO=500;function nO(){const e=T(null),t=T([]),n=K(()=>e.value);let o=null,r=null;function a(c){e.value=c}async function s(){if(r){await r;return}r=(async()=>{try{const c=await tA();a(c),t.value=c?[c]:[]}catch{}finally{r=null}})(),await r}function i(){if(typeof window>"u"){s();return}o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null,s()},tO)}function l(){o===null||typeof window>"u"||(window.clearTimeout(o),o=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function oO(e){const t=T(FL()),n=T(UL());let o=null;function r(f,y={}){t.value=f,y.persist!==!1&&BL(f)}function a(f,y={}){n.value=f,y.persist!==!1&&zL(f)}async function s(f,y){try{const S=await Ki(),I={...S.labels};let U=!1;for(const O of S.order){if(!qu(O,f))continue;const $=y.trim();$.length===0?I[O]!==void 0&&(delete I[O],U=!0):I[O]!==$&&(I[O]=$,U=!0)}U&&await Pd({order:S.order,labels:I,active:S.active,projectOrder:S.projectOrder})}catch{}}function i(f,y){f.length===0||(n.value[f]??"")===y||(a({...n.value,[f]:y}),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,s(f,y)},500))}async function l(){try{const f=await Ki(),y=fL(f,t.value,e.sourceGroups.value);await Pd({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(Va(t.value,y)||r(y),e.sourceGroups.value=e.sourceGroups.value.filter($=>$.projectName!==f),n.value[f]!==void 0){const $={...n.value};delete $[f],a($)}e.applyThreadFlags();const S=Jn(e.projectGroups.value);e.pruneThreadScopedState(S),S.some($=>$.id===e.selectedThreadId.value)||e.setSelectedThreadId(((O=S[0])==null?void 0:O.id)??"");const U=new Set;try{const $=await Ki();dL($,f).forEach(q=>{U.add(q)})}catch{}if(U.size>0)try{const $=await Ki(),q=$.order.filter(ue=>!U.has(ue)),M=$.active.filter(ue=>!U.has(ue)),pe=M.length===0&&q.length>0?[q[0]]:M;await Pd({order:q,labels:rL($.labels,U),active:pe,projectOrder:$.projectOrder.filter(ue=>ue!==f&&!U.has(ue))});return}catch{}await l()}function d(f,y){if(f.length===0||e.sourceGroups.value.length===0)return;const S=e.sourceGroups.value.map(q=>q.projectName),I=S.indexOf(f);if(I===-1)return;const U=Math.max(0,Math.min(y,S.length-1)),O=qj(S,I,U);if(O===S)return;r(Vi(O,e.sourceGroups.value));const $=mf(e.sourceGroups.value,t.value);e.sourceGroups.value=ic(e.sourceGroups.value,$),e.applyThreadFlags(),l()}function v(f){const y=f.trim();if(!y)return;const S=[y,...t.value.filter(U=>U!==y)];if(Va(t.value,S))return;r(S);const I=mf(e.sourceGroups.value,t.value);e.sourceGroups.value=ic(e.sourceGroups.value,I),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:v,removeProject:c,renameProject:i,reorderProject:d,setProjectDisplayNames:a,setProjectOrder:r}}const rO=2e3;function aO(e){const t=T([]),n=T([]),o=T(!1);let r=null,a=null,s=!1,i=!1,l=0,c="";async function d(f={}){const y=e.getSelectedCwd().trim(),S=y||"__global__";if(r){await r;return}f.force!==!0&&s&&c===S&&Date.now()-l<rO||(r=(async()=>{try{t.value=await zI(y?[y]:void 0),s=!0,l=Date.now(),c=S}catch{}finally{r=null}})(),await r)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(o.value=!0,a=(async()=>{try{n.value=await vI(),i=!0}catch{}finally{o.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:o,refreshHooks:v,refreshSkills:d}}const Ky="codex-web-local.stashed-messages.v1",Yy="codex-web-local.auto-compact-threshold.v1",$u=10,sO=650;function iO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ky);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[o]=a)}return n}catch{return{}}}function lO(){if(typeof window>"u")return $u;try{const e=window.localStorage.getItem(Yy);if(e===null)return $u;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):$u}catch{return $u}}function uO(e){const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();!r||o.length===0||(t[r]=o.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=T({}),n=T({}),o=T(iO()),r=T(lO());let a=!1;const s=K(()=>{const V=e.value;if(!V)return[];const ie=t.value[V]??[];return[...(o.value[V]??[]).map(ge=>({...ge,awaitingCompaction:!0})),...ie]});function i(){typeof window>"u"||window.localStorage.setItem(Ky,JSON.stringify(o.value))}function l(){AI(uO(t.value)).catch(()=>{})}async function c(){if(!a){a=!0;try{t.value=await Cm()}catch{}}}async function d(V){if(n.value[V]!==!0){n.value={...n.value,[V]:!0};try{t.value=await Cm()}catch{}finally{n.value=Tt(n.value,V)}}}function v(V){d(V),!(typeof window>"u")&&window.setTimeout(()=>{d(V)},sO)}function f(V){const ie=Number.isFinite(V)&&V>0?Math.round(V):0;ie!==r.value&&(r.value=ie,!(typeof window>"u")&&window.localStorage.setItem(Yy,String(ie)))}function y(V){return o.value[V]??[]}function S(V,ie){o.value={...o.value,[V]:[...y(V),ie]},i()}function I(V){const ie=[...y(V)];return ie.length===0||(o.value=Tt(o.value,V),i()),ie}function U(V,ie,ye){const ge=[...t.value[V]??[]],Z=typeof ye=="number"?Math.max(0,Math.min(ye,ge.length)):ge.length;ge.splice(Z,0,ie),t.value={...t.value,[V]:ge},l()}function O(V,ie){return y(V).find(ye=>ye.id===ie)}function $(V,ie){var ye;return(ye=t.value[V])==null?void 0:ye.find(Pe=>Pe.id===ie)}function q(V){const ie=e.value;if(!ie)return;if(O(ie,V)){const ge=y(ie).filter(Z=>Z.id!==V);o.value=ge.length>0?{...o.value,[ie]:ge}:Tt(o.value,ie),i();return}const ye=t.value[ie];if(!ye)return;const Pe=ye.filter(ge=>ge.id!==V);t.value=Pe.length>0?{...t.value,[ie]:Pe}:Tt(t.value,ie),l()}function M(V,ie){const ye=e.value;if(!ye)return;const Pe=t.value[ye];if(!Pe||O(ye,V)||O(ye,ie))return;const ge=Pe.findIndex(Ae=>Ae.id===V),Z=Pe.findIndex(Ae=>Ae.id===ie);if(ge<0||Z<0||ge===Z)return;const me=[...Pe],[oe]=me.splice(ge,1);me.splice(Z,0,oe),t.value={...t.value,[ye]:me},l()}function pe(V){const ie=nn(t.value,V);ie!==t.value&&(t.value=ie,l())}function ue(){t.value={},n.value={},o.value={},i(),l()}return{appendStashedMessage:S,autoCompactThreshold:r,clearQueueState:ue,enqueueQueuedMessage:U,findQueuedMessage:$,findStashedMessage:O,getStashedMessages:y,loadPersistedQueueStateIfNeeded:c,processQueuedMessages:d,pruneQueueState:pe,removeQueuedMessage:q,reorderQueuedMessage:M,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:I}}const dO=1e4,fO=2e3;function pO(e){const{selectedThreadId:t,projectGroups:n,inProgressById:o,applyThreadGroups:r,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:c}=e,d=T(!1),v=T(!1),f=T(!1);let y=null,S=0,I=null,U=null,O=!1,$=!1,q=[],M=null;function pe(me,oe){if(me.length===0)return oe;if(oe.length===0)return me;const Ae=new Map;for(const Ne of Jn(me))Ae.set(Ne.id,Ne);for(const Ne of Jn(oe))Ae.set(Ne.id,Ne);const De=new Map;for(const Ne of Ae.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,Re;const Ce=new Date(((xe=Ne.threads[0])==null?void 0:xe.updatedAtIso)??0).getTime();return new Date(((Re=Le.threads[0])==null?void 0:Re.updatedAtIso)??0).getTime()-Ce})}function ue(){return Object.values(o.value).some(me=>me===!0)}function V(me=M){if(!(!I||O||ue())){if(M=me,typeof window>"u"){ie(me);return}U!==null&&window.clearTimeout(U),U=window.setTimeout(()=>{U=null,!(!I||ue())&&ie(M)},dO)}}async function ie(me){if(!(O||!I||ue())){O=!0;try{const oe=await dm(I,CI());I=oe.nextCursor,$=oe.nextCursor===null,f.value=$,q=pe(q,oe.groups),r(q,me)}catch{}finally{O=!1,I&&!ue()&&V(me)}}}async function ye(me={}){if(y){await y;return}me.force!==!0&&d.value&&Date.now()-S<fO||(y=(async()=>{var oe;d.value||(v.value=!0);try{const[Ae,De]=await Promise.all([dm(),i(),s({force:me.force===!0})]);M=De;const Ne=Ae.groups;q=Ne,I=Ae.nextCursor,$=Ae.nextCursor===null,f.value=$,await a(Ne,De),r(q,De),d.value=!0,S=Date.now(),$||V(De);const Le=Jn(n.value);l(Le),!Le.some(Se=>Se.id===t.value)&&!t.value&&c(((oe=Le[0])==null?void 0:oe.id)??"")}finally{v.value=!1}})().finally(()=>{y=null}),await y)}function Pe(me){q=Ry(q,me)}function ge(){return I!==null}function Z(){U!==null&&typeof window<"u"&&(window.clearTimeout(U),U=null)}return{dispose:Z,hasActiveInProgressThreads:ue,hasLoadedThreads:d,hasRemainingThreadPages:ge,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:ye,removeThreadFromLoadedLists:Pe,scheduleRemainingThreadPages:V}}const uv=2e3;function hO(e){const t=T({}),n=T({}),o=T({}),r=T({}),a=T(!1),s=5e3,i=T(null);let l=0,c=null;function d(){l&&(clearTimeout(l),l=0),c=null,i.value=null}function v(M){d(),c=M,l=window.setTimeout(()=>{l=0,i.value=c},s)}const f=new Map,y=new Map,S=new Map;let I=0;async function U(M,pe={}){var ge;if(!M)return;const ue=Date.now()-(S.get(M)??0)<uv;if((ge=e.turnErrorByThreadId.value[M])!=null&&ge.transient&&(pe.silent===!0||ue))return;const V=f.get(M);if(V&&pe.force!==!0){await V;return}const ie=n.value[M]===!0,ye=pe.silent!==!0&&!ie;ye&&(I+=1,a.value=!0),v(M);const Pe=(async()=>{try{const Z=e.currentThreadVersion(M),me=t.value[M]??"",oe=Date.now()-(y.get(M)??0)<uv;if(pe.force===!0?!1:ie&&(oe||(Z.length===0||me===Z)&&e.inProgressById.value[M]!==!0)){e.markThreadAsRead(M);return}const Ne=e.resumedThreadById.value[M]!==!0?await cf(M):null,Le=Ne??await uf(M);Le.modelProvider&&e.setThreadModelProviderId(M,Le.modelProvider),Le.model&&!e.hasThreadOwnModelSelection(M)&&e.setThreadModelId(M,e.resolveThreadModelForProvider(M,Le.model,Le.modelProvider)),Ne&&(e.resumedThreadById.value={...e.resumedThreadById.value,[M]:!0});const{messages:Ce,inProgress:Se,activeTurnId:xe,turnIndexByTurnId:Re}=Le,Je=e.persistedMessagesByThreadId.value[M]??[],Xe=Ce.length===0&&Je.length>0;Xe&&console.warn(`[thread-load] ${M}: server returned 0 messages while ${Je.length} are persisted locally; keeping local history`),o.value={...o.value,[M]:Le.hasMoreOlder===!0},e.markThreadMessagesPersisted(M,Ce),Xe||e.replaceTurnIndexLookupForThread(M,Re),e.rebindLiveFileChangeTurnIndices(M);const at=ev(Je,Ce,{preserveMissing:pe.silent===!0||Yj(Je)||Xe});e.setPersistedMessagesForThread(M,at);const ce=e.liveAgentMessagesByThreadId.value[M]??[];if(Se){const N=Qj(ce,Ce);e.setLiveAgentMessagesForThread(M,N)}else e.clearLiveAgentMessagesForThread(M);e.removeLiveCommandsPersistedIn(M,Ce),e.removeLiveFileChangesPersistedIn(M,Ce),n.value={...n.value,[M]:!0},y.set(M,Date.now()),S.delete(M),Z&&(t.value={...t.value,[M]:Z}),e.setThreadInProgress(M,Se),Le.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[M]:Le.externalSession}),e.clearTransientTurnErrorForThread(M),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[M]:xe}:e.activeTurnIdByThreadId.value[M]&&(e.activeTurnIdByThreadId.value=Tt(e.activeTurnIdByThreadId.value,M)),Se||e.clearCompletedTurnLiveState(M),e.markThreadAsRead(M)}catch(Z){const me=Z instanceof Error?Z.message:"Unknown application error";throw e.selectedThreadId.value===M&&e.setTurnErrorForThread(M,me,{transient:!0}),S.set(M,Date.now()),Z}finally{ye&&(I=Math.max(0,I-1),I===0&&(a.value=!1))}})().finally(()=>{c===M&&d(),f.delete(M)});f.set(M,Pe),await Pe}async function O(M=e.selectedThreadId.value){if(!M||r.value[M]===!0||o.value[M]!==!0)return;const pe=e.getFirstPersistedTurnId(M);if(!pe){o.value={...o.value,[M]:!1};return}r.value={...r.value,[M]:!0};try{const ue=await Jk(M,pe),V=e.persistedMessagesByThreadId.value[M]??[],ie=ev(ue.messages,V,{preserveMissing:!0});e.setPersistedMessagesForThread(M,ie),e.replaceTurnIndexLookupForThread(M,{...e.turnIndexByTurnIdByThreadId.value[M]??{},...ue.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(M),o.value={...o.value,[M]:ue.hasMoreOlder}}catch(ue){throw ue instanceof Oo&&ue.code==="older_turns_unavailable"&&(o.value={...o.value,[M]:!1}),e.error.value=ue instanceof Error?ue.message:"Failed to load earlier messages",ue}finally{r.value={...r.value,[M]:!1}}}async function $(M,pe={}){var ue;M&&n.value[M]!==!0&&(pe.silent===!0&&((ue=e.turnErrorByThreadId.value[M])!=null&&ue.transient)||await U(M,pe))}function q(M){n.value=nn(n.value,M),t.value=nn(t.value,M)}return{ensureThreadMessagesLoaded:$,hasMoreOlderMessagesByThreadId:o,isLoadingMessages:a,loadMessages:U,loadOlderMessages:O,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:r,pruneMessageHistoryState:q,slowOpenThreadId:i}}function mO(e){const t=T({});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:Ns(c.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(c=>{const d=i[c.id];return{...c,title:Ns(d??c.title)}})}))}async function o(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await RI();if(Object.keys(i.titles).length>0){const l={};for(const[c,d]of Object.entries(i.titles))l[c]=Ns(d);t.value=l}}catch{}}function r(s,i,l){const c=s.trim();if(c)return Ns(c);const d=l.map(v=>v.label.trim()).find(v=>v.length>0);return d?Ns(d):i.length>0?Ns("[Image]"):"Untitled thread"}async function a(s,i,l,c=[],d=[]){if(t.value[s])return;const v=i.trim();if(!v){const y=r(i,c,d);t.value={...t.value,[s]:y},e.applyThreadFlags(),rc(s,y);return}const f=v.length>300?v.slice(0,300):v;try{const y=await BI(f,l);if(!y||t.value[s])return;const S=y.length>wf?y.slice(0,wf):y;t.value={...t.value,[s]:S},e.applyThreadFlags(),rc(s,S)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:o,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:r,threadTitleById:t}}function vO(e){const t=T({}),n=T({});function o(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function r(S){bN(o(),S)}function a(S){TN(o(),S)}function s(S){CN(o(),S)}function i(S){return SN(o(),S)}const l=K(()=>{const S=[],I=e.getSelectedThreadId();return I&&Array.isArray(t.value[I])&&S.push(...t.value[I]),Array.isArray(t.value[rl])&&S.push(...t.value[rl]),S.sort((U,O)=>U.receivedAtIso.localeCompare(O.receivedAtIso))});function c(S){return S?Array.isArray(t.value[S])?t.value[S]:[]:[]}function d(S){return S.some(I=>dN(I.method))?"approval":S.length>0?"response":null}function v(S){const I={};for(const[U,O]of Object.entries(t.value))(U===rl||S.has(U))&&(I[U]=O);t.value=I}async function f(){try{const I=(await Sm()).map(U=>Wy(U)).filter(U=>U!==null);s(I)}catch{}}async function y(S){try{const I=await Sm();for(const U of I){const O=Ve(U);if((O==null?void 0:O.id)===S)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:r}}const Du=220,gO=3e3,yO=1500,wO=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 bO(e,t){if(t.length===0)return e;const n=new Set(e.map(s=>s.id)),o=new Map,r=[];for(const s of t){const i=s.modelSwitchInsertAfterId;if(i&&n.has(i)){const l=o.get(i)??[];l.push(s),o.set(i,l)}else r.push(s)}const a=[];for(const s of e){a.push(s);const i=o.get(s.id);i&&i.length>0&&a.push(...i)}return r.length>0&&a.push(...r),a}function TO(){const e=T([]),t=T([]),n=T($L()),o=T(""),r=T({}),a=T({}),s=T(AL()),i=T({}),l=T({}),c=T(kL()),d=T(IL()),v=T({}),f=new Map,y=new Map,S=new Map,I=new Map,U=T({}),O=T({}),$=T({}),M=zN({liveReasoningTextByThreadId:v,inProgressById:$}),pe=T({});let ue=!1;const V=T({}),{activeProviderId:ie,availableModelIds:ye,availableModelReasoningEfforts:Pe,codexCliMissingError:ge,isUpdatingSpeedMode:Z,selectedModelId:me,selectedReasoningEffort:oe,selectedSpeedMode:Ae,applyFallbackModelSelection:De,buildPendingTurnDetails:Ne,hasThreadModelSelection:Le,hasThreadOwnModelSelection:Ce,pruneThreadModelState:Se,readModelIdForThread:xe,refreshModelPreferences:Re,resolveThreadModelForProvider:Je,setSelectedModelId:Xe,setSelectedModelIdForThread:at,setSelectedReasoningEffort:ce,setThreadModelId:N,setThreadModelProviderId:re,syncSelectedThreadModel:se,updateSelectedSpeedMode:je}=ZN({selectedThreadId:n,error:o,onThreadModelChanged:h=>Ia(h)}),{availableCollaborationModes:qe,selectedCollaborationMode:_,pruneThreadCollaborationState:R,refreshCollaborationModes:H,setSelectedCollaborationMode:le,setSelectedCollaborationModeForThread:ne,syncSelectedThreadCollaborationMode:ae}=eO(n),_e=T(xL()),Oe=T(PL()),{projectDisplayNameById:Ie,projectOrder:he,pinProjectToTop:Ke,removeProject:$e,renameProject:We,reorderProject:Ge,setProjectDisplayNames:dt,setProjectOrder:wt}=oO({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:fn,pruneThreadScopedState:gr,setSelectedThreadId:_n}),tt=T({}),st=T({}),Y=T({}),de=T({}),Te=T({}),ze=T({}),bt=hO({selectedThreadId:n,error:o,persistedMessagesByThreadId:r,liveAgentMessagesByThreadId:i,inProgressById:$,externalSessionByThreadId:pe,resumedThreadById:tt,turnIndexByTurnIdByThreadId:st,turnErrorByThreadId:Te,activeTurnIdByThreadId:ze,markThreadAsRead:is,markThreadMessagesPersisted:xi,replaceTurnIndexLookupForThread:C,rebindLiveFileChangeTurnIndices:x,setPersistedMessagesForThread:Vn,setLiveAgentMessagesForThread:yr,clearLiveAgentMessagesForThread:Aa,removeLiveCommandsPersistedIn:_a,removeLiveFileChangesPersistedIn:na,setThreadInProgress:pn,setThreadModelProviderId:re,setThreadModelId:N,resolveThreadModelForProvider:Je,hasThreadOwnModelSelection:Ce,clearTransientTurnErrorForThread:cs,clearCompletedTurnLiveState:Ai,setTurnErrorForThread:jt,getFirstPersistedTurnId:Gs,currentThreadVersion:Gn}),{ensureThreadMessagesLoaded:yt,hasMoreOlderMessagesByThreadId:$t,isLoadingMessages:Lr,loadMessages:Qt,loadOlderMessages:ur,loadedMessagesByThreadId:eo,loadedVersionByThreadId:ga,loadingOlderMessagesByThreadId:cr,pruneMessageHistoryState:qs,slowOpenThreadId:ya}=bt,Za=mO({applyThreadFlags:fn}),{threadTitleById:$o,applyCachedTitlesToGroups:es,loadThreadTitleCacheIfNeeded:Do,requestThreadTitleGeneration:Nr}=Za,Or=vO({applyThreadFlags:fn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Ws,loadPendingServerRequestsFromBridge:$r,pendingReplyErrorByRequestId:Fo,pendingReplyErrorForRequest:ts,pendingRequestStillExistsOnServer:wa,pendingServerRequestsByThreadId:Dr,prunePendingServerRequestsByActiveThreads:dr,readPendingRequestState:fr,removePendingServerRequestById:xo,selectedThreadServerRequests:ns,upsertPendingServerRequest:os}=Or,vt={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:c,turnIndexByTurnIdByThreadId:st,activeTurnIdByThreadId:ze,activeReasoningTurnIdByThreadId:I,reasoningItemTextByItemId:y,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:S,appendLiveReasoningText:(h,g)=>M.appendLiveReasoningText(h,g),clearLiveReasoningSnapshot:h=>M.clearLiveReasoningSnapshot(h),savePersistedReasoningMap:Fd},xt=T({}),It=T({}),cn=T({}),qn=T({}),sn=T({}),{accountRateLimitSnapshots:ko,codexQuota:po,refreshRateLimits:Fr,scheduleRateLimitRefresh:ln,setCodexRateLimit:to,stopRateLimitRefresh:Io}=nO(),Et=T(ML()),pr=T(NL()),no=T(jL()),gn=T({}),Bo=T(!1),Ln=T(!1),In=T(!1),yn=T(new Set),ba=6e4,ho=T([]);let Uo="";const Ft=T(!1);function hr(h){var g;try{const A=new URL(h,"http://localhost");return A.pathname!=="/codex-local-image"?"":((g=A.searchParams.get("path"))==null?void 0:g.trim())??""}catch{return""}}function Br(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 Ur(h){var A;const g=r.value[h]??[];for(let L=g.length-1;L>=0;L-=1){const z=g[L];if(!(z.role!=="user"||!Array.isArray(z.images)||z.images.length===0))for(let X=z.images.length-1;X>=0;X-=1){const W=((A=z.images[X])==null?void 0:A.trim())??"";if(W&&hr(W))return W}}return""}let wn=null,Yt=null;const mo=new Map;let un=!1,zr=!1;const Xt=new Set,zo=new Set;let Ta=!1,Wt=!1;const Hr=new Map,qr=new Set,At=pO({selectedThreadId:n,projectGroups:e,inProgressById:$,applyThreadGroups:Qs,hydrateWorkspaceRootsStateIfNeeded:ra,loadThreadTitleCacheIfNeeded:Do,loadWorkspaceRootsStateForThreadList:Nn,pruneThreadScopedState:gr,setSelectedThreadId:_n}),bn=K(()=>Jn(e.value)),Wr=K(()=>bn.value.find(h=>h.id===n.value)??null),{appendStashedMessage:Ao,autoCompactThreshold:_o,clearQueueState:Gr,enqueueQueuedMessage:Ho,findQueuedMessage:Vr,findStashedMessage:oo,getStashedMessages:mr,loadPersistedQueueStateIfNeeded:Kr,pruneQueueState:Po,removeQueuedMessage:ht,reorderQueuedMessage:An,scheduleQueueStateRefresh:Tn,selectedThreadQueuedMessages:Sa,setAutoCompactThreshold:Wn,takeStashedMessages:k}=cO(n),{hooksList:j,installedSkills:G,isHooksLoading:be,refreshHooks:He,refreshSkills:Mt}=aO({getSelectedCwd:()=>{var h;return((h=Wr.value)==null?void 0:h.cwd)??""}}),_t=K(()=>{const h=n.value;return!!(h&&pr.value[h]===!0)}),Zt=K(()=>{const h=n.value;return h?xt.value[h]===!0:!1}),Gt=K(()=>{const h=n.value;return h?ze.value[h]??"":""}),qo=K(()=>{var ee;const h=n.value;if(!h)return null;const g=$.value[h]===!0,A=g?de.value[h]:void 0,L=g?(v.value[h]??"").trim():"",z=(((ee=Te.value[h])==null?void 0:ee.message)??"").trim();let X="";if(!g&&z){const fe=r.value[h]??[];for(let ke=fe.length-1;ke>=0;ke-=1){const Fe=fe[ke];if(Fe.messageType==="turnError"){X=Qa(Fe.text);break}}}const W=!g&&z&&X===z?"":z;return!g&&!A&&!L&&!W?null:{activityLabel:(A==null?void 0:A.label)||"Thinking",activityDetails:(A==null?void 0:A.details)??[],reasoningText:L,errorText:W}}),Ca=K(()=>{const h=n.value;return h?Et.value[h]??null:null}),rs=K(()=>{const h=n.value;if(!h)return[];const g=r.value[h]??[],A=a.value[h]??[],L=i.value[h]??[],z=U.value[h]??[],X=O.value[h]??[],W=l.value[h]??[],ee=c.value[h]??[],fe=g.some(Sn=>Sn.messageType==="compaction.done"),ke=yn.value.has(h),Fe=fe&&!ke?W.filter(Sn=>Sn.messageType!=="compaction.pending"&&Sn.messageType!=="compaction.done"):W,it=SL(h,g,ee,[A,z,X,L],Fe),mt=Y.value[h],lt=mt?nL(it,mt):it,St=oL(lt,d.value[h]),Vt=no.value[h]??[];return bO(St,Vt)}),dn=K(()=>{const h=n.value;return h?qn.value[h]??null:null}),xa=K(()=>{const h=n.value;return h?$t.value[h]===!0:!1}),ka=K(()=>{const h=n.value;return h?cr.value[h]===!0:!1});function Gs(h){var A;const g=r.value[h]??[];for(const L of g){const z=((A=L.turnId)==null?void 0:A.trim())??"";if(z)return z}return""}function _n(h,g={}){n.value!==h&&(n.value=h,g.persist!==!1&&DL(h),se(h),ae(h),Wt=!1)}function as(h,g){const A=h.trim();if(!A)return;if(!g){if(!(A in Et.value))return;Et.value=Tt(Et.value,A),Ud(Et.value);return}const L=Et.value[A];if(L&&JSON.stringify(L)===JSON.stringify(g))return;Et.value={...Et.value,[A]:g},Ud(Et.value);const z=mr(A);z&&z.length>0&&_o.value>0&&(g.remainingContextPercent!==null&&g.remainingContextPercent<=_o.value?yn.value.has(A)||Tr(A):br(A))}function Vs(h,g){sn.value={...sn.value,[h]:g}}function ss(h,g,A){var mt;const L=h.trim(),z=g.trim(),X=A.trim();if(!L||!X||z===X)return;const W=no.value[L]??[],ee=r.value[L]??[],fe=ee.length,ke=gn.value[L],Fe=W.length>0&&ke!==void 0&&ke===fe;let it;if(Fe){const lt=W[W.length-1];it=[...W.slice(0,-1),{...lt,modelSwitchFrom:z||void 0,modelSwitchTo:X}]}else{const lt=(mt=ee[ee.length-1])==null?void 0:mt.id,St={id:`model-switch:${L}:${Date.now()}:${W.length}`,role:"system",text:"",messageType:Cy,modelSwitchFrom:z||void 0,modelSwitchTo:X,...lt?{modelSwitchInsertAfterId:lt}:{}};it=[...W,St].slice(-xy)}no.value={...no.value,[L]:it},gn.value={...gn.value,[L]:fe},LL(no.value)}function Ia(h){const g=h.trim(),A=Et.value[g];A&&A.modelContextWindow!==null&&(Et.value={...Et.value,[g]:{...A,modelContextWindow:null,remainingContextTokens:null,remainingContextPercent:null}},Ud(Et.value))}function Yr(h){sn.value[h]&&(sn.value=Tt(sn.value,h))}async function en(h){var A,L;if(qr.has(h))return;const g=sn.value[h];if(!(!g||g.fallbackRetried)){qr.add(h),Vs(h,{...g,fallbackRetried:!0});try{await De(h);try{const z=((L=(A=(r.value[h]??[]).reduce((X,W)=>{const ee=typeof W.turnIndex=="number"?W.turnIndex:-1,fe=X!==null&&typeof X.turnIndex=="number"?X.turnIndex:-1;return ee>=0&&ee>fe?W:X},null))==null?void 0:A.turnId)==null?void 0:L.trim())??"";if(z){const X=await Id(h,z);Vn(h,X),ea(h),yr(h,[]),Jo(h),U.value[h]&&(U.value=Tt(U.value,h))}}catch{}if(jt(h,null),o.value="",rn(h,null),Pt(h,{label:"Thinking",details:Ne(kr,g.effort,g.collaborationMode)}),pn(h,!0),tt.value[h]!==!0){const z=await cf(h);z.model&&N(h,Je(h,z.model,z.modelProvider)),z.modelProvider&&re(h,z.modelProvider),tt.value={...tt.value,[h]:!0}}await Ad(h,g.text,g.imageUrls,kr,g.effort||void 0,g.skills.length>0?g.skills:void 0,g.fileAttachments,g.collaborationMode),ln(),Xt.add(h),await $n()}catch(z){const X=z instanceof Error?z.message:"Unknown application error";jt(h,X),o.value=X,pn(h,!1),Pt(h,null)}finally{qr.delete(h)}}}function Jr(h){if(!h||typeof window>"u")return;const g=mo.get(h);g!==void 0&&(window.clearTimeout(g),mo.delete(h))}function Wo(h){if(!h||typeof window>"u")return;Jr(h);const g=window.setTimeout(()=>{mo.delete(h),Xt.add(h),$n()},gO);mo.set(h,g)}function fn(){const g=es(t.value).map(A=>({projectName:A.projectName,threads:A.threads.map(L=>{const z=pe.value[L.id]??L.externalSession??null,X=$.value[L.id]===!0||(z==null?void 0:z.active)===!0,W=fr(Ws(L.id)),ee=n.value===L.id,fe=V.value[L.id]===!0,ke=zj(L.updatedAtIso,_e.value[L.id],Oe.value);return{...L,inProgress:X,unread:!ee&&!X&&(fe||ke),pendingRequestState:W,...z?{externalSession:z}:{}}})}));e.value=ic(e.value,g)}function vr(h,g,A){const L=new Date().toISOString(),z=Ze(g),X=ar(z),W={id:h,title:Ns(A),projectName:X,cwd:z,hasWorktree:z.includes("/.codex/worktrees/")||z.includes("/.git/worktrees/"),createdAtIso:L,updatedAtIso:L,preview:A,unread:!1,inProgress:!1},ee=t.value.findIndex(ke=>ke.projectName===X);if(ee>=0){const Fe=t.value[ee].threads.filter(lt=>lt.id!==h),it={projectName:X,threads:[W,...Fe]},mt=[...t.value];mt.splice(ee,1,it),t.value=mt}else t.value=[{projectName:X,threads:[W]},...t.value];const fe=Vi(he.value,t.value);Va(he.value,fe)||wt(fe),fn()}function gr(h){const g=new Set(h.map(z=>z.id)),A=n.value.trim();A&&g.add(A),Se(g),R(g);const L=nn(_e.value,g);if(L!==_e.value&&(_e.value=L,rv(L)),qs(g),tt.value=nn(tt.value,g),st.value=nn(st.value,g),r.value=nn(r.value,g),i.value=nn(i.value,g),v.value=nn(v.value,g),U.value=nn(U.value,g),O.value=nn(O.value,g),Y.value=nn(Y.value,g),de.value=nn(de.value,g),Te.value=nn(Te.value,g),ze.value=nn(ze.value,g),I.size>0)for(const z of[...I.keys()])g.has(z)||I.delete(z);wL(g),xt.value=nn(xt.value,g),It.value=nn(It.value,g),cn.value=nn(cn.value,g),Po(g),Et.value=nn(Et.value,g),V.value=nn(V.value,g),$.value=nn($.value,g),dr(g)}function is(h){const g=Jn(t.value).find(A=>A.id===h);g&&(_e.value={..._e.value,[h]:g.updatedAtIso},rv(_e.value),V.value[h]&&(V.value=Tt(V.value,h)),fn())}function rn(h,g){if(!h)return;const A=Y.value[h];if(g){if(Zj(A,g))return;Y.value={...Y.value,[h]:g}}else A&&(Y.value=Tt(Y.value,h))}function Ci(h,g,A){if(!h||!g)return;const L={...d.value[h]??{}},z=Number.isFinite(A)?Math.max(0,Math.round(A)):0;z<=0?delete L[g]:L[g]=z,Object.keys(L).length===0?d.value=Tt(d.value,h):d.value={...d.value,[h]:L},av(d.value)}function pn(h,g,A={}){!h||$.value[h]===!0===g||(g?($.value={...$.value,[h]:!0},Ii(h)):($.value=Tt($.value,h),Ai(h,{keepLiveCommands:A.keepDeferredLiveCommands===!0}),Ks(h),ws(h)?Tr(h):br(h)),fn(),!g&&!At.hasActiveInProgressThreads()&&At.hasRemainingThreadPages()&&At.scheduleRemainingThreadPages())}function Ks(h){h&&(xt.value[h]&&(xt.value=Tt(xt.value,h)),It.value[h]&&(It.value=Tt(It.value,h)),cn.value[h]&&(cn.value=Tt(cn.value,h)))}function ro(h){h&&(xt.value={...xt.value,[h]:!0},It.value[h]&&(It.value=Tt(It.value,h)),cn.value[h]&&(cn.value=Tt(cn.value,h)))}function ls(h){h&&xt.value[h]===!0&&It.value[h]===!0&&cn.value[h]===!0&&Ks(h)}function us(h,g){!h||!g||xt.value[h]===!0&&Ks(h)}function ml(h){const g=Object.keys(xt.value);if(g.length===0)return;let A=It.value,L=!1;for(const z of g)!h.has(z)||A[z]===!0||(A={...A,[z]:!0},L=!0);if(L){It.value=A;for(const z of g)ls(z)}}function xi(h,g){h&&xt.value[h]===!0&&g.some(A=>A.role==="user")&&(cn.value[h]!==!0&&(cn.value={...cn.value,[h]:!0}),ls(h))}function Ys(h){h&&h!==n.value&&V.value[h]!==!0&&(V.value={...V.value,[h]:!0},fn())}function Pt(h,g){if(!h)return;const A=de.value[h];if(!g){A&&(de.value=Tt(de.value,h));return}const L=Qo(g.label)||"Thinking",z=g.details.map(ee=>Qo(ee)).filter(ee=>ee.length>0&&ee!==L),X=Array.from(new Set([...(A==null?void 0:A.details)??[],...z])).slice(-3),W={label:L,details:X};eL(A,W)||(de.value={...de.value,[h]:W})}function jt(h,g,A={}){if(!h)return;const L=Te.value[h],z=g?Qa(g):"";if(!z){L&&(Te.value=Tt(Te.value,h));return}const X=A.transient===!0;(L==null?void 0:L.message)===z&&L.transient===X||(Te.value={...Te.value,[h]:{message:z,transient:X}})}function cs(h){var g;h&&(g=Te.value[h])!=null&&g.transient&&jt(h,null)}function Eo(){const h=Object.entries(Te.value).filter(([,A])=>A==null?void 0:A.transient).map(([A])=>A);if(h.length===0)return;let g=Te.value;for(const A of h)g=Tt(g,A);Te.value=g}function Gn(h){const g=Jn(t.value).find(A=>A.id===h);return(g==null?void 0:g.updatedAtIso)??""}function Go(h,g){if(!h)return;const A={...pr.value};g?A[h]=!0:delete A[h],pr.value=A,OL(A)}function Qr(){const h=n.value;h&&Go(h,!_t.value)}function Vn(h,g){const A=r.value[h]??[];pl(A,g)||(r.value={...r.value,[h]:g})}function Xr(h,g,A=[],L=[],z=[]){const X=r.value[h]??[],W={id:`optimistic-user:${h}:${Date.now()}`,role:"user",text:g,images:A.length>0?[...A]:void 0,skills:L.length>0?L.map(ee=>({name:ee.name,path:ee.path})):void 0,fileAttachments:z.length>0?z.map(ee=>({...ee})):void 0,messageType:"userMessage.optimistic"};Vn(h,[...X,W])}function yr(h,g){Gy(ao,h,g)}function Aa(h){xN(ao,h)}function Zr(h,g){AN(ao,h,g)}function Vo(h,g){PN(ao,h,g)}function Ko(h,g){_N(ao,h,g)}function Yo(h,g){M.setLiveReasoningText(h,g)}function ki(h,g){M.appendLiveReasoningText(h,g)}function Ii(h){M.restoreLiveReasoningSnapshot(h)}function ds(h){HN(vt,h)}function Jo(h,g=!1){qN(vt,h,g)}function ea(h){h&&h in a.value&&(a.value=Tt(a.value,h))}function fs(h){h&&h in O.value&&(O.value=Tt(O.value,h))}function ps(h){h&&(zo.delete(h),U.value[h]&&(U.value=Tt(U.value,h)))}function Ai(h,g={}){if(!h)return;ea(h);const A=s.value[h];if(A&&A.messageType==="plan.live"){const L={...A,messageType:"plan",plan:A.plan?{...A.plan,isStreaming:!1}:A.plan};s.value={...s.value,[h]:L},qy(s.value)}Jo(h),gL(h),Pt(h,null),n.value,g.keepLiveCommands===!0&&U.value[h]?zo.add(h):ps(h),ze.value[h]&&(ze.value=Tt(ze.value,h)),Yr(h)}function Js(h){if(!h)return;const g=h===n.value;pn(h,!1,{keepDeferredLiveCommands:g}),!(!g||typeof window>"u")&&window.setTimeout(()=>{zo.has(h)&&$.value[h]!==!0&&ps(h)},yO)}function hs(h){var ke;if(h.method!=="turn/plan/updated")return null;const g=Ve(h.params),A=Bn(h),L=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),X=(Array.isArray(g==null?void 0:g.plan)?g==null?void 0:g.plan:[]).map(Fe=>Ve(Fe)).map(Fe=>({step:Me(Fe==null?void 0:Fe.step),status:HL(Fe==null?void 0:Fe.status)})).filter(Fe=>Fe.step.length>0);if(!A||!L)return null;const ee={explanation:Me(g==null?void 0:g.explanation).trim()||void 0,steps:X,isStreaming:!0},fe=(ke=st.value[A])==null?void 0:ke[L];return{threadId:A,message:{id:`${L}:plan`,role:"assistant",text:qL(ee),messageType:"plan.live",plan:ee,turnId:L||void 0,turnIndex:typeof fe=="number"?fe:void 0}}}function vl(h){var Fe;if(h.method!=="item/plan/delta")return null;const g=Ve(h.params),A=Bn(h),L=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),z=Me(g==null?void 0:g.delta);if(!A||!L||!z)return null;const X=`${L}:plan`,W=(a.value[A]??[]).find(it=>it.id===X),ee=`${(W==null?void 0:W.text)??""}${z}`,fe=W!=null&&W.plan?{...W.plan,isStreaming:!0}:void 0,ke=(Fe=st.value[A])==null?void 0:Fe[L];return{threadId:A,message:{id:X,role:"assistant",text:ee,messageType:"plan.live",plan:fe,turnId:L||void 0,turnIndex:typeof ke=="number"?ke:void 0}}}const ao={liveCommandsByThreadId:U,liveFileChangeMessagesByThreadId:O,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},vo={turnIndexByTurnIdByThreadId:st,persistedMessagesByThreadId:r,liveFileChangeMessagesByThreadId:O};function Ro(h){if(h.method==="server/request"){const g=Wy(h.params);return g&&os(g),!0}if(h.method==="server/request/resolved"){const g=Ve(h.params),A=g==null?void 0:g.id;return typeof A=="number"&&Number.isInteger(A)&&xo(A),!0}return!1}function Qo(h){return h.replace(/\s+/gu," ").trim()}function go(h){return NN(vo,h)}function ta(h,g,A){ON(vo,h,g,A)}function C(h,g){$N(vo,h,g)}function E(h,g){return DN(vo,h,g)}function x(h){FN(vo,h)}function Q(h,g,A){VN(vt,h,g,A)}function Qe(h){KN(vt,h)}function Ut(h){var fe;if(h.method!=="item/started"&&h.method!=="item/completed")return null;const g=Ve(h.params),A=Ve(g==null?void 0:g.item);if(!A||Me(A.type).toLowerCase()!=="plan")return null;const L=Bn(h),z=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),X=Me(A.id),W=Me(A.text);if(!L||!X||!W)return null;const ee=L&&z?(fe=st.value[L])==null?void 0:fe[z]:void 0;return{threadId:L,message:{id:X,role:"assistant",text:W,messageType:h.method==="item/completed"?"plan":"plan.live",plan:Sy(W)??void 0,turnId:z||void 0,turnIndex:typeof ee=="number"?ee:void 0}}}function Kn(h){var ke;if(h.method!=="item/started")return null;const g=Ve(h.params),A=Ve(g==null?void 0:g.item);if(!A||A.type!=="commandExecution")return null;const L=Me(A.id),z=Me(A.command);if(!L)return null;const X=typeof A.cwd=="string"?A.cwd:null,W=Bn(h),ee=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),fe=W&&ee?(ke=st.value[W])==null?void 0:ke[ee]:void 0;return{id:L,role:"system",text:z,messageType:"commandExecution",commandExecution:{command:z,cwd:X,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:ee||void 0,turnIndex:typeof fe=="number"?fe:void 0}}function yo(h){var lt;if(h.method!=="item/completed")return null;const g=Ve(h.params),A=Ve(g==null?void 0:g.item);if(!A||A.type!=="commandExecution")return null;const L=Me(A.id),z=Me(A.command);if(!L)return null;const X=typeof A.cwd=="string"?A.cwd:null,W=Me(A.status),ee=W==="failed"?"failed":W==="declined"?"declined":W==="interrupted"?"interrupted":"completed",fe=typeof A.aggregatedOutput=="string"?A.aggregatedOutput:"",ke=typeof A.exitCode=="number"?A.exitCode:null,Fe=Bn(h),it=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),mt=Fe&&it?(lt=st.value[Fe])==null?void 0:lt[it]:void 0;return{id:L,role:"system",text:z,messageType:"commandExecution",commandExecution:{command:z,cwd:X,status:ee,aggregatedOutput:fe,exitCode:ke},turnId:it||void 0,turnIndex:typeof mt=="number"?mt:void 0}}function tn(h){var ke;if(h.method!=="item/completed")return null;const g=Ve(h.params),A=Ve(g==null?void 0:g.item);if(!A||A.type!=="fileChange")return null;const L=Me(A.id);if(!L)return null;const z=Me(g==null?void 0:g.threadId),X=Me(g==null?void 0:g.turnId),W=z&&X?(ke=st.value[z])==null?void 0:ke[X]:void 0,ee=sf(A.changes),fe=Xg(A.status);return ee.length===0||fe!=="completed"?null:{id:L,role:"system",text:"",messageType:"fileChange",fileChangeStatus:fe,fileChanges:ee,turnId:X||void 0,turnIndex:typeof W=="number"?W:void 0}}function Mo(h,g){EN(ao,h,g)}function _a(h,g){RN(ao,h,g)}function na(h,g){MN(ao,h,g)}function ms(h){if(h.method==="item/agentMessage/delta")return!0;const g=Ve(h.params);if(!g)return!1;if(h.method==="item/completed"){const A=Ve(g.item);return(A==null?void 0:A.type)==="agentMessage"}return!1}const vs=new Set;function Pa(h){for(const g of vs)try{g(h)}catch{}}function Ec(h){return vs.add(h),()=>{vs.delete(h)}}function uu(h,g,A){jN(ao,h,g,A)}function Yn(h,g,A){LN(ao,h,g,A)}function oa(h){var wl,pu,jo,Mi,ji,Li,ua,Ni;if(Ro(h))return;if(Qe(h),h.method==="turn/started"){const Ee=Bn(h);Ee&&S.delete(Ee)}if(wO.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"){Pa(h.method);return}if(h.method==="skills/changed"){Mt({force:!0});return}if(h.method==="hook/started"||h.method==="hook/completed"){He({force:!0});return}if(h.method==="thread/status/changed"){const Ee=Bn(h);Ee&&Ee===n.value&&Xt.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),kt=Me(Ee==null?void 0:Ee.threadId);kt&&(h.method==="item/fileChange/patchUpdated"?uu(kt,Me(Ee==null?void 0:Ee.itemId),sf(Ee==null?void 0:Ee.changes)):Yn(kt,Me(Ee==null?void 0:Ee.turnId),Me(Ee==null?void 0:Ee.diff)??""),kt===n.value&&Xt.add(kt));return}if(h.method==="account/rateLimits/updated"&&ln(),h.method==="thread/name/updated"){const Ee=Ve(h.params),kt=Me(Ee==null?void 0:Ee.threadId),Lo=Me(Ee==null?void 0:Ee.threadName);if(kt&&Lo){const Oa=Ns(Lo);$o.value={...$o.value,[kt]:Oa},fn(),rc(kt,Oa)}}if(h.method==="thread/compacted"){const Ee=Ve(h.params),kt=Me(Ee==null?void 0:Ee.threadId);kt&&(En(kt,!1),On(kt,"done"),Xt.add(kt));return}if(h.method==="fuzzyFileSearch/sessionUpdated"){const Ee=Ve(h.params),kt=Me(Ee==null?void 0:Ee.sessionId);kt&&kt===Uo&&(ho.value=Kx(Ee));return}if(h.method==="fuzzyFileSearch/sessionCompleted"){const Ee=Ve(h.params),kt=Me(Ee==null?void 0:Ee.sessionId);kt&&kt===Uo&&(Uo="");return}if(h.method==="account/rateLimits/updated"){to(ay(h.params));return}const g=GL(h);if(g){as(g.threadId,g.usage);return}const A=YL(h);A&&Pt(A.threadId,A.activity);const L=Bn(h),z=KL(h);!z&&L&&cs(L);const X=JL(h);X&&(Hr.set(X.turnId,X),ta(X.threadId,X.turnId,go(X.threadId)),ze.value={...ze.value,[X.threadId]:X.turnId},us(X.threadId,X.turnId),ea(X.threadId),fs(X.threadId),rn(X.threadId,null),jt(X.threadId,null),pn(X.threadId,!0),Tn(X.threadId),V.value[X.threadId]&&(V.value=Tt(V.value,X.threadId)));const W=QL(h),ee=VL(h),fe=(W==null?void 0:W.threadId)??Bn(h),ke=fe?xe(fe):"",Fe=!!fe&&!!ee&&ke!==kr&&Nu(new Error(ee));if(W){sn.value[W.threadId];const Ee=Hr.get(W.turnId);Ee&&Hr.delete(W.turnId);const kt=Ds((wl=Ve(h.params))==null?void 0:wl.durationMs)??Ds((jo=Ve((pu=Ve(h.params))==null?void 0:pu.turn))==null?void 0:jo.durationMs)??(typeof W.startedAtMs=="number"?W.completedAtMs-W.startedAtMs:null)??(Ee?W.completedAtMs-Ee.startedAtMs:null),Lo=typeof kt=="number"?Math.max(0,kt):0;rn(W.threadId,{turnId:W.turnId,durationMs:Lo}),Ci(W.threadId,W.turnId,Lo),ze.value[W.threadId]&&(ze.value=Tt(ze.value,W.threadId)),Js(W.threadId),Pt(W.threadId,null),Ys(W.threadId),Fe||(Yr(W.threadId),Tn(W.threadId))}if(ee){const Ee=(W==null?void 0:W.threadId)||Bn(h);Ee&&jt(Ee,ee),o.value=ee,Ee&&Fe&&en(Ee)}else W&&jt(W.threadId,null);if(z){const Ee=L,kt=Ee?xe(Ee):me.value.trim();Ee&&jt(Ee,z.message,{transient:z.transient}),o.value=z.message,kt!==kr&&Nu(new Error(z.message))&&(Ee?en(Ee):De())}const it=hs(h);it&&(Zr(it.threadId,it.message),Pt(it.threadId,{label:"Planning",details:((Mi=it.message.plan)==null?void 0:Mi.steps.map(Ee=>Ee.step).slice(0,2))??[]}));const mt=vl(h);mt&&(Zr(mt.threadId,mt.message),Pt(mt.threadId,{label:"Planning",details:[]}));const lt=Ut(h);if(lt&&(Zr(lt.threadId,lt.message),Pt(lt.threadId,{label:"Planning",details:((ji=lt.message.plan)==null?void 0:ji.steps.map(Ee=>Ee.step).slice(0,2))??[]})),!L||L!==n.value)return;rN(h);const St=aN(h);if(St){const Ee=(i.value[L]??[]).find(bl=>bl.id===St.messageId),kt=`${(Ee==null?void 0:Ee.text)??""}${St.delta}`,Lo=St.turnId??(Ee==null?void 0:Ee.turnId),Oa=Lo?(Li=st.value[L])==null?void 0:Li[Lo]:Ee==null?void 0:Ee.turnIndex;Vo(L,{id:St.messageId,role:"assistant",text:kt,messageType:"agentMessage.live",turnId:Lo,turnIndex:typeof Oa=="number"?Oa:void 0})}const Vt=sN(h);if(Vt){const Ee=Vt.turnId?(ua=st.value[L])==null?void 0:ua[Vt.turnId]:void 0;Vo(L,{...Vt,turnIndex:typeof Ee=="number"?Ee:void 0})}const Sn=uN(h);Sn&&Vo(L,Sn),XL(h)&&ds(L);const Zo=ZL(h);Zo&&(ki(L,Zo.delta),JN(vt,Zo.itemId,Zo.delta));const ei=oN(h);if(ei&&(Q(L,ei.itemId,ei.text),ds(L)),eN(h)){const Ee=v.value[L]??"";Ee.trim().length>0&&!Ee.endsWith(`
|
|
75
|
-
|
|
76
|
-
`)&&Yo(L,`${Ee}
|
|
77
|
-
|
|
78
|
-
`)}tN(h);const Dn=Kn(h);Dn&&(Mo(L,Dn),Pt(L,{label:"Running command",details:[((Ni=Dn.commandExecution)==null?void 0:Ni.command)??""]}));const bo=cN(h);if(bo){const Ee=(U.value[L]??[]).find(kt=>kt.id===bo.itemId);Ee!=null&&Ee.commandExecution&&Mo(L,{...Ee,commandExecution:{...Ee.commandExecution,aggregatedOutput:`${Ee.commandExecution.aggregatedOutput}${bo.delta}`}})}const Ri=yo(h);Ri&&Mo(L,Ri);const er=tn(h);if(er&&Ko(L,er),ms(h)&&Jo(L,!0),h.method==="turn/completed"){Wt=!1,Jo(L),lv(vt);const Ee=Bn(h);Ee&&(Jr(Ee),Js(Ee),Pt(Ee,null),Ys(Ee),Fe||(Yr(Ee),Tn(Ee)))}}function wr(h){if(h.method==="thread/tokenUsage/updated"||h.method.startsWith("thread/realtime/"))return;const g=h.method,A=g==="turn/started"||g==="turn/completed"||g==="error",L=g.startsWith("thread/")||g==="turn/completed";if(!A&&!L)return;const z=Bn(h);z&&A&&Xt.add(z),L&&(un=!0,zr=!0),!(Yt!==null||typeof window>"u")&&(Yt=window.setTimeout(()=>{Yt=null,$n()},Du))}async function ra(h,g){if(!Ta){Ta=!0;try{if(!g)return;const A=[];for(const L of Pc(g)){const z=bi(L);A.includes(z)||A.push(z)}if(A.length>0){const L=g.projectOrder.length>0?Vi(A,h):Vi(he.value,h);Va(he.value,L)||wt(L,{persist:!1})}if(Object.keys(g.labels).length>0||(g.remoteProjects??[]).length>0){const L={...Ie.value};let z=!1;for(const[X,W]of Object.entries(g.labels)){const ee=Ze(X).trim(),fe=[bi(X)];ee&&fe.push(ee);for(const ke of fe)L[ke]!==W&&(L[ke]=W,z=!0)}for(const X of g.order){const W=bi(X),ee=ar(tl(X));if(!ee.startsWith(".")||ee===W)continue;const fe=`${W} ${ee}`;L[W]!==void 0||L[W]===fe||(L[W]=fe,z=!0)}for(const X of g.remoteProjects??[]){const W=cL(X);L[X.id]!==W&&(L[X.id]=W,z=!0)}z&&dt(L,{persist:!1})}}catch{}}}async function Nn(){try{return await Ki()}catch{return null}}function _i(h,g){const A=yf(h,g),L=hL(h,g),z=mL(L,g,A);if(!g||g.order.length===0&&(g.remoteProjects??[]).length===0)return z;const X=new Set;for(const ee of gf(g,A))X.add(ee);const W=z.filter(ee=>X.has(ee.projectName)?!0:bf(ee));return pL(W,g,A)}function Qs(h,g){const A=_i(h,g),L=!!(g&&(g.order.length>0||g.projectOrder.length>0||(g.remoteProjects??[]).length>0)),z=g!=null&&g.projectOrder.length?Vi(gf(g,yf(h,g)),A):Vi(he.value,A);Va(he.value,z)||wt(z,{persist:!L});const X=mf(A,he.value);ml(new Set(Jn(X).map(fe=>fe.id)));const W=lL(t.value,X,$.value);t.value=ic(t.value,W),$.value=nn($.value,new Set(Jn(t.value).map(fe=>fe.id))),new Set(Jn(t.value).map(fe=>fe.id));const ee={};for(const fe of Jn(t.value))ee[fe.id]=fe.externalSession??pe.value[fe.id]??null;pe.value=ee,fn()}function Ea(h){At.removeThreadFromLoadedLists(h),t.value=Ry(t.value,h),$.value=Tt($.value,h),fn()}async function gl(h={}){await Promise.allSettled([Re({providerChanged:h.providerChanged,includeProviderModels:h.includeProviderModels}),Fr(),H(),Mt()])}function Ra(h={}){const g=()=>{gl(h)};if(typeof window>"u"){g();return}window.setTimeout(g,0)}async function Xo(h={}){o.value="",ge.value="";const g=h.includeSelectedThreadMessages!==!1,A=h.awaitAncillaryRefreshes===!0;try{if(await Kr(),await At.loadThreads({force:h.forceThreadRefresh===!0}),g)try{await Qt(n.value)}catch(L){o.value=L instanceof Error?L.message:"Unknown application error"}A?await gl({providerChanged:h.providerChanged,includeProviderModels:h.providerChanged===!0||A}):Ra({providerChanged:h.providerChanged,includeProviderModels:!1})}catch(L){o.value=L instanceof Error?L.message:"Unknown application error",_y(L)?ge.value=Vy:ge.value=""}}async function aa(h){_n(h);try{return await Qt(h),await Re({includeProviderModels:!0}),Mt(),"ok"}catch(g){const A=g instanceof Error?g.message:"Unknown application error";o.value=A;const L=Bj(g)?"not-found":"error";return h.trim()&&jt(h,A,{transient:!0}),L}}async function hn(h){const g=n.value===h,A=g?Fj(Jn(e.value),h):"";g&&(_n(A),A&&Qt(A,{silent:!0}));try{await Qk(h),Ea(h),await At.loadThreads(),g&&A&&n.value===A&&await yt(A,{silent:!0})}catch(L){o.value=L instanceof Error?L.message:"Unknown application error"}}async function Ma(h,g){const A=g.trim();if(!(!h||!A))try{await eI(h,A),$o.value={...$o.value,[h]:A},fn(),rc(h,A)}catch(L){o.value=L instanceof Error?L.message:"Unknown application error"}}async function gs(h){var W,ee;const g=h.trim();if(!g)return"";const A=Jn(t.value).find(fe=>fe.id===g),L=((W=A==null?void 0:A.cwd)==null?void 0:W.trim())??"",z=((ee=A==null?void 0:A.title)==null?void 0:ee.trim())??"Forked chat",X=xe(g);o.value="";try{const fe=await pm(g,L||void 0,X||void 0),ke=fe.threadId.trim();return ke?(vr(ke,L,z),N(ke,fe.model),tt.value={...tt.value,[ke]:!0},_n(ke),await At.loadThreads(),await Qt(ke),ke):""}catch(fe){return o.value=fe instanceof Error?fe.message:"Unknown application error",""}}async function ys(h,g){var W;const A=h.trim();if(!A||!Number.isInteger(g)||g<0)return"";if($.value[A]===!0)return o.value="Finish the current turn before forking from a response.","";if(eo.value[A]!==!0)try{await Qt(A)}catch(ee){return o.value=ee instanceof Error?ee.message:"Unknown application error",""}const L=r.value[A]??[];let z=-1;for(const ee of L)typeof ee.turnIndex=="number"&&Number.isFinite(ee.turnIndex)&&(z=Math.max(z,ee.turnIndex));if(z>=0&&g>z)return"";const X=Jn(t.value).find(ee=>ee.id===A)??null;try{o.value="";const ee=await pm(A),fe=ee.threadId.trim();if(!fe)return"";const ke=ee.cwd.trim()||((W=X==null?void 0:X.cwd)==null?void 0:W.trim())||"",Fe=vL((X==null?void 0:X.title)||(X==null?void 0:X.preview)||"Untitled thread");if(vr(fe,ke,Fe),N(fe,ee.model),Vn(fe,ee.messages),eo.value={...eo.value,[fe]:!0},tt.value={...tt.value,[fe]:!0},ea(fe),yr(fe,[]),Jo(fe),U.value[fe]&&(U.value=Tt(U.value,fe)),rn(fe,null),Pt(fe,null),jt(fe,null),pn(fe,!1),z-g>0){const it=ee.messages.find(mt=>{var lt;return typeof mt.turnIndex=="number"&&mt.turnIndex>g&&!!((lt=mt.turnId)!=null&<.trim())});if(it!=null&&it.turnId){const mt=await Id(fe,it.turnId.trim());Vn(fe,mt)}}return await Ma(fe,Fe),_n(fe),At.loadThreads().catch(()=>{}),fe}catch(ee){return o.value=ee instanceof Error?ee.message:"Unknown application error",""}}async function Xs(h,g,A=[],L=[],z=[]){if(!h||!g.trim()||A.length>0||L.length>0||z.length>0)return!1;const W=(Dr.value[h]??[]).filter(ke=>ke.method==="item/tool/requestUserInput");if(W.length!==1)return!1;const[ee]=W,fe=wN(ee);return fe.length!==1?!1:Ss({id:ee.id,result:{answers:{[fe[0]]:{answers:[g.trim()]}}}})}function ws(h){if(_o.value<=0||yn.value.has(h))return!1;const g=Et.value[h];return!g||g.remainingContextPercent===null?!1:g.remainingContextPercent<=_o.value}async function bs(h,g,A,L,z,X){if(ue||_o.value<=0||$.value[h]===!0)return!1;const W=Et.value[h];if(!W||W.remainingContextPercent===null||W.remainingContextPercent>_o.value)return!1;const ee=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,fe=X==="plan"?"plan":X==="default"?"default":_.value;return Ao(h,{id:ee,text:g,imageUrls:A,skills:L,fileAttachments:z,collaborationMode:fe}),yn.value.has(h)||Tr(h),!0}async function br(h){const g=mr(h);if(!g||g.length===0||$.value[h]===!0)return;const A=k(h);ue=!0;try{for(const L of A)try{await ja(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments,void 0,L.collaborationMode)}catch{}}finally{ue=!1}}function Rc(h){return h instanceof Error&&/ActiveTurnNotSteerable|cannot steer a \S+ turn|same-turn steering/i.test(h.message)}function Mc(h){return h instanceof Error&&/expected active turn id/i.test(h.message)}async function jc(h,g,A,L,z,X){const W=ze.value[h]??"";if(W)try{await tI(h,W,g,A,L,z),Xr(h,g,A,L,z),Xt.add(h),await $n(),Wo(h);return}catch(ee){if(Rc(ee)){const fe=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Ho(h,{id:fe,text:g,imageUrls:A,skills:L,fileAttachments:z,collaborationMode:X==="plan"?"plan":X==="default"?"default":_.value});return}if(!Mc(ee))throw ee}Xr(h,g,A,L,z),await La(h,g,A,L,z,X)}async function ja(h,g=[],A=[],L="steer",z=[],X,W){if(Z.value)return;const ee=n.value,fe=h.trim();if(!ee||!fe&&g.length===0&&z.length===0||await Xs(ee,fe,g,A,z)||await bs(ee,fe,g,A,z,W))return;const ke=$.value[ee]===!0;if(ke&&L==="queue"){const Fe=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Ho(ee,{id:Fe,text:fe,imageUrls:g,skills:A,fileAttachments:z,collaborationMode:W==="plan"?"plan":W==="default"?"default":_.value},X);return}if(ke){Wt=!0,jc(ee,fe,g,A,z,W).catch(Fe=>{const it=Fe instanceof Error?Fe.message:"Unknown application error";jt(ee,it),o.value=it});return}o.value="",Wt=!0,rn(ee,null),Xr(ee,fe,g,A,z),Pt(ee,{label:"Thinking",details:Ne(xe(ee),oe.value,W==="plan"?"plan":W==="default"?"default":_.value)}),jt(ee,null),pn(ee,!0);try{await La(ee,fe,g,A,z,W)}catch(Fe){Wt=!1,pn(ee,!1),Pt(ee,null);const it=Fe instanceof Error?Fe.message:"Unknown application error";throw jt(ee,it),o.value=it,Fe}}async function sa(h,g,A=[],L=[],z=[]){if(Z.value)return"";const X=h.trim(),W=g.trim(),ee=xe(ha).trim(),fe=_.value;if(!X&&A.length===0&&z.length===0)return"";Bo.value=!0,o.value="";let ke="";try{try{const lt=await fm(W||void 0,ee||void 0);ke=lt.threadId,N(ke,lt.model),re(ke,lt.modelProvider||ie.value),ne(ke,fe)}catch(lt){if(ee&&ee!==kr&&Nu(lt)){await De();const St=await fm(W||void 0,kr);ke=St.threadId,N(ke,St.model),re(ke,St.modelProvider||ie.value),ne(ke,fe)}else throw lt}if(!ke)return"";vr(ke,W,X||"[Image]"),Xr(ke,X,A,L,z),ro(ke),tt.value={...tt.value,[ke]:!0},_n(ke),Wt=!0,rn(ke,null),Pt(ke,{label:"Thinking",details:Ne(xe(ke),oe.value,fe)}),jt(ke,null),pn(ke,!0);const Fe=ke,it=W||null,mt=X;return La(ke,X,A,L,z,fe).catch(lt=>{Wt=!1,pn(ke,!1),Pt(ke,null);const St=lt instanceof Error?lt.message:"Unknown application error";jt(ke,St),o.value=St}).finally(()=>{Bo.value=!1}),Nr(Fe,mt,it,A,z),ke}catch(Fe){Wt=!1,ke&&(pn(ke,!1),Pt(ke,null));const it=Fe instanceof Error?Fe.message:"Unknown application error";throw ke&&jt(ke,it),o.value=it,Bo.value=!1,Fe}}async function La(h,g,A=[],L=[],z=[],X){const W=oe.value,ee=X==="plan"?"plan":X==="default"?"default":_.value,fe=g.trim(),ke=[...A];if(ke.length===0&&Br(fe)){const mt=Ur(h);mt&&ke.push(mt)}const Fe=L.map(mt=>({name:mt.name,path:mt.path})),it=z.map(mt=>({...mt}));Vs(h,{text:fe,imageUrls:[...ke],skills:Fe,fileAttachments:it,effort:W,collaborationMode:ee,fallbackRetried:!1});try{if(tt.value[h]!==!0){const St=Le(h),Vt=await cf(h);Vt.model&&!St&&N(h,Je(h,Vt.model,Vt.modelProvider)),Vt.modelProvider&&re(h,Vt.modelProvider),tt.value={...tt.value,[h]:!0}}const mt=xe(h);let lt="";try{lt=await Ad(h,g,ke,mt||void 0,W||void 0,L.length>0?L:void 0,z,ee)}catch(St){if(mt&&mt!==kr&&Nu(St))await De(h),Vs(h,{text:fe,imageUrls:[...ke],skills:Fe,fileAttachments:it,effort:W,collaborationMode:ee,fallbackRetried:!0}),lt=await Ad(h,g,ke,kr,W||void 0,L.length>0?L:void 0,z,ee);else throw St}lt&&(ze.value={...ze.value,[h]:lt},us(h,lt)),Xt.add(h),await $n(),Wo(h)}catch(mt){throw mt}}async function Ts(){const h=n.value;if(!h||$.value[h]!==!0||xt.value[h]===!0)return;let g=ze.value[h];if(!g){const{activeTurnId:X}=await uf(h);g=X,g&&(ze.value={...ze.value,[h]:g})}if(!g)throw new Error("Could not determine active turn id for interrupt");const A=rs.value.filter(X=>X.turnId===g),L=A.find(X=>X.role==="user"),z=A.some(X=>{if(X.role==="assistant")return!0;const W=X.messageType??"";return W==="commandExecution"||W==="toolCall"||W==="worked"||W==="fileChange"||W==="plan"||W==="plan.live"||W==="compaction.done"||W==="turnError"});Ln.value=!0,o.value="";try{if(await nI(h,g),pn(h,!1),Pt(h,null),jt(h,null),ze.value[h]&&(ze.value=Tt(ze.value,h)),Xt.add(h),un=!0,await $n(),L&&!z){const X=(r.value[h]??[]).filter(ee=>ee.turnId!==g);Vn(h,X);const W=c.value[h];if(W){const ee=W.filter(fe=>fe.turnId!==g);ee.length!==W.length&&(c.value={...c.value,[h]:ee},Fd(c.value))}qn.value={...qn.value,[h]:{text:L.text??"",imageUrls:L.images??[],fileAttachments:(L.fileAttachments??[]).map(ee=>({label:ee.label,path:ee.path,fsPath:ee.fsPath??ee.path})),skills:L.skills??[]}}}}catch(X){const W=X instanceof Error?X.message:"Failed to interrupt active turn";jt(h,W),o.value=W}finally{Ln.value=!1}}function cu(h){h&&qn.value[h]&&(qn.value=Tt(qn.value,h))}async function du(h,g){if(!g)throw new Error("Cannot roll back: failed to resolve the turn id where the removal starts");return await Id(h,g)}async function Pn(h){var A,L,z,X,W;const g=n.value;if(g&&!In.value&&h.trim()){In.value=!0,o.value="";try{$.value[g]===!0&&await Ts();const ee=r.value[g]??[],fe=ee.find(St=>St.turnId===h),ke=ee.reduce((St,Vt)=>typeof Vt.turnIndex=="number"&&Vt.turnIndex>St?Vt.turnIndex:St,-1);if(ke<0)return;let Fe=typeof(fe==null?void 0:fe.turnIndex)=="number"?fe.turnIndex:((A=st.value[g])==null?void 0:A[h])??-1;(Fe<0||Fe>ke)&&(console.warn(`[rollback] turn ${h} not resolvable (index=${Fe}), clamping to newest turn`),Fe=ke);let it=((L=fe==null?void 0:fe.turnId)==null?void 0:L.trim())??"";if(!it&&Fe>=0){const St=st.value[g]??{};it=Object.keys(St).find(Vt=>St[Vt]===Fe)??""}if(!it){const St=ee.reduce((Vt,Sn)=>{const wo=typeof Sn.turnIndex=="number"?Sn.turnIndex:-1,Zo=Vt!==null&&typeof Vt.turnIndex=="number"?Vt.turnIndex:-1;return wo>=0&&wo>Zo?Sn:Vt},null);it=((z=St==null?void 0:St.turnId)==null?void 0:z.trim())??""}const mt=await du(g,it),lt=((W=(X=Wr.value)==null?void 0:X.cwd)==null?void 0:W.trim())??"";if(lt){const St=await jA(g,h,lt);St.errors.length>0&&console.warn(`[rollback] file revert for ${g} left errors: ${St.errors.join("; ")}`)}Vn(g,mt),yr(g,[]),Jo(g),U.value[g]&&(U.value=Tt(U.value,g)),rn(g,null),Pt(g,null),jt(g,null),un=!0,await $n()}catch(ee){o.value=ee instanceof Error?ee.message:"Failed to rollback thread"}finally{In.value=!1}}}function On(h,g){const L=(l.value[h]??[]).filter(z=>z.messageType!=="compaction.pending"&&z.messageType!=="compaction.done");L.push({id:`compaction:${g}:${h}:${Date.now()}`,role:"system",text:"",messageType:g==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[h]:L}}function En(h,g){const A=new Set(yn.value);g?A.add(h):A.delete(h),yn.value=A}function Lc(h){Uo=h.trim(),ho.value=[]}async function Tr(h){const g=h.trim();if(!(!g||yn.value.has(g))){En(g,!0),On(g,"pending");try{await Zk(g);const A=2e3,L=14,z=Date.now()+ba;let X=0;for(;Date.now()<z&&X<L&&yn.value.has(g);){if((await uf(g)).messages.some(fe=>fe.messageType==="compaction.done")){En(g,!1),n.value===g&&await Qt(g,{silent:!0,force:!0}),On(g,"done"),br(g);break}X+=1,await Dj(A)}yn.value.has(g)&&(En(g,!1),On(g,"done"),br(g))}catch(A){o.value=A instanceof Error?A.message:"Failed to compact thread",En(g,!1),On(g,"done"),br(g)}}}async function $n(){if(Ft.value){typeof window<"u"&&Yt===null&&(Yt=window.setTimeout(()=>{Yt=null,$n()},Du));return}Ft.value=!0;const h=un,g=zr,A=new Set(Xt);un=!1,zr=!1,Xt.clear();try{h&&await At.loadThreads({force:g});const L=n.value;if(!L)return;const z=A.has(L),X=$.value[L]===!0,W=Gn(L),ee=ga.value[L]??"";(W.length>0&&W!==ee||z||X&&eo.value[L]!==!0||h&&eo.value[L]!==!0)&&await Qt(L,{silent:!0,force:z})}catch{}finally{Ft.value=!1,(un||Xt.size>0)&&typeof window<"u"&&Yt===null&&(Yt=window.setTimeout(()=>{Yt=null,$n()},Du))}}async function Zs(){await $r(),un=!At.hasLoadedThreads.value,n.value&&eo.value[n.value]!==!0&&Xt.add(n.value),await $n()}function Na(h){const g=Ve(h.params),A=typeof(g==null?void 0:g.threadId)=="string"?g.threadId.trim():"";if(!A)return;const L=Ve(g==null?void 0:g.externalSession),z=L&&typeof L.origin=="string"&&L.origin.trim().length>0?{origin:L.origin.trim(),active:L.active===!0,lastWriteAt:typeof L.lastWriteAt=="string"?L.lastWriteAt:null}:null;pe.value={...pe.value,[A]:z},pn(A,(z==null?void 0:z.active)===!0),fn(),un=!0,n.value===A&&Xt.add(A),Yt===null&&typeof window<"u"&&(Yt=window.setTimeout(()=>{Yt=null,$n()},Du))}function Pi(){typeof window>"u"||wn||($r(),fu(),Ei(),wn=xI(h=>{if(h.method==="ready"){Eo(),Zs();return}if(h.method==="externalSessionChanged"){Na(h);return}oa(h),wr(h)}))}async function fu(){try{const h=await MI(),g=Object.entries(h);if(g.length===0)return;const A={...c.value};let L=!1;for(const[z,X]of g){const W=X.filter(Fe=>!!Fe&&typeof Fe.id=="string");if(W.length===0)continue;const ee=A[z]??[],fe=new Set(ee.map(Fe=>Fe.text)),ke=[...ee];for(const Fe of W)fe.has(Fe.text)||(ke.push(Fe),fe.add(Fe.text));A[z]=ke.slice(-20),L=!0}L&&(c.value=A,Fd(A))}catch{}}async function Ei(){try{const h=await LI(),g=Object.entries(h);if(g.length===0)return;const A={...d.value};let L=!1;for(const[z,X]of g){if(!z||!X||typeof X!="object"||Array.isArray(X))continue;const W={};for(const[ke,Fe]of Object.entries(X))!ke||typeof Fe!="number"||!Number.isFinite(Fe)||Fe<=0||(W[ke]=Math.round(Fe));if(Object.keys(W).length===0)continue;const ee={...A[z]??{},...W},fe=Object.keys(ee);A[z]=fe.length>200?Object.fromEntries(fe.slice(-200).map(ke=>[ke,ee[ke]])):ee,L=!0}L&&(d.value=A,Hy(h),av(A))}catch{}}async function Ss(h){try{return await kI(h.id,{result:h.result,error:h.error}),xo(h.id),Fo.value=Tt(Fo.value,String(h.id)),!0}catch(g){const A=g instanceof Error?g.message:"Failed to reply to server request";return await wa(h.id)?(o.value=A,Fo.value={...Fo.value,[String(h.id)]:A},!1):(xo(h.id),Fo.value=Tt(Fo.value,String(h.id)),!0)}}function ia(){if(wn&&(wn(),wn=null),un=!1,Xt.clear(),Hr.clear(),Yt!==null&&typeof window<"u"&&(window.clearTimeout(Yt),Yt=null),Io(),At.dispose(),typeof window<"u")for(const h of mo.values())window.clearTimeout(h);mo.clear(),Wt=!1,r.value={},a.value={},i.value={},v.value={},c.value={},d.value={},U.value={},O.value={},st.value={},de.value={},Y.value={},Te.value={},ze.value={},I.clear(),lv(vt),S.clear(),yL(),xt.value={},It.value={},cn.value={},Gr(),to(null),Et.value={}}function yl(h){const g=n.value;if(!g)return;const A=oo(g,h);if(A){ht(h),le(A.collaborationMode),ue=!0,ja(A.text,A.imageUrls,A.skills,"steer",A.fileAttachments).finally(()=>{ue=!1});return}const L=Vr(g,h);L&&(ht(h),le(L.collaborationMode),ja(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments))}function la(h,g={}){_n(h,g)}return{projectGroups:e,projectDisplayNameById:Ie,selectedThread:Wr,selectedThreadTokenUsage:Ca,selectedThreadTerminalOpen:_t,isSelectedThreadInterruptPending:Zt,selectedThreadServerRequests:ns,selectedLiveOverlay:qo,selectedActiveTurnId:Gt,lastPlanByThreadId:s,resolveThreadTurnIndex:E,codexQuota:po,selectedThreadId:n,availableCollaborationModes:qe,availableModelIds:ye,availableModelReasoningEfforts:Pe,selectedCollaborationMode:_,selectedModelId:me,selectedReasoningEffort:oe,selectedSpeedMode:Ae,codexCliMissingError:ge,installedSkills:G,accountRateLimitSnapshots:ko,messages:rs,hasMoreOlderMessages:xa,isLoadingThreads:At.isLoadingThreads,isThreadListFullyLoaded:At.isThreadListFullyLoaded,isLoadingMessages:Lr,slowOpenThreadId:ya,isLoadingOlderMessages:ka,isSendingMessage:Bo,isInterruptingTurn:Ln,isUpdatingSpeedMode:Z,isRollingBack:In,compactingThreadIds:yn,fuzzyFileSearchResults:ho,registerFuzzyFileSearchSession:Lc,error:o,refreshAll:Xo,refreshSkills:Mt,refreshHooks:He,hooksList:j,isHooksLoading:be,onRealtimeEvent:Ec,selectThread:aa,loadMessages:Qt,loadOlderMessages:ur,ensureThreadMessagesLoaded:yt,setThreadTerminalOpen:Go,toggleSelectedThreadTerminal:Qr,archiveThreadById:hn,compactThreadById:Tr,renameThreadById:Ma,forkThreadById:gs,forkThreadFromTurn:ys,rollbackSelectedThread:Pn,sendMessageToSelectedThread:ja,sendMessageToNewThread:sa,interruptSelectedThreadTurn:Ts,interruptedUnsubmittedMessage:dn,clearInterruptedUnsubmittedMessage:cu,selectedThreadQueuedMessages:Sa,removeQueuedMessage:ht,reorderQueuedMessage:An,steerQueuedMessage:yl,autoCompactThreshold:_o,setAutoCompactThreshold:Wn,setSelectedCollaborationMode:le,readModelIdForThread:xe,setSelectedModelIdForThread:at,injectModelSwitchDivision:ss,invalidateThreadContextWindow:Ia,setSelectedModelId:Xe,setSelectedReasoningEffort:ce,updateSelectedSpeedMode:je,respondToPendingServerRequest:Ss,pendingReplyErrorForRequest:ts,renameProject:We,removeProject:$e,reorderProject:Ge,pinProjectToTop:Ke,startPolling:Pi,stopPolling:ia,primeSelectedThread:la}}const Jy="codex-web-local.sidebar-collapsed.v1",Qy="codex-web-local.accounts-section-collapsed.v1";function SO(){return typeof window>"u"?!1:window.localStorage.getItem(Jy)==="1"}function CO(e){typeof window>"u"||window.localStorage.setItem(Jy,e?"1":"0")}function xO(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(Qy);return e===null?!0:e==="1"}function kO(){const e=T(SO()),t=T(xO()),n=T(""),o=T(!1),r=T(null),a=T(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,CO(O),O||S()}}function d(){o.value=!o.value,o.value?Dt(()=>{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 r.value?r.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 S(){const O=++i,$=s,q=90;l=!0;const M=()=>{O===i&&(s=$,l=!1)},pe=ue=>{if(O!==i)return;if(e.value){M();return}const V=f();if(V&&(V.scrollTop=$,Math.abs(V.scrollTop-$)<=1||ue>=q)){M();return}if(ue>=q||typeof window>"u"){M();return}window.requestAnimationFrame(()=>pe(ue+1))};Dt(()=>pe(0))}function I(O){O.key==="Escape"&&(o.value=!1,n.value="")}function U(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(Qy,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:o,sidebarScrollableRef:r,sidebarSearchInputRef:a,setSidebarCollapsed:c,toggleSidebarSearch:d,clearSidebarSearch:v,onSidebarScroll:y,onSidebarSearchKeydown:I,restoreSidebarScrollPosition:S,toggleAccountsSectionCollapsed:U}}const Xy="codex-web-local.right-panel-width.v1",IO=260,AO=640,cv=320;function Zy(e){return Math.min(AO,Math.max(IO,e))}function _O(){if(typeof window>"u")return cv;const e=window.localStorage.getItem(Xy),t=Number(e);return Number.isFinite(t)?Zy(t):cv}function PO(e){typeof window>"u"||window.localStorage.setItem(Xy,String(e))}function EO(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:o}=e,r=T("git"),a=T([]),s=T(""),i=K(()=>a.value.find(ge=>ge.key===s.value)??null),l=T(!1),c=T(!1),d=T(!1),v=T(_O()),f=T(!1),y=T(!1);let S=null;function I(){S&&(clearTimeout(S),S=null)}function U(){f.value=!1,y.value=!1,I()}function O(ge){ge.preventDefault();const Z=ge.clientX,me=v.value,oe=De=>{const Ne=Z-De.clientX;v.value=Zy(me+Ne)},Ae=()=>{PO(v.value),window.removeEventListener("mousemove",oe),window.removeEventListener("mouseup",Ae)};window.addEventListener("mousemove",oe),window.addEventListener("mouseup",Ae)}function $(){n()&&(t()&&!c.value&&(c.value=!0),t()||(d.value=!1),r.value=r.value==="terminal"?"git":"terminal",r.value!=="terminal"&&U())}function q(ge){r.value=ge,l.value=!1,t()||(d.value=!1),t()&&(c.value=!0),ge!=="terminal"&&U()}function M(ge){const Z=a.value.find(me=>me.path===ge.path);if(Z)s.value=Z.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(Z=>Z.key===ge)&&(s.value=ge,q("preview"))}function ue(ge){const Z=a.value.findIndex(Ae=>Ae.key===ge);if(Z<0)return;const me=a.value.filter(Ae=>Ae.key!==ge);if(a.value=me,s.value!==ge)return;if(me.length===0){s.value="",r.value="files";return}const oe=me[Math.min(Z,me.length-1)];s.value=oe.key}function V(){if(t()){c.value=!1;return}d.value=!0,l.value=!1,U()}function ie(){if(t()){c.value=!c.value;return}d.value=!d.value,d.value&&(l.value=!1,U())}function ye(){r.value="git",t()&&(c.value=!1),U()}function Pe(ge){if(f.value=ge,!ge){y.value=!1,I();return}y.value=!0,I(),S=setTimeout(()=>{S=null,o()||(y.value=!1)},1500)}return{activeRightPanelTab:r,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:c,isRightPanelCollapsed:d,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:y,onRightResizeHandleMouseDown:O,toggleRightPanelTerminal:$,selectRightPanelTab:q,onOpenFilePreview:M,selectFilePreviewTab:pe,closeFilePreviewTab:ue,onCloseRightPanel:V,onToggleRightPanelToggle:ie,onHideRightPanelTerminal:ye,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:U,clearTerminalKeyboardFocusFallbackTimer:I}}function RO(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 MO(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!RO(e))throw new Error("Copy failed")}const jO=400;function LO(e,t,n,o){return e==="visible"&&!n&&t!==null&&o-t>=jO}const NO=[[/(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 ew(e){return e.trim().toLowerCase()}function OO(e,t){return t.reduce((n,[o,r])=>n+(o.test(e)?r:0),0)}function dv(e){return e.activeCount*1e3+(e.isNoAuth?300:0)+e.toolsCount*3+e.triggersCount*4+OO(`${e.name} ${e.slug} ${e.description}`,NO)}function $O(e,t){const n=ew(t);if(!n)return 0;const o=e.name.toLowerCase(),r=e.slug.toLowerCase();return o===n||r===n?1e6:o.replace(/\s+/gu,"")===n.replace(/\s+/gu,"")?9e5:o.startsWith(n)||r.startsWith(n)?8e5:o.includes(n)||r.includes(n)?7e5:0}function Hi(e){return e.activeCount>0?0:e.totalConnections>0?1:e.isNoAuth?2:3}function nB(e,t,n=""){const o=ew(n),r=a=>$O(a,o);return t==="name"?[...e].sort((a,s)=>r(s)-r(a)||Hi(a)-Hi(s)||a.name.localeCompare(s.name)):t==="date"?[...e].sort((a,s)=>r(s)-r(a)||Hi(a)-Hi(s)||a.name.localeCompare(s.name)):[...e].sort((a,s)=>r(s)-r(a)||Hi(a)-Hi(s)||dv(s)-dv(a)||a.name.localeCompare(s.name))}function DO(e,t){var a;const n=e.lastIndexOf(":"),o=n>=0?e.slice(n+1):e,r=t.find(s=>s.name===e)??t.find(s=>s.name===o||s.name.endsWith(`:${o}`));return((a=r==null?void 0:r.path)==null?void 0:a.trim())??""}function FO(e,t){const n=[];for(const o of e){const r=o.name.trim();if(!r)continue;const a=(o.path??"").trim()||DO(r,t);a&&n.push({name:r,path:a})}return n}const BO={class:"sidebar-root"},UO=["aria-pressed","aria-label","title"],zO={key:1,class:"sidebar-search-bar"},HO=["placeholder"],qO=["aria-label"],WO={class:"sidebar-skills-link-icon","aria-hidden":"true"},GO={class:"sidebar-skills-link-copy"},VO={class:"sidebar-skills-link-title"},KO={class:"sidebar-skills-link-subtitle"},YO={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},JO={class:"sidebar-skills-link-copy"},QO={class:"sidebar-skills-link-title"},XO={class:"sidebar-skills-link-subtitle"},ZO={class:"sidebar-settings-actions"},e$=["title","aria-label"],t$=["title","aria-label"],n$={class:"content-root-wrap"},o$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},r$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},a$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},s$=["aria-label","title"],i$={class:"content-body"},l$={key:2,class:"content-grid content-grid-home"},u$={class:"new-thread-empty"},c$={class:"new-thread-hero"},d$=["title"],f$={class:"new-thread-folder-actions"},p$=["disabled"],h$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},m$={class:"new-thread-launch-card-copy"},v$={class:"new-thread-launch-card-topline"},g$={class:"new-thread-launch-card-badge","aria-hidden":"true"},y$={class:"new-thread-launch-card-eyebrow"},w$={class:"new-thread-launch-card-title"},b$={class:"new-thread-launch-card-text"},T$={class:"new-thread-launch-card-actions"},S$=["aria-label","onKeydown"],C$={class:"new-thread-open-folder-header"},x$={class:"new-thread-open-folder-title"},k$={class:"new-thread-open-folder-label"},I$={class:"new-thread-open-folder-current"},A$=["placeholder","title","disabled","onKeydown"],_$=["disabled"],P$={class:"new-thread-open-folder-actions"},E$={class:"new-thread-open-folder-toggle"},R$=["aria-pressed","disabled"],M$={key:0,class:"new-thread-open-folder-create"},j$={class:"new-thread-open-folder-create-composer"},L$=["placeholder","onKeydown"],N$=["disabled"],O$={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},$$=["href"],D$=["placeholder","onKeydown"],F$={key:1,class:"new-thread-open-folder-error-actions"},B$={class:"new-thread-open-folder-error visible-error-with-feedback"},U$=["href"],z$=["disabled"],H$={key:2,class:"new-thread-open-folder-status"},q$={key:3,class:"new-thread-open-folder-status"},W$={key:4,class:"new-thread-open-folder-list"},G$=["title","disabled","onClick"],V$={class:"new-thread-open-folder-item-name"},K$=["disabled","onClick"],Y$=["aria-label","onKeydown"],J$={class:"new-thread-open-folder-header"},Q$={class:"new-thread-open-folder-title"},X$=["disabled"],Z$=["aria-label"],eD=["aria-selected","disabled"],tD=["aria-selected","disabled"],nD={class:"new-thread-project-field"},oD={class:"new-thread-open-folder-label"},rD=["disabled","placeholder"],aD={key:0,class:"new-thread-project-field"},sD={class:"new-thread-open-folder-label"},iD=["disabled","placeholder","onKeydown"],lD={key:1,class:"new-thread-project-field"},uD={class:"new-thread-open-folder-label"},cD=["disabled","onKeydown"],dD={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},fD=["href"],pD={class:"new-thread-project-modal-actions"},hD=["disabled"],mD=["disabled"],vD={key:3,class:"new-thread-branch-select"},gD={class:"new-thread-branch-select-label"},yD={class:"new-thread-branch-select-help"},wD={key:4,class:"new-thread-runtime-help"},bD={class:"worktree-init-status-title"},TD={class:"worktree-init-status-message"},SD={class:"composer-with-queue"},CD={key:0,class:"composer-runtime-error",role:"alert"},xD=["href"],kD={key:3,class:"content-grid"},ID={class:"content-thread"},AD={key:0,class:"external-session-banner",role:"alert"},_D={key:1,class:"composer-runtime-error",role:"alert"},PD=["href"],ED={key:2,class:"interrupt-recovered-banner",role:"status"},RD=["aria-label"],MD={class:"content-right-panel-header"},jD={class:"content-right-panel-tabs",role:"tablist"},LD=["aria-selected"],ND=["aria-selected"],OD=["aria-selected","title","onClick"],$D={class:"content-right-panel-tab-label"},DD=["aria-label","title","onClick"],FD={class:"content-right-panel-actions"},BD={class:"content-right-panel-add-wrap"},UD=["aria-label","title"],zD={key:0,class:"content-right-panel-menu"},HD=["aria-label","title"],qD={class:"content-right-panel-body"},WD={key:0,class:"project-zip-modal-backdrop",role:"presentation"},GD=["aria-label"],VD={class:"project-zip-modal-header"},KD={class:"project-zip-modal-title"},YD=["aria-label","disabled"],JD={class:"project-zip-modal-copy"},QD={class:"project-zip-progress-label",role:"status","aria-live":"polite"},XD={class:"project-zip-progress-track"},ZD={key:0,class:"project-zip-modal-error",role:"alert"},eF={class:"project-zip-modal-actions"},tF=["disabled"],nF=["disabled"],oF=["disabled"],rF=["aria-label"],aF={class:"codex-login-modal-header"},sF={class:"codex-login-modal-title"},iF=["aria-label","disabled"],lF={class:"codex-login-modal-copy"},uF=["href"],cF=["placeholder","disabled"],dF={key:1,class:"codex-login-modal-error visible-error-with-feedback"},fF=["href"],pF={class:"codex-login-modal-actions"},hF=["disabled"],mF=["disabled"],vF=400,fv="codex-web-local.send-with-enter.v1",pv="codex-web-local.in-progress-send-mode.v1",hv="codex-web-local.dark-mode.v1",mv="codex-web-local.dictation-click-to-toggle.v1",vv="codex-web-local.dictation-auto-send.v1",gv="codex-web-local.dictation-language.v1",yv="codex-web-local.chat-width.v1",gF=vn({__name:"App",setup(e){var Kp,Yp;const t=Cr(()=>xr(()=>import("./ThreadConversation-BB19p4J3.js"),__vite__mapDeps([0,1,2]))),n=Cr(()=>xr(()=>import("./ThreadTerminalPanel-BPYLKihX.js"),__vite__mapDeps([3,4]))),o=Cr(()=>xr(()=>import("./ReviewPane-DLogJNGk.js"),__vite__mapDeps([5,6]))),r=Cr(()=>xr(()=>import("./DirectoryHub-DjzGaPq6.js"),__vite__mapDeps([7,1,8]))),a=Cr(()=>xr(()=>import("./AutomationsPanel-DNsTBfFe.js"),__vite__mapDeps([9,10]))),s=Cr(()=>xr(()=>import("./SettingsDialog-BRMjc7tX.js"),__vite__mapDeps([11,12]))),i=Cr(()=>xr(()=>import("./RightGitPanel-BaFysyCQ.js"),__vite__mapDeps([13,14]))),l=Cr(()=>xr(()=>import("./RightFilesPanel-C7leH782.js"),__vite__mapDeps([15,16]))),c=Cr(()=>xr(()=>import("./RightFilePreview-DIz4AIh6.js"),__vite__mapDeps([17,18]))),d=Cr(()=>xr(()=>import("./ThreadPendingRequestPanel-rVtQUq_G.js"),__vite__mapDeps([19,20]))),v=Cr(()=>xr(()=>import("./QueuedMessages-DNVDZvsM.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:y,uiLanguageOptions:S,setUiLanguage:I}=va(),U="codex-mobile",O="0.1.129",$={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:M,projectDisplayNameById:pe,selectedThread:ue,selectedThreadTokenUsage:V,selectedThreadServerRequests:ie,selectedLiveOverlay:ye,lastPlanByThreadId:Pe,resolveThreadTurnIndex:ge,selectedActiveTurnId:Z,codexQuota:me,selectedThreadId:oe,availableCollaborationModes:Ae,availableModelIds:De,availableModelReasoningEfforts:Ne,selectedCollaborationMode:Le,selectedReasoningEffort:Ce,selectedSpeedMode:Se,codexCliMissingError:xe,installedSkills:Re,accountRateLimitSnapshots:Je,messages:Xe,hasMoreOlderMessages:at,isLoadingThreads:ce,isThreadListFullyLoaded:N,isLoadingMessages:re,slowOpenThreadId:se,isLoadingOlderMessages:je,isSendingMessage:qe,isInterruptingTurn:_,isSelectedThreadInterruptPending:R,isUpdatingSpeedMode:H,error:le,refreshAll:ne,refreshSkills:ae,refreshHooks:_e,hooksList:Oe,isHooksLoading:Ie,onRealtimeEvent:he,selectThread:Ke,ensureThreadMessagesLoaded:$e,loadMessages:We,loadOlderMessages:Ge,archiveThreadById:dt,compactThreadById:wt,compactingThreadIds:tt,fuzzyFileSearchResults:st,registerFuzzyFileSearchSession:Y,forkThreadById:de,renameThreadById:Te,forkThreadFromTurn:ze,sendMessageToSelectedThread:bt,sendMessageToNewThread:yt,interruptSelectedThreadTurn:$t,interruptedUnsubmittedMessage:Lr,clearInterruptedUnsubmittedMessage:Qt,selectedThreadQueuedMessages:ur,removeQueuedMessage:eo,reorderQueuedMessage:ga,steerQueuedMessage:cr,autoCompactThreshold:qs,setAutoCompactThreshold:ya,setSelectedCollaborationMode:Za,readModelIdForThread:$o,setSelectedModelIdForThread:es,injectModelSwitchDivision:Do,invalidateThreadContextWindow:Nr,setSelectedReasoningEffort:Or,updateSelectedSpeedMode:Ws,respondToPendingServerRequest:$r,pendingReplyErrorForRequest:Fo,renameProject:ts,removeProject:wa,reorderProject:Dr,pinProjectToTop:dr,startPolling:fr,stopPolling:xo,primeSelectedThread:ns,rollbackSelectedThread:os}=TO(),vt=Px(),xt=_x(),{isMobile:It}=Yf();function cn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const qn=T(null),sn=T(null),ko=T(null);let po=null;const{buildFeedbackMailto:Fr,feedbackMailtoBase:ln,recordVisibleFailure:to}=gy(),Io=ln();function Et(u,p){p&&to(p);const b=u.currentTarget;b instanceof HTMLAnchorElement&&(b.href=Fr())}const pr=T(null),no=T(null),gn=T(null),Bo=T(0);let Ln=null;function In(){const u=gn.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)),J=p.getPropertyValue("--chat-column-max").trim(),we=Number.parseFloat(J)*(J.endsWith("rem")?16:1),Ue=Number.isFinite(we)&&we>0?Math.min(D,we):D;Bo.value=Ue}const yn=T(null),ba=T(null),ho=T(!0),Uo=EO({isMobile:()=>It.value,canShowRightPanel:()=>mu.value,isVirtualKeyboardOpen:()=>Sl.value}),{activeRightPanelTab:Ft,filePreviewTabs:hr,activeFilePreviewTabKey:Br,activeFilePreviewTab:Ur,isRightPanelMenuOpen:wn,isMobileRightPanelOpen:Yt,isRightPanelCollapsed:mo,rightPanelWidth:un,isTerminalInputFocused:zr,isTerminalKeyboardFocusFallbackActive:Xt,onRightResizeHandleMouseDown:zo,toggleRightPanelTerminal:Ta,selectRightPanelTab:Wt,onOpenFilePreview:Hr,selectFilePreviewTab:qr,closeFilePreviewTab:At,onCloseRightPanel:bn,onToggleRightPanelToggle:Wr,onHideRightPanelTerminal:Ao,onTerminalFocusChange:_o,resetTerminalKeyboardFocusState:Gr,clearTerminalKeyboardFocusFallbackTimer:Ho}=Uo,Vr=T(null),oo=T(!1),mr=T("");let Kr=!1;const Po=T(!1),ht=T(""),An=T("local"),Tn=T({}),Sa=new Map,Wn=T(""),k=T([]),j=T(!1),G=T({order:[],labels:{},projectOrder:[]}),be=T({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),He=T({phase:"idle",title:"",message:""}),Mt=kO(),{isSidebarCollapsed:_t,isAccountsSectionCollapsed:Zt,sidebarSearchQuery:Gt,isSidebarSearchVisible:qo,sidebarScrollableRef:Ca,sidebarSearchInputRef:rs,setSidebarCollapsed:dn,toggleSidebarSearch:xa,clearSidebarSearch:ka,onSidebarScroll:Gs,onSidebarSearchKeydown:_n,toggleAccountsSectionCollapsed:as}=Mt,Vs=T(null),ss=T(null),Ia=T(null),Yr=T(null);let en=null,Jr=0,Wo=0,fn=0,vr=0;const gr=T("New Project (1)"),is=T(""),rn=T(!1),Ci=T("general");let pn=0;function Ks(){if(rn.value){pn=Date.now(),rn.value=!1;return}Date.now()-pn<vF||(rn.value=!0)}const ro=T(!1),ls=T(!1),us=T(new Set);async function ml(){try{us.value=new Set(await hI())}catch{}finally{ls.value=!0}}const xi=K(()=>!ls.value||us.value.has("hooks/list")),Ys=K(()=>!ls.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>us.value.has(u)));nt(rn,u=>{u&&(_e(),ds(),Ys.value&&ps())});const Pt=T({enabled:!1,clients:[]}),jt=T(null),cs=T(!1),Eo=T(!1),Gn=T(""),Go=T(""),Qr=T("");let Vn=null,Xr=!1,yr=null;const Aa=T("never"),Zr=T(!1),Vo=T(!1),Ko=T(""),Yo=T("");let ki=!1;const Ii=T(!1);async function ds(u={}){if(!(u.force!==!0&&ki)){Zr.value=!0,Ko.value="";try{Aa.value=await YI(),ki=!0}catch(p){Ko.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{Zr.value=!1}}}function Jo(u){Aa.value=u}async function ea(){Vo.value=!0,Ko.value="",Yo.value="";try{await JI(Aa.value),Ii.value=!0,Yo.value=f("Approval policy saved"),fs&&clearTimeout(fs),fs=setTimeout(()=>{Yo.value=""},2200)}catch(u){Ko.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{Vo.value=!1}}let fs=null;async function ps(u={}){if(!(u.force!==!0&&Xr)){cs.value=!0,Go.value="";try{const p=await KI();Pt.value=p,Xr=!0}catch(p){Go.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{cs.value=!1}}}async function Ai(){const u=!Pt.value.enabled;Eo.value=!0,Gn.value=u?"enable":"disable";try{await QI(u),Pt.value={...Pt.value,enabled:u},ao(u?"Remote control enabled":"Remote control disabled")}catch(p){Go.value=p instanceof Error?p.message:"Failed to update remote control"}finally{Eo.value=!1,Gn.value=""}}async function Js(){Eo.value=!0,Gn.value="pairing";try{jt.value=await XI()}catch(u){Go.value=u instanceof Error?u.message:"Failed to start pairing"}finally{Eo.value=!1,Gn.value=""}}async function hs(){Eo.value=!0,Gn.value="clients";try{Pt.value={...Pt.value,clients:await ZI()}}catch(u){Go.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{Eo.value=!1,Gn.value=""}}async function vl(u){Eo.value=!0,Gn.value=`revoke:${u}`;try{await eA(u),Pt.value={...Pt.value,clients:Pt.value.clients.filter(p=>p.clientId!==u)},ao("Remote client removed")}catch(p){Go.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{Eo.value=!1,Gn.value=""}}function ao(u){Qr.value=u,Vn&&clearTimeout(Vn),Vn=setTimeout(()=>{Qr.value=""},3e3)}const vo=T(""),Ro=T(""),Qo=T([]),go=T(null),ta=T(null),C=T(null),E=T(null),x=T(!1),Q=T(!1),Qe=T({addedLineCount:0,removedLineCount:0}),Ut=T([]),Kn=T(""),yo=T({}),tn=T(""),Mo=T(""),_a=T({}),na=T(""),ms=T(""),vs=T(!1),Pa=T(!1);function Ec(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const uu=T(null),Yn=T([]),oa=T(!1),wr=T(!1),ra=T(!1),Nn=T(!1),_i=T(!1),Qs=T(""),Ea=T(""),gl=T(null),Ra=T(""),Xo=T(""),aa=T(""),hn=T(""),Ma=T(od(fv,!0)),gs=T(fT()),ys=T(dT()),Xs=T(pT()),ws=T(od(mv,!1)),bs=T(od(vv,!0)),br=T(PT()),Rc=K(()=>ET()),Mc=K(()=>{const{loaded:u,total:p}=be.value,b=kp(u);return p&&p>0?`${b} / ${kp(p)}`:u>0?b:f("Preparing...")}),jc=K(()=>{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)))}%`}),ja=T(!1),sa=T(!1),La=T(!1),Ts=T(""),cu=T(!1),du=T(null),Pn=T(!1),On=T(""),En=T("codex"),Lc=K(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),Tr=T(""),$n=T(""),Zs=T("responses"),Na=T("responses"),Pi=T(""),fu=T(!1),Ei=T(""),Ss=T(""),ia=T(""),yl=T(!1),la=T(!1),h=T(""),g=T(""),A=T(!1),L=T(!1),z=T("create"),X=T(""),W=T(""),ee=T(""),fe=T(!1),ke=T(""),Fe=T(!1),it=T(null),mt=T(null),lt=T(!1),St=T(null),Vt=T(null),Sn=T(""),wo=T(""),Zo=T(""),ei=T([]),Rn=T(""),Dn=T(!1),bo=T(!1),Ri=T(!1),er=T(""),wl=[le,xe,Kn,Mo,hn,On,ia,g,ke,Rn],pu=K(()=>wl.some(u=>u.value.trim().length>0)),jo=T({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Mi=T(null),ji=T(!1),Li=T(!1),ua=T(typeof window<"u"?((Kp=window.visualViewport)==null?void 0:Kp.height)??window.innerHeight:0),Ni=T(typeof window<"u"?((Yp=window.visualViewport)==null?void 0:Yp.offsetTop)??0:0),Ee=T(typeof window<"u"?window.innerHeight:0);let kt=null,Lo=!1,Oa=!1,bl=!1,Tl=0;const ti=K(()=>{const u=vt.params.threadId;return typeof u=="string"?u:""}),Cn=K(()=>vt.name==="home"),Cs=K(()=>vt.name==="skills"),ni=K(()=>vt.name==="automations"),sp=K(()=>{const u=vt.query.automationId;return typeof u=="string"?u:""}),tw=K(()=>{var u;return ni.value?f("Automations"):Cs.value?f("Skills"):Cn.value?f("Start new thread"):((u=ue.value)==null?void 0:u.title)??f("Choose a thread")}),nw=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",ow=K(()=>{var p,b;return(((b=(p=ue.value)==null?void 0:p.title)==null?void 0:b.trim())??"")||nw}),Oi=K(()=>Xe.value.filter(u=>{const p=jT(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),Nc=T([]);nt(()=>[Oi.value,re.value],([u,p])=>{p||(Nc.value=u)},{immediate:!0});const rw=K(()=>re.value&&Nc.value.length>0?Nc.value:Oi.value),ip=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Oc=T(null);function aw(u,p,b){const D=typeof p.turnIndex=="number"?p.turnIndex:-1;return D<0?!1:u.some((J,we)=>we>b&&typeof J.turnIndex=="number"&&J.turnIndex>=D&&ip.has(J.messageType??""))}function sw(u,p){return u.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=p&&ip.has(b.messageType??""))}const $c=K(()=>{const u=Oi.value,p=re.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 zt=Qm(Ue);if(!zt||Oc.value!==null&&Ue.id===Oc.value)return null;const FT=p?!0:aw(u,Ue,we);return{id:Ue.id,streaming:Ue.messageType==="plan.live",explanation:zt.explanation,steps:zt.steps,implemented:FT}}const b=oe.value?Pe.value[oe.value]??null:null;if(!b)return null;const D=Qm(b);if(!D)return null;const J=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?ge(oe.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:D.explanation,steps:D.steps,implemented:p?!0:J>=0?sw(u,J):!1}}),iw=K(()=>ye.value),xs=K(()=>Cn.value?"__new-thread__":oe.value),lp=K(()=>$o(xs.value)),hu=K(()=>{const u=ie.value;return u.length>0?u[u.length-1]:null}),lw=K(()=>hu.value?Fo(hu.value.id):""),xn=K(()=>{var u,p;return Cn.value?ht.value.trim():((p=(u=ue.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),mu=K(()=>ho.value&&(Cn.value&&xn.value.length>0||vt.name==="thread"&&oe.value.length>0)),uw=K(()=>mu.value&&Ft.value==="terminal"),Sl=K(()=>!It.value||ua.value<=0||Ee.value<=0?!1:Ee.value-ua.value>120),cw=K(()=>Sl.value||uw.value&&Xt.value),up=K(()=>{var u,p;return((p=(u=ue.value)==null?void 0:u.cwd)==null?void 0:p.trim())??ht.value.trim()}),Dc=K(()=>{var u;return!Cn.value&&((u=ue.value)==null?void 0:u.inProgress)===!0}),dw=K(()=>{const u=oe.value;return!!u&&tt.value.has(u)}),cp=K(()=>{var u,p;return!Cn.value&&((p=(u=ue.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Fc=K(()=>qe.value||_.value||Dc.value||ie.value.length>0);function dp(){ja.value&&(ja.value=!1,FI(!0))}function fw(){dp(),xt.push({name:"skills",query:{tab:"plugins"}})}function pw(){const u=oe.value;u&&wt(u)}function Bc(u,p){const b=Ze(u).trim(),D=No(b);return!b||!D?!1:p.some(J=>{const we=Ze(J).trim();return we!==b&&No(we)===D})}function Uc(u,p=""){const b=Ze(u).trim(),D=p.trim();if(D)return D;const J=No(b),we=[...G.value.order,...M.value.map(Ue=>{var zt,To;return((To=(zt=Ue.threads[0])==null?void 0:zt.cwd)==null?void 0:To.trim())??""}).filter(Boolean)];return Bc(b,we)?b:J}function hw(){const u=new Set(G.value.order),p=G.value.projectOrder.filter(b=>u.has(b));for(const b of G.value.order)p.includes(b)||p.push(b);return p}function Cl(u){const p=Ze(u).trim(),b=[...G.value.order,...M.value.map(D=>{var J,we;return((we=(J=D.threads[0])==null?void 0:J.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];return Bc(p,b)?p:No(p)}function fp(u){const p=Ze(u).trim();if(!p)return"";const b=[...G.value.order,...M.value.map(D=>{var J,we;return((we=(J=D.threads[0])==null?void 0:J.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];for(const D of G.value.order){const J=Ze(D).trim();if(!J)continue;const we=No(J),Ue=Bc(J,b)?J:we;if(J===p||Ue===p||we===p)return J}return""}const zc=K(()=>{var D,J;const u=[],p=new Set;for(const we of hw()){const Ue=we.trim();!Ue||p.has(Ue)||(p.add(Ue),u.push({value:Ue,label:Uc(Ue,G.value.labels[Ue])}))}for(const we of M.value){const Ue=((J=(D=we.threads[0])==null?void 0:D.cwd)==null?void 0:J.trim())??"";!Ue||p.has(Ue)||oc(Ue)||(p.add(Ue),u.push({value:Ue,label:Uc(Ue,pe.value[we.projectName])}))}const b=ht.value.trim();return b&&!p.has(b)&&u.unshift({value:b,label:Uc(b)}),u}),oi=K(()=>{const u=ht.value.trim();return u?Tn.value[u]===!0:!1}),mw=K(()=>{var p,b;const u={};for(const D of M.value){const J=Di(D.projectName,((b=(p=D.threads[0])==null?void 0:p.cwd)==null?void 0:b.trim())??"");u[D.projectName]=J?Tn.value[J]===!0:!1}return u}),Hc=K(()=>{const u=Wn.value.trim(),p=[...k.value];return u&&!p.some(b=>b.value===u)&&p.unshift({value:u,label:u}),p}),pp=K(()=>{const u=Wn.value.trim();if(!u)return"";const p=Hc.value.find(b=>b.value===u);return(p==null?void 0:p.label)??u}),hp=K(()=>wo.value.trim()),mp=K(()=>{const u=h.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),vw=K(()=>mp.value&&hp.value.trim().length>0&&!Rn.value),vp=K(()=>{const u=W.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),gp=K(()=>X.value.trim()?z.value==="create"?vp.value:ee.value.trim().length>0:!1),xl=K(()=>{const u=Ze(Sn.value).trim();return u||wo.value.trim()}),gw=K(()=>A.value?"Creating…":"Create"),yw=K(()=>Fe.value?z.value==="clone"?f("Cloning…"):f("Creating…"):z.value==="clone"?f("Clone repository"):f("Create project")),ww=K(()=>{const u=wo.value.trim(),p=Zo.value.trim();return!!(u&&p&&u!==p)}),yp=K(()=>{const u=[];ww.value&&u.push({key:`parent:${Zo.value}`,name:"..",path:Zo.value,kind:"parent"});for(const p of ei.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),qc=K(()=>{const u=er.value.trim().toLowerCase();return u?yp.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):yp.value}),$i=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,bw=K(()=>f($[Xs.value].label)),Tw=K(()=>{const u=$[Xs.value],p=Math.max(0,Ee.value-ua.value-Ni.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":ua.value>0?`${ua.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Ni.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),Sw=K(()=>{if(!jo.value.configured)return f("Not configured");const u=jo.value.active?f("Online"):f("Configured (offline)"),p=jo.value.allowAllUsers?f("allow all users"):`${jo.value.allowedUsers} ${f("allowed user(s)")}`,b=`${jo.value.mappedChats} ${f("chat(s)")}, ${jo.value.mappedThreads} ${f("thread(s)")}, ${p}`,D=jo.value.lastError?`, ${f("error")}: ${jo.value.lastError}`:"";return`${u}, ${b}${D}`});Ti(()=>{var u,p;document.addEventListener("pointerdown",Ep),window.addEventListener("keydown",Pp),document.addEventListener("visibilitychange",Rp),window.addEventListener("pageshow",Mp),window.addEventListener("focus",jp),window.addEventListener("resize",ri),(u=window.visualViewport)==null||u.addEventListener("resize",ri),(p=window.visualViewport)==null||p.addEventListener("scroll",ri),ri(),Cu(),$i==null||$i.addEventListener("change",Cu),po=he(b=>{ko.value&&ko.value.refreshFromNotification(b)}),yr=he(b=>{b==="remoteControl/status/changed"&&ps({force:!0})}),LT(),oT(),ml(),kw(),Is(),Sr(),bp(),Wc(),rd(),xb(),ds()}),nt(wl,(u,p)=>{u.forEach((b,D)=>{if(b===p[D])return;const J=b.trim();J&&to(J)})}),nt(gn,u=>{if(Ln&&(Ln.disconnect(),Ln=null),typeof ResizeObserver<"u"){Ln=new ResizeObserver(In),u&&Ln.observe(u);return}In()},{immediate:!0}),au(()=>{var u,p;document.removeEventListener("pointerdown",Ep),window.removeEventListener("keydown",Pp),document.removeEventListener("visibilitychange",Rp),window.removeEventListener("pageshow",Mp),window.removeEventListener("focus",jp),window.removeEventListener("resize",ri),(u=window.visualViewport)==null||u.removeEventListener("resize",ri),(p=window.visualViewport)==null||p.removeEventListener("scroll",ri),$i==null||$i.removeEventListener("change",Cu),Ln&&(Ln.disconnect(),Ln=null),kt!==null&&(window.clearInterval(kt),kt=null),en&&(clearTimeout(en),en=null),Ho(),xo(),po&&(po(),po=null),yr&&(yr(),yr=null),Vn&&(clearTimeout(Vn),Vn=null)});function ri(){var u,p;typeof window>"u"||(Ee.value=Math.max(Ee.value,window.innerHeight),ua.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Ni.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}nt(Gt,u=>{const p=u.trim();if(en&&(clearTimeout(en),en=null),!p){Yr.value=null;return}en=setTimeout(()=>{Xx(p,1e3).then(b=>{Gt.value.trim()===p&&(Yr.value=b.threadIds)}).catch(()=>{Gt.value.trim()===p&&(Yr.value=null)})},220)}),nt(Sl,u=>{u||(Xt.value=!1)}),nt(Yn,()=>{if(typeof window>"u")return;if(!Yn.value.some(p=>p.quotaStatus==="loading")){kt!==null&&(window.clearInterval(kt),kt=null);return}kt===null&&(kt=window.setInterval(()=>{Lo||(Lo=!0,kl({silent:!0}).finally(()=>{Lo=!1}))},1500))},{deep:!0}),nt(Je,()=>{wp().then(u=>{u&&ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function wp(){if(!Oa||bl||En.value!=="codex"||Yn.value.length>0||Je.value.length===0)return!1;bl=!0;const u=JSON.stringify(Yn.value.map(b=>b.accountId).sort());try{const b=await km();Yn.value=b.accounts}catch{await kl({silent:!0})}const p=JSON.stringify(Yn.value.map(b=>b.accountId).sort());return u!==p}function Cw(){ae({force:!0})}function xw(u){u&&We(u,{silent:!0,force:!0})}async function Wc(){try{jo.value=await EI()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";jo.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function bp(){try{const u=await PI();Ei.value=u.botToken,Ss.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
79
|
-
`),ia.value=""}catch(u){ia.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function kw(){const u=await DI();ja.value=u.dismissed!==!0}function Iw(u){const p=u.split(/[\n,]/).map(J=>J.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=p.includes("*"),D=Array.from(new Set(p.filter(J=>/^-?\d+$/.test(J)).map(J=>Number.parseInt(J,10))));return b?["*",...D]:D}async function Aw(){const u=Ei.value.trim(),p=Iw(Ss.value);if(!u){ia.value=f("Telegram bot token is required.");return}if(p.length===0){ia.value=f("At least one allowed Telegram user ID or * is required.");return}yl.value=!0,ia.value="";try{await _I(u,p),Ss.value=p.map(b=>String(b)).join(`
|
|
80
|
-
`),await Promise.all([bp(),Wc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){ia.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),Wc()}finally{yl.value=!1}}const vu=T(""),_w=K(()=>vu.value||oe.value);nt(oe,()=>{vu.value=""});function Pw(){return new Promise(u=>{let p=!1;const b=()=>{p||(p=!0,u())};requestAnimationFrame(()=>setTimeout(b,0)),setTimeout(b,80)})}let Gc=0;function Ew(u){if(!u)return;if(vt.name==="thread"&&ti.value===u){Gc+=1,vu.value="";return}vu.value=u;const p=Gc+=1;Pw().then(()=>{p===Gc&&xt.push({name:"thread",params:{threadId:u}})}),It.value&&dn(!0)}function Rw(u){vt.name==="automations"&&sp.value!==u&&xt.replace({name:"automations",query:u?{automationId:u}:{}})}async function Mw(u){var p;_t.value&&(dn(!1),await Dt()),(p=qn.value)==null||p.openAutomationEditorFromPanel(u)}async function jw(){var u;_t.value&&(dn(!1),await Dt()),(u=qn.value)==null||u.openAutomationCreatorFromPanel()}function Lw(){var u;vt.name==="automations"&&((u=sn.value)==null||u.loadAutomations())}async function Nw(u){u&&oe.value===u&&await lT()}function Ow(u){return u.length>8?u.slice(-8):u}function Tp(u){const p=[u.planType||f("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function $w(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function gu(u){return u.unavailableReason==="payment_required"||$w(u.quotaError)}function Dw(u){return oa.value||wr.value||ra.value||Nn.value||Ra.value.length>0||u.isActive&&Ra.value!==u.storageId&&Fc.value}function Vc(u){return Xo.value===u.storageId}function Fw(u){return aa.value===u.storageId||Vc(u)}function Bw(u){return gu(u)?f("Unavailable"):u.isActive?f("Active"):wr.value?f("Switching…"):f("Switch")}function Uw(u){return Ra.value===u.storageId?f("Removing…"):Vc(u)?f("Click again to remove"):f("Remove")}function zw(u){aa.value=u}function Hw(u){aa.value===u&&(aa.value=""),Ra.value!==u&&Xo.value===u&&(Xo.value="")}function qw(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 J=b.filter(we=>typeof we.windowMinutes=="number"&&we.windowMinutes>=7*24*60).sort((we,Ue)=>(we.windowMinutes??0)-(Ue.windowMinutes??0))[0]??null;return J||(p.secondary??null)}function Ww(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function Sp(u){var we,Ue;if(gu(u))return u.quotaError||f("402 Payment Required");const p=u.quotaSnapshot,b=qw(u),D=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,J=b??D;if(J){const zt=Math.max(0,Math.min(100,100-Math.round(J.usedPercent))),To=Ww(J.resetsAt);return To?`${zt}% ${f("weekly remaining")} · ${To}`:`${zt}% ${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 Gw(u){return[u.email||f("Account"),Tp(u),gu(u)?f("Unavailable account"):null,Sp(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
81
|
-
`)}async function kl(u={}){try{const p=await nA();Yn.value=p.accounts,p.accounts.some(b=>b.storageId===aa.value)||(aa.value=""),p.accounts.some(b=>b.storageId===Xo.value)||(Xo.value="")}catch(p){if(u.silent===!0)return;hn.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Vw(){if(!(oa.value||wr.value||ra.value||Nn.value)){hn.value="",aa.value="",Xo.value="",oa.value=!0;try{const u=await km();Yn.value=u.accounts,xo(),fr(),ne({includeSelectedThreadMessages:!0})}catch(u){hn.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{oa.value=!1}}}async function Kw(u){if(!(wr.value||oa.value||ra.value||Nn.value)){if(Fc.value){hn.value=f("Finish the current turn and pending requests before switching accounts.");return}hn.value="",aa.value="",Xo.value="",wr.value=!0;try{const p=await aA(u);Yn.value=Yn.value.map(b=>b.storageId===u?p:{...b,isActive:!1}),xo(),fr(),ne({includeSelectedThreadMessages:!0}),kl({silent:!0})}catch(p){hn.value=p instanceof Error?p.message:f("Failed to switch account")}finally{wr.value=!1}}}async function Yw(){var u;if(!(oa.value||wr.value||ra.value||Nn.value)){hn.value="",Ea.value="",ra.value=!0;try{const p=await oA();Qs.value=p,_i.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Dt(),(u=gl.value)==null||u.focus()}catch(p){hn.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{ra.value=!1}}}function Kc(){Nn.value||(_i.value=!1,Ea.value="")}async function Jw(){const u=Ea.value.trim();u&&await Qw(u)}async function Qw(u){if(!(Nn.value||u.length===0)){hn.value="",Nn.value=!0;try{const p=await rA(u);Yn.value=p.accounts,Qs.value="",Ea.value="",_i.value=!1,xo(),fr(),ne({includeSelectedThreadMessages:!0})}catch(p){hn.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{Nn.value=!1}}}async function Xw(u){if(oa.value||wr.value||ra.value||Nn.value||Ra.value.length>0)return;const p=Yn.value.find(D=>D.storageId===u)??null;if(!p)return;if(Xo.value!==u){Xo.value=u;return}if(p.isActive&&Fc.value){hn.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=p.isActive;hn.value="",Xo.value="",Ra.value=u;try{const D=await sA(u);Yn.value=D.accounts,xo(),fr(),b&&ne({includeSelectedThreadMessages:!0}),kl({silent:!0})}catch(D){hn.value=D instanceof Error?D.message:f("Failed to remove account")}finally{Ra.value=""}}function Zw(u){dt(u)}function eb(u){ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function tb(u){const p=await de(u);p&&(Cn.value?await xt.replace({name:"thread",params:{threadId:p}}):await xt.push({name:"thread",params:{threadId:p}}),It.value&&dn(!0))}function Cp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function Di(u,p=""){var we,Ue,zt;const b=M.value.find(To=>To.projectName===u);if(!b)return fp(u)||p.trim();const D=b.threads.find(To=>!Cp(To.cwd));return(((we=D==null?void 0:D.cwd)==null?void 0:we.trim())??((zt=(Ue=b.threads[0])==null?void 0:Ue.cwd)==null?void 0:zt.trim())??"")||fp(u)||p.trim()}function nb(u){var D,J;const p=M.value.find(we=>we.projectName===u),b=Di(u,((J=(D=p==null?void 0:p.threads[0])==null?void 0:D.cwd)==null?void 0:J.trim())??"");b&&(ht.value=b),It.value&&dn(!0),!Cn.value&&xt.push({name:"home"})}function ob(u){var b;let p="";for(const D of M.value){const J=D.threads.find(we=>we.id===u);if((b=J==null?void 0:J.cwd)!=null&&b.trim()){p=J.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function yu(u){var b,D;const p=M.value.find(J=>J.projectName===u);return Di(u,((D=(b=p==null?void 0:p.threads[0])==null?void 0:b.cwd)==null?void 0:D.trim())??"")}const xp=K(()=>Object.fromEntries(M.value.map(u=>[u.projectName,yu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function rb(u){return(pe.value[u]??u).trim()||u}function ab(u){return rb(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function sb(u){const p=yu(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function ib(u){const p=yu(u);await Ap(p)}async function lb(u){const p=ub(u);await Ap(p)}function ub(u){var p;for(const b of M.value){const D=b.threads.find(J=>J.id===u);if((p=D==null?void 0:D.cwd)!=null&&p.trim())return D.cwd.trim()}return""}function kp(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 cb(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 db(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 Ip(){be.value.phase!=="exporting"&&(be.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function fb(){const{blob:u,fileName:p}=be.value;!u||!p||(be.value={...be.value,error:""},cb(u,p))}async function pb(){const{blob:u,fileName:p}=be.value;if(!(!u||!p))try{be.value={...be.value,error:""},await db(u,p)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const D=b instanceof Error?b.message:"",J=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(D);be.value={...be.value,error:J?f("This browser blocked sharing the ZIP. Use Download instead."):D||f("Failed to share project. Use Download instead.")}}}async function Ap(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 bA(u,({loaded:D,total:J})=>{be.value={...be.value,phase:"exporting",loaded:D,total:J}});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 hb(u){const p=yu(u);if(!p||typeof window>"u"||(await wu(p),Tn.value[p]!==!0))return;const b=`${ab(u)}-`,D=window.prompt("New worktree folder name",b);if(D===null)return;const J=D.trim();if(J){if(J.includes("/")||J.includes("\\")||J==="."||J===".."){window.alert("Worktree name must be a single folder name.");return}try{const we=await cA(p,J),Ue=await Ru(we.cwd,{createIfMissing:!1,label:""});if(!Ue)return;ht.value=Ue,An.value="local",dr(Cl(Ue)),await Is(),await Sr(),It.value&&dn(!0),Cn.value||await xt.push({name:"home"})}catch(we){const Ue=we instanceof Error?we.message:"Failed to create worktree.";window.alert(Ue)}}}function mb(){var b,D,J;const u=ue.value;if(!u)return"";const p=((b=u.projectName)==null?void 0:b.trim())??"";return p?Di(p,((J=u.cwd)==null?void 0:J.trim())??""):((D=u.cwd)==null?void 0:D.trim())??""}function Yc(){const u=mb();u&&(ht.value=u),An.value="local",It.value&&dn(!0),!Cn.value&&xt.push({name:"home"})}function vb(){ht.value="",An.value="local",It.value&&dn(!0),!Cn.value&&xt.push({name:"home"})}async function wu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(Tn.value,p))return;const b=Sa.get(p);if(b){const we=await b;Object.prototype.hasOwnProperty.call(Tn.value,p)||(Tn.value={...Tn.value,[p]:we});return}const D=pA(p).then(we=>we.isGitRepo).catch(()=>!1).finally(()=>{Sa.delete(p)});Sa.set(p,D);const J=await D;Object.prototype.hasOwnProperty.call(Tn.value,p)||(Tn.value={...Tn.value,[p]:J})}function gb(u){ts(u.projectName,u.displayName)}function yb(u){Te(u.threadId,u.title)}async function wb(u){await wa(u),await Is(),Sr()}function bb(u){Dr(u.projectName,u.toIndex)}function Tb(u){var D,J;const p=M.value.find(we=>we.projectName===u),b=Di(u,((J=(D=p==null?void 0:p.threads[0])==null?void 0:D.cwd)==null?void 0:J.trim())??"");wu(b)}function _p(u){Sb(u)}async function Sb(u){var D;const p=await $r(u),b=((D=u.followUpMessageText)==null?void 0:D.trim())??"";if(!(!p||!b||Cn.value))try{await bt(b,[],[],"steer",[])}catch{}}async function Cb(u){const p=await ze(u.threadId,u.turnIndex);p&&(await xt.push({name:"thread",params:{threadId:p}}),oe.value!==p&&await Ke(p),It.value&&dn(!0))}function Pp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&rn.value){rn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(cn()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),dn(!_t.value);return}if(p==="j"&&vt.name==="thread"&&oe.value){u.preventDefault(),Ta();return}p==="j"&&Cn.value&&xn.value&&(u.preventDefault(),Ta())}async function xb(){try{const u=await ek();ho.value=u.available,!u.available&&Ft.value==="terminal"&&(Ft.value="git",Gr())}catch{ho.value=!1,Ft.value==="terminal"&&(Ft.value="git")}}function Ep(u){var b,D;const p=u.target;if(p instanceof Node){if(zr.value){const J=p instanceof Element?p:p.parentElement;J!=null&&J.closest(".thread-terminal-panel")||Gr()}rn.value&&((b=ss.value)!=null&&b.containsTarget(p)||(D=Ia.value)!=null&&D.contains(p)||(pn=Date.now(),rn.value=!1))}}function kb(u){var b,D;if(!rn.value)return;const p=u.target;p instanceof Node&&((b=ss.value)!=null&&b.containsTarget(p)||(D=Ia.value)!=null&&D.contains(p)||(pn=Date.now(),rn.value=!1))}function Ib(){var u;(u=qn.value)==null||u.openRecycleBin()}function Rp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Mi.value=Date.now(),ji.value=!1;return}Jc()}}function Mp(u){u.persisted&&Jc()}function jp(){vt.name==="home"&&(Is(),Sr()),Jc()}function Jc(){typeof window>"u"||typeof document>"u"||LO(document.visibilityState,Mi.value,ji.value,Date.now())&&(ji.value=!0,Mi.value=null,Ab())}async function Ab(){if(!Li.value){Li.value=!0;try{await ne({includeSelectedThreadMessages:!1}),await sd()}finally{Li.value=!1}}}function Lp(u){const p=u.text;bu();const b=Vr.value,D=u.mode==="queue"&&b&&b.threadId===oe.value?b.queueIndex:void 0;if(Vr.value=null,Cn.value){NT(p,u.imageUrls,u.skills,u.fileAttachments);return}bt(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,D)}function _b(u){const p=ur.value.findIndex(we=>we.id===u),b=p>=0?ur.value[p]:void 0,D=no.value;if(!b||!D||D.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Vr.value=oe.value?{threadId:oe.value,queueIndex:p}:null;const J={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(we=>({...we})),skills:b.skills.map(we=>({...we}))};D.hydrateDraft(J),eo(u)}function bu(){if(!It.value||Cn.value)return;const u=()=>{var p;(p=yn.value)==null||p.jumpToLatest()};u(),Dt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function Pb(u){ht.value=u.trim(),g.value=""}function Eb(u){Wn.value=u.trim()}function ks(u){const p=xn.value.trim();return!u||p!==u?!1:vt.name==="thread"||vt.name==="home"&&oi.value}function Np(){Jr+=1,Wo+=1,fn+=1,vr+=1,Qo.value=[],go.value=null,ta.value=null,C.value=null,E.value=null,x.value=!1,Q.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},Ut.value=[],yo.value={},tn.value="",Mo.value="",_a.value={},na.value="",ms.value="",Kn.value="",vs.value=!1}function Op(u){const p=u.trim();if(!p){Qe.value={addedLineCount:0,removedLineCount:0};return}const b=++vr;RA(p,"unstaged").then(D=>{b!==vr||!ks(p)||(Qe.value={addedLineCount:D.addedLineCount,removedLineCount:D.removedLineCount})}).catch(()=>{b!==vr||!ks(p)||(Qe.value={addedLineCount:0,removedLineCount:0})})}async function Il(u){var D,J,we;const p=u.trim();if(!p){Np();return}const b=++Jr;vs.value=!0,Kn.value="";try{const Ue=await fA(p);if(b!==Jr||!ks(p))return;Qo.value=Ue.options,go.value=Ue.currentBranch,ta.value=Ue.headSha,C.value=Ue.headSubject,E.value=Ue.headDate,x.value=Ue.detached,Q.value=Ue.dirty,Ut.value=Ue.changedFiles,Op(p);const zt=((D=Ue.currentBranch)==null?void 0:D.trim())||((we=(J=Ue.options[0])==null?void 0:J.value)==null?void 0:we.trim())||"";zt&&$p({branch:zt,includeResetHistory:!0})}catch{if(b!==Jr||!ks(p))return;Qo.value=[],go.value=null,ta.value=null,C.value=null,E.value=null,x.value=!1,Q.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},Ut.value=[]}finally{b===Jr&&(vs.value=!1)}}function Rb(u){go.value=u.currentBranch,ta.value=u.headSha,C.value=u.headSubject,E.value=u.headDate,x.value=u.detached,Q.value=u.dirty,Ut.value=u.changedFiles,Op(xn.value)}function Mb(u){if(Pa.value)return;const p=u.trim();if(!p||p===(go.value??""))return;const b=xn.value.trim();b&&(Pa.value=!0,Kn.value="",hA(b,p).then(D=>(go.value=D||p,ta.value=null,C.value=null,E.value=null,x.value=!1,ro.value=!1,Il(b))).catch(D=>{const J=D instanceof Error?D.message:"Failed to switch branch";Il(b).finally(()=>{Kn.value=J})}).finally(()=>{Pa.value=!1}))}function jb(u){if(Pa.value)return;const p=u.branch.trim(),b=u.sha.trim(),D=xn.value.trim();!p||!b||!D||(Pa.value=!0,Kn.value="",gA(D,p,b).then(J=>(Rb(J),ro.value=!1,Il(D))).catch(J=>{const we=J instanceof Error?J.message:"Failed to reset branch to commit";Il(D).finally(()=>{Kn.value=we})}).finally(()=>{Pa.value=!1}))}function $p(u){const p=(typeof u=="string"?u:u.branch).trim(),b=typeof u=="string"?!0:u.includeResetHistory!==!1,D=xn.value.trim(),J=Ec(p,b);if(!p||!D||tn.value===J||(Mo.value="",yo.value[J]))return;const we=++Wo;tn.value=J,mA(D,p,{includeResetHistory:b}).then(Ue=>{we!==Wo||!ks(D)||(yo.value={...yo.value,[J]:Ue})}).catch(Ue=>{we!==Wo||!ks(D)||(Mo.value=Ue instanceof Error?Ue.message:"Failed to load branch commits")}).finally(()=>{we===Wo&&tn.value===J&&(tn.value="")})}function Lb(u){const p=u.trim(),b=xn.value.trim();if(!p||!b||na.value===p||(ms.value="",_a.value[p]))return;const D=++fn;na.value=p,vA(b,p).then(J=>{D!==fn||!ks(b)||(_a.value={..._a.value,[p]:J})}).catch(J=>{D!==fn||!ks(b)||(ms.value=J instanceof Error?J.message:"Failed to load commit files")}).finally(()=>{D===fn&&na.value===p&&(na.value="")})}function Nb(u){const p=u.path.trim(),b=u.sha.trim();!p||!b||(vo.value=p,Ro.value=b,ro.value=!0)}function Ob(){vo.value="",Ro.value="",ro.value=!ro.value}function $b(){!vo.value&&!Ro.value||(vo.value="",Ro.value="",ro.value=!1)}async function Db(){const u=await Su();u&&(await Sr(),X.value=u,W.value=gr.value.trim()||"New Project (1)",ee.value="",ke.value="",z.value="create",L.value=!0,Dt(()=>{var p;return(p=it.value)==null?void 0:p.focus()}))}function Tu(){Fe.value||(L.value=!1,ke.value="")}let Qc=!1,Xc=!1;function Fb(){Qc=!0}function Bb(){Qc&&(Qc=!1,Fi())}function Ub(){Xc=!0}function zb(){Xc&&(Xc=!1,Tu())}async function Hb(){const u=X.value.trim(),p=W.value.trim();if(!vp.value)throw new Error("Enter a single project folder name.");const b=Up(Bp(u,p));return b?Ru(b,{createIfMissing:!0,label:""}):""}async function qb(){const u=X.value.trim(),p=ee.value.trim();return p?xA(p,u):""}async function Zc(){if(!(!gp.value||Fe.value)){ke.value="",Fe.value=!0;try{const u=z.value==="clone"?await qb():await Hb();if(!u)return;ht.value=u,dr(Cl(u)),await Is(),await Sr(),L.value=!1}catch(u){ke.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{Fe.value=!1}}}function Wb(){Gb(mt.value)}function Gb(u){fe.value||!u||(u.value="",u.click())}async function Vb(u,p,b){fe.value=!0;try{const D=await Su();if(!D)return;const J=await p(D);if(!J.path)return;ht.value=J.path,dr(Cl(J.path)),await Is(),await ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Sr()}catch(D){const J=D instanceof Error?D.message:b;window.alert(J)}finally{fe.value=!1,u&&(u.value="")}}async function Kb(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||fe.value||await Vb(p,J=>TA(b,J),"Failed to import project.")}async function Yb(){const u=ht.value.trim()||await Su();u&&(la.value=!1,lt.value=!0,er.value="",await As(u),Rn.value||Dt(()=>{var p;return(p=St.value)==null?void 0:p.focus()}))}function Fi(){Tl+=1,lt.value=!1,Dn.value=!1,Rn.value="",er.value="",Sn.value="",Al()}async function Jb(u){!u||Dn.value||(er.value="",await As(u))}function Qb(){const u=wo.value.trim();!lt.value||!u||As(u)}function Xb(){const u=xl.value;!lt.value||!u||Dn.value||As(u)}function Zb(){if(!lt.value||Dn.value||bo.value)return;const u=xl.value,p=wo.value.trim();!u||u===p||As(u)}function eT(){const u=xl.value,p=wo.value.trim();if(u){if(u!==p){As(u);return}ed(u)}}async function ed(u=xl.value){const p=Ze(u).trim();if(p){Rn.value="",bo.value=!0;try{const b=await Ru(p,{createIfMissing:!1,label:""});if(!b){Rn.value="Failed to open the selected folder.";return}ht.value=b,dr(Cl(b)),await Is(),await ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Sr(),Fi()}catch(b){Rn.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{bo.value=!1}}}async function tT(){if(g.value="",la.value){Al();return}if(!lt.value){const u=ht.value.trim()||await Su();if(!u||(lt.value=!0,er.value="",await As(u),Rn.value))return}Rn.value||(h.value=gr.value,la.value=!0,Dt(()=>{var u;return(u=uu.value)==null?void 0:u.focus()}))}function Al(){g.value="",h.value="",la.value=!1}async function Dp(){const u=h.value.trim();if(!u)return;if(g.value="",Rn.value){g.value="Reload the current folder before creating a new one.";return}A.value=!0;const p=hp.value.trim(),b=Up(Bp(p,u));if(!b){g.value="Unable to determine where the new folder should be created.",A.value=!1;return}if(!mp.value){g.value="Enter a single folder name.",A.value=!1;return}try{const D=await CA(b);if(!D){g.value="Failed to create the folder.";return}g.value="",er.value="",await As(D),Al()}catch(D){g.value=D instanceof Error?D.message:"Failed to create folder."}finally{A.value=!1}}async function nT(){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 Ru(u,{createIfMissing:!1,label:""});if(!b)return!1;ht.value=b,dr(Cl(b)),await xt.replace({name:"home"}),await Is();const D=new URL(window.location.href);return D.searchParams.delete("openProjectPath"),window.history.replaceState({},"",D.toString()),!0}catch{return!1}}async function Su(){const u=Fp();if(u)return u;try{const p=await Im();if(p)return is.value=p,p}catch{}return""}async function Sr(){const u=Fp();if(!u){gr.value="New Project (1)";return}try{const p=await IA(u);gr.value=p.name||"New Project (1)"}catch{gr.value="New Project (1)"}}function Fp(){var b,D;const u=ht.value.trim();if(u)return tl(u);const p=((D=(b=zc.value[0])==null?void 0:b.value)==null?void 0:D.trim())??"";return p?tl(p):is.value.trim()}async function oT(){try{is.value=await Im()}catch{is.value=""}}async function Is(){try{const u=await Ki();G.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{G.value={order:[],labels:{},projectOrder:[]}}}async function As(u){const p=++Tl,b=Ze(u).trim();Sn.value=b,wo.value=b,Rn.value="",Dn.value=!0;try{const D=await SA(u,{showHidden:Ri.value});if(p!==Tl)return;Sn.value=D.path,wo.value=D.path,Zo.value=D.parentPath,ei.value=D.entries}catch(D){if(p!==Tl)return;Rn.value=D instanceof Error?D.message:"Failed to load local folders.",Zo.value=tl(wo.value),ei.value=[],Al()}finally{p===Tl&&(Dn.value=!1)}}function Bp(u,p){const b=Ze(u).trim(),D=Ze(p).trim().replace(/^[\\/]+/u,"");if(!b||!D)return"";const J=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${J}${D}`;if(/^\/+$/u.test(b))return`/${D}`;const we=b.replace(/[\\/]+$/u,"");return we?`${we}${J}${D}`:""}function Up(u){const p=Ze(u).trim();if(!p)return"";const b=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,J,we,Ue=""]=b,zt=td(Ue.split(/[\\/]+/u));return zt.length>0?`\\\\${J}\\${we}\\${zt.join("\\")}`:`\\\\${J}\\${we}`}const D=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(D){const[,J,we=""]=D,Ue=p.includes("\\")&&!p.includes("/")?"\\":"/",zt=td(we.split(/[\\/]+/u));return zt.length>0?`${J}${Ue}${zt.join(Ue)}`:`${J}${Ue}`}if(p.startsWith("/")){const J=td(p.split("/"));return J.length>0?`/${J.join("/")}`:"/"}return p}function td(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 rT(u){ga(u.draggedId,u.targetId)}function zp(u){const p=xs.value,b=$o(p);es(p,u),b&&b!==u&&(Do(p,b,u),Nr(p))}function Hp(u){Or(u)}function qp(u){Ws(u)}function aT(){$t()}const _l=T("");let nd=null;nt(Lr,u=>{var p;u&&(u.text&&((p=no.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),_l.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),nd&&clearTimeout(nd),nd=setTimeout(()=>{_l.value=""},6e3),Qt(xs.value))});function Wp(u){var b,D;const p=oe.value.trim();switch(u){case"compact":p&&wt(p);break;case"review":if(!p)return;vo.value="",Ro.value="",ro.value=!0;break;case"rename":p&&((D=qn.value)==null||D.openRenameThreadDialog(p,((b=ue.value)==null?void 0:b.title)??""));break;case"archive":p&&dt(p);break;case"fork":p&&de(p);break;case"new":Yc();break;case"skills":Cs.value||xt.push({name:"skills"});break}}function sT(u){const p=u.turnId.trim();if(p.length>0){const b=[...Oi.value].reverse().find(D=>{var J;return D.role==="user"&&(((J=D.turnId)==null?void 0:J.trim())??"")===p&&D.text.trim().length>0});b!=null&&b.text&&no.value&&no.value.appendTextToDraft(b.text)}os(u.turnId)}function iT(){Cn.value||!oe.value||($c.value&&(Oc.value=$c.value.id),Za("default"),bu(),bt("Implement",[],[],"steer",[],void 0,"default"))}async function lT(){if(Cn.value||Cs.value||ni.value||!ue.value||Oi.value.length===0)return;const u=uT();try{await MO(u)}catch{}}function uT(){var b,D,J;const u=[],p=((D=(b=ue.value)==null?void 0:b.title)==null?void 0:D.trim())||"Untitled thread";u.push(`# ${cT(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((J=ue.value)==null?void 0:J.id)??""}`),u.push(""),u.push("---"),u.push("");for(const we of Oi.value){const Ue=we.role?we.role.toUpperCase():"MESSAGE";u.push(`## ${Ue}`),u.push("");const zt=we.text.trim();if(zt&&(u.push(zt),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 To of we.fileAttachments)u.push(`- ${To.path}`);u.push("")}if(we.images&&we.images.length>0){u.push("Images:");for(const To of we.images)u.push(`- ${To}`);u.push("")}}return`${u.join(`
|
|
82
|
-
`).trimEnd()}
|
|
83
|
-
`}function cT(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function od(u,p){if(typeof window>"u")return p;const b=window.localStorage.getItem(u);return b===null?p:b==="1"}function dT(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(hv);return u==="light"||u==="dark"?u:"system"}function fT(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(pv);return u==="steer"||u==="queue"?u:"queue"}function pT(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(yv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function hT(){Ma.value=!Ma.value,window.localStorage.setItem(fv,Ma.value?"1":"0")}function mT(){gs.value=gs.value==="steer"?"queue":"steer",window.localStorage.setItem(pv,gs.value)}function vT(){const u=["system","light","dark"],p=u.indexOf(ys.value);ys.value=u[(p+1)%u.length],window.localStorage.setItem(hv,ys.value),Cu()}function gT(){const u=["standard","wide","extra-wide"],p=u.indexOf(Xs.value);Xs.value=u[(p+1)%u.length],window.localStorage.setItem(yv,Xs.value)}function yT(){ws.value=!ws.value,window.localStorage.setItem(mv,ws.value?"1":"0")}function wT(){bs.value=!bs.value,window.localStorage.setItem(vv,bs.value?"1":"0")}async function bT(u){if(!La.value){La.value=!0;try{if(u==="codex"){En.value="codex";const p=await gm(!1);sa.value=p.enabled}else if(u==="openrouter"){En.value="openrouter";const p=await gm(!0);sa.value=p.enabled,await zi("","",{wireApi:Na.value,provider:"openrouter"})}else u==="opencode-zen"?(En.value="opencode-zen",await zi("",Pi.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),sa.value=!0):u==="custom"&&(En.value="custom",Tr.value.trim()&&$n.value.trim()&&(await zi(Tr.value.trim(),$n.value.trim(),{wireApi:Zs.value}),sa.value=!0));On.value="",await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){On.value=p instanceof Error?p.message:"Failed to switch provider"}finally{La.value=!1}}}async function TT(){if(Pn.value)return;const u=Tr.value.trim();if(u){Pn.value=!0;try{On.value="",await zi(u,$n.value.trim(),{wireApi:Zs.value}),sa.value=!0;const p=await vm();p.provider==="custom"&&!p.currentModel&&(On.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){On.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Pn.value=!1}}}async function ST(u){if(Pn.value||La.value||Na.value===u)return;const p=Na.value;Na.value=u,Pn.value=!0;try{On.value="",await zi("","",{wireApi:u,provider:"openrouter"}),sa.value=!0,await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){Na.value=p,On.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Pn.value=!1}}async function CT(){if(Pn.value)return;const u=Pi.value.trim();if(u){Pn.value=!0;try{On.value="",await zi("",u,{wireApi:"responses",provider:"opencode-zen"}),sa.value=!0,await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){On.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Pn.value=!1}}}async function xT(){if(!Pn.value){Pn.value=!0;try{const u=Ts.value.trim();await ym(u),Ts.value="",await rd(),await ne({includeSelectedThreadMessages:!1})}catch{}finally{Pn.value=!1}}}async function kT(){if(!Pn.value){Pn.value=!0;try{await ym(""),Ts.value="",await rd(),await ne({includeSelectedThreadMessages:!1})}catch{}finally{Pn.value=!1}}}async function rd(){try{const u=En.value,p=await vm();sa.value=p.enabled,cu.value=p.customKey??!1,du.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?En.value="opencode-zen":p.provider==="custom"?(En.value="custom",Tr.value=p.customBaseUrl??"",Zs.value=p.wireApi==="chat"?"chat":"responses"):(En.value="openrouter",Na.value=p.wireApi==="chat"?"chat":"responses"):En.value="codex",Oa=p.hasCodexAuth===!0,Oa||(bl=!1);const b=En.value!==u;b&&await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const D=await wp();D&&await ne({includeSelectedThreadMessages:!1,providerChanged:b||D,awaitAncillaryRefreshes:!0})}catch{}}function IT(u){const b=ad(u.trim())||"auto";br.value=b,window.localStorage.setItem(gv,b)}function AT(u){ya(Number(u))}const _T=[{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 PT(){var b;if(typeof window>"u")return"auto";const u=((b=window.localStorage.getItem(gv))==null?void 0:b.trim())||"auto";return ad(u)||"auto"}function ET(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function b(J){const we=q[J]||J;return`${we.charAt(0).toUpperCase()+we.slice(1)} (${J})`}for(const J of typeof navigator<"u"?navigator.languages??[]:[]){const we=ad(J);!we||p.has(we)||(p.add(we),u.push({value:we,label:`${f("Preferred")}: ${b(we)}`}))}for(const J of Object.keys(q))p.has(J)||(p.add(J),u.push({value:J,label:b(J)}));const D=br.value.trim();return D&&!p.has(D)&&u.push({value:D,label:b(D)}),u}function ad(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 Cu(){const u=document.documentElement;if(ys.value==="dark")u.classList.add("dark");else if(ys.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}RT()}function RT(){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 MT=K(()=>({activeSettingsGroup:Ci.value,accounts:Yn.value,isAccountsSectionCollapsed:Zt.value,isRefreshingAccounts:oa.value,isSwitchingAccounts:wr.value,isStartingCodexLogin:ra.value,isCompletingCodexLogin:Nn.value,accountActionError:hn.value,codexLoginUrl:Qs.value,feedbackMailto:Io,isAccountUnavailable:gu,isRemoveConfirmationActive:Vc,isRemoveVisible:Fw,buildAccountTitle:Gw,formatAccountMeta:Tp,formatAccountQuota:Sp,shortAccountId:Ow,isAccountActionDisabled:Dw,getAccountSwitchLabel:Bw,getAccountRemoveLabel:Uw,onRefreshAccounts:Vw,onStartCodexLogin:Yw,onSwitchAccount:Kw,onRemoveAccount:Xw,onAccountCardPointerEnter:zw,onAccountCardPointerLeave:Hw,toggleAccountsSectionCollapsed:as,prepareFeedbackLink:Et,sendWithEnter:Ma.value,inProgressSendMode:gs.value,darkMode:ys.value,uiLanguage:y.value,uiLanguageOptions:S,chatWidthLabel:bw.value,dictationClickToToggle:ws.value,dictationAutoSend:bs.value,dictationLanguage:br.value,dictationLanguageOptions:Rc.value,autoCompactThreshold:qs.value,autoCompactThresholdOptions:_T,hasVisibleFeedbackError:pu.value,selectedProvider:En.value,providerDropdownOptions:Lc.value,freeModeLoading:La.value,providerError:On.value,freeModeHasCustomKey:cu.value,freeModeCustomKey:Ts.value,freeModeCustomKeyMasked:du.value,freeModeCustomKeySaving:Pn.value,openRouterWireApi:Na.value,opencodeZenKey:Pi.value,customEndpointUrl:Tr.value,customEndpointKey:$n.value,customEndpointWireApi:Zs.value,isTelegramConfigOpen:fu.value,telegramStatusText:Sw.value,telegramBotTokenDraft:Ei.value,telegramAllowedUserIdsDraft:Ss.value,telegramConfigError:ia.value,isTelegramSaving:yl.value,supportsHooks:xi.value,isHooksLoading:Ie.value,hooksList:Oe.value,supportsRemoteControl:Ys.value,remoteControlStatus:Pt.value,isRemoteControlActionInFlight:Eo.value,remoteControlError:Go.value,remoteControlNotice:Qr.value,isRemoteControlLoading:cs.value,remoteControlActionName:Gn.value,pairingCode:jt.value,accountRateLimitSnapshots:Je.value,worktreeName:U,appVersion:O,onClose:()=>{rn.value=!1},onActiveSettingsGroupChange:u=>{Ci.value=u},toggleSendWithEnter:hT,cycleInProgressSendMode:mT,cycleDarkMode:vT,onUiLanguageChange:I,cycleChatWidth:gT,toggleDictationClickToToggle:yT,toggleDictationAutoSend:wT,onDictationLanguageChange:IT,onAutoCompactThresholdChange:AT,onProviderChange:bT,onFreeModeCustomKeyChange:u=>{Ts.value=u},clearFreeModeCustomKey:kT,saveFreeModeCustomKey:xT,setOpenRouterWireApi:ST,onOpencodeZenKeyChange:u=>{Pi.value=u},saveOpencodeZen:CT,onCustomEndpointUrlChange:u=>{Tr.value=u},onCustomEndpointKeyChange:u=>{$n.value=u},saveCustomEndpoint:TT,onCustomEndpointWireApiChange:u=>{Zs.value=u},onTelegramConfigOpenChange:u=>{fu.value=u},onTelegramBotTokenDraftChange:u=>{Ei.value=u},onTelegramAllowedUserIdsDraftChange:u=>{Ss.value=u},saveTelegramConfig:Aw,refreshHooks:_e,toggleRemoteControl:Ai,startRemotePairing:Js,refreshRemoteClients:hs,revokeRemoteClient:vl}));function jT(u,p){const b=(u??"").trim();return b.length>0?b:p.trim()||"message"}function Gp(u){Za(u)}async function LT(){await xt.isReady(),vt.name==="thread"&&ti.value?ns(ti.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&ns("",{persist:!1}),await ne({includeSelectedThreadMessages:vt.name==="thread"}),kl({silent:!0}),await nT(),Po.value=!0,await sd(),fr()}async function sd(){if(oo.value){Kr=!0;return}oo.value=!0;try{do{if(Kr=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){oe.value!==""&&await Ke("");continue}if(vt.name==="thread"){const u=ti.value;if(!u)continue;if(oe.value!==u){if(await Ke(u)==="not-found")continue}else $e(u,{silent:!0}).catch(()=>{})}}while(Kr)}finally{oo.value=!1}}nt(()=>[vt.name,ti.value,ce.value,oe.value],async()=>{Po.value&&await sd()}),nt(()=>[oe.value,xn.value],()=>{$b()}),nt(()=>[vt.name,xn.value],([u,p])=>{u==="thread"&&wu(p)},{immediate:!0}),nt(()=>oe.value,async u=>{if(Po.value&&!oo.value&&!(Cn.value||Cs.value||ni.value)){if(!u){vt.name!=="home"&&await xt.replace({name:"home"});return}vt.name==="thread"&&ti.value===u||await xt.replace({name:"thread",params:{threadId:u}})}}),nt(()=>zc.value,u=>{if(u.length===0){ht.value="",Sr();return}const p=ht.value.trim();p&&(u.some(D=>D.value===p)||(ht.value="")),Sr()},{immediate:!0}),nt(()=>ht.value,()=>{He.value={phase:"idle",title:"",message:""},Sr()}),nt(()=>[vt.name,ht.value],([u,p])=>{u==="home"&&wu(p)},{immediate:!0}),nt(oi,u=>{!u&&An.value==="worktree"&&(An.value="local")},{immediate:!0}),nt(()=>[An.value,ht.value],([u,p])=>{u!=="worktree"||!oi.value||Vp(p)},{immediate:!0}),nt(()=>An.value,u=>{var p;if(u==="local"){He.value={phase:"idle",title:"",message:""};const b=ht.value.trim();if(b&&Cp(b)){const D=((p=ue.value)==null?void 0:p.projectName)??No(b),J=Di(D,"");J&&(ht.value=J)}return}oi.value&&Vp(ht.value)}),nt(()=>vt.name,u=>{u!=="home"&&(He.value={phase:"idle",title:"",message:""}),u!=="thread"&&(ro.value=!1)}),nt(()=>oe.value,()=>{He.value={phase:"idle",title:"",message:""}}),nt(()=>[vt.name,xn.value,oi.value],([u,p,b])=>{if(!(u==="thread"||u==="home"&&b)){Np();return}Wo+=1,yo.value={},tn.value="",Mo.value="",Il(p)},{immediate:!0}),nt(ow,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),nt(It,u=>{u&&!_t.value&&dn(!0)},{immediate:!0});async function NT(u,p=[],b=[],D=[]){try{He.value={phase:"idle",title:"",message:""};let J=ht.value;if(An.value==="worktree"){He.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Ue=await uA(ht.value,Wn.value);J=Ue.cwd,ht.value=Ue.cwd,He.value={phase:"idle",title:"",message:""}}catch{He.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!J.trim()){const Ue=await kA(u);J=Ue.cwd,ht.value=Ue.cwd}const we=await yt(u,J,p,b,D);if(!we)return;await xt.replace({name:"thread",params:{threadId:we}}),bu()}catch{}}function OT(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 $T(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function DT(u){var J;if(mr.value)return;mr.value=$T(u);const p=OT(u),b=(J=u.attachedSkills)!=null&&J.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[],D=FO(b,Re.value);try{const we=up.value.trim()||xn.value.trim(),Ue=await yt(p,we,[],D,[]);if(!Ue)return;await xt.replace({name:"thread",params:{threadId:Ue}}),bu()}catch{}finally{mr.value=""}}async function Vp(u){var b;const p=u.trim();if(!p){k.value=[],Wn.value="";return}j.value=!0;try{const D=await dA(p);k.value=D;const J=Wn.value.trim();if(!(J.length>0&&D.some(Ue=>Ue.value===J))){const Ue=D.find(zt=>zt.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{j.value=!1}}return(u,p)=>(P(),B(ct,null,[Be(Nx,{"is-sidebar-collapsed":m(_t),onCloseSidebar:p[37]||(p[37]=b=>m(dn)(!0))},{sidebar:ft(()=>[w("section",BO,[w("div",{ref_key:"sidebarScrollableRef",ref:Ca,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...b)=>m(Gs)&&m(Gs)(...b))},[m(_t)?ve("",!0):(P(),et(Gm,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":m(_t),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=b=>m(dn)(!m(_t))),onStartNewThread:Yc},{default:ft(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":m(qo),"aria-label":m(f)("Search threads"),title:m(f)("Search threads"),onClick:p[0]||(p[0]=(...b)=>m(xa)&&m(xa)(...b))},[Be(Ym,{class:"sidebar-search-toggle-icon"})],8,UO)]),_:1},8,["is-sidebar-collapsed"])),!m(_t)&&m(qo)?(P(),B("div",zO,[Be(Ym,{class:"sidebar-search-bar-icon"}),Mn(w("input",{ref_key:"sidebarSearchInputRef",ref:rs,"onUpdate:modelValue":p[2]||(p[2]=b=>jn(Gt)?Gt.value=b:null),class:"sidebar-search-input",type:"text",placeholder:m(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...b)=>m(_n)&&m(_n)(...b))},null,40,HO),[[Un,m(Gt)]]),m(Gt).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(ka)&&m(ka)(...b))},[Be(hf,{class:"sidebar-search-clear-icon"})],8,qO)):ve("",!0)])):ve("",!0),m(_t)?ve("",!0):(P(),B("button",{key:2,class:ut(["sidebar-skills-link",{"is-active":Cs.value}]),type:"button",onClick:p[5]||(p[5]=b=>{m(xt).push({name:"skills"}),m(It)&&m(dn)(!0)})},[w("span",WO,[Be(Km)]),w("span",GO,[w("span",VO,F(m(f)("Skills")),1),w("span",KO,F(m(f)("Plugins, apps, MCPs")),1)])],2)),m(_t)?ve("",!0):(P(),B("button",{key:3,class:ut(["sidebar-skills-link",{"is-active":ni.value}]),type:"button",onClick:p[6]||(p[6]=b=>{m(xt).push({name:"automations"}),m(It)&&m(dn)(!0)})},[w("span",YO,[Be(Vm)]),w("span",JO,[w("span",QO,F(m(f)("Automations")),1),w("span",XO,F(m(f)("Scheduled work")),1)])],2)),m(_t)?ve("",!0):(P(),et(aR,{key:4,ref_key:"sidebarThreadTreeRef",ref:qn,groups:m(M),"project-display-name-by-id":m(pe),"project-git-repo-by-name":mw.value,"project-cwd-by-name":xp.value,"selected-thread-id":_w.value,"is-loading":m(ce),"is-thread-list-fully-loaded":m(N),"search-query":m(Gt),"search-matched-thread-ids":Yr.value,onSelect:Ew,onArchive:Zw,onStartNewThread:nb,onRenameProject:gb,onBrowseThreadFiles:ob,onSaveThreadProject:lb,onBrowseProjectFiles:sb,onSaveProject:ib,onRequestProjectGitStatus:Tb,onCreateProjectWorktree:hb,onRenameThread:yb,onForkThread:tb,onRemoveProject:wb,onReorderProject:bb,onCopyThreadChat:Nw,onAutomationsChanged:Lw,onRestoreThread:eb,onStartNewChat:vb},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(_t)?ve("",!0):(P(),B("div",{key:0,ref_key:"settingsAreaRef",ref:Vs,class:"sidebar-settings-area",onClick:kb},[rn.value?(P(),et(m(s),qf({key:0,ref_key:"settingsDialogRef",ref:ss},MT.value),null,16)):ve("",!0),w("div",ZO,[w("button",{ref_key:"settingsButtonRef",ref:Ia,class:"sidebar-settings-icon-button",type:"button",title:m(f)("Settings"),"aria-label":m(f)("Settings"),onClick:gt(Ks,["stop"])},[Be(Ij,{class:"sidebar-settings-icon"})],8,e$),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:m(f)("Recycle bin"),"aria-label":m(f)("Recycle bin"),onClick:gt(Ib,["stop"])},[Be(by,{class:"sidebar-settings-icon"})],8,t$)])],512))])]),content:ft(()=>[w("div",n$,[w("section",{class:ut(["content-root",{"is-virtual-keyboard-open":cw.value}]),style:or(Tw.value)},[Sl.value?(P(),B("span",o$)):ve("",!0),Be(cR,{title:tw.value,accent:Cs.value||ni.value},{leading:ft(()=>[m(_t)||m(It)?(P(),et(Gm,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":m(_t),"show-new-thread-button":!0,onToggleSidebar:p[8]||(p[8]=b=>m(dn)(!m(_t))),onStartNewThread:Yc},null,8,["is-sidebar-collapsed"])):ve("",!0),Cs.value?(P(),B("span",r$,[Be(Km)])):ni.value?(P(),B("span",a$,[Be(Vm)])):ve("",!0)]),actions:ft(()=>[mu.value?(P(),B("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":m(It)?m(Yt)?m(f)("Close side panel"):m(f)("Open side panel"):m(mo)?m(f)("Open side panel"):m(f)("Close side panel"),title:m(It)?m(Yt)?m(f)("Close side panel"):m(f)("Open side panel"):m(mo)?m(f)("Open side panel"):m(f)("Close side panel"),onClick:p[9]||(p[9]=(...b)=>m(Wr)&&m(Wr)(...b))},[Be(Ty,{class:"content-header-right-panel-toggle-icon"})],8,s$)):ve("",!0)]),_:1},8,["title","accent"]),w("section",i$,[Cs.value?(P(),et(m(r),{key:0,ref_key:"directoryHubRef",ref:ko,cwd:up.value,"thread-id":ti.value,"try-in-flight-key":mr.value,onSkillsChanged:Cw,onTryItem:DT},null,8,["cwd","thread-id","try-in-flight-key"])):ni.value?(P(),et(m(a),{key:1,ref_key:"automationsPanelRef",ref:sn,groups:m(M),"project-cwd-by-name":xp.value,"project-display-name-by-id":m(pe),"selected-automation-id":sp.value,onSelectAutomation:Rw,onEditAutomation:Mw,onCreateAutomation:jw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):Cn.value?(P(),B("div",l$,[w("div",u$,[w("p",c$,F(m(f)("Let's build")),1),Be(yi,{class:"new-thread-folder-dropdown","model-value":ht.value,options:zc.value,placeholder:m(f)("Choose folder"),"enable-search":!0,"search-placeholder":m(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":Pb},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,d$)):ve("",!0),w("div",f$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Yb},F(m(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:Db},F(m(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:fe.value,onClick:Wb},F(fe.value?m(f)("Importing…"):m(f)("Import Project")),9,p$),w("input",{ref_key:"projectImportInputRef",ref:mt,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:Kb},null,544)]),ja.value?(P(),B("section",h$,[w("div",m$,[w("div",v$,[w("span",g$,[Be(Ic)]),w("p",y$,F(m(f)("New in Codex")),1)]),w("h2",w$,F(m(f)("Plugins are here")),1),w("p",b$,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",T$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:fw},F(m(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:dp},F(m(f)("Dismiss")),1)])])):ve("",!0),(P(),et(sl,{to:"body"},[lt.value?(P(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(Fb,["self"]),onMouseup:Bb},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":m(f)("Select folder"),onKeydown:So(gt(Fi,["prevent"]),["esc"])},[w("div",C$,[w("p",x$,F(m(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Fi},F(m(f)("Cancel")),1)]),w("p",k$,F(m(f)("Current folder")),1),w("div",I$,[Mn(w("input",{ref_key:"existingFolderPathInputRef",ref:St,"onUpdate:modelValue":p[10]||(p[10]=b=>Sn.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:m(f)("Current folder"),title:Sn.value||m(f)("Unavailable"),disabled:Dn.value||bo.value,onBlur:Zb,onKeydown:[So(gt(eT,["prevent"]),["enter"]),So(gt(Fi,["prevent"]),["esc"])]},null,40,A$),[[Un,Sn.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!xl.value||Dn.value||bo.value,onClick:p[11]||(p[11]=b=>ed())},F(bo.value?m(f)("Opening…"):m(f)("Open")),9,_$)]),w("div",P$,[w("label",E$,[Mn(w("input",{"onUpdate:modelValue":p[12]||(p[12]=b=>Ri.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Qb},null,544),[[uC,Ri.value]]),w("span",null,F(m(f)("Show hidden folders")),1)]),w("button",{class:ut(["new-thread-folder-action",{"new-thread-folder-action-primary":la.value}]),type:"button","aria-pressed":la.value,disabled:!wo.value||Dn.value||bo.value||A.value||!!Rn.value&&!la.value,onClick:tT},F(m(f)("New folder")),11,R$)]),la.value?(P(),B("div",M$,[w("div",j$,[Mn(w("input",{ref_key:"createFolderInputRef",ref:uu,"onUpdate:modelValue":p[13]||(p[13]=b=>h.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:m(f)("Folder name"),onKeydown:[So(gt(Dp,["prevent"]),["enter"]),So(gt(Al,["prevent"]),["esc"])]},null,40,L$),[[Un,h.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!vw.value||A.value,onClick:Dp},F(gw.value),9,N$)]),g.value?(P(),B("div",O$,[w("span",null,F(g.value),1),w("a",{class:"visible-error-feedback",href:m(Io),onClick:p[14]||(p[14]=b=>Et(b,g.value))},F(m(f)("Send feedback")),9,$$)])):ve("",!0)])):ve("",!0),Mn(w("input",{ref_key:"existingFolderFilterInputRef",ref:Vt,"onUpdate:modelValue":p[15]||(p[15]=b=>er.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:m(f)("Filter folders..."),onKeydown:So(gt(Fi,["prevent"]),["esc"])},null,40,D$),[[Un,er.value]]),Rn.value?(P(),B("div",F$,[w("div",B$,[w("span",null,F(Rn.value),1),w("a",{class:"visible-error-feedback",href:m(Io),onClick:p[16]||(p[16]=b=>Et(b,Rn.value))},F(m(f)("Send feedback")),9,U$)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Dn.value||bo.value,onClick:Xb},F(m(f)("Retry")),9,z$)])):ve("",!0),Dn.value?(P(),B("p",H$,F(m(f)("Loading folders…")),1)):!Rn.value&&qc.value.length===0?(P(),B("p",q$,F(er.value.trim()?m(f)("No folders match this filter."):m(f)("No subfolders found here.")),1)):qc.value.length>0?(P(),B("ul",W$,[(P(!0),B(ct,null,on(qc.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:Dn.value||bo.value,onClick:D=>Jb(b.path)},[w("span",V$,F(b.name),1)],8,G$),b.kind==="directory"?(P(),B("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Dn.value||bo.value,onClick:D=>ed(b.path)},F(m(f)("Open")),9,K$)):ve("",!0)]))),128))])):ve("",!0)],40,S$)],32)):ve("",!0)])),(P(),et(sl,{to:"body"},[L.value?(P(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(Ub,["self"]),onMouseup:zb},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Create or clone project"),onKeydown:So(gt(Tu,["prevent"]),["esc"])},[w("div",J$,[w("p",Q$,F(m(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:Fe.value,onClick:Tu},F(m(f)("Cancel")),9,X$)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":m(f)("Project source")},[w("button",{class:ut(["new-thread-project-mode-tab",{"is-active":z.value==="create"}]),type:"button",role:"tab","aria-selected":z.value==="create",disabled:Fe.value,onClick:p[17]||(p[17]=b=>z.value="create")},F(m(f)("New project")),11,eD),w("button",{class:ut(["new-thread-project-mode-tab",{"is-active":z.value==="clone"}]),type:"button",role:"tab","aria-selected":z.value==="clone",disabled:Fe.value,onClick:p[18]||(p[18]=b=>z.value="clone")},F(m(f)("Clone from GitHub")),11,tD)],8,Z$),w("label",nD,[w("span",oD,F(m(f)("Destination folder")),1),Mn(w("input",{"onUpdate:modelValue":p[19]||(p[19]=b=>X.value=b),class:"new-thread-open-folder-path",type:"text",disabled:Fe.value,placeholder:m(f)("Destination folder")},null,8,rD),[[Un,X.value]])]),z.value==="create"?(P(),B("label",aD,[w("span",sD,F(m(f)("Project name")),1),Mn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:it,"onUpdate:modelValue":p[20]||(p[20]=b=>W.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:Fe.value,placeholder:m(f)("Project name"),onKeydown:So(gt(Zc,["prevent"]),["enter"])},null,40,iD),[[Un,W.value]])])):z.value==="clone"?(P(),B("label",lD,[w("span",uD,F(m(f)("GitHub repository URL")),1),Mn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:it,"onUpdate:modelValue":p[21]||(p[21]=b=>ee.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:Fe.value,placeholder:"https://github.com/owner/repo",onKeydown:So(gt(Zc,["prevent"]),["enter"])},null,40,cD),[[Un,ee.value]])])):ve("",!0),ke.value?(P(),B("div",dD,[w("span",null,F(ke.value),1),w("a",{class:"visible-error-feedback",href:m(Io),onClick:p[22]||(p[22]=b=>Et(b,ke.value))},F(m(f)("Send feedback")),9,fD)])):ve("",!0),w("div",pD,[w("button",{class:"new-thread-folder-action",type:"button",disabled:Fe.value,onClick:Tu},F(m(f)("Cancel")),9,hD),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!gp.value||Fe.value,onClick:Zc},F(yw.value),9,mD)])],40,Y$)],32)):ve("",!0)])),oi.value?(P(),et(nj,{key:2,class:"new-thread-runtime-dropdown",modelValue:An.value,"onUpdate:modelValue":p[23]||(p[23]=b=>An.value=b)},null,8,["modelValue"])):ve("",!0),An.value==="worktree"?(P(),B("div",vD,[w("p",gD,F(m(f)("Base branch")),1),Be(yi,{class:"new-thread-branch-dropdown","model-value":Wn.value,options:Hc.value,placeholder:m(f)("Select branch"),"enable-search":!0,"search-placeholder":m(f)("Search branches..."),disabled:j.value||Hc.value.length===0,"onUpdate:modelValue":Eb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",yD,F(j.value?m(f)("Loading branches…"):pp.value?m(f)("New worktree branch will start from {branch}.",{branch:pp.value}):m(f)("No Git branches found for this folder.")),1)])):ve("",!0),oi.value?(P(),B("p",wD,F(m(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ve("",!0),He.value.phase!=="idle"?(P(),B("div",{key:5,class:ut(["worktree-init-status",{"is-running":He.value.phase==="running","is-error":He.value.phase==="error"}])},[w("strong",bD,F(He.value.title),1),w("span",TD,F(He.value.message),1)],2)):ve("",!0)]),w("div",SD,[m(xe)?(P(),B("div",CD,[w("span",null,F(m(f)(m(xe))),1),w("a",{class:"visible-error-feedback",href:m(Io),onClick:p[24]||(p[24]=b=>Et(b,m(xe)))},F(m(f)("Send feedback")),9,xD)])):ve("",!0),Be(Wm,{ref_key:"homeThreadComposerRef",ref:pr,"active-thread-id":xs.value,cwd:xn.value,"fuzzy-file-search-results":m(st),onRegisterFuzzySession:m(Y),"collaboration-modes":m(Ae),"selected-collaboration-mode":m(Le),models:m(De),"model-reasoning-efforts":m(Ne),"selected-model":lp.value,"selected-reasoning-effort":m(Ce),"selected-speed-mode":m(Se),"is-updating-speed-mode":m(H),skills:m(Re),"thread-token-usage":m(V),"codex-quota":m(me),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":Ma.value,"in-progress-submit-mode":gs.value,"dictation-click-to-toggle":ws.value,"dictation-auto-send":bs.value,"dictation-language":br.value,onSubmit:Lp,"onUpdate:selectedCollaborationMode":Gp,"onUpdate:selectedModel":zp,"onUpdate:selectedReasoningEffort":Hp,"onUpdate:selectedSpeedMode":qp,"approval-policy":Aa.value,"is-approval-policy-saving":Vo.value,"approval-policy-error":Ko.value,"approval-policy-notice":Yo.value,"onUpdate:approvalPolicy":Jo,onSaveApprovalPolicy:ea,onSlashCommand:Wp},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",kD,[ro.value&&m(oe)&&xn.value?(P(),et(m(o),{key:0,"thread-id":m(oe),cwd:xn.value,"is-thread-in-progress":Dc.value,"initial-file-path":vo.value,"commit-sha":Ro.value,onClose:p[25]||(p[25]=b=>ro.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):ve("",!0),w("div",ID,[Be(m(t),{ref_key:"threadConversationRef",ref:yn,messages:rw.value,"is-loading":m(re),"is-slow-open":m(se)!==null&&m(se)===xs.value,"active-thread-id":xs.value,cwd:xn.value,"live-overlay":iw.value,"live-turn-id":m(Z),"pending-requests":m(ie),"has-more-persisted-above":m(at),"is-loading-persisted-above":m(je),"load-earlier-messages":m(Ge),onForkThread:Cb,onRollback:sT,onFileChangesChanged:xw,onRespondServerRequest:_p},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:gn},[cp.value?(P(),B("div",AD,F(m(f)("This thread is running in the Codex TUI")),1)):ve("",!0),m(xe)?(P(),B("div",_D,[w("span",null,F(m(f)(m(xe))),1),w("a",{class:"visible-error-feedback",href:m(Io),onClick:p[26]||(p[26]=b=>Et(b,m(xe)))},F(m(f)("Send feedback")),9,PD)])):ve("",!0),Be(m(v),{messages:m(ur),onEdit:_b,onSteer:m(cr),onDelete:m(eo),onReorder:rT},null,8,["messages","onSteer","onDelete"]),_l.value?(P(),B("div",ED,[w("span",null,F(_l.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":m(f)("Dismiss"),onClick:p[27]||(p[27]=b=>_l.value="")}," × ",8,RD)])):ve("",!0),hu.value?(P(),et(m(d),{key:3,request:hu.value,"request-count":m(ie).length,"has-queue-above":m(ur).length>0,"panel-width":Bo.value,"visual-viewport-height":Sl.value?ua.value:0,"panel-error":lw.value,onRespondServerRequest:_p},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(P(),et(Wm,{key:4,ref_key:"threadComposerRef",ref:no,"active-thread-id":xs.value,cwd:xn.value,"fuzzy-file-search-results":m(st),onRegisterFuzzySession:m(Y),"collaboration-modes":m(Ae),"selected-collaboration-mode":m(Le),models:m(De),"model-reasoning-efforts":m(Ne),"selected-model":lp.value,"selected-reasoning-effort":m(Ce),"selected-speed-mode":m(Se),"is-updating-speed-mode":m(H),skills:m(Re),"thread-token-usage":m(V),"codex-quota":m(me),"is-turn-in-progress":Dc.value,"is-stop-pending":m(R),"is-interrupting-turn":m(_),"is-compacting":dw.value,"external-session-active":cp.value,"has-queue-above":m(ur).length>0,"send-with-enter":Ma.value,"in-progress-submit-mode":gs.value,"dictation-click-to-toggle":ws.value,"dictation-auto-send":bs.value,"dictation-language":br.value,"onUpdate:selectedCollaborationMode":Gp,onSubmit:Lp,"onUpdate:selectedModel":zp,"onUpdate:selectedReasoningEffort":Hp,"onUpdate:selectedSpeedMode":qp,"approval-policy":Aa.value,"is-approval-policy-saving":Vo.value,"approval-policy-error":Ko.value,"approval-policy-notice":Yo.value,"onUpdate:approvalPolicy":Jo,onSaveApprovalPolicy:ea,"plan-panel":$c.value,onInterrupt:aT,onSlashCommand:Wp,onImplementPlan:iT,onCompactContext:pw},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(It)&&m(Yt)?(P(),B("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...b)=>m(bn)&&m(bn)(...b))})):ve("",!0),mu.value&&(m(It)||!m(mo))?(P(),B("aside",{key:1,class:ut(["content-right-panel",{"is-mobile-open":m(Yt)}]),style:or({"--right-panel-width":`${m(un)}px`})},[m(It)?ve("",!0):(P(),B("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:p[29]||(p[29]=(...b)=>m(zo)&&m(zo)(...b))},null,32)),w("div",MD,[w("div",jD,[w("button",{class:ut(["content-right-panel-tab",{"is-active":m(Ft)==="git"}]),type:"button",role:"tab","aria-selected":m(Ft)==="git",onClick:p[30]||(p[30]=b=>m(Wt)("git"))},[Be(ac,{class:"content-right-panel-tab-icon"}),Os(" "+F(m(f)("Git")),1)],10,LD),w("button",{class:ut(["content-right-panel-tab",{"is-active":m(Ft)==="files"}]),type:"button",role:"tab","aria-selected":m(Ft)==="files",onClick:p[31]||(p[31]=b=>m(Wt)("files"))},[Be(Jm,{class:"content-right-panel-tab-icon"}),Os(" "+F(m(f)("Files")),1)],10,ND),(P(!0),B(ct,null,on(m(hr),b=>(P(),B("button",{key:b.key,class:ut(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":m(Ft)==="preview"&&m(Br)===b.key}]),type:"button",role:"tab","aria-selected":m(Ft)==="preview"&&m(Br)===b.key,title:b.path,onClick:D=>m(qr)(b.key)},[Be(fl,{class:"content-right-panel-tab-icon"}),w("span",$D,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(At)(b.key),["stop"])},"×",8,DD)],10,OD))),128))]),w("div",FD,[w("div",BD,[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=>wn.value=!m(wn),["stop"]))},"+",8,UD),Be(iu,{name:"right-panel-menu"},{default:ft(()=>[m(wn)?(P(),B("div",zD,[w("button",{type:"button",onClick:p[33]||(p[33]=b=>m(Wt)("terminal"))},[Be(Ej,{class:"content-right-panel-menu-icon"}),Os(" "+F(m(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=b=>m(Wt)("git"))},[Be(ac,{class:"content-right-panel-menu-icon"}),Os(" "+F(m(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=b=>m(Wt)("files"))},[Be(Jm,{class:"content-right-panel-menu-icon"}),Os(" "+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(bn)&&m(bn)(...b))},[Be(hf,{class:"content-right-panel-close-icon"})],8,HD)])]),w("div",qD,[m(Ft)==="git"?(P(),et(m(i),{key:0,"current-branch":go.value,"head-sha":ta.value,"head-subject":C.value,"head-date":E.value,detached:x.value,dirty:Q.value,"worktree-change-summary":Qe.value,"worktree-changes":Ut.value,branches:Qo.value,"commits-by-branch":yo.value,"commits-loading-for":tn.value,"commits-error":Mo.value,"commit-files-by-sha":_a.value,"commit-files-loading-for":na.value,"commit-files-error":ms.value,loading:vs.value,busy:Pa.value,error:Kn.value,"review-open":ro.value,"show-review":m(vt).name==="thread"&&m(oe).length>0,onToggleReview:Ob,onCheckoutBranch:Mb,onResetBranchToCommit:jb,onLoadCommits:$p,onLoadCommitFiles:Lb,onOpenCommitFile:Nb},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(Ft)==="files"?(P(),et(m(l),{key:1,cwd:xn.value,onOpenPreview:m(Hr)},null,8,["cwd","onOpenPreview"])):m(Ft)==="preview"&&m(Ur)?(P(),et(m(c),{key:2,"file-path":m(Ur).path,name:m(Ur).label},null,8,["file-path","name"])):(P(),et(m(n),{key:3,ref_key:"threadTerminalPanelRef",ref:ba,"thread-id":xs.value,cwd:xn.value,onHide:m(Ao),onTerminalFocusChange:m(_o)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),be.value.phase!=="idle"?(P(),B("div",WD,[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",VD,[w("h2",KD,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:Ip}," × ",8,YD)]),w("p",JD,F(be.value.phase==="exporting"?m(f)("Preparing project ZIP..."):be.value.fileName),1),w("div",QD,[w("span",null,F(be.value.phase==="exporting"?m(f)("Exporting"):m(f)("Ready")),1),w("span",null,F(Mc.value),1)]),w("div",XD,[w("div",{class:"project-zip-progress-fill",style:or({width:jc.value})},null,4)]),be.value.error?(P(),B("p",ZD,F(be.value.error),1)):ve("",!0),w("div",eF,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:be.value.phase==="exporting",onClick:Ip},F(m(f)("Close")),9,tF),w("button",{class:"project-zip-modal-action",type:"button",disabled:!be.value.blob,onClick:fb},F(m(f)("Download")),9,nF),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!be.value.blob,onClick:pb},F(m(f)("Share")),9,oF)])],8,GD)])):ve("",!0),_i.value?(P(),B("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Kc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Complete Codex login"),onSubmit:gt(Jw,["prevent"]),onClick:p[41]||(p[41]=gt(()=>{},["stop"]))},[w("div",aF,[w("h2",sF,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:Kc}," × ",8,iF)]),w("p",lF,F(m(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),Qs.value?(P(),B("a",{key:0,class:"codex-login-modal-link",href:Qs.value,target:"_blank",rel:"noreferrer"},F(m(f)("Open login URL")),9,uF)):ve("",!0),Mn(w("input",{ref_key:"codexLoginCallbackInputRef",ref:gl,"onUpdate:modelValue":p[39]||(p[39]=b=>Ea.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:m(f)("Paste localhost callback URL"),disabled:Nn.value},null,8,cF),[[Un,Ea.value]]),hn.value?(P(),B("div",dF,[w("span",null,F(hn.value),1),w("a",{class:"visible-error-feedback",href:m(Io),onClick:p[40]||(p[40]=b=>Et(b,hn.value))},F(m(f)("Send feedback")),9,fF)])):ve("",!0),w("div",pF,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:Nn.value,onClick:Kc},F(m(f)("Cancel")),9,hF),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:Nn.value||Ea.value.trim().length===0},F(Nn.value?m(f)("Completing…"):m(f)("Complete")),9,mF)])],40,rF)])):ve("",!0)],64))}}),yF=Ct(gF,[["__scopeId","data-v-8c5e7e25"]]),Fu={render:()=>null},wF=Ax({history:ax(),routes:[{path:"/",name:"home",component:Fu},{path:"/thread/:threadId",name:"thread",component:Fu},{path:"/skills",name:"skills",component:Fu},{path:"/automations",name:"automations",component:Fu},{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");m_();vC(yF).use(wF).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(py("Service worker registration failed."),e)})});export{tB as $,ac as A,Co as B,Fs as C,Mu as D,Xj as E,ct as F,AF as G,xr as H,hf as I,Yf as J,Dt as K,Ti as L,bF as M,Ff as N,vR as O,So as P,MA as Q,xI as R,xF as S,sl as T,SF as U,kF as V,CF as W,IF as X,yi as Y,ZF as Z,Ct as _,MO as a,eB as a0,op as a1,Mn as a2,Un as a3,Px as a4,_x as a5,nB as a6,hI as a7,NF as a8,_F as a9,fl as aA,uC as aB,QF as aC,XF as aD,PF as aa,EF as ab,BF as ac,WF as ad,GF as ae,OF as af,qF as ag,MF as ah,RF as ai,jF as aj,LF as ak,VF as al,YF as am,JF as an,$F as ao,DF as ap,FF as aq,UF as ar,HF as as,zF as at,KF as au,zx as av,Hx as aw,Ic as ax,_R as ay,TF as az,RO as b,K as c,Qm as d,vn as e,P as f,Wf as g,et as h,B as i,w as j,ve as k,on as l,Os as m,ut as n,Hs as o,Be as p,iu as q,T as r,ft as s,F as t,m as u,va as v,gt as w,nt as x,or as y,gy as z};
|