codex-mobile-re 0.1.134 → 0.1.136

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 (24) hide show
  1. package/README.md +214 -214
  2. package/dist/assets/{AutomationsPanel-CPmFyFEQ.js → AutomationsPanel-BrxpYd3F.js} +1 -1
  3. package/dist/assets/{DirectoryHub-98VWiJA8.js → DirectoryHub-CbWz81wr.js} +1 -1
  4. package/dist/assets/{QueuedMessages-D_vueKGf.js → QueuedMessages-BYByp2ES.js} +1 -1
  5. package/dist/assets/{ReviewPane-BSREI-GV.js → ReviewPane-BzcuGGZz.js} +1 -1
  6. package/dist/assets/{RightFilePreview-CoX2APsz.js → RightFilePreview-BRXbHofi.js} +1 -1
  7. package/dist/assets/{RightFilesPanel-BEfSnNoe.js → RightFilesPanel-mG5aaeVI.js} +1 -1
  8. package/dist/assets/{RightGitPanel-B_XONRO5.js → RightGitPanel-BsVCibLZ.js} +1 -1
  9. package/dist/assets/{SettingsDialog-DWXo_tgA.js → SettingsDialog-D34lKAxd.js} +1 -1
  10. package/dist/assets/{ThreadConversation-Dtax0JLK.js → ThreadConversation-BiyKia_7.js} +5 -5
  11. package/dist/assets/{ThreadConversation-DynO33d_.css → ThreadConversation-DynLmaDw.css} +1 -1
  12. package/dist/assets/{ThreadPendingRequestPanel-DIuf5YSm.js → ThreadPendingRequestPanel-Bg_3qi-T.js} +1 -1
  13. package/dist/assets/{ThreadTerminalPanel-idJzeGIj.js → ThreadTerminalPanel-BlisDnyv.js} +1 -1
  14. package/dist/assets/common-DEPjExR-.js +5 -0
  15. package/dist/assets/index-ChD_mFyW.js +98 -0
  16. package/dist/assets/{index-D7o4ya4e.css → index-CuSbagu4.css} +1 -1
  17. package/dist/fonts/LICENSE-Bricolage-Grotesque.txt +93 -93
  18. package/dist/fonts/LICENSE-IBM-Plex.txt +93 -93
  19. package/dist/index.html +2 -2
  20. package/dist-cli/index.js +0 -0
  21. package/dist-cli/index.js.map +1 -1
  22. package/package.json +81 -79
  23. package/dist/assets/common-BeuopZEI.js +0 -5
  24. package/dist/assets/index-CJDrYqZR.js +0 -98
@@ -1,98 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-Dtax0JLK.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-DynO33d_.css","assets/ThreadTerminalPanel-idJzeGIj.js","assets/ThreadTerminalPanel-DkX7vTl_.css","assets/ReviewPane-BSREI-GV.js","assets/ReviewPane-BFBDQWlW.css","assets/DirectoryHub-98VWiJA8.js","assets/DirectoryHub-DcMzIMOW.css","assets/AutomationsPanel-CPmFyFEQ.js","assets/AutomationsPanel-Dz1E0PMi.css","assets/SettingsDialog-DWXo_tgA.js","assets/SettingsDialog-C6mYdSFF.css","assets/RightGitPanel-B_XONRO5.js","assets/RightGitPanel-CQgG9pXB.css","assets/RightFilesPanel-BEfSnNoe.js","assets/RightFilesPanel-ev__hRb5.css","assets/RightFilePreview-CoX2APsz.js","assets/RightFilePreview-DNZDBkBr.css","assets/ThreadPendingRequestPanel-DIuf5YSm.js","assets/ThreadPendingRequestPanel-BlBoJVzv.css","assets/QueuedMessages-D_vueKGf.js","assets/QueuedMessages-D6bvkQIC.css"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
3
- * @vue/shared v3.5.40
4
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
- * @license MIT
6
- **/function eh(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ht={},rl=[],Ta=()=>{},wv=()=>!1,jc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),$c=e=>e.startsWith("onUpdate:"),Tn=Object.assign,th=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},X0=Object.prototype.hasOwnProperty,Dt=(e,t)=>X0.call(e,t),it=Array.isArray,ol=e=>uu(e)==="[object Map]",Nc=e=>uu(e)==="[object Set]",Bp=e=>uu(e)==="[object Date]",ht=e=>typeof e=="function",Qt=e=>typeof e=="string",Oo=e=>typeof e=="symbol",Ft=e=>e!==null&&typeof e=="object",bv=e=>(Ft(e)||ht(e))&&ht(e.then)&&ht(e.catch),Tv=Object.prototype.toString,uu=e=>Tv.call(e),Z0=e=>uu(e).slice(8,-1),kv=e=>uu(e)==="[object Object]",nh=e=>Qt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ql=eh(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Oc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},ek=/-\w/g,fr=Oc(e=>e.replace(ek,t=>t.slice(1).toUpperCase())),tk=/\B([A-Z])/g,ei=Oc(e=>e.replace(tk,"-$1").toLowerCase()),Dc=Oc(e=>e.charAt(0).toUpperCase()+e.slice(1)),Pd=Oc(e=>e?`on${Dc(e)}`:""),Ro=(e,t)=>!Object.is(e,t),ec=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Sv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},rh=e=>{const t=parseFloat(e);return isNaN(t)?e:t},nk=e=>{const t=Qt(e)?Number(e):NaN;return isNaN(t)?e:t};let Up;const Fc=()=>Up||(Up=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function oo(e){if(it(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Qt(r)?sk(r):oo(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(Qt(e)||Ft(e))return e}const rk=/;(?![^(]*\))/g,ok=/:([^]+)/,ak=/\/\*[^]*?\*\//g;function sk(e){const t={};return e.replace(ak,"").split(rk).forEach(n=>{if(n){const r=n.split(ok);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ct(e){let t="";if(Qt(e))t=e;else if(it(e))for(let n=0;n<e.length;n++){const r=ct(e[n]);r&&(t+=r+" ")}else if(Ft(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ik="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",lk=eh(ik);function Cv(e){return!!e||e===""}function uk(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=cu(e[r],t[r]);return n}function cu(e,t){if(e===t)return!0;let n=Bp(e),r=Bp(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Oo(e),r=Oo(t),n||r)return e===t;if(n=it(e),r=it(t),n||r)return n&&r?uk(e,t):!1;if(n=Ft(e),r=Ft(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||!cu(e[s],t[s]))return!1}}return String(e)===String(t)}function xv(e,t){return e.findIndex(n=>cu(n,t))}const Iv=e=>!!(e&&e.__v_isRef===!0),D=e=>Qt(e)?e:e==null?"":it(e)||Ft(e)&&(e.toString===Tv||!ht(e.toString))?Iv(e)?D(e.value):JSON.stringify(e,Av,2):String(e),Av=(e,t)=>Iv(t)?Av(e,t.value):ol(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[Ed(r,a)+" =>"]=o,n),{})}:Nc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Ed(n))}:Oo(t)?Ed(t):Ft(t)&&!it(t)&&!kv(t)?String(t):t,Ed=(e,t="")=>{var n;return Oo(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
- * @vue/reactivity v3.5.40
8
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
- * @license MIT
10
- **/let Bn;class ck{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&&Bn&&(Bn.active?(this.parent=Bn,this.index=(Bn.scopes||(Bn.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=Bn;try{return Bn=this,t()}finally{Bn=n}}}on(){++this._on===1&&(this.prevScope=Bn,Bn=this)}off(){if(this._on>0&&--this._on===0){if(Bn===this)Bn=this.prevScope;else{let t=Bn;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 dk(){return Bn}let Vt;const Md=new WeakSet;class _v{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Bn&&(Bn.active?Bn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Md.has(this)&&(Md.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ev(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,zp(this),Mv(this);const t=Vt,n=$o;Vt=this,$o=!0;try{return this.fn()}finally{Rv(this),Vt=t,$o=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)sh(t);this.deps=this.depsTail=void 0,zp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Md.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ff(this)&&this.run()}get dirty(){return ff(this)}}let Pv=0,Gl,Vl;function Ev(e,t=!1){if(e.flags|=8,t){e.next=Vl,Vl=e;return}e.next=Gl,Gl=e}function oh(){Pv++}function ah(){if(--Pv>0)return;if(Vl){let t=Vl;for(Vl=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Gl;){let t=Gl;for(Gl=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 Mv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Rv(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),sh(r),fk(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function ff(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Lv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Lv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Zl)||(e.globalVersion=Zl,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ff(e))))return;e.flags|=2;const t=e.dep,n=Vt,r=$o;Vt=e,$o=!0;try{Mv(e);const o=e.fn(e._value);(t.version===0||Ro(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Vt=n,$o=r,Rv(e),e.flags&=-3}}function sh(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)sh(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function fk(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let $o=!0;const jv=[];function ts(){jv.push($o),$o=!1}function ns(){const e=jv.pop();$o=e===void 0?!0:e}function zp(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Vt;Vt=void 0;try{t()}finally{Vt=n}}}let Zl=0;class hk{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 ih{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(!Vt||!$o||Vt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Vt)n=this.activeLink=new hk(Vt,this),Vt.deps?(n.prevDep=Vt.depsTail,Vt.depsTail.nextDep=n,Vt.depsTail=n):Vt.deps=Vt.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=Vt.depsTail,n.nextDep=void 0,Vt.depsTail.nextDep=n,Vt.depsTail=n,Vt.deps===n&&(Vt.deps=r)}return n}trigger(t){this.version++,Zl++,this.notify(t)}notify(t){oh();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ah()}}}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 hf=new WeakMap,xi=Symbol(""),pf=Symbol(""),eu=Symbol("");function Qn(e,t,n){if($o&&Vt){let r=hf.get(e);r||hf.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new ih),o.map=r,o.key=n),o.track()}}function Ka(e,t,n,r,o,a){const s=hf.get(e);if(!s){Zl++;return}const i=l=>{l&&l.trigger()};if(oh(),t==="clear")s.forEach(i);else{const l=it(e),u=l&&nh(n);if(l&&n==="length"){const d=Number(r);s.forEach((m,f)=>{(f==="length"||f===eu||!Oo(f)&&f>=d)&&i(m)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),u&&i(s.get(eu)),t){case"add":l?u&&i(s.get("length")):(i(s.get(xi)),ol(e)&&i(s.get(pf)));break;case"delete":l||(i(s.get(xi)),ol(e)&&i(s.get(pf)));break;case"set":ol(e)&&i(s.get(xi));break}}ah()}function Ki(e){const t=jt(e);return t===e?t:(Qn(t,"iterate",eu),ao(e)?t:t.map(Do))}function Bc(e){return Qn(e=jt(e),"iterate",eu),e}function ya(e,t){return rs(e)?pl(Ii(e)?Do(t):t):Do(t)}const pk={__proto__:null,[Symbol.iterator](){return Rd(this,Symbol.iterator,e=>ya(this,e))},concat(...e){return Ki(this).concat(...e.map(t=>it(t)?Ki(t):t))},entries(){return Rd(this,"entries",e=>(e[1]=ya(this,e[1]),e))},every(e,t){return za(this,"every",e,t,void 0,arguments)},filter(e,t){return za(this,"filter",e,t,n=>n.map(r=>ya(this,r)),arguments)},find(e,t){return za(this,"find",e,t,n=>ya(this,n),arguments)},findIndex(e,t){return za(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return za(this,"findLast",e,t,n=>ya(this,n),arguments)},findLastIndex(e,t){return za(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return za(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ld(this,"includes",e)},indexOf(...e){return Ld(this,"indexOf",e)},join(e){return Ki(this).join(e)},lastIndexOf(...e){return Ld(this,"lastIndexOf",e)},map(e,t){return za(this,"map",e,t,void 0,arguments)},pop(){return $l(this,"pop")},push(...e){return $l(this,"push",e)},reduce(e,...t){return Hp(this,"reduce",e,t)},reduceRight(e,...t){return Hp(this,"reduceRight",e,t)},shift(){return $l(this,"shift")},some(e,t){return za(this,"some",e,t,void 0,arguments)},splice(...e){return $l(this,"splice",e)},toReversed(){return Ki(this).toReversed()},toSorted(e){return Ki(this).toSorted(e)},toSpliced(...e){return Ki(this).toSpliced(...e)},unshift(...e){return $l(this,"unshift",e)},values(){return Rd(this,"values",e=>ya(this,e))}};function Rd(e,t,n){const r=Bc(e),o=r[t]();return r!==e&&!ao(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const mk=Array.prototype;function za(e,t,n,r,o,a){const s=Bc(e),i=s!==e&&!ao(e),l=s[t];if(l!==mk[t]){const m=l.apply(e,a);return i?Do(m):m}let u=n;s!==e&&(i?u=function(m,f){return n.call(this,ya(e,m),f,e)}:n.length>2&&(u=function(m,f){return n.call(this,m,f,e)}));const d=l.call(s,u,r);return i&&o?o(d):d}function Hp(e,t,n,r){const o=Bc(e),a=o!==e&&!ao(e);let s=n,i=!1;o!==e&&(a?(i=r.length===0,s=function(u,d,m){return i&&(i=!1,u=ya(e,u)),n.call(this,u,ya(e,d),m,e)}):n.length>3&&(s=function(u,d,m){return n.call(this,u,d,m,e)}));const l=o[t](s,...r);return i?ya(e,l):l}function Ld(e,t,n){const r=jt(e);Qn(r,"iterate",eu);const o=r[t](...n);return(o===-1||o===!1)&&ch(n[0])?(n[0]=jt(n[0]),r[t](...n)):o}function $l(e,t,n=[]){ts(),oh();const r=jt(e)[t].apply(e,n);return ah(),ns(),r}const gk=eh("__proto__,__v_isRef,__isVue"),Nv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Oo));function vk(e){Oo(e)||(e=String(e));const t=jt(this);return Qn(t,"has",e),t.hasOwnProperty(e)}class Ov{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?Ak:Uv:a?Bv:Fv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=it(t);if(!o){let l;if(s&&(l=pk[n]))return l;if(n==="hasOwnProperty")return vk}const i=Reflect.get(t,n,jn(t)?t:r);if((Oo(n)?Nv.has(n):gk(n))||(o||Qn(t,"get",n),a))return i;if(jn(i)){const l=s&&nh(n)?i:i.value;return o&&Ft(l)?gf(l):l}return Ft(i)?o?gf(i):Uc(i):i}}class Dv extends Ov{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=it(t)&&nh(n);if(!this._isShallow){const u=rs(a);if(!ao(r)&&!rs(r)&&(a=jt(a),r=jt(r)),!s&&jn(a)&&!jn(r))return u||(a.value=r),!0}const i=s?Number(n)<t.length:Dt(t,n),l=Reflect.set(t,n,r,jn(t)?t:o);return t===jt(o)&&l&&(i?Ro(r,a)&&Ka(t,"set",n,r):Ka(t,"add",n,r)),l}deleteProperty(t,n){const r=Dt(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&Ka(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!Oo(n)||!Nv.has(n))&&Qn(t,"has",n),r}ownKeys(t){return Qn(t,"iterate",it(t)?"length":xi),Reflect.ownKeys(t)}}class yk extends Ov{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const wk=new Dv,bk=new yk,Tk=new Dv(!0);const mf=e=>e,Ou=e=>Reflect.getPrototypeOf(e);function kk(e,t,n){return function(...r){const o=this.__v_raw,a=jt(o),s=ol(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?mf:t?pl:Do;return!t&&Qn(a,"iterate",l?pf:xi),Tn(Object.create(u),{next(){const{value:m,done:f}=u.next();return f?{value:m,done:f}:{value:i?[d(m[0]),d(m[1])]:d(m),done:f}}})}}function Du(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Sk(e,t){const n={get(o){const a=this.__v_raw,s=jt(a),i=jt(o);e||(Ro(o,i)&&Qn(s,"get",o),Qn(s,"get",i));const{has:l}=Ou(s),u=t?mf:e?pl:Do;if(l.call(s,o))return u(a.get(o));if(l.call(s,i))return u(a.get(i));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&Qn(jt(o),"iterate",xi),o.size},has(o){const a=this.__v_raw,s=jt(a),i=jt(o);return e||(Ro(o,i)&&Qn(s,"has",o),Qn(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=jt(i),u=t?mf:e?pl:Do;return!e&&Qn(l,"iterate",xi),i.forEach((d,m)=>o.call(a,u(d),u(m),s))}};return Tn(n,e?{add:Du("add"),set:Du("set"),delete:Du("delete"),clear:Du("clear")}:{add(o){const a=jt(this),s=Ou(a),i=jt(o),l=!t&&!ao(o)&&!rs(o)?i:o;return s.has.call(a,l)||Ro(o,l)&&s.has.call(a,o)||Ro(i,l)&&s.has.call(a,i)||(a.add(l),Ka(a,"add",l,l)),this},set(o,a){!t&&!ao(a)&&!rs(a)&&(a=jt(a));const s=jt(this),{has:i,get:l}=Ou(s);let u=i.call(s,o);u||(o=jt(o),u=i.call(s,o));const d=l.call(s,o);return s.set(o,a),u?Ro(a,d)&&Ka(s,"set",o,a):Ka(s,"add",o,a),this},delete(o){const a=jt(this),{has:s,get:i}=Ou(a);let l=s.call(a,o);l||(o=jt(o),l=s.call(a,o)),i&&i.call(a,o);const u=a.delete(o);return l&&Ka(a,"delete",o,void 0),u},clear(){const o=jt(this),a=o.size!==0,s=o.clear();return a&&Ka(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=kk(o,e,t)}),n}function lh(e,t){const n=Sk(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Dt(n,o)&&o in r?n:r,o,a)}const Ck={get:lh(!1,!1)},xk={get:lh(!1,!0)},Ik={get:lh(!0,!1)};const Fv=new WeakMap,Bv=new WeakMap,Uv=new WeakMap,Ak=new WeakMap;function _k(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Uc(e){return rs(e)?e:uh(e,!1,wk,Ck,Fv)}function zv(e){return uh(e,!1,Tk,xk,Bv)}function gf(e){return uh(e,!0,bk,Ik,Uv)}function uh(e,t,n,r,o){if(!Ft(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=_k(Z0(e));if(s===0)return e;const i=new Proxy(e,s===2?r:n);return o.set(e,i),i}function Ii(e){return rs(e)?Ii(e.__v_raw):!!(e&&e.__v_isReactive)}function rs(e){return!!(e&&e.__v_isReadonly)}function ao(e){return!!(e&&e.__v_isShallow)}function ch(e){return e?!!e.__v_raw:!1}function jt(e){const t=e&&e.__v_raw;return t?jt(t):e}function Pk(e){return!Dt(e,"__v_skip")&&Object.isExtensible(e)&&Sv(e,"__v_skip",!0),e}const Do=e=>Ft(e)?Uc(e):e,pl=e=>Ft(e)?gf(e):e;function jn(e){return e?e.__v_isRef===!0:!1}function k(e){return Hv(e,!1)}function Ek(e){return Hv(e,!0)}function Hv(e,t){return jn(e)?e:new Mk(e,t)}class Mk{constructor(t,n){this.dep=new ih,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:jt(t),this._value=n?t:Do(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||ao(t)||rs(t);t=r?t:jt(t),Ro(t,n)&&(this._rawValue=t,this._value=r?t:Do(t),this.dep.trigger())}}function g(e){return jn(e)?e.value:e}const Rk={get:(e,t,n)=>t==="__v_raw"?e:g(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 Wv(e){return Ii(e)?e:new Proxy(e,Rk)}class Lk{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ih(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Zl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Vt!==this)return Ev(this,!0),!0}get value(){const t=this.dep.track();return Lv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function jk(e,t,n=!1){let r,o;return ht(e)?r=e:(r=e.get,o=e.set),new Lk(r,o,n)}const Fu={},uc=new WeakMap;let wi;function $k(e,t=!1,n=wi){if(n){let r=uc.get(n);r||uc.set(n,r=[]),r.push(e)}}function Nk(e,t,n=Ht){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:i,call:l}=n,u=L=>o?L:ao(L)||o===!1||o===0?Ya(L,1):Ya(L);let d,m,f,v,T=!1,S=!1;if(jn(e)?(m=()=>e.value,T=ao(e)):Ii(e)?(m=()=>u(e),T=!0):it(e)?(S=!0,T=e.some(L=>Ii(L)||ao(L)),m=()=>e.map(L=>{if(jn(L))return L.value;if(Ii(L))return u(L);if(ht(L))return l?l(L,2):L()})):ht(e)?t?m=l?()=>l(e,2):e:m=()=>{if(f){ts();try{f()}finally{ns()}}const L=wi;wi=d;try{return l?l(e,3,[v]):e(v)}finally{wi=L}}:m=Ta,t&&o){const L=m,fe=o===!0?1/0:o;m=()=>Ya(L(),fe)}const R=dk(),E=()=>{d.stop(),R&&R.active&&th(R.effects,d)};if(a&&t){const L=t;t=(...fe)=>{const le=L(...fe);return E(),le}}let N=S?new Array(e.length).fill(Fu):Fu;const W=L=>{if(!(!(d.flags&1)||!d.dirty&&!L))if(t){const fe=d.run();if(L||o||T||(S?fe.some((le,Y)=>Ro(le,N[Y])):Ro(fe,N))){f&&f();const le=wi;wi=d;try{const Y=[fe,N===Fu?void 0:S&&N[0]===Fu?[]:N,v];N=fe,l?l(t,3,Y):t(...Y)}finally{wi=le}}}else d.run()};return i&&i(W),d=new _v(m),d.scheduler=s?()=>s(W,!1):W,v=L=>$k(L,!1,d),f=d.onStop=()=>{const L=uc.get(d);if(L){if(l)l(L,4);else for(const fe of L)fe();uc.delete(d)}},t?r?W(!0):N=d.run():s?s(W.bind(null,!0),!0):d.run(),E.pause=d.pause.bind(d),E.resume=d.resume.bind(d),E.stop=E,E}function Ya(e,t=1/0,n){if(t<=0||!Ft(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,jn(e))Ya(e.value,t,n);else if(it(e))for(let r=0;r<e.length;r++)Ya(e[r],t,n);else if(Nc(e)||ol(e))e.forEach(r=>{Ya(r,t,n)});else if(kv(e)){for(const r in e)Ya(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ya(e[r],t,n)}return e}/**
11
- * @vue/runtime-core v3.5.40
12
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
- * @license MIT
14
- **/function du(e,t,n,r){try{return r?e(...r):e()}catch(o){fu(o,t,n)}}function io(e,t,n,r){if(ht(e)){const o=du(e,t,n,r);return o&&bv(o)&&o.catch(a=>{fu(a,t,n)}),o}if(it(e)){const o=[];for(let a=0;a<e.length;a++)o.push(io(e[a],t,n,r));return o}}function fu(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Ht;if(t){let i=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const d=i.ec;if(d){for(let m=0;m<d.length;m++)if(d[m](e,l,u)===!1)return}i=i.parent}if(a){ts(),du(a,null,10,[e,l,u]),ns();return}}Ok(e,n,o,r,s)}function Ok(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const cr=[];let va=-1;const al=[];let Hs=null,Xi=0;const qv=Promise.resolve();let cc=null;function Mt(e){const t=cc||qv;return e?t.then(this?e.bind(this):e):t}function Dk(e){let t=va+1,n=cr.length;for(;t<n;){const r=t+n>>>1,o=cr[r],a=tu(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function dh(e){if(!(e.flags&1)){const t=tu(e),n=cr[cr.length-1];!n||!(e.flags&2)&&t>=tu(n)?cr.push(e):cr.splice(Dk(t),0,e),e.flags|=1,Gv()}}function Gv(){cc||(cc=qv.then(Kv))}function Fk(e){it(e)?al.push(...e):Hs&&e.id===-1?Hs.splice(Xi+1,0,e):e.flags&1||(al.push(e),e.flags|=1),Gv()}function Wp(e,t,n=va+1){for(;n<cr.length;n++){const r=cr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;cr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Vv(e){if(al.length){const t=[...new Set(al)].sort((n,r)=>tu(n)-tu(r));if(al.length=0,Hs){Hs.push(...t);return}for(Hs=t,Xi=0;Xi<Hs.length;Xi++){const n=Hs[Xi];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Hs=null,Xi=0}}const tu=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Kv(e){try{for(va=0;va<cr.length;va++){const t=cr[va];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),du(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;va<cr.length;va++){const t=cr[va];t&&(t.flags&=-2)}va=-1,cr.length=0,Vv(),cc=null,(cr.length||al.length)&&Kv()}}let Hn=null,Yv=null;function dc(e){const t=Hn;return Hn=e,Yv=e&&e.type.__scopeId||null,t}function ft(e,t=Hn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&pc(-1);const a=dc(t),s=Qa.length;let i;try{i=e(...o)}finally{for(let l=Qa.length;l>s;l--)vh();dc(a),r._d&&pc(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function _n(e,t){if(Hn===null)return e;const n=qc(Hn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,i,l=Ht]=t[o];a&&(ht(a)&&(a={mounted:a,updated:a}),a.deep&&Ya(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function pi(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&&(ts(),io(l,n,8,[e.el,i,e,t]),ns())}}function tc(e,t){if(zn){let n=zn.provides;const r=zn.parent&&zn.parent.provides;r===n&&(n=zn.provides=Object.create(r)),n[e]=t}}function No(e,t,n=!1){const r=wh();if(r||il){let o=il?il._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 Bk=Symbol.for("v-scx"),Uk=()=>No(Bk);function tt(e,t,n){return Jv(e,t,n)}function Jv(e,t,n=Ht){const{immediate:r,deep:o,flush:a,once:s}=n,i=Tn({},n),l=t&&r||!t&&a!=="post";let u;if(gl){if(a==="sync"){const v=Uk();u=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=Ta,v.resume=Ta,v.pause=Ta,v}}const d=zn;i.call=(v,T,S)=>io(v,d,T,S);let m=!1;a==="post"?i.scheduler=v=>{lr(v,d&&d.suspense)}:a!=="sync"&&(m=!0,i.scheduler=(v,T)=>{T?v():dh(v)}),i.augmentJob=v=>{t&&(v.flags|=4),m&&(v.flags|=2,d&&(v.id=d.uid,v.i=d))};const f=Nk(e,t,i);return gl&&(u?u.push(f):l&&f()),f}function zk(e,t,n){const r=this.proxy,o=Qt(e)?e.includes(".")?Qv(r,e):()=>r[e]:e.bind(r,r);let a;ht(t)?a=t:(a=t.handler,n=t);const s=mu(this),i=Jv(o,a.bind(r),n);return s(),i}function Qv(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 Bs=new WeakMap,Xv=Symbol("_vte"),Zv=e=>e.__isTeleport,Ti=e=>e&&(e.disabled||e.disabled===""),Hk=e=>e&&(e.defer||e.defer===""),qp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Gp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,vf=(e,t)=>{const n=e&&e.to;return Qt(n)?t?t(n):null:n},Wk={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,i,l,u){const{mc:d,pc:m,pbc:f,o:{insert:v,querySelector:T,createText:S,createComment:R,parentNode:E}}=u,N=Ti(t.props);let{dynamicChildren:W}=t;const L=(Y,ie,we)=>{Y.shapeFlag&16&&d(Y.children,ie,we,o,a,s,i,l)},fe=(Y=t)=>{const ie=Ti(Y.props),we=Y.target=vf(Y.props,T),Pe=yf(we,Y,S,v);we&&(s!=="svg"&&qp(we)?s="svg":s!=="mathml"&&Gp(we)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(we),ie||(L(Y,we,Pe),Ul(Y,!1)))},le=Y=>{const ie=()=>{if(Bs.get(Y)===ie){if(Bs.delete(Y),Ti(Y.props)){const we=E(Y.el)||n;L(Y,we,Y.anchor),Ul(Y,!0)}fe(Y)}};Bs.set(Y,ie),lr(ie,a)};if(e==null){const Y=t.el=S(""),ie=t.anchor=S("");if(v(Y,n,r),v(ie,n,r),Hk(t.props)||a&&a.pendingBranch){le(t);return}N&&(L(t,n,ie),Ul(t,!0)),fe()}else{t.el=e.el;const Y=t.anchor=e.anchor,ie=Bs.get(e);if(ie){ie.flags|=8,Bs.delete(e),le(t);return}t.targetStart=e.targetStart;const we=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,ye=Ti(e.props),ee=ye?n:we,ve=ye?Y:Pe;if(s==="svg"||qp(we)?s="svg":(s==="mathml"||Gp(we))&&(s="mathml"),W?(f(e.dynamicChildren,W,ee,o,a,s,i),gh(e,t,!0)):l||m(e,t,ee,ve,o,a,s,i,!1),N)ye?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Bu(t,n,Y,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ne=vf(t.props,T);ne&&(t.target=ne,Bu(t,ne,null,u,0))}else ye&&Bu(t,we,Pe,u,1);Ul(t,N)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:u,targetAnchor:d,target:m,props:f}=e,v=Ti(f),T=a||!v,S=Bs.get(e);if(S&&(S.flags|=8,Bs.delete(e)),m&&(o(u),o(d)),a&&o(l),!S&&(v||m)&&s&16)for(let R=0;R<i.length;R++){const E=i[R];r(E,t,n,T,!!E.dynamicChildren)}},move:Bu,hydrate:qk};function Bu(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:u,props:d}=e,m=a===2;if(m&&r(s,t,n),!Bs.has(e)&&(!m||Ti(d))&&l&16)for(let f=0;f<u.length;f++)o(u[f],t,n,2);m&&r(i,t,n)}function qk(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:u,createText:d}},m){function f(R,E){let N=E;for(;N;){if(N&&N.nodeType===8){if(N.data==="teleport start anchor")t.targetStart=N;else if(N.data==="teleport anchor"){t.targetAnchor=N,R._lpa=t.targetAnchor&&s(t.targetAnchor);break}}N=s(N)}}function v(R,E){E.anchor=m(s(R),E,i(R),n,r,o,a)}const T=t.target=vf(t.props,l),S=Ti(t.props);if(T){const R=T._lpa||T.firstChild;t.shapeFlag&16&&(S?(v(e,t),f(T,R),t.targetAnchor||yf(T,t,d,u,i(e)===T?e:null)):(t.anchor=s(e),f(T,R),t.targetAnchor||yf(T,t,d,u),m(R&&s(R),t,T,n,r,o,a))),Ul(t,S)}else S&&t.shapeFlag&16&&(v(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Qs=Wk;function Ul(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 yf(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[Xv]=s,e&&(r(a,e,o),r(s,e,o)),s}const ro=Symbol("_leaveCb"),Nl=Symbol("_enterCb");function Gk(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ss(()=>{e.isMounted=!0}),ti(()=>{e.isUnmounting=!0}),e}const no=[Function,Array],ey={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:no,onEnter:no,onAfterEnter:no,onEnterCancelled:no,onBeforeLeave:no,onLeave:no,onAfterLeave:no,onLeaveCancelled:no,onBeforeAppear:no,onAppear:no,onAfterAppear:no,onAppearCancelled:no},ty=e=>{const t=e.subTree;return t.component?ty(t.component):t},Vk={name:"BaseTransition",props:ey,setup(e,{slots:t}){const n=wh(),r=Gk();return()=>{const o=t.default&&oy(t.default(),!0),a=o&&o.length?ny(o):n.subTree?pe():void 0;if(!a)return;const s=jt(e),{mode:i}=s;if(r.isLeaving)return jd(a);const l=Vp(a);if(!l)return jd(a);let u=wf(l,s,r,n,m=>u=m);l.type!==Xn&&nu(l,u);let d=n.subTree&&Vp(n.subTree);if(d&&d.type!==Xn&&!ki(d,l)&&ty(n).type!==Xn){let m=wf(d,s,r,n);if(nu(d,m),i==="out-in"&&l.type!==Xn)return r.isLeaving=!0,m.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete m.afterLeave,d=void 0},jd(a);i==="in-out"&&l.type!==Xn?m.delayLeave=(f,v,T)=>{const S=ry(r,d);S[String(d.key)]=d,f[ro]=()=>{v(),f[ro]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{T(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return a}}};function ny(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Xn){t=n;break}}return t}const Kk=Vk;function ry(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 wf(e,t,n,r,o){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:m,onBeforeLeave:f,onLeave:v,onAfterLeave:T,onLeaveCancelled:S,onBeforeAppear:R,onAppear:E,onAfterAppear:N,onAppearCancelled:W}=t,L=String(e.key),fe=ry(n,e),le=(we,Pe)=>{we&&io(we,r,9,Pe)},Y=(we,Pe)=>{const ye=Pe[1];le(we,Pe),it(we)?we.every(ee=>ee.length<=1)&&ye():we.length<=1&&ye()},ie={mode:s,persisted:i,beforeEnter(we){let Pe=l;if(!n.isMounted)if(a)Pe=R||l;else return;we[ro]&&we[ro](!0);const ye=fe[L];ye&&ki(e,ye)&&ye.el[ro]&&ye.el[ro](),le(Pe,[we])},enter(we){if(fe[L]===e)return;let Pe=u,ye=d,ee=m;if(!n.isMounted)if(a)Pe=E||u,ye=N||d,ee=W||m;else return;let ve=!1;we[Nl]=Ae=>{ve||(ve=!0,Ae?le(ee,[we]):le(ye,[we]),ie.delayedLeave&&ie.delayedLeave(),we[Nl]=void 0)};const ne=we[Nl].bind(null,!1);Pe?Y(Pe,[we,ne]):ne()},leave(we,Pe){const ye=String(e.key);if(we[Nl]&&we[Nl](!0),n.isUnmounting)return Pe();le(f,[we]);let ee=!1;we[ro]=ne=>{ee||(ee=!0,Pe(),ne?le(S,[we]):le(T,[we]),we[ro]=void 0,fe[ye]===e&&delete fe[ye])};const ve=we[ro].bind(null,!1);fe[ye]=e,v?Y(v,[we,ve]):ve()},clone(we){const Pe=wf(we,t,n,r,o);return o&&o(Pe),Pe}};return ie}function jd(e){if(hu(e))return e=Xs(e),e.children=null,e}function Vp(e){if(!hu(e))return Zv(e.type)&&e.children?ny(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 nu(e,t){e.shapeFlag&6&&e.component?(e.transition=t,nu(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function oy(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===rt?(s.patchFlag&128&&o++,r=r.concat(oy(s.children,t,i))):(t||s.type!==Xn)&&r.push(i!=null?Xs(s,{key:i}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function hn(e,t){return ht(e)?Tn({name:e.name},t,{setup:e}):e}function fh(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Kp(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const fc=new WeakMap;function Kl(e,t,n,r,o=!1){if(it(e)){e.forEach((S,R)=>Kl(S,t&&(it(t)?t[R]:t),n,r,o));return}if(sl(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Kl(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?qc(r.component):r.el,s=o?null:a,{i,r:l}=e,u=t&&t.r,d=i.refs===Ht?i.refs={}:i.refs,m=i.setupState,f=jt(m),v=m===Ht?wv:S=>Kp(d,S)?!1:Dt(f,S),T=(S,R)=>!(R&&Kp(d,R));if(u!=null&&u!==l){if(Yp(t),Qt(u))d[u]=null,v(u)&&(m[u]=null);else if(jn(u)){const S=t;T(u,S.k)&&(u.value=null),S.k&&(d[S.k]=null)}}if(ht(l))du(l,i,12,[s,d]);else{const S=Qt(l),R=jn(l);if(S||R){const E=()=>{if(e.f){const N=S?v(l)?m[l]:d[l]:T()||!e.k?l.value:d[e.k];if(o)it(N)&&th(N,a);else if(it(N))N.includes(a)||N.push(a);else if(S)d[l]=[a],v(l)&&(m[l]=d[l]);else{const W=[a];T(l,e.k)&&(l.value=W),e.k&&(d[e.k]=W)}}else S?(d[l]=s,v(l)&&(m[l]=s)):R&&(T(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const N=()=>{E(),fc.delete(e)};N.id=-1,fc.set(e,N),lr(N,n)}else Yp(e),E()}}}function Yp(e){const t=fc.get(e);t&&(t.flags|=8,fc.delete(e))}const Jp=e=>e.nodeType===8;Fc().requestIdleCallback;Fc().cancelIdleCallback;function Yk(e,t){if(Jp(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Jp(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const sl=e=>!!e.type.__asyncLoader;function Po(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 u=null,d,m=0;const f=()=>(m++,u=null,v()),v=()=>{let T;return u||(T=u=t().catch(S=>{if(S=S instanceof Error?S:new Error(String(S)),l)return new Promise((R,E)=>{l(S,()=>R(f()),()=>E(S),m+1)});throw S}).then(S=>T!==u&&u?u:(S&&(S.__esModule||S[Symbol.toStringTag]==="Module")&&(S=S.default),d=S,S)))};return hn({name:"AsyncComponentWrapper",__asyncLoader:v,__asyncHydrate(T,S,R){const E=T.isConnected;let N=!1;(S.bu||(S.bu=[])).push(()=>N=!0);const W=()=>{N||!T.parentNode||E&&!T.isConnected||R()},L=a?()=>{const fe=a(W,le=>Yk(T,le));fe&&(S.bum||(S.bum=[])).push(fe)}:W;d?L():v().then(()=>!S.isUnmounted&&L())},get __asyncResolved(){return d},setup(){const T=zn;if(fh(T),d)return()=>Uu(d,T);const S=fe=>{u=null,fu(fe,T,13,!r)};if(i&&T.suspense||gl)return v().then(fe=>()=>Uu(fe,T)).catch(fe=>(S(fe),()=>r?Fe(r,{error:fe}):null));const R=k(!1),E=k(),N=k(!!o);let W,L;return pu(()=>{W!=null&&clearTimeout(W),L!=null&&clearTimeout(L)}),o&&(L=setTimeout(()=>{T.isUnmounted||(N.value=!1)},o)),s!=null&&(W=setTimeout(()=>{if(!T.isUnmounted&&!R.value&&!E.value){const fe=new Error(`Async component timed out after ${s}ms.`);S(fe),E.value=fe}},s)),v().then(()=>{T.isUnmounted||(R.value=!0,T.parent&&hu(T.parent.vnode)&&T.parent.update())}).catch(fe=>{if(T.isUnmounted){u=null;return}S(fe),E.value=fe}),()=>{if(R.value&&d)return Uu(d,T);if(E.value&&r)return Fe(r,{error:E.value});if(n&&!N.value)return Uu(n,T)}}})}function Uu(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 hu=e=>e.type.__isKeepAlive;function Jk(e,t){ay(e,"a",t)}function Qk(e,t){ay(e,"da",t)}function ay(e,t,n=zn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(zc(t,r,n),n){let o=n.parent;for(;o&&o.parent;)hu(o.parent.vnode)&&Xk(r,t,n,o),o=o.parent}}function Xk(e,t,n,r){const o=zc(t,e,r,!0);pu(()=>{th(r[t],o)},n)}function zc(e,t,n=zn,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{ts();const i=mu(n),l=io(t,n,e,s);return i(),ns(),l});return r?o.unshift(a):o.push(a),a}}const as=e=>(t,n=zn)=>{(!gl||e==="sp")&&zc(e,(...r)=>t(...r),n)},Zk=as("bm"),ss=as("m"),eS=as("bu"),tS=as("u"),ti=as("bum"),pu=as("um"),nS=as("sp"),rS=as("rtg"),oS=as("rtc");function aS(e,t=zn){zc("ec",e,t)}const sS="components",sy=Symbol.for("v-ndc");function hh(e){return Qt(e)?iS(sS,e,!1)||e:e||sy}function iS(e,t,n=!0,r=!1){const o=Hn||zn;if(o){const a=o.type;{const i=WS(a,!1);if(i&&(i===t||i===fr(t)||i===Dc(fr(t))))return a}const s=Qp(o[e]||a[e],t)||Qp(o.appContext[e],t);return!s&&r?a:s}}function Qp(e,t){return e&&(e[t]||e[fr(t)]||e[Dc(fr(t))])}function Wt(e,t,n,r){let o;const a=n,s=it(e);if(s||Qt(e)){const i=s&&Ii(e);let l=!1,u=!1;i&&(l=!ao(e),u=rs(e),e=Bc(e)),o=new Array(e.length);for(let d=0,m=e.length;d<m;d++)o[d]=t(l?u?pl(Do(e[d])):Do(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(Ft(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,u=i.length;l<u;l++){const d=i[l];o[l]=t(e[d],d,l,a)}}else o=[];return o}function kr(e,t,n={},r,o,a){if(Hn.ce||Hn.parent&&sl(Hn.parent)&&Hn.parent.ce){const u=a!=null&&n.key==null?Tn({},n,{key:a}):n,d=Object.keys(u).length>0;return t!=="default"&&(u.name=t),_(),Ze(rt,null,[Fe("slot",u,r)],d?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=Qa.length;_();let l;try{const u=s&&iy(s(n)),d=n.key||a||u&&u.key;l=Ze(rt,{key:(d&&!Oo(d)?d:`_${t}`)+(!u&&r?"_fb":"")},u||(r?r():[]),u&&e._===1?64:-2)}catch(u){for(let d=Qa.length;d>i;d--)vh();throw u}finally{s&&s._c&&(s._d=!0)}return l}function iy(e){return e.some(t=>ru(t)?!(t.type===Xn||t.type===rt&&!iy(t.children)):!0)?e:null}const bf=e=>e?Iy(e)?qc(e):bf(e.parent):null,Yl=Tn(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=>bf(e.parent),$root:e=>bf(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>uy(e),$forceUpdate:e=>e.f||(e.f=()=>{dh(e.update)}),$nextTick:e=>e.n||(e.n=Mt.bind(e.proxy)),$watch:e=>zk.bind(e)}),$d=(e,t)=>e!==Ht&&!e.__isScriptSetup&&Dt(e,t),lS={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($d(r,t))return s[t]=1,r[t];if(o!==Ht&&Dt(o,t))return s[t]=2,o[t];if(Dt(a,t))return s[t]=3,a[t];if(n!==Ht&&Dt(n,t))return s[t]=4,n[t];Tf&&(s[t]=0)}}const u=Yl[t];let d,m;if(u)return t==="$attrs"&&Qn(e.attrs,"get",""),u(e);if((d=i.__cssModules)&&(d=d[t]))return d;if(n!==Ht&&Dt(n,t))return s[t]=4,n[t];if(m=l.config.globalProperties,Dt(m,t))return m[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return $d(o,t)?(o[t]=n,!0):r!==Ht&&Dt(r,t)?(r[t]=n,!0):Dt(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!==Ht&&i[0]!=="$"&&Dt(e,i)||$d(t,i)||Dt(a,i)||Dt(r,i)||Dt(Yl,i)||Dt(o.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Dt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function uS(){return cS().slots}function cS(e){const t=wh();return t.setupContext||(t.setupContext=_y(t))}function Xp(e){return it(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Tf=!0;function dS(e){const t=uy(e),n=e.proxy,r=e.ctx;Tf=!1,t.beforeCreate&&Zp(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:i,provide:l,inject:u,created:d,beforeMount:m,mounted:f,beforeUpdate:v,updated:T,activated:S,deactivated:R,beforeDestroy:E,beforeUnmount:N,destroyed:W,unmounted:L,render:fe,renderTracked:le,renderTriggered:Y,errorCaptured:ie,serverPrefetch:we,expose:Pe,inheritAttrs:ye,components:ee,directives:ve,filters:ne}=t;if(u&&fS(u,r,null),s)for(const $e in s){const je=s[$e];ht(je)&&(r[$e]=je.bind(n))}if(o){const $e=o.call(n,n);Ft($e)&&(e.data=Uc($e))}if(Tf=!0,a)for(const $e in a){const je=a[$e],Ce=ht(je)?je.bind(n,n):ht(je.get)?je.get.bind(n,n):Ta,Se=!ht(je)&&ht(je.set)?je.set.bind(n):Ta,xe=G({get:Ce,set:Se});Object.defineProperty(r,$e,{enumerable:!0,configurable:!0,get:()=>xe.value,set:Ee=>xe.value=Ee})}if(i)for(const $e in i)ly(i[$e],r,n,$e);if(l){const $e=ht(l)?l.call(n):l;Reflect.ownKeys($e).forEach(je=>{tc(je,$e[je])})}d&&Zp(d,e,"c");function De($e,je){it(je)?je.forEach(Ce=>$e(Ce.bind(n))):je&&$e(je.bind(n))}if(De(Zk,m),De(ss,f),De(eS,v),De(tS,T),De(Jk,S),De(Qk,R),De(aS,ie),De(oS,le),De(rS,Y),De(ti,N),De(pu,L),De(nS,we),it(Pe))if(Pe.length){const $e=e.exposed||(e.exposed={});Pe.forEach(je=>{Object.defineProperty($e,je,{get:()=>n[je],set:Ce=>n[je]=Ce,enumerable:!0})})}else e.exposed||(e.exposed={});fe&&e.render===Ta&&(e.render=fe),ye!=null&&(e.inheritAttrs=ye),ee&&(e.components=ee),ve&&(e.directives=ve),we&&fh(e)}function fS(e,t,n=Ta){it(e)&&(e=kf(e));for(const r in e){const o=e[r];let a;Ft(o)?"default"in o?a=No(o.from||r,o.default,!0):a=No(o.from||r):a=No(o),jn(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function Zp(e,t,n){io(it(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function ly(e,t,n,r){let o=r.includes(".")?Qv(n,r):()=>n[r];if(Qt(e)){const a=t[e];ht(a)&&tt(o,a)}else if(ht(e))tt(o,e.bind(n));else if(Ft(e))if(it(e))e.forEach(a=>ly(a,t,n,r));else{const a=ht(e.handler)?e.handler.bind(n):t[e.handler];ht(a)&&tt(o,a,e)}}function uy(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(u=>hc(l,u,s,!0)),hc(l,t,s)),Ft(t)&&a.set(t,l),l}function hc(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&hc(e,a,n,!0),o&&o.forEach(s=>hc(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const i=hS[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const hS={data:em,props:tm,emits:tm,methods:zl,computed:zl,beforeCreate:ir,created:ir,beforeMount:ir,mounted:ir,beforeUpdate:ir,updated:ir,beforeDestroy:ir,beforeUnmount:ir,destroyed:ir,unmounted:ir,activated:ir,deactivated:ir,errorCaptured:ir,serverPrefetch:ir,components:zl,directives:zl,watch:mS,provide:em,inject:pS};function em(e,t){return t?e?function(){return Tn(ht(e)?e.call(this,this):e,ht(t)?t.call(this,this):t)}:t:e}function pS(e,t){return zl(kf(e),kf(t))}function kf(e){if(it(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ir(e,t){return e?[...new Set([].concat(e,t))]:t}function zl(e,t){return e?Tn(Object.create(null),e,t):t}function tm(e,t){return e?it(e)&&it(t)?[...new Set([...e,...t])]:Tn(Object.create(null),Xp(e),Xp(t??{})):t}function mS(e,t){if(!e)return t;if(!t)return e;const n=Tn(Object.create(null),e);for(const r in t)n[r]=ir(e[r],t[r]);return n}function cy(){return{app:null,config:{isNativeTag:wv,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let gS=0;function vS(e,t){return function(r,o=null){ht(r)||(r=Tn({},r)),o!=null&&!Ft(o)&&(o=null);const a=cy(),s=new WeakSet,i=[];let l=!1;const u=a.app={_uid:gS++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:VS,get config(){return a.config},set config(d){},use(d,...m){return s.has(d)||(d&&ht(d.install)?(s.add(d),d.install(u,...m)):ht(d)&&(s.add(d),d(u,...m))),u},mixin(d){return a.mixins.includes(d)||a.mixins.push(d),u},component(d,m){return m?(a.components[d]=m,u):a.components[d]},directive(d,m){return m?(a.directives[d]=m,u):a.directives[d]},mount(d,m,f){if(!l){const v=u._ceVNode||Fe(r,o);return v.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(v,d,f),l=!0,u._container=d,d.__vue_app__=u,qc(v.component)}},onUnmount(d){i.push(d)},unmount(){l&&(io(i,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,m){return a.provides[d]=m,u},runWithContext(d){const m=il;il=u;try{return d()}finally{il=m}}};return u}}let il=null;const yS=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${fr(t)}Modifiers`]||e[`${ei(t)}Modifiers`];function wS(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Ht;let o=n;const a=t.startsWith("update:"),s=a&&yS(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Qt(d)?d.trim():d)),s.number&&(o=n.map(rh)));let i,l=r[i=Pd(t)]||r[i=Pd(fr(t))];!l&&a&&(l=r[i=Pd(ei(t))]),l&&io(l,e,6,o);const u=r[i+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,io(u,e,6,o)}}const bS=new WeakMap;function dy(e,t,n=!1){const r=n?bS: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=u=>{const d=dy(u,t,!0);d&&(i=!0,Tn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(Ft(e)&&r.set(e,null),null):(it(a)?a.forEach(l=>s[l]=null):Tn(s,a),Ft(e)&&r.set(e,s),s)}function Hc(e,t){return!e||!jc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Dt(e,t[0].toLowerCase()+t.slice(1))||Dt(e,ei(t))||Dt(e,t))}function nm(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:i,emit:l,render:u,renderCache:d,props:m,data:f,setupState:v,ctx:T,inheritAttrs:S}=e,R=dc(e);let E,N;try{if(n.shapeFlag&4){const L=o||r,fe=L;E=wa(u.call(fe,L,d,m,v,f,T)),N=i}else{const L=t;E=wa(L.length>1?L(m,{attrs:i,slots:s,emit:l}):L(m,null)),N=t.props?i:TS(i)}}catch(L){Qa.length=0,fu(L,e,1),E=Fe(Xn)}let W=E;if(N&&S!==!1){const L=Object.keys(N),{shapeFlag:fe}=W;L.length&&fe&7&&(a&&L.some($c)&&(N=kS(N,a)),W=Xs(W,N,!1,!0))}return n.dirs&&(W=Xs(W,null,!1,!0),W.dirs=W.dirs?W.dirs.concat(n.dirs):n.dirs),n.transition&&nu(W,n.transition),E=W,dc(R),E}const TS=e=>{let t;for(const n in e)(n==="class"||n==="style"||jc(n))&&((t||(t={}))[n]=e[n]);return t},kS=(e,t)=>{const n={};for(const r in e)(!$c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function SS(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:i,patchFlag:l}=t,u=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?rm(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let m=0;m<d.length;m++){const f=d[m];if(fy(s,r,f)&&!Hc(u,f))return!0}}}else return(o||i)&&(!i||!i.$stable)?!0:r===s?!1:r?s?rm(r,s,u):!0:!!s;return!1}function rm(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(fy(t,e,a)&&!Hc(n,a))return!0}return!1}function fy(e,t,n){const r=e[n],o=t[n];return n==="style"&&Ft(r)&&Ft(o)?!cu(r,o):r!==o}function CS({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 hy={},py=()=>Object.create(hy),my=e=>Object.getPrototypeOf(e)===hy;function xS(e,t,n,r=!1){const o={},a=py();e.propsDefaults=Object.create(null),gy(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:zv(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function IS(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,i=jt(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let m=0;m<d.length;m++){let f=d[m];if(Hc(e.emitsOptions,f))continue;const v=t[f];if(l)if(Dt(a,f))v!==a[f]&&(a[f]=v,u=!0);else{const T=fr(f);o[T]=Sf(l,i,T,v,e,!1)}else v!==a[f]&&(a[f]=v,u=!0)}}}else{gy(e,t,o,a)&&(u=!0);let d;for(const m in i)(!t||!Dt(t,m)&&((d=ei(m))===m||!Dt(t,d)))&&(l?n&&(n[m]!==void 0||n[d]!==void 0)&&(o[m]=Sf(l,i,m,void 0,e,!0)):delete o[m]);if(a!==i)for(const m in a)(!t||!Dt(t,m))&&(delete a[m],u=!0)}u&&Ka(e.attrs,"set","")}function gy(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(ql(l))continue;const u=t[l];let d;o&&Dt(o,d=fr(l))?!a||!a.includes(d)?n[d]=u:(i||(i={}))[d]=u:Hc(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(a){const l=jt(n),u=i||Ht;for(let d=0;d<a.length;d++){const m=a[d];n[m]=Sf(o,l,m,u[m],e,!Dt(u,m))}}return s}function Sf(e,t,n,r,o,a){const s=e[n];if(s!=null){const i=Dt(s,"default");if(i&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ht(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=mu(o);r=u[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===ei(n))&&(r=!0))}return r}const AS=new WeakMap;function vy(e,t,n=!1){const r=n?AS:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},i=[];let l=!1;if(!ht(e)){const d=m=>{l=!0;const[f,v]=vy(m,t,!0);Tn(s,f),v&&i.push(...v)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!a&&!l)return Ft(e)&&r.set(e,rl),rl;if(it(a))for(let d=0;d<a.length;d++){const m=fr(a[d]);om(m)&&(s[m]=Ht)}else if(a)for(const d in a){const m=fr(d);if(om(m)){const f=a[d],v=s[m]=it(f)||ht(f)?{type:f}:Tn({},f),T=v.type;let S=!1,R=!0;if(it(T))for(let E=0;E<T.length;++E){const N=T[E],W=ht(N)&&N.name;if(W==="Boolean"){S=!0;break}else W==="String"&&(R=!1)}else S=ht(T)&&T.name==="Boolean";v[0]=S,v[1]=R,(S||Dt(v,"default"))&&i.push(m)}}const u=[s,i];return Ft(e)&&r.set(e,u),u}function om(e){return e[0]!=="$"&&!ql(e)}const ph=e=>e==="_"||e==="_ctx"||e==="$stable",mh=e=>it(e)?e.map(wa):[wa(e)],_S=(e,t,n)=>{if(t._n)return t;const r=ft((...o)=>mh(t(...o)),n);return r._c=!1,r},yy=(e,t,n)=>{const r=e._ctx;for(const o in e){if(ph(o))continue;const a=e[o];if(ht(a))t[o]=_S(o,a,r);else if(a!=null){const s=mh(a);t[o]=()=>s}}},wy=(e,t)=>{const n=mh(t);e.slots.default=()=>n},by=(e,t,n)=>{for(const r in t)(n||!ph(r))&&(e[r]=t[r])},PS=(e,t,n)=>{const r=e.slots=py();if(e.vnode.shapeFlag&32){const o=t._;o?(by(r,t,n),n&&Sv(r,"_",o,!0)):yy(t,r)}else t&&wy(e,t)},ES=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=Ht;if(r.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:by(o,t,n):(a=!t.$stable,yy(t,o)),s=t}else t&&(wy(e,t),s={default:1});if(a)for(const i in o)!ph(i)&&s[i]==null&&delete o[i]},lr=$S;function MS(e){return RS(e)}function RS(e,t){const n=Fc();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:i,createComment:l,setText:u,setElementText:d,parentNode:m,nextSibling:f,setScopeId:v=Ta,insertStaticContent:T}=e,S=(P,$,q,ue=null,re=null,ae=null,_e=void 0,Ne=null,Ie=!!$.dynamicChildren)=>{if(P===$)return;P&&!ki(P,$)&&(ue=F(P),Ee(P,re,ae,!0),P=null),$.patchFlag===-2&&(Ie=!1,$.dynamicChildren=null);const{type:he,ref:Ke,shapeFlag:Oe}=$;switch(he){case Wc:R(P,$,q,ue);break;case Xn:E(P,$,q,ue);break;case Od:P==null&&N($,q,ue,_e);break;case rt:ee(P,$,q,ue,re,ae,_e,Ne,Ie);break;default:Oe&1?fe(P,$,q,ue,re,ae,_e,Ne,Ie):Oe&6?ve(P,$,q,ue,re,ae,_e,Ne,Ie):(Oe&64||Oe&128)&&he.process(P,$,q,ue,re,ae,_e,Ne,Ie,Le)}Ke!=null&&re?Kl(Ke,P&&P.ref,ae,$||P,!$):Ke==null&&P&&P.ref!=null&&Kl(P.ref,null,ae,P,!0)},R=(P,$,q,ue)=>{if(P==null)r($.el=i($.children),q,ue);else{const re=$.el=P.el;$.children!==P.children&&u(re,$.children)}},E=(P,$,q,ue)=>{P==null?r($.el=l($.children||""),q,ue):$.el=P.el},N=(P,$,q,ue)=>{[P.el,P.anchor]=T(P.children,$,q,ue,P.el,P.anchor)},W=({el:P,anchor:$},q,ue)=>{let re;for(;P&&P!==$;)re=f(P),r(P,q,ue),P=re;r($,q,ue)},L=({el:P,anchor:$})=>{let q;for(;P&&P!==$;)q=f(P),o(P),P=q;o($)},fe=(P,$,q,ue,re,ae,_e,Ne,Ie)=>{if($.type==="svg"?_e="svg":$.type==="math"&&(_e="mathml"),P==null)le($,q,ue,re,ae,_e,Ne,Ie);else{const he=P.el&&P.el._isVueCE?P.el:null;try{he&&he._beginPatch(),we(P,$,re,ae,_e,Ne,Ie)}finally{he&&he._endPatch()}}},le=(P,$,q,ue,re,ae,_e,Ne)=>{let Ie,he;const{props:Ke,shapeFlag:Oe,transition:qe,dirs:Ge}=P;if(Ie=P.el=s(P.type,ae,Ke&&Ke.is,Ke),Oe&8?d(Ie,P.children):Oe&16&&ie(P.children,Ie,null,ue,re,Nd(P,ae),_e,Ne),Ge&&pi(P,null,ue,"created"),Y(Ie,P,P.scopeId,_e,ue),Ke){for(const bt in Ke)bt!=="value"&&!ql(bt)&&a(Ie,bt,null,Ke[bt],ae,ue);"value"in Ke&&a(Ie,"value",null,Ke.value,ae),(he=Ke.onVnodeBeforeMount)&&ga(he,ue,P)}Ge&&pi(P,null,ue,"beforeMount");const dt=LS(re,qe);dt&&qe.beforeEnter(Ie),r(Ie,$,q),((he=Ke&&Ke.onVnodeMounted)||dt||Ge)&&lr(()=>{try{he&&ga(he,ue,P),dt&&qe.enter(Ie),Ge&&pi(P,null,ue,"mounted")}finally{}},re)},Y=(P,$,q,ue,re)=>{if(q&&v(P,q),ue)for(let ae=0;ae<ue.length;ae++)v(P,ue[ae]);if(re){let ae=re.subTree;if($===ae||Sy(ae.type)&&(ae.ssContent===$||ae.ssFallback===$)){const _e=re.vnode;Y(P,_e,_e.scopeId,_e.slotScopeIds,re.parent)}}},ie=(P,$,q,ue,re,ae,_e,Ne,Ie=0)=>{for(let he=Ie;he<P.length;he++){const Ke=P[he]=Ne?Va(P[he]):wa(P[he]);S(null,Ke,$,q,ue,re,ae,_e,Ne)}},we=(P,$,q,ue,re,ae,_e)=>{const Ne=$.el=P.el;let{patchFlag:Ie,dynamicChildren:he,dirs:Ke}=$;Ie|=P.patchFlag&16;const Oe=P.props||Ht,qe=$.props||Ht;let Ge;if(q&&mi(q,!1),(Ge=qe.onVnodeBeforeUpdate)&&ga(Ge,q,$,P),Ke&&pi($,P,q,"beforeUpdate"),q&&mi(q,!0),he&&(!P.dynamicChildren||P.dynamicChildren.length!==he.length)&&(Ie=0,_e=!1,he=null),(Oe.innerHTML&&qe.innerHTML==null||Oe.textContent&&qe.textContent==null)&&d(Ne,""),he?Pe(P.dynamicChildren,he,Ne,q,ue,Nd($,re),ae):_e||je(P,$,Ne,null,q,ue,Nd($,re),ae,!1),Ie>0){if(Ie&16)ye(Ne,Oe,qe,q,re);else if(Ie&2&&Oe.class!==qe.class&&a(Ne,"class",null,qe.class,re),Ie&4&&a(Ne,"style",Oe.style,qe.style,re),Ie&8){const dt=$.dynamicProps;for(let bt=0;bt<dt.length;bt++){const ot=dt[bt],ut=Oe[ot],J=qe[ot];(J!==ut||ot==="value")&&a(Ne,ot,ut,J,re,q)}}Ie&1&&P.children!==$.children&&d(Ne,$.children)}else!_e&&he==null&&ye(Ne,Oe,qe,q,re);((Ge=qe.onVnodeUpdated)||Ke)&&lr(()=>{Ge&&ga(Ge,q,$,P),Ke&&pi($,P,q,"updated")},ue)},Pe=(P,$,q,ue,re,ae,_e)=>{for(let Ne=0;Ne<$.length;Ne++){const Ie=P[Ne],he=$[Ne],Ke=Ie.el&&(Ie.type===rt||!ki(Ie,he)||Ie.shapeFlag&198)?m(Ie.el):q;S(Ie,he,Ke,null,ue,re,ae,_e,!0)}},ye=(P,$,q,ue,re)=>{if($!==q){if($!==Ht)for(const ae in $)!ql(ae)&&!(ae in q)&&a(P,ae,$[ae],null,re,ue);for(const ae in q){if(ql(ae))continue;const _e=q[ae],Ne=$[ae];_e!==Ne&&ae!=="value"&&a(P,ae,Ne,_e,re,ue)}"value"in q&&a(P,"value",$.value,q.value,re)}},ee=(P,$,q,ue,re,ae,_e,Ne,Ie)=>{const he=$.el=P?P.el:i(""),Ke=$.anchor=P?P.anchor:i("");let{patchFlag:Oe,dynamicChildren:qe,slotScopeIds:Ge}=$;Ge&&(Ne=Ne?Ne.concat(Ge):Ge),P==null?(r(he,q,ue),r(Ke,q,ue),ie($.children||[],q,Ke,re,ae,_e,Ne,Ie)):Oe>0&&Oe&64&&qe&&P.dynamicChildren&&P.dynamicChildren.length===qe.length?(Pe(P.dynamicChildren,qe,q,re,ae,_e,Ne),($.key!=null||re&&$===re.subTree)&&gh(P,$,!0)):je(P,$,q,Ke,re,ae,_e,Ne,Ie)},ve=(P,$,q,ue,re,ae,_e,Ne,Ie)=>{$.slotScopeIds=Ne,P==null?$.shapeFlag&512?re.ctx.activate($,q,ue,_e,Ie):ne($,q,ue,re,ae,_e,Ie):Ae(P,$,Ie)},ne=(P,$,q,ue,re,ae,_e)=>{const Ne=P.component=BS(P,ue,re);if(hu(P)&&(Ne.ctx.renderer=Le),US(Ne,!1,_e),Ne.asyncDep){if(re&&re.registerDep(Ne,De,_e),!P.el){const Ie=Ne.subTree=Fe(Xn);E(null,Ie,$,q),P.placeholder=Ie.el}}else De(Ne,P,$,q,re,ae,_e)},Ae=(P,$,q)=>{const ue=$.component=P.component;if(SS(P,$,q))if(ue.asyncDep&&!ue.asyncResolved){$e(ue,$,q);return}else ue.next=$,ue.update();else $.el=P.el,ue.vnode=$},De=(P,$,q,ue,re,ae,_e)=>{const Ne=()=>{if(P.isMounted){let{next:Oe,bu:qe,u:Ge,parent:dt,vnode:bt}=P;{const ke=Ty(P);if(ke){Oe&&(Oe.el=bt.el,$e(P,Oe,_e)),ke.asyncDep.then(()=>{lr(()=>{P.isUnmounted||he()},re)});return}}let ot=Oe,ut;mi(P,!1),Oe?(Oe.el=bt.el,$e(P,Oe,_e)):Oe=bt,qe&&ec(qe),(ut=Oe.props&&Oe.props.onVnodeBeforeUpdate)&&ga(ut,dt,Oe,bt),mi(P,!0);const J=nm(P),de=P.subTree;P.subTree=J,S(de,J,m(de.el),F(de),P,re,ae),Oe.el=J.el,ot===null&&CS(P,J.el),Ge&&lr(Ge,re),(ut=Oe.props&&Oe.props.onVnodeUpdated)&&lr(()=>ga(ut,dt,Oe,bt),re)}else{let Oe;const{el:qe,props:Ge}=$,{bm:dt,m:bt,parent:ot,root:ut,type:J}=P,de=sl($);mi(P,!1),dt&&ec(dt),!de&&(Oe=Ge&&Ge.onVnodeBeforeMount)&&ga(Oe,ot,$),mi(P,!0);{ut.ce&&ut.ce._hasShadowRoot()&&ut.ce._injectChildStyle(J,P.parent?P.parent.type:void 0);const ke=P.subTree=nm(P);S(null,ke,q,ue,P,re,ae),$.el=ke.el}if(bt&&lr(bt,re),!de&&(Oe=Ge&&Ge.onVnodeMounted)){const ke=$;lr(()=>ga(Oe,ot,ke),re)}($.shapeFlag&256||ot&&sl(ot.vnode)&&ot.vnode.shapeFlag&256)&&P.a&&lr(P.a,re),P.isMounted=!0,$=q=ue=null}};P.scope.on();const Ie=P.effect=new _v(Ne);P.scope.off();const he=P.update=Ie.run.bind(Ie),Ke=P.job=Ie.runIfDirty.bind(Ie);Ke.i=P,Ke.id=P.uid,Ie.scheduler=()=>dh(Ke),mi(P,!0),he()},$e=(P,$,q)=>{$.component=P;const ue=P.vnode.props;P.vnode=$,P.next=null,IS(P,$.props,ue,q),ES(P,$.children,q),ts(),Wp(P),ns()},je=(P,$,q,ue,re,ae,_e,Ne,Ie=!1)=>{const he=P&&P.children,Ke=P?P.shapeFlag:0,Oe=$.children,{patchFlag:qe,shapeFlag:Ge}=$;if(qe>0){if(qe&128){Se(he,Oe,q,ue,re,ae,_e,Ne,Ie);return}else if(qe&256){Ce(he,Oe,q,ue,re,ae,_e,Ne,Ie);return}}Ge&8?(Ke&16&&ce(he,re,ae),Oe!==he&&d(q,Oe)):Ke&16?Ge&16?Se(he,Oe,q,ue,re,ae,_e,Ne,Ie):ce(he,re,ae,!0):(Ke&8&&d(q,""),Ge&16&&ie(Oe,q,ue,re,ae,_e,Ne,Ie))},Ce=(P,$,q,ue,re,ae,_e,Ne,Ie)=>{P=P||rl,$=$||rl;const he=P.length,Ke=$.length,Oe=Math.min(he,Ke);let qe;for(qe=0;qe<Oe;qe++){const Ge=$[qe]=Ie?Va($[qe]):wa($[qe]);S(P[qe],Ge,q,null,re,ae,_e,Ne,Ie)}he>Ke?ce(P,re,ae,!0,!1,Oe):ie($,q,ue,re,ae,_e,Ne,Ie,Oe)},Se=(P,$,q,ue,re,ae,_e,Ne,Ie)=>{let he=0;const Ke=$.length;let Oe=P.length-1,qe=Ke-1;for(;he<=Oe&&he<=qe;){const Ge=P[he],dt=$[he]=Ie?Va($[he]):wa($[he]);if(ki(Ge,dt))S(Ge,dt,q,null,re,ae,_e,Ne,Ie);else break;he++}for(;he<=Oe&&he<=qe;){const Ge=P[Oe],dt=$[qe]=Ie?Va($[qe]):wa($[qe]);if(ki(Ge,dt))S(Ge,dt,q,null,re,ae,_e,Ne,Ie);else break;Oe--,qe--}if(he>Oe){if(he<=qe){const Ge=qe+1,dt=Ge<Ke?$[Ge].el:ue;for(;he<=qe;)S(null,$[he]=Ie?Va($[he]):wa($[he]),q,dt,re,ae,_e,Ne,Ie),he++}}else if(he>qe)for(;he<=Oe;)Ee(P[he],re,ae,!0),he++;else{const Ge=he,dt=he,bt=new Map;for(he=dt;he<=qe;he++){const yt=$[he]=Ie?Va($[he]):wa($[he]);yt.key!=null&&bt.set(yt.key,he)}let ot,ut=0;const J=qe-dt+1;let de=!1,ke=0;const Be=new Array(J);for(he=0;he<J;he++)Be[he]=0;for(he=Ge;he<=Oe;he++){const yt=P[he];if(ut>=J){Ee(yt,re,ae,!0);continue}let Bt;if(yt.key!=null)Bt=bt.get(yt.key);else for(ot=dt;ot<=qe;ot++)if(Be[ot-dt]===0&&ki(yt,$[ot])){Bt=ot;break}Bt===void 0?Ee(yt,re,ae,!0):(Be[Bt-dt]=he+1,Bt>=ke?ke=Bt:de=!0,S(yt,$[Bt],q,null,re,ae,_e,Ne,Ie),ut++)}const vt=de?jS(Be):rl;for(ot=vt.length-1,he=J-1;he>=0;he--){const yt=dt+he,Bt=$[yt],Bo=$[yt+1],Yt=yt+1<Ke?Bo.el||ky(Bo):ue;Be[he]===0?S(null,Bt,q,Yt,re,ae,_e,Ne,Ie):de&&(ot<0||he!==vt[ot]?xe(Bt,q,Yt,2):ot--)}}},xe=(P,$,q,ue,re=null)=>{const{el:ae,type:_e,transition:Ne,children:Ie,shapeFlag:he}=P;if(he&6){xe(P.component.subTree,$,q,ue);return}if(he&128){P.suspense.move($,q,ue);return}if(he&64){_e.move(P,$,q,Le);return}if(_e===rt){r(ae,$,q);for(let Oe=0;Oe<Ie.length;Oe++)xe(Ie[Oe],$,q,ue);r(P.anchor,$,q);return}if(_e===Od){W(P,$,q);return}if(ue!==2&&he&1&&Ne)if(ue===0)Ne.persisted&&!ae[ro]?r(ae,$,q):(Ne.beforeEnter(ae),r(ae,$,q),lr(()=>Ne.enter(ae),re));else{const{leave:Oe,delayLeave:qe,afterLeave:Ge}=Ne,dt=()=>{P.ctx.isUnmounted?o(ae):r(ae,$,q)},bt=()=>{const ot=ae._isLeaving||!!ae[ro];ae._isLeaving&&ae[ro](!0),Ne.persisted&&!ot?dt():Oe(ae,()=>{dt(),Ge&&Ge()})};qe?qe(ae,dt,bt):bt()}else r(ae,$,q)},Ee=(P,$,q,ue=!1,re=!1)=>{const{type:ae,props:_e,ref:Ne,children:Ie,dynamicChildren:he,shapeFlag:Ke,patchFlag:Oe,dirs:qe,cacheIndex:Ge,memo:dt}=P;if(Oe===-2&&(re=!1),Ne!=null&&(ts(),Kl(Ne,null,q,P,!0),ns()),Ge!=null&&($.renderCache[Ge]=void 0),Ke&256){$.ctx.deactivate(P);return}const bt=Ke&1&&qe,ot=!sl(P);let ut;if(ot&&(ut=_e&&_e.onVnodeBeforeUnmount)&&ga(ut,$,P),Ke&6)lt(P.component,q,ue);else{if(Ke&128){P.suspense.unmount(q,ue);return}bt&&pi(P,null,$,"beforeUnmount"),Ke&64?P.type.remove(P,$,q,Le,ue):he&&!he.hasOnce&&(ae!==rt||Oe>0&&Oe&64)?ce(he,$,q,!1,!0):(ae===rt&&Oe&384||!re&&Ke&16)&&ce(Ie,$,q),ue&&Je(P)}const J=dt!=null&&Ge==null;(ot&&(ut=_e&&_e.onVnodeUnmounted)||bt||J)&&lr(()=>{ut&&ga(ut,$,P),bt&&pi(P,null,$,"unmounted"),J&&(P.el=null)},q)},Je=P=>{const{type:$,el:q,anchor:ue,transition:re}=P;if($===rt){Xe(q,ue);return}if($===Od){L(P);return}const ae=()=>{o(q),re&&!re.persisted&&re.afterLeave&&re.afterLeave()};if(P.shapeFlag&1&&re&&!re.persisted){const{leave:_e,delayLeave:Ne}=re,Ie=()=>_e(q,ae);Ne?Ne(P.el,ae,Ie):Ie()}else ae()},Xe=(P,$)=>{let q;for(;P!==$;)q=f(P),o(P),P=q;o($)},lt=(P,$,q)=>{const{bum:ue,scope:re,job:ae,subTree:_e,um:Ne,m:Ie,a:he}=P;am(Ie),am(he),ue&&ec(ue),re.stop(),ae&&(ae.flags|=8,Ee(_e,P,$,q)),Ne&&lr(Ne,$),lr(()=>{P.isUnmounted=!0},$)},ce=(P,$,q,ue=!1,re=!1,ae=0)=>{for(let _e=ae;_e<P.length;_e++)Ee(P[_e],$,q,ue,re)},F=P=>{if(P.shapeFlag&6)return F(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const $=f(P.anchor||P.el),q=$&&$[Xv];return q?f(q):$};let oe=!1;const se=(P,$,q)=>{let ue;P==null?$._vnode&&(Ee($._vnode,null,null,!0),ue=$._vnode.component):S($._vnode||null,P,$,null,null,null,q),$._vnode=P,oe||(oe=!0,Wp(ue),Vv(),oe=!1)},Le={p:S,um:Ee,m:xe,r:Je,mt:ne,mc:ie,pc:je,pbc:Pe,n:F,o:e};return{render:se,hydrate:void 0,createApp:vS(se)}}function Nd({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 mi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function LS(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function gh(e,t,n=!1){const r=e.children,o=t.children;if(it(r)&&it(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]=Va(o[a]),i.el=s.el),!n&&i.patchFlag!==-2&&gh(s,i)),i.type===Wc&&(i.patchFlag===-1&&(i=o[a]=Va(i)),i.el=s.el),i.type===Xn&&!i.el&&(i.el=s.el)}}function jS(e){const t=e.slice(),n=[0];let r,o,a,s,i;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<u?a=i+1:s=i;u<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 Ty(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ty(t)}function am(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ky(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?ky(t.subTree):null}const Sy=e=>e.__isSuspense;function $S(e,t){t&&t.pendingBranch?it(e)?t.effects.push(...e):t.effects.push(e):Fk(e)}const rt=Symbol.for("v-fgt"),Wc=Symbol.for("v-txt"),Xn=Symbol.for("v-cmt"),Od=Symbol.for("v-stc"),Qa=[];let dr=null;function _(e=!1){Qa.push(dr=e?null:[])}function vh(){Qa.pop(),dr=Qa[Qa.length-1]||null}let ml=1;function pc(e,t=!1){ml+=e,e<0&&dr&&t&&(dr.hasOnce=!0)}function Cy(e){return e.dynamicChildren=ml>0?dr||rl:null,vh(),ml>0&&dr&&dr.push(e),e}function B(e,t,n,r,o,a){return Cy(w(e,t,n,r,o,a,!0))}function Ze(e,t,n,r,o){return Cy(Fe(e,t,n,r,o,!0))}function ru(e){return e?e.__v_isVNode===!0:!1}function ki(e,t){return e.type===t.type&&e.key===t.key}const xy=({key:e})=>e??null,nc=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Qt(e)||jn(e)||ht(e)?{i:Hn,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,r=0,o=null,a=e===rt?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&xy(t),ref:t&&nc(t),scopeId:Yv,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Hn};return i?(mc(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Qt(n)?8:16),ml>0&&!s&&dr&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&dr.push(l),l}const Fe=NS;function NS(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===sy)&&(e=Xn),ru(e)){const i=Xs(e,t,!0);return n&&mc(i,n),ml>0&&!a&&dr&&(i.shapeFlag&6?dr[dr.indexOf(e)]=i:dr.push(i)),i.patchFlag=-2,i}if(qS(e)&&(e=e.__vccOpts),t){t=OS(t);let{class:i,style:l}=t;i&&!Qt(i)&&(t.class=ct(i)),Ft(l)&&(ch(l)&&!it(l)&&(l=Tn({},l)),t.style=oo(l))}const s=Qt(e)?1:Sy(e)?128:Zv(e)?64:Ft(e)?4:ht(e)?2:0;return w(e,t,n,r,o,s,a,!0)}function OS(e){return e?ch(e)||my(e)?Tn({},e):e:null}function Xs(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:i,transition:l}=e,u=t?yh(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&xy(u),ref:t&&t.ref?n&&a?it(a)?a.concat(nc(t)):[a,nc(t)]:nc(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!==rt?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&&Xs(e.ssContent),ssFallback:e.ssFallback&&Xs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&nu(d,l.clone(d)),d}function Gs(e=" ",t=0){return Fe(Wc,null,e,t)}function pe(e="",t=!1){return t?(_(),Ze(Xn,null,e)):Fe(Xn,null,e)}function wa(e){return e==null||typeof e=="boolean"?Fe(Xn):it(e)?Fe(rt,null,e.slice()):ru(e)?Va(e):Fe(Wc,null,String(e))}function Va(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Xs(e)}function mc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(it(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),mc(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!my(t)?t._ctx=Hn:o===3&&Hn&&(Hn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ht(t)){if(r&65){mc(e,{default:t});return}t={default:t,_ctx:Hn},n=32}else t=String(t),r&64?(n=16,t=[Gs(t)]):n=8;e.children=t,e.shapeFlag|=n}function yh(...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=ct([t.class,r.class]));else if(o==="style")t.style=oo([t.style,r.style]);else if(jc(o)){const a=t[o],s=r[o];s&&a!==s&&!(it(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!$c(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function ga(e,t,n,r=null){io(e,t,7,[n,r])}const DS=cy();let FS=0;function BS(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||DS,a={uid:FS++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ck(!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:vy(r,o),emitsOptions:dy(r,o),emit:null,emitted:null,propsDefaults:Ht,inheritAttrs:r.inheritAttrs,ctx:Ht,data:Ht,props:Ht,attrs:Ht,slots:Ht,refs:Ht,setupState:Ht,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=wS.bind(null,a),e.ce&&e.ce(a),a}let zn=null;const wh=()=>zn||Hn;let gc,Cf;{const e=Fc(),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)}};gc=t("__VUE_INSTANCE_SETTERS__",n=>zn=n),Cf=t("__VUE_SSR_SETTERS__",n=>gl=n)}const mu=e=>{const t=zn;return gc(e),e.scope.on(),()=>{e.scope.off(),gc(t)}},sm=()=>{zn&&zn.scope.off(),gc(null)};function Iy(e){return e.vnode.shapeFlag&4}let gl=!1;function US(e,t=!1,n=!1){t&&Cf(t);const{props:r,children:o}=e.vnode,a=Iy(e);xS(e,r,a,t),PS(e,o,n||t);const s=a?zS(e,t):void 0;return t&&Cf(!1),s}function zS(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,lS);const{setup:r}=n;if(r){ts();const o=e.setupContext=r.length>1?_y(e):null,a=mu(e),s=du(r,e,0,[e.props,o]),i=bv(s);if(ns(),a(),(i||e.sp)&&!sl(e)&&fh(e),i){if(s.then(sm,sm),t)return s.then(l=>{im(e,l)}).catch(l=>{fu(l,e,0)});e.asyncDep=s}else im(e,s)}else Ay(e)}function im(e,t,n){ht(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ft(t)&&(e.setupState=Wv(t)),Ay(e)}function Ay(e,t,n){const r=e.type;e.render||(e.render=r.render||Ta);{const o=mu(e);ts();try{dS(e)}finally{ns(),o()}}}const HS={get(e,t){return Qn(e,"get",""),e[t]}};function _y(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,HS),slots:e.slots,emit:e.emit,expose:t}}function qc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Wv(Pk(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Yl)return Yl[n](e)},has(t,n){return n in t||n in Yl}})):e.proxy}function WS(e,t=!0){return ht(e)?e.displayName||e.name:e.name||t&&e.__name}function qS(e){return ht(e)&&"__vccOpts"in e}const G=(e,t)=>jk(e,t,gl);function bh(e,t,n){try{pc(-1);const r=arguments.length;return r===2?Ft(t)&&!it(t)?ru(t)?Fe(e,null,[t]):Fe(e,t):Fe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ru(n)&&(n=[n]),Fe(e,t,n))}finally{pc(1)}}function q2(e,t,n,r){const o=n[r];if(o&&GS(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function GS(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Ro(n[r],t[r]))return!1;return ml>0&&dr&&dr.push(e),!0}const VS="3.5.40";/**
15
- * @vue/runtime-dom v3.5.40
16
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
- * @license MIT
18
- **/let xf;const lm=typeof window<"u"&&window.trustedTypes;if(lm)try{xf=lm.createPolicy("vue",{createHTML:e=>e})}catch{}const Py=xf?e=>xf.createHTML(e):e=>e,KS="http://www.w3.org/2000/svg",YS="http://www.w3.org/1998/Math/MathML",Ga=typeof document<"u"?document:null,um=Ga&&Ga.createElement("template"),JS={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"?Ga.createElementNS(KS,e):t==="mathml"?Ga.createElementNS(YS,e):n?Ga.createElement(e,{is:n}):Ga.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Ga.createTextNode(e),createComment:e=>Ga.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ga.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{um.innerHTML=Py(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const i=um.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]}},Ds="transition",Ol="animation",ou=Symbol("_vtc"),Ey={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},QS=Tn({},ey,Ey),XS=e=>(e.displayName="Transition",e.props=QS,e),gu=XS((e,{slots:t})=>bh(Kk,ZS(e),t)),gi=(e,t=[])=>{it(e)?e.forEach(n=>n(...t)):e&&e(...t)},cm=e=>e?it(e)?e.some(t=>t.length>1):e.length>1:!1;function ZS(e){const t={};for(const ee in e)ee in Ey||(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:u=s,appearToClass:d=i,leaveFromClass:m=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:v=`${n}-leave-to`}=e,T=eC(o),S=T&&T[0],R=T&&T[1],{onBeforeEnter:E,onEnter:N,onEnterCancelled:W,onLeave:L,onLeaveCancelled:fe,onBeforeAppear:le=E,onAppear:Y=N,onAppearCancelled:ie=W}=t,we=(ee,ve,ne,Ae)=>{ee._enterCancelled=Ae,vi(ee,ve?d:i),vi(ee,ve?u:s),ne&&ne()},Pe=(ee,ve)=>{ee._isLeaving=!1,vi(ee,m),vi(ee,v),vi(ee,f),ve&&ve()},ye=ee=>(ve,ne)=>{const Ae=ee?Y:N,De=()=>we(ve,ee,ne);gi(Ae,[ve,De]),dm(()=>{vi(ve,ee?l:a),Ha(ve,ee?d:i),cm(Ae)||fm(ve,r,S,De)})};return Tn(t,{onBeforeEnter(ee){gi(E,[ee]),Ha(ee,a),Ha(ee,s)},onBeforeAppear(ee){gi(le,[ee]),Ha(ee,l),Ha(ee,u)},onEnter:ye(!1),onAppear:ye(!0),onLeave(ee,ve){ee._isLeaving=!0;const ne=()=>Pe(ee,ve);Ha(ee,m),ee._enterCancelled?(Ha(ee,f),mm(ee)):(mm(ee),Ha(ee,f)),dm(()=>{ee._isLeaving&&(vi(ee,m),Ha(ee,v),cm(L)||fm(ee,r,R,ne))}),gi(L,[ee,ne])},onEnterCancelled(ee){we(ee,!1,void 0,!0),gi(W,[ee])},onAppearCancelled(ee){we(ee,!0,void 0,!0),gi(ie,[ee])},onLeaveCancelled(ee){Pe(ee),gi(fe,[ee])}})}function eC(e){if(e==null)return null;if(Ft(e))return[Dd(e.enter),Dd(e.leave)];{const t=Dd(e);return[t,t]}}function Dd(e){return nk(e)}function Ha(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[ou]||(e[ou]=new Set)).add(t)}function vi(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[ou];n&&(n.delete(t),n.size||(e[ou]=void 0))}function dm(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let tC=0;function fm(e,t,n,r){const o=e._endId=++tC,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=nC(e,t);if(!s)return r();const u=s+"end";let d=0;const m=()=>{e.removeEventListener(u,f),a()},f=v=>{v.target===e&&++d>=l&&m()};setTimeout(()=>{d<l&&m()},i+1),e.addEventListener(u,f)}function nC(e,t){const n=window.getComputedStyle(e),r=T=>(n[T]||"").split(", "),o=r(`${Ds}Delay`),a=r(`${Ds}Duration`),s=hm(o,a),i=r(`${Ol}Delay`),l=r(`${Ol}Duration`),u=hm(i,l);let d=null,m=0,f=0;t===Ds?s>0&&(d=Ds,m=s,f=a.length):t===Ol?u>0&&(d=Ol,m=u,f=l.length):(m=Math.max(s,u),d=m>0?s>u?Ds:Ol:null,f=d?d===Ds?a.length:l.length:0);const v=d===Ds&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ds}Property`).toString());return{type:d,timeout:m,propCount:f,hasTransform:v}}function hm(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>pm(n)+pm(e[r])))}function pm(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function mm(e){return(e?e.ownerDocument:document).body.offsetHeight}function rC(e,t,n){const r=e[ou];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const vc=Symbol("_vod"),My=Symbol("_vsh"),G2={name:"show",beforeMount(e,{value:t},{transition:n}){e[vc]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Dl(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),Dl(e,!0),r.enter(e)):r.leave(e,()=>{Dl(e,!1)}):Dl(e,t))},beforeUnmount(e,{value:t}){Dl(e,t)}};function Dl(e,t){e.style.display=t?e[vc]:"none",e[My]=!t}const oC=Symbol(""),aC=/(?:^|;)\s*display\s*:/;function sC(e,t,n){const r=e.style,o=Qt(n);let a=!1;if(n&&!o){if(t)if(Qt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Hl(r,i,"")}else for(const s in t)n[s]==null&&Hl(r,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?lC(e,s,!Qt(t)&&t?t[s]:void 0,i)||Hl(r,s,i):Hl(r,s,"")}}else if(o){if(t!==n){const s=r[oC];s&&(n+=";"+s),r.cssText=n,a=aC.test(n)}}else t&&e.removeAttribute("style");vc in e&&(e[vc]=a?r.display:"",e[My]&&(r.display="none"))}const gm=/\s*!important$/;function Hl(e,t,n){if(it(n))n.forEach(r=>Hl(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=iC(e,t);gm.test(n)?e.setProperty(ei(r),n.replace(gm,""),"important"):e[r]=n}}const vm=["Webkit","Moz","ms"],Fd={};function iC(e,t){const n=Fd[t];if(n)return n;let r=fr(t);if(r!=="filter"&&r in e)return Fd[t]=r;r=Dc(r);for(let o=0;o<vm.length;o++){const a=vm[o]+r;if(a in e)return Fd[t]=a}return t}function lC(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Qt(r)&&n===r}const ym="http://www.w3.org/1999/xlink";function wm(e,t,n,r,o,a=lk(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(ym,t.slice(6,t.length)):e.setAttributeNS(ym,t,n):n==null||a&&!Cv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":Oo(n)?String(n):n)}function bm(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Py(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=Cv(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 Si(e,t,n,r){e.addEventListener(t,n,r)}function uC(e,t,n,r){e.removeEventListener(t,n,r)}const Tm=Symbol("_vei");function cC(e,t,n,r,o=null){const a=e[Tm]||(e[Tm]={}),s=a[t];if(r&&s)s.value=r;else{const[i,l]=hC(t);if(r){const u=a[t]=gC(r,o);Si(e,i,u,l)}else s&&(uC(e,i,s,l),a[t]=void 0)}}const dC=/(Once|Passive|Capture)$/,fC=/^on:?(?:Once|Passive|Capture)$/;function hC(e){let t,n;for(;(n=e.match(dC))&&!fC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):ei(e.slice(2)),t]}let Bd=0;const pC=Promise.resolve(),mC=()=>Bd||(pC.then(()=>Bd=0),Bd=Date.now());function gC(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const o=n.value;if(it(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 u=s[l];u&&io(u,t,5,i)}}else io(o,t,5,[r])};return n.value=e,n.attached=mC(),n}const km=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,vC=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?rC(e,r,s):t==="style"?sC(e,n,r):jc(t)?$c(t)||cC(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):yC(e,t,r,s))?(bm(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&wm(e,t,r,s,a,t!=="value")):e._isVueCE&&(wC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Qt(r)))?bm(e,fr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),wm(e,t,r,s))};function yC(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&km(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 km(t)&&Qt(n)?!1:t in e}function wC(e,t){const n=e._def.props;if(!n)return!1;const r=fr(t);return Array.isArray(n)?n.some(o=>fr(o)===r):Object.keys(n).some(o=>fr(o)===r)}const yc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return it(t)?n=>ec(t,n):t};function bC(e){e.target.composing=!0}function Sm(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ll=Symbol("_assign");function Cm(e,t,n){return t&&(e=e.trim()),n&&(e=rh(e)),e}const Ln={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[ll]=yc(o);const a=r||o.props&&o.props.type==="number";Si(e,t?"change":"input",s=>{s.target.composing||e[ll](Cm(e.value,n,a))}),(n||a)&&Si(e,"change",()=>{e.value=Cm(e.value,n,a)}),t||(Si(e,"compositionstart",bC),Si(e,"compositionend",Sm),Si(e,"change",Sm))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[ll]=yc(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?rh(e.value):e.value,l=t??"";if(i===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},TC={deep:!0,created(e,t,n){e[ll]=yc(n),Si(e,"change",()=>{const r=e._modelValue,o=kC(e),a=e.checked,s=e[ll];if(it(r)){const i=xv(r,o),l=i!==-1;if(a&&!l)s(r.concat(o));else if(!a&&l){const u=[...r];u.splice(i,1),s(u)}}else if(Nc(r)){const i=new Set(r);a?i.add(o):i.delete(o),s(i)}else s(Ry(e,a))})},mounted:xm,beforeUpdate(e,t,n){e[ll]=yc(n),xm(e,t,n)}};function xm(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(it(t))o=xv(t,r.props.value)>-1;else if(Nc(t))o=t.has(r.props.value);else{if(t===n)return;o=cu(t,Ry(e,!0))}e.checked!==o&&(e.checked=o)}function kC(e){return"_value"in e?e._value:e.value}function Ry(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const SC=["ctrl","shift","alt","meta"],CC={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)=>SC.some(n=>e[`${n}Key`]&&!t.includes(n))},pt=(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=CC[t[s]];if(i&&i(o,t))return}return e(o,...a)})},xC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Tr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=o=>{if(!("key"in o))return;const a=ei(o.key);if(t.some(s=>s===a||xC[s]===a))return e(o)})},IC=Tn({patchProp:vC},JS);let Im;function AC(){return Im||(Im=MS(IC))}const _C=(...e)=>{const t=AC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=EC(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,PC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function PC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function EC(e){return Qt(e)?document.querySelector(e):e}const MC="modulepreload",RC=function(e){return"/"+e},Am={},Eo=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};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(u=>{if(u=RC(u),u in Am)return;Am[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":MC,d||(f.as="script"),f.crossOrigin="",f.href=u,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((v,T)=>{f.addEventListener("load",v),f.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return o.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
19
- * vue-router v4.6.4
20
- * (c) 2025 Eduardo San Martin Morote
21
- * @license MIT
22
- */const Zi=typeof document<"u";function Ly(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function LC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Ly(e.default)}const Ot=Object.assign;function Ud(e,t){const n={};for(const r in t){const o=t[r];n[r]=Fo(o)?o.map(e):e(o)}return n}const Jl=()=>{},Fo=Array.isArray;function _m(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const jy=/#/g,jC=/&/g,$C=/\//g,NC=/=/g,OC=/\?/g,$y=/\+/g,DC=/%5B/g,FC=/%5D/g,Ny=/%5E/g,BC=/%60/g,Oy=/%7B/g,UC=/%7C/g,Dy=/%7D/g,zC=/%20/g;function Th(e){return e==null?"":encodeURI(""+e).replace(UC,"|").replace(DC,"[").replace(FC,"]")}function HC(e){return Th(e).replace(Oy,"{").replace(Dy,"}").replace(Ny,"^")}function If(e){return Th(e).replace($y,"%2B").replace(zC,"+").replace(jy,"%23").replace(jC,"%26").replace(BC,"`").replace(Oy,"{").replace(Dy,"}").replace(Ny,"^")}function WC(e){return If(e).replace(NC,"%3D")}function qC(e){return Th(e).replace(jy,"%23").replace(OC,"%3F")}function GC(e){return qC(e).replace($C,"%2F")}function au(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const VC=/\/$/,KC=e=>e.replace(VC,"");function zd(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=XC(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:au(s)}}function YC(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Pm(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function JC(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&vl(t.matched[r],n.matched[o])&&Fy(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function vl(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Fy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!QC(e[n],t[n]))return!1;return!0}function QC(e,t){return Fo(e)?Em(e,t):Fo(t)?Em(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Em(e,t){return Fo(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function XC(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 Fs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Af=function(e){return e.pop="pop",e.push="push",e}({}),Hd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function ZC(e){if(!e)if(Zi){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),KC(e)}const ex=/^[^#]+#/;function tx(e,t){return e.replace(ex,"#")+t}function nx(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 Gc=()=>({left:window.scrollX,top:window.scrollY});function rx(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=nx(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 Mm(e,t){return(history.state?history.state.position-t:-1)+e}const _f=new Map;function ox(e,t){_f.set(e,t)}function ax(e){const t=_f.get(e);return _f.delete(e),t}function sx(e){return typeof e=="string"||e&&typeof e=="object"}function By(e){return typeof e=="string"||typeof e=="symbol"}let fn=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 Uy=Symbol("");fn.MATCHER_NOT_FOUND+"",fn.NAVIGATION_GUARD_REDIRECT+"",fn.NAVIGATION_ABORTED+"",fn.NAVIGATION_CANCELLED+"",fn.NAVIGATION_DUPLICATED+"";function yl(e,t){return Ot(new Error,{type:e,[Uy]:!0},t)}function Wa(e,t){return e instanceof Error&&Uy in e&&(t==null||!!(e.type&t))}const ix=["params","query","hash"];function lx(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of ix)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function ux(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($y," "),a=o.indexOf("="),s=au(a<0?o:o.slice(0,a)),i=a<0?null:au(o.slice(a+1));if(s in t){let l=t[s];Fo(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function Rm(e){let t="";for(let n in e){const r=e[n];if(n=WC(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(Fo(r)?r.map(o=>o&&If(o)):[r&&If(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function cx(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Fo(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const dx=Symbol(""),Lm=Symbol(""),Vc=Symbol(""),kh=Symbol(""),Pf=Symbol("");function Fl(){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 Ws(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((i,l)=>{const u=f=>{f===!1?l(yl(fn.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):sx(f)?l(yl(fn.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,u));let m=Promise.resolve(d);e.length<3&&(m=m.then(u)),m.catch(f=>l(f))})}function Wd(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(Ly(l)){const u=(l.__vccOpts||l)[t];u&&a.push(Ws(u,n,r,s,i,o))}else{let u=l();a.push(()=>u.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const m=LC(d)?d.default:d;s.mods[i]=d,s.components[i]=m;const f=(m.__vccOpts||m)[t];return f&&Ws(f,n,r,s,i,o)()}))}}return a}function fx(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(u=>vl(u,i))?r.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(u=>vl(u,l))||o.push(l))}return[n,r,o]}/*!
23
- * vue-router v4.6.4
24
- * (c) 2025 Eduardo San Martin Morote
25
- * @license MIT
26
- */let hx=()=>location.protocol+"//"+location.host;function zy(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),Pm(i,"")}return Pm(n,e)+r+o}function px(e,t,n,r){let o=[],a=[],s=null;const i=({state:f})=>{const v=zy(e,location),T=n.value,S=t.value;let R=0;if(f){if(n.value=v,t.value=f,s&&s===T){s=null;return}R=S?f.position-S.position:0}else r(v);o.forEach(E=>{E(n.value,T,{delta:R,type:Af.pop,direction:R?R>0?Hd.forward:Hd.back:Hd.unknown})})};function l(){s=n.value}function u(f){o.push(f);const v=()=>{const T=o.indexOf(f);T>-1&&o.splice(T,1)};return a.push(v),v}function d(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Ot({},f.state,{scroll:Gc()}),"")}}function m(){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:u,destroy:m}}function jm(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?Gc():null}}function mx(e){const{history:t,location:n}=window,r={value:zy(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,u,d){const m=e.indexOf("#"),f=m>-1?(n.host&&document.querySelector("base")?e:e.slice(m))+l:hx()+e+l;try{t[d?"replaceState":"pushState"](u,"",f),o.value=u}catch(v){console.error(v),n[d?"replace":"assign"](f)}}function s(l,u){a(l,Ot({},t.state,jm(o.value.back,l,o.value.forward,!0),u,{position:o.value.position}),!0),r.value=l}function i(l,u){const d=Ot({},o.value,t.state,{forward:l,scroll:Gc()});a(d.current,d,!0),a(l,Ot({},jm(r.value,l,null),{position:d.position+1},u),!1),r.value=l}return{location:r,state:o,push:i,replace:s}}function gx(e){e=ZC(e);const t=mx(e),n=px(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=Ot({location:"",base:e,go:r,createHref:tx.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 vx(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),gx(e)}let Ci=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var An=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}(An||{});const yx={type:Ci.Static,value:""},wx=/[a-zA-Z0-9_]/;function bx(e){if(!e)return[[]];if(e==="/")return[[yx]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(v){throw new Error(`ERR (${n})/"${u}": ${v}`)}let n=An.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let i=0,l,u="",d="";function m(){u&&(n===An.Static?a.push({type:Ci.Static,value:u}):n===An.Param||n===An.ParamRegExp||n===An.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Ci.Param,value:u,regexp:d,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),u="")}function f(){u+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==An.ParamRegExp){r=n,n=An.EscapeNext;continue}switch(n){case An.Static:l==="/"?(u&&m(),s()):l===":"?(m(),n=An.Param):f();break;case An.EscapeNext:f(),n=r;break;case An.Param:l==="("?n=An.ParamRegExp:wx.test(l)?f():(m(),n=An.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case An.ParamRegExp:l===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+l:n=An.ParamRegExpEnd:d+=l;break;case An.ParamRegExpEnd:m(),n=An.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,d="";break;default:t("Unknown state");break}}return n===An.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),m(),s(),o}const $m="[^/]+?",Tx={sensitive:!1,strict:!1,start:!0,end:!0};var ur=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}(ur||{});const kx=/[.+*?^${}()[\]/\\]/g;function Sx(e,t){const n=Ot({},Tx,t),r=[];let o=n.start?"^":"";const a=[];for(const u of e){const d=u.length?[]:[ur.Root];n.strict&&!u.length&&(o+="/");for(let m=0;m<u.length;m++){const f=u[m];let v=ur.Segment+(n.sensitive?ur.BonusCaseSensitive:0);if(f.type===Ci.Static)m||(o+="/"),o+=f.value.replace(kx,"\\$&"),v+=ur.Static;else if(f.type===Ci.Param){const{value:T,repeatable:S,optional:R,regexp:E}=f;a.push({name:T,repeatable:S,optional:R});const N=E||$m;if(N!==$m){v+=ur.BonusCustomRegExp;try{`${N}`}catch(L){throw new Error(`Invalid custom RegExp for param "${T}" (${N}): `+L.message)}}let W=S?`((?:${N})(?:/(?:${N}))*)`:`(${N})`;m||(W=R&&u.length<2?`(?:/${W})`:"/"+W),R&&(W+="?"),o+=W,v+=ur.Dynamic,R&&(v+=ur.BonusOptional),S&&(v+=ur.BonusRepeatable),N===".*"&&(v+=ur.BonusWildcard)}d.push(v)}r.push(d)}if(n.strict&&n.end){const u=r.length-1;r[u][r[u].length-1]+=ur.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function i(u){const d=u.match(s),m={};if(!d)return null;for(let f=1;f<d.length;f++){const v=d[f]||"",T=a[f-1];m[T.name]=v&&T.repeatable?v.split("/"):v}return m}function l(u){let d="",m=!1;for(const f of e){(!m||!d.endsWith("/"))&&(d+="/"),m=!1;for(const v of f)if(v.type===Ci.Static)d+=v.value;else if(v.type===Ci.Param){const{value:T,repeatable:S,optional:R}=v,E=T in u?u[T]:"";if(Fo(E)&&!S)throw new Error(`Provided param "${T}" is an array but it is not repeatable (* or + modifiers)`);const N=Fo(E)?E.join("/"):E;if(!N)if(R)f.length<2&&(d.endsWith("/")?d=d.slice(0,-1):m=!0);else throw new Error(`Missing required param "${T}"`);d+=N}}return d||"/"}return{re:s,score:r,keys:a,parse:i,stringify:l}}function Cx(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]===ur.Static+ur.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===ur.Static+ur.Segment?1:-1:0}function Hy(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=Cx(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(Nm(r))return 1;if(Nm(o))return-1}return o.length-r.length}function Nm(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const xx={strict:!1,end:!0,sensitive:!1};function Ix(e,t,n){const r=Sx(bx(e.path),n),o=Ot(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function Ax(e,t){const n=[],r=new Map;t=_m(xx,t);function o(m){return r.get(m)}function a(m,f,v){const T=!v,S=Dm(m);S.aliasOf=v&&v.record;const R=_m(t,m),E=[S];if("alias"in m){const L=typeof m.alias=="string"?[m.alias]:m.alias;for(const fe of L)E.push(Dm(Ot({},S,{components:v?v.record.components:S.components,path:fe,aliasOf:v?v.record:S})))}let N,W;for(const L of E){const{path:fe}=L;if(f&&fe[0]!=="/"){const le=f.record.path,Y=le[le.length-1]==="/"?"":"/";L.path=f.record.path+(fe&&Y+fe)}if(N=Ix(L,f,R),v?v.alias.push(N):(W=W||N,W!==N&&W.alias.push(N),T&&m.name&&!Fm(N)&&s(m.name)),Wy(N)&&l(N),S.children){const le=S.children;for(let Y=0;Y<le.length;Y++)a(le[Y],N,v&&v.children[Y])}v=v||N}return W?()=>{s(W)}:Jl}function s(m){if(By(m)){const f=r.get(m);f&&(r.delete(m),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(m);f>-1&&(n.splice(f,1),m.record.name&&r.delete(m.record.name),m.children.forEach(s),m.alias.forEach(s))}}function i(){return n}function l(m){const f=Ex(m,n);n.splice(f,0,m),m.record.name&&!Fm(m)&&r.set(m.record.name,m)}function u(m,f){let v,T={},S,R;if("name"in m&&m.name){if(v=r.get(m.name),!v)throw yl(fn.MATCHER_NOT_FOUND,{location:m});R=v.record.name,T=Ot(Om(f.params,v.keys.filter(W=>!W.optional).concat(v.parent?v.parent.keys.filter(W=>W.optional):[]).map(W=>W.name)),m.params&&Om(m.params,v.keys.map(W=>W.name))),S=v.stringify(T)}else if(m.path!=null)S=m.path,v=n.find(W=>W.re.test(S)),v&&(T=v.parse(S),R=v.record.name);else{if(v=f.name?r.get(f.name):n.find(W=>W.re.test(f.path)),!v)throw yl(fn.MATCHER_NOT_FOUND,{location:m,currentLocation:f});R=v.record.name,T=Ot({},f.params,m.params),S=v.stringify(T)}const E=[];let N=v;for(;N;)E.unshift(N.record),N=N.parent;return{name:R,path:S,params:T,matched:E,meta:Px(E)}}e.forEach(m=>a(m));function d(){n.length=0,r.clear()}return{addRoute:a,resolve:u,removeRoute:s,clearRoutes:d,getRoutes:i,getRecordMatcher:o}}function Om(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Dm(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:_x(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 _x(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 Fm(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Px(e){return e.reduce((t,n)=>Ot(t,n.meta),{})}function Ex(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;Hy(e,t[a])<0?r=a:n=a+1}const o=Mx(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function Mx(e){let t=e;for(;t=t.parent;)if(Wy(t)&&Hy(e,t)===0)return t}function Wy({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Bm(e){const t=No(Vc),n=No(kh),r=G(()=>{const l=g(e.to);return t.resolve(l)}),o=G(()=>{const{matched:l}=r.value,{length:u}=l,d=l[u-1],m=n.matched;if(!d||!m.length)return-1;const f=m.findIndex(vl.bind(null,d));if(f>-1)return f;const v=Um(l[u-2]);return u>1&&Um(d)===v&&m[m.length-1].path!==v?m.findIndex(vl.bind(null,l[u-2])):f}),a=G(()=>o.value>-1&&Nx(n.params,r.value.params)),s=G(()=>o.value>-1&&o.value===n.matched.length-1&&Fy(n.params,r.value.params));function i(l={}){if($x(l)){const u=t[g(e.replace)?"replace":"push"](g(e.to)).catch(Jl);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:G(()=>r.value.href),isActive:a,isExactActive:s,navigate:i}}function Rx(e){return e.length===1?e[0]:e}const Lx=hn({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:Bm,setup(e,{slots:t}){const n=Uc(Bm(e)),{options:r}=No(Vc),o=G(()=>({[zm(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[zm(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&Rx(t.default(n));return e.custom?a:bh("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),jx=Lx;function $x(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 Nx(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(!Fo(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function Um(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const zm=(e,t,n)=>e??t??n,Ox=hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=No(Pf),o=G(()=>e.route||r.value),a=No(Lm,0),s=G(()=>{let u=g(a);const{matched:d}=o.value;let m;for(;(m=d[u])&&!m.components;)u++;return u}),i=G(()=>o.value.matched[s.value]);tc(Lm,G(()=>s.value+1)),tc(dx,i),tc(Pf,o);const l=k();return tt(()=>[l.value,i.value,e.name],([u,d,m],[f,v,T])=>{d&&(d.instances[m]=u,v&&v!==d&&u&&u===f&&(d.leaveGuards.size||(d.leaveGuards=v.leaveGuards),d.updateGuards.size||(d.updateGuards=v.updateGuards))),u&&d&&(!v||!vl(d,v)||!f)&&(d.enterCallbacks[m]||[]).forEach(S=>S(u))},{flush:"post"}),()=>{const u=o.value,d=e.name,m=i.value,f=m&&m.components[d];if(!f)return Hm(n.default,{Component:f,route:u});const v=m.props[d],T=v?v===!0?u.params:typeof v=="function"?v(u):v:null,R=bh(f,Ot({},T,t,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(m.instances[d]=null)},ref:l}));return Hm(n.default,{Component:R,route:u})||R}}});function Hm(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Dx=Ox;function Fx(e){const t=Ax(e.routes,e),n=e.parseQuery||ux,r=e.stringifyQuery||Rm,o=e.history,a=Fl(),s=Fl(),i=Fl(),l=Ek(Fs);let u=Fs;Zi&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=Ud.bind(null,F=>""+F),m=Ud.bind(null,GC),f=Ud.bind(null,au);function v(F,oe){let se,Le;return By(F)?(se=t.getRecordMatcher(F),Le=oe):Le=F,t.addRoute(Le,se)}function T(F){const oe=t.getRecordMatcher(F);oe&&t.removeRoute(oe)}function S(){return t.getRoutes().map(F=>F.record)}function R(F){return!!t.getRecordMatcher(F)}function E(F,oe){if(oe=Ot({},oe||l.value),typeof F=="string"){const q=zd(n,F,oe.path),ue=t.resolve({path:q.path},oe),re=o.createHref(q.fullPath);return Ot(q,ue,{params:f(ue.params),hash:au(q.hash),redirectedFrom:void 0,href:re})}let se;if(F.path!=null)se=Ot({},F,{path:zd(n,F.path,oe.path).path});else{const q=Ot({},F.params);for(const ue in q)q[ue]==null&&delete q[ue];se=Ot({},F,{params:m(q)}),oe.params=m(oe.params)}const Le=t.resolve(se,oe),We=F.hash||"";Le.params=d(f(Le.params));const P=YC(r,Ot({},F,{hash:HC(We),path:Le.path})),$=o.createHref(P);return Ot({fullPath:P,hash:We,query:r===Rm?cx(F.query):F.query||{}},Le,{redirectedFrom:void 0,href:$})}function N(F){return typeof F=="string"?zd(n,F,l.value.path):Ot({},F)}function W(F,oe){if(u!==F)return yl(fn.NAVIGATION_CANCELLED,{from:oe,to:F})}function L(F){return Y(F)}function fe(F){return L(Ot(N(F),{replace:!0}))}function le(F,oe){const se=F.matched[F.matched.length-1];if(se&&se.redirect){const{redirect:Le}=se;let We=typeof Le=="function"?Le(F,oe):Le;return typeof We=="string"&&(We=We.includes("?")||We.includes("#")?We=N(We):{path:We},We.params={}),Ot({query:F.query,hash:F.hash,params:We.path!=null?{}:F.params},We)}}function Y(F,oe){const se=u=E(F),Le=l.value,We=F.state,P=F.force,$=F.replace===!0,q=le(se,Le);if(q)return Y(Ot(N(q),{state:typeof q=="object"?Ot({},We,q.state):We,force:P,replace:$}),oe||se);const ue=se;ue.redirectedFrom=oe;let re;return!P&&JC(r,Le,se)&&(re=yl(fn.NAVIGATION_DUPLICATED,{to:ue,from:Le}),xe(Le,Le,!0,!1)),(re?Promise.resolve(re):Pe(ue,Le)).catch(ae=>Wa(ae)?Wa(ae,fn.NAVIGATION_GUARD_REDIRECT)?ae:Se(ae):je(ae,ue,Le)).then(ae=>{if(ae){if(Wa(ae,fn.NAVIGATION_GUARD_REDIRECT))return Y(Ot({replace:$},N(ae.to),{state:typeof ae.to=="object"?Ot({},We,ae.to.state):We,force:P}),oe||ue)}else ae=ee(ue,Le,!0,$,We);return ye(ue,Le,ae),ae})}function ie(F,oe){const se=W(F,oe);return se?Promise.reject(se):Promise.resolve()}function we(F){const oe=Xe.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(F):F()}function Pe(F,oe){let se;const[Le,We,P]=fx(F,oe);se=Wd(Le.reverse(),"beforeRouteLeave",F,oe);for(const q of Le)q.leaveGuards.forEach(ue=>{se.push(Ws(ue,F,oe))});const $=ie.bind(null,F,oe);return se.push($),ce(se).then(()=>{se=[];for(const q of a.list())se.push(Ws(q,F,oe));return se.push($),ce(se)}).then(()=>{se=Wd(We,"beforeRouteUpdate",F,oe);for(const q of We)q.updateGuards.forEach(ue=>{se.push(Ws(ue,F,oe))});return se.push($),ce(se)}).then(()=>{se=[];for(const q of P)if(q.beforeEnter)if(Fo(q.beforeEnter))for(const ue of q.beforeEnter)se.push(Ws(ue,F,oe));else se.push(Ws(q.beforeEnter,F,oe));return se.push($),ce(se)}).then(()=>(F.matched.forEach(q=>q.enterCallbacks={}),se=Wd(P,"beforeRouteEnter",F,oe,we),se.push($),ce(se))).then(()=>{se=[];for(const q of s.list())se.push(Ws(q,F,oe));return se.push($),ce(se)}).catch(q=>Wa(q,fn.NAVIGATION_CANCELLED)?q:Promise.reject(q))}function ye(F,oe,se){i.list().forEach(Le=>we(()=>Le(F,oe,se)))}function ee(F,oe,se,Le,We){const P=W(F,oe);if(P)return P;const $=oe===Fs,q=Zi?history.state:{};se&&(Le||$?o.replace(F.fullPath,Ot({scroll:$&&q&&q.scroll},We)):o.push(F.fullPath,We)),l.value=F,xe(F,oe,se,$),Se()}let ve;function ne(){ve||(ve=o.listen((F,oe,se)=>{if(!lt.listening)return;const Le=E(F),We=le(Le,lt.currentRoute.value);if(We){Y(Ot(We,{replace:!0,force:!0}),Le).catch(Jl);return}u=Le;const P=l.value;Zi&&ox(Mm(P.fullPath,se.delta),Gc()),Pe(Le,P).catch($=>Wa($,fn.NAVIGATION_ABORTED|fn.NAVIGATION_CANCELLED)?$:Wa($,fn.NAVIGATION_GUARD_REDIRECT)?(Y(Ot(N($.to),{force:!0}),Le).then(q=>{Wa(q,fn.NAVIGATION_ABORTED|fn.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===Af.pop&&o.go(-1,!1)}).catch(Jl),Promise.reject()):(se.delta&&o.go(-se.delta,!1),je($,Le,P))).then($=>{$=$||ee(Le,P,!1),$&&(se.delta&&!Wa($,fn.NAVIGATION_CANCELLED)?o.go(-se.delta,!1):se.type===Af.pop&&Wa($,fn.NAVIGATION_ABORTED|fn.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),ye(Le,P,$)}).catch(Jl)}))}let Ae=Fl(),De=Fl(),$e;function je(F,oe,se){Se(F);const Le=De.list();return Le.length?Le.forEach(We=>We(F,oe,se)):console.error(F),Promise.reject(F)}function Ce(){return $e&&l.value!==Fs?Promise.resolve():new Promise((F,oe)=>{Ae.add([F,oe])})}function Se(F){return $e||($e=!F,ne(),Ae.list().forEach(([oe,se])=>F?se(F):oe()),Ae.reset()),F}function xe(F,oe,se,Le){const{scrollBehavior:We}=e;if(!Zi||!We)return Promise.resolve();const P=!se&&ax(Mm(F.fullPath,0))||(Le||!se)&&history.state&&history.state.scroll||null;return Mt().then(()=>We(F,oe,P)).then($=>$&&rx($)).catch($=>je($,F,oe))}const Ee=F=>o.go(F);let Je;const Xe=new Set,lt={currentRoute:l,listening:!0,addRoute:v,removeRoute:T,clearRoutes:t.clearRoutes,hasRoute:R,getRoutes:S,resolve:E,options:e,push:L,replace:fe,go:Ee,back:()=>Ee(-1),forward:()=>Ee(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:De.add,isReady:Ce,install(F){F.component("RouterLink",jx),F.component("RouterView",Dx),F.config.globalProperties.$router=lt,Object.defineProperty(F.config.globalProperties,"$route",{enumerable:!0,get:()=>g(l)}),Zi&&!Je&&l.value===Fs&&(Je=!0,L(o.location).catch(Le=>{}));const oe={};for(const Le in Fs)Object.defineProperty(oe,Le,{get:()=>l.value[Le],enumerable:!0});F.provide(Vc,lt),F.provide(kh,zv(oe)),F.provide(Pf,l);const se=F.unmount;Xe.add(F),F.unmount=function(){Xe.delete(F),Xe.size<1&&(u=Fs,ve&&ve(),ve=null,l.value=Fs,Je=!1,$e=!1),se()}}};function ce(F){return F.reduce((oe,se)=>oe.then(()=>we(se)),Promise.resolve())}return lt}function Bx(){return No(Vc)}function Ux(e){return No(kh)}const Wm=768;function Sh(){const e=k(typeof window<"u"?window.innerWidth<Wm:!1);let t=null;function n(r){e.value=r.matches}return ss(()=>{t=window.matchMedia(`(max-width: ${Wm-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),pu(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const zx={key:0,class:"desktop-sidebar"},Hx={class:"desktop-main"},qm="codex-web-local.sidebar-width.v1",Wx=260,qx=620,Gm=320,Gx=hn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Sh();function r(u){return Math.min(qx,Math.max(Wx,u))}function o(){if(typeof window>"u")return Gm;const u=window.localStorage.getItem(qm),d=Number(u);return Number.isFinite(d)?r(d):Gm}const a=k(o()),s=G(()=>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(u){typeof window>"u"||window.localStorage.setItem(qm,String(u))}function l(u){u.preventDefault();const d=u.clientX,m=a.value,f=T=>{const S=T.clientX-d;a.value=r(m+S)},v=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",v)}return(u,d)=>(_(),B("div",{class:ct(["desktop-layout",{"is-mobile":g(n)}]),style:oo(s.value)},[g(n)?(_(),Ze(Qs,{key:0,to:"body"},[Fe(gu,{name:"drawer"},{default:ft(()=>[e.isSidebarCollapsed?pe("",!0):(_(),B("div",{key:0,class:"mobile-drawer-backdrop",onClick:d[1]||(d[1]=m=>u.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:d[0]||(d[0]=pt(()=>{},["stop"]))},[kr(u.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):pe("",!0),g(n)?pe("",!0):(_(),B(rt,{key:1},[e.isSidebarCollapsed?pe("",!0):(_(),B("aside",zx,[kr(u.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?pe("",!0):(_(),B("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",Hx,[kr(u.$slots,"content",{},void 0)])],6))}}),wt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},Vx=wt(Gx,[["__scopeId","data-v-336d0207"]]);function Vm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Dr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function uo(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Vm(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=Vm(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 lo(e,t,n){return e instanceof Dr?e:e instanceof Error?new Dr(e.message||t,{code:"unknown_error",method:n}):new Dr(t,{code:"unknown_error",method:n})}function qy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function Kx(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 Dr(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=uo(o,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${r.status}`;throw new Dr(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 Dr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function Yx(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Dr(uo(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 Jx(e){const t=qy(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 Km(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Qx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(u,d)=>{if(n||r!==null)return;const m=Math.min(1e3*2**d,1e4);r=window.setTimeout(()=>{r=null,!n&&u()},m)},s=u=>{const d=Jx(u);d&&e(d)},i=(u=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const d=new EventSource("/codex-api/events");let m=!1;d.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},d.addEventListener("ready",f=>{try{const v=f.data?JSON.parse(f.data):{ok:!0};Km(e,v)}catch{Km(e)}}),d.onerror=()=>{n||m||d.readyState===EventSource.CLOSED&&(m=!0,d.close(),a(()=>i(u+1),u))},t=()=>{m=!0,d.close()}},l=(u=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const d=window.location.protocol==="https:"?"wss:":"ws:",m=new WebSocket(`${d}//${window.location.host}/codex-api/ws`);let f=!1,v=!1,T=window.setTimeout(()=>{f||n||v||(v=!0,m.close(),i())},2500);m.onopen=()=>{f=!0,o(),T!==null&&(window.clearTimeout(T),T=null)},m.onmessage=S=>{try{s(JSON.parse(String(S.data)))}catch{}},m.onerror=()=>{},m.onclose=()=>{if(T!==null&&(window.clearTimeout(T),T=null),!(n||v)){if(!f){i();return}a(()=>l(u+1),u)}},t=()=>{v=!0,T!==null&&(window.clearTimeout(T),T=null),m.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,o(),t==null||t()}}async function Xx(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 Dr(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 Dr(uo(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 Dr(uo(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=qy(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}async function st(e,t){try{return await Kx(e,t)}catch(n){throw lo(n,`RPC ${e} failed`,e)}}function Zt(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 Kt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Zn(e){return typeof e=="boolean"?e:null}function Lo(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Ei(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 wc(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:Kt(t.createdAtMs),updatedAtMs:Kt(t.updatedAtMs),nextRunAtMs:Kt(t.nextRunAtMs)}}function Gy(e){if(Array.isArray(e))return e.flatMap(n=>{const r=wc(n);return r?[r]:[]});const t=wc(e);return t?[t]:[]}async function eI(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(uo(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=Gy(s);i.length>0&&(r[a]=i)}return r}async function tI(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(uo(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=Gy(s);i.length>0&&(r[a]=i)}return r}async function nI(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(uo(n,"Failed to save thread automation"));const r=wc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function rI(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(uo(n,"Failed to save project automation"));const r=wc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function Ym(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(uo(o,"Failed to delete thread automation"))}async function Vy(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(uo(o,"Failed to delete project automation"))}async function oI(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(uo(r,"Failed to run thread automation"))}const aI=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Ky(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||aI.has(n))}function sI(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||Ky(i)||r.push({path:i})}return r}async function iI(e,t){await st("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function lI(e,t){await st("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function uI(e){await st("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function Jm(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 u=Zt(a,"Failed to search files");throw new Error(u)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const u of i){if(!u||typeof u!="object"||Array.isArray(u))continue;const m=u.path,f=typeof m=="string"?m.trim():"";!f||Ky(f)||l.push({path:f})}return l}async function cI(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 dI(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:Zn(t.truncated)??!1}}async function kl(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(uo(r,`Terminal request failed with HTTP ${n.status}`));return r}async function V2(e){var r;const t=await kl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=dI((r=Ye(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function fI(){const e=await kl("/codex-api/thread-terminal/status"),t=Ye(e);return{available:Zn(t==null?void 0:t.available)??!1,reason:te(t==null?void 0:t.reason)||null}}async function K2(e){const t=await kl(`/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 Y2(e,t){await kl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function J2(e,t,n){await kl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function Q2(e){await kl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}function hI(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 Yy=["none","minimal","low","medium","high","xhigh","max","ultra"];function wl(e){return typeof e=="string"&&Yy.some(t=>t===e)}function pI(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function et(e){return pI(e)}function Jy(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function mI(e){const t=et(e);return t.startsWith("/")||Jy(t)}function gI(e){const t=et(e).replace(/[\\/]+/gu,"/");return Jy(t)?t.toLowerCase():t}function Or(e){const t=et(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function ul(e){const t=et(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function so(e){return Or(e)||et(e)||"Projectless"}function bc(e){const t=et(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function Qm(e){return new Date(e*1e3).toISOString()}function vI(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 yI(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wI(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const bI=/^##\s+(.+?):\s+(.+?)\s*$/,TI=/^#\s*files mentioned by the user\s*:?\s*$/i;function kI(e){var o,a;const t=e.split(`
27
- `).findIndex(s=>TI.test(s.trim()));if(t<0)return[];const n=e.split(`
28
- `).slice(t+1),r=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(bI);if(!l)break;const u=(o=l[1])==null?void 0:o.trim(),d=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");u&&d&&r.push({label:u,path:d})}return r}function SI(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const o=r.index+r[0].length;return e.slice(o).trim()}const CI=new Set(["text","image","localImage","audio","localAudio","skill","mention"]);function Qy(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function xI(e){return`/codex-local-file?path=${encodeURIComponent(e)}`}function II(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 AI(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 _I(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function qd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?_I(n[1].trim()):""}function PI(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=qd(t,"current_time_iso"),r=qd(t,"instructions");return!n||!r?null:{automationId:qd(t,"automation_id"),currentTimeIso:n,instructions:r}}function EI(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],imageAttachmentIds:[],audioSources:[],mentions:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[],s=[],i=[],l=[];for(const[f,v]of t.entries()){if(v.type==="text"&&typeof v.text=="string"&&v.text.length>0&&n.push(v.text),v.type==="image"&&"url"in v&&typeof v.url=="string"&&v.url.trim().length>0&&r.push(v.url.trim()),v.type==="image"&&!("url"in v)&&"fileId"in v&&typeof v.fileId=="string"&&v.fileId.trim().length>0&&o.push(v.fileId.trim()),v.type==="localImage"&&typeof v.path=="string"&&v.path.trim().length>0&&r.push(Qy(v.path.trim())),v.type==="skill"){const S=typeof v.name=="string"?v.name.trim():"",R=typeof v.path=="string"?v.path.trim():"";S&&R&&i.push({name:S,path:R})}if(v.type==="audio"&&typeof v.url=="string"&&v.url.trim().length>0&&a.push(v.url.trim()),v.type==="localAudio"&&typeof v.path=="string"&&v.path.trim().length>0&&a.push(xI(v.path.trim())),v.type==="mention"){const S=typeof v.name=="string"?v.name.trim():"",R=typeof v.path=="string"?v.path.trim():"";S&&s.push({name:S,path:R})}const T=v.type;CI.has(T)||l.push({id:`${e}:user-content:${f}`,role:"user",text:"",messageType:`userContent.${T}`,rawPayload:yI(v),isUnhandled:!0})}const u=n.join(`
29
- `),d=kI(u),m=PI(u);return{text:(m==null?void 0:m.instructions)??SI(u),images:r,skills:i,fileAttachments:d,imageAttachmentIds:o,audioSources:a,mentions:s,rawBlocks:l,isAutomationRun:m!==null,automationDisplayName:(m==null?void 0:m.automationId)||null}}function MI(e){var a;const t=e.replace(/\r\n/g,`
30
- `).trim();if(!t)return null;const n=t.split(`
31
- `),r=[],o=[];for(const s of n){const i=s.trim();if(!i){r.length===0&&o.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const u=(l[1]??" ").toLowerCase(),d=(a=l[2])==null?void 0:a.trim();if(!d)continue;let m="pending";u==="x"&&(m="completed"),(u==="~"||u===">"||u==="-")&&(m="inProgress"),r.push({step:d,status:m});continue}o.push(i)}return r.length===0?null:{explanation:o.join(`
32
- `).trim()||void 0,steps:r}}function Xm(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
33
- `),n=t.endsWith(`
34
- `)?t.slice(0,-1):t;return n?n.split(`
35
- `).length:0}function RI(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
36
- `).split(`
37
- `))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function Xy(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Ef(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 u=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,d=l==="update"?RI(s):l==="add"?{addedLineCount:Xm(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:Xm(s)};n.push({path:a,operation:l,movedToPath:u,diff:s,...d})}return n}function LI(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=EI(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0||t.imageAttachmentIds.length>0||t.audioSources.length>0||t.mentions.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,skills:t.skills.length>0?t.skills:void 0,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,imageAttachmentIds:t.imageAttachmentIds.length>0?t.imageAttachmentIds:void 0,audioSources:t.audioSources.length>0?t.audioSources:void 0,mentions:t.mentions.length>0?t.mentions:void 0,messageType:e.type,clientId:typeof e.clientId=="string"&&e.clientId.length>0?e.clientId:null,isAutomationRun:t.isAutomationRun,automationDisplayName:t.automationDisplayName}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="imageView"){const t=typeof e.path=="string"?e.path.trim():"";return t?[{id:e.id,role:"assistant",text:"",images:[Qy(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?II(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning"){const t=e,n=Array.isArray(t.summary)?t.summary.filter(i=>typeof i=="string"):[],r=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],o=n.join(`
38
- `).trim(),s=r.join(`
39
- `).trim()||o;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:r}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",r=typeof t.tool=="string"?t.tool:"";if(!n&&!r)return[];const o=t.status;let a="completed";const s=typeof o=="string"?o:o==null?void 0:o.type;(s==="inProgress"||s==="in_progress")&&(a="inProgress"),(s==="failed"||s==="error")&&(a="failed");const i=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",l=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:r,messageType:"toolCall",toolCall:{server:n,tool:r,status:a,error:i,durationMs:l}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:MI(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=jI(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:AI(t)}}]}if(e.type==="fileChange"){const t=Ef(e.changes),n=Xy(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 jI(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function $I(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 NI(e){const t=$I(e);return t.length>0?t:"Untitled thread"}function Ch(e){return(e==null?void 0:e.status)==="inProgress"}function xh(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 OI(e){var t;return((t=xh(e))==null?void 0:t.active)===!0}function Zy(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 Ch(o)||OI(e)}function ew(e){const t=e,n=et(typeof t.cwd=="string"?t.cwd:e.cwd),r=gI(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:NI(e),projectName:so(n),cwd:n,hasWorktree:o,createdAtIso:Qm(e.createdAt),updatedAtIso:Qm(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:Zy(e),externalSession:xh(e)}}function DI(e){return ew(e.thread)}function FI(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 BI(e){const t=e.data.map(ew);return FI(t)}const UI=["<subagent_notification>","<environment_context>"];function zI(e,t){const n=e.text.trimStart();return UI.some(r=>n.startsWith(r))?!0:t<=0?!1:(e.clientId??null)===null}function vu(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,u=Array.isArray(s.items)?s.items:[],d=vI(s==null?void 0:s.startedAt),m=[];for(const T of u)for(const S of LI(T))m.push({...S,turnId:l,turnIndex:a,turnStartedAtIso:d??void 0});let f=0;for(const T of m)T.role!=="user"||T.isUnhandled===!0||(zI(T,f)&&(T.isAgentNote=!0),f+=1);const v=wI(s);if(s.status==="failed"&&v){const T=l??`turn-${a}`;m.push({id:`${T}-error`,role:"system",text:v,messageType:"turnError",turnId:l,turnIndex:a,turnStartedAtIso:d??void 0})}r.push(...m)}return WI(HI(r))}function HI(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 WI(e){var s;let t=-1;for(let i=0;i<e.length;i+=1)if(((s=e[i])==null?void 0:s.messageType)==="compaction.done"){t=i;break}if(t<0)return e;const n=e[t],r=n.turnIndex;let o=-1;for(let i=0;i<e.length;i+=1){const l=e[i];if((l==null?void 0:l.turnIndex)===r&&(l==null?void 0:l.role)==="user"&&(l==null?void 0:l.isAgentNote)!==!0){o=i;break}}if(o<0||t<=o)return e;const a=e.filter((i,l)=>l!==t);return a.splice(o+1,0,n),a}function Ih(e){if(Zy(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Ch(t.at(-1))}function tw(e){return xh(e.thread)}function Ah(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(Ch(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const qI=50,GI=3e4,Yi=new Map,VI=5e3;function Gd(e){return e&&e.length>0?e:null}function Vd(e){return e&&e.length>0?e:null}function KI(e){return wl(e)?e:""}function YI(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function _h(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 Ph(e){const t=Ye(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function Mf(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 JI(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 su(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function Kc(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 Zm(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 QI(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
40
- `;for(const r of t)n+=`
41
- ## ${r.label}: ${r.path}
42
- `;return`${n}
43
- ## My request for Codex:
44
-
45
- ${e}
46
- `}function XI(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function ZI(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(VI)});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 eA(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),u=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return wl(u)?[u]:[]}).filter((i,l,u)=>u.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:wl(a)?a:null}}function eg(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function tA(e={}){const t=e.includeProviderModels!==!1,n=t?await ZI(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(eg);const r=await st("model/list",{}),o=[];for(const a of r.data){const s=eA(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(eg(a));return o}async function nA(e={}){return(await tA(e)).map(t=>t.id)}async function rA(){const e=await st("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=KI(e.config.model_reasoning_effort),o=YI(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}async function oA(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Gd(n):Vd(n)};let o=null;try{o=await rA()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?Gd(n??(o==null?void 0:o.reasoningEffort)):Vd(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await nA()}catch{s=[]}const i=((l=s.find(u=>u.trim().length>0))==null?void 0:l.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?Gd(n??(o==null?void 0:o.reasoningEffort)):Vd(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 aA(e,t){const n=await st("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:BI(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function sA(e){const t=await st("thread/read",{threadId:e,includeTurns:!1});return DI(t)}async function iA(e){const t=await st("thread/read",{threadId:e,includeTurns:!0}),n=Ph(t),r=vu(t,n);return{model:su(t),modelProvider:Kc(t),messages:r,inProgress:Ih(t),activeTurnId:Ah(t),hasMoreOlder:n>0,turnIndexByTurnId:_h(t,n),externalSession:tw(t)}}async function lA(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 Dr("当前 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:vu(a.result,s),inProgress:Ih(a.result),activeTurnId:Ah(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:_h(a.result,s)}}async function tg(e=null,t=qI){try{return await aA(e,t)}catch(n){throw lo(n,"Failed to load thread groups","thread/list")}}async function uA(e){try{return await sA(e)}catch(t){throw lo(t,`Failed to load thread ${e}`,"thread/read")}}async function Rf(e){try{return await iA(e)}catch(t){throw lo(t,`Failed to load thread ${e}`,"thread/read")}}async function cA(e,t,n){try{return await lA(e,t,n)}catch(r){throw lo(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function X2(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 Lf(e){const t=Yi.get(e);if(t)return t;const n=(async()=>{const o=await st("thread/resume",{threadId:e}),a=Ph(o),s=vu(o,a);return{model:su(o),modelProvider:Kc(o),messages:s,inProgress:Ih(o),activeTurnId:Ah(o),hasMoreOlder:a>0,turnIndexByTurnId:_h(o,a),externalSession:tw(o)}})();Yi.set(e,n);const r=globalThis.setTimeout(()=>{Yi.get(e)===n&&Yi.delete(e)},GI);return n.finally(()=>{globalThis.clearTimeout(r),globalThis.setTimeout(()=>{Yi.get(e)===n&&Yi.delete(e)},2e3)}).catch(()=>{}),n}async function dA(e){await st("thread/archive",{threadId:e})}async function fA(e){await st("thread/unarchive",{threadId:e})}async function hA(e){await st("thread/compact/start",{threadId:e})}async function pA(e,t){await st("thread/name/set",{threadId:e,name:t})}async function Kd(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 vu({thread:{...n.thread,turns:[...r.data].reverse()}},0)}async function mA(e){const t=await st("thread/turns/list",{threadId:e,limit:1e4,sortDirection:"desc",itemsView:"notLoaded"});return{turnIds:(Array.isArray(t.data)?t.data:[]).map(o=>{var a;return te((a=Ye(o))==null?void 0:a.id)}).filter(o=>typeof o=="string"&&o.length>0),complete:!te(t.nextCursor)}}async function ng(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=Mf(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:su(r),modelProvider:Kc(r)}}catch(n){throw lo(n,"Failed to start a new thread","thread/start")}}async function Yd(e,t,n){if(t===void 0||typeof t=="object"&&t!==null){const o=t&&typeof t=="object"?(t.beforeTurnId??"").trim():"";try{const a=await st("thread/fork",{threadId:e,persistExtendedHistory:!0,...o?{beforeTurnId:o}:{}}),s=Mf(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,cwd:JI(a),model:su(a),messages:vu(a,Ph(a))}}catch(a){throw lo(a,`Failed to fork thread ${e}`,"thread/fork")}}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const a={threadId:o};typeof t=="string"&&t.trim().length>0&&(a.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(a.model=n.trim());const s=await st("thread/fork",a),i=Mf(s);if(!i)throw new Error("thread/fork did not return a thread id");return{threadId:i,model:su(s),modelProvider:Kc(s)}}catch(o){throw lo(o,`Failed to fork thread ${e}`,"thread/fork")}}function nw(e,t,n,r=[]){const o=[];for(const u of t){const d=Zm(u.trim());d&&o.push({label:XI(d),path:d,fsPath:d})}const a=[...r,...o],s=a.filter((u,d)=>a.findIndex(m=>m.fsPath===u.fsPath)===d),l=[{type:"text",text:QI(hI(e,s,t),s)}];for(const u of t){const d=u.trim();if(!d)continue;const m=Zm(d);if(m){l.push({type:"localImage",path:m});continue}l.push({type:"image",url:d,image_url:d})}if(n)for(const u of n)l.push({type:"skill",name:u.name,path:u.path});return{input:l,dedupedFileAttachments:s}}function rw(){const e=typeof globalThis>"u"?void 0:globalThis.crypto;if(e&&typeof e.randomUUID=="function")try{return e.randomUUID()}catch{}const t="0123456789abcdef";let n="";for(let r=0;r<36;r+=1){if(r===8||r===13||r===18||r===23){n+="-";continue}if(r===14){n+="4";continue}const o=Math.floor(Math.random()*16);n+=r===19?t[o&3|8]:t[o]}return n}async function Jd(e,t,n=[],r,o,a,s=[],i,l){var u;try{const d=(r==null?void 0:r.trim())??"",{input:m,dedupedFileAttachments:f}=nw(t,n,a,s),v=f.map(R=>({label:R.label,path:R.path,fsPath:R.fsPath})),T={threadId:e,input:m,clientUserMessageId:rw()};if(typeof l=="string"&&l.trim().length>0&&(T.turnTrigger=l.trim()),v.length>0&&(T.attachments=v),d&&(T.model=d),typeof o=="string"&&o.length>0&&(T.effort=o),i){const R=await oA(i,d,o);T.collaborationMode={mode:i,settings:{model:R.model,reasoning_effort:R.reasoningEffort,developer_instructions:null}}}const S=await st("turn/start",T);return typeof((u=S==null?void 0:S.turn)==null?void 0:u.id)=="string"?S.turn.id.trim():""}catch(d){throw lo(d,`Failed to start turn for thread ${e}`,"turn/start")}}async function gA(e,t,n,r=[],o,a=[]){const s=e.trim(),i=t.trim();try{const{input:l}=nw(n,r,o,a),u=await st("turn/steer",{threadId:s,input:l,expectedTurnId:i,clientUserMessageId:rw()});return typeof(u==null?void 0:u.turnId)=="string"&&u.turnId.trim().length>0?u.turnId.trim():i}catch(l){throw lo(l,`Failed to steer turn for thread ${s}`,"turn/steer")}}async function vA(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 lo(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const yA=5e3,wA=3e4,rg=new Map,Qd=new Map,og=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function bA(e){return wl(e)?e:""}function TA(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function kA(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 ag(){return await(await fetch("/codex-api/free-mode/status")).json()}async function sg(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function ig(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 Ji(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 SA(e){const t=(e==null?void 0:e.trim())??"",n=t,r=rg.get(n);if(r&&Date.now()-r.fetchedAt<wA)return r.result;const o=Qd.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(yA)});let u=null;try{u=await l.json()}catch{u=null}l.ok&&Array.isArray(u==null?void 0:u.data)&&(s={ids:u.data.map(d=>typeof d=="string"?d.trim():"").filter((d,m,f)=>d.length>0&&f.indexOf(d)===m),exclusive:u.exclusive===!0})}catch{}return rg.set(n,{fetchedAt:Date.now(),result:s}),s})();Qd.set(n,a);try{return await a}finally{Qd.delete(n)}}function CA(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),u=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return wl(u)?[u]:[]}).filter((i,l,u)=>u.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:wl(a)?a:null}}function lg(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function xA(e={}){const t=e.includeProviderModels!==!1,n=t?await SA(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(lg);const r=await st("model/list",{}),o=[];for(const a of r.data){const s=CA(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(lg(a));return o}async function IA(){const e=await st("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=bA(e.config.model_reasoning_effort),o=TA(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function AA(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function _A(){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:AA(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of og)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return og}async function PA(){return Yx()}function EA(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:Kt(t.timeout??t.timeout_ms),enabled:Zn(t.enabled??t.active)}}async function MA(){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(EA).filter(o=>o!==null):[],warnings:Lo(r.warnings),errors:Lo(r.errors)})}return t}async function Z2(e){await st("marketplace/add",{source:e})}async function eU(e){await st("marketplace/remove",{marketplaceName:e})}async function tU(){const e=await st("marketplace/upgrade",{});return{selectedMarketplaces:Lo(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:Lo(e.upgradedRoots??e.upgraded_roots),errors:Lo(e.errors)}}function RA(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 nU(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 rU(){const e=await st("plugin/share/list",{});return(e.data??e.shares??[]).map(RA).filter(n=>n!==null)}async function oU(e){await st("plugin/share/delete",{remotePluginId:e})}async function aU(e){await st("plugin/share/checkout",{remotePluginId:e})}function ow(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:Zn(t.needsAuth??t.needs_auth)??!1}}function LA(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:Zn(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 aw(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),u=te(s==null?void 0:s.url)??"",d=i==="remote"?t.name??null:null,m=t.path??(i==="local"?l:null),f=te((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,v=te((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),T=te((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,displayName:f,description:v??T,longDescription:T,developerName:te((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:te(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:m,remoteMarketplaceName:d,sourceType:i,sourceUrl:u,installed:Zn(n.installed)??!1,enabled:Zn(n.enabled)??!0,installPolicy:te(n.installPolicy??n.install_policy)??"",authPolicy:te(n.authPolicy??n.auth_policy)??"",logoUrl:te((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:te(a==null?void 0:a.logo)??"",composerIconUrl:te((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:te((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:te((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:Lo(a==null?void 0:a.capabilities),defaultPrompt:Lo((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:Lo((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:Lo(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 jA(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:Zn(n.isAccessible??n.is_accessible)??!1,isEnabled:Zn(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Lo(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 $A(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,u])=>{const d=Ye(u);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 u=Ye(l);return{name:te(u==null?void 0:u.name)??"",title:te(u==null?void 0:u.title)??"",uri:te(u==null?void 0:u.uri)??"",description:te(u==null?void 0:u.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const u=Ye(l);return{name:te(u==null?void 0:u.name)??"",title:te(u==null?void 0:u.title)??"",uriTemplate:te((u==null?void 0:u.uriTemplate)??(u==null?void 0:u.uri_template))??"",description:te(u==null?void 0:u.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 sU(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 u of l){const d=aw(u,i);d&&r.push(d)}}return r}async function iU(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=aw(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(ow).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(LA).filter(a=>a!==null):[],mcpServers:Lo(r.mcpServers??r.mcp_servers)}}async function lU(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(ow).filter(o=>o!==null)}}async function uU(e){await st("plugin/uninstall",{pluginId:e})}async function cU(e,t){await st("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function dU(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=jA(s,r);i&&t.push(i),r+=1}n=te(a.nextCursor??a.next_cursor)}while(n);return t}async function fU(e,t){await st("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function hU(){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=$A(o);a&&e.push(a)}t=te(r.nextCursor??r.next_cursor)}while(t);return e}async function pU(){await st("config/mcpServer/reload",{})}async function mU(e){const t=await st("mcpServer/oauth/login",{name:e});return{authorizationUrl:te(t.authorizationUrl??t.authorization_url)??""}}async function gU(){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 vU(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 yU(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 wU(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 bU(){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 TU(){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 ug(e){const t=Ye(e);if(!t)return null;const n=Kt(t.usedPercent??t.used_percent);if(n===null)return null;const r=Kt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Kt(t.resetsAt??t.resets_at)}}function NA(e){const t=Ye(e);if(!t)return null;const n=Zn(t.hasCredits??t.has_credits),r=Zn(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:te(t.balance)}}function cg(e){const t=Ye(e);if(!t)return null;const n=ug(t.primary),r=ug(t.secondary),o=NA(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 sw(e){const t=Ye(e);if(!t)return null;const n=Ye(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=cg(n==null?void 0:n.codex);return r||cg(t.rateLimits??t.rate_limits)}const OA=100;function DA(){return OA}function FA(e){return Qx(e)}async function BA(e,t){await Xx({id:e,...t})}async function dg(){return Zx()}function UA(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():"",u=typeof i.path=="string"?i.path.trim():"";return l&&u?[{name:l,path:u}]:[]}):[],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():"",u=typeof i.path=="string"?i.path.trim():"",d=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&u&&d?[{label:l,path:u,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 iw(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=UA(s);return i?[i]:[]});a.length>0&&(t[o]=a)}return t}async function fg(){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 iw(n.data)}async function zA(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(iw(e))})).ok)throw new Error("Failed to save thread queue state")}async function HA(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=Zt(r,"Failed to connect Telegram bot");throw new Error(o)}}async function WA(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Zt(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 qA(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=Zt(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 GA(){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 Tc(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 VA(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function KA(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 YA(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function JA(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 QA(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function XA(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function ZA(){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 e_(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 t_(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 jf(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function n_(e,t){const n=jf(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 u=`/${[...r.slice(0,o+1),l,"SKILL.md"].join("/")}`;if(t.has(u))return{rootPath:u,rootName:l,isNested:u!==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 r_(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=>jf(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=n_(i.path,o),u=jf(i.path),m=!!(l!=null&&l.isNested&&o.has(l.rootPath))?l.rootPath:u,f=u===m,v=a.get(m),T={name:i.name,displayName:l&&m===l.rootPath?l.rootName:void 0,description:i.shortDescription||i.description||"",path:m,scope:i.scope,enabled:i.enabled,__hasRoot:f};if(!v){a.set(m,T);continue}if(v.enabled=v.enabled||i.enabled,!v.__hasRoot&&f){a.set(m,T);continue}!v.displayName&&T.displayName&&(v.displayName=T.displayName),!v.description&&T.description&&(v.description=T.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const o_=6e4;async function zu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),o_);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 a_(e){return e==="payment_required"?e:null}function s_(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function hg(e){const t=Ye(e);if(!t)return null;const n=Kt(t.usedPercent??t.used_percent);if(n===null)return null;const r=Kt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Kt(t.resetsAt??t.resets_at)}}function i_(e){const t=Ye(e);if(!t)return null;const n=Zn(t.hasCredits??t.has_credits),r=Zn(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:te(t.balance)}}function l_(e){const t=Ye(e);if(!t)return null;const n=hg(t.primary),r=hg(t.secondary),o=i_(t.credits);return!n&&!r&&!o?null:{limitId:te(t.limitId??t.limit_id),limitName:te(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:te(t.planType??t.plan_type)}}function lw(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:l_(r.quotaSnapshot),quotaUpdatedAtIso:te(r.quotaUpdatedAtIso),quotaStatus:i,quotaError:te(r.quotaError),unavailableReason:a_(r.unavailableReason)??(s_(te(r.quotaError))?"payment_required":null),isActive:Zn(r.isActive)??(a===n||o===t)}:null}function uw(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 u_(){const e=await st("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:Zn(e.enabled)??!1,clients:t.map(uw).filter(n=>n!==null)}}async function c_(){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 d_(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 f_(e){await st(e?"remoteControl/enable":"remoteControl/disable",{})}async function h_(){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 p_(){const e=await st("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(uw).filter(n=>n!==null)}async function m_(e){await st("remoteControl/client/revoke",{clientId:e})}async function g_(){try{const e=await st("account/rateLimits/read");return sw(e)}catch(e){throw lo(e,"Failed to load account rate limits","account/rateLimits/read")}}function Yc(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=>lw(a,n,r)).filter(a=>a!==null)}}async function v_(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Zt(t,"Failed to load accounts"));const n=Ye(t);return Yc(n==null?void 0:n.data)}async function pg(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Zt(t,"Failed to refresh accounts"));const n=Ye(t);return Yc(n==null?void 0:n.data)}async function y_(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Zt(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 w_(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(Zt(n,"Failed to complete Codex login"));const r=Ye(n);return Yc(r==null?void 0:r.data)}async function b_(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(Zt(n,"Failed to switch account"));const r=Ye(n),o=Ye(r==null?void 0:r.data),a=lw(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 T_(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(Zt(n,"Failed to remove account"));const r=Ye(n);return Yc(r==null?void 0:r.data)}let Hu=null,Ql=null;function k_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const i of a)typeof i=="string"&&i.length>0&&!s.includes(i)&&s.push(i);return s},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const i=typeof a=="string"?et(a):"";i.length>0&&typeof s=="string"&&(o[i]=s)}return{order:n(t.order).map(a=>et(a)),labels:o,active:n(t.active).map(a=>et(a)),projectOrder:n(t.projectOrder).map(a=>et(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,i=typeof s.id=="string"?s.id.trim():"";return i?[{id:i,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?et(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function nl(){return Ql?$f(Ql):(Hu||(Hu=S_().then(e=>(Ql=e,e)).finally(()=>{Hu=null})),$f(await Hu))}async function S_(){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 k_(n.data)}function $f(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 Eh(){Ql=null}async function C_(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:et(o.data.cwd),gitRoot:et(o.data.gitRoot)}}async function x_(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:et(r.data.cwd),gitRoot:et(r.data.gitRoot)}}async function I_(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 u=l,d=typeof u.value=="string"?u.value.trim():"",m=typeof u.label=="string"?u.label.trim():"";!d||i.has(d)||(i.add(d),s.push({value:d,label:m||d}))}return s}async function A_(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:[],u=[],d=new Set;for(const R of l){if(!R||typeof R!="object"||Array.isArray(R))continue;const E=R,N=typeof E.value=="string"?E.value.trim():"",W=typeof E.label=="string"?E.label.trim():"";!N||d.has(N)||(d.add(N),u.push({value:N,label:W||N,isCurrent:E.isCurrent===!0,isRemote:E.isRemote===!0}))}i&&!d.has(i)&&u.unshift({value:i,label:i,isCurrent:!0});const m=a.headSha,f=a.headSubject,v=a.headDate,T=a.gitRoot,S=cw(a.changedFiles);return{currentBranch:i,headSha:typeof m=="string"&&m.trim()?m.trim():null,headSubject:typeof f=="string"&&f.trim()?f.trim():null,headDate:typeof v=="string"&&v.trim()?v.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof T=="string"?et(T):"",options:u,changedFiles:S}}function cw(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){if(!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.path,s=typeof a=="string"?et(a.trim()):"";if(!s)continue;const i=o.status,l=typeof i=="string"?i.trim():"",u=o.label,d=typeof u=="string"&&u.trim()?u.trim():l;n.push({path:s,previousPath:typeof o.previousPath=="string"&&o.previousPath.trim()?et(o.previousPath.trim()):null,status:l,label:d,addedLineCount:typeof o.addedLineCount=="number"?o.addedLineCount:null,removedLineCount:typeof o.removedLineCount=="number"?o.removedLineCount:null})}return n}async function __(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?et(a.gitRoot):""}}async function P_(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 E_(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(u=>{if(!u||typeof u!="object"||Array.isArray(u))return[];const d=u,m=typeof d.sha=="string"?d.sha.trim():"",f=typeof d.shortSha=="string"?d.shortSha.trim():"",v=typeof d.subject=="string"?d.subject.trim():"",T=typeof d.date=="string"?d.date.trim():"";return!m||!f?[]:[{sha:m,shortSha:f,subject:v||f,date:T}]})}async function M_(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 u=l,d=typeof u.path=="string"?u.path:"",m=typeof u.previousPath=="string"&&u.previousPath.length>0?u.previousPath:null,f=typeof u.status=="string"?u.status.trim():"",v=typeof u.label=="string"?u.label.trim():"",T=typeof u.addedLineCount=="number"&&Number.isFinite(u.addedLineCount)?u.addedLineCount:null,S=typeof u.removedLineCount=="number"&&Number.isFinite(u.removedLineCount)?u.removedLineCount:null;return!d||!f?[]:[{path:d,previousPath:m,status:f,label:v||f,addedLineCount:T,removedLineCount:S}]})}async function R_(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?et(a.gitRoot):"",options:[],changedFiles:cw(a.changedFiles)}}async function Xd(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=$f(e)}async function Wu(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=Zt(r,"Failed to open project root");throw new Error(i)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?et(a.path):"";return Eh(),s}function L_(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function j_(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 $_(e,t){var d;const n=await fetch(L_(e));if(!n.ok){const m=await n.json().catch(()=>null),f="Failed to export project",v=Zt(m,f),T=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),S=v!==f?v:T?`Failed to export project: ${T}`:f;throw new Error(S)}const r=Number(n.headers.get("content-length")??""),o=Number.isFinite(r)&&r>0?r:null,a=j_(n,"project.zip"),s=(d=n.body)==null?void 0:d.getReader();if(!s){const m=await n.blob();return t==null||t({loaded:m.size,total:m.size||o}),{blob:m,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:o});;){const{done:m,value:f}=await s.read();if(m)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:o}))}const u=i.map(m=>{const f=new Uint8Array(m.byteLength);return f.set(m),f.buffer});return{blob:new Blob(u,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function N_(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 Ei(r);if(!r.ok){const l=Zt(o,"Failed to import project");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?et(s.path):"";return i&&Eh(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function mg(){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 O_(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 Ei(r);if(!r.ok){const l=Zt(o,"Failed to load local directories");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?et(s.path):"",parentPath:typeof s.parentPath=="string"?et(s.parentPath):"",entries:i.flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const u=l,d=typeof u.name=="string"?u.name.trim():"",m=typeof u.path=="string"?et(u.path):"";return d&&m?[{name:d,path:m}]:[]})}}async function kU(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),r=await Ei(n);if(!n.ok){const i=Zt(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,u=typeof l.path=="string"?et(l.path):"",d=typeof l.relativePath=="string"?l.relativePath.trim():"";return!u||!d?[]:[{path:u,relativePath:d,isDirectory:l.isDirectory===!0}]})}async function SU(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),r=await Ei(n);if(!n.ok){const i=Zt(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 D_(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Ei(t);if(!t.ok){const s=Zt(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.path=="string"?et(o.path):"";return a&&Eh(),a}async function F_(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 Ei(n);if(!n.ok){const s=Zt(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?et(a.path):""}async function B_(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 Ei(t);if(!t.ok){const s=Zt(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.cwd=="string"?et(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?et(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?et(o.workspaceRoot):""}}async function U_(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=Zt(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?et(a.path):""}}function z_(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:Kt(t.oldLine),newLine:Kt(t.newLine)}}function H_(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:Kt(t.addedLineCount)??0,removedLineCount:Kt(t.removedLineCount)??0,oldStart:Kt(t.oldStart),oldLineCount:Kt(t.oldLineCount)??0,newStart:Kt(t.newStart),newLineCount:Kt(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>z_(a)).filter(a=>a!==null):[]}:null}function W_(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:Kt(t.addedLineCount)??0,removedLineCount:Kt(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>H_(s)).filter(s=>s!==null):[]}}function dw(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:Zn(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:te(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>te(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:te(n==null?void 0:n.commitSha),headBranch:te(n==null?void 0:n.headBranch),mergeBaseSha:te(n==null?void 0:n.mergeBaseSha),generatedAtIso:te(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Kt(r==null?void 0:r.fileCount)??0,addedLineCount:Kt(r==null?void 0:r.addedLineCount)??0,removedLineCount:Kt(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>W_(i)).filter(i=>i!==null):[]}}function q_(e){const t=Ye(e),n=Ye(t==null?void 0:t.data);return{fileCount:Kt(n==null?void 0:n.fileCount)??0,addedLineCount:Kt(n==null?void 0:n.addedLineCount)??0,removedLineCount:Kt(n==null?void 0:n.removedLineCount)??0}}async function CU(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(Zt(i,"Failed to load review snapshot"));return dw(i)}async function G_(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(Zt(o,"Failed to load review summary"));return q_(o)}async function xU(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(Zt(n,"Failed to apply review action"));return dw(n)}async function IU(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(Zt(n,"Failed to initialize Git"))}async function V_(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 u=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:[u],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 K_(e,t,n){const r=await V_(e,t,n,"undo");return{reverted:r.changed,errors:r.errors}}const Y_={},J_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Q_(e,t){return _(),B("svg",J_,[...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 Ys=wt(Y_,[["render",Q_]]),X_={},Z_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function eP(e,t){return _(),B("svg",Z_,[...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 qu=wt(X_,[["render",eP]]),tP={},nP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function rP(e,t){return _(),B("svg",nP,[...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 Nf=wt(tP,[["render",rP]]),oP={},aP={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function sP(e,t){return _(),B("svg",aP,[...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 bl=wt(oP,[["render",sP]]),iP={},lP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function uP(e,t){return _(),B("svg",lP,[...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 Mh=wt(iP,[["render",uP]]),cP={},dP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function fP(e,t){return _(),B("svg",dP,[...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 hP=wt(cP,[["render",fP]]),pP={},mP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function gP(e,t){return _(),B("svg",mP,[...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 Jc=wt(pP,[["render",gP]]),fw="codex-web-local.ui-language.v1",vP={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":"编辑消息","Saving rolls this turn back and resends it with your changes. Later replies will be removed.":"保存后将回退此轮并以修改后的文本重发。之后的回复将被移除。",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy last code block":"复制最后一个代码块","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出",Today:"今天",Yesterday:"昨天","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查",Commit:"提交","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","No file changes in this commit.":"此提交中没有文件更改。","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads. Clear the search to see all threads.":"没有匹配的线程。清除搜索即可查看全部线程。","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads yet. Start a new thread to begin.":"还没有线程。新建一个线程即可开始。","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Yes:"是","Yes for Session":"本次会话内允许",pending:"条待处理","Do you want to run this command?":"是否运行此命令?","Do you want to make these changes?":"是否进行这些更改?","Do you want to grant these permissions?":"是否授予这些权限?","An MCP server needs your input before Codex can continue.":"MCP 服务器需要你的输入,Codex 才能继续。","Codex needs your answer before it can continue.":"Codex 需要你的回答才能继续。","Codex is waiting for a response before it can continue.":"Codex 正在等待你的回复,然后才能继续。",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作",Skill:"技能","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Ask Codex anything, @ to add files, / for commands":"向 Codex 提问,@ 添加文件,/ 执行命令",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑","Edit automation":"编辑自动化",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽",Hooks:"Hooks","Reload lifecycle hooks":"重新加载生命周期 Hooks","Hooks are not supported by this Codex version.":"当前 Codex 版本不支持 Hooks。","Loading hooks…":"加载 Hooks 中…","No hooks registered.":"未注册任何 Hooks。",Global:"全局",Enabled:"已启用","Compacting thread context…":"正在压缩上下文…","Context compacted":"上下文已压缩","Agent note":"代理注记","Approval policy":"审批策略","Choose when Codex asks for your permission before running commands or changing files.":"选择 Codex 在执行命令或修改文件前何时征求你的许可。","Only untrusted commands":"仅不受信任的命令","After a command fails":"命令失败后","When Codex requests it":"请求时",Never:"从不","Unless trusted":"除非信任",Default:"默认","Execution plans":"执行计划","Not supported by this Codex version":"当前 Codex 版本不支持","Remote control":"远程控制","Enable or disable remote control":"启用或禁用远程控制","Remote control is not supported by this Codex version.":"当前 Codex 版本不支持远程控制。","Pair a new device":"配对新设备","Generate code":"生成配对码","Paired devices":"已配对设备","No paired devices.":"暂无已配对设备。",Revoke:"撤销","Starting…":"启动中…","Add panel":"添加面板","Approval policy saved":"审批策略已保存",Automations:"自动化","Bearer token (optional)":"Bearer Token(可选)","Close panel":"关闭面板","Close side panel":"关闭侧边面板",Codex:"Codex",Compact:"压缩","Compacting…":"正在压缩…","Compacts context before send":"发送前压缩上下文","Auto-compact before send":"发送前自动压缩","Compacting context — the message will send after compaction":"正在压缩上下文——消息将在压缩完成后发送","Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.":"当剩余上下文占比等于或低于该百分比时,发送前先自动压缩上下文。0 表示关闭,退回服务端自动压缩。","Custom endpoint":"自定义端点","Failed to resolve model from custom endpoint; check the URL and try again":"无法从自定义端点获取模型,请检查 URL 后重试",Off:"关闭",Dismiss:"忽略",Download:"下载","Drag to reorder queued message":"拖动可重新排列排队消息","Exit full screen composer":"退出全屏输入框","Expand composer":"展开输入框","Explore Plugins & Apps":"探索插件与应用","Export Project":"导出项目",Exporting:"正在导出","Failed to share project. Use Download instead.":"项目分享失败,请改用下载。","Files panel":"文件面板","Filter files...":"筛选文件...",Git:"Git","Git panel":"Git 面板","Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.":"将 Codex 接入 Gmail、日历、GitHub、Slack、Browser Use 等应用,让它可以立即帮你处理实际工作。","Import Project":"导入项目","Importing…":"正在导入…","Issue detected":"发现问题","Loading files...":"加载文件中...","Loading…":"加载中…","New in Codex":"Codex 新功能","No files in workspace.":"工作区中没有文件。","No searchable directory for this thread":"此线程没有可搜索的目录","Open side panel":"打开侧边面板","OpenCode Zen":"OpenCode Zen",OpenRouter:"OpenRouter",Plugin:"插件","Plugins are here":"插件来了","Plugins, apps, MCPs":"插件、应用、MCP","Preparing project ZIP...":"正在准备项目 ZIP...","Preparing...":"正在准备...",Ready:"就绪",Repo:"仓库","Scheduled work":"定时任务",Search:"搜索","Search options...":"搜索选项...","Send feedback":"发送反馈",Share:"分享","Skills directory":"技能目录","Terminal panel":"终端面板","This browser blocked sharing the ZIP. Use Download instead.":"浏览器阻止了分享 ZIP,请改用下载。",User:"用户","sk-or-v1-... (optional, uses free keys if empty)":"sk-or-v1-...(可选,留空则使用免费 key)","File preview":"文件预览","Loading file…":"正在加载文件…","Failed to preview file":"文件预览失败","This file type cannot be previewed.":"此文件类型无法预览。","Open in browser":"在浏览器中打开","File is large; showing the first part.":"文件较大,仅显示开头部分。","Confirm delete":"确认删除",Confirm:"确认",Authenticated:"已认证",Failed:"失败","Logged in":"已登录",Unknown:"未知","No auth":"无需认证","No auth required":"无需认证","Connection required":"需要连接","Composio workspace":"Composio 工作区","Apps needing auth":"需要认证的应用","Plugin shares":"插件分享",Connector:"连接器",connected:"已连接",account:"个账户",accounts:"个账户",Manage:"管理",Reconnect:"重新连接",Connect:"连接",App:"应用",Plugins:"插件",Apps:"应用","Composio CLI shares the login and connections from this machine.":"Composio CLI 共享本机的登录状态与连接。","Bearer token":"Bearer Token","Login required":"需要登录","Auth unsupported":"不支持认证","Status unknown":"状态未知","OpenAI catalog":"OpenAI 目录","Ecosystem directory":"生态系统目录",Expired:"已过期",Pending:"待处理","Plugins make Codex work your way.":"插件让 Codex 按你的方式工作。","Connect Codex to external apps and services.":"将 Codex 连接到外部应用与服务。","Browse Composio connectors, auth state, and ready-to-try integrations.":"浏览 Composio 连接器、认证状态与可直接尝试的集成。","MCPs first, then installed skills and GitHub sync state.":"先看 MCP,再是已安装技能与 GitHub 同步状态。","Close plugin detail":"关闭插件详情","Close plugin shares":"关闭插件分享","Close Composio detail":"关闭 Composio 详情","Add another automation":"再添加一个自动化","New thread":"新建线程",methods:"个方法",Schedule:"计划",Daily:"每天",days:"天",Interval:"间隔","Run every day at":"每天运行时间","Run every":"每隔",Unit:"单位","Running…":"运行中…","Run now":"立即运行","Archive and remove":"归档并移除",Delete:"删除",'This will archive the thread "{title}" and remove the attached heartbeat automations.':"这将归档线程「{title}」并移除其关联的心跳自动化。",'This will archive the thread "{title}". You can find it later in archived threads.':"这将归档线程「{title}」。你之后可以在已归档线程中找到它。","Recycle bin":"回收站","Threads you removed are kept here so you can restore them.":"被移除的线程会保存在这里,你可以随时还原。","Recycle bin is empty.":"回收站是空的。",Restore:"还原","Restoring…":"还原中…","Delete permanently":"永久删除","Delete thread?":"删除线程?","Archive chat and remove automations?":"归档聊天并移除自动化?",active:"个进行中",added:"已新增","Add automation":"添加自动化","Add automation…":"添加自动化…",ago:"前","Answer the required field":"请填写必填字段",app:"应用",automations:"个自动化",cached:"缓存",changed:"已更改",Checkout:"检出","Checking out...":"检出中…","command:":"命令:","Context window":"上下文窗口","Copy path":"复制路径",Credits:"额度","cwd:":"工作目录:","day(s)":"天",deleted:"已删除",Detached:"已分离",edited:"已编辑",Edited:"已编辑",Every:"每","exitCode:":"退出码:","Failed to connect {name}":"连接 {name} 失败","Failed to start login for {name}":"为 {name} 启动登录失败","file changed":"个文件已更改","files changed":"个文件已更改","hour(s)":"小时",hours:"小时",Image:"图片",input:"输入","Last turn":"上一轮","Manage automations…":"管理自动化…","minute(s)":"分钟",minutes:"分钟",moved:"已移动","Network access":"网络访问",Next:"下次","Next run":"下次运行","Not scheduled":"未计划",RRULE:"规则","No login URL returned for {name}":"未返回 {name} 的登录链接","Opened {name} authorization":"已打开 {name} 授权",output:"输出",plugin:"插件","plugin installed":"插件已安装","plugin uninstalled":"插件已卸载",Preferred:"首选","Primary window":"主窗口","Project automation":"项目自动化",Read:"读取",reasoning:"推理","Removing...":"移除中…","resets in":"重置于","Resets in":"重置于","runs every":"每","Secondary window":"次窗口","Session total":"会话总计","Share this plugin":"共享此插件","Sharing...":"共享中…",Show:"显示","skill installed":"技能已安装","skill uninstalled":"技能已卸载","start new thread":"新建线程","status:":"状态:",total:"总计","Weekly refresh":"每周刷新",Write:"写入","Current branch":"当前分支","Credits available":"额度可用","Custom schedule":"自定义计划","Detached HEAD":"已分离 HEAD","Every minute":"每分钟",Hourly:"每小时","In context":"上下文内","Loading branch...":"加载分支中...","Rate limits":"速率限制","Resetting now":"正在重置",unlimited:"无限",Weekly:"每周",Window:"窗口","Automation details":"自动化详情","Automation run queued.":"自动化运行已排队。","Automation saved.":"自动化已保存。","Awaiting approval":"等待审批","Awaiting response":"等待响应",Branches:"分支",command:"个命令",commands:"个命令","Command approval required":"需要命令审批",Commits:"提交",Completed:"已完成","Copied commit ref":"已复制提交引用",Copied:"已复制",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成",Exit:"退出","Failed to delete project automation":"删除项目自动化失败","Failed to install skill":"安装技能失败","Failed to load automations":"加载自动化失败","Failed to load skills":"加载技能失败","Failed to remove automation":"移除自动化失败","Failed to run automation":"运行自动化失败","Failed to save automation":"保存自动化失败","Failed to search skills":"搜索技能失败","Failed to uninstall skill":"卸载技能失败","Failed to update file changes.":"更新文件变更失败。","Failed to update skill":"更新技能失败","File change approval required":"需要文件变更审批",Heartbeat:"心跳","Input required":"需要输入","Install completed but no local skill path was returned":"安装完成,但未返回本地技能路径","Install completed but the local skill was not found after refresh":"安装完成,但刷新后未找到本地技能","Install failed":"安装失败",Interrupted:"已中断","latest:":"最新:","Loading automations...":"加载自动化中...","Loading commits...":"加载提交中...","MCP server input required":"需要 MCP 服务器输入","Modified files":"修改的文件","New automation":"新自动化","No automations yet":"还没有自动化","No branches found.":"未找到分支。","No commits found.":"未找到提交。","No file changes.":"无文件更改。","No file changes to redo.":"没有可重做的文件变更。","No file changes to undo.":"没有可撤销的文件变更。","No messages in this thread yet. Type a message below to get started.":"此线程还没有消息。在下方输入消息即可开始。","Image attachment (preview unavailable)":"图片附件(无法预览)",now:"刚刚","Open this chat before copying":"请先打开此聊天再复制","Pin thread":"固定线程","Unpin thread":"取消固定线程",paused:"个已暂停","Permissions approval required":"需要权限审批",Project:"项目","Project automation requires a resolved absolute project path.":"项目自动化需要已解析的绝对项目路径。",Redo:"重做","Redo file changes?":"重做文件变更?","Redo the file changes from this turn? This reapplies the edits to the working tree.":"重做本轮的文件变更?这会重新将修改应用到工作树。",Redoing:"正在重做","Refreshing...":"刷新中...","Rejected from codex-web-local UI.":"已在 codex-web-local 界面中拒绝。","Rename project":"重命名项目",Reset:"重置","Reset-history refs":"重置历史引用",remote:"远程","Review Worktree Changes":"审查工作树更改","Review Worktree Changes (Open)":"审查工作树更改(打开)",Running:"运行中","Search commits...":"搜索提交...","Search skills":"搜索技能","Select a branch.":"请选择一个分支。","Select a chat target for this automation":"为此自动化选择一个聊天目标","Select a project target for this automation":"为此自动化选择一个项目目标",Stopped:"已停止","Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。","Output trimmed: {omitted} omitted of {total}.":"输出已截断:省略 {omitted}(共 {total})。","Show full output":"查看完整输出","Loading full output…":"正在加载完整输出…","Could not load the full output.":"无法加载完整输出。",Target:"目标","This creates a heartbeat automation attached to the selected chat.":"这会在所选聊天上创建一个心跳自动化。","This creates a project automation attached to the selected project folder.":"这会在所选项目文件夹上创建一个项目自动化。","This creates heartbeat automations attached to the selected thread.":"这会在所选线程上创建心跳自动化。","This creates project automations attached to the selected project folder.":"这会在所选项目文件夹上创建项目自动化。","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.":"请通过线程或项目菜单添加自动化。","Command palette":"命令面板","Type a command...":"输入命令…","No matching commands":"没有匹配的命令",Thread:"线程",Panel:"面板",View:"视图",Navigate:"导航","Open the Git panel":"打开 Git 面板","Open the files panel":"打开文件面板","Toggle the terminal panel":"切换终端面板","Toggle the side panel":"切换侧边面板","Close the side panel":"关闭侧边面板","Toggle the sidebar":"切换侧栏","Cycle the color theme":"循环切换主题","Cycle the chat width":"循环切换聊天宽度","Switch the interface language":"切换界面语言","Toggle send with Enter":"切换回车发送","Cycle the in-progress send mode":"循环切换进行中发送方式","Open the automations page":"打开自动化页面","Open the recycle bin":"打开回收站","Open settings":"打开设置","Copy the conversation as Markdown":"复制对话为 Markdown","Stop the running turn":"停止正在运行的轮次","Implement the current plan":"执行当前计划","Keyboard shortcuts":"键盘快捷键","Press Esc to close":"按 Esc 关闭",Composer:"输入框",Navigation:"导航","Open the command palette":"打开命令面板","Close dialogs and popovers":"关闭弹窗与浮层","Send the message":"发送消息",'When "send with Enter" is on':"当「回车发送」开启时",'When "send with Enter" is off':"当「回车发送」关闭时","Insert a line break":"插入换行","Open the slash command menu":"打开斜杠命令菜单","Mention a file":"提及文件","Move through the menu":"在菜单中移动","Accept the highlighted suggestion":"接受高亮的候选","Dismiss the menu":"关闭菜单","Move the selection":"移动选择","Activate the focused item":"激活当前项","Jump to the first or last item":"跳到第一项 / 最后一项"},gg={en:"English","zh-CN":"简体中文"};function yP(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(fw))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Qc=k(yP());function hw(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}hw(Qc.value);function wP(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function bP(e){Qc.value=e,hw(e),typeof window<"u"&&window.localStorage.setItem(fw,e)}function pw(e,t){const n=Qc.value==="zh-CN"?vP[e]??e:e;return wP(n,t)}function co(){return{uiLanguage:Qc,uiLanguageOptions:[{value:"en",label:gg.en},{value:"zh-CN",label:gg["zh-CN"]}],t:pw,setUiLanguage:bP}}const mw="brutalstrikedevs@gmail.com",TP=20,kP=6500,vg=1800,Zd=12,yg=240,wg=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,cl=k([]);let bg=!1,ef=!1,tf=null;function Wl(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 SP(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function CP(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 gw(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Tg(e){return encodeURIComponent(e)}function xP(){return`mailto:${mw}`}function IP(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
47
- `).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
48
-
49
- `).trim())??"";return e?e.length>vg?`${e.slice(0,vg)}
50
- ...[truncated]`:e:"No visible page text captured."}function AP(e,t){const n=t.replace(/\r\n/g,`
51
- `).replace(/[ \t]+/g," ").trim();return n?wg.test(e)||wg.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>yg?`${n.slice(0,yg)}...[truncated, ${n.length} chars total]`:n:""}function kg(e,t){if(!e)return`${t}: unavailable`;try{const n=[],r=Math.min(e.length,Zd);for(let a=0;a<r;a+=1){const s=e.key(a);s&&n.push(`${s}=${AP(s,e.getItem(s)??"")}`)}const o=e.length>Zd?`
52
- ...${e.length-Zd} more item(s)`:"";return`${t}:
53
- ${n.join(`
54
- `)||"empty"}${o}`}catch(n){return`${t}: unavailable (${gw(Wl(n))})`}}function _P(){return typeof window>"u"?"unknown":[`Path: ${window.location.pathname||"/"}`,`Hash: ${window.location.hash||"(none)"}`,`Search: ${window.location.search||"(none)"}`,`Online: ${typeof navigator>"u"?"unknown":String(navigator.onLine)}`,`Language: ${typeof navigator>"u"?"unknown":navigator.language}`,`Platform: ${typeof navigator>"u"?"unknown":navigator.platform}`,kg(window.localStorage,"localStorage"),kg(window.sessionStorage,"sessionStorage")].join(`
55
- `)}function bi(e){const t=e.message.trim();if(!t)return;const n=cl.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()};cl.value=[r,...cl.value].slice(0,TP)}function vw(e=cl.value){var u;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.134",a="codex-mobile",s=e.slice(0,12).map((d,m)=>[`${m+1}. [${d.atIso}] ${d.kind}`,d.method?`${d.method}`:"",d.url??"",typeof d.status=="number"?`${d.status} ${d.statusText??""}`.trim():"",d.message].filter(Boolean).join(" | ")).join(`
56
- `),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${r}`,`Viewport: ${t}`,`App version: ${o}`,`Worktree: ${a}`,"","Browser/app state",_P(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",IP()].join(`
57
- `).slice(0,kP),l=`Codex Web feedback: ${gw((u=e[0])==null?void 0:u.message)}`;return`mailto:${mw}?subject=${Tg(l)}&body=${Tg(i)}`}function PP(){typeof window>"u"||(window.location.href=vw())}function EP(){if(!(typeof window>"u")&&(bg||(bg=!0,window.addEventListener("error",e=>{bi({kind:"window-error",message:e.error?Wl(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{bi({kind:"unhandled-rejection",message:Wl(e.reason),url:window.location.href})})),!ef)){if(typeof window.fetch!="function"){bi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{tf=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=SP(e),r=CP(e,t);try{const o=await tf(e,t);return o.ok||bi({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 bi({kind:"fetch-error",message:Wl(o),url:n,method:r}),o}},ef=!0}catch(e){tf=null,ef=!1;try{bi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${Wl(e)}`,url:window.location.href})}catch{}}}}function yw(){const e=G(()=>cl.value.length>0);function t(n,r){bi({kind:"visible-error",message:n,url:r||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:cl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:PP,buildFeedbackMailto:vw,feedbackMailtoBase:xP}}const ww="codex-web-local.recycle-bin.v1";function bw(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ww);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 Sg(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ww,JSON.stringify(e))}catch{}}const qa=k(bw());function MP(){function e(){qa.value=bw()}function t(o){qa.value=[{...o,archivedAtIso:new Date().toISOString()},...qa.value.filter(a=>a.id!==o.id)],Sg(qa.value)}function n(o){qa.value=qa.value.filter(a=>a.id!==o),Sg(qa.value)}async function r(o){if(!qa.value.some(a=>a.id===o))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await fA(o),n(o),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:qa,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:r}}function Cg(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function RP(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,Cg(s)>Cg(o[i])&&(o[i]=s)}return o.length===r.threads.length?r:{...r,threads:o}});return t?n:e}const LP=["title","aria-label","disabled"],jP={key:1,class:"composer-dropdown-value"},$P={key:0,class:"composer-dropdown-search-wrap"},NP=["placeholder","onKeydown"],OP={class:"composer-dropdown-options",role:"listbox"},DP=["onClick"],FP={key:0,class:"composer-dropdown-empty"},BP=hn({__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=k(null),a=k(null),s=k(null),i=k(null),l=k(!1),u=k(""),d=k({});let m=!1;const f=G(()=>{var Ae;const ne=n.options.find(De=>De.value===n.modelValue);return ne?ne.label:((Ae=n.placeholder)==null?void 0:Ae.trim())||""}),v=G(()=>n.openDirection??"down"),T=G(()=>n.menuAlign??"start"),S=G(()=>n.iconOnly===!0),R=G(()=>n.enableSearch===!0),E=G(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),N=G(()=>{var ne;return((ne=n.searchPlaceholder)==null?void 0:ne.trim())||"Quick search projects"}),W=G(()=>{var ne;return((ne=n.emptyLabel)==null?void 0:ne.trim())||"No results"}),L=G(()=>{var ne;return f.value||((ne=n.placeholder)==null?void 0:ne.trim())||"Select option"}),fe=G(()=>{const ne=u.value.trim().toLowerCase();return ne?n.options.filter(Ae=>Ae.label.toLowerCase().includes(ne)||Ae.value.toLowerCase().includes(ne)):n.options});function le(){n.disabled||(l.value=!l.value)}function Y(ne,Ae,De){return Math.min(De,Math.max(Ae,ne))}function ie(){var oe,se,Le,We;if(!l.value)return;const ne=o.value;if(!ne||typeof window>"u")return;const Ae=ne.getBoundingClientRect(),De=window.innerWidth,$e=window.innerHeight,je=8,Ce=8,Se=Math.max(0,De-je*2),xe=((oe=s.value)==null?void 0:oe.offsetWidth)??((se=a.value)==null?void 0:se.offsetWidth)??224,Ee=((Le=s.value)==null?void 0:Le.offsetHeight)??((We=a.value)==null?void 0:We.offsetHeight)??0,Je=Math.min(xe,Se),Xe=Math.max(je,De-Je-je),lt=T.value==="end"?Ae.right-Je:Ae.left,ce=Y(lt,je,Xe);let F=v.value==="up"?Ae.top-Ee-Ce:Ae.bottom+Ce;Ee>0&&F+Ee>$e-je&&(F=$e-Ee-je),F=Math.max(je,F),d.value={position:"fixed",left:`${ce}px`,right:"auto",top:`${F}px`,bottom:"auto",width:`${Je}px`}}function we(){m||typeof window>"u"||(window.addEventListener("resize",ie),window.addEventListener("scroll",ie,!0),m=!0)}function Pe(){!m||typeof window>"u"||(window.removeEventListener("resize",ie),window.removeEventListener("scroll",ie,!0),m=!1)}function ye(ne){r("update:modelValue",ne),l.value=!1,u.value=""}function ee(){if(u.value.length>0){u.value="";return}l.value=!1}function ve(ne){if(!l.value)return;const Ae=o.value;if(!Ae)return;const De=ne.target;De instanceof Node&&(Ae.contains(De)||(l.value=!1,u.value=""))}return tt(l,ne=>{if(!ne){Pe(),d.value={};return}we(),Mt(()=>{var Ae;ie(),window.requestAnimationFrame(ie),R.value&&((Ae=i.value)==null||Ae.focus())})}),ss(()=>{window.addEventListener("pointerdown",ve)}),ti(()=>{window.removeEventListener("pointerdown",ve),Pe()}),(ne,Ae)=>(_(),B("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[w("button",{class:ct(["composer-dropdown-trigger",E.value]),type:"button",title:L.value,"aria-label":L.value,disabled:e.disabled,onClick:le},[e.selectedPrefixIcon?(_(),Ze(hh(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):pe("",!0),S.value?pe("",!0):(_(),B("span",jP,D(f.value),1)),Fe(Ys,{class:"composer-dropdown-chevron"})],10,LP),l.value?(_(),B("div",{key:0,ref_key:"menuWrapRef",ref:a,class:ct(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":v.value==="up","composer-dropdown-menu-wrap-down":v.value==="down"}]),style:oo(d.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[R.value?(_(),B("div",$P,[_n(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":Ae[0]||(Ae[0]=De=>u.value=De),class:"composer-dropdown-search-input",type:"text",placeholder:N.value,onKeydown:Tr(pt(ee,["prevent"]),["esc"])},null,40,NP),[[Ln,u.value]])])):pe("",!0),w("ul",OP,[(_(!0),B(rt,null,Wt(fe.value,De=>(_(),B("li",{key:De.value},[w("button",{class:ct(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:$e=>ye(De.value)},D(De.label),11,DP)]))),128)),fe.value.length===0?(_(),B("li",FP,D(W.value),1)):pe("",!0)])],512)],6)):pe("",!0)],512))}}),Ai=wt(BP,[["__scopeId","data-v-58b5aa2e"]]),UP={},zP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function HP(e,t){return _(),B("svg",zP,[...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 kc=wt(UP,[["render",HP]]),WP=["aria-label","onKeydown"],qP={class:"app-dialog-header"},GP={class:"app-dialog-title-wrap"},VP={class:"app-dialog-title"},KP={key:0,class:"app-dialog-subtitle"},YP=["aria-label","title"],JP={class:"app-dialog-body"},QP={key:0,class:"app-dialog-footer"},XP=hn({__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}=co();function a(){r("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return tt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),ti(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(_(),Ze(Qs,{to:"body"},[e.open?(_(),B("div",{key:0,class:"app-dialog-overlay",onClick:pt(a,["self"])},[w("div",{class:ct(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Tr(pt(a,["prevent"]),["esc"])},[w("div",qP,[w("div",GP,[w("h3",VP,D(e.title),1),e.subtitle?(_(),B("p",KP,D(e.subtitle),1)):pe("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":g(o)("Close"),title:g(o)("Close"),onClick:a},[Fe(kc,{class:"app-dialog-close-icon"})],8,YP)]),w("div",JP,[kr(i.$slots,"default",{},void 0)]),i.$slots.footer?(_(),B("div",QP,[kr(i.$slots,"footer",{},void 0)])):pe("",!0)],42,WP)])):pe("",!0)]))}}),nf=wt(XP,[["__scopeId","data-v-3405af9b"]]),ZP={key:0,class:"sidebar-menu-row-left"},e1={class:"sidebar-menu-row-main"},t1={key:1,class:"sidebar-menu-row-right"},n1={key:0,class:"sidebar-menu-row-right-default"},r1={key:1,class:"sidebar-menu-row-right-hover"},o1=hn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=uS(),r=G(()=>!!n.left),o=G(()=>!!n.right),a=G(()=>!!n["right-hover"]),s=G(()=>o.value||a.value);return(i,l)=>(_(),Ze(hh(t.as),yh({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:ft(()=>[r.value?(_(),B("span",ZP,[kr(i.$slots,"left",{},void 0,!0)])):pe("",!0),w("span",e1,[kr(i.$slots,"default",{},void 0,!0)]),s.value?(_(),B("span",t1,[o.value?(_(),B("span",n1,[kr(i.$slots,"right",{},void 0,!0)])):pe("",!0),a.value?(_(),B("span",r1,[kr(i.$slots,"right-hover",{},void 0,!0)])):pe("",!0)])):pe("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Us=wt(o1,[["__scopeId","data-v-06eaad4c"]]),a1={},s1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function i1(e,t){return _(),B("svg",s1,[...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 Sc=wt(a1,[["render",i1]]),l1={},u1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function c1(e,t){return _(),B("svg",u1,[...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 Tw=wt(l1,[["render",c1]]),d1=["data-menu-open"],f1={class:"thread-left-stack"},h1=["data-state"],p1=["data-confirming","title"],m1={key:0,class:"thread-delete-confirm-label"},g1=["title"],v1={class:"thread-row-title-wrap"},y1={class:"thread-row-title-line"},w1={class:"thread-row-title"},b1={key:0,class:"thread-row-originator"},T1=["title"],k1={key:0,class:"thread-row-automation-count"},S1=["data-state"],C1={class:"thread-row-time"},x1=hn({__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=G(()=>n.thread.originator?`${n.thread.originator}`:"");function a(s){n.setMenuWrapRef(s instanceof HTMLDivElement?s:null)}return(s,i)=>(_(),B("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Fe(Us,{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:ft(()=>[w("span",f1,[n.showStatusIndicator?(_(),B("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,h1)):pe("",!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]=pt(l=>r("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(_(),B("span",m1,D(n.confirmLabel),1)):(_(),Ze(Tw,{key:1,class:"thread-icon"}))],8,p1)])]),right:ft(()=>[w("span",C1,D(n.relativeTime),1)]),"right-hover":ft(()=>[w("div",{ref:a,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:i[2]||(i[2]=pt(l=>r("menu-toggle"),["stop"]))},[Fe(Nf,{class:"thread-icon"})])])]),default:ft(()=>[w("button",{class:"thread-main-button",type:"button",title:o.value,onClick:i[1]||(i[1]=pt(l=>r("select"),["stop"]))},[w("span",v1,[w("span",y1,[w("span",w1,D(n.thread.title),1),n.thread.originator?(_(),B("span",b1,D(n.thread.originator),1)):pe("",!0),n.thread.hasWorktree?(_(),Ze(Sc,{key:1,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):pe("",!0),n.automationCount>0?(_(),B("span",{key:2,class:"thread-row-automation-chip",title:n.automationTooltip},[Fe(Jc,{class:"thread-row-automation-icon"}),n.automationCount>1?(_(),B("span",k1,D(n.automationCount),1)):pe("",!0)],8,T1)):pe("",!0),n.thread.pendingRequestState?(_(),B("span",{key:3,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},D(n.requestLabel),9,S1)):pe("",!0)])])],8,g1)]),_:1},8,["data-thread-id","data-active","data-live","data-pinned","data-menu-open","force-right-hover"])],8,d1))}}),Gu=wt(x1,[["__scopeId","data-v-d01c8f46"]]);function I1(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}function A1(e){const{getGroups:t,t:n}=e,r=k({}),o=k({}),a=k(!1),s=k("thread"),i=k(""),l=k(""),u=k(""),d=k("create"),m=k(!1),f=k("thread"),v=k(""),T=k(""),S=k(""),R=k(""),E=k(!1),N=k(!1),W=k({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),L=k({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),fe=G(()=>{if(s.value==="project"){const de=l.value;return de?o.value[de]??[]:[]}const J=i.value;return J?r.value[J]??[]:[]}),le=G(()=>ce(W.value.rrule)),Y=G(()=>m.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=G(()=>{var de;const J=[];for(const ke of t())for(const Be of ke.threads){const vt=((de=Be.title)==null?void 0:de.trim())||Be.id,yt=e.getProjectDisplayName(ke.projectName);J.push({value:Be.id,label:`${vt} · ${yt}`,searchText:`${vt} ${yt} ${Be.id}`.toLowerCase()})}return J}),we=G(()=>{const J=[];for(const de of t()){const ke=e.getProjectAutomationKey(de.projectName);if(!ke)continue;const Be=e.getProjectDisplayName(de.projectName);J.push({value:ke,label:Be,searchText:`${Be} ${ke}`.toLowerCase()})}return J}),Pe=G(()=>(f.value==="project"?we.value:ie.value).map(de=>({value:de.value,label:de.label}))),ye=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],ee=G(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);tt(Pe,J=>{var de;m.value&&(J.some(ke=>ke.value===v.value)||(v.value=((de=J[0])==null?void 0:de.value)??""))});function ve(J){var de;return((de=r.value[J])==null?void 0:de.length)??0}function ne(J){return ve(J)>0}function Ae(J){var ke;const de=e.getProjectAutomationKey(J);return de?((ke=o.value[de])==null?void 0:ke.length)??0:0}function De(J){return Ae(J)>0}function $e(J){if(J.length===0)return"";if(J.length>1){const Be=J.filter(vt=>vt.status==="ACTIVE").length;return`${J.length} ${n("automations")} • ${Be} ${n("active")}`}const[de]=J,ke=de.status==="PAUSED"?"-":de.nextRunAtMs?new Date(de.nextRunAtMs).toLocaleString():n("Not scheduled");return`${de.name} • ${n("Next run")}: ${ke}`}function je(J){return $e(r.value[J]??[])}function Ce(J){const de=e.getProjectAutomationKey(J);return $e(de?o.value[de]??[]:[])}function Se(J){return String(Math.max(0,J)).padStart(2,"0")}function xe(J,de){const ke=typeof J=="number"?J:Number(J);return Number.isFinite(ke)?Math.max(1,Math.floor(ke)):de}function Ee(J){const[de,ke]=J.split(":"),Be=Math.min(23,Math.max(0,Number(de)||0)),vt=Math.min(59,Math.max(0,Number(ke)||0));return`FREQ=DAILY;BYHOUR=${Be};BYMINUTE=${vt}`}function Je(J,de){const ke=xe(J,1);return de==="minutes"?`FREQ=MINUTELY;INTERVAL=${ke}`:de==="hours"?`FREQ=HOURLY;INTERVAL=${ke}`:`FREQ=DAILY;INTERVAL=${ke}`}function Xe(J){return Object.fromEntries(J.split(";").map(de=>de.trim()).filter(Boolean).map(de=>{const[ke,...Be]=de.split("=");return[ke.toUpperCase(),Be.join("=").trim()]}).filter(([de,ke])=>de&&ke))}function lt(J){var vt;const de=Xe(J),ke=(vt=de.FREQ)==null?void 0:vt.toUpperCase(),Be=xe(de.INTERVAL,1);if(ke==="DAILY"&&de.BYHOUR!==void 0&&de.BYMINUTE!==void 0&&Be===1){const yt=Math.min(23,Math.max(0,Number(de.BYHOUR)||0)),Bt=Math.min(59,Math.max(0,Number(de.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Se(yt)}:${Se(Bt)}`,interval:1,intervalUnit:"hours"}}return ke==="MINUTELY"||ke==="HOURLY"||ke==="DAILY"&&de.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Be,intervalUnit:ke==="MINUTELY"?"minutes":ke==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function ce(J){var vt;const de=Xe(J),ke=(vt=de.FREQ)==null?void 0:vt.toUpperCase(),Be=xe(de.INTERVAL,1);if(ke==="DAILY"&&de.BYHOUR!==void 0&&de.BYMINUTE!==void 0&&Be===1){const yt=Math.min(23,Math.max(0,Number(de.BYHOUR)||0)),Bt=Math.min(59,Math.max(0,Number(de.BYMINUTE)||0));return`${n("RRULE")}: ${J} · ${n("runs daily at")} ${Se(yt)}:${Se(Bt)}`}return ke==="MINUTELY"?`${n("RRULE")}: ${J} · ${n("runs every")} ${Be} ${n("minute(s)")}`:ke==="HOURLY"?`${n("RRULE")}: ${J} · ${n("runs every")} ${Be} ${n("hour(s)")}`:ke==="DAILY"&&de.INTERVAL!==void 0?`${n("RRULE")}: ${J} · ${n("runs every")} ${Be} ${n("day(s)")}`:J?`${n("RRULE")}: ${J}`:n("RRULE is required.")}function F(){const J=L.value;J.mode==="daily"?W.value.rrule=Ee(J.dailyTime):J.mode==="interval"&&(W.value.rrule=Je(J.interval,J.intervalUnit))}function oe(J){J!=="minutes"&&J!=="hours"&&J!=="days"||(L.value={...L.value,intervalUnit:J},F())}function se(J){J!=="ACTIVE"&&J!=="PAUSED"||(W.value={...W.value,status:J})}function Le(){L.value=lt(W.value.rrule)}function We(J){L.value={...L.value,mode:J},F()}function P(J){var ke;s.value="thread",i.value=J,l.value="",m.value=!1,T.value="",S.value="";const de=(ke=r.value[J])==null?void 0:ke[0];de?_e(de.id):ae(),a.value=!0,e.closeThreadMenu()}function $(J){var Be;const de=e.getProjectAutomationKey(J);if(!de){s.value="project",i.value="",l.value="",m.value=!1,T.value=n("Project automation requires a resolved absolute project path."),S.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=de,m.value=!1,T.value="",S.value="";const ke=(Be=o.value[de])==null?void 0:Be[0];ke?_e(ke.id):ae(),a.value=!0,e.closeProjectMenu()}function q(J){s.value=J.scope,i.value=J.scope==="thread"?J.target:"",l.value=J.scope==="project"?J.target:"",m.value=!1,T.value="",S.value="",J.scope==="project"?o.value=qe(o.value,J.target,J.automation):r.value=he(r.value,J.target,J.automation),_e(J.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ue(){var J;m.value=!0,f.value="thread",v.value=((J=ie.value[0])==null?void 0:J.value)??"",s.value="thread",i.value="",l.value="",T.value="",S.value="",ae(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function re(J){var de;f.value=J,v.value="",s.value=J==="project"?"project":"thread",v.value=((de=Pe.value[0])==null?void 0:de.value)??""}function ae(){u.value="",d.value="create",T.value="",S.value="",W.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},L.value=lt(W.value.rrule)}function _e(J){const de=fe.value.find(ke=>ke.id===J);de&&(u.value=de.id,d.value="edit",T.value="",S.value="",W.value={name:de.name,prompt:de.prompt,rrule:de.rrule,status:de.status},L.value=lt(de.rrule))}function Ne(){a.value=!1,s.value="thread",i.value="",l.value="",u.value="",T.value="",S.value="",E.value=!1,N.value=!1}function Ie(J,de){return Object.fromEntries(Object.entries(J).filter(([ke])=>ke!==de))}function he(J,de,ke){const Be=J[de]??[],vt=Be.findIndex(Bt=>Bt.id===ke.id),yt=[...Be];return vt>=0?yt.splice(vt,1,ke):yt.push(ke),{...J,[de]:yt}}function Ke(J,de,ke){const Be=(J[de]??[]).filter(vt=>vt.id!==ke);return Be.length>0?{...J,[de]:Be}:Ie(J,de)}function Oe(J,de){return Object.fromEntries(Object.entries(J).filter(([ke])=>ke!==de))}function qe(J,de,ke){const Be=J[de]??[],vt=Be.findIndex(Bt=>Bt.id===ke.id),yt=[...Be];return vt>=0?yt.splice(vt,1,ke):yt.push(ke),{...J,[de]:yt}}async function Ge(){o.value=await tI()}async function dt(J){await Ym(J).catch(()=>{}),r.value=Ie(r.value,J)}async function bt(){let J=i.value,de=l.value;E.value=!0,T.value="",S.value="";try{if(F(),m.value&&d.value==="create"&&(f.value==="thread"?(J=v.value,de="",s.value="thread",i.value=J,l.value=""):(de=v.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 ke={id:u.value||void 0,name:W.value.name,prompt:W.value.prompt,rrule:W.value.rrule,status:W.value.status},Be=s.value==="project"?await rI({...ke,projectName:de}):await nI({...ke,threadId:J});s.value==="project"?await Ge():r.value=he(r.value,J,Be),e.onAutomationsChanged(),_e(Be.id),S.value=n("Automation saved."),E.value=!1}catch(ke){T.value=ke instanceof Error?ke.message:n("Failed to save automation"),E.value=!1}}async function ot(){const J=i.value,de=l.value,ke=u.value;if(ke&&!(s.value==="thread"&&!J)&&!(s.value==="project"&&!de)){E.value=!0,T.value="",S.value="";try{s.value==="project"?(await Vy(de,ke),await Ge()):(await Ym(J,ke),r.value=Ke(r.value,J,ke));const Be=fe.value[0];Be?_e(Be.id):ae(),e.onAutomationsChanged(),E.value=!1}catch(Be){T.value=Be instanceof Error?Be.message:n("Failed to remove automation"),E.value=!1}}}async function ut(){const J=i.value,de=u.value;if(!(!J||!de)){N.value=!0,T.value="",S.value="";try{await oI(J,de),S.value=n("Automation run queued.")}catch(ke){T.value=ke instanceof Error?ke.message:n("Failed to run automation")}finally{N.value=!1}}}return{automationByThreadId:r,automationByProjectName:o,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:u,automationDialogMode:d,automationTargetPickerVisible:m,automationTargetMode:f,automationTargetValue:v,automationDialogError:T,automationDialogNotice:S,projectAutomationActionError:R,isSavingAutomation:E,isRunningAutomation:N,automationDraft:W,automationScheduleDraft:L,automationDialogAutomations:fe,automationSchedulePreview:le,automationDialogSubtitle:Y,automationThreadTargetOptions:ie,automationProjectTargetOptions:we,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:ye,automationStatusOptions:ee,threadAutomationCount:ve,threadHasAutomation:ne,projectAutomationCount:Ae,projectHasAutomation:De,threadAutomationTooltip:je,projectAutomationTooltip:Ce,syncAutomationRruleFromScheduleDraft:F,onAutomationIntervalUnitChange:oe,onAutomationStatusChange:se,syncAutomationScheduleDraftFromRrule:Le,setAutomationScheduleMode:We,openAutomationDialog:P,openProjectAutomationDialog:$,openAutomationEditorFromPanel:q,openAutomationCreatorFromPanel:ue,setAutomationTargetMode:re,startNewAutomationDraft:ae,selectAutomationForEditing:_e,closeAutomationDialog:Ne,omitAutomationProject:Oe,reloadProjectAutomations:Ge,removeAutomationsForThread:dt,submitAutomationDialog:bt,onDeleteAutomationFromDialog:ot,onRunAutomationFromDialog:ut}}const _1=4,xg=6;function P1(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 E1(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:r,isCollapsed:o,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=k(null),u=k(null),d=k(null);let m=null,f=null;const v=k(""),T=k({}),S=new Map,R=new WeakMap,E=typeof window<"u"?new ResizeObserver(ce=>{for(const F of ce){const oe=F.target,se=R.get(oe);se&&W(se,oe)}}):null,N=()=>{var ce,F;return((ce=d.value)==null?void 0:ce.projectName)??((F=u.value)==null?void 0:F.projectName)??""};function W(ce,F){const oe=F.getBoundingClientRect().height;if(!Number.isFinite(oe)||oe<=0)return;const se=T.value[ce];se!==void 0&&Math.abs(se-oe)<.5||(T.value={...T.value,[ce]:oe})}function L(ce,F){const oe=S.get(ce);oe&&oe!==F&&E&&E.unobserve(oe);const se=F instanceof HTMLElement?F:F&&"$el"in F&&F.$el instanceof HTMLElement?F.$el:null;if(se){S.set(ce,se),R.set(se,ce),W(ce,se),E==null||E.observe(se);return}oe&&(E==null||E.unobserve(oe)),S.delete(ce)}function fe(ce){const F=T.value[ce]??0,oe=d.value,Le=((oe==null?void 0:oe.projectName)===ce?oe.groupHeight:null)??F,We=o(ce)?0:xg;return Math.max(0,Le+We)}const le=G(()=>{const ce=d.value;return ce?P1(ce.dropTargetIndexFull,ce.fromIndex,t().length):null}),Y=G(()=>{const F=(r()?n():t()).map(P=>P.projectName),oe=d.value,se=le.value;if(!oe||se===null)return F;const Le=[...F],[We]=Le.splice(oe.fromIndex,1);return We?(Le.splice(se,0,We),Le):F}),ie=G(()=>{const ce={};let F=0;for(const oe of Y.value)ce[oe]=F,F+=fe(oe);return ce}),we=G(()=>{let ce=0;for(const F of Y.value)ce+=fe(F);return{height:`${Math.max(0,ce)}px`}});function Pe(ce,F){if(ce.button!==0||r()||u.value||d.value)return;const se=t().findIndex($=>$.projectName===F),Le=S.get(F);if(se<0||!Le)return;const We=Le.getBoundingClientRect(),P=o(F)?0:xg;u.value={projectName:F,fromIndex:se,startClientX:ce.clientX,startClientY:ce.clientY,pointerOffsetY:ce.clientY-We.top,groupLeft:We.left,groupWidth:We.width,groupHeight:We.height,groupOuterHeight:We.height+P},ce.preventDefault(),ye()}function ye(){window.addEventListener("mousemove",ve),window.addEventListener("mouseup",ne),window.addEventListener("keydown",Ae)}function ee(){window.removeEventListener("mousemove",ve),window.removeEventListener("mouseup",ne),window.removeEventListener("keydown",Ae)}function ve(ce){m={clientX:ce.clientX,clientY:ce.clientY},$e()}function ne(ce){je({clientX:ce.clientX,clientY:ce.clientY});const F=d.value;if(F&&le.value!==null){const oe=t().findIndex(se=>se.projectName===F.projectName);if(oe>=0){const se=le.value;se!==oe&&s(F.projectName,se)}}De({preserveToggleSuppression:!!F})}function Ae(ce){ce.key==="Escape"&&(!u.value&&!d.value||(ce.preventDefault(),De()))}function De(ce={}){f!==null&&(window.cancelAnimationFrame(f),f=null),m=null,u.value=null,d.value=null,ce.preserveToggleSuppression||(v.value=""),ee()}function $e(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!m)return;const ce=m;m=null,je(ce)}))}function je(ce){const F=u.value;if(!d.value&&F){const oe=ce.clientX-F.startClientX,se=ce.clientY-F.startClientY;if(Math.hypot(oe,se)<_1)return;i(),v.value=F.projectName,d.value={projectName:F.projectName,fromIndex:F.fromIndex,pointerOffsetY:F.pointerOffsetY,groupLeft:F.groupLeft,groupWidth:F.groupWidth,groupHeight:F.groupHeight,groupOuterHeight:F.groupOuterHeight,ghostTop:ce.clientY-F.pointerOffsetY,dropTargetIndexFull:null}}d.value&&Ce(ce)}function Ce(ce){const F=d.value;if(!F)return;if(F.ghostTop=ce.clientY-F.pointerOffsetY,!Se(ce)){F.dropTargetIndexFull=null;return}const oe=ce.clientY,se=l.value;if(!se){F.dropTargetIndexFull=null;return}const Le=t(),We=se.getBoundingClientRect(),P=new Map(Le.map((re,ae)=>[re.projectName,ae])),$=Le.map(re=>re.projectName).filter(re=>re!==F.projectName);let q=0,ue=Le.length;for(const re of $){const ae=P.get(re);if(ae===void 0)continue;const _e=fe(re),Ne=We.top+q+_e/2;if(oe<Ne){ue=ae;break}q+=_e}F.dropTargetIndexFull=ue}function Se(ce){const F=l.value;if(!F)return!1;const oe=F.getBoundingClientRect(),se=ce.clientX>=oe.left&&ce.clientX<=oe.right,Le=ce.clientY>=oe.top-32&&ce.clientY<=oe.bottom+32;return se&&Le}function xe(ce){var F;return((F=d.value)==null?void 0:F.projectName)===ce}function Ee(ce){const F=d.value,oe=ie.value[ce]??0,se=a()===ce;return!F||F.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:`${F.groupLeft}px`,width:`${F.groupWidth}px`,height:`${F.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${F.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Je(ce){return v.value===ce?(v.value="",!0):!1}function Xe(ce){const F=N();F&&!ce.includes(F)&&De();const oe=new Set(ce),se=Object.fromEntries(Object.entries(T.value).filter(([Le])=>oe.has(Le)));Object.keys(se).length!==Object.keys(T.value).length&&(T.value=se)}function lt(){for(const ce of S.values())E==null||E.unobserve(ce);S.clear(),De()}return{groupsContainerRef:l,groupsContainerStyle:we,setProjectGroupRef:L,isDraggingProject:xe,projectGroupStyle:Ee,onProjectHandleMouseDown:Pe,takeToggleSuppression:Je,pruneProjectGroups:Xe,dispose:lt}}const M1={key:0,class:"pinned-section"},R1={class:"thread-tree-header"},L1={key:0,class:"thread-list"},j1={class:"projects-section"},$1={class:"thread-tree-header"},N1=["aria-expanded","aria-label","title"],O1={class:"organize-menu-title"},D1=["data-active"],F1={key:0},B1=["data-active"],U1={key:0},z1=["data-active"],H1={key:0},W1={class:"organize-menu-title"},q1=["data-active"],G1={key:0},V1=["data-active"],K1={key:0},Y1={key:0,class:"thread-tree-action-error"},J1={key:1,class:"thread-tree-no-results"},Q1={key:2,class:"thread-tree-loading"},X1={key:3,class:"thread-list thread-list-global"},Z1=["data-project-name","data-expanded","data-dragging"],eE={class:"project-icon-stack"},tE={class:"project-icon-folder"},nE={class:"project-icon-chevron"},rE=["data-dragging-handle","onMousedown"],oE=["title"],aE=["title"],sE={key:0,class:"thread-row-automation-count"},iE={class:"project-hover-controls"},lE=["onClick"],uE=["data-open-direction"],cE=["onClick"],dE=["onClick"],fE=["onClick"],hE=["onClick"],pE=["onClick"],mE=["onClick"],gE={class:"project-menu-label"},vE=["onInput"],yE=["aria-label","title","onClick"],wE={key:0,class:"thread-list"},bE={class:"project-empty"},TE=["onClick"],kE={class:"chats-section"},SE={class:"thread-tree-header"},CE={class:"chats-section-actions"},xE=["aria-label","title"],IE={key:0,class:"thread-tree-no-results"},AE={key:1,class:"thread-list thread-list-global"},_E=["data-open-direction"],PE=["disabled","title"],EE=["placeholder","onKeydown"],ME={class:"recycle-bin-content"},RE={key:0,class:"recycle-bin-empty"},LE={key:1,class:"recycle-bin-list"},jE={class:"recycle-bin-item-copy"},$E={class:"recycle-bin-item-title"},NE={key:0,class:"recycle-bin-item-meta"},OE={class:"recycle-bin-item-time"},DE={class:"recycle-bin-item-actions"},FE=["disabled","onClick"],BE=["onClick"],UE={key:2,class:"recycle-bin-error",role:"alert"},zE=["aria-label"],HE={class:"rename-thread-title"},WE={class:"rename-thread-subtitle"},qE={key:0,class:"automation-target-picker"},GE={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},VE={class:"automation-target-dropdown"},KE=["aria-label"],YE=["onClick"],JE={class:"automation-thread-field"},QE={class:"automation-thread-label"},XE=["placeholder"],ZE={class:"automation-thread-field"},eM={class:"automation-thread-label"},tM=["placeholder"],nM={class:"automation-thread-field"},rM={class:"automation-thread-label"},oM={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},aM={key:0,class:"automation-schedule-row"},sM={class:"automation-schedule-copy"},iM={key:1,class:"automation-schedule-row"},lM={class:"automation-schedule-copy"},uM={class:"automation-schedule-preview"},cM={class:"automation-thread-field"},dM={class:"automation-thread-label"},fM={key:2,class:"rename-thread-subtitle automation-thread-error"},hM={key:3,class:"rename-thread-subtitle automation-thread-notice"},pM={class:"rename-thread-actions"},mM=["disabled"],gM=["disabled"],vM=["disabled"],yM=["disabled"],Ig="codex-web-local.sidebar-section-expansion.v1",Ag="codex-web-local.sidebar-chats-first.v1",_g="codex-web-local.sidebar-chat-sort-mode.v1",Pg="codex-web-local.thread-view-mode.v1",Eg="codex-web-local.collapsed-projects.v1",wM=hn({__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}=co(),{recordVisibleFailure:a}=yw(),s=n,{records:i,loadRecords:l,recordArchivedThread:u,removeArchivedRecord:d,restoreArchivedThread:m}=MP(),f=k(!1),v=k(""),T=k("");function S(){mn.value=!1,v.value="",l(),f.value=!0}async function R(C){if(!T.value){T.value=C,v.value="";try{const M=await m(C);M.ok?s("restore-thread",C):v.value=M.error??"Failed to restore thread"}finally{T.value=""}}}const E=k({}),N=k({}),W=k(!0),L=k(!0),fe=k(!0),le=k(!1),Y=k(go(Ag,!1)),ie=k(nr());let we=!1;const Pe=k([]),ye=k({}),ee=k(""),ve=k([]),ne=k(""),Ae=k(""),De=k("hover"),$e=k({}),je=k({}),Ce=k({}),Se=k("actions"),xe=k(""),Ee=k(!1),Je=k(""),Xe=k(""),lt=k(null),ce=k(!1),F=k(""),oe=k(""),se=A1({getGroups:()=>r.groups,t:o,getProjectDisplayName:Mn,getProjectAutomationKey:Ri,closeThreadMenu:He,closeProjectMenu:rn,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:Le,automationByProjectName:We,automationDialogVisible:P,automationDialogScope:$,automationDialogAutomationId:q,automationDialogMode:ue,automationTargetPickerVisible:re,automationTargetMode:ae,automationTargetValue:_e,automationDialogError:Ne,automationDialogNotice:Ie,projectAutomationActionError:he,isSavingAutomation:Ke,isRunningAutomation:Oe,automationDraft:qe,automationScheduleDraft:Ge,automationDialogAutomations:dt,automationSchedulePreview:bt,automationDialogSubtitle:ot,automationTargetDropdownOptions:ut,automationIntervalUnitOptions:J,automationStatusOptions:de,threadAutomationCount:ke,threadHasAutomation:Be,projectAutomationCount:vt,projectHasAutomation:yt,threadAutomationTooltip:Bt,projectAutomationTooltip:Bo,syncAutomationRruleFromScheduleDraft:Yt,onAutomationIntervalUnitChange:fo,onAutomationStatusChange:er,syncAutomationScheduleDraftFromRrule:ka,setAutomationScheduleMode:ho,openAutomationDialog:ni,openProjectAutomationDialog:Sa,openAutomationEditorFromPanel:is,openAutomationCreatorFromPanel:Fr,setAutomationTargetMode:ls,startNewAutomationDraft:Br,selectAutomationForEditing:Uo,closeAutomationDialog:zo,omitAutomationProject:ri,reloadProjectAutomations:Ho,removeAutomationsForThread:Ur,submitAutomationDialog:us,onDeleteAutomationFromDialog:Ca,onRunAutomationFromDialog:Wo}=se,po=E1({getGroups:()=>r.groups,getFilteredGroups:()=>vo.value,isSearchActive:()=>Pn.value,isCollapsed:Nt,getElevatedProjectName:()=>ne.value?ne.value:Ae.value?zt.value.get(Ae.value)??"":"",onReorderProject:(C,M)=>s("reorder-project",{projectName:C,toIndex:M}),closeProjectMenu:rn}),{groupsContainerRef:mo,groupsContainerStyle:Sr,setProjectGroupRef:cs,isDraggingProject:xa,projectGroupStyle:gt,onProjectHandleMouseDown:Tt,takeToggleSuppression:Ct,pruneProjectGroups:en,dispose:$n}=po,pn=new Map,Cr=new Map,hr=k(null),qo=k(null),mn=k(!1),tr=k(Rt());function xr(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(Eg);if(!C)return{};const M=JSON.parse(C);return!M||typeof M!="object"||Array.isArray(M)?{}:M}catch{return{}}}function Rt(){return typeof window>"u"?"project":window.localStorage.getItem(Pg)==="chronological"?"chronological":"project"}function go(C,M){if(typeof window>"u")return M;const x=window.localStorage.getItem(C);return x==="true"?!0:x==="false"?!1:M}function nr(){return typeof window>"u"?"updated":window.localStorage.getItem(_g)==="created"?"created":"updated"}N.value=xr();function kn(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem(Ig)||"{}");typeof C.pinned=="boolean"&&(W.value=C.pinned),typeof C.projects=="boolean"&&(L.value=C.projects),typeof C.chats=="boolean"&&(fe.value=C.chats)}catch{}}function zr(){typeof window>"u"||window.localStorage.setItem(Ig,JSON.stringify({pinned:W.value,projects:L.value,chats:fe.value}))}kn(),tt(N,C=>{typeof window>"u"||window.localStorage.setItem(Eg,JSON.stringify(C))},{deep:!0}),tt(tr,C=>{typeof window>"u"||window.localStorage.setItem(Pg,C)}),tt(Y,C=>{typeof window>"u"||window.localStorage.setItem(Ag,String(C))}),tt(ie,C=>{typeof window>"u"||window.localStorage.setItem(_g,C)}),tt([W,L,fe],zr);const Nn=G(()=>r.searchQuery.trim().toLowerCase()),Pn=G(()=>Nn.value.length>0),Sn=G(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),Ia=G(()=>new Set(Pe.value)),pr=G(()=>new Set(ve.value));function Hr(C){if(pr.value.has(C.id))return!1;if(!Pn.value)return!0;if(Sn.value)return Sn.value.has(C.id);const M=Nn.value;return C.title.toLowerCase().includes(M)||C.preview.toLowerCase().includes(M)}const Ut=G(()=>RP(r.groups)),vo=G(()=>Ut.value.flatMap(C=>{const M=C.threads.filter(x=>!bc(x.cwd)&&Hr(x));return M.length>0?[{...C,threads:M}]:!Pn.value&&C.threads.length===0?[{...C,threads:M}]:[]})),Go=G(()=>tr.value==="chronological"),Vo=G(()=>{const C=[];for(const M of Ut.value)for(const x of M.threads)Ia.value.has(x.id)||Hr(x)&&C.push(x);return C.sort((M,x)=>{const X=new Date(M.updatedAtIso||M.createdAtIso).getTime();return new Date(x.updatedAtIso||x.createdAtIso).getTime()-X})}),Cn=G(()=>{const C=Vo.value.filter(x=>bc(x.cwd)),M=ie.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((x,X)=>{const Qe=new Date(x[M]||x.updatedAtIso||x.createdAtIso).getTime();return new Date(X[M]||X.updatedAtIso||X.createdAtIso).getTime()-Qe})}),Xt=G(()=>Pn.value||le.value?Cn.value:Cn.value.slice(0,10)),mr=G(()=>Pn.value?!1:Cn.value.length>10),ln=G(()=>{const C=new Map;for(const M of Ut.value)for(const x of M.threads)pr.value.has(x.id)||C.set(x.id,x);return C});tt(Pe,C=>{we&&XA(C)}),tt([ln,()=>r.isThreadListFullyLoaded],([C])=>{const M=I1(Pe.value,new Set(C.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(M.length===Pe.value.length)return;const x=new Set(M),X=Object.fromEntries(Object.entries(ye.value).filter(([Qe])=>x.has(Qe)));ye.value=X,Pe.value=M});let Ko=0;async function tn(){if(r.isLoading)return;const C=Pe.value.filter(Qe=>!ln.value.has(Qe)&&!ye.value[Qe]);if(C.length===0)return;const M=Ko+=1,x=await Promise.all(C.map(async Qe=>{try{return await uA(Qe)}catch{return null}}));if(M!==Ko)return;const X={...ye.value};for(const Qe of x)Qe&&(X[Qe.id]=Qe);ye.value=X}tt([Pe,ln,()=>r.isLoading],()=>{we&&tn()}),ss(async()=>{const{threadIds:C}=await QA(),M=Array.isArray(C)?C.filter(x=>typeof x=="string").map(x=>x.trim()).filter((x,X,Qe)=>x.length>0&&Qe.indexOf(x)===X):[];M.length>0&&(Pe.value=M);try{Le.value=await eI()}catch{Le.value={}}try{await Ho()}catch{We.value={}}we=!0,tn()});const Wr=G(()=>Be(F.value)),Yo=G(()=>{const C=oe.value;return Wr.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})}),zt=G(()=>{const C=new Map;for(const M of r.groups)for(const x of M.threads)C.set(x.id,M.projectName);return C}),Jo=G(()=>{const C=new Map;for(const M of r.groups){const x=M.threads.filter(X=>!Ia.value.has(X.id)&&!pr.value.has(X.id));C.set(M.projectName,x)}return C}),Qo=G(()=>{const C=new Map;for(const M of r.groups)for(const x of M.threads){const X=new Date(x.updatedAtIso||x.createdAtIso).getTime();C.set(x.id,X)}return C}),It=G(()=>{const C=Ae.value;return C?ln.value.get(C)??null:null}),vn=G(()=>Pe.value.map(C=>ln.value.get(C)??ye.value[C]??null).filter(C=>C!==null).filter(Hr));function yo(){W.value=!W.value}function Ir(){L.value=!L.value}function Ar(){fe.value=!fe.value}function Xo(C){if(Number.isNaN(C))return"n/a";const M=Math.abs(Date.now()-C);if(M<6e4)return o("now");const x=Math.floor(M/6e4);if(x<60)return`${x}m`;const X=Math.floor(x/60);return X<24?`${X}h`:`${Math.floor(X/24)}d`}function qr(C){const M=Qo.value.get(C.id);return Xo(typeof M=="number"?M:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function Zo(C){const M=new Date(C).getTime();return Number.isNaN(M)?"":new Date(M).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function rr(C){return Ia.value.has(C)}function wo(C){if(rr(C)){Pe.value=Pe.value.filter(M=>M!==C);return}Pe.value=[C,...Pe.value]}function ea(C){wo(C),He()}function _r(C){ee.value="",s("select",C)}function mt(C){C===r.selectedThreadId&&(s("copy-thread-chat",C),He())}function En(C){s("fork-thread",C),He()}function xn(C){return`${o("start new thread")} ${Mn(C)}`}function Aa(C){s("start-new-thread",C)}function Wn(C){s("browse-thread-files",C),He()}function I(C){s("save-thread-project",C),He()}async function O(C){var x,X;const M=((X=(x=ln.value.get(C))==null?void 0:x.cwd)==null?void 0:X.trim())??"";if(He(),!(!M||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(M)}catch{}}function K(C,M){if(Ae.value===C&&De.value==="hover"){if(M){const x=M.relatedTarget,X=qo.value;if(x instanceof Node&&X&&X.contains(x))return}He()}}function Te(C){return Ae.value===C}function He(){Ae.value="",De.value="hover",Ce.value={}}function $t(C){if(ee.value="",Ae.value===C){He();return}De.value="hover",rn(),mn.value=!1,Ae.value=C,Mt(()=>{Yr(C)})}function xt(C,M){C.preventDefault(),ee.value="",De.value="contextmenu",Ae.value=M}function nn(C,M){Je.value=C,Xe.value=M,Ee.value=!0,He(),Mt(()=>{var x,X;(x=lt.value)==null||x.focus(),(X=lt.value)==null||X.select()})}function Jt(){Ee.value=!1,Je.value="",Xe.value=""}function Pr(){const C=Je.value,M=Xe.value.trim();!C||!M||(s("rename-thread",{threadId:C,title:M}),Jt())}function _a(C,M){ee.value="",F.value=C,oe.value=M,ce.value=!0,He()}function ds(){ce.value=!1,F.value="",oe.value=""}async function un(){const C=F.value;C&&(oi(C),ds())}function ta(C){return ee.value===C}function Pa(C){if(ee.value!==C){ee.value=C,He();return}oi(C),ee.value=""}function oi(C){var x,X;const M=ln.value.get(C)??null;pr.value.has(C)||(ve.value=[C,...ve.value]),ee.value="",He(),u({id:C,title:((x=M==null?void 0:M.title)==null?void 0:x.trim())||"(untitled)",cwd:((X=M==null?void 0:M.cwd)==null?void 0:X.trim())??"",projectName:zt.value.get(C)??""}),Pe.value=Pe.value.filter(Qe=>Qe!==C),s("archive",C),Be(C)&&Ur(C)}function Mn(C){return r.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:is,openAutomationCreatorFromPanel:Fr,openRenameThreadDialog:nn,openRecycleBin:S});function fs(C){return C.includes("/")||C.includes("\\")}function ai(C){return fs(C)?C:Mn(C)}function hs(C){const M=Or(C);if(!M)return!1;let x=0;for(const X of r.groups)if(fs(X.projectName)&&Or(X.projectName)===M&&(x+=1,x>1))return!0;return!1}function Ea(C){const M=r.projectDisplayNameById[C.projectName],x=Mn(C.projectName),X=C.projectName;if(M&&!fs(X)&&X!==x)return x.includes(X)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(X)?x:`${x} ${X}`;if(M&&fs(X)){const Gn=Or(X),yr=Or(ul(X)),an=hs(X)?yr:Gn;return an&&an!==x?`${x} ${an}`:x}if(!x.includes("/")&&!x.includes("\\"))return x;const Qe=Or(x)||x,qt=Or(ul(x));return qt.startsWith(".")&&qt!==Qe?`${Qe} ${qt}`:C.threads.length>0||!hs(X)?Qe:qt?`${Qe} ${qt}`:Qe}function na(C){return ne.value===C}function rn(){ne.value="",Se.value="actions",xe.value=""}function ra(){const C=!mn.value;C&&(rn(),He()),mn.value=C}function Gr(C){tr.value=C,mn.value=!1}function yn(){Y.value=!Y.value}function bo(C){ie.value=C}function To(C){s("request-project-git-status",C),Mt(()=>{sa(C)})}function ps(C){if(ne.value===C){rn();return}He(),mn.value=!1,ne.value=C,Se.value="actions",xe.value=Mn(C),To(C)}function on(C){He(),mn.value=!1,ne.value=C,Se.value="actions",xe.value=Mn(C),To(C)}function Mi(C){return r.projectDisplayNameById[C.projectName]??Ea(C)}function wn(C){He();const M=C.projectName;ne.value=M,Se.value="rename",xe.value=Mi(C),Mt(()=>{sa(M)})}function ms(C){s("browse-project-files",C),rn()}function or(C){s("save-project",C),rn()}function gs(C){s("create-project-worktree",C),rn()}function vs(C){s("rename-project",{projectName:C,displayName:xe.value})}function Sl(C){const M=Ri(C);if(s("remove-project",C),M&&yt(C)){he.value="";const x=We.value;We.value=ri(We.value,M),Vy(M).then(Ho).catch(async X=>{We.value=x;const Qe=X instanceof Error?X.message:o("Failed to delete project automation");he.value=Qe,a(Qe);try{await Ho()}catch{We.value=x}}).finally(()=>{s("automations-changed")})}rn()}function Ri(C){var x;const M=((x=r.projectCwdByName[C])==null?void 0:x.trim())??"";return mI(M)?M:""}function si(C,M){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const x=r.groups.findIndex(qt=>qt.projectName===M);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:M,toIndex:Qe}))}function _t(C){return E.value[C]===!0}function Nt(C){return N.value[C]===!0}function ys(C){E.value={...E.value,[C]:!_t(C)}}function Er(){le.value=!le.value}function qn(C){Ct(C)||(N.value={...N.value,[C]:!Nt(C)})}function Vr(C,M){const x=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(x){pn.set(C,x);return}pn.delete(C)}function oa(C,M){const x=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(x){Cr.set(C,x);return}Cr.delete(C)}function On(C){let M=C.parentElement;for(;M;){const x=window.getComputedStyle(M),X=x.overflowY||x.overflow;if(X==="auto"||X==="scroll"||X==="hidden"||X==="clip")return M.getBoundingClientRect();M=M.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function aa(C,M){const x=C.getBoundingClientRect(),X=On(C),Qe=6,qt=X.bottom-x.bottom,Gn=x.top-X.top;return qt>=M+Qe?"down":Gn>qt?"up":"down"}function ko(C,M){const x=Cr.get(C);if(!x)return"down";const X=aa(x,M);return je.value={...je.value,[C]:X},X}function Ma(C){return je.value[C]??"down"}function sa(C){const M=pn.get(C);if(!M)return;const x=M.querySelector(".project-menu-panel"),X=(x==null?void 0:x.getBoundingClientRect().height)??0;$e.value={...$e.value,[C]:aa(M,X)}}function Kr(C,M,x){return Math.min(Math.max(C,M),x)}function Yr(C){const M=Cr.get(C);if(!M)return;const x=qo.value,X=x==null?void 0:x.getBoundingClientRect(),Qe=(X==null?void 0:X.height)||(x==null?void 0:x.offsetHeight)||112,qt=(X==null?void 0:X.width)||(x==null?void 0:x.offsetWidth)||160,Gn=ko(C,Qe),yr=M.getBoundingClientRect(),an=8,Rr=4,Ra=Math.max(an,window.innerWidth-qt-an),ua=Kr(yr.right-qt,an,Ra),Ss=Kr(Gn==="up"?yr.top-Qe-Rr:yr.bottom+Rr,an,Math.max(an,window.innerHeight-Qe-an));Ce.value={left:`${Math.round(ua)}px`,top:`${Math.round(Ss)}px`}}function Jr(){const C=Ae.value;C&&Yr(C)}function Li(){window.addEventListener("resize",Jr),document.addEventListener("scroll",Jr,!0)}function ji(){window.removeEventListener("resize",Jr),document.removeEventListener("scroll",Jr,!0)}function ws(C){const M=ne.value;if(!M)return!1;const x=pn.get(M);if(!x)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(x))return!0;const Qe=C.target;return Qe instanceof Node?x.contains(Qe):!1}function Qr(C){const M=Ae.value;if(!M)return!1;const x=Cr.get(M);if(!x)return!1;const X=typeof C.composedPath=="function"?C.composedPath():[];if(X.includes(x))return!0;const Qe=qo.value;if(Qe&&X.includes(Qe))return!0;const qt=C.target;return qt instanceof Node?!!(x.contains(qt)||Qe&&Qe.contains(qt)):!1}function ia(C){if(mn.value){const M=hr.value,x=typeof C.composedPath=="function"?C.composedPath():[];!!M&&(x.includes(M)||C.target instanceof Node&&M.contains(C.target))||(mn.value=!1)}ne.value&&(ws(C)||rn(),Ae.value&&(Qr(C)||He()))}function bs(C){ne.value&&!ws(C)&&rn(),Ae.value&&!Qr(C)&&He()}function Ts(){mn.value&&(mn.value=!1),ne.value&&rn(),Ae.value&&He()}function $i(){window.addEventListener("pointerdown",ia,{capture:!0}),window.addEventListener("focusin",bs,{capture:!0}),window.addEventListener("blur",Ts)}function ii(){window.removeEventListener("pointerdown",ia,{capture:!0}),window.removeEventListener("focusin",bs,{capture:!0}),window.removeEventListener("blur",Ts)}function ks(C){return Jo.value.get(C.projectName)??[]}function Cl(C){if(Pn.value)return ks(C);if(Nt(C.projectName))return[];const M=ks(C);return _t(C.projectName)?M:M.slice(0,10)}function ar(C){return Pn.value?!1:!Nt(C.projectName)&&ks(C).length>10}function gr(C){return ks(C).length>0}function Mr(C){var M;return!!C.pendingRequestState||C.inProgress||C.unread||((M=C.externalSession)==null?void 0:M.active)===!0}function Xr(C){return C.pendingRequestState==="approval"?o("Awaiting approval"):o("Awaiting response")}function vr(C){var M;return((M=C.externalSession)==null?void 0:M.active)===!0?"external":C.pendingRequestState==="approval"?"awaiting-approval":C.pendingRequestState==="response"?"awaiting-response":C.inProgress?"working":C.unread?"unread":"idle"}tt(()=>r.groups.map(C=>C.projectName),C=>{en(C)}),tt(()=>{const C=ne.value;return C?r.projectGitRepoByName[C]:void 0},()=>{const C=ne.value;C&&Mt(()=>{ne.value===C&&sa(C)})});const la=G(()=>mn.value||ne.value!==""||Ae.value!=="");return tt(la,C=>{if(C){$i();return}ii()}),tt(Ae,C=>{if(!C){ji();return}Li(),Mt(()=>{Yr(C)})}),ti(()=>{pn.clear(),ji(),ii(),$n()}),(C,M)=>(_(),B("section",{class:ct(["thread-tree-root",{"chats-first":Y.value}])},[vn.value.length>0?(_(),B("section",M1,[Fe(Us,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":W.value,onClick:yo},{left:ft(()=>[W.value?(_(),Ze(Ys,{key:1,class:"thread-icon"})):(_(),Ze(qu,{key:0,class:"thread-icon"}))]),default:ft(()=>[w("span",R1,D(g(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),W.value?(_(),B("ul",L1,[(_(!0),B(rt,null,Wt(vn.value,x=>(_(),Ze(Gu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:rr(x.id),"menu-open":Te(x.id),"show-status-indicator":Mr(x),"thread-state":vr(x),"inline-delete-confirming":ta(x.id),"automation-count":g(ke)(x.id),"automation-tooltip":g(Bt)(x.id),"request-label":Xr(x),"relative-time":qr(x),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":X=>oa(x.id,X),onSelect:X=>_r(x.id),onInlineDelete:X=>Pa(x.id),onMenuToggle:X=>$t(x.id),onRowLeave:X=>K(x.id,X),onRowContextmenu:X=>xt(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))])):pe("",!0)])):pe("",!0),w("section",j1,[Fe(Us,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":L.value,onClick:Ir},{left:ft(()=>[L.value?(_(),Ze(Ys,{key:1,class:"thread-icon"})):(_(),Ze(qu,{key:0,class:"thread-icon"}))]),right:ft(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:hr,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":mn.value,"aria-label":g(o)("Organize threads"),title:g(o)("Organize threads"),onClick:pt(ra,["stop"])},[Fe(Nf,{class:"thread-icon"})],8,N1),mn.value?(_(),B("div",{key:0,class:"organize-menu-panel",onClick:M[4]||(M[4]=pt(()=>{},["stop"]))},[w("p",O1,D(g(o)("Organize")),1),w("button",{class:"organize-menu-item","data-active":tr.value==="project",type:"button",onClick:M[0]||(M[0]=x=>Gr("project"))},[w("span",null,D(g(o)("By project")),1),tr.value==="project"?(_(),B("span",F1,"✓")):pe("",!0)],8,D1),w("button",{class:"organize-menu-item","data-active":tr.value==="chronological",type:"button",onClick:M[1]||(M[1]=x=>Gr("chronological"))},[w("span",null,D(g(o)("Chronological list")),1),tr.value==="chronological"?(_(),B("span",U1,"✓")):pe("",!0)],8,B1),w("button",{class:"organize-menu-item","data-active":Y.value,type:"button",onClick:yn},[w("span",null,D(g(o)("Chats first")),1),Y.value?(_(),B("span",H1,"✓")):pe("",!0)],8,z1),M[40]||(M[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",W1,D(g(o)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":ie.value==="created",type:"button",onClick:M[2]||(M[2]=x=>bo("created"))},[w("span",null,D(g(o)("Created")),1),ie.value==="created"?(_(),B("span",G1,"✓")):pe("",!0)],8,q1),w("button",{class:"organize-menu-item","data-active":ie.value==="updated",type:"button",onClick:M[3]||(M[3]=x=>bo("updated"))},[w("span",null,D(g(o)("Updated")),1),ie.value==="updated"?(_(),B("span",K1,"✓")):pe("",!0)],8,V1),M[41]||(M[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:S},[w("span",null,D(g(o)("Recycle bin")),1)])])):pe("",!0)],512)]),default:ft(()=>[w("span",$1,D(g(o)("Projects")),1)]),_:1},8,["aria-expanded"]),L.value?(_(),B(rt,{key:0},[g(he)?(_(),B("p",Y1,D(g(he)),1)):pe("",!0),Pn.value&&vo.value.length===0?(_(),B("p",J1,D(g(o)("No matching threads. Clear the search to see all threads.")),1)):e.isLoading&&e.groups.length===0?(_(),B("p",Q1,D(g(o)("Loading threads...")),1)):Go.value?(_(),B("ul",X1,[(_(!0),B(rt,null,Wt(Vo.value,x=>(_(),Ze(Gu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:rr(x.id),"menu-open":Te(x.id),"show-status-indicator":Mr(x),"thread-state":vr(x),"inline-delete-confirming":ta(x.id),"automation-count":g(ke)(x.id),"automation-tooltip":g(Bt)(x.id),"request-label":Xr(x),"relative-time":qr(x),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":X=>oa(x.id,X),onSelect:X=>_r(x.id),onInlineDelete:X=>Pa(x.id),onMenuToggle:X=>$t(x.id),onRowLeave:X=>K(x.id,X),onRowContextmenu:X=>xt(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))])):(_(),B("div",{key:4,ref_key:"groupsContainerRef",ref:mo,class:"thread-tree-groups",style:oo(g(Sr))},[(_(!0),B(rt,null,Wt(vo.value,x=>(_(),B("article",{key:x.projectName,ref_for:!0,ref:X=>g(cs)(x.projectName,X),class:"project-group","data-project-name":x.projectName,"data-expanded":!Nt(x.projectName),"data-dragging":g(xa)(x.projectName),style:oo(g(gt)(x.projectName))},[Fe(Us,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:X=>qn(x.projectName),onContextmenu:pt(X=>on(x.projectName),["prevent"]),onKeydown:[X=>si(X,x.projectName),Tr(pt(X=>qn(x.projectName),["prevent"]),["enter"]),Tr(pt(X=>qn(x.projectName),["prevent"]),["space"])]},{left:ft(()=>[w("span",eE,[w("span",tE,[Nt(x.projectName)?(_(),Ze(Mh,{key:0,class:"thread-icon"})):(_(),Ze(hP,{key:1,class:"thread-icon"}))]),w("span",nE,[Nt(x.projectName)?(_(),Ze(qu,{key:0,class:"thread-icon"})):(_(),Ze(Ys,{key:1,class:"thread-icon"}))])])]),right:ft(()=>[w("div",iE,[w("div",{ref_for:!0,ref:X=>Vr(x.projectName,X),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:pt(X=>ps(x.projectName),["stop"])},[Fe(Nf,{class:"thread-icon"})],8,lE),na(x.projectName)?(_(),B("div",{key:0,class:"project-menu-panel","data-open-direction":$e.value[x.projectName]??"down",onClick:M[6]||(M[6]=pt(()=>{},["stop"]))},[Se.value==="actions"?(_(),B(rt,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:X=>ms(x.projectName)},D(g(o)("Browse files")),9,cE),w("button",{class:"project-menu-item",type:"button",onClick:X=>or(x.projectName)},D(g(o)("Export Project")),9,dE),w("button",{class:"project-menu-item",type:"button",onClick:X=>g(Sa)(x.projectName)},D(g(yt)(x.projectName)?g(o)("Manage automations…"):g(o)("Add automation…")),9,fE),e.projectGitRepoByName[x.projectName]?(_(),B("button",{key:0,class:"project-menu-item",type:"button",onClick:X=>gs(x.projectName)},D(g(o)("New worktree")),9,hE)):pe("",!0),w("button",{class:"project-menu-item",type:"button",onClick:X=>wn(x)},D(g(o)("Rename project")),9,pE),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:X=>Sl(x.projectName)},D(g(o)("Remove")),9,mE)],64)):(_(),B(rt,{key:1},[w("label",gE,D(g(o)("Project name")),1),_n(w("input",{"onUpdate:modelValue":M[5]||(M[5]=X=>xe.value=X),class:"project-menu-input",type:"text",onInput:X=>vs(x.projectName)},null,40,vE),[[Ln,xe.value]])],64))],8,uE)):pe("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":xn(x.projectName),title:xn(x.projectName),onClick:pt(X=>Aa(x.projectName),["stop"])},[Fe(bl,{class:"thread-icon"})],8,yE)])]),default:ft(()=>[w("span",{class:"project-main-button","data-dragging-handle":g(xa)(x.projectName),onMousedown:pt(X=>g(Tt)(X,x.projectName),["left"])},[w("span",{class:"project-title",title:ai(x.projectName)},D(Ea(x)),9,oE),g(yt)(x.projectName)?(_(),B("span",{key:0,class:"thread-row-automation-chip",title:g(Bo)(x.projectName)},[Fe(Jc,{class:"thread-row-automation-icon"}),g(vt)(x.projectName)>1?(_(),B("span",sE,D(g(vt)(x.projectName)),1)):pe("",!0)],8,aE)):pe("",!0)],40,rE)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),gr(x)?(_(),B("ul",wE,[(_(!0),B(rt,null,Wt(Cl(x),X=>(_(),Ze(Gu,{key:X.id,thread:X,selected:X.id===e.selectedThreadId,pinned:rr(X.id),"menu-open":Te(X.id),"show-status-indicator":Mr(X),"thread-state":vr(X),"inline-delete-confirming":ta(X.id),"automation-count":g(ke)(X.id),"automation-tooltip":g(Bt)(X.id),"request-label":Xr(X),"relative-time":qr(X),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":Qe=>oa(X.id,Qe),onSelect:Qe=>_r(X.id),onInlineDelete:Qe=>Pa(X.id),onMenuToggle:Qe=>$t(X.id),onRowLeave:Qe=>K(X.id,Qe),onRowContextmenu:Qe=>xt(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))])):(_(),Ze(Us,{key:1,as:"p",class:"project-empty-row"},{left:ft(()=>[...M[42]||(M[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:ft(()=>[w("span",bE,D(g(o)("No threads yet. Start a new thread to begin.")),1)]),_:1})),ar(x)?(_(),Ze(Us,{key:2,class:"thread-show-more-row"},{left:ft(()=>[...M[43]||(M[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ft(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:X=>ys(x.projectName)},D(_t(x.projectName)?"Show less":"Show more"),9,TE)]),_:2},1024)):pe("",!0)],12,Z1))),128))],4))],64)):pe("",!0)]),w("section",kE,[Fe(Us,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":fe.value,onClick:Ar},{left:ft(()=>[fe.value?(_(),Ze(Ys,{key:1,class:"thread-icon"})):(_(),Ze(qu,{key:0,class:"thread-icon"}))]),right:ft(()=>[w("div",CE,[w("button",{class:"chats-section-action",type:"button","aria-label":g(o)("New chat"),title:g(o)("New chat"),onClick:M[7]||(M[7]=pt(x=>C.$emit("start-new-chat"),["stop"]))},[Fe(bl,{class:"thread-icon"})],8,xE)])]),default:ft(()=>[w("span",SE,D(g(o)("Chats")),1)]),_:1},8,["aria-expanded"]),fe.value&&Cn.value.length===0?(_(),B("p",IE,D(g(o)("No chats")),1)):fe.value?(_(),B("ul",AE,[(_(!0),B(rt,null,Wt(Xt.value,x=>(_(),Ze(Gu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:rr(x.id),"menu-open":Te(x.id),"show-status-indicator":Mr(x),"thread-state":vr(x),"inline-delete-confirming":ta(x.id),"automation-count":g(ke)(x.id),"automation-tooltip":g(Bt)(x.id),"request-label":Xr(x),"relative-time":qr(x),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":X=>oa(x.id,X),onSelect:X=>_r(x.id),onInlineDelete:X=>Pa(x.id),onMenuToggle:X=>$t(x.id),onRowLeave:X=>K(x.id,X),onRowContextmenu:X=>xt(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))])):pe("",!0),fe.value&&mr.value?(_(),Ze(Us,{key:2,class:"thread-show-more-row"},{left:ft(()=>[...M[44]||(M[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ft(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Er},D(le.value?"Show less":"Show more"),1)]),_:1})):pe("",!0)]),(_(),Ze(Qs,{to:"body"},[It.value?(_(),B("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:qo,class:"thread-menu-panel thread-menu-panel-fixed",style:oo(Ce.value),"data-open-direction":Ma(It.value.id),onClick:M[17]||(M[17]=pt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:M[8]||(M[8]=x=>g(ni)(It.value.id))},D(g(Be)(It.value.id)?g(o)("Manage automations…"):g(o)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[9]||(M[9]=x=>Wn(It.value.id))},D(g(o)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[10]||(M[10]=x=>I(It.value.id))},D(g(o)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[11]||(M[11]=x=>O(It.value.id))},D(g(o)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:It.value.id!==e.selectedThreadId,title:It.value.id===e.selectedThreadId?g(o)("Copy chat"):g(o)("Open this chat before copying"),onClick:M[12]||(M[12]=x=>mt(It.value.id))},D(g(o)("Copy chat")),9,PE),w("button",{class:"thread-menu-item",type:"button",onClick:M[13]||(M[13]=x=>En(It.value.id))},D(g(o)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[14]||(M[14]=x=>ea(It.value.id))},D(rr(It.value.id)?g(o)("Unpin thread"):g(o)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[15]||(M[15]=x=>nn(It.value.id,It.value.title))},D(g(o)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:M[16]||(M[16]=x=>_a(It.value.id,It.value.title))},D(g(o)("Delete thread")),1)],12,_E)):pe("",!0)])),Fe(nf,{open:Ee.value,title:g(o)("Rename thread"),subtitle:g(o)("Make it short and recognizable."),onClose:Jt},{footer:ft(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Jt},D(g(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Pr},D(g(o)("Save")),1)]),default:ft(()=>[_n(w("input",{ref_key:"renameThreadInputRef",ref:lt,"onUpdate:modelValue":M[18]||(M[18]=x=>Xe.value=x),class:"rename-thread-input",type:"text",placeholder:g(o)("Add title..."),onKeydown:Tr(pt(Pr,["prevent"]),["enter"])},null,40,EE),[[Ln,Xe.value]])]),_:1},8,["open","title","subtitle"]),Fe(nf,{open:ce.value,title:Wr.value?g(o)("Archive chat and remove automations?"):g(o)("Delete thread?"),subtitle:Yo.value,onClose:ds},{footer:ft(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:ds},D(g(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:un},D(Wr.value?g(o)("Archive and remove"):g(o)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Fe(nf,{open:f.value,title:g(o)("Recycle bin"),subtitle:g(o)("Threads you removed are kept here so you can restore them."),size:"md",onClose:M[19]||(M[19]=x=>f.value=!1)},{default:ft(()=>[w("div",ME,[g(i).length===0?(_(),B("div",RE,D(g(o)("Recycle bin is empty.")),1)):(_(),B("ul",LE,[(_(!0),B(rt,null,Wt(g(i),x=>(_(),B("li",{key:x.id,class:"recycle-bin-item"},[w("div",jE,[w("span",$E,D(x.title),1),x.projectName?(_(),B("span",NE,D(x.projectName),1)):pe("",!0),w("span",OE,D(Zo(x.archivedAtIso)),1)]),w("div",DE,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:T.value===x.id,onClick:X=>R(x.id)},D(T.value===x.id?g(o)("Restoring…"):g(o)("Restore")),9,FE),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:X=>g(d)(x.id)},D(g(o)("Delete permanently")),9,BE)])]))),128))])),v.value?(_(),B("p",UE,D(v.value),1)):pe("",!0)])]),_:1},8,["open","title","subtitle"]),(_(),Ze(Qs,{to:"body"},[g(P)?(_(),B("div",{key:0,class:"rename-thread-overlay",onClick:M[39]||(M[39]=pt((...x)=>g(zo)&&g(zo)(...x),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":g($)==="project"?g(o)("Project automation"):g(o)("Thread automation")},[w("h3",HE,D(g(ue)==="edit"?g(o)("Edit automation"):g(o)("Add automation")),1),w("p",WE,D(g(ot)),1),g(re)&&g(ue)==="create"?(_(),B("div",qE,[M[45]||(M[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",GE,[w("button",{class:ct(["automation-target-mode",{"is-active":g(ae)==="thread"}]),type:"button",onClick:M[20]||(M[20]=x=>g(ls)("thread"))}," Existing chat ",2),w("button",{class:ct(["automation-target-mode",{"is-active":g(ae)==="project"}]),type:"button",onClick:M[21]||(M[21]=x=>g(ls)("project"))}," Project ",2)]),w("div",VE,[Fe(Ai,{modelValue:g(_e),"onUpdate:modelValue":M[22]||(M[22]=x=>jn(_e)?_e.value=x:null),class:"automation-thread-dropdown",options:g(ut),placeholder:g(ae)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":g(ae)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):pe("",!0),g(dt).length>0?(_(),B("div",{key:1,class:"automation-thread-list","aria-label":g($)==="project"?"Project automations":"Thread automations"},[(_(!0),B(rt,null,Wt(g(dt),x=>(_(),B("button",{key:x.id,class:ct(["automation-thread-list-item",{"is-active":x.id===g(q)}]),type:"button",onClick:X=>g(Uo)(x.id)},[w("span",null,D(x.name),1),w("small",null,D(x.status==="PAUSED"?"Paused":"Active"),1)],10,YE))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:M[23]||(M[23]=(...x)=>g(Br)&&g(Br)(...x))},D(g(o)("Add another automation")),1)],8,KE)):pe("",!0),w("label",JE,[w("span",QE,D(g(o)("Name")),1),_n(w("input",{"onUpdate:modelValue":M[24]||(M[24]=x=>g(qe).name=x),class:"rename-thread-input",type:"text",placeholder:g(o)("Automation name")},null,8,XE),[[Ln,g(qe).name]])]),w("label",ZE,[w("span",eM,D(g(o)("Prompt")),1),_n(w("textarea",{"onUpdate:modelValue":M[25]||(M[25]=x=>g(qe).prompt=x),class:"automation-thread-textarea",rows:"6",placeholder:g(o)("Describe what the automation should do")},null,8,tM),[[Ln,g(qe).prompt]])]),w("div",nM,[w("span",rM,D(g(o)("Schedule")),1),w("div",oM,[w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ge).mode==="daily"}]),type:"button",onClick:M[26]||(M[26]=x=>g(ho)("daily"))},D(g(o)("Daily")),3),w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ge).mode==="interval"}]),type:"button",onClick:M[27]||(M[27]=x=>g(ho)("interval"))},D(g(o)("Interval")),3),w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ge).mode==="advanced"}]),type:"button",onClick:M[28]||(M[28]=x=>g(ho)("advanced"))}," RRULE ",2)]),g(Ge).mode==="daily"?(_(),B("div",aM,[w("span",sM,D(g(o)("Run every day at")),1),_n(w("input",{"onUpdate:modelValue":M[29]||(M[29]=x=>g(Ge).dailyTime=x),class:"automation-schedule-time",type:"time",onInput:M[30]||(M[30]=(...x)=>g(Yt)&&g(Yt)(...x))},null,544),[[Ln,g(Ge).dailyTime]])])):g(Ge).mode==="interval"?(_(),B("div",iM,[w("span",lM,D(g(o)("Run every")),1),_n(w("input",{"onUpdate:modelValue":M[31]||(M[31]=x=>g(Ge).interval=x),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:M[32]||(M[32]=(...x)=>g(Yt)&&g(Yt)(...x))},null,544),[[Ln,g(Ge).interval,void 0,{number:!0}]]),Fe(Ai,{class:"automation-schedule-unit-dropdown","model-value":g(Ge).intervalUnit,options:g(J),placeholder:g(o)("Unit"),"onUpdate:modelValue":g(fo)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):pe("",!0),g(Ge).mode==="advanced"?_n((_(),B("input",{key:2,"onUpdate:modelValue":M[33]||(M[33]=x=>g(qe).rrule=x),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:M[34]||(M[34]=(...x)=>g(ka)&&g(ka)(...x))},null,544)),[[Ln,g(qe).rrule]]):pe("",!0),w("p",uM,D(g(bt)),1)]),w("div",cM,[w("span",dM,D(g(o)("Status")),1),Fe(Ai,{class:"automation-thread-dropdown","model-value":g(qe).status,options:g(de),placeholder:g(o)("Status"),"onUpdate:modelValue":g(er)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),g(Ne)?(_(),B("p",fM,D(g(Ne)),1)):g(Ie)?(_(),B("p",hM,D(g(Ie)),1)):pe("",!0),w("div",pM,[g(ue)==="edit"&&g($)==="thread"?(_(),B("button",{key:0,class:"rename-thread-button",type:"button",disabled:g(Ke)||g(Oe),onClick:M[35]||(M[35]=(...x)=>g(Wo)&&g(Wo)(...x))},D(g(Oe)?g(o)("Running…"):g(o)("Run now")),9,mM)):pe("",!0),g(ue)==="edit"?(_(),B("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:g(Ke)||g(Oe),onClick:M[36]||(M[36]=(...x)=>g(Ca)&&g(Ca)(...x))},D(g(o)("Remove")),9,gM)):pe("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:g(Ke)||g(Oe),onClick:M[37]||(M[37]=(...x)=>g(zo)&&g(zo)(...x))},D(g(o)("Cancel")),9,vM),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:g(Ke)||g(Oe),onClick:M[38]||(M[38]=(...x)=>g(us)&&g(us)(...x))},D(g(Ke)?g(o)("Saving…"):g(o)("Save")),9,yM)])],8,zE)])):pe("",!0)]))],2))}}),bM=wt(wM,[["__scopeId","data-v-0b490210"]]),TM={class:"content-header"},kM=["title"],SM={class:"content-actions"},CM=hn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(_(),B("header",TM,[w("div",{class:ct(["content-leading",{"is-accent":e.accent}])},[kr(t.$slots,"leading",{},void 0)],2),w("h1",{class:ct(["content-title",{"is-accent":e.accent}]),title:e.title},D(e.title),11,kM),w("div",SM,[kr(t.$slots,"actions",{},void 0)])]))}}),xM=wt(CM,[["__scopeId","data-v-413c4c2d"]]),IM={},AM={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function _M(e,t){return _(),B("svg",AM,[...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 rc=wt(IM,[["render",_M]]),PM=["thread","panel","view","navigate"],EM={thread:"Thread",panel:"Panel",view:"View",navigate:"Navigate"},MM=[{id:"thread.new",title:"Start a new thread",group:"thread",keywords:["new","chat","新建","新线程"]},{id:"thread.rename",title:"Rename the current thread",group:"thread",keywords:["title","重命名","标题"],requiresThread:!0},{id:"thread.archive",title:"Archive the current thread",group:"thread",keywords:["delete","归档","删除"],requiresThread:!0},{id:"thread.fork",title:"Fork the current thread",group:"thread",keywords:["branch","copy","派生","分叉"],requiresThread:!0},{id:"thread.copy-markdown",title:"Copy the conversation as Markdown",group:"thread",keywords:["export","md","导出","复制对话"],requiresThread:!0},{id:"thread.copy-last-code-block",title:"Copy last code block",group:"thread",keywords:["code","snippet","clipboard","代码块","复制代码"],requiresThread:!0},{id:"thread.compact",title:"Compact the current thread context",group:"thread",keywords:["compress","summarize","压缩","上下文"],requiresThread:!0},{id:"thread.interrupt",title:"Stop the running turn",group:"thread",keywords:["cancel","abort","interrupt","中断","停止"],requiresThread:!0},{id:"thread.implement-plan",title:"Implement the current plan",group:"thread",keywords:["execute","approve","执行","计划"],requiresThread:!0},{id:"panel.git",title:"Open the Git panel",group:"panel",keywords:["diff","changes","git","变更"]},{id:"panel.files",title:"Open the files panel",group:"panel",keywords:["explorer","files","文件"]},{id:"panel.terminal",title:"Toggle the terminal panel",group:"panel",keywords:["shell","console","终端"],shortcut:"Mod+J"},{id:"panel.toggle",title:"Toggle the side panel",group:"panel",keywords:["right","layout","侧边栏"]},{id:"panel.close",title:"Close the side panel",group:"panel",keywords:["hide","right","关闭"]},{id:"view.toggle-sidebar",title:"Toggle the sidebar",group:"view",keywords:["collapse","sidebar","侧栏"],shortcut:"Mod+B"},{id:"view.search-threads",title:"Search threads",group:"view",keywords:["filter","find","搜索","筛选"]},{id:"view.cycle-theme",title:"Cycle the color theme",group:"view",keywords:["dark","light","system","theme","暗色","亮色","主题"]},{id:"view.cycle-chat-width",title:"Cycle the chat width",group:"view",keywords:["wide","layout","宽度"]},{id:"view.toggle-language",title:"Switch the interface language",group:"view",keywords:["language","chinese","english","语言","中文"]},{id:"view.send-with-enter",title:"Toggle send with Enter",group:"view",keywords:["keyboard","enter","回车"]},{id:"view.in-progress-send-mode",title:"Cycle the in-progress send mode",group:"view",keywords:["steer","queue","队列"]},{id:"view.shortcuts",title:"Keyboard shortcuts",group:"view",keywords:["keys","bindings","help","快捷键","帮助"]},{id:"nav.skills",title:"Open the skills page",group:"navigate",keywords:["plugins","mcp","技能"]},{id:"nav.automations",title:"Open the automations page",group:"navigate",keywords:["schedule","cron","自动化"]},{id:"nav.recycle-bin",title:"Open the recycle bin",group:"navigate",keywords:["trash","deleted","回收站"]},{id:"nav.settings",title:"Open settings",group:"navigate",keywords:["preferences","config","设置"]}];function RM(e,t){if(t<=0)return!0;const n=e[t-1]??"";return n===" "||n==="-"||n==="/"||n==="."||n==="_"}function Mg(e,t){const n=t.trim().toLowerCase();if(!n)return 0;const r=e.toLowerCase();if(!r)return null;let o=0,a=0,s=0,i=-1;for(let l=0;l<n.length;l+=1){const u=n[l];if(u===" ")continue;let d=-1;for(let m=a;m<r.length;m+=1)if(r[m]===u){d=m;break}if(d<0)return null;i<0&&(i=d),s=d===a?s+1:1,o+=10+s*6,RM(e,d)&&(o+=12),a=d+1}return o-=i*2,o-=Math.floor((r.length-n.length)/4),o}function LM(e,t){const n=t.trim();if(!n)return[...e];const r=[];return e.forEach((o,a)=>{const s=Mg(o.title,n);if(s!==null){r.push({command:o,score:s,keywordOnly:!1,index:a});return}let i=null;for(const l of o.keywords??[]){const u=Mg(l,n);u!==null&&(i===null||u>i)&&(i=u)}i!==null&&r.push({command:o,score:i,keywordOnly:!0,index:a})}),r.sort((o,a)=>Number(o.keywordOnly)-Number(a.keywordOnly)||a.score-o.score||o.index-a.index),r.map(o=>o.command)}function jM(e){return PM.map(t=>({group:t,label:EM[t],commands:e.filter(n=>n.group===t)})).filter(t=>t.commands.length>0)}const $M=["aria-label"],NM={class:"command-palette-search"},OM=["placeholder"],DM={class:"command-palette-count","aria-hidden":"true"},FM={class:"command-palette-group-label"},BM=["aria-selected","onClick"],UM={class:"command-palette-row-title"},zM={key:0,class:"command-palette-row-shortcut"},HM={key:0,class:"command-palette-empty"},WM=hn({__name:"CommandPalette",props:{commands:{}},emits:["close","run"],setup(e,{emit:t}){const n=e,r=t,{t:o}=co(),a=k(""),s=k(0),i=k(null),l=k(null),u=G(()=>LM(n.commands,a.value)),d=G(()=>jM(u.value)),m=G(()=>d.value.flatMap(E=>E.commands));tt(u,()=>{s.value=0}),tt(s,async()=>{var W;await Mt();const N=Array.from(((W=l.value)==null?void 0:W.querySelectorAll(".command-palette-row"))??[])[s.value];N instanceof HTMLElement&&N.scrollIntoView({block:"nearest"})});function f(E){return m.value.indexOf(E)}function v(E){const N=m.value.length;N!==0&&(s.value=(s.value+E+N)%N)}function T(E){r("run",E.id)}function S(){const E=m.value[s.value];E&&T(E)}function R(E){if(E.key==="ArrowDown"){E.preventDefault(),v(1);return}if(E.key==="ArrowUp"){E.preventDefault(),v(-1);return}if(E.key==="Tab"){E.preventDefault(),v(E.shiftKey?-1:1);return}if(E.key==="Enter"){E.preventDefault(),S();return}E.key==="Escape"&&(E.preventDefault(),r("close"))}return ss(async()=>{var E;await Mt(),(E=i.value)==null||E.focus()}),(E,N)=>(_(),Ze(Qs,{to:"body"},[w("div",{class:"command-palette-backdrop",role:"presentation",onClick:N[2]||(N[2]=W=>r("close"))},[w("section",{class:"command-palette",role:"dialog","aria-modal":"true","aria-label":g(o)("Command palette"),onClick:N[1]||(N[1]=pt(()=>{},["stop"]))},[w("div",NM,[Fe(rc,{class:"command-palette-search-icon"}),_n(w("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":N[0]||(N[0]=W=>a.value=W),class:"command-palette-input",type:"text",role:"combobox","aria-expanded":"true","aria-controls":"command-palette-list",placeholder:g(o)("Type a command..."),autocomplete:"off",spellcheck:"false",onKeydown:R},null,40,OM),[[Ln,a.value]]),w("span",DM,D(u.value.length)+"/"+D(n.commands.length),1)]),w("div",{id:"command-palette-list",ref_key:"listRef",ref:l,class:"command-palette-list",role:"listbox"},[(_(!0),B(rt,null,Wt(d.value,W=>(_(),B(rt,{key:W.group},[w("div",FM,D(g(o)(W.label)),1),(_(!0),B(rt,null,Wt(W.commands,L=>(_(),B("button",{key:L.id,class:ct(["command-palette-row",{"is-active":f(L)===s.value}]),type:"button",tabindex:"-1",role:"option","aria-selected":f(L)===s.value,onClick:fe=>T(L)},[w("span",UM,D(g(o)(L.title)),1),L.shortcut?(_(),B("span",zM,D(L.shortcut),1)):pe("",!0)],10,BM))),128))],64))),128)),u.value.length===0?(_(),B("p",HM,D(g(o)("No matching commands")),1)):pe("",!0)],512)],8,$M)])]))}}),qM=wt(WM,[["__scopeId","data-v-d7a0f5d2"]]),GM="Mod",kw=[{id:"global",label:"Global",entries:[{id:"global.palette",keys:["Mod","/"],label:"Open the command palette"},{id:"global.sidebar",keys:["Mod","B"],label:"Toggle the sidebar"},{id:"global.terminal",keys:["Mod","J"],label:"Toggle the terminal panel"},{id:"global.dismiss",keys:["Esc"],label:"Close dialogs and popovers"}]},{id:"composer",label:"Composer",entries:[{id:"composer.send-enter",keys:["Enter"],label:"Send the message",note:'When "send with Enter" is on'},{id:"composer.send-mod-enter",keys:["Mod","Enter"],label:"Send the message",note:'When "send with Enter" is off'},{id:"composer.newline",keys:["Shift","Enter"],label:"Insert a line break"},{id:"composer.slash",keys:["/"],label:"Open the slash command menu"},{id:"composer.mention",keys:["@"],label:"Mention a file"},{id:"composer.move",keys:["↑"],alsoKeys:["↓"],label:"Move through the menu"},{id:"composer.accept",keys:["Enter"],alsoKeys:["Tab"],label:"Accept the highlighted suggestion"},{id:"composer.dismiss",keys:["Esc"],label:"Dismiss the menu"}]},{id:"navigation",label:"Navigation",entries:[{id:"navigation.move",keys:["↑"],alsoKeys:["↓"],label:"Move the selection"},{id:"navigation.activate",keys:["Enter"],alsoKeys:["Space"],label:"Activate the focused item"},{id:"navigation.ends",keys:["Home"],alsoKeys:["End"],label:"Jump to the first or last item"}]}];function VM(e,t){return e.map(n=>n===GM?t?"⌘":"Ctrl":t&&n==="Shift"?"⇧":n)}function Rg(e,t){return VM(e,t).join(t?"":" + ")}function KM(e,t){const n=[Rg(e.keys,t)];return e.alsoKeys&&e.alsoKeys.length>0&&n.push(Rg(e.alsoKeys,t)),n.join(" / ")}function YM(e=kw){return e.reduce((t,n)=>t+n.entries.length,0)}const JM=["aria-label"],QM={class:"shortcut-help-header"},XM={class:"shortcut-help-title"},ZM={class:"shortcut-help-count","aria-hidden":"true"},eR=["aria-label","title"],tR={class:"shortcut-help-body"},nR={class:"shortcut-help-group-label"},rR={class:"shortcut-help-list"},oR={class:"shortcut-help-keys"},aR={class:"shortcut-help-key"},sR={class:"shortcut-help-label"},iR={class:"shortcut-help-label-text"},lR={key:0,class:"shortcut-help-note"},uR={class:"shortcut-help-footer"},cR=hn({__name:"ShortcutHelpPanel",props:{isMac:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=co(),a=kw,s=YM(),i=k(null);return ss(async()=>{var l;await Mt(),(l=i.value)==null||l.focus()}),(l,u)=>(_(),Ze(Qs,{to:"body"},[w("div",{class:"shortcut-help-backdrop",role:"presentation",onClick:u[2]||(u[2]=d=>r("close"))},[w("section",{class:"shortcut-help",role:"dialog","aria-modal":"true","aria-label":g(o)("Keyboard shortcuts"),onClick:u[1]||(u[1]=pt(()=>{},["stop"]))},[w("header",QM,[w("h2",XM,D(g(o)("Keyboard shortcuts")),1),w("span",ZM,D(g(s)),1),w("button",{ref_key:"closeButtonRef",ref:i,class:"shortcut-help-close",type:"button","aria-label":g(o)("Close"),title:g(o)("Close"),onClick:u[0]||(u[0]=d=>r("close"))},[Fe(kc,{class:"shortcut-help-close-icon"})],8,eR)]),w("div",tR,[(_(!0),B(rt,null,Wt(g(a),d=>(_(),B("section",{key:d.id,class:"shortcut-help-group"},[w("h3",nR,D(g(o)(d.label)),1),w("dl",rR,[(_(!0),B(rt,null,Wt(d.entries,m=>(_(),B("div",{key:m.id,class:"shortcut-help-row"},[w("dt",oR,[w("kbd",aR,D(g(KM)(m,n.isMac)),1)]),w("dd",sR,[w("span",iR,D(g(o)(m.label)),1),m.note?(_(),B("span",lR,D(g(o)(m.note)),1)):pe("",!0)])]))),128))])]))),128))]),w("footer",uR,D(g(o)("Press Esc to close")),1)],8,JM)])]))}}),dR=wt(cR,[["__scopeId","data-v-31a7bebc"]]),Lg=.0025,rf=3,jg=2,fR=256;function hR(e){var ye;const t=k("idle"),n=k(typeof navigator<"u"&&!!((ye=navigator.mediaDevices)!=null&&ye.getUserMedia)),r=k(0),o=k(null);let a=null,s=null,i=[],l=null,u=null,d=null,m=null,f=[],v=!1,T=!1,S=null;function R(){S&&(S.abort(),S=null),t.value==="transcribing"&&(t.value="idle")}function E(){const ee=o.value;if(!ee||typeof window>"u")return;const ve=ee.getContext("2d");if(!ve)return;const ne=Math.max(1,Math.floor(ee.clientWidth)),Ae=Math.max(1,Math.floor(ee.clientHeight||36)),De=window.devicePixelRatio||1,$e=Math.max(1,Math.floor(ne*De)),je=Math.max(1,Math.floor(Ae*De));(ee.width!==$e||ee.height!==je)&&(ee.width=$e,ee.height=je),ve.setTransform(De,0,0,De,0,0),ve.clearRect(0,0,ne,Ae);const Ce=Math.max(12,Math.floor(ne/(rf+jg))),Se=f.slice(-Ce),xe=Math.max(0,Ce-Se.length),Ee=Ae/2,Je=getComputedStyle(ee).color||"#000000";for(let Xe=0;Xe<Ce;Xe+=1){const lt=Se[Xe-xe]??0,F=Math.max(.08,Math.min(1,lt*18))*Ee,oe=Xe*(rf+jg);ve.globalAlpha=lt<=Lg?.35:1,ve.fillStyle=Je,ve.fillRect(oe,Ee-F,rf,F*2)}ve.globalAlpha=1}function N(){f=[],r.value=0,E()}function W(){d&&(d.disconnect(),d.onaudioprocess=null,d=null),u&&(u.disconnect(),u=null),l&&(l.close(),l=null),m=null}function L(ee){if(typeof window>"u")return;const ve=window.webkitAudioContext,ne=window.AudioContext??ve;ne&&(W(),N(),l=new ne,u=l.createMediaStreamSource(ee),d=l.createScriptProcessor(2048,1,1),m=performance.now(),d.onaudioprocess=Ae=>{const De=Ae.inputBuffer.getChannelData(0);let $e=0;for(let je=0;je<De.length;je+=1){const Ce=Math.abs(De[je]??0);$e+=Ce<Lg?0:Ce}f.push($e/De.length),f.length>fR&&f.shift(),m!==null&&(r.value=Math.max(0,performance.now()-m)),E()},u.connect(d),d.connect(l.destination),E())}async function fe(){var ee;if(t.value==="transcribing"&&R(),!(t.value!=="idle"||!n.value||v)){v=!0,T=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=ve=>{ve.data.size>0&&i.push(ve.data)},a.onstop=()=>{var Ae;const ve=i,ne=(a==null?void 0:a.mimeType)||((Ae=ve[0])==null?void 0:Ae.type)||"audio/webm";we(),ie(ve,ne)},L(s),a.start(250),t.value="recording",T&&le()}catch(ve){we(),t.value="idle",(ee=e.onError)==null||ee.call(e,ve)}finally{v=!1}}}function le(){if(v&&t.value==="idle"){T=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function Y(){T=!1,R(),we(),t.value="idle"}async function ie(ee,ve){var De,$e,je,Ce,Se;if(ee.length===0){(De=e.onEmpty)==null||De.call(e),t.value="idle";return}const ne=new Blob(ee,{type:ve});t.value="transcribing";let Ae=null;try{const xe=ve.split(/[/;]/)[1]??"webm",Ee=new FormData;Ee.append("file",ne,`codex.${xe}`);const Je=(($e=e.getLanguage)==null?void 0:$e.call(e).trim())??"";Je&&Je.toLowerCase()!=="auto"&&Ee.append("language",Je),Ae=new AbortController,S=Ae;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:Ee,signal:Ae.signal}),lt=await Xe.text();let ce=null;try{ce=lt.trim()?JSON.parse(lt):null}catch{ce=null}if(!Xe.ok){const oe=(je=ce==null?void 0:ce.error)==null?void 0:je.trim(),se=lt.trim();throw new Error(oe||se||`Transcription failed: ${Xe.status}`)}const F=((ce==null?void 0:ce.text)??"").trim();F.length>0?e.onTranscript(F):(Ce=e.onEmpty)==null||Ce.call(e)}catch(xe){if(xe instanceof DOMException&&xe.name==="AbortError")return;(Se=e.onError)==null||Se.call(e,xe)}finally{Ae&&S===Ae&&(S=null),t.value==="transcribing"&&(t.value="idle")}}function we(){W(),N(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(ee=>ee.stop()),s=null),i=[]}ti(()=>{Y()});function Pe(){if(t.value==="recording"){le();return}(t.value==="idle"||t.value==="transcribing")&&fe()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:fe,stopRecording:le,toggleRecording:Pe,cancel:Y}}const pR={},mR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function gR(e,t){return _(),B("svg",mR,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const vR=wt(pR,[["render",gR]]),yR={},wR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function bR(e,t){return _(),B("svg",wR,[...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 TR=wt(yR,[["render",bR]]),kR={},SR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function CR(e,t){return _(),B("svg",SR,[...t[0]||(t[0]=[w("path",{d:"M8 4v4H4"},null,-1),w("path",{d:"M16 4v4h4"},null,-1),w("path",{d:"M8 20v-4H4"},null,-1),w("path",{d:"M16 20v-4h4"},null,-1)])])}const xR=wt(kR,[["render",CR]]),IR={},AR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function _R(e,t){return _(),B("svg",AR,[...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 PR=wt(IR,[["render",_R]]),ER=["aria-label"],MR=8,yi=8,RR=hn({__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=k(null),s=k(null),i=k({});let l=!1;const u=G(()=>r.open),d=G(()=>r.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function m(E,N,W){return Math.min(Math.max(N,E),W)}function f(){var Pe,ye;if(!u.value)return;const E=a.value;if(!E||typeof window>"u")return;const N=E.getBoundingClientRect(),W=window.innerWidth,L=window.innerHeight,fe=Math.max(0,W-yi*2),le=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,fe),Y=((ye=s.value)==null?void 0:ye.offsetHeight)??0;let ie;r.align==="end"?ie=N.right-le:r.align==="center"?ie=N.left+(N.width-le)/2:ie=N.left,ie=m(ie,yi,Math.max(yi,W-le-yi));let we=N.top-Y-MR;we=m(we,yi,Math.max(yi,L-Y-yi)),i.value={position:"fixed",left:`${ie}px`,right:"auto",top:`${we}px`,bottom:"auto",width:`${le}px`}}function v(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function T(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}tt(u,E=>{if(!E){T(),i.value={};return}v(),Mt(()=>{var N;(N=s.value)==null||N.focus(),f(),window.requestAnimationFrame(f)})}),ti(()=>{T()});function S(){o("update:open",!r.open)}function R(E){var Y,ie,we;if(E.key==="Escape"){o("update:open",!1);return}const N=s.value;if(!N)return;const W=Array.from(N.querySelectorAll("button")).filter(Pe=>!Pe.disabled&&Pe.offsetParent!==null);if(W.length===0)return;if(E.key==="Home"){E.preventDefault(),(Y=W[0])==null||Y.focus();return}if(E.key==="End"){E.preventDefault(),(ie=W[W.length-1])==null||ie.focus();return}if(E.key!=="ArrowDown"&&E.key!=="ArrowUp")return;E.preventDefault();let L=W.findIndex(Pe=>Pe===document.activeElement);L<0&&(L=E.key==="ArrowDown"?-1:0);const fe=E.key==="ArrowDown"?1:-1,le=(L+fe+W.length)%W.length;(we=W[le])==null||we.focus()}return t({root:a}),(E,N)=>(_(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[kr(E.$slots,"trigger",{toggle:S,isOpen:u.value},void 0),Fe(gu,{name:"composer-popover"},{default:ft(()=>[u.value?(_(),B("div",{key:0,ref_key:"panelRef",ref:s,class:ct(["composer-popover-panel",[d.value,e.panelClass]]),style:oo(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:R},[kr(E.$slots,"default",{},void 0,!0)],46,ER)):pe("",!0)]),_:3})],512))}}),Cc=wt(RR,[["__scopeId","data-v-1fb1570a"]]),LR=["aria-label"],jR={class:"composer-popover-group-label"},$R=["aria-selected","onMousedown"],NR={class:"thread-composer-slash-body"},OR={class:"thread-composer-slash-name"},DR={class:"thread-composer-slash-desc"},FR={class:"thread-composer-slash-kind"},BR={class:"composer-popover-group-label composer-popover-group-label--skills"},UR=["aria-selected","onMousedown"],zR=["aria-label","title"],HR={class:"thread-composer-slash-body thread-composer-slash-body--skill"},WR={class:"thread-composer-slash-skill-name"},qR={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},GR=hn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,{t:o}=co(),a=k(null),s=G(()=>n.commands.filter(m=>m.group!=="skill")),i=G(()=>n.commands.filter(m=>m.group==="skill"));tt(()=>n.highlightedIndex,async()=>{var m,f;await Mt(),(f=(m=a.value)==null?void 0:m.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(m){return o(m==="rpc"?"Action":m==="text"?"Prompt":m==="skill"?"Skill":"Local")}function u(m){return m==="system"?"S":m==="repo"?"R":m==="plugin"?"P":"U"}function d(m){return o(m==="system"?"System":m==="repo"?"Repo":m==="plugin"?"Plugin":"User")}return(m,f)=>(_(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":g(o)("Commands")},[s.value.length>0?(_(),B(rt,{key:0},[w("div",jR,D(g(o)("Commands")),1),(_(!0),B(rt,null,Wt(s.value,(v,T)=>(_(),B("button",{key:v.id,class:ct(["thread-composer-slash-row",{"is-active":T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":T===e.highlightedIndex,onMousedown:pt(S=>r("select",v),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",NR,[w("span",OR,D(v.id),1),w("span",DR,D(g(o)(v.description)),1)]),w("span",FR,D(l(v.kind)),1)],42,$R))),128))],64)):pe("",!0),i.value.length>0?(_(),B(rt,{key:1},[w("div",BR,D(g(o)("Skills")),1),(_(!0),B(rt,null,Wt(i.value,(v,T)=>(_(),B("button",{key:v.skillPath||v.id,class:ct(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+T===e.highlightedIndex,onMousedown:pt(S=>r("select",v),["prevent"])},[w("span",{class:ct(["thread-composer-slash-skill-icon",`is-${v.scope||"user"}`]),"aria-label":d(v.scope),title:d(v.scope)},D(u(v.scope)),11,zR),w("span",HR,[w("span",WR,D(v.displayName||v.id),1),w("span",qR,D(v.description),1)])],42,UR))),128))],64)):pe("",!0)],8,LR))}}),VR=wt(GR,[["__scopeId","data-v-bc518c3f"]]),KR=["data-streaming"],YR=["aria-expanded"],JR={class:"thread-composer-plan-panel-title"},QR={key:0,class:"thread-composer-plan-panel-badge"},XR={class:"thread-composer-plan-panel-progress"},ZR=["title"],eL=["data-status"],tL={class:"thread-composer-plan-panel-latest-text"},nL={class:"thread-composer-plan-panel-popover-content"},rL={class:"thread-composer-plan-panel-popover-scroll"},oL={class:"thread-composer-plan-panel-popover-head"},aL={class:"thread-composer-plan-panel-title"},sL={class:"thread-composer-plan-panel-progress"},iL={key:0,class:"thread-composer-plan-panel-popover-section"},lL={class:"thread-composer-plan-panel-section-label"},uL=["title"],cL={class:"thread-composer-plan-panel-popover-section"},dL={class:"thread-composer-plan-panel-section-label"},fL={class:"thread-composer-plan-panel-steps"},hL=["data-status"],pL=["data-status"],mL=["title"],gL={class:"thread-composer-plan-panel-popover-footer"},vL=["disabled","data-state"],yL=hn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,r=t,{t:o}=co(),a=k(!1),s=G(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(v=>v.status==="completed").length}),i=G(()=>{var f;const m=((f=n.planPanel)==null?void 0:f.steps)??[];if(m.length===0)return null;for(let v=m.length-1;v>=0;v-=1){const T=m[v];if(T.status==="inProgress")return T}return m[m.length-1]}),l=G(()=>{var T,S,R;const m=((S=(T=n.planPanel)==null?void 0:T.explanation)==null?void 0:S.trim())??"";if(!m)return"";const f=((R=m.split(/[。!?!?\n]/u)[0])==null?void 0:R.trim())??"";if(!f)return m;const v=80;return f.length>v?`${f.slice(0,v)}…`:f});function u(m){switch(m){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function d(){a.value=!1,r("implement-plan")}return(m,f)=>(_(),B("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Fe(Cc,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":g(o)("Plan"),"onUpdate:open":f[1]||(f[1]=v=>a.value=v)},{trigger:ft(()=>{var v,T;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=S=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",JR,D(g(o)("Plan")),1),e.planPanel.streaming?(_(),B("span",QR,D(g(o)("Updating")),1)):pe("",!0),w("span",XR,D(s.value)+"/"+D(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((v=i.value)==null?void 0:v.step)??""},[i.value?(_(),B("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},D(u(i.value.status)),9,eL)):pe("",!0),w("span",tL,D(((T=i.value)==null?void 0:T.step)??""),1)],8,ZR),Fe(Ys,{class:"thread-composer-plan-panel-chevron"})],8,YR)]}),default:ft(()=>[w("div",nL,[w("div",rL,[w("header",oL,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",aL,D(g(o)("Plan")),1),w("span",sL,D(s.value)+"/"+D(e.planPanel.steps.length),1)]),e.planPanel.explanation?(_(),B("section",iL,[w("p",lL,D(g(o)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},D(l.value),9,uL)])):pe("",!0),w("section",cL,[w("p",dL,D(g(o)("Steps"))+" ("+D(e.planPanel.steps.length)+")",1),w("ol",fL,[(_(!0),B(rt,null,Wt(e.planPanel.steps,(v,T)=>(_(),B("li",{key:`composer-plan-${e.planPanel.id}-${T}`,class:"thread-composer-plan-panel-step","data-status":v.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":v.status},D(u(v.status)),9,pL),w("span",{class:"thread-composer-plan-panel-step-text",title:v.step},D(v.step),9,mL)],8,hL))),128))])])]),w("footer",gL,[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},D(e.planPanel.implemented?g(o)("Plan executed"):e.planPanel.streaming?g(o)("Implementing…"):g(o)("Implement plan")),9,vL)])])]),_:1},8,["open","aria-label"])],8,KR))}}),wL=wt(yL,[["__scopeId","data-v-61a093d9"]]),bL={key:0,class:"thread-composer-attachments"},TL=["src"],kL=["src","alt"],SL=["aria-label","disabled","onClick"],CL={key:1,class:"thread-composer-folder-chips"},xL=["title"],IL={class:"thread-composer-folder-chip-meta"},AL=["aria-label","disabled","onClick"],_L={key:2,class:"thread-composer-file-chips"},PL=["title"],EL=["aria-label","disabled","onClick"],ML={key:3,class:"thread-composer-skill-chips"},RL=["title","aria-label","onClick"],LL=["aria-label","onClick"],jL=hn({__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 u=l.trim();return u?!!(/^video\/|^data:video\//i.test(u)||r.test(u)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const u=l.trim();return u?u.endsWith("/SKILL.md")?u:`${u.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const u=s(l.path);!u||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(u)}`,"_blank","noopener,noreferrer")}return(l,u)=>(_(),B(rt,null,[e.selectedImages.length>0?(_(),B("div",bL,[(_(!0),B(rt,null,Wt(e.selectedImages,d=>(_(),B("div",{key:d.id,class:"thread-composer-attachment"},[o(d.url)?(_(),B("video",{key:0,class:"thread-composer-attachment-image",src:d.url,controls:"",preload:"metadata"},null,8,TL)):(_(),B("img",{key:1,class:"thread-composer-attachment-image",src:d.url,alt:d.name||"Selected image"},null,8,kL)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${d.name||"image"}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-image",d.id)}," x ",8,SL)]))),128))])):pe("",!0),e.folderUploadGroups.length>0?(_(),B("div",CL,[(_(!0),B(rt,null,Wt(e.folderUploadGroups,d=>(_(),B("span",{key:d.id,class:"thread-composer-folder-chip"},[Fe(Mh,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:d.name},D(d.name),9,xL),w("span",IL,[d.isUploading?(_(),B(rt,{key:0},[Gs(D(a(d))+"% uploading ("+D(d.processed)+"/"+D(d.total)+") ",1)],64)):(_(),B(rt,{key:1},[Gs(D(d.filePaths.length)+" file"+D(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:m=>n("remove-folder",d.id)},"×",8,AL)]))),128))])):pe("",!0),e.standaloneFileAttachments.length>0?(_(),B("div",_L,[(_(!0),B(rt,null,Wt(e.standaloneFileAttachments,d=>(_(),B("span",{key:d.fsPath,class:"thread-composer-file-chip"},[Fe(bl,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:d.fsPath},D(d.label),9,PL),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${d.label}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-file",d.fsPath)},"×",8,EL)]))),128))])):pe("",!0),e.selectedSkills.length>0?(_(),B("div",ML,[(_(!0),B(rt,null,Wt(e.selectedSkills,d=>(_(),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:m=>i(d)},D(d.displayName||d.name),9,RL),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${d.displayName||d.name}`,onClick:m=>n("remove-skill",d.path)},"×",8,LL)]))),128))])):pe("",!0)],64))}}),$L=wt(jL,[["__scopeId","data-v-7ba5474c"]]),NL=hn({__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}=co(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=G(()=>{var R;const T=(R=n.modelReasoningEfforts)==null?void 0:R[n.selectedModel];if(T===void 0)return a;const S=new Set(T);return a.filter(E=>S.has(E.value))});function i(T){return T.trim().replace(/^gpt/i,"GPT")}const l=G(()=>n.models.map(T=>({value:T,label:i(T)}))),u=G(()=>n.disabled||!n.activeThreadId),d=G(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),m=G(()=>n.selectedSpeedMode==="fast"&&d.value);function f(T){r("update:selected-model",T)}function v(T){r("update:selected-reasoning-effort",T)}return(T,S)=>(_(),B(rt,null,[Fe(Ai,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":m.value?Jc:null,placeholder:g(o)("Model"),"open-direction":"up",variant:"pill",disabled:u.value||e.models.length===0,"enable-search":"","search-placeholder":g(o)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Fe(Ai,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:g(o)("Thinking"),"open-direction":"up",variant:"pill",disabled:u.value||s.value.length===0,"onUpdate:modelValue":v},null,8,["model-value","options","placeholder","disabled"])],64))}}),OL=wt(NL,[["__scopeId","data-v-7df9181e"]]),DL=["aria-label","disabled"],FL=["disabled"],BL=["disabled"],UL=["disabled"],zL={class:"thread-composer-attach-mode"},HL={class:"thread-composer-attach-mode-label"},WL={class:"thread-composer-attach-mode-buttons"},qL=["disabled"],GL=["disabled"],VL={class:"thread-composer-attach-mode"},KL={class:"thread-composer-attach-mode-label"},YL={class:"thread-composer-attach-mode-buttons"},JL=["disabled","onClick"],QL={class:"thread-composer-attach-mode"},XL={class:"thread-composer-attach-mode-label"},ZL={class:"thread-composer-attach-mode-buttons"},ej=["disabled","onClick"],tj={key:0,class:"thread-composer-menu-error",role:"alert"},nj={key:0,class:"thread-composer-approval-tip",role:"status"},rj=hn({__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}=co();function o(){n("toggle")}function a(m){n("set-active-mode",m)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function u(m){n("select-collaboration-mode",m)}function d(m){n("select-approval-policy",m)}return(m,f)=>(_(),Ze(Cc,{open:e.open,align:"start",width:"lg","aria-label":g(r)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=v=>n("update:open",v))},{trigger:ft(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":g(r)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:o}," + ",8,DL)]),default:ft(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},D(g(r)("Add photos & files")),9,FL),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},D(g(r)("Add folder")),9,BL),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},D(g(r)("Take photo")),9,UL),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",zL,[w("span",HL,D(g(r)("In-progress send")),1),w("div",WL,[w("button",{class:ct(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=v=>a("steer"))},D(g(r)("Steer")),11,qL),w("button",{class:ct(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=v=>a("queue"))},D(g(r)("Queue")),11,GL)])]),e.isMobile?(_(),B(rt,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",VL,[w("span",KL,D(g(r)("Plan mode")),1),w("div",YL,[(_(!0),B(rt,null,Wt(e.collaborationModeChoices,v=>(_(),B("button",{key:`mobile-plan-${v.value}`,class:ct(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===v.value}]),type:"button",disabled:v.disabled||e.isComposerConfigDisabled,onClick:T=>u(v.value)},D(g(r)(v.labelKey)),11,JL))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",QL,[w("span",XL,D(g(r)("Approval policy")),1),w("div",ZL,[(_(!0),B(rt,null,Wt(e.approvalPolicyChoices,v=>(_(),B("button",{key:`mobile-approval-${v.value}`,class:ct(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===v.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:T=>d(v.value)},D(g(r)(v.label)),11,ej))),128))])]),e.approvalPolicyError?(_(),B("p",tj,D(e.approvalPolicyError),1)):pe("",!0),Fe(gu,{name:"approval-tip"},{default:ft(()=>[e.approvalPolicyNotice?(_(),B("span",nj,D(e.approvalPolicyNotice),1)):pe("",!0)]),_:1})],64)):pe("",!0)]),_:1},8,["open","aria-label"]))}}),oj=wt(rj,[["__scopeId","data-v-4d71ea67"]]),aj=/(^|\s)(\/[a-zA-Z]*)$/,$g=[{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 sj(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 ij(e){const t=e.match(aj);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function lj(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 uj={class:"thread-composer-main"},cj={class:"thread-composer-input-row"},dj={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},fj={class:"thread-composer-drop-overlay-copy"},hj={key:1,class:"composer-popover"},pj=["onMousedown"],mj={key:1,class:"thread-composer-file-mention-icon-markdown"},gj={class:"thread-composer-file-mention-text"},vj={class:"thread-composer-file-mention-name"},yj={key:0,class:"thread-composer-file-mention-dir"},wj={key:1,class:"thread-composer-file-mention-empty"},bj={key:2,class:"thread-composer-file-mention-empty"},Tj=["placeholder","disabled"],kj=["aria-label","title","disabled"],Sj={class:"thread-composer-actions"},Cj=["aria-label","title","disabled"],xj={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},Ij=["aria-label","title","disabled"],Aj={key:0,class:"thread-composer-secondary"},_j=["aria-label","disabled"],Pj={class:"thread-composer-plan-trigger-label"},Ej=["aria-checked","disabled","onClick"],Mj={class:"thread-composer-menu-item-copy"},Rj={class:"thread-composer-menu-item-title"},Lj={key:0,class:"thread-composer-menu-item-sub"},jj={key:1,class:"thread-composer-menu-item-hint"},$j={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},Nj=["aria-label","disabled"],Oj={class:"thread-composer-approval-trigger-label"},Dj=["aria-checked","disabled","onClick"],Fj={class:"thread-composer-menu-item-copy"},Bj={class:"thread-composer-menu-item-title"},Uj={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},zj={key:0,class:"thread-composer-menu-error",role:"alert"},Hj={key:0,class:"thread-composer-approval-tip",role:"status"},Wj=["title","aria-label"],qj={class:"thread-composer-context-usage-value"},Gj={key:0,class:"thread-composer-context-usage-compact"},Vj=["disabled"],Kj=["disabled"],Yj=["disabled"],of=12e3,Jj=2e3,Qj="codex-web-local.thread-draft.v1.",Xj=hn({__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}=co(),s=k(""),i=k([]),l=k([]),u=k([]),d=k([]),m=k(""),f=k(0),v=k(null),T=k(!1),{state:S,cancel:R}=hR({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:I=>{if(s.value=s.value?`${s.value}
58
- ${I}`:I,m.value="",r.dictationAutoSend!==!1){const O=r.isTurnInProgress?Oe.value:"steer";Yt(O);return}Mt(()=>{var O;return(O=L.value)==null?void 0:O.focus()})},onEmpty:()=>{m.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:I=>{if(I instanceof DOMException&&I.name==="NotAllowedError"){m.value="Microphone access was denied.";return}m.value=I instanceof Error?I.message:"Dictation failed."}}),E=k(null),N=k(null),W=k(null),L=k(null),{isMobile:fe}=Sh(),le=k(!1),Y=k(!1),ie=k(!1),we=k(null),Pe=k(""),ye=k([]),ee=k(!1),ve=k(0),ne=k(!1),Ae=k(null),De=k(""),$e=k(0),je=k($g),Ce=G(()=>[...$g,...sj(r.skills??[])]),Se=k(!1),xe=k(!1);let Ee=!1;const Je=k(0);let Xe=0,lt=null,ce="",F=!1,oe=0,se=0;const Le=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let We="";const P=G(()=>{const I=new Set((r.collaborationModes??[]).map(O=>O.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:!I.has("execplans")}]}),$=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],q=G(()=>{const I=P.value.find(O=>O.value===r.selectedCollaborationMode);return a(I?I.labelKey:"Plan mode")}),ue=G(()=>{const I=$.find(O=>O.value===r.approvalPolicy);return a(I?I.label:"Approval policy")}),re=G(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),ae=G(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||re.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||u.value.length>0),_e=G(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||u.value.length>0||d.value.length>0),Ne=G(()=>{const I=new Set;for(const O of d.value)for(const K of O.filePaths)I.add(K);return u.value.filter(O=>!I.has(O.fsPath))}),Ie=G(()=>r.disabled||!r.activeThreadId||r.externalSessionActive===!0),he=G(()=>r.disabled||!r.activeThreadId),Ke=G(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),Oe=k(Ke.value),qe=G(()=>S.value==="recording"),Ge=G(()=>r.activeThreadId?re.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),dt=G(()=>s.value.trim().length>0||i.value.length>0||u.value.length>0),bt=G(()=>s.value.split(`
59
- `).length),ot=G(()=>Se.value||bt.value>=6||xe.value),ut=G(()=>Bo(r.threadTokenUsage??null)),J=G(()=>{var I;return((I=ut.value)==null?void 0:I.summaryText)??""}),de=G(()=>{var I;return((I=ut.value)==null?void 0:I.tooltipText)??""}),ke=G(()=>{var I;return((I=ut.value)==null?void 0:I.tone)??"healthy"});function Be(){ke.value!=="healthy"&&o("compact-context")}function vt(I){if(!Number.isFinite(I))return"0";const O=Math.abs(I);return O>=1e6?`${(O>=1e7?(I/1e6).toFixed(0):(I/1e6).toFixed(1)).replace(/\.0$/,"")}M`:O>=1e3?`${(O>=1e5?(I/1e3).toFixed(0):(I/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(I))}function yt(I){const O=Math.max(0,I.inputTokens-I.cachedInputTokens),K=[`${vt(I.totalTokens)} ${a("total")}`,`${vt(O)} ${a("input")}`];return I.cachedInputTokens>0&&K.push(`${vt(I.cachedInputTokens)} ${a("cached")}`),I.outputTokens>0&&K.push(`${vt(I.outputTokens)} ${a("output")}`),I.reasoningOutputTokens>0&&K.push(`${vt(I.reasoningOutputTokens)} ${a("reasoning")}`),K.join(" · ")}function Bt(I,O){if(!Number.isFinite(I)||!Number.isFinite(O)||O<=0)return 0;if(O<=of){const $t=Math.max(0,O-Math.max(0,I));return Math.max(0,Math.min(100,Math.round($t/O*100)))}const K=O-of,Te=Math.max(0,I-of),He=Math.max(0,K-Te);return Math.max(0,Math.min(100,Math.round(He/K*100)))}function Bo(I){if(!I)return null;const O=I.modelContextWindow??null;if(typeof O!="number"||!Number.isFinite(O)||O<=0)return null;const K=Math.max(0,I.last.totalTokens),Te=Bt(K,O),He=Math.max(0,Math.min(100,100-Te)),$t=Te<=15?"danger":Te<=35?"warning":"healthy";return{summaryText:`${Te}% · ${vt(K)} / ${vt(O)}`,tooltipText:[`${a("Context window")}: ${Te}% ${a("left")} (${He}% ${a("used")})`,`${a("In context")}: ${K.toLocaleString()} / ${O.toLocaleString()} tokens`,`${a("Last turn")}: ${yt(I.last)}`,`${a("Session total")}: ${yt(I.total)}`].join(`
60
- `),percentRemaining:Te,tone:$t}}function Yt(I="steer"){var K;const O=s.value.trim();if(ae.value){if(o("submit",{text:O,imageUrls:i.value.map(Te=>Te.url),fileAttachments:[...u.value],skills:l.value.map(Te=>({name:Te.name,path:Te.path})),mode:I}),is(r.activeThreadId),ka(),Se.value=!1,d.value=[],le.value=!1,vn(),Le||fe.value){(K=L.value)==null||K.blur();return}Mt(()=>{var Te;return(Te=L.value)==null?void 0:Te.focus()})}}function fo(I){Oe.value=I}function er(I){Je.value+=1,s.value=I.text,i.value=I.imageUrls.map((O,K)=>({id:`queued-${Date.now()}-${K}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${K+1}`,url:O})),l.value=I.skills.map(O=>(r.skills??[]).find(K=>K.path===O.path)??{name:O.name,displayName:void 0,description:"",path:O.path}),u.value=I.fileAttachments.map(O=>({...O})),d.value=[],m.value="",v.value=null,f.value=0,le.value=!1,vn(),Ir(),se+=1}function ka(){er({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Se.value=!1}function ho(I){return`${Qj}${I}`}function ni(I){if(typeof window>"u")return null;const O=I.trim();if(!O)return null;try{const K=window.localStorage.getItem(ho(O));if(!K)return null;const Te=JSON.parse(K);return typeof Te=="string"?{text:Te,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Te.text=="string"?Te.text:"",imageUrls:Array.isArray(Te.imageUrls)?Te.imageUrls.filter(He=>typeof He=="string"):[],fileAttachments:Array.isArray(Te.fileAttachments)?Te.fileAttachments.filter(He=>!!He&&typeof He.label=="string"&&typeof He.path=="string"&&typeof He.fsPath=="string"):[],skills:Array.isArray(Te.skills)?Te.skills.filter(He=>!!He&&typeof He.name=="string"&&typeof He.path=="string"):[]}}catch{return null}}function Sa(I,O){if(typeof window>"u")return;const K=I.trim();if(K)try{if(O.text.trim().length>0||O.imageUrls.length>0||O.fileAttachments.length>0||O.skills.length>0){window.localStorage.setItem(ho(K),JSON.stringify(O));return}window.localStorage.removeItem(ho(K))}catch{}}function is(I){Sa(I,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Fr(){return{text:s.value,imageUrls:i.value.map(I=>I.url),fileAttachments:u.value.map(I=>({...I})),skills:l.value.map(I=>({name:I.name,path:I.path}))}}function ls(){o("interrupt")}function Br(){const I=L.value;if(!I){xe.value=!1;return}xe.value=I.scrollHeight>I.clientHeight+2}function Uo(){Ee||(Ee=!0,Mt(()=>{Ee=!1,Br()}))}function zo(){Ie.value||(Se.value=!Se.value,Uo(),Mt(()=>{var I;return(I=L.value)==null?void 0:I.focus()}))}function ri(I){o("update:selected-model",I)}function Ho(I){if(I===r.selectedCollaborationMode){Y.value=!1;return}o("update:selected-collaboration-mode",I),Y.value=!1}function Ur(I){if(I===r.selectedCollaborationMode){le.value=!1;return}o("update:selected-collaboration-mode",I),le.value=!1}function us(I){o("update:selected-reasoning-effort",I)}function Ca(I){r.approvalPolicy===I||r.isApprovalPolicySaving===!0||(o("update:approval-policy",I),o("save-approval-policy"))}function Wo(){r.dictationClickToToggle}function po(){Ie.value||(le.value=!le.value,Y.value=!1,ie.value=!1)}function mo(){he.value||(Y.value=!Y.value,le.value=!1,ie.value=!1)}function Sr(){he.value||(ie.value=!ie.value,le.value=!1,Y.value=!1)}function cs(){var I;(I=E.value)==null||I.click()}function xa(){var I;(I=N.value)==null||I.click()}function gt(){var I;(I=W.value)==null||I.click()}function Tt(I){const O=i.value.find(K=>K.id===I);if(O&&mn(O.url)){const K=tr(O.url);K&&en(K)}i.value=i.value.filter(K=>K.id!==I)}function Ct(I){l.value=l.value.filter(O=>O.path!==I)}function en(I){u.value=u.value.filter(O=>O.fsPath!==I)}function $n(I){const O=d.value.find(Te=>Te.id===I);if(!O)return;const K=new Set(O.filePaths);u.value=u.value.filter(Te=>!K.has(Te.fsPath)),d.value=d.value.filter(Te=>Te.id!==I)}function pn(I,O){const K=I.replace(/\\/g,"/");if(u.value.some($t=>$t.fsPath===K))return;const Te=K.split("/").filter(Boolean),He=(O==null?void 0:O.trim())||Te[Te.length-1]||K;u.value=[...u.value,{label:He,path:K,fsPath:K}]}function Cr(I){return I.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(I.name)}const hr=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function qo(I){return I.type.startsWith("video/")?!0:hr.test(I.name)}function mn(I){const O=I.trim();if(!O)return!1;if(O.startsWith("data:video/"))return!0;try{const K=new URL(O,window.location.href);return hr.test(K.pathname)?!0:K.pathname==="/codex-local-image"?hr.test(K.searchParams.get("path")??""):!1}catch{return hr.test(O)}}function tr(I){try{const O=new URL(I,window.location.href);return O.pathname!=="/codex-local-image"?"":decodeURIComponent(O.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function xr(I){return I?Array.from(I):[]}function Rt(I){return I!==se?!1:(f.value+=1,!0)}function go(I){I===se&&(f.value=Math.max(0,f.value-1))}function nr(I){if(I<=0)return;const O=v.value,K=O?O.succeeded+O.failed:0;if(!O||K>=O.total){v.value={total:I,succeeded:0,failed:0};return}v.value={...O,total:O.total+I}}function kn(I){const O=v.value;O&&(v.value={...O,succeeded:O.succeeded+(I==="success"?1:0),failed:O.failed+(I==="failure"?1:0)})}function zr(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Nn(I){const O=new Date,K=[O.getFullYear(),String(O.getMonth()+1).padStart(2,"0"),String(O.getDate()).padStart(2,"0"),String(O.getHours()).padStart(2,"0"),String(O.getMinutes()).padStart(2,"0"),String(O.getSeconds()).padStart(2,"0")].join("-"),Te=I.type.startsWith("image/")&&I.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${K}.${Te}`}function Pn(){const I=new Date;return`pasted-text-${[I.getFullYear(),String(I.getMonth()+1).padStart(2,"0"),String(I.getDate()).padStart(2,"0"),String(I.getHours()).padStart(2,"0"),String(I.getMinutes()).padStart(2,"0"),String(I.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Sn(I){return I.name.trim()?I:new File([I],Nn(I),{type:I.type||"image/png",lastModified:Date.now()})}async function Ia(I,O){if(Rt(O))try{const K=Sn(I),Te=await zu(K);if(O!==se)return;if(!Te){kn("failure");return}i.value=[...i.value,{id:zr(),name:K.name,url:`/codex-local-image?path=${encodeURIComponent(Te)}`}],kn("success")}catch{O===se&&kn("failure")}finally{go(O)}}async function pr(I,O){if(Rt(O))try{const K=await zu(I);if(O!==se)return;if(!K){kn("failure");return}pn(K),kn("success")}catch{O===se&&kn("failure")}finally{go(O)}}async function Hr(I,O){if(Rt(O))try{const K=Sn(I),Te=await zu(K);if(O!==se)return;if(!Te){kn("failure");return}const He=Te.replace(/\\/g,"/");i.value=[...i.value,{id:zr(),name:K.name,url:`/codex-local-image?path=${encodeURIComponent(He)}`}],pn(He),kn("success")}catch{O===se&&kn("failure")}finally{go(O)}}function Ut(I){const O=xr(I);if(O.length===0)return;nr(O.length),le.value=!1,vn();const K=se;for(const Te of O)Cr(Te)?Ia(Te,K):qo(Te)?Hr(Te,K):pr(Te,K)}function vo(){oe=0,T.value=!1}function Go(I){return I?Array.from(I.types??[]).includes("Files"):!1}async function Vo(I){if(!I||I.length===0)return;const O=Je.value,K=Array.from(I),He=(K[0].webkitRelativePath||K[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:K.length,processed:0,filePaths:[],isUploading:!0}];const xt=nn=>{O===Je.value&&(d.value=d.value.map(Jt=>Jt.id===$t?nn(Jt):Jt))};for(const nn of K)try{const Jt=await zu(nn);if(O!==Je.value)return;if(Jt){const Pr=nn.webkitRelativePath||nn.name;pn(Jt,Pr),xt(_a=>({..._a,processed:_a.processed+1,filePaths:[..._a.filePaths,Jt]}));continue}xt(Pr=>({...Pr,processed:Pr.processed+1}))}catch{xt(Jt=>({...Jt,processed:Jt.processed+1}))}xt(nn=>({...nn,isUploading:!1}))}function Cn(I){I&&(I.value="")}function Xt(I){const O=I.target;Ut((O==null?void 0:O.files)??null),Cn(O),le.value=!1}function mr(I){const O=I.target;Ut((O==null?void 0:O.files)??null),Cn(O),le.value=!1}function ln(I){const O=I.target;Vo((O==null?void 0:O.files)??null),Cn(O),le.value=!1}function Ko(I){Ie.value||!Go(I.dataTransfer)||(I.preventDefault(),oe+=1,T.value=!0)}function tn(I){Ie.value||!Go(I.dataTransfer)||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="copy"),T.value=!0)}function Wr(I){T.value&&(I.preventDefault(),oe=Math.max(0,oe-1),oe===0&&vo())}function Yo(I){var O;Ie.value||!Go(I.dataTransfer)||(I.preventDefault(),vo(),Ut(((O=I.dataTransfer)==null?void 0:O.files)??null))}function zt(){!T.value&&oe===0||vo()}function Jo(I){var $t,xt;if(Ie.value)return;const O=(($t=I.clipboardData)==null?void 0:$t.getData("text/plain"))??"";if(O.length>=Jj){I.preventDefault();const nn=new File([O],Pn(),{type:"text/plain",lastModified:Date.now()});Ut([nn]);return}const K=Array.from(((xt=I.clipboardData)==null?void 0:xt.items)??[]);if(K.length===0)return;const Te=O.length>0,He=K.filter(nn=>nn.kind==="file"&&nn.type.startsWith("image/")).map(nn=>nn.getAsFile()).filter(nn=>nn instanceof File);He.length!==0&&(Te||I.preventDefault(),Ut(He))}function Qo(){m.value&&(m.value=""),Uo(),yo(),Ar()}function It(I){if(I.isComposing||I.keyCode===229)return;if(ee.value){if(I.key==="Escape"){I.preventDefault(),vn();return}if(I.key==="ArrowDown"){I.preventDefault(),ye.value.length>0&&(ve.value=(ve.value+1)%ye.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),ye.value.length>0){const K=ye.value.length;ve.value=(ve.value+K-1)%K}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const K=ye.value[ve.value];K?Zo(K):vn();return}}if(ne.value){if(I.key==="Escape"){I.preventDefault(),Ir();return}if(I.key==="ArrowDown"){I.preventDefault(),je.value.length>0&&($e.value=($e.value+1)%je.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),je.value.length>0){const K=je.value.length;$e.value=($e.value+K-1)%K}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const K=je.value[$e.value];K?Xo(K):Ir();return}}if(r.sendWithEnter!==!1?I.key==="Enter"&&!I.shiftKey:I.key==="Enter"&&(I.metaKey||I.ctrlKey)){I.preventDefault(),Yt(r.isTurnInProgress?Oe.value:"steer");return}}function vn(){if(ee.value=!1,we.value=null,Pe.value="",ye.value=[],ve.value=0,F=!1,ce){const I=ce;ce="",uI(I)}}function yo(){const I=L.value;if(!I){vn();return}const O=I.selectionStart??s.value.length,Te=s.value.slice(0,O).match(/(^|\s)(@[^\s@]*)$/);if(!Te){vn();return}const He=Te[2]??"",$t=He.length,xt=O-$t;ne.value&&Ir(),we.value=xt,Pe.value=He.slice(1),ee.value=!0,qr()}function Ir(){ne.value=!1,Ae.value=null,De.value="",$e.value=0,je.value=Ce.value}function Ar(){const I=L.value;if(!I){Ir();return}const O=I.selectionStart??s.value.length,K=s.value.slice(0,O),Te=ij(K);if(!Te){Ir();return}ee.value&&vn(),Ae.value=Te.startIndex,De.value=Te.query,je.value=lj(Ce.value,Te.query),$e.value=0,ne.value=!0}function Xo(I){const O=L.value,K=Ae.value;if(K!==null&&O){const Te=O.selectionStart??s.value.length;s.value=`${s.value.slice(0,K)}${s.value.slice(Te)}`}if(Ir(),I.kind==="skill"){const Te=(r.skills??[]).find($t=>$t.path===I.skillPath||$t.name===I.id);Te&&!l.value.some($t=>$t.path===Te.path)&&(l.value=[...l.value,{...Te}]);const He=s.value.trim();s.value=He.length>0?`${He} (Use the ${I.id} skill.)`:`Use the ${I.id} skill.`,Mt(()=>{O==null||O.focus(),Br()});return}if(I.kind==="rpc"){o("slash-command",I.id);return}I.kind==="text"&&I.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${I.insertText}`:I.insertText),I.kind==="local"&&I.id==="clear"&&(s.value=""),Mt(()=>{O==null||O.focus(),Br()})}async function qr(){if(!ee.value)return;const I=(r.cwd??"").trim();if(!I){ye.value=[],F=!0;return}F=!1,lt&&clearTimeout(lt);const O=++Xe;lt=setTimeout(async()=>{const K=`composer-${O}`,Te=Pe.value;try{if(ce||(await iI([I],K),ce=K,o("register-fuzzy-session",K)),await lI(ce,Te),!ee.value||O!==Xe)return;if(ye.value=(r.fuzzyFileSearchResults??[]).map(He=>({path:He.path})),ve.value=0,ye.value.length===0)try{const He=await Jm(I,Te,20);if(!ee.value||O!==Xe)return;ye.value=He,ve.value=0}catch{if(!ee.value||O!==Xe)return;ye.value=[]}}catch{if(!ee.value||O!==Xe)return;ce="";try{const He=await Jm(I,Te,20);if(!ee.value||O!==Xe)return;ye.value=He,ve.value=0}catch{if(!ee.value||O!==Xe)return;ye.value=[]}}},120)}function Zo(I){const O=L.value,K=we.value;if(K!==null&&O){const Te=O.selectionStart??s.value.length;s.value=`${s.value.slice(0,K)}${s.value.slice(Te)}`.trimEnd()}pn(I.path),vn(),Mt(()=>O==null?void 0:O.focus())}function rr(I){R(),er(I),Mt(()=>{var O;(O=L.value)==null||O.focus(),Br()})}function wo(I){const O=I.trim();O&&(s.value=s.value.trim()?`${s.value.trim()}
61
- ${O}`:O,Mt(()=>{var K;(K=L.value)==null||K.focus(),Br()}))}function ea(I){const O=I.lastIndexOf("/");return O<0?I:I.slice(O+1)}function _r(I){const O=I.lastIndexOf("/");return O<=0?"":I.slice(0,O)}function mt(I){const O=ea(I),K=O.lastIndexOf(".");return K<=0?"":O.slice(K+1).toLowerCase()}function En(I){const O=mt(I);return O==="ts"?"TS":O==="tsx"?"TSX":O==="js"?"JS":O==="jsx"?"JSX":O==="json"?"{}":""}function xn(I){const O=mt(I);return O.startsWith("ts")?"ts":O.startsWith("js")?"js":O==="json"?"json":"default"}function Aa(I){const O=mt(I);return O==="md"||O==="mdx"}function Wn(I){if(!le.value&&!Y.value&&!ie.value)return;const O=I.target;O&&(typeof O.closest=="function"&&O.closest(".composer-popover-anchor")||(le.value=!1,Y.value=!1,ie.value=!1))}return ss(()=>{document.addEventListener("click",Wn),window.addEventListener("drop",zt),window.addEventListener("dragend",zt),window.addEventListener("blur",zt),Uo()}),t({hydrateDraft:rr,appendTextToDraft:wo,hasUnsavedDraft:()=>_e.value}),ti(()=>{document.removeEventListener("click",Wn),window.removeEventListener("drop",zt),window.removeEventListener("dragend",zt),window.removeEventListener("blur",zt),window.removeEventListener("pointerup",Wo),window.removeEventListener("pointercancel",Wo),window.removeEventListener("blur",Wo),lt&&clearTimeout(lt)}),tt(()=>r.activeThreadId,I=>{R(),We&&Sa(We,Fr()),ka();const O=ni(I);O&&(er(O),Qo()),We=I.trim()},{immediate:!0}),tt([s,i,u,l],()=>{We&&Sa(We,Fr())},{deep:!0}),tt(s,()=>{Uo()}),tt(()=>r.cwd,()=>{ee.value&&qr()}),tt(()=>r.fuzzyFileSearchResults,I=>{!ee.value||!ce||(ye.value=(I??[]).map(O=>({path:O.path})),ve.value=0)}),tt(Ke,I=>{Oe.value=I}),(I,O)=>(_(),B("form",{class:"thread-composer",onSubmit:O[6]||(O[6]=pt(K=>Yt(e.isTurnInProgress?Oe.value:"steer"),["prevent"]))},[w("div",{class:ct(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":T.value}])},[e.planPanel?(_(),Ze(wL,{key:0,"plan-panel":e.planPanel,onImplementPlan:O[0]||(O[0]=K=>I.$emit("implement-plan"))},null,8,["plan-panel"])):pe("",!0),Fe($L,{"selected-images":i.value,"folder-upload-groups":d.value,"standalone-file-attachments":Ne.value,"selected-skills":l.value,"is-interaction-disabled":Ie.value,onRemoveImage:Tt,onRemoveFolder:$n,onRemoveFile:en,onRemoveSkill:Ct},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",uj,[w("div",cj,[w("div",{class:ct(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":T.value,"thread-composer-input-wrap--expanded":Se.value}]),onDragenter:Ko,onDragover:tn,onDragleave:Wr,onDrop:Yo},[T.value?(_(),B("div",dj,[w("span",fj,D(g(a)("Drop images or files")),1)])):pe("",!0),ee.value?(_(),B("div",hj,[ye.value.length>0?(_(!0),B(rt,{key:0},Wt(ye.value,(K,Te)=>(_(),B("button",{key:K.path,class:ct(["thread-composer-file-mention-row",{"is-active":Te===ve.value}]),type:"button",onMousedown:pt(He=>Zo(K),["prevent"])},[En(K.path)?(_(),B("span",{key:0,class:ct(["thread-composer-file-mention-icon-badge",`is-${xn(K.path)}`])},D(En(K.path)),3)):Aa(K.path)?(_(),B("span",mj,"↓")):(_(),Ze(bl,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",gj,[w("span",vj,D(ea(K.path)),1),_r(K.path)?(_(),B("span",yj,D(_r(K.path)),1)):pe("",!0)])],42,pj))),128)):g(F)?(_(),B("div",wj,D(g(a)("No searchable directory for this thread")),1)):(_(),B("div",bj,D(g(a)("No matching files")),1))])):pe("",!0),ne.value?(_(),Ze(VR,{key:2,commands:je.value,"highlighted-index":$e.value,onSelect:Xo},null,8,["commands","highlighted-index"])):pe("",!0),_n(w("textarea",{ref_key:"inputRef",ref:L,"onUpdate:modelValue":O[1]||(O[1]=K=>s.value=K),class:"thread-composer-input",placeholder:Ge.value,disabled:Ie.value,onInput:Qo,onKeydown:It,onPaste:Jo},null,40,Tj),[[Ln,s.value]]),ot.value?(_(),B("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Se.value?g(a)("Exit full screen composer"):g(a)("Expand composer"),title:Se.value?g(a)("Exit full screen composer"):g(a)("Expand composer"),disabled:Ie.value,onClick:zo},[Se.value?(_(),Ze(xR,{key:0,class:"thread-composer-expand-icon"})):(_(),Ze(TR,{key:1,class:"thread-composer-expand-icon"}))],8,kj)):pe("",!0)],34),w("div",Sj,[e.isTurnInProgress&&!dt.value?(_(),B("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?g(a)("Saving thread before stop is available"):g(a)("Stop"),title:e.isStopPending?g(a)("Saving thread before stop is available"):g(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:ls},[e.isStopPending?(_(),B("span",xj)):(_(),Ze(PR,{key:1,class:"thread-composer-stop-icon"}))],8,Cj)):(_(),B("button",{key:1,class:ct(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Oe.value==="queue"}]),type:"button","aria-label":e.isCompacting?g(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Oe.value==="queue"?g(a)("Queue message"):g(a)("Send message"),title:e.isCompacting?g(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${g(a)("Send")} ${Oe.value==="queue"?g(a)("Queue"):g(a)("Steer")}`:g(a)("Send"),disabled:!ae.value,onClick:O[2]||(O[2]=K=>Yt(e.isTurnInProgress?Oe.value:"steer"))},[Fe(vR,{class:"thread-composer-submit-icon"})],10,Ij))])]),w("div",{class:ct(["thread-composer-controls",{"thread-composer-controls--recording":qe.value}])},[Fe(oj,{open:le.value,"is-mobile":g(fe),"is-interaction-disabled":Ie.value,"is-composer-config-disabled":he.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":P.value,"approval-policy-choices":$,"active-in-progress-mode":Oe.value,"onUpdate:open":O[3]||(O[3]=K=>le.value=K),onToggle:po,onSetActiveMode:fo,onSelectPhoto:cs,onSelectFolder:gt,onCaptureCamera:xa,onSelectCollaborationMode:Ur,onSelectApprovalPolicy:Ca},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(OL,{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":ri,"onUpdate:selectedReasoningEffort":us},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),g(fe)?pe("",!0):(_(),B("div",Aj,[Fe(Cc,{open:Y.value,align:"start",width:"md","aria-label":g(a)("Plan mode"),"onUpdate:open":O[4]||(O[4]=K=>Y.value=K)},{trigger:ft(()=>[w("button",{class:ct(["thread-composer-plan-trigger",{"is-active":Y.value}]),type:"button","aria-label":g(a)("Plan mode"),disabled:he.value,onClick:mo},[w("span",Pj,D(q.value),1),Fe(Ys,{class:"thread-composer-plan-trigger-chevron"})],10,_j)]),default:ft(()=>[(_(!0),B(rt,null,Wt(P.value,K=>(_(),B("button",{key:K.value,class:ct(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===K.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===K.value,disabled:K.disabled||he.value,onClick:Te=>Ho(K.value)},[w("span",Mj,[w("span",Rj,D(g(a)(K.labelKey)),1),K.subLabel?(_(),B("span",Lj,D(K.subLabel),1)):pe("",!0),K.disabled?(_(),B("span",jj,D(g(a)("Not supported by this Codex version")),1)):pe("",!0)]),e.selectedCollaborationMode===K.value?(_(),B("span",$j,"✓")):pe("",!0)],10,Ej))),128))]),_:1},8,["open","aria-label"]),Fe(Cc,{open:ie.value,align:"center",width:"md","aria-label":g(a)("Approval policy"),"onUpdate:open":O[5]||(O[5]=K=>ie.value=K)},{trigger:ft(()=>[w("button",{class:ct(["thread-composer-approval-trigger",{"is-active":ie.value}]),type:"button","aria-label":g(a)("Approval policy"),disabled:he.value,onClick:Sr},[w("span",Oj,D(ue.value),1),Fe(Ys,{class:"thread-composer-approval-trigger-chevron"})],10,Nj)]),default:ft(()=>[(_(),B(rt,null,Wt($,K=>w("button",{key:K.value,class:ct(["thread-composer-menu-item",{"is-active":e.approvalPolicy===K.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===K.value,disabled:e.isApprovalPolicySaving,onClick:Te=>Ca(K.value)},[w("span",Fj,[w("span",Bj,D(g(a)(K.label)),1)]),e.approvalPolicy===K.value?(_(),B("span",Uj,"✓")):pe("",!0)],10,Dj)),64)),e.approvalPolicyError?(_(),B("p",zj,D(e.approvalPolicyError),1)):pe("",!0),Fe(gu,{name:"approval-tip"},{default:ft(()=>[e.approvalPolicyNotice?(_(),B("span",Hj,D(e.approvalPolicyNotice),1)):pe("",!0)]),_:1})]),_:1},8,["open","aria-label"])])),ut.value?(_(),B("button",{key:1,type:"button",class:ct(["thread-composer-context-usage-inline",{"is-warning":ke.value==="warning","is-danger":ke.value==="danger"}]),title:de.value,"aria-label":g(a)("Context"),onClick:Be},[w("span",qj,D(J.value),1),ke.value!=="healthy"?(_(),B("span",Gj,D(g(a)("Compact")),1)):pe("",!0)],10,Wj)):pe("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:E,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ie.value,onChange:Xt},null,40,Vj),w("input",{ref_key:"cameraCaptureInputRef",ref:N,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ie.value,onChange:mr},null,40,Kj),w("input",{ref_key:"folderPickerInputRef",ref:W,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ie.value,onChange:ln},null,40,Yj)],32))}}),Ng=wt(Xj,[["__scopeId","data-v-c87250dc"]]),Og={hooks:{methods:["hooks/list"]},remoteControl:{methods:["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"]},plugins:{methods:["plugin/list","plugin/read","plugin/install","plugin/uninstall"]},apps:{methods:["app/list"]},mcps:{methods:["mcpServerStatus/list"]},mcpReload:{methods:["config/mcpServer/reload"]},mcpLogin:{methods:["mcpServer/oauth/login"]},marketplace:{methods:["marketplace/add","marketplace/remove","marketplace/upgrade"]},pluginShare:{methods:["plugin/share/save","plugin/share/list","plugin/share/delete"]}};function Dg(e,t){return t.methods.every(n=>e.has(n))}const Zj=["aria-label"],e$=["aria-checked","onClick"],t$={class:"runtime-toggle-option-label"},n$=hn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=co(),o=[{value:"local",label:r("Local project"),icon:Mh},{value:"worktree",label:r("New worktree"),icon:Sc}];function a(s){n("update:modelValue",s)}return(s,i)=>(_(),B("div",{class:"runtime-toggle",role:"radiogroup","aria-label":g(r)("Continue in")},[(_(),B(rt,null,Wt(o,l=>w("button",{key:l.value,class:ct(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:u=>a(l.value)},[(_(),Ze(hh(l.icon),{class:"runtime-toggle-option-icon"})),w("span",t$,D(l.label),1)],10,e$)),64))],8,Zj))}}),r$=wt(n$,[["__scopeId","data-v-b3c220d3"]]),o$={},a$={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 s$(e,t){return _(),B("svg",a$,[...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 Sw=wt(o$,[["render",s$]]),i$={},l$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function u$(e,t){return _(),B("svg",l$,[...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 c$=wt(i$,[["render",u$]]),d$={class:"sidebar-thread-controls"},f$=["aria-label","title"],h$=["aria-label","title"],p$=hn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=co();return(n,r)=>(_(),B("div",d$,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),title:e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(_(),Ze(c$,{key:0,class:"sidebar-thread-controls-icon"})):(_(),Ze(Sw,{key:1,class:"sidebar-thread-controls-icon"}))],8,f$),kr(n.$slots,"default",{},void 0),e.showNewThreadButton?(_(),B("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":g(t)("Start new thread"),title:g(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[Fe(bl,{class:"sidebar-thread-controls-icon"})],8,h$)):pe("",!0)]))}}),Fg=wt(p$,[["__scopeId","data-v-de38b7ee"]]),m$={},g$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function v$(e,t){return _(),B("svg",g$,[...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 Bg=wt(m$,[["render",v$]]),y$={},w$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function b$(e,t){return _(),B("svg",w$,[...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 Ug=wt(y$,[["render",b$]]),T$={},k$={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function S$(e,t){return _(),B("svg",k$,[...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 C$=wt(T$,[["render",S$]]),x$={},I$={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function A$(e,t){return _(),B("svg",I$,[...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 _$=wt(x$,[["render",A$]]),P$={},E$={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function M$(e,t){return _(),B("svg",E$,[...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 zg=wt(P$,[["render",M$]]);function Cw(e){var o;const t=e.replace(/\r\n/g,`
62
- `).trim();if(!t)return null;const n=[],r=[];for(const a of t.split(`
63
- `)){const s=a.trim();if(!s){n.length===0&&r.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let u="pending";l==="x"&&(u="completed"),(l==="~"||l===">"||l==="-")&&(u="inProgress"),n.push({step:((o=i[2])==null?void 0:o.trim())??"",status:u});continue}r.push(s)}if(n.length===0){const a=R$(t);return a||null}return{explanation:r.join(`
64
- `).trim(),steps:n.filter(a=>a.step.length>0)}}function R$(e){var a,s;const t=[],n=[],r=[];for(const i of e.split(`
65
- `)){const l=i.trim();if(!l){t.length===0&&n.length===0&&r.push("");continue}const u=l.match(/^\d+[.)]\s+(.+)$/);if(u){t.push({step:((a=u[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:L$(r.join(`
66
- `)),steps:o.filter(i=>i.step.length>0)}}function L$(e){return e.split(`
67
- `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
68
- `).trim()}function Hg(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}:Cw(e.text)}function j$(e,t){var r;const n=e.find(o=>{var a;return typeof o.turnIndex=="number"&&o.turnIndex>t&&!!((a=o.turnId)!=null&&a.trim())});return((r=n==null?void 0:n.turnId)==null?void 0:r.trim())??""}function $$(e,t,n){return t?!e.some(r=>{var o;return((o=r.turnId)==null?void 0:o.trim())===t||typeof r.turnIndex=="number"&&r.turnIndex>n}):!0}const xw="modelSwitch",Iw=20;function N$(e){return e.messageType===xw}function Zs(e){return e.role==="user"&&e.isAgentNote!==!0}function O$(e){return e.isAgentNote===!0?"agent-note":e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function D$(e,t=!1){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&(t||!((n=e.messageType)!=null&&n.endsWith(".live")))&&e.text.trim().length>0}function AU(e,t){var a,s;const n=[];let r=null;for(const i of e)(Zs(i)||!r)&&(r={key:`turn-${i.id}`,items:[]},n.push(r)),r.items.push({message:i,kind:O$(i)});const o=n.length-1;for(let i=0;i<n.length;i+=1){const l=n[i],u=(s=(a=l.items.find(v=>{var T;return(T=v.message.turnId)==null?void 0:T.trim()}))==null?void 0:a.message.turnId)==null?void 0:s.trim(),d=t!==void 0&&"liveTurnId"in t;if((t==null?void 0:t.liveOverlayActive)===!0&&(d?u===(t==null?void 0:t.liveTurnId):i===o))continue;const f=[...l.items].reverse().find(v=>D$(v.message,(t==null?void 0:t.liveOverlayActive)===!1));f&&((t==null?void 0:t.liveOverlayActive)!==!1&&l.items.some(T=>typeof T.message.messageType=="string"&&T.message.messageType.endsWith(".live"))||(f.kind="final-assistant"))}return n}function Aw(e){return e.replace(/\s+/g," ").trim()}function _U(e){const t=Aw(e);return t.length<=80?t:t.slice(0,80)}function F$(e){const t=Aw(e);return t.length<=80?t:t.slice(0,77)+"..."}function B$(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function Rh(e,t){return e.sessionKey===t?e:B$(t)}function PU(e,t){const n=Rh(e,t);return{...n,coldPage:n.coldPage+1}}function EU(e,t,n){const r=Rh(e,t),o=Math.max(0,Math.floor(n));return r.coldPage>=o?r:{...r,coldPage:o}}function MU(e,t,n,r){const o=Rh(e,t),a=new Set(o.expandedWarmTurns);return r?a.add(n):a.delete(n),{...o,expandedWarmTurns:a}}function U$(e){return Zs(e)}function z$(e){var t;return((t=e.messageType)==null?void 0:t.endsWith(".live"))===!0}function RU(e){var a;const t=[];let n=-1,r=0;const o=(s,i)=>{t.push({userItem:s,assistantPreview:"",toolCount:0,startIdx:i,endIdx:e.length})};for(let s=0;s<e.length;s+=1){const i=e[s];if(U$(i)){if(n>=0)t[t.length-1].endIdx=s;else{t.push({userItem:i,assistantPreview:"",toolCount:0,startIdx:r,endIdx:e.length}),n=s,r=s;continue}n=s,o(i,s)}else if(n>=0&&t.length>0){const l=t[t.length-1],u=((a=i.text)==null?void 0:a.trim())||"";i.role==="assistant"&&!z$(i)&&u&&(l.assistantPreview=F$(u)),i.messageType==="toolCall"&&(l.toolCount+=1)}}return t}function LU({turnCount:e,hotTurns:t,pageSize:n,coldPage:r}){const o=Math.max(0,e),a=Math.max(0,t),s=Math.max(0,o-Math.min(o,a));if(s===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const i=Math.max(0,n),l=Math.max(0,Math.floor(r)),u=Math.min(s,i*(l+1));return{warmStartTurn:s-u,warmEndTurn:s,coldTurnCount:s-u}}function jU({turn:e,turnCount:t,hotTurns:n,pageSize:r}){const o=Math.max(0,t),a=Math.max(0,n),s=Math.max(0,o-Math.min(o,a));if(s===0||e>=s)return 0;const i=Math.max(1,r),l=Math.max(0,Math.floor(e)),u=s-l;return Math.max(0,Math.ceil(u/i)-1)}function $U(e,t,n){if(t.length===0)return e.slice(0);if(n>=t.length)return[];const r=t[n].startIdx;return e.slice(r)}const ba="__new-thread__",_w="__new-thread-provider__::";function Pw(e){return e==="plan"?"plan":"default"}function _i(e){return typeof e=="string"?e.trim():""}function jo(){return Object.create(null)}function oc(e){const t=jo();for(const[n,r]of Object.entries(e))t[n]=r;return t}function Xl(e,t){if(!(t in e))return e;const n=jo();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function Ew(e,t){let n=!1;const r=jo();for(const[o,a]of Object.entries(e)){if(o===ba||o.startsWith(_w)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function zs(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function H$(e){return e===ba}function Vu(e){const t=zs(e);return t?`${_w}${t}`:""}function Ja(e){return e.trim()||ba}function af(e,t){const n=Ja(t),r=_i(e[n]);return r||_i(e[ba])}function sf(e,t){const n=Ja(t);return Pw(e[n])}function Wg(e,t,n){const r=Ja(t);if(H$(r))return Xl(e,r);if(n==="plan"){const o=oc(e);return o[r]="plan",o}return Xl(e,r)}function W$(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Jn(e){return e.flatMap(t=>t.threads)}function q$(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 Mw(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function G$(e){if(e instanceof Dr&&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 V$(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 K$(e,t,n){return V$(e,t??n)}function Rw(e,t,n){return Math.min(Math.max(e,t),n)}function el(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 qg(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:el(t.totalTokens)??0,inputTokens:el(t.inputTokens)??0,cachedInputTokens:el(t.cachedInputTokens)??0,outputTokens:el(t.outputTokens)??0,reasoningOutputTokens:el(t.reasoningOutputTokens)??0}}function Y$(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=qg(t.total),r=qg(t.last);if(!n||!r)return null;const o=el(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Rw(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function tl(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 Xa(e,n)?e:n}function Of(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 Xa(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 J$(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 Q$(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function X$(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 Z$(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&X$(e.steps,t.steps)}function Ku(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 Df(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Xa(e.images,t.images)&&eN(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&Q$(e.commandExecution,t.commandExecution)&&Z$(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function Tl(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 Gg(e,t,n={}){var T;const r=new Map(e.map(S=>[S.id,S])),o=new Map(t.map(S=>[S.id,S])),a=t.map(S=>{const R=r.get(S.id);return R&&Df(R,S)?R:S});if(n.preserveMissing!==!0)return Tl(e,a)?e:a;const s=e.map(S=>{const R=o.get(S.id);return!R||Df(S,R)?S:R}).filter(S=>!dl(S)||!Vg(S,t)),i=new Set(e.map(S=>S.id)),l=a.filter(S=>!i.has(S.id)),u=e.filter(dl);let d=[],m=l;if(u.length>0){const S=a.findIndex(R=>u.some(E=>Vg(E,[R])));if(S>=0){const R=l.findIndex(E=>E.id===a[S].id);R>=0?(d=l.slice(0,R),m=l.slice(R)):(d=[],m=l)}else{const R=new Set(e.map(E=>{var N;return((N=E.turnId)==null?void 0:N.trim())??""}).filter(E=>E!==""));if(R.size>0){const E=[],N=[];for(const W of l){const L=((T=W.turnId)==null?void 0:T.trim())??"";L!==""&&R.has(L)?E.push(W):N.push(W)}d=E,m=N}}}const f=s.findIndex(dl),v=f>=0?[...s.slice(0,f),...d,...s.slice(f),...m]:[...s,...d,...m];return Tl(e,v)?e:v}function eN(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 os(e){return e.replace(/\s+/gu," ").trim()}function dl(e){return e.messageType==="userMessage.optimistic"}function tN(e){return e.some(dl)}function Vg(e,t){if(!Zs(e))return!1;const n=os(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||!Zs(s)||dl(s))return!1;const i=os(s.text),l=Array.isArray(s.images)?s.images:[],u=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,d=Array.isArray(s.skills)?s.skills.length:0;return i===n&&Xa(l,r)&&u===o&&d===a})}function nN(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"))){Zs(r)&&(n=new Map),t.push(r);continue}const a=os(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 rN(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>os(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=os(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function Xc(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Df(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const Lh="worked";function Vs(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function oN(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 aN(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function sN(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 Lw(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${oN(e.durationMs)}`,messageType:Lh,turnId:e.turnId,durationMs:e.durationMs}}function iN(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function lN(e,t){const n=Lw(t),r=e.filter(s=>s.messageType!==Lh),o=iN(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function uN(e,t){if(!t)return e;const n=new Set;for(const o of e)o.messageType===Lh&&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(Lw({turnId:o,durationMs:Math.round(a)})),n.add(o));return r.length===0?e:[...e,...r]}function kt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function cN(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 dN(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 fN(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 hN(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 sn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function jw(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 xc(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 u=s.get(l.id);return u&&dN(u,l)?u:l});return a&&a.projectName===o.projectName&&fN(a.threads,i)?a:{projectName:o.projectName,threads:i}});return hN(e,r)?e:r}function pN(e,t,n){const r=new Set(Jn(t).map(i=>i.id)),o=Jn(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 u=s.findIndex(d=>d.projectName===i.projectName);u>=0&&(s[u]={projectName:s[u].projectName,threads:[i,...s[u].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function Pi(e){return so(e)}function mN(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function gN(e){const t=e.label||so(e.remotePath),n=mN(e.hostId);return n?`${t} ${n}`:t}function $w(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function Zc(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 Ff(e,t){const n=$w(e);return Zc(e).map(r=>{if(n.has(r))return r;const o=et(r).trim(),a=Pi(o);return t.has(a)?o:a})}function ac(e,t){return et(e).trim()===t||Pi(e)===t}function vN(e,t){const n=new Set;for(const r of e.order)ac(r,t)&&n.add(r);for(const r of e.active)ac(r,t)&&n.add(r);for(const r of Object.keys(e.labels))ac(r,t)&&n.add(r);return n}function yN(e,t,n){var u,d;const r=new Set((e.remoteProjects??[]).map(m=>m.id)),o=new Map;for(const m of e.order){const f=Pi(m);o.has(f)||o.set(f,m)}for(const m of n){const f=((d=(u=m.threads[0])==null?void 0:u.cwd)==null?void 0:d.trim())??"";f&&o.set(m.projectName,f)}const a=[],s=m=>{m&&!a.includes(m)&&a.push(m)};for(const m of t){if(r.has(m)){s(m);continue}const f=o.get(m);f&&s(f)}for(const m of Zc(e))s(m);const i=a.filter(m=>e.order.includes(m));for(const m of e.order)i.includes(m)||i.push(m);const l=e.active.filter(m=>i.includes(m));return l.length===0&&i.length>0&&l.push(i[0]),{order:i,active:l,projectOrder:a}}function wN(e,t,n){const r=Ff(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(zf(a)||zf(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 Bf(e,t){const n=new Map,r=new Map,o=s=>{const i=et(s).trim();if(!i)return;const l=so(i),u=n.get(l)??new Set;u.add(i),n.set(l,u)};for(const s of(t==null?void 0:t.order)??[]){const i=et(s).trim();if(!i)continue;const l=so(i);Ic(i)||r.set(l,(r.get(l)??0)+1),o(s)}for(const s of e)for(const i of s.threads){const l=et(i.cwd).trim(),u=so(l),d=(t==null?void 0:t.order.some(m=>et(m).trim()===l))===!0;Ic(l)&&!d&&r.get(u)===1||o(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function Ic(e){return e.includes("/.codex/worktrees/")}function bN(e,t){const n=Bf(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const u of(t==null?void 0:t.order)??[]){const d=et(u).trim();if(!d||(s.add(d),Ic(d)))continue;const m=so(d);r.has(m)?(r.delete(m),o.add(m),a.delete(m)):o.has(m)||(r.add(m),a.set(m,d))}const i=[],l=new Map;for(const u of e)for(const d of u.threads){const m=et(d.cwd).trim(),f=so(m),v=s.has(m),T=Ic(m)&&!v&&r.has(f);let S=u.projectName;T&&n.has(f)?S=a.get(f)??u.projectName:m&&n.has(f)&&(S=m);const R=d.projectName===S?d:{...d,projectName:S},E=l.get(S);if(E)E.threads.push(R);else{const N={projectName:S,threads:[R]};l.set(S,N),i.push(N)}}return i}function TN(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=$w(t);for(const s of Zc(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const i=et(s).trim();if(!i)continue;const l=Pi(i),u=n.has(l)?i:l;r.has(u)||(o.push({projectName:u,threads:[]}),r.add(u))}return o}const Uf=20;function qs(e){const t=e.split(`
69
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Uf):"Untitled thread"}function kN(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function zf(e){return e.threads.some(t=>t.cwd.trim().length===0||bc(t.cwd))}const Js=new Map;let sc=0;function lf(e,t){const n=`${e}:${t.id}`,r=Js.get(n);return r!==void 0?r:(sc+=1,Js.set(n,sc),sc)}function SN(e){const t=`${e}:`;for(const n of[...Js.keys()])n.startsWith(t)&&Js.delete(n)}function CN(){Js.clear(),sc=0}function xN(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 Kg(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 IN(e,t){var s,i,l;if(t.length===0)return e;const n=[...e],r=[],o=new Set(e.map(u=>{var d;return((d=u.turnId)==null?void 0:d.trim())??""}).filter(u=>u.length>0)),a=new Map;for(const u of t){const d=((s=u.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(d&&Kg(n,d)>=0)continue;const m=u.turnIndex;if(typeof m!="number"||!Number.isFinite(m))continue;const f=a.get(m)??[];f.push(u),a.set(m,f)}for(const u of[...t].reverse()){const d=((i=u.reasoningAnchorMessageId)==null?void 0:i.trim())??"";if(d){const R=Kg(n,d);if(R>=0){n.splice(R+1,0,u);continue}}const m=u.turnIndex;if(typeof m!="number"||!Number.isFinite(m)){const R=((l=u.turnId)==null?void 0:l.trim())??"";if(R&&!o.has(R))continue;r.push(u);continue}let f=-1,v=-1;const T=[];for(let R=0;R<n.length;R+=1)n[R].turnIndex===m&&(v=R,Zs(n[R])?f=R:n[R].messageType!=="reasoning"&&T.push(R));if(T.some(R=>{const E=n[R].messageType;return E==="commandExecution"||E==="toolCall"||E==="fileChange"||E==="worked"})){const E=(a.get(m)??[]).indexOf(u),N=E>=0?E:0;n.splice(T[Math.min(N,T.length-1)]+1,0,u)}else if(f>=0)n.splice(f+1,0,u);else if(v>=0)n.splice(v+1,0,u);else continue}return r.length>0?[...n,...r.reverse()]:n}function AN(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)lf(e,s);return a.sort((s,i)=>lf(e,s)-lf(e,i))}function _N(e,t,n,r,o){const a=AN(e,r,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const v=t[f];!Zs(v)||!Number.isInteger(v.turnIndex)||v.turnIndex<0||(i!==void 0&&s.set(i,f),i=v.turnIndex)}if(i!==void 0){const f=t.findIndex(dl);s.set(i,f>=0?f:t.length)}const l=new Map,u=[];for(const f of a){const v=f.turnIndex,T=Number.isInteger(v)&&v>=0?s.get(v):void 0;if(T===void 0){u.push(f);continue}const S=l.get(T);S?S.push(f):l.set(T,[f])}const d=[];for(let f=0;f<=t.length;f+=1)d.push(...l.get(f)??[]),f<t.length&&d.push(t[f]);d.push(...u);const m=nN(d);return[...IN(m,n),...o]}const Nw="codex-web-local.thread-read-state.v1",Yg="codex-web-local.thread-unread-cutoff.v1",Ow="codex-web-local.thread-token-usage.v1",Dw="codex-web-local.thread-reasoning.v1",Hf="codex-web-local.thread-turn-durations.v1",Fw="codex-web-local.thread-last-plan.v1",Bw="codex-web-local.live-reasoning-snapshot.v1",Uw="codex-web-local.thread-terminal-open.v1",Wf="codex-web-local.selected-thread-id.v1",qf="codex-web-local.selected-model-by-context.v1",zw="codex-web-local.selected-model-id.v1",Hw="codex-web-local.project-order.v1",Ww="codex-web-local.project-display-name.v1",Gf="codex-web-local.collaboration-mode-by-context.v1",PN="codex-web-local.collaboration-mode.v1";function EN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Nw);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Jg(e){typeof window>"u"||window.localStorage.setItem(Nw,JSON.stringify(e))}function MN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dw);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Bl(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Dw,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&KA(t,n)}}function RN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Hf);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 qw={};function Gw(e){const t={};for(const[n,r]of Object.entries(e))n&&Object.keys(r).length>0&&(t[n]={...r});qw=t}function Qg(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(Hf):window.localStorage.setItem(Hf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e)){if(!t)continue;const r=qw[t]??{};for(const[o,a]of Object.entries(n))!o||typeof a!="number"||a<=0||r[o]!==a&&JA(t,o,a)}Gw(e)}}function LN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fw);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Vw(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Fw,JSON.stringify(e))}catch{}}function jN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Bw);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 $N(){if(typeof window>"u")return"";const e=window.localStorage.getItem(Yg);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(Yg,t),t}function NN(){if(typeof window>"u")return jo();try{const n=window.localStorage.getItem(qf);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return jo();const o=jo();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const i=_i(s);i&&(o[a]=i)}return o}}catch{}const e=_i(window.localStorage.getItem(zw)),t=jo();return e&&(t[ba]=e),t}function Yu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(qf):window.localStorage.setItem(qf,JSON.stringify(e)),window.localStorage.removeItem(zw)}catch{}}function ON(){if(typeof window>"u")return jo();try{const e=window.localStorage.getItem(Gf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return jo();const n=jo();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=Pw(o);a==="plan"&&(n[r]=a)}return n}}catch{}return jo()}function uf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Gf):window.localStorage.setItem(Gf,JSON.stringify(e)),window.localStorage.removeItem(PN)}catch{}}function DN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ow);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=Y$(o);a&&(n[r]=a)}return n}catch{return{}}}function cf(e){typeof window>"u"||window.localStorage.setItem(Ow,JSON.stringify(e))}const Vf="codex-web-local.thread-model-switch-markers.v1",Kf="codex-web-local.thread-scroll-state.v1",FN=24,BN=200;function Kw(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(t.v!==1)return null;const n=t.coldPage;if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=t.distanceFromBottomPx;if(typeof r!="number"||!Number.isFinite(r)||r<0)return null;const o=t.savedAt;if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;const a=Array.isArray(t.expandedWarmTurns)?t.expandedWarmTurns:[],s=[];for(const u of a)typeof u=="number"&&Number.isInteger(u)&&u>=0&&!s.includes(u)&&s.push(u);const i=t.hotHeights,l={};if(i&&typeof i=="object"&&!Array.isArray(i)){for(const[u,d]of Object.entries(i))if(!(!u||typeof d!="number"||!Number.isFinite(d)||d<=0)&&(l[u]=d,Object.keys(l).length>=BN))break}return{v:1,coldPage:n,expandedWarmTurns:s,distanceFromBottomPx:r,hotHeights:l,savedAt:o}}function NU(){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)continue;const a=Kw(o);a&&(n[r]=a)}return n}catch{return{}}}function OU(e){if(!(typeof window>"u"))try{const t=Object.entries(e).filter(n=>!!n[0]&&Kw(n[1])!==null).sort((n,r)=>r[1].savedAt-n[1].savedAt).slice(0,FN);if(t.length===0)window.localStorage.removeItem(Kf);else{const n={};for(const[r,o]of t)n[r]=o;window.localStorage.setItem(Kf,JSON.stringify(n))}}catch{}}function UN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Vf);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"&&N$(s)).slice(0,Iw);a.length>0&&(n[r]=a)}return n}catch{return{}}}function zN(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Vf):window.localStorage.setItem(Vf,JSON.stringify(e))}catch{}}function HN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uw);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 WN(e){typeof window>"u"||window.localStorage.setItem(Uw,JSON.stringify(e))}function qN(){return typeof window>"u"?"":window.localStorage.getItem(Wf)??""}function GN(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Wf);return}window.localStorage.setItem(Wf,e)}}function VN(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Hw);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=so(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function KN(e){typeof window>"u"||window.localStorage.setItem(Hw,JSON.stringify(e))}function YN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ww);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"?so(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function JN(e){typeof window>"u"||window.localStorage.setItem(Ww,JSON.stringify(e))}function QN(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function XN(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const r of e.steps){const o=r.status==="completed"?"x":r.status==="inProgress"?"~":" ";t.push(`- [${o}] ${r.step}`)}return t.join(`
70
- `).trim()}function Ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Re(e){return typeof e=="string"?e:""}function Ks(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Xg(e){const t=Ve(e);if(!t)return null;const n=Ks(t.totalTokens??t.total_tokens),r=Ks(t.inputTokens??t.input_tokens),o=Ks(t.cachedInputTokens??t.cached_input_tokens),a=Ks(t.outputTokens??t.output_tokens),s=Ks(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 ZN(e){const t=Ve(e);if(!t)return null;const n=Xg(t.total),r=Xg(t.last);if(!n||!r)return null;const o=Ks(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?Rw(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function eO(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ve(e.params),n=Un(e),r=ZN((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!r?null:{threadId:n,usage:r}}function Un(e){const t=Ve(e.params);if(!t)return"";const n=Re(t.threadId);if(n)return n;const r=Re(t.thread_id);if(r)return r;const o=Re(t.conversationId);if(o)return o;const a=Re(t.conversation_id);if(a)return a;const s=Ve(t.thread),i=Re(s==null?void 0:s.id);if(i)return i;const l=Ve(t.turn),u=Re(l==null?void 0:l.threadId);if(u)return u;const d=Re(l==null?void 0:l.thread_id);return d||""}function tO(e){if(e.method!=="turn/completed")return"";const t=Ve(e.params),n=Ve(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const r=Ve(n.error);return Re(r==null?void 0:r.message)}function nO(e){var r;if(e.method!=="error")return null;const t=Ve(e.params),n=Re(t==null?void 0:t.message)||Re((r=Ve(t==null?void 0:t.error))==null?void 0:r.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function rO(e){const t=Un(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=Ve(e.params),r=Ve(n==null?void 0:n.item),o=Re(r==null?void 0:r.type).toLowerCase();if(o==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(o==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(o==="commandexecution"){const a=Re(r==null?void 0:r.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(o==="filechange"){const s=(Array.isArray(r==null?void 0:r.changes)?r.changes:[])[0],i=Re(s==null?void 0:s.path);return{threadId:t,activity:{label:"Applying changes",details:i?[i]:[]}}}}return e.method==="item/commandExecution/outputDelta"?{threadId:t,activity:{label:"Running command",details:[]}}:e.method==="item/fileChange/outputDelta"?{threadId:t,activity:{label:"Applying changes",details:[]}}:e.method==="item/reasoning/summaryTextDelta"||e.method==="item/reasoning/summaryPartAdded"||e.method==="item/reasoning/textDelta"?{threadId:t,activity:{label:"Thinking",details:[]}}:e.method==="item/agentMessage/delta"?{threadId:t,activity:{label:"Writing response",details:[]}}:null}function oO(e){if(e.method!=="turn/started")return null;const t=Ve(e.params);if(!t)return null;const n=Un(e);if(!n)return null;const r=Ve(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Vs(Re(r==null?void 0:r.startedAt))??Vs(Re(t.startedAt))??Vs(e.atIso)??Date.now();return{threadId:n,turnId:o,startedAtMs:a}}function aO(e){if(e.method!=="turn/completed")return null;const t=Ve(e.params);if(!t)return null;const n=Un(e);if(!n)return null;const r=Ve(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Vs(Re(r==null?void 0:r.completedAt))??Vs(Re(t.completedAt))??Vs(e.atIso)??Date.now(),s=Vs(Re(r==null?void 0:r.startedAt))??Vs(Re(t.startedAt))??void 0;return{threadId:n,turnId:o,completedAtMs:a,startedAtMs:s}}function Ac(e){return`${e}:live-reasoning`}function sO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":Re(n.id)}return""}function iO(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:Ac(n),itemId:n,delta:r}}if(e.method==="item/reasoning/textDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:Ac(n),itemId:n,delta:r}}return null}function lO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Re(t.itemId);return n?Ac(n):""}return""}function uO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":Ac(Re(n.id))}return""}function cO(e){var n;const t=[];for(const r of["content","summary"]){const o=Array.isArray(e[r])?e[r]:[];for(const a of o){const s=typeof a=="string"?a:(n=Ve(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
71
- `).trim()}function dO(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n||Re(n.type).toLowerCase()!=="reasoning")return null;const r=Re(n.id);return r?{itemId:r,text:cO(n)}:null}function fO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="agentMessage"?"":Re(n.id)}return""}function hO(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Re(t.itemId),r=Re(t.delta);if(!n||!r)return null;const o=Re(t.turnId)||Re(t.turn_id);return{messageId:n,delta:r,turnId:o||void 0}}return null}function pO(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/completed"){const n=Ve(t.item);if(!n||n.type!=="agentMessage")return null;const r=Re(n.id),o=Re(n.text);if(!r||!o)return null;const a=Re(t.turnId)||Re(t.turn_id);return{id:r,role:"assistant",text:o,messageType:"agentMessage",turnId:a||void 0}}return null}function mO(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function gO(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 vO(e){if(e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n)return null;const r=Re(n.id);if(!r)return null;if(n.type==="imageView"){const s=Re(n.path);return s?{id:r,role:"assistant",text:"",images:[mO(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const o=Re(n.result),a=o?gO(o):"";return a?{id:r,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function yO(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=Ve(e.params);if(!t)return null;const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{itemId:n,delta:r}}const fl="__global__";function wO(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function Yw(e){const t=Ve(e);if(!t)return null;const n=t.id,r=Re(t.method),o=t.params;if(typeof n!="number"||!Number.isInteger(n)||!r)return null;const a=Ve(o),s=bO(r,a),i=Re(a==null?void 0:a.threadId)||Re(a==null?void 0:a.thread_id)||Re(a==null?void 0:a.conversationId)||Re(a==null?void 0:a.conversation_id)||fl,l=Re(a==null?void 0:a.turnId)||Re(a==null?void 0:a.turn_id),u=Re(a==null?void 0:a.itemId)||Re(a==null?void 0:a.item_id)||Re(a==null?void 0:a.callId)||Re(a==null?void 0:a.call_id),d=Re(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:u,receivedAtIso:d,params:o??null}}function bO(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||TO(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||kO(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||SO(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||xO(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||IO(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||CO(t)?"item/tool/call":n)}function TO(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 kO(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 SO(e){return!!(e&&Array.isArray(e.questions))}function CO(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function xO(e){if(!e)return!1;const t=Re(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function IO(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ve(e.permissions)!==null:!1}function AO(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ve(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const o of n){const a=Ve(o),s=Re(a==null?void 0:a.id).trim();s&&r.push(s)}return r}function _O(e,t){const n=t.threadId||fl,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 PO(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=kt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function EO(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function MO(e,t){const n={},r=new Set;for(const a of t){const s=a.threadId||fl,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 Jw(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];Tl(r,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function RO(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=kt(e.liveAgentMessagesByThreadId.value,t))}function LO(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[];Tl(r,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function jO(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},Vw(e.lastPlanByThreadId.value))}function $O(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[],o=Xc(r,n);LO(e,t,o),jO(e,t,n)}function NO(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[],o=Xc(r,n);jh(e,t,o)}function OO(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];let o=Xc(r,n);const a=os(n.text);if(n.role==="assistant"&&a.length>0){const s=o.filter(i=>i.id===n.id||os(i.text)!==a);s.length!==o.length&&(o=s)}Jw(e,t,o)}function jh(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[];Tl(r,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function DO(e,t,n){const r=e.liveCommandsByThreadId.value[t]??[],o=Xc(r,n);o!==r&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:o})}function FO(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=kt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function BO(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=kt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function UO(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},jh(e,t,s)}function zO(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}))},jh(e,t,s)}function HO(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 WO(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 qO(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 GO(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 VO(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 Zg=8e3,KO=1500,YO=15*60*1e3;function JO(e){let t=jN(),n=!1,r=null;function o(){r===null&&(r=setTimeout(()=>{if(r=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(Bw,JSON.stringify(t))}catch{}n&&o()},KO))}function a(d,m){if(!d||e.inProgressById.value[d]!==!0)return;const f=m.length>Zg?m.slice(-Zg):m;t[d]={text:f,ts:Date.now()},n=!0,o()}function s(d,m){if(!d)return;const f=m.trim(),v=e.liveReasoningTextByThreadId.value[d]??"";if(f.length===0){if(!v)return;e.liveReasoningTextByThreadId.value=kt(e.liveReasoningTextByThreadId.value,d);return}v!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f},a(d,f))}function i(d,m){if(!d)return;const f=e.liveReasoningTextByThreadId.value[d]??"";s(d,`${f}${m}`)}function l(d){var v;if(!d||((v=e.liveReasoningTextByThreadId.value[d])==null?void 0:v.trim()))return;const f=t[d];f!=null&&f.text&&(Date.now()-f.ts>YO||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f.text}))}function u(d){d&&d in t&&(delete t[d],n=!0,o())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:u}}function QO(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function XO(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=rD(e,t),i=o||void 0;s.length>0?eD(e,t,s,i,a):n||ZO(e,t,r,i,a),e.liveReasoningTextByThreadId.value=kt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function ZO(e,t,n,r,o){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(u=>u.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 eD(e,t,n,r,o){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const u=l.text.trim();if(!u)continue;const d=`reasoning:item:${t}:${l.itemId}`,m=s.findIndex(f=>f.id===d);if(m>=0){const f=s[m],v=l.anchorMessageId||f.reasoningAnchorMessageId,T=typeof o=="number"?o:f.turnIndex;if(f.text===u&&f.turnIndex===T&&f.reasoningAnchorMessageId===v)continue;s[m]={...f,text:u,reasoning:{summary:[],content:[u]},turnId:r||f.turnId,turnIndex:T,reasoningAnchorMessageId:v};continue}s.some(f=>f.text===u)||s.push({id:d,role:"system",text:u,messageType:"reasoning",reasoning:{summary:[],content:[u]},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 tD(e,t,n,r){if(!t||!r)return;r.trim()&&e.reasoningItemTextByItemId.set(n,r.trim());const o=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(o.endsWith(r)||a&&r===a){e.reasoningAppendedTextByItemId.set(n,r);return}if(a&&r.startsWith(a)){const i=r.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,r);return}const s=o.length>0&&!o.endsWith(`
72
- `)?`
73
-
74
- `:"";e.appendLiveReasoningText(t,`${s}${r}`),e.reasoningAppendedTextByItemId.set(n,r)}function nD(e,t){const n=Ve(t.params);if(!n)return;const r=t.method==="item/started"||t.method==="item/completed",o=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!r&&!o)return;const a=Ve(n.item),s=Re(o?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Un(t);if(!i)return;const l=o||Re(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",u=e.turnItemSequenceByThreadId.get(i)??[];u.some(d=>d.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...u,{itemId:s,kind:l}])}function rD(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 oD(e,t,n){if(!t||!n)return;const r=e.reasoningItemTextByItemId.get(t)??"";r.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${r}${n}`)}function ev(e){e.reasoningItemTextByItemId.clear()}const Mo="gpt-5.4-mini",Qw="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",aD="big-pickle",sD=Yy;function iD(e){const t=k([]),n=k({}),r=k({}),o=k(NN()),a=k(af(o.value,e.selectedThreadId.value)),s=k("medium"),i=k("standard"),l=k(""),u=k(""),d=k(!1),m=k({});let f=!1;function v(Ce){if(Ja(Ce)===ba){const xe=zs(l.value),Ee=Vu(xe),Je=Ee?_i(o.value[Ee]):"";if(Je)return Je}return af(o.value,Ce).trim()}function T(Ce){const Se=Ce.trim();return zs(Se?m.value[Se]??l.value:l.value)}function S(Ce){const Se=Ce.trim();return!Se||Ja(Se)===ba?!1:af(o.value,Se).trim().length>0}function R(Ce){const Se=Ce.trim();if(!Se)return!1;const xe=Ja(Se);return xe===ba?!1:_i(o.value[xe]).length>0}function E(Ce){return n.value[Ce.trim()]??sD}function N(Ce,Se=s.value){const xe=Ce.trim(),Ee=E(xe);if(Se&&Ee.includes(Se))return Se;if(Ee.includes("medium"))return"medium";const Je=r.value[xe];return Je&&Ee.includes(Je)?Je:Ee[0]??""}function W(Ce){s.value=N(Ce)}function L(Ce){const Se={},xe={};for(const Ee of Ce)Ee.supportedReasoningEfforts!==null&&(Se[Ee.id]=[...Ee.supportedReasoningEfforts]),Ee.defaultReasoningEffort&&(xe[Ee.id]=Ee.defaultReasoningEffort);n.value=Se,r.value=xe}function fe(...Ce){const Se=[...t.value];for(const xe of Ce){const Ee=xe.trim();Ee&&!Se.includes(Ee)&&Se.push(Ee)}Xa(t.value,Se)||(t.value=Se)}function le(Ce){const Se=Ce.trim();return t.value.length===0||Se&&t.value.includes(Se)?Se:t.value[0]??""}function Y(Ce,Se){const xe=Se.trim(),Ee=Ja(Ce),Je=zs(l.value),Xe=Ee===ba?Vu(Je):"",lt=Xe||Ee;if(xe){const ce=oc(o.value);ce[lt]=xe,Xe&&delete ce[Ee],o.value=ce}else{let ce=Xl(o.value,lt);Xe&&(ce=Xl(ce,Ee)),o.value=ce}Ee===Ja(e.selectedThreadId.value)?(a.value=v(e.selectedThreadId.value),fe(a.value),W(a.value)):fe(xe),Yu(o.value)}function ie(Ce){Y(e.selectedThreadId.value,Ce)}function we(Ce,Se){const xe=Ce.trim();if(!xe)return;const Ee=Se.trim();if(Ee){const Je=oc(o.value);Je[xe]=Ee,o.value=Je}else o.value=Xl(o.value,xe);fe(Ee),e.selectedThreadId.value===xe&&(a.value=v(e.selectedThreadId.value),W(a.value)),Yu(o.value)}function Pe(Ce,Se){const xe=Ce.trim();if(!xe)return;const Ee=zs(Se);Ee?m.value={...m.value,[xe]:Ee}:m.value[xe]&&(m.value=kt(m.value,xe))}function ye(Ce,Se,xe){const Ee=Se.trim();if(zs(xe)!=="opencode-zen")return Ee;const Xe=v(Ce).trim();return Xe&&!/^gpt-/i.test(Xe)?Xe:Ee&&!/^gpt-/i.test(Ee)?Ee:aD}async function ee(Ce=e.selectedThreadId.value){var xe;const Se=Ce.trim();Se?(we(Se,Mo),(xe=e.onThreadModelChanged)==null||xe.call(e,Se)):ie(Mo),fe(Mo)}function ve(Ce){Ce&&!E(a.value).includes(Ce)||(f=!0,s.value=Ce)}async function ne(Ce){const Se=Ce==="fast"?"fast":"standard";if(d.value||i.value===Se)return;const xe=i.value;i.value=Se,d.value=!0,e.error.value="";try{await kA(Se)}catch(Ee){i.value=xe,e.error.value=Ee instanceof Error?Ee.message:"Failed to update Fast mode"}finally{d.value=!1}}function Ae(Ce,Se,xe){const Ee=Ce.trim()||"default",Je=Se||"default",Xe=xe==="plan"?"Plan":"Default",lt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Xe}`,`Model: ${Ee}`,`Thinking: ${Je}`,`Speed: ${lt}`]}async function De(Ce){u.value="";try{const Se=await IA(),xe=Se.model.trim(),Ee=zs(Se.providerId);l.value=Ee;const Je=T(e.selectedThreadId.value),Xe=Je!=="codex"&&Je!=="custom",lt=v(e.selectedThreadId.value),ce=await xA({includeProviderModels:Xe||(Ce==null?void 0:Ce.includeProviderModels)!==!1,requireProviderModels:Xe,providerId:Xe?Je:void 0}),F=ce.map(P=>P.id);L(ce);const oe=Vu(Je),se=oe?_i(o.value[oe]):"",Le=[...F];!(Ce!=null&&Ce.providerChanged)&&Xe&&Je===Ee&&xe&&!Le.includes(xe)&&Le.push(xe),t.value=Le;const We=lt&&F.includes(lt);if(!lt||!We||Ce!=null&&Ce.providerChanged?Ce!=null&&Ce.providerChanged&&Le.length>0?se&&F.includes(se)?ie(se):Je===Ee&&xe&&Le.includes(xe)?ie(xe):ie(Le[0]):Je===Ee&&xe&&Le.includes(xe)?ie(Se.model):Le.length>0?ie(Le[0]):ie(""):a.value.trim()!==lt&&ie(lt),oe&&a.value.trim().length>0){const P=oc(o.value);P[oe]=a.value.trim();const $=Vu(Ee);$&&$!==oe&&xe&&(P[$]=xe),o.value=P,Yu(o.value)}s.value=N(a.value,f?s.value:"medium"),i.value=Se.speedMode}catch(Se){u.value=Mw(Se)?Qw:""}}function $e(Ce){a.value=le(v(Ce)),W(a.value)}function je(Ce){const Se=Ew(o.value,Ce);Se!==o.value&&(o.value=Se,$e(e.selectedThreadId.value),Yu(Se)),m.value=sn(m.value,Ce)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:u,isUpdatingSpeedMode:d,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:ee,buildPendingTurnDetails:Ae,hasThreadModelSelection:S,hasThreadOwnModelSelection:R,pruneThreadModelState:je,readModelIdForThread:v,refreshModelPreferences:De,resolveThreadModelForProvider:ye,setSelectedModelId:ie,setSelectedModelIdForThread:Y,setSelectedReasoningEffort:ve,setThreadModelId:we,setThreadModelProviderId:Pe,syncSelectedThreadModel:$e,updateSelectedSpeedMode:ne}}function lD(e){const t=k([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=k(ON()),r=k(sf(n.value,e.value));function o(u){const d=u==="plan"?"plan":"default",m=Ja(e.value);sf(n.value,e.value)===d&&r.value===d||(r.value=d,n.value=Wg(n.value,m,d),uf(n.value))}function a(u,d){const m=d==="plan"?"plan":"default";n.value=Wg(n.value,u,m),u.trim()===e.value&&(r.value=m),uf(n.value)}function s(u){r.value=sf(n.value,u)}function i(u){const d=Ew(n.value,u);d!==n.value&&(n.value=d,s(e.value),uf(d))}async function l(){try{const u=await _A();t.value=u,u.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 uD=500;function cD(){const e=k(null),t=k([]),n=G(()=>e.value);let r=null,o=null;function a(u){e.value=u}async function s(){if(o){await o;return}o=(async()=>{try{const u=await g_();a(u),t.value=u?[u]:[]}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()},uD)}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 dD(e){const t=k(VN()),n=k(YN());let r=null;function o(f,v={}){t.value=f,v.persist!==!1&&KN(f)}function a(f,v={}){n.value=f,v.persist!==!1&&JN(f)}async function s(f,v){try{const T=await nl(),S={...T.labels};let R=!1;for(const E of T.order){if(!ac(E,f))continue;const N=v.trim();N.length===0?S[E]!==void 0&&(delete S[E],R=!0):S[E]!==N&&(S[E]=N,R=!0)}R&&await Xd({order:T.order,labels:S,active:T.active,projectOrder:T.projectOrder})}catch{}}function i(f,v){f.length===0||(n.value[f]??"")===v||(a({...n.value,[f]:v}),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,s(f,v)},500))}async function l(){try{const f=await nl(),v=yN(f,t.value,e.sourceGroups.value);await Xd({order:v.order,labels:f.labels,active:v.active,projectOrder:v.projectOrder})}catch{}}async function u(f){var E;if(f.length===0)return;const v=t.value.filter(N=>N!==f);if(Xa(t.value,v)||o(v),e.sourceGroups.value=e.sourceGroups.value.filter(N=>N.projectName!==f),n.value[f]!==void 0){const N={...n.value};delete N[f],a(N)}e.applyThreadFlags();const T=Jn(e.projectGroups.value);e.pruneThreadScopedState(T),T.some(N=>N.id===e.selectedThreadId.value)||e.setSelectedThreadId(((E=T[0])==null?void 0:E.id)??"");const R=new Set;try{const N=await nl();vN(N,f).forEach(W=>{R.add(W)})}catch{}if(R.size>0)try{const N=await nl(),W=N.order.filter(le=>!R.has(le)),L=N.active.filter(le=>!R.has(le)),fe=L.length===0&&W.length>0?[W[0]]:L;await Xd({order:W,labels:cN(N.labels,R),active:fe,projectOrder:N.projectOrder.filter(le=>le!==f&&!R.has(le))});return}catch{}await l()}function d(f,v){if(f.length===0||e.sourceGroups.value.length===0)return;const T=e.sourceGroups.value.map(W=>W.projectName),S=T.indexOf(f);if(S===-1)return;const R=Math.max(0,Math.min(v,T.length-1)),E=J$(T,S,R);if(E===T)return;o(tl(E,e.sourceGroups.value));const N=Of(e.sourceGroups.value,t.value);e.sourceGroups.value=xc(e.sourceGroups.value,N),e.applyThreadFlags(),l()}function m(f){const v=f.trim();if(!v)return;const T=[v,...t.value.filter(R=>R!==v)];if(Xa(t.value,T))return;o(T);const S=Of(e.sourceGroups.value,t.value);e.sourceGroups.value=xc(e.sourceGroups.value,S),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:m,removeProject:u,renameProject:i,reorderProject:d,setProjectDisplayNames:a,setProjectOrder:o}}const fD=2e3;function hD(e){const t=k([]),n=k([]),r=k(!1);let o=null,a=null,s=!1,i=!1,l=0,u="";async function d(f={}){const v=e.getSelectedCwd().trim(),T=v||"__global__";if(o){await o;return}f.force!==!0&&s&&u===T&&Date.now()-l<fD||(o=(async()=>{try{t.value=await r_(v?[v]:void 0),s=!0,l=Date.now(),u=T}catch{}finally{o=null}})(),await o)}async function m(f={}){if(a){await a;return}f.force!==!0&&i||(r.value=!0,a=(async()=>{try{n.value=await MA(),i=!0}catch{}finally{r.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:r,refreshHooks:m,refreshSkills:d}}const Xw="codex-web-local.stashed-messages.v1",Zw="codex-web-local.auto-compact-threshold.v1",Ju=10,pD=650;function mD(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Xw);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 gD(){if(typeof window>"u")return Ju;try{const e=window.localStorage.getItem(Zw);if(e===null)return Ju;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Ju}catch{return Ju}}function vD(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 yD(e){const t=k({}),n=k({}),r=k(mD()),o=k(gD());let a=!1;const s=G(()=>{const Y=e.value;if(!Y)return[];const ie=t.value[Y]??[];return[...(r.value[Y]??[]).map(ye=>({...ye,awaitingCompaction:!0})),...ie]});function i(){typeof window>"u"||window.localStorage.setItem(Xw,JSON.stringify(r.value))}function l(){zA(vD(t.value)).catch(()=>{})}async function u(){if(!a){a=!0;try{t.value=await fg()}catch{}}}async function d(Y){if(n.value[Y]!==!0){n.value={...n.value,[Y]:!0};try{t.value=await fg()}catch{}finally{n.value=kt(n.value,Y)}}}function m(Y){d(Y),!(typeof window>"u")&&window.setTimeout(()=>{d(Y)},pD)}function f(Y){const ie=Number.isFinite(Y)&&Y>0?Math.round(Y):0;ie!==o.value&&(o.value=ie,!(typeof window>"u")&&window.localStorage.setItem(Zw,String(ie)))}function v(Y){return r.value[Y]??[]}function T(Y,ie){r.value={...r.value,[Y]:[...v(Y),ie]},i()}function S(Y){const ie=[...v(Y)];return ie.length===0||(r.value=kt(r.value,Y),i()),ie}function R(Y,ie,we){const ye=[...t.value[Y]??[]],ee=typeof we=="number"?Math.max(0,Math.min(we,ye.length)):ye.length;ye.splice(ee,0,ie),t.value={...t.value,[Y]:ye},l()}function E(Y,ie){return v(Y).find(we=>we.id===ie)}function N(Y,ie){var we;return(we=t.value[Y])==null?void 0:we.find(Pe=>Pe.id===ie)}function W(Y){const ie=e.value;if(!ie)return;if(E(ie,Y)){const ye=v(ie).filter(ee=>ee.id!==Y);r.value=ye.length>0?{...r.value,[ie]:ye}:kt(r.value,ie),i();return}const we=t.value[ie];if(!we)return;const Pe=we.filter(ye=>ye.id!==Y);t.value=Pe.length>0?{...t.value,[ie]:Pe}:kt(t.value,ie),l()}function L(Y,ie){const we=e.value;if(!we)return;const Pe=t.value[we];if(!Pe||E(we,Y)||E(we,ie))return;const ye=Pe.findIndex(Ae=>Ae.id===Y),ee=Pe.findIndex(Ae=>Ae.id===ie);if(ye<0||ee<0||ye===ee)return;const ve=[...Pe],[ne]=ve.splice(ye,1);ve.splice(ee,0,ne),t.value={...t.value,[we]:ve},l()}function fe(Y){const ie=sn(t.value,Y);ie!==t.value&&(t.value=ie,l())}function le(){t.value={},n.value={},r.value={},i(),l()}return{appendStashedMessage:T,autoCompactThreshold:o,clearQueueState:le,enqueueQueuedMessage:R,findQueuedMessage:N,findStashedMessage:E,getStashedMessages:v,loadPersistedQueueStateIfNeeded:u,processQueuedMessages:d,pruneQueueState:fe,removeQueuedMessage:W,reorderQueuedMessage:L,scheduleQueueStateRefresh:m,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:S}}const wD=1e4,bD=2e3;function TD(e){const{selectedThreadId:t,projectGroups:n,inProgressById:r,applyThreadGroups:o,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:u}=e,d=k(!1),m=k(!1),f=k(!1);let v=null,T=0,S=null,R=null,E=!1,N=!1,W=[],L=null;function fe(ve,ne){if(ve.length===0)return ne;if(ne.length===0)return ve;const Ae=new Map;for(const $e of Jn(ve))Ae.set($e.id,$e);for(const $e of Jn(ne))Ae.set($e.id,$e);const De=new Map;for(const $e of Ae.values()){const je=De.get($e.projectName);je?je.push($e):De.set($e.projectName,[$e])}return Array.from(De.entries()).map(([$e,je])=>({projectName:$e,threads:je.sort((Ce,Se)=>new Date(Se.updatedAtIso).getTime()-new Date(Ce.updatedAtIso).getTime())})).sort(($e,je)=>{var xe,Ee;const Ce=new Date(((xe=$e.threads[0])==null?void 0:xe.updatedAtIso)??0).getTime();return new Date(((Ee=je.threads[0])==null?void 0:Ee.updatedAtIso)??0).getTime()-Ce})}function le(){return Object.values(r.value).some(ve=>ve===!0)}function Y(ve=L){if(!(!S||E||le())){if(L=ve,typeof window>"u"){ie(ve);return}R!==null&&window.clearTimeout(R),R=window.setTimeout(()=>{R=null,!(!S||le())&&ie(L)},wD)}}async function ie(ve){if(!(E||!S||le())){E=!0;try{const ne=await tg(S,DA());S=ne.nextCursor,N=ne.nextCursor===null,f.value=N,W=fe(W,ne.groups),o(W,ve)}catch{}finally{E=!1,S&&!le()&&Y(ve)}}}async function we(ve={}){if(v){await v;return}ve.force!==!0&&d.value&&Date.now()-T<bD||(v=(async()=>{var ne;d.value||(m.value=!0);try{const[Ae,De]=await Promise.all([tg(),i(),s({force:ve.force===!0})]);L=De;const $e=Ae.groups;W=$e,S=Ae.nextCursor,N=Ae.nextCursor===null,f.value=N,await a($e,De),o(W,De),d.value=!0,T=Date.now(),N||Y(De);const je=Jn(n.value);l(je),!je.some(Se=>Se.id===t.value)&&!t.value&&u(((ne=je[0])==null?void 0:ne.id)??"")}finally{m.value=!1}})().finally(()=>{v=null}),await v)}function Pe(ve){W=jw(W,ve)}function ye(){return S!==null}function ee(){R!==null&&typeof window<"u"&&(window.clearTimeout(R),R=null)}return{dispose:ee,hasActiveInProgressThreads:le,hasLoadedThreads:d,hasRemainingThreadPages:ye,isLoadingThreads:m,isThreadListFullyLoaded:f,loadThreads:we,removeThreadFromLoadedLists:Pe,scheduleRemainingThreadPages:Y}}const tv=2e3;function kD(e){const t=k({}),n=k({}),r=k({}),o=k({}),a=k(!1),s=5e3,i=k(null);let l=0,u=null;function d(){l&&(clearTimeout(l),l=0),u=null,i.value=null}function m(L){d(),u=L,l=window.setTimeout(()=>{l=0,i.value=u},s)}const f=new Map,v=new Map,T=new Map;let S=0;async function R(L,fe={}){var ye;if(!L)return;const le=Date.now()-(T.get(L)??0)<tv;if((ye=e.turnErrorByThreadId.value[L])!=null&&ye.transient&&(fe.silent===!0||le))return;const Y=f.get(L);if(Y&&fe.force!==!0){await Y;return}const ie=n.value[L]===!0,we=fe.silent!==!0&&!ie;we&&(S+=1,a.value=!0),m(L);const Pe=(async()=>{try{const ee=e.currentThreadVersion(L),ve=t.value[L]??"",ne=Date.now()-(v.get(L)??0)<tv;if(fe.force===!0?!1:ie&&(ne||(ee.length===0||ve===ee)&&e.inProgressById.value[L]!==!0)){e.markThreadAsRead(L);return}const $e=e.resumedThreadById.value[L]!==!0?await Lf(L):null,je=$e??await Rf(L);je.modelProvider&&e.setThreadModelProviderId(L,je.modelProvider),je.model&&!e.hasThreadOwnModelSelection(L)&&e.setThreadModelId(L,e.resolveThreadModelForProvider(L,je.model,je.modelProvider)),$e&&(e.resumedThreadById.value={...e.resumedThreadById.value,[L]:!0});const{messages:Ce,inProgress:Se,activeTurnId:xe,turnIndexByTurnId:Ee}=je,Je=e.persistedMessagesByThreadId.value[L]??[],Xe=Ce.length===0&&Je.length>0;Xe&&console.warn(`[thread-load] ${L}: server returned 0 messages while ${Je.length} are persisted locally; keeping local history`),r.value={...r.value,[L]:je.hasMoreOlder===!0},e.markThreadMessagesPersisted(L,Ce),Xe||e.replaceTurnIndexLookupForThread(L,Ee),e.rebindLiveFileChangeTurnIndices(L);const lt=Gg(Je,Ce,{preserveMissing:fe.silent===!0||tN(Je)||Xe});e.setPersistedMessagesForThread(L,lt);const ce=e.liveAgentMessagesByThreadId.value[L]??[];if(Se){const F=rN(ce,Ce);e.setLiveAgentMessagesForThread(L,F)}else e.clearLiveAgentMessagesForThread(L);e.removeLiveCommandsPersistedIn(L,Ce),e.removeLiveFileChangesPersistedIn(L,Ce),n.value={...n.value,[L]:!0},v.set(L,Date.now()),T.delete(L),ee&&(t.value={...t.value,[L]:ee}),e.setThreadInProgress(L,Se),je.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[L]:je.externalSession}),e.clearTransientTurnErrorForThread(L),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[L]:xe}:e.activeTurnIdByThreadId.value[L]&&(e.activeTurnIdByThreadId.value=kt(e.activeTurnIdByThreadId.value,L)),Se||e.clearCompletedTurnLiveState(L),e.markThreadAsRead(L)}catch(ee){const ve=ee instanceof Error?ee.message:"Unknown application error";throw e.selectedThreadId.value===L&&e.setTurnErrorForThread(L,ve,{transient:!0}),T.set(L,Date.now()),ee}finally{we&&(S=Math.max(0,S-1),S===0&&(a.value=!1))}})().finally(()=>{u===L&&d(),f.delete(L)});f.set(L,Pe),await Pe}async function E(L=e.selectedThreadId.value){if(!L||o.value[L]===!0||r.value[L]!==!0)return;const fe=e.getFirstPersistedTurnId(L);if(!fe){r.value={...r.value,[L]:!1};return}o.value={...o.value,[L]:!0};try{const le=await cA(L,fe),Y=e.persistedMessagesByThreadId.value[L]??[],ie=Gg(le.messages,Y,{preserveMissing:!0});e.setPersistedMessagesForThread(L,ie),e.replaceTurnIndexLookupForThread(L,{...e.turnIndexByTurnIdByThreadId.value[L]??{},...le.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(L),r.value={...r.value,[L]:le.hasMoreOlder}}catch(le){throw le instanceof Dr&&le.code==="older_turns_unavailable"&&(r.value={...r.value,[L]:!1}),e.error.value=le instanceof Error?le.message:"Failed to load earlier messages",le}finally{o.value={...o.value,[L]:!1}}}async function N(L,fe={}){var le;L&&n.value[L]!==!0&&(fe.silent===!0&&((le=e.turnErrorByThreadId.value[L])!=null&&le.transient)||await R(L,fe))}function W(L){n.value=sn(n.value,L),t.value=sn(t.value,L)}return{ensureThreadMessagesLoaded:N,hasMoreOlderMessagesByThreadId:r,isLoadingMessages:a,loadMessages:R,loadOlderMessages:E,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:o,pruneMessageHistoryState:W,slowOpenThreadId:i}}function SD(e){const t=k({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(u=>({...u,title:qs(u.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(u=>{const d=i[u.id];return{...u,title:qs(d??u.title)}})}))}async function r(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await GA();if(Object.keys(i.titles).length>0){const l={};for(const[u,d]of Object.entries(i.titles))l[u]=qs(d);t.value=l}}catch{}}function o(s,i,l){const u=s.trim();if(u)return qs(u);const d=l.map(m=>m.label.trim()).find(m=>m.length>0);return d?qs(d):i.length>0?qs("[Image]"):"Untitled thread"}async function a(s,i,l,u=[],d=[]){if(t.value[s])return;const m=i.trim();if(!m){const v=o(i,u,d);t.value={...t.value,[s]:v},e.applyThreadFlags(),Tc(s,v);return}const f=m.length>300?m.slice(0,300):m;try{const v=await t_(f,l);if(!v||t.value[s])return;const T=v.length>Uf?v.slice(0,Uf):v;t.value={...t.value,[s]:T},e.applyThreadFlags(),Tc(s,T)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:r,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:o,threadTitleById:t}}function CD(e){const t=k({}),n=k({});function r(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function o(T){_O(r(),T)}function a(T){PO(r(),T)}function s(T){MO(r(),T)}function i(T){return EO(r(),T)}const l=G(()=>{const T=[],S=e.getSelectedThreadId();return S&&Array.isArray(t.value[S])&&T.push(...t.value[S]),Array.isArray(t.value[fl])&&T.push(...t.value[fl]),T.sort((R,E)=>R.receivedAtIso.localeCompare(E.receivedAtIso))});function u(T){return T?Array.isArray(t.value[T])?t.value[T]:[]:[]}function d(T){return T.some(S=>wO(S.method))?"approval":T.length>0?"response":null}function m(T){const S={};for(const[R,E]of Object.entries(t.value))(R===fl||T.has(R))&&(S[R]=E);t.value=S}async function f(){try{const S=(await dg()).map(R=>Yw(R)).filter(R=>R!==null);s(S)}catch{}}async function v(T){try{const S=await dg();for(const R of S){const E=Ve(R);if((E==null?void 0:E.id)===T)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:u,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:v,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:m,readPendingRequestState:d,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:o}}const Qu=220,xD=3e3,ID=1500,AD=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 _D(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 PD(){const e=k([]),t=k([]),n=k(qN()),r=k(""),o=k({}),a=k({}),s=k(LN()),i=k({}),l=k({}),u=k(MN()),d=k(RN()),m=k({}),f=new Map,v=new Map,T=new Map,S=new Map,R=k({}),E=k({}),N=k({}),L=JO({liveReasoningTextByThreadId:m,inProgressById:N}),fe=k({});let le=!1;const Y=k({}),{activeProviderId:ie,availableModelIds:we,availableModelReasoningEfforts:Pe,codexCliMissingError:ye,isUpdatingSpeedMode:ee,selectedModelId:ve,selectedReasoningEffort:ne,selectedSpeedMode:Ae,applyFallbackModelSelection:De,buildPendingTurnDetails:$e,hasThreadModelSelection:je,hasThreadOwnModelSelection:Ce,pruneThreadModelState:Se,readModelIdForThread:xe,refreshModelPreferences:Ee,resolveThreadModelForProvider:Je,setSelectedModelId:Xe,setSelectedModelIdForThread:lt,setSelectedReasoningEffort:ce,setThreadModelId:F,setThreadModelProviderId:oe,syncSelectedThreadModel:se,updateSelectedSpeedMode:Le}=iD({selectedThreadId:n,error:r,onThreadModelChanged:p=>Ea(p)}),{availableCollaborationModes:We,selectedCollaborationMode:P,pruneThreadCollaborationState:$,refreshCollaborationModes:q,setSelectedCollaborationMode:ue,setSelectedCollaborationModeForThread:re,syncSelectedThreadCollaborationMode:ae}=lD(n),_e=k(EN()),Ne=k($N()),{projectDisplayNameById:Ie,projectOrder:he,pinProjectToTop:Ke,removeProject:Oe,renameProject:qe,reorderProject:Ge,setProjectDisplayNames:dt,setProjectOrder:bt}=dD({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:yn,pruneThreadScopedState:To,setSelectedThreadId:Mn}),ot=k({}),ut=k({}),J=k({}),de=k({}),ke=k({}),Be=k({}),vt=kD({selectedThreadId:n,error:r,persistedMessagesByThreadId:o,liveAgentMessagesByThreadId:i,inProgressById:N,externalSessionByThreadId:fe,resumedThreadById:ot,turnIndexByTurnIdByThreadId:ut,turnErrorByThreadId:ke,activeTurnIdByThreadId:Be,markThreadAsRead:ps,markThreadMessagesPersisted:Ri,replaceTurnIndexLookupForThread:C,rebindLiveFileChangeTurnIndices:x,setPersistedMessagesForThread:On,setLiveAgentMessagesForThread:ko,clearLiveAgentMessagesForThread:Ma,removeLiveCommandsPersistedIn:Ra,removeLiveFileChangesPersistedIn:ua,setThreadInProgress:wn,setThreadModelProviderId:oe,setThreadModelId:F,resolveThreadModelForProvider:Je,hasThreadOwnModelSelection:Ce,clearTransientTurnErrorForThread:ys,clearCompletedTurnLiveState:$i,setTurnErrorForThread:Nt,getFirstPersistedTurnId:oi,currentThreadVersion:qn}),{ensureThreadMessagesLoaded:yt,hasMoreOlderMessagesByThreadId:Bt,isLoadingMessages:Bo,loadMessages:Yt,loadOlderMessages:fo,loadedMessagesByThreadId:er,loadedVersionByThreadId:ka,loadingOlderMessagesByThreadId:ho,pruneMessageHistoryState:ni,slowOpenThreadId:Sa}=vt,is=SD({applyThreadFlags:yn}),{threadTitleById:Fr,applyCachedTitlesToGroups:ls,loadThreadTitleCacheIfNeeded:Br,requestThreadTitleGeneration:Uo}=is,zo=CD({applyThreadFlags:yn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:ri,loadPendingServerRequestsFromBridge:Ho,pendingReplyErrorByRequestId:Ur,pendingReplyErrorForRequest:us,pendingRequestStillExistsOnServer:Ca,pendingServerRequestsByThreadId:Wo,prunePendingServerRequestsByActiveThreads:po,readPendingRequestState:mo,removePendingServerRequestById:Sr,selectedThreadServerRequests:cs,upsertPendingServerRequest:xa}=zo,gt={liveReasoningTextByThreadId:m,persistedReasoningByThreadId:u,turnIndexByTurnIdByThreadId:ut,activeTurnIdByThreadId:Be,activeReasoningTurnIdByThreadId:S,reasoningItemTextByItemId:v,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:T,appendLiveReasoningText:(p,y)=>L.appendLiveReasoningText(p,y),clearLiveReasoningSnapshot:p=>L.clearLiveReasoningSnapshot(p),savePersistedReasoningMap:Bl},Tt=k({}),Ct=k({}),en=k({}),$n=k({}),pn=k({}),{accountRateLimitSnapshots:Cr,codexQuota:hr,refreshRateLimits:qo,scheduleRateLimitRefresh:mn,setCodexRateLimit:tr,stopRateLimitRefresh:xr}=cD(),Rt=k(DN()),go=k(HN()),nr=k(UN()),kn=k({}),zr=k(!1),Nn=k(!1),Pn=k(!1),Sn=k(new Set),Ia=6e4,pr=k([]);let Hr="";const Ut=k(!1);function vo(p){var y;try{const A=new URL(p,"http://localhost");return A.pathname!=="/codex-local-image"?"":((y=A.searchParams.get("path"))==null?void 0:y.trim())??""}catch{return""}}function Go(p){const y=p.trim().toLowerCase();return y?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(y):!1}function Vo(p){var A;const y=o.value[p]??[];for(let j=y.length-1;j>=0;j-=1){const H=y[j];if(!(H.role!=="user"||!Array.isArray(H.images)||H.images.length===0))for(let V=H.images.length-1;V>=0;V-=1){const z=((A=H.images[V])==null?void 0:A.trim())??"";if(z&&vo(z))return z}}return""}let Cn=null,Xt=null;const mr=new Map;let ln=!1,Ko=!1;const tn=new Set,Wr=new Set;let Yo=!1,zt=!1;const Jo=new Map,Qo=new Set,It=TD({selectedThreadId:n,projectGroups:e,inProgressById:N,applyThreadGroups:li,hydrateWorkspaceRootsStateIfNeeded:da,loadThreadTitleCacheIfNeeded:Br,loadWorkspaceRootsStateForThreadList:Dn,pruneThreadScopedState:To,setSelectedThreadId:Mn}),vn=G(()=>Jn(e.value)),yo=G(()=>vn.value.find(p=>p.id===n.value)??null),{appendStashedMessage:Ir,autoCompactThreshold:Ar,clearQueueState:Xo,enqueueQueuedMessage:qr,findQueuedMessage:Zo,findStashedMessage:rr,getStashedMessages:wo,loadPersistedQueueStateIfNeeded:ea,pruneQueueState:_r,removeQueuedMessage:mt,reorderQueuedMessage:En,scheduleQueueStateRefresh:xn,selectedThreadQueuedMessages:Aa,setAutoCompactThreshold:Wn,takeStashedMessages:I}=yD(n),{hooksList:O,installedSkills:K,isHooksLoading:Te,refreshHooks:He,refreshSkills:$t}=hD({getSelectedCwd:()=>{var p;return((p=yo.value)==null?void 0:p.cwd)??""}}),xt=G(()=>{const p=n.value;return!!(p&&go.value[p]===!0)}),nn=G(()=>{const p=n.value;return p?Tt.value[p]===!0:!1}),Jt=G(()=>{const p=n.value;return p?Be.value[p]??"":""}),Pr=G(()=>{var Z;const p=n.value;if(!p)return null;const y=N.value[p]===!0,A=y?de.value[p]:void 0,j=y?(m.value[p]??"").trim():"",H=(((Z=ke.value[p])==null?void 0:Z.message)??"").trim();let V="";if(!y&&H){const me=o.value[p]??[];for(let ge=me.length-1;ge>=0;ge-=1){const ze=me[ge];if(ze.messageType==="turnError"){V=os(ze.text);break}}}const z=!y&&H&&V===H?"":H;return!y&&!A&&!j&&!z?null:{activityLabel:(A==null?void 0:A.label)||"Thinking",activityDetails:(A==null?void 0:A.details)??[],reasoningText:j,errorText:z}}),_a=G(()=>{const p=n.value;return p?Rt.value[p]??null:null}),ds=G(()=>{const p=n.value;if(!p)return[];const y=o.value[p]??[],A=a.value[p]??[],j=i.value[p]??[],H=R.value[p]??[],V=E.value[p]??[],z=l.value[p]??[],Z=u.value[p]??[],me=y.some(Lt=>Lt.messageType==="compaction.done"),ge=Sn.value.has(p),ze=me&&!ge?z.filter(Lt=>Lt.messageType!=="compaction.pending"&&Lt.messageType!=="compaction.done"):z,nt=_N(p,y,Z,[A,H,V,j],ze),Pt=J.value[p],at=Pt?lN(nt,Pt):nt,At=uN(at,d.value[p]),St=nr.value[p]??[];return _D(At,St)}),un=G(()=>{const p=n.value;return p?$n.value[p]??null:null}),ta=G(()=>{const p=n.value;return p?Bt.value[p]===!0:!1}),Pa=G(()=>{const p=n.value;return p?ho.value[p]===!0:!1});function oi(p){var A;const y=o.value[p]??[];for(const j of y){const H=((A=j.turnId)==null?void 0:A.trim())??"";if(H)return H}return""}function Mn(p,y={}){n.value!==p&&(n.value=p,y.persist!==!1&&GN(p),se(p),ae(p),zt=!1)}function fs(p,y){const A=p.trim();if(!A)return;if(!y){if(!(A in Rt.value))return;Rt.value=kt(Rt.value,A),cf(Rt.value);return}const j=Rt.value[A];if(j&&JSON.stringify(j)===JSON.stringify(y))return;Rt.value={...Rt.value,[A]:y},cf(Rt.value);const H=wo(A);H&&H.length>0&&Ar.value>0&&(y.remainingContextPercent!==null&&y.remainingContextPercent<=Ar.value?Sn.value.has(A)||to(A):Co(A))}function ai(p,y){pn.value={...pn.value,[p]:y}}function hs(p,y,A){var Pt;const j=p.trim(),H=y.trim(),V=A.trim();if(!j||!V||H===V)return;const z=nr.value[j]??[],Z=o.value[j]??[],me=Z.length,ge=kn.value[j],ze=z.length>0&&ge!==void 0&&ge===me;let nt;if(ze){const at=z[z.length-1];nt=[...z.slice(0,-1),{...at,modelSwitchFrom:H||void 0,modelSwitchTo:V}]}else{const at=(Pt=Z[Z.length-1])==null?void 0:Pt.id,At={id:`model-switch:${j}:${Date.now()}:${z.length}`,role:"system",text:"",messageType:xw,modelSwitchFrom:H||void 0,modelSwitchTo:V,...at?{modelSwitchInsertAfterId:at}:{}};nt=[...z,At].slice(-Iw)}nr.value={...nr.value,[j]:nt},kn.value={...kn.value,[j]:me},zN(nr.value)}function Ea(p){const y=p.trim(),A=Rt.value[y];A&&A.modelContextWindow!==null&&(Rt.value={...Rt.value,[y]:{...A,modelContextWindow:null,remainingContextTokens:null,remainingContextPercent:null}},cf(Rt.value))}function na(p){pn.value[p]&&(pn.value=kt(pn.value,p))}async function rn(p){var A,j;if(Qo.has(p))return;const y=pn.value[p];if(!(!y||y.fallbackRetried)){Qo.add(p),ai(p,{...y,fallbackRetried:!0});try{await De(p);try{const H=((j=(A=(o.value[p]??[]).reduce((V,z)=>{const Z=typeof z.turnIndex=="number"?z.turnIndex:-1,me=V!==null&&typeof V.turnIndex=="number"?V.turnIndex:-1;return Z>=0&&Z>me?z:V},null))==null?void 0:A.turnId)==null?void 0:j.trim())??"";if(H){const V=await Kd(p,H);On(p,V),ia(p),ko(p,[]),Qr(p),R.value[p]&&(R.value=kt(R.value,p))}}catch{}if(Nt(p,null),r.value="",on(p,null),_t(p,{label:"Thinking",details:$e(Mo,y.effort,y.collaborationMode)}),wn(p,!0),ot.value[p]!==!0){const H=await Lf(p);H.model&&F(p,Je(p,H.model,H.modelProvider)),H.modelProvider&&oe(p,H.modelProvider),ot.value={...ot.value,[p]:!0}}await Jd(p,y.text,y.imageUrls,Mo,y.effort||void 0,y.skills.length>0?y.skills:void 0,y.fileAttachments,y.collaborationMode),mn(),tn.add(p),await Fn()}catch(H){const V=H instanceof Error?H.message:"Unknown application error";Nt(p,V),r.value=V,wn(p,!1),_t(p,null)}finally{Qo.delete(p)}}}function ra(p){if(!p||typeof window>"u")return;const y=mr.get(p);y!==void 0&&(window.clearTimeout(y),mr.delete(p))}function Gr(p){if(!p||typeof window>"u")return;ra(p);const y=window.setTimeout(()=>{mr.delete(p),tn.add(p),Fn()},xD);mr.set(p,y)}function yn(){const y=ls(t.value).map(A=>({projectName:A.projectName,threads:A.threads.map(j=>{const H=fe.value[j.id]??j.externalSession??null,V=N.value[j.id]===!0||(H==null?void 0:H.active)===!0,z=mo(ri(j.id)),Z=n.value===j.id,me=Y.value[j.id]===!0,ge=K$(j.updatedAtIso,_e.value[j.id],Ne.value);return{...j,inProgress:V,unread:!Z&&!V&&(me||ge),pendingRequestState:z,...H?{externalSession:H}:{}}})}));e.value=xc(e.value,y)}function bo(p,y,A){const j=new Date().toISOString(),H=et(y),V=so(H),z={id:p,title:qs(A),projectName:V,cwd:H,hasWorktree:H.includes("/.codex/worktrees/")||H.includes("/.git/worktrees/"),createdAtIso:j,updatedAtIso:j,preview:A,unread:!1,inProgress:!1},Z=t.value.findIndex(ge=>ge.projectName===V);if(Z>=0){const ze=t.value[Z].threads.filter(at=>at.id!==p),nt={projectName:V,threads:[z,...ze]},Pt=[...t.value];Pt.splice(Z,1,nt),t.value=Pt}else t.value=[{projectName:V,threads:[z]},...t.value];const me=tl(he.value,t.value);Xa(he.value,me)||bt(me),yn()}function To(p){const y=new Set(p.map(H=>H.id)),A=n.value.trim();A&&y.add(A),Se(y),$(y);const j=sn(_e.value,y);if(j!==_e.value&&(_e.value=j,Jg(j)),ni(y),ot.value=sn(ot.value,y),ut.value=sn(ut.value,y),o.value=sn(o.value,y),i.value=sn(i.value,y),m.value=sn(m.value,y),R.value=sn(R.value,y),E.value=sn(E.value,y),J.value=sn(J.value,y),de.value=sn(de.value,y),ke.value=sn(ke.value,y),Be.value=sn(Be.value,y),S.size>0)for(const H of[...S.keys()])y.has(H)||S.delete(H);xN(y),Tt.value=sn(Tt.value,y),Ct.value=sn(Ct.value,y),en.value=sn(en.value,y),_r(y),Rt.value=sn(Rt.value,y),Y.value=sn(Y.value,y),N.value=sn(N.value,y),po(y)}function ps(p){const y=Jn(t.value).find(A=>A.id===p);y&&(_e.value={..._e.value,[p]:y.updatedAtIso},Jg(_e.value),Y.value[p]&&(Y.value=kt(Y.value,p)),yn())}function on(p,y){if(!p)return;const A=J.value[p];if(y){if(aN(A,y))return;J.value={...J.value,[p]:y}}else A&&(J.value=kt(J.value,p))}function Mi(p,y,A){if(!p||!y)return;const j={...d.value[p]??{}},H=Number.isFinite(A)?Math.max(0,Math.round(A)):0;H<=0?delete j[y]:j[y]=H,Object.keys(j).length===0?d.value=kt(d.value,p):d.value={...d.value,[p]:j},Qg(d.value)}function wn(p,y,A={}){!p||N.value[p]===!0===y||(y?(N.value={...N.value,[p]:!0},ji(p)):(N.value=kt(N.value,p),$i(p,{keepLiveCommands:A.keepDeferredLiveCommands===!0}),ms(p),As(p)?to(p):Co(p)),yn(),!y&&!It.hasActiveInProgressThreads()&&It.hasRemainingThreadPages()&&It.scheduleRemainingThreadPages())}function ms(p){p&&(Tt.value[p]&&(Tt.value=kt(Tt.value,p)),Ct.value[p]&&(Ct.value=kt(Ct.value,p)),en.value[p]&&(en.value=kt(en.value,p)))}function or(p){p&&(Tt.value={...Tt.value,[p]:!0},Ct.value[p]&&(Ct.value=kt(Ct.value,p)),en.value[p]&&(en.value=kt(en.value,p)))}function gs(p){p&&Tt.value[p]===!0&&Ct.value[p]===!0&&en.value[p]===!0&&ms(p)}function vs(p,y){!p||!y||Tt.value[p]===!0&&ms(p)}function Sl(p){const y=Object.keys(Tt.value);if(y.length===0)return;let A=Ct.value,j=!1;for(const H of y)!p.has(H)||A[H]===!0||(A={...A,[H]:!0},j=!0);if(j){Ct.value=A;for(const H of y)gs(H)}}function Ri(p,y){p&&Tt.value[p]===!0&&y.some(A=>A.role==="user")&&(en.value[p]!==!0&&(en.value={...en.value,[p]:!0}),gs(p))}function si(p){p&&p!==n.value&&Y.value[p]!==!0&&(Y.value={...Y.value,[p]:!0},yn())}function _t(p,y){if(!p)return;const A=de.value[p];if(!y){A&&(de.value=kt(de.value,p));return}const j=Xr(y.label)||"Thinking",H=y.details.map(Z=>Xr(Z)).filter(Z=>Z.length>0&&Z!==j),V=Array.from(new Set([...(A==null?void 0:A.details)??[],...H])).slice(-3),z={label:j,details:V};sN(A,z)||(de.value={...de.value,[p]:z})}function Nt(p,y,A={}){if(!p)return;const j=ke.value[p],H=y?os(y):"";if(!H){j&&(ke.value=kt(ke.value,p));return}const V=A.transient===!0;(j==null?void 0:j.message)===H&&j.transient===V||(ke.value={...ke.value,[p]:{message:H,transient:V}})}function ys(p){var y;p&&(y=ke.value[p])!=null&&y.transient&&Nt(p,null)}function Er(){const p=Object.entries(ke.value).filter(([,A])=>A==null?void 0:A.transient).map(([A])=>A);if(p.length===0)return;let y=ke.value;for(const A of p)y=kt(y,A);ke.value=y}function qn(p){const y=Jn(t.value).find(A=>A.id===p);return(y==null?void 0:y.updatedAtIso)??""}function Vr(p,y){if(!p)return;const A={...go.value};y?A[p]=!0:delete A[p],go.value=A,WN(A)}function oa(){const p=n.value;p&&Vr(p,!xt.value)}function On(p,y){const A=o.value[p]??[];Tl(A,y)||(o.value={...o.value,[p]:y})}function aa(p,y,A=[],j=[],H=[]){const V=o.value[p]??[],z={id:`optimistic-user:${p}:${Date.now()}`,role:"user",text:y,images:A.length>0?[...A]:void 0,skills:j.length>0?j.map(Z=>({name:Z.name,path:Z.path})):void 0,fileAttachments:H.length>0?H.map(Z=>({...Z})):void 0,messageType:"userMessage.optimistic"};On(p,[...V,z])}function ko(p,y){Jw(ar,p,y)}function Ma(p){RO(ar,p)}function sa(p,y){$O(ar,p,y)}function Kr(p,y){OO(ar,p,y)}function Yr(p,y){NO(ar,p,y)}function Jr(p,y){L.setLiveReasoningText(p,y)}function Li(p,y){L.appendLiveReasoningText(p,y)}function ji(p){L.restoreLiveReasoningSnapshot(p)}function ws(p){QO(gt,p)}function Qr(p,y=!1){XO(gt,p,y)}function ia(p){p&&p in a.value&&(a.value=kt(a.value,p))}function bs(p){p&&p in E.value&&(E.value=kt(E.value,p))}function Ts(p){p&&(Wr.delete(p),R.value[p]&&(R.value=kt(R.value,p)))}function $i(p,y={}){if(!p)return;ia(p);const A=s.value[p];if(A&&A.messageType==="plan.live"){const j={...A,messageType:"plan",plan:A.plan?{...A.plan,isStreaming:!1}:A.plan};s.value={...s.value,[p]:j},Vw(s.value)}Qr(p),SN(p),_t(p,null),n.value,y.keepLiveCommands===!0&&R.value[p]?Wr.add(p):Ts(p),Be.value[p]&&(Be.value=kt(Be.value,p)),na(p)}function ii(p){if(!p)return;const y=p===n.value;wn(p,!1,{keepDeferredLiveCommands:y}),!(!y||typeof window>"u")&&window.setTimeout(()=>{Wr.has(p)&&N.value[p]!==!0&&Ts(p)},ID)}function ks(p){var ge;if(p.method!=="turn/plan/updated")return null;const y=Ve(p.params),A=Un(p),j=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),V=(Array.isArray(y==null?void 0:y.plan)?y==null?void 0:y.plan:[]).map(ze=>Ve(ze)).map(ze=>({step:Re(ze==null?void 0:ze.step),status:QN(ze==null?void 0:ze.status)})).filter(ze=>ze.step.length>0);if(!A||!j)return null;const Z={explanation:Re(y==null?void 0:y.explanation).trim()||void 0,steps:V,isStreaming:!0},me=(ge=ut.value[A])==null?void 0:ge[j];return{threadId:A,message:{id:`${j}:plan`,role:"assistant",text:XN(Z),messageType:"plan.live",plan:Z,turnId:j||void 0,turnIndex:typeof me=="number"?me:void 0}}}function Cl(p){var ze;if(p.method!=="item/plan/delta")return null;const y=Ve(p.params),A=Un(p),j=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),H=Re(y==null?void 0:y.delta);if(!A||!j||!H)return null;const V=`${j}:plan`,z=(a.value[A]??[]).find(nt=>nt.id===V),Z=`${(z==null?void 0:z.text)??""}${H}`,me=z!=null&&z.plan?{...z.plan,isStreaming:!0}:void 0,ge=(ze=ut.value[A])==null?void 0:ze[j];return{threadId:A,message:{id:V,role:"assistant",text:Z,messageType:"plan.live",plan:me,turnId:j||void 0,turnIndex:typeof ge=="number"?ge:void 0}}}const ar={liveCommandsByThreadId:R,liveFileChangeMessagesByThreadId:E,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},gr={turnIndexByTurnIdByThreadId:ut,persistedMessagesByThreadId:o,liveFileChangeMessagesByThreadId:E};function Mr(p){if(p.method==="server/request"){const y=Yw(p.params);return y&&xa(y),!0}if(p.method==="server/request/resolved"){const y=Ve(p.params),A=y==null?void 0:y.id;return typeof A=="number"&&Number.isInteger(A)&&Sr(A),!0}return!1}function Xr(p){return p.replace(/\s+/gu," ").trim()}function vr(p){return HO(gr,p)}function la(p,y,A){WO(gr,p,y,A)}function C(p,y){qO(gr,p,y)}function M(p,y){return GO(gr,p,y)}function x(p){VO(gr,p)}function X(p,y,A){tD(gt,p,y,A)}function Qe(p){nD(gt,p)}function qt(p){var me;if(p.method!=="item/started"&&p.method!=="item/completed")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||Re(A.type).toLowerCase()!=="plan")return null;const j=Un(p),H=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),V=Re(A.id),z=Re(A.text);if(!j||!V||!z)return null;const Z=j&&H?(me=ut.value[j])==null?void 0:me[H]:void 0;return{threadId:j,message:{id:V,role:"assistant",text:z,messageType:p.method==="item/completed"?"plan":"plan.live",plan:Cw(z)??void 0,turnId:H||void 0,turnIndex:typeof Z=="number"?Z:void 0}}}function Gn(p){var ge;if(p.method!=="item/started")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||A.type!=="commandExecution")return null;const j=Re(A.id),H=Re(A.command);if(!j)return null;const V=typeof A.cwd=="string"?A.cwd:null,z=Un(p),Z=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),me=z&&Z?(ge=ut.value[z])==null?void 0:ge[Z]:void 0;return{id:j,role:"system",text:H,messageType:"commandExecution",commandExecution:{command:H,cwd:V,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:Z||void 0,turnIndex:typeof me=="number"?me:void 0}}function yr(p){var at;if(p.method!=="item/completed")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||A.type!=="commandExecution")return null;const j=Re(A.id),H=Re(A.command);if(!j)return null;const V=typeof A.cwd=="string"?A.cwd:null,z=Re(A.status),Z=z==="failed"?"failed":z==="declined"?"declined":z==="interrupted"?"interrupted":"completed",me=typeof A.aggregatedOutput=="string"?A.aggregatedOutput:"",ge=typeof A.exitCode=="number"?A.exitCode:null,ze=Un(p),nt=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),Pt=ze&&nt?(at=ut.value[ze])==null?void 0:at[nt]:void 0;return{id:j,role:"system",text:H,messageType:"commandExecution",commandExecution:{command:H,cwd:V,status:Z,aggregatedOutput:me,exitCode:ge},turnId:nt||void 0,turnIndex:typeof Pt=="number"?Pt:void 0}}function an(p){var ge;if(p.method!=="item/completed")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||A.type!=="fileChange")return null;const j=Re(A.id);if(!j)return null;const H=Re(y==null?void 0:y.threadId),V=Re(y==null?void 0:y.turnId),z=H&&V?(ge=ut.value[H])==null?void 0:ge[V]:void 0,Z=Ef(A.changes),me=Xy(A.status);return Z.length===0||me!=="completed"?null:{id:j,role:"system",text:"",messageType:"fileChange",fileChangeStatus:me,fileChanges:Z,turnId:V||void 0,turnIndex:typeof z=="number"?z:void 0}}function Rr(p,y){DO(ar,p,y)}function Ra(p,y){FO(ar,p,y)}function ua(p,y){BO(ar,p,y)}function Ss(p){if(p.method==="item/agentMessage/delta")return!0;const y=Ve(p.params);if(!y)return!1;if(p.method==="item/completed"){const A=Ve(y.item);return(A==null?void 0:A.type)==="agentMessage"}return!1}const Cs=new Set;function La(p){for(const y of Cs)try{y(p)}catch{}}function ed(p){return Cs.add(p),()=>{Cs.delete(p)}}function yu(p,y,A){UO(ar,p,y,A)}function Vn(p,y,A){zO(ar,p,y,A)}function ca(p){var Fi,Bi,Ui,ma,zi,Ms,Ao,Hi;if(Mr(p))return;if(Qe(p),p.method==="turn/started"){const Me=Un(p);Me&&T.delete(Me)}if(AD.has(p.method))return;if(p.method==="app/list/updated"||p.method==="mcpServer/startupStatus/updated"||p.method==="mcpServer/oauthLogin/completed"||p.method==="remoteControl/status/changed"){La(p.method);return}if(p.method==="skills/changed"){$t({force:!0});return}if(p.method==="hook/started"||p.method==="hook/completed"){He({force:!0});return}if(p.method==="thread/status/changed"){const Me=Un(p);Me&&Me===n.value&&tn.add(Me);return}if(p.method==="thread/archived"||p.method==="thread/unarchived"||p.method==="thread/deleted"||p.method==="thread/closed")return;if(p.method==="item/fileChange/patchUpdated"||p.method==="turn/diff/updated"){const Me=Ve(p.params),Et=Re(Me==null?void 0:Me.threadId);Et&&(p.method==="item/fileChange/patchUpdated"?yu(Et,Re(Me==null?void 0:Me.itemId),Ef(Me==null?void 0:Me.changes)):Vn(Et,Re(Me==null?void 0:Me.turnId),Re(Me==null?void 0:Me.diff)??""),Et===n.value&&tn.add(Et));return}if(p.method==="account/rateLimits/updated"&&mn(),p.method==="thread/name/updated"){const Me=Ve(p.params),Et=Re(Me==null?void 0:Me.threadId),sr=Re(Me==null?void 0:Me.threadName);if(Et&&sr){const Nr=qs(sr);Fr.value={...Fr.value,[Et]:Nr},yn(),Tc(Et,Nr)}}if(p.method==="thread/compacted"){const Me=Ve(p.params),Et=Re(Me==null?void 0:Me.threadId);Et&&(xo(Et,!1),eo(Et,"done"),tn.add(Et));return}if(p.method==="fuzzyFileSearch/sessionUpdated"){const Me=Ve(p.params),Et=Re(Me==null?void 0:Me.sessionId);Et&&Et===Hr&&(pr.value=sI(Me));return}if(p.method==="fuzzyFileSearch/sessionCompleted"){const Me=Ve(p.params),Et=Re(Me==null?void 0:Me.sessionId);Et&&Et===Hr&&(Hr="");return}if(p.method==="account/rateLimits/updated"){tr(sw(p.params));return}const y=eO(p);if(y){fs(y.threadId,y.usage);return}const A=rO(p);A&&_t(A.threadId,A.activity);const j=Un(p),H=nO(p);!H&&j&&ys(j);const V=oO(p);V&&(Jo.set(V.turnId,V),la(V.threadId,V.turnId,vr(V.threadId)),Be.value={...Be.value,[V.threadId]:V.turnId},vs(V.threadId,V.turnId),ia(V.threadId),bs(V.threadId),on(V.threadId,null),Nt(V.threadId,null),wn(V.threadId,!0),xn(V.threadId),Y.value[V.threadId]&&(Y.value=kt(Y.value,V.threadId)));const z=aO(p),Z=tO(p),me=(z==null?void 0:z.threadId)??Un(p),ge=me?xe(me):"",ze=!!me&&!!Z&&ge!==Mo&&Ku(new Error(Z));if(z){pn.value[z.threadId];const Me=Jo.get(z.turnId);Me&&Jo.delete(z.turnId);const Et=Ks((Fi=Ve(p.params))==null?void 0:Fi.durationMs)??Ks((Ui=Ve((Bi=Ve(p.params))==null?void 0:Bi.turn))==null?void 0:Ui.durationMs)??(typeof z.startedAtMs=="number"?z.completedAtMs-z.startedAtMs:null)??(Me?z.completedAtMs-Me.startedAtMs:null),sr=typeof Et=="number"?Math.max(0,Et):0;on(z.threadId,{turnId:z.turnId,durationMs:sr}),Mi(z.threadId,z.turnId,sr),Be.value[z.threadId]&&(Be.value=kt(Be.value,z.threadId)),ii(z.threadId),_t(z.threadId,null),si(z.threadId),ze||(na(z.threadId),xn(z.threadId))}if(Z){const Me=(z==null?void 0:z.threadId)||Un(p);Me&&Nt(Me,Z),r.value=Z,Me&&ze&&rn(Me)}else z&&Nt(z.threadId,null);if(H){const Me=j,Et=Me?xe(Me):ve.value.trim();Me&&Nt(Me,H.message,{transient:H.transient}),r.value=H.message,Et!==Mo&&Ku(new Error(H.message))&&(Me?rn(Me):De())}const nt=ks(p);nt&&(sa(nt.threadId,nt.message),_t(nt.threadId,{label:"Planning",details:((ma=nt.message.plan)==null?void 0:ma.steps.map(Me=>Me.step).slice(0,2))??[]}));const Pt=Cl(p);Pt&&(sa(Pt.threadId,Pt.message),_t(Pt.threadId,{label:"Planning",details:[]}));const at=qt(p);if(at&&(sa(at.threadId,at.message),_t(at.threadId,{label:"Planning",details:((zi=at.message.plan)==null?void 0:zi.steps.map(Me=>Me.step).slice(0,2))??[]})),!j||j!==n.value)return;fO(p);const At=hO(p);if(At){const Me=(i.value[j]??[]).find(dn=>dn.id===At.messageId),Et=`${(Me==null?void 0:Me.text)??""}${At.delta}`,sr=At.turnId??(Me==null?void 0:Me.turnId),Nr=sr?(Ms=ut.value[j])==null?void 0:Ms[sr]:Me==null?void 0:Me.turnIndex;Kr(j,{id:At.messageId,role:"assistant",text:Et,messageType:"agentMessage.live",turnId:sr,turnIndex:typeof Nr=="number"?Nr:void 0})}const St=pO(p);if(St){const Me=St.turnId?(Ao=ut.value[j])==null?void 0:Ao[St.turnId]:void 0;Kr(j,{...St,turnIndex:typeof Me=="number"?Me:void 0})}const Lt=vO(p);Lt&&Kr(j,Lt),sO(p)&&ws(j);const gn=iO(p);gn&&(Li(j,gn.delta),oD(gt,gn.itemId,gn.delta));const Yn=dO(p);if(Yn&&(X(j,Yn.itemId,Yn.text),ws(j)),lO(p)){const Me=m.value[j]??"";Me.trim().length>0&&!Me.endsWith(`
75
-
76
- `)&&Jr(j,`${Me}
77
-
78
- `)}uO(p);const jr=Gn(p);jr&&(Rr(j,jr),_t(j,{label:"Running command",details:[((Hi=jr.commandExecution)==null?void 0:Hi.command)??""]}));const Di=yO(p);if(Di){const Me=(R.value[j]??[]).find(Et=>Et.id===Di.itemId);Me!=null&&Me.commandExecution&&Rr(j,{...Me,commandExecution:{...Me.commandExecution,aggregatedOutput:`${Me.commandExecution.aggregatedOutput}${Di.delta}`}})}const Su=yr(p);Su&&Rr(j,Su);const $r=an(p);if($r&&Yr(j,$r),Ss(p)&&Qr(j,!0),p.method==="turn/completed"){zt=!1,Qr(j),ev(gt);const Me=Un(p);Me&&(ra(Me),ii(Me),_t(Me,null),si(Me),ze||(na(Me),xn(Me)))}}function So(p){if(p.method==="thread/tokenUsage/updated"||p.method.startsWith("thread/realtime/"))return;const y=p.method,A=y==="turn/started"||y==="turn/completed"||y==="error",j=y.startsWith("thread/")||y==="turn/completed";if(!A&&!j)return;const H=Un(p);H&&A&&tn.add(H),j&&(ln=!0,Ko=!0),!(Xt!==null||typeof window>"u")&&(Xt=window.setTimeout(()=>{Xt=null,Fn()},Qu))}async function da(p,y){if(!Yo){Yo=!0;try{if(!y)return;const A=[];for(const j of Zc(y)){const H=Pi(j);A.includes(H)||A.push(H)}if(A.length>0){const j=y.projectOrder.length>0?tl(A,p):tl(he.value,p);Xa(he.value,j)||bt(j,{persist:!1})}if(Object.keys(y.labels).length>0||(y.remoteProjects??[]).length>0){const j={...Ie.value};let H=!1;for(const[V,z]of Object.entries(y.labels)){const Z=et(V).trim(),me=[Pi(V)];Z&&me.push(Z);for(const ge of me)j[ge]!==z&&(j[ge]=z,H=!0)}for(const V of y.order){const z=Pi(V),Z=so(ul(V));if(!Z.startsWith(".")||Z===z)continue;const me=`${z} ${Z}`;j[z]!==void 0||j[z]===me||(j[z]=me,H=!0)}for(const V of y.remoteProjects??[]){const z=gN(V);j[V.id]!==z&&(j[V.id]=z,H=!0)}H&&dt(j,{persist:!1})}}catch{}}}async function Dn(){try{return await nl()}catch{return null}}function Ni(p,y){const A=Bf(p,y),j=bN(p,y),H=TN(j,y,A);if(!y||y.order.length===0&&(y.remoteProjects??[]).length===0)return H;const V=new Set;for(const Z of Ff(y,A))V.add(Z);const z=H.filter(Z=>V.has(Z.projectName)?!0:zf(Z));return wN(z,y,A)}function li(p,y){const A=Ni(p,y),j=!!(y&&(y.order.length>0||y.projectOrder.length>0||(y.remoteProjects??[]).length>0)),H=y!=null&&y.projectOrder.length?tl(Ff(y,Bf(p,y)),A):tl(he.value,A);Xa(he.value,H)||bt(H,{persist:!j});const V=Of(A,he.value);Sl(new Set(Jn(V).map(me=>me.id)));const z=pN(t.value,V,N.value);t.value=xc(t.value,z),N.value=sn(N.value,new Set(Jn(t.value).map(me=>me.id))),new Set(Jn(t.value).map(me=>me.id));const Z={};for(const me of Jn(t.value))Z[me.id]=me.externalSession??fe.value[me.id]??null;fe.value=Z,yn()}function ja(p){It.removeThreadFromLoadedLists(p),t.value=jw(t.value,p),N.value=kt(N.value,p),yn()}async function xl(p={}){await Promise.allSettled([Ee({providerChanged:p.providerChanged,includeProviderModels:p.includeProviderModels}),qo(),q(),$t()])}function $a(p={}){const y=()=>{xl(p)};if(typeof window>"u"){y();return}window.setTimeout(y,0)}async function Zr(p={}){r.value="",ye.value="";const y=p.includeSelectedThreadMessages!==!1,A=p.awaitAncillaryRefreshes===!0;try{if(await ea(),await It.loadThreads({force:p.forceThreadRefresh===!0}),y)try{await Yt(n.value)}catch(j){r.value=j instanceof Error?j.message:"Unknown application error"}A?await xl({providerChanged:p.providerChanged,includeProviderModels:p.providerChanged===!0||A}):$a({providerChanged:p.providerChanged,includeProviderModels:!1})}catch(j){r.value=j instanceof Error?j.message:"Unknown application error",Mw(j)?ye.value=Qw:ye.value=""}}async function fa(p){Mn(p);try{return await Yt(p),await Ee({includeProviderModels:!0}),$t(),"ok"}catch(y){const A=y instanceof Error?y.message:"Unknown application error";r.value=A;const j=G$(y)?"not-found":"error";return p.trim()&&Nt(p,A,{transient:!0}),j}}async function bn(p){const y=n.value===p,A=y?q$(Jn(e.value),p):"";y&&(Mn(A),A&&Yt(A,{silent:!0}));try{await dA(p),ja(p),await It.loadThreads(),y&&A&&n.value===A&&await yt(A,{silent:!0})}catch(j){r.value=j instanceof Error?j.message:"Unknown application error"}}async function Na(p,y){const A=y.trim();if(!(!p||!A))try{await pA(p,A),Fr.value={...Fr.value,[p]:A},yn(),Tc(p,A)}catch(j){r.value=j instanceof Error?j.message:"Unknown application error"}}async function xs(p){var z,Z;const y=p.trim();if(!y)return"";const A=Jn(t.value).find(me=>me.id===y),j=((z=A==null?void 0:A.cwd)==null?void 0:z.trim())??"",H=((Z=A==null?void 0:A.title)==null?void 0:Z.trim())??"Forked chat",V=xe(y);r.value="";try{const me=await Yd(y,j||void 0,V||void 0),ge=me.threadId.trim();return ge?(bo(ge,j,H),F(ge,me.model),ot.value={...ot.value,[ge]:!0},Mn(ge),await It.loadThreads(),await Yt(ge),ge):""}catch(me){return r.value=me instanceof Error?me.message:"Unknown application error",""}}async function Is(p,y){var z;const A=p.trim();if(!A||!Number.isInteger(y)||y<0)return"";if(N.value[A]===!0)return r.value="Finish the current turn before forking from a response.","";if(er.value[A]!==!0)try{await Yt(A)}catch(Z){return r.value=Z instanceof Error?Z.message:"Unknown application error",""}const j=o.value[A]??[];let H=-1;for(const Z of j)typeof Z.turnIndex=="number"&&Number.isFinite(Z.turnIndex)&&(H=Math.max(H,Z.turnIndex));if(H>=0&&y>H)return"";const V=Jn(t.value).find(Z=>Z.id===A)??null;try{r.value="";const Z=j$(j,y),me=Z?await Yd(A,{beforeTurnId:Z}):await Yd(A),ge=me.threadId.trim();if(!ge)return"";const ze=me.cwd.trim()||((z=V==null?void 0:V.cwd)==null?void 0:z.trim())||"",nt=kN((V==null?void 0:V.title)||(V==null?void 0:V.preview)||"Untitled thread");if(bo(ge,ze,nt),F(ge,me.model),On(ge,me.messages),er.value={...er.value,[ge]:!0},ot.value={...ot.value,[ge]:!0},ia(ge),ko(ge,[]),Qr(ge),R.value[ge]&&(R.value=kt(R.value,ge)),on(ge,null),_t(ge,null),Nt(ge,null),wn(ge,!1),!$$(me.messages,Z,y)){const Pt=await Kd(ge,Z);On(ge,Pt)}return await Na(ge,nt),Mn(ge),It.loadThreads().catch(()=>{}),ge}catch(Z){return r.value=Z instanceof Error?Z.message:"Unknown application error",""}}async function ui(p,y,A=[],j=[],H=[]){if(!p||!y.trim()||A.length>0||j.length>0||H.length>0)return!1;const z=(Wo.value[p]??[]).filter(ge=>ge.method==="item/tool/requestUserInput");if(z.length!==1)return!1;const[Z]=z,me=AO(Z);return me.length!==1?!1:Io({id:Z.id,result:{answers:{[me[0]]:{answers:[y.trim()]}}}})}function As(p){if(Ar.value<=0||Sn.value.has(p))return!1;const y=Rt.value[p];return!y||y.remainingContextPercent===null?!1:y.remainingContextPercent<=Ar.value}async function _s(p,y,A,j,H,V){if(le||Ar.value<=0||N.value[p]===!0)return!1;const z=Rt.value[p];if(!z||z.remainingContextPercent===null||z.remainingContextPercent>Ar.value)return!1;const Z=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,me=V==="plan"?"plan":V==="default"?"default":P.value;return Ir(p,{id:Z,text:y,imageUrls:A,skills:j,fileAttachments:H,collaborationMode:me}),Sn.value.has(p)||to(p),!0}async function Co(p){const y=wo(p);if(!y||y.length===0||N.value[p]===!0)return;const A=I(p);le=!0;try{for(const j of A)try{await Oa(j.text,j.imageUrls,j.skills,"steer",j.fileAttachments,void 0,j.collaborationMode)}catch{}}finally{le=!1}}function td(p){return p instanceof Error&&/ActiveTurnNotSteerable|cannot steer a \S+ turn|same-turn steering/i.test(p.message)}function nd(p){return p instanceof Error&&/expected active turn id/i.test(p.message)}async function rd(p,y,A,j,H,V){const z=Be.value[p]??"";if(z)try{await gA(p,z,y,A,j,H),aa(p,y,A,j,H),tn.add(p),await Fn(),Gr(p);return}catch(Z){if(td(Z)){const me=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;qr(p,{id:me,text:y,imageUrls:A,skills:j,fileAttachments:H,collaborationMode:V==="plan"?"plan":V==="default"?"default":P.value});return}if(!nd(Z))throw Z}aa(p,y,A,j,H),await Da(p,y,A,j,H,V)}async function Oa(p,y=[],A=[],j="steer",H=[],V,z,Z){if(ee.value)return;const me=n.value,ge=p.trim();if(!me||!ge&&y.length===0&&H.length===0||await ui(me,ge,y,A,H)||await _s(me,ge,y,A,H,z))return;const ze=N.value[me]===!0;if(ze&&j==="queue"){const nt=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;qr(me,{id:nt,text:ge,imageUrls:y,skills:A,fileAttachments:H,collaborationMode:z==="plan"?"plan":z==="default"?"default":P.value},V);return}if(ze){zt=!0,rd(me,ge,y,A,H,z).catch(nt=>{const Pt=nt instanceof Error?nt.message:"Unknown application error";Nt(me,Pt),r.value=Pt});return}r.value="",zt=!0,on(me,null),aa(me,ge,y,A,H),_t(me,{label:"Thinking",details:$e(xe(me),ne.value,z==="plan"?"plan":z==="default"?"default":P.value)}),Nt(me,null),wn(me,!0);try{await Da(me,ge,y,A,H,z,Z)}catch(nt){zt=!1,wn(me,!1),_t(me,null);const Pt=nt instanceof Error?nt.message:"Unknown application error";throw Nt(me,Pt),r.value=Pt,nt}}async function ha(p,y,A=[],j=[],H=[]){if(ee.value)return"";const V=p.trim(),z=y.trim(),Z=xe(ba).trim(),me=P.value;if(!V&&A.length===0&&H.length===0)return"";zr.value=!0,r.value="";let ge="";try{try{const at=await ng(z||void 0,Z||void 0);ge=at.threadId,F(ge,at.model),oe(ge,at.modelProvider||ie.value),re(ge,me)}catch(at){if(Z&&Z!==Mo&&Ku(at)){await De();const At=await ng(z||void 0,Mo);ge=At.threadId,F(ge,At.model),oe(ge,At.modelProvider||ie.value),re(ge,me)}else throw at}if(!ge)return"";bo(ge,z,V||"[Image]"),aa(ge,V,A,j,H),or(ge),ot.value={...ot.value,[ge]:!0},Mn(ge),zt=!0,on(ge,null),_t(ge,{label:"Thinking",details:$e(xe(ge),ne.value,me)}),Nt(ge,null),wn(ge,!0);const ze=ge,nt=z||null,Pt=V;return Da(ge,V,A,j,H,me).catch(at=>{zt=!1,wn(ge,!1),_t(ge,null);const At=at instanceof Error?at.message:"Unknown application error";Nt(ge,At),r.value=At}).finally(()=>{zr.value=!1}),Uo(ze,Pt,nt,A,H),ge}catch(ze){zt=!1,ge&&(wn(ge,!1),_t(ge,null));const nt=ze instanceof Error?ze.message:"Unknown application error";throw ge&&Nt(ge,nt),r.value=nt,zr.value=!1,ze}}async function Da(p,y,A=[],j=[],H=[],V,z){const Z=ne.value,me=V==="plan"?"plan":V==="default"?"default":P.value,ge=y.trim(),ze=[...A];if(ze.length===0&&Go(ge)){const at=Vo(p);at&&ze.push(at)}const nt=j.map(at=>({name:at.name,path:at.path})),Pt=H.map(at=>({...at}));ai(p,{text:ge,imageUrls:[...ze],skills:nt,fileAttachments:Pt,effort:Z,collaborationMode:me,fallbackRetried:!1});try{if(ot.value[p]!==!0){const St=je(p),Lt=await Lf(p);Lt.model&&!St&&F(p,Je(p,Lt.model,Lt.modelProvider)),Lt.modelProvider&&oe(p,Lt.modelProvider),ot.value={...ot.value,[p]:!0}}const at=xe(p);let At="";try{At=await Jd(p,y,ze,at||void 0,Z||void 0,j.length>0?j:void 0,H,me,...z?[z]:[])}catch(St){if(at&&at!==Mo&&Ku(St))await De(p),ai(p,{text:ge,imageUrls:[...ze],skills:nt,fileAttachments:Pt,effort:Z,collaborationMode:me,fallbackRetried:!0}),At=await Jd(p,y,ze,Mo,Z||void 0,j.length>0?j:void 0,H,me,...z?[z]:[]);else throw St}At&&(Be.value={...Be.value,[p]:At},vs(p,At)),tn.add(p),await Fn(),Gr(p)}catch(at){throw at}}async function Ps(){const p=n.value;if(!p||N.value[p]!==!0||Tt.value[p]===!0)return;let y=Be.value[p];if(!y){const{activeTurnId:V}=await Rf(p);y=V,y&&(Be.value={...Be.value,[p]:y})}if(!y)throw new Error("Could not determine active turn id for interrupt");const A=ds.value.filter(V=>V.turnId===y),j=A.find(V=>V.role==="user"&&V.isAgentNote!==!0),H=A.some(V=>{if(V.role==="assistant")return!0;const z=V.messageType??"";return z==="commandExecution"||z==="toolCall"||z==="worked"||z==="fileChange"||z==="plan"||z==="plan.live"||z==="compaction.done"||z==="turnError"});Nn.value=!0,r.value="";try{if(await vA(p,y),wn(p,!1),_t(p,null),Nt(p,null),Be.value[p]&&(Be.value=kt(Be.value,p)),tn.add(p),ln=!0,await Fn(),j&&!H){const V=(o.value[p]??[]).filter(Z=>Z.turnId!==y);On(p,V);const z=u.value[p];if(z){const Z=z.filter(me=>me.turnId!==y);Z.length!==z.length&&(u.value={...u.value,[p]:Z},Bl(u.value))}$n.value={...$n.value,[p]:{text:j.text??"",imageUrls:j.images??[],fileAttachments:(j.fileAttachments??[]).map(Z=>({label:Z.label,path:Z.path,fsPath:Z.fsPath??Z.path})),skills:j.skills??[]}}}}catch(V){const z=V instanceof Error?V.message:"Failed to interrupt active turn";Nt(p,z),r.value=z}finally{Nn.value=!1}}function wu(p){p&&$n.value[p]&&($n.value=kt($n.value,p))}async function bu(p,y){if(!y)throw new Error("Cannot roll back: failed to resolve the turn id where the removal starts");return await Kd(p,y)}async function Rn(p,y){if(!p||!y||N.value[p]===!0||y===(Be.value[p]??""))return!1;let A;try{A=await mA(p)}catch{return!1}return A.complete&&!A.turnIds.includes(y)}function Lr(p,y){const A=o.value[p]??[],j=A.filter(z=>{var Z;return(((Z=z.turnId)==null?void 0:Z.trim())??"")!==y});j.length!==A.length&&On(p,j);const H=u.value[p];if(!H)return;const V=H.filter(z=>{var Z;return(((Z=z.turnId)==null?void 0:Z.trim())??"")!==y});V.length!==H.length&&(u.value={...u.value,[p]:V},Bl(u.value))}function wr(p,y,A){const j=u.value[p];if(!j||j.length===0)return;const H=new Set(y.map(z=>z.trim()).filter(z=>z.length>0)),V=j.filter(z=>{var ge;const Z=((ge=z.turnId)==null?void 0:ge.trim())??"";if(Z&&H.has(Z))return!1;const me=z.turnIndex;return!(A>=0&&typeof me=="number"&&Number.isFinite(me)&&me>=A)});V.length!==j.length&&(u.value={...u.value,[p]:V},Bl(u.value))}async function od(p){var A,j,H,V,z;const y=n.value;if(y&&!Pn.value&&p.trim()){Pn.value=!0,r.value="";try{N.value[y]===!0&&await Ps();const Z=o.value[y]??[],me=Z.find(St=>St.turnId===p),ge=Z.reduce((St,Lt)=>typeof Lt.turnIndex=="number"&&Lt.turnIndex>St?Lt.turnIndex:St,-1);if(ge<0)return;let ze=typeof(me==null?void 0:me.turnIndex)=="number"?me.turnIndex:((A=ut.value[y])==null?void 0:A[p])??-1;(ze<0||ze>ge)&&(console.warn(`[rollback] turn ${p} not resolvable (index=${ze}), clamping to newest turn`),ze=ge);let nt=((j=me==null?void 0:me.turnId)==null?void 0:j.trim())??"";if(!nt&&ze>=0){const St=ut.value[y]??{};nt=Object.keys(St).find(Lt=>St[Lt]===ze)??""}if(!nt){const St=Z.reduce((Lt,cn)=>{const gn=typeof cn.turnIndex=="number"?cn.turnIndex:-1,Yn=Lt!==null&&typeof Lt.turnIndex=="number"?Lt.turnIndex:-1;return gn>=0&&gn>Yn?cn:Lt},null);nt=((H=St==null?void 0:St.turnId)==null?void 0:H.trim())??""}if(await Rn(y,nt)){console.warn(`[rollback] ${y}: turn ${nt} is already gone on the server; reconciling locally instead of sending thread/revert`),Lr(y,nt),ln=!0;try{await Yt(y,{force:!0}),await Fn()}catch{}return}const Pt=await bu(y,nt),at=((z=(V=yo.value)==null?void 0:V.cwd)==null?void 0:z.trim())??"";if(at){const St=await K_(y,p,at);St.errors.length>0&&console.warn(`[rollback] file revert for ${y} left errors: ${St.errors.join("; ")}`)}const At=Z.filter(St=>typeof St.turnIndex=="number"&&St.turnIndex>=ze).map(St=>{var Lt;return((Lt=St.turnId)==null?void 0:Lt.trim())??""}).filter(St=>St.length>0);On(y,Pt),ko(y,[]),Qr(y),wr(y,[...At,nt],ze),R.value[y]&&(R.value=kt(R.value,y)),on(y,null),_t(y,null),Nt(y,null),ln=!0,await Fn()}catch(Z){r.value=Z instanceof Error?Z.message:"Failed to rollback thread";try{await Yt(y,{force:!0})}catch{}}finally{Pn.value=!1}}}function eo(p,y){const j=(l.value[p]??[]).filter(H=>H.messageType!=="compaction.pending"&&H.messageType!=="compaction.done");j.push({id:`compaction:${y}:${p}:${Date.now()}`,role:"system",text:"",messageType:y==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[p]:j}}function xo(p,y){const A=new Set(Sn.value);y?A.add(p):A.delete(p),Sn.value=A}function ci(p){Hr=p.trim(),pr.value=[]}async function to(p){const y=p.trim();if(!(!y||Sn.value.has(y))){xo(y,!0),eo(y,"pending");try{await hA(y);const A=2e3,j=14,H=Date.now()+Ia;let V=0;for(;Date.now()<H&&V<j&&Sn.value.has(y);){if((await Rf(y)).messages.some(me=>me.messageType==="compaction.done")){xo(y,!1),n.value===y&&await Yt(y,{silent:!0,force:!0}),eo(y,"done"),Co(y);break}V+=1,await W$(A)}Sn.value.has(y)&&(xo(y,!1),eo(y,"done"),Co(y))}catch(A){r.value=A instanceof Error?A.message:"Failed to compact thread",xo(y,!1),eo(y,"done"),Co(y)}}}async function Fn(){if(Ut.value){typeof window<"u"&&Xt===null&&(Xt=window.setTimeout(()=>{Xt=null,Fn()},Qu));return}Ut.value=!0;const p=ln,y=Ko,A=new Set(tn);ln=!1,Ko=!1,tn.clear();try{p&&await It.loadThreads({force:y});const j=n.value;if(!j)return;const H=A.has(j),V=N.value[j]===!0,z=qn(j),Z=ka.value[j]??"";(z.length>0&&z!==Z||H||V&&er.value[j]!==!0||p&&er.value[j]!==!0)&&await Yt(j,{silent:!0,force:H})}catch{}finally{Ut.value=!1,(ln||tn.size>0)&&typeof window<"u"&&Xt===null&&(Xt=window.setTimeout(()=>{Xt=null,Fn()},Qu))}}async function Tu(){await Ho(),ln=!It.hasLoadedThreads.value,n.value&&er.value[n.value]!==!0&&tn.add(n.value),await Fn()}function Oi(p){const y=Ve(p.params),A=typeof(y==null?void 0:y.threadId)=="string"?y.threadId.trim():"";if(!A)return;const j=Ve(y==null?void 0:y.externalSession),H=j&&typeof j.origin=="string"&&j.origin.trim().length>0?{origin:j.origin.trim(),active:j.active===!0,lastWriteAt:typeof j.lastWriteAt=="string"?j.lastWriteAt:null}:null;fe.value={...fe.value,[A]:H},wn(A,(H==null?void 0:H.active)===!0),yn(),ln=!0,n.value===A&&tn.add(A),Xt===null&&typeof window<"u"&&(Xt=window.setTimeout(()=>{Xt=null,Fn()},Qu))}function di(){typeof window>"u"||Cn||(Ho(),pa(),Il(),Cn=FA(p=>{if(p.method==="ready"){Er(),Tu();return}if(p.method==="externalSessionChanged"){Oi(p);return}ca(p),So(p)}))}async function pa(){try{const p=await VA(),y=Object.entries(p);if(y.length===0)return;const A={...u.value};let j=!1;for(const[H,V]of y){const z=V.filter(ze=>!!ze&&typeof ze.id=="string");if(z.length===0)continue;const Z=A[H]??[],me=new Set(Z.map(ze=>ze.text)),ge=[...Z];for(const ze of z)me.has(ze.text)||(ge.push(ze),me.add(ze.text));A[H]=ge.slice(-20),j=!0}j&&(u.value=A,Bl(A))}catch{}}async function Il(){try{const p=await YA(),y=Object.entries(p);if(y.length===0)return;const A={...d.value};let j=!1;for(const[H,V]of y){if(!H||!V||typeof V!="object"||Array.isArray(V))continue;const z={};for(const[ge,ze]of Object.entries(V))!ge||typeof ze!="number"||!Number.isFinite(ze)||ze<=0||(z[ge]=Math.round(ze));if(Object.keys(z).length===0)continue;const Z={...A[H]??{},...z},me=Object.keys(Z);A[H]=me.length>200?Object.fromEntries(me.slice(-200).map(ge=>[ge,Z[ge]])):Z,j=!0}j&&(d.value=A,Gw(p),Qg(A))}catch{}}async function Io(p){try{return await BA(p.id,{result:p.result,error:p.error}),Sr(p.id),Ur.value=kt(Ur.value,String(p.id)),!0}catch(y){const A=y instanceof Error?y.message:"Failed to reply to server request";return await Ca(p.id)?(r.value=A,Ur.value={...Ur.value,[String(p.id)]:A},!1):(Sr(p.id),Ur.value=kt(Ur.value,String(p.id)),!0)}}function Es(){if(Cn&&(Cn(),Cn=null),ln=!1,tn.clear(),Jo.clear(),Xt!==null&&typeof window<"u"&&(window.clearTimeout(Xt),Xt=null),xr(),It.dispose(),typeof window<"u")for(const p of mr.values())window.clearTimeout(p);mr.clear(),zt=!1,o.value={},a.value={},i.value={},m.value={},u.value={},d.value={},R.value={},E.value={},ut.value={},de.value={},J.value={},ke.value={},Be.value={},S.clear(),ev(gt),T.clear(),CN(),Tt.value={},Ct.value={},en.value={},Xo(),tr(null),Rt.value={}}function Kn(p){const y=n.value;if(!y)return;const A=rr(y,p);if(A){mt(p),ue(A.collaborationMode),le=!0,Oa(A.text,A.imageUrls,A.skills,"steer",A.fileAttachments).finally(()=>{le=!1});return}const j=Zo(y,p);j&&(mt(p),ue(j.collaborationMode),Oa(j.text,j.imageUrls,j.skills,"steer",j.fileAttachments))}function Fa(p,y={}){Mn(p,y)}return{projectGroups:e,projectDisplayNameById:Ie,selectedThread:yo,selectedThreadTokenUsage:_a,selectedThreadTerminalOpen:xt,isSelectedThreadInterruptPending:nn,selectedThreadServerRequests:cs,selectedLiveOverlay:Pr,selectedActiveTurnId:Jt,lastPlanByThreadId:s,resolveThreadTurnIndex:M,codexQuota:hr,selectedThreadId:n,availableCollaborationModes:We,availableModelIds:we,availableModelReasoningEfforts:Pe,selectedCollaborationMode:P,selectedModelId:ve,selectedReasoningEffort:ne,selectedSpeedMode:Ae,codexCliMissingError:ye,installedSkills:K,accountRateLimitSnapshots:Cr,messages:ds,hasMoreOlderMessages:ta,isLoadingThreads:It.isLoadingThreads,isThreadListFullyLoaded:It.isThreadListFullyLoaded,isLoadingMessages:Bo,slowOpenThreadId:Sa,isLoadingOlderMessages:Pa,isSendingMessage:zr,isInterruptingTurn:Nn,isUpdatingSpeedMode:ee,isRollingBack:Pn,compactingThreadIds:Sn,fuzzyFileSearchResults:pr,registerFuzzyFileSearchSession:ci,error:r,refreshAll:Zr,refreshSkills:$t,refreshHooks:He,hooksList:O,isHooksLoading:Te,onRealtimeEvent:ed,selectThread:fa,loadMessages:Yt,loadOlderMessages:fo,ensureThreadMessagesLoaded:yt,setThreadTerminalOpen:Vr,toggleSelectedThreadTerminal:oa,archiveThreadById:bn,compactThreadById:to,renameThreadById:Na,forkThreadById:xs,forkThreadFromTurn:Is,rollbackSelectedThread:od,sendMessageToSelectedThread:Oa,sendMessageToNewThread:ha,interruptSelectedThreadTurn:Ps,interruptedUnsubmittedMessage:un,clearInterruptedUnsubmittedMessage:wu,selectedThreadQueuedMessages:Aa,removeQueuedMessage:mt,reorderQueuedMessage:En,steerQueuedMessage:Kn,autoCompactThreshold:Ar,setAutoCompactThreshold:Wn,setSelectedCollaborationMode:ue,readModelIdForThread:xe,setSelectedModelIdForThread:lt,injectModelSwitchDivision:hs,invalidateThreadContextWindow:Ea,setSelectedModelId:Xe,setSelectedReasoningEffort:ce,updateSelectedSpeedMode:Le,respondToPendingServerRequest:Io,pendingReplyErrorForRequest:us,renameProject:qe,removeProject:Oe,reorderProject:Ge,pinProjectToTop:Ke,startPolling:di,stopPolling:Es,primeSelectedThread:Fa}}const eb="codex-web-local.sidebar-collapsed.v1",tb="codex-web-local.accounts-section-collapsed.v1";function ED(){return typeof window>"u"?!1:window.localStorage.getItem(eb)==="1"}function MD(e){typeof window>"u"||window.localStorage.setItem(eb,e?"1":"0")}function RD(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(tb);return e===null?!0:e==="1"}function LD(){const e=k(ED()),t=k(RD()),n=k(""),r=k(!1),o=k(null),a=k(null);let s=0,i=0,l=!1;function u(E){var N;if(e.value!==E){if(E){const W=(N=f())==null?void 0:N.scrollTop;typeof W=="number"&&(W>0||s===0)&&(s=W)}e.value=E,MD(E),E||T()}}function d(){r.value=!r.value,r.value?Mt(()=>{var E;return(E=a.value)==null?void 0:E.focus()}):n.value=""}function m(){var E;n.value="",(E=a.value)==null||E.focus()}function f(){return o.value?o.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function v(E){if(e.value||l)return;const W=(E==null?void 0:E.currentTarget)&&typeof HTMLElement<"u"&&E.currentTarget instanceof HTMLElement?E.currentTarget:f();s=(W==null?void 0:W.scrollTop)??s}function T(){const E=++i,N=s,W=90;l=!0;const L=()=>{E===i&&(s=N,l=!1)},fe=le=>{if(E!==i)return;if(e.value){L();return}const Y=f();if(Y&&(Y.scrollTop=N,Math.abs(Y.scrollTop-N)<=1||le>=W)){L();return}if(le>=W||typeof window>"u"){L();return}window.requestAnimationFrame(()=>fe(le+1))};Mt(()=>fe(0))}function S(E){E.key==="Escape"&&(r.value=!1,n.value="")}function R(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(tb,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:r,sidebarScrollableRef:o,sidebarSearchInputRef:a,setSidebarCollapsed:u,toggleSidebarSearch:d,clearSidebarSearch:m,onSidebarScroll:v,onSidebarSearchKeydown:S,restoreSidebarScrollPosition:T,toggleAccountsSectionCollapsed:R}}const nb="codex-web-local.right-panel-width.v1",jD=260,$D=640,nv=320;function rb(e){return Math.min($D,Math.max(jD,e))}function ND(){if(typeof window>"u")return nv;const e=window.localStorage.getItem(nb),t=Number(e);return Number.isFinite(t)?rb(t):nv}function OD(e){typeof window>"u"||window.localStorage.setItem(nb,String(e))}function DD(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:r}=e,o=k("git"),a=k([]),s=k(""),i=G(()=>a.value.find(ye=>ye.key===s.value)??null),l=k(!1),u=k(!1),d=k(!1),m=k(ND()),f=k(!1),v=k(!1);let T=null;function S(){T&&(clearTimeout(T),T=null)}function R(){f.value=!1,v.value=!1,S()}function E(ye){ye.preventDefault();const ee=ye.clientX,ve=m.value,ne=De=>{const $e=ee-De.clientX;m.value=rb(ve+$e)},Ae=()=>{OD(m.value),window.removeEventListener("mousemove",ne),window.removeEventListener("mouseup",Ae)};window.addEventListener("mousemove",ne),window.addEventListener("mouseup",Ae)}function N(){n()&&(t()&&!u.value&&(u.value=!0),t()||(d.value=!1),o.value=o.value==="terminal"?"git":"terminal",o.value!=="terminal"&&R())}function W(ye){o.value=ye,l.value=!1,t()||(d.value=!1),t()&&(u.value=!0),ye!=="terminal"&&R()}function L(ye){const ee=a.value.find(ve=>ve.path===ye.path);if(ee)s.value=ee.key;else{const ve={key:`preview-${Date.now()}`,path:ye.path,label:ye.label};a.value=[...a.value,ve],s.value=ve.key}W("preview")}function fe(ye){a.value.some(ee=>ee.key===ye)&&(s.value=ye,W("preview"))}function le(ye){const ee=a.value.findIndex(Ae=>Ae.key===ye);if(ee<0)return;const ve=a.value.filter(Ae=>Ae.key!==ye);if(a.value=ve,s.value!==ye)return;if(ve.length===0){s.value="",o.value="files";return}const ne=ve[Math.min(ee,ve.length-1)];s.value=ne.key}function Y(){if(t()){u.value=!1;return}d.value=!0,l.value=!1,R()}function ie(){if(t()){u.value=!u.value;return}d.value=!d.value,d.value&&(l.value=!1,R())}function we(){o.value="git",t()&&(u.value=!1),R()}function Pe(ye){if(f.value=ye,!ye){v.value=!1,S();return}v.value=!0,S(),T=setTimeout(()=>{T=null,r()||(v.value=!1)},1500)}return{activeRightPanelTab:o,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:u,isRightPanelCollapsed:d,rightPanelWidth:m,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:v,onRightResizeHandleMouseDown:E,toggleRightPanelTerminal:N,selectRightPanelTab:W,onOpenFilePreview:L,selectFilePreviewTab:fe,closeFilePreviewTab:le,onCloseRightPanel:Y,onToggleRightPanelToggle:ie,onHideRightPanelTerminal:we,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:R,clearTerminalKeyboardFocusFallbackTimer:S}}function FD(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 rv(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!FD(e))throw new Error("Copy failed")}const BD=400;function UD(e,t,n,r){return e==="visible"&&!n&&t!==null&&r-t>=BD}function zD(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const t=e.startsWith("/"),n=/^[A-Za-z]:[\\/]/u.test(e),r=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return t||n||r||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function _c(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function Pc(e){return e.replace(/\\/gu,"/")}function ob(e){if(!e.startsWith("file://"))return e;let t=e.replace(/^file:\/\//u,"");try{t=decodeURIComponent(t)}catch{}return/^\/[A-Za-z]:\//u.test(t)&&(t=t.slice(1)),t}function HD(e){const t=Pc(e),n=t.match(/^\/Users\/([^/]+)/u);if(n)return`/Users/${n[1]}`;const r=t.match(/^\/home\/([^/]+)/u);return r?`/home/${r[1]}`:""}function Xu(e){const t=Pc(e);if(!t)return t;let n="",r=t;const o=r.match(/^([A-Za-z]:)(\/.*)?$/u);o?(n=`${o[1]}/`,r=(o[2]??"").replace(/^\/+/u,"")):r.startsWith("/")&&(n="/",r=r.slice(1));const a=r.split("/").filter(Boolean),s=[];for(const l of a)if(l!=="."){if(l===".."){s.length>0&&s.pop();continue}s.push(l)}const i=s.join("/");return n?`${n}${i}`.replace(/\/+$/u,"")||n:i||t}function DU(e,t){const n=Pc(ob(e.trim()));if(!n)return"";if(n.startsWith("/")||/^[A-Za-z]:\//u.test(n))return Xu(n);if(n.startsWith("~/")){const a=HD(t);if(a)return Xu(`${a}/${n.slice(2)}`)}const o=Pc(t.trim());return Xu(o?`${o.replace(/\/+$/u,"")}/${n}`:n)}function Ec(e){let t=e,n="",r="";const o={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;t.length>0;){const a=t[0],s=Object.prototype.hasOwnProperty.call(o,a)?o[a]:"";if(!s||!t.endsWith(s))break;n+=a,r+=s,t=t.slice(1,-1)}return{core:t,leading:n,trailing:r}}function Mc(e){if(!e)return null;let t=e.trim();t=Ec(t).core.trim();let r=null;const o=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(o)t=o[1],r=Number(o[2]);else{const a=t.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(t=a[1],r=Number(a[2]))}return t=ob(t),zD(t)?{path:t,line:r}:null}function ov(e,t,n){let r=0,o=t-1;for(;o>=n&&e[o]==="*";)r+=1,o-=1;return r}function WD(e,t){let n=0,r=t;for(;r<e.length&&e[r]==="*";)n+=1,r+=1;return n}function ab(e,t,n,r,o){const a=ov(e,t,r);return a<2?null:WD(e,n)>=a?{segmentStart:t-a,segmentEnd:n+a,tokenEndTrim:0}:ov(o,o.length,0)>=a?{segmentStart:t-a,segmentEnd:n,tokenEndTrim:a}:null}function Yf(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith(")"))return null;const n=t.indexOf("]");if(n<=1||t[n+1]!=="(")return null;const r=t.slice(1,n).trim(),o=t.slice(n+2,-1).trim();if(r.includes(`
79
- `)||o.includes(`
80
- `))return null;const a=Ec(r).core.trim()||r,s=Ec(o).core.trim();return s?{label:a,target:s}:null}function Rc(e){const t=e.trim().match(/^codex:\/\/threads\/([A-Za-z0-9-]+)$/u);if(!t)return null;if(typeof window>"u")return`/#/thread/${t[1]}`;const n=window.location.pathname.replace(/\/?$/u,"/");return`${window.location.origin}${n}#/thread/${t[1]}`}function FU(e){const t=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(t)}`}function BU(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function qD(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;if(t.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(t)}`;const n=t.startsWith("/"),r=/^[A-Za-z]:[\\/]/u.test(t);return n||r?`/codex-local-image?path=${encodeURIComponent(t)}`:t}function hl(e,t={}){const n=[],r=/codex:\/\/threads\/[A-Za-z0-9-]+|https?:\/\/[^\s<>"'`,。;:!?、()[\]{}「」『』《》]+|file:\/\/[^\n<>"'`,。;:!?、[\]{}「」『』《》]+|["'](?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^\n"']+["']|`(?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^`\n]+`/gu;let o=0;for(const a of e.matchAll(r)){if(typeof a.index!="number")continue;const s=a.index,i=s+a[0].length;let l=a[0],u="";for(;/[.,;:!?,。;:!?、]$/u.test(l);)u=l.slice(-1)+u,l=l.slice(0,-1);const d=ab(e,s,i,o,l),m=(d==null?void 0:d.segmentStart)??s,f=(d==null?void 0:d.segmentEnd)??i;m>o&&n.push({kind:"text",value:e.slice(o,m)}),d!=null&&d.tokenEndTrim&&(l=l.slice(0,-d.tokenEndTrim));const v=Ec(l);l=v.core;const T=v.leading,S=v.trailing+u;T&&n.push({kind:"text",value:T});const R=Rc(l);if(R)n.push({kind:"url",value:R,href:R}),S&&n.push({kind:"text",value:S});else if(l.startsWith("**")&&l.endsWith("**")&&l.length>4)n.push({kind:"bold",value:l.slice(2,-2)}),S&&n.push({kind:"text",value:S});else if(/^https?:\/\//u.test(l))n.push({kind:"url",value:l,href:l}),S&&n.push({kind:"text",value:S});else{const E=Mc(l);E?(n.push({kind:"file",value:l,path:E.path,displayPath:l,downloadName:_c(E.path)}),S&&n.push({kind:"text",value:S})):n.push({kind:"text",value:a[0]})}o=f}return o<e.length&&n.push({kind:"text",value:e.slice(o)}),t.applyMarkdownMarkers===!1?n:sb(n)}function df(e,t){const n=[];let r=!1,o="";const a=s=>{s&&n.push({kind:"text",value:s})};for(const s of e){if(s.kind!=="text"){r&&(a(`${t.marker}${o}`),r=!1,o=""),n.push(s);continue}let i=s.value;for(;i.length>0;){const l=i.indexOf(t.marker);if(l<0){r?o+=i:a(i);break}const u=i.slice(0,l);if(r?o+=u:a(u),i=i.slice(l+t.marker.length),r){const d=o;d.length>0&&(!t.isValidContent||t.isValidContent(d))?n.push({kind:t.kind,value:d}):a(`${t.marker}${d}${t.marker}`),o="",r=!1}else r=!0}}return r&&a(`${t.marker}${o}`),n}function sb(e){const t=r=>r.trim().length>0&&!/^\s/u.test(r)&&!/\s$/u.test(r);let n=df(e,{marker:"**",kind:"bold",isValidContent:t});return n=df(n,{marker:"~~",kind:"strikethrough",isValidContent:t}),n=df(n,{marker:"*",kind:"italic",isValidContent:t}),n}function GD(e,t={}){const n=[];let r=0,o=0;const a=(s,i)=>{let l=s.indexOf("[",i);for(;l>=0;){const u=s.indexOf("]",l+1);if(u<0)return null;if(s[u+1]!=="("){l=s.indexOf("[",l+1);continue}let d=1,m=u+2,f=!1;for(;m<s.length;){const v=s[m];if(v===`
81
- `){f=!0;break}if(v==="("&&(d+=1),v===")"&&(d-=1,d===0)){const T=s.slice(l,m+1);if(Yf(T))return{start:l,end:m+1,token:T};break}m+=1}if(f){l=s.indexOf("[",l+1);continue}l=s.indexOf("[",l+1)}return null};for(;o<e.length;){const s=a(e,o);if(!s)break;const{start:i,end:l,token:u}=s,d=ab(e,i,l,r,u),m=(d==null?void 0:d.segmentStart)??i,f=(d==null?void 0:d.segmentEnd)??l;m>r&&n.push(...hl(e.slice(r,m),t));const v=Yf(u);if(!v){n.push(...hl(e.slice(m,f),t)),r=f,o=f;continue}const T=v.label,S=v.target,R=Rc(S);if(R)n.push({kind:"url",value:T||R,href:R});else if(/^https?:\/\//u.test(S))n.push({kind:"url",value:T||S,href:S});else{const E=Mc(S);E?n.push({kind:"file",value:S,path:E.path,displayPath:T||S,downloadName:_c(E.path)}):n.push({kind:"text",value:u})}r=f,o=f}return r<e.length&&n.push(...hl(e.slice(r),t)),n}function UU(e){const t=e.includes("`"),n=GD(e,{applyMarkdownMarkers:!t});if(!t)return n;if(!n.some(o=>o.kind==="text"&&o.value.includes("`")))return sb(n);const r=o=>{if(!o.includes("`"))return hl(o);const a=[];let s=0,i=0;for(;s<o.length;){if(o[s]!=="`"){s+=1;continue}let l=1;for(;s+l<o.length&&o[s+l]==="`";)l+=1;const u="`".repeat(l);let d=s+l,m=-1;for(;d<o.length;){const v=o.indexOf(u,d);if(v<0)break;const T=v>0&&o[v-1]==="`",S=v+l<o.length&&o[v+l]==="`",R=o.slice(s+l,v).includes(`
82
- `);if(!T&&!S&&!R){m=v;break}d=v+1}if(m<0){s+=l;continue}s>i&&a.push(...hl(o.slice(i,s)));const f=o.slice(s+l,m);if(f.length>0){const v=Yf(f);if(v){const T=Rc(v.target);if(T)a.push({kind:"url",value:v.label||T,href:T});else if(/^https?:\/\//u.test(v.target))a.push({kind:"url",value:v.label||v.target,href:v.target});else{const S=Mc(v.target);S?a.push({kind:"file",value:v.target,path:S.path,displayPath:v.label||v.target,downloadName:_c(S.path)}):a.push({kind:"code",value:f})}}else{const T=Rc(f);if(T)a.push({kind:"url",value:T,href:T});else if(/^https?:\/\/[^\s]+$/u.test(f))a.push({kind:"url",value:f,href:f});else{const S=Mc(f);if(S){const R=S.line?`${S.path}:${String(S.line)}`:S.path;a.push({kind:"file",value:f,path:S.path,displayPath:R,downloadName:_c(S.path)})}else a.push({kind:"code",value:f})}}}else a.push({kind:"text",value:`${u}${u}`});s=m+l,i=s}return i<o.length&&a.push(...hl(o.slice(i))),a};return n.flatMap(o=>o.kind==="text"?r(o.value):[o])}function ib(e){return e.replace(/\r\n/gu,`
83
- `)}function Za(e){var n;return(((n=e.match(/^\s*/u))==null?void 0:n[0])??"").replace(/\t/gu," ").length}function lb(e,t){if(t<=0)return e.trimStart();let n=0,r=0;for(;n<e.length&&r<t;){const o=e[n];r+=o===" "?4:1,n+=1}return e.slice(n)}function es(e){return e.trim().length===0}function Jf(e){const t=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return t?{level:t[1].length,value:t[2].trim()}:null}function ic(e){const t=e.match(/^\s{0,3}>\s?(.*)$/u);return t?t[1]??"":null}function iu(e){var n;const t=e.match(/^\s*[-*+]\s+(.+)$/u);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function VD(e){var n;const t=e.match(/^(\s*)[-*+]\s+(.+)$/u);return t?{indent:Za(t[1]??""),text:((n=t[2])==null?void 0:n.trim())??""}:null}function lu(e){var n;const t=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{checked:(t[1]??" ").toLowerCase()==="x",text:((n=t[2])==null?void 0:n.trim())??""}:null}function av(e){var n;const t=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{indent:Za(t[1]??""),item:{checked:(t[2]??" ").toLowerCase()==="x",text:((n=t[3])==null?void 0:n.trim())??""}}:null}function ub(e){var n;const t=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return t?{indent:Za(t[1]??""),start:Number.parseInt(t[2]??"1",10)||1,text:((n=t[3])==null?void 0:n.trim())??""}:null}function Qf(e){var t;return((t=ub(e))==null?void 0:t.text)??null}function sv(e){return ub(e)}function Xf(e){const t=e.trim();if(!t.includes("|"))return null;let n=t;n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const r=[];let o="",a=0;for(let s=0;s<n.length;s+=1){const i=n[s];if(i==="\\"&&n[s+1]==="|"){o+="|",s+=1;continue}if(i==="`"){let l=1;for(;n[s+l]==="`";)l+=1;o+=n.slice(s,s+l),a===0?a=l:a===l&&(a=0),s+=l-1;continue}if(i==="|"&&a===0){r.push(o.trim()),o="";continue}o+=i}return r.push(o.trim()),r.some(s=>s.length>0)?r:null}function KD(e){const t=Xf(e);if(!t||t.length===0)return null;const n=t.map(r=>{const o=r.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(o))return null;const a=o.startsWith(":"),s=o.endsWith(":");return a&&s?"center":s?"right":a?"left":null});return n.every((r,o)=>r!==null||/^-+$/u.test(t[o].replace(/\s+/gu,"")))?n:null}function iv(e,t){return e.length===t?e:e.length>t?e.slice(0,t):[...e,...Array.from({length:t-e.length},()=>"")]}function lv(e,t){var d;if(t+1>=e.length)return null;const n=e[t],r=e[t+1],o=Xf(n),a=KD(r);if(!o||!a||o.length!==a.length)return null;const s=n.trim();if(!s.startsWith("|")&&(((d=s.match(/\|/gu))==null?void 0:d.length)??0)<2)return null;const i=o.length,l=[];let u=t+2;for(;u<e.length&&!es(e[u]);){const m=Xf(e[u]);if(!m)break;l.push(iv(m,i)),u+=1}return{kind:"table",headers:iv(o,i),rows:l,alignments:a}}function YD(e){return es(e)||Lc(e)!==null||Zf(e)||Jf(e)!==null||ic(e)!==null||lu(e)!==null||iu(e)!==null||Qf(e)!==null}function JD(e,t,n=-1){const r=[];let o=t;for(;o<e.length&&!(YD(e[o])||n>=0&&Za(e[o])<=n);)r.push(n>=0?lb(e[o],n+1):e[o]),o+=1;const a=r.join(`
84
- `).trim();return a?{value:a,nextIndex:o}:null}function cb(e,t){for(let n=t;n<e.length;n+=1)if(!es(e[n]))return n;return-1}function QD(e,t,n,r=null,o=!1){const a=[];let s=t;for(;s<e.length;){const i=e[s];if(es(i)){const m=cb(e,s+1);if(m===-1){a.push(""),s=e.length;break}const f=r==null?void 0:r(e[m]);if(f&&f.indent===n||Za(e[m])<=n)break;a.push(""),s+=1;continue}const l=r==null?void 0:r(i);if(l&&l.indent===n)break;const u=Za(i),d=o&&(lu(i)!==null||iu(i)!==null);if(u<=n&&!d)break;a.push(u>n?lb(i,n+1):i.trimStart()),s+=1}for(;a.length>0&&es(a[0]);)a.shift();for(;a.length>0&&es(a[a.length-1]);)a.pop();return a.length===0?null:{blocks:lc(a.join(`
85
- `)),nextIndex:s}}function uv(e,t,n,r=!1){const o=[];let a=t;const s=n(e[t]);if(!s)return null;const i=s.indent;for(;a<e.length;){const l=n(e[a]);if(l===null||l.indent!==i)break;const u=[l.text],d=[];for(a+=1;a<e.length;){if(es(e[a])){const S=cb(e,a+1);if(S===-1){a=e.length;break}const R=n(e[S]);if(R&&R.indent===i){a=S;break}if(Za(e[S])<=i){a=S;break}a+=1;continue}const m=n(e[a]);if(m&&m.indent===i)break;const f=Za(e[a])>i,v=r&&(lu(e[a])!==null||iu(e[a])!==null);if(f||v){const S=QD(e,a,i,n,r);if(S){d.push(...S.blocks),a=S.nextIndex;continue}}if(Za(e[a])<=i)break;const T=JD(e,a,i);if(!T)break;u.push(T.value),a=T.nextIndex}o.push(d.length>0?{paragraphs:u,children:d}:{paragraphs:u})}return o.length>0?{items:o,nextIndex:a}:null}function Zf(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}const db="^\\s{0,3}(```+|~~~+)\\s*([^\\s`~][^`]*)?\\s*$",XD=new RegExp(db,"u"),cv=new RegExp(db,"gmu");function Lc(e){const t=e.match(XD);return t?{marker:t[1],language:(t[2]??"").trim()}:null}function ZD(e){return e?(cv.lastIndex=0,cv.test(e.replace(/\r\n/gu,`
86
- `))):!1}function lc(e){var a;const n=ib(e).split(`
87
- `),r=[];let o=0;for(;o<n.length;){if(es(n[o])){o+=1;continue}const s=Lc(n[o]);if(s){o+=1;const S=[];for(;o<n.length;){if(n[o].trim()===s.marker){o+=1;break}S.push(n[o]),o+=1}r.push({kind:"codeBlock",language:s.language,value:S.join(`
88
- `)});continue}if(Zf(n[o])){r.push({kind:"thematicBreak"}),o+=1;continue}const i=Jf(n[o]);if(i){r.push({kind:"heading",level:i.level,value:i.value}),o+=1;continue}if(ic(n[o])!==null){const S=[];for(;o<n.length;){const R=ic(n[o]);if(R===null)break;S.push(R),o+=1}r.push({kind:"blockquote",value:S.join(`
89
- `).trim()});continue}const u=lv(n,o);if(u){r.push(u),o+=2+u.rows.length;continue}if(lu(n[o])!==null){const S=[],R=((a=av(n[o]))==null?void 0:a.indent)??0;for(;o<n.length;){const E=av(n[o]);if(E===null||E.indent!==R)break;S.push(E.item),o+=1}if(S.length>0){r.push({kind:"taskList",items:S});continue}}const m=iu(n[o]);if(m!==null){const S=uv(n,o,VD);if(S){r.push({kind:"unorderedList",items:S.items}),o=S.nextIndex;continue}if(m.length>0){r.push({kind:"unorderedList",items:[{paragraphs:[m]}]}),o+=1;continue}}const f=Qf(n[o]);if(f!==null){const S=sv(n[o]),R=uv(n,o,sv,!0);if(R){r.push({kind:"orderedList",items:R.items,start:(S==null?void 0:S.start)??1}),o=R.nextIndex;continue}if(f.length>0){r.push({kind:"orderedList",items:[{paragraphs:[f]}],start:(S==null?void 0:S.start)??1}),o+=1;continue}}const v=[];for(;o<n.length&&!(es(n[o])||Lc(n[o])||Zf(n[o])||Jf(n[o])||lv(n,o)||ic(n[o])!==null||lu(n[o])!==null||iu(n[o])!==null||Qf(n[o])!==null);)v.push(n[o]),o+=1;const T=v.join(`
90
- `).trim();T&&r.push({kind:"paragraph",value:T})}return r}function eF(e){if(!e.includes("![")||!e.includes("]("))return lc(e);const t=[],n=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let r=0;for(const o of e.matchAll(n)){const[a,s,i]=o;if(typeof o.index!="number")continue;const l=o.index,u=l+a.length,d=qD(i.trim());d&&(l>r&&t.push(...lc(e.slice(r,l))),t.push({kind:"image",url:d,alt:s.trim(),markdown:a}),r=u)}return r<e.length&&t.push(...lc(e.slice(r))),t}function tF(e){const n=ib(e).split(`
91
- `),r=[];let o=0,a=0;const s=i=>{if(i<=a)return;const l=n.slice(a,i).join(`
92
- `);r.push(...eF(l))};for(;o<n.length;){const i=Lc(n[o]);if(!i){o+=1;continue}s(o),o+=1;const l=[];for(;o<n.length;){if(n[o].trim()===i.marker){o+=1;break}l.push(n[o]),o+=1}r.push({kind:"codeBlock",language:i.language,value:l.join(`
93
- `)}),a=o}return s(n.length),r.length>0?r:[{kind:"paragraph",value:e}]}function fb(e){return e.role==="assistant"&&!(e.messageType==="commandExecution"&&e.commandExecution)&&e.messageType!=="worked"&&!(e.messageType??"").endsWith(".live")}function hb(e,t){for(const n of e){if(n.kind==="codeBlock"){t.push({language:n.language,value:n.value});continue}if(n.kind==="unorderedList"||n.kind==="orderedList")for(const r of n.items)r.children&&r.children.length>0&&hb(r.children,t)}}function nF(e){const t=e.text;if(!t||!t.trim())return[];const n=[];return hb(tF(t),n),n}function rF(e,t=fb){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(t(r)&&ZD(r.text??""))return!0}return!1}function oF(e,t=fb){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(!t(r))continue;const o=nF(r),a=o[o.length-1];if(a)return{messageId:r.id,turnIndex:typeof r.turnIndex=="number"?r.turnIndex:null,language:a.language,value:a.value}}return null}const aF=[[/(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 pb(e){return e.trim().toLowerCase()}function sF(e,t){return t.reduce((n,[r,o])=>n+(r.test(e)?o:0),0)}function dv(e){return e.activeCount*1e3+(e.isNoAuth?300:0)+e.toolsCount*3+e.triggersCount*4+sF(`${e.name} ${e.slug} ${e.description}`,aF)}function iF(e,t){const n=pb(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 Qi(e){return e.activeCount>0?0:e.totalConnections>0?1:e.isNoAuth?2:3}function zU(e,t,n=""){const r=pb(n),o=a=>iF(a,r);return t==="name"?[...e].sort((a,s)=>o(s)-o(a)||Qi(a)-Qi(s)||a.name.localeCompare(s.name)):t==="date"?[...e].sort((a,s)=>o(s)-o(a)||Qi(a)-Qi(s)||a.name.localeCompare(s.name)):[...e].sort((a,s)=>o(s)-o(a)||Qi(a)-Qi(s)||dv(s)-dv(a)||a.name.localeCompare(s.name))}function lF(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 uF(e,t){const n=[];for(const r of e){const o=r.name.trim();if(!o)continue;const a=(r.path??"").trim()||lF(o,t);a&&n.push({name:o,path:a})}return n}const cF={class:"sidebar-root"},dF=["aria-pressed","aria-label","title"],fF={key:1,class:"sidebar-search-bar"},hF=["placeholder"],pF=["aria-label"],mF={class:"sidebar-skills-link-icon","aria-hidden":"true"},gF={class:"sidebar-skills-link-copy"},vF={class:"sidebar-skills-link-title"},yF={class:"sidebar-skills-link-subtitle"},wF={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},bF={class:"sidebar-skills-link-copy"},TF={class:"sidebar-skills-link-title"},kF={class:"sidebar-skills-link-subtitle"},SF={class:"sidebar-settings-actions"},CF=["title","aria-label"],xF=["title","aria-label"],IF={class:"content-root-wrap"},AF={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},_F={key:1,class:"skills-route-header-icon","aria-hidden":"true"},PF={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},EF=["aria-label","title"],MF=["aria-label","title"],RF={class:"content-body"},LF={key:2,class:"content-grid content-grid-home"},jF={class:"new-thread-empty"},$F={class:"new-thread-hero"},NF=["title"],OF={class:"new-thread-folder-actions"},DF=["disabled"],FF={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},BF={class:"new-thread-launch-card-copy"},UF={class:"new-thread-launch-card-topline"},zF={class:"new-thread-launch-card-badge","aria-hidden":"true"},HF={class:"new-thread-launch-card-eyebrow"},WF={class:"new-thread-launch-card-title"},qF={class:"new-thread-launch-card-text"},GF={class:"new-thread-launch-card-actions"},VF=["aria-label","onKeydown"],KF={class:"new-thread-open-folder-header"},YF={class:"new-thread-open-folder-title"},JF={class:"new-thread-open-folder-label"},QF={class:"new-thread-open-folder-current"},XF=["placeholder","title","disabled","onKeydown"],ZF=["disabled"],eB={class:"new-thread-open-folder-actions"},tB={class:"new-thread-open-folder-toggle"},nB=["aria-pressed","disabled"],rB={key:0,class:"new-thread-open-folder-create"},oB={class:"new-thread-open-folder-create-composer"},aB=["placeholder","onKeydown"],sB=["disabled"],iB={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},lB=["href"],uB=["placeholder","onKeydown"],cB={key:1,class:"new-thread-open-folder-error-actions"},dB={class:"new-thread-open-folder-error visible-error-with-feedback"},fB=["href"],hB=["disabled"],pB={key:2,class:"new-thread-open-folder-status"},mB={key:3,class:"new-thread-open-folder-status"},gB={key:4,class:"new-thread-open-folder-list"},vB=["title","disabled","onClick"],yB={class:"new-thread-open-folder-item-name"},wB=["disabled","onClick"],bB=["aria-label","onKeydown"],TB={class:"new-thread-open-folder-header"},kB={class:"new-thread-open-folder-title"},SB=["disabled"],CB=["aria-label"],xB=["aria-selected","disabled"],IB=["aria-selected","disabled"],AB={class:"new-thread-project-field"},_B={class:"new-thread-open-folder-label"},PB=["disabled","placeholder"],EB={key:0,class:"new-thread-project-field"},MB={class:"new-thread-open-folder-label"},RB=["disabled","placeholder","onKeydown"],LB={key:1,class:"new-thread-project-field"},jB={class:"new-thread-open-folder-label"},$B=["disabled","onKeydown"],NB={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},OB=["href"],DB={class:"new-thread-project-modal-actions"},FB=["disabled"],BB=["disabled"],UB={key:3,class:"new-thread-branch-select"},zB={class:"new-thread-branch-select-label"},HB={class:"new-thread-branch-select-help"},WB={key:4,class:"new-thread-runtime-help"},qB={class:"worktree-init-status-title"},GB={class:"worktree-init-status-message"},VB={class:"composer-with-queue"},KB={key:0,class:"composer-runtime-error",role:"alert"},YB=["href"],JB={key:3,class:"content-grid"},QB={class:"content-thread"},XB={key:0,class:"external-session-banner",role:"alert"},ZB={key:1,class:"composer-runtime-error",role:"alert"},e2=["href"],t2={key:2,class:"interrupt-recovered-banner",role:"status"},n2=["aria-label"],r2={class:"content-right-panel-header"},o2={class:"content-right-panel-tabs",role:"tablist"},a2=["aria-selected"],s2=["aria-selected"],i2=["aria-selected","title","onClick"],l2={class:"content-right-panel-tab-label"},u2=["aria-label","title","onClick"],c2={class:"content-right-panel-actions"},d2={class:"content-right-panel-add-wrap"},f2=["aria-label","title"],h2={key:0,class:"content-right-panel-menu"},p2=["aria-label","title"],m2={class:"content-right-panel-body"},g2={key:2,class:"project-zip-modal-backdrop",role:"presentation"},v2=["aria-label"],y2={class:"project-zip-modal-header"},w2={class:"project-zip-modal-title"},b2=["aria-label","disabled"],T2={class:"project-zip-modal-copy"},k2={class:"project-zip-progress-label",role:"status","aria-live":"polite"},S2={class:"project-zip-progress-track"},C2={key:0,class:"project-zip-modal-error",role:"alert"},x2={class:"project-zip-modal-actions"},I2=["disabled"],A2=["disabled"],_2=["disabled"],P2=["aria-label"],E2={class:"codex-login-modal-header"},M2={class:"codex-login-modal-title"},R2=["aria-label","disabled"],L2={class:"codex-login-modal-copy"},j2=["href"],$2=["placeholder","disabled"],N2={key:1,class:"codex-login-modal-error visible-error-with-feedback"},O2=["href"],D2={class:"codex-login-modal-actions"},F2=["disabled"],B2=["disabled"],U2=400,fv="codex-web-local.send-with-enter.v1",hv="codex-web-local.in-progress-send-mode.v1",pv="codex-web-local.dark-mode.v1",mv="codex-web-local.dictation-click-to-toggle.v1",gv="codex-web-local.dictation-auto-send.v1",vv="codex-web-local.dictation-language.v1",yv="codex-web-local.chat-width.v1",z2=hn({__name:"App",setup(e){var Dp,Fp;const t=Po(()=>Eo(()=>import("./ThreadConversation-Dtax0JLK.js"),__vite__mapDeps([0,1,2]))),n=Po(()=>Eo(()=>import("./ThreadTerminalPanel-idJzeGIj.js"),__vite__mapDeps([3,4]))),r=Po(()=>Eo(()=>import("./ReviewPane-BSREI-GV.js"),__vite__mapDeps([5,6]))),o=Po(()=>Eo(()=>import("./DirectoryHub-98VWiJA8.js"),__vite__mapDeps([7,1,8]))),a=Po(()=>Eo(()=>import("./AutomationsPanel-CPmFyFEQ.js"),__vite__mapDeps([9,10]))),s=Po(()=>Eo(()=>import("./SettingsDialog-DWXo_tgA.js"),__vite__mapDeps([11,12]))),i=Po(()=>Eo(()=>import("./RightGitPanel-B_XONRO5.js"),__vite__mapDeps([13,14]))),l=Po(()=>Eo(()=>import("./RightFilesPanel-BEfSnNoe.js"),__vite__mapDeps([15,16]))),u=Po(()=>Eo(()=>import("./RightFilePreview-CoX2APsz.js"),__vite__mapDeps([17,18]))),d=Po(()=>Eo(()=>import("./ThreadPendingRequestPanel-DIuf5YSm.js"),__vite__mapDeps([19,20]))),m=Po(()=>Eo(()=>import("./QueuedMessages-D_vueKGf.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:v,uiLanguageOptions:T,setUiLanguage:S}=co(),R="codex-mobile",E="0.1.134",N={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},W={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:L,projectDisplayNameById:fe,selectedThread:le,selectedThreadTokenUsage:Y,selectedThreadServerRequests:ie,selectedLiveOverlay:we,lastPlanByThreadId:Pe,resolveThreadTurnIndex:ye,selectedActiveTurnId:ee,codexQuota:ve,selectedThreadId:ne,availableCollaborationModes:Ae,availableModelIds:De,availableModelReasoningEfforts:$e,selectedCollaborationMode:je,selectedReasoningEffort:Ce,selectedSpeedMode:Se,codexCliMissingError:xe,installedSkills:Ee,accountRateLimitSnapshots:Je,messages:Xe,hasMoreOlderMessages:lt,isLoadingThreads:ce,isThreadListFullyLoaded:F,isLoadingMessages:oe,slowOpenThreadId:se,isLoadingOlderMessages:Le,isSendingMessage:We,isInterruptingTurn:P,isSelectedThreadInterruptPending:$,isUpdatingSpeedMode:q,error:ue,refreshAll:re,refreshSkills:ae,refreshHooks:_e,hooksList:Ne,isHooksLoading:Ie,onRealtimeEvent:he,selectThread:Ke,ensureThreadMessagesLoaded:Oe,loadMessages:qe,loadOlderMessages:Ge,archiveThreadById:dt,compactThreadById:bt,compactingThreadIds:ot,fuzzyFileSearchResults:ut,registerFuzzyFileSearchSession:J,forkThreadById:de,renameThreadById:ke,forkThreadFromTurn:Be,sendMessageToSelectedThread:vt,sendMessageToNewThread:yt,interruptSelectedThreadTurn:Bt,interruptedUnsubmittedMessage:Bo,clearInterruptedUnsubmittedMessage:Yt,selectedThreadQueuedMessages:fo,removeQueuedMessage:er,reorderQueuedMessage:ka,steerQueuedMessage:ho,autoCompactThreshold:ni,setAutoCompactThreshold:Sa,setSelectedCollaborationMode:is,readModelIdForThread:Fr,setSelectedModelIdForThread:ls,injectModelSwitchDivision:Br,invalidateThreadContextWindow:Uo,setSelectedReasoningEffort:zo,updateSelectedSpeedMode:ri,respondToPendingServerRequest:Ho,pendingReplyErrorForRequest:Ur,renameProject:us,removeProject:Ca,reorderProject:Wo,pinProjectToTop:po,startPolling:mo,stopPolling:Sr,primeSelectedThread:cs,rollbackSelectedThread:xa}=PD(),gt=Ux(),Tt=Bx(),{isMobile:Ct}=Sh();function en(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const $n=k(null),pn=k(null),Cr=k(null);let hr=null;const{buildFeedbackMailto:qo,feedbackMailtoBase:mn,recordVisibleFailure:tr}=yw(),xr=mn();function Rt(c,h){h&&tr(h);const b=c.currentTarget;b instanceof HTMLAnchorElement&&(b.href=qo())}const go=k(null),nr=k(null),kn=k(null),zr=k(0);let Nn=null;function Pn(){const c=kn.value;if(!c)return;const h=window.getComputedStyle(c),b=Number.parseFloat(h.paddingLeft)+Number.parseFloat(h.paddingRight),U=Math.max(0,c.clientWidth-(Number.isFinite(b)?b:0)),Q=h.getPropertyValue("--chat-column-max").trim(),be=Number.parseFloat(Q)*(Q.endsWith("rem")?16:1),Ue=Number.isFinite(be)&&be>0?Math.min(U,be):U;zr.value=Ue}const Sn=k(null),Ia=k(null),pr=k(!0),Hr=DD({isMobile:()=>Ct.value,canShowRightPanel:()=>Al.value,isVirtualKeyboardOpen:()=>_l.value}),{activeRightPanelTab:Ut,filePreviewTabs:vo,activeFilePreviewTabKey:Go,activeFilePreviewTab:Vo,isRightPanelMenuOpen:Cn,isMobileRightPanelOpen:Xt,isRightPanelCollapsed:mr,rightPanelWidth:ln,isTerminalInputFocused:Ko,isTerminalKeyboardFocusFallbackActive:tn,onRightResizeHandleMouseDown:Wr,toggleRightPanelTerminal:Yo,selectRightPanelTab:zt,onOpenFilePreview:Jo,selectFilePreviewTab:Qo,closeFilePreviewTab:It,onCloseRightPanel:vn,onToggleRightPanelToggle:yo,onHideRightPanelTerminal:Ir,onTerminalFocusChange:Ar,resetTerminalKeyboardFocusState:Xo,clearTerminalKeyboardFocusFallbackTimer:qr}=Hr,Zo=k(null),rr=k(!1),wo=k("");let ea=!1;const _r=k(!1),mt=k(""),En=k("local"),xn=k({}),Aa=new Map,Wn=k(""),I=k([]),O=k(!1),K=k({order:[],labels:{},projectOrder:[]}),Te=k({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),He=k({phase:"idle",title:"",message:""}),$t=LD(),{isSidebarCollapsed:xt,isAccountsSectionCollapsed:nn,sidebarSearchQuery:Jt,isSidebarSearchVisible:Pr,sidebarScrollableRef:_a,sidebarSearchInputRef:ds,setSidebarCollapsed:un,toggleSidebarSearch:ta,clearSidebarSearch:Pa,onSidebarScroll:oi,onSidebarSearchKeydown:Mn,toggleAccountsSectionCollapsed:fs}=$t,ai=k(null),hs=k(null),Ea=k(null),na=k(null);let rn=null,ra=0,Gr=0,yn=0,bo=0;const To=k("New Project (1)"),ps=k(""),on=k(!1),Mi=k("general");let wn=0;function ms(){if(on.value){wn=Date.now(),on.value=!1;return}Date.now()-wn<U2||(on.value=!0)}const or=k(!1),gs=k(!1),vs=k(new Set);async function Sl(){try{vs.value=new Set(await PA())}catch{}finally{gs.value=!0}}const Ri=G(()=>!gs.value||Dg(vs.value,Og.hooks)),si=G(()=>!gs.value||Dg(vs.value,Og.remoteControl));tt(on,c=>{c&&(_e(),ws(),si.value&&Ts())});const _t=k({enabled:!1,clients:[]}),Nt=k(null),ys=k(!1),Er=k(!1),qn=k(""),Vr=k(""),oa=k("");let On=null,aa=!1,ko=null;const Ma=k("never"),sa=k(!1),Kr=k(!1),Yr=k(""),Jr=k("");let Li=!1;const ji=k(!1);async function ws(c={}){if(!(c.force!==!0&&Li)){sa.value=!0,Yr.value="";try{Ma.value=await c_(),Li=!0}catch(h){Yr.value=h instanceof Error?h.message:"Failed to load approval policy"}finally{sa.value=!1}}}function Qr(c){Ma.value=c}async function ia(){Kr.value=!0,Yr.value="",Jr.value="";try{await d_(Ma.value),ji.value=!0,Jr.value=f("Approval policy saved"),bs&&clearTimeout(bs),bs=setTimeout(()=>{Jr.value=""},2200)}catch(c){Yr.value=c instanceof Error?c.message:"Failed to save approval policy"}finally{Kr.value=!1}}let bs=null;async function Ts(c={}){if(!(c.force!==!0&&aa)){ys.value=!0,Vr.value="";try{const h=await u_();_t.value=h,aa=!0}catch(h){Vr.value=h instanceof Error?h.message:"Failed to load remote control status"}finally{ys.value=!1}}}async function $i(){const c=!_t.value.enabled;Er.value=!0,qn.value=c?"enable":"disable";try{await f_(c),_t.value={..._t.value,enabled:c},ar(c?"Remote control enabled":"Remote control disabled")}catch(h){Vr.value=h instanceof Error?h.message:"Failed to update remote control"}finally{Er.value=!1,qn.value=""}}async function ii(){Er.value=!0,qn.value="pairing";try{Nt.value=await h_()}catch(c){Vr.value=c instanceof Error?c.message:"Failed to start pairing"}finally{Er.value=!1,qn.value=""}}async function ks(){Er.value=!0,qn.value="clients";try{_t.value={..._t.value,clients:await p_()}}catch(c){Vr.value=c instanceof Error?c.message:"Failed to load remote clients"}finally{Er.value=!1,qn.value=""}}async function Cl(c){Er.value=!0,qn.value=`revoke:${c}`;try{await m_(c),_t.value={..._t.value,clients:_t.value.clients.filter(h=>h.clientId!==c)},ar("Remote client removed")}catch(h){Vr.value=h instanceof Error?h.message:"Failed to remove remote client"}finally{Er.value=!1,qn.value=""}}function ar(c){oa.value=c,On&&clearTimeout(On),On=setTimeout(()=>{oa.value=""},3e3)}const gr=k(""),Mr=k(""),Xr=k([]),vr=k(null),la=k(null),C=k(null),M=k(null),x=k(!1),X=k(!1),Qe=k({addedLineCount:0,removedLineCount:0}),qt=k([]),Gn=k(""),yr=k({}),an=k(""),Rr=k(""),Ra=k({}),ua=k(""),Ss=k(""),Cs=k(!1),La=k(!1);function ed(c,h){return`${c}\0${h?"with-reset-history":"without-reset-history"}`}const yu=k(null),Vn=k([]),ca=k(!1),So=k(!1),da=k(!1),Dn=k(!1),Ni=k(!1),li=k(""),ja=k(""),xl=k(null),$a=k(""),Zr=k(""),fa=k(""),bn=k(""),Na=k(xd(fv,!0)),xs=k(_0()),Is=k(A0()),ui=k(P0()),As=k(xd(mv,!1)),_s=k(xd(gv,!0)),Co=k(U0()),td=G(()=>z0()),nd=G(()=>{const{loaded:c,total:h}=Te.value,b=rp(c);return h&&h>0?`${b} / ${rp(h)}`:c>0?b:f("Preparing...")}),rd=G(()=>{const{loaded:c,total:h,phase:b}=Te.value;return b==="ready"?"100%":!h||h<=0?c>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(c/h*100)))}%`}),Oa=k(!1),ha=k(!1),Da=k(!1),Ps=k(""),wu=k(!1),bu=k(null),Rn=k(!1),Lr=k(""),wr=k("codex"),od=G(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),eo=k(""),xo=k(""),ci=k("responses"),to=k("responses"),Fn=k(""),Tu=k(!1),Oi=k(""),di=k(""),pa=k(""),Il=k(!1),Io=k(!1),Es=k(""),Kn=k(""),Fa=k(!1),p=k(!1),y=k("create"),A=k(""),j=k(""),H=k(""),V=k(!1),z=k(""),Z=k(!1),me=k(null),ge=k(null),ze=k(!1),nt=k(null),Pt=k(null),at=k(""),At=k(""),St=k(""),Lt=k([]),cn=k(""),gn=k(!1),Yn=k(!1),ku=k(!1),jr=k(""),Di=[ue,xe,Gn,Rr,bn,Lr,pa,Kn,z,cn],Su=G(()=>Di.some(c=>c.value.trim().length>0)),$r=k({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Fi=k(null),Bi=k(!1),Ui=k(!1),ma=k(typeof window<"u"?((Dp=window.visualViewport)==null?void 0:Dp.height)??window.innerHeight:0),zi=k(typeof window<"u"?((Fp=window.visualViewport)==null?void 0:Fp.offsetTop)??0:0),Ms=k(typeof window<"u"?window.innerHeight:0);let Ao=null,Hi=!1,Me=!1,Et=!1,sr=0;const Nr=G(()=>{const c=gt.params.threadId;return typeof c=="string"?c:""}),dn=G(()=>gt.name==="home"),Ba=G(()=>gt.name==="skills"),Rs=G(()=>gt.name==="automations"),$h=G(()=>{const c=gt.query.automationId;return typeof c=="string"?c:""}),mb=G(()=>{var c;return Rs.value?f("Automations"):Ba.value?f("Skills"):dn.value?f("Start new thread"):((c=le.value)==null?void 0:c.title)??f("Choose a thread")}),gb=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",vb=G(()=>{var h,b;return(((b=(h=le.value)==null?void 0:h.title)==null?void 0:b.trim())??"")||gb}),Ua=G(()=>Xe.value.filter(c=>{const h=q0(c.messageType,c.role);return h==="worked"?!0:!(h==="turnActivity.live"||h==="turnError.live"||h==="agentReasoning.live")})),ad=k([]);tt(()=>[Ua.value,oe.value],([c,h])=>{h||(ad.value=c)},{immediate:!0});const yb=G(()=>oe.value&&ad.value.length>0?ad.value:Ua.value),Nh=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),sd=k(null);function wb(c,h,b){const U=typeof h.turnIndex=="number"?h.turnIndex:-1;return U<0?!1:c.some((Q,be)=>be>b&&typeof Q.turnIndex=="number"&&Q.turnIndex>=U&&Nh.has(Q.messageType??""))}function bb(c,h){return c.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=h&&Nh.has(b.messageType??""))}const Cu=G(()=>{const c=Ua.value,h=oe.value;for(let be=c.length-1;be>=0;be-=1){const Ue=c[be];if(Ue.messageType!=="plan"&&Ue.messageType!=="plan.live")continue;const Gt=Hg(Ue);if(!Gt||sd.value!==null&&Ue.id===sd.value)return null;const Q0=h?!0:wb(c,Ue,be);return{id:Ue.id,streaming:Ue.messageType==="plan.live",explanation:Gt.explanation,steps:Gt.steps,implemented:Q0}}const b=ne.value?Pe.value[ne.value]??null:null;if(!b)return null;const U=Hg(b);if(!U)return null;const Q=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?ye(ne.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:U.explanation,steps:U.steps,implemented:h?!0:Q>=0?bb(c,Q):!1}}),Tb=G(()=>we.value),Ls=G(()=>dn.value?"__new-thread__":ne.value),Oh=G(()=>Fr(Ls.value)),xu=G(()=>{const c=ie.value;return c.length>0?c[c.length-1]:null}),kb=G(()=>xu.value?Ur(xu.value.id):""),In=G(()=>{var c,h;return dn.value?mt.value.trim():((h=(c=le.value)==null?void 0:c.cwd)==null?void 0:h.trim())??""}),Al=G(()=>pr.value&&(dn.value&&In.value.length>0||gt.name==="thread"&&ne.value.length>0)),Sb=G(()=>Al.value&&Ut.value==="terminal"),_l=G(()=>!Ct.value||ma.value<=0||Ms.value<=0?!1:Ms.value-ma.value>120),Cb=G(()=>_l.value||Sb.value&&tn.value),Dh=G(()=>{var c,h;return((h=(c=le.value)==null?void 0:c.cwd)==null?void 0:h.trim())??mt.value.trim()}),Iu=G(()=>{var c;return!dn.value&&((c=le.value)==null?void 0:c.inProgress)===!0}),xb=G(()=>{const c=ne.value;return!!c&&ot.value.has(c)}),Fh=G(()=>{var c,h;return!dn.value&&((h=(c=le.value)==null?void 0:c.externalSession)==null?void 0:h.active)===!0}),id=G(()=>We.value||P.value||Iu.value||ie.value.length>0);function Bh(){Oa.value&&(Oa.value=!1,e_(!0))}function Ib(){Bh(),Tt.push({name:"skills",query:{tab:"plugins"}})}function Uh(){const c=ne.value;c&&bt(c)}function ld(c,h){const b=et(c).trim(),U=Or(b);return!b||!U?!1:h.some(Q=>{const be=et(Q).trim();return be!==b&&Or(be)===U})}function ud(c,h=""){const b=et(c).trim(),U=h.trim();if(U)return U;const Q=Or(b),be=[...K.value.order,...L.value.map(Ue=>{var Gt,br;return((br=(Gt=Ue.threads[0])==null?void 0:Gt.cwd)==null?void 0:br.trim())??""}).filter(Boolean)];return ld(b,be)?b:Q}function Ab(){const c=new Set(K.value.order),h=K.value.projectOrder.filter(b=>c.has(b));for(const b of K.value.order)h.includes(b)||h.push(b);return h}function Pl(c){const h=et(c).trim(),b=[...K.value.order,...L.value.map(U=>{var Q,be;return((be=(Q=U.threads[0])==null?void 0:Q.cwd)==null?void 0:be.trim())??""}).filter(Boolean)];return ld(h,b)?h:Or(h)}function zh(c){const h=et(c).trim();if(!h)return"";const b=[...K.value.order,...L.value.map(U=>{var Q,be;return((be=(Q=U.threads[0])==null?void 0:Q.cwd)==null?void 0:be.trim())??""}).filter(Boolean)];for(const U of K.value.order){const Q=et(U).trim();if(!Q)continue;const be=Or(Q),Ue=ld(Q,b)?Q:be;if(Q===h||Ue===h||be===h)return Q}return""}const cd=G(()=>{var U,Q;const c=[],h=new Set;for(const be of Ab()){const Ue=be.trim();!Ue||h.has(Ue)||(h.add(Ue),c.push({value:Ue,label:ud(Ue,K.value.labels[Ue])}))}for(const be of L.value){const Ue=((Q=(U=be.threads[0])==null?void 0:U.cwd)==null?void 0:Q.trim())??"";!Ue||h.has(Ue)||bc(Ue)||(h.add(Ue),c.push({value:Ue,label:ud(Ue,fe.value[be.projectName])}))}const b=mt.value.trim();return b&&!h.has(b)&&c.unshift({value:b,label:ud(b)}),c}),fi=G(()=>{const c=mt.value.trim();return c?xn.value[c]===!0:!1}),_b=G(()=>{var h,b;const c={};for(const U of L.value){const Q=qi(U.projectName,((b=(h=U.threads[0])==null?void 0:h.cwd)==null?void 0:b.trim())??"");c[U.projectName]=Q?xn.value[Q]===!0:!1}return c}),dd=G(()=>{const c=Wn.value.trim(),h=[...I.value];return c&&!h.some(b=>b.value===c)&&h.unshift({value:c,label:c}),h}),Hh=G(()=>{const c=Wn.value.trim();if(!c)return"";const h=dd.value.find(b=>b.value===c);return(h==null?void 0:h.label)??c}),Wh=G(()=>At.value.trim()),qh=G(()=>{const c=Es.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),Pb=G(()=>qh.value&&Wh.value.trim().length>0&&!cn.value),Gh=G(()=>{const c=j.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),Vh=G(()=>A.value.trim()?y.value==="create"?Gh.value:H.value.trim().length>0:!1),El=G(()=>{const c=et(at.value).trim();return c||At.value.trim()}),Eb=G(()=>Fa.value?"Creating…":"Create"),Mb=G(()=>Z.value?y.value==="clone"?f("Cloning…"):f("Creating…"):y.value==="clone"?f("Clone repository"):f("Create project")),Rb=G(()=>{const c=At.value.trim(),h=St.value.trim();return!!(c&&h&&c!==h)}),Kh=G(()=>{const c=[];Rb.value&&c.push({key:`parent:${St.value}`,name:"..",path:St.value,kind:"parent"});for(const h of Lt.value)c.push({key:`directory:${h.path}`,name:h.name,path:h.path,kind:"directory"});return c}),fd=G(()=>{const c=jr.value.trim().toLowerCase();return c?Kh.value.filter(h=>h.kind==="parent"||h.name.toLowerCase().includes(c)):Kh.value}),Wi=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Lb=G(()=>f(N[ui.value].label)),jb=G(()=>{const c=N[ui.value],h=Math.max(0,Ms.value-ma.value-zi.value);return{"--chat-column-max":c.columnMax,"--chat-card-max":c.cardMax,"--visual-viewport-height":ma.value>0?`${ma.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,zi.value)}px`,"--virtual-keyboard-inset":`${h}px`}}),$b=G(()=>{if(!$r.value.configured)return f("Not configured");const c=$r.value.active?f("Online"):f("Configured (offline)"),h=$r.value.allowAllUsers?f("allow all users"):`${$r.value.allowedUsers} ${f("allowed user(s)")}`,b=`${$r.value.mappedChats} ${f("chat(s)")}, ${$r.value.mappedThreads} ${f("thread(s)")}, ${h}`,U=$r.value.lastError?`, ${f("error")}: ${$r.value.lastError}`:"";return`${c}, ${b}${U}`});ss(()=>{var c,h;document.addEventListener("pointerdown",fp),window.addEventListener("keydown",dp),document.addEventListener("visibilitychange",pp),window.addEventListener("pageshow",mp),window.addEventListener("focus",gp),window.addEventListener("resize",hi),(c=window.visualViewport)==null||c.addEventListener("resize",hi),(h=window.visualViewport)==null||h.addEventListener("scroll",hi),hi(),Nu(),Wi==null||Wi.addEventListener("change",Nu),hr=he(b=>{Cr.value&&Cr.value.refreshFromNotification(b)}),ko=he(b=>{b==="remoteControl/status/changed"&&Ts({force:!0})}),G0(),b0(),Sl(),Db(),Ns(),_o(),Jh(),hd(),Id(),zT(),ws()}),tt(Di,(c,h)=>{c.forEach((b,U)=>{if(b===h[U])return;const Q=b.trim();Q&&tr(Q)})}),tt(kn,c=>{if(Nn&&(Nn.disconnect(),Nn=null),typeof ResizeObserver<"u"){Nn=new ResizeObserver(Pn),c&&Nn.observe(c);return}Pn()},{immediate:!0}),pu(()=>{var c,h;document.removeEventListener("pointerdown",fp),window.removeEventListener("keydown",dp),document.removeEventListener("visibilitychange",pp),window.removeEventListener("pageshow",mp),window.removeEventListener("focus",gp),window.removeEventListener("resize",hi),(c=window.visualViewport)==null||c.removeEventListener("resize",hi),(h=window.visualViewport)==null||h.removeEventListener("scroll",hi),Wi==null||Wi.removeEventListener("change",Nu),Nn&&(Nn.disconnect(),Nn=null),Ao!==null&&(window.clearInterval(Ao),Ao=null),rn&&(clearTimeout(rn),rn=null),qr(),Sr(),hr&&(hr(),hr=null),ko&&(ko(),ko=null),On&&(clearTimeout(On),On=null)});function hi(){var c,h;typeof window>"u"||(Ms.value=Math.max(Ms.value,window.innerHeight),ma.value=((c=window.visualViewport)==null?void 0:c.height)??window.innerHeight,zi.value=((h=window.visualViewport)==null?void 0:h.offsetTop)??0)}tt(Jt,c=>{const h=c.trim();if(rn&&(clearTimeout(rn),rn=null),!h){na.value=null;return}rn=setTimeout(()=>{cI(h,1e3).then(b=>{Jt.value.trim()===h&&(na.value=b.threadIds)}).catch(()=>{Jt.value.trim()===h&&(na.value=null)})},220)}),tt(_l,c=>{c||(tn.value=!1)}),tt(Vn,()=>{if(typeof window>"u")return;if(!Vn.value.some(h=>h.quotaStatus==="loading")){Ao!==null&&(window.clearInterval(Ao),Ao=null);return}Ao===null&&(Ao=window.setInterval(()=>{Hi||(Hi=!0,Ml({silent:!0}).finally(()=>{Hi=!1}))},1500))},{deep:!0}),tt(Je,()=>{Yh().then(c=>{c&&re({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function Yh(){if(!Me||Et||wr.value!=="codex"||Vn.value.length>0||Je.value.length===0)return!1;Et=!0;const c=JSON.stringify(Vn.value.map(b=>b.accountId).sort());try{const b=await pg();Vn.value=b.accounts}catch{await Ml({silent:!0})}const h=JSON.stringify(Vn.value.map(b=>b.accountId).sort());return c!==h}function Nb(){ae({force:!0})}function Ob(c){c&&qe(c,{silent:!0,force:!0})}async function hd(){try{$r.value=await qA()}catch(c){const h=c instanceof Error?c.message:"Failed to load Telegram status";$r.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:h}}}async function Jh(){try{const c=await WA();Oi.value=c.botToken,di.value=c.allowedUserIds.map(h=>String(h)).join(`
94
- `),pa.value=""}catch(c){pa.value=c instanceof Error?c.message:"Failed to load Telegram configuration"}}async function Db(){const c=await ZA();Oa.value=c.dismissed!==!0}function Fb(c){const h=c.split(/[\n,]/).map(Q=>Q.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=h.includes("*"),U=Array.from(new Set(h.filter(Q=>/^-?\d+$/.test(Q)).map(Q=>Number.parseInt(Q,10))));return b?["*",...U]:U}async function Bb(){const c=Oi.value.trim(),h=Fb(di.value);if(!c){pa.value=f("Telegram bot token is required.");return}if(h.length===0){pa.value=f("At least one allowed Telegram user ID or * is required.");return}Il.value=!0,pa.value="";try{await HA(c,h),di.value=h.map(b=>String(b)).join(`
95
- `),await Promise.all([Jh(),hd()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){pa.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),hd()}finally{Il.value=!1}}const Au=k(""),Ub=G(()=>Au.value||ne.value);tt(ne,()=>{Au.value=""});function zb(){return new Promise(c=>{let h=!1;const b=()=>{h||(h=!0,c())};requestAnimationFrame(()=>setTimeout(b,0)),setTimeout(b,80)})}let pd=0;function Hb(c){if(!c)return;if(gt.name==="thread"&&Nr.value===c){pd+=1,Au.value="";return}Au.value=c;const h=pd+=1;zb().then(()=>{h===pd&&Tt.push({name:"thread",params:{threadId:c}})}),Ct.value&&un(!0)}function Wb(c){gt.name==="automations"&&$h.value!==c&&Tt.replace({name:"automations",query:c?{automationId:c}:{}})}async function qb(c){var h;xt.value&&(un(!1),await Mt()),(h=$n.value)==null||h.openAutomationEditorFromPanel(c)}async function Gb(){var c;xt.value&&(un(!1),await Mt()),(c=$n.value)==null||c.openAutomationCreatorFromPanel()}function Vb(){var c;gt.name==="automations"&&((c=pn.value)==null||c.loadAutomations())}async function Kb(c){c&&ne.value===c&&await Mp()}function Yb(c){return c.length>8?c.slice(-8):c}function Qh(c){const h=[c.planType||f("unknown")];return c.authMode&&h.unshift(c.authMode),h.join(" · ")}function Jb(c){if(!c)return!1;const h=c.toLowerCase();return h.includes("payment required")||/\b402\b/.test(h)}function _u(c){return c.unavailableReason==="payment_required"||Jb(c.quotaError)}function Qb(c){return ca.value||So.value||da.value||Dn.value||$a.value.length>0||c.isActive&&$a.value!==c.storageId&&id.value}function md(c){return Zr.value===c.storageId}function Xb(c){return fa.value===c.storageId||md(c)}function Zb(c){return _u(c)?f("Unavailable"):c.isActive?f("Active"):So.value?f("Switching…"):f("Switch")}function eT(c){return $a.value===c.storageId?f("Removing…"):md(c)?f("Click again to remove"):f("Remove")}function tT(c){fa.value=c}function nT(c){fa.value===c&&(fa.value=""),$a.value!==c&&Zr.value===c&&(Zr.value="")}function rT(c){const h=c.quotaSnapshot;if(!h)return null;const b=[h==null?void 0:h.primary,h==null?void 0:h.secondary].filter(be=>be!==null),U=b.find(be=>be.windowMinutes===7*24*60);if(U)return U;const Q=b.filter(be=>typeof be.windowMinutes=="number"&&be.windowMinutes>=7*24*60).sort((be,Ue)=>(be.windowMinutes??0)-(Ue.windowMinutes??0))[0]??null;return Q||(h.secondary??null)}function oT(c){if(typeof c!="number"||!Number.isFinite(c))return"";const h=new Date(c*1e3);return`${h.getMonth()+1}月${h.getDate()}日`}function Xh(c){var be,Ue;if(_u(c))return c.quotaError||f("402 Payment Required");const h=c.quotaSnapshot,b=rT(c),U=(h==null?void 0:h.primary)??(h==null?void 0:h.secondary)??null,Q=b??U;if(Q){const Gt=Math.max(0,Math.min(100,100-Math.round(Q.usedPercent))),br=oT(Q.resetsAt);return br?`${Gt}% ${f("weekly remaining")} · ${br}`:`${Gt}% ${f("weekly remaining")}`}return(be=h==null?void 0:h.credits)!=null&&be.unlimited?f("Unlimited credits"):(Ue=h==null?void 0:h.credits)!=null&&Ue.hasCredits&&h.credits.balance?`${h.credits.balance} ${f("credits")}`:c.quotaStatus==="loading"?f("Loading quota…"):c.quotaStatus==="error"?c.quotaError||f("Quota unavailable"):c.quotaStatus==="ready"||c.quotaStatus==="idle"?f("Quota unavailable"):f("Fetching account details…")}function aT(c){return[c.email||f("Account"),Qh(c),_u(c)?f("Unavailable account"):null,Xh(c),`${f("Workspace")} ${c.accountId}`].filter(Boolean).join(`
96
- `)}async function Ml(c={}){try{const h=await v_();Vn.value=h.accounts,h.accounts.some(b=>b.storageId===fa.value)||(fa.value=""),h.accounts.some(b=>b.storageId===Zr.value)||(Zr.value="")}catch(h){if(c.silent===!0)return;bn.value=h instanceof Error?h.message:f("Failed to load accounts")}}async function sT(){if(!(ca.value||So.value||da.value||Dn.value)){bn.value="",fa.value="",Zr.value="",ca.value=!0;try{const c=await pg();Vn.value=c.accounts,Sr(),mo(),re({includeSelectedThreadMessages:!0})}catch(c){bn.value=c instanceof Error?c.message:f("Failed to refresh accounts")}finally{ca.value=!1}}}async function iT(c){if(!(So.value||ca.value||da.value||Dn.value)){if(id.value){bn.value=f("Finish the current turn and pending requests before switching accounts.");return}bn.value="",fa.value="",Zr.value="",So.value=!0;try{const h=await b_(c);Vn.value=Vn.value.map(b=>b.storageId===c?h:{...b,isActive:!1}),Sr(),mo(),re({includeSelectedThreadMessages:!0}),Ml({silent:!0})}catch(h){bn.value=h instanceof Error?h.message:f("Failed to switch account")}finally{So.value=!1}}}async function lT(){var c;if(!(ca.value||So.value||da.value||Dn.value)){bn.value="",ja.value="",da.value=!0;try{const h=await y_();li.value=h,Ni.value=!0,window.open(h,"_blank","noopener,noreferrer"),await Mt(),(c=xl.value)==null||c.focus()}catch(h){bn.value=h instanceof Error?h.message:f("Failed to start Codex login")}finally{da.value=!1}}}function gd(){Dn.value||(Ni.value=!1,ja.value="")}async function uT(){const c=ja.value.trim();c&&await cT(c)}async function cT(c){if(!(Dn.value||c.length===0)){bn.value="",Dn.value=!0;try{const h=await w_(c);Vn.value=h.accounts,li.value="",ja.value="",Ni.value=!1,Sr(),mo(),re({includeSelectedThreadMessages:!0})}catch(h){bn.value=h instanceof Error?h.message:f("Failed to complete Codex login")}finally{Dn.value=!1}}}async function dT(c){if(ca.value||So.value||da.value||Dn.value||$a.value.length>0)return;const h=Vn.value.find(U=>U.storageId===c)??null;if(!h)return;if(Zr.value!==c){Zr.value=c;return}if(h.isActive&&id.value){bn.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=h.isActive;bn.value="",Zr.value="",$a.value=c;try{const U=await T_(c);Vn.value=U.accounts,Sr(),mo(),b&&re({includeSelectedThreadMessages:!0}),Ml({silent:!0})}catch(U){bn.value=U instanceof Error?U.message:f("Failed to remove account")}finally{$a.value=""}}function Zh(c){dt(c)}function fT(c){re({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function ep(c){const h=await de(c);h&&(dn.value?await Tt.replace({name:"thread",params:{threadId:h}}):await Tt.push({name:"thread",params:{threadId:h}}),Ct.value&&un(!0))}function tp(c){const h=c.trim().replace(/\\/gu,"/");return h?h.includes("/.codex/worktrees/")||h.includes("/.git/worktrees/"):!1}function qi(c,h=""){var be,Ue,Gt;const b=L.value.find(br=>br.projectName===c);if(!b)return zh(c)||h.trim();const U=b.threads.find(br=>!tp(br.cwd));return(((be=U==null?void 0:U.cwd)==null?void 0:be.trim())??((Gt=(Ue=b.threads[0])==null?void 0:Ue.cwd)==null?void 0:Gt.trim())??"")||zh(c)||h.trim()}function hT(c){var U,Q;const h=L.value.find(be=>be.projectName===c),b=qi(c,((Q=(U=h==null?void 0:h.threads[0])==null?void 0:U.cwd)==null?void 0:Q.trim())??"");b&&(mt.value=b),Ct.value&&un(!0),!dn.value&&Tt.push({name:"home"})}function pT(c){var b;let h="";for(const U of L.value){const Q=U.threads.find(be=>be.id===c);if((b=Q==null?void 0:Q.cwd)!=null&&b.trim()){h=Q.cwd.trim();break}}!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}function Pu(c){var b,U;const h=L.value.find(Q=>Q.projectName===c);return qi(c,((U=(b=h==null?void 0:h.threads[0])==null?void 0:b.cwd)==null?void 0:U.trim())??"")}const np=G(()=>Object.fromEntries(L.value.map(c=>[c.projectName,Pu(c.projectName).trim()]).filter(([,c])=>c.length>0)));function mT(c){return(fe.value[c]??c).trim()||c}function gT(c){return mT(c).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function vT(c){const h=Pu(c);!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}async function yT(c){const h=Pu(c);await ap(h)}async function wT(c){const h=bT(c);await ap(h)}function bT(c){var h;for(const b of L.value){const U=b.threads.find(Q=>Q.id===c);if((h=U==null?void 0:U.cwd)!=null&&h.trim())return U.cwd.trim()}return""}function rp(c){if(!Number.isFinite(c)||c<=0)return"0 B";const h=["B","KB","MB","GB"];let b=c,U=0;for(;b>=1024&&U<h.length-1;)b/=1024,U+=1;return`${b>=10||U===0?b.toFixed(0):b.toFixed(1)} ${h[U]}`}function TT(c,h){const b=URL.createObjectURL(c),U=document.createElement("a");U.href=b,U.download=h,document.body.appendChild(U),U.click(),document.body.removeChild(U),window.setTimeout(()=>URL.revokeObjectURL(b),3e4)}async function kT(c,h){const U={files:[new File([c],h,{type:c.type||"application/zip"})],title:h};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(U))))throw new Error("File sharing is not supported in this browser.");await navigator.share(U)}function op(){Te.value.phase!=="exporting"&&(Te.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function ST(){const{blob:c,fileName:h}=Te.value;!c||!h||(Te.value={...Te.value,error:""},TT(c,h))}async function CT(){const{blob:c,fileName:h}=Te.value;if(!(!c||!h))try{Te.value={...Te.value,error:""},await kT(c,h)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const U=b instanceof Error?b.message:"",Q=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(U);Te.value={...Te.value,error:Q?f("This browser blocked sharing the ZIP. Use Download instead."):U||f("Failed to share project. Use Download instead.")}}}async function ap(c){if(!(!c||typeof document>"u")){Te.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:h,fileName:b}=await $_(c,({loaded:U,total:Q})=>{Te.value={...Te.value,phase:"exporting",loaded:U,total:Q}});Te.value={phase:"ready",loaded:h.size,total:h.size,blob:h,fileName:b,error:""}}catch(h){if(Te.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},h instanceof DOMException&&h.name==="AbortError")return;const b=h instanceof Error?h.message:"Failed to export project.";window.alert(b)}}}async function xT(c){const h=Pu(c);if(!h||typeof window>"u"||(await Mu(h),xn.value[h]!==!0))return;const b=`${gT(c)}-`,U=window.prompt("New worktree folder name",b);if(U===null)return;const Q=U.trim();if(Q){if(Q.includes("/")||Q.includes("\\")||Q==="."||Q===".."){window.alert("Worktree name must be a single folder name.");return}try{const be=await x_(h,Q),Ue=await Wu(be.cwd,{createIfMissing:!1,label:""});if(!Ue)return;mt.value=Ue,En.value="local",po(Pl(Ue)),await Ns(),await _o(),Ct.value&&un(!0),dn.value||await Tt.push({name:"home"})}catch(be){const Ue=be instanceof Error?be.message:"Failed to create worktree.";window.alert(Ue)}}}function IT(){var b,U,Q;const c=le.value;if(!c)return"";const h=((b=c.projectName)==null?void 0:b.trim())??"";return h?qi(h,((Q=c.cwd)==null?void 0:Q.trim())??""):((U=c.cwd)==null?void 0:U.trim())??""}function Eu(){const c=IT();c&&(mt.value=c),En.value="local",Ct.value&&un(!0),!dn.value&&Tt.push({name:"home"})}function AT(){mt.value="",En.value="local",Ct.value&&un(!0),!dn.value&&Tt.push({name:"home"})}async function Mu(c){const h=c.trim();if(!h||Object.prototype.hasOwnProperty.call(xn.value,h))return;const b=Aa.get(h);if(b){const be=await b;Object.prototype.hasOwnProperty.call(xn.value,h)||(xn.value={...xn.value,[h]:be});return}const U=__(h).then(be=>be.isGitRepo).catch(()=>!1).finally(()=>{Aa.delete(h)});Aa.set(h,U);const Q=await U;Object.prototype.hasOwnProperty.call(xn.value,h)||(xn.value={...xn.value,[h]:Q})}function _T(c){us(c.projectName,c.displayName)}function PT(c){ke(c.threadId,c.title)}async function ET(c){await Ca(c),await Ns(),_o()}function MT(c){Wo(c.projectName,c.toIndex)}function RT(c){var U,Q;const h=L.value.find(be=>be.projectName===c),b=qi(c,((Q=(U=h==null?void 0:h.threads[0])==null?void 0:U.cwd)==null?void 0:Q.trim())??"");Mu(b)}function sp(c){LT(c)}async function LT(c){var U;const h=await Ho(c),b=((U=c.followUpMessageText)==null?void 0:U.trim())??"";if(!(!h||!b||dn.value))try{await vt(b,[],[],"steer",[])}catch{}}async function jT(c){const h=await Be(c.threadId,c.turnIndex);h&&(await Tt.push({name:"thread",params:{threadId:h}}),ne.value!==h&&await Ke(h),Ct.value&&un(!0))}const js=k(!1),ip=k(null),$T=G(()=>en()?"⌘/":"Ctrl+/"),NT=G(()=>`${f("Command palette")} · ${$T.value}`);let vd=null;function OT(){const c=document.activeElement;vd=c instanceof HTMLElement?c:null}function lp(){const c=vd;vd=null,Mt(()=>{var h;if(c!=null&&c.isConnected){c.focus();return}(h=ip.value)==null||h.focus()})}function up(){OT(),Gi.value=!1,js.value=!0}function DT(){if(js.value){Ru();return}up()}const Gi=k(!1);function FT(){js.value=!1,Gi.value=!0}function cp(){Gi.value&&(Gi.value=!1,lp())}function Ru(){js.value&&(js.value=!1,lp())}const BT=G(()=>{const c=!dn.value&&!Ba.value&&!Rs.value&&ne.value.trim().length>0,h=en()?"⌘":"Ctrl+";return MM.filter(b=>!(b.requiresThread&&!c||b.id==="thread.interrupt"&&!Iu.value||b.id==="thread.implement-plan"&&!Cu.value||b.id==="thread.copy-last-code-block"&&!rF(Ua.value)||b.group==="panel"&&!Al.value)).map(b=>b.shortcut?{...b,shortcut:b.shortcut.replace("Mod+",h)}:b)});function UT(c){var b,U;Ru();const h=ne.value.trim();switch(c){case"thread.new":Eu();break;case"thread.rename":h&&((U=$n.value)==null||U.openRenameThreadDialog(h,((b=le.value)==null?void 0:b.title)??""));break;case"thread.archive":h&&Zh(h);break;case"thread.fork":h&&ep(h);break;case"thread.copy-markdown":Mp();break;case"thread.copy-last-code-block":C0();break;case"thread.compact":Uh();break;case"thread.interrupt":_p();break;case"thread.implement-plan":Ep();break;case"panel.git":zt("git");break;case"panel.files":zt("files");break;case"panel.terminal":Yo();break;case"panel.toggle":yo();break;case"panel.close":vn();break;case"view.toggle-sidebar":un(!xt.value);break;case"view.search-threads":xt.value&&un(!1),Pr.value||ta();break;case"view.cycle-theme":jp();break;case"view.cycle-chat-width":$p();break;case"view.toggle-language":S(v.value==="zh-CN"?"en":"zh-CN");break;case"view.send-with-enter":Rp();break;case"view.in-progress-send-mode":Lp();break;case"view.shortcuts":FT();break;case"nav.skills":Tt.push({name:"skills"});break;case"nav.automations":Tt.push({name:"automations"});break;case"nav.recycle-bin":hp();break;case"nav.settings":on.value||ms();break}}function dp(c){if(c.defaultPrevented)return;if(c.key==="Escape"&&Gi.value){cp();return}if(c.key==="Escape"&&js.value){Ru();return}if(c.key==="Escape"&&on.value){on.value=!1;return}if(!c.ctrlKey&&!c.metaKey||c.shiftKey||c.altKey)return;const h=c.key.toLowerCase();if(h==="/"){c.preventDefault(),DT();return}if(!js.value){if(h==="b"){if(!(en()?c.metaKey&&!c.ctrlKey:c.ctrlKey&&!c.metaKey))return;c.preventDefault(),un(!xt.value);return}if(h==="j"&&gt.name==="thread"&&ne.value){c.preventDefault(),Yo();return}h==="j"&&dn.value&&In.value&&(c.preventDefault(),Yo())}}async function zT(){try{const c=await fI();pr.value=c.available,!c.available&&Ut.value==="terminal"&&(Ut.value="git",Xo())}catch{pr.value=!1,Ut.value==="terminal"&&(Ut.value="git")}}function fp(c){var b,U;const h=c.target;if(h instanceof Node){if(Ko.value){const Q=h instanceof Element?h:h.parentElement;Q!=null&&Q.closest(".thread-terminal-panel")||Xo()}on.value&&((b=hs.value)!=null&&b.containsTarget(h)||(U=Ea.value)!=null&&U.contains(h)||(wn=Date.now(),on.value=!1))}}function HT(c){var b,U;if(!on.value)return;const h=c.target;h instanceof Node&&((b=hs.value)!=null&&b.containsTarget(h)||(U=Ea.value)!=null&&U.contains(h)||(wn=Date.now(),on.value=!1))}function hp(){var c;(c=$n.value)==null||c.openRecycleBin()}function pp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Fi.value=Date.now(),Bi.value=!1;return}yd()}}function mp(c){c.persisted&&yd()}function gp(){gt.name==="home"&&(Ns(),_o()),yd()}function yd(){typeof window>"u"||typeof document>"u"||UD(document.visibilityState,Fi.value,Bi.value,Date.now())&&(Bi.value=!0,Fi.value=null,WT())}async function WT(){if(!Ui.value){Ui.value=!0;try{await re({includeSelectedThreadMessages:!1}),await _d()}finally{Ui.value=!1}}}function vp(c){const h=c.text;Lu();const b=Zo.value,U=c.mode==="queue"&&b&&b.threadId===ne.value?b.queueIndex:void 0;if(Zo.value=null,dn.value){V0(h,c.imageUrls,c.skills,c.fileAttachments);return}vt(h,c.imageUrls,c.skills,c.mode,c.fileAttachments,U)}function qT(c){const h=fo.value.findIndex(be=>be.id===c),b=h>=0?fo.value[h]:void 0,U=nr.value;if(!b||!U||U.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Zo.value=ne.value?{threadId:ne.value,queueIndex:h}:null;const Q={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(be=>({...be})),skills:b.skills.map(be=>({...be}))};U.hydrateDraft(Q),er(c)}function Lu(){if(!Ct.value||dn.value)return;const c=()=>{var h;(h=Sn.value)==null||h.jumpToLatest()};c(),Mt(()=>{c(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{c(),window.requestAnimationFrame(c)})})}function GT(c){mt.value=c.trim(),Kn.value=""}function VT(c){Wn.value=c.trim()}function $s(c){const h=In.value.trim();return!c||h!==c?!1:gt.name==="thread"||gt.name==="home"&&fi.value}function yp(){ra+=1,Gr+=1,yn+=1,bo+=1,Xr.value=[],vr.value=null,la.value=null,C.value=null,M.value=null,x.value=!1,X.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},qt.value=[],yr.value={},an.value="",Rr.value="",Ra.value={},ua.value="",Ss.value="",Gn.value="",Cs.value=!1}function wp(c){const h=c.trim();if(!h){Qe.value={addedLineCount:0,removedLineCount:0};return}const b=++bo;G_(h,"unstaged").then(U=>{b!==bo||!$s(h)||(Qe.value={addedLineCount:U.addedLineCount,removedLineCount:U.removedLineCount})}).catch(()=>{b!==bo||!$s(h)||(Qe.value={addedLineCount:0,removedLineCount:0})})}async function Rl(c){var U,Q,be;const h=c.trim();if(!h){yp();return}const b=++ra;Cs.value=!0,Gn.value="";try{const Ue=await A_(h);if(b!==ra||!$s(h))return;Xr.value=Ue.options,vr.value=Ue.currentBranch,la.value=Ue.headSha,C.value=Ue.headSubject,M.value=Ue.headDate,x.value=Ue.detached,X.value=Ue.dirty,qt.value=Ue.changedFiles,wp(h);const Gt=((U=Ue.currentBranch)==null?void 0:U.trim())||((be=(Q=Ue.options[0])==null?void 0:Q.value)==null?void 0:be.trim())||"";Gt&&bp({branch:Gt,includeResetHistory:!0})}catch{if(b!==ra||!$s(h))return;Xr.value=[],vr.value=null,la.value=null,C.value=null,M.value=null,x.value=!1,X.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},qt.value=[]}finally{b===ra&&(Cs.value=!1)}}function KT(c){vr.value=c.currentBranch,la.value=c.headSha,C.value=c.headSubject,M.value=c.headDate,x.value=c.detached,X.value=c.dirty,qt.value=c.changedFiles,wp(In.value)}function YT(c){if(La.value)return;const h=c.trim();if(!h||h===(vr.value??""))return;const b=In.value.trim();b&&(La.value=!0,Gn.value="",P_(b,h).then(U=>(vr.value=U||h,la.value=null,C.value=null,M.value=null,x.value=!1,or.value=!1,Rl(b))).catch(U=>{const Q=U instanceof Error?U.message:"Failed to switch branch";Rl(b).finally(()=>{Gn.value=Q})}).finally(()=>{La.value=!1}))}function JT(c){if(La.value)return;const h=c.branch.trim(),b=c.sha.trim(),U=In.value.trim();!h||!b||!U||(La.value=!0,Gn.value="",R_(U,h,b).then(Q=>(KT(Q),or.value=!1,Rl(U))).catch(Q=>{const be=Q instanceof Error?Q.message:"Failed to reset branch to commit";Rl(U).finally(()=>{Gn.value=be})}).finally(()=>{La.value=!1}))}function bp(c){const h=(typeof c=="string"?c:c.branch).trim(),b=typeof c=="string"?!0:c.includeResetHistory!==!1,U=In.value.trim(),Q=ed(h,b);if(!h||!U||an.value===Q||(Rr.value="",yr.value[Q]))return;const be=++Gr;an.value=Q,E_(U,h,{includeResetHistory:b}).then(Ue=>{be!==Gr||!$s(U)||(yr.value={...yr.value,[Q]:Ue})}).catch(Ue=>{be!==Gr||!$s(U)||(Rr.value=Ue instanceof Error?Ue.message:"Failed to load branch commits")}).finally(()=>{be===Gr&&an.value===Q&&(an.value="")})}function QT(c){const h=c.trim(),b=In.value.trim();if(!h||!b||ua.value===h||(Ss.value="",Ra.value[h]))return;const U=++yn;ua.value=h,M_(b,h).then(Q=>{U!==yn||!$s(b)||(Ra.value={...Ra.value,[h]:Q})}).catch(Q=>{U!==yn||!$s(b)||(Ss.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{U===yn&&ua.value===h&&(ua.value="")})}function XT(c){const h=c.path.trim(),b=c.sha.trim();!h||!b||(gr.value=h,Mr.value=b,or.value=!0)}function ZT(){gr.value="",Mr.value="",or.value=!or.value}function e0(){!gr.value&&!Mr.value||(gr.value="",Mr.value="",or.value=!1)}async function t0(){const c=await $u();c&&(await _o(),A.value=c,j.value=To.value.trim()||"New Project (1)",H.value="",z.value="",y.value="create",p.value=!0,Mt(()=>{var h;return(h=me.value)==null?void 0:h.focus()}))}function ju(){Z.value||(p.value=!1,z.value="")}let wd=!1,bd=!1;function n0(){wd=!0}function r0(){wd&&(wd=!1,Vi())}function o0(){bd=!0}function a0(){bd&&(bd=!1,ju())}async function s0(){const c=A.value.trim(),h=j.value.trim();if(!Gh.value)throw new Error("Enter a single project folder name.");const b=Cp(Sp(c,h));return b?Wu(b,{createIfMissing:!0,label:""}):""}async function i0(){const c=A.value.trim(),h=H.value.trim();return h?F_(h,c):""}async function Td(){if(!(!Vh.value||Z.value)){z.value="",Z.value=!0;try{const c=y.value==="clone"?await i0():await s0();if(!c)return;mt.value=c,po(Pl(c)),await Ns(),await _o(),p.value=!1}catch(c){z.value=c instanceof Error?c.message:"Failed to create or clone project."}finally{Z.value=!1}}}function l0(){u0(ge.value)}function u0(c){V.value||!c||(c.value="",c.click())}async function c0(c,h,b){V.value=!0;try{const U=await $u();if(!U)return;const Q=await h(U);if(!Q.path)return;mt.value=Q.path,po(Pl(Q.path)),await Ns(),await re({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await _o()}catch(U){const Q=U instanceof Error?U.message:b;window.alert(Q)}finally{V.value=!1,c&&(c.value="")}}async function d0(c){var U;const h=c.target instanceof HTMLInputElement?c.target:null,b=((U=h==null?void 0:h.files)==null?void 0:U[0])??null;!b||V.value||await c0(h,Q=>N_(b,Q),"Failed to import project.")}async function f0(){const c=mt.value.trim()||await $u();c&&(Io.value=!1,ze.value=!0,jr.value="",await Os(c),cn.value||Mt(()=>{var h;return(h=nt.value)==null?void 0:h.focus()}))}function Vi(){sr+=1,ze.value=!1,gn.value=!1,cn.value="",jr.value="",at.value="",Ll()}async function h0(c){!c||gn.value||(jr.value="",await Os(c))}function p0(){const c=At.value.trim();!ze.value||!c||Os(c)}function m0(){const c=El.value;!ze.value||!c||gn.value||Os(c)}function g0(){if(!ze.value||gn.value||Yn.value)return;const c=El.value,h=At.value.trim();!c||c===h||Os(c)}function v0(){const c=El.value,h=At.value.trim();if(c){if(c!==h){Os(c);return}kd(c)}}async function kd(c=El.value){const h=et(c).trim();if(h){cn.value="",Yn.value=!0;try{const b=await Wu(h,{createIfMissing:!1,label:""});if(!b){cn.value="Failed to open the selected folder.";return}mt.value=b,po(Pl(b)),await Ns(),await re({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await _o(),Vi()}catch(b){cn.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{Yn.value=!1}}}async function y0(){if(Kn.value="",Io.value){Ll();return}if(!ze.value){const c=mt.value.trim()||await $u();if(!c||(ze.value=!0,jr.value="",await Os(c),cn.value))return}cn.value||(Es.value=To.value,Io.value=!0,Mt(()=>{var c;return(c=yu.value)==null?void 0:c.focus()}))}function Ll(){Kn.value="",Es.value="",Io.value=!1}async function Tp(){const c=Es.value.trim();if(!c)return;if(Kn.value="",cn.value){Kn.value="Reload the current folder before creating a new one.";return}Fa.value=!0;const h=Wh.value.trim(),b=Cp(Sp(h,c));if(!b){Kn.value="Unable to determine where the new folder should be created.",Fa.value=!1;return}if(!qh.value){Kn.value="Enter a single folder name.",Fa.value=!1;return}try{const U=await D_(b);if(!U){Kn.value="Failed to create the folder.";return}Kn.value="",jr.value="",await Os(U),Ll()}catch(U){Kn.value=U instanceof Error?U.message:"Failed to create folder."}finally{Fa.value=!1}}async function w0(){var h;if(typeof window>"u")return!1;const c=((h=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:h.trim())??"";if(!c)return!1;try{const b=await Wu(c,{createIfMissing:!1,label:""});if(!b)return!1;mt.value=b,po(Pl(b)),await Tt.replace({name:"home"}),await Ns();const U=new URL(window.location.href);return U.searchParams.delete("openProjectPath"),window.history.replaceState({},"",U.toString()),!0}catch{return!1}}async function $u(){const c=kp();if(c)return c;try{const h=await mg();if(h)return ps.value=h,h}catch{}return""}async function _o(){const c=kp();if(!c){To.value="New Project (1)";return}try{const h=await U_(c);To.value=h.name||"New Project (1)"}catch{To.value="New Project (1)"}}function kp(){var b,U;const c=mt.value.trim();if(c)return ul(c);const h=((U=(b=cd.value[0])==null?void 0:b.value)==null?void 0:U.trim())??"";return h?ul(h):ps.value.trim()}async function b0(){try{ps.value=await mg()}catch{ps.value=""}}async function Ns(){try{const c=await nl();K.value={order:[...c.order],labels:{...c.labels},projectOrder:[...c.projectOrder]}}catch{K.value={order:[],labels:{},projectOrder:[]}}}async function Os(c){const h=++sr,b=et(c).trim();at.value=b,At.value=b,cn.value="",gn.value=!0;try{const U=await O_(c,{showHidden:ku.value});if(h!==sr)return;at.value=U.path,At.value=U.path,St.value=U.parentPath,Lt.value=U.entries}catch(U){if(h!==sr)return;cn.value=U instanceof Error?U.message:"Failed to load local folders.",St.value=ul(At.value),Lt.value=[],Ll()}finally{h===sr&&(gn.value=!1)}}function Sp(c,h){const b=et(c).trim(),U=et(h).trim().replace(/^[\\/]+/u,"");if(!b||!U)return"";const Q=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${Q}${U}`;if(/^\/+$/u.test(b))return`/${U}`;const be=b.replace(/[\\/]+$/u,"");return be?`${be}${Q}${U}`:""}function Cp(c){const h=et(c).trim();if(!h)return"";const b=h.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,Q,be,Ue=""]=b,Gt=Sd(Ue.split(/[\\/]+/u));return Gt.length>0?`\\\\${Q}\\${be}\\${Gt.join("\\")}`:`\\\\${Q}\\${be}`}const U=h.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(U){const[,Q,be=""]=U,Ue=h.includes("\\")&&!h.includes("/")?"\\":"/",Gt=Sd(be.split(/[\\/]+/u));return Gt.length>0?`${Q}${Ue}${Gt.join(Ue)}`:`${Q}${Ue}`}if(h.startsWith("/")){const Q=Sd(h.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return h}function Sd(c){const h=[];for(const b of c){const U=b.trim();if(!(!U||U===".")){if(U===".."){h.length>0&&h.pop();continue}h.push(U)}}return h}function T0(c){ka(c.draggedId,c.targetId)}function xp(c){const h=Ls.value,b=Fr(h);ls(h,c),b&&b!==c&&(Br(h,b,c),Uo(h))}function Ip(c){zo(c)}function Ap(c){ri(c)}function _p(){Bt()}const jl=k("");let Cd=null;tt(Bo,c=>{var h;c&&(c.text&&((h=nr.value)==null||h.hydrateDraft({text:c.text,imageUrls:c.imageUrls,fileAttachments:c.fileAttachments,skills:c.skills})),jl.value=c.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Cd&&clearTimeout(Cd),Cd=setTimeout(()=>{jl.value=""},6e3),Yt(Ls.value))});function Pp(c){var b,U;const h=ne.value.trim();switch(c){case"compact":h&&bt(h);break;case"review":if(!h)return;gr.value="",Mr.value="",or.value=!0;break;case"rename":h&&((U=$n.value)==null||U.openRenameThreadDialog(h,((b=le.value)==null?void 0:b.title)??""));break;case"archive":h&&dt(h);break;case"fork":h&&de(h);break;case"new":Eu();break;case"skills":Ba.value||Tt.push({name:"skills"});break}}function k0(c){const h=c.turnId.trim();if(h.length>0){const b=[...Ua.value].reverse().find(U=>{var Q;return Zs(U)&&(((Q=U.turnId)==null?void 0:Q.trim())??"")===h&&U.text.trim().length>0});b!=null&&b.text&&nr.value&&nr.value.appendTextToDraft(b.text)}xa(c.turnId)}async function S0(c){const h=c.turnId.trim();!ne.value||!h||c.text.trim().length===0||(await xa(h),!Ua.value.some(b=>{var U;return(((U=b.turnId)==null?void 0:U.trim())??"")===h})&&await vt(c.text,[],[],"steer",[],void 0,void 0,"edit_user_message"))}function Ep(){dn.value||!ne.value||(Cu.value&&(sd.value=Cu.value.id),is("default"),Lu(),vt("Implement",[],[],"steer",[],void 0,"default"))}async function Mp(){if(dn.value||Ba.value||Rs.value||!le.value||Ua.value.length===0)return;const c=x0();try{await rv(c)}catch{}}async function C0(){const c=oF(Ua.value);if(c)try{await rv(c.value)}catch{}}function x0(){var b,U,Q;const c=[],h=((U=(b=le.value)==null?void 0:b.title)==null?void 0:U.trim())||"Untitled thread";c.push(`# ${I0(h)}`),c.push(""),c.push(`- Exported: ${new Date().toISOString()}`),c.push(`- Thread ID: ${((Q=le.value)==null?void 0:Q.id)??""}`),c.push(""),c.push("---"),c.push("");for(const be of Ua.value){const Ue=be.role?be.role.toUpperCase():"MESSAGE";c.push(`## ${Ue}`),c.push("");const Gt=be.text.trim();if(Gt&&(c.push(Gt),c.push("")),be.commandExecution&&(c.push("```text"),c.push(`command: ${be.commandExecution.command}`),c.push(`status: ${be.commandExecution.status}`),be.commandExecution.cwd&&c.push(`cwd: ${be.commandExecution.cwd}`),be.commandExecution.exitCode!==null&&c.push(`exitCode: ${be.commandExecution.exitCode}`),c.push(be.commandExecution.aggregatedOutput||"(no output)"),c.push("```"),c.push("")),be.fileAttachments&&be.fileAttachments.length>0){c.push("Attachments:");for(const br of be.fileAttachments)c.push(`- ${br.path}`);c.push("")}if(be.images&&be.images.length>0){c.push("Images:");for(const br of be.images)c.push(`- ${br}`);c.push("")}}return`${c.join(`
97
- `).trimEnd()}
98
- `}function I0(c){return c.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function xd(c,h){if(typeof window>"u")return h;const b=window.localStorage.getItem(c);return b===null?h:b==="1"}function A0(){if(typeof window>"u")return"system";const c=window.localStorage.getItem(pv);return c==="light"||c==="dark"?c:"system"}function _0(){if(typeof window>"u")return"steer";const c=window.localStorage.getItem(hv);return c==="steer"||c==="queue"?c:"queue"}function P0(){if(typeof window>"u")return"standard";const c=window.localStorage.getItem(yv);return c==="standard"||c==="wide"||c==="extra-wide"?c:"standard"}function Rp(){Na.value=!Na.value,window.localStorage.setItem(fv,Na.value?"1":"0")}function Lp(){xs.value=xs.value==="steer"?"queue":"steer",window.localStorage.setItem(hv,xs.value)}function jp(){const c=["system","light","dark"],h=c.indexOf(Is.value);Is.value=c[(h+1)%c.length],window.localStorage.setItem(pv,Is.value),Nu()}function $p(){const c=["standard","wide","extra-wide"],h=c.indexOf(ui.value);ui.value=c[(h+1)%c.length],window.localStorage.setItem(yv,ui.value)}function E0(){As.value=!As.value,window.localStorage.setItem(mv,As.value?"1":"0")}function M0(){_s.value=!_s.value,window.localStorage.setItem(gv,_s.value?"1":"0")}async function R0(c){if(!Da.value){Da.value=!0;try{if(c==="codex"){wr.value="codex";const h=await sg(!1);ha.value=h.enabled}else if(c==="openrouter"){wr.value="openrouter";const h=await sg(!0);ha.value=h.enabled,await Ji("","",{wireApi:to.value,provider:"openrouter"})}else c==="opencode-zen"?(wr.value="opencode-zen",await Ji("",Fn.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),ha.value=!0):c==="custom"&&(wr.value="custom",eo.value.trim()&&xo.value.trim()&&(await Ji(eo.value.trim(),xo.value.trim(),{wireApi:ci.value}),ha.value=!0));Lr.value="",await re({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Lr.value=h instanceof Error?h.message:"Failed to switch provider"}finally{Da.value=!1}}}async function L0(){if(Rn.value)return;const c=eo.value.trim();if(c){Rn.value=!0;try{Lr.value="",await Ji(c,xo.value.trim(),{wireApi:ci.value}),ha.value=!0;const h=await ag();h.provider==="custom"&&!h.currentModel&&(Lr.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await re({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Lr.value=h instanceof Error?h.message:"Failed to save custom endpoint"}finally{Rn.value=!1}}}async function j0(c){if(Rn.value||Da.value||to.value===c)return;const h=to.value;to.value=c,Rn.value=!0;try{Lr.value="",await Ji("","",{wireApi:c,provider:"openrouter"}),ha.value=!0,await re({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){to.value=h,Lr.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Rn.value=!1}}async function $0(){if(Rn.value)return;const c=Fn.value.trim();if(c){Rn.value=!0;try{Lr.value="",await Ji("",c,{wireApi:"responses",provider:"opencode-zen"}),ha.value=!0,await re({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Lr.value=h instanceof Error?h.message:"Failed to save OpenCode Zen config"}finally{Rn.value=!1}}}async function N0(){if(!Rn.value){Rn.value=!0;try{const c=Ps.value.trim();await ig(c),Ps.value="",await Id(),await re({includeSelectedThreadMessages:!1})}catch{}finally{Rn.value=!1}}}async function O0(){if(!Rn.value){Rn.value=!0;try{await ig(""),Ps.value="",await Id(),await re({includeSelectedThreadMessages:!1})}catch{}finally{Rn.value=!1}}}async function Id(){try{const c=wr.value,h=await ag();ha.value=h.enabled,wu.value=h.customKey??!1,bu.value=h.maskedKey??null,h.enabled?h.provider==="opencode-zen"?wr.value="opencode-zen":h.provider==="custom"?(wr.value="custom",eo.value=h.customBaseUrl??"",ci.value=h.wireApi==="chat"?"chat":"responses"):(wr.value="openrouter",to.value=h.wireApi==="chat"?"chat":"responses"):wr.value="codex",Me=h.hasCodexAuth===!0,Me||(Et=!1);const b=wr.value!==c;b&&await re({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const U=await Yh();U&&await re({includeSelectedThreadMessages:!1,providerChanged:b||U,awaitAncillaryRefreshes:!0})}catch{}}function D0(c){const b=Ad(c.trim())||"auto";Co.value=b,window.localStorage.setItem(vv,b)}function F0(c){Sa(Number(c))}const B0=[{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 U0(){var b;if(typeof window>"u")return"auto";const c=((b=window.localStorage.getItem(vv))==null?void 0:b.trim())||"auto";return Ad(c)||"auto"}function z0(){const c=[{value:"auto",label:f("Auto-detect")}],h=new Set(["auto"]);function b(Q){const be=W[Q]||Q;return`${be.charAt(0).toUpperCase()+be.slice(1)} (${Q})`}for(const Q of typeof navigator<"u"?navigator.languages??[]:[]){const be=Ad(Q);!be||h.has(be)||(h.add(be),c.push({value:be,label:`${f("Preferred")}: ${b(be)}`}))}for(const Q of Object.keys(W))h.has(Q)||(h.add(Q),c.push({value:Q,label:b(Q)}));const U=Co.value.trim();return U&&!h.has(U)&&c.push({value:U,label:b(U)}),c}function Ad(c){const h=c.trim().toLowerCase();if(!h||h==="auto")return"";if(h in W)return h;const b=h.split("-")[0]??h;return b in W?b:""}function Nu(){const c=document.documentElement;if(Is.value==="dark")c.classList.add("dark");else if(Is.value==="light")c.classList.remove("dark");else{const h=window.matchMedia("(prefers-color-scheme: dark)").matches;c.classList.toggle("dark",h)}H0()}function H0(){const c=document.querySelector('meta[name="theme-color"]');if(!c)return;const h=window.getComputedStyle(document.documentElement).getPropertyValue("--s0").trim();h&&c.setAttribute("content",h)}const W0=G(()=>({activeSettingsGroup:Mi.value,accounts:Vn.value,isAccountsSectionCollapsed:nn.value,isRefreshingAccounts:ca.value,isSwitchingAccounts:So.value,isStartingCodexLogin:da.value,isCompletingCodexLogin:Dn.value,accountActionError:bn.value,codexLoginUrl:li.value,feedbackMailto:xr,isAccountUnavailable:_u,isRemoveConfirmationActive:md,isRemoveVisible:Xb,buildAccountTitle:aT,formatAccountMeta:Qh,formatAccountQuota:Xh,shortAccountId:Yb,isAccountActionDisabled:Qb,getAccountSwitchLabel:Zb,getAccountRemoveLabel:eT,onRefreshAccounts:sT,onStartCodexLogin:lT,onSwitchAccount:iT,onRemoveAccount:dT,onAccountCardPointerEnter:tT,onAccountCardPointerLeave:nT,toggleAccountsSectionCollapsed:fs,prepareFeedbackLink:Rt,sendWithEnter:Na.value,inProgressSendMode:xs.value,darkMode:Is.value,uiLanguage:v.value,uiLanguageOptions:T,chatWidthLabel:Lb.value,dictationClickToToggle:As.value,dictationAutoSend:_s.value,dictationLanguage:Co.value,dictationLanguageOptions:td.value,autoCompactThreshold:ni.value,autoCompactThresholdOptions:B0,hasVisibleFeedbackError:Su.value,selectedProvider:wr.value,providerDropdownOptions:od.value,freeModeLoading:Da.value,providerError:Lr.value,freeModeHasCustomKey:wu.value,freeModeCustomKey:Ps.value,freeModeCustomKeyMasked:bu.value,freeModeCustomKeySaving:Rn.value,openRouterWireApi:to.value,opencodeZenKey:Fn.value,customEndpointUrl:eo.value,customEndpointKey:xo.value,customEndpointWireApi:ci.value,isTelegramConfigOpen:Tu.value,telegramStatusText:$b.value,telegramBotTokenDraft:Oi.value,telegramAllowedUserIdsDraft:di.value,telegramConfigError:pa.value,isTelegramSaving:Il.value,supportsHooks:Ri.value,isHooksLoading:Ie.value,hooksList:Ne.value,supportsRemoteControl:si.value,remoteControlStatus:_t.value,isRemoteControlActionInFlight:Er.value,remoteControlError:Vr.value,remoteControlNotice:oa.value,isRemoteControlLoading:ys.value,remoteControlActionName:qn.value,pairingCode:Nt.value,accountRateLimitSnapshots:Je.value,worktreeName:R,appVersion:E,onClose:()=>{on.value=!1},onActiveSettingsGroupChange:c=>{Mi.value=c},toggleSendWithEnter:Rp,cycleInProgressSendMode:Lp,cycleDarkMode:jp,onUiLanguageChange:S,cycleChatWidth:$p,toggleDictationClickToToggle:E0,toggleDictationAutoSend:M0,onDictationLanguageChange:D0,onAutoCompactThresholdChange:F0,onProviderChange:R0,onFreeModeCustomKeyChange:c=>{Ps.value=c},clearFreeModeCustomKey:O0,saveFreeModeCustomKey:N0,setOpenRouterWireApi:j0,onOpencodeZenKeyChange:c=>{Fn.value=c},saveOpencodeZen:$0,onCustomEndpointUrlChange:c=>{eo.value=c},onCustomEndpointKeyChange:c=>{xo.value=c},saveCustomEndpoint:L0,onCustomEndpointWireApiChange:c=>{ci.value=c},onTelegramConfigOpenChange:c=>{Tu.value=c},onTelegramBotTokenDraftChange:c=>{Oi.value=c},onTelegramAllowedUserIdsDraftChange:c=>{di.value=c},saveTelegramConfig:Bb,refreshHooks:_e,toggleRemoteControl:$i,startRemotePairing:ii,refreshRemoteClients:ks,revokeRemoteClient:Cl}));function q0(c,h){const b=(c??"").trim();return b.length>0?b:h.trim()||"message"}function Np(c){is(c)}async function G0(){await Tt.isReady(),gt.name==="thread"&&Nr.value?cs(Nr.value):(gt.name==="home"||gt.name==="skills"||gt.name==="automations")&&cs("",{persist:!1}),await re({includeSelectedThreadMessages:gt.name==="thread"}),Ml({silent:!0}),await w0(),_r.value=!0,await _d(),mo()}async function _d(){if(rr.value){ea=!0;return}rr.value=!0;try{do{if(ea=!1,gt.name==="home"||gt.name==="skills"||gt.name==="automations"){ne.value!==""&&await Ke("");continue}if(gt.name==="thread"){const c=Nr.value;if(!c)continue;if(ne.value!==c){if(await Ke(c)==="not-found")continue}else Oe(c,{silent:!0}).catch(()=>{})}}while(ea)}finally{rr.value=!1}}tt(()=>[gt.name,Nr.value,ce.value,ne.value],async()=>{_r.value&&await _d()}),tt(()=>[ne.value,In.value],()=>{e0()}),tt(()=>[gt.name,In.value],([c,h])=>{c==="thread"&&Mu(h)},{immediate:!0}),tt(()=>ne.value,async c=>{if(_r.value&&!rr.value&&!(dn.value||Ba.value||Rs.value)){if(!c){gt.name!=="home"&&await Tt.replace({name:"home"});return}gt.name==="thread"&&Nr.value===c||await Tt.replace({name:"thread",params:{threadId:c}})}}),tt(()=>cd.value,c=>{if(c.length===0){mt.value="",_o();return}const h=mt.value.trim();h&&(c.some(U=>U.value===h)||(mt.value="")),_o()},{immediate:!0}),tt(()=>mt.value,()=>{He.value={phase:"idle",title:"",message:""},_o()}),tt(()=>[gt.name,mt.value],([c,h])=>{c==="home"&&Mu(h)},{immediate:!0}),tt(fi,c=>{!c&&En.value==="worktree"&&(En.value="local")},{immediate:!0}),tt(()=>[En.value,mt.value],([c,h])=>{c!=="worktree"||!fi.value||Op(h)},{immediate:!0}),tt(()=>En.value,c=>{var h;if(c==="local"){He.value={phase:"idle",title:"",message:""};const b=mt.value.trim();if(b&&tp(b)){const U=((h=le.value)==null?void 0:h.projectName)??Or(b),Q=qi(U,"");Q&&(mt.value=Q)}return}fi.value&&Op(mt.value)}),tt(()=>gt.name,c=>{c!=="home"&&(He.value={phase:"idle",title:"",message:""}),c!=="thread"&&(or.value=!1)}),tt(()=>ne.value,()=>{He.value={phase:"idle",title:"",message:""}}),tt(()=>[gt.name,In.value,fi.value],([c,h,b])=>{if(!(c==="thread"||c==="home"&&b)){yp();return}Gr+=1,yr.value={},an.value="",Rr.value="",Rl(h)},{immediate:!0}),tt(vb,c=>{typeof document>"u"||(document.title=c)},{immediate:!0}),tt(Ct,c=>{c&&!xt.value&&un(!0)},{immediate:!0});async function V0(c,h=[],b=[],U=[]){try{He.value={phase:"idle",title:"",message:""};let Q=mt.value;if(En.value==="worktree"){He.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Ue=await C_(mt.value,Wn.value);Q=Ue.cwd,mt.value=Ue.cwd,He.value={phase:"idle",title:"",message:""}}catch{He.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!Q.trim()){const Ue=await B_(c);Q=Ue.cwd,mt.value=Ue.cwd}const be=await yt(c,Q,h,b,U);if(!be)return;await Tt.replace({name:"thread",params:{threadId:be}}),Lu()}catch{}}function K0(c){var U;if((U=c.prompt)!=null&&U.trim())return c.prompt.trim();const h=c.displayName.trim()||c.name.trim(),b=c.kind==="skill"?"skill":c.kind==="plugin"?"plugin":c.kind==="composio"?"Composio connector":"app";return`Test ${h} ${b}. Give me a list of what it can do and one useful example.`}function Y0(c){return`${c.kind}:${c.name}:${c.skillPath??""}`}async function J0(c){var Q;if(wo.value)return;wo.value=Y0(c);const h=K0(c),b=(Q=c.attachedSkills)!=null&&Q.length?c.attachedSkills:c.kind==="skill"&&c.skillPath?[{name:c.name,path:c.skillPath}]:[],U=uF(b,Ee.value);try{const be=Dh.value.trim()||In.value.trim(),Ue=await yt(h,be,[],U,[]);if(!Ue)return;await Tt.replace({name:"thread",params:{threadId:Ue}}),Lu()}catch{}finally{wo.value=""}}async function Op(c){var b;const h=c.trim();if(!h){I.value=[],Wn.value="";return}O.value=!0;try{const U=await I_(h);I.value=U;const Q=Wn.value.trim();if(!(Q.length>0&&U.some(Ue=>Ue.value===Q))){const Ue=U.find(Gt=>Gt.value.trim()==="main");Wn.value=(Ue==null?void 0:Ue.value)??((b=U[0])==null?void 0:b.value)??""}}catch{I.value=[],Wn.value=""}finally{O.value=!1}}return(c,h)=>(_(),B(rt,null,[Fe(Vx,{"is-sidebar-collapsed":g(xt),onCloseSidebar:h[37]||(h[37]=b=>g(un)(!0))},{sidebar:ft(()=>[w("section",cF,[w("div",{ref_key:"sidebarScrollableRef",ref:_a,class:"sidebar-scrollable",onScroll:h[7]||(h[7]=(...b)=>g(oi)&&g(oi)(...b))},[g(xt)?pe("",!0):(_(),Ze(Fg,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":g(xt),"show-new-thread-button":!0,onToggleSidebar:h[1]||(h[1]=b=>g(un)(!g(xt))),onStartNewThread:Eu},{default:ft(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":g(Pr),"aria-label":g(f)("Search threads"),title:g(f)("Search threads"),onClick:h[0]||(h[0]=(...b)=>g(ta)&&g(ta)(...b))},[Fe(rc,{class:"sidebar-search-toggle-icon"})],8,dF)]),_:1},8,["is-sidebar-collapsed"])),!g(xt)&&g(Pr)?(_(),B("div",fF,[Fe(rc,{class:"sidebar-search-bar-icon"}),_n(w("input",{ref_key:"sidebarSearchInputRef",ref:ds,"onUpdate:modelValue":h[2]||(h[2]=b=>jn(Jt)?Jt.value=b:null),class:"sidebar-search-input",type:"text",placeholder:g(f)("Filter threads..."),onKeydown:h[3]||(h[3]=(...b)=>g(Mn)&&g(Mn)(...b))},null,40,hF),[[Ln,g(Jt)]]),g(Jt).length>0?(_(),B("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":g(f)("Clear search"),onClick:h[4]||(h[4]=(...b)=>g(Pa)&&g(Pa)(...b))},[Fe(kc,{class:"sidebar-search-clear-icon"})],8,pF)):pe("",!0)])):pe("",!0),g(xt)?pe("",!0):(_(),B("button",{key:2,class:ct(["sidebar-skills-link",{"is-active":Ba.value}]),type:"button",onClick:h[5]||(h[5]=b=>{g(Tt).push({name:"skills"}),g(Ct)&&g(un)(!0)})},[w("span",mF,[Fe(Ug)]),w("span",gF,[w("span",vF,D(g(f)("Skills")),1),w("span",yF,D(g(f)("Plugins, apps, MCPs")),1)])],2)),g(xt)?pe("",!0):(_(),B("button",{key:3,class:ct(["sidebar-skills-link",{"is-active":Rs.value}]),type:"button",onClick:h[6]||(h[6]=b=>{g(Tt).push({name:"automations"}),g(Ct)&&g(un)(!0)})},[w("span",wF,[Fe(Bg)]),w("span",bF,[w("span",TF,D(g(f)("Automations")),1),w("span",kF,D(g(f)("Scheduled work")),1)])],2)),g(xt)?pe("",!0):(_(),Ze(bM,{key:4,ref_key:"sidebarThreadTreeRef",ref:$n,groups:g(L),"project-display-name-by-id":g(fe),"project-git-repo-by-name":_b.value,"project-cwd-by-name":np.value,"selected-thread-id":Ub.value,"is-loading":g(ce),"is-thread-list-fully-loaded":g(F),"search-query":g(Jt),"search-matched-thread-ids":na.value,onSelect:Hb,onArchive:Zh,onStartNewThread:hT,onRenameProject:_T,onBrowseThreadFiles:pT,onSaveThreadProject:wT,onBrowseProjectFiles:vT,onSaveProject:yT,onRequestProjectGitStatus:RT,onCreateProjectWorktree:xT,onRenameThread:PT,onForkThread:ep,onRemoveProject:ET,onReorderProject:MT,onCopyThreadChat:Kb,onAutomationsChanged:Vb,onRestoreThread:fT,onStartNewChat:AT},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),g(xt)?pe("",!0):(_(),B("div",{key:0,ref_key:"settingsAreaRef",ref:ai,class:"sidebar-settings-area",onClick:HT},[on.value?(_(),Ze(g(s),yh({key:0,ref_key:"settingsDialogRef",ref:hs},W0.value),null,16)):pe("",!0),w("div",SF,[w("button",{ref_key:"settingsButtonRef",ref:Ea,class:"sidebar-settings-icon-button",type:"button",title:g(f)("Settings"),"aria-label":g(f)("Settings"),onClick:pt(ms,["stop"])},[Fe(C$,{class:"sidebar-settings-icon"})],8,CF),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:g(f)("Recycle bin"),"aria-label":g(f)("Recycle bin"),onClick:pt(hp,["stop"])},[Fe(Tw,{class:"sidebar-settings-icon"})],8,xF)])],512))])]),content:ft(()=>[w("div",IF,[w("section",{class:ct(["content-root",{"is-virtual-keyboard-open":Cb.value}]),style:oo(jb.value)},[_l.value?(_(),B("span",AF)):pe("",!0),Fe(xM,{title:mb.value,accent:Ba.value||Rs.value},{leading:ft(()=>[g(xt)||g(Ct)?(_(),Ze(Fg,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":g(xt),"show-new-thread-button":!0,onToggleSidebar:h[8]||(h[8]=b=>g(un)(!g(xt))),onStartNewThread:Eu},null,8,["is-sidebar-collapsed"])):pe("",!0),Ba.value?(_(),B("span",_F,[Fe(Ug)])):Rs.value?(_(),B("span",PF,[Fe(Bg)])):pe("",!0)]),actions:ft(()=>[w("button",{ref_key:"commandPaletteButtonRef",ref:ip,class:"content-header-command-button",type:"button","aria-label":g(f)("Command palette"),title:NT.value,onClick:up},[Fe(rc,{class:"content-header-command-button-icon"})],8,EF),Al.value?(_(),B("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":g(Ct)?g(Xt)?g(f)("Close side panel"):g(f)("Open side panel"):g(mr)?g(f)("Open side panel"):g(f)("Close side panel"),title:g(Ct)?g(Xt)?g(f)("Close side panel"):g(f)("Open side panel"):g(mr)?g(f)("Open side panel"):g(f)("Close side panel"),onClick:h[9]||(h[9]=(...b)=>g(yo)&&g(yo)(...b))},[Fe(Sw,{class:"content-header-right-panel-toggle-icon"})],8,MF)):pe("",!0)]),_:1},8,["title","accent"]),w("section",RF,[Ba.value?(_(),Ze(g(o),{key:0,ref_key:"directoryHubRef",ref:Cr,cwd:Dh.value,"thread-id":Nr.value,"try-in-flight-key":wo.value,onSkillsChanged:Nb,onTryItem:J0},null,8,["cwd","thread-id","try-in-flight-key"])):Rs.value?(_(),Ze(g(a),{key:1,ref_key:"automationsPanelRef",ref:pn,groups:g(L),"project-cwd-by-name":np.value,"project-display-name-by-id":g(fe),"selected-automation-id":$h.value,onSelectAutomation:Wb,onEditAutomation:qb,onCreateAutomation:Gb},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):dn.value?(_(),B("div",LF,[w("div",jF,[w("p",$F,D(g(f)("Let's build")),1),Fe(Ai,{class:"new-thread-folder-dropdown","model-value":mt.value,options:cd.value,placeholder:g(f)("Choose folder"),"enable-search":!0,"search-placeholder":g(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":GT},null,8,["model-value","options","placeholder","search-placeholder"]),mt.value?(_(),B("p",{key:0,class:"new-thread-folder-selected",title:mt.value},D(g(f)("Selected folder"))+": "+D(mt.value),9,NF)):pe("",!0),w("div",OF,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:f0},D(g(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:t0},D(g(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:V.value,onClick:l0},D(V.value?g(f)("Importing…"):g(f)("Import Project")),9,DF),w("input",{ref_key:"projectImportInputRef",ref:ge,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:d0},null,544)]),Oa.value?(_(),B("section",FF,[w("div",BF,[w("div",UF,[w("span",zF,[Fe(Jc)]),w("p",HF,D(g(f)("New in Codex")),1)]),w("h2",WF,D(g(f)("Plugins are here")),1),w("p",qF,D(g(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),h[42]||(h[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",GF,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Ib},D(g(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:Bh},D(g(f)("Dismiss")),1)])])):pe("",!0),(_(),Ze(Qs,{to:"body"},[ze.value?(_(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:pt(n0,["self"]),onMouseup:r0},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":g(f)("Select folder"),onKeydown:Tr(pt(Vi,["prevent"]),["esc"])},[w("div",KF,[w("p",YF,D(g(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Vi},D(g(f)("Cancel")),1)]),w("p",JF,D(g(f)("Current folder")),1),w("div",QF,[_n(w("input",{ref_key:"existingFolderPathInputRef",ref:nt,"onUpdate:modelValue":h[10]||(h[10]=b=>at.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:g(f)("Current folder"),title:at.value||g(f)("Unavailable"),disabled:gn.value||Yn.value,onBlur:g0,onKeydown:[Tr(pt(v0,["prevent"]),["enter"]),Tr(pt(Vi,["prevent"]),["esc"])]},null,40,XF),[[Ln,at.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!El.value||gn.value||Yn.value,onClick:h[11]||(h[11]=b=>kd())},D(Yn.value?g(f)("Opening…"):g(f)("Open")),9,ZF)]),w("div",eB,[w("label",tB,[_n(w("input",{"onUpdate:modelValue":h[12]||(h[12]=b=>ku.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:p0},null,544),[[TC,ku.value]]),w("span",null,D(g(f)("Show hidden folders")),1)]),w("button",{class:ct(["new-thread-folder-action",{"new-thread-folder-action-primary":Io.value}]),type:"button","aria-pressed":Io.value,disabled:!At.value||gn.value||Yn.value||Fa.value||!!cn.value&&!Io.value,onClick:y0},D(g(f)("New folder")),11,nB)]),Io.value?(_(),B("div",rB,[w("div",oB,[_n(w("input",{ref_key:"createFolderInputRef",ref:yu,"onUpdate:modelValue":h[13]||(h[13]=b=>Es.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:g(f)("Folder name"),onKeydown:[Tr(pt(Tp,["prevent"]),["enter"]),Tr(pt(Ll,["prevent"]),["esc"])]},null,40,aB),[[Ln,Es.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Pb.value||Fa.value,onClick:Tp},D(Eb.value),9,sB)]),Kn.value?(_(),B("div",iB,[w("span",null,D(Kn.value),1),w("a",{class:"visible-error-feedback",href:g(xr),onClick:h[14]||(h[14]=b=>Rt(b,Kn.value))},D(g(f)("Send feedback")),9,lB)])):pe("",!0)])):pe("",!0),_n(w("input",{ref_key:"existingFolderFilterInputRef",ref:Pt,"onUpdate:modelValue":h[15]||(h[15]=b=>jr.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:g(f)("Filter folders..."),onKeydown:Tr(pt(Vi,["prevent"]),["esc"])},null,40,uB),[[Ln,jr.value]]),cn.value?(_(),B("div",cB,[w("div",dB,[w("span",null,D(cn.value),1),w("a",{class:"visible-error-feedback",href:g(xr),onClick:h[16]||(h[16]=b=>Rt(b,cn.value))},D(g(f)("Send feedback")),9,fB)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:gn.value||Yn.value,onClick:m0},D(g(f)("Retry")),9,hB)])):pe("",!0),gn.value?(_(),B("p",pB,D(g(f)("Loading folders…")),1)):!cn.value&&fd.value.length===0?(_(),B("p",mB,D(jr.value.trim()?g(f)("No folders match this filter."):g(f)("No subfolders found here.")),1)):fd.value.length>0?(_(),B("ul",gB,[(_(!0),B(rt,null,Wt(fd.value,b=>(_(),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:gn.value||Yn.value,onClick:U=>h0(b.path)},[w("span",yB,D(b.name),1)],8,vB),b.kind==="directory"?(_(),B("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:gn.value||Yn.value,onClick:U=>kd(b.path)},D(g(f)("Open")),9,wB)):pe("",!0)]))),128))])):pe("",!0)],40,VF)],32)):pe("",!0)])),(_(),Ze(Qs,{to:"body"},[p.value?(_(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:pt(o0,["self"]),onMouseup:a0},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Create or clone project"),onKeydown:Tr(pt(ju,["prevent"]),["esc"])},[w("div",TB,[w("p",kB,D(g(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:Z.value,onClick:ju},D(g(f)("Cancel")),9,SB)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":g(f)("Project source")},[w("button",{class:ct(["new-thread-project-mode-tab",{"is-active":y.value==="create"}]),type:"button",role:"tab","aria-selected":y.value==="create",disabled:Z.value,onClick:h[17]||(h[17]=b=>y.value="create")},D(g(f)("New project")),11,xB),w("button",{class:ct(["new-thread-project-mode-tab",{"is-active":y.value==="clone"}]),type:"button",role:"tab","aria-selected":y.value==="clone",disabled:Z.value,onClick:h[18]||(h[18]=b=>y.value="clone")},D(g(f)("Clone from GitHub")),11,IB)],8,CB),w("label",AB,[w("span",_B,D(g(f)("Destination folder")),1),_n(w("input",{"onUpdate:modelValue":h[19]||(h[19]=b=>A.value=b),class:"new-thread-open-folder-path",type:"text",disabled:Z.value,placeholder:g(f)("Destination folder")},null,8,PB),[[Ln,A.value]])]),y.value==="create"?(_(),B("label",EB,[w("span",MB,D(g(f)("Project name")),1),_n(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:me,"onUpdate:modelValue":h[20]||(h[20]=b=>j.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:Z.value,placeholder:g(f)("Project name"),onKeydown:Tr(pt(Td,["prevent"]),["enter"])},null,40,RB),[[Ln,j.value]])])):y.value==="clone"?(_(),B("label",LB,[w("span",jB,D(g(f)("GitHub repository URL")),1),_n(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:me,"onUpdate:modelValue":h[21]||(h[21]=b=>H.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:Z.value,placeholder:"https://github.com/owner/repo",onKeydown:Tr(pt(Td,["prevent"]),["enter"])},null,40,$B),[[Ln,H.value]])])):pe("",!0),z.value?(_(),B("div",NB,[w("span",null,D(z.value),1),w("a",{class:"visible-error-feedback",href:g(xr),onClick:h[22]||(h[22]=b=>Rt(b,z.value))},D(g(f)("Send feedback")),9,OB)])):pe("",!0),w("div",DB,[w("button",{class:"new-thread-folder-action",type:"button",disabled:Z.value,onClick:ju},D(g(f)("Cancel")),9,FB),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Vh.value||Z.value,onClick:Td},D(Mb.value),9,BB)])],40,bB)],32)):pe("",!0)])),fi.value?(_(),Ze(r$,{key:2,class:"new-thread-runtime-dropdown",modelValue:En.value,"onUpdate:modelValue":h[23]||(h[23]=b=>En.value=b)},null,8,["modelValue"])):pe("",!0),En.value==="worktree"?(_(),B("div",UB,[w("p",zB,D(g(f)("Base branch")),1),Fe(Ai,{class:"new-thread-branch-dropdown","model-value":Wn.value,options:dd.value,placeholder:g(f)("Select branch"),"enable-search":!0,"search-placeholder":g(f)("Search branches..."),disabled:O.value||dd.value.length===0,"onUpdate:modelValue":VT},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",HB,D(O.value?g(f)("Loading branches…"):Hh.value?g(f)("New worktree branch will start from {branch}.",{branch:Hh.value}):g(f)("No Git branches found for this folder.")),1)])):pe("",!0),fi.value?(_(),B("p",WB,D(g(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):pe("",!0),He.value.phase!=="idle"?(_(),B("div",{key:5,class:ct(["worktree-init-status",{"is-running":He.value.phase==="running","is-error":He.value.phase==="error"}])},[w("strong",qB,D(He.value.title),1),w("span",GB,D(He.value.message),1)],2)):pe("",!0)]),w("div",VB,[g(xe)?(_(),B("div",KB,[w("span",null,D(g(f)(g(xe))),1),w("a",{class:"visible-error-feedback",href:g(xr),onClick:h[24]||(h[24]=b=>Rt(b,g(xe)))},D(g(f)("Send feedback")),9,YB)])):pe("",!0),Fe(Ng,{ref_key:"homeThreadComposerRef",ref:go,"active-thread-id":Ls.value,cwd:In.value,"fuzzy-file-search-results":g(ut),onRegisterFuzzySession:g(J),"collaboration-modes":g(Ae),"selected-collaboration-mode":g(je),models:g(De),"model-reasoning-efforts":g($e),"selected-model":Oh.value,"selected-reasoning-effort":g(Ce),"selected-speed-mode":g(Se),"is-updating-speed-mode":g(q),skills:g(Ee),"thread-token-usage":g(Y),"codex-quota":g(ve),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":Na.value,"in-progress-submit-mode":xs.value,"dictation-click-to-toggle":As.value,"dictation-auto-send":_s.value,"dictation-language":Co.value,onSubmit:vp,"onUpdate:selectedCollaborationMode":Np,"onUpdate:selectedModel":xp,"onUpdate:selectedReasoningEffort":Ip,"onUpdate:selectedSpeedMode":Ap,"approval-policy":Ma.value,"is-approval-policy-saving":Kr.value,"approval-policy-error":Yr.value,"approval-policy-notice":Jr.value,"onUpdate:approvalPolicy":Qr,onSaveApprovalPolicy:ia,onSlashCommand:Pp},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"])])])):(_(),B("div",JB,[or.value&&g(ne)&&In.value?(_(),Ze(g(r),{key:0,"thread-id":g(ne),cwd:In.value,"is-thread-in-progress":Iu.value,"initial-file-path":gr.value,"commit-sha":Mr.value,onClose:h[25]||(h[25]=b=>or.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):pe("",!0),w("div",QB,[Fe(g(t),{ref_key:"threadConversationRef",ref:Sn,messages:yb.value,"is-loading":g(oe),"is-slow-open":g(se)!==null&&g(se)===Ls.value,"active-thread-id":Ls.value,cwd:In.value,"live-overlay":Tb.value,"live-turn-id":g(ee),"pending-requests":g(ie),"has-more-persisted-above":g(lt),"is-loading-persisted-above":g(Le),"load-earlier-messages":g(Ge),onForkThread:jT,onRollback:k0,onEditMessage:S0,onFileChangesChanged:Ob,onRespondServerRequest:sp},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:kn},[Fh.value?(_(),B("div",XB,D(g(f)("This thread is running in the Codex TUI")),1)):pe("",!0),g(xe)?(_(),B("div",ZB,[w("span",null,D(g(f)(g(xe))),1),w("a",{class:"visible-error-feedback",href:g(xr),onClick:h[26]||(h[26]=b=>Rt(b,g(xe)))},D(g(f)("Send feedback")),9,e2)])):pe("",!0),Fe(g(m),{messages:g(fo),onEdit:qT,onSteer:g(ho),onDelete:g(er),onReorder:T0},null,8,["messages","onSteer","onDelete"]),jl.value?(_(),B("div",t2,[w("span",null,D(jl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":g(f)("Dismiss"),onClick:h[27]||(h[27]=b=>jl.value="")}," × ",8,n2)])):pe("",!0),xu.value?(_(),Ze(g(d),{key:3,request:xu.value,"request-count":g(ie).length,"has-queue-above":g(fo).length>0,"panel-width":zr.value,"visual-viewport-height":_l.value?ma.value:0,"panel-error":kb.value,onRespondServerRequest:sp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(_(),Ze(Ng,{key:4,ref_key:"threadComposerRef",ref:nr,"active-thread-id":Ls.value,cwd:In.value,"fuzzy-file-search-results":g(ut),onRegisterFuzzySession:g(J),"collaboration-modes":g(Ae),"selected-collaboration-mode":g(je),models:g(De),"model-reasoning-efforts":g($e),"selected-model":Oh.value,"selected-reasoning-effort":g(Ce),"selected-speed-mode":g(Se),"is-updating-speed-mode":g(q),skills:g(Ee),"thread-token-usage":g(Y),"codex-quota":g(ve),"is-turn-in-progress":Iu.value,"is-stop-pending":g($),"is-interrupting-turn":g(P),"is-compacting":xb.value,"external-session-active":Fh.value,"has-queue-above":g(fo).length>0,"send-with-enter":Na.value,"in-progress-submit-mode":xs.value,"dictation-click-to-toggle":As.value,"dictation-auto-send":_s.value,"dictation-language":Co.value,"onUpdate:selectedCollaborationMode":Np,onSubmit:vp,"onUpdate:selectedModel":xp,"onUpdate:selectedReasoningEffort":Ip,"onUpdate:selectedSpeedMode":Ap,"approval-policy":Ma.value,"is-approval-policy-saving":Kr.value,"approval-policy-error":Yr.value,"approval-policy-notice":Jr.value,"onUpdate:approvalPolicy":Qr,onSaveApprovalPolicy:ia,"plan-panel":Cu.value,onInterrupt:_p,onSlashCommand:Pp,onImplementPlan:Ep,onCompactContext:Uh},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","is-turn-in-progress","is-stop-pending","is-interrupting-turn","is-compacting","external-session-active","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice","plan-panel"]))],512)]))])],6),g(Ct)&&g(Xt)?(_(),B("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:h[28]||(h[28]=(...b)=>g(vn)&&g(vn)(...b))})):pe("",!0),Al.value&&(g(Ct)||!g(mr))?(_(),B("aside",{key:1,class:ct(["content-right-panel",{"is-mobile-open":g(Xt)}]),style:oo({"--right-panel-width":`${g(ln)}px`})},[g(Ct)?pe("",!0):(_(),B("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:h[29]||(h[29]=(...b)=>g(Wr)&&g(Wr)(...b))},null,32)),w("div",r2,[w("div",o2,[w("button",{class:ct(["content-right-panel-tab",{"is-active":g(Ut)==="git"}]),type:"button",role:"tab","aria-selected":g(Ut)==="git",onClick:h[30]||(h[30]=b=>g(zt)("git"))},[Fe(Sc,{class:"content-right-panel-tab-icon"}),Gs(" "+D(g(f)("Git")),1)],10,a2),w("button",{class:ct(["content-right-panel-tab",{"is-active":g(Ut)==="files"}]),type:"button",role:"tab","aria-selected":g(Ut)==="files",onClick:h[31]||(h[31]=b=>g(zt)("files"))},[Fe(zg,{class:"content-right-panel-tab-icon"}),Gs(" "+D(g(f)("Files")),1)],10,s2),(_(!0),B(rt,null,Wt(g(vo),b=>(_(),B("button",{key:b.key,class:ct(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":g(Ut)==="preview"&&g(Go)===b.key}]),type:"button",role:"tab","aria-selected":g(Ut)==="preview"&&g(Go)===b.key,title:b.path,onClick:U=>g(Qo)(b.key)},[Fe(bl,{class:"content-right-panel-tab-icon"}),w("span",l2,D(b.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":g(f)("Close"),title:g(f)("Close"),onClick:pt(U=>g(It)(b.key),["stop"])},"×",8,u2)],10,i2))),128))]),w("div",c2,[w("div",d2,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":g(f)("Add panel"),title:g(f)("Add panel"),onClick:h[32]||(h[32]=pt(b=>Cn.value=!g(Cn),["stop"]))},"+",8,f2),Fe(gu,{name:"right-panel-menu"},{default:ft(()=>[g(Cn)?(_(),B("div",h2,[w("button",{type:"button",onClick:h[33]||(h[33]=b=>g(zt)("terminal"))},[Fe(_$,{class:"content-right-panel-menu-icon"}),Gs(" "+D(g(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:h[34]||(h[34]=b=>g(zt)("git"))},[Fe(Sc,{class:"content-right-panel-menu-icon"}),Gs(" "+D(g(f)("Git panel")),1)]),w("button",{type:"button",onClick:h[35]||(h[35]=b=>g(zt)("files"))},[Fe(zg,{class:"content-right-panel-menu-icon"}),Gs(" "+D(g(f)("Files panel")),1)])])):pe("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":g(f)("Close panel"),title:g(f)("Close panel"),onClick:h[36]||(h[36]=(...b)=>g(vn)&&g(vn)(...b))},[Fe(kc,{class:"content-right-panel-close-icon"})],8,p2)])]),w("div",m2,[g(Ut)==="git"?(_(),Ze(g(i),{key:0,"current-branch":vr.value,"head-sha":la.value,"head-subject":C.value,"head-date":M.value,detached:x.value,dirty:X.value,"worktree-change-summary":Qe.value,"worktree-changes":qt.value,branches:Xr.value,"commits-by-branch":yr.value,"commits-loading-for":an.value,"commits-error":Rr.value,"commit-files-by-sha":Ra.value,"commit-files-loading-for":ua.value,"commit-files-error":Ss.value,loading:Cs.value,busy:La.value,error:Gn.value,"review-open":or.value,"show-review":g(gt).name==="thread"&&g(ne).length>0,onToggleReview:ZT,onCheckoutBranch:YT,onResetBranchToCommit:JT,onLoadCommits:bp,onLoadCommitFiles:QT,onOpenCommitFile:XT},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"])):g(Ut)==="files"?(_(),Ze(g(l),{key:1,cwd:In.value,onOpenPreview:g(Jo)},null,8,["cwd","onOpenPreview"])):g(Ut)==="preview"&&g(Vo)?(_(),Ze(g(u),{key:2,"file-path":g(Vo).path,name:g(Vo).label},null,8,["file-path","name"])):(_(),Ze(g(n),{key:3,ref_key:"threadTerminalPanelRef",ref:Ia,"thread-id":Ls.value,cwd:In.value,onHide:g(Ir),onTerminalFocusChange:g(Ar)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):pe("",!0)])]),_:1},8,["is-sidebar-collapsed"]),js.value?(_(),Ze(qM,{key:0,commands:BT.value,onClose:Ru,onRun:UT},null,8,["commands"])):pe("",!0),Gi.value?(_(),Ze(dR,{key:1,"is-mac":en(),onClose:cp},null,8,["is-mac"])):pe("",!0),Te.value.phase!=="idle"?(_(),B("div",g2,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Export Project"),onClick:h[38]||(h[38]=pt(()=>{},["stop"]))},[w("div",y2,[w("h2",w2,D(g(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":g(f)("Close"),disabled:Te.value.phase==="exporting",onClick:op}," × ",8,b2)]),w("p",T2,D(Te.value.phase==="exporting"?g(f)("Preparing project ZIP..."):Te.value.fileName),1),w("div",k2,[w("span",null,D(Te.value.phase==="exporting"?g(f)("Exporting"):g(f)("Ready")),1),w("span",null,D(nd.value),1)]),w("div",S2,[w("div",{class:"project-zip-progress-fill",style:oo({width:rd.value})},null,4)]),Te.value.error?(_(),B("p",C2,D(Te.value.error),1)):pe("",!0),w("div",x2,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:Te.value.phase==="exporting",onClick:op},D(g(f)("Close")),9,I2),w("button",{class:"project-zip-modal-action",type:"button",disabled:!Te.value.blob,onClick:ST},D(g(f)("Download")),9,A2),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!Te.value.blob,onClick:CT},D(g(f)("Share")),9,_2)])],8,v2)])):pe("",!0),Ni.value?(_(),B("div",{key:3,class:"codex-login-modal-backdrop",role:"presentation",onClick:gd},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Complete Codex login"),onSubmit:pt(uT,["prevent"]),onClick:h[41]||(h[41]=pt(()=>{},["stop"]))},[w("div",E2,[w("h2",M2,D(g(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":g(f)("Close"),disabled:Dn.value,onClick:gd}," × ",8,R2)]),w("p",L2,D(g(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),li.value?(_(),B("a",{key:0,class:"codex-login-modal-link",href:li.value,target:"_blank",rel:"noreferrer"},D(g(f)("Open login URL")),9,j2)):pe("",!0),_n(w("input",{ref_key:"codexLoginCallbackInputRef",ref:xl,"onUpdate:modelValue":h[39]||(h[39]=b=>ja.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:g(f)("Paste localhost callback URL"),disabled:Dn.value},null,8,$2),[[Ln,ja.value]]),bn.value?(_(),B("div",N2,[w("span",null,D(bn.value),1),w("a",{class:"visible-error-feedback",href:g(xr),onClick:h[40]||(h[40]=b=>Rt(b,bn.value))},D(g(f)("Send feedback")),9,O2)])):pe("",!0),w("div",D2,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:Dn.value,onClick:gd},D(g(f)("Cancel")),9,F2),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:Dn.value||ja.value.trim().length===0},D(Dn.value?g(f)("Completing…"):g(f)("Complete")),9,B2)])],40,P2)])):pe("",!0)],64))}}),H2=wt(z2,[["__scopeId","data-v-9212e719"]]),Zu={render:()=>null},W2=Fx({history:vx(),routes:[{path:"/",name:"home",component:Zu},{path:"/thread/:threadId",name:"thread",component:Zu},{path:"/skills",name:"skills",component:Zu},{path:"/automations",name:"automations",component:Zu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-mobile-re. github: https://github.com/cattails-lgao/codex-mobile");EP();_C(H2).use(W2).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(pw("Service worker registration failed."),e)})});export{Ln as $,tt as A,oo as B,yw as C,Sc as D,kr as E,rt as F,Ys as G,qu as H,kc as I,oN as J,X2 as K,tF as L,Mc as M,UU as N,Eo as O,FU as P,BU as Q,Sh as R,B$ as S,Qs as T,Mt as U,ss as V,q2 as W,hh as X,_n as Y,Tr as Z,wt as _,Pc as a,kU as a$,vR as a0,NU as a1,OU as a2,F$ as a3,$U as a4,AU as a5,PU as a6,MU as a7,_U as a8,jU as a9,tU as aA,dU as aB,gU as aC,vU as aD,iU as aE,mU as aF,rU as aG,nU as aH,oU as aI,aU as aJ,yU as aK,bU as aL,TU as aM,lU as aN,uU as aO,cU as aP,fU as aQ,pU as aR,hU as aS,wU as aT,eI as aU,tI as aV,Jc as aW,PR as aX,G2 as aY,bl as aZ,TC as a_,EU as aa,RU as ab,LU as ac,Zs as ad,Rh as ae,V_ as af,FA as ag,Y2 as ah,V2 as ai,J2 as aj,K2 as ak,Q2 as al,Ai as am,CU as an,IU as ao,xU as ap,Mh as aq,Ux as ar,Bx as as,Dg as at,Og as au,zU as av,PA as aw,sU as ax,Z2 as ay,eU as az,k as b,SU as b0,G as c,rv as d,FD as e,Hg as f,wh as g,hn as h,_ as i,Ze as j,B as k,w as l,ct as m,Xu as n,ti as o,pe as p,Wt as q,DU as r,Gs as s,D as t,g as u,Fe as v,pt as w,gu as x,ft as y,co as z};