codex-mobile-re 0.1.111 → 0.1.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AutomationsPanel-o9elVnFr.js → AutomationsPanel-DlBkLmKR.js} +1 -1
- package/dist/assets/{DirectoryHub-B0r0JD4Y.js → DirectoryHub-sS2h3U_D.js} +1 -1
- package/dist/assets/{QueuedMessages-BN-LwcoG.js → QueuedMessages-D_o6pC9F.js} +1 -1
- package/dist/assets/{ReviewPane-BPu58eNW.js → ReviewPane-qS7hOyaM.js} +1 -1
- package/dist/assets/{RightFilePreview-DG_IORfL.js → RightFilePreview-D1LmPrpY.js} +1 -1
- package/dist/assets/{RightFilesPanel-rBbhhcHg.js → RightFilesPanel-B5AIrAU3.js} +1 -1
- package/dist/assets/{RightGitPanel-DLd-Bkw8.js → RightGitPanel-K_jp1qHA.js} +1 -1
- package/dist/assets/{SettingsDialog-B0HUh4it.js → SettingsDialog-C4aE-PFC.js} +1 -1
- package/dist/assets/{ThreadConversation-Bx1bFGUl.js → ThreadConversation-B4NZvuHw.js} +2 -2
- package/dist/assets/{ThreadConversation-DdVXSJ1V.css → ThreadConversation-Ccm62p-Y.css} +1 -1
- package/dist/assets/{ThreadPendingRequestPanel-IUYdge4_.js → ThreadPendingRequestPanel-DNTrk7uR.js} +1 -1
- package/dist/assets/{ThreadTerminalPanel-CR04tNVA.js → ThreadTerminalPanel-BLHMQWJI.js} +1 -1
- package/dist/assets/index-Cu_hRJGY.js +83 -0
- package/dist/assets/{index-IvNznUpW.css → index-pBusEabS.css} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/index-kOwa0g4Z.js +0 -83
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-Bx1bFGUl.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-DdVXSJ1V.css","assets/ThreadTerminalPanel-CR04tNVA.js","assets/ThreadTerminalPanel-O7IxAyfy.css","assets/ReviewPane-BPu58eNW.js","assets/ReviewPane-ZrWfZEd_.css","assets/DirectoryHub-B0r0JD4Y.js","assets/DirectoryHub-DmZLEiwB.css","assets/AutomationsPanel-o9elVnFr.js","assets/AutomationsPanel-VRBbmMYW.css","assets/SettingsDialog-B0HUh4it.js","assets/SettingsDialog-CfChVi0L.css","assets/RightGitPanel-DLd-Bkw8.js","assets/RightGitPanel-BTq9Wdmr.css","assets/RightFilesPanel-rBbhhcHg.js","assets/RightFilesPanel-l-aqQaW6.css","assets/RightFilePreview-DG_IORfL.js","assets/RightFilePreview-BythLbi1.css","assets/ThreadPendingRequestPanel-IUYdge4_.js","assets/ThreadPendingRequestPanel-BptJdqbc.css","assets/QueuedMessages-BN-LwcoG.js","assets/QueuedMessages-BM1najM7.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();/**
|
|
3
|
-
* @vue/shared v3.5.40
|
|
4
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
-
* @license MIT
|
|
6
|
-
**/function hf(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Dt={},Oi=[],ca=()=>{},ov=()=>!1,tc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),nc=e=>e.startsWith("onUpdate:"),pn=Object.assign,mf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},mT=Object.prototype.hasOwnProperty,Mt=(e,t)=>mT.call(e,t),tt=Array.isArray,Di=e=>Wl(e)==="[object Map]",oc=e=>Wl(e)==="[object Set]",Dp=e=>Wl(e)==="[object Date]",ft=e=>typeof e=="function",Vt=e=>typeof e=="string",$r=e=>typeof e=="symbol",jt=e=>e!==null&&typeof e=="object",rv=e=>(jt(e)||ft(e))&&ft(e.then)&&ft(e.catch),av=Object.prototype.toString,Wl=e=>av.call(e),vT=e=>Wl(e).slice(8,-1),sv=e=>Wl(e)==="[object Object]",vf=e=>Vt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Pl=hf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),rc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},gT=/-\w/g,po=rc(e=>e.replace(gT,t=>t.slice(1).toUpperCase())),yT=/\B([A-Z])/g,As=rc(e=>e.replace(yT,"-$1").toLowerCase()),ac=rc(e=>e.charAt(0).toUpperCase()+e.slice(1)),ed=rc(e=>e?`on${ac(e)}`:""),Rr=(e,t)=>!Object.is(e,t),Ru=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},iv=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},gf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},wT=e=>{const t=Vt(e)?Number(e):NaN;return isNaN(t)?e:t};let Fp;const sc=()=>Fp||(Fp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function er(e){if(tt(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=Vt(o)?CT(o):er(o);if(r)for(const a in r)t[a]=r[a]}return t}else if(Vt(e)||jt(e))return e}const bT=/;(?![^(]*\))/g,TT=/:([^]+)/,ST=/\/\*[^]*?\*\//g;function CT(e){const t={};return e.replace(ST,"").split(bT).forEach(n=>{if(n){const o=n.split(TT);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function at(e){let t="";if(Vt(e))t=e;else if(tt(e))for(let n=0;n<e.length;n++){const o=at(e[n]);o&&(t+=o+" ")}else if(jt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const xT="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",kT=hf(xT);function lv(e){return!!e||e===""}function IT(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=Gl(e[o],t[o]);return n}function Gl(e,t){if(e===t)return!0;let n=Dp(e),o=Dp(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=$r(e),o=$r(t),n||o)return e===t;if(n=tt(e),o=tt(t),n||o)return n&&o?IT(e,t):!1;if(n=jt(e),o=jt(t),n||o){if(!n||!o)return!1;const r=Object.keys(e).length,a=Object.keys(t).length;if(r!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!Gl(e[s],t[s]))return!1}}return String(e)===String(t)}function uv(e,t){return e.findIndex(n=>Gl(n,t))}const cv=e=>!!(e&&e.__v_isRef===!0),D=e=>Vt(e)?e:e==null?"":tt(e)||jt(e)&&(e.toString===av||!ft(e.toString))?cv(e)?D(e.value):JSON.stringify(e,dv,2):String(e),dv=(e,t)=>cv(t)?dv(e,t.value):Di(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],a)=>(n[td(o,a)+" =>"]=r,n),{})}:oc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>td(n))}:$r(t)?td(t):jt(t)&&!tt(t)&&!sv(t)?String(t):t,td=(e,t="")=>{var n;return $r(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 jn;class AT{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&&jn&&(jn.active?(this.parent=jn,this.index=(jn.scopes||(jn.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}const o=this.effects.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}}run(t){if(this._active){const n=jn;try{return jn=this,t()}finally{jn=n}}}on(){++this._on===1&&(this.prevScope=jn,jn=this)}off(){if(this._on>0&&--this._on===0){if(jn===this)jn=this.prevScope;else{let t=jn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,o;for(n=0,o=this.effects.length;n<o;n++)this.effects[n].stop();for(this.effects.length=0,n=0,o=this.cleanups.length;n<o;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const r=this.scopes.slice();for(n=0,o=r.length;n<o;n++)r[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function _T(){return jn}let Bt;const nd=new WeakSet;class fv{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,jn&&(jn.active?jn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,nd.has(this)&&(nd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||hv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Bp(this),mv(this);const t=Bt,n=jr;Bt=this,jr=!0;try{return this.fn()}finally{vv(this),Bt=t,jr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)bf(t);this.deps=this.depsTail=void 0,Bp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?nd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ed(this)&&this.run()}get dirty(){return Ed(this)}}let pv=0,Rl,El;function hv(e,t=!1){if(e.flags|=8,t){e.next=El,El=e;return}e.next=Rl,Rl=e}function yf(){pv++}function wf(){if(--pv>0)return;if(El){let t=El;for(El=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Rl;){let t=Rl;for(Rl=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}t=n}}if(e)throw e}function mv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function vv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),bf(o),PT(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function Ed(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(gv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function gv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ol)||(e.globalVersion=Ol,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ed(e))))return;e.flags|=2;const t=e.dep,n=Bt,o=jr;Bt=e,jr=!0;try{mv(e);const r=e.fn(e._value);(t.version===0||Rr(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Bt=n,jr=o,vv(e),e.flags&=-3}}function bf(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)bf(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function PT(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let jr=!0;const yv=[];function Da(){yv.push(jr),jr=!1}function Fa(){const e=yv.pop();jr=e===void 0?!0:e}function Bp(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Bt;Bt=void 0;try{t()}finally{Bt=n}}}let Ol=0;class RT{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 Tf{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(!Bt||!jr||Bt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Bt)n=this.activeLink=new RT(Bt,this),Bt.deps?(n.prevDep=Bt.depsTail,Bt.depsTail.nextDep=n,Bt.depsTail=n):Bt.deps=Bt.depsTail=n,wv(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const o=n.nextDep;o.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=o),n.prevDep=Bt.depsTail,n.nextDep=void 0,Bt.depsTail.nextDep=n,Bt.depsTail=n,Bt.deps===n&&(Bt.deps=o)}return n}trigger(t){this.version++,Ol++,this.notify(t)}notify(t){yf();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{wf()}}}function wv(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let o=t.deps;o;o=o.nextDep)wv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Md=new WeakMap,li=Symbol(""),jd=Symbol(""),Dl=Symbol("");function Jn(e,t,n){if(jr&&Bt){let o=Md.get(e);o||Md.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new Tf),r.map=o,r.key=n),r.track()}}function La(e,t,n,o,r,a){const s=Md.get(e);if(!s){Ol++;return}const i=l=>{l&&l.trigger()};if(yf(),t==="clear")s.forEach(i);else{const l=tt(e),d=l&&vf(n);if(l&&n==="length"){const c=Number(o);s.forEach((v,f)=>{(f==="length"||f===Dl||!$r(f)&&f>=c)&&i(v)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),d&&i(s.get(Dl)),t){case"add":l?d&&i(s.get("length")):(i(s.get(li)),Di(e)&&i(s.get(jd)));break;case"delete":l||(i(s.get(li)),Di(e)&&i(s.get(jd)));break;case"set":Di(e)&&i(s.get(li));break}}wf()}function Pi(e){const t=Rt(e);return t===e?t:(Jn(t,"iterate",Dl),tr(e)?t:t.map(Or))}function ic(e){return Jn(e=Rt(e),"iterate",Dl),e}function la(e,t){return Ba(e)?Gi(ui(e)?Or(t):t):Or(t)}const ET={__proto__:null,[Symbol.iterator](){return od(this,Symbol.iterator,e=>la(this,e))},concat(...e){return Pi(this).concat(...e.map(t=>tt(t)?Pi(t):t))},entries(){return od(this,"entries",e=>(e[1]=la(this,e[1]),e))},every(e,t){return _a(this,"every",e,t,void 0,arguments)},filter(e,t){return _a(this,"filter",e,t,n=>n.map(o=>la(this,o)),arguments)},find(e,t){return _a(this,"find",e,t,n=>la(this,n),arguments)},findIndex(e,t){return _a(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return _a(this,"findLast",e,t,n=>la(this,n),arguments)},findLastIndex(e,t){return _a(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return _a(this,"forEach",e,t,void 0,arguments)},includes(...e){return rd(this,"includes",e)},indexOf(...e){return rd(this,"indexOf",e)},join(e){return Pi(this).join(e)},lastIndexOf(...e){return rd(this,"lastIndexOf",e)},map(e,t){return _a(this,"map",e,t,void 0,arguments)},pop(){return bl(this,"pop")},push(...e){return bl(this,"push",e)},reduce(e,...t){return Up(this,"reduce",e,t)},reduceRight(e,...t){return Up(this,"reduceRight",e,t)},shift(){return bl(this,"shift")},some(e,t){return _a(this,"some",e,t,void 0,arguments)},splice(...e){return bl(this,"splice",e)},toReversed(){return Pi(this).toReversed()},toSorted(e){return Pi(this).toSorted(e)},toSpliced(...e){return Pi(this).toSpliced(...e)},unshift(...e){return bl(this,"unshift",e)},values(){return od(this,"values",e=>la(this,e))}};function od(e,t,n){const o=ic(e),r=o[t]();return o!==e&&!tr(e)&&(r._next=r.next,r.next=()=>{const a=r._next();return a.done||(a.value=n(a.value)),a}),r}const MT=Array.prototype;function _a(e,t,n,o,r,a){const s=ic(e),i=s!==e&&!tr(e),l=s[t];if(l!==MT[t]){const v=l.apply(e,a);return i?Or(v):v}let d=n;s!==e&&(i?d=function(v,f){return n.call(this,la(e,v),f,e)}:n.length>2&&(d=function(v,f){return n.call(this,v,f,e)}));const c=l.call(s,d,o);return i&&r?r(c):c}function Up(e,t,n,o){const r=ic(e),a=r!==e&&!tr(e);let s=n,i=!1;r!==e&&(a?(i=o.length===0,s=function(d,c,v){return i&&(i=!1,d=la(e,d)),n.call(this,d,la(e,c),v,e)}):n.length>3&&(s=function(d,c,v){return n.call(this,d,c,v,e)}));const l=r[t](s,...o);return i?la(e,l):l}function rd(e,t,n){const o=Rt(e);Jn(o,"iterate",Dl);const r=o[t](...n);return(r===-1||r===!1)&&xf(n[0])?(n[0]=Rt(n[0]),o[t](...n)):r}function bl(e,t,n=[]){Da(),yf();const o=Rt(e)[t].apply(e,n);return wf(),Fa(),o}const jT=hf("__proto__,__v_isRef,__isVue"),bv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter($r));function LT(e){$r(e)||(e=String(e));const t=Rt(this);return Jn(t,"has",e),t.hasOwnProperty(e)}class Tv{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return o===(r?a?qT:kv:a?xv:Cv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const s=tt(t);if(!r){let l;if(s&&(l=ET[n]))return l;if(n==="hasOwnProperty")return LT}const i=Reflect.get(t,n,kn(t)?t:o);if(($r(n)?bv.has(n):jT(n))||(r||Jn(t,"get",n),a))return i;if(kn(i)){const l=s&&vf(n)?i:i.value;return r&&jt(l)?Nd(l):l}return jt(i)?r?Nd(i):lc(i):i}}class Sv extends Tv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let a=t[n];const s=tt(t)&&vf(n);if(!this._isShallow){const d=Ba(a);if(!tr(o)&&!Ba(o)&&(a=Rt(a),o=Rt(o)),!s&&kn(a)&&!kn(o))return d||(a.value=o),!0}const i=s?Number(n)<t.length:Mt(t,n),l=Reflect.set(t,n,o,kn(t)?t:r);return t===Rt(r)&&l&&(i?Rr(o,a)&&La(t,"set",n,o):La(t,"add",n,o)),l}deleteProperty(t,n){const o=Mt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&La(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!$r(n)||!bv.has(n))&&Jn(t,"has",n),o}ownKeys(t){return Jn(t,"iterate",tt(t)?"length":li),Reflect.ownKeys(t)}}class NT extends Tv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const $T=new Sv,OT=new NT,DT=new Sv(!0);const Ld=e=>e,hu=e=>Reflect.getPrototypeOf(e);function FT(e,t,n){return function(...o){const r=this.__v_raw,a=Rt(r),s=Di(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,d=r[e](...o),c=n?Ld:t?Gi:Or;return!t&&Jn(a,"iterate",l?jd:li),pn(Object.create(d),{next(){const{value:v,done:f}=d.next();return f?{value:v,done:f}:{value:i?[c(v[0]),c(v[1])]:c(v),done:f}}})}}function mu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function BT(e,t){const n={get(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);e||(Rr(r,i)&&Jn(s,"get",r),Jn(s,"get",i));const{has:l}=hu(s),d=t?Ld:e?Gi:Or;if(l.call(s,r))return d(a.get(r));if(l.call(s,i))return d(a.get(i));a!==s&&a.get(r)},get size(){const r=this.__v_raw;return!e&&Jn(Rt(r),"iterate",li),r.size},has(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);return e||(Rr(r,i)&&Jn(s,"has",r),Jn(s,"has",i)),r===i?a.has(r):a.has(r)||a.has(i)},forEach(r,a){const s=this,i=s.__v_raw,l=Rt(i),d=t?Ld:e?Gi:Or;return!e&&Jn(l,"iterate",li),i.forEach((c,v)=>r.call(a,d(c),d(v),s))}};return pn(n,e?{add:mu("add"),set:mu("set"),delete:mu("delete"),clear:mu("clear")}:{add(r){const a=Rt(this),s=hu(a),i=Rt(r),l=!t&&!tr(r)&&!Ba(r)?i:r;return s.has.call(a,l)||Rr(r,l)&&s.has.call(a,r)||Rr(i,l)&&s.has.call(a,i)||(a.add(l),La(a,"add",l,l)),this},set(r,a){!t&&!tr(a)&&!Ba(a)&&(a=Rt(a));const s=Rt(this),{has:i,get:l}=hu(s);let d=i.call(s,r);d||(r=Rt(r),d=i.call(s,r));const c=l.call(s,r);return s.set(r,a),d?Rr(a,c)&&La(s,"set",r,a):La(s,"add",r,a),this},delete(r){const a=Rt(this),{has:s,get:i}=hu(a);let l=s.call(a,r);l||(r=Rt(r),l=s.call(a,r)),i&&i.call(a,r);const d=a.delete(r);return l&&La(a,"delete",r,void 0),d},clear(){const r=Rt(this),a=r.size!==0,s=r.clear();return a&&La(r,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=FT(r,e,t)}),n}function Sf(e,t){const n=BT(e,t);return(o,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Mt(n,r)&&r in o?n:o,r,a)}const UT={get:Sf(!1,!1)},zT={get:Sf(!1,!0)},HT={get:Sf(!0,!1)};const Cv=new WeakMap,xv=new WeakMap,kv=new WeakMap,qT=new WeakMap;function WT(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function lc(e){return Ba(e)?e:Cf(e,!1,$T,UT,Cv)}function Iv(e){return Cf(e,!1,DT,zT,xv)}function Nd(e){return Cf(e,!0,OT,HT,kv)}function Cf(e,t,n,o,r){if(!jt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=r.get(e);if(a)return a;const s=WT(vT(e));if(s===0)return e;const i=new Proxy(e,s===2?o:n);return r.set(e,i),i}function ui(e){return Ba(e)?ui(e.__v_raw):!!(e&&e.__v_isReactive)}function Ba(e){return!!(e&&e.__v_isReadonly)}function tr(e){return!!(e&&e.__v_isShallow)}function xf(e){return e?!!e.__v_raw:!1}function Rt(e){const t=e&&e.__v_raw;return t?Rt(t):e}function GT(e){return!Mt(e,"__v_skip")&&Object.isExtensible(e)&&iv(e,"__v_skip",!0),e}const Or=e=>jt(e)?lc(e):e,Gi=e=>jt(e)?Nd(e):e;function kn(e){return e?e.__v_isRef===!0:!1}function T(e){return Av(e,!1)}function VT(e){return Av(e,!0)}function Av(e,t){return kn(e)?e:new KT(e,t)}class KT{constructor(t,n){this.dep=new Tf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Rt(t),this._value=n?t:Or(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||tr(t)||Ba(t);t=o?t:Rt(t),Rr(t,n)&&(this._rawValue=t,this._value=o?t:Or(t),this.dep.trigger())}}function h(e){return kn(e)?e.value:e}const YT={get:(e,t,n)=>t==="__v_raw"?e:h(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return kn(r)&&!kn(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function _v(e){return ui(e)?e:new Proxy(e,YT)}class JT{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Tf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ol-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&Bt!==this)return hv(this,!0),!0}get value(){const t=this.dep.track();return gv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function QT(e,t,n=!1){let o,r;return ft(e)?o=e:(o=e.get,r=e.set),new JT(o,r,n)}const vu={},Ou=new WeakMap;let ni;function XT(e,t=!1,n=ni){if(n){let o=Ou.get(n);o||Ou.set(n,o=[]),o.push(e)}}function ZT(e,t,n=Dt){const{immediate:o,deep:r,once:a,scheduler:s,augmentJob:i,call:l}=n,d=H=>r?H:tr(H)||r===!1||r===0?Na(H,1):Na(H);let c,v,f,g,S=!1,P=!1;if(kn(e)?(v=()=>e.value,S=tr(e)):ui(e)?(v=()=>d(e),S=!0):tt(e)?(P=!0,S=e.some(H=>ui(H)||tr(H)),v=()=>e.map(H=>{if(kn(H))return H.value;if(ui(H))return d(H);if(ft(H))return l?l(H,2):H()})):ft(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Da();try{f()}finally{Fa()}}const H=ni;ni=c;try{return l?l(e,3,[g]):e(g)}finally{ni=H}}:v=ca,t&&r){const H=v,he=r===!0?1/0:r;v=()=>Na(H(),he)}const B=_T(),L=()=>{c.stop(),B&&B.active&&mf(B.effects,c)};if(a&&t){const H=t;t=(...he)=>{const de=H(...he);return L(),de}}let j=P?new Array(e.length).fill(vu):vu;const U=H=>{if(!(!(c.flags&1)||!c.dirty&&!H))if(t){const he=c.run();if(H||r||S||(P?he.some((de,W)=>Rr(de,j[W])):Rr(he,j))){f&&f();const de=ni;ni=c;try{const W=[he,j===vu?void 0:P&&j[0]===vu?[]:j,g];j=he,l?l(t,3,W):t(...W)}finally{ni=de}}}else c.run()};return i&&i(U),c=new fv(v),c.scheduler=s?()=>s(U,!1):U,g=H=>XT(H,!1,c),f=c.onStop=()=>{const H=Ou.get(c);if(H){if(l)l(H,4);else for(const he of H)he();Ou.delete(c)}},t?o?U(!0):j=c.run():s?s(U.bind(null,!0),!0):c.run(),L.pause=c.pause.bind(c),L.resume=c.resume.bind(c),L.stop=L,L}function Na(e,t=1/0,n){if(t<=0||!jt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,kn(e))Na(e.value,t,n);else if(tt(e))for(let o=0;o<e.length;o++)Na(e[o],t,n);else if(oc(e)||Di(e))e.forEach(o=>{Na(o,t,n)});else if(sv(e)){for(const o in e)Na(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Na(e[o],t,n)}return e}/**
|
|
11
|
-
* @vue/runtime-core v3.5.40
|
|
12
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
-
* @license MIT
|
|
14
|
-
**/function Vl(e,t,n,o){try{return o?e(...o):e()}catch(r){Kl(r,t,n)}}function or(e,t,n,o){if(ft(e)){const r=Vl(e,t,n,o);return r&&rv(r)&&r.catch(a=>{Kl(a,t,n)}),r}if(tt(e)){const r=[];for(let a=0;a<e.length;a++)r.push(or(e[a],t,n,o));return r}}function Kl(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Dt;if(t){let i=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const c=i.ec;if(c){for(let v=0;v<c.length;v++)if(c[v](e,l,d)===!1)return}i=i.parent}if(a){Da(),Vl(a,null,10,[e,l,d]),Fa();return}}eS(e,n,r,o,s)}function eS(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const co=[];let ia=-1;const Fi=[];let vs=null,Mi=0;const Pv=Promise.resolve();let Du=null;function Nt(e){const t=Du||Pv;return e?t.then(this?e.bind(this):e):t}function tS(e){let t=ia+1,n=co.length;for(;t<n;){const o=t+n>>>1,r=co[o],a=Fl(r);a<e||a===e&&r.flags&2?t=o+1:n=o}return t}function kf(e){if(!(e.flags&1)){const t=Fl(e),n=co[co.length-1];!n||!(e.flags&2)&&t>=Fl(n)?co.push(e):co.splice(tS(t),0,e),e.flags|=1,Rv()}}function Rv(){Du||(Du=Pv.then(Mv))}function nS(e){tt(e)?Fi.push(...e):vs&&e.id===-1?vs.splice(Mi+1,0,e):e.flags&1||(Fi.push(e),e.flags|=1),Rv()}function zp(e,t,n=ia+1){for(;n<co.length;n++){const o=co[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;co.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function Ev(e){if(Fi.length){const t=[...new Set(Fi)].sort((n,o)=>Fl(n)-Fl(o));if(Fi.length=0,vs){vs.push(...t);return}for(vs=t,Mi=0;Mi<vs.length;Mi++){const n=vs[Mi];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}vs=null,Mi=0}}const Fl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Mv(e){try{for(ia=0;ia<co.length;ia++){const t=co[ia];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Vl(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ia<co.length;ia++){const t=co[ia];t&&(t.flags&=-2)}ia=-1,co.length=0,Ev(),Du=null,(co.length||Fi.length)&&Mv()}}let On=null,jv=null;function Fu(e){const t=On;return On=e,jv=e&&e.type.__scopeId||null,t}function dt(e,t=On,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&zu(-1);const a=Fu(t),s=$a.length;let i;try{i=e(...r)}finally{for(let l=$a.length;l>s;l--)Ef();Fu(a),o._d&&zu(1)}return i};return o._n=!0,o._c=!0,o._d=!0,o}function xn(e,t){if(On===null)return e;const n=fc(On),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[a,s,i,l=Dt]=t[r];a&&(ft(a)&&(a={mounted:a,updated:a}),a.deep&&Na(s),o.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function Qs(e,t,n,o){const r=e.dirs,a=t&&t.dirs;for(let s=0;s<r.length;s++){const i=r[s];a&&(i.oldValue=a[s].value);let l=i.dir[o];l&&(Da(),or(l,n,8,[e.el,i,e,t]),Fa())}}function Eu(e,t){if($n){let n=$n.provides;const o=$n.parent&&$n.parent.provides;o===n&&(n=$n.provides=Object.create(o)),n[e]=t}}function Lr(e,t,n=!1){const o=jf();if(o||Ui){let r=Ui?Ui._context.provides:o?o.parent==null||o.ce?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&ft(t)?t.call(o&&o.proxy):t}}const oS=Symbol.for("v-scx"),rS=()=>Lr(oS);function nt(e,t,n){return Lv(e,t,n)}function Lv(e,t,n=Dt){const{immediate:o,deep:r,flush:a,once:s}=n,i=pn({},n),l=t&&o||!t&&a!=="post";let d;if(Yi){if(a==="sync"){const g=rS();d=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=ca,g.resume=ca,g.pause=ca,g}}const c=$n;i.call=(g,S,P)=>or(g,c,S,P);let v=!1;a==="post"?i.scheduler=g=>{lo(g,c&&c.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(g,S)=>{S?g():kf(g)}),i.augmentJob=g=>{t&&(g.flags|=4),v&&(g.flags|=2,c&&(g.id=c.uid,g.i=c))};const f=ZT(e,t,i);return Yi&&(d?d.push(f):l&&f()),f}function aS(e,t,n){const o=this.proxy,r=Vt(e)?e.includes(".")?Nv(o,e):()=>o[e]:e.bind(o,o);let a;ft(t)?a=t:(a=t.handler,n=t);const s=Ql(this),i=Lv(r,a.bind(o),n);return s(),i}function Nv(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r<n.length&&o;r++)o=o[n[r]];return o}}const ps=new WeakMap,$v=Symbol("_vte"),Ov=e=>e.__isTeleport,ri=e=>e&&(e.disabled||e.disabled===""),sS=e=>e&&(e.defer||e.defer===""),Hp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,qp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,$d=(e,t)=>{const n=e&&e.to;return Vt(n)?t?t(n):null:n},iS={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,a,s,i,l,d){const{mc:c,pc:v,pbc:f,o:{insert:g,querySelector:S,createText:P,createComment:B,parentNode:L}}=d,j=ri(t.props);let{dynamicChildren:U}=t;const H=(W,ve,Se)=>{W.shapeFlag&16&&c(W.children,ve,Se,r,a,s,i,l)},he=(W=t)=>{const ve=ri(W.props),Se=W.target=$d(W.props,S),Ae=Od(Se,W,P,g);Se&&(s!=="svg"&&Hp(Se)?s="svg":s!=="mathml"&&qp(Se)&&(s="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(Se),ve||(H(W,Se,Ae),kl(W,!1)))},de=W=>{const ve=()=>{if(ps.get(W)===ve){if(ps.delete(W),ri(W.props)){const Se=L(W.el)||n;H(W,Se,W.anchor),kl(W,!0)}he(W)}};ps.set(W,ve),lo(ve,a)};if(e==null){const W=t.el=P(""),ve=t.anchor=P("");if(g(W,n,o),g(ve,n,o),sS(t.props)||a&&a.pendingBranch){de(t);return}j&&(H(t,n,ve),kl(t,!0)),he()}else{t.el=e.el;const W=t.anchor=e.anchor,ve=ps.get(e);if(ve){ve.flags|=8,ps.delete(e),de(t);return}t.targetStart=e.targetStart;const Se=t.target=e.target,Ae=t.targetAnchor=e.targetAnchor,pe=ri(e.props),Q=pe?n:Se,me=pe?W:Ae;if(s==="svg"||Hp(Se)?s="svg":(s==="mathml"||qp(Se))&&(s="mathml"),U?(f(e.dynamicChildren,U,Q,r,a,s,i),Rf(e,t,!0)):l||v(e,t,Q,me,r,a,s,i,!1),j)pe?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):gu(t,n,W,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ne=$d(t.props,S);ne&&(t.target=ne,gu(t,ne,null,d,0))}else pe&&gu(t,Se,Ae,d,1);kl(t,j)}},remove(e,t,n,{um:o,o:{remove:r}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:d,targetAnchor:c,target:v,props:f}=e,g=ri(f),S=a||!g,P=ps.get(e);if(P&&(P.flags|=8,ps.delete(e)),v&&(r(d),r(c)),a&&r(l),!P&&(g||v)&&s&16)for(let B=0;B<i.length;B++){const L=i[B];o(L,t,n,S,!!L.dynamicChildren)}},move:gu,hydrate:lS};function gu(e,t,n,{o:{insert:o},m:r},a=2){a===0&&o(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:d,props:c}=e,v=a===2;if(v&&o(s,t,n),!ps.has(e)&&(!v||ri(c))&&l&16)for(let f=0;f<d.length;f++)r(d[f],t,n,2);v&&o(i,t,n)}function lS(e,t,n,o,r,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:d,createText:c}},v){function f(B,L){let j=L;for(;j;){if(j&&j.nodeType===8){if(j.data==="teleport start anchor")t.targetStart=j;else if(j.data==="teleport anchor"){t.targetAnchor=j,B._lpa=t.targetAnchor&&s(t.targetAnchor);break}}j=s(j)}}function g(B,L){L.anchor=v(s(B),L,i(B),n,o,r,a)}const S=t.target=$d(t.props,l),P=ri(t.props);if(S){const B=S._lpa||S.firstChild;t.shapeFlag&16&&(P?(g(e,t),f(S,B),t.targetAnchor||Od(S,t,c,d,i(e)===S?e:null)):(t.anchor=s(e),f(S,B),t.targetAnchor||Od(S,t,c,d),v(B&&s(B),t,S,n,o,r,a))),kl(t,P)}else P&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Vi=iS;function kl(e,t){const n=e.ctx;if(n&&n.ut){let o,r;for(t?(o=e.el,r=e.anchor):(o=e.targetStart,r=e.targetAnchor);o&&o!==r;)o.nodeType===1&&o.setAttribute("data-v-owner",n.uid),o=o.nextSibling;n.ut()}}function Od(e,t,n,o,r=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[$v]=s,e&&(o(a,e,r),o(s,e,r)),s}const Zo=Symbol("_leaveCb"),Tl=Symbol("_enterCb");function uS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return pi(()=>{e.isMounted=!0}),_s(()=>{e.isUnmounting=!0}),e}const Xo=[Function,Array],Dv={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Xo,onEnter:Xo,onAfterEnter:Xo,onEnterCancelled:Xo,onBeforeLeave:Xo,onLeave:Xo,onAfterLeave:Xo,onLeaveCancelled:Xo,onBeforeAppear:Xo,onAppear:Xo,onAfterAppear:Xo,onAppearCancelled:Xo},Fv=e=>{const t=e.subTree;return t.component?Fv(t.component):t},cS={name:"BaseTransition",props:Dv,setup(e,{slots:t}){const n=jf(),o=uS();return()=>{const r=t.default&&zv(t.default(),!0),a=r&&r.length?Bv(r):n.subTree?ye():void 0;if(!a)return;const s=Rt(e),{mode:i}=s;if(o.isLeaving)return ad(a);const l=Wp(a);if(!l)return ad(a);let d=Dd(l,s,o,n,v=>d=v);l.type!==Qn&&Bl(l,d);let c=n.subTree&&Wp(n.subTree);if(c&&c.type!==Qn&&!ai(c,l)&&Fv(n).type!==Qn){let v=Dd(c,s,o,n);if(Bl(c,v),i==="out-in"&&l.type!==Qn)return o.isLeaving=!0,v.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,c=void 0},ad(a);i==="in-out"&&l.type!==Qn?v.delayLeave=(f,g,S)=>{const P=Uv(o,c);P[String(c.key)]=c,f[Zo]=()=>{g(),f[Zo]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{S(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return a}}};function Bv(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Qn){t=n;break}}return t}const dS=cS;function Uv(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function Dd(e,t,n,o,r){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:v,onBeforeLeave:f,onLeave:g,onAfterLeave:S,onLeaveCancelled:P,onBeforeAppear:B,onAppear:L,onAfterAppear:j,onAppearCancelled:U}=t,H=String(e.key),he=Uv(n,e),de=(Se,Ae)=>{Se&&or(Se,o,9,Ae)},W=(Se,Ae)=>{const pe=Ae[1];de(Se,Ae),tt(Se)?Se.every(Q=>Q.length<=1)&&pe():Se.length<=1&&pe()},ve={mode:s,persisted:i,beforeEnter(Se){let Ae=l;if(!n.isMounted)if(a)Ae=B||l;else return;Se[Zo]&&Se[Zo](!0);const pe=he[H];pe&&ai(e,pe)&&pe.el[Zo]&&pe.el[Zo](),de(Ae,[Se])},enter(Se){if(he[H]===e)return;let Ae=d,pe=c,Q=v;if(!n.isMounted)if(a)Ae=L||d,pe=j||c,Q=U||v;else return;let me=!1;Se[Tl]=ke=>{me||(me=!0,ke?de(Q,[Se]):de(pe,[Se]),ve.delayedLeave&&ve.delayedLeave(),Se[Tl]=void 0)};const ne=Se[Tl].bind(null,!1);Ae?W(Ae,[Se,ne]):ne()},leave(Se,Ae){const pe=String(e.key);if(Se[Tl]&&Se[Tl](!0),n.isUnmounting)return Ae();de(f,[Se]);let Q=!1;Se[Zo]=ne=>{Q||(Q=!0,Ae(),ne?de(P,[Se]):de(S,[Se]),Se[Zo]=void 0,he[pe]===e&&delete he[pe])};const me=Se[Zo].bind(null,!1);he[pe]=e,g?W(g,[Se,me]):me()},clone(Se){const Ae=Dd(Se,t,n,o,r);return r&&r(Ae),Ae}};return ve}function ad(e){if(Yl(e))return e=ks(e),e.children=null,e}function Wp(e){if(!Yl(e))return Ov(e.type)&&e.children?Bv(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ft(n.default))return n.default()}}function Bl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Bl(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 zv(e,t=!1,n){let o=[],r=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===ot?(s.patchFlag&128&&r++,o=o.concat(zv(s.children,t,i))):(t||s.type!==Qn)&&o.push(i!=null?ks(s,{key:i}):s)}if(r>1)for(let a=0;a<o.length;a++)o[a].patchFlag=-2;return o}function hn(e,t){return ft(e)?pn({name:e.name},t,{setup:e}):e}function If(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Gp(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Bu=new WeakMap;function Ml(e,t,n,o,r=!1){if(tt(e)){e.forEach((P,B)=>Ml(P,t&&(tt(t)?t[B]:t),n,o,r));return}if(Bi(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&Ml(e,t,n,o.component.subTree);return}const a=o.shapeFlag&4?fc(o.component):o.el,s=r?null:a,{i,r:l}=e,d=t&&t.r,c=i.refs===Dt?i.refs={}:i.refs,v=i.setupState,f=Rt(v),g=v===Dt?ov:P=>Gp(c,P)?!1:Mt(f,P),S=(P,B)=>!(B&&Gp(c,B));if(d!=null&&d!==l){if(Vp(t),Vt(d))c[d]=null,g(d)&&(v[d]=null);else if(kn(d)){const P=t;S(d,P.k)&&(d.value=null),P.k&&(c[P.k]=null)}}if(ft(l))Vl(l,i,12,[s,c]);else{const P=Vt(l),B=kn(l);if(P||B){const L=()=>{if(e.f){const j=P?g(l)?v[l]:c[l]:S()||!e.k?l.value:c[e.k];if(r)tt(j)&&mf(j,a);else if(tt(j))j.includes(a)||j.push(a);else if(P)c[l]=[a],g(l)&&(v[l]=c[l]);else{const U=[a];S(l,e.k)&&(l.value=U),e.k&&(c[e.k]=U)}}else P?(c[l]=s,g(l)&&(v[l]=s)):B&&(S(l,e.k)&&(l.value=s),e.k&&(c[e.k]=s))};if(s){const j=()=>{L(),Bu.delete(e)};j.id=-1,Bu.set(e,j),lo(j,n)}else Vp(e),L()}}}function Vp(e){const t=Bu.get(e);t&&(t.flags|=8,Bu.delete(e))}const Kp=e=>e.nodeType===8;sc().requestIdleCallback;sc().cancelIdleCallback;function fS(e,t){if(Kp(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(Kp(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const Bi=e=>!!e.type.__asyncLoader;function Ar(e){ft(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let d=null,c,v=0;const f=()=>(v++,d=null,g()),g=()=>{let S;return d||(S=d=t().catch(P=>{if(P=P instanceof Error?P:new Error(String(P)),l)return new Promise((B,L)=>{l(P,()=>B(f()),()=>L(P),v+1)});throw P}).then(P=>S!==d&&d?d:(P&&(P.__esModule||P[Symbol.toStringTag]==="Module")&&(P=P.default),c=P,P)))};return hn({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(S,P,B){const L=S.isConnected;let j=!1;(P.bu||(P.bu=[])).push(()=>j=!0);const U=()=>{j||!S.parentNode||L&&!S.isConnected||B()},H=a?()=>{const he=a(U,de=>fS(S,de));he&&(P.bum||(P.bum=[])).push(he)}:U;c?H():g().then(()=>!P.isUnmounted&&H())},get __asyncResolved(){return c},setup(){const S=$n;if(If(S),c)return()=>yu(c,S);const P=he=>{d=null,Kl(he,S,13,!o)};if(i&&S.suspense||Yi)return g().then(he=>()=>yu(he,S)).catch(he=>(P(he),()=>o?Oe(o,{error:he}):null));const B=T(!1),L=T(),j=T(!!r);let U,H;return Jl(()=>{U!=null&&clearTimeout(U),H!=null&&clearTimeout(H)}),r&&(H=setTimeout(()=>{S.isUnmounted||(j.value=!1)},r)),s!=null&&(U=setTimeout(()=>{if(!S.isUnmounted&&!B.value&&!L.value){const he=new Error(`Async component timed out after ${s}ms.`);P(he),L.value=he}},s)),g().then(()=>{S.isUnmounted||(B.value=!0,S.parent&&Yl(S.parent.vnode)&&S.parent.update())}).catch(he=>{if(S.isUnmounted){d=null;return}P(he),L.value=he}),()=>{if(B.value&&c)return yu(c,S);if(L.value&&o)return Oe(o,{error:L.value});if(n&&!j.value)return yu(n,S)}}})}function yu(e,t){const{ref:n,props:o,children:r,ce:a}=t.vnode,s=Oe(e,o,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const Yl=e=>e.type.__isKeepAlive;function pS(e,t){Hv(e,"a",t)}function hS(e,t){Hv(e,"da",t)}function Hv(e,t,n=$n){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(uc(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Yl(r.parent.vnode)&&mS(o,t,n,r),r=r.parent}}function mS(e,t,n,o){const r=uc(t,e,o,!0);Jl(()=>{mf(o[t],r)},n)}function uc(e,t,n=$n,o=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Da();const i=Ql(n),l=or(t,n,e,s);return i(),Fa(),l});return o?r.unshift(a):r.push(a),a}}const za=e=>(t,n=$n)=>{(!Yi||e==="sp")&&uc(e,(...o)=>t(...o),n)},vS=za("bm"),pi=za("m"),gS=za("bu"),yS=za("u"),_s=za("bum"),Jl=za("um"),wS=za("sp"),bS=za("rtg"),TS=za("rtc");function SS(e,t=$n){uc("ec",e,t)}const CS="components",qv=Symbol.for("v-ndc");function Af(e){return Vt(e)?xS(CS,e,!1)||e:e||qv}function xS(e,t,n=!0,o=!1){const r=On||$n;if(r){const a=r.type;{const i=iC(a,!1);if(i&&(i===t||i===po(t)||i===ac(po(t))))return a}const s=Yp(r[e]||a[e],t)||Yp(r.appContext[e],t);return!s&&o?a:s}}function Yp(e,t){return e&&(e[t]||e[po(t)]||e[ac(po(t))])}function Zt(e,t,n,o){let r;const a=n,s=tt(e);if(s||Vt(e)){const i=s&&ui(e);let l=!1,d=!1;i&&(l=!tr(e),d=Ba(e),e=ic(e)),r=new Array(e.length);for(let c=0,v=e.length;c<v;c++)r[c]=t(l?d?Gi(Or(e[c])):Or(e[c]):e[c],c,void 0,a)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,a)}else if(jt(e))if(e[Symbol.iterator])r=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);r=new Array(i.length);for(let l=0,d=i.length;l<d;l++){const c=i[l];r[l]=t(e[c],c,l,a)}}else r=[];return r}function _o(e,t,n={},o,r,a){if(On.ce||On.parent&&Bi(On.parent)&&On.parent.ce){const d=a!=null&&n.key==null?pn({},n,{key:a}):n,c=Object.keys(d).length>0;return t!=="default"&&(d.name=t),_(),Qe(ot,null,[Oe("slot",d,o)],c?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=$a.length;_();let l;try{const d=s&&Wv(s(n)),c=n.key||a||d&&d.key;l=Qe(ot,{key:(c&&!$r(c)?c:`_${t}`)+(!d&&o?"_fb":"")},d||(o?o():[]),d&&e._===1?64:-2)}catch(d){for(let c=$a.length;c>i;c--)Ef();throw d}finally{s&&s._c&&(s._d=!0)}return l}function Wv(e){return e.some(t=>Ul(t)?!(t.type===Qn||t.type===ot&&!Wv(t.children)):!0)?e:null}const Fd=e=>e?cg(e)?fc(e):Fd(e.parent):null,jl=pn(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=>Fd(e.parent),$root:e=>Fd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Vv(e),$forceUpdate:e=>e.f||(e.f=()=>{kf(e.update)}),$nextTick:e=>e.n||(e.n=Nt.bind(e.proxy)),$watch:e=>aS.bind(e)}),sd=(e,t)=>e!==Dt&&!e.__isScriptSetup&&Mt(e,t),kS={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(sd(o,t))return s[t]=1,o[t];if(r!==Dt&&Mt(r,t))return s[t]=2,r[t];if(Mt(a,t))return s[t]=3,a[t];if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];Bd&&(s[t]=0)}}const d=jl[t];let c,v;if(d)return t==="$attrs"&&Jn(e.attrs,"get",""),d(e);if((c=i.__cssModules)&&(c=c[t]))return c;if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Mt(v,t))return v[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:a}=e;return sd(r,t)?(r[t]=n,!0):o!==Dt&&Mt(o,t)?(o[t]=n,!0):Mt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:a,type:s}},i){let l;return!!(n[i]||e!==Dt&&i[0]!=="$"&&Mt(e,i)||sd(t,i)||Mt(a,i)||Mt(o,i)||Mt(jl,i)||Mt(r.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Mt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function IS(){return AS().slots}function AS(e){const t=jf();return t.setupContext||(t.setupContext=fg(t))}function Jp(e){return tt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Bd=!0;function _S(e){const t=Vv(e),n=e.proxy,o=e.ctx;Bd=!1,t.beforeCreate&&Qp(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:i,provide:l,inject:d,created:c,beforeMount:v,mounted:f,beforeUpdate:g,updated:S,activated:P,deactivated:B,beforeDestroy:L,beforeUnmount:j,destroyed:U,unmounted:H,render:he,renderTracked:de,renderTriggered:W,errorCaptured:ve,serverPrefetch:Se,expose:Ae,inheritAttrs:pe,components:Q,directives:me,filters:ne}=t;if(d&&PS(d,o,null),s)for(const te in s){const ce=s[te];ft(ce)&&(o[te]=ce.bind(n))}if(r){const te=r.call(n,n);jt(te)&&(e.data=lc(te))}if(Bd=!0,a)for(const te in a){const ce=a[te],Le=ft(ce)?ce.bind(n,n):ft(ce.get)?ce.get.bind(n,n):ca,Pe=!ft(ce)&&ft(ce.set)?ce.set.bind(n):ca,Fe=K({get:Le,set:Pe});Object.defineProperty(o,te,{enumerable:!0,configurable:!0,get:()=>Fe.value,set:Ke=>Fe.value=Ke})}if(i)for(const te in i)Gv(i[te],o,n,te);if(l){const te=ft(l)?l.call(n):l;Reflect.ownKeys(te).forEach(ce=>{Eu(ce,te[ce])})}c&&Qp(c,e,"c");function $e(te,ce){tt(ce)?ce.forEach(Le=>te(Le.bind(n))):ce&&te(ce.bind(n))}if($e(vS,v),$e(pi,f),$e(gS,g),$e(yS,S),$e(pS,P),$e(hS,B),$e(SS,ve),$e(TS,de),$e(bS,W),$e(_s,j),$e(Jl,H),$e(wS,Se),tt(Ae))if(Ae.length){const te=e.exposed||(e.exposed={});Ae.forEach(ce=>{Object.defineProperty(te,ce,{get:()=>n[ce],set:Le=>n[ce]=Le,enumerable:!0})})}else e.exposed||(e.exposed={});he&&e.render===ca&&(e.render=he),pe!=null&&(e.inheritAttrs=pe),Q&&(e.components=Q),me&&(e.directives=me),Se&&If(e)}function PS(e,t,n=ca){tt(e)&&(e=Ud(e));for(const o in e){const r=e[o];let a;jt(r)?"default"in r?a=Lr(r.from||o,r.default,!0):a=Lr(r.from||o):a=Lr(r),kn(a)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[o]=a}}function Qp(e,t,n){or(tt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Gv(e,t,n,o){let r=o.includes(".")?Nv(n,o):()=>n[o];if(Vt(e)){const a=t[e];ft(a)&&nt(r,a)}else if(ft(e))nt(r,e.bind(n));else if(jt(e))if(tt(e))e.forEach(a=>Gv(a,t,n,o));else{const a=ft(e.handler)?e.handler.bind(n):t[e.handler];ft(a)&&nt(r,a,e)}}function Vv(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!r.length&&!n&&!o?l=t:(l={},r.length&&r.forEach(d=>Uu(l,d,s,!0)),Uu(l,t,s)),jt(t)&&a.set(t,l),l}function Uu(e,t,n,o=!1){const{mixins:r,extends:a}=t;a&&Uu(e,a,n,!0),r&&r.forEach(s=>Uu(e,s,n,!0));for(const s in t)if(!(o&&s==="expose")){const i=RS[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const RS={data:Xp,props:Zp,emits:Zp,methods:Il,computed:Il,beforeCreate:io,created:io,beforeMount:io,mounted:io,beforeUpdate:io,updated:io,beforeDestroy:io,beforeUnmount:io,destroyed:io,unmounted:io,activated:io,deactivated:io,errorCaptured:io,serverPrefetch:io,components:Il,directives:Il,watch:MS,provide:Xp,inject:ES};function Xp(e,t){return t?e?function(){return pn(ft(e)?e.call(this,this):e,ft(t)?t.call(this,this):t)}:t:e}function ES(e,t){return Il(Ud(e),Ud(t))}function Ud(e){if(tt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function io(e,t){return e?[...new Set([].concat(e,t))]:t}function Il(e,t){return e?pn(Object.create(null),e,t):t}function Zp(e,t){return e?tt(e)&&tt(t)?[...new Set([...e,...t])]:pn(Object.create(null),Jp(e),Jp(t??{})):t}function MS(e,t){if(!e)return t;if(!t)return e;const n=pn(Object.create(null),e);for(const o in t)n[o]=io(e[o],t[o]);return n}function Kv(){return{app:null,config:{isNativeTag:ov,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 jS=0;function LS(e,t){return function(o,r=null){ft(o)||(o=pn({},o)),r!=null&&!jt(r)&&(r=null);const a=Kv(),s=new WeakSet,i=[];let l=!1;const d=a.app={_uid:jS++,_component:o,_props:r,_container:null,_context:a,_instance:null,version:cC,get config(){return a.config},set config(c){},use(c,...v){return s.has(c)||(c&&ft(c.install)?(s.add(c),c.install(d,...v)):ft(c)&&(s.add(c),c(d,...v))),d},mixin(c){return a.mixins.includes(c)||a.mixins.push(c),d},component(c,v){return v?(a.components[c]=v,d):a.components[c]},directive(c,v){return v?(a.directives[c]=v,d):a.directives[c]},mount(c,v,f){if(!l){const g=d._ceVNode||Oe(o,r);return g.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(g,c,f),l=!0,d._container=c,c.__vue_app__=d,fc(g.component)}},onUnmount(c){i.push(c)},unmount(){l&&(or(i,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,v){return a.provides[c]=v,d},runWithContext(c){const v=Ui;Ui=d;try{return c()}finally{Ui=v}}};return d}}let Ui=null;const NS=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${po(t)}Modifiers`]||e[`${As(t)}Modifiers`];function $S(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Dt;let r=n;const a=t.startsWith("update:"),s=a&&NS(o,t.slice(7));s&&(s.trim&&(r=n.map(c=>Vt(c)?c.trim():c)),s.number&&(r=n.map(gf)));let i,l=o[i=ed(t)]||o[i=ed(po(t))];!l&&a&&(l=o[i=ed(As(t))]),l&&or(l,e,6,r);const d=o[i+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,or(d,e,6,r)}}const OS=new WeakMap;function Yv(e,t,n=!1){const o=n?OS:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const a=e.emits;let s={},i=!1;if(!ft(e)){const l=d=>{const c=Yv(d,t,!0);c&&(i=!0,pn(s,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(jt(e)&&o.set(e,null),null):(tt(a)?a.forEach(l=>s[l]=null):pn(s,a),jt(e)&&o.set(e,s),s)}function cc(e,t){return!e||!tc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Mt(e,t[0].toLowerCase()+t.slice(1))||Mt(e,As(t))||Mt(e,t))}function eh(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[a],slots:s,attrs:i,emit:l,render:d,renderCache:c,props:v,data:f,setupState:g,ctx:S,inheritAttrs:P}=e,B=Fu(e);let L,j;try{if(n.shapeFlag&4){const H=r||o,he=H;L=ua(d.call(he,H,c,v,g,f,S)),j=i}else{const H=t;L=ua(H.length>1?H(v,{attrs:i,slots:s,emit:l}):H(v,null)),j=t.props?i:DS(i)}}catch(H){$a.length=0,Kl(H,e,1),L=Oe(Qn)}let U=L;if(j&&P!==!1){const H=Object.keys(j),{shapeFlag:he}=U;H.length&&he&7&&(a&&H.some(nc)&&(j=FS(j,a)),U=ks(U,j,!1,!0))}return n.dirs&&(U=ks(U,null,!1,!0),U.dirs=U.dirs?U.dirs.concat(n.dirs):n.dirs),n.transition&&Bl(U,n.transition),L=U,Fu(B),L}const DS=e=>{let t;for(const n in e)(n==="class"||n==="style"||tc(n))&&((t||(t={}))[n]=e[n]);return t},FS=(e,t)=>{const n={};for(const o in e)(!nc(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function BS(e,t,n){const{props:o,children:r,component:a}=e,{props:s,children:i,patchFlag:l}=t,d=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return o?th(o,s,d):!!s;if(l&8){const c=t.dynamicProps;for(let v=0;v<c.length;v++){const f=c[v];if(Jv(s,o,f)&&!cc(d,f))return!0}}}else return(r||i)&&(!i||!i.$stable)?!0:o===s?!1:o?s?th(o,s,d):!0:!!s;return!1}function th(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const a=o[r];if(Jv(t,e,a)&&!cc(n,a))return!0}return!1}function Jv(e,t,n){const o=e[n],r=t[n];return n==="style"&&jt(o)&&jt(r)?!Gl(o,r):o!==r}function US({vnode:e,parent:t,suspense:n},o){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=o,e=r),r===e)(e=t.vnode).el=o,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=o)}const Qv={},Xv=()=>Object.create(Qv),Zv=e=>Object.getPrototypeOf(e)===Qv;function zS(e,t,n,o=!1){const r={},a=Xv();e.propsDefaults=Object.create(null),eg(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=o?r:Iv(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function HS(e,t,n,o){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,i=Rt(r),[l]=e.propsOptions;let d=!1;if((o||s>0)&&!(s&16)){if(s&8){const c=e.vnode.dynamicProps;for(let v=0;v<c.length;v++){let f=c[v];if(cc(e.emitsOptions,f))continue;const g=t[f];if(l)if(Mt(a,f))g!==a[f]&&(a[f]=g,d=!0);else{const S=po(f);r[S]=zd(l,i,S,g,e,!1)}else g!==a[f]&&(a[f]=g,d=!0)}}}else{eg(e,t,r,a)&&(d=!0);let c;for(const v in i)(!t||!Mt(t,v)&&((c=As(v))===v||!Mt(t,c)))&&(l?n&&(n[v]!==void 0||n[c]!==void 0)&&(r[v]=zd(l,i,v,void 0,e,!0)):delete r[v]);if(a!==i)for(const v in a)(!t||!Mt(t,v))&&(delete a[v],d=!0)}d&&La(e.attrs,"set","")}function eg(e,t,n,o){const[r,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Pl(l))continue;const d=t[l];let c;r&&Mt(r,c=po(l))?!a||!a.includes(c)?n[c]=d:(i||(i={}))[c]=d:cc(e.emitsOptions,l)||(!(l in o)||d!==o[l])&&(o[l]=d,s=!0)}if(a){const l=Rt(n),d=i||Dt;for(let c=0;c<a.length;c++){const v=a[c];n[v]=zd(r,l,v,d[v],e,!Mt(d,v))}}return s}function zd(e,t,n,o,r,a){const s=e[n];if(s!=null){const i=Mt(s,"default");if(i&&o===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ft(l)){const{propsDefaults:d}=r;if(n in d)o=d[n];else{const c=Ql(r);o=d[n]=l.call(null,t),c()}}else o=l;r.ce&&r.ce._setProp(n,o)}s[0]&&(a&&!i?o=!1:s[1]&&(o===""||o===As(n))&&(o=!0))}return o}const qS=new WeakMap;function tg(e,t,n=!1){const o=n?qS:t.propsCache,r=o.get(e);if(r)return r;const a=e.props,s={},i=[];let l=!1;if(!ft(e)){const c=v=>{l=!0;const[f,g]=tg(v,t,!0);pn(s,f),g&&i.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!a&&!l)return jt(e)&&o.set(e,Oi),Oi;if(tt(a))for(let c=0;c<a.length;c++){const v=po(a[c]);nh(v)&&(s[v]=Dt)}else if(a)for(const c in a){const v=po(c);if(nh(v)){const f=a[c],g=s[v]=tt(f)||ft(f)?{type:f}:pn({},f),S=g.type;let P=!1,B=!0;if(tt(S))for(let L=0;L<S.length;++L){const j=S[L],U=ft(j)&&j.name;if(U==="Boolean"){P=!0;break}else U==="String"&&(B=!1)}else P=ft(S)&&S.name==="Boolean";g[0]=P,g[1]=B,(P||Mt(g,"default"))&&i.push(v)}}const d=[s,i];return jt(e)&&o.set(e,d),d}function nh(e){return e[0]!=="$"&&!Pl(e)}const _f=e=>e==="_"||e==="_ctx"||e==="$stable",Pf=e=>tt(e)?e.map(ua):[ua(e)],WS=(e,t,n)=>{if(t._n)return t;const o=dt((...r)=>Pf(t(...r)),n);return o._c=!1,o},ng=(e,t,n)=>{const o=e._ctx;for(const r in e){if(_f(r))continue;const a=e[r];if(ft(a))t[r]=WS(r,a,o);else if(a!=null){const s=Pf(a);t[r]=()=>s}}},og=(e,t)=>{const n=Pf(t);e.slots.default=()=>n},rg=(e,t,n)=>{for(const o in t)(n||!_f(o))&&(e[o]=t[o])},GS=(e,t,n)=>{const o=e.slots=Xv();if(e.vnode.shapeFlag&32){const r=t._;r?(rg(o,t,n),n&&iv(o,"_",r,!0)):ng(t,o)}else t&&og(e,t)},VS=(e,t,n)=>{const{vnode:o,slots:r}=e;let a=!0,s=Dt;if(o.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:rg(r,t,n):(a=!t.$stable,ng(t,r)),s=t}else t&&(og(e,t),s={default:1});if(a)for(const i in r)!_f(i)&&s[i]==null&&delete r[i]},lo=XS;function KS(e){return YS(e)}function YS(e,t){const n=sc();n.__VUE__=!0;const{insert:o,remove:r,patchProp:a,createElement:s,createText:i,createComment:l,setText:d,setElementText:c,parentNode:v,nextSibling:f,setScopeId:g=ca,insertStaticContent:S}=e,P=(A,M,z,Z=null,ue=null,re=null,je=void 0,Re=null,xe=!!M.dynamicChildren)=>{if(A===M)return;A&&!ai(A,M)&&(Z=N(A),Ke(A,ue,re,!0),A=null),M.patchFlag===-2&&(xe=!1,M.dynamicChildren=null);const{type:ge,ref:Ve,shapeFlag:Ne}=M;switch(ge){case dc:B(A,M,z,Z);break;case Qn:L(A,M,z,Z);break;case Mu:A==null&&j(M,z,Z,je);break;case ot:Q(A,M,z,Z,ue,re,je,Re,xe);break;default:Ne&1?he(A,M,z,Z,ue,re,je,Re,xe):Ne&6?me(A,M,z,Z,ue,re,je,Re,xe):(Ne&64||Ne&128)&&ge.process(A,M,z,Z,ue,re,je,Re,xe,Ee)}Ve!=null&&ue?Ml(Ve,A&&A.ref,re,M||A,!M):Ve==null&&A&&A.ref!=null&&Ml(A.ref,null,re,A,!0)},B=(A,M,z,Z)=>{if(A==null)o(M.el=i(M.children),z,Z);else{const ue=M.el=A.el;M.children!==A.children&&d(ue,M.children)}},L=(A,M,z,Z)=>{A==null?o(M.el=l(M.children||""),z,Z):M.el=A.el},j=(A,M,z,Z)=>{[A.el,A.anchor]=S(A.children,M,z,Z,A.el,A.anchor)},U=({el:A,anchor:M},z,Z)=>{let ue;for(;A&&A!==M;)ue=f(A),o(A,z,Z),A=ue;o(M,z,Z)},H=({el:A,anchor:M})=>{let z;for(;A&&A!==M;)z=f(A),r(A),A=z;r(M)},he=(A,M,z,Z,ue,re,je,Re,xe)=>{if(M.type==="svg"?je="svg":M.type==="math"&&(je="mathml"),A==null)de(M,z,Z,ue,re,je,Re,xe);else{const ge=A.el&&A.el._isVueCE?A.el:null;try{ge&&ge._beginPatch(),Se(A,M,ue,re,je,Re,xe)}finally{ge&&ge._endPatch()}}},de=(A,M,z,Z,ue,re,je,Re)=>{let xe,ge;const{props:Ve,shapeFlag:Ne,transition:He,dirs:Ue}=A;if(xe=A.el=s(A.type,re,Ve&&Ve.is,Ve),Ne&8?c(xe,A.children):Ne&16&&ve(A.children,xe,null,Z,ue,id(A,re),je,Re),Ue&&Qs(A,null,Z,"created"),W(xe,A,A.scopeId,je,Z),Ve){for(const et in Ve)et!=="value"&&!Pl(et)&&a(xe,et,null,Ve[et],re,Z);"value"in Ve&&a(xe,"value",null,Ve.value,re),(ge=Ve.onVnodeBeforeMount)&&sa(ge,Z,A)}Ue&&Qs(A,null,Z,"beforeMount");const Je=JS(ue,He);Je&&He.beforeEnter(xe),o(xe,M,z),((ge=Ve&&Ve.onVnodeMounted)||Je||Ue)&&lo(()=>{try{ge&&sa(ge,Z,A),Je&&He.enter(xe),Ue&&Qs(A,null,Z,"mounted")}finally{}},ue)},W=(A,M,z,Z,ue)=>{if(z&&g(A,z),Z)for(let re=0;re<Z.length;re++)g(A,Z[re]);if(ue){let re=ue.subTree;if(M===re||ig(re.type)&&(re.ssContent===M||re.ssFallback===M)){const je=ue.vnode;W(A,je,je.scopeId,je.slotScopeIds,ue.parent)}}},ve=(A,M,z,Z,ue,re,je,Re,xe=0)=>{for(let ge=xe;ge<A.length;ge++){const Ve=A[ge]=Re?ja(A[ge]):ua(A[ge]);P(null,Ve,M,z,Z,ue,re,je,Re)}},Se=(A,M,z,Z,ue,re,je)=>{const Re=M.el=A.el;let{patchFlag:xe,dynamicChildren:ge,dirs:Ve}=M;xe|=A.patchFlag&16;const Ne=A.props||Dt,He=M.props||Dt;let Ue;if(z&&Xs(z,!1),(Ue=He.onVnodeBeforeUpdate)&&sa(Ue,z,M,A),Ve&&Qs(M,A,z,"beforeUpdate"),z&&Xs(z,!0),ge&&(!A.dynamicChildren||A.dynamicChildren.length!==ge.length)&&(xe=0,je=!1,ge=null),(Ne.innerHTML&&He.innerHTML==null||Ne.textContent&&He.textContent==null)&&c(Re,""),ge?Ae(A.dynamicChildren,ge,Re,z,Z,id(M,ue),re):je||ce(A,M,Re,null,z,Z,id(M,ue),re,!1),xe>0){if(xe&16)pe(Re,Ne,He,z,ue);else if(xe&2&&Ne.class!==He.class&&a(Re,"class",null,He.class,ue),xe&4&&a(Re,"style",Ne.style,He.style,ue),xe&8){const Je=M.dynamicProps;for(let et=0;et<Je.length;et++){const st=Je[et],mt=Ne[st],q=He[st];(q!==mt||st==="value")&&a(Re,st,mt,q,ue,z)}}xe&1&&A.children!==M.children&&c(Re,M.children)}else!je&&ge==null&&pe(Re,Ne,He,z,ue);((Ue=He.onVnodeUpdated)||Ve)&&lo(()=>{Ue&&sa(Ue,z,M,A),Ve&&Qs(M,A,z,"updated")},Z)},Ae=(A,M,z,Z,ue,re,je)=>{for(let Re=0;Re<M.length;Re++){const xe=A[Re],ge=M[Re],Ve=xe.el&&(xe.type===ot||!ai(xe,ge)||xe.shapeFlag&198)?v(xe.el):z;P(xe,ge,Ve,null,Z,ue,re,je,!0)}},pe=(A,M,z,Z,ue)=>{if(M!==z){if(M!==Dt)for(const re in M)!Pl(re)&&!(re in z)&&a(A,re,M[re],null,ue,Z);for(const re in z){if(Pl(re))continue;const je=z[re],Re=M[re];je!==Re&&re!=="value"&&a(A,re,Re,je,ue,Z)}"value"in z&&a(A,"value",M.value,z.value,ue)}},Q=(A,M,z,Z,ue,re,je,Re,xe)=>{const ge=M.el=A?A.el:i(""),Ve=M.anchor=A?A.anchor:i("");let{patchFlag:Ne,dynamicChildren:He,slotScopeIds:Ue}=M;Ue&&(Re=Re?Re.concat(Ue):Ue),A==null?(o(ge,z,Z),o(Ve,z,Z),ve(M.children||[],z,Ve,ue,re,je,Re,xe)):Ne>0&&Ne&64&&He&&A.dynamicChildren&&A.dynamicChildren.length===He.length?(Ae(A.dynamicChildren,He,z,ue,re,je,Re),(M.key!=null||ue&&M===ue.subTree)&&Rf(A,M,!0)):ce(A,M,z,Ve,ue,re,je,Re,xe)},me=(A,M,z,Z,ue,re,je,Re,xe)=>{M.slotScopeIds=Re,A==null?M.shapeFlag&512?ue.ctx.activate(M,z,Z,je,xe):ne(M,z,Z,ue,re,je,xe):ke(A,M,xe)},ne=(A,M,z,Z,ue,re,je)=>{const Re=A.component=oC(A,Z,ue);if(Yl(A)&&(Re.ctx.renderer=Ee),rC(Re,!1,je),Re.asyncDep){if(ue&&ue.registerDep(Re,$e,je),!A.el){const xe=Re.subTree=Oe(Qn);L(null,xe,M,z),A.placeholder=xe.el}}else $e(Re,A,M,z,ue,re,je)},ke=(A,M,z)=>{const Z=M.component=A.component;if(BS(A,M,z))if(Z.asyncDep&&!Z.asyncResolved){te(Z,M,z);return}else Z.next=M,Z.update();else M.el=A.el,Z.vnode=M},$e=(A,M,z,Z,ue,re,je)=>{const Re=()=>{if(A.isMounted){let{next:Ne,bu:He,u:Ue,parent:Je,vnode:et}=A;{const _e=ag(A);if(_e){Ne&&(Ne.el=et.el,te(A,Ne,je)),_e.asyncDep.then(()=>{lo(()=>{A.isUnmounted||ge()},ue)});return}}let st=Ne,mt;Xs(A,!1),Ne?(Ne.el=et.el,te(A,Ne,je)):Ne=et,He&&Ru(He),(mt=Ne.props&&Ne.props.onVnodeBeforeUpdate)&&sa(mt,Je,Ne,et),Xs(A,!0);const q=eh(A),ae=A.subTree;A.subTree=q,P(ae,q,v(ae.el),N(ae),A,ue,re),Ne.el=q.el,st===null&&US(A,q.el),Ue&&lo(Ue,ue),(mt=Ne.props&&Ne.props.onVnodeUpdated)&&lo(()=>sa(mt,Je,Ne,et),ue)}else{let Ne;const{el:He,props:Ue}=M,{bm:Je,m:et,parent:st,root:mt,type:q}=A,ae=Bi(M);Xs(A,!1),Je&&Ru(Je),!ae&&(Ne=Ue&&Ue.onVnodeBeforeMount)&&sa(Ne,st,M),Xs(A,!0);{mt.ce&&mt.ce._hasShadowRoot()&&mt.ce._injectChildStyle(q,A.parent?A.parent.type:void 0);const _e=A.subTree=eh(A);P(null,_e,z,Z,A,ue,re),M.el=_e.el}if(et&&lo(et,ue),!ae&&(Ne=Ue&&Ue.onVnodeMounted)){const _e=M;lo(()=>sa(Ne,st,_e),ue)}(M.shapeFlag&256||st&&Bi(st.vnode)&&st.vnode.shapeFlag&256)&&A.a&&lo(A.a,ue),A.isMounted=!0,M=z=Z=null}};A.scope.on();const xe=A.effect=new fv(Re);A.scope.off();const ge=A.update=xe.run.bind(xe),Ve=A.job=xe.runIfDirty.bind(xe);Ve.i=A,Ve.id=A.uid,xe.scheduler=()=>kf(Ve),Xs(A,!0),ge()},te=(A,M,z)=>{M.component=A;const Z=A.vnode.props;A.vnode=M,A.next=null,HS(A,M.props,Z,z),VS(A,M.children,z),Da(),zp(A),Fa()},ce=(A,M,z,Z,ue,re,je,Re,xe=!1)=>{const ge=A&&A.children,Ve=A?A.shapeFlag:0,Ne=M.children,{patchFlag:He,shapeFlag:Ue}=M;if(He>0){if(He&128){Pe(ge,Ne,z,Z,ue,re,je,Re,xe);return}else if(He&256){Le(ge,Ne,z,Z,ue,re,je,Re,xe);return}}Ue&8?(Ve&16&&fe(ge,ue,re),Ne!==ge&&c(z,Ne)):Ve&16?Ue&16?Pe(ge,Ne,z,Z,ue,re,je,Re,xe):fe(ge,ue,re,!0):(Ve&8&&c(z,""),Ue&16&&ve(Ne,z,Z,ue,re,je,Re,xe))},Le=(A,M,z,Z,ue,re,je,Re,xe)=>{A=A||Oi,M=M||Oi;const ge=A.length,Ve=M.length,Ne=Math.min(ge,Ve);let He;for(He=0;He<Ne;He++){const Ue=M[He]=xe?ja(M[He]):ua(M[He]);P(A[He],Ue,z,null,ue,re,je,Re,xe)}ge>Ve?fe(A,ue,re,!0,!1,Ne):ve(M,z,Z,ue,re,je,Re,xe,Ne)},Pe=(A,M,z,Z,ue,re,je,Re,xe)=>{let ge=0;const Ve=M.length;let Ne=A.length-1,He=Ve-1;for(;ge<=Ne&&ge<=He;){const Ue=A[ge],Je=M[ge]=xe?ja(M[ge]):ua(M[ge]);if(ai(Ue,Je))P(Ue,Je,z,null,ue,re,je,Re,xe);else break;ge++}for(;ge<=Ne&&ge<=He;){const Ue=A[Ne],Je=M[He]=xe?ja(M[He]):ua(M[He]);if(ai(Ue,Je))P(Ue,Je,z,null,ue,re,je,Re,xe);else break;Ne--,He--}if(ge>Ne){if(ge<=He){const Ue=He+1,Je=Ue<Ve?M[Ue].el:Z;for(;ge<=He;)P(null,M[ge]=xe?ja(M[ge]):ua(M[ge]),z,Je,ue,re,je,Re,xe),ge++}}else if(ge>He)for(;ge<=Ne;)Ke(A[ge],ue,re,!0),ge++;else{const Ue=ge,Je=ge,et=new Map;for(ge=Je;ge<=He;ge++){const Tt=M[ge]=xe?ja(M[ge]):ua(M[ge]);Tt.key!=null&&et.set(Tt.key,ge)}let st,mt=0;const q=He-Je+1;let ae=!1,_e=0;const Ye=new Array(q);for(ge=0;ge<q;ge++)Ye[ge]=0;for(ge=Ue;ge<=Ne;ge++){const Tt=A[ge];if(mt>=q){Ke(Tt,ue,re,!0);continue}let At;if(Tt.key!=null)At=et.get(Tt.key);else for(st=Je;st<=He;st++)if(Ye[st-Je]===0&&ai(Tt,M[st])){At=st;break}At===void 0?Ke(Tt,ue,re,!0):(Ye[At-Je]=ge+1,At>=_e?_e=At:ae=!0,P(Tt,M[At],z,null,ue,re,je,Re,xe),mt++)}const bt=ae?QS(Ye):Oi;for(st=bt.length-1,ge=q-1;ge>=0;ge--){const Tt=Je+ge,At=M[Tt],Br=M[Tt+1],zt=Tt+1<Ve?Br.el||sg(Br):Z;Ye[ge]===0?P(null,At,z,zt,ue,re,je,Re,xe):ae&&(st<0||ge!==bt[st]?Fe(At,z,zt,2):st--)}}},Fe=(A,M,z,Z,ue=null)=>{const{el:re,type:je,transition:Re,children:xe,shapeFlag:ge}=A;if(ge&6){Fe(A.component.subTree,M,z,Z);return}if(ge&128){A.suspense.move(M,z,Z);return}if(ge&64){je.move(A,M,z,Ee);return}if(je===ot){o(re,M,z);for(let Ne=0;Ne<xe.length;Ne++)Fe(xe[Ne],M,z,Z);o(A.anchor,M,z);return}if(je===Mu){U(A,M,z);return}if(Z!==2&&ge&1&&Re)if(Z===0)Re.persisted&&!re[Zo]?o(re,M,z):(Re.beforeEnter(re),o(re,M,z),lo(()=>Re.enter(re),ue));else{const{leave:Ne,delayLeave:He,afterLeave:Ue}=Re,Je=()=>{A.ctx.isUnmounted?r(re):o(re,M,z)},et=()=>{const st=re._isLeaving||!!re[Zo];re._isLeaving&&re[Zo](!0),Re.persisted&&!st?Je():Ne(re,()=>{Je(),Ue&&Ue()})};He?He(re,Je,et):et()}else o(re,M,z)},Ke=(A,M,z,Z=!1,ue=!1)=>{const{type:re,props:je,ref:Re,children:xe,dynamicChildren:ge,shapeFlag:Ve,patchFlag:Ne,dirs:He,cacheIndex:Ue,memo:Je}=A;if(Ne===-2&&(ue=!1),Re!=null&&(Da(),Ml(Re,null,z,A,!0),Fa()),Ue!=null&&(M.renderCache[Ue]=void 0),Ve&256){M.ctx.deactivate(A);return}const et=Ve&1&&He,st=!Bi(A);let mt;if(st&&(mt=je&&je.onVnodeBeforeUnmount)&&sa(mt,M,A),Ve&6)ut(A.component,z,Z);else{if(Ve&128){A.suspense.unmount(z,Z);return}et&&Qs(A,null,M,"beforeUnmount"),Ve&64?A.type.remove(A,M,z,Ee,Z):ge&&!ge.hasOnce&&(re!==ot||Ne>0&&Ne&64)?fe(ge,M,z,!1,!0):(re===ot&&Ne&384||!ue&&Ve&16)&&fe(xe,M,z),Z&<(A)}const q=Je!=null&&Ue==null;(st&&(mt=je&&je.onVnodeUnmounted)||et||q)&&lo(()=>{mt&&sa(mt,M,A),et&&Qs(A,null,M,"unmounted"),q&&(A.el=null)},z)},lt=A=>{const{type:M,el:z,anchor:Z,transition:ue}=A;if(M===ot){Ze(z,Z);return}if(M===Mu){H(A);return}const re=()=>{r(z),ue&&!ue.persisted&&ue.afterLeave&&ue.afterLeave()};if(A.shapeFlag&1&&ue&&!ue.persisted){const{leave:je,delayLeave:Re}=ue,xe=()=>je(z,re);Re?Re(A.el,re,xe):xe()}else re()},Ze=(A,M)=>{let z;for(;A!==M;)z=f(A),r(A),A=z;r(M)},ut=(A,M,z)=>{const{bum:Z,scope:ue,job:re,subTree:je,um:Re,m:xe,a:ge}=A;oh(xe),oh(ge),Z&&Ru(Z),ue.stop(),re&&(re.flags|=8,Ke(je,A,M,z)),Re&&lo(Re,M),lo(()=>{A.isUnmounted=!0},M)},fe=(A,M,z,Z=!1,ue=!1,re=0)=>{for(let je=re;je<A.length;je++)Ke(A[je],M,z,Z,ue)},N=A=>{if(A.shapeFlag&6)return N(A.component.subTree);if(A.shapeFlag&128)return A.suspense.next();const M=f(A.anchor||A.el),z=M&&M[$v];return z?f(z):M};let oe=!1;const le=(A,M,z)=>{let Z;A==null?M._vnode&&(Ke(M._vnode,null,null,!0),Z=M._vnode.component):P(M._vnode||null,A,M,null,null,null,z),M._vnode=A,oe||(oe=!0,zp(Z),Ev(),oe=!1)},Ee={p:P,um:Ke,m:Fe,r:lt,mt:ne,mc:ve,pc:ce,pbc:Ae,n:N,o:e};return{render:le,hydrate:void 0,createApp:LS(le)}}function id({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 Xs({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function JS(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Rf(e,t,n=!1){const o=e.children,r=t.children;if(tt(o)&&tt(r))for(let a=0;a<o.length;a++){const s=o[a];let i=r[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=r[a]=ja(r[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Rf(s,i)),i.type===dc&&(i.patchFlag===-1&&(i=r[a]=ja(i)),i.el=s.el),i.type===Qn&&!i.el&&(i.el=s.el)}}function QS(e){const t=e.slice(),n=[0];let o,r,a,s,i;const l=e.length;for(o=0;o<l;o++){const d=e[o];if(d!==0){if(r=n[n.length-1],e[r]<d){t[o]=r,n.push(o);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<d?a=i+1:s=i;d<e[n[a]]&&(a>0&&(t[o]=n[a-1]),n[a]=o)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function ag(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ag(t)}function oh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function sg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?sg(t.subTree):null}const ig=e=>e.__isSuspense;function XS(e,t){t&&t.pendingBranch?tt(e)?t.effects.push(...e):t.effects.push(e):nS(e)}const ot=Symbol.for("v-fgt"),dc=Symbol.for("v-txt"),Qn=Symbol.for("v-cmt"),Mu=Symbol.for("v-stc"),$a=[];let fo=null;function _(e=!1){$a.push(fo=e?null:[])}function Ef(){$a.pop(),fo=$a[$a.length-1]||null}let Ki=1;function zu(e,t=!1){Ki+=e,e<0&&fo&&t&&(fo.hasOnce=!0)}function lg(e){return e.dynamicChildren=Ki>0?fo||Oi:null,Ef(),Ki>0&&fo&&fo.push(e),e}function F(e,t,n,o,r,a){return lg(w(e,t,n,o,r,a,!0))}function Qe(e,t,n,o,r){return lg(Oe(e,t,n,o,r,!0))}function Ul(e){return e?e.__v_isVNode===!0:!1}function ai(e,t){return e.type===t.type&&e.key===t.key}const ug=({key:e})=>e??null,ju=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Vt(e)||kn(e)||ft(e)?{i:On,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,o=0,r=null,a=e===ot?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ug(t),ref:t&&ju(t),scopeId:jv,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:On};return i?(Hu(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Vt(n)?8:16),Ki>0&&!s&&fo&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&fo.push(l),l}const Oe=ZS;function ZS(e,t=null,n=null,o=0,r=null,a=!1){if((!e||e===qv)&&(e=Qn),Ul(e)){const i=ks(e,t,!0);return n&&Hu(i,n),Ki>0&&!a&&fo&&(i.shapeFlag&6?fo[fo.indexOf(e)]=i:fo.push(i)),i.patchFlag=-2,i}if(lC(e)&&(e=e.__vccOpts),t){t=eC(t);let{class:i,style:l}=t;i&&!Vt(i)&&(t.class=at(i)),jt(l)&&(xf(l)&&!tt(l)&&(l=pn({},l)),t.style=er(l))}const s=Vt(e)?1:ig(e)?128:Ov(e)?64:jt(e)?4:ft(e)?2:0;return w(e,t,n,o,r,s,a,!0)}function eC(e){return e?xf(e)||Zv(e)?pn({},e):e:null}function ks(e,t,n=!1,o=!1){const{props:r,ref:a,patchFlag:s,children:i,transition:l}=e,d=t?Mf(r||{},t):r,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&ug(d),ref:t&&t.ref?n&&a?tt(a)?a.concat(ju(t)):[a,ju(t)]:ju(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!==ot?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&&ks(e.ssContent),ssFallback:e.ssFallback&&ks(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&o&&Bl(c,l.clone(c)),c}function ws(e=" ",t=0){return Oe(dc,null,e,t)}function CD(e,t){const n=Oe(Mu,null,e);return n.staticCount=t,n}function ye(e="",t=!1){return t?(_(),Qe(Qn,null,e)):Oe(Qn,null,e)}function ua(e){return e==null||typeof e=="boolean"?Oe(Qn):tt(e)?Oe(ot,null,e.slice()):Ul(e)?ja(e):Oe(dc,null,String(e))}function ja(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ks(e)}function Hu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(tt(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Hu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Zv(t)?t._ctx=On:r===3&&On&&(On.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ft(t)){if(o&65){Hu(e,{default:t});return}t={default:t,_ctx:On},n=32}else t=String(t),o&64?(n=16,t=[ws(t)]):n=8;e.children=t,e.shapeFlag|=n}function Mf(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const r in o)if(r==="class")t.class!==o.class&&(t.class=at([t.class,o.class]));else if(r==="style")t.style=er([t.style,o.style]);else if(tc(r)){const a=t[r],s=o[r];s&&a!==s&&!(tt(a)&&a.includes(s))?t[r]=a?[].concat(a,s):s:s==null&&a==null&&!nc(r)&&(t[r]=s)}else r!==""&&(t[r]=o[r])}return t}function sa(e,t,n,o=null){or(e,t,7,[n,o])}const tC=Kv();let nC=0;function oC(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||tC,a={uid:nC++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new AT(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:tg(o,r),emitsOptions:Yv(o,r),emit:null,emitted:null,propsDefaults:Dt,inheritAttrs:o.inheritAttrs,ctx:Dt,data:Dt,props:Dt,attrs:Dt,slots:Dt,refs:Dt,setupState:Dt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=$S.bind(null,a),e.ce&&e.ce(a),a}let $n=null;const jf=()=>$n||On;let qu,Hd;{const e=sc(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};qu=t("__VUE_INSTANCE_SETTERS__",n=>$n=n),Hd=t("__VUE_SSR_SETTERS__",n=>Yi=n)}const Ql=e=>{const t=$n;return qu(e),e.scope.on(),()=>{e.scope.off(),qu(t)}},rh=()=>{$n&&$n.scope.off(),qu(null)};function cg(e){return e.vnode.shapeFlag&4}let Yi=!1;function rC(e,t=!1,n=!1){t&&Hd(t);const{props:o,children:r}=e.vnode,a=cg(e);zS(e,o,a,t),GS(e,r,n||t);const s=a?aC(e,t):void 0;return t&&Hd(!1),s}function aC(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,kS);const{setup:o}=n;if(o){Da();const r=e.setupContext=o.length>1?fg(e):null,a=Ql(e),s=Vl(o,e,0,[e.props,r]),i=rv(s);if(Fa(),a(),(i||e.sp)&&!Bi(e)&&If(e),i){if(s.then(rh,rh),t)return s.then(l=>{ah(e,l)}).catch(l=>{Kl(l,e,0)});e.asyncDep=s}else ah(e,s)}else dg(e)}function ah(e,t,n){ft(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:jt(t)&&(e.setupState=_v(t)),dg(e)}function dg(e,t,n){const o=e.type;e.render||(e.render=o.render||ca);{const r=Ql(e);Da();try{_S(e)}finally{Fa(),r()}}}const sC={get(e,t){return Jn(e,"get",""),e[t]}};function fg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,sC),slots:e.slots,emit:e.emit,expose:t}}function fc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(_v(GT(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in jl)return jl[n](e)},has(t,n){return n in t||n in jl}})):e.proxy}function iC(e,t=!0){return ft(e)?e.displayName||e.name:e.name||t&&e.__name}function lC(e){return ft(e)&&"__vccOpts"in e}const K=(e,t)=>QT(e,t,Yi);function Lf(e,t,n){try{zu(-1);const o=arguments.length;return o===2?jt(t)&&!tt(t)?Ul(t)?Oe(e,null,[t]):Oe(e,t):Oe(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Ul(n)&&(n=[n]),Oe(e,t,n))}finally{zu(1)}}function xD(e,t,n,o){const r=n[o];if(r&&uC(r,e))return r;const a=t();return a.memo=e.slice(),a.cacheIndex=o,n[o]=a}function uC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(Rr(n[o],t[o]))return!1;return Ki>0&&fo&&fo.push(e),!0}const cC="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 qd;const sh=typeof window<"u"&&window.trustedTypes;if(sh)try{qd=sh.createPolicy("vue",{createHTML:e=>e})}catch{}const pg=qd?e=>qd.createHTML(e):e=>e,dC="http://www.w3.org/2000/svg",fC="http://www.w3.org/1998/Math/MathML",Ma=typeof document<"u"?document:null,ih=Ma&&Ma.createElement("template"),pC={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r=t==="svg"?Ma.createElementNS(dC,e):t==="mathml"?Ma.createElementNS(fC,e):n?Ma.createElement(e,{is:n}):Ma.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>Ma.createTextNode(e),createComment:e=>Ma.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ma.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{ih.innerHTML=pg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const i=ih.content;if(o==="svg"||o==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ds="transition",Sl="animation",zl=Symbol("_vtc"),hg={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},hC=pn({},Dv,hg),mC=e=>(e.displayName="Transition",e.props=hC,e),Xl=mC((e,{slots:t})=>Lf(dS,vC(e),t)),Zs=(e,t=[])=>{tt(e)?e.forEach(n=>n(...t)):e&&e(...t)},lh=e=>e?tt(e)?e.some(t=>t.length>1):e.length>1:!1;function vC(e){const t={};for(const Q in e)Q in hg||(t[Q]=e[Q]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:d=s,appearToClass:c=i,leaveFromClass:v=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,S=gC(r),P=S&&S[0],B=S&&S[1],{onBeforeEnter:L,onEnter:j,onEnterCancelled:U,onLeave:H,onLeaveCancelled:he,onBeforeAppear:de=L,onAppear:W=j,onAppearCancelled:ve=U}=t,Se=(Q,me,ne,ke)=>{Q._enterCancelled=ke,ei(Q,me?c:i),ei(Q,me?d:s),ne&&ne()},Ae=(Q,me)=>{Q._isLeaving=!1,ei(Q,v),ei(Q,g),ei(Q,f),me&&me()},pe=Q=>(me,ne)=>{const ke=Q?W:j,$e=()=>Se(me,Q,ne);Zs(ke,[me,$e]),uh(()=>{ei(me,Q?l:a),Pa(me,Q?c:i),lh(ke)||ch(me,o,P,$e)})};return pn(t,{onBeforeEnter(Q){Zs(L,[Q]),Pa(Q,a),Pa(Q,s)},onBeforeAppear(Q){Zs(de,[Q]),Pa(Q,l),Pa(Q,d)},onEnter:pe(!1),onAppear:pe(!0),onLeave(Q,me){Q._isLeaving=!0;const ne=()=>Ae(Q,me);Pa(Q,v),Q._enterCancelled?(Pa(Q,f),ph(Q)):(ph(Q),Pa(Q,f)),uh(()=>{Q._isLeaving&&(ei(Q,v),Pa(Q,g),lh(H)||ch(Q,o,B,ne))}),Zs(H,[Q,ne])},onEnterCancelled(Q){Se(Q,!1,void 0,!0),Zs(U,[Q])},onAppearCancelled(Q){Se(Q,!0,void 0,!0),Zs(ve,[Q])},onLeaveCancelled(Q){Ae(Q),Zs(he,[Q])}})}function gC(e){if(e==null)return null;if(jt(e))return[ld(e.enter),ld(e.leave)];{const t=ld(e);return[t,t]}}function ld(e){return wT(e)}function Pa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[zl]||(e[zl]=new Set)).add(t)}function ei(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[zl];n&&(n.delete(t),n.size||(e[zl]=void 0))}function uh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let yC=0;function ch(e,t,n,o){const r=e._endId=++yC,a=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=wC(e,t);if(!s)return o();const d=s+"end";let c=0;const v=()=>{e.removeEventListener(d,f),a()},f=g=>{g.target===e&&++c>=l&&v()};setTimeout(()=>{c<l&&v()},i+1),e.addEventListener(d,f)}function wC(e,t){const n=window.getComputedStyle(e),o=S=>(n[S]||"").split(", "),r=o(`${ds}Delay`),a=o(`${ds}Duration`),s=dh(r,a),i=o(`${Sl}Delay`),l=o(`${Sl}Duration`),d=dh(i,l);let c=null,v=0,f=0;t===ds?s>0&&(c=ds,v=s,f=a.length):t===Sl?d>0&&(c=Sl,v=d,f=l.length):(v=Math.max(s,d),c=v>0?s>d?ds:Sl:null,f=c?c===ds?a.length:l.length:0);const g=c===ds&&/\b(?:transform|all)(?:,|$)/.test(o(`${ds}Property`).toString());return{type:c,timeout:v,propCount:f,hasTransform:g}}function dh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>fh(n)+fh(e[o])))}function fh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ph(e){return(e?e.ownerDocument:document).body.offsetHeight}function bC(e,t,n){const o=e[zl];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Wu=Symbol("_vod"),mg=Symbol("_vsh"),kD={name:"show",beforeMount(e,{value:t},{transition:n}){e[Wu]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Cl(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),Cl(e,!0),o.enter(e)):o.leave(e,()=>{Cl(e,!1)}):Cl(e,t))},beforeUnmount(e,{value:t}){Cl(e,t)}};function Cl(e,t){e.style.display=t?e[Wu]:"none",e[mg]=!t}const TC=Symbol(""),SC=/(?:^|;)\s*display\s*:/;function CC(e,t,n){const o=e.style,r=Vt(n);let a=!1;if(n&&!r){if(t)if(Vt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Al(o,i,"")}else for(const s in t)n[s]==null&&Al(o,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?kC(e,s,!Vt(t)&&t?t[s]:void 0,i)||Al(o,s,i):Al(o,s,"")}}else if(r){if(t!==n){const s=o[TC];s&&(n+=";"+s),o.cssText=n,a=SC.test(n)}}else t&&e.removeAttribute("style");Wu in e&&(e[Wu]=a?o.display:"",e[mg]&&(o.display="none"))}const hh=/\s*!important$/;function Al(e,t,n){if(tt(n))n.forEach(o=>Al(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=xC(e,t);hh.test(n)?e.setProperty(As(o),n.replace(hh,""),"important"):e[o]=n}}const mh=["Webkit","Moz","ms"],ud={};function xC(e,t){const n=ud[t];if(n)return n;let o=po(t);if(o!=="filter"&&o in e)return ud[t]=o;o=ac(o);for(let r=0;r<mh.length;r++){const a=mh[r]+o;if(a in e)return ud[t]=a}return t}function kC(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Vt(o)&&n===o}const vh="http://www.w3.org/1999/xlink";function gh(e,t,n,o,r,a=kT(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(vh,t.slice(6,t.length)):e.setAttributeNS(vh,t,n):n==null||a&&!lv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":$r(n)?String(n):n)}function yh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?pg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=lv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(r||t)}function si(e,t,n,o){e.addEventListener(t,n,o)}function IC(e,t,n,o){e.removeEventListener(t,n,o)}const wh=Symbol("_vei");function AC(e,t,n,o,r=null){const a=e[wh]||(e[wh]={}),s=a[t];if(o&&s)s.value=o;else{const[i,l]=RC(t);if(o){const d=a[t]=jC(o,r);si(e,i,d,l)}else s&&(IC(e,i,s,l),a[t]=void 0)}}const _C=/(Once|Passive|Capture)$/,PC=/^on:?(?:Once|Passive|Capture)$/;function RC(e){let t,n;for(;(n=e.match(_C))&&!PC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):As(e.slice(2)),t]}let cd=0;const EC=Promise.resolve(),MC=()=>cd||(EC.then(()=>cd=0),cd=Date.now());function jC(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(tt(r)){const a=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{a.call(o),o._stopped=!0};const s=r.slice(),i=[o];for(let l=0;l<s.length&&!o._stopped;l++){const d=s[l];d&&or(d,t,5,i)}}else or(r,t,5,[o])};return n.value=e,n.attached=MC(),n}const bh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,LC=(e,t,n,o,r,a)=>{const s=r==="svg";t==="class"?bC(e,o,s):t==="style"?CC(e,n,o):tc(t)?nc(t)||AC(e,t,n,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):NC(e,t,o,s))?(yh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&gh(e,t,o,s,a,t!=="value")):e._isVueCE&&($C(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Vt(o)))?yh(e,po(t),o,a,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),gh(e,t,o,s))};function NC(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&bh(t)&&ft(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return bh(t)&&Vt(n)?!1:t in e}function $C(e,t){const n=e._def.props;if(!n)return!1;const o=po(t);return Array.isArray(n)?n.some(r=>po(r)===o):Object.keys(n).some(r=>po(r)===o)}const Gu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return tt(t)?n=>Ru(t,n):t};function OC(e){e.target.composing=!0}function Th(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const zi=Symbol("_assign");function Sh(e,t,n){return t&&(e=e.trim()),n&&(e=gf(e)),e}const Nn={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[zi]=Gu(r);const a=o||r.props&&r.props.type==="number";si(e,t?"change":"input",s=>{s.target.composing||e[zi](Sh(e.value,n,a))}),(n||a)&&si(e,"change",()=>{e.value=Sh(e.value,n,a)}),t||(si(e,"compositionstart",OC),si(e,"compositionend",Th),si(e,"change",Th))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:a}},s){if(e[zi]=Gu(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?gf(e.value):e.value,l=t??"";if(i===l)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===l)||(e.value=l)}},DC={deep:!0,created(e,t,n){e[zi]=Gu(n),si(e,"change",()=>{const o=e._modelValue,r=FC(e),a=e.checked,s=e[zi];if(tt(o)){const i=uv(o,r),l=i!==-1;if(a&&!l)s(o.concat(r));else if(!a&&l){const d=[...o];d.splice(i,1),s(d)}}else if(oc(o)){const i=new Set(o);a?i.add(r):i.delete(r),s(i)}else s(vg(e,a))})},mounted:Ch,beforeUpdate(e,t,n){e[zi]=Gu(n),Ch(e,t,n)}};function Ch(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(tt(t))r=uv(t,o.props.value)>-1;else if(oc(t))r=t.has(o.props.value);else{if(t===n)return;r=Gl(t,vg(e,!0))}e.checked!==r&&(e.checked=r)}function FC(e){return"_value"in e?e._value:e.value}function vg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const BC=["ctrl","shift","alt","meta"],UC={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)=>BC.some(n=>e[`${n}Key`]&&!t.includes(n))},gt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...a)=>{for(let s=0;s<t.length;s++){const i=UC[t[s]];if(i&&i(r,t))return}return e(r,...a)})},zC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Ao=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const a=As(r.key);if(t.some(s=>s===a||zC[s]===a))return e(r)})},HC=pn({patchProp:LC},pC);let xh;function qC(){return xh||(xh=KS(HC))}const WC=(...e)=>{const t=qC().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=VC(o);if(!r)return;const a=t._component;!ft(a)&&!a.render&&!a.template&&(a.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const s=n(r,!1,GC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),s},t};function GC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function VC(e){return Vt(e)?document.querySelector(e):e}const KC="modulepreload",YC=function(e){return"/"+e},kh={},_r=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let s=function(d){return Promise.all(d.map(c=>Promise.resolve(c).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));r=s(n.map(d=>{if(d=YC(d),d in kh)return;kh[d]=!0;const c=d.endsWith(".css"),v=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${v}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":KC,c||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((g,S)=>{f.addEventListener("load",g),f.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return r.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
|
|
19
|
-
* vue-router v4.6.4
|
|
20
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
-
* @license MIT
|
|
22
|
-
*/const ji=typeof document<"u";function gg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function JC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&gg(e.default)}const Et=Object.assign;function dd(e,t){const n={};for(const o in t){const r=t[o];n[o]=Dr(r)?r.map(e):e(r)}return n}const Ll=()=>{},Dr=Array.isArray;function Ih(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const yg=/#/g,QC=/&/g,XC=/\//g,ZC=/=/g,e0=/\?/g,wg=/\+/g,t0=/%5B/g,n0=/%5D/g,bg=/%5E/g,o0=/%60/g,Tg=/%7B/g,r0=/%7C/g,Sg=/%7D/g,a0=/%20/g;function Nf(e){return e==null?"":encodeURI(""+e).replace(r0,"|").replace(t0,"[").replace(n0,"]")}function s0(e){return Nf(e).replace(Tg,"{").replace(Sg,"}").replace(bg,"^")}function Wd(e){return Nf(e).replace(wg,"%2B").replace(a0,"+").replace(yg,"%23").replace(QC,"%26").replace(o0,"`").replace(Tg,"{").replace(Sg,"}").replace(bg,"^")}function i0(e){return Wd(e).replace(ZC,"%3D")}function l0(e){return Nf(e).replace(yg,"%23").replace(e0,"%3F")}function u0(e){return l0(e).replace(XC,"%2F")}function Hl(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const c0=/\/$/,d0=e=>e.replace(c0,"");function fd(e,t,n="/"){let o,r={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(o=t.slice(0,l),a=t.slice(l,i>0?i:t.length),r=e(a.slice(1))),i>=0&&(o=o||t.slice(0,i),s=t.slice(i,t.length)),o=m0(o??t,n),{fullPath:o+a+s,path:o,query:r,hash:Hl(s)}}function f0(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Ah(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function p0(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&Ji(t.matched[o],n.matched[r])&&Cg(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ji(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Cg(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!h0(e[n],t[n]))return!1;return!0}function h0(e,t){return Dr(e)?_h(e,t):Dr(t)?_h(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function _h(e,t){return Dr(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function m0(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),r=o[o.length-1];(r===".."||r===".")&&o.push("");let a=n.length-1,s,i;for(s=0;s<o.length;s++)if(i=o[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(s).join("/")}const fs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Gd=function(e){return e.pop="pop",e.push="push",e}({}),pd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function v0(e){if(!e)if(ji){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),d0(e)}const g0=/^[^#]+#/;function y0(e,t){return e.replace(g0,"#")+t}function w0(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const pc=()=>({left:window.scrollX,top:window.scrollY});function b0(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=w0(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ph(e,t){return(history.state?history.state.position-t:-1)+e}const Vd=new Map;function T0(e,t){Vd.set(e,t)}function S0(e){const t=Vd.get(e);return Vd.delete(e),t}function C0(e){return typeof e=="string"||e&&typeof e=="object"}function xg(e){return typeof e=="string"||typeof e=="symbol"}let an=function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e}({});const kg=Symbol("");an.MATCHER_NOT_FOUND+"",an.NAVIGATION_GUARD_REDIRECT+"",an.NAVIGATION_ABORTED+"",an.NAVIGATION_CANCELLED+"",an.NAVIGATION_DUPLICATED+"";function Qi(e,t){return Et(new Error,{type:e,[kg]:!0},t)}function Ra(e,t){return e instanceof Error&&kg in e&&(t==null||!!(e.type&t))}const x0=["params","query","hash"];function k0(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of x0)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function I0(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;o<n.length;++o){const r=n[o].replace(wg," "),a=r.indexOf("="),s=Hl(a<0?r:r.slice(0,a)),i=a<0?null:Hl(r.slice(a+1));if(s in t){let l=t[s];Dr(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function Rh(e){let t="";for(let n in e){const o=e[n];if(n=i0(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(Dr(o)?o.map(r=>r&&Wd(r)):[o&&Wd(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function A0(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Dr(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const _0=Symbol(""),Eh=Symbol(""),hc=Symbol(""),$f=Symbol(""),Kd=Symbol("");function xl(){let e=[];function t(o){return e.push(o),()=>{const r=e.indexOf(o);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function gs(e,t,n,o,r,a=s=>s()){const s=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((i,l)=>{const d=f=>{f===!1?l(Qi(an.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):C0(f)?l(Qi(an.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&o.enterCallbacks[r]===s&&typeof f=="function"&&s.push(f),i())},c=a(()=>e.call(o&&o.instances[r],t,n,d));let v=Promise.resolve(c);e.length<3&&(v=v.then(d)),v.catch(f=>l(f))})}function hd(e,t,n,o,r=a=>a()){const a=[];for(const s of e)for(const i in s.components){let l=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if(gg(l)){const d=(l.__vccOpts||l)[t];d&&a.push(gs(d,n,o,s,i,r))}else{let d=l();a.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const v=JC(c)?c.default:c;s.mods[i]=c,s.components[i]=v;const f=(v.__vccOpts||v)[t];return f&&gs(f,n,o,s,i,r)()}))}}return a}function P0(e,t){const n=[],o=[],r=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const i=t.matched[s];i&&(e.matched.find(d=>Ji(d,i))?o.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(d=>Ji(d,l))||r.push(l))}return[n,o,r]}/*!
|
|
23
|
-
* vue-router v4.6.4
|
|
24
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
-
* @license MIT
|
|
26
|
-
*/let R0=()=>location.protocol+"//"+location.host;function Ig(e,t){const{pathname:n,search:o,hash:r}=t,a=e.indexOf("#");if(a>-1){let s=r.includes(e.slice(a))?e.slice(a).length:1,i=r.slice(s);return i[0]!=="/"&&(i="/"+i),Ah(i,"")}return Ah(n,e)+o+r}function E0(e,t,n,o){let r=[],a=[],s=null;const i=({state:f})=>{const g=Ig(e,location),S=n.value,P=t.value;let B=0;if(f){if(n.value=g,t.value=f,s&&s===S){s=null;return}B=P?f.position-P.position:0}else o(g);r.forEach(L=>{L(n.value,S,{delta:B,type:Gd.pop,direction:B?B>0?pd.forward:pd.back:pd.unknown})})};function l(){s=n.value}function d(f){r.push(f);const g=()=>{const S=r.indexOf(f);S>-1&&r.splice(S,1)};return a.push(g),g}function c(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Et({},f.state,{scroll:pc()}),"")}}function v(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:v}}function Mh(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?pc():null}}function M0(e){const{history:t,location:n}=window,o={value:Ig(e,n)},r={value:t.state};r.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,d,c){const v=e.indexOf("#"),f=v>-1?(n.host&&document.querySelector("base")?e:e.slice(v))+l:R0()+e+l;try{t[c?"replaceState":"pushState"](d,"",f),r.value=d}catch(g){console.error(g),n[c?"replace":"assign"](f)}}function s(l,d){a(l,Et({},t.state,Mh(r.value.back,l,r.value.forward,!0),d,{position:r.value.position}),!0),o.value=l}function i(l,d){const c=Et({},r.value,t.state,{forward:l,scroll:pc()});a(c.current,c,!0),a(l,Et({},Mh(o.value,l,null),{position:c.position+1},d),!1),o.value=l}return{location:o,state:r,push:i,replace:s}}function j0(e){e=v0(e);const t=M0(e),n=E0(e,t.state,t.location,t.replace);function o(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=Et({location:"",base:e,go:o,createHref:y0.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}function L0(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),j0(e)}let ii=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var wn=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}(wn||{});const N0={type:ii.Static,value:""},$0=/[a-zA-Z0-9_]/;function O0(e){if(!e)return[[]];if(e==="/")return[[N0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(g){throw new Error(`ERR (${n})/"${d}": ${g}`)}let n=wn.Static,o=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let i=0,l,d="",c="";function v(){d&&(n===wn.Static?a.push({type:ii.Static,value:d}):n===wn.Param||n===wn.ParamRegExp||n===wn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),a.push({type:ii.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function f(){d+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==wn.ParamRegExp){o=n,n=wn.EscapeNext;continue}switch(n){case wn.Static:l==="/"?(d&&v(),s()):l===":"?(v(),n=wn.Param):f();break;case wn.EscapeNext:f(),n=o;break;case wn.Param:l==="("?n=wn.ParamRegExp:$0.test(l)?f():(v(),n=wn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case wn.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=wn.ParamRegExpEnd:c+=l;break;case wn.ParamRegExpEnd:v(),n=wn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,c="";break;default:t("Unknown state");break}}return n===wn.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),v(),s(),r}const jh="[^/]+?",D0={sensitive:!1,strict:!1,start:!0,end:!0};var uo=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}(uo||{});const F0=/[.+*?^${}()[\]/\\]/g;function B0(e,t){const n=Et({},D0,t),o=[];let r=n.start?"^":"";const a=[];for(const d of e){const c=d.length?[]:[uo.Root];n.strict&&!d.length&&(r+="/");for(let v=0;v<d.length;v++){const f=d[v];let g=uo.Segment+(n.sensitive?uo.BonusCaseSensitive:0);if(f.type===ii.Static)v||(r+="/"),r+=f.value.replace(F0,"\\$&"),g+=uo.Static;else if(f.type===ii.Param){const{value:S,repeatable:P,optional:B,regexp:L}=f;a.push({name:S,repeatable:P,optional:B});const j=L||jh;if(j!==jh){g+=uo.BonusCustomRegExp;try{`${j}`}catch(H){throw new Error(`Invalid custom RegExp for param "${S}" (${j}): `+H.message)}}let U=P?`((?:${j})(?:/(?:${j}))*)`:`(${j})`;v||(U=B&&d.length<2?`(?:/${U})`:"/"+U),B&&(U+="?"),r+=U,g+=uo.Dynamic,B&&(g+=uo.BonusOptional),P&&(g+=uo.BonusRepeatable),j===".*"&&(g+=uo.BonusWildcard)}c.push(g)}o.push(c)}if(n.strict&&n.end){const d=o.length-1;o[d][o[d].length-1]+=uo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const s=new RegExp(r,n.sensitive?"":"i");function i(d){const c=d.match(s),v={};if(!c)return null;for(let f=1;f<c.length;f++){const g=c[f]||"",S=a[f-1];v[S.name]=g&&S.repeatable?g.split("/"):g}return v}function l(d){let c="",v=!1;for(const f of e){(!v||!c.endsWith("/"))&&(c+="/"),v=!1;for(const g of f)if(g.type===ii.Static)c+=g.value;else if(g.type===ii.Param){const{value:S,repeatable:P,optional:B}=g,L=S in d?d[S]:"";if(Dr(L)&&!P)throw new Error(`Provided param "${S}" is an array but it is not repeatable (* or + modifiers)`);const j=Dr(L)?L.join("/"):L;if(!j)if(B)f.length<2&&(c.endsWith("/")?c=c.slice(0,-1):v=!0);else throw new Error(`Missing required param "${S}"`);c+=j}}return c||"/"}return{re:s,score:o,keys:a,parse:i,stringify:l}}function U0(e,t){let n=0;for(;n<e.length&&n<t.length;){const o=t[n]-e[n];if(o)return o;n++}return e.length<t.length?e.length===1&&e[0]===uo.Static+uo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===uo.Static+uo.Segment?1:-1:0}function Ag(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const a=U0(o[n],r[n]);if(a)return a;n++}if(Math.abs(r.length-o.length)===1){if(Lh(o))return 1;if(Lh(r))return-1}return r.length-o.length}function Lh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const z0={strict:!1,end:!0,sensitive:!1};function H0(e,t,n){const o=B0(O0(e.path),n),r=Et(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function q0(e,t){const n=[],o=new Map;t=Ih(z0,t);function r(v){return o.get(v)}function a(v,f,g){const S=!g,P=$h(v);P.aliasOf=g&&g.record;const B=Ih(t,v),L=[P];if("alias"in v){const H=typeof v.alias=="string"?[v.alias]:v.alias;for(const he of H)L.push($h(Et({},P,{components:g?g.record.components:P.components,path:he,aliasOf:g?g.record:P})))}let j,U;for(const H of L){const{path:he}=H;if(f&&he[0]!=="/"){const de=f.record.path,W=de[de.length-1]==="/"?"":"/";H.path=f.record.path+(he&&W+he)}if(j=H0(H,f,B),g?g.alias.push(j):(U=U||j,U!==j&&U.alias.push(j),S&&v.name&&!Oh(j)&&s(v.name)),_g(j)&&l(j),P.children){const de=P.children;for(let W=0;W<de.length;W++)a(de[W],j,g&&g.children[W])}g=g||j}return U?()=>{s(U)}:Ll}function s(v){if(xg(v)){const f=o.get(v);f&&(o.delete(v),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(v);f>-1&&(n.splice(f,1),v.record.name&&o.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=V0(v,n);n.splice(f,0,v),v.record.name&&!Oh(v)&&o.set(v.record.name,v)}function d(v,f){let g,S={},P,B;if("name"in v&&v.name){if(g=o.get(v.name),!g)throw Qi(an.MATCHER_NOT_FOUND,{location:v});B=g.record.name,S=Et(Nh(f.params,g.keys.filter(U=>!U.optional).concat(g.parent?g.parent.keys.filter(U=>U.optional):[]).map(U=>U.name)),v.params&&Nh(v.params,g.keys.map(U=>U.name))),P=g.stringify(S)}else if(v.path!=null)P=v.path,g=n.find(U=>U.re.test(P)),g&&(S=g.parse(P),B=g.record.name);else{if(g=f.name?o.get(f.name):n.find(U=>U.re.test(f.path)),!g)throw Qi(an.MATCHER_NOT_FOUND,{location:v,currentLocation:f});B=g.record.name,S=Et({},f.params,v.params),P=g.stringify(S)}const L=[];let j=g;for(;j;)L.unshift(j.record),j=j.parent;return{name:B,path:P,params:S,matched:L,meta:G0(L)}}e.forEach(v=>a(v));function c(){n.length=0,o.clear()}return{addRoute:a,resolve:d,removeRoute:s,clearRoutes:c,getRoutes:i,getRecordMatcher:r}}function Nh(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function $h(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:W0(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 W0(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function Oh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function G0(e){return e.reduce((t,n)=>Et(t,n.meta),{})}function V0(e,t){let n=0,o=t.length;for(;n!==o;){const a=n+o>>1;Ag(e,t[a])<0?o=a:n=a+1}const r=K0(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function K0(e){let t=e;for(;t=t.parent;)if(_g(t)&&Ag(e,t)===0)return t}function _g({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Dh(e){const t=Lr(hc),n=Lr($f),o=K(()=>{const l=h(e.to);return t.resolve(l)}),r=K(()=>{const{matched:l}=o.value,{length:d}=l,c=l[d-1],v=n.matched;if(!c||!v.length)return-1;const f=v.findIndex(Ji.bind(null,c));if(f>-1)return f;const g=Fh(l[d-2]);return d>1&&Fh(c)===g&&v[v.length-1].path!==g?v.findIndex(Ji.bind(null,l[d-2])):f}),a=K(()=>r.value>-1&&Z0(n.params,o.value.params)),s=K(()=>r.value>-1&&r.value===n.matched.length-1&&Cg(n.params,o.value.params));function i(l={}){if(X0(l)){const d=t[h(e.replace)?"replace":"push"](h(e.to)).catch(Ll);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:o,href:K(()=>o.value.href),isActive:a,isExactActive:s,navigate:i}}function Y0(e){return e.length===1?e[0]:e}const J0=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:Dh,setup(e,{slots:t}){const n=lc(Dh(e)),{options:o}=Lr(hc),r=K(()=>({[Bh(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Bh(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&Y0(t.default(n));return e.custom?a:Lf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),Q0=J0;function X0(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 Z0(e,t){for(const n in t){const o=t[n],r=e[n];if(typeof o=="string"){if(o!==r)return!1}else if(!Dr(r)||r.length!==o.length||o.some((a,s)=>a.valueOf()!==r[s].valueOf()))return!1}return!0}function Fh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Bh=(e,t,n)=>e??t??n,ex=hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Lr(Kd),r=K(()=>e.route||o.value),a=Lr(Eh,0),s=K(()=>{let d=h(a);const{matched:c}=r.value;let v;for(;(v=c[d])&&!v.components;)d++;return d}),i=K(()=>r.value.matched[s.value]);Eu(Eh,K(()=>s.value+1)),Eu(_0,i),Eu(Kd,r);const l=T();return nt(()=>[l.value,i.value,e.name],([d,c,v],[f,g,S])=>{c&&(c.instances[v]=d,g&&g!==c&&d&&d===f&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),d&&c&&(!g||!Ji(c,g)||!f)&&(c.enterCallbacks[v]||[]).forEach(P=>P(d))},{flush:"post"}),()=>{const d=r.value,c=e.name,v=i.value,f=v&&v.components[c];if(!f)return Uh(n.default,{Component:f,route:d});const g=v.props[c],S=g?g===!0?d.params:typeof g=="function"?g(d):g:null,B=Lf(f,Et({},S,t,{onVnodeUnmounted:L=>{L.component.isUnmounted&&(v.instances[c]=null)},ref:l}));return Uh(n.default,{Component:B,route:d})||B}}});function Uh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const tx=ex;function nx(e){const t=q0(e.routes,e),n=e.parseQuery||I0,o=e.stringifyQuery||Rh,r=e.history,a=xl(),s=xl(),i=xl(),l=VT(fs);let d=fs;ji&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=dd.bind(null,N=>""+N),v=dd.bind(null,u0),f=dd.bind(null,Hl);function g(N,oe){let le,Ee;return xg(N)?(le=t.getRecordMatcher(N),Ee=oe):Ee=N,t.addRoute(Ee,le)}function S(N){const oe=t.getRecordMatcher(N);oe&&t.removeRoute(oe)}function P(){return t.getRoutes().map(N=>N.record)}function B(N){return!!t.getRecordMatcher(N)}function L(N,oe){if(oe=Et({},oe||l.value),typeof N=="string"){const z=fd(n,N,oe.path),Z=t.resolve({path:z.path},oe),ue=r.createHref(z.fullPath);return Et(z,Z,{params:f(Z.params),hash:Hl(z.hash),redirectedFrom:void 0,href:ue})}let le;if(N.path!=null)le=Et({},N,{path:fd(n,N.path,oe.path).path});else{const z=Et({},N.params);for(const Z in z)z[Z]==null&&delete z[Z];le=Et({},N,{params:v(z)}),oe.params=v(oe.params)}const Ee=t.resolve(le,oe),Be=N.hash||"";Ee.params=c(f(Ee.params));const A=f0(o,Et({},N,{hash:s0(Be),path:Ee.path})),M=r.createHref(A);return Et({fullPath:A,hash:Be,query:o===Rh?A0(N.query):N.query||{}},Ee,{redirectedFrom:void 0,href:M})}function j(N){return typeof N=="string"?fd(n,N,l.value.path):Et({},N)}function U(N,oe){if(d!==N)return Qi(an.NAVIGATION_CANCELLED,{from:oe,to:N})}function H(N){return W(N)}function he(N){return H(Et(j(N),{replace:!0}))}function de(N,oe){const le=N.matched[N.matched.length-1];if(le&&le.redirect){const{redirect:Ee}=le;let Be=typeof Ee=="function"?Ee(N,oe):Ee;return typeof Be=="string"&&(Be=Be.includes("?")||Be.includes("#")?Be=j(Be):{path:Be},Be.params={}),Et({query:N.query,hash:N.hash,params:Be.path!=null?{}:N.params},Be)}}function W(N,oe){const le=d=L(N),Ee=l.value,Be=N.state,A=N.force,M=N.replace===!0,z=de(le,Ee);if(z)return W(Et(j(z),{state:typeof z=="object"?Et({},Be,z.state):Be,force:A,replace:M}),oe||le);const Z=le;Z.redirectedFrom=oe;let ue;return!A&&p0(o,Ee,le)&&(ue=Qi(an.NAVIGATION_DUPLICATED,{to:Z,from:Ee}),Fe(Ee,Ee,!0,!1)),(ue?Promise.resolve(ue):Ae(Z,Ee)).catch(re=>Ra(re)?Ra(re,an.NAVIGATION_GUARD_REDIRECT)?re:Pe(re):ce(re,Z,Ee)).then(re=>{if(re){if(Ra(re,an.NAVIGATION_GUARD_REDIRECT))return W(Et({replace:M},j(re.to),{state:typeof re.to=="object"?Et({},Be,re.to.state):Be,force:A}),oe||Z)}else re=Q(Z,Ee,!0,M,Be);return pe(Z,Ee,re),re})}function ve(N,oe){const le=U(N,oe);return le?Promise.reject(le):Promise.resolve()}function Se(N){const oe=Ze.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(N):N()}function Ae(N,oe){let le;const[Ee,Be,A]=P0(N,oe);le=hd(Ee.reverse(),"beforeRouteLeave",N,oe);for(const z of Ee)z.leaveGuards.forEach(Z=>{le.push(gs(Z,N,oe))});const M=ve.bind(null,N,oe);return le.push(M),fe(le).then(()=>{le=[];for(const z of a.list())le.push(gs(z,N,oe));return le.push(M),fe(le)}).then(()=>{le=hd(Be,"beforeRouteUpdate",N,oe);for(const z of Be)z.updateGuards.forEach(Z=>{le.push(gs(Z,N,oe))});return le.push(M),fe(le)}).then(()=>{le=[];for(const z of A)if(z.beforeEnter)if(Dr(z.beforeEnter))for(const Z of z.beforeEnter)le.push(gs(Z,N,oe));else le.push(gs(z.beforeEnter,N,oe));return le.push(M),fe(le)}).then(()=>(N.matched.forEach(z=>z.enterCallbacks={}),le=hd(A,"beforeRouteEnter",N,oe,Se),le.push(M),fe(le))).then(()=>{le=[];for(const z of s.list())le.push(gs(z,N,oe));return le.push(M),fe(le)}).catch(z=>Ra(z,an.NAVIGATION_CANCELLED)?z:Promise.reject(z))}function pe(N,oe,le){i.list().forEach(Ee=>Se(()=>Ee(N,oe,le)))}function Q(N,oe,le,Ee,Be){const A=U(N,oe);if(A)return A;const M=oe===fs,z=ji?history.state:{};le&&(Ee||M?r.replace(N.fullPath,Et({scroll:M&&z&&z.scroll},Be)):r.push(N.fullPath,Be)),l.value=N,Fe(N,oe,le,M),Pe()}let me;function ne(){me||(me=r.listen((N,oe,le)=>{if(!ut.listening)return;const Ee=L(N),Be=de(Ee,ut.currentRoute.value);if(Be){W(Et(Be,{replace:!0,force:!0}),Ee).catch(Ll);return}d=Ee;const A=l.value;ji&&T0(Ph(A.fullPath,le.delta),pc()),Ae(Ee,A).catch(M=>Ra(M,an.NAVIGATION_ABORTED|an.NAVIGATION_CANCELLED)?M:Ra(M,an.NAVIGATION_GUARD_REDIRECT)?(W(Et(j(M.to),{force:!0}),Ee).then(z=>{Ra(z,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&!le.delta&&le.type===Gd.pop&&r.go(-1,!1)}).catch(Ll),Promise.reject()):(le.delta&&r.go(-le.delta,!1),ce(M,Ee,A))).then(M=>{M=M||Q(Ee,A,!1),M&&(le.delta&&!Ra(M,an.NAVIGATION_CANCELLED)?r.go(-le.delta,!1):le.type===Gd.pop&&Ra(M,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),pe(Ee,A,M)}).catch(Ll)}))}let ke=xl(),$e=xl(),te;function ce(N,oe,le){Pe(N);const Ee=$e.list();return Ee.length?Ee.forEach(Be=>Be(N,oe,le)):console.error(N),Promise.reject(N)}function Le(){return te&&l.value!==fs?Promise.resolve():new Promise((N,oe)=>{ke.add([N,oe])})}function Pe(N){return te||(te=!N,ne(),ke.list().forEach(([oe,le])=>N?le(N):oe()),ke.reset()),N}function Fe(N,oe,le,Ee){const{scrollBehavior:Be}=e;if(!ji||!Be)return Promise.resolve();const A=!le&&S0(Ph(N.fullPath,0))||(Ee||!le)&&history.state&&history.state.scroll||null;return Nt().then(()=>Be(N,oe,A)).then(M=>M&&b0(M)).catch(M=>ce(M,N,oe))}const Ke=N=>r.go(N);let lt;const Ze=new Set,ut={currentRoute:l,listening:!0,addRoute:g,removeRoute:S,clearRoutes:t.clearRoutes,hasRoute:B,getRoutes:P,resolve:L,options:e,push:H,replace:he,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:$e.add,isReady:Le,install(N){N.component("RouterLink",Q0),N.component("RouterView",tx),N.config.globalProperties.$router=ut,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>h(l)}),ji&&!lt&&l.value===fs&&(lt=!0,H(r.location).catch(Ee=>{}));const oe={};for(const Ee in fs)Object.defineProperty(oe,Ee,{get:()=>l.value[Ee],enumerable:!0});N.provide(hc,ut),N.provide($f,Iv(oe)),N.provide(Kd,l);const le=N.unmount;Ze.add(N),N.unmount=function(){Ze.delete(N),Ze.size<1&&(d=fs,me&&me(),me=null,l.value=fs,lt=!1,te=!1),le()}}};function fe(N){return N.reduce((oe,le)=>oe.then(()=>Se(le)),Promise.resolve())}return ut}function ox(){return Lr(hc)}function rx(e){return Lr($f)}const zh=768;function Of(){const e=T(typeof window<"u"?window.innerWidth<zh:!1);let t=null;function n(o){e.value=o.matches}return pi(()=>{t=window.matchMedia(`(max-width: ${zh-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Jl(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const ax={key:0,class:"desktop-sidebar"},sx={class:"desktop-main"},Hh="codex-web-local.sidebar-width.v1",ix=260,lx=620,qh=320,ux=hn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Of();function o(d){return Math.min(lx,Math.max(ix,d))}function r(){if(typeof window>"u")return qh;const d=window.localStorage.getItem(Hh),c=Number(d);return Number.isFinite(c)?o(c):qh}const a=T(r()),s=K(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(d){typeof window>"u"||window.localStorage.setItem(Hh,String(d))}function l(d){d.preventDefault();const c=d.clientX,v=a.value,f=S=>{const P=S.clientX-c;a.value=o(v+P)},g=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)}return(d,c)=>(_(),F("div",{class:at(["desktop-layout",{"is-mobile":h(n)}]),style:er(s.value)},[h(n)?(_(),Qe(Vi,{key:0,to:"body"},[Oe(Xl,{name:"drawer"},{default:dt(()=>[e.isSidebarCollapsed?ye("",!0):(_(),F("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=v=>d.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=gt(()=>{},["stop"]))},[_o(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ye("",!0),h(n)?ye("",!0):(_(),F(ot,{key:1},[e.isSidebarCollapsed?ye("",!0):(_(),F("aside",ax,[_o(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ye("",!0):(_(),F("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",sx,[_o(d.$slots,"content",{},void 0)])],6))}}),It=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},cx=It(ux,[["__scopeId","data-v-782e512b"]]);function Wh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Nr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function rr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Wh(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=Wh(o);return r&&typeof r.message=="string"&&r.message.length>0?r.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function Fr(e,t,n){return e instanceof Nr?e:e instanceof Error?new Nr(e.message||t,{code:"unknown_error",method:n}):new Nr(t,{code:"unknown_error",method:n})}function Pg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function dx(e,t){const n={method:e,params:t??null};let o;try{o=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Nr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,a=null;try{a=await o.text(),r=JSON.parse(a)}catch{r=null}if(!o.ok){const i=rr(r,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${o.status}`;throw new Nr(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:o.status})}const s=r;if(!s||typeof s!="object"||!("result"in s))throw new Nr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return s.result}async function fx(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(rr(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 px(e){const t=Pg(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 Gh(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function hx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},a=(d,c)=>{if(n||o!==null)return;const v=Math.min(1e3*2**c,1e4);o=window.setTimeout(()=>{o=null,!n&&d()},v)},s=d=>{const c=px(d);c&&e(c)},i=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let v=!1;c.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},c.addEventListener("ready",f=>{try{const g=f.data?JSON.parse(f.data):{ok:!0};Gh(e,g)}catch{Gh(e)}}),c.onerror=()=>{n||v||c.readyState===EventSource.CLOSED&&(v=!0,c.close(),a(()=>i(d+1),d))},t=()=>{v=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let f=!1,g=!1,S=window.setTimeout(()=>{f||n||g||(g=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,r(),S!==null&&(window.clearTimeout(S),S=null)},v.onmessage=P=>{try{s(JSON.parse(String(P.data)))}catch{}},v.onerror=()=>{},v.onclose=()=>{if(S!==null&&(window.clearTimeout(S),S=null),!(n||g)){if(!f){i();return}a(()=>l(d+1),d)}},t=()=>{g=!0,S!==null&&(window.clearTimeout(S),S=null),v.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,r(),t==null||t()}}async function mx(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(o){throw new Nr(o instanceof Error?o.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Nr(rr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function vx(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(rr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Pg(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}async function rt(e,t){try{return await dx(e,t)}catch(n){throw Fr(n,`RPC ${e} failed`,e)}}function Jt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=n.message;if(typeof o=="string"&&o.trim().length>0)return o;const r=n.error;return typeof r=="string"&&r.trim().length>0?r:t}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ee(e){return typeof e=="string"&&e.length>0?e:null}function Ut(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Xn(e){return typeof e=="boolean"?e:null}function Er(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function hi(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 Vu(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.kind),r=ee(t.name),a=ee(t.prompt),s=ee(t.rrule),i=ee(t.status);return!n||!r||!a||!s||o!=="heartbeat"&&o!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:a,rrule:s,status:i,targetThreadId:ee(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Ut(t.createdAtMs),updatedAtMs:Ut(t.updatedAtMs),nextRunAtMs:Ut(t.nextRunAtMs)}}function Rg(e){if(Array.isArray(e))return e.flatMap(n=>{const o=Vu(n);return o?[o]:[]});const t=Vu(e);return t?[t]:[]}async function gx(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(rr(t,"Failed to load thread automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Rg(s);i.length>0&&(o[a]=i)}return o}async function yx(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(rr(t,"Failed to load project automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Rg(s);i.length>0&&(o[a]=i)}return o}async function wx(e){var r;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(rr(n,"Failed to save thread automation"));const o=Vu((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function bx(e){var r;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(rr(n,"Failed to save project automation"));const o=Vu((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function Vh(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(rr(r,"Failed to delete thread automation"))}async function Eg(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(rr(r,"Failed to delete project automation"))}async function Tx(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(rr(o,"Failed to run thread automation"))}const Sx=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Mg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||Sx.has(n))}function Cx(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],o=[];for(const r of n){if(!r||typeof r!="object"||Array.isArray(r))continue;const s=r.path,i=typeof s=="string"?s.trim():"";!i||Mg(i)||o.push({path:i})}return o}async function xx(e,t){await rt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function kx(e,t){await rt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function Ix(e){await rt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function Kh(e,t,n=20){const o=e.trim();if(!o)return[];const r=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:o,query:t.trim(),limit:n})}),a=await r.json();if(!r.ok){const d=Jt(a,"Failed to search files");throw new Error(d)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const d of i){if(!d||typeof d!="object"||Array.isArray(d))continue;const v=d.path,f=typeof v=="string"?v.trim():"";!f||Mg(f)||l.push({path:f})}return l}async function Ax(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to search threads");return o.data??{threadIds:[],indexedThreadCount:0}}function _x(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.threadId),r=ee(t.cwd),a=ee(t.shell);return!n||!o||!r||!a?null:{id:n,threadId:o,cwd:r,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Xn(t.truncated)??!1}}async function nl(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(rr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function ID(e){var o;const t=await nl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=_x((o=Ge(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function Px(){const e=await nl("/codex-api/thread-terminal/status"),t=Ge(e);return{available:Xn(t==null?void 0:t.available)??!1,reason:ee(t==null?void 0:t.reason)||null}}async function AD(e){const t=await nl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ge(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const a=Ge(r),s=ee(a==null?void 0:a.label),i=ee(a==null?void 0:a.value),l=ee(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function _D(e,t){await nl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function PD(e,t,n){await nl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function RD(e){await nl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}const jg=["none","minimal","low","medium","high","xhigh","max","ultra"];function Xi(e){return typeof e=="string"&&jg.some(t=>t===e)}function Rx(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Xe(e){return Rx(e)}function Lg(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function Ex(e){const t=Xe(e);return t.startsWith("/")||Lg(t)}function Mx(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return Lg(t)?t.toLowerCase():t}function Bo(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function Hi(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function nr(e){return Bo(e)||Xe(e)||"Projectless"}function Ku(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function Yh(e){return new Date(e*1e3).toISOString()}function jx(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Lx(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const Nx=/^##\s+(.+?):\s+(.+?)\s*$/,$x=/^#\s*files mentioned by the user\s*:?\s*$/i;function Ox(e){var r,a;const t=e.split(`
|
|
27
|
-
`).findIndex(s=>$x.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
-
`).slice(t+1),o=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(Nx);if(!l)break;const d=(r=l[1])==null?void 0:r.trim(),c=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&o.push({label:d,path:c})}return o}function Dx(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const o=n.at(-1);if(!o||typeof o.index!="number")return e.trim();const r=o.index+o[0].length;return e.slice(r).trim()}function Ng(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function Fx(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 Bx(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function md(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?Bx(n[1].trim()):""}function Ux(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=md(t,"current_time_iso"),o=md(t,"instructions");return!n||!o?null:{automationId:md(t,"automation_id"),currentTimeIso:n,instructions:o}}function zx(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],a=[];for(const[d,c]of t.entries()){if(c.type==="text"&&typeof c.text=="string"&&c.text.length>0&&n.push(c.text),c.type==="image"&&typeof c.url=="string"&&c.url.trim().length>0&&o.push(c.url.trim()),c.type==="localImage"&&typeof c.path=="string"&&c.path.trim().length>0&&o.push(Ng(c.path.trim())),c.type==="skill"){const v=typeof c.name=="string"?c.name.trim():"",f=typeof c.path=="string"?c.path.trim():"";v&&f&&r.push({name:v,path:f})}c.type!=="text"&&c.type!=="image"&&c.type!=="localImage"&&c.type!=="skill"&&a.push({id:`${e}:user-content:${d}`,role:"user",text:"",messageType:`userContent.${c.type}`,rawPayload:jx(c),isUnhandled:!0})}const s=n.join(`
|
|
29
|
-
`),i=Ox(s),l=Ux(s);return{text:(l==null?void 0:l.instructions)??Dx(s),images:o,skills:r,fileAttachments:i,rawBlocks:a,isAutomationRun:l!==null,automationDisplayName:(l==null?void 0:l.automationId)||null}}function Hx(e){var a;const t=e.replace(/\r\n/g,`
|
|
30
|
-
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
-
`),o=[],r=[];for(const s of n){const i=s.trim();if(!i){o.length===0&&r.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const d=(l[1]??" ").toLowerCase(),c=(a=l[2])==null?void 0:a.trim();if(!c)continue;let v="pending";d==="x"&&(v="completed"),(d==="~"||d===">"||d==="-")&&(v="inProgress"),o.push({step:c,status:v});continue}r.push(i)}return o.length===0?null:{explanation:r.join(`
|
|
32
|
-
`).trim()||void 0,steps:o}}function Jh(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 qx(e){let t=0,n=0;for(const o of e.replace(/\r\n/g,`
|
|
36
|
-
`).split(`
|
|
37
|
-
`))if(o&&!(o.startsWith("+++")||o.startsWith("---")||o.startsWith("@@"))){if(o.startsWith("+")){t+=1;continue}o.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function $g(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Yd(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){const r=o,a=typeof r.path=="string"?r.path:"",s=typeof r.diff=="string"?r.diff:"",i=r.kind,l=i==null?void 0:i.type;if(!a||l!=="add"&&l!=="delete"&&l!=="update")continue;const d=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,c=l==="update"?qx(s):l==="add"?{addedLineCount:Jh(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:Jh(s)};n.push({path:a,operation:l,movedToPath:d,diff:s,...c})}return n}function Wx(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=zx(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,skills:t.skills.length>0?t.skills:void 0,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type,isAutomationRun:t.isAutomationRun,automationDisplayName:t.automationDisplayName}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="imageView"){const t=typeof e.path=="string"?e.path.trim():"";return t?[{id:e.id,role:"assistant",text:"",images:[Ng(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?Fx(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning"){const t=e,n=Array.isArray(t.summary)?t.summary.filter(i=>typeof i=="string"):[],o=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],r=n.join(`
|
|
38
|
-
`).trim(),s=o.join(`
|
|
39
|
-
`).trim()||r;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:o}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",o=typeof t.tool=="string"?t.tool:"";if(!n&&!o)return[];const r=t.status;let a="completed";const s=typeof r=="string"?r:r==null?void 0:r.type;(s==="inProgress"||s==="in_progress")&&(a="inProgress"),(s==="failed"||s==="error")&&(a="failed");const i=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",l=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:o,messageType:"toolCall",toolCall:{server:n,tool:o,status:a,error:i,durationMs:l}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:Hx(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Gx(t.status),o=typeof t.command=="string"?t.command:"",r=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:o,messageType:"commandExecution",commandExecution:{command:o,cwd:r,status:n,aggregatedOutput:a,exitCode:s}}]}if(e.type==="fileChange"){const t=Yd(e.changes),n=$g(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 Gx(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Vx(e){const t=e,n=[t.name,t.title,e.preview];for(const o of n)if(typeof o=="string"&&o.trim().length>0)return o.trim();return""}function Kx(e){const t=Vx(e);return t.length>0?t:"Untitled thread"}function Df(e){return(e==null?void 0:e.status)==="inProgress"}function Ff(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const o=n,r=typeof o.origin=="string"&&o.origin.trim().length>0?o.origin.trim():"";return r?{origin:r,active:o.active===!0,lastWriteAt:typeof o.lastWriteAt=="string"?o.lastWriteAt:null}:null}function Yx(e){var t;return((t=Ff(e))==null?void 0:t.active)===!0}function Og(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const n=t.status;if(n&&typeof n=="object"){const a=n.type;if(a==="active"||a==="inProgress")return!0}const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Df(r)||Yx(e)}function Dg(e){const t=e,n=Xe(typeof t.cwd=="string"?t.cwd:e.cwd),o=Mx(n),r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||o.includes("/.codex/worktrees/")||o.includes("/.git/worktrees/");return{id:e.id,title:Kx(e),projectName:nr(n),cwd:n,hasWorktree:r,createdAtIso:Yh(e.createdAt),updatedAtIso:Yh(e.updatedAt),preview:e.preview,unread:!1,inProgress:Og(e),externalSession:Ff(e)}}function Jx(e){return Dg(e.thread)}function Qx(e){const t=new Map;for(const n of e){const o=t.get(n.projectName);o?o.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,o])=>({projectName:n,threads:o.sort((r,a)=>new Date(a.updatedAtIso).getTime()-new Date(r.updatedAtIso).getTime())})).sort((n,o)=>{var s,i;const r=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=o.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-r})}function Xx(e){const t=e.data.map(Dg);return Qx(t)}function Zl(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o=[];for(let r=0;r<n.length;r++){const a=t+r,s=n[r],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",l=i.length>0?i:void 0,d=Array.isArray(s.items)?s.items:[],c=[];for(const f of d)for(const g of Wx(f))c.push({...g,turnId:l,turnIndex:a});const v=Lx(s);if(s.status==="failed"&&v){const f=l??`turn-${a}`;c.push({id:`${f}-error`,role:"system",text:v,messageType:"turnError",turnId:l,turnIndex:a})}o.push(...c)}return ek(Zx(o))}function Zx(e){var n;let t=-1;for(let o=e.length-1;o>=0;o-=1)if(((n=e[o])==null?void 0:n.messageType)==="compaction.done"){t=o;break}return t<0?e:e.filter((o,r)=>o.messageType!=="compaction.done"||r===t)}function ek(e){var s,i,l;let t=-1;for(let d=0;d<e.length;d+=1)if(((s=e[d])==null?void 0:s.messageType)==="compaction.done"){t=d;break}if(t<0)return e;const n=e[t],o=n.turnIndex;let r=-1;for(let d=0;d<e.length;d+=1)if(((i=e[d])==null?void 0:i.turnIndex)===o&&((l=e[d])==null?void 0:l.role)==="user"){r=d;break}if(r<0||t<=r)return e;const a=e.filter((d,c)=>c!==t);return a.splice(r+1,0,n),a}function Bf(e){if(Og(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Df(t.at(-1))}function Fg(e){return Ff(e.thread)}function Uf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const o=t[n];if(Df(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const tk=50,nk=3e4,Ri=new Map,ok=5e3;function vd(e){return e&&e.length>0?e:null}function gd(e){return e&&e.length>0?e:null}function rk(e){return Xi(e)?e:""}function ak(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function zf(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o={};for(let r=0;r<n.length;r+=1){const a=t+r,s=n[r];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(o[s.id]=a)}return o}function mc(e){const t=Ge(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function Jd(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.id;if(typeof o=="string"&&o.length>0)return o}return""}function sk(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.cwd;if(typeof o=="string"&&o.length>0)return o}return""}function ql(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function vc(e){var r,a;const t=Ge(e);if(!t)return"";const n=((r=ee(t.modelProvider))==null?void 0:r.trim())??"";if(n)return n;const o=Ge(t.thread);return((a=ee(o==null?void 0:o.modelProvider))==null?void 0:a.trim())??""}function Qh(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const o=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return o.length>0?o:null}catch{return null}}function ik(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
40
|
-
`;for(const o of t)n+=`
|
|
41
|
-
## ${o.label}: ${o.path}
|
|
42
|
-
`;return`${n}
|
|
43
|
-
## My request for Codex:
|
|
44
|
-
|
|
45
|
-
${e}
|
|
46
|
-
`}function lk(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function uk(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",o=await fetch(n,{signal:AbortSignal.timeout(ok)});let r=null;try{r=await o.json()}catch{r=null}if(o.ok&&Array.isArray(r==null?void 0:r.data))return{ids:r.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:r.exclusive===!0}}catch{}return null}function ck(e){var s;const t=Ge(e);if(!t)return null;const n=((s=ee(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const l=Ge(i),d=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return Xi(d)?[d]:[]}).filter((i,l,d)=>d.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:Xi(a)?a:null}}function Xh(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function dk(e={}){const t=e.includeProviderModels!==!1,n=t?await uk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(Xh);const o=await rt("model/list",{}),r=[];for(const a of o.data){const s=ck(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(Xh(a));return r}async function fk(e={}){return(await dk(e)).map(t=>t.id)}async function pk(){const e=await rt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=rk(e.config.model_reasoning_effort),r=ak(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}async function hk(e,t,n){var l;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?vd(n):gd(n)};let r=null;try{r=await pk()}catch{r=null}const a=(r==null?void 0:r.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?vd(n??(r==null?void 0:r.reasoningEffort)):gd(n??(r==null?void 0:r.reasoningEffort))};let s=[];try{s=await fk()}catch{s=[]}const i=((l=s.find(d=>d.trim().length>0))==null?void 0:l.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?vd(n??(r==null?void 0:r.reasoningEffort)):gd(n??(r==null?void 0:r.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function mk(e,t){const n=await rt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:Xx(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function vk(e){const t=await rt("thread/read",{threadId:e,includeTurns:!1});return Jx(t)}async function gk(e){const t=await rt("thread/read",{threadId:e,includeTurns:!0}),n=mc(t),o=Zl(t,n);return{model:ql(t),modelProvider:vc(t),messages:o,inProgress:Bf(t),activeTurnId:Uf(t),hasMoreOlder:n>0,turnIndexByTurnId:zf(t,n),externalSession:Fg(t)}}async function yk(e,t,n=10){const o=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),r=await fetch(`/codex-api/thread-turn-page?${o.toString()}`);if(!r.ok)throw new Error(`Older thread page request failed with ${r.status}`);const a=await r.json();if(!a.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:Zl(a.result,s),inProgress:Bf(a.result),activeTurnId:Uf(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:zf(a.result,s)}}async function Zh(e=null,t=tk){try{return await mk(e,t)}catch(n){throw Fr(n,"Failed to load thread groups","thread/list")}}async function wk(e){try{return await vk(e)}catch(t){throw Fr(t,`Failed to load thread ${e}`,"thread/read")}}async function Qd(e){try{return await gk(e)}catch(t){throw Fr(t,`Failed to load thread ${e}`,"thread/read")}}async function bk(e,t,n){try{return await yk(e,t,n)}catch(o){throw Fr(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function Xd(e){const t=Ri.get(e);if(t)return t;const n=(async()=>{const r=await rt("thread/resume",{threadId:e}),a=mc(r),s=Zl(r,a);return{model:ql(r),modelProvider:vc(r),messages:s,inProgress:Bf(r),activeTurnId:Uf(r),hasMoreOlder:a>0,turnIndexByTurnId:zf(r,a),externalSession:Fg(r)}})();Ri.set(e,n);const o=globalThis.setTimeout(()=>{Ri.get(e)===n&&Ri.delete(e)},nk);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{Ri.get(e)===n&&Ri.delete(e)},2e3)}).catch(()=>{}),n}async function Tk(e){await rt("thread/archive",{threadId:e})}async function Sk(e){await rt("thread/unarchive",{threadId:e})}async function Ck(e){await rt("thread/compact/start",{threadId:e})}async function xk(e,t){await rt("thread/name/set",{threadId:e,name:t})}async function yd(e,t){const n=await rt("thread/rollback",{threadId:e,numTurns:t});return Zl(n,mc(n))}async function em(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const o=await rt("thread/start",n),r=Jd(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:ql(o),modelProvider:vc(o)}}catch(n){throw Fr(n,"Failed to start a new thread","thread/start")}}async function tm(e,t,n){if(arguments.length<=1)try{const o=await rt("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=Jd(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:sk(o),model:ql(o),messages:Zl(o,mc(o))}}catch(o){throw Fr(o,`Failed to fork thread ${e}`,"thread/fork")}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const r={threadId:o};typeof t=="string"&&t.trim().length>0&&(r.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(r.model=n.trim());const a=await rt("thread/fork",r),s=Jd(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:ql(a),modelProvider:vc(a)}}catch(o){throw Fr(o,`Failed to fork thread ${e}`,"thread/fork")}}async function wd(e,t,n=[],o,r,a,s=[],i){var l;try{const d=(o==null?void 0:o.trim())??"",c=[];for(const j of n){const U=Qh(j.trim());U&&c.push({label:lk(U),path:U,fsPath:U})}const v=[...s,...c],f=v.filter((j,U)=>v.findIndex(H=>H.fsPath===j.fsPath)===U),S=[{type:"text",text:ik(t,f)}];for(const j of n){const U=j.trim();if(!U)continue;const H=Qh(U);if(H){S.push({type:"localImage",path:H});continue}S.push({type:"image",url:U,image_url:U})}if(a)for(const j of a)S.push({type:"skill",name:j.name,path:j.path});const P=f.map(j=>({label:j.label,path:j.path,fsPath:j.fsPath})),B={threadId:e,input:S};if(P.length>0&&(B.attachments=P),d&&(B.model=d),typeof r=="string"&&r.length>0&&(B.effort=r),i){const j=await hk(i,d,r);B.collaborationMode={mode:i,settings:{model:j.model,reasoning_effort:j.reasoningEffort,developer_instructions:null}}}const L=await rt("turn/start",B);return typeof((l=L==null?void 0:L.turn)==null?void 0:l.id)=="string"?L.turn.id.trim():""}catch(d){throw Fr(d,`Failed to start turn for thread ${e}`,"turn/start")}}async function kk(e,t){const n=e.trim(),o=(t==null?void 0:t.trim())||"";if(n)try{if(!o)throw new Error("turn/interrupt requires turnId");await rt("turn/interrupt",{threadId:n,turnId:o})}catch(r){throw Fr(r,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const Ik=5e3,nm=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Ak(e){return Xi(e)?e:""}function _k(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function Pk(e){const t=e==="fast"?"fast":"standard";await rt("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function om(){return await(await fetch("/codex-api/free-mode/status")).json()}async function rm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function am(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 Ei(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 Rk(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",o=await fetch(n,{signal:AbortSignal.timeout(Ik)});let r=null;try{r=await o.json()}catch{r=null}if(o.ok&&Array.isArray(r==null?void 0:r.data))return{ids:r.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:r.exclusive===!0}}catch{}return null}function Ek(e){var s;const t=Ge(e);if(!t)return null;const n=((s=ee(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const l=Ge(i),d=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return Xi(d)?[d]:[]}).filter((i,l,d)=>d.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:Xi(a)?a:null}}function sm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Mk(e={}){const t=e.includeProviderModels!==!1,n=t?await Rk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(sm);const o=await rt("model/list",{}),r=[];for(const a of o.data){const s=Ek(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(sm(a));return r}async function jk(){const e=await rt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=Ak(e.config.model_reasoning_effort),r=_k(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function Lk(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function Nk(){try{const e=await rt("collaborationMode/list",{}),t=new Set,n=[];for(const o of e.data){const r=o.mode;r!=="default"&&r!=="plan"&&r!=="execplans"||t.has(r)||(t.add(r),n.push({value:r,label:Lk(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of nm)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return nm}async function $k(){return fx()}function Ok(e){const t=Ge(e);if(!t)return null;const n=ee(t.event??t.name??t.hookName),o=ee(t.command??t.cmd);return!n||!o?null:{event:n,command:o,timeout:Ut(t.timeout??t.timeout_ms),enabled:Xn(t.enabled??t.active)}}async function Dk(){const e=await rt("hooks/list",{}),t=[];for(const n of e.data??[]){const o=Ge(n);o&&t.push({cwd:ee(o.cwd)??"",hooks:Array.isArray(o.hooks)?o.hooks.map(Ok).filter(r=>r!==null):[],warnings:Er(o.warnings),errors:Er(o.errors)})}return t}async function ED(e){await rt("marketplace/add",{source:e})}async function MD(e){await rt("marketplace/remove",{marketplaceName:e})}async function jD(){const e=await rt("marketplace/upgrade",{});return{selectedMarketplaces:Er(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:Er(e.upgradedRoots??e.upgraded_roots),errors:Er(e.errors)}}function Fk(e){const t=Ge(e);if(!t)return null;const n=ee(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:ee(t.pluginName??t.plugin_name??t.name)??n,shareUrl:ee(t.shareUrl??t.share_url??t.url)??"",createdAt:ee(t.createdAt??t.created_at)??""}:null}async function LD(e){const t=await rt("plugin/share/save",{pluginPath:e});return{remotePluginId:ee(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:ee(t.shareUrl??t.share_url??t.url)??""}}async function ND(){const e=await rt("plugin/share/list",{});return(e.data??e.shares??[]).map(Fk).filter(n=>n!==null)}async function $D(e){await rt("plugin/share/delete",{remotePluginId:e})}async function OD(e){await rt("plugin/share/checkout",{remotePluginId:e})}function Bg(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.name);return!n||!o?null:{id:n,name:o,description:ee(t.description)??"",installUrl:ee(t.installUrl??t.install_url)??"",needsAuth:Xn(t.needsAuth??t.needs_auth)??!1}}function Bk(e){const t=Ge(e);if(!t)return null;const n=ee(t.name),o=ee(t.path);if(!n||!o)return null;const r=Ge(t.interface);return{name:n,path:o,description:ee(t.description)??"",enabled:Xn(t.enabled)??!0,displayName:ee((r==null?void 0:r.displayName)??(r==null?void 0:r.display_name))??n,shortDescription:ee(t.shortDescription??t.short_description)??""}}function Ug(e,t={}){const n=Ge(e);if(!n)return null;const o=ee(n.id),r=ee(n.name);if(!o||!r)return null;const a=Ge(n.interface),s=Ge(n.source),i=ee(s==null?void 0:s.type)??"",l=ee(s==null?void 0:s.path),d=ee(s==null?void 0:s.url)??"",c=i==="remote"?t.name??null:null,v=t.path??(i==="local"?l:null),f=ee((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??r,g=ee((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),S=ee((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:o,name:r,displayName:f,description:g??S,longDescription:S,developerName:ee((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:ee(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:v,remoteMarketplaceName:c,sourceType:i,sourceUrl:d,installed:Xn(n.installed)??!1,enabled:Xn(n.enabled)??!0,installPolicy:ee(n.installPolicy??n.install_policy)??"",authPolicy:ee(n.authPolicy??n.auth_policy)??"",logoUrl:ee((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:ee(a==null?void 0:a.logo)??"",composerIconUrl:ee((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:ee((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:ee((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:Er(a==null?void 0:a.capabilities),defaultPrompt:Er((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:Er((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:Er(a==null?void 0:a.screenshots),websiteUrl:ee((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:ee((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:ee((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function Uk(e,t=0){const n=Ge(e);if(!n)return null;const o=ee(n.id),r=ee(n.name);if(!o||!r)return null;const a=Ge(n.branding),s=Ge(n.appMetadata??n.app_metadata);return{id:o,name:r,description:ee(n.description)??ee((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:ee(n.logoUrl??n.logo_url)??"",logoUrlDark:ee(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:ee(n.distributionChannel??n.distribution_channel)??"",installUrl:ee(n.installUrl??n.install_url)??"",isAccessible:Xn(n.isAccessible??n.is_accessible)??!1,isEnabled:Xn(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Er(n.pluginDisplayNames??n.plugin_display_names),category:ee(a==null?void 0:a.category)??"",developer:ee(a==null?void 0:a.developer)??ee(s==null?void 0:s.developer)??"",website:ee(a==null?void 0:a.website)??"",privacyPolicy:ee((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:ee((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function zk(e){const t=Ge(e);if(!t)return null;const n=ee(t.name);if(!n)return null;const o=Ge(t.tools)??{},r=Object.entries(o).map(([l,d])=>{const c=Ge(d);return{name:ee(c==null?void 0:c.name)??l,title:ee(c==null?void 0:c.title)??"",description:ee(c==null?void 0:c.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(l=>{const d=Ge(l);return{name:ee(d==null?void 0:d.name)??"",title:ee(d==null?void 0:d.title)??"",uri:ee(d==null?void 0:d.uri)??"",description:ee(d==null?void 0:d.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const d=Ge(l);return{name:ee(d==null?void 0:d.name)??"",title:ee(d==null?void 0:d.title)??"",uriTemplate:ee((d==null?void 0:d.uriTemplate)??(d==null?void 0:d.uri_template))??"",description:ee(d==null?void 0:d.description)??""}}).filter(l=>l.name||l.uriTemplate):[];return{name:n,authStatus:ee(t.authStatus??t.auth_status)??"unsupported",tools:r,resources:a,resourceTemplates:i}}async function DD(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await rt("plugin/list",t),o=[];for(const r of n.marketplaces??[]){const a=Ge(r);if(!a)continue;const s=Ge(a.interface),i={name:ee(a.name)??"",displayName:ee((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:ee(a.path)},l=Array.isArray(a.plugins)?a.plugins:[];for(const d of l){const c=Ug(d,i);c&&o.push(c)}}return o}async function FD(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await rt("plugin/read",t),o=Ge(n.plugin);if(!o)throw new Error("Plugin detail response is empty");const r=Ug(o.summary,{name:ee(o.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:ee(o.marketplacePath)??e.marketplacePath})??e;return{summary:r,description:ee(o.description)??r.longDescription,apps:Array.isArray(o.apps)?o.apps.map(Bg).filter(a=>a!==null):[],skills:Array.isArray(o.skills)?o.skills.map(Bk).filter(a=>a!==null):[],mcpServers:Er(o.mcpServers??o.mcp_servers)}}async function BD(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await rt("plugin/install",t),o=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:ee(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:o.map(Bg).filter(r=>r!==null)}}async function UD(e){await rt("plugin/uninstall",{pluginId:e})}async function zD(e,t){await rt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function HD(e){const t=[];let n=null,o=0;do{const r={limit:100};n&&(r.cursor=n),e&&(r.threadId=e);const a=await rt("app/list",r);for(const s of a.data??[]){const i=Uk(s,o);i&&t.push(i),o+=1}n=ee(a.nextCursor??a.next_cursor)}while(n);return t}async function qD(e,t){await rt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function WD(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const o=await rt("mcpServerStatus/list",n);for(const r of o.data??[]){const a=zk(r);a&&e.push(a)}t=ee(o.nextCursor??o.next_cursor)}while(t);return e}async function GD(){await rt("config/mcpServer/reload",{})}async function VD(e){const t=await rt("mcpServer/oauth/login",{name:e});return{authorizationUrl:ee(t.authorizationUrl??t.authorization_url)??""}}async function KD(){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 YD(e="",t=null,n=50){const o=new URLSearchParams;e.trim()&&o.set("query",e.trim()),t&&o.set("cursor",t),n&&Number.isFinite(n)&&o.set("limit",String(Math.max(1,Math.floor(n))));const r=o.toString(),a=await fetch(`/codex-api/composio/connectors${r?`?${r}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function JD(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 QD(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 XD(){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 ZD(){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 im(e){const t=Ge(e);if(!t)return null;const n=Ut(t.usedPercent??t.used_percent);if(n===null)return null;const o=Ut(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:Ut(t.resetsAt??t.resets_at)}}function Hk(e){const t=Ge(e);if(!t)return null;const n=Xn(t.hasCredits??t.has_credits),o=Xn(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ee(t.balance)}}function lm(e){const t=Ge(e);if(!t)return null;const n=im(t.primary),o=im(t.secondary),r=Hk(t.credits);return!n&&!o&&!r?null:{limitId:ee(t.limitId??t.limit_id),limitName:ee(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ee(t.planType??t.plan_type)}}function zg(e){const t=Ge(e);if(!t)return null;const n=Ge(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=lm(n==null?void 0:n.codex);return o||lm(t.rateLimits??t.rate_limits)}const qk=100;function Wk(){return qk}function Gk(e){return hx(e)}async function Vk(e,t){await mx({id:e,...t})}async function um(){return vx()}function Kk(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const o=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],r=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.name=="string"?i.name.trim():"",d=typeof i.path=="string"?i.path.trim():"";return l&&d?[{name:l,path:d}]:[]}):[],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():"",d=typeof i.path=="string"?i.path.trim():"",c=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&d&&c?[{label:l,path:d,fsPath:c}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:o,skills:r,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function Hg(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();if(!r||!Array.isArray(o))continue;const a=o.flatMap(s=>{const i=Kk(s);return i?[i]:[]});a.length>0&&(t[r]=a)}return t}async function cm(){const e=await fetch("/codex-api/thread-queue-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load thread queue state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return Hg(n.data)}async function Yk(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Hg(e))})).ok)throw new Error("Failed to save thread queue state")}async function Jk(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),o=await n.json();if(!n.ok){const r=Jt(o,"Failed to connect Telegram bot");throw new Error(r)}}async function Qk(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Jt(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},r=Array.isArray(o.allowedUserIds)?o.allowedUserIds:[],a=[];for(const s of r){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof o.botToken=="string"?o.botToken:"",allowedUserIds:a}}async function Xk(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const r=Jt(t,"Failed to load Telegram status");throw new Error(r)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:o.configured===!0,active:o.active===!0,mappedChats:typeof o.mappedChats=="number"?o.mappedChats:0,mappedThreads:typeof o.mappedThreads=="number"?o.mappedThreads:0,allowedUsers:typeof o.allowedUsers=="number"?o.allowedUsers:0,allowAllUsers:o.allowAllUsers===!0,lastError:typeof o.lastError=="string"?o.lastError:""}}async function Zk(){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 Yu(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 eI(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function tI(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 nI(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function oI(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 rI(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function aI(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function sI(){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 iI(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 lI(e,t){var n;try{return((n=(await rt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function Zd(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function uI(e,t){const n=Zd(e),o=n.split("/").filter(Boolean);if(o.length<2)return null;const r=o.lastIndexOf("skills");if(r>=2){const l=o[r-2]??"";if(l){const d=`/${[...o.slice(0,r+1),l,"SKILL.md"].join("/")}`;if(t.has(d))return{rootPath:d,rootName:l,isNested:d!==n}}}const a=o.indexOf("skills");if(a<0||a+1>=o.length-1)return null;const s=o[a+1]??"";if(!s)return null;const i=`/${[...o.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(i)?{rootPath:i,rootName:s,isNested:i!==n}:{rootPath:i,rootName:s,isNested:i!==n}}async function cI(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await rt("skills/list",t),o=n.data.flatMap(s=>s.skills),r=new Set(o.map(s=>Zd(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const i of s.skills){if(!i.name)continue;const l=uI(i.path,r),d=Zd(i.path),v=!!(l!=null&&l.isNested&&r.has(l.rootPath))?l.rootPath:d,f=d===v,g=a.get(v),S={name:i.name,displayName:l&&v===l.rootPath?l.rootName:void 0,description:i.shortDescription||i.description||"",path:v,scope:i.scope,enabled:i.enabled,__hasRoot:f};if(!g){a.set(v,S);continue}if(g.enabled=g.enabled||i.enabled,!g.__hasRoot&&f){a.set(v,S);continue}!g.displayName&&S.displayName&&(g.displayName=S.displayName),!g.description&&S.description&&(g.description=S.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const dI=6e4;async function wu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),dI);try{const o=new FormData;o.append("file",e);const r=await fetch("/codex-api/upload-file",{method:"POST",body:o,signal:t.signal});return r.ok?(await r.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function fI(e){return e==="payment_required"?e:null}function pI(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function dm(e){const t=Ge(e);if(!t)return null;const n=Ut(t.usedPercent??t.used_percent);if(n===null)return null;const o=Ut(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:Ut(t.resetsAt??t.resets_at)}}function hI(e){const t=Ge(e);if(!t)return null;const n=Xn(t.hasCredits??t.has_credits),o=Xn(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ee(t.balance)}}function mI(e){const t=Ge(e);if(!t)return null;const n=dm(t.primary),o=dm(t.secondary),r=hI(t.credits);return!n&&!o&&!r?null:{limitId:ee(t.limitId??t.limit_id),limitName:ee(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ee(t.planType??t.plan_type)}}function qg(e,t=null,n=null){const o=Ge(e);if(!o)return null;const r=ee(o.accountId),a=ee(o.storageId)??r,s=ee(o.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,storageId:a??r,userId:ee(o.userId),authMode:ee(o.authMode),email:ee(o.email),planType:ee(o.planType),lastRefreshedAtIso:ee(o.lastRefreshedAtIso)??"",lastActivatedAtIso:ee(o.lastActivatedAtIso),quotaSnapshot:mI(o.quotaSnapshot),quotaUpdatedAtIso:ee(o.quotaUpdatedAtIso),quotaStatus:i,quotaError:ee(o.quotaError),unavailableReason:fI(o.unavailableReason)??(pI(ee(o.quotaError))?"payment_required":null),isActive:Xn(o.isActive)??(a===n||r===t)}:null}function Wg(e){const t=Ge(e);if(!t)return null;const n=ee(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:ee(t.deviceName??t.device_name??t.name)??"",lastSeenAt:ee(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function vI(){const e=await rt("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:Xn(e.enabled)??!1,clients:t.map(Wg).filter(n=>n!==null)}}async function gI(){var o;const e=await fetch("/codex-api/approval-policy"),t=await e.json();if(!e.ok)throw new Error(t.error||"Failed to read approval policy");const n=ee((o=t.data)==null?void 0:o.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function yI(e){const t=await fetch("/codex-api/approval-policy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({policy:e})}),n=await t.json();if(!t.ok)throw new Error(n.error||"Failed to save approval policy")}async function wI(e){await rt(e?"remoteControl/enable":"remoteControl/disable",{})}async function bI(){const e=await rt("remoteControl/pairing/start",{});return{pairingCode:ee(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:ee(e.expiresAt??e.expires_at)}}async function TI(){const e=await rt("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(Wg).filter(n=>n!==null)}async function SI(e){await rt("remoteControl/client/revoke",{clientId:e})}async function CI(){try{const e=await rt("account/rateLimits/read");return zg(e)}catch(e){throw Fr(e,"Failed to load account rate limits","account/rateLimits/read")}}function gc(e){const t=Ge(e),n=ee(t==null?void 0:t.activeAccountId),o=ee(t==null?void 0:t.activeStorageId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:o,importedAccountId:ee(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:ee(t==null?void 0:t.importedStorageId)??void 0,accounts:r.map(a=>qg(a,n,o)).filter(a=>a!==null)}}async function xI(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Jt(t,"Failed to load accounts"));const n=Ge(t);return gc(n==null?void 0:n.data)}async function fm(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Jt(t,"Failed to refresh accounts"));const n=Ge(t);return gc(n==null?void 0:n.data)}async function kI(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Jt(t,"Failed to start Codex login"));const n=Ge(t),o=Ge(n==null?void 0:n.data),r=ee(o==null?void 0:o.loginUrl);if(!r)throw new Error("Failed to start Codex login");return r}async function II(e){const t=await fetch("/codex-api/accounts/login/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:e})}),n=await t.json();if(!t.ok)throw new Error(Jt(n,"Failed to complete Codex login"));const o=Ge(n);return gc(o==null?void 0:o.data)}async function AI(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(Jt(n,"Failed to switch account"));const o=Ge(n),r=Ge(o==null?void 0:o.data),a=qg(r==null?void 0:r.account,ee(r==null?void 0:r.activeAccountId),ee(r==null?void 0:r.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function _I(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(Jt(n,"Failed to remove account"));const o=Ge(n);return gc(o==null?void 0:o.data)}let bu=null,Nl=null;function PI(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const i of a)typeof i=="string"&&i.length>0&&!s.includes(i)&&s.push(i);return s},o=t.labels,r={};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[a,s]of Object.entries(o)){const i=typeof a=="string"?Xe(a):"";i.length>0&&typeof s=="string"&&(r[i]=s)}return{order:n(t.order).map(a=>Xe(a)),labels:r,active:n(t.active).map(a=>Xe(a)),projectOrder:n(t.projectOrder).map(a=>Xe(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"?Xe(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function $i(){return Nl?ef(Nl):(bu||(bu=RI().then(e=>(Nl=e,e)).finally(()=>{bu=null})),ef(await bu))}async function RI(){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 PI(n.data)}function ef(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 Hf(){Nl=null}async function EI(e,t){const n=(t??"").trim(),o=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),r=await o.json();if(!o.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:Xe(r.data.cwd),gitRoot:Xe(r.data.gitRoot)}}async function MI(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),o=await n.json();if(!n.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:Xe(o.data.cwd),gitRoot:Xe(o.data.gitRoot)}}async function jI(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),o=await fetch(`/codex-api/worktree/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load branches");const a=Array.isArray(r.data)?r.data:[],s=[],i=new Set;for(const l of a){if(!l||typeof l!="object"||Array.isArray(l))continue;const d=l,c=typeof d.value=="string"?d.value.trim():"",v=typeof d.label=="string"?d.label.trim():"";!c||i.has(c)||(i.add(c),s.push({value:c,label:v||c}))}return s}async function LI(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[],changedFiles:[]};const n=new URLSearchParams({cwd:t}),o=await fetch(`/codex-api/git/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load Git branch state");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,l=Array.isArray(a.options)?a.options:[],d=[],c=new Set;for(const B of l){if(!B||typeof B!="object"||Array.isArray(B))continue;const L=B,j=typeof L.value=="string"?L.value.trim():"",U=typeof L.label=="string"?L.label.trim():"";!j||c.has(j)||(c.add(j),d.push({value:j,label:U||j,isCurrent:L.isCurrent===!0,isRemote:L.isRemote===!0}))}i&&!c.has(i)&&d.unshift({value:i,label:i,isCurrent:!0});const v=a.headSha,f=a.headSubject,g=a.headDate,S=a.gitRoot,P=Gg(a.changedFiles);return{currentBranch:i,headSha:typeof v=="string"&&v.trim()?v.trim():null,headSubject:typeof f=="string"&&f.trim()?f.trim():null,headDate:typeof g=="string"&&g.trim()?g.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof S=="string"?Xe(S):"",options:d,changedFiles:P}}function Gg(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){if(!o||typeof o!="object"||Array.isArray(o))continue;const r=o,a=r.path,s=typeof a=="string"?Xe(a.trim()):"";if(!s)continue;const i=r.status,l=typeof i=="string"?i.trim():"",d=r.label,c=typeof d=="string"&&d.trim()?d.trim():l;n.push({path:s,previousPath:typeof r.previousPath=="string"&&r.previousPath.trim()?Xe(r.previousPath.trim()):null,status:l,label:c,addedLineCount:typeof r.addedLineCount=="number"?r.addedLineCount:null,removedLineCount:typeof r.removedLineCount=="number"?r.removedLineCount:null})}return n}async function NI(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),o=await fetch(`/codex-api/git/repository-status?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to read Git repository status");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?Xe(a.gitRoot):""}}async function $I(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to switch branch");const r=(a=o.data)==null?void 0:a.currentBranch;return typeof r=="string"&&r.trim()?r.trim():null}async function OI(e,t,n={}){const o=e.trim(),r=t.trim();if(!o||!r)return[];const a=new URLSearchParams({cwd:o,branch:r,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),s=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(i.error||"Failed to load branch commits");return(Array.isArray(i.data)?i.data:[]).flatMap(d=>{if(!d||typeof d!="object"||Array.isArray(d))return[];const c=d,v=typeof c.sha=="string"?c.sha.trim():"",f=typeof c.shortSha=="string"?c.shortSha.trim():"",g=typeof c.subject=="string"?c.subject.trim():"",S=typeof c.date=="string"?c.date.trim():"";return!v||!f?[]:[{sha:v,shortSha:f,subject:g||f,date:S}]})}async function DI(e,t){const n=e.trim(),o=t.trim();if(!n||!o)return[];const r=new URLSearchParams({cwd:n,sha:o}),a=await fetch(`/codex-api/git/commit-files?${r.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load commit files");return(Array.isArray(s.data)?s.data:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const d=l,c=typeof d.path=="string"?d.path:"",v=typeof d.previousPath=="string"&&d.previousPath.length>0?d.previousPath:null,f=typeof d.status=="string"?d.status.trim():"",g=typeof d.label=="string"?d.label.trim():"",S=typeof d.addedLineCount=="number"&&Number.isFinite(d.addedLineCount)?d.addedLineCount:null,P=typeof d.removedLineCount=="number"&&Number.isFinite(d.removedLineCount)?d.removedLineCount:null;return!c||!f?[]:[{path:c,previousPath:v,status:f,label:g||f,addedLineCount:S,removedLineCount:P}]})}async function FI(e,t,n){const o=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to reset branch to commit");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?Xe(a.gitRoot):"",options:[],changedFiles:Gg(a.changedFiles)}}async function bd(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");Nl=ef(e)}async function Tu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),o=await n.json();if(!n.ok){const i=Jt(o,"Failed to open project root");throw new Error(i)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=typeof a.path=="string"?Xe(a.path):"";return Hf(),s}function BI(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function UI(e,t){var a;const n=e.headers.get("content-disposition")??"",o=n.match(/filename\*=UTF-8''([^;]+)/iu);if(o!=null&&o[1])try{return decodeURIComponent(o[1])}catch{return o[1]}const r=n.match(/filename="?([^";]+)"?/iu);return((a=r==null?void 0:r[1])==null?void 0:a.trim())||t}async function zI(e,t){var c;const n=await fetch(BI(e));if(!n.ok){const v=await n.json().catch(()=>null),f="Failed to export project",g=Jt(v,f),S=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),P=g!==f?g:S?`Failed to export project: ${S}`:f;throw new Error(P)}const o=Number(n.headers.get("content-length")??""),r=Number.isFinite(o)&&o>0?o:null,a=UI(n,"project.zip"),s=(c=n.body)==null?void 0:c.getReader();if(!s){const v=await n.blob();return t==null||t({loaded:v.size,total:v.size||r}),{blob:v,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:r});;){const{done:v,value:f}=await s.read();if(v)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:r}))}const d=i.map(v=>{const f=new Uint8Array(v.byteLength);return f.set(v),f.buffer});return{blob:new Blob(d,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function HI(e,t){const n=new URLSearchParams({parent:t}),o=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),r=await hi(o);if(!o.ok){const l=Jt(r,"Failed to import project");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?Xe(s.path):"";return i&&Hf(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function pm(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof o.path=="string"?o.path.trim():""}async function qI(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const o=await fetch(`/codex-local-directories?${n.toString()}`),r=await hi(o);if(!o.ok){const l=Jt(r,"Failed to load local directories");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?Xe(s.path):"",parentPath:typeof s.parentPath=="string"?Xe(s.parentPath):"",entries:i.flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const d=l,c=typeof d.name=="string"?d.name.trim():"",v=typeof d.path=="string"?Xe(d.path):"";return c&&v?[{name:c,path:v}]:[]})}}async function eF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await hi(n);if(!n.ok){const i=Jt(o,"Failed to load workspace files");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const l=i,d=typeof l.path=="string"?Xe(l.path):"",c=typeof l.relativePath=="string"?l.relativePath.trim():"";return!d||!c?[]:[{path:d,relativePath:c,isDirectory:l.isDirectory===!0}]})}async function tF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await hi(n);if(!n.ok){const i=Jt(o,"Failed to preview file");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data,s=a&&typeof a=="object"&&!Array.isArray(a)?a:{};return{path:typeof s.path=="string"?s.path:e,name:typeof s.name=="string"?s.name:"",size:typeof s.size=="number"?s.size:0,isText:s.isText===!0,isImage:s.isImage===!0,content:typeof s.content=="string"?s.content:void 0,truncated:s.truncated===!0}}async function WI(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await hi(t);if(!t.ok){const s=Jt(n,"Failed to create local directory");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.path=="string"?Xe(r.path):"";return a&&Hf(),a}async function GI(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),o=await hi(n);if(!n.ok){const s=Jt(o,"Failed to clone GitHub repository");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof a.path=="string"?Xe(a.path):""}async function VI(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 hi(t);if(!t.ok){const s=Jt(n,"Failed to create new chat folder");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.cwd=="string"?Xe(r.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof r.outputDirectory=="string"?Xe(r.outputDirectory):a,workspaceRoot:typeof r.workspaceRoot=="string"?Xe(r.workspaceRoot):""}}async function KI(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),o=await n.json();if(!n.ok){const s=Jt(o,"Failed to suggest project name");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?Xe(a.path):""}}function YI(e){const t=Ge(e);if(!t)return null;const n=ee(t.key),o=typeof t.text=="string"?t.text:"",r=ee(t.kind);return!n||!r||r!=="meta"&&r!=="hunk"&&r!=="add"&&r!=="remove"&&r!=="context"?null:{key:n,kind:r,text:o,oldLine:Ut(t.oldLine),newLine:Ut(t.newLine)}}function JI(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=typeof t.header=="string"?t.header:"",r=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:o,patch:r,addedLineCount:Ut(t.addedLineCount)??0,removedLineCount:Ut(t.removedLineCount)??0,oldStart:Ut(t.oldStart),oldLineCount:Ut(t.oldLineCount)??0,newStart:Ut(t.newStart),newLineCount:Ut(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>YI(a)).filter(a=>a!==null):[]}:null}function QI(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.path),r=ee(t.absolutePath),a=ee(t.operation);return!n||!o||!r||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:o,absolutePath:r,previousPath:ee(t.previousPath),previousAbsolutePath:ee(t.previousAbsolutePath),operation:a,addedLineCount:Ut(t.addedLineCount)??0,removedLineCount:Ut(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>JI(s)).filter(s=>s!==null):[]}}function Vg(e){const t=Ge(e),n=Ge(t==null?void 0:t.data),o=Ge(n==null?void 0:n.summary),r=ee(n==null?void 0:n.scope),a=r==="baseBranch"||r==="commit"?r:"workspace",s=ee(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:ee(n==null?void 0:n.cwd)??"",gitRoot:ee(n==null?void 0:n.gitRoot),isGitRepo:Xn(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:ee(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>ee(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:ee(n==null?void 0:n.commitSha),headBranch:ee(n==null?void 0:n.headBranch),mergeBaseSha:ee(n==null?void 0:n.mergeBaseSha),generatedAtIso:ee(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Ut(o==null?void 0:o.fileCount)??0,addedLineCount:Ut(o==null?void 0:o.addedLineCount)??0,removedLineCount:Ut(o==null?void 0:o.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>QI(i)).filter(i=>i!==null):[]}}function XI(e){const t=Ge(e),n=Ge(t==null?void 0:t.data);return{fileCount:Ut(n==null?void 0:n.fileCount)??0,addedLineCount:Ut(n==null?void 0:n.addedLineCount)??0,removedLineCount:Ut(n==null?void 0:n.removedLineCount)??0}}async function nF(e,t,n,o,r){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});o&&o.trim()&&a.set("baseBranch",o.trim()),r&&r.trim()&&a.set("commitSha",r.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(Jt(i,"Failed to load review snapshot"));return Vg(i)}async function ZI(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),o=await fetch(`/codex-api/review/summary?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(Jt(r,"Failed to load review summary"));return XI(r)}async function oF(e){const t=await fetch("/codex-api/review/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw new Error(Jt(n,"Failed to apply review action"));return Vg(n)}async function rF(e){const t=await fetch("/codex-api/review/git/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})}),n=await t.json();if(!t.ok)throw new Error(Jt(n,"Failed to initialize Git"))}async function eA(e,t,n,o,r,a,s){try{const i=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n,action:o,patchIds:r,scope:a,filePaths:s})}),l=await i.json().catch(()=>({}));if(!i.ok){const d=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:[d],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 tA(e,t,n){const o=await eA(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}const nA={},oA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function rA(e,t){return _(),F("svg",oA,[...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 Cs=It(nA,[["render",rA]]),aA={},sA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function iA(e,t){return _(),F("svg",sA,[...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 Su=It(aA,[["render",iA]]),lA={},uA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function cA(e,t){return _(),F("svg",uA,[...t[0]||(t[0]=[w("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const tf=It(lA,[["render",cA]]),dA={},fA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function pA(e,t){return _(),F("svg",fA,[...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 Zi=It(dA,[["render",pA]]),hA={},mA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vA(e,t){return _(),F("svg",mA,[...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 qf=It(hA,[["render",vA]]),gA={},yA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wA(e,t){return _(),F("svg",yA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const bA=It(gA,[["render",wA]]),TA={},SA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function CA(e,t){return _(),F("svg",SA,[...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 bs=It(TA,[["render",CA]]),Kg="codex-web-local.ui-language.v1",xA={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...":"加载消息中...",Plan:"计划",Updating:"更新中",Step:"步骤","Edit this message":"编辑此消息","Edit message":"编辑消息","Rollback this message":"回退此消息",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查",Commit:"提交","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","No file changes in this commit.":"此提交中没有文件更改。","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads":"没有匹配的线程","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads":"没有线程","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Yes:"是","Yes for Session":"本次会话内允许",pending:"条待处理","Do you want to run this command?":"是否运行此命令?","Do you want to make these changes?":"是否进行这些更改?","Do you want to grant these permissions?":"是否授予这些权限?","An MCP server needs your input before Codex can continue.":"MCP 服务器需要你的输入,Codex 才能继续。","Codex needs your answer before it can continue.":"Codex 需要你的回答才能继续。","Codex is waiting for a response before it can continue.":"Codex 正在等待你的回复,然后才能继续。",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作",Skill:"技能","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Ask Codex anything, @ to add files, / for commands":"向 Codex 提问,@ 添加文件,/ 执行命令",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑","Edit automation":"编辑自动化",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽",Hooks:"Hooks","Reload lifecycle hooks":"重新加载生命周期 Hooks","Hooks are not supported by this Codex version.":"当前 Codex 版本不支持 Hooks。","Loading hooks…":"加载 Hooks 中…","No hooks registered.":"未注册任何 Hooks。",Global:"全局",Enabled:"已启用","Compacting thread context…":"正在压缩上下文…","Context compacted":"上下文已压缩","Approval policy":"审批策略","Choose when Codex asks for your permission before running commands or changing files.":"选择 Codex 在执行命令或修改文件前何时征求你的许可。","Only untrusted commands":"仅不受信任的命令","After a command fails":"命令失败后","When Codex requests it":"请求时",Never:"从不","Unless trusted":"除非信任",Default:"默认","Execution plans":"执行计划","Not supported by this Codex version":"当前 Codex 版本不支持","Remote control":"远程控制","Enable or disable remote control":"启用或禁用远程控制","Remote control is not supported by this Codex version.":"当前 Codex 版本不支持远程控制。","Pair a new device":"配对新设备","Generate code":"生成配对码","Paired devices":"已配对设备","No paired devices.":"暂无已配对设备。",Revoke:"撤销","Starting…":"启动中…","Add panel":"添加面板","Approval policy saved":"审批策略已保存",Automations:"自动化","Bearer token (optional)":"Bearer Token(可选)","Close panel":"关闭面板","Close side panel":"关闭侧边面板",Codex:"Codex",Compact:"压缩","Compacting…":"正在压缩…","Compacts context before send":"发送前压缩上下文","Auto-compact before send":"发送前自动压缩","Compacting context — the message will send after compaction":"正在压缩上下文——消息将在压缩完成后发送","Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.":"当剩余上下文占比等于或低于该百分比时,发送前先自动压缩上下文。0 表示关闭,退回服务端自动压缩。","Custom endpoint":"自定义端点","Failed to resolve model from custom endpoint; check the URL and try again":"无法从自定义端点获取模型,请检查 URL 后重试",Off:"关闭",Dismiss:"忽略",Download:"下载","Drag to reorder queued message":"拖动可重新排列排队消息","Exit full screen composer":"退出全屏输入框","Expand composer":"展开输入框","Explore Plugins & Apps":"探索插件与应用","Export Project":"导出项目",Exporting:"正在导出","Failed to share project. Use Download instead.":"项目分享失败,请改用下载。","Files panel":"文件面板","Filter files...":"筛选文件...",Git:"Git","Git panel":"Git 面板","Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.":"将 Codex 接入 Gmail、日历、GitHub、Slack、Browser Use 等应用,让它可以立即帮你处理实际工作。","Import Project":"导入项目","Importing…":"正在导入…","Issue detected":"发现问题","Loading files...":"加载文件中...","Loading…":"加载中…","New in Codex":"Codex 新功能","No files in workspace.":"工作区中没有文件。","No searchable directory for this thread":"此线程没有可搜索的目录","Open side panel":"打开侧边面板","OpenCode Zen":"OpenCode Zen",OpenRouter:"OpenRouter",Plugin:"插件","Plugins are here":"插件来了","Plugins, apps, MCPs":"插件、应用、MCP","Preparing project ZIP...":"正在准备项目 ZIP...","Preparing...":"正在准备...",Ready:"就绪",Repo:"仓库","Scheduled work":"定时任务",Search:"搜索","Search options...":"搜索选项...","Send feedback":"发送反馈",Share:"分享","Skills directory":"技能目录","Terminal panel":"终端面板","This browser blocked sharing the ZIP. Use Download instead.":"浏览器阻止了分享 ZIP,请改用下载。",User:"用户","sk-or-v1-... (optional, uses free keys if empty)":"sk-or-v1-...(可选,留空则使用免费 key)","File preview":"文件预览","Loading file…":"正在加载文件…","Failed to preview file":"文件预览失败","This file type cannot be previewed.":"此文件类型无法预览。","Open in browser":"在浏览器中打开","File is large; showing the first part.":"文件较大,仅显示开头部分。","Confirm delete":"确认删除",Confirm:"确认",Authenticated:"已认证",Failed:"失败","Logged in":"已登录",Unknown:"未知","No auth":"无需认证","No auth required":"无需认证","Connection required":"需要连接","Composio workspace":"Composio 工作区","Apps needing auth":"需要认证的应用","Plugin shares":"插件分享",Connector:"连接器",connected:"已连接",account:"个账户",accounts:"个账户",Manage:"管理",Reconnect:"重新连接",Connect:"连接",App:"应用",Plugins:"插件",Apps:"应用","Composio CLI shares the login and connections from this machine.":"Composio CLI 共享本机的登录状态与连接。","Bearer token":"Bearer Token","Login required":"需要登录","Auth unsupported":"不支持认证","Status unknown":"状态未知","OpenAI catalog":"OpenAI 目录","Ecosystem directory":"生态系统目录",Expired:"已过期",Pending:"待处理","Plugins make Codex work your way.":"插件让 Codex 按你的方式工作。","Connect Codex to external apps and services.":"将 Codex 连接到外部应用与服务。","Browse Composio connectors, auth state, and ready-to-try integrations.":"浏览 Composio 连接器、认证状态与可直接尝试的集成。","MCPs first, then installed skills and GitHub sync state.":"先看 MCP,再是已安装技能与 GitHub 同步状态。","Close plugin detail":"关闭插件详情","Close plugin shares":"关闭插件分享","Close Composio detail":"关闭 Composio 详情","Add another automation":"再添加一个自动化","New thread":"新建线程",methods:"个方法",Schedule:"计划",Daily:"每天",days:"天",Interval:"间隔","Run every day at":"每天运行时间","Run every":"每隔",Unit:"单位","Running…":"运行中…","Run now":"立即运行","Archive and remove":"归档并移除",Delete:"删除",'This will archive the thread "{title}" and remove the attached heartbeat automations.':"这将归档线程「{title}」并移除其关联的心跳自动化。",'This will archive the thread "{title}". You can find it later in archived threads.':"这将归档线程「{title}」。你之后可以在已归档线程中找到它。","Recycle bin":"回收站","Threads you removed are kept here so you can restore them.":"被移除的线程会保存在这里,你可以随时还原。","Recycle bin is empty.":"回收站是空的。",Restore:"还原","Restoring…":"还原中…","Delete permanently":"永久删除","Delete thread?":"删除线程?","Archive chat and remove automations?":"归档聊天并移除自动化?",active:"个进行中",added:"已新增","Add automation":"添加自动化","Add automation…":"添加自动化…",ago:"前","Answer the required field":"请填写必填字段",app:"应用",automations:"个自动化",cached:"缓存",changed:"已更改",Checkout:"检出","Checking out...":"检出中…","command:":"命令:","Context window":"上下文窗口","Copy path":"复制路径",Credits:"额度","cwd:":"工作目录:","day(s)":"天",deleted:"已删除",Detached:"已分离",edited:"已编辑",Edited:"已编辑",Every:"每","exitCode:":"退出码:","Failed to connect {name}":"连接 {name} 失败","Failed to start login for {name}":"为 {name} 启动登录失败","file changed":"个文件已更改","files changed":"个文件已更改","hour(s)":"小时",hours:"小时",Image:"图片",input:"输入","Last turn":"上一轮","Manage automations…":"管理自动化…","minute(s)":"分钟",minutes:"分钟",moved:"已移动","Network access":"网络访问",Next:"下次","Next run":"下次运行","Not scheduled":"未计划",RRULE:"规则","No login URL returned for {name}":"未返回 {name} 的登录链接","Opened {name} authorization":"已打开 {name} 授权",output:"输出",plugin:"插件","plugin installed":"插件已安装","plugin uninstalled":"插件已卸载",Preferred:"首选","Primary window":"主窗口","Project automation":"项目自动化",Read:"读取",reasoning:"推理","Removing...":"移除中…","resets in":"重置于","Resets in":"重置于","runs every":"每","Secondary window":"次窗口","Session total":"会话总计","Share this plugin":"共享此插件","Sharing...":"共享中…",Show:"显示","skill installed":"技能已安装","skill uninstalled":"技能已卸载","start new thread":"新建线程","status:":"状态:",total:"总计","Weekly refresh":"每周刷新",Write:"写入","Current branch":"当前分支","Credits available":"额度可用","Custom schedule":"自定义计划","Detached HEAD":"已分离 HEAD","Every minute":"每分钟",Hourly:"每小时","In context":"上下文内","Loading branch...":"加载分支中...","Rate limits":"速率限制","Resetting now":"正在重置",unlimited:"无限",Weekly:"每周",Window:"窗口","Automation details":"自动化详情","Automation run queued.":"自动化运行已排队。","Automation saved.":"自动化已保存。","Awaiting approval":"等待审批","Awaiting response":"等待响应",Branches:"分支",command:"个命令",commands:"个命令","Command approval required":"需要命令审批",Commits:"提交",Completed:"已完成","Copied commit ref":"已复制提交引用",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成","Rollback this turn?":"回退到该轮?",Exit:"退出","Failed to delete project automation":"删除项目自动化失败","Failed to install skill":"安装技能失败","Failed to load automations":"加载自动化失败","Failed to load skills":"加载技能失败","Failed to remove automation":"移除自动化失败","Failed to run automation":"运行自动化失败","Failed to save automation":"保存自动化失败","Failed to search skills":"搜索技能失败","Failed to uninstall skill":"卸载技能失败","Failed to update file changes.":"更新文件变更失败。","Failed to update skill":"更新技能失败","File change approval required":"需要文件变更审批",Heartbeat:"心跳","Input required":"需要输入","Install completed but no local skill path was returned":"安装完成,但未返回本地技能路径","Install completed but the local skill was not found after refresh":"安装完成,但刷新后未找到本地技能","Install failed":"安装失败",Interrupted:"已中断","latest:":"最新:","Loading automations...":"加载自动化中...","Loading commits...":"加载提交中...","MCP server input required":"需要 MCP 服务器输入","Modified files":"修改的文件","New automation":"新自动化","No automations yet":"还没有自动化","No branches found.":"未找到分支。","No commits found.":"未找到提交。","No file changes.":"无文件更改。","No file changes to redo.":"没有可重做的文件变更。","No file changes to undo.":"没有可撤销的文件变更。","No messages in this thread yet.":"此线程还没有消息。",now:"刚刚","Open this chat before copying":"请先打开此聊天再复制","Pin thread":"固定线程","Unpin thread":"取消固定线程",paused:"个已暂停","Permissions approval required":"需要权限审批",Project:"项目","Project automation requires a resolved absolute project path.":"项目自动化需要已解析的绝对项目路径。",Redo:"重做","Redo file changes?":"重做文件变更?","Redo the file changes from this turn? This reapplies the edits to the working tree.":"重做本轮的文件变更?这会重新将修改应用到工作树。",Redoing:"正在重做","Refreshing...":"刷新中...","Rejected from codex-web-local UI.":"已在 codex-web-local 界面中拒绝。","Rename project":"重命名项目",Reset:"重置","Reset-history refs":"重置历史引用",remote:"远程","Review Worktree Changes":"审查工作树更改","Review Worktree Changes (Open)":"审查工作树更改(打开)",Running:"运行中","Search commits...":"搜索提交...","Search skills":"搜索技能","Select a branch.":"请选择一个分支。","Select a chat target for this automation":"为此自动化选择一个聊天目标","Select a project target for this automation":"为此自动化选择一个项目目标",Stopped:"已停止","Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。",Target:"目标","This creates a heartbeat automation attached to the selected chat.":"这会在所选聊天上创建一个心跳自动化。","This creates a project automation attached to the selected project folder.":"这会在所选项目文件夹上创建一个项目自动化。","This creates heartbeat automations attached to the selected thread.":"这会在所选线程上创建心跳自动化。","This creates project automations attached to the selected project folder.":"这会在所选项目文件夹上创建项目自动化。","This rolls the thread back to this turn so you can edit the message. Later replies will be removed.":"将线程回退到本轮,以便你编辑消息。之后的回复将被移除。","Tool call rejected from codex-web-local UI.":"工具调用已在 codex-web-local 界面中拒绝。","Tool call waiting for response":"工具调用等待响应","Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"切换或重置前,必须提交、暂存或丢弃已跟踪的更改。除非 Git 会覆盖,否则允许存在未跟踪的文件。",Undo:"撤销","Undo file changes?":"撤销文件变更?","Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically.":"撤销本轮的文件变更?这会修改工作树,Codex 无法自动还原。","Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.":"撤销对 {file} 的变更?这会修改工作树,Codex 无法自动还原。","Redo the changes to {file}? This reapplies the edits to the working tree.":"重做对 {file} 的变更?这会重新应用对工作树的编辑。",Undoing:"正在撤销","Uninstall failed":"卸载失败","Use a thread or project menu to add an automation.":"请通过线程或项目菜单添加自动化。"},hm={en:"English","zh-CN":"简体中文"};function kA(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Kg))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const yc=T(kA());function Yg(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Yg(yc.value);function IA(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function AA(e){yc.value=e,Yg(e),typeof window<"u"&&window.localStorage.setItem(Kg,e)}function Jg(e,t){const n=yc.value==="zh-CN"?xA[e]??e:e;return IA(n,t)}function da(){return{uiLanguage:yc,uiLanguageOptions:[{value:"en",label:hm.en},{value:"zh-CN",label:hm["zh-CN"]}],t:Jg,setUiLanguage:AA}}const Qg="brutalstrikedevs@gmail.com",_A=20,PA=6500,mm=1800,Td=12,vm=240,gm=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,qi=T([]);let ym=!1,Sd=!1,Cd=null;function _l(e){if(e instanceof Error)return e.stack||e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function RA(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function EA(e,t){var o;const n=(o=t==null?void 0:t.method)==null?void 0:o.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function Xg(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function wm(e){return encodeURIComponent(e)}function MA(){return`mailto:${Qg}`}function jA(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
|
|
47
|
-
`).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
|
|
48
|
-
|
|
49
|
-
`).trim())??"";return e?e.length>mm?`${e.slice(0,mm)}
|
|
50
|
-
...[truncated]`:e:"No visible page text captured."}function LA(e,t){const n=t.replace(/\r\n/g,`
|
|
51
|
-
`).replace(/[ \t]+/g," ").trim();return n?gm.test(e)||gm.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>vm?`${n.slice(0,vm)}...[truncated, ${n.length} chars total]`:n:""}function bm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,Td);for(let a=0;a<o;a+=1){const s=e.key(a);s&&n.push(`${s}=${LA(s,e.getItem(s)??"")}`)}const r=e.length>Td?`
|
|
52
|
-
...${e.length-Td} more item(s)`:"";return`${t}:
|
|
53
|
-
${n.join(`
|
|
54
|
-
`)||"empty"}${r}`}catch(n){return`${t}: unavailable (${Xg(_l(n))})`}}function NA(){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}`,bm(window.localStorage,"localStorage"),bm(window.sessionStorage,"sessionStorage")].join(`
|
|
55
|
-
`)}function oi(e){const t=e.message.trim();if(!t)return;const n=qi.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const o={...e,message:t,atIso:e.atIso??new Date().toISOString()};qi.value=[o,...qi.value].slice(0,_A)}function Zg(e=qi.value){var d;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,o=typeof navigator>"u"?"unknown":navigator.userAgent,r="0.1.111",a="codex-mobile",s=e.slice(0,12).map((c,v)=>[`${v+1}. [${c.atIso}] ${c.kind}`,c.method?`${c.method}`:"",c.url??"",typeof c.status=="number"?`${c.status} ${c.statusText??""}`.trim():"",c.message].filter(Boolean).join(" | ")).join(`
|
|
56
|
-
`),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${a}`,"","Browser/app state",NA(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",jA()].join(`
|
|
57
|
-
`).slice(0,PA),l=`Codex Web feedback: ${Xg((d=e[0])==null?void 0:d.message)}`;return`mailto:${Qg}?subject=${wm(l)}&body=${wm(i)}`}function $A(){typeof window>"u"||(window.location.href=Zg())}function OA(){if(!(typeof window>"u")&&(ym||(ym=!0,window.addEventListener("error",e=>{oi({kind:"window-error",message:e.error?_l(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{oi({kind:"unhandled-rejection",message:_l(e.reason),url:window.location.href})})),!Sd)){if(typeof window.fetch!="function"){oi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{Cd=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=RA(e),o=EA(e,t);try{const r=await Cd(e,t);return r.ok||oi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${r.status}`,url:n,method:o,status:r.status,statusText:r.statusText}),r}catch(r){throw oi({kind:"fetch-error",message:_l(r),url:n,method:o}),r}},Sd=!0}catch(e){Cd=null,Sd=!1;try{oi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${_l(e)}`,url:window.location.href})}catch{}}}}function ey(){const e=K(()=>qi.value.length>0);function t(n,o){oi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:qi,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:$A,buildFeedbackMailto:Zg,feedbackMailtoBase:MA}}const ty="codex-web-local.recycle-bin.v1";function ny(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ty);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>!!n&&typeof n.id=="string"&&typeof n.title=="string"):[]}catch{return[]}}function Tm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ty,JSON.stringify(e))}catch{}}const Ea=T(ny());function DA(){function e(){Ea.value=ny()}function t(r){Ea.value=[{...r,archivedAtIso:new Date().toISOString()},...Ea.value.filter(a=>a.id!==r.id)],Tm(Ea.value)}function n(r){Ea.value=Ea.value.filter(a=>a.id!==r),Tm(Ea.value)}async function o(r){if(!Ea.value.some(a=>a.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await Sk(r),n(r),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Ea,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}const FA=["title","aria-label","disabled"],BA={key:1,class:"composer-dropdown-value"},UA={key:0,class:"composer-dropdown-search-wrap"},zA=["placeholder","onKeydown"],HA={class:"composer-dropdown-options",role:"listbox"},qA=["onClick"],WA={key:0,class:"composer-dropdown-empty"},GA=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,o=t,r=T(null),a=T(null),s=T(null),i=T(null),l=T(!1),d=T(""),c=T({});let v=!1;const f=K(()=>{var ke;const ne=n.options.find($e=>$e.value===n.modelValue);return ne?ne.label:((ke=n.placeholder)==null?void 0:ke.trim())||""}),g=K(()=>n.openDirection??"down"),S=K(()=>n.menuAlign??"start"),P=K(()=>n.iconOnly===!0),B=K(()=>n.enableSearch===!0),L=K(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),j=K(()=>{var ne;return((ne=n.searchPlaceholder)==null?void 0:ne.trim())||"Quick search projects"}),U=K(()=>{var ne;return((ne=n.emptyLabel)==null?void 0:ne.trim())||"No results"}),H=K(()=>{var ne;return f.value||((ne=n.placeholder)==null?void 0:ne.trim())||"Select option"}),he=K(()=>{const ne=d.value.trim().toLowerCase();return ne?n.options.filter(ke=>ke.label.toLowerCase().includes(ne)||ke.value.toLowerCase().includes(ne)):n.options});function de(){n.disabled||(l.value=!l.value)}function W(ne,ke,$e){return Math.min($e,Math.max(ke,ne))}function ve(){var oe,le,Ee,Be;if(!l.value)return;const ne=r.value;if(!ne||typeof window>"u")return;const ke=ne.getBoundingClientRect(),$e=window.innerWidth,te=window.innerHeight,ce=8,Le=8,Pe=Math.max(0,$e-ce*2),Fe=((oe=s.value)==null?void 0:oe.offsetWidth)??((le=a.value)==null?void 0:le.offsetWidth)??224,Ke=((Ee=s.value)==null?void 0:Ee.offsetHeight)??((Be=a.value)==null?void 0:Be.offsetHeight)??0,lt=Math.min(Fe,Pe),Ze=Math.max(ce,$e-lt-ce),ut=S.value==="end"?ke.right-lt:ke.left,fe=W(ut,ce,Ze);let N=g.value==="up"?ke.top-Ke-Le:ke.bottom+Le;Ke>0&&N+Ke>te-ce&&(N=te-Ke-ce),N=Math.max(ce,N),c.value={position:"fixed",left:`${fe}px`,right:"auto",top:`${N}px`,bottom:"auto",width:`${lt}px`}}function Se(){v||typeof window>"u"||(window.addEventListener("resize",ve),window.addEventListener("scroll",ve,!0),v=!0)}function Ae(){!v||typeof window>"u"||(window.removeEventListener("resize",ve),window.removeEventListener("scroll",ve,!0),v=!1)}function pe(ne){o("update:modelValue",ne),l.value=!1,d.value=""}function Q(){if(d.value.length>0){d.value="";return}l.value=!1}function me(ne){if(!l.value)return;const ke=r.value;if(!ke)return;const $e=ne.target;$e instanceof Node&&(ke.contains($e)||(l.value=!1,d.value=""))}return nt(l,ne=>{if(!ne){Ae(),c.value={};return}Se(),Nt(()=>{var ke;ve(),window.requestAnimationFrame(ve),B.value&&((ke=i.value)==null||ke.focus())})}),pi(()=>{window.addEventListener("pointerdown",me)}),_s(()=>{window.removeEventListener("pointerdown",me),Ae()}),(ne,ke)=>(_(),F("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[w("button",{class:at(["composer-dropdown-trigger",L.value]),type:"button",title:H.value,"aria-label":H.value,disabled:e.disabled,onClick:de},[e.selectedPrefixIcon?(_(),Qe(Af(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ye("",!0),P.value?ye("",!0):(_(),F("span",BA,D(f.value),1)),Oe(Cs,{class:"composer-dropdown-chevron"})],10,FA),l.value?(_(),F("div",{key:0,ref_key:"menuWrapRef",ref:a,class:at(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":g.value==="up","composer-dropdown-menu-wrap-down":g.value==="down"}]),style:er(c.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[B.value?(_(),F("div",UA,[xn(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":ke[0]||(ke[0]=$e=>d.value=$e),class:"composer-dropdown-search-input",type:"text",placeholder:j.value,onKeydown:Ao(gt(Q,["prevent"]),["esc"])},null,40,zA),[[Nn,d.value]])])):ye("",!0),w("ul",HA,[(_(!0),F(ot,null,Zt(he.value,$e=>(_(),F("li",{key:$e.value},[w("button",{class:at(["composer-dropdown-option",{"is-selected":$e.value===e.modelValue}]),type:"button",onClick:te=>pe($e.value)},D($e.label),11,qA)]))),128)),he.value.length===0?(_(),F("li",WA,D(U.value),1)):ye("",!0)])],512)],6)):ye("",!0)],512))}}),ci=It(GA,[["__scopeId","data-v-48e2516e"]]),VA={},KA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function YA(e,t){return _(),F("svg",KA,[...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 nf=It(VA,[["render",YA]]),JA=["aria-label","onKeydown"],QA={class:"app-dialog-header"},XA={class:"app-dialog-title-wrap"},ZA={class:"app-dialog-title"},e_={key:0,class:"app-dialog-subtitle"},t_=["aria-label","title"],n_={class:"app-dialog-body"},o_={key:0,class:"app-dialog-footer"},r_=hn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da();function a(){o("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return nt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),_s(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(_(),Qe(Vi,{to:"body"},[e.open?(_(),F("div",{key:0,class:"app-dialog-overlay",onClick:gt(a,["self"])},[w("div",{class:at(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Ao(gt(a,["prevent"]),["esc"])},[w("div",QA,[w("div",XA,[w("h3",ZA,D(e.title),1),e.subtitle?(_(),F("p",e_,D(e.subtitle),1)):ye("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":h(r)("Close"),title:h(r)("Close"),onClick:a},[Oe(nf,{class:"app-dialog-close-icon"})],8,t_)]),w("div",n_,[_o(i.$slots,"default",{},void 0)]),i.$slots.footer?(_(),F("div",o_,[_o(i.$slots,"footer",{},void 0)])):ye("",!0)],42,JA)])):ye("",!0)]))}}),xd=It(r_,[["__scopeId","data-v-0c988f32"]]),a_={key:0,class:"sidebar-menu-row-left"},s_={class:"sidebar-menu-row-main"},i_={key:1,class:"sidebar-menu-row-right"},l_={key:0,class:"sidebar-menu-row-right-default"},u_={key:1,class:"sidebar-menu-row-right-hover"},c_=hn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=IS(),o=K(()=>!!n.left),r=K(()=>!!n.right),a=K(()=>!!n["right-hover"]),s=K(()=>r.value||a.value);return(i,l)=>(_(),Qe(Af(t.as),Mf({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:dt(()=>[o.value?(_(),F("span",a_,[_o(i.$slots,"left",{},void 0,!0)])):ye("",!0),w("span",s_,[_o(i.$slots,"default",{},void 0,!0)]),s.value?(_(),F("span",i_,[r.value?(_(),F("span",l_,[_o(i.$slots,"right",{},void 0,!0)])):ye("",!0),a.value?(_(),F("span",u_,[_o(i.$slots,"right-hover",{},void 0,!0)])):ye("",!0)])):ye("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),hs=It(c_,[["__scopeId","data-v-5fc666fb"]]),d_={},f_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function p_(e,t){return _(),F("svg",f_,[...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 Ju=It(d_,[["render",p_]]),h_={},m_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function v_(e,t){return _(),F("svg",m_,[...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 oy=It(h_,[["render",v_]]),g_=["data-menu-open"],y_={class:"thread-left-stack"},w_=["data-state"],b_=["data-confirming","title"],T_={key:0,class:"thread-delete-confirm-label"},S_={class:"thread-row-title-wrap"},C_={class:"thread-row-title-line"},x_={class:"thread-row-title"},k_=["title"],I_={key:0,class:"thread-row-automation-count"},A_=["data-state"],__={class:"thread-row-time"},P_=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,o=t;function r(a){n.setMenuWrapRef(a instanceof HTMLDivElement?a:null)}return(a,s)=>(_(),F("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Oe(hs,{class:"thread-row","data-active":n.selected,"data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:s[3]||(s[3]=i=>o("select")),onMouseleave:s[4]||(s[4]=i=>o("row-leave",i)),onContextmenu:s[5]||(s[5]=i=>o("row-contextmenu",i))},{left:dt(()=>[w("span",y_,[n.showStatusIndicator?(_(),F("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,w_)):ye("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:s[0]||(s[0]=gt(i=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(_(),F("span",T_,D(n.confirmLabel),1)):(_(),Qe(oy,{key:1,class:"thread-icon"}))],8,b_)])]),right:dt(()=>[w("span",__,D(n.relativeTime),1)]),"right-hover":dt(()=>[w("div",{ref:r,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:s[2]||(s[2]=gt(i=>o("menu-toggle"),["stop"]))},[Oe(tf,{class:"thread-icon"})])])]),default:dt(()=>[w("button",{class:"thread-main-button",type:"button",onClick:s[1]||(s[1]=gt(i=>o("select"),["stop"]))},[w("span",S_,[w("span",C_,[w("span",x_,D(n.thread.title),1),n.thread.hasWorktree?(_(),Qe(Ju,{key:0,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ye("",!0),n.automationCount>0?(_(),F("span",{key:1,class:"thread-row-automation-chip",title:n.automationTooltip},[Oe(bs,{class:"thread-row-automation-icon"}),n.automationCount>1?(_(),F("span",I_,D(n.automationCount),1)):ye("",!0)],8,k_)):ye("",!0),n.thread.pendingRequestState?(_(),F("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},D(n.requestLabel),9,A_)):ye("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,g_))}}),Cu=It(P_,[["__scopeId","data-v-fac0242e"]]);function R_(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}function E_(e){const{getGroups:t,t:n}=e,o=T({}),r=T({}),a=T(!1),s=T("thread"),i=T(""),l=T(""),d=T(""),c=T("create"),v=T(!1),f=T("thread"),g=T(""),S=T(""),P=T(""),B=T(""),L=T(!1),j=T(!1),U=T({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),H=T({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),he=K(()=>{if(s.value==="project"){const ae=l.value;return ae?r.value[ae]??[]:[]}const q=i.value;return q?o.value[q]??[]:[]}),de=K(()=>fe(U.value.rrule)),W=K(()=>v.value&&c.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.")),ve=K(()=>{var ae;const q=[];for(const _e of t())for(const Ye of _e.threads){const bt=((ae=Ye.title)==null?void 0:ae.trim())||Ye.id,Tt=e.getProjectDisplayName(_e.projectName);q.push({value:Ye.id,label:`${bt} · ${Tt}`,searchText:`${bt} ${Tt} ${Ye.id}`.toLowerCase()})}return q}),Se=K(()=>{const q=[];for(const ae of t()){const _e=e.getProjectAutomationKey(ae.projectName);if(!_e)continue;const Ye=e.getProjectDisplayName(ae.projectName);q.push({value:_e,label:Ye,searchText:`${Ye} ${_e}`.toLowerCase()})}return q}),Ae=K(()=>(f.value==="project"?Se.value:ve.value).map(ae=>({value:ae.value,label:ae.label}))),pe=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],Q=K(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);nt(Ae,q=>{var ae;v.value&&(q.some(_e=>_e.value===g.value)||(g.value=((ae=q[0])==null?void 0:ae.value)??""))});function me(q){var ae;return((ae=o.value[q])==null?void 0:ae.length)??0}function ne(q){return me(q)>0}function ke(q){var _e;const ae=e.getProjectAutomationKey(q);return ae?((_e=r.value[ae])==null?void 0:_e.length)??0:0}function $e(q){return ke(q)>0}function te(q){if(q.length===0)return"";if(q.length>1){const Ye=q.filter(bt=>bt.status==="ACTIVE").length;return`${q.length} ${n("automations")} • ${Ye} ${n("active")}`}const[ae]=q,_e=ae.status==="PAUSED"?"-":ae.nextRunAtMs?new Date(ae.nextRunAtMs).toLocaleString():n("Not scheduled");return`${ae.name} • ${n("Next run")}: ${_e}`}function ce(q){return te(o.value[q]??[])}function Le(q){const ae=e.getProjectAutomationKey(q);return te(ae?r.value[ae]??[]:[])}function Pe(q){return String(Math.max(0,q)).padStart(2,"0")}function Fe(q,ae){const _e=typeof q=="number"?q:Number(q);return Number.isFinite(_e)?Math.max(1,Math.floor(_e)):ae}function Ke(q){const[ae,_e]=q.split(":"),Ye=Math.min(23,Math.max(0,Number(ae)||0)),bt=Math.min(59,Math.max(0,Number(_e)||0));return`FREQ=DAILY;BYHOUR=${Ye};BYMINUTE=${bt}`}function lt(q,ae){const _e=Fe(q,1);return ae==="minutes"?`FREQ=MINUTELY;INTERVAL=${_e}`:ae==="hours"?`FREQ=HOURLY;INTERVAL=${_e}`:`FREQ=DAILY;INTERVAL=${_e}`}function Ze(q){return Object.fromEntries(q.split(";").map(ae=>ae.trim()).filter(Boolean).map(ae=>{const[_e,...Ye]=ae.split("=");return[_e.toUpperCase(),Ye.join("=").trim()]}).filter(([ae,_e])=>ae&&_e))}function ut(q){var bt;const ae=Ze(q),_e=(bt=ae.FREQ)==null?void 0:bt.toUpperCase(),Ye=Fe(ae.INTERVAL,1);if(_e==="DAILY"&&ae.BYHOUR!==void 0&&ae.BYMINUTE!==void 0&&Ye===1){const Tt=Math.min(23,Math.max(0,Number(ae.BYHOUR)||0)),At=Math.min(59,Math.max(0,Number(ae.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Pe(Tt)}:${Pe(At)}`,interval:1,intervalUnit:"hours"}}return _e==="MINUTELY"||_e==="HOURLY"||_e==="DAILY"&&ae.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Ye,intervalUnit:_e==="MINUTELY"?"minutes":_e==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function fe(q){var bt;const ae=Ze(q),_e=(bt=ae.FREQ)==null?void 0:bt.toUpperCase(),Ye=Fe(ae.INTERVAL,1);if(_e==="DAILY"&&ae.BYHOUR!==void 0&&ae.BYMINUTE!==void 0&&Ye===1){const Tt=Math.min(23,Math.max(0,Number(ae.BYHOUR)||0)),At=Math.min(59,Math.max(0,Number(ae.BYMINUTE)||0));return`${n("RRULE")}: ${q} · ${n("runs daily at")} ${Pe(Tt)}:${Pe(At)}`}return _e==="MINUTELY"?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("minute(s)")}`:_e==="HOURLY"?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("hour(s)")}`:_e==="DAILY"&&ae.INTERVAL!==void 0?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("day(s)")}`:q?`${n("RRULE")}: ${q}`:n("RRULE is required.")}function N(){const q=H.value;q.mode==="daily"?U.value.rrule=Ke(q.dailyTime):q.mode==="interval"&&(U.value.rrule=lt(q.interval,q.intervalUnit))}function oe(q){q!=="minutes"&&q!=="hours"&&q!=="days"||(H.value={...H.value,intervalUnit:q},N())}function le(q){q!=="ACTIVE"&&q!=="PAUSED"||(U.value={...U.value,status:q})}function Ee(){H.value=ut(U.value.rrule)}function Be(q){H.value={...H.value,mode:q},N()}function A(q){var _e;s.value="thread",i.value=q,l.value="",v.value=!1,S.value="",P.value="";const ae=(_e=o.value[q])==null?void 0:_e[0];ae?je(ae.id):re(),a.value=!0,e.closeThreadMenu()}function M(q){var Ye;const ae=e.getProjectAutomationKey(q);if(!ae){s.value="project",i.value="",l.value="",v.value=!1,S.value=n("Project automation requires a resolved absolute project path."),P.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=ae,v.value=!1,S.value="",P.value="";const _e=(Ye=r.value[ae])==null?void 0:Ye[0];_e?je(_e.id):re(),a.value=!0,e.closeProjectMenu()}function z(q){s.value=q.scope,i.value=q.scope==="thread"?q.target:"",l.value=q.scope==="project"?q.target:"",v.value=!1,S.value="",P.value="",q.scope==="project"?r.value=He(r.value,q.target,q.automation):o.value=ge(o.value,q.target,q.automation),je(q.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function Z(){var q;v.value=!0,f.value="thread",g.value=((q=ve.value[0])==null?void 0:q.value)??"",s.value="thread",i.value="",l.value="",S.value="",P.value="",re(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ue(q){var ae;f.value=q,g.value="",s.value=q==="project"?"project":"thread",g.value=((ae=Ae.value[0])==null?void 0:ae.value)??""}function re(){d.value="",c.value="create",S.value="",P.value="",U.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},H.value=ut(U.value.rrule)}function je(q){const ae=he.value.find(_e=>_e.id===q);ae&&(d.value=ae.id,c.value="edit",S.value="",P.value="",U.value={name:ae.name,prompt:ae.prompt,rrule:ae.rrule,status:ae.status},H.value=ut(ae.rrule))}function Re(){a.value=!1,s.value="thread",i.value="",l.value="",d.value="",S.value="",P.value="",L.value=!1,j.value=!1}function xe(q,ae){return Object.fromEntries(Object.entries(q).filter(([_e])=>_e!==ae))}function ge(q,ae,_e){const Ye=q[ae]??[],bt=Ye.findIndex(At=>At.id===_e.id),Tt=[...Ye];return bt>=0?Tt.splice(bt,1,_e):Tt.push(_e),{...q,[ae]:Tt}}function Ve(q,ae,_e){const Ye=(q[ae]??[]).filter(bt=>bt.id!==_e);return Ye.length>0?{...q,[ae]:Ye}:xe(q,ae)}function Ne(q,ae){return Object.fromEntries(Object.entries(q).filter(([_e])=>_e!==ae))}function He(q,ae,_e){const Ye=q[ae]??[],bt=Ye.findIndex(At=>At.id===_e.id),Tt=[...Ye];return bt>=0?Tt.splice(bt,1,_e):Tt.push(_e),{...q,[ae]:Tt}}async function Ue(){r.value=await yx()}async function Je(q){await Vh(q).catch(()=>{}),o.value=xe(o.value,q)}async function et(){let q=i.value,ae=l.value;L.value=!0,S.value="",P.value="";try{if(N(),v.value&&c.value==="create"&&(f.value==="thread"?(q=g.value,ae="",s.value="thread",i.value=q,l.value=""):(ae=g.value,q="",s.value="project",i.value="",l.value=ae)),s.value==="thread"&&!q)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!ae)throw new Error(n("Select a project target for this automation"));const _e={id:d.value||void 0,name:U.value.name,prompt:U.value.prompt,rrule:U.value.rrule,status:U.value.status},Ye=s.value==="project"?await bx({..._e,projectName:ae}):await wx({..._e,threadId:q});s.value==="project"?await Ue():o.value=ge(o.value,q,Ye),e.onAutomationsChanged(),je(Ye.id),P.value=n("Automation saved."),L.value=!1}catch(_e){S.value=_e instanceof Error?_e.message:n("Failed to save automation"),L.value=!1}}async function st(){const q=i.value,ae=l.value,_e=d.value;if(_e&&!(s.value==="thread"&&!q)&&!(s.value==="project"&&!ae)){L.value=!0,S.value="",P.value="";try{s.value==="project"?(await Eg(ae,_e),await Ue()):(await Vh(q,_e),o.value=Ve(o.value,q,_e));const Ye=he.value[0];Ye?je(Ye.id):re(),e.onAutomationsChanged(),L.value=!1}catch(Ye){S.value=Ye instanceof Error?Ye.message:n("Failed to remove automation"),L.value=!1}}}async function mt(){const q=i.value,ae=d.value;if(!(!q||!ae)){j.value=!0,S.value="",P.value="";try{await Tx(q,ae),P.value=n("Automation run queued.")}catch(_e){S.value=_e instanceof Error?_e.message:n("Failed to run automation")}finally{j.value=!1}}}return{automationByThreadId:o,automationByProjectName:r,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:d,automationDialogMode:c,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:g,automationDialogError:S,automationDialogNotice:P,projectAutomationActionError:B,isSavingAutomation:L,isRunningAutomation:j,automationDraft:U,automationScheduleDraft:H,automationDialogAutomations:he,automationSchedulePreview:de,automationDialogSubtitle:W,automationThreadTargetOptions:ve,automationProjectTargetOptions:Se,automationTargetDropdownOptions:Ae,automationIntervalUnitOptions:pe,automationStatusOptions:Q,threadAutomationCount:me,threadHasAutomation:ne,projectAutomationCount:ke,projectHasAutomation:$e,threadAutomationTooltip:ce,projectAutomationTooltip:Le,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:oe,onAutomationStatusChange:le,syncAutomationScheduleDraftFromRrule:Ee,setAutomationScheduleMode:Be,openAutomationDialog:A,openProjectAutomationDialog:M,openAutomationEditorFromPanel:z,openAutomationCreatorFromPanel:Z,setAutomationTargetMode:ue,startNewAutomationDraft:re,selectAutomationForEditing:je,closeAutomationDialog:Re,omitAutomationProject:Ne,reloadProjectAutomations:Ue,removeAutomationsForThread:Je,submitAutomationDialog:et,onDeleteAutomationFromDialog:st,onRunAutomationFromDialog:mt}}const M_=4,Sm=6;function j_(e,t,n){if(e===null||n===0)return null;const o=Math.max(0,Math.min(e,n)),r=o>t?o-1:o,a=Math.max(0,Math.min(r,n-1));return a===t?null:a}function L_(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:o,isCollapsed:r,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=T(null),d=T(null),c=T(null);let v=null,f=null;const g=T(""),S=T({}),P=new Map,B=new WeakMap,L=typeof window<"u"?new ResizeObserver(fe=>{for(const N of fe){const oe=N.target,le=B.get(oe);le&&U(le,oe)}}):null,j=()=>{var fe,N;return((fe=c.value)==null?void 0:fe.projectName)??((N=d.value)==null?void 0:N.projectName)??""};function U(fe,N){const oe=N.getBoundingClientRect().height;if(!Number.isFinite(oe)||oe<=0)return;const le=S.value[fe];le!==void 0&&Math.abs(le-oe)<.5||(S.value={...S.value,[fe]:oe})}function H(fe,N){const oe=P.get(fe);oe&&oe!==N&&L&&L.unobserve(oe);const le=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(le){P.set(fe,le),B.set(le,fe),U(fe,le),L==null||L.observe(le);return}oe&&(L==null||L.unobserve(oe)),P.delete(fe)}function he(fe){const N=S.value[fe]??0,oe=c.value,Ee=((oe==null?void 0:oe.projectName)===fe?oe.groupHeight:null)??N,Be=r(fe)?0:Sm;return Math.max(0,Ee+Be)}const de=K(()=>{const fe=c.value;return fe?j_(fe.dropTargetIndexFull,fe.fromIndex,t().length):null}),W=K(()=>{const N=(o()?n():t()).map(A=>A.projectName),oe=c.value,le=de.value;if(!oe||le===null)return N;const Ee=[...N],[Be]=Ee.splice(oe.fromIndex,1);return Be?(Ee.splice(le,0,Be),Ee):N}),ve=K(()=>{const fe={};let N=0;for(const oe of W.value)fe[oe]=N,N+=he(oe);return fe}),Se=K(()=>{let fe=0;for(const N of W.value)fe+=he(N);return{height:`${Math.max(0,fe)}px`}});function Ae(fe,N){if(fe.button!==0||o()||d.value||c.value)return;const le=t().findIndex(M=>M.projectName===N),Ee=P.get(N);if(le<0||!Ee)return;const Be=Ee.getBoundingClientRect(),A=r(N)?0:Sm;d.value={projectName:N,fromIndex:le,startClientX:fe.clientX,startClientY:fe.clientY,pointerOffsetY:fe.clientY-Be.top,groupLeft:Be.left,groupWidth:Be.width,groupHeight:Be.height,groupOuterHeight:Be.height+A},fe.preventDefault(),pe()}function pe(){window.addEventListener("mousemove",me),window.addEventListener("mouseup",ne),window.addEventListener("keydown",ke)}function Q(){window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",ne),window.removeEventListener("keydown",ke)}function me(fe){v={clientX:fe.clientX,clientY:fe.clientY},te()}function ne(fe){ce({clientX:fe.clientX,clientY:fe.clientY});const N=c.value;if(N&&de.value!==null){const oe=t().findIndex(le=>le.projectName===N.projectName);if(oe>=0){const le=de.value;le!==oe&&s(N.projectName,le)}}$e({preserveToggleSuppression:!!N})}function ke(fe){fe.key==="Escape"&&(!d.value&&!c.value||(fe.preventDefault(),$e()))}function $e(fe={}){f!==null&&(window.cancelAnimationFrame(f),f=null),v=null,d.value=null,c.value=null,fe.preserveToggleSuppression||(g.value=""),Q()}function te(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!v)return;const fe=v;v=null,ce(fe)}))}function ce(fe){const N=d.value;if(!c.value&&N){const oe=fe.clientX-N.startClientX,le=fe.clientY-N.startClientY;if(Math.hypot(oe,le)<M_)return;i(),g.value=N.projectName,c.value={projectName:N.projectName,fromIndex:N.fromIndex,pointerOffsetY:N.pointerOffsetY,groupLeft:N.groupLeft,groupWidth:N.groupWidth,groupHeight:N.groupHeight,groupOuterHeight:N.groupOuterHeight,ghostTop:fe.clientY-N.pointerOffsetY,dropTargetIndexFull:null}}c.value&&Le(fe)}function Le(fe){const N=c.value;if(!N)return;if(N.ghostTop=fe.clientY-N.pointerOffsetY,!Pe(fe)){N.dropTargetIndexFull=null;return}const oe=fe.clientY,le=l.value;if(!le){N.dropTargetIndexFull=null;return}const Ee=t(),Be=le.getBoundingClientRect(),A=new Map(Ee.map((ue,re)=>[ue.projectName,re])),M=Ee.map(ue=>ue.projectName).filter(ue=>ue!==N.projectName);let z=0,Z=Ee.length;for(const ue of M){const re=A.get(ue);if(re===void 0)continue;const je=he(ue),Re=Be.top+z+je/2;if(oe<Re){Z=re;break}z+=je}N.dropTargetIndexFull=Z}function Pe(fe){const N=l.value;if(!N)return!1;const oe=N.getBoundingClientRect(),le=fe.clientX>=oe.left&&fe.clientX<=oe.right,Ee=fe.clientY>=oe.top-32&&fe.clientY<=oe.bottom+32;return le&&Ee}function Fe(fe){var N;return((N=c.value)==null?void 0:N.projectName)===fe}function Ke(fe){const N=c.value,oe=ve.value[fe]??0,le=a()===fe;return!N||N.projectName!==fe?{position:"absolute",top:"0",left:"0",right:"0",zIndex:le?"40":"1",transform:`translate3d(0, ${oe}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${N.groupLeft}px`,width:`${N.groupWidth}px`,height:`${N.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${N.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function lt(fe){return g.value===fe?(g.value="",!0):!1}function Ze(fe){const N=j();N&&!fe.includes(N)&&$e();const oe=new Set(fe),le=Object.fromEntries(Object.entries(S.value).filter(([Ee])=>oe.has(Ee)));Object.keys(le).length!==Object.keys(S.value).length&&(S.value=le)}function ut(){for(const fe of P.values())L==null||L.unobserve(fe);P.clear(),$e()}return{groupsContainerRef:l,groupsContainerStyle:Se,setProjectGroupRef:H,isDraggingProject:Fe,projectGroupStyle:Ke,onProjectHandleMouseDown:Ae,takeToggleSuppression:lt,pruneProjectGroups:Ze,dispose:ut}}const N_={key:0,class:"pinned-section"},$_={class:"thread-tree-header"},O_={key:0,class:"thread-list"},D_={class:"projects-section"},F_={class:"thread-tree-header"},B_=["aria-expanded","aria-label","title"],U_={class:"organize-menu-title"},z_=["data-active"],H_={key:0},q_=["data-active"],W_={key:0},G_=["data-active"],V_={key:0},K_={class:"organize-menu-title"},Y_=["data-active"],J_={key:0},Q_=["data-active"],X_={key:0},Z_={key:0,class:"thread-tree-action-error"},eP={key:1,class:"thread-tree-no-results"},tP={key:2,class:"thread-tree-loading"},nP={key:3,class:"thread-list thread-list-global"},oP=["data-project-name","data-expanded","data-dragging"],rP={class:"project-icon-stack"},aP={class:"project-icon-folder"},sP={class:"project-icon-chevron"},iP=["data-dragging-handle","onMousedown"],lP=["title"],uP=["title"],cP={key:0,class:"thread-row-automation-count"},dP={class:"project-hover-controls"},fP=["onClick"],pP=["data-open-direction"],hP=["onClick"],mP=["onClick"],vP=["onClick"],gP=["onClick"],yP=["onClick"],wP=["onClick"],bP={class:"project-menu-label"},TP=["onInput"],SP=["aria-label","title","onClick"],CP={key:0,class:"thread-list"},xP={class:"project-empty"},kP=["onClick"],IP={class:"chats-section"},AP={class:"thread-tree-header"},_P={class:"chats-section-actions"},PP=["aria-label","title"],RP={key:0,class:"thread-tree-no-results"},EP={key:1,class:"thread-list thread-list-global"},MP=["data-open-direction"],jP=["disabled","title"],LP=["placeholder","onKeydown"],NP={class:"recycle-bin-content"},$P={key:0,class:"recycle-bin-empty"},OP={key:1,class:"recycle-bin-list"},DP={class:"recycle-bin-item-copy"},FP={class:"recycle-bin-item-title"},BP={key:0,class:"recycle-bin-item-meta"},UP={class:"recycle-bin-item-time"},zP={class:"recycle-bin-item-actions"},HP=["disabled","onClick"],qP=["onClick"],WP={key:2,class:"recycle-bin-error",role:"alert"},GP=["aria-label"],VP={class:"rename-thread-title"},KP={class:"rename-thread-subtitle"},YP={key:0,class:"automation-target-picker"},JP={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},QP={class:"automation-target-dropdown"},XP=["aria-label"],ZP=["onClick"],eR={class:"automation-thread-field"},tR={class:"automation-thread-label"},nR=["placeholder"],oR={class:"automation-thread-field"},rR={class:"automation-thread-label"},aR=["placeholder"],sR={class:"automation-thread-field"},iR={class:"automation-thread-label"},lR={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},uR={key:0,class:"automation-schedule-row"},cR={class:"automation-schedule-copy"},dR={key:1,class:"automation-schedule-row"},fR={class:"automation-schedule-copy"},pR={class:"automation-schedule-preview"},hR={class:"automation-thread-field"},mR={class:"automation-thread-label"},vR={key:2,class:"rename-thread-subtitle automation-thread-error"},gR={key:3,class:"rename-thread-subtitle automation-thread-notice"},yR={class:"rename-thread-actions"},wR=["disabled"],bR=["disabled"],TR=["disabled"],SR=["disabled"],Cm="codex-web-local.sidebar-section-expansion.v1",xm="codex-web-local.sidebar-chats-first.v1",km="codex-web-local.sidebar-chat-sort-mode.v1",Im="codex-web-local.thread-view-mode.v1",Am="codex-web-local.collapsed-projects.v1",CR=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 o=e,{t:r}=da(),{recordVisibleFailure:a}=ey(),s=n,{records:i,loadRecords:l,recordArchivedThread:d,removeArchivedRecord:c,restoreArchivedThread:v}=DA(),f=T(!1),g=T(""),S=T("");function P(){xt.value=!1,g.value="",l(),f.value=!0}async function B(x){if(!S.value){S.value=x,g.value="";try{const R=await v(x);R.ok?s("restore-thread",x):g.value=R.error??"Failed to restore thread"}finally{S.value=""}}}const L=T({}),j=T({}),U=T(!0),H=T(!0),he=T(!0),de=T(!1),W=T(Mo(xm,!1)),ve=T(en());let Se=!1;const Ae=T([]),pe=T({}),Q=T(""),me=T([]),ne=T(""),ke=T(""),$e=T("hover"),te=T({}),ce=T({}),Le=T({}),Pe=T("actions"),Fe=T(""),Ke=T(!1),lt=T(""),Ze=T(""),ut=T(null),fe=T(!1),N=T(""),oe=T(""),le=E_({getGroups:()=>o.groups,t:r,getProjectDisplayName:mr,getProjectAutomationKey:qn,closeThreadMenu:we,closeProjectMenu:$t,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:Ee,automationByProjectName:Be,automationDialogVisible:A,automationDialogScope:M,automationDialogAutomationId:z,automationDialogMode:Z,automationTargetPickerVisible:ue,automationTargetMode:re,automationTargetValue:je,automationDialogError:Re,automationDialogNotice:xe,projectAutomationActionError:ge,isSavingAutomation:Ve,isRunningAutomation:Ne,automationDraft:He,automationScheduleDraft:Ue,automationDialogAutomations:Je,automationSchedulePreview:et,automationDialogSubtitle:st,automationTargetDropdownOptions:mt,automationIntervalUnitOptions:q,automationStatusOptions:ae,threadAutomationCount:_e,threadHasAutomation:Ye,projectAutomationCount:bt,projectHasAutomation:Tt,threadAutomationTooltip:At,projectAutomationTooltip:Br,syncAutomationRruleFromScheduleDraft:zt,onAutomationIntervalUnitChange:Ha,onAutomationStatusChange:fa,syncAutomationScheduleDraftFromRrule:pa,setAutomationScheduleMode:ar,openAutomationDialog:Ur,openProjectAutomationDialog:zr,openAutomationEditorFromPanel:Ps,openAutomationCreatorFromPanel:qa,setAutomationTargetMode:Wa,startNewAutomationDraft:Uo,selectAutomationForEditing:sr,closeAutomationDialog:Zn,omitAutomationProject:Rs,reloadProjectAutomations:ha,removeAutomationsForThread:Es,submitAutomationDialog:zo,onDeleteAutomationFromDialog:Po,onRunAutomationFromDialog:Dn}=le,Ga=L_({getGroups:()=>o.groups,getFilteredGroups:()=>Lt.value,isSearchActive:()=>bn.value,isCollapsed:un,getElevatedProjectName:()=>ne.value?ne.value:ke.value?Gr.value.get(ke.value)??"":"",onReorderProject:(x,R)=>s("reorder-project",{projectName:x,toIndex:R}),closeProjectMenu:$t}),{groupsContainerRef:Ms,groupsContainerStyle:vt,setProjectGroupRef:Ct,isDraggingProject:kt,projectGroupStyle:mn,onProjectHandleMouseDown:Fn,takeToggleSuppression:ho,pruneProjectGroups:Hr,dispose:qr}=Ga,mo=new Map,Ho=new Map,Ro=T(null),Bn=T(null),xt=T(!1),eo=T(Eo());function vo(){if(typeof window>"u")return{};try{const x=window.localStorage.getItem(Am);if(!x)return{};const R=JSON.parse(x);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function Eo(){return typeof window>"u"?"project":window.localStorage.getItem(Im)==="chronological"?"chronological":"project"}function Mo(x,R){if(typeof window>"u")return R;const k=window.localStorage.getItem(x);return k==="true"?!0:k==="false"?!1:R}function en(){return typeof window>"u"?"updated":window.localStorage.getItem(km)==="created"?"created":"updated"}j.value=vo();function Un(){if(!(typeof window>"u"))try{const x=JSON.parse(window.localStorage.getItem(Cm)||"{}");typeof x.pinned=="boolean"&&(U.value=x.pinned),typeof x.projects=="boolean"&&(H.value=x.projects),typeof x.chats=="boolean"&&(he.value=x.chats)}catch{}}function ir(){typeof window>"u"||window.localStorage.setItem(Cm,JSON.stringify({pinned:U.value,projects:H.value,chats:he.value}))}Un(),nt(j,x=>{typeof window>"u"||window.localStorage.setItem(Am,JSON.stringify(x))},{deep:!0}),nt(eo,x=>{typeof window>"u"||window.localStorage.setItem(Im,x)}),nt(W,x=>{typeof window>"u"||window.localStorage.setItem(xm,String(x))}),nt(ve,x=>{typeof window>"u"||window.localStorage.setItem(km,x)}),nt([U,H,he],ir);const lr=K(()=>o.searchQuery.trim().toLowerCase()),bn=K(()=>lr.value.length>0),ma=K(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),tn=K(()=>new Set(Ae.value)),Wr=K(()=>new Set(me.value));function go(x){if(Wr.value.has(x.id))return!1;if(!bn.value)return!0;if(ma.value)return ma.value.has(x.id);const R=lr.value;return x.title.toLowerCase().includes(R)||x.preview.toLowerCase().includes(R)}const Lt=K(()=>o.groups.flatMap(x=>{const R=x.threads.filter(k=>!Ku(k.cwd)&&go(k));return R.length>0?[{...x,threads:R}]:!bn.value&&x.threads.length===0?[{...x,threads:R}]:[]})),zn=K(()=>eo.value==="chronological"),sn=K(()=>{const x=[];for(const R of o.groups)for(const k of R.threads)tn.value.has(k.id)||go(k)&&x.push(k);return x.sort((R,k)=>{const G=new Date(R.updatedAtIso||R.createdAtIso).getTime();return new Date(k.updatedAtIso||k.createdAtIso).getTime()-G})}),to=K(()=>{const x=sn.value.filter(k=>Ku(k.cwd)),R=ve.value==="created"?"createdAtIso":"updatedAtIso";return x.sort((k,G)=>{const We=new Date(k[R]||k.updatedAtIso||k.createdAtIso).getTime();return new Date(G[R]||G.updatedAtIso||G.createdAtIso).getTime()-We})}),nn=K(()=>bn.value||de.value?to.value:to.value.slice(0,10)),Va=K(()=>bn.value?!1:to.value.length>10),on=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads)Wr.value.has(k.id)||x.set(k.id,k);return x});nt(Ae,x=>{Se&&aI(x)}),nt([on,()=>o.isThreadListFullyLoaded],([x])=>{const R=R_(Ae.value,new Set(x.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(R.length===Ae.value.length)return;const k=new Set(R),G=Object.fromEntries(Object.entries(pe.value).filter(([We])=>k.has(We)));pe.value=G,Ae.value=R});let qo=0;async function ur(){if(o.isLoading)return;const x=Ae.value.filter(We=>!on.value.has(We)&&!pe.value[We]);if(x.length===0)return;const R=qo+=1,k=await Promise.all(x.map(async We=>{try{return await wk(We)}catch{return null}}));if(R!==qo)return;const G={...pe.value};for(const We of k)We&&(G[We.id]=We);pe.value=G}nt([Ae,on,()=>o.isLoading],()=>{Se&&ur()}),pi(async()=>{const{threadIds:x}=await rI(),R=Array.isArray(x)?x.filter(k=>typeof k=="string").map(k=>k.trim()).filter((k,G,We)=>k.length>0&&We.indexOf(k)===G):[];R.length>0&&(Ae.value=R);try{Ee.value=await gx()}catch{Ee.value={}}try{await ha()}catch{Be.value={}}Se=!0,ur()});const Ht=K(()=>Ye(N.value)),js=K(()=>{const x=oe.value;return Ht.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:x}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:x})}),Gr=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads)x.set(k.id,R.projectName);return x}),Wo=K(()=>{const x=new Map;for(const R of o.groups){const k=R.threads.filter(G=>!tn.value.has(G.id)&&!Wr.value.has(G.id));x.set(R.projectName,k)}return x}),yo=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads){const G=new Date(k.updatedAtIso||k.createdAtIso).getTime();x.set(k.id,G)}return x}),qt=K(()=>{const x=ke.value;return x?on.value.get(x)??null:null}),Ka=K(()=>Ae.value.map(x=>on.value.get(x)??pe.value[x]??null).filter(x=>x!==null).filter(go));function no(){U.value=!U.value}function Ya(){H.value=!H.value}function wo(){he.value=!he.value}function Vr(x){if(Number.isNaN(x))return"n/a";const R=Math.abs(Date.now()-x);if(R<6e4)return r("now");const k=Math.floor(R/6e4);if(k<60)return`${k}m`;const G=Math.floor(k/60);return G<24?`${G}h`:`${Math.floor(G/24)}d`}function bo(x){const R=yo.value.get(x.id);return Vr(typeof R=="number"?R:new Date(x.updatedAtIso||x.createdAtIso).getTime())}function jo(x){const R=new Date(x).getTime();return Number.isNaN(R)?"":new Date(R).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function oo(x){return tn.value.has(x)}function cr(x){if(oo(x)){Ae.value=Ae.value.filter(R=>R!==x);return}Ae.value=[x,...Ae.value]}function St(x){cr(x),we()}function ln(x){Q.value="",s("select",x)}function In(x){x===o.selectedThreadId&&(s("copy-thread-chat",x),we())}function dr(x){s("fork-thread",x),we()}function An(x){return`${r("start new thread")} ${mr(x)}`}function Kr(x){s("start-new-thread",x)}function fr(x){s("browse-thread-files",x),we()}function dn(x){s("save-thread-project",x),we()}async function C(x){var k,G;const R=((G=(k=on.value.get(x))==null?void 0:k.cwd)==null?void 0:G.trim())??"";if(we(),!(!R||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(R)}catch{}}function E(x,R){if(ke.value===x&&$e.value==="hover"){if(R){const k=R.relatedTarget,G=Bn.value;if(k instanceof Node&&G&&G.contains(k))return}we()}}function J(x){return ke.value===x}function we(){ke.value="",$e.value="hover",Le.value={}}function ct(x){if(Q.value="",ke.value===x){we();return}$e.value="hover",$t(),xt.value=!1,ke.value=x,Nt(()=>{Xa(x)})}function _t(x,R){x.preventDefault(),Q.value="",$e.value="contextmenu",ke.value=R}function _n(x,R){lt.value=x,Ze.value=R,Ke.value=!0,we(),Nt(()=>{var k,G;(k=ut.value)==null||k.focus(),(G=ut.value)==null||G.select()})}function Kt(){Ke.value=!1,lt.value="",Ze.value=""}function Pn(){const x=lt.value,R=Ze.value.trim();!x||!R||(s("rename-thread",{threadId:x,title:R}),Kt())}function Wt(x,R){Q.value="",N.value=x,oe.value=R,fe.value=!0,we()}function vn(){fe.value=!1,N.value="",oe.value=""}async function mi(){const x=N.value;x&&(Ls(x),vn())}function pr(x){return Q.value===x}function hr(x){if(Q.value!==x){Q.value=x,we();return}Ls(x),Q.value=""}function Ls(x){var k,G;const R=on.value.get(x)??null;Wr.value.has(x)||(me.value=[x,...me.value]),Q.value="",we(),d({id:x,title:((k=R==null?void 0:R.title)==null?void 0:k.trim())||"(untitled)",cwd:((G=R==null?void 0:R.cwd)==null?void 0:G.trim())??"",projectName:Gr.value.get(x)??""}),Ae.value=Ae.value.filter(We=>We!==x),s("archive",x),Ye(x)&&Es(x)}function mr(x){return o.projectDisplayNameById[x]??x}t({openAutomationEditorFromPanel:Ps,openAutomationCreatorFromPanel:qa,openRenameThreadDialog:_n,openRecycleBin:P});function Yr(x){return x.includes("/")||x.includes("\\")}function Tn(x){return Yr(x)?x:mr(x)}function vr(x){const R=Bo(x);if(!R)return!1;let k=0;for(const G of o.groups)if(Yr(G.projectName)&&Bo(G.projectName)===R&&(k+=1,k>1))return!0;return!1}function Lo(x){const R=o.projectDisplayNameById[x.projectName],k=mr(x.projectName),G=x.projectName;if(R&&!Yr(G)&&G!==k)return k.includes(G)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(G)?k:`${k} ${G}`;if(R&&Yr(G)){const ao=Bo(G),Co=Bo(Hi(G)),cn=vr(G)?Co:ao;return cn&&cn!==k?`${k} ${cn}`:k}if(!k.includes("/")&&!k.includes("\\"))return k;const We=Bo(k)||k,Ot=Bo(Hi(k));return Ot.startsWith(".")&&Ot!==We?`${We} ${Ot}`:x.threads.length>0||!vr(G)?We:Ot?`${We} ${Ot}`:We}function va(x){return ne.value===x}function $t(){ne.value="",Pe.value="actions",Fe.value=""}function ga(){const x=!xt.value;x&&($t(),we()),xt.value=x}function rn(x){eo.value=x,xt.value=!1}function gr(){W.value=!W.value}function ya(x){ve.value=x}function Sn(x){s("request-project-git-status",x),Nt(()=>{Rn(x)})}function Ns(x){if(ne.value===x){$t();return}we(),xt.value=!1,ne.value=x,Pe.value="actions",Fe.value=mr(x),Sn(x)}function Ja(x){we(),xt.value=!1,ne.value=x,Pe.value="actions",Fe.value=mr(x),Sn(x)}function ol(x){return o.projectDisplayNameById[x.projectName]??Lo(x)}function Hn(x){we();const R=x.projectName;ne.value=R,Pe.value="rename",Fe.value=ol(x),Nt(()=>{Rn(R)})}function Yt(x){s("browse-project-files",x),$t()}function Gt(x){s("save-project",x),$t()}function vi(x){s("create-project-worktree",x),$t()}function rl(x){s("rename-project",{projectName:x,displayName:Fe.value})}function $s(x){const R=qn(x);if(s("remove-project",x),R&&Tt(x)){ge.value="";const k=Be.value;Be.value=Rs(Be.value,R),Eg(R).then(ha).catch(async G=>{Be.value=k;const We=G instanceof Error?G.message:r("Failed to delete project automation");ge.value=We,a(We);try{await ha()}catch{Be.value=k}}).finally(()=>{s("automations-changed")})}$t()}function qn(x){var k;const R=((k=o.projectCwdByName[x])==null?void 0:k.trim())??"";return Ex(R)?R:""}function gi(x,R){if(!x.altKey||x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;const k=o.groups.findIndex(Ot=>Ot.projectName===R);if(k<0)return;const G=x.key==="ArrowUp"?-1:1,We=Math.max(0,Math.min(k+G,o.groups.length-1));We!==k&&(x.preventDefault(),s("reorder-project",{projectName:R,toIndex:We}))}function ro(x){return L.value[x]===!0}function un(x){return j.value[x]===!0}function Wn(x){L.value={...L.value,[x]:!ro(x)}}function yr(){de.value=!de.value}function wr(x){ho(x)||(j.value={...j.value,[x]:!un(x)})}function Go(x,R){const k=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(k){mo.set(x,k);return}mo.delete(x)}function wa(x,R){const k=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(k){Ho.set(x,k);return}Ho.delete(x)}function Qa(x){let R=x.parentElement;for(;R;){const k=window.getComputedStyle(R),G=k.overflowY||k.overflow;if(G==="auto"||G==="scroll"||G==="hidden"||G==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Jr(x,R){const k=x.getBoundingClientRect(),G=Qa(x),We=6,Ot=G.bottom-k.bottom,ao=k.top-G.top;return Ot>=R+We?"down":ao>Ot?"up":"down"}function yi(x,R){const k=Ho.get(x);if(!k)return"down";const G=Jr(k,R);return ce.value={...ce.value,[x]:G},G}function ba(x){return ce.value[x]??"down"}function Rn(x){const R=mo.get(x);if(!R)return;const k=R.querySelector(".project-menu-panel"),G=(k==null?void 0:k.getBoundingClientRect().height)??0;te.value={...te.value,[x]:Jr(R,G)}}function To(x,R,k){return Math.min(Math.max(x,R),k)}function Xa(x){const R=Ho.get(x);if(!R)return;const k=Bn.value,G=k==null?void 0:k.getBoundingClientRect(),We=(G==null?void 0:G.height)||(k==null?void 0:k.offsetHeight)||112,Ot=(G==null?void 0:G.width)||(k==null?void 0:k.offsetWidth)||160,ao=yi(x,We),Co=R.getBoundingClientRect(),cn=8,br=4,es=Math.max(cn,window.innerWidth-Ot-cn),ts=To(Co.right-Ot,cn,es),Tr=To(ao==="up"?Co.top-We-br:Co.bottom+br,cn,Math.max(cn,window.innerHeight-We-cn));Le.value={left:`${Math.round(ts)}px`,top:`${Math.round(Tr)}px`}}function Ta(){const x=ke.value;x&&Xa(x)}function wi(){window.addEventListener("resize",Ta),document.addEventListener("scroll",Ta,!0)}function Os(){window.removeEventListener("resize",Ta),document.removeEventListener("scroll",Ta,!0)}function Gn(x){const R=ne.value;if(!R)return!1;const k=mo.get(R);if(!k)return!1;if((typeof x.composedPath=="function"?x.composedPath():[]).includes(k))return!0;const We=x.target;return We instanceof Node?k.contains(We):!1}function Vo(x){const R=ke.value;if(!R)return!1;const k=Ho.get(R);if(!k)return!1;const G=typeof x.composedPath=="function"?x.composedPath():[];if(G.includes(k))return!0;const We=Bn.value;if(We&&G.includes(We))return!0;const Ot=x.target;return Ot instanceof Node?!!(k.contains(Ot)||We&&We.contains(Ot)):!1}function Ds(x){if(xt.value){const R=Ro.value,k=typeof x.composedPath=="function"?x.composedPath():[];!!R&&(k.includes(R)||x.target instanceof Node&&R.contains(x.target))||(xt.value=!1)}ne.value&&(Gn(x)||$t(),ke.value&&(Vo(x)||we()))}function Fs(x){ne.value&&!Gn(x)&&$t(),ke.value&&!Vo(x)&&we()}function bi(){xt.value&&(xt.value=!1),ne.value&&$t(),ke.value&&we()}function al(){window.addEventListener("pointerdown",Ds,{capture:!0}),window.addEventListener("focusin",Fs,{capture:!0}),window.addEventListener("blur",bi)}function Ti(){window.removeEventListener("pointerdown",Ds,{capture:!0}),window.removeEventListener("focusin",Fs,{capture:!0}),window.removeEventListener("blur",bi)}function Sa(x){return Wo.value.get(x.projectName)??[]}function Qr(x){if(bn.value)return Sa(x);if(un(x.projectName))return[];const R=Sa(x);return ro(x.projectName)?R:R.slice(0,10)}function Xr(x){return bn.value?!1:!un(x.projectName)&&Sa(x).length>10}function Za(x){return Sa(x).length>0}function So(x){var R;return!!x.pendingRequestState||x.inProgress||x.unread||((R=x.externalSession)==null?void 0:R.active)===!0}function No(x){return x.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function $o(x){var R;return((R=x.externalSession)==null?void 0:R.active)===!0?"external":x.pendingRequestState==="approval"?"awaiting-approval":x.pendingRequestState==="response"?"awaiting-response":x.inProgress?"working":x.unread?"unread":"idle"}nt(()=>o.groups.map(x=>x.projectName),x=>{Hr(x)}),nt(()=>{const x=ne.value;return x?o.projectGitRepoByName[x]:void 0},()=>{const x=ne.value;x&&Nt(()=>{ne.value===x&&Rn(x)})});const Zr=K(()=>xt.value||ne.value!==""||ke.value!=="");return nt(Zr,x=>{if(x){al();return}Ti()}),nt(ke,x=>{if(!x){Os();return}wi(),Nt(()=>{Xa(x)})}),_s(()=>{mo.clear(),Os(),Ti(),qr()}),(x,R)=>(_(),F("section",{class:at(["thread-tree-root",{"chats-first":W.value}])},[Ka.value.length>0?(_(),F("section",N_,[Oe(hs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":U.value,onClick:no},{left:dt(()=>[U.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),default:dt(()=>[w("span",$_,D(h(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),U.value?(_(),F("ul",O_,[(_(!0),F(ot,null,Zt(Ka.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":J(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":h(_e)(k.id),"automation-tooltip":h(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.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))])):ye("",!0)])):ye("",!0),w("section",D_,[Oe(hs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":H.value,onClick:Ya},{left:dt(()=>[H.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:Ro,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":xt.value,"aria-label":h(r)("Organize threads"),title:h(r)("Organize threads"),onClick:gt(ga,["stop"])},[Oe(tf,{class:"thread-icon"})],8,B_),xt.value?(_(),F("div",{key:0,class:"organize-menu-panel",onClick:R[4]||(R[4]=gt(()=>{},["stop"]))},[w("p",U_,D(h(r)("Organize")),1),w("button",{class:"organize-menu-item","data-active":eo.value==="project",type:"button",onClick:R[0]||(R[0]=k=>rn("project"))},[w("span",null,D(h(r)("By project")),1),eo.value==="project"?(_(),F("span",H_,"✓")):ye("",!0)],8,z_),w("button",{class:"organize-menu-item","data-active":eo.value==="chronological",type:"button",onClick:R[1]||(R[1]=k=>rn("chronological"))},[w("span",null,D(h(r)("Chronological list")),1),eo.value==="chronological"?(_(),F("span",W_,"✓")):ye("",!0)],8,q_),w("button",{class:"organize-menu-item","data-active":W.value,type:"button",onClick:gr},[w("span",null,D(h(r)("Chats first")),1),W.value?(_(),F("span",V_,"✓")):ye("",!0)],8,G_),R[40]||(R[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",K_,D(h(r)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":ve.value==="created",type:"button",onClick:R[2]||(R[2]=k=>ya("created"))},[w("span",null,D(h(r)("Created")),1),ve.value==="created"?(_(),F("span",J_,"✓")):ye("",!0)],8,Y_),w("button",{class:"organize-menu-item","data-active":ve.value==="updated",type:"button",onClick:R[3]||(R[3]=k=>ya("updated"))},[w("span",null,D(h(r)("Updated")),1),ve.value==="updated"?(_(),F("span",X_,"✓")):ye("",!0)],8,Q_),R[41]||(R[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:P},[w("span",null,D(h(r)("Recycle bin")),1)])])):ye("",!0)],512)]),default:dt(()=>[w("span",F_,D(h(r)("Projects")),1)]),_:1},8,["aria-expanded"]),H.value?(_(),F(ot,{key:0},[h(ge)?(_(),F("p",Z_,D(h(ge)),1)):ye("",!0),bn.value&&Lt.value.length===0?(_(),F("p",eP,D(h(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(_(),F("p",tP,D(h(r)("Loading threads...")),1)):zn.value?(_(),F("ul",nP,[(_(!0),F(ot,null,Zt(sn.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":J(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":h(_e)(k.id),"automation-tooltip":h(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.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))])):(_(),F("div",{key:4,ref_key:"groupsContainerRef",ref:Ms,class:"thread-tree-groups",style:er(h(vt))},[(_(!0),F(ot,null,Zt(Lt.value,k=>(_(),F("article",{key:k.projectName,ref_for:!0,ref:G=>h(Ct)(k.projectName,G),class:"project-group","data-project-name":k.projectName,"data-expanded":!un(k.projectName),"data-dragging":h(kt)(k.projectName),style:er(h(mn)(k.projectName))},[Oe(hs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:G=>wr(k.projectName),onContextmenu:gt(G=>Ja(k.projectName),["prevent"]),onKeydown:[G=>gi(G,k.projectName),Ao(gt(G=>wr(k.projectName),["prevent"]),["enter"]),Ao(gt(G=>wr(k.projectName),["prevent"]),["space"])]},{left:dt(()=>[w("span",rP,[w("span",aP,[un(k.projectName)?(_(),Qe(qf,{key:0,class:"thread-icon"})):(_(),Qe(bA,{key:1,class:"thread-icon"}))]),w("span",sP,[un(k.projectName)?(_(),Qe(Su,{key:0,class:"thread-icon"})):(_(),Qe(Cs,{key:1,class:"thread-icon"}))])])]),right:dt(()=>[w("div",dP,[w("div",{ref_for:!0,ref:G=>Go(k.projectName,G),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:gt(G=>Ns(k.projectName),["stop"])},[Oe(tf,{class:"thread-icon"})],8,fP),va(k.projectName)?(_(),F("div",{key:0,class:"project-menu-panel","data-open-direction":te.value[k.projectName]??"down",onClick:R[6]||(R[6]=gt(()=>{},["stop"]))},[Pe.value==="actions"?(_(),F(ot,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:G=>Yt(k.projectName)},D(h(r)("Browse files")),9,hP),w("button",{class:"project-menu-item",type:"button",onClick:G=>Gt(k.projectName)},D(h(r)("Export Project")),9,mP),w("button",{class:"project-menu-item",type:"button",onClick:G=>h(zr)(k.projectName)},D(h(Tt)(k.projectName)?h(r)("Manage automations…"):h(r)("Add automation…")),9,vP),e.projectGitRepoByName[k.projectName]?(_(),F("button",{key:0,class:"project-menu-item",type:"button",onClick:G=>vi(k.projectName)},D(h(r)("New worktree")),9,gP)):ye("",!0),w("button",{class:"project-menu-item",type:"button",onClick:G=>Hn(k)},D(h(r)("Rename project")),9,yP),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:G=>$s(k.projectName)},D(h(r)("Remove")),9,wP)],64)):(_(),F(ot,{key:1},[w("label",bP,D(h(r)("Project name")),1),xn(w("input",{"onUpdate:modelValue":R[5]||(R[5]=G=>Fe.value=G),class:"project-menu-input",type:"text",onInput:G=>rl(k.projectName)},null,40,TP),[[Nn,Fe.value]])],64))],8,pP)):ye("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":An(k.projectName),title:An(k.projectName),onClick:gt(G=>Kr(k.projectName),["stop"])},[Oe(Zi,{class:"thread-icon"})],8,SP)])]),default:dt(()=>[w("span",{class:"project-main-button","data-dragging-handle":h(kt)(k.projectName),onMousedown:gt(G=>h(Fn)(G,k.projectName),["left"])},[w("span",{class:"project-title",title:Tn(k.projectName)},D(Lo(k)),9,lP),h(Tt)(k.projectName)?(_(),F("span",{key:0,class:"thread-row-automation-chip",title:h(Br)(k.projectName)},[Oe(bs,{class:"thread-row-automation-icon"}),h(bt)(k.projectName)>1?(_(),F("span",cP,D(h(bt)(k.projectName)),1)):ye("",!0)],8,uP)):ye("",!0)],40,iP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Za(k)?(_(),F("ul",CP,[(_(!0),F(ot,null,Zt(Qr(k),G=>(_(),Qe(Cu,{key:G.id,thread:G,selected:G.id===e.selectedThreadId,pinned:oo(G.id),"menu-open":J(G.id),"show-status-indicator":So(G),"thread-state":$o(G),"inline-delete-confirming":pr(G.id),"automation-count":h(_e)(G.id),"automation-tooltip":h(At)(G.id),"request-label":No(G),"relative-time":bo(G),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":We=>wa(G.id,We),onSelect:We=>ln(G.id),onInlineDelete:We=>hr(G.id),onMenuToggle:We=>ct(G.id),onRowLeave:We=>E(G.id,We),onRowContextmenu:We=>_t(We,G.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))])):(_(),Qe(hs,{key:1,as:"p",class:"project-empty-row"},{left:dt(()=>[...R[42]||(R[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:dt(()=>[w("span",xP,D(h(r)("No threads")),1)]),_:1})),Xr(k)?(_(),Qe(hs,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...R[43]||(R[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:G=>Wn(k.projectName)},D(ro(k.projectName)?"Show less":"Show more"),9,kP)]),_:2},1024)):ye("",!0)],12,oP))),128))],4))],64)):ye("",!0)]),w("section",IP,[Oe(hs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":he.value,onClick:wo},{left:dt(()=>[he.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",_P,[w("button",{class:"chats-section-action",type:"button","aria-label":h(r)("New chat"),title:h(r)("New chat"),onClick:R[7]||(R[7]=gt(k=>x.$emit("start-new-chat"),["stop"]))},[Oe(Zi,{class:"thread-icon"})],8,PP)])]),default:dt(()=>[w("span",AP,D(h(r)("Chats")),1)]),_:1},8,["aria-expanded"]),he.value&&to.value.length===0?(_(),F("p",RP,D(h(r)("No chats")),1)):he.value?(_(),F("ul",EP,[(_(!0),F(ot,null,Zt(nn.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":J(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":h(_e)(k.id),"automation-tooltip":h(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.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))])):ye("",!0),he.value&&Va.value?(_(),Qe(hs,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...R[44]||(R[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:yr},D(de.value?"Show less":"Show more"),1)]),_:1})):ye("",!0)]),(_(),Qe(Vi,{to:"body"},[qt.value?(_(),F("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Bn,class:"thread-menu-panel thread-menu-panel-fixed",style:er(Le.value),"data-open-direction":ba(qt.value.id),onClick:R[17]||(R[17]=gt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:R[8]||(R[8]=k=>h(Ur)(qt.value.id))},D(h(Ye)(qt.value.id)?h(r)("Manage automations…"):h(r)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[9]||(R[9]=k=>fr(qt.value.id))},D(h(r)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[10]||(R[10]=k=>dn(qt.value.id))},D(h(r)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[11]||(R[11]=k=>C(qt.value.id))},D(h(r)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:qt.value.id!==e.selectedThreadId,title:qt.value.id===e.selectedThreadId?h(r)("Copy chat"):h(r)("Open this chat before copying"),onClick:R[12]||(R[12]=k=>In(qt.value.id))},D(h(r)("Copy chat")),9,jP),w("button",{class:"thread-menu-item",type:"button",onClick:R[13]||(R[13]=k=>dr(qt.value.id))},D(h(r)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[14]||(R[14]=k=>St(qt.value.id))},D(oo(qt.value.id)?h(r)("Unpin thread"):h(r)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[15]||(R[15]=k=>_n(qt.value.id,qt.value.title))},D(h(r)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[16]||(R[16]=k=>Wt(qt.value.id,qt.value.title))},D(h(r)("Delete thread")),1)],12,MP)):ye("",!0)])),Oe(xd,{open:Ke.value,title:h(r)("Rename thread"),subtitle:h(r)("Make it short and recognizable."),onClose:Kt},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Kt},D(h(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Pn},D(h(r)("Save")),1)]),default:dt(()=>[xn(w("input",{ref_key:"renameThreadInputRef",ref:ut,"onUpdate:modelValue":R[18]||(R[18]=k=>Ze.value=k),class:"rename-thread-input",type:"text",placeholder:h(r)("Add title..."),onKeydown:Ao(gt(Pn,["prevent"]),["enter"])},null,40,LP),[[Nn,Ze.value]])]),_:1},8,["open","title","subtitle"]),Oe(xd,{open:fe.value,title:Ht.value?h(r)("Archive chat and remove automations?"):h(r)("Delete thread?"),subtitle:js.value,onClose:vn},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:vn},D(h(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:mi},D(Ht.value?h(r)("Archive and remove"):h(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Oe(xd,{open:f.value,title:h(r)("Recycle bin"),subtitle:h(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:R[19]||(R[19]=k=>f.value=!1)},{default:dt(()=>[w("div",NP,[h(i).length===0?(_(),F("div",$P,D(h(r)("Recycle bin is empty.")),1)):(_(),F("ul",OP,[(_(!0),F(ot,null,Zt(h(i),k=>(_(),F("li",{key:k.id,class:"recycle-bin-item"},[w("div",DP,[w("span",FP,D(k.title),1),k.projectName?(_(),F("span",BP,D(k.projectName),1)):ye("",!0),w("span",UP,D(jo(k.archivedAtIso)),1)]),w("div",zP,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:S.value===k.id,onClick:G=>B(k.id)},D(S.value===k.id?h(r)("Restoring…"):h(r)("Restore")),9,HP),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:G=>h(c)(k.id)},D(h(r)("Delete permanently")),9,qP)])]))),128))])),g.value?(_(),F("p",WP,D(g.value),1)):ye("",!0)])]),_:1},8,["open","title","subtitle"]),(_(),Qe(Vi,{to:"body"},[h(A)?(_(),F("div",{key:0,class:"rename-thread-overlay",onClick:R[39]||(R[39]=gt((...k)=>h(Zn)&&h(Zn)(...k),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":h(M)==="project"?h(r)("Project automation"):h(r)("Thread automation")},[w("h3",VP,D(h(Z)==="edit"?h(r)("Edit automation"):h(r)("Add automation")),1),w("p",KP,D(h(st)),1),h(ue)&&h(Z)==="create"?(_(),F("div",YP,[R[45]||(R[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",JP,[w("button",{class:at(["automation-target-mode",{"is-active":h(re)==="thread"}]),type:"button",onClick:R[20]||(R[20]=k=>h(Wa)("thread"))}," Existing chat ",2),w("button",{class:at(["automation-target-mode",{"is-active":h(re)==="project"}]),type:"button",onClick:R[21]||(R[21]=k=>h(Wa)("project"))}," Project ",2)]),w("div",QP,[Oe(ci,{modelValue:h(je),"onUpdate:modelValue":R[22]||(R[22]=k=>kn(je)?je.value=k:null),class:"automation-thread-dropdown",options:h(mt),placeholder:h(re)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":h(re)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ye("",!0),h(Je).length>0?(_(),F("div",{key:1,class:"automation-thread-list","aria-label":h(M)==="project"?"Project automations":"Thread automations"},[(_(!0),F(ot,null,Zt(h(Je),k=>(_(),F("button",{key:k.id,class:at(["automation-thread-list-item",{"is-active":k.id===h(z)}]),type:"button",onClick:G=>h(sr)(k.id)},[w("span",null,D(k.name),1),w("small",null,D(k.status==="PAUSED"?"Paused":"Active"),1)],10,ZP))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:R[23]||(R[23]=(...k)=>h(Uo)&&h(Uo)(...k))},D(h(r)("Add another automation")),1)],8,XP)):ye("",!0),w("label",eR,[w("span",tR,D(h(r)("Name")),1),xn(w("input",{"onUpdate:modelValue":R[24]||(R[24]=k=>h(He).name=k),class:"rename-thread-input",type:"text",placeholder:h(r)("Automation name")},null,8,nR),[[Nn,h(He).name]])]),w("label",oR,[w("span",rR,D(h(r)("Prompt")),1),xn(w("textarea",{"onUpdate:modelValue":R[25]||(R[25]=k=>h(He).prompt=k),class:"automation-thread-textarea",rows:"6",placeholder:h(r)("Describe what the automation should do")},null,8,aR),[[Nn,h(He).prompt]])]),w("div",sR,[w("span",iR,D(h(r)("Schedule")),1),w("div",lR,[w("button",{class:at(["automation-schedule-mode",{"is-active":h(Ue).mode==="daily"}]),type:"button",onClick:R[26]||(R[26]=k=>h(ar)("daily"))},D(h(r)("Daily")),3),w("button",{class:at(["automation-schedule-mode",{"is-active":h(Ue).mode==="interval"}]),type:"button",onClick:R[27]||(R[27]=k=>h(ar)("interval"))},D(h(r)("Interval")),3),w("button",{class:at(["automation-schedule-mode",{"is-active":h(Ue).mode==="advanced"}]),type:"button",onClick:R[28]||(R[28]=k=>h(ar)("advanced"))}," RRULE ",2)]),h(Ue).mode==="daily"?(_(),F("div",uR,[w("span",cR,D(h(r)("Run every day at")),1),xn(w("input",{"onUpdate:modelValue":R[29]||(R[29]=k=>h(Ue).dailyTime=k),class:"automation-schedule-time",type:"time",onInput:R[30]||(R[30]=(...k)=>h(zt)&&h(zt)(...k))},null,544),[[Nn,h(Ue).dailyTime]])])):h(Ue).mode==="interval"?(_(),F("div",dR,[w("span",fR,D(h(r)("Run every")),1),xn(w("input",{"onUpdate:modelValue":R[31]||(R[31]=k=>h(Ue).interval=k),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:R[32]||(R[32]=(...k)=>h(zt)&&h(zt)(...k))},null,544),[[Nn,h(Ue).interval,void 0,{number:!0}]]),Oe(ci,{class:"automation-schedule-unit-dropdown","model-value":h(Ue).intervalUnit,options:h(q),placeholder:h(r)("Unit"),"onUpdate:modelValue":h(Ha)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ye("",!0),h(Ue).mode==="advanced"?xn((_(),F("input",{key:2,"onUpdate:modelValue":R[33]||(R[33]=k=>h(He).rrule=k),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:R[34]||(R[34]=(...k)=>h(pa)&&h(pa)(...k))},null,544)),[[Nn,h(He).rrule]]):ye("",!0),w("p",pR,D(h(et)),1)]),w("div",hR,[w("span",mR,D(h(r)("Status")),1),Oe(ci,{class:"automation-thread-dropdown","model-value":h(He).status,options:h(ae),placeholder:h(r)("Status"),"onUpdate:modelValue":h(fa)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),h(Re)?(_(),F("p",vR,D(h(Re)),1)):h(xe)?(_(),F("p",gR,D(h(xe)),1)):ye("",!0),w("div",yR,[h(Z)==="edit"&&h(M)==="thread"?(_(),F("button",{key:0,class:"rename-thread-button",type:"button",disabled:h(Ve)||h(Ne),onClick:R[35]||(R[35]=(...k)=>h(Dn)&&h(Dn)(...k))},D(h(Ne)?h(r)("Running…"):h(r)("Run now")),9,wR)):ye("",!0),h(Z)==="edit"?(_(),F("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:h(Ve)||h(Ne),onClick:R[36]||(R[36]=(...k)=>h(Po)&&h(Po)(...k))},D(h(r)("Remove")),9,bR)):ye("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:h(Ve)||h(Ne),onClick:R[37]||(R[37]=(...k)=>h(Zn)&&h(Zn)(...k))},D(h(r)("Cancel")),9,TR),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:h(Ve)||h(Ne),onClick:R[38]||(R[38]=(...k)=>h(zo)&&h(zo)(...k))},D(h(Ve)?h(r)("Saving…"):h(r)("Save")),9,SR)])],8,GP)])):ye("",!0)]))],2))}}),xR=It(CR,[["__scopeId","data-v-e9f9e36a"]]),kR={class:"content-header"},IR=["title"],AR={class:"content-actions"},_R=hn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(_(),F("header",kR,[w("div",{class:at(["content-leading",{"is-accent":e.accent}])},[_o(t.$slots,"leading",{},void 0)],2),w("h1",{class:at(["content-title",{"is-accent":e.accent}]),title:e.title},D(e.title),11,IR),w("div",AR,[_o(t.$slots,"actions",{},void 0)])]))}}),PR=It(_R,[["__scopeId","data-v-61739409"]]),_m=.0025,kd=3,Pm=2,RR=256;function ER(e){var pe;const t=T("idle"),n=T(typeof navigator<"u"&&!!((pe=navigator.mediaDevices)!=null&&pe.getUserMedia)),o=T(0),r=T(null);let a=null,s=null,i=[],l=null,d=null,c=null,v=null,f=[],g=!1,S=!1,P=null;function B(){P&&(P.abort(),P=null),t.value==="transcribing"&&(t.value="idle")}function L(){const Q=r.value;if(!Q||typeof window>"u")return;const me=Q.getContext("2d");if(!me)return;const ne=Math.max(1,Math.floor(Q.clientWidth)),ke=Math.max(1,Math.floor(Q.clientHeight||36)),$e=window.devicePixelRatio||1,te=Math.max(1,Math.floor(ne*$e)),ce=Math.max(1,Math.floor(ke*$e));(Q.width!==te||Q.height!==ce)&&(Q.width=te,Q.height=ce),me.setTransform($e,0,0,$e,0,0),me.clearRect(0,0,ne,ke);const Le=Math.max(12,Math.floor(ne/(kd+Pm))),Pe=f.slice(-Le),Fe=Math.max(0,Le-Pe.length),Ke=ke/2,lt=getComputedStyle(Q).color||"#000000";for(let Ze=0;Ze<Le;Ze+=1){const ut=Pe[Ze-Fe]??0,N=Math.max(.08,Math.min(1,ut*18))*Ke,oe=Ze*(kd+Pm);me.globalAlpha=ut<=_m?.35:1,me.fillStyle=lt,me.fillRect(oe,Ke-N,kd,N*2)}me.globalAlpha=1}function j(){f=[],o.value=0,L()}function U(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),v=null}function H(Q){if(typeof window>"u")return;const me=window.webkitAudioContext,ne=window.AudioContext??me;ne&&(U(),j(),l=new ne,d=l.createMediaStreamSource(Q),c=l.createScriptProcessor(2048,1,1),v=performance.now(),c.onaudioprocess=ke=>{const $e=ke.inputBuffer.getChannelData(0);let te=0;for(let ce=0;ce<$e.length;ce+=1){const Le=Math.abs($e[ce]??0);te+=Le<_m?0:Le}f.push(te/$e.length),f.length>RR&&f.shift(),v!==null&&(o.value=Math.max(0,performance.now()-v)),L()},d.connect(c),c.connect(l.destination),L())}async function he(){var Q;if(t.value==="transcribing"&&B(),!(t.value!=="idle"||!n.value||g)){g=!0,S=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=me=>{me.data.size>0&&i.push(me.data)},a.onstop=()=>{var ke;const me=i,ne=(a==null?void 0:a.mimeType)||((ke=me[0])==null?void 0:ke.type)||"audio/webm";Se(),ve(me,ne)},H(s),a.start(250),t.value="recording",S&&de()}catch(me){Se(),t.value="idle",(Q=e.onError)==null||Q.call(e,me)}finally{g=!1}}}function de(){if(g&&t.value==="idle"){S=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function W(){S=!1,B(),Se(),t.value="idle"}async function ve(Q,me){var $e,te,ce,Le,Pe;if(Q.length===0){($e=e.onEmpty)==null||$e.call(e),t.value="idle";return}const ne=new Blob(Q,{type:me});t.value="transcribing";let ke=null;try{const Fe=me.split(/[/;]/)[1]??"webm",Ke=new FormData;Ke.append("file",ne,`codex.${Fe}`);const lt=((te=e.getLanguage)==null?void 0:te.call(e).trim())??"";lt&<.toLowerCase()!=="auto"&&Ke.append("language",lt),ke=new AbortController,P=ke;const Ze=await fetch("/codex-api/transcribe",{method:"POST",body:Ke,signal:ke.signal}),ut=await Ze.text();let fe=null;try{fe=ut.trim()?JSON.parse(ut):null}catch{fe=null}if(!Ze.ok){const oe=(ce=fe==null?void 0:fe.error)==null?void 0:ce.trim(),le=ut.trim();throw new Error(oe||le||`Transcription failed: ${Ze.status}`)}const N=((fe==null?void 0:fe.text)??"").trim();N.length>0?e.onTranscript(N):(Le=e.onEmpty)==null||Le.call(e)}catch(Fe){if(Fe instanceof DOMException&&Fe.name==="AbortError")return;(Pe=e.onError)==null||Pe.call(e,Fe)}finally{ke&&P===ke&&(P=null),t.value==="transcribing"&&(t.value="idle")}}function Se(){U(),j(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(Q=>Q.stop()),s=null),i=[]}_s(()=>{W()});function Ae(){if(t.value==="recording"){de();return}(t.value==="idle"||t.value==="transcribing")&&he()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:he,stopRecording:de,toggleRecording:Ae,cancel:W}}const MR={},jR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function LR(e,t){return _(),F("svg",jR,[...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 NR=It(MR,[["render",LR]]),$R={},OR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function DR(e,t){return _(),F("svg",OR,[...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 FR=It($R,[["render",DR]]),BR={},UR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function zR(e,t){return _(),F("svg",UR,[...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 HR=It(BR,[["render",zR]]),qR={},WR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function GR(e,t){return _(),F("svg",WR,[...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 VR=It(qR,[["render",GR]]),KR=["aria-label"],YR=8,ti=8,JR=hn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,a=T(null),s=T(null),i=T({});let l=!1;const d=K(()=>o.open),c=K(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function v(L,j,U){return Math.min(Math.max(j,L),U)}function f(){var Ae,pe;if(!d.value)return;const L=a.value;if(!L||typeof window>"u")return;const j=L.getBoundingClientRect(),U=window.innerWidth,H=window.innerHeight,he=Math.max(0,U-ti*2),de=Math.min(((Ae=s.value)==null?void 0:Ae.offsetWidth)??288,he),W=((pe=s.value)==null?void 0:pe.offsetHeight)??0;let ve;o.align==="end"?ve=j.right-de:o.align==="center"?ve=j.left+(j.width-de)/2:ve=j.left,ve=v(ve,ti,Math.max(ti,U-de-ti));let Se=j.top-W-YR;Se=v(Se,ti,Math.max(ti,H-W-ti)),i.value={position:"fixed",left:`${ve}px`,right:"auto",top:`${Se}px`,bottom:"auto",width:`${de}px`}}function g(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function S(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}nt(d,L=>{if(!L){S(),i.value={};return}g(),Nt(()=>{var j;(j=s.value)==null||j.focus(),f(),window.requestAnimationFrame(f)})}),_s(()=>{S()});function P(){r("update:open",!o.open)}function B(L){var W,ve,Se;if(L.key==="Escape"){r("update:open",!1);return}const j=s.value;if(!j)return;const U=Array.from(j.querySelectorAll("button")).filter(Ae=>!Ae.disabled&&Ae.offsetParent!==null);if(U.length===0)return;if(L.key==="Home"){L.preventDefault(),(W=U[0])==null||W.focus();return}if(L.key==="End"){L.preventDefault(),(ve=U[U.length-1])==null||ve.focus();return}if(L.key!=="ArrowDown"&&L.key!=="ArrowUp")return;L.preventDefault();let H=U.findIndex(Ae=>Ae===document.activeElement);H<0&&(H=L.key==="ArrowDown"?-1:0);const he=L.key==="ArrowDown"?1:-1,de=(H+he+U.length)%U.length;(Se=U[de])==null||Se.focus()}return t({root:a}),(L,j)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[_o(L.$slots,"trigger",{toggle:P,isOpen:d.value},void 0),Oe(Xl,{name:"composer-popover"},{default:dt(()=>[d.value?(_(),F("div",{key:0,ref_key:"panelRef",ref:s,class:at(["composer-popover-panel",[c.value,e.panelClass]]),style:er(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:B},[_o(L.$slots,"default",{},void 0,!0)],46,KR)):ye("",!0)]),_:3})],512))}}),Qu=It(JR,[["__scopeId","data-v-f7444b02"]]),QR=["aria-label"],XR={class:"composer-popover-group-label"},ZR=["aria-selected","onMousedown"],eE={class:"thread-composer-slash-body"},tE={class:"thread-composer-slash-name"},nE={class:"thread-composer-slash-desc"},oE={class:"thread-composer-slash-kind"},rE={class:"composer-popover-group-label composer-popover-group-label--skills"},aE=["aria-selected","onMousedown"],sE=["aria-label","title"],iE={class:"thread-composer-slash-body thread-composer-slash-body--skill"},lE={class:"thread-composer-slash-skill-name"},uE={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},cE=hn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=T(null),s=K(()=>n.commands.filter(v=>v.group!=="skill")),i=K(()=>n.commands.filter(v=>v.group==="skill"));nt(()=>n.highlightedIndex,async()=>{var v,f;await Nt(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return r(v==="rpc"?"Action":v==="text"?"Prompt":v==="skill"?"Skill":"Local")}function d(v){return v==="system"?"S":v==="repo"?"R":v==="plugin"?"P":"U"}function c(v){return r(v==="system"?"System":v==="repo"?"Repo":v==="plugin"?"Plugin":"User")}return(v,f)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":h(r)("Commands")},[s.value.length>0?(_(),F(ot,{key:0},[w("div",XR,D(h(r)("Commands")),1),(_(!0),F(ot,null,Zt(s.value,(g,S)=>(_(),F("button",{key:g.id,class:at(["thread-composer-slash-row",{"is-active":S===e.highlightedIndex}]),type:"button",role:"option","aria-selected":S===e.highlightedIndex,onMousedown:gt(P=>o("select",g),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",eE,[w("span",tE,D(g.id),1),w("span",nE,D(h(r)(g.description)),1)]),w("span",oE,D(l(g.kind)),1)],42,ZR))),128))],64)):ye("",!0),i.value.length>0?(_(),F(ot,{key:1},[w("div",rE,D(h(r)("Skills")),1),(_(!0),F(ot,null,Zt(i.value,(g,S)=>(_(),F("button",{key:g.skillPath||g.id,class:at(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+S===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+S===e.highlightedIndex,onMousedown:gt(P=>o("select",g),["prevent"])},[w("span",{class:at(["thread-composer-slash-skill-icon",`is-${g.scope||"user"}`]),"aria-label":c(g.scope),title:c(g.scope)},D(d(g.scope)),11,sE),w("span",iE,[w("span",lE,D(g.displayName||g.id),1),w("span",uE,D(g.description),1)])],42,aE))),128))],64)):ye("",!0)],8,QR))}}),dE=It(cE,[["__scopeId","data-v-ca16aa11"]]),fE=["data-streaming"],pE=["aria-expanded"],hE={class:"thread-composer-plan-panel-title"},mE={key:0,class:"thread-composer-plan-panel-badge"},vE={class:"thread-composer-plan-panel-progress"},gE=["title"],yE=["data-status"],wE={class:"thread-composer-plan-panel-latest-text"},bE={class:"thread-composer-plan-panel-popover-content"},TE={class:"thread-composer-plan-panel-popover-scroll"},SE={class:"thread-composer-plan-panel-popover-head"},CE={class:"thread-composer-plan-panel-title"},xE={class:"thread-composer-plan-panel-progress"},kE={key:0,class:"thread-composer-plan-panel-popover-section"},IE={class:"thread-composer-plan-panel-section-label"},AE=["title"],_E={class:"thread-composer-plan-panel-popover-section"},PE={class:"thread-composer-plan-panel-section-label"},RE={class:"thread-composer-plan-panel-steps"},EE=["data-status"],ME=["data-status"],jE=["title"],LE={class:"thread-composer-plan-panel-popover-footer"},NE=["disabled","data-state"],$E=hn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=T(!1),s=K(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(g=>g.status==="completed").length}),i=K(()=>{var f;const v=((f=n.planPanel)==null?void 0:f.steps)??[];if(v.length===0)return null;for(let g=v.length-1;g>=0;g-=1){const S=v[g];if(S.status==="inProgress")return S}return v[v.length-1]}),l=K(()=>{var S,P,B;const v=((P=(S=n.planPanel)==null?void 0:S.explanation)==null?void 0:P.trim())??"";if(!v)return"";const f=((B=v.split(/[。!?!?\n]/u)[0])==null?void 0:B.trim())??"";if(!f)return v;const g=80;return f.length>g?`${f.slice(0,g)}…`:f});function d(v){switch(v){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function c(){a.value=!1,o("implement-plan")}return(v,f)=>(_(),F("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Oe(Qu,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":h(r)("Plan"),"onUpdate:open":f[1]||(f[1]=g=>a.value=g)},{trigger:dt(()=>{var g,S;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=P=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",hE,D(h(r)("Plan")),1),e.planPanel.streaming?(_(),F("span",mE,D(h(r)("Updating")),1)):ye("",!0),w("span",vE,D(s.value)+"/"+D(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((g=i.value)==null?void 0:g.step)??""},[i.value?(_(),F("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},D(d(i.value.status)),9,yE)):ye("",!0),w("span",wE,D(((S=i.value)==null?void 0:S.step)??""),1)],8,gE),Oe(Cs,{class:"thread-composer-plan-panel-chevron"})],8,pE)]}),default:dt(()=>[w("div",bE,[w("div",TE,[w("header",SE,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",CE,D(h(r)("Plan")),1),w("span",xE,D(s.value)+"/"+D(e.planPanel.steps.length),1)]),e.planPanel.explanation?(_(),F("section",kE,[w("p",IE,D(h(r)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},D(l.value),9,AE)])):ye("",!0),w("section",_E,[w("p",PE,D(h(r)("Steps"))+" ("+D(e.planPanel.steps.length)+")",1),w("ol",RE,[(_(!0),F(ot,null,Zt(e.planPanel.steps,(g,S)=>(_(),F("li",{key:`composer-plan-${e.planPanel.id}-${S}`,class:"thread-composer-plan-panel-step","data-status":g.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":g.status},D(d(g.status)),9,ME),w("span",{class:"thread-composer-plan-panel-step-text",title:g.step},D(g.step),9,jE)],8,EE))),128))])])]),w("footer",LE,[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:c},D(e.planPanel.implemented?h(r)("Plan executed"):e.planPanel.streaming?h(r)("Implementing…"):h(r)("Implement plan")),9,NE)])])]),_:1},8,["open","aria-label"])],8,fE))}}),OE=It($E,[["__scopeId","data-v-856e4361"]]),DE={key:0,class:"thread-composer-attachments"},FE=["src"],BE=["src","alt"],UE=["aria-label","disabled","onClick"],zE={key:1,class:"thread-composer-folder-chips"},HE=["title"],qE={class:"thread-composer-folder-chip-meta"},WE=["aria-label","disabled","onClick"],GE={key:2,class:"thread-composer-file-chips"},VE=["title"],KE=["aria-label","disabled","onClick"],YE={key:3,class:"thread-composer-skill-chips"},JE=["title","aria-label","onClick"],QE=["aria-label","onClick"],XE=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,o=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function r(l){const d=l.trim();return d?!!(/^video\/|^data:video\//i.test(d)||o.test(d)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const d=l.trim();return d?d.endsWith("/SKILL.md")?d:`${d.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const d=s(l.path);!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}return(l,d)=>(_(),F(ot,null,[e.selectedImages.length>0?(_(),F("div",DE,[(_(!0),F(ot,null,Zt(e.selectedImages,c=>(_(),F("div",{key:c.id,class:"thread-composer-attachment"},[r(c.url)?(_(),F("video",{key:0,class:"thread-composer-attachment-image",src:c.url,controls:"",preload:"metadata"},null,8,FE)):(_(),F("img",{key:1,class:"thread-composer-attachment-image",src:c.url,alt:c.name||"Selected image"},null,8,BE)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${c.name||"image"}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-image",c.id)}," x ",8,UE)]))),128))])):ye("",!0),e.folderUploadGroups.length>0?(_(),F("div",zE,[(_(!0),F(ot,null,Zt(e.folderUploadGroups,c=>(_(),F("span",{key:c.id,class:"thread-composer-folder-chip"},[Oe(qf,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:c.name},D(c.name),9,HE),w("span",qE,[c.isUploading?(_(),F(ot,{key:0},[ws(D(a(c))+"% uploading ("+D(c.processed)+"/"+D(c.total)+") ",1)],64)):(_(),F(ot,{key:1},[ws(D(c.filePaths.length)+" file"+D(c.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${c.name}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-folder",c.id)},"×",8,WE)]))),128))])):ye("",!0),e.standaloneFileAttachments.length>0?(_(),F("div",GE,[(_(!0),F(ot,null,Zt(e.standaloneFileAttachments,c=>(_(),F("span",{key:c.fsPath,class:"thread-composer-file-chip"},[Oe(Zi,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:c.fsPath},D(c.label),9,VE),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${c.label}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-file",c.fsPath)},"×",8,KE)]))),128))])):ye("",!0),e.selectedSkills.length>0?(_(),F("div",YE,[(_(!0),F(ot,null,Zt(e.selectedSkills,c=>(_(),F("span",{key:c.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(c.path),"aria-label":`Open ${c.displayName||c.name} SKILL.md`,onClick:v=>i(c)},D(c.displayName||c.name),9,JE),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${c.displayName||c.name}`,onClick:v=>n("remove-skill",c.path)},"×",8,QE)]))),128))])):ye("",!0)],64))}}),ZE=It(XE,[["__scopeId","data-v-67fd7144"]]),eM=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,o=t,{t:r}=da(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=K(()=>{var B;const S=(B=n.modelReasoningEfforts)==null?void 0:B[n.selectedModel];if(S===void 0)return a;const P=new Set(S);return a.filter(L=>P.has(L.value))});function i(S){return S.trim().replace(/^gpt/i,"GPT")}const l=K(()=>n.models.map(S=>({value:S,label:i(S)}))),d=K(()=>n.disabled||!n.activeThreadId),c=K(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=K(()=>n.selectedSpeedMode==="fast"&&c.value);function f(S){o("update:selected-model",S)}function g(S){o("update:selected-reasoning-effort",S)}return(S,P)=>(_(),F(ot,null,[Oe(ci,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?bs:null,placeholder:h(r)("Model"),"open-direction":"up",variant:"pill",disabled:d.value||e.models.length===0,"enable-search":"","search-placeholder":h(r)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Oe(ci,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:h(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:d.value||s.value.length===0,"onUpdate:modelValue":g},null,8,["model-value","options","placeholder","disabled"])],64))}}),tM=It(eM,[["__scopeId","data-v-ad846e52"]]),nM=["aria-label","disabled"],oM=["disabled"],rM=["disabled"],aM=["disabled"],sM={class:"thread-composer-attach-mode"},iM={class:"thread-composer-attach-mode-label"},lM={class:"thread-composer-attach-mode-buttons"},uM=["disabled"],cM=["disabled"],dM={class:"thread-composer-attach-mode"},fM={class:"thread-composer-attach-mode-label"},pM={class:"thread-composer-attach-mode-buttons"},hM=["disabled","onClick"],mM={class:"thread-composer-attach-mode"},vM={class:"thread-composer-attach-mode-label"},gM={class:"thread-composer-attach-mode-buttons"},yM=["disabled","onClick"],wM={key:0,class:"thread-composer-menu-error",role:"alert"},bM={key:0,class:"thread-composer-approval-tip",role:"status"},TM=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:o}=da();function r(){n("toggle")}function a(v){n("set-active-mode",v)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function d(v){n("select-collaboration-mode",v)}function c(v){n("select-approval-policy",v)}return(v,f)=>(_(),Qe(Qu,{open:e.open,align:"start",width:"lg","aria-label":h(o)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=g=>n("update:open",g))},{trigger:dt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":h(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,nM)]),default:dt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},D(h(o)("Add photos & files")),9,oM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},D(h(o)("Add folder")),9,rM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},D(h(o)("Take photo")),9,aM),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",sM,[w("span",iM,D(h(o)("In-progress send")),1),w("div",lM,[w("button",{class:at(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=g=>a("steer"))},D(h(o)("Steer")),11,uM),w("button",{class:at(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=g=>a("queue"))},D(h(o)("Queue")),11,cM)])]),e.isMobile?(_(),F(ot,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",dM,[w("span",fM,D(h(o)("Plan mode")),1),w("div",pM,[(_(!0),F(ot,null,Zt(e.collaborationModeChoices,g=>(_(),F("button",{key:`mobile-plan-${g.value}`,class:at(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===g.value}]),type:"button",disabled:g.disabled||e.isComposerConfigDisabled,onClick:S=>d(g.value)},D(h(o)(g.labelKey)),11,hM))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",mM,[w("span",vM,D(h(o)("Approval policy")),1),w("div",gM,[(_(!0),F(ot,null,Zt(e.approvalPolicyChoices,g=>(_(),F("button",{key:`mobile-approval-${g.value}`,class:at(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===g.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:S=>c(g.value)},D(h(o)(g.label)),11,yM))),128))])]),e.approvalPolicyError?(_(),F("p",wM,D(e.approvalPolicyError),1)):ye("",!0),Oe(Xl,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(_(),F("span",bM,D(e.approvalPolicyNotice),1)):ye("",!0)]),_:1})],64)):ye("",!0)]),_:1},8,["open","aria-label"]))}}),SM=It(TM,[["__scopeId","data-v-93f4c279"]]),CM=/(^|\s)(\/[a-zA-Z]*)$/,Rm=[{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 xM(e){var o,r,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((o=s.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((r=s.displayName)==null?void 0:r.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function kM(e){const t=e.match(CM);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function IM(e,t){const n=t.trim().toLowerCase();if(!n)return e;const o=e.filter(r=>r.id===n);return o.length>0?o:e.filter(r=>r.id.startsWith(n))}const AM={class:"thread-composer-main"},_M={class:"thread-composer-input-row"},PM={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},RM={class:"thread-composer-drop-overlay-copy"},EM={key:1,class:"composer-popover"},MM=["onMousedown"],jM={key:1,class:"thread-composer-file-mention-icon-markdown"},LM={class:"thread-composer-file-mention-text"},NM={class:"thread-composer-file-mention-name"},$M={key:0,class:"thread-composer-file-mention-dir"},OM={key:1,class:"thread-composer-file-mention-empty"},DM={key:2,class:"thread-composer-file-mention-empty"},FM=["placeholder","disabled"],BM=["aria-label","title","disabled"],UM={class:"thread-composer-actions"},zM=["aria-label","title","disabled"],HM={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},qM=["aria-label","title","disabled"],WM=["aria-label","disabled"],GM={class:"thread-composer-plan-trigger-label"},VM=["aria-checked","disabled","onClick"],KM={class:"thread-composer-menu-item-copy"},YM={class:"thread-composer-menu-item-title"},JM={key:0,class:"thread-composer-menu-item-sub"},QM={key:1,class:"thread-composer-menu-item-hint"},XM={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},ZM=["aria-label","disabled"],e1={class:"thread-composer-approval-trigger-label"},t1=["aria-checked","disabled","onClick"],n1={class:"thread-composer-menu-item-copy"},o1={class:"thread-composer-menu-item-title"},r1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},a1={key:0,class:"thread-composer-menu-error",role:"alert"},s1={key:0,class:"thread-composer-approval-tip",role:"status"},i1=["title","aria-label"],l1={class:"thread-composer-context-usage-value"},u1={key:0,class:"thread-composer-context-usage-compact"},c1=["disabled"],d1=["disabled"],f1=["disabled"],Id=12e3,p1=2e3,h1="codex-web-local.thread-draft.v1.",m1=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 o=e,r=n,{t:a}=da(),s=T(""),i=T([]),l=T([]),d=T([]),c=T([]),v=T(""),f=T(0),g=T(null),S=T(!1),{state:P,cancel:B}=ER({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:C=>{if(s.value=s.value?`${s.value}
|
|
58
|
-
${C}`:C,v.value="",o.dictationAutoSend!==!1){const E=o.isTurnInProgress?Ne.value:"steer";zt(E);return}Nt(()=>{var E;return(E=H.value)==null?void 0:E.focus()})},onEmpty:()=>{v.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:C=>{if(C instanceof DOMException&&C.name==="NotAllowedError"){v.value="Microphone access was denied.";return}v.value=C instanceof Error?C.message:"Dictation failed."}}),L=T(null),j=T(null),U=T(null),H=T(null),{isMobile:he}=Of(),de=T(!1),W=T(!1),ve=T(!1),Se=T(null),Ae=T(""),pe=T([]),Q=T(!1),me=T(0),ne=T(!1),ke=T(null),$e=T(""),te=T(0),ce=T(Rm),Le=K(()=>[...Rm,...xM(o.skills??[])]),Pe=T(!1),Fe=T(!1);let Ke=!1;const lt=T(0);let Ze=0,ut=null,fe="",N=!1,oe=0,le=0;const Ee=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let Be="";const A=K(()=>{const C=new Set((o.collaborationModes??[]).map(E=>E.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:!C.has("execplans")}]}),M=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],z=K(()=>{const C=A.value.find(E=>E.value===o.selectedCollaborationMode);return a(C?C.labelKey:"Plan mode")}),Z=K(()=>{const C=M.find(E=>E.value===o.approvalPolicy);return a(C?C.label:"Approval policy")}),ue=K(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),re=K(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||ue.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||d.value.length>0),je=K(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||d.value.length>0||c.value.length>0),Re=K(()=>{const C=new Set;for(const E of c.value)for(const J of E.filePaths)C.add(J);return d.value.filter(E=>!C.has(E.fsPath))}),xe=K(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),ge=K(()=>o.disabled||!o.activeThreadId),Ve=K(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),Ne=T(Ve.value),He=K(()=>P.value==="recording"),Ue=K(()=>o.activeThreadId?ue.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),Je=K(()=>s.value.trim().length>0||i.value.length>0||d.value.length>0),et=K(()=>s.value.split(`
|
|
59
|
-
`).length),st=K(()=>Pe.value||et.value>=6||Fe.value),mt=K(()=>Br(o.threadTokenUsage??null)),q=K(()=>{var C;return((C=mt.value)==null?void 0:C.summaryText)??""}),ae=K(()=>{var C;return((C=mt.value)==null?void 0:C.tooltipText)??""}),_e=K(()=>{var C;return((C=mt.value)==null?void 0:C.tone)??"healthy"});function Ye(){_e.value!=="healthy"&&r("compact-context")}function bt(C){if(!Number.isFinite(C))return"0";const E=Math.abs(C);return E>=1e6?`${(E>=1e7?(C/1e6).toFixed(0):(C/1e6).toFixed(1)).replace(/\.0$/,"")}M`:E>=1e3?`${(E>=1e5?(C/1e3).toFixed(0):(C/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(C))}function Tt(C){const E=Math.max(0,C.inputTokens-C.cachedInputTokens),J=[`${bt(C.totalTokens)} ${a("total")}`,`${bt(E)} ${a("input")}`];return C.cachedInputTokens>0&&J.push(`${bt(C.cachedInputTokens)} ${a("cached")}`),C.outputTokens>0&&J.push(`${bt(C.outputTokens)} ${a("output")}`),C.reasoningOutputTokens>0&&J.push(`${bt(C.reasoningOutputTokens)} ${a("reasoning")}`),J.join(" · ")}function At(C,E){if(!Number.isFinite(C)||!Number.isFinite(E)||E<=0)return 0;if(E<=Id){const _t=Math.max(0,E-Math.max(0,C));return Math.max(0,Math.min(100,Math.round(_t/E*100)))}const J=E-Id,we=Math.max(0,C-Id),ct=Math.max(0,J-we);return Math.max(0,Math.min(100,Math.round(ct/J*100)))}function Br(C){if(!C)return null;const E=C.modelContextWindow??null;if(typeof E!="number"||!Number.isFinite(E)||E<=0)return null;const J=Math.max(0,C.last.totalTokens),we=At(J,E),ct=Math.max(0,Math.min(100,100-we)),_t=we<=15?"danger":we<=35?"warning":"healthy";return{summaryText:`${we}% · ${bt(J)} / ${bt(E)}`,tooltipText:[`${a("Context window")}: ${we}% ${a("left")} (${ct}% ${a("used")})`,`${a("In context")}: ${J.toLocaleString()} / ${E.toLocaleString()} tokens`,`${a("Last turn")}: ${Tt(C.last)}`,`${a("Session total")}: ${Tt(C.total)}`].join(`
|
|
60
|
-
`),percentRemaining:we,tone:_t}}function zt(C="steer"){var J;const E=s.value.trim();if(re.value){if(r("submit",{text:E,imageUrls:i.value.map(we=>we.url),fileAttachments:[...d.value],skills:l.value.map(we=>({name:we.name,path:we.path})),mode:C}),Ps(o.activeThreadId),pa(),Pe.value=!1,c.value=[],de.value=!1,no(),Ee||he.value){(J=H.value)==null||J.blur();return}Nt(()=>{var we;return(we=H.value)==null?void 0:we.focus()})}}function Ha(C){Ne.value=C}function fa(C){lt.value+=1,s.value=C.text,i.value=C.imageUrls.map((E,J)=>({id:`queued-${Date.now()}-${J}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${J+1}`,url:E})),l.value=C.skills.map(E=>(o.skills??[]).find(J=>J.path===E.path)??{name:E.name,displayName:void 0,description:"",path:E.path}),d.value=C.fileAttachments.map(E=>({...E})),c.value=[],v.value="",g.value=null,f.value=0,de.value=!1,no(),wo(),le+=1}function pa(){fa({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Pe.value=!1}function ar(C){return`${h1}${C}`}function Ur(C){if(typeof window>"u")return null;const E=C.trim();if(!E)return null;try{const J=window.localStorage.getItem(ar(E));if(!J)return null;const we=JSON.parse(J);return typeof we=="string"?{text:we,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof we.text=="string"?we.text:"",imageUrls:Array.isArray(we.imageUrls)?we.imageUrls.filter(ct=>typeof ct=="string"):[],fileAttachments:Array.isArray(we.fileAttachments)?we.fileAttachments.filter(ct=>!!ct&&typeof ct.label=="string"&&typeof ct.path=="string"&&typeof ct.fsPath=="string"):[],skills:Array.isArray(we.skills)?we.skills.filter(ct=>!!ct&&typeof ct.name=="string"&&typeof ct.path=="string"):[]}}catch{return null}}function zr(C,E){if(typeof window>"u")return;const J=C.trim();if(J)try{if(E.text.trim().length>0||E.imageUrls.length>0||E.fileAttachments.length>0||E.skills.length>0){window.localStorage.setItem(ar(J),JSON.stringify(E));return}window.localStorage.removeItem(ar(J))}catch{}}function Ps(C){zr(C,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function qa(){return{text:s.value,imageUrls:i.value.map(C=>C.url),fileAttachments:d.value.map(C=>({...C})),skills:l.value.map(C=>({name:C.name,path:C.path}))}}function Wa(){r("interrupt")}function Uo(){const C=H.value;if(!C){Fe.value=!1;return}Fe.value=C.scrollHeight>C.clientHeight+2}function sr(){Ke||(Ke=!0,Nt(()=>{Ke=!1,Uo()}))}function Zn(){xe.value||(Pe.value=!Pe.value,sr(),Nt(()=>{var C;return(C=H.value)==null?void 0:C.focus()}))}function Rs(C){r("update:selected-model",C)}function ha(C){if(C===o.selectedCollaborationMode){W.value=!1;return}r("update:selected-collaboration-mode",C),W.value=!1}function Es(C){if(C===o.selectedCollaborationMode){de.value=!1;return}r("update:selected-collaboration-mode",C),de.value=!1}function zo(C){r("update:selected-reasoning-effort",C)}function Po(C){o.approvalPolicy===C||o.isApprovalPolicySaving===!0||(r("update:approval-policy",C),r("save-approval-policy"))}function Dn(){o.dictationClickToToggle}function Ga(){xe.value||(de.value=!de.value,W.value=!1,ve.value=!1)}function Ms(){ge.value||(W.value=!W.value,de.value=!1,ve.value=!1)}function vt(){ge.value||(ve.value=!ve.value,de.value=!1,W.value=!1)}function Ct(){var C;(C=L.value)==null||C.click()}function kt(){var C;(C=j.value)==null||C.click()}function mn(){var C;(C=U.value)==null||C.click()}function Fn(C){const E=i.value.find(J=>J.id===C);if(E&&xt(E.url)){const J=eo(E.url);J&&Hr(J)}i.value=i.value.filter(J=>J.id!==C)}function ho(C){l.value=l.value.filter(E=>E.path!==C)}function Hr(C){d.value=d.value.filter(E=>E.fsPath!==C)}function qr(C){const E=c.value.find(we=>we.id===C);if(!E)return;const J=new Set(E.filePaths);d.value=d.value.filter(we=>!J.has(we.fsPath)),c.value=c.value.filter(we=>we.id!==C)}function mo(C,E){const J=C.replace(/\\/g,"/");if(d.value.some(_t=>_t.fsPath===J))return;const we=J.split("/").filter(Boolean),ct=(E==null?void 0:E.trim())||we[we.length-1]||J;d.value=[...d.value,{label:ct,path:J,fsPath:J}]}function Ho(C){return C.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(C.name)}const Ro=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Bn(C){return C.type.startsWith("video/")?!0:Ro.test(C.name)}function xt(C){const E=C.trim();if(!E)return!1;if(E.startsWith("data:video/"))return!0;try{const J=new URL(E,window.location.href);return Ro.test(J.pathname)?!0:J.pathname==="/codex-local-image"?Ro.test(J.searchParams.get("path")??""):!1}catch{return Ro.test(E)}}function eo(C){try{const E=new URL(C,window.location.href);return E.pathname!=="/codex-local-image"?"":decodeURIComponent(E.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function vo(C){return C?Array.from(C):[]}function Eo(C){return C!==le?!1:(f.value+=1,!0)}function Mo(C){C===le&&(f.value=Math.max(0,f.value-1))}function en(C){if(C<=0)return;const E=g.value,J=E?E.succeeded+E.failed:0;if(!E||J>=E.total){g.value={total:C,succeeded:0,failed:0};return}g.value={...E,total:E.total+C}}function Un(C){const E=g.value;E&&(g.value={...E,succeeded:E.succeeded+(C==="success"?1:0),failed:E.failed+(C==="failure"?1:0)})}function ir(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function lr(C){const E=new Date,J=[E.getFullYear(),String(E.getMonth()+1).padStart(2,"0"),String(E.getDate()).padStart(2,"0"),String(E.getHours()).padStart(2,"0"),String(E.getMinutes()).padStart(2,"0"),String(E.getSeconds()).padStart(2,"0")].join("-"),we=C.type.startsWith("image/")&&C.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${J}.${we}`}function bn(){const C=new Date;return`pasted-text-${[C.getFullYear(),String(C.getMonth()+1).padStart(2,"0"),String(C.getDate()).padStart(2,"0"),String(C.getHours()).padStart(2,"0"),String(C.getMinutes()).padStart(2,"0"),String(C.getSeconds()).padStart(2,"0")].join("-")}.txt`}function ma(C){return C.name.trim()?C:new File([C],lr(C),{type:C.type||"image/png",lastModified:Date.now()})}async function tn(C,E){if(Eo(E))try{const J=ma(C),we=await wu(J);if(E!==le)return;if(!we){Un("failure");return}i.value=[...i.value,{id:ir(),name:J.name,url:`/codex-local-image?path=${encodeURIComponent(we)}`}],Un("success")}catch{E===le&&Un("failure")}finally{Mo(E)}}async function Wr(C,E){if(Eo(E))try{const J=await wu(C);if(E!==le)return;if(!J){Un("failure");return}mo(J),Un("success")}catch{E===le&&Un("failure")}finally{Mo(E)}}async function go(C,E){if(Eo(E))try{const J=ma(C),we=await wu(J);if(E!==le)return;if(!we){Un("failure");return}const ct=we.replace(/\\/g,"/");i.value=[...i.value,{id:ir(),name:J.name,url:`/codex-local-image?path=${encodeURIComponent(ct)}`}],mo(ct),Un("success")}catch{E===le&&Un("failure")}finally{Mo(E)}}function Lt(C){const E=vo(C);if(E.length===0)return;en(E.length),de.value=!1,no();const J=le;for(const we of E)Ho(we)?tn(we,J):Bn(we)?go(we,J):Wr(we,J)}function zn(){oe=0,S.value=!1}function sn(C){return C?Array.from(C.types??[]).includes("Files"):!1}async function to(C){if(!C||C.length===0)return;const E=lt.value,J=Array.from(C),ct=(J[0].webkitRelativePath||J[0].name).split("/").filter(Boolean)[0]||"Folder",_t=`${Date.now()}-${Math.random().toString(36).slice(2)}`;c.value=[...c.value,{id:_t,name:ct,total:J.length,processed:0,filePaths:[],isUploading:!0}];const _n=Kt=>{E===lt.value&&(c.value=c.value.map(Pn=>Pn.id===_t?Kt(Pn):Pn))};for(const Kt of J)try{const Pn=await wu(Kt);if(E!==lt.value)return;if(Pn){const Wt=Kt.webkitRelativePath||Kt.name;mo(Pn,Wt),_n(vn=>({...vn,processed:vn.processed+1,filePaths:[...vn.filePaths,Pn]}));continue}_n(Wt=>({...Wt,processed:Wt.processed+1}))}catch{_n(Pn=>({...Pn,processed:Pn.processed+1}))}_n(Kt=>({...Kt,isUploading:!1}))}function nn(C){C&&(C.value="")}function Va(C){const E=C.target;Lt((E==null?void 0:E.files)??null),nn(E),de.value=!1}function on(C){const E=C.target;Lt((E==null?void 0:E.files)??null),nn(E),de.value=!1}function qo(C){const E=C.target;to((E==null?void 0:E.files)??null),nn(E),de.value=!1}function ur(C){xe.value||!sn(C.dataTransfer)||(C.preventDefault(),oe+=1,S.value=!0)}function Ht(C){xe.value||!sn(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"),S.value=!0)}function js(C){S.value&&(C.preventDefault(),oe=Math.max(0,oe-1),oe===0&&zn())}function Gr(C){var E;xe.value||!sn(C.dataTransfer)||(C.preventDefault(),zn(),Lt(((E=C.dataTransfer)==null?void 0:E.files)??null))}function Wo(){!S.value&&oe===0||zn()}function yo(C){var _t,_n;if(xe.value)return;const E=((_t=C.clipboardData)==null?void 0:_t.getData("text/plain"))??"";if(E.length>=p1){C.preventDefault();const Kt=new File([E],bn(),{type:"text/plain",lastModified:Date.now()});Lt([Kt]);return}const J=Array.from(((_n=C.clipboardData)==null?void 0:_n.items)??[]);if(J.length===0)return;const we=E.length>0,ct=J.filter(Kt=>Kt.kind==="file"&&Kt.type.startsWith("image/")).map(Kt=>Kt.getAsFile()).filter(Kt=>Kt instanceof File);ct.length!==0&&(we||C.preventDefault(),Lt(ct))}function qt(){v.value&&(v.value=""),sr(),Ya(),Vr()}function Ka(C){if(C.isComposing||C.keyCode===229)return;if(Q.value){if(C.key==="Escape"){C.preventDefault(),no();return}if(C.key==="ArrowDown"){C.preventDefault(),pe.value.length>0&&(me.value=(me.value+1)%pe.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),pe.value.length>0){const J=pe.value.length;me.value=(me.value+J-1)%J}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const J=pe.value[me.value];J?oo(J):no();return}}if(ne.value){if(C.key==="Escape"){C.preventDefault(),wo();return}if(C.key==="ArrowDown"){C.preventDefault(),ce.value.length>0&&(te.value=(te.value+1)%ce.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),ce.value.length>0){const J=ce.value.length;te.value=(te.value+J-1)%J}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const J=ce.value[te.value];J?bo(J):wo();return}}if(o.sendWithEnter!==!1?C.key==="Enter"&&!C.shiftKey:C.key==="Enter"&&(C.metaKey||C.ctrlKey)){C.preventDefault(),zt(o.isTurnInProgress?Ne.value:"steer");return}}function no(){if(Q.value=!1,Se.value=null,Ae.value="",pe.value=[],me.value=0,N=!1,fe){const C=fe;fe="",Ix(C)}}function Ya(){const C=H.value;if(!C){no();return}const E=C.selectionStart??s.value.length,we=s.value.slice(0,E).match(/(^|\s)(@[^\s@]*)$/);if(!we){no();return}const ct=we[2]??"",_t=ct.length,_n=E-_t;ne.value&&wo(),Se.value=_n,Ae.value=ct.slice(1),Q.value=!0,jo()}function wo(){ne.value=!1,ke.value=null,$e.value="",te.value=0,ce.value=Le.value}function Vr(){const C=H.value;if(!C){wo();return}const E=C.selectionStart??s.value.length,J=s.value.slice(0,E),we=kM(J);if(!we){wo();return}Q.value&&no(),ke.value=we.startIndex,$e.value=we.query,ce.value=IM(Le.value,we.query),te.value=0,ne.value=!0}function bo(C){const E=H.value,J=ke.value;if(J!==null&&E){const we=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,J)}${s.value.slice(we)}`}if(wo(),C.kind==="skill"){const we=(o.skills??[]).find(_t=>_t.path===C.skillPath||_t.name===C.id);we&&!l.value.some(_t=>_t.path===we.path)&&(l.value=[...l.value,{...we}]);const ct=s.value.trim();s.value=ct.length>0?`${ct} (Use the ${C.id} skill.)`:`Use the ${C.id} skill.`,Nt(()=>{E==null||E.focus(),Uo()});return}if(C.kind==="rpc"){r("slash-command",C.id);return}C.kind==="text"&&C.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${C.insertText}`:C.insertText),C.kind==="local"&&C.id==="clear"&&(s.value=""),Nt(()=>{E==null||E.focus(),Uo()})}async function jo(){if(!Q.value)return;const C=(o.cwd??"").trim();if(!C){pe.value=[],N=!0;return}N=!1,ut&&clearTimeout(ut);const E=++Ze;ut=setTimeout(async()=>{const J=`composer-${E}`,we=Ae.value;try{if(fe||(await xx([C],J),fe=J,r("register-fuzzy-session",J)),await kx(fe,we),!Q.value||E!==Ze)return;if(pe.value=(o.fuzzyFileSearchResults??[]).map(ct=>({path:ct.path})),me.value=0,pe.value.length===0)try{const ct=await Kh(C,we,20);if(!Q.value||E!==Ze)return;pe.value=ct,me.value=0}catch{if(!Q.value||E!==Ze)return;pe.value=[]}}catch{if(!Q.value||E!==Ze)return;fe="";try{const ct=await Kh(C,we,20);if(!Q.value||E!==Ze)return;pe.value=ct,me.value=0}catch{if(!Q.value||E!==Ze)return;pe.value=[]}}},120)}function oo(C){const E=H.value,J=Se.value;if(J!==null&&E){const we=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,J)}${s.value.slice(we)}`.trimEnd()}mo(C.path),no(),Nt(()=>E==null?void 0:E.focus())}function cr(C){B(),fa(C),Nt(()=>{var E;(E=H.value)==null||E.focus(),Uo()})}function St(C){const E=C.trim();E&&(s.value=s.value.trim()?`${s.value.trim()}
|
|
61
|
-
${E}`:E,Nt(()=>{var J;(J=H.value)==null||J.focus(),Uo()}))}function ln(C){const E=C.lastIndexOf("/");return E<0?C:C.slice(E+1)}function In(C){const E=C.lastIndexOf("/");return E<=0?"":C.slice(0,E)}function dr(C){const E=ln(C),J=E.lastIndexOf(".");return J<=0?"":E.slice(J+1).toLowerCase()}function An(C){const E=dr(C);return E==="ts"?"TS":E==="tsx"?"TSX":E==="js"?"JS":E==="jsx"?"JSX":E==="json"?"{}":""}function Kr(C){const E=dr(C);return E.startsWith("ts")?"ts":E.startsWith("js")?"js":E==="json"?"json":"default"}function fr(C){const E=dr(C);return E==="md"||E==="mdx"}function dn(C){if(!de.value&&!W.value&&!ve.value)return;const E=C.target;E&&(typeof E.closest=="function"&&E.closest(".composer-popover-anchor")||(de.value=!1,W.value=!1,ve.value=!1))}return pi(()=>{document.addEventListener("click",dn),window.addEventListener("drop",Wo),window.addEventListener("dragend",Wo),window.addEventListener("blur",Wo),sr()}),t({hydrateDraft:cr,appendTextToDraft:St,hasUnsavedDraft:()=>je.value}),_s(()=>{document.removeEventListener("click",dn),window.removeEventListener("drop",Wo),window.removeEventListener("dragend",Wo),window.removeEventListener("blur",Wo),window.removeEventListener("pointerup",Dn),window.removeEventListener("pointercancel",Dn),window.removeEventListener("blur",Dn),ut&&clearTimeout(ut)}),nt(()=>o.activeThreadId,C=>{B(),Be&&zr(Be,qa()),pa();const E=Ur(C);E&&(fa(E),qt()),Be=C.trim()},{immediate:!0}),nt([s,i,d,l],()=>{Be&&zr(Be,qa())},{deep:!0}),nt(s,()=>{sr()}),nt(()=>o.cwd,()=>{Q.value&&jo()}),nt(()=>o.fuzzyFileSearchResults,C=>{!Q.value||!fe||(pe.value=(C??[]).map(E=>({path:E.path})),me.value=0)}),nt(Ve,C=>{Ne.value=C}),(C,E)=>(_(),F("form",{class:"thread-composer",onSubmit:E[6]||(E[6]=gt(J=>zt(e.isTurnInProgress?Ne.value:"steer"),["prevent"]))},[w("div",{class:at(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":S.value}])},[e.planPanel?(_(),Qe(OE,{key:0,"plan-panel":e.planPanel,onImplementPlan:E[0]||(E[0]=J=>C.$emit("implement-plan"))},null,8,["plan-panel"])):ye("",!0),Oe(ZE,{"selected-images":i.value,"folder-upload-groups":c.value,"standalone-file-attachments":Re.value,"selected-skills":l.value,"is-interaction-disabled":xe.value,onRemoveImage:Fn,onRemoveFolder:qr,onRemoveFile:Hr,onRemoveSkill:ho},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",AM,[w("div",_M,[w("div",{class:at(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":S.value,"thread-composer-input-wrap--expanded":Pe.value}]),onDragenter:ur,onDragover:Ht,onDragleave:js,onDrop:Gr},[S.value?(_(),F("div",PM,[w("span",RM,D(h(a)("Drop images or files")),1)])):ye("",!0),Q.value?(_(),F("div",EM,[pe.value.length>0?(_(!0),F(ot,{key:0},Zt(pe.value,(J,we)=>(_(),F("button",{key:J.path,class:at(["thread-composer-file-mention-row",{"is-active":we===me.value}]),type:"button",onMousedown:gt(ct=>oo(J),["prevent"])},[An(J.path)?(_(),F("span",{key:0,class:at(["thread-composer-file-mention-icon-badge",`is-${Kr(J.path)}`])},D(An(J.path)),3)):fr(J.path)?(_(),F("span",jM,"↓")):(_(),Qe(Zi,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",LM,[w("span",NM,D(ln(J.path)),1),In(J.path)?(_(),F("span",$M,D(In(J.path)),1)):ye("",!0)])],42,MM))),128)):h(N)?(_(),F("div",OM,D(h(a)("No searchable directory for this thread")),1)):(_(),F("div",DM,D(h(a)("No matching files")),1))])):ye("",!0),ne.value?(_(),Qe(dE,{key:2,commands:ce.value,"highlighted-index":te.value,onSelect:bo},null,8,["commands","highlighted-index"])):ye("",!0),xn(w("textarea",{ref_key:"inputRef",ref:H,"onUpdate:modelValue":E[1]||(E[1]=J=>s.value=J),class:"thread-composer-input",placeholder:Ue.value,disabled:xe.value,onInput:qt,onKeydown:Ka,onPaste:yo},null,40,FM),[[Nn,s.value]]),st.value?(_(),F("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Pe.value?h(a)("Exit full screen composer"):h(a)("Expand composer"),title:Pe.value?h(a)("Exit full screen composer"):h(a)("Expand composer"),disabled:xe.value,onClick:Zn},[Pe.value?(_(),Qe(HR,{key:0,class:"thread-composer-expand-icon"})):(_(),Qe(FR,{key:1,class:"thread-composer-expand-icon"}))],8,BM)):ye("",!0)],34),w("div",UM,[e.isTurnInProgress&&!Je.value?(_(),F("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?h(a)("Saving thread before stop is available"):h(a)("Stop"),title:e.isStopPending?h(a)("Saving thread before stop is available"):h(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:Wa},[e.isStopPending?(_(),F("span",HM)):(_(),Qe(VR,{key:1,class:"thread-composer-stop-icon"}))],8,zM)):(_(),F("button",{key:1,class:at(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ne.value==="queue"}]),type:"button","aria-label":e.isCompacting?h(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Ne.value==="queue"?h(a)("Queue message"):h(a)("Send message"),title:e.isCompacting?h(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${h(a)("Send")} ${Ne.value==="queue"?h(a)("Queue"):h(a)("Steer")}`:h(a)("Send"),disabled:!re.value,onClick:E[2]||(E[2]=J=>zt(e.isTurnInProgress?Ne.value:"steer"))},[Oe(NR,{class:"thread-composer-submit-icon"})],10,qM))])]),w("div",{class:at(["thread-composer-controls",{"thread-composer-controls--recording":He.value}])},[Oe(SM,{open:de.value,"is-mobile":h(he),"is-interaction-disabled":xe.value,"is-composer-config-disabled":ge.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":A.value,"approval-policy-choices":M,"active-in-progress-mode":Ne.value,"onUpdate:open":E[3]||(E[3]=J=>de.value=J),onToggle:Ga,onSetActiveMode:Ha,onSelectPhoto:Ct,onSelectFolder:mn,onCaptureCamera:kt,onSelectCollaborationMode:Es,onSelectApprovalPolicy:Po},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"]),h(he)?ye("",!0):(_(),Qe(Qu,{key:0,open:W.value,align:"start",width:"md","aria-label":h(a)("Plan mode"),"onUpdate:open":E[4]||(E[4]=J=>W.value=J)},{trigger:dt(()=>[w("button",{class:at(["thread-composer-plan-trigger",{"is-active":W.value}]),type:"button","aria-label":h(a)("Plan mode"),disabled:ge.value,onClick:Ms},[w("span",GM,D(z.value),1),Oe(Cs,{class:"thread-composer-plan-trigger-chevron"})],10,WM)]),default:dt(()=>[(_(!0),F(ot,null,Zt(A.value,J=>(_(),F("button",{key:J.value,class:at(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===J.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===J.value,disabled:J.disabled||ge.value,onClick:we=>ha(J.value)},[w("span",KM,[w("span",YM,D(h(a)(J.labelKey)),1),J.subLabel?(_(),F("span",JM,D(J.subLabel),1)):ye("",!0),J.disabled?(_(),F("span",QM,D(h(a)("Not supported by this Codex version")),1)):ye("",!0)]),e.selectedCollaborationMode===J.value?(_(),F("span",XM,"✓")):ye("",!0)],10,VM))),128))]),_:1},8,["open","aria-label"])),h(he)?ye("",!0):(_(),Qe(Qu,{key:1,open:ve.value,align:"center",width:"md","aria-label":h(a)("Approval policy"),"onUpdate:open":E[5]||(E[5]=J=>ve.value=J)},{trigger:dt(()=>[w("button",{class:at(["thread-composer-approval-trigger",{"is-active":ve.value}]),type:"button","aria-label":h(a)("Approval policy"),disabled:ge.value,onClick:vt},[w("span",e1,D(Z.value),1),Oe(Cs,{class:"thread-composer-approval-trigger-chevron"})],10,ZM)]),default:dt(()=>[(_(),F(ot,null,Zt(M,J=>w("button",{key:J.value,class:at(["thread-composer-menu-item",{"is-active":e.approvalPolicy===J.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===J.value,disabled:e.isApprovalPolicySaving,onClick:we=>Po(J.value)},[w("span",n1,[w("span",o1,D(h(a)(J.label)),1)]),e.approvalPolicy===J.value?(_(),F("span",r1,"✓")):ye("",!0)],10,t1)),64)),e.approvalPolicyError?(_(),F("p",a1,D(e.approvalPolicyError),1)):ye("",!0),Oe(Xl,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(_(),F("span",s1,D(e.approvalPolicyNotice),1)):ye("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Oe(tM,{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":Rs,"onUpdate:selectedReasoningEffort":zo},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),mt.value?(_(),F("button",{key:2,type:"button",class:at(["thread-composer-context-usage-inline",{"is-warning":_e.value==="warning","is-danger":_e.value==="danger"}]),title:ae.value,"aria-label":h(a)("Context"),onClick:Ye},[w("span",l1,D(q.value),1),_e.value!=="healthy"?(_(),F("span",u1,D(h(a)("Compact")),1)):ye("",!0)],10,i1)):ye("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:L,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:xe.value,onChange:Va},null,40,c1),w("input",{ref_key:"cameraCaptureInputRef",ref:j,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:xe.value,onChange:on},null,40,d1),w("input",{ref_key:"folderPickerInputRef",ref:U,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:xe.value,onChange:qo},null,40,f1)],32))}}),Em=It(m1,[["__scopeId","data-v-b91883d7"]]),v1=["aria-label"],g1=["aria-checked","onClick"],y1={class:"runtime-toggle-option-label"},w1=hn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=da(),r=[{value:"local",label:o("Local project"),icon:qf},{value:"worktree",label:o("New worktree"),icon:Ju}];function a(s){n("update:modelValue",s)}return(s,i)=>(_(),F("div",{class:"runtime-toggle",role:"radiogroup","aria-label":h(o)("Continue in")},[(_(),F(ot,null,Zt(r,l=>w("button",{key:l.value,class:at(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:d=>a(l.value)},[(_(),Qe(Af(l.icon),{class:"runtime-toggle-option-icon"})),w("span",y1,D(l.label),1)],10,g1)),64))],8,v1))}}),b1=It(w1,[["__scopeId","data-v-4d282f1a"]]),T1={},S1={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 C1(e,t){return _(),F("svg",S1,[...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 ry=It(T1,[["render",C1]]),x1={},k1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function I1(e,t){return _(),F("svg",k1,[...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 A1=It(x1,[["render",I1]]),_1={class:"sidebar-thread-controls"},P1=["aria-label","title"],R1=["aria-label","title"],E1=hn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=da();return(n,o)=>(_(),F("div",_1,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?h(t)("Expand sidebar"):h(t)("Collapse sidebar"),title:e.isSidebarCollapsed?h(t)("Expand sidebar"):h(t)("Collapse sidebar"),onClick:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(_(),Qe(A1,{key:0,class:"sidebar-thread-controls-icon"})):(_(),Qe(ry,{key:1,class:"sidebar-thread-controls-icon"}))],8,P1),_o(n.$slots,"default",{},void 0),e.showNewThreadButton?(_(),F("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":h(t)("Start new thread"),title:h(t)("Start new thread"),onClick:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Oe(Zi,{class:"sidebar-thread-controls-icon"})],8,R1)):ye("",!0)]))}}),Mm=It(E1,[["__scopeId","data-v-39c4ec05"]]),M1={},j1={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function L1(e,t){return _(),F("svg",j1,[...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 jm=It(M1,[["render",L1]]),N1={},$1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function O1(e,t){return _(),F("svg",$1,[...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 D1=It(N1,[["render",O1]]),F1={},B1={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function U1(e,t){return _(),F("svg",B1,[...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 z1=It(F1,[["render",U1]]),H1={},q1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function W1(e,t){return _(),F("svg",q1,[...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 Lm=It(H1,[["render",W1]]);function ay(e){var r;const t=e.replace(/\r\n/g,`
|
|
62
|
-
`).trim();if(!t)return null;const n=[],o=[];for(const a of t.split(`
|
|
63
|
-
`)){const s=a.trim();if(!s){n.length===0&&o.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let d="pending";l==="x"&&(d="completed"),(l==="~"||l===">"||l==="-")&&(d="inProgress"),n.push({step:((r=i[2])==null?void 0:r.trim())??"",status:d});continue}o.push(s)}if(n.length===0){const a=G1(t);return a||null}return{explanation:o.join(`
|
|
64
|
-
`).trim(),steps:n.filter(a=>a.step.length>0)}}function G1(e){var a,s;const t=[],n=[],o=[];for(const i of e.split(`
|
|
65
|
-
`)){const l=i.trim();if(!l){t.length===0&&n.length===0&&o.push("");continue}const d=l.match(/^\d+[.)]\s+(.+)$/);if(d){t.push({step:((a=d[1])==null?void 0:a.trim())??"",status:"pending"});continue}const c=l.match(/^[-*]\s+(.+)$/);if(c){n.push({step:((s=c[1])==null?void 0:s.trim())??"",status:"pending"});continue}o.push(l)}const r=t.length>0?t:n;return r.length===0?null:{explanation:V1(o.join(`
|
|
66
|
-
`)),steps:r.filter(i=>i.step.length>0)}}function V1(e){return e.split(`
|
|
67
|
-
`).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
|
|
68
|
-
`).trim()}function Nm(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}:ay(e.text)}const Is="__new-thread__",sy="__new-thread-provider__::";function iy(e){return e==="plan"?"plan":"default"}function el(e){return typeof e=="string"?e.trim():""}function Mr(){return Object.create(null)}function Lu(e){const t=Mr();for(const[n,o]of Object.entries(e))t[n]=o;return t}function $l(e,t){if(!(t in e))return e;const n=Mr();for(const[o,r]of Object.entries(e))o!==t&&(n[o]=r);return n}function ly(e,t){let n=!1;const o=Mr();for(const[r,a]of Object.entries(e)){if(r===Is||r.startsWith(sy)||t.has(r)){o[r]=a;continue}n=!0}return n?o:e}function ms(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function K1(e){return e===Is}function xu(e){const t=ms(e);return t?`${sy}${t}`:""}function di(e){return e.trim()||Is}function $m(e,t){const n=di(t),o=el(e[n]);return o||el(e[Is])}function Ad(e,t){const n=di(t);return iy(e[n])}function Om(e,t,n){const o=di(t);if(K1(o))return $l(e,o);if(n==="plan"){const r=Lu(e);return r[o]="plan",r}return $l(e,o)}function Y1(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Yn(e){return e.flatMap(t=>t.threads)}function J1(e,t){var o,r;const n=e.findIndex(a=>a.id===t);return n<0?"":((o=e[n+1])==null?void 0:o.id)??((r=e[n-1])==null?void 0:r.id)??""}function uy(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function Q1(e){if(e instanceof Nr&&e.status===404)return!0;const t=e instanceof Error?e.message:String(e??"");return/\b404\b|thread.*not found|conversation.*not found|no such thread|no rollout found for thread id/i.test(t)}function X1(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),o=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(o)?!1:n>o}function Z1(e,t,n){return X1(e,t??n)}function cy(e,t,n){return Math.min(Math.max(e,t),n)}function Li(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 Dm(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Li(t.totalTokens)??0,inputTokens:Li(t.inputTokens)??0,cachedInputTokens:Li(t.cachedInputTokens)??0,outputTokens:Li(t.outputTokens)??0,reasoningOutputTokens:Li(t.reasoningOutputTokens)??0}}function ej(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Dm(t.total),o=Dm(t.last);if(!n||!o)return null;const r=Li(t.modelContextWindow),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?cy(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function Ni(e,t){const n=[];for(const o of e)n.includes(o)||n.push(o);for(const o of t)n.includes(o.projectName)||n.push(o.projectName);return Oa(e,n)?e:n}function of(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>n.get(r)??null).filter(r=>r!==null);for(const r of e)t.includes(r.projectName)||o.push(r);return o}function Oa(e,t){const n=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1)if(n[r]!==o[r])return!1;return!0}function tj(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const o=[...e],[r]=o.splice(t,1);return o.splice(n,0,r),o}function nj(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function oj(e=[],t=[]){var n,o,r,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((o=t[s])==null?void 0:o.step)||((r=e[s])==null?void 0:r.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function rj(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&oj(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 rf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Oa(e.images,t.images)&&aj(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&nj(e.commandExecution,t.commandExecution)&&rj(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 Fm(e,t,n={}){const o=new Map(e.map(c=>[c.id,c])),r=new Map(t.map(c=>[c.id,c])),a=t.map(c=>{const v=o.get(c.id);return v&&rf(v,c)?v:c});if(n.preserveMissing!==!0)return tl(e,a)?e:a;const s=e.map(c=>{const v=r.get(c.id);return!v||rf(c,v)?c:v}).filter(c=>!Wf(c)||!ij(c,t)),i=new Set(e.map(c=>c.id)),l=a.filter(c=>!i.has(c.id)),d=[...s,...l];return tl(e,d)?e:d}function aj(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const o=e[n],r=t[n];if(o.path!==r.path||o.operation!==r.operation||o.movedToPath!==r.movedToPath||o.diff!==r.diff||o.addedLineCount!==r.addedLineCount||o.removedLineCount!==r.removedLineCount)return!1}return!0}function Ua(e){return e.replace(/\s+/gu," ").trim()}function Wf(e){return e.messageType==="userMessage.optimistic"}function sj(e){return e.some(Wf)}function ij(e,t){if(e.role!=="user")return!1;const n=Ua(e.text),o=Array.isArray(e.images)?e.images:[],r=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||s.role!=="user"||Wf(s))return!1;const i=Ua(s.text),l=Array.isArray(s.images)?s.images:[],d=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,c=Array.isArray(s.skills)?s.skills.length:0;return i===n&&Oa(l,o)&&d===r&&c===a})}function lj(e){const t=[];let n=new Map;for(const o of e){if(!(o.role==="assistant"&&typeof o.messageType=="string"&&(o.messageType==="agentMessage"||o.messageType==="agentMessage.live"))){o.role==="user"&&(n=new Map),t.push(o);continue}const a=Ua(o.text);if(a.length===0){t.push(o);continue}const s=n.get(a);if(typeof s=="number"){t.splice(s,1);for(const[i,l]of n)l>s&&n.set(i,l-1);n.set(a,t.length),t.push(o)}else n.set(a,t.length),t.push(o)}return t}function uj(e,t){const n=new Set(t.map(a=>a.id)),o=new Set(t.filter(a=>a.role==="assistant").map(a=>Ua(a.text)).filter(a=>a.length>0));if(o.size===0)return e;const r=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Ua(a.text);return s.length===0?!1:!o.has(s)});return r.length===e.length?e:r}function wc(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const o=e[n];if(rf(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const Gf="worked";function Ts(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function cj(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];n>0&&a.push(`${n}h`),(o>0||n>0)&&a.push(`${o}m`);const s=r>0||a.length===0?r:0;return a.push(`${s}s`),a.join(" ")}function dj(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function fj(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 dy(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${cj(e.durationMs)}`,messageType:Gf,turnId:e.turnId,durationMs:e.durationMs}}function pj(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function hj(e,t){const n=dy(t),o=e.filter(s=>s.messageType!==Gf),r=pj(o);if(r<0)return[...o,n];const a=[...o];return a.splice(r,0,n),a}function mj(e,t){if(!t)return e;const n=new Set;for(const r of e)r.messageType===Gf&&r.turnId&&n.add(r.turnId);const o=[];for(const[r,a]of Object.entries(t))!r||n.has(r)||typeof a!="number"||!Number.isFinite(a)||a<=0||(o.push(dy({turnId:r,durationMs:Math.round(a)})),n.add(r));return o.length===0?e:[...e,...o]}function yt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function vj(e,t){if(t.size===0)return e;let n=!1;const o={};for(const[r,a]of Object.entries(e)){if(t.has(r)){n=!0;continue}o[r]=a}return n?o:e}function gj(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 yj(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 wj(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 Xt(e,t){const n=Object.entries(e).filter(([o])=>t.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function fy(e,t){const n=t.trim();if(!n)return e;let o=!1;const r=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(o=!0),s.length>0?r.push(i?{...a,threads:s}:a):a.threads.length===0&&r.push(a)}return o?r:e}function Xu(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>{const a=n.get(r.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=r.threads.map(l=>{const d=s.get(l.id);return d&&gj(d,l)?d:l});return a&&a.projectName===r.projectName&&yj(a.threads,i)?a:{projectName:r.projectName,threads:i}});return wj(e,o)?e:o}function bj(e,t,n){const o=new Set(Yn(t).map(i=>i.id)),r=Yn(e).filter(i=>n[i.id]===!0&&!o.has(i.id));if(r.length===0)return t;const a=new Map(t.map(i=>[i.projectName,i])),s=t.map(i=>({projectName:i.projectName,threads:[...i.threads]}));for(const i of r){if(a.get(i.projectName)){const d=s.findIndex(c=>c.projectName===i.projectName);d>=0&&(s[d]={projectName:s[d].projectName,threads:[i,...s[d].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function fi(e){return nr(e)}function Tj(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function Sj(e){const t=e.label||nr(e.remotePath),n=Tj(e.hostId);return n?`${t} ${n}`:t}function py(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function bc(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(r=>r.id)),o=e.projectOrder.filter(r=>t.has(r)||n.has(r));for(const r of e.order)o.includes(r)||o.push(r);for(const r of n)o.includes(r)||o.push(r);return o}function af(e,t){const n=py(e);return bc(e).map(o=>{if(n.has(o))return o;const r=Xe(o).trim(),a=fi(r);return t.has(a)?r:a})}function Nu(e,t){return Xe(e).trim()===t||fi(e)===t}function Cj(e,t){const n=new Set;for(const o of e.order)Nu(o,t)&&n.add(o);for(const o of e.active)Nu(o,t)&&n.add(o);for(const o of Object.keys(e.labels))Nu(o,t)&&n.add(o);return n}function xj(e,t,n){var d,c;const o=new Set((e.remoteProjects??[]).map(v=>v.id)),r=new Map;for(const v of e.order){const f=fi(v);r.has(f)||r.set(f,v)}for(const v of n){const f=((c=(d=v.threads[0])==null?void 0:d.cwd)==null?void 0:c.trim())??"";f&&r.set(v.projectName,f)}const a=[],s=v=>{v&&!a.includes(v)&&a.push(v)};for(const v of t){if(o.has(v)){s(v);continue}const f=r.get(v);f&&s(f)}for(const v of bc(e))s(v);const i=a.filter(v=>e.order.includes(v));for(const v of e.order)i.includes(v)||i.push(v);const l=e.active.filter(v=>i.includes(v));return l.length===0&&i.length>0&&l.push(i[0]),{order:i,active:l,projectOrder:a}}function kj(e,t,n){const o=af(t,n);if(o.length===0)return e;const r=new Map(o.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(uf(a)||uf(s))return 0;const i=r.get(a.projectName)??Number.POSITIVE_INFINITY,l=r.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function sf(e,t){const n=new Map,o=new Map,r=s=>{const i=Xe(s).trim();if(!i)return;const l=nr(i),d=n.get(l)??new Set;d.add(i),n.set(l,d)};for(const s of(t==null?void 0:t.order)??[]){const i=Xe(s).trim();if(!i)continue;const l=nr(i);Zu(i)||o.set(l,(o.get(l)??0)+1),r(s)}for(const s of e)for(const i of s.threads){const l=Xe(i.cwd).trim(),d=nr(l),c=(t==null?void 0:t.order.some(v=>Xe(v).trim()===l))===!0;Zu(l)&&!c&&o.get(d)===1||r(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function Zu(e){return e.includes("/.codex/worktrees/")}function Ij(e,t){const n=sf(e,t);if(n.size===0)return e;const o=new Set,r=new Set,a=new Map,s=new Set;for(const d of(t==null?void 0:t.order)??[]){const c=Xe(d).trim();if(!c||(s.add(c),Zu(c)))continue;const v=nr(c);o.has(v)?(o.delete(v),r.add(v),a.delete(v)):r.has(v)||(o.add(v),a.set(v,c))}const i=[],l=new Map;for(const d of e)for(const c of d.threads){const v=Xe(c.cwd).trim(),f=nr(v),g=s.has(v),S=Zu(v)&&!g&&o.has(f);let P=d.projectName;S&&n.has(f)?P=a.get(f)??d.projectName:v&&n.has(f)&&(P=v);const B=c.projectName===P?c:{...c,projectName:P},L=l.get(P);if(L)L.threads.push(B);else{const j={projectName:P,threads:[B]};l.set(P,j),i.push(j)}}return i}function Aj(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const o=new Set(e.map(s=>s.projectName)),r=[...e],a=py(t);for(const s of bc(t)){if(a.has(s)){if(o.has(s))continue;r.push({projectName:s,threads:[]}),o.add(s);continue}const i=Xe(s).trim();if(!i)continue;const l=fi(i),d=n.has(l)?i:l;o.has(d)||(r.push({projectName:d,threads:[]}),o.add(d))}return r}const lf=20;function ys(e){const t=e.split(`
|
|
69
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,lf):"Untitled thread"}function _j(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function uf(e){return e.threads.some(t=>t.cwd.trim().length===0||Ku(t.cwd))}const xs=new Map;let $u=0;function _d(e,t){const n=`${e}:${t.id}`,o=xs.get(n);return o!==void 0?o:($u+=1,xs.set(n,$u),$u)}function Pj(e){const t=`${e}:`;for(const n of[...xs.keys()])n.startsWith(t)&&xs.delete(n)}function Rj(){xs.clear(),$u=0}function Ej(e){if(xs.size!==0)for(const t of[...xs.keys()]){const n=t.indexOf(":"),o=n>0?t.slice(0,n):"";e.has(o)||xs.delete(t)}}function Bm(e,t){const n=t.trim();if(!n)return-1;const o=e.findIndex(i=>i.id===n);if(o>=0)return o;const r=`session-cmd-${n}`,a=e.findIndex(i=>i.id===r);if(a>=0)return a;const s="session-cmd-";if(n.startsWith(s)){const i=e.findIndex(l=>l.id===n.slice(s.length));if(i>=0)return i}return-1}function Mj(e,t){var a,s;if(t.length===0)return e;const n=[...e],o=[],r=new Map;for(const i of t){const l=((a=i.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(l&&Bm(n,l)>=0)continue;const d=i.turnIndex;if(typeof d!="number"||!Number.isFinite(d))continue;const c=r.get(d)??[];c.push(i),r.set(d,c)}for(const i of[...t].reverse()){const l=((s=i.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(l){const S=Bm(n,l);if(S>=0){n.splice(S+1,0,i);continue}}const d=i.turnIndex;if(typeof d!="number"||!Number.isFinite(d)){o.push(i);continue}let c=-1,v=-1;const f=[];for(let S=0;S<n.length;S+=1)n[S].turnIndex===d&&(v=S,n[S].role==="user"?c=S:n[S].messageType!=="reasoning"&&f.push(S));if(f.some(S=>{const P=n[S].messageType;return P==="commandExecution"||P==="toolCall"||P==="fileChange"||P==="worked"})){const P=(r.get(d)??[]).indexOf(i),B=P>=0?P:0;n.splice(f[Math.min(B,f.length-1)]+1,0,i)}else if(c>=0)n.splice(c+1,0,i);else if(v>=0)n.splice(v+1,0,i);else continue}return o.length>0?[...n,...o.reverse()]:n}function jj(e,t,n){const o=new Set(n.map(s=>s.id)),r=new Map;for(const s of t)for(const i of s)o.has(i.id)||r.has(i.id)||r.set(i.id,i);const a=Array.from(r.values());for(const s of a)_d(e,s);return a.sort((s,i)=>_d(e,s)-_d(e,i))}function Lj(e,t,n,o,r){const a=jj(e,o,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const g=t[f];g.role!=="user"||!Number.isInteger(g.turnIndex)||g.turnIndex<0||(i!==void 0&&s.set(i,f),i=g.turnIndex)}i!==void 0&&s.set(i,t.length);const l=new Map,d=[];for(const f of a){const g=f.turnIndex,S=Number.isInteger(g)&&g>=0?s.get(g):void 0;if(S===void 0){d.push(f);continue}const P=l.get(S);P?P.push(f):l.set(S,[f])}const c=[];for(let f=0;f<=t.length;f+=1)c.push(...l.get(f)??[]),f<t.length&&c.push(t[f]);c.push(...d);const v=lj(c);return[...Mj(v,n),...r]}const hy="codex-web-local.thread-read-state.v1",Um="codex-web-local.thread-unread-cutoff.v1",my="codex-web-local.thread-token-usage.v1",vy="codex-web-local.thread-reasoning.v1",cf="codex-web-local.thread-turn-durations.v1",gy="codex-web-local.thread-last-plan.v1",yy="codex-web-local.live-reasoning-snapshot.v1",wy="codex-web-local.thread-terminal-open.v1",df="codex-web-local.selected-thread-id.v1",ff="codex-web-local.selected-model-by-context.v1",by="codex-web-local.selected-model-id.v1",Ty="codex-web-local.project-order.v1",Sy="codex-web-local.project-display-name.v1",pf="codex-web-local.collaboration-mode-by-context.v1",Nj="codex-web-local.collaboration-mode.v1";function $j(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(hy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function zm(e){typeof window>"u"||window.localStorage.setItem(hy,JSON.stringify(e))}function Oj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(vy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Pd(e){if(!(typeof window>"u")){try{window.localStorage.setItem(vy,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&tI(t,n)}}function Dj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(cf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!r||typeof r!="object"||Array.isArray(r))continue;const a={};for(const[s,i]of Object.entries(r))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[o]=a)}return n}catch{return{}}}function Hm(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(cf):window.localStorage.setItem(cf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))if(t)for(const[o,r]of Object.entries(n))!o||typeof r!="number"||r<=0||oI(t,o,r)}}function Fj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(gy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Cy(e){if(!(typeof window>"u"))try{window.localStorage.setItem(gy,JSON.stringify(e))}catch{}}function Bj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(yy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=r;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[o]={text:a.text,ts:a.ts})}return n}catch{return{}}}function Uj(){if(typeof window>"u")return"";const e=window.localStorage.getItem(Um);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(Um,t),t}function zj(){if(typeof window>"u")return Mr();try{const n=window.localStorage.getItem(ff);if(n){const o=JSON.parse(n);if(!o||typeof o!="object"||Array.isArray(o))return Mr();const r=Mr();for(const[a,s]of Object.entries(o)){if(typeof a!="string"||a.length===0)continue;const i=el(s);i&&(r[a]=i)}return r}}catch{}const e=el(window.localStorage.getItem(by)),t=Mr();return e&&(t[Is]=e),t}function Iu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(ff):window.localStorage.setItem(ff,JSON.stringify(e)),window.localStorage.removeItem(by)}catch{}}function Hj(){if(typeof window>"u")return Mr();try{const e=window.localStorage.getItem(pf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Mr();const n=Mr();for(const[o,r]of Object.entries(t)){if(typeof o!="string"||o.length===0)continue;const a=iy(r);a==="plan"&&(n[o]=a)}return n}}catch{}return Mr()}function Rd(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(pf):window.localStorage.setItem(pf,JSON.stringify(e)),window.localStorage.removeItem(Nj)}catch{}}function qj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(my);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o)continue;const a=ej(r);a&&(n[o]=a)}return n}catch{return{}}}function qm(e){typeof window>"u"||window.localStorage.setItem(my,JSON.stringify(e))}function Wj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(wy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t))o&&typeof r=="boolean"&&(n[o]=r);return n}catch{return{}}}function Gj(e){typeof window>"u"||window.localStorage.setItem(wy,JSON.stringify(e))}function Vj(){return typeof window>"u"?"":window.localStorage.getItem(df)??""}function Kj(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(df);return}window.localStorage.setItem(df,e)}}function Yj(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ty);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const o of t){if(typeof o!="string"||o.length===0)continue;const r=nr(o);r.length>0&&!n.includes(r)&&n.push(r)}return n}catch{return[]}}function Jj(e){typeof window>"u"||window.localStorage.setItem(Ty,JSON.stringify(e))}function Qj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Sy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=typeof o=="string"?nr(o):"";a.length>0&&typeof r=="string"&&(n[a]=r)}return n}catch{return{}}}function Xj(e){typeof window>"u"||window.localStorage.setItem(Sy,JSON.stringify(e))}function Zj(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function eL(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const o of e.steps){const r=o.status==="completed"?"x":o.status==="inProgress"?"~":" ";t.push(`- [${r}] ${o.step}`)}return t.join(`
|
|
70
|
-
`).trim()}function qe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Me(e){return typeof e=="string"?e:""}function Ss(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Wm(e){const t=qe(e);if(!t)return null;const n=Ss(t.totalTokens??t.total_tokens),o=Ss(t.inputTokens??t.input_tokens),r=Ss(t.cachedInputTokens??t.cached_input_tokens),a=Ss(t.outputTokens??t.output_tokens),s=Ss(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||o===null||r===null||a===null||s===null?null:{totalTokens:n,inputTokens:o,cachedInputTokens:r,outputTokens:a,reasoningOutputTokens:s}}function tL(e){const t=qe(e);if(!t)return null;const n=Wm(t.total),o=Wm(t.last);if(!n||!o)return null;const r=Ss(t.modelContextWindow??t.model_context_window),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?cy(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function nL(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=qe(e.params),n=Ln(e),o=tL((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!o?null:{threadId:n,usage:o}}function Ln(e){const t=qe(e.params);if(!t)return"";const n=Me(t.threadId);if(n)return n;const o=Me(t.thread_id);if(o)return o;const r=Me(t.conversationId);if(r)return r;const a=Me(t.conversation_id);if(a)return a;const s=qe(t.thread),i=Me(s==null?void 0:s.id);if(i)return i;const l=qe(t.turn),d=Me(l==null?void 0:l.threadId);if(d)return d;const c=Me(l==null?void 0:l.thread_id);return c||""}function oL(e){if(e.method!=="turn/completed")return"";const t=qe(e.params),n=qe(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const o=qe(n.error);return Me(o==null?void 0:o.message)}function rL(e){var o;if(e.method!=="error")return null;const t=qe(e.params),n=Me(t==null?void 0:t.message)||Me((o=qe(t==null?void 0:t.error))==null?void 0:o.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function aL(e){const t=Ln(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=qe(e.params),o=qe(n==null?void 0:n.item),r=Me(o==null?void 0:o.type).toLowerCase();if(r==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(r==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(r==="commandexecution"){const a=Me(o==null?void 0:o.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(r==="filechange"){const s=(Array.isArray(o==null?void 0:o.changes)?o.changes:[])[0],i=Me(s==null?void 0:s.path);return{threadId:t,activity:{label:"Applying changes",details:i?[i]:[]}}}}return e.method==="item/commandExecution/outputDelta"?{threadId:t,activity:{label:"Running command",details:[]}}:e.method==="item/fileChange/outputDelta"?{threadId:t,activity:{label:"Applying changes",details:[]}}:e.method==="item/reasoning/summaryTextDelta"||e.method==="item/reasoning/summaryPartAdded"||e.method==="item/reasoning/textDelta"?{threadId:t,activity:{label:"Thinking",details:[]}}:e.method==="item/agentMessage/delta"?{threadId:t,activity:{label:"Writing response",details:[]}}:null}function sL(e){if(e.method!=="turn/started")return null;const t=qe(e.params);if(!t)return null;const n=Ln(e);if(!n)return null;const o=qe(t.turn),r=Me(o==null?void 0:o.id)||Me(t.turnId)||`${n}:unknown`;if(!r)return null;const a=Ts(Me(o==null?void 0:o.startedAt))??Ts(Me(t.startedAt))??Ts(e.atIso)??Date.now();return{threadId:n,turnId:r,startedAtMs:a}}function iL(e){if(e.method!=="turn/completed")return null;const t=qe(e.params);if(!t)return null;const n=Ln(e);if(!n)return null;const o=qe(t.turn),r=Me(o==null?void 0:o.id)||Me(t.turnId)||`${n}:unknown`;if(!r)return null;const a=Ts(Me(o==null?void 0:o.completedAt))??Ts(Me(t.completedAt))??Ts(e.atIso)??Date.now(),s=Ts(Me(o==null?void 0:o.startedAt))??Ts(Me(t.startedAt))??void 0;return{threadId:n,turnId:r,completedAtMs:a,startedAtMs:s}}function ec(e){return`${e}:live-reasoning`}function lL(e){const t=qe(e.params);if(!t)return"";if(e.method==="item/started"){const n=qe(t.item);return!n||n.type!=="reasoning"?"":Me(n.id)}return""}function uL(e){const t=qe(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{messageId:ec(n),itemId:n,delta:o}}if(e.method==="item/reasoning/textDelta"){const n=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{messageId:ec(n),itemId:n,delta:o}}return null}function cL(e){const t=qe(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Me(t.itemId);return n?ec(n):""}return""}function dL(e){const t=qe(e.params);if(!t)return"";if(e.method==="item/completed"){const n=qe(t.item);return!n||n.type!=="reasoning"?"":ec(Me(n.id))}return""}function fL(e){var n;const t=[];for(const o of["content","summary"]){const r=Array.isArray(e[o])?e[o]:[];for(const a of r){const s=typeof a=="string"?a:(n=qe(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
|
|
71
|
-
`).trim()}function pL(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=qe(e.params),n=qe(t==null?void 0:t.item);if(!n||Me(n.type).toLowerCase()!=="reasoning")return null;const o=Me(n.id);return o?{itemId:o,text:fL(n)}:null}function hL(e){const t=qe(e.params);if(!t)return"";if(e.method==="item/started"){const n=qe(t.item);return!n||n.type!=="agentMessage"?"":Me(n.id)}return""}function mL(e){const t=qe(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Me(t.itemId),o=Me(t.delta);if(!n||!o)return null;const r=Me(t.turnId)||Me(t.turn_id);return{messageId:n,delta:o,turnId:r||void 0}}return null}function vL(e){const t=qe(e.params);if(!t)return null;if(e.method==="item/completed"){const n=qe(t.item);if(!n||n.type!=="agentMessage")return null;const o=Me(n.id),r=Me(n.text);if(!o||!r)return null;const a=Me(t.turnId)||Me(t.turn_id);return{id:o,role:"assistant",text:r,messageType:"agentMessage",turnId:a||void 0}}return null}function gL(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function yL(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 wL(e){if(e.method!=="item/completed")return null;const t=qe(e.params),n=qe(t==null?void 0:t.item);if(!n)return null;const o=Me(n.id);if(!o)return null;if(n.type==="imageView"){const s=Me(n.path);return s?{id:o,role:"assistant",text:"",images:[gL(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const r=Me(n.result),a=r?yL(r):"";return a?{id:o,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function bL(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=qe(e.params);if(!t)return null;const n=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{itemId:n,delta:o}}const Wi="__global__";function TL(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function xy(e){const t=qe(e);if(!t)return null;const n=t.id,o=Me(t.method),r=t.params;if(typeof n!="number"||!Number.isInteger(n)||!o)return null;const a=qe(r),s=SL(o,a),i=Me(a==null?void 0:a.threadId)||Me(a==null?void 0:a.thread_id)||Me(a==null?void 0:a.conversationId)||Me(a==null?void 0:a.conversation_id)||Wi,l=Me(a==null?void 0:a.turnId)||Me(a==null?void 0:a.turn_id),d=Me(a==null?void 0:a.itemId)||Me(a==null?void 0:a.item_id)||Me(a==null?void 0:a.callId)||Me(a==null?void 0:a.call_id),c=Me(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:d,receivedAtIso:c,params:r??null}}function SL(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||CL(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||xL(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||kL(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||AL(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||_L(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||IL(t)?"item/tool/call":n)}function CL(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 xL(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||qe(e.fileChanges)?!0:qe(e.changes)!==null:!1}function kL(e){return!!(e&&Array.isArray(e.questions))}function IL(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function AL(e){if(!e)return!1;const t=Me(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function _L(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&qe(e.permissions)!==null:!1}function PL(e){if(e.method!=="item/tool/requestUserInput")return[];const t=qe(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],o=[];for(const r of n){const a=qe(r),s=Me(a==null?void 0:a.id).trim();s&&o.push(s)}return o}function RL(e,t){const n=t.threadId||Wi,o=e.pendingServerRequestsByThreadId.value[n]??[],r=o.findIndex(s=>s.id===t.id),a=[...o];r>=0?a.splice(r,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function EL(e,t){const n={};for(const[o,r]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=r.filter(s=>s.id!==t);a.length>0&&(n[o]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=yt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function ML(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function jL(e,t){const n={},o=new Set;for(const a of t){const s=a.threadId||Wi,i=n[s]??[];i.push(a),n[s]=i,o.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const r={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))o.has(Number(a))&&(r[a]=s);e.pendingReplyErrorByRequestId.value=r}function ky(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];tl(o,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function LL(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=yt(e.liveAgentMessagesByThreadId.value,t))}function NL(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[];tl(o,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function $L(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},Cy(e.lastPlanByThreadId.value))}function OL(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[],r=wc(o,n);NL(e,t,r),$L(e,t,n)}function DL(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[],r=wc(o,n);Vf(e,t,r)}function FL(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];let r=wc(o,n);const a=Ua(n.text);if(n.role==="assistant"&&a.length>0){const s=r.filter(i=>i.id===n.id||Ua(i.text)!==a);s.length!==r.length&&(r=s)}ky(e,t,r)}function Vf(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[];tl(o,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function BL(e,t,n){const o=e.liveCommandsByThreadId.value[t]??[],r=wc(o,n);r!==o&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:r})}function UL(e,t,n){const o=e.liveCommandsByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(s=>s.id)),a=o.filter(s=>!r.has(s.id));a.length!==o.length&&(a.length===0?e.liveCommandsByThreadId.value=yt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function zL(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(l=>l.id)),a=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnId=="string"&&l.turnId.length>0).map(l=>l.turnId)),s=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnIndex=="number").map(l=>l.turnIndex)),i=o.filter(l=>!r.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==o.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=yt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function HL(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...r];s[a]={...s[a],fileChanges:o},Vf(e,t,s)}function qL(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...r],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:o}))},Vf(e,t,s)}function WL(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let o=-1;for(const r of n)typeof r.turnIndex=="number"&&Number.isFinite(r.turnIndex)&&(o=Math.max(o,r.turnIndex));return o+1}function GL(e,t,n,o){if(!t||!n||!Number.isInteger(o)||o<0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};r[n]!==o&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...r,[n]:o}})}function VL(e,t,n){const o=e.turnIndexByTurnIdByThreadId.value[t]??{},r=Object.entries(o),a=Object.entries(n);r.length===a.length&&r.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function KL(e,t,n){var r;if(!t||!n)return;const o=(r=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:r[n];return typeof o=="number"?o:void 0}function YL(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};let r=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=o[s.turnId];return typeof i!="number"?s:(r=!0,{...s,turnIndex:i})});r&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const Gm=8e3,JL=1500,QL=15*60*1e3;function XL(e){let t=Bj(),n=!1,o=null;function r(){o===null&&(o=setTimeout(()=>{if(o=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(yy,JSON.stringify(t))}catch{}n&&r()},JL))}function a(c,v){if(!c||e.inProgressById.value[c]!==!0)return;const f=v.length>Gm?v.slice(-Gm):v;t[c]={text:f,ts:Date.now()},n=!0,r()}function s(c,v){if(!c)return;const f=v.trim(),g=e.liveReasoningTextByThreadId.value[c]??"";if(f.length===0){if(!g)return;e.liveReasoningTextByThreadId.value=yt(e.liveReasoningTextByThreadId.value,c);return}g!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[c]:f},a(c,f))}function i(c,v){if(!c)return;const f=e.liveReasoningTextByThreadId.value[c]??"";s(c,`${f}${v}`)}function l(c){var g;if(!c||((g=e.liveReasoningTextByThreadId.value[c])==null?void 0:g.trim()))return;const f=t[c];f!=null&&f.text&&(Date.now()-f.ts>QL||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[c]:f.text}))}function d(c){c&&c in t&&(delete t[c],n=!0,r())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:d}}function ZL(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function eN(e,t,n=!1){var l;if(!t)return;const o=e.liveReasoningTextByThreadId.value[t];if(o===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const r=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=r?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[r]:void 0,s=aN(e,t),i=r||void 0;s.length>0?nN(e,t,s,i,a):n||tN(e,t,o,i,a),e.liveReasoningTextByThreadId.value=yt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function tN(e,t,n,o,r){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(d=>d.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function nN(e,t,n,o,r){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const d=l.text.trim();if(!d)continue;const c=`reasoning:item:${t}:${l.itemId}`,v=s.findIndex(f=>f.id===c);if(v>=0){const f=s[v],g=l.anchorMessageId||f.reasoningAnchorMessageId,S=typeof r=="number"?r:f.turnIndex;if(f.text===d&&f.turnIndex===S&&f.reasoningAnchorMessageId===g)continue;s[v]={...f,text:d,reasoning:{summary:[],content:[d]},turnId:o||f.turnId,turnIndex:S,reasoningAnchorMessageId:g};continue}s.some(f=>f.text===d)||s.push({id:c,role:"system",text:d,messageType:"reasoning",reasoning:{summary:[],content:[d]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0,reasoningAnchorMessageId:l.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function oN(e,t,n,o){if(!t||!o)return;o.trim()&&e.reasoningItemTextByItemId.set(n,o.trim());const r=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(r.endsWith(o)||a&&o===a){e.reasoningAppendedTextByItemId.set(n,o);return}if(a&&o.startsWith(a)){const i=o.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,o);return}const s=r.length>0&&!r.endsWith(`
|
|
72
|
-
`)?`
|
|
73
|
-
|
|
74
|
-
`:"";e.appendLiveReasoningText(t,`${s}${o}`),e.reasoningAppendedTextByItemId.set(n,o)}function rN(e,t){const n=qe(t.params);if(!n)return;const o=t.method==="item/started"||t.method==="item/completed",r=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!o&&!r)return;const a=qe(n.item),s=Me(r?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Ln(t);if(!i)return;const l=r||Me(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",d=e.turnItemSequenceByThreadId.get(i)??[];d.some(c=>c.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...d,{itemId:s,kind:l}])}function aN(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],o=[];let r="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&o.push({text:i,anchorMessageId:r,itemId:s.itemId})}else r=s.itemId;return o}function sN(e,t,n){if(!t||!n)return;const o=e.reasoningItemTextByItemId.get(t)??"";o.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${o}${n}`)}function Vm(e){e.reasoningItemTextByItemId.clear()}const Pr="gpt-5.4-mini",Iy="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",iN="big-pickle",lN=jg;function uN(e){const t=T([]),n=T({}),o=T({}),r=T(zj()),a=T($m(r.value,e.selectedThreadId.value)),s=T("medium"),i=T("standard"),l=T(""),d=T(""),c=T(!1),v=T({});let f=!1;function g(te){if(di(te)===Is){const Le=ms(l.value),Pe=xu(Le),Fe=Pe?el(r.value[Pe]):"";if(Fe)return Fe}return $m(r.value,te).trim()}function S(te){const ce=te.trim();return ms(ce?v.value[ce]??l.value:l.value)}function P(te){return n.value[te.trim()]??lN}function B(te,ce=s.value){const Le=te.trim(),Pe=P(Le);if(ce&&Pe.includes(ce))return ce;if(Pe.includes("medium"))return"medium";const Fe=o.value[Le];return Fe&&Pe.includes(Fe)?Fe:Pe[0]??""}function L(te){s.value=B(te)}function j(te){const ce={},Le={};for(const Pe of te)Pe.supportedReasoningEfforts!==null&&(ce[Pe.id]=[...Pe.supportedReasoningEfforts]),Pe.defaultReasoningEffort&&(Le[Pe.id]=Pe.defaultReasoningEffort);n.value=ce,o.value=Le}function U(...te){const ce=[...t.value];for(const Le of te){const Pe=Le.trim();Pe&&!ce.includes(Pe)&&ce.push(Pe)}Oa(t.value,ce)||(t.value=ce)}function H(te){const ce=te.trim();return t.value.length===0||ce&&t.value.includes(ce)?ce:t.value[0]??""}function he(te,ce){const Le=ce.trim(),Pe=di(te),Fe=ms(l.value),Ke=Pe===Is?xu(Fe):"",lt=Ke||Pe;if(Le){const Ze=Lu(r.value);Ze[lt]=Le,Ke&&delete Ze[Pe],r.value=Ze}else{let Ze=$l(r.value,lt);Ke&&(Ze=$l(Ze,Pe)),r.value=Ze}Pe===di(e.selectedThreadId.value)?(a.value=g(e.selectedThreadId.value),U(a.value),L(a.value)):U(Le),Iu(r.value)}function de(te){he(e.selectedThreadId.value,te)}function W(te,ce){const Le=te.trim();if(!Le)return;const Pe=ce.trim();if(Pe){const Fe=Lu(r.value);Fe[Le]=Pe,r.value=Fe}else r.value=$l(r.value,Le);U(Pe),e.selectedThreadId.value===Le&&(a.value=g(e.selectedThreadId.value),L(a.value)),Iu(r.value)}function ve(te,ce){const Le=te.trim();if(!Le)return;const Pe=ms(ce);Pe?v.value={...v.value,[Le]:Pe}:v.value[Le]&&(v.value=yt(v.value,Le))}function Se(te,ce,Le){const Pe=ce.trim();if(ms(Le)!=="opencode-zen")return Pe;const Ke=g(te).trim();return Ke&&!/^gpt-/i.test(Ke)?Ke:Pe&&!/^gpt-/i.test(Pe)?Pe:iN}async function Ae(te=e.selectedThreadId.value){te.trim()?W(te,Pr):de(Pr),U(Pr)}function pe(te){te&&!P(a.value).includes(te)||(f=!0,s.value=te)}async function Q(te){const ce=te==="fast"?"fast":"standard";if(c.value||i.value===ce)return;const Le=i.value;i.value=ce,c.value=!0,e.error.value="";try{await Pk(ce)}catch(Pe){i.value=Le,e.error.value=Pe instanceof Error?Pe.message:"Failed to update Fast mode"}finally{c.value=!1}}function me(te,ce,Le){const Pe=te.trim()||"default",Fe=ce||"default",Ke=Le==="plan"?"Plan":"Default",lt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Ke}`,`Model: ${Pe}`,`Thinking: ${Fe}`,`Speed: ${lt}`]}async function ne(te){d.value="";try{const ce=await jk(),Le=ce.model.trim(),Pe=ms(ce.providerId);l.value=Pe;const Fe=S(e.selectedThreadId.value),Ke=Fe!=="codex"&&Fe!=="custom",lt=g(e.selectedThreadId.value),Ze=await Mk({includeProviderModels:Ke||(te==null?void 0:te.includeProviderModels)!==!1,requireProviderModels:Ke,providerId:Ke?Fe:void 0}),ut=Ze.map(Ee=>Ee.id);j(Ze);const fe=xu(Fe),N=fe?el(r.value[fe]):"",oe=[...ut];!(te!=null&&te.providerChanged)&&Ke&&Fe===Pe&&Le&&!oe.includes(Le)&&oe.push(Le),t.value=oe;const le=lt&&ut.includes(lt);if(!lt||!le||te!=null&&te.providerChanged?te!=null&&te.providerChanged&&oe.length>0?N&&ut.includes(N)?de(N):Fe===Pe&&Le&&oe.includes(Le)?de(Le):de(oe[0]):Fe===Pe&&Le&&oe.includes(Le)?de(ce.model):oe.length>0?de(oe[0]):de(""):a.value.trim()!==lt&&de(lt),fe&&a.value.trim().length>0){const Ee=Lu(r.value);Ee[fe]=a.value.trim();const Be=xu(Pe);Be&&Be!==fe&&Le&&(Ee[Be]=Le),r.value=Ee,Iu(r.value)}s.value=B(a.value,f?s.value:"medium"),i.value=ce.speedMode}catch(ce){d.value=uy(ce)?Iy:""}}function ke(te){a.value=H(g(te)),L(a.value)}function $e(te){const ce=ly(r.value,te);ce!==r.value&&(r.value=ce,ke(e.selectedThreadId.value),Iu(ce)),v.value=Xt(v.value,te)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:d,isUpdatingSpeedMode:c,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:Ae,buildPendingTurnDetails:me,pruneThreadModelState:$e,readModelIdForThread:g,refreshModelPreferences:ne,resolveThreadModelForProvider:Se,setSelectedModelId:de,setSelectedModelIdForThread:he,setSelectedReasoningEffort:pe,setThreadModelId:W,setThreadModelProviderId:ve,syncSelectedThreadModel:ke,updateSelectedSpeedMode:Q}}function cN(e){const t=T([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=T(Hj()),o=T(Ad(n.value,e.value));function r(d){const c=d==="plan"?"plan":"default",v=di(e.value);Ad(n.value,e.value)===c&&o.value===c||(o.value=c,n.value=Om(n.value,v,c),Rd(n.value))}function a(d,c){const v=c==="plan"?"plan":"default";n.value=Om(n.value,d,v),d.trim()===e.value&&(o.value=v),Rd(n.value)}function s(d){o.value=Ad(n.value,d)}function i(d){const c=ly(n.value,d);c!==n.value&&(n.value=c,s(e.value),Rd(c))}async function l(){try{const d=await Nk();t.value=d,d.some(c=>c.value===o.value)||r("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:o,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:r,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const dN=500;function fN(){const e=T(null),t=T([]),n=K(()=>e.value);let o=null,r=null;function a(d){e.value=d}async function s(){if(r){await r;return}r=(async()=>{try{const d=await CI();a(d),t.value=d?[d]:[]}catch{}finally{r=null}})(),await r}function i(){if(typeof window>"u"){s();return}o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null,s()},dN)}function l(){o===null||typeof window>"u"||(window.clearTimeout(o),o=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function pN(e){const t=T(Yj()),n=T(Qj());let o=null;function r(f,g={}){t.value=f,g.persist!==!1&&Jj(f)}function a(f,g={}){n.value=f,g.persist!==!1&&Xj(f)}async function s(f,g){try{const S=await $i(),P={...S.labels};let B=!1;for(const L of S.order){if(!Nu(L,f))continue;const j=g.trim();j.length===0?P[L]!==void 0&&(delete P[L],B=!0):P[L]!==j&&(P[L]=j,B=!0)}B&&await bd({order:S.order,labels:P,active:S.active,projectOrder:S.projectOrder})}catch{}}function i(f,g){f.length===0||(n.value[f]??"")===g||(a({...n.value,[f]:g}),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,s(f,g)},500))}async function l(){try{const f=await $i(),g=xj(f,t.value,e.sourceGroups.value);await bd({order:g.order,labels:f.labels,active:g.active,projectOrder:g.projectOrder})}catch{}}async function d(f){var L;if(f.length===0)return;const g=t.value.filter(j=>j!==f);if(Oa(t.value,g)||r(g),e.sourceGroups.value=e.sourceGroups.value.filter(j=>j.projectName!==f),n.value[f]!==void 0){const j={...n.value};delete j[f],a(j)}e.applyThreadFlags();const S=Yn(e.projectGroups.value);e.pruneThreadScopedState(S),S.some(j=>j.id===e.selectedThreadId.value)||e.setSelectedThreadId(((L=S[0])==null?void 0:L.id)??"");const B=new Set;try{const j=await $i();Cj(j,f).forEach(U=>{B.add(U)})}catch{}if(B.size>0)try{const j=await $i(),U=j.order.filter(de=>!B.has(de)),H=j.active.filter(de=>!B.has(de)),he=H.length===0&&U.length>0?[U[0]]:H;await bd({order:U,labels:vj(j.labels,B),active:he,projectOrder:j.projectOrder.filter(de=>de!==f&&!B.has(de))});return}catch{}await l()}function c(f,g){if(f.length===0||e.sourceGroups.value.length===0)return;const S=e.sourceGroups.value.map(U=>U.projectName),P=S.indexOf(f);if(P===-1)return;const B=Math.max(0,Math.min(g,S.length-1)),L=tj(S,P,B);if(L===S)return;r(Ni(L,e.sourceGroups.value));const j=of(e.sourceGroups.value,t.value);e.sourceGroups.value=Xu(e.sourceGroups.value,j),e.applyThreadFlags(),l()}function v(f){const g=f.trim();if(!g)return;const S=[g,...t.value.filter(B=>B!==g)];if(Oa(t.value,S))return;r(S);const P=of(e.sourceGroups.value,t.value);e.sourceGroups.value=Xu(e.sourceGroups.value,P),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:v,removeProject:d,renameProject:i,reorderProject:c,setProjectDisplayNames:a,setProjectOrder:r}}const hN=2e3;function mN(e){const t=T([]),n=T([]),o=T(!1);let r=null,a=null,s=!1,i=!1,l=0,d="";async function c(f={}){const g=e.getSelectedCwd().trim(),S=g||"__global__";if(r){await r;return}f.force!==!0&&s&&d===S&&Date.now()-l<hN||(r=(async()=>{try{t.value=await cI(g?[g]:void 0),s=!0,l=Date.now(),d=S}catch{}finally{r=null}})(),await r)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(o.value=!0,a=(async()=>{try{n.value=await Dk(),i=!0}catch{}finally{o.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:o,refreshHooks:v,refreshSkills:c}}const Ay="codex-web-local.stashed-messages.v1",_y="codex-web-local.auto-compact-threshold.v1",Au=10,vN=650;function gN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ay);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[o]=a)}return n}catch{return{}}}function yN(){if(typeof window>"u")return Au;try{const e=window.localStorage.getItem(_y);if(e===null)return Au;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Au}catch{return Au}}function wN(e){const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();!r||o.length===0||(t[r]=o.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function bN(e){const t=T({}),n=T({}),o=T(gN()),r=T(yN());let a=!1;const s=K(()=>{const W=e.value;if(!W)return[];const ve=t.value[W]??[];return[...(o.value[W]??[]).map(pe=>({...pe,awaitingCompaction:!0})),...ve]});function i(){typeof window>"u"||window.localStorage.setItem(Ay,JSON.stringify(o.value))}function l(){Yk(wN(t.value)).catch(()=>{})}async function d(){if(!a){a=!0;try{t.value=await cm()}catch{}}}async function c(W){if(n.value[W]!==!0){n.value={...n.value,[W]:!0};try{t.value=await cm()}catch{}finally{n.value=yt(n.value,W)}}}function v(W){c(W),!(typeof window>"u")&&window.setTimeout(()=>{c(W)},vN)}function f(W){const ve=Number.isFinite(W)&&W>0?Math.round(W):0;ve!==r.value&&(r.value=ve,!(typeof window>"u")&&window.localStorage.setItem(_y,String(ve)))}function g(W){return o.value[W]??[]}function S(W,ve){o.value={...o.value,[W]:[...g(W),ve]},i()}function P(W){const ve=[...g(W)];return ve.length===0||(o.value=yt(o.value,W),i()),ve}function B(W,ve,Se){const pe=[...t.value[W]??[]],Q=typeof Se=="number"?Math.max(0,Math.min(Se,pe.length)):pe.length;pe.splice(Q,0,ve),t.value={...t.value,[W]:pe},l()}function L(W,ve){return g(W).find(Se=>Se.id===ve)}function j(W,ve){var Se;return(Se=t.value[W])==null?void 0:Se.find(Ae=>Ae.id===ve)}function U(W){const ve=e.value;if(!ve)return;if(L(ve,W)){const pe=g(ve).filter(Q=>Q.id!==W);o.value=pe.length>0?{...o.value,[ve]:pe}:yt(o.value,ve),i();return}const Se=t.value[ve];if(!Se)return;const Ae=Se.filter(pe=>pe.id!==W);t.value=Ae.length>0?{...t.value,[ve]:Ae}:yt(t.value,ve),l()}function H(W,ve){const Se=e.value;if(!Se)return;const Ae=t.value[Se];if(!Ae||L(Se,W)||L(Se,ve))return;const pe=Ae.findIndex(ke=>ke.id===W),Q=Ae.findIndex(ke=>ke.id===ve);if(pe<0||Q<0||pe===Q)return;const me=[...Ae],[ne]=me.splice(pe,1);me.splice(Q,0,ne),t.value={...t.value,[Se]:me},l()}function he(W){const ve=Xt(t.value,W);ve!==t.value&&(t.value=ve,l())}function de(){t.value={},n.value={},o.value={},i(),l()}return{appendStashedMessage:S,autoCompactThreshold:r,clearQueueState:de,enqueueQueuedMessage:B,findQueuedMessage:j,findStashedMessage:L,getStashedMessages:g,loadPersistedQueueStateIfNeeded:d,processQueuedMessages:c,pruneQueueState:he,removeQueuedMessage:U,reorderQueuedMessage:H,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:P}}const TN=1e4,SN=2e3;function CN(e){const{selectedThreadId:t,projectGroups:n,inProgressById:o,applyThreadGroups:r,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:d}=e,c=T(!1),v=T(!1),f=T(!1);let g=null,S=0,P=null,B=null,L=!1,j=!1,U=[],H=null;function he(me,ne){if(me.length===0)return ne;if(ne.length===0)return me;const ke=new Map;for(const te of Yn(me))ke.set(te.id,te);for(const te of Yn(ne))ke.set(te.id,te);const $e=new Map;for(const te of ke.values()){const ce=$e.get(te.projectName);ce?ce.push(te):$e.set(te.projectName,[te])}return Array.from($e.entries()).map(([te,ce])=>({projectName:te,threads:ce.sort((Le,Pe)=>new Date(Pe.updatedAtIso).getTime()-new Date(Le.updatedAtIso).getTime())})).sort((te,ce)=>{var Fe,Ke;const Le=new Date(((Fe=te.threads[0])==null?void 0:Fe.updatedAtIso)??0).getTime();return new Date(((Ke=ce.threads[0])==null?void 0:Ke.updatedAtIso)??0).getTime()-Le})}function de(){return Object.values(o.value).some(me=>me===!0)}function W(me=H){if(!(!P||L||de())){if(H=me,typeof window>"u"){ve(me);return}B!==null&&window.clearTimeout(B),B=window.setTimeout(()=>{B=null,!(!P||de())&&ve(H)},TN)}}async function ve(me){if(!(L||!P||de())){L=!0;try{const ne=await Zh(P,Wk());P=ne.nextCursor,j=ne.nextCursor===null,f.value=j,U=he(U,ne.groups),r(U,me)}catch{}finally{L=!1,P&&!de()&&W(me)}}}async function Se(me={}){if(g){await g;return}me.force!==!0&&c.value&&Date.now()-S<SN||(g=(async()=>{var ne;c.value||(v.value=!0);try{const[ke,$e]=await Promise.all([Zh(),i(),s({force:me.force===!0})]);H=$e;const te=ke.groups;U=te,P=ke.nextCursor,j=ke.nextCursor===null,f.value=j,await a(te,$e),r(U,$e),c.value=!0,S=Date.now(),j||W($e);const ce=Yn(n.value);l(ce),!ce.some(Pe=>Pe.id===t.value)&&!t.value&&d(((ne=ce[0])==null?void 0:ne.id)??"")}finally{v.value=!1}})().finally(()=>{g=null}),await g)}function Ae(me){U=fy(U,me)}function pe(){return P!==null}function Q(){B!==null&&typeof window<"u"&&(window.clearTimeout(B),B=null)}return{dispose:Q,hasActiveInProgressThreads:de,hasLoadedThreads:c,hasRemainingThreadPages:pe,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:Se,removeThreadFromLoadedLists:Ae,scheduleRemainingThreadPages:W}}const Km=2e3;function xN(e){const t=T({}),n=T({}),o=T({}),r=T({}),a=T(!1),s=new Map,i=new Map,l=new Map;async function d(g,S={}){var H;if(!g)return;const P=Date.now()-(l.get(g)??0)<Km;if((H=e.turnErrorByThreadId.value[g])!=null&&H.transient&&(S.silent===!0||P))return;const B=s.get(g);if(B&&S.force!==!0){await B;return}const L=n.value[g]===!0,j=S.silent!==!0&&!L;j&&(a.value=!0);const U=(async()=>{try{const he=e.currentThreadVersion(g),de=t.value[g]??"",W=Date.now()-(i.get(g)??0)<Km;if(S.force===!0?!1:L&&(W||(he.length===0||de===he)&&e.inProgressById.value[g]!==!0)){e.markThreadAsRead(g);return}const Ae=e.resumedThreadById.value[g]!==!0?await Xd(g):null,pe=Ae??await Qd(g);pe.modelProvider&&e.setThreadModelProviderId(g,pe.modelProvider),pe.model&&e.setThreadModelId(g,e.resolveThreadModelForProvider(g,pe.model,pe.modelProvider)),Ae&&(e.resumedThreadById.value={...e.resumedThreadById.value,[g]:!0});const{messages:Q,inProgress:me,activeTurnId:ne,turnIndexByTurnId:ke}=pe;o.value={...o.value,[g]:pe.hasMoreOlder===!0},e.markThreadMessagesPersisted(g,Q),e.replaceTurnIndexLookupForThread(g,ke),e.rebindLiveFileChangeTurnIndices(g);const $e=e.persistedMessagesByThreadId.value[g]??[],te=Fm($e,Q,{preserveMissing:S.silent===!0||sj($e)});e.setPersistedMessagesForThread(g,te);const ce=e.liveAgentMessagesByThreadId.value[g]??[];if(me){const Le=uj(ce,Q);e.setLiveAgentMessagesForThread(g,Le)}else e.clearLiveAgentMessagesForThread(g);e.removeLiveCommandsPersistedIn(g,Q),e.removeLiveFileChangesPersistedIn(g,Q),n.value={...n.value,[g]:!0},i.set(g,Date.now()),l.delete(g),he&&(t.value={...t.value,[g]:he}),e.setThreadInProgress(g,me),pe.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[g]:pe.externalSession}),e.clearTransientTurnErrorForThread(g),ne?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[g]:ne}:e.activeTurnIdByThreadId.value[g]&&(e.activeTurnIdByThreadId.value=yt(e.activeTurnIdByThreadId.value,g)),me||e.clearCompletedTurnLiveState(g),e.markThreadAsRead(g)}catch(he){const de=he instanceof Error?he.message:"Unknown application error";throw e.selectedThreadId.value===g&&e.setTurnErrorForThread(g,de,{transient:!0}),l.set(g,Date.now()),he}finally{j&&(a.value=!1)}})().finally(()=>{s.delete(g)});s.set(g,U),await U}async function c(g=e.selectedThreadId.value){if(!g||r.value[g]===!0||o.value[g]!==!0)return;const S=e.getFirstPersistedTurnId(g);if(!S){o.value={...o.value,[g]:!1};return}r.value={...r.value,[g]:!0};try{const P=await bk(g,S),B=e.persistedMessagesByThreadId.value[g]??[],L=Fm(P.messages,B,{preserveMissing:!0});e.setPersistedMessagesForThread(g,L),e.replaceTurnIndexLookupForThread(g,{...e.turnIndexByTurnIdByThreadId.value[g]??{},...P.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(g),o.value={...o.value,[g]:P.hasMoreOlder}}catch(P){throw e.error.value=P instanceof Error?P.message:"Failed to load earlier messages",P}finally{r.value={...r.value,[g]:!1}}}async function v(g,S={}){var P;g&&n.value[g]!==!0&&(S.silent===!0&&((P=e.turnErrorByThreadId.value[g])!=null&&P.transient)||await d(g,S))}function f(g){n.value=Xt(n.value,g),t.value=Xt(t.value,g)}return{ensureThreadMessagesLoaded:v,hasMoreOlderMessagesByThreadId:o,isLoadingMessages:a,loadMessages:d,loadOlderMessages:c,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:r,pruneMessageHistoryState:f}}function kN(e){const t=T({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>({...d,title:ys(d.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>{const c=i[d.id];return{...d,title:ys(c??d.title)}})}))}async function o(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await Zk();if(Object.keys(i.titles).length>0){const l={};for(const[d,c]of Object.entries(i.titles))l[d]=ys(c);t.value=l}}catch{}}function r(s,i,l){const d=s.trim();if(d)return ys(d);const c=l.map(v=>v.label.trim()).find(v=>v.length>0);return c?ys(c):i.length>0?ys("[Image]"):"Untitled thread"}async function a(s,i,l,d=[],c=[]){if(t.value[s])return;const v=i.trim();if(!v){const g=r(i,d,c);t.value={...t.value,[s]:g},e.applyThreadFlags(),Yu(s,g);return}const f=v.length>300?v.slice(0,300):v;try{const g=await lI(f,l);if(!g||t.value[s])return;const S=g.length>lf?g.slice(0,lf):g;t.value={...t.value,[s]:S},e.applyThreadFlags(),Yu(s,S)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:o,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:r,threadTitleById:t}}function IN(e){const t=T({}),n=T({});function o(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function r(S){RL(o(),S)}function a(S){EL(o(),S)}function s(S){jL(o(),S)}function i(S){return ML(o(),S)}const l=K(()=>{const S=[],P=e.getSelectedThreadId();return P&&Array.isArray(t.value[P])&&S.push(...t.value[P]),Array.isArray(t.value[Wi])&&S.push(...t.value[Wi]),S.sort((B,L)=>B.receivedAtIso.localeCompare(L.receivedAtIso))});function d(S){return S?Array.isArray(t.value[S])?t.value[S]:[]:[]}function c(S){return S.some(P=>TL(P.method))?"approval":S.length>0?"response":null}function v(S){const P={};for(const[B,L]of Object.entries(t.value))(B===Wi||S.has(B))&&(P[B]=L);t.value=P}async function f(){try{const P=(await um()).map(B=>xy(B)).filter(B=>B!==null);s(P)}catch{}}async function g(S){try{const P=await um();for(const B of P){const L=qe(B);if((L==null?void 0:L.id)===S)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:d,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:g,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:v,readPendingRequestState:c,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:r}}const _u=220,AN=3e3,_N=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 PN(){const e=T([]),t=T([]),n=T(Vj()),o=T(""),r=T({}),a=T({}),s=T(Fj()),i=T({}),l=T({}),d=T(Oj()),c=T(Dj()),v=T({}),f=new Map,g=new Map,S=new Map,P=new Map,B=T({}),L=T({}),j=T({}),H=XL({liveReasoningTextByThreadId:v,inProgressById:j}),he=T({});let de=!1;const W=T({}),{activeProviderId:ve,availableModelIds:Se,availableModelReasoningEfforts:Ae,codexCliMissingError:pe,isUpdatingSpeedMode:Q,selectedModelId:me,selectedReasoningEffort:ne,selectedSpeedMode:ke,applyFallbackModelSelection:$e,buildPendingTurnDetails:te,pruneThreadModelState:ce,readModelIdForThread:Le,refreshModelPreferences:Pe,resolveThreadModelForProvider:Fe,setSelectedModelId:Ke,setSelectedModelIdForThread:lt,setSelectedReasoningEffort:Ze,setThreadModelId:ut,setThreadModelProviderId:fe,syncSelectedThreadModel:N,updateSelectedSpeedMode:oe}=uN({selectedThreadId:n,error:o}),{availableCollaborationModes:le,selectedCollaborationMode:Ee,pruneThreadCollaborationState:Be,refreshCollaborationModes:A,setSelectedCollaborationMode:M,setSelectedCollaborationModeForThread:z,syncSelectedThreadCollaborationMode:Z}=cN(n),ue=T($j()),re=T(Uj()),{projectDisplayNameById:je,projectOrder:Re,pinProjectToTop:xe,removeProject:ge,renameProject:Ve,reorderProject:Ne,setProjectDisplayNames:He,setProjectOrder:Ue}=pN({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:Tn,pruneThreadScopedState:Lo,setSelectedThreadId:vn}),Je=T({}),et=T({}),st=T({}),mt=T({}),q=T({}),ae=T({}),_e=xN({selectedThreadId:n,error:o,persistedMessagesByThreadId:r,liveAgentMessagesByThreadId:i,inProgressById:j,externalSessionByThreadId:he,resumedThreadById:Je,turnIndexByTurnIdByThreadId:et,turnErrorByThreadId:q,activeTurnIdByThreadId:ae,markThreadAsRead:va,markThreadMessagesPersisted:ol,replaceTurnIndexLookupForThread:Ti,rebindLiveFileChangeTurnIndices:Qr,setPersistedMessagesForThread:ro,setLiveAgentMessagesForThread:Wn,clearLiveAgentMessagesForThread:yr,removeLiveCommandsPersistedIn:R,removeLiveFileChangesPersistedIn:k,setThreadInProgress:rn,setThreadModelProviderId:fe,setThreadModelId:ut,resolveThreadModelForProvider:Fe,clearTransientTurnErrorForThread:vi,clearCompletedTurnLiveState:Ta,setTurnErrorForThread:Gt,getFirstPersistedTurnId:Wt,currentThreadVersion:$s}),{ensureThreadMessagesLoaded:Ye,hasMoreOlderMessagesByThreadId:bt,isLoadingMessages:Tt,loadMessages:At,loadOlderMessages:Br,loadedMessagesByThreadId:zt,loadedVersionByThreadId:Ha,loadingOlderMessagesByThreadId:fa,pruneMessageHistoryState:pa}=_e,ar=kN({applyThreadFlags:Tn}),{threadTitleById:Ur,applyCachedTitlesToGroups:zr,loadThreadTitleCacheIfNeeded:Ps,requestThreadTitleGeneration:qa}=ar,Wa=IN({applyThreadFlags:Tn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Uo,loadPendingServerRequestsFromBridge:sr,pendingReplyErrorByRequestId:Zn,pendingReplyErrorForRequest:Rs,pendingRequestStillExistsOnServer:ha,pendingServerRequestsByThreadId:Es,prunePendingServerRequestsByActiveThreads:zo,readPendingRequestState:Po,removePendingServerRequestById:Dn,selectedThreadServerRequests:Ga,upsertPendingServerRequest:Ms}=Wa,vt={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:d,turnIndexByTurnIdByThreadId:et,activeTurnIdByThreadId:ae,activeReasoningTurnIdByThreadId:P,reasoningItemTextByItemId:g,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:S,appendLiveReasoningText:(m,y)=>H.appendLiveReasoningText(m,y),clearLiveReasoningSnapshot:m=>H.clearLiveReasoningSnapshot(m),savePersistedReasoningMap:Pd},Ct=T({}),kt=T({}),mn=T({}),Fn=T({}),ho=T({}),{accountRateLimitSnapshots:Hr,codexQuota:qr,refreshRateLimits:mo,scheduleRateLimitRefresh:Ho,setCodexRateLimit:Ro,stopRateLimitRefresh:Bn}=fN(),xt=T(qj()),eo=T(Wj()),vo=T(!1),Eo=T(!1),Mo=T(!1),en=T(new Set),Un=6e4,ir=T([]);let lr="";const bn=T(!1);function ma(m){var y;try{const I=new URL(m,"http://localhost");return I.pathname!=="/codex-local-image"?"":((y=I.searchParams.get("path"))==null?void 0:y.trim())??""}catch{return""}}function tn(m){const y=m.trim().toLowerCase();return y?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(y):!1}function Wr(m){var I;const y=r.value[m]??[];for(let $=y.length-1;$>=0;$-=1){const Y=y[$];if(!(Y.role!=="user"||!Array.isArray(Y.images)||Y.images.length===0))for(let ie=Y.images.length-1;ie>=0;ie-=1){const X=((I=Y.images[ie])==null?void 0:I.trim())??"";if(X&&ma(X))return X}}return""}let go=null,Lt=null;const zn=new Map;let sn=!1,to=!1;const nn=new Set;let Va=!1,on=!1;const qo=new Map,ur=new Set,Ht=CN({selectedThreadId:n,projectGroups:e,inProgressById:j,applyThreadGroups:eu,hydrateWorkspaceRootsStateIfNeeded:ts,loadThreadTitleCacheIfNeeded:Ps,loadWorkspaceRootsStateForThreadList:Tr,pruneThreadScopedState:Lo,setSelectedThreadId:vn}),js=K(()=>Yn(e.value)),Gr=K(()=>js.value.find(m=>m.id===n.value)??null),{appendStashedMessage:Wo,autoCompactThreshold:yo,clearQueueState:qt,enqueueQueuedMessage:Ka,findQueuedMessage:no,findStashedMessage:Ya,getStashedMessages:wo,loadPersistedQueueStateIfNeeded:Vr,pruneQueueState:bo,removeQueuedMessage:jo,reorderQueuedMessage:oo,scheduleQueueStateRefresh:cr,selectedThreadQueuedMessages:St,setAutoCompactThreshold:ln,takeStashedMessages:In}=bN(n),{hooksList:dr,installedSkills:An,isHooksLoading:Kr,refreshHooks:fr,refreshSkills:dn}=mN({getSelectedCwd:()=>{var m;return((m=Gr.value)==null?void 0:m.cwd)??""}}),C=K(()=>{const m=n.value;return!!(m&&eo.value[m]===!0)}),E=K(()=>{const m=n.value;return m?Ct.value[m]===!0:!1}),J=K(()=>{const m=n.value;return m?ae.value[m]??"":""}),we=K(()=>{var se;const m=n.value;if(!m)return null;const y=j.value[m]===!0,I=y?mt.value[m]:void 0,$=y?(v.value[m]??"").trim():"",Y=(((se=q.value[m])==null?void 0:se.message)??"").trim();let ie="";if(!y&&Y){const be=r.value[m]??[];for(let Ie=be.length-1;Ie>=0;Ie-=1){const ze=be[Ie];if(ze.messageType==="turnError"){ie=Ua(ze.text);break}}}const X=!y&&Y&&ie===Y?"":Y;return!y&&!I&&!$&&!X?null:{activityLabel:(I==null?void 0:I.label)||"Thinking",activityDetails:(I==null?void 0:I.details)??[],reasoningText:$,errorText:X}}),ct=K(()=>{const m=n.value;return m?xt.value[m]??null:null}),_t=K(()=>{const m=n.value;if(!m)return[];const y=r.value[m]??[],I=a.value[m]??[],$=i.value[m]??[],Y=B.value[m]??[],ie=L.value[m]??[],X=l.value[m]??[],se=d.value[m]??[],be=y.some(Pt=>Pt.messageType==="compaction.done"),Ie=en.value.has(m),ze=be&&!Ie?X.filter(Pt=>Pt.messageType!=="compaction.pending"&&Pt.messageType!=="compaction.done"):X,pt=Lj(m,y,se,[I,Y,ie,$],ze),ht=st.value[m],it=ht?hj(pt,ht):pt;return mj(it,c.value[m])}),_n=K(()=>{const m=n.value;return m?Fn.value[m]??null:null}),Kt=K(()=>{const m=n.value;return m?bt.value[m]===!0:!1}),Pn=K(()=>{const m=n.value;return m?fa.value[m]===!0:!1});function Wt(m){var I;const y=r.value[m]??[];for(const $ of y){const Y=((I=$.turnId)==null?void 0:I.trim())??"";if(Y)return Y}return""}function vn(m,y={}){n.value!==m&&(n.value=m,y.persist!==!1&&Kj(m),N(m),Z(m),on=!1)}function mi(m,y){const I=m.trim();if(!I)return;if(!y){if(!(I in xt.value))return;xt.value=yt(xt.value,I),qm(xt.value);return}const $=xt.value[I];if($&&JSON.stringify($)===JSON.stringify(y))return;xt.value={...xt.value,[I]:y},qm(xt.value);const Y=wo(I);Y&&Y.length>0&&yo.value>0&&(y.remainingContextPercent!==null&&y.remainingContextPercent<=yo.value?en.value.has(I)||sl(I):xo(I))}function pr(m,y){ho.value={...ho.value,[m]:y}}function hr(m){ho.value[m]&&(ho.value=yt(ho.value,m))}async function Ls(m){if(ur.has(m))return;const y=ho.value[m];if(!(!y||y.fallbackRetried)){ur.add(m),pr(m,{...y,fallbackRetried:!0});try{await $e(m);try{const I=await yd(m,1);ro(m,I),To(m),Wn(m,[]),Rn(m),B.value[m]&&(B.value=yt(B.value,m))}catch{}if(Gt(m,null),o.value="",$t(m,null),Yt(m,{label:"Thinking",details:te(Pr,y.effort,y.collaborationMode)}),rn(m,!0),Je.value[m]!==!0){const I=await Xd(m);I.model&&ut(m,Fe(m,I.model,I.modelProvider)),I.modelProvider&&fe(m,I.modelProvider),Je.value={...Je.value,[m]:!0}}await wd(m,y.text,y.imageUrls,Pr,y.effort||void 0,y.skills.length>0?y.skills:void 0,y.fileAttachments,y.collaborationMode),Ho(),nn.add(m),await Jo()}catch(I){const $=I instanceof Error?I.message:"Unknown application error";Gt(m,$),o.value=$,rn(m,!1),Yt(m,null)}finally{ur.delete(m)}}}function mr(m){if(!m||typeof window>"u")return;const y=zn.get(m);y!==void 0&&(window.clearTimeout(y),zn.delete(m))}function Yr(m){if(!m||typeof window>"u")return;mr(m);const y=window.setTimeout(()=>{zn.delete(m),nn.add(m),Jo()},AN);zn.set(m,y)}function Tn(){const y=zr(t.value).map(I=>({projectName:I.projectName,threads:I.threads.map($=>{const Y=he.value[$.id]??$.externalSession??null,ie=j.value[$.id]===!0||(Y==null?void 0:Y.active)===!0,X=Po(Uo($.id)),se=n.value===$.id,be=W.value[$.id]===!0,Ie=Z1($.updatedAtIso,ue.value[$.id],re.value);return{...$,inProgress:ie,unread:!se&&!ie&&(be||Ie),pendingRequestState:X,...Y?{externalSession:Y}:{}}})}));e.value=Xu(e.value,y)}function vr(m,y,I){const $=new Date().toISOString(),Y=Xe(y),ie=nr(Y),X={id:m,title:ys(I),projectName:ie,cwd:Y,hasWorktree:Y.includes("/.codex/worktrees/")||Y.includes("/.git/worktrees/"),createdAtIso:$,updatedAtIso:$,preview:I,unread:!1,inProgress:!1},se=t.value.findIndex(Ie=>Ie.projectName===ie);if(se>=0){const ze=t.value[se].threads.filter(it=>it.id!==m),pt={projectName:ie,threads:[X,...ze]},ht=[...t.value];ht.splice(se,1,pt),t.value=ht}else t.value=[{projectName:ie,threads:[X]},...t.value];const be=Ni(Re.value,t.value);Oa(Re.value,be)||Ue(be),Tn()}function Lo(m){const y=new Set(m.map(Y=>Y.id)),I=n.value.trim();I&&y.add(I),ce(y),Be(y);const $=Xt(ue.value,y);if($!==ue.value&&(ue.value=$,zm($)),pa(y),Je.value=Xt(Je.value,y),et.value=Xt(et.value,y),r.value=Xt(r.value,y),i.value=Xt(i.value,y),v.value=Xt(v.value,y),B.value=Xt(B.value,y),L.value=Xt(L.value,y),st.value=Xt(st.value,y),mt.value=Xt(mt.value,y),q.value=Xt(q.value,y),ae.value=Xt(ae.value,y),P.size>0)for(const Y of[...P.keys()])y.has(Y)||P.delete(Y);Ej(y),Ct.value=Xt(Ct.value,y),kt.value=Xt(kt.value,y),mn.value=Xt(mn.value,y),bo(y),xt.value=Xt(xt.value,y),W.value=Xt(W.value,y),j.value=Xt(j.value,y),zo(y)}function va(m){const y=Yn(t.value).find(I=>I.id===m);y&&(ue.value={...ue.value,[m]:y.updatedAtIso},zm(ue.value),W.value[m]&&(W.value=yt(W.value,m)),Tn())}function $t(m,y){if(!m)return;const I=st.value[m];if(y){if(dj(I,y))return;st.value={...st.value,[m]:y}}else I&&(st.value=yt(st.value,m))}function ga(m,y,I){if(!m||!y)return;const $={...c.value[m]??{}},Y=Number.isFinite(I)?Math.max(0,Math.round(I)):0;Y<=0?delete $[y]:$[y]=Y,Object.keys($).length===0?c.value=yt(c.value,m):c.value={...c.value,[m]:$},Hm(c.value)}function rn(m,y){!m||j.value[m]===!0===y||(y?(j.value={...j.value,[m]:!0},yi(m)):(j.value=yt(j.value,m),Ta(m),gr(m),xo(m)),Tn(),!y&&!Ht.hasActiveInProgressThreads()&&Ht.hasRemainingThreadPages()&&Ht.scheduleRemainingThreadPages())}function gr(m){m&&(Ct.value[m]&&(Ct.value=yt(Ct.value,m)),kt.value[m]&&(kt.value=yt(kt.value,m)),mn.value[m]&&(mn.value=yt(mn.value,m)))}function ya(m){m&&(Ct.value={...Ct.value,[m]:!0},kt.value[m]&&(kt.value=yt(kt.value,m)),mn.value[m]&&(mn.value=yt(mn.value,m)))}function Sn(m){m&&Ct.value[m]===!0&&kt.value[m]===!0&&mn.value[m]===!0&&gr(m)}function Ns(m,y){!m||!y||Ct.value[m]===!0&&gr(m)}function Ja(m){const y=Object.keys(Ct.value);if(y.length===0)return;let I=kt.value,$=!1;for(const Y of y)!m.has(Y)||I[Y]===!0||(I={...I,[Y]:!0},$=!0);if($){kt.value=I;for(const Y of y)Sn(Y)}}function ol(m,y){m&&Ct.value[m]===!0&&y.some(I=>I.role==="user")&&(mn.value[m]!==!0&&(mn.value={...mn.value,[m]:!0}),Sn(m))}function Hn(m){m&&m!==n.value&&W.value[m]!==!0&&(W.value={...W.value,[m]:!0},Tn())}function Yt(m,y){if(!m)return;const I=mt.value[m];if(!y){I&&(mt.value=yt(mt.value,m));return}const $=Fs(y.label)||"Thinking",Y=y.details.map(se=>Fs(se)).filter(se=>se.length>0&&se!==$),ie=Array.from(new Set([...(I==null?void 0:I.details)??[],...Y])).slice(-3),X={label:$,details:ie};fj(I,X)||(mt.value={...mt.value,[m]:X})}function Gt(m,y,I={}){if(!m)return;const $=q.value[m],Y=y?Ua(y):"";if(!Y){$&&(q.value=yt(q.value,m));return}const ie=I.transient===!0;($==null?void 0:$.message)===Y&&$.transient===ie||(q.value={...q.value,[m]:{message:Y,transient:ie}})}function vi(m){var y;m&&(y=q.value[m])!=null&&y.transient&&Gt(m,null)}function rl(){const m=Object.entries(q.value).filter(([,I])=>I==null?void 0:I.transient).map(([I])=>I);if(m.length===0)return;let y=q.value;for(const I of m)y=yt(y,I);q.value=y}function $s(m){const y=Yn(t.value).find(I=>I.id===m);return(y==null?void 0:y.updatedAtIso)??""}function qn(m,y){if(!m)return;const I={...eo.value};y?I[m]=!0:delete I[m],eo.value=I,Gj(I)}function gi(){const m=n.value;m&&qn(m,!C.value)}function ro(m,y){const I=r.value[m]??[];tl(I,y)||(r.value={...r.value,[m]:y})}function un(m,y,I=[],$=[],Y=[]){const ie=r.value[m]??[],X={id:`optimistic-user:${m}:${Date.now()}`,role:"user",text:y,images:I.length>0?[...I]:void 0,skills:$.length>0?$.map(se=>({name:se.name,path:se.path})):void 0,fileAttachments:Y.length>0?Y.map(se=>({...se})):void 0,messageType:"userMessage.optimistic"};ro(m,[...ie,X])}function Wn(m,y){ky(Gn,m,y)}function yr(m){LL(Gn,m)}function wr(m,y){OL(Gn,m,y)}function Go(m,y){FL(Gn,m,y)}function wa(m,y){DL(Gn,m,y)}function Qa(m,y){H.setLiveReasoningText(m,y)}function Jr(m,y){H.appendLiveReasoningText(m,y)}function yi(m){H.restoreLiveReasoningSnapshot(m)}function ba(m){ZL(vt,m)}function Rn(m,y=!1){eN(vt,m,y)}function To(m){m&&m in a.value&&(a.value=yt(a.value,m))}function Xa(m){m&&m in L.value&&(L.value=yt(L.value,m))}function Ta(m){if(!m)return;To(m);const y=s.value[m];if(y&&y.messageType==="plan.live"){const I={...y,messageType:"plan",plan:y.plan?{...y.plan,isStreaming:!1}:y.plan};s.value={...s.value,[m]:I},Cy(s.value)}Rn(m),Pj(m),Yt(m,null),n.value,B.value[m]&&(B.value=yt(B.value,m)),ae.value[m]&&(ae.value=yt(ae.value,m)),hr(m)}function wi(m){var Ie;if(m.method!=="turn/plan/updated")return null;const y=qe(m.params),I=Ln(m),$=Me(y==null?void 0:y.turnId)||Me(y==null?void 0:y.turn_id),ie=(Array.isArray(y==null?void 0:y.plan)?y==null?void 0:y.plan:[]).map(ze=>qe(ze)).map(ze=>({step:Me(ze==null?void 0:ze.step),status:Zj(ze==null?void 0:ze.status)})).filter(ze=>ze.step.length>0);if(!I||!$)return null;const se={explanation:Me(y==null?void 0:y.explanation).trim()||void 0,steps:ie,isStreaming:!0},be=(Ie=et.value[I])==null?void 0:Ie[$];return{threadId:I,message:{id:`${$}:plan`,role:"assistant",text:eL(se),messageType:"plan.live",plan:se,turnId:$||void 0,turnIndex:typeof be=="number"?be:void 0}}}function Os(m){var ze;if(m.method!=="item/plan/delta")return null;const y=qe(m.params),I=Ln(m),$=Me(y==null?void 0:y.turnId)||Me(y==null?void 0:y.turn_id),Y=Me(y==null?void 0:y.delta);if(!I||!$||!Y)return null;const ie=`${$}:plan`,X=(a.value[I]??[]).find(pt=>pt.id===ie),se=`${(X==null?void 0:X.text)??""}${Y}`,be=X!=null&&X.plan?{...X.plan,isStreaming:!0}:void 0,Ie=(ze=et.value[I])==null?void 0:ze[$];return{threadId:I,message:{id:ie,role:"assistant",text:se,messageType:"plan.live",plan:be,turnId:$||void 0,turnIndex:typeof Ie=="number"?Ie:void 0}}}const Gn={liveCommandsByThreadId:B,liveFileChangeMessagesByThreadId:L,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},Vo={turnIndexByTurnIdByThreadId:et,persistedMessagesByThreadId:r,liveFileChangeMessagesByThreadId:L};function Ds(m){if(m.method==="server/request"){const y=xy(m.params);return y&&Ms(y),!0}if(m.method==="server/request/resolved"){const y=qe(m.params),I=y==null?void 0:y.id;return typeof I=="number"&&Number.isInteger(I)&&Dn(I),!0}return!1}function Fs(m){return m.replace(/\s+/gu," ").trim()}function bi(m){return WL(Vo,m)}function al(m,y,I){GL(Vo,m,y,I)}function Ti(m,y){VL(Vo,m,y)}function Sa(m,y){return KL(Vo,m,y)}function Qr(m){YL(Vo,m)}function Xr(m,y,I){oN(vt,m,y,I)}function Za(m){rN(vt,m)}function So(m){var be;if(m.method!=="item/started"&&m.method!=="item/completed")return null;const y=qe(m.params),I=qe(y==null?void 0:y.item);if(!I||Me(I.type).toLowerCase()!=="plan")return null;const $=Ln(m),Y=Me(y==null?void 0:y.turnId)||Me(y==null?void 0:y.turn_id),ie=Me(I.id),X=Me(I.text);if(!$||!ie||!X)return null;const se=$&&Y?(be=et.value[$])==null?void 0:be[Y]:void 0;return{threadId:$,message:{id:ie,role:"assistant",text:X,messageType:m.method==="item/completed"?"plan":"plan.live",plan:ay(X)??void 0,turnId:Y||void 0,turnIndex:typeof se=="number"?se:void 0}}}function No(m){var Ie;if(m.method!=="item/started")return null;const y=qe(m.params),I=qe(y==null?void 0:y.item);if(!I||I.type!=="commandExecution")return null;const $=Me(I.id),Y=Me(I.command);if(!$)return null;const ie=typeof I.cwd=="string"?I.cwd:null,X=Ln(m),se=Me(y==null?void 0:y.turnId)||Me(y==null?void 0:y.turn_id),be=X&&se?(Ie=et.value[X])==null?void 0:Ie[se]:void 0;return{id:$,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:ie,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:se||void 0,turnIndex:typeof be=="number"?be:void 0}}function $o(m){var it;if(m.method!=="item/completed")return null;const y=qe(m.params),I=qe(y==null?void 0:y.item);if(!I||I.type!=="commandExecution")return null;const $=Me(I.id),Y=Me(I.command);if(!$)return null;const ie=typeof I.cwd=="string"?I.cwd:null,X=Me(I.status),se=X==="failed"?"failed":X==="declined"?"declined":X==="interrupted"?"interrupted":"completed",be=typeof I.aggregatedOutput=="string"?I.aggregatedOutput:"",Ie=typeof I.exitCode=="number"?I.exitCode:null,ze=Ln(m),pt=Me(y==null?void 0:y.turnId)||Me(y==null?void 0:y.turn_id),ht=ze&&pt?(it=et.value[ze])==null?void 0:it[pt]:void 0;return{id:$,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:ie,status:se,aggregatedOutput:be,exitCode:Ie},turnId:pt||void 0,turnIndex:typeof ht=="number"?ht:void 0}}function Zr(m){var Ie;if(m.method!=="item/completed")return null;const y=qe(m.params),I=qe(y==null?void 0:y.item);if(!I||I.type!=="fileChange")return null;const $=Me(I.id);if(!$)return null;const Y=Me(y==null?void 0:y.threadId),ie=Me(y==null?void 0:y.turnId),X=Y&&ie?(Ie=et.value[Y])==null?void 0:Ie[ie]:void 0,se=Yd(I.changes),be=$g(I.status);return se.length===0||be!=="completed"?null:{id:$,role:"system",text:"",messageType:"fileChange",fileChangeStatus:be,fileChanges:se,turnId:ie||void 0,turnIndex:typeof X=="number"?X:void 0}}function x(m,y){BL(Gn,m,y)}function R(m,y){UL(Gn,m,y)}function k(m,y){zL(Gn,m,y)}function G(m){if(m.method==="item/agentMessage/delta")return!0;const y=qe(m.params);if(!y)return!1;if(m.method==="item/completed"){const I=qe(y.item);return(I==null?void 0:I.type)==="agentMessage"}return!1}const We=new Set;function Ot(m){for(const y of We)try{y(m)}catch{}}function ao(m){return We.add(m),()=>{We.delete(m)}}function Co(m,y,I){HL(Gn,m,y,I)}function cn(m,y,I){qL(Gn,m,y,I)}function br(m){var kr,ul,ou,ra,Do,as,ki,fn;if(Ds(m))return;if(Za(m),m.method==="turn/started"){const Ce=Ln(m);Ce&&S.delete(Ce)}if(_N.has(m.method))return;if(m.method==="app/list/updated"||m.method==="mcpServer/startupStatus/updated"||m.method==="mcpServer/oauthLogin/completed"||m.method==="remoteControl/status/changed"){Ot(m.method);return}if(m.method==="skills/changed"){dn({force:!0});return}if(m.method==="hook/started"||m.method==="hook/completed"){fr({force:!0});return}if(m.method==="thread/status/changed"){const Ce=Ln(m);Ce&&Ce===n.value&&nn.add(Ce);return}if(m.method==="thread/archived"||m.method==="thread/unarchived"||m.method==="thread/deleted"||m.method==="thread/closed")return;if(m.method==="item/fileChange/patchUpdated"||m.method==="turn/diff/updated"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.threadId);wt&&(m.method==="item/fileChange/patchUpdated"?Co(wt,Me(Ce==null?void 0:Ce.itemId),Yd(Ce==null?void 0:Ce.changes)):cn(wt,Me(Ce==null?void 0:Ce.turnId),Me(Ce==null?void 0:Ce.diff)??""),wt===n.value&&nn.add(wt));return}if(m.method==="account/rateLimits/updated"&&Ho(),m.method==="thread/name/updated"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.threadId),Fo=Me(Ce==null?void 0:Ce.threadName);if(wt&&Fo){const so=ys(Fo);Ur.value={...Ur.value,[wt]:so},Tn(),Yu(wt,so)}}if(m.method==="thread/compacted"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.threadId);wt&&(xr(wt,!1),Yo(wt,"done"),nn.add(wt));return}if(m.method==="fuzzyFileSearch/sessionUpdated"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.sessionId);wt&&wt===lr&&(ir.value=Cx(Ce));return}if(m.method==="fuzzyFileSearch/sessionCompleted"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.sessionId);wt&&wt===lr&&(lr="");return}if(m.method==="account/rateLimits/updated"){Ro(zg(m.params));return}const y=nL(m);if(y){mi(y.threadId,y.usage);return}const I=aL(m);I&&Yt(I.threadId,I.activity);const $=Ln(m),Y=rL(m);!Y&&$&&vi($);const ie=sL(m);ie&&(qo.set(ie.turnId,ie),al(ie.threadId,ie.turnId,bi(ie.threadId)),ae.value={...ae.value,[ie.threadId]:ie.turnId},Ns(ie.threadId,ie.turnId),To(ie.threadId),Xa(ie.threadId),$t(ie.threadId,null),Gt(ie.threadId,null),rn(ie.threadId,!0),cr(ie.threadId),W.value[ie.threadId]&&(W.value=yt(W.value,ie.threadId)));const X=iL(m),se=oL(m),be=(X==null?void 0:X.threadId)??Ln(m),Ie=be?Le(be):"",ze=!!be&&!!se&&Ie!==Pr&&ku(new Error(se));if(X){ho.value[X.threadId];const Ce=qo.get(X.turnId);Ce&&qo.delete(X.turnId);const wt=Ss((kr=qe(m.params))==null?void 0:kr.durationMs)??Ss((ou=qe((ul=qe(m.params))==null?void 0:ul.turn))==null?void 0:ou.durationMs)??(typeof X.startedAtMs=="number"?X.completedAtMs-X.startedAtMs:null)??(Ce?X.completedAtMs-Ce.startedAtMs:null),Fo=typeof wt=="number"?Math.max(0,wt):0;$t(X.threadId,{turnId:X.turnId,durationMs:Fo}),ga(X.threadId,X.turnId,Fo),ae.value[X.threadId]&&(ae.value=yt(ae.value,X.threadId)),rn(X.threadId,!1),Yt(X.threadId,null),Hn(X.threadId),ze||(hr(X.threadId),cr(X.threadId))}if(se){const Ce=(X==null?void 0:X.threadId)||Ln(m);Ce&&Gt(Ce,se),o.value=se,Ce&&ze&&Ls(Ce)}else X&&Gt(X.threadId,null);if(Y){const Ce=$,wt=Ce?Le(Ce):me.value.trim();Ce&&Gt(Ce,Y.message,{transient:Y.transient}),o.value=Y.message,wt!==Pr&&ku(new Error(Y.message))&&(Ce?Ls(Ce):$e())}const pt=wi(m);pt&&(wr(pt.threadId,pt.message),Yt(pt.threadId,{label:"Planning",details:((ra=pt.message.plan)==null?void 0:ra.steps.map(Ce=>Ce.step).slice(0,2))??[]}));const ht=Os(m);ht&&(wr(ht.threadId,ht.message),Yt(ht.threadId,{label:"Planning",details:[]}));const it=So(m);if(it&&(wr(it.threadId,it.message),Yt(it.threadId,{label:"Planning",details:((Do=it.message.plan)==null?void 0:Do.steps.map(Ce=>Ce.step).slice(0,2))??[]})),!$||$!==n.value)return;hL(m);const Pt=mL(m);if(Pt){const Ce=(i.value[$]??[]).find(ru=>ru.id===Pt.messageId),wt=`${(Ce==null?void 0:Ce.text)??""}${Pt.delta}`,Fo=Pt.turnId??(Ce==null?void 0:Ce.turnId),so=Fo?(as=et.value[$])==null?void 0:as[Fo]:Ce==null?void 0:Ce.turnIndex;Go($,{id:Pt.messageId,role:"assistant",text:wt,messageType:"agentMessage.live",turnId:Fo,turnIndex:typeof so=="number"?so:void 0})}const Ia=vL(m);if(Ia){const Ce=Ia.turnId?(ki=et.value[$])==null?void 0:ki[Ia.turnId]:void 0;Go($,{...Ia,turnIndex:typeof Ce=="number"?Ce:void 0})}const Kn=wL(m);Kn&&Go($,Kn),lL(m)&&ba($);const oa=uL(m);oa&&(Jr($,oa.delta),sN(vt,oa.itemId,oa.delta));const Aa=pL(m);if(Aa&&(Xr($,Aa.itemId,Aa.text),ba($)),cL(m)){const Ce=v.value[$]??"";Ce.trim().length>0&&!Ce.endsWith(`
|
|
75
|
-
|
|
76
|
-
`)&&Qa($,`${Ce}
|
|
77
|
-
|
|
78
|
-
`)}dL(m);const Qo=No(m);Qo&&(x($,Qo),Yt($,{label:"Running command",details:[((fn=Qo.commandExecution)==null?void 0:fn.command)??""]}));const Mn=bL(m);if(Mn){const Ce=(B.value[$]??[]).find(wt=>wt.id===Mn.itemId);Ce!=null&&Ce.commandExecution&&x($,{...Ce,commandExecution:{...Ce.commandExecution,aggregatedOutput:`${Ce.commandExecution.aggregatedOutput}${Mn.delta}`}})}const xi=$o(m);xi&&x($,xi);const ll=Zr(m);if(ll&&wa($,ll),G(m)&&Rn($,!0),m.method==="turn/completed"){on=!1,Rn($),Vm(vt),B.value[$]&&(B.value=yt(B.value,$));const Ce=Ln(m);Ce&&(mr(Ce),rn(Ce,!1),Yt(Ce,null),Hn(Ce),ze||(hr(Ce),cr(Ce)))}}function es(m){if(m.method==="thread/tokenUsage/updated"||m.method.startsWith("thread/realtime/"))return;const y=m.method,I=y==="turn/started"||y==="turn/completed"||y==="error",$=y.startsWith("thread/")||y==="turn/completed";if(!I&&!$)return;const Y=Ln(m);Y&&I&&nn.add(Y),$&&(sn=!0,to=!0),!(Lt!==null||typeof window>"u")&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}async function ts(m,y){if(!Va){Va=!0;try{if(!y)return;const I=[];for(const $ of bc(y)){const Y=fi($);I.includes(Y)||I.push(Y)}if(I.length>0){const $=y.projectOrder.length>0?Ni(I,m):Ni(Re.value,m);Oa(Re.value,$)||Ue($,{persist:!1})}if(Object.keys(y.labels).length>0||(y.remoteProjects??[]).length>0){const $={...je.value};let Y=!1;for(const[ie,X]of Object.entries(y.labels)){const se=Xe(ie).trim(),be=[fi(ie)];se&&be.push(se);for(const Ie of be)$[Ie]!==X&&($[Ie]=X,Y=!0)}for(const ie of y.order){const X=fi(ie),se=nr(Hi(ie));if(!se.startsWith(".")||se===X)continue;const be=`${X} ${se}`;$[X]!==void 0||$[X]===be||($[X]=be,Y=!0)}for(const ie of y.remoteProjects??[]){const X=Sj(ie);$[ie.id]!==X&&($[ie.id]=X,Y=!0)}Y&&He($,{persist:!1})}}catch{}}}async function Tr(){try{return await $i()}catch{return null}}function Tc(m,y){const I=sf(m,y),$=Ij(m,y),Y=Aj($,y,I);if(!y||y.order.length===0&&(y.remoteProjects??[]).length===0)return Y;const ie=new Set;for(const se of af(y,I))ie.add(se);const X=Y.filter(se=>ie.has(se.projectName)?!0:uf(se));return kj(X,y,I)}function eu(m,y){const I=Tc(m,y),$=!!(y&&(y.order.length>0||y.projectOrder.length>0||(y.remoteProjects??[]).length>0)),Y=y!=null&&y.projectOrder.length?Ni(af(y,sf(m,y)),I):Ni(Re.value,I);Oa(Re.value,Y)||Ue(Y,{persist:!$});const ie=of(I,Re.value);Ja(new Set(Yn(ie).map(be=>be.id)));const X=bj(t.value,ie,j.value);t.value=Xu(t.value,X),j.value=Xt(j.value,new Set(Yn(t.value).map(be=>be.id))),new Set(Yn(t.value).map(be=>be.id));const se={};for(const be of Yn(t.value))se[be.id]=be.externalSession??he.value[be.id]??null;he.value=se,Tn()}function Vn(m){Ht.removeThreadFromLoadedLists(m),t.value=fy(t.value,m),j.value=yt(j.value,m),Tn()}async function Sr(m={}){await Promise.allSettled([Pe({providerChanged:m.providerChanged,includeProviderModels:m.includeProviderModels}),mo(),A(),dn()])}function Cr(m={}){const y=()=>{Sr(m)};if(typeof window>"u"){y();return}window.setTimeout(y,0)}async function ea(m={}){o.value="",pe.value="";const y=m.includeSelectedThreadMessages!==!1,I=m.awaitAncillaryRefreshes===!0;try{if(await Vr(),await Ht.loadThreads({force:m.forceThreadRefresh===!0}),y)try{await At(n.value)}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}I?await Sr({providerChanged:m.providerChanged,includeProviderModels:m.providerChanged===!0||I}):Cr({providerChanged:m.providerChanged,includeProviderModels:!1})}catch($){o.value=$ instanceof Error?$.message:"Unknown application error",uy($)?pe.value=Iy:pe.value=""}}async function En(m){vn(m);try{return await At(m),await Pe({includeProviderModels:!0}),dn(),"ok"}catch(y){const I=y instanceof Error?y.message:"Unknown application error";o.value=I;const $=Q1(y)?"not-found":"error";return m.trim()&&Gt(m,I,{transient:!0}),$}}async function Si(m){const y=n.value===m,I=y?J1(Yn(e.value),m):"";y&&(vn(I),I&&At(I,{silent:!0}));try{await Tk(m),Vn(m),await Ht.loadThreads(),y&&I&&n.value===I&&await Ye(I,{silent:!0})}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}}async function ns(m,y){const I=y.trim();if(!(!m||!I))try{await xk(m,I),Ur.value={...Ur.value,[m]:I},Tn(),Yu(m,I)}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}}async function Ca(m){var X,se;const y=m.trim();if(!y)return"";const I=Yn(t.value).find(be=>be.id===y),$=((X=I==null?void 0:I.cwd)==null?void 0:X.trim())??"",Y=((se=I==null?void 0:I.title)==null?void 0:se.trim())??"Forked chat",ie=Le(y);o.value="";try{const be=await tm(y,$||void 0,ie||void 0),Ie=be.threadId.trim();return Ie?(vr(Ie,$,Y),ut(Ie,be.model),Je.value={...Je.value,[Ie]:!0},vn(Ie),await Ht.loadThreads(),await At(Ie),Ie):""}catch(be){return o.value=be instanceof Error?be.message:"Unknown application error",""}}async function tu(m,y){var X;const I=m.trim();if(!I||!Number.isInteger(y)||y<0)return"";if(j.value[I]===!0)return o.value="Finish the current turn before forking from a response.","";if(zt.value[I]!==!0)try{await At(I)}catch(se){return o.value=se instanceof Error?se.message:"Unknown application error",""}const $=r.value[I]??[];let Y=-1;for(const se of $)typeof se.turnIndex=="number"&&Number.isFinite(se.turnIndex)&&(Y=Math.max(Y,se.turnIndex));if(Y>=0&&y>Y)return"";const ie=Yn(t.value).find(se=>se.id===I)??null;try{o.value="";const se=await tm(I),be=se.threadId.trim();if(!be)return"";const Ie=se.cwd.trim()||((X=ie==null?void 0:ie.cwd)==null?void 0:X.trim())||"",ze=_j((ie==null?void 0:ie.title)||(ie==null?void 0:ie.preview)||"Untitled thread");vr(be,Ie,ze),ut(be,se.model),ro(be,se.messages),zt.value={...zt.value,[be]:!0},Je.value={...Je.value,[be]:!0},To(be),Wn(be,[]),Rn(be),B.value[be]&&(B.value=yt(B.value,be)),$t(be,null),Yt(be,null),Gt(be,null),rn(be,!1);const pt=Y-y;if(pt>0){const ht=await yd(be,pt);ro(be,ht)}return await ns(be,ze),vn(be),Ht.loadThreads().catch(()=>{}),be}catch(se){return o.value=se instanceof Error?se.message:"Unknown application error",""}}async function xa(m,y,I=[],$=[],Y=[]){if(!m||!y.trim()||I.length>0||$.length>0||Y.length>0)return!1;const X=(Es.value[m]??[]).filter(Ie=>Ie.method==="item/tool/requestUserInput");if(X.length!==1)return!1;const[se]=X,be=PL(se);return be.length!==1?!1:il({id:se.id,result:{answers:{[be[0]]:{answers:[y.trim()]}}}})}async function Ko(m,y,I,$,Y,ie){if(de||yo.value<=0||j.value[m]===!0)return!1;const X=xt.value[m];if(!X||X.remainingContextPercent===null||X.remainingContextPercent>yo.value)return!1;const se=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,be=ie==="plan"?"plan":ie==="default"?"default":Ee.value;return Wo(m,{id:se,text:y,imageUrls:I,skills:$,fileAttachments:Y,collaborationMode:be}),en.value.has(m)||sl(m),!0}async function xo(m){const y=wo(m);if(!y||y.length===0||j.value[m]===!0)return;const I=In(m);de=!0;try{for(const $ of I)try{await Qt($.text,$.imageUrls,$.skills,"steer",$.fileAttachments,void 0,$.collaborationMode)}catch{}}finally{de=!1}}async function Qt(m,y=[],I=[],$="steer",Y=[],ie,X){if(Q.value)return;const se=n.value,be=m.trim();if(!se||!be&&y.length===0&&Y.length===0||await xa(se,be,y,I,Y)||await Ko(se,be,y,I,Y,X))return;const Ie=j.value[se]===!0;if(Ie&&$==="queue"){const ze=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Ka(se,{id:ze,text:be,imageUrls:y,skills:I,fileAttachments:Y,collaborationMode:X==="plan"?"plan":X==="default"?"default":Ee.value},ie);return}if(Ie){on=!0,un(se,be,y,I,Y),ta(se,be,y,I,Y,X).catch(ze=>{const pt=ze instanceof Error?ze.message:"Unknown application error";Gt(se,pt),o.value=pt});return}o.value="",on=!0,$t(se,null),un(se,be,y,I,Y),Yt(se,{label:"Thinking",details:te(Le(se),ne.value,X==="plan"?"plan":X==="default"?"default":Ee.value)}),Gt(se,null),rn(se,!0);try{await ta(se,be,y,I,Y,X)}catch(ze){on=!1,rn(se,!1),Yt(se,null);const pt=ze instanceof Error?ze.message:"Unknown application error";throw Gt(se,pt),o.value=pt,ze}}async function os(m,y,I=[],$=[],Y=[]){if(Q.value)return"";const ie=m.trim(),X=y.trim(),se=Le(Is).trim(),be=Ee.value;if(!ie&&I.length===0&&Y.length===0)return"";vo.value=!0,o.value="";let Ie="";try{try{const it=await em(X||void 0,se||void 0);Ie=it.threadId,ut(Ie,it.model),fe(Ie,it.modelProvider||ve.value),z(Ie,be)}catch(it){if(se&&se!==Pr&&ku(it)){await $e();const Pt=await em(X||void 0,Pr);Ie=Pt.threadId,ut(Ie,Pt.model),fe(Ie,Pt.modelProvider||ve.value),z(Ie,be)}else throw it}if(!Ie)return"";vr(Ie,X,ie||"[Image]"),un(Ie,ie,I,$,Y),ya(Ie),Je.value={...Je.value,[Ie]:!0},vn(Ie),on=!0,$t(Ie,null),Yt(Ie,{label:"Thinking",details:te(Le(Ie),ne.value,be)}),Gt(Ie,null),rn(Ie,!0);const ze=Ie,pt=X||null,ht=ie;return ta(Ie,ie,I,$,Y,be).catch(it=>{on=!1,rn(Ie,!1),Yt(Ie,null);const Pt=it instanceof Error?it.message:"Unknown application error";Gt(Ie,Pt),o.value=Pt}).finally(()=>{vo.value=!1}),qa(ze,ht,pt,I,Y),Ie}catch(ze){on=!1,Ie&&(rn(Ie,!1),Yt(Ie,null));const pt=ze instanceof Error?ze.message:"Unknown application error";throw Ie&&Gt(Ie,pt),o.value=pt,vo.value=!1,ze}}async function ta(m,y,I=[],$=[],Y=[],ie){const X=ne.value,se=ie==="plan"?"plan":ie==="default"?"default":Ee.value,be=y.trim(),Ie=[...I];if(Ie.length===0&&tn(be)){const ht=Wr(m);ht&&Ie.push(ht)}const ze=$.map(ht=>({name:ht.name,path:ht.path})),pt=Y.map(ht=>({...ht}));pr(m,{text:be,imageUrls:[...Ie],skills:ze,fileAttachments:pt,effort:X,collaborationMode:se,fallbackRetried:!1});try{if(Je.value[m]!==!0){const Pt=await Xd(m);Pt.model&&ut(m,Fe(m,Pt.model,Pt.modelProvider)),Pt.modelProvider&&fe(m,Pt.modelProvider),Je.value={...Je.value,[m]:!0}}const ht=Le(m);let it="";try{it=await wd(m,y,Ie,ht||void 0,X||void 0,$.length>0?$:void 0,Y,se)}catch(Pt){if(ht&&ht!==Pr&&ku(Pt))await $e(m),pr(m,{text:be,imageUrls:[...Ie],skills:ze,fileAttachments:pt,effort:X,collaborationMode:se,fallbackRetried:!0}),it=await wd(m,y,Ie,Pr,X||void 0,$.length>0?$:void 0,Y,se);else throw Pt}it&&(ae.value={...ae.value,[m]:it},Ns(m,it)),nn.add(m),await Jo(),Yr(m)}catch(ht){throw ht}}async function ka(){const m=n.value;if(!m||j.value[m]!==!0||Ct.value[m]===!0)return;let y=ae.value[m];if(!y){const{activeTurnId:ie}=await Qd(m);y=ie,y&&(ae.value={...ae.value,[m]:y})}if(!y)throw new Error("Could not determine active turn id for interrupt");const I=_t.value.filter(ie=>ie.turnId===y),$=I.find(ie=>ie.role==="user"),Y=I.some(ie=>{if(ie.role==="assistant")return!0;const X=ie.messageType??"";return X==="commandExecution"||X==="toolCall"||X==="worked"||X==="fileChange"||X==="plan"||X==="plan.live"||X==="compaction.done"||X==="turnError"});Eo.value=!0,o.value="";try{if(await kk(m,y),rn(m,!1),Yt(m,null),Gt(m,null),ae.value[m]&&(ae.value=yt(ae.value,m)),nn.add(m),sn=!0,await Jo(),$&&!Y){const ie=(r.value[m]??[]).filter(se=>se.turnId!==y);ro(m,ie);const X=d.value[m];if(X){const se=X.filter(be=>be.turnId!==y);se.length!==X.length&&(d.value={...d.value,[m]:se},Pd(d.value))}Fn.value={...Fn.value,[m]:{text:$.text??"",imageUrls:$.images??[],fileAttachments:($.fileAttachments??[]).map(se=>({label:se.label,path:se.path,fsPath:se.fsPath??se.path})),skills:$.skills??[]}}}}catch(ie){const X=ie instanceof Error?ie.message:"Failed to interrupt active turn";Gt(m,X),o.value=X}finally{Eo.value=!1}}function Bs(m){m&&Fn.value[m]&&(Fn.value=yt(Fn.value,m))}async function rs(m){var I,$,Y;const y=n.value;if(y&&!Mo.value&&m.trim()){Mo.value=!0,o.value="";try{j.value[y]===!0&&await ka();const ie=r.value[y]??[],X=ie.find(ht=>ht.turnId===m),se=typeof(X==null?void 0:X.turnIndex)=="number"?X.turnIndex:((I=et.value[y])==null?void 0:I[m])??-1;if(se<0)return;const be=ie.reduce((ht,it)=>typeof it.turnIndex=="number"&&it.turnIndex>ht?it.turnIndex:ht,-1);if(be<0||se>be)return;const Ie=be-se;if(Ie<1)return;const ze=((Y=($=Gr.value)==null?void 0:$.cwd)==null?void 0:Y.trim())??"";ze&&await tA(y,m,ze);const pt=await yd(y,Ie);ro(y,pt),Wn(y,[]),Rn(y),B.value[y]&&(B.value=yt(B.value,y)),$t(y,null),Yt(y,null),Gt(y,null),sn=!0,await Jo()}catch(ie){o.value=ie instanceof Error?ie.message:"Failed to rollback thread"}finally{Mo.value=!1}}}function Yo(m,y){const $=(l.value[m]??[]).filter(Y=>Y.messageType!=="compaction.pending"&&Y.messageType!=="compaction.done");$.push({id:`compaction:${y}:${m}:${Date.now()}`,role:"system",text:"",messageType:y==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[m]:$}}function xr(m,y){const I=new Set(en.value);y?I.add(m):I.delete(m),en.value=I}function Sc(m){lr=m.trim(),ir.value=[]}async function sl(m){const y=m.trim();if(!(!y||en.value.has(y))){xr(y,!0),Yo(y,"pending");try{await Ck(y);const I=2e3,$=14,Y=Date.now()+Un;let ie=0;for(;Date.now()<Y&&ie<$&&en.value.has(y);){if((await Qd(y)).messages.some(be=>be.messageType==="compaction.done")){xr(y,!1),n.value===y&&await At(y,{silent:!0,force:!0}),Yo(y,"done"),xo(y);break}ie+=1,await Y1(I)}en.value.has(y)&&(xr(y,!1),Yo(y,"done"),xo(y))}catch(I){o.value=I instanceof Error?I.message:"Failed to compact thread",xr(y,!1),Yo(y,"done"),xo(y)}}}async function Jo(){if(bn.value){typeof window<"u"&&Lt===null&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u));return}bn.value=!0;const m=sn,y=to,I=new Set(nn);sn=!1,to=!1,nn.clear();try{m&&await Ht.loadThreads({force:y});const $=n.value;if(!$)return;const Y=I.has($),ie=j.value[$]===!0,X=$s($),se=Ha.value[$]??"";(X.length>0&&X!==se||Y||ie&&zt.value[$]!==!0||m&&zt.value[$]!==!0)&&await At($,{silent:!0,force:Y})}catch{}finally{bn.value=!1,(sn||nn.size>0)&&typeof window<"u"&&Lt===null&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}}async function Ci(){await sr(),sn=!Ht.hasLoadedThreads.value,n.value&&zt.value[n.value]!==!0&&nn.add(n.value),await Jo()}function na(m){const y=qe(m.params),I=typeof(y==null?void 0:y.threadId)=="string"?y.threadId.trim():"";if(!I)return;const $=qe(y==null?void 0:y.externalSession),Y=$&&typeof $.origin=="string"&&$.origin.trim().length>0?{origin:$.origin.trim(),active:$.active===!0,lastWriteAt:typeof $.lastWriteAt=="string"?$.lastWriteAt:null}:null;he.value={...he.value,[I]:Y},rn(I,(Y==null?void 0:Y.active)===!0),Tn(),sn=!0,n.value===I&&nn.add(I),Lt===null&&typeof window<"u"&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}function Us(){typeof window>"u"||go||(sr(),zs(),nu(),go=Gk(m=>{if(m.method==="ready"){rl(),Ci();return}if(m.method==="externalSessionChanged"){na(m);return}br(m),es(m)}))}async function zs(){try{const m=await eI(),y=Object.entries(m);if(y.length===0)return;const I={...d.value};let $=!1;for(const[Y,ie]of y){const X=ie.filter(ze=>!!ze&&typeof ze.id=="string");if(X.length===0)continue;const se=I[Y]??[],be=new Set(se.map(ze=>ze.text)),Ie=[...se];for(const ze of X)be.has(ze.text)||(Ie.push(ze),be.add(ze.text));I[Y]=Ie.slice(-20),$=!0}$&&(d.value=I,Pd(I))}catch{}}async function nu(){try{const m=await nI(),y=Object.entries(m);if(y.length===0)return;const I={...c.value};let $=!1;for(const[Y,ie]of y){if(!Y||!ie||typeof ie!="object"||Array.isArray(ie))continue;const X={};for(const[Ie,ze]of Object.entries(ie))!Ie||typeof ze!="number"||!Number.isFinite(ze)||ze<=0||(X[Ie]=Math.round(ze));if(Object.keys(X).length===0)continue;const se={...I[Y]??{},...X},be=Object.keys(se);I[Y]=be.length>200?Object.fromEntries(be.slice(-200).map(Ie=>[Ie,se[Ie]])):se,$=!0}$&&(c.value=I,Hm(I))}catch{}}async function il(m){try{return await Vk(m.id,{result:m.result,error:m.error}),Dn(m.id),Zn.value=yt(Zn.value,String(m.id)),!0}catch(y){const I=y instanceof Error?y.message:"Failed to reply to server request";return await ha(m.id)?(o.value=I,Zn.value={...Zn.value,[String(m.id)]:I},!1):(Dn(m.id),Zn.value=yt(Zn.value,String(m.id)),!0)}}function Cn(){if(go&&(go(),go=null),sn=!1,nn.clear(),qo.clear(),Lt!==null&&typeof window<"u"&&(window.clearTimeout(Lt),Lt=null),Bn(),Ht.dispose(),typeof window<"u")for(const m of zn.values())window.clearTimeout(m);zn.clear(),on=!1,r.value={},a.value={},i.value={},v.value={},d.value={},c.value={},B.value={},L.value={},et.value={},mt.value={},st.value={},q.value={},ae.value={},P.clear(),Vm(vt),S.clear(),Rj(),Ct.value={},kt.value={},mn.value={},qt(),Ro(null),xt.value={}}function Oo(m){const y=n.value;if(!y)return;const I=Ya(y,m);if(I){jo(m),M(I.collaborationMode),de=!0,Qt(I.text,I.imageUrls,I.skills,"steer",I.fileAttachments).finally(()=>{de=!1});return}const $=no(y,m);$&&(jo(m),M($.collaborationMode),Qt($.text,$.imageUrls,$.skills,"steer",$.fileAttachments))}function ko(m,y={}){vn(m,y)}return{projectGroups:e,projectDisplayNameById:je,selectedThread:Gr,selectedThreadTokenUsage:ct,selectedThreadTerminalOpen:C,isSelectedThreadInterruptPending:E,selectedThreadServerRequests:Ga,selectedLiveOverlay:we,selectedActiveTurnId:J,lastPlanByThreadId:s,resolveThreadTurnIndex:Sa,codexQuota:qr,selectedThreadId:n,availableCollaborationModes:le,availableModelIds:Se,availableModelReasoningEfforts:Ae,selectedCollaborationMode:Ee,selectedModelId:me,selectedReasoningEffort:ne,selectedSpeedMode:ke,codexCliMissingError:pe,installedSkills:An,accountRateLimitSnapshots:Hr,messages:_t,hasMoreOlderMessages:Kt,isLoadingThreads:Ht.isLoadingThreads,isThreadListFullyLoaded:Ht.isThreadListFullyLoaded,isLoadingMessages:Tt,isLoadingOlderMessages:Pn,isSendingMessage:vo,isInterruptingTurn:Eo,isUpdatingSpeedMode:Q,isRollingBack:Mo,compactingThreadIds:en,fuzzyFileSearchResults:ir,registerFuzzyFileSearchSession:Sc,error:o,refreshAll:ea,refreshSkills:dn,refreshHooks:fr,hooksList:dr,isHooksLoading:Kr,onRealtimeEvent:ao,selectThread:En,loadMessages:At,loadOlderMessages:Br,ensureThreadMessagesLoaded:Ye,setThreadTerminalOpen:qn,toggleSelectedThreadTerminal:gi,archiveThreadById:Si,compactThreadById:sl,renameThreadById:ns,forkThreadById:Ca,forkThreadFromTurn:tu,rollbackSelectedThread:rs,sendMessageToSelectedThread:Qt,sendMessageToNewThread:os,interruptSelectedThreadTurn:ka,interruptedUnsubmittedMessage:_n,clearInterruptedUnsubmittedMessage:Bs,selectedThreadQueuedMessages:St,removeQueuedMessage:jo,reorderQueuedMessage:oo,steerQueuedMessage:Oo,autoCompactThreshold:yo,setAutoCompactThreshold:ln,setSelectedCollaborationMode:M,readModelIdForThread:Le,setSelectedModelIdForThread:lt,setSelectedModelId:Ke,setSelectedReasoningEffort:Ze,updateSelectedSpeedMode:oe,respondToPendingServerRequest:il,pendingReplyErrorForRequest:Rs,renameProject:Ve,removeProject:ge,reorderProject:Ne,pinProjectToTop:xe,startPolling:Us,stopPolling:Cn,primeSelectedThread:ko}}const Py="codex-web-local.sidebar-collapsed.v1",Ry="codex-web-local.accounts-section-collapsed.v1";function RN(){return typeof window>"u"?!1:window.localStorage.getItem(Py)==="1"}function EN(e){typeof window>"u"||window.localStorage.setItem(Py,e?"1":"0")}function MN(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(Ry);return e===null?!0:e==="1"}function jN(){const e=T(RN()),t=T(MN()),n=T(""),o=T(!1),r=T(null),a=T(null);let s=0,i=0,l=!1;function d(L){var j;if(e.value!==L){if(L){const U=(j=f())==null?void 0:j.scrollTop;typeof U=="number"&&(U>0||s===0)&&(s=U)}e.value=L,EN(L),L||S()}}function c(){o.value=!o.value,o.value?Nt(()=>{var L;return(L=a.value)==null?void 0:L.focus()}):n.value=""}function v(){var L;n.value="",(L=a.value)==null||L.focus()}function f(){return r.value?r.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function g(L){if(e.value||l)return;const U=(L==null?void 0:L.currentTarget)&&typeof HTMLElement<"u"&&L.currentTarget instanceof HTMLElement?L.currentTarget:f();s=(U==null?void 0:U.scrollTop)??s}function S(){const L=++i,j=s,U=90;l=!0;const H=()=>{L===i&&(s=j,l=!1)},he=de=>{if(L!==i)return;if(e.value){H();return}const W=f();if(W&&(W.scrollTop=j,Math.abs(W.scrollTop-j)<=1||de>=U)){H();return}if(de>=U||typeof window>"u"){H();return}window.requestAnimationFrame(()=>he(de+1))};Nt(()=>he(0))}function P(L){L.key==="Escape"&&(o.value=!1,n.value="")}function B(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(Ry,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:o,sidebarScrollableRef:r,sidebarSearchInputRef:a,setSidebarCollapsed:d,toggleSidebarSearch:c,clearSidebarSearch:v,onSidebarScroll:g,onSidebarSearchKeydown:P,restoreSidebarScrollPosition:S,toggleAccountsSectionCollapsed:B}}const Ey="codex-web-local.right-panel-width.v1",LN=260,NN=640,Ym=320;function My(e){return Math.min(NN,Math.max(LN,e))}function $N(){if(typeof window>"u")return Ym;const e=window.localStorage.getItem(Ey),t=Number(e);return Number.isFinite(t)?My(t):Ym}function ON(e){typeof window>"u"||window.localStorage.setItem(Ey,String(e))}function DN(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:o}=e,r=T("git"),a=T([]),s=T(""),i=K(()=>a.value.find(pe=>pe.key===s.value)??null),l=T(!1),d=T(!1),c=T(!1),v=T($N()),f=T(!1),g=T(!1);let S=null;function P(){S&&(clearTimeout(S),S=null)}function B(){f.value=!1,g.value=!1,P()}function L(pe){pe.preventDefault();const Q=pe.clientX,me=v.value,ne=$e=>{const te=Q-$e.clientX;v.value=My(me+te)},ke=()=>{ON(v.value),window.removeEventListener("mousemove",ne),window.removeEventListener("mouseup",ke)};window.addEventListener("mousemove",ne),window.addEventListener("mouseup",ke)}function j(){n()&&(t()&&!d.value&&(d.value=!0),t()||(c.value=!1),r.value=r.value==="terminal"?"git":"terminal",r.value!=="terminal"&&B())}function U(pe){r.value=pe,l.value=!1,t()||(c.value=!1),t()&&(d.value=!0),pe!=="terminal"&&B()}function H(pe){const Q=a.value.find(me=>me.path===pe.path);if(Q)s.value=Q.key;else{const me={key:`preview-${Date.now()}`,path:pe.path,label:pe.label};a.value=[...a.value,me],s.value=me.key}U("preview")}function he(pe){a.value.some(Q=>Q.key===pe)&&(s.value=pe,U("preview"))}function de(pe){const Q=a.value.findIndex(ke=>ke.key===pe);if(Q<0)return;const me=a.value.filter(ke=>ke.key!==pe);if(a.value=me,s.value!==pe)return;if(me.length===0){s.value="",r.value="files";return}const ne=me[Math.min(Q,me.length-1)];s.value=ne.key}function W(){if(t()){d.value=!1;return}c.value=!0,l.value=!1,B()}function ve(){if(t()){d.value=!d.value;return}c.value=!c.value,c.value&&(l.value=!1,B())}function Se(){r.value="git",t()&&(d.value=!1),B()}function Ae(pe){if(f.value=pe,!pe){g.value=!1,P();return}g.value=!0,P(),S=setTimeout(()=>{S=null,o()||(g.value=!1)},1500)}return{activeRightPanelTab:r,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:d,isRightPanelCollapsed:c,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:g,onRightResizeHandleMouseDown:L,toggleRightPanelTerminal:j,selectRightPanelTab:U,onOpenFilePreview:H,selectFilePreviewTab:he,closeFilePreviewTab:de,onCloseRightPanel:W,onToggleRightPanelToggle:ve,onHideRightPanelTerminal:Se,onTerminalFocusChange:Ae,resetTerminalKeyboardFocusState:B,clearTerminalKeyboardFocusFallbackTimer:P}}function FN(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 BN(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!FN(e))throw new Error("Copy failed")}const UN=400;function zN(e,t,n,o){return e==="visible"&&!n&&t!==null&&o-t>=UN}const HN={class:"sidebar-root"},qN=["aria-pressed","aria-label","title"],WN={key:1,class:"sidebar-search-bar"},GN=["placeholder"],VN=["aria-label"],KN={class:"sidebar-skills-link-icon","aria-hidden":"true"},YN={class:"sidebar-skills-link-copy"},JN={class:"sidebar-skills-link-title"},QN={class:"sidebar-skills-link-subtitle"},XN={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},ZN={class:"sidebar-skills-link-copy"},e$={class:"sidebar-skills-link-title"},t$={class:"sidebar-skills-link-subtitle"},n$={class:"sidebar-settings-actions"},o$=["title","aria-label"],r$=["title","aria-label"],a$={class:"content-root-wrap"},s$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},i$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},l$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},u$=["aria-label","title"],c$={class:"content-body"},d$={key:2,class:"content-grid content-grid-home"},f$={class:"new-thread-empty"},p$={class:"new-thread-hero"},h$=["title"],m$={class:"new-thread-folder-actions"},v$=["disabled"],g$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},y$={class:"new-thread-launch-card-copy"},w$={class:"new-thread-launch-card-topline"},b$={class:"new-thread-launch-card-badge","aria-hidden":"true"},T$={class:"new-thread-launch-card-eyebrow"},S$={class:"new-thread-launch-card-title"},C$={class:"new-thread-launch-card-text"},x$={class:"new-thread-launch-card-actions"},k$=["aria-label","onKeydown"],I$={class:"new-thread-open-folder-header"},A$={class:"new-thread-open-folder-title"},_$={class:"new-thread-open-folder-label"},P$={class:"new-thread-open-folder-current"},R$=["placeholder","title","disabled","onKeydown"],E$=["disabled"],M$={class:"new-thread-open-folder-actions"},j$={class:"new-thread-open-folder-toggle"},L$=["aria-pressed","disabled"],N$={key:0,class:"new-thread-open-folder-create"},$$={class:"new-thread-open-folder-create-composer"},O$=["placeholder","onKeydown"],D$=["disabled"],F$={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},B$=["href"],U$=["placeholder","onKeydown"],z$={key:1,class:"new-thread-open-folder-error-actions"},H$={class:"new-thread-open-folder-error visible-error-with-feedback"},q$=["href"],W$=["disabled"],G$={key:2,class:"new-thread-open-folder-status"},V$={key:3,class:"new-thread-open-folder-status"},K$={key:4,class:"new-thread-open-folder-list"},Y$=["title","disabled","onClick"],J$={class:"new-thread-open-folder-item-name"},Q$=["disabled","onClick"],X$=["aria-label","onKeydown"],Z$={class:"new-thread-open-folder-header"},eO={class:"new-thread-open-folder-title"},tO=["disabled"],nO=["aria-label"],oO=["aria-selected","disabled"],rO=["aria-selected","disabled"],aO={class:"new-thread-project-field"},sO={class:"new-thread-open-folder-label"},iO=["disabled","placeholder"],lO={key:0,class:"new-thread-project-field"},uO={class:"new-thread-open-folder-label"},cO=["disabled","placeholder","onKeydown"],dO={key:1,class:"new-thread-project-field"},fO={class:"new-thread-open-folder-label"},pO=["disabled","onKeydown"],hO={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},mO=["href"],vO={class:"new-thread-project-modal-actions"},gO=["disabled"],yO=["disabled"],wO={key:3,class:"new-thread-branch-select"},bO={class:"new-thread-branch-select-label"},TO={class:"new-thread-branch-select-help"},SO={key:4,class:"new-thread-runtime-help"},CO={class:"worktree-init-status-title"},xO={class:"worktree-init-status-message"},kO={class:"composer-with-queue"},IO={key:0,class:"composer-runtime-error",role:"alert"},AO=["href"],_O={key:3,class:"content-grid"},PO={class:"content-thread"},RO={key:0,class:"external-session-banner",role:"alert"},EO={key:1,class:"composer-runtime-error",role:"alert"},MO=["href"],jO={key:2,class:"interrupt-recovered-banner",role:"status"},LO=["aria-label"],NO={class:"content-right-panel-header"},$O={class:"content-right-panel-tabs",role:"tablist"},OO=["aria-selected"],DO=["aria-selected"],FO=["aria-selected","title","onClick"],BO={class:"content-right-panel-tab-label"},UO=["aria-label","title","onClick"],zO={class:"content-right-panel-actions"},HO={class:"content-right-panel-add-wrap"},qO=["aria-label","title"],WO={key:0,class:"content-right-panel-menu"},GO=["aria-label","title"],VO={class:"content-right-panel-body"},KO={key:0,class:"project-zip-modal-backdrop",role:"presentation"},YO=["aria-label"],JO={class:"project-zip-modal-header"},QO={class:"project-zip-modal-title"},XO=["aria-label","disabled"],ZO={class:"project-zip-modal-copy"},eD={class:"project-zip-progress-label",role:"status","aria-live":"polite"},tD={class:"project-zip-progress-track"},nD={key:0,class:"project-zip-modal-error",role:"alert"},oD={class:"project-zip-modal-actions"},rD=["disabled"],aD=["disabled"],sD=["disabled"],iD=["aria-label"],lD={class:"codex-login-modal-header"},uD={class:"codex-login-modal-title"},cD=["aria-label","disabled"],dD={class:"codex-login-modal-copy"},fD=["href"],pD=["placeholder","disabled"],hD={key:1,class:"codex-login-modal-error visible-error-with-feedback"},mD=["href"],vD={class:"codex-login-modal-actions"},gD=["disabled"],yD=["disabled"],wD=400,Jm="codex-web-local.send-with-enter.v1",Qm="codex-web-local.in-progress-send-mode.v1",Xm="codex-web-local.dark-mode.v1",Zm="codex-web-local.dictation-click-to-toggle.v1",ev="codex-web-local.dictation-auto-send.v1",tv="codex-web-local.dictation-language.v1",nv="codex-web-local.chat-width.v1",bD=hn({__name:"App",setup(e){var $p,Op;const t=Ar(()=>_r(()=>import("./ThreadConversation-Bx1bFGUl.js"),__vite__mapDeps([0,1,2]))),n=Ar(()=>_r(()=>import("./ThreadTerminalPanel-CR04tNVA.js"),__vite__mapDeps([3,4]))),o=Ar(()=>_r(()=>import("./ReviewPane-BPu58eNW.js"),__vite__mapDeps([5,6]))),r=Ar(()=>_r(()=>import("./DirectoryHub-B0r0JD4Y.js"),__vite__mapDeps([7,1,8]))),a=Ar(()=>_r(()=>import("./AutomationsPanel-o9elVnFr.js"),__vite__mapDeps([9,10]))),s=Ar(()=>_r(()=>import("./SettingsDialog-B0HUh4it.js"),__vite__mapDeps([11,12]))),i=Ar(()=>_r(()=>import("./RightGitPanel-DLd-Bkw8.js"),__vite__mapDeps([13,14]))),l=Ar(()=>_r(()=>import("./RightFilesPanel-rBbhhcHg.js"),__vite__mapDeps([15,16]))),d=Ar(()=>_r(()=>import("./RightFilePreview-DG_IORfL.js"),__vite__mapDeps([17,18]))),c=Ar(()=>_r(()=>import("./ThreadPendingRequestPanel-IUYdge4_.js"),__vite__mapDeps([19,20]))),v=Ar(()=>_r(()=>import("./QueuedMessages-BN-LwcoG.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:g,uiLanguageOptions:S,setUiLanguage:P}=da(),B="codex-mobile",L="0.1.111",j={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},U={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:H,projectDisplayNameById:he,selectedThread:de,selectedThreadTokenUsage:W,selectedThreadServerRequests:ve,selectedLiveOverlay:Se,lastPlanByThreadId:Ae,resolveThreadTurnIndex:pe,selectedActiveTurnId:Q,codexQuota:me,selectedThreadId:ne,availableCollaborationModes:ke,availableModelIds:$e,availableModelReasoningEfforts:te,selectedCollaborationMode:ce,selectedReasoningEffort:Le,selectedSpeedMode:Pe,codexCliMissingError:Fe,installedSkills:Ke,accountRateLimitSnapshots:lt,messages:Ze,hasMoreOlderMessages:ut,isLoadingThreads:fe,isThreadListFullyLoaded:N,isLoadingMessages:oe,isLoadingOlderMessages:le,isSendingMessage:Ee,isInterruptingTurn:Be,isSelectedThreadInterruptPending:A,isUpdatingSpeedMode:M,error:z,refreshAll:Z,refreshSkills:ue,refreshHooks:re,hooksList:je,isHooksLoading:Re,onRealtimeEvent:xe,selectThread:ge,ensureThreadMessagesLoaded:Ve,loadMessages:Ne,loadOlderMessages:He,archiveThreadById:Ue,compactThreadById:Je,compactingThreadIds:et,fuzzyFileSearchResults:st,registerFuzzyFileSearchSession:mt,forkThreadById:q,renameThreadById:ae,forkThreadFromTurn:_e,sendMessageToSelectedThread:Ye,sendMessageToNewThread:bt,interruptSelectedThreadTurn:Tt,interruptedUnsubmittedMessage:At,clearInterruptedUnsubmittedMessage:Br,selectedThreadQueuedMessages:zt,removeQueuedMessage:Ha,reorderQueuedMessage:fa,steerQueuedMessage:pa,autoCompactThreshold:ar,setAutoCompactThreshold:Ur,setSelectedCollaborationMode:zr,readModelIdForThread:Ps,setSelectedModelIdForThread:qa,setSelectedReasoningEffort:Wa,updateSelectedSpeedMode:Uo,respondToPendingServerRequest:sr,pendingReplyErrorForRequest:Zn,renameProject:Rs,removeProject:ha,reorderProject:Es,pinProjectToTop:zo,startPolling:Po,stopPolling:Dn,primeSelectedThread:Ga,rollbackSelectedThread:Ms}=PN(),vt=rx(),Ct=ox(),{isMobile:kt}=Of();function mn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const Fn=T(null),ho=T(null),Hr=T(null);let qr=null;const{buildFeedbackMailto:mo,feedbackMailtoBase:Ho,recordVisibleFailure:Ro}=ey(),Bn=Ho();function xt(u,p){p&&Ro(p);const b=u.currentTarget;b instanceof HTMLAnchorElement&&(b.href=mo())}const eo=T(null),vo=T(null),Eo=T(null),Mo=T(0);let en=null;function Un(){const u=Eo.value;if(!u)return;const p=window.getComputedStyle(u),b=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),O=Math.max(0,u.clientWidth-(Number.isFinite(b)?b:0)),V=window.getComputedStyle(u).getPropertyValue("--chat-column-max").trim(),Te=Number.parseFloat(V)*(V.endsWith("rem")?16:1),De=Number.isFinite(Te)&&Te>0?Math.min(O,Te):O;Mo.value=De}const ir=T(null),lr=T(null),bn=T(!0),ma=DN({isMobile:()=>kt.value,canShowRightPanel:()=>su.value,isVirtualKeyboardOpen:()=>pl.value}),{activeRightPanelTab:tn,filePreviewTabs:Wr,activeFilePreviewTabKey:go,activeFilePreviewTab:Lt,isRightPanelMenuOpen:zn,isMobileRightPanelOpen:sn,isRightPanelCollapsed:to,rightPanelWidth:nn,isTerminalInputFocused:Va,isTerminalKeyboardFocusFallbackActive:on,onRightResizeHandleMouseDown:qo,toggleRightPanelTerminal:ur,selectRightPanelTab:Ht,onOpenFilePreview:js,selectFilePreviewTab:Gr,closeFilePreviewTab:Wo,onCloseRightPanel:yo,onToggleRightPanelToggle:qt,onHideRightPanelTerminal:Ka,onTerminalFocusChange:no,resetTerminalKeyboardFocusState:Ya,clearTerminalKeyboardFocusFallbackTimer:wo}=ma,Vr=T(null),bo=T(!1),jo=T("");let oo=!1;const cr=T(!1),St=T(""),ln=T("local"),In=T({}),dr=new Map,An=T(""),Kr=T([]),fr=T(!1),dn=T({order:[],labels:{},projectOrder:[]}),C=T({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),E=T({phase:"idle",title:"",message:""}),J=jN(),{isSidebarCollapsed:we,isAccountsSectionCollapsed:ct,sidebarSearchQuery:_t,isSidebarSearchVisible:_n,sidebarScrollableRef:Kt,sidebarSearchInputRef:Pn,setSidebarCollapsed:Wt,toggleSidebarSearch:vn,clearSidebarSearch:mi,onSidebarScroll:pr,onSidebarSearchKeydown:hr,toggleAccountsSectionCollapsed:Ls}=J,mr=T(null),Yr=T(null),Tn=T(null),vr=T(null);let Lo=null,va=0,$t=0,ga=0,rn=0;const gr=T("New Project (1)"),ya=T(""),Sn=T(!1),Ns=T("general");let Ja=0;function ol(){if(Sn.value){Ja=Date.now(),Sn.value=!1;return}Date.now()-Ja<wD||(Sn.value=!0)}const Hn=T(!1),Yt=T(!1),Gt=T(new Set);async function vi(){try{Gt.value=new Set(await $k())}catch{}finally{Yt.value=!0}}const rl=K(()=>!Yt.value||Gt.value.has("hooks/list")),$s=K(()=>!Yt.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>Gt.value.has(u)));nt(Sn,u=>{u&&(re(),wi(),$s.value&&Ds())});const qn=T({enabled:!1,clients:[]}),gi=T(null),ro=T(!1),un=T(!1),Wn=T(""),yr=T(""),wr=T("");let Go=null,wa=!1,Qa=null;const Jr=T("never"),yi=T(!1),ba=T(!1),Rn=T(""),To=T("");let Xa=!1;const Ta=T(!1);async function wi(u={}){if(!(u.force!==!0&&Xa)){yi.value=!0,Rn.value="";try{Jr.value=await gI(),Xa=!0}catch(p){Rn.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{yi.value=!1}}}function Os(u){Jr.value=u}async function Gn(){ba.value=!0,Rn.value="",To.value="";try{await yI(Jr.value),Ta.value=!0,To.value=f("Approval policy saved"),Vo&&clearTimeout(Vo),Vo=setTimeout(()=>{To.value=""},2200)}catch(u){Rn.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{ba.value=!1}}let Vo=null;async function Ds(u={}){if(!(u.force!==!0&&wa)){ro.value=!0,yr.value="";try{const p=await vI();qn.value=p,wa=!0}catch(p){yr.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{ro.value=!1}}}async function Fs(){const u=!qn.value.enabled;un.value=!0,Wn.value=u?"enable":"disable";try{await wI(u),qn.value={...qn.value,enabled:u},Sa(u?"Remote control enabled":"Remote control disabled")}catch(p){yr.value=p instanceof Error?p.message:"Failed to update remote control"}finally{un.value=!1,Wn.value=""}}async function bi(){un.value=!0,Wn.value="pairing";try{gi.value=await bI()}catch(u){yr.value=u instanceof Error?u.message:"Failed to start pairing"}finally{un.value=!1,Wn.value=""}}async function al(){un.value=!0,Wn.value="clients";try{qn.value={...qn.value,clients:await TI()}}catch(u){yr.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{un.value=!1,Wn.value=""}}async function Ti(u){un.value=!0,Wn.value=`revoke:${u}`;try{await SI(u),qn.value={...qn.value,clients:qn.value.clients.filter(p=>p.clientId!==u)},Sa("Remote client removed")}catch(p){yr.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{un.value=!1,Wn.value=""}}function Sa(u){wr.value=u,Go&&clearTimeout(Go),Go=setTimeout(()=>{wr.value=""},3e3)}const Qr=T(""),Xr=T(""),Za=T([]),So=T(null),No=T(null),$o=T(null),Zr=T(null),x=T(!1),R=T(!1),k=T({addedLineCount:0,removedLineCount:0}),G=T([]),We=T(""),Ot=T({}),ao=T(""),Co=T(""),cn=T({}),br=T(""),es=T(""),ts=T(!1),Tr=T(!1);function Tc(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const eu=T(null),Vn=T([]),Sr=T(!1),Cr=T(!1),ea=T(!1),En=T(!1),Si=T(!1),ns=T(""),Ca=T(""),tu=T(null),xa=T(""),Ko=T(""),xo=T(""),Qt=T(""),os=T(Jc(Jm,!0)),ta=T(zb()),ka=T(Ub()),Bs=T(Hb()),rs=T(Jc(Zm,!1)),Yo=T(Jc(ev,!0)),xr=T(aT()),Sc=K(()=>sT()),sl=K(()=>{const{loaded:u,total:p}=C.value,b=pp(u);return p&&p>0?`${b} / ${pp(p)}`:u>0?b:f("Preparing...")}),Jo=K(()=>{const{loaded:u,total:p,phase:b}=C.value;return b==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),Ci=T(!1),na=T(!1),Us=T(!1),zs=T(""),nu=T(!1),il=T(null),Cn=T(!1),Oo=T(""),ko=T("codex"),m=K(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),y=T(""),I=T(""),$=T("responses"),Y=T("responses"),ie=T(""),X=T(!1),se=T(""),be=T(""),Ie=T(""),ze=T(!1),pt=T(!1),ht=T(""),it=T(""),Pt=T(!1),Ia=T(!1),Kn=T("create"),Hs=T(""),oa=T(""),Aa=T(""),qs=T(!1),Qo=T(""),Mn=T(!1),xi=T(null),ll=T(null),kr=T(!1),ul=T(null),ou=T(null),ra=T(""),Do=T(""),as=T(""),ki=T([]),fn=T(""),Ce=T(!1),wt=T(!1),Fo=T(!1),so=T(""),ru=[z,Fe,We,Co,Qt,Oo,Ie,it,Qo,fn],jy=K(()=>ru.some(u=>u.value.trim().length>0)),aa=T({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Cc=T(null),xc=T(!1),kc=T(!1),Ws=T(typeof window<"u"?(($p=window.visualViewport)==null?void 0:$p.height)??window.innerHeight:0),Ic=T(typeof window<"u"?((Op=window.visualViewport)==null?void 0:Op.offsetTop)??0:0),cl=T(typeof window<"u"?window.innerHeight:0);let ss=null,Ac=!1,_c=!1,Pc=!1,dl=0;const Gs=K(()=>{const u=vt.params.threadId;return typeof u=="string"?u:""}),gn=K(()=>vt.name==="home"),is=K(()=>vt.name==="skills"),Vs=K(()=>vt.name==="automations"),Kf=K(()=>{const u=vt.query.automationId;return typeof u=="string"?u:""}),Ly=K(()=>{var u;return Vs.value?f("Automations"):is.value?f("Skills"):gn.value?f("Start new thread"):((u=de.value)==null?void 0:u.title)??f("Choose a thread")}),Ny=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",$y=K(()=>{var p,b;return(((b=(p=de.value)==null?void 0:p.title)==null?void 0:b.trim())??"")||Ny}),fl=K(()=>Ze.value.filter(u=>{const p=lT(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),Yf=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Rc=T(null);function Oy(u,p,b){const O=typeof p.turnIndex=="number"?p.turnIndex:-1;return O<0?!1:u.some((V,Te)=>Te>b&&typeof V.turnIndex=="number"&&V.turnIndex>=O&&Yf.has(V.messageType??""))}function Dy(u,p){return u.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=p&&Yf.has(b.messageType??""))}const Ec=K(()=>{const u=fl.value,p=oe.value;for(let Te=u.length-1;Te>=0;Te-=1){const De=u[Te];if(De.messageType!=="plan"&&De.messageType!=="plan.live")continue;const Ft=Nm(De);if(!Ft||Rc.value!==null&&De.id===Rc.value)return null;const hT=p?!0:Oy(u,De,Te);return{id:De.id,streaming:De.messageType==="plan.live",explanation:Ft.explanation,steps:Ft.steps,implemented:hT}}const b=ne.value?Ae.value[ne.value]??null:null;if(!b)return null;const O=Nm(b);if(!O)return null;const V=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?pe(ne.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:O.explanation,steps:O.steps,implemented:p?!0:V>=0?Dy(u,V):!1}}),Fy=K(()=>Se.value),Ks=K(()=>gn.value?"__new-thread__":ne.value),Jf=K(()=>Ps(Ks.value)),au=K(()=>{const u=ve.value;return u.length>0?u[u.length-1]:null}),By=K(()=>au.value?Zn(au.value.id):""),yn=K(()=>{var u,p;return gn.value?St.value.trim():((p=(u=de.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),su=K(()=>bn.value&&(gn.value&&yn.value.length>0||vt.name==="thread"&&ne.value.length>0)),Uy=K(()=>su.value&&tn.value==="terminal"),pl=K(()=>!kt.value||Ws.value<=0||cl.value<=0?!1:cl.value-Ws.value>120),zy=K(()=>pl.value||Uy.value&&on.value),Qf=K(()=>{var u,p;return((p=(u=de.value)==null?void 0:u.cwd)==null?void 0:p.trim())??St.value.trim()}),Mc=K(()=>{var u;return!gn.value&&((u=de.value)==null?void 0:u.inProgress)===!0}),Hy=K(()=>{const u=ne.value;return!!u&&et.value.has(u)}),Xf=K(()=>{var u,p;return!gn.value&&((p=(u=de.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),jc=K(()=>Ee.value||Be.value||Mc.value||ve.value.length>0);function Zf(){Ci.value&&(Ci.value=!1,iI(!0))}function qy(){Zf(),Ct.push({name:"skills",query:{tab:"plugins"}})}function Wy(){const u=ne.value;u&&Je(u)}function Lc(u,p){const b=Xe(u).trim(),O=Bo(b);return!b||!O?!1:p.some(V=>{const Te=Xe(V).trim();return Te!==b&&Bo(Te)===O})}function Nc(u,p=""){const b=Xe(u).trim(),O=p.trim();if(O)return O;const V=Bo(b),Te=[...dn.value.order,...H.value.map(De=>{var Ft,Io;return((Io=(Ft=De.threads[0])==null?void 0:Ft.cwd)==null?void 0:Io.trim())??""}).filter(Boolean)];return Lc(b,Te)?b:V}function Gy(){const u=new Set(dn.value.order),p=dn.value.projectOrder.filter(b=>u.has(b));for(const b of dn.value.order)p.includes(b)||p.push(b);return p}function hl(u){const p=Xe(u).trim(),b=[...dn.value.order,...H.value.map(O=>{var V,Te;return((Te=(V=O.threads[0])==null?void 0:V.cwd)==null?void 0:Te.trim())??""}).filter(Boolean)];return Lc(p,b)?p:Bo(p)}function ep(u){const p=Xe(u).trim();if(!p)return"";const b=[...dn.value.order,...H.value.map(O=>{var V,Te;return((Te=(V=O.threads[0])==null?void 0:V.cwd)==null?void 0:Te.trim())??""}).filter(Boolean)];for(const O of dn.value.order){const V=Xe(O).trim();if(!V)continue;const Te=Bo(V),De=Lc(V,b)?V:Te;if(V===p||De===p||Te===p)return V}return""}const $c=K(()=>{var O,V;const u=[],p=new Set;for(const Te of Gy()){const De=Te.trim();!De||p.has(De)||(p.add(De),u.push({value:De,label:Nc(De,dn.value.labels[De])}))}for(const Te of H.value){const De=((V=(O=Te.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"";!De||p.has(De)||Ku(De)||(p.add(De),u.push({value:De,label:Nc(De,he.value[Te.projectName])}))}const b=St.value.trim();return b&&!p.has(b)&&u.unshift({value:b,label:Nc(b)}),u}),Ys=K(()=>{const u=St.value.trim();return u?In.value[u]===!0:!1}),Vy=K(()=>{var p,b;const u={};for(const O of H.value){const V=Ai(O.projectName,((b=(p=O.threads[0])==null?void 0:p.cwd)==null?void 0:b.trim())??"");u[O.projectName]=V?In.value[V]===!0:!1}return u}),Oc=K(()=>{const u=An.value.trim(),p=[...Kr.value];return u&&!p.some(b=>b.value===u)&&p.unshift({value:u,label:u}),p}),tp=K(()=>{const u=An.value.trim();if(!u)return"";const p=Oc.value.find(b=>b.value===u);return(p==null?void 0:p.label)??u}),np=K(()=>Do.value.trim()),op=K(()=>{const u=ht.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Ky=K(()=>op.value&&np.value.trim().length>0&&!fn.value),rp=K(()=>{const u=oa.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),ap=K(()=>Hs.value.trim()?Kn.value==="create"?rp.value:Aa.value.trim().length>0:!1),ml=K(()=>{const u=Xe(ra.value).trim();return u||Do.value.trim()}),Yy=K(()=>Pt.value?"Creating…":"Create"),Jy=K(()=>Mn.value?Kn.value==="clone"?f("Cloning…"):f("Creating…"):Kn.value==="clone"?f("Clone repository"):f("Create project")),Qy=K(()=>{const u=Do.value.trim(),p=as.value.trim();return!!(u&&p&&u!==p)}),sp=K(()=>{const u=[];Qy.value&&u.push({key:`parent:${as.value}`,name:"..",path:as.value,kind:"parent"});for(const p of ki.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),Dc=K(()=>{const u=so.value.trim().toLowerCase();return u?sp.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):sp.value}),Ii=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Xy=K(()=>f(j[Bs.value].label)),Zy=K(()=>{const u=j[Bs.value],p=Math.max(0,cl.value-Ws.value-Ic.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":Ws.value>0?`${Ws.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Ic.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),ew=K(()=>{if(!aa.value.configured)return f("Not configured");const u=aa.value.active?f("Online"):f("Configured (offline)"),p=aa.value.allowAllUsers?f("allow all users"):`${aa.value.allowedUsers} ${f("allowed user(s)")}`,b=`${aa.value.mappedChats} ${f("chat(s)")}, ${aa.value.mappedThreads} ${f("thread(s)")}, ${p}`,O=aa.value.lastError?`, ${f("error")}: ${aa.value.lastError}`:"";return`${u}, ${b}${O}`});pi(()=>{var u,p;document.addEventListener("pointerdown",yp),window.addEventListener("keydown",gp),document.addEventListener("visibilitychange",wp),window.addEventListener("pageshow",bp),window.addEventListener("focus",Tp),window.addEventListener("resize",Js),(u=window.visualViewport)==null||u.addEventListener("resize",Js),(p=window.visualViewport)==null||p.addEventListener("scroll",Js),Js(),pu(),Ii==null||Ii.addEventListener("change",pu),qr=xe(b=>{Hr.value&&Hr.value.refreshFromNotification(b)}),Qa=xe(b=>{b==="remoteControl/status/changed"&&Ds({force:!0})}),uT(),jb(),vi(),ow(),us(),Ir(),lp(),Fc(),Qc(),eb(),wi()}),nt(ru,(u,p)=>{u.forEach((b,O)=>{if(b===p[O])return;const V=b.trim();V&&Ro(V)})}),nt(Eo,u=>{en&&(en.disconnect(),en=null),typeof ResizeObserver<"u"&&(en=new ResizeObserver(Un),u&&en.observe(u)),Un()},{immediate:!0}),Jl(()=>{var u,p;document.removeEventListener("pointerdown",yp),window.removeEventListener("keydown",gp),document.removeEventListener("visibilitychange",wp),window.removeEventListener("pageshow",bp),window.removeEventListener("focus",Tp),window.removeEventListener("resize",Js),(u=window.visualViewport)==null||u.removeEventListener("resize",Js),(p=window.visualViewport)==null||p.removeEventListener("scroll",Js),Ii==null||Ii.removeEventListener("change",pu),en&&(en.disconnect(),en=null),ss!==null&&(window.clearInterval(ss),ss=null),Lo&&(clearTimeout(Lo),Lo=null),wo(),Dn(),qr&&(qr(),qr=null),Qa&&(Qa(),Qa=null),Go&&(clearTimeout(Go),Go=null)});function Js(){var u,p;typeof window>"u"||(cl.value=Math.max(cl.value,window.innerHeight),Ws.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Ic.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}nt(_t,u=>{const p=u.trim();if(Lo&&(clearTimeout(Lo),Lo=null),!p){vr.value=null;return}Lo=setTimeout(()=>{Ax(p,1e3).then(b=>{_t.value.trim()===p&&(vr.value=b.threadIds)}).catch(()=>{_t.value.trim()===p&&(vr.value=null)})},220)}),nt(pl,u=>{u||(on.value=!1)}),nt(Vn,()=>{if(typeof window>"u")return;if(!Vn.value.some(p=>p.quotaStatus==="loading")){ss!==null&&(window.clearInterval(ss),ss=null);return}ss===null&&(ss=window.setInterval(()=>{Ac||(Ac=!0,vl({silent:!0}).finally(()=>{Ac=!1}))},1500))},{deep:!0}),nt(lt,()=>{ip().then(u=>{u&&Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function ip(){if(!_c||Pc||ko.value!=="codex"||Vn.value.length>0||lt.value.length===0)return!1;Pc=!0;const u=JSON.stringify(Vn.value.map(b=>b.accountId).sort());try{const b=await fm();Vn.value=b.accounts}catch{await vl({silent:!0})}const p=JSON.stringify(Vn.value.map(b=>b.accountId).sort());return u!==p}function tw(){ue({force:!0})}function nw(u){u&&Ne(u,{silent:!0,force:!0})}async function Fc(){try{aa.value=await Xk()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";aa.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function lp(){try{const u=await Qk();se.value=u.botToken,be.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
79
|
-
`),Ie.value=""}catch(u){Ie.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function ow(){const u=await sI();Ci.value=u.dismissed!==!0}function rw(u){const p=u.split(/[\n,]/).map(V=>V.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=p.includes("*"),O=Array.from(new Set(p.filter(V=>/^-?\d+$/.test(V)).map(V=>Number.parseInt(V,10))));return b?["*",...O]:O}async function aw(){const u=se.value.trim(),p=rw(be.value);if(!u){Ie.value=f("Telegram bot token is required.");return}if(p.length===0){Ie.value=f("At least one allowed Telegram user ID or * is required.");return}ze.value=!0,Ie.value="";try{await Jk(u,p),be.value=p.map(b=>String(b)).join(`
|
|
80
|
-
`),await Promise.all([lp(),Fc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){Ie.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),Fc()}finally{ze.value=!1}}function sw(u){u&&(vt.name==="thread"&&Gs.value===u||(Ct.push({name:"thread",params:{threadId:u}}),kt.value&&Wt(!0)))}function iw(u){vt.name==="automations"&&Kf.value!==u&&Ct.replace({name:"automations",query:u?{automationId:u}:{}})}async function lw(u){var p;we.value&&(Wt(!1),await Nt()),(p=Fn.value)==null||p.openAutomationEditorFromPanel(u)}async function uw(){var u;we.value&&(Wt(!1),await Nt()),(u=Fn.value)==null||u.openAutomationCreatorFromPanel()}function cw(){var u;vt.name==="automations"&&((u=ho.value)==null||u.loadAutomations())}async function dw(u){u&&ne.value===u&&await Db()}function fw(u){return u.length>8?u.slice(-8):u}function up(u){const p=[u.planType||f("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function pw(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function iu(u){return u.unavailableReason==="payment_required"||pw(u.quotaError)}function hw(u){return Sr.value||Cr.value||ea.value||En.value||xa.value.length>0||u.isActive&&xa.value!==u.storageId&&jc.value}function Bc(u){return Ko.value===u.storageId}function mw(u){return xo.value===u.storageId||Bc(u)}function vw(u){return iu(u)?f("Unavailable"):u.isActive?f("Active"):Cr.value?f("Switching…"):f("Switch")}function gw(u){return xa.value===u.storageId?f("Removing…"):Bc(u)?f("Click again to remove"):f("Remove")}function yw(u){xo.value=u}function ww(u){xo.value===u&&(xo.value=""),xa.value!==u&&Ko.value===u&&(Ko.value="")}function bw(u){const p=u.quotaSnapshot;if(!p)return null;const b=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(Te=>Te!==null),O=b.find(Te=>Te.windowMinutes===7*24*60);if(O)return O;const V=b.filter(Te=>typeof Te.windowMinutes=="number"&&Te.windowMinutes>=7*24*60).sort((Te,De)=>(Te.windowMinutes??0)-(De.windowMinutes??0))[0]??null;return V||(p.secondary??null)}function Tw(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function cp(u){var Te,De;if(iu(u))return u.quotaError||f("402 Payment Required");const p=u.quotaSnapshot,b=bw(u),O=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,V=b??O;if(V){const Ft=Math.max(0,Math.min(100,100-Math.round(V.usedPercent))),Io=Tw(V.resetsAt);return Io?`${Ft}% ${f("weekly remaining")} · ${Io}`:`${Ft}% ${f("weekly remaining")}`}return(Te=p==null?void 0:p.credits)!=null&&Te.unlimited?f("Unlimited credits"):(De=p==null?void 0:p.credits)!=null&&De.hasCredits&&p.credits.balance?`${p.credits.balance} ${f("credits")}`:u.quotaStatus==="loading"?f("Loading quota…"):u.quotaStatus==="error"?u.quotaError||f("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?f("Quota unavailable"):f("Fetching account details…")}function Sw(u){return[u.email||f("Account"),up(u),iu(u)?f("Unavailable account"):null,cp(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
81
|
-
`)}async function vl(u={}){try{const p=await xI();Vn.value=p.accounts,p.accounts.some(b=>b.storageId===xo.value)||(xo.value=""),p.accounts.some(b=>b.storageId===Ko.value)||(Ko.value="")}catch(p){if(u.silent===!0)return;Qt.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Cw(){if(!(Sr.value||Cr.value||ea.value||En.value)){Qt.value="",xo.value="",Ko.value="",Sr.value=!0;try{const u=await fm();Vn.value=u.accounts,Dn(),Po(),Z({includeSelectedThreadMessages:!0})}catch(u){Qt.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{Sr.value=!1}}}async function xw(u){if(!(Cr.value||Sr.value||ea.value||En.value)){if(jc.value){Qt.value=f("Finish the current turn and pending requests before switching accounts.");return}Qt.value="",xo.value="",Ko.value="",Cr.value=!0;try{const p=await AI(u);Vn.value=Vn.value.map(b=>b.storageId===u?p:{...b,isActive:!1}),Dn(),Po(),Z({includeSelectedThreadMessages:!0}),vl({silent:!0})}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to switch account")}finally{Cr.value=!1}}}async function kw(){var u;if(!(Sr.value||Cr.value||ea.value||En.value)){Qt.value="",Ca.value="",ea.value=!0;try{const p=await kI();ns.value=p,Si.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Nt(),(u=tu.value)==null||u.focus()}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{ea.value=!1}}}function Uc(){En.value||(Si.value=!1,Ca.value="")}async function Iw(){const u=Ca.value.trim();u&&await Aw(u)}async function Aw(u){if(!(En.value||u.length===0)){Qt.value="",En.value=!0;try{const p=await II(u);Vn.value=p.accounts,ns.value="",Ca.value="",Si.value=!1,Dn(),Po(),Z({includeSelectedThreadMessages:!0})}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{En.value=!1}}}async function _w(u){if(Sr.value||Cr.value||ea.value||En.value||xa.value.length>0)return;const p=Vn.value.find(O=>O.storageId===u)??null;if(!p)return;if(Ko.value!==u){Ko.value=u;return}if(p.isActive&&jc.value){Qt.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=p.isActive;Qt.value="",Ko.value="",xa.value=u;try{const O=await _I(u);Vn.value=O.accounts,Dn(),Po(),b&&Z({includeSelectedThreadMessages:!0}),vl({silent:!0})}catch(O){Qt.value=O instanceof Error?O.message:f("Failed to remove account")}finally{xa.value=""}}function Pw(u){Ue(u)}function Rw(u){Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function Ew(u){const p=await q(u);p&&(gn.value?await Ct.replace({name:"thread",params:{threadId:p}}):await Ct.push({name:"thread",params:{threadId:p}}),kt.value&&Wt(!0))}function dp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function Ai(u,p=""){var Te,De,Ft;const b=H.value.find(Io=>Io.projectName===u);if(!b)return ep(u)||p.trim();const O=b.threads.find(Io=>!dp(Io.cwd));return(((Te=O==null?void 0:O.cwd)==null?void 0:Te.trim())??((Ft=(De=b.threads[0])==null?void 0:De.cwd)==null?void 0:Ft.trim())??"")||ep(u)||p.trim()}function Mw(u){var O,V;const p=H.value.find(Te=>Te.projectName===u),b=Ai(u,((V=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"");b&&(St.value=b),kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}function jw(u){var b;let p="";for(const O of H.value){const V=O.threads.find(Te=>Te.id===u);if((b=V==null?void 0:V.cwd)!=null&&b.trim()){p=V.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function lu(u){var b,O;const p=H.value.find(V=>V.projectName===u);return Ai(u,((O=(b=p==null?void 0:p.threads[0])==null?void 0:b.cwd)==null?void 0:O.trim())??"")}const fp=K(()=>Object.fromEntries(H.value.map(u=>[u.projectName,lu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function Lw(u){return(he.value[u]??u).trim()||u}function Nw(u){return Lw(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function $w(u){const p=lu(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function Ow(u){const p=lu(u);await mp(p)}async function Dw(u){const p=Fw(u);await mp(p)}function Fw(u){var p;for(const b of H.value){const O=b.threads.find(V=>V.id===u);if((p=O==null?void 0:O.cwd)!=null&&p.trim())return O.cwd.trim()}return""}function pp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let b=u,O=0;for(;b>=1024&&O<p.length-1;)b/=1024,O+=1;return`${b>=10||O===0?b.toFixed(0):b.toFixed(1)} ${p[O]}`}function Bw(u,p){const b=URL.createObjectURL(u),O=document.createElement("a");O.href=b,O.download=p,document.body.appendChild(O),O.click(),document.body.removeChild(O),window.setTimeout(()=>URL.revokeObjectURL(b),3e4)}async function Uw(u,p){const O={files:[new File([u],p,{type:u.type||"application/zip"})],title:p};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(O))))throw new Error("File sharing is not supported in this browser.");await navigator.share(O)}function hp(){C.value.phase!=="exporting"&&(C.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function zw(){const{blob:u,fileName:p}=C.value;!u||!p||(C.value={...C.value,error:""},Bw(u,p))}async function Hw(){const{blob:u,fileName:p}=C.value;if(!(!u||!p))try{C.value={...C.value,error:""},await Uw(u,p)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const O=b instanceof Error?b.message:"",V=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(O);C.value={...C.value,error:V?f("This browser blocked sharing the ZIP. Use Download instead."):O||f("Failed to share project. Use Download instead.")}}}async function mp(u){if(!(!u||typeof document>"u")){C.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:p,fileName:b}=await zI(u,({loaded:O,total:V})=>{C.value={...C.value,phase:"exporting",loaded:O,total:V}});C.value={phase:"ready",loaded:p.size,total:p.size,blob:p,fileName:b,error:""}}catch(p){if(C.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},p instanceof DOMException&&p.name==="AbortError")return;const b=p instanceof Error?p.message:"Failed to export project.";window.alert(b)}}}async function qw(u){const p=lu(u);if(!p||typeof window>"u"||(await uu(p),In.value[p]!==!0))return;const b=`${Nw(u)}-`,O=window.prompt("New worktree folder name",b);if(O===null)return;const V=O.trim();if(V){if(V.includes("/")||V.includes("\\")||V==="."||V===".."){window.alert("Worktree name must be a single folder name.");return}try{const Te=await MI(p,V),De=await Tu(Te.cwd,{createIfMissing:!1,label:""});if(!De)return;St.value=De,ln.value="local",zo(hl(De)),await us(),await Ir(),kt.value&&Wt(!0),gn.value||await Ct.push({name:"home"})}catch(Te){const De=Te instanceof Error?Te.message:"Failed to create worktree.";window.alert(De)}}}function Ww(){var b,O,V;const u=de.value;if(!u)return"";const p=((b=u.projectName)==null?void 0:b.trim())??"";return p?Ai(p,((V=u.cwd)==null?void 0:V.trim())??""):((O=u.cwd)==null?void 0:O.trim())??""}function zc(){const u=Ww();u&&(St.value=u),ln.value="local",kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}function Gw(){St.value="",ln.value="local",kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}async function uu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(In.value,p))return;const b=dr.get(p);if(b){const Te=await b;Object.prototype.hasOwnProperty.call(In.value,p)||(In.value={...In.value,[p]:Te});return}const O=NI(p).then(Te=>Te.isGitRepo).catch(()=>!1).finally(()=>{dr.delete(p)});dr.set(p,O);const V=await O;Object.prototype.hasOwnProperty.call(In.value,p)||(In.value={...In.value,[p]:V})}function Vw(u){Rs(u.projectName,u.displayName)}function Kw(u){ae(u.threadId,u.title)}async function Yw(u){await ha(u),await us(),Ir()}function Jw(u){Es(u.projectName,u.toIndex)}function Qw(u){var O,V;const p=H.value.find(Te=>Te.projectName===u),b=Ai(u,((V=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"");uu(b)}function vp(u){Xw(u)}async function Xw(u){var O;const p=await sr(u),b=((O=u.followUpMessageText)==null?void 0:O.trim())??"";if(!(!p||!b||gn.value))try{await Ye(b,[],[],"steer",[])}catch{}}async function Zw(u){const p=await _e(u.threadId,u.turnIndex);p&&(await Ct.push({name:"thread",params:{threadId:p}}),ne.value!==p&&await ge(p),kt.value&&Wt(!0))}function gp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Sn.value){Sn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(mn()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),Wt(!we.value);return}if(p==="j"&&vt.name==="thread"&&ne.value){u.preventDefault(),ur();return}p==="j"&&gn.value&&yn.value&&(u.preventDefault(),ur())}async function eb(){try{const u=await Px();bn.value=u.available,!u.available&&tn.value==="terminal"&&(tn.value="git",Ya())}catch{bn.value=!1,tn.value==="terminal"&&(tn.value="git")}}function yp(u){var b,O;const p=u.target;if(p instanceof Node){if(Va.value){const V=p instanceof Element?p:p.parentElement;V!=null&&V.closest(".thread-terminal-panel")||Ya()}Sn.value&&((b=Yr.value)!=null&&b.containsTarget(p)||(O=Tn.value)!=null&&O.contains(p)||(Ja=Date.now(),Sn.value=!1))}}function tb(u){var b,O;if(!Sn.value)return;const p=u.target;p instanceof Node&&((b=Yr.value)!=null&&b.containsTarget(p)||(O=Tn.value)!=null&&O.contains(p)||(Ja=Date.now(),Sn.value=!1))}function nb(){var u;(u=Fn.value)==null||u.openRecycleBin()}function wp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Cc.value=Date.now(),xc.value=!1;return}Hc()}}function bp(u){u.persisted&&Hc()}function Tp(){vt.name==="home"&&(us(),Ir()),Hc()}function Hc(){typeof window>"u"||typeof document>"u"||zN(document.visibilityState,Cc.value,xc.value,Date.now())&&(xc.value=!0,Cc.value=null,ob())}async function ob(){if(!kc.value){kc.value=!0;try{await Z({includeSelectedThreadMessages:!0}),await Zc()}finally{kc.value=!1}}}function Sp(u){const p=u.text;cu();const b=Vr.value,O=u.mode==="queue"&&b&&b.threadId===ne.value?b.queueIndex:void 0;if(Vr.value=null,gn.value){cT(p,u.imageUrls,u.skills,u.fileAttachments);return}Ye(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,O)}function rb(u){const p=zt.value.findIndex(Te=>Te.id===u),b=p>=0?zt.value[p]:void 0,O=vo.value;if(!b||!O||O.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Vr.value=ne.value?{threadId:ne.value,queueIndex:p}:null;const V={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(Te=>({...Te})),skills:b.skills.map(Te=>({...Te}))};O.hydrateDraft(V),Ha(u)}function cu(){if(!kt.value||gn.value)return;const u=()=>{var p;(p=ir.value)==null||p.jumpToLatest()};u(),Nt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function ab(u){St.value=u.trim(),it.value=""}function sb(u){An.value=u.trim()}function ls(u){const p=yn.value.trim();return!u||p!==u?!1:vt.name==="thread"||vt.name==="home"&&Ys.value}function Cp(){va+=1,$t+=1,ga+=1,rn+=1,Za.value=[],So.value=null,No.value=null,$o.value=null,Zr.value=null,x.value=!1,R.value=!1,k.value={addedLineCount:0,removedLineCount:0},G.value=[],Ot.value={},ao.value="",Co.value="",cn.value={},br.value="",es.value="",We.value="",ts.value=!1}function xp(u){const p=u.trim();if(!p){k.value={addedLineCount:0,removedLineCount:0};return}const b=++rn;ZI(p,"unstaged").then(O=>{b!==rn||!ls(p)||(k.value={addedLineCount:O.addedLineCount,removedLineCount:O.removedLineCount})}).catch(()=>{b!==rn||!ls(p)||(k.value={addedLineCount:0,removedLineCount:0})})}async function gl(u){var O,V,Te;const p=u.trim();if(!p){Cp();return}const b=++va;ts.value=!0,We.value="";try{const De=await LI(p);if(b!==va||!ls(p))return;Za.value=De.options,So.value=De.currentBranch,No.value=De.headSha,$o.value=De.headSubject,Zr.value=De.headDate,x.value=De.detached,R.value=De.dirty,G.value=De.changedFiles,xp(p);const Ft=((O=De.currentBranch)==null?void 0:O.trim())||((Te=(V=De.options[0])==null?void 0:V.value)==null?void 0:Te.trim())||"";Ft&&kp({branch:Ft,includeResetHistory:!0})}catch{if(b!==va||!ls(p))return;Za.value=[],So.value=null,No.value=null,$o.value=null,Zr.value=null,x.value=!1,R.value=!1,k.value={addedLineCount:0,removedLineCount:0},G.value=[]}finally{b===va&&(ts.value=!1)}}function ib(u){So.value=u.currentBranch,No.value=u.headSha,$o.value=u.headSubject,Zr.value=u.headDate,x.value=u.detached,R.value=u.dirty,G.value=u.changedFiles,xp(yn.value)}function lb(u){if(Tr.value)return;const p=u.trim();if(!p||p===(So.value??""))return;const b=yn.value.trim();b&&(Tr.value=!0,We.value="",$I(b,p).then(O=>(So.value=O||p,No.value=null,$o.value=null,Zr.value=null,x.value=!1,Hn.value=!1,gl(b))).catch(O=>{const V=O instanceof Error?O.message:"Failed to switch branch";gl(b).finally(()=>{We.value=V})}).finally(()=>{Tr.value=!1}))}function ub(u){if(Tr.value)return;const p=u.branch.trim(),b=u.sha.trim(),O=yn.value.trim();!p||!b||!O||(Tr.value=!0,We.value="",FI(O,p,b).then(V=>(ib(V),Hn.value=!1,gl(O))).catch(V=>{const Te=V instanceof Error?V.message:"Failed to reset branch to commit";gl(O).finally(()=>{We.value=Te})}).finally(()=>{Tr.value=!1}))}function kp(u){const p=(typeof u=="string"?u:u.branch).trim(),b=typeof u=="string"?!0:u.includeResetHistory!==!1,O=yn.value.trim(),V=Tc(p,b);if(!p||!O||ao.value===V||(Co.value="",Ot.value[V]))return;const Te=++$t;ao.value=V,OI(O,p,{includeResetHistory:b}).then(De=>{Te!==$t||!ls(O)||(Ot.value={...Ot.value,[V]:De})}).catch(De=>{Te!==$t||!ls(O)||(Co.value=De instanceof Error?De.message:"Failed to load branch commits")}).finally(()=>{Te===$t&&ao.value===V&&(ao.value="")})}function cb(u){const p=u.trim(),b=yn.value.trim();if(!p||!b||br.value===p||(es.value="",cn.value[p]))return;const O=++ga;br.value=p,DI(b,p).then(V=>{O!==ga||!ls(b)||(cn.value={...cn.value,[p]:V})}).catch(V=>{O!==ga||!ls(b)||(es.value=V instanceof Error?V.message:"Failed to load commit files")}).finally(()=>{O===ga&&br.value===p&&(br.value="")})}function db(u){const p=u.path.trim(),b=u.sha.trim();!p||!b||(Qr.value=p,Xr.value=b,Hn.value=!0)}function fb(){Qr.value="",Xr.value="",Hn.value=!Hn.value}function pb(){!Qr.value&&!Xr.value||(Qr.value="",Xr.value="",Hn.value=!1)}async function hb(){const u=await fu();u&&(await Ir(),Hs.value=u,oa.value=gr.value.trim()||"New Project (1)",Aa.value="",Qo.value="",Kn.value="create",Ia.value=!0,Nt(()=>{var p;return(p=xi.value)==null?void 0:p.focus()}))}function du(){Mn.value||(Ia.value=!1,Qo.value="")}let qc=!1,Wc=!1;function mb(){qc=!0}function vb(){qc&&(qc=!1,_i())}function gb(){Wc=!0}function yb(){Wc&&(Wc=!1,du())}async function wb(){const u=Hs.value.trim(),p=oa.value.trim();if(!rp.value)throw new Error("Enter a single project folder name.");const b=Pp(_p(u,p));return b?Tu(b,{createIfMissing:!0,label:""}):""}async function bb(){const u=Hs.value.trim(),p=Aa.value.trim();return p?GI(p,u):""}async function Gc(){if(!(!ap.value||Mn.value)){Qo.value="",Mn.value=!0;try{const u=Kn.value==="clone"?await bb():await wb();if(!u)return;St.value=u,zo(hl(u)),await us(),await Ir(),Ia.value=!1}catch(u){Qo.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{Mn.value=!1}}}function Tb(){Sb(ll.value)}function Sb(u){qs.value||!u||(u.value="",u.click())}async function Cb(u,p,b){qs.value=!0;try{const O=await fu();if(!O)return;const V=await p(O);if(!V.path)return;St.value=V.path,zo(hl(V.path)),await us(),await Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir()}catch(O){const V=O instanceof Error?O.message:b;window.alert(V)}finally{qs.value=!1,u&&(u.value="")}}async function xb(u){var O;const p=u.target instanceof HTMLInputElement?u.target:null,b=((O=p==null?void 0:p.files)==null?void 0:O[0])??null;!b||qs.value||await Cb(p,V=>HI(b,V),"Failed to import project.")}async function kb(){const u=St.value.trim()||await fu();u&&(pt.value=!1,kr.value=!0,so.value="",await cs(u),fn.value||Nt(()=>{var p;return(p=ul.value)==null?void 0:p.focus()}))}function _i(){dl+=1,kr.value=!1,Ce.value=!1,fn.value="",so.value="",ra.value="",yl()}async function Ib(u){!u||Ce.value||(so.value="",await cs(u))}function Ab(){const u=Do.value.trim();!kr.value||!u||cs(u)}function _b(){const u=ml.value;!kr.value||!u||Ce.value||cs(u)}function Pb(){if(!kr.value||Ce.value||wt.value)return;const u=ml.value,p=Do.value.trim();!u||u===p||cs(u)}function Rb(){const u=ml.value,p=Do.value.trim();if(u){if(u!==p){cs(u);return}Vc(u)}}async function Vc(u=ml.value){const p=Xe(u).trim();if(p){fn.value="",wt.value=!0;try{const b=await Tu(p,{createIfMissing:!1,label:""});if(!b){fn.value="Failed to open the selected folder.";return}St.value=b,zo(hl(b)),await us(),await Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir(),_i()}catch(b){fn.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{wt.value=!1}}}async function Eb(){if(it.value="",pt.value){yl();return}if(!kr.value){const u=St.value.trim()||await fu();if(!u||(kr.value=!0,so.value="",await cs(u),fn.value))return}fn.value||(ht.value=gr.value,pt.value=!0,Nt(()=>{var u;return(u=eu.value)==null?void 0:u.focus()}))}function yl(){it.value="",ht.value="",pt.value=!1}async function Ip(){const u=ht.value.trim();if(!u)return;if(it.value="",fn.value){it.value="Reload the current folder before creating a new one.";return}Pt.value=!0;const p=np.value.trim(),b=Pp(_p(p,u));if(!b){it.value="Unable to determine where the new folder should be created.",Pt.value=!1;return}if(!op.value){it.value="Enter a single folder name.",Pt.value=!1;return}try{const O=await WI(b);if(!O){it.value="Failed to create the folder.";return}it.value="",so.value="",await cs(O),yl()}catch(O){it.value=O instanceof Error?O.message:"Failed to create folder."}finally{Pt.value=!1}}async function Mb(){var p;if(typeof window>"u")return!1;const u=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!u)return!1;try{const b=await Tu(u,{createIfMissing:!1,label:""});if(!b)return!1;St.value=b,zo(hl(b)),await Ct.replace({name:"home"}),await us();const O=new URL(window.location.href);return O.searchParams.delete("openProjectPath"),window.history.replaceState({},"",O.toString()),!0}catch{return!1}}async function fu(){const u=Ap();if(u)return u;try{const p=await pm();if(p)return ya.value=p,p}catch{}return""}async function Ir(){const u=Ap();if(!u){gr.value="New Project (1)";return}try{const p=await KI(u);gr.value=p.name||"New Project (1)"}catch{gr.value="New Project (1)"}}function Ap(){var b,O;const u=St.value.trim();if(u)return Hi(u);const p=((O=(b=$c.value[0])==null?void 0:b.value)==null?void 0:O.trim())??"";return p?Hi(p):ya.value.trim()}async function jb(){try{ya.value=await pm()}catch{ya.value=""}}async function us(){try{const u=await $i();dn.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{dn.value={order:[],labels:{},projectOrder:[]}}}async function cs(u){const p=++dl,b=Xe(u).trim();ra.value=b,Do.value=b,fn.value="",Ce.value=!0;try{const O=await qI(u,{showHidden:Fo.value});if(p!==dl)return;ra.value=O.path,Do.value=O.path,as.value=O.parentPath,ki.value=O.entries}catch(O){if(p!==dl)return;fn.value=O instanceof Error?O.message:"Failed to load local folders.",as.value=Hi(Do.value),ki.value=[],yl()}finally{p===dl&&(Ce.value=!1)}}function _p(u,p){const b=Xe(u).trim(),O=Xe(p).trim().replace(/^[\\/]+/u,"");if(!b||!O)return"";const V=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${V}${O}`;if(/^\/+$/u.test(b))return`/${O}`;const Te=b.replace(/[\\/]+$/u,"");return Te?`${Te}${V}${O}`:""}function Pp(u){const p=Xe(u).trim();if(!p)return"";const b=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,V,Te,De=""]=b,Ft=Kc(De.split(/[\\/]+/u));return Ft.length>0?`\\\\${V}\\${Te}\\${Ft.join("\\")}`:`\\\\${V}\\${Te}`}const O=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(O){const[,V,Te=""]=O,De=p.includes("\\")&&!p.includes("/")?"\\":"/",Ft=Kc(Te.split(/[\\/]+/u));return Ft.length>0?`${V}${De}${Ft.join(De)}`:`${V}${De}`}if(p.startsWith("/")){const V=Kc(p.split("/"));return V.length>0?`/${V.join("/")}`:"/"}return p}function Kc(u){const p=[];for(const b of u){const O=b.trim();if(!(!O||O===".")){if(O===".."){p.length>0&&p.pop();continue}p.push(O)}}return p}function Lb(u){fa(u.draggedId,u.targetId)}function Rp(u){qa(Ks.value,u)}function Ep(u){Wa(u)}function Mp(u){Uo(u)}function Nb(){Tt()}const wl=T("");let Yc=null;nt(At,u=>{var p;u&&(u.text&&((p=vo.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),wl.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Yc&&clearTimeout(Yc),Yc=setTimeout(()=>{wl.value=""},6e3),Br(Ks.value))});function jp(u){var b,O;const p=ne.value.trim();switch(u){case"compact":p&&Je(p);break;case"review":if(!p)return;Qr.value="",Xr.value="",Hn.value=!0;break;case"rename":p&&((O=Fn.value)==null||O.openRenameThreadDialog(p,((b=de.value)==null?void 0:b.title)??""));break;case"archive":p&&Ue(p);break;case"fork":p&&q(p);break;case"new":zc();break;case"skills":is.value||Ct.push({name:"skills"});break}}function $b(u){const p=u.turnId.trim();if(p.length>0){const b=[...fl.value].reverse().find(O=>{var V;return O.role==="user"&&(((V=O.turnId)==null?void 0:V.trim())??"")===p&&O.text.trim().length>0});b!=null&&b.text&&vo.value&&vo.value.appendTextToDraft(b.text)}Ms(u.turnId)}function Ob(){gn.value||!ne.value||(Ec.value&&(Rc.value=Ec.value.id),zr("default"),cu(),Ye("Implement",[],[],"steer",[],void 0,"default"))}async function Db(){if(gn.value||is.value||Vs.value||!de.value||fl.value.length===0)return;const u=Fb();try{await BN(u)}catch{}}function Fb(){var b,O,V;const u=[],p=((O=(b=de.value)==null?void 0:b.title)==null?void 0:O.trim())||"Untitled thread";u.push(`# ${Bb(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((V=de.value)==null?void 0:V.id)??""}`),u.push(""),u.push("---"),u.push("");for(const Te of fl.value){const De=Te.role?Te.role.toUpperCase():"MESSAGE";u.push(`## ${De}`),u.push("");const Ft=Te.text.trim();if(Ft&&(u.push(Ft),u.push("")),Te.commandExecution&&(u.push("```text"),u.push(`command: ${Te.commandExecution.command}`),u.push(`status: ${Te.commandExecution.status}`),Te.commandExecution.cwd&&u.push(`cwd: ${Te.commandExecution.cwd}`),Te.commandExecution.exitCode!==null&&u.push(`exitCode: ${Te.commandExecution.exitCode}`),u.push(Te.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),Te.fileAttachments&&Te.fileAttachments.length>0){u.push("Attachments:");for(const Io of Te.fileAttachments)u.push(`- ${Io.path}`);u.push("")}if(Te.images&&Te.images.length>0){u.push("Images:");for(const Io of Te.images)u.push(`- ${Io}`);u.push("")}}return`${u.join(`
|
|
82
|
-
`).trimEnd()}
|
|
83
|
-
`}function Bb(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Jc(u,p){if(typeof window>"u")return p;const b=window.localStorage.getItem(u);return b===null?p:b==="1"}function Ub(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(Xm);return u==="light"||u==="dark"?u:"system"}function zb(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(Qm);return u==="steer"||u==="queue"?u:"queue"}function Hb(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(nv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function qb(){os.value=!os.value,window.localStorage.setItem(Jm,os.value?"1":"0")}function Wb(){ta.value=ta.value==="steer"?"queue":"steer",window.localStorage.setItem(Qm,ta.value)}function Gb(){const u=["system","light","dark"],p=u.indexOf(ka.value);ka.value=u[(p+1)%u.length],window.localStorage.setItem(Xm,ka.value),pu()}function Vb(){const u=["standard","wide","extra-wide"],p=u.indexOf(Bs.value);Bs.value=u[(p+1)%u.length],window.localStorage.setItem(nv,Bs.value)}function Kb(){rs.value=!rs.value,window.localStorage.setItem(Zm,rs.value?"1":"0")}function Yb(){Yo.value=!Yo.value,window.localStorage.setItem(ev,Yo.value?"1":"0")}async function Jb(u){if(!Us.value){Us.value=!0;try{if(u==="codex"){ko.value="codex";const p=await rm(!1);na.value=p.enabled}else if(u==="openrouter"){ko.value="openrouter";const p=await rm(!0);na.value=p.enabled,await Ei("","",{wireApi:Y.value,provider:"openrouter"})}else u==="opencode-zen"?(ko.value="opencode-zen",await Ei("",ie.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),na.value=!0):u==="custom"&&(ko.value="custom",y.value.trim()&&I.value.trim()&&(await Ei(y.value.trim(),I.value.trim(),{wireApi:$.value}),na.value=!0));Oo.value="",await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Us.value=!1}}}async function Qb(){if(Cn.value)return;const u=y.value.trim();if(u){Cn.value=!0;try{Oo.value="",await Ei(u,I.value.trim(),{wireApi:$.value}),na.value=!0;const p=await om();p.provider==="custom"&&!p.currentModel&&(Oo.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Cn.value=!1}}}async function Xb(u){if(Cn.value||Us.value||Y.value===u)return;const p=Y.value;Y.value=u,Cn.value=!0;try{Oo.value="",await Ei("","",{wireApi:u,provider:"openrouter"}),na.value=!0,await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){Y.value=p,Oo.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Cn.value=!1}}async function Zb(){if(Cn.value)return;const u=ie.value.trim();if(u){Cn.value=!0;try{Oo.value="",await Ei("",u,{wireApi:"responses",provider:"opencode-zen"}),na.value=!0,await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Cn.value=!1}}}async function eT(){if(!Cn.value){Cn.value=!0;try{const u=zs.value.trim();await am(u),zs.value="",await Qc(),await Z({includeSelectedThreadMessages:!1})}catch{}finally{Cn.value=!1}}}async function tT(){if(!Cn.value){Cn.value=!0;try{await am(""),zs.value="",await Qc(),await Z({includeSelectedThreadMessages:!1})}catch{}finally{Cn.value=!1}}}async function Qc(){try{const u=ko.value,p=await om();na.value=p.enabled,nu.value=p.customKey??!1,il.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?ko.value="opencode-zen":p.provider==="custom"?(ko.value="custom",y.value=p.customBaseUrl??"",$.value=p.wireApi==="chat"?"chat":"responses"):(ko.value="openrouter",Y.value=p.wireApi==="chat"?"chat":"responses"):ko.value="codex",_c=p.hasCodexAuth===!0,_c||(Pc=!1);const b=ko.value!==u;b&&await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const O=await ip();O&&await Z({includeSelectedThreadMessages:!1,providerChanged:b||O,awaitAncillaryRefreshes:!0})}catch{}}function nT(u){const b=Xc(u.trim())||"auto";xr.value=b,window.localStorage.setItem(tv,b)}function oT(u){Ur(Number(u))}const rT=[{value:"0",label:f("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function aT(){var b;if(typeof window>"u")return"auto";const u=((b=window.localStorage.getItem(tv))==null?void 0:b.trim())||"auto";return Xc(u)||"auto"}function sT(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function b(V){const Te=U[V]||V;return`${Te.charAt(0).toUpperCase()+Te.slice(1)} (${V})`}for(const V of typeof navigator<"u"?navigator.languages??[]:[]){const Te=Xc(V);!Te||p.has(Te)||(p.add(Te),u.push({value:Te,label:`${f("Preferred")}: ${b(Te)}`}))}for(const V of Object.keys(U))p.has(V)||(p.add(V),u.push({value:V,label:b(V)}));const O=xr.value.trim();return O&&!p.has(O)&&u.push({value:O,label:b(O)}),u}function Xc(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in U)return p;const b=p.split("-")[0]??p;return b in U?b:""}function pu(){const u=document.documentElement;if(ka.value==="dark")u.classList.add("dark");else if(ka.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}const iT=K(()=>({activeSettingsGroup:Ns.value,accounts:Vn.value,isAccountsSectionCollapsed:ct.value,isRefreshingAccounts:Sr.value,isSwitchingAccounts:Cr.value,isStartingCodexLogin:ea.value,isCompletingCodexLogin:En.value,accountActionError:Qt.value,codexLoginUrl:ns.value,feedbackMailto:Bn,isAccountUnavailable:iu,isRemoveConfirmationActive:Bc,isRemoveVisible:mw,buildAccountTitle:Sw,formatAccountMeta:up,formatAccountQuota:cp,shortAccountId:fw,isAccountActionDisabled:hw,getAccountSwitchLabel:vw,getAccountRemoveLabel:gw,onRefreshAccounts:Cw,onStartCodexLogin:kw,onSwitchAccount:xw,onRemoveAccount:_w,onAccountCardPointerEnter:yw,onAccountCardPointerLeave:ww,toggleAccountsSectionCollapsed:Ls,prepareFeedbackLink:xt,sendWithEnter:os.value,inProgressSendMode:ta.value,darkMode:ka.value,uiLanguage:g.value,uiLanguageOptions:S,chatWidthLabel:Xy.value,dictationClickToToggle:rs.value,dictationAutoSend:Yo.value,dictationLanguage:xr.value,dictationLanguageOptions:Sc.value,autoCompactThreshold:ar.value,autoCompactThresholdOptions:rT,hasVisibleFeedbackError:jy.value,selectedProvider:ko.value,providerDropdownOptions:m.value,freeModeLoading:Us.value,providerError:Oo.value,freeModeHasCustomKey:nu.value,freeModeCustomKey:zs.value,freeModeCustomKeyMasked:il.value,freeModeCustomKeySaving:Cn.value,openRouterWireApi:Y.value,opencodeZenKey:ie.value,customEndpointUrl:y.value,customEndpointKey:I.value,customEndpointWireApi:$.value,isTelegramConfigOpen:X.value,telegramStatusText:ew.value,telegramBotTokenDraft:se.value,telegramAllowedUserIdsDraft:be.value,telegramConfigError:Ie.value,isTelegramSaving:ze.value,supportsHooks:rl.value,isHooksLoading:Re.value,hooksList:je.value,supportsRemoteControl:$s.value,remoteControlStatus:qn.value,isRemoteControlActionInFlight:un.value,remoteControlError:yr.value,remoteControlNotice:wr.value,isRemoteControlLoading:ro.value,remoteControlActionName:Wn.value,pairingCode:gi.value,accountRateLimitSnapshots:lt.value,worktreeName:B,appVersion:L,onClose:()=>{Sn.value=!1},onActiveSettingsGroupChange:u=>{Ns.value=u},toggleSendWithEnter:qb,cycleInProgressSendMode:Wb,cycleDarkMode:Gb,onUiLanguageChange:P,cycleChatWidth:Vb,toggleDictationClickToToggle:Kb,toggleDictationAutoSend:Yb,onDictationLanguageChange:nT,onAutoCompactThresholdChange:oT,onProviderChange:Jb,onFreeModeCustomKeyChange:u=>{zs.value=u},clearFreeModeCustomKey:tT,saveFreeModeCustomKey:eT,setOpenRouterWireApi:Xb,onOpencodeZenKeyChange:u=>{ie.value=u},saveOpencodeZen:Zb,onCustomEndpointUrlChange:u=>{y.value=u},onCustomEndpointKeyChange:u=>{I.value=u},saveCustomEndpoint:Qb,onCustomEndpointWireApiChange:u=>{$.value=u},onTelegramConfigOpenChange:u=>{X.value=u},onTelegramBotTokenDraftChange:u=>{se.value=u},onTelegramAllowedUserIdsDraftChange:u=>{be.value=u},saveTelegramConfig:aw,refreshHooks:re,toggleRemoteControl:Fs,startRemotePairing:bi,refreshRemoteClients:al,revokeRemoteClient:Ti}));function lT(u,p){const b=(u??"").trim();return b.length>0?b:p.trim()||"message"}function Lp(u){zr(u)}async function uT(){await Ct.isReady(),vt.name==="thread"&&Gs.value?Ga(Gs.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&Ga("",{persist:!1}),await Z({includeSelectedThreadMessages:vt.name==="thread"}),vl({silent:!0}),await Mb(),cr.value=!0,await Zc(),Po()}async function Zc(){if(bo.value){oo=!0;return}bo.value=!0;try{do{if(oo=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){ne.value!==""&&await ge("");continue}if(vt.name==="thread"){const u=Gs.value;if(!u)continue;if(ne.value!==u){if(await ge(u)==="not-found")continue}else Ve(u,{silent:!0}).catch(()=>{})}}while(oo)}finally{bo.value=!1}}nt(()=>[vt.name,Gs.value,fe.value,ne.value],async()=>{cr.value&&await Zc()}),nt(()=>[ne.value,yn.value],()=>{pb()}),nt(()=>[vt.name,yn.value],([u,p])=>{u==="thread"&&uu(p)},{immediate:!0}),nt(()=>ne.value,async u=>{if(cr.value&&!bo.value&&!(gn.value||is.value||Vs.value)){if(!u){vt.name!=="home"&&await Ct.replace({name:"home"});return}vt.name==="thread"&&Gs.value===u||await Ct.replace({name:"thread",params:{threadId:u}})}}),nt(()=>$c.value,u=>{if(u.length===0){St.value="",Ir();return}const p=St.value.trim();p&&(u.some(O=>O.value===p)||(St.value="")),Ir()},{immediate:!0}),nt(()=>St.value,()=>{E.value={phase:"idle",title:"",message:""},Ir()}),nt(()=>[vt.name,St.value],([u,p])=>{u==="home"&&uu(p)},{immediate:!0}),nt(Ys,u=>{!u&&ln.value==="worktree"&&(ln.value="local")},{immediate:!0}),nt(()=>[ln.value,St.value],([u,p])=>{u!=="worktree"||!Ys.value||Np(p)},{immediate:!0}),nt(()=>ln.value,u=>{var p;if(u==="local"){E.value={phase:"idle",title:"",message:""};const b=St.value.trim();if(b&&dp(b)){const O=((p=de.value)==null?void 0:p.projectName)??Bo(b),V=Ai(O,"");V&&(St.value=V)}return}Ys.value&&Np(St.value)}),nt(()=>vt.name,u=>{u!=="home"&&(E.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Hn.value=!1)}),nt(()=>ne.value,()=>{E.value={phase:"idle",title:"",message:""}}),nt(()=>[vt.name,yn.value,Ys.value],([u,p,b])=>{if(!(u==="thread"||u==="home"&&b)){Cp();return}$t+=1,Ot.value={},ao.value="",Co.value="",gl(p)},{immediate:!0}),nt($y,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),nt(kt,u=>{u&&!we.value&&Wt(!0)},{immediate:!0});async function cT(u,p=[],b=[],O=[]){try{E.value={phase:"idle",title:"",message:""};let V=St.value;if(ln.value==="worktree"){E.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const De=await EI(St.value,An.value);V=De.cwd,St.value=De.cwd,E.value={phase:"idle",title:"",message:""}}catch{E.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!V.trim()){const De=await VI(u);V=De.cwd,St.value=De.cwd}const Te=await bt(u,V,p,b,O);if(!Te)return;await Ct.replace({name:"thread",params:{threadId:Te}}),cu()}catch{}}function dT(u){var O;if((O=u.prompt)!=null&&O.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),b=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${b}. Give me a list of what it can do and one useful example.`}function fT(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function pT(u){var O;if(jo.value)return;jo.value=fT(u);const p=dT(u),b=(O=u.attachedSkills)!=null&&O.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const V=Qf.value.trim()||yn.value.trim(),Te=await bt(p,V,[],b,[]);if(!Te)return;await Ct.replace({name:"thread",params:{threadId:Te}}),cu()}catch{}finally{jo.value=""}}async function Np(u){var b;const p=u.trim();if(!p){Kr.value=[],An.value="";return}fr.value=!0;try{const O=await jI(p);Kr.value=O;const V=An.value.trim();if(!(V.length>0&&O.some(De=>De.value===V))){const De=O.find(Ft=>Ft.value.trim()==="main");An.value=(De==null?void 0:De.value)??((b=O[0])==null?void 0:b.value)??""}}catch{Kr.value=[],An.value=""}finally{fr.value=!1}}return(u,p)=>(_(),F(ot,null,[Oe(cx,{"is-sidebar-collapsed":h(we),onCloseSidebar:p[37]||(p[37]=b=>h(Wt)(!0))},{sidebar:dt(()=>[w("section",HN,[w("div",{ref_key:"sidebarScrollableRef",ref:Kt,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...b)=>h(pr)&&h(pr)(...b))},[h(we)?ye("",!0):(_(),Qe(Mm,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":h(we),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=b=>h(Wt)(!h(we))),onStartNewThread:zc},{default:dt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":h(_n),"aria-label":h(f)("Search threads"),title:h(f)("Search threads"),onClick:p[0]||(p[0]=(...b)=>h(vn)&&h(vn)(...b))},[Oe(jm,{class:"sidebar-search-toggle-icon"})],8,qN)]),_:1},8,["is-sidebar-collapsed"])),!h(we)&&h(_n)?(_(),F("div",WN,[Oe(jm,{class:"sidebar-search-bar-icon"}),xn(w("input",{ref_key:"sidebarSearchInputRef",ref:Pn,"onUpdate:modelValue":p[2]||(p[2]=b=>kn(_t)?_t.value=b:null),class:"sidebar-search-input",type:"text",placeholder:h(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...b)=>h(hr)&&h(hr)(...b))},null,40,GN),[[Nn,h(_t)]]),h(_t).length>0?(_(),F("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":h(f)("Clear search"),onClick:p[4]||(p[4]=(...b)=>h(mi)&&h(mi)(...b))},[Oe(nf,{class:"sidebar-search-clear-icon"})],8,VN)):ye("",!0)])):ye("",!0),h(we)?ye("",!0):(_(),F("button",{key:2,class:at(["sidebar-skills-link",{"is-active":is.value}]),type:"button",onClick:p[5]||(p[5]=b=>{h(Ct).push({name:"skills"}),h(kt)&&h(Wt)(!0)})},[w("span",KN,[Oe(bs)]),w("span",YN,[w("span",JN,D(h(f)("Skills")),1),w("span",QN,D(h(f)("Plugins, apps, MCPs")),1)])],2)),h(we)?ye("",!0):(_(),F("button",{key:3,class:at(["sidebar-skills-link",{"is-active":Vs.value}]),type:"button",onClick:p[6]||(p[6]=b=>{h(Ct).push({name:"automations"}),h(kt)&&h(Wt)(!0)})},[w("span",XN,[Oe(bs)]),w("span",ZN,[w("span",e$,D(h(f)("Automations")),1),w("span",t$,D(h(f)("Scheduled work")),1)])],2)),h(we)?ye("",!0):(_(),Qe(xR,{key:4,ref_key:"sidebarThreadTreeRef",ref:Fn,groups:h(H),"project-display-name-by-id":h(he),"project-git-repo-by-name":Vy.value,"project-cwd-by-name":fp.value,"selected-thread-id":h(ne),"is-loading":h(fe),"is-thread-list-fully-loaded":h(N),"search-query":h(_t),"search-matched-thread-ids":vr.value,onSelect:sw,onArchive:Pw,onStartNewThread:Mw,onRenameProject:Vw,onBrowseThreadFiles:jw,onSaveThreadProject:Dw,onBrowseProjectFiles:$w,onSaveProject:Ow,onRequestProjectGitStatus:Qw,onCreateProjectWorktree:qw,onRenameThread:Kw,onForkThread:Ew,onRemoveProject:Yw,onReorderProject:Jw,onCopyThreadChat:dw,onAutomationsChanged:cw,onRestoreThread:Rw,onStartNewChat:Gw},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),h(we)?ye("",!0):(_(),F("div",{key:0,ref_key:"settingsAreaRef",ref:mr,class:"sidebar-settings-area",onClick:tb},[Sn.value?(_(),Qe(h(s),Mf({key:0,ref_key:"settingsDialogRef",ref:Yr},iT.value),null,16)):ye("",!0),w("div",n$,[w("button",{ref_key:"settingsButtonRef",ref:Tn,class:"sidebar-settings-icon-button",type:"button",title:h(f)("Settings"),"aria-label":h(f)("Settings"),onClick:gt(ol,["stop"])},[Oe(D1,{class:"sidebar-settings-icon"})],8,o$),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:h(f)("Recycle bin"),"aria-label":h(f)("Recycle bin"),onClick:gt(nb,["stop"])},[Oe(oy,{class:"sidebar-settings-icon"})],8,r$)])],512))])]),content:dt(()=>[w("div",a$,[w("section",{class:at(["content-root",{"is-virtual-keyboard-open":zy.value}]),style:er(Zy.value)},[pl.value?(_(),F("span",s$)):ye("",!0),Oe(PR,{title:Ly.value,accent:is.value||Vs.value},{leading:dt(()=>[h(we)||h(kt)?(_(),Qe(Mm,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":h(we),"show-new-thread-button":!0,onToggleSidebar:p[8]||(p[8]=b=>h(Wt)(!h(we))),onStartNewThread:zc},null,8,["is-sidebar-collapsed"])):ye("",!0),is.value?(_(),F("span",i$,[Oe(bs)])):Vs.value?(_(),F("span",l$,[Oe(bs)])):ye("",!0)]),actions:dt(()=>[su.value?(_(),F("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":h(kt)?h(sn)?h(f)("Close side panel"):h(f)("Open side panel"):h(to)?h(f)("Open side panel"):h(f)("Close side panel"),title:h(kt)?h(sn)?h(f)("Close side panel"):h(f)("Open side panel"):h(to)?h(f)("Open side panel"):h(f)("Close side panel"),onClick:p[9]||(p[9]=(...b)=>h(qt)&&h(qt)(...b))},[Oe(ry,{class:"content-header-right-panel-toggle-icon"})],8,u$)):ye("",!0)]),_:1},8,["title","accent"]),w("section",c$,[is.value?(_(),Qe(h(r),{key:0,ref_key:"directoryHubRef",ref:Hr,cwd:Qf.value,"thread-id":Gs.value,"try-in-flight-key":jo.value,onSkillsChanged:tw,onTryItem:pT},null,8,["cwd","thread-id","try-in-flight-key"])):Vs.value?(_(),Qe(h(a),{key:1,ref_key:"automationsPanelRef",ref:ho,groups:h(H),"project-cwd-by-name":fp.value,"project-display-name-by-id":h(he),"selected-automation-id":Kf.value,onSelectAutomation:iw,onEditAutomation:lw,onCreateAutomation:uw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):gn.value?(_(),F("div",d$,[w("div",f$,[w("p",p$,D(h(f)("Let's build")),1),Oe(ci,{class:"new-thread-folder-dropdown","model-value":St.value,options:$c.value,placeholder:h(f)("Choose folder"),"enable-search":!0,"search-placeholder":h(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":ab},null,8,["model-value","options","placeholder","search-placeholder"]),St.value?(_(),F("p",{key:0,class:"new-thread-folder-selected",title:St.value},D(h(f)("Selected folder"))+": "+D(St.value),9,h$)):ye("",!0),w("div",m$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:kb},D(h(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:hb},D(h(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:qs.value,onClick:Tb},D(qs.value?h(f)("Importing…"):h(f)("Import Project")),9,v$),w("input",{ref_key:"projectImportInputRef",ref:ll,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:xb},null,544)]),Ci.value?(_(),F("section",g$,[w("div",y$,[w("div",w$,[w("span",b$,[Oe(bs)]),w("p",T$,D(h(f)("New in Codex")),1)]),w("h2",S$,D(h(f)("Plugins are here")),1),w("p",C$,D(h(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[42]||(p[42]=w("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[w("span",{class:"new-thread-launch-card-pill"},"Gmail"),w("span",{class:"new-thread-launch-card-pill"},"Calendar"),w("span",{class:"new-thread-launch-card-pill"},"GitHub"),w("span",{class:"new-thread-launch-card-pill"},"Slack"),w("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),w("div",x$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:qy},D(h(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:Zf},D(h(f)("Dismiss")),1)])])):ye("",!0),(_(),Qe(Vi,{to:"body"},[kr.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(mb,["self"]),onMouseup:vb},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":h(f)("Select folder"),onKeydown:Ao(gt(_i,["prevent"]),["esc"])},[w("div",I$,[w("p",A$,D(h(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:_i},D(h(f)("Cancel")),1)]),w("p",_$,D(h(f)("Current folder")),1),w("div",P$,[xn(w("input",{ref_key:"existingFolderPathInputRef",ref:ul,"onUpdate:modelValue":p[10]||(p[10]=b=>ra.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:h(f)("Current folder"),title:ra.value||h(f)("Unavailable"),disabled:Ce.value||wt.value,onBlur:Pb,onKeydown:[Ao(gt(Rb,["prevent"]),["enter"]),Ao(gt(_i,["prevent"]),["esc"])]},null,40,R$),[[Nn,ra.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ml.value||Ce.value||wt.value,onClick:p[11]||(p[11]=b=>Vc())},D(wt.value?h(f)("Opening…"):h(f)("Open")),9,E$)]),w("div",M$,[w("label",j$,[xn(w("input",{"onUpdate:modelValue":p[12]||(p[12]=b=>Fo.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Ab},null,544),[[DC,Fo.value]]),w("span",null,D(h(f)("Show hidden folders")),1)]),w("button",{class:at(["new-thread-folder-action",{"new-thread-folder-action-primary":pt.value}]),type:"button","aria-pressed":pt.value,disabled:!Do.value||Ce.value||wt.value||Pt.value||!!fn.value&&!pt.value,onClick:Eb},D(h(f)("New folder")),11,L$)]),pt.value?(_(),F("div",N$,[w("div",$$,[xn(w("input",{ref_key:"createFolderInputRef",ref:eu,"onUpdate:modelValue":p[13]||(p[13]=b=>ht.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:h(f)("Folder name"),onKeydown:[Ao(gt(Ip,["prevent"]),["enter"]),Ao(gt(yl,["prevent"]),["esc"])]},null,40,O$),[[Nn,ht.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Ky.value||Pt.value,onClick:Ip},D(Yy.value),9,D$)]),it.value?(_(),F("div",F$,[w("span",null,D(it.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[14]||(p[14]=b=>xt(b,it.value))},D(h(f)("Send feedback")),9,B$)])):ye("",!0)])):ye("",!0),xn(w("input",{ref_key:"existingFolderFilterInputRef",ref:ou,"onUpdate:modelValue":p[15]||(p[15]=b=>so.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:h(f)("Filter folders..."),onKeydown:Ao(gt(_i,["prevent"]),["esc"])},null,40,U$),[[Nn,so.value]]),fn.value?(_(),F("div",z$,[w("div",H$,[w("span",null,D(fn.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[16]||(p[16]=b=>xt(b,fn.value))},D(h(f)("Send feedback")),9,q$)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Ce.value||wt.value,onClick:_b},D(h(f)("Retry")),9,W$)])):ye("",!0),Ce.value?(_(),F("p",G$,D(h(f)("Loading folders…")),1)):!fn.value&&Dc.value.length===0?(_(),F("p",V$,D(so.value.trim()?h(f)("No folders match this filter."):h(f)("No subfolders found here.")),1)):Dc.value.length>0?(_(),F("ul",K$,[(_(!0),F(ot,null,Zt(Dc.value,b=>(_(),F("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:Ce.value||wt.value,onClick:O=>Ib(b.path)},[w("span",J$,D(b.name),1)],8,Y$),b.kind==="directory"?(_(),F("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Ce.value||wt.value,onClick:O=>Vc(b.path)},D(h(f)("Open")),9,Q$)):ye("",!0)]))),128))])):ye("",!0)],40,k$)],32)):ye("",!0)])),(_(),Qe(Vi,{to:"body"},[Ia.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(gb,["self"]),onMouseup:yb},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":h(f)("Create or clone project"),onKeydown:Ao(gt(du,["prevent"]),["esc"])},[w("div",Z$,[w("p",eO,D(h(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:Mn.value,onClick:du},D(h(f)("Cancel")),9,tO)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":h(f)("Project source")},[w("button",{class:at(["new-thread-project-mode-tab",{"is-active":Kn.value==="create"}]),type:"button",role:"tab","aria-selected":Kn.value==="create",disabled:Mn.value,onClick:p[17]||(p[17]=b=>Kn.value="create")},D(h(f)("New project")),11,oO),w("button",{class:at(["new-thread-project-mode-tab",{"is-active":Kn.value==="clone"}]),type:"button",role:"tab","aria-selected":Kn.value==="clone",disabled:Mn.value,onClick:p[18]||(p[18]=b=>Kn.value="clone")},D(h(f)("Clone from GitHub")),11,rO)],8,nO),w("label",aO,[w("span",sO,D(h(f)("Destination folder")),1),xn(w("input",{"onUpdate:modelValue":p[19]||(p[19]=b=>Hs.value=b),class:"new-thread-open-folder-path",type:"text",disabled:Mn.value,placeholder:h(f)("Destination folder")},null,8,iO),[[Nn,Hs.value]])]),Kn.value==="create"?(_(),F("label",lO,[w("span",uO,D(h(f)("Project name")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:xi,"onUpdate:modelValue":p[20]||(p[20]=b=>oa.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:Mn.value,placeholder:h(f)("Project name"),onKeydown:Ao(gt(Gc,["prevent"]),["enter"])},null,40,cO),[[Nn,oa.value]])])):Kn.value==="clone"?(_(),F("label",dO,[w("span",fO,D(h(f)("GitHub repository URL")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:xi,"onUpdate:modelValue":p[21]||(p[21]=b=>Aa.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:Mn.value,placeholder:"https://github.com/owner/repo",onKeydown:Ao(gt(Gc,["prevent"]),["enter"])},null,40,pO),[[Nn,Aa.value]])])):ye("",!0),Qo.value?(_(),F("div",hO,[w("span",null,D(Qo.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[22]||(p[22]=b=>xt(b,Qo.value))},D(h(f)("Send feedback")),9,mO)])):ye("",!0),w("div",vO,[w("button",{class:"new-thread-folder-action",type:"button",disabled:Mn.value,onClick:du},D(h(f)("Cancel")),9,gO),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ap.value||Mn.value,onClick:Gc},D(Jy.value),9,yO)])],40,X$)],32)):ye("",!0)])),Ys.value?(_(),Qe(b1,{key:2,class:"new-thread-runtime-dropdown",modelValue:ln.value,"onUpdate:modelValue":p[23]||(p[23]=b=>ln.value=b)},null,8,["modelValue"])):ye("",!0),ln.value==="worktree"?(_(),F("div",wO,[w("p",bO,D(h(f)("Base branch")),1),Oe(ci,{class:"new-thread-branch-dropdown","model-value":An.value,options:Oc.value,placeholder:h(f)("Select branch"),"enable-search":!0,"search-placeholder":h(f)("Search branches..."),disabled:fr.value||Oc.value.length===0,"onUpdate:modelValue":sb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",TO,D(fr.value?h(f)("Loading branches…"):tp.value?h(f)("New worktree branch will start from {branch}.",{branch:tp.value}):h(f)("No Git branches found for this folder.")),1)])):ye("",!0),Ys.value?(_(),F("p",SO,D(h(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ye("",!0),E.value.phase!=="idle"?(_(),F("div",{key:5,class:at(["worktree-init-status",{"is-running":E.value.phase==="running","is-error":E.value.phase==="error"}])},[w("strong",CO,D(E.value.title),1),w("span",xO,D(E.value.message),1)],2)):ye("",!0)]),w("div",kO,[h(Fe)?(_(),F("div",IO,[w("span",null,D(h(f)(h(Fe))),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[24]||(p[24]=b=>xt(b,h(Fe)))},D(h(f)("Send feedback")),9,AO)])):ye("",!0),Oe(Em,{ref_key:"homeThreadComposerRef",ref:eo,"active-thread-id":Ks.value,cwd:yn.value,"fuzzy-file-search-results":h(st),onRegisterFuzzySession:h(mt),"collaboration-modes":h(ke),"selected-collaboration-mode":h(ce),models:h($e),"model-reasoning-efforts":h(te),"selected-model":Jf.value,"selected-reasoning-effort":h(Le),"selected-speed-mode":h(Pe),"is-updating-speed-mode":h(M),skills:h(Ke),"thread-token-usage":h(W),"codex-quota":h(me),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":os.value,"in-progress-submit-mode":ta.value,"dictation-click-to-toggle":rs.value,"dictation-auto-send":Yo.value,"dictation-language":xr.value,onSubmit:Sp,"onUpdate:selectedCollaborationMode":Lp,"onUpdate:selectedModel":Rp,"onUpdate:selectedReasoningEffort":Ep,"onUpdate:selectedSpeedMode":Mp,"approval-policy":Jr.value,"is-approval-policy-saving":ba.value,"approval-policy-error":Rn.value,"approval-policy-notice":To.value,"onUpdate:approvalPolicy":Os,onSaveApprovalPolicy:Gn,onSlashCommand:jp},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"])])])):(_(),F("div",_O,[Hn.value&&h(ne)&&yn.value?(_(),Qe(h(o),{key:0,"thread-id":h(ne),cwd:yn.value,"is-thread-in-progress":Mc.value,"initial-file-path":Qr.value,"commit-sha":Xr.value,onClose:p[25]||(p[25]=b=>Hn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(_(),F(ot,{key:1},[w("div",PO,[Oe(h(t),{ref_key:"threadConversationRef",ref:ir,messages:fl.value,"is-loading":h(oe),"active-thread-id":Ks.value,cwd:yn.value,"live-overlay":Fy.value,"live-turn-id":h(Q),"pending-requests":h(ve),"has-more-persisted-above":h(ut),"is-loading-persisted-above":h(le),"load-earlier-messages":h(He),onForkThread:Zw,onRollback:$b,onFileChangesChanged:nw,onRespondServerRequest:vp},null,8,["messages","is-loading","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:Eo},[Xf.value?(_(),F("div",RO,D(h(f)("This thread is running in the Codex TUI")),1)):ye("",!0),h(Fe)?(_(),F("div",EO,[w("span",null,D(h(f)(h(Fe))),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[26]||(p[26]=b=>xt(b,h(Fe)))},D(h(f)("Send feedback")),9,MO)])):ye("",!0),Oe(h(v),{messages:h(zt),onEdit:rb,onSteer:h(pa),onDelete:h(Ha),onReorder:Lb},null,8,["messages","onSteer","onDelete"]),wl.value?(_(),F("div",jO,[w("span",null,D(wl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":h(f)("Dismiss"),onClick:p[27]||(p[27]=b=>wl.value="")}," × ",8,LO)])):ye("",!0),au.value?(_(),Qe(h(c),{key:3,request:au.value,"request-count":h(ve).length,"has-queue-above":h(zt).length>0,"panel-width":Mo.value,"visual-viewport-height":pl.value?Ws.value:0,"panel-error":By.value,onRespondServerRequest:vp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(_(),Qe(Em,{key:4,ref_key:"threadComposerRef",ref:vo,"active-thread-id":Ks.value,cwd:yn.value,"fuzzy-file-search-results":h(st),onRegisterFuzzySession:h(mt),"collaboration-modes":h(ke),"selected-collaboration-mode":h(ce),models:h($e),"model-reasoning-efforts":h(te),"selected-model":Jf.value,"selected-reasoning-effort":h(Le),"selected-speed-mode":h(Pe),"is-updating-speed-mode":h(M),skills:h(Ke),"thread-token-usage":h(W),"codex-quota":h(me),"is-turn-in-progress":Mc.value,"is-stop-pending":h(A),"is-interrupting-turn":h(Be),"is-compacting":Hy.value,"external-session-active":Xf.value,"has-queue-above":h(zt).length>0,"send-with-enter":os.value,"in-progress-submit-mode":ta.value,"dictation-click-to-toggle":rs.value,"dictation-auto-send":Yo.value,"dictation-language":xr.value,"onUpdate:selectedCollaborationMode":Lp,onSubmit:Sp,"onUpdate:selectedModel":Rp,"onUpdate:selectedReasoningEffort":Ep,"onUpdate:selectedSpeedMode":Mp,"approval-policy":Jr.value,"is-approval-policy-saving":ba.value,"approval-policy-error":Rn.value,"approval-policy-notice":To.value,"onUpdate:approvalPolicy":Os,onSaveApprovalPolicy:Gn,"plan-panel":Ec.value,onInterrupt:Nb,onSlashCommand:jp,onImplementPlan:Ob,onCompactContext:Wy},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","is-turn-in-progress","is-stop-pending","is-interrupting-turn","is-compacting","external-session-active","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice","plan-panel"]))],512)],64))]))])],6),h(kt)&&h(sn)?(_(),F("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...b)=>h(yo)&&h(yo)(...b))})):ye("",!0),su.value&&(h(kt)||!h(to))?(_(),F("aside",{key:1,class:at(["content-right-panel",{"is-mobile-open":h(sn)}]),style:er({"--right-panel-width":`${h(nn)}px`})},[h(kt)?ye("",!0):(_(),F("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:p[29]||(p[29]=(...b)=>h(qo)&&h(qo)(...b))},null,32)),w("div",NO,[w("div",$O,[w("button",{class:at(["content-right-panel-tab",{"is-active":h(tn)==="git"}]),type:"button",role:"tab","aria-selected":h(tn)==="git",onClick:p[30]||(p[30]=b=>h(Ht)("git"))},[Oe(Ju,{class:"content-right-panel-tab-icon"}),ws(" "+D(h(f)("Git")),1)],10,OO),w("button",{class:at(["content-right-panel-tab",{"is-active":h(tn)==="files"}]),type:"button",role:"tab","aria-selected":h(tn)==="files",onClick:p[31]||(p[31]=b=>h(Ht)("files"))},[Oe(Lm,{class:"content-right-panel-tab-icon"}),ws(" "+D(h(f)("Files")),1)],10,DO),(_(!0),F(ot,null,Zt(h(Wr),b=>(_(),F("button",{key:b.key,class:at(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":h(tn)==="preview"&&h(go)===b.key}]),type:"button",role:"tab","aria-selected":h(tn)==="preview"&&h(go)===b.key,title:b.path,onClick:O=>h(Gr)(b.key)},[Oe(Zi,{class:"content-right-panel-tab-icon"}),w("span",BO,D(b.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":h(f)("Close"),title:h(f)("Close"),onClick:gt(O=>h(Wo)(b.key),["stop"])},"×",8,UO)],10,FO))),128))]),w("div",zO,[w("div",HO,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":h(f)("Add panel"),title:h(f)("Add panel"),onClick:p[32]||(p[32]=gt(b=>zn.value=!h(zn),["stop"]))},"+",8,qO),Oe(Xl,{name:"right-panel-menu"},{default:dt(()=>[h(zn)?(_(),F("div",WO,[w("button",{type:"button",onClick:p[33]||(p[33]=b=>h(Ht)("terminal"))},[Oe(z1,{class:"content-right-panel-menu-icon"}),ws(" "+D(h(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=b=>h(Ht)("git"))},[Oe(Ju,{class:"content-right-panel-menu-icon"}),ws(" "+D(h(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=b=>h(Ht)("files"))},[Oe(Lm,{class:"content-right-panel-menu-icon"}),ws(" "+D(h(f)("Files panel")),1)])])):ye("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":h(f)("Close panel"),title:h(f)("Close panel"),onClick:p[36]||(p[36]=(...b)=>h(yo)&&h(yo)(...b))},[Oe(nf,{class:"content-right-panel-close-icon"})],8,GO)])]),w("div",VO,[h(tn)==="git"?(_(),Qe(h(i),{key:0,"current-branch":So.value,"head-sha":No.value,"head-subject":$o.value,"head-date":Zr.value,detached:x.value,dirty:R.value,"worktree-change-summary":k.value,"worktree-changes":G.value,branches:Za.value,"commits-by-branch":Ot.value,"commits-loading-for":ao.value,"commits-error":Co.value,"commit-files-by-sha":cn.value,"commit-files-loading-for":br.value,"commit-files-error":es.value,loading:ts.value,busy:Tr.value,error:We.value,"review-open":Hn.value,"show-review":h(vt).name==="thread"&&h(ne).length>0,onToggleReview:fb,onCheckoutBranch:lb,onResetBranchToCommit:ub,onLoadCommits:kp,onLoadCommitFiles:cb,onOpenCommitFile:db},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"])):h(tn)==="files"?(_(),Qe(h(l),{key:1,cwd:yn.value,onOpenPreview:h(js)},null,8,["cwd","onOpenPreview"])):h(tn)==="preview"&&h(Lt)?(_(),Qe(h(d),{key:2,"file-path":h(Lt).path,name:h(Lt).label},null,8,["file-path","name"])):(_(),Qe(h(n),{key:3,ref_key:"threadTerminalPanelRef",ref:lr,"thread-id":Ks.value,cwd:yn.value,onHide:h(Ka),onTerminalFocusChange:h(no)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ye("",!0)])]),_:1},8,["is-sidebar-collapsed"]),C.value.phase!=="idle"?(_(),F("div",KO,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":h(f)("Export Project"),onClick:p[38]||(p[38]=gt(()=>{},["stop"]))},[w("div",JO,[w("h2",QO,D(h(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":h(f)("Close"),disabled:C.value.phase==="exporting",onClick:hp}," × ",8,XO)]),w("p",ZO,D(C.value.phase==="exporting"?h(f)("Preparing project ZIP..."):C.value.fileName),1),w("div",eD,[w("span",null,D(C.value.phase==="exporting"?h(f)("Exporting"):h(f)("Ready")),1),w("span",null,D(sl.value),1)]),w("div",tD,[w("div",{class:"project-zip-progress-fill",style:er({width:Jo.value})},null,4)]),C.value.error?(_(),F("p",nD,D(C.value.error),1)):ye("",!0),w("div",oD,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:C.value.phase==="exporting",onClick:hp},D(h(f)("Close")),9,rD),w("button",{class:"project-zip-modal-action",type:"button",disabled:!C.value.blob,onClick:zw},D(h(f)("Download")),9,aD),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!C.value.blob,onClick:Hw},D(h(f)("Share")),9,sD)])],8,YO)])):ye("",!0),Si.value?(_(),F("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Uc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":h(f)("Complete Codex login"),onSubmit:gt(Iw,["prevent"]),onClick:p[41]||(p[41]=gt(()=>{},["stop"]))},[w("div",lD,[w("h2",uD,D(h(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":h(f)("Close"),disabled:En.value,onClick:Uc}," × ",8,cD)]),w("p",dD,D(h(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),ns.value?(_(),F("a",{key:0,class:"codex-login-modal-link",href:ns.value,target:"_blank",rel:"noreferrer"},D(h(f)("Open login URL")),9,fD)):ye("",!0),xn(w("input",{ref_key:"codexLoginCallbackInputRef",ref:tu,"onUpdate:modelValue":p[39]||(p[39]=b=>Ca.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:h(f)("Paste localhost callback URL"),disabled:En.value},null,8,pD),[[Nn,Ca.value]]),Qt.value?(_(),F("div",hD,[w("span",null,D(Qt.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[40]||(p[40]=b=>xt(b,Qt.value))},D(h(f)("Send feedback")),9,mD)])):ye("",!0),w("div",vD,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:En.value,onClick:Uc},D(h(f)("Cancel")),9,gD),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:En.value||Ca.value.trim().length===0},D(En.value?h(f)("Completing…"):h(f)("Complete")),9,yD)])],40,iD)])):ye("",!0)],64))}}),TD=It(bD,[["__scopeId","data-v-d285a7c1"]]),Pu={render:()=>null},SD=nx({history:L0(),routes:[{path:"/",name:"home",component:Pu},{path:"/thread/:threadId",name:"thread",component:Pu},{path:"/skills",name:"skills",component:Pu},{path:"/automations",name:"automations",component:Pu},{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");OA();WC(TD).use(SD).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Jg("Service worker registration failed."),e)})});export{CD as $,Ju as A,_o as B,Cs as C,Su as D,cj as E,ot as F,_r as G,Of as H,nf as I,Nt as J,xD as K,Af as L,NR as M,eA as N,pi as O,Gk as P,_D as Q,ID as R,PD as S,Vi as T,AD as U,RD as V,ci as W,nF as X,rF as Y,oF as Z,It as _,BN as a,Ao as a0,qf as a1,xn as a2,Nn as a3,rx as a4,ox as a5,$k as a6,DD as a7,ED as a8,MD as a9,DC as aA,eF as aB,tF as aC,jD as aa,HD as ab,KD as ac,YD as ad,FD as ae,VD as af,ND as ag,LD as ah,$D as ai,OD as aj,JD as ak,XD as al,ZD as am,BD as an,UD as ao,zD as ap,qD as aq,GD as ar,WD as as,QD as at,gx as au,yx as av,bs as aw,VR as ax,kD as ay,Zi as az,FN as b,K as c,Nm as d,hn as e,_ as f,jf as g,Qe as h,F as i,w as j,ye as k,Zt as l,ws as m,at as n,_s as o,Oe as p,Xl as q,T as r,dt as s,D as t,h as u,da as v,gt as w,nt as x,er as y,ey as z};
|