codex-mobile-re 0.1.127 → 0.1.129

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.
Files changed (42) hide show
  1. package/LICENSE +11 -11
  2. package/README.md +214 -214
  3. package/dist/assets/{AutomationsPanel-MrvbWVMR.js → AutomationsPanel-DNsTBfFe.js} +1 -1
  4. package/dist/assets/{AutomationsPanel-B7eVtPih.css → AutomationsPanel-Dz1E0PMi.css} +1 -1
  5. package/dist/assets/{DirectoryHub-CP5GVedy.css → DirectoryHub-DcMzIMOW.css} +1 -1
  6. package/dist/assets/{DirectoryHub-ky-MNTyn.js → DirectoryHub-DjzGaPq6.js} +2 -2
  7. package/dist/assets/{QueuedMessages-CYYFZ0w1.css → QueuedMessages-D6bvkQIC.css} +1 -1
  8. package/dist/assets/{QueuedMessages-D1zNlWJ3.js → QueuedMessages-DNVDZvsM.js} +1 -1
  9. package/dist/assets/{ReviewPane-76bdhZJV.css → ReviewPane-BFBDQWlW.css} +1 -1
  10. package/dist/assets/{ReviewPane-Dgmjqhm5.js → ReviewPane-DLogJNGk.js} +1 -1
  11. package/dist/assets/{RightFilePreview-CYPdkP5X.js → RightFilePreview-DIz4AIh6.js} +1 -1
  12. package/dist/assets/{RightFilePreview-JKcCwln_.css → RightFilePreview-DNZDBkBr.css} +1 -1
  13. package/dist/assets/{RightFilesPanel-DZUnVVyu.js → RightFilesPanel-C7leH782.js} +1 -1
  14. package/dist/assets/{RightFilesPanel-BQYjjDQ4.css → RightFilesPanel-ev__hRb5.css} +1 -1
  15. package/dist/assets/{RightGitPanel-Blhf_dam.js → RightGitPanel-BaFysyCQ.js} +2 -2
  16. package/dist/assets/{RightGitPanel-Dxufp9aB.css → RightGitPanel-CQgG9pXB.css} +1 -1
  17. package/dist/assets/{SettingsDialog-BGT0xELN.js → SettingsDialog-BRMjc7tX.js} +3 -3
  18. package/dist/assets/{SettingsDialog-DKsOfSTw.css → SettingsDialog-C6mYdSFF.css} +1 -1
  19. package/dist/assets/ThreadConversation-BB19p4J3.js +39 -0
  20. package/dist/assets/{ThreadConversation-Dpnahm_f.css → ThreadConversation-BEc1XQXz.css} +1 -1
  21. package/dist/assets/{ThreadPendingRequestPanel-DKioGHoo.css → ThreadPendingRequestPanel-BlBoJVzv.css} +1 -1
  22. package/dist/assets/{ThreadPendingRequestPanel-CiFTnhF6.js → ThreadPendingRequestPanel-rVtQUq_G.js} +1 -1
  23. package/dist/assets/{ThreadTerminalPanel-D13KPZ88.js → ThreadTerminalPanel-BPYLKihX.js} +2 -2
  24. package/dist/assets/{ThreadTerminalPanel-O0PkQIRl.css → ThreadTerminalPanel-DkX7vTl_.css} +1 -1
  25. package/dist/assets/common-DEPjExR-.js +5 -0
  26. package/dist/assets/{index-C2Pxi7u9.css → index-DI_rCYF6.css} +1 -1
  27. package/dist/assets/index-rc4ZsEIH.js +83 -0
  28. package/dist/assets/{index.esm-Cls06s1L.js → index.esm-Cxn_LBGD.js} +1 -1
  29. package/dist/icons/codexui-icon.svg +52 -52
  30. package/dist/icons/pwa-icon.svg +38 -38
  31. package/dist/icons/pwa-maskable.svg +36 -36
  32. package/dist/index.html +45 -45
  33. package/dist/manifest.webmanifest +36 -36
  34. package/dist/sw.js +92 -92
  35. package/dist-cli/index.js +3441 -2889
  36. package/dist-cli/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/scripts/dev-random-home.cjs +21 -21
  39. package/scripts/dev.cjs +69 -69
  40. package/dist/assets/ThreadConversation-9sr4DxKg.js +0 -39
  41. package/dist/assets/common-BeuopZEI.js +0 -5
  42. package/dist/assets/index-CkZzIAPA.js +0 -84
@@ -1,84 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-9sr4DxKg.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-Dpnahm_f.css","assets/ThreadTerminalPanel-D13KPZ88.js","assets/ThreadTerminalPanel-O0PkQIRl.css","assets/ReviewPane-Dgmjqhm5.js","assets/ReviewPane-76bdhZJV.css","assets/DirectoryHub-ky-MNTyn.js","assets/DirectoryHub-CP5GVedy.css","assets/AutomationsPanel-MrvbWVMR.js","assets/AutomationsPanel-B7eVtPih.css","assets/SettingsDialog-BGT0xELN.js","assets/SettingsDialog-DKsOfSTw.css","assets/RightGitPanel-Blhf_dam.js","assets/RightGitPanel-Dxufp9aB.css","assets/RightFilesPanel-DZUnVVyu.js","assets/RightFilesPanel-BQYjjDQ4.css","assets/RightFilePreview-CYPdkP5X.js","assets/RightFilePreview-JKcCwln_.css","assets/ThreadPendingRequestPanel-CiFTnhF6.js","assets/ThreadPendingRequestPanel-DKioGHoo.css","assets/QueuedMessages-D1zNlWJ3.js","assets/QueuedMessages-CYYFZ0w1.css"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
3
- * @vue/shared v3.5.41
4
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
- * @license MIT
6
- **/function Ef(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Dt={},Yi=[],ya=()=>{},Tv=()=>!1,fc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),pc=e=>e.startsWith("onUpdate:"),wn=Object.assign,Rf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},UT=Object.prototype.hasOwnProperty,Mt=(e,t)=>UT.call(e,t),at=Array.isArray,Ji=e=>tu(e)==="[object Map]",hc=e=>tu(e)==="[object Set]",eh=e=>tu(e)==="[object Date]",ht=e=>typeof e=="function",Wt=e=>typeof e=="string",jo=e=>typeof e=="symbol",jt=e=>e!==null&&typeof e=="object",Sv=e=>(jt(e)||ht(e))&&ht(e.then)&&ht(e.catch),Cv=Object.prototype.toString,tu=e=>Cv.call(e),zT=e=>tu(e).slice(8,-1),xv=e=>tu(e)==="[object Object]",Mf=e=>Wt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Dl=Ef(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),mc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},HT=/-\w/g,pr=mc(e=>e.replace(HT,t=>t.slice(1).toUpperCase())),qT=/\B([A-Z])/g,Ns=mc(e=>e.replace(qT,"-$1").toLowerCase()),vc=mc(e=>e.charAt(0).toUpperCase()+e.slice(1)),dd=mc(e=>e?`on${vc(e)}`:""),_o=(e,t)=>!Object.is(e,t),Uu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},kv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},jf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},WT=e=>{const t=Wt(e)?Number(e):NaN;return isNaN(t)?e:t};let th;const gc=()=>th||(th=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Jr(e){if(at(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Wt(r)?YT(r):Jr(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(Wt(e)||jt(e))return e}const GT=/;(?![^(]*\))/g,VT=/:([^]+)/,KT=/\/\*[^]*?\*\//g;function YT(e){const t={};return e.replace(KT,"").split(GT).forEach(n=>{if(n){const r=n.split(VT);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function dt(e){let t="";if(Wt(e))t=e;else if(at(e))for(let n=0;n<e.length;n++){const r=dt(e[n]);r&&(t+=r+" ")}else if(jt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const JT="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",QT=Ef(JT);function Iv(e){return!!e||e===""}function XT(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=nu(e[r],t[r]);return n}function nu(e,t){if(e===t)return!0;let n=eh(e),r=eh(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=jo(e),r=jo(t),n||r)return e===t;if(n=at(e),r=at(t),n||r)return n&&r?XT(e,t):!1;if(n=jt(e),r=jt(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!nu(e[s],t[s]))return!1}}return String(e)===String(t)}function Av(e,t){return e.findIndex(n=>nu(n,t))}const _v=e=>!!(e&&e.__v_isRef===!0),F=e=>Wt(e)?e:e==null?"":at(e)||jt(e)&&(e.toString===Cv||!ht(e.toString))?_v(e)?F(e.value):JSON.stringify(e,Pv,2):String(e),Pv=(e,t)=>_v(t)?Pv(e,t.value):Ji(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[fd(r,a)+" =>"]=o,n),{})}:hc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>fd(n))}:jo(t)?fd(t):jt(t)&&!at(t)&&!xv(t)?String(t):t,fd=(e,t="")=>{var n;return jo(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
- * @vue/reactivity v3.5.41
8
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
- * @license MIT
10
- **/let $n;class ZT{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&&$n&&($n.active?(this.parent=$n,this.index=($n.scopes||($n.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const r=this.effects.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}}run(t){if(this._active){const n=$n;try{return $n=this,t()}finally{$n=n}}}on(){++this._on===1&&(this.prevScope=$n,$n=this)}off(){if(this._on>0&&--this._on===0){if($n===this)$n=this.prevScope;else{let t=$n;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,r=o.length;n<r;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function eS(){return $n}let zt;const pd=new WeakSet;class Ev{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,$n&&($n.active?$n.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,pd.has(this)&&(pd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Mv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nh(this),jv(this);const t=zt,n=Ro;zt=this,Ro=!0;try{return this.fn()}finally{Lv(this),zt=t,Ro=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Of(t);this.deps=this.depsTail=void 0,nh(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?pd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Vd(this)&&this.run()}get dirty(){return Vd(this)}}let Rv=0,Fl,Bl;function Mv(e,t=!1){if(e.flags|=8,t){e.next=Bl,Bl=e;return}e.next=Fl,Fl=e}function Lf(){Rv++}function Nf(){if(--Rv>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(r){e||(e=r)}t=n}}if(e)throw e}function jv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Lv(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Of(r),tS(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Vd(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Nv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Nv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Gl)||(e.globalVersion=Gl,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Vd(e))))return;e.flags|=2;const t=e.dep,n=zt,r=Ro;zt=e,Ro=!0;try{jv(e);const o=e.fn(e._value);(t.version===0||_o(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{zt=n,Ro=r,Lv(e),e.flags&=-3}}function Of(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Of(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function tS(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Ro=!0;const Ov=[];function Va(){Ov.push(Ro),Ro=!1}function Ka(){const e=Ov.pop();Ro=e===void 0?!0:e}function nh(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=zt;zt=void 0;try{t()}finally{zt=n}}}let Gl=0;class nS{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 $f{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(!zt||!Ro||zt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==zt)n=this.activeLink=new nS(zt,this),zt.deps?(n.prevDep=zt.depsTail,zt.depsTail.nextDep=n,zt.depsTail=n):zt.deps=zt.depsTail=n,$v(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=zt.depsTail,n.nextDep=void 0,zt.depsTail.nextDep=n,zt.depsTail=n,zt.deps===n&&(zt.deps=r)}return n}trigger(t){this.version++,Gl++,this.notify(t)}notify(t){Lf();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Nf()}}}function $v(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)$v(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Kd=new WeakMap,Ti=Symbol(""),Yd=Symbol(""),Vl=Symbol("");function er(e,t,n){if(Ro&&zt){let r=Kd.get(e);r||Kd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new $f),o.map=r,o.key=n),o.track()}}function za(e,t,n,r,o,a){const s=Kd.get(e);if(!s){Gl++;return}const i=l=>{l&&l.trigger()};if(Lf(),t==="clear")s.forEach(i);else{const l=at(e),c=l&&Mf(n);if(l&&n==="length"){const d=Number(r);s.forEach((v,f)=>{(f==="length"||f===Vl||!jo(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(Ti)),Ji(e)&&i(s.get(Yd)));break;case"delete":l||(i(s.get(Ti)),Ji(e)&&i(s.get(Yd)));break;case"set":Ji(e)&&i(s.get(Ti));break}}Nf()}function Bi(e){const t=Et(e);return t===e?t:(er(t,"iterate",Vl),Qr(e)?t:t.map(Lo))}function yc(e){return er(e=Et(e),"iterate",Vl),e}function ma(e,t){return Ya(e)?ol(Si(e)?Lo(t):t):Lo(t)}const rS={__proto__:null,[Symbol.iterator](){return hd(this,Symbol.iterator,e=>ma(this,e))},concat(...e){return Bi(this).concat(...e.map(t=>at(t)?Bi(t):t))},entries(){return hd(this,"entries",e=>(e[1]=ma(this,e[1]),e))},every(e,t){return Oa(this,"every",e,t,void 0,arguments)},filter(e,t){return Oa(this,"filter",e,t,n=>n.map(r=>ma(this,r)),arguments)},find(e,t){return Oa(this,"find",e,t,n=>ma(this,n),arguments)},findIndex(e,t){return Oa(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Oa(this,"findLast",e,t,n=>ma(this,n),arguments)},findLastIndex(e,t){return Oa(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Oa(this,"forEach",e,t,void 0,arguments)},includes(...e){return md(this,"includes",e)},indexOf(...e){return md(this,"indexOf",e)},join(e){return Bi(this).join(e)},lastIndexOf(...e){return md(this,"lastIndexOf",e)},map(e,t){return Oa(this,"map",e,t,void 0,arguments)},pop(){return Pl(this,"pop")},push(...e){return Pl(this,"push",e)},reduce(e,...t){return rh(this,"reduce",e,t)},reduceRight(e,...t){return rh(this,"reduceRight",e,t)},shift(){return Pl(this,"shift")},some(e,t){return Oa(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 hd(this,"values",e=>ma(this,e))}};function hd(e,t,n){const r=yc(e),o=r[t]();return r!==e&&!Qr(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const oS=Array.prototype;function Oa(e,t,n,r,o,a){const s=yc(e),i=s!==e&&!Qr(e),l=s[t];if(l!==oS[t]){const v=l.apply(e,a);return i?Lo(v):v}let c=n;s!==e&&(i?c=function(v,f){return n.call(this,ma(e,v),f,e)}:n.length>2&&(c=function(v,f){return n.call(this,v,f,e)}));const d=l.call(s,c,r);return i&&o?o(d):d}function rh(e,t,n,r){const o=yc(e),a=o!==e&&!Qr(e);let s=n,i=!1;o!==e&&(a?(i=r.length===0,s=function(c,d,v){return i&&(i=!1,c=ma(e,c)),n.call(this,c,ma(e,d),v,e)}):n.length>3&&(s=function(c,d,v){return n.call(this,c,d,v,e)}));const l=o[t](s,...r);return i?ma(e,l):l}function md(e,t,n){const r=Et(e);er(r,"iterate",Vl);const o=r[t](...n);return(o===-1||o===!1)&&Bf(n[0])?(n[0]=Et(n[0]),r[t](...n)):o}function Pl(e,t,n=[]){Va(),Lf();const r=Et(e)[t].apply(e,n);return Nf(),Ka(),r}const aS=Ef("__proto__,__v_isRef,__isVue"),Dv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(jo));function sS(e){jo(e)||(e=String(e));const t=Et(this);return er(t,"has",e),t.hasOwnProperty(e)}class Fv{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return a;if(n==="__v_raw")return r===(o?a?vS:Hv:a?zv:Uv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=at(t);if(!o){let l;if(s&&(l=rS[n]))return l;if(n==="hasOwnProperty")return sS}const i=Reflect.get(t,n,jn(t)?t:r);if((jo(n)?Dv.has(n):aS(n))||(o||er(t,"get",n),a))return i;if(jn(i)){const l=s&&Mf(n)?i:i.value;return o&&jt(l)?Qd(l):l}return jt(i)?o?Qd(i):wc(i):i}}class Bv extends Fv{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=at(t)&&Mf(n);if(!this._isShallow){const c=Ya(a);if(!Qr(r)&&!Ya(r)&&(a=Et(a),r=Et(r)),!s&&jn(a)&&!jn(r))return c||(a.value=r),!0}const i=s?Number(n)<t.length:Mt(t,n),l=Reflect.set(t,n,r,jn(t)?t:o);return t===Et(o)&&l&&(i?_o(r,a)&&za(t,"set",n,r):za(t,"add",n,r)),l}deleteProperty(t,n){const r=Mt(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&za(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!jo(n)||!Dv.has(n))&&er(t,"has",n),r}ownKeys(t){return er(t,"iterate",at(t)?"length":Ti),Reflect.ownKeys(t)}}class iS extends Fv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const lS=new Bv,uS=new iS,cS=new Bv(!0);const Jd=e=>e,xu=e=>Reflect.getPrototypeOf(e);function dS(e,t,n){return function(...r){const o=this.__v_raw,a=Et(o),s=Ji(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=o[e](...r),d=n?Jd:t?ol:Lo;return!t&&er(a,"iterate",l?Yd:Ti),wn(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 fS(e,t){const n={get(o){const a=this.__v_raw,s=Et(a),i=Et(o);e||(_o(o,i)&&er(s,"get",o),er(s,"get",i));const{has:l}=xu(s),c=t?Jd:e?ol:Lo;if(l.call(s,o))return c(a.get(o));if(l.call(s,i))return c(a.get(i));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&er(Et(o),"iterate",Ti),o.size},has(o){const a=this.__v_raw,s=Et(a),i=Et(o);return e||(_o(o,i)&&er(s,"has",o),er(s,"has",i)),o===i?a.has(o):a.has(o)||a.has(i)},forEach(o,a){const s=this,i=s.__v_raw,l=Et(i),c=t?Jd:e?ol:Lo;return!e&&er(l,"iterate",Ti),i.forEach((d,v)=>o.call(a,c(d),c(v),s))}};return wn(n,e?{add:ku("add"),set:ku("set"),delete:ku("delete"),clear:ku("clear")}:{add(o){const a=Et(this),s=xu(a),i=Et(o),l=!t&&!Qr(o)&&!Ya(o)?i:o;return s.has.call(a,l)||_o(o,l)&&s.has.call(a,o)||_o(i,l)&&s.has.call(a,i)||(a.add(l),za(a,"add",l,l)),this},set(o,a){!t&&!Qr(a)&&!Ya(a)&&(a=Et(a));const s=Et(this),{has:i,get:l}=xu(s);let c=i.call(s,o);c||(o=Et(o),c=i.call(s,o));const d=l.call(s,o);return s.set(o,a),c?_o(a,d)&&za(s,"set",o,a):za(s,"add",o,a),this},delete(o){const a=Et(this),{has:s,get:i}=xu(a);let l=s.call(a,o);l||(o=Et(o),l=s.call(a,o)),i&&i.call(a,o);const c=a.delete(o);return l&&za(a,"delete",o,void 0),c},clear(){const o=Et(this),a=o.size!==0,s=o.clear();return a&&za(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=dS(o,e,t)}),n}function Df(e,t){const n=fS(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Mt(n,o)&&o in r?n:r,o,a)}const pS={get:Df(!1,!1)},hS={get:Df(!1,!0)},mS={get:Df(!0,!1)};const Uv=new WeakMap,zv=new WeakMap,Hv=new WeakMap,vS=new WeakMap;function gS(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function wc(e){return Ya(e)?e:Ff(e,!1,lS,pS,Uv)}function qv(e){return Ff(e,!1,cS,hS,zv)}function Qd(e){return Ff(e,!0,uS,mS,Hv)}function Ff(e,t,n,r,o){if(!jt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=o.get(e);if(a)return a;const s=gS(zT(e));if(s===0)return e;const i=new Proxy(e,s===2?r:n);return o.set(e,i),i}function Si(e){return Ya(e)?Si(e.__v_raw):!!(e&&e.__v_isReactive)}function Ya(e){return!!(e&&e.__v_isReadonly)}function Qr(e){return!!(e&&e.__v_isShallow)}function Bf(e){return e?!!e.__v_raw:!1}function Et(e){const t=e&&e.__v_raw;return t?Et(t):e}function yS(e){return!Mt(e,"__v_skip")&&Object.isExtensible(e)&&kv(e,"__v_skip",!0),e}const Lo=e=>jt(e)?wc(e):e,ol=e=>jt(e)?Qd(e):e;function jn(e){return e?e.__v_isRef===!0:!1}function T(e){return Wv(e,!1)}function wS(e){return Wv(e,!0)}function Wv(e,t){return jn(e)?e:new bS(e,t)}class bS{constructor(t,n){this.dep=new $f,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Et(t),this._value=n?t:Lo(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Qr(t)||Ya(t);t=r?t:Et(t),_o(t,n)&&(this._rawValue=t,this._value=r?t:Lo(t),this.dep.trigger())}}function m(e){return jn(e)?e.value:e}const TS={get:(e,t,n)=>t==="__v_raw"?e:m(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return jn(o)&&!jn(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function Gv(e){return Si(e)?e:new Proxy(e,TS)}class SS{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new $f(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=r}notify(){if(this.flags|=16,!(this.flags&8)&&zt!==this)return Mv(this,!0),!0}get value(){const t=this.dep.track();return Nv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function CS(e,t,n=!1){let r,o;return ht(e)?r=e:(r=e.get,o=e.set),new SS(r,o,n)}const Iu={},Vu=new WeakMap;let hi;function xS(e,t=!1,n=hi){if(n){let r=Vu.get(n);r||Vu.set(n,r=[]),r.push(e)}}function kS(e,t,n=Dt){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:i,call:l}=n,c=M=>o?M:Qr(M)||o===!1||o===0?Ha(M,1):Ha(M);let d,v,f,y,S=!1,I=!1;if(jn(e)?(v=()=>e.value,S=Qr(e)):Si(e)?(v=()=>c(e),S=!0):at(e)?(I=!0,S=e.some(M=>Si(M)||Qr(M)),v=()=>e.map(M=>{if(jn(M))return M.value;if(Si(M))return c(M);if(ht(M))return l?l(M,2):M()})):ht(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Va();try{f()}finally{Ka()}}const M=hi;hi=d;try{return l?l(e,3,[y]):e(y)}finally{hi=M}}:v=ya,t&&o){const M=v,pe=o===!0?1/0:o;v=()=>Ha(M(),pe)}const U=eS(),O=()=>{d.stop(),U&&U.active&&Rf(U.effects,d)};if(a&&t){const M=t;t=(...pe)=>{const ue=M(...pe);return O(),ue}}let D=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||o||S||(I?pe.some((ue,K)=>_o(ue,D[K])):_o(pe,D))){f&&f();const ue=hi;hi=d;try{const K=[pe,D===Iu?void 0:I&&D[0]===Iu?[]:D,y];D=pe,l?l(t,3,K):t(...K)}finally{hi=ue}}}else d.run()};return i&&i(q),d=new Ev(v),d.scheduler=s?()=>s(q,!1):q,y=M=>xS(M,!1,d),f=d.onStop=()=>{const M=Vu.get(d);if(M){if(l)l(M,4);else for(const pe of M)pe();Vu.delete(d)}},t?r?q(!0):D=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 Ha(e,t=1/0,n){if(t<=0||!jt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,jn(e))Ha(e.value,t,n);else if(at(e))for(let r=0;r<e.length;r++)Ha(e[r],t,n);else if(hc(e)||Ji(e))e.forEach(r=>{Ha(r,t,n)});else if(xv(e)){for(const r in e)Ha(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ha(e[r],t,n)}return e}/**
11
- * @vue/runtime-core v3.5.41
12
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
- * @license MIT
14
- **/function ru(e,t,n,r){try{return r?e(...r):e()}catch(o){ou(o,t,n)}}function Zr(e,t,n,r){if(ht(e)){const o=ru(e,t,n,r);return o&&Sv(o)&&o.catch(a=>{ou(a,t,n)}),o}if(at(e)){const o=[];for(let a=0;a<e.length;a++)o.push(Zr(e[a],t,n,r));return o}}function ou(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Dt;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){Va(),ru(a,null,10,[e,l,c]),Ka();return}}IS(e,n,o,r,s)}function IS(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const dr=[];let ha=-1;const Qi=[];let Is=null,qi=0;const Vv=Promise.resolve();let Ku=null;function Nt(e){const t=Ku||Vv;return e?t.then(this?e.bind(this):e):t}function AS(e){let t=ha+1,n=dr.length;for(;t<n;){const r=t+n>>>1,o=dr[r],a=Kl(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function Uf(e){if(!(e.flags&1)){const t=Kl(e),n=dr[dr.length-1];!n||!(e.flags&2)&&t>=Kl(n)?dr.push(e):dr.splice(AS(t),0,e),e.flags|=1,Kv()}}function Kv(){Ku||(Ku=Vv.then(Jv))}function _S(e){if(!at(e))Is&&e.id===-1?Is.splice(qi+1,0,e):e.flags&1||(Qi.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Qi.push(e[t]);Kv()}function oh(e,t,n=ha+1){for(;n<dr.length;n++){const r=dr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;dr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Yv(e){if(Qi.length){const t=[...new Set(Qi)].sort((n,r)=>Kl(n)-Kl(r));if(Qi.length=0,Is){for(let n=0;n<t.length;n++)Is.push(t[n]);return}for(Is=t,qi=0;qi<Is.length;qi++){const n=Is[qi];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Is=null,qi=0}}const Kl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Jv(e){try{for(ha=0;ha<dr.length;ha++){const t=dr[ha];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),ru(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ha<dr.length;ha++){const t=dr[ha];t&&(t.flags&=-2)}ha=-1,dr.length=0,Yv(),Ku=null,(dr.length||Qi.length)&&Jv()}}let Un=null,Qv=null;function Yu(e){const t=Un;return Un=e,Qv=e&&e.type.__scopeId||null,t}function pt(e,t=Un,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Zu(-1);const a=Yu(t),s=Wa.length;let i;try{i=e(...o)}finally{for(let l=Wa.length;l>s;l--)Vf();Yu(a),r._d&&Zu(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Mn(e,t){if(Un===null)return e;const n=xc(Un),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,i,l=Dt]=t[o];a&&(ht(a)&&(a={mounted:a,updated:a}),a.deep&&Ha(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function ui(e,t,n,r){const o=e.dirs,a=t&&t.dirs;for(let s=0;s<o.length;s++){const i=o[s];a&&(i.oldValue=a[s].value);let l=i.dir[r];l&&(Va(),Zr(l,n,8,[e.el,i,e,t]),Ka())}}function zu(e,t){if(Bn){let n=Bn.provides;const r=Bn.parent&&Bn.parent.provides;r===n&&(n=Bn.provides=Object.create(r)),n[e]=t}}function Mo(e,t,n=!1){const r=Yf();if(r||Zi){let o=Zi?Zi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&ht(t)?t.call(r&&r.proxy):t}}const PS=Symbol.for("v-scx"),ES=()=>Mo(PS);function ot(e,t,n){return Xv(e,t,n)}function Xv(e,t,n=Dt){const{immediate:r,deep:o,flush:a,once:s}=n,i=wn({},n),l=t&&r||!t&&a!=="post";let c;if(il){if(a==="sync"){const y=ES();c=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=ya,y.resume=ya,y.pause=ya,y}}const d=Bn;i.call=(y,S,I)=>Zr(y,d,S,I);let v=!1;a==="post"?i.scheduler=y=>{ur(y,d&&d.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(y,S)=>{S?y():Uf(y)}),i.augmentJob=y=>{t&&(y.flags|=4),v&&(y.flags|=2,d&&(y.id=d.uid,y.i=d))};const f=kS(e,t,i);return il&&(c?c.push(f):l&&f()),f}function RS(e,t,n){const r=this.proxy,o=Wt(e)?e.includes(".")?Zv(r,e):()=>r[e]:e.bind(r,r);let a;ht(t)?a=t:(a=t.handler,n=t);const s=iu(this),i=Xv(o,a.bind(r),n);return s(),i}function Zv(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}const Cs=new WeakMap,eg=Symbol("_vte"),bc=e=>e.__isTeleport,vi=e=>e&&(e.disabled||e.disabled===""),MS=e=>e&&(e.defer||e.defer===""),ah=e=>typeof SVGElement<"u"&&e instanceof SVGElement,sh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Xd=(e,t)=>{const n=e&&e.to;return Wt(n)?t?t(n):null:n},jS={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,i,l,c){const{mc:d,pc:v,pbc:f,o:{insert:y,querySelector:S,createText:I,createComment:U,parentNode:O}}=c,D=vi(t.props);let{dynamicChildren:q}=t;const M=(K,ie,ye)=>{K.shapeFlag&16&&d(K.children,ie,ye,o,a,s,i,l)},pe=(K=t)=>{const ie=vi(K.props),ye=K.target=Xd(K.props,S),Pe=Zd(ye,K,I,y);ye&&(s!=="svg"&&ah(ye)?s="svg":s!=="mathml"&&sh(ye)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(ye),ie||(M(K,ye,Pe),Ll(K,!1)))},ue=K=>{const ie=()=>{if(Cs.get(K)===ie){if(Cs.delete(K),vi(K.props)){const ye=O(K.el)||n;M(K,ye,K.anchor),Ll(K,!0)}pe(K)}};Cs.set(K,ie),ur(ie,a)};if(e==null){const K=t.el=I(""),ie=t.anchor=I("");if(y(K,n,r),y(ie,n,r),MS(t.props)||a&&a.pendingBranch){ue(t);return}D&&(M(t,n,ie),Ll(t,!0)),pe()}else{t.el=e.el;const K=t.anchor=e.anchor,ie=Cs.get(e);if(ie){ie.flags|=8,Cs.delete(e),ue(t);return}t.targetStart=e.targetStart;const ye=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,ge=vi(e.props),ee=ge?n:ye,me=ge?K:Pe;if(s==="svg"||ah(ye)?s="svg":(s==="mathml"||sh(ye))&&(s="mathml"),q?(f(e.dynamicChildren,q,ee,o,a,s,i),Gf(e,t,!0)):l||v(e,t,ee,me,o,a,s,i,!1),D)ge?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Au(t,n,K,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const re=Xd(t.props,S);re&&(t.target=re,Au(t,re,null,c,0))}else ge&&Au(t,ye,Pe,c,1);Ll(t,D)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:c,targetAnchor:d,target:v,props:f}=e,y=vi(f),S=a||!y,I=Cs.get(e);if(I&&(I.flags|=8,Cs.delete(e)),v&&(o(c),o(d)),a&&o(l),!I&&(y||v)&&s&16)for(let U=0;U<i.length;U++){const O=i[U];r(O,t,n,S,!!O.dynamicChildren)}},move:Au,hydrate:LS};function Au(e,t,n,{o:{insert:r},m:o},a=2){a===0&&r(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:c,props:d}=e,v=a===2;if(v&&r(s,t,n),!Cs.has(e)&&(!v||vi(d))&&l&16)for(let f=0;f<c.length;f++)o(c[f],t,n,2);v&&r(i,t,n)}function LS(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:c,createText:d}},v){function f(U,O){let D=O;for(;D;){if(D&&D.nodeType===8){if(D.data==="teleport start anchor")t.targetStart=D;else if(D.data==="teleport anchor"){t.targetAnchor=D,U._lpa=t.targetAnchor&&s(t.targetAnchor);break}}D=s(D)}}function y(U,O){O.anchor=v(s(U),O,i(U),n,r,o,a)}const S=t.target=Xd(t.props,l),I=vi(t.props);if(S){const U=S._lpa||S.firstChild;t.shapeFlag&16&&(I?(y(e,t),f(S,U),t.targetAnchor||Zd(S,t,d,c,i(e)===S?e:null)):(t.anchor=s(e),f(S,U),t.targetAnchor||Zd(S,t,d,c),v(U&&s(U),t,S,n,r,o,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 al=jS;function Ll(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Zd(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[eg]=s,e&&(r(a,e,o),r(s,e,o)),s}const Yr=Symbol("_leaveCb"),El=Symbol("_enterCb");function NS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ii(()=>{e.isMounted=!0}),Os(()=>{e.isUnmounting=!0}),e}const Kr=[Function,Array],tg={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Kr,onEnter:Kr,onAfterEnter:Kr,onEnterCancelled:Kr,onBeforeLeave:Kr,onLeave:Kr,onAfterLeave:Kr,onLeaveCancelled:Kr,onBeforeAppear:Kr,onAppear:Kr,onAfterAppear:Kr,onAppearCancelled:Kr},ng=e=>{const t=e.subTree;return t.component?ng(t.component):t},OS={name:"BaseTransition",props:tg,setup(e,{slots:t}){const n=Yf(),r=NS();return()=>{const o=t.default&&ag(t.default(),!0),a=o&&o.length?rg(o):n.subTree?ve():void 0;if(!a)return;const s=Et(e),{mode:i}=s;if(r.isLeaving)return vd(a);const l=Ju(a);if(!l)return vd(a);let c=ef(l,s,r,n,v=>c=v);l.type!==tr&&Yl(l,c);let d=n.subTree&&Ju(n.subTree);if(d&&d.type!==tr&&!gi(d,l)&&ng(n).type!==tr){let v=ef(d,s,r,n);if(Yl(d,v),i==="out-in"&&l.type!==tr)return r.isLeaving=!0,v.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,d=void 0},vd(a);i==="in-out"&&l.type!==tr?v.delayLeave=(f,y,S)=>{const I=og(r,d);I[String(d.key)]=d,f[Yr]=()=>{y(),f[Yr]=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 rg(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==tr){t=n;break}}return t}const $S=OS;function og(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function ef(e,t,n,r,o){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:v,onBeforeLeave:f,onLeave:y,onAfterLeave:S,onLeaveCancelled:I,onBeforeAppear:U,onAppear:O,onAfterAppear:D,onAppearCancelled:q}=t,M=String(e.key),pe=og(n,e),ue=(ye,Pe)=>{ye&&Zr(ye,r,9,Pe)},K=(ye,Pe)=>{const ge=Pe[1];ue(ye,Pe),at(ye)?ye.every(ee=>ee.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[Yr]&&ye[Yr](!0);const ge=pe[M];ge&&gi(e,ge)&&ge.el[Yr]&&ge.el[Yr](),ue(Pe,[ye])},enter(ye){if(pe[M]===e)return;let Pe=c,ge=d,ee=v;if(!n.isMounted)if(a)Pe=O||c,ge=D||d,ee=q||v;else return;let me=!1;ye[El]=Ae=>{me||(me=!0,Ae?ue(ee,[ye]):ue(ge,[ye]),ie.delayedLeave&&ie.delayedLeave(),ye[El]=void 0)};const re=ye[El].bind(null,!1);Pe?K(Pe,[ye,re]):re()},leave(ye,Pe){const ge=String(e.key);if(ye[El]&&ye[El](!0),n.isUnmounting)return Pe();ue(f,[ye]);let ee=!1;ye[Yr]=re=>{ee||(ee=!0,Pe(),re?ue(I,[ye]):ue(S,[ye]),ye[Yr]=void 0,pe[ge]===e&&delete pe[ge])};const me=ye[Yr].bind(null,!1);pe[ge]=e,y?K(y,[ye,me]):me()},clone(ye){const Pe=ef(ye,t,n,r,o);return o&&o(Pe),Pe}};return ie}function vd(e){if(au(e))return e=Ls(e),e.children=null,e}function Ju(e){if(!au(e))return bc(e.type)&&e.children?rg(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&&ht(n.default))return n.default()}}function Yl(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;const n=e.component.subTree;Yl(bc(n.type)&&Ju(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ag(e,t=!1,n){let r=[],o=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===ct?(s.patchFlag&128&&o++,r=r.concat(ag(s.children,t,i))):(t||s.type!==tr)&&r.push(i!=null?Ls(s,{key:i}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function bn(e,t){return ht(e)?wn({name:e.name},t,{setup:e}):e}function zf(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function ih(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Qu=new WeakMap;function Ul(e,t,n,r,o=!1){if(at(e)){e.forEach((I,U)=>Ul(I,t&&(at(t)?t[U]:t),n,r,o));return}if(Xi(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ul(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?xc(r.component):r.el,s=o?null:a,{i,r:l}=e,c=t&&t.r,d=i.refs===Dt?i.refs={}:i.refs,v=i.setupState,f=Et(v),y=v===Dt?Tv:I=>ih(d,I)?!1:Mt(f,I),S=(I,U)=>!(U&&ih(d,U));if(c!=null&&c!==l){if(lh(t),Wt(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(ht(l))ru(l,i,12,[s,d]);else{const I=Wt(l),U=jn(l);if(I||U){const O=()=>{if(e.f){const D=I?y(l)?v[l]:d[l]:S()||!e.k?l.value:d[e.k];if(o)at(D)&&Rf(D,a);else if(at(D))D.includes(a)||D.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 D=()=>{O(),Qu.delete(e)};D.id=-1,Qu.set(e,D),ur(D,n)}else lh(e),O()}}}function lh(e){const t=Qu.get(e);t&&(t.flags|=8,Qu.delete(e))}const uh=e=>e.nodeType===8;gc().requestIdleCallback;gc().cancelIdleCallback;function DS(e,t){if(uh(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(uh(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const Xi=e=>!!e.type.__asyncLoader;function ko(e){ht(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let c=null,d,v=0;const f=()=>(v++,c=null,y()),y=()=>{let 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 bn({name:"AsyncComponentWrapper",__asyncLoader:y,__asyncHydrate(S,I,U){const O=S.isConnected;let D=!1;(I.bu||(I.bu=[])).push(()=>D=!0);const q=()=>{D||!S.parentNode||O&&!S.isConnected||U()},M=a?()=>{const pe=a(q,ue=>DS(S,ue));pe&&(I.bum||(I.bum=[])).push(pe)}:q;d?M():y().then(()=>!I.isUnmounted&&M())},get __asyncResolved(){return d},setup(){const S=Bn;if(zf(S),d)return()=>_u(d,S);const I=pe=>{c=null,ou(pe,S,13,!r)};if(i&&S.suspense||il)return y().then(pe=>()=>_u(pe,S)).catch(pe=>(I(pe),()=>r?Fe(r,{error:pe}):null));const U=T(!1),O=T(),D=T(!!o);let q,M;return su(()=>{q!=null&&clearTimeout(q),M!=null&&clearTimeout(M)}),o&&(M=setTimeout(()=>{S.isUnmounted||(D.value=!1)},o)),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&&au(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&&r)return Fe(r,{error:O.value});if(n&&!D.value)return _u(n,S)}}})}function _u(e,t){const{ref:n,props:r,children:o,ce:a}=t.vnode,s=Fe(e,r,o);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const au=e=>e.type.__isKeepAlive;function FS(e,t){sg(e,"a",t)}function BS(e,t){sg(e,"da",t)}function sg(e,t,n=Bn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Tc(t,r,n),n){let o=n.parent;for(;o&&o.parent;)au(o.parent.vnode)&&US(r,t,n,o),o=o.parent}}function US(e,t,n,r){const o=Tc(t,e,r,!0);su(()=>{Rf(r[t],o)},n)}function Tc(e,t,n=Bn,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Va();const i=iu(n),l=Zr(t,n,e,s);return i(),Ka(),l});return r?o.unshift(a):o.push(a),a}}const Qa=e=>(t,n=Bn)=>{(!il||e==="sp")&&Tc(e,(...r)=>t(...r),n)},zS=Qa("bm"),Ii=Qa("m"),HS=Qa("bu"),qS=Qa("u"),Os=Qa("bum"),su=Qa("um"),WS=Qa("sp"),GS=Qa("rtg"),VS=Qa("rtc");function KS(e,t=Bn){Tc("ec",e,t)}const YS="components",ig=Symbol.for("v-ndc");function Hf(e){return Wt(e)?JS(YS,e,!1)||e:e||ig}function JS(e,t,n=!0,r=!1){const o=Un||Bn;if(o){const a=o.type;{const i=j0(a,!1);if(i&&(i===t||i===pr(t)||i===vc(pr(t))))return a}const s=ch(o[e]||a[e],t)||ch(o.appContext[e],t);return!s&&r?a:s}}function ch(e,t){return e&&(e[t]||e[pr(t)]||e[vc(pr(t))])}function rn(e,t,n,r){let o;const a=n,s=at(e);if(s||Wt(e)){const i=s&&Si(e);let l=!1,c=!1;i&&(l=!Qr(e),c=Ya(e),e=yc(e)),o=new Array(e.length);for(let d=0,v=e.length;d<v;d++)o[d]=t(l?c?ol(Lo(e[d])):Lo(e[d]):e[d],d,void 0,a)}else if(typeof e=="number"){o=new Array(e);for(let i=0;i<e;i++)o[i]=t(i+1,i,void 0,a)}else if(jt(e))if(e[Symbol.iterator])o=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);o=new Array(i.length);for(let l=0,c=i.length;l<c;l++){const d=i[l];o[l]=t(e[d],d,l,a)}}else o=[];return o}function xr(e,t,n,r,o,a){if(n==null&&(n={}),Un.ce||Un.parent&&Xi(Un.parent)&&Un.parent.ce){const c=a!=null&&n.key==null?wn({},n,{key:a}):n,d=Object.keys(c).length>0;return t!=="default"&&(c.name=t),P(),et(ct,null,[Fe("slot",c,r)],d?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=Wa.length;P();let l;try{const c=s&&lg(s(n)),d=n.key||a||c&&c.key;l=et(ct,{key:(d&&!jo(d)?d:`_${t}`)+(!c&&r?"_fb":"")},c||(r?r():[]),c&&e._===1?64:-2)}catch(c){for(let d=Wa.length;d>i;d--)Vf();throw c}finally{s&&s._c&&(s._d=!0)}return l}function lg(e){return e.some(t=>Jl(t)?!(t.type===tr||t.type===ct&&!lg(t.children)):!0)?e:null}const tf=e=>e?Ag(e)?xc(e):tf(e.parent):null,zl=wn(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=>tf(e.parent),$root:e=>tf(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>cg(e),$forceUpdate:e=>e.f||(e.f=()=>{Uf(e.update)}),$nextTick:e=>e.n||(e.n=Nt.bind(e.proxy)),$watch:e=>RS.bind(e)}),gd=(e,t)=>e!==Dt&&!e.__isScriptSetup&&Mt(e,t),QS={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return a[t]}else{if(gd(r,t))return s[t]=1,r[t];if(o!==Dt&&Mt(o,t))return s[t]=2,o[t];if(Mt(a,t))return s[t]=3,a[t];if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];nf&&(s[t]=0)}}const c=zl[t];let d,v;if(c)return t==="$attrs"&&er(e.attrs,"get",""),c(e);if((d=i.__cssModules)&&(d=d[t]))return d;if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Mt(v,t))return v[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return gd(o,t)?(o[t]=n,!0):r!==Dt&&Mt(r,t)?(r[t]=n,!0):Mt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:a,type:s}},i){let l;return!!(n[i]||e!==Dt&&i[0]!=="$"&&Mt(e,i)||gd(t,i)||Mt(a,i)||Mt(r,i)||Mt(zl,i)||Mt(o.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Mt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function XS(){return ZS().slots}function ZS(e){const t=Yf();return t.setupContext||(t.setupContext=Pg(t))}function dh(e){return at(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let nf=!0;function e0(e){const t=cg(e),n=e.proxy,r=e.ctx;nf=!1,t.beforeCreate&&fh(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:i,provide:l,inject:c,created:d,beforeMount:v,mounted:f,beforeUpdate:y,updated:S,activated:I,deactivated:U,beforeDestroy:O,beforeUnmount:D,destroyed:q,unmounted:M,render:pe,renderTracked:ue,renderTriggered:K,errorCaptured:ie,serverPrefetch:ye,expose:Pe,inheritAttrs:ge,components:ee,directives:me,filters:re}=t;if(c&&t0(c,r,null),s)for(const Ne in s){const Le=s[Ne];ht(Le)&&(r[Ne]=Le.bind(n))}if(o){const Ne=o.call(n,n);jt(Ne)&&(e.data=wc(Ne))}if(nf=!0,a)for(const Ne in a){const Le=a[Ne],xe=ht(Le)?Le.bind(n,n):ht(Le.get)?Le.get.bind(n,n):ya,Se=!ht(Le)&&ht(Le.set)?Le.set.bind(n):ya,Ce=Y({get:xe,set:Se});Object.defineProperty(r,Ne,{enumerable:!0,configurable:!0,get:()=>Ce.value,set:Ee=>Ce.value=Ee})}if(i)for(const Ne in i)ug(i[Ne],r,n,Ne);if(l){const Ne=ht(l)?l.call(n):l;Reflect.ownKeys(Ne).forEach(Le=>{zu(Le,Ne[Le])})}d&&fh(d,e,"c");function De(Ne,Le){at(Le)?Le.forEach(xe=>Ne(xe.bind(n))):Le&&Ne(Le.bind(n))}if(De(zS,v),De(Ii,f),De(HS,y),De(qS,S),De(FS,I),De(BS,U),De(KS,ie),De(VS,ue),De(GS,K),De(Os,D),De(su,M),De(WS,ye),at(Pe))if(Pe.length){const Ne=e.exposed||(e.exposed={});Pe.forEach(Le=>{Object.defineProperty(Ne,Le,{get:()=>n[Le],set:xe=>n[Le]=xe,enumerable:!0})})}else e.exposed||(e.exposed={});pe&&e.render===ya&&(e.render=pe),ge!=null&&(e.inheritAttrs=ge),ee&&(e.components=ee),me&&(e.directives=me),ye&&zf(e)}function t0(e,t,n=ya){at(e)&&(e=rf(e));for(const r in e){const o=e[r];let a;jt(o)?"default"in o?a=Mo(o.from||r,o.default,!0):a=Mo(o.from||r):a=Mo(o),jn(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function fh(e,t,n){Zr(at(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function ug(e,t,n,r){let o=r.includes(".")?Zv(n,r):()=>n[r];if(Wt(e)){const a=t[e];ht(a)&&ot(o,a)}else if(ht(e))ot(o,e.bind(n));else if(jt(e))if(at(e))e.forEach(a=>ug(a,t,n,r));else{const a=ht(e.handler)?e.handler.bind(n):t[e.handler];ht(a)&&ot(o,a,e)}}function cg(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(c=>Xu(l,c,s,!0)),Xu(l,t,s)),jt(t)&&a.set(t,l),l}function Xu(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&Xu(e,a,n,!0),o&&o.forEach(s=>Xu(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const i=n0[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const n0={data:ph,props:hh,emits:hh,methods:Nl,computed:Nl,beforeCreate:lr,created:lr,beforeMount:lr,mounted:lr,beforeUpdate:lr,updated:lr,beforeDestroy:lr,beforeUnmount:lr,destroyed:lr,unmounted:lr,activated:lr,deactivated:lr,errorCaptured:lr,serverPrefetch:lr,components:Nl,directives:Nl,watch:o0,provide:ph,inject:r0};function ph(e,t){return t?e?function(){return wn(ht(e)?e.call(this,this):e,ht(t)?t.call(this,this):t)}:t:e}function r0(e,t){return Nl(rf(e),rf(t))}function rf(e){if(at(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function lr(e,t){return e?[...new Set([].concat(e,t))]:t}function Nl(e,t){return e?wn(Object.create(null),e,t):t}function hh(e,t){return e?at(e)&&at(t)?[...new Set([...e,...t])]:wn(Object.create(null),dh(e),dh(t??{})):t}function o0(e,t){if(!e)return t;if(!t)return e;const n=wn(Object.create(null),e);for(const r in t)n[r]=lr(e[r],t[r]);return n}function dg(){return{app:null,config:{isNativeTag:Tv,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let a0=0;function s0(e,t){return function(r,o=null){ht(r)||(r=wn({},r)),o!=null&&!jt(o)&&(o=null);const a=dg(),s=new WeakSet,i=[];let l=!1;const c=a.app={_uid:a0++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:O0,get config(){return a.config},set config(d){},use(d,...v){return s.has(d)||(d&&ht(d.install)?(s.add(d),d.install(c,...v)):ht(d)&&(s.add(d),d(c,...v))),c},mixin(d){return a.mixins.includes(d)||a.mixins.push(d),c},component(d,v){return v?(a.components[d]=v,c):a.components[d]},directive(d,v){return v?(a.directives[d]=v,c):a.directives[d]},mount(d,v,f){if(!l){const y=c._ceVNode||Fe(r,o);return y.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(y,d,f),l=!0,c._container=d,d.__vue_app__=c,xc(y.component)}},onUnmount(d){i.push(d)},unmount(){l&&(Zr(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 i0=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${pr(t)}Modifiers`]||e[`${Ns(t)}Modifiers`];function l0(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Dt;let o=n;const a=t.startsWith("update:"),s=a&&i0(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Wt(d)?d.trim():d)),s.number&&(o=n.map(jf)));let i,l=r[i=dd(t)]||r[i=dd(pr(t))];!l&&a&&(l=r[i=dd(Ns(t))]),l&&Zr(l,e,6,o);const c=r[i+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,Zr(c,e,6,o)}}const u0=new WeakMap;function fg(e,t,n=!1){const r=n?u0:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const a=e.emits;let s={},i=!1;if(!ht(e)){const l=c=>{const d=fg(c,t,!0);d&&(i=!0,wn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(jt(e)&&r.set(e,null),null):(at(a)?a.forEach(l=>s[l]=null):wn(s,a),jt(e)&&r.set(e,s),s)}function Sc(e,t){return!e||!fc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Mt(e,t[0].toLowerCase()+t.slice(1))||Mt(e,Ns(t))||Mt(e,t))}function mh(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:i,emit:l,render:c,renderCache:d,props:v,data:f,setupState:y,ctx:S,inheritAttrs:I}=e,U=Yu(e);let O,D;try{if(n.shapeFlag&4){const M=o||r,pe=M;O=va(c.call(pe,M,d,v,y,f,S)),D=i}else{const M=t;O=va(M.length>1?M(v,{attrs:i,slots:s,emit:l}):M(v,null)),D=t.props?i:c0(i)}}catch(M){Wa.length=0,ou(M,e,1),O=Fe(tr)}let q=O;if(D&&I!==!1){const M=Object.keys(D),{shapeFlag:pe}=q;M.length&&pe&7&&(a&&M.some(pc)&&(D=d0(D,a)),q=Ls(q,D,!1,!0))}if(n.dirs&&(q=Ls(q,null,!1,!0),q.dirs=q.dirs?q.dirs.concat(n.dirs):n.dirs),n.transition){const M=bc(q.type)&&Ju(q)||q;Yl(M,n.transition)}return O=q,Yu(U),O}const c0=e=>{let t;for(const n in e)(n==="class"||n==="style"||fc(n))&&((t||(t={}))[n]=e[n]);return t},d0=(e,t)=>{const n={};for(const r in e)(!pc(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function f0(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:i,patchFlag:l}=t,c=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?vh(r,s,c):!!s;if(l&8){const d=t.dynamicProps;for(let v=0;v<d.length;v++){const f=d[v];if(pg(s,r,f)&&!Sc(c,f))return!0}}}else return(o||i)&&(!i||!i.$stable)?!0:r===s?!1:r?s?vh(r,s,c):!0:!!s;return!1}function vh(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const a=r[o];if(pg(t,e,a)&&!Sc(n,a))return!0}return!1}function pg(e,t,n){const r=e[n],o=t[n];return n==="style"&&jt(r)&&jt(o)?!nu(r,o):r!==o}function p0({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const hg={},mg=()=>Object.create(hg),vg=e=>Object.getPrototypeOf(e)===hg;function h0(e,t,n,r=!1){const o={},a=mg();e.propsDefaults=Object.create(null),gg(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:qv(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function m0(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,i=Et(o),[l]=e.propsOptions;let c=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let v=0;v<d.length;v++){let f=d[v];if(Sc(e.emitsOptions,f))continue;const y=t[f];if(l)if(Mt(a,f))y!==a[f]&&(a[f]=y,c=!0);else{const S=pr(f);o[S]=of(l,i,S,y,e,!1)}else y!==a[f]&&(a[f]=y,c=!0)}}}else{gg(e,t,o,a)&&(c=!0);let d;for(const v in i)(!t||!Mt(t,v)&&((d=Ns(v))===v||!Mt(t,d)))&&(l?n&&(n[v]!==void 0||n[d]!==void 0)&&(o[v]=of(l,i,v,void 0,e,!0)):delete o[v]);if(a!==i)for(const v in a)(!t||!Mt(t,v))&&(delete a[v],c=!0)}c&&za(e.attrs,"set","")}function gg(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Dl(l))continue;const c=t[l];let d;o&&Mt(o,d=pr(l))?!a||!a.includes(d)?n[d]=c:(i||(i={}))[d]=c:Sc(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,s=!0)}if(a){const l=Et(n),c=i||Dt;for(let d=0;d<a.length;d++){const v=a[d];n[v]=of(o,l,v,c[v],e,!Mt(c,v))}}return s}function of(e,t,n,r,o,a){const s=e[n];if(s!=null){const i=Mt(s,"default");if(i&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ht(l)){const{propsDefaults:c}=o;if(n in c)r=c[n];else{const d=iu(o);r=c[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(a&&!i?r=!1:s[1]&&(r===""||r===Ns(n))&&(r=!0))}return r}const v0=new WeakMap;function yg(e,t,n=!1){const r=n?v0:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},i=[];let l=!1;if(!ht(e)){const d=v=>{l=!0;const[f,y]=yg(v,t,!0);wn(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 jt(e)&&r.set(e,Yi),Yi;if(at(a))for(let d=0;d<a.length;d++){const v=pr(a[d]);gh(v)&&(s[v]=Dt)}else if(a)for(const d in a){const v=pr(d);if(gh(v)){const f=a[d],y=s[v]=at(f)||ht(f)?{type:f}:wn({},f),S=y.type;let I=!1,U=!0;if(at(S))for(let O=0;O<S.length;++O){const D=S[O],q=ht(D)&&D.name;if(q==="Boolean"){I=!0;break}else q==="String"&&(U=!1)}else I=ht(S)&&S.name==="Boolean";y[0]=I,y[1]=U,(I||Mt(y,"default"))&&i.push(v)}}const c=[s,i];return jt(e)&&r.set(e,c),c}function gh(e){return e[0]!=="$"&&!Dl(e)}const qf=e=>e==="_"||e==="_ctx"||e==="$stable",Wf=e=>at(e)?e.map(va):[va(e)],g0=(e,t,n)=>{if(t._n)return t;const r=pt((...o)=>Wf(t(...o)),n);return r._c=!1,r},wg=(e,t,n)=>{const r=e._ctx;for(const o in e){if(qf(o))continue;const a=e[o];if(ht(a))t[o]=g0(o,a,r);else if(a!=null){const s=Wf(a);t[o]=()=>s}}},bg=(e,t)=>{const n=Wf(t);e.slots.default=()=>n},Tg=(e,t,n)=>{for(const r in t)(n||!qf(r))&&(e[r]=t[r])},y0=(e,t,n)=>{const r=e.slots=mg();if(e.vnode.shapeFlag&32){const o=t._;o?(Tg(r,t,n),n&&kv(r,"_",o,!0)):wg(t,r)}else t&&bg(e,t)},w0=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=Dt;if(r.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:Tg(o,t,n):(a=!t.$stable,wg(t,o)),s=t}else t&&(bg(e,t),s={default:1});if(a)for(const i in o)!qf(i)&&s[i]==null&&delete o[i]},ur=x0;function b0(e){return T0(e)}function T0(e,t){const n=gc();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:i,createComment:l,setText:c,setElementText:d,parentNode:v,nextSibling:f,setScopeId:y=ya,insertStaticContent:S}=e,I=(A,R,H,le=null,ne=null,ae=null,_e=void 0,Oe=null,ke=!!R.dynamicChildren)=>{if(A===R)return;A&&!gi(A,R)&&(le=N(A),Ee(A,ne,ae,!0),A=null),R.patchFlag===-2&&(ke=!1,R.dynamicChildren=null);const{type:he,ref:Ke,shapeFlag:$e}=R;switch(he){case Cc:U(A,R,H,le);break;case tr:O(A,R,H,le);break;case wd:A==null&&D(R,H,le,_e);break;case ct:ee(A,R,H,le,ne,ae,_e,Oe,ke);break;default:$e&1?pe(A,R,H,le,ne,ae,_e,Oe,ke):$e&6?me(A,R,H,le,ne,ae,_e,Oe,ke):($e&64||$e&128)&&he.process(A,R,H,le,ne,ae,_e,Oe,ke,je)}Ke!=null&&ne?Ul(Ke,A&&A.ref,ae,R||A,!R):Ke==null&&A&&A.ref!=null&&Ul(A.ref,null,ae,A,!0)},U=(A,R,H,le)=>{if(A==null)r(R.el=i(R.children),H,le);else{const ne=R.el=A.el;R.children!==A.children&&c(ne,R.children)}},O=(A,R,H,le)=>{A==null?r(R.el=l(R.children||""),H,le):R.el=A.el},D=(A,R,H,le)=>{[A.el,A.anchor]=S(A.children,R,H,le,A.el,A.anchor)},q=({el:A,anchor:R},H,le)=>{let ne;for(;A&&A!==R;)ne=f(A),r(A,H,le),A=ne;r(R,H,le)},M=({el:A,anchor:R})=>{let H;for(;A&&A!==R;)H=f(A),o(A),A=H;o(R)},pe=(A,R,H,le,ne,ae,_e,Oe,ke)=>{if(R.type==="svg"?_e="svg":R.type==="math"&&(_e="mathml"),A==null)ue(R,H,le,ne,ae,_e,Oe,ke);else{const he=A.el&&A.el._isVueCE?A.el:null;try{he&&he._beginPatch(),ye(A,R,ne,ae,_e,Oe,ke)}finally{he&&he._endPatch()}}},ue=(A,R,H,le,ne,ae,_e,Oe)=>{let ke,he;const{props:Ke,shapeFlag:$e,transition:We,dirs:Ge}=A;if(ke=A.el=s(A.type,ae,Ke&&Ke.is,Ke),$e&8?d(ke,A.children):$e&16&&ie(A.children,ke,null,le,ne,yd(A,ae),_e,Oe),Ge&&ui(A,null,le,"created"),K(ke,A,A.scopeId,_e,le),Ke){for(const bt in Ke)bt!=="value"&&!Dl(bt)&&a(ke,bt,null,Ke[bt],ae,le);"value"in Ke&&a(ke,"value",null,Ke.value,ae),(he=Ke.onVnodeBeforeMount)&&pa(he,le,A)}Ge&&ui(A,null,le,"beforeMount");const ft=S0(ne,We);ft&&We.beforeEnter(ke),r(ke,R,H),((he=Ke&&Ke.onVnodeMounted)||ft||Ge)&&ur(()=>{try{he&&pa(he,le,A),ft&&We.enter(ke),Ge&&ui(A,null,le,"mounted")}finally{}},ne)},K=(A,R,H,le,ne)=>{if(H&&y(A,H),le)for(let ae=0;ae<le.length;ae++)y(A,le[ae]);if(ne){let ae=ne.subTree;if(R===ae||xg(ae.type)&&(ae.ssContent===R||ae.ssFallback===R)){const _e=ne.vnode;K(A,_e,_e.scopeId,_e.slotScopeIds,ne.parent)}}},ie=(A,R,H,le,ne,ae,_e,Oe,ke=0)=>{for(let he=ke;he<A.length;he++){const Ke=A[he]=Oe?Ua(A[he]):va(A[he]);I(null,Ke,R,H,le,ne,ae,_e,Oe)}},ye=(A,R,H,le,ne,ae,_e)=>{const Oe=R.el=A.el;let{patchFlag:ke,dynamicChildren:he,dirs:Ke}=R;ke|=A.patchFlag&16;const $e=A.props||Dt,We=R.props||Dt;let Ge;if(H&&ci(H,!1),(Ge=We.onVnodeBeforeUpdate)&&pa(Ge,H,R,A),Ke&&ui(R,A,H,"beforeUpdate"),H&&ci(H,!0),he&&(!A.dynamicChildren||A.dynamicChildren.length!==he.length)&&(ke=0,_e=!1,he=null),($e.innerHTML&&We.innerHTML==null||$e.textContent&&We.textContent==null)&&d(Oe,""),he?Pe(A.dynamicChildren,he,Oe,H,le,yd(R,ne),ae):_e||Le(A,R,Oe,null,H,le,yd(R,ne),ae,!1),ke>0){if(ke&16)ge(Oe,$e,We,H,ne);else if(ke&2&&$e.class!==We.class&&a(Oe,"class",null,We.class,ne),ke&4&&a(Oe,"style",$e.style,We.style,ne),ke&8){const ft=R.dynamicProps;for(let bt=0;bt<ft.length;bt++){const nt=ft[bt],lt=$e[nt],J=We[nt];(J!==lt||nt==="value")&&a(Oe,nt,lt,J,ne,H)}}ke&1&&A.children!==R.children&&d(Oe,R.children)}else!_e&&he==null&&ge(Oe,$e,We,H,ne);((Ge=We.onVnodeUpdated)||Ke)&&ur(()=>{Ge&&pa(Ge,H,R,A),Ke&&ui(R,A,H,"updated")},le)},Pe=(A,R,H,le,ne,ae,_e)=>{for(let Oe=0;Oe<R.length;Oe++){const ke=A[Oe],he=R[Oe],Ke=ke.el&&(ke.type===ct||!gi(ke,he)||ke.shapeFlag&198)?v(ke.el):H;I(ke,he,Ke,null,le,ne,ae,_e,!0)}},ge=(A,R,H,le,ne)=>{if(R!==H){if(R!==Dt)for(const ae in R)!Dl(ae)&&!(ae in H)&&a(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(A,ae,Oe,_e,ne,le)}"value"in H&&a(A,"value",R.value,H.value,ne)}},ee=(A,R,H,le,ne,ae,_e,Oe,ke)=>{const he=R.el=A?A.el:i(""),Ke=R.anchor=A?A.anchor:i("");let{patchFlag:$e,dynamicChildren:We,slotScopeIds:Ge}=R;Ge&&(Oe=Oe?Oe.concat(Ge):Ge),A==null?(r(he,H,le),r(Ke,H,le),ie(R.children||[],H,Ke,ne,ae,_e,Oe,ke)):$e>0&&$e&64&&We&&A.dynamicChildren&&A.dynamicChildren.length===We.length?(Pe(A.dynamicChildren,We,H,ne,ae,_e,Oe),(R.key!=null||ne&&R===ne.subTree)&&Gf(A,R,!0)):Le(A,R,H,Ke,ne,ae,_e,Oe,ke)},me=(A,R,H,le,ne,ae,_e,Oe,ke)=>{R.slotScopeIds=Oe,A==null?R.shapeFlag&512?ne.ctx.activate(R,H,le,_e,ke):re(R,H,le,ne,ae,_e,ke):Ae(A,R,ke)},re=(A,R,H,le,ne,ae,_e)=>{const Oe=A.component=P0(A,le,ne);if(au(A)&&(Oe.ctx.renderer=je),E0(Oe,!1,_e),Oe.asyncDep){if(ne&&ne.registerDep(Oe,De,_e),!A.el){const ke=Oe.subTree=Fe(tr);O(null,ke,R,H),A.placeholder=ke.el}}else De(Oe,A,R,H,ne,ae,_e)},Ae=(A,R,H)=>{const le=R.component=A.component;if(f0(A,R,H))if(le.asyncDep&&!le.asyncResolved){Ne(le,R,H);return}else le.next=R,le.update();else R.el=A.el,le.vnode=R},De=(A,R,H,le,ne,ae,_e)=>{const Oe=()=>{if(A.isMounted){let{next:$e,bu:We,u:Ge,parent:ft,vnode:bt}=A;{const Te=Sg(A);if(Te){$e&&($e.el=bt.el,Ne(A,$e,_e)),Te.asyncDep.then(()=>{ur(()=>{A.isUnmounted||he()},ne)});return}}let nt=$e,lt;ci(A,!1),$e?($e.el=bt.el,Ne(A,$e,_e)):$e=bt,We&&Uu(We),(lt=$e.props&&$e.props.onVnodeBeforeUpdate)&&pa(lt,ft,$e,bt),ci(A,!0);const J=mh(A),de=A.subTree;A.subTree=J,I(de,J,v(de.el),N(de),A,ne,ae),$e.el=J.el,nt===null&&p0(A,J.el),Ge&&ur(Ge,ne),(lt=$e.props&&$e.props.onVnodeUpdated)&&ur(()=>pa(lt,ft,$e,bt),ne)}else{let $e;const{el:We,props:Ge}=R,{bm:ft,m:bt,parent:nt,root:lt,type:J}=A,de=Xi(R);ci(A,!1),ft&&Uu(ft),!de&&($e=Ge&&Ge.onVnodeBeforeMount)&&pa($e,nt,R),ci(A,!0);{lt.ce&&lt.ce._hasShadowRoot()&&lt.ce._injectChildStyle(J,A.parent?A.parent.type:void 0);const Te=A.subTree=mh(A);I(null,Te,H,le,A,ne,ae),R.el=Te.el}if(bt&&ur(bt,ne),!de&&($e=Ge&&Ge.onVnodeMounted)){const Te=R;ur(()=>pa($e,nt,Te),ne)}(R.shapeFlag&256||nt&&Xi(nt.vnode)&&nt.vnode.shapeFlag&256)&&A.a&&ur(A.a,ne),A.isMounted=!0,R=H=le=null}};A.scope.on();const ke=A.effect=new Ev(Oe);A.scope.off();const he=A.update=ke.run.bind(ke),Ke=A.job=ke.runIfDirty.bind(ke);Ke.i=A,Ke.id=A.uid,ke.scheduler=()=>Uf(Ke),ci(A,!0),he()},Ne=(A,R,H)=>{R.component=A;const le=A.vnode.props;A.vnode=R,A.next=null,m0(A,R.props,le,H),w0(A,R.children,H),Va(),oh(A),Ka()},Le=(A,R,H,le,ne,ae,_e,Oe,ke=!1)=>{const he=A&&A.children,Ke=A?A.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,ke);return}else if(We&256){xe(he,$e,H,le,ne,ae,_e,Oe,ke);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,ke):ce(he,ne,ae,!0):(Ke&8&&d(H,""),Ge&16&&ie($e,H,le,ne,ae,_e,Oe,ke))},xe=(A,R,H,le,ne,ae,_e,Oe,ke)=>{A=A||Yi,R=R||Yi;const he=A.length,Ke=R.length,$e=Math.min(he,Ke);let We;for(We=0;We<$e;We++){const Ge=R[We]=ke?Ua(R[We]):va(R[We]);I(A[We],Ge,H,null,ne,ae,_e,Oe,ke)}he>Ke?ce(A,ne,ae,!0,!1,$e):ie(R,H,le,ne,ae,_e,Oe,ke,$e)},Se=(A,R,H,le,ne,ae,_e,Oe,ke)=>{let he=0;const Ke=R.length;let $e=A.length-1,We=Ke-1;for(;he<=$e&&he<=We;){const Ge=A[he],ft=R[he]=ke?Ua(R[he]):va(R[he]);if(gi(Ge,ft))I(Ge,ft,H,null,ne,ae,_e,Oe,ke);else break;he++}for(;he<=$e&&he<=We;){const Ge=A[$e],ft=R[We]=ke?Ua(R[We]):va(R[We]);if(gi(Ge,ft))I(Ge,ft,H,null,ne,ae,_e,Oe,ke);else break;$e--,We--}if(he>$e){if(he<=We){const Ge=We+1,ft=Ge<Ke?R[Ge].el:le;for(;he<=We;)I(null,R[he]=ke?Ua(R[he]):va(R[he]),H,ft,ne,ae,_e,Oe,ke),he++}}else if(he>We)for(;he<=$e;)Ee(A[he],ne,ae,!0),he++;else{const Ge=he,ft=he,bt=new Map;for(he=ft;he<=We;he++){const gt=R[he]=ke?Ua(R[he]):va(R[he]);gt.key!=null&&bt.set(gt.key,he)}let nt,lt=0;const J=We-ft+1;let de=!1,Te=0;const Ue=new Array(J);for(he=0;he<J;he++)Ue[he]=0;for(he=Ge;he<=$e;he++){const gt=A[he];if(lt>=J){Ee(gt,ne,ae,!0);continue}let Lt;if(gt.key!=null)Lt=bt.get(gt.key);else for(nt=ft;nt<=We;nt++)if(Ue[nt-ft]===0&&gi(gt,R[nt])){Lt=nt;break}Lt===void 0?Ee(gt,ne,ae,!0):(Ue[Lt-ft]=he+1,Lt>=Te?Te=Lt:de=!0,I(gt,R[Lt],H,null,ne,ae,_e,Oe,ke),lt++)}const Tt=de?C0(Ue):Yi;for(nt=Tt.length-1,he=J-1;he>=0;he--){const gt=ft+he,Lt=R[gt],Oo=R[gt+1],Yt=gt+1<Ke?Oo.el||Cg(Oo):le;Ue[he]===0?I(null,Lt,H,Yt,ne,ae,_e,Oe,ke):de&&(nt<0||he!==Tt[nt]?Ce(Lt,H,Yt,2):nt--)}}},Ce=(A,R,H,le,ne=null)=>{const{el:ae,type:_e,transition:Oe,children:ke,shapeFlag:he}=A;if(he&6){Ce(A.component.subTree,R,H,le);return}if(he&128){A.suspense.move(R,H,le);return}if(he&64){_e.move(A,R,H,je);return}if(_e===ct){r(ae,R,H);for(let $e=0;$e<ke.length;$e++)Ce(ke[$e],R,H,le);r(A.anchor,R,H);return}if(_e===wd){q(A,R,H);return}if(le!==2&&he&1&&Oe)if(le===0)Oe.persisted&&!ae[Yr]?r(ae,R,H):(Oe.beforeEnter(ae),r(ae,R,H),ur(()=>Oe.enter(ae),ne));else{const{leave:$e,delayLeave:We,afterLeave:Ge}=Oe,ft=()=>{A.ctx.isUnmounted?o(ae):r(ae,R,H)},bt=()=>{const nt=ae._isLeaving||!!ae[Yr];ae._isLeaving&&ae[Yr](!0),Oe.persisted&&!nt?ft():$e(ae,()=>{ft(),Ge&&Ge()})};We?We(ae,ft,bt):bt()}else r(ae,R,H)},Ee=(A,R,H,le=!1,ne=!1)=>{const{type:ae,props:_e,ref:Oe,children:ke,dynamicChildren:he,shapeFlag:Ke,patchFlag:$e,dirs:We,cacheIndex:Ge,memo:ft}=A;if($e===-2&&(ne=!1),Oe!=null&&(Va(),Ul(Oe,null,H,A,!0),Ka()),Ge!=null&&(R.renderCache[Ge]=void 0),Ke&256){R.ctx.deactivate(A);return}const bt=Ke&1&&We,nt=!Xi(A);let lt;if(nt&&(lt=_e&&_e.onVnodeBeforeUnmount)&&pa(lt,R,A),Ke&6)it(A.component,H,le);else{if(Ke&128){A.suspense.unmount(H,le);return}bt&&ui(A,null,R,"beforeUnmount"),Ke&64?A.type.remove(A,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(ke,R,H),le&&Je(A)}const J=ft!=null&&Ge==null;(nt&&(lt=_e&&_e.onVnodeUnmounted)||bt||J)&&ur(()=>{lt&&pa(lt,R,A),bt&&ui(A,null,R,"unmounted"),J&&(A.el=null)},H)},Je=A=>{const{type:R,el:H,anchor:le,transition:ne}=A;if(R===ct){Xe(H,le);return}if(R===wd){M(A);return}const ae=()=>{o(H),ne&&!ne.persisted&&ne.afterLeave&&ne.afterLeave()};if(A.shapeFlag&1&&ne&&!ne.persisted){const{leave:_e,delayLeave:Oe}=ne,ke=()=>_e(H,ae);Oe?Oe(A.el,ae,ke):ke()}else ae()},Xe=(A,R)=>{let H;for(;A!==R;)H=f(A),o(A),A=H;o(R)},it=(A,R,H)=>{const{bum:le,scope:ne,job:ae,subTree:_e,um:Oe,m:ke,a:he}=A;yh(ke),yh(he),le&&Uu(le),ne.stop(),ae&&(ae.flags|=8,Ee(_e,A,R,H)),Oe&&ur(Oe,R),ur(()=>{A.isUnmounted=!0},R)},ce=(A,R,H,le=!1,ne=!1,ae=0)=>{for(let _e=ae;_e<A.length;_e++)Ee(A[_e],R,H,le,ne)},N=A=>{if(A.shapeFlag&6)return N(A.component.subTree);if(A.shapeFlag&128)return A.suspense.next();const R=f(A.anchor||A.el),H=R&&R[eg];return H?f(H):R};let oe=!1;const se=(A,R,H)=>{let le;A==null?R._vnode&&(Ee(R._vnode,null,null,!0),le=R._vnode.component):I(R._vnode||null,A,R,null,null,null,H),R._vnode=A,oe||(oe=!0,oh(le),Yv(),oe=!1)},je={p:I,um:Ee,m:Ce,r:Je,mt:re,mc:ie,pc:Le,pbc:Pe,n:N,o:e};return{render:se,hydrate:void 0,createApp:s0(se)}}function yd({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 ci({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function S0(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Gf(e,t,n=!1){const r=e.children,o=t.children;if(at(r)&&at(o))for(let a=0;a<r.length;a++){const s=r[a];let i=o[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=o[a]=Ua(o[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Gf(s,i)),i.type===Cc&&(i.patchFlag===-1&&(i=o[a]=Ua(i)),i.el=s.el),i.type===tr&&!i.el&&(i.el=s.el)}}function C0(e){const t=e.slice(),n=[0];let r,o,a,s,i;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(o=n[n.length-1],e[o]<c){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<c?a=i+1:s=i;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function Sg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Sg(t)}function yh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Cg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Cg(t.subTree):null}const xg=e=>e.__isSuspense;function x0(e,t){t&&t.pendingBranch?at(e)?t.effects.push(...e):t.effects.push(e):_S(e)}const ct=Symbol.for("v-fgt"),Cc=Symbol.for("v-txt"),tr=Symbol.for("v-cmt"),wd=Symbol.for("v-stc"),Wa=[];let fr=null;function P(e=!1){Wa.push(fr=e?null:[])}function Vf(){Wa.pop(),fr=Wa[Wa.length-1]||null}let sl=1;function Zu(e,t=!1){sl+=e,e<0&&fr&&t&&(fr.hasOnce=!0)}function kg(e){return e.dynamicChildren=sl>0?fr||Yi:null,Vf(),sl>0&&fr&&fr.push(e),e}function B(e,t,n,r,o,a){return kg(w(e,t,n,r,o,a,!0))}function et(e,t,n,r,o){return kg(Fe(e,t,n,r,o,!0))}function Jl(e){return e?e.__v_isVNode===!0:!1}function gi(e,t){return e.type===t.type&&e.key===t.key}const Ig=({key:e})=>e??null,Hu=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Wt(e)||jn(e)||ht(e)?{i:Un,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,r=0,o=null,a=e===ct?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ig(t),ref:t&&Hu(t),scopeId:Qv,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Un};return i?(ec(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Wt(n)?8:16),sl>0&&!s&&fr&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&fr.push(l),l}const Fe=k0;function k0(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===ig)&&(e=tr),Jl(e)){const i=Ls(e,t,!0);return n&&ec(i,n),sl>0&&!a&&fr&&(i.shapeFlag&6?fr[fr.indexOf(e)]=i:fr.push(i)),i.patchFlag=-2,i}if(L0(e)&&(e=e.__vccOpts),t){t=I0(t);let{class:i,style:l}=t;i&&!Wt(i)&&(t.class=dt(i)),jt(l)&&(Bf(l)&&!at(l)&&(l=wn({},l)),t.style=Jr(l))}const s=Wt(e)?1:xg(e)?128:bc(e)?64:jt(e)?4:ht(e)?2:0;return w(e,t,n,r,o,s,a,!0)}function I0(e){return e?Bf(e)||vg(e)?wn({},e):e:null}function Ls(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:i,transition:l}=e,c=t?Kf(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Ig(c),ref:t&&t.ref?n&&a?at(a)?a.concat(Hu(t)):[a,Hu(t)]:Hu(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&&Ls(e.ssContent),ssFallback:e.ssFallback&&Ls(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Yl(d,l.clone(d)),d}function Ps(e=" ",t=0){return Fe(Cc,null,e,t)}function ve(e="",t=!1){return t?(P(),et(tr,null,e)):Fe(tr,null,e)}function va(e){return e==null||typeof e=="boolean"?Fe(tr):at(e)?Fe(ct,null,e.slice()):Jl(e)?Ua(e):Fe(Cc,null,String(e))}function Ua(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ls(e)}function ec(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(at(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),ec(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!vg(t)?t._ctx=Un:o===3&&Un&&(Un.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ht(t)){if(r&65){ec(e,{default:t});return}t={default:t,_ctx:Un},n=32}else t=String(t),r&64?(n=16,t=[Ps(t)]):n=8;e.children=t,e.shapeFlag|=n}function Kf(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=dt([t.class,r.class]));else if(o==="style")t.style=Jr([t.style,r.style]);else if(fc(o)){const a=t[o],s=r[o];s&&a!==s&&!(at(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!pc(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function pa(e,t,n,r=null){Zr(e,t,7,[n,r])}const A0=dg();let _0=0;function P0(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||A0,a={uid:_0++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ZT(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:yg(r,o),emitsOptions:fg(r,o),emit:null,emitted:null,propsDefaults:Dt,inheritAttrs:r.inheritAttrs,ctx:Dt,data:Dt,props:Dt,attrs:Dt,slots:Dt,refs:Dt,setupState:Dt,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=l0.bind(null,a),e.ce&&e.ce(a),a}let Bn=null;const Yf=()=>Bn||Un;let tc,Ql;{const e=gc(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),a=>{o.length>1?o.forEach(s=>s(a)):o[0](a)}};tc=t("__VUE_INSTANCE_SETTERS__",n=>Bn=n),Ql=t("__VUE_SSR_SETTERS__",n=>il=n)}const iu=e=>{const t=Bn;return tc(e),e.scope.on(),()=>{e.scope.off(),tc(t)}},wh=()=>{Bn&&Bn.scope.off(),tc(null)};function Ag(e){return e.vnode.shapeFlag&4}let il=!1;function E0(e,t=!1,n=!1){t&&Ql(t);const{props:r,children:o}=e.vnode,a=Ag(e);h0(e,r,a,t),y0(e,o,n||t);const s=a?R0(e,t):void 0;return t&&Ql(!1),s}function R0(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,QS);const{setup:r}=n;if(r){Va();const o=e.setupContext=r.length>1?Pg(e):null,a=iu(e),s=ru(r,e,0,[e.props,o]),i=Sv(s);if(Ka(),a(),(i||e.sp)&&!Xi(e)&&zf(e),i){if(s.then(wh,wh),t)return s.then(l=>{Ql(!0);try{bh(e,l,t)}finally{Ql(!1)}}).catch(l=>{ou(l,e,0)});e.asyncDep=s}else bh(e,s)}else _g(e)}function bh(e,t,n){ht(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:jt(t)&&(e.setupState=Gv(t)),_g(e)}function _g(e,t,n){const r=e.type;e.render||(e.render=r.render||ya);{const o=iu(e);Va();try{e0(e)}finally{Ka(),o()}}}const M0={get(e,t){return er(e,"get",""),e[t]}};function Pg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,M0),slots:e.slots,emit:e.emit,expose:t}}function xc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Gv(yS(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 j0(e,t=!0){return ht(e)?e.displayName||e.name:e.name||t&&e.__name}function L0(e){return ht(e)&&"__vccOpts"in e}const Y=(e,t)=>CS(e,t,il);function Jf(e,t,n){try{Zu(-1);const r=arguments.length;return r===2?jt(t)&&!at(t)?Jl(t)?Fe(e,null,[t]):Fe(e,t):Fe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Jl(n)&&(n=[n]),Fe(e,t,n))}finally{Zu(1)}}function yF(e,t,n,r){const o=n[r];if(o&&N0(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function N0(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(_o(n[r],t[r]))return!1;return sl>0&&fr&&fr.push(e),!0}const O0="3.5.41";/**
15
- * @vue/runtime-dom v3.5.41
16
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
- * @license MIT
18
- **/let af;const Th=typeof window<"u"&&window.trustedTypes;if(Th)try{af=Th.createPolicy("vue",{createHTML:e=>e})}catch{}const Eg=af?e=>af.createHTML(e):e=>e,$0="http://www.w3.org/2000/svg",D0="http://www.w3.org/1998/Math/MathML",Ba=typeof document<"u"?document:null,Sh=Ba&&Ba.createElement("template"),F0={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Ba.createElementNS($0,e):t==="mathml"?Ba.createElementNS(D0,e):n?Ba.createElement(e,{is:n}):Ba.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Ba.createTextNode(e),createComment:e=>Ba.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ba.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,a){const s=n?n.previousSibling:t.lastChild;if(o&&(o===a||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===a||!(o=o.nextSibling)););else{Sh.innerHTML=Eg(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const i=Sh.content;if(r==="svg"||r==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ts="transition",Rl="animation",Xl=Symbol("_vtc"),Rg={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},B0=wn({},tg,Rg),U0=e=>(e.displayName="Transition",e.props=B0,e),lu=U0((e,{slots:t})=>Jf($S,z0(e),t)),di=(e,t=[])=>{at(e)?e.forEach(n=>n(...t)):e&&e(...t)},Ch=e=>e?at(e)?e.some(t=>t.length>1):e.length>1:!1;function z0(e){const t={};for(const ee in e)ee in Rg||(t[ee]=e[ee]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:c=s,appearToClass:d=i,leaveFromClass:v=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:y=`${n}-leave-to`}=e,S=H0(o),I=S&&S[0],U=S&&S[1],{onBeforeEnter:O,onEnter:D,onEnterCancelled:q,onLeave:M,onLeaveCancelled:pe,onBeforeAppear:ue=O,onAppear:K=D,onAppearCancelled:ie=q}=t,ye=(ee,me,re,Ae)=>{ee._enterCancelled=Ae,fi(ee,me?d:i),fi(ee,me?c:s),re&&re()},Pe=(ee,me)=>{ee._isLeaving=!1,fi(ee,v),fi(ee,y),fi(ee,f),me&&me()},ge=ee=>(me,re)=>{const Ae=ee?K:D,De=()=>ye(me,ee,re);di(Ae,[me,De]),xh(()=>{fi(me,ee?l:a),$a(me,ee?d:i),Ch(Ae)||kh(me,r,I,De)})};return wn(t,{onBeforeEnter(ee){di(O,[ee]),$a(ee,a),$a(ee,s)},onBeforeAppear(ee){di(ue,[ee]),$a(ee,l),$a(ee,c)},onEnter:ge(!1),onAppear:ge(!0),onLeave(ee,me){ee._isLeaving=!0;const re=()=>Pe(ee,me);$a(ee,v),ee._enterCancelled?($a(ee,f),_h(ee)):(_h(ee),$a(ee,f)),xh(()=>{ee._isLeaving&&(fi(ee,v),$a(ee,y),Ch(M)||kh(ee,r,U,re))}),di(M,[ee,re])},onEnterCancelled(ee){ye(ee,!1,void 0,!0),di(q,[ee])},onAppearCancelled(ee){ye(ee,!0,void 0,!0),di(ie,[ee])},onLeaveCancelled(ee){Pe(ee),di(pe,[ee])}})}function H0(e){if(e==null)return null;if(jt(e))return[bd(e.enter),bd(e.leave)];{const t=bd(e);return[t,t]}}function bd(e){return WT(e)}function $a(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Xl]||(e[Xl]=new Set)).add(t)}function fi(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Xl];n&&(n.delete(t),n.size||(e[Xl]=void 0))}function xh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let q0=0;function kh(e,t,n,r){const o=e._endId=++q0,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=W0(e,t);if(!s)return r();const c=s+"end";let d=0;const v=()=>{e.removeEventListener(c,f),a()},f=y=>{y.target===e&&++d>=l&&v()};setTimeout(()=>{d<l&&v()},i+1),e.addEventListener(c,f)}function W0(e,t){const n=window.getComputedStyle(e),r=S=>(n[S]||"").split(", "),o=r(`${Ts}Delay`),a=r(`${Ts}Duration`),s=Ih(o,a),i=r(`${Rl}Delay`),l=r(`${Rl}Duration`),c=Ih(i,l);let d=null,v=0,f=0;t===Ts?s>0&&(d=Ts,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?Ts:Rl:null,f=d?d===Ts?a.length:l.length:0);const y=d===Ts&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ts}Property`).toString());return{type:d,timeout:v,propCount:f,hasTransform:y}}function Ih(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Ah(n)+Ah(e[r])))}function Ah(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function _h(e){return(e?e.ownerDocument:document).body.offsetHeight}function G0(e,t,n){const r=e[Xl];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const nc=Symbol("_vod"),Mg=Symbol("_vsh"),wF={name:"show",beforeMount(e,{value:t},{transition:n}){e[nc]=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:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Ml(e,!0),r.enter(e)):r.leave(e,()=>{Ml(e,!1)}):Ml(e,t))},beforeUnmount(e,{value:t}){Ml(e,t)}};function Ml(e,t){e.style.display=t?e[nc]:"none",e[Mg]=!t}const V0=Symbol(""),K0=/(?:^|;)\s*display\s*:/;function Y0(e,t,n){const r=e.style,o=Wt(n);let a=!1;if(n&&!o){if(t)if(Wt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Ol(r,i,"")}else for(const s in t)n[s]==null&&Ol(r,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?Q0(e,s,!Wt(t)&&t?t[s]:void 0,i)||Ol(r,s,i):Ol(r,s,"")}}else if(o){if(t!==n){const s=r[V0];s&&(n+=";"+s),r.cssText=n,a=K0.test(n)}}else t&&e.removeAttribute("style");nc in e&&(e[nc]=a?r.display:"",e[Mg]&&(r.display="none"))}const Ph=/\s*!important$/;function Ol(e,t,n){if(at(n))n.forEach(r=>Ol(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=J0(e,t);Ph.test(n)?e.setProperty(Ns(r),n.replace(Ph,""),"important"):e[r]=n}}const Eh=["Webkit","Moz","ms"],Td={};function J0(e,t){const n=Td[t];if(n)return n;let r=pr(t);if(r!=="filter"&&r in e)return Td[t]=r;r=vc(r);for(let o=0;o<Eh.length;o++){const a=Eh[o]+r;if(a in e)return Td[t]=a}return t}function Q0(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Wt(r)&&n===r}const Rh="http://www.w3.org/1999/xlink";function Mh(e,t,n,r,o,a=QT(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Rh,t.slice(6,t.length)):e.setAttributeNS(Rh,t,n):n==null||a&&!Iv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":jo(n)?String(n):n)}function jh(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Eg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=Iv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function yi(e,t,n,r){e.addEventListener(t,n,r)}function X0(e,t,n,r){e.removeEventListener(t,n,r)}const Lh=Symbol("_vei");function Z0(e,t,n,r,o=null){const a=e[Lh]||(e[Lh]={}),s=a[t];if(r&&s)s.value=r;else{const[i,l]=nC(t);if(r){const c=a[t]=aC(r,o);yi(e,i,c,l)}else s&&(X0(e,i,s,l),a[t]=void 0)}}const eC=/(Once|Passive|Capture)$/,tC=/^on:?(?:Once|Passive|Capture)$/;function nC(e){let t,n;for(;(n=e.match(eC))&&!tC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Ns(e.slice(2)),t]}let Sd=0;const rC=Promise.resolve(),oC=()=>Sd||(rC.then(()=>Sd=0),Sd=Date.now());function aC(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const o=n.value;if(at(o)){const a=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{a.call(r),r._stopped=!0};const s=o.slice(),i=[r];for(let l=0;l<s.length&&!r._stopped;l++){const c=s[l];c&&Zr(c,t,5,i)}}else Zr(o,t,5,[r])};return n.value=e,n.attached=oC(),n}const Nh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,sC=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?G0(e,r,s):t==="style"?Y0(e,n,r):fc(t)?pc(t)||Z0(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):iC(e,t,r,s))?(jh(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Mh(e,t,r,s,a,t!=="value")):e._isVueCE&&(lC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Wt(r)))?jh(e,pr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Mh(e,t,r,s))};function iC(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Nh(t)&&ht(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Nh(t)&&Wt(n)?!1:t in e}function lC(e,t){const n=e._def.props;if(!n)return!1;const r=pr(t);return Array.isArray(n)?n.some(o=>pr(o)===r):Object.keys(n).some(o=>pr(o)===r)}const rc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return at(t)?n=>Uu(t,n):t};function uC(e){e.target.composing=!0}function Oh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const wi=Symbol("_assign"),Pu=Symbol("_initialValue");function Cd(e,t,n){return t&&(e=e.trim()),n&&(e=jf(e)),e}const Fn={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e.parentNode&&(e.type==="text"?e[Pu]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[Pu]=e.defaultValue.replace(/\r\n?/g,`
19
- `))),e[wi]=rc(o);const a=r||o.props&&o.props.type==="number";yi(e,t?"change":"input",s=>{s.target.composing||e[wi](Cd(e.value,n,a))}),(n||a)&&yi(e,"change",()=>{e.value=Cd(e.value,n,a)}),t||(yi(e,"compositionstart",uC),yi(e,"compositionend",Oh),yi(e,"change",Oh))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){const o=t??"",a=e[Pu];delete e[Pu],a!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==a?e[wi](Cd(e.value,n,r)):e.value=o},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[wi]=rc(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?jf(e.value):e.value,l=t??"";if(i===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},cC={deep:!0,created(e,t,n){e[wi]=rc(n),yi(e,"change",()=>{const r=e._modelValue,o=dC(e),a=e.checked,s=e[wi];if(at(r)){const i=Av(r,o),l=i!==-1;if(a&&!l)s(r.concat(o));else if(!a&&l){const c=[...r];c.splice(i,1),s(c)}}else if(hc(r)){const i=new Set(r);a?i.add(o):i.delete(o),s(i)}else s(jg(e,a))})},mounted:$h,beforeUpdate(e,t,n){e[wi]=rc(n),$h(e,t,n)}};function $h(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(at(t))o=Av(t,r.props.value)>-1;else if(hc(t))o=t.has(r.props.value);else{if(t===n)return;o=nu(t,jg(e,!0))}e.checked!==o&&(e.checked=o)}function dC(e){return"_value"in e?e._value:e.value}function jg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const fC=["ctrl","shift","alt","meta"],pC={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)=>fC.some(n=>e[`${n}Key`]&&!t.includes(n))},vt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(o,...a)=>{for(let s=0;s<t.length;s++){const i=pC[t[s]];if(i&&i(o,t))return}return e(o,...a)})},hC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Cr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=o=>{if(!("key"in o))return;const a=Ns(o.key);if(t.some(s=>s===a||hC[s]===a))return e(o)})},mC=wn({patchProp:sC},F0);let Dh;function vC(){return Dh||(Dh=b0(mC))}const gC=(...e)=>{const t=vC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=wC(r);if(!o)return;const a=t._component;!ht(a)&&!a.render&&!a.template&&(a.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,yC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function yC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function wC(e){return Wt(e)?document.querySelector(e):e}const bC="modulepreload",TC=function(e){return"/"+e},Fh={},Io=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=s(n.map(c=>{if(c=TC(c),c in Fh)return;Fh[c]=!0;const d=c.endsWith(".css"),v=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${v}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":bC,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 o.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
20
- * vue-router v4.6.4
21
- * (c) 2025 Eduardo San Martin Morote
22
- * @license MIT
23
- */const Wi=typeof document<"u";function Lg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function SC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Lg(e.default)}const Rt=Object.assign;function xd(e,t){const n={};for(const r in t){const o=t[r];n[r]=No(o)?o.map(e):e(o)}return n}const Hl=()=>{},No=Array.isArray;function Bh(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Ng=/#/g,CC=/&/g,xC=/\//g,kC=/=/g,IC=/\?/g,Og=/\+/g,AC=/%5B/g,_C=/%5D/g,$g=/%5E/g,PC=/%60/g,Dg=/%7B/g,EC=/%7C/g,Fg=/%7D/g,RC=/%20/g;function Qf(e){return e==null?"":encodeURI(""+e).replace(EC,"|").replace(AC,"[").replace(_C,"]")}function MC(e){return Qf(e).replace(Dg,"{").replace(Fg,"}").replace($g,"^")}function sf(e){return Qf(e).replace(Og,"%2B").replace(RC,"+").replace(Ng,"%23").replace(CC,"%26").replace(PC,"`").replace(Dg,"{").replace(Fg,"}").replace($g,"^")}function jC(e){return sf(e).replace(kC,"%3D")}function LC(e){return Qf(e).replace(Ng,"%23").replace(IC,"%3F")}function NC(e){return LC(e).replace(xC,"%2F")}function Zl(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const OC=/\/$/,$C=e=>e.replace(OC,"");function kd(e,t,n="/"){let r,o={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(r=t.slice(0,l),a=t.slice(l,i>0?i:t.length),o=e(a.slice(1))),i>=0&&(r=r||t.slice(0,i),s=t.slice(i,t.length)),r=UC(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:Zl(s)}}function DC(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Uh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function FC(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&ll(t.matched[r],n.matched[o])&&Bg(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ll(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Bg(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!BC(e[n],t[n]))return!1;return!0}function BC(e,t){return No(e)?zh(e,t):No(t)?zh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function zh(e,t){return No(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function UC(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),o=r[r.length-1];(o===".."||o===".")&&r.push("");let a=n.length-1,s,i;for(s=0;s<r.length;s++)if(i=r[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+r.slice(s).join("/")}const Ss={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let lf=function(e){return e.pop="pop",e.push="push",e}({}),Id=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function zC(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),$C(e)}const HC=/^[^#]+#/;function qC(e,t){return e.replace(HC,"#")+t}function WC(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const kc=()=>({left:window.scrollX,top:window.scrollY});function GC(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=WC(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Hh(e,t){return(history.state?history.state.position-t:-1)+e}const uf=new Map;function VC(e,t){uf.set(e,t)}function KC(e){const t=uf.get(e);return uf.delete(e),t}function YC(e){return typeof e=="string"||e&&typeof e=="object"}function Ug(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 zg=Symbol("");an.MATCHER_NOT_FOUND+"",an.NAVIGATION_GUARD_REDIRECT+"",an.NAVIGATION_ABORTED+"",an.NAVIGATION_CANCELLED+"",an.NAVIGATION_DUPLICATED+"";function ul(e,t){return Rt(new Error,{type:e,[zg]:!0},t)}function Da(e,t){return e instanceof Error&&zg in e&&(t==null||!!(e.type&t))}const JC=["params","query","hash"];function QC(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of JC)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function XC(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const o=n[r].replace(Og," "),a=o.indexOf("="),s=Zl(a<0?o:o.slice(0,a)),i=a<0?null:Zl(o.slice(a+1));if(s in t){let l=t[s];No(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function qh(e){let t="";for(let n in e){const r=e[n];if(n=jC(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(No(r)?r.map(o=>o&&sf(o)):[r&&sf(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function ZC(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=No(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const ex=Symbol(""),Wh=Symbol(""),Ic=Symbol(""),Xf=Symbol(""),cf=Symbol("");function jl(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function As(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((i,l)=>{const c=f=>{f===!1?l(ul(an.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):YC(f)?l(ul(an.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&r.enterCallbacks[o]===s&&typeof f=="function"&&s.push(f),i())},d=a(()=>e.call(r&&r.instances[o],t,n,c));let v=Promise.resolve(d);e.length<3&&(v=v.then(c)),v.catch(f=>l(f))})}function Ad(e,t,n,r,o=a=>a()){const a=[];for(const s of e)for(const i in s.components){let l=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if(Lg(l)){const c=(l.__vccOpts||l)[t];c&&a.push(As(c,n,r,s,i,o))}else{let c=l();a.push(()=>c.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const v=SC(d)?d.default:d;s.mods[i]=d,s.components[i]=v;const f=(v.__vccOpts||v)[t];return f&&As(f,n,r,s,i,o)()}))}}return a}function tx(e,t){const n=[],r=[],o=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const i=t.matched[s];i&&(e.matched.find(c=>ll(c,i))?r.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(c=>ll(c,l))||o.push(l))}return[n,r,o]}/*!
24
- * vue-router v4.6.4
25
- * (c) 2025 Eduardo San Martin Morote
26
- * @license MIT
27
- */let nx=()=>location.protocol+"//"+location.host;function Hg(e,t){const{pathname:n,search:r,hash:o}=t,a=e.indexOf("#");if(a>-1){let s=o.includes(e.slice(a))?e.slice(a).length:1,i=o.slice(s);return i[0]!=="/"&&(i="/"+i),Uh(i,"")}return Uh(n,e)+r+o}function rx(e,t,n,r){let o=[],a=[],s=null;const i=({state:f})=>{const y=Hg(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 r(y);o.forEach(O=>{O(n.value,S,{delta:U,type:lf.pop,direction:U?U>0?Id.forward:Id.back:Id.unknown})})};function l(){s=n.value}function c(f){o.push(f);const y=()=>{const S=o.indexOf(f);S>-1&&o.splice(S,1)};return a.push(y),y}function d(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Rt({},f.state,{scroll:kc()}),"")}}function v(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",d)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",d),document.addEventListener("visibilitychange",d),{pauseListeners:l,listen:c,destroy:v}}function Gh(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?kc():null}}function ox(e){const{history:t,location:n}=window,r={value:Hg(e,n)},o={value:t.state};o.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,c,d){const v=e.indexOf("#"),f=v>-1?(n.host&&document.querySelector("base")?e:e.slice(v))+l:nx()+e+l;try{t[d?"replaceState":"pushState"](c,"",f),o.value=c}catch(y){console.error(y),n[d?"replace":"assign"](f)}}function s(l,c){a(l,Rt({},t.state,Gh(o.value.back,l,o.value.forward,!0),c,{position:o.value.position}),!0),r.value=l}function i(l,c){const d=Rt({},o.value,t.state,{forward:l,scroll:kc()});a(d.current,d,!0),a(l,Rt({},Gh(r.value,l,null),{position:d.position+1},c),!1),r.value=l}return{location:r,state:o,push:i,replace:s}}function ax(e){e=zC(e);const t=ox(e),n=rx(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=Rt({location:"",base:e,go:r,createHref:qC.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function sx(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),ax(e)}let bi=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var _n=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}(_n||{});const ix={type:bi.Static,value:""},lx=/[a-zA-Z0-9_]/;function ux(e){if(!e)return[[]];if(e==="/")return[[ix]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${n})/"${c}": ${y}`)}let n=_n.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let i=0,l,c="",d="";function v(){c&&(n===_n.Static?a.push({type:bi.Static,value:c}):n===_n.Param||n===_n.ParamRegExp||n===_n.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),a.push({type:bi.Param,value:c,regexp:d,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function f(){c+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==_n.ParamRegExp){r=n,n=_n.EscapeNext;continue}switch(n){case _n.Static:l==="/"?(c&&v(),s()):l===":"?(v(),n=_n.Param):f();break;case _n.EscapeNext:f(),n=r;break;case _n.Param:l==="("?n=_n.ParamRegExp:lx.test(l)?f():(v(),n=_n.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case _n.ParamRegExp:l===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+l:n=_n.ParamRegExpEnd:d+=l;break;case _n.ParamRegExpEnd:v(),n=_n.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,d="";break;default:t("Unknown state");break}}return n===_n.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),v(),s(),o}const Vh="[^/]+?",cx={sensitive:!1,strict:!1,start:!0,end:!0};var cr=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}(cr||{});const dx=/[.+*?^${}()[\]/\\]/g;function fx(e,t){const n=Rt({},cx,t),r=[];let o=n.start?"^":"";const a=[];for(const c of e){const d=c.length?[]:[cr.Root];n.strict&&!c.length&&(o+="/");for(let v=0;v<c.length;v++){const f=c[v];let y=cr.Segment+(n.sensitive?cr.BonusCaseSensitive:0);if(f.type===bi.Static)v||(o+="/"),o+=f.value.replace(dx,"\\$&"),y+=cr.Static;else if(f.type===bi.Param){const{value:S,repeatable:I,optional:U,regexp:O}=f;a.push({name:S,repeatable:I,optional:U});const D=O||Vh;if(D!==Vh){y+=cr.BonusCustomRegExp;try{`${D}`}catch(M){throw new Error(`Invalid custom RegExp for param "${S}" (${D}): `+M.message)}}let q=I?`((?:${D})(?:/(?:${D}))*)`:`(${D})`;v||(q=U&&c.length<2?`(?:/${q})`:"/"+q),U&&(q+="?"),o+=q,y+=cr.Dynamic,U&&(y+=cr.BonusOptional),I&&(y+=cr.BonusRepeatable),D===".*"&&(y+=cr.BonusWildcard)}d.push(y)}r.push(d)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=cr.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function i(c){const d=c.match(s),v={};if(!d)return null;for(let f=1;f<d.length;f++){const y=d[f]||"",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===bi.Static)d+=y.value;else if(y.type===bi.Param){const{value:S,repeatable:I,optional:U}=y,O=S in c?c[S]:"";if(No(O)&&!I)throw new Error(`Provided param "${S}" is an array but it is not repeatable (* or + modifiers)`);const D=No(O)?O.join("/"):O;if(!D)if(U)f.length<2&&(d.endsWith("/")?d=d.slice(0,-1):v=!0);else throw new Error(`Missing required param "${S}"`);d+=D}}return d||"/"}return{re:s,score:r,keys:a,parse:i,stringify:l}}function px(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===cr.Static+cr.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===cr.Static+cr.Segment?1:-1:0}function qg(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=px(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(Kh(r))return 1;if(Kh(o))return-1}return o.length-r.length}function Kh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const hx={strict:!1,end:!0,sensitive:!1};function mx(e,t,n){const r=fx(ux(e.path),n),o=Rt(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function vx(e,t){const n=[],r=new Map;t=Bh(hx,t);function o(v){return r.get(v)}function a(v,f,y){const S=!y,I=Jh(v);I.aliasOf=y&&y.record;const U=Bh(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(Jh(Rt({},I,{components:y?y.record.components:I.components,path:pe,aliasOf:y?y.record:I})))}let D,q;for(const M of O){const{path:pe}=M;if(f&&pe[0]!=="/"){const ue=f.record.path,K=ue[ue.length-1]==="/"?"":"/";M.path=f.record.path+(pe&&K+pe)}if(D=mx(M,f,U),y?y.alias.push(D):(q=q||D,q!==D&&q.alias.push(D),S&&v.name&&!Qh(D)&&s(v.name)),Wg(D)&&l(D),I.children){const ue=I.children;for(let K=0;K<ue.length;K++)a(ue[K],D,y&&y.children[K])}y=y||D}return q?()=>{s(q)}:Hl}function s(v){if(Ug(v)){const f=r.get(v);f&&(r.delete(v),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(v);f>-1&&(n.splice(f,1),v.record.name&&r.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=wx(v,n);n.splice(f,0,v),v.record.name&&!Qh(v)&&r.set(v.record.name,v)}function c(v,f){let y,S={},I,U;if("name"in v&&v.name){if(y=r.get(v.name),!y)throw ul(an.MATCHER_NOT_FOUND,{location:v});U=y.record.name,S=Rt(Yh(f.params,y.keys.filter(q=>!q.optional).concat(y.parent?y.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),v.params&&Yh(v.params,y.keys.map(q=>q.name))),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?r.get(f.name):n.find(q=>q.re.test(f.path)),!y)throw ul(an.MATCHER_NOT_FOUND,{location:v,currentLocation:f});U=y.record.name,S=Rt({},f.params,v.params),I=y.stringify(S)}const O=[];let D=y;for(;D;)O.unshift(D.record),D=D.parent;return{name:U,path:I,params:S,matched:O,meta:yx(O)}}e.forEach(v=>a(v));function d(){n.length=0,r.clear()}return{addRoute:a,resolve:c,removeRoute:s,clearRoutes:d,getRoutes:i,getRecordMatcher:o}}function Yh(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Jh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:gx(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 gx(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Qh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function yx(e){return e.reduce((t,n)=>Rt(t,n.meta),{})}function wx(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;qg(e,t[a])<0?r=a:n=a+1}const o=bx(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function bx(e){let t=e;for(;t=t.parent;)if(Wg(t)&&qg(e,t)===0)return t}function Wg({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Xh(e){const t=Mo(Ic),n=Mo(Xf),r=Y(()=>{const l=m(e.to);return t.resolve(l)}),o=Y(()=>{const{matched:l}=r.value,{length:c}=l,d=l[c-1],v=n.matched;if(!d||!v.length)return-1;const f=v.findIndex(ll.bind(null,d));if(f>-1)return f;const y=Zh(l[c-2]);return c>1&&Zh(d)===y&&v[v.length-1].path!==y?v.findIndex(ll.bind(null,l[c-2])):f}),a=Y(()=>o.value>-1&&kx(n.params,r.value.params)),s=Y(()=>o.value>-1&&o.value===n.matched.length-1&&Bg(n.params,r.value.params));function i(l={}){if(xx(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:r,href:Y(()=>r.value.href),isActive:a,isExactActive:s,navigate:i}}function Tx(e){return e.length===1?e[0]:e}const Sx=bn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Xh,setup(e,{slots:t}){const n=wc(Xh(e)),{options:r}=Mo(Ic),o=Y(()=>({[em(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[em(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&Tx(t.default(n));return e.custom?a:Jf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),Cx=Sx;function xx(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 kx(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!No(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function Zh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const em=(e,t,n)=>e??t??n,Ix=bn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Mo(cf),o=Y(()=>e.route||r.value),a=Mo(Wh,0),s=Y(()=>{let c=m(a);const{matched:d}=o.value;let v;for(;(v=d[c])&&!v.components;)c++;return c}),i=Y(()=>o.value.matched[s.value]);zu(Wh,Y(()=>s.value+1)),zu(ex,i),zu(cf,o);const l=T();return ot(()=>[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||!ll(d,y)||!f)&&(d.enterCallbacks[v]||[]).forEach(I=>I(c))},{flush:"post"}),()=>{const c=o.value,d=e.name,v=i.value,f=v&&v.components[d];if(!f)return tm(n.default,{Component:f,route:c});const y=v.props[d],S=y?y===!0?c.params:typeof y=="function"?y(c):y:null,U=Jf(f,Rt({},S,t,{onVnodeUnmounted:O=>{O.component.isUnmounted&&(v.instances[d]=null)},ref:l}));return tm(n.default,{Component:U,route:c})||U}}});function tm(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ax=Ix;function _x(e){const t=vx(e.routes,e),n=e.parseQuery||XC,r=e.stringifyQuery||qh,o=e.history,a=jl(),s=jl(),i=jl(),l=wS(Ss);let c=Ss;Wi&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=xd.bind(null,N=>""+N),v=xd.bind(null,NC),f=xd.bind(null,Zl);function y(N,oe){let se,je;return Ug(N)?(se=t.getRecordMatcher(N),je=oe):je=N,t.addRoute(je,se)}function S(N){const oe=t.getRecordMatcher(N);oe&&t.removeRoute(oe)}function I(){return t.getRoutes().map(N=>N.record)}function U(N){return!!t.getRecordMatcher(N)}function O(N,oe){if(oe=Rt({},oe||l.value),typeof N=="string"){const H=kd(n,N,oe.path),le=t.resolve({path:H.path},oe),ne=o.createHref(H.fullPath);return Rt(H,le,{params:f(le.params),hash:Zl(H.hash),redirectedFrom:void 0,href:ne})}let se;if(N.path!=null)se=Rt({},N,{path:kd(n,N.path,oe.path).path});else{const H=Rt({},N.params);for(const le in H)H[le]==null&&delete H[le];se=Rt({},N,{params:v(H)}),oe.params=v(oe.params)}const je=t.resolve(se,oe),qe=N.hash||"";je.params=d(f(je.params));const A=DC(r,Rt({},N,{hash:MC(qe),path:je.path})),R=o.createHref(A);return Rt({fullPath:A,hash:qe,query:r===qh?ZC(N.query):N.query||{}},je,{redirectedFrom:void 0,href:R})}function D(N){return typeof N=="string"?kd(n,N,l.value.path):Rt({},N)}function q(N,oe){if(c!==N)return ul(an.NAVIGATION_CANCELLED,{from:oe,to:N})}function M(N){return K(N)}function pe(N){return M(Rt(D(N),{replace:!0}))}function ue(N,oe){const se=N.matched[N.matched.length-1];if(se&&se.redirect){const{redirect:je}=se;let qe=typeof je=="function"?je(N,oe):je;return typeof qe=="string"&&(qe=qe.includes("?")||qe.includes("#")?qe=D(qe):{path:qe},qe.params={}),Rt({query:N.query,hash:N.hash,params:qe.path!=null?{}:N.params},qe)}}function K(N,oe){const se=c=O(N),je=l.value,qe=N.state,A=N.force,R=N.replace===!0,H=ue(se,je);if(H)return K(Rt(D(H),{state:typeof H=="object"?Rt({},qe,H.state):qe,force:A,replace:R}),oe||se);const le=se;le.redirectedFrom=oe;let ne;return!A&&FC(r,je,se)&&(ne=ul(an.NAVIGATION_DUPLICATED,{to:le,from:je}),Ce(je,je,!0,!1)),(ne?Promise.resolve(ne):Pe(le,je)).catch(ae=>Da(ae)?Da(ae,an.NAVIGATION_GUARD_REDIRECT)?ae:Se(ae):Le(ae,le,je)).then(ae=>{if(ae){if(Da(ae,an.NAVIGATION_GUARD_REDIRECT))return K(Rt({replace:R},D(ae.to),{state:typeof ae.to=="object"?Rt({},qe,ae.to.state):qe,force:A}),oe||le)}else ae=ee(le,je,!0,R,qe);return ge(le,je,ae),ae})}function ie(N,oe){const se=q(N,oe);return se?Promise.reject(se):Promise.resolve()}function ye(N){const oe=Xe.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(N):N()}function Pe(N,oe){let se;const[je,qe,A]=tx(N,oe);se=Ad(je.reverse(),"beforeRouteLeave",N,oe);for(const H of je)H.leaveGuards.forEach(le=>{se.push(As(le,N,oe))});const R=ie.bind(null,N,oe);return se.push(R),ce(se).then(()=>{se=[];for(const H of a.list())se.push(As(H,N,oe));return se.push(R),ce(se)}).then(()=>{se=Ad(qe,"beforeRouteUpdate",N,oe);for(const H of qe)H.updateGuards.forEach(le=>{se.push(As(le,N,oe))});return se.push(R),ce(se)}).then(()=>{se=[];for(const H of A)if(H.beforeEnter)if(No(H.beforeEnter))for(const le of H.beforeEnter)se.push(As(le,N,oe));else se.push(As(H.beforeEnter,N,oe));return se.push(R),ce(se)}).then(()=>(N.matched.forEach(H=>H.enterCallbacks={}),se=Ad(A,"beforeRouteEnter",N,oe,ye),se.push(R),ce(se))).then(()=>{se=[];for(const H of s.list())se.push(As(H,N,oe));return se.push(R),ce(se)}).catch(H=>Da(H,an.NAVIGATION_CANCELLED)?H:Promise.reject(H))}function ge(N,oe,se){i.list().forEach(je=>ye(()=>je(N,oe,se)))}function ee(N,oe,se,je,qe){const A=q(N,oe);if(A)return A;const R=oe===Ss,H=Wi?history.state:{};se&&(je||R?o.replace(N.fullPath,Rt({scroll:R&&H&&H.scroll},qe)):o.push(N.fullPath,qe)),l.value=N,Ce(N,oe,se,R),Se()}let me;function re(){me||(me=o.listen((N,oe,se)=>{if(!it.listening)return;const je=O(N),qe=ue(je,it.currentRoute.value);if(qe){K(Rt(qe,{replace:!0,force:!0}),je).catch(Hl);return}c=je;const A=l.value;Wi&&VC(Hh(A.fullPath,se.delta),kc()),Pe(je,A).catch(R=>Da(R,an.NAVIGATION_ABORTED|an.NAVIGATION_CANCELLED)?R:Da(R,an.NAVIGATION_GUARD_REDIRECT)?(K(Rt(D(R.to),{force:!0}),je).then(H=>{Da(H,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===lf.pop&&o.go(-1,!1)}).catch(Hl),Promise.reject()):(se.delta&&o.go(-se.delta,!1),Le(R,je,A))).then(R=>{R=R||ee(je,A,!1),R&&(se.delta&&!Da(R,an.NAVIGATION_CANCELLED)?o.go(-se.delta,!1):se.type===lf.pop&&Da(R,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),ge(je,A,R)}).catch(Hl)}))}let Ae=jl(),De=jl(),Ne;function Le(N,oe,se){Se(N);const je=De.list();return je.length?je.forEach(qe=>qe(N,oe,se)):console.error(N),Promise.reject(N)}function xe(){return Ne&&l.value!==Ss?Promise.resolve():new Promise((N,oe)=>{Ae.add([N,oe])})}function Se(N){return Ne||(Ne=!N,re(),Ae.list().forEach(([oe,se])=>N?se(N):oe()),Ae.reset()),N}function Ce(N,oe,se,je){const{scrollBehavior:qe}=e;if(!Wi||!qe)return Promise.resolve();const A=!se&&KC(Hh(N.fullPath,0))||(je||!se)&&history.state&&history.state.scroll||null;return Nt().then(()=>qe(N,oe,A)).then(R=>R&&GC(R)).catch(R=>Le(R,N,oe))}const Ee=N=>o.go(N);let Je;const Xe=new Set,it={currentRoute:l,listening:!0,addRoute:y,removeRoute:S,clearRoutes:t.clearRoutes,hasRoute:U,getRoutes:I,resolve:O,options:e,push:M,replace:pe,go:Ee,back:()=>Ee(-1),forward:()=>Ee(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:De.add,isReady:xe,install(N){N.component("RouterLink",Cx),N.component("RouterView",Ax),N.config.globalProperties.$router=it,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>m(l)}),Wi&&!Je&&l.value===Ss&&(Je=!0,M(o.location).catch(je=>{}));const oe={};for(const je in Ss)Object.defineProperty(oe,je,{get:()=>l.value[je],enumerable:!0});N.provide(Ic,it),N.provide(Xf,qv(oe)),N.provide(cf,l);const se=N.unmount;Xe.add(N),N.unmount=function(){Xe.delete(N),Xe.size<1&&(c=Ss,me&&me(),me=null,l.value=Ss,Je=!1,Ne=!1),se()}}};function ce(N){return N.reduce((oe,se)=>oe.then(()=>ye(se)),Promise.resolve())}return it}function Px(){return Mo(Ic)}function Ex(e){return Mo(Xf)}const nm=768;function Zf(){const e=T(typeof window<"u"?window.innerWidth<nm:!1);let t=null;function n(r){e.value=r.matches}return Ii(()=>{t=window.matchMedia(`(max-width: ${nm-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),su(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Rx={key:0,class:"desktop-sidebar"},Mx={class:"desktop-main"},rm="codex-web-local.sidebar-width.v1",jx=260,Lx=620,om=320,Nx=bn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Zf();function r(c){return Math.min(Lx,Math.max(jx,c))}function o(){if(typeof window>"u")return om;const c=window.localStorage.getItem(rm),d=Number(c);return Number.isFinite(d)?r(d):om}const a=T(o()),s=Y(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(c){typeof window>"u"||window.localStorage.setItem(rm,String(c))}function l(c){c.preventDefault();const d=c.clientX,v=a.value,f=S=>{const I=S.clientX-d;a.value=r(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:dt(["desktop-layout",{"is-mobile":m(n)}]),style:Jr(s.value)},[m(n)?(P(),et(al,{key:0,to:"body"},[Fe(lu,{name:"drawer"},{default:pt(()=>[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]=vt(()=>{},["stop"]))},[xr(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",Rx,[xr(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",Mx,[xr(c.$slots,"content",{},void 0)])],6))}}),Ct=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},Ox=Ct(Nx,[["__scopeId","data-v-aa0e8811"]]);function am(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Or extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function to(e,t){if(typeof e=="string"&&e.length>0)return e;const n=am(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=am(r);return o&&typeof o.message=="string"&&o.message.length>0?o.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function eo(e,t,n){return e instanceof Or?e:e instanceof Error?new Or(e.message||t,{code:"unknown_error",method:n}):new Or(t,{code:"unknown_error",method:n})}function Gg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function $x(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Or(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,a=null;try{a=await r.text(),o=JSON.parse(a)}catch{o=null}if(!r.ok){const i=to(o,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${r.status}`;throw new Or(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:r.status})}const s=o;if(!s||typeof s!="object"||!("result"in s))throw new Or(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function Dx(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Or(to(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 Fx(e){const t=Gg(e);if(!t||typeof t.method!="string"||t.method.length===0)return null;const n=typeof t.atIso=="string"&&t.atIso.length>0?t.atIso:new Date().toISOString();return{method:t.method,params:t.params??null,atIso:n}}function sm(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Bx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(c,d)=>{if(n||r!==null)return;const v=Math.min(1e3*2**d,1e4);r=window.setTimeout(()=>{r=null,!n&&c()},v)},s=c=>{const d=Fx(c);d&&e(d)},i=(c=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const d=new EventSource("/codex-api/events");let v=!1;d.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},d.addEventListener("ready",f=>{try{const y=f.data?JSON.parse(f.data):{ok:!0};sm(e,y)}catch{sm(e)}}),d.onerror=()=>{n||v||d.readyState===EventSource.CLOSED&&(v=!0,d.close(),a(()=>i(c+1),c))},t=()=>{v=!0,d.close()}},l=(c=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const d=window.location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${d}//${window.location.host}/codex-api/ws`);let f=!1,y=!1,S=window.setTimeout(()=>{f||n||y||(y=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,o(),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,o(),t==null||t()}}async function Ux(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new Or(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Or(to(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function zx(){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 Or(to(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Gg(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}async function st(e,t){try{return await $x(e,t)}catch(n){throw eo(n,`RPC ${e} failed`,e)}}function Kt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const o=n.error;return typeof o=="string"&&o.trim().length>0?o:t}function Ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function te(e){return typeof e=="string"&&e.length>0?e:null}function Ht(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function nr(e){return typeof e=="boolean"?e:null}function Po(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Ai(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{throw new Error(`Expected JSON response from ${e.url||"request"}`)}}function oc(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.kind),o=te(t.name),a=te(t.prompt),s=te(t.rrule),i=te(t.status);return!n||!o||!a||!s||r!=="heartbeat"&&r!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:a,rrule:s,status:i,targetThreadId:te(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Ht(t.createdAtMs),updatedAtMs:Ht(t.updatedAtMs),nextRunAtMs:Ht(t.nextRunAtMs)}}function Vg(e){if(Array.isArray(e))return e.flatMap(n=>{const r=oc(n);return r?[r]:[]});const t=oc(e);return t?[t]:[]}async function Hx(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(to(t,"Failed to load thread automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=Vg(s);i.length>0&&(r[a]=i)}return r}async function qx(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(to(t,"Failed to load project automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=Vg(s);i.length>0&&(r[a]=i)}return r}async function Wx(e){var o;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(to(n,"Failed to save thread automation"));const r=oc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function Gx(e){var o;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(to(n,"Failed to save project automation"));const r=oc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function im(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(to(o,"Failed to delete thread automation"))}async function Kg(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(to(o,"Failed to delete project automation"))}async function Vx(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(to(r,"Failed to run thread automation"))}const Kx=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Yg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||Kx.has(n))}function Yx(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],r=[];for(const o of n){if(!o||typeof o!="object"||Array.isArray(o))continue;const s=o.path,i=typeof s=="string"?s.trim():"";!i||Yg(i)||r.push({path:i})}return r}async function Jx(e,t){await st("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function Qx(e,t){await st("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function Xx(e){await st("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function lm(e,t,n=20){const r=e.trim();if(!r)return[];const o=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),a=await o.json();if(!o.ok){const c=Kt(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||Yg(f)||l.push({path:f})}return l}async function Zx(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function ek(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.threadId),o=te(t.cwd),a=te(t.shell);return!n||!r||!o||!a?null:{id:n,threadId:r,cwd:o,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:nr(t.truncated)??!1}}async function pl(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(to(r,`Terminal request failed with HTTP ${n.status}`));return r}async function bF(e){var r;const t=await pl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=ek((r=Ye(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function tk(){const e=await pl("/codex-api/thread-terminal/status"),t=Ye(e);return{available:nr(t==null?void 0:t.available)??!1,reason:te(t==null?void 0:t.reason)||null}}async function TF(e){const t=await pl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ye(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(o=>{const a=Ye(o),s=te(a==null?void 0:a.label),i=te(a==null?void 0:a.value),l=te(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function SF(e,t){await pl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function CF(e,t,n){await pl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function xF(e){await pl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}function nk(e,t=[],n=[]){if(e.trim().length>0)return e;const r=t.map(o=>(o.label??"").trim()).find(o=>o.length>0);return r||(n.some(o=>(o??"").trim().length>0)?"[Image]":"[Attachment]")}const Jg=["none","minimal","low","medium","high","xhigh","max","ultra"];function cl(e){return typeof e=="string"&&Jg.some(t=>t===e)}function rk(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Ze(e){return rk(e)}function Qg(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function ok(e){const t=Ze(e);return t.startsWith("/")||Qg(t)}function ak(e){const t=Ze(e).replace(/[\\/]+/gu,"/");return Qg(t)?t.toLowerCase():t}function Nr(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 el(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 Xr(e){return Nr(e)||Ze(e)||"Projectless"}function ac(e){const t=Ze(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function um(e){return new Date(e*1e3).toISOString()}function sk(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 ik(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function lk(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const uk=/^##\s+(.+?):\s+(.+?)\s*$/,ck=/^#\s*files mentioned by the user\s*:?\s*$/i;function dk(e){var o,a;const t=e.split(`
28
- `).findIndex(s=>ck.test(s.trim()));if(t<0)return[];const n=e.split(`
29
- `).slice(t+1),r=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(uk);if(!l)break;const c=(o=l[1])==null?void 0:o.trim(),d=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");c&&d&&r.push({label:c,path:d})}return r}function fk(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const o=r.index+r[0].length;return e.slice(o).trim()}function Xg(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function pk(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 hk(e){const t=e.aggregatedOutputSpill;if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,r=typeof n.ref=="string"?n.ref.trim():"",o=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?Math.trunc(i):0,a=o(n.totalBytes),s=o(n.omittedBytes);if(!(s<=0))return{ref:r,totalBytes:a,omittedBytes:s}}function mk(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function _d(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?mk(n[1].trim()):""}function vk(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=_d(t,"current_time_iso"),r=_d(t,"instructions");return!n||!r?null:{automationId:_d(t,"automation_id"),currentTimeIso:n,instructions:r}}function gk(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[];for(const[c,d]of t.entries()){if(d.type==="text"&&typeof d.text=="string"&&d.text.length>0&&n.push(d.text),d.type==="image"&&typeof d.url=="string"&&d.url.trim().length>0&&r.push(d.url.trim()),d.type==="localImage"&&typeof d.path=="string"&&d.path.trim().length>0&&r.push(Xg(d.path.trim())),d.type==="skill"){const v=typeof d.name=="string"?d.name.trim():"",f=typeof d.path=="string"?d.path.trim():"";v&&f&&o.push({name:v,path:f})}d.type!=="text"&&d.type!=="image"&&d.type!=="localImage"&&d.type!=="skill"&&a.push({id:`${e}:user-content:${c}`,role:"user",text:"",messageType:`userContent.${d.type}`,rawPayload:ik(d),isUnhandled:!0})}const s=n.join(`
30
- `),i=dk(s),l=vk(s);return{text:(l==null?void 0:l.instructions)??fk(s),images:r,skills:o,fileAttachments:i,rawBlocks:a,isAutomationRun:l!==null,automationDisplayName:(l==null?void 0:l.automationId)||null}}function yk(e){var a;const t=e.replace(/\r\n/g,`
31
- `).trim();if(!t)return null;const n=t.split(`
32
- `),r=[],o=[];for(const s of n){const i=s.trim();if(!i){r.length===0&&o.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const c=(l[1]??" ").toLowerCase(),d=(a=l[2])==null?void 0:a.trim();if(!d)continue;let v="pending";c==="x"&&(v="completed"),(c==="~"||c===">"||c==="-")&&(v="inProgress"),r.push({step:d,status:v});continue}o.push(i)}return r.length===0?null:{explanation:o.join(`
33
- `).trim()||void 0,steps:r}}function cm(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
34
- `),n=t.endsWith(`
35
- `)?t.slice(0,-1):t;return n?n.split(`
36
- `).length:0}function wk(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
37
- `).split(`
38
- `))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function Zg(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function df(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,a=typeof o.path=="string"?o.path:"",s=typeof o.diff=="string"?o.diff:"",i=o.kind,l=i==null?void 0:i.type;if(!a||l!=="add"&&l!=="delete"&&l!=="update")continue;const c=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,d=l==="update"?wk(s):l==="add"?{addedLineCount:cm(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:cm(s)};n.push({path:a,operation:l,movedToPath:c,diff:s,...d})}return n}function bk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=gk(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.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,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:[Xg(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?pk(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning"){const t=e,n=Array.isArray(t.summary)?t.summary.filter(i=>typeof i=="string"):[],r=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],o=n.join(`
39
- `).trim(),s=r.join(`
40
- `).trim()||o;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:r}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",r=typeof t.tool=="string"?t.tool:"";if(!n&&!r)return[];const o=t.status;let a="completed";const s=typeof o=="string"?o:o==null?void 0:o.type;(s==="inProgress"||s==="in_progress")&&(a="inProgress"),(s==="failed"||s==="error")&&(a="failed");const i=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",l=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:r,messageType:"toolCall",toolCall:{server:n,tool:r,status:a,error:i,durationMs:l}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:yk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Tk(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:o,status:n,aggregatedOutput:a,exitCode:s,outputSpill:hk(t)}}]}if(e.type==="fileChange"){const t=df(e.changes),n=Zg(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 Tk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Sk(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function Ck(e){const t=Sk(e);return t.length>0?t:"Untitled thread"}function ep(e){return(e==null?void 0:e.status)==="inProgress"}function tp(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n,o=typeof r.origin=="string"&&r.origin.trim().length>0?r.origin.trim():"";return o?{origin:o,active:r.active===!0,lastWriteAt:typeof r.lastWriteAt=="string"?r.lastWriteAt:null}:null}function xk(e){var t;return((t=tp(e))==null?void 0:t.active)===!0}function ey(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const n=t.status;if(n&&typeof n=="object"){const a=n.type;if(a==="active"||a==="inProgress")return!0}const o=(Array.isArray(e.turns)?e.turns:[]).at(-1);return ep(o)||xk(e)}function ty(e){const t=e,n=Ze(typeof t.cwd=="string"?t.cwd:e.cwd),r=ak(n),o=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:Ck(e),projectName:Xr(n),cwd:n,hasWorktree:o,createdAtIso:um(e.createdAt),updatedAtIso:um(e.updatedAt),preview:e.preview,historyMode:t.historyMode==="legacy"?"legacy":"paginated",originator:typeof t.originator=="string"&&t.originator.trim().length>0?t.originator.trim():null,unread:!1,inProgress:ey(e),externalSession:tp(e)}}function kk(e){return ty(e.thread)}function Ik(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((o,a)=>new Date(a.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var s,i;const o=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=r.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-o})}function Ak(e){const t=e.data.map(ty);return Ik(t)}function uu(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let o=0;o<n.length;o++){const a=t+o,s=n[o],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",l=i.length>0?i:void 0,c=Array.isArray(s.items)?s.items:[],d=sk(s==null?void 0:s.startedAt),v=[];for(const y of c)for(const S of bk(y))v.push({...S,turnId:l,turnIndex:a,turnStartedAtIso:d??void 0});const f=lk(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})}r.push(...v)}return Pk(_k(r))}function _k(e){var n;let t=-1;for(let r=e.length-1;r>=0;r-=1)if(((n=e[r])==null?void 0:n.messageType)==="compaction.done"){t=r;break}return t<0?e:e.filter((r,o)=>r.messageType!=="compaction.done"||o===t)}function Pk(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],r=n.turnIndex;let o=-1;for(let c=0;c<e.length;c+=1)if(((i=e[c])==null?void 0:i.turnIndex)===r&&((l=e[c])==null?void 0:l.role)==="user"){o=c;break}if(o<0||t<=o)return e;const a=e.filter((c,d)=>d!==t);return a.splice(o+1,0,n),a}function np(e){if(ey(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return ep(t.at(-1))}function ny(e){return tp(e.thread)}function rp(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(ep(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const Ek=50,Rk=3e4,Ui=new Map,Mk=5e3;function Pd(e){return e&&e.length>0?e:null}function Ed(e){return e&&e.length>0?e:null}function jk(e){return cl(e)?e:""}function Lk(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function op(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let o=0;o<n.length;o+=1){const a=t+o,s=n[o];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=a)}return r}function ap(e){const t=Ye(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function ff(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}function Nk(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}function eu(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function Ac(e){var o,a;const t=Ye(e);if(!t)return"";const n=((o=te(t.modelProvider))==null?void 0:o.trim())??"";if(n)return n;const r=Ye(t.thread);return((a=te(r==null?void 0:r.modelProvider))==null?void 0:a.trim())??""}function dm(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const r=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return r.length>0?r:null}catch{return null}}function Ok(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
41
- `;for(const r of t)n+=`
42
- ## ${r.label}: ${r.path}
43
- `;return`${n}
44
- ## My request for Codex:
45
-
46
- ${e}
47
- `}function $k(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function Dk(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",r=await fetch(n,{signal:AbortSignal.timeout(Mk)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data))return{ids:o.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:o.exclusive===!0}}catch{}return null}function Fk(e){var s;const t=Ye(e);if(!t)return null;const n=((s=te(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return cl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:cl(a)?a:null}}function fm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Bk(e={}){const t=e.includeProviderModels!==!1,n=t?await Dk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(fm);const r=await st("model/list",{}),o=[];for(const a of r.data){const s=Fk(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(fm(a));return o}async function Uk(e={}){return(await Bk(e)).map(t=>t.id)}async function zk(){const e=await st("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=jk(e.config.model_reasoning_effort),o=Lk(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}async function Hk(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Pd(n):Ed(n)};let o=null;try{o=await zk()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?Pd(n??(o==null?void 0:o.reasoningEffort)):Ed(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await Uk()}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"?Pd(n??(o==null?void 0:o.reasoningEffort)):Ed(n??(o==null?void 0:o.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function qk(e,t){const n=await st("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:Ak(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function Wk(e){const t=await st("thread/read",{threadId:e,includeTurns:!1});return kk(t)}async function Gk(e){const t=await st("thread/read",{threadId:e,includeTurns:!0}),n=ap(t),r=uu(t,n);return{model:eu(t),modelProvider:Ac(t),messages:r,inProgress:np(t),activeTurnId:rp(t),hasMoreOlder:n>0,turnIndexByTurnId:op(t,n),externalSession:ny(t)}}async function Vk(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),o=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!o.ok)throw new Error(`Older thread page request failed with ${o.status}`);const a=await o.json();if(a.olderTurnsUnavailable===!0)throw new Or("当前 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:uu(a.result,s),inProgress:np(a.result),activeTurnId:rp(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:op(a.result,s)}}async function pm(e=null,t=Ek){try{return await qk(e,t)}catch(n){throw eo(n,"Failed to load thread groups","thread/list")}}async function Kk(e){try{return await Wk(e)}catch(t){throw eo(t,`Failed to load thread ${e}`,"thread/read")}}async function pf(e){try{return await Gk(e)}catch(t){throw eo(t,`Failed to load thread ${e}`,"thread/read")}}async function Yk(e,t,n){try{return await Vk(e,t,n)}catch(r){throw eo(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function kF(e){const t=new URLSearchParams({ref:e}),n=await fetch(`/codex-api/command-output?${t.toString()}`);if(!n.ok)throw new Error(`Command output request failed with ${n.status}`);const r=await n.json();return typeof r.text=="string"?r.text:""}async function hf(e){const t=Ui.get(e);if(t)return t;const n=(async()=>{const o=await st("thread/resume",{threadId:e}),a=ap(o),s=uu(o,a);return{model:eu(o),modelProvider:Ac(o),messages:s,inProgress:np(o),activeTurnId:rp(o),hasMoreOlder:a>0,turnIndexByTurnId:op(o,a),externalSession:ny(o)}})();Ui.set(e,n);const r=globalThis.setTimeout(()=>{Ui.get(e)===n&&Ui.delete(e)},Rk);return n.finally(()=>{globalThis.clearTimeout(r),globalThis.setTimeout(()=>{Ui.get(e)===n&&Ui.delete(e)},2e3)}).catch(()=>{}),n}async function Jk(e){await st("thread/archive",{threadId:e})}async function Qk(e){await st("thread/unarchive",{threadId:e})}async function Xk(e){await st("thread/compact/start",{threadId:e})}async function Zk(e,t){await st("thread/name/set",{threadId:e,name:t})}async function Rd(e,t){const n=await st("thread/revert",{threadId:e,beforeTurnId:t});if(!n.turnsBackwardsCursor)return[];const r=await st("thread/turns/list",{threadId:e,cursor:n.turnsBackwardsCursor,sortDirection:"desc",limit:200,itemsView:"full"});return uu({thread:{...n.thread,turns:[...r.data].reverse()}},0)}async function hm(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await st("thread/start",n),o=ff(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:eu(r),modelProvider:Ac(r)}}catch(n){throw eo(n,"Failed to start a new thread","thread/start")}}async function mm(e,t,n){if(arguments.length<=1)try{const r=await st("thread/fork",{threadId:e,persistExtendedHistory:!0}),o=ff(r);if(!o)throw new Error("thread/fork did not return a thread id");return{threadId:o,cwd:Nk(r),model:eu(r),messages:uu(r,ap(r))}}catch(r){throw eo(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const o={threadId:r};typeof t=="string"&&t.trim().length>0&&(o.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(o.model=n.trim());const a=await st("thread/fork",o),s=ff(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:eu(a),modelProvider:Ac(a)}}catch(r){throw eo(r,`Failed to fork thread ${e}`,"thread/fork")}}function ry(e,t,n,r=[]){const o=[];for(const c of t){const d=dm(c.trim());d&&o.push({label:$k(d),path:d,fsPath:d})}const a=[...r,...o],s=a.filter((c,d)=>a.findIndex(v=>v.fsPath===c.fsPath)===d),l=[{type:"text",text:Ok(nk(e,s,t),s)}];for(const c of t){const d=c.trim();if(!d)continue;const v=dm(d);if(v){l.push({type:"localImage",path:v});continue}l.push({type:"image",url:d,image_url:d})}if(n)for(const c of n)l.push({type:"skill",name:c.name,path:c.path});return{input:l,dedupedFileAttachments:s}}async function Md(e,t,n=[],r,o,a,s=[],i){var l;try{const c=(r==null?void 0:r.trim())??"",{input:d,dedupedFileAttachments:v}=ry(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 o=="string"&&o.length>0&&(y.effort=o),i){const I=await Hk(i,c,o);y.collaborationMode={mode:i,settings:{model:I.model,reasoning_effort:I.reasoningEffort,developer_instructions:null}}}const S=await st("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 eo(c,`Failed to start turn for thread ${e}`,"turn/start")}}async function eI(e,t,n,r=[],o,a=[]){const s=e.trim(),i=t.trim();try{const{input:l}=ry(n,r,o,a),c=await st("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 eo(l,`Failed to steer turn for thread ${s}`,"turn/steer")}}async function tI(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await st("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw eo(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const nI=5e3,rI=3e4,vm=new Map,jd=new Map,gm=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function oI(e){return cl(e)?e:""}function aI(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function sI(e){const t=e==="fast"?"fast":"standard";await st("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function ym(){return await(await fetch("/codex-api/free-mode/status")).json()}async function wm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function bm(e){return await(await fetch("/codex-api/free-mode/custom-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})})).json()}async function 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 iI(e){const t=(e==null?void 0:e.trim())??"",n=t,r=vm.get(n);if(r&&Date.now()-r.fetchedAt<rI)return r.result;const o=jd.get(n);if(o)return o;const a=(async()=>{let s=null;try{const i=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",l=await fetch(i,{signal:AbortSignal.timeout(nI)});let c=null;try{c=await l.json()}catch{c=null}l.ok&&Array.isArray(c==null?void 0:c.data)&&(s={ids:c.data.map(d=>typeof d=="string"?d.trim():"").filter((d,v,f)=>d.length>0&&f.indexOf(d)===v),exclusive:c.exclusive===!0})}catch{}return vm.set(n,{fetchedAt:Date.now(),result:s}),s})();jd.set(n,a);try{return await a}finally{jd.delete(n)}}function lI(e){var s;const t=Ye(e);if(!t)return null;const n=((s=te(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return cl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:cl(a)?a:null}}function Tm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function uI(e={}){const t=e.includeProviderModels!==!1,n=t?await iI(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(Tm);const r=await st("model/list",{}),o=[];for(const a of r.data){const s=lI(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(Tm(a));return o}async function cI(){const e=await st("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=oI(e.config.model_reasoning_effort),o=aI(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function dI(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function fI(){try{const e=await st("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"&&o!=="execplans"||t.has(o)||(t.add(o),n.push({value:o,label:dI(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of gm)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return gm}async function pI(){return Dx()}function hI(e){const t=Ye(e);if(!t)return null;const n=te(t.event??t.name??t.hookName),r=te(t.command??t.cmd);return!n||!r?null:{event:n,command:r,timeout:Ht(t.timeout??t.timeout_ms),enabled:nr(t.enabled??t.active)}}async function mI(){const e=await st("hooks/list",{}),t=[];for(const n of e.data??[]){const r=Ye(n);r&&t.push({cwd:te(r.cwd)??"",hooks:Array.isArray(r.hooks)?r.hooks.map(hI).filter(o=>o!==null):[],warnings:Po(r.warnings),errors:Po(r.errors)})}return t}async function IF(e){await st("marketplace/add",{source:e})}async function AF(e){await st("marketplace/remove",{marketplaceName:e})}async function _F(){const e=await st("marketplace/upgrade",{});return{selectedMarketplaces:Po(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:Po(e.upgradedRoots??e.upgraded_roots),errors:Po(e.errors)}}function vI(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 PF(e){const t=await st("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 EF(){const e=await st("plugin/share/list",{});return(e.data??e.shares??[]).map(vI).filter(n=>n!==null)}async function RF(e){await st("plugin/share/delete",{remotePluginId:e})}async function MF(e){await st("plugin/share/checkout",{remotePluginId:e})}function oy(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.name);return!n||!r?null:{id:n,name:r,description:te(t.description)??"",installUrl:te(t.installUrl??t.install_url)??"",needsAuth:nr(t.needsAuth??t.needs_auth)??!1}}function gI(e){const t=Ye(e);if(!t)return null;const n=te(t.name),r=te(t.path);if(!n||!r)return null;const o=Ye(t.interface);return{name:n,path:r,description:te(t.description)??"",enabled:nr(t.enabled)??!0,displayName:te((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??n,shortDescription:te(t.shortDescription??t.short_description)??""}}function ay(e,t={}){const n=Ye(e);if(!n)return null;const r=te(n.id),o=te(n.name);if(!r||!o)return null;const a=Ye(n.interface),s=Ye(n.source),i=te(s==null?void 0:s.type)??"",l=te(s==null?void 0:s.path),c=te(s==null?void 0:s.url)??"",d=i==="remote"?t.name??null:null,v=t.path??(i==="local"?l:null),f=te((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,y=te((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),S=te((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,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:nr(n.installed)??!1,enabled:nr(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:Po(a==null?void 0:a.capabilities),defaultPrompt:Po((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:Po((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:Po(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 yI(e,t=0){const n=Ye(e);if(!n)return null;const r=te(n.id),o=te(n.name);if(!r||!o)return null;const a=Ye(n.branding),s=Ye(n.appMetadata??n.app_metadata);return{id:r,name:o,description:te(n.description)??te((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:te(n.logoUrl??n.logo_url)??"",logoUrlDark:te(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:te(n.distributionChannel??n.distribution_channel)??"",installUrl:te(n.installUrl??n.install_url)??"",isAccessible:nr(n.isAccessible??n.is_accessible)??!1,isEnabled:nr(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Po(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 wI(e){const t=Ye(e);if(!t)return null;const n=te(t.name);if(!n)return null;const r=Ye(t.tools)??{},o=Object.entries(r).map(([l,c])=>{const d=Ye(c);return{name:te(d==null?void 0:d.name)??l,title:te(d==null?void 0:d.title)??"",description:te(d==null?void 0:d.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(l=>{const c=Ye(l);return{name:te(c==null?void 0:c.name)??"",title:te(c==null?void 0:c.title)??"",uri:te(c==null?void 0:c.uri)??"",description:te(c==null?void 0:c.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const c=Ye(l);return{name:te(c==null?void 0:c.name)??"",title:te(c==null?void 0:c.title)??"",uriTemplate:te((c==null?void 0:c.uriTemplate)??(c==null?void 0:c.uri_template))??"",description:te(c==null?void 0:c.description)??""}}).filter(l=>l.name||l.uriTemplate):[];return{name:n,authStatus:te(t.authStatus??t.auth_status)??"unsupported",tools:o,resources:a,resourceTemplates:i}}async function jF(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await st("plugin/list",t),r=[];for(const o of n.marketplaces??[]){const a=Ye(o);if(!a)continue;const s=Ye(a.interface),i={name:te(a.name)??"",displayName:te((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:te(a.path)},l=Array.isArray(a.plugins)?a.plugins:[];for(const c of l){const d=ay(c,i);d&&r.push(d)}}return r}async function LF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await st("plugin/read",t),r=Ye(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const o=ay(r.summary,{name:te(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:te(r.marketplacePath)??e.marketplacePath})??e;return{summary:o,description:te(r.description)??o.longDescription,apps:Array.isArray(r.apps)?r.apps.map(oy).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(gI).filter(a=>a!==null):[],mcpServers:Po(r.mcpServers??r.mcp_servers)}}async function NF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await st("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:te(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(oy).filter(o=>o!==null)}}async function OF(e){await st("plugin/uninstall",{pluginId:e})}async function $F(e,t){await st("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function DF(e){const t=[];let n=null,r=0;do{const o={limit:100};n&&(o.cursor=n),e&&(o.threadId=e);const a=await st("app/list",o);for(const s of a.data??[]){const i=yI(s,r);i&&t.push(i),r+=1}n=te(a.nextCursor??a.next_cursor)}while(n);return t}async function FF(e,t){await st("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function BF(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await st("mcpServerStatus/list",n);for(const o of r.data??[]){const a=wI(o);a&&e.push(a)}t=te(r.nextCursor??r.next_cursor)}while(t);return e}async function UF(){await st("config/mcpServer/reload",{})}async function zF(e){const t=await st("mcpServer/oauth/login",{name:e});return{authorizationUrl:te(t.authorizationUrl??t.authorization_url)??""}}async function HF(){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 qF(e="",t=null,n=50){const r=new URLSearchParams;e.trim()&&r.set("query",e.trim()),t&&r.set("cursor",t),n&&Number.isFinite(n)&&r.set("limit",String(Math.max(1,Math.floor(n))));const o=r.toString(),a=await fetch(`/codex-api/composio/connectors${o?`?${o}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function WF(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 GF(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 VF(){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 KF(){const e=await fetch("/codex-api/composio/install",{method:"POST"});if(!e.ok)throw new Error(`Failed to install Composio CLI (${e.status})`);return await e.json()}function Sm(e){const t=Ye(e);if(!t)return null;const n=Ht(t.usedPercent??t.used_percent);if(n===null)return null;const r=Ht(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Ht(t.resetsAt??t.resets_at)}}function bI(e){const t=Ye(e);if(!t)return null;const n=nr(t.hasCredits??t.has_credits),r=nr(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:te(t.balance)}}function Cm(e){const t=Ye(e);if(!t)return null;const n=Sm(t.primary),r=Sm(t.secondary),o=bI(t.credits);return!n&&!r&&!o?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:te(t.planType??t.plan_type)}}function sy(e){const t=Ye(e);if(!t)return null;const n=Ye(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Cm(n==null?void 0:n.codex);return r||Cm(t.rateLimits??t.rate_limits)}const TI=100;function SI(){return TI}function CI(e){return Bx(e)}async function xI(e,t){await Ux({id:e,...t})}async function xm(){return zx()}function kI(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const r=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],o=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.name=="string"?i.name.trim():"",c=typeof i.path=="string"?i.path.trim():"";return l&&c?[{name:l,path:c}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.label=="string"?i.label.trim():"",c=typeof i.path=="string"?i.path.trim():"",d=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&c&&d?[{label:l,path:c,fsPath:d}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:o,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function iy(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();if(!o||!Array.isArray(r))continue;const a=r.flatMap(s=>{const i=kI(s);return i?[i]:[]});a.length>0&&(t[o]=a)}return t}async function km(){const e=await fetch("/codex-api/thread-queue-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load thread queue state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return iy(n.data)}async function II(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(iy(e))})).ok)throw new Error("Failed to save thread queue state")}async function AI(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),r=await n.json();if(!n.ok){const o=Kt(r,"Failed to connect Telegram bot");throw new Error(o)}}async function _I(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Kt(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],a=[];for(const s of o){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:a}}async function PI(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=Kt(t,"Failed to load Telegram status");throw new Error(o)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}async function EI(){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 sc(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 RI(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function MI(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 jI(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function LI(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 NI(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function OI(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function $I(){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 DI(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 FI(e,t){var n;try{return((n=(await st("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function mf(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function BI(e,t){const n=mf(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const o=r.lastIndexOf("skills");if(o>=2){const l=r[o-2]??"";if(l){const c=`/${[...r.slice(0,o+1),l,"SKILL.md"].join("/")}`;if(t.has(c))return{rootPath:c,rootName:l,isNested:c!==n}}}const a=r.indexOf("skills");if(a<0||a+1>=r.length-1)return null;const s=r[a+1]??"";if(!s)return null;const i=`/${[...r.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(i)?{rootPath:i,rootName:s,isNested:i!==n}:{rootPath:i,rootName:s,isNested:i!==n}}async function UI(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await st("skills/list",t),r=n.data.flatMap(s=>s.skills),o=new Set(r.map(s=>mf(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=BI(i.path,o),c=mf(i.path),v=!!(l!=null&&l.isNested&&o.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 zI=6e4;async function Eu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),zI);try{const r=new FormData;r.append("file",e);const o=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return o.ok?(await o.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function HI(e){return e==="payment_required"?e:null}function qI(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Im(e){const t=Ye(e);if(!t)return null;const n=Ht(t.usedPercent??t.used_percent);if(n===null)return null;const r=Ht(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Ht(t.resetsAt??t.resets_at)}}function WI(e){const t=Ye(e);if(!t)return null;const n=nr(t.hasCredits??t.has_credits),r=nr(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:te(t.balance)}}function GI(e){const t=Ye(e);if(!t)return null;const n=Im(t.primary),r=Im(t.secondary),o=WI(t.credits);return!n&&!r&&!o?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:te(t.planType??t.plan_type)}}function ly(e,t=null,n=null){const r=Ye(e);if(!r)return null;const o=te(r.accountId),a=te(r.storageId)??o,s=te(r.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return o?{accountId:o,storageId:a??o,userId:te(r.userId),authMode:te(r.authMode),email:te(r.email),planType:te(r.planType),lastRefreshedAtIso:te(r.lastRefreshedAtIso)??"",lastActivatedAtIso:te(r.lastActivatedAtIso),quotaSnapshot:GI(r.quotaSnapshot),quotaUpdatedAtIso:te(r.quotaUpdatedAtIso),quotaStatus:i,quotaError:te(r.quotaError),unavailableReason:HI(r.unavailableReason)??(qI(te(r.quotaError))?"payment_required":null),isActive:nr(r.isActive)??(a===n||o===t)}:null}function uy(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 VI(){const e=await st("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:nr(e.enabled)??!1,clients:t.map(uy).filter(n=>n!==null)}}async function KI(){var r;const e=await fetch("/codex-api/approval-policy"),t=await e.json();if(!e.ok)throw new Error(t.error||"Failed to read approval policy");const n=te((r=t.data)==null?void 0:r.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function YI(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 JI(e){await st(e?"remoteControl/enable":"remoteControl/disable",{})}async function QI(){const e=await st("remoteControl/pairing/start",{});return{pairingCode:te(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:te(e.expiresAt??e.expires_at)}}async function XI(){const e=await st("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(uy).filter(n=>n!==null)}async function ZI(e){await st("remoteControl/client/revoke",{clientId:e})}async function eA(){try{const e=await st("account/rateLimits/read");return sy(e)}catch(e){throw eo(e,"Failed to load account rate limits","account/rateLimits/read")}}function _c(e){const t=Ye(e),n=te(t==null?void 0:t.activeAccountId),r=te(t==null?void 0:t.activeStorageId),o=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:r,importedAccountId:te(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:te(t==null?void 0:t.importedStorageId)??void 0,accounts:o.map(a=>ly(a,n,r)).filter(a=>a!==null)}}async function tA(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Kt(t,"Failed to load accounts"));const n=Ye(t);return _c(n==null?void 0:n.data)}async function Am(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Kt(t,"Failed to refresh accounts"));const n=Ye(t);return _c(n==null?void 0:n.data)}async function nA(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Kt(t,"Failed to start Codex login"));const n=Ye(t),r=Ye(n==null?void 0:n.data),o=te(r==null?void 0:r.loginUrl);if(!o)throw new Error("Failed to start Codex login");return o}async function 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(Kt(n,"Failed to complete Codex login"));const r=Ye(n);return _c(r==null?void 0:r.data)}async function oA(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(Kt(n,"Failed to switch account"));const r=Ye(n),o=Ye(r==null?void 0:r.data),a=ly(o==null?void 0:o.account,te(o==null?void 0:o.activeAccountId),te(o==null?void 0:o.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function aA(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(Kt(n,"Failed to remove account"));const r=Ye(n);return _c(r==null?void 0:r.data)}let Ru=null,ql=null;function sA(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const i of a)typeof i=="string"&&i.length>0&&!s.includes(i)&&s.push(i);return s},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const i=typeof a=="string"?Ze(a):"";i.length>0&&typeof s=="string"&&(o[i]=s)}return{order:n(t.order).map(a=>Ze(a)),labels:o,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?vf(ql):(Ru||(Ru=iA().then(e=>(ql=e,e)).finally(()=>{Ru=null})),vf(await Ru))}async function iA(){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 sA(n.data)}function vf(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 sp(){ql=null}async function lA(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:Ze(o.data.cwd),gitRoot:Ze(o.data.gitRoot)}}async function uA(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:Ze(r.data.cwd),gitRoot:Ze(r.data.gitRoot)}}async function cA(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load branches");const a=Array.isArray(o.data)?o.data:[],s=[],i=new Set;for(const l of a){if(!l||typeof l!="object"||Array.isArray(l))continue;const c=l,d=typeof c.value=="string"?c.value.trim():"",v=typeof c.label=="string"?c.label.trim():"";!d||i.has(d)||(i.add(d),s.push({value:d,label:v||d}))}return s}async function dA(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[],changedFiles:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load Git branch state");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,l=Array.isArray(a.options)?a.options:[],c=[],d=new Set;for(const U of l){if(!U||typeof U!="object"||Array.isArray(U))continue;const O=U,D=typeof O.value=="string"?O.value.trim():"",q=typeof O.label=="string"?O.label.trim():"";!D||d.has(D)||(d.add(D),c.push({value:D,label:q||D,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=cy(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 cy(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){if(!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.path,s=typeof a=="string"?Ze(a.trim()):"";if(!s)continue;const i=o.status,l=typeof i=="string"?i.trim():"",c=o.label,d=typeof c=="string"&&c.trim()?c.trim():l;n.push({path:s,previousPath:typeof o.previousPath=="string"&&o.previousPath.trim()?Ze(o.previousPath.trim()):null,status:l,label:d,addedLineCount:typeof o.addedLineCount=="number"?o.addedLineCount:null,removedLineCount:typeof o.removedLineCount=="number"?o.removedLineCount:null})}return n}async function fA(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?Ze(a.gitRoot):""}}async function pA(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to switch branch");const o=(a=r.data)==null?void 0:a.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function hA(e,t,n={}){const r=e.trim(),o=t.trim();if(!r||!o)return[];const a=new URLSearchParams({cwd:r,branch:o,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),s=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(i.error||"Failed to load branch commits");return(Array.isArray(i.data)?i.data:[]).flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const d=c,v=typeof d.sha=="string"?d.sha.trim():"",f=typeof d.shortSha=="string"?d.shortSha.trim():"",y=typeof d.subject=="string"?d.subject.trim():"",S=typeof d.date=="string"?d.date.trim():"";return!v||!f?[]:[{sha:v,shortSha:f,subject:y||f,date:S}]})}async function mA(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const o=new URLSearchParams({cwd:n,sha:r}),a=await fetch(`/codex-api/git/commit-files?${o.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load commit files");return(Array.isArray(s.data)?s.data:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const c=l,d=typeof c.path=="string"?c.path:"",v=typeof c.previousPath=="string"&&c.previousPath.length>0?c.previousPath:null,f=typeof c.status=="string"?c.status.trim():"",y=typeof c.label=="string"?c.label.trim():"",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 vA(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?Ze(a.gitRoot):"",options:[],changedFiles:cy(a.changedFiles)}}async function Ld(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=vf(e)}async function Mu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const i=Kt(r,"Failed to open project root");throw new Error(i)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?Ze(a.path):"";return sp(),s}function gA(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function yA(e,t){var a;const n=e.headers.get("content-disposition")??"",r=n.match(/filename\*=UTF-8''([^;]+)/iu);if(r!=null&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}const o=n.match(/filename="?([^";]+)"?/iu);return((a=o==null?void 0:o[1])==null?void 0:a.trim())||t}async function wA(e,t){var d;const n=await fetch(gA(e));if(!n.ok){const v=await n.json().catch(()=>null),f="Failed to export project",y=Kt(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 r=Number(n.headers.get("content-length")??""),o=Number.isFinite(r)&&r>0?r:null,a=yA(n,"project.zip"),s=(d=n.body)==null?void 0:d.getReader();if(!s){const v=await n.blob();return t==null||t({loaded:v.size,total:v.size||o}),{blob:v,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:o});;){const{done:v,value:f}=await s.read();if(v)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:o}))}const c=i.map(v=>{const f=new Uint8Array(v.byteLength);return f.set(v),f.buffer});return{blob:new Blob(c,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function bA(e,t){const n=new URLSearchParams({parent:t}),r=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),o=await Ai(r);if(!r.ok){const l=Kt(o,"Failed to import project");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?Ze(s.path):"";return i&&sp(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function _m(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function TA(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const r=await fetch(`/codex-local-directories?${n.toString()}`),o=await Ai(r);if(!r.ok){const l=Kt(o,"Failed to load local directories");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?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 YF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),r=await Ai(n);if(!n.ok){const i=Kt(r,"Failed to load workspace files");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const l=i,c=typeof l.path=="string"?Ze(l.path):"",d=typeof l.relativePath=="string"?l.relativePath.trim():"";return!c||!d?[]:[{path:c,relativePath:d,isDirectory:l.isDirectory===!0}]})}async function JF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),r=await Ai(n);if(!n.ok){const i=Kt(r,"Failed to preview file");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data,s=a&&typeof a=="object"&&!Array.isArray(a)?a:{};return{path:typeof s.path=="string"?s.path:e,name:typeof s.name=="string"?s.name:"",size:typeof s.size=="number"?s.size:0,isText:s.isText===!0,isImage:s.isImage===!0,content:typeof s.content=="string"?s.content:void 0,truncated:s.truncated===!0}}async function SA(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Ai(t);if(!t.ok){const s=Kt(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.path=="string"?Ze(o.path):"";return a&&sp(),a}async function CA(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),r=await Ai(n);if(!n.ok){const s=Kt(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?Ze(a.path):""}async function xA(e){const t=await fetch("/codex-api/projectless-thread-cwd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e??null})}),n=await Ai(t);if(!t.ok){const s=Kt(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.cwd=="string"?Ze(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?Ze(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?Ze(o.workspaceRoot):""}}async function kA(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const s=Kt(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?Ze(a.path):""}}function IA(e){const t=Ye(e);if(!t)return null;const n=te(t.key),r=typeof t.text=="string"?t.text:"",o=te(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:Ht(t.oldLine),newLine:Ht(t.newLine)}}function AA(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=typeof t.header=="string"?t.header:"",o=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:o,addedLineCount:Ht(t.addedLineCount)??0,removedLineCount:Ht(t.removedLineCount)??0,oldStart:Ht(t.oldStart),oldLineCount:Ht(t.oldLineCount)??0,newStart:Ht(t.newStart),newLineCount:Ht(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>IA(a)).filter(a=>a!==null):[]}:null}function _A(e){const t=Ye(e);if(!t)return null;const n=te(t.id),r=te(t.path),o=te(t.absolutePath),a=te(t.operation);return!n||!r||!o||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:te(t.previousPath),previousAbsolutePath:te(t.previousAbsolutePath),operation:a,addedLineCount:Ht(t.addedLineCount)??0,removedLineCount:Ht(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>AA(s)).filter(s=>s!==null):[]}}function dy(e){const t=Ye(e),n=Ye(t==null?void 0:t.data),r=Ye(n==null?void 0:n.summary),o=te(n==null?void 0:n.scope),a=o==="baseBranch"||o==="commit"?o:"workspace",s=te(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:te(n==null?void 0:n.cwd)??"",gitRoot:te(n==null?void 0:n.gitRoot),isGitRepo:nr(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:Ht(r==null?void 0:r.fileCount)??0,addedLineCount:Ht(r==null?void 0:r.addedLineCount)??0,removedLineCount:Ht(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>_A(i)).filter(i=>i!==null):[]}}function PA(e){const t=Ye(e),n=Ye(t==null?void 0:t.data);return{fileCount:Ht(n==null?void 0:n.fileCount)??0,addedLineCount:Ht(n==null?void 0:n.addedLineCount)??0,removedLineCount:Ht(n==null?void 0:n.removedLineCount)??0}}async function QF(e,t,n,r,o){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim()),o&&o.trim()&&a.set("commitSha",o.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(Kt(i,"Failed to load review snapshot"));return dy(i)}async function EA(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),r=await fetch(`/codex-api/review/summary?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(Kt(o,"Failed to load review summary"));return PA(o)}async function XF(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(Kt(n,"Failed to apply review action"));return dy(n)}async function ZF(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(Kt(n,"Failed to initialize Git"))}async function RA(e,t,n,r,o,a,s){try{const i=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n,action:r,patchIds:o,scope:a,filePaths:s})}),l=await i.json().catch(()=>({}));if(!i.ok){const c=typeof l.message=="string"&&l.message.trim()?l.message.trim():typeof l.error=="string"&&l.error.trim()?l.error.trim():"Server error";return{changed:0,errors:Array.isArray(l.errors)&&l.errors.length>0?l.errors:[c],message:l.message}}return{changed:l.changed??l.reverted??l.applied??0,errors:Array.isArray(l.errors)?l.errors:[],message:l.message,revertedPatchIds:Array.isArray(l.revertedPatchIds)?l.revertedPatchIds:[],appliedPatchIds:Array.isArray(l.appliedPatchIds)?l.appliedPatchIds:[]}}catch(i){return{changed:0,errors:[i instanceof Error?i.message:"Network error"]}}}async function MA(e,t,n){const r=await RA(e,t,n,"undo");return{reverted:r.changed,errors:r.errors}}const jA={},LA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function NA(e,t){return P(),B("svg",LA,[...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 Ms=Ct(jA,[["render",NA]]),OA={},$A={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function DA(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:"m9 6l6 6l-6 6"},null,-1)])])}const ju=Ct(OA,[["render",DA]]),FA={},BA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function UA(e,t){return P(),B("svg",BA,[...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 gf=Ct(FA,[["render",UA]]),zA={},HA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function qA(e,t){return P(),B("svg",HA,[...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 dl=Ct(zA,[["render",qA]]),WA={},GA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function VA(e,t){return P(),B("svg",GA,[...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 ip=Ct(WA,[["render",VA]]),KA={},YA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function JA(e,t){return P(),B("svg",YA,[...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 QA=Ct(KA,[["render",JA]]),XA={},ZA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function e_(e,t){return P(),B("svg",ZA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const Pc=Ct(XA,[["render",e_]]),fy="codex-web-local.ui-language.v1",t_={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":"没有匹配的线程","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads":"没有线程","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.":"此线程还没有消息。",now:"刚刚","Open this chat before copying":"请先打开此聊天再复制","Pin thread":"固定线程","Unpin thread":"取消固定线程",paused:"个已暂停","Permissions approval required":"需要权限审批",Project:"项目","Project automation requires a resolved absolute project path.":"项目自动化需要已解析的绝对项目路径。",Redo:"重做","Redo file changes?":"重做文件变更?","Redo the file changes from this turn? This reapplies the edits to the working tree.":"重做本轮的文件变更?这会重新将修改应用到工作树。",Redoing:"正在重做","Refreshing...":"刷新中...","Rejected from codex-web-local UI.":"已在 codex-web-local 界面中拒绝。","Rename project":"重命名项目",Reset:"重置","Reset-history refs":"重置历史引用",remote:"远程","Review Worktree Changes":"审查工作树更改","Review Worktree Changes (Open)":"审查工作树更改(打开)",Running:"运行中","Search commits...":"搜索提交...","Search skills":"搜索技能","Select a branch.":"请选择一个分支。","Select a chat target for this automation":"为此自动化选择一个聊天目标","Select a project target for this automation":"为此自动化选择一个项目目标",Stopped:"已停止","Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。","Output trimmed: {omitted} omitted of {total}.":"输出已截断:省略 {omitted}(共 {total})。","Show full output":"查看完整输出","Loading full output…":"正在加载完整输出…","Could not load the full output.":"无法加载完整输出。",Target:"目标","This creates a heartbeat automation attached to the selected chat.":"这会在所选聊天上创建一个心跳自动化。","This creates a project automation attached to the selected project folder.":"这会在所选项目文件夹上创建一个项目自动化。","This creates heartbeat automations attached to the selected thread.":"这会在所选线程上创建心跳自动化。","This creates project automations attached to the selected project folder.":"这会在所选项目文件夹上创建项目自动化。","This rolls the thread back to this turn so you can edit the message. Later replies will be removed.":"将线程回退到本轮,以便你编辑消息。之后的回复将被移除。","Tool call rejected from codex-web-local UI.":"工具调用已在 codex-web-local 界面中拒绝。","Tool call waiting for response":"工具调用等待响应","Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"切换或重置前,必须提交、暂存或丢弃已跟踪的更改。除非 Git 会覆盖,否则允许存在未跟踪的文件。",Undo:"撤销","Undo file changes?":"撤销文件变更?","Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically.":"撤销本轮的文件变更?这会修改工作树,Codex 无法自动还原。","Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.":"撤销对 {file} 的变更?这会修改工作树,Codex 无法自动还原。","Redo the changes to {file}? This reapplies the edits to the working tree.":"重做对 {file} 的变更?这会重新应用对工作树的编辑。",Undoing:"正在撤销","Uninstall failed":"卸载失败","Use a thread or project menu to add an automation.":"请通过线程或项目菜单添加自动化。"},Pm={en:"English","zh-CN":"简体中文"};function n_(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(fy))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Ec=T(n_());function py(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}py(Ec.value);function r_(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function o_(e){Ec.value=e,py(e),typeof window<"u"&&window.localStorage.setItem(fy,e)}function hy(e,t){const n=Ec.value==="zh-CN"?t_[e]??e:e;return r_(n,t)}function wa(){return{uiLanguage:Ec,uiLanguageOptions:[{value:"en",label:Pm.en},{value:"zh-CN",label:Pm["zh-CN"]}],t:hy,setUiLanguage:o_}}const my="brutalstrikedevs@gmail.com",a_=20,s_=6500,Em=1800,Nd=12,Rm=240,Mm=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,tl=T([]);let jm=!1,Od=!1,$d=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 i_(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function l_(e,t){var r;const n=(r=t==null?void 0:t.method)==null?void 0:r.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function vy(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Lm(e){return encodeURIComponent(e)}function u_(){return`mailto:${my}`}function c_(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
48
- `).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
49
-
50
- `).trim())??"";return e?e.length>Em?`${e.slice(0,Em)}
51
- ...[truncated]`:e:"No visible page text captured."}function d_(e,t){const n=t.replace(/\r\n/g,`
52
- `).replace(/[ \t]+/g," ").trim();return n?Mm.test(e)||Mm.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Rm?`${n.slice(0,Rm)}...[truncated, ${n.length} chars total]`:n:""}function Nm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],r=Math.min(e.length,Nd);for(let a=0;a<r;a+=1){const s=e.key(a);s&&n.push(`${s}=${d_(s,e.getItem(s)??"")}`)}const o=e.length>Nd?`
53
- ...${e.length-Nd} more item(s)`:"";return`${t}:
54
- ${n.join(`
55
- `)||"empty"}${o}`}catch(n){return`${t}: unavailable (${vy($l(n))})`}}function f_(){return typeof window>"u"?"unknown":[`Path: ${window.location.pathname||"/"}`,`Hash: ${window.location.hash||"(none)"}`,`Search: ${window.location.search||"(none)"}`,`Online: ${typeof navigator>"u"?"unknown":String(navigator.onLine)}`,`Language: ${typeof navigator>"u"?"unknown":navigator.language}`,`Platform: ${typeof navigator>"u"?"unknown":navigator.platform}`,Nm(window.localStorage,"localStorage"),Nm(window.sessionStorage,"sessionStorage")].join(`
56
- `)}function mi(e){const t=e.message.trim();if(!t)return;const n=tl.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const r={...e,message:t,atIso:e.atIso??new Date().toISOString()};tl.value=[r,...tl.value].slice(0,a_)}function gy(e=tl.value){var c;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,r=typeof navigator>"u"?"unknown":navigator.userAgent,o="0.1.127",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(`
57
- `),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${r}`,`Viewport: ${t}`,`App version: ${o}`,`Worktree: ${a}`,"","Browser/app state",f_(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",c_()].join(`
58
- `).slice(0,s_),l=`Codex Web feedback: ${vy((c=e[0])==null?void 0:c.message)}`;return`mailto:${my}?subject=${Lm(l)}&body=${Lm(i)}`}function p_(){typeof window>"u"||(window.location.href=gy())}function h_(){if(!(typeof window>"u")&&(jm||(jm=!0,window.addEventListener("error",e=>{mi({kind:"window-error",message:e.error?$l(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{mi({kind:"unhandled-rejection",message:$l(e.reason),url:window.location.href})})),!Od)){if(typeof window.fetch!="function"){mi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{$d=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=i_(e),r=l_(e,t);try{const o=await $d(e,t);return o.ok||mi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${o.status}`,url:n,method:r,status:o.status,statusText:o.statusText}),o}catch(o){throw mi({kind:"fetch-error",message:$l(o),url:n,method:r}),o}},Od=!0}catch(e){$d=null,Od=!1;try{mi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${$l(e)}`,url:window.location.href})}catch{}}}}function yy(){const e=Y(()=>tl.value.length>0);function t(n,r){mi({kind:"visible-error",message:n,url:r||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:tl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:p_,buildFeedbackMailto:gy,feedbackMailtoBase:u_}}const wy="codex-web-local.recycle-bin.v1";function by(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(wy);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>!!n&&typeof n.id=="string"&&typeof n.title=="string"):[]}catch{return[]}}function Om(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wy,JSON.stringify(e))}catch{}}const Fa=T(by());function m_(){function e(){Fa.value=by()}function t(o){Fa.value=[{...o,archivedAtIso:new Date().toISOString()},...Fa.value.filter(a=>a.id!==o.id)],Om(Fa.value)}function n(o){Fa.value=Fa.value.filter(a=>a.id!==o),Om(Fa.value)}async function r(o){if(!Fa.value.some(a=>a.id===o))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await Qk(o),n(o),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Fa,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:r}}function $m(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function v_(e){let t=!1;const n=e.map(r=>{const o=[],a=new Map;for(const s of r.threads){const i=a.get(s.id);if(i===void 0){a.set(s.id,o.length),o.push(s);continue}t=!0,$m(s)>$m(o[i])&&(o[i]=s)}return o.length===r.threads.length?r:{...r,threads:o}});return t?n:e}const g_=["title","aria-label","disabled"],y_={key:1,class:"composer-dropdown-value"},w_={key:0,class:"composer-dropdown-search-wrap"},b_=["placeholder","onKeydown"],T_={class:"composer-dropdown-options",role:"listbox"},S_=["onClick"],C_={key:0,class:"composer-dropdown-empty"},x_=bn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},menuAlign:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{},variant:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,o=T(null),a=T(null),s=T(null),i=T(null),l=T(!1),c=T(""),d=T({});let v=!1;const f=Y(()=>{var Ae;const re=n.options.find(De=>De.value===n.modelValue);return re?re.label:((Ae=n.placeholder)==null?void 0:Ae.trim())||""}),y=Y(()=>n.openDirection??"down"),S=Y(()=>n.menuAlign??"start"),I=Y(()=>n.iconOnly===!0),U=Y(()=>n.enableSearch===!0),O=Y(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),D=Y(()=>{var re;return((re=n.searchPlaceholder)==null?void 0:re.trim())||"Quick search projects"}),q=Y(()=>{var re;return((re=n.emptyLabel)==null?void 0:re.trim())||"No results"}),M=Y(()=>{var re;return f.value||((re=n.placeholder)==null?void 0:re.trim())||"Select option"}),pe=Y(()=>{const re=c.value.trim().toLowerCase();return re?n.options.filter(Ae=>Ae.label.toLowerCase().includes(re)||Ae.value.toLowerCase().includes(re)):n.options});function ue(){n.disabled||(l.value=!l.value)}function K(re,Ae,De){return Math.min(De,Math.max(Ae,re))}function ie(){var oe,se,je,qe;if(!l.value)return;const re=o.value;if(!re||typeof window>"u")return;const Ae=re.getBoundingClientRect(),De=window.innerWidth,Ne=window.innerHeight,Le=8,xe=8,Se=Math.max(0,De-Le*2),Ce=((oe=s.value)==null?void 0:oe.offsetWidth)??((se=a.value)==null?void 0:se.offsetWidth)??224,Ee=((je=s.value)==null?void 0:je.offsetHeight)??((qe=a.value)==null?void 0:qe.offsetHeight)??0,Je=Math.min(Ce,Se),Xe=Math.max(Le,De-Je-Le),it=S.value==="end"?Ae.right-Je:Ae.left,ce=K(it,Le,Xe);let N=y.value==="up"?Ae.top-Ee-xe:Ae.bottom+xe;Ee>0&&N+Ee>Ne-Le&&(N=Ne-Ee-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(re){r("update:modelValue",re),l.value=!1,c.value=""}function ee(){if(c.value.length>0){c.value="";return}l.value=!1}function me(re){if(!l.value)return;const Ae=o.value;if(!Ae)return;const De=re.target;De instanceof Node&&(Ae.contains(De)||(l.value=!1,c.value=""))}return ot(l,re=>{if(!re){Pe(),d.value={};return}ye(),Nt(()=>{var Ae;ie(),window.requestAnimationFrame(ie),U.value&&((Ae=i.value)==null||Ae.focus())})}),Ii(()=>{window.addEventListener("pointerdown",me)}),Os(()=>{window.removeEventListener("pointerdown",me),Pe()}),(re,Ae)=>(P(),B("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[w("button",{class:dt(["composer-dropdown-trigger",O.value]),type:"button",title:M.value,"aria-label":M.value,disabled:e.disabled,onClick:ue},[e.selectedPrefixIcon?(P(),et(Hf(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),I.value?ve("",!0):(P(),B("span",y_,F(f.value),1)),Fe(Ms,{class:"composer-dropdown-chevron"})],10,g_),l.value?(P(),B("div",{key:0,ref_key:"menuWrapRef",ref:a,class:dt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":y.value==="up","composer-dropdown-menu-wrap-down":y.value==="down"}]),style:Jr(d.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[U.value?(P(),B("div",w_,[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:D.value,onKeydown:Cr(vt(ee,["prevent"]),["esc"])},null,40,b_),[[Fn,c.value]])])):ve("",!0),w("ul",T_,[(P(!0),B(ct,null,rn(pe.value,De=>(P(),B("li",{key:De.value},[w("button",{class:dt(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:Ne=>ge(De.value)},F(De.label),11,S_)]))),128)),pe.value.length===0?(P(),B("li",C_,F(q.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),Ci=Ct(x_,[["__scopeId","data-v-5c5d724f"]]),k_={},I_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function A_(e,t){return P(),B("svg",I_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const yf=Ct(k_,[["render",A_]]),__=["aria-label","onKeydown"],P_={class:"app-dialog-header"},E_={class:"app-dialog-title-wrap"},R_={class:"app-dialog-title"},M_={key:0,class:"app-dialog-subtitle"},j_=["aria-label","title"],L_={class:"app-dialog-body"},N_={key:0,class:"app-dialog-footer"},O_=bn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=wa();function a(){r("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return ot(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),Os(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(P(),et(al,{to:"body"},[e.open?(P(),B("div",{key:0,class:"app-dialog-overlay",onClick:vt(a,["self"])},[w("div",{class:dt(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Cr(vt(a,["prevent"]),["esc"])},[w("div",P_,[w("div",E_,[w("h3",R_,F(e.title),1),e.subtitle?(P(),B("p",M_,F(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":m(o)("Close"),title:m(o)("Close"),onClick:a},[Fe(yf,{class:"app-dialog-close-icon"})],8,j_)]),w("div",L_,[xr(i.$slots,"default",{},void 0)]),i.$slots.footer?(P(),B("div",N_,[xr(i.$slots,"footer",{},void 0)])):ve("",!0)],42,__)])):ve("",!0)]))}}),Dd=Ct(O_,[["__scopeId","data-v-ad2ce243"]]),$_={key:0,class:"sidebar-menu-row-left"},D_={class:"sidebar-menu-row-main"},F_={key:1,class:"sidebar-menu-row-right"},B_={key:0,class:"sidebar-menu-row-right-default"},U_={key:1,class:"sidebar-menu-row-right-hover"},z_=bn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=XS(),r=Y(()=>!!n.left),o=Y(()=>!!n.right),a=Y(()=>!!n["right-hover"]),s=Y(()=>o.value||a.value);return(i,l)=>(P(),et(Hf(t.as),Kf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:pt(()=>[r.value?(P(),B("span",$_,[xr(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",D_,[xr(i.$slots,"default",{},void 0,!0)]),s.value?(P(),B("span",F_,[o.value?(P(),B("span",B_,[xr(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(P(),B("span",U_,[xr(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"]))}}),xs=Ct(z_,[["__scopeId","data-v-9db51cf5"]]),H_={},q_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function W_(e,t){return P(),B("svg",q_,[...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 ic=Ct(H_,[["render",W_]]),G_={},V_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function K_(e,t){return P(),B("svg",V_,[...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 Ty=Ct(G_,[["render",K_]]),Y_=["data-menu-open"],J_={class:"thread-left-stack"},Q_=["data-state"],X_=["data-confirming","title"],Z_={key:0,class:"thread-delete-confirm-label"},eP=["title"],tP={class:"thread-row-title-wrap"},nP={class:"thread-row-title-line"},rP={class:"thread-row-title"},oP={key:0,class:"thread-row-originator"},aP=["title"],sP={key:0,class:"thread-row-automation-count"},iP=["data-state"],lP={class:"thread-row-time"},uP=bn({__name:"SidebarThreadRow",props:{thread:{},selected:{type:Boolean},pinned:{type:Boolean},menuOpen:{type:Boolean},showStatusIndicator:{type:Boolean},threadState:{},inlineDeleteConfirming:{type:Boolean},automationCount:{},automationTooltip:{},requestLabel:{},relativeTime:{},deleteLabel:{},confirmDeleteLabel:{},confirmLabel:{},worktreeLabel:{},setMenuWrapRef:{type:Function}},emits:["select","inline-delete","menu-toggle","row-leave","row-contextmenu"],setup(e,{emit:t}){const n=e,r=t,o=Y(()=>n.thread.originator?`${n.thread.originator}`:"");function a(s){n.setMenuWrapRef(s instanceof HTMLDivElement?s:null)}return(s,i)=>(P(),B("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Fe(xs,{class:"thread-row","data-thread-id":n.thread.id,"data-active":n.selected,"data-live":n.threadState==="working"?"true":"false","data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:i[3]||(i[3]=l=>r("select")),onMouseleave:i[4]||(i[4]=l=>r("row-leave",l)),onContextmenu:i[5]||(i[5]=l=>r("row-contextmenu",l))},{left:pt(()=>[w("span",J_,[n.showStatusIndicator?(P(),B("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,Q_)):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]=vt(l=>r("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(P(),B("span",Z_,F(n.confirmLabel),1)):(P(),et(Ty,{key:1,class:"thread-icon"}))],8,X_)])]),right:pt(()=>[w("span",lP,F(n.relativeTime),1)]),"right-hover":pt(()=>[w("div",{ref:a,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:i[2]||(i[2]=vt(l=>r("menu-toggle"),["stop"]))},[Fe(gf,{class:"thread-icon"})])],512)]),default:pt(()=>[w("button",{class:"thread-main-button",type:"button",title:o.value,onClick:i[1]||(i[1]=vt(l=>r("select"),["stop"]))},[w("span",tP,[w("span",nP,[w("span",rP,F(n.thread.title),1),n.thread.originator?(P(),B("span",oP,F(n.thread.originator),1)):ve("",!0),n.thread.hasWorktree?(P(),et(ic,{key:1,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ve("",!0),n.automationCount>0?(P(),B("span",{key:2,class:"thread-row-automation-chip",title:n.automationTooltip},[Fe(Pc,{class:"thread-row-automation-icon"}),n.automationCount>1?(P(),B("span",sP,F(n.automationCount),1)):ve("",!0)],8,aP)):ve("",!0),n.thread.pendingRequestState?(P(),B("span",{key:3,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},F(n.requestLabel),9,iP)):ve("",!0)])])],8,eP)]),_:1},8,["data-thread-id","data-active","data-live","data-pinned","data-menu-open","force-right-hover"])],8,Y_))}}),Lu=Ct(uP,[["__scopeId","data-v-105373c3"]]);function cP(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}function dP(e){const{getGroups:t,t:n}=e,r=T({}),o=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),D=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=Y(()=>{if(s.value==="project"){const de=l.value;return de?o.value[de]??[]:[]}const J=i.value;return J?r.value[J]??[]:[]}),ue=Y(()=>ce(q.value.rrule)),K=Y(()=>v.value&&d.value==="create"?f.value==="thread"?n("This creates a heartbeat automation attached to the selected chat."):n("This creates a project automation attached to the selected project folder."):s.value==="project"?n("This creates project automations attached to the selected project folder."):n("This creates heartbeat automations attached to the selected thread.")),ie=Y(()=>{var de;const J=[];for(const Te of t())for(const Ue of Te.threads){const Tt=((de=Ue.title)==null?void 0:de.trim())||Ue.id,gt=e.getProjectDisplayName(Te.projectName);J.push({value:Ue.id,label:`${Tt} · ${gt}`,searchText:`${Tt} ${gt} ${Ue.id}`.toLowerCase()})}return J}),ye=Y(()=>{const J=[];for(const de of t()){const Te=e.getProjectAutomationKey(de.projectName);if(!Te)continue;const Ue=e.getProjectDisplayName(de.projectName);J.push({value:Te,label:Ue,searchText:`${Ue} ${Te}`.toLowerCase()})}return J}),Pe=Y(()=>(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")}],ee=Y(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);ot(Pe,J=>{var de;v.value&&(J.some(Te=>Te.value===y.value)||(y.value=((de=J[0])==null?void 0:de.value)??""))});function me(J){var de;return((de=r.value[J])==null?void 0:de.length)??0}function re(J){return me(J)>0}function Ae(J){var Te;const de=e.getProjectAutomationKey(J);return de?((Te=o.value[de])==null?void 0:Te.length)??0:0}function De(J){return Ae(J)>0}function Ne(J){if(J.length===0)return"";if(J.length>1){const Ue=J.filter(Tt=>Tt.status==="ACTIVE").length;return`${J.length} ${n("automations")} • ${Ue} ${n("active")}`}const[de]=J,Te=de.status==="PAUSED"?"-":de.nextRunAtMs?new Date(de.nextRunAtMs).toLocaleString():n("Not scheduled");return`${de.name} • ${n("Next run")}: ${Te}`}function Le(J){return Ne(r.value[J]??[])}function xe(J){const de=e.getProjectAutomationKey(J);return Ne(de?o.value[de]??[]:[])}function Se(J){return String(Math.max(0,J)).padStart(2,"0")}function Ce(J,de){const Te=typeof J=="number"?J:Number(J);return Number.isFinite(Te)?Math.max(1,Math.floor(Te)):de}function Ee(J){const[de,Te]=J.split(":"),Ue=Math.min(23,Math.max(0,Number(de)||0)),Tt=Math.min(59,Math.max(0,Number(Te)||0));return`FREQ=DAILY;BYHOUR=${Ue};BYMINUTE=${Tt}`}function Je(J,de){const Te=Ce(J,1);return de==="minutes"?`FREQ=MINUTELY;INTERVAL=${Te}`:de==="hours"?`FREQ=HOURLY;INTERVAL=${Te}`:`FREQ=DAILY;INTERVAL=${Te}`}function Xe(J){return Object.fromEntries(J.split(";").map(de=>de.trim()).filter(Boolean).map(de=>{const[Te,...Ue]=de.split("=");return[Te.toUpperCase(),Ue.join("=").trim()]}).filter(([de,Te])=>de&&Te))}function it(J){var Tt;const de=Xe(J),Te=(Tt=de.FREQ)==null?void 0:Tt.toUpperCase(),Ue=Ce(de.INTERVAL,1);if(Te==="DAILY"&&de.BYHOUR!==void 0&&de.BYMINUTE!==void 0&&Ue===1){const gt=Math.min(23,Math.max(0,Number(de.BYHOUR)||0)),Lt=Math.min(59,Math.max(0,Number(de.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Se(gt)}:${Se(Lt)}`,interval:1,intervalUnit:"hours"}}return Te==="MINUTELY"||Te==="HOURLY"||Te==="DAILY"&&de.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Ue,intervalUnit:Te==="MINUTELY"?"minutes":Te==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function ce(J){var Tt;const de=Xe(J),Te=(Tt=de.FREQ)==null?void 0:Tt.toUpperCase(),Ue=Ce(de.INTERVAL,1);if(Te==="DAILY"&&de.BYHOUR!==void 0&&de.BYMINUTE!==void 0&&Ue===1){const gt=Math.min(23,Math.max(0,Number(de.BYHOUR)||0)),Lt=Math.min(59,Math.max(0,Number(de.BYMINUTE)||0));return`${n("RRULE")}: ${J} · ${n("runs daily at")} ${Se(gt)}:${Se(Lt)}`}return Te==="MINUTELY"?`${n("RRULE")}: ${J} · ${n("runs every")} ${Ue} ${n("minute(s)")}`:Te==="HOURLY"?`${n("RRULE")}: ${J} · ${n("runs every")} ${Ue} ${n("hour(s)")}`:Te==="DAILY"&&de.INTERVAL!==void 0?`${n("RRULE")}: ${J} · ${n("runs every")} ${Ue} ${n("day(s)")}`:J?`${n("RRULE")}: ${J}`:n("RRULE is required.")}function N(){const J=M.value;J.mode==="daily"?q.value.rrule=Ee(J.dailyTime):J.mode==="interval"&&(q.value.rrule=Je(J.interval,J.intervalUnit))}function oe(J){J!=="minutes"&&J!=="hours"&&J!=="days"||(M.value={...M.value,intervalUnit:J},N())}function se(J){J!=="ACTIVE"&&J!=="PAUSED"||(q.value={...q.value,status:J})}function je(){M.value=it(q.value.rrule)}function qe(J){M.value={...M.value,mode:J},N()}function A(J){var Te;s.value="thread",i.value=J,l.value="",v.value=!1,S.value="",I.value="";const de=(Te=r.value[J])==null?void 0:Te[0];de?_e(de.id):ae(),a.value=!0,e.closeThreadMenu()}function R(J){var Ue;const de=e.getProjectAutomationKey(J);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=(Ue=o.value[de])==null?void 0:Ue[0];Te?_e(Te.id):ae(),a.value=!0,e.closeProjectMenu()}function H(J){s.value=J.scope,i.value=J.scope==="thread"?J.target:"",l.value=J.scope==="project"?J.target:"",v.value=!1,S.value="",I.value="",J.scope==="project"?o.value=We(o.value,J.target,J.automation):r.value=he(r.value,J.target,J.automation),_e(J.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function le(){var J;v.value=!0,f.value="thread",y.value=((J=ie.value[0])==null?void 0:J.value)??"",s.value="thread",i.value="",l.value="",S.value="",I.value="",ae(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ne(J){var de;f.value=J,y.value="",s.value=J==="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=it(q.value.rrule)}function _e(J){const de=pe.value.find(Te=>Te.id===J);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=it(de.rrule))}function Oe(){a.value=!1,s.value="thread",i.value="",l.value="",c.value="",S.value="",I.value="",O.value=!1,D.value=!1}function ke(J,de){return Object.fromEntries(Object.entries(J).filter(([Te])=>Te!==de))}function he(J,de,Te){const Ue=J[de]??[],Tt=Ue.findIndex(Lt=>Lt.id===Te.id),gt=[...Ue];return Tt>=0?gt.splice(Tt,1,Te):gt.push(Te),{...J,[de]:gt}}function Ke(J,de,Te){const Ue=(J[de]??[]).filter(Tt=>Tt.id!==Te);return Ue.length>0?{...J,[de]:Ue}:ke(J,de)}function $e(J,de){return Object.fromEntries(Object.entries(J).filter(([Te])=>Te!==de))}function We(J,de,Te){const Ue=J[de]??[],Tt=Ue.findIndex(Lt=>Lt.id===Te.id),gt=[...Ue];return Tt>=0?gt.splice(Tt,1,Te):gt.push(Te),{...J,[de]:gt}}async function Ge(){o.value=await qx()}async function ft(J){await im(J).catch(()=>{}),r.value=ke(r.value,J)}async function bt(){let J=i.value,de=l.value;O.value=!0,S.value="",I.value="";try{if(N(),v.value&&d.value==="create"&&(f.value==="thread"?(J=y.value,de="",s.value="thread",i.value=J,l.value=""):(de=y.value,J="",s.value="project",i.value="",l.value=de)),s.value==="thread"&&!J)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},Ue=s.value==="project"?await Gx({...Te,projectName:de}):await Wx({...Te,threadId:J});s.value==="project"?await Ge():r.value=he(r.value,J,Ue),e.onAutomationsChanged(),_e(Ue.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 nt(){const J=i.value,de=l.value,Te=c.value;if(Te&&!(s.value==="thread"&&!J)&&!(s.value==="project"&&!de)){O.value=!0,S.value="",I.value="";try{s.value==="project"?(await Kg(de,Te),await Ge()):(await im(J,Te),r.value=Ke(r.value,J,Te));const Ue=pe.value[0];Ue?_e(Ue.id):ae(),e.onAutomationsChanged(),O.value=!1}catch(Ue){S.value=Ue instanceof Error?Ue.message:n("Failed to remove automation"),O.value=!1}}}async function lt(){const J=i.value,de=c.value;if(!(!J||!de)){D.value=!0,S.value="",I.value="";try{await Vx(J,de),I.value=n("Automation run queued.")}catch(Te){S.value=Te instanceof Error?Te.message:n("Failed to run automation")}finally{D.value=!1}}}return{automationByThreadId:r,automationByProjectName:o,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:c,automationDialogMode:d,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:y,automationDialogError:S,automationDialogNotice:I,projectAutomationActionError:U,isSavingAutomation:O,isRunningAutomation:D,automationDraft:q,automationScheduleDraft:M,automationDialogAutomations:pe,automationSchedulePreview:ue,automationDialogSubtitle:K,automationThreadTargetOptions:ie,automationProjectTargetOptions:ye,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:ge,automationStatusOptions:ee,threadAutomationCount:me,threadHasAutomation:re,projectAutomationCount:Ae,projectHasAutomation:De,threadAutomationTooltip:Le,projectAutomationTooltip:xe,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:oe,onAutomationStatusChange:se,syncAutomationScheduleDraftFromRrule:je,setAutomationScheduleMode:qe,openAutomationDialog:A,openProjectAutomationDialog:R,openAutomationEditorFromPanel:H,openAutomationCreatorFromPanel:le,setAutomationTargetMode:ne,startNewAutomationDraft:ae,selectAutomationForEditing:_e,closeAutomationDialog:Oe,omitAutomationProject:$e,reloadProjectAutomations:Ge,removeAutomationsForThread:ft,submitAutomationDialog:bt,onDeleteAutomationFromDialog:nt,onRunAutomationFromDialog:lt}}const fP=4,Dm=6;function pP(e,t,n){if(e===null||n===0)return null;const r=Math.max(0,Math.min(e,n)),o=r>t?r-1:r,a=Math.max(0,Math.min(o,n-1));return a===t?null:a}function hP(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:r,isCollapsed:o,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 oe=N.target,se=U.get(oe);se&&q(se,oe)}}):null,D=()=>{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 oe=N.getBoundingClientRect().height;if(!Number.isFinite(oe)||oe<=0)return;const se=S.value[ce];se!==void 0&&Math.abs(se-oe)<.5||(S.value={...S.value,[ce]:oe})}function M(ce,N){const oe=I.get(ce);oe&&oe!==N&&O&&O.unobserve(oe);const se=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(se){I.set(ce,se),U.set(se,ce),q(ce,se),O==null||O.observe(se);return}oe&&(O==null||O.unobserve(oe)),I.delete(ce)}function pe(ce){const N=S.value[ce]??0,oe=d.value,je=((oe==null?void 0:oe.projectName)===ce?oe.groupHeight:null)??N,qe=o(ce)?0:Dm;return Math.max(0,je+qe)}const ue=Y(()=>{const ce=d.value;return ce?pP(ce.dropTargetIndexFull,ce.fromIndex,t().length):null}),K=Y(()=>{const N=(r()?n():t()).map(A=>A.projectName),oe=d.value,se=ue.value;if(!oe||se===null)return N;const je=[...N],[qe]=je.splice(oe.fromIndex,1);return qe?(je.splice(se,0,qe),je):N}),ie=Y(()=>{const ce={};let N=0;for(const oe of K.value)ce[oe]=N,N+=pe(oe);return ce}),ye=Y(()=>{let ce=0;for(const N of K.value)ce+=pe(N);return{height:`${Math.max(0,ce)}px`}});function Pe(ce,N){if(ce.button!==0||r()||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(),A=o(N)?0:Dm;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+A},ce.preventDefault(),ge()}function ge(){window.addEventListener("mousemove",me),window.addEventListener("mouseup",re),window.addEventListener("keydown",Ae)}function ee(){window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",re),window.removeEventListener("keydown",Ae)}function me(ce){v={clientX:ce.clientX,clientY:ce.clientY},Ne()}function re(ce){Le({clientX:ce.clientX,clientY:ce.clientY});const N=d.value;if(N&&ue.value!==null){const oe=t().findIndex(se=>se.projectName===N.projectName);if(oe>=0){const se=ue.value;se!==oe&&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=""),ee()}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 oe=ce.clientX-N.startClientX,se=ce.clientY-N.startClientY;if(Math.hypot(oe,se)<fP)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&&xe(ce)}function xe(ce){const N=d.value;if(!N)return;if(N.ghostTop=ce.clientY-N.pointerOffsetY,!Se(ce)){N.dropTargetIndexFull=null;return}const oe=ce.clientY,se=l.value;if(!se){N.dropTargetIndexFull=null;return}const je=t(),qe=se.getBoundingClientRect(),A=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=A.get(ne);if(ae===void 0)continue;const _e=pe(ne),Oe=qe.top+H+_e/2;if(oe<Oe){le=ae;break}H+=_e}N.dropTargetIndexFull=le}function Se(ce){const N=l.value;if(!N)return!1;const oe=N.getBoundingClientRect(),se=ce.clientX>=oe.left&&ce.clientX<=oe.right,je=ce.clientY>=oe.top-32&&ce.clientY<=oe.bottom+32;return se&&je}function Ce(ce){var N;return((N=d.value)==null?void 0:N.projectName)===ce}function Ee(ce){const N=d.value,oe=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, ${oe}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${N.groupLeft}px`,width:`${N.groupWidth}px`,height:`${N.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${N.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Je(ce){return y.value===ce?(y.value="",!0):!1}function Xe(ce){const N=D();N&&!ce.includes(N)&&De();const oe=new Set(ce),se=Object.fromEntries(Object.entries(S.value).filter(([je])=>oe.has(je)));Object.keys(se).length!==Object.keys(S.value).length&&(S.value=se)}function it(){for(const ce of I.values())O==null||O.unobserve(ce);I.clear(),De()}return{groupsContainerRef:l,groupsContainerStyle:ye,setProjectGroupRef:M,isDraggingProject:Ce,projectGroupStyle:Ee,onProjectHandleMouseDown:Pe,takeToggleSuppression:Je,pruneProjectGroups:Xe,dispose:it}}const mP={key:0,class:"pinned-section"},vP={class:"thread-tree-header"},gP={key:0,class:"thread-list"},yP={class:"projects-section"},wP={class:"thread-tree-header"},bP=["aria-expanded","aria-label","title"],TP={class:"organize-menu-title"},SP=["data-active"],CP={key:0},xP=["data-active"],kP={key:0},IP=["data-active"],AP={key:0},_P={class:"organize-menu-title"},PP=["data-active"],EP={key:0},RP=["data-active"],MP={key:0},jP={key:0,class:"thread-tree-action-error"},LP={key:1,class:"thread-tree-no-results"},NP={key:2,class:"thread-tree-loading"},OP={key:3,class:"thread-list thread-list-global"},$P=["data-project-name","data-expanded","data-dragging"],DP={class:"project-icon-stack"},FP={class:"project-icon-folder"},BP={class:"project-icon-chevron"},UP=["data-dragging-handle","onMousedown"],zP=["title"],HP=["title"],qP={key:0,class:"thread-row-automation-count"},WP={class:"project-hover-controls"},GP=["onClick"],VP=["data-open-direction"],KP=["onClick"],YP=["onClick"],JP=["onClick"],QP=["onClick"],XP=["onClick"],ZP=["onClick"],eE={class:"project-menu-label"},tE=["onInput"],nE=["aria-label","title","onClick"],rE={key:0,class:"thread-list"},oE={class:"project-empty"},aE=["onClick"],sE={class:"chats-section"},iE={class:"thread-tree-header"},lE={class:"chats-section-actions"},uE=["aria-label","title"],cE={key:0,class:"thread-tree-no-results"},dE={key:1,class:"thread-list thread-list-global"},fE=["data-open-direction"],pE=["disabled","title"],hE=["placeholder","onKeydown"],mE={class:"recycle-bin-content"},vE={key:0,class:"recycle-bin-empty"},gE={key:1,class:"recycle-bin-list"},yE={class:"recycle-bin-item-copy"},wE={class:"recycle-bin-item-title"},bE={key:0,class:"recycle-bin-item-meta"},TE={class:"recycle-bin-item-time"},SE={class:"recycle-bin-item-actions"},CE=["disabled","onClick"],xE=["onClick"],kE={key:2,class:"recycle-bin-error",role:"alert"},IE=["aria-label"],AE={class:"rename-thread-title"},_E={class:"rename-thread-subtitle"},PE={key:0,class:"automation-target-picker"},EE={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},RE={class:"automation-target-dropdown"},ME=["aria-label"],jE=["onClick"],LE={class:"automation-thread-field"},NE={class:"automation-thread-label"},OE=["placeholder"],$E={class:"automation-thread-field"},DE={class:"automation-thread-label"},FE=["placeholder"],BE={class:"automation-thread-field"},UE={class:"automation-thread-label"},zE={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},HE={key:0,class:"automation-schedule-row"},qE={class:"automation-schedule-copy"},WE={key:1,class:"automation-schedule-row"},GE={class:"automation-schedule-copy"},VE={class:"automation-schedule-preview"},KE={class:"automation-thread-field"},YE={class:"automation-thread-label"},JE={key:2,class:"rename-thread-subtitle automation-thread-error"},QE={key:3,class:"rename-thread-subtitle automation-thread-notice"},XE={class:"rename-thread-actions"},ZE=["disabled"],eR=["disabled"],tR=["disabled"],nR=["disabled"],Fm="codex-web-local.sidebar-section-expansion.v1",Bm="codex-web-local.sidebar-chats-first.v1",Um="codex-web-local.sidebar-chat-sort-mode.v1",zm="codex-web-local.thread-view-mode.v1",Hm="codex-web-local.collapsed-projects.v1",rR=bn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},projectGitRepoByName:{},projectCwdByName:{},selectedThreadId:{},isLoading:{type:Boolean},isThreadListFullyLoaded:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","save-thread-project","browse-project-files","save-project","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","copy-thread-chat","fork-thread","start-new-chat","automations-changed","restore-thread"],setup(e,{expose:t,emit:n}){const r=e,{t:o}=wa(),{recordVisibleFailure:a}=yy(),s=n,{records:i,loadRecords:l,recordArchivedThread:c,removeArchivedRecord:d,restoreArchivedThread:v}=m_(),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({}),D=T({}),q=T(!0),M=T(!0),pe=T(!0),ue=T(!1),K=T(so(Bm,!1)),ie=T(ar());let ye=!1;const Pe=T([]),ge=T({}),ee=T(""),me=T([]),re=T(""),Ae=T(""),De=T("hover"),Ne=T({}),Le=T({}),xe=T({}),Se=T("actions"),Ce=T(""),Ee=T(!1),Je=T(""),Xe=T(""),it=T(null),ce=T(!1),N=T(""),oe=T(""),se=dP({getGroups:()=>r.groups,t:o,getProjectDisplayName:fo,getProjectAutomationKey:zs,closeThreadMenu:He,closeProjectMenu:Zt,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:je,automationByProjectName:qe,automationDialogVisible:A,automationDialogScope:R,automationDialogAutomationId:H,automationDialogMode:le,automationTargetPickerVisible:ne,automationTargetMode:ae,automationTargetValue:_e,automationDialogError:Oe,automationDialogNotice:ke,projectAutomationActionError:he,isSavingAutomation:Ke,isRunningAutomation:$e,automationDraft:We,automationScheduleDraft:Ge,automationDialogAutomations:ft,automationSchedulePreview:bt,automationDialogSubtitle:nt,automationTargetDropdownOptions:lt,automationIntervalUnitOptions:J,automationStatusOptions:de,threadAutomationCount:Te,threadHasAutomation:Ue,projectAutomationCount:Tt,projectHasAutomation:gt,threadAutomationTooltip:Lt,projectAutomationTooltip:Oo,syncAutomationRruleFromScheduleDraft:Yt,onAutomationIntervalUnitChange:no,onAutomationStatusChange:rr,syncAutomationScheduleDraftFromRrule:ba,setAutomationScheduleMode:ro,openAutomationDialog:$s,openProjectAutomationDialog:Ta,openAutomationEditorFromPanel:Xa,openAutomationCreatorFromPanel:$r,setAutomationTargetMode:Za,startNewAutomationDraft:Dr,selectAutomationForEditing:$o,closeAutomationDialog:Do,omitAutomationProject:Ds,reloadProjectAutomations:Fo,removeAutomationsForThread:Fr,submitAutomationDialog:es,onDeleteAutomationFromDialog:Sa,onRunAutomationFromDialog:Bo}=se,oo=hP({getGroups:()=>r.groups,getFilteredGroups:()=>io.value,isSearchActive:()=>Pn.value,isCollapsed:_r,getElevatedProjectName:()=>re.value?re.value:Ae.value?fn.value.get(Ae.value)??"":"",onReorderProject:(C,E)=>s("reorder-project",{projectName:C,toIndex:E}),closeProjectMenu:Zt}),{groupsContainerRef:ao,groupsContainerStyle:kr,setProjectGroupRef:ts,isDraggingProject:ns,projectGroupStyle:mt,onProjectHandleMouseDown:xt,takeToggleSuppression:It,pruneProjectGroups:dn,dispose:zn}=oo,sn=new Map,Ir=new Map,hr=T(null),Uo=T(null),ln=T(!1),or=T(Pt());function Ar(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(Hm);if(!C)return{};const E=JSON.parse(C);return!E||typeof E!="object"||Array.isArray(E)?{}:E}catch{return{}}}function Pt(){return typeof window>"u"?"project":window.localStorage.getItem(zm)==="chronological"?"chronological":"project"}function so(C,E){if(typeof window>"u")return E;const x=window.localStorage.getItem(C);return x==="true"?!0:x==="false"?!1:E}function ar(){return typeof window>"u"?"updated":window.localStorage.getItem(Um)==="created"?"created":"updated"}D.value=Ar();function Tn(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem(Fm)||"{}");typeof C.pinned=="boolean"&&(q.value=C.pinned),typeof C.projects=="boolean"&&(M.value=C.projects),typeof C.chats=="boolean"&&(pe.value=C.chats)}catch{}}function Br(){typeof window>"u"||window.localStorage.setItem(Fm,JSON.stringify({pinned:q.value,projects:M.value,chats:pe.value}))}Tn(),ot(D,C=>{typeof window>"u"||window.localStorage.setItem(Hm,JSON.stringify(C))},{deep:!0}),ot(or,C=>{typeof window>"u"||window.localStorage.setItem(zm,C)}),ot(K,C=>{typeof window>"u"||window.localStorage.setItem(Bm,String(C))}),ot(ie,C=>{typeof window>"u"||window.localStorage.setItem(Um,C)}),ot([q,M,pe],Br);const Ln=Y(()=>r.searchQuery.trim().toLowerCase()),Pn=Y(()=>Ln.value.length>0),Sn=Y(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),Ca=Y(()=>new Set(Pe.value)),mr=Y(()=>new Set(me.value));function Ur(C){if(mr.value.has(C.id))return!1;if(!Pn.value)return!0;if(Sn.value)return Sn.value.has(C.id);const E=Ln.value;return C.title.toLowerCase().includes(E)||C.preview.toLowerCase().includes(E)}const Ot=Y(()=>v_(r.groups)),io=Y(()=>Ot.value.flatMap(C=>{const E=C.threads.filter(x=>!ac(x.cwd)&&Ur(x));return E.length>0?[{...C,threads:E}]:!Pn.value&&C.threads.length===0?[{...C,threads:E}]:[]})),zo=Y(()=>or.value==="chronological"),Ho=Y(()=>{const C=[];for(const E of Ot.value)for(const x of E.threads)Ca.value.has(x.id)||Ur(x)&&C.push(x);return C.sort((E,x)=>{const X=new Date(E.updatedAtIso||E.createdAtIso).getTime();return new Date(x.updatedAtIso||x.createdAtIso).getTime()-X})}),Cn=Y(()=>{const C=Ho.value.filter(x=>ac(x.cwd)),E=ie.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((x,X)=>{const Qe=new Date(x[E]||x.updatedAtIso||x.createdAtIso).getTime();return new Date(X[E]||X.updatedAtIso||X.createdAtIso).getTime()-Qe})}),Gt=Y(()=>Pn.value||ue.value?Cn.value:Cn.value.slice(0,10)),vr=Y(()=>Pn.value?!1:Cn.value.length>10),un=Y(()=>{const C=new Map;for(const E of Ot.value)for(const x of E.threads)mr.value.has(x.id)||C.set(x.id,x);return C});ot(Pe,C=>{ye&&OI(C)}),ot([un,()=>r.isThreadListFullyLoaded],([C])=>{const E=cP(Pe.value,new Set(C.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(E.length===Pe.value.length)return;const x=new Set(E),X=Object.fromEntries(Object.entries(ge.value).filter(([Qe])=>x.has(Qe)));ge.value=X,Pe.value=E});let qo=0;async function Jt(){if(r.isLoading)return;const C=Pe.value.filter(Qe=>!un.value.has(Qe)&&!ge.value[Qe]);if(C.length===0)return;const E=qo+=1,x=await Promise.all(C.map(async Qe=>{try{return await Kk(Qe)}catch{return null}}));if(E!==qo)return;const X={...ge.value};for(const Qe of x)Qe&&(X[Qe.id]=Qe);ge.value=X}ot([Pe,un,()=>r.isLoading],()=>{ye&&Jt()}),Ii(async()=>{const{threadIds:C}=await NI(),E=Array.isArray(C)?C.filter(x=>typeof x=="string").map(x=>x.trim()).filter((x,X,Qe)=>x.length>0&&Qe.indexOf(x)===X):[];E.length>0&&(Pe.value=E);try{je.value=await Hx()}catch{je.value={}}try{await Fo()}catch{qe.value={}}ye=!0,Jt()});const lo=Y(()=>Ue(N.value)),Hn=Y(()=>{const C=oe.value;return lo.value?o('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:C}):o('This will archive the thread "{title}". You can find it later in archived threads.',{title:C})}),fn=Y(()=>{const C=new Map;for(const E of r.groups)for(const x of E.threads)C.set(x.id,E.projectName);return C}),xa=Y(()=>{const C=new Map;for(const E of r.groups){const x=E.threads.filter(X=>!Ca.value.has(X.id)&&!mr.value.has(X.id));C.set(E.projectName,x)}return C}),pn=Y(()=>{const C=new Map;for(const E of r.groups)for(const x of E.threads){const X=new Date(x.updatedAtIso||x.createdAtIso).getTime();C.set(x.id,X)}return C}),Qt=Y(()=>{const C=Ae.value;return C?un.value.get(C)??null:null}),cn=Y(()=>Pe.value.map(C=>un.value.get(C)??ge.value[C]??null).filter(C=>C!==null).filter(Ur));function rs(){q.value=!q.value}function xn(){M.value=!M.value}function Fs(){pe.value=!pe.value}function uo(C){if(Number.isNaN(C))return"n/a";const E=Math.abs(Date.now()-C);if(E<6e4)return o("now");const x=Math.floor(E/6e4);if(x<60)return`${x}m`;const X=Math.floor(x/60);return X<24?`${X}h`:`${Math.floor(X/24)}d`}function co(C){const E=pn.value.get(C.id);return uo(typeof E=="number"?E:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function Wo(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 qn(C){return Ca.value.has(C)}function Go(C){if(qn(C)){Pe.value=Pe.value.filter(E=>E!==C);return}Pe.value=[C,...Pe.value]}function Vo(C){Go(C),He()}function sr(C){ee.value="",s("select",C)}function yt(C){C===r.selectedThreadId&&(s("copy-thread-chat",C),He())}function hn(C){s("fork-thread",C),He()}function Nn(C){return`${o("start new thread")} ${fo(C)}`}function ka(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,X;const E=((X=(x=un.value.get(C))==null?void 0:x.cwd)==null?void 0:X.trim())??"";if(He(),!(!E||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(E)}catch{}}function V(C,E){if(Ae.value===C&&De.value==="hover"){if(E){const x=E.relatedTarget,X=Uo.value;if(x instanceof Node&&X&&X.contains(x))return}He()}}function be(C){return Ae.value===C}function He(){Ae.value="",De.value="hover",xe.value={}}function $t(C){if(ee.value="",Ae.value===C){He();return}De.value="hover",Zt(),ln.value=!1,Ae.value=C,Nt(()=>{Hr(C)})}function _t(C,E){C.preventDefault(),ee.value="",De.value="contextmenu",Ae.value=E}function Xt(C,E){Je.value=C,Xe.value=E,Ee.value=!0,He(),Nt(()=>{var x,X;(x=it.value)==null||x.focus(),(X=it.value)==null||X.select()})}function qt(){Ee.value=!1,Je.value="",Xe.value=""}function zr(){const C=Je.value,E=Xe.value.trim();!C||!E||(s("rename-thread",{threadId:C,title:E}),qt())}function Ko(C,E){ee.value="",N.value=C,oe.value=E,ce.value=!0,He()}function Bs(){ce.value=!1,N.value="",oe.value=""}async function mn(){const C=N.value;C&&(gr(C),Bs())}function Ia(C){return ee.value===C}function Aa(C){if(ee.value!==C){ee.value=C,He();return}gr(C),ee.value=""}function gr(C){var x,X;const E=un.value.get(C)??null;mr.value.has(C)||(me.value=[C,...me.value]),ee.value="",He(),c({id:C,title:((x=E==null?void 0:E.title)==null?void 0:x.trim())||"(untitled)",cwd:((X=E==null?void 0:E.cwd)==null?void 0:X.trim())??"",projectName:fn.value.get(C)??""}),Pe.value=Pe.value.filter(Qe=>Qe!==C),s("archive",C),Ue(C)&&Fr(C)}function fo(C){return r.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:Xa,openAutomationCreatorFromPanel:$r,openRenameThreadDialog:Xt,openRecycleBin:I});function Yo(C){return C.includes("/")||C.includes("\\")}function hl(C){return Yo(C)?C:fo(C)}function _a(C){const E=Nr(C);if(!E)return!1;let x=0;for(const X of r.groups)if(Yo(X.projectName)&&Nr(X.projectName)===E&&(x+=1,x>1))return!0;return!1}function Jo(C){const E=r.projectDisplayNameById[C.projectName],x=fo(C.projectName),X=C.projectName;if(E&&!Yo(X)&&X!==x)return x.includes(X)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(X)?x:`${x} ${X}`;if(E&&Yo(X)){const En=Nr(X),Tr=Nr(el(X)),tn=_a(X)?Tr:En;return tn&&tn!==x?`${x} ${tn}`:x}if(!x.includes("/")&&!x.includes("\\"))return x;const Qe=Nr(x)||x,Ft=Nr(el(x));return Ft.startsWith(".")&&Ft!==Qe?`${Qe} ${Ft}`:C.threads.length>0||!_a(X)?Qe:Ft?`${Qe} ${Ft}`:Qe}function Pa(C){return re.value===C}function Zt(){re.value="",Se.value="actions",Ce.value=""}function Qo(){const C=!ln.value;C&&(Zt(),He()),ln.value=C}function on(C){or.value=C,ln.value=!1}function po(){K.value=!K.value}function Xo(C){ie.value=C}function Zo(C){s("request-project-git-status",C),Nt(()=>{na(C)})}function yr(C){if(re.value===C){Zt();return}He(),ln.value=!1,re.value=C,Se.value="actions",Ce.value=fo(C),Zo(C)}function Gn(C){He(),ln.value=!1,re.value=C,Se.value="actions",Ce.value=fo(C),Zo(C)}function kn(C){return r.projectDisplayNameById[C.projectName]??Jo(C)}function ea(C){He();const E=C.projectName;re.value=E,Se.value="rename",Ce.value=kn(C),Nt(()=>{na(E)})}function ml(C){s("browse-project-files",C),Zt()}function Vn(C){s("save-project",C),Zt()}function os(C){s("create-project-worktree",C),Zt()}function Us(C){s("rename-project",{projectName:C,displayName:Ce.value})}function vl(C){const E=zs(C);if(s("remove-project",C),E&&gt(C)){he.value="";const x=qe.value;qe.value=Ds(qe.value,E),Kg(E).then(Fo).catch(async X=>{qe.value=x;const Qe=X instanceof Error?X.message:o("Failed to delete project automation");he.value=Qe,a(Qe);try{await Fo()}catch{qe.value=x}}).finally(()=>{s("automations-changed")})}Zt()}function zs(C){var x;const E=((x=r.projectCwdByName[C])==null?void 0:x.trim())??"";return ok(E)?E:""}function en(C,E){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const x=r.groups.findIndex(Ft=>Ft.projectName===E);if(x<0)return;const X=C.key==="ArrowUp"?-1:1,Qe=Math.max(0,Math.min(x+X,r.groups.length-1));Qe!==x&&(C.preventDefault(),s("reorder-project",{projectName:E,toIndex:Qe}))}function At(C){return O.value[C]===!0}function _r(C){return D.value[C]===!0}function Hs(C){O.value={...O.value,[C]:!At(C)}}function wr(){ue.value=!ue.value}function Kn(C){It(C)||(D.value={...D.value,[C]:!_r(C)})}function ho(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 Yn(C,E){const x=E instanceof HTMLElement?E:E&&"$el"in E&&E.$el instanceof HTMLElement?E.$el:null;if(x){Ir.set(C,x);return}Ir.delete(C)}function Pr(C){let E=C.parentElement;for(;E;){const x=window.getComputedStyle(E),X=x.overflowY||x.overflow;if(X==="auto"||X==="scroll"||X==="hidden"||X==="clip")return E.getBoundingClientRect();E=E.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function ta(C,E){const x=C.getBoundingClientRect(),X=Pr(C),Qe=6,Ft=X.bottom-x.bottom,En=x.top-X.top;return Ft>=E+Qe?"down":En>Ft?"up":"down"}function as(C,E){const x=Ir.get(C);if(!x)return"down";const X=ta(x,E);return Le.value={...Le.value,[C]:X},X}function mo(C){return Le.value[C]??"down"}function na(C){const E=sn.get(C);if(!E)return;const x=E.querySelector(".project-menu-panel"),X=(x==null?void 0:x.getBoundingClientRect().height)??0;Ne.value={...Ne.value,[C]:ta(E,X)}}function ra(C,E,x){return Math.min(Math.max(C,E),x)}function Hr(C){const E=Ir.get(C);if(!E)return;const x=Uo.value,X=x==null?void 0:x.getBoundingClientRect(),Qe=(X==null?void 0:X.height)||(x==null?void 0:x.offsetHeight)||112,Ft=(X==null?void 0:X.width)||(x==null?void 0:x.offsetWidth)||160,En=as(C,Qe),Tr=E.getBoundingClientRect(),tn=8,go=4,yo=Math.max(tn,window.innerWidth-Ft-tn),ia=ra(Tr.right-Ft,tn,yo),ss=ra(En==="up"?Tr.top-Qe-go:Tr.bottom+go,tn,Math.max(tn,window.innerHeight-Qe-tn));xe.value={left:`${Math.round(ia)}px`,top:`${Math.round(ss)}px`}}function qr(){const C=Ae.value;C&&Hr(C)}function _i(){window.addEventListener("resize",qr),document.addEventListener("scroll",qr,!0)}function qs(){window.removeEventListener("resize",qr),document.removeEventListener("scroll",qr,!0)}function Wr(C){const E=re.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 oa(C){const E=Ae.value;if(!E)return!1;const x=Ir.get(E);if(!x)return!1;const X=typeof C.composedPath=="function"?C.composedPath():[];if(X.includes(x))return!0;const Qe=Uo.value;if(Qe&&X.includes(Qe))return!0;const Ft=C.target;return Ft instanceof Node?!!(x.contains(Ft)||Qe&&Qe.contains(Ft)):!1}function Ws(C){if(ln.value){const E=hr.value,x=typeof C.composedPath=="function"?C.composedPath():[];!!E&&(x.includes(E)||C.target instanceof Node&&E.contains(C.target))||(ln.value=!1)}re.value&&(Wr(C)||Zt(),Ae.value&&(oa(C)||He()))}function Ea(C){re.value&&!Wr(C)&&Zt(),Ae.value&&!oa(C)&&He()}function Gs(){ln.value&&(ln.value=!1),re.value&&Zt(),Ae.value&&He()}function gl(){window.addEventListener("pointerdown",Ws,{capture:!0}),window.addEventListener("focusin",Ea,{capture:!0}),window.addEventListener("blur",Gs)}function ir(){window.removeEventListener("pointerdown",Ws,{capture:!0}),window.removeEventListener("focusin",Ea,{capture:!0}),window.removeEventListener("blur",Gs)}function Gr(C){return xa.value.get(C.projectName)??[]}function yl(C){if(Pn.value)return Gr(C);if(_r(C.projectName))return[];const E=Gr(C);return At(C.projectName)?E:E.slice(0,10)}function Vs(C){return Pn.value?!1:!_r(C.projectName)&&Gr(C).length>10}function aa(C){return Gr(C).length>0}function Er(C){var E;return!!C.pendingRequestState||C.inProgress||C.unread||((E=C.externalSession)==null?void 0:E.active)===!0}function vo(C){return C.pendingRequestState==="approval"?o("Awaiting approval"):o("Awaiting response")}function br(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"}ot(()=>r.groups.map(C=>C.projectName),C=>{dn(C)}),ot(()=>{const C=re.value;return C?r.projectGitRepoByName[C]:void 0},()=>{const C=re.value;C&&Nt(()=>{re.value===C&&na(C)})});const sa=Y(()=>ln.value||re.value!==""||Ae.value!=="");return ot(sa,C=>{if(C){gl();return}ir()}),ot(Ae,C=>{if(!C){qs();return}_i(),Nt(()=>{Hr(C)})}),Os(()=>{sn.clear(),qs(),ir(),zn()}),(C,E)=>(P(),B("section",{class:dt(["thread-tree-root",{"chats-first":K.value}])},[cn.value.length>0?(P(),B("section",mP,[Fe(xs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":q.value,onClick:rs},{left:pt(()=>[q.value?(P(),et(Ms,{key:1,class:"thread-icon"})):(P(),et(ju,{key:0,class:"thread-icon"}))]),default:pt(()=>[w("span",vP,F(m(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),q.value?(P(),B("ul",gP,[(P(!0),B(ct,null,rn(cn.value,x=>(P(),et(Lu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:qn(x.id),"menu-open":be(x.id),"show-status-indicator":Er(x),"thread-state":br(x),"inline-delete-confirming":Ia(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m(Lt)(x.id),"request-label":vo(x),"relative-time":co(x),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":X=>Yn(x.id,X),onSelect:X=>sr(x.id),onInlineDelete:X=>Aa(x.id),onMenuToggle:X=>$t(x.id),onRowLeave:X=>V(x.id,X),onRowContextmenu:X=>_t(X,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",yP,[Fe(xs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":M.value,onClick:xn},{left:pt(()=>[M.value?(P(),et(Ms,{key:1,class:"thread-icon"})):(P(),et(ju,{key:0,class:"thread-icon"}))]),right:pt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:hr,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":ln.value,"aria-label":m(o)("Organize threads"),title:m(o)("Organize threads"),onClick:vt(Qo,["stop"])},[Fe(gf,{class:"thread-icon"})],8,bP),ln.value?(P(),B("div",{key:0,class:"organize-menu-panel",onClick:E[4]||(E[4]=vt(()=>{},["stop"]))},[w("p",TP,F(m(o)("Organize")),1),w("button",{class:"organize-menu-item","data-active":or.value==="project",type:"button",onClick:E[0]||(E[0]=x=>on("project"))},[w("span",null,F(m(o)("By project")),1),or.value==="project"?(P(),B("span",CP,"✓")):ve("",!0)],8,SP),w("button",{class:"organize-menu-item","data-active":or.value==="chronological",type:"button",onClick:E[1]||(E[1]=x=>on("chronological"))},[w("span",null,F(m(o)("Chronological list")),1),or.value==="chronological"?(P(),B("span",kP,"✓")):ve("",!0)],8,xP),w("button",{class:"organize-menu-item","data-active":K.value,type:"button",onClick:po},[w("span",null,F(m(o)("Chats first")),1),K.value?(P(),B("span",AP,"✓")):ve("",!0)],8,IP),E[40]||(E[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",_P,F(m(o)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":ie.value==="created",type:"button",onClick:E[2]||(E[2]=x=>Xo("created"))},[w("span",null,F(m(o)("Created")),1),ie.value==="created"?(P(),B("span",EP,"✓")):ve("",!0)],8,PP),w("button",{class:"organize-menu-item","data-active":ie.value==="updated",type:"button",onClick:E[3]||(E[3]=x=>Xo("updated"))},[w("span",null,F(m(o)("Updated")),1),ie.value==="updated"?(P(),B("span",MP,"✓")):ve("",!0)],8,RP),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(o)("Recycle bin")),1)])])):ve("",!0)],512)]),default:pt(()=>[w("span",wP,F(m(o)("Projects")),1)]),_:1},8,["aria-expanded"]),M.value?(P(),B(ct,{key:0},[m(he)?(P(),B("p",jP,F(m(he)),1)):ve("",!0),Pn.value&&io.value.length===0?(P(),B("p",LP,F(m(o)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(P(),B("p",NP,F(m(o)("Loading threads...")),1)):zo.value?(P(),B("ul",OP,[(P(!0),B(ct,null,rn(Ho.value,x=>(P(),et(Lu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:qn(x.id),"menu-open":be(x.id),"show-status-indicator":Er(x),"thread-state":br(x),"inline-delete-confirming":Ia(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m(Lt)(x.id),"request-label":vo(x),"relative-time":co(x),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":X=>Yn(x.id,X),onSelect:X=>sr(x.id),onInlineDelete:X=>Aa(x.id),onMenuToggle:X=>$t(x.id),onRowLeave:X=>V(x.id,X),onRowContextmenu:X=>_t(X,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:ao,class:"thread-tree-groups",style:Jr(m(kr))},[(P(!0),B(ct,null,rn(io.value,x=>(P(),B("article",{key:x.projectName,ref_for:!0,ref:X=>m(ts)(x.projectName,X),class:"project-group","data-project-name":x.projectName,"data-expanded":!_r(x.projectName),"data-dragging":m(ns)(x.projectName),style:Jr(m(mt)(x.projectName))},[Fe(xs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:X=>Kn(x.projectName),onContextmenu:vt(X=>Gn(x.projectName),["prevent"]),onKeydown:[X=>en(X,x.projectName),Cr(vt(X=>Kn(x.projectName),["prevent"]),["enter"]),Cr(vt(X=>Kn(x.projectName),["prevent"]),["space"])]},{left:pt(()=>[w("span",DP,[w("span",FP,[_r(x.projectName)?(P(),et(ip,{key:0,class:"thread-icon"})):(P(),et(QA,{key:1,class:"thread-icon"}))]),w("span",BP,[_r(x.projectName)?(P(),et(ju,{key:0,class:"thread-icon"})):(P(),et(Ms,{key:1,class:"thread-icon"}))])])]),right:pt(()=>[w("div",WP,[w("div",{ref_for:!0,ref:X=>ho(x.projectName,X),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:vt(X=>yr(x.projectName),["stop"])},[Fe(gf,{class:"thread-icon"})],8,GP),Pa(x.projectName)?(P(),B("div",{key:0,class:"project-menu-panel","data-open-direction":Ne.value[x.projectName]??"down",onClick:E[6]||(E[6]=vt(()=>{},["stop"]))},[Se.value==="actions"?(P(),B(ct,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:X=>ml(x.projectName)},F(m(o)("Browse files")),9,KP),w("button",{class:"project-menu-item",type:"button",onClick:X=>Vn(x.projectName)},F(m(o)("Export Project")),9,YP),w("button",{class:"project-menu-item",type:"button",onClick:X=>m(Ta)(x.projectName)},F(m(gt)(x.projectName)?m(o)("Manage automations…"):m(o)("Add automation…")),9,JP),e.projectGitRepoByName[x.projectName]?(P(),B("button",{key:0,class:"project-menu-item",type:"button",onClick:X=>os(x.projectName)},F(m(o)("New worktree")),9,QP)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:X=>ea(x)},F(m(o)("Rename project")),9,XP),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:X=>vl(x.projectName)},F(m(o)("Remove")),9,ZP)],64)):(P(),B(ct,{key:1},[w("label",eE,F(m(o)("Project name")),1),Mn(w("input",{"onUpdate:modelValue":E[5]||(E[5]=X=>Ce.value=X),class:"project-menu-input",type:"text",onInput:X=>Us(x.projectName)},null,40,tE),[[Fn,Ce.value]])],64))],8,VP)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":Nn(x.projectName),title:Nn(x.projectName),onClick:vt(X=>ka(x.projectName),["stop"])},[Fe(dl,{class:"thread-icon"})],8,nE)])]),default:pt(()=>[w("span",{class:"project-main-button","data-dragging-handle":m(ns)(x.projectName),onMousedown:vt(X=>m(xt)(X,x.projectName),["left"])},[w("span",{class:"project-title",title:hl(x.projectName)},F(Jo(x)),9,zP),m(gt)(x.projectName)?(P(),B("span",{key:0,class:"thread-row-automation-chip",title:m(Oo)(x.projectName)},[Fe(Pc,{class:"thread-row-automation-icon"}),m(Tt)(x.projectName)>1?(P(),B("span",qP,F(m(Tt)(x.projectName)),1)):ve("",!0)],8,HP)):ve("",!0)],40,UP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),aa(x)?(P(),B("ul",rE,[(P(!0),B(ct,null,rn(yl(x),X=>(P(),et(Lu,{key:X.id,thread:X,selected:X.id===e.selectedThreadId,pinned:qn(X.id),"menu-open":be(X.id),"show-status-indicator":Er(X),"thread-state":br(X),"inline-delete-confirming":Ia(X.id),"automation-count":m(Te)(X.id),"automation-tooltip":m(Lt)(X.id),"request-label":vo(X),"relative-time":co(X),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":Qe=>Yn(X.id,Qe),onSelect:Qe=>sr(X.id),onInlineDelete:Qe=>Aa(X.id),onMenuToggle:Qe=>$t(X.id),onRowLeave:Qe=>V(X.id,Qe),onRowContextmenu:Qe=>_t(Qe,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(),et(xs,{key:1,as:"p",class:"project-empty-row"},{left:pt(()=>[...E[42]||(E[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:pt(()=>[w("span",oE,F(m(o)("No threads")),1)]),_:1})),Vs(x)?(P(),et(xs,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...E[43]||(E[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:X=>Hs(x.projectName)},F(At(x.projectName)?"Show less":"Show more"),9,aE)]),_:2},1024)):ve("",!0)],12,$P))),128))],4))],64)):ve("",!0)]),w("section",sE,[Fe(xs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":pe.value,onClick:Fs},{left:pt(()=>[pe.value?(P(),et(Ms,{key:1,class:"thread-icon"})):(P(),et(ju,{key:0,class:"thread-icon"}))]),right:pt(()=>[w("div",lE,[w("button",{class:"chats-section-action",type:"button","aria-label":m(o)("New chat"),title:m(o)("New chat"),onClick:E[7]||(E[7]=vt(x=>C.$emit("start-new-chat"),["stop"]))},[Fe(dl,{class:"thread-icon"})],8,uE)])]),default:pt(()=>[w("span",iE,F(m(o)("Chats")),1)]),_:1},8,["aria-expanded"]),pe.value&&Cn.value.length===0?(P(),B("p",cE,F(m(o)("No chats")),1)):pe.value?(P(),B("ul",dE,[(P(!0),B(ct,null,rn(Gt.value,x=>(P(),et(Lu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:qn(x.id),"menu-open":be(x.id),"show-status-indicator":Er(x),"thread-state":br(x),"inline-delete-confirming":Ia(x.id),"automation-count":m(Te)(x.id),"automation-tooltip":m(Lt)(x.id),"request-label":vo(x),"relative-time":co(x),"delete-label":m(o)("Delete thread"),"confirm-delete-label":m(o)("Confirm delete"),"confirm-label":m(o)("Confirm"),"worktree-label":m(o)("Worktree thread"),"set-menu-wrap-ref":X=>Yn(x.id,X),onSelect:X=>sr(x.id),onInlineDelete:X=>Aa(x.id),onMenuToggle:X=>$t(x.id),onRowLeave:X=>V(x.id,X),onRowContextmenu:X=>_t(X,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&&vr.value?(P(),et(xs,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...E[44]||(E[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:wr},F(ue.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(P(),et(al,{to:"body"},[Qt.value?(P(),B("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Uo,class:"thread-menu-panel thread-menu-panel-fixed",style:Jr(xe.value),"data-open-direction":mo(Qt.value.id),onClick:E[17]||(E[17]=vt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:E[8]||(E[8]=x=>m($s)(Qt.value.id))},F(m(Ue)(Qt.value.id)?m(o)("Manage automations…"):m(o)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[9]||(E[9]=x=>Wn(Qt.value.id))},F(m(o)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[10]||(E[10]=x=>k(Qt.value.id))},F(m(o)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[11]||(E[11]=x=>j(Qt.value.id))},F(m(o)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:Qt.value.id!==e.selectedThreadId,title:Qt.value.id===e.selectedThreadId?m(o)("Copy chat"):m(o)("Open this chat before copying"),onClick:E[12]||(E[12]=x=>yt(Qt.value.id))},F(m(o)("Copy chat")),9,pE),w("button",{class:"thread-menu-item",type:"button",onClick:E[13]||(E[13]=x=>hn(Qt.value.id))},F(m(o)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[14]||(E[14]=x=>Vo(Qt.value.id))},F(qn(Qt.value.id)?m(o)("Unpin thread"):m(o)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:E[15]||(E[15]=x=>Xt(Qt.value.id,Qt.value.title))},F(m(o)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:E[16]||(E[16]=x=>Ko(Qt.value.id,Qt.value.title))},F(m(o)("Delete thread")),1)],12,fE)):ve("",!0)])),Fe(Dd,{open:Ee.value,title:m(o)("Rename thread"),subtitle:m(o)("Make it short and recognizable."),onClose:qt},{footer:pt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:qt},F(m(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:zr},F(m(o)("Save")),1)]),default:pt(()=>[Mn(w("input",{ref_key:"renameThreadInputRef",ref:it,"onUpdate:modelValue":E[18]||(E[18]=x=>Xe.value=x),class:"rename-thread-input",type:"text",placeholder:m(o)("Add title..."),onKeydown:Cr(vt(zr,["prevent"]),["enter"])},null,40,hE),[[Fn,Xe.value]])]),_:1},8,["open","title","subtitle"]),Fe(Dd,{open:ce.value,title:lo.value?m(o)("Archive chat and remove automations?"):m(o)("Delete thread?"),subtitle:Hn.value,onClose:Bs},{footer:pt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Bs},F(m(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:mn},F(lo.value?m(o)("Archive and remove"):m(o)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Fe(Dd,{open:f.value,title:m(o)("Recycle bin"),subtitle:m(o)("Threads you removed are kept here so you can restore them."),size:"md",onClose:E[19]||(E[19]=x=>f.value=!1)},{default:pt(()=>[w("div",mE,[m(i).length===0?(P(),B("div",vE,F(m(o)("Recycle bin is empty.")),1)):(P(),B("ul",gE,[(P(!0),B(ct,null,rn(m(i),x=>(P(),B("li",{key:x.id,class:"recycle-bin-item"},[w("div",yE,[w("span",wE,F(x.title),1),x.projectName?(P(),B("span",bE,F(x.projectName),1)):ve("",!0),w("span",TE,F(Wo(x.archivedAtIso)),1)]),w("div",SE,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:S.value===x.id,onClick:X=>U(x.id)},F(S.value===x.id?m(o)("Restoring…"):m(o)("Restore")),9,CE),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:X=>m(d)(x.id)},F(m(o)("Delete permanently")),9,xE)])]))),128))])),y.value?(P(),B("p",kE,F(y.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(P(),et(al,{to:"body"},[m(A)?(P(),B("div",{key:0,class:"rename-thread-overlay",onClick:E[39]||(E[39]=vt((...x)=>m(Do)&&m(Do)(...x),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":m(R)==="project"?m(o)("Project automation"):m(o)("Thread automation")},[w("h3",AE,F(m(le)==="edit"?m(o)("Edit automation"):m(o)("Add automation")),1),w("p",_E,F(m(nt)),1),m(ne)&&m(le)==="create"?(P(),B("div",PE,[E[45]||(E[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",EE,[w("button",{class:dt(["automation-target-mode",{"is-active":m(ae)==="thread"}]),type:"button",onClick:E[20]||(E[20]=x=>m(Za)("thread"))}," Existing chat ",2),w("button",{class:dt(["automation-target-mode",{"is-active":m(ae)==="project"}]),type:"button",onClick:E[21]||(E[21]=x=>m(Za)("project"))}," Project ",2)]),w("div",RE,[Fe(Ci,{modelValue:m(_e),"onUpdate:modelValue":E[22]||(E[22]=x=>jn(_e)?_e.value=x:null),class:"automation-thread-dropdown",options:m(lt),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(ft).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,rn(m(ft),x=>(P(),B("button",{key:x.id,class:dt(["automation-thread-list-item",{"is-active":x.id===m(H)}]),type:"button",onClick:X=>m($o)(x.id)},[w("span",null,F(x.name),1),w("small",null,F(x.status==="PAUSED"?"Paused":"Active"),1)],10,jE))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:E[23]||(E[23]=(...x)=>m(Dr)&&m(Dr)(...x))},F(m(o)("Add another automation")),1)],8,ME)):ve("",!0),w("label",LE,[w("span",NE,F(m(o)("Name")),1),Mn(w("input",{"onUpdate:modelValue":E[24]||(E[24]=x=>m(We).name=x),class:"rename-thread-input",type:"text",placeholder:m(o)("Automation name")},null,8,OE),[[Fn,m(We).name]])]),w("label",$E,[w("span",DE,F(m(o)("Prompt")),1),Mn(w("textarea",{"onUpdate:modelValue":E[25]||(E[25]=x=>m(We).prompt=x),class:"automation-thread-textarea",rows:"6",placeholder:m(o)("Describe what the automation should do")},null,8,FE),[[Fn,m(We).prompt]])]),w("div",BE,[w("span",UE,F(m(o)("Schedule")),1),w("div",zE,[w("button",{class:dt(["automation-schedule-mode",{"is-active":m(Ge).mode==="daily"}]),type:"button",onClick:E[26]||(E[26]=x=>m(ro)("daily"))},F(m(o)("Daily")),3),w("button",{class:dt(["automation-schedule-mode",{"is-active":m(Ge).mode==="interval"}]),type:"button",onClick:E[27]||(E[27]=x=>m(ro)("interval"))},F(m(o)("Interval")),3),w("button",{class:dt(["automation-schedule-mode",{"is-active":m(Ge).mode==="advanced"}]),type:"button",onClick:E[28]||(E[28]=x=>m(ro)("advanced"))}," RRULE ",2)]),m(Ge).mode==="daily"?(P(),B("div",HE,[w("span",qE,F(m(o)("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(Yt)&&m(Yt)(...x))},null,544),[[Fn,m(Ge).dailyTime]])])):m(Ge).mode==="interval"?(P(),B("div",WE,[w("span",GE,F(m(o)("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(Yt)&&m(Yt)(...x))},null,544),[[Fn,m(Ge).interval,void 0,{number:!0}]]),Fe(Ci,{class:"automation-schedule-unit-dropdown","model-value":m(Ge).intervalUnit,options:m(J),placeholder:m(o)("Unit"),"onUpdate:modelValue":m(no)},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(ba)&&m(ba)(...x))},null,544)),[[Fn,m(We).rrule]]):ve("",!0),w("p",VE,F(m(bt)),1)]),w("div",KE,[w("span",YE,F(m(o)("Status")),1),Fe(Ci,{class:"automation-thread-dropdown","model-value":m(We).status,options:m(de),placeholder:m(o)("Status"),"onUpdate:modelValue":m(rr)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),m(Oe)?(P(),B("p",JE,F(m(Oe)),1)):m(ke)?(P(),B("p",QE,F(m(ke)),1)):ve("",!0),w("div",XE,[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(Bo)&&m(Bo)(...x))},F(m($e)?m(o)("Running…"):m(o)("Run now")),9,ZE)):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(Sa)&&m(Sa)(...x))},F(m(o)("Remove")),9,eR)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:m(Ke)||m($e),onClick:E[37]||(E[37]=(...x)=>m(Do)&&m(Do)(...x))},F(m(o)("Cancel")),9,tR),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:m(Ke)||m($e),onClick:E[38]||(E[38]=(...x)=>m(es)&&m(es)(...x))},F(m(Ke)?m(o)("Saving…"):m(o)("Save")),9,nR)])],8,IE)])):ve("",!0)]))],2))}}),oR=Ct(rR,[["__scopeId","data-v-9df479e0"]]),aR={class:"content-header"},sR=["title"],iR={class:"content-actions"},lR=bn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(P(),B("header",aR,[w("div",{class:dt(["content-leading",{"is-accent":e.accent}])},[xr(t.$slots,"leading",{},void 0)],2),w("h1",{class:dt(["content-title",{"is-accent":e.accent}]),title:e.title},F(e.title),11,sR),w("div",iR,[xr(t.$slots,"actions",{},void 0)])]))}}),uR=Ct(lR,[["__scopeId","data-v-f28f4744"]]),qm=.0025,Fd=3,Wm=2,cR=256;function dR(e){var ge;const t=T("idle"),n=T(typeof navigator<"u"&&!!((ge=navigator.mediaDevices)!=null&&ge.getUserMedia)),r=T(0),o=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 ee=o.value;if(!ee||typeof window>"u")return;const me=ee.getContext("2d");if(!me)return;const re=Math.max(1,Math.floor(ee.clientWidth)),Ae=Math.max(1,Math.floor(ee.clientHeight||36)),De=window.devicePixelRatio||1,Ne=Math.max(1,Math.floor(re*De)),Le=Math.max(1,Math.floor(Ae*De));(ee.width!==Ne||ee.height!==Le)&&(ee.width=Ne,ee.height=Le),me.setTransform(De,0,0,De,0,0),me.clearRect(0,0,re,Ae);const xe=Math.max(12,Math.floor(re/(Fd+Wm))),Se=f.slice(-xe),Ce=Math.max(0,xe-Se.length),Ee=Ae/2,Je=getComputedStyle(ee).color||"#000000";for(let Xe=0;Xe<xe;Xe+=1){const it=Se[Xe-Ce]??0,N=Math.max(.08,Math.min(1,it*18))*Ee,oe=Xe*(Fd+Wm);me.globalAlpha=it<=qm?.35:1,me.fillStyle=Je,me.fillRect(oe,Ee-N,Fd,N*2)}me.globalAlpha=1}function D(){f=[],r.value=0,O()}function q(){d&&(d.disconnect(),d.onaudioprocess=null,d=null),c&&(c.disconnect(),c=null),l&&(l.close(),l=null),v=null}function M(ee){if(typeof window>"u")return;const me=window.webkitAudioContext,re=window.AudioContext??me;re&&(q(),D(),l=new re,c=l.createMediaStreamSource(ee),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 xe=Math.abs(De[Le]??0);Ne+=xe<qm?0:xe}f.push(Ne/De.length),f.length>cR&&f.shift(),v!==null&&(r.value=Math.max(0,performance.now()-v)),O()},c.connect(d),d.connect(l.destination),O())}async function pe(){var ee;if(t.value==="transcribing"&&U(),!(t.value!=="idle"||!n.value||y)){y=!0,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,re=(a==null?void 0:a.mimeType)||((Ae=me[0])==null?void 0:Ae.type)||"audio/webm";ye(),ie(me,re)},M(s),a.start(250),t.value="recording",S&&ue()}catch(me){ye(),t.value="idle",(ee=e.onError)==null||ee.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 K(){S=!1,U(),ye(),t.value="idle"}async function ie(ee,me){var De,Ne,Le,xe,Se;if(ee.length===0){(De=e.onEmpty)==null||De.call(e),t.value="idle";return}const re=new Blob(ee,{type:me});t.value="transcribing";let Ae=null;try{const Ce=me.split(/[/;]/)[1]??"webm",Ee=new FormData;Ee.append("file",re,`codex.${Ce}`);const Je=((Ne=e.getLanguage)==null?void 0:Ne.call(e).trim())??"";Je&&Je.toLowerCase()!=="auto"&&Ee.append("language",Je),Ae=new AbortController,I=Ae;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:Ee,signal:Ae.signal}),it=await Xe.text();let ce=null;try{ce=it.trim()?JSON.parse(it):null}catch{ce=null}if(!Xe.ok){const oe=(Le=ce==null?void 0:ce.error)==null?void 0:Le.trim(),se=it.trim();throw new Error(oe||se||`Transcription failed: ${Xe.status}`)}const N=((ce==null?void 0:ce.text)??"").trim();N.length>0?e.onTranscript(N):(xe=e.onEmpty)==null||xe.call(e)}catch(Ce){if(Ce instanceof DOMException&&Ce.name==="AbortError")return;(Se=e.onError)==null||Se.call(e,Ce)}finally{Ae&&I===Ae&&(I=null),t.value==="transcribing"&&(t.value="idle")}}function ye(){q(),D(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(ee=>ee.stop()),s=null),i=[]}Os(()=>{K()});function Pe(){if(t.value==="recording"){ue();return}(t.value==="idle"||t.value==="transcribing")&&pe()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:pe,stopRecording:ue,toggleRecording:Pe,cancel:K}}const fR={},pR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function hR(e,t){return P(),B("svg",pR,[...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 mR=Ct(fR,[["render",hR]]),vR={},gR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function yR(e,t){return P(),B("svg",gR,[...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 wR=Ct(vR,[["render",yR]]),bR={},TR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function SR(e,t){return P(),B("svg",TR,[...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 CR=Ct(bR,[["render",SR]]),xR={},kR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function IR(e,t){return P(),B("svg",kR,[...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 AR=Ct(xR,[["render",IR]]),_R=["aria-label"],PR=8,pi=8,ER=bn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const r=e,o=n,a=T(null),s=T(null),i=T({});let l=!1;const c=Y(()=>r.open),d=Y(()=>r.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function v(O,D,q){return Math.min(Math.max(D,O),q)}function f(){var Pe,ge;if(!c.value)return;const O=a.value;if(!O||typeof window>"u")return;const D=O.getBoundingClientRect(),q=window.innerWidth,M=window.innerHeight,pe=Math.max(0,q-pi*2),ue=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,pe),K=((ge=s.value)==null?void 0:ge.offsetHeight)??0;let ie;r.align==="end"?ie=D.right-ue:r.align==="center"?ie=D.left+(D.width-ue)/2:ie=D.left,ie=v(ie,pi,Math.max(pi,q-ue-pi));let ye=D.top-K-PR;ye=v(ye,pi,Math.max(pi,M-K-pi)),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)}ot(c,O=>{if(!O){S(),i.value={};return}y(),Nt(()=>{var D;(D=s.value)==null||D.focus(),f(),window.requestAnimationFrame(f)})}),Os(()=>{S()});function I(){o("update:open",!r.open)}function U(O){var K,ie,ye;if(O.key==="Escape"){o("update:open",!1);return}const D=s.value;if(!D)return;const q=Array.from(D.querySelectorAll("button")).filter(Pe=>!Pe.disabled&&Pe.offsetParent!==null);if(q.length===0)return;if(O.key==="Home"){O.preventDefault(),(K=q[0])==null||K.focus();return}if(O.key==="End"){O.preventDefault(),(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,D)=>(P(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[xr(O.$slots,"trigger",{toggle:I,isOpen:c.value},void 0),Fe(lu,{name:"composer-popover"},{default:pt(()=>[c.value?(P(),B("div",{key:0,ref_key:"panelRef",ref:s,class:dt(["composer-popover-panel",[d.value,e.panelClass]]),style:Jr(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:U},[xr(O.$slots,"default",{},void 0,!0)],46,_R)):ve("",!0)]),_:3})],512))}}),lc=Ct(ER,[["__scopeId","data-v-edf1513b"]]),RR=["aria-label"],MR={class:"composer-popover-group-label"},jR=["aria-selected","onMousedown"],LR={class:"thread-composer-slash-body"},NR={class:"thread-composer-slash-name"},OR={class:"thread-composer-slash-desc"},$R={class:"thread-composer-slash-kind"},DR={class:"composer-popover-group-label composer-popover-group-label--skills"},FR=["aria-selected","onMousedown"],BR=["aria-label","title"],UR={class:"thread-composer-slash-body thread-composer-slash-body--skill"},zR={class:"thread-composer-slash-skill-name"},HR={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},qR=bn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,{t:o}=wa(),a=T(null),s=Y(()=>n.commands.filter(v=>v.group!=="skill")),i=Y(()=>n.commands.filter(v=>v.group==="skill"));ot(()=>n.highlightedIndex,async()=>{var v,f;await Nt(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return o(v==="rpc"?"Action":v==="text"?"Prompt":v==="skill"?"Skill":"Local")}function c(v){return v==="system"?"S":v==="repo"?"R":v==="plugin"?"P":"U"}function d(v){return o(v==="system"?"System":v==="repo"?"Repo":v==="plugin"?"Plugin":"User")}return(v,f)=>(P(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":m(o)("Commands")},[s.value.length>0?(P(),B(ct,{key:0},[w("div",MR,F(m(o)("Commands")),1),(P(!0),B(ct,null,rn(s.value,(y,S)=>(P(),B("button",{key:y.id,class:dt(["thread-composer-slash-row",{"is-active":S===e.highlightedIndex}]),type:"button",role:"option","aria-selected":S===e.highlightedIndex,onMousedown:vt(I=>r("select",y),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",LR,[w("span",NR,F(y.id),1),w("span",OR,F(m(o)(y.description)),1)]),w("span",$R,F(l(y.kind)),1)],42,jR))),128))],64)):ve("",!0),i.value.length>0?(P(),B(ct,{key:1},[w("div",DR,F(m(o)("Skills")),1),(P(!0),B(ct,null,rn(i.value,(y,S)=>(P(),B("button",{key:y.skillPath||y.id,class:dt(["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:vt(I=>r("select",y),["prevent"])},[w("span",{class:dt(["thread-composer-slash-skill-icon",`is-${y.scope||"user"}`]),"aria-label":d(y.scope),title:d(y.scope)},F(c(y.scope)),11,BR),w("span",UR,[w("span",zR,F(y.displayName||y.id),1),w("span",HR,F(y.description),1)])],42,FR))),128))],64)):ve("",!0)],8,RR))}}),WR=Ct(qR,[["__scopeId","data-v-9d28a35b"]]),GR=["data-streaming"],VR=["aria-expanded"],KR={class:"thread-composer-plan-panel-title"},YR={key:0,class:"thread-composer-plan-panel-badge"},JR={class:"thread-composer-plan-panel-progress"},QR=["title"],XR=["data-status"],ZR={class:"thread-composer-plan-panel-latest-text"},eM={class:"thread-composer-plan-panel-popover-content"},tM={class:"thread-composer-plan-panel-popover-scroll"},nM={class:"thread-composer-plan-panel-popover-head"},rM={class:"thread-composer-plan-panel-title"},oM={class:"thread-composer-plan-panel-progress"},aM={key:0,class:"thread-composer-plan-panel-popover-section"},sM={class:"thread-composer-plan-panel-section-label"},iM=["title"],lM={class:"thread-composer-plan-panel-popover-section"},uM={class:"thread-composer-plan-panel-section-label"},cM={class:"thread-composer-plan-panel-steps"},dM=["data-status"],fM=["data-status"],pM=["title"],hM={class:"thread-composer-plan-panel-popover-footer"},mM=["disabled","data-state"],vM=bn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,r=t,{t:o}=wa(),a=T(!1),s=Y(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(y=>y.status==="completed").length}),i=Y(()=>{var f;const v=((f=n.planPanel)==null?void 0:f.steps)??[];if(v.length===0)return null;for(let y=v.length-1;y>=0;y-=1){const S=v[y];if(S.status==="inProgress")return S}return v[v.length-1]}),l=Y(()=>{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,r("implement-plan")}return(v,f)=>(P(),B("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Fe(lc,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":m(o)("Plan"),"onUpdate:open":f[1]||(f[1]=y=>a.value=y)},{trigger:pt(()=>{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",KR,F(m(o)("Plan")),1),e.planPanel.streaming?(P(),B("span",YR,F(m(o)("Updating")),1)):ve("",!0),w("span",JR,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,XR)):ve("",!0),w("span",ZR,F(((S=i.value)==null?void 0:S.step)??""),1)],8,QR),Fe(Ms,{class:"thread-composer-plan-panel-chevron"})],8,VR)]}),default:pt(()=>[w("div",eM,[w("div",tM,[w("header",nM,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",rM,F(m(o)("Plan")),1),w("span",oM,F(s.value)+"/"+F(e.planPanel.steps.length),1)]),e.planPanel.explanation?(P(),B("section",aM,[w("p",sM,F(m(o)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},F(l.value),9,iM)])):ve("",!0),w("section",lM,[w("p",uM,F(m(o)("Steps"))+" ("+F(e.planPanel.steps.length)+")",1),w("ol",cM,[(P(!0),B(ct,null,rn(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,fM),w("span",{class:"thread-composer-plan-panel-step-text",title:y.step},F(y.step),9,pM)],8,dM))),128))])])]),w("footer",hM,[w("button",{type:"button",class:"thread-composer-plan-panel-implement",disabled:e.planPanel.streaming||e.planPanel.implemented,"data-state":e.planPanel.implemented?"done":e.planPanel.streaming?"running":"idle",onClick:d},F(e.planPanel.implemented?m(o)("Plan executed"):e.planPanel.streaming?m(o)("Implementing…"):m(o)("Implement plan")),9,mM)])])]),_:1},8,["open","aria-label"])],8,GR))}}),gM=Ct(vM,[["__scopeId","data-v-970a9351"]]),yM={key:0,class:"thread-composer-attachments"},wM=["src"],bM=["src","alt"],TM=["aria-label","disabled","onClick"],SM={key:1,class:"thread-composer-folder-chips"},CM=["title"],xM={class:"thread-composer-folder-chip-meta"},kM=["aria-label","disabled","onClick"],IM={key:2,class:"thread-composer-file-chips"},AM=["title"],_M=["aria-label","disabled","onClick"],PM={key:3,class:"thread-composer-skill-chips"},EM=["title","aria-label","onClick"],RM=["aria-label","onClick"],MM=bn({__name:"ThreadComposerAttachments",props:{selectedImages:{},folderUploadGroups:{},standaloneFileAttachments:{},selectedSkills:{},isInteractionDisabled:{type:Boolean}},emits:["remove-image","remove-folder","remove-file","remove-skill"],setup(e,{emit:t}){const n=t,r=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function o(l){const c=l.trim();return c?!!(/^video\/|^data:video\//i.test(c)||r.test(c)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const c=l.trim();return c?c.endsWith("/SKILL.md")?c:`${c.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const c=s(l.path);!c||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(c)}`,"_blank","noopener,noreferrer")}return(l,c)=>(P(),B(ct,null,[e.selectedImages.length>0?(P(),B("div",yM,[(P(!0),B(ct,null,rn(e.selectedImages,d=>(P(),B("div",{key:d.id,class:"thread-composer-attachment"},[o(d.url)?(P(),B("video",{key:0,class:"thread-composer-attachment-image",src:d.url,controls:"",preload:"metadata"},null,8,wM)):(P(),B("img",{key:1,class:"thread-composer-attachment-image",src:d.url,alt:d.name||"Selected image"},null,8,bM)),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,TM)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(P(),B("div",SM,[(P(!0),B(ct,null,rn(e.folderUploadGroups,d=>(P(),B("span",{key:d.id,class:"thread-composer-folder-chip"},[Fe(ip,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:d.name},F(d.name),9,CM),w("span",xM,[d.isUploading?(P(),B(ct,{key:0},[Ps(F(a(d))+"% uploading ("+F(d.processed)+"/"+F(d.total)+") ",1)],64)):(P(),B(ct,{key:1},[Ps(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,kM)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(P(),B("div",IM,[(P(!0),B(ct,null,rn(e.standaloneFileAttachments,d=>(P(),B("span",{key:d.fsPath,class:"thread-composer-file-chip"},[Fe(dl,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:d.fsPath},F(d.label),9,AM),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,_M)]))),128))])):ve("",!0),e.selectedSkills.length>0?(P(),B("div",PM,[(P(!0),B(ct,null,rn(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,EM),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,RM)]))),128))])):ve("",!0)],64))}}),jM=Ct(MM,[["__scopeId","data-v-7f9996e5"]]),LM=bn({__name:"ThreadComposerModelControls",props:{models:{},selectedModel:{},modelReasoningEfforts:{},selectedReasoningEffort:{},selectedSpeedMode:{},disabled:{type:Boolean},activeThreadId:{}},emits:["update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,{t:o}=wa(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=Y(()=>{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=Y(()=>n.models.map(S=>({value:S,label:i(S)}))),c=Y(()=>n.disabled||!n.activeThreadId),d=Y(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=Y(()=>n.selectedSpeedMode==="fast"&&d.value);function f(S){r("update:selected-model",S)}function y(S){r("update:selected-reasoning-effort",S)}return(S,I)=>(P(),B(ct,null,[Fe(Ci,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?Pc:null,placeholder:m(o)("Model"),"open-direction":"up",variant:"pill",disabled:c.value||e.models.length===0,"enable-search":"","search-placeholder":m(o)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Fe(Ci,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:m(o)("Thinking"),"open-direction":"up",variant:"pill",disabled:c.value||s.value.length===0,"onUpdate:modelValue":y},null,8,["model-value","options","placeholder","disabled"])],64))}}),NM=Ct(LM,[["__scopeId","data-v-245f3391"]]),OM=["aria-label","disabled"],$M=["disabled"],DM=["disabled"],FM=["disabled"],BM={class:"thread-composer-attach-mode"},UM={class:"thread-composer-attach-mode-label"},zM={class:"thread-composer-attach-mode-buttons"},HM=["disabled"],qM=["disabled"],WM={class:"thread-composer-attach-mode"},GM={class:"thread-composer-attach-mode-label"},VM={class:"thread-composer-attach-mode-buttons"},KM=["disabled","onClick"],YM={class:"thread-composer-attach-mode"},JM={class:"thread-composer-attach-mode-label"},QM={class:"thread-composer-attach-mode-buttons"},XM=["disabled","onClick"],ZM={key:0,class:"thread-composer-menu-error",role:"alert"},e1={key:0,class:"thread-composer-approval-tip",role:"status"},t1=bn({__name:"ThreadComposerAttachMenu",props:{open:{type:Boolean},isMobile:{type:Boolean},isInteractionDisabled:{type:Boolean},isComposerConfigDisabled:{type:Boolean},isApprovalPolicySaving:{type:Boolean},approvalPolicy:{},approvalPolicyError:{},approvalPolicyNotice:{},selectedCollaborationMode:{},collaborationModeChoices:{},approvalPolicyChoices:{},activeInProgressMode:{}},emits:["update:open","toggle","set-active-mode","select-photo","select-folder","capture-camera","select-collaboration-mode","select-approval-policy"],setup(e,{emit:t}){const n=t,{t:r}=wa();function o(){n("toggle")}function a(v){n("set-active-mode",v)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function c(v){n("select-collaboration-mode",v)}function d(v){n("select-approval-policy",v)}return(v,f)=>(P(),et(lc,{open:e.open,align:"start",width:"lg","aria-label":m(r)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=y=>n("update:open",y))},{trigger:pt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":m(r)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:o}," + ",8,OM)]),default:pt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},F(m(r)("Add photos & files")),9,$M),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},F(m(r)("Add folder")),9,DM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},F(m(r)("Take photo")),9,FM),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",BM,[w("span",UM,F(m(r)("In-progress send")),1),w("div",zM,[w("button",{class:dt(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=y=>a("steer"))},F(m(r)("Steer")),11,HM),w("button",{class:dt(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=y=>a("queue"))},F(m(r)("Queue")),11,qM)])]),e.isMobile?(P(),B(ct,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",WM,[w("span",GM,F(m(r)("Plan mode")),1),w("div",VM,[(P(!0),B(ct,null,rn(e.collaborationModeChoices,y=>(P(),B("button",{key:`mobile-plan-${y.value}`,class:dt(["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(r)(y.labelKey)),11,KM))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",YM,[w("span",JM,F(m(r)("Approval policy")),1),w("div",QM,[(P(!0),B(ct,null,rn(e.approvalPolicyChoices,y=>(P(),B("button",{key:`mobile-approval-${y.value}`,class:dt(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===y.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:S=>d(y.value)},F(m(r)(y.label)),11,XM))),128))])]),e.approvalPolicyError?(P(),B("p",ZM,F(e.approvalPolicyError),1)):ve("",!0),Fe(lu,{name:"approval-tip"},{default:pt(()=>[e.approvalPolicyNotice?(P(),B("span",e1,F(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),n1=Ct(t1,[["__scopeId","data-v-31ce3b29"]]),r1=/(^|\s)(\/[a-zA-Z]*)$/,Gm=[{id:"compact",description:"Compact the current thread context",kind:"rpc",group:"builtin"},{id:"review",description:"Open the code review pane",kind:"rpc",group:"builtin"},{id:"rename",description:"Rename the current thread",kind:"rpc",group:"builtin"},{id:"archive",description:"Archive the current thread",kind:"rpc",group:"builtin"},{id:"fork",description:"Fork the current thread",kind:"rpc",group:"builtin"},{id:"new",description:"Start a new thread",kind:"rpc",group:"builtin"},{id:"skills",description:"Open the skills page",kind:"rpc",group:"builtin"},{id:"init",description:"Generate or update AGENTS.md",kind:"text",group:"builtin",insertText:"Create or update the AGENTS.md file for this project: include an overview, architecture notes, development conventions, and a workflow guide based on the codebase."},{id:"help",description:"Show help about Codex",kind:"text",group:"builtin",insertText:"How do I use Codex? Point me to the official documentation and explain the available commands."},{id:"mention",description:"Mention files with @",kind:"text",group:"builtin",insertText:"Please review the files I mention with @, starting with: "},{id:"diff",description:"Show the current git diff",kind:"text",group:"builtin",insertText:"Show the current git diff of this project and summarize the changes."},{id:"clear",description:"Clear the input",kind:"local",group:"builtin"}];function o1(e){var r,o,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((r=s.description)==null?void 0:r.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((o=s.displayName)==null?void 0:o.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function a1(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 s1(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=e.filter(o=>o.id===n);return r.length>0?r:e.filter(o=>o.id.startsWith(n))}const i1={class:"thread-composer-main"},l1={class:"thread-composer-input-row"},u1={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},c1={class:"thread-composer-drop-overlay-copy"},d1={key:1,class:"composer-popover"},f1=["onMousedown"],p1={key:1,class:"thread-composer-file-mention-icon-markdown"},h1={class:"thread-composer-file-mention-text"},m1={class:"thread-composer-file-mention-name"},v1={key:0,class:"thread-composer-file-mention-dir"},g1={key:1,class:"thread-composer-file-mention-empty"},y1={key:2,class:"thread-composer-file-mention-empty"},w1=["placeholder","disabled"],b1=["aria-label","title","disabled"],T1={class:"thread-composer-actions"},S1=["aria-label","title","disabled"],C1={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},x1=["aria-label","title","disabled"],k1={key:0,class:"thread-composer-secondary"},I1=["aria-label","disabled"],A1={class:"thread-composer-plan-trigger-label"},_1=["aria-checked","disabled","onClick"],P1={class:"thread-composer-menu-item-copy"},E1={class:"thread-composer-menu-item-title"},R1={key:0,class:"thread-composer-menu-item-sub"},M1={key:1,class:"thread-composer-menu-item-hint"},j1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},L1=["aria-label","disabled"],N1={class:"thread-composer-approval-trigger-label"},O1=["aria-checked","disabled","onClick"],$1={class:"thread-composer-menu-item-copy"},D1={class:"thread-composer-menu-item-title"},F1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},B1={key:0,class:"thread-composer-menu-error",role:"alert"},U1={key:0,class:"thread-composer-approval-tip",role:"status"},z1=["title","aria-label"],H1={class:"thread-composer-context-usage-value"},q1={key:0,class:"thread-composer-context-usage-compact"},W1=["disabled"],G1=["disabled"],V1=["disabled"],Bd=12e3,K1=2e3,Y1="codex-web-local.thread-draft.v1.",J1=bn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},fuzzyFileSearchResults:{},collaborationModes:{},selectedCollaborationMode:{},models:{},modelReasoningEfforts:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isCompacting:{type:Boolean},externalSessionActive:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},approvalPolicy:{},isApprovalPolicySaving:{type:Boolean},approvalPolicyError:{},approvalPolicyNotice:{},planPanel:{}},emits:["submit","interrupt","register-fuzzy-session","slash-command","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode","update:approval-policy","save-approval-policy","implement-plan","compact-context"],setup(e,{expose:t,emit:n}){const r=e,o=n,{t:a}=wa(),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}=dR({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:k=>{if(s.value=s.value?`${s.value}
59
- ${k}`:k,v.value="",r.dictationAutoSend!==!1){const j=r.isTurnInProgress?$e.value:"steer";Yt(j);return}Nt(()=>{var j;return(j=M.value)==null?void 0:j.focus()})},onEmpty:()=>{v.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:k=>{if(k instanceof DOMException&&k.name==="NotAllowedError"){v.value="Microphone access was denied.";return}v.value=k instanceof Error?k.message:"Dictation failed."}}),O=T(null),D=T(null),q=T(null),M=T(null),{isMobile:pe}=Zf(),ue=T(!1),K=T(!1),ie=T(!1),ye=T(null),Pe=T(""),ge=T([]),ee=T(!1),me=T(0),re=T(!1),Ae=T(null),De=T(""),Ne=T(0),Le=T(Gm),xe=Y(()=>[...Gm,...o1(r.skills??[])]),Se=T(!1),Ce=T(!1);let Ee=!1;const Je=T(0);let Xe=0,it=null,ce="",N=!1,oe=0,se=0;const je=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let qe="";const A=Y(()=>{const k=new Set((r.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=Y(()=>{const k=A.value.find(j=>j.value===r.selectedCollaborationMode);return a(k?k.labelKey:"Plan mode")}),le=Y(()=>{const k=R.find(j=>j.value===r.approvalPolicy);return a(k?k.label:"Approval policy")}),ne=Y(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),ae=Y(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||ne.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||c.value.length>0),_e=Y(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||c.value.length>0||d.value.length>0),Oe=Y(()=>{const k=new Set;for(const j of d.value)for(const V of j.filePaths)k.add(V);return c.value.filter(j=>!k.has(j.fsPath))}),ke=Y(()=>r.disabled||!r.activeThreadId||r.externalSessionActive===!0),he=Y(()=>r.disabled||!r.activeThreadId),Ke=Y(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),$e=T(Ke.value),We=Y(()=>I.value==="recording"),Ge=Y(()=>r.activeThreadId?ne.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),ft=Y(()=>s.value.trim().length>0||i.value.length>0||c.value.length>0),bt=Y(()=>s.value.split(`
60
- `).length),nt=Y(()=>Se.value||bt.value>=6||Ce.value),lt=Y(()=>Oo(r.threadTokenUsage??null)),J=Y(()=>{var k;return((k=lt.value)==null?void 0:k.summaryText)??""}),de=Y(()=>{var k;return((k=lt.value)==null?void 0:k.tooltipText)??""}),Te=Y(()=>{var k;return((k=lt.value)==null?void 0:k.tone)??"healthy"});function Ue(){Te.value!=="healthy"&&o("compact-context")}function Tt(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 gt(k){const j=Math.max(0,k.inputTokens-k.cachedInputTokens),V=[`${Tt(k.totalTokens)} ${a("total")}`,`${Tt(j)} ${a("input")}`];return k.cachedInputTokens>0&&V.push(`${Tt(k.cachedInputTokens)} ${a("cached")}`),k.outputTokens>0&&V.push(`${Tt(k.outputTokens)} ${a("output")}`),k.reasoningOutputTokens>0&&V.push(`${Tt(k.reasoningOutputTokens)} ${a("reasoning")}`),V.join(" · ")}function Lt(k,j){if(!Number.isFinite(k)||!Number.isFinite(j)||j<=0)return 0;if(j<=Bd){const $t=Math.max(0,j-Math.max(0,k));return Math.max(0,Math.min(100,Math.round($t/j*100)))}const V=j-Bd,be=Math.max(0,k-Bd),He=Math.max(0,V-be);return Math.max(0,Math.min(100,Math.round(He/V*100)))}function Oo(k){if(!k)return null;const j=k.modelContextWindow??null;if(typeof j!="number"||!Number.isFinite(j)||j<=0)return null;const V=Math.max(0,k.last.totalTokens),be=Lt(V,j),He=Math.max(0,Math.min(100,100-be)),$t=be<=15?"danger":be<=35?"warning":"healthy";return{summaryText:`${be}% · ${Tt(V)} / ${Tt(j)}`,tooltipText:[`${a("Context window")}: ${be}% ${a("left")} (${He}% ${a("used")})`,`${a("In context")}: ${V.toLocaleString()} / ${j.toLocaleString()} tokens`,`${a("Last turn")}: ${gt(k.last)}`,`${a("Session total")}: ${gt(k.total)}`].join(`
61
- `),percentRemaining:be,tone:$t}}function Yt(k="steer"){var V;const j=s.value.trim();if(ae.value){if(o("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}),Xa(r.activeThreadId),ba(),Se.value=!1,d.value=[],ue.value=!1,cn(),je||pe.value){(V=M.value)==null||V.blur();return}Nt(()=>{var be;return(be=M.value)==null?void 0:be.focus()})}}function no(k){$e.value=k}function rr(k){Je.value+=1,s.value=k.text,i.value=k.imageUrls.map((j,V)=>({id:`queued-${Date.now()}-${V}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${V+1}`,url:j})),l.value=k.skills.map(j=>(r.skills??[]).find(V=>V.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,cn(),xn(),se+=1}function ba(){rr({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Se.value=!1}function ro(k){return`${Y1}${k}`}function $s(k){if(typeof window>"u")return null;const j=k.trim();if(!j)return null;try{const V=window.localStorage.getItem(ro(j));if(!V)return null;const be=JSON.parse(V);return typeof be=="string"?{text:be,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof be.text=="string"?be.text:"",imageUrls:Array.isArray(be.imageUrls)?be.imageUrls.filter(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 Ta(k,j){if(typeof window>"u")return;const V=k.trim();if(V)try{if(j.text.trim().length>0||j.imageUrls.length>0||j.fileAttachments.length>0||j.skills.length>0){window.localStorage.setItem(ro(V),JSON.stringify(j));return}window.localStorage.removeItem(ro(V))}catch{}}function Xa(k){Ta(k,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function $r(){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 Za(){o("interrupt")}function Dr(){const k=M.value;if(!k){Ce.value=!1;return}Ce.value=k.scrollHeight>k.clientHeight+2}function $o(){Ee||(Ee=!0,Nt(()=>{Ee=!1,Dr()}))}function Do(){ke.value||(Se.value=!Se.value,$o(),Nt(()=>{var k;return(k=M.value)==null?void 0:k.focus()}))}function Ds(k){o("update:selected-model",k)}function Fo(k){if(k===r.selectedCollaborationMode){K.value=!1;return}o("update:selected-collaboration-mode",k),K.value=!1}function Fr(k){if(k===r.selectedCollaborationMode){ue.value=!1;return}o("update:selected-collaboration-mode",k),ue.value=!1}function es(k){o("update:selected-reasoning-effort",k)}function Sa(k){r.approvalPolicy===k||r.isApprovalPolicySaving===!0||(o("update:approval-policy",k),o("save-approval-policy"))}function Bo(){r.dictationClickToToggle}function oo(){ke.value||(ue.value=!ue.value,K.value=!1,ie.value=!1)}function ao(){he.value||(K.value=!K.value,ue.value=!1,ie.value=!1)}function kr(){he.value||(ie.value=!ie.value,ue.value=!1,K.value=!1)}function ts(){var k;(k=O.value)==null||k.click()}function ns(){var k;(k=D.value)==null||k.click()}function mt(){var k;(k=q.value)==null||k.click()}function xt(k){const j=i.value.find(V=>V.id===k);if(j&&ln(j.url)){const V=or(j.url);V&&dn(V)}i.value=i.value.filter(V=>V.id!==k)}function It(k){l.value=l.value.filter(j=>j.path!==k)}function dn(k){c.value=c.value.filter(j=>j.fsPath!==k)}function zn(k){const j=d.value.find(be=>be.id===k);if(!j)return;const V=new Set(j.filePaths);c.value=c.value.filter(be=>!V.has(be.fsPath)),d.value=d.value.filter(be=>be.id!==k)}function sn(k,j){const V=k.replace(/\\/g,"/");if(c.value.some($t=>$t.fsPath===V))return;const be=V.split("/").filter(Boolean),He=(j==null?void 0:j.trim())||be[be.length-1]||V;c.value=[...c.value,{label:He,path:V,fsPath:V}]}function Ir(k){return k.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(k.name)}const hr=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Uo(k){return k.type.startsWith("video/")?!0:hr.test(k.name)}function ln(k){const j=k.trim();if(!j)return!1;if(j.startsWith("data:video/"))return!0;try{const V=new URL(j,window.location.href);return hr.test(V.pathname)?!0:V.pathname==="/codex-local-image"?hr.test(V.searchParams.get("path")??""):!1}catch{return hr.test(j)}}function or(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 Ar(k){return k?Array.from(k):[]}function Pt(k){return k!==se?!1:(f.value+=1,!0)}function so(k){k===se&&(f.value=Math.max(0,f.value-1))}function ar(k){if(k<=0)return;const j=y.value,V=j?j.succeeded+j.failed:0;if(!j||V>=j.total){y.value={total:k,succeeded:0,failed:0};return}y.value={...j,total:j.total+k}}function Tn(k){const j=y.value;j&&(y.value={...j,succeeded:j.succeeded+(k==="success"?1:0),failed:j.failed+(k==="failure"?1:0)})}function Br(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ln(k){const j=new Date,V=[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-${V}.${be}`}function Pn(){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 Sn(k){return k.name.trim()?k:new File([k],Ln(k),{type:k.type||"image/png",lastModified:Date.now()})}async function Ca(k,j){if(Pt(j))try{const V=Sn(k),be=await Eu(V);if(j!==se)return;if(!be){Tn("failure");return}i.value=[...i.value,{id:Br(),name:V.name,url:`/codex-local-image?path=${encodeURIComponent(be)}`}],Tn("success")}catch{j===se&&Tn("failure")}finally{so(j)}}async function mr(k,j){if(Pt(j))try{const V=await Eu(k);if(j!==se)return;if(!V){Tn("failure");return}sn(V),Tn("success")}catch{j===se&&Tn("failure")}finally{so(j)}}async function Ur(k,j){if(Pt(j))try{const V=Sn(k),be=await Eu(V);if(j!==se)return;if(!be){Tn("failure");return}const He=be.replace(/\\/g,"/");i.value=[...i.value,{id:Br(),name:V.name,url:`/codex-local-image?path=${encodeURIComponent(He)}`}],sn(He),Tn("success")}catch{j===se&&Tn("failure")}finally{so(j)}}function Ot(k){const j=Ar(k);if(j.length===0)return;ar(j.length),ue.value=!1,cn();const V=se;for(const be of j)Ir(be)?Ca(be,V):Uo(be)?Ur(be,V):mr(be,V)}function io(){oe=0,S.value=!1}function zo(k){return k?Array.from(k.types??[]).includes("Files"):!1}async function Ho(k){if(!k||k.length===0)return;const j=Je.value,V=Array.from(k),He=(V[0].webkitRelativePath||V[0].name).split("/").filter(Boolean)[0]||"Folder",$t=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:$t,name:He,total:V.length,processed:0,filePaths:[],isUploading:!0}];const _t=Xt=>{j===Je.value&&(d.value=d.value.map(qt=>qt.id===$t?Xt(qt):qt))};for(const Xt of V)try{const qt=await Eu(Xt);if(j!==Je.value)return;if(qt){const zr=Xt.webkitRelativePath||Xt.name;sn(qt,zr),_t(Ko=>({...Ko,processed:Ko.processed+1,filePaths:[...Ko.filePaths,qt]}));continue}_t(zr=>({...zr,processed:zr.processed+1}))}catch{_t(qt=>({...qt,processed:qt.processed+1}))}_t(Xt=>({...Xt,isUploading:!1}))}function Cn(k){k&&(k.value="")}function Gt(k){const j=k.target;Ot((j==null?void 0:j.files)??null),Cn(j),ue.value=!1}function vr(k){const j=k.target;Ot((j==null?void 0:j.files)??null),Cn(j),ue.value=!1}function un(k){const j=k.target;Ho((j==null?void 0:j.files)??null),Cn(j),ue.value=!1}function qo(k){ke.value||!zo(k.dataTransfer)||(k.preventDefault(),oe+=1,S.value=!0)}function Jt(k){ke.value||!zo(k.dataTransfer)||(k.preventDefault(),k.dataTransfer&&(k.dataTransfer.dropEffect="copy"),S.value=!0)}function lo(k){S.value&&(k.preventDefault(),oe=Math.max(0,oe-1),oe===0&&io())}function Hn(k){var j;ke.value||!zo(k.dataTransfer)||(k.preventDefault(),io(),Ot(((j=k.dataTransfer)==null?void 0:j.files)??null))}function fn(){!S.value&&oe===0||io()}function xa(k){var $t,_t;if(ke.value)return;const j=(($t=k.clipboardData)==null?void 0:$t.getData("text/plain"))??"";if(j.length>=K1){k.preventDefault();const Xt=new File([j],Pn(),{type:"text/plain",lastModified:Date.now()});Ot([Xt]);return}const V=Array.from(((_t=k.clipboardData)==null?void 0:_t.items)??[]);if(V.length===0)return;const be=j.length>0,He=V.filter(Xt=>Xt.kind==="file"&&Xt.type.startsWith("image/")).map(Xt=>Xt.getAsFile()).filter(Xt=>Xt instanceof File);He.length!==0&&(be||k.preventDefault(),Ot(He))}function pn(){v.value&&(v.value=""),$o(),rs(),Fs()}function Qt(k){if(k.isComposing||k.keyCode===229)return;if(ee.value){if(k.key==="Escape"){k.preventDefault(),cn();return}if(k.key==="ArrowDown"){k.preventDefault(),ge.value.length>0&&(me.value=(me.value+1)%ge.value.length);return}if(k.key==="ArrowUp"){if(k.preventDefault(),ge.value.length>0){const V=ge.value.length;me.value=(me.value+V-1)%V}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const V=ge.value[me.value];V?Wo(V):cn();return}}if(re.value){if(k.key==="Escape"){k.preventDefault(),xn();return}if(k.key==="ArrowDown"){k.preventDefault(),Le.value.length>0&&(Ne.value=(Ne.value+1)%Le.value.length);return}if(k.key==="ArrowUp"){if(k.preventDefault(),Le.value.length>0){const V=Le.value.length;Ne.value=(Ne.value+V-1)%V}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const V=Le.value[Ne.value];V?uo(V):xn();return}}if(r.sendWithEnter!==!1?k.key==="Enter"&&!k.shiftKey:k.key==="Enter"&&(k.metaKey||k.ctrlKey)){k.preventDefault(),Yt(r.isTurnInProgress?$e.value:"steer");return}}function cn(){if(ee.value=!1,ye.value=null,Pe.value="",ge.value=[],me.value=0,N=!1,ce){const k=ce;ce="",Xx(k)}}function rs(){const k=M.value;if(!k){cn();return}const j=k.selectionStart??s.value.length,be=s.value.slice(0,j).match(/(^|\s)(@[^\s@]*)$/);if(!be){cn();return}const He=be[2]??"",$t=He.length,_t=j-$t;re.value&&xn(),ye.value=_t,Pe.value=He.slice(1),ee.value=!0,co()}function xn(){re.value=!1,Ae.value=null,De.value="",Ne.value=0,Le.value=xe.value}function Fs(){const k=M.value;if(!k){xn();return}const j=k.selectionStart??s.value.length,V=s.value.slice(0,j),be=a1(V);if(!be){xn();return}ee.value&&cn(),Ae.value=be.startIndex,De.value=be.query,Le.value=s1(xe.value,be.query),Ne.value=0,re.value=!0}function uo(k){const j=M.value,V=Ae.value;if(V!==null&&j){const be=j.selectionStart??s.value.length;s.value=`${s.value.slice(0,V)}${s.value.slice(be)}`}if(xn(),k.kind==="skill"){const be=(r.skills??[]).find($t=>$t.path===k.skillPath||$t.name===k.id);be&&!l.value.some($t=>$t.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.`,Nt(()=>{j==null||j.focus(),Dr()});return}if(k.kind==="rpc"){o("slash-command",k.id);return}k.kind==="text"&&k.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${k.insertText}`:k.insertText),k.kind==="local"&&k.id==="clear"&&(s.value=""),Nt(()=>{j==null||j.focus(),Dr()})}async function co(){if(!ee.value)return;const k=(r.cwd??"").trim();if(!k){ge.value=[],N=!0;return}N=!1,it&&clearTimeout(it);const j=++Xe;it=setTimeout(async()=>{const V=`composer-${j}`,be=Pe.value;try{if(ce||(await Jx([k],V),ce=V,o("register-fuzzy-session",V)),await Qx(ce,be),!ee.value||j!==Xe)return;if(ge.value=(r.fuzzyFileSearchResults??[]).map(He=>({path:He.path})),me.value=0,ge.value.length===0)try{const He=await lm(k,be,20);if(!ee.value||j!==Xe)return;ge.value=He,me.value=0}catch{if(!ee.value||j!==Xe)return;ge.value=[]}}catch{if(!ee.value||j!==Xe)return;ce="";try{const He=await lm(k,be,20);if(!ee.value||j!==Xe)return;ge.value=He,me.value=0}catch{if(!ee.value||j!==Xe)return;ge.value=[]}}},120)}function Wo(k){const j=M.value,V=ye.value;if(V!==null&&j){const be=j.selectionStart??s.value.length;s.value=`${s.value.slice(0,V)}${s.value.slice(be)}`.trimEnd()}sn(k.path),cn(),Nt(()=>j==null?void 0:j.focus())}function qn(k){U(),rr(k),Nt(()=>{var j;(j=M.value)==null||j.focus(),Dr()})}function Go(k){const j=k.trim();j&&(s.value=s.value.trim()?`${s.value.trim()}
62
- ${j}`:j,Nt(()=>{var V;(V=M.value)==null||V.focus(),Dr()}))}function Vo(k){const j=k.lastIndexOf("/");return j<0?k:k.slice(j+1)}function sr(k){const j=k.lastIndexOf("/");return j<=0?"":k.slice(0,j)}function yt(k){const j=Vo(k),V=j.lastIndexOf(".");return V<=0?"":j.slice(V+1).toLowerCase()}function hn(k){const j=yt(k);return j==="ts"?"TS":j==="tsx"?"TSX":j==="js"?"JS":j==="jsx"?"JSX":j==="json"?"{}":""}function Nn(k){const j=yt(k);return j.startsWith("ts")?"ts":j.startsWith("js")?"js":j==="json"?"json":"default"}function ka(k){const j=yt(k);return j==="md"||j==="mdx"}function Wn(k){if(!ue.value&&!K.value&&!ie.value)return;const j=k.target;j&&(typeof j.closest=="function"&&j.closest(".composer-popover-anchor")||(ue.value=!1,K.value=!1,ie.value=!1))}return Ii(()=>{document.addEventListener("click",Wn),window.addEventListener("drop",fn),window.addEventListener("dragend",fn),window.addEventListener("blur",fn),$o()}),t({hydrateDraft:qn,appendTextToDraft:Go,hasUnsavedDraft:()=>_e.value}),Os(()=>{document.removeEventListener("click",Wn),window.removeEventListener("drop",fn),window.removeEventListener("dragend",fn),window.removeEventListener("blur",fn),window.removeEventListener("pointerup",Bo),window.removeEventListener("pointercancel",Bo),window.removeEventListener("blur",Bo),it&&clearTimeout(it)}),ot(()=>r.activeThreadId,k=>{U(),qe&&Ta(qe,$r()),ba();const j=$s(k);j&&(rr(j),pn()),qe=k.trim()},{immediate:!0}),ot([s,i,c,l],()=>{qe&&Ta(qe,$r())},{deep:!0}),ot(s,()=>{$o()}),ot(()=>r.cwd,()=>{ee.value&&co()}),ot(()=>r.fuzzyFileSearchResults,k=>{!ee.value||!ce||(ge.value=(k??[]).map(j=>({path:j.path})),me.value=0)}),ot(Ke,k=>{$e.value=k}),(k,j)=>(P(),B("form",{class:"thread-composer",onSubmit:j[6]||(j[6]=vt(V=>Yt(e.isTurnInProgress?$e.value:"steer"),["prevent"]))},[w("div",{class:dt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":S.value}])},[e.planPanel?(P(),et(gM,{key:0,"plan-panel":e.planPanel,onImplementPlan:j[0]||(j[0]=V=>k.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Fe(jM,{"selected-images":i.value,"folder-upload-groups":d.value,"standalone-file-attachments":Oe.value,"selected-skills":l.value,"is-interaction-disabled":ke.value,onRemoveImage:xt,onRemoveFolder:zn,onRemoveFile:dn,onRemoveSkill:It},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",i1,[w("div",l1,[w("div",{class:dt(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":S.value,"thread-composer-input-wrap--expanded":Se.value}]),onDragenter:qo,onDragover:Jt,onDragleave:lo,onDrop:Hn},[S.value?(P(),B("div",u1,[w("span",c1,F(m(a)("Drop images or files")),1)])):ve("",!0),ee.value?(P(),B("div",d1,[ge.value.length>0?(P(!0),B(ct,{key:0},rn(ge.value,(V,be)=>(P(),B("button",{key:V.path,class:dt(["thread-composer-file-mention-row",{"is-active":be===me.value}]),type:"button",onMousedown:vt(He=>Wo(V),["prevent"])},[hn(V.path)?(P(),B("span",{key:0,class:dt(["thread-composer-file-mention-icon-badge",`is-${Nn(V.path)}`])},F(hn(V.path)),3)):ka(V.path)?(P(),B("span",p1,"↓")):(P(),et(dl,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",h1,[w("span",m1,F(Vo(V.path)),1),sr(V.path)?(P(),B("span",v1,F(sr(V.path)),1)):ve("",!0)])],42,f1))),128)):m(N)?(P(),B("div",g1,F(m(a)("No searchable directory for this thread")),1)):(P(),B("div",y1,F(m(a)("No matching files")),1))])):ve("",!0),re.value?(P(),et(WR,{key:2,commands:Le.value,"highlighted-index":Ne.value,onSelect:uo},null,8,["commands","highlighted-index"])):ve("",!0),Mn(w("textarea",{ref_key:"inputRef",ref:M,"onUpdate:modelValue":j[1]||(j[1]=V=>s.value=V),class:"thread-composer-input",placeholder:Ge.value,disabled:ke.value,onInput:pn,onKeydown:Qt,onPaste:xa},null,40,w1),[[Fn,s.value]]),nt.value?(P(),B("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Se.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),title:Se.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),disabled:ke.value,onClick:Do},[Se.value?(P(),et(CR,{key:0,class:"thread-composer-expand-icon"})):(P(),et(wR,{key:1,class:"thread-composer-expand-icon"}))],8,b1)):ve("",!0)],34),w("div",T1,[e.isTurnInProgress&&!ft.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:Za},[e.isStopPending?(P(),B("span",C1)):(P(),et(AR,{key:1,class:"thread-composer-stop-icon"}))],8,S1)):(P(),B("button",{key:1,class:dt(["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]=V=>Yt(e.isTurnInProgress?$e.value:"steer"))},[Fe(mR,{class:"thread-composer-submit-icon"})],10,x1))])]),w("div",{class:dt(["thread-composer-controls",{"thread-composer-controls--recording":We.value}])},[Fe(n1,{open:ue.value,"is-mobile":m(pe),"is-interaction-disabled":ke.value,"is-composer-config-disabled":he.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":A.value,"approval-policy-choices":R,"active-in-progress-mode":$e.value,"onUpdate:open":j[3]||(j[3]=V=>ue.value=V),onToggle:oo,onSetActiveMode:no,onSelectPhoto:ts,onSelectFolder:mt,onCaptureCamera:ns,onSelectCollaborationMode:Fr,onSelectApprovalPolicy:Sa},null,8,["open","is-mobile","is-interaction-disabled","is-composer-config-disabled","is-approval-policy-saving","approval-policy","approval-policy-error","approval-policy-notice","selected-collaboration-mode","collaboration-mode-choices","active-in-progress-mode"]),Fe(NM,{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":Ds,"onUpdate:selectedReasoningEffort":es},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",k1,[Fe(lc,{open:K.value,align:"start",width:"md","aria-label":m(a)("Plan mode"),"onUpdate:open":j[4]||(j[4]=V=>K.value=V)},{trigger:pt(()=>[w("button",{class:dt(["thread-composer-plan-trigger",{"is-active":K.value}]),type:"button","aria-label":m(a)("Plan mode"),disabled:he.value,onClick:ao},[w("span",A1,F(H.value),1),Fe(Ms,{class:"thread-composer-plan-trigger-chevron"})],10,I1)]),default:pt(()=>[(P(!0),B(ct,null,rn(A.value,V=>(P(),B("button",{key:V.value,class:dt(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===V.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===V.value,disabled:V.disabled||he.value,onClick:be=>Fo(V.value)},[w("span",P1,[w("span",E1,F(m(a)(V.labelKey)),1),V.subLabel?(P(),B("span",R1,F(V.subLabel),1)):ve("",!0),V.disabled?(P(),B("span",M1,F(m(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===V.value?(P(),B("span",j1,"✓")):ve("",!0)],10,_1))),128))]),_:1},8,["open","aria-label"]),Fe(lc,{open:ie.value,align:"center",width:"md","aria-label":m(a)("Approval policy"),"onUpdate:open":j[5]||(j[5]=V=>ie.value=V)},{trigger:pt(()=>[w("button",{class:dt(["thread-composer-approval-trigger",{"is-active":ie.value}]),type:"button","aria-label":m(a)("Approval policy"),disabled:he.value,onClick:kr},[w("span",N1,F(le.value),1),Fe(Ms,{class:"thread-composer-approval-trigger-chevron"})],10,L1)]),default:pt(()=>[(P(),B(ct,null,rn(R,V=>w("button",{key:V.value,class:dt(["thread-composer-menu-item",{"is-active":e.approvalPolicy===V.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===V.value,disabled:e.isApprovalPolicySaving,onClick:be=>Sa(V.value)},[w("span",$1,[w("span",D1,F(m(a)(V.label)),1)]),e.approvalPolicy===V.value?(P(),B("span",F1,"✓")):ve("",!0)],10,O1)),64)),e.approvalPolicyError?(P(),B("p",B1,F(e.approvalPolicyError),1)):ve("",!0),Fe(lu,{name:"approval-tip"},{default:pt(()=>[e.approvalPolicyNotice?(P(),B("span",U1,F(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])])),lt.value?(P(),B("button",{key:1,type:"button",class:dt(["thread-composer-context-usage-inline",{"is-warning":Te.value==="warning","is-danger":Te.value==="danger"}]),title:de.value,"aria-label":m(a)("Context"),onClick:Ue},[w("span",H1,F(J.value),1),Te.value!=="healthy"?(P(),B("span",q1,F(m(a)("Compact")),1)):ve("",!0)],10,z1)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:O,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:ke.value,onChange:Gt},null,40,W1),w("input",{ref_key:"cameraCaptureInputRef",ref:D,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:ke.value,onChange:vr},null,40,G1),w("input",{ref_key:"folderPickerInputRef",ref:q,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:ke.value,onChange:un},null,40,V1)],32))}}),Vm=Ct(J1,[["__scopeId","data-v-3e7a7887"]]),Q1=["aria-label"],X1=["aria-checked","onClick"],Z1={class:"runtime-toggle-option-label"},ej=bn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=wa(),o=[{value:"local",label:r("Local project"),icon:ip},{value:"worktree",label:r("New worktree"),icon:ic}];function a(s){n("update:modelValue",s)}return(s,i)=>(P(),B("div",{class:"runtime-toggle",role:"radiogroup","aria-label":m(r)("Continue in")},[(P(),B(ct,null,rn(o,l=>w("button",{key:l.value,class:dt(["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(Hf(l.icon),{class:"runtime-toggle-option-icon"})),w("span",Z1,F(l.label),1)],10,X1)),64))],8,Q1))}}),tj=Ct(ej,[["__scopeId","data-v-7949f4e3"]]),nj={},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 oj(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 Sy=Ct(nj,[["render",oj]]),aj={},sj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function ij(e,t){return P(),B("svg",sj,[...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 lj=Ct(aj,[["render",ij]]),uj={class:"sidebar-thread-controls"},cj=["aria-label","title"],dj=["aria-label","title"],fj=bn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=wa();return(n,r)=>(P(),B("div",uj,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),title:e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(P(),et(lj,{key:0,class:"sidebar-thread-controls-icon"})):(P(),et(Sy,{key:1,class:"sidebar-thread-controls-icon"}))],8,cj),xr(n.$slots,"default",{},void 0),e.showNewThreadButton?(P(),B("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":m(t)("Start new thread"),title:m(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[Fe(dl,{class:"sidebar-thread-controls-icon"})],8,dj)):ve("",!0)]))}}),Km=Ct(fj,[["__scopeId","data-v-e3703c43"]]),pj={},hj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mj(e,t){return P(),B("svg",hj,[...t[0]||(t[0]=[w("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.9"},null,-1),w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M12 8v4l3 2"},null,-1)])])}const Ym=Ct(pj,[["render",mj]]),vj={},gj={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function yj(e,t){return P(),B("svg",gj,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M4 7h16M4 12h16M4 17h10"},null,-1)])])}const Jm=Ct(vj,[["render",yj]]),wj={},bj={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function Tj(e,t){return P(),B("svg",bj,[...t[0]||(t[0]=[w("circle",{cx:"11",cy:"11",r:"8"},null,-1),w("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Qm=Ct(wj,[["render",Tj]]),Sj={},Cj={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function xj(e,t){return P(),B("svg",Cj,[...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 kj=Ct(Sj,[["render",xj]]),Ij={},Aj={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function _j(e,t){return P(),B("svg",Aj,[...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 Pj=Ct(Ij,[["render",_j]]),Ej={},Rj={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Mj(e,t){return P(),B("svg",Rj,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7a2 2 0 0 1 2-2h2.586A2 2 0 0 1 14 5.586L15.414 7H18a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2zm-4 4V5a2 2 0 0 1 2-2h2"},null,-1)])])}const Xm=Ct(Ej,[["render",Mj]]);function Cy(e){var o;const t=e.replace(/\r\n/g,`
63
- `).trim();if(!t)return null;const n=[],r=[];for(const a of t.split(`
64
- `)){const s=a.trim();if(!s){n.length===0&&r.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let c="pending";l==="x"&&(c="completed"),(l==="~"||l===">"||l==="-")&&(c="inProgress"),n.push({step:((o=i[2])==null?void 0:o.trim())??"",status:c});continue}r.push(s)}if(n.length===0){const a=jj(t);return a||null}return{explanation:r.join(`
65
- `).trim(),steps:n.filter(a=>a.step.length>0)}}function jj(e){var a,s;const t=[],n=[],r=[];for(const i of e.split(`
66
- `)){const l=i.trim();if(!l){t.length===0&&n.length===0&&r.push("");continue}const c=l.match(/^\d+[.)]\s+(.+)$/);if(c){t.push({step:((a=c[1])==null?void 0:a.trim())??"",status:"pending"});continue}const d=l.match(/^[-*]\s+(.+)$/);if(d){n.push({step:((s=d[1])==null?void 0:s.trim())??"",status:"pending"});continue}r.push(l)}const o=t.length>0?t:n;return o.length===0?null:{explanation:Lj(r.join(`
67
- `)),steps:o.filter(i=>i.step.length>0)}}function Lj(e){return e.split(`
68
- `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
69
- `).trim()}function Zm(e){var t;return e.plan&&e.plan.steps.length>0?{explanation:((t=e.plan.explanation)==null?void 0:t.trim())??"",steps:e.plan.steps}:Cy(e.text)}const xy="modelSwitch",ky=20;function Nj(e){return e.messageType===xy}const ga="__new-thread__",Iy="__new-thread-provider__::";function Ay(e){return e==="plan"?"plan":"default"}function xi(e){return typeof e=="string"?e.trim():""}function Eo(){return Object.create(null)}function qu(e){const t=Eo();for(const[n,r]of Object.entries(e))t[n]=r;return t}function Wl(e,t){if(!(t in e))return e;const n=Eo();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function _y(e,t){let n=!1;const r=Eo();for(const[o,a]of Object.entries(e)){if(o===ga||o.startsWith(Iy)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function ks(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function Oj(e){return e===ga}function Nu(e){const t=ks(e);return t?`${Iy}${t}`:""}function qa(e){return e.trim()||ga}function Ud(e,t){const n=qa(t),r=xi(e[n]);return r||xi(e[ga])}function zd(e,t){const n=qa(t);return Ay(e[n])}function ev(e,t,n){const r=qa(t);if(Oj(r))return Wl(e,r);if(n==="plan"){const o=qu(e);return o[r]="plan",o}return Wl(e,r)}function $j(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Zn(e){return e.flatMap(t=>t.threads)}function Dj(e,t){var r,o;const n=e.findIndex(a=>a.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((o=e[n-1])==null?void 0:o.id)??""}function Py(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function Fj(e){if(e instanceof Or&&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 Bj(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),r=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!1:n>r}function Uj(e,t,n){return Bj(e,t??n)}function Ey(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 tv(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 zj(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=tv(t.total),r=tv(t.last);if(!n||!r)return null;const o=Gi(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Ey(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function Vi(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return Ga(e,n)?e:n}function wf(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Ga(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==r[o])return!1;return!0}function Hj(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function qj(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function Wj(e=[],t=[]){var n,r,o,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((r=t[s])==null?void 0:r.step)||((o=e[s])==null?void 0:o.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function Gj(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&Wj(e.steps,t.steps)}function Ou(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 bf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ga(e.images,t.images)&&Vj(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&qj(e.commandExecution,t.commandExecution)&&Gj(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function fl(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function nv(e,t,n={}){var S;const r=new Map(e.map(I=>[I.id,I])),o=new Map(t.map(I=>[I.id,I])),a=t.map(I=>{const U=r.get(I.id);return U&&bf(U,I)?U:I});if(n.preserveMissing!==!0)return fl(e,a)?e:a;const s=e.map(I=>{const U=o.get(I.id);return!U||bf(I,U)?I:U}).filter(I=>!nl(I)||!rv(I,t)),i=new Set(e.map(I=>I.id)),l=a.filter(I=>!i.has(I.id)),c=e.filter(nl);let d=[],v=l;if(c.length>0){const I=a.findIndex(U=>c.some(O=>rv(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 D;return((D=O.turnId)==null?void 0:D.trim())??""}).filter(O=>O!==""));if(U.size>0){const O=[],D=[];for(const q of l){const M=((S=q.turnId)==null?void 0:S.trim())??"";M!==""&&U.has(M)?O.push(q):D.push(q)}d=O,v=D}}}const f=s.findIndex(nl),y=f>=0?[...s.slice(0,f),...d,...s.slice(f),...v]:[...s,...d,...v];return fl(e,y)?e:y}function Vj(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r.path!==o.path||r.operation!==o.operation||r.movedToPath!==o.movedToPath||r.diff!==o.diff||r.addedLineCount!==o.addedLineCount||r.removedLineCount!==o.removedLineCount)return!1}return!0}function Ja(e){return e.replace(/\s+/gu," ").trim()}function nl(e){return e.messageType==="userMessage.optimistic"}function Kj(e){return e.some(nl)}function rv(e,t){if(e.role!=="user")return!1;const n=Ja(e.text),r=Array.isArray(e.images)?e.images:[],o=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||s.role!=="user"||nl(s))return!1;const i=Ja(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&&Ga(l,r)&&c===o&&d===a})}function Yj(e){const t=[];let n=new Map;for(const r of e){if(!(r.role==="assistant"&&typeof r.messageType=="string"&&(r.messageType==="agentMessage"||r.messageType==="agentMessage.live"))){r.role==="user"&&(n=new Map),t.push(r);continue}const a=Ja(r.text);if(a.length===0){t.push(r);continue}const s=n.get(a);if(typeof s=="number"){t.splice(s,1);for(const[i,l]of n)l>s&&n.set(i,l-1);n.set(a,t.length),t.push(r)}else n.set(a,t.length),t.push(r)}return t}function Jj(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>Ja(a.text)).filter(a=>a.length>0));if(r.size===0)return e;const o=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Ja(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function Rc(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(bf(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const lp="worked";function Es(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function Qj(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60,a=[];n>0&&a.push(`${n}h`),(r>0||n>0)&&a.push(`${r}m`);const s=o>0||a.length===0?o:0;return a.push(`${s}s`),a.join(" ")}function Xj(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function Zj(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 Ry(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${Qj(e.durationMs)}`,messageType:lp,turnId:e.turnId,durationMs:e.durationMs}}function eL(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function tL(e,t){const n=Ry(t),r=e.filter(s=>s.messageType!==lp),o=eL(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function nL(e,t){if(!t)return e;const n=new Set;for(const o of e)o.messageType===lp&&o.turnId&&n.add(o.turnId);const r=[];for(const[o,a]of Object.entries(t))!o||n.has(o)||typeof a!="number"||!Number.isFinite(a)||a<=0||(r.push(Ry({turnId:o,durationMs:Math.round(a)})),n.add(o));return r.length===0?e:[...e,...r]}function wt(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 r={};for(const[o,a]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=a}return n?r:e}function oL(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 aL(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 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 nn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function My(e,t){const n=t.trim();if(!n)return e;let r=!1;const o=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(r=!0),s.length>0?o.push(i?{...a,threads:s}:a):a.threads.length===0&&o.push(a)}return r?o:e}function uc(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const a=n.get(o.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=o.threads.map(l=>{const c=s.get(l.id);return c&&oL(c,l)?c:l});return a&&a.projectName===o.projectName&&aL(a.threads,i)?a:{projectName:o.projectName,threads:i}});return sL(e,r)?e:r}function iL(e,t,n){const r=new Set(Zn(t).map(i=>i.id)),o=Zn(e).filter(i=>n[i.id]===!0&&!r.has(i.id));if(o.length===0)return t;const a=new Map(t.map(i=>[i.projectName,i])),s=t.map(i=>({projectName:i.projectName,threads:[...i.threads]}));for(const i of o){if(a.get(i.projectName)){const c=s.findIndex(d=>d.projectName===i.projectName);c>=0&&(s[c]={projectName:s[c].projectName,threads:[i,...s[c].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function ki(e){return Xr(e)}function lL(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function uL(e){const t=e.label||Xr(e.remotePath),n=lL(e.hostId);return n?`${t} ${n}`:t}function jy(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function Mc(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(o=>o.id)),r=e.projectOrder.filter(o=>t.has(o)||n.has(o));for(const o of e.order)r.includes(o)||r.push(o);for(const o of n)r.includes(o)||r.push(o);return r}function Tf(e,t){const n=jy(e);return Mc(e).map(r=>{if(n.has(r))return r;const o=Ze(r).trim(),a=ki(o);return t.has(a)?o:a})}function Wu(e,t){return Ze(e).trim()===t||ki(e)===t}function cL(e,t){const n=new Set;for(const r of e.order)Wu(r,t)&&n.add(r);for(const r of e.active)Wu(r,t)&&n.add(r);for(const r of Object.keys(e.labels))Wu(r,t)&&n.add(r);return n}function dL(e,t,n){var c,d;const r=new Set((e.remoteProjects??[]).map(v=>v.id)),o=new Map;for(const v of e.order){const f=ki(v);o.has(f)||o.set(f,v)}for(const v of n){const f=((d=(c=v.threads[0])==null?void 0:c.cwd)==null?void 0:d.trim())??"";f&&o.set(v.projectName,f)}const a=[],s=v=>{v&&!a.includes(v)&&a.push(v)};for(const v of t){if(r.has(v)){s(v);continue}const f=o.get(v);f&&s(f)}for(const v of Mc(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 fL(e,t,n){const r=Tf(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(xf(a)||xf(s))return 0;const i=o.get(a.projectName)??Number.POSITIVE_INFINITY,l=o.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function Sf(e,t){const n=new Map,r=new Map,o=s=>{const i=Ze(s).trim();if(!i)return;const l=Xr(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=Xr(i);cc(i)||r.set(l,(r.get(l)??0)+1),o(s)}for(const s of e)for(const i of s.threads){const l=Ze(i.cwd).trim(),c=Xr(l),d=(t==null?void 0:t.order.some(v=>Ze(v).trim()===l))===!0;cc(l)&&!d&&r.get(c)===1||o(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function cc(e){return e.includes("/.codex/worktrees/")}function pL(e,t){const n=Sf(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const c of(t==null?void 0:t.order)??[]){const d=Ze(c).trim();if(!d||(s.add(d),cc(d)))continue;const v=Xr(d);r.has(v)?(r.delete(v),o.add(v),a.delete(v)):o.has(v)||(r.add(v),a.set(v,d))}const i=[],l=new Map;for(const c of e)for(const d of c.threads){const v=Ze(d.cwd).trim(),f=Xr(v),y=s.has(v),S=cc(v)&&!y&&r.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 D={projectName:I,threads:[U]};l.set(I,D),i.push(D)}}return i}function hL(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),o=[...e],a=jy(t);for(const s of Mc(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const i=Ze(s).trim();if(!i)continue;const l=ki(i),c=n.has(l)?i:l;r.has(c)||(o.push({projectName:c,threads:[]}),r.add(c))}return o}const Cf=20;function _s(e){const t=e.split(`
70
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Cf):"Untitled thread"}function mL(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function xf(e){return e.threads.some(t=>t.cwd.trim().length===0||ac(t.cwd))}const js=new Map;let Gu=0;function Hd(e,t){const n=`${e}:${t.id}`,r=js.get(n);return r!==void 0?r:(Gu+=1,js.set(n,Gu),Gu)}function vL(e){const t=`${e}:`;for(const n of[...js.keys()])n.startsWith(t)&&js.delete(n)}function gL(){js.clear(),Gu=0}function yL(e){if(js.size!==0)for(const t of[...js.keys()]){const n=t.indexOf(":"),r=n>0?t.slice(0,n):"";e.has(r)||js.delete(t)}}function ov(e,t){const n=t.trim();if(!n)return-1;const r=e.findIndex(i=>i.id===n);if(r>=0)return r;const o=`session-cmd-${n}`,a=e.findIndex(i=>i.id===o);if(a>=0)return a;const s="session-cmd-";if(n.startsWith(s)){const i=e.findIndex(l=>l.id===n.slice(s.length));if(i>=0)return i}return-1}function wL(e,t){var a,s;if(t.length===0)return e;const n=[...e],r=[],o=new Map;for(const i of t){const l=((a=i.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(l&&ov(n,l)>=0)continue;const c=i.turnIndex;if(typeof c!="number"||!Number.isFinite(c))continue;const d=o.get(c)??[];d.push(i),o.set(c,d)}for(const i of[...t].reverse()){const l=((s=i.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(l){const S=ov(n,l);if(S>=0){n.splice(S+1,0,i);continue}}const c=i.turnIndex;if(typeof c!="number"||!Number.isFinite(c)){r.push(i);continue}let d=-1,v=-1;const f=[];for(let 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=(o.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 r.length>0?[...n,...r.reverse()]:n}function bL(e,t,n){const r=new Set(n.map(s=>s.id)),o=new Map;for(const s of t)for(const i of s)r.has(i.id)||o.has(i.id)||o.set(i.id,i);const a=Array.from(o.values());for(const s of a)Hd(e,s);return a.sort((s,i)=>Hd(e,s)-Hd(e,i))}function TL(e,t,n,r,o){const a=bL(e,r,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(nl);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=Yj(d);return[...wL(v,n),...o]}const Ly="codex-web-local.thread-read-state.v1",av="codex-web-local.thread-unread-cutoff.v1",Ny="codex-web-local.thread-token-usage.v1",Oy="codex-web-local.thread-reasoning.v1",kf="codex-web-local.thread-turn-durations.v1",$y="codex-web-local.thread-last-plan.v1",Dy="codex-web-local.live-reasoning-snapshot.v1",Fy="codex-web-local.thread-terminal-open.v1",If="codex-web-local.selected-thread-id.v1",Af="codex-web-local.selected-model-by-context.v1",By="codex-web-local.selected-model-id.v1",Uy="codex-web-local.project-order.v1",zy="codex-web-local.project-display-name.v1",_f="codex-web-local.collaboration-mode-by-context.v1",SL="codex-web-local.collaboration-mode.v1";function CL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ly);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function sv(e){typeof window>"u"||window.localStorage.setItem(Ly,JSON.stringify(e))}function xL(){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 qd(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Oy,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&MI(t,n)}}function kL(){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[r,o]of Object.entries(t)){if(!r||!o||typeof o!="object"||Array.isArray(o))continue;const a={};for(const[s,i]of Object.entries(o))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[r]=a)}return n}catch{return{}}}let Hy={};function qy(e){const t={};for(const[n,r]of Object.entries(e))n&&Object.keys(r).length>0&&(t[n]={...r});Hy=t}function iv(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(kf):window.localStorage.setItem(kf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e)){if(!t)continue;const r=Hy[t]??{};for(const[o,a]of Object.entries(n))!o||typeof a!="number"||a<=0||r[o]!==a&&LI(t,o,a)}qy(e)}}function IL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($y);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Wy(e){if(!(typeof window>"u"))try{window.localStorage.setItem($y,JSON.stringify(e))}catch{}}function AL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=o;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[r]={text:a.text,ts:a.ts})}return n}catch{return{}}}function _L(){if(typeof window>"u")return"";const e=window.localStorage.getItem(av);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(av,t),t}function PL(){if(typeof window>"u")return Eo();try{const n=window.localStorage.getItem(Af);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Eo();const o=Eo();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const i=xi(s);i&&(o[a]=i)}return o}}catch{}const e=xi(window.localStorage.getItem(By)),t=Eo();return e&&(t[ga]=e),t}function $u(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Af):window.localStorage.setItem(Af,JSON.stringify(e)),window.localStorage.removeItem(By)}catch{}}function EL(){if(typeof window>"u")return Eo();try{const e=window.localStorage.getItem(_f);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Eo();const n=Eo();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=Ay(o);a==="plan"&&(n[r]=a)}return n}}catch{}return Eo()}function Wd(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(_f):window.localStorage.setItem(_f,JSON.stringify(e)),window.localStorage.removeItem(SL)}catch{}}function RL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ny);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=zj(o);a&&(n[r]=a)}return n}catch{return{}}}function Gd(e){typeof window>"u"||window.localStorage.setItem(Ny,JSON.stringify(e))}const Pf="codex-web-local.thread-model-switch-markers.v1";function ML(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Pf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&Nj(s)).slice(0,ky);a.length>0&&(n[r]=a)}return n}catch{return{}}}function jL(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Pf):window.localStorage.setItem(Pf,JSON.stringify(e))}catch{}}function LL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))r&&typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function NL(e){typeof window>"u"||window.localStorage.setItem(Fy,JSON.stringify(e))}function OL(){return typeof window>"u"?"":window.localStorage.getItem(If)??""}function $L(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(If);return}window.localStorage.setItem(If,e)}}function DL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Uy);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const o=Xr(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function FL(e){typeof window>"u"||window.localStorage.setItem(Uy,JSON.stringify(e))}function BL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=typeof r=="string"?Xr(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function UL(e){typeof window>"u"||window.localStorage.setItem(zy,JSON.stringify(e))}function zL(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function HL(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const r of e.steps){const o=r.status==="completed"?"x":r.status==="inProgress"?"~":" ";t.push(`- [${o}] ${r.step}`)}return t.join(`
71
- `).trim()}function Ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Me(e){return typeof e=="string"?e:""}function Rs(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function lv(e){const t=Ve(e);if(!t)return null;const n=Rs(t.totalTokens??t.total_tokens),r=Rs(t.inputTokens??t.input_tokens),o=Rs(t.cachedInputTokens??t.cached_input_tokens),a=Rs(t.outputTokens??t.output_tokens),s=Rs(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||r===null||o===null||a===null||s===null?null:{totalTokens:n,inputTokens:r,cachedInputTokens:o,outputTokens:a,reasoningOutputTokens:s}}function qL(e){const t=Ve(e);if(!t)return null;const n=lv(t.total),r=lv(t.last);if(!n||!r)return null;const o=Rs(t.modelContextWindow??t.model_context_window),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Ey(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function WL(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ve(e.params),n=Dn(e),r=qL((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!r?null:{threadId:n,usage:r}}function Dn(e){const t=Ve(e.params);if(!t)return"";const n=Me(t.threadId);if(n)return n;const r=Me(t.thread_id);if(r)return r;const o=Me(t.conversationId);if(o)return o;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 GL(e){if(e.method!=="turn/completed")return"";const t=Ve(e.params),n=Ve(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const r=Ve(n.error);return Me(r==null?void 0:r.message)}function VL(e){var r;if(e.method!=="error")return null;const t=Ve(e.params),n=Me(t==null?void 0:t.message)||Me((r=Ve(t==null?void 0:t.error))==null?void 0:r.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function KL(e){const t=Dn(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=Ve(e.params),r=Ve(n==null?void 0:n.item),o=Me(r==null?void 0:r.type).toLowerCase();if(o==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(o==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(o==="commandexecution"){const a=Me(r==null?void 0:r.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(o==="filechange"){const s=(Array.isArray(r==null?void 0:r.changes)?r.changes:[])[0],i=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 YL(e){if(e.method!=="turn/started")return null;const t=Ve(e.params);if(!t)return null;const n=Dn(e);if(!n)return null;const r=Ve(t.turn),o=Me(r==null?void 0:r.id)||Me(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Es(Me(r==null?void 0:r.startedAt))??Es(Me(t.startedAt))??Es(e.atIso)??Date.now();return{threadId:n,turnId:o,startedAtMs:a}}function JL(e){if(e.method!=="turn/completed")return null;const t=Ve(e.params);if(!t)return null;const n=Dn(e);if(!n)return null;const r=Ve(t.turn),o=Me(r==null?void 0:r.id)||Me(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Es(Me(r==null?void 0:r.completedAt))??Es(Me(t.completedAt))??Es(e.atIso)??Date.now(),s=Es(Me(r==null?void 0:r.startedAt))??Es(Me(t.startedAt))??void 0;return{threadId:n,turnId:o,completedAtMs:a,startedAtMs:s}}function dc(e){return`${e}:live-reasoning`}function QL(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 XL(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Me(t.itemId),r=Me(t.delta);return!n||!r?null:{messageId:dc(n),itemId:n,delta:r}}if(e.method==="item/reasoning/textDelta"){const n=Me(t.itemId),r=Me(t.delta);return!n||!r?null:{messageId:dc(n),itemId:n,delta:r}}return null}function ZL(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Me(t.itemId);return n?dc(n):""}return""}function eN(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":dc(Me(n.id))}return""}function tN(e){var n;const t=[];for(const r of["content","summary"]){const o=Array.isArray(e[r])?e[r]:[];for(const a of o){const s=typeof a=="string"?a:(n=Ve(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
72
- `).trim()}function nN(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 r=Me(n.id);return r?{itemId:r,text:tN(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 oN(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Me(t.itemId),r=Me(t.delta);if(!n||!r)return null;const o=Me(t.turnId)||Me(t.turn_id);return{messageId:n,delta:r,turnId:o||void 0}}return null}function aN(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/completed"){const n=Ve(t.item);if(!n||n.type!=="agentMessage")return null;const r=Me(n.id),o=Me(n.text);if(!r||!o)return null;const a=Me(t.turnId)||Me(t.turn_id);return{id:r,role:"assistant",text:o,messageType:"agentMessage",turnId:a||void 0}}return null}function sN(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function iN(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 lN(e){if(e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n)return null;const r=Me(n.id);if(!r)return null;if(n.type==="imageView"){const s=Me(n.path);return s?{id:r,role:"assistant",text:"",images:[sN(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const o=Me(n.result),a=o?iN(o):"";return a?{id:r,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function uN(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=Ve(e.params);if(!t)return null;const n=Me(t.itemId),r=Me(t.delta);return!n||!r?null:{itemId:n,delta:r}}const rl="__global__";function cN(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function Gy(e){const t=Ve(e);if(!t)return null;const n=t.id,r=Me(t.method),o=t.params;if(typeof n!="number"||!Number.isInteger(n)||!r)return null;const a=Ve(o),s=dN(r,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:o??null}}function dN(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||fN(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||pN(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||hN(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||vN(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||gN(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||mN(t)?"item/tool/call":n)}function fN(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 pN(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 hN(e){return!!(e&&Array.isArray(e.questions))}function mN(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function vN(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 gN(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ve(e.permissions)!==null:!1}function yN(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ve(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const o of n){const a=Ve(o),s=Me(a==null?void 0:a.id).trim();s&&r.push(s)}return r}function wN(e,t){const n=t.threadId||rl,r=e.pendingServerRequestsByThreadId.value[n]??[],o=r.findIndex(s=>s.id===t.id),a=[...r];o>=0?a.splice(o,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function bN(e,t){const n={};for(const[r,o]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=o.filter(s=>s.id!==t);a.length>0&&(n[r]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=wt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function TN(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function SN(e,t){const n={},r=new Set;for(const a of t){const s=a.threadId||rl,i=n[s]??[];i.push(a),n[s]=i,r.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const o={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))r.has(Number(a))&&(o[a]=s);e.pendingReplyErrorByRequestId.value=o}function Vy(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];fl(r,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function CN(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=wt(e.liveAgentMessagesByThreadId.value,t))}function xN(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[];fl(r,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function kN(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},Wy(e.lastPlanByThreadId.value))}function IN(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[],o=Rc(r,n);xN(e,t,o),kN(e,t,n)}function AN(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[],o=Rc(r,n);up(e,t,o)}function _N(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];let o=Rc(r,n);const a=Ja(n.text);if(n.role==="assistant"&&a.length>0){const s=o.filter(i=>i.id===n.id||Ja(i.text)!==a);s.length!==o.length&&(o=s)}Vy(e,t,o)}function up(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[];fl(r,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function PN(e,t,n){const r=e.liveCommandsByThreadId.value[t]??[],o=Rc(r,n);o!==r&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:o})}function EN(e,t,n){const r=e.liveCommandsByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(s=>s.id)),a=r.filter(s=>!o.has(s.id));a.length!==r.length&&(a.length===0?e.liveCommandsByThreadId.value=wt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function RN(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(l=>l.id)),a=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnId=="string"&&l.turnId.length>0).map(l=>l.turnId)),s=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnIndex=="number").map(l=>l.turnIndex)),i=r.filter(l=>!o.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==r.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=wt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function MN(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...o];s[a]={...s[a],fileChanges:r},up(e,t,s)}function jN(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...o],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:r}))},up(e,t,s)}function LN(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let r=-1;for(const o of n)typeof o.turnIndex=="number"&&Number.isFinite(o.turnIndex)&&(r=Math.max(r,o.turnIndex));return r+1}function NN(e,t,n,r){if(!t||!n||!Number.isInteger(r)||r<0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};o[n]!==r&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...o,[n]:r}})}function ON(e,t,n){const r=e.turnIndexByTurnIdByThreadId.value[t]??{},o=Object.entries(r),a=Object.entries(n);o.length===a.length&&o.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function $N(e,t,n){var o;if(!t||!n)return;const r=(o=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:o[n];return typeof r=="number"?r:void 0}function DN(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};let o=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=r[s.turnId];return typeof i!="number"?s:(o=!0,{...s,turnIndex:i})});o&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const uv=8e3,FN=1500,BN=15*60*1e3;function UN(e){let t=AL(),n=!1,r=null;function o(){r===null&&(r=setTimeout(()=>{if(r=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(Dy,JSON.stringify(t))}catch{}n&&o()},FN))}function a(d,v){if(!d||e.inProgressById.value[d]!==!0)return;const f=v.length>uv?v.slice(-uv):v;t[d]={text:f,ts:Date.now()},n=!0,o()}function s(d,v){if(!d)return;const f=v.trim(),y=e.liveReasoningTextByThreadId.value[d]??"";if(f.length===0){if(!y)return;e.liveReasoningTextByThreadId.value=wt(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>BN||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f.text}))}function c(d){d&&d in t&&(delete t[d],n=!0,o())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:c}}function zN(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function HN(e,t,n=!1){var l;if(!t)return;const r=e.liveReasoningTextByThreadId.value[t];if(r===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const o=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=o?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[o]:void 0,s=KN(e,t),i=o||void 0;s.length>0?WN(e,t,s,i,a):n||qN(e,t,r,i,a),e.liveReasoningTextByThreadId.value=wt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function qN(e,t,n,r,o){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(c=>c.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:r||void 0,turnIndex:typeof o=="number"?o:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function WN(e,t,n,r,o){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const c=l.text.trim();if(!c)continue;const d=`reasoning:item:${t}:${l.itemId}`,v=s.findIndex(f=>f.id===d);if(v>=0){const f=s[v],y=l.anchorMessageId||f.reasoningAnchorMessageId,S=typeof o=="number"?o:f.turnIndex;if(f.text===c&&f.turnIndex===S&&f.reasoningAnchorMessageId===y)continue;s[v]={...f,text:c,reasoning:{summary:[],content:[c]},turnId:r||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:r||void 0,turnIndex:typeof o=="number"?o:void 0,reasoningAnchorMessageId:l.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function GN(e,t,n,r){if(!t||!r)return;r.trim()&&e.reasoningItemTextByItemId.set(n,r.trim());const o=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(o.endsWith(r)||a&&r===a){e.reasoningAppendedTextByItemId.set(n,r);return}if(a&&r.startsWith(a)){const i=r.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,r);return}const s=o.length>0&&!o.endsWith(`
73
- `)?`
74
-
75
- `:"";e.appendLiveReasoningText(t,`${s}${r}`),e.reasoningAppendedTextByItemId.set(n,r)}function VN(e,t){const n=Ve(t.params);if(!n)return;const r=t.method==="item/started"||t.method==="item/completed",o=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!r&&!o)return;const a=Ve(n.item),s=Me(o?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Dn(t);if(!i)return;const l=o||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 KN(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],r=[];let o="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&r.push({text:i,anchorMessageId:o,itemId:s.itemId})}else o=s.itemId;return r}function YN(e,t,n){if(!t||!n)return;const r=e.reasoningItemTextByItemId.get(t)??"";r.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${r}${n}`)}function cv(e){e.reasoningItemTextByItemId.clear()}const Ao="gpt-5.4-mini",Ky="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",JN="big-pickle",QN=Jg;function XN(e){const t=T([]),n=T({}),r=T({}),o=T(PL()),a=T(Ud(o.value,e.selectedThreadId.value)),s=T("medium"),i=T("standard"),l=T(""),c=T(""),d=T(!1),v=T({});let f=!1;function y(xe){if(qa(xe)===ga){const Ce=ks(l.value),Ee=Nu(Ce),Je=Ee?xi(o.value[Ee]):"";if(Je)return Je}return Ud(o.value,xe).trim()}function S(xe){const Se=xe.trim();return ks(Se?v.value[Se]??l.value:l.value)}function I(xe){const Se=xe.trim();return!Se||qa(Se)===ga?!1:Ud(o.value,Se).trim().length>0}function U(xe){const Se=xe.trim();if(!Se)return!1;const Ce=qa(Se);return Ce===ga?!1:xi(o.value[Ce]).length>0}function O(xe){return n.value[xe.trim()]??QN}function D(xe,Se=s.value){const Ce=xe.trim(),Ee=O(Ce);if(Se&&Ee.includes(Se))return Se;if(Ee.includes("medium"))return"medium";const Je=r.value[Ce];return Je&&Ee.includes(Je)?Je:Ee[0]??""}function q(xe){s.value=D(xe)}function M(xe){const Se={},Ce={};for(const Ee of xe)Ee.supportedReasoningEfforts!==null&&(Se[Ee.id]=[...Ee.supportedReasoningEfforts]),Ee.defaultReasoningEffort&&(Ce[Ee.id]=Ee.defaultReasoningEffort);n.value=Se,r.value=Ce}function pe(...xe){const Se=[...t.value];for(const Ce of xe){const Ee=Ce.trim();Ee&&!Se.includes(Ee)&&Se.push(Ee)}Ga(t.value,Se)||(t.value=Se)}function ue(xe){const Se=xe.trim();return t.value.length===0||Se&&t.value.includes(Se)?Se:t.value[0]??""}function K(xe,Se){const Ce=Se.trim(),Ee=qa(xe),Je=ks(l.value),Xe=Ee===ga?Nu(Je):"",it=Xe||Ee;if(Ce){const ce=qu(o.value);ce[it]=Ce,Xe&&delete ce[Ee],o.value=ce}else{let ce=Wl(o.value,it);Xe&&(ce=Wl(ce,Ee)),o.value=ce}Ee===qa(e.selectedThreadId.value)?(a.value=y(e.selectedThreadId.value),pe(a.value),q(a.value)):pe(Ce),$u(o.value)}function ie(xe){K(e.selectedThreadId.value,xe)}function ye(xe,Se){const Ce=xe.trim();if(!Ce)return;const Ee=Se.trim();if(Ee){const Je=qu(o.value);Je[Ce]=Ee,o.value=Je}else o.value=Wl(o.value,Ce);pe(Ee),e.selectedThreadId.value===Ce&&(a.value=y(e.selectedThreadId.value),q(a.value)),$u(o.value)}function Pe(xe,Se){const Ce=xe.trim();if(!Ce)return;const Ee=ks(Se);Ee?v.value={...v.value,[Ce]:Ee}:v.value[Ce]&&(v.value=wt(v.value,Ce))}function ge(xe,Se,Ce){const Ee=Se.trim();if(ks(Ce)!=="opencode-zen")return Ee;const Xe=y(xe).trim();return Xe&&!/^gpt-/i.test(Xe)?Xe:Ee&&!/^gpt-/i.test(Ee)?Ee:JN}async function ee(xe=e.selectedThreadId.value){var Ce;const Se=xe.trim();Se?(ye(Se,Ao),(Ce=e.onThreadModelChanged)==null||Ce.call(e,Se)):ie(Ao),pe(Ao)}function me(xe){xe&&!O(a.value).includes(xe)||(f=!0,s.value=xe)}async function re(xe){const Se=xe==="fast"?"fast":"standard";if(d.value||i.value===Se)return;const Ce=i.value;i.value=Se,d.value=!0,e.error.value="";try{await sI(Se)}catch(Ee){i.value=Ce,e.error.value=Ee instanceof Error?Ee.message:"Failed to update Fast mode"}finally{d.value=!1}}function Ae(xe,Se,Ce){const Ee=xe.trim()||"default",Je=Se||"default",Xe=Ce==="plan"?"Plan":"Default",it=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Xe}`,`Model: ${Ee}`,`Thinking: ${Je}`,`Speed: ${it}`]}async function De(xe){c.value="";try{const Se=await cI(),Ce=Se.model.trim(),Ee=ks(Se.providerId);l.value=Ee;const Je=S(e.selectedThreadId.value),Xe=Je!=="codex"&&Je!=="custom",it=y(e.selectedThreadId.value),ce=await uI({includeProviderModels:Xe||(xe==null?void 0:xe.includeProviderModels)!==!1,requireProviderModels:Xe,providerId:Xe?Je:void 0}),N=ce.map(A=>A.id);M(ce);const oe=Nu(Je),se=oe?xi(o.value[oe]):"",je=[...N];!(xe!=null&&xe.providerChanged)&&Xe&&Je===Ee&&Ce&&!je.includes(Ce)&&je.push(Ce),t.value=je;const qe=it&&N.includes(it);if(!it||!qe||xe!=null&&xe.providerChanged?xe!=null&&xe.providerChanged&&je.length>0?se&&N.includes(se)?ie(se):Je===Ee&&Ce&&je.includes(Ce)?ie(Ce):ie(je[0]):Je===Ee&&Ce&&je.includes(Ce)?ie(Se.model):je.length>0?ie(je[0]):ie(""):a.value.trim()!==it&&ie(it),oe&&a.value.trim().length>0){const A=qu(o.value);A[oe]=a.value.trim();const R=Nu(Ee);R&&R!==oe&&Ce&&(A[R]=Ce),o.value=A,$u(o.value)}s.value=D(a.value,f?s.value:"medium"),i.value=Se.speedMode}catch(Se){c.value=Py(Se)?Ky:""}}function Ne(xe){a.value=ue(y(xe)),q(a.value)}function Le(xe){const Se=_y(o.value,xe);Se!==o.value&&(o.value=Se,Ne(e.selectedThreadId.value),$u(Se)),v.value=nn(v.value,xe)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:c,isUpdatingSpeedMode:d,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:ee,buildPendingTurnDetails:Ae,hasThreadModelSelection:I,hasThreadOwnModelSelection:U,pruneThreadModelState:Le,readModelIdForThread:y,refreshModelPreferences:De,resolveThreadModelForProvider:ge,setSelectedModelId:ie,setSelectedModelIdForThread:K,setSelectedReasoningEffort:me,setThreadModelId:ye,setThreadModelProviderId:Pe,syncSelectedThreadModel:Ne,updateSelectedSpeedMode:re}}function ZN(e){const t=T([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=T(EL()),r=T(zd(n.value,e.value));function o(c){const d=c==="plan"?"plan":"default",v=qa(e.value);zd(n.value,e.value)===d&&r.value===d||(r.value=d,n.value=ev(n.value,v,d),Wd(n.value))}function a(c,d){const v=d==="plan"?"plan":"default";n.value=ev(n.value,c,v),c.trim()===e.value&&(r.value=v),Wd(n.value)}function s(c){r.value=zd(n.value,c)}function i(c){const d=_y(n.value,c);d!==n.value&&(n.value=d,s(e.value),Wd(d))}async function l(){try{const c=await fI();t.value=c,c.some(d=>d.value===r.value)||o("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:r,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:o,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const eO=500;function tO(){const e=T(null),t=T([]),n=Y(()=>e.value);let r=null,o=null;function a(c){e.value=c}async function s(){if(o){await o;return}o=(async()=>{try{const c=await eA();a(c),t.value=c?[c]:[]}catch{}finally{o=null}})(),await o}function i(){if(typeof window>"u"){s();return}r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null,s()},eO)}function l(){r===null||typeof window>"u"||(window.clearTimeout(r),r=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function nO(e){const t=T(DL()),n=T(BL());let r=null;function o(f,y={}){t.value=f,y.persist!==!1&&FL(f)}function a(f,y={}){n.value=f,y.persist!==!1&&UL(f)}async function s(f,y){try{const S=await Ki(),I={...S.labels};let U=!1;for(const O of S.order){if(!Wu(O,f))continue;const D=y.trim();D.length===0?I[O]!==void 0&&(delete I[O],U=!0):I[O]!==D&&(I[O]=D,U=!0)}U&&await Ld({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}),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,s(f,y)},500))}async function l(){try{const f=await Ki(),y=dL(f,t.value,e.sourceGroups.value);await Ld({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(D=>D!==f);if(Ga(t.value,y)||o(y),e.sourceGroups.value=e.sourceGroups.value.filter(D=>D.projectName!==f),n.value[f]!==void 0){const D={...n.value};delete D[f],a(D)}e.applyThreadFlags();const S=Zn(e.projectGroups.value);e.pruneThreadScopedState(S),S.some(D=>D.id===e.selectedThreadId.value)||e.setSelectedThreadId(((O=S[0])==null?void 0:O.id)??"");const U=new Set;try{const D=await Ki();cL(D,f).forEach(q=>{U.add(q)})}catch{}if(U.size>0)try{const D=await Ki(),q=D.order.filter(ue=>!U.has(ue)),M=D.active.filter(ue=>!U.has(ue)),pe=M.length===0&&q.length>0?[q[0]]:M;await Ld({order:q,labels:rL(D.labels,U),active:pe,projectOrder:D.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=Hj(S,I,U);if(O===S)return;o(Vi(O,e.sourceGroups.value));const D=wf(e.sourceGroups.value,t.value);e.sourceGroups.value=uc(e.sourceGroups.value,D),e.applyThreadFlags(),l()}function v(f){const y=f.trim();if(!y)return;const S=[y,...t.value.filter(U=>U!==y)];if(Ga(t.value,S))return;o(S);const I=wf(e.sourceGroups.value,t.value);e.sourceGroups.value=uc(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:o}}const rO=2e3;function oO(e){const t=T([]),n=T([]),r=T(!1);let o=null,a=null,s=!1,i=!1,l=0,c="";async function d(f={}){const y=e.getSelectedCwd().trim(),S=y||"__global__";if(o){await o;return}f.force!==!0&&s&&c===S&&Date.now()-l<rO||(o=(async()=>{try{t.value=await UI(y?[y]:void 0),s=!0,l=Date.now(),c=S}catch{}finally{o=null}})(),await o)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(r.value=!0,a=(async()=>{try{n.value=await mI(),i=!0}catch{}finally{r.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:r,refreshHooks:v,refreshSkills:d}}const Yy="codex-web-local.stashed-messages.v1",Jy="codex-web-local.auto-compact-threshold.v1",Du=10,aO=650;function sO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Yy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[r]=a)}return n}catch{return{}}}function iO(){if(typeof window>"u")return Du;try{const e=window.localStorage.getItem(Jy);if(e===null)return Du;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Du}catch{return Du}}function lO(e){const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();!o||r.length===0||(t[o]=r.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function uO(e){const t=T({}),n=T({}),r=T(sO()),o=T(iO());let a=!1;const s=Y(()=>{const K=e.value;if(!K)return[];const ie=t.value[K]??[];return[...(r.value[K]??[]).map(ge=>({...ge,awaitingCompaction:!0})),...ie]});function i(){typeof window>"u"||window.localStorage.setItem(Yy,JSON.stringify(r.value))}function l(){II(lO(t.value)).catch(()=>{})}async function c(){if(!a){a=!0;try{t.value=await km()}catch{}}}async function d(K){if(n.value[K]!==!0){n.value={...n.value,[K]:!0};try{t.value=await km()}catch{}finally{n.value=wt(n.value,K)}}}function v(K){d(K),!(typeof window>"u")&&window.setTimeout(()=>{d(K)},aO)}function f(K){const ie=Number.isFinite(K)&&K>0?Math.round(K):0;ie!==o.value&&(o.value=ie,!(typeof window>"u")&&window.localStorage.setItem(Jy,String(ie)))}function y(K){return r.value[K]??[]}function S(K,ie){r.value={...r.value,[K]:[...y(K),ie]},i()}function I(K){const ie=[...y(K)];return ie.length===0||(r.value=wt(r.value,K),i()),ie}function U(K,ie,ye){const ge=[...t.value[K]??[]],ee=typeof ye=="number"?Math.max(0,Math.min(ye,ge.length)):ge.length;ge.splice(ee,0,ie),t.value={...t.value,[K]:ge},l()}function O(K,ie){return y(K).find(ye=>ye.id===ie)}function D(K,ie){var ye;return(ye=t.value[K])==null?void 0:ye.find(Pe=>Pe.id===ie)}function q(K){const ie=e.value;if(!ie)return;if(O(ie,K)){const ge=y(ie).filter(ee=>ee.id!==K);r.value=ge.length>0?{...r.value,[ie]:ge}:wt(r.value,ie),i();return}const ye=t.value[ie];if(!ye)return;const Pe=ye.filter(ge=>ge.id!==K);t.value=Pe.length>0?{...t.value,[ie]:Pe}:wt(t.value,ie),l()}function M(K,ie){const ye=e.value;if(!ye)return;const Pe=t.value[ye];if(!Pe||O(ye,K)||O(ye,ie))return;const ge=Pe.findIndex(Ae=>Ae.id===K),ee=Pe.findIndex(Ae=>Ae.id===ie);if(ge<0||ee<0||ge===ee)return;const me=[...Pe],[re]=me.splice(ge,1);me.splice(ee,0,re),t.value={...t.value,[ye]:me},l()}function pe(K){const ie=nn(t.value,K);ie!==t.value&&(t.value=ie,l())}function ue(){t.value={},n.value={},r.value={},i(),l()}return{appendStashedMessage:S,autoCompactThreshold:o,clearQueueState:ue,enqueueQueuedMessage:U,findQueuedMessage:D,findStashedMessage:O,getStashedMessages:y,loadPersistedQueueStateIfNeeded:c,processQueuedMessages:d,pruneQueueState:pe,removeQueuedMessage:q,reorderQueuedMessage:M,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:I}}const cO=1e4,dO=2e3;function fO(e){const{selectedThreadId:t,projectGroups:n,inProgressById:r,applyThreadGroups:o,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,D=!1,q=[],M=null;function pe(me,re){if(me.length===0)return re;if(re.length===0)return me;const Ae=new Map;for(const Ne of Zn(me))Ae.set(Ne.id,Ne);for(const Ne of Zn(re))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((xe,Se)=>new Date(Se.updatedAtIso).getTime()-new Date(xe.updatedAtIso).getTime())})).sort((Ne,Le)=>{var Ce,Ee;const xe=new Date(((Ce=Ne.threads[0])==null?void 0:Ce.updatedAtIso)??0).getTime();return new Date(((Ee=Le.threads[0])==null?void 0:Ee.updatedAtIso)??0).getTime()-xe})}function ue(){return Object.values(r.value).some(me=>me===!0)}function K(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)},cO)}}async function ie(me){if(!(O||!I||ue())){O=!0;try{const re=await pm(I,SI());I=re.nextCursor,D=re.nextCursor===null,f.value=D,q=pe(q,re.groups),o(q,me)}catch{}finally{O=!1,I&&!ue()&&K(me)}}}async function ye(me={}){if(y){await y;return}me.force!==!0&&d.value&&Date.now()-S<dO||(y=(async()=>{var re;d.value||(v.value=!0);try{const[Ae,De]=await Promise.all([pm(),i(),s({force:me.force===!0})]);M=De;const Ne=Ae.groups;q=Ne,I=Ae.nextCursor,D=Ae.nextCursor===null,f.value=D,await a(Ne,De),o(q,De),d.value=!0,S=Date.now(),D||K(De);const Le=Zn(n.value);l(Le),!Le.some(Se=>Se.id===t.value)&&!t.value&&c(((re=Le[0])==null?void 0:re.id)??"")}finally{v.value=!1}})().finally(()=>{y=null}),await y)}function Pe(me){q=My(q,me)}function ge(){return I!==null}function ee(){U!==null&&typeof window<"u"&&(window.clearTimeout(U),U=null)}return{dispose:ee,hasActiveInProgressThreads:ue,hasLoadedThreads:d,hasRemainingThreadPages:ge,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:ye,removeThreadFromLoadedLists:Pe,scheduleRemainingThreadPages:K}}const dv=2e3;function pO(e){const t=T({}),n=T({}),r=T({}),o=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)<dv;if((ge=e.turnErrorByThreadId.value[M])!=null&&ge.transient&&(pe.silent===!0||ue))return;const K=f.get(M);if(K&&pe.force!==!0){await K;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 ee=e.currentThreadVersion(M),me=t.value[M]??"",re=Date.now()-(y.get(M)??0)<dv;if(pe.force===!0?!1:ie&&(re||(ee.length===0||me===ee)&&e.inProgressById.value[M]!==!0)){e.markThreadAsRead(M);return}const Ne=e.resumedThreadById.value[M]!==!0?await hf(M):null,Le=Ne??await pf(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:xe,inProgress:Se,activeTurnId:Ce,turnIndexByTurnId:Ee}=Le;r.value={...r.value,[M]:Le.hasMoreOlder===!0},e.markThreadMessagesPersisted(M,xe),e.replaceTurnIndexLookupForThread(M,Ee),e.rebindLiveFileChangeTurnIndices(M);const Je=e.persistedMessagesByThreadId.value[M]??[],Xe=nv(Je,xe,{preserveMissing:pe.silent===!0||Kj(Je)});e.setPersistedMessagesForThread(M,Xe);const it=e.liveAgentMessagesByThreadId.value[M]??[];if(Se){const ce=Jj(it,xe);e.setLiveAgentMessagesForThread(M,ce)}else e.clearLiveAgentMessagesForThread(M);e.removeLiveCommandsPersistedIn(M,xe),e.removeLiveFileChangesPersistedIn(M,xe),n.value={...n.value,[M]:!0},y.set(M,Date.now()),S.delete(M),ee&&(t.value={...t.value,[M]:ee}),e.setThreadInProgress(M,Se),Le.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[M]:Le.externalSession}),e.clearTransientTurnErrorForThread(M),Ce?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[M]:Ce}:e.activeTurnIdByThreadId.value[M]&&(e.activeTurnIdByThreadId.value=wt(e.activeTurnIdByThreadId.value,M)),Se||e.clearCompletedTurnLiveState(M),e.markThreadAsRead(M)}catch(ee){const me=ee instanceof Error?ee.message:"Unknown application error";throw e.selectedThreadId.value===M&&e.setTurnErrorForThread(M,me,{transient:!0}),S.set(M,Date.now()),ee}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||o.value[M]===!0||r.value[M]!==!0)return;const pe=e.getFirstPersistedTurnId(M);if(!pe){r.value={...r.value,[M]:!1};return}o.value={...o.value,[M]:!0};try{const ue=await Yk(M,pe),K=e.persistedMessagesByThreadId.value[M]??[],ie=nv(ue.messages,K,{preserveMissing:!0});e.setPersistedMessagesForThread(M,ie),e.replaceTurnIndexLookupForThread(M,{...e.turnIndexByTurnIdByThreadId.value[M]??{},...ue.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(M),r.value={...r.value,[M]:ue.hasMoreOlder}}catch(ue){throw ue instanceof Or&&ue.code==="older_turns_unavailable"&&(r.value={...r.value,[M]:!1}),e.error.value=ue instanceof Error?ue.message:"Failed to load earlier messages",ue}finally{o.value={...o.value,[M]:!1}}}async function D(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:D,hasMoreOlderMessagesByThreadId:r,isLoadingMessages:a,loadMessages:U,loadOlderMessages:O,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:o,pruneMessageHistoryState:q,slowOpenThreadId:i}}function hO(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:_s(c.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(c=>{const d=i[c.id];return{...c,title:_s(d??c.title)}})}))}async function r(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await EI();if(Object.keys(i.titles).length>0){const l={};for(const[c,d]of Object.entries(i.titles))l[c]=_s(d);t.value=l}}catch{}}function o(s,i,l){const c=s.trim();if(c)return _s(c);const d=l.map(v=>v.label.trim()).find(v=>v.length>0);return d?_s(d):i.length>0?_s("[Image]"):"Untitled thread"}async function a(s,i,l,c=[],d=[]){if(t.value[s])return;const v=i.trim();if(!v){const y=o(i,c,d);t.value={...t.value,[s]:y},e.applyThreadFlags(),sc(s,y);return}const f=v.length>300?v.slice(0,300):v;try{const y=await FI(f,l);if(!y||t.value[s])return;const S=y.length>Cf?y.slice(0,Cf):y;t.value={...t.value,[s]:S},e.applyThreadFlags(),sc(s,S)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:r,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:o,threadTitleById:t}}function mO(e){const t=T({}),n=T({});function r(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function o(S){wN(r(),S)}function a(S){bN(r(),S)}function s(S){SN(r(),S)}function i(S){return TN(r(),S)}const l=Y(()=>{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=>cN(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 xm()).map(U=>Gy(U)).filter(U=>U!==null);s(I)}catch{}}async function y(S){try{const I=await xm();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:o}}const Fu=220,vO=3e3,gO=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 yO(e,t){if(t.length===0)return e;const n=new Set(e.map(s=>s.id)),r=new Map,o=[];for(const s of t){const i=s.modelSwitchInsertAfterId;if(i&&n.has(i)){const l=r.get(i)??[];l.push(s),r.set(i,l)}else o.push(s)}const a=[];for(const s of e){a.push(s);const i=r.get(s.id);i&&i.length>0&&a.push(...i)}return o.length>0&&a.push(...o),a}function wO(){const e=T([]),t=T([]),n=T(OL()),r=T(""),o=T({}),a=T({}),s=T(IL()),i=T({}),l=T({}),c=T(xL()),d=T(kL()),v=T({}),f=new Map,y=new Map,S=new Map,I=new Map,U=T({}),O=T({}),D=T({}),M=UN({liveReasoningTextByThreadId:v,inProgressById:D}),pe=T({});let ue=!1;const K=T({}),{activeProviderId:ie,availableModelIds:ye,availableModelReasoningEfforts:Pe,codexCliMissingError:ge,isUpdatingSpeedMode:ee,selectedModelId:me,selectedReasoningEffort:re,selectedSpeedMode:Ae,applyFallbackModelSelection:De,buildPendingTurnDetails:Ne,hasThreadModelSelection:Le,hasThreadOwnModelSelection:xe,pruneThreadModelState:Se,readModelIdForThread:Ce,refreshModelPreferences:Ee,resolveThreadModelForProvider:Je,setSelectedModelId:Xe,setSelectedModelIdForThread:it,setSelectedReasoningEffort:ce,setThreadModelId:N,setThreadModelProviderId:oe,syncSelectedThreadModel:se,updateSelectedSpeedMode:je}=XN({selectedThreadId:n,error:r,onThreadModelChanged:h=>_a(h)}),{availableCollaborationModes:qe,selectedCollaborationMode:A,pruneThreadCollaborationState:R,refreshCollaborationModes:H,setSelectedCollaborationMode:le,setSelectedCollaborationModeForThread:ne,syncSelectedThreadCollaborationMode:ae}=ZN(n),_e=T(CL()),Oe=T(_L()),{projectDisplayNameById:ke,projectOrder:he,pinProjectToTop:Ke,removeProject:$e,renameProject:We,reorderProject:Ge,setProjectDisplayNames:ft,setProjectOrder:bt}=nO({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:on,pruneThreadScopedState:Xo,setSelectedThreadId:gr}),nt=T({}),lt=T({}),J=T({}),de=T({}),Te=T({}),Ue=T({}),Tt=pO({selectedThreadId:n,error:r,persistedMessagesByThreadId:o,liveAgentMessagesByThreadId:i,inProgressById:D,externalSessionByThreadId:pe,resumedThreadById:nt,turnIndexByTurnIdByThreadId:lt,turnErrorByThreadId:Te,activeTurnIdByThreadId:Ue,markThreadAsRead:Zo,markThreadMessagesPersisted:vl,replaceTurnIndexLookupForThread:vo,rebindLiveFileChangeTurnIndices:sa,setPersistedMessagesForThread:Yn,setLiveAgentMessagesForThread:ta,clearLiveAgentMessagesForThread:as,removeLiveCommandsPersistedIn:Tr,removeLiveFileChangesPersistedIn:tn,setThreadInProgress:kn,setThreadModelProviderId:oe,setThreadModelId:N,resolveThreadModelForProvider:Je,hasThreadOwnModelSelection:xe,clearTransientTurnErrorForThread:_r,clearCompletedTurnLiveState:Ea,setTurnErrorForThread:At,getFirstPersistedTurnId:Aa,currentThreadVersion:wr}),{ensureThreadMessagesLoaded:gt,hasMoreOlderMessagesByThreadId:Lt,isLoadingMessages:Oo,loadMessages:Yt,loadOlderMessages:no,loadedMessagesByThreadId:rr,loadedVersionByThreadId:ba,loadingOlderMessagesByThreadId:ro,pruneMessageHistoryState:$s,slowOpenThreadId:Ta}=Tt,Xa=hO({applyThreadFlags:on}),{threadTitleById:$r,applyCachedTitlesToGroups:Za,loadThreadTitleCacheIfNeeded:Dr,requestThreadTitleGeneration:$o}=Xa,Do=mO({applyThreadFlags:on,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Ds,loadPendingServerRequestsFromBridge:Fo,pendingReplyErrorByRequestId:Fr,pendingReplyErrorForRequest:es,pendingRequestStillExistsOnServer:Sa,pendingServerRequestsByThreadId:Bo,prunePendingServerRequestsByActiveThreads:oo,readPendingRequestState:ao,removePendingServerRequestById:kr,selectedThreadServerRequests:ts,upsertPendingServerRequest:ns}=Do,mt={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:c,turnIndexByTurnIdByThreadId:lt,activeTurnIdByThreadId:Ue,activeReasoningTurnIdByThreadId:I,reasoningItemTextByItemId:y,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:S,appendLiveReasoningText:(h,g)=>M.appendLiveReasoningText(h,g),clearLiveReasoningSnapshot:h=>M.clearLiveReasoningSnapshot(h),savePersistedReasoningMap:qd},xt=T({}),It=T({}),dn=T({}),zn=T({}),sn=T({}),{accountRateLimitSnapshots:Ir,codexQuota:hr,refreshRateLimits:Uo,scheduleRateLimitRefresh:ln,setCodexRateLimit:or,stopRateLimitRefresh:Ar}=tO(),Pt=T(RL()),so=T(LL()),ar=T(ML()),Tn=T({}),Br=T(!1),Ln=T(!1),Pn=T(!1),Sn=T(new Set),Ca=6e4,mr=T([]);let Ur="";const Ot=T(!1);function io(h){var g;try{const _=new URL(h,"http://localhost");return _.pathname!=="/codex-local-image"?"":((g=_.searchParams.get("path"))==null?void 0:g.trim())??""}catch{return""}}function zo(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 Ho(h){var _;const g=o.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 Z=z.images.length-1;Z>=0;Z-=1){const W=((_=z.images[Z])==null?void 0:_.trim())??"";if(W&&io(W))return W}}return""}let Cn=null,Gt=null;const vr=new Map;let un=!1,qo=!1;const Jt=new Set;let lo=!1,Hn=!1;const fn=new Map,xa=new Set,pn=fO({selectedThreadId:n,projectGroups:e,inProgressById:D,applyThreadGroups:ua,hydrateWorkspaceRootsStateIfNeeded:Jn,loadThreadTitleCacheIfNeeded:Dr,loadWorkspaceRootsStateForThreadList:la,pruneThreadScopedState:Xo,setSelectedThreadId:gr}),Qt=Y(()=>Zn(e.value)),cn=Y(()=>Qt.value.find(h=>h.id===n.value)??null),{appendStashedMessage:rs,autoCompactThreshold:xn,clearQueueState:Fs,enqueueQueuedMessage:uo,findQueuedMessage:co,findStashedMessage:Wo,getStashedMessages:qn,loadPersistedQueueStateIfNeeded:Go,pruneQueueState:Vo,removeQueuedMessage:sr,reorderQueuedMessage:yt,scheduleQueueStateRefresh:hn,selectedThreadQueuedMessages:Nn,setAutoCompactThreshold:ka,takeStashedMessages:Wn}=uO(n),{hooksList:k,installedSkills:j,isHooksLoading:V,refreshHooks:be,refreshSkills:He}=oO({getSelectedCwd:()=>{var h;return((h=cn.value)==null?void 0:h.cwd)??""}}),$t=Y(()=>{const h=n.value;return!!(h&&so.value[h]===!0)}),_t=Y(()=>{const h=n.value;return h?xt.value[h]===!0:!1}),Xt=Y(()=>{const h=n.value;return h?Ue.value[h]??"":""}),qt=Y(()=>{var G;const h=n.value;if(!h)return null;const g=D.value[h]===!0,_=g?de.value[h]:void 0,L=g?(v.value[h]??"").trim():"",z=(((G=Te.value[h])==null?void 0:G.message)??"").trim();let Z="";if(!g&&z){const fe=o.value[h]??[];for(let Ie=fe.length-1;Ie>=0;Ie-=1){const ze=fe[Ie];if(ze.messageType==="turnError"){Z=Ja(ze.text);break}}}const W=!g&&z&&Z===z?"":z;return!g&&!_&&!L&&!W?null:{activityLabel:(_==null?void 0:_.label)||"Thinking",activityDetails:(_==null?void 0:_.details)??[],reasoningText:L,errorText:W}}),zr=Y(()=>{const h=n.value;return h?Pt.value[h]??null:null}),Ko=Y(()=>{const h=n.value;if(!h)return[];const g=o.value[h]??[],_=a.value[h]??[],L=i.value[h]??[],z=U.value[h]??[],Z=O.value[h]??[],W=l.value[h]??[],G=c.value[h]??[],fe=g.some(gn=>gn.messageType==="compaction.done"),Ie=Sn.value.has(h),ze=fe&&!Ie?W.filter(gn=>gn.messageType!=="compaction.pending"&&gn.messageType!=="compaction.done"):W,rt=TL(h,g,G,[_,z,Z,L],ze),ut=J.value[h],tt=ut?tL(rt,ut):rt,St=nL(tt,d.value[h]),Bt=ar.value[h]??[];return yO(St,Bt)}),Bs=Y(()=>{const h=n.value;return h?zn.value[h]??null:null}),mn=Y(()=>{const h=n.value;return h?Lt.value[h]===!0:!1}),Ia=Y(()=>{const h=n.value;return h?ro.value[h]===!0:!1});function Aa(h){var _;const g=o.value[h]??[];for(const L of g){const z=((_=L.turnId)==null?void 0:_.trim())??"";if(z)return z}return""}function gr(h,g={}){n.value!==h&&(n.value=h,g.persist!==!1&&$L(h),se(h),ae(h),Hn=!1)}function fo(h,g){const _=h.trim();if(!_)return;if(!g){if(!(_ in Pt.value))return;Pt.value=wt(Pt.value,_),Gd(Pt.value);return}const L=Pt.value[_];if(L&&JSON.stringify(L)===JSON.stringify(g))return;Pt.value={...Pt.value,[_]:g},Gd(Pt.value);const z=qn(_);z&&z.length>0&&xn.value>0&&(g.remainingContextPercent!==null&&g.remainingContextPercent<=xn.value?Sn.value.has(_)||Qn(_):bo(_))}function Yo(h,g){sn.value={...sn.value,[h]:g}}function hl(h,g,_){var ut;const L=h.trim(),z=g.trim(),Z=_.trim();if(!L||!Z||z===Z)return;const W=ar.value[L]??[],G=o.value[L]??[],fe=G.length,Ie=Tn.value[L],ze=W.length>0&&Ie!==void 0&&Ie===fe;let rt;if(ze){const tt=W[W.length-1];rt=[...W.slice(0,-1),{...tt,modelSwitchFrom:z||void 0,modelSwitchTo:Z}]}else{const tt=(ut=G[G.length-1])==null?void 0:ut.id,St={id:`model-switch:${L}:${Date.now()}:${W.length}`,role:"system",text:"",messageType:xy,modelSwitchFrom:z||void 0,modelSwitchTo:Z,...tt?{modelSwitchInsertAfterId:tt}:{}};rt=[...W,St].slice(-ky)}ar.value={...ar.value,[L]:rt},Tn.value={...Tn.value,[L]:fe},jL(ar.value)}function _a(h){const g=h.trim(),_=Pt.value[g];_&&_.modelContextWindow!==null&&(Pt.value={...Pt.value,[g]:{..._,modelContextWindow:null,remainingContextTokens:null,remainingContextPercent:null}},Gd(Pt.value))}function Jo(h){sn.value[h]&&(sn.value=wt(sn.value,h))}async function Pa(h){var _,L;if(xa.has(h))return;const g=sn.value[h];if(!(!g||g.fallbackRetried)){xa.add(h),Yo(h,{...g,fallbackRetried:!0});try{await De(h);try{const z=((L=(_=(o.value[h]??[]).reduce((Z,W)=>{const G=typeof W.turnIndex=="number"?W.turnIndex:-1,fe=Z!==null&&typeof Z.turnIndex=="number"?Z.turnIndex:-1;return G>=0&&G>fe?W:Z},null))==null?void 0:_.turnId)==null?void 0:L.trim())??"";if(z){const Z=await Rd(h,z);Yn(h,Z),oa(h),ta(h,[]),Wr(h),U.value[h]&&(U.value=wt(U.value,h))}}catch{}if(At(h,null),r.value="",yr(h,null),en(h,{label:"Thinking",details:Ne(Ao,g.effort,g.collaborationMode)}),kn(h,!0),nt.value[h]!==!0){const z=await hf(h);z.model&&N(h,Je(h,z.model,z.modelProvider)),z.modelProvider&&oe(h,z.modelProvider),nt.value={...nt.value,[h]:!0}}await Md(h,g.text,g.imageUrls,Ao,g.effort||void 0,g.skills.length>0?g.skills:void 0,g.fileAttachments,g.collaborationMode),ln(),Jt.add(h),await Vt()}catch(z){const Z=z instanceof Error?z.message:"Unknown application error";At(h,Z),r.value=Z,kn(h,!1),en(h,null)}finally{xa.delete(h)}}}function Zt(h){if(!h||typeof window>"u")return;const g=vr.get(h);g!==void 0&&(window.clearTimeout(g),vr.delete(h))}function Qo(h){if(!h||typeof window>"u")return;Zt(h);const g=window.setTimeout(()=>{vr.delete(h),Jt.add(h),Vt()},vO);vr.set(h,g)}function on(){const g=Za(t.value).map(_=>({projectName:_.projectName,threads:_.threads.map(L=>{const z=pe.value[L.id]??L.externalSession??null,Z=D.value[L.id]===!0||(z==null?void 0:z.active)===!0,W=ao(Ds(L.id)),G=n.value===L.id,fe=K.value[L.id]===!0,Ie=Uj(L.updatedAtIso,_e.value[L.id],Oe.value);return{...L,inProgress:Z,unread:!G&&!Z&&(fe||Ie),pendingRequestState:W,...z?{externalSession:z}:{}}})}));e.value=uc(e.value,g)}function po(h,g,_){const L=new Date().toISOString(),z=Ze(g),Z=Xr(z),W={id:h,title:_s(_),projectName:Z,cwd:z,hasWorktree:z.includes("/.codex/worktrees/")||z.includes("/.git/worktrees/"),createdAtIso:L,updatedAtIso:L,preview:_,unread:!1,inProgress:!1},G=t.value.findIndex(Ie=>Ie.projectName===Z);if(G>=0){const ze=t.value[G].threads.filter(tt=>tt.id!==h),rt={projectName:Z,threads:[W,...ze]},ut=[...t.value];ut.splice(G,1,rt),t.value=ut}else t.value=[{projectName:Z,threads:[W]},...t.value];const fe=Vi(he.value,t.value);Ga(he.value,fe)||bt(fe),on()}function Xo(h){const g=new Set(h.map(z=>z.id)),_=n.value.trim();_&&g.add(_),Se(g),R(g);const L=nn(_e.value,g);if(L!==_e.value&&(_e.value=L,sv(L)),$s(g),nt.value=nn(nt.value,g),lt.value=nn(lt.value,g),o.value=nn(o.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),J.value=nn(J.value,g),de.value=nn(de.value,g),Te.value=nn(Te.value,g),Ue.value=nn(Ue.value,g),I.size>0)for(const z of[...I.keys()])g.has(z)||I.delete(z);yL(g),xt.value=nn(xt.value,g),It.value=nn(It.value,g),dn.value=nn(dn.value,g),Vo(g),Pt.value=nn(Pt.value,g),K.value=nn(K.value,g),D.value=nn(D.value,g),oo(g)}function Zo(h){const g=Zn(t.value).find(_=>_.id===h);g&&(_e.value={..._e.value,[h]:g.updatedAtIso},sv(_e.value),K.value[h]&&(K.value=wt(K.value,h)),on())}function yr(h,g){if(!h)return;const _=J.value[h];if(g){if(Xj(_,g))return;J.value={...J.value,[h]:g}}else _&&(J.value=wt(J.value,h))}function Gn(h,g,_){if(!h||!g)return;const L={...d.value[h]??{}},z=Number.isFinite(_)?Math.max(0,Math.round(_)):0;z<=0?delete L[g]:L[g]=z,Object.keys(L).length===0?d.value=wt(d.value,h):d.value={...d.value,[h]:L},iv(d.value)}function kn(h,g){!h||D.value[h]===!0===g||(g?(D.value={...D.value,[h]:!0},_i(h)):(D.value=wt(D.value,h),Ea(h),ea(h),ls(h)?Qn(h):bo(h)),on(),!g&&!pn.hasActiveInProgressThreads()&&pn.hasRemainingThreadPages()&&pn.scheduleRemainingThreadPages())}function ea(h){h&&(xt.value[h]&&(xt.value=wt(xt.value,h)),It.value[h]&&(It.value=wt(It.value,h)),dn.value[h]&&(dn.value=wt(dn.value,h)))}function ml(h){h&&(xt.value={...xt.value,[h]:!0},It.value[h]&&(It.value=wt(It.value,h)),dn.value[h]&&(dn.value=wt(dn.value,h)))}function Vn(h){h&&xt.value[h]===!0&&It.value[h]===!0&&dn.value[h]===!0&&ea(h)}function os(h,g){!h||!g||xt.value[h]===!0&&ea(h)}function Us(h){const g=Object.keys(xt.value);if(g.length===0)return;let _=It.value,L=!1;for(const z of g)!h.has(z)||_[z]===!0||(_={..._,[z]:!0},L=!0);if(L){It.value=_;for(const z of g)Vn(z)}}function vl(h,g){h&&xt.value[h]===!0&&g.some(_=>_.role==="user")&&(dn.value[h]!==!0&&(dn.value={...dn.value,[h]:!0}),Vn(h))}function zs(h){h&&h!==n.value&&K.value[h]!==!0&&(K.value={...K.value,[h]:!0},on())}function en(h,g){if(!h)return;const _=de.value[h];if(!g){_&&(de.value=wt(de.value,h));return}const L=Vs(g.label)||"Thinking",z=g.details.map(G=>Vs(G)).filter(G=>G.length>0&&G!==L),Z=Array.from(new Set([...(_==null?void 0:_.details)??[],...z])).slice(-3),W={label:L,details:Z};Zj(_,W)||(de.value={...de.value,[h]:W})}function At(h,g,_={}){if(!h)return;const L=Te.value[h],z=g?Ja(g):"";if(!z){L&&(Te.value=wt(Te.value,h));return}const Z=_.transient===!0;(L==null?void 0:L.message)===z&&L.transient===Z||(Te.value={...Te.value,[h]:{message:z,transient:Z}})}function _r(h){var g;h&&(g=Te.value[h])!=null&&g.transient&&At(h,null)}function Hs(){const h=Object.entries(Te.value).filter(([,_])=>_==null?void 0:_.transient).map(([_])=>_);if(h.length===0)return;let g=Te.value;for(const _ of h)g=wt(g,_);Te.value=g}function wr(h){const g=Zn(t.value).find(_=>_.id===h);return(g==null?void 0:g.updatedAtIso)??""}function Kn(h,g){if(!h)return;const _={...so.value};g?_[h]=!0:delete _[h],so.value=_,NL(_)}function ho(){const h=n.value;h&&Kn(h,!$t.value)}function Yn(h,g){const _=o.value[h]??[];fl(_,g)||(o.value={...o.value,[h]:g})}function Pr(h,g,_=[],L=[],z=[]){const Z=o.value[h]??[],W={id:`optimistic-user:${h}:${Date.now()}`,role:"user",text:g,images:_.length>0?[..._]:void 0,skills:L.length>0?L.map(G=>({name:G.name,path:G.path})):void 0,fileAttachments:z.length>0?z.map(G=>({...G})):void 0,messageType:"userMessage.optimistic"};Yn(h,[...Z,W])}function ta(h,g){Vy(ir,h,g)}function as(h){CN(ir,h)}function mo(h,g){IN(ir,h,g)}function na(h,g){_N(ir,h,g)}function ra(h,g){AN(ir,h,g)}function Hr(h,g){M.setLiveReasoningText(h,g)}function qr(h,g){M.appendLiveReasoningText(h,g)}function _i(h){M.restoreLiveReasoningSnapshot(h)}function qs(h){zN(mt,h)}function Wr(h,g=!1){HN(mt,h,g)}function oa(h){h&&h in a.value&&(a.value=wt(a.value,h))}function Ws(h){h&&h in O.value&&(O.value=wt(O.value,h))}function Ea(h){if(!h)return;oa(h);const g=s.value[h];if(g&&g.messageType==="plan.live"){const _={...g,messageType:"plan",plan:g.plan?{...g.plan,isStreaming:!1}:g.plan};s.value={...s.value,[h]:_},Wy(s.value)}Wr(h),vL(h),en(h,null),n.value,U.value[h]&&(U.value=wt(U.value,h)),Ue.value[h]&&(Ue.value=wt(Ue.value,h)),Jo(h)}function Gs(h){var Ie;if(h.method!=="turn/plan/updated")return null;const g=Ve(h.params),_=Dn(h),L=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),Z=(Array.isArray(g==null?void 0:g.plan)?g==null?void 0:g.plan:[]).map(ze=>Ve(ze)).map(ze=>({step:Me(ze==null?void 0:ze.step),status:zL(ze==null?void 0:ze.status)})).filter(ze=>ze.step.length>0);if(!_||!L)return null;const G={explanation:Me(g==null?void 0:g.explanation).trim()||void 0,steps:Z,isStreaming:!0},fe=(Ie=lt.value[_])==null?void 0:Ie[L];return{threadId:_,message:{id:`${L}:plan`,role:"assistant",text:HL(G),messageType:"plan.live",plan:G,turnId:L||void 0,turnIndex:typeof fe=="number"?fe:void 0}}}function gl(h){var ze;if(h.method!=="item/plan/delta")return null;const g=Ve(h.params),_=Dn(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(!_||!L||!z)return null;const Z=`${L}:plan`,W=(a.value[_]??[]).find(rt=>rt.id===Z),G=`${(W==null?void 0:W.text)??""}${z}`,fe=W!=null&&W.plan?{...W.plan,isStreaming:!0}:void 0,Ie=(ze=lt.value[_])==null?void 0:ze[L];return{threadId:_,message:{id:Z,role:"assistant",text:G,messageType:"plan.live",plan:fe,turnId:L||void 0,turnIndex:typeof Ie=="number"?Ie:void 0}}}const ir={liveCommandsByThreadId:U,liveFileChangeMessagesByThreadId:O,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},Gr={turnIndexByTurnIdByThreadId:lt,persistedMessagesByThreadId:o,liveFileChangeMessagesByThreadId:O};function yl(h){if(h.method==="server/request"){const g=Gy(h.params);return g&&ns(g),!0}if(h.method==="server/request/resolved"){const g=Ve(h.params),_=g==null?void 0:g.id;return typeof _=="number"&&Number.isInteger(_)&&kr(_),!0}return!1}function Vs(h){return h.replace(/\s+/gu," ").trim()}function aa(h){return LN(Gr,h)}function Er(h,g,_){NN(Gr,h,g,_)}function vo(h,g){ON(Gr,h,g)}function br(h,g){return $N(Gr,h,g)}function sa(h){DN(Gr,h)}function C(h,g,_){GN(mt,h,g,_)}function E(h){VN(mt,h)}function x(h){var fe;if(h.method!=="item/started"&&h.method!=="item/completed")return null;const g=Ve(h.params),_=Ve(g==null?void 0:g.item);if(!_||Me(_.type).toLowerCase()!=="plan")return null;const L=Dn(h),z=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),Z=Me(_.id),W=Me(_.text);if(!L||!Z||!W)return null;const G=L&&z?(fe=lt.value[L])==null?void 0:fe[z]:void 0;return{threadId:L,message:{id:Z,role:"assistant",text:W,messageType:h.method==="item/completed"?"plan":"plan.live",plan:Cy(W)??void 0,turnId:z||void 0,turnIndex:typeof G=="number"?G:void 0}}}function X(h){var Ie;if(h.method!=="item/started")return null;const g=Ve(h.params),_=Ve(g==null?void 0:g.item);if(!_||_.type!=="commandExecution")return null;const L=Me(_.id),z=Me(_.command);if(!L)return null;const Z=typeof _.cwd=="string"?_.cwd:null,W=Dn(h),G=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),fe=W&&G?(Ie=lt.value[W])==null?void 0:Ie[G]:void 0;return{id:L,role:"system",text:z,messageType:"commandExecution",commandExecution:{command:z,cwd:Z,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:G||void 0,turnIndex:typeof fe=="number"?fe:void 0}}function Qe(h){var tt;if(h.method!=="item/completed")return null;const g=Ve(h.params),_=Ve(g==null?void 0:g.item);if(!_||_.type!=="commandExecution")return null;const L=Me(_.id),z=Me(_.command);if(!L)return null;const Z=typeof _.cwd=="string"?_.cwd:null,W=Me(_.status),G=W==="failed"?"failed":W==="declined"?"declined":W==="interrupted"?"interrupted":"completed",fe=typeof _.aggregatedOutput=="string"?_.aggregatedOutput:"",Ie=typeof _.exitCode=="number"?_.exitCode:null,ze=Dn(h),rt=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ut=ze&&rt?(tt=lt.value[ze])==null?void 0:tt[rt]:void 0;return{id:L,role:"system",text:z,messageType:"commandExecution",commandExecution:{command:z,cwd:Z,status:G,aggregatedOutput:fe,exitCode:Ie},turnId:rt||void 0,turnIndex:typeof ut=="number"?ut:void 0}}function Ft(h){var Ie;if(h.method!=="item/completed")return null;const g=Ve(h.params),_=Ve(g==null?void 0:g.item);if(!_||_.type!=="fileChange")return null;const L=Me(_.id);if(!L)return null;const z=Me(g==null?void 0:g.threadId),Z=Me(g==null?void 0:g.turnId),W=z&&Z?(Ie=lt.value[z])==null?void 0:Ie[Z]:void 0,G=df(_.changes),fe=Zg(_.status);return G.length===0||fe!=="completed"?null:{id:L,role:"system",text:"",messageType:"fileChange",fileChangeStatus:fe,fileChanges:G,turnId:Z||void 0,turnIndex:typeof W=="number"?W:void 0}}function En(h,g){PN(ir,h,g)}function Tr(h,g){EN(ir,h,g)}function tn(h,g){RN(ir,h,g)}function go(h){if(h.method==="item/agentMessage/delta")return!0;const g=Ve(h.params);if(!g)return!1;if(h.method==="item/completed"){const _=Ve(g.item);return(_==null?void 0:_.type)==="agentMessage"}return!1}const yo=new Set;function ia(h){for(const g of yo)try{g(h)}catch{}}function ss(h){return yo.add(h),()=>{yo.delete(h)}}function Pi(h,g,_){MN(ir,h,g,_)}function Ra(h,g,_){jN(ir,h,g,_)}function jc(h){var Mr,ji,Vr,bl,pu,jr,Li,Ni;if(yl(h))return;if(E(h),h.method==="turn/started"){const Re=Dn(h);Re&&S.delete(Re)}if(gO.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"){ia(h.method);return}if(h.method==="skills/changed"){He({force:!0});return}if(h.method==="hook/started"||h.method==="hook/completed"){be({force:!0});return}if(h.method==="thread/status/changed"){const Re=Dn(h);Re&&Re===n.value&&Jt.add(Re);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 Re=Ve(h.params),kt=Me(Re==null?void 0:Re.threadId);kt&&(h.method==="item/fileChange/patchUpdated"?Pi(kt,Me(Re==null?void 0:Re.itemId),df(Re==null?void 0:Re.changes)):Ra(kt,Me(Re==null?void 0:Re.turnId),Me(Re==null?void 0:Re.diff)??""),kt===n.value&&Jt.add(kt));return}if(h.method==="account/rateLimits/updated"&&ln(),h.method==="thread/name/updated"){const Re=Ve(h.params),kt=Me(Re==null?void 0:Re.threadId),Lr=Me(Re==null?void 0:Re.threadName);if(kt&&Lr){const Co=_s(Lr);$r.value={...$r.value,[kt]:Co},on(),sc(kt,Co)}}if(h.method==="thread/compacted"){const Re=Ve(h.params),kt=Me(Re==null?void 0:Re.threadId);kt&&(ps(kt,!1),fs(kt,"done"),Jt.add(kt));return}if(h.method==="fuzzyFileSearch/sessionUpdated"){const Re=Ve(h.params),kt=Me(Re==null?void 0:Re.sessionId);kt&&kt===Ur&&(mr.value=Yx(Re));return}if(h.method==="fuzzyFileSearch/sessionCompleted"){const Re=Ve(h.params),kt=Me(Re==null?void 0:Re.sessionId);kt&&kt===Ur&&(Ur="");return}if(h.method==="account/rateLimits/updated"){or(sy(h.params));return}const g=WL(h);if(g){fo(g.threadId,g.usage);return}const _=KL(h);_&&en(_.threadId,_.activity);const L=Dn(h),z=VL(h);!z&&L&&_r(L);const Z=YL(h);Z&&(fn.set(Z.turnId,Z),Er(Z.threadId,Z.turnId,aa(Z.threadId)),Ue.value={...Ue.value,[Z.threadId]:Z.turnId},os(Z.threadId,Z.turnId),oa(Z.threadId),Ws(Z.threadId),yr(Z.threadId,null),At(Z.threadId,null),kn(Z.threadId,!0),hn(Z.threadId),K.value[Z.threadId]&&(K.value=wt(K.value,Z.threadId)));const W=JL(h),G=GL(h),fe=(W==null?void 0:W.threadId)??Dn(h),Ie=fe?Ce(fe):"",ze=!!fe&&!!G&&Ie!==Ao&&Ou(new Error(G));if(W){sn.value[W.threadId];const Re=fn.get(W.turnId);Re&&fn.delete(W.turnId);const kt=Rs((Mr=Ve(h.params))==null?void 0:Mr.durationMs)??Rs((Vr=Ve((ji=Ve(h.params))==null?void 0:ji.turn))==null?void 0:Vr.durationMs)??(typeof W.startedAtMs=="number"?W.completedAtMs-W.startedAtMs:null)??(Re?W.completedAtMs-Re.startedAtMs:null),Lr=typeof kt=="number"?Math.max(0,kt):0;yr(W.threadId,{turnId:W.turnId,durationMs:Lr}),Gn(W.threadId,W.turnId,Lr),Ue.value[W.threadId]&&(Ue.value=wt(Ue.value,W.threadId)),kn(W.threadId,!1),en(W.threadId,null),zs(W.threadId),ze||(Jo(W.threadId),hn(W.threadId))}if(G){const Re=(W==null?void 0:W.threadId)||Dn(h);Re&&At(Re,G),r.value=G,Re&&ze&&Pa(Re)}else W&&At(W.threadId,null);if(z){const Re=L,kt=Re?Ce(Re):me.value.trim();Re&&At(Re,z.message,{transient:z.transient}),r.value=z.message,kt!==Ao&&Ou(new Error(z.message))&&(Re?Pa(Re):De())}const rt=Gs(h);rt&&(mo(rt.threadId,rt.message),en(rt.threadId,{label:"Planning",details:((bl=rt.message.plan)==null?void 0:bl.steps.map(Re=>Re.step).slice(0,2))??[]}));const ut=gl(h);ut&&(mo(ut.threadId,ut.message),en(ut.threadId,{label:"Planning",details:[]}));const tt=x(h);if(tt&&(mo(tt.threadId,tt.message),en(tt.threadId,{label:"Planning",details:((pu=tt.message.plan)==null?void 0:pu.steps.map(Re=>Re.step).slice(0,2))??[]})),!L||L!==n.value)return;rN(h);const St=oN(h);if(St){const Re=(i.value[L]??[]).find(fa=>fa.id===St.messageId),kt=`${(Re==null?void 0:Re.text)??""}${St.delta}`,Lr=St.turnId??(Re==null?void 0:Re.turnId),Co=Lr?(jr=lt.value[L])==null?void 0:jr[Lr]:Re==null?void 0:Re.turnIndex;na(L,{id:St.messageId,role:"assistant",text:kt,messageType:"agentMessage.live",turnId:Lr,turnIndex:typeof Co=="number"?Co:void 0})}const Bt=aN(h);if(Bt){const Re=Bt.turnId?(Li=lt.value[L])==null?void 0:Li[Bt.turnId]:void 0;na(L,{...Bt,turnIndex:typeof Re=="number"?Re:void 0})}const gn=lN(h);gn&&na(L,gn),QL(h)&&qs(L);const ms=XL(h);ms&&(qr(L,ms.delta),YN(mt,ms.itemId,ms.delta));const To=nN(h);if(To&&(C(L,To.itemId,To.text),qs(L)),ZL(h)){const Re=v.value[L]??"";Re.trim().length>0&&!Re.endsWith(`
76
-
77
- `)&&Hr(L,`${Re}
78
-
79
- `)}eN(h);const Na=X(h);Na&&(En(L,Na),en(L,{label:"Running command",details:[((Ni=Na.commandExecution)==null?void 0:Ni.command)??""]}));const oi=uN(h);if(oi){const Re=(U.value[L]??[]).find(kt=>kt.id===oi.itemId);Re!=null&&Re.commandExecution&&En(L,{...Re,commandExecution:{...Re.commandExecution,aggregatedOutput:`${Re.commandExecution.aggregatedOutput}${oi.delta}`}})}const yn=Qe(h);yn&&En(L,yn);const Xn=Ft(h);if(Xn&&ra(L,Xn),go(h)&&Wr(L,!0),h.method==="turn/completed"){Hn=!1,Wr(L),cv(mt),U.value[L]&&(U.value=wt(U.value,L));const Re=Dn(h);Re&&(Zt(Re),kn(Re,!1),en(Re,null),zs(Re),ze||(Jo(Re),hn(Re)))}}function cu(h){if(h.method==="thread/tokenUsage/updated"||h.method.startsWith("thread/realtime/"))return;const g=h.method,_=g==="turn/started"||g==="turn/completed"||g==="error",L=g.startsWith("thread/")||g==="turn/completed";if(!_&&!L)return;const z=Dn(h);z&&_&&Jt.add(z),L&&(un=!0,qo=!0),!(Gt!==null||typeof window>"u")&&(Gt=window.setTimeout(()=>{Gt=null,Vt()},Fu))}async function Jn(h,g){if(!lo){lo=!0;try{if(!g)return;const _=[];for(const L of Mc(g)){const z=ki(L);_.includes(z)||_.push(z)}if(_.length>0){const L=g.projectOrder.length>0?Vi(_,h):Vi(he.value,h);Ga(he.value,L)||bt(L,{persist:!1})}if(Object.keys(g.labels).length>0||(g.remoteProjects??[]).length>0){const L={...ke.value};let z=!1;for(const[Z,W]of Object.entries(g.labels)){const G=Ze(Z).trim(),fe=[ki(Z)];G&&fe.push(G);for(const Ie of fe)L[Ie]!==W&&(L[Ie]=W,z=!0)}for(const Z of g.order){const W=ki(Z),G=Xr(el(Z));if(!G.startsWith(".")||G===W)continue;const fe=`${W} ${G}`;L[W]!==void 0||L[W]===fe||(L[W]=fe,z=!0)}for(const Z of g.remoteProjects??[]){const W=uL(Z);L[Z.id]!==W&&(L[Z.id]=W,z=!0)}z&&ft(L,{persist:!1})}}catch{}}}async function la(){try{return await Ki()}catch{return null}}function wo(h,g){const _=Sf(h,g),L=pL(h,g),z=hL(L,g,_);if(!g||g.order.length===0&&(g.remoteProjects??[]).length===0)return z;const Z=new Set;for(const G of Tf(g,_))Z.add(G);const W=z.filter(G=>Z.has(G.projectName)?!0:xf(G));return fL(W,g,_)}function ua(h,g){const _=wo(h,g),L=!!(g&&(g.order.length>0||g.projectOrder.length>0||(g.remoteProjects??[]).length>0)),z=g!=null&&g.projectOrder.length?Vi(Tf(g,Sf(h,g)),_):Vi(he.value,_);Ga(he.value,z)||bt(z,{persist:!L});const Z=wf(_,he.value);Us(new Set(Zn(Z).map(fe=>fe.id)));const W=iL(t.value,Z,D.value);t.value=uc(t.value,W),D.value=nn(D.value,new Set(Zn(t.value).map(fe=>fe.id))),new Set(Zn(t.value).map(fe=>fe.id));const G={};for(const fe of Zn(t.value))G[fe.id]=fe.externalSession??pe.value[fe.id]??null;pe.value=G,on()}function On(h){pn.removeThreadFromLoadedLists(h),t.value=My(t.value,h),D.value=wt(D.value,h),on()}async function Ks(h={}){await Promise.allSettled([Ee({providerChanged:h.providerChanged,includeProviderModels:h.includeProviderModels}),Uo(),H(),He()])}function Ys(h={}){const g=()=>{Ks(h)};if(typeof window>"u"){g();return}window.setTimeout(g,0)}async function Ma(h={}){r.value="",ge.value="";const g=h.includeSelectedThreadMessages!==!1,_=h.awaitAncillaryRefreshes===!0;try{if(await Go(),await pn.loadThreads({force:h.forceThreadRefresh===!0}),g)try{await Yt(n.value)}catch(L){r.value=L instanceof Error?L.message:"Unknown application error"}_?await Ks({providerChanged:h.providerChanged,includeProviderModels:h.providerChanged===!0||_}):Ys({providerChanged:h.providerChanged,includeProviderModels:!1})}catch(L){r.value=L instanceof Error?L.message:"Unknown application error",Py(L)?ge.value=Ky:ge.value=""}}async function du(h){gr(h);try{return await Yt(h),await Ee({includeProviderModels:!0}),He(),"ok"}catch(g){const _=g instanceof Error?g.message:"Unknown application error";r.value=_;const L=Fj(g)?"not-found":"error";return h.trim()&&At(h,_,{transient:!0}),L}}async function ja(h){const g=n.value===h,_=g?Dj(Zn(e.value),h):"";g&&(gr(_),_&&Yt(_,{silent:!0}));try{await Jk(h),On(h),await pn.loadThreads(),g&&_&&n.value===_&&await gt(_,{silent:!0})}catch(L){r.value=L instanceof Error?L.message:"Unknown application error"}}async function Rr(h,g){const _=g.trim();if(!(!h||!_))try{await Zk(h,_),$r.value={...$r.value,[h]:_},on(),sc(h,_)}catch(L){r.value=L instanceof Error?L.message:"Unknown application error"}}async function ca(h){var W,G;const g=h.trim();if(!g)return"";const _=Zn(t.value).find(fe=>fe.id===g),L=((W=_==null?void 0:_.cwd)==null?void 0:W.trim())??"",z=((G=_==null?void 0:_.title)==null?void 0:G.trim())??"Forked chat",Z=Ce(g);r.value="";try{const fe=await mm(g,L||void 0,Z||void 0),Ie=fe.threadId.trim();return Ie?(po(Ie,L,z),N(Ie,fe.model),nt.value={...nt.value,[Ie]:!0},gr(Ie),await pn.loadThreads(),await Yt(Ie),Ie):""}catch(fe){return r.value=fe instanceof Error?fe.message:"Unknown application error",""}}async function vn(h,g){var W;const _=h.trim();if(!_||!Number.isInteger(g)||g<0)return"";if(D.value[_]===!0)return r.value="Finish the current turn before forking from a response.","";if(rr.value[_]!==!0)try{await Yt(_)}catch(G){return r.value=G instanceof Error?G.message:"Unknown application error",""}const L=o.value[_]??[];let z=-1;for(const G of L)typeof G.turnIndex=="number"&&Number.isFinite(G.turnIndex)&&(z=Math.max(z,G.turnIndex));if(z>=0&&g>z)return"";const Z=Zn(t.value).find(G=>G.id===_)??null;try{r.value="";const G=await mm(_),fe=G.threadId.trim();if(!fe)return"";const Ie=G.cwd.trim()||((W=Z==null?void 0:Z.cwd)==null?void 0:W.trim())||"",ze=mL((Z==null?void 0:Z.title)||(Z==null?void 0:Z.preview)||"Untitled thread");if(po(fe,Ie,ze),N(fe,G.model),Yn(fe,G.messages),rr.value={...rr.value,[fe]:!0},nt.value={...nt.value,[fe]:!0},oa(fe),ta(fe,[]),Wr(fe),U.value[fe]&&(U.value=wt(U.value,fe)),yr(fe,null),en(fe,null),At(fe,null),kn(fe,!1),z-g>0){const rt=G.messages.find(ut=>{var tt;return typeof ut.turnIndex=="number"&&ut.turnIndex>g&&!!((tt=ut.turnId)!=null&&tt.trim())});if(rt!=null&&rt.turnId){const ut=await Rd(fe,rt.turnId.trim());Yn(fe,ut)}}return await Rr(fe,ze),gr(fe),pn.loadThreads().catch(()=>{}),fe}catch(G){return r.value=G instanceof Error?G.message:"Unknown application error",""}}async function is(h,g,_=[],L=[],z=[]){if(!h||!g.trim()||_.length>0||L.length>0||z.length>0)return!1;const W=(Bo.value[h]??[]).filter(Ie=>Ie.method==="item/tool/requestUserInput");if(W.length!==1)return!1;const[G]=W,fe=yN(G);return fe.length!==1?!1:ni({id:G.id,result:{answers:{[fe[0]]:{answers:[g.trim()]}}}})}function ls(h){if(xn.value<=0||Sn.value.has(h))return!1;const g=Pt.value[h];return!g||g.remainingContextPercent===null?!1:g.remainingContextPercent<=xn.value}async function us(h,g,_,L,z,Z){if(ue||xn.value<=0||D.value[h]===!0)return!1;const W=Pt.value[h];if(!W||W.remainingContextPercent===null||W.remainingContextPercent>xn.value)return!1;const G=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,fe=Z==="plan"?"plan":Z==="default"?"default":A.value;return rs(h,{id:G,text:g,imageUrls:_,skills:L,fileAttachments:z,collaborationMode:fe}),Sn.value.has(h)||Qn(h),!0}async function bo(h){const g=qn(h);if(!g||g.length===0||D.value[h]===!0)return;const _=Wn(h);ue=!0;try{for(const L of _)try{await Ei(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments,void 0,L.collaborationMode)}catch{}}finally{ue=!1}}function cs(h){return h instanceof Error&&/ActiveTurnNotSteerable|cannot steer a \S+ turn|same-turn steering/i.test(h.message)}function ds(h){return h instanceof Error&&/expected active turn id/i.test(h.message)}async function Js(h,g,_,L,z,Z){const W=Ue.value[h]??"";if(W)try{await eI(h,W,g,_,L,z),Pr(h,g,_,L,z),Jt.add(h),await Vt(),Qo(h);return}catch(G){if(cs(G)){const fe=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;uo(h,{id:fe,text:g,imageUrls:_,skills:L,fileAttachments:z,collaborationMode:Z==="plan"?"plan":Z==="default"?"default":A.value});return}if(!ds(G))throw G}Pr(h,g,_,L,z),await wl(h,g,_,L,z,Z)}async function Ei(h,g=[],_=[],L="steer",z=[],Z,W){if(ee.value)return;const G=n.value,fe=h.trim();if(!G||!fe&&g.length===0&&z.length===0||await is(G,fe,g,_,z)||await us(G,fe,g,_,z,W))return;const Ie=D.value[G]===!0;if(Ie&&L==="queue"){const ze=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;uo(G,{id:ze,text:fe,imageUrls:g,skills:_,fileAttachments:z,collaborationMode:W==="plan"?"plan":W==="default"?"default":A.value},Z);return}if(Ie){Hn=!0,Js(G,fe,g,_,z,W).catch(ze=>{const rt=ze instanceof Error?ze.message:"Unknown application error";At(G,rt),r.value=rt});return}r.value="",Hn=!0,yr(G,null),Pr(G,fe,g,_,z),en(G,{label:"Thinking",details:Ne(Ce(G),re.value,W==="plan"?"plan":W==="default"?"default":A.value)}),At(G,null),kn(G,!0);try{await wl(G,fe,g,_,z,W)}catch(ze){Hn=!1,kn(G,!1),en(G,null);const rt=ze instanceof Error?ze.message:"Unknown application error";throw At(G,rt),r.value=rt,ze}}async function Lc(h,g,_=[],L=[],z=[]){if(ee.value)return"";const Z=h.trim(),W=g.trim(),G=Ce(ga).trim(),fe=A.value;if(!Z&&_.length===0&&z.length===0)return"";Br.value=!0,r.value="";let Ie="";try{try{const tt=await hm(W||void 0,G||void 0);Ie=tt.threadId,N(Ie,tt.model),oe(Ie,tt.modelProvider||ie.value),ne(Ie,fe)}catch(tt){if(G&&G!==Ao&&Ou(tt)){await De();const St=await hm(W||void 0,Ao);Ie=St.threadId,N(Ie,St.model),oe(Ie,St.modelProvider||ie.value),ne(Ie,fe)}else throw tt}if(!Ie)return"";po(Ie,W,Z||"[Image]"),Pr(Ie,Z,_,L,z),ml(Ie),nt.value={...nt.value,[Ie]:!0},gr(Ie),Hn=!0,yr(Ie,null),en(Ie,{label:"Thinking",details:Ne(Ce(Ie),re.value,fe)}),At(Ie,null),kn(Ie,!0);const ze=Ie,rt=W||null,ut=Z;return wl(Ie,Z,_,L,z,fe).catch(tt=>{Hn=!1,kn(Ie,!1),en(Ie,null);const St=tt instanceof Error?tt.message:"Unknown application error";At(Ie,St),r.value=St}).finally(()=>{Br.value=!1}),$o(ze,ut,rt,_,z),Ie}catch(ze){Hn=!1,Ie&&(kn(Ie,!1),en(Ie,null));const rt=ze instanceof Error?ze.message:"Unknown application error";throw Ie&&At(Ie,rt),r.value=rt,Br.value=!1,ze}}async function wl(h,g,_=[],L=[],z=[],Z){const W=re.value,G=Z==="plan"?"plan":Z==="default"?"default":A.value,fe=g.trim(),Ie=[..._];if(Ie.length===0&&zo(fe)){const ut=Ho(h);ut&&Ie.push(ut)}const ze=L.map(ut=>({name:ut.name,path:ut.path})),rt=z.map(ut=>({...ut}));Yo(h,{text:fe,imageUrls:[...Ie],skills:ze,fileAttachments:rt,effort:W,collaborationMode:G,fallbackRetried:!1});try{if(nt.value[h]!==!0){const St=Le(h),Bt=await hf(h);Bt.model&&!St&&N(h,Je(h,Bt.model,Bt.modelProvider)),Bt.modelProvider&&oe(h,Bt.modelProvider),nt.value={...nt.value,[h]:!0}}const ut=Ce(h);let tt="";try{tt=await Md(h,g,Ie,ut||void 0,W||void 0,L.length>0?L:void 0,z,G)}catch(St){if(ut&&ut!==Ao&&Ou(St))await De(h),Yo(h,{text:fe,imageUrls:[...Ie],skills:ze,fileAttachments:rt,effort:W,collaborationMode:G,fallbackRetried:!0}),tt=await Md(h,g,Ie,Ao,W||void 0,L.length>0?L:void 0,z,G);else throw St}tt&&(Ue.value={...Ue.value,[h]:tt},os(h,tt)),Jt.add(h),await Vt(),Qo(h)}catch(ut){throw ut}}async function Qs(){const h=n.value;if(!h||D.value[h]!==!0||xt.value[h]===!0)return;let g=Ue.value[h];if(!g){const{activeTurnId:Z}=await pf(h);g=Z,g&&(Ue.value={...Ue.value,[h]:g})}if(!g)throw new Error("Could not determine active turn id for interrupt");const _=Ko.value.filter(Z=>Z.turnId===g),L=_.find(Z=>Z.role==="user"),z=_.some(Z=>{if(Z.role==="assistant")return!0;const W=Z.messageType??"";return W==="commandExecution"||W==="toolCall"||W==="worked"||W==="fileChange"||W==="plan"||W==="plan.live"||W==="compaction.done"||W==="turnError"});Ln.value=!0,r.value="";try{if(await tI(h,g),kn(h,!1),en(h,null),At(h,null),Ue.value[h]&&(Ue.value=wt(Ue.value,h)),Jt.add(h),un=!0,await Vt(),L&&!z){const Z=(o.value[h]??[]).filter(G=>G.turnId!==g);Yn(h,Z);const W=c.value[h];if(W){const G=W.filter(fe=>fe.turnId!==g);G.length!==W.length&&(c.value={...c.value,[h]:G},qd(c.value))}zn.value={...zn.value,[h]:{text:L.text??"",imageUrls:L.images??[],fileAttachments:(L.fileAttachments??[]).map(G=>({label:G.label,path:G.path,fsPath:G.fsPath??G.path})),skills:L.skills??[]}}}}catch(Z){const W=Z instanceof Error?Z.message:"Failed to interrupt active turn";At(h,W),r.value=W}finally{Ln.value=!1}}function da(h){h&&zn.value[h]&&(zn.value=wt(zn.value,h))}async function Xs(h,g){if(!g)throw new Error("Cannot roll back: failed to resolve the turn id where the removal starts");return await Rd(h,g)}async function Zs(h){var _,L,z,Z,W;const g=n.value;if(g&&!Pn.value&&h.trim()){Pn.value=!0,r.value="";try{D.value[g]===!0&&await Qs();const G=o.value[g]??[],fe=G.find(St=>St.turnId===h),Ie=G.reduce((St,Bt)=>typeof Bt.turnIndex=="number"&&Bt.turnIndex>St?Bt.turnIndex:St,-1);if(Ie<0)return;let ze=typeof(fe==null?void 0:fe.turnIndex)=="number"?fe.turnIndex:((_=lt.value[g])==null?void 0:_[h])??-1;(ze<0||ze>Ie)&&(console.warn(`[rollback] turn ${h} not resolvable (index=${ze}), clamping to newest turn`),ze=Ie);let rt=((L=fe==null?void 0:fe.turnId)==null?void 0:L.trim())??"";if(!rt&&ze>=0){const St=lt.value[g]??{};rt=Object.keys(St).find(Bt=>St[Bt]===ze)??""}if(!rt){const St=G.reduce((Bt,gn)=>{const Mi=typeof gn.turnIndex=="number"?gn.turnIndex:-1,ms=Bt!==null&&typeof Bt.turnIndex=="number"?Bt.turnIndex:-1;return Mi>=0&&Mi>ms?gn:Bt},null);rt=((z=St==null?void 0:St.turnId)==null?void 0:z.trim())??""}const ut=await Xs(g,rt),tt=((W=(Z=cn.value)==null?void 0:Z.cwd)==null?void 0:W.trim())??"";if(tt){const St=await MA(g,h,tt);St.errors.length>0&&console.warn(`[rollback] file revert for ${g} left errors: ${St.errors.join("; ")}`)}Yn(g,ut),ta(g,[]),Wr(g),U.value[g]&&(U.value=wt(U.value,g)),yr(g,null),en(g,null),At(g,null),un=!0,await Vt()}catch(G){r.value=G instanceof Error?G.message:"Failed to rollback thread"}finally{Pn.value=!1}}}function fs(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 ps(h,g){const _=new Set(Sn.value);g?_.add(h):_.delete(h),Sn.value=_}function Rn(h){Ur=h.trim(),mr.value=[]}async function Qn(h){const g=h.trim();if(!(!g||Sn.value.has(g))){ps(g,!0),fs(g,"pending");try{await Xk(g);const _=2e3,L=14,z=Date.now()+Ca;let Z=0;for(;Date.now()<z&&Z<L&&Sn.value.has(g);){if((await pf(g)).messages.some(fe=>fe.messageType==="compaction.done")){ps(g,!1),n.value===g&&await Yt(g,{silent:!0,force:!0}),fs(g,"done"),bo(g);break}Z+=1,await $j(_)}Sn.value.has(g)&&(ps(g,!1),fs(g,"done"),bo(g))}catch(_){r.value=_ instanceof Error?_.message:"Failed to compact thread",ps(g,!1),fs(g,"done"),bo(g)}}}async function Vt(){if(Ot.value){typeof window<"u"&&Gt===null&&(Gt=window.setTimeout(()=>{Gt=null,Vt()},Fu));return}Ot.value=!0;const h=un,g=qo,_=new Set(Jt);un=!1,qo=!1,Jt.clear();try{h&&await pn.loadThreads({force:g});const L=n.value;if(!L)return;const z=_.has(L),Z=D.value[L]===!0,W=wr(L),G=ba.value[L]??"";(W.length>0&&W!==G||z||Z&&rr.value[L]!==!0||h&&rr.value[L]!==!0)&&await Yt(L,{silent:!0,force:z})}catch{}finally{Ot.value=!1,(un||Jt.size>0)&&typeof window<"u"&&Gt===null&&(Gt=window.setTimeout(()=>{Gt=null,Vt()},Fu))}}async function Nc(){await Fo(),un=!pn.hasLoadedThreads.value,n.value&&rr.value[n.value]!==!0&&Jt.add(n.value),await Vt()}function hs(h){const g=Ve(h.params),_=typeof(g==null?void 0:g.threadId)=="string"?g.threadId.trim():"";if(!_)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,[_]:z},kn(_,(z==null?void 0:z.active)===!0),on(),un=!0,n.value===_&&Jt.add(_),Gt===null&&typeof window<"u"&&(Gt=window.setTimeout(()=>{Gt=null,Vt()},Fu))}function ei(){typeof window>"u"||Cn||(Fo(),ti(),La(),Cn=CI(h=>{if(h.method==="ready"){Hs(),Nc();return}if(h.method==="externalSessionChanged"){hs(h);return}jc(h),cu(h)}))}async function ti(){try{const h=await RI(),g=Object.entries(h);if(g.length===0)return;const _={...c.value};let L=!1;for(const[z,Z]of g){const W=Z.filter(ze=>!!ze&&typeof ze.id=="string");if(W.length===0)continue;const G=_[z]??[],fe=new Set(G.map(ze=>ze.text)),Ie=[...G];for(const ze of W)fe.has(ze.text)||(Ie.push(ze),fe.add(ze.text));_[z]=Ie.slice(-20),L=!0}L&&(c.value=_,qd(_))}catch{}}async function La(){try{const h=await jI(),g=Object.entries(h);if(g.length===0)return;const _={...d.value};let L=!1;for(const[z,Z]of g){if(!z||!Z||typeof Z!="object"||Array.isArray(Z))continue;const W={};for(const[Ie,ze]of Object.entries(Z))!Ie||typeof ze!="number"||!Number.isFinite(ze)||ze<=0||(W[Ie]=Math.round(ze));if(Object.keys(W).length===0)continue;const G={..._[z]??{},...W},fe=Object.keys(G);_[z]=fe.length>200?Object.fromEntries(fe.slice(-200).map(Ie=>[Ie,G[Ie]])):G,L=!0}L&&(d.value=_,qy(h),iv(_))}catch{}}async function ni(h){try{return await xI(h.id,{result:h.result,error:h.error}),kr(h.id),Fr.value=wt(Fr.value,String(h.id)),!0}catch(g){const _=g instanceof Error?g.message:"Failed to reply to server request";return await Sa(h.id)?(r.value=_,Fr.value={...Fr.value,[String(h.id)]:_},!1):(kr(h.id),Fr.value=wt(Fr.value,String(h.id)),!0)}}function fu(){if(Cn&&(Cn(),Cn=null),un=!1,Jt.clear(),fn.clear(),Gt!==null&&typeof window<"u"&&(window.clearTimeout(Gt),Gt=null),Ar(),pn.dispose(),typeof window<"u")for(const h of vr.values())window.clearTimeout(h);vr.clear(),Hn=!1,o.value={},a.value={},i.value={},v.value={},c.value={},d.value={},U.value={},O.value={},lt.value={},de.value={},J.value={},Te.value={},Ue.value={},I.clear(),cv(mt),S.clear(),gL(),xt.value={},It.value={},dn.value={},Fs(),or(null),Pt.value={}}function Ri(h){const g=n.value;if(!g)return;const _=Wo(g,h);if(_){sr(h),le(_.collaborationMode),ue=!0,Ei(_.text,_.imageUrls,_.skills,"steer",_.fileAttachments).finally(()=>{ue=!1});return}const L=co(g,h);L&&(sr(h),le(L.collaborationMode),Ei(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments))}function ri(h,g={}){gr(h,g)}return{projectGroups:e,projectDisplayNameById:ke,selectedThread:cn,selectedThreadTokenUsage:zr,selectedThreadTerminalOpen:$t,isSelectedThreadInterruptPending:_t,selectedThreadServerRequests:ts,selectedLiveOverlay:qt,selectedActiveTurnId:Xt,lastPlanByThreadId:s,resolveThreadTurnIndex:br,codexQuota:hr,selectedThreadId:n,availableCollaborationModes:qe,availableModelIds:ye,availableModelReasoningEfforts:Pe,selectedCollaborationMode:A,selectedModelId:me,selectedReasoningEffort:re,selectedSpeedMode:Ae,codexCliMissingError:ge,installedSkills:j,accountRateLimitSnapshots:Ir,messages:Ko,hasMoreOlderMessages:mn,isLoadingThreads:pn.isLoadingThreads,isThreadListFullyLoaded:pn.isThreadListFullyLoaded,isLoadingMessages:Oo,slowOpenThreadId:Ta,isLoadingOlderMessages:Ia,isSendingMessage:Br,isInterruptingTurn:Ln,isUpdatingSpeedMode:ee,isRollingBack:Pn,compactingThreadIds:Sn,fuzzyFileSearchResults:mr,registerFuzzyFileSearchSession:Rn,error:r,refreshAll:Ma,refreshSkills:He,refreshHooks:be,hooksList:k,isHooksLoading:V,onRealtimeEvent:ss,selectThread:du,loadMessages:Yt,loadOlderMessages:no,ensureThreadMessagesLoaded:gt,setThreadTerminalOpen:Kn,toggleSelectedThreadTerminal:ho,archiveThreadById:ja,compactThreadById:Qn,renameThreadById:Rr,forkThreadById:ca,forkThreadFromTurn:vn,rollbackSelectedThread:Zs,sendMessageToSelectedThread:Ei,sendMessageToNewThread:Lc,interruptSelectedThreadTurn:Qs,interruptedUnsubmittedMessage:Bs,clearInterruptedUnsubmittedMessage:da,selectedThreadQueuedMessages:Nn,removeQueuedMessage:sr,reorderQueuedMessage:yt,steerQueuedMessage:Ri,autoCompactThreshold:xn,setAutoCompactThreshold:ka,setSelectedCollaborationMode:le,readModelIdForThread:Ce,setSelectedModelIdForThread:it,injectModelSwitchDivision:hl,invalidateThreadContextWindow:_a,setSelectedModelId:Xe,setSelectedReasoningEffort:ce,updateSelectedSpeedMode:je,respondToPendingServerRequest:ni,pendingReplyErrorForRequest:es,renameProject:We,removeProject:$e,reorderProject:Ge,pinProjectToTop:Ke,startPolling:ei,stopPolling:fu,primeSelectedThread:ri}}const Qy="codex-web-local.sidebar-collapsed.v1",Xy="codex-web-local.accounts-section-collapsed.v1";function bO(){return typeof window>"u"?!1:window.localStorage.getItem(Qy)==="1"}function TO(e){typeof window>"u"||window.localStorage.setItem(Qy,e?"1":"0")}function SO(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(Xy);return e===null?!0:e==="1"}function CO(){const e=T(bO()),t=T(SO()),n=T(""),r=T(!1),o=T(null),a=T(null);let s=0,i=0,l=!1;function c(O){var D;if(e.value!==O){if(O){const q=(D=f())==null?void 0:D.scrollTop;typeof q=="number"&&(q>0||s===0)&&(s=q)}e.value=O,TO(O),O||S()}}function d(){r.value=!r.value,r.value?Nt(()=>{var O;return(O=a.value)==null?void 0:O.focus()}):n.value=""}function v(){var O;n.value="",(O=a.value)==null||O.focus()}function f(){return o.value?o.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function y(O){if(e.value||l)return;const q=(O==null?void 0:O.currentTarget)&&typeof HTMLElement<"u"&&O.currentTarget instanceof HTMLElement?O.currentTarget:f();s=(q==null?void 0:q.scrollTop)??s}function S(){const O=++i,D=s,q=90;l=!0;const M=()=>{O===i&&(s=D,l=!1)},pe=ue=>{if(O!==i)return;if(e.value){M();return}const K=f();if(K&&(K.scrollTop=D,Math.abs(K.scrollTop-D)<=1||ue>=q)){M();return}if(ue>=q||typeof window>"u"){M();return}window.requestAnimationFrame(()=>pe(ue+1))};Nt(()=>pe(0))}function I(O){O.key==="Escape"&&(r.value=!1,n.value="")}function U(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(Xy,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:r,sidebarScrollableRef:o,sidebarSearchInputRef:a,setSidebarCollapsed:c,toggleSidebarSearch:d,clearSidebarSearch:v,onSidebarScroll:y,onSidebarSearchKeydown:I,restoreSidebarScrollPosition:S,toggleAccountsSectionCollapsed:U}}const Zy="codex-web-local.right-panel-width.v1",xO=260,kO=640,fv=320;function ew(e){return Math.min(kO,Math.max(xO,e))}function IO(){if(typeof window>"u")return fv;const e=window.localStorage.getItem(Zy),t=Number(e);return Number.isFinite(t)?ew(t):fv}function AO(e){typeof window>"u"||window.localStorage.setItem(Zy,String(e))}function _O(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:r}=e,o=T("git"),a=T([]),s=T(""),i=Y(()=>a.value.find(ge=>ge.key===s.value)??null),l=T(!1),c=T(!1),d=T(!1),v=T(IO()),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 ee=ge.clientX,me=v.value,re=De=>{const Ne=ee-De.clientX;v.value=ew(me+Ne)},Ae=()=>{AO(v.value),window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",Ae)};window.addEventListener("mousemove",re),window.addEventListener("mouseup",Ae)}function D(){n()&&(t()&&!c.value&&(c.value=!0),t()||(d.value=!1),o.value=o.value==="terminal"?"git":"terminal",o.value!=="terminal"&&U())}function q(ge){o.value=ge,l.value=!1,t()||(d.value=!1),t()&&(c.value=!0),ge!=="terminal"&&U()}function M(ge){const ee=a.value.find(me=>me.path===ge.path);if(ee)s.value=ee.key;else{const me={key:`preview-${Date.now()}`,path:ge.path,label:ge.label};a.value=[...a.value,me],s.value=me.key}q("preview")}function pe(ge){a.value.some(ee=>ee.key===ge)&&(s.value=ge,q("preview"))}function ue(ge){const ee=a.value.findIndex(Ae=>Ae.key===ge);if(ee<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="",o.value="files";return}const re=me[Math.min(ee,me.length-1)];s.value=re.key}function K(){if(t()){c.value=!1;return}d.value=!0,l.value=!1,U()}function ie(){if(t()){c.value=!c.value;return}d.value=!d.value,d.value&&(l.value=!1,U())}function ye(){o.value="git",t()&&(c.value=!1),U()}function Pe(ge){if(f.value=ge,!ge){y.value=!1,I();return}y.value=!0,I(),S=setTimeout(()=>{S=null,r()||(y.value=!1)},1500)}return{activeRightPanelTab:o,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:c,isRightPanelCollapsed:d,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:y,onRightResizeHandleMouseDown:O,toggleRightPanelTerminal:D,selectRightPanelTab:q,onOpenFilePreview:M,selectFilePreviewTab:pe,closeFilePreviewTab:ue,onCloseRightPanel:K,onToggleRightPanelToggle:ie,onHideRightPanelTerminal:ye,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:U,clearTerminalKeyboardFocusFallbackTimer:I}}function PO(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 EO(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!PO(e))throw new Error("Copy failed")}const RO=400;function MO(e,t,n,r){return e==="visible"&&!n&&t!==null&&r-t>=RO}const jO=[[/(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 tw(e){return e.trim().toLowerCase()}function LO(e,t){return t.reduce((n,[r,o])=>n+(r.test(e)?o:0),0)}function pv(e){return e.activeCount*1e3+(e.isNoAuth?300:0)+e.toolsCount*3+e.triggersCount*4+LO(`${e.name} ${e.slug} ${e.description}`,jO)}function NO(e,t){const n=tw(t);if(!n)return 0;const r=e.name.toLowerCase(),o=e.slug.toLowerCase();return r===n||o===n?1e6:r.replace(/\s+/gu,"")===n.replace(/\s+/gu,"")?9e5:r.startsWith(n)||o.startsWith(n)?8e5:r.includes(n)||o.includes(n)?7e5:0}function Hi(e){return e.activeCount>0?0:e.totalConnections>0?1:e.isNoAuth?2:3}function eB(e,t,n=""){const r=tw(n),o=a=>NO(a,r);return t==="name"?[...e].sort((a,s)=>o(s)-o(a)||Hi(a)-Hi(s)||a.name.localeCompare(s.name)):t==="date"?[...e].sort((a,s)=>o(s)-o(a)||Hi(a)-Hi(s)||a.name.localeCompare(s.name)):[...e].sort((a,s)=>o(s)-o(a)||Hi(a)-Hi(s)||pv(s)-pv(a)||a.name.localeCompare(s.name))}function OO(e,t){var a;const n=e.lastIndexOf(":"),r=n>=0?e.slice(n+1):e,o=t.find(s=>s.name===e)??t.find(s=>s.name===r||s.name.endsWith(`:${r}`));return((a=o==null?void 0:o.path)==null?void 0:a.trim())??""}function $O(e,t){const n=[];for(const r of e){const o=r.name.trim();if(!o)continue;const a=(r.path??"").trim()||OO(o,t);a&&n.push({name:o,path:a})}return n}const DO={class:"sidebar-root"},FO=["aria-pressed","aria-label","title"],BO={key:1,class:"sidebar-search-bar"},UO=["placeholder"],zO=["aria-label"],HO={class:"sidebar-skills-link-icon","aria-hidden":"true"},qO={class:"sidebar-skills-link-copy"},WO={class:"sidebar-skills-link-title"},GO={class:"sidebar-skills-link-subtitle"},VO={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},KO={class:"sidebar-skills-link-copy"},YO={class:"sidebar-skills-link-title"},JO={class:"sidebar-skills-link-subtitle"},QO={class:"sidebar-settings-actions"},XO=["title","aria-label"],ZO=["title","aria-label"],e$={class:"content-root-wrap"},t$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},n$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},r$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},o$=["aria-label","title"],a$={class:"content-body"},s$={key:2,class:"content-grid content-grid-home"},i$={class:"new-thread-empty"},l$={class:"new-thread-hero"},u$=["title"],c$={class:"new-thread-folder-actions"},d$=["disabled"],f$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},p$={class:"new-thread-launch-card-copy"},h$={class:"new-thread-launch-card-topline"},m$={class:"new-thread-launch-card-badge","aria-hidden":"true"},v$={class:"new-thread-launch-card-eyebrow"},g$={class:"new-thread-launch-card-title"},y$={class:"new-thread-launch-card-text"},w$={class:"new-thread-launch-card-actions"},b$=["aria-label","onKeydown"],T$={class:"new-thread-open-folder-header"},S$={class:"new-thread-open-folder-title"},C$={class:"new-thread-open-folder-label"},x$={class:"new-thread-open-folder-current"},k$=["placeholder","title","disabled","onKeydown"],I$=["disabled"],A$={class:"new-thread-open-folder-actions"},_$={class:"new-thread-open-folder-toggle"},P$=["aria-pressed","disabled"],E$={key:0,class:"new-thread-open-folder-create"},R$={class:"new-thread-open-folder-create-composer"},M$=["placeholder","onKeydown"],j$=["disabled"],L$={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},N$=["href"],O$=["placeholder","onKeydown"],$$={key:1,class:"new-thread-open-folder-error-actions"},D$={class:"new-thread-open-folder-error visible-error-with-feedback"},F$=["href"],B$=["disabled"],U$={key:2,class:"new-thread-open-folder-status"},z$={key:3,class:"new-thread-open-folder-status"},H$={key:4,class:"new-thread-open-folder-list"},q$=["title","disabled","onClick"],W$={class:"new-thread-open-folder-item-name"},G$=["disabled","onClick"],V$=["aria-label","onKeydown"],K$={class:"new-thread-open-folder-header"},Y$={class:"new-thread-open-folder-title"},J$=["disabled"],Q$=["aria-label"],X$=["aria-selected","disabled"],Z$=["aria-selected","disabled"],eD={class:"new-thread-project-field"},tD={class:"new-thread-open-folder-label"},nD=["disabled","placeholder"],rD={key:0,class:"new-thread-project-field"},oD={class:"new-thread-open-folder-label"},aD=["disabled","placeholder","onKeydown"],sD={key:1,class:"new-thread-project-field"},iD={class:"new-thread-open-folder-label"},lD=["disabled","onKeydown"],uD={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},cD=["href"],dD={class:"new-thread-project-modal-actions"},fD=["disabled"],pD=["disabled"],hD={key:3,class:"new-thread-branch-select"},mD={class:"new-thread-branch-select-label"},vD={class:"new-thread-branch-select-help"},gD={key:4,class:"new-thread-runtime-help"},yD={class:"worktree-init-status-title"},wD={class:"worktree-init-status-message"},bD={class:"composer-with-queue"},TD={key:0,class:"composer-runtime-error",role:"alert"},SD=["href"],CD={key:3,class:"content-grid"},xD={class:"content-thread"},kD={key:0,class:"external-session-banner",role:"alert"},ID={key:1,class:"composer-runtime-error",role:"alert"},AD=["href"],_D={key:2,class:"interrupt-recovered-banner",role:"status"},PD=["aria-label"],ED={class:"content-right-panel-header"},RD={class:"content-right-panel-tabs",role:"tablist"},MD=["aria-selected"],jD=["aria-selected"],LD=["aria-selected","title","onClick"],ND={class:"content-right-panel-tab-label"},OD=["aria-label","title","onClick"],$D={class:"content-right-panel-actions"},DD={class:"content-right-panel-add-wrap"},FD=["aria-label","title"],BD={key:0,class:"content-right-panel-menu"},UD=["aria-label","title"],zD={class:"content-right-panel-body"},HD={key:0,class:"project-zip-modal-backdrop",role:"presentation"},qD=["aria-label"],WD={class:"project-zip-modal-header"},GD={class:"project-zip-modal-title"},VD=["aria-label","disabled"],KD={class:"project-zip-modal-copy"},YD={class:"project-zip-progress-label",role:"status","aria-live":"polite"},JD={class:"project-zip-progress-track"},QD={key:0,class:"project-zip-modal-error",role:"alert"},XD={class:"project-zip-modal-actions"},ZD=["disabled"],eF=["disabled"],tF=["disabled"],nF=["aria-label"],rF={class:"codex-login-modal-header"},oF={class:"codex-login-modal-title"},aF=["aria-label","disabled"],sF={class:"codex-login-modal-copy"},iF=["href"],lF=["placeholder","disabled"],uF={key:1,class:"codex-login-modal-error visible-error-with-feedback"},cF=["href"],dF={class:"codex-login-modal-actions"},fF=["disabled"],pF=["disabled"],hF=400,hv="codex-web-local.send-with-enter.v1",mv="codex-web-local.in-progress-send-mode.v1",vv="codex-web-local.dark-mode.v1",gv="codex-web-local.dictation-click-to-toggle.v1",yv="codex-web-local.dictation-auto-send.v1",wv="codex-web-local.dictation-language.v1",bv="codex-web-local.chat-width.v1",mF=bn({__name:"App",setup(e){var Xp,Zp;const t=ko(()=>Io(()=>import("./ThreadConversation-9sr4DxKg.js"),__vite__mapDeps([0,1,2]))),n=ko(()=>Io(()=>import("./ThreadTerminalPanel-D13KPZ88.js"),__vite__mapDeps([3,4]))),r=ko(()=>Io(()=>import("./ReviewPane-Dgmjqhm5.js"),__vite__mapDeps([5,6]))),o=ko(()=>Io(()=>import("./DirectoryHub-ky-MNTyn.js"),__vite__mapDeps([7,1,8]))),a=ko(()=>Io(()=>import("./AutomationsPanel-MrvbWVMR.js"),__vite__mapDeps([9,10]))),s=ko(()=>Io(()=>import("./SettingsDialog-BGT0xELN.js"),__vite__mapDeps([11,12]))),i=ko(()=>Io(()=>import("./RightGitPanel-Blhf_dam.js"),__vite__mapDeps([13,14]))),l=ko(()=>Io(()=>import("./RightFilesPanel-DZUnVVyu.js"),__vite__mapDeps([15,16]))),c=ko(()=>Io(()=>import("./RightFilePreview-CYPdkP5X.js"),__vite__mapDeps([17,18]))),d=ko(()=>Io(()=>import("./ThreadPendingRequestPanel-CiFTnhF6.js"),__vite__mapDeps([19,20]))),v=ko(()=>Io(()=>import("./QueuedMessages-D1zNlWJ3.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:y,uiLanguageOptions:S,setUiLanguage:I}=wa(),U="codex-mobile",O="0.1.127",D={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:K,selectedThreadServerRequests:ie,selectedLiveOverlay:ye,lastPlanByThreadId:Pe,resolveThreadTurnIndex:ge,selectedActiveTurnId:ee,codexQuota:me,selectedThreadId:re,availableCollaborationModes:Ae,availableModelIds:De,availableModelReasoningEfforts:Ne,selectedCollaborationMode:Le,selectedReasoningEffort:xe,selectedSpeedMode:Se,codexCliMissingError:Ce,installedSkills:Ee,accountRateLimitSnapshots:Je,messages:Xe,hasMoreOlderMessages:it,isLoadingThreads:ce,isThreadListFullyLoaded:N,isLoadingMessages:oe,slowOpenThreadId:se,isLoadingOlderMessages:je,isSendingMessage:qe,isInterruptingTurn:A,isSelectedThreadInterruptPending:R,isUpdatingSpeedMode:H,error:le,refreshAll:ne,refreshSkills:ae,refreshHooks:_e,hooksList:Oe,isHooksLoading:ke,onRealtimeEvent:he,selectThread:Ke,ensureThreadMessagesLoaded:$e,loadMessages:We,loadOlderMessages:Ge,archiveThreadById:ft,compactThreadById:bt,compactingThreadIds:nt,fuzzyFileSearchResults:lt,registerFuzzyFileSearchSession:J,forkThreadById:de,renameThreadById:Te,forkThreadFromTurn:Ue,sendMessageToSelectedThread:Tt,sendMessageToNewThread:gt,interruptSelectedThreadTurn:Lt,interruptedUnsubmittedMessage:Oo,clearInterruptedUnsubmittedMessage:Yt,selectedThreadQueuedMessages:no,removeQueuedMessage:rr,reorderQueuedMessage:ba,steerQueuedMessage:ro,autoCompactThreshold:$s,setAutoCompactThreshold:Ta,setSelectedCollaborationMode:Xa,readModelIdForThread:$r,setSelectedModelIdForThread:Za,injectModelSwitchDivision:Dr,invalidateThreadContextWindow:$o,setSelectedReasoningEffort:Do,updateSelectedSpeedMode:Ds,respondToPendingServerRequest:Fo,pendingReplyErrorForRequest:Fr,renameProject:es,removeProject:Sa,reorderProject:Bo,pinProjectToTop:oo,startPolling:ao,stopPolling:kr,primeSelectedThread:ts,rollbackSelectedThread:ns}=wO(),mt=Ex(),xt=Px(),{isMobile:It}=Zf();function dn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const zn=T(null),sn=T(null),Ir=T(null);let hr=null;const{buildFeedbackMailto:Uo,feedbackMailtoBase:ln,recordVisibleFailure:or}=yy(),Ar=ln();function Pt(u,p){p&&or(p);const b=u.currentTarget;b instanceof HTMLAnchorElement&&(b.href=Uo())}const so=T(null),ar=T(null),Tn=T(null),Br=T(0);let Ln=null;function Pn(){const u=Tn.value;if(!u)return;const p=window.getComputedStyle(u),b=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),$=Math.max(0,u.clientWidth-(Number.isFinite(b)?b:0)),Q=p.getPropertyValue("--chat-column-max").trim(),we=Number.parseFloat(Q)*(Q.endsWith("rem")?16:1),Be=Number.isFinite(we)&&we>0?Math.min($,we):$;Br.value=Be}const Sn=T(null),Ca=T(null),mr=T(!0),Ur=_O({isMobile:()=>It.value,canShowRightPanel:()=>mu.value,isVirtualKeyboardOpen:()=>Sl.value}),{activeRightPanelTab:Ot,filePreviewTabs:io,activeFilePreviewTabKey:zo,activeFilePreviewTab:Ho,isRightPanelMenuOpen:Cn,isMobileRightPanelOpen:Gt,isRightPanelCollapsed:vr,rightPanelWidth:un,isTerminalInputFocused:qo,isTerminalKeyboardFocusFallbackActive:Jt,onRightResizeHandleMouseDown:lo,toggleRightPanelTerminal:Hn,selectRightPanelTab:fn,onOpenFilePreview:xa,selectFilePreviewTab:pn,closeFilePreviewTab:Qt,onCloseRightPanel:cn,onToggleRightPanelToggle:rs,onHideRightPanelTerminal:xn,onTerminalFocusChange:Fs,resetTerminalKeyboardFocusState:uo,clearTerminalKeyboardFocusFallbackTimer:co}=Ur,Wo=T(null),qn=T(!1),Go=T("");let Vo=!1;const sr=T(!1),yt=T(""),hn=T("local"),Nn=T({}),ka=new Map,Wn=T(""),k=T([]),j=T(!1),V=T({order:[],labels:{},projectOrder:[]}),be=T({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),He=T({phase:"idle",title:"",message:""}),$t=CO(),{isSidebarCollapsed:_t,isAccountsSectionCollapsed:Xt,sidebarSearchQuery:qt,isSidebarSearchVisible:zr,sidebarScrollableRef:Ko,sidebarSearchInputRef:Bs,setSidebarCollapsed:mn,toggleSidebarSearch:Ia,clearSidebarSearch:Aa,onSidebarScroll:gr,onSidebarSearchKeydown:fo,toggleAccountsSectionCollapsed:Yo}=$t,hl=T(null),_a=T(null),Jo=T(null),Pa=T(null);let Zt=null,Qo=0,on=0,po=0,Xo=0;const Zo=T("New Project (1)"),yr=T(""),Gn=T(!1),kn=T("general");let ea=0;function ml(){if(Gn.value){ea=Date.now(),Gn.value=!1;return}Date.now()-ea<hF||(Gn.value=!0)}const Vn=T(!1),os=T(!1),Us=T(new Set);async function vl(){try{Us.value=new Set(await pI())}catch{}finally{os.value=!0}}const zs=Y(()=>!os.value||Us.value.has("hooks/list")),en=Y(()=>!os.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>Us.value.has(u)));ot(Gn,u=>{u&&(_e(),Wr(),en.value&&Gs())});const At=T({enabled:!1,clients:[]}),_r=T(null),Hs=T(!1),wr=T(!1),Kn=T(""),ho=T(""),Yn=T("");let Pr=null,ta=!1,as=null;const mo=T("never"),na=T(!1),ra=T(!1),Hr=T(""),qr=T("");let _i=!1;const qs=T(!1);async function Wr(u={}){if(!(u.force!==!0&&_i)){na.value=!0,Hr.value="";try{mo.value=await KI(),_i=!0}catch(p){Hr.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{na.value=!1}}}function oa(u){mo.value=u}async function Ws(){ra.value=!0,Hr.value="",qr.value="";try{await YI(mo.value),qs.value=!0,qr.value=f("Approval policy saved"),Ea&&clearTimeout(Ea),Ea=setTimeout(()=>{qr.value=""},2200)}catch(u){Hr.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{ra.value=!1}}let Ea=null;async function Gs(u={}){if(!(u.force!==!0&&ta)){Hs.value=!0,ho.value="";try{const p=await VI();At.value=p,ta=!0}catch(p){ho.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{Hs.value=!1}}}async function gl(){const u=!At.value.enabled;wr.value=!0,Kn.value=u?"enable":"disable";try{await JI(u),At.value={...At.value,enabled:u},Vs(u?"Remote control enabled":"Remote control disabled")}catch(p){ho.value=p instanceof Error?p.message:"Failed to update remote control"}finally{wr.value=!1,Kn.value=""}}async function ir(){wr.value=!0,Kn.value="pairing";try{_r.value=await QI()}catch(u){ho.value=u instanceof Error?u.message:"Failed to start pairing"}finally{wr.value=!1,Kn.value=""}}async function Gr(){wr.value=!0,Kn.value="clients";try{At.value={...At.value,clients:await XI()}}catch(u){ho.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{wr.value=!1,Kn.value=""}}async function yl(u){wr.value=!0,Kn.value=`revoke:${u}`;try{await ZI(u),At.value={...At.value,clients:At.value.clients.filter(p=>p.clientId!==u)},Vs("Remote client removed")}catch(p){ho.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{wr.value=!1,Kn.value=""}}function Vs(u){Yn.value=u,Pr&&clearTimeout(Pr),Pr=setTimeout(()=>{Yn.value=""},3e3)}const aa=T(""),Er=T(""),vo=T([]),br=T(null),sa=T(null),C=T(null),E=T(null),x=T(!1),X=T(!1),Qe=T({addedLineCount:0,removedLineCount:0}),Ft=T([]),En=T(""),Tr=T({}),tn=T(""),go=T(""),yo=T({}),ia=T(""),ss=T(""),Pi=T(!1),Ra=T(!1);function jc(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const cu=T(null),Jn=T([]),la=T(!1),wo=T(!1),ua=T(!1),On=T(!1),Ks=T(!1),Ys=T(""),Ma=T(""),du=T(null),ja=T(""),Rr=T(""),ca=T(""),vn=T(""),is=T(id(hv,!0)),ls=T(pT()),us=T(fT()),bo=T(hT()),cs=T(id(gv,!1)),ds=T(id(yv,!0)),Js=T(ET()),Ei=Y(()=>RT()),Lc=Y(()=>{const{loaded:u,total:p}=be.value,b=Pp(u);return p&&p>0?`${b} / ${Pp(p)}`:u>0?b:f("Preparing...")}),wl=Y(()=>{const{loaded:u,total:p,phase:b}=be.value;return b==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),Qs=T(!1),da=T(!1),Xs=T(!1),Zs=T(""),fs=T(!1),ps=T(null),Rn=T(!1),Qn=T(""),Vt=T("codex"),Nc=Y(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),hs=T(""),ei=T(""),ti=T("responses"),La=T("responses"),ni=T(""),fu=T(!1),Ri=T(""),ri=T(""),h=T(""),g=T(!1),_=T(!1),L=T(""),z=T(""),Z=T(!1),W=T(!1),G=T("create"),fe=T(""),Ie=T(""),ze=T(""),rt=T(!1),ut=T(""),tt=T(!1),St=T(null),Bt=T(null),gn=T(!1),Mi=T(null),ms=T(null),To=T(""),So=T(""),Na=T(""),oi=T([]),yn=T(""),Xn=T(!1),Mr=T(!1),ji=T(!1),Vr=T(""),bl=[le,Ce,En,go,vn,Qn,h,z,ut,yn],pu=Y(()=>bl.some(u=>u.value.trim().length>0)),jr=T({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Li=T(null),Ni=T(!1),Re=T(!1),kt=T(typeof window<"u"?((Xp=window.visualViewport)==null?void 0:Xp.height)??window.innerHeight:0),Lr=T(typeof window<"u"?((Zp=window.visualViewport)==null?void 0:Zp.offsetTop)??0:0),Co=T(typeof window<"u"?window.innerHeight:0);let fa=null,Oc=!1,$c=!1,Dc=!1,Tl=0;const ai=Y(()=>{const u=mt.params.threadId;return typeof u=="string"?u:""}),In=Y(()=>mt.name==="home"),vs=Y(()=>mt.name==="skills"),si=Y(()=>mt.name==="automations"),cp=Y(()=>{const u=mt.query.automationId;return typeof u=="string"?u:""}),nw=Y(()=>{var u;return si.value?f("Automations"):vs.value?f("Skills"):In.value?f("Start new thread"):((u=ue.value)==null?void 0:u.title)??f("Choose a thread")}),rw=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",ow=Y(()=>{var p,b;return(((b=(p=ue.value)==null?void 0:p.title)==null?void 0:b.trim())??"")||rw}),Oi=Y(()=>Xe.value.filter(u=>{const p=LT(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),Fc=T([]);ot(()=>[Oi.value,oe.value],([u,p])=>{p||(Fc.value=u)},{immediate:!0});const aw=Y(()=>oe.value&&Fc.value.length>0?Fc.value:Oi.value),dp=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Bc=T(null);function sw(u,p,b){const $=typeof p.turnIndex=="number"?p.turnIndex:-1;return $<0?!1:u.some((Q,we)=>we>b&&typeof Q.turnIndex=="number"&&Q.turnIndex>=$&&dp.has(Q.messageType??""))}function iw(u,p){return u.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=p&&dp.has(b.messageType??""))}const Uc=Y(()=>{const u=Oi.value,p=oe.value;for(let we=u.length-1;we>=0;we-=1){const Be=u[we];if(Be.messageType!=="plan"&&Be.messageType!=="plan.live")continue;const Ut=Zm(Be);if(!Ut||Bc.value!==null&&Be.id===Bc.value)return null;const BT=p?!0:sw(u,Be,we);return{id:Be.id,streaming:Be.messageType==="plan.live",explanation:Ut.explanation,steps:Ut.steps,implemented:BT}}const b=re.value?Pe.value[re.value]??null:null;if(!b)return null;const $=Zm(b);if(!$)return null;const Q=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?ge(re.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:$.explanation,steps:$.steps,implemented:p?!0:Q>=0?iw(u,Q):!1}}),lw=Y(()=>ye.value),gs=Y(()=>In.value?"__new-thread__":re.value),fp=Y(()=>$r(gs.value)),hu=Y(()=>{const u=ie.value;return u.length>0?u[u.length-1]:null}),uw=Y(()=>hu.value?Fr(hu.value.id):""),An=Y(()=>{var u,p;return In.value?yt.value.trim():((p=(u=ue.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),mu=Y(()=>mr.value&&(In.value&&An.value.length>0||mt.name==="thread"&&re.value.length>0)),cw=Y(()=>mu.value&&Ot.value==="terminal"),Sl=Y(()=>!It.value||kt.value<=0||Co.value<=0?!1:Co.value-kt.value>120),dw=Y(()=>Sl.value||cw.value&&Jt.value),pp=Y(()=>{var u,p;return((p=(u=ue.value)==null?void 0:u.cwd)==null?void 0:p.trim())??yt.value.trim()}),zc=Y(()=>{var u;return!In.value&&((u=ue.value)==null?void 0:u.inProgress)===!0}),fw=Y(()=>{const u=re.value;return!!u&&nt.value.has(u)}),hp=Y(()=>{var u,p;return!In.value&&((p=(u=ue.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Hc=Y(()=>qe.value||A.value||zc.value||ie.value.length>0);function mp(){Qs.value&&(Qs.value=!1,DI(!0))}function pw(){mp(),xt.push({name:"skills",query:{tab:"plugins"}})}function hw(){const u=re.value;u&&bt(u)}function qc(u,p){const b=Ze(u).trim(),$=Nr(b);return!b||!$?!1:p.some(Q=>{const we=Ze(Q).trim();return we!==b&&Nr(we)===$})}function Wc(u,p=""){const b=Ze(u).trim(),$=p.trim();if($)return $;const Q=Nr(b),we=[...V.value.order,...M.value.map(Be=>{var Ut,Sr;return((Sr=(Ut=Be.threads[0])==null?void 0:Ut.cwd)==null?void 0:Sr.trim())??""}).filter(Boolean)];return qc(b,we)?b:Q}function mw(){const u=new Set(V.value.order),p=V.value.projectOrder.filter(b=>u.has(b));for(const b of V.value.order)p.includes(b)||p.push(b);return p}function Cl(u){const p=Ze(u).trim(),b=[...V.value.order,...M.value.map($=>{var Q,we;return((we=(Q=$.threads[0])==null?void 0:Q.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];return qc(p,b)?p:Nr(p)}function vp(u){const p=Ze(u).trim();if(!p)return"";const b=[...V.value.order,...M.value.map($=>{var Q,we;return((we=(Q=$.threads[0])==null?void 0:Q.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];for(const $ of V.value.order){const Q=Ze($).trim();if(!Q)continue;const we=Nr(Q),Be=qc(Q,b)?Q:we;if(Q===p||Be===p||we===p)return Q}return""}const Gc=Y(()=>{var $,Q;const u=[],p=new Set;for(const we of mw()){const Be=we.trim();!Be||p.has(Be)||(p.add(Be),u.push({value:Be,label:Wc(Be,V.value.labels[Be])}))}for(const we of M.value){const Be=((Q=($=we.threads[0])==null?void 0:$.cwd)==null?void 0:Q.trim())??"";!Be||p.has(Be)||ac(Be)||(p.add(Be),u.push({value:Be,label:Wc(Be,pe.value[we.projectName])}))}const b=yt.value.trim();return b&&!p.has(b)&&u.unshift({value:b,label:Wc(b)}),u}),ii=Y(()=>{const u=yt.value.trim();return u?Nn.value[u]===!0:!1}),vw=Y(()=>{var p,b;const u={};for(const $ of M.value){const Q=Di($.projectName,((b=(p=$.threads[0])==null?void 0:p.cwd)==null?void 0:b.trim())??"");u[$.projectName]=Q?Nn.value[Q]===!0:!1}return u}),Vc=Y(()=>{const u=Wn.value.trim(),p=[...k.value];return u&&!p.some(b=>b.value===u)&&p.unshift({value:u,label:u}),p}),gp=Y(()=>{const u=Wn.value.trim();if(!u)return"";const p=Vc.value.find(b=>b.value===u);return(p==null?void 0:p.label)??u}),yp=Y(()=>So.value.trim()),wp=Y(()=>{const u=L.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),gw=Y(()=>wp.value&&yp.value.trim().length>0&&!yn.value),bp=Y(()=>{const u=Ie.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Tp=Y(()=>fe.value.trim()?G.value==="create"?bp.value:ze.value.trim().length>0:!1),xl=Y(()=>{const u=Ze(To.value).trim();return u||So.value.trim()}),yw=Y(()=>Z.value?"Creating…":"Create"),ww=Y(()=>tt.value?G.value==="clone"?f("Cloning…"):f("Creating…"):G.value==="clone"?f("Clone repository"):f("Create project")),bw=Y(()=>{const u=So.value.trim(),p=Na.value.trim();return!!(u&&p&&u!==p)}),Sp=Y(()=>{const u=[];bw.value&&u.push({key:`parent:${Na.value}`,name:"..",path:Na.value,kind:"parent"});for(const p of oi.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),Kc=Y(()=>{const u=Vr.value.trim().toLowerCase();return u?Sp.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):Sp.value}),$i=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Tw=Y(()=>f(D[bo.value].label)),Sw=Y(()=>{const u=D[bo.value],p=Math.max(0,Co.value-kt.value-Lr.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":kt.value>0?`${kt.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Lr.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),Cw=Y(()=>{if(!jr.value.configured)return f("Not configured");const u=jr.value.active?f("Online"):f("Configured (offline)"),p=jr.value.allowAllUsers?f("allow all users"):`${jr.value.allowedUsers} ${f("allowed user(s)")}`,b=`${jr.value.mappedChats} ${f("chat(s)")}, ${jr.value.mappedThreads} ${f("thread(s)")}, ${p}`,$=jr.value.lastError?`, ${f("error")}: ${jr.value.lastError}`:"";return`${u}, ${b}${$}`});Ii(()=>{var u,p;document.addEventListener("pointerdown",Lp),window.addEventListener("keydown",jp),document.addEventListener("visibilitychange",Np),window.addEventListener("pageshow",Op),window.addEventListener("focus",$p),window.addEventListener("resize",li),(u=window.visualViewport)==null||u.addEventListener("resize",li),(p=window.visualViewport)==null||p.addEventListener("scroll",li),li(),Cu(),$i==null||$i.addEventListener("change",Cu),hr=he(b=>{Ir.value&&Ir.value.refreshFromNotification(b)}),as=he(b=>{b==="remoteControl/status/changed"&&Gs({force:!0})}),NT(),oT(),vl(),Iw(),ws(),xo(),xp(),Yc(),ld(),kb(),Wr()}),ot(bl,(u,p)=>{u.forEach((b,$)=>{if(b===p[$])return;const Q=b.trim();Q&&or(Q)})}),ot(Tn,u=>{if(Ln&&(Ln.disconnect(),Ln=null),typeof ResizeObserver<"u"){Ln=new ResizeObserver(Pn),u&&Ln.observe(u);return}Pn()},{immediate:!0}),su(()=>{var u,p;document.removeEventListener("pointerdown",Lp),window.removeEventListener("keydown",jp),document.removeEventListener("visibilitychange",Np),window.removeEventListener("pageshow",Op),window.removeEventListener("focus",$p),window.removeEventListener("resize",li),(u=window.visualViewport)==null||u.removeEventListener("resize",li),(p=window.visualViewport)==null||p.removeEventListener("scroll",li),$i==null||$i.removeEventListener("change",Cu),Ln&&(Ln.disconnect(),Ln=null),fa!==null&&(window.clearInterval(fa),fa=null),Zt&&(clearTimeout(Zt),Zt=null),co(),kr(),hr&&(hr(),hr=null),as&&(as(),as=null),Pr&&(clearTimeout(Pr),Pr=null)});function li(){var u,p;typeof window>"u"||(Co.value=Math.max(Co.value,window.innerHeight),kt.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Lr.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}ot(qt,u=>{const p=u.trim();if(Zt&&(clearTimeout(Zt),Zt=null),!p){Pa.value=null;return}Zt=setTimeout(()=>{Zx(p,1e3).then(b=>{qt.value.trim()===p&&(Pa.value=b.threadIds)}).catch(()=>{qt.value.trim()===p&&(Pa.value=null)})},220)}),ot(Sl,u=>{u||(Jt.value=!1)}),ot(Jn,()=>{if(typeof window>"u")return;if(!Jn.value.some(p=>p.quotaStatus==="loading")){fa!==null&&(window.clearInterval(fa),fa=null);return}fa===null&&(fa=window.setInterval(()=>{Oc||(Oc=!0,kl({silent:!0}).finally(()=>{Oc=!1}))},1500))},{deep:!0}),ot(Je,()=>{Cp().then(u=>{u&&ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function Cp(){if(!$c||Dc||Vt.value!=="codex"||Jn.value.length>0||Je.value.length===0)return!1;Dc=!0;const u=JSON.stringify(Jn.value.map(b=>b.accountId).sort());try{const b=await Am();Jn.value=b.accounts}catch{await kl({silent:!0})}const p=JSON.stringify(Jn.value.map(b=>b.accountId).sort());return u!==p}function xw(){ae({force:!0})}function kw(u){u&&We(u,{silent:!0,force:!0})}async function Yc(){try{jr.value=await PI()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";jr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function xp(){try{const u=await _I();Ri.value=u.botToken,ri.value=u.allowedUserIds.map(p=>String(p)).join(`
80
- `),h.value=""}catch(u){h.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function Iw(){const u=await $I();Qs.value=u.dismissed!==!0}function Aw(u){const p=u.split(/[\n,]/).map(Q=>Q.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=p.includes("*"),$=Array.from(new Set(p.filter(Q=>/^-?\d+$/.test(Q)).map(Q=>Number.parseInt(Q,10))));return b?["*",...$]:$}async function _w(){const u=Ri.value.trim(),p=Aw(ri.value);if(!u){h.value=f("Telegram bot token is required.");return}if(p.length===0){h.value=f("At least one allowed Telegram user ID or * is required.");return}g.value=!0,h.value="";try{await AI(u,p),ri.value=p.map(b=>String(b)).join(`
81
- `),await Promise.all([xp(),Yc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){h.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),Yc()}finally{g.value=!1}}const vu=T(""),Pw=Y(()=>vu.value||re.value);ot(re,()=>{vu.value=""});function Ew(){return new Promise(u=>{let p=!1;const b=()=>{p||(p=!0,u())};requestAnimationFrame(()=>setTimeout(b,0)),setTimeout(b,80)})}let Jc=0;function Rw(u){if(!u)return;if(mt.name==="thread"&&ai.value===u){Jc+=1,vu.value="";return}vu.value=u;const p=Jc+=1;Ew().then(()=>{p===Jc&&xt.push({name:"thread",params:{threadId:u}})}),It.value&&mn(!0)}function Mw(u){mt.name==="automations"&&cp.value!==u&&xt.replace({name:"automations",query:u?{automationId:u}:{}})}async function jw(u){var p;_t.value&&(mn(!1),await Nt()),(p=zn.value)==null||p.openAutomationEditorFromPanel(u)}async function Lw(){var u;_t.value&&(mn(!1),await Nt()),(u=zn.value)==null||u.openAutomationCreatorFromPanel()}function Nw(){var u;mt.name==="automations"&&((u=sn.value)==null||u.loadAutomations())}async function Ow(u){u&&re.value===u&&await uT()}function $w(u){return u.length>8?u.slice(-8):u}function kp(u){const p=[u.planType||f("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function Dw(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"||Dw(u.quotaError)}function Fw(u){return la.value||wo.value||ua.value||On.value||ja.value.length>0||u.isActive&&ja.value!==u.storageId&&Hc.value}function Qc(u){return Rr.value===u.storageId}function Bw(u){return ca.value===u.storageId||Qc(u)}function Uw(u){return gu(u)?f("Unavailable"):u.isActive?f("Active"):wo.value?f("Switching…"):f("Switch")}function zw(u){return ja.value===u.storageId?f("Removing…"):Qc(u)?f("Click again to remove"):f("Remove")}function Hw(u){ca.value=u}function qw(u){ca.value===u&&(ca.value=""),ja.value!==u&&Rr.value===u&&(Rr.value="")}function Ww(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),$=b.find(we=>we.windowMinutes===7*24*60);if($)return $;const Q=b.filter(we=>typeof we.windowMinutes=="number"&&we.windowMinutes>=7*24*60).sort((we,Be)=>(we.windowMinutes??0)-(Be.windowMinutes??0))[0]??null;return Q||(p.secondary??null)}function Gw(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function Ip(u){var we,Be;if(gu(u))return u.quotaError||f("402 Payment Required");const p=u.quotaSnapshot,b=Ww(u),$=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,Q=b??$;if(Q){const Ut=Math.max(0,Math.min(100,100-Math.round(Q.usedPercent))),Sr=Gw(Q.resetsAt);return Sr?`${Ut}% ${f("weekly remaining")} · ${Sr}`:`${Ut}% ${f("weekly remaining")}`}return(we=p==null?void 0:p.credits)!=null&&we.unlimited?f("Unlimited credits"):(Be=p==null?void 0:p.credits)!=null&&Be.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 Vw(u){return[u.email||f("Account"),kp(u),gu(u)?f("Unavailable account"):null,Ip(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
82
- `)}async function kl(u={}){try{const p=await tA();Jn.value=p.accounts,p.accounts.some(b=>b.storageId===ca.value)||(ca.value=""),p.accounts.some(b=>b.storageId===Rr.value)||(Rr.value="")}catch(p){if(u.silent===!0)return;vn.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Kw(){if(!(la.value||wo.value||ua.value||On.value)){vn.value="",ca.value="",Rr.value="",la.value=!0;try{const u=await Am();Jn.value=u.accounts,kr(),ao(),ne({includeSelectedThreadMessages:!0})}catch(u){vn.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{la.value=!1}}}async function Yw(u){if(!(wo.value||la.value||ua.value||On.value)){if(Hc.value){vn.value=f("Finish the current turn and pending requests before switching accounts.");return}vn.value="",ca.value="",Rr.value="",wo.value=!0;try{const p=await oA(u);Jn.value=Jn.value.map(b=>b.storageId===u?p:{...b,isActive:!1}),kr(),ao(),ne({includeSelectedThreadMessages:!0}),kl({silent:!0})}catch(p){vn.value=p instanceof Error?p.message:f("Failed to switch account")}finally{wo.value=!1}}}async function Jw(){var u;if(!(la.value||wo.value||ua.value||On.value)){vn.value="",Ma.value="",ua.value=!0;try{const p=await nA();Ys.value=p,Ks.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Nt(),(u=du.value)==null||u.focus()}catch(p){vn.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{ua.value=!1}}}function Xc(){On.value||(Ks.value=!1,Ma.value="")}async function Qw(){const u=Ma.value.trim();u&&await Xw(u)}async function Xw(u){if(!(On.value||u.length===0)){vn.value="",On.value=!0;try{const p=await rA(u);Jn.value=p.accounts,Ys.value="",Ma.value="",Ks.value=!1,kr(),ao(),ne({includeSelectedThreadMessages:!0})}catch(p){vn.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{On.value=!1}}}async function Zw(u){if(la.value||wo.value||ua.value||On.value||ja.value.length>0)return;const p=Jn.value.find($=>$.storageId===u)??null;if(!p)return;if(Rr.value!==u){Rr.value=u;return}if(p.isActive&&Hc.value){vn.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=p.isActive;vn.value="",Rr.value="",ja.value=u;try{const $=await aA(u);Jn.value=$.accounts,kr(),ao(),b&&ne({includeSelectedThreadMessages:!0}),kl({silent:!0})}catch($){vn.value=$ instanceof Error?$.message:f("Failed to remove account")}finally{ja.value=""}}function eb(u){ft(u)}function tb(u){ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function nb(u){const p=await de(u);p&&(In.value?await xt.replace({name:"thread",params:{threadId:p}}):await xt.push({name:"thread",params:{threadId:p}}),It.value&&mn(!0))}function Ap(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function Di(u,p=""){var we,Be,Ut;const b=M.value.find(Sr=>Sr.projectName===u);if(!b)return vp(u)||p.trim();const $=b.threads.find(Sr=>!Ap(Sr.cwd));return(((we=$==null?void 0:$.cwd)==null?void 0:we.trim())??((Ut=(Be=b.threads[0])==null?void 0:Be.cwd)==null?void 0:Ut.trim())??"")||vp(u)||p.trim()}function rb(u){var $,Q;const p=M.value.find(we=>we.projectName===u),b=Di(u,((Q=($=p==null?void 0:p.threads[0])==null?void 0:$.cwd)==null?void 0:Q.trim())??"");b&&(yt.value=b),It.value&&mn(!0),!In.value&&xt.push({name:"home"})}function ob(u){var b;let p="";for(const $ of M.value){const Q=$.threads.find(we=>we.id===u);if((b=Q==null?void 0:Q.cwd)!=null&&b.trim()){p=Q.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function yu(u){var b,$;const p=M.value.find(Q=>Q.projectName===u);return Di(u,(($=(b=p==null?void 0:p.threads[0])==null?void 0:b.cwd)==null?void 0:$.trim())??"")}const _p=Y(()=>Object.fromEntries(M.value.map(u=>[u.projectName,yu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function ab(u){return(pe.value[u]??u).trim()||u}function sb(u){return ab(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function ib(u){const p=yu(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function lb(u){const p=yu(u);await Rp(p)}async function ub(u){const p=cb(u);await Rp(p)}function cb(u){var p;for(const b of M.value){const $=b.threads.find(Q=>Q.id===u);if((p=$==null?void 0:$.cwd)!=null&&p.trim())return $.cwd.trim()}return""}function Pp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let b=u,$=0;for(;b>=1024&&$<p.length-1;)b/=1024,$+=1;return`${b>=10||$===0?b.toFixed(0):b.toFixed(1)} ${p[$]}`}function db(u,p){const b=URL.createObjectURL(u),$=document.createElement("a");$.href=b,$.download=p,document.body.appendChild($),$.click(),document.body.removeChild($),window.setTimeout(()=>URL.revokeObjectURL(b),3e4)}async function fb(u,p){const $={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($))))throw new Error("File sharing is not supported in this browser.");await navigator.share($)}function Ep(){be.value.phase!=="exporting"&&(be.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function pb(){const{blob:u,fileName:p}=be.value;!u||!p||(be.value={...be.value,error:""},db(u,p))}async function hb(){const{blob:u,fileName:p}=be.value;if(!(!u||!p))try{be.value={...be.value,error:""},await fb(u,p)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const $=b instanceof Error?b.message:"",Q=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test($);be.value={...be.value,error:Q?f("This browser blocked sharing the ZIP. Use Download instead."):$||f("Failed to share project. Use Download instead.")}}}async function Rp(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 wA(u,({loaded:$,total:Q})=>{be.value={...be.value,phase:"exporting",loaded:$,total:Q}});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 mb(u){const p=yu(u);if(!p||typeof window>"u"||(await wu(p),Nn.value[p]!==!0))return;const b=`${sb(u)}-`,$=window.prompt("New worktree folder name",b);if($===null)return;const Q=$.trim();if(Q){if(Q.includes("/")||Q.includes("\\")||Q==="."||Q===".."){window.alert("Worktree name must be a single folder name.");return}try{const we=await uA(p,Q),Be=await Mu(we.cwd,{createIfMissing:!1,label:""});if(!Be)return;yt.value=Be,hn.value="local",oo(Cl(Be)),await ws(),await xo(),It.value&&mn(!0),In.value||await xt.push({name:"home"})}catch(we){const Be=we instanceof Error?we.message:"Failed to create worktree.";window.alert(Be)}}}function vb(){var b,$,Q;const u=ue.value;if(!u)return"";const p=((b=u.projectName)==null?void 0:b.trim())??"";return p?Di(p,((Q=u.cwd)==null?void 0:Q.trim())??""):(($=u.cwd)==null?void 0:$.trim())??""}function Zc(){const u=vb();u&&(yt.value=u),hn.value="local",It.value&&mn(!0),!In.value&&xt.push({name:"home"})}function gb(){yt.value="",hn.value="local",It.value&&mn(!0),!In.value&&xt.push({name:"home"})}async function wu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(Nn.value,p))return;const b=ka.get(p);if(b){const we=await b;Object.prototype.hasOwnProperty.call(Nn.value,p)||(Nn.value={...Nn.value,[p]:we});return}const $=fA(p).then(we=>we.isGitRepo).catch(()=>!1).finally(()=>{ka.delete(p)});ka.set(p,$);const Q=await $;Object.prototype.hasOwnProperty.call(Nn.value,p)||(Nn.value={...Nn.value,[p]:Q})}function yb(u){es(u.projectName,u.displayName)}function wb(u){Te(u.threadId,u.title)}async function bb(u){await Sa(u),await ws(),xo()}function Tb(u){Bo(u.projectName,u.toIndex)}function Sb(u){var $,Q;const p=M.value.find(we=>we.projectName===u),b=Di(u,((Q=($=p==null?void 0:p.threads[0])==null?void 0:$.cwd)==null?void 0:Q.trim())??"");wu(b)}function Mp(u){Cb(u)}async function Cb(u){var $;const p=await Fo(u),b=(($=u.followUpMessageText)==null?void 0:$.trim())??"";if(!(!p||!b||In.value))try{await Tt(b,[],[],"steer",[])}catch{}}async function xb(u){const p=await Ue(u.threadId,u.turnIndex);p&&(await xt.push({name:"thread",params:{threadId:p}}),re.value!==p&&await Ke(p),It.value&&mn(!0))}function jp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Gn.value){Gn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(dn()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),mn(!_t.value);return}if(p==="j"&&mt.name==="thread"&&re.value){u.preventDefault(),Hn();return}p==="j"&&In.value&&An.value&&(u.preventDefault(),Hn())}async function kb(){try{const u=await tk();mr.value=u.available,!u.available&&Ot.value==="terminal"&&(Ot.value="git",uo())}catch{mr.value=!1,Ot.value==="terminal"&&(Ot.value="git")}}function Lp(u){var b,$;const p=u.target;if(p instanceof Node){if(qo.value){const Q=p instanceof Element?p:p.parentElement;Q!=null&&Q.closest(".thread-terminal-panel")||uo()}Gn.value&&((b=_a.value)!=null&&b.containsTarget(p)||($=Jo.value)!=null&&$.contains(p)||(ea=Date.now(),Gn.value=!1))}}function Ib(u){var b,$;if(!Gn.value)return;const p=u.target;p instanceof Node&&((b=_a.value)!=null&&b.containsTarget(p)||($=Jo.value)!=null&&$.contains(p)||(ea=Date.now(),Gn.value=!1))}function Ab(){var u;(u=zn.value)==null||u.openRecycleBin()}function Np(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Li.value=Date.now(),Ni.value=!1;return}ed()}}function Op(u){u.persisted&&ed()}function $p(){mt.name==="home"&&(ws(),xo()),ed()}function ed(){typeof window>"u"||typeof document>"u"||MO(document.visibilityState,Li.value,Ni.value,Date.now())&&(Ni.value=!0,Li.value=null,_b())}async function _b(){if(!Re.value){Re.value=!0;try{await ne({includeSelectedThreadMessages:!0}),await cd()}finally{Re.value=!1}}}function Dp(u){const p=u.text;bu();const b=Wo.value,$=u.mode==="queue"&&b&&b.threadId===re.value?b.queueIndex:void 0;if(Wo.value=null,In.value){OT(p,u.imageUrls,u.skills,u.fileAttachments);return}Tt(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,$)}function Pb(u){const p=no.value.findIndex(we=>we.id===u),b=p>=0?no.value[p]:void 0,$=ar.value;if(!b||!$||$.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Wo.value=re.value?{threadId:re.value,queueIndex:p}:null;const Q={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(we=>({...we})),skills:b.skills.map(we=>({...we}))};$.hydrateDraft(Q),rr(u)}function bu(){if(!It.value||In.value)return;const u=()=>{var p;(p=Sn.value)==null||p.jumpToLatest()};u(),Nt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function Eb(u){yt.value=u.trim(),z.value=""}function Rb(u){Wn.value=u.trim()}function ys(u){const p=An.value.trim();return!u||p!==u?!1:mt.name==="thread"||mt.name==="home"&&ii.value}function Fp(){Qo+=1,on+=1,po+=1,Xo+=1,vo.value=[],br.value=null,sa.value=null,C.value=null,E.value=null,x.value=!1,X.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},Ft.value=[],Tr.value={},tn.value="",go.value="",yo.value={},ia.value="",ss.value="",En.value="",Pi.value=!1}function Bp(u){const p=u.trim();if(!p){Qe.value={addedLineCount:0,removedLineCount:0};return}const b=++Xo;EA(p,"unstaged").then($=>{b!==Xo||!ys(p)||(Qe.value={addedLineCount:$.addedLineCount,removedLineCount:$.removedLineCount})}).catch(()=>{b!==Xo||!ys(p)||(Qe.value={addedLineCount:0,removedLineCount:0})})}async function Il(u){var $,Q,we;const p=u.trim();if(!p){Fp();return}const b=++Qo;Pi.value=!0,En.value="";try{const Be=await dA(p);if(b!==Qo||!ys(p))return;vo.value=Be.options,br.value=Be.currentBranch,sa.value=Be.headSha,C.value=Be.headSubject,E.value=Be.headDate,x.value=Be.detached,X.value=Be.dirty,Ft.value=Be.changedFiles,Bp(p);const Ut=(($=Be.currentBranch)==null?void 0:$.trim())||((we=(Q=Be.options[0])==null?void 0:Q.value)==null?void 0:we.trim())||"";Ut&&Up({branch:Ut,includeResetHistory:!0})}catch{if(b!==Qo||!ys(p))return;vo.value=[],br.value=null,sa.value=null,C.value=null,E.value=null,x.value=!1,X.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},Ft.value=[]}finally{b===Qo&&(Pi.value=!1)}}function Mb(u){br.value=u.currentBranch,sa.value=u.headSha,C.value=u.headSubject,E.value=u.headDate,x.value=u.detached,X.value=u.dirty,Ft.value=u.changedFiles,Bp(An.value)}function jb(u){if(Ra.value)return;const p=u.trim();if(!p||p===(br.value??""))return;const b=An.value.trim();b&&(Ra.value=!0,En.value="",pA(b,p).then($=>(br.value=$||p,sa.value=null,C.value=null,E.value=null,x.value=!1,Vn.value=!1,Il(b))).catch($=>{const Q=$ instanceof Error?$.message:"Failed to switch branch";Il(b).finally(()=>{En.value=Q})}).finally(()=>{Ra.value=!1}))}function Lb(u){if(Ra.value)return;const p=u.branch.trim(),b=u.sha.trim(),$=An.value.trim();!p||!b||!$||(Ra.value=!0,En.value="",vA($,p,b).then(Q=>(Mb(Q),Vn.value=!1,Il($))).catch(Q=>{const we=Q instanceof Error?Q.message:"Failed to reset branch to commit";Il($).finally(()=>{En.value=we})}).finally(()=>{Ra.value=!1}))}function Up(u){const p=(typeof u=="string"?u:u.branch).trim(),b=typeof u=="string"?!0:u.includeResetHistory!==!1,$=An.value.trim(),Q=jc(p,b);if(!p||!$||tn.value===Q||(go.value="",Tr.value[Q]))return;const we=++on;tn.value=Q,hA($,p,{includeResetHistory:b}).then(Be=>{we!==on||!ys($)||(Tr.value={...Tr.value,[Q]:Be})}).catch(Be=>{we!==on||!ys($)||(go.value=Be instanceof Error?Be.message:"Failed to load branch commits")}).finally(()=>{we===on&&tn.value===Q&&(tn.value="")})}function Nb(u){const p=u.trim(),b=An.value.trim();if(!p||!b||ia.value===p||(ss.value="",yo.value[p]))return;const $=++po;ia.value=p,mA(b,p).then(Q=>{$!==po||!ys(b)||(yo.value={...yo.value,[p]:Q})}).catch(Q=>{$!==po||!ys(b)||(ss.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{$===po&&ia.value===p&&(ia.value="")})}function Ob(u){const p=u.path.trim(),b=u.sha.trim();!p||!b||(aa.value=p,Er.value=b,Vn.value=!0)}function $b(){aa.value="",Er.value="",Vn.value=!Vn.value}function Db(){!aa.value&&!Er.value||(aa.value="",Er.value="",Vn.value=!1)}async function Fb(){const u=await Su();u&&(await xo(),fe.value=u,Ie.value=Zo.value.trim()||"New Project (1)",ze.value="",ut.value="",G.value="create",W.value=!0,Nt(()=>{var p;return(p=St.value)==null?void 0:p.focus()}))}function Tu(){tt.value||(W.value=!1,ut.value="")}let td=!1,nd=!1;function Bb(){td=!0}function Ub(){td&&(td=!1,Fi())}function zb(){nd=!0}function Hb(){nd&&(nd=!1,Tu())}async function qb(){const u=fe.value.trim(),p=Ie.value.trim();if(!bp.value)throw new Error("Enter a single project folder name.");const b=Wp(qp(u,p));return b?Mu(b,{createIfMissing:!0,label:""}):""}async function Wb(){const u=fe.value.trim(),p=ze.value.trim();return p?CA(p,u):""}async function rd(){if(!(!Tp.value||tt.value)){ut.value="",tt.value=!0;try{const u=G.value==="clone"?await Wb():await qb();if(!u)return;yt.value=u,oo(Cl(u)),await ws(),await xo(),W.value=!1}catch(u){ut.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{tt.value=!1}}}function Gb(){Vb(Bt.value)}function Vb(u){rt.value||!u||(u.value="",u.click())}async function Kb(u,p,b){rt.value=!0;try{const $=await Su();if(!$)return;const Q=await p($);if(!Q.path)return;yt.value=Q.path,oo(Cl(Q.path)),await ws(),await ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await xo()}catch($){const Q=$ instanceof Error?$.message:b;window.alert(Q)}finally{rt.value=!1,u&&(u.value="")}}async function Yb(u){var $;const p=u.target instanceof HTMLInputElement?u.target:null,b=(($=p==null?void 0:p.files)==null?void 0:$[0])??null;!b||rt.value||await Kb(p,Q=>bA(b,Q),"Failed to import project.")}async function Jb(){const u=yt.value.trim()||await Su();u&&(_.value=!1,gn.value=!0,Vr.value="",await bs(u),yn.value||Nt(()=>{var p;return(p=Mi.value)==null?void 0:p.focus()}))}function Fi(){Tl+=1,gn.value=!1,Xn.value=!1,yn.value="",Vr.value="",To.value="",Al()}async function Qb(u){!u||Xn.value||(Vr.value="",await bs(u))}function Xb(){const u=So.value.trim();!gn.value||!u||bs(u)}function Zb(){const u=xl.value;!gn.value||!u||Xn.value||bs(u)}function eT(){if(!gn.value||Xn.value||Mr.value)return;const u=xl.value,p=So.value.trim();!u||u===p||bs(u)}function tT(){const u=xl.value,p=So.value.trim();if(u){if(u!==p){bs(u);return}od(u)}}async function od(u=xl.value){const p=Ze(u).trim();if(p){yn.value="",Mr.value=!0;try{const b=await Mu(p,{createIfMissing:!1,label:""});if(!b){yn.value="Failed to open the selected folder.";return}yt.value=b,oo(Cl(b)),await ws(),await ne({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await xo(),Fi()}catch(b){yn.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{Mr.value=!1}}}async function nT(){if(z.value="",_.value){Al();return}if(!gn.value){const u=yt.value.trim()||await Su();if(!u||(gn.value=!0,Vr.value="",await bs(u),yn.value))return}yn.value||(L.value=Zo.value,_.value=!0,Nt(()=>{var u;return(u=cu.value)==null?void 0:u.focus()}))}function Al(){z.value="",L.value="",_.value=!1}async function zp(){const u=L.value.trim();if(!u)return;if(z.value="",yn.value){z.value="Reload the current folder before creating a new one.";return}Z.value=!0;const p=yp.value.trim(),b=Wp(qp(p,u));if(!b){z.value="Unable to determine where the new folder should be created.",Z.value=!1;return}if(!wp.value){z.value="Enter a single folder name.",Z.value=!1;return}try{const $=await SA(b);if(!$){z.value="Failed to create the folder.";return}z.value="",Vr.value="",await bs($),Al()}catch($){z.value=$ instanceof Error?$.message:"Failed to create folder."}finally{Z.value=!1}}async function rT(){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 Mu(u,{createIfMissing:!1,label:""});if(!b)return!1;yt.value=b,oo(Cl(b)),await xt.replace({name:"home"}),await ws();const $=new URL(window.location.href);return $.searchParams.delete("openProjectPath"),window.history.replaceState({},"",$.toString()),!0}catch{return!1}}async function Su(){const u=Hp();if(u)return u;try{const p=await _m();if(p)return yr.value=p,p}catch{}return""}async function xo(){const u=Hp();if(!u){Zo.value="New Project (1)";return}try{const p=await kA(u);Zo.value=p.name||"New Project (1)"}catch{Zo.value="New Project (1)"}}function Hp(){var b,$;const u=yt.value.trim();if(u)return el(u);const p=(($=(b=Gc.value[0])==null?void 0:b.value)==null?void 0:$.trim())??"";return p?el(p):yr.value.trim()}async function oT(){try{yr.value=await _m()}catch{yr.value=""}}async function ws(){try{const u=await Ki();V.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{V.value={order:[],labels:{},projectOrder:[]}}}async function bs(u){const p=++Tl,b=Ze(u).trim();To.value=b,So.value=b,yn.value="",Xn.value=!0;try{const $=await TA(u,{showHidden:ji.value});if(p!==Tl)return;To.value=$.path,So.value=$.path,Na.value=$.parentPath,oi.value=$.entries}catch($){if(p!==Tl)return;yn.value=$ instanceof Error?$.message:"Failed to load local folders.",Na.value=el(So.value),oi.value=[],Al()}finally{p===Tl&&(Xn.value=!1)}}function qp(u,p){const b=Ze(u).trim(),$=Ze(p).trim().replace(/^[\\/]+/u,"");if(!b||!$)return"";const Q=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${Q}${$}`;if(/^\/+$/u.test(b))return`/${$}`;const we=b.replace(/[\\/]+$/u,"");return we?`${we}${Q}${$}`:""}function Wp(u){const p=Ze(u).trim();if(!p)return"";const b=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,Q,we,Be=""]=b,Ut=ad(Be.split(/[\\/]+/u));return Ut.length>0?`\\\\${Q}\\${we}\\${Ut.join("\\")}`:`\\\\${Q}\\${we}`}const $=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if($){const[,Q,we=""]=$,Be=p.includes("\\")&&!p.includes("/")?"\\":"/",Ut=ad(we.split(/[\\/]+/u));return Ut.length>0?`${Q}${Be}${Ut.join(Be)}`:`${Q}${Be}`}if(p.startsWith("/")){const Q=ad(p.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return p}function ad(u){const p=[];for(const b of u){const $=b.trim();if(!(!$||$===".")){if($===".."){p.length>0&&p.pop();continue}p.push($)}}return p}function aT(u){ba(u.draggedId,u.targetId)}function Gp(u){const p=gs.value,b=$r(p);Za(p,u),b&&b!==u&&(Dr(p,b,u),$o(p))}function Vp(u){Do(u)}function Kp(u){Ds(u)}function sT(){Lt()}const _l=T("");let sd=null;ot(Oo,u=>{var p;u&&(u.text&&((p=ar.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."),sd&&clearTimeout(sd),sd=setTimeout(()=>{_l.value=""},6e3),Yt(gs.value))});function Yp(u){var b,$;const p=re.value.trim();switch(u){case"compact":p&&bt(p);break;case"review":if(!p)return;aa.value="",Er.value="",Vn.value=!0;break;case"rename":p&&(($=zn.value)==null||$.openRenameThreadDialog(p,((b=ue.value)==null?void 0:b.title)??""));break;case"archive":p&&ft(p);break;case"fork":p&&de(p);break;case"new":Zc();break;case"skills":vs.value||xt.push({name:"skills"});break}}function iT(u){const p=u.turnId.trim();if(p.length>0){const b=[...Oi.value].reverse().find($=>{var Q;return $.role==="user"&&(((Q=$.turnId)==null?void 0:Q.trim())??"")===p&&$.text.trim().length>0});b!=null&&b.text&&ar.value&&ar.value.appendTextToDraft(b.text)}ns(u.turnId)}function lT(){In.value||!re.value||(Uc.value&&(Bc.value=Uc.value.id),Xa("default"),bu(),Tt("Implement",[],[],"steer",[],void 0,"default"))}async function uT(){if(In.value||vs.value||si.value||!ue.value||Oi.value.length===0)return;const u=cT();try{await EO(u)}catch{}}function cT(){var b,$,Q;const u=[],p=(($=(b=ue.value)==null?void 0:b.title)==null?void 0:$.trim())||"Untitled thread";u.push(`# ${dT(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((Q=ue.value)==null?void 0:Q.id)??""}`),u.push(""),u.push("---"),u.push("");for(const we of Oi.value){const Be=we.role?we.role.toUpperCase():"MESSAGE";u.push(`## ${Be}`),u.push("");const Ut=we.text.trim();if(Ut&&(u.push(Ut),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 Sr of we.fileAttachments)u.push(`- ${Sr.path}`);u.push("")}if(we.images&&we.images.length>0){u.push("Images:");for(const Sr of we.images)u.push(`- ${Sr}`);u.push("")}}return`${u.join(`
83
- `).trimEnd()}
84
- `}function dT(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function id(u,p){if(typeof window>"u")return p;const b=window.localStorage.getItem(u);return b===null?p:b==="1"}function fT(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(vv);return u==="light"||u==="dark"?u:"system"}function pT(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(mv);return u==="steer"||u==="queue"?u:"queue"}function hT(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(bv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function mT(){is.value=!is.value,window.localStorage.setItem(hv,is.value?"1":"0")}function vT(){ls.value=ls.value==="steer"?"queue":"steer",window.localStorage.setItem(mv,ls.value)}function gT(){const u=["system","light","dark"],p=u.indexOf(us.value);us.value=u[(p+1)%u.length],window.localStorage.setItem(vv,us.value),Cu()}function yT(){const u=["standard","wide","extra-wide"],p=u.indexOf(bo.value);bo.value=u[(p+1)%u.length],window.localStorage.setItem(bv,bo.value)}function wT(){cs.value=!cs.value,window.localStorage.setItem(gv,cs.value?"1":"0")}function bT(){ds.value=!ds.value,window.localStorage.setItem(yv,ds.value?"1":"0")}async function TT(u){if(!Xs.value){Xs.value=!0;try{if(u==="codex"){Vt.value="codex";const p=await wm(!1);da.value=p.enabled}else if(u==="openrouter"){Vt.value="openrouter";const p=await wm(!0);da.value=p.enabled,await zi("","",{wireApi:La.value,provider:"openrouter"})}else u==="opencode-zen"?(Vt.value="opencode-zen",await zi("",ni.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),da.value=!0):u==="custom"&&(Vt.value="custom",hs.value.trim()&&ei.value.trim()&&(await zi(hs.value.trim(),ei.value.trim(),{wireApi:ti.value}),da.value=!0));Qn.value="",await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Qn.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Xs.value=!1}}}async function ST(){if(Rn.value)return;const u=hs.value.trim();if(u){Rn.value=!0;try{Qn.value="",await zi(u,ei.value.trim(),{wireApi:ti.value}),da.value=!0;const p=await ym();p.provider==="custom"&&!p.currentModel&&(Qn.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){Qn.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Rn.value=!1}}}async function CT(u){if(Rn.value||Xs.value||La.value===u)return;const p=La.value;La.value=u,Rn.value=!0;try{Qn.value="",await zi("","",{wireApi:u,provider:"openrouter"}),da.value=!0,await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){La.value=p,Qn.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Rn.value=!1}}async function xT(){if(Rn.value)return;const u=ni.value.trim();if(u){Rn.value=!0;try{Qn.value="",await zi("",u,{wireApi:"responses",provider:"opencode-zen"}),da.value=!0,await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Qn.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Rn.value=!1}}}async function kT(){if(!Rn.value){Rn.value=!0;try{const u=Zs.value.trim();await bm(u),Zs.value="",await ld(),await ne({includeSelectedThreadMessages:!1})}catch{}finally{Rn.value=!1}}}async function IT(){if(!Rn.value){Rn.value=!0;try{await bm(""),Zs.value="",await ld(),await ne({includeSelectedThreadMessages:!1})}catch{}finally{Rn.value=!1}}}async function ld(){try{const u=Vt.value,p=await ym();da.value=p.enabled,fs.value=p.customKey??!1,ps.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?Vt.value="opencode-zen":p.provider==="custom"?(Vt.value="custom",hs.value=p.customBaseUrl??"",ti.value=p.wireApi==="chat"?"chat":"responses"):(Vt.value="openrouter",La.value=p.wireApi==="chat"?"chat":"responses"):Vt.value="codex",$c=p.hasCodexAuth===!0,$c||(Dc=!1);const b=Vt.value!==u;b&&await ne({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const $=await Cp();$&&await ne({includeSelectedThreadMessages:!1,providerChanged:b||$,awaitAncillaryRefreshes:!0})}catch{}}function AT(u){const b=ud(u.trim())||"auto";Js.value=b,window.localStorage.setItem(wv,b)}function _T(u){Ta(Number(u))}const PT=[{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 ET(){var b;if(typeof window>"u")return"auto";const u=((b=window.localStorage.getItem(wv))==null?void 0:b.trim())||"auto";return ud(u)||"auto"}function RT(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function b(Q){const we=q[Q]||Q;return`${we.charAt(0).toUpperCase()+we.slice(1)} (${Q})`}for(const Q of typeof navigator<"u"?navigator.languages??[]:[]){const we=ud(Q);!we||p.has(we)||(p.add(we),u.push({value:we,label:`${f("Preferred")}: ${b(we)}`}))}for(const Q of Object.keys(q))p.has(Q)||(p.add(Q),u.push({value:Q,label:b(Q)}));const $=Js.value.trim();return $&&!p.has($)&&u.push({value:$,label:b($)}),u}function ud(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(us.value==="dark")u.classList.add("dark");else if(us.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}MT()}function MT(){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 jT=Y(()=>({activeSettingsGroup:kn.value,accounts:Jn.value,isAccountsSectionCollapsed:Xt.value,isRefreshingAccounts:la.value,isSwitchingAccounts:wo.value,isStartingCodexLogin:ua.value,isCompletingCodexLogin:On.value,accountActionError:vn.value,codexLoginUrl:Ys.value,feedbackMailto:Ar,isAccountUnavailable:gu,isRemoveConfirmationActive:Qc,isRemoveVisible:Bw,buildAccountTitle:Vw,formatAccountMeta:kp,formatAccountQuota:Ip,shortAccountId:$w,isAccountActionDisabled:Fw,getAccountSwitchLabel:Uw,getAccountRemoveLabel:zw,onRefreshAccounts:Kw,onStartCodexLogin:Jw,onSwitchAccount:Yw,onRemoveAccount:Zw,onAccountCardPointerEnter:Hw,onAccountCardPointerLeave:qw,toggleAccountsSectionCollapsed:Yo,prepareFeedbackLink:Pt,sendWithEnter:is.value,inProgressSendMode:ls.value,darkMode:us.value,uiLanguage:y.value,uiLanguageOptions:S,chatWidthLabel:Tw.value,dictationClickToToggle:cs.value,dictationAutoSend:ds.value,dictationLanguage:Js.value,dictationLanguageOptions:Ei.value,autoCompactThreshold:$s.value,autoCompactThresholdOptions:PT,hasVisibleFeedbackError:pu.value,selectedProvider:Vt.value,providerDropdownOptions:Nc.value,freeModeLoading:Xs.value,providerError:Qn.value,freeModeHasCustomKey:fs.value,freeModeCustomKey:Zs.value,freeModeCustomKeyMasked:ps.value,freeModeCustomKeySaving:Rn.value,openRouterWireApi:La.value,opencodeZenKey:ni.value,customEndpointUrl:hs.value,customEndpointKey:ei.value,customEndpointWireApi:ti.value,isTelegramConfigOpen:fu.value,telegramStatusText:Cw.value,telegramBotTokenDraft:Ri.value,telegramAllowedUserIdsDraft:ri.value,telegramConfigError:h.value,isTelegramSaving:g.value,supportsHooks:zs.value,isHooksLoading:ke.value,hooksList:Oe.value,supportsRemoteControl:en.value,remoteControlStatus:At.value,isRemoteControlActionInFlight:wr.value,remoteControlError:ho.value,remoteControlNotice:Yn.value,isRemoteControlLoading:Hs.value,remoteControlActionName:Kn.value,pairingCode:_r.value,accountRateLimitSnapshots:Je.value,worktreeName:U,appVersion:O,onClose:()=>{Gn.value=!1},onActiveSettingsGroupChange:u=>{kn.value=u},toggleSendWithEnter:mT,cycleInProgressSendMode:vT,cycleDarkMode:gT,onUiLanguageChange:I,cycleChatWidth:yT,toggleDictationClickToToggle:wT,toggleDictationAutoSend:bT,onDictationLanguageChange:AT,onAutoCompactThresholdChange:_T,onProviderChange:TT,onFreeModeCustomKeyChange:u=>{Zs.value=u},clearFreeModeCustomKey:IT,saveFreeModeCustomKey:kT,setOpenRouterWireApi:CT,onOpencodeZenKeyChange:u=>{ni.value=u},saveOpencodeZen:xT,onCustomEndpointUrlChange:u=>{hs.value=u},onCustomEndpointKeyChange:u=>{ei.value=u},saveCustomEndpoint:ST,onCustomEndpointWireApiChange:u=>{ti.value=u},onTelegramConfigOpenChange:u=>{fu.value=u},onTelegramBotTokenDraftChange:u=>{Ri.value=u},onTelegramAllowedUserIdsDraftChange:u=>{ri.value=u},saveTelegramConfig:_w,refreshHooks:_e,toggleRemoteControl:gl,startRemotePairing:ir,refreshRemoteClients:Gr,revokeRemoteClient:yl}));function LT(u,p){const b=(u??"").trim();return b.length>0?b:p.trim()||"message"}function Jp(u){Xa(u)}async function NT(){await xt.isReady(),mt.name==="thread"&&ai.value?ts(ai.value):(mt.name==="home"||mt.name==="skills"||mt.name==="automations")&&ts("",{persist:!1}),await ne({includeSelectedThreadMessages:mt.name==="thread"}),kl({silent:!0}),await rT(),sr.value=!0,await cd(),ao()}async function cd(){if(qn.value){Vo=!0;return}qn.value=!0;try{do{if(Vo=!1,mt.name==="home"||mt.name==="skills"||mt.name==="automations"){re.value!==""&&await Ke("");continue}if(mt.name==="thread"){const u=ai.value;if(!u)continue;if(re.value!==u){if(await Ke(u)==="not-found")continue}else $e(u,{silent:!0}).catch(()=>{})}}while(Vo)}finally{qn.value=!1}}ot(()=>[mt.name,ai.value,ce.value,re.value],async()=>{sr.value&&await cd()}),ot(()=>[re.value,An.value],()=>{Db()}),ot(()=>[mt.name,An.value],([u,p])=>{u==="thread"&&wu(p)},{immediate:!0}),ot(()=>re.value,async u=>{if(sr.value&&!qn.value&&!(In.value||vs.value||si.value)){if(!u){mt.name!=="home"&&await xt.replace({name:"home"});return}mt.name==="thread"&&ai.value===u||await xt.replace({name:"thread",params:{threadId:u}})}}),ot(()=>Gc.value,u=>{if(u.length===0){yt.value="",xo();return}const p=yt.value.trim();p&&(u.some($=>$.value===p)||(yt.value="")),xo()},{immediate:!0}),ot(()=>yt.value,()=>{He.value={phase:"idle",title:"",message:""},xo()}),ot(()=>[mt.name,yt.value],([u,p])=>{u==="home"&&wu(p)},{immediate:!0}),ot(ii,u=>{!u&&hn.value==="worktree"&&(hn.value="local")},{immediate:!0}),ot(()=>[hn.value,yt.value],([u,p])=>{u!=="worktree"||!ii.value||Qp(p)},{immediate:!0}),ot(()=>hn.value,u=>{var p;if(u==="local"){He.value={phase:"idle",title:"",message:""};const b=yt.value.trim();if(b&&Ap(b)){const $=((p=ue.value)==null?void 0:p.projectName)??Nr(b),Q=Di($,"");Q&&(yt.value=Q)}return}ii.value&&Qp(yt.value)}),ot(()=>mt.name,u=>{u!=="home"&&(He.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Vn.value=!1)}),ot(()=>re.value,()=>{He.value={phase:"idle",title:"",message:""}}),ot(()=>[mt.name,An.value,ii.value],([u,p,b])=>{if(!(u==="thread"||u==="home"&&b)){Fp();return}on+=1,Tr.value={},tn.value="",go.value="",Il(p)},{immediate:!0}),ot(ow,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),ot(It,u=>{u&&!_t.value&&mn(!0)},{immediate:!0});async function OT(u,p=[],b=[],$=[]){try{He.value={phase:"idle",title:"",message:""};let Q=yt.value;if(hn.value==="worktree"){He.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Be=await lA(yt.value,Wn.value);Q=Be.cwd,yt.value=Be.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(!Q.trim()){const Be=await xA(u);Q=Be.cwd,yt.value=Be.cwd}const we=await gt(u,Q,p,b,$);if(!we)return;await xt.replace({name:"thread",params:{threadId:we}}),bu()}catch{}}function $T(u){var $;if(($=u.prompt)!=null&&$.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 DT(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function FT(u){var Q;if(Go.value)return;Go.value=DT(u);const p=$T(u),b=(Q=u.attachedSkills)!=null&&Q.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[],$=$O(b,Ee.value);try{const we=pp.value.trim()||An.value.trim(),Be=await gt(p,we,[],$,[]);if(!Be)return;await xt.replace({name:"thread",params:{threadId:Be}}),bu()}catch{}finally{Go.value=""}}async function Qp(u){var b;const p=u.trim();if(!p){k.value=[],Wn.value="";return}j.value=!0;try{const $=await cA(p);k.value=$;const Q=Wn.value.trim();if(!(Q.length>0&&$.some(Be=>Be.value===Q))){const Be=$.find(Ut=>Ut.value.trim()==="main");Wn.value=(Be==null?void 0:Be.value)??((b=$[0])==null?void 0:b.value)??""}}catch{k.value=[],Wn.value=""}finally{j.value=!1}}return(u,p)=>(P(),B(ct,null,[Fe(Ox,{"is-sidebar-collapsed":m(_t),onCloseSidebar:p[37]||(p[37]=b=>m(mn)(!0))},{sidebar:pt(()=>[w("section",DO,[w("div",{ref_key:"sidebarScrollableRef",ref:Ko,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...b)=>m(gr)&&m(gr)(...b))},[m(_t)?ve("",!0):(P(),et(Km,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":m(_t),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=b=>m(mn)(!m(_t))),onStartNewThread:Zc},{default:pt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":m(zr),"aria-label":m(f)("Search threads"),title:m(f)("Search threads"),onClick:p[0]||(p[0]=(...b)=>m(Ia)&&m(Ia)(...b))},[Fe(Qm,{class:"sidebar-search-toggle-icon"})],8,FO)]),_:1},8,["is-sidebar-collapsed"])),!m(_t)&&m(zr)?(P(),B("div",BO,[Fe(Qm,{class:"sidebar-search-bar-icon"}),Mn(w("input",{ref_key:"sidebarSearchInputRef",ref:Bs,"onUpdate:modelValue":p[2]||(p[2]=b=>jn(qt)?qt.value=b:null),class:"sidebar-search-input",type:"text",placeholder:m(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...b)=>m(fo)&&m(fo)(...b))},null,40,UO),[[Fn,m(qt)]]),m(qt).length>0?(P(),B("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":m(f)("Clear search"),onClick:p[4]||(p[4]=(...b)=>m(Aa)&&m(Aa)(...b))},[Fe(yf,{class:"sidebar-search-clear-icon"})],8,zO)):ve("",!0)])):ve("",!0),m(_t)?ve("",!0):(P(),B("button",{key:2,class:dt(["sidebar-skills-link",{"is-active":vs.value}]),type:"button",onClick:p[5]||(p[5]=b=>{m(xt).push({name:"skills"}),m(It)&&m(mn)(!0)})},[w("span",HO,[Fe(Jm)]),w("span",qO,[w("span",WO,F(m(f)("Skills")),1),w("span",GO,F(m(f)("Plugins, apps, MCPs")),1)])],2)),m(_t)?ve("",!0):(P(),B("button",{key:3,class:dt(["sidebar-skills-link",{"is-active":si.value}]),type:"button",onClick:p[6]||(p[6]=b=>{m(xt).push({name:"automations"}),m(It)&&m(mn)(!0)})},[w("span",VO,[Fe(Ym)]),w("span",KO,[w("span",YO,F(m(f)("Automations")),1),w("span",JO,F(m(f)("Scheduled work")),1)])],2)),m(_t)?ve("",!0):(P(),et(oR,{key:4,ref_key:"sidebarThreadTreeRef",ref:zn,groups:m(M),"project-display-name-by-id":m(pe),"project-git-repo-by-name":vw.value,"project-cwd-by-name":_p.value,"selected-thread-id":Pw.value,"is-loading":m(ce),"is-thread-list-fully-loaded":m(N),"search-query":m(qt),"search-matched-thread-ids":Pa.value,onSelect:Rw,onArchive:eb,onStartNewThread:rb,onRenameProject:yb,onBrowseThreadFiles:ob,onSaveThreadProject:ub,onBrowseProjectFiles:ib,onSaveProject:lb,onRequestProjectGitStatus:Sb,onCreateProjectWorktree:mb,onRenameThread:wb,onForkThread:nb,onRemoveProject:bb,onReorderProject:Tb,onCopyThreadChat:Ow,onAutomationsChanged:Nw,onRestoreThread:tb,onStartNewChat:gb},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:hl,class:"sidebar-settings-area",onClick:Ib},[Gn.value?(P(),et(m(s),Kf({key:0,ref_key:"settingsDialogRef",ref:_a},jT.value),null,16)):ve("",!0),w("div",QO,[w("button",{ref_key:"settingsButtonRef",ref:Jo,class:"sidebar-settings-icon-button",type:"button",title:m(f)("Settings"),"aria-label":m(f)("Settings"),onClick:vt(ml,["stop"])},[Fe(kj,{class:"sidebar-settings-icon"})],8,XO),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:m(f)("Recycle bin"),"aria-label":m(f)("Recycle bin"),onClick:vt(Ab,["stop"])},[Fe(Ty,{class:"sidebar-settings-icon"})],8,ZO)])],512))])]),content:pt(()=>[w("div",e$,[w("section",{class:dt(["content-root",{"is-virtual-keyboard-open":dw.value}]),style:Jr(Sw.value)},[Sl.value?(P(),B("span",t$)):ve("",!0),Fe(uR,{title:nw.value,accent:vs.value||si.value},{leading:pt(()=>[m(_t)||m(It)?(P(),et(Km,{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(mn)(!m(_t))),onStartNewThread:Zc},null,8,["is-sidebar-collapsed"])):ve("",!0),vs.value?(P(),B("span",n$,[Fe(Jm)])):si.value?(P(),B("span",r$,[Fe(Ym)])):ve("",!0)]),actions:pt(()=>[mu.value?(P(),B("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":m(It)?m(Gt)?m(f)("Close side panel"):m(f)("Open side panel"):m(vr)?m(f)("Open side panel"):m(f)("Close side panel"),title:m(It)?m(Gt)?m(f)("Close side panel"):m(f)("Open side panel"):m(vr)?m(f)("Open side panel"):m(f)("Close side panel"),onClick:p[9]||(p[9]=(...b)=>m(rs)&&m(rs)(...b))},[Fe(Sy,{class:"content-header-right-panel-toggle-icon"})],8,o$)):ve("",!0)]),_:1},8,["title","accent"]),w("section",a$,[vs.value?(P(),et(m(o),{key:0,ref_key:"directoryHubRef",ref:Ir,cwd:pp.value,"thread-id":ai.value,"try-in-flight-key":Go.value,onSkillsChanged:xw,onTryItem:FT},null,8,["cwd","thread-id","try-in-flight-key"])):si.value?(P(),et(m(a),{key:1,ref_key:"automationsPanelRef",ref:sn,groups:m(M),"project-cwd-by-name":_p.value,"project-display-name-by-id":m(pe),"selected-automation-id":cp.value,onSelectAutomation:Mw,onEditAutomation:jw,onCreateAutomation:Lw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):In.value?(P(),B("div",s$,[w("div",i$,[w("p",l$,F(m(f)("Let's build")),1),Fe(Ci,{class:"new-thread-folder-dropdown","model-value":yt.value,options:Gc.value,placeholder:m(f)("Choose folder"),"enable-search":!0,"search-placeholder":m(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":Eb},null,8,["model-value","options","placeholder","search-placeholder"]),yt.value?(P(),B("p",{key:0,class:"new-thread-folder-selected",title:yt.value},F(m(f)("Selected folder"))+": "+F(yt.value),9,u$)):ve("",!0),w("div",c$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Jb},F(m(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:Fb},F(m(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:rt.value,onClick:Gb},F(rt.value?m(f)("Importing…"):m(f)("Import Project")),9,d$),w("input",{ref_key:"projectImportInputRef",ref:Bt,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:Yb},null,544)]),Qs.value?(P(),B("section",f$,[w("div",p$,[w("div",h$,[w("span",m$,[Fe(Pc)]),w("p",v$,F(m(f)("New in Codex")),1)]),w("h2",g$,F(m(f)("Plugins are here")),1),w("p",y$,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",w$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:pw},F(m(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:mp},F(m(f)("Dismiss")),1)])])):ve("",!0),(P(),et(al,{to:"body"},[gn.value?(P(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:vt(Bb,["self"]),onMouseup:Ub},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":m(f)("Select folder"),onKeydown:Cr(vt(Fi,["prevent"]),["esc"])},[w("div",T$,[w("p",S$,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",C$,F(m(f)("Current folder")),1),w("div",x$,[Mn(w("input",{ref_key:"existingFolderPathInputRef",ref:Mi,"onUpdate:modelValue":p[10]||(p[10]=b=>To.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:m(f)("Current folder"),title:To.value||m(f)("Unavailable"),disabled:Xn.value||Mr.value,onBlur:eT,onKeydown:[Cr(vt(tT,["prevent"]),["enter"]),Cr(vt(Fi,["prevent"]),["esc"])]},null,40,k$),[[Fn,To.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!xl.value||Xn.value||Mr.value,onClick:p[11]||(p[11]=b=>od())},F(Mr.value?m(f)("Opening…"):m(f)("Open")),9,I$)]),w("div",A$,[w("label",_$,[Mn(w("input",{"onUpdate:modelValue":p[12]||(p[12]=b=>ji.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Xb},null,544),[[cC,ji.value]]),w("span",null,F(m(f)("Show hidden folders")),1)]),w("button",{class:dt(["new-thread-folder-action",{"new-thread-folder-action-primary":_.value}]),type:"button","aria-pressed":_.value,disabled:!So.value||Xn.value||Mr.value||Z.value||!!yn.value&&!_.value,onClick:nT},F(m(f)("New folder")),11,P$)]),_.value?(P(),B("div",E$,[w("div",R$,[Mn(w("input",{ref_key:"createFolderInputRef",ref:cu,"onUpdate:modelValue":p[13]||(p[13]=b=>L.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:m(f)("Folder name"),onKeydown:[Cr(vt(zp,["prevent"]),["enter"]),Cr(vt(Al,["prevent"]),["esc"])]},null,40,M$),[[Fn,L.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!gw.value||Z.value,onClick:zp},F(yw.value),9,j$)]),z.value?(P(),B("div",L$,[w("span",null,F(z.value),1),w("a",{class:"visible-error-feedback",href:m(Ar),onClick:p[14]||(p[14]=b=>Pt(b,z.value))},F(m(f)("Send feedback")),9,N$)])):ve("",!0)])):ve("",!0),Mn(w("input",{ref_key:"existingFolderFilterInputRef",ref:ms,"onUpdate:modelValue":p[15]||(p[15]=b=>Vr.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:m(f)("Filter folders..."),onKeydown:Cr(vt(Fi,["prevent"]),["esc"])},null,40,O$),[[Fn,Vr.value]]),yn.value?(P(),B("div",$$,[w("div",D$,[w("span",null,F(yn.value),1),w("a",{class:"visible-error-feedback",href:m(Ar),onClick:p[16]||(p[16]=b=>Pt(b,yn.value))},F(m(f)("Send feedback")),9,F$)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Xn.value||Mr.value,onClick:Zb},F(m(f)("Retry")),9,B$)])):ve("",!0),Xn.value?(P(),B("p",U$,F(m(f)("Loading folders…")),1)):!yn.value&&Kc.value.length===0?(P(),B("p",z$,F(Vr.value.trim()?m(f)("No folders match this filter."):m(f)("No subfolders found here.")),1)):Kc.value.length>0?(P(),B("ul",H$,[(P(!0),B(ct,null,rn(Kc.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:Xn.value||Mr.value,onClick:$=>Qb(b.path)},[w("span",W$,F(b.name),1)],8,q$),b.kind==="directory"?(P(),B("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Xn.value||Mr.value,onClick:$=>od(b.path)},F(m(f)("Open")),9,G$)):ve("",!0)]))),128))])):ve("",!0)],40,b$)],32)):ve("",!0)])),(P(),et(al,{to:"body"},[W.value?(P(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:vt(zb,["self"]),onMouseup:Hb},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Create or clone project"),onKeydown:Cr(vt(Tu,["prevent"]),["esc"])},[w("div",K$,[w("p",Y$,F(m(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:tt.value,onClick:Tu},F(m(f)("Cancel")),9,J$)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":m(f)("Project source")},[w("button",{class:dt(["new-thread-project-mode-tab",{"is-active":G.value==="create"}]),type:"button",role:"tab","aria-selected":G.value==="create",disabled:tt.value,onClick:p[17]||(p[17]=b=>G.value="create")},F(m(f)("New project")),11,X$),w("button",{class:dt(["new-thread-project-mode-tab",{"is-active":G.value==="clone"}]),type:"button",role:"tab","aria-selected":G.value==="clone",disabled:tt.value,onClick:p[18]||(p[18]=b=>G.value="clone")},F(m(f)("Clone from GitHub")),11,Z$)],8,Q$),w("label",eD,[w("span",tD,F(m(f)("Destination folder")),1),Mn(w("input",{"onUpdate:modelValue":p[19]||(p[19]=b=>fe.value=b),class:"new-thread-open-folder-path",type:"text",disabled:tt.value,placeholder:m(f)("Destination folder")},null,8,nD),[[Fn,fe.value]])]),G.value==="create"?(P(),B("label",rD,[w("span",oD,F(m(f)("Project name")),1),Mn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:St,"onUpdate:modelValue":p[20]||(p[20]=b=>Ie.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:tt.value,placeholder:m(f)("Project name"),onKeydown:Cr(vt(rd,["prevent"]),["enter"])},null,40,aD),[[Fn,Ie.value]])])):G.value==="clone"?(P(),B("label",sD,[w("span",iD,F(m(f)("GitHub repository URL")),1),Mn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:St,"onUpdate:modelValue":p[21]||(p[21]=b=>ze.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:tt.value,placeholder:"https://github.com/owner/repo",onKeydown:Cr(vt(rd,["prevent"]),["enter"])},null,40,lD),[[Fn,ze.value]])])):ve("",!0),ut.value?(P(),B("div",uD,[w("span",null,F(ut.value),1),w("a",{class:"visible-error-feedback",href:m(Ar),onClick:p[22]||(p[22]=b=>Pt(b,ut.value))},F(m(f)("Send feedback")),9,cD)])):ve("",!0),w("div",dD,[w("button",{class:"new-thread-folder-action",type:"button",disabled:tt.value,onClick:Tu},F(m(f)("Cancel")),9,fD),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Tp.value||tt.value,onClick:rd},F(ww.value),9,pD)])],40,V$)],32)):ve("",!0)])),ii.value?(P(),et(tj,{key:2,class:"new-thread-runtime-dropdown",modelValue:hn.value,"onUpdate:modelValue":p[23]||(p[23]=b=>hn.value=b)},null,8,["modelValue"])):ve("",!0),hn.value==="worktree"?(P(),B("div",hD,[w("p",mD,F(m(f)("Base branch")),1),Fe(Ci,{class:"new-thread-branch-dropdown","model-value":Wn.value,options:Vc.value,placeholder:m(f)("Select branch"),"enable-search":!0,"search-placeholder":m(f)("Search branches..."),disabled:j.value||Vc.value.length===0,"onUpdate:modelValue":Rb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",vD,F(j.value?m(f)("Loading branches…"):gp.value?m(f)("New worktree branch will start from {branch}.",{branch:gp.value}):m(f)("No Git branches found for this folder.")),1)])):ve("",!0),ii.value?(P(),B("p",gD,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:dt(["worktree-init-status",{"is-running":He.value.phase==="running","is-error":He.value.phase==="error"}])},[w("strong",yD,F(He.value.title),1),w("span",wD,F(He.value.message),1)],2)):ve("",!0)]),w("div",bD,[m(Ce)?(P(),B("div",TD,[w("span",null,F(m(f)(m(Ce))),1),w("a",{class:"visible-error-feedback",href:m(Ar),onClick:p[24]||(p[24]=b=>Pt(b,m(Ce)))},F(m(f)("Send feedback")),9,SD)])):ve("",!0),Fe(Vm,{ref_key:"homeThreadComposerRef",ref:so,"active-thread-id":gs.value,cwd:An.value,"fuzzy-file-search-results":m(lt),onRegisterFuzzySession:m(J),"collaboration-modes":m(Ae),"selected-collaboration-mode":m(Le),models:m(De),"model-reasoning-efforts":m(Ne),"selected-model":fp.value,"selected-reasoning-effort":m(xe),"selected-speed-mode":m(Se),"is-updating-speed-mode":m(H),skills:m(Ee),"thread-token-usage":m(K),"codex-quota":m(me),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":is.value,"in-progress-submit-mode":ls.value,"dictation-click-to-toggle":cs.value,"dictation-auto-send":ds.value,"dictation-language":Js.value,onSubmit:Dp,"onUpdate:selectedCollaborationMode":Jp,"onUpdate:selectedModel":Gp,"onUpdate:selectedReasoningEffort":Vp,"onUpdate:selectedSpeedMode":Kp,"approval-policy":mo.value,"is-approval-policy-saving":ra.value,"approval-policy-error":Hr.value,"approval-policy-notice":qr.value,"onUpdate:approvalPolicy":oa,onSaveApprovalPolicy:Ws,onSlashCommand:Yp},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",CD,[Vn.value&&m(re)&&An.value?(P(),et(m(r),{key:0,"thread-id":m(re),cwd:An.value,"is-thread-in-progress":zc.value,"initial-file-path":aa.value,"commit-sha":Er.value,onClose:p[25]||(p[25]=b=>Vn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(P(),B(ct,{key:1},[w("div",xD,[Fe(m(t),{ref_key:"threadConversationRef",ref:Sn,messages:aw.value,"is-loading":m(oe),"is-slow-open":m(se)!==null&&m(se)===gs.value,"active-thread-id":gs.value,cwd:An.value,"live-overlay":lw.value,"live-turn-id":m(ee),"pending-requests":m(ie),"has-more-persisted-above":m(it),"is-loading-persisted-above":m(je),"load-earlier-messages":m(Ge),onForkThread:xb,onRollback:iT,onFileChangesChanged:kw,onRespondServerRequest:Mp},null,8,["messages","is-loading","is-slow-open","active-thread-id","cwd","live-overlay","live-turn-id","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:Tn},[hp.value?(P(),B("div",kD,F(m(f)("This thread is running in the Codex TUI")),1)):ve("",!0),m(Ce)?(P(),B("div",ID,[w("span",null,F(m(f)(m(Ce))),1),w("a",{class:"visible-error-feedback",href:m(Ar),onClick:p[26]||(p[26]=b=>Pt(b,m(Ce)))},F(m(f)("Send feedback")),9,AD)])):ve("",!0),Fe(m(v),{messages:m(no),onEdit:Pb,onSteer:m(ro),onDelete:m(rr),onReorder:aT},null,8,["messages","onSteer","onDelete"]),_l.value?(P(),B("div",_D,[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,PD)])):ve("",!0),hu.value?(P(),et(m(d),{key:3,request:hu.value,"request-count":m(ie).length,"has-queue-above":m(no).length>0,"panel-width":Br.value,"visual-viewport-height":Sl.value?kt.value:0,"panel-error":uw.value,onRespondServerRequest:Mp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(P(),et(Vm,{key:4,ref_key:"threadComposerRef",ref:ar,"active-thread-id":gs.value,cwd:An.value,"fuzzy-file-search-results":m(lt),onRegisterFuzzySession:m(J),"collaboration-modes":m(Ae),"selected-collaboration-mode":m(Le),models:m(De),"model-reasoning-efforts":m(Ne),"selected-model":fp.value,"selected-reasoning-effort":m(xe),"selected-speed-mode":m(Se),"is-updating-speed-mode":m(H),skills:m(Ee),"thread-token-usage":m(K),"codex-quota":m(me),"is-turn-in-progress":zc.value,"is-stop-pending":m(R),"is-interrupting-turn":m(A),"is-compacting":fw.value,"external-session-active":hp.value,"has-queue-above":m(no).length>0,"send-with-enter":is.value,"in-progress-submit-mode":ls.value,"dictation-click-to-toggle":cs.value,"dictation-auto-send":ds.value,"dictation-language":Js.value,"onUpdate:selectedCollaborationMode":Jp,onSubmit:Dp,"onUpdate:selectedModel":Gp,"onUpdate:selectedReasoningEffort":Vp,"onUpdate:selectedSpeedMode":Kp,"approval-policy":mo.value,"is-approval-policy-saving":ra.value,"approval-policy-error":Hr.value,"approval-policy-notice":qr.value,"onUpdate:approvalPolicy":oa,onSaveApprovalPolicy:Ws,"plan-panel":Uc.value,onInterrupt:sT,onSlashCommand:Yp,onImplementPlan:lT,onCompactContext:hw},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)],64))]))])],6),m(It)&&m(Gt)?(P(),B("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...b)=>m(cn)&&m(cn)(...b))})):ve("",!0),mu.value&&(m(It)||!m(vr))?(P(),B("aside",{key:1,class:dt(["content-right-panel",{"is-mobile-open":m(Gt)}]),style:Jr({"--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(lo)&&m(lo)(...b))},null,32)),w("div",ED,[w("div",RD,[w("button",{class:dt(["content-right-panel-tab",{"is-active":m(Ot)==="git"}]),type:"button",role:"tab","aria-selected":m(Ot)==="git",onClick:p[30]||(p[30]=b=>m(fn)("git"))},[Fe(ic,{class:"content-right-panel-tab-icon"}),Ps(" "+F(m(f)("Git")),1)],10,MD),w("button",{class:dt(["content-right-panel-tab",{"is-active":m(Ot)==="files"}]),type:"button",role:"tab","aria-selected":m(Ot)==="files",onClick:p[31]||(p[31]=b=>m(fn)("files"))},[Fe(Xm,{class:"content-right-panel-tab-icon"}),Ps(" "+F(m(f)("Files")),1)],10,jD),(P(!0),B(ct,null,rn(m(io),b=>(P(),B("button",{key:b.key,class:dt(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":m(Ot)==="preview"&&m(zo)===b.key}]),type:"button",role:"tab","aria-selected":m(Ot)==="preview"&&m(zo)===b.key,title:b.path,onClick:$=>m(pn)(b.key)},[Fe(dl,{class:"content-right-panel-tab-icon"}),w("span",ND,F(b.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":m(f)("Close"),title:m(f)("Close"),onClick:vt($=>m(Qt)(b.key),["stop"])},"×",8,OD)],10,LD))),128))]),w("div",$D,[w("div",DD,[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]=vt(b=>Cn.value=!m(Cn),["stop"]))},"+",8,FD),Fe(lu,{name:"right-panel-menu"},{default:pt(()=>[m(Cn)?(P(),B("div",BD,[w("button",{type:"button",onClick:p[33]||(p[33]=b=>m(fn)("terminal"))},[Fe(Pj,{class:"content-right-panel-menu-icon"}),Ps(" "+F(m(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=b=>m(fn)("git"))},[Fe(ic,{class:"content-right-panel-menu-icon"}),Ps(" "+F(m(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=b=>m(fn)("files"))},[Fe(Xm,{class:"content-right-panel-menu-icon"}),Ps(" "+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(cn)&&m(cn)(...b))},[Fe(yf,{class:"content-right-panel-close-icon"})],8,UD)])]),w("div",zD,[m(Ot)==="git"?(P(),et(m(i),{key:0,"current-branch":br.value,"head-sha":sa.value,"head-subject":C.value,"head-date":E.value,detached:x.value,dirty:X.value,"worktree-change-summary":Qe.value,"worktree-changes":Ft.value,branches:vo.value,"commits-by-branch":Tr.value,"commits-loading-for":tn.value,"commits-error":go.value,"commit-files-by-sha":yo.value,"commit-files-loading-for":ia.value,"commit-files-error":ss.value,loading:Pi.value,busy:Ra.value,error:En.value,"review-open":Vn.value,"show-review":m(mt).name==="thread"&&m(re).length>0,onToggleReview:$b,onCheckoutBranch:jb,onResetBranchToCommit:Lb,onLoadCommits:Up,onLoadCommitFiles:Nb,onOpenCommitFile:Ob},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(Ot)==="files"?(P(),et(m(l),{key:1,cwd:An.value,onOpenPreview:m(xa)},null,8,["cwd","onOpenPreview"])):m(Ot)==="preview"&&m(Ho)?(P(),et(m(c),{key:2,"file-path":m(Ho).path,name:m(Ho).label},null,8,["file-path","name"])):(P(),et(m(n),{key:3,ref_key:"threadTerminalPanelRef",ref:Ca,"thread-id":gs.value,cwd:An.value,onHide:m(xn),onTerminalFocusChange:m(Fs)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),be.value.phase!=="idle"?(P(),B("div",HD,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Export Project"),onClick:p[38]||(p[38]=vt(()=>{},["stop"]))},[w("div",WD,[w("h2",GD,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:Ep}," × ",8,VD)]),w("p",KD,F(be.value.phase==="exporting"?m(f)("Preparing project ZIP..."):be.value.fileName),1),w("div",YD,[w("span",null,F(be.value.phase==="exporting"?m(f)("Exporting"):m(f)("Ready")),1),w("span",null,F(Lc.value),1)]),w("div",JD,[w("div",{class:"project-zip-progress-fill",style:Jr({width:wl.value})},null,4)]),be.value.error?(P(),B("p",QD,F(be.value.error),1)):ve("",!0),w("div",XD,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:be.value.phase==="exporting",onClick:Ep},F(m(f)("Close")),9,ZD),w("button",{class:"project-zip-modal-action",type:"button",disabled:!be.value.blob,onClick:pb},F(m(f)("Download")),9,eF),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!be.value.blob,onClick:hb},F(m(f)("Share")),9,tF)])],8,qD)])):ve("",!0),Ks.value?(P(),B("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Xc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Complete Codex login"),onSubmit:vt(Qw,["prevent"]),onClick:p[41]||(p[41]=vt(()=>{},["stop"]))},[w("div",rF,[w("h2",oF,F(m(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":m(f)("Close"),disabled:On.value,onClick:Xc}," × ",8,aF)]),w("p",sF,F(m(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),Ys.value?(P(),B("a",{key:0,class:"codex-login-modal-link",href:Ys.value,target:"_blank",rel:"noreferrer"},F(m(f)("Open login URL")),9,iF)):ve("",!0),Mn(w("input",{ref_key:"codexLoginCallbackInputRef",ref:du,"onUpdate:modelValue":p[39]||(p[39]=b=>Ma.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:m(f)("Paste localhost callback URL"),disabled:On.value},null,8,lF),[[Fn,Ma.value]]),vn.value?(P(),B("div",uF,[w("span",null,F(vn.value),1),w("a",{class:"visible-error-feedback",href:m(Ar),onClick:p[40]||(p[40]=b=>Pt(b,vn.value))},F(m(f)("Send feedback")),9,cF)])):ve("",!0),w("div",dF,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:On.value,onClick:Xc},F(m(f)("Cancel")),9,fF),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:On.value||Ma.value.trim().length===0},F(On.value?m(f)("Completing…"):m(f)("Complete")),9,pF)])],40,nF)])):ve("",!0)],64))}}),vF=Ct(mF,[["__scopeId","data-v-62efffd7"]]),Bu={render:()=>null},gF=_x({history:sx(),routes:[{path:"/",name:"home",component:Bu},{path:"/thread/:threadId",name:"thread",component:Bu},{path:"/skills",name:"skills",component:Bu},{path:"/automations",name:"automations",component:Bu},{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");h_();gC(vF).use(gF).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(hy("Service worker registration failed."),e)})});export{ZF as $,ic as A,xr as B,Ms as C,ju as D,Qj as E,ct as F,kF as G,Io as H,yf as I,Zf as J,Nt as K,yF as L,Hf as M,mR as N,Cr as O,RA as P,Ii as Q,CI as R,SF as S,al as T,bF as U,CF as V,TF as W,xF as X,Ci as Y,QF as Z,Ct as _,EO as a,XF as a0,ip as a1,Mn as a2,Fn as a3,Ex as a4,Px as a5,eB as a6,pI as a7,jF as a8,IF as a9,dl as aA,cC as aB,YF as aC,JF as aD,AF as aa,_F as ab,DF as ac,HF as ad,qF as ae,LF as af,zF as ag,EF as ah,PF as ai,RF as aj,MF as ak,WF as al,VF as am,KF as an,NF as ao,OF as ap,$F as aq,FF as ar,UF as as,BF as at,GF as au,Hx as av,qx as aw,Pc as ax,AR as ay,wF as az,PO as b,Y as c,Zm as d,bn as e,P as f,Yf as g,et as h,B as i,w as j,ve as k,rn as l,Ps as m,dt as n,Os as o,Fe as p,lu as q,T as r,pt as s,F as t,m as u,wa as v,vt as w,ot as x,Jr as y,yy as z};