codex-mobile-re 0.1.99 → 0.1.101
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/README.md +214 -214
- package/dist/assets/AutomationsPanel-BujKO0oC.js +1 -0
- package/dist/assets/{AutomationsPanel-VRBbmMYW.css → AutomationsPanel-ulx5N8pM.css} +1 -1
- package/dist/assets/DirectoryHub-BOBZNd77.css +1 -0
- package/dist/assets/DirectoryHub-C4D0oVqF.js +2 -0
- package/dist/assets/{ReviewPane-BJDgzRm5.js → ReviewPane-DJs-RkeF.js} +1 -1
- package/dist/assets/ThreadConversation-CO1w6DqK.js +39 -0
- package/dist/assets/ThreadConversation-Db8A09JM.css +1 -0
- package/dist/assets/{ThreadTerminalPanel-BvTM32Ld.js → ThreadTerminalPanel-BrRExfgh.js} +1 -1
- package/dist/assets/index-CA0M4Wjh.js +86 -0
- package/dist/assets/index-DpBCV6zI.css +1 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +16 -3
- package/dist-cli/index.js.map +1 -1
- package/package.json +94 -94
- package/dist/assets/AutomationsPanel-DZWPqxB8.js +0 -1
- package/dist/assets/DirectoryHub-Cfo8Fvin.css +0 -1
- package/dist/assets/DirectoryHub-Ck4f6pd_.js +0 -2
- package/dist/assets/ThreadConversation-AWze4DXm.js +0 -39
- package/dist/assets/ThreadConversation-bN6NnVYj.css +0 -1
- package/dist/assets/index-Ba0WA2wF.css +0 -1
- package/dist/assets/index-CZP3HKY9.js +0 -86
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-CO1w6DqK.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-Db8A09JM.css","assets/ThreadTerminalPanel-BrRExfgh.js","assets/ThreadTerminalPanel-O7IxAyfy.css","assets/ReviewPane-DJs-RkeF.js","assets/ReviewPane-C3Zdl2_i.css","assets/DirectoryHub-C4D0oVqF.js","assets/DirectoryHub-BOBZNd77.css","assets/AutomationsPanel-BujKO0oC.js","assets/AutomationsPanel-ulx5N8pM.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 s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();/**
|
|
3
|
+
* @vue/shared v3.5.40
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function Jf(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const en={},vl=[],qa=()=>{},$v=()=>!1,Ju=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Qu=e=>e.startsWith("onUpdate:"),On=Object.assign,Qf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},u0=Object.prototype.hasOwnProperty,Ht=(e,t)=>u0.call(e,t),dt=Array.isArray,gl=e=>_c(e)==="[object Map]",Xu=e=>_c(e)==="[object Set]",lh=e=>_c(e)==="[object Date]",wt=e=>typeof e=="function",un=e=>typeof e=="string",va=e=>typeof e=="symbol",Vt=e=>e!==null&&typeof e=="object",jv=e=>(Vt(e)||wt(e))&&wt(e.then)&&wt(e.catch),Lv=Object.prototype.toString,_c=e=>Lv.call(e),d0=e=>_c(e).slice(8,-1),Nv=e=>_c(e)==="[object Object]",Xf=e=>un(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,cc=Jf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Zu=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},f0=/-\w/g,qo=Zu(e=>e.replace(f0,t=>t.slice(1).toUpperCase())),p0=/\B([A-Z])/g,ti=Zu(e=>e.replace(p0,"-$1").toLowerCase()),ed=Zu(e=>e.charAt(0).toUpperCase()+e.slice(1)),Dd=Zu(e=>e?`on${ed(e)}`:""),ua=(e,t)=>!Object.is(e,t),Au=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Ov=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},Zf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},h0=e=>{const t=un(e)?Number(e):NaN;return isNaN(t)?e:t};let ch;const td=()=>ch||(ch=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function kr(e){if(dt(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=un(o)?y0(o):kr(o);if(r)for(const s in r)t[s]=r[s]}return t}else if(un(e)||Vt(e))return e}const m0=/;(?![^(]*\))/g,v0=/:([^]+)/,g0=/\/\*[^]*?\*\//g;function y0(e){const t={};return e.replace(g0,"").split(m0).forEach(n=>{if(n){const o=n.split(v0);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function Ke(e){let t="";if(un(e))t=e;else if(dt(e))for(let n=0;n<e.length;n++){const o=Ke(e[n]);o&&(t+=o+" ")}else if(Vt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const w0="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",b0=Jf(w0);function Dv(e){return!!e||e===""}function k0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=xc(e[o],t[o]);return n}function xc(e,t){if(e===t)return!0;let n=lh(e),o=lh(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=va(e),o=va(t),n||o)return e===t;if(n=dt(e),o=dt(t),n||o)return n&&o?k0(e,t):!1;if(n=Vt(e),o=Vt(t),n||o){if(!n||!o)return!1;const r=Object.keys(e).length,s=Object.keys(t).length;if(r!==s)return!1;for(const a in e){const l=e.hasOwnProperty(a),d=t.hasOwnProperty(a);if(l&&!d||!l&&d||!xc(e[a],t[a]))return!1}}return String(e)===String(t)}function Fv(e,t){return e.findIndex(n=>xc(n,t))}const Uv=e=>!!(e&&e.__v_isRef===!0),T=e=>un(e)?e:e==null?"":dt(e)||Vt(e)&&(e.toString===Lv||!wt(e.toString))?Uv(e)?T(e.value):JSON.stringify(e,Bv,2):String(e),Bv=(e,t)=>Uv(t)?Bv(e,t.value):gl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],s)=>(n[Fd(o,s)+" =>"]=r,n),{})}:Xu(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Fd(n))}:va(t)?Fd(t):Vt(t)&&!dt(t)&&!Nv(t)?String(t):t,Fd=(e,t="")=>{var n;return va(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 ro;class C0{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&&ro&&(ro.active?(this.parent=ro,this.index=(ro.scopes||(ro.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=ro;try{return ro=this,t()}finally{ro=n}}}on(){++this._on===1&&(this.prevScope=ro,ro=this)}off(){if(this._on>0&&--this._on===0){if(ro===this)ro=this.prevScope;else{let t=ro;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 T0(){return ro}let rn;const Ud=new WeakSet;class qv{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,ro&&(ro.active?ro.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ud.has(this)&&(Ud.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Hv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,uh(this),Wv(this);const t=rn,n=pa;rn=this,pa=!0;try{return this.fn()}finally{Vv(this),rn=t,pa=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)np(t);this.deps=this.depsTail=void 0,uh(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ud.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){gf(this)&&this.run()}get dirty(){return gf(this)}}let zv=0,uc,dc;function Hv(e,t=!1){if(e.flags|=8,t){e.next=dc,dc=e;return}e.next=uc,uc=e}function ep(){zv++}function tp(){if(--zv>0)return;if(dc){let t=dc;for(dc=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;uc;){let t=uc;for(uc=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 Wv(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),np(o),S0(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function gf(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===gc)||(e.globalVersion=gc,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!gf(e))))return;e.flags|=2;const t=e.dep,n=rn,o=pa;rn=e,pa=!0;try{Wv(e);const r=e.fn(e._value);(t.version===0||ua(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{rn=n,pa=o,Vv(e),e.flags&=-3}}function np(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 s=n.computed.deps;s;s=s.nextDep)np(s,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function S0(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let pa=!0;const Kv=[];function ms(){Kv.push(pa),pa=!1}function vs(){const e=Kv.pop();pa=e===void 0?!0:e}function uh(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=rn;rn=void 0;try{t()}finally{rn=n}}}let gc=0;class _0{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 op{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(!rn||!pa||rn===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==rn)n=this.activeLink=new _0(rn,this),rn.deps?(n.prevDep=rn.depsTail,rn.depsTail.nextDep=n,rn.depsTail=n):rn.deps=rn.depsTail=n,Yv(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=rn.depsTail,n.nextDep=void 0,rn.depsTail.nextDep=n,rn.depsTail=n,rn.deps===n&&(rn.deps=o)}return n}trigger(t){this.version++,gc++,this.notify(t)}notify(t){ep();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{tp()}}}function Yv(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)Yv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const yf=new WeakMap,Di=Symbol(""),wf=Symbol(""),yc=Symbol("");function So(e,t,n){if(pa&&rn){let o=yf.get(e);o||yf.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new op),r.map=o,r.key=n),r.track()}}function ds(e,t,n,o,r,s){const a=yf.get(e);if(!a){gc++;return}const l=d=>{d&&d.trigger()};if(ep(),t==="clear")a.forEach(l);else{const d=dt(e),h=d&&Xf(n);if(d&&n==="length"){const v=Number(o);a.forEach((y,_)=>{(_==="length"||_===yc||!va(_)&&_>=v)&&l(y)})}else switch((n!==void 0||a.has(void 0))&&l(a.get(n)),h&&l(a.get(yc)),t){case"add":d?h&&l(a.get("length")):(l(a.get(Di)),gl(e)&&l(a.get(wf)));break;case"delete":d||(l(a.get(Di)),gl(e)&&l(a.get(wf)));break;case"set":gl(e)&&l(a.get(Di));break}}tp()}function sl(e){const t=Dt(e);return t===e?t:(So(t,"iterate",yc),zr(e)?t:t.map(ga))}function nd(e){return So(e=Dt(e),"iterate",yc),e}function Ua(e,t){return gs(e)?Sl(Fi(e)?ga(t):t):ga(t)}const x0={__proto__:null,[Symbol.iterator](){return Bd(this,Symbol.iterator,e=>Ua(this,e))},concat(...e){return sl(this).concat(...e.map(t=>dt(t)?sl(t):t))},entries(){return Bd(this,"entries",e=>(e[1]=Ua(this,e[1]),e))},every(e,t){return rs(this,"every",e,t,void 0,arguments)},filter(e,t){return rs(this,"filter",e,t,n=>n.map(o=>Ua(this,o)),arguments)},find(e,t){return rs(this,"find",e,t,n=>Ua(this,n),arguments)},findIndex(e,t){return rs(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return rs(this,"findLast",e,t,n=>Ua(this,n),arguments)},findLastIndex(e,t){return rs(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return rs(this,"forEach",e,t,void 0,arguments)},includes(...e){return qd(this,"includes",e)},indexOf(...e){return qd(this,"indexOf",e)},join(e){return sl(this).join(e)},lastIndexOf(...e){return qd(this,"lastIndexOf",e)},map(e,t){return rs(this,"map",e,t,void 0,arguments)},pop(){return Ql(this,"pop")},push(...e){return Ql(this,"push",e)},reduce(e,...t){return dh(this,"reduce",e,t)},reduceRight(e,...t){return dh(this,"reduceRight",e,t)},shift(){return Ql(this,"shift")},some(e,t){return rs(this,"some",e,t,void 0,arguments)},splice(...e){return Ql(this,"splice",e)},toReversed(){return sl(this).toReversed()},toSorted(e){return sl(this).toSorted(e)},toSpliced(...e){return sl(this).toSpliced(...e)},unshift(...e){return Ql(this,"unshift",e)},values(){return Bd(this,"values",e=>Ua(this,e))}};function Bd(e,t,n){const o=nd(e),r=o[t]();return o!==e&&!zr(e)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=n(s.value)),s}),r}const A0=Array.prototype;function rs(e,t,n,o,r,s){const a=nd(e),l=a!==e&&!zr(e),d=a[t];if(d!==A0[t]){const y=d.apply(e,s);return l?ga(y):y}let h=n;a!==e&&(l?h=function(y,_){return n.call(this,Ua(e,y),_,e)}:n.length>2&&(h=function(y,_){return n.call(this,y,_,e)}));const v=d.call(a,h,o);return l&&r?r(v):v}function dh(e,t,n,o){const r=nd(e),s=r!==e&&!zr(e);let a=n,l=!1;r!==e&&(s?(l=o.length===0,a=function(h,v,y){return l&&(l=!1,h=Ua(e,h)),n.call(this,h,Ua(e,v),y,e)}):n.length>3&&(a=function(h,v,y){return n.call(this,h,v,y,e)}));const d=r[t](a,...o);return l?Ua(e,d):d}function qd(e,t,n){const o=Dt(e);So(o,"iterate",yc);const r=o[t](...n);return(r===-1||r===!1)&&sp(n[0])?(n[0]=Dt(n[0]),o[t](...n)):r}function Ql(e,t,n=[]){ms(),ep();const o=Dt(e)[t].apply(e,n);return tp(),vs(),o}const P0=Jf("__proto__,__v_isRef,__isVue"),Jv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(va));function I0(e){va(e)||(e=String(e));const t=Dt(this);return So(t,"has",e),t.hasOwnProperty(e)}class Qv{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,s=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return s;if(n==="__v_raw")return o===(r?s?F0:tg:s?eg:Zv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const a=dt(t);if(!r){let d;if(a&&(d=x0[n]))return d;if(n==="hasOwnProperty")return I0}const l=Reflect.get(t,n,xo(t)?t:o);if((va(n)?Jv.has(n):P0(n))||(r||So(t,"get",n),s))return l;if(xo(l)){const d=a&&Xf(n)?l:l.value;return r&&Vt(d)?kf(d):d}return Vt(l)?r?kf(l):od(l):l}}class Xv extends Qv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let s=t[n];const a=dt(t)&&Xf(n);if(!this._isShallow){const h=gs(s);if(!zr(o)&&!gs(o)&&(s=Dt(s),o=Dt(o)),!a&&xo(s)&&!xo(o))return h||(s.value=o),!0}const l=a?Number(n)<t.length:Ht(t,n),d=Reflect.set(t,n,o,xo(t)?t:r);return t===Dt(r)&&d&&(l?ua(o,s)&&ds(t,"set",n,o):ds(t,"add",n,o)),d}deleteProperty(t,n){const o=Ht(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&ds(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!va(n)||!Jv.has(n))&&So(t,"has",n),o}ownKeys(t){return So(t,"iterate",dt(t)?"length":Di),Reflect.ownKeys(t)}}class E0 extends Qv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const R0=new Xv,M0=new E0,$0=new Xv(!0);const bf=e=>e,au=e=>Reflect.getPrototypeOf(e);function j0(e,t,n){return function(...o){const r=this.__v_raw,s=Dt(r),a=gl(s),l=e==="entries"||e===Symbol.iterator&&a,d=e==="keys"&&a,h=r[e](...o),v=n?bf:t?Sl:ga;return!t&&So(s,"iterate",d?wf:Di),On(Object.create(h),{next(){const{value:y,done:_}=h.next();return _?{value:y,done:_}:{value:l?[v(y[0]),v(y[1])]:v(y),done:_}}})}}function su(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function L0(e,t){const n={get(r){const s=this.__v_raw,a=Dt(s),l=Dt(r);e||(ua(r,l)&&So(a,"get",r),So(a,"get",l));const{has:d}=au(a),h=t?bf:e?Sl:ga;if(d.call(a,r))return h(s.get(r));if(d.call(a,l))return h(s.get(l));s!==a&&s.get(r)},get size(){const r=this.__v_raw;return!e&&So(Dt(r),"iterate",Di),r.size},has(r){const s=this.__v_raw,a=Dt(s),l=Dt(r);return e||(ua(r,l)&&So(a,"has",r),So(a,"has",l)),r===l?s.has(r):s.has(r)||s.has(l)},forEach(r,s){const a=this,l=a.__v_raw,d=Dt(l),h=t?bf:e?Sl:ga;return!e&&So(d,"iterate",Di),l.forEach((v,y)=>r.call(s,h(v),h(y),a))}};return On(n,e?{add:su("add"),set:su("set"),delete:su("delete"),clear:su("clear")}:{add(r){const s=Dt(this),a=au(s),l=Dt(r),d=!t&&!zr(r)&&!gs(r)?l:r;return a.has.call(s,d)||ua(r,d)&&a.has.call(s,r)||ua(l,d)&&a.has.call(s,l)||(s.add(d),ds(s,"add",d,d)),this},set(r,s){!t&&!zr(s)&&!gs(s)&&(s=Dt(s));const a=Dt(this),{has:l,get:d}=au(a);let h=l.call(a,r);h||(r=Dt(r),h=l.call(a,r));const v=d.call(a,r);return a.set(r,s),h?ua(s,v)&&ds(a,"set",r,s):ds(a,"add",r,s),this},delete(r){const s=Dt(this),{has:a,get:l}=au(s);let d=a.call(s,r);d||(r=Dt(r),d=a.call(s,r)),l&&l.call(s,r);const h=s.delete(r);return d&&ds(s,"delete",r,void 0),h},clear(){const r=Dt(this),s=r.size!==0,a=r.clear();return s&&ds(r,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=j0(r,e,t)}),n}function rp(e,t){const n=L0(e,t);return(o,r,s)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Ht(n,r)&&r in o?n:o,r,s)}const N0={get:rp(!1,!1)},O0={get:rp(!1,!0)},D0={get:rp(!0,!1)};const Zv=new WeakMap,eg=new WeakMap,tg=new WeakMap,F0=new WeakMap;function U0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function od(e){return gs(e)?e:ap(e,!1,R0,N0,Zv)}function ng(e){return ap(e,!1,$0,O0,eg)}function kf(e){return ap(e,!0,M0,D0,tg)}function ap(e,t,n,o,r){if(!Vt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const s=r.get(e);if(s)return s;const a=U0(d0(e));if(a===0)return e;const l=new Proxy(e,a===2?o:n);return r.set(e,l),l}function Fi(e){return gs(e)?Fi(e.__v_raw):!!(e&&e.__v_isReactive)}function gs(e){return!!(e&&e.__v_isReadonly)}function zr(e){return!!(e&&e.__v_isShallow)}function sp(e){return e?!!e.__v_raw:!1}function Dt(e){const t=e&&e.__v_raw;return t?Dt(t):e}function B0(e){return!Ht(e,"__v_skip")&&Object.isExtensible(e)&&Ov(e,"__v_skip",!0),e}const ga=e=>Vt(e)?od(e):e,Sl=e=>Vt(e)?kf(e):e;function xo(e){return e?e.__v_isRef===!0:!1}function A(e){return og(e,!1)}function q0(e){return og(e,!0)}function og(e,t){return xo(e)?e:new z0(e,t)}class z0{constructor(t,n){this.dep=new op,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Dt(t),this._value=n?t:ga(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||zr(t)||gs(t);t=o?t:Dt(t),ua(t,n)&&(this._rawValue=t,this._value=o?t:ga(t),this.dep.trigger())}}function g(e){return xo(e)?e.value:e}const H0={get:(e,t,n)=>t==="__v_raw"?e:g(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return xo(r)&&!xo(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function rg(e){return Fi(e)?e:new Proxy(e,H0)}class W0{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new op(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=gc-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&rn!==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 V0(e,t,n=!1){let o,r;return wt(e)?o=e:(o=e.get,r=e.set),new W0(o,r,n)}const iu={},Lu=new WeakMap;let Ri;function G0(e,t=!1,n=Ri){if(n){let o=Lu.get(n);o||Lu.set(n,o=[]),o.push(e)}}function K0(e,t,n=en){const{immediate:o,deep:r,once:s,scheduler:a,augmentJob:l,call:d}=n,h=K=>r?K:zr(K)||r===!1||r===0?fs(K,1):fs(K);let v,y,_,P,j=!1,B=!1;if(xo(e)?(y=()=>e.value,j=zr(e)):Fi(e)?(y=()=>h(e),j=!0):dt(e)?(B=!0,j=e.some(K=>Fi(K)||zr(K)),y=()=>e.map(K=>{if(xo(K))return K.value;if(Fi(K))return h(K);if(wt(K))return d?d(K,2):K()})):wt(e)?t?y=d?()=>d(e,2):e:y=()=>{if(_){ms();try{_()}finally{vs()}}const K=Ri;Ri=v;try{return d?d(e,3,[P]):e(P)}finally{Ri=K}}:y=qa,t&&r){const K=y,ye=r===!0?1/0:r;y=()=>fs(K(),ye)}const J=T0(),ce=()=>{v.stop(),J&&J.active&&Qf(J.effects,v)};if(s&&t){const K=t;t=(...ye)=>{const _e=K(...ye);return ce(),_e}}let U=B?new Array(e.length).fill(iu):iu;const V=K=>{if(!(!(v.flags&1)||!v.dirty&&!K))if(t){const ye=v.run();if(K||r||j||(B?ye.some((_e,we)=>ua(_e,U[we])):ua(ye,U))){_&&_();const _e=Ri;Ri=v;try{const we=[ye,U===iu?void 0:B&&U[0]===iu?[]:U,P];U=ye,d?d(t,3,we):t(...we)}finally{Ri=_e}}}else v.run()};return l&&l(V),v=new qv(y),v.scheduler=a?()=>a(V,!1):V,P=K=>G0(K,!1,v),_=v.onStop=()=>{const K=Lu.get(v);if(K){if(d)d(K,4);else for(const ye of K)ye();Lu.delete(v)}},t?o?V(!0):U=v.run():a?a(V.bind(null,!0),!0):v.run(),ce.pause=v.pause.bind(v),ce.resume=v.resume.bind(v),ce.stop=ce,ce}function fs(e,t=1/0,n){if(t<=0||!Vt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,xo(e))fs(e.value,t,n);else if(dt(e))for(let o=0;o<e.length;o++)fs(e[o],t,n);else if(Xu(e)||gl(e))e.forEach(o=>{fs(o,t,n)});else if(Nv(e)){for(const o in e)fs(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&fs(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 Ac(e,t,n,o){try{return o?e(...o):e()}catch(r){Pc(r,t,n)}}function Wr(e,t,n,o){if(wt(e)){const r=Ac(e,t,n,o);return r&&jv(r)&&r.catch(s=>{Pc(s,t,n)}),r}if(dt(e)){const r=[];for(let s=0;s<e.length;s++)r.push(Wr(e[s],t,n,o));return r}}function Pc(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||en;if(t){let l=t.parent;const d=t.proxy,h=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const v=l.ec;if(v){for(let y=0;y<v.length;y++)if(v[y](e,d,h)===!1)return}l=l.parent}if(s){ms(),Ac(s,null,10,[e,d,h]),vs();return}}Y0(e,n,r,o,a)}function Y0(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const Uo=[];let Fa=-1;const yl=[];let Gs=null,dl=0;const ag=Promise.resolve();let Nu=null;function Wt(e){const t=Nu||ag;return e?t.then(this?e.bind(this):e):t}function J0(e){let t=Fa+1,n=Uo.length;for(;t<n;){const o=t+n>>>1,r=Uo[o],s=wc(r);s<e||s===e&&r.flags&2?t=o+1:n=o}return t}function ip(e){if(!(e.flags&1)){const t=wc(e),n=Uo[Uo.length-1];!n||!(e.flags&2)&&t>=wc(n)?Uo.push(e):Uo.splice(J0(t),0,e),e.flags|=1,sg()}}function sg(){Nu||(Nu=ag.then(lg))}function Q0(e){dt(e)?yl.push(...e):Gs&&e.id===-1?Gs.splice(dl+1,0,e):e.flags&1||(yl.push(e),e.flags|=1),sg()}function fh(e,t,n=Fa+1){for(;n<Uo.length;n++){const o=Uo[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;Uo.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function ig(e){if(yl.length){const t=[...new Set(yl)].sort((n,o)=>wc(n)-wc(o));if(yl.length=0,Gs){Gs.push(...t);return}for(Gs=t,dl=0;dl<Gs.length;dl++){const n=Gs[dl];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Gs=null,dl=0}}const wc=e=>e.id==null?e.flags&2?-1:1/0:e.id;function lg(e){try{for(Fa=0;Fa<Uo.length;Fa++){const t=Uo[Fa];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Ac(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Fa<Uo.length;Fa++){const t=Uo[Fa];t&&(t.flags&=-2)}Fa=-1,Uo.length=0,ig(),Nu=null,(Uo.length||yl.length)&&lg()}}let so=null,cg=null;function Ou(e){const t=so;return so=e,cg=e&&e.type.__scopeId||null,t}function yt(e,t=so,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&Uu(-1);const s=Ou(t),a=hs.length;let l;try{l=e(...r)}finally{for(let d=hs.length;d>a;d--)pp();Ou(s),o._d&&Uu(1)}return l};return o._n=!0,o._c=!0,o._d=!0,o}function Lt(e,t){if(so===null)return e;const n=id(so),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[s,a,l,d=en]=t[r];s&&(wt(s)&&(s={mounted:s,updated:s}),s.deep&&fs(a),o.push({dir:s,instance:n,value:a,oldValue:void 0,arg:l,modifiers:d}))}return e}function Ai(e,t,n,o){const r=e.dirs,s=t&&t.dirs;for(let a=0;a<r.length;a++){const l=r[a];s&&(l.oldValue=s[a].value);let d=l.dir[o];d&&(ms(),Wr(d,n,8,[e.el,l,e,t]),vs())}}function Pu(e,t){if(ao){let n=ao.provides;const o=ao.parent&&ao.parent.provides;o===n&&(n=ao.provides=Object.create(o)),n[e]=t}}function ha(e,t,n=!1){const o=hp();if(o||bl){let r=bl?bl._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&&wt(t)?t.call(o&&o.proxy):t}}const X0=Symbol.for("v-scx"),Z0=()=>ha(X0);function nt(e,t,n){return ug(e,t,n)}function ug(e,t,n=en){const{immediate:o,deep:r,flush:s,once:a}=n,l=On({},n),d=t&&o||!t&&s!=="post";let h;if(xl){if(s==="sync"){const P=Z0();h=P.__watcherHandles||(P.__watcherHandles=[])}else if(!d){const P=()=>{};return P.stop=qa,P.resume=qa,P.pause=qa,P}}const v=ao;l.call=(P,j,B)=>Wr(P,v,j,B);let y=!1;s==="post"?l.scheduler=P=>{Do(P,v&&v.suspense)}:s!=="sync"&&(y=!0,l.scheduler=(P,j)=>{j?P():ip(P)}),l.augmentJob=P=>{t&&(P.flags|=4),y&&(P.flags|=2,v&&(P.id=v.uid,P.i=v))};const _=K0(e,t,l);return xl&&(h?h.push(_):d&&_()),_}function ek(e,t,n){const o=this.proxy,r=un(e)?e.includes(".")?dg(o,e):()=>o[e]:e.bind(o,o);let s;wt(t)?s=t:(s=t.handler,n=t);const a=Rc(this),l=ug(r,s.bind(o),n);return a(),l}function dg(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 Hs=new WeakMap,fg=Symbol("_vte"),pg=e=>e.__isTeleport,$i=e=>e&&(e.disabled||e.disabled===""),tk=e=>e&&(e.defer||e.defer===""),ph=e=>typeof SVGElement<"u"&&e instanceof SVGElement,hh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Cf=(e,t)=>{const n=e&&e.to;return un(n)?t?t(n):null:n},nk={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,s,a,l,d,h){const{mc:v,pc:y,pbc:_,o:{insert:P,querySelector:j,createText:B,createComment:J,parentNode:ce}}=h,U=$i(t.props);let{dynamicChildren:V}=t;const K=(we,$e,de)=>{we.shapeFlag&16&&v(we.children,$e,de,r,s,a,l,d)},ye=(we=t)=>{const $e=$i(we.props),de=we.target=Cf(we.props,j),Le=Tf(de,we,B,P);de&&(a!=="svg"&&ph(de)?a="svg":a!=="mathml"&&hh(de)&&(a="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(de),$e||(K(we,de,Le),ac(we,!1)))},_e=we=>{const $e=()=>{if(Hs.get(we)===$e){if(Hs.delete(we),$i(we.props)){const de=ce(we.el)||n;K(we,de,we.anchor),ac(we,!0)}ye(we)}};Hs.set(we,$e),Do($e,s)};if(e==null){const we=t.el=B(""),$e=t.anchor=B("");if(P(we,n,o),P($e,n,o),tk(t.props)||s&&s.pendingBranch){_e(t);return}U&&(K(t,n,$e),ac(t,!0)),ye()}else{t.el=e.el;const we=t.anchor=e.anchor,$e=Hs.get(e);if($e){$e.flags|=8,Hs.delete(e),_e(t);return}t.targetStart=e.targetStart;const de=t.target=e.target,Le=t.targetAnchor=e.targetAnchor,je=$i(e.props),fe=je?n:de,Te=je?we:Le;if(a==="svg"||ph(de)?a="svg":(a==="mathml"||hh(de))&&(a="mathml"),V?(_(e.dynamicChildren,V,fe,r,s,a,l),fp(e,t,!0)):d||y(e,t,fe,Te,r,s,a,l,!1),U)je?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):lu(t,n,we,h,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const xe=Cf(t.props,j);xe&&(t.target=xe,lu(t,xe,null,h,0))}else je&&lu(t,de,Le,h,1);ac(t,U)}},remove(e,t,n,{um:o,o:{remove:r}},s){const{shapeFlag:a,children:l,anchor:d,targetStart:h,targetAnchor:v,target:y,props:_}=e,P=$i(_),j=s||!P,B=Hs.get(e);if(B&&(B.flags|=8,Hs.delete(e)),y&&(r(h),r(v)),s&&r(d),!B&&(P||y)&&a&16)for(let J=0;J<l.length;J++){const ce=l[J];o(ce,t,n,j,!!ce.dynamicChildren)}},move:lu,hydrate:ok};function lu(e,t,n,{o:{insert:o},m:r},s=2){s===0&&o(e.targetAnchor,t,n);const{el:a,anchor:l,shapeFlag:d,children:h,props:v}=e,y=s===2;if(y&&o(a,t,n),!Hs.has(e)&&(!y||$i(v))&&d&16)for(let _=0;_<h.length;_++)r(h[_],t,n,2);y&&o(l,t,n)}function ok(e,t,n,o,r,s,{o:{nextSibling:a,parentNode:l,querySelector:d,insert:h,createText:v}},y){function _(J,ce){let U=ce;for(;U;){if(U&&U.nodeType===8){if(U.data==="teleport start anchor")t.targetStart=U;else if(U.data==="teleport anchor"){t.targetAnchor=U,J._lpa=t.targetAnchor&&a(t.targetAnchor);break}}U=a(U)}}function P(J,ce){ce.anchor=y(a(J),ce,l(J),n,o,r,s)}const j=t.target=Cf(t.props,d),B=$i(t.props);if(j){const J=j._lpa||j.firstChild;t.shapeFlag&16&&(B?(P(e,t),_(j,J),t.targetAnchor||Tf(j,t,v,h,l(e)===j?e:null)):(t.anchor=a(e),_(j,J),t.targetAnchor||Tf(j,t,v,h),y(J&&a(J),t,j,n,o,r,s))),ac(t,B)}else B&&t.shapeFlag&16&&(P(e,t),t.targetStart=e,t.targetAnchor=a(e));return t.anchor&&a(t.anchor)}const Xs=nk;function ac(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 Tf(e,t,n,o,r=null){const s=t.targetStart=n(""),a=t.targetAnchor=n("");return s[fg]=a,e&&(o(s,e,r),o(a,e,r)),a}const qr=Symbol("_leaveCb"),Xl=Symbol("_enterCb");function rk(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ws(()=>{e.isMounted=!0}),qi(()=>{e.isUnmounting=!0}),e}const Br=[Function,Array],hg={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Br,onEnter:Br,onAfterEnter:Br,onEnterCancelled:Br,onBeforeLeave:Br,onLeave:Br,onAfterLeave:Br,onLeaveCancelled:Br,onBeforeAppear:Br,onAppear:Br,onAfterAppear:Br,onAppearCancelled:Br},mg=e=>{const t=e.subTree;return t.component?mg(t.component):t},ak={name:"BaseTransition",props:hg,setup(e,{slots:t}){const n=hp(),o=rk();return()=>{const r=t.default&&yg(t.default(),!0),s=r&&r.length?vg(r):n.subTree?ee():void 0;if(!s)return;const a=Dt(e),{mode:l}=a;if(o.isLeaving)return zd(s);const d=mh(s);if(!d)return zd(s);let h=Sf(d,a,o,n,y=>h=y);d.type!==_o&&bc(d,h);let v=n.subTree&&mh(n.subTree);if(v&&v.type!==_o&&!ji(v,d)&&mg(n).type!==_o){let y=Sf(v,a,o,n);if(bc(v,y),l==="out-in"&&d.type!==_o)return o.isLeaving=!0,y.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete y.afterLeave,v=void 0},zd(s);l==="in-out"&&d.type!==_o?y.delayLeave=(_,P,j)=>{const B=gg(o,v);B[String(v.key)]=v,_[qr]=()=>{P(),_[qr]=void 0,delete h.delayedLeave,v=void 0},h.delayedLeave=()=>{j(),delete h.delayedLeave,v=void 0}}:v=void 0}else v&&(v=void 0);return s}}};function vg(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==_o){t=n;break}}return t}const sk=ak;function gg(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 Sf(e,t,n,o,r){const{appear:s,mode:a,persisted:l=!1,onBeforeEnter:d,onEnter:h,onAfterEnter:v,onEnterCancelled:y,onBeforeLeave:_,onLeave:P,onAfterLeave:j,onLeaveCancelled:B,onBeforeAppear:J,onAppear:ce,onAfterAppear:U,onAppearCancelled:V}=t,K=String(e.key),ye=gg(n,e),_e=(de,Le)=>{de&&Wr(de,o,9,Le)},we=(de,Le)=>{const je=Le[1];_e(de,Le),dt(de)?de.every(fe=>fe.length<=1)&&je():de.length<=1&&je()},$e={mode:a,persisted:l,beforeEnter(de){let Le=d;if(!n.isMounted)if(s)Le=J||d;else return;de[qr]&&de[qr](!0);const je=ye[K];je&&ji(e,je)&&je.el[qr]&&je.el[qr](),_e(Le,[de])},enter(de){if(ye[K]===e)return;let Le=h,je=v,fe=y;if(!n.isMounted)if(s)Le=ce||h,je=U||v,fe=V||y;else return;let Te=!1;de[Xl]=Ae=>{Te||(Te=!0,Ae?_e(fe,[de]):_e(je,[de]),$e.delayedLeave&&$e.delayedLeave(),de[Xl]=void 0)};const xe=de[Xl].bind(null,!1);Le?we(Le,[de,xe]):xe()},leave(de,Le){const je=String(e.key);if(de[Xl]&&de[Xl](!0),n.isUnmounting)return Le();_e(_,[de]);let fe=!1;de[qr]=xe=>{fe||(fe=!0,Le(),xe?_e(B,[de]):_e(j,[de]),de[qr]=void 0,ye[je]===e&&delete ye[je])};const Te=de[qr].bind(null,!1);ye[je]=e,P?we(P,[de,Te]):Te()},clone(de){const Le=Sf(de,t,n,o,r);return r&&r(Le),Le}};return $e}function zd(e){if(Ic(e))return e=ei(e),e.children=null,e}function mh(e){if(!Ic(e))return pg(e.type)&&e.children?vg(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&&wt(n.default))return n.default()}}function bc(e,t){e.shapeFlag&6&&e.component?(e.transition=t,bc(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 yg(e,t=!1,n){let o=[],r=0;for(let s=0;s<e.length;s++){let a=e[s];const l=n==null?a.key:String(n)+String(a.key!=null?a.key:s);a.type===ze?(a.patchFlag&128&&r++,o=o.concat(yg(a.children,t,l))):(t||a.type!==_o)&&o.push(l!=null?ei(a,{key:l}):a)}if(r>1)for(let s=0;s<o.length;s++)o[s].patchFlag=-2;return o}function tn(e,t){return wt(e)?On({name:e.name},t,{setup:e}):e}function lp(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function vh(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Du=new WeakMap;function fc(e,t,n,o,r=!1){if(dt(e)){e.forEach((B,J)=>fc(B,t&&(dt(t)?t[J]:t),n,o,r));return}if(wl(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&fc(e,t,n,o.component.subTree);return}const s=o.shapeFlag&4?id(o.component):o.el,a=r?null:s,{i:l,r:d}=e,h=t&&t.r,v=l.refs===en?l.refs={}:l.refs,y=l.setupState,_=Dt(y),P=y===en?$v:B=>vh(v,B)?!1:Ht(_,B),j=(B,J)=>!(J&&vh(v,J));if(h!=null&&h!==d){if(gh(t),un(h))v[h]=null,P(h)&&(y[h]=null);else if(xo(h)){const B=t;j(h,B.k)&&(h.value=null),B.k&&(v[B.k]=null)}}if(wt(d))Ac(d,l,12,[a,v]);else{const B=un(d),J=xo(d);if(B||J){const ce=()=>{if(e.f){const U=B?P(d)?y[d]:v[d]:j()||!e.k?d.value:v[e.k];if(r)dt(U)&&Qf(U,s);else if(dt(U))U.includes(s)||U.push(s);else if(B)v[d]=[s],P(d)&&(y[d]=v[d]);else{const V=[s];j(d,e.k)&&(d.value=V),e.k&&(v[e.k]=V)}}else B?(v[d]=a,P(d)&&(y[d]=a)):J&&(j(d,e.k)&&(d.value=a),e.k&&(v[e.k]=a))};if(a){const U=()=>{ce(),Du.delete(e)};U.id=-1,Du.set(e,U),Do(U,n)}else gh(e),ce()}}}function gh(e){const t=Du.get(e);t&&(t.flags|=8,Du.delete(e))}const yh=e=>e.nodeType===8;td().requestIdleCallback;td().cancelIdleCallback;function ik(e,t){if(yh(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(yh(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const wl=e=>!!e.type.__asyncLoader;function Zl(e){wt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:s,timeout:a,suspensible:l=!0,onError:d}=e;let h=null,v,y=0;const _=()=>(y++,h=null,P()),P=()=>{let j;return h||(j=h=t().catch(B=>{if(B=B instanceof Error?B:new Error(String(B)),d)return new Promise((J,ce)=>{d(B,()=>J(_()),()=>ce(B),y+1)});throw B}).then(B=>j!==h&&h?h:(B&&(B.__esModule||B[Symbol.toStringTag]==="Module")&&(B=B.default),v=B,B)))};return tn({name:"AsyncComponentWrapper",__asyncLoader:P,__asyncHydrate(j,B,J){const ce=j.isConnected;let U=!1;(B.bu||(B.bu=[])).push(()=>U=!0);const V=()=>{U||!j.parentNode||ce&&!j.isConnected||J()},K=s?()=>{const ye=s(V,_e=>ik(j,_e));ye&&(B.bum||(B.bum=[])).push(ye)}:V;v?K():P().then(()=>!B.isUnmounted&&K())},get __asyncResolved(){return v},setup(){const j=ao;if(lp(j),v)return()=>cu(v,j);const B=ye=>{h=null,Pc(ye,j,13,!o)};if(l&&j.suspense||xl)return P().then(ye=>()=>cu(ye,j)).catch(ye=>(B(ye),()=>o?Ie(o,{error:ye}):null));const J=A(!1),ce=A(),U=A(!!r);let V,K;return Ec(()=>{V!=null&&clearTimeout(V),K!=null&&clearTimeout(K)}),r&&(K=setTimeout(()=>{j.isUnmounted||(U.value=!1)},r)),a!=null&&(V=setTimeout(()=>{if(!j.isUnmounted&&!J.value&&!ce.value){const ye=new Error(`Async component timed out after ${a}ms.`);B(ye),ce.value=ye}},a)),P().then(()=>{j.isUnmounted||(J.value=!0,j.parent&&Ic(j.parent.vnode)&&j.parent.update())}).catch(ye=>{if(j.isUnmounted){h=null;return}B(ye),ce.value=ye}),()=>{if(J.value&&v)return cu(v,j);if(ce.value&&o)return Ie(o,{error:ce.value});if(n&&!U.value)return cu(n,j)}}})}function cu(e,t){const{ref:n,props:o,children:r,ce:s}=t.vnode,a=Ie(e,o,r);return a.ref=n,a.ce=s,delete t.vnode.ce,a}const Ic=e=>e.type.__isKeepAlive;function lk(e,t){wg(e,"a",t)}function ck(e,t){wg(e,"da",t)}function wg(e,t,n=ao){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(rd(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Ic(r.parent.vnode)&&uk(o,t,n,r),r=r.parent}}function uk(e,t,n,o){const r=rd(t,e,o,!0);Ec(()=>{Qf(o[t],r)},n)}function rd(e,t,n=ao,o=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...a)=>{ms();const l=Rc(n),d=Wr(t,n,e,a);return l(),vs(),d});return o?r.unshift(s):r.push(s),s}}const ys=e=>(t,n=ao)=>{(!xl||e==="sp")&&rd(e,(...o)=>t(...o),n)},dk=ys("bm"),ws=ys("m"),fk=ys("bu"),pk=ys("u"),qi=ys("bum"),Ec=ys("um"),hk=ys("sp"),mk=ys("rtg"),vk=ys("rtc");function gk(e,t=ao){rd("ec",e,t)}const yk="components",bg=Symbol.for("v-ndc");function cp(e){return un(e)?wk(yk,e,!1)||e:e||bg}function wk(e,t,n=!0,o=!1){const r=so||ao;if(r){const s=r.type;{const l=nC(s,!1);if(l&&(l===t||l===qo(t)||l===ed(qo(t))))return s}const a=wh(r[e]||s[e],t)||wh(r.appContext[e],t);return!a&&o?s:a}}function wh(e,t){return e&&(e[t]||e[qo(t)]||e[ed(qo(t))])}function _t(e,t,n,o){let r;const s=n,a=dt(e);if(a||un(e)){const l=a&&Fi(e);let d=!1,h=!1;l&&(d=!zr(e),h=gs(e),e=nd(e)),r=new Array(e.length);for(let v=0,y=e.length;v<y;v++)r[v]=t(d?h?Sl(ga(e[v])):ga(e[v]):e[v],v,void 0,s)}else if(typeof e=="number"){r=new Array(e);for(let l=0;l<e;l++)r[l]=t(l+1,l,void 0,s)}else if(Vt(e))if(e[Symbol.iterator])r=Array.from(e,(l,d)=>t(l,d,void 0,s));else{const l=Object.keys(e);r=new Array(l.length);for(let d=0,h=l.length;d<h;d++){const v=l[d];r[d]=t(e[v],v,d,s)}}else r=[];return r}function rr(e,t,n={},o,r,s){if(so.ce||so.parent&&wl(so.parent)&&so.parent.ce){const h=s!=null&&n.key==null?On({},n,{key:s}):n,v=Object.keys(h).length>0;return t!=="default"&&(h.name=t),S(),tt(ze,null,[Ie("slot",h,o)],v?-2:64)}let a=e[t];a&&a._c&&(a._d=!1);const l=hs.length;S();let d;try{const h=a&&kg(a(n)),v=n.key||s||h&&h.key;d=tt(ze,{key:(v&&!va(v)?v:`_${t}`)+(!h&&o?"_fb":"")},h||(o?o():[]),h&&e._===1?64:-2)}catch(h){for(let v=hs.length;v>l;v--)pp();throw h}finally{a&&a._c&&(a._d=!0)}return d}function kg(e){return e.some(t=>kc(t)?!(t.type===_o||t.type===ze&&!kg(t.children)):!0)?e:null}const _f=e=>e?Bg(e)?id(e):_f(e.parent):null,pc=On(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=>_f(e.parent),$root:e=>_f(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Tg(e),$forceUpdate:e=>e.f||(e.f=()=>{ip(e.update)}),$nextTick:e=>e.n||(e.n=Wt.bind(e.proxy)),$watch:e=>ek.bind(e)}),Hd=(e,t)=>e!==en&&!e.__isScriptSetup&&Ht(e,t),bk={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:s,accessCache:a,type:l,appContext:d}=e;if(t[0]!=="$"){const _=a[t];if(_!==void 0)switch(_){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return s[t]}else{if(Hd(o,t))return a[t]=1,o[t];if(r!==en&&Ht(r,t))return a[t]=2,r[t];if(Ht(s,t))return a[t]=3,s[t];if(n!==en&&Ht(n,t))return a[t]=4,n[t];xf&&(a[t]=0)}}const h=pc[t];let v,y;if(h)return t==="$attrs"&&So(e.attrs,"get",""),h(e);if((v=l.__cssModules)&&(v=v[t]))return v;if(n!==en&&Ht(n,t))return a[t]=4,n[t];if(y=d.config.globalProperties,Ht(y,t))return y[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:s}=e;return Hd(r,t)?(r[t]=n,!0):o!==en&&Ht(o,t)?(o[t]=n,!0):Ht(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:s,type:a}},l){let d;return!!(n[l]||e!==en&&l[0]!=="$"&&Ht(e,l)||Hd(t,l)||Ht(s,l)||Ht(o,l)||Ht(pc,l)||Ht(r.config.globalProperties,l)||(d=a.__cssModules)&&d[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ht(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function kk(){return Ck().slots}function Ck(e){const t=hp();return t.setupContext||(t.setupContext=zg(t))}function bh(e){return dt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let xf=!0;function Tk(e){const t=Tg(e),n=e.proxy,o=e.ctx;xf=!1,t.beforeCreate&&kh(t.beforeCreate,e,"bc");const{data:r,computed:s,methods:a,watch:l,provide:d,inject:h,created:v,beforeMount:y,mounted:_,beforeUpdate:P,updated:j,activated:B,deactivated:J,beforeDestroy:ce,beforeUnmount:U,destroyed:V,unmounted:K,render:ye,renderTracked:_e,renderTriggered:we,errorCaptured:$e,serverPrefetch:de,expose:Le,inheritAttrs:je,components:fe,directives:Te,filters:xe}=t;if(h&&Sk(h,o,null),a)for(const Ye in a){const He=a[Ye];wt(He)&&(o[Ye]=He.bind(n))}if(r){const Ye=r.call(n,n);Vt(Ye)&&(e.data=od(Ye))}if(xf=!0,s)for(const Ye in s){const He=s[Ye],At=wt(He)?He.bind(n,n):wt(He.get)?He.get.bind(n,n):qa,ct=!wt(He)&&wt(He.set)?He.set.bind(n):qa,Qe=X({get:At,set:ct});Object.defineProperty(o,Ye,{enumerable:!0,configurable:!0,get:()=>Qe.value,set:et=>Qe.value=et})}if(l)for(const Ye in l)Cg(l[Ye],o,n,Ye);if(d){const Ye=wt(d)?d.call(n):d;Reflect.ownKeys(Ye).forEach(He=>{Pu(He,Ye[He])})}v&&kh(v,e,"c");function Ue(Ye,He){dt(He)?He.forEach(At=>Ye(At.bind(n))):He&&Ye(He.bind(n))}if(Ue(dk,y),Ue(ws,_),Ue(fk,P),Ue(pk,j),Ue(lk,B),Ue(ck,J),Ue(gk,$e),Ue(vk,_e),Ue(mk,we),Ue(qi,U),Ue(Ec,K),Ue(hk,de),dt(Le))if(Le.length){const Ye=e.exposed||(e.exposed={});Le.forEach(He=>{Object.defineProperty(Ye,He,{get:()=>n[He],set:At=>n[He]=At,enumerable:!0})})}else e.exposed||(e.exposed={});ye&&e.render===qa&&(e.render=ye),je!=null&&(e.inheritAttrs=je),fe&&(e.components=fe),Te&&(e.directives=Te),de&&lp(e)}function Sk(e,t,n=qa){dt(e)&&(e=Af(e));for(const o in e){const r=e[o];let s;Vt(r)?"default"in r?s=ha(r.from||o,r.default,!0):s=ha(r.from||o):s=ha(r),xo(s)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):t[o]=s}}function kh(e,t,n){Wr(dt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Cg(e,t,n,o){let r=o.includes(".")?dg(n,o):()=>n[o];if(un(e)){const s=t[e];wt(s)&&nt(r,s)}else if(wt(e))nt(r,e.bind(n));else if(Vt(e))if(dt(e))e.forEach(s=>Cg(s,t,n,o));else{const s=wt(e.handler)?e.handler.bind(n):t[e.handler];wt(s)&&nt(r,s,e)}}function Tg(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=e.appContext,l=s.get(t);let d;return l?d=l:!r.length&&!n&&!o?d=t:(d={},r.length&&r.forEach(h=>Fu(d,h,a,!0)),Fu(d,t,a)),Vt(t)&&s.set(t,d),d}function Fu(e,t,n,o=!1){const{mixins:r,extends:s}=t;s&&Fu(e,s,n,!0),r&&r.forEach(a=>Fu(e,a,n,!0));for(const a in t)if(!(o&&a==="expose")){const l=_k[a]||n&&n[a];e[a]=l?l(e[a],t[a]):t[a]}return e}const _k={data:Ch,props:Th,emits:Th,methods:sc,computed:sc,beforeCreate:Oo,created:Oo,beforeMount:Oo,mounted:Oo,beforeUpdate:Oo,updated:Oo,beforeDestroy:Oo,beforeUnmount:Oo,destroyed:Oo,unmounted:Oo,activated:Oo,deactivated:Oo,errorCaptured:Oo,serverPrefetch:Oo,components:sc,directives:sc,watch:Ak,provide:Ch,inject:xk};function Ch(e,t){return t?e?function(){return On(wt(e)?e.call(this,this):e,wt(t)?t.call(this,this):t)}:t:e}function xk(e,t){return sc(Af(e),Af(t))}function Af(e){if(dt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Oo(e,t){return e?[...new Set([].concat(e,t))]:t}function sc(e,t){return e?On(Object.create(null),e,t):t}function Th(e,t){return e?dt(e)&&dt(t)?[...new Set([...e,...t])]:On(Object.create(null),bh(e),bh(t??{})):t}function Ak(e,t){if(!e)return t;if(!t)return e;const n=On(Object.create(null),e);for(const o in t)n[o]=Oo(e[o],t[o]);return n}function Sg(){return{app:null,config:{isNativeTag:$v,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 Pk=0;function Ik(e,t){return function(o,r=null){wt(o)||(o=On({},o)),r!=null&&!Vt(r)&&(r=null);const s=Sg(),a=new WeakSet,l=[];let d=!1;const h=s.app={_uid:Pk++,_component:o,_props:r,_container:null,_context:s,_instance:null,version:aC,get config(){return s.config},set config(v){},use(v,...y){return a.has(v)||(v&&wt(v.install)?(a.add(v),v.install(h,...y)):wt(v)&&(a.add(v),v(h,...y))),h},mixin(v){return s.mixins.includes(v)||s.mixins.push(v),h},component(v,y){return y?(s.components[v]=y,h):s.components[v]},directive(v,y){return y?(s.directives[v]=y,h):s.directives[v]},mount(v,y,_){if(!d){const P=h._ceVNode||Ie(o,r);return P.appContext=s,_===!0?_="svg":_===!1&&(_=void 0),e(P,v,_),d=!0,h._container=v,v.__vue_app__=h,id(P.component)}},onUnmount(v){l.push(v)},unmount(){d&&(Wr(l,h._instance,16),e(null,h._container),delete h._container.__vue_app__)},provide(v,y){return s.provides[v]=y,h},runWithContext(v){const y=bl;bl=h;try{return v()}finally{bl=y}}};return h}}let bl=null;const Ek=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${qo(t)}Modifiers`]||e[`${ti(t)}Modifiers`];function Rk(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||en;let r=n;const s=t.startsWith("update:"),a=s&&Ek(o,t.slice(7));a&&(a.trim&&(r=n.map(v=>un(v)?v.trim():v)),a.number&&(r=n.map(Zf)));let l,d=o[l=Dd(t)]||o[l=Dd(qo(t))];!d&&s&&(d=o[l=Dd(ti(t))]),d&&Wr(d,e,6,r);const h=o[l+"Once"];if(h){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Wr(h,e,6,r)}}const Mk=new WeakMap;function _g(e,t,n=!1){const o=n?Mk:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const s=e.emits;let a={},l=!1;if(!wt(e)){const d=h=>{const v=_g(h,t,!0);v&&(l=!0,On(a,v))};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}return!s&&!l?(Vt(e)&&o.set(e,null),null):(dt(s)?s.forEach(d=>a[d]=null):On(a,s),Vt(e)&&o.set(e,a),a)}function ad(e,t){return!e||!Ju(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Ht(e,t[0].toLowerCase()+t.slice(1))||Ht(e,ti(t))||Ht(e,t))}function Sh(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[s],slots:a,attrs:l,emit:d,render:h,renderCache:v,props:y,data:_,setupState:P,ctx:j,inheritAttrs:B}=e,J=Ou(e);let ce,U;try{if(n.shapeFlag&4){const K=r||o,ye=K;ce=Ba(h.call(ye,K,v,y,P,_,j)),U=l}else{const K=t;ce=Ba(K.length>1?K(y,{attrs:l,slots:a,emit:d}):K(y,null)),U=t.props?l:$k(l)}}catch(K){hs.length=0,Pc(K,e,1),ce=Ie(_o)}let V=ce;if(U&&B!==!1){const K=Object.keys(U),{shapeFlag:ye}=V;K.length&&ye&7&&(s&&K.some(Qu)&&(U=jk(U,s)),V=ei(V,U,!1,!0))}return n.dirs&&(V=ei(V,null,!1,!0),V.dirs=V.dirs?V.dirs.concat(n.dirs):n.dirs),n.transition&&bc(V,n.transition),ce=V,Ou(J),ce}const $k=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ju(n))&&((t||(t={}))[n]=e[n]);return t},jk=(e,t)=>{const n={};for(const o in e)(!Qu(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function Lk(e,t,n){const{props:o,children:r,component:s}=e,{props:a,children:l,patchFlag:d}=t,h=s.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&d>=0){if(d&1024)return!0;if(d&16)return o?_h(o,a,h):!!a;if(d&8){const v=t.dynamicProps;for(let y=0;y<v.length;y++){const _=v[y];if(xg(a,o,_)&&!ad(h,_))return!0}}}else return(r||l)&&(!l||!l.$stable)?!0:o===a?!1:o?a?_h(o,a,h):!0:!!a;return!1}function _h(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 s=o[r];if(xg(t,e,s)&&!ad(n,s))return!0}return!1}function xg(e,t,n){const o=e[n],r=t[n];return n==="style"&&Vt(o)&&Vt(r)?!xc(o,r):o!==r}function Nk({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 Ag={},Pg=()=>Object.create(Ag),Ig=e=>Object.getPrototypeOf(e)===Ag;function Ok(e,t,n,o=!1){const r={},s=Pg();e.propsDefaults=Object.create(null),Eg(e,t,r,s);for(const a in e.propsOptions[0])a in r||(r[a]=void 0);n?e.props=o?r:ng(r):e.type.props?e.props=r:e.props=s,e.attrs=s}function Dk(e,t,n,o){const{props:r,attrs:s,vnode:{patchFlag:a}}=e,l=Dt(r),[d]=e.propsOptions;let h=!1;if((o||a>0)&&!(a&16)){if(a&8){const v=e.vnode.dynamicProps;for(let y=0;y<v.length;y++){let _=v[y];if(ad(e.emitsOptions,_))continue;const P=t[_];if(d)if(Ht(s,_))P!==s[_]&&(s[_]=P,h=!0);else{const j=qo(_);r[j]=Pf(d,l,j,P,e,!1)}else P!==s[_]&&(s[_]=P,h=!0)}}}else{Eg(e,t,r,s)&&(h=!0);let v;for(const y in l)(!t||!Ht(t,y)&&((v=ti(y))===y||!Ht(t,v)))&&(d?n&&(n[y]!==void 0||n[v]!==void 0)&&(r[y]=Pf(d,l,y,void 0,e,!0)):delete r[y]);if(s!==l)for(const y in s)(!t||!Ht(t,y))&&(delete s[y],h=!0)}h&&ds(e.attrs,"set","")}function Eg(e,t,n,o){const[r,s]=e.propsOptions;let a=!1,l;if(t)for(let d in t){if(cc(d))continue;const h=t[d];let v;r&&Ht(r,v=qo(d))?!s||!s.includes(v)?n[v]=h:(l||(l={}))[v]=h:ad(e.emitsOptions,d)||(!(d in o)||h!==o[d])&&(o[d]=h,a=!0)}if(s){const d=Dt(n),h=l||en;for(let v=0;v<s.length;v++){const y=s[v];n[y]=Pf(r,d,y,h[y],e,!Ht(h,y))}}return a}function Pf(e,t,n,o,r,s){const a=e[n];if(a!=null){const l=Ht(a,"default");if(l&&o===void 0){const d=a.default;if(a.type!==Function&&!a.skipFactory&&wt(d)){const{propsDefaults:h}=r;if(n in h)o=h[n];else{const v=Rc(r);o=h[n]=d.call(null,t),v()}}else o=d;r.ce&&r.ce._setProp(n,o)}a[0]&&(s&&!l?o=!1:a[1]&&(o===""||o===ti(n))&&(o=!0))}return o}const Fk=new WeakMap;function Rg(e,t,n=!1){const o=n?Fk:t.propsCache,r=o.get(e);if(r)return r;const s=e.props,a={},l=[];let d=!1;if(!wt(e)){const v=y=>{d=!0;const[_,P]=Rg(y,t,!0);On(a,_),P&&l.push(...P)};!n&&t.mixins.length&&t.mixins.forEach(v),e.extends&&v(e.extends),e.mixins&&e.mixins.forEach(v)}if(!s&&!d)return Vt(e)&&o.set(e,vl),vl;if(dt(s))for(let v=0;v<s.length;v++){const y=qo(s[v]);xh(y)&&(a[y]=en)}else if(s)for(const v in s){const y=qo(v);if(xh(y)){const _=s[v],P=a[y]=dt(_)||wt(_)?{type:_}:On({},_),j=P.type;let B=!1,J=!0;if(dt(j))for(let ce=0;ce<j.length;++ce){const U=j[ce],V=wt(U)&&U.name;if(V==="Boolean"){B=!0;break}else V==="String"&&(J=!1)}else B=wt(j)&&j.name==="Boolean";P[0]=B,P[1]=J,(B||Ht(P,"default"))&&l.push(y)}}const h=[a,l];return Vt(e)&&o.set(e,h),h}function xh(e){return e[0]!=="$"&&!cc(e)}const up=e=>e==="_"||e==="_ctx"||e==="$stable",dp=e=>dt(e)?e.map(Ba):[Ba(e)],Uk=(e,t,n)=>{if(t._n)return t;const o=yt((...r)=>dp(t(...r)),n);return o._c=!1,o},Mg=(e,t,n)=>{const o=e._ctx;for(const r in e){if(up(r))continue;const s=e[r];if(wt(s))t[r]=Uk(r,s,o);else if(s!=null){const a=dp(s);t[r]=()=>a}}},$g=(e,t)=>{const n=dp(t);e.slots.default=()=>n},jg=(e,t,n)=>{for(const o in t)(n||!up(o))&&(e[o]=t[o])},Bk=(e,t,n)=>{const o=e.slots=Pg();if(e.vnode.shapeFlag&32){const r=t._;r?(jg(o,t,n),n&&Ov(o,"_",r,!0)):Mg(t,o)}else t&&$g(e,t)},qk=(e,t,n)=>{const{vnode:o,slots:r}=e;let s=!0,a=en;if(o.shapeFlag&32){const l=t._;l?n&&l===1?s=!1:jg(r,t,n):(s=!t.$stable,Mg(t,r)),a=t}else t&&($g(e,t),a={default:1});if(s)for(const l in r)!up(l)&&a[l]==null&&delete r[l]},Do=Gk;function zk(e){return Hk(e)}function Hk(e,t){const n=td();n.__VUE__=!0;const{insert:o,remove:r,patchProp:s,createElement:a,createText:l,createComment:d,setText:h,setElementText:v,parentNode:y,nextSibling:_,setScopeId:P=qa,insertStaticContent:j}=e,B=($,O,G,ue=null,ie=null,re=null,Se=void 0,be=null,pe=!!O.dynamicChildren)=>{if($===O)return;$&&!ji($,O)&&(ue=ae($),et($,ie,re,!0),$=null),O.patchFlag===-2&&(pe=!1,O.dynamicChildren=null);const{type:se,ref:Ee,shapeFlag:ge}=O;switch(se){case sd:J($,O,G,ue);break;case _o:ce($,O,G,ue);break;case Iu:$==null&&U(O,G,ue,Se);break;case ze:fe($,O,G,ue,ie,re,Se,be,pe);break;default:ge&1?ye($,O,G,ue,ie,re,Se,be,pe):ge&6?Te($,O,G,ue,ie,re,Se,be,pe):(ge&64||ge&128)&&se.process($,O,G,ue,ie,re,Se,be,pe,z)}Ee!=null&&ie?fc(Ee,$&&$.ref,re,O||$,!O):Ee==null&&$&&$.ref!=null&&fc($.ref,null,re,$,!0)},J=($,O,G,ue)=>{if($==null)o(O.el=l(O.children),G,ue);else{const ie=O.el=$.el;O.children!==$.children&&h(ie,O.children)}},ce=($,O,G,ue)=>{$==null?o(O.el=d(O.children||""),G,ue):O.el=$.el},U=($,O,G,ue)=>{[$.el,$.anchor]=j($.children,O,G,ue,$.el,$.anchor)},V=({el:$,anchor:O},G,ue)=>{let ie;for(;$&&$!==O;)ie=_($),o($,G,ue),$=ie;o(O,G,ue)},K=({el:$,anchor:O})=>{let G;for(;$&&$!==O;)G=_($),r($),$=G;r(O)},ye=($,O,G,ue,ie,re,Se,be,pe)=>{if(O.type==="svg"?Se="svg":O.type==="math"&&(Se="mathml"),$==null)_e(O,G,ue,ie,re,Se,be,pe);else{const se=$.el&&$.el._isVueCE?$.el:null;try{se&&se._beginPatch(),de($,O,ie,re,Se,be,pe)}finally{se&&se._endPatch()}}},_e=($,O,G,ue,ie,re,Se,be)=>{let pe,se;const{props:Ee,shapeFlag:ge,transition:Fe,dirs:Me}=$;if(pe=$.el=a($.type,re,Ee&&Ee.is,Ee),ge&8?v(pe,$.children):ge&16&&$e($.children,pe,null,ue,ie,Wd($,re),Se,be),Me&&Ai($,null,ue,"created"),we(pe,$,$.scopeId,Se,ue),Ee){for(const rt in Ee)rt!=="value"&&!cc(rt)&&s(pe,rt,null,Ee[rt],re,ue);"value"in Ee&&s(pe,"value",null,Ee.value,re),(se=Ee.onVnodeBeforeMount)&&Da(se,ue,$)}Me&&Ai($,null,ue,"beforeMount");const Ve=Wk(ie,Fe);Ve&&Fe.beforeEnter(pe),o(pe,O,G),((se=Ee&&Ee.onVnodeMounted)||Ve||Me)&&Do(()=>{try{se&&Da(se,ue,$),Ve&&Fe.enter(pe),Me&&Ai($,null,ue,"mounted")}finally{}},ie)},we=($,O,G,ue,ie)=>{if(G&&P($,G),ue)for(let re=0;re<ue.length;re++)P($,ue[re]);if(ie){let re=ie.subTree;if(O===re||Og(re.type)&&(re.ssContent===O||re.ssFallback===O)){const Se=ie.vnode;we($,Se,Se.scopeId,Se.slotScopeIds,ie.parent)}}},$e=($,O,G,ue,ie,re,Se,be,pe=0)=>{for(let se=pe;se<$.length;se++){const Ee=$[se]=be?cs($[se]):Ba($[se]);B(null,Ee,O,G,ue,ie,re,Se,be)}},de=($,O,G,ue,ie,re,Se)=>{const be=O.el=$.el;let{patchFlag:pe,dynamicChildren:se,dirs:Ee}=O;pe|=$.patchFlag&16;const ge=$.props||en,Fe=O.props||en;let Me;if(G&&Pi(G,!1),(Me=Fe.onVnodeBeforeUpdate)&&Da(Me,G,O,$),Ee&&Ai(O,$,G,"beforeUpdate"),G&&Pi(G,!0),se&&(!$.dynamicChildren||$.dynamicChildren.length!==se.length)&&(pe=0,Se=!1,se=null),(ge.innerHTML&&Fe.innerHTML==null||ge.textContent&&Fe.textContent==null)&&v(be,""),se?Le($.dynamicChildren,se,be,G,ue,Wd(O,ie),re):Se||He($,O,be,null,G,ue,Wd(O,ie),re,!1),pe>0){if(pe&16)je(be,ge,Fe,G,ie);else if(pe&2&&ge.class!==Fe.class&&s(be,"class",null,Fe.class,ie),pe&4&&s(be,"style",ge.style,Fe.style,ie),pe&8){const Ve=O.dynamicProps;for(let rt=0;rt<Ve.length;rt++){const gt=Ve[rt],It=ge[gt],Tt=Fe[gt];(Tt!==It||gt==="value")&&s(be,gt,It,Tt,ie,G)}}pe&1&&$.children!==O.children&&v(be,O.children)}else!Se&&se==null&&je(be,ge,Fe,G,ie);((Me=Fe.onVnodeUpdated)||Ee)&&Do(()=>{Me&&Da(Me,G,O,$),Ee&&Ai(O,$,G,"updated")},ue)},Le=($,O,G,ue,ie,re,Se)=>{for(let be=0;be<O.length;be++){const pe=$[be],se=O[be],Ee=pe.el&&(pe.type===ze||!ji(pe,se)||pe.shapeFlag&198)?y(pe.el):G;B(pe,se,Ee,null,ue,ie,re,Se,!0)}},je=($,O,G,ue,ie)=>{if(O!==G){if(O!==en)for(const re in O)!cc(re)&&!(re in G)&&s($,re,O[re],null,ie,ue);for(const re in G){if(cc(re))continue;const Se=G[re],be=O[re];Se!==be&&re!=="value"&&s($,re,be,Se,ie,ue)}"value"in G&&s($,"value",O.value,G.value,ie)}},fe=($,O,G,ue,ie,re,Se,be,pe)=>{const se=O.el=$?$.el:l(""),Ee=O.anchor=$?$.anchor:l("");let{patchFlag:ge,dynamicChildren:Fe,slotScopeIds:Me}=O;Me&&(be=be?be.concat(Me):Me),$==null?(o(se,G,ue),o(Ee,G,ue),$e(O.children||[],G,Ee,ie,re,Se,be,pe)):ge>0&&ge&64&&Fe&&$.dynamicChildren&&$.dynamicChildren.length===Fe.length?(Le($.dynamicChildren,Fe,G,ie,re,Se,be),(O.key!=null||ie&&O===ie.subTree)&&fp($,O,!0)):He($,O,G,Ee,ie,re,Se,be,pe)},Te=($,O,G,ue,ie,re,Se,be,pe)=>{O.slotScopeIds=be,$==null?O.shapeFlag&512?ie.ctx.activate(O,G,ue,Se,pe):xe(O,G,ue,ie,re,Se,pe):Ae($,O,pe)},xe=($,O,G,ue,ie,re,Se)=>{const be=$.component=Xk($,ue,ie);if(Ic($)&&(be.ctx.renderer=z),Zk(be,!1,Se),be.asyncDep){if(ie&&ie.registerDep(be,Ue,Se),!$.el){const pe=be.subTree=Ie(_o);ce(null,pe,O,G),$.placeholder=pe.el}}else Ue(be,$,O,G,ie,re,Se)},Ae=($,O,G)=>{const ue=O.component=$.component;if(Lk($,O,G))if(ue.asyncDep&&!ue.asyncResolved){Ye(ue,O,G);return}else ue.next=O,ue.update();else O.el=$.el,ue.vnode=O},Ue=($,O,G,ue,ie,re,Se)=>{const be=()=>{if($.isMounted){let{next:ge,bu:Fe,u:Me,parent:Ve,vnode:rt}=$;{const H=Lg($);if(H){ge&&(ge.el=rt.el,Ye($,ge,Se)),H.asyncDep.then(()=>{Do(()=>{$.isUnmounted||se()},ie)});return}}let gt=ge,It;Pi($,!1),ge?(ge.el=rt.el,Ye($,ge,Se)):ge=rt,Fe&&Au(Fe),(It=ge.props&&ge.props.onVnodeBeforeUpdate)&&Da(It,Ve,ge,rt),Pi($,!0);const Tt=Sh($),Tn=$.subTree;$.subTree=Tt,B(Tn,Tt,y(Tn.el),ae(Tn),$,ie,re),ge.el=Tt.el,gt===null&&Nk($,Tt.el),Me&&Do(Me,ie),(It=ge.props&&ge.props.onVnodeUpdated)&&Do(()=>Da(It,Ve,ge,rt),ie)}else{let ge;const{el:Fe,props:Me}=O,{bm:Ve,m:rt,parent:gt,root:It,type:Tt}=$,Tn=wl(O);Pi($,!1),Ve&&Au(Ve),!Tn&&(ge=Me&&Me.onVnodeBeforeMount)&&Da(ge,gt,O),Pi($,!0);{It.ce&&It.ce._hasShadowRoot()&&It.ce._injectChildStyle(Tt,$.parent?$.parent.type:void 0);const H=$.subTree=Sh($);B(null,H,G,ue,$,ie,re),O.el=H.el}if(rt&&Do(rt,ie),!Tn&&(ge=Me&&Me.onVnodeMounted)){const H=O;Do(()=>Da(ge,gt,H),ie)}(O.shapeFlag&256||gt&&wl(gt.vnode)&>.vnode.shapeFlag&256)&&$.a&&Do($.a,ie),$.isMounted=!0,O=G=ue=null}};$.scope.on();const pe=$.effect=new qv(be);$.scope.off();const se=$.update=pe.run.bind(pe),Ee=$.job=pe.runIfDirty.bind(pe);Ee.i=$,Ee.id=$.uid,pe.scheduler=()=>ip(Ee),Pi($,!0),se()},Ye=($,O,G)=>{O.component=$;const ue=$.vnode.props;$.vnode=O,$.next=null,Dk($,O.props,ue,G),qk($,O.children,G),ms(),fh($),vs()},He=($,O,G,ue,ie,re,Se,be,pe=!1)=>{const se=$&&$.children,Ee=$?$.shapeFlag:0,ge=O.children,{patchFlag:Fe,shapeFlag:Me}=O;if(Fe>0){if(Fe&128){ct(se,ge,G,ue,ie,re,Se,be,pe);return}else if(Fe&256){At(se,ge,G,ue,ie,re,Se,be,pe);return}}Me&8?(Ee&16&&at(se,ie,re),ge!==se&&v(G,ge)):Ee&16?Me&16?ct(se,ge,G,ue,ie,re,Se,be,pe):at(se,ie,re,!0):(Ee&8&&v(G,""),Me&16&&$e(ge,G,ue,ie,re,Se,be,pe))},At=($,O,G,ue,ie,re,Se,be,pe)=>{$=$||vl,O=O||vl;const se=$.length,Ee=O.length,ge=Math.min(se,Ee);let Fe;for(Fe=0;Fe<ge;Fe++){const Me=O[Fe]=pe?cs(O[Fe]):Ba(O[Fe]);B($[Fe],Me,G,null,ie,re,Se,be,pe)}se>Ee?at($,ie,re,!0,!1,ge):$e(O,G,ue,ie,re,Se,be,pe,ge)},ct=($,O,G,ue,ie,re,Se,be,pe)=>{let se=0;const Ee=O.length;let ge=$.length-1,Fe=Ee-1;for(;se<=ge&&se<=Fe;){const Me=$[se],Ve=O[se]=pe?cs(O[se]):Ba(O[se]);if(ji(Me,Ve))B(Me,Ve,G,null,ie,re,Se,be,pe);else break;se++}for(;se<=ge&&se<=Fe;){const Me=$[ge],Ve=O[Fe]=pe?cs(O[Fe]):Ba(O[Fe]);if(ji(Me,Ve))B(Me,Ve,G,null,ie,re,Se,be,pe);else break;ge--,Fe--}if(se>ge){if(se<=Fe){const Me=Fe+1,Ve=Me<Ee?O[Me].el:ue;for(;se<=Fe;)B(null,O[se]=pe?cs(O[se]):Ba(O[se]),G,Ve,ie,re,Se,be,pe),se++}}else if(se>Fe)for(;se<=ge;)et($[se],ie,re,!0),se++;else{const Me=se,Ve=se,rt=new Map;for(se=Ve;se<=Fe;se++){const me=O[se]=pe?cs(O[se]):Ba(O[se]);me.key!=null&&rt.set(me.key,se)}let gt,It=0;const Tt=Fe-Ve+1;let Tn=!1,H=0;const W=new Array(Tt);for(se=0;se<Tt;se++)W[se]=0;for(se=Me;se<=ge;se++){const me=$[se];if(It>=Tt){et(me,ie,re,!0);continue}let Oe;if(me.key!=null)Oe=rt.get(me.key);else for(gt=Ve;gt<=Fe;gt++)if(W[gt-Ve]===0&&ji(me,O[gt])){Oe=gt;break}Oe===void 0?et(me,ie,re,!0):(W[Oe-Ve]=se+1,Oe>=H?H=Oe:Tn=!0,B(me,O[Oe],G,null,ie,re,Se,be,pe),It++)}const Y=Tn?Vk(W):vl;for(gt=Y.length-1,se=Tt-1;se>=0;se--){const me=Ve+se,Oe=O[me],We=O[me+1],Ze=me+1<Ee?We.el||Ng(We):ue;W[se]===0?B(null,Oe,G,Ze,ie,re,Se,be,pe):Tn&&(gt<0||se!==Y[gt]?Qe(Oe,G,Ze,2):gt--)}}},Qe=($,O,G,ue,ie=null)=>{const{el:re,type:Se,transition:be,children:pe,shapeFlag:se}=$;if(se&6){Qe($.component.subTree,O,G,ue);return}if(se&128){$.suspense.move(O,G,ue);return}if(se&64){Se.move($,O,G,z);return}if(Se===ze){o(re,O,G);for(let ge=0;ge<pe.length;ge++)Qe(pe[ge],O,G,ue);o($.anchor,O,G);return}if(Se===Iu){V($,O,G);return}if(ue!==2&&se&1&&be)if(ue===0)be.persisted&&!re[qr]?o(re,O,G):(be.beforeEnter(re),o(re,O,G),Do(()=>be.enter(re),ie));else{const{leave:ge,delayLeave:Fe,afterLeave:Me}=be,Ve=()=>{$.ctx.isUnmounted?r(re):o(re,O,G)},rt=()=>{const gt=re._isLeaving||!!re[qr];re._isLeaving&&re[qr](!0),be.persisted&&!gt?Ve():ge(re,()=>{Ve(),Me&&Me()})};Fe?Fe(re,Ve,rt):rt()}else o(re,O,G)},et=($,O,G,ue=!1,ie=!1)=>{const{type:re,props:Se,ref:be,children:pe,dynamicChildren:se,shapeFlag:Ee,patchFlag:ge,dirs:Fe,cacheIndex:Me,memo:Ve}=$;if(ge===-2&&(ie=!1),be!=null&&(ms(),fc(be,null,G,$,!0),vs()),Me!=null&&(O.renderCache[Me]=void 0),Ee&256){O.ctx.deactivate($);return}const rt=Ee&1&&Fe,gt=!wl($);let It;if(gt&&(It=Se&&Se.onVnodeBeforeUnmount)&&Da(It,O,$),Ee&6)kt($.component,G,ue);else{if(Ee&128){$.suspense.unmount(G,ue);return}rt&&Ai($,null,O,"beforeUnmount"),Ee&64?$.type.remove($,O,G,z,ue):se&&!se.hasOnce&&(re!==ze||ge>0&&ge&64)?at(se,O,G,!1,!0):(re===ze&&ge&384||!ie&&Ee&16)&&at(pe,O,G),ue&&ft($)}const Tt=Ve!=null&&Me==null;(gt&&(It=Se&&Se.onVnodeUnmounted)||rt||Tt)&&Do(()=>{It&&Da(It,O,$),rt&&Ai($,null,O,"unmounted"),Tt&&($.el=null)},G)},ft=$=>{const{type:O,el:G,anchor:ue,transition:ie}=$;if(O===ze){mt(G,ue);return}if(O===Iu){K($);return}const re=()=>{r(G),ie&&!ie.persisted&&ie.afterLeave&&ie.afterLeave()};if($.shapeFlag&1&&ie&&!ie.persisted){const{leave:Se,delayLeave:be}=ie,pe=()=>Se(G,re);be?be($.el,re,pe):pe()}else re()},mt=($,O)=>{let G;for(;$!==O;)G=_($),r($),$=G;r(O)},kt=($,O,G)=>{const{bum:ue,scope:ie,job:re,subTree:Se,um:be,m:pe,a:se}=$;Ah(pe),Ah(se),ue&&Au(ue),ie.stop(),re&&(re.flags|=8,et(Se,$,O,G)),be&&Do(be,O),Do(()=>{$.isUnmounted=!0},O)},at=($,O,G,ue=!1,ie=!1,re=0)=>{for(let Se=re;Se<$.length;Se++)et($[Se],O,G,ue,ie)},ae=$=>{if($.shapeFlag&6)return ae($.component.subTree);if($.shapeFlag&128)return $.suspense.next();const O=_($.anchor||$.el),G=O&&O[fg];return G?_(G):O};let te=!1;const oe=($,O,G)=>{let ue;$==null?O._vnode&&(et(O._vnode,null,null,!0),ue=O._vnode.component):B(O._vnode||null,$,O,null,null,null,G),O._vnode=$,te||(te=!0,fh(ue),ig(),te=!1)},z={p:B,um:et,m:Qe,r:ft,mt:xe,mc:$e,pc:He,pbc:Le,n:ae,o:e};return{render:oe,hydrate:void 0,createApp:Ik(oe)}}function Wd({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 Pi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Wk(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function fp(e,t,n=!1){const o=e.children,r=t.children;if(dt(o)&&dt(r))for(let s=0;s<o.length;s++){const a=o[s];let l=r[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=r[s]=cs(r[s]),l.el=a.el),!n&&l.patchFlag!==-2&&fp(a,l)),l.type===sd&&(l.patchFlag===-1&&(l=r[s]=cs(l)),l.el=a.el),l.type===_o&&!l.el&&(l.el=a.el)}}function Vk(e){const t=e.slice(),n=[0];let o,r,s,a,l;const d=e.length;for(o=0;o<d;o++){const h=e[o];if(h!==0){if(r=n[n.length-1],e[r]<h){t[o]=r,n.push(o);continue}for(s=0,a=n.length-1;s<a;)l=s+a>>1,e[n[l]]<h?s=l+1:a=l;h<e[n[s]]&&(s>0&&(t[o]=n[s-1]),n[s]=o)}}for(s=n.length,a=n[s-1];s-- >0;)n[s]=a,a=t[a];return n}function Lg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Lg(t)}function Ah(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Ng(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Ng(t.subTree):null}const Og=e=>e.__isSuspense;function Gk(e,t){t&&t.pendingBranch?dt(e)?t.effects.push(...e):t.effects.push(e):Q0(e)}const ze=Symbol.for("v-fgt"),sd=Symbol.for("v-txt"),_o=Symbol.for("v-cmt"),Iu=Symbol.for("v-stc"),hs=[];let Bo=null;function S(e=!1){hs.push(Bo=e?null:[])}function pp(){hs.pop(),Bo=hs[hs.length-1]||null}let _l=1;function Uu(e,t=!1){_l+=e,e<0&&Bo&&t&&(Bo.hasOnce=!0)}function Dg(e){return e.dynamicChildren=_l>0?Bo||vl:null,pp(),_l>0&&Bo&&Bo.push(e),e}function I(e,t,n,o,r,s){return Dg(p(e,t,n,o,r,s,!0))}function tt(e,t,n,o,r){return Dg(Ie(e,t,n,o,r,!0))}function kc(e){return e?e.__v_isVNode===!0:!1}function ji(e,t){return e.type===t.type&&e.key===t.key}const Fg=({key:e})=>e??null,Eu=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?un(e)||xo(e)||wt(e)?{i:so,r:e,k:t,f:!!n}:e:null);function p(e,t=null,n=null,o=0,r=null,s=e===ze?0:1,a=!1,l=!1){const d={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Fg(t),ref:t&&Eu(t),scopeId:cg,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:s,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:so};return l?(Bu(d,n),s&128&&e.normalize(d)):n&&(d.shapeFlag|=un(n)?8:16),_l>0&&!a&&Bo&&(d.patchFlag>0||s&6)&&d.patchFlag!==32&&Bo.push(d),d}const Ie=Kk;function Kk(e,t=null,n=null,o=0,r=null,s=!1){if((!e||e===bg)&&(e=_o),kc(e)){const l=ei(e,t,!0);return n&&Bu(l,n),_l>0&&!s&&Bo&&(l.shapeFlag&6?Bo[Bo.indexOf(e)]=l:Bo.push(l)),l.patchFlag=-2,l}if(oC(e)&&(e=e.__vccOpts),t){t=Yk(t);let{class:l,style:d}=t;l&&!un(l)&&(t.class=Ke(l)),Vt(d)&&(sp(d)&&!dt(d)&&(d=On({},d)),t.style=kr(d))}const a=un(e)?1:Og(e)?128:pg(e)?64:Vt(e)?4:wt(e)?2:0;return p(e,t,n,o,r,a,s,!0)}function Yk(e){return e?sp(e)||Ig(e)?On({},e):e:null}function ei(e,t,n=!1,o=!1){const{props:r,ref:s,patchFlag:a,children:l,transition:d}=e,h=t?Ug(r||{},t):r,v={__v_isVNode:!0,__v_skip:!0,type:e.type,props:h,key:h&&Fg(h),ref:t&&t.ref?n&&s?dt(s)?s.concat(Eu(t)):[s,Eu(t)]:Eu(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ze?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:d,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ei(e.ssContent),ssFallback:e.ssFallback&&ei(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return d&&o&&bc(v,d.clone(v)),v}function ps(e=" ",t=0){return Ie(sd,null,e,t)}function tB(e,t){const n=Ie(Iu,null,e);return n.staticCount=t,n}function ee(e="",t=!1){return t?(S(),tt(_o,null,e)):Ie(_o,null,e)}function Ba(e){return e==null||typeof e=="boolean"?Ie(_o):dt(e)?Ie(ze,null,e.slice()):kc(e)?cs(e):Ie(sd,null,String(e))}function cs(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ei(e)}function Bu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(dt(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Bu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Ig(t)?t._ctx=so:r===3&&so&&(so.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(wt(t)){if(o&65){Bu(e,{default:t});return}t={default:t,_ctx:so},n=32}else t=String(t),o&64?(n=16,t=[ps(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ug(...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=Ke([t.class,o.class]));else if(r==="style")t.style=kr([t.style,o.style]);else if(Ju(r)){const s=t[r],a=o[r];a&&s!==a&&!(dt(s)&&s.includes(a))?t[r]=s?[].concat(s,a):a:a==null&&s==null&&!Qu(r)&&(t[r]=a)}else r!==""&&(t[r]=o[r])}return t}function Da(e,t,n,o=null){Wr(e,t,7,[n,o])}const Jk=Sg();let Qk=0;function Xk(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||Jk,s={uid:Qk++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new C0(!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:Rg(o,r),emitsOptions:_g(o,r),emit:null,emitted:null,propsDefaults:en,inheritAttrs:o.inheritAttrs,ctx:en,data:en,props:en,attrs:en,slots:en,refs:en,setupState:en,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 s.ctx={_:s},s.root=t?t.root:s,s.emit=Rk.bind(null,s),e.ce&&e.ce(s),s}let ao=null;const hp=()=>ao||so;let qu,If;{const e=td(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),s=>{r.length>1?r.forEach(a=>a(s)):r[0](s)}};qu=t("__VUE_INSTANCE_SETTERS__",n=>ao=n),If=t("__VUE_SSR_SETTERS__",n=>xl=n)}const Rc=e=>{const t=ao;return qu(e),e.scope.on(),()=>{e.scope.off(),qu(t)}},Ph=()=>{ao&&ao.scope.off(),qu(null)};function Bg(e){return e.vnode.shapeFlag&4}let xl=!1;function Zk(e,t=!1,n=!1){t&&If(t);const{props:o,children:r}=e.vnode,s=Bg(e);Ok(e,o,s,t),Bk(e,r,n||t);const a=s?eC(e,t):void 0;return t&&If(!1),a}function eC(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,bk);const{setup:o}=n;if(o){ms();const r=e.setupContext=o.length>1?zg(e):null,s=Rc(e),a=Ac(o,e,0,[e.props,r]),l=jv(a);if(vs(),s(),(l||e.sp)&&!wl(e)&&lp(e),l){if(a.then(Ph,Ph),t)return a.then(d=>{Ih(e,d)}).catch(d=>{Pc(d,e,0)});e.asyncDep=a}else Ih(e,a)}else qg(e)}function Ih(e,t,n){wt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Vt(t)&&(e.setupState=rg(t)),qg(e)}function qg(e,t,n){const o=e.type;e.render||(e.render=o.render||qa);{const r=Rc(e);ms();try{Tk(e)}finally{vs(),r()}}}const tC={get(e,t){return So(e,"get",""),e[t]}};function zg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,tC),slots:e.slots,emit:e.emit,expose:t}}function id(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(rg(B0(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in pc)return pc[n](e)},has(t,n){return n in t||n in pc}})):e.proxy}function nC(e,t=!0){return wt(e)?e.displayName||e.name:e.name||t&&e.__name}function oC(e){return wt(e)&&"__vccOpts"in e}const X=(e,t)=>V0(e,t,xl);function mp(e,t,n){try{Uu(-1);const o=arguments.length;return o===2?Vt(t)&&!dt(t)?kc(t)?Ie(e,null,[t]):Ie(e,t):Ie(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&kc(n)&&(n=[n]),Ie(e,t,n))}finally{Uu(1)}}function nB(e,t,n,o){const r=n[o];if(r&&rC(r,e))return r;const s=t();return s.memo=e.slice(),s.cacheIndex=o,n[o]=s}function rC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(ua(n[o],t[o]))return!1;return _l>0&&Bo&&Bo.push(e),!0}const aC="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 Ef;const Eh=typeof window<"u"&&window.trustedTypes;if(Eh)try{Ef=Eh.createPolicy("vue",{createHTML:e=>e})}catch{}const Hg=Ef?e=>Ef.createHTML(e):e=>e,sC="http://www.w3.org/2000/svg",iC="http://www.w3.org/1998/Math/MathML",ls=typeof document<"u"?document:null,Rh=ls&&ls.createElement("template"),lC={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"?ls.createElementNS(sC,e):t==="mathml"?ls.createElementNS(iC,e):n?ls.createElement(e,{is:n}):ls.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>ls.createTextNode(e),createComment:e=>ls.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ls.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,s){const a=n?n.previousSibling:t.lastChild;if(r&&(r===s||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===s||!(r=r.nextSibling)););else{Rh.innerHTML=Hg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const l=Rh.content;if(o==="svg"||o==="mathml"){const d=l.firstChild;for(;d.firstChild;)l.appendChild(d.firstChild);l.removeChild(d)}t.insertBefore(l,n)}return[a?a.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Us="transition",ec="animation",Cc=Symbol("_vtc"),Wg={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},cC=On({},hg,Wg),uC=e=>(e.displayName="Transition",e.props=cC,e),Mc=uC((e,{slots:t})=>mp(sk,dC(e),t)),Ii=(e,t=[])=>{dt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Mh=e=>e?dt(e)?e.some(t=>t.length>1):e.length>1:!1;function dC(e){const t={};for(const fe in e)fe in Wg||(t[fe]=e[fe]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:s=`${n}-enter-from`,enterActiveClass:a=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:d=s,appearActiveClass:h=a,appearToClass:v=l,leaveFromClass:y=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:P=`${n}-leave-to`}=e,j=fC(r),B=j&&j[0],J=j&&j[1],{onBeforeEnter:ce,onEnter:U,onEnterCancelled:V,onLeave:K,onLeaveCancelled:ye,onBeforeAppear:_e=ce,onAppear:we=U,onAppearCancelled:$e=V}=t,de=(fe,Te,xe,Ae)=>{fe._enterCancelled=Ae,Ei(fe,Te?v:l),Ei(fe,Te?h:a),xe&&xe()},Le=(fe,Te)=>{fe._isLeaving=!1,Ei(fe,y),Ei(fe,P),Ei(fe,_),Te&&Te()},je=fe=>(Te,xe)=>{const Ae=fe?we:U,Ue=()=>de(Te,fe,xe);Ii(Ae,[Te,Ue]),$h(()=>{Ei(Te,fe?d:s),as(Te,fe?v:l),Mh(Ae)||jh(Te,o,B,Ue)})};return On(t,{onBeforeEnter(fe){Ii(ce,[fe]),as(fe,s),as(fe,a)},onBeforeAppear(fe){Ii(_e,[fe]),as(fe,d),as(fe,h)},onEnter:je(!1),onAppear:je(!0),onLeave(fe,Te){fe._isLeaving=!0;const xe=()=>Le(fe,Te);as(fe,y),fe._enterCancelled?(as(fe,_),Oh(fe)):(Oh(fe),as(fe,_)),$h(()=>{fe._isLeaving&&(Ei(fe,y),as(fe,P),Mh(K)||jh(fe,o,J,xe))}),Ii(K,[fe,xe])},onEnterCancelled(fe){de(fe,!1,void 0,!0),Ii(V,[fe])},onAppearCancelled(fe){de(fe,!0,void 0,!0),Ii($e,[fe])},onLeaveCancelled(fe){Le(fe),Ii(ye,[fe])}})}function fC(e){if(e==null)return null;if(Vt(e))return[Vd(e.enter),Vd(e.leave)];{const t=Vd(e);return[t,t]}}function Vd(e){return h0(e)}function as(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Cc]||(e[Cc]=new Set)).add(t)}function Ei(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[Cc];n&&(n.delete(t),n.size||(e[Cc]=void 0))}function $h(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let pC=0;function jh(e,t,n,o){const r=e._endId=++pC,s=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(s,n);const{type:a,timeout:l,propCount:d}=hC(e,t);if(!a)return o();const h=a+"end";let v=0;const y=()=>{e.removeEventListener(h,_),s()},_=P=>{P.target===e&&++v>=d&&y()};setTimeout(()=>{v<d&&y()},l+1),e.addEventListener(h,_)}function hC(e,t){const n=window.getComputedStyle(e),o=j=>(n[j]||"").split(", "),r=o(`${Us}Delay`),s=o(`${Us}Duration`),a=Lh(r,s),l=o(`${ec}Delay`),d=o(`${ec}Duration`),h=Lh(l,d);let v=null,y=0,_=0;t===Us?a>0&&(v=Us,y=a,_=s.length):t===ec?h>0&&(v=ec,y=h,_=d.length):(y=Math.max(a,h),v=y>0?a>h?Us:ec:null,_=v?v===Us?s.length:d.length:0);const P=v===Us&&/\b(?:transform|all)(?:,|$)/.test(o(`${Us}Property`).toString());return{type:v,timeout:y,propCount:_,hasTransform:P}}function Lh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>Nh(n)+Nh(e[o])))}function Nh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Oh(e){return(e?e.ownerDocument:document).body.offsetHeight}function mC(e,t,n){const o=e[Cc];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const zu=Symbol("_vod"),Vg=Symbol("_vsh"),uu={name:"show",beforeMount(e,{value:t},{transition:n}){e[zu]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):tc(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),tc(e,!0),o.enter(e)):o.leave(e,()=>{tc(e,!1)}):tc(e,t))},beforeUnmount(e,{value:t}){tc(e,t)}};function tc(e,t){e.style.display=t?e[zu]:"none",e[Vg]=!t}const vC=Symbol(""),gC=/(?:^|;)\s*display\s*:/;function yC(e,t,n){const o=e.style,r=un(n);let s=!1;if(n&&!r){if(t)if(un(t))for(const a of t.split(";")){const l=a.slice(0,a.indexOf(":")).trim();n[l]==null&&ic(o,l,"")}else for(const a in t)n[a]==null&&ic(o,a,"");for(const a in n){a==="display"&&(s=!0);const l=n[a];l!=null?bC(e,a,!un(t)&&t?t[a]:void 0,l)||ic(o,a,l):ic(o,a,"")}}else if(r){if(t!==n){const a=o[vC];a&&(n+=";"+a),o.cssText=n,s=gC.test(n)}}else t&&e.removeAttribute("style");zu in e&&(e[zu]=s?o.display:"",e[Vg]&&(o.display="none"))}const Dh=/\s*!important$/;function ic(e,t,n){if(dt(n))n.forEach(o=>ic(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=wC(e,t);Dh.test(n)?e.setProperty(ti(o),n.replace(Dh,""),"important"):e[o]=n}}const Fh=["Webkit","Moz","ms"],Gd={};function wC(e,t){const n=Gd[t];if(n)return n;let o=qo(t);if(o!=="filter"&&o in e)return Gd[t]=o;o=ed(o);for(let r=0;r<Fh.length;r++){const s=Fh[r]+o;if(s in e)return Gd[t]=s}return t}function bC(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&un(o)&&n===o}const Uh="http://www.w3.org/1999/xlink";function Bh(e,t,n,o,r,s=b0(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Uh,t.slice(6,t.length)):e.setAttributeNS(Uh,t,n):n==null||s&&!Dv(n)?e.removeAttribute(t):e.setAttribute(t,s?"":va(n)?String(n):n)}function qh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Hg(n):n);return}const s=e.tagName;if(t==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?e.getAttribute("value")||"":e.value,d=n==null?e.type==="checkbox"?"on":"":String(n);(l!==d||!("_value"in e))&&(e.value=d),n==null&&e.removeAttribute(t),e._value=n;return}let a=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=Dv(n):n==null&&l==="string"?(n="",a=!0):l==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(r||t)}function Li(e,t,n,o){e.addEventListener(t,n,o)}function kC(e,t,n,o){e.removeEventListener(t,n,o)}const zh=Symbol("_vei");function CC(e,t,n,o,r=null){const s=e[zh]||(e[zh]={}),a=s[t];if(o&&a)a.value=o;else{const[l,d]=_C(t);if(o){const h=s[t]=PC(o,r);Li(e,l,h,d)}else a&&(kC(e,l,a,d),s[t]=void 0)}}const TC=/(Once|Passive|Capture)$/,SC=/^on:?(?:Once|Passive|Capture)$/;function _C(e){let t,n;for(;(n=e.match(TC))&&!SC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):ti(e.slice(2)),t]}let Kd=0;const xC=Promise.resolve(),AC=()=>Kd||(xC.then(()=>Kd=0),Kd=Date.now());function PC(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(dt(r)){const s=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{s.call(o),o._stopped=!0};const a=r.slice(),l=[o];for(let d=0;d<a.length&&!o._stopped;d++){const h=a[d];h&&Wr(h,t,5,l)}}else Wr(r,t,5,[o])};return n.value=e,n.attached=AC(),n}const Hh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,IC=(e,t,n,o,r,s)=>{const a=r==="svg";t==="class"?mC(e,o,a):t==="style"?yC(e,n,o):Ju(t)?Qu(t)||CC(e,t,n,o,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):EC(e,t,o,a))?(qh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Bh(e,t,o,a,s,t!=="value")):e._isVueCE&&(RC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!un(o)))?qh(e,qo(t),o,s,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),Bh(e,t,o,a))};function EC(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Hh(t)&&wt(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 Hh(t)&&un(n)?!1:t in e}function RC(e,t){const n=e._def.props;if(!n)return!1;const o=qo(t);return Array.isArray(n)?n.some(r=>qo(r)===o):Object.keys(n).some(r=>qo(r)===o)}const Hu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return dt(t)?n=>Au(t,n):t};function MC(e){e.target.composing=!0}function Wh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const kl=Symbol("_assign");function Vh(e,t,n){return t&&(e=e.trim()),n&&(e=Zf(e)),e}const an={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[kl]=Hu(r);const s=o||r.props&&r.props.type==="number";Li(e,t?"change":"input",a=>{a.target.composing||e[kl](Vh(e.value,n,s))}),(n||s)&&Li(e,"change",()=>{e.value=Vh(e.value,n,s)}),t||(Li(e,"compositionstart",MC),Li(e,"compositionend",Wh),Li(e,"change",Wh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:s}},a){if(e[kl]=Hu(a),e.composing)return;const l=(s||e.type==="number")&&!/^0\d/.test(e.value)?Zf(e.value):e.value,d=t??"";if(l===d)return;const h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===d)||(e.value=d)}},Gg={deep:!0,created(e,t,n){e[kl]=Hu(n),Li(e,"change",()=>{const o=e._modelValue,r=$C(e),s=e.checked,a=e[kl];if(dt(o)){const l=Fv(o,r),d=l!==-1;if(s&&!d)a(o.concat(r));else if(!s&&d){const h=[...o];h.splice(l,1),a(h)}}else if(Xu(o)){const l=new Set(o);s?l.add(r):l.delete(r),a(l)}else a(Kg(e,s))})},mounted:Gh,beforeUpdate(e,t,n){e[kl]=Hu(n),Gh(e,t,n)}};function Gh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(dt(t))r=Fv(t,o.props.value)>-1;else if(Xu(t))r=t.has(o.props.value);else{if(t===n)return;r=xc(t,Kg(e,!0))}e.checked!==r&&(e.checked=r)}function $C(e){return"_value"in e?e._value:e.value}function Kg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const jC=["ctrl","shift","alt","meta"],LC={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)=>jC.some(n=>e[`${n}Key`]&&!t.includes(n))},lt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...s)=>{for(let a=0;a<t.length;a++){const l=LC[t[a]];if(l&&l(r,t))return}return e(r,...s)})},NC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},An=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const s=ti(r.key);if(t.some(a=>a===s||NC[a]===s))return e(r)})},OC=On({patchProp:IC},lC);let Kh;function DC(){return Kh||(Kh=zk(OC))}const FC=(...e)=>{const t=DC().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=BC(o);if(!r)return;const s=t._component;!wt(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const a=n(r,!1,UC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},t};function UC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function BC(e){return un(e)?document.querySelector(e):e}const qC="modulepreload",zC=function(e){return"/"+e},Yh={},nc=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let a=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=a(n.map(h=>{if(h=zC(h),h in Yh)return;Yh[h]=!0;const v=h.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":qC,v||(_.as="script"),_.crossOrigin="",_.href=h,d&&_.setAttribute("nonce",d),document.head.appendChild(_),v)return new Promise((P,j)=>{_.addEventListener("load",P),_.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};/*!
|
|
19
|
+
* vue-router v4.6.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/const fl=typeof document<"u";function Yg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function HC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Yg(e.default)}const zt=Object.assign;function Yd(e,t){const n={};for(const o in t){const r=t[o];n[o]=ya(r)?r.map(e):e(r)}return n}const hc=()=>{},ya=Array.isArray;function Jh(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const Jg=/#/g,WC=/&/g,VC=/\//g,GC=/=/g,KC=/\?/g,Qg=/\+/g,YC=/%5B/g,JC=/%5D/g,Xg=/%5E/g,QC=/%60/g,Zg=/%7B/g,XC=/%7C/g,ey=/%7D/g,ZC=/%20/g;function vp(e){return e==null?"":encodeURI(""+e).replace(XC,"|").replace(YC,"[").replace(JC,"]")}function eT(e){return vp(e).replace(Zg,"{").replace(ey,"}").replace(Xg,"^")}function Rf(e){return vp(e).replace(Qg,"%2B").replace(ZC,"+").replace(Jg,"%23").replace(WC,"%26").replace(QC,"`").replace(Zg,"{").replace(ey,"}").replace(Xg,"^")}function tT(e){return Rf(e).replace(GC,"%3D")}function nT(e){return vp(e).replace(Jg,"%23").replace(KC,"%3F")}function oT(e){return nT(e).replace(VC,"%2F")}function Tc(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const rT=/\/$/,aT=e=>e.replace(rT,"");function Jd(e,t,n="/"){let o,r={},s="",a="";const l=t.indexOf("#");let d=t.indexOf("?");return d=l>=0&&d>l?-1:d,d>=0&&(o=t.slice(0,d),s=t.slice(d,l>0?l:t.length),r=e(s.slice(1))),l>=0&&(o=o||t.slice(0,l),a=t.slice(l,t.length)),o=cT(o??t,n),{fullPath:o+s+a,path:o,query:r,hash:Tc(a)}}function sT(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Qh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function iT(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&Al(t.matched[o],n.matched[r])&&ty(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Al(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function ty(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!lT(e[n],t[n]))return!1;return!0}function lT(e,t){return ya(e)?Xh(e,t):ya(t)?Xh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Xh(e,t){return ya(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function cT(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 s=n.length-1,a,l;for(a=0;a<o.length;a++)if(l=o[a],l!==".")if(l==="..")s>1&&s--;else break;return n.slice(0,s).join("/")+"/"+o.slice(a).join("/")}const Bs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Mf=function(e){return e.pop="pop",e.push="push",e}({}),Qd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function uT(e){if(!e)if(fl){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),aT(e)}const dT=/^[^#]+#/;function fT(e,t){return e.replace(dT,"#")+t}function pT(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 ld=()=>({left:window.scrollX,top:window.scrollY});function hT(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=pT(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 Zh(e,t){return(history.state?history.state.position-t:-1)+e}const $f=new Map;function mT(e,t){$f.set(e,t)}function vT(e){const t=$f.get(e);return $f.delete(e),t}function gT(e){return typeof e=="string"||e&&typeof e=="object"}function ny(e){return typeof e=="string"||typeof e=="symbol"}let Pn=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 oy=Symbol("");Pn.MATCHER_NOT_FOUND+"",Pn.NAVIGATION_GUARD_REDIRECT+"",Pn.NAVIGATION_ABORTED+"",Pn.NAVIGATION_CANCELLED+"",Pn.NAVIGATION_DUPLICATED+"";function Pl(e,t){return zt(new Error,{type:e,[oy]:!0},t)}function ss(e,t){return e instanceof Error&&oy in e&&(t==null||!!(e.type&t))}const yT=["params","query","hash"];function wT(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of yT)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function bT(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(Qg," "),s=r.indexOf("="),a=Tc(s<0?r:r.slice(0,s)),l=s<0?null:Tc(r.slice(s+1));if(a in t){let d=t[a];ya(d)||(d=t[a]=[d]),d.push(l)}else t[a]=l}return t}function em(e){let t="";for(let n in e){const o=e[n];if(n=tT(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(ya(o)?o.map(r=>r&&Rf(r)):[o&&Rf(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function kT(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=ya(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const CT=Symbol(""),tm=Symbol(""),cd=Symbol(""),gp=Symbol(""),jf=Symbol("");function oc(){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 Ks(e,t,n,o,r,s=a=>a()){const a=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((l,d)=>{const h=_=>{_===!1?d(Pl(Pn.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?d(_):gT(_)?d(Pl(Pn.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(a&&o.enterCallbacks[r]===a&&typeof _=="function"&&a.push(_),l())},v=s(()=>e.call(o&&o.instances[r],t,n,h));let y=Promise.resolve(v);e.length<3&&(y=y.then(h)),y.catch(_=>d(_))})}function Xd(e,t,n,o,r=s=>s()){const s=[];for(const a of e)for(const l in a.components){let d=a.components[l];if(!(t!=="beforeRouteEnter"&&!a.instances[l]))if(Yg(d)){const h=(d.__vccOpts||d)[t];h&&s.push(Ks(h,n,o,a,l,r))}else{let h=d();s.push(()=>h.then(v=>{if(!v)throw new Error(`Couldn't resolve component "${l}" at "${a.path}"`);const y=HC(v)?v.default:v;a.mods[l]=v,a.components[l]=y;const _=(y.__vccOpts||y)[t];return _&&Ks(_,n,o,a,l,r)()}))}}return s}function TT(e,t){const n=[],o=[],r=[],s=Math.max(t.matched.length,e.matched.length);for(let a=0;a<s;a++){const l=t.matched[a];l&&(e.matched.find(h=>Al(h,l))?o.push(l):n.push(l));const d=e.matched[a];d&&(t.matched.find(h=>Al(h,d))||r.push(d))}return[n,o,r]}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/let ST=()=>location.protocol+"//"+location.host;function ry(e,t){const{pathname:n,search:o,hash:r}=t,s=e.indexOf("#");if(s>-1){let a=r.includes(e.slice(s))?e.slice(s).length:1,l=r.slice(a);return l[0]!=="/"&&(l="/"+l),Qh(l,"")}return Qh(n,e)+o+r}function _T(e,t,n,o){let r=[],s=[],a=null;const l=({state:_})=>{const P=ry(e,location),j=n.value,B=t.value;let J=0;if(_){if(n.value=P,t.value=_,a&&a===j){a=null;return}J=B?_.position-B.position:0}else o(P);r.forEach(ce=>{ce(n.value,j,{delta:J,type:Mf.pop,direction:J?J>0?Qd.forward:Qd.back:Qd.unknown})})};function d(){a=n.value}function h(_){r.push(_);const P=()=>{const j=r.indexOf(_);j>-1&&r.splice(j,1)};return s.push(P),P}function v(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(zt({},_.state,{scroll:ld()}),"")}}function y(){for(const _ of s)_();s=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",v),document.removeEventListener("visibilitychange",v)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",v),document.addEventListener("visibilitychange",v),{pauseListeners:d,listen:h,destroy:y}}function nm(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?ld():null}}function xT(e){const{history:t,location:n}=window,o={value:ry(e,n)},r={value:t.state};r.value||s(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function s(d,h,v){const y=e.indexOf("#"),_=y>-1?(n.host&&document.querySelector("base")?e:e.slice(y))+d:ST()+e+d;try{t[v?"replaceState":"pushState"](h,"",_),r.value=h}catch(P){console.error(P),n[v?"replace":"assign"](_)}}function a(d,h){s(d,zt({},t.state,nm(r.value.back,d,r.value.forward,!0),h,{position:r.value.position}),!0),o.value=d}function l(d,h){const v=zt({},r.value,t.state,{forward:d,scroll:ld()});s(v.current,v,!0),s(d,zt({},nm(o.value,d,null),{position:v.position+1},h),!1),o.value=d}return{location:o,state:r,push:l,replace:a}}function AT(e){e=uT(e);const t=xT(e),n=_T(e,t.state,t.location,t.replace);function o(s,a=!0){a||n.pauseListeners(),history.go(s)}const r=zt({location:"",base:e,go:o,createHref:fT.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 PT(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),AT(e)}let Ni=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var qn=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}(qn||{});const IT={type:Ni.Static,value:""},ET=/[a-zA-Z0-9_]/;function RT(e){if(!e)return[[]];if(e==="/")return[[IT]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(P){throw new Error(`ERR (${n})/"${h}": ${P}`)}let n=qn.Static,o=n;const r=[];let s;function a(){s&&r.push(s),s=[]}let l=0,d,h="",v="";function y(){h&&(n===qn.Static?s.push({type:Ni.Static,value:h}):n===qn.Param||n===qn.ParamRegExp||n===qn.ParamRegExpEnd?(s.length>1&&(d==="*"||d==="+")&&t(`A repeatable param (${h}) must be alone in its segment. eg: '/:ids+.`),s.push({type:Ni.Param,value:h,regexp:v,repeatable:d==="*"||d==="+",optional:d==="*"||d==="?"})):t("Invalid state to consume buffer"),h="")}function _(){h+=d}for(;l<e.length;){if(d=e[l++],d==="\\"&&n!==qn.ParamRegExp){o=n,n=qn.EscapeNext;continue}switch(n){case qn.Static:d==="/"?(h&&y(),a()):d===":"?(y(),n=qn.Param):_();break;case qn.EscapeNext:_(),n=o;break;case qn.Param:d==="("?n=qn.ParamRegExp:ET.test(d)?_():(y(),n=qn.Static,d!=="*"&&d!=="?"&&d!=="+"&&l--);break;case qn.ParamRegExp:d===")"?v[v.length-1]=="\\"?v=v.slice(0,-1)+d:n=qn.ParamRegExpEnd:v+=d;break;case qn.ParamRegExpEnd:y(),n=qn.Static,d!=="*"&&d!=="?"&&d!=="+"&&l--,v="";break;default:t("Unknown state");break}}return n===qn.ParamRegExp&&t(`Unfinished custom RegExp for param "${h}"`),y(),a(),r}const om="[^/]+?",MT={sensitive:!1,strict:!1,start:!0,end:!0};var Fo=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}(Fo||{});const $T=/[.+*?^${}()[\]/\\]/g;function jT(e,t){const n=zt({},MT,t),o=[];let r=n.start?"^":"";const s=[];for(const h of e){const v=h.length?[]:[Fo.Root];n.strict&&!h.length&&(r+="/");for(let y=0;y<h.length;y++){const _=h[y];let P=Fo.Segment+(n.sensitive?Fo.BonusCaseSensitive:0);if(_.type===Ni.Static)y||(r+="/"),r+=_.value.replace($T,"\\$&"),P+=Fo.Static;else if(_.type===Ni.Param){const{value:j,repeatable:B,optional:J,regexp:ce}=_;s.push({name:j,repeatable:B,optional:J});const U=ce||om;if(U!==om){P+=Fo.BonusCustomRegExp;try{`${U}`}catch(K){throw new Error(`Invalid custom RegExp for param "${j}" (${U}): `+K.message)}}let V=B?`((?:${U})(?:/(?:${U}))*)`:`(${U})`;y||(V=J&&h.length<2?`(?:/${V})`:"/"+V),J&&(V+="?"),r+=V,P+=Fo.Dynamic,J&&(P+=Fo.BonusOptional),B&&(P+=Fo.BonusRepeatable),U===".*"&&(P+=Fo.BonusWildcard)}v.push(P)}o.push(v)}if(n.strict&&n.end){const h=o.length-1;o[h][o[h].length-1]+=Fo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const a=new RegExp(r,n.sensitive?"":"i");function l(h){const v=h.match(a),y={};if(!v)return null;for(let _=1;_<v.length;_++){const P=v[_]||"",j=s[_-1];y[j.name]=P&&j.repeatable?P.split("/"):P}return y}function d(h){let v="",y=!1;for(const _ of e){(!y||!v.endsWith("/"))&&(v+="/"),y=!1;for(const P of _)if(P.type===Ni.Static)v+=P.value;else if(P.type===Ni.Param){const{value:j,repeatable:B,optional:J}=P,ce=j in h?h[j]:"";if(ya(ce)&&!B)throw new Error(`Provided param "${j}" is an array but it is not repeatable (* or + modifiers)`);const U=ya(ce)?ce.join("/"):ce;if(!U)if(J)_.length<2&&(v.endsWith("/")?v=v.slice(0,-1):y=!0);else throw new Error(`Missing required param "${j}"`);v+=U}}return v||"/"}return{re:a,score:o,keys:s,parse:l,stringify:d}}function LT(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]===Fo.Static+Fo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Fo.Static+Fo.Segment?1:-1:0}function ay(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const s=LT(o[n],r[n]);if(s)return s;n++}if(Math.abs(r.length-o.length)===1){if(rm(o))return 1;if(rm(r))return-1}return r.length-o.length}function rm(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const NT={strict:!1,end:!0,sensitive:!1};function OT(e,t,n){const o=jT(RT(e.path),n),r=zt(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function DT(e,t){const n=[],o=new Map;t=Jh(NT,t);function r(y){return o.get(y)}function s(y,_,P){const j=!P,B=sm(y);B.aliasOf=P&&P.record;const J=Jh(t,y),ce=[B];if("alias"in y){const K=typeof y.alias=="string"?[y.alias]:y.alias;for(const ye of K)ce.push(sm(zt({},B,{components:P?P.record.components:B.components,path:ye,aliasOf:P?P.record:B})))}let U,V;for(const K of ce){const{path:ye}=K;if(_&&ye[0]!=="/"){const _e=_.record.path,we=_e[_e.length-1]==="/"?"":"/";K.path=_.record.path+(ye&&we+ye)}if(U=OT(K,_,J),P?P.alias.push(U):(V=V||U,V!==U&&V.alias.push(U),j&&y.name&&!im(U)&&a(y.name)),sy(U)&&d(U),B.children){const _e=B.children;for(let we=0;we<_e.length;we++)s(_e[we],U,P&&P.children[we])}P=P||U}return V?()=>{a(V)}:hc}function a(y){if(ny(y)){const _=o.get(y);_&&(o.delete(y),n.splice(n.indexOf(_),1),_.children.forEach(a),_.alias.forEach(a))}else{const _=n.indexOf(y);_>-1&&(n.splice(_,1),y.record.name&&o.delete(y.record.name),y.children.forEach(a),y.alias.forEach(a))}}function l(){return n}function d(y){const _=BT(y,n);n.splice(_,0,y),y.record.name&&!im(y)&&o.set(y.record.name,y)}function h(y,_){let P,j={},B,J;if("name"in y&&y.name){if(P=o.get(y.name),!P)throw Pl(Pn.MATCHER_NOT_FOUND,{location:y});J=P.record.name,j=zt(am(_.params,P.keys.filter(V=>!V.optional).concat(P.parent?P.parent.keys.filter(V=>V.optional):[]).map(V=>V.name)),y.params&&am(y.params,P.keys.map(V=>V.name))),B=P.stringify(j)}else if(y.path!=null)B=y.path,P=n.find(V=>V.re.test(B)),P&&(j=P.parse(B),J=P.record.name);else{if(P=_.name?o.get(_.name):n.find(V=>V.re.test(_.path)),!P)throw Pl(Pn.MATCHER_NOT_FOUND,{location:y,currentLocation:_});J=P.record.name,j=zt({},_.params,y.params),B=P.stringify(j)}const ce=[];let U=P;for(;U;)ce.unshift(U.record),U=U.parent;return{name:J,path:B,params:j,matched:ce,meta:UT(ce)}}e.forEach(y=>s(y));function v(){n.length=0,o.clear()}return{addRoute:s,resolve:h,removeRoute:a,clearRoutes:v,getRoutes:l,getRecordMatcher:r}}function am(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function sm(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:FT(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 FT(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 im(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function UT(e){return e.reduce((t,n)=>zt(t,n.meta),{})}function BT(e,t){let n=0,o=t.length;for(;n!==o;){const s=n+o>>1;ay(e,t[s])<0?o=s:n=s+1}const r=qT(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function qT(e){let t=e;for(;t=t.parent;)if(sy(t)&&ay(e,t)===0)return t}function sy({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function lm(e){const t=ha(cd),n=ha(gp),o=X(()=>{const d=g(e.to);return t.resolve(d)}),r=X(()=>{const{matched:d}=o.value,{length:h}=d,v=d[h-1],y=n.matched;if(!v||!y.length)return-1;const _=y.findIndex(Al.bind(null,v));if(_>-1)return _;const P=cm(d[h-2]);return h>1&&cm(v)===P&&y[y.length-1].path!==P?y.findIndex(Al.bind(null,d[h-2])):_}),s=X(()=>r.value>-1&>(n.params,o.value.params)),a=X(()=>r.value>-1&&r.value===n.matched.length-1&&ty(n.params,o.value.params));function l(d={}){if(VT(d)){const h=t[g(e.replace)?"replace":"push"](g(e.to)).catch(hc);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>h),h}return Promise.resolve()}return{route:o,href:X(()=>o.value.href),isActive:s,isExactActive:a,navigate:l}}function zT(e){return e.length===1?e[0]:e}const HT=tn({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:lm,setup(e,{slots:t}){const n=od(lm(e)),{options:o}=ha(cd),r=X(()=>({[um(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[um(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const s=t.default&&zT(t.default(n));return e.custom?s:mp("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},s)}}}),WT=HT;function VT(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 GT(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(!ya(r)||r.length!==o.length||o.some((s,a)=>s.valueOf()!==r[a].valueOf()))return!1}return!0}function cm(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const um=(e,t,n)=>e??t??n,KT=tn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=ha(jf),r=X(()=>e.route||o.value),s=ha(tm,0),a=X(()=>{let h=g(s);const{matched:v}=r.value;let y;for(;(y=v[h])&&!y.components;)h++;return h}),l=X(()=>r.value.matched[a.value]);Pu(tm,X(()=>a.value+1)),Pu(CT,l),Pu(jf,r);const d=A();return nt(()=>[d.value,l.value,e.name],([h,v,y],[_,P,j])=>{v&&(v.instances[y]=h,P&&P!==v&&h&&h===_&&(v.leaveGuards.size||(v.leaveGuards=P.leaveGuards),v.updateGuards.size||(v.updateGuards=P.updateGuards))),h&&v&&(!P||!Al(v,P)||!_)&&(v.enterCallbacks[y]||[]).forEach(B=>B(h))},{flush:"post"}),()=>{const h=r.value,v=e.name,y=l.value,_=y&&y.components[v];if(!_)return dm(n.default,{Component:_,route:h});const P=y.props[v],j=P?P===!0?h.params:typeof P=="function"?P(h):P:null,J=mp(_,zt({},j,t,{onVnodeUnmounted:ce=>{ce.component.isUnmounted&&(y.instances[v]=null)},ref:d}));return dm(n.default,{Component:J,route:h})||J}}});function dm(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const YT=KT;function JT(e){const t=DT(e.routes,e),n=e.parseQuery||bT,o=e.stringifyQuery||em,r=e.history,s=oc(),a=oc(),l=oc(),d=q0(Bs);let h=Bs;fl&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const v=Yd.bind(null,ae=>""+ae),y=Yd.bind(null,oT),_=Yd.bind(null,Tc);function P(ae,te){let oe,z;return ny(ae)?(oe=t.getRecordMatcher(ae),z=te):z=ae,t.addRoute(z,oe)}function j(ae){const te=t.getRecordMatcher(ae);te&&t.removeRoute(te)}function B(){return t.getRoutes().map(ae=>ae.record)}function J(ae){return!!t.getRecordMatcher(ae)}function ce(ae,te){if(te=zt({},te||d.value),typeof ae=="string"){const G=Jd(n,ae,te.path),ue=t.resolve({path:G.path},te),ie=r.createHref(G.fullPath);return zt(G,ue,{params:_(ue.params),hash:Tc(G.hash),redirectedFrom:void 0,href:ie})}let oe;if(ae.path!=null)oe=zt({},ae,{path:Jd(n,ae.path,te.path).path});else{const G=zt({},ae.params);for(const ue in G)G[ue]==null&&delete G[ue];oe=zt({},ae,{params:y(G)}),te.params=y(te.params)}const z=t.resolve(oe,te),Be=ae.hash||"";z.params=v(_(z.params));const $=sT(o,zt({},ae,{hash:eT(Be),path:z.path})),O=r.createHref($);return zt({fullPath:$,hash:Be,query:o===em?kT(ae.query):ae.query||{}},z,{redirectedFrom:void 0,href:O})}function U(ae){return typeof ae=="string"?Jd(n,ae,d.value.path):zt({},ae)}function V(ae,te){if(h!==ae)return Pl(Pn.NAVIGATION_CANCELLED,{from:te,to:ae})}function K(ae){return we(ae)}function ye(ae){return K(zt(U(ae),{replace:!0}))}function _e(ae,te){const oe=ae.matched[ae.matched.length-1];if(oe&&oe.redirect){const{redirect:z}=oe;let Be=typeof z=="function"?z(ae,te):z;return typeof Be=="string"&&(Be=Be.includes("?")||Be.includes("#")?Be=U(Be):{path:Be},Be.params={}),zt({query:ae.query,hash:ae.hash,params:Be.path!=null?{}:ae.params},Be)}}function we(ae,te){const oe=h=ce(ae),z=d.value,Be=ae.state,$=ae.force,O=ae.replace===!0,G=_e(oe,z);if(G)return we(zt(U(G),{state:typeof G=="object"?zt({},Be,G.state):Be,force:$,replace:O}),te||oe);const ue=oe;ue.redirectedFrom=te;let ie;return!$&&iT(o,z,oe)&&(ie=Pl(Pn.NAVIGATION_DUPLICATED,{to:ue,from:z}),Qe(z,z,!0,!1)),(ie?Promise.resolve(ie):Le(ue,z)).catch(re=>ss(re)?ss(re,Pn.NAVIGATION_GUARD_REDIRECT)?re:ct(re):He(re,ue,z)).then(re=>{if(re){if(ss(re,Pn.NAVIGATION_GUARD_REDIRECT))return we(zt({replace:O},U(re.to),{state:typeof re.to=="object"?zt({},Be,re.to.state):Be,force:$}),te||ue)}else re=fe(ue,z,!0,O,Be);return je(ue,z,re),re})}function $e(ae,te){const oe=V(ae,te);return oe?Promise.reject(oe):Promise.resolve()}function de(ae){const te=mt.values().next().value;return te&&typeof te.runWithContext=="function"?te.runWithContext(ae):ae()}function Le(ae,te){let oe;const[z,Be,$]=TT(ae,te);oe=Xd(z.reverse(),"beforeRouteLeave",ae,te);for(const G of z)G.leaveGuards.forEach(ue=>{oe.push(Ks(ue,ae,te))});const O=$e.bind(null,ae,te);return oe.push(O),at(oe).then(()=>{oe=[];for(const G of s.list())oe.push(Ks(G,ae,te));return oe.push(O),at(oe)}).then(()=>{oe=Xd(Be,"beforeRouteUpdate",ae,te);for(const G of Be)G.updateGuards.forEach(ue=>{oe.push(Ks(ue,ae,te))});return oe.push(O),at(oe)}).then(()=>{oe=[];for(const G of $)if(G.beforeEnter)if(ya(G.beforeEnter))for(const ue of G.beforeEnter)oe.push(Ks(ue,ae,te));else oe.push(Ks(G.beforeEnter,ae,te));return oe.push(O),at(oe)}).then(()=>(ae.matched.forEach(G=>G.enterCallbacks={}),oe=Xd($,"beforeRouteEnter",ae,te,de),oe.push(O),at(oe))).then(()=>{oe=[];for(const G of a.list())oe.push(Ks(G,ae,te));return oe.push(O),at(oe)}).catch(G=>ss(G,Pn.NAVIGATION_CANCELLED)?G:Promise.reject(G))}function je(ae,te,oe){l.list().forEach(z=>de(()=>z(ae,te,oe)))}function fe(ae,te,oe,z,Be){const $=V(ae,te);if($)return $;const O=te===Bs,G=fl?history.state:{};oe&&(z||O?r.replace(ae.fullPath,zt({scroll:O&&G&&G.scroll},Be)):r.push(ae.fullPath,Be)),d.value=ae,Qe(ae,te,oe,O),ct()}let Te;function xe(){Te||(Te=r.listen((ae,te,oe)=>{if(!kt.listening)return;const z=ce(ae),Be=_e(z,kt.currentRoute.value);if(Be){we(zt(Be,{replace:!0,force:!0}),z).catch(hc);return}h=z;const $=d.value;fl&&mT(Zh($.fullPath,oe.delta),ld()),Le(z,$).catch(O=>ss(O,Pn.NAVIGATION_ABORTED|Pn.NAVIGATION_CANCELLED)?O:ss(O,Pn.NAVIGATION_GUARD_REDIRECT)?(we(zt(U(O.to),{force:!0}),z).then(G=>{ss(G,Pn.NAVIGATION_ABORTED|Pn.NAVIGATION_DUPLICATED)&&!oe.delta&&oe.type===Mf.pop&&r.go(-1,!1)}).catch(hc),Promise.reject()):(oe.delta&&r.go(-oe.delta,!1),He(O,z,$))).then(O=>{O=O||fe(z,$,!1),O&&(oe.delta&&!ss(O,Pn.NAVIGATION_CANCELLED)?r.go(-oe.delta,!1):oe.type===Mf.pop&&ss(O,Pn.NAVIGATION_ABORTED|Pn.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),je(z,$,O)}).catch(hc)}))}let Ae=oc(),Ue=oc(),Ye;function He(ae,te,oe){ct(ae);const z=Ue.list();return z.length?z.forEach(Be=>Be(ae,te,oe)):console.error(ae),Promise.reject(ae)}function At(){return Ye&&d.value!==Bs?Promise.resolve():new Promise((ae,te)=>{Ae.add([ae,te])})}function ct(ae){return Ye||(Ye=!ae,xe(),Ae.list().forEach(([te,oe])=>ae?oe(ae):te()),Ae.reset()),ae}function Qe(ae,te,oe,z){const{scrollBehavior:Be}=e;if(!fl||!Be)return Promise.resolve();const $=!oe&&vT(Zh(ae.fullPath,0))||(z||!oe)&&history.state&&history.state.scroll||null;return Wt().then(()=>Be(ae,te,$)).then(O=>O&&hT(O)).catch(O=>He(O,ae,te))}const et=ae=>r.go(ae);let ft;const mt=new Set,kt={currentRoute:d,listening:!0,addRoute:P,removeRoute:j,clearRoutes:t.clearRoutes,hasRoute:J,getRoutes:B,resolve:ce,options:e,push:K,replace:ye,go:et,back:()=>et(-1),forward:()=>et(1),beforeEach:s.add,beforeResolve:a.add,afterEach:l.add,onError:Ue.add,isReady:At,install(ae){ae.component("RouterLink",WT),ae.component("RouterView",YT),ae.config.globalProperties.$router=kt,Object.defineProperty(ae.config.globalProperties,"$route",{enumerable:!0,get:()=>g(d)}),fl&&!ft&&d.value===Bs&&(ft=!0,K(r.location).catch(z=>{}));const te={};for(const z in Bs)Object.defineProperty(te,z,{get:()=>d.value[z],enumerable:!0});ae.provide(cd,kt),ae.provide(gp,ng(te)),ae.provide(jf,d);const oe=ae.unmount;mt.add(ae),ae.unmount=function(){mt.delete(ae),mt.size<1&&(h=Bs,Te&&Te(),Te=null,d.value=Bs,ft=!1,Ye=!1),oe()}}};function at(ae){return ae.reduce((te,oe)=>te.then(()=>de(oe)),Promise.resolve())}return kt}function QT(){return ha(cd)}function XT(e){return ha(gp)}const fm=768;function yp(){const e=A(typeof window<"u"?window.innerWidth<fm:!1);let t=null;function n(o){e.value=o.matches}return ws(()=>{t=window.matchMedia(`(max-width: ${fm-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Ec(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const ZT={key:0,class:"desktop-sidebar"},eS={class:"desktop-main"},pm="codex-web-local.sidebar-width.v1",tS=260,nS=620,hm=320,oS=tn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=yp();function o(h){return Math.min(nS,Math.max(tS,h))}function r(){if(typeof window>"u")return hm;const h=window.localStorage.getItem(pm),v=Number(h);return Number.isFinite(v)?o(v):hm}const s=A(r()),a=X(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${s.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function l(h){typeof window>"u"||window.localStorage.setItem(pm,String(h))}function d(h){h.preventDefault();const v=h.clientX,y=s.value,_=j=>{const B=j.clientX-v;s.value=o(y+B)},P=()=>{l(s.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",P)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",P)}return(h,v)=>(S(),I("div",{class:Ke(["desktop-layout",{"is-mobile":g(n)}]),style:kr(a.value)},[g(n)?(S(),tt(Xs,{key:0,to:"body"},[Ie(Mc,{name:"drawer"},{default:yt(()=>[e.isSidebarCollapsed?ee("",!0):(S(),I("div",{key:0,class:"mobile-drawer-backdrop",onClick:v[1]||(v[1]=y=>h.$emit("close-sidebar"))},[p("aside",{class:"mobile-drawer",onClick:v[0]||(v[0]=lt(()=>{},["stop"]))},[rr(h.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ee("",!0),g(n)?ee("",!0):(S(),I(ze,{key:1},[e.isSidebarCollapsed?ee("",!0):(S(),I("aside",ZT,[rr(h.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ee("",!0):(S(),I("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:d},null,32))],64)),p("section",eS,[rr(h.$slots,"content",{},void 0)])],6))}}),bt=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},rS=bt(oS,[["__scopeId","data-v-782e512b"]]);function mm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class ma extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Vr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=mm(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=mm(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 wa(e,t,n){return e instanceof ma?e:e instanceof Error?new ma(e.message||t,{code:"unknown_error",method:n}):new ma(t,{code:"unknown_error",method:n})}function iy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function aS(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(l){throw new ma(l instanceof Error?l.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,s=null;try{s=await o.text(),r=JSON.parse(s)}catch{r=null}if(!o.ok){const l=Vr(r,"")||(s==null?void 0:s.slice(0,500))||"",d=`RPC ${e} failed with HTTP ${o.status}`;throw new ma(l?`${d}: ${l}`:d,{code:"http_error",method:e,status:o.status})}const a=r;if(!a||typeof a!="object"||!("result"in a))throw new ma(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return a.result}async function sS(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new ma(Vr(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 iS(e){const t=iy(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 vm(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function lS(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},s=(h,v)=>{if(n||o!==null)return;const y=Math.min(1e3*2**v,1e4);o=window.setTimeout(()=>{o=null,!n&&h()},y)},a=h=>{const v=iS(h);v&&e(v)},l=(h=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const v=new EventSource("/codex-api/events");let y=!1;v.onmessage=_=>{try{a(JSON.parse(_.data))}catch{}},v.addEventListener("ready",_=>{try{const P=_.data?JSON.parse(_.data):{ok:!0};vm(e,P)}catch{vm(e)}}),v.onerror=()=>{n||y||v.readyState===EventSource.CLOSED&&(y=!0,v.close(),s(()=>l(h+1),h))},t=()=>{y=!0,v.close()}},d=(h=0)=>{if(typeof WebSocket>"u"||n){l();return}t==null||t();const v=window.location.protocol==="https:"?"wss:":"ws:",y=new WebSocket(`${v}//${window.location.host}/codex-api/ws`);let _=!1,P=!1,j=window.setTimeout(()=>{_||n||P||(P=!0,y.close(),l())},2500);y.onopen=()=>{_=!0,r(),j!==null&&(window.clearTimeout(j),j=null)},y.onmessage=B=>{try{a(JSON.parse(String(B.data)))}catch{}},y.onerror=()=>{},y.onclose=()=>{if(j!==null&&(window.clearTimeout(j),j=null),!(n||P)){if(!_){l();return}s(()=>d(h+1),h)}},t=()=>{P=!0,j!==null&&(window.clearTimeout(j),j=null),y.close()}};return typeof WebSocket<"u"?d():l(),()=>{n=!0,r(),t==null||t()}}async function cS(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 ma(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 ma(Vr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function uS(){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 ma(Vr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=iy(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}const ly=["none","minimal","low","medium","high","xhigh","max","ultra"];function Lf(e){return typeof e=="string"&&ly.some(t=>t===e)}function dS(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function ot(e){return dS(e)}function cy(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function fS(e){const t=ot(e);return t.startsWith("/")||cy(t)}function pS(e){const t=ot(e).replace(/[\\/]+/gu,"/");return cy(t)?t.toLowerCase():t}function br(e){const t=ot(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function Cl(e){const t=ot(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Hr(e){return br(e)||ot(e)||"Projectless"}function Wu(e){const t=ot(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function gm(e){return new Date(e*1e3).toISOString()}function hS(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function mS(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const vS=/^##\s+(.+?):\s+(.+?)\s*$/,gS=/^#\s*files mentioned by the user\s*:?\s*$/i;function yS(e){var r,s;const t=e.split(`
|
|
27
|
+
`).findIndex(a=>gS.test(a.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
+
`).slice(t+1),o=[];for(const a of n){const l=a.trim();if(!l)continue;const d=l.match(vS);if(!d)break;const h=(r=d[1])==null?void 0:r.trim(),v=(s=d[2])==null?void 0:s.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");h&&v&&o.push({label:h,path:v})}return o}function wS(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 uy(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function bS(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 kS(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function Zd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?kS(n[1].trim()):""}function CS(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Zd(t,"current_time_iso"),o=Zd(t,"instructions");return!n||!o?null:{automationId:Zd(t,"automation_id"),currentTimeIso:n,instructions:o}}function TS(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],s=[];for(const[h,v]of t.entries()){if(v.type==="text"&&typeof v.text=="string"&&v.text.length>0&&n.push(v.text),v.type==="image"&&typeof v.url=="string"&&v.url.trim().length>0&&o.push(v.url.trim()),v.type==="localImage"&&typeof v.path=="string"&&v.path.trim().length>0&&o.push(uy(v.path.trim())),v.type==="skill"){const y=typeof v.name=="string"?v.name.trim():"",_=typeof v.path=="string"?v.path.trim():"";y&&_&&r.push({name:y,path:_})}v.type!=="text"&&v.type!=="image"&&v.type!=="localImage"&&v.type!=="skill"&&s.push({id:`${e}:user-content:${h}`,role:"user",text:"",messageType:`userContent.${v.type}`,rawPayload:hS(v),isUnhandled:!0})}const a=n.join(`
|
|
29
|
+
`),l=yS(a),d=CS(a);return{text:(d==null?void 0:d.instructions)??wS(a),images:o,skills:r,fileAttachments:l,rawBlocks:s,isAutomationRun:d!==null,automationDisplayName:(d==null?void 0:d.automationId)||null}}function SS(e){var s;const t=e.replace(/\r\n/g,`
|
|
30
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
+
`),o=[],r=[];for(const a of n){const l=a.trim();if(!l){o.length===0&&r.push("");continue}const d=l.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(d){const h=(d[1]??" ").toLowerCase(),v=(s=d[2])==null?void 0:s.trim();if(!v)continue;let y="pending";h==="x"&&(y="completed"),(h==="~"||h===">"||h==="-")&&(y="inProgress"),o.push({step:v,status:y});continue}r.push(l)}return o.length===0?null:{explanation:r.join(`
|
|
32
|
+
`).trim()||void 0,steps:o}}function ym(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 _S(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 dy(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Nf(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){const r=o,s=typeof r.path=="string"?r.path:"",a=typeof r.diff=="string"?r.diff:"",l=r.kind,d=l==null?void 0:l.type;if(!s||d!=="add"&&d!=="delete"&&d!=="update")continue;const h=d==="update"&&typeof(l==null?void 0:l.move_path)=="string"?l.move_path:null,v=d==="update"?_S(a):d==="add"?{addedLineCount:ym(a),removedLineCount:0}:{addedLineCount:0,removedLineCount:ym(a)};n.push({path:s,operation:d,movedToPath:h,diff:a,...v})}return n}function xS(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=TS(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:[uy(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?bS(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(l=>typeof l=="string"):[],o=Array.isArray(t.content)?t.content.filter(l=>typeof l=="string"):[],r=n.join(`
|
|
38
|
+
`).trim(),a=o.join(`
|
|
39
|
+
`).trim()||r;return a?[{id:e.id,role:"assistant",text:a,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 s="completed";const a=typeof r=="string"?r:r==null?void 0:r.type;(a==="inProgress"||a==="in_progress")&&(s="inProgress"),(a==="failed"||a==="error")&&(s="failed");const l=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",d=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:o,messageType:"toolCall",toolCall:{server:n,tool:o,status:s,error:l,durationMs:d}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:SS(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=AS(t.status),o=typeof t.command=="string"?t.command:"",r=typeof t.cwd=="string"?t.cwd:null,s=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",a=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:s,exitCode:a}}]}if(e.type==="fileChange"){const t=Nf(e.changes),n=dy(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 AS(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function PS(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 IS(e){const t=PS(e);return t.length>0?t:"Untitled thread"}function wp(e){return(e==null?void 0:e.status)==="inProgress"}function bp(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 ES(e){var t;return((t=bp(e))==null?void 0:t.active)===!0}function fy(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 s=n.type;if(s==="active"||s==="inProgress")return!0}const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return wp(r)||ES(e)}function py(e){const t=e,n=ot(typeof t.cwd=="string"?t.cwd:e.cwd),o=pS(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:IS(e),projectName:Hr(n),cwd:n,hasWorktree:r,createdAtIso:gm(e.createdAt),updatedAtIso:gm(e.updatedAt),preview:e.preview,unread:!1,inProgress:fy(e),externalSession:bp(e)}}function RS(e){return py(e.thread)}function MS(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,s)=>new Date(s.updatedAtIso).getTime()-new Date(r.updatedAtIso).getTime())})).sort((n,o)=>{var a,l;const r=new Date(((a=n.threads[0])==null?void 0:a.updatedAtIso)??0).getTime();return new Date(((l=o.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-r})}function $S(e){const t=e.data.map(py);return MS(t)}function $c(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o=[];for(let r=0;r<n.length;r++){const s=t+r,a=n[r],l=typeof(a==null?void 0:a.id)=="string"?a.id.trim():"",d=l.length>0?l:void 0,h=Array.isArray(a.items)?a.items:[],v=[];for(const _ of h)for(const P of xS(_))v.push({...P,turnId:d,turnIndex:s});const y=mS(a);if(a.status==="failed"&&y){const _=d??`turn-${s}`;v.push({id:`${_}-error`,role:"system",text:y,messageType:"turnError",turnId:d,turnIndex:s})}o.push(...v)}return LS(jS(o))}function jS(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 LS(e){var a,l,d;let t=-1;for(let h=0;h<e.length;h+=1)if(((a=e[h])==null?void 0:a.messageType)==="compaction.done"){t=h;break}if(t<0)return e;const n=e[t],o=n.turnIndex;let r=-1;for(let h=0;h<e.length;h+=1)if(((l=e[h])==null?void 0:l.turnIndex)===o&&((d=e[h])==null?void 0:d.role)==="user"){r=h;break}if(r<0||t<=r)return e;const s=e.filter((h,v)=>v!==t);return s.splice(r+1,0,n),s}function kp(e){if(fy(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return wp(t.at(-1))}function hy(e){return bp(e.thread)}function Cp(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(wp(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const NS=5e3;function ef(e){return e&&e.length>0?e:null}function tf(e){return e&&e.length>0?e:null}let du=null,mc=null;async function OS(e,t){await vt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function DS(e,t){await vt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function FS(e){await vt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}const US=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function my(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||US.has(n))}function BS(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 a=r.path,l=typeof a=="string"?a.trim():"";!l||my(l)||o.push({path:l})}return o}const wm=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Xe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function le(e){return typeof e=="string"&&e.length>0?e:null}function Cn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function ar(e){return typeof e=="boolean"?e:null}function da(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function qS(e){return e==="payment_required"?e:null}function zS(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function bm(e){const t=Xe(e);if(!t)return null;const n=Cn(t.usedPercent??t.used_percent);if(n===null)return null;const o=Cn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:Cn(t.resetsAt??t.resets_at)}}function HS(e){const t=Xe(e);if(!t)return null;const n=ar(t.hasCredits??t.has_credits),o=ar(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:le(t.balance)}}function Of(e){const t=Xe(e);if(!t)return null;const n=bm(t.primary),o=bm(t.secondary),r=HS(t.credits);return!n&&!o&&!r?null:{limitId:le(t.limitId??t.limit_id),limitName:le(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:le(t.planType??t.plan_type)}}function vy(e,t=null,n=null){const o=Xe(e);if(!o)return null;const r=le(o.accountId),s=le(o.storageId)??r,a=le(o.quotaStatus),l=a==="loading"||a==="ready"||a==="error"?a:"idle";return r?{accountId:r,storageId:s??r,userId:le(o.userId),authMode:le(o.authMode),email:le(o.email),planType:le(o.planType),lastRefreshedAtIso:le(o.lastRefreshedAtIso)??"",lastActivatedAtIso:le(o.lastActivatedAtIso),quotaSnapshot:Of(o.quotaSnapshot),quotaUpdatedAtIso:le(o.quotaUpdatedAtIso),quotaStatus:l,quotaError:le(o.quotaError),unavailableReason:qS(o.unavailableReason)??(zS(le(o.quotaError))?"payment_required":null),isActive:ar(o.isActive)??(s===n||r===t)}:null}function gy(e){const t=Xe(e);if(!t)return null;const n=Xe(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=Of(n==null?void 0:n.codex);return o||Of(t.rateLimits??t.rate_limits)}async function vt(e,t){try{return await aS(e,t)}catch(n){throw wa(n,`RPC ${e} failed`,e)}}function Tp(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o={};for(let r=0;r<n.length;r+=1){const s=t+r,a=n[r];typeof(a==null?void 0:a.id)!="string"||a.id.length===0||(o[a.id]=s)}return o}function ud(e){const t=Xe(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function WS(e){return Lf(e)?e:""}function VS(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const GS=50,KS=100;async function YS(e,t){const n=await vt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:$S(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function JS(e){const t=await vt("thread/read",{threadId:e,includeTurns:!1});return RS(t)}async function QS(e){const t=await vt("thread/read",{threadId:e,includeTurns:!0}),n=ud(t),o=$c(t,n);return{model:Sc(t),modelProvider:fd(t),messages:o,inProgress:kp(t),activeTurnId:Cp(t),hasMoreOlder:n>0,turnIndexByTurnId:Tp(t,n),externalSession:hy(t)}}async function XS(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 s=await r.json();if(!s.result)throw new Error("Older thread page response did not include a thread result");const a=Math.max(0,Math.floor(typeof s.startTurnIndex=="number"?s.startTurnIndex:0));return{messages:$c(s.result,a),inProgress:kp(s.result),activeTurnId:Cp(s.result),hasMoreOlder:s.hasMoreOlder===!0,startTurnIndex:a,turnIndexByTurnId:Tp(s.result,a)}}async function km(e=null,t=GS){try{return await YS(e,t)}catch(n){throw wa(n,"Failed to load thread groups","thread/list")}}function ZS(){return KS}async function e_(e){try{return await JS(e)}catch(t){throw wa(t,`Failed to load thread ${e}`,"thread/read")}}async function nf(e){try{return await QS(e)}catch(t){throw wa(t,`Failed to load thread ${e}`,"thread/read")}}async function t_(e,t,n){try{return await XS(e,t,n)}catch(o){throw wa(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}function n_(e){const t=Xe(e);if(!t)return null;const n=le(t.key),o=typeof t.text=="string"?t.text:"",r=le(t.kind);return!n||!r||r!=="meta"&&r!=="hunk"&&r!=="add"&&r!=="remove"&&r!=="context"?null:{key:n,kind:r,text:o,oldLine:Cn(t.oldLine),newLine:Cn(t.newLine)}}function o_(e){const t=Xe(e);if(!t)return null;const n=le(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:Cn(t.addedLineCount)??0,removedLineCount:Cn(t.removedLineCount)??0,oldStart:Cn(t.oldStart),oldLineCount:Cn(t.oldLineCount)??0,newStart:Cn(t.newStart),newLineCount:Cn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(s=>n_(s)).filter(s=>s!==null):[]}:null}function r_(e){const t=Xe(e);if(!t)return null;const n=le(t.id),o=le(t.path),r=le(t.absolutePath),s=le(t.operation);return!n||!o||!r||!s||s!=="add"&&s!=="delete"&&s!=="update"&&s!=="rename"?null:{id:n,path:o,absolutePath:r,previousPath:le(t.previousPath),previousAbsolutePath:le(t.previousAbsolutePath),operation:s,addedLineCount:Cn(t.addedLineCount)??0,removedLineCount:Cn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(a=>o_(a)).filter(a=>a!==null):[]}}function yy(e){const t=Xe(e),n=Xe(t==null?void 0:t.data),o=Xe(n==null?void 0:n.summary),r=le(n==null?void 0:n.scope),s=r==="baseBranch"||r==="commit"?r:"workspace",a=le(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:le(n==null?void 0:n.cwd)??"",gitRoot:le(n==null?void 0:n.gitRoot),isGitRepo:ar(n==null?void 0:n.isGitRepo)??!1,scope:s,workspaceView:a,baseBranch:le(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(l=>le(l)).filter(l=>typeof l=="string"&&l.length>0):[],commitSha:le(n==null?void 0:n.commitSha),headBranch:le(n==null?void 0:n.headBranch),mergeBaseSha:le(n==null?void 0:n.mergeBaseSha),generatedAtIso:le(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Cn(o==null?void 0:o.fileCount)??0,addedLineCount:Cn(o==null?void 0:o.addedLineCount)??0,removedLineCount:Cn(o==null?void 0:o.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(l=>r_(l)).filter(l=>l!==null):[]}}function a_(e){const t=Xe(e),n=Xe(t==null?void 0:t.data);return{fileCount:Cn(n==null?void 0:n.fileCount)??0,addedLineCount:Cn(n==null?void 0:n.addedLineCount)??0,removedLineCount:Cn(n==null?void 0:n.removedLineCount)??0}}async function s_(){return sS()}function i_(e){const t=Xe(e);if(!t)return null;const n=le(t.event??t.name??t.hookName),o=le(t.command??t.cmd);return!n||!o?null:{event:n,command:o,timeout:Cn(t.timeout??t.timeout_ms),enabled:ar(t.enabled??t.active)}}async function l_(){const e=await vt("hooks/list",{}),t=[];for(const n of e.data??[]){const o=Xe(n);o&&t.push({cwd:le(o.cwd)??"",hooks:Array.isArray(o.hooks)?o.hooks.map(i_).filter(r=>r!==null):[],warnings:da(o.warnings),errors:da(o.errors)})}return t}async function oB(e){await vt("marketplace/add",{source:e})}async function rB(e){await vt("marketplace/remove",{marketplaceName:e})}async function aB(){const e=await vt("marketplace/upgrade",{});return{selectedMarketplaces:da(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:da(e.upgradedRoots??e.upgraded_roots),errors:da(e.errors)}}function c_(e){const t=Xe(e);if(!t)return null;const n=le(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:le(t.pluginName??t.plugin_name??t.name)??n,shareUrl:le(t.shareUrl??t.share_url??t.url)??"",createdAt:le(t.createdAt??t.created_at)??""}:null}async function sB(e){const t=await vt("plugin/share/save",{pluginPath:e});return{remotePluginId:le(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:le(t.shareUrl??t.share_url??t.url)??""}}async function iB(){const e=await vt("plugin/share/list",{});return(e.data??e.shares??[]).map(c_).filter(n=>n!==null)}async function lB(e){await vt("plugin/share/delete",{remotePluginId:e})}async function cB(e){await vt("plugin/share/checkout",{remotePluginId:e})}function wy(e){const t=Xe(e);if(!t)return null;const n=le(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:le(t.deviceName??t.device_name??t.name)??"",lastSeenAt:le(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function u_(){const e=await vt("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:ar(e.enabled)??!1,clients:t.map(wy).filter(n=>n!==null)}}async function d_(){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=le((o=t.data)==null?void 0:o.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function f_(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 p_(e){await vt(e?"remoteControl/enable":"remoteControl/disable",{})}async function h_(){const e=await vt("remoteControl/pairing/start",{});return{pairingCode:le(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:le(e.expiresAt??e.expires_at)}}async function m_(){const e=await vt("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(wy).filter(n=>n!==null)}async function v_(e){await vt("remoteControl/client/revoke",{clientId:e})}function Vu(e){const t=Xe(e);if(!t)return null;const n=le(t.id),o=le(t.kind),r=le(t.name),s=le(t.prompt),a=le(t.rrule),l=le(t.status);return!n||!r||!s||!a||o!=="heartbeat"&&o!=="cron"||l!=="ACTIVE"&&l!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:s,rrule:a,status:l,targetThreadId:le(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(d=>typeof d=="string"&&d.trim().length>0):[],createdAtMs:Cn(t.createdAtMs),updatedAtMs:Cn(t.updatedAtMs),nextRunAtMs:Cn(t.nextRunAtMs)}}function by(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 g_(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Vr(t,"Failed to load thread automations"));const n=Xe((r=Xe(t))==null?void 0:r.data),o={};if(!n)return o;for(const[s,a]of Object.entries(n)){const l=by(a);l.length>0&&(o[s]=l)}return o}async function y_(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Vr(t,"Failed to load project automations"));const n=Xe((r=Xe(t))==null?void 0:r.data),o={};if(!n)return o;for(const[s,a]of Object.entries(n)){const l=by(a);l.length>0&&(o[s]=l)}return o}async function w_(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(Vr(n,"Failed to save thread automation"));const o=Vu((r=Xe(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function b_(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(Vr(n,"Failed to save project automation"));const o=Vu((r=Xe(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function Cm(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(Vr(r,"Failed to delete thread automation"))}async function Tm(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(Vr(r,"Failed to delete project automation"))}async function k_(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(Vr(o,"Failed to run thread automation"))}function C_(e){return lS(e)}function T_(e){const t=Xe(e);if(!t)return null;const n=le(t.id),o=le(t.threadId),r=le(t.cwd),s=le(t.shell);return!n||!o||!r||!s?null:{id:n,threadId:o,cwd:r,shell:s,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:ar(t.truncated)??!1}}async function Rl(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(Vr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function uB(e){var o;const t=await Rl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=T_((o=Xe(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function S_(){const e=await Rl("/codex-api/thread-terminal/status"),t=Xe(e);return{available:ar(t==null?void 0:t.available)??!1,reason:le(t==null?void 0:t.reason)||null}}async function dB(e){const t=await Rl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Xe(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const s=Xe(r),a=le(s==null?void 0:s.label),l=le(s==null?void 0:s.value),d=le(s==null?void 0:s.source);return!a||!l||d!=="package"&&d!=="script"&&d!=="make"?[]:[{label:a,value:l,source:d}]})}async function fB(e,t){await Rl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function pB(e,t,n){await Rl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function hB(e){await Rl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function __(e,t){await cS({id:e,...t})}async function Sm(){return uS()}async function x_(){try{const e=await vt("account/rateLimits/read");return gy(e)}catch(e){throw wa(e,"Failed to load account rate limits","account/rateLimits/read")}}function dd(e){const t=Xe(e),n=le(t==null?void 0:t.activeAccountId),o=le(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:le(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:le(t==null?void 0:t.importedStorageId)??void 0,accounts:r.map(s=>vy(s,n,o)).filter(s=>s!==null)}}async function A_(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to load accounts"));const n=Xe(t);return dd(n==null?void 0:n.data)}async function _m(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to refresh accounts"));const n=Xe(t);return dd(n==null?void 0:n.data)}async function P_(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to start Codex login"));const n=Xe(t),o=Xe(n==null?void 0:n.data),r=le(o==null?void 0:o.loginUrl);if(!r)throw new Error("Failed to start Codex login");return r}async function I_(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(vn(n,"Failed to complete Codex login"));const o=Xe(n);return dd(o==null?void 0:o.data)}async function E_(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(vn(n,"Failed to switch account"));const o=Xe(n),r=Xe(o==null?void 0:o.data),s=vy(r==null?void 0:r.account,le(r==null?void 0:r.activeAccountId),le(r==null?void 0:r.activeStorageId));if(!s)throw new Error("Failed to switch account");return s}async function R_(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(vn(n,"Failed to remove account"));const o=Xe(n);return dd(o==null?void 0:o.data)}const M_=3e4,il=new Map;async function of(e){const t=il.get(e);if(t)return t;const n=(async()=>{const r=await vt("thread/resume",{threadId:e}),s=ud(r),a=$c(r,s);return{model:Sc(r),modelProvider:fd(r),messages:a,inProgress:kp(r),activeTurnId:Cp(r),hasMoreOlder:s>0,turnIndexByTurnId:Tp(r,s),externalSession:hy(r)}})();il.set(e,n);const o=globalThis.setTimeout(()=>{il.get(e)===n&&il.delete(e)},M_);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{il.get(e)===n&&il.delete(e)},2e3)}).catch(()=>{}),n}async function $_(e){await vt("thread/archive",{threadId:e})}async function j_(e){await vt("thread/unarchive",{threadId:e})}async function L_(e){await vt("thread/compact/start",{threadId:e})}async function N_(e,t){await vt("thread/name/set",{threadId:e,name:t})}async function rf(e,t){const n=await vt("thread/rollback",{threadId:e,numTurns:t});return $c(n,ud(n))}async function O_(e,t,n,o,r,s,a){try{const l=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:s,filePaths:a})}),d=await l.json().catch(()=>({}));if(!l.ok){const h=typeof d.message=="string"&&d.message.trim()?d.message.trim():typeof d.error=="string"&&d.error.trim()?d.error.trim():"Server error";return{changed:0,errors:Array.isArray(d.errors)&&d.errors.length>0?d.errors:[h],message:d.message}}return{changed:d.changed??d.reverted??d.applied??0,errors:Array.isArray(d.errors)?d.errors:[],message:d.message,revertedPatchIds:Array.isArray(d.revertedPatchIds)?d.revertedPatchIds:[],appliedPatchIds:Array.isArray(d.appliedPatchIds)?d.appliedPatchIds:[]}}catch(l){return{changed:0,errors:[l instanceof Error?l.message:"Network error"]}}}async function D_(e,t,n){const o=await O_(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}function Df(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 F_(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 Sc(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function fd(e){var r,s;const t=Xe(e);if(!t)return"";const n=((r=le(t.modelProvider))==null?void 0:r.trim())??"";if(n)return n;const o=Xe(t.thread);return((s=le(o==null?void 0:o.modelProvider))==null?void 0:s.trim())??""}async function xm(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 vt("thread/start",n),r=Df(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:Sc(o),modelProvider:fd(o)}}catch(n){throw wa(n,"Failed to start a new thread","thread/start")}}async function Am(e,t,n){if(arguments.length<=1)try{const o=await vt("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=Df(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:F_(o),model:Sc(o),messages:$c(o,ud(o))}}catch(o){throw wa(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 s=await vt("thread/fork",r),a=Df(s);if(!a)throw new Error("thread/fork did not return a thread id");return{threadId:a,model:Sc(s),modelProvider:fd(s)}}catch(o){throw wa(o,`Failed to fork thread ${e}`,"thread/fork")}}function Pm(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 U_(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 B_(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function q_(e,t,n){var d;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?ef(n):tf(n)};let r=null;try{r=await Cy()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:e==="plan"?ef(n??(r==null?void 0:r.reasoningEffort)):tf(n??(r==null?void 0:r.reasoningEffort))};let a=[];try{a=await G_()}catch{a=[]}const l=((d=a.find(h=>h.trim().length>0))==null?void 0:d.trim())??"";if(l)return{model:l,reasoningEffort:e==="plan"?ef(n??(r==null?void 0:r.reasoningEffort)):tf(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 af(e,t,n=[],o,r,s,a=[],l){var d;try{const h=(o==null?void 0:o.trim())??"",v=[];for(const U of n){const V=Pm(U.trim());V&&v.push({label:B_(V),path:V,fsPath:V})}const y=[...a,...v],_=y.filter((U,V)=>y.findIndex(K=>K.fsPath===U.fsPath)===V),j=[{type:"text",text:U_(t,_)}];for(const U of n){const V=U.trim();if(!V)continue;const K=Pm(V);if(K){j.push({type:"localImage",path:K});continue}j.push({type:"image",url:V,image_url:V})}if(s)for(const U of s)j.push({type:"skill",name:U.name,path:U.path});const B=_.map(U=>({label:U.label,path:U.path,fsPath:U.fsPath})),J={threadId:e,input:j};if(B.length>0&&(J.attachments=B),h&&(J.model=h),typeof r=="string"&&r.length>0&&(J.effort=r),l){const U=await q_(l,h,r);J.collaborationMode={mode:l,settings:{model:U.model,reasoning_effort:U.reasoningEffort,developer_instructions:null}}}const ce=await vt("turn/start",J);return typeof((d=ce==null?void 0:ce.turn)==null?void 0:d.id)=="string"?ce.turn.id.trim():""}catch(h){throw wa(h,`Failed to start turn for thread ${e}`,"turn/start")}}async function z_(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 vt("turn/interrupt",{threadId:n,turnId:o})}catch(r){throw wa(r,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function H_(e){const t=e==="fast"?"fast":"standard";await vt("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 Im(){return await(await fetch("/codex-api/free-mode/status")).json()}async function Em(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function Rm(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 ll(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 W_(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(NS)});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(s=>typeof s=="string"?s.trim():"").filter((s,a,l)=>s.length>0&&l.indexOf(s)===a),exclusive:r.exclusive===!0}}catch{}return null}function V_(e){var a;const t=Xe(e);if(!t)return null;const n=((a=le(t.id??t.model))==null?void 0:a.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(l=>{const d=Xe(l),h=d?d.reasoningEffort??d.reasoning_effort??d.effort:l;return Lf(h)?[h]:[]}).filter((l,d,h)=>h.indexOf(l)===d):null,s=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:Lf(s)?s:null}}function Mm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function ky(e={}){const t=e.includeProviderModels!==!1,n=t?await W_(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(Mm);const o=await vt("model/list",{}),r=[];for(const s of o.data){const a=V_(s);!a||r.some(l=>l.id===a.id)||r.push(a)}if(!t||!n)return r;for(const s of n.ids)r.some(a=>a.id===s)||r.push(Mm(s));return r}async function G_(e={}){return(await ky(e)).map(t=>t.id)}async function Cy(){const e=await vt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=WS(e.config.model_reasoning_effort),r=VS(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function Ty(e){const t=Xe(e);if(!t)return null;const n=le(t.id),o=le(t.name);return!n||!o?null:{id:n,name:o,description:le(t.description)??"",installUrl:le(t.installUrl??t.install_url)??"",needsAuth:ar(t.needsAuth??t.needs_auth)??!1}}function K_(e){const t=Xe(e);if(!t)return null;const n=le(t.name),o=le(t.path);if(!n||!o)return null;const r=Xe(t.interface);return{name:n,path:o,description:le(t.description)??"",enabled:ar(t.enabled)??!0,displayName:le((r==null?void 0:r.displayName)??(r==null?void 0:r.display_name))??n,shortDescription:le(t.shortDescription??t.short_description)??""}}function Sy(e,t={}){const n=Xe(e);if(!n)return null;const o=le(n.id),r=le(n.name);if(!o||!r)return null;const s=Xe(n.interface),a=Xe(n.source),l=le(a==null?void 0:a.type)??"",d=le(a==null?void 0:a.path),h=le(a==null?void 0:a.url)??"",v=l==="remote"?t.name??null:null,y=t.path??(l==="local"?d:null),_=le((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??r,P=le((s==null?void 0:s.shortDescription)??(s==null?void 0:s.short_description)),j=le((s==null?void 0:s.longDescription)??(s==null?void 0:s.long_description))??"";return{id:o,name:r,displayName:_,description:P??j,longDescription:j,developerName:le((s==null?void 0:s.developerName)??(s==null?void 0:s.developer_name))??"",category:le(s==null?void 0:s.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:y,remoteMarketplaceName:v,sourceType:l,sourceUrl:h,installed:ar(n.installed)??!1,enabled:ar(n.enabled)??!0,installPolicy:le(n.installPolicy??n.install_policy)??"",authPolicy:le(n.authPolicy??n.auth_policy)??"",logoUrl:le((s==null?void 0:s.logoUrl)??(s==null?void 0:s.logo_url))??"",logoPath:le(s==null?void 0:s.logo)??"",composerIconUrl:le((s==null?void 0:s.composerIconUrl)??(s==null?void 0:s.composer_icon_url))??"",composerIconPath:le((s==null?void 0:s.composerIcon)??(s==null?void 0:s.composer_icon))??"",brandColor:le((s==null?void 0:s.brandColor)??(s==null?void 0:s.brand_color))??"",capabilities:da(s==null?void 0:s.capabilities),defaultPrompt:da((s==null?void 0:s.defaultPrompt)??(s==null?void 0:s.default_prompt)),screenshotUrls:da((s==null?void 0:s.screenshotUrls)??(s==null?void 0:s.screenshot_urls)),screenshots:da(s==null?void 0:s.screenshots),websiteUrl:le((s==null?void 0:s.websiteUrl)??(s==null?void 0:s.website_url))??"",privacyPolicyUrl:le((s==null?void 0:s.privacyPolicyUrl)??(s==null?void 0:s.privacy_policy_url))??"",termsOfServiceUrl:le((s==null?void 0:s.termsOfServiceUrl)??(s==null?void 0:s.terms_of_service_url))??""}}function Y_(e,t=0){const n=Xe(e);if(!n)return null;const o=le(n.id),r=le(n.name);if(!o||!r)return null;const s=Xe(n.branding),a=Xe(n.appMetadata??n.app_metadata);return{id:o,name:r,description:le(n.description)??le((a==null?void 0:a.seoDescription)??(a==null?void 0:a.seo_description))??"",logoUrl:le(n.logoUrl??n.logo_url)??"",logoUrlDark:le(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:le(n.distributionChannel??n.distribution_channel)??"",installUrl:le(n.installUrl??n.install_url)??"",isAccessible:ar(n.isAccessible??n.is_accessible)??!1,isEnabled:ar(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:da(n.pluginDisplayNames??n.plugin_display_names),category:le(s==null?void 0:s.category)??"",developer:le(s==null?void 0:s.developer)??le(a==null?void 0:a.developer)??"",website:le(s==null?void 0:s.website)??"",privacyPolicy:le((s==null?void 0:s.privacyPolicy)??(s==null?void 0:s.privacy_policy))??"",termsOfService:le((s==null?void 0:s.termsOfService)??(s==null?void 0:s.terms_of_service))??"",catalogRank:t}}function J_(e){const t=Xe(e);if(!t)return null;const n=le(t.name);if(!n)return null;const o=Xe(t.tools)??{},r=Object.entries(o).map(([d,h])=>{const v=Xe(h);return{name:le(v==null?void 0:v.name)??d,title:le(v==null?void 0:v.title)??"",description:le(v==null?void 0:v.description)??""}}),s=Array.isArray(t.resources)?t.resources.map(d=>{const h=Xe(d);return{name:le(h==null?void 0:h.name)??"",title:le(h==null?void 0:h.title)??"",uri:le(h==null?void 0:h.uri)??"",description:le(h==null?void 0:h.description)??""}}).filter(d=>d.name||d.uri):[],a=t.resourceTemplates??t.resource_templates,l=Array.isArray(a)?a.map(d=>{const h=Xe(d);return{name:le(h==null?void 0:h.name)??"",title:le(h==null?void 0:h.title)??"",uriTemplate:le((h==null?void 0:h.uriTemplate)??(h==null?void 0:h.uri_template))??"",description:le(h==null?void 0:h.description)??""}}).filter(d=>d.name||d.uriTemplate):[];return{name:n,authStatus:le(t.authStatus??t.auth_status)??"unsupported",tools:r,resources:s,resourceTemplates:l}}async function mB(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await vt("plugin/list",t),o=[];for(const r of n.marketplaces??[]){const s=Xe(r);if(!s)continue;const a=Xe(s.interface),l={name:le(s.name)??"",displayName:le((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??"",path:le(s.path)},d=Array.isArray(s.plugins)?s.plugins:[];for(const h of d){const v=Sy(h,l);v&&o.push(v)}}return o}async function vB(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await vt("plugin/read",t),o=Xe(n.plugin);if(!o)throw new Error("Plugin detail response is empty");const r=Sy(o.summary,{name:le(o.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:le(o.marketplacePath)??e.marketplacePath})??e;return{summary:r,description:le(o.description)??r.longDescription,apps:Array.isArray(o.apps)?o.apps.map(Ty).filter(s=>s!==null):[],skills:Array.isArray(o.skills)?o.skills.map(K_).filter(s=>s!==null):[],mcpServers:da(o.mcpServers??o.mcp_servers)}}async function gB(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await vt("plugin/install",t),o=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:le(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:o.map(Ty).filter(r=>r!==null)}}async function yB(e){await vt("plugin/uninstall",{pluginId:e})}async function wB(e,t){await vt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function bB(e){const t=[];let n=null,o=0;do{const r={limit:100};n&&(r.cursor=n),e&&(r.threadId=e);const s=await vt("app/list",r);for(const a of s.data??[]){const l=Y_(a,o);l&&t.push(l),o+=1}n=le(s.nextCursor??s.next_cursor)}while(n);return t}async function kB(e,t){await vt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function CB(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const o=await vt("mcpServerStatus/list",n);for(const r of o.data??[]){const s=J_(r);s&&e.push(s)}t=le(o.nextCursor??o.next_cursor)}while(t);return e}async function TB(){await vt("config/mcpServer/reload",{})}async function SB(e){const t=await vt("mcpServer/oauth/login",{name:e});return{authorizationUrl:le(t.authorizationUrl??t.authorization_url)??""}}async function _B(){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 xB(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(),s=await fetch(`/codex-api/composio/connectors${r?`?${r}`:""}`);if(!s.ok)throw new Error(`Failed to list Composio connectors (${s.status})`);const a=await s.json();return{data:Array.isArray(a.data)?a.data:[],nextCursor:typeof a.nextCursor=="string"&&a.nextCursor.length>0?a.nextCursor:null,total:typeof a.total=="number"&&Number.isFinite(a.total)?Math.max(0,Math.floor(a.total)):0}}async function AB(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 PB(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 IB(){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 EB(){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 Q_(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function X_(){try{const e=await vt("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:Q_(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of wm)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return wm}function Z_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=s=>{if(!Array.isArray(s))return[];const a=[];for(const l of s)typeof l=="string"&&l.length>0&&!a.includes(l)&&a.push(l);return a},o=t.labels,r={};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[s,a]of Object.entries(o)){const l=typeof s=="string"?ot(s):"";l.length>0&&typeof a=="string"&&(r[l]=a)}return{order:n(t.order).map(s=>ot(s)),labels:r,active:n(t.active).map(s=>ot(s)),projectOrder:n(t.projectOrder).map(s=>ot(s)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const a=s,l=typeof a.id=="string"?a.id.trim():"";return l?[{id:l,hostId:typeof a.hostId=="string"?a.hostId.trim():"",remotePath:typeof a.remotePath=="string"?ot(a.remotePath):"",label:typeof a.label=="string"?a.label.trim():""}]:[]}):[]}}function ex(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(a=>typeof a=="string"&&a.trim().length>0):[],r=Array.isArray(t.skills)?t.skills.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const l=a,d=typeof l.name=="string"?l.name.trim():"",h=typeof l.path=="string"?l.path.trim():"";return d&&h?[{name:d,path:h}]:[]}):[],s=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const l=a,d=typeof l.label=="string"?l.label.trim():"",h=typeof l.path=="string"?l.path.trim():"",v=typeof l.fsPath=="string"?l.fsPath.trim():"";return d&&h&&v?[{label:d,path:h,fsPath:v}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:o,skills:r,fileAttachments:s,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function _y(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 s=o.flatMap(a=>{const l=ex(a);return l?[l]:[]});s.length>0&&(t[r]=s)}return t}async function pl(){return mc?Ff(mc):(du||(du=tx().then(e=>(mc=e,e)).finally(()=>{du=null})),Ff(await du))}async function tx(){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 Z_(n.data)}function Ff(e){var t;return{order:[...e.order],labels:{...e.labels},active:[...e.active],projectOrder:[...e.projectOrder],remoteProjects:((t=e.remoteProjects)==null?void 0:t.map(n=>({...n})))??[]}}function Sp(){mc=null}async function $m(){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 _y(n.data)}async function nx(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(_y(e))})).ok)throw new Error("Failed to save thread queue state")}async function ox(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:ot(r.data.cwd),gitRoot:ot(r.data.gitRoot)}}async function rx(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:ot(o.data.cwd),gitRoot:ot(o.data.gitRoot)}}async function ax(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 s=Array.isArray(r.data)?r.data:[],a=[],l=new Set;for(const d of s){if(!d||typeof d!="object"||Array.isArray(d))continue;const h=d,v=typeof h.value=="string"?h.value.trim():"",y=typeof h.label=="string"?h.label.trim():"";!v||l.has(v)||(l.add(v),a.push({value:v,label:y||v}))}return a}async function sx(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 s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=s.currentBranch,l=typeof a=="string"&&a.trim()?a.trim():null,d=Array.isArray(s.options)?s.options:[],h=[],v=new Set;for(const J of d){if(!J||typeof J!="object"||Array.isArray(J))continue;const ce=J,U=typeof ce.value=="string"?ce.value.trim():"",V=typeof ce.label=="string"?ce.label.trim():"";!U||v.has(U)||(v.add(U),h.push({value:U,label:V||U,isCurrent:ce.isCurrent===!0,isRemote:ce.isRemote===!0}))}l&&!v.has(l)&&h.unshift({value:l,label:l,isCurrent:!0});const y=s.headSha,_=s.headSubject,P=s.headDate,j=s.gitRoot,B=xy(s.changedFiles);return{currentBranch:l,headSha:typeof y=="string"&&y.trim()?y.trim():null,headSubject:typeof _=="string"&&_.trim()?_.trim():null,headDate:typeof P=="string"&&P.trim()?P.trim():null,detached:s.detached===!0,dirty:s.dirty===!0,gitRoot:typeof j=="string"?ot(j):"",options:h,changedFiles:B}}function xy(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,s=r.path,a=typeof s=="string"?ot(s.trim()):"";if(!a)continue;const l=r.status,d=typeof l=="string"?l.trim():"",h=r.label,v=typeof h=="string"&&h.trim()?h.trim():d;n.push({path:a,previousPath:typeof r.previousPath=="string"&&r.previousPath.trim()?ot(r.previousPath.trim()):null,status:d,label:v,addedLineCount:typeof r.addedLineCount=="number"?r.addedLineCount:null,removedLineCount:typeof r.removedLineCount=="number"?r.removedLineCount:null})}return n}async function ix(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 s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{isGitRepo:s.isGitRepo===!0,gitRoot:typeof s.gitRoot=="string"?ot(s.gitRoot):""}}async function lx(e,t){var s;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=(s=o.data)==null?void 0:s.currentBranch;return typeof r=="string"&&r.trim()?r.trim():null}async function cx(e,t,n={}){const o=e.trim(),r=t.trim();if(!o||!r)return[];const s=new URLSearchParams({cwd:o,branch:r,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),a=await fetch(`/codex-api/git/branch-commits?${s.toString()}`),l=await a.json();if(!a.ok)throw new Error(l.error||"Failed to load branch commits");return(Array.isArray(l.data)?l.data:[]).flatMap(h=>{if(!h||typeof h!="object"||Array.isArray(h))return[];const v=h,y=typeof v.sha=="string"?v.sha.trim():"",_=typeof v.shortSha=="string"?v.shortSha.trim():"",P=typeof v.subject=="string"?v.subject.trim():"",j=typeof v.date=="string"?v.date.trim():"";return!y||!_?[]:[{sha:y,shortSha:_,subject:P||_,date:j}]})}async function ux(e,t){const n=e.trim(),o=t.trim();if(!n||!o)return[];const r=new URLSearchParams({cwd:n,sha:o}),s=await fetch(`/codex-api/git/commit-files?${r.toString()}`),a=await s.json();if(!s.ok)throw new Error(a.error||"Failed to load commit files");return(Array.isArray(a.data)?a.data:[]).flatMap(d=>{if(!d||typeof d!="object"||Array.isArray(d))return[];const h=d,v=typeof h.path=="string"?h.path:"",y=typeof h.previousPath=="string"&&h.previousPath.length>0?h.previousPath:null,_=typeof h.status=="string"?h.status.trim():"",P=typeof h.label=="string"?h.label.trim():"",j=typeof h.addedLineCount=="number"&&Number.isFinite(h.addedLineCount)?h.addedLineCount:null,B=typeof h.removedLineCount=="number"&&Number.isFinite(h.removedLineCount)?h.removedLineCount:null;return!v||!_?[]:[{path:v,previousPath:y,status:_,label:P||_,addedLineCount:j,removedLineCount:B}]})}async function dx(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 s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{currentBranch:typeof s.currentBranch=="string"&&s.currentBranch.trim()?s.currentBranch.trim():null,headSha:typeof s.headSha=="string"&&s.headSha.trim()?s.headSha.trim():null,headSubject:typeof s.headSubject=="string"&&s.headSubject.trim()?s.headSubject.trim():null,headDate:typeof s.headDate=="string"&&s.headDate.trim()?s.headDate.trim():null,detached:s.detached===!0,dirty:s.dirty===!0,gitRoot:typeof s.gitRoot=="string"?ot(s.gitRoot):"",options:[],changedFiles:xy(s.changedFiles)}}async function RB(e,t,n,o,r){const s=new URLSearchParams({cwd:e,scope:t,workspaceView:n});o&&o.trim()&&s.set("baseBranch",o.trim()),r&&r.trim()&&s.set("commitSha",r.trim());const a=await fetch(`/codex-api/review/snapshot?${s.toString()}`),l=await a.json();if(!a.ok)throw new Error(vn(l,"Failed to load review snapshot"));return yy(l)}async function fx(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(vn(r,"Failed to load review summary"));return a_(r)}async function MB(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(vn(n,"Failed to apply review action"));return yy(n)}async function $B(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(vn(n,"Failed to initialize Git"))}async function jm(){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 px(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 zi(o);if(!o.ok){const d=vn(r,"Failed to load local directories");throw new Error(d)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{},l=Array.isArray(a.entries)?a.entries:[];return{path:typeof a.path=="string"?ot(a.path):"",parentPath:typeof a.parentPath=="string"?ot(a.parentPath):"",entries:l.flatMap(d=>{if(!d||typeof d!="object"||Array.isArray(d))return[];const h=d,v=typeof h.name=="string"?h.name.trim():"",y=typeof h.path=="string"?ot(h.path):"";return v&&y?[{name:v,path:y}]:[]})}}async function hx(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await zi(n);if(!n.ok){const l=vn(o,"Failed to load workspace files");throw new Error(l)}const s=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data;return(Array.isArray(s)?s:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const d=l,h=typeof d.path=="string"?ot(d.path):"",v=typeof d.relativePath=="string"?d.relativePath.trim():"";return!h||!v?[]:[{path:h,relativePath:v,isDirectory:d.isDirectory===!0}]})}async function mx(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await zi(n);if(!n.ok){const l=vn(o,"Failed to preview file");throw new Error(l)}const s=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data,a=s&&typeof s=="object"&&!Array.isArray(s)?s:{};return{path:typeof a.path=="string"?a.path:e,name:typeof a.name=="string"?a.name:"",size:typeof a.size=="number"?a.size:0,isText:a.isText===!0,isImage:a.isImage===!0,content:typeof a.content=="string"?a.content:void 0,truncated:a.truncated===!0}}async function zi(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"}`)}}async function sf(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");mc=Ff(e)}async function fu(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 l=vn(o,"Failed to open project root");throw new Error(l)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof s.path=="string"?ot(s.path):"";return Sp(),a}function vx(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function gx(e,t){var s;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((s=r==null?void 0:r[1])==null?void 0:s.trim())||t}async function yx(e,t){var v;const n=await fetch(vx(e));if(!n.ok){const y=await n.json().catch(()=>null),_="Failed to export project",P=vn(y,_),j=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),B=P!==_?P:j?`Failed to export project: ${j}`:_;throw new Error(B)}const o=Number(n.headers.get("content-length")??""),r=Number.isFinite(o)&&o>0?o:null,s=gx(n,"project.zip"),a=(v=n.body)==null?void 0:v.getReader();if(!a){const y=await n.blob();return t==null||t({loaded:y.size,total:y.size||r}),{blob:y,fileName:s}}const l=[];let d=0;for(t==null||t({loaded:d,total:r});;){const{done:y,value:_}=await a.read();if(y)break;_&&(l.push(new Uint8Array(_)),d+=_.byteLength,t==null||t({loaded:d,total:r}))}const h=l.map(y=>{const _=new Uint8Array(y.byteLength);return _.set(y),_.buffer});return{blob:new Blob(h,{type:n.headers.get("content-type")??"application/zip"}),fileName:s}}async function wx(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 zi(o);if(!o.ok){const d=vn(r,"Failed to import project");throw new Error(d)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{},l=typeof a.path=="string"?ot(a.path):"";return l&&Sp(),{path:l,importedSessions:typeof a.importedSessions=="number"?a.importedSessions:0}}async function bx(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await zi(t);if(!t.ok){const a=vn(n,"Failed to create local directory");throw new Error(a)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof r.path=="string"?ot(r.path):"";return s&&Sp(),s}async function kx(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 zi(n);if(!n.ok){const a=vn(o,"Failed to clone GitHub repository");throw new Error(a)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof s.path=="string"?ot(s.path):""}async function Cx(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 zi(t);if(!t.ok){const a=vn(n,"Failed to create new chat folder");throw new Error(a)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof r.cwd=="string"?ot(r.cwd):"";if(!s)throw new Error("Failed to create new chat folder");return{cwd:s,outputDirectory:typeof r.outputDirectory=="string"?ot(r.outputDirectory):s,workspaceRoot:typeof r.workspaceRoot=="string"?ot(r.workspaceRoot):""}}async function Tx(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 a=vn(o,"Failed to suggest project name");throw new Error(a)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{name:typeof s.name=="string"?s.name.trim():"",path:typeof s.path=="string"?ot(s.path):""}}async function Lm(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})}),s=await r.json();if(!r.ok){const h=vn(s,"Failed to search files");throw new Error(h)}const a=s&&typeof s=="object"&&!Array.isArray(s)?s:{},l=Array.isArray(a.data)?a.data:[],d=[];for(const h of l){if(!h||typeof h!="object"||Array.isArray(h))continue;const y=h.path,_=typeof y=="string"?y.trim():"";!_||my(_)||d.push({path:_})}return d}async function Sx(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}}async function _x(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=vn(o,"Failed to connect Telegram bot");throw new Error(r)}}async function xx(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const a=vn(t,"Failed to load Telegram configuration");throw new Error(a)}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:[],s=[];for(const a of r){if(a==="*"){s.push("*");continue}typeof a=="number"&&Number.isFinite(a)&&s.push(Math.trunc(a))}return{botToken:typeof o.botToken=="string"?o.botToken:"",allowedUserIds:s}}async function Ax(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const r=vn(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:""}}function vn(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}async function Px(){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 pu(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 Ix(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function Ex(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 Rx(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function Mx(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function $x(){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 jx(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 Lx(e,t){var n;try{return((n=(await vt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function Uf(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function Nx(e,t){const n=Uf(e),o=n.split("/").filter(Boolean);if(o.length<2)return null;const r=o.lastIndexOf("skills");if(r>=2){const d=o[r-2]??"";if(d){const h=`/${[...o.slice(0,r+1),d,"SKILL.md"].join("/")}`;if(t.has(h))return{rootPath:h,rootName:d,isNested:h!==n}}}const s=o.indexOf("skills");if(s<0||s+1>=o.length-1)return null;const a=o[s+1]??"";if(!a)return null;const l=`/${[...o.slice(0,s+2),"SKILL.md"].join("/")}`;return t.has(l)?{rootPath:l,rootName:a,isNested:l!==n}:{rootPath:l,rootName:a,isNested:l!==n}}async function Ox(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await vt("skills/list",t),o=n.data.flatMap(a=>a.skills),r=new Set(o.map(a=>Uf(a.path)).filter(Boolean)),s=new Map;for(const a of n.data)for(const l of a.skills){if(!l.name)continue;const d=Nx(l.path,r),h=Uf(l.path),y=!!(d!=null&&d.isNested&&r.has(d.rootPath))?d.rootPath:h,_=h===y,P=s.get(y),j={name:l.name,displayName:d&&y===d.rootPath?d.rootName:void 0,description:l.shortDescription||l.description||"",path:y,scope:l.scope,enabled:l.enabled,__hasRoot:_};if(!P){s.set(y,j);continue}if(P.enabled=P.enabled||l.enabled,!P.__hasRoot&&_){s.set(y,j);continue}!P.displayName&&j.displayName&&(P.displayName=j.displayName),!P.description&&j.description&&(P.description=j.description)}return Array.from(s.values()).map(({__hasRoot:a,...l})=>l)}catch{return[]}}const Dx=6e4;async function hu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),Dx);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)}}const Fx={},Ux={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Bx(e,t){return S(),I("svg",Ux,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Js=bt(Fx,[["render",Bx]]),qx={},zx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Hx(e,t){return S(),I("svg",zx,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const mu=bt(qx,[["render",Hx]]),Wx={},Vx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Gx(e,t){return S(),I("svg",Vx,[...t[0]||(t[0]=[p("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 Bf=bt(Wx,[["render",Gx]]),Kx={},Yx={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Jx(e,t){return S(),I("svg",Yx,[...t[0]||(t[0]=[p("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 Bi=bt(Kx,[["render",Jx]]),Qx={},Xx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Zx(e,t){return S(),I("svg",Xx,[...t[0]||(t[0]=[p("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 _p=bt(Qx,[["render",Zx]]),e1={},t1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function n1(e,t){return S(),I("svg",t1,[...t[0]||(t[0]=[p("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 o1=bt(e1,[["render",n1]]),r1={},a1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function s1(e,t){return S(),I("svg",a1,[...t[0]||(t[0]=[p("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 Ys=bt(r1,[["render",s1]]),Ay="codex-web-local.ui-language.v1",i1={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.":"请通过线程或项目菜单添加自动化。"},Nm={en:"English","zh-CN":"简体中文"};function l1(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Ay))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const pd=A(l1());function Py(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Py(pd.value);function c1(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function u1(e){pd.value=e,Py(e),typeof window<"u"&&window.localStorage.setItem(Ay,e)}function Iy(e,t){const n=pd.value==="zh-CN"?i1[e]??e:e;return c1(n,t)}function io(){return{uiLanguage:pd,uiLanguageOptions:[{value:"en",label:Nm.en},{value:"zh-CN",label:Nm["zh-CN"]}],t:Iy,setUiLanguage:u1}}const Ey="brutalstrikedevs@gmail.com",d1=20,f1=6500,Om=1800,lf=12,Dm=240,Fm=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,Tl=A([]);let Um=!1,cf=!1,uf=null;function lc(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 p1(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function h1(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 Ry(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Bm(e){return encodeURIComponent(e)}function m1(){return`mailto:${Ey}`}function v1(){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>Om?`${e.slice(0,Om)}
|
|
50
|
+
...[truncated]`:e:"No visible page text captured."}function g1(e,t){const n=t.replace(/\r\n/g,`
|
|
51
|
+
`).replace(/[ \t]+/g," ").trim();return n?Fm.test(e)||Fm.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Dm?`${n.slice(0,Dm)}...[truncated, ${n.length} chars total]`:n:""}function qm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,lf);for(let s=0;s<o;s+=1){const a=e.key(s);a&&n.push(`${a}=${g1(a,e.getItem(a)??"")}`)}const r=e.length>lf?`
|
|
52
|
+
...${e.length-lf} more item(s)`:"";return`${t}:
|
|
53
|
+
${n.join(`
|
|
54
|
+
`)||"empty"}${r}`}catch(n){return`${t}: unavailable (${Ry(lc(n))})`}}function y1(){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}`,qm(window.localStorage,"localStorage"),qm(window.sessionStorage,"sessionStorage")].join(`
|
|
55
|
+
`)}function Mi(e){const t=e.message.trim();if(!t)return;const n=Tl.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const o={...e,message:t,atIso:e.atIso??new Date().toISOString()};Tl.value=[o,...Tl.value].slice(0,d1)}function My(e=Tl.value){var h;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.101",s="codex-mobile",a=e.slice(0,12).map((v,y)=>[`${y+1}. [${v.atIso}] ${v.kind}`,v.method?`${v.method}`:"",v.url??"",typeof v.status=="number"?`${v.status} ${v.statusText??""}`.trim():"",v.message].filter(Boolean).join(" | ")).join(`
|
|
56
|
+
`),l=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${s}`,"","Browser/app state",y1(),"","Recent diagnostics",a||"No diagnostics captured.","","Visible page text",v1()].join(`
|
|
57
|
+
`).slice(0,f1),d=`Codex Web feedback: ${Ry((h=e[0])==null?void 0:h.message)}`;return`mailto:${Ey}?subject=${Bm(d)}&body=${Bm(l)}`}function w1(){typeof window>"u"||(window.location.href=My())}function b1(){if(!(typeof window>"u")&&(Um||(Um=!0,window.addEventListener("error",e=>{Mi({kind:"window-error",message:e.error?lc(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{Mi({kind:"unhandled-rejection",message:lc(e.reason),url:window.location.href})})),!cf)){if(typeof window.fetch!="function"){Mi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{uf=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=p1(e),o=h1(e,t);try{const r=await uf(e,t);return r.ok||Mi({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 Mi({kind:"fetch-error",message:lc(r),url:n,method:o}),r}},cf=!0}catch(e){uf=null,cf=!1;try{Mi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${lc(e)}`,url:window.location.href})}catch{}}}}function xp(){const e=X(()=>Tl.value.length>0);function t(n,o){Mi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:Tl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:w1,buildFeedbackMailto:My,feedbackMailtoBase:m1}}const $y="codex-web-local.recycle-bin.v1";function jy(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem($y);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 zm(e){if(!(typeof window>"u"))try{window.localStorage.setItem($y,JSON.stringify(e))}catch{}}const is=A(jy());function k1(){function e(){is.value=jy()}function t(r){is.value=[{...r,archivedAtIso:new Date().toISOString()},...is.value.filter(s=>s.id!==r.id)],zm(is.value)}function n(r){is.value=is.value.filter(s=>s.id!==r),zm(is.value)}async function o(r){if(!is.value.some(s=>s.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await j_(r),n(r),{ok:!0}}catch(s){return{ok:!1,error:s instanceof Error?s.message:"Failed to restore thread"}}}return{records:is,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}const C1=["title","aria-label","disabled"],T1={key:1,class:"composer-dropdown-value"},S1={key:0,class:"composer-dropdown-search-wrap"},_1=["placeholder","onKeydown"],x1={class:"composer-dropdown-options",role:"listbox"},A1=["onClick"],P1={key:0,class:"composer-dropdown-empty"},I1=tn({__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=A(null),s=A(null),a=A(null),l=A(null),d=A(!1),h=A(""),v=A({});let y=!1;const _=X(()=>{var Ae;const xe=n.options.find(Ue=>Ue.value===n.modelValue);return xe?xe.label:((Ae=n.placeholder)==null?void 0:Ae.trim())||""}),P=X(()=>n.openDirection??"down"),j=X(()=>n.menuAlign??"start"),B=X(()=>n.iconOnly===!0),J=X(()=>n.enableSearch===!0),ce=X(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),U=X(()=>{var xe;return((xe=n.searchPlaceholder)==null?void 0:xe.trim())||"Quick search projects"}),V=X(()=>{var xe;return((xe=n.emptyLabel)==null?void 0:xe.trim())||"No results"}),K=X(()=>{var xe;return _.value||((xe=n.placeholder)==null?void 0:xe.trim())||"Select option"}),ye=X(()=>{const xe=h.value.trim().toLowerCase();return xe?n.options.filter(Ae=>Ae.label.toLowerCase().includes(xe)||Ae.value.toLowerCase().includes(xe)):n.options});function _e(){n.disabled||(d.value=!d.value)}function we(xe,Ae,Ue){return Math.min(Ue,Math.max(Ae,xe))}function $e(){var te,oe,z,Be;if(!d.value)return;const xe=r.value;if(!xe||typeof window>"u")return;const Ae=xe.getBoundingClientRect(),Ue=window.innerWidth,Ye=window.innerHeight,He=8,At=8,ct=Math.max(0,Ue-He*2),Qe=((te=a.value)==null?void 0:te.offsetWidth)??((oe=s.value)==null?void 0:oe.offsetWidth)??224,et=((z=a.value)==null?void 0:z.offsetHeight)??((Be=s.value)==null?void 0:Be.offsetHeight)??0,ft=Math.min(Qe,ct),mt=Math.max(He,Ue-ft-He),kt=j.value==="end"?Ae.right-ft:Ae.left,at=we(kt,He,mt);let ae=P.value==="up"?Ae.top-et-At:Ae.bottom+At;et>0&&ae+et>Ye-He&&(ae=Ye-et-He),ae=Math.max(He,ae),v.value={position:"fixed",left:`${at}px`,right:"auto",top:`${ae}px`,bottom:"auto",width:`${ft}px`}}function de(){y||typeof window>"u"||(window.addEventListener("resize",$e),window.addEventListener("scroll",$e,!0),y=!0)}function Le(){!y||typeof window>"u"||(window.removeEventListener("resize",$e),window.removeEventListener("scroll",$e,!0),y=!1)}function je(xe){o("update:modelValue",xe),d.value=!1,h.value=""}function fe(){if(h.value.length>0){h.value="";return}d.value=!1}function Te(xe){if(!d.value)return;const Ae=r.value;if(!Ae)return;const Ue=xe.target;Ue instanceof Node&&(Ae.contains(Ue)||(d.value=!1,h.value=""))}return nt(d,xe=>{if(!xe){Le(),v.value={};return}de(),Wt(()=>{var Ae;$e(),window.requestAnimationFrame($e),J.value&&((Ae=l.value)==null||Ae.focus())})}),ws(()=>{window.addEventListener("pointerdown",Te)}),qi(()=>{window.removeEventListener("pointerdown",Te),Le()}),(xe,Ae)=>(S(),I("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[p("button",{class:Ke(["composer-dropdown-trigger",ce.value]),type:"button",title:K.value,"aria-label":K.value,disabled:e.disabled,onClick:_e},[e.selectedPrefixIcon?(S(),tt(cp(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ee("",!0),B.value?ee("",!0):(S(),I("span",T1,T(_.value),1)),Ie(Js,{class:"composer-dropdown-chevron"})],10,C1),d.value?(S(),I("div",{key:0,ref_key:"menuWrapRef",ref:s,class:Ke(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":P.value==="up","composer-dropdown-menu-wrap-down":P.value==="down"}]),style:kr(v.value)},[p("div",{ref_key:"menuRef",ref:a,class:"composer-dropdown-menu"},[J.value?(S(),I("div",S1,[Lt(p("input",{ref_key:"searchInputRef",ref:l,"onUpdate:modelValue":Ae[0]||(Ae[0]=Ue=>h.value=Ue),class:"composer-dropdown-search-input",type:"text",placeholder:U.value,onKeydown:An(lt(fe,["prevent"]),["esc"])},null,40,_1),[[an,h.value]])])):ee("",!0),p("ul",x1,[(S(!0),I(ze,null,_t(ye.value,Ue=>(S(),I("li",{key:Ue.value},[p("button",{class:Ke(["composer-dropdown-option",{"is-selected":Ue.value===e.modelValue}]),type:"button",onClick:Ye=>je(Ue.value)},T(Ue.label),11,A1)]))),128)),ye.value.length===0?(S(),I("li",P1,T(V.value),1)):ee("",!0)])],512)],6)):ee("",!0)],512))}}),or=bt(I1,[["__scopeId","data-v-48e2516e"]]),E1={},R1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function M1(e,t){return S(),I("svg",R1,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Ru=bt(E1,[["render",M1]]),$1=["aria-label","onKeydown"],j1={class:"app-dialog-header"},L1={class:"app-dialog-title-wrap"},N1={class:"app-dialog-title"},O1={key:0,class:"app-dialog-subtitle"},D1=["aria-label","title"],F1={class:"app-dialog-body"},U1={key:0,class:"app-dialog-footer"},B1=tn({__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}=io();function s(){o("close")}function a(l){n.open&&l.key==="Escape"&&(l.preventDefault(),s())}return nt(()=>n.open,l=>{typeof window>"u"||(l?window.addEventListener("keydown",a):window.removeEventListener("keydown",a))},{immediate:!0}),qi(()=>{typeof window>"u"||window.removeEventListener("keydown",a)}),(l,d)=>(S(),tt(Xs,{to:"body"},[e.open?(S(),I("div",{key:0,class:"app-dialog-overlay",onClick:lt(s,["self"])},[p("div",{class:Ke(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:An(lt(s,["prevent"]),["esc"])},[p("div",j1,[p("div",L1,[p("h3",N1,T(e.title),1),e.subtitle?(S(),I("p",O1,T(e.subtitle),1)):ee("",!0)]),p("button",{class:"app-dialog-close",type:"button","aria-label":g(r)("Close"),title:g(r)("Close"),onClick:s},[Ie(Ru,{class:"app-dialog-close-icon"})],8,D1)]),p("div",F1,[rr(l.$slots,"default",{},void 0)]),l.$slots.footer?(S(),I("div",U1,[rr(l.$slots,"footer",{},void 0)])):ee("",!0)],42,$1)])):ee("",!0)]))}}),df=bt(B1,[["__scopeId","data-v-0c988f32"]]),q1={key:0,class:"sidebar-menu-row-left"},z1={class:"sidebar-menu-row-main"},H1={key:1,class:"sidebar-menu-row-right"},W1={key:0,class:"sidebar-menu-row-right-default"},V1={key:1,class:"sidebar-menu-row-right-hover"},G1=tn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=kk(),o=X(()=>!!n.left),r=X(()=>!!n.right),s=X(()=>!!n["right-hover"]),a=X(()=>r.value||s.value);return(l,d)=>(S(),tt(cp(t.as),Ug({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":a.value,"data-has-right-hover":s.value,"data-force-right-hover":t.forceRightHover},l.$attrs),{default:yt(()=>[o.value?(S(),I("span",q1,[rr(l.$slots,"left",{},void 0,!0)])):ee("",!0),p("span",z1,[rr(l.$slots,"default",{},void 0,!0)]),a.value?(S(),I("span",H1,[r.value?(S(),I("span",W1,[rr(l.$slots,"right",{},void 0,!0)])):ee("",!0),s.value?(S(),I("span",V1,[rr(l.$slots,"right-hover",{},void 0,!0)])):ee("",!0)])):ee("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Ws=bt(G1,[["__scopeId","data-v-5fc666fb"]]),K1={},Y1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function J1(e,t){return S(),I("svg",Y1,[...t[0]||(t[0]=[p("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 Gu=bt(K1,[["render",J1]]),Q1={},X1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Z1(e,t){return S(),I("svg",X1,[...t[0]||(t[0]=[p("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 Ly=bt(Q1,[["render",Z1]]),eA=["data-menu-open"],tA={class:"thread-left-stack"},nA=["data-state"],oA=["data-confirming","title"],rA={key:0,class:"thread-delete-confirm-label"},aA={class:"thread-row-title-wrap"},sA={class:"thread-row-title-line"},iA={class:"thread-row-title"},lA=["title"],cA={key:0,class:"thread-row-automation-count"},uA=["data-state"],dA={class:"thread-row-time"},fA=tn({__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(s){n.setMenuWrapRef(s instanceof HTMLDivElement?s:null)}return(s,a)=>(S(),I("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Ie(Ws,{class:"thread-row","data-active":n.selected,"data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:a[3]||(a[3]=l=>o("select")),onMouseleave:a[4]||(a[4]=l=>o("row-leave",l)),onContextmenu:a[5]||(a[5]=l=>o("row-contextmenu",l))},{left:yt(()=>[p("span",tA,[n.showStatusIndicator?(S(),I("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,nA)):ee("",!0),p("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:a[0]||(a[0]=lt(l=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(S(),I("span",rA,T(n.confirmLabel),1)):(S(),tt(Ly,{key:1,class:"thread-icon"}))],8,oA)])]),right:yt(()=>[p("span",dA,T(n.relativeTime),1)]),"right-hover":yt(()=>[p("div",{ref:r,class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:a[2]||(a[2]=lt(l=>o("menu-toggle"),["stop"]))},[Ie(Bf,{class:"thread-icon"})])])]),default:yt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:a[1]||(a[1]=lt(l=>o("select"),["stop"]))},[p("span",aA,[p("span",sA,[p("span",iA,T(n.thread.title),1),n.thread.hasWorktree?(S(),tt(Gu,{key:0,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ee("",!0),n.automationCount>0?(S(),I("span",{key:1,class:"thread-row-automation-chip",title:n.automationTooltip},[Ie(Ys,{class:"thread-row-automation-icon"}),n.automationCount>1?(S(),I("span",cA,T(n.automationCount),1)):ee("",!0)],8,lA)):ee("",!0),n.thread.pendingRequestState?(S(),I("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},T(n.requestLabel),9,uA)):ee("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,eA))}}),vu=bt(fA,[["__scopeId","data-v-f14bf478"]]);function pA(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}const hA={key:0,class:"pinned-section"},mA={class:"thread-tree-header"},vA={key:0,class:"thread-list"},gA={class:"projects-section"},yA={class:"thread-tree-header"},wA=["aria-expanded","aria-label","title"],bA={class:"organize-menu-title"},kA=["data-active"],CA={key:0},TA=["data-active"],SA={key:0},_A=["data-active"],xA={key:0},AA={class:"organize-menu-title"},PA=["data-active"],IA={key:0},EA=["data-active"],RA={key:0},MA={key:0,class:"thread-tree-action-error"},$A={key:1,class:"thread-tree-no-results"},jA={key:2,class:"thread-tree-loading"},LA={key:3,class:"thread-list thread-list-global"},NA=["data-project-name","data-expanded","data-dragging"],OA={class:"project-icon-stack"},DA={class:"project-icon-folder"},FA={class:"project-icon-chevron"},UA=["data-dragging-handle","onMousedown"],BA=["title"],qA=["title"],zA={key:0,class:"thread-row-automation-count"},HA={class:"project-hover-controls"},WA=["onClick"],VA=["data-open-direction"],GA=["onClick"],KA=["onClick"],YA=["onClick"],JA=["onClick"],QA=["onClick"],XA=["onClick"],ZA={class:"project-menu-label"},eP=["onInput"],tP=["aria-label","title","onClick"],nP={key:0,class:"thread-list"},oP={class:"project-empty"},rP=["onClick"],aP={class:"chats-section"},sP={class:"thread-tree-header"},iP={class:"chats-section-actions"},lP=["aria-label","title"],cP={key:0,class:"thread-tree-no-results"},uP={key:1,class:"thread-list thread-list-global"},dP=["data-open-direction"],fP=["disabled","title"],pP=["placeholder","onKeydown"],hP={key:0,class:"recycle-bin-empty"},mP={key:1,class:"recycle-bin-list"},vP={class:"recycle-bin-item-copy"},gP={class:"recycle-bin-item-title"},yP={key:0,class:"recycle-bin-item-meta"},wP={class:"recycle-bin-item-time"},bP={class:"recycle-bin-item-actions"},kP=["disabled","onClick"],CP=["onClick"],TP={key:2,class:"recycle-bin-error",role:"alert"},SP=["aria-label"],_P={class:"rename-thread-title"},xP={class:"rename-thread-subtitle"},AP={key:0,class:"automation-target-picker"},PP={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},IP={class:"automation-target-dropdown"},EP=["aria-label"],RP=["onClick"],MP={class:"automation-thread-field"},$P={class:"automation-thread-label"},jP=["placeholder"],LP={class:"automation-thread-field"},NP={class:"automation-thread-label"},OP=["placeholder"],DP={class:"automation-thread-field"},FP={class:"automation-thread-label"},UP={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},BP={key:0,class:"automation-schedule-row"},qP={class:"automation-schedule-copy"},zP={key:1,class:"automation-schedule-row"},HP={class:"automation-schedule-copy"},WP={class:"automation-schedule-preview"},VP={class:"automation-thread-field"},GP={class:"automation-thread-label"},KP={key:2,class:"rename-thread-subtitle automation-thread-error"},YP={key:3,class:"rename-thread-subtitle automation-thread-notice"},JP={class:"rename-thread-actions"},QP=["disabled"],XP=["disabled"],ZP=["disabled"],eI=["disabled"],tI=4,Hm=6,Wm="codex-web-local.sidebar-section-expansion.v1",Vm="codex-web-local.sidebar-chats-first.v1",Gm="codex-web-local.sidebar-chat-sort-mode.v1",Km="codex-web-local.thread-view-mode.v1",Ym="codex-web-local.collapsed-projects.v1",nI=tn({__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}=io(),{recordVisibleFailure:s}=xp(),a=n,{records:l,loadRecords:d,recordArchivedThread:h,removeArchivedRecord:v,restoreArchivedThread:y}=k1(),_=A(!1),P=A(""),j=A("");function B(){Qt.value=!1,P.value="",d(),_.value=!0}async function J(w){if(!j.value){j.value=w,P.value="";try{const k=await y(w);k.ok?a("restore-thread",w):P.value=k.error??"Failed to restore thread"}finally{j.value=""}}}const ce=A({}),U=A({}),V=A(!0),K=A(!0),ye=A(!0),_e=A(!1),we=A(ni(Vm,!1)),$e=A(Et());let de=!1;const Le=A([]),je=A({}),fe=A(""),Te=A([]),xe=A(""),Ae=A(""),Ue=A("hover"),Ye=A({}),He=A({}),At=A({}),ct=A("actions"),Qe=A(""),et=A(!1),ft=A(""),mt=A(""),kt=A(null),at=A(!1),ae=A(""),te=A(""),oe=A({}),z=A({}),Be=A(!1),$=A("thread"),O=A(""),G=A(""),ue=A(""),ie=A("create"),re=A(!1),Se=A("thread"),be=A(""),pe=A(""),se=A(""),Ee=A(""),ge=A(!1),Fe=A(!1),Me=A({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),Ve=A({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),rt=X(()=>{if($.value==="project"){const k=G.value;return k?z.value[k]??[]:[]}const w=O.value;return w?oe.value[w]??[]:[]}),gt=X(()=>fn(Me.value.rrule)),It=X(()=>re.value&&ie.value==="create"?Se.value==="thread"?r("This creates a heartbeat automation attached to the selected chat."):r("This creates a project automation attached to the selected project folder."):$.value==="project"?r("This creates project automations attached to the selected project folder."):r("This creates heartbeat automations attached to the selected thread.")),Tt=X(()=>{var k;const w=[];for(const C of o.groups)for(const D of C.threads){const Ce=((k=D.title)==null?void 0:k.trim())||D.id,st=no(C.projectName);w.push({value:D.id,label:`${Ce} · ${st}`,searchText:`${Ce} ${st} ${D.id}`.toLowerCase()})}return w}),Tn=X(()=>{const w=[];for(const k of o.groups){const C=Mo(k.projectName);if(!C)continue;const D=no(k.projectName);w.push({value:C,label:D,searchText:`${D} ${C}`.toLowerCase()})}return w}),H=X(()=>(Se.value==="project"?Tn.value:Tt.value).map(k=>({value:k.value,label:k.label}))),W=[{value:"minutes",label:r("minutes")},{value:"hours",label:r("hours")},{value:"days",label:r("days")}],Y=X(()=>[{value:"ACTIVE",label:r("Active")},{value:"PAUSED",label:r("Paused")}]);nt(H,w=>{var k;re.value&&(w.some(C=>C.value===be.value)||(be.value=((k=w[0])==null?void 0:k.value)??""))});const me=A(null),Oe=A(null),We=A(null);let Ze=null,Ft=null;const Nt=A(""),Kn=A({}),lo=new Map,co=new Map,uo=new Map,fo=new WeakMap,za=A(null),Cr=A(null),Qt=A(!1),ut=A(bs()),gn=typeof window<"u"?new ResizeObserver(w=>{for(const k of w){const C=k.target,D=fo.get(C);D&&wn(D,C)}}):null;function zo(){if(typeof window>"u")return{};try{const w=window.localStorage.getItem(Ym);if(!w)return{};const k=JSON.parse(w);return!k||typeof k!="object"||Array.isArray(k)?{}:k}catch{return{}}}function bs(){return typeof window>"u"?"project":window.localStorage.getItem(Km)==="chronological"?"chronological":"project"}function ni(w,k){if(typeof window>"u")return k;const C=window.localStorage.getItem(w);return C==="true"?!0:C==="false"?!1:k}function Et(){return typeof window>"u"?"updated":window.localStorage.getItem(Gm)==="created"?"created":"updated"}U.value=zo();function Ut(){if(!(typeof window>"u"))try{const w=JSON.parse(window.localStorage.getItem(Wm)||"{}");typeof w.pinned=="boolean"&&(V.value=w.pinned),typeof w.projects=="boolean"&&(K.value=w.projects),typeof w.chats=="boolean"&&(ye.value=w.chats)}catch{}}function ht(){typeof window>"u"||window.localStorage.setItem(Wm,JSON.stringify({pinned:V.value,projects:K.value,chats:ye.value}))}Ut(),nt(U,w=>{typeof window>"u"||window.localStorage.setItem(Ym,JSON.stringify(w))},{deep:!0}),nt(ut,w=>{typeof window>"u"||window.localStorage.setItem(Km,w)}),nt(we,w=>{typeof window>"u"||window.localStorage.setItem(Vm,String(w))}),nt($e,w=>{typeof window>"u"||window.localStorage.setItem(Gm,w)}),nt([V,K,ye],ht);const Ho=X(()=>o.searchQuery.trim().toLowerCase()),dn=X(()=>Ho.value.length>0),sr=X(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),ir=X(()=>new Set(Le.value)),Yn=X(()=>new Set(Te.value));function lr(w){if(Yn.value.has(w.id))return!1;if(!dn.value)return!0;if(sr.value)return sr.value.has(w.id);const k=Ho.value;return w.title.toLowerCase().includes(k)||w.preview.toLowerCase().includes(k)}const ba=X(()=>o.groups.flatMap(w=>{const k=w.threads.filter(C=>!Wu(C.cwd)&&lr(C));return k.length>0?[{...w,threads:k}]:!dn.value&&w.threads.length===0?[{...w,threads:k}]:[]})),Ha=X(()=>ut.value==="chronological"),Dn=X(()=>{const w=[];for(const k of o.groups)for(const C of k.threads)ir.value.has(C.id)||lr(C)&&w.push(C);return w.sort((k,C)=>{const D=new Date(k.updatedAtIso||k.createdAtIso).getTime();return new Date(C.updatedAtIso||C.createdAtIso).getTime()-D})}),In=X(()=>{const w=Dn.value.filter(C=>Wu(C.cwd)),k=$e.value==="created"?"createdAtIso":"updatedAtIso";return w.sort((C,D)=>{const Ce=new Date(C[k]||C.updatedAtIso||C.createdAtIso).getTime();return new Date(D[k]||D.updatedAtIso||D.createdAtIso).getTime()-Ce})}),Gr=X(()=>dn.value||_e.value?In.value:In.value.slice(0,10)),Ao=X(()=>dn.value?!1:In.value.length>10),nn=X(()=>{const w=new Map;for(const k of o.groups)for(const C of k.threads)Yn.value.has(C.id)||w.set(C.id,C);return w});nt(Le,w=>{de&&Mx(w)}),nt([nn,()=>o.isThreadListFullyLoaded],([w])=>{const k=pA(Le.value,new Set(w.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(k.length===Le.value.length)return;const C=new Set(k),D=Object.fromEntries(Object.entries(je.value).filter(([Ce])=>C.has(Ce)));je.value=D,Le.value=k});let Kr=0;async function Yt(){if(o.isLoading)return;const w=Le.value.filter(Ce=>!nn.value.has(Ce)&&!je.value[Ce]);if(w.length===0)return;const k=Kr+=1,C=await Promise.all(w.map(async Ce=>{try{return await e_(Ce)}catch{return null}}));if(k!==Kr)return;const D={...je.value};for(const Ce of C)Ce&&(D[Ce.id]=Ce);je.value=D}nt([Le,nn,()=>o.isLoading],()=>{de&&Yt()}),ws(async()=>{const{threadIds:w}=await Rx(),k=Array.isArray(w)?w.filter(C=>typeof C=="string").map(C=>C.trim()).filter((C,D,Ce)=>C.length>0&&Ce.indexOf(C)===D):[];k.length>0&&(Le.value=k);try{oe.value=await g_()}catch{oe.value={}}try{await Gt()}catch{z.value={}}de=!0,Yt()});const Yr=X(()=>_r(ae.value)),ka=X(()=>{const w=te.value;return Yr.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:w}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:w})}),Jn=X(()=>{const w=new Map;for(const k of o.groups)for(const C of k.threads)w.set(C.id,k.projectName);return w}),Qn=X(()=>{const w=new Map;for(const k of o.groups){const C=k.threads.filter(D=>!ir.value.has(D.id)&&!Yn.value.has(D.id));w.set(k.projectName,C)}return w}),Po=X(()=>{const w=new Map;for(const k of o.groups)for(const C of k.threads){const D=new Date(C.updatedAtIso||C.createdAtIso).getTime();w.set(C.id,D)}return w}),Pt=X(()=>{const w=Ae.value;return w?nn.value.get(w)??null:null}),$t=X(()=>Le.value.map(w=>nn.value.get(w)??je.value[w]??null).filter(w=>w!==null).filter(lr));function zn(){V.value=!V.value}function po(){K.value=!K.value}function Hn(){ye.value=!ye.value}const Xn=X(()=>{const w=We.value;if(!w||w.dropTargetIndexFull===null||o.groups.length===0)return null;const k=Math.max(0,Math.min(w.dropTargetIndexFull,o.groups.length)),C=k>w.fromIndex?k-1:k,D=Math.max(0,Math.min(C,o.groups.length-1));return D===w.fromIndex?null:D}),Mn=X(()=>{const k=(dn.value?ba.value:o.groups).map(Rt=>Rt.projectName),C=We.value,D=Xn.value;if(!C||D===null)return k;const Ce=[...k],[st]=Ce.splice(C.fromIndex,1);return st?(Ce.splice(D,0,st),Ce):k}),Io=X(()=>{const w={};let k=0;for(const C of Mn.value)w[C]=k,k+=Un(C);return w}),ho=X(()=>{let w=0;for(const k of Mn.value)w+=Un(k);return{height:`${Math.max(0,w)}px`}});function Tr(w){if(Number.isNaN(w))return"n/a";const k=Math.abs(Date.now()-w);if(k<6e4)return r("now");const C=Math.floor(k/6e4);if(C<60)return`${C}m`;const D=Math.floor(C/60);return D<24?`${D}h`:`${Math.floor(D/24)}d`}function Sr(w){const k=Po.value.get(w.id);return Tr(typeof k=="number"?k:new Date(w.updatedAtIso||w.createdAtIso).getTime())}function oi(w){const k=new Date(w).getTime();return Number.isNaN(k)?"":new Date(k).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Wo(w){return ir.value.has(w)}function Wa(w){if(Wo(w)){Le.value=Le.value.filter(k=>k!==w);return}Le.value=[w,...Le.value]}function Ca(w){Wa(w),Ge()}function cr(w){fe.value="",a("select",w)}function _r(w){return ur(w)>0}function ur(w){var k;return((k=oe.value[w])==null?void 0:k.length)??0}function Ct(w){return Fn(w)>0}function Fn(w){var C;const k=Mo(w);return k?((C=z.value[k])==null?void 0:C.length)??0:0}function Sn(w){if(w.length===0)return"";if(w.length>1){const D=w.filter(Ce=>Ce.status==="ACTIVE").length;return`${w.length} ${r("automations")} • ${D} ${r("active")}`}const[k]=w,C=k.status==="PAUSED"?"-":k.nextRunAtMs?new Date(k.nextRunAtMs).toLocaleString():r("Not scheduled");return`${k.name} • ${r("Next run")}: ${C}`}function sn(w){return Sn(oe.value[w]??[])}function mo(w){const k=Mo(w);return Sn(k?z.value[k]??[]:[])}function Vo(w){return String(Math.max(0,w)).padStart(2,"0")}function En(w,k){const C=typeof w=="number"?w:Number(w);return Number.isFinite(C)?Math.max(1,Math.floor(C)):k}function Wn(w){const[k,C]=w.split(":"),D=Math.min(23,Math.max(0,Number(k)||0)),Ce=Math.min(59,Math.max(0,Number(C)||0));return`FREQ=DAILY;BYHOUR=${D};BYMINUTE=${Ce}`}function xt(w,k){const C=En(w,1);return k==="minutes"?`FREQ=MINUTELY;INTERVAL=${C}`:k==="hours"?`FREQ=HOURLY;INTERVAL=${C}`:`FREQ=DAILY;INTERVAL=${C}`}function yn(w){return Object.fromEntries(w.split(";").map(k=>k.trim()).filter(Boolean).map(k=>{const[C,...D]=k.split("=");return[C.toUpperCase(),D.join("=").trim()]}).filter(([k,C])=>k&&C))}function Bt(w){var Ce;const k=yn(w),C=(Ce=k.FREQ)==null?void 0:Ce.toUpperCase(),D=En(k.INTERVAL,1);if(C==="DAILY"&&k.BYHOUR!==void 0&&k.BYMINUTE!==void 0&&D===1){const st=Math.min(23,Math.max(0,Number(k.BYHOUR)||0)),Rt=Math.min(59,Math.max(0,Number(k.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Vo(st)}:${Vo(Rt)}`,interval:1,intervalUnit:"hours"}}return C==="MINUTELY"||C==="HOURLY"||C==="DAILY"&&k.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:D,intervalUnit:C==="MINUTELY"?"minutes":C==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function fn(w){var Ce;const k=yn(w),C=(Ce=k.FREQ)==null?void 0:Ce.toUpperCase(),D=En(k.INTERVAL,1);if(C==="DAILY"&&k.BYHOUR!==void 0&&k.BYMINUTE!==void 0&&D===1){const st=Math.min(23,Math.max(0,Number(k.BYHOUR)||0)),Rt=Math.min(59,Math.max(0,Number(k.BYMINUTE)||0));return`${r("RRULE")}: ${w} · ${r("runs daily at")} ${Vo(st)}:${Vo(Rt)}`}return C==="MINUTELY"?`${r("RRULE")}: ${w} · ${r("runs every")} ${D} ${r("minute(s)")}`:C==="HOURLY"?`${r("RRULE")}: ${w} · ${r("runs every")} ${D} ${r("hour(s)")}`:C==="DAILY"&&k.INTERVAL!==void 0?`${r("RRULE")}: ${w} · ${r("runs every")} ${D} ${r("day(s)")}`:w?`${r("RRULE")}: ${w}`:r("RRULE is required.")}function Vn(){const w=Ve.value;w.mode==="daily"?Me.value.rrule=Wn(w.dailyTime):w.mode==="interval"&&(Me.value.rrule=xt(w.interval,w.intervalUnit))}function Zn(w){w!=="minutes"&&w!=="hours"&&w!=="days"||(Ve.value={...Ve.value,intervalUnit:w},Vn())}function vo(w){w!=="ACTIVE"&&w!=="PAUSED"||(Me.value={...Me.value,status:w})}function xr(){Ve.value=Bt(Me.value.rrule)}function Go(w){Ve.value={...Ve.value,mode:w},Vn()}function Jr(w){w===o.selectedThreadId&&(a("copy-thread-chat",w),Ge())}function Ko(w){a("fork-thread",w),Ge()}function Eo(w){return`${r("start new thread")} ${no(w)}`}function Ar(w){a("start-new-thread",w)}function go(w){a("browse-thread-files",w),Ge()}function M(w){a("save-thread-project",w),Ge()}async function F(w){var C,D;const k=((D=(C=nn.value.get(w))==null?void 0:C.cwd)==null?void 0:D.trim())??"";if(Ge(),!(!k||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(k)}catch{}}function ne(w,k){if(Ae.value===w&&Ue.value==="hover"){if(k){const C=k.relatedTarget,D=Cr.value;if(C instanceof Node&&D&&D.contains(C))return}Ge()}}function Pe(w){return Ae.value===w}function Ge(){Ae.value="",Ue.value="hover",At.value={}}function qt(w){if(fe.value="",Ae.value===w){Ge();return}Ue.value="hover",$n(),Qt.value=!1,Ae.value=w,Wt(()=>{Jo(w)})}function pn(w,k){w.preventDefault(),fe.value="",Ue.value="contextmenu",Ae.value=k}function Xt(w,k){ft.value=w,mt.value=k,et.value=!0,Ge(),Wt(()=>{var C,D;(C=kt.value)==null||C.focus(),(D=kt.value)==null||D.select()})}function jt(){et.value=!1,ft.value="",mt.value=""}function Pr(){const w=ft.value,k=mt.value.trim();!w||!k||(a("rename-thread",{threadId:w,title:k}),jt())}function yo(w,k){fe.value="",ae.value=w,te.value=k,at.value=!0,Ge()}function Ta(){at.value=!1,ae.value="",te.value=""}async function Ml(){const w=ae.value;w&&(ks(w),Ta())}function Qr(w){return fe.value===w}function Gn(w){if(fe.value!==w){fe.value=w,Ge();return}ks(w),fe.value=""}function ks(w){var C,D;const k=nn.value.get(w)??null;Yn.value.has(w)||(Te.value=[w,...Te.value]),fe.value="",Ge(),h({id:w,title:((C=k==null?void 0:k.title)==null?void 0:C.trim())||"(untitled)",cwd:((D=k==null?void 0:k.cwd)==null?void 0:D.trim())??"",projectName:Jn.value.get(w)??""}),Le.value=Le.value.filter(Ce=>Ce!==w),a("archive",w),_r(w)&&(Cm(w).catch(()=>{}),oe.value=to(oe.value,w))}function _n(w){var C;$.value="thread",O.value=w,G.value="",re.value=!1,pe.value="",se.value="";const k=(C=oe.value[w])==null?void 0:C[0];k?Ro(k.id):hn(),Be.value=!0,Ge()}function ri(w){var D;const k=Mo(w);if(!k){$.value="project",O.value="",G.value="",re.value=!1,pe.value=r("Project automation requires a resolved absolute project path."),se.value="",Be.value=!0,$n();return}$.value="project",O.value="",G.value=k,re.value=!1,pe.value="",se.value="";const C=(D=z.value[k])==null?void 0:D[0];C?Ro(C.id):hn(),Be.value=!0,$n()}function Hi(w){$.value=w.scope,O.value=w.scope==="thread"?w.target:"",G.value=w.scope==="project"?w.target:"",re.value=!1,pe.value="",se.value="",w.scope==="project"?z.value=si(z.value,w.target,w.automation):oe.value=Yo(oe.value,w.target,w.automation),Ro(w.automation.id),Be.value=!0,$n(),Ge()}function ai(){var w;re.value=!0,Se.value="thread",be.value=((w=Tt.value[0])==null?void 0:w.value)??"",$.value="thread",O.value="",G.value="",pe.value="",se.value="",hn(),Be.value=!0,$n(),Ge()}function ln(w){var k;Se.value=w,be.value="",$.value=w==="project"?"project":"thread",be.value=((k=H.value[0])==null?void 0:k.value)??""}function hn(){ue.value="",ie.value="create",pe.value="",se.value="",Me.value={name:$.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},Ve.value=Bt(Me.value.rrule)}function Ro(w){const k=rt.value.find(C=>C.id===w);k&&(ue.value=k.id,ie.value="edit",pe.value="",se.value="",Me.value={name:k.name,prompt:k.prompt,rrule:k.rrule,status:k.status},Ve.value=Bt(k.rrule))}function eo(){Be.value=!1,$.value="thread",O.value="",G.value="",ue.value="",pe.value="",se.value="",ge.value=!1,Fe.value=!1}function to(w,k){return Object.fromEntries(Object.entries(w).filter(([C])=>C!==k))}function Yo(w,k,C){const D=w[k]??[],Ce=D.findIndex(Rt=>Rt.id===C.id),st=[...D];return Ce>=0?st.splice(Ce,1,C):st.push(C),{...w,[k]:st}}function Cs(w,k,C){const D=(w[k]??[]).filter(Ce=>Ce.id!==C);return D.length>0?{...w,[k]:D}:to(w,k)}function Sa(w,k){return Object.fromEntries(Object.entries(w).filter(([C])=>C!==k))}function si(w,k,C){const D=w[k]??[],Ce=D.findIndex(Rt=>Rt.id===C.id),st=[...D];return Ce>=0?st.splice(Ce,1,C):st.push(C),{...w,[k]:st}}async function Gt(){z.value=await y_()}async function Zt(){let w=O.value,k=G.value;ge.value=!0,pe.value="",se.value="";try{if(Vn(),re.value&&ie.value==="create"&&(Se.value==="thread"?(w=be.value,k="",$.value="thread",O.value=w,G.value=""):(k=be.value,w="",$.value="project",O.value="",G.value=k)),$.value==="thread"&&!w)throw new Error(r("Select a chat target for this automation"));if($.value==="project"&&!k)throw new Error(r("Select a project target for this automation"));const C={id:ue.value||void 0,name:Me.value.name,prompt:Me.value.prompt,rrule:Me.value.rrule,status:Me.value.status},D=$.value==="project"?await b_({...C,projectName:k}):await w_({...C,threadId:w});$.value==="project"?await Gt():oe.value=Yo(oe.value,w,D),a("automations-changed"),Ro(D.id),se.value=r("Automation saved."),ge.value=!1}catch(C){pe.value=C instanceof Error?C.message:r("Failed to save automation"),ge.value=!1}}async function ii(){const w=O.value,k=G.value,C=ue.value;if(C&&!($.value==="thread"&&!w)&&!($.value==="project"&&!k)){ge.value=!0,pe.value="",se.value="";try{$.value==="project"?(await Tm(k,C),await Gt()):(await Cm(w,C),oe.value=Cs(oe.value,w,C));const D=rt.value[0];D?Ro(D.id):hn(),a("automations-changed"),ge.value=!1}catch(D){pe.value=D instanceof Error?D.message:r("Failed to remove automation"),ge.value=!1}}}async function Ts(){const w=O.value,k=ue.value;if(!(!w||!k)){Fe.value=!0,pe.value="",se.value="";try{await k_(w,k),se.value=r("Automation run queued.")}catch(C){pe.value=C instanceof Error?C.message:r("Failed to run automation")}finally{Fe.value=!1}}}function no(w){return o.projectDisplayNameById[w]??w}t({openAutomationEditorFromPanel:Hi,openAutomationCreatorFromPanel:ai,openRenameThreadDialog:Xt,openRecycleBin:B});function dr(w){return w.includes("/")||w.includes("\\")}function Wi(w){return dr(w)?w:no(w)}function fr(w){const k=br(w);if(!k)return!1;let C=0;for(const D of o.groups)if(dr(D.projectName)&&br(D.projectName)===k&&(C+=1,C>1))return!0;return!1}function li(w){const k=o.projectDisplayNameById[w.projectName],C=no(w.projectName),D=w.projectName;if(k&&!dr(D)&&D!==C)return C.includes(D)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(D)?C:`${C} ${D}`;if(k&&dr(D)){const Rt=br(D),$o=br(Cl(D)),Kt=fr(D)?$o:Rt;return Kt&&Kt!==C?`${C} ${Kt}`:C}if(!C.includes("/")&&!C.includes("\\"))return C;const Ce=br(C)||C,st=br(Cl(C));return st.startsWith(".")&&st!==Ce?`${Ce} ${st}`:w.threads.length>0||!fr(D)?Ce:st?`${Ce} ${st}`:Ce}function _a(w){return xe.value===w}function $n(){xe.value="",ct.value="actions",Qe.value=""}function Va(){const w=!Qt.value;w&&($n(),Ge()),Qt.value=w}function ci(w){ut.value=w,Qt.value=!1}function ui(){we.value=!we.value}function Vi(w){$e.value=w}function Ss(w){a("request-project-git-status",w),Wt(()=>{Ka(w)})}function $l(w){if(xe.value===w){$n();return}Ge(),Qt.value=!1,xe.value=w,ct.value="actions",Qe.value=no(w),Ss(w)}function di(w){Ge(),Qt.value=!1,xe.value=w,ct.value="actions",Qe.value=no(w),Ss(w)}function Ir(w){return o.projectDisplayNameById[w.projectName]??li(w)}function Xr(w){Ge();const k=w.projectName;xe.value=k,ct.value="rename",Qe.value=Ir(w),Wt(()=>{Ka(k)})}function pr(w){a("browse-project-files",w),$n()}function Zr(w){a("save-project",w),$n()}function xa(w){a("create-project-worktree",w),$n()}function hr(w){a("rename-project",{projectName:w,displayName:Qe.value})}function Aa(w){const k=Mo(w);if(a("remove-project",w),k&&Ct(w)){Ee.value="";const C=z.value;z.value=Sa(z.value,k),Tm(k).then(Gt).catch(async D=>{z.value=C;const Ce=D instanceof Error?D.message:r("Failed to delete project automation");Ee.value=Ce,s(Ce);try{await Gt()}catch{z.value=C}}).finally(()=>{a("automations-changed")})}$n()}function Mo(w){var C;const k=((C=o.projectCwdByName[w])==null?void 0:C.trim())??"";return fS(k)?k:""}function Ga(w,k){if(!w.altKey||w.key!=="ArrowUp"&&w.key!=="ArrowDown")return;const C=o.groups.findIndex(st=>st.projectName===k);if(C<0)return;const D=w.key==="ArrowUp"?-1:1,Ce=Math.max(0,Math.min(C+D,o.groups.length-1));Ce!==C&&(w.preventDefault(),a("reorder-project",{projectName:k,toIndex:Ce}))}function Er(w){return ce.value[w]===!0}function wo(w){return U.value[w]===!0}function Rr(w){ce.value={...ce.value,[w]:!Er(w)}}function qe(){_e.value=!_e.value}function ke(w){if(Nt.value===w){Nt.value="";return}U.value={...U.value,[w]:!wo(w)}}function Un(w){const k=Kn.value[w]??0,C=We.value,Ce=((C==null?void 0:C.projectName)===w?C.groupHeight:null)??k,st=wo(w)?0:Hm;return Math.max(0,Ce+st)}function Pa(w,k){const C=k instanceof HTMLElement?k:k&&"$el"in k&&k.$el instanceof HTMLElement?k.$el:null;if(C){co.set(w,C);return}co.delete(w)}function mr(w,k){const C=k instanceof HTMLElement?k:k&&"$el"in k&&k.$el instanceof HTMLElement?k.$el:null;if(C){uo.set(w,C);return}uo.delete(w)}function _s(w){let k=w.parentElement;for(;k;){const C=window.getComputedStyle(k),D=C.overflowY||C.overflow;if(D==="auto"||D==="scroll"||D==="hidden"||D==="clip")return k.getBoundingClientRect();k=k.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function cn(w,k){const C=w.getBoundingClientRect(),D=_s(w),Ce=6,st=D.bottom-C.bottom,Rt=C.top-D.top;return st>=k+Ce?"down":Rt>st?"up":"down"}function ea(w,k){const C=uo.get(w);if(!C)return"down";const D=cn(C,k);return He.value={...He.value,[w]:D},D}function jl(w){return He.value[w]??"down"}function Ka(w){const k=co.get(w);if(!k)return;const C=k.querySelector(".project-menu-panel"),D=(C==null?void 0:C.getBoundingClientRect().height)??0;Ye.value={...Ye.value,[w]:cn(k,D)}}function jn(w,k,C){return Math.min(Math.max(w,k),C)}function Jo(w){const k=uo.get(w);if(!k)return;const C=Cr.value,D=C==null?void 0:C.getBoundingClientRect(),Ce=(D==null?void 0:D.height)||(C==null?void 0:C.offsetHeight)||112,st=(D==null?void 0:D.width)||(C==null?void 0:C.offsetWidth)||160,Rt=ea(w,Ce),$o=k.getBoundingClientRect(),Kt=8,Nn=4,bn=Math.max(Kt,window.innerWidth-st-Kt),tr=jn($o.right-st,Kt,bn),Nr=jn(Rt==="up"?$o.top-Ce-Nn:$o.bottom+Nn,Kt,Math.max(Kt,window.innerHeight-Ce-Kt));At.value={left:`${Math.round(tr)}px`,top:`${Math.round(Nr)}px`}}function bo(){const w=Ae.value;w&&Jo(w)}function Mr(){window.addEventListener("resize",bo),document.addEventListener("scroll",bo,!0)}function Ln(){window.removeEventListener("resize",bo),document.removeEventListener("scroll",bo,!0)}function Ya(w){const k=xe.value;if(!k)return!1;const C=co.get(k);if(!C)return!1;if((typeof w.composedPath=="function"?w.composedPath():[]).includes(C))return!0;const Ce=w.target;return Ce instanceof Node?C.contains(Ce):!1}function Ia(w){const k=Ae.value;if(!k)return!1;const C=uo.get(k);if(!C)return!1;const D=typeof w.composedPath=="function"?w.composedPath():[];if(D.includes(C))return!0;const Ce=Cr.value;if(Ce&&D.includes(Ce))return!0;const st=w.target;return st instanceof Node?!!(C.contains(st)||Ce&&Ce.contains(st)):!1}function $r(w){if(Qt.value){const k=za.value,C=typeof w.composedPath=="function"?w.composedPath():[];!!k&&(C.includes(k)||w.target instanceof Node&&k.contains(w.target))||(Qt.value=!1)}xe.value&&(Ya(w)||$n(),Ae.value&&(Ia(w)||Ge()))}function fi(w){xe.value&&!Ya(w)&&$n(),Ae.value&&!Ia(w)&&Ge()}function Qo(){Qt.value&&(Qt.value=!1),xe.value&&$n(),Ae.value&&Ge()}function Xo(){window.addEventListener("pointerdown",$r,{capture:!0}),window.addEventListener("focusin",fi,{capture:!0}),window.addEventListener("blur",Qo)}function vr(){window.removeEventListener("pointerdown",$r,{capture:!0}),window.removeEventListener("focusin",fi,{capture:!0}),window.removeEventListener("blur",Qo)}function wn(w,k){const C=k.getBoundingClientRect().height;if(!Number.isFinite(C)||C<=0)return;const D=Kn.value[w];D!==void 0&&Math.abs(D-C)<.5||(Kn.value={...Kn.value,[w]:C})}function ta(w,k){const C=lo.get(w);C&&C!==k&&gn&&gn.unobserve(C);const D=k instanceof HTMLElement?k:k&&"$el"in k&&k.$el instanceof HTMLElement?k.$el:null;if(D){lo.set(w,D),fo.set(D,w),wn(w,D),gn==null||gn.observe(D);return}C&&(gn==null||gn.unobserve(C)),lo.delete(w)}function Ea(w,k){if(w.button!==0||dn.value||Oe.value||We.value)return;const C=o.groups.findIndex(Rt=>Rt.projectName===k),D=lo.get(k);if(C<0||!D)return;const Ce=D.getBoundingClientRect(),st=wo(k)?0:Hm;Oe.value={projectName:k,fromIndex:C,startClientX:w.clientX,startClientY:w.clientY,pointerOffsetY:w.clientY-Ce.top,groupLeft:Ce.left,groupWidth:Ce.width,groupHeight:Ce.height,groupOuterHeight:Ce.height+st},w.preventDefault(),na()}function na(){window.addEventListener("mousemove",Zo),window.addEventListener("mouseup",oa),window.addEventListener("keydown",Ra)}function Ja(){window.removeEventListener("mousemove",Zo),window.removeEventListener("mouseup",oa),window.removeEventListener("keydown",Ra)}function Zo(w){Ze={clientX:w.clientX,clientY:w.clientY},Ll()}function oa(w){pi({clientX:w.clientX,clientY:w.clientY});const k=We.value;if(k&&Xn.value!==null){const C=o.groups.findIndex(D=>D.projectName===k.projectName);if(C>=0){const D=Xn.value;D!==C&&a("reorder-project",{projectName:k.projectName,toIndex:D})}}Qa({preserveToggleSuppression:!!k})}function Ra(w){w.key==="Escape"&&(!Oe.value&&!We.value||(w.preventDefault(),Qa()))}function Qa(w={}){Ft!==null&&(window.cancelAnimationFrame(Ft),Ft=null),Ze=null,Oe.value=null,We.value=null,w.preserveToggleSuppression||(Nt.value=""),Ja()}function Ll(){Ft===null&&(Ft=window.requestAnimationFrame(()=>{if(Ft=null,!Ze)return;const w=Ze;Ze=null,pi(w)}))}function pi(w){const k=Oe.value;if(!We.value&&k){const C=w.clientX-k.startClientX,D=w.clientY-k.startClientY;if(Math.hypot(C,D)<tI)return;$n(),Nt.value=k.projectName,We.value={projectName:k.projectName,fromIndex:k.fromIndex,pointerOffsetY:k.pointerOffsetY,groupLeft:k.groupLeft,groupWidth:k.groupWidth,groupHeight:k.groupHeight,groupOuterHeight:k.groupOuterHeight,ghostTop:w.clientY-k.pointerOffsetY,dropTargetIndexFull:null}}We.value&&xs(w)}function xs(w){const k=We.value;if(!k)return;if(k.ghostTop=w.clientY-k.pointerOffsetY,!jr(w)){k.dropTargetIndexFull=null;return}const C=w.clientY,D=me.value;if(!D){k.dropTargetIndexFull=null;return}const Ce=D.getBoundingClientRect(),st=new Map(o.groups.map((Nn,bn)=>[Nn.projectName,bn])),Rt=o.groups.map(Nn=>Nn.projectName).filter(Nn=>Nn!==k.projectName);let $o=0,Kt=o.groups.length;for(const Nn of Rt){const bn=st.get(Nn);if(bn===void 0)continue;const tr=Un(Nn),Nr=Ce.top+$o+tr/2;if(C<Nr){Kt=bn;break}$o+=tr}k.dropTargetIndexFull=Kt}function jr(w){const k=me.value;if(!k)return!1;const C=k.getBoundingClientRect(),D=w.clientX>=C.left&&w.clientX<=C.right,Ce=w.clientY>=C.top-32&&w.clientY<=C.bottom+32;return D&&Ce}function Lr(w){var k;return((k=We.value)==null?void 0:k.projectName)===w}function ra(w){const k=We.value,C=Io.value[w]??0,D=Ae.value?Jn.value.get(Ae.value)??"":"",Ce=xe.value===w||D===w;return!k||k.projectName!==w?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Ce?"40":"1",transform:`translate3d(0, ${C}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${k.groupLeft}px`,width:`${k.groupWidth}px`,height:`${k.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${k.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Xa(w){return Qn.value.get(w.projectName)??[]}function Gi(w){if(dn.value)return Xa(w);if(wo(w.projectName))return[];const k=Xa(w);return Er(w.projectName)?k:k.slice(0,10)}function Jt(w){return dn.value?!1:!wo(w.projectName)&&Xa(w).length>10}function oo(w){return Xa(w).length>0}function xn(w){var k;return!!w.pendingRequestState||w.inProgress||w.unread||((k=w.externalSession)==null?void 0:k.active)===!0}function As(w){return w.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function er(w){var k;return((k=w.externalSession)==null?void 0:k.active)===!0?"external":w.pendingRequestState==="approval"?"awaiting-approval":w.pendingRequestState==="response"?"awaiting-response":w.inProgress?"working":w.unread?"unread":"idle"}nt(()=>o.groups.map(w=>w.projectName),w=>{var Ce,st;const k=((Ce=We.value)==null?void 0:Ce.projectName)??((st=Oe.value)==null?void 0:st.projectName)??"";k&&!o.groups.some(Rt=>Rt.projectName===k)&&Qa();const C=new Set(w),D=Object.fromEntries(Object.entries(Kn.value).filter(([Rt])=>C.has(Rt)));Object.keys(D).length!==Object.keys(Kn.value).length&&(Kn.value=D)}),nt(()=>{const w=xe.value;return w?o.projectGitRepoByName[w]:void 0},()=>{const w=xe.value;w&&Wt(()=>{xe.value===w&&Ka(w)})});const Za=X(()=>Qt.value||xe.value!==""||Ae.value!=="");return nt(Za,w=>{if(w){Xo();return}vr()}),nt(Ae,w=>{if(!w){Ln();return}Mr(),Wt(()=>{Jo(w)})}),qi(()=>{for(const w of lo.values())gn==null||gn.unobserve(w);lo.clear(),co.clear(),Ln(),vr(),Qa()}),(w,k)=>(S(),I("section",{class:Ke(["thread-tree-root",{"chats-first":we.value}])},[$t.value.length>0?(S(),I("section",hA,[Ie(Ws,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":V.value,onClick:zn},{left:yt(()=>[V.value?(S(),tt(Js,{key:1,class:"thread-icon"})):(S(),tt(mu,{key:0,class:"thread-icon"}))]),default:yt(()=>[p("span",mA,T(g(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),V.value?(S(),I("ul",vA,[(S(!0),I(ze,null,_t($t.value,C=>(S(),tt(vu,{key:C.id,thread:C,selected:C.id===e.selectedThreadId,pinned:Wo(C.id),"menu-open":Pe(C.id),"show-status-indicator":xn(C),"thread-state":er(C),"inline-delete-confirming":Qr(C.id),"automation-count":ur(C.id),"automation-tooltip":sn(C.id),"request-label":As(C),"relative-time":Sr(C),"delete-label":g(r)("Delete thread"),"confirm-delete-label":g(r)("Confirm delete"),"confirm-label":g(r)("Confirm"),"worktree-label":g(r)("Worktree thread"),"set-menu-wrap-ref":D=>mr(C.id,D),onSelect:D=>cr(C.id),onInlineDelete:D=>Gn(C.id),onMenuToggle:D=>qt(C.id),onRowLeave:D=>ne(C.id,D),onRowContextmenu:D=>pn(D,C.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))])):ee("",!0)])):ee("",!0),p("section",gA,[Ie(Ws,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":K.value,onClick:po},{left:yt(()=>[K.value?(S(),tt(Js,{key:1,class:"thread-icon"})):(S(),tt(mu,{key:0,class:"thread-icon"}))]),right:yt(()=>[p("div",{ref_key:"organizeMenuWrapRef",ref:za,class:"organize-menu-wrap"},[p("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Qt.value,"aria-label":g(r)("Organize threads"),title:g(r)("Organize threads"),onClick:lt(Va,["stop"])},[Ie(Bf,{class:"thread-icon"})],8,wA),Qt.value?(S(),I("div",{key:0,class:"organize-menu-panel",onClick:k[4]||(k[4]=lt(()=>{},["stop"]))},[p("p",bA,T(g(r)("Organize")),1),p("button",{class:"organize-menu-item","data-active":ut.value==="project",type:"button",onClick:k[0]||(k[0]=C=>ci("project"))},[p("span",null,T(g(r)("By project")),1),ut.value==="project"?(S(),I("span",CA,"✓")):ee("",!0)],8,kA),p("button",{class:"organize-menu-item","data-active":ut.value==="chronological",type:"button",onClick:k[1]||(k[1]=C=>ci("chronological"))},[p("span",null,T(g(r)("Chronological list")),1),ut.value==="chronological"?(S(),I("span",SA,"✓")):ee("",!0)],8,TA),p("button",{class:"organize-menu-item","data-active":we.value,type:"button",onClick:ui},[p("span",null,T(g(r)("Chats first")),1),we.value?(S(),I("span",xA,"✓")):ee("",!0)],8,_A),k[31]||(k[31]=p("div",{class:"organize-menu-separator"},null,-1)),p("p",AA,T(g(r)("Sort by")),1),p("button",{class:"organize-menu-item","data-active":$e.value==="created",type:"button",onClick:k[2]||(k[2]=C=>Vi("created"))},[p("span",null,T(g(r)("Created")),1),$e.value==="created"?(S(),I("span",IA,"✓")):ee("",!0)],8,PA),p("button",{class:"organize-menu-item","data-active":$e.value==="updated",type:"button",onClick:k[3]||(k[3]=C=>Vi("updated"))},[p("span",null,T(g(r)("Updated")),1),$e.value==="updated"?(S(),I("span",RA,"✓")):ee("",!0)],8,EA),k[32]||(k[32]=p("div",{class:"organize-menu-separator"},null,-1)),p("button",{class:"organize-menu-item",type:"button",onClick:B},[p("span",null,T(g(r)("Recycle bin")),1)])])):ee("",!0)],512)]),default:yt(()=>[p("span",yA,T(g(r)("Projects")),1)]),_:1},8,["aria-expanded"]),K.value?(S(),I(ze,{key:0},[Ee.value?(S(),I("p",MA,T(Ee.value),1)):ee("",!0),dn.value&&ba.value.length===0?(S(),I("p",$A,T(g(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(S(),I("p",jA,T(g(r)("Loading threads...")),1)):Ha.value?(S(),I("ul",LA,[(S(!0),I(ze,null,_t(Dn.value,C=>(S(),tt(vu,{key:C.id,thread:C,selected:C.id===e.selectedThreadId,pinned:Wo(C.id),"menu-open":Pe(C.id),"show-status-indicator":xn(C),"thread-state":er(C),"inline-delete-confirming":Qr(C.id),"automation-count":ur(C.id),"automation-tooltip":sn(C.id),"request-label":As(C),"relative-time":Sr(C),"delete-label":g(r)("Delete thread"),"confirm-delete-label":g(r)("Confirm delete"),"confirm-label":g(r)("Confirm"),"worktree-label":g(r)("Worktree thread"),"set-menu-wrap-ref":D=>mr(C.id,D),onSelect:D=>cr(C.id),onInlineDelete:D=>Gn(C.id),onMenuToggle:D=>qt(C.id),onRowLeave:D=>ne(C.id,D),onRowContextmenu:D=>pn(D,C.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))])):(S(),I("div",{key:4,ref_key:"groupsContainerRef",ref:me,class:"thread-tree-groups",style:kr(ho.value)},[(S(!0),I(ze,null,_t(ba.value,C=>(S(),I("article",{key:C.projectName,ref_for:!0,ref:D=>ta(C.projectName,D),class:"project-group","data-project-name":C.projectName,"data-expanded":!wo(C.projectName),"data-dragging":Lr(C.projectName),style:kr(ra(C.projectName))},[Ie(Ws,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:D=>ke(C.projectName),onContextmenu:lt(D=>di(C.projectName),["prevent"]),onKeydown:[D=>Ga(D,C.projectName),An(lt(D=>ke(C.projectName),["prevent"]),["enter"]),An(lt(D=>ke(C.projectName),["prevent"]),["space"])]},{left:yt(()=>[p("span",OA,[p("span",DA,[wo(C.projectName)?(S(),tt(_p,{key:0,class:"thread-icon"})):(S(),tt(o1,{key:1,class:"thread-icon"}))]),p("span",FA,[wo(C.projectName)?(S(),tt(mu,{key:0,class:"thread-icon"})):(S(),tt(Js,{key:1,class:"thread-icon"}))])])]),right:yt(()=>[p("div",HA,[p("div",{ref_for:!0,ref:D=>Pa(C.projectName,D),class:"project-menu-wrap"},[p("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:lt(D=>$l(C.projectName),["stop"])},[Ie(Bf,{class:"thread-icon"})],8,WA),_a(C.projectName)?(S(),I("div",{key:0,class:"project-menu-panel","data-open-direction":Ye.value[C.projectName]??"down",onClick:k[6]||(k[6]=lt(()=>{},["stop"]))},[ct.value==="actions"?(S(),I(ze,{key:0},[p("button",{class:"project-menu-item",type:"button",onClick:D=>pr(C.projectName)},T(g(r)("Browse files")),9,GA),p("button",{class:"project-menu-item",type:"button",onClick:D=>Zr(C.projectName)},T(g(r)("Export Project")),9,KA),p("button",{class:"project-menu-item",type:"button",onClick:D=>ri(C.projectName)},T(Ct(C.projectName)?g(r)("Manage automations…"):g(r)("Add automation…")),9,YA),e.projectGitRepoByName[C.projectName]?(S(),I("button",{key:0,class:"project-menu-item",type:"button",onClick:D=>xa(C.projectName)},T(g(r)("New worktree")),9,JA)):ee("",!0),p("button",{class:"project-menu-item",type:"button",onClick:D=>Xr(C)},T(g(r)("Rename project")),9,QA),p("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:D=>Aa(C.projectName)},T(g(r)("Remove")),9,XA)],64)):(S(),I(ze,{key:1},[p("label",ZA,T(g(r)("Project name")),1),Lt(p("input",{"onUpdate:modelValue":k[5]||(k[5]=D=>Qe.value=D),class:"project-menu-input",type:"text",onInput:D=>hr(C.projectName)},null,40,eP),[[an,Qe.value]])],64))],8,VA)):ee("",!0)],512),p("button",{class:"thread-start-button",type:"button","aria-label":Eo(C.projectName),title:Eo(C.projectName),onClick:lt(D=>Ar(C.projectName),["stop"])},[Ie(Bi,{class:"thread-icon"})],8,tP)])]),default:yt(()=>[p("span",{class:"project-main-button","data-dragging-handle":Lr(C.projectName),onMousedown:lt(D=>Ea(D,C.projectName),["left"])},[p("span",{class:"project-title",title:Wi(C.projectName)},T(li(C)),9,BA),Ct(C.projectName)?(S(),I("span",{key:0,class:"thread-row-automation-chip",title:mo(C.projectName)},[Ie(Ys,{class:"thread-row-automation-icon"}),Fn(C.projectName)>1?(S(),I("span",zA,T(Fn(C.projectName)),1)):ee("",!0)],8,qA)):ee("",!0)],40,UA)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),oo(C)?(S(),I("ul",nP,[(S(!0),I(ze,null,_t(Gi(C),D=>(S(),tt(vu,{key:D.id,thread:D,selected:D.id===e.selectedThreadId,pinned:Wo(D.id),"menu-open":Pe(D.id),"show-status-indicator":xn(D),"thread-state":er(D),"inline-delete-confirming":Qr(D.id),"automation-count":ur(D.id),"automation-tooltip":sn(D.id),"request-label":As(D),"relative-time":Sr(D),"delete-label":g(r)("Delete thread"),"confirm-delete-label":g(r)("Confirm delete"),"confirm-label":g(r)("Confirm"),"worktree-label":g(r)("Worktree thread"),"set-menu-wrap-ref":Ce=>mr(D.id,Ce),onSelect:Ce=>cr(D.id),onInlineDelete:Ce=>Gn(D.id),onMenuToggle:Ce=>qt(D.id),onRowLeave:Ce=>ne(D.id,Ce),onRowContextmenu:Ce=>pn(Ce,D.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))])):(S(),tt(Ws,{key:1,as:"p",class:"project-empty-row"},{left:yt(()=>[...k[33]||(k[33]=[p("span",{class:"project-empty-spacer"},null,-1)])]),default:yt(()=>[p("span",oP,T(g(r)("No threads")),1)]),_:1})),Jt(C)?(S(),tt(Ws,{key:2,class:"thread-show-more-row"},{left:yt(()=>[...k[34]||(k[34]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:yt(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:D=>Rr(C.projectName)},T(Er(C.projectName)?"Show less":"Show more"),9,rP)]),_:2},1024)):ee("",!0)],12,NA))),128))],4))],64)):ee("",!0)]),p("section",aP,[Ie(Ws,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":ye.value,onClick:Hn},{left:yt(()=>[ye.value?(S(),tt(Js,{key:1,class:"thread-icon"})):(S(),tt(mu,{key:0,class:"thread-icon"}))]),right:yt(()=>[p("div",iP,[p("button",{class:"chats-section-action",type:"button","aria-label":g(r)("New chat"),title:g(r)("New chat"),onClick:k[7]||(k[7]=lt(C=>w.$emit("start-new-chat"),["stop"]))},[Ie(Bi,{class:"thread-icon"})],8,lP)])]),default:yt(()=>[p("span",sP,T(g(r)("Chats")),1)]),_:1},8,["aria-expanded"]),ye.value&&In.value.length===0?(S(),I("p",cP,T(g(r)("No chats")),1)):ye.value?(S(),I("ul",uP,[(S(!0),I(ze,null,_t(Gr.value,C=>(S(),tt(vu,{key:C.id,thread:C,selected:C.id===e.selectedThreadId,pinned:Wo(C.id),"menu-open":Pe(C.id),"show-status-indicator":xn(C),"thread-state":er(C),"inline-delete-confirming":Qr(C.id),"automation-count":ur(C.id),"automation-tooltip":sn(C.id),"request-label":As(C),"relative-time":Sr(C),"delete-label":g(r)("Delete thread"),"confirm-delete-label":g(r)("Confirm delete"),"confirm-label":g(r)("Confirm"),"worktree-label":g(r)("Worktree thread"),"set-menu-wrap-ref":D=>mr(C.id,D),onSelect:D=>cr(C.id),onInlineDelete:D=>Gn(C.id),onMenuToggle:D=>qt(C.id),onRowLeave:D=>ne(C.id,D),onRowContextmenu:D=>pn(D,C.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))])):ee("",!0),ye.value&&Ao.value?(S(),tt(Ws,{key:2,class:"thread-show-more-row"},{left:yt(()=>[...k[35]||(k[35]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:yt(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:qe},T(_e.value?"Show less":"Show more"),1)]),_:1})):ee("",!0)]),(S(),tt(Xs,{to:"body"},[Pt.value?(S(),I("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Cr,class:"thread-menu-panel thread-menu-panel-fixed",style:kr(At.value),"data-open-direction":jl(Pt.value.id),onClick:k[17]||(k[17]=lt(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:k[8]||(k[8]=C=>_n(Pt.value.id))},T(_r(Pt.value.id)?g(r)("Manage automations…"):g(r)("Add automation…")),1),p("button",{class:"thread-menu-item",type:"button",onClick:k[9]||(k[9]=C=>go(Pt.value.id))},T(g(r)("Browse files")),1),p("button",{class:"thread-menu-item",type:"button",onClick:k[10]||(k[10]=C=>M(Pt.value.id))},T(g(r)("Export Project")),1),p("button",{class:"thread-menu-item",type:"button",onClick:k[11]||(k[11]=C=>F(Pt.value.id))},T(g(r)("Copy path")),1),p("button",{class:"thread-menu-item",type:"button",disabled:Pt.value.id!==e.selectedThreadId,title:Pt.value.id===e.selectedThreadId?g(r)("Copy chat"):g(r)("Open this chat before copying"),onClick:k[12]||(k[12]=C=>Jr(Pt.value.id))},T(g(r)("Copy chat")),9,fP),p("button",{class:"thread-menu-item",type:"button",onClick:k[13]||(k[13]=C=>Ko(Pt.value.id))},T(g(r)("Create chat fork")),1),p("button",{class:"thread-menu-item",type:"button",onClick:k[14]||(k[14]=C=>Ca(Pt.value.id))},T(Wo(Pt.value.id)?g(r)("Unpin thread"):g(r)("Pin thread")),1),p("button",{class:"thread-menu-item",type:"button",onClick:k[15]||(k[15]=C=>Xt(Pt.value.id,Pt.value.title))},T(g(r)("Rename thread")),1),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:k[16]||(k[16]=C=>yo(Pt.value.id,Pt.value.title))},T(g(r)("Delete thread")),1)],12,dP)):ee("",!0)])),Ie(df,{open:et.value,title:g(r)("Rename thread"),subtitle:g(r)("Make it short and recognizable."),onClose:jt},{footer:yt(()=>[p("button",{class:"rename-thread-button",type:"button",onClick:jt},T(g(r)("Cancel")),1),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Pr},T(g(r)("Save")),1)]),default:yt(()=>[Lt(p("input",{ref_key:"renameThreadInputRef",ref:kt,"onUpdate:modelValue":k[18]||(k[18]=C=>mt.value=C),class:"rename-thread-input",type:"text",placeholder:g(r)("Add title..."),onKeydown:An(lt(Pr,["prevent"]),["enter"])},null,40,pP),[[an,mt.value]])]),_:1},8,["open","title","subtitle"]),Ie(df,{open:at.value,title:Yr.value?g(r)("Archive chat and remove automations?"):g(r)("Delete thread?"),subtitle:ka.value,onClose:Ta},{footer:yt(()=>[p("button",{class:"rename-thread-button",type:"button",onClick:Ta},T(g(r)("Cancel")),1),p("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ml},T(Yr.value?g(r)("Archive and remove"):g(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Ie(df,{open:_.value,title:g(r)("Recycle bin"),subtitle:g(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:k[19]||(k[19]=C=>_.value=!1)},{default:yt(()=>[g(l).length===0?(S(),I("div",hP,T(g(r)("Recycle bin is empty.")),1)):(S(),I("ul",mP,[(S(!0),I(ze,null,_t(g(l),C=>(S(),I("li",{key:C.id,class:"recycle-bin-item"},[p("div",vP,[p("span",gP,T(C.title),1),C.projectName?(S(),I("span",yP,T(C.projectName),1)):ee("",!0),p("span",wP,T(oi(C.archivedAtIso)),1)]),p("div",bP,[p("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:j.value===C.id,onClick:D=>J(C.id)},T(j.value===C.id?g(r)("Restoring…"):g(r)("Restore")),9,kP),p("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:D=>g(v)(C.id)},T(g(r)("Delete permanently")),9,CP)])]))),128))])),P.value?(S(),I("p",TP,T(P.value),1)):ee("",!0)]),_:1},8,["open","title","subtitle"]),(S(),tt(Xs,{to:"body"},[Be.value?(S(),I("div",{key:0,class:"rename-thread-overlay",onClick:lt(eo,["self"])},[p("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":$.value==="project"?g(r)("Project automation"):g(r)("Thread automation")},[p("h3",_P,T(ie.value==="edit"?g(r)("Edit automation"):g(r)("Add automation")),1),p("p",xP,T(It.value),1),re.value&&ie.value==="create"?(S(),I("div",AP,[k[36]||(k[36]=p("span",{class:"automation-thread-label"},"Target",-1)),p("div",PP,[p("button",{class:Ke(["automation-target-mode",{"is-active":Se.value==="thread"}]),type:"button",onClick:k[20]||(k[20]=C=>ln("thread"))}," Existing chat ",2),p("button",{class:Ke(["automation-target-mode",{"is-active":Se.value==="project"}]),type:"button",onClick:k[21]||(k[21]=C=>ln("project"))}," Project ",2)]),p("div",IP,[Ie(or,{modelValue:be.value,"onUpdate:modelValue":k[22]||(k[22]=C=>be.value=C),class:"automation-thread-dropdown",options:H.value,placeholder:Se.value==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":Se.value==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ee("",!0),rt.value.length>0?(S(),I("div",{key:1,class:"automation-thread-list","aria-label":$.value==="project"?"Project automations":"Thread automations"},[(S(!0),I(ze,null,_t(rt.value,C=>(S(),I("button",{key:C.id,class:Ke(["automation-thread-list-item",{"is-active":C.id===ue.value}]),type:"button",onClick:D=>Ro(C.id)},[p("span",null,T(C.name),1),p("small",null,T(C.status==="PAUSED"?"Paused":"Active"),1)],10,RP))),128)),p("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:hn},T(g(r)("Add another automation")),1)],8,EP)):ee("",!0),p("label",MP,[p("span",$P,T(g(r)("Name")),1),Lt(p("input",{"onUpdate:modelValue":k[23]||(k[23]=C=>Me.value.name=C),class:"rename-thread-input",type:"text",placeholder:g(r)("Automation name")},null,8,jP),[[an,Me.value.name]])]),p("label",LP,[p("span",NP,T(g(r)("Prompt")),1),Lt(p("textarea",{"onUpdate:modelValue":k[24]||(k[24]=C=>Me.value.prompt=C),class:"automation-thread-textarea",rows:"6",placeholder:g(r)("Describe what the automation should do")},null,8,OP),[[an,Me.value.prompt]])]),p("div",DP,[p("span",FP,T(g(r)("Schedule")),1),p("div",UP,[p("button",{class:Ke(["automation-schedule-mode",{"is-active":Ve.value.mode==="daily"}]),type:"button",onClick:k[25]||(k[25]=C=>Go("daily"))},T(g(r)("Daily")),3),p("button",{class:Ke(["automation-schedule-mode",{"is-active":Ve.value.mode==="interval"}]),type:"button",onClick:k[26]||(k[26]=C=>Go("interval"))},T(g(r)("Interval")),3),p("button",{class:Ke(["automation-schedule-mode",{"is-active":Ve.value.mode==="advanced"}]),type:"button",onClick:k[27]||(k[27]=C=>Go("advanced"))}," RRULE ",2)]),Ve.value.mode==="daily"?(S(),I("div",BP,[p("span",qP,T(g(r)("Run every day at")),1),Lt(p("input",{"onUpdate:modelValue":k[28]||(k[28]=C=>Ve.value.dailyTime=C),class:"automation-schedule-time",type:"time",onInput:Vn},null,544),[[an,Ve.value.dailyTime]])])):Ve.value.mode==="interval"?(S(),I("div",zP,[p("span",HP,T(g(r)("Run every")),1),Lt(p("input",{"onUpdate:modelValue":k[29]||(k[29]=C=>Ve.value.interval=C),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:Vn},null,544),[[an,Ve.value.interval,void 0,{number:!0}]]),Ie(or,{class:"automation-schedule-unit-dropdown","model-value":Ve.value.intervalUnit,options:W,placeholder:g(r)("Unit"),"onUpdate:modelValue":Zn},null,8,["model-value","placeholder"])])):ee("",!0),Ve.value.mode==="advanced"?Lt((S(),I("input",{key:2,"onUpdate:modelValue":k[30]||(k[30]=C=>Me.value.rrule=C),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:xr},null,544)),[[an,Me.value.rrule]]):ee("",!0),p("p",WP,T(gt.value),1)]),p("div",VP,[p("span",GP,T(g(r)("Status")),1),Ie(or,{class:"automation-thread-dropdown","model-value":Me.value.status,options:Y.value,placeholder:g(r)("Status"),"onUpdate:modelValue":vo},null,8,["model-value","options","placeholder"])]),pe.value?(S(),I("p",KP,T(pe.value),1)):se.value?(S(),I("p",YP,T(se.value),1)):ee("",!0),p("div",JP,[ie.value==="edit"&&$.value==="thread"?(S(),I("button",{key:0,class:"rename-thread-button",type:"button",disabled:ge.value||Fe.value,onClick:Ts},T(Fe.value?g(r)("Running…"):g(r)("Run now")),9,QP)):ee("",!0),ie.value==="edit"?(S(),I("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:ge.value||Fe.value,onClick:ii},T(g(r)("Remove")),9,XP)):ee("",!0),p("button",{class:"rename-thread-button",type:"button",disabled:ge.value||Fe.value,onClick:eo},T(g(r)("Cancel")),9,ZP),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:ge.value||Fe.value,onClick:Zt},T(ge.value?g(r)("Saving…"):g(r)("Save")),9,eI)])],8,SP)])):ee("",!0)]))],2))}}),oI=bt(nI,[["__scopeId","data-v-2f390881"]]),rI={class:"content-header"},aI=["title"],sI={class:"content-actions"},iI=tn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(S(),I("header",rI,[p("div",{class:Ke(["content-leading",{"is-accent":e.accent}])},[rr(t.$slots,"leading",{},void 0)],2),p("h1",{class:Ke(["content-title",{"is-accent":e.accent}]),title:e.title},T(e.title),11,aI),p("div",sI,[rr(t.$slots,"actions",{},void 0)])]))}}),lI=bt(iI,[["__scopeId","data-v-61739409"]]),Jm=.0025,ff=3,Qm=2,cI=256;function uI(e){var je;const t=A("idle"),n=A(typeof navigator<"u"&&!!((je=navigator.mediaDevices)!=null&&je.getUserMedia)),o=A(0),r=A(null);let s=null,a=null,l=[],d=null,h=null,v=null,y=null,_=[],P=!1,j=!1,B=null;function J(){B&&(B.abort(),B=null),t.value==="transcribing"&&(t.value="idle")}function ce(){const fe=r.value;if(!fe||typeof window>"u")return;const Te=fe.getContext("2d");if(!Te)return;const xe=Math.max(1,Math.floor(fe.clientWidth)),Ae=Math.max(1,Math.floor(fe.clientHeight||36)),Ue=window.devicePixelRatio||1,Ye=Math.max(1,Math.floor(xe*Ue)),He=Math.max(1,Math.floor(Ae*Ue));(fe.width!==Ye||fe.height!==He)&&(fe.width=Ye,fe.height=He),Te.setTransform(Ue,0,0,Ue,0,0),Te.clearRect(0,0,xe,Ae);const At=Math.max(12,Math.floor(xe/(ff+Qm))),ct=_.slice(-At),Qe=Math.max(0,At-ct.length),et=Ae/2,ft=getComputedStyle(fe).color||"#000000";for(let mt=0;mt<At;mt+=1){const kt=ct[mt-Qe]??0,ae=Math.max(.08,Math.min(1,kt*18))*et,te=mt*(ff+Qm);Te.globalAlpha=kt<=Jm?.35:1,Te.fillStyle=ft,Te.fillRect(te,et-ae,ff,ae*2)}Te.globalAlpha=1}function U(){_=[],o.value=0,ce()}function V(){v&&(v.disconnect(),v.onaudioprocess=null,v=null),h&&(h.disconnect(),h=null),d&&(d.close(),d=null),y=null}function K(fe){if(typeof window>"u")return;const Te=window.webkitAudioContext,xe=window.AudioContext??Te;xe&&(V(),U(),d=new xe,h=d.createMediaStreamSource(fe),v=d.createScriptProcessor(2048,1,1),y=performance.now(),v.onaudioprocess=Ae=>{const Ue=Ae.inputBuffer.getChannelData(0);let Ye=0;for(let He=0;He<Ue.length;He+=1){const At=Math.abs(Ue[He]??0);Ye+=At<Jm?0:At}_.push(Ye/Ue.length),_.length>cI&&_.shift(),y!==null&&(o.value=Math.max(0,performance.now()-y)),ce()},h.connect(v),v.connect(d.destination),ce())}async function ye(){var fe;if(t.value==="transcribing"&&J(),!(t.value!=="idle"||!n.value||P)){P=!0,j=!1;try{a=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],s=new MediaRecorder(a),s.ondataavailable=Te=>{Te.data.size>0&&l.push(Te.data)},s.onstop=()=>{var Ae;const Te=l,xe=(s==null?void 0:s.mimeType)||((Ae=Te[0])==null?void 0:Ae.type)||"audio/webm";de(),$e(Te,xe)},K(a),s.start(250),t.value="recording",j&&_e()}catch(Te){de(),t.value="idle",(fe=e.onError)==null||fe.call(e,Te)}finally{P=!1}}}function _e(){if(P&&t.value==="idle"){j=!0;return}if(!(t.value!=="recording"||!s)&&s.state!=="inactive"){t.value="transcribing";try{s.requestData()}catch{}s.stop()}}function we(){j=!1,J(),de(),t.value="idle"}async function $e(fe,Te){var Ue,Ye,He,At,ct;if(fe.length===0){(Ue=e.onEmpty)==null||Ue.call(e),t.value="idle";return}const xe=new Blob(fe,{type:Te});t.value="transcribing";let Ae=null;try{const Qe=Te.split(/[/;]/)[1]??"webm",et=new FormData;et.append("file",xe,`codex.${Qe}`);const ft=((Ye=e.getLanguage)==null?void 0:Ye.call(e).trim())??"";ft&&ft.toLowerCase()!=="auto"&&et.append("language",ft),Ae=new AbortController,B=Ae;const mt=await fetch("/codex-api/transcribe",{method:"POST",body:et,signal:Ae.signal}),kt=await mt.text();let at=null;try{at=kt.trim()?JSON.parse(kt):null}catch{at=null}if(!mt.ok){const te=(He=at==null?void 0:at.error)==null?void 0:He.trim(),oe=kt.trim();throw new Error(te||oe||`Transcription failed: ${mt.status}`)}const ae=((at==null?void 0:at.text)??"").trim();ae.length>0?e.onTranscript(ae):(At=e.onEmpty)==null||At.call(e)}catch(Qe){if(Qe instanceof DOMException&&Qe.name==="AbortError")return;(ct=e.onError)==null||ct.call(e,Qe)}finally{Ae&&B===Ae&&(B=null),t.value==="transcribing"&&(t.value="idle")}}function de(){V(),U(),s&&(s.ondataavailable=null,s.onstop=null,s=null),a&&(a.getTracks().forEach(fe=>fe.stop()),a=null),l=[]}qi(()=>{we()});function Le(){if(t.value==="recording"){_e();return}(t.value==="idle"||t.value==="transcribing")&&ye()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:ye,stopRecording:_e,toggleRecording:Le,cancel:we}}const dI={},fI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function pI(e,t){return S(),I("svg",fI,[...t[0]||(t[0]=[p("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 hI=bt(dI,[["render",pI]]),mI={},vI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function gI(e,t){return S(),I("svg",vI,[...t[0]||(t[0]=[p("path",{d:"M4 8V4h4"},null,-1),p("path",{d:"M20 8V4h-4"},null,-1),p("path",{d:"M4 16v4h4"},null,-1),p("path",{d:"M20 16v4h-4"},null,-1)])])}const yI=bt(mI,[["render",gI]]),wI={},bI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function kI(e,t){return S(),I("svg",bI,[...t[0]||(t[0]=[p("path",{d:"M8 4v4H4"},null,-1),p("path",{d:"M16 4v4h4"},null,-1),p("path",{d:"M8 20v-4H4"},null,-1),p("path",{d:"M16 20v-4h4"},null,-1)])])}const CI=bt(wI,[["render",kI]]),TI={},SI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function _I(e,t){return S(),I("svg",SI,[...t[0]||(t[0]=[p("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),p("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 xI=bt(TI,[["render",_I]]),AI=["aria-label"],PI=tn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,s=A(null),a=A(null),l=X(()=>o.open),d=X(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");nt(l,async y=>{var _;y&&(await Wt(),(_=a.value)==null||_.focus())});function h(){r("update:open",!o.open)}function v(y){var ce,U,V;if(y.key==="Escape"){r("update:open",!1);return}const _=a.value;if(!_)return;const P=Array.from(_.querySelectorAll("button")).filter(K=>!K.disabled&&K.offsetParent!==null);if(P.length===0)return;if(y.key==="Home"){y.preventDefault(),(ce=P[0])==null||ce.focus();return}if(y.key==="End"){y.preventDefault(),(U=P[P.length-1])==null||U.focus();return}if(y.key!=="ArrowDown"&&y.key!=="ArrowUp")return;y.preventDefault();let j=P.findIndex(K=>K===document.activeElement);j<0&&(j=y.key==="ArrowDown"?-1:0);const B=y.key==="ArrowDown"?1:-1,J=(j+B+P.length)%P.length;(V=P[J])==null||V.focus()}return t({root:s}),(y,_)=>(S(),I("div",{ref_key:"rootRef",ref:s,class:Ke(["composer-popover-anchor",{"is-align-end":e.align==="end","is-align-center":e.align==="center"}])},[rr(y.$slots,"trigger",{toggle:h,isOpen:l.value},void 0),Ie(Mc,{name:"composer-popover"},{default:yt(()=>[l.value?(S(),I("div",{key:0,ref_key:"panelRef",ref:a,class:Ke(["composer-popover-panel",[d.value,e.panelClass]]),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:v},[rr(y.$slots,"default",{},void 0,!0)],42,AI)):ee("",!0)]),_:3})],2))}}),Ku=bt(PI,[["__scopeId","data-v-bdd45c16"]]),II=["aria-label"],EI={class:"composer-popover-group-label"},RI=["aria-selected","onMousedown"],MI={class:"thread-composer-slash-body"},$I={class:"thread-composer-slash-name"},jI={class:"thread-composer-slash-desc"},LI={class:"thread-composer-slash-kind"},NI={class:"composer-popover-group-label composer-popover-group-label--skills"},OI=["aria-selected","onMousedown"],DI=["aria-label","title"],FI={class:"thread-composer-slash-body thread-composer-slash-body--skill"},UI={class:"thread-composer-slash-skill-name"},BI={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},qI=tn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io(),s=A(null),a=X(()=>n.commands.filter(y=>y.group!=="skill")),l=X(()=>n.commands.filter(y=>y.group==="skill"));nt(()=>n.highlightedIndex,async()=>{var y,_;await Wt(),(_=(y=s.value)==null?void 0:y.querySelector(".is-active"))==null||_.scrollIntoView({block:"nearest"})});function d(y){return r(y==="rpc"?"Action":y==="text"?"Prompt":y==="skill"?"Skill":"Local")}function h(y){return y==="system"?"S":y==="repo"?"R":y==="plugin"?"P":"U"}function v(y){return r(y==="system"?"System":y==="repo"?"Repo":y==="plugin"?"Plugin":"User")}return(y,_)=>(S(),I("div",{ref_key:"rootRef",ref:s,class:"composer-popover",role:"listbox","aria-label":g(r)("Commands")},[a.value.length>0?(S(),I(ze,{key:0},[p("div",EI,T(g(r)("Commands")),1),(S(!0),I(ze,null,_t(a.value,(P,j)=>(S(),I("button",{key:P.id,class:Ke(["thread-composer-slash-row",{"is-active":j===e.highlightedIndex}]),type:"button",role:"option","aria-selected":j===e.highlightedIndex,onMousedown:lt(B=>o("select",P),["prevent"])},[_[0]||(_[0]=p("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),p("span",MI,[p("span",$I,T(P.id),1),p("span",jI,T(g(r)(P.description)),1)]),p("span",LI,T(d(P.kind)),1)],42,RI))),128))],64)):ee("",!0),l.value.length>0?(S(),I(ze,{key:1},[p("div",NI,T(g(r)("Skills")),1),(S(!0),I(ze,null,_t(l.value,(P,j)=>(S(),I("button",{key:P.skillPath||P.id,class:Ke(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":a.value.length+j===e.highlightedIndex}]),type:"button",role:"option","aria-selected":a.value.length+j===e.highlightedIndex,onMousedown:lt(B=>o("select",P),["prevent"])},[p("span",{class:Ke(["thread-composer-slash-skill-icon",`is-${P.scope||"user"}`]),"aria-label":v(P.scope),title:v(P.scope)},T(h(P.scope)),11,DI),p("span",FI,[p("span",UI,T(P.displayName||P.id),1),p("span",BI,T(P.description),1)])],42,OI))),128))],64)):ee("",!0)],8,II))}}),zI=bt(qI,[["__scopeId","data-v-ca16aa11"]]),HI=["data-streaming"],WI=["aria-expanded"],VI={class:"thread-composer-plan-panel-title"},GI={key:0,class:"thread-composer-plan-panel-badge"},KI={class:"thread-composer-plan-panel-progress"},YI=["title"],JI=["data-status"],QI={class:"thread-composer-plan-panel-latest-text"},XI={class:"thread-composer-plan-panel-popover-content"},ZI={class:"thread-composer-plan-panel-popover-scroll"},eE={class:"thread-composer-plan-panel-popover-head"},tE={class:"thread-composer-plan-panel-title"},nE={class:"thread-composer-plan-panel-progress"},oE={key:0,class:"thread-composer-plan-panel-popover-section"},rE={class:"thread-composer-plan-panel-section-label"},aE=["title"],sE={class:"thread-composer-plan-panel-popover-section"},iE={class:"thread-composer-plan-panel-section-label"},lE={class:"thread-composer-plan-panel-steps"},cE=["data-status"],uE=["data-status"],dE=["title"],fE={class:"thread-composer-plan-panel-popover-footer"},pE=["disabled","data-state"],hE=tn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io(),s=A(!1),a=X(()=>{var _;return(((_=n.planPanel)==null?void 0:_.steps)??[]).filter(P=>P.status==="completed").length}),l=X(()=>{var _;const y=((_=n.planPanel)==null?void 0:_.steps)??[];if(y.length===0)return null;for(let P=y.length-1;P>=0;P-=1){const j=y[P];if(j.status==="inProgress")return j}return y[y.length-1]}),d=X(()=>{var j,B,J;const y=((B=(j=n.planPanel)==null?void 0:j.explanation)==null?void 0:B.trim())??"";if(!y)return"";const _=((J=y.split(/[。!?!?\n]/u)[0])==null?void 0:J.trim())??"";if(!_)return y;const P=80;return _.length>P?`${_.slice(0,P)}…`:_});function h(y){switch(y){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function v(){s.value=!1,o("implement-plan")}return(y,_)=>(S(),I("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Ie(Ku,{open:s.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":g(r)("Plan"),"onUpdate:open":_[1]||(_[1]=P=>s.value=P)},{trigger:yt(()=>{var P,j;return[p("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":s.value,onClick:_[0]||(_[0]=B=>s.value=!s.value)},[_[2]||(_[2]=p("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),p("span",VI,T(g(r)("Plan")),1),e.planPanel.streaming?(S(),I("span",GI,T(g(r)("Updating")),1)):ee("",!0),p("span",KI,T(a.value)+"/"+T(e.planPanel.steps.length),1),p("span",{class:"thread-composer-plan-panel-latest",title:((P=l.value)==null?void 0:P.step)??""},[l.value?(S(),I("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":l.value.status},T(h(l.value.status)),9,JI)):ee("",!0),p("span",QI,T(((j=l.value)==null?void 0:j.step)??""),1)],8,YI),Ie(Js,{class:"thread-composer-plan-panel-chevron"})],8,WI)]}),default:yt(()=>[p("div",XI,[p("div",ZI,[p("header",eE,[_[3]||(_[3]=p("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),p("span",tE,T(g(r)("Plan")),1),p("span",nE,T(a.value)+"/"+T(e.planPanel.steps.length),1)]),e.planPanel.explanation?(S(),I("section",oE,[p("p",rE,T(g(r)("Summary")),1),p("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},T(d.value),9,aE)])):ee("",!0),p("section",sE,[p("p",iE,T(g(r)("Steps"))+" ("+T(e.planPanel.steps.length)+")",1),p("ol",lE,[(S(!0),I(ze,null,_t(e.planPanel.steps,(P,j)=>(S(),I("li",{key:`composer-plan-${e.planPanel.id}-${j}`,class:"thread-composer-plan-panel-step","data-status":P.status},[p("span",{class:"thread-composer-plan-panel-step-status","data-status":P.status},T(h(P.status)),9,uE),p("span",{class:"thread-composer-plan-panel-step-text",title:P.step},T(P.step),9,dE)],8,cE))),128))])])]),p("footer",fE,[p("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:v},T(e.planPanel.implemented?g(r)("Plan executed"):e.planPanel.streaming?g(r)("Implementing…"):g(r)("Implement plan")),9,pE)])])]),_:1},8,["open","aria-label"])],8,HI))}}),mE=bt(hE,[["__scopeId","data-v-b1cbf479"]]),vE={key:0,class:"thread-composer-attachments"},gE=["src"],yE=["src","alt"],wE=["aria-label","disabled","onClick"],bE={key:1,class:"thread-composer-folder-chips"},kE=["title"],CE={class:"thread-composer-folder-chip-meta"},TE=["aria-label","disabled","onClick"],SE={key:2,class:"thread-composer-file-chips"},_E=["title"],xE=["aria-label","disabled","onClick"],AE={key:3,class:"thread-composer-skill-chips"},PE=["title","aria-label","onClick"],IE=["aria-label","onClick"],EE=tn({__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(d){const h=d.trim();return h?!!(/^video\/|^data:video\//i.test(h)||o.test(h)):!1}function s(d){return d.total<=0?0:Math.round(d.processed/d.total*100)}function a(d){const h=d.trim();return h?h.endsWith("/SKILL.md")?h:`${h.replace(/\/+$/,"")}/SKILL.md`:""}function l(d){const h=a(d.path);!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}return(d,h)=>(S(),I(ze,null,[e.selectedImages.length>0?(S(),I("div",vE,[(S(!0),I(ze,null,_t(e.selectedImages,v=>(S(),I("div",{key:v.id,class:"thread-composer-attachment"},[r(v.url)?(S(),I("video",{key:0,class:"thread-composer-attachment-image",src:v.url,controls:"",preload:"metadata"},null,8,gE)):(S(),I("img",{key:1,class:"thread-composer-attachment-image",src:v.url,alt:v.name||"Selected image"},null,8,yE)),p("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${v.name||"image"}`,disabled:e.isInteractionDisabled,onClick:y=>n("remove-image",v.id)}," x ",8,wE)]))),128))])):ee("",!0),e.folderUploadGroups.length>0?(S(),I("div",bE,[(S(!0),I(ze,null,_t(e.folderUploadGroups,v=>(S(),I("span",{key:v.id,class:"thread-composer-folder-chip"},[Ie(_p,{class:"thread-composer-folder-chip-icon"}),p("span",{class:"thread-composer-folder-chip-name",title:v.name},T(v.name),9,kE),p("span",CE,[v.isUploading?(S(),I(ze,{key:0},[ps(T(s(v))+"% uploading ("+T(v.processed)+"/"+T(v.total)+") ",1)],64)):(S(),I(ze,{key:1},[ps(T(v.filePaths.length)+" file"+T(v.filePaths.length===1?"":"s"),1)],64))]),p("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${v.name}`,disabled:e.isInteractionDisabled,onClick:y=>n("remove-folder",v.id)},"×",8,TE)]))),128))])):ee("",!0),e.standaloneFileAttachments.length>0?(S(),I("div",SE,[(S(!0),I(ze,null,_t(e.standaloneFileAttachments,v=>(S(),I("span",{key:v.fsPath,class:"thread-composer-file-chip"},[Ie(Bi,{class:"thread-composer-file-chip-icon"}),p("span",{class:"thread-composer-file-chip-name",title:v.fsPath},T(v.label),9,_E),p("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${v.label}`,disabled:e.isInteractionDisabled,onClick:y=>n("remove-file",v.fsPath)},"×",8,xE)]))),128))])):ee("",!0),e.selectedSkills.length>0?(S(),I("div",AE,[(S(!0),I(ze,null,_t(e.selectedSkills,v=>(S(),I("span",{key:v.path,class:"thread-composer-skill-chip"},[p("button",{class:"thread-composer-skill-chip-name",type:"button",title:a(v.path),"aria-label":`Open ${v.displayName||v.name} SKILL.md`,onClick:y=>l(v)},T(v.displayName||v.name),9,PE),p("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${v.displayName||v.name}`,onClick:y=>n("remove-skill",v.path)},"×",8,IE)]))),128))])):ee("",!0)],64))}}),RE=bt(EE,[["__scopeId","data-v-acea11fd"]]),ME=tn({__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}=io(),s=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],a=X(()=>{var J;const j=(J=n.modelReasoningEfforts)==null?void 0:J[n.selectedModel];if(j===void 0)return s;const B=new Set(j);return s.filter(ce=>B.has(ce.value))});function l(j){return j.trim().replace(/^gpt/i,"GPT")}const d=X(()=>n.models.map(j=>({value:j,label:l(j)}))),h=X(()=>n.disabled||!n.activeThreadId),v=X(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),y=X(()=>n.selectedSpeedMode==="fast"&&v.value);function _(j){o("update:selected-model",j)}function P(j){o("update:selected-reasoning-effort",j)}return(j,B)=>(S(),I(ze,null,[Ie(or,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:d.value,"selected-prefix-icon":y.value?Ys:null,placeholder:g(r)("Model"),"open-direction":"up",variant:"pill",disabled:h.value||e.models.length===0,"enable-search":"","search-placeholder":g(r)("Search models..."),"onUpdate:modelValue":_},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Ie(or,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:a.value,placeholder:g(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:h.value||a.value.length===0,"onUpdate:modelValue":P},null,8,["model-value","options","placeholder","disabled"])],64))}}),$E=bt(ME,[["__scopeId","data-v-05288bd3"]]),jE=["aria-label","disabled"],LE=["disabled"],NE=["disabled"],OE=["disabled"],DE={class:"thread-composer-attach-mode"},FE={class:"thread-composer-attach-mode-label"},UE={class:"thread-composer-attach-mode-buttons"},BE=["disabled"],qE=["disabled"],zE={class:"thread-composer-attach-mode"},HE={class:"thread-composer-attach-mode-label"},WE={class:"thread-composer-attach-mode-buttons"},VE=["disabled","onClick"],GE={class:"thread-composer-attach-mode"},KE={class:"thread-composer-attach-mode-label"},YE={class:"thread-composer-attach-mode-buttons"},JE=["disabled","onClick"],QE={key:0,class:"thread-composer-menu-error",role:"alert"},XE={key:0,class:"thread-composer-approval-tip",role:"status"},ZE=tn({__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}=io();function r(){n("toggle")}function s(y){n("set-active-mode",y)}function a(){n("select-photo")}function l(){n("select-folder")}function d(){n("capture-camera")}function h(y){n("select-collaboration-mode",y)}function v(y){n("select-approval-policy",y)}return(y,_)=>(S(),tt(Ku,{open:e.open,align:"start",width:"lg","aria-label":g(o)("Add photos & files"),"onUpdate:open":_[2]||(_[2]=P=>n("update:open",P))},{trigger:yt(()=>[p("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":g(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,jE)]),default:yt(()=>[p("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:a},T(g(o)("Add photos & files")),9,LE),p("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},T(g(o)("Add folder")),9,NE),p("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:d},T(g(o)("Take photo")),9,OE),_[5]||(_[5]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",DE,[p("span",FE,T(g(o)("In-progress send")),1),p("div",UE,[p("button",{class:Ke(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:_[0]||(_[0]=P=>s("steer"))},T(g(o)("Steer")),11,BE),p("button",{class:Ke(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:_[1]||(_[1]=P=>s("queue"))},T(g(o)("Queue")),11,qE)])]),e.isMobile?(S(),I(ze,{key:0},[_[3]||(_[3]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",zE,[p("span",HE,T(g(o)("Plan mode")),1),p("div",WE,[(S(!0),I(ze,null,_t(e.collaborationModeChoices,P=>(S(),I("button",{key:`mobile-plan-${P.value}`,class:Ke(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===P.value}]),type:"button",disabled:P.disabled||e.isComposerConfigDisabled,onClick:j=>h(P.value)},T(g(o)(P.labelKey)),11,VE))),128))])]),_[4]||(_[4]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",GE,[p("span",KE,T(g(o)("Approval policy")),1),p("div",YE,[(S(!0),I(ze,null,_t(e.approvalPolicyChoices,P=>(S(),I("button",{key:`mobile-approval-${P.value}`,class:Ke(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===P.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:j=>v(P.value)},T(g(o)(P.label)),11,JE))),128))])]),e.approvalPolicyError?(S(),I("p",QE,T(e.approvalPolicyError),1)):ee("",!0),Ie(Mc,{name:"approval-tip"},{default:yt(()=>[e.approvalPolicyNotice?(S(),I("span",XE,T(e.approvalPolicyNotice),1)):ee("",!0)]),_:1})],64)):ee("",!0)]),_:1},8,["open","aria-label"]))}}),eR=bt(ZE,[["__scopeId","data-v-24be0643"]]),tR=/(^|\s)(\/[a-zA-Z]*)$/,Xm=[{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 nR(e){var o,r,s;const t=[],n=new Set;for(const a of e){const l=a.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!l)continue;const d=a.path.trim()||l;n.has(d)||(n.add(d),t.push({id:l,description:((o=a.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:a.path,displayName:((r=a.displayName)==null?void 0:r.trim())||a.name.trim(),scope:((s=a.scope)==null?void 0:s.trim())||"user"}))}return t.sort((a,l)=>a.id.localeCompare(l.id))}function oR(e){const t=e.match(tR);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function rR(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 aR={class:"thread-composer-main"},sR={class:"thread-composer-input-row"},iR={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},lR={class:"thread-composer-drop-overlay-copy"},cR={key:1,class:"composer-popover"},uR=["onMousedown"],dR={key:1,class:"thread-composer-file-mention-icon-markdown"},fR={class:"thread-composer-file-mention-text"},pR={class:"thread-composer-file-mention-name"},hR={key:0,class:"thread-composer-file-mention-dir"},mR={key:1,class:"thread-composer-file-mention-empty"},vR={key:2,class:"thread-composer-file-mention-empty"},gR=["placeholder","disabled"],yR=["aria-label","title","disabled"],wR={class:"thread-composer-actions"},bR=["aria-label","title","disabled"],kR={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},CR=["aria-label","title","disabled"],TR=["aria-label","disabled"],SR={class:"thread-composer-plan-trigger-label"},_R=["aria-checked","disabled","onClick"],xR={class:"thread-composer-menu-item-copy"},AR={class:"thread-composer-menu-item-title"},PR={key:0,class:"thread-composer-menu-item-sub"},IR={key:1,class:"thread-composer-menu-item-hint"},ER={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},RR=["aria-label","disabled"],MR={class:"thread-composer-approval-trigger-label"},$R=["aria-checked","disabled","onClick"],jR={class:"thread-composer-menu-item-copy"},LR={class:"thread-composer-menu-item-title"},NR={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},OR={key:0,class:"thread-composer-menu-error",role:"alert"},DR={key:0,class:"thread-composer-approval-tip",role:"status"},FR=["title","aria-label"],UR={class:"thread-composer-context-usage-value"},BR={key:0,class:"thread-composer-context-usage-compact"},qR=["disabled"],zR=["disabled"],HR=["disabled"],pf=12e3,WR=2e3,VR="codex-web-local.thread-draft.v1.",GR=tn({__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:s}=io(),a=A(""),l=A([]),d=A([]),h=A([]),v=A([]),y=A(""),_=A(0),P=A(null),j=A(!1),{state:B,cancel:J}=uI({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:M=>{if(a.value=a.value?`${a.value}
|
|
58
|
+
${M}`:M,y.value="",o.dictationAutoSend!==!1){const F=o.isTurnInProgress?ge.value:"steer";Ze(F);return}Wt(()=>{var F;return(F=K.value)==null?void 0:F.focus()})},onEmpty:()=>{y.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:M=>{if(M instanceof DOMException&&M.name==="NotAllowedError"){y.value="Microphone access was denied.";return}y.value=M instanceof Error?M.message:"Dictation failed."}}),ce=A(null),U=A(null),V=A(null),K=A(null),{isMobile:ye}=yp(),_e=A(!1),we=A(!1),$e=A(!1),de=A(null),Le=A(""),je=A([]),fe=A(!1),Te=A(0),xe=A(!1),Ae=A(null),Ue=A(""),Ye=A(0),He=A(Xm),At=X(()=>[...Xm,...nR(o.skills??[])]),ct=A(!1),Qe=A(!1);let et=!1;const ft=A(0);let mt=0,kt=null,at="",ae=!1,te=0,oe=0;const z=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let Be="";const $=X(()=>{const M=new Set((o.collaborationModes??[]).map(F=>F.value));return[{value:"default",labelKey:"Default",subLabel:"",disabled:!1},{value:"plan",labelKey:"Plan mode",subLabel:s("Agent proposes a plan before acting"),disabled:!1},{value:"execplans",labelKey:"Execution plans",subLabel:"",disabled:!M.has("execplans")}]}),O=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],G=X(()=>{const M=$.value.find(F=>F.value===o.selectedCollaborationMode);return s(M?M.labelKey:"Plan mode")}),ue=X(()=>{const M=O.find(F=>F.value===o.approvalPolicy);return s(M?M.label:"Approval policy")}),ie=X(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),re=X(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||ie.value||_.value>0?!1:a.value.trim().length>0||l.value.length>0||h.value.length>0),Se=X(()=>a.value.trim().length>0||l.value.length>0||d.value.length>0||h.value.length>0||v.value.length>0),be=X(()=>{const M=new Set;for(const F of v.value)for(const ne of F.filePaths)M.add(ne);return h.value.filter(F=>!M.has(F.fsPath))}),pe=X(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),se=X(()=>o.disabled||!o.activeThreadId),Ee=X(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),ge=A(Ee.value),Fe=X(()=>B.value==="recording"),Me=X(()=>o.activeThreadId?ie.value?s("Loading models for plan mode..."):s("Ask Codex anything, @ to add files, / for commands"):s("Select a thread to send a message")),Ve=X(()=>a.value.trim().length>0||l.value.length>0||h.value.length>0),rt=X(()=>a.value.split(`
|
|
59
|
+
`).length),gt=X(()=>ct.value||rt.value>=6||Qe.value),It=X(()=>We(o.threadTokenUsage??null)),Tt=X(()=>{var M;return((M=It.value)==null?void 0:M.summaryText)??""}),Tn=X(()=>{var M;return((M=It.value)==null?void 0:M.tooltipText)??""}),H=X(()=>{var M;return((M=It.value)==null?void 0:M.tone)??"healthy"});function W(){H.value!=="healthy"&&r("compact-context")}function Y(M){if(!Number.isFinite(M))return"0";const F=Math.abs(M);return F>=1e6?`${(F>=1e7?(M/1e6).toFixed(0):(M/1e6).toFixed(1)).replace(/\.0$/,"")}M`:F>=1e3?`${(F>=1e5?(M/1e3).toFixed(0):(M/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(M))}function me(M){const F=Math.max(0,M.inputTokens-M.cachedInputTokens),ne=[`${Y(M.totalTokens)} ${s("total")}`,`${Y(F)} ${s("input")}`];return M.cachedInputTokens>0&&ne.push(`${Y(M.cachedInputTokens)} ${s("cached")}`),M.outputTokens>0&&ne.push(`${Y(M.outputTokens)} ${s("output")}`),M.reasoningOutputTokens>0&&ne.push(`${Y(M.reasoningOutputTokens)} ${s("reasoning")}`),ne.join(" · ")}function Oe(M,F){if(!Number.isFinite(M)||!Number.isFinite(F)||F<=0)return 0;if(F<=pf){const qt=Math.max(0,F-Math.max(0,M));return Math.max(0,Math.min(100,Math.round(qt/F*100)))}const ne=F-pf,Pe=Math.max(0,M-pf),Ge=Math.max(0,ne-Pe);return Math.max(0,Math.min(100,Math.round(Ge/ne*100)))}function We(M){if(!M)return null;const F=M.modelContextWindow??null;if(typeof F!="number"||!Number.isFinite(F)||F<=0)return null;const ne=Math.max(0,M.last.totalTokens),Pe=Oe(ne,F),Ge=Math.max(0,Math.min(100,100-Pe)),qt=Pe<=15?"danger":Pe<=35?"warning":"healthy";return{summaryText:`${Pe}% · ${Y(ne)} / ${Y(F)}`,tooltipText:[`${s("Context window")}: ${Pe}% ${s("left")} (${Ge}% ${s("used")})`,`${s("In context")}: ${ne.toLocaleString()} / ${F.toLocaleString()} tokens`,`${s("Last turn")}: ${me(M.last)}`,`${s("Session total")}: ${me(M.total)}`].join(`
|
|
60
|
+
`),percentRemaining:Pe,tone:qt}}function Ze(M="steer"){var ne;const F=a.value.trim();if(re.value){if(r("submit",{text:F,imageUrls:l.value.map(Pe=>Pe.url),fileAttachments:[...h.value],skills:d.value.map(Pe=>({name:Pe.name,path:Pe.path})),mode:M}),fo(o.activeThreadId),Kn(),ct.value=!1,v.value=[],_e.value=!1,En(),z||ye.value){(ne=K.value)==null||ne.blur();return}Wt(()=>{var Pe;return(Pe=K.value)==null?void 0:Pe.focus()})}}function Ft(M){ge.value=M}function Nt(M){ft.value+=1,a.value=M.text,l.value=M.imageUrls.map((F,ne)=>({id:`queued-${Date.now()}-${ne}-${Math.random().toString(36).slice(2,8)}`,name:`${s("Image")} ${ne+1}`,url:F})),d.value=M.skills.map(F=>(o.skills??[]).find(ne=>ne.path===F.path)??{name:F.name,displayName:void 0,description:"",path:F.path}),h.value=M.fileAttachments.map(F=>({...F})),v.value=[],y.value="",P.value=null,_.value=0,_e.value=!1,En(),xt(),oe+=1}function Kn(){Nt({text:"",imageUrls:[],fileAttachments:[],skills:[]}),ct.value=!1}function lo(M){return`${VR}${M}`}function co(M){if(typeof window>"u")return null;const F=M.trim();if(!F)return null;try{const ne=window.localStorage.getItem(lo(F));if(!ne)return null;const Pe=JSON.parse(ne);return typeof Pe=="string"?{text:Pe,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Pe.text=="string"?Pe.text:"",imageUrls:Array.isArray(Pe.imageUrls)?Pe.imageUrls.filter(Ge=>typeof Ge=="string"):[],fileAttachments:Array.isArray(Pe.fileAttachments)?Pe.fileAttachments.filter(Ge=>!!Ge&&typeof Ge.label=="string"&&typeof Ge.path=="string"&&typeof Ge.fsPath=="string"):[],skills:Array.isArray(Pe.skills)?Pe.skills.filter(Ge=>!!Ge&&typeof Ge.name=="string"&&typeof Ge.path=="string"):[]}}catch{return null}}function uo(M,F){if(typeof window>"u")return;const ne=M.trim();if(ne)try{if(F.text.trim().length>0||F.imageUrls.length>0||F.fileAttachments.length>0||F.skills.length>0){window.localStorage.setItem(lo(ne),JSON.stringify(F));return}window.localStorage.removeItem(lo(ne))}catch{}}function fo(M){uo(M,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function za(){return{text:a.value,imageUrls:l.value.map(M=>M.url),fileAttachments:h.value.map(M=>({...M})),skills:d.value.map(M=>({name:M.name,path:M.path}))}}function Cr(){r("interrupt")}function Qt(){const M=K.value;if(!M){Qe.value=!1;return}Qe.value=M.scrollHeight>M.clientHeight+2}function ut(){et||(et=!0,Wt(()=>{et=!1,Qt()}))}function gn(){pe.value||(ct.value=!ct.value,ut(),Wt(()=>{var M;return(M=K.value)==null?void 0:M.focus()}))}function zo(M){r("update:selected-model",M)}function bs(M){if(M===o.selectedCollaborationMode){we.value=!1;return}r("update:selected-collaboration-mode",M),we.value=!1}function ni(M){if(M===o.selectedCollaborationMode){_e.value=!1;return}r("update:selected-collaboration-mode",M),_e.value=!1}function Et(M){r("update:selected-reasoning-effort",M)}function Ut(M){o.approvalPolicy===M||o.isApprovalPolicySaving===!0||(r("update:approval-policy",M),r("save-approval-policy"))}function ht(){o.dictationClickToToggle}function Ho(){pe.value||(_e.value=!_e.value,we.value=!1,$e.value=!1)}function dn(){se.value||(we.value=!we.value,_e.value=!1,$e.value=!1)}function sr(){se.value||($e.value=!$e.value,_e.value=!1,we.value=!1)}function ir(){var M;(M=ce.value)==null||M.click()}function Yn(){var M;(M=U.value)==null||M.click()}function lr(){var M;(M=V.value)==null||M.click()}function ba(M){const F=l.value.find(ne=>ne.id===M);if(F&&Yt(F.url)){const ne=Yr(F.url);ne&&Dn(ne)}l.value=l.value.filter(ne=>ne.id!==M)}function Ha(M){d.value=d.value.filter(F=>F.path!==M)}function Dn(M){h.value=h.value.filter(F=>F.fsPath!==M)}function In(M){const F=v.value.find(Pe=>Pe.id===M);if(!F)return;const ne=new Set(F.filePaths);h.value=h.value.filter(Pe=>!ne.has(Pe.fsPath)),v.value=v.value.filter(Pe=>Pe.id!==M)}function Gr(M,F){const ne=M.replace(/\\/g,"/");if(h.value.some(qt=>qt.fsPath===ne))return;const Pe=ne.split("/").filter(Boolean),Ge=(F==null?void 0:F.trim())||Pe[Pe.length-1]||ne;h.value=[...h.value,{label:Ge,path:ne,fsPath:ne}]}function Ao(M){return M.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(M.name)}const nn=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Kr(M){return M.type.startsWith("video/")?!0:nn.test(M.name)}function Yt(M){const F=M.trim();if(!F)return!1;if(F.startsWith("data:video/"))return!0;try{const ne=new URL(F,window.location.href);return nn.test(ne.pathname)?!0:ne.pathname==="/codex-local-image"?nn.test(ne.searchParams.get("path")??""):!1}catch{return nn.test(F)}}function Yr(M){try{const F=new URL(M,window.location.href);return F.pathname!=="/codex-local-image"?"":decodeURIComponent(F.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function ka(M){return M?Array.from(M):[]}function Jn(M){return M!==oe?!1:(_.value+=1,!0)}function Qn(M){M===oe&&(_.value=Math.max(0,_.value-1))}function Po(M){if(M<=0)return;const F=P.value,ne=F?F.succeeded+F.failed:0;if(!F||ne>=F.total){P.value={total:M,succeeded:0,failed:0};return}P.value={...F,total:F.total+M}}function Pt(M){const F=P.value;F&&(P.value={...F,succeeded:F.succeeded+(M==="success"?1:0),failed:F.failed+(M==="failure"?1:0)})}function $t(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function zn(M){const F=new Date,ne=[F.getFullYear(),String(F.getMonth()+1).padStart(2,"0"),String(F.getDate()).padStart(2,"0"),String(F.getHours()).padStart(2,"0"),String(F.getMinutes()).padStart(2,"0"),String(F.getSeconds()).padStart(2,"0")].join("-"),Pe=M.type.startsWith("image/")&&M.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${ne}.${Pe}`}function po(){const M=new Date;return`pasted-text-${[M.getFullYear(),String(M.getMonth()+1).padStart(2,"0"),String(M.getDate()).padStart(2,"0"),String(M.getHours()).padStart(2,"0"),String(M.getMinutes()).padStart(2,"0"),String(M.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Hn(M){return M.name.trim()?M:new File([M],zn(M),{type:M.type||"image/png",lastModified:Date.now()})}async function Xn(M,F){if(Jn(F))try{const ne=Hn(M),Pe=await hu(ne);if(F!==oe)return;if(!Pe){Pt("failure");return}l.value=[...l.value,{id:$t(),name:ne.name,url:`/codex-local-image?path=${encodeURIComponent(Pe)}`}],Pt("success")}catch{F===oe&&Pt("failure")}finally{Qn(F)}}async function Mn(M,F){if(Jn(F))try{const ne=await hu(M);if(F!==oe)return;if(!ne){Pt("failure");return}Gr(ne),Pt("success")}catch{F===oe&&Pt("failure")}finally{Qn(F)}}async function Io(M,F){if(Jn(F))try{const ne=Hn(M),Pe=await hu(ne);if(F!==oe)return;if(!Pe){Pt("failure");return}const Ge=Pe.replace(/\\/g,"/");l.value=[...l.value,{id:$t(),name:ne.name,url:`/codex-local-image?path=${encodeURIComponent(Ge)}`}],Gr(Ge),Pt("success")}catch{F===oe&&Pt("failure")}finally{Qn(F)}}function ho(M){const F=ka(M);if(F.length===0)return;Po(F.length),_e.value=!1,En();const ne=oe;for(const Pe of F)Ao(Pe)?Xn(Pe,ne):Kr(Pe)?Io(Pe,ne):Mn(Pe,ne)}function Tr(){te=0,j.value=!1}function Sr(M){return M?Array.from(M.types??[]).includes("Files"):!1}async function oi(M){if(!M||M.length===0)return;const F=ft.value,ne=Array.from(M),Ge=(ne[0].webkitRelativePath||ne[0].name).split("/").filter(Boolean)[0]||"Folder",qt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;v.value=[...v.value,{id:qt,name:Ge,total:ne.length,processed:0,filePaths:[],isUploading:!0}];const pn=Xt=>{F===ft.value&&(v.value=v.value.map(jt=>jt.id===qt?Xt(jt):jt))};for(const Xt of ne)try{const jt=await hu(Xt);if(F!==ft.value)return;if(jt){const Pr=Xt.webkitRelativePath||Xt.name;Gr(jt,Pr),pn(yo=>({...yo,processed:yo.processed+1,filePaths:[...yo.filePaths,jt]}));continue}pn(Pr=>({...Pr,processed:Pr.processed+1}))}catch{pn(jt=>({...jt,processed:jt.processed+1}))}pn(Xt=>({...Xt,isUploading:!1}))}function Wo(M){M&&(M.value="")}function Wa(M){const F=M.target;ho((F==null?void 0:F.files)??null),Wo(F),_e.value=!1}function Ca(M){const F=M.target;ho((F==null?void 0:F.files)??null),Wo(F),_e.value=!1}function cr(M){const F=M.target;oi((F==null?void 0:F.files)??null),Wo(F),_e.value=!1}function _r(M){pe.value||!Sr(M.dataTransfer)||(M.preventDefault(),te+=1,j.value=!0)}function ur(M){pe.value||!Sr(M.dataTransfer)||(M.preventDefault(),M.dataTransfer&&(M.dataTransfer.dropEffect="copy"),j.value=!0)}function Ct(M){j.value&&(M.preventDefault(),te=Math.max(0,te-1),te===0&&Tr())}function Fn(M){var F;pe.value||!Sr(M.dataTransfer)||(M.preventDefault(),Tr(),ho(((F=M.dataTransfer)==null?void 0:F.files)??null))}function Sn(){!j.value&&te===0||Tr()}function sn(M){var qt,pn;if(pe.value)return;const F=((qt=M.clipboardData)==null?void 0:qt.getData("text/plain"))??"";if(F.length>=WR){M.preventDefault();const Xt=new File([F],po(),{type:"text/plain",lastModified:Date.now()});ho([Xt]);return}const ne=Array.from(((pn=M.clipboardData)==null?void 0:pn.items)??[]);if(ne.length===0)return;const Pe=F.length>0,Ge=ne.filter(Xt=>Xt.kind==="file"&&Xt.type.startsWith("image/")).map(Xt=>Xt.getAsFile()).filter(Xt=>Xt instanceof File);Ge.length!==0&&(Pe||M.preventDefault(),ho(Ge))}function mo(){y.value&&(y.value=""),ut(),Wn(),yn()}function Vo(M){if(M.isComposing||M.keyCode===229)return;if(fe.value){if(M.key==="Escape"){M.preventDefault(),En();return}if(M.key==="ArrowDown"){M.preventDefault(),je.value.length>0&&(Te.value=(Te.value+1)%je.value.length);return}if(M.key==="ArrowUp"){if(M.preventDefault(),je.value.length>0){const ne=je.value.length;Te.value=(Te.value+ne-1)%ne}return}if(M.key==="Enter"||M.key==="Tab"){M.preventDefault();const ne=je.value[Te.value];ne?Vn(ne):En();return}}if(xe.value){if(M.key==="Escape"){M.preventDefault(),xt();return}if(M.key==="ArrowDown"){M.preventDefault(),He.value.length>0&&(Ye.value=(Ye.value+1)%He.value.length);return}if(M.key==="ArrowUp"){if(M.preventDefault(),He.value.length>0){const ne=He.value.length;Ye.value=(Ye.value+ne-1)%ne}return}if(M.key==="Enter"||M.key==="Tab"){M.preventDefault();const ne=He.value[Ye.value];ne?Bt(ne):xt();return}}if(o.sendWithEnter!==!1?M.key==="Enter"&&!M.shiftKey:M.key==="Enter"&&(M.metaKey||M.ctrlKey)){M.preventDefault(),Ze(o.isTurnInProgress?ge.value:"steer");return}}function En(){if(fe.value=!1,de.value=null,Le.value="",je.value=[],Te.value=0,ae=!1,at){const M=at;at="",FS(M)}}function Wn(){const M=K.value;if(!M){En();return}const F=M.selectionStart??a.value.length,Pe=a.value.slice(0,F).match(/(^|\s)(@[^\s@]*)$/);if(!Pe){En();return}const Ge=Pe[2]??"",qt=Ge.length,pn=F-qt;xe.value&&xt(),de.value=pn,Le.value=Ge.slice(1),fe.value=!0,fn()}function xt(){xe.value=!1,Ae.value=null,Ue.value="",Ye.value=0,He.value=At.value}function yn(){const M=K.value;if(!M){xt();return}const F=M.selectionStart??a.value.length,ne=a.value.slice(0,F),Pe=oR(ne);if(!Pe){xt();return}fe.value&&En(),Ae.value=Pe.startIndex,Ue.value=Pe.query,He.value=rR(At.value,Pe.query),Ye.value=0,xe.value=!0}function Bt(M){const F=K.value,ne=Ae.value;if(ne!==null&&F){const Pe=F.selectionStart??a.value.length;a.value=`${a.value.slice(0,ne)}${a.value.slice(Pe)}`}if(xt(),M.kind==="skill"){const Pe=(o.skills??[]).find(qt=>qt.path===M.skillPath||qt.name===M.id);Pe&&!d.value.some(qt=>qt.path===Pe.path)&&(d.value=[...d.value,{...Pe}]);const Ge=a.value.trim();a.value=Ge.length>0?`${Ge} (Use the ${M.id} skill.)`:`Use the ${M.id} skill.`,Wt(()=>{F==null||F.focus(),Qt()});return}if(M.kind==="rpc"){r("slash-command",M.id);return}M.kind==="text"&&M.insertText&&(a.value=a.value.trimEnd(),a.value=a.value.length>0?`${a.value} ${M.insertText}`:M.insertText),M.kind==="local"&&M.id==="clear"&&(a.value=""),Wt(()=>{F==null||F.focus(),Qt()})}async function fn(){if(!fe.value)return;const M=(o.cwd??"").trim();if(!M){je.value=[],ae=!0;return}ae=!1,kt&&clearTimeout(kt);const F=++mt;kt=setTimeout(async()=>{const ne=`composer-${F}`,Pe=Le.value;try{if(at||(await OS([M],ne),at=ne,r("register-fuzzy-session",ne)),await DS(at,Pe),!fe.value||F!==mt)return;if(je.value=(o.fuzzyFileSearchResults??[]).map(Ge=>({path:Ge.path})),Te.value=0,je.value.length===0)try{const Ge=await Lm(M,Pe,20);if(!fe.value||F!==mt)return;je.value=Ge,Te.value=0}catch{if(!fe.value||F!==mt)return;je.value=[]}}catch{if(!fe.value||F!==mt)return;at="";try{const Ge=await Lm(M,Pe,20);if(!fe.value||F!==mt)return;je.value=Ge,Te.value=0}catch{if(!fe.value||F!==mt)return;je.value=[]}}},120)}function Vn(M){const F=K.value,ne=de.value;if(ne!==null&&F){const Pe=F.selectionStart??a.value.length;a.value=`${a.value.slice(0,ne)}${a.value.slice(Pe)}`.trimEnd()}Gr(M.path),En(),Wt(()=>F==null?void 0:F.focus())}function Zn(M){J(),Nt(M),Wt(()=>{var F;(F=K.value)==null||F.focus(),Qt()})}function vo(M){const F=M.trim();F&&(a.value=a.value.trim()?`${a.value.trim()}
|
|
61
|
+
${F}`:F,Wt(()=>{var ne;(ne=K.value)==null||ne.focus(),Qt()}))}function xr(M){const F=M.lastIndexOf("/");return F<0?M:M.slice(F+1)}function Go(M){const F=M.lastIndexOf("/");return F<=0?"":M.slice(0,F)}function Jr(M){const F=xr(M),ne=F.lastIndexOf(".");return ne<=0?"":F.slice(ne+1).toLowerCase()}function Ko(M){const F=Jr(M);return F==="ts"?"TS":F==="tsx"?"TSX":F==="js"?"JS":F==="jsx"?"JSX":F==="json"?"{}":""}function Eo(M){const F=Jr(M);return F.startsWith("ts")?"ts":F.startsWith("js")?"js":F==="json"?"json":"default"}function Ar(M){const F=Jr(M);return F==="md"||F==="mdx"}function go(M){if(!_e.value&&!we.value&&!$e.value)return;const F=M.target;F&&(typeof F.closest=="function"&&F.closest(".composer-popover-anchor")||(_e.value=!1,we.value=!1,$e.value=!1))}return ws(()=>{document.addEventListener("click",go),window.addEventListener("drop",Sn),window.addEventListener("dragend",Sn),window.addEventListener("blur",Sn),ut()}),t({hydrateDraft:Zn,appendTextToDraft:vo,hasUnsavedDraft:()=>Se.value}),qi(()=>{document.removeEventListener("click",go),window.removeEventListener("drop",Sn),window.removeEventListener("dragend",Sn),window.removeEventListener("blur",Sn),window.removeEventListener("pointerup",ht),window.removeEventListener("pointercancel",ht),window.removeEventListener("blur",ht),kt&&clearTimeout(kt)}),nt(()=>o.activeThreadId,M=>{J(),Be&&uo(Be,za()),Kn();const F=co(M);F&&(Nt(F),mo()),Be=M.trim()},{immediate:!0}),nt([a,l,h,d],()=>{Be&&uo(Be,za())},{deep:!0}),nt(a,()=>{ut()}),nt(()=>o.cwd,()=>{fe.value&&fn()}),nt(()=>o.fuzzyFileSearchResults,M=>{!fe.value||!at||(je.value=(M??[]).map(F=>({path:F.path})),Te.value=0)}),nt(Ee,M=>{ge.value=M}),(M,F)=>(S(),I("form",{class:"thread-composer",onSubmit:F[6]||(F[6]=lt(ne=>Ze(e.isTurnInProgress?ge.value:"steer"),["prevent"]))},[p("div",{class:Ke(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":j.value}])},[e.planPanel?(S(),tt(mE,{key:0,"plan-panel":e.planPanel,onImplementPlan:F[0]||(F[0]=ne=>M.$emit("implement-plan"))},null,8,["plan-panel"])):ee("",!0),Ie(RE,{"selected-images":l.value,"folder-upload-groups":v.value,"standalone-file-attachments":be.value,"selected-skills":d.value,"is-interaction-disabled":pe.value,onRemoveImage:ba,onRemoveFolder:In,onRemoveFile:Dn,onRemoveSkill:Ha},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),p("div",aR,[p("div",sR,[p("div",{class:Ke(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":j.value,"thread-composer-input-wrap--expanded":ct.value}]),onDragenter:_r,onDragover:ur,onDragleave:Ct,onDrop:Fn},[j.value?(S(),I("div",iR,[p("span",lR,T(g(s)("Drop images or files")),1)])):ee("",!0),fe.value?(S(),I("div",cR,[je.value.length>0?(S(!0),I(ze,{key:0},_t(je.value,(ne,Pe)=>(S(),I("button",{key:ne.path,class:Ke(["thread-composer-file-mention-row",{"is-active":Pe===Te.value}]),type:"button",onMousedown:lt(Ge=>Vn(ne),["prevent"])},[Ko(ne.path)?(S(),I("span",{key:0,class:Ke(["thread-composer-file-mention-icon-badge",`is-${Eo(ne.path)}`])},T(Ko(ne.path)),3)):Ar(ne.path)?(S(),I("span",dR,"↓")):(S(),tt(Bi,{key:2,class:"thread-composer-file-mention-icon-file"})),p("span",fR,[p("span",pR,T(xr(ne.path)),1),Go(ne.path)?(S(),I("span",hR,T(Go(ne.path)),1)):ee("",!0)])],42,uR))),128)):g(ae)?(S(),I("div",mR,T(g(s)("No searchable directory for this thread")),1)):(S(),I("div",vR,T(g(s)("No matching files")),1))])):ee("",!0),xe.value?(S(),tt(zI,{key:2,commands:He.value,"highlighted-index":Ye.value,onSelect:Bt},null,8,["commands","highlighted-index"])):ee("",!0),Lt(p("textarea",{ref_key:"inputRef",ref:K,"onUpdate:modelValue":F[1]||(F[1]=ne=>a.value=ne),class:"thread-composer-input",placeholder:Me.value,disabled:pe.value,onInput:mo,onKeydown:Vo,onPaste:sn},null,40,gR),[[an,a.value]]),gt.value?(S(),I("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":ct.value?g(s)("Exit full screen composer"):g(s)("Expand composer"),title:ct.value?g(s)("Exit full screen composer"):g(s)("Expand composer"),disabled:pe.value,onClick:gn},[ct.value?(S(),tt(CI,{key:0,class:"thread-composer-expand-icon"})):(S(),tt(yI,{key:1,class:"thread-composer-expand-icon"}))],8,yR)):ee("",!0)],34),p("div",wR,[e.isTurnInProgress&&!Ve.value?(S(),I("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?g(s)("Saving thread before stop is available"):g(s)("Stop"),title:e.isStopPending?g(s)("Saving thread before stop is available"):g(s)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:Cr},[e.isStopPending?(S(),I("span",kR)):(S(),tt(xI,{key:1,class:"thread-composer-stop-icon"}))],8,bR)):(S(),I("button",{key:1,class:Ke(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&ge.value==="queue"}]),type:"button","aria-label":e.isCompacting?g(s)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&ge.value==="queue"?g(s)("Queue message"):g(s)("Send message"),title:e.isCompacting?g(s)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${g(s)("Send")} ${ge.value==="queue"?g(s)("Queue"):g(s)("Steer")}`:g(s)("Send"),disabled:!re.value,onClick:F[2]||(F[2]=ne=>Ze(e.isTurnInProgress?ge.value:"steer"))},[Ie(hI,{class:"thread-composer-submit-icon"})],10,CR))])]),p("div",{class:Ke(["thread-composer-controls",{"thread-composer-controls--recording":Fe.value}])},[Ie(eR,{open:_e.value,"is-mobile":g(ye),"is-interaction-disabled":pe.value,"is-composer-config-disabled":se.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":$.value,"approval-policy-choices":O,"active-in-progress-mode":ge.value,"onUpdate:open":F[3]||(F[3]=ne=>_e.value=ne),onToggle:Ho,onSetActiveMode:Ft,onSelectPhoto:ir,onSelectFolder:lr,onCaptureCamera:Yn,onSelectCollaborationMode:ni,onSelectApprovalPolicy:Ut},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"]),g(ye)?ee("",!0):(S(),tt(Ku,{key:0,open:we.value,align:"start",width:"md","aria-label":g(s)("Plan mode"),"onUpdate:open":F[4]||(F[4]=ne=>we.value=ne)},{trigger:yt(()=>[p("button",{class:Ke(["thread-composer-plan-trigger",{"is-active":we.value}]),type:"button","aria-label":g(s)("Plan mode"),disabled:se.value,onClick:dn},[p("span",SR,T(G.value),1),Ie(Js,{class:"thread-composer-plan-trigger-chevron"})],10,TR)]),default:yt(()=>[(S(!0),I(ze,null,_t($.value,ne=>(S(),I("button",{key:ne.value,class:Ke(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===ne.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===ne.value,disabled:ne.disabled||se.value,onClick:Pe=>bs(ne.value)},[p("span",xR,[p("span",AR,T(g(s)(ne.labelKey)),1),ne.subLabel?(S(),I("span",PR,T(ne.subLabel),1)):ee("",!0),ne.disabled?(S(),I("span",IR,T(g(s)("Not supported by this Codex version")),1)):ee("",!0)]),e.selectedCollaborationMode===ne.value?(S(),I("span",ER,"✓")):ee("",!0)],10,_R))),128))]),_:1},8,["open","aria-label"])),g(ye)?ee("",!0):(S(),tt(Ku,{key:1,open:$e.value,align:"center",width:"md","aria-label":g(s)("Approval policy"),"onUpdate:open":F[5]||(F[5]=ne=>$e.value=ne)},{trigger:yt(()=>[p("button",{class:Ke(["thread-composer-approval-trigger",{"is-active":$e.value}]),type:"button","aria-label":g(s)("Approval policy"),disabled:se.value,onClick:sr},[p("span",MR,T(ue.value),1),Ie(Js,{class:"thread-composer-approval-trigger-chevron"})],10,RR)]),default:yt(()=>[(S(),I(ze,null,_t(O,ne=>p("button",{key:ne.value,class:Ke(["thread-composer-menu-item",{"is-active":e.approvalPolicy===ne.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===ne.value,disabled:e.isApprovalPolicySaving,onClick:Pe=>Ut(ne.value)},[p("span",jR,[p("span",LR,T(g(s)(ne.label)),1)]),e.approvalPolicy===ne.value?(S(),I("span",NR,"✓")):ee("",!0)],10,$R)),64)),e.approvalPolicyError?(S(),I("p",OR,T(e.approvalPolicyError),1)):ee("",!0),Ie(Mc,{name:"approval-tip"},{default:yt(()=>[e.approvalPolicyNotice?(S(),I("span",DR,T(e.approvalPolicyNotice),1)):ee("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Ie($E,{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":zo,"onUpdate:selectedReasoningEffort":Et},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),It.value?(S(),I("button",{key:2,type:"button",class:Ke(["thread-composer-context-usage-inline",{"is-warning":H.value==="warning","is-danger":H.value==="danger"}]),title:Tn.value,"aria-label":g(s)("Context"),onClick:W},[p("span",UR,T(Tt.value),1),H.value!=="healthy"?(S(),I("span",BR,T(g(s)("Compact")),1)):ee("",!0)],10,FR)):ee("",!0)],2)])],2),p("input",{ref_key:"photoLibraryInputRef",ref:ce,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:pe.value,onChange:Wa},null,40,qR),p("input",{ref_key:"cameraCaptureInputRef",ref:U,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:pe.value,onChange:Ca},null,40,zR),p("input",{ref_key:"folderPickerInputRef",ref:V,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:pe.value,onChange:cr},null,40,HR)],32))}}),Zm=bt(GR,[["__scopeId","data-v-b38ffbf2"]]),KR={class:"thread-pending-request-title"},YR=["title"],JR={class:"thread-pending-request-approval"},QR=["aria-label"],XR=["aria-pressed","onClick"],ZR={class:"thread-pending-request-option-index"},eM={class:"thread-pending-request-option-label"},tM={class:"thread-pending-request-footer thread-pending-request-footer--approval"},nM=["value","placeholder"],oM={key:0,class:"thread-pending-request-validation-error",role:"alert"},rM={class:"thread-pending-request-header"},aM={class:"thread-pending-request-heading"},sM={class:"thread-pending-request-eyebrow"},iM={class:"thread-pending-request-title"},lM={key:0,class:"thread-pending-request-counter"},cM={key:0,class:"thread-pending-request-preview"},uM={class:"thread-pending-request-preview-code"},dM={key:1,class:"thread-pending-request-validation-error",role:"alert"},fM={key:2,class:"thread-pending-request-user-input"},pM={key:0,class:"thread-pending-request-question-description"},hM=["href"],mM={class:"thread-pending-request-question-title"},vM={key:0},gM={key:0,class:"thread-pending-request-question-text"},yM={key:1,class:"thread-pending-request-input-wrap"},wM={class:"thread-pending-request-select-label"},bM=["type","value","onInput"],kM={key:2,class:"thread-pending-request-select-wrap"},CM={class:"thread-pending-request-select-label"},TM={key:3,class:"thread-pending-request-select-wrap"},SM={class:"thread-pending-request-select-label"},_M={key:4,class:"thread-pending-request-question-options"},xM=["checked","onChange"],AM={class:"thread-pending-request-checkbox-label"},PM={key:2,class:"thread-pending-request-validation-error"},IM={class:"thread-pending-request-footer"},EM={key:3,class:"thread-pending-request-user-input"},RM={class:"thread-pending-request-question-title"},MM={key:0,class:"thread-pending-request-question-text"},$M={key:1,class:"thread-pending-request-question-options"},jM={class:"thread-pending-request-select-wrap"},LM={class:"thread-pending-request-select-label"},NM={key:0,class:"thread-pending-request-question-description"},OM={key:2,class:"thread-pending-request-input-wrap"},DM={class:"thread-pending-request-select-label"},FM=["value","placeholder","onInput"],UM={class:"thread-pending-request-footer"},BM={key:4,class:"thread-pending-request-actions"},qM={key:5,class:"thread-pending-request-actions"},zM=tn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean},panelWidth:{},visualViewportHeight:{},panelError:{}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,o=t,r=X(()=>{const H=typeof n.panelWidth=="number"&&n.panelWidth>0?n.panelWidth:0,W=typeof n.visualViewportHeight=="number"&&n.visualViewportHeight>0?`${n.visualViewportHeight}px`:"100dvh";return{...H>0?{width:`${H}px`}:{},"--visual-viewport-height":W}}),s=A("accept"),a=A(""),l=A({}),d=A({}),h=A({}),v=A(""),{t:y}=io();function _(H){return H!==null&&typeof H=="object"&&!Array.isArray(H)?H:null}function P(H){return typeof H=="string"?H.trim():""}function j(H){return typeof H=="string"?H:null}function B(H){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(H)?H:JSON.stringify(H)}function J(H){const Y=(Array.isArray(H.commandActions)?H.commandActions:[]).map(me=>_(me)).map(me=>P(me==null?void 0:me.command)).find(me=>me.length>0);if(Y)return Y.replace(/\s+/g," ").trim();if(Array.isArray(H.command)){const me=H.command.filter(Oe=>typeof Oe=="string").map(Oe=>Oe.trim()).filter(Oe=>Oe.length>0);if(me.length>0)return me.map(Oe=>B(Oe)).join(" ")}return de(P(H.command))}function ce(H){return H.method==="item/commandExecution/requestApproval"||H.method==="execCommandApproval"}function U(H){return H.method==="item/fileChange/requestApproval"||H.method==="applyPatchApproval"}function V(H){return H.method==="item/permissions/requestApproval"}function K(H){return ce(H)||U(H)||V(H)}function ye(H){return H.method==="mcpServer/elicitation/request"}function _e(H){const W=_(H.params);return P(W==null?void 0:W.reason)||P(W==null?void 0:W.prompt)||P(W==null?void 0:W.message)}function we(H){return K(H)?y("Awaiting approval"):ye(H)?y("MCP server input required"):H.method==="item/tool/requestUserInput"?y("Awaiting response"):H.method==="item/tool/call"?y("Tool call waiting for response"):H.method}function $e(H){const W=_e(H);return W||(ce(H)?y("Do you want to run this command?"):U(H)?y("Do you want to make these changes?"):V(H)?y("Do you want to grant these permissions?"):ye(H)?y("An MCP server needs your input before Codex can continue."):H.method==="item/tool/requestUserInput"?y("Codex needs your answer before it can continue."):y("Codex is waiting for a response before it can continue."))}function de(H){var We;const W=H.trim();if(!W)return"";const Y=W.match(/-Command\s+(.+)$/i),me=((We=Y==null?void 0:Y[1])==null?void 0:We.trim())??W;return(me.startsWith('"')&&me.endsWith('"')?me.slice(1,-1):me).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function Le(H){const W=_(H.params);if(!W)return"";if(ce(H))return J(W);if(U(H)){const Y=P(W.grantRoot)||P(W.grant_root);if(Y)return Y.replace(/\s+/g," ").trim();const me=_(W.fileChanges)??_(W.changes);if(!me)return"";const Oe=Object.keys(me).map(We=>We.trim()).filter(We=>We.length>0);return Oe.length===0?"":Oe.slice(0,3).join(", ")}return V(H)?je(W.permissions):ye(H)?P(W.serverName)||P(W.url):""}function je(H){const W=_(H);if(!W)return"";const Y=[],me=_(W.fileSystem),Oe=_(W.network),We=Array.isArray(me==null?void 0:me.read)?me.read.filter(Ft=>typeof Ft=="string"):[],Ze=Array.isArray(me==null?void 0:me.write)?me.write.filter(Ft=>typeof Ft=="string"):[];return We.length>0&&Y.push(`${y("Read")}: ${We.join(", ")}`),Ze.length>0&&Y.push(`${y("Write")}: ${Ze.join(", ")}`),(Oe==null?void 0:Oe.enabled)===!0&&Y.push(y("Network access")),Y.join(" • ")}function fe(H){return!H||!K(H)?[]:[{id:"accept",label:y("Yes")},{id:"acceptForSession",label:y("Yes for Session")}]}const Te=X(()=>fe(n.request));nt(()=>{var H;return((H=n.request)==null?void 0:H.id)??0},()=>{var H;a.value="",l.value={},d.value={},h.value={},v.value="",s.value=((H=Te.value[0])==null?void 0:H.id)??"accept"},{immediate:!0}),nt(Te,H=>{var W;s.value!=="decline"&&(H.some(Y=>Y.id===s.value)||(s.value=((W=H[0])==null?void 0:W.id)??"accept"))},{immediate:!0});function xe(H,W){return`${String(H)}:${W}`}function Ae(H){const W=_(H.params),Y=Array.isArray(W==null?void 0:W.questions)?W.questions:[],me=[];for(const Oe of Y){const We=_(Oe);if(!We)continue;const Ze=P(We.id);if(!Ze)continue;const Ft=Array.isArray(We.options)?We.options.map(Nt=>_(Nt)).map(Nt=>({label:P(Nt==null?void 0:Nt.label),description:P(Nt==null?void 0:Nt.description)})).filter(Nt=>Nt.label.length>0):[];me.push({id:Ze,header:P(We.header),question:P(We.question),isOther:We.isOther===!0,options:Ft})}return me}function Ue(H,W,Y){const me=xe(H,W),Oe=l.value[me];return typeof Oe=="string"&&Oe.length>0?Oe:Y}function Ye(H,W){return d.value[xe(H,W)]??""}function He(H,W,Y){const me=xe(H,W);l.value={...l.value,[me]:Y}}function At(H){return H.options.map(W=>({value:W.label,label:W.label}))}function ct(H,W,Y){const me=Y.target;if(!(me instanceof HTMLInputElement))return;const Oe=xe(H,W);d.value={...d.value,[Oe]:me.value}}function Qe(H,W,Y){var Oe,We;const me=Ue(H,W,((Oe=Y[0])==null?void 0:Oe.label)||"");return((We=Y.find(Ze=>Ze.label===me))==null?void 0:We.description)??""}function et(H,W){return`${String(H)}:${W}`}function ft(H){var W;return P((W=_(H.params))==null?void 0:W.serverName)}function mt(H){var Y;const W=P((Y=_(H.params))==null?void 0:Y.url);if(!W)return"";try{const me=new URL(W),Oe=me.protocol.toLowerCase();return Oe==="https:"||Oe==="http:"?me.toString():""}catch{return""}}function kt(H){const W=_(H.params),Y=_(W==null?void 0:W.requestedSchema),me=_(Y==null?void 0:Y.properties);if(!me)return[];const Oe=new Set(Array.isArray(Y==null?void 0:Y.required)?Y.required.filter(We=>typeof We=="string"):[]);return Object.entries(me).map(([We,Ze])=>at(We,_(Ze),Oe.has(We))).filter(We=>We!==null)}function at(H,W,Y){if(!W)return null;const me=P(W.title)||H,Oe=P(W.description),We=P(W.type);if(We==="boolean")return{key:H,label:me,description:Oe,required:Y,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof W.default=="boolean"?W.default:null,hasExplicitDefault:typeof W.default=="boolean"};if(We==="number"||We==="integer")return{key:H,label:me,description:Oe,required:Y,kind:"number",inputType:"number",options:[],defaultValue:typeof W.default=="number"?W.default:null,hasExplicitDefault:typeof W.default=="number"};const Ze=ae(W);if(We==="array")return{key:H,label:me,description:Oe,required:Y,kind:"multiEnum",inputType:"checkbox",options:Ze,defaultValue:Array.isArray(W.default)?W.default.filter(Nt=>typeof Nt=="string"):[],hasExplicitDefault:Array.isArray(W.default)};const Ft=j(W.default);return Ze.length>0?{key:H,label:me,description:Oe,required:Y,kind:"singleEnum",inputType:"select",options:Ze,defaultValue:Ft,hasExplicitDefault:Ft!==null}:{key:H,label:me,description:Oe,required:Y,kind:"string",inputType:te(W),options:[],defaultValue:Ft,hasExplicitDefault:Ft!==null}}function ae(H){const Y=(Array.isArray(H.oneOf)?H.oneOf:Array.isArray(H.anyOf)?H.anyOf:[]).map(Ze=>_(Ze)).map(Ze=>({value:P(Ze==null?void 0:Ze.const),label:P(Ze==null?void 0:Ze.title)||P(Ze==null?void 0:Ze.const)})).filter(Ze=>Ze.value.length>0);if(Y.length>0)return Y;const me=_(H.items);if(me){const Ze=ae(me);if(Ze.length>0)return Ze}const Oe=Array.isArray(H.enum)?H.enum.filter(Ze=>typeof Ze=="string"):[],We=Array.isArray(H.enumNames)?H.enumNames.filter(Ze=>typeof Ze=="string"):[];return Oe.map((Ze,Ft)=>({value:Ze,label:We[Ft]||Ze}))}function te(H){const W=P(H.format);return W==="email"?"email":W==="uri"?"url":W==="date"?"date":W==="date-time"?"datetime-local":"text"}function oe(H,W){const Y=h.value[et(H,W.key)];return Y!==void 0?Y:W.defaultValue}function z(H,W){const Y=oe(H,W);return Array.isArray(Y)?Y.filter(me=>typeof me=="string"):[]}function Be(H,W,Y){const me=Y.target;me instanceof HTMLInputElement&&$(H,W,me.value)}function $(H,W,Y){const me=(W.kind==="number",Y);h.value={...h.value,[et(H,W.key)]:Y.length>0?me:null},v.value=""}function O(H,W,Y){let me=null;Y==="true"?me=!0:Y==="false"&&(me=!1),h.value={...h.value,[et(H,W.key)]:me},v.value=""}function G(H,W,Y,me){const Oe=me.target;if(!(Oe instanceof HTMLInputElement))return;const We=new Set(z(H,W));Oe.checked?We.add(Y):We.delete(Y),h.value={...h.value,[et(H,W.key)]:Array.from(We)},v.value=""}function ue(H){return H===!0?"true":H===!1?"false":""}function ie(H){const W=[{value:"true",label:y("True")},{value:"false",label:y("False")}];return H.hasExplicitDefault||W.unshift({value:"",label:y("Select true or false")}),W}function re(H){const W=H.options.map(Y=>({value:Y.value,label:Y.label}));return H.hasExplicitDefault||W.unshift({value:"",label:y("Select an option")}),W}function Se(H,W){const Y=oe(H,W);return W.kind==="multiEnum"?Array.isArray(Y)&&Y.length>0:W.kind==="boolean"?typeof Y=="boolean":W.kind==="number"&&typeof Y=="number"?!0:typeof Y=="string"&&Y.trim().length>0}function be(H){const W=kt(H).filter(Y=>Y.required&&!Se(H.id,Y)).map(Y=>Y.label);return W.length===0?"":W.length===1?`${y("Answer the required field")}: ${W[0]}.`:`${y("Answer the required field")}: ${W.join(", ")}.`}function pe(H){const W={};for(const Y of kt(H)){const me=oe(H.id,Y);if(Y.kind==="multiEnum"){const We=Array.isArray(me)?me:[];(We.length>0||Y.required)&&(W[Y.key]=We);continue}if(Y.kind==="boolean"){typeof me=="boolean"&&(W[Y.key]=me);continue}if(Y.kind==="number"){const We=typeof me=="number"?me:Number(String(me).trim());Number.isNaN(We)||(W[Y.key]=We);continue}const Oe=String(me??"").trim();(Oe.length>0||Y.required)&&(W[Y.key]=Oe)}return W}function se(H){s.value=H}function Ee(){s.value="decline"}function ge(H){const W=H.target;W instanceof HTMLInputElement&&(a.value=W.value,s.value="decline")}function Fe(H,W){var Y;if(V(H)){if(W==="decline"||W==="cancel"){o("respondServerRequest",{id:H.id,error:{code:-32e3,message:W==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const me=_((Y=_(H.params))==null?void 0:Y.permissions)??{};o("respondServerRequest",{id:H.id,result:{permissions:me,scope:W==="acceptForSession"?"session":"turn"}});return}o("respondServerRequest",{id:H.id,result:{decision:W}})}function Me(H){const W=a.value.trim(),Y=W.length>0?"decline":s.value;if(V(H)){Fe(H,Y);return}o("respondServerRequest",{id:H.id,result:{decision:Y},followUpMessageText:W||void 0})}function Ve(H,W){const Y=_(H.params),me={action:W};if(W==="accept"&&P(Y==null?void 0:Y.mode)==="form"){const Oe=be(H);if(Oe){v.value=Oe;return}me.content=pe(H)}o("respondServerRequest",{id:H.id,result:me})}function rt(H){var me;const W=Ae(H),Y={};for(const Oe of W){const We=Ue(H.id,Oe.id,((me=Oe.options[0])==null?void 0:me.label)||""),Ze=Ye(H.id,Oe.id).trim(),Ft=[We,Ze].map(Nt=>Nt.trim()).filter(Nt=>Nt.length>0);Y[Oe.id]={answers:Ft}}o("respondServerRequest",{id:H.id,result:{answers:Y}})}function gt(H){o("respondServerRequest",{id:H.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function It(H){o("respondServerRequest",{id:H.id,result:{success:!0,contentItems:[]}})}function Tt(H){o("respondServerRequest",{id:H.id,result:{}})}function Tn(H){o("respondServerRequest",{id:H.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(H,W)=>(S(),tt(Xs,{to:"body"},[e.request?(S(),I("section",{key:0,class:"thread-pending-request",style:kr(r.value)},[p("article",{class:Ke(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[K(e.request)?(S(),I(ze,{key:0},[p("p",KR,T($e(e.request)),1),Le(e.request)?(S(),I("p",{key:0,class:"thread-pending-request-command-line",title:Le(e.request)},T(Le(e.request)),9,YR)):ee("",!0),p("section",JR,[p("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":g(y)("Approval choices")},[(S(!0),I(ze,null,_t(Te.value,(Y,me)=>(S(),I("button",{key:Y.id,type:"button",class:Ke(["thread-pending-request-option",{"is-selected":s.value===Y.id}]),"aria-pressed":s.value===Y.id,onClick:Oe=>se(Y.id)},[p("span",ZR,T(me+1)+".",1),p("span",eM,T(Y.label),1)],10,XR))),128))],8,QR),p("footer",tM,[p("label",{class:Ke(["thread-pending-request-inline-input",{"is-active":s.value==="decline"||a.value.length>0}])},[W[11]||(W[11]=p("span",{class:"thread-pending-request-option-index"},"3.",-1)),p("input",{class:"thread-pending-request-inline-control",type:"text",value:a.value,placeholder:g(y)("No, and tell Codex what to do differently"),onFocus:Ee,onInput:ge,onKeydown:W[0]||(W[0]=An(lt(Y=>Me(e.request),["prevent"]),["enter"]))},null,40,nM)],2),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:W[1]||(W[1]=Y=>Fe(e.request,"cancel"))},T(g(y)("Skip")),1),p("button",{type:"button",class:"thread-pending-request-primary",onClick:W[2]||(W[2]=Y=>Me(e.request))},T(g(y)("Send")),1)]),e.panelError?(S(),I("p",oM,T(e.panelError),1)):ee("",!0)])],64)):(S(),I(ze,{key:1},[p("header",rM,[p("div",aM,[p("p",sM,T(we(e.request)),1),p("p",iM,T($e(e.request)),1)]),(e.requestCount??0)>1?(S(),I("span",lM,T(e.requestCount??0)+" "+T(g(y)("pending")),1)):ee("",!0)]),Le(e.request)?(S(),I("div",cM,[p("code",uM,T(Le(e.request)),1)])):ee("",!0),e.panelError?(S(),I("p",dM,T(e.panelError),1)):ee("",!0),e.request.method==="mcpServer/elicitation/request"?(S(),I("section",fM,[ft(e.request)?(S(),I("p",pM,T(g(y)("Server"))+": "+T(ft(e.request)),1)):ee("",!0),mt(e.request)?(S(),I("a",{key:1,class:"thread-pending-request-link",href:mt(e.request),target:"_blank",rel:"noopener noreferrer"},T(g(y)("Open authorization link")),9,hM)):ee("",!0),(S(!0),I(ze,null,_t(kt(e.request),Y=>(S(),I("div",{key:`${e.request.id}:${Y.key}`,class:"thread-pending-request-question"},[p("p",mM,[ps(T(Y.label),1),Y.required?(S(),I("span",vM," *")):ee("",!0)]),Y.description?(S(),I("p",gM,T(Y.description),1)):ee("",!0),Y.kind==="string"||Y.kind==="number"?(S(),I("label",yM,[p("span",wM,T(g(y)("Value")),1),p("input",{class:"thread-pending-request-input",type:Y.inputType,value:String(oe(e.request.id,Y)??""),onInput:me=>Be(e.request.id,Y,me)},null,40,bM)])):Y.kind==="boolean"?(S(),I("div",kM,[p("span",CM,T(g(y)("Choice")),1),Ie(or,{class:"thread-pending-request-dropdown","model-value":ue(oe(e.request.id,Y)),options:ie(Y),placeholder:g(y)("Select true or false"),"onUpdate:modelValue":me=>O(e.request.id,Y,me)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):Y.kind==="singleEnum"?(S(),I("div",TM,[p("span",SM,T(g(y)("Choice")),1),Ie(or,{class:"thread-pending-request-dropdown","model-value":String(oe(e.request.id,Y)??""),options:re(Y),placeholder:g(y)("Select an option"),"enable-search":"","search-placeholder":g(y)("Search options..."),"onUpdate:modelValue":me=>$(e.request.id,Y,me)},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])])):(S(),I("div",_M,[(S(!0),I(ze,null,_t(Y.options,me=>(S(),I("label",{key:`${e.request.id}:${Y.key}:${me.value}`,class:"thread-pending-request-checkbox-row"},[p("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:z(e.request.id,Y).includes(me.value),onChange:Oe=>G(e.request.id,Y,me.value,Oe)},null,40,xM),p("span",AM,T(me.label),1)]))),128))]))]))),128)),v.value?(S(),I("p",PM,T(v.value),1)):ee("",!0),p("footer",IM,[p("button",{type:"button",class:"thread-pending-request-secondary",onClick:W[3]||(W[3]=Y=>Ve(e.request,"cancel"))},T(g(y)("Cancel")),1),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:W[4]||(W[4]=Y=>Ve(e.request,"decline"))},T(g(y)("Decline")),1),p("button",{type:"button",class:"thread-pending-request-primary",onClick:W[5]||(W[5]=Y=>Ve(e.request,"accept"))},T(g(y)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(S(),I("section",EM,[(S(!0),I(ze,null,_t(Ae(e.request),Y=>{var me;return S(),I("div",{key:`${e.request.id}:${Y.id}`,class:"thread-pending-request-question"},[p("p",RM,T(Y.header||Y.question),1),Y.question?(S(),I("p",MM,T(Y.question),1)):ee("",!0),Y.options.length>0?(S(),I("div",$M,[p("div",jM,[p("span",LM,T(g(y)("Choice")),1),Ie(or,{class:"thread-pending-request-dropdown","model-value":Ue(e.request.id,Y.id,((me=Y.options[0])==null?void 0:me.label)||""),options:At(Y),placeholder:g(y)("Choice"),"onUpdate:modelValue":Oe=>He(e.request.id,Y.id,Oe)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),Qe(e.request.id,Y.id,Y.options)?(S(),I("p",NM,T(Qe(e.request.id,Y.id,Y.options)),1)):ee("",!0)])):ee("",!0),Y.isOther?(S(),I("label",OM,[p("span",DM,T(g(y)("Other answer")),1),p("input",{class:"thread-pending-request-input",type:"text",value:Ye(e.request.id,Y.id),placeholder:g(y)("Other answer"),onInput:Oe=>ct(e.request.id,Y.id,Oe)},null,40,FM)])):ee("",!0)])}),128)),p("footer",UM,[p("button",{type:"button",class:"thread-pending-request-primary",onClick:W[6]||(W[6]=Y=>rt(e.request))},T(g(y)("Send")),1)])])):e.request.method==="item/tool/call"?(S(),I("section",BM,[p("button",{type:"button",class:"thread-pending-request-primary",onClick:W[7]||(W[7]=Y=>gt(e.request))},T(g(y)("Fail Tool Call")),1),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:W[8]||(W[8]=Y=>It(e.request))},T(g(y)("Success (Empty)")),1)])):(S(),I("section",qM,[p("button",{type:"button",class:"thread-pending-request-primary",onClick:W[9]||(W[9]=Y=>Tt(e.request))},T(g(y)("Return Empty Result")),1),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:W[10]||(W[10]=Y=>Tn(e.request))},T(g(y)("Reject Request")),1)]))],64))],2)],4)):ee("",!0)]))}}),HM=bt(zM,[["__scopeId","data-v-1f49cff5"]]),WM={key:0,class:"queued-messages"},VM={class:"queued-messages-inner"},GM=["onDragstart","onDragover","onDragleave","onDrop"],KM=["aria-label","title"],YM={class:"queued-row-text"},JM={key:0,class:"queued-row-badge"},QM={class:"queued-row-actions"},XM=["title","onClick"],ZM=["title","onClick"],e$=["aria-label","title","onClick"],t$=tn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:o}=io(),r=A(""),s=A("");function a(_,P){var j;r.value=P,s.value="",(j=_.dataTransfer)==null||j.setData("text/plain",P),_.dataTransfer&&(_.dataTransfer.effectAllowed="move")}function l(_){!r.value||r.value===_||(s.value=_)}function d(_){s.value===_&&(s.value="")}function h(_){const P=r.value;v(),!(!P||P===_)&&n("reorder",{draggedId:P,targetId:_})}function v(){r.value="",s.value=""}function y(_){var U,V,K;const P=_.text.trim();if(P)return P;const j=[],B=((U=_.imageUrls)==null?void 0:U.length)??0,J=((V=_.fileAttachments)==null?void 0:V.length)??0,ce=((K=_.skills)==null?void 0:K.length)??0;return B>0&&j.push(`${B} ${o(B===1?"image":"images")}`),J>0&&j.push(`${J} ${o(J===1?"file":"files")}`),ce>0&&j.push(`${ce} ${o(ce===1?"skill":"skills")}`),j.join(", ")||o("(empty queued message)")}return(_,P)=>e.messages.length>0?(S(),I("div",WM,[p("div",VM,[(S(!0),I(ze,null,_t(e.messages,j=>(S(),I("div",{key:j.id,class:Ke(["queued-row",{"is-dragging":r.value===j.id,"is-drop-target":s.value===j.id&&r.value!==j.id}]),draggable:"true",onDragstart:B=>a(B,j.id),onDragover:lt(B=>l(j.id),["prevent"]),onDragleave:B=>d(j.id),onDrop:lt(B=>h(j.id),["prevent"]),onDragend:v},[p("button",{class:"queued-row-drag",type:"button","aria-label":g(o)("Drag to reorder queued message"),title:g(o)("Drag to reorder queued message")},[...P[0]||(P[0]=[p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("path",{fill:"currentColor",d:"M9 5.5A1.5 1.5 0 1 1 6 5.5a1.5 1.5 0 0 1 3 0m0 6.5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8A1.5 1.5 0 1 0 7.5 17a1.5 1.5 0 0 0 0 3m10-13A1.5 1.5 0 1 0 17.5 4a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"})],-1)])],8,KM),P[2]||(P[2]=p("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),p("span",YM,T(y(j)),1),j.awaitingCompaction?(S(),I("span",JM,T(g(o)("Compacts context before send")),1)):ee("",!0),p("div",QM,[p("button",{class:"queued-row-edit",type:"button",title:g(o)("Edit queued message"),onClick:B=>_.$emit("edit",j.id)},T(g(o)("Edit")),9,XM),p("button",{class:"queued-row-steer",type:"button",title:g(o)("Send now without interrupting work"),onClick:B=>_.$emit("steer",j.id)},T(g(o)("Steer")),9,ZM),p("button",{class:"queued-row-delete",type:"button","aria-label":g(o)("Delete queued message"),title:g(o)("Delete queued message"),onClick:B=>_.$emit("delete",j.id)},[...P[1]||(P[1]=[p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("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"})],-1)])],8,e$)])],42,GM))),128))])])):ee("",!0)}}),n$=bt(t$,[["__scopeId","data-v-631d6962"]]),o$={key:0,class:"rate-limit-status","aria-live":"polite"},r$=["title"],a$={class:"rate-limit-card-header"},s$={class:"rate-limit-card-title"},i$={key:0,class:"rate-limit-card-plan"},l$={class:"rate-limit-card-metrics"},c$={key:0,class:"rate-limit-card-footer"},u$=tn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){const{t}=io();function n(U){var V,K;return((V=U.limitId)==null?void 0:V.trim())||((K=U.limitName)==null?void 0:K.trim())||"__default__"}function o(U){var V,K;return((V=U.limitName)==null?void 0:V.trim())||((K=U.limitId)==null?void 0:K.trim())||t("Rate limits")}function r(U){const V=U.trim();return V?V.replace(/[_-]+/g," ").replace(/\b\w/g,K=>K.toUpperCase()):""}function s(U){return!U||U<=0?t("Window"):U%1440===0?`${U/1440}d`:U%60===0?`${U/60}h`:U<60?`${U}m`:`${Math.round(U/60*10)/10}h`}function a(U){const V=Math.max(0,Math.min(100,100-U));return`${Math.round(V)}% ${t("left")}`}function l(U){return`${Math.round(U)}%`}function d(U,V){return{key:V,label:`${s(U.windowDurationMins)} ${a(U.usedPercent)}`}}function h(U){const V=[];return U.primary&&V.push(d(U.primary,"primary")),U.secondary&&V.push(d(U.secondary,"secondary")),V}function v(U){if(!U)return"";const V=new Date(U*1e3),K=V.getMonth()+1,ye=String(V.getDate()).padStart(2,"0"),_e=String(V.getHours()).padStart(2,"0"),we=String(V.getMinutes()).padStart(2,"0");return`${K}.${ye} ${_e}:${we}`}function y(U){if(!(U!=null&&U.resetsAt))return"";const V=U.resetsAt*1e3-Date.now();if(V<=0)return t("Resetting now");const K=Math.round(V/6e4);if(K<60)return`${t("Resets in")} ${K}m`;const ye=Math.round(K/60);if(ye<24)return`${t("Resets in")} ${ye}h`;const _e=Math.round(ye/24);return`${t("Resets in")} ${_e}d`}function _(U){return[U.primary,U.secondary].filter(V=>V!==null)}function P(U){const V=_(U);return V.length===0?null:[...V].sort((K,ye)=>{const _e=K.windowDurationMins??Number.MAX_SAFE_INTEGER,we=ye.windowDurationMins??Number.MAX_SAFE_INTEGER;return _e!==we?_e-we:(K.resetsAt??Number.MAX_SAFE_INTEGER)-(ye.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function j(U){const V=_(U);if(V.length===0)return"";const K=[...V].sort((_e,we)=>{const $e=_e.windowDurationMins??-1,de=we.windowDurationMins??-1;return $e!==de?de-$e:(we.resetsAt??-1)-(_e.resetsAt??-1)})[0],ye=v(K.resetsAt);return ye||""}function B(U){const V=U.credits;return V?V.unlimited?t("Unlimited credits"):V.balance?`${t("Credits")} ${V.balance}`:V.hasCredits?t("Credits available"):"":""}function J(U){return[y(P(U)),j(U),B(U)].filter(V=>V.length>0)}function ce(U){const V=[o(U)];for(const K of h(U))V.push(K.label);for(const K of _(U))V.push(`${s(K.windowDurationMins)} used ${l(K.usedPercent)}`);for(const K of J(U))V.push(K);return V.join(`
|
|
62
|
+
`)}return(U,V)=>e.snapshots.length>0?(S(),I("aside",o$,[(S(!0),I(ze,null,_t(e.snapshots,K=>(S(),I("div",{key:n(K),class:"rate-limit-card",title:ce(K)},[p("div",a$,[p("span",s$,T(o(K)),1),K.planType?(S(),I("span",i$,T(r(K.planType)),1)):ee("",!0)]),p("div",l$,[(S(!0),I(ze,null,_t(h(K),ye=>(S(),I("span",{key:ye.key,class:"rate-limit-card-metric"},T(ye.label),1))),128))]),J(K).length>0?(S(),I("div",c$,T(J(K).join(" | ")),1)):ee("",!0)],8,r$))),128))])):ee("",!0)}}),d$=bt(u$,[["__scopeId","data-v-1fd5e1ec"]]),f$=["aria-label"],p$=["aria-checked","onClick"],h$={class:"runtime-toggle-option-label"},m$=tn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=io(),r=[{value:"local",label:o("Local project"),icon:_p},{value:"worktree",label:o("New worktree"),icon:Gu}];function s(a){n("update:modelValue",a)}return(a,l)=>(S(),I("div",{class:"runtime-toggle",role:"radiogroup","aria-label":g(o)("Continue in")},[(S(),I(ze,null,_t(r,d=>p("button",{key:d.value,class:Ke(["runtime-toggle-option",{"is-selected":e.modelValue===d.value}]),type:"button",role:"radio","aria-checked":e.modelValue===d.value,onClick:h=>s(d.value)},[(S(),tt(cp(d.icon),{class:"runtime-toggle-option-icon"})),p("span",h$,T(d.label),1)],10,p$)),64))],8,f$))}}),v$=bt(m$,[["__scopeId","data-v-4d282f1a"]]),g$={},y$={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 w$(e,t){return S(),I("svg",y$,[...t[0]||(t[0]=[p("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),p("path",{d:"M9 4l0 16"},null,-1)])])}const Ny=bt(g$,[["render",w$]]),b$={},k$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function C$(e,t){return S(),I("svg",k$,[...t[0]||(t[0]=[p("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 T$=bt(b$,[["render",C$]]),S$={class:"sidebar-thread-controls"},_$=["aria-label","title"],x$=["aria-label","title"],A$=tn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=io();return(n,o)=>(S(),I("div",S$,[p("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),title:e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),onClick:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(S(),tt(T$,{key:0,class:"sidebar-thread-controls-icon"})):(S(),tt(Ny,{key:1,class:"sidebar-thread-controls-icon"}))],8,_$),rr(n.$slots,"default",{},void 0),e.showNewThreadButton?(S(),I("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":g(t)("Start new thread"),title:g(t)("Start new thread"),onClick:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Ie(Bi,{class:"sidebar-thread-controls-icon"})],8,x$)):ee("",!0)]))}}),ev=bt(A$,[["__scopeId","data-v-39c4ec05"]]),P$={class:"sidebar-settings-account-section"},I$={class:"sidebar-settings-account-header"},E$={class:"sidebar-settings-account-header-main"},R$=["aria-expanded","title"],M$={class:"sidebar-settings-account-collapse-icon"},$$={class:"sidebar-settings-account-title"},j$={class:"sidebar-settings-account-count"},L$=["disabled"],N$={key:0,class:"sidebar-settings-account-error visible-error-with-feedback"},O$=["href"],D$={class:"sidebar-settings-account-login"},F$=["disabled"],U$=["href"],B$={key:1,class:"sidebar-settings-account-empty"},q$={key:2,class:"sidebar-settings-account-list"},z$=["title","onMouseenter","onMouseleave"],H$={class:"sidebar-settings-account-main"},W$={class:"sidebar-settings-account-email"},V$={class:"sidebar-settings-account-meta"},G$={class:"sidebar-settings-account-quota"},K$={class:"sidebar-settings-account-id"},Y$={class:"sidebar-settings-account-actions"},J$=["disabled","onClick"],Q$=["disabled","onClick"],X$=tn({__name:"SettingsAccountsPanel",props:{accounts:{},isAccountsSectionCollapsed:{type:Boolean},isRefreshingAccounts:{type:Boolean},isSwitchingAccounts:{type:Boolean},isStartingCodexLogin:{type:Boolean},isCompletingCodexLogin:{type:Boolean},accountActionError:{},codexLoginUrl:{},feedbackMailto:{},isAccountUnavailable:{type:Function},isRemoveConfirmationActive:{type:Function},isRemoveVisible:{type:Function},buildAccountTitle:{type:Function},formatAccountMeta:{type:Function},formatAccountQuota:{type:Function},shortAccountId:{type:Function},isAccountActionDisabled:{type:Function},getAccountSwitchLabel:{type:Function},getAccountRemoveLabel:{type:Function},onRefreshAccounts:{type:Function},onStartCodexLogin:{type:Function},onSwitchAccount:{type:Function},onRemoveAccount:{type:Function},onAccountCardPointerEnter:{type:Function},onAccountCardPointerLeave:{type:Function},toggleAccountsSectionCollapsed:{type:Function},prepareFeedbackLink:{type:Function}},setup(e){const{t}=io();return(n,o)=>(S(),I("div",P$,[p("div",I$,[p("div",E$,[p("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!e.isAccountsSectionCollapsed,title:e.isAccountsSectionCollapsed?g(t)("Expand accounts"):g(t)("Collapse accounts"),onClick:o[0]||(o[0]=(...r)=>e.toggleAccountsSectionCollapsed&&e.toggleAccountsSectionCollapsed(...r))},[p("span",M$,T(e.isAccountsSectionCollapsed?"▸":"▾"),1)],8,R$),p("span",$$,T(g(t)("Accounts")),1),p("span",j$,T(e.accounts.length),1)]),p("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:e.isRefreshingAccounts||e.isSwitchingAccounts||e.isStartingCodexLogin||e.isCompletingCodexLogin,onClick:o[1]||(o[1]=(...r)=>e.onRefreshAccounts&&e.onRefreshAccounts(...r))},T(e.isRefreshingAccounts?g(t)("Reloading…"):g(t)("Reload")),9,L$)]),e.isAccountsSectionCollapsed?ee("",!0):(S(),I(ze,{key:0},[e.accountActionError?(S(),I("div",N$,[p("span",null,T(e.accountActionError),1),p("a",{class:"visible-error-feedback",href:e.feedbackMailto,onClick:o[2]||(o[2]=r=>e.prepareFeedbackLink(r,e.accountActionError))},T(g(t)("Send feedback")),9,O$)])):ee("",!0),p("div",D$,[p("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:e.isRefreshingAccounts||e.isSwitchingAccounts||e.isStartingCodexLogin||e.isCompletingCodexLogin,onClick:o[3]||(o[3]=(...r)=>e.onStartCodexLogin&&e.onStartCodexLogin(...r))},T(e.isStartingCodexLogin?g(t)("Starting login…"):g(t)("Login")),9,F$),e.codexLoginUrl?(S(),I("a",{key:0,class:"sidebar-settings-account-login-link",href:e.codexLoginUrl,target:"_blank",rel:"noreferrer"},T(g(t)("Open login URL")),9,U$)):ee("",!0)]),e.accounts.length===0?(S(),I("p",B$,T(g(t)("Click Login, or run `codex login`, then click reload.")),1)):(S(),I("div",q$,[(S(!0),I(ze,null,_t(e.accounts,r=>(S(),I("article",{key:r.storageId,class:Ke(["sidebar-settings-account-item",{"is-active":r.isActive,"is-unavailable":e.isAccountUnavailable(r),"is-confirming-remove":e.isRemoveConfirmationActive(r),"is-remove-visible":e.isRemoveVisible(r)}]),title:e.buildAccountTitle(r),onMouseenter:s=>e.onAccountCardPointerEnter(r.storageId),onMouseleave:s=>e.onAccountCardPointerLeave(r.storageId)},[p("div",H$,[p("p",W$,T(r.email||g(t)("Account")),1),p("p",V$,T(e.formatAccountMeta(r)),1),p("p",G$,T(e.formatAccountQuota(r)),1),p("p",K$," Workspace "+T(e.shortAccountId(r.accountId)),1)]),p("div",Y$,[p("button",{class:"sidebar-settings-account-switch",type:"button",disabled:e.isAccountActionDisabled(r)||r.isActive||e.isAccountUnavailable(r),onClick:s=>e.onSwitchAccount(r.storageId)},T(e.getAccountSwitchLabel(r)),9,J$),p("button",{class:Ke(["sidebar-settings-account-remove",{"is-visible":e.isRemoveVisible(r),"is-confirming":e.isRemoveConfirmationActive(r)}]),type:"button",disabled:e.isAccountActionDisabled(r),onClick:s=>e.onRemoveAccount(r.storageId)},T(e.getAccountRemoveLabel(r)),11,Q$)])],42,z$))),128))]))],64))]))}}),Z$=bt(X$,[["__scopeId","data-v-acc2fdca"]]);function ej(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 Oy(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!ej(e))throw new Error("Copy failed")}const tj={class:"right-git-panel"},nj={class:"rgp-review-label"},oj={class:"rgp-review-delta"},rj={class:"rgp-added"},aj={class:"rgp-removed"},sj={class:"rgp-state"},ij={class:"rgp-state-label"},lj={class:"rgp-state-value"},cj={key:0,class:"rgp-state-meta"},uj=["href"],dj={key:2,class:"rgp-section"},fj={class:"rgp-section-title"},pj={class:"rgp-file-list"},hj=["title","onClick"],mj={class:"rgp-file-status"},vj={class:"rgp-file-path"},gj={key:0,class:"rgp-file-previous-path"},yj={class:"rgp-section"},wj={class:"rgp-section-title"},bj={class:"rgp-search-wrap"},kj=["placeholder"],Cj={class:"rgp-branches",role:"listbox"},Tj={class:"rgp-branch-row"},Sj=["disabled","onClick"],_j={class:"rgp-branch-name"},xj={key:0,class:"rgp-branch-meta"},Aj={key:1,class:"rgp-branch-meta"},Pj=["disabled","onClick"],Ij={key:0,class:"rgp-empty"},Ej={class:"rgp-section"},Rj={class:"rgp-section-title"},Mj={class:"rgp-search-wrap"},$j=["placeholder"],jj={class:"rgp-toggle-row"},Lj={class:"rgp-commit-list"},Nj={key:0,class:"rgp-empty"},Oj={key:1,class:"rgp-empty"},Dj={key:2,class:"rgp-empty is-error"},Fj=["disabled","title","onClick"],Uj={class:"rgp-commit-top"},Bj=["title","onClick","onKeydown"],qj={class:"rgp-commit-meta"},zj={key:0,class:"rgp-branch-meta"},Hj={class:"rgp-commit-subject"},Wj={key:0,class:"rgp-empty"},Vj={key:3,class:"rgp-section"},Gj={class:"rgp-section-title"},Kj=["title"],Yj=["disabled"],Jj={class:"rgp-commit-detail-subject"},Qj={class:"rgp-file-list"},Xj={key:0,class:"rgp-empty"},Zj={key:1,class:"rgp-empty is-error"},eL=["title","onClick"],tL={class:"rgp-file-meta-row"},nL={class:"rgp-file-status"},oL={class:"rgp-file-delta"},rL={class:"rgp-added"},aL={class:"rgp-removed"},sL={class:"rgp-file-path"},iL={key:0,class:"rgp-file-previous-path"},lL={key:0,class:"rgp-empty"},cL=tn({__name:"RightGitPanel",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},worktreeChangeSummary:{},worktreeChanges:{},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},commitFilesBySha:{},commitFilesLoadingFor:{},commitFilesError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits","loadCommitFiles","openCommitFile"],setup(e,{emit:t}){const n=e,o=t,r=A(null),s=A(""),a=A(""),l=A(""),d=A(""),h=A(""),v=A(""),y=A(!0),_=X(()=>n.showReview!==!1),{buildFeedbackMailto:P,feedbackMailtoBase:j,recordVisibleFailure:B}=xp(),{t:J}=io(),ce=j();function U(te,oe){B(oe);const z=te.currentTarget;z instanceof HTMLAnchorElement&&(z.href=P())}const V=X(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`${J("Detached")} ${n.headSha}`:n.loading?J("Loading branch..."):J("Detached HEAD")),K=X(()=>{var z;const te=[n.headSha,n.headDate].filter(Boolean).join(" · "),oe=((z=n.headSubject)==null?void 0:z.trim())??"";return oe&&te?`${oe} (${te})`:oe||te}),ye=X(()=>n.busy||n.loading),_e=X(()=>n.error||(n.dirty?J("Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them."):"")),we=X(()=>n.error?"error":"info"),$e=X(()=>{const te=s.value.trim().toLowerCase(),oe=[...n.branches].sort((z,Be)=>z.isRemote===!0&&Be.isRemote!==!0?1:z.isRemote!==!0&&Be.isRemote===!0?-1:0);return te?oe.filter(z=>z.label.toLowerCase().includes(te)||z.value.toLowerCase().includes(te)):oe}),de=X(()=>n.branches.find(te=>te.value===l.value)??null),Le=X(()=>{var te;return((te=de.value)==null?void 0:te.isRemote)===!0}),je=X(()=>l.value?`${l.value}\0${y.value?"with-reset-history":"without-reset-history"}`:""),fe=X(()=>je.value?n.commitsByBranch[je.value]||[]:[]),Te=X(()=>fe.value.find(te=>te.sha===d.value)??null),xe=X(()=>Te.value?n.commitFilesBySha[Te.value.sha]||[]:[]),Ae=X(()=>{const te=a.value.trim().toLowerCase(),oe=fe.value;return te?oe.filter(z=>z.sha.toLowerCase().includes(te)||z.shortSha.toLowerCase().includes(te)||z.subject.toLowerCase().includes(te)||z.date.toLowerCase().includes(te)):oe});function Ue(te){l.value=te,d.value="",o("loadCommits",{branch:te,includeResetHistory:y.value})}function Ye(){l.value&&o("loadCommits",{branch:l.value,includeResetHistory:y.value})}function He(te){var z;const oe=((z=n.headSha)==null?void 0:z.trim())??"";return oe?te.sha===oe||te.shortSha===oe||te.sha.startsWith(oe):!1}function At(te){return`${J("Show")} ${te.shortSha} ${J("files")}`}function ct(te){d.value=te.sha,o("loadCommitFiles",te.sha)}function Qe(te){const oe=te.sha.trim()||te.shortSha.trim();oe&&(h.value=te.sha,Oy(oe).catch(()=>{h.value=""}))}function et(){!l.value||!Te.value||Le.value||o("resetBranchToCommit",{branch:l.value,sha:Te.value.sha})}function ft(te){return typeof te=="number"&&Number.isFinite(te)?String(te):"-"}function mt(te){Te.value&&o("openCommitFile",{sha:Te.value.sha,path:te})}function kt(te){n.headSha&&o("openCommitFile",{sha:n.headSha,path:te})}function at(){var oe,z;const te=(oe=n.currentBranch)==null?void 0:oe.trim();return te||(((z=n.branches[0])==null?void 0:z.value)??"")}function ae(){const te=l.value||at();te&&(l.value=te,o("loadCommits",{branch:te,includeResetHistory:y.value}))}return ws(()=>{ae(),Wt(()=>{var te;return(te=r.value)==null?void 0:te.focus()})}),nt(()=>[n.currentBranch,n.branches.map(te=>te.value).join(`
|
|
63
|
+
`)],()=>{var Be;const te=at();if(!te){l.value="",v.value="";return}const oe=((Be=n.currentBranch)==null?void 0:Be.trim())??"",z=oe!==v.value;v.value=oe,(z||!l.value||!n.branches.some($=>$.value===l.value))&&(l.value=te),l.value&&o("loadCommits",{branch:l.value,includeResetHistory:y.value})},{immediate:!0}),nt(fe,te=>{d.value&&(te.some(oe=>oe.sha===d.value)||(d.value=""))}),(te,oe)=>(S(),I("div",tj,[_.value?(S(),I("button",{key:0,class:"rgp-review",type:"button",onClick:oe[0]||(oe[0]=z=>o("toggleReview"))},[Ie(Bi,{class:"rgp-review-icon"}),p("span",nj,T(e.reviewOpen?g(J)("Review Worktree Changes (Open)"):g(J)("Review Worktree Changes")),1),p("span",oj,[p("span",rj,"+"+T(e.worktreeChangeSummary.addedLineCount),1),p("span",aj,"-"+T(e.worktreeChangeSummary.removedLineCount),1)])])):ee("",!0),p("div",sj,[p("span",ij,T(e.detached?g(J)("Detached HEAD"):g(J)("Current branch")),1),p("span",lj,T(V.value),1),K.value?(S(),I("span",cj,T(K.value),1)):ee("",!0)]),_e.value?(S(),I("div",{key:1,class:Ke(["rgp-status",{"is-error":we.value==="error"}])},[p("span",null,T(_e.value),1),we.value==="error"?(S(),I("a",{key:0,class:"rgp-feedback",href:g(ce),onClick:oe[1]||(oe[1]=z=>U(z,_e.value))},T(g(J)("Send feedback")),9,uj)):ee("",!0)],2)):ee("",!0),n.worktreeChanges.length>0?(S(),I("div",dj,[p("div",fj,T(n.worktreeChanges.length)+" "+T(n.worktreeChanges.length===1?g(J)("file changed"):g(J)("files changed")),1),p("div",pj,[(S(!0),I(ze,null,_t(n.worktreeChanges,z=>(S(),I("button",{key:`${z.status}:${z.previousPath??""}:${z.path}`,class:"rgp-file",type:"button",title:z.previousPath?`${z.previousPath} → ${z.path}`:z.path,onClick:Be=>kt(z.path)},[p("span",mj,T(z.label),1),p("span",vj,T(z.path),1),z.previousPath?(S(),I("span",gj,"← "+T(z.previousPath),1)):ee("",!0)],8,hj))),128))])])):ee("",!0),p("div",yj,[p("div",wj,T(g(J)("Branches")),1),p("div",bj,[Lt(p("input",{ref_key:"searchInputRef",ref:r,"onUpdate:modelValue":oe[2]||(oe[2]=z=>s.value=z),class:"rgp-search",type:"text",placeholder:g(J)("Search branches...")},null,8,kj),[[an,s.value]])]),p("ul",Cj,[(S(!0),I(ze,null,_t($e.value,z=>(S(),I("li",{key:z.value,class:"rgp-branch-item"},[p("div",Tj,[p("button",{class:Ke(["rgp-branch-button",{"is-current":z.value===e.currentBranch,"is-selected":z.value===l.value}]),type:"button",disabled:ye.value,onClick:Be=>Ue(z.value)},[p("span",_j,T(z.label),1),z.value===e.currentBranch?(S(),I("span",xj,T(g(J)("current")),1)):z.isRemote?(S(),I("span",Aj,T(g(J)("remote")),1)):ee("",!0)],10,Sj),z.value===l.value&&z.value!==e.currentBranch&&!z.isRemote?(S(),I("button",{key:0,class:"rgp-branch-checkout",type:"button",disabled:ye.value,onClick:Be=>o("checkoutBranch",z.value)},T(g(J)("Checkout")),9,Pj)):ee("",!0)])]))),128)),$e.value.length===0?(S(),I("li",Ij,T(g(J)("No branches found.")),1)):ee("",!0)])]),p("div",Ej,[p("div",Rj,T(g(J)("Commits")),1),p("div",Mj,[Lt(p("input",{"onUpdate:modelValue":oe[3]||(oe[3]=z=>a.value=z),class:"rgp-search",type:"text",placeholder:g(J)("Search commits...")},null,8,$j),[[an,a.value]])]),p("label",jj,[Lt(p("input",{"onUpdate:modelValue":oe[4]||(oe[4]=z=>y.value=z),type:"checkbox",onChange:Ye},null,544),[[Gg,y.value]]),p("span",null,T(g(J)("Reset-history refs")),1)]),p("div",Lj,[l.value?e.commitsLoadingFor===je.value?(S(),I("div",Oj,T(g(J)("Loading commits...")),1)):e.commitsError?(S(),I("div",Dj,T(e.commitsError),1)):(S(),I(ze,{key:3},[(S(!0),I(ze,null,_t(Ae.value,z=>(S(),I("button",{key:z.sha,class:Ke(["rgp-commit",{"is-current":He(z),"is-selected":z.sha===d.value}]),type:"button",disabled:ye.value,title:At(z),onClick:Be=>ct(z)},[p("span",Uj,[p("span",{class:"rgp-ref",role:"button",tabindex:"0",title:h.value===z.sha?g(J)("Copied commit ref"):`${g(J)("Copy")} ${z.sha}`,onClick:lt(Be=>Qe(z),["stop"]),onKeydown:[An(lt(Be=>Qe(z),["prevent","stop"]),["enter"]),An(lt(Be=>Qe(z),["prevent","stop"]),["space"])]},T(z.shortSha),41,Bj),p("span",qj,[He(z)?(S(),I("span",zj,T(g(J)("current")),1)):ee("",!0),p("span",null,T(z.date),1)])]),p("span",Hj,T(z.subject),1)],10,Fj))),128)),Ae.value.length===0?(S(),I("div",Wj,T(g(J)("No commits found.")),1)):ee("",!0)],64)):(S(),I("div",Nj,T(g(J)("Select a branch.")),1))])]),Te.value?(S(),I("div",Vj,[p("div",Gj,[p("span",{class:"rgp-ref",role:"button",tabindex:"0",title:h.value===Te.value.sha?g(J)("Copied commit ref"):`${g(J)("Copy")} ${Te.value.sha}`,onClick:oe[5]||(oe[5]=lt(z=>Qe(Te.value),["stop"])),onKeydown:oe[6]||(oe[6]=An(lt(z=>Qe(Te.value),["prevent","stop"]),["enter"]))},T(Te.value.shortSha),41,Kj),p("button",{class:"rgp-reset-commit",type:"button",disabled:ye.value||Le.value||!l.value,onClick:et},T(g(J)("Reset")),9,Yj)]),p("p",Jj,T(Te.value.subject),1),p("div",Qj,[e.commitFilesLoadingFor===Te.value.sha?(S(),I("div",Xj,T(g(J)("Loading files...")),1)):e.commitFilesError?(S(),I("div",Zj,T(e.commitFilesError),1)):(S(),I(ze,{key:2},[(S(!0),I(ze,null,_t(xe.value,z=>(S(),I("button",{key:`${z.status}:${z.previousPath??""}:${z.path}`,class:"rgp-file",type:"button",title:z.previousPath?`${z.previousPath} → ${z.path}`:z.path,onClick:Be=>mt(z.path)},[p("span",tL,[p("span",nL,T(z.label),1),p("span",oL,[p("span",rL,"+"+T(ft(z.addedLineCount)),1),p("span",aL,"-"+T(ft(z.removedLineCount)),1)])]),p("span",sL,T(z.path),1),z.previousPath?(S(),I("span",iL,"← "+T(z.previousPath),1)):ee("",!0)],8,eL))),128)),xe.value.length===0?(S(),I("div",lL,T(g(J)("No file changes.")),1)):ee("",!0)],64))])])):ee("",!0)]))}}),uL=bt(cL,[["__scopeId","data-v-76cdff49"]]),dL={class:"right-files-panel"},fL={class:"rfp-toolbar"},pL=["placeholder"],hL={key:0,class:"rfp-empty"},mL={key:1,class:"rfp-empty is-error"},vL={key:2,class:"rfp-empty"},gL={key:3,class:"rfp-groups"},yL=["aria-expanded","onClick"],wL={class:"rfp-dir-chevron","aria-hidden":"true"},bL={class:"rfp-dir-icon","aria-hidden":"true"},kL={class:"rfp-dir-name"},CL=["title","onClick"],TL={class:"rfp-file-label"},SL=tn({__name:"RightFilesPanel",props:{cwd:{}},emits:["open-preview"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io(),s=A([]),a=A(!1),l=A(""),d=A(""),h=A(new Set);function v(U){return U.sort((V,K)=>V.kind!==K.kind?V.kind==="dir"?-1:1:V.name.localeCompare(K.name,void 0,{numeric:!0,sensitivity:"base"}))}function y(U){const V=[],K=new Map;function ye(_e){let we="",$e=V;for(const de of _e){we=we?`${we}/${de}`:de;let Le=K.get(we);Le||(Le={name:de,path:"",relativePath:we,kind:"dir",children:[]},K.set(we,Le),$e.push(Le)),$e=Le.children}return K.get(we)}for(const _e of U){const we=_e.relativePath.split("/").filter(Boolean);if(we.length===0)continue;if(_e.isDirectory){const je=ye(we);je.path=_e.path;continue}const $e=we[we.length-1],de=we.slice(0,-1);(de.length>0?ye(de).children:V).push({name:$e,path:_e.path,relativePath:_e.relativePath,kind:"file",children:[]})}v(V);for(const _e of K.values())v(_e.children);return V}const _=X(()=>y(s.value)),P=X(()=>{const U=d.value.trim().toLowerCase(),V=[];function K(_e){return!U||_e.relativePath.toLowerCase().includes(U)?!0:_e.children.some(K)}function ye(_e,we){for(const $e of _e){if(U&&!K($e)||(V.push({node:$e,depth:we}),$e.kind==="file"))continue;(U?!0:!h.value.has($e.relativePath))&&ye($e.children,we+1)}}return ye(_.value,0),V});function j(U){return d.value.trim()?!0:!h.value.has(U)}function B(U){const V=new Set(h.value);V.has(U)?V.delete(U):V.add(U),h.value=V}function J(U){o("open-preview",{path:U.path,label:U.name})}async function ce(){const U=n.cwd.trim();if(!U){s.value=[],l.value="";return}a.value=!0,l.value="";try{s.value=await hx(U)}catch(V){s.value=[],l.value=V instanceof Error?V.message:"Failed to load workspace files"}finally{a.value=!1}}return ws(()=>{ce()}),nt(()=>n.cwd,()=>{h.value=new Set,d.value="",ce()}),(U,V)=>(S(),I("div",dL,[p("div",fL,[Lt(p("input",{"onUpdate:modelValue":V[0]||(V[0]=K=>d.value=K),class:"rfp-search",type:"text",placeholder:g(r)("Filter files...")},null,8,pL),[[an,d.value]])]),a.value?(S(),I("div",hL,T(g(r)("Loading files...")),1)):l.value?(S(),I("div",mL,T(l.value),1)):P.value.length===0?(S(),I("div",vL,T(g(r)("No files in workspace.")),1)):(S(),I("div",gL,[(S(!0),I(ze,null,_t(P.value,K=>(S(),I("div",{key:K.node.relativePath,class:"rfp-row",style:kr({paddingLeft:`${K.depth*12+6}px`})},[K.node.kind==="dir"?(S(),I("button",{key:0,class:"rfp-dir",type:"button","aria-expanded":j(K.node.relativePath),onClick:ye=>B(K.node.relativePath)},[p("span",wL,T(j(K.node.relativePath)?"▾":"▸"),1),p("span",bL,T(j(K.node.relativePath)?"📂":"📁"),1),p("span",kL,T(K.node.name),1)],8,yL)):(S(),I("button",{key:1,class:"rfp-file",type:"button",title:K.node.relativePath,onClick:ye=>J(K.node)},[V[1]||(V[1]=p("span",{class:"rfp-file-icon","aria-hidden":"true"},"📄",-1)),p("span",TL,T(K.node.name),1)],8,CL))],4))),128))]))]))}}),_L=bt(SL,[["__scopeId","data-v-475974d9"]]),xL={class:"right-file-preview"},AL={class:"right-file-preview-header"},PL={class:"right-file-preview-title-wrap"},IL={class:"right-file-preview-title"},EL={class:"right-file-preview-path"},RL=["href"],ML={class:"right-file-preview-body"},$L={key:0,class:"right-file-preview-empty"},jL={key:1,class:"right-file-preview-empty is-error"},LL=["src","alt"],NL={key:3,class:"right-file-preview-code"},OL={key:4,class:"right-file-preview-empty"},DL=["href"],FL={key:0,class:"right-file-preview-footer"},UL=tn({__name:"RightFilePreview",props:{filePath:{},name:{}},setup(e){const t=e,{t:n}=io(),o=A(null),r=A(!1),s=A(""),a=X(()=>{const l=t.filePath.replace(/\\/g,"/"),d=l.startsWith("/")?l:`/${l}`;return`/codex-local-browse${encodeURI(d)}`});return nt(()=>t.filePath,async l=>{if(o.value=null,s.value="",!!l){r.value=!0;try{o.value=await mx(l)}catch(d){s.value=d instanceof Error?d.message:"Failed to preview file"}finally{r.value=!1}}},{immediate:!0}),(l,d)=>(S(),I("div",xL,[p("div",AL,[p("div",PL,[p("span",IL,T(e.name),1),p("span",EL,T(e.filePath),1)]),p("a",{class:"right-file-preview-open",href:a.value,target:"_blank",rel:"noopener noreferrer"},T(g(n)("Open in browser")),9,RL)]),p("div",ML,[r.value?(S(),I("div",$L,T(g(n)("Loading file…")),1)):s.value?(S(),I("div",jL,T(s.value),1)):o.value&&o.value.isImage?(S(),I("img",{key:2,class:"right-file-preview-image",src:a.value,alt:e.name},null,8,LL)):o.value&&o.value.isText&&o.value.content!==void 0?(S(),I("pre",NL,T(o.value.content),1)):(S(),I("div",OL,[p("p",null,T(g(n)("This file type cannot be previewed.")),1),p("a",{class:"right-file-preview-open",href:a.value,target:"_blank",rel:"noopener noreferrer"},T(g(n)("Open in browser")),9,DL)]))]),o.value&&o.value.truncated?(S(),I("div",FL,T(g(n)("File is large; showing the first part.")),1)):ee("",!0)]))}}),BL=bt(UL,[["__scopeId","data-v-11e988a2"]]),qL={},zL={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function HL(e,t){return S(),I("svg",zL,[...t[0]||(t[0]=[p("circle",{cx:"11",cy:"11",r:"8"},null,-1),p("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const tv=bt(qL,[["render",HL]]),WL={},VL={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function GL(e,t){return S(),I("svg",VL,[...t[0]||(t[0]=[p("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[p("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"}),p("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const KL=bt(WL,[["render",GL]]),YL={},JL={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function QL(e,t){return S(),I("svg",JL,[...t[0]||(t[0]=[p("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),p("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const XL=bt(YL,[["render",QL]]),ZL={},eN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function tN(e,t){return S(),I("svg",eN,[...t[0]||(t[0]=[p("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 nv=bt(ZL,[["render",tN]]);function Dy(e){var r;const t=e.replace(/\r\n/g,`
|
|
64
|
+
`).trim();if(!t)return null;const n=[],o=[];for(const s of t.split(`
|
|
65
|
+
`)){const a=s.trim();if(!a){n.length===0&&o.push("");continue}const l=a.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const d=(l[1]??" ").toLowerCase();let h="pending";d==="x"&&(h="completed"),(d==="~"||d===">"||d==="-")&&(h="inProgress"),n.push({step:((r=l[2])==null?void 0:r.trim())??"",status:h});continue}o.push(a)}if(n.length===0){const s=nN(t);return s||null}return{explanation:o.join(`
|
|
66
|
+
`).trim(),steps:n.filter(s=>s.step.length>0)}}function nN(e){var s,a;const t=[],n=[],o=[];for(const l of e.split(`
|
|
67
|
+
`)){const d=l.trim();if(!d){t.length===0&&n.length===0&&o.push("");continue}const h=d.match(/^\d+[.)]\s+(.+)$/);if(h){t.push({step:((s=h[1])==null?void 0:s.trim())??"",status:"pending"});continue}const v=d.match(/^[-*]\s+(.+)$/);if(v){n.push({step:((a=v[1])==null?void 0:a.trim())??"",status:"pending"});continue}o.push(d)}const r=t.length>0?t:n;return r.length===0?null:{explanation:oN(o.join(`
|
|
68
|
+
`)),steps:r.filter(l=>l.step.length>0)}}function oN(e){return e.split(`
|
|
69
|
+
`).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
|
|
70
|
+
`).trim()}function ov(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}:Dy(e.text)}function rN(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function To(e){return e.flatMap(t=>t.threads)}function aN(e,t){var o,r;const n=e.findIndex(s=>s.id===t);return n<0?"":((o=e[n+1])==null?void 0:o.id)??((r=e[n-1])==null?void 0:r.id)??""}const Fy="codex-web-local.thread-read-state.v1",rv="codex-web-local.thread-unread-cutoff.v1",Uy="codex-web-local.thread-token-usage.v1",By="codex-web-local.thread-reasoning.v1",qy="codex-web-local.thread-last-plan.v1",zy="codex-web-local.live-reasoning-snapshot.v1",av=8e3,sN=15*60*1e3,iN=1500,sv="codex-web-local.stashed-messages.v1",iv="codex-web-local.auto-compact-threshold.v1",gu=10,Hy="codex-web-local.thread-terminal-open.v1",qf="codex-web-local.selected-thread-id.v1",zf="codex-web-local.selected-model-by-context.v1",Wy="codex-web-local.selected-model-id.v1",Vy="codex-web-local.project-order.v1",Gy="codex-web-local.project-display-name.v1",Hf="codex-web-local.collaboration-mode-by-context.v1",lN="codex-web-local.collaboration-mode.v1",Zs="__new-thread__",Ky="__new-thread-provider__::",yu=220,cN=1e4,uN=500,dN=3e3,lv=2e3,fN=2e3,pN=2e3,hN=ly,cl="__global__",ca="gpt-5.4-mini",mN="big-pickle",cv="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",vN=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 uv(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function gN(e){if(e instanceof ma&&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 yN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function dv(e){typeof window>"u"||window.localStorage.setItem(Fy,JSON.stringify(e))}function wN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(By);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function wu(e){if(!(typeof window>"u")){try{window.localStorage.setItem(By,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&Ex(t,n)}}function bN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function fv(e){if(!(typeof window>"u"))try{window.localStorage.setItem(qy,JSON.stringify(e))}catch{}}function kN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const s=r;typeof(s==null?void 0:s.text)=="string"&&s.text.trim()&&typeof s.ts=="number"&&(n[o]={text:s.text,ts:s.ts})}return n}catch{return{}}}function CN(){if(typeof window>"u")return"";const e=window.localStorage.getItem(rv);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(rv,t),t}function TN(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 SN(e,t,n){return TN(e,t??n)}function Yy(e){return e==="plan"?"plan":"default"}function Il(e){return typeof e=="string"?e.trim():""}function fa(){return Object.create(null)}function Mu(e){const t=fa();for(const[n,o]of Object.entries(e))t[n]=o;return t}function vc(e,t){if(!(t in e))return e;const n=fa();for(const[o,r]of Object.entries(e))o!==t&&(n[o]=r);return n}function pv(e,t){let n=!1;const o=fa();for(const[r,s]of Object.entries(e)){if(r===Zs||r.startsWith(Ky)||t.has(r)){o[r]=s;continue}n=!0}return n?o:e}function Vs(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function _N(e){return e===Zs}function bu(e){const t=Vs(e);return t?`${Ky}${t}`:""}function Oi(e){return e.trim()||Zs}function xN(){if(typeof window>"u")return fa();try{const n=window.localStorage.getItem(zf);if(n){const o=JSON.parse(n);if(!o||typeof o!="object"||Array.isArray(o))return fa();const r=fa();for(const[s,a]of Object.entries(o)){if(typeof s!="string"||s.length===0)continue;const l=Il(a);l&&(r[s]=l)}return r}}catch{}const e=Il(window.localStorage.getItem(Wy)),t=fa();return e&&(t[Zs]=e),t}function hv(e,t){const n=Oi(t),o=Il(e[n]);return o||Il(e[Zs])}function ku(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(zf):window.localStorage.setItem(zf,JSON.stringify(e)),window.localStorage.removeItem(Wy)}catch{}}function AN(){if(typeof window>"u")return fa();try{const e=window.localStorage.getItem(Hf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return fa();const n=fa();for(const[o,r]of Object.entries(t)){if(typeof o!="string"||o.length===0)continue;const s=Yy(r);s==="plan"&&(n[o]=s)}return n}}catch{}return fa()}function Cu(e,t){const n=Oi(t);return Yy(e[n])}function mv(e,t,n){const o=Oi(t);if(_N(o))return vc(e,o);if(n==="plan"){const r=Mu(e);return r[o]="plan",r}return vc(e,o)}function hf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Hf):window.localStorage.setItem(Hf,JSON.stringify(e)),window.localStorage.removeItem(lN)}catch{}}function Jy(e,t,n){return Math.min(Math.max(e,t),n)}function hl(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 vv(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:hl(t.totalTokens)??0,inputTokens:hl(t.inputTokens)??0,cachedInputTokens:hl(t.cachedInputTokens)??0,outputTokens:hl(t.outputTokens)??0,reasoningOutputTokens:hl(t.reasoningOutputTokens)??0}}function PN(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=vv(t.total),o=vv(t.last);if(!n||!o)return null;const r=hl(t.modelContextWindow),s=o.totalTokens,a=typeof r=="number"?Math.max(r-s,0):null,l=typeof r=="number"&&r>0?Jy(Math.round((a??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:s,remainingContextTokens:a,remainingContextPercent:l}}function IN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o)continue;const s=PN(r);s&&(n[o]=s)}return n}catch{return{}}}function gv(e){typeof window>"u"||window.localStorage.setItem(Uy,JSON.stringify(e))}function EN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Hy);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 RN(e){typeof window>"u"||window.localStorage.setItem(Hy,JSON.stringify(e))}function MN(){return typeof window>"u"?"":window.localStorage.getItem(qf)??""}function $N(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(qf);return}window.localStorage.setItem(qf,e)}}function jN(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Vy);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=Hr(o);r.length>0&&!n.includes(r)&&n.push(r)}return n}catch{return[]}}function rc(e){typeof window>"u"||window.localStorage.setItem(Vy,JSON.stringify(e))}function LN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Gy);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 s=typeof o=="string"?Hr(o):"";s.length>0&&typeof r=="string"&&(n[s]=r)}return n}catch{return{}}}function yv(e){typeof window>"u"||window.localStorage.setItem(Gy,JSON.stringify(e))}function ul(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 us(e,n)?e:n}function mf(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>n.get(r)??null).filter(r=>r!==null);for(const r of e)t.includes(r.projectName)||o.push(r);return o}function us(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 NN(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 ON(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function DN(e=[],t=[]){var n,o,r,s;if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1)if(((n=e[a])==null?void 0:n.step)!==((o=t[a])==null?void 0:o.step)||((r=e[a])==null?void 0:r.status)!==((s=t[a])==null?void 0:s.status))return!1;return!0}function FN(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&DN(e.steps,t.steps)}function Tu(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 Wf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&us(e.images,t.images)&&UN(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&ON(e.commandExecution,t.commandExecution)&&FN(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function ml(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 wv(e,t,n={}){const o=new Map(e.map(v=>[v.id,v])),r=new Map(t.map(v=>[v.id,v])),s=t.map(v=>{const y=o.get(v.id);return y&&Wf(y,v)?y:v});if(n.preserveMissing!==!0)return ml(e,s)?e:s;const a=e.map(v=>{const y=r.get(v.id);return!y||Wf(v,y)?v:y}).filter(v=>!Ap(v)||!qN(v,t)),l=new Set(e.map(v=>v.id)),d=s.filter(v=>!l.has(v.id)),h=[...a,...d];return ml(e,h)?e:h}function UN(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 El(e){return e.replace(/\s+/gu," ").trim()}function Ap(e){return e.messageType==="userMessage.optimistic"}function BN(e){return e.some(Ap)}function qN(e,t){if(e.role!=="user")return!1;const n=El(e.text),o=Array.isArray(e.images)?e.images:[],r=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,s=Array.isArray(e.skills)?e.skills.length:0;return t.some(a=>{if(a===e||a.role!=="user"||Ap(a))return!1;const l=El(a.text),d=Array.isArray(a.images)?a.images:[],h=Array.isArray(a.fileAttachments)?a.fileAttachments.length:0,v=Array.isArray(a.skills)?a.skills.length:0;return l===n&&us(d,o)&&h===r&&v===s})}function zN(e,t){const n=new Set(t.map(s=>s.id)),o=new Set(t.filter(s=>s.role==="assistant").map(s=>El(s.text)).filter(s=>s.length>0));if(o.size===0)return e;const r=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;if(n.has(s.id))return!1;const a=El(s.text);return a.length===0?!1:!o.has(a)});return r.length===e.length?e:r}function Su(e,t){const n=e.findIndex(s=>s.id===t.id);if(n<0)return[...e,t];const o=e[n];if(Wf(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const Qy="worked";function qs(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function HN(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,s=[];n>0&&s.push(`${n}h`),(o>0||n>0)&&s.push(`${o}m`);const a=r>0||s.length===0?r:0;return s.push(`${a}s`),s.join(" ")}function WN(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function VN(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 GN(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${HN(e.durationMs)}`,messageType:Qy,turnId:e.turnId,durationMs:e.durationMs}}function KN(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function YN(e,t){const n=GN(t),o=e.filter(a=>a.messageType!==Qy),r=KN(o);if(r<0)return[...o,n];const s=[...o];return s.splice(r,0,n),s}function St(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function JN(e,t){if(t.size===0)return e;let n=!1;const o={};for(const[r,s]of Object.entries(e)){if(t.has(r)){n=!0;continue}o[r]=s}return n?o:e}function QN(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 XN(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 ZN(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 kn(e,t){const n=Object.entries(e).filter(([o])=>t.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function bv(e,t){const n=t.trim();if(!n)return e;let o=!1;const r=[];for(const s of e){const a=s.threads.filter(d=>d.id!==n),l=a.length!==s.threads.length;l&&(o=!0),a.length>0?r.push(l?{...s,threads:a}:s):s.threads.length===0&&r.push(s)}return o?r:e}function _u(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>{const s=n.get(r.projectName),a=new Map((s==null?void 0:s.threads.map(d=>[d.id,d]))??[]),l=r.threads.map(d=>{const h=a.get(d.id);return h&&QN(h,d)?h:d});return s&&s.projectName===r.projectName&&XN(s.threads,l)?s:{projectName:r.projectName,threads:l}});return ZN(e,o)?e:o}function eO(e,t,n){const o=new Set(To(t).map(l=>l.id)),r=To(e).filter(l=>n[l.id]===!0&&!o.has(l.id));if(r.length===0)return t;const s=new Map(t.map(l=>[l.projectName,l])),a=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of r){if(s.get(l.projectName)){const h=a.findIndex(v=>v.projectName===l.projectName);h>=0&&(a[h]={projectName:a[h].projectName,threads:[l,...a[h].threads]});continue}a.push({projectName:l.projectName,threads:[l]})}return a}function Ui(e){return Hr(e)}function tO(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function nO(e){const t=e.label||Hr(e.remotePath),n=tO(e.hostId);return n?`${t} ${n}`:t}function Xy(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function hd(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 Vf(e,t){const n=Xy(e);return hd(e).map(o=>{if(n.has(o))return o;const r=ot(o).trim(),s=Ui(r);return t.has(s)?r:s})}function $u(e,t){return ot(e).trim()===t||Ui(e)===t}function oO(e,t){const n=new Set;for(const o of e.order)$u(o,t)&&n.add(o);for(const o of e.active)$u(o,t)&&n.add(o);for(const o of Object.keys(e.labels))$u(o,t)&&n.add(o);return n}function rO(e,t,n){var h,v;const o=new Set((e.remoteProjects??[]).map(y=>y.id)),r=new Map;for(const y of e.order){const _=Ui(y);r.has(_)||r.set(_,y)}for(const y of n){const _=((v=(h=y.threads[0])==null?void 0:h.cwd)==null?void 0:v.trim())??"";_&&r.set(y.projectName,_)}const s=[],a=y=>{y&&!s.includes(y)&&s.push(y)};for(const y of t){if(o.has(y)){a(y);continue}const _=r.get(y);_&&a(_)}for(const y of hd(e))a(y);const l=s.filter(y=>e.order.includes(y));for(const y of e.order)l.includes(y)||l.push(y);const d=e.active.filter(y=>l.includes(y));return d.length===0&&l.length>0&&d.push(l[0]),{order:l,active:d,projectOrder:s}}function aO(e,t,n){const o=Vf(t,n);if(o.length===0)return e;const r=new Map(o.map((s,a)=>[s,a]));return[...e].sort((s,a)=>{if(Yf(s)||Yf(a))return 0;const l=r.get(s.projectName)??Number.POSITIVE_INFINITY,d=r.get(a.projectName)??Number.POSITIVE_INFINITY;return l===d?0:l-d})}function Gf(e,t){const n=new Map,o=new Map,r=a=>{const l=ot(a).trim();if(!l)return;const d=Hr(l),h=n.get(d)??new Set;h.add(l),n.set(d,h)};for(const a of(t==null?void 0:t.order)??[]){const l=ot(a).trim();if(!l)continue;const d=Hr(l);Yu(l)||o.set(d,(o.get(d)??0)+1),r(a)}for(const a of e)for(const l of a.threads){const d=ot(l.cwd).trim(),h=Hr(d),v=(t==null?void 0:t.order.some(y=>ot(y).trim()===d))===!0;Yu(d)&&!v&&o.get(h)===1||r(l.cwd)}const s=new Set;for(const[a,l]of n.entries())l.size>1&&s.add(a);return s}function Yu(e){return e.includes("/.codex/worktrees/")}function sO(e,t){const n=Gf(e,t);if(n.size===0)return e;const o=new Set,r=new Set,s=new Map,a=new Set;for(const h of(t==null?void 0:t.order)??[]){const v=ot(h).trim();if(!v||(a.add(v),Yu(v)))continue;const y=Hr(v);o.has(y)?(o.delete(y),r.add(y),s.delete(y)):r.has(y)||(o.add(y),s.set(y,v))}const l=[],d=new Map;for(const h of e)for(const v of h.threads){const y=ot(v.cwd).trim(),_=Hr(y),P=a.has(y),j=Yu(y)&&!P&&o.has(_);let B=h.projectName;j&&n.has(_)?B=s.get(_)??h.projectName:y&&n.has(_)&&(B=y);const J=v.projectName===B?v:{...v,projectName:B},ce=d.get(B);if(ce)ce.threads.push(J);else{const U={projectName:B,threads:[J]};d.set(B,U),l.push(U)}}return l}function iO(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const o=new Set(e.map(a=>a.projectName)),r=[...e],s=Xy(t);for(const a of hd(t)){if(s.has(a)){if(o.has(a))continue;r.push({projectName:a,threads:[]}),o.add(a);continue}const l=ot(a).trim();if(!l)continue;const d=Ui(l),h=n.has(d)?l:d;o.has(h)||(r.push({projectName:h,threads:[]}),o.add(h))}return r}const Kf=20;function zs(e){const t=e.split(`
|
|
71
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Kf):"Untitled thread"}function lO(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Yf(e){return e.threads.some(t=>t.cwd.trim().length===0||Wu(t.cwd))}const Qs=new Map;let ju=0;function vf(e,t){const n=`${e}:${t.id}`,o=Qs.get(n);return o!==void 0?o:(ju+=1,Qs.set(n,ju),ju)}function cO(e){const t=`${e}:`;for(const n of[...Qs.keys()])n.startsWith(t)&&Qs.delete(n)}function kv(e,t){const n=t.trim();if(!n)return-1;const o=e.findIndex(l=>l.id===n);if(o>=0)return o;const r=`session-cmd-${n}`,s=e.findIndex(l=>l.id===r);if(s>=0)return s;const a="session-cmd-";if(n.startsWith(a)){const l=e.findIndex(d=>d.id===n.slice(a.length));if(l>=0)return l}return-1}function uO(e,t){var s,a;if(t.length===0)return e;const n=[...e],o=[],r=new Map;for(const l of t){const d=((s=l.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(d&&kv(n,d)>=0)continue;const h=l.turnIndex;if(typeof h!="number"||!Number.isFinite(h))continue;const v=r.get(h)??[];v.push(l),r.set(h,v)}for(const l of[...t].reverse()){const d=((a=l.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(d){const j=kv(n,d);if(j>=0){n.splice(j+1,0,l);continue}}const h=l.turnIndex;if(typeof h!="number"||!Number.isFinite(h)){o.push(l);continue}let v=-1,y=-1;const _=[];for(let j=0;j<n.length;j+=1)n[j].turnIndex===h&&(y=j,n[j].role==="user"?v=j:n[j].messageType!=="reasoning"&&_.push(j));if(_.some(j=>{const B=n[j].messageType;return B==="commandExecution"||B==="toolCall"||B==="fileChange"||B==="worked"})){const B=(r.get(h)??[]).indexOf(l),J=B>=0?B:0;n.splice(_[Math.min(J,_.length-1)]+1,0,l)}else if(v>=0)n.splice(v+1,0,l);else if(y>=0)n.splice(y+1,0,l);else continue}return o.length>0?[...n,...o.reverse()]:n}function dO(e,t,n){const o=new Set(n.map(a=>a.id)),r=new Map;for(const a of t)for(const l of a)o.has(l.id)||r.has(l.id)||r.set(l.id,l);const s=Array.from(r.values());for(const a of s)vf(e,a);return s.sort((a,l)=>vf(e,a)-vf(e,l))}function fO(e,t,n,o,r){const s=dO(e,o,t),a=[...t,...s];return[...uO(a,n),...r]}function pO(){const e=A([]),t=A([]),n=A(MN()),o=A({}),r=A({}),s=A(bN()),a=A({}),l=A({}),d=A(wN()),h=A({}),v=new Map,y=new Map,_=new Map,P=new Map,j=A({}),B=A({}),J=A({});let ce=kN(),U=!1,V=null;function K(){V===null&&(V=setTimeout(()=>{if(V=null,U&&(U=!1,typeof window<"u"))try{window.localStorage.setItem(zy,JSON.stringify(ce))}catch{}U&&K()},iN))}function ye(i,u){if(!i||J.value[i]!==!0)return;const m=u.length>av?u.slice(-av):u;ce[i]={text:m,ts:Date.now()},U=!0,K()}function _e(i){var b;if(!i||((b=h.value[i])==null?void 0:b.trim()))return;const m=ce[i];m!=null&&m.text&&(Date.now()-m.ts>sN||(h.value={...h.value,[i]:m.text}))}function we(i){i&&i in ce&&(delete ce[i],U=!0,K())}const $e=A({}),de=A({}),Le=A({}),je=A(Rn()),fe=A(ts());let Te=!1,xe=!1;const Ae=A({}),Ue=A([]),Ye=A({}),He=A({}),At=A([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),ct=A(AN()),Qe=A(xN()),et=A(Cu(ct.value,n.value)),ft=A(hv(Qe.value,n.value)),mt=A("medium"),kt=A("standard"),at=A(""),ae=A(""),te=A(yN()),oe=A(CN()),z=A(jN()),Be=A(LN()),$=A({}),O=A({}),G=A({}),ue=A({}),ie=A({}),re=A({}),Se=A({}),be=A({}),pe=A({}),se=A({}),Ee=A({}),ge=A({}),Fe=A({}),Me=A({}),Ve=A({}),rt=A({}),gt=A({}),It=A(null),Tt=A(IN()),Tn=A(EN()),H=A({}),W=A({}),Y=A([]),me=A([]),Oe=A([]),We=A(!1),Ze=A(!1),Ft=A(!1),Nt=A(!1),Kn=A(!1),lo=A(!1),co=A(!1),uo=A(!1),fo=A(new Set),za=6e4,Cr=A([]);let Qt="";const ut=A(""),gn=A(!1),zo=A(!1);function bs(i){var u;try{const m=new URL(i,"http://localhost");return m.pathname!=="/codex-local-image"?"":((u=m.searchParams.get("path"))==null?void 0:u.trim())??""}catch{return""}}function ni(i){const u=i.trim().toLowerCase();return u?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(u):!1}function Et(i){var m;const u=o.value[i]??[];for(let b=u.length-1;b>=0;b-=1){const R=u[b];if(!(R.role!=="user"||!Array.isArray(R.images)||R.images.length===0))for(let E=R.images.length-1;E>=0;E-=1){const L=((m=R.images[E])==null?void 0:m.trim())??"";if(L&&bs(L))return L}}return""}let Ut=null,ht=null,Ho=null;const dn=new Map;let sr=null;const ir=new Map;let Yn=null,lr=null,ba=0,Ha=!1,Dn=!1,In=0,Gr="",Ao=null,nn=!1,Kr=!1;const Yt=new Set,Yr=new Map,ka=new Map;let Jn=null,Qn=null,Po=!1,Pt=!1,$t=[],zn=null,po=!1,Hn=!1;const Xn=new Map,Mn=new Set,Io=X(()=>To(e.value)),ho=X(()=>Io.value.find(i=>i.id===n.value)??null),Tr=X(()=>{const i=n.value;return!!(i&&Tn.value[i]===!0)}),Sr=X(()=>{const i=n.value;return i?ge.value[i]===!0:!1}),oi=X(()=>{const i=[],u=n.value;return u&&Array.isArray(rt.value[u])&&i.push(...rt.value[u]),Array.isArray(rt.value[cl])&&i.push(...rt.value[cl]),i.sort((m,b)=>m.receivedAtIso.localeCompare(b.receivedAtIso))}),Wo=X(()=>{const i=n.value;return i?Ee.value[i]??"":""}),Wa=X(()=>{var q;const i=n.value;if(!i)return null;const u=J.value[i]===!0,m=u?be.value[i]:void 0,b=u?(h.value[i]??"").trim():"",R=(((q=se.value[i])==null?void 0:q.message)??"").trim();let E="";if(!u&&R){const Z=o.value[i]??[];for(let he=Z.length-1;he>=0;he-=1){const Ne=Z[he];if(Ne.messageType==="turnError"){E=El(Ne.text);break}}}const L=!u&&R&&E===R?"":R;return!u&&!m&&!b&&!L?null:{activityLabel:(m==null?void 0:m.label)||"Thinking",activityDetails:(m==null?void 0:m.details)??[],reasoningText:b,errorText:L}}),Ca=X(()=>It.value),cr=X(()=>{const i=n.value;return i?Tt.value[i]??null:null}),_r=X(()=>{const i=n.value;if(!i)return[];const u=o.value[i]??[],m=r.value[i]??[],b=a.value[i]??[],R=j.value[i]??[],E=B.value[i]??[],L=l.value[i]??[],q=d.value[i]??[],Z=u.some(it=>it.messageType==="compaction.done"),he=fo.value.has(i),Ne=Z&&!he?L.filter(it=>it.messageType!=="compaction.pending"&&it.messageType!=="compaction.done"):L,Je=fO(i,u,q,[m,R,E,b],Ne),pt=Se.value[i];return pt?YN(Je,pt):Je}),ur=X(()=>{const i=n.value;return i?Ve.value[i]??null:null}),Ct=X(()=>{const i=n.value;return i?G.value[i]===!0:!1}),Fn=X(()=>{const i=n.value;return i?ue.value[i]===!0:!1});function Sn(i){var m;const u=o.value[i]??[];for(const b of u){const R=((m=b.turnId)==null?void 0:m.trim())??"";if(R)return R}return""}function sn(i){if(Oi(i)===Zs){const m=Vs(at.value),b=bu(m),R=b?Il(Qe.value[b]):"";if(R)return R}return hv(Qe.value,i).trim()}function mo(i){const u=i.trim();return Vs(u?H.value[u]??at.value:at.value)}function Vo(i){return Ye.value[i.trim()]??hN}function En(i,u=mt.value){const m=i.trim(),b=Vo(m);if(u&&b.includes(u))return u;if(b.includes("medium"))return"medium";const R=He.value[m];return R&&b.includes(R)?R:b[0]??""}function Wn(i){mt.value=En(i)}function xt(i){const u={},m={};for(const b of i)b.supportedReasoningEfforts!==null&&(u[b.id]=[...b.supportedReasoningEfforts]),b.defaultReasoningEffort&&(m[b.id]=b.defaultReasoningEffort);Ye.value=u,He.value=m}function yn(...i){const u=[...Ue.value];for(const m of i){const b=m.trim();b&&!u.includes(b)&&u.push(b)}us(Ue.value,u)||(Ue.value=u)}function Bt(i){const u=i.trim();return Ue.value.length===0||u&&Ue.value.includes(u)?u:Ue.value[0]??""}function fn(i,u={}){n.value!==i&&(n.value=i,u.persist!==!1&&$N(i),ft.value=Bt(sn(i)),Wn(ft.value),et.value=Cu(ct.value,i),Hn=!1)}function Vn(i,u){const m=u.trim(),b=Oi(i),R=Vs(at.value),E=b===Zs?bu(R):"",L=E||b;if(m){const q=Mu(Qe.value);q[L]=m,E&&delete q[b],Qe.value=q}else{let q=vc(Qe.value,L);E&&(q=vc(q,b)),Qe.value=q}b===Oi(n.value)?(ft.value=sn(n.value),yn(ft.value),Wn(ft.value)):yn(m),ku(Qe.value)}function Zn(i){Vn(n.value,i)}function vo(i,u){const m=i.trim();if(!m)return;const b=u.trim();if(b){const R=Mu(Qe.value);R[m]=b,Qe.value=R}else Qe.value=vc(Qe.value,m);yn(b),n.value===m&&(ft.value=sn(n.value),Wn(ft.value)),ku(Qe.value)}function xr(i,u){const m=i.trim();if(!m)return;const b=Vs(u);b?H.value={...H.value,[m]:b}:H.value[m]&&(H.value=St(H.value,m))}function Go(i,u,m){const b=u.trim();if(Vs(m)!=="opencode-zen")return b;const E=sn(i).trim();return E&&!/^gpt-/i.test(E)?E:b&&!/^gpt-/i.test(b)?b:mN}function Jr(i,u){const m=i.trim();if(!m)return;if(!u){if(!(m in Tt.value))return;Tt.value=St(Tt.value,m),gv(Tt.value);return}const b=Tt.value[m];if(b&&JSON.stringify(b)===JSON.stringify(u))return;Tt.value={...Tt.value,[m]:u},gv(Tt.value);const R=je.value[m];R&&R.length>0&&fe.value>0&&(u.remainingContextPercent!==null&&u.remainingContextPercent<=fe.value?fo.value.has(m)||zl(m):bi(m))}function Ko(i){const u=i==="plan"?"plan":"default",m=Oi(n.value);Cu(ct.value,n.value)===u&&et.value===u||(et.value=u,ct.value=mv(ct.value,m,u),hf(ct.value))}function Eo(i,u){const m=u==="plan"?"plan":"default";ct.value=mv(ct.value,i,m),i.trim()===n.value&&(et.value=m),hf(ct.value)}function Ar(i){It.value=i}async function go(i=n.value){i.trim()?vo(i,ca):Zn(ca),yn(ca)}function M(i,u){gt.value={...gt.value,[i]:u}}function F(i){gt.value[i]&&(gt.value=St(gt.value,i))}async function ne(i){if(Mn.has(i))return;const u=gt.value[i];if(!(!u||u.fallbackRetried)){Mn.add(i),M(i,{...u,fallbackRetried:!0});try{await go(i);try{const m=await rf(i,1);fr(i,m),hr(i),_a(i,[]),pr(i),j.value[i]&&(j.value=St(j.value,i))}catch{}if(Zt(i,null),ut.value="",ln(i,null),Gt(i,{label:"Thinking",details:pn(ca,u.effort,u.collaborationMode)}),hn(i,!0),ie.value[i]!==!0){const m=await of(i);m.model&&vo(i,Go(i,m.model,m.modelProvider)),m.modelProvider&&xr(i,m.modelProvider),ie.value={...ie.value,[i]:!0}}await af(i,u.text,u.imageUrls,ca,u.effort||void 0,u.skills.length>0?u.skills:void 0,u.fileAttachments,u.collaborationMode),Pr(),Yt.add(i),await Ur()}catch(m){const b=m instanceof Error?m.message:"Unknown application error";Zt(i,b),ut.value=b,hn(i,!1),Gt(i,null)}finally{Mn.delete(i)}}}function Pe(i){i&&!Vo(ft.value).includes(i)||(mt.value=i)}async function Ge(i){const u=i==="fast"?"fast":"standard";if(co.value||kt.value===u)return;const m=kt.value;kt.value=u,co.value=!0,ut.value="";try{await H_(u)}catch(b){kt.value=m,ut.value=b instanceof Error?b.message:"Failed to update Fast mode"}finally{co.value=!1}}async function qt(){try{const i=await X_();At.value=i,i.some(u=>u.value===et.value)||Ko("default")}catch{}}function pn(i,u,m=et.value){const b=i.trim()||"default",R=u||"default",E=m==="plan"?"Plan":"Default",L=kt.value==="fast"?"Fast":"Standard";return[`Mode: ${E}`,`Model: ${b}`,`Thinking: ${R}`,`Speed: ${L}`]}async function Xt(i){ae.value="";try{const u=await Cy(),m=u.model.trim(),b=Vs(u.providerId);at.value=b;const R=mo(n.value),E=R!=="codex"&&R!=="custom",L=sn(n.value),q=await ky({includeProviderModels:E||(i==null?void 0:i.includeProviderModels)!==!1,requireProviderModels:E,providerId:E?R:void 0}),Z=q.map(it=>it.id);xt(q);const he=bu(R),Ne=he?Il(Qe.value[he]):"",Je=[...Z];!(i!=null&&i.providerChanged)&&E&&R===b&&m&&!Je.includes(m)&&Je.push(m),Ue.value=Je;const pt=L&&Z.includes(L);if(!L||!pt||i!=null&&i.providerChanged?i!=null&&i.providerChanged&&Je.length>0?Ne&&Z.includes(Ne)?Zn(Ne):R===b&&m&&Je.includes(m)?Zn(m):Zn(Je[0]):R===b&&m&&Je.includes(m)?Zn(u.model):Je.length>0?Zn(Je[0]):Zn(""):ft.value.trim()!==L&&Zn(L),he&&ft.value.trim().length>0){const it=Mu(Qe.value);it[he]=ft.value.trim();const Mt=bu(b);Mt&&Mt!==he&&m&&(it[Mt]=m),Qe.value=it,ku(Qe.value)}mt.value=En(ft.value,u.reasoningEffort),kt.value=u.speedMode}catch(u){uv(u)?ae.value=cv:ae.value=""}}async function jt(){if(Ao){await Ao;return}Ao=(async()=>{try{const i=await x_();Ar(i),me.value=i?[i]:[]}catch{}finally{Ao=null}})(),await Ao}function Pr(){if(typeof window>"u"){jt();return}Ho!==null&&window.clearTimeout(Ho),Ho=window.setTimeout(()=>{Ho=null,jt()},uN)}function yo(i){if(!i||typeof window>"u")return;const u=dn.get(i);u!==void 0&&(window.clearTimeout(u),dn.delete(i))}function Ta(i){if(!i||typeof window>"u")return;yo(i);const u=window.setTimeout(()=>{dn.delete(i),Yt.add(i),Ur()},dN);dn.set(i,u)}function Ml(i){const u=W.value;return Object.keys(u).length===0?i.map(m=>({projectName:m.projectName,threads:m.threads.map(b=>({...b,title:zs(b.title)}))})):i.map(m=>({projectName:m.projectName,threads:m.threads.map(b=>{const R=u[b.id];return{...b,title:zs(R??b.title)}})}))}function Qr(i){return i?Array.isArray(rt.value[i])?rt.value[i]:[]:[]}function Gn(i){return i==="item/commandExecution/requestApproval"||i==="item/fileChange/requestApproval"||i==="item/permissions/requestApproval"||i==="execCommandApproval"||i==="applyPatchApproval"}function ks(i){return i.some(u=>Gn(u.method))?"approval":i.length>0?"response":null}function _n(){const u=Ml(t.value).map(m=>({projectName:m.projectName,threads:m.threads.map(b=>{const R=$e.value[b.id]??b.externalSession??null,E=J.value[b.id]===!0||(R==null?void 0:R.active)===!0,L=ks(Qr(b.id)),q=n.value===b.id,Z=Ae.value[b.id]===!0,he=SN(b.updatedAtIso,te.value[b.id],oe.value);return{...b,inProgress:E,unread:!q&&!E&&(Z||he),pendingRequestState:L,...R?{externalSession:R}:{}}})}));e.value=_u(e.value,u)}function ri(i,u,m){const b=new Date().toISOString(),R=ot(u),E=Hr(R),L={id:i,title:zs(m),projectName:E,cwd:R,hasWorktree:R.includes("/.codex/worktrees/")||R.includes("/.git/worktrees/"),createdAtIso:b,updatedAtIso:b,preview:m,unread:!1,inProgress:!1},q=t.value.findIndex(he=>he.projectName===E);if(q>=0){const Ne=t.value[q].threads.filter(it=>it.id!==i),Je={projectName:E,threads:[L,...Ne]},pt=[...t.value];pt.splice(q,1,Je),t.value=pt}else t.value=[{projectName:E,threads:[L]},...t.value];const Z=ul(z.value,t.value);us(z.value,Z)||(z.value=Z,rc(z.value)),_n()}function Hi(i){const u=new Set(i.map(Z=>Z.id)),m=n.value.trim();m&&u.add(m);const b=pv(Qe.value,u);b!==Qe.value&&(Qe.value=b,ft.value=Bt(sn(n.value)),ku(b));const R=pv(ct.value,u);R!==ct.value&&(ct.value=R,et.value=Cu(R,n.value),hf(R));const E=kn(te.value,u);if(E!==te.value&&(te.value=E,dv(E)),O.value=kn(O.value,u),$.value=kn($.value,u),ie.value=kn(ie.value,u),re.value=kn(re.value,u),o.value=kn(o.value,u),a.value=kn(a.value,u),h.value=kn(h.value,u),j.value=kn(j.value,u),B.value=kn(B.value,u),Se.value=kn(Se.value,u),be.value=kn(be.value,u),se.value=kn(se.value,u),Ee.value=kn(Ee.value,u),P.size>0)for(const Z of[...P.keys()])u.has(Z)||P.delete(Z);if(Qs.size>0)for(const Z of[...Qs.keys()]){const he=Z.indexOf(":"),Ne=he>0?Z.slice(0,he):"";u.has(Ne)||Qs.delete(Z)}ge.value=kn(ge.value,u),Fe.value=kn(Fe.value,u),Me.value=kn(Me.value,u),H.value=kn(H.value,u);const L=kn(de.value,u);L!==de.value&&(de.value=L,aa()),Tt.value=kn(Tt.value,u),Ae.value=kn(Ae.value,u),J.value=kn(J.value,u);const q={};for(const[Z,he]of Object.entries(rt.value))(Z===cl||u.has(Z))&&(q[Z]=he);rt.value=q}function ai(i){const u=To(t.value).find(m=>m.id===i);u&&(te.value={...te.value,[i]:u.updatedAtIso},dv(te.value),Ae.value[i]&&(Ae.value=St(Ae.value,i)),_n())}function ln(i,u){if(!i)return;const m=Se.value[i];if(u){if(WN(m,u))return;Se.value={...Se.value,[i]:u}}else m&&(Se.value=St(Se.value,i))}function hn(i,u){!i||J.value[i]===!0===u||(u?(J.value={...J.value,[i]:!0},_e(i)):(J.value=St(J.value,i),Mo(i),Ro(i),bi(i)),_n(),!u&&!ko()&&Jn&&vi())}function Ro(i){i&&(ge.value[i]&&(ge.value=St(ge.value,i)),Fe.value[i]&&(Fe.value=St(Fe.value,i)),Me.value[i]&&(Me.value=St(Me.value,i)))}function eo(i){i&&(ge.value={...ge.value,[i]:!0},Fe.value[i]&&(Fe.value=St(Fe.value,i)),Me.value[i]&&(Me.value=St(Me.value,i)))}function to(i){i&&ge.value[i]===!0&&Fe.value[i]===!0&&Me.value[i]===!0&&Ro(i)}function Yo(i,u){!i||!u||ge.value[i]===!0&&Ro(i)}function Cs(i){const u=Object.keys(ge.value);if(u.length===0)return;let m=Fe.value,b=!1;for(const R of u)!i.has(R)||m[R]===!0||(m={...m,[R]:!0},b=!0);if(b){Fe.value=m;for(const R of u)to(R)}}function Sa(i,u){i&&ge.value[i]===!0&&u.some(m=>m.role==="user")&&(Me.value[i]!==!0&&(Me.value={...Me.value,[i]:!0}),to(i))}function si(i){i&&i!==n.value&&Ae.value[i]!==!0&&(Ae.value={...Ae.value,[i]:!0},_n())}function Gt(i,u){if(!i)return;const m=be.value[i];if(!u){m&&(be.value=St(be.value,i));return}const b=ta(u.label)||"Thinking",R=u.details.map(q=>ta(q)).filter(q=>q.length>0&&q!==b),E=Array.from(new Set([...(m==null?void 0:m.details)??[],...R])).slice(-3),L={label:b,details:E};VN(m,L)||(be.value={...be.value,[i]:L})}function Zt(i,u,m={}){if(!i)return;const b=se.value[i],R=u?El(u):"";if(!R){b&&(se.value=St(se.value,i));return}const E=m.transient===!0;(b==null?void 0:b.message)===R&&b.transient===E||(se.value={...se.value,[i]:{message:R,transient:E}})}function ii(i){var u;i&&(u=se.value[i])!=null&&u.transient&&Zt(i,null)}function Ts(){const i=Object.entries(se.value).filter(([,m])=>m==null?void 0:m.transient).map(([m])=>m);if(i.length===0)return;let u=se.value;for(const m of i)u=St(u,m);se.value=u}function no(i){const u=To(t.value).find(m=>m.id===i);return(u==null?void 0:u.updatedAtIso)??""}function dr(i,u){if(!i)return;const m={...Tn.value};u?m[i]=!0:delete m[i],Tn.value=m,RN(m)}function Wi(){const i=n.value;i&&dr(i,!Tr.value)}function fr(i,u){const m=o.value[i]??[];ml(m,u)||(o.value={...o.value,[i]:u})}function li(i,u,m=[],b=[],R=[]){const E=o.value[i]??[],L={id:`optimistic-user:${i}:${Date.now()}`,role:"user",text:u,images:m.length>0?[...m]:void 0,skills:b.length>0?b.map(q=>({name:q.name,path:q.path})):void 0,fileAttachments:R.length>0?R.map(q=>({...q})):void 0,messageType:"userMessage.optimistic"};fr(i,[...E,L])}function _a(i,u){const m=a.value[i]??[];ml(m,u)||(a.value={...a.value,[i]:u})}function $n(i){i&&i in a.value&&(a.value=St(a.value,i))}function Va(i,u){const m=B.value[i]??[];ml(m,u)||(B.value={...B.value,[i]:u})}function ci(i,u){const m=r.value[i]??[];ml(m,u)||(r.value={...r.value,[i]:u})}function ui(i,u){const m=r.value[i]??[],b=Su(m,u);ci(i,b),Vi(i,u)}function Vi(i,u){!i||!u||(s.value={...s.value,[i]:u},fv(s.value))}function Ss(i,u){const m=a.value[i]??[],b=Su(m,u);_a(i,b)}function $l(i,u){const m=B.value[i]??[],b=Su(m,u);Va(i,b)}function di(i,u){if(!i)return;const m=u.trim(),b=h.value[i]??"";if(m.length===0){if(!b)return;h.value=St(h.value,i);return}b!==m&&(h.value={...h.value,[i]:m},ye(i,m))}function Ir(i,u){if(!i)return;const m=h.value[i]??"";di(i,`${m}${u}`)}function Xr(i){if(!i)return;const u=Ee.value[i]??"";u&&P.set(i,u)}function pr(i,u=!1){var L;if(!i)return;const m=h.value[i];if(m===void 0){u||(_.delete(i),v.clear());return}const b=P.get(i)??Ee.value[i]??"";P.delete(i);const R=b?(L=re.value[i])==null?void 0:L[b]:void 0,E=xn(i);E.length>0?xa(i,E,b||void 0,R):u||Zr(i,m,b||void 0,R),h.value=St(h.value,i),u||(_.delete(i),v.clear(),we(i))}function Zr(i,u,m,b){if(!i)return;const R=u.trim();if(!R)return;const E=d.value[i]??[];if(E.some(Z=>Z.text===R))return;const L={id:`reasoning:local:${i}:${Date.now()}`,role:"system",text:R,messageType:"reasoning",reasoning:{summary:[],content:[R]},turnId:m||void 0,turnIndex:typeof b=="number"?b:void 0},q=[...E,L].slice(-20);d.value={...d.value,[i]:q},wu(d.value)}function xa(i,u,m,b){if(!i||u.length===0)return;const E=[...d.value[i]??[]];for(const q of u){const Z=q.text.trim();if(!Z)continue;const he=`reasoning:item:${i}:${q.itemId}`,Ne=E.findIndex(Je=>Je.id===he);if(Ne>=0){const Je=E[Ne],pt=q.anchorMessageId||Je.reasoningAnchorMessageId,it=typeof b=="number"?b:Je.turnIndex;if(Je.text===Z&&Je.turnIndex===it&&Je.reasoningAnchorMessageId===pt)continue;E[Ne]={...Je,text:Z,reasoning:{summary:[],content:[Z]},turnId:m||Je.turnId,turnIndex:it,reasoningAnchorMessageId:pt};continue}E.some(Je=>Je.text===Z)||E.push({id:he,role:"system",text:Z,messageType:"reasoning",reasoning:{summary:[],content:[Z]},turnId:m||void 0,turnIndex:typeof b=="number"?b:void 0,reasoningAnchorMessageId:q.anchorMessageId||void 0})}const L=E.slice(-20);d.value={...d.value,[i]:L},wu(d.value)}function hr(i){i&&i in r.value&&(r.value=St(r.value,i))}function Aa(i){i&&i in B.value&&(B.value=St(B.value,i))}function Mo(i){if(!i)return;hr(i);const u=s.value[i];if(u&&u.messageType==="plan.live"){const m={...u,messageType:"plan",plan:u.plan?{...u.plan,isStreaming:!1}:u.plan};s.value={...s.value,[i]:m},fv(s.value)}pr(i),cO(i),Gt(i,null),n.value,j.value[i]&&(j.value=St(j.value,i)),Ee.value[i]&&(Ee.value=St(Ee.value,i)),F(i)}function Ga(i){return i==="completed"?"completed":i==="inProgress"||i==="in_progress"?"inProgress":"pending"}function Er(i){var m;const u=[];(m=i.explanation)!=null&&m.trim()&&u.push(i.explanation.trim());for(const b of i.steps){const R=b.status==="completed"?"x":b.status==="inProgress"?"~":" ";u.push(`- [${R}] ${b.step}`)}return u.join(`
|
|
72
|
+
`).trim()}function wo(i){var he;if(i.method!=="turn/plan/updated")return null;const u=qe(i.params),m=cn(i),b=ke(u==null?void 0:u.turnId)||ke(u==null?void 0:u.turn_id),E=(Array.isArray(u==null?void 0:u.plan)?u==null?void 0:u.plan:[]).map(Ne=>qe(Ne)).map(Ne=>({step:ke(Ne==null?void 0:Ne.step),status:Ga(Ne==null?void 0:Ne.status)})).filter(Ne=>Ne.step.length>0);if(!m||!b)return null;const q={explanation:ke(u==null?void 0:u.explanation).trim()||void 0,steps:E,isStreaming:!0},Z=(he=re.value[m])==null?void 0:he[b];return{threadId:m,message:{id:`${b}:plan`,role:"assistant",text:Er(q),messageType:"plan.live",plan:q,turnId:b||void 0,turnIndex:typeof Z=="number"?Z:void 0}}}function Rr(i){var Ne;if(i.method!=="item/plan/delta")return null;const u=qe(i.params),m=cn(i),b=ke(u==null?void 0:u.turnId)||ke(u==null?void 0:u.turn_id),R=ke(u==null?void 0:u.delta);if(!m||!b||!R)return null;const E=`${b}:plan`,L=(r.value[m]??[]).find(Je=>Je.id===E),q=`${(L==null?void 0:L.text)??""}${R}`,Z=L!=null&&L.plan?{...L.plan,isStreaming:!0}:void 0,he=(Ne=re.value[m])==null?void 0:Ne[b];return{threadId:m,message:{id:E,role:"assistant",text:q,messageType:"plan.live",plan:Z,turnId:b||void 0,turnIndex:typeof he=="number"?he:void 0}}}function qe(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:null}function ke(i){return typeof i=="string"?i:""}function Un(i){return typeof i=="number"&&Number.isFinite(i)?i:null}function Pa(i){const u=qe(i);if(!u)return null;const m=Un(u.totalTokens??u.total_tokens),b=Un(u.inputTokens??u.input_tokens),R=Un(u.cachedInputTokens??u.cached_input_tokens),E=Un(u.outputTokens??u.output_tokens),L=Un(u.reasoningOutputTokens??u.reasoning_output_tokens);return m===null||b===null||R===null||E===null||L===null?null:{totalTokens:m,inputTokens:b,cachedInputTokens:R,outputTokens:E,reasoningOutputTokens:L}}function mr(i){const u=qe(i);if(!u)return null;const m=Pa(u.total),b=Pa(u.last);if(!m||!b)return null;const R=Un(u.modelContextWindow??u.model_context_window),E=b.totalTokens,L=typeof R=="number"?Math.max(R-E,0):null,q=typeof R=="number"&&R>0?Jy(Math.round((L??0)/R*100),0,100):null;return{total:m,last:b,modelContextWindow:R,currentContextTokens:E,remainingContextTokens:L,remainingContextPercent:q}}function _s(i){if(i.method!=="thread/tokenUsage/updated")return null;const u=qe(i.params),m=cn(i),b=mr((u==null?void 0:u.tokenUsage)??(u==null?void 0:u.token_usage));return!m||!b?null:{threadId:m,usage:b}}function cn(i){const u=qe(i.params);if(!u)return"";const m=ke(u.threadId);if(m)return m;const b=ke(u.thread_id);if(b)return b;const R=ke(u.conversationId);if(R)return R;const E=ke(u.conversation_id);if(E)return E;const L=qe(u.thread),q=ke(L==null?void 0:L.id);if(q)return q;const Z=qe(u.turn),he=ke(Z==null?void 0:Z.threadId);if(he)return he;const Ne=ke(Z==null?void 0:Z.thread_id);return Ne||""}function ea(i){if(i.method!=="turn/completed")return"";const u=qe(i.params),m=qe(u==null?void 0:u.turn);if(!m||m.status!=="failed")return"";const b=qe(m.error);return ke(b==null?void 0:b.message)}function jl(i){var b;if(i.method!=="error")return null;const u=qe(i.params),m=ke(u==null?void 0:u.message)||ke((b=qe(u==null?void 0:u.error))==null?void 0:b.message);return m?{message:m,transient:(u==null?void 0:u.willRetry)===!0}:null}function Ka(i){const u=qe(i);if(!u)return null;const m=u.id,b=ke(u.method),R=u.params;if(typeof m!="number"||!Number.isInteger(m)||!b)return null;const E=qe(R),L=jn(b,E),q=ke(E==null?void 0:E.threadId)||ke(E==null?void 0:E.thread_id)||ke(E==null?void 0:E.conversationId)||ke(E==null?void 0:E.conversation_id)||cl,Z=ke(E==null?void 0:E.turnId)||ke(E==null?void 0:E.turn_id),he=ke(E==null?void 0:E.itemId)||ke(E==null?void 0:E.item_id)||ke(E==null?void 0:E.callId)||ke(E==null?void 0:E.call_id),Ne=ke(u.receivedAtIso)||new Date().toISOString();return{id:m,method:L,threadId:q,turnId:Z,itemId:he,receivedAtIso:Ne,params:R??null}}function jn(i,u){const m=i.trim();return m&&(m==="item/commandExecution/requestApproval"||m==="execCommandApproval"||m==="exec_approval_request"||Jo(u)?"item/commandExecution/requestApproval":m==="item/fileChange/requestApproval"||m==="applyPatchApproval"||m==="apply_patch_approval_request"||bo(u)?"item/fileChange/requestApproval":m==="item/tool/requestUserInput"||m==="request_user_input"||Mr(u)?"item/tool/requestUserInput":m==="mcpServer/elicitation/request"||m==="elicitation_request"||Ya(u)?"mcpServer/elicitation/request":m==="item/permissions/requestApproval"||Ia(u)?"item/permissions/requestApproval":m==="item/tool/call"||m==="dynamic_tool_call_request"||Ln(u)?"item/tool/call":m)}function Jo(i){if(!i)return!1;const u=i.command;return Array.isArray(u)&&u.some(m=>typeof m=="string"&&m.trim().length>0)||typeof u=="string"&&u.trim().length>0?!0:Array.isArray(i.commandActions)}function bo(i){return i?typeof i.grantRoot=="string"&&i.grantRoot.trim().length>0||typeof i.grant_root=="string"&&i.grant_root.trim().length>0||qe(i.fileChanges)?!0:qe(i.changes)!==null:!1}function Mr(i){return!!(i&&Array.isArray(i.questions))}function Ln(i){return i?typeof i.toolName=="string"||typeof i.tool_name=="string"||typeof i.name=="string"||Array.isArray(i.arguments):!1}function Ya(i){if(!i)return!1;const u=ke(i.mode);return typeof i.serverName=="string"&&typeof i.threadId=="string"&&typeof i.message=="string"&&(u==="form"||u==="url")}function Ia(i){return i?typeof i.threadId=="string"&&typeof i.turnId=="string"&&typeof i.itemId=="string"&&qe(i.permissions)!==null:!1}function $r(i){if(i.method!=="item/tool/requestUserInput")return[];const u=qe(i.params),m=Array.isArray(u==null?void 0:u.questions)?u.questions:[],b=[];for(const R of m){const E=qe(R),L=ke(E==null?void 0:E.id).trim();L&&b.push(L)}return b}function fi(i){const u=i.threadId||cl,m=rt.value[u]??[],b=m.findIndex(E=>E.id===i.id),R=[...m];b>=0?R.splice(b,1,i):R.push(i),rt.value={...rt.value,[u]:R.sort((E,L)=>E.receivedAtIso.localeCompare(L.receivedAtIso))},_n()}function Qo(i){const u={};for(const[m,b]of Object.entries(rt.value)){const R=b.filter(E=>E.id!==i);R.length>0&&(u[m]=R)}rt.value=u,pe.value[String(i)]&&(pe.value=St(pe.value,String(i))),_n()}function Xo(i){return pe.value[String(i)]??""}function vr(i){const u={},m=new Set;for(const R of i){const E=R.threadId||cl,L=u[E]??[];L.push(R),u[E]=L,m.add(R.id)}for(const R of Object.values(u))R.sort((E,L)=>E.receivedAtIso.localeCompare(L.receivedAtIso));rt.value=u;const b={};for(const[R,E]of Object.entries(pe.value))m.has(Number(R))&&(b[R]=E);pe.value=b}function wn(i){if(i.method==="server/request"){const u=Ka(i.params);return u&&fi(u),!0}if(i.method==="server/request/resolved"){const u=qe(i.params),m=u==null?void 0:u.id;return typeof m=="number"&&Number.isInteger(m)&&Qo(m),!0}return!1}function ta(i){return i.replace(/\s+/gu," ").trim()}function Ea(i){const u=cn(i);if(!u)return null;if(i.method==="turn/started")return{threadId:u,activity:{label:"Thinking",details:[]}};if(i.method==="item/started"){const m=qe(i.params),b=qe(m==null?void 0:m.item),R=ke(b==null?void 0:b.type).toLowerCase();if(R==="reasoning")return{threadId:u,activity:{label:"Thinking",details:[]}};if(R==="agentmessage")return{threadId:u,activity:{label:"Writing response",details:[]}};if(R==="commandexecution"){const E=ke(b==null?void 0:b.command);return{threadId:u,activity:{label:"Running command",details:E?[E]:[]}}}if(R==="filechange"){const L=(Array.isArray(b==null?void 0:b.changes)?b.changes:[])[0],q=ke(L==null?void 0:L.path);return{threadId:u,activity:{label:"Applying changes",details:q?[q]:[]}}}}return i.method==="item/commandExecution/outputDelta"?{threadId:u,activity:{label:"Running command",details:[]}}:i.method==="item/fileChange/outputDelta"?{threadId:u,activity:{label:"Applying changes",details:[]}}:i.method==="item/reasoning/summaryTextDelta"||i.method==="item/reasoning/summaryPartAdded"||i.method==="item/reasoning/textDelta"?{threadId:u,activity:{label:"Thinking",details:[]}}:i.method==="item/agentMessage/delta"?{threadId:u,activity:{label:"Writing response",details:[]}}:null}function na(i){if(i.method!=="turn/started")return null;const u=qe(i.params);if(!u)return null;const m=cn(i);if(!m)return null;const b=qe(u.turn),R=ke(b==null?void 0:b.id)||ke(u.turnId)||`${m}:unknown`;if(!R)return null;const E=qs(ke(b==null?void 0:b.startedAt))??qs(ke(u.startedAt))??qs(i.atIso)??Date.now();return{threadId:m,turnId:R,startedAtMs:E}}function Ja(i){if(i.method!=="turn/completed")return null;const u=qe(i.params);if(!u)return null;const m=cn(i);if(!m)return null;const b=qe(u.turn),R=ke(b==null?void 0:b.id)||ke(u.turnId)||`${m}:unknown`;if(!R)return null;const E=qs(ke(b==null?void 0:b.completedAt))??qs(ke(u.completedAt))??qs(i.atIso)??Date.now(),L=qs(ke(b==null?void 0:b.startedAt))??qs(ke(u.startedAt))??void 0;return{threadId:m,turnId:R,completedAtMs:E,startedAtMs:L}}function Zo(i){return`${i}:live-reasoning`}function oa(i){const u=o.value[i]??[];let m=-1;for(const b of u)typeof b.turnIndex=="number"&&Number.isFinite(b.turnIndex)&&(m=Math.max(m,b.turnIndex));return m+1}function Ra(i,u,m){if(!i||!u||!Number.isInteger(m)||m<0)return;const b=re.value[i]??{};b[u]!==m&&(re.value={...re.value,[i]:{...b,[u]:m}})}function Qa(i,u){const m=re.value[i]??{},b=Object.entries(m),R=Object.entries(u);b.length===R.length&&b.every(([E,L])=>u[E]===L)||(re.value={...re.value,[i]:{...u}})}function Ll(i,u){var b;if(!i||!u)return;const m=(b=re.value[i])==null?void 0:b[u];return typeof m=="number"?m:void 0}function pi(i){const u=B.value[i];if(!u||u.length===0)return;const m=re.value[i]??{};let b=!1;const R=u.map(E=>{if(typeof E.turnIndex=="number"||!E.turnId)return E;const L=m[E.turnId];return typeof L!="number"?E:(b=!0,{...E,turnIndex:L})});b&&(B.value={...B.value,[i]:R})}function xs(i){const u=qe(i.params);if(!u)return"";if(i.method==="item/started"){const m=qe(u.item);return!m||m.type!=="reasoning"?"":ke(m.id)}return""}function jr(i){const u=qe(i.params);if(!u)return null;if(i.method==="item/reasoning/summaryTextDelta"){const m=ke(u.itemId),b=ke(u.delta);return!m||!b?null:{messageId:Zo(m),itemId:m,delta:b}}if(i.method==="item/reasoning/textDelta"){const m=ke(u.itemId),b=ke(u.delta);return!m||!b?null:{messageId:Zo(m),itemId:m,delta:b}}return null}function Lr(i){const u=qe(i.params);if(!u)return"";if(i.method==="item/reasoning/summaryPartAdded"){const m=ke(u.itemId);return m?Zo(m):""}return""}function ra(i){const u=qe(i.params);if(!u)return"";if(i.method==="item/completed"){const m=qe(u.item);return!m||m.type!=="reasoning"?"":Zo(ke(m.id))}return""}function Xa(i){var m;const u=[];for(const b of["content","summary"]){const R=Array.isArray(i[b])?i[b]:[];for(const E of R){const L=typeof E=="string"?E:(m=qe(E))==null?void 0:m.text;typeof L=="string"&&L.trim()&&u.push(L)}}return u.join(`
|
|
73
|
+
`).trim()}function Gi(i){if(i.method!=="item/started"&&i.method!=="item/completed")return null;const u=qe(i.params),m=qe(u==null?void 0:u.item);if(!m||ke(m.type).toLowerCase()!=="reasoning")return null;const b=ke(m.id);return b?{itemId:b,text:Xa(m)}:null}function Jt(i,u,m){if(!i||!m)return;m.trim()&&y.set(u,m.trim());const b=h.value[i]??"",R=v.get(u)??"";if(b.endsWith(m)||R&&m===R){v.set(u,m);return}if(R&&m.startsWith(R)){const L=m.slice(R.length);L&&Ir(i,L),v.set(u,m);return}const E=b.length>0&&!b.endsWith(`
|
|
74
|
+
`)?`
|
|
75
|
+
|
|
76
|
+
`:"";Ir(i,`${E}${m}`),v.set(u,m)}function oo(i){const u=qe(i.params);if(!u)return;const m=i.method==="item/started"||i.method==="item/completed",b=i.method==="item/reasoning/textDelta"||i.method==="item/reasoning/summaryTextDelta";if(!m&&!b)return;const R=qe(u.item),E=ke(b?u.itemId:R==null?void 0:R.id);if(!E)return;const L=cn(i);if(!L)return;const q=b||ke(R==null?void 0:R.type).toLowerCase()==="reasoning"?"reasoning":"other",Z=_.get(L)??[];Z.some(he=>he.itemId===E)||_.set(L,[...Z,{itemId:E,kind:q}])}function xn(i){var R;const u=_.get(i)??[],m=[];let b="";for(const E of u)if(E.kind==="reasoning"){const L=((R=y.get(E.itemId))==null?void 0:R.trim())??"";L&&m.push({text:L,anchorMessageId:b,itemId:E.itemId})}else b=E.itemId;return m}function As(i){var Z;if(i.method!=="item/started"&&i.method!=="item/completed")return null;const u=qe(i.params),m=qe(u==null?void 0:u.item);if(!m||ke(m.type).toLowerCase()!=="plan")return null;const b=cn(i),R=ke(u==null?void 0:u.turnId)||ke(u==null?void 0:u.turn_id),E=ke(m.id),L=ke(m.text);if(!b||!E||!L)return null;const q=b&&R?(Z=re.value[b])==null?void 0:Z[R]:void 0;return{threadId:b,message:{id:E,role:"assistant",text:L,messageType:i.method==="item/completed"?"plan":"plan.live",plan:Dy(L)??void 0,turnId:R||void 0,turnIndex:typeof q=="number"?q:void 0}}}function er(i){const u=qe(i.params);if(!u)return"";if(i.method==="item/started"){const m=qe(u.item);return!m||m.type!=="agentMessage"?"":ke(m.id)}return""}function Za(i){const u=qe(i.params);if(!u)return null;if(i.method==="item/agentMessage/delta"){const m=ke(u.itemId),b=ke(u.delta);return!m||!b?null:{messageId:m,delta:b}}return null}function w(i){const u=qe(i.params);if(!u)return null;if(i.method==="item/completed"){const m=qe(u.item);if(!m||m.type!=="agentMessage")return null;const b=ke(m.id),R=ke(m.text);return!b||!R?null:{id:b,role:"assistant",text:R,messageType:"agentMessage.live"}}return null}function k(i){return`/codex-local-image?path=${encodeURIComponent(i)}`}function C(i){const u=i.trim();if(!u)return"";if(u.startsWith("data:")||u.startsWith("http://")||u.startsWith("https://")||u.startsWith("/codex-local-image?"))return u;const m=u.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(m)?`data:image/png;base64,${m}`:""}function D(i){if(i.method!=="item/completed")return null;const u=qe(i.params),m=qe(u==null?void 0:u.item);if(!m)return null;const b=ke(m.id);if(!b)return null;if(m.type==="imageView"){const L=ke(m.path);return L?{id:b,role:"assistant",text:"",images:[k(L)],messageType:"imageView"}:null}if(m.type!=="imageGeneration"&&m.type!=="image_generation")return null;const R=ke(m.result),E=R?C(R):"";return E?{id:b,role:"assistant",text:"",images:[E],messageType:"imageView"}:null}function Ce(i){var he;if(i.method!=="item/started")return null;const u=qe(i.params),m=qe(u==null?void 0:u.item);if(!m||m.type!=="commandExecution")return null;const b=ke(m.id),R=ke(m.command);if(!b)return null;const E=typeof m.cwd=="string"?m.cwd:null,L=cn(i),q=ke(u==null?void 0:u.turnId)||ke(u==null?void 0:u.turn_id),Z=L&&q?(he=re.value[L])==null?void 0:he[q]:void 0;return{id:b,role:"system",text:R,messageType:"commandExecution",commandExecution:{command:R,cwd:E,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:q||void 0,turnIndex:typeof Z=="number"?Z:void 0}}function st(i){if(i.method!=="item/commandExecution/outputDelta")return null;const u=qe(i.params);if(!u)return null;const m=ke(u.itemId),b=ke(u.delta);return!m||!b?null:{itemId:m,delta:b}}function Rt(i){var it;if(i.method!=="item/completed")return null;const u=qe(i.params),m=qe(u==null?void 0:u.item);if(!m||m.type!=="commandExecution")return null;const b=ke(m.id),R=ke(m.command);if(!b)return null;const E=typeof m.cwd=="string"?m.cwd:null,L=ke(m.status),q=L==="failed"?"failed":L==="declined"?"declined":L==="interrupted"?"interrupted":"completed",Z=typeof m.aggregatedOutput=="string"?m.aggregatedOutput:"",he=typeof m.exitCode=="number"?m.exitCode:null,Ne=cn(i),Je=ke(u==null?void 0:u.turnId)||ke(u==null?void 0:u.turn_id),pt=Ne&&Je?(it=re.value[Ne])==null?void 0:it[Je]:void 0;return{id:b,role:"system",text:R,messageType:"commandExecution",commandExecution:{command:R,cwd:E,status:q,aggregatedOutput:Z,exitCode:he},turnId:Je||void 0,turnIndex:typeof pt=="number"?pt:void 0}}function $o(i){var he;if(i.method!=="item/completed")return null;const u=qe(i.params),m=qe(u==null?void 0:u.item);if(!m||m.type!=="fileChange")return null;const b=ke(m.id);if(!b)return null;const R=ke(u==null?void 0:u.threadId),E=ke(u==null?void 0:u.turnId),L=R&&E?(he=re.value[R])==null?void 0:he[E]:void 0,q=Nf(m.changes),Z=dy(m.status);return q.length===0||Z!=="completed"?null:{id:b,role:"system",text:"",messageType:"fileChange",fileChangeStatus:Z,fileChanges:q,turnId:E||void 0,turnIndex:typeof L=="number"?L:void 0}}function Kt(i,u){const m=j.value[i]??[],b=Su(m,u);b!==m&&(j.value={...j.value,[i]:b})}function Nn(i,u){const m=j.value[i];if(!m||m.length===0)return;const b=new Set(u.map(E=>E.id)),R=m.filter(E=>!b.has(E.id));R.length!==m.length&&(R.length===0?j.value=St(j.value,i):j.value={...j.value,[i]:R})}function bn(i,u){const m=B.value[i];if(!m||m.length===0)return;const b=new Set(u.map(q=>q.id)),R=new Set(u.filter(q=>q.messageType==="fileChange"&&typeof q.turnId=="string"&&q.turnId.length>0).map(q=>q.turnId)),E=new Set(u.filter(q=>q.messageType==="fileChange"&&typeof q.turnIndex=="number").map(q=>q.turnIndex)),L=m.filter(q=>!b.has(q.id)&&!(q.turnId&&R.has(q.turnId))&&!(typeof q.turnIndex=="number"&&E.has(q.turnIndex)));L.length!==m.length&&(L.length===0?B.value=St(B.value,i):B.value={...B.value,[i]:L})}function tr(i){if(i.method==="item/agentMessage/delta")return!0;const u=qe(i.params);if(!u)return!1;if(i.method==="item/completed"){const m=qe(u.item);return(m==null?void 0:m.type)==="agentMessage"}return!1}const Nr=new Set;function jo(i){for(const u of Nr)try{u(i)}catch{}}function Ps(i){return Nr.add(i),()=>{Nr.delete(i)}}function hi(i,u,m){if(!i||!u)return;const b=B.value[i];if(!b)return;const R=b.findIndex(L=>L.id===u||L.turnId===u);if(R<0)return;const E=[...b];E[R]={...E[R],fileChanges:m},Va(i,E)}function mi(i,u,m){if(!i||!u)return;const b=B.value[i];if(!b)return;const R=b.findIndex(q=>q.turnId===u);if(R<0)return;const E=[...b],L=E[R];E[R]={...L,fileChanges:(L.fileChanges??[]).map(q=>({...q,diff:m}))},Va(i,E)}function Is(i){var Wc,Vc,Gc,ol,Kc,Yc;if(wn(i))return;if(oo(i),i.method==="turn/started"){const Re=cn(i);Re&&_.delete(Re)}if(vN.has(i.method))return;if(i.method==="app/list/updated"||i.method==="mcpServer/startupStatus/updated"||i.method==="mcpServer/oauthLogin/completed"||i.method==="remoteControl/status/changed"){jo(i.method);return}if(i.method==="skills/changed"){Rs({force:!0});return}if(i.method==="hook/started"||i.method==="hook/completed"){Ki({force:!0});return}if(i.method==="thread/status/changed"){const Re=cn(i);Re&&Re===n.value&&Yt.add(Re);return}if(i.method==="thread/archived"||i.method==="thread/unarchived"||i.method==="thread/deleted"||i.method==="thread/closed")return;if(i.method==="item/fileChange/patchUpdated"||i.method==="turn/diff/updated"){const Re=qe(i.params),Ot=ke(Re==null?void 0:Re.threadId);Ot&&(i.method==="item/fileChange/patchUpdated"?hi(Ot,ke(Re==null?void 0:Re.itemId),Nf(Re==null?void 0:Re.changes)):mi(Ot,ke(Re==null?void 0:Re.turnId),ke(Re==null?void 0:Re.diff)??""),Ot===n.value&&Yt.add(Ot));return}if(i.method==="account/rateLimits/updated"&&Pr(),i.method==="thread/name/updated"){const Re=qe(i.params),Ot=ke(Re==null?void 0:Re.threadId),Ns=ke(Re==null?void 0:Re.threadName);if(Ot&&Ns){const Jc=zs(Ns);W.value={...W.value,[Ot]:Jc},_n(),pu(Ot,Jc)}}if(i.method==="thread/compacted"){const Re=qe(i.params),Ot=ke(Re==null?void 0:Re.threadId);Ot&&(Ms(Ot,!1),yr(Ot,"done"),Yt.add(Ot));return}if(i.method==="fuzzyFileSearch/sessionUpdated"){const Re=qe(i.params),Ot=ke(Re==null?void 0:Re.sessionId);Ot&&Ot===Qt&&(Cr.value=BS(Re));return}if(i.method==="fuzzyFileSearch/sessionCompleted"){const Re=qe(i.params),Ot=ke(Re==null?void 0:Re.sessionId);Ot&&Ot===Qt&&(Qt="");return}if(i.method==="account/rateLimits/updated"){Ar(gy(i.params));return}const u=_s(i);if(u){Jr(u.threadId,u.usage);return}const m=Ea(i);m&&Gt(m.threadId,m.activity);const b=cn(i),R=jl(i);!R&&b&&ii(b);const E=na(i);E&&(Xn.set(E.turnId,E),Ra(E.threadId,E.turnId,oa(E.threadId)),Ee.value={...Ee.value,[E.threadId]:E.turnId},Yo(E.threadId,E.turnId),hr(E.threadId),Aa(E.threadId),ln(E.threadId,null),Zt(E.threadId,null),hn(E.threadId,!0),Bl(E.threadId),Ae.value[E.threadId]&&(Ae.value=St(Ae.value,E.threadId)));const L=Ja(i),q=ea(i),Z=(L==null?void 0:L.threadId)??cn(i),he=Z?sn(Z):"",Ne=!!Z&&!!q&&he!==ca&&Tu(new Error(q));if(L){gt.value[L.threadId];const Re=Xn.get(L.turnId);Re&&Xn.delete(L.turnId);const Ot=Un((Wc=qe(i.params))==null?void 0:Wc.durationMs)??Un((Gc=qe((Vc=qe(i.params))==null?void 0:Vc.turn))==null?void 0:Gc.durationMs)??(typeof L.startedAtMs=="number"?L.completedAtMs-L.startedAtMs:null)??(Re?L.completedAtMs-Re.startedAtMs:null),Ns=typeof Ot=="number"?Math.max(0,Ot):0;ln(L.threadId,{turnId:L.turnId,durationMs:Ns}),Ee.value[L.threadId]&&(Ee.value=St(Ee.value,L.threadId)),hn(L.threadId,!1),Gt(L.threadId,null),si(L.threadId),Ne||(F(L.threadId),Bl(L.threadId))}if(q){const Re=(L==null?void 0:L.threadId)||cn(i);Re&&Zt(Re,q),ut.value=q,Re&&Ne&&ne(Re)}else L&&Zt(L.threadId,null);if(R){const Re=b,Ot=Re?sn(Re):ft.value.trim();Re&&Zt(Re,R.message,{transient:R.transient}),ut.value=R.message,Ot!==ca&&Tu(new Error(R.message))&&(Re?ne(Re):go())}const Je=wo(i);Je&&(ui(Je.threadId,Je.message),Gt(Je.threadId,{label:"Planning",details:((ol=Je.message.plan)==null?void 0:ol.steps.map(Re=>Re.step).slice(0,2))??[]}));const pt=Rr(i);pt&&(ui(pt.threadId,pt.message),Gt(pt.threadId,{label:"Planning",details:[]}));const it=As(i);if(it&&(ui(it.threadId,it.message),Gt(it.threadId,{label:"Planning",details:((Kc=it.message.plan)==null?void 0:Kc.steps.map(Re=>Re.step).slice(0,2))??[]})),!b||b!==n.value)return;er(i);const Mt=Za(i);if(Mt){const Re=(a.value[b]??[]).find(Ns=>Ns.id===Mt.messageId),Ot=`${(Re==null?void 0:Re.text)??""}${Mt.delta}`;Ss(b,{id:Mt.messageId,role:"assistant",text:Ot,messageType:"agentMessage.live"})}const Oa=w(i);Oa&&Ss(b,Oa);const $s=D(i);$s&&Ss(b,$s),xs(i)&&Xr(b);const wr=jr(i);if(wr&&(Ir(b,wr.delta),wr.itemId&&wr.delta)){const Re=y.get(wr.itemId)??"";Re.endsWith(wr.delta)||y.set(wr.itemId,`${Re}${wr.delta}`)}const js=Gi(i);if(js&&(Jt(b,js.itemId,js.text),Xr(b)),Lr(i)){const Re=h.value[b]??"";Re.trim().length>0&&!Re.endsWith(`
|
|
77
|
+
|
|
78
|
+
`)&&di(b,`${Re}
|
|
79
|
+
|
|
80
|
+
`)}ra(i);const os=Ce(i);os&&(Kt(b,os),Gt(b,{label:"Running command",details:[((Yc=os.commandExecution)==null?void 0:Yc.command)??""]}));const Ls=st(i);if(Ls){const Re=(j.value[b]??[]).find(Ot=>Ot.id===Ls.itemId);Re!=null&&Re.commandExecution&&Kt(b,{...Re,commandExecution:{...Re.commandExecution,aggregatedOutput:`${Re.commandExecution.aggregatedOutput}${Ls.delta}`}})}const zc=Rt(i);zc&&Kt(b,zc);const Hc=$o(i);if(Hc&&$l(b,Hc),tr(i)&&pr(b,!0),i.method==="turn/completed"){Hn=!1,pr(b),y.clear(),j.value[b]&&(j.value=St(j.value,b));const Re=cn(i);Re&&(yo(Re),hn(Re,!1),Gt(Re,null),si(Re),Ne||(F(Re),Bl(Re)))}}function Ma(i){if(i.method==="thread/tokenUsage/updated"||i.method.startsWith("thread/realtime/"))return;const u=i.method,m=u==="turn/started"||u==="turn/completed"||u==="error",b=u.startsWith("thread/")||u==="turn/completed";if(!m&&!b)return;const R=cn(i);R&&m&&Yt.add(R),b&&(nn=!0,Kr=!0),!(ht!==null||typeof window>"u")&&(ht=window.setTimeout(()=>{ht=null,Ur()},yu))}async function Lo(i,u){if(!po){po=!0;try{if(!u)return;const m=[];for(const b of hd(u)){const R=Ui(b);m.includes(R)||m.push(R)}if(m.length>0){const b=u.projectOrder.length>0?ul(m,i):ul(z.value,i);us(z.value,b)||(z.value=b)}if(Object.keys(u.labels).length>0||(u.remoteProjects??[]).length>0){const b={...Be.value};let R=!1;for(const[E,L]of Object.entries(u.labels)){const q=ot(E).trim(),Z=[Ui(E)];q&&Z.push(q);for(const he of Z)b[he]!==L&&(b[he]=L,R=!0)}for(const E of u.order){const L=Ui(E),q=Hr(Cl(E));if(!q.startsWith(".")||q===L)continue;const Z=`${L} ${q}`;b[L]!==void 0||b[L]===Z||(b[L]=Z,R=!0)}for(const E of u.remoteProjects??[]){const L=nO(E);b[E.id]!==L&&(b[E.id]=L,R=!0)}R&&(Be.value=b)}}catch{}}}async function Nl(i={}){if(!(i.force!==!0&&Object.keys(W.value).length>0))try{const u=await Px();if(Object.keys(u.titles).length>0){const m={};for(const[b,R]of Object.entries(u.titles))m[b]=zs(R);W.value=m}}catch{}}async function jc(){try{return await pl()}catch{return null}}function $a(i,u,m){const b=i.trim();if(b)return zs(b);const R=m.map(E=>E.label.trim()).find(E=>E.length>0);return R?zs(R):u.length>0?zs("[Image]"):"Untitled thread"}async function Lc(i,u,m,b=[],R=[]){if(W.value[i])return;const E=u.trim();if(!E){const q=$a(u,b,R);W.value={...W.value,[i]:q},_n(),pu(i,q);return}const L=E.length>300?E.slice(0,300):E;try{const q=await Lx(L,m);if(!q||W.value[i])return;const Z=q.length>Kf?q.slice(0,Kf):q;W.value={...W.value,[i]:Z},_n(),pu(i,Z)}catch{}}function md(i,u){const m=Gf(i,u),b=sO(i,u),R=iO(b,u,m);if(!u||u.order.length===0&&(u.remoteProjects??[]).length===0)return R;const E=new Set;for(const q of Vf(u,m))E.add(q);const L=R.filter(q=>E.has(q.projectName)?!0:Yf(q));return aO(L,u,m)}function ja(i,u){const m=md(i,u),b=!!(u&&(u.order.length>0||u.projectOrder.length>0||(u.remoteProjects??[]).length>0)),R=u!=null&&u.projectOrder.length?ul(Vf(u,Gf(i,u)),m):ul(z.value,m);us(z.value,R)||(z.value=R,b||rc(z.value));const E=mf(m,z.value);Cs(new Set(To(E).map(Z=>Z.id)));const L=eO(t.value,E,J.value);t.value=_u(t.value,L),J.value=kn(J.value,new Set(To(t.value).map(Z=>Z.id))),new Set(To(t.value).map(Z=>Z.id));const q={};for(const Z of To(t.value))q[Z.id]=Z.externalSession??$e.value[Z.id]??null;$e.value=q,_n()}function Or(i){const u={};for(const[m,b]of Object.entries(i)){const R=m.trim();!R||b.length===0||(u[R]=b.map(E=>({id:E.id,text:E.text,imageUrls:[...E.imageUrls],skills:E.skills.map(L=>({name:L.name,path:L.path})),fileAttachments:E.fileAttachments.map(L=>({label:L.label,path:L.path,fsPath:L.fsPath})),collaborationMode:E.collaborationMode})))}return u}function aa(){nx(Or(de.value)).catch(()=>{})}async function Ol(){if(!xe){xe=!0;try{de.value=await $m()}catch{}}}function Bn(i){$t=bv($t,i),t.value=bv(t.value,i),J.value=St(J.value,i),_n()}function No(i,u){if(i.length===0)return u;if(u.length===0)return i;const m=new Map;for(const R of To(i))m.set(R.id,R);for(const R of To(u))m.set(R.id,R);const b=new Map;for(const R of m.values()){const E=b.get(R.projectName);E?E.push(R):b.set(R.projectName,[R])}return Array.from(b.entries()).map(([R,E])=>({projectName:R,threads:E.sort((L,q)=>new Date(q.updatedAtIso).getTime()-new Date(L.updatedAtIso).getTime())})).sort((R,E)=>{var Z,he;const L=new Date(((Z=R.threads[0])==null?void 0:Z.updatedAtIso)??0).getTime();return new Date(((he=E.threads[0])==null?void 0:he.updatedAtIso)??0).getTime()-L})}function ko(){return Object.values(J.value).some(i=>i===!0)}function vi(i=zn){if(!(!Jn||Po||ko())){if(zn=i,typeof window>"u"){Dr(i);return}Qn!==null&&window.clearTimeout(Qn),Qn=window.setTimeout(()=>{Qn=null,!(!Jn||ko())&&Dr(zn)},cN)}}async function Dr(i){if(!(Po||!Jn||ko())){Po=!0;try{const u=await km(Jn,ZS());Jn=u.nextCursor,Pt=u.nextCursor===null,Nt.value=Pt,$t=No($t,u.groups),ja($t,i)}catch{}finally{Po=!1,Jn&&!ko()&&vi(i)}}}async function Es(i={}){if(sr){await sr;return}i.force!==!0&&zo.value&&Date.now()-ba<fN||(sr=(async()=>{var u;zo.value||(Ze.value=!0);try{const[m,b]=await Promise.all([km(),jc(),Nl({force:i.force===!0})]);zn=b;const R=m.groups;$t=R,Jn=m.nextCursor,Pt=m.nextCursor===null,Nt.value=Pt,await Lo(R,b),ja($t,b),zo.value=!0,ba=Date.now(),Pt||vi(b);const E=To(e.value);Hi(E),!E.some(q=>q.id===n.value)&&!n.value&&fn(((u=E[0])==null?void 0:u.id)??"")}finally{Ze.value=!1}})().finally(()=>{sr=null}),await sr)}async function sa(i,u={}){var q;if(!i)return;const m=Date.now()-(ka.get(i)??0)<lv;if((q=se.value[i])!=null&&q.transient&&(u.silent===!0||m))return;const b=ir.get(i);if(b&&u.force!==!0){await b;return}const R=O.value[i]===!0,E=u.silent!==!0&&!R;E&&(Ft.value=!0);const L=(async()=>{try{const Z=no(i),he=$.value[i]??"",Ne=Date.now()-(Yr.get(i)??0)<lv;if(u.force===!0?!1:R&&(Ne||(Z.length===0||he===Z)&&J.value[i]!==!0)){ai(i);return}const it=ie.value[i]!==!0?await of(i):null,Mt=it??await nf(i);Mt.modelProvider&&xr(i,Mt.modelProvider),Mt.model&&vo(i,Go(i,Mt.model,Mt.modelProvider)),it&&(ie.value={...ie.value,[i]:!0});const{messages:Oa,inProgress:$s,activeTurnId:ia,turnIndexByTurnId:wr}=Mt;G.value={...G.value,[i]:Mt.hasMoreOlder===!0},Sa(i,Oa),Qa(i,wr),pi(i);const js=o.value[i]??[],qc=wv(js,Oa,{preserveMissing:u.silent===!0||BN(js)});fr(i,qc);const os=a.value[i]??[];if($s){const Ls=zN(os,Oa);_a(i,Ls)}else $n(i);Nn(i,Oa),bn(i,Oa),O.value={...O.value,[i]:!0},Yr.set(i,Date.now()),ka.delete(i),Z&&($.value={...$.value,[i]:Z}),hn(i,$s),Mt.externalSession&&($e.value={...$e.value,[i]:Mt.externalSession}),ii(i),ia?Ee.value={...Ee.value,[i]:ia}:Ee.value[i]&&(Ee.value=St(Ee.value,i)),$s||Mo(i),ai(i)}catch(Z){const he=Z instanceof Error?Z.message:"Unknown application error";throw n.value===i&&Zt(i,he,{transient:!0}),ka.set(i,Date.now()),Z}finally{E&&(Ft.value=!1)}})().finally(()=>{ir.delete(i)});ir.set(i,L),await L}async function Fr(i=n.value){if(!i||ue.value[i]===!0||G.value[i]!==!0)return;const u=Sn(i);if(!u){G.value={...G.value,[i]:!1};return}ue.value={...ue.value,[i]:!0};try{const m=await t_(i,u),b=o.value[i]??[],R=wv(m.messages,b,{preserveMissing:!0});fr(i,R),Qa(i,{...re.value[i]??{},...m.turnIndexByTurnId}),pi(i),G.value={...G.value,[i]:m.hasMoreOlder}}catch(m){throw ut.value=m instanceof Error?m.message:"Failed to load earlier messages",m}finally{ue.value={...ue.value,[i]:!1}}}async function gi(i,u={}){var m;i&&O.value[i]!==!0&&(u.silent===!0&&((m=se.value[i])!=null&&m.transient)||await sa(i,u))}async function Rs(i={}){var b,R;const u=((R=(b=ho.value)==null?void 0:b.cwd)==null?void 0:R.trim())??"",m=u||"__global__";if(Yn){await Yn;return}i.force!==!0&&Ha&&Gr===m&&Date.now()-In<pN||(Yn=(async()=>{try{Y.value=await Ox(u?[u]:void 0),Ha=!0,In=Date.now(),Gr=m}catch{}finally{Yn=null}})(),await Yn)}async function Ki(i={}){if(lr){await lr;return}i.force!==!0&&Dn||(We.value=!0,lr=(async()=>{try{Oe.value=await l_(),Dn=!0}catch{}finally{We.value=!1,lr=null}})(),await lr)}async function La(i={}){await Promise.allSettled([Xt({providerChanged:i.providerChanged,includeProviderModels:i.includeProviderModels}),jt(),qt(),Rs()])}function Dl(i={}){const u=()=>{La(i)};if(typeof window>"u"){u();return}window.setTimeout(u,0)}async function yi(i={}){ut.value="",ae.value="";const u=i.includeSelectedThreadMessages!==!1,m=i.awaitAncillaryRefreshes===!0;try{if(await Ol(),await Es({force:i.forceThreadRefresh===!0}),u)try{await sa(n.value)}catch(b){ut.value=b instanceof Error?b.message:"Unknown application error"}m?await La({providerChanged:i.providerChanged,includeProviderModels:i.providerChanged===!0||m}):Dl({providerChanged:i.providerChanged,includeProviderModels:!1})}catch(b){ut.value=b instanceof Error?b.message:"Unknown application error",uv(b)?ae.value=cv:ae.value=""}}async function Na(i){fn(i);try{return await sa(i),await Xt({includeProviderModels:!0}),Rs(),"ok"}catch(u){const m=u instanceof Error?u.message:"Unknown application error";ut.value=m;const b=gN(u)?"not-found":"error";return i.trim()&&Zt(i,m,{transient:!0}),b}}async function Fl(i){const u=n.value===i,m=u?aN(To(e.value),i):"";u&&(fn(m),m&&sa(m,{silent:!0}));try{await $_(i),Bn(i),await Es(),u&&m&&n.value===m&&await gi(m,{silent:!0})}catch(b){ut.value=b instanceof Error?b.message:"Unknown application error"}}async function Yi(i,u){const m=u.trim();if(!(!i||!m))try{await N_(i,m),W.value={...W.value,[i]:m},_n(),pu(i,m)}catch(b){ut.value=b instanceof Error?b.message:"Unknown application error"}}async function Ul(i){var L,q;const u=i.trim();if(!u)return"";const m=To(t.value).find(Z=>Z.id===u),b=((L=m==null?void 0:m.cwd)==null?void 0:L.trim())??"",R=((q=m==null?void 0:m.title)==null?void 0:q.trim())??"Forked chat",E=sn(u);ut.value="";try{const Z=await Am(u,b||void 0,E||void 0),he=Z.threadId.trim();return he?(ri(he,b,R),vo(he,Z.model),ie.value={...ie.value,[he]:!0},fn(he),await Es(),await sa(he),he):""}catch(Z){return ut.value=Z instanceof Error?Z.message:"Unknown application error",""}}async function wi(i,u){var L;const m=i.trim();if(!m||!Number.isInteger(u)||u<0)return"";if(J.value[m]===!0)return ut.value="Finish the current turn before forking from a response.","";if(O.value[m]!==!0)try{await sa(m)}catch(q){return ut.value=q instanceof Error?q.message:"Unknown application error",""}const b=o.value[m]??[];let R=-1;for(const q of b)typeof q.turnIndex=="number"&&Number.isFinite(q.turnIndex)&&(R=Math.max(R,q.turnIndex));if(R>=0&&u>R)return"";const E=To(t.value).find(q=>q.id===m)??null;try{ut.value="";const q=await Am(m),Z=q.threadId.trim();if(!Z)return"";const he=q.cwd.trim()||((L=E==null?void 0:E.cwd)==null?void 0:L.trim())||"",Ne=lO((E==null?void 0:E.title)||(E==null?void 0:E.preview)||"Untitled thread");ri(Z,he,Ne),vo(Z,q.model),fr(Z,q.messages),O.value={...O.value,[Z]:!0},ie.value={...ie.value,[Z]:!0},hr(Z),_a(Z,[]),pr(Z),j.value[Z]&&(j.value=St(j.value,Z)),ln(Z,null),Gt(Z,null),Zt(Z,null),hn(Z,!1);const Je=R-u;if(Je>0){const pt=await rf(Z,Je);fr(Z,pt)}return await Yi(Z,Ne),fn(Z),Es().catch(()=>{}),Z}catch(q){return ut.value=q instanceof Error?q.message:"Unknown application error",""}}async function es(i,u,m=[],b=[],R=[]){if(!i||!u.trim()||m.length>0||b.length>0||R.length>0)return!1;const L=(rt.value[i]??[]).filter(he=>he.method==="item/tool/requestUserInput");if(L.length!==1)return!1;const[q]=L,Z=$r(q);return Z.length!==1?!1:tl({id:q.id,result:{answers:{[Z[0]]:{answers:[u.trim()]}}}})}function Rn(){if(typeof window>"u")return{};try{const i=window.localStorage.getItem(sv);if(!i)return{};const u=JSON.parse(i);if(!u||typeof u!="object"||Array.isArray(u))return{};const m={};for(const[b,R]of Object.entries(u)){if(!b||!Array.isArray(R))continue;const E=R.filter(L=>!!L&&typeof L=="object"&&typeof L.id=="string"&&typeof L.text=="string");E.length>0&&(m[b]=E)}return m}catch{return{}}}function gr(){typeof window>"u"||window.localStorage.setItem(sv,JSON.stringify(je.value))}function ts(){if(typeof window>"u")return gu;try{const i=window.localStorage.getItem(iv);if(i===null)return gu;const u=Number(i);return Number.isFinite(u)&&u>=0?Math.round(u):gu}catch{return gu}}function Nc(i){const u=Number.isFinite(i)&&i>0?Math.round(i):0;u!==fe.value&&(fe.value=u,!(typeof window>"u")&&window.localStorage.setItem(iv,String(u)))}async function vd(i,u,m,b,R,E){if(Te||fe.value<=0||J.value[i]===!0)return!1;const L=Tt.value[i];if(!L||L.remainingContextPercent===null||L.remainingContextPercent>fe.value)return!1;const q=je.value[i]??[],Z=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,he=E==="plan"?"plan":E==="default"?"default":et.value;return je.value={...je.value,[i]:[...q,{id:Z,text:u,imageUrls:m,skills:b,fileAttachments:R,collaborationMode:he}]},gr(),fo.value.has(i)||zl(i),!0}async function bi(i){const u=je.value[i];if(!u||u.length===0||J.value[i]===!0)return;const m=[...u];je.value=St(je.value,i),gr(),Te=!0;try{for(const b of m)try{await Ji(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments,void 0,b.collaborationMode)}catch{}}finally{Te=!1}}async function Ji(i,u=[],m=[],b="steer",R=[],E,L){if(co.value)return;const q=n.value,Z=i.trim();if(!q||!Z&&u.length===0&&R.length===0||await es(q,Z,u,m,R)||await vd(q,Z,u,m,R,L))return;const he=J.value[q]===!0;if(he&&b==="queue"){const Ne=de.value[q]??[],Je=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,pt=[...Ne],it=typeof E=="number"?Math.max(0,Math.min(E,pt.length)):pt.length;pt.splice(it,0,{id:Je,text:Z,imageUrls:u,skills:m,fileAttachments:R,collaborationMode:L==="plan"?"plan":L==="default"?"default":et.value}),de.value={...de.value,[q]:pt},aa();return}if(he){Hn=!0,Qi(q,Z,u,m,R,L).catch(Ne=>{const Je=Ne instanceof Error?Ne.message:"Unknown application error";Zt(q,Je),ut.value=Je});return}ut.value="",Hn=!0,ln(q,null),Gt(q,{label:"Thinking",details:pn(sn(q),mt.value,L==="plan"?"plan":L==="default"?"default":et.value)}),Zt(q,null),hn(q,!0);try{await Qi(q,Z,u,m,R,L)}catch(Ne){Hn=!1,hn(q,!1),Gt(q,null);const Je=Ne instanceof Error?Ne.message:"Unknown application error";throw Zt(q,Je),ut.value=Je,Ne}}async function ki(i,u,m=[],b=[],R=[]){if(co.value)return"";const E=i.trim(),L=u.trim(),q=sn(Zs).trim(),Z=et.value;if(!E&&m.length===0&&R.length===0)return"";Kn.value=!0,ut.value="";let he="";try{try{const it=await xm(L||void 0,q||void 0);he=it.threadId,vo(he,it.model),xr(he,it.modelProvider||at.value),Eo(he,Z)}catch(it){if(q&&q!==ca&&Tu(it)){await go();const Mt=await xm(L||void 0,ca);he=Mt.threadId,vo(he,Mt.model),xr(he,Mt.modelProvider||at.value),Eo(he,Z)}else throw it}if(!he)return"";ri(he,L,E||"[Image]"),li(he,E,m,b,R),eo(he),ie.value={...ie.value,[he]:!0},fn(he),Hn=!0,ln(he,null),Gt(he,{label:"Thinking",details:pn(sn(he),mt.value,Z)}),Zt(he,null),hn(he,!0);const Ne=he,Je=L||null,pt=E;return Qi(he,E,m,b,R,Z).catch(it=>{Hn=!1,hn(he,!1),Gt(he,null);const Mt=it instanceof Error?it.message:"Unknown application error";Zt(he,Mt),ut.value=Mt}).finally(()=>{Kn.value=!1}),Lc(Ne,pt,Je,m,R),he}catch(Ne){Hn=!1,he&&(hn(he,!1),Gt(he,null));const Je=Ne instanceof Error?Ne.message:"Unknown application error";throw he&&Zt(he,Je),ut.value=Je,Kn.value=!1,Ne}}async function Qi(i,u,m=[],b=[],R=[],E){const L=mt.value,q=E==="plan"?"plan":E==="default"?"default":et.value,Z=u.trim(),he=[...m];if(he.length===0&&ni(Z)){const pt=Et(i);pt&&he.push(pt)}const Ne=b.map(pt=>({name:pt.name,path:pt.path})),Je=R.map(pt=>({...pt}));M(i,{text:Z,imageUrls:[...he],skills:Ne,fileAttachments:Je,effort:L,collaborationMode:q,fallbackRetried:!1});try{if(ie.value[i]!==!0){const Mt=await of(i);Mt.model&&vo(i,Go(i,Mt.model,Mt.modelProvider)),Mt.modelProvider&&xr(i,Mt.modelProvider),ie.value={...ie.value,[i]:!0}}const pt=sn(i);let it="";try{it=await af(i,u,he,pt||void 0,L||void 0,b.length>0?b:void 0,R,q)}catch(Mt){if(pt&&pt!==ca&&Tu(Mt))await go(i),M(i,{text:Z,imageUrls:[...he],skills:Ne,fileAttachments:Je,effort:L,collaborationMode:q,fallbackRetried:!0}),it=await af(i,u,he,ca,L||void 0,b.length>0?b:void 0,R,q);else throw Mt}it&&(Ee.value={...Ee.value,[i]:it},Yo(i,it)),Yt.add(i),await Ur(),Ta(i)}catch(pt){throw pt}}async function Xi(i){if(Le.value[i]!==!0){Le.value={...Le.value,[i]:!0};try{de.value=await $m()}catch{}finally{Le.value=St(Le.value,i)}}}function Bl(i){Xi(i),!(typeof window>"u")&&window.setTimeout(()=>{Xi(i)},650)}async function Oc(){const i=n.value;if(!i||J.value[i]!==!0||ge.value[i]===!0)return;let u=Ee.value[i];if(!u){const{activeTurnId:E}=await nf(i);u=E,u&&(Ee.value={...Ee.value,[i]:u})}if(!u)throw new Error("Could not determine active turn id for interrupt");const m=_r.value.filter(E=>E.turnId===u),b=m.find(E=>E.role==="user"),R=m.some(E=>{if(E.role==="assistant")return!0;const L=E.messageType??"";return L==="commandExecution"||L==="toolCall"||L==="worked"||L==="fileChange"||L==="plan"||L==="plan.live"||L==="compaction.done"||L==="turnError"});lo.value=!0,ut.value="";try{if(await z_(i,u),hn(i,!1),Gt(i,null),Zt(i,null),Ee.value[i]&&(Ee.value=St(Ee.value,i)),Yt.add(i),nn=!0,await Ur(),b&&!R){const E=(o.value[i]??[]).filter(q=>q.turnId!==u);fr(i,E);const L=d.value[i];if(L){const q=L.filter(Z=>Z.turnId!==u);q.length!==L.length&&(d.value={...d.value,[i]:q},wu(d.value))}Ve.value={...Ve.value,[i]:{text:b.text??"",imageUrls:b.images??[],fileAttachments:(b.fileAttachments??[]).map(q=>({label:q.label,path:q.path,fsPath:q.fsPath??q.path})),skills:b.skills??[]}}}}catch(E){const L=E instanceof Error?E.message:"Failed to interrupt active turn";Zt(i,L),ut.value=L}finally{lo.value=!1}}function ql(i){i&&Ve.value[i]&&(Ve.value=St(Ve.value,i))}async function gd(i){var m,b;const u=n.value;if(u&&!uo.value&&i.trim()){uo.value=!0,ut.value="";try{J.value[u]===!0&&await Oc();const R=o.value[u]??[],E=R.find(Je=>Je.turnId===i),L=typeof(E==null?void 0:E.turnIndex)=="number"?E.turnIndex:-1;if(L<0)return;const q=R.reduce((Je,pt)=>typeof pt.turnIndex=="number"&&pt.turnIndex>Je?pt.turnIndex:Je,-1);if(q<0||L>q)return;const Z=q-L+1;if(Z<1)return;const he=((b=(m=ho.value)==null?void 0:m.cwd)==null?void 0:b.trim())??"";he&&await D_(u,i,he);const Ne=await rf(u,Z);fr(u,Ne),_a(u,[]),pr(u),j.value[u]&&(j.value=St(j.value,u)),ln(u,null),Gt(u,null),Zt(u,null),nn=!0,await Ur()}catch(R){ut.value=R instanceof Error?R.message:"Failed to rollback thread"}finally{uo.value=!1}}}function yr(i,u){const b=(l.value[i]??[]).filter(R=>R.messageType!=="compaction.pending"&&R.messageType!=="compaction.done");b.push({id:`compaction:${u}:${i}:${Date.now()}`,role:"system",text:"",messageType:u==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[i]:b}}function Ms(i,u){const m=new Set(fo.value);u?m.add(i):m.delete(i),fo.value=m}function Zi(i){Qt=i.trim(),Cr.value=[]}async function zl(i){const u=i.trim();if(!(!u||fo.value.has(u))){Ms(u,!0),yr(u,"pending");try{await L_(u);const m=2e3,b=14,R=Date.now()+za;let E=0;for(;Date.now()<R&&E<b&&fo.value.has(u);){if((await nf(u)).messages.some(Z=>Z.messageType==="compaction.done")){Ms(u,!1),n.value===u&&await sa(u,{silent:!0,force:!0}),yr(u,"done"),bi(u);break}E+=1,await rN(m)}fo.value.has(u)&&(Ms(u,!1),yr(u,"done"),bi(u))}catch(m){ut.value=m instanceof Error?m.message:"Failed to compact thread",Ms(u,!1),yr(u,"done"),bi(u)}}}let mn=null;async function el(i,u){try{const m=await pl(),b={...m.labels};let R=!1;for(const E of m.order){if(!$u(E,i))continue;const L=u.trim();L.length===0?b[E]!==void 0&&(delete b[E],R=!0):b[E]!==L&&(b[E]=L,R=!0)}R&&await sf({order:m.order,labels:b,active:m.active,projectOrder:m.projectOrder})}catch{}}function yd(i,u){i.length===0||(Be.value[i]??"")===u||(Be.value={...Be.value,[i]:u},yv(Be.value),mn!==null&&clearTimeout(mn),mn=setTimeout(()=>{mn=null,el(i,u)},500))}async function Ci(i){var E;if(i.length===0)return;const u=z.value.filter(L=>L!==i);if(us(z.value,u)||(z.value=u,rc(z.value)),t.value=t.value.filter(L=>L.projectName!==i),Be.value[i]!==void 0){const L={...Be.value};delete L[i],Be.value=L,yv(L)}_n();const m=To(e.value);Hi(m),m.some(L=>L.id===n.value)||fn(((E=m[0])==null?void 0:E.id)??"");const R=new Set;try{const L=await pl();oO(L,i).forEach(q=>{R.add(q)})}catch{}if(R.size>0)try{const L=await pl(),q=L.order.filter(Ne=>!R.has(Ne)),Z=L.active.filter(Ne=>!R.has(Ne)),he=Z.length===0&&q.length>0?[q[0]]:Z;await sf({order:q,labels:JN(L.labels,R),active:he,projectOrder:L.projectOrder.filter(Ne=>Ne!==i&&!R.has(Ne))});return}catch{}await Ti()}function wd(i,u){if(i.length===0||t.value.length===0)return;const m=t.value.map(Z=>Z.projectName),b=m.indexOf(i);if(b===-1)return;const R=Math.max(0,Math.min(u,m.length-1)),E=NN(m,b,R);if(E===m)return;const L=ul(E,t.value);z.value=L,rc(z.value);const q=mf(t.value,z.value);t.value=_u(t.value,q),_n(),Ti()}function Dc(i){const u=i.trim();if(!u)return;const m=[u,...z.value.filter(R=>R!==u)];if(us(z.value,m))return;z.value=m,rc(z.value);const b=mf(t.value,z.value);t.value=_u(t.value,b),_n(),Ti()}async function Ti(){try{const i=await pl(),u=rO(i,z.value,t.value);await sf({order:u.order,labels:i.labels,active:u.active,projectOrder:u.projectOrder})}catch{}}async function Ur(){if(gn.value){typeof window<"u"&&ht===null&&(ht=window.setTimeout(()=>{ht=null,Ur()},yu));return}gn.value=!0;const i=nn,u=Kr,m=new Set(Yt);nn=!1,Kr=!1,Yt.clear();try{i&&await Es({force:u});const b=n.value;if(!b)return;const R=m.has(b),E=J.value[b]===!0,L=no(b),q=$.value[b]??"";(L.length>0&&L!==q||R||E&&O.value[b]!==!0||i&&O.value[b]!==!0)&&await sa(b,{silent:!0,force:R})}catch{}finally{gn.value=!1,(nn||Yt.size>0)&&typeof window<"u"&&ht===null&&(ht=window.setTimeout(()=>{ht=null,Ur()},yu))}}async function Fc(){await Bc(),nn=!zo.value,n.value&&O.value[n.value]!==!0&&Yt.add(n.value),await Ur()}function Hl(i){const u=qe(i.params),m=typeof(u==null?void 0:u.threadId)=="string"?u.threadId.trim():"";if(!m)return;const b=qe(u==null?void 0:u.externalSession),R=b&&typeof b.origin=="string"&&b.origin.trim().length>0?{origin:b.origin.trim(),active:b.active===!0,lastWriteAt:typeof b.lastWriteAt=="string"?b.lastWriteAt:null}:null;$e.value={...$e.value,[m]:R},hn(m,(R==null?void 0:R.active)===!0),_n(),nn=!0,n.value===m&&Yt.add(m),ht===null&&typeof window<"u"&&(ht=window.setTimeout(()=>{ht=null,Ur()},yu))}function Uc(){typeof window>"u"||Ut||(Bc(),bd(),Ut=C_(i=>{if(i.method==="ready"){Ts(),Fc();return}if(i.method==="externalSessionChanged"){Hl(i);return}Is(i),Ma(i)}))}async function Bc(){try{const u=(await Sm()).map(m=>Ka(m)).filter(m=>m!==null);vr(u)}catch{}}async function bd(){try{const i=await Ix(),u=Object.entries(i);if(u.length===0)return;const m={...d.value};let b=!1;for(const[R,E]of u){const L=E.filter(Ne=>!!Ne&&typeof Ne.id=="string");if(L.length===0)continue;const q=m[R]??[],Z=new Set(q.map(Ne=>Ne.text)),he=[...q];for(const Ne of L)Z.has(Ne.text)||(he.push(Ne),Z.add(Ne.text));m[R]=he.slice(-20),b=!0}b&&(d.value=m,wu(m))}catch{}}async function tl(i){try{return await __(i.id,{result:i.result,error:i.error}),Qo(i.id),pe.value=St(pe.value,String(i.id)),!0}catch(u){const m=u instanceof Error?u.message:"Failed to reply to server request";return await Wl(i.id)?(ut.value=m,pe.value={...pe.value,[String(i.id)]:m},!1):(Qo(i.id),pe.value=St(pe.value,String(i.id)),!0)}}async function Wl(i){try{const u=await Sm();for(const m of u){const b=qe(m);if((b==null?void 0:b.id)===i)return!0}return!1}catch{return!0}}function kd(){if(Ut&&(Ut(),Ut=null),nn=!1,Yt.clear(),Xn.clear(),ht!==null&&typeof window<"u"&&(window.clearTimeout(ht),ht=null),Ho!==null&&typeof window<"u"&&(window.clearTimeout(Ho),Ho=null),Qn!==null&&typeof window<"u"&&(window.clearTimeout(Qn),Qn=null),typeof window<"u")for(const i of dn.values())window.clearTimeout(i);dn.clear(),Hn=!1,o.value={},r.value={},a.value={},h.value={},d.value={},j.value={},B.value={},re.value={},be.value={},Se.value={},se.value={},Ee.value={},P.clear(),y.clear(),_.clear(),Qs.clear(),ju=0,ge.value={},Fe.value={},Me.value={},de.value={},Le.value={},je.value={},gr(),aa(),It.value=null,Tt.value={}}const Si=X(()=>{const i=n.value;if(!i)return[];const u=de.value[i]??[];return[...(je.value[i]??[]).map(R=>({...R,awaitingCompaction:!0})),...u]});function nl(i){const u=n.value;if(!u)return;const m=je.value[u];if(m!=null&&m.some(E=>E.id===i)){const E=m.filter(L=>L.id!==i);je.value=E.length>0?{...je.value,[u]:E}:St(je.value,u),gr();return}const b=de.value[u];if(!b)return;const R=b.filter(E=>E.id!==i);de.value=R.length>0?{...de.value,[u]:R}:St(de.value,u),aa()}function Vl(i,u){const m=n.value;if(!m)return;const b=de.value[m];if(!b)return;const R=je.value[m];if(R!=null&&R.some(he=>he.id===i||he.id===u))return;const E=b.findIndex(he=>he.id===i),L=b.findIndex(he=>he.id===u);if(E<0||L<0||E===L)return;const q=[...b],[Z]=q.splice(E,1);q.splice(L,0,Z),de.value={...de.value,[m]:q},aa()}function ns(i){const u=n.value;if(!u)return;const m=je.value[u],b=m==null?void 0:m.find(L=>L.id===i);if(b){nl(i),Ko(b.collaborationMode),Te=!0,Ji(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments).finally(()=>{Te=!1});return}const R=de.value[u];if(!R)return;const E=R.find(L=>L.id===i);E&&(nl(i),Ko(E.collaborationMode),Ji(E.text,E.imageUrls,E.skills,"steer",E.fileAttachments))}function Cd(i,u={}){fn(i,u)}return{projectGroups:e,projectDisplayNameById:Be,selectedThread:ho,selectedThreadTokenUsage:cr,selectedThreadTerminalOpen:Tr,isSelectedThreadInterruptPending:Sr,selectedThreadServerRequests:oi,selectedLiveOverlay:Wa,selectedActiveTurnId:Wo,lastPlanByThreadId:s,resolveThreadTurnIndex:Ll,codexQuota:Ca,selectedThreadId:n,availableCollaborationModes:At,availableModelIds:Ue,availableModelReasoningEfforts:Ye,selectedCollaborationMode:et,selectedModelId:ft,selectedReasoningEffort:mt,selectedSpeedMode:kt,codexCliMissingError:ae,installedSkills:Y,accountRateLimitSnapshots:me,messages:_r,hasMoreOlderMessages:Ct,isLoadingThreads:Ze,isThreadListFullyLoaded:Nt,isLoadingMessages:Ft,isLoadingOlderMessages:Fn,isSendingMessage:Kn,isInterruptingTurn:lo,isUpdatingSpeedMode:co,isRollingBack:uo,compactingThreadIds:fo,fuzzyFileSearchResults:Cr,registerFuzzyFileSearchSession:Zi,error:ut,refreshAll:yi,refreshSkills:Rs,refreshHooks:Ki,hooksList:Oe,isHooksLoading:We,onRealtimeEvent:Ps,selectThread:Na,loadMessages:sa,loadOlderMessages:Fr,ensureThreadMessagesLoaded:gi,setThreadTerminalOpen:dr,toggleSelectedThreadTerminal:Wi,archiveThreadById:Fl,compactThreadById:zl,renameThreadById:Yi,forkThreadById:Ul,forkThreadFromTurn:wi,rollbackSelectedThread:gd,sendMessageToSelectedThread:Ji,sendMessageToNewThread:ki,interruptSelectedThreadTurn:Oc,interruptedUnsubmittedMessage:ur,clearInterruptedUnsubmittedMessage:ql,selectedThreadQueuedMessages:Si,removeQueuedMessage:nl,reorderQueuedMessage:Vl,steerQueuedMessage:ns,autoCompactThreshold:fe,setAutoCompactThreshold:Nc,setSelectedCollaborationMode:Ko,readModelIdForThread:sn,setSelectedModelIdForThread:Vn,setSelectedModelId:Zn,setSelectedReasoningEffort:Pe,updateSelectedSpeedMode:Ge,respondToPendingServerRequest:tl,pendingReplyErrorForRequest:Xo,renameProject:yd,removeProject:Ci,reorderProject:wd,pinProjectToTop:Dc,startPolling:Uc,stopPolling:kd,primeSelectedThread:Cd}}const hO={class:"sidebar-root"},mO=["aria-pressed","aria-label","title"],vO={key:1,class:"sidebar-search-bar"},gO=["placeholder"],yO=["aria-label"],wO={class:"sidebar-skills-link-icon","aria-hidden":"true"},bO={class:"sidebar-skills-link-copy"},kO={class:"sidebar-skills-link-title"},CO={class:"sidebar-skills-link-subtitle"},TO={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},SO={class:"sidebar-skills-link-copy"},_O={class:"sidebar-skills-link-title"},xO={class:"sidebar-skills-link-subtitle"},AO=["aria-label"],PO={class:"settings-dialog-header"},IO={class:"settings-dialog-title"},EO=["aria-label","title"],RO={class:"settings-dialog-body"},MO=["aria-label"],$O=["aria-current","onClick"],jO={class:"settings-group-content"},LO=["title"],NO={class:"sidebar-settings-label"},OO=["title"],DO={class:"sidebar-settings-label"},FO={class:"sidebar-settings-value"},UO=["title"],BO={class:"sidebar-settings-label"},qO={class:"sidebar-settings-value"},zO=["title"],HO={class:"sidebar-settings-label"},WO=["title"],VO={class:"sidebar-settings-label"},GO={class:"sidebar-settings-value"},KO=["title"],YO={class:"sidebar-settings-label"},JO=["title"],QO={class:"sidebar-settings-label"},XO=["title"],ZO={class:"sidebar-settings-label"},e2=["title"],t2={class:"sidebar-settings-label"},n2=["href"],o2={class:"sidebar-settings-label"},r2={class:"sidebar-settings-value"},a2=["title"],s2={class:"sidebar-settings-label"},i2={key:0,class:"sidebar-settings-row sidebar-settings-error"},l2=["href"],c2={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},u2={class:"sidebar-settings-provider-info"},d2={class:"sidebar-settings-label"},f2={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},p2={class:"sidebar-settings-key-group"},h2={class:"sidebar-settings-key-masked"},m2=["disabled","title"],v2=["placeholder"],g2=["disabled"],y2={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},w2={class:"sidebar-settings-label"},b2=["aria-label"],k2=["disabled"],C2=["disabled"],T2={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},S2={class:"sidebar-settings-provider-info"},_2={class:"sidebar-settings-label"},x2={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},A2={class:"sidebar-settings-key-group"},P2=["placeholder"],I2=["disabled"],E2={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},R2={class:"sidebar-settings-label"},M2={class:"sidebar-settings-key-group"},$2=["placeholder"],j2={class:"sidebar-settings-label",style:{"margin-top":"4px"}},L2={class:"sidebar-settings-key-group"},N2=["placeholder"],O2=["disabled"],D2={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},F2={class:"sidebar-settings-label"},U2=["aria-label"],B2={class:"sidebar-settings-label"},q2={class:"sidebar-settings-value"},z2={key:0,class:"sidebar-settings-telegram-panel"},H2={class:"sidebar-settings-field"},W2={class:"sidebar-settings-field-label"},V2={class:"sidebar-settings-field"},G2={class:"sidebar-settings-field-label"},K2={class:"sidebar-settings-field-help"},Y2={key:0,class:"sidebar-settings-telegram-error"},J2=["href"],Q2={class:"sidebar-settings-telegram-actions"},X2=["disabled"],Z2={class:"sidebar-settings-hooks-section"},eD={class:"sidebar-settings-hooks-header"},tD={class:"sidebar-settings-hooks-title"},nD=["disabled","title"],oD={key:0,class:"sidebar-settings-hooks-empty"},rD={key:0,class:"sidebar-settings-hooks-empty"},aD={key:1,class:"sidebar-settings-hooks-empty"},sD={key:2,class:"sidebar-settings-hooks-list"},iD={class:"sidebar-settings-hooks-cwd"},lD={class:"sidebar-settings-hooks-event"},cD={class:"sidebar-settings-hooks-command"},uD={class:"sidebar-settings-remote-section"},dD={class:"sidebar-settings-remote-header"},fD={class:"sidebar-settings-remote-title"},pD=["disabled","title"],hD={class:"sidebar-settings-remote-toggle-label"},mD={key:0,class:"sidebar-settings-remote-empty"},vD={key:0,class:"sidebar-settings-remote-error"},gD={key:1,class:"sidebar-settings-remote-notice"},yD={key:2,class:"sidebar-settings-remote-empty"},wD=["disabled"],bD={class:"sidebar-settings-remote-label"},kD={class:"sidebar-settings-remote-value"},CD={class:"sidebar-settings-remote-clients"},TD={class:"sidebar-settings-remote-clients-header"},SD={class:"sidebar-settings-remote-label"},_D=["disabled"],xD={key:0,class:"sidebar-settings-remote-empty"},AD={class:"sidebar-settings-remote-client-name"},PD=["disabled","onClick"],ID={class:"sidebar-settings-rate-limits"},ED=["aria-label"],RD={class:"sidebar-settings-actions"},MD=["title","aria-label"],$D=["title","aria-label"],jD={class:"content-root-wrap"},LD={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},ND={key:1,class:"skills-route-header-icon","aria-hidden":"true"},OD={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},DD=["aria-label","title"],FD={class:"content-body"},UD={key:2,class:"content-grid content-grid-home"},BD={class:"new-thread-empty"},qD={class:"new-thread-hero"},zD=["title"],HD={class:"new-thread-folder-actions"},WD=["disabled"],VD={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},GD={class:"new-thread-launch-card-copy"},KD={class:"new-thread-launch-card-topline"},YD={class:"new-thread-launch-card-badge","aria-hidden":"true"},JD={class:"new-thread-launch-card-eyebrow"},QD={class:"new-thread-launch-card-title"},XD={class:"new-thread-launch-card-text"},ZD={class:"new-thread-launch-card-actions"},eF=["aria-label","onKeydown"],tF={class:"new-thread-open-folder-header"},nF={class:"new-thread-open-folder-title"},oF={class:"new-thread-open-folder-label"},rF={class:"new-thread-open-folder-current"},aF=["placeholder","title","disabled","onKeydown"],sF=["disabled"],iF={class:"new-thread-open-folder-actions"},lF={class:"new-thread-open-folder-toggle"},cF=["aria-pressed","disabled"],uF={key:0,class:"new-thread-open-folder-create"},dF={class:"new-thread-open-folder-create-composer"},fF=["placeholder","onKeydown"],pF=["disabled"],hF={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},mF=["href"],vF=["placeholder","onKeydown"],gF={key:1,class:"new-thread-open-folder-error-actions"},yF={class:"new-thread-open-folder-error visible-error-with-feedback"},wF=["href"],bF=["disabled"],kF={key:2,class:"new-thread-open-folder-status"},CF={key:3,class:"new-thread-open-folder-status"},TF={key:4,class:"new-thread-open-folder-list"},SF=["title","disabled","onClick"],_F={class:"new-thread-open-folder-item-name"},xF=["disabled","onClick"],AF=["aria-label","onKeydown"],PF={class:"new-thread-open-folder-header"},IF={class:"new-thread-open-folder-title"},EF=["disabled"],RF=["aria-label"],MF=["aria-selected","disabled"],$F=["aria-selected","disabled"],jF={class:"new-thread-project-field"},LF={class:"new-thread-open-folder-label"},NF=["disabled","placeholder"],OF={key:0,class:"new-thread-project-field"},DF={class:"new-thread-open-folder-label"},FF=["disabled","placeholder","onKeydown"],UF={key:1,class:"new-thread-project-field"},BF={class:"new-thread-open-folder-label"},qF=["disabled","onKeydown"],zF={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},HF=["href"],WF={class:"new-thread-project-modal-actions"},VF=["disabled"],GF=["disabled"],KF={key:3,class:"new-thread-branch-select"},YF={class:"new-thread-branch-select-label"},JF={class:"new-thread-branch-select-help"},QF={key:4,class:"new-thread-runtime-help"},XF={class:"worktree-init-status-title"},ZF={class:"worktree-init-status-message"},eU={class:"composer-with-queue"},tU={key:0,class:"composer-runtime-error",role:"alert"},nU=["href"],oU={key:3,class:"content-grid"},rU={class:"content-thread"},aU={key:0,class:"external-session-banner",role:"alert"},sU={key:1,class:"composer-runtime-error",role:"alert"},iU=["href"],lU={key:2,class:"interrupt-recovered-banner",role:"status"},cU=["aria-label"],uU={class:"content-right-panel-header"},dU={class:"content-right-panel-tabs",role:"tablist"},fU=["aria-selected"],pU=["aria-selected"],hU=["aria-selected","title","onClick"],mU={class:"content-right-panel-tab-label"},vU=["aria-label","title","onClick"],gU={class:"content-right-panel-actions"},yU={class:"content-right-panel-add-wrap"},wU=["aria-label","title"],bU={key:0,class:"content-right-panel-menu"},kU=["aria-label","title"],CU={class:"content-right-panel-body"},TU={key:0,class:"project-zip-modal-backdrop",role:"presentation"},SU=["aria-label"],_U={class:"project-zip-modal-header"},xU={class:"project-zip-modal-title"},AU=["aria-label","disabled"],PU={class:"project-zip-modal-copy"},IU={class:"project-zip-progress-label",role:"status","aria-live":"polite"},EU={class:"project-zip-progress-track"},RU={key:0,class:"project-zip-modal-error",role:"alert"},MU={class:"project-zip-modal-actions"},$U=["disabled"],jU=["disabled"],LU=["disabled"],NU=["aria-label"],OU={class:"codex-login-modal-header"},DU={class:"codex-login-modal-title"},FU=["aria-label","disabled"],UU={class:"codex-login-modal-copy"},BU=["href"],qU=["placeholder","disabled"],zU={key:1,class:"codex-login-modal-error visible-error-with-feedback"},HU=["href"],WU={class:"codex-login-modal-actions"},VU=["disabled"],GU=["disabled"],Cv="codex-web-local.sidebar-collapsed.v1",Tv="codex-web-local.accounts-section-collapsed.v1",Sv="codex-web-local.right-panel-width.v1",KU=260,YU=640,_v=320,JU=400,xv="codex-web-local.send-with-enter.v1",Av="codex-web-local.in-progress-send-mode.v1",Pv="codex-web-local.dark-mode.v1",Iv="codex-web-local.dictation-click-to-toggle.v1",Ev="codex-web-local.dictation-auto-send.v1",Rv="codex-web-local.dictation-language.v1",Mv="codex-web-local.chat-width.v1",QU=400,XU=tn({__name:"App",setup(e){var sh,ih;const t=Zl(()=>nc(()=>import("./ThreadConversation-CO1w6DqK.js"),__vite__mapDeps([0,1,2]))),n=Zl(()=>nc(()=>import("./ThreadTerminalPanel-BrRExfgh.js"),__vite__mapDeps([3,4]))),o=Zl(()=>nc(()=>import("./ReviewPane-DJs-RkeF.js"),__vite__mapDeps([5,6]))),r=Zl(()=>nc(()=>import("./DirectoryHub-C4D0oVqF.js"),__vite__mapDeps([7,1,8]))),s=Zl(()=>nc(()=>import("./AutomationsPanel-BujKO0oC.js"),__vite__mapDeps([9,10]))),{t:a,uiLanguage:l,uiLanguageOptions:d,setUiLanguage:h}=io(),v="codex-mobile",y="0.1.101",_={sendWithEnter:a("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:a("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:a("Switch between system theme, light mode, and dark mode."),chatWidth:a("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:a("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:a("Automatically send transcribed dictation when recording stops."),dictationLanguage:a("Choose transcription language or keep auto-detect.")},P={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},j={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:B,projectDisplayNameById:J,selectedThread:ce,selectedThreadTokenUsage:U,selectedThreadServerRequests:V,selectedLiveOverlay:K,lastPlanByThreadId:ye,resolveThreadTurnIndex:_e,selectedActiveTurnId:we,codexQuota:$e,selectedThreadId:de,availableCollaborationModes:Le,availableModelIds:je,availableModelReasoningEfforts:fe,selectedCollaborationMode:Te,selectedReasoningEffort:xe,selectedSpeedMode:Ae,codexCliMissingError:Ue,installedSkills:Ye,accountRateLimitSnapshots:He,messages:At,hasMoreOlderMessages:ct,isLoadingThreads:Qe,isThreadListFullyLoaded:et,isLoadingMessages:ft,isLoadingOlderMessages:mt,isSendingMessage:kt,isInterruptingTurn:at,isSelectedThreadInterruptPending:ae,isUpdatingSpeedMode:te,error:oe,refreshAll:z,refreshSkills:Be,refreshHooks:$,hooksList:O,isHooksLoading:G,onRealtimeEvent:ue,selectThread:ie,ensureThreadMessagesLoaded:re,loadMessages:Se,loadOlderMessages:be,archiveThreadById:pe,compactThreadById:se,compactingThreadIds:Ee,fuzzyFileSearchResults:ge,registerFuzzyFileSearchSession:Fe,forkThreadById:Me,renameThreadById:Ve,forkThreadFromTurn:rt,sendMessageToSelectedThread:gt,sendMessageToNewThread:It,interruptSelectedThreadTurn:Tt,interruptedUnsubmittedMessage:Tn,clearInterruptedUnsubmittedMessage:H,selectedThreadQueuedMessages:W,removeQueuedMessage:Y,reorderQueuedMessage:me,steerQueuedMessage:Oe,autoCompactThreshold:We,setAutoCompactThreshold:Ze,setSelectedCollaborationMode:Ft,readModelIdForThread:Nt,setSelectedModelIdForThread:Kn,setSelectedReasoningEffort:lo,updateSelectedSpeedMode:co,respondToPendingServerRequest:uo,pendingReplyErrorForRequest:fo,renameProject:za,removeProject:Cr,reorderProject:Qt,pinProjectToTop:ut,startPolling:gn,stopPolling:zo,primeSelectedThread:bs,rollbackSelectedThread:ni}=pO(),Et=XT(),Ut=QT(),{isMobile:ht}=yp();function Ho(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const dn=A(null),sr=A(null),ir=A(null);let Yn=null;const{buildFeedbackMailto:lr,feedbackMailtoBase:ba,recordVisibleFailure:Ha}=xp(),Dn=ba();function In(c,f){f&&Ha(f);const x=c.currentTarget;x instanceof HTMLAnchorElement&&(x.href=lr())}const Gr=A(null),Ao=A(null),nn=A(null),Kr=A(0);let Yt=null;function Yr(){const c=nn.value;if(!c)return;const f=window.getComputedStyle(c),x=Number.parseFloat(f.paddingLeft)+Number.parseFloat(f.paddingRight),N=Math.max(0,c.clientWidth-(Number.isFinite(x)?x:0)),Q=window.getComputedStyle(c).getPropertyValue("--chat-column-max").trim(),ve=Number.parseFloat(Q)*(Q.endsWith("rem")?16:1),De=Number.isFinite(ve)&&ve>0?Math.min(N,ve):N;Kr.value=De}const ka=A(null),Jn=A(null),Qn=A(!1),Po=A(!1),Pt=A(!0),$t=A("git"),zn=A([]),po=A(""),Hn=X(()=>zn.value.find(c=>c.key===po.value)??null),Xn=A(!1),Mn=A(!1),Io=A(!1),ho=A(Sr());function Tr(c){return Math.min(YU,Math.max(KU,c))}function Sr(){if(typeof window>"u")return _v;const c=window.localStorage.getItem(Sv),f=Number(c);return Number.isFinite(f)?Tr(f):_v}function oi(c){typeof window>"u"||window.localStorage.setItem(Sv,String(c))}function Wo(c){c.preventDefault();const f=c.clientX,x=ho.value,N=ve=>{const De=f-ve.clientX;ho.value=Tr(x+De)},Q=()=>{oi(ho.value),window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",Q)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",Q)}const Wa=A(null),Ca=A(!1),cr=A("");let _r=!1;const ur=A(!1),Ct=A(""),Fn=A("local"),Sn=A({}),sn=new Map,mo=A(""),Vo=A([]),En=A(!1),Wn=A({order:[],labels:{},projectOrder:[]}),xt=A({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),yn=A({phase:"idle",title:"",message:""}),Bt=A(Zb()),fn=A(""),Vn=A(!1),Zn=A(null),vo=A(null),xr=A(null),Go=A(null),Jr=A(null),Ko=A(null);let Eo=null,Ar=null,go=0,M=0,F=!1,ne=0,Pe=0,Ge=0,qt=0;const pn=A("New Project (1)"),Xt=A(""),jt=A(!1),Pr=[{id:"general",label:"General settings"},{id:"models",label:"Models & providers"},{id:"integrations",label:"Integrations"},{id:"usage",label:"Usage & about"}],yo=A("general");let Ta=0;function Ml(){if(jt.value){Ta=Date.now(),jt.value=!1;return}Date.now()-Ta<JU||(jt.value=!0)}const Qr=A(t0()),Gn=A(!1),ks=A(!1),_n=A(new Set);async function ri(){try{_n.value=new Set(await s_())}catch{}finally{ks.value=!0}}const Hi=X(()=>!ks.value||_n.value.has("hooks/list")),ai=X(()=>!ks.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(c=>_n.value.has(c)));nt(jt,c=>{c&&($(),li(),ai.value&&ci())});const ln=A({enabled:!1,clients:[]}),hn=A(null),Ro=A(!1),eo=A(!1),to=A(""),Yo=A(""),Cs=A("");let Sa=null,si=!1,Gt=null;const Zt=A("never"),ii=A(!1),Ts=A(!1),no=A(""),dr=A("");let Wi=!1;const fr=A(!1);async function li(c={}){if(!(c.force!==!0&&Wi)){ii.value=!0,no.value="";try{Zt.value=await d_(),Wi=!0}catch(f){no.value=f instanceof Error?f.message:"Failed to load approval policy"}finally{ii.value=!1}}}function _a(c){Zt.value=c}async function $n(){Ts.value=!0,no.value="",dr.value="";try{await f_(Zt.value),fr.value=!0,dr.value=a("Approval policy saved"),Va&&clearTimeout(Va),Va=setTimeout(()=>{dr.value=""},2200)}catch(c){no.value=c instanceof Error?c.message:"Failed to save approval policy"}finally{Ts.value=!1}}let Va=null;async function ci(c={}){if(!(c.force!==!0&&si)){Ro.value=!0,Yo.value="";try{const f=await u_();ln.value=f,si=!0}catch(f){Yo.value=f instanceof Error?f.message:"Failed to load remote control status"}finally{Ro.value=!1}}}async function ui(){const c=!ln.value.enabled;eo.value=!0,to.value=c?"enable":"disable";try{await p_(c),ln.value={...ln.value,enabled:c},di(c?"Remote control enabled":"Remote control disabled")}catch(f){Yo.value=f instanceof Error?f.message:"Failed to update remote control"}finally{eo.value=!1,to.value=""}}async function Vi(){eo.value=!0,to.value="pairing";try{hn.value=await h_()}catch(c){Yo.value=c instanceof Error?c.message:"Failed to start pairing"}finally{eo.value=!1,to.value=""}}async function Ss(){eo.value=!0,to.value="clients";try{ln.value={...ln.value,clients:await m_()}}catch(c){Yo.value=c instanceof Error?c.message:"Failed to load remote clients"}finally{eo.value=!1,to.value=""}}async function $l(c){eo.value=!0,to.value=`revoke:${c}`;try{await v_(c),ln.value={...ln.value,clients:ln.value.clients.filter(f=>f.clientId!==c)},di("Remote client removed")}catch(f){Yo.value=f instanceof Error?f.message:"Failed to remove remote client"}finally{eo.value=!1,to.value=""}}function di(c){Cs.value=c,Sa&&clearTimeout(Sa),Sa=setTimeout(()=>{Cs.value=""},3e3)}const Ir=A(""),Xr=A(""),pr=A([]),Zr=A(null),xa=A(null),hr=A(null),Aa=A(null),Mo=A(!1),Ga=A(!1),Er=A({addedLineCount:0,removedLineCount:0}),wo=A([]),Rr=A(""),qe=A({}),ke=A(""),Un=A(""),Pa=A({}),mr=A(""),_s=A(""),cn=A(!1),ea=A(!1);function jl(c,f){return`${c}\0${f?"with-reset-history":"without-reset-history"}`}const Ka=A(null),jn=A([]),Jo=A(!1),bo=A(!1),Mr=A(!1),Ln=A(!1),Ya=A(!1),Ia=A(""),$r=A(""),fi=A(null),Qo=A(""),Xo=A(""),vr=A(""),wn=A(""),ta=A($d(xv,!0)),Ea=A(Db()),na=A(Ob()),Ja=A(Fb()),Zo=A($d(Iv,!1)),oa=A($d(Ev,!0)),Ra=A(Qb()),Qa=X(()=>Xb()),Ll=X(()=>{const{loaded:c,total:f}=xt.value,x=Mp(c);return f&&f>0?`${x} / ${Mp(f)}`:c>0?x:a("Preparing...")}),pi=X(()=>{const{loaded:c,total:f,phase:x}=xt.value;return x==="ready"?"100%":!f||f<=0?c>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(c/f*100)))}%`}),xs=A(!1),jr=A(!1),Lr=A(!1),ra=A(""),Xa=A(!1),Gi=A(null),Jt=A(!1),oo=A(""),xn=A("codex"),As=X(()=>[{value:"codex",label:a("Codex")},{value:"openrouter",label:a("OpenRouter")},{value:"opencode-zen",label:a("OpenCode Zen")},{value:"custom",label:a("Custom endpoint")}]),er=A(""),Za=A(""),w=A("responses"),k=A("responses"),C=A(""),D=A(!1),Ce=A(""),st=A(""),Rt=A(""),$o=A(!1),Kt=A(!1),Nn=A(""),bn=A(""),tr=A(!1),Nr=A(!1),jo=A("create"),Ps=A(""),hi=A(""),mi=A(""),Is=A(!1),Ma=A(""),Lo=A(!1),Nl=A(null),jc=A(null),$a=A(!1),Lc=A(null),md=A(null),ja=A(""),Or=A(""),aa=A(""),Ol=A([]),Bn=A(""),No=A(!1),ko=A(!1),vi=A(!1),Dr=A(""),Es=[oe,Ue,Rr,Un,wn,oo,Rt,bn,Ma,Bn],sa=X(()=>Es.some(c=>c.value.trim().length>0)),Fr=A({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),gi=A(null),Rs=A(!1),Ki=A(!1),La=A(typeof window<"u"?((sh=window.visualViewport)==null?void 0:sh.height)??window.innerHeight:0),Dl=A(typeof window<"u"?((ih=window.visualViewport)==null?void 0:ih.offsetTop)??0:0),yi=A(typeof window<"u"?window.innerHeight:0);let Na=null,Fl=!1,Yi=!1,Ul=!1,wi=0;const es=X(()=>{const c=Et.params.threadId;return typeof c=="string"?c:""}),Rn=X(()=>Et.name==="home"),gr=X(()=>Et.name==="skills"),ts=X(()=>Et.name==="automations"),Nc=X(()=>{const c=Et.query.automationId;return typeof c=="string"?c:""}),vd=X(()=>{var c;return ts.value?a("Automations"):gr.value?a("Skills"):Rn.value?a("Start new thread"):((c=ce.value)==null?void 0:c.title)??a("Choose a thread")}),bi=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Ji=X(()=>{var f,x;return(((x=(f=ce.value)==null?void 0:f.title)==null?void 0:x.trim())??"")||bi}),ki=X(()=>At.value.filter(c=>{const f=o0(c.messageType,c.role);return f==="worked"?!0:!(f==="turnActivity.live"||f==="turnError.live"||f==="agentReasoning.live")})),Qi=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Xi=A(null);function Bl(c,f,x){const N=typeof f.turnIndex=="number"?f.turnIndex:-1;return N<0?!1:c.some((Q,ve)=>ve>x&&typeof Q.turnIndex=="number"&&Q.turnIndex>=N&&Qi.has(Q.messageType??""))}function Oc(c,f){return c.some(x=>typeof x.turnIndex=="number"&&x.turnIndex>=f&&Qi.has(x.messageType??""))}const ql=X(()=>{const c=ki.value,f=ft.value;for(let ve=c.length-1;ve>=0;ve-=1){const De=c[ve];if(De.messageType!=="plan"&&De.messageType!=="plan.live")continue;const on=ov(De);if(!on||Xi.value!==null&&De.id===Xi.value)return null;const c0=f?!0:Bl(c,De,ve);return{id:De.id,streaming:De.messageType==="plan.live",explanation:on.explanation,steps:on.steps,implemented:c0}}const x=de.value?ye.value[de.value]??null:null;if(!x)return null;const N=ov(x);if(!N)return null;const Q=typeof x.turnIndex=="number"?x.turnIndex:x.turnId?_e(de.value,x.turnId)??-1:-1;return{id:x.id,streaming:x.messageType==="plan.live",explanation:N.explanation,steps:N.steps,implemented:f?!0:Q>=0?Oc(c,Q):!1}}),gd=X(()=>K.value),yr=X(()=>Rn.value?"__new-thread__":de.value),Ms=X(()=>Nt(yr.value)),Zi=X(()=>{const c=V.value;return c.length>0?c[c.length-1]:null}),zl=X(()=>Zi.value?fo(Zi.value.id):""),mn=X(()=>{var c,f;return Rn.value?Ct.value.trim():((f=(c=ce.value)==null?void 0:c.cwd)==null?void 0:f.trim())??""}),el=X(()=>Pt.value&&(Rn.value&&mn.value.length>0||Et.name==="thread"&&de.value.length>0)),yd=X(()=>el.value&&$t.value==="terminal"),Ci=X(()=>!ht.value||La.value<=0||yi.value<=0?!1:yi.value-La.value>120),wd=X(()=>Ci.value||yd.value&&Po.value),Dc=X(()=>{var c,f;return((f=(c=ce.value)==null?void 0:c.cwd)==null?void 0:f.trim())??Ct.value.trim()}),Ti=X(()=>{var c;return!Rn.value&&((c=ce.value)==null?void 0:c.inProgress)===!0}),Ur=X(()=>{const c=de.value;return!!c&&Ee.value.has(c)}),Fc=X(()=>{var c,f;return!Rn.value&&((f=(c=ce.value)==null?void 0:c.externalSession)==null?void 0:f.active)===!0}),Hl=X(()=>kt.value||at.value||Ti.value||V.value.length>0);function Uc(){xs.value&&(xs.value=!1,jx(!0))}function Bc(){Uc(),Ut.push({name:"skills",query:{tab:"plugins"}})}function bd(){const c=de.value;c&&se(c)}function tl(c,f){const x=ot(c).trim(),N=br(x);return!x||!N?!1:f.some(Q=>{const ve=ot(Q).trim();return ve!==x&&br(ve)===N})}function Wl(c,f=""){const x=ot(c).trim(),N=f.trim();if(N)return N;const Q=br(x),ve=[...Wn.value.order,...B.value.map(De=>{var on,nr;return((nr=(on=De.threads[0])==null?void 0:on.cwd)==null?void 0:nr.trim())??""}).filter(Boolean)];return tl(x,ve)?x:Q}function kd(){const c=new Set(Wn.value.order),f=Wn.value.projectOrder.filter(x=>c.has(x));for(const x of Wn.value.order)f.includes(x)||f.push(x);return f}function Si(c){const f=ot(c).trim(),x=[...Wn.value.order,...B.value.map(N=>{var Q,ve;return((ve=(Q=N.threads[0])==null?void 0:Q.cwd)==null?void 0:ve.trim())??""}).filter(Boolean)];return tl(f,x)?f:br(f)}function nl(c){const f=ot(c).trim();if(!f)return"";const x=[...Wn.value.order,...B.value.map(N=>{var Q,ve;return((ve=(Q=N.threads[0])==null?void 0:Q.cwd)==null?void 0:ve.trim())??""}).filter(Boolean)];for(const N of Wn.value.order){const Q=ot(N).trim();if(!Q)continue;const ve=br(Q),De=tl(Q,x)?Q:ve;if(Q===f||De===f||ve===f)return Q}return""}const Vl=X(()=>{var N,Q;const c=[],f=new Set;for(const ve of kd()){const De=ve.trim();!De||f.has(De)||(f.add(De),c.push({value:De,label:Wl(De,Wn.value.labels[De])}))}for(const ve of B.value){const De=((Q=(N=ve.threads[0])==null?void 0:N.cwd)==null?void 0:Q.trim())??"";!De||f.has(De)||Wu(De)||(f.add(De),c.push({value:De,label:Wl(De,J.value[ve.projectName])}))}const x=Ct.value.trim();return x&&!f.has(x)&&c.unshift({value:x,label:Wl(x)}),c}),ns=X(()=>{const c=Ct.value.trim();return c?Sn.value[c]===!0:!1}),Cd=X(()=>{var f,x;const c={};for(const N of B.value){const Q=rl(N.projectName,((x=(f=N.threads[0])==null?void 0:f.cwd)==null?void 0:x.trim())??"");c[N.projectName]=Q?Sn.value[Q]===!0:!1}return c}),i=X(()=>{const c=mo.value.trim(),f=[...Vo.value];return c&&!f.some(x=>x.value===c)&&f.unshift({value:c,label:c}),f}),u=X(()=>{const c=mo.value.trim();if(!c)return"";const f=i.value.find(x=>x.value===c);return(f==null?void 0:f.label)??c}),m=X(()=>Or.value.trim()),b=X(()=>{const c=Nn.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),R=X(()=>b.value&&m.value.trim().length>0&&!Bn.value),E=X(()=>{const c=hi.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),L=X(()=>Ps.value.trim()?jo.value==="create"?E.value:mi.value.trim().length>0:!1),q=X(()=>{const c=ot(ja.value).trim();return c||Or.value.trim()}),Z=X(()=>tr.value?"Creating…":"Create"),he=X(()=>Lo.value?jo.value==="clone"?a("Cloning…"):a("Creating…"):jo.value==="clone"?a("Clone repository"):a("Create project")),Ne=X(()=>{const c=Or.value.trim(),f=aa.value.trim();return!!(c&&f&&c!==f)}),Je=X(()=>{const c=[];Ne.value&&c.push({key:`parent:${aa.value}`,name:"..",path:aa.value,kind:"parent"});for(const f of Ol.value)c.push({key:`directory:${f.path}`,name:f.name,path:f.path,kind:"directory"});return c}),pt=X(()=>{const c=Dr.value.trim().toLowerCase();return c?Je.value.filter(f=>f.kind==="parent"||f.name.toLowerCase().includes(c)):Je.value}),it=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Mt=X(()=>a(P[Ja.value].label)),Oa=X(()=>{const c=P[Ja.value],f=Math.max(0,yi.value-La.value-Dl.value);return{"--chat-column-max":c.columnMax,"--chat-card-max":c.cardMax,"--visual-viewport-height":La.value>0?`${La.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Dl.value)}px`,"--virtual-keyboard-inset":`${f}px`}}),$s=X(()=>{if(!Fr.value.configured)return a("Not configured");const c=Fr.value.active?a("Online"):a("Configured (offline)"),f=Fr.value.allowAllUsers?a("allow all users"):`${Fr.value.allowedUsers} ${a("allowed user(s)")}`,x=`${Fr.value.mappedChats} ${a("chat(s)")}, ${Fr.value.mappedThreads} ${a("thread(s)")}, ${f}`,N=Fr.value.lastError?`, ${a("error")}: ${Fr.value.lastError}`:"";return`${c}, ${x}${N}`});ws(()=>{var c,f;document.addEventListener("pointerdown",Fp),window.addEventListener("keydown",Np),document.addEventListener("visibilitychange",Up),window.addEventListener("pageshow",Bp),window.addEventListener("focus",qp),window.addEventListener("resize",ia),(c=window.visualViewport)==null||c.addEventListener("resize",ia),(f=window.visualViewport)==null||f.addEventListener("scroll",ia),ia(),ru(),it==null||it.addEventListener("change",ru),Yn=ue(x=>{ir.value&&ir.value.refreshFromNotification(x)}),Gt=ue(x=>{x==="remoteControl/status/changed"&&ci({force:!0})}),r0(),Ib(),ri(),zc(),Ds(),la(),Ls(),os(),Ld(),Jw(),li()}),nt(Es,(c,f)=>{c.forEach((x,N)=>{if(x===f[N])return;const Q=x.trim();Q&&Ha(Q)})}),nt(nn,c=>{Yt&&(Yt.disconnect(),Yt=null),typeof ResizeObserver<"u"&&(Yt=new ResizeObserver(Yr),c&&Yt.observe(c)),Yr()},{immediate:!0}),Ec(()=>{var c,f;document.removeEventListener("pointerdown",Fp),window.removeEventListener("keydown",Np),document.removeEventListener("visibilitychange",Up),window.removeEventListener("pageshow",Bp),window.removeEventListener("focus",qp),window.removeEventListener("resize",ia),(c=window.visualViewport)==null||c.removeEventListener("resize",ia),(f=window.visualViewport)==null||f.removeEventListener("scroll",ia),it==null||it.removeEventListener("change",ru),Yt&&(Yt.disconnect(),Yt=null),Na!==null&&(window.clearInterval(Na),Na=null),Eo&&(clearTimeout(Eo),Eo=null),eu(),zo(),Yn&&(Yn(),Yn=null),Gt&&(Gt(),Gt=null),Sa&&(clearTimeout(Sa),Sa=null)});function ia(){var c,f;typeof window>"u"||(yi.value=Math.max(yi.value,window.innerHeight),La.value=((c=window.visualViewport)==null?void 0:c.height)??window.innerHeight,Dl.value=((f=window.visualViewport)==null?void 0:f.offsetTop)??0)}nt(fn,c=>{const f=c.trim();if(Eo&&(clearTimeout(Eo),Eo=null),!f){Ko.value=null;return}Eo=setTimeout(()=>{Sx(f,1e3).then(x=>{fn.value.trim()===f&&(Ko.value=x.threadIds)}).catch(()=>{fn.value.trim()===f&&(Ko.value=null)})},220)}),nt(Ci,c=>{c||(Po.value=!1)}),nt(jn,()=>{if(typeof window>"u")return;if(!jn.value.some(f=>f.quotaStatus==="loading")){Na!==null&&(window.clearInterval(Na),Na=null);return}Na===null&&(Na=window.setInterval(()=>{Fl||(Fl=!0,Gl({silent:!0}).finally(()=>{Fl=!1}))},1500))},{deep:!0}),nt(He,()=>{wr().then(c=>{c&&z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function wr(){if(!Yi||Ul||xn.value!=="codex"||jn.value.length>0||He.value.length===0)return!1;Ul=!0;const c=JSON.stringify(jn.value.map(x=>x.accountId).sort());try{const x=await _m();jn.value=x.accounts}catch{await Gl({silent:!0})}const f=JSON.stringify(jn.value.map(x=>x.accountId).sort());return c!==f}function js(){Be({force:!0})}function qc(c){c&&Se(c,{silent:!0,force:!0})}async function os(){try{Fr.value=await Ax()}catch(c){const f=c instanceof Error?c.message:"Failed to load Telegram status";Fr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:f}}}async function Ls(){try{const c=await xx();Ce.value=c.botToken,st.value=c.allowedUserIds.map(f=>String(f)).join(`
|
|
81
|
+
`),Rt.value=""}catch(c){Rt.value=c instanceof Error?c.message:"Failed to load Telegram configuration"}}async function zc(){const c=await $x();xs.value=c.dismissed!==!0}function Hc(c){const f=c.split(/[\n,]/).map(Q=>Q.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),x=f.includes("*"),N=Array.from(new Set(f.filter(Q=>/^-?\d+$/.test(Q)).map(Q=>Number.parseInt(Q,10))));return x?["*",...N]:N}async function Wc(){const c=Ce.value.trim(),f=Hc(st.value);if(!c){Rt.value=a("Telegram bot token is required.");return}if(f.length===0){Rt.value=a("At least one allowed Telegram user ID or * is required.");return}$o.value=!0,Rt.value="";try{await _x(c,f),st.value=f.map(x=>String(x)).join(`
|
|
82
|
+
`),await Promise.all([Ls(),os()]),window.alert(a("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(x){Rt.value=x instanceof Error?x.message:a("Failed to connect Telegram bot"),os()}finally{$o.value=!1}}function Vc(){Vn.value=!Vn.value,Vn.value?Wt(()=>{var c;return(c=vo.value)==null?void 0:c.focus()}):fn.value=""}function Gc(){var c;fn.value="",(c=vo.value)==null||c.focus()}function ol(){return Zn.value?Zn.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function Kc(c){if(Bt.value||F)return;const f=c==null?void 0:c.currentTarget,x=f instanceof HTMLElement?f:ol();go=(x==null?void 0:x.scrollTop)??go}function Yc(){const c=++M,f=go,x=90;F=!0;const N=()=>{c===M&&(go=f,F=!1)},Q=ve=>{if(c!==M)return;if(Bt.value){N();return}const De=ol();if(De&&(De.scrollTop=f,Math.abs(De.scrollTop-f)<=1||ve>=x)){N();return}if(ve>=x||typeof window>"u"){N();return}window.requestAnimationFrame(()=>Q(ve+1))};Wt(()=>Q(0))}function Re(c){c.key==="Escape"&&(Vn.value=!1,fn.value="")}function Ot(c){c&&(Et.name==="thread"&&es.value===c||(Ut.push({name:"thread",params:{threadId:c}}),ht.value&&Co(!0)))}function Ns(c){Et.name==="automations"&&Nc.value!==c&&Ut.replace({name:"automations",query:c?{automationId:c}:{}})}async function Jc(c){var f;Bt.value&&(Co(!1),await Wt()),(f=dn.value)==null||f.openAutomationEditorFromPanel(c)}async function Zy(){var c;Bt.value&&(Co(!1),await Wt()),(c=dn.value)==null||c.openAutomationCreatorFromPanel()}function ew(){var c;Et.name==="automations"&&((c=sr.value)==null||c.loadAutomations())}async function tw(c){c&&de.value===c&&await jb()}function nw(c){return c.length>8?c.slice(-8):c}function Pp(c){const f=[c.planType||a("unknown")];return c.authMode&&f.unshift(c.authMode),f.join(" · ")}function ow(c){if(!c)return!1;const f=c.toLowerCase();return f.includes("payment required")||/\b402\b/.test(f)}function Qc(c){return c.unavailableReason==="payment_required"||ow(c.quotaError)}function rw(c){return Jo.value||bo.value||Mr.value||Ln.value||Qo.value.length>0||c.isActive&&Qo.value!==c.storageId&&Hl.value}function Td(c){return Xo.value===c.storageId}function aw(c){return vr.value===c.storageId||Td(c)}function sw(c){return Qc(c)?a("Unavailable"):c.isActive?a("Active"):bo.value?a("Switching…"):a("Switch")}function iw(c){return Qo.value===c.storageId?a("Removing…"):Td(c)?a("Click again to remove"):a("Remove")}function lw(c){vr.value=c}function cw(c){vr.value===c&&(vr.value=""),Qo.value!==c&&Xo.value===c&&(Xo.value="")}function uw(c){const f=c.quotaSnapshot;if(!f)return null;const x=[f==null?void 0:f.primary,f==null?void 0:f.secondary].filter(ve=>ve!==null),N=x.find(ve=>ve.windowMinutes===7*24*60);if(N)return N;const Q=x.filter(ve=>typeof ve.windowMinutes=="number"&&ve.windowMinutes>=7*24*60).sort((ve,De)=>(ve.windowMinutes??0)-(De.windowMinutes??0))[0]??null;return Q||(f.secondary??null)}function dw(c){if(typeof c!="number"||!Number.isFinite(c))return"";const f=new Date(c*1e3);return`${f.getMonth()+1}月${f.getDate()}日`}function Ip(c){var ve,De;if(Qc(c))return c.quotaError||a("402 Payment Required");const f=c.quotaSnapshot,x=uw(c),N=(f==null?void 0:f.primary)??(f==null?void 0:f.secondary)??null,Q=x??N;if(Q){const on=Math.max(0,Math.min(100,100-Math.round(Q.usedPercent))),nr=dw(Q.resetsAt);return nr?`${on}% ${a("weekly remaining")} · ${nr}`:`${on}% ${a("weekly remaining")}`}return(ve=f==null?void 0:f.credits)!=null&&ve.unlimited?a("Unlimited credits"):(De=f==null?void 0:f.credits)!=null&&De.hasCredits&&f.credits.balance?`${f.credits.balance} ${a("credits")}`:c.quotaStatus==="loading"?a("Loading quota…"):c.quotaStatus==="error"?c.quotaError||a("Quota unavailable"):c.quotaStatus==="ready"||c.quotaStatus==="idle"?a("Quota unavailable"):a("Fetching account details…")}function fw(c){return[c.email||a("Account"),Pp(c),Qc(c)?a("Unavailable account"):null,Ip(c),`${a("Workspace")} ${c.accountId}`].filter(Boolean).join(`
|
|
83
|
+
`)}async function Gl(c={}){try{const f=await A_();jn.value=f.accounts,f.accounts.some(x=>x.storageId===vr.value)||(vr.value=""),f.accounts.some(x=>x.storageId===Xo.value)||(Xo.value="")}catch(f){if(c.silent===!0)return;wn.value=f instanceof Error?f.message:a("Failed to load accounts")}}async function pw(){if(!(Jo.value||bo.value||Mr.value||Ln.value)){wn.value="",vr.value="",Xo.value="",Jo.value=!0;try{const c=await _m();jn.value=c.accounts,zo(),gn(),z({includeSelectedThreadMessages:!0})}catch(c){wn.value=c instanceof Error?c.message:a("Failed to refresh accounts")}finally{Jo.value=!1}}}async function hw(c){if(!(bo.value||Jo.value||Mr.value||Ln.value)){if(Hl.value){wn.value=a("Finish the current turn and pending requests before switching accounts.");return}wn.value="",vr.value="",Xo.value="",bo.value=!0;try{const f=await E_(c);jn.value=jn.value.map(x=>x.storageId===c?f:{...x,isActive:!1}),zo(),gn(),z({includeSelectedThreadMessages:!0}),Gl({silent:!0})}catch(f){wn.value=f instanceof Error?f.message:a("Failed to switch account")}finally{bo.value=!1}}}async function mw(){var c;if(!(Jo.value||bo.value||Mr.value||Ln.value)){wn.value="",$r.value="",Mr.value=!0;try{const f=await P_();Ia.value=f,Ya.value=!0,window.open(f,"_blank","noopener,noreferrer"),await Wt(),(c=fi.value)==null||c.focus()}catch(f){wn.value=f instanceof Error?f.message:a("Failed to start Codex login")}finally{Mr.value=!1}}}function Sd(){Ln.value||(Ya.value=!1,$r.value="")}async function vw(){const c=$r.value.trim();c&&await gw(c)}async function gw(c){if(!(Ln.value||c.length===0)){wn.value="",Ln.value=!0;try{const f=await I_(c);jn.value=f.accounts,Ia.value="",$r.value="",Ya.value=!1,zo(),gn(),z({includeSelectedThreadMessages:!0})}catch(f){wn.value=f instanceof Error?f.message:a("Failed to complete Codex login")}finally{Ln.value=!1}}}async function yw(c){if(Jo.value||bo.value||Mr.value||Ln.value||Qo.value.length>0)return;const f=jn.value.find(N=>N.storageId===c)??null;if(!f)return;if(Xo.value!==c){Xo.value=c;return}if(f.isActive&&Hl.value){wn.value=a("Finish the current turn and pending requests before removing the active account.");return}const x=f.isActive;wn.value="",Xo.value="",Qo.value=c;try{const N=await R_(c);jn.value=N.accounts,zo(),gn(),x&&z({includeSelectedThreadMessages:!0}),Gl({silent:!0})}catch(N){wn.value=N instanceof Error?N.message:a("Failed to remove account")}finally{Qo.value=""}}function ww(c){pe(c)}function bw(c){z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function kw(c){const f=await Me(c);f&&(Rn.value?await Ut.replace({name:"thread",params:{threadId:f}}):await Ut.push({name:"thread",params:{threadId:f}}),ht.value&&Co(!0))}function Ep(c){const f=c.trim().replace(/\\/gu,"/");return f?f.includes("/.codex/worktrees/")||f.includes("/.git/worktrees/"):!1}function rl(c,f=""){var ve,De,on;const x=B.value.find(nr=>nr.projectName===c);if(!x)return nl(c)||f.trim();const N=x.threads.find(nr=>!Ep(nr.cwd));return(((ve=N==null?void 0:N.cwd)==null?void 0:ve.trim())??((on=(De=x.threads[0])==null?void 0:De.cwd)==null?void 0:on.trim())??"")||nl(c)||f.trim()}function Cw(c){var N,Q;const f=B.value.find(ve=>ve.projectName===c),x=rl(c,((Q=(N=f==null?void 0:f.threads[0])==null?void 0:N.cwd)==null?void 0:Q.trim())??"");x&&(Ct.value=x),ht.value&&Co(!0),!Rn.value&&Ut.push({name:"home"})}function Tw(c){var x;let f="";for(const N of B.value){const Q=N.threads.find(ve=>ve.id===c);if((x=Q==null?void 0:Q.cwd)!=null&&x.trim()){f=Q.cwd.trim();break}}!f||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(f)}`,"_blank","noopener,noreferrer")}function Xc(c){var x,N;const f=B.value.find(Q=>Q.projectName===c);return rl(c,((N=(x=f==null?void 0:f.threads[0])==null?void 0:x.cwd)==null?void 0:N.trim())??"")}const Rp=X(()=>Object.fromEntries(B.value.map(c=>[c.projectName,Xc(c.projectName).trim()]).filter(([,c])=>c.length>0)));function Sw(c){return(J.value[c]??c).trim()||c}function _w(c){return Sw(c).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function xw(c){const f=Xc(c);!f||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(f)}`,"_blank","noopener,noreferrer")}async function Aw(c){const f=Xc(c);await jp(f)}async function Pw(c){const f=Iw(c);await jp(f)}function Iw(c){var f;for(const x of B.value){const N=x.threads.find(Q=>Q.id===c);if((f=N==null?void 0:N.cwd)!=null&&f.trim())return N.cwd.trim()}return""}function Mp(c){if(!Number.isFinite(c)||c<=0)return"0 B";const f=["B","KB","MB","GB"];let x=c,N=0;for(;x>=1024&&N<f.length-1;)x/=1024,N+=1;return`${x>=10||N===0?x.toFixed(0):x.toFixed(1)} ${f[N]}`}function Ew(c,f){const x=URL.createObjectURL(c),N=document.createElement("a");N.href=x,N.download=f,document.body.appendChild(N),N.click(),document.body.removeChild(N),window.setTimeout(()=>URL.revokeObjectURL(x),3e4)}async function Rw(c,f){const N={files:[new File([c],f,{type:c.type||"application/zip"})],title:f};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(N))))throw new Error("File sharing is not supported in this browser.");await navigator.share(N)}function $p(){xt.value.phase!=="exporting"&&(xt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function Mw(){const{blob:c,fileName:f}=xt.value;!c||!f||(xt.value={...xt.value,error:""},Ew(c,f))}async function $w(){const{blob:c,fileName:f}=xt.value;if(!(!c||!f))try{xt.value={...xt.value,error:""},await Rw(c,f)}catch(x){if(x instanceof DOMException&&x.name==="AbortError")return;const N=x instanceof Error?x.message:"",Q=x instanceof DOMException&&x.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(N);xt.value={...xt.value,error:Q?a("This browser blocked sharing the ZIP. Use Download instead."):N||a("Failed to share project. Use Download instead.")}}}async function jp(c){if(!(!c||typeof document>"u")){xt.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:f,fileName:x}=await yx(c,({loaded:N,total:Q})=>{xt.value={...xt.value,phase:"exporting",loaded:N,total:Q}});xt.value={phase:"ready",loaded:f.size,total:f.size,blob:f,fileName:x,error:""}}catch(f){if(xt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},f instanceof DOMException&&f.name==="AbortError")return;const x=f instanceof Error?f.message:"Failed to export project.";window.alert(x)}}}async function jw(c){const f=Xc(c);if(!f||typeof window>"u"||(await Zc(f),Sn.value[f]!==!0))return;const x=`${_w(c)}-`,N=window.prompt("New worktree folder name",x);if(N===null)return;const Q=N.trim();if(Q){if(Q.includes("/")||Q.includes("\\")||Q==="."||Q===".."){window.alert("Worktree name must be a single folder name.");return}try{const ve=await rx(f,Q),De=await fu(ve.cwd,{createIfMissing:!1,label:""});if(!De)return;Ct.value=De,Fn.value="local",ut(Si(De)),await Ds(),await la(),ht.value&&Co(!0),Rn.value||await Ut.push({name:"home"})}catch(ve){const De=ve instanceof Error?ve.message:"Failed to create worktree.";window.alert(De)}}}function Lw(){var x,N,Q;const c=ce.value;if(!c)return"";const f=((x=c.projectName)==null?void 0:x.trim())??"";return f?rl(f,((Q=c.cwd)==null?void 0:Q.trim())??""):((N=c.cwd)==null?void 0:N.trim())??""}function _d(){const c=Lw();c&&(Ct.value=c),Fn.value="local",ht.value&&Co(!0),!Rn.value&&Ut.push({name:"home"})}function Nw(){Ct.value="",Fn.value="local",ht.value&&Co(!0),!Rn.value&&Ut.push({name:"home"})}async function Zc(c){const f=c.trim();if(!f||Object.prototype.hasOwnProperty.call(Sn.value,f))return;const x=sn.get(f);if(x){const ve=await x;Object.prototype.hasOwnProperty.call(Sn.value,f)||(Sn.value={...Sn.value,[f]:ve});return}const N=ix(f).then(ve=>ve.isGitRepo).catch(()=>!1).finally(()=>{sn.delete(f)});sn.set(f,N);const Q=await N;Object.prototype.hasOwnProperty.call(Sn.value,f)||(Sn.value={...Sn.value,[f]:Q})}function Ow(c){za(c.projectName,c.displayName)}function Dw(c){Ve(c.threadId,c.title)}async function Fw(c){await Cr(c),await Ds(),la()}function Uw(c){Qt(c.projectName,c.toIndex)}function Bw(c){var N,Q;const f=B.value.find(ve=>ve.projectName===c),x=rl(c,((Q=(N=f==null?void 0:f.threads[0])==null?void 0:N.cwd)==null?void 0:Q.trim())??"");Zc(x)}function Lp(c){qw(c)}async function qw(c){var N;const f=await uo(c),x=((N=c.followUpMessageText)==null?void 0:N.trim())??"";if(!(!f||!x||Rn.value))try{await gt(x,[],[],"steer",[])}catch{}}async function zw(c){const f=await rt(c.threadId,c.turnIndex);f&&(await Ut.push({name:"thread",params:{threadId:f}}),de.value!==f&&await ie(f),ht.value&&Co(!0))}function Co(c){var f;if(Bt.value!==c){if(c){const x=(f=ol())==null?void 0:f.scrollTop;typeof x=="number"&&(x>0||go===0)&&(go=x)}Bt.value=c,e0(c),c||Yc()}}function Np(c){if(c.defaultPrevented)return;if(c.key==="Escape"&&jt.value){jt.value=!1;return}if(!c.ctrlKey&&!c.metaKey||c.shiftKey||c.altKey)return;const f=c.key.toLowerCase();if(f==="b"){if(!(Ho()?c.metaKey&&!c.ctrlKey:c.ctrlKey&&!c.metaKey))return;c.preventDefault(),Co(!Bt.value);return}if(f==="j"&&Et.name==="thread"&&de.value){c.preventDefault(),Op();return}f==="j"&&Rn.value&&mn.value&&(c.preventDefault(),Op())}function Op(){el.value&&(ht.value&&!Mn.value&&(Mn.value=!0),ht.value||(Io.value=!1),$t.value=$t.value==="terminal"?"git":"terminal",$t.value!=="terminal"&&xi())}function _i(c){$t.value=c,Xn.value=!1,ht.value||(Io.value=!1),ht.value&&(Mn.value=!0),c!=="terminal"&&xi()}function Hw(c){const f=zn.value.find(x=>x.path===c.path);if(f)po.value=f.key;else{const x={key:`preview-${Date.now()}`,path:c.path,label:c.label};zn.value=[...zn.value,x],po.value=x.key}_i("preview")}function Ww(c){zn.value.some(f=>f.key===c)&&(po.value=c,_i("preview"))}function Vw(c){const f=zn.value.findIndex(Q=>Q.key===c);if(f<0)return;const x=zn.value.filter(Q=>Q.key!==c);if(zn.value=x,po.value!==c)return;if(x.length===0){po.value="",$t.value="files";return}const N=x[Math.min(f,x.length-1)];po.value=N.key}function Dp(){if(ht.value){Mn.value=!1;return}Io.value=!0,Xn.value=!1,xi()}function Gw(){if(ht.value){Mn.value=!Mn.value;return}Io.value=!Io.value,Io.value&&(Xn.value=!1,xi())}function Kw(){$t.value="git",ht.value&&(Mn.value=!1),xi()}function Yw(c){if(Qn.value=c,!c){Po.value=!1,eu();return}Po.value=!0,eu(),Ar=setTimeout(()=>{Ar=null,Ci.value||(Po.value=!1)},1500)}function xi(){Qn.value=!1,Po.value=!1,eu()}function eu(){Ar&&(clearTimeout(Ar),Ar=null)}async function Jw(){try{const c=await S_();Pt.value=c.available,!c.available&&$t.value==="terminal"&&($t.value="git",xi())}catch{Pt.value=!1,$t.value==="terminal"&&($t.value="git")}}function Fp(c){var x,N;const f=c.target;if(f instanceof Node){if(Qn.value){const Q=f instanceof Element?f:f.parentElement;Q!=null&&Q.closest(".thread-terminal-panel")||xi()}jt.value&&((x=Go.value)!=null&&x.contains(f)||(N=Jr.value)!=null&&N.contains(f)||(Ta=Date.now(),jt.value=!1))}}function Qw(c){var x,N;if(!jt.value)return;const f=c.target;f instanceof Node&&((x=Go.value)!=null&&x.contains(f)||(N=Jr.value)!=null&&N.contains(f)||(Ta=Date.now(),jt.value=!1))}function Xw(){var c;(c=dn.value)==null||c.openRecycleBin()}function Up(){if(!(typeof document>"u")&&ht.value){if(document.visibilityState==="hidden"){gi.value=Date.now(),Rs.value=!1;return}xd()}}function Bp(c){c.persisted&&xd()}function qp(){Et.name==="home"&&(Ds(),la()),xd()}function xd(){typeof window>"u"||typeof document>"u"||!ht.value||document.visibilityState!=="visible"||Rs.value||gi.value===null||Date.now()-gi.value<QU||(Rs.value=!0,gi.value=null,Zw())}async function Zw(){if(!Ki.value){Ki.value=!0;try{await z({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Od()}finally{Ki.value=!1}}}function zp(c){const f=c.text;tu();const x=Wa.value,N=c.mode==="queue"&&x&&x.threadId===de.value?x.queueIndex:void 0;if(Wa.value=null,Rn.value){a0(f,c.imageUrls,c.skills,c.fileAttachments);return}gt(f,c.imageUrls,c.skills,c.mode,c.fileAttachments,N)}function eb(c){const f=W.value.findIndex(ve=>ve.id===c),x=f>=0?W.value[f]:void 0,N=Ao.value;if(!x||!N||N.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Wa.value=de.value?{threadId:de.value,queueIndex:f}:null;const Q={text:x.text,imageUrls:[...x.imageUrls],fileAttachments:x.fileAttachments.map(ve=>({...ve})),skills:x.skills.map(ve=>({...ve}))};N.hydrateDraft(Q),Y(c)}function tu(){if(!ht.value||Rn.value)return;const c=()=>{var f;(f=ka.value)==null||f.jumpToLatest()};c(),Wt(()=>{c(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{c(),window.requestAnimationFrame(c)})})}function tb(c){Ct.value=c.trim(),bn.value=""}function nb(c){mo.value=c.trim()}function Os(c){const f=mn.value.trim();return!c||f!==c?!1:Et.name==="thread"||Et.name==="home"&&ns.value}function Hp(){ne+=1,Pe+=1,Ge+=1,qt+=1,pr.value=[],Zr.value=null,xa.value=null,hr.value=null,Aa.value=null,Mo.value=!1,Ga.value=!1,Er.value={addedLineCount:0,removedLineCount:0},wo.value=[],qe.value={},ke.value="",Un.value="",Pa.value={},mr.value="",_s.value="",Rr.value="",cn.value=!1}function Wp(c){const f=c.trim();if(!f){Er.value={addedLineCount:0,removedLineCount:0};return}const x=++qt;fx(f,"unstaged").then(N=>{x!==qt||!Os(f)||(Er.value={addedLineCount:N.addedLineCount,removedLineCount:N.removedLineCount})}).catch(()=>{x!==qt||!Os(f)||(Er.value={addedLineCount:0,removedLineCount:0})})}async function Kl(c){var N,Q,ve;const f=c.trim();if(!f){Hp();return}const x=++ne;cn.value=!0,Rr.value="";try{const De=await sx(f);if(x!==ne||!Os(f))return;pr.value=De.options,Zr.value=De.currentBranch,xa.value=De.headSha,hr.value=De.headSubject,Aa.value=De.headDate,Mo.value=De.detached,Ga.value=De.dirty,wo.value=De.changedFiles,Wp(f);const on=((N=De.currentBranch)==null?void 0:N.trim())||((ve=(Q=De.options[0])==null?void 0:Q.value)==null?void 0:ve.trim())||"";on&&Vp({branch:on,includeResetHistory:!0})}catch{if(x!==ne||!Os(f))return;pr.value=[],Zr.value=null,xa.value=null,hr.value=null,Aa.value=null,Mo.value=!1,Ga.value=!1,Er.value={addedLineCount:0,removedLineCount:0},wo.value=[]}finally{x===ne&&(cn.value=!1)}}function ob(c){Zr.value=c.currentBranch,xa.value=c.headSha,hr.value=c.headSubject,Aa.value=c.headDate,Mo.value=c.detached,Ga.value=c.dirty,wo.value=c.changedFiles,Wp(mn.value)}function rb(c){if(ea.value)return;const f=c.trim();if(!f||f===(Zr.value??""))return;const x=mn.value.trim();x&&(ea.value=!0,Rr.value="",lx(x,f).then(N=>(Zr.value=N||f,xa.value=null,hr.value=null,Aa.value=null,Mo.value=!1,Gn.value=!1,Kl(x))).catch(N=>{const Q=N instanceof Error?N.message:"Failed to switch branch";Kl(x).finally(()=>{Rr.value=Q})}).finally(()=>{ea.value=!1}))}function ab(c){if(ea.value)return;const f=c.branch.trim(),x=c.sha.trim(),N=mn.value.trim();!f||!x||!N||(ea.value=!0,Rr.value="",dx(N,f,x).then(Q=>(ob(Q),Gn.value=!1,Kl(N))).catch(Q=>{const ve=Q instanceof Error?Q.message:"Failed to reset branch to commit";Kl(N).finally(()=>{Rr.value=ve})}).finally(()=>{ea.value=!1}))}function Vp(c){const f=(typeof c=="string"?c:c.branch).trim(),x=typeof c=="string"?!0:c.includeResetHistory!==!1,N=mn.value.trim(),Q=jl(f,x);if(!f||!N||ke.value===Q||(Un.value="",qe.value[Q]))return;const ve=++Pe;ke.value=Q,cx(N,f,{includeResetHistory:x}).then(De=>{ve!==Pe||!Os(N)||(qe.value={...qe.value,[Q]:De})}).catch(De=>{ve!==Pe||!Os(N)||(Un.value=De instanceof Error?De.message:"Failed to load branch commits")}).finally(()=>{ve===Pe&&ke.value===Q&&(ke.value="")})}function sb(c){const f=c.trim(),x=mn.value.trim();if(!f||!x||mr.value===f||(_s.value="",Pa.value[f]))return;const N=++Ge;mr.value=f,ux(x,f).then(Q=>{N!==Ge||!Os(x)||(Pa.value={...Pa.value,[f]:Q})}).catch(Q=>{N!==Ge||!Os(x)||(_s.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{N===Ge&&mr.value===f&&(mr.value="")})}function ib(c){const f=c.path.trim(),x=c.sha.trim();!f||!x||(Ir.value=f,Xr.value=x,Gn.value=!0)}function lb(){Ir.value="",Xr.value="",Gn.value=!Gn.value}function cb(){!Ir.value&&!Xr.value||(Ir.value="",Xr.value="",Gn.value=!1)}async function ub(){const c=await ou();c&&(await la(),Ps.value=c,hi.value=pn.value.trim()||"New Project (1)",mi.value="",Ma.value="",jo.value="create",Nr.value=!0,Wt(()=>{var f;return(f=Nl.value)==null?void 0:f.focus()}))}function nu(){Lo.value||(Nr.value=!1,Ma.value="")}let Ad=!1,Pd=!1;function db(){Ad=!0}function fb(){Ad&&(Ad=!1,al())}function pb(){Pd=!0}function hb(){Pd&&(Pd=!1,nu())}async function mb(){const c=Ps.value.trim(),f=hi.value.trim();if(!E.value)throw new Error("Enter a single project folder name.");const x=Jp(Yp(c,f));return x?fu(x,{createIfMissing:!0,label:""}):""}async function vb(){const c=Ps.value.trim(),f=mi.value.trim();return f?kx(f,c):""}async function Id(){if(!(!L.value||Lo.value)){Ma.value="",Lo.value=!0;try{const c=jo.value==="clone"?await vb():await mb();if(!c)return;Ct.value=c,ut(Si(c)),await Ds(),await la(),Nr.value=!1}catch(c){Ma.value=c instanceof Error?c.message:"Failed to create or clone project."}finally{Lo.value=!1}}}function gb(){yb(jc.value)}function yb(c){Is.value||!c||(c.value="",c.click())}async function wb(c,f,x){Is.value=!0;try{const N=await ou();if(!N)return;const Q=await f(N);if(!Q.path)return;Ct.value=Q.path,ut(Si(Q.path)),await Ds(),await z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await la()}catch(N){const Q=N instanceof Error?N.message:x;window.alert(Q)}finally{Is.value=!1,c&&(c.value="")}}async function bb(c){var N;const f=c.target instanceof HTMLInputElement?c.target:null,x=((N=f==null?void 0:f.files)==null?void 0:N[0])??null;!x||Is.value||await wb(f,Q=>wx(x,Q),"Failed to import project.")}async function kb(){const c=Ct.value.trim()||await ou();c&&(Kt.value=!1,$a.value=!0,Dr.value="",await Fs(c),Bn.value||Wt(()=>{var f;return(f=Lc.value)==null?void 0:f.focus()}))}function al(){wi+=1,$a.value=!1,No.value=!1,Bn.value="",Dr.value="",ja.value="",Yl()}async function Cb(c){!c||No.value||(Dr.value="",await Fs(c))}function Tb(){const c=Or.value.trim();!$a.value||!c||Fs(c)}function Sb(){const c=q.value;!$a.value||!c||No.value||Fs(c)}function _b(){if(!$a.value||No.value||ko.value)return;const c=q.value,f=Or.value.trim();!c||c===f||Fs(c)}function xb(){const c=q.value,f=Or.value.trim();if(c){if(c!==f){Fs(c);return}Ed(c)}}async function Ed(c=q.value){const f=ot(c).trim();if(f){Bn.value="",ko.value=!0;try{const x=await fu(f,{createIfMissing:!1,label:""});if(!x){Bn.value="Failed to open the selected folder.";return}Ct.value=x,ut(Si(x)),await Ds(),await z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await la(),al()}catch(x){Bn.value=x instanceof Error?x.message:"Failed to open the selected folder."}finally{ko.value=!1}}}async function Ab(){if(bn.value="",Kt.value){Yl();return}if(!$a.value){const c=Ct.value.trim()||await ou();if(!c||($a.value=!0,Dr.value="",await Fs(c),Bn.value))return}Bn.value||(Nn.value=pn.value,Kt.value=!0,Wt(()=>{var c;return(c=Ka.value)==null?void 0:c.focus()}))}function Yl(){bn.value="",Nn.value="",Kt.value=!1}async function Gp(){const c=Nn.value.trim();if(!c)return;if(bn.value="",Bn.value){bn.value="Reload the current folder before creating a new one.";return}tr.value=!0;const f=m.value.trim(),x=Jp(Yp(f,c));if(!x){bn.value="Unable to determine where the new folder should be created.",tr.value=!1;return}if(!b.value){bn.value="Enter a single folder name.",tr.value=!1;return}try{const N=await bx(x);if(!N){bn.value="Failed to create the folder.";return}bn.value="",Dr.value="",await Fs(N),Yl()}catch(N){bn.value=N instanceof Error?N.message:"Failed to create folder."}finally{tr.value=!1}}async function Pb(){var f;if(typeof window>"u")return!1;const c=((f=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:f.trim())??"";if(!c)return!1;try{const x=await fu(c,{createIfMissing:!1,label:""});if(!x)return!1;Ct.value=x,ut(Si(x)),await Ut.replace({name:"home"}),await Ds();const N=new URL(window.location.href);return N.searchParams.delete("openProjectPath"),window.history.replaceState({},"",N.toString()),!0}catch{return!1}}async function ou(){const c=Kp();if(c)return c;try{const f=await jm();if(f)return Xt.value=f,f}catch{}return""}async function la(){const c=Kp();if(!c){pn.value="New Project (1)";return}try{const f=await Tx(c);pn.value=f.name||"New Project (1)"}catch{pn.value="New Project (1)"}}function Kp(){var x,N;const c=Ct.value.trim();if(c)return Cl(c);const f=((N=(x=Vl.value[0])==null?void 0:x.value)==null?void 0:N.trim())??"";return f?Cl(f):Xt.value.trim()}async function Ib(){try{Xt.value=await jm()}catch{Xt.value=""}}async function Ds(){try{const c=await pl();Wn.value={order:[...c.order],labels:{...c.labels},projectOrder:[...c.projectOrder]}}catch{Wn.value={order:[],labels:{},projectOrder:[]}}}async function Fs(c){const f=++wi,x=ot(c).trim();ja.value=x,Or.value=x,Bn.value="",No.value=!0;try{const N=await px(c,{showHidden:vi.value});if(f!==wi)return;ja.value=N.path,Or.value=N.path,aa.value=N.parentPath,Ol.value=N.entries}catch(N){if(f!==wi)return;Bn.value=N instanceof Error?N.message:"Failed to load local folders.",aa.value=Cl(Or.value),Ol.value=[],Yl()}finally{f===wi&&(No.value=!1)}}function Yp(c,f){const x=ot(c).trim(),N=ot(f).trim().replace(/^[\\/]+/u,"");if(!x||!N)return"";const Q=x.includes("\\")&&!x.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(x))return`${x.slice(0,2)}${Q}${N}`;if(/^\/+$/u.test(x))return`/${N}`;const ve=x.replace(/[\\/]+$/u,"");return ve?`${ve}${Q}${N}`:""}function Jp(c){const f=ot(c).trim();if(!f)return"";const x=f.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(x){const[,Q,ve,De=""]=x,on=Rd(De.split(/[\\/]+/u));return on.length>0?`\\\\${Q}\\${ve}\\${on.join("\\")}`:`\\\\${Q}\\${ve}`}const N=f.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(N){const[,Q,ve=""]=N,De=f.includes("\\")&&!f.includes("/")?"\\":"/",on=Rd(ve.split(/[\\/]+/u));return on.length>0?`${Q}${De}${on.join(De)}`:`${Q}${De}`}if(f.startsWith("/")){const Q=Rd(f.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return f}function Rd(c){const f=[];for(const x of c){const N=x.trim();if(!(!N||N===".")){if(N===".."){f.length>0&&f.pop();continue}f.push(N)}}return f}function Eb(c){me(c.draggedId,c.targetId)}function Qp(c){Kn(yr.value,c)}function Xp(c){lo(c)}function Zp(c){co(c)}function Rb(){Tt()}const Jl=A("");let Md=null;nt(Tn,c=>{var f;c&&(c.text&&((f=Ao.value)==null||f.hydrateDraft({text:c.text,imageUrls:c.imageUrls,fileAttachments:c.fileAttachments,skills:c.skills})),Jl.value=c.text?a("Stopped: message not submitted, restored to input."):a("Stopped: message not submitted."),Md&&clearTimeout(Md),Md=setTimeout(()=>{Jl.value=""},6e3),H(yr.value))});function eh(c){var x,N;const f=de.value.trim();switch(c){case"compact":f&&se(f);break;case"review":if(!f)return;Ir.value="",Xr.value="",Gn.value=!0;break;case"rename":f&&((N=dn.value)==null||N.openRenameThreadDialog(f,((x=ce.value)==null?void 0:x.title)??""));break;case"archive":f&&pe(f);break;case"fork":f&&Me(f);break;case"new":_d();break;case"skills":gr.value||Ut.push({name:"skills"});break}}function Mb(c){const f=c.turnId.trim();if(f.length>0){const x=[...ki.value].reverse().find(N=>{var Q;return N.role==="user"&&(((Q=N.turnId)==null?void 0:Q.trim())??"")===f&&N.text.trim().length>0});x!=null&&x.text&&Ao.value&&Ao.value.appendTextToDraft(x.text)}ni(c.turnId)}function $b(){Rn.value||!de.value||(ql.value&&(Xi.value=ql.value.id),Ft("default"),tu(),gt("Implement",[],[],"steer",[],void 0,"default"))}async function jb(){if(Rn.value||gr.value||ts.value||!ce.value||ki.value.length===0)return;const c=Lb();try{await Oy(c)}catch{}}function Lb(){var x,N,Q;const c=[],f=((N=(x=ce.value)==null?void 0:x.title)==null?void 0:N.trim())||"Untitled thread";c.push(`# ${Nb(f)}`),c.push(""),c.push(`- Exported: ${new Date().toISOString()}`),c.push(`- Thread ID: ${((Q=ce.value)==null?void 0:Q.id)??""}`),c.push(""),c.push("---"),c.push("");for(const ve of ki.value){const De=ve.role?ve.role.toUpperCase():"MESSAGE";c.push(`## ${De}`),c.push("");const on=ve.text.trim();if(on&&(c.push(on),c.push("")),ve.commandExecution&&(c.push("```text"),c.push(`command: ${ve.commandExecution.command}`),c.push(`status: ${ve.commandExecution.status}`),ve.commandExecution.cwd&&c.push(`cwd: ${ve.commandExecution.cwd}`),ve.commandExecution.exitCode!==null&&c.push(`exitCode: ${ve.commandExecution.exitCode}`),c.push(ve.commandExecution.aggregatedOutput||"(no output)"),c.push("```"),c.push("")),ve.fileAttachments&&ve.fileAttachments.length>0){c.push("Attachments:");for(const nr of ve.fileAttachments)c.push(`- ${nr.path}`);c.push("")}if(ve.images&&ve.images.length>0){c.push("Images:");for(const nr of ve.images)c.push(`- ${nr}`);c.push("")}}return`${c.join(`
|
|
84
|
+
`).trimEnd()}
|
|
85
|
+
`}function Nb(c){return c.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function $d(c,f){if(typeof window>"u")return f;const x=window.localStorage.getItem(c);return x===null?f:x==="1"}function Ob(){if(typeof window>"u")return"system";const c=window.localStorage.getItem(Pv);return c==="light"||c==="dark"?c:"system"}function Db(){if(typeof window>"u")return"steer";const c=window.localStorage.getItem(Av);return c==="steer"||c==="queue"?c:"queue"}function Fb(){if(typeof window>"u")return"standard";const c=window.localStorage.getItem(Mv);return c==="standard"||c==="wide"||c==="extra-wide"?c:"standard"}function Ub(){ta.value=!ta.value,window.localStorage.setItem(xv,ta.value?"1":"0")}function Bb(){Ea.value=Ea.value==="steer"?"queue":"steer",window.localStorage.setItem(Av,Ea.value)}function qb(){const c=["system","light","dark"],f=c.indexOf(na.value);na.value=c[(f+1)%c.length],window.localStorage.setItem(Pv,na.value),ru()}function zb(){const c=["standard","wide","extra-wide"],f=c.indexOf(Ja.value);Ja.value=c[(f+1)%c.length],window.localStorage.setItem(Mv,Ja.value)}function Hb(){Zo.value=!Zo.value,window.localStorage.setItem(Iv,Zo.value?"1":"0")}function Wb(){oa.value=!oa.value,window.localStorage.setItem(Ev,oa.value?"1":"0")}async function Vb(c){if(!Lr.value){Lr.value=!0;try{if(c==="codex"){xn.value="codex";const f=await Em(!1);jr.value=f.enabled}else if(c==="openrouter"){xn.value="openrouter";const f=await Em(!0);jr.value=f.enabled,await ll("","",{wireApi:k.value,provider:"openrouter"})}else c==="opencode-zen"?(xn.value="opencode-zen",await ll("",C.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),jr.value=!0):c==="custom"&&(xn.value="custom",er.value.trim()&&Za.value.trim()&&(await ll(er.value.trim(),Za.value.trim(),{wireApi:w.value}),jr.value=!0));oo.value="",await z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(f){oo.value=f instanceof Error?f.message:"Failed to switch provider"}finally{Lr.value=!1}}}async function jd(){if(Jt.value)return;const c=er.value.trim();if(c){Jt.value=!0;try{oo.value="",await ll(c,Za.value.trim(),{wireApi:w.value}),jr.value=!0;const f=await Im();f.provider==="custom"&&!f.currentModel&&(oo.value=a("Failed to resolve model from custom endpoint; check the URL and try again")),await z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(f){oo.value=f instanceof Error?f.message:"Failed to save custom endpoint"}finally{Jt.value=!1}}}async function th(c){if(Jt.value||Lr.value||k.value===c)return;const f=k.value;k.value=c,Jt.value=!0;try{oo.value="",await ll("","",{wireApi:c,provider:"openrouter"}),jr.value=!0,await z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(x){k.value=f,oo.value=x instanceof Error?x.message:"Failed to save OpenRouter API format"}finally{Jt.value=!1}}async function nh(){if(Jt.value)return;const c=C.value.trim();if(c){Jt.value=!0;try{oo.value="",await ll("",c,{wireApi:"responses",provider:"opencode-zen"}),jr.value=!0,await z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(f){oo.value=f instanceof Error?f.message:"Failed to save OpenCode Zen config"}finally{Jt.value=!1}}}async function oh(){if(!Jt.value){Jt.value=!0;try{const c=ra.value.trim();await Rm(c),ra.value="",await Ld(),await z({includeSelectedThreadMessages:!1})}catch{}finally{Jt.value=!1}}}async function Gb(){if(!Jt.value){Jt.value=!0;try{await Rm(""),ra.value="",await Ld(),await z({includeSelectedThreadMessages:!1})}catch{}finally{Jt.value=!1}}}async function Ld(){try{const c=xn.value,f=await Im();jr.value=f.enabled,Xa.value=f.customKey??!1,Gi.value=f.maskedKey??null,f.enabled?f.provider==="opencode-zen"?xn.value="opencode-zen":f.provider==="custom"?(xn.value="custom",er.value=f.customBaseUrl??"",w.value=f.wireApi==="chat"?"chat":"responses"):(xn.value="openrouter",k.value=f.wireApi==="chat"?"chat":"responses"):xn.value="codex",Yi=f.hasCodexAuth===!0,Yi||(Ul=!1);const x=xn.value!==c;x&&await z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const N=await wr();N&&await z({includeSelectedThreadMessages:!1,providerChanged:x||N,awaitAncillaryRefreshes:!0})}catch{}}function Kb(c){const x=Nd(c.trim())||"auto";Ra.value=x,window.localStorage.setItem(Rv,x)}function Yb(c){Ze(Number(c))}const Jb=[{value:"0",label:a("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function Qb(){var x;if(typeof window>"u")return"auto";const c=((x=window.localStorage.getItem(Rv))==null?void 0:x.trim())||"auto";return Nd(c)||"auto"}function Xb(){const c=[{value:"auto",label:a("Auto-detect")}],f=new Set(["auto"]);function x(Q){const ve=j[Q]||Q;return`${ve.charAt(0).toUpperCase()+ve.slice(1)} (${Q})`}for(const Q of typeof navigator<"u"?navigator.languages??[]:[]){const ve=Nd(Q);!ve||f.has(ve)||(f.add(ve),c.push({value:ve,label:`${a("Preferred")}: ${x(ve)}`}))}for(const Q of Object.keys(j))f.has(Q)||(f.add(Q),c.push({value:Q,label:x(Q)}));const N=Ra.value.trim();return N&&!f.has(N)&&c.push({value:N,label:x(N)}),c}function Nd(c){const f=c.trim().toLowerCase();if(!f||f==="auto")return"";if(f in j)return f;const x=f.split("-")[0]??f;return x in j?x:""}function ru(){const c=document.documentElement;if(na.value==="dark")c.classList.add("dark");else if(na.value==="light")c.classList.remove("dark");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;c.classList.toggle("dark",f)}}function Zb(){return typeof window>"u"?!1:window.localStorage.getItem(Cv)==="1"}function e0(c){typeof window>"u"||window.localStorage.setItem(Cv,c?"1":"0")}function t0(){if(typeof window>"u")return!0;const c=window.localStorage.getItem(Tv);return c===null?!0:c==="1"}function n0(){Qr.value=!Qr.value,!(typeof window>"u")&&window.localStorage.setItem(Tv,Qr.value?"1":"0")}function o0(c,f){const x=(c??"").trim();return x.length>0?x:f.trim()||"message"}function rh(c){Ft(c)}async function r0(){await Ut.isReady(),Et.name==="thread"&&es.value?bs(es.value):(Et.name==="home"||Et.name==="skills"||Et.name==="automations")&&bs("",{persist:!1}),await z({includeSelectedThreadMessages:Et.name==="thread"}),Gl({silent:!0}),await Pb(),ur.value=!0,await Od(),gn()}async function Od(){if(Ca.value){_r=!0;return}Ca.value=!0;try{do{if(_r=!1,Et.name==="home"||Et.name==="skills"||Et.name==="automations"){de.value!==""&&await ie("");continue}if(Et.name==="thread"){const c=es.value;if(!c)continue;if(de.value!==c){if(await ie(c)==="not-found")continue}else re(c,{silent:!0}).catch(()=>{})}}while(_r)}finally{Ca.value=!1}}nt(()=>[Et.name,es.value,Qe.value,de.value],async()=>{ur.value&&await Od()}),nt(()=>[de.value,mn.value],()=>{cb()}),nt(()=>[Et.name,mn.value],([c,f])=>{c==="thread"&&Zc(f)},{immediate:!0}),nt(()=>de.value,async c=>{if(ur.value&&!Ca.value&&!(Rn.value||gr.value||ts.value)){if(!c){Et.name!=="home"&&await Ut.replace({name:"home"});return}Et.name==="thread"&&es.value===c||await Ut.replace({name:"thread",params:{threadId:c}})}}),nt(()=>Vl.value,c=>{if(c.length===0){Ct.value="",la();return}const f=Ct.value.trim();f&&(c.some(N=>N.value===f)||(Ct.value="")),la()},{immediate:!0}),nt(()=>Ct.value,()=>{yn.value={phase:"idle",title:"",message:""},la()}),nt(()=>[Et.name,Ct.value],([c,f])=>{c==="home"&&Zc(f)},{immediate:!0}),nt(ns,c=>{!c&&Fn.value==="worktree"&&(Fn.value="local")},{immediate:!0}),nt(()=>[Fn.value,Ct.value],([c,f])=>{c!=="worktree"||!ns.value||ah(f)},{immediate:!0}),nt(()=>Fn.value,c=>{var f;if(c==="local"){yn.value={phase:"idle",title:"",message:""};const x=Ct.value.trim();if(x&&Ep(x)){const N=((f=ce.value)==null?void 0:f.projectName)??br(x),Q=rl(N,"");Q&&(Ct.value=Q)}return}ns.value&&ah(Ct.value)}),nt(()=>Et.name,c=>{c!=="home"&&(yn.value={phase:"idle",title:"",message:""}),c!=="thread"&&(Gn.value=!1)}),nt(()=>de.value,()=>{yn.value={phase:"idle",title:"",message:""}}),nt(()=>[Et.name,mn.value,ns.value],([c,f,x])=>{if(!(c==="thread"||c==="home"&&x)){Hp();return}Pe+=1,qe.value={},ke.value="",Un.value="",Kl(f)},{immediate:!0}),nt(Ji,c=>{typeof document>"u"||(document.title=c)},{immediate:!0}),nt(ht,c=>{c&&!Bt.value&&Co(!0)},{immediate:!0});async function a0(c,f=[],x=[],N=[]){try{yn.value={phase:"idle",title:"",message:""};let Q=Ct.value;if(Fn.value==="worktree"){yn.value={phase:"running",title:a("Creating worktree"),message:a("Creating a worktree and running setup.")};try{const De=await ox(Ct.value,mo.value);Q=De.cwd,Ct.value=De.cwd,yn.value={phase:"idle",title:"",message:""}}catch{yn.value={phase:"error",title:a("Worktree setup failed"),message:a("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!Q.trim()){const De=await Cx(c);Q=De.cwd,Ct.value=De.cwd}const ve=await It(c,Q,f,x,N);if(!ve)return;await Ut.replace({name:"thread",params:{threadId:ve}}),tu()}catch{}}function s0(c){var N;if((N=c.prompt)!=null&&N.trim())return c.prompt.trim();const f=c.displayName.trim()||c.name.trim(),x=c.kind==="skill"?"skill":c.kind==="plugin"?"plugin":c.kind==="composio"?"Composio connector":"app";return`Test ${f} ${x}. Give me a list of what it can do and one useful example.`}function i0(c){return`${c.kind}:${c.name}:${c.skillPath??""}`}async function l0(c){var N;if(cr.value)return;cr.value=i0(c);const f=s0(c),x=(N=c.attachedSkills)!=null&&N.length?c.attachedSkills:c.kind==="skill"&&c.skillPath?[{name:c.name,path:c.skillPath}]:[];try{const Q=Dc.value.trim()||mn.value.trim(),ve=await It(f,Q,[],x,[]);if(!ve)return;await Ut.replace({name:"thread",params:{threadId:ve}}),tu()}catch{}finally{cr.value=""}}async function ah(c){var x;const f=c.trim();if(!f){Vo.value=[],mo.value="";return}En.value=!0;try{const N=await ax(f);Vo.value=N;const Q=mo.value.trim();if(!(Q.length>0&&N.some(De=>De.value===Q))){const De=N.find(on=>on.value.trim()==="main");mo.value=(De==null?void 0:De.value)??((x=N[0])==null?void 0:x.value)??""}}catch{Vo.value=[],mo.value=""}finally{En.value=!1}}return(c,f)=>(S(),I(ze,null,[Ie(rS,{"is-sidebar-collapsed":Bt.value,onCloseSidebar:f[47]||(f[47]=x=>Co(!0))},{sidebar:yt(()=>{var x;return[p("section",hO,[p("div",{ref_key:"sidebarScrollableRef",ref:Zn,class:"sidebar-scrollable",onScroll:Kc},[Bt.value?ee("",!0):(S(),tt(ev,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Bt.value,"show-new-thread-button":!0,onToggleSidebar:f[0]||(f[0]=N=>Co(!Bt.value)),onStartNewThread:_d},{default:yt(()=>[p("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Vn.value,"aria-label":g(a)("Search threads"),title:g(a)("Search threads"),onClick:Vc},[Ie(tv,{class:"sidebar-search-toggle-icon"})],8,mO)]),_:1},8,["is-sidebar-collapsed"])),!Bt.value&&Vn.value?(S(),I("div",vO,[Ie(tv,{class:"sidebar-search-bar-icon"}),Lt(p("input",{ref_key:"sidebarSearchInputRef",ref:vo,"onUpdate:modelValue":f[1]||(f[1]=N=>fn.value=N),class:"sidebar-search-input",type:"text",placeholder:g(a)("Filter threads..."),onKeydown:Re},null,40,gO),[[an,fn.value]]),fn.value.length>0?(S(),I("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":g(a)("Clear search"),onClick:Gc},[Ie(Ru,{class:"sidebar-search-clear-icon"})],8,yO)):ee("",!0)])):ee("",!0),Bt.value?ee("",!0):(S(),I("button",{key:2,class:Ke(["sidebar-skills-link",{"is-active":gr.value}]),type:"button",onClick:f[2]||(f[2]=N=>{g(Ut).push({name:"skills"}),g(ht)&&Co(!0)})},[p("span",wO,[Ie(Ys)]),p("span",bO,[p("span",kO,T(g(a)("Skills")),1),p("span",CO,T(g(a)("Plugins, apps, MCPs")),1)])],2)),Bt.value?ee("",!0):(S(),I("button",{key:3,class:Ke(["sidebar-skills-link",{"is-active":ts.value}]),type:"button",onClick:f[3]||(f[3]=N=>{g(Ut).push({name:"automations"}),g(ht)&&Co(!0)})},[p("span",TO,[Ie(Ys)]),p("span",SO,[p("span",_O,T(g(a)("Automations")),1),p("span",xO,T(g(a)("Scheduled work")),1)])],2)),Bt.value?ee("",!0):(S(),tt(oI,{key:4,ref_key:"sidebarThreadTreeRef",ref:dn,groups:g(B),"project-display-name-by-id":g(J),"project-git-repo-by-name":Cd.value,"project-cwd-by-name":Rp.value,"selected-thread-id":g(de),"is-loading":g(Qe),"is-thread-list-fully-loaded":g(et),"search-query":fn.value,"search-matched-thread-ids":Ko.value,onSelect:Ot,onArchive:ww,onStartNewThread:Cw,onRenameProject:Ow,onBrowseThreadFiles:Tw,onSaveThreadProject:Pw,onBrowseProjectFiles:xw,onSaveProject:Aw,onRequestProjectGitStatus:Bw,onCreateProjectWorktree:jw,onRenameThread:Dw,onForkThread:kw,onRemoveProject:Fw,onReorderProject:Uw,onCopyThreadChat:tw,onAutomationsChanged:ew,onRestoreThread:bw,onStartNewChat:Nw},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),Bt.value?ee("",!0):(S(),I("div",{key:0,ref_key:"settingsAreaRef",ref:xr,class:"sidebar-settings-area",onClick:Qw},[(S(),tt(Xs,{to:"body"},[jt.value?(S(),I("div",{key:0,class:"settings-dialog-backdrop",role:"presentation",onClick:f[21]||(f[21]=lt(N=>jt.value=!1,["self"]))},[p("div",{ref_key:"settingsPanelRef",ref:Go,class:"sidebar-settings-panel",role:"dialog","aria-modal":"true","aria-label":g(a)("Settings"),onClick:f[20]||(f[20]=lt(()=>{},["stop"]))},[p("div",PO,[p("h2",IO,T(g(a)("Settings")),1),p("button",{class:"settings-dialog-close",type:"button","aria-label":g(a)("Close"),title:g(a)("Close"),onClick:f[4]||(f[4]=N=>jt.value=!1)},[Ie(Ru,{class:"settings-dialog-close-icon"})],8,EO)]),p("div",RO,[p("nav",{class:"settings-group-nav","aria-label":g(a)("Settings groups")},[(S(),I(ze,null,_t(Pr,N=>p("button",{key:N.id,type:"button",class:Ke(["settings-group-nav-item",{"is-active":yo.value===N.id}]),"aria-current":yo.value===N.id?"true":void 0,onClick:Q=>yo.value=N.id},T(g(a)(N.label)),11,$O)),64))],8,MO),p("div",jO,[Lt(p("div",null,[Ie(Z$,{accounts:jn.value,"is-accounts-section-collapsed":Qr.value,"is-refreshing-accounts":Jo.value,"is-switching-accounts":bo.value,"is-starting-codex-login":Mr.value,"is-completing-codex-login":Ln.value,"account-action-error":wn.value,"codex-login-url":Ia.value,"feedback-mailto":g(Dn),"is-account-unavailable":Qc,"is-remove-confirmation-active":Td,"is-remove-visible":aw,"build-account-title":fw,"format-account-meta":Pp,"format-account-quota":Ip,"short-account-id":nw,"is-account-action-disabled":rw,"get-account-switch-label":sw,"get-account-remove-label":iw,"on-refresh-accounts":pw,"on-start-codex-login":mw,"on-switch-account":hw,"on-remove-account":yw,"on-account-card-pointer-enter":lw,"on-account-card-pointer-leave":cw,"toggle-accounts-section-collapsed":n0,"prepare-feedback-link":In},null,8,["accounts","is-accounts-section-collapsed","is-refreshing-accounts","is-switching-accounts","is-starting-codex-login","is-completing-codex-login","account-action-error","codex-login-url","feedback-mailto"]),p("button",{class:"sidebar-settings-row",type:"button",title:_.sendWithEnter,onClick:Ub},[p("span",NO,T(g(a)("Require ⌘ + enter to send")),1),p("span",{class:Ke(["sidebar-settings-toggle",{"is-on":!ta.value}])},null,2)],8,LO),p("button",{class:"sidebar-settings-row",type:"button",title:_.inProgressSendMode,onClick:Bb},[p("span",DO,T(g(a)("When busy, send as")),1),p("span",FO,T(Ea.value==="steer"?g(a)("Steer"):g(a)("Queue")),1)],8,OO),p("button",{class:"sidebar-settings-row",type:"button",title:_.appearance,onClick:qb},[p("span",BO,T(g(a)("Appearance")),1),p("span",qO,T(na.value==="system"?g(a)("System"):na.value==="dark"?g(a)("Dark"):g(a)("Light")),1)],8,UO),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g(a)("Choose the interface language for the app.")},[p("span",HO,T(g(a)("UI language")),1),Ie(or,{class:"sidebar-settings-provider-dropdown","model-value":g(l),options:g(d),placeholder:g(a)("UI language"),"menu-align":"end","onUpdate:modelValue":f[5]||(f[5]=N=>g(h)(N))},null,8,["model-value","options","placeholder"])],8,zO),p("button",{class:"sidebar-settings-row",type:"button",title:_.chatWidth,onClick:zb},[p("span",VO,T(g(a)("Chat width")),1),p("span",GO,T(Mt.value),1)],8,WO),p("button",{class:"sidebar-settings-row",type:"button",title:_.dictationClickToToggle,onClick:Hb},[p("span",YO,T(g(a)("Click to toggle dictation")),1),p("span",{class:Ke(["sidebar-settings-toggle",{"is-on":Zo.value}])},null,2)],8,KO),p("button",{class:"sidebar-settings-row",type:"button",title:_.dictationAutoSend,onClick:Wb},[p("span",QO,T(g(a)("Auto send dictation")),1),p("span",{class:Ke(["sidebar-settings-toggle",{"is-on":oa.value}])},null,2)],8,JO),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:_.dictationLanguage},[p("span",ZO,T(g(a)("Dictation language")),1),Ie(or,{class:"sidebar-settings-language-dropdown","model-value":Ra.value,options:Qa.value,placeholder:g(a)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":g(a)("Search language..."),"onUpdate:modelValue":Kb},null,8,["model-value","options","placeholder","search-placeholder"])],8,XO),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g(a)("Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.")},[p("span",t2,T(g(a)("Auto-compact before send")),1),Ie(or,{class:"sidebar-settings-auto-compact-dropdown","model-value":String(g(We)),options:Jb,placeholder:g(a)("Off"),"menu-align":"end","onUpdate:modelValue":Yb},null,8,["model-value","placeholder"])],8,e2),sa.value?(S(),I("a",{key:0,class:"sidebar-settings-row sidebar-settings-feedback-row",href:g(Dn),onClick:In},[p("span",o2,T(g(a)("Send feedback")),1),p("span",r2,T(g(a)("Issue detected")),1)],8,n2)):ee("",!0)],512),[[uu,yo.value==="general"]]),Lt(p("div",null,[p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g(a)("Choose the API provider for the Codex backend")},[p("span",s2,T(g(a)("Provider")),1),Ie(or,{class:"sidebar-settings-provider-dropdown","model-value":xn.value,options:As.value,placeholder:g(a)("Provider"),disabled:Lr.value,"menu-align":"end","onUpdate:modelValue":Vb},null,8,["model-value","options","placeholder","disabled"])],8,a2),oo.value?(S(),I("div",i2,[p("span",null,T(oo.value),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[6]||(f[6]=N=>In(N,oo.value))},T(g(a)("Send feedback")),9,l2)])):ee("",!0),xn.value==="openrouter"?(S(),I("div",c2,[p("div",u2,[p("span",d2,T(g(a)("OpenRouter API key")),1),p("a",f2,T(g(a)("Get API key")),1)]),p("div",p2,[Xa.value&&!ra.value?(S(),I(ze,{key:0},[p("span",h2,T(Gi.value),1),p("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Jt.value,title:g(a)("Remove custom key, use community keys"),onClick:Gb},"✕",8,m2)],64)):(S(),I(ze,{key:1},[Lt(p("input",{"onUpdate:modelValue":f[7]||(f[7]=N=>ra.value=N),class:"sidebar-settings-key-input",type:"password",placeholder:g(a)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:An(oh,["enter"])},null,40,v2),[[an,ra.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Jt.value||!ra.value.trim(),onClick:oh},T(Jt.value?"...":g(a)("Set")),9,g2)],64))]),p("div",y2,[p("span",w2,T(g(a)("API format")),1),p("div",{class:"sidebar-settings-segmented",role:"group","aria-label":g(a)("OpenRouter API format")},[p("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":k.value==="responses"}]),disabled:Jt.value||Lr.value,onClick:f[8]||(f[8]=N=>th("responses"))},T(g(a)("Responses")),11,k2),p("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":k.value==="chat"}]),disabled:Jt.value||Lr.value,onClick:f[9]||(f[9]=N=>th("chat"))},T(g(a)("Completions")),11,C2)],8,b2)])])):ee("",!0),xn.value==="opencode-zen"?(S(),I("div",T2,[p("div",S2,[p("span",_2,T(g(a)("OpenCode Zen API key")),1),p("a",x2,T(g(a)("Get API key")),1)]),p("div",A2,[Lt(p("input",{"onUpdate:modelValue":f[10]||(f[10]=N=>C.value=N),class:"sidebar-settings-key-input",type:"password",placeholder:g(a)("sk-..."),onKeydown:An(nh,["enter"])},null,40,P2),[[an,C.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Jt.value||!C.value.trim(),onClick:nh},T(Jt.value?"...":g(a)("Save")),9,I2)])])):ee("",!0),xn.value==="custom"?(S(),I("div",E2,[p("span",R2,T(g(a)("Custom endpoint URL")),1),p("div",M2,[Lt(p("input",{"onUpdate:modelValue":f[11]||(f[11]=N=>er.value=N),class:"sidebar-settings-key-input",type:"url",placeholder:g(a)("https://api.example.com/v1"),onKeydown:An(jd,["enter"])},null,40,$2),[[an,er.value]])]),p("span",j2,T(g(a)("API key")),1),p("div",L2,[Lt(p("input",{"onUpdate:modelValue":f[12]||(f[12]=N=>Za.value=N),class:"sidebar-settings-key-input",type:"password",placeholder:g(a)("Bearer token (optional)"),onKeydown:An(jd,["enter"])},null,40,N2),[[an,Za.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Jt.value||!er.value.trim(),onClick:jd},T(Jt.value?"...":g(a)("Save")),9,O2)]),p("div",D2,[p("span",F2,T(g(a)("API format")),1),p("div",{class:"sidebar-settings-segmented",role:"group","aria-label":g(a)("Custom endpoint API format")},[p("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":w.value==="responses"}]),onClick:f[13]||(f[13]=N=>w.value="responses")},T(g(a)("Responses")),3),p("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":w.value==="chat"}]),onClick:f[14]||(f[14]=N=>w.value="chat")},T(g(a)("Completions")),3)],8,U2)])])):ee("",!0)],512),[[uu,yo.value==="models"]]),Lt(p("div",null,[p("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:f[15]||(f[15]=N=>D.value=!D.value)},[p("span",B2,T(g(a)("Telegram")),1),p("span",q2,T($s.value),1)]),D.value?(S(),I("div",z2,[p("label",H2,[p("span",W2,T(g(a)("Bot token")),1),Lt(p("input",{"onUpdate:modelValue":f[16]||(f[16]=N=>Ce.value=N),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[an,Ce.value]])]),p("label",V2,[p("span",G2,T(g(a)("Allowed Telegram user IDs")),1),Lt(p("textarea",{"onUpdate:modelValue":f[17]||(f[17]=N=>st.value=N),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
|
|
86
|
+
987654321`,spellcheck:"false"},null,512),[[an,st.value]])]),p("div",K2,T(g(a)("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.")),1),Rt.value?(S(),I("div",Y2,[p("span",null,T(Rt.value),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[18]||(f[18]=N=>In(N,Rt.value))},T(g(a)("Send feedback")),9,J2)])):ee("",!0),p("div",Q2,[p("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:$o.value,onClick:Wc},T($o.value?g(a)("Saving…"):g(a)("Save Telegram config")),9,X2)])])):ee("",!0),p("div",Z2,[p("div",eD,[p("span",tD,T(g(a)("Hooks")),1),p("button",{class:"sidebar-settings-hooks-reload",type:"button",disabled:g(G),title:g(a)("Reload lifecycle hooks"),onClick:f[19]||(f[19]=N=>g($)({force:!0}))},T(g(G)?g(a)("Reloading…"):g(a)("Reload")),9,nD)]),Hi.value?(S(),I(ze,{key:1},[g(G)?(S(),I("p",rD,T(g(a)("Loading hooks…")),1)):g(O).length===0?(S(),I("p",aD,T(g(a)("No hooks registered.")),1)):(S(),I("div",sD,[(S(!0),I(ze,null,_t(g(O),N=>(S(),I("div",{key:N.cwd||"__global__",class:"sidebar-settings-hooks-entry"},[p("p",iD,T(N.cwd||g(a)("Global")),1),(S(!0),I(ze,null,_t(N.hooks,(Q,ve)=>(S(),I("div",{key:`${N.cwd}:${Q.event}:${ve}`,class:"sidebar-settings-hooks-item"},[p("span",{class:Ke(["sidebar-settings-hooks-state",{"is-on":Q.enabled!==!1}])},T(Q.enabled===!1?g(a)("Disabled"):g(a)("Enabled")),3),p("span",lD,T(Q.event),1),p("code",cD,T(Q.command),1)]))),128))]))),128))]))],64)):(S(),I("p",oD,T(g(a)("Hooks are not supported by this Codex version.")),1))]),p("div",uD,[p("div",dD,[p("span",fD,T(g(a)("Remote control")),1),p("button",{class:"sidebar-settings-remote-toggle",type:"button",disabled:eo.value||Ro.value,title:g(a)("Enable or disable remote control"),onClick:ui},[p("span",{class:Ke(["sidebar-settings-remote-toggle-track",{"is-on":ln.value.enabled}])},[...f[52]||(f[52]=[p("span",{class:"sidebar-settings-remote-toggle-thumb"},null,-1)])],2),p("span",hD,T(ln.value.enabled?g(a)("Enabled"):g(a)("Disabled")),1)],8,pD)]),ai.value?(S(),I(ze,{key:1},[Yo.value?(S(),I("p",vD,T(Yo.value),1)):ee("",!0),Cs.value?(S(),I("p",gD,T(Cs.value),1)):ee("",!0),Ro.value?(S(),I("p",yD,T(g(a)("Loading…")),1)):(S(),I(ze,{key:3},[p("button",{class:"sidebar-settings-remote-row",type:"button",disabled:!ln.value.enabled||eo.value,onClick:Vi},[p("span",bD,T(g(a)("Pair a new device")),1),p("span",kD,T(to.value==="pairing"?g(a)("Starting…"):(x=hn.value)!=null&&x.pairingCode?hn.value.pairingCode:g(a)("Generate code")),1)],8,wD),p("div",CD,[p("div",TD,[p("span",SD,T(g(a)("Paired devices")),1),p("button",{class:"sidebar-settings-remote-reload",type:"button",disabled:eo.value,onClick:Ss},T(to.value==="clients"?g(a)("Reloading…"):g(a)("Reload")),9,_D)]),ln.value.clients.length===0?(S(),I("p",xD,T(g(a)("No paired devices.")),1)):ee("",!0),(S(!0),I(ze,null,_t(ln.value.clients,N=>(S(),I("div",{key:N.clientId,class:"sidebar-settings-remote-client"},[p("span",AD,T(N.deviceName||N.clientId),1),p("button",{class:"sidebar-settings-remote-client-revoke",type:"button",disabled:eo.value,onClick:Q=>$l(N.clientId)},T(to.value===`revoke:${N.clientId}`?g(a)("Removing…"):g(a)("Revoke")),9,PD)]))),128))])],64))],64)):(S(),I("p",mD,T(g(a)("Remote control is not supported by this Codex version.")),1))])],512),[[uu,yo.value==="integrations"]]),Lt(p("div",null,[p("div",ID,[Ie(d$,{snapshots:g(He)},null,8,["snapshots"])]),p("div",{class:"sidebar-settings-build-label","aria-label":g(a)("Worktree name and version")}," WT "+T(g(v))+" · v"+T(g(y)),9,ED)],512),[[uu,yo.value==="usage"]])])])],8,AO)])):ee("",!0)])),p("div",RD,[p("button",{ref_key:"settingsButtonRef",ref:Jr,class:"sidebar-settings-icon-button",type:"button",title:g(a)("Settings"),"aria-label":g(a)("Settings"),onClick:lt(Ml,["stop"])},[Ie(KL,{class:"sidebar-settings-icon"})],8,MD),p("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:g(a)("Recycle bin"),"aria-label":g(a)("Recycle bin"),onClick:lt(Xw,["stop"])},[Ie(Ly,{class:"sidebar-settings-icon"})],8,$D)])],512))])]}),content:yt(()=>[p("div",jD,[p("section",{class:Ke(["content-root",{"is-virtual-keyboard-open":wd.value}]),style:kr(Oa.value)},[Ci.value?(S(),I("span",LD)):ee("",!0),Ie(lI,{title:vd.value,accent:gr.value||ts.value},{leading:yt(()=>[Bt.value||g(ht)?(S(),tt(ev,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Bt.value,"show-new-thread-button":!0,onToggleSidebar:f[22]||(f[22]=x=>Co(!Bt.value)),onStartNewThread:_d},null,8,["is-sidebar-collapsed"])):ee("",!0),gr.value?(S(),I("span",ND,[Ie(Ys)])):ts.value?(S(),I("span",OD,[Ie(Ys)])):ee("",!0)]),actions:yt(()=>[el.value?(S(),I("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":g(ht)?Mn.value?g(a)("Close side panel"):g(a)("Open side panel"):Io.value?g(a)("Open side panel"):g(a)("Close side panel"),title:g(ht)?Mn.value?g(a)("Close side panel"):g(a)("Open side panel"):Io.value?g(a)("Open side panel"):g(a)("Close side panel"),onClick:Gw},[Ie(Ny,{class:"content-header-right-panel-toggle-icon"})],8,DD)):ee("",!0)]),_:1},8,["title","accent"]),p("section",FD,[gr.value?(S(),tt(g(r),{key:0,ref_key:"directoryHubRef",ref:ir,cwd:Dc.value,"thread-id":es.value,"try-in-flight-key":cr.value,onSkillsChanged:js,onTryItem:l0},null,8,["cwd","thread-id","try-in-flight-key"])):ts.value?(S(),tt(g(s),{key:1,ref_key:"automationsPanelRef",ref:sr,groups:g(B),"project-cwd-by-name":Rp.value,"project-display-name-by-id":g(J),"selected-automation-id":Nc.value,onSelectAutomation:Ns,onEditAutomation:Jc,onCreateAutomation:Zy},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):Rn.value?(S(),I("div",UD,[p("div",BD,[p("p",qD,T(g(a)("Let's build")),1),Ie(or,{class:"new-thread-folder-dropdown","model-value":Ct.value,options:Vl.value,placeholder:g(a)("Choose folder"),"enable-search":!0,"search-placeholder":g(a)("Quick search project"),disabled:!1,"onUpdate:modelValue":tb},null,8,["model-value","options","placeholder","search-placeholder"]),Ct.value?(S(),I("p",{key:0,class:"new-thread-folder-selected",title:Ct.value},T(g(a)("Selected folder"))+": "+T(Ct.value),9,zD)):ee("",!0),p("div",HD,[p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:kb},T(g(a)("Select folder")),1),p("button",{class:"new-thread-folder-action",type:"button",onClick:ub},T(g(a)("Create Project")),1),p("button",{class:"new-thread-folder-action",type:"button",disabled:Is.value,onClick:gb},T(Is.value?g(a)("Importing…"):g(a)("Import Project")),9,WD),p("input",{ref_key:"projectImportInputRef",ref:jc,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:bb},null,544)]),xs.value?(S(),I("section",VD,[p("div",GD,[p("div",KD,[p("span",YD,[Ie(Ys)]),p("p",JD,T(g(a)("New in Codex")),1)]),p("h2",QD,T(g(a)("Plugins are here")),1),p("p",XD,T(g(a)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),f[53]||(f[53]=p("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[p("span",{class:"new-thread-launch-card-pill"},"Gmail"),p("span",{class:"new-thread-launch-card-pill"},"Calendar"),p("span",{class:"new-thread-launch-card-pill"},"GitHub"),p("span",{class:"new-thread-launch-card-pill"},"Slack"),p("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),p("div",ZD,[p("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Bc},T(g(a)("Explore Plugins & Apps")),1),p("button",{class:"new-thread-launch-card-button",type:"button",onClick:Uc},T(g(a)("Dismiss")),1)])])):ee("",!0),(S(),tt(Xs,{to:"body"},[$a.value?(S(),I("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:lt(db,["self"]),onMouseup:fb},[p("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":g(a)("Select folder"),onKeydown:An(lt(al,["prevent"]),["esc"])},[p("div",tF,[p("p",nF,T(g(a)("Select folder")),1),p("button",{class:"new-thread-open-folder-close",type:"button",onClick:al},T(g(a)("Cancel")),1)]),p("p",oF,T(g(a)("Current folder")),1),p("div",rF,[Lt(p("input",{ref_key:"existingFolderPathInputRef",ref:Lc,"onUpdate:modelValue":f[23]||(f[23]=x=>ja.value=x),class:"new-thread-open-folder-path",type:"text",placeholder:g(a)("Current folder"),title:ja.value||g(a)("Unavailable"),disabled:No.value||ko.value,onBlur:_b,onKeydown:[An(lt(xb,["prevent"]),["enter"]),An(lt(al,["prevent"]),["esc"])]},null,40,aF),[[an,ja.value]]),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!q.value||No.value||ko.value,onClick:f[24]||(f[24]=x=>Ed())},T(ko.value?g(a)("Opening…"):g(a)("Open")),9,sF)]),p("div",iF,[p("label",lF,[Lt(p("input",{"onUpdate:modelValue":f[25]||(f[25]=x=>vi.value=x),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Tb},null,544),[[Gg,vi.value]]),p("span",null,T(g(a)("Show hidden folders")),1)]),p("button",{class:Ke(["new-thread-folder-action",{"new-thread-folder-action-primary":Kt.value}]),type:"button","aria-pressed":Kt.value,disabled:!Or.value||No.value||ko.value||tr.value||!!Bn.value&&!Kt.value,onClick:Ab},T(g(a)("New folder")),11,cF)]),Kt.value?(S(),I("div",uF,[p("div",dF,[Lt(p("input",{ref_key:"createFolderInputRef",ref:Ka,"onUpdate:modelValue":f[26]||(f[26]=x=>Nn.value=x),class:"new-thread-open-folder-create-input",type:"text",placeholder:g(a)("Folder name"),onKeydown:[An(lt(Gp,["prevent"]),["enter"]),An(lt(Yl,["prevent"]),["esc"])]},null,40,fF),[[an,Nn.value]]),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!R.value||tr.value,onClick:Gp},T(Z.value),9,pF)]),bn.value?(S(),I("div",hF,[p("span",null,T(bn.value),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[27]||(f[27]=x=>In(x,bn.value))},T(g(a)("Send feedback")),9,mF)])):ee("",!0)])):ee("",!0),Lt(p("input",{ref_key:"existingFolderFilterInputRef",ref:md,"onUpdate:modelValue":f[28]||(f[28]=x=>Dr.value=x),class:"new-thread-open-folder-filter",type:"text",placeholder:g(a)("Filter folders..."),onKeydown:An(lt(al,["prevent"]),["esc"])},null,40,vF),[[an,Dr.value]]),Bn.value?(S(),I("div",gF,[p("div",yF,[p("span",null,T(Bn.value),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[29]||(f[29]=x=>In(x,Bn.value))},T(g(a)("Send feedback")),9,wF)]),p("button",{class:"new-thread-folder-action",type:"button",disabled:No.value||ko.value,onClick:Sb},T(g(a)("Retry")),9,bF)])):ee("",!0),No.value?(S(),I("p",kF,T(g(a)("Loading folders…")),1)):!Bn.value&&pt.value.length===0?(S(),I("p",CF,T(Dr.value.trim()?g(a)("No folders match this filter."):g(a)("No subfolders found here.")),1)):pt.value.length>0?(S(),I("ul",TF,[(S(!0),I(ze,null,_t(pt.value,x=>(S(),I("li",{key:x.key,class:"new-thread-open-folder-item"},[p("button",{class:"new-thread-open-folder-item-main",type:"button",title:x.path,disabled:No.value||ko.value,onClick:N=>Cb(x.path)},[p("span",_F,T(x.name),1)],8,SF),x.kind==="directory"?(S(),I("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:No.value||ko.value,onClick:N=>Ed(x.path)},T(g(a)("Open")),9,xF)):ee("",!0)]))),128))])):ee("",!0)],40,eF)],32)):ee("",!0)])),(S(),tt(Xs,{to:"body"},[Nr.value?(S(),I("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:lt(pb,["self"]),onMouseup:hb},[p("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":g(a)("Create or clone project"),onKeydown:An(lt(nu,["prevent"]),["esc"])},[p("div",PF,[p("p",IF,T(g(a)("Create or clone project")),1),p("button",{class:"new-thread-open-folder-close",type:"button",disabled:Lo.value,onClick:nu},T(g(a)("Cancel")),9,EF)]),p("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":g(a)("Project source")},[p("button",{class:Ke(["new-thread-project-mode-tab",{"is-active":jo.value==="create"}]),type:"button",role:"tab","aria-selected":jo.value==="create",disabled:Lo.value,onClick:f[30]||(f[30]=x=>jo.value="create")},T(g(a)("New project")),11,MF),p("button",{class:Ke(["new-thread-project-mode-tab",{"is-active":jo.value==="clone"}]),type:"button",role:"tab","aria-selected":jo.value==="clone",disabled:Lo.value,onClick:f[31]||(f[31]=x=>jo.value="clone")},T(g(a)("Clone from GitHub")),11,$F)],8,RF),p("label",jF,[p("span",LF,T(g(a)("Destination folder")),1),Lt(p("input",{"onUpdate:modelValue":f[32]||(f[32]=x=>Ps.value=x),class:"new-thread-open-folder-path",type:"text",disabled:Lo.value,placeholder:g(a)("Destination folder")},null,8,NF),[[an,Ps.value]])]),jo.value==="create"?(S(),I("label",OF,[p("span",DF,T(g(a)("Project name")),1),Lt(p("input",{ref_key:"projectSetupPrimaryInputRef",ref:Nl,"onUpdate:modelValue":f[33]||(f[33]=x=>hi.value=x),class:"new-thread-open-folder-create-input",type:"text",disabled:Lo.value,placeholder:g(a)("Project name"),onKeydown:An(lt(Id,["prevent"]),["enter"])},null,40,FF),[[an,hi.value]])])):jo.value==="clone"?(S(),I("label",UF,[p("span",BF,T(g(a)("GitHub repository URL")),1),Lt(p("input",{ref_key:"projectSetupPrimaryInputRef",ref:Nl,"onUpdate:modelValue":f[34]||(f[34]=x=>mi.value=x),class:"new-thread-open-folder-create-input",type:"url",disabled:Lo.value,placeholder:"https://github.com/owner/repo",onKeydown:An(lt(Id,["prevent"]),["enter"])},null,40,qF),[[an,mi.value]])])):ee("",!0),Ma.value?(S(),I("div",zF,[p("span",null,T(Ma.value),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[35]||(f[35]=x=>In(x,Ma.value))},T(g(a)("Send feedback")),9,HF)])):ee("",!0),p("div",WF,[p("button",{class:"new-thread-folder-action",type:"button",disabled:Lo.value,onClick:nu},T(g(a)("Cancel")),9,VF),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!L.value||Lo.value,onClick:Id},T(he.value),9,GF)])],40,AF)],32)):ee("",!0)])),ns.value?(S(),tt(v$,{key:2,class:"new-thread-runtime-dropdown",modelValue:Fn.value,"onUpdate:modelValue":f[36]||(f[36]=x=>Fn.value=x)},null,8,["modelValue"])):ee("",!0),Fn.value==="worktree"?(S(),I("div",KF,[p("p",YF,T(g(a)("Base branch")),1),Ie(or,{class:"new-thread-branch-dropdown","model-value":mo.value,options:i.value,placeholder:g(a)("Select branch"),"enable-search":!0,"search-placeholder":g(a)("Search branches..."),disabled:En.value||i.value.length===0,"onUpdate:modelValue":nb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),p("p",JF,T(En.value?g(a)("Loading branches…"):u.value?g(a)("New worktree branch will start from {branch}.",{branch:u.value}):g(a)("No Git branches found for this folder.")),1)])):ee("",!0),ns.value?(S(),I("p",QF,T(g(a)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ee("",!0),yn.value.phase!=="idle"?(S(),I("div",{key:5,class:Ke(["worktree-init-status",{"is-running":yn.value.phase==="running","is-error":yn.value.phase==="error"}])},[p("strong",XF,T(yn.value.title),1),p("span",ZF,T(yn.value.message),1)],2)):ee("",!0)]),p("div",eU,[g(Ue)?(S(),I("div",tU,[p("span",null,T(g(a)(g(Ue))),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[37]||(f[37]=x=>In(x,g(Ue)))},T(g(a)("Send feedback")),9,nU)])):ee("",!0),Ie(Zm,{ref_key:"homeThreadComposerRef",ref:Gr,"active-thread-id":yr.value,cwd:mn.value,"fuzzy-file-search-results":g(ge),onRegisterFuzzySession:g(Fe),"collaboration-modes":g(Le),"selected-collaboration-mode":g(Te),models:g(je),"model-reasoning-efforts":g(fe),"selected-model":Ms.value,"selected-reasoning-effort":g(xe),"selected-speed-mode":g(Ae),"is-updating-speed-mode":g(te),skills:g(Ye),"thread-token-usage":g(U),"codex-quota":g($e),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":ta.value,"in-progress-submit-mode":Ea.value,"dictation-click-to-toggle":Zo.value,"dictation-auto-send":oa.value,"dictation-language":Ra.value,onSubmit:zp,"onUpdate:selectedCollaborationMode":rh,"onUpdate:selectedModel":Qp,"onUpdate:selectedReasoningEffort":Xp,"onUpdate:selectedSpeedMode":Zp,"approval-policy":Zt.value,"is-approval-policy-saving":Ts.value,"approval-policy-error":no.value,"approval-policy-notice":dr.value,"onUpdate:approvalPolicy":_a,onSaveApprovalPolicy:$n,onSlashCommand:eh},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"])])])):(S(),I("div",oU,[Gn.value&&g(de)&&mn.value?(S(),tt(g(o),{key:0,"thread-id":g(de),cwd:mn.value,"is-thread-in-progress":Ti.value,"initial-file-path":Ir.value,"commit-sha":Xr.value,onClose:f[38]||(f[38]=x=>Gn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(S(),I(ze,{key:1},[p("div",rU,[Ie(g(t),{ref_key:"threadConversationRef",ref:ka,messages:ki.value,"is-loading":g(ft),"active-thread-id":yr.value,cwd:mn.value,"live-overlay":gd.value,"live-turn-id":g(we),"pending-requests":g(V),"has-more-persisted-above":g(ct),"is-loading-persisted-above":g(mt),"load-earlier-messages":g(be),onForkThread:zw,onRollback:Mb,onFileChangesChanged:qc,onRespondServerRequest:Lp},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"])]),p("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:nn},[Fc.value?(S(),I("div",aU,T(g(a)("This thread is running in the Codex TUI")),1)):ee("",!0),g(Ue)?(S(),I("div",sU,[p("span",null,T(g(a)(g(Ue))),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[39]||(f[39]=x=>In(x,g(Ue)))},T(g(a)("Send feedback")),9,iU)])):ee("",!0),Ie(n$,{messages:g(W),onEdit:eb,onSteer:g(Oe),onDelete:g(Y),onReorder:Eb},null,8,["messages","onSteer","onDelete"]),Jl.value?(S(),I("div",lU,[p("span",null,T(Jl.value),1),p("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":g(a)("Dismiss"),onClick:f[40]||(f[40]=x=>Jl.value="")}," × ",8,cU)])):ee("",!0),Zi.value?(S(),tt(HM,{key:3,request:Zi.value,"request-count":g(V).length,"has-queue-above":g(W).length>0,"panel-width":Kr.value,"visual-viewport-height":Ci.value?La.value:0,"panel-error":zl.value,onRespondServerRequest:Lp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(S(),tt(Zm,{key:4,ref_key:"threadComposerRef",ref:Ao,"active-thread-id":yr.value,cwd:mn.value,"fuzzy-file-search-results":g(ge),onRegisterFuzzySession:g(Fe),"collaboration-modes":g(Le),"selected-collaboration-mode":g(Te),models:g(je),"model-reasoning-efforts":g(fe),"selected-model":Ms.value,"selected-reasoning-effort":g(xe),"selected-speed-mode":g(Ae),"is-updating-speed-mode":g(te),skills:g(Ye),"thread-token-usage":g(U),"codex-quota":g($e),"is-turn-in-progress":Ti.value,"is-stop-pending":g(ae),"is-interrupting-turn":g(at),"is-compacting":Ur.value,"external-session-active":Fc.value,"has-queue-above":g(W).length>0,"send-with-enter":ta.value,"in-progress-submit-mode":Ea.value,"dictation-click-to-toggle":Zo.value,"dictation-auto-send":oa.value,"dictation-language":Ra.value,"onUpdate:selectedCollaborationMode":rh,onSubmit:zp,"onUpdate:selectedModel":Qp,"onUpdate:selectedReasoningEffort":Xp,"onUpdate:selectedSpeedMode":Zp,"approval-policy":Zt.value,"is-approval-policy-saving":Ts.value,"approval-policy-error":no.value,"approval-policy-notice":dr.value,"onUpdate:approvalPolicy":_a,onSaveApprovalPolicy:$n,"plan-panel":ql.value,onInterrupt:Rb,onSlashCommand:eh,onImplementPlan:$b,onCompactContext:bd},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),g(ht)&&Mn.value?(S(),I("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:Dp})):ee("",!0),el.value&&(g(ht)||!Io.value)?(S(),I("aside",{key:1,class:Ke(["content-right-panel",{"is-mobile-open":Mn.value}]),style:kr({"--right-panel-width":`${ho.value}px`})},[g(ht)?ee("",!0):(S(),I("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:Wo},null,32)),p("div",uU,[p("div",dU,[p("button",{class:Ke(["content-right-panel-tab",{"is-active":$t.value==="git"}]),type:"button",role:"tab","aria-selected":$t.value==="git",onClick:f[41]||(f[41]=x=>_i("git"))},[Ie(Gu,{class:"content-right-panel-tab-icon"}),ps(" "+T(g(a)("Git")),1)],10,fU),p("button",{class:Ke(["content-right-panel-tab",{"is-active":$t.value==="files"}]),type:"button",role:"tab","aria-selected":$t.value==="files",onClick:f[42]||(f[42]=x=>_i("files"))},[Ie(nv,{class:"content-right-panel-tab-icon"}),ps(" "+T(g(a)("Files")),1)],10,pU),(S(!0),I(ze,null,_t(zn.value,x=>(S(),I("button",{key:x.key,class:Ke(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":$t.value==="preview"&&po.value===x.key}]),type:"button",role:"tab","aria-selected":$t.value==="preview"&&po.value===x.key,title:x.path,onClick:N=>Ww(x.key)},[Ie(Bi,{class:"content-right-panel-tab-icon"}),p("span",mU,T(x.label),1),p("span",{class:"content-right-panel-tab-close",role:"button","aria-label":g(a)("Close"),title:g(a)("Close"),onClick:lt(N=>Vw(x.key),["stop"])},"×",8,vU)],10,hU))),128))]),p("div",gU,[p("div",yU,[p("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":g(a)("Add panel"),title:g(a)("Add panel"),onClick:f[43]||(f[43]=lt(x=>Xn.value=!Xn.value,["stop"]))},"+",8,wU),Ie(Mc,{name:"right-panel-menu"},{default:yt(()=>[Xn.value?(S(),I("div",bU,[p("button",{type:"button",onClick:f[44]||(f[44]=x=>_i("terminal"))},[Ie(XL,{class:"content-right-panel-menu-icon"}),ps(" "+T(g(a)("Terminal panel")),1)]),p("button",{type:"button",onClick:f[45]||(f[45]=x=>_i("git"))},[Ie(Gu,{class:"content-right-panel-menu-icon"}),ps(" "+T(g(a)("Git panel")),1)]),p("button",{type:"button",onClick:f[46]||(f[46]=x=>_i("files"))},[Ie(nv,{class:"content-right-panel-menu-icon"}),ps(" "+T(g(a)("Files panel")),1)])])):ee("",!0)]),_:1})]),p("button",{class:"content-right-panel-close",type:"button","aria-label":g(a)("Close panel"),title:g(a)("Close panel"),onClick:Dp},[Ie(Ru,{class:"content-right-panel-close-icon"})],8,kU)])]),p("div",CU,[$t.value==="git"?(S(),tt(uL,{key:0,"current-branch":Zr.value,"head-sha":xa.value,"head-subject":hr.value,"head-date":Aa.value,detached:Mo.value,dirty:Ga.value,"worktree-change-summary":Er.value,"worktree-changes":wo.value,branches:pr.value,"commits-by-branch":qe.value,"commits-loading-for":ke.value,"commits-error":Un.value,"commit-files-by-sha":Pa.value,"commit-files-loading-for":mr.value,"commit-files-error":_s.value,loading:cn.value,busy:ea.value,error:Rr.value,"review-open":Gn.value,"show-review":g(Et).name==="thread"&&g(de).length>0,onToggleReview:lb,onCheckoutBranch:rb,onResetBranchToCommit:ab,onLoadCommits:Vp,onLoadCommitFiles:sb,onOpenCommitFile:ib},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"])):$t.value==="files"?(S(),tt(_L,{key:1,cwd:mn.value,onOpenPreview:Hw},null,8,["cwd"])):$t.value==="preview"&&Hn.value?(S(),tt(BL,{key:2,"file-path":Hn.value.path,name:Hn.value.label},null,8,["file-path","name"])):(S(),tt(g(n),{key:3,ref_key:"threadTerminalPanelRef",ref:Jn,"thread-id":yr.value,cwd:mn.value,onHide:Kw,onTerminalFocusChange:Yw},null,8,["thread-id","cwd"]))])],6)):ee("",!0)])]),_:1},8,["is-sidebar-collapsed"]),xt.value.phase!=="idle"?(S(),I("div",TU,[p("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":g(a)("Export Project"),onClick:f[48]||(f[48]=lt(()=>{},["stop"]))},[p("div",_U,[p("h2",xU,T(g(a)("Export Project")),1),p("button",{class:"project-zip-modal-close",type:"button","aria-label":g(a)("Close"),disabled:xt.value.phase==="exporting",onClick:$p}," × ",8,AU)]),p("p",PU,T(xt.value.phase==="exporting"?g(a)("Preparing project ZIP..."):xt.value.fileName),1),p("div",IU,[p("span",null,T(xt.value.phase==="exporting"?g(a)("Exporting"):g(a)("Ready")),1),p("span",null,T(Ll.value),1)]),p("div",EU,[p("div",{class:"project-zip-progress-fill",style:kr({width:pi.value})},null,4)]),xt.value.error?(S(),I("p",RU,T(xt.value.error),1)):ee("",!0),p("div",MU,[p("button",{class:"project-zip-modal-cancel",type:"button",disabled:xt.value.phase==="exporting",onClick:$p},T(g(a)("Close")),9,$U),p("button",{class:"project-zip-modal-action",type:"button",disabled:!xt.value.blob,onClick:Mw},T(g(a)("Download")),9,jU),p("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!xt.value.blob,onClick:$w},T(g(a)("Share")),9,LU)])],8,SU)])):ee("",!0),Ya.value?(S(),I("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Sd},[p("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":g(a)("Complete Codex login"),onSubmit:lt(vw,["prevent"]),onClick:f[51]||(f[51]=lt(()=>{},["stop"]))},[p("div",OU,[p("h2",DU,T(g(a)("Complete Codex login")),1),p("button",{class:"codex-login-modal-close",type:"button","aria-label":g(a)("Close"),disabled:Ln.value,onClick:Sd}," × ",8,FU)]),p("p",UU,T(g(a)("Finish login in the browser, then paste the localhost callback URL here.")),1),Ia.value?(S(),I("a",{key:0,class:"codex-login-modal-link",href:Ia.value,target:"_blank",rel:"noreferrer"},T(g(a)("Open login URL")),9,BU)):ee("",!0),Lt(p("input",{ref_key:"codexLoginCallbackInputRef",ref:fi,"onUpdate:modelValue":f[49]||(f[49]=x=>$r.value=x),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:g(a)("Paste localhost callback URL"),disabled:Ln.value},null,8,qU),[[an,$r.value]]),wn.value?(S(),I("div",zU,[p("span",null,T(wn.value),1),p("a",{class:"visible-error-feedback",href:g(Dn),onClick:f[50]||(f[50]=x=>In(x,wn.value))},T(g(a)("Send feedback")),9,HU)])):ee("",!0),p("div",WU,[p("button",{class:"codex-login-modal-cancel",type:"button",disabled:Ln.value,onClick:Sd},T(g(a)("Cancel")),9,VU),p("button",{class:"codex-login-modal-submit",type:"submit",disabled:Ln.value||$r.value.trim().length===0},T(Ln.value?g(a)("Completing…"):g(a)("Complete")),9,GU)])],40,NU)])):ee("",!0)],64))}}),ZU=bt(XU,[["__scopeId","data-v-de87fe36"]]),xu={render:()=>null},eB=JT({history:PT(),routes:[{path:"/",name:"home",component:xu},{path:"/thread/:threadId",name:"thread",component:xu},{path:"/skills",name:"skills",component:xu},{path:"/automations",name:"automations",component:xu},{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");b1();FC(ZU).use(eB).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Iy("Service worker registration failed."),e)})});export{An as $,mu as A,yp as B,Wt as C,ov as D,nB as E,ze as F,cp as G,hI as H,Ru as I,nc as J,ej as K,O_ as L,HN as M,ws as N,C_ as O,fB as P,uB as Q,pB as R,dB as S,Xs as T,hB as U,or as V,RB as W,$B as X,MB as Y,tB as Z,bt as _,I as a,_p as a0,Lt as a1,an as a2,XT as a3,QT as a4,s_ as a5,mB as a6,oB as a7,rB as a8,aB as a9,bB as aa,_B as ab,xB as ac,vB as ad,SB as ae,iB as af,sB as ag,lB as ah,cB as ai,AB as aj,IB as ak,EB as al,gB as am,yB as an,wB as ao,kB as ap,TB as aq,CB as ar,PB as as,g_ as at,y_ as au,Ys as av,xI as aw,p as b,tt as c,tn as d,ee as e,ps as f,Ie as g,Mc as h,yt as i,io as j,X as k,nt as l,qi as m,Ke as n,S as o,kr as p,A as q,_t as r,Oy as s,T as t,g as u,xp as v,lt as w,Gu as x,rr as y,Js as z};
|