codex-mobile-re 0.1.102 → 0.1.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/LICENSE +11 -11
  2. package/README.md +214 -214
  3. package/dist/assets/{AutomationsPanel-ulx5N8pM.css → AutomationsPanel-BBeoQ-Fx.css} +1 -1
  4. package/dist/assets/{AutomationsPanel-BZ73-GJE.js → AutomationsPanel-CnK1Yuru.js} +1 -1
  5. package/dist/assets/{DirectoryHub-DWtUbt5I.js → DirectoryHub-BunsdSMs.js} +2 -2
  6. package/dist/assets/{DirectoryHub-BOBZNd77.css → DirectoryHub-Ce5pFnd0.css} +1 -1
  7. package/dist/assets/{ReviewPane-Cd7kjB6d.js → ReviewPane-C02hbV2G.js} +1 -1
  8. package/dist/assets/{ReviewPane-B8ZRIB5L.css → ReviewPane-CyX0PWor.css} +1 -1
  9. package/dist/assets/{ThreadConversation-BFAPAWUd.js → ThreadConversation-BS09bMfR.js} +5 -5
  10. package/dist/assets/{ThreadConversation-Db8A09JM.css → ThreadConversation-D0SQKKN2.css} +1 -1
  11. package/dist/assets/{ThreadTerminalPanel-O7IxAyfy.css → ThreadTerminalPanel-BHXovq7A.css} +1 -1
  12. package/dist/assets/{ThreadTerminalPanel-C0cuIPzx.js → ThreadTerminalPanel-juDCK2c0.js} +2 -2
  13. package/dist/assets/index-DDchNpQh.js +87 -0
  14. package/dist/assets/{index-bLpg1m_q.css → index-DM1MDzKD.css} +1 -1
  15. package/dist/assets/{index.esm-Cxn_LBGD.js → index.esm-Cls06s1L.js} +1 -1
  16. package/dist/icons/codexui-icon.svg +52 -52
  17. package/dist/icons/pwa-icon.svg +38 -38
  18. package/dist/icons/pwa-maskable.svg +36 -36
  19. package/dist/index.html +21 -21
  20. package/dist/manifest.webmanifest +36 -36
  21. package/dist/sw.js +92 -92
  22. package/dist-cli/index.js +0 -0
  23. package/dist-cli/index.js.map +1 -1
  24. package/package.json +94 -94
  25. package/scripts/dev-random-home.cjs +21 -21
  26. package/scripts/dev.cjs +69 -69
  27. package/scripts/fix-pty-native-build.cjs +70 -70
  28. package/dist/assets/index-BALsV_-J.js +0 -86
@@ -0,0 +1,87 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-BS09bMfR.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-D0SQKKN2.css","assets/ThreadTerminalPanel-juDCK2c0.js","assets/ThreadTerminalPanel-BHXovq7A.css","assets/ReviewPane-C02hbV2G.js","assets/ReviewPane-CyX0PWor.css","assets/DirectoryHub-BunsdSMs.js","assets/DirectoryHub-Ce5pFnd0.css","assets/AutomationsPanel-CnK1Yuru.js","assets/AutomationsPanel-BBeoQ-Fx.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.41
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/function ep(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const en={},yl=[],qa=()=>{},Lv=()=>!1,Zu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ed=e=>e.startsWith("onUpdate:"),On=Object.assign,tp=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},d0=Object.prototype.hasOwnProperty,Ht=(e,t)=>d0.call(e,t),dt=Array.isArray,wl=e=>xc(e)==="[object Map]",td=e=>xc(e)==="[object Set]",fh=e=>xc(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",Nv=e=>(Vt(e)||wt(e))&&wt(e.then)&&wt(e.catch),Ov=Object.prototype.toString,xc=e=>Ov.call(e),f0=e=>xc(e).slice(8,-1),Dv=e=>xc(e)==="[object Object]",np=e=>un(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,cc=ep(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),nd=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},p0=/-\w/g,qo=nd(e=>e.replace(p0,t=>t.slice(1).toUpperCase())),h0=/\B([A-Z])/g,ni=nd(e=>e.replace(h0,"-$1").toLowerCase()),od=nd(e=>e.charAt(0).toUpperCase()+e.slice(1)),qd=nd(e=>e?`on${od(e)}`:""),ua=(e,t)=>!Object.is(e,t),Iu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Fv=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},op=e=>{const t=parseFloat(e);return isNaN(t)?e:t},m0=e=>{const t=un(e)?Number(e):NaN;return isNaN(t)?e:t};let ph;const rd=()=>ph||(ph=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)?w0(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 v0=/;(?![^(]*\))/g,g0=/:([^]+)/,y0=/\/\*[^]*?\*\//g;function w0(e){const t={};return e.replace(y0,"").split(v0).forEach(n=>{if(n){const o=n.split(g0);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 b0="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",k0=ep(b0);function Uv(e){return!!e||e===""}function C0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=Ac(e[o],t[o]);return n}function Ac(e,t){if(e===t)return!0;let n=fh(e),o=fh(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?C0(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||!Ac(e[a],t[a]))return!1}}return String(e)===String(t)}function Bv(e,t){return e.findIndex(n=>Ac(n,t))}const qv=e=>!!(e&&e.__v_isRef===!0),T=e=>un(e)?e:e==null?"":dt(e)||Vt(e)&&(e.toString===Ov||!wt(e.toString))?qv(e)?T(e.value):JSON.stringify(e,zv,2):String(e),zv=(e,t)=>qv(t)?zv(e,t.value):wl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],s)=>(n[zd(o,s)+" =>"]=r,n),{})}:td(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>zd(n))}:va(t)?zd(t):Vt(t)&&!dt(t)&&!Dv(t)?String(t):t,zd=(e,t="")=>{var n;return va(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
+ * @vue/reactivity v3.5.41
8
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
+ * @license MIT
10
+ **/let ro;class T0{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 S0(){return ro}let rn;const Hd=new WeakSet;class Hv{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,Hd.has(this)&&(Hd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Vv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,hh(this),Gv(this);const t=rn,n=pa;rn=this,pa=!0;try{return this.fn()}finally{Kv(this),rn=t,pa=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)sp(t);this.deps=this.depsTail=void 0,hh(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Hd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Cf(this)&&this.run()}get dirty(){return Cf(this)}}let Wv=0,uc,dc;function Vv(e,t=!1){if(e.flags|=8,t){e.next=dc,dc=e;return}e.next=uc,uc=e}function rp(){Wv++}function ap(){if(--Wv>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 Gv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Kv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),sp(o),_0(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function Cf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Yv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Yv(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||!Cf(e))))return;e.flags|=2;const t=e.dep,n=rn,o=pa;rn=e,pa=!0;try{Gv(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,Kv(e),e.flags&=-3}}function sp(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)sp(s,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function _0(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 Jv=[];function vs(){Jv.push(pa),pa=!1}function gs(){const e=Jv.pop();pa=e===void 0?!0:e}function hh(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 x0{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 ip{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 x0(rn,this),rn.deps?(n.prevDep=rn.depsTail,rn.depsTail.nextDep=n,rn.depsTail=n):rn.deps=rn.depsTail=n,Qv(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){rp();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ap()}}}function Qv(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)Qv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Tf=new WeakMap,Ui=Symbol(""),Sf=Symbol(""),yc=Symbol("");function So(e,t,n){if(pa&&rn){let o=Tf.get(e);o||Tf.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new ip),r.map=o,r.key=n),r.track()}}function ds(e,t,n,o,r,s){const a=Tf.get(e);if(!a){gc++;return}const l=d=>{d&&d.trigger()};if(rp(),t==="clear")a.forEach(l);else{const d=dt(e),h=d&&np(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(Ui)),wl(e)&&l(a.get(Sf)));break;case"delete":d||(l(a.get(Ui)),wl(e)&&l(a.get(Sf)));break;case"set":wl(e)&&l(a.get(Ui));break}}ap()}function ll(e){const t=Dt(e);return t===e?t:(So(t,"iterate",yc),zr(e)?t:t.map(ga))}function ad(e){return So(e=Dt(e),"iterate",yc),e}function Ua(e,t){return ys(e)?_l(Bi(e)?ga(t):t):ga(t)}const A0={__proto__:null,[Symbol.iterator](){return Wd(this,Symbol.iterator,e=>Ua(this,e))},concat(...e){return ll(this).concat(...e.map(t=>dt(t)?ll(t):t))},entries(){return Wd(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 Vd(this,"includes",e)},indexOf(...e){return Vd(this,"indexOf",e)},join(e){return ll(this).join(e)},lastIndexOf(...e){return Vd(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 mh(this,"reduce",e,t)},reduceRight(e,...t){return mh(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 ll(this).toReversed()},toSorted(e){return ll(this).toSorted(e)},toSpliced(...e){return ll(this).toSpliced(...e)},unshift(...e){return Ql(this,"unshift",e)},values(){return Wd(this,"values",e=>Ua(this,e))}};function Wd(e,t,n){const o=ad(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 P0=Array.prototype;function rs(e,t,n,o,r,s){const a=ad(e),l=a!==e&&!zr(e),d=a[t];if(d!==P0[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 mh(e,t,n,o){const r=ad(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 Vd(e,t,n){const o=Dt(e);So(o,"iterate",yc);const r=o[t](...n);return(r===-1||r===!1)&&up(n[0])?(n[0]=Dt(n[0]),o[t](...n)):r}function Ql(e,t,n=[]){vs(),rp();const o=Dt(e)[t].apply(e,n);return ap(),gs(),o}const I0=ep("__proto__,__v_isRef,__isVue"),Xv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(va));function E0(e){va(e)||(e=String(e));const t=Dt(this);return So(t,"has",e),t.hasOwnProperty(e)}class Zv{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?U0:og:s?ng:tg).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const a=dt(t);if(!r){let d;if(a&&(d=A0[n]))return d;if(n==="hasOwnProperty")return E0}const l=Reflect.get(t,n,xo(t)?t:o);if((va(n)?Xv.has(n):I0(n))||(r||So(t,"get",n),s))return l;if(xo(l)){const d=a&&np(n)?l:l.value;return r&&Vt(d)?xf(d):d}return Vt(l)?r?xf(l):sd(l):l}}class eg extends Zv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let s=t[n];const a=dt(t)&&np(n);if(!this._isShallow){const h=ys(s);if(!zr(o)&&!ys(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)||!Xv.has(n))&&So(t,"has",n),o}ownKeys(t){return So(t,"iterate",dt(t)?"length":Ui),Reflect.ownKeys(t)}}class R0 extends Zv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const M0=new eg,$0=new R0,j0=new eg(!0);const _f=e=>e,su=e=>Reflect.getPrototypeOf(e);function L0(e,t,n){return function(...o){const r=this.__v_raw,s=Dt(r),a=wl(s),l=e==="entries"||e===Symbol.iterator&&a,d=e==="keys"&&a,h=r[e](...o),v=n?_f:t?_l:ga;return!t&&So(s,"iterate",d?Sf:Ui),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 iu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function N0(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}=su(a),h=t?_f:e?_l: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",Ui),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?_f:e?_l:ga;return!e&&So(d,"iterate",Ui),l.forEach((v,y)=>r.call(s,h(v),h(y),a))}};return On(n,e?{add:iu("add"),set:iu("set"),delete:iu("delete"),clear:iu("clear")}:{add(r){const s=Dt(this),a=su(s),l=Dt(r),d=!t&&!zr(r)&&!ys(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)&&!ys(s)&&(s=Dt(s));const a=Dt(this),{has:l,get:d}=su(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}=su(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]=L0(r,e,t)}),n}function lp(e,t){const n=N0(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 O0={get:lp(!1,!1)},D0={get:lp(!1,!0)},F0={get:lp(!0,!1)};const tg=new WeakMap,ng=new WeakMap,og=new WeakMap,U0=new WeakMap;function B0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function sd(e){return ys(e)?e:cp(e,!1,M0,O0,tg)}function rg(e){return cp(e,!1,j0,D0,ng)}function xf(e){return cp(e,!0,$0,F0,og)}function cp(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=B0(f0(e));if(a===0)return e;const l=new Proxy(e,a===2?o:n);return r.set(e,l),l}function Bi(e){return ys(e)?Bi(e.__v_raw):!!(e&&e.__v_isReactive)}function ys(e){return!!(e&&e.__v_isReadonly)}function zr(e){return!!(e&&e.__v_isShallow)}function up(e){return e?!!e.__v_raw:!1}function Dt(e){const t=e&&e.__v_raw;return t?Dt(t):e}function q0(e){return!Ht(e,"__v_skip")&&Object.isExtensible(e)&&Fv(e,"__v_skip",!0),e}const ga=e=>Vt(e)?sd(e):e,_l=e=>Vt(e)?xf(e):e;function xo(e){return e?e.__v_isRef===!0:!1}function A(e){return ag(e,!1)}function z0(e){return ag(e,!0)}function ag(e,t){return xo(e)?e:new H0(e,t)}class H0{constructor(t,n){this.dep=new ip,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)||ys(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 W0={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 sg(e){return Bi(e)?e:new Proxy(e,W0)}class V0{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ip(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 Vv(this,!0),!0}get value(){const t=this.dep.track();return Yv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function G0(e,t,n=!1){let o,r;return wt(e)?o=e:(o=e.get,r=e.set),new V0(o,r,n)}const lu={},Ou=new WeakMap;let Mi;function K0(e,t=!1,n=Mi){if(n){let o=Ou.get(n);o||Ou.set(n,o=[]),o.push(e)}}function Y0(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)):Bi(e)?(y=()=>h(e),j=!0):dt(e)?(B=!0,j=e.some(K=>Bi(K)||zr(K)),y=()=>e.map(K=>{if(xo(K))return K.value;if(Bi(K))return h(K);if(wt(K))return d?d(K,2):K()})):wt(e)?t?y=d?()=>d(e,2):e:y=()=>{if(_){vs();try{_()}finally{gs()}}const K=Mi;Mi=v;try{return d?d(e,3,[P]):e(P)}finally{Mi=K}}:y=qa,t&&r){const K=y,ye=r===!0?1/0:r;y=()=>fs(K(),ye)}const J=S0(),ce=()=>{v.stop(),J&&J.active&&tp(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(lu):lu;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=Mi;Mi=v;try{const we=[ye,U===lu?void 0:B&&U[0]===lu?[]:U,P];U=ye,d?d(t,3,we):t(...we)}finally{Mi=_e}}}else v.run()};return l&&l(V),v=new Hv(y),v.scheduler=a?()=>a(V,!1):V,P=K=>K0(K,!1,v),_=v.onStop=()=>{const K=Ou.get(v);if(K){if(d)d(K,4);else for(const ye of K)ye();Ou.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(td(e)||wl(e))e.forEach(o=>{fs(o,t,n)});else if(Dv(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.41
12
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
+ * @license MIT
14
+ **/function Pc(e,t,n,o){try{return o?e(...o):e()}catch(r){Ic(r,t,n)}}function Wr(e,t,n,o){if(wt(e)){const r=Pc(e,t,n,o);return r&&Nv(r)&&r.catch(s=>{Ic(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 Ic(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){vs(),Pc(s,null,10,[e,d,h]),gs();return}}J0(e,n,r,o,a)}function J0(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const Uo=[];let Fa=-1;const bl=[];let Ks=null,pl=0;const ig=Promise.resolve();let Du=null;function Wt(e){const t=Du||ig;return e?t.then(this?e.bind(this):e):t}function Q0(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 dp(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(Q0(t),0,e),e.flags|=1,lg()}}function lg(){Du||(Du=ig.then(ug))}function X0(e){if(!dt(e))Ks&&e.id===-1?Ks.splice(pl+1,0,e):e.flags&1||(bl.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)bl.push(e[t]);lg()}function vh(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 cg(e){if(bl.length){const t=[...new Set(bl)].sort((n,o)=>wc(n)-wc(o));if(bl.length=0,Ks){for(let n=0;n<t.length;n++)Ks.push(t[n]);return}for(Ks=t,pl=0;pl<Ks.length;pl++){const n=Ks[pl];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ks=null,pl=0}}const wc=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ug(e){try{for(Fa=0;Fa<Uo.length;Fa++){const t=Uo[Fa];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Pc(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,cg(),Du=null,(Uo.length||bl.length)&&ug()}}let so=null,dg=null;function Fu(e){const t=so;return so=e,dg=e&&e.type.__scopeId||null,t}function yt(e,t=so,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&zu(-1);const s=Fu(t),a=ms.length;let l;try{l=e(...r)}finally{for(let d=ms.length;d>a;d--)gp();Fu(s),o._d&&zu(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=dd(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 Pi(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&&(vs(),Wr(d,n,8,[e.el,l,e,t]),gs())}}function Eu(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=yp();if(o||Cl){let r=Cl?Cl._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 Z0=Symbol.for("v-scx"),ek=()=>ha(Z0);function nt(e,t,n){return fg(e,t,n)}function fg(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(Al){if(s==="sync"){const P=ek();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():dp(P)}),l.augmentJob=P=>{t&&(P.flags|=4),y&&(P.flags|=2,v&&(P.id=v.uid,P.i=v))};const _=Y0(e,t,l);return Al&&(h?h.push(_):d&&_()),_}function tk(e,t,n){const o=this.proxy,r=un(e)?e.includes(".")?pg(o,e):()=>o[e]:e.bind(o,o);let s;wt(t)?s=t:(s=t.handler,n=t);const a=Mc(this),l=fg(r,s.bind(o),n);return a(),l}function pg(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 Ws=new WeakMap,hg=Symbol("_vte"),id=e=>e.__isTeleport,ji=e=>e&&(e.disabled||e.disabled===""),nk=e=>e&&(e.defer||e.defer===""),gh=e=>typeof SVGElement<"u"&&e instanceof SVGElement,yh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Af=(e,t)=>{const n=e&&e.to;return un(n)?t?t(n):null:n},ok={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=ji(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=ji(we.props),de=we.target=Af(we.props,j),Le=Pf(de,we,B,P);de&&(a!=="svg"&&gh(de)?a="svg":a!=="mathml"&&yh(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(Ws.get(we)===$e){if(Ws.delete(we),ji(we.props)){const de=ce(we.el)||n;K(we,de,we.anchor),ac(we,!0)}ye(we)}};Ws.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),nk(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=Ws.get(e);if($e){$e.flags|=8,Ws.delete(e),_e(t);return}t.targetStart=e.targetStart;const de=t.target=e.target,Le=t.targetAnchor=e.targetAnchor,je=ji(e.props),fe=je?n:de,Te=je?we:Le;if(a==="svg"||gh(de)?a="svg":(a==="mathml"||yh(de))&&(a="mathml"),V?(_(e.dynamicChildren,V,fe,r,s,a,l),vp(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):cu(t,n,we,h,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const xe=Af(t.props,j);xe&&(t.target=xe,cu(t,xe,null,h,0))}else je&&cu(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=ji(_),j=s||!P,B=Ws.get(e);if(B&&(B.flags|=8,Ws.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:cu,hydrate:rk};function cu(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),!Ws.has(e)&&(!y||ji(v))&&d&16)for(let _=0;_<h.length;_++)r(h[_],t,n,2);y&&o(l,t,n)}function rk(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=Af(t.props,d),B=ji(t.props);if(j){const J=j._lpa||j.firstChild;t.shapeFlag&16&&(B?(P(e,t),_(j,J),t.targetAnchor||Pf(j,t,v,h,l(e)===j?e:null)):(t.anchor=a(e),_(j,J),t.targetAnchor||Pf(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 Zs=ok;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 Pf(e,t,n,o,r=null){const s=t.targetStart=n(""),a=t.targetAnchor=n("");return s[hg]=a,e&&(o(s,e,r),o(a,e,r)),a}const qr=Symbol("_leaveCb"),Xl=Symbol("_enterCb");function ak(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return bs(()=>{e.isMounted=!0}),Hi(()=>{e.isUnmounting=!0}),e}const Br=[Function,Array],mg={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},vg=e=>{const t=e.subTree;return t.component?vg(t.component):t},sk={name:"BaseTransition",props:mg,setup(e,{slots:t}){const n=yp(),o=ak();return()=>{const r=t.default&&wg(t.default(),!0),s=r&&r.length?gg(r):n.subTree?ee():void 0;if(!s)return;const a=Dt(e),{mode:l}=a;if(o.isLeaving)return Gd(s);const d=Uu(s);if(!d)return Gd(s);let h=If(d,a,o,n,y=>h=y);d.type!==_o&&bc(d,h);let v=n.subTree&&Uu(n.subTree);if(v&&v.type!==_o&&!Li(v,d)&&vg(n).type!==_o){let y=If(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},Gd(s);l==="in-out"&&d.type!==_o?y.delayLeave=(_,P,j)=>{const B=yg(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 gg(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==_o){t=n;break}}return t}const ik=sk;function yg(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 If(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=yg(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&&Li(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=If(de,t,n,o,r);return r&&r(Le),Le}};return $e}function Gd(e){if(Ec(e))return e=ti(e),e.children=null,e}function Uu(e){if(!Ec(e))return id(e.type)&&e.children?gg(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){if(e.shapeFlag&6&&e.component){e.transition=t;const n=e.component.subTree;bc(id(n.type)&&Uu(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function wg(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(wg(a.children,t,l))):(t||a.type!==_o)&&o.push(l!=null?ti(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 fp(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function wh(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Bu=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(kl(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?dd(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?Lv:B=>wh(v,B)?!1:Ht(_,B),j=(B,J)=>!(J&&wh(v,J));if(h!=null&&h!==d){if(bh(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))Pc(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)&&tp(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(),Bu.delete(e)};U.id=-1,Bu.set(e,U),Do(U,n)}else bh(e),ce()}}}function bh(e){const t=Bu.get(e);t&&(t.flags|=8,Bu.delete(e))}const kh=e=>e.nodeType===8;rd().requestIdleCallback;rd().cancelIdleCallback;function lk(e,t){if(kh(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(kh(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const kl=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=>lk(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(fp(j),v)return()=>uu(v,j);const B=ye=>{h=null,Ic(ye,j,13,!o)};if(l&&j.suspense||Al)return P().then(ye=>()=>uu(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 Rc(()=>{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&&Ec(j.parent.vnode)&&j.parent.update())}).catch(ye=>{if(j.isUnmounted){h=null;return}B(ye),ce.value=ye}),()=>{if(J.value&&v)return uu(v,j);if(ce.value&&o)return Ie(o,{error:ce.value});if(n&&!U.value)return uu(n,j)}}})}function uu(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 Ec=e=>e.type.__isKeepAlive;function ck(e,t){bg(e,"a",t)}function uk(e,t){bg(e,"da",t)}function bg(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(ld(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Ec(r.parent.vnode)&&dk(o,t,n,r),r=r.parent}}function dk(e,t,n,o){const r=ld(t,e,o,!0);Rc(()=>{tp(o[t],r)},n)}function ld(e,t,n=ao,o=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...a)=>{vs();const l=Mc(n),d=Wr(t,n,e,a);return l(),gs(),d});return o?r.unshift(s):r.push(s),s}}const ws=e=>(t,n=ao)=>{(!Al||e==="sp")&&ld(e,(...o)=>t(...o),n)},fk=ws("bm"),bs=ws("m"),pk=ws("bu"),hk=ws("u"),Hi=ws("bum"),Rc=ws("um"),mk=ws("sp"),vk=ws("rtg"),gk=ws("rtc");function yk(e,t=ao){ld("ec",e,t)}const wk="components",kg=Symbol.for("v-ndc");function pp(e){return un(e)?bk(wk,e,!1)||e:e||kg}function bk(e,t,n=!0,o=!1){const r=so||ao;if(r){const s=r.type;{const l=oC(s,!1);if(l&&(l===t||l===qo(t)||l===od(qo(t))))return s}const a=Ch(r[e]||s[e],t)||Ch(r.appContext[e],t);return!a&&o?s:a}}function Ch(e,t){return e&&(e[t]||e[qo(t)]||e[od(qo(t))])}function _t(e,t,n,o){let r;const s=n,a=dt(e);if(a||un(e)){const l=a&&Bi(e);let d=!1,h=!1;l&&(d=!zr(e),h=ys(e),e=ad(e)),r=new Array(e.length);for(let v=0,y=e.length;v<y;v++)r[v]=t(d?h?_l(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(n==null&&(n={}),so.ce||so.parent&&kl(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=ms.length;S();let d;try{const h=a&&Cg(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=ms.length;v>l;v--)gp();throw h}finally{a&&a._c&&(a._d=!0)}return d}function Cg(e){return e.some(t=>kc(t)?!(t.type===_o||t.type===ze&&!Cg(t.children)):!0)?e:null}const Ef=e=>e?qg(e)?dd(e):Ef(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=>Ef(e.parent),$root:e=>Ef(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Sg(e),$forceUpdate:e=>e.f||(e.f=()=>{dp(e.update)}),$nextTick:e=>e.n||(e.n=Wt.bind(e.proxy)),$watch:e=>tk.bind(e)}),Kd=(e,t)=>e!==en&&!e.__isScriptSetup&&Ht(e,t),kk={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(Kd(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];Rf&&(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 Kd(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)||Kd(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 Ck(){return Tk().slots}function Tk(e){const t=yp();return t.setupContext||(t.setupContext=Hg(t))}function Th(e){return dt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Rf=!0;function Sk(e){const t=Sg(e),n=e.proxy,o=e.ctx;Rf=!1,t.beforeCreate&&Sh(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&&_k(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=sd(Ye))}if(Rf=!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)Tg(l[Ye],o,n,Ye);if(d){const Ye=wt(d)?d.call(n):d;Reflect.ownKeys(Ye).forEach(He=>{Eu(He,Ye[He])})}v&&Sh(v,e,"c");function Ue(Ye,He){dt(He)?He.forEach(At=>Ye(At.bind(n))):He&&Ye(He.bind(n))}if(Ue(fk,y),Ue(bs,_),Ue(pk,P),Ue(hk,j),Ue(ck,B),Ue(uk,J),Ue(yk,$e),Ue(gk,_e),Ue(vk,we),Ue(Hi,U),Ue(Rc,K),Ue(mk,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&&fp(e)}function _k(e,t,n=qa){dt(e)&&(e=Mf(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 Sh(e,t,n){Wr(dt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Tg(e,t,n,o){let r=o.includes(".")?pg(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=>Tg(s,t,n,o));else{const s=wt(e.handler)?e.handler.bind(n):t[e.handler];wt(s)&&nt(r,s,e)}}function Sg(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=>qu(d,h,a,!0)),qu(d,t,a)),Vt(t)&&s.set(t,d),d}function qu(e,t,n,o=!1){const{mixins:r,extends:s}=t;s&&qu(e,s,n,!0),r&&r.forEach(a=>qu(e,a,n,!0));for(const a in t)if(!(o&&a==="expose")){const l=xk[a]||n&&n[a];e[a]=l?l(e[a],t[a]):t[a]}return e}const xk={data:_h,props:xh,emits:xh,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:Pk,provide:_h,inject:Ak};function _h(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 Ak(e,t){return sc(Mf(e),Mf(t))}function Mf(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 xh(e,t){return e?dt(e)&&dt(t)?[...new Set([...e,...t])]:On(Object.create(null),Th(e),Th(t??{})):t}function Pk(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 _g(){return{app:null,config:{isNativeTag:Lv,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 Ik=0;function Ek(e,t){return function(o,r=null){wt(o)||(o=On({},o)),r!=null&&!Vt(r)&&(r=null);const s=_g(),a=new WeakSet,l=[];let d=!1;const h=s.app={_uid:Ik++,_component:o,_props:r,_container:null,_context:s,_instance:null,version:sC,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,dd(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=Cl;Cl=h;try{return v()}finally{Cl=y}}};return h}}let Cl=null;const Rk=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${qo(t)}Modifiers`]||e[`${ni(t)}Modifiers`];function Mk(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||en;let r=n;const s=t.startsWith("update:"),a=s&&Rk(o,t.slice(7));a&&(a.trim&&(r=n.map(v=>un(v)?v.trim():v)),a.number&&(r=n.map(op)));let l,d=o[l=qd(t)]||o[l=qd(qo(t))];!d&&s&&(d=o[l=qd(ni(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 $k=new WeakMap;function xg(e,t,n=!1){const o=n?$k: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=xg(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 cd(e,t){return!e||!Zu(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Ht(e,t[0].toLowerCase()+t.slice(1))||Ht(e,ni(t))||Ht(e,t))}function Ah(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=Fu(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:jk(l)}}catch(K){ms.length=0,Ic(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(ed)&&(U=Lk(U,s)),V=ti(V,U,!1,!0))}if(n.dirs&&(V=ti(V,null,!1,!0),V.dirs=V.dirs?V.dirs.concat(n.dirs):n.dirs),n.transition){const K=id(V.type)&&Uu(V)||V;bc(K,n.transition)}return ce=V,Fu(J),ce}const jk=e=>{let t;for(const n in e)(n==="class"||n==="style"||Zu(n))&&((t||(t={}))[n]=e[n]);return t},Lk=(e,t)=>{const n={};for(const o in e)(!ed(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function Nk(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?Ph(o,a,h):!!a;if(d&8){const v=t.dynamicProps;for(let y=0;y<v.length;y++){const _=v[y];if(Ag(a,o,_)&&!cd(h,_))return!0}}}else return(r||l)&&(!l||!l.$stable)?!0:o===a?!1:o?a?Ph(o,a,h):!0:!!a;return!1}function Ph(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const s=o[r];if(Ag(t,e,s)&&!cd(n,s))return!0}return!1}function Ag(e,t,n){const o=e[n],r=t[n];return n==="style"&&Vt(o)&&Vt(r)?!Ac(o,r):o!==r}function Ok({vnode:e,parent:t,suspense:n},o){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=o,e=r),r===e)(e=t.vnode).el=o,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=o)}const Pg={},Ig=()=>Object.create(Pg),Eg=e=>Object.getPrototypeOf(e)===Pg;function Dk(e,t,n,o=!1){const r={},s=Ig();e.propsDefaults=Object.create(null),Rg(e,t,r,s);for(const a in e.propsOptions[0])a in r||(r[a]=void 0);n?e.props=o?r:rg(r):e.type.props?e.props=r:e.props=s,e.attrs=s}function Fk(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(cd(e.emitsOptions,_))continue;const P=t[_];if(d)if(Ht(s,_))P!==s[_]&&(s[_]=P,h=!0);else{const j=qo(_);r[j]=$f(d,l,j,P,e,!1)}else P!==s[_]&&(s[_]=P,h=!0)}}}else{Rg(e,t,r,s)&&(h=!0);let v;for(const y in l)(!t||!Ht(t,y)&&((v=ni(y))===y||!Ht(t,v)))&&(d?n&&(n[y]!==void 0||n[v]!==void 0)&&(r[y]=$f(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 Rg(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:cd(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]=$f(r,d,y,h[y],e,!Ht(h,y))}}return a}function $f(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=Mc(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===ni(n))&&(o=!0))}return o}const Uk=new WeakMap;function Mg(e,t,n=!1){const o=n?Uk: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]=Mg(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,yl),yl;if(dt(s))for(let v=0;v<s.length;v++){const y=qo(s[v]);Ih(y)&&(a[y]=en)}else if(s)for(const v in s){const y=qo(v);if(Ih(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 Ih(e){return e[0]!=="$"&&!cc(e)}const hp=e=>e==="_"||e==="_ctx"||e==="$stable",mp=e=>dt(e)?e.map(Ba):[Ba(e)],Bk=(e,t,n)=>{if(t._n)return t;const o=yt((...r)=>mp(t(...r)),n);return o._c=!1,o},$g=(e,t,n)=>{const o=e._ctx;for(const r in e){if(hp(r))continue;const s=e[r];if(wt(s))t[r]=Bk(r,s,o);else if(s!=null){const a=mp(s);t[r]=()=>a}}},jg=(e,t)=>{const n=mp(t);e.slots.default=()=>n},Lg=(e,t,n)=>{for(const o in t)(n||!hp(o))&&(e[o]=t[o])},qk=(e,t,n)=>{const o=e.slots=Ig();if(e.vnode.shapeFlag&32){const r=t._;r?(Lg(o,t,n),n&&Fv(o,"_",r,!0)):$g(t,o)}else t&&jg(e,t)},zk=(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:Lg(r,t,n):(s=!t.$stable,$g(t,r)),a=t}else t&&(jg(e,t),a={default:1});if(s)for(const l in r)!hp(l)&&a[l]==null&&delete r[l]},Do=Kk;function Hk(e){return Wk(e)}function Wk(e,t){const n=rd();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;$&&!Li($,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 ud:J($,O,G,ue);break;case _o:ce($,O,G,ue);break;case Ru:$==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,Yd($,re),Se,be),Me&&Pi($,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&&Pi($,null,ue,"beforeMount");const Ve=Vk(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&&Pi($,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||Dg(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&&Ii(G,!1),(Me=Fe.onVnodeBeforeUpdate)&&Da(Me,G,O,$),Ee&&Pi(O,$,G,"beforeUpdate"),G&&Ii(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,Yd(O,ie),re):Se||He($,O,be,null,G,ue,Yd(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&&Pi(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||!Li(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)&&vp($,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=Zk($,ue,ie);if(Ec($)&&(be.ctx.renderer=z),eC(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(Nk($,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=Ng($);if(H){ge&&(ge.el=rt.el,Ye($,ge,Se)),H.asyncDep.then(()=>{Do(()=>{$.isUnmounted||se()},ie)});return}}let gt=ge,It;Ii($,!1),ge?(ge.el=rt.el,Ye($,ge,Se)):ge=rt,Fe&&Iu(Fe),(It=ge.props&&ge.props.onVnodeBeforeUpdate)&&Da(It,Ve,ge,rt),Ii($,!0);const Tt=Ah($),Tn=$.subTree;$.subTree=Tt,B(Tn,Tt,y(Tn.el),ae(Tn),$,ie,re),ge.el=Tt.el,gt===null&&Ok($,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=kl(O);Ii($,!1),Ve&&Iu(Ve),!Tn&&(ge=Me&&Me.onVnodeBeforeMount)&&Da(ge,gt,O),Ii($,!0);{It.ce&&It.ce._hasShadowRoot()&&It.ce._injectChildStyle(Tt,$.parent?$.parent.type:void 0);const H=$.subTree=Ah($);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&&kl(gt.vnode)&&gt.vnode.shapeFlag&256)&&$.a&&Do($.a,ie),$.isMounted=!0,O=G=ue=null}};$.scope.on();const pe=$.effect=new Hv(be);$.scope.off();const se=$.update=pe.run.bind(pe),Ee=$.job=pe.runIfDirty.bind(pe);Ee.i=$,Ee.id=$.uid,pe.scheduler=()=>dp(Ee),Ii($,!0),se()},Ye=($,O,G)=>{O.component=$;const ue=$.vnode.props;$.vnode=O,$.next=null,Fk($,O.props,ue,G),zk($,O.children,G),vs(),vh($),gs()},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)=>{$=$||yl,O=O||yl;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(Li(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(Li(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&&Li(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?Gk(W):yl;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||Og(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===Ru){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&&(vs(),fc(be,null,G,$,!0),gs()),Me!=null&&(O.renderCache[Me]=void 0),Ee&256){O.ctx.deactivate($);return}const rt=Ee&1&&Fe,gt=!kl($);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&&Pi($,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&&Pi($,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===Ru){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}=$;Eh(pe),Eh(se),ue&&Iu(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[hg];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,vh(ue),cg(),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:Ek(oe)}}function Yd({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Ii({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Vk(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function vp(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&&vp(a,l)),l.type===ud&&(l.patchFlag===-1&&(l=r[s]=cs(l)),l.el=a.el),l.type===_o&&!l.el&&(l.el=a.el)}}function Gk(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 Ng(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ng(t)}function Eh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Og(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Og(t.subTree):null}const Dg=e=>e.__isSuspense;function Kk(e,t){t&&t.pendingBranch?dt(e)?t.effects.push(...e):t.effects.push(e):X0(e)}const ze=Symbol.for("v-fgt"),ud=Symbol.for("v-txt"),_o=Symbol.for("v-cmt"),Ru=Symbol.for("v-stc"),ms=[];let Bo=null;function S(e=!1){ms.push(Bo=e?null:[])}function gp(){ms.pop(),Bo=ms[ms.length-1]||null}let xl=1;function zu(e,t=!1){xl+=e,e<0&&Bo&&t&&(Bo.hasOnce=!0)}function Fg(e){return e.dynamicChildren=xl>0?Bo||yl:null,gp(),xl>0&&Bo&&Bo.push(e),e}function I(e,t,n,o,r,s){return Fg(p(e,t,n,o,r,s,!0))}function tt(e,t,n,o,r){return Fg(Ie(e,t,n,o,r,!0))}function kc(e){return e?e.__v_isVNode===!0:!1}function Li(e,t){return e.type===t.type&&e.key===t.key}const Ug=({key:e})=>e??null,Mu=({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&&Ug(t),ref:t&&Mu(t),scopeId:dg,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?(Hu(d,n),s&128&&e.normalize(d)):n&&(d.shapeFlag|=un(n)?8:16),xl>0&&!a&&Bo&&(d.patchFlag>0||s&6)&&d.patchFlag!==32&&Bo.push(d),d}const Ie=Yk;function Yk(e,t=null,n=null,o=0,r=null,s=!1){if((!e||e===kg)&&(e=_o),kc(e)){const l=ti(e,t,!0);return n&&Hu(l,n),xl>0&&!s&&Bo&&(l.shapeFlag&6?Bo[Bo.indexOf(e)]=l:Bo.push(l)),l.patchFlag=-2,l}if(rC(e)&&(e=e.__vccOpts),t){t=Jk(t);let{class:l,style:d}=t;l&&!un(l)&&(t.class=Ke(l)),Vt(d)&&(up(d)&&!dt(d)&&(d=On({},d)),t.style=kr(d))}const a=un(e)?1:Dg(e)?128:id(e)?64:Vt(e)?4:wt(e)?2:0;return p(e,t,n,o,r,a,s,!0)}function Jk(e){return e?up(e)||Eg(e)?On({},e):e:null}function ti(e,t,n=!1,o=!1){const{props:r,ref:s,patchFlag:a,children:l,transition:d}=e,h=t?Bg(r||{},t):r,v={__v_isVNode:!0,__v_skip:!0,type:e.type,props:h,key:h&&Ug(h),ref:t&&t.ref?n&&s?dt(s)?s.concat(Mu(t)):[s,Mu(t)]:Mu(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&&ti(e.ssContent),ssFallback:e.ssFallback&&ti(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(ud,null,e,t)}function oB(e,t){const n=Ie(Ru,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(ud,null,String(e))}function cs(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ti(e)}function Hu(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),Hu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Eg(t)?t._ctx=so:r===3&&so&&(so.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(wt(t)){if(o&65){Hu(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 Bg(...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(Zu(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&&!ed(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 Qk=_g();let Xk=0;function Zk(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||Qk,s={uid:Xk++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new T0(!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:Mg(o,r),emitsOptions:xg(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=Mk.bind(null,s),e.ce&&e.ce(s),s}let ao=null;const yp=()=>ao||so;let Wu,Cc;{const e=rd(),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)}};Wu=t("__VUE_INSTANCE_SETTERS__",n=>ao=n),Cc=t("__VUE_SSR_SETTERS__",n=>Al=n)}const Mc=e=>{const t=ao;return Wu(e),e.scope.on(),()=>{e.scope.off(),Wu(t)}},Rh=()=>{ao&&ao.scope.off(),Wu(null)};function qg(e){return e.vnode.shapeFlag&4}let Al=!1;function eC(e,t=!1,n=!1){t&&Cc(t);const{props:o,children:r}=e.vnode,s=qg(e);Dk(e,o,s,t),qk(e,r,n||t);const a=s?tC(e,t):void 0;return t&&Cc(!1),a}function tC(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,kk);const{setup:o}=n;if(o){vs();const r=e.setupContext=o.length>1?Hg(e):null,s=Mc(e),a=Pc(o,e,0,[e.props,r]),l=Nv(a);if(gs(),s(),(l||e.sp)&&!kl(e)&&fp(e),l){if(a.then(Rh,Rh),t)return a.then(d=>{Cc(!0);try{Mh(e,d,t)}finally{Cc(!1)}}).catch(d=>{Ic(d,e,0)});e.asyncDep=a}else Mh(e,a)}else zg(e)}function Mh(e,t,n){wt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Vt(t)&&(e.setupState=sg(t)),zg(e)}function zg(e,t,n){const o=e.type;e.render||(e.render=o.render||qa);{const r=Mc(e);vs();try{Sk(e)}finally{gs(),r()}}}const nC={get(e,t){return So(e,"get",""),e[t]}};function Hg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,nC),slots:e.slots,emit:e.emit,expose:t}}function dd(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(sg(q0(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 oC(e,t=!0){return wt(e)?e.displayName||e.name:e.name||t&&e.__name}function rC(e){return wt(e)&&"__vccOpts"in e}const X=(e,t)=>G0(e,t,Al);function wp(e,t,n){try{zu(-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{zu(1)}}function rB(e,t,n,o){const r=n[o];if(r&&aC(r,e))return r;const s=t();return s.memo=e.slice(),s.cacheIndex=o,n[o]=s}function aC(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 xl>0&&Bo&&Bo.push(e),!0}const sC="3.5.41";/**
15
+ * @vue/runtime-dom v3.5.41
16
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
+ * @license MIT
18
+ **/let jf;const $h=typeof window<"u"&&window.trustedTypes;if($h)try{jf=$h.createPolicy("vue",{createHTML:e=>e})}catch{}const Wg=jf?e=>jf.createHTML(e):e=>e,iC="http://www.w3.org/2000/svg",lC="http://www.w3.org/1998/Math/MathML",ls=typeof document<"u"?document:null,jh=ls&&ls.createElement("template"),cC={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(iC,e):t==="mathml"?ls.createElementNS(lC,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{jh.innerHTML=Wg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const l=jh.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]}},Bs="transition",ec="animation",Tc=Symbol("_vtc"),Vg={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},uC=On({},mg,Vg),dC=e=>(e.displayName="Transition",e.props=uC,e),$c=dC((e,{slots:t})=>wp(ik,fC(e),t)),Ei=(e,t=[])=>{dt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Lh=e=>e?dt(e)?e.some(t=>t.length>1):e.length>1:!1;function fC(e){const t={};for(const fe in e)fe in Vg||(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=pC(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,Ri(fe,Te?v:l),Ri(fe,Te?h:a),xe&&xe()},Le=(fe,Te)=>{fe._isLeaving=!1,Ri(fe,y),Ri(fe,P),Ri(fe,_),Te&&Te()},je=fe=>(Te,xe)=>{const Ae=fe?we:U,Ue=()=>de(Te,fe,xe);Ei(Ae,[Te,Ue]),Nh(()=>{Ri(Te,fe?d:s),as(Te,fe?v:l),Lh(Ae)||Oh(Te,o,B,Ue)})};return On(t,{onBeforeEnter(fe){Ei(ce,[fe]),as(fe,s),as(fe,a)},onBeforeAppear(fe){Ei(_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,_),Uh(fe)):(Uh(fe),as(fe,_)),Nh(()=>{fe._isLeaving&&(Ri(fe,y),as(fe,P),Lh(K)||Oh(fe,o,J,xe))}),Ei(K,[fe,xe])},onEnterCancelled(fe){de(fe,!1,void 0,!0),Ei(V,[fe])},onAppearCancelled(fe){de(fe,!0,void 0,!0),Ei($e,[fe])},onLeaveCancelled(fe){Le(fe),Ei(ye,[fe])}})}function pC(e){if(e==null)return null;if(Vt(e))return[Jd(e.enter),Jd(e.leave)];{const t=Jd(e);return[t,t]}}function Jd(e){return m0(e)}function as(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Tc]||(e[Tc]=new Set)).add(t)}function Ri(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[Tc];n&&(n.delete(t),n.size||(e[Tc]=void 0))}function Nh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let hC=0;function Oh(e,t,n,o){const r=e._endId=++hC,s=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(s,n);const{type:a,timeout:l,propCount:d}=mC(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 mC(e,t){const n=window.getComputedStyle(e),o=j=>(n[j]||"").split(", "),r=o(`${Bs}Delay`),s=o(`${Bs}Duration`),a=Dh(r,s),l=o(`${ec}Delay`),d=o(`${ec}Duration`),h=Dh(l,d);let v=null,y=0,_=0;t===Bs?a>0&&(v=Bs,y=a,_=s.length):t===ec?h>0&&(v=ec,y=h,_=d.length):(y=Math.max(a,h),v=y>0?a>h?Bs:ec:null,_=v?v===Bs?s.length:d.length:0);const P=v===Bs&&/\b(?:transform|all)(?:,|$)/.test(o(`${Bs}Property`).toString());return{type:v,timeout:y,propCount:_,hasTransform:P}}function Dh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>Fh(n)+Fh(e[o])))}function Fh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Uh(e){return(e?e.ownerDocument:document).body.offsetHeight}function vC(e,t,n){const o=e[Tc];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Vu=Symbol("_vod"),Gg=Symbol("_vsh"),du={name:"show",beforeMount(e,{value:t},{transition:n}){e[Vu]=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[Vu]:"none",e[Gg]=!t}const gC=Symbol(""),yC=/(?:^|;)\s*display\s*:/;function wC(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?kC(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[gC];a&&(n+=";"+a),o.cssText=n,s=yC.test(n)}}else t&&e.removeAttribute("style");Vu in e&&(e[Vu]=s?o.display:"",e[Gg]&&(o.display="none"))}const Bh=/\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=bC(e,t);Bh.test(n)?e.setProperty(ni(o),n.replace(Bh,""),"important"):e[o]=n}}const qh=["Webkit","Moz","ms"],Qd={};function bC(e,t){const n=Qd[t];if(n)return n;let o=qo(t);if(o!=="filter"&&o in e)return Qd[t]=o;o=od(o);for(let r=0;r<qh.length;r++){const s=qh[r]+o;if(s in e)return Qd[t]=s}return t}function kC(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&un(o)&&n===o}const zh="http://www.w3.org/1999/xlink";function Hh(e,t,n,o,r,s=k0(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(zh,t.slice(6,t.length)):e.setAttributeNS(zh,t,n):n==null||s&&!Uv(n)?e.removeAttribute(t):e.setAttribute(t,s?"":va(n)?String(n):n)}function Wh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Wg(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=Uv(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 Ni(e,t,n,o){e.addEventListener(t,n,o)}function CC(e,t,n,o){e.removeEventListener(t,n,o)}const Vh=Symbol("_vei");function TC(e,t,n,o,r=null){const s=e[Vh]||(e[Vh]={}),a=s[t];if(o&&a)a.value=o;else{const[l,d]=xC(t);if(o){const h=s[t]=IC(o,r);Ni(e,l,h,d)}else a&&(CC(e,l,a,d),s[t]=void 0)}}const SC=/(Once|Passive|Capture)$/,_C=/^on:?(?:Once|Passive|Capture)$/;function xC(e){let t,n;for(;(n=e.match(SC))&&!_C.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):ni(e.slice(2)),t]}let Xd=0;const AC=Promise.resolve(),PC=()=>Xd||(AC.then(()=>Xd=0),Xd=Date.now());function IC(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=PC(),n}const Gh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,EC=(e,t,n,o,r,s)=>{const a=r==="svg";t==="class"?vC(e,o,a):t==="style"?wC(e,n,o):Zu(t)?ed(t)||TC(e,t,n,o,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):RC(e,t,o,a))?(Wh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Hh(e,t,o,a,s,t!=="value")):e._isVueCE&&(MC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!un(o)))?Wh(e,qo(t),o,s,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),Hh(e,t,o,a))};function RC(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Gh(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 Gh(t)&&un(n)?!1:t in e}function MC(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 Gu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return dt(t)?n=>Iu(t,n):t};function $C(e){e.target.composing=!0}function Kh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Oi=Symbol("_assign"),fu=Symbol("_initialValue");function Zd(e,t,n){return t&&(e=e.trim()),n&&(e=op(e)),e}const an={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e.parentNode&&(e.type==="text"?e[fu]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[fu]=e.defaultValue.replace(/\r\n?/g,`
19
+ `))),e[Oi]=Gu(r);const s=o||r.props&&r.props.type==="number";Ni(e,t?"change":"input",a=>{a.target.composing||e[Oi](Zd(e.value,n,s))}),(n||s)&&Ni(e,"change",()=>{e.value=Zd(e.value,n,s)}),t||(Ni(e,"compositionstart",$C),Ni(e,"compositionend",Kh),Ni(e,"change",Kh))},mounted(e,{value:t,modifiers:{trim:n,number:o}}){const r=t??"",s=e[fu];delete e[fu],s!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==s?e[Oi](Zd(e.value,n,o)):e.value=r},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:s}},a){if(e[Oi]=Gu(a),e.composing)return;const l=(s||e.type==="number")&&!/^0\d/.test(e.value)?op(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)}},Kg={deep:!0,created(e,t,n){e[Oi]=Gu(n),Ni(e,"change",()=>{const o=e._modelValue,r=jC(e),s=e.checked,a=e[Oi];if(dt(o)){const l=Bv(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(td(o)){const l=new Set(o);s?l.add(r):l.delete(r),a(l)}else a(Yg(e,s))})},mounted:Yh,beforeUpdate(e,t,n){e[Oi]=Gu(n),Yh(e,t,n)}};function Yh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(dt(t))r=Bv(t,o.props.value)>-1;else if(td(t))r=t.has(o.props.value);else{if(t===n)return;r=Ac(t,Yg(e,!0))}e.checked!==r&&(e.checked=r)}function jC(e){return"_value"in e?e._value:e.value}function Yg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const LC=["ctrl","shift","alt","meta"],NC={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)=>LC.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=NC[t[a]];if(l&&l(r,t))return}return e(r,...s)})},OC={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=ni(r.key);if(t.some(a=>a===s||OC[a]===s))return e(r)})},DC=On({patchProp:EC},cC);let Jh;function FC(){return Jh||(Jh=Hk(DC))}const UC=(...e)=>{const t=FC().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=qC(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,BC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},t};function BC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function qC(e){return un(e)?document.querySelector(e):e}const zC="modulepreload",HC=function(e){return"/"+e},Qh={},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=HC(h),h in Qh)return;Qh[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":zC,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)})};/*!
20
+ * vue-router v4.6.4
21
+ * (c) 2025 Eduardo San Martin Morote
22
+ * @license MIT
23
+ */const hl=typeof document<"u";function Jg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function WC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Jg(e.default)}const zt=Object.assign;function ef(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 Xh(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const Qg=/#/g,VC=/&/g,GC=/\//g,KC=/=/g,YC=/\?/g,Xg=/\+/g,JC=/%5B/g,QC=/%5D/g,Zg=/%5E/g,XC=/%60/g,ey=/%7B/g,ZC=/%7C/g,ty=/%7D/g,eT=/%20/g;function bp(e){return e==null?"":encodeURI(""+e).replace(ZC,"|").replace(JC,"[").replace(QC,"]")}function tT(e){return bp(e).replace(ey,"{").replace(ty,"}").replace(Zg,"^")}function Lf(e){return bp(e).replace(Xg,"%2B").replace(eT,"+").replace(Qg,"%23").replace(VC,"%26").replace(XC,"`").replace(ey,"{").replace(ty,"}").replace(Zg,"^")}function nT(e){return Lf(e).replace(KC,"%3D")}function oT(e){return bp(e).replace(Qg,"%23").replace(YC,"%3F")}function rT(e){return oT(e).replace(GC,"%2F")}function Sc(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const aT=/\/$/,sT=e=>e.replace(aT,"");function tf(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=uT(o??t,n),{fullPath:o+s+a,path:o,query:r,hash:Sc(a)}}function iT(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Zh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function lT(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&Pl(t.matched[o],n.matched[r])&&ny(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Pl(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function ny(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!cT(e[n],t[n]))return!1;return!0}function cT(e,t){return ya(e)?em(e,t):ya(t)?em(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function em(e,t){return ya(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function uT(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 qs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Nf=function(e){return e.pop="pop",e.push="push",e}({}),nf=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function dT(e){if(!e)if(hl){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),sT(e)}const fT=/^[^#]+#/;function pT(e,t){return e.replace(fT,"#")+t}function hT(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 fd=()=>({left:window.scrollX,top:window.scrollY});function mT(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=hT(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 tm(e,t){return(history.state?history.state.position-t:-1)+e}const Of=new Map;function vT(e,t){Of.set(e,t)}function gT(e){const t=Of.get(e);return Of.delete(e),t}function yT(e){return typeof e=="string"||e&&typeof e=="object"}function oy(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 ry=Symbol("");Pn.MATCHER_NOT_FOUND+"",Pn.NAVIGATION_GUARD_REDIRECT+"",Pn.NAVIGATION_ABORTED+"",Pn.NAVIGATION_CANCELLED+"",Pn.NAVIGATION_DUPLICATED+"";function Il(e,t){return zt(new Error,{type:e,[ry]:!0},t)}function ss(e,t){return e instanceof Error&&ry in e&&(t==null||!!(e.type&t))}const wT=["params","query","hash"];function bT(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of wT)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function kT(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(Xg," "),s=r.indexOf("="),a=Sc(s<0?r:r.slice(0,s)),l=s<0?null:Sc(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 nm(e){let t="";for(let n in e){const o=e[n];if(n=nT(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(ya(o)?o.map(r=>r&&Lf(r)):[o&&Lf(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function CT(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 TT=Symbol(""),om=Symbol(""),pd=Symbol(""),kp=Symbol(""),Df=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 Ys(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(Il(Pn.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?d(_):yT(_)?d(Il(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 of(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(Jg(d)){const h=(d.__vccOpts||d)[t];h&&s.push(Ys(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=WC(v)?v.default:v;a.mods[l]=v,a.components[l]=y;const _=(y.__vccOpts||y)[t];return _&&Ys(_,n,o,a,l,r)()}))}}return s}function ST(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=>Pl(h,l))?o.push(l):n.push(l));const d=e.matched[a];d&&(t.matched.find(h=>Pl(h,d))||r.push(d))}return[n,o,r]}/*!
24
+ * vue-router v4.6.4
25
+ * (c) 2025 Eduardo San Martin Morote
26
+ * @license MIT
27
+ */let _T=()=>location.protocol+"//"+location.host;function ay(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),Zh(l,"")}return Zh(n,e)+o+r}function xT(e,t,n,o){let r=[],s=[],a=null;const l=({state:_})=>{const P=ay(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:Nf.pop,direction:J?J>0?nf.forward:nf.back:nf.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:fd()}),"")}}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 rm(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?fd():null}}function AT(e){const{history:t,location:n}=window,o={value:ay(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:_T()+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,rm(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:fd()});s(v.current,v,!0),s(d,zt({},rm(o.value,d,null),{position:v.position+1},h),!1),o.value=d}return{location:o,state:r,push:l,replace:a}}function PT(e){e=dT(e);const t=AT(e),n=xT(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:pT.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 IT(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),PT(e)}let Di=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 ET={type:Di.Static,value:""},RT=/[a-zA-Z0-9_]/;function MT(e){if(!e)return[[]];if(e==="/")return[[ET]];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:Di.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:Di.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:RT.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 am="[^/]+?",$T={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 jT=/[.+*?^${}()[\]/\\]/g;function LT(e,t){const n=zt({},$T,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===Di.Static)y||(r+="/"),r+=_.value.replace(jT,"\\$&"),P+=Fo.Static;else if(_.type===Di.Param){const{value:j,repeatable:B,optional:J,regexp:ce}=_;s.push({name:j,repeatable:B,optional:J});const U=ce||am;if(U!==am){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===Di.Static)v+=P.value;else if(P.type===Di.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 NT(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 sy(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const s=NT(o[n],r[n]);if(s)return s;n++}if(Math.abs(r.length-o.length)===1){if(sm(o))return 1;if(sm(r))return-1}return r.length-o.length}function sm(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const OT={strict:!1,end:!0,sensitive:!1};function DT(e,t,n){const o=LT(MT(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 FT(e,t){const n=[],o=new Map;t=Xh(OT,t);function r(y){return o.get(y)}function s(y,_,P){const j=!P,B=lm(y);B.aliasOf=P&&P.record;const J=Xh(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(lm(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=DT(K,_,J),P?P.alias.push(U):(V=V||U,V!==U&&V.alias.push(U),j&&y.name&&!cm(U)&&a(y.name)),iy(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(oy(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 _=qT(y,n);n.splice(_,0,y),y.record.name&&!cm(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 Il(Pn.MATCHER_NOT_FOUND,{location:y});J=P.record.name,j=zt(im(_.params,P.keys.filter(V=>!V.optional).concat(P.parent?P.parent.keys.filter(V=>V.optional):[]).map(V=>V.name)),y.params&&im(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 Il(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:BT(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 im(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function lm(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:UT(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 UT(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 cm(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function BT(e){return e.reduce((t,n)=>zt(t,n.meta),{})}function qT(e,t){let n=0,o=t.length;for(;n!==o;){const s=n+o>>1;sy(e,t[s])<0?o=s:n=s+1}const r=zT(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function zT(e){let t=e;for(;t=t.parent;)if(iy(t)&&sy(e,t)===0)return t}function iy({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function um(e){const t=ha(pd),n=ha(kp),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(Pl.bind(null,v));if(_>-1)return _;const P=dm(d[h-2]);return h>1&&dm(v)===P&&y[y.length-1].path!==P?y.findIndex(Pl.bind(null,d[h-2])):_}),s=X(()=>r.value>-1&&KT(n.params,o.value.params)),a=X(()=>r.value>-1&&r.value===n.matched.length-1&&ny(n.params,o.value.params));function l(d={}){if(GT(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 HT(e){return e.length===1?e[0]:e}const WT=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:um,setup(e,{slots:t}){const n=sd(um(e)),{options:o}=ha(pd),r=X(()=>({[fm(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[fm(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const s=t.default&&HT(t.default(n));return e.custom?s:wp("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},s)}}}),VT=WT;function GT(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 KT(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 dm(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const fm=(e,t,n)=>e??t??n,YT=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(Df),r=X(()=>e.route||o.value),s=ha(om,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]);Eu(om,X(()=>a.value+1)),Eu(TT,l),Eu(Df,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||!Pl(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 pm(n.default,{Component:_,route:h});const P=y.props[v],j=P?P===!0?h.params:typeof P=="function"?P(h):P:null,J=wp(_,zt({},j,t,{onVnodeUnmounted:ce=>{ce.component.isUnmounted&&(y.instances[v]=null)},ref:d}));return pm(n.default,{Component:J,route:h})||J}}});function pm(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const JT=YT;function QT(e){const t=FT(e.routes,e),n=e.parseQuery||kT,o=e.stringifyQuery||nm,r=e.history,s=oc(),a=oc(),l=oc(),d=z0(qs);let h=qs;hl&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const v=ef.bind(null,ae=>""+ae),y=ef.bind(null,rT),_=ef.bind(null,Sc);function P(ae,te){let oe,z;return oy(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=tf(n,ae,te.path),ue=t.resolve({path:G.path},te),ie=r.createHref(G.fullPath);return zt(G,ue,{params:_(ue.params),hash:Sc(G.hash),redirectedFrom:void 0,href:ie})}let oe;if(ae.path!=null)oe=zt({},ae,{path:tf(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 $=iT(o,zt({},ae,{hash:tT(Be),path:z.path})),O=r.createHref($);return zt({fullPath:$,hash:Be,query:o===nm?CT(ae.query):ae.query||{}},z,{redirectedFrom:void 0,href:O})}function U(ae){return typeof ae=="string"?tf(n,ae,d.value.path):zt({},ae)}function V(ae,te){if(h!==ae)return Il(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!$&&lT(o,z,oe)&&(ie=Il(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,$]=ST(ae,te);oe=of(z.reverse(),"beforeRouteLeave",ae,te);for(const G of z)G.leaveGuards.forEach(ue=>{oe.push(Ys(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(Ys(G,ae,te));return oe.push(O),at(oe)}).then(()=>{oe=of(Be,"beforeRouteUpdate",ae,te);for(const G of Be)G.updateGuards.forEach(ue=>{oe.push(Ys(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(Ys(ue,ae,te));else oe.push(Ys(G.beforeEnter,ae,te));return oe.push(O),at(oe)}).then(()=>(ae.matched.forEach(G=>G.enterCallbacks={}),oe=of($,"beforeRouteEnter",ae,te,de),oe.push(O),at(oe))).then(()=>{oe=[];for(const G of a.list())oe.push(Ys(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===qs,G=hl?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;hl&&vT(tm($.fullPath,oe.delta),fd()),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===Nf.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===Nf.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!==qs?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(!hl||!Be)return Promise.resolve();const $=!oe&&gT(tm(ae.fullPath,0))||(z||!oe)&&history.state&&history.state.scroll||null;return Wt().then(()=>Be(ae,te,$)).then(O=>O&&mT(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",VT),ae.component("RouterView",JT),ae.config.globalProperties.$router=kt,Object.defineProperty(ae.config.globalProperties,"$route",{enumerable:!0,get:()=>g(d)}),hl&&!ft&&d.value===qs&&(ft=!0,K(r.location).catch(z=>{}));const te={};for(const z in qs)Object.defineProperty(te,z,{get:()=>d.value[z],enumerable:!0});ae.provide(pd,kt),ae.provide(kp,rg(te)),ae.provide(Df,d);const oe=ae.unmount;mt.add(ae),ae.unmount=function(){mt.delete(ae),mt.size<1&&(h=qs,Te&&Te(),Te=null,d.value=qs,ft=!1,Ye=!1),oe()}}};function at(ae){return ae.reduce((te,oe)=>te.then(()=>de(oe)),Promise.resolve())}return kt}function XT(){return ha(pd)}function ZT(e){return ha(kp)}const hm=768;function Cp(){const e=A(typeof window<"u"?window.innerWidth<hm:!1);let t=null;function n(o){e.value=o.matches}return bs(()=>{t=window.matchMedia(`(max-width: ${hm-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Rc(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const eS={key:0,class:"desktop-sidebar"},tS={class:"desktop-main"},mm="codex-web-local.sidebar-width.v1",nS=260,oS=620,vm=320,rS=tn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Cp();function o(h){return Math.min(oS,Math.max(nS,h))}function r(){if(typeof window>"u")return vm;const h=window.localStorage.getItem(mm),v=Number(h);return Number.isFinite(v)?o(v):vm}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(mm,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(Zs,{key:0,to:"body"},[Ie($c,{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",eS,[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",tS,[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},aS=bt(rS,[["__scopeId","data-v-59d3c494"]]);function gm(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=gm(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=gm(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 ly(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function sS(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 iS(){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 lS(e){const t=ly(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 ym(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function cS(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=lS(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};ym(e,P)}catch{ym(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 uS(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 dS(){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=ly(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}const cy=["none","minimal","low","medium","high","xhigh","max","ultra"];function Ff(e){return typeof e=="string"&&cy.some(t=>t===e)}function fS(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function ot(e){return fS(e)}function uy(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function pS(e){const t=ot(e);return t.startsWith("/")||uy(t)}function hS(e){const t=ot(e).replace(/[\\/]+/gu,"/");return uy(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 Tl(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 Ku(e){const t=ot(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function wm(e){return new Date(e*1e3).toISOString()}function mS(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function vS(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const gS=/^##\s+(.+?):\s+(.+?)\s*$/,yS=/^#\s*files mentioned by the user\s*:?\s*$/i;function wS(e){var r,s;const t=e.split(`
28
+ `).findIndex(a=>yS.test(a.trim()));if(t<0)return[];const n=e.split(`
29
+ `).slice(t+1),o=[];for(const a of n){const l=a.trim();if(!l)continue;const d=l.match(gS);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 bS(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 dy(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function kS(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 CS(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function rf(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?CS(n[1].trim()):""}function TS(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=rf(t,"current_time_iso"),o=rf(t,"instructions");return!n||!o?null:{automationId:rf(t,"automation_id"),currentTimeIso:n,instructions:o}}function SS(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(dy(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:mS(v),isUnhandled:!0})}const a=n.join(`
30
+ `),l=wS(a),d=TS(a);return{text:(d==null?void 0:d.instructions)??bS(a),images:o,skills:r,fileAttachments:l,rawBlocks:s,isAutomationRun:d!==null,automationDisplayName:(d==null?void 0:d.automationId)||null}}function _S(e){var s;const t=e.replace(/\r\n/g,`
31
+ `).trim();if(!t)return null;const n=t.split(`
32
+ `),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(`
33
+ `).trim()||void 0,steps:o}}function bm(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
34
+ `),n=t.endsWith(`
35
+ `)?t.slice(0,-1):t;return n?n.split(`
36
+ `).length:0}function xS(e){let t=0,n=0;for(const o of e.replace(/\r\n/g,`
37
+ `).split(`
38
+ `))if(o&&!(o.startsWith("+++")||o.startsWith("---")||o.startsWith("@@"))){if(o.startsWith("+")){t+=1;continue}o.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function fy(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Uf(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"?xS(a):d==="add"?{addedLineCount:bm(a),removedLineCount:0}:{addedLineCount:0,removedLineCount:bm(a)};n.push({path:s,operation:d,movedToPath:h,diff:a,...v})}return n}function AS(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=SS(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:[dy(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?kS(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(`
39
+ `).trim(),a=o.join(`
40
+ `).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:_S(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=PS(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=Uf(e.changes),n=fy(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 PS(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function IS(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 ES(e){const t=IS(e);return t.length>0?t:"Untitled thread"}function Tp(e){return(e==null?void 0:e.status)==="inProgress"}function Sp(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 RS(e){var t;return((t=Sp(e))==null?void 0:t.active)===!0}function py(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 Tp(r)||RS(e)}function hy(e){const t=e,n=ot(typeof t.cwd=="string"?t.cwd:e.cwd),o=hS(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:ES(e),projectName:Hr(n),cwd:n,hasWorktree:r,createdAtIso:wm(e.createdAt),updatedAtIso:wm(e.updatedAt),preview:e.preview,unread:!1,inProgress:py(e),externalSession:Sp(e)}}function MS(e){return hy(e.thread)}function $S(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 jS(e){const t=e.data.map(hy);return $S(t)}function jc(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 AS(_))v.push({...P,turnId:d,turnIndex:s});const y=vS(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 NS(LS(o))}function LS(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 NS(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 _p(e){if(py(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Tp(t.at(-1))}function my(e){return Sp(e.thread)}function xp(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(Tp(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const OS=5e3;function af(e){return e&&e.length>0?e:null}function sf(e){return e&&e.length>0?e:null}let pu=null,mc=null;async function DS(e,t){await vt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function FS(e,t){await vt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function US(e){await vt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}const BS=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function vy(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||BS.has(n))}function qS(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||vy(l)||o.push({path:l})}return o}const km=[{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 zS(e){return e==="payment_required"?e:null}function HS(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Cm(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 WS(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 Bf(e){const t=Xe(e);if(!t)return null;const n=Cm(t.primary),o=Cm(t.secondary),r=WS(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 gy(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:Bf(o.quotaSnapshot),quotaUpdatedAtIso:le(o.quotaUpdatedAtIso),quotaStatus:l,quotaError:le(o.quotaError),unavailableReason:zS(o.unavailableReason)??(HS(le(o.quotaError))?"payment_required":null),isActive:ar(o.isActive)??(s===n||r===t)}:null}function yy(e){const t=Xe(e);if(!t)return null;const n=Xe(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=Bf(n==null?void 0:n.codex);return o||Bf(t.rateLimits??t.rate_limits)}async function vt(e,t){try{return await sS(e,t)}catch(n){throw wa(n,`RPC ${e} failed`,e)}}function Ap(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 hd(e){const t=Xe(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function VS(e){return Ff(e)?e:""}function GS(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const KS=50,YS=100;async function JS(e,t){const n=await vt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:jS(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function QS(e){const t=await vt("thread/read",{threadId:e,includeTurns:!1});return MS(t)}async function XS(e){const t=await vt("thread/read",{threadId:e,includeTurns:!0}),n=hd(t),o=jc(t,n);return{model:_c(t),modelProvider:vd(t),messages:o,inProgress:_p(t),activeTurnId:xp(t),hasMoreOlder:n>0,turnIndexByTurnId:Ap(t,n),externalSession:my(t)}}async function ZS(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:jc(s.result,a),inProgress:_p(s.result),activeTurnId:xp(s.result),hasMoreOlder:s.hasMoreOlder===!0,startTurnIndex:a,turnIndexByTurnId:Ap(s.result,a)}}async function Tm(e=null,t=KS){try{return await JS(e,t)}catch(n){throw wa(n,"Failed to load thread groups","thread/list")}}function e_(){return YS}async function t_(e){try{return await QS(e)}catch(t){throw wa(t,`Failed to load thread ${e}`,"thread/read")}}async function lf(e){try{return await XS(e)}catch(t){throw wa(t,`Failed to load thread ${e}`,"thread/read")}}async function n_(e,t,n){try{return await ZS(e,t,n)}catch(o){throw wa(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}function o_(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 r_(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=>o_(s)).filter(s=>s!==null):[]}:null}function a_(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=>r_(a)).filter(a=>a!==null):[]}}function wy(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=>a_(l)).filter(l=>l!==null):[]}}function s_(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 i_(){return iS()}function l_(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 c_(){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(l_).filter(r=>r!==null):[],warnings:da(o.warnings),errors:da(o.errors)})}return t}async function aB(e){await vt("marketplace/add",{source:e})}async function sB(e){await vt("marketplace/remove",{marketplaceName:e})}async function iB(){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 u_(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 lB(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 cB(){const e=await vt("plugin/share/list",{});return(e.data??e.shares??[]).map(u_).filter(n=>n!==null)}async function uB(e){await vt("plugin/share/delete",{remotePluginId:e})}async function dB(e){await vt("plugin/share/checkout",{remotePluginId:e})}function by(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 d_(){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(by).filter(n=>n!==null)}}async function f_(){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 p_(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 h_(e){await vt(e?"remoteControl/enable":"remoteControl/disable",{})}async function m_(){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 v_(){const e=await vt("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(by).filter(n=>n!==null)}async function g_(e){await vt("remoteControl/client/revoke",{clientId:e})}function Yu(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 ky(e){if(Array.isArray(e))return e.flatMap(n=>{const o=Yu(n);return o?[o]:[]});const t=Yu(e);return t?[t]:[]}async function y_(){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=ky(a);l.length>0&&(o[s]=l)}return o}async function w_(){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=ky(a);l.length>0&&(o[s]=l)}return o}async function b_(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=Yu((r=Xe(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function k_(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=Yu((r=Xe(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function Sm(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 _m(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 C_(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 T_(e){return cS(e)}function S_(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 fB(e){var o;const t=await Rl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=S_((o=Xe(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function __(){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 pB(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 hB(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 mB(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 vB(e){await Rl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function x_(e,t){await uS({id:e,...t})}async function xm(){return dS()}async function A_(){try{const e=await vt("account/rateLimits/read");return yy(e)}catch(e){throw wa(e,"Failed to load account rate limits","account/rateLimits/read")}}function md(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=>gy(s,n,o)).filter(s=>s!==null)}}async function P_(){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 md(n==null?void 0:n.data)}async function Am(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to refresh accounts"));const n=Xe(t);return md(n==null?void 0:n.data)}async function I_(){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 E_(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 md(o==null?void 0:o.data)}async function R_(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=gy(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 M_(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 md(o==null?void 0:o.data)}const $_=3e4,cl=new Map;async function cf(e){const t=cl.get(e);if(t)return t;const n=(async()=>{const r=await vt("thread/resume",{threadId:e}),s=hd(r),a=jc(r,s);return{model:_c(r),modelProvider:vd(r),messages:a,inProgress:_p(r),activeTurnId:xp(r),hasMoreOlder:s>0,turnIndexByTurnId:Ap(r,s),externalSession:my(r)}})();cl.set(e,n);const o=globalThis.setTimeout(()=>{cl.get(e)===n&&cl.delete(e)},$_);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{cl.get(e)===n&&cl.delete(e)},2e3)}).catch(()=>{}),n}async function j_(e){await vt("thread/archive",{threadId:e})}async function L_(e){await vt("thread/unarchive",{threadId:e})}async function N_(e){await vt("thread/compact/start",{threadId:e})}async function O_(e,t){await vt("thread/name/set",{threadId:e,name:t})}async function uf(e,t){const n=await vt("thread/rollback",{threadId:e,numTurns:t});return jc(n,hd(n))}async function D_(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 F_(e,t,n){const o=await D_(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}function qf(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 U_(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 _c(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function vd(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 Pm(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=qf(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:_c(o),modelProvider:vd(o)}}catch(n){throw wa(n,"Failed to start a new thread","thread/start")}}async function Im(e,t,n){if(arguments.length<=1)try{const o=await vt("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=qf(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:U_(o),model:_c(o),messages:jc(o,hd(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=qf(s);if(!a)throw new Error("thread/fork did not return a thread id");return{threadId:a,model:_c(s),modelProvider:vd(s)}}catch(o){throw wa(o,`Failed to fork thread ${e}`,"thread/fork")}}function Em(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 B_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
41
+ `;for(const o of t)n+=`
42
+ ## ${o.label}: ${o.path}
43
+ `;return`${n}
44
+ ## My request for Codex:
45
+
46
+ ${e}
47
+ `}function q_(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function z_(e,t,n){var d;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?af(n):sf(n)};let r=null;try{r=await Ty()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:e==="plan"?af(n??(r==null?void 0:r.reasoningEffort)):sf(n??(r==null?void 0:r.reasoningEffort))};let a=[];try{a=await K_()}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"?af(n??(r==null?void 0:r.reasoningEffort)):sf(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 df(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=Em(U.trim());V&&v.push({label:q_(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:B_(t,_)}];for(const U of n){const V=U.trim();if(!V)continue;const K=Em(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 z_(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 H_(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 W_(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 Rm(){return await(await fetch("/codex-api/free-mode/status")).json()}async function Mm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function $m(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 ul(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 V_(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(OS)});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 G_(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 Ff(h)?[h]:[]}).filter((l,d,h)=>h.indexOf(l)===d):null,s=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:Ff(s)?s:null}}function jm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Cy(e={}){const t=e.includeProviderModels!==!1,n=t?await V_(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(jm);const o=await vt("model/list",{}),r=[];for(const s of o.data){const a=G_(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(jm(s));return r}async function K_(e={}){return(await Cy(e)).map(t=>t.id)}async function Ty(){const e=await vt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=VS(e.config.model_reasoning_effort),r=GS(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function Sy(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 Y_(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 _y(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 J_(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 Q_(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 gB(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=_y(h,l);v&&o.push(v)}}return o}async function yB(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=_y(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(Sy).filter(s=>s!==null):[],skills:Array.isArray(o.skills)?o.skills.map(Y_).filter(s=>s!==null):[],mcpServers:da(o.mcpServers??o.mcp_servers)}}async function wB(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(Sy).filter(r=>r!==null)}}async function bB(e){await vt("plugin/uninstall",{pluginId:e})}async function kB(e,t){await vt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function CB(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=J_(a,o);l&&t.push(l),o+=1}n=le(s.nextCursor??s.next_cursor)}while(n);return t}async function TB(e,t){await vt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function SB(){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=Q_(r);s&&e.push(s)}t=le(o.nextCursor??o.next_cursor)}while(t);return e}async function _B(){await vt("config/mcpServer/reload",{})}async function xB(e){const t=await vt("mcpServer/oauth/login",{name:e});return{authorizationUrl:le(t.authorizationUrl??t.authorization_url)??""}}async function AB(){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 PB(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 IB(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 EB(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 RB(){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 MB(){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 X_(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function Z_(){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:X_(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of km)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return km}function ex(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 tx(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 xy(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=tx(a);return l?[l]:[]});s.length>0&&(t[r]=s)}return t}async function ml(){return mc?zf(mc):(pu||(pu=nx().then(e=>(mc=e,e)).finally(()=>{pu=null})),zf(await pu))}async function nx(){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 ex(n.data)}function zf(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 Pp(){mc=null}async function Lm(){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 xy(n.data)}async function ox(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(xy(e))})).ok)throw new Error("Failed to save thread queue state")}async function rx(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 ax(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 sx(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 ix(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=Ay(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 Ay(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 lx(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 cx(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 ux(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 dx(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 fx(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:Ay(s.changedFiles)}}async function $B(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 wy(l)}async function px(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 s_(r)}async function jB(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 wy(n)}async function LB(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 Nm(){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 hx(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 Wi(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 mx(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await Wi(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 vx(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await Wi(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 Wi(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 ff(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=zf(e)}async function hu(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 Pp(),a}function gx(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function yx(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 wx(e,t){var v;const n=await fetch(gx(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=yx(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 bx(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 Wi(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&&Pp(),{path:l,importedSessions:typeof a.importedSessions=="number"?a.importedSessions:0}}async function kx(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Wi(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&&Pp(),s}async function Cx(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 Wi(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 Tx(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 Wi(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 Sx(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 Om(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():"";!_||vy(_)||d.push({path:_})}return d}async function _x(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 xx(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 Ax(){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 Px(){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 Ix(){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 mu(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 Ex(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function Rx(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 Mx(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function $x(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function jx(){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 Lx(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 Nx(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 Hf(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function Ox(e,t){const n=Hf(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 Dx(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=>Hf(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=Ox(l.path,r),h=Hf(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 Fx=6e4;async function vu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),Fx);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 Ux={},Bx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qx(e,t){return S(),I("svg",Bx,[...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 Qs=bt(Ux,[["render",qx]]),zx={},Hx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Wx(e,t){return S(),I("svg",Hx,[...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 gu=bt(zx,[["render",Wx]]),Vx={},Gx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Kx(e,t){return S(),I("svg",Gx,[...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 Wf=bt(Vx,[["render",Kx]]),Yx={},Jx={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Qx(e,t){return S(),I("svg",Jx,[...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 zi=bt(Yx,[["render",Qx]]),Xx={},Zx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function e1(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:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const Ip=bt(Xx,[["render",e1]]),t1={},n1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function o1(e,t){return S(),I("svg",n1,[...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 r1=bt(t1,[["render",o1]]),a1={},s1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function i1(e,t){return S(),I("svg",s1,[...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 Js=bt(a1,[["render",i1]]),Py="codex-web-local.ui-language.v1",l1={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.":"请通过线程或项目菜单添加自动化。"},Dm={en:"English","zh-CN":"简体中文"};function c1(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Py))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const gd=A(c1());function Iy(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Iy(gd.value);function u1(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function d1(e){gd.value=e,Iy(e),typeof window<"u"&&window.localStorage.setItem(Py,e)}function Ey(e,t){const n=gd.value==="zh-CN"?l1[e]??e:e;return u1(n,t)}function io(){return{uiLanguage:gd,uiLanguageOptions:[{value:"en",label:Dm.en},{value:"zh-CN",label:Dm["zh-CN"]}],t:Ey,setUiLanguage:d1}}const Ry="brutalstrikedevs@gmail.com",f1=20,p1=6500,Fm=1800,pf=12,Um=240,Bm=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,Sl=A([]);let qm=!1,hf=!1,mf=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 h1(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function m1(e,t){var o;const n=(o=t==null?void 0:t.method)==null?void 0:o.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function My(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function zm(e){return encodeURIComponent(e)}function v1(){return`mailto:${Ry}`}function g1(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
48
+ `).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
49
+
50
+ `).trim())??"";return e?e.length>Fm?`${e.slice(0,Fm)}
51
+ ...[truncated]`:e:"No visible page text captured."}function y1(e,t){const n=t.replace(/\r\n/g,`
52
+ `).replace(/[ \t]+/g," ").trim();return n?Bm.test(e)||Bm.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Um?`${n.slice(0,Um)}...[truncated, ${n.length} chars total]`:n:""}function Hm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,pf);for(let s=0;s<o;s+=1){const a=e.key(s);a&&n.push(`${a}=${y1(a,e.getItem(a)??"")}`)}const r=e.length>pf?`
53
+ ...${e.length-pf} more item(s)`:"";return`${t}:
54
+ ${n.join(`
55
+ `)||"empty"}${r}`}catch(n){return`${t}: unavailable (${My(lc(n))})`}}function w1(){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}`,Hm(window.localStorage,"localStorage"),Hm(window.sessionStorage,"sessionStorage")].join(`
56
+ `)}function $i(e){const t=e.message.trim();if(!t)return;const n=Sl.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()};Sl.value=[o,...Sl.value].slice(0,f1)}function $y(e=Sl.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.103",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(`
57
+ `),l=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${s}`,"","Browser/app state",w1(),"","Recent diagnostics",a||"No diagnostics captured.","","Visible page text",g1()].join(`
58
+ `).slice(0,p1),d=`Codex Web feedback: ${My((h=e[0])==null?void 0:h.message)}`;return`mailto:${Ry}?subject=${zm(d)}&body=${zm(l)}`}function b1(){typeof window>"u"||(window.location.href=$y())}function k1(){if(!(typeof window>"u")&&(qm||(qm=!0,window.addEventListener("error",e=>{$i({kind:"window-error",message:e.error?lc(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{$i({kind:"unhandled-rejection",message:lc(e.reason),url:window.location.href})})),!hf)){if(typeof window.fetch!="function"){$i({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{mf=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=h1(e),o=m1(e,t);try{const r=await mf(e,t);return r.ok||$i({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 $i({kind:"fetch-error",message:lc(r),url:n,method:o}),r}},hf=!0}catch(e){mf=null,hf=!1;try{$i({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${lc(e)}`,url:window.location.href})}catch{}}}}function Ep(){const e=X(()=>Sl.value.length>0);function t(n,o){$i({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:Sl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:b1,buildFeedbackMailto:$y,feedbackMailtoBase:v1}}const jy="codex-web-local.recycle-bin.v1";function Ly(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(jy);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 Wm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(jy,JSON.stringify(e))}catch{}}const is=A(Ly());function C1(){function e(){is.value=Ly()}function t(r){is.value=[{...r,archivedAtIso:new Date().toISOString()},...is.value.filter(s=>s.id!==r.id)],Wm(is.value)}function n(r){is.value=is.value.filter(s=>s.id!==r),Wm(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 L_(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 T1=["title","aria-label","disabled"],S1={key:1,class:"composer-dropdown-value"},_1={key:0,class:"composer-dropdown-search-wrap"},x1=["placeholder","onKeydown"],A1={class:"composer-dropdown-options",role:"listbox"},P1=["onClick"],I1={key:0,class:"composer-dropdown-empty"},E1=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())})}),bs(()=>{window.addEventListener("pointerdown",Te)}),Hi(()=>{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(pp(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ee("",!0),B.value?ee("",!0):(S(),I("span",S1,T(_.value),1)),Ie(Qs,{class:"composer-dropdown-chevron"})],10,T1),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",_1,[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,x1),[[an,h.value]])])):ee("",!0),p("ul",A1,[(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,P1)]))),128)),ye.value.length===0?(S(),I("li",I1,T(V.value),1)):ee("",!0)])],512)],6)):ee("",!0)],512))}}),or=bt(E1,[["__scopeId","data-v-355d3b00"]]),R1={},M1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $1(e,t){return S(),I("svg",M1,[...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 $u=bt(R1,[["render",$1]]),j1=["aria-label","onKeydown"],L1={class:"app-dialog-header"},N1={class:"app-dialog-title-wrap"},O1={class:"app-dialog-title"},D1={key:0,class:"app-dialog-subtitle"},F1=["aria-label","title"],U1={class:"app-dialog-body"},B1={key:0,class:"app-dialog-footer"},q1=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}),Hi(()=>{typeof window>"u"||window.removeEventListener("keydown",a)}),(l,d)=>(S(),tt(Zs,{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",L1,[p("div",N1,[p("h3",O1,T(e.title),1),e.subtitle?(S(),I("p",D1,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($u,{class:"app-dialog-close-icon"})],8,F1)]),p("div",U1,[rr(l.$slots,"default",{},void 0)]),l.$slots.footer?(S(),I("div",B1,[rr(l.$slots,"footer",{},void 0)])):ee("",!0)],42,j1)])):ee("",!0)]))}}),vf=bt(q1,[["__scopeId","data-v-d8f6ef3c"]]),z1={key:0,class:"sidebar-menu-row-left"},H1={class:"sidebar-menu-row-main"},W1={key:1,class:"sidebar-menu-row-right"},V1={key:0,class:"sidebar-menu-row-right-default"},G1={key:1,class:"sidebar-menu-row-right-hover"},K1=tn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Ck(),o=X(()=>!!n.left),r=X(()=>!!n.right),s=X(()=>!!n["right-hover"]),a=X(()=>r.value||s.value);return(l,d)=>(S(),tt(pp(t.as),Bg({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",z1,[rr(l.$slots,"left",{},void 0,!0)])):ee("",!0),p("span",H1,[rr(l.$slots,"default",{},void 0,!0)]),a.value?(S(),I("span",W1,[r.value?(S(),I("span",V1,[rr(l.$slots,"right",{},void 0,!0)])):ee("",!0),s.value?(S(),I("span",G1,[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"]))}}),Vs=bt(K1,[["__scopeId","data-v-36239f39"]]),Y1={},J1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Q1(e,t){return S(),I("svg",J1,[...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 Ju=bt(Y1,[["render",Q1]]),X1={},Z1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function eA(e,t){return S(),I("svg",Z1,[...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 Ny=bt(X1,[["render",eA]]),tA=["data-menu-open"],nA={class:"thread-left-stack"},oA=["data-state"],rA=["data-confirming","title"],aA={key:0,class:"thread-delete-confirm-label"},sA={class:"thread-row-title-wrap"},iA={class:"thread-row-title-line"},lA={class:"thread-row-title"},cA=["title"],uA={key:0,class:"thread-row-automation-count"},dA=["data-state"],fA={class:"thread-row-time"},pA=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(Vs,{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",nA,[n.showStatusIndicator?(S(),I("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,oA)):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",aA,T(n.confirmLabel),1)):(S(),tt(Ny,{key:1,class:"thread-icon"}))],8,rA)])]),right:yt(()=>[p("span",fA,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(Wf,{class:"thread-icon"})])],512)]),default:yt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:a[1]||(a[1]=lt(l=>o("select"),["stop"]))},[p("span",sA,[p("span",iA,[p("span",lA,T(n.thread.title),1),n.thread.hasWorktree?(S(),tt(Ju,{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(Js,{class:"thread-row-automation-icon"}),n.automationCount>1?(S(),I("span",uA,T(n.automationCount),1)):ee("",!0)],8,cA)):ee("",!0),n.thread.pendingRequestState?(S(),I("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},T(n.requestLabel),9,dA)):ee("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,tA))}}),yu=bt(pA,[["__scopeId","data-v-fac0242e"]]);function hA(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}const mA={key:0,class:"pinned-section"},vA={class:"thread-tree-header"},gA={key:0,class:"thread-list"},yA={class:"projects-section"},wA={class:"thread-tree-header"},bA=["aria-expanded","aria-label","title"],kA={class:"organize-menu-title"},CA=["data-active"],TA={key:0},SA=["data-active"],_A={key:0},xA=["data-active"],AA={key:0},PA={class:"organize-menu-title"},IA=["data-active"],EA={key:0},RA=["data-active"],MA={key:0},$A={key:0,class:"thread-tree-action-error"},jA={key:1,class:"thread-tree-no-results"},LA={key:2,class:"thread-tree-loading"},NA={key:3,class:"thread-list thread-list-global"},OA=["data-project-name","data-expanded","data-dragging"],DA={class:"project-icon-stack"},FA={class:"project-icon-folder"},UA={class:"project-icon-chevron"},BA=["data-dragging-handle","onMousedown"],qA=["title"],zA=["title"],HA={key:0,class:"thread-row-automation-count"},WA={class:"project-hover-controls"},VA=["onClick"],GA=["data-open-direction"],KA=["onClick"],YA=["onClick"],JA=["onClick"],QA=["onClick"],XA=["onClick"],ZA=["onClick"],eP={class:"project-menu-label"},tP=["onInput"],nP=["aria-label","title","onClick"],oP={key:0,class:"thread-list"},rP={class:"project-empty"},aP=["onClick"],sP={class:"chats-section"},iP={class:"thread-tree-header"},lP={class:"chats-section-actions"},cP=["aria-label","title"],uP={key:0,class:"thread-tree-no-results"},dP={key:1,class:"thread-list thread-list-global"},fP=["data-open-direction"],pP=["disabled","title"],hP=["placeholder","onKeydown"],mP={key:0,class:"recycle-bin-empty"},vP={key:1,class:"recycle-bin-list"},gP={class:"recycle-bin-item-copy"},yP={class:"recycle-bin-item-title"},wP={key:0,class:"recycle-bin-item-meta"},bP={class:"recycle-bin-item-time"},kP={class:"recycle-bin-item-actions"},CP=["disabled","onClick"],TP=["onClick"],SP={key:2,class:"recycle-bin-error",role:"alert"},_P=["aria-label"],xP={class:"rename-thread-title"},AP={class:"rename-thread-subtitle"},PP={key:0,class:"automation-target-picker"},IP={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},EP={class:"automation-target-dropdown"},RP=["aria-label"],MP=["onClick"],$P={class:"automation-thread-field"},jP={class:"automation-thread-label"},LP=["placeholder"],NP={class:"automation-thread-field"},OP={class:"automation-thread-label"},DP=["placeholder"],FP={class:"automation-thread-field"},UP={class:"automation-thread-label"},BP={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},qP={key:0,class:"automation-schedule-row"},zP={class:"automation-schedule-copy"},HP={key:1,class:"automation-schedule-row"},WP={class:"automation-schedule-copy"},VP={class:"automation-schedule-preview"},GP={class:"automation-thread-field"},KP={class:"automation-thread-label"},YP={key:2,class:"rename-thread-subtitle automation-thread-error"},JP={key:3,class:"rename-thread-subtitle automation-thread-notice"},QP={class:"rename-thread-actions"},XP=["disabled"],ZP=["disabled"],eI=["disabled"],tI=["disabled"],nI=4,Vm=6,Gm="codex-web-local.sidebar-section-expansion.v1",Km="codex-web-local.sidebar-chats-first.v1",Ym="codex-web-local.sidebar-chat-sort-mode.v1",Jm="codex-web-local.thread-view-mode.v1",Qm="codex-web-local.collapsed-projects.v1",oI=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}=Ep(),a=n,{records:l,loadRecords:d,recordArchivedThread:h,removeArchivedRecord:v,restoreArchivedThread:y}=C1(),_=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(oi(Km,!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(ks()),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(Qm);if(!w)return{};const k=JSON.parse(w);return!k||typeof k!="object"||Array.isArray(k)?{}:k}catch{return{}}}function ks(){return typeof window>"u"?"project":window.localStorage.getItem(Jm)==="chronological"?"chronological":"project"}function oi(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(Ym)==="created"?"created":"updated"}U.value=zo();function Ut(){if(!(typeof window>"u"))try{const w=JSON.parse(window.localStorage.getItem(Gm)||"{}");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(Gm,JSON.stringify({pinned:V.value,projects:K.value,chats:ye.value}))}Ut(),nt(U,w=>{typeof window>"u"||window.localStorage.setItem(Qm,JSON.stringify(w))},{deep:!0}),nt(ut,w=>{typeof window>"u"||window.localStorage.setItem(Jm,w)}),nt(we,w=>{typeof window>"u"||window.localStorage.setItem(Km,String(w))}),nt($e,w=>{typeof window>"u"||window.localStorage.setItem(Ym,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=>!Ku(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=>Ku(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&&$x(w)}),nt([nn,()=>o.isThreadListFullyLoaded],([w])=>{const k=hA(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 t_(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()}),bs(async()=>{const{threadIds:w}=await Mx(),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 y_()}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 ri(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&&(Cs(w),Ta())}function Qr(w){return fe.value===w}function Gn(w){if(fe.value!==w){fe.value=w,Ge();return}Cs(w),fe.value=""}function Cs(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)&&(Sm(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 ai(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 Vi(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=ii(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 si(){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 Ts(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 ii(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 w_()}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 k_({...C,projectName:k}):await b_({...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 li(){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 _m(k,C),await Gt()):(await Sm(w,C),oe.value=Ts(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 Ss(){const w=O.value,k=ue.value;if(!(!w||!k)){Fe.value=!0,pe.value="",se.value="";try{await C_(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:Vi,openAutomationCreatorFromPanel:si,openRenameThreadDialog:Xt,openRecycleBin:B});function dr(w){return w.includes("/")||w.includes("\\")}function Gi(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 ci(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(Tl(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(Tl(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 ui(w){ut.value=w,Qt.value=!1}function di(){we.value=!we.value}function Ki(w){$e.value=w}function _s(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),_s(w)}function fi(w){Ge(),Qt.value=!1,xe.value=w,ct.value="actions",Qe.value=no(w),_s(w)}function Ir(w){return o.projectDisplayNameById[w.projectName]??ci(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),_m(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 pS(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:Vm;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 xs(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=xs(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 pi(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",pi,{capture:!0}),window.addEventListener("blur",Qo)}function vr(){window.removeEventListener("pointerdown",$r,{capture:!0}),window.removeEventListener("focusin",pi,{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:Vm;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){hi({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,hi(w)}))}function hi(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)<nI)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&&As(w)}function As(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 Yi(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 Ps(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)})}),Hi(()=>{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",mA,[Ie(Vs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":V.value,onClick:zn},{left:yt(()=>[V.value?(S(),tt(Qs,{key:1,class:"thread-icon"})):(S(),tt(gu,{key:0,class:"thread-icon"}))]),default:yt(()=>[p("span",vA,T(g(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),V.value?(S(),I("ul",gA,[(S(!0),I(ze,null,_t($t.value,C=>(S(),tt(yu,{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":Ps(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",yA,[Ie(Vs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":K.value,onClick:po},{left:yt(()=>[K.value?(S(),tt(Qs,{key:1,class:"thread-icon"})):(S(),tt(gu,{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(Wf,{class:"thread-icon"})],8,bA),Qt.value?(S(),I("div",{key:0,class:"organize-menu-panel",onClick:k[4]||(k[4]=lt(()=>{},["stop"]))},[p("p",kA,T(g(r)("Organize")),1),p("button",{class:"organize-menu-item","data-active":ut.value==="project",type:"button",onClick:k[0]||(k[0]=C=>ui("project"))},[p("span",null,T(g(r)("By project")),1),ut.value==="project"?(S(),I("span",TA,"✓")):ee("",!0)],8,CA),p("button",{class:"organize-menu-item","data-active":ut.value==="chronological",type:"button",onClick:k[1]||(k[1]=C=>ui("chronological"))},[p("span",null,T(g(r)("Chronological list")),1),ut.value==="chronological"?(S(),I("span",_A,"✓")):ee("",!0)],8,SA),p("button",{class:"organize-menu-item","data-active":we.value,type:"button",onClick:di},[p("span",null,T(g(r)("Chats first")),1),we.value?(S(),I("span",AA,"✓")):ee("",!0)],8,xA),k[31]||(k[31]=p("div",{class:"organize-menu-separator"},null,-1)),p("p",PA,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=>Ki("created"))},[p("span",null,T(g(r)("Created")),1),$e.value==="created"?(S(),I("span",EA,"✓")):ee("",!0)],8,IA),p("button",{class:"organize-menu-item","data-active":$e.value==="updated",type:"button",onClick:k[3]||(k[3]=C=>Ki("updated"))},[p("span",null,T(g(r)("Updated")),1),$e.value==="updated"?(S(),I("span",MA,"✓")):ee("",!0)],8,RA),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",wA,T(g(r)("Projects")),1)]),_:1},8,["aria-expanded"]),K.value?(S(),I(ze,{key:0},[Ee.value?(S(),I("p",$A,T(Ee.value),1)):ee("",!0),dn.value&&ba.value.length===0?(S(),I("p",jA,T(g(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(S(),I("p",LA,T(g(r)("Loading threads...")),1)):Ha.value?(S(),I("ul",NA,[(S(!0),I(ze,null,_t(Dn.value,C=>(S(),tt(yu,{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":Ps(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(Vs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:D=>ke(C.projectName),onContextmenu:lt(D=>fi(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",DA,[p("span",FA,[wo(C.projectName)?(S(),tt(Ip,{key:0,class:"thread-icon"})):(S(),tt(r1,{key:1,class:"thread-icon"}))]),p("span",UA,[wo(C.projectName)?(S(),tt(gu,{key:0,class:"thread-icon"})):(S(),tt(Qs,{key:1,class:"thread-icon"}))])])]),right:yt(()=>[p("div",WA,[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(Wf,{class:"thread-icon"})],8,VA),_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,KA),p("button",{class:"project-menu-item",type:"button",onClick:D=>Zr(C.projectName)},T(g(r)("Export Project")),9,YA),p("button",{class:"project-menu-item",type:"button",onClick:D=>ai(C.projectName)},T(Ct(C.projectName)?g(r)("Manage automations…"):g(r)("Add automation…")),9,JA),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,QA)):ee("",!0),p("button",{class:"project-menu-item",type:"button",onClick:D=>Xr(C)},T(g(r)("Rename project")),9,XA),p("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:D=>Aa(C.projectName)},T(g(r)("Remove")),9,ZA)],64)):(S(),I(ze,{key:1},[p("label",eP,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,tP),[[an,Qe.value]])],64))],8,GA)):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(zi,{class:"thread-icon"})],8,nP)])]),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:Gi(C.projectName)},T(ci(C)),9,qA),Ct(C.projectName)?(S(),I("span",{key:0,class:"thread-row-automation-chip",title:mo(C.projectName)},[Ie(Js,{class:"thread-row-automation-icon"}),Fn(C.projectName)>1?(S(),I("span",HA,T(Fn(C.projectName)),1)):ee("",!0)],8,zA)):ee("",!0)],40,BA)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),oo(C)?(S(),I("ul",oP,[(S(!0),I(ze,null,_t(Yi(C),D=>(S(),tt(yu,{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":Ps(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(Vs,{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",rP,T(g(r)("No threads")),1)]),_:1})),Jt(C)?(S(),tt(Vs,{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,aP)]),_:2},1024)):ee("",!0)],12,OA))),128))],4))],64)):ee("",!0)]),p("section",sP,[Ie(Vs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":ye.value,onClick:Hn},{left:yt(()=>[ye.value?(S(),tt(Qs,{key:1,class:"thread-icon"})):(S(),tt(gu,{key:0,class:"thread-icon"}))]),right:yt(()=>[p("div",lP,[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(zi,{class:"thread-icon"})],8,cP)])]),default:yt(()=>[p("span",iP,T(g(r)("Chats")),1)]),_:1},8,["aria-expanded"]),ye.value&&In.value.length===0?(S(),I("p",uP,T(g(r)("No chats")),1)):ye.value?(S(),I("ul",dP,[(S(!0),I(ze,null,_t(Gr.value,C=>(S(),tt(yu,{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":Ps(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(Vs,{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(Zs,{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,pP),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,fP)):ee("",!0)])),Ie(vf,{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,hP),[[an,mt.value]])]),_:1},8,["open","title","subtitle"]),Ie(vf,{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(vf,{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",mP,T(g(r)("Recycle bin is empty.")),1)):(S(),I("ul",vP,[(S(!0),I(ze,null,_t(g(l),C=>(S(),I("li",{key:C.id,class:"recycle-bin-item"},[p("div",gP,[p("span",yP,T(C.title),1),C.projectName?(S(),I("span",wP,T(C.projectName),1)):ee("",!0),p("span",bP,T(ri(C.archivedAtIso)),1)]),p("div",kP,[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,CP),p("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:D=>g(v)(C.id)},T(g(r)("Delete permanently")),9,TP)])]))),128))])),P.value?(S(),I("p",SP,T(P.value),1)):ee("",!0)]),_:1},8,["open","title","subtitle"]),(S(),tt(Zs,{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",xP,T(ie.value==="edit"?g(r)("Edit automation"):g(r)("Add automation")),1),p("p",AP,T(It.value),1),re.value&&ie.value==="create"?(S(),I("div",PP,[k[36]||(k[36]=p("span",{class:"automation-thread-label"},"Target",-1)),p("div",IP,[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",EP,[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,MP))),128)),p("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:hn},T(g(r)("Add another automation")),1)],8,RP)):ee("",!0),p("label",$P,[p("span",jP,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,LP),[[an,Me.value.name]])]),p("label",NP,[p("span",OP,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,DP),[[an,Me.value.prompt]])]),p("div",FP,[p("span",UP,T(g(r)("Schedule")),1),p("div",BP,[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",qP,[p("span",zP,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",HP,[p("span",WP,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",VP,T(gt.value),1)]),p("div",GP,[p("span",KP,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",YP,T(pe.value),1)):se.value?(S(),I("p",JP,T(se.value),1)):ee("",!0),p("div",QP,[ie.value==="edit"&&$.value==="thread"?(S(),I("button",{key:0,class:"rename-thread-button",type:"button",disabled:ge.value||Fe.value,onClick:Ss},T(Fe.value?g(r)("Running…"):g(r)("Run now")),9,XP)):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:li},T(g(r)("Remove")),9,ZP)):ee("",!0),p("button",{class:"rename-thread-button",type:"button",disabled:ge.value||Fe.value,onClick:eo},T(g(r)("Cancel")),9,eI),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,tI)])],8,_P)])):ee("",!0)]))],2))}}),rI=bt(oI,[["__scopeId","data-v-2b934f6f"]]),aI={class:"content-header"},sI=["title"],iI={class:"content-actions"},lI=tn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(S(),I("header",aI,[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,sI),p("div",iI,[rr(t.$slots,"actions",{},void 0)])]))}}),cI=bt(lI,[["__scopeId","data-v-2f9df031"]]),Xm=.0025,gf=3,Zm=2,uI=256;function dI(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/(gf+Zm))),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*(gf+Zm);Te.globalAlpha=kt<=Xm?.35:1,Te.fillStyle=ft,Te.fillRect(te,et-ae,gf,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<Xm?0:At}_.push(Ye/Ue.length),_.length>uI&&_.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=[]}Hi(()=>{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 fI={},pI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function hI(e,t){return S(),I("svg",pI,[...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 mI=bt(fI,[["render",hI]]),vI={},gI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function yI(e,t){return S(),I("svg",gI,[...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 wI=bt(vI,[["render",yI]]),bI={},kI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function CI(e,t){return S(),I("svg",kI,[...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 TI=bt(bI,[["render",CI]]),SI={},_I={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function xI(e,t){return S(),I("svg",_I,[...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 AI=bt(SI,[["render",xI]]),PI=["aria-label"],II=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($c,{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,PI)):ee("",!0)]),_:3})],2))}}),Qu=bt(II,[["__scopeId","data-v-98990ef6"]]),EI=["aria-label"],RI={class:"composer-popover-group-label"},MI=["aria-selected","onMousedown"],$I={class:"thread-composer-slash-body"},jI={class:"thread-composer-slash-name"},LI={class:"thread-composer-slash-desc"},NI={class:"thread-composer-slash-kind"},OI={class:"composer-popover-group-label composer-popover-group-label--skills"},DI=["aria-selected","onMousedown"],FI=["aria-label","title"],UI={class:"thread-composer-slash-body thread-composer-slash-body--skill"},BI={class:"thread-composer-slash-skill-name"},qI={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},zI=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",RI,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",$I,[p("span",jI,T(P.id),1),p("span",LI,T(g(r)(P.description)),1)]),p("span",NI,T(d(P.kind)),1)],42,MI))),128))],64)):ee("",!0),l.value.length>0?(S(),I(ze,{key:1},[p("div",OI,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,FI),p("span",UI,[p("span",BI,T(P.displayName||P.id),1),p("span",qI,T(P.description),1)])],42,DI))),128))],64)):ee("",!0)],8,EI))}}),HI=bt(zI,[["__scopeId","data-v-310ede11"]]),WI=["data-streaming"],VI=["aria-expanded"],GI={class:"thread-composer-plan-panel-title"},KI={key:0,class:"thread-composer-plan-panel-badge"},YI={class:"thread-composer-plan-panel-progress"},JI=["title"],QI=["data-status"],XI={class:"thread-composer-plan-panel-latest-text"},ZI={class:"thread-composer-plan-panel-popover-content"},eE={class:"thread-composer-plan-panel-popover-scroll"},tE={class:"thread-composer-plan-panel-popover-head"},nE={class:"thread-composer-plan-panel-title"},oE={class:"thread-composer-plan-panel-progress"},rE={key:0,class:"thread-composer-plan-panel-popover-section"},aE={class:"thread-composer-plan-panel-section-label"},sE=["title"],iE={class:"thread-composer-plan-panel-popover-section"},lE={class:"thread-composer-plan-panel-section-label"},cE={class:"thread-composer-plan-panel-steps"},uE=["data-status"],dE=["data-status"],fE=["title"],pE={class:"thread-composer-plan-panel-popover-footer"},hE=["disabled","data-state"],mE=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(Qu,{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",GI,T(g(r)("Plan")),1),e.planPanel.streaming?(S(),I("span",KI,T(g(r)("Updating")),1)):ee("",!0),p("span",YI,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,QI)):ee("",!0),p("span",XI,T(((j=l.value)==null?void 0:j.step)??""),1)],8,JI),Ie(Qs,{class:"thread-composer-plan-panel-chevron"})],8,VI)]}),default:yt(()=>[p("div",ZI,[p("div",eE,[p("header",tE,[_[3]||(_[3]=p("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),p("span",nE,T(g(r)("Plan")),1),p("span",oE,T(a.value)+"/"+T(e.planPanel.steps.length),1)]),e.planPanel.explanation?(S(),I("section",rE,[p("p",aE,T(g(r)("Summary")),1),p("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},T(d.value),9,sE)])):ee("",!0),p("section",iE,[p("p",lE,T(g(r)("Steps"))+" ("+T(e.planPanel.steps.length)+")",1),p("ol",cE,[(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,dE),p("span",{class:"thread-composer-plan-panel-step-text",title:P.step},T(P.step),9,fE)],8,uE))),128))])])]),p("footer",pE,[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,hE)])])]),_:1},8,["open","aria-label"])],8,WI))}}),vE=bt(mE,[["__scopeId","data-v-b1cbf479"]]),gE={key:0,class:"thread-composer-attachments"},yE=["src"],wE=["src","alt"],bE=["aria-label","disabled","onClick"],kE={key:1,class:"thread-composer-folder-chips"},CE=["title"],TE={class:"thread-composer-folder-chip-meta"},SE=["aria-label","disabled","onClick"],_E={key:2,class:"thread-composer-file-chips"},xE=["title"],AE=["aria-label","disabled","onClick"],PE={key:3,class:"thread-composer-skill-chips"},IE=["title","aria-label","onClick"],EE=["aria-label","onClick"],RE=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",gE,[(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,yE)):(S(),I("img",{key:1,class:"thread-composer-attachment-image",src:v.url,alt:v.name||"Selected image"},null,8,wE)),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,bE)]))),128))])):ee("",!0),e.folderUploadGroups.length>0?(S(),I("div",kE,[(S(!0),I(ze,null,_t(e.folderUploadGroups,v=>(S(),I("span",{key:v.id,class:"thread-composer-folder-chip"},[Ie(Ip,{class:"thread-composer-folder-chip-icon"}),p("span",{class:"thread-composer-folder-chip-name",title:v.name},T(v.name),9,CE),p("span",TE,[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,SE)]))),128))])):ee("",!0),e.standaloneFileAttachments.length>0?(S(),I("div",_E,[(S(!0),I(ze,null,_t(e.standaloneFileAttachments,v=>(S(),I("span",{key:v.fsPath,class:"thread-composer-file-chip"},[Ie(zi,{class:"thread-composer-file-chip-icon"}),p("span",{class:"thread-composer-file-chip-name",title:v.fsPath},T(v.label),9,xE),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,AE)]))),128))])):ee("",!0),e.selectedSkills.length>0?(S(),I("div",PE,[(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,IE),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,EE)]))),128))])):ee("",!0)],64))}}),ME=bt(RE,[["__scopeId","data-v-acea11fd"]]),$E=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?Js: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))}}),jE=bt($E,[["__scopeId","data-v-05288bd3"]]),LE=["aria-label","disabled"],NE=["disabled"],OE=["disabled"],DE=["disabled"],FE={class:"thread-composer-attach-mode"},UE={class:"thread-composer-attach-mode-label"},BE={class:"thread-composer-attach-mode-buttons"},qE=["disabled"],zE=["disabled"],HE={class:"thread-composer-attach-mode"},WE={class:"thread-composer-attach-mode-label"},VE={class:"thread-composer-attach-mode-buttons"},GE=["disabled","onClick"],KE={class:"thread-composer-attach-mode"},YE={class:"thread-composer-attach-mode-label"},JE={class:"thread-composer-attach-mode-buttons"},QE=["disabled","onClick"],XE={key:0,class:"thread-composer-menu-error",role:"alert"},ZE={key:0,class:"thread-composer-approval-tip",role:"status"},eR=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(Qu,{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,LE)]),default:yt(()=>[p("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:a},T(g(o)("Add photos & files")),9,NE),p("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},T(g(o)("Add folder")),9,OE),p("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:d},T(g(o)("Take photo")),9,DE),_[5]||(_[5]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",FE,[p("span",UE,T(g(o)("In-progress send")),1),p("div",BE,[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,qE),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,zE)])]),e.isMobile?(S(),I(ze,{key:0},[_[3]||(_[3]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",HE,[p("span",WE,T(g(o)("Plan mode")),1),p("div",VE,[(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,GE))),128))])]),_[4]||(_[4]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",KE,[p("span",YE,T(g(o)("Approval policy")),1),p("div",JE,[(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,QE))),128))])]),e.approvalPolicyError?(S(),I("p",XE,T(e.approvalPolicyError),1)):ee("",!0),Ie($c,{name:"approval-tip"},{default:yt(()=>[e.approvalPolicyNotice?(S(),I("span",ZE,T(e.approvalPolicyNotice),1)):ee("",!0)]),_:1})],64)):ee("",!0)]),_:1},8,["open","aria-label"]))}}),tR=bt(eR,[["__scopeId","data-v-24be0643"]]),nR=/(^|\s)(\/[a-zA-Z]*)$/,ev=[{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 oR(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 rR(e){const t=e.match(nR);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function aR(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 sR={class:"thread-composer-main"},iR={class:"thread-composer-input-row"},lR={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},cR={class:"thread-composer-drop-overlay-copy"},uR={key:1,class:"composer-popover"},dR=["onMousedown"],fR={key:1,class:"thread-composer-file-mention-icon-markdown"},pR={class:"thread-composer-file-mention-text"},hR={class:"thread-composer-file-mention-name"},mR={key:0,class:"thread-composer-file-mention-dir"},vR={key:1,class:"thread-composer-file-mention-empty"},gR={key:2,class:"thread-composer-file-mention-empty"},yR=["placeholder","disabled"],wR=["aria-label","title","disabled"],bR={class:"thread-composer-actions"},kR=["aria-label","title","disabled"],CR={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},TR=["aria-label","title","disabled"],SR=["aria-label","disabled"],_R={class:"thread-composer-plan-trigger-label"},xR=["aria-checked","disabled","onClick"],AR={class:"thread-composer-menu-item-copy"},PR={class:"thread-composer-menu-item-title"},IR={key:0,class:"thread-composer-menu-item-sub"},ER={key:1,class:"thread-composer-menu-item-hint"},RR={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},MR=["aria-label","disabled"],$R={class:"thread-composer-approval-trigger-label"},jR=["aria-checked","disabled","onClick"],LR={class:"thread-composer-menu-item-copy"},NR={class:"thread-composer-menu-item-title"},OR={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},DR={key:0,class:"thread-composer-menu-error",role:"alert"},FR={key:0,class:"thread-composer-approval-tip",role:"status"},UR=["title","aria-label"],BR={class:"thread-composer-context-usage-value"},qR={key:0,class:"thread-composer-context-usage-compact"},zR=["disabled"],HR=["disabled"],WR=["disabled"],yf=12e3,VR=2e3,GR="codex-web-local.thread-draft.v1.",KR=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}=dI({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:M=>{if(a.value=a.value?`${a.value}
59
+ ${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}=Cp(),_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(ev),At=X(()=>[...ev,...oR(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(`
60
+ `).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<=yf){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-yf,Pe=Math.max(0,M-yf),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(`
61
+ `),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`${GR}${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 ks(M){if(M===o.selectedCollaborationMode){we.value=!1;return}r("update:selected-collaboration-mode",M),we.value=!1}function oi(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 vu(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 vu(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 vu(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 ri(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 vu(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;ri((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>=VR){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="",US(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=rR(ne);if(!Pe){xt();return}fe.value&&En(),Ae.value=Pe.startIndex,Ue.value=Pe.query,He.value=aR(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 DS([M],ne),at=ne,r("register-fuzzy-session",ne)),await FS(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 Om(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 Om(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()}
62
+ ${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 bs(()=>{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}),Hi(()=>{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(vE,{key:0,"plan-panel":e.planPanel,onImplementPlan:F[0]||(F[0]=ne=>M.$emit("implement-plan"))},null,8,["plan-panel"])):ee("",!0),Ie(ME,{"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",sR,[p("div",iR,[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",lR,[p("span",cR,T(g(s)("Drop images or files")),1)])):ee("",!0),fe.value?(S(),I("div",uR,[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",fR,"↓")):(S(),tt(zi,{key:2,class:"thread-composer-file-mention-icon-file"})),p("span",pR,[p("span",hR,T(xr(ne.path)),1),Go(ne.path)?(S(),I("span",mR,T(Go(ne.path)),1)):ee("",!0)])],42,dR))),128)):g(ae)?(S(),I("div",vR,T(g(s)("No searchable directory for this thread")),1)):(S(),I("div",gR,T(g(s)("No matching files")),1))])):ee("",!0),xe.value?(S(),tt(HI,{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,yR),[[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(TI,{key:0,class:"thread-composer-expand-icon"})):(S(),tt(wI,{key:1,class:"thread-composer-expand-icon"}))],8,wR)):ee("",!0)],34),p("div",bR,[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",CR)):(S(),tt(AI,{key:1,class:"thread-composer-stop-icon"}))],8,kR)):(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(mI,{class:"thread-composer-submit-icon"})],10,TR))])]),p("div",{class:Ke(["thread-composer-controls",{"thread-composer-controls--recording":Fe.value}])},[Ie(tR,{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:oi,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(Qu,{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",_R,T(G.value),1),Ie(Qs,{class:"thread-composer-plan-trigger-chevron"})],10,SR)]),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=>ks(ne.value)},[p("span",AR,[p("span",PR,T(g(s)(ne.labelKey)),1),ne.subLabel?(S(),I("span",IR,T(ne.subLabel),1)):ee("",!0),ne.disabled?(S(),I("span",ER,T(g(s)("Not supported by this Codex version")),1)):ee("",!0)]),e.selectedCollaborationMode===ne.value?(S(),I("span",RR,"✓")):ee("",!0)],10,xR))),128))]),_:1},8,["open","aria-label"])),g(ye)?ee("",!0):(S(),tt(Qu,{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",$R,T(ue.value),1),Ie(Qs,{class:"thread-composer-approval-trigger-chevron"})],10,MR)]),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",LR,[p("span",NR,T(g(s)(ne.label)),1)]),e.approvalPolicy===ne.value?(S(),I("span",OR,"✓")):ee("",!0)],10,jR)),64)),e.approvalPolicyError?(S(),I("p",DR,T(e.approvalPolicyError),1)):ee("",!0),Ie($c,{name:"approval-tip"},{default:yt(()=>[e.approvalPolicyNotice?(S(),I("span",FR,T(e.approvalPolicyNotice),1)):ee("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Ie(jE,{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",BR,T(Tt.value),1),H.value!=="healthy"?(S(),I("span",qR,T(g(s)("Compact")),1)):ee("",!0)],10,UR)):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,zR),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,HR),p("input",{ref_key:"folderPickerInputRef",ref:V,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:pe.value,onChange:cr},null,40,WR)],32))}}),tv=bt(KR,[["__scopeId","data-v-f340ad1d"]]),YR={class:"thread-pending-request-title"},JR=["title"],QR={class:"thread-pending-request-approval"},XR=["aria-label"],ZR=["aria-pressed","onClick"],eM={class:"thread-pending-request-option-index"},tM={class:"thread-pending-request-option-label"},nM={class:"thread-pending-request-footer thread-pending-request-footer--approval"},oM=["value","placeholder"],rM={key:0,class:"thread-pending-request-validation-error",role:"alert"},aM={class:"thread-pending-request-header"},sM={class:"thread-pending-request-heading"},iM={class:"thread-pending-request-eyebrow"},lM={class:"thread-pending-request-title"},cM={key:0,class:"thread-pending-request-counter"},uM={key:0,class:"thread-pending-request-preview"},dM={class:"thread-pending-request-preview-code"},fM={key:1,class:"thread-pending-request-validation-error",role:"alert"},pM={key:2,class:"thread-pending-request-user-input"},hM={key:0,class:"thread-pending-request-question-description"},mM=["href"],vM={class:"thread-pending-request-question-title"},gM={key:0},yM={key:0,class:"thread-pending-request-question-text"},wM={key:1,class:"thread-pending-request-input-wrap"},bM={class:"thread-pending-request-select-label"},kM=["type","value","onInput"],CM={key:2,class:"thread-pending-request-select-wrap"},TM={class:"thread-pending-request-select-label"},SM={key:3,class:"thread-pending-request-select-wrap"},_M={class:"thread-pending-request-select-label"},xM={key:4,class:"thread-pending-request-question-options"},AM=["checked","onChange"],PM={class:"thread-pending-request-checkbox-label"},IM={key:2,class:"thread-pending-request-validation-error"},EM={class:"thread-pending-request-footer"},RM={key:3,class:"thread-pending-request-user-input"},MM={class:"thread-pending-request-question-title"},$M={key:0,class:"thread-pending-request-question-text"},jM={key:1,class:"thread-pending-request-question-options"},LM={class:"thread-pending-request-select-wrap"},NM={class:"thread-pending-request-select-label"},OM={key:0,class:"thread-pending-request-question-description"},DM={key:2,class:"thread-pending-request-input-wrap"},FM={class:"thread-pending-request-select-label"},UM=["value","placeholder","onInput"],BM={class:"thread-pending-request-footer"},qM={key:4,class:"thread-pending-request-actions"},zM={key:5,class:"thread-pending-request-actions"},HM=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(Zs,{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",YR,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,JR)):ee("",!0),p("section",QR,[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",eM,T(me+1)+".",1),p("span",tM,T(Y.label),1)],10,ZR))),128))],8,XR),p("footer",nM,[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,oM)],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",rM,T(e.panelError),1)):ee("",!0)])],64)):(S(),I(ze,{key:1},[p("header",aM,[p("div",sM,[p("p",iM,T(we(e.request)),1),p("p",lM,T($e(e.request)),1)]),(e.requestCount??0)>1?(S(),I("span",cM,T(e.requestCount??0)+" "+T(g(y)("pending")),1)):ee("",!0)]),Le(e.request)?(S(),I("div",uM,[p("code",dM,T(Le(e.request)),1)])):ee("",!0),e.panelError?(S(),I("p",fM,T(e.panelError),1)):ee("",!0),e.request.method==="mcpServer/elicitation/request"?(S(),I("section",pM,[ft(e.request)?(S(),I("p",hM,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,mM)):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",vM,[ps(T(Y.label),1),Y.required?(S(),I("span",gM," *")):ee("",!0)]),Y.description?(S(),I("p",yM,T(Y.description),1)):ee("",!0),Y.kind==="string"||Y.kind==="number"?(S(),I("label",wM,[p("span",bM,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,kM)])):Y.kind==="boolean"?(S(),I("div",CM,[p("span",TM,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",SM,[p("span",_M,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",xM,[(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,AM),p("span",PM,T(me.label),1)]))),128))]))]))),128)),v.value?(S(),I("p",IM,T(v.value),1)):ee("",!0),p("footer",EM,[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",RM,[(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",MM,T(Y.header||Y.question),1),Y.question?(S(),I("p",$M,T(Y.question),1)):ee("",!0),Y.options.length>0?(S(),I("div",jM,[p("div",LM,[p("span",NM,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",OM,T(Qe(e.request.id,Y.id,Y.options)),1)):ee("",!0)])):ee("",!0),Y.isOther?(S(),I("label",DM,[p("span",FM,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,UM)])):ee("",!0)])}),128)),p("footer",BM,[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",qM,[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",zM,[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)]))}}),WM=bt(HM,[["__scopeId","data-v-371cca16"]]),VM={key:0,class:"queued-messages"},GM={class:"queued-messages-inner"},KM=["onDragstart","onDragover","onDragleave","onDrop"],YM=["aria-label","title"],JM={class:"queued-row-text"},QM={key:0,class:"queued-row-badge"},XM={class:"queued-row-actions"},ZM=["title","onClick"],e$=["title","onClick"],t$=["aria-label","title","onClick"],n$=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",VM,[p("div",GM,[(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,YM),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",JM,T(y(j)),1),j.awaitingCompaction?(S(),I("span",QM,T(g(o)("Compacts context before send")),1)):ee("",!0),p("div",XM,[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,ZM),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,e$),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,t$)])],42,KM))),128))])])):ee("",!0)}}),o$=bt(n$,[["__scopeId","data-v-89dd9f84"]]),r$={key:0,class:"rate-limit-status","aria-live":"polite"},a$=["title"],s$={class:"rate-limit-card-header"},i$={class:"rate-limit-card-title"},l$={key:0,class:"rate-limit-card-plan"},c$={class:"rate-limit-card-metrics"},u$={key:0,class:"rate-limit-card-footer"},d$=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(`
63
+ `)}return(U,V)=>e.snapshots.length>0?(S(),I("aside",r$,[(S(!0),I(ze,null,_t(e.snapshots,K=>(S(),I("div",{key:n(K),class:"rate-limit-card",title:ce(K)},[p("div",s$,[p("span",i$,T(o(K)),1),K.planType?(S(),I("span",l$,T(r(K.planType)),1)):ee("",!0)]),p("div",c$,[(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",u$,T(J(K).join(" | ")),1)):ee("",!0)],8,a$))),128))])):ee("",!0)}}),f$=bt(d$,[["__scopeId","data-v-d4640579"]]),p$=["aria-label"],h$=["aria-checked","onClick"],m$={class:"runtime-toggle-option-label"},v$=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:Ip},{value:"worktree",label:o("New worktree"),icon:Ju}];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(pp(d.icon),{class:"runtime-toggle-option-icon"})),p("span",m$,T(d.label),1)],10,h$)),64))],8,p$))}}),g$=bt(v$,[["__scopeId","data-v-0f175c28"]]),y$={},w$={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 b$(e,t){return S(),I("svg",w$,[...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 Oy=bt(y$,[["render",b$]]),k$={},C$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function T$(e,t){return S(),I("svg",C$,[...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 S$=bt(k$,[["render",T$]]),_$={class:"sidebar-thread-controls"},x$=["aria-label","title"],A$=["aria-label","title"],P$=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",_$,[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(S$,{key:0,class:"sidebar-thread-controls-icon"})):(S(),tt(Oy,{key:1,class:"sidebar-thread-controls-icon"}))],8,x$),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(zi,{class:"sidebar-thread-controls-icon"})],8,A$)):ee("",!0)]))}}),nv=bt(P$,[["__scopeId","data-v-2369affb"]]),I$={class:"sidebar-settings-account-section"},E$={class:"sidebar-settings-account-header"},R$={class:"sidebar-settings-account-header-main"},M$=["aria-expanded","title"],$$={class:"sidebar-settings-account-collapse-icon"},j$={class:"sidebar-settings-account-title"},L$={class:"sidebar-settings-account-count"},N$=["disabled"],O$={key:0,class:"sidebar-settings-account-error visible-error-with-feedback"},D$=["href"],F$={class:"sidebar-settings-account-login"},U$=["disabled"],B$=["href"],q$={key:1,class:"sidebar-settings-account-empty"},z$={key:2,class:"sidebar-settings-account-list"},H$=["title","onMouseenter","onMouseleave"],W$={class:"sidebar-settings-account-main"},V$={class:"sidebar-settings-account-email"},G$={class:"sidebar-settings-account-meta"},K$={class:"sidebar-settings-account-quota"},Y$={class:"sidebar-settings-account-id"},J$={class:"sidebar-settings-account-actions"},Q$=["disabled","onClick"],X$=["disabled","onClick"],Z$=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",I$,[p("div",E$,[p("div",R$,[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",$$,T(e.isAccountsSectionCollapsed?"▸":"▾"),1)],8,M$),p("span",j$,T(g(t)("Accounts")),1),p("span",L$,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,N$)]),e.isAccountsSectionCollapsed?ee("",!0):(S(),I(ze,{key:0},[e.accountActionError?(S(),I("div",O$,[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,D$)])):ee("",!0),p("div",F$,[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,U$),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,B$)):ee("",!0)]),e.accounts.length===0?(S(),I("p",q$,T(g(t)("Click Login, or run `codex login`, then click reload.")),1)):(S(),I("div",z$,[(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",W$,[p("p",V$,T(r.email||g(t)("Account")),1),p("p",G$,T(e.formatAccountMeta(r)),1),p("p",K$,T(e.formatAccountQuota(r)),1),p("p",Y$," Workspace "+T(e.shortAccountId(r.accountId)),1)]),p("div",J$,[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,Q$),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,X$)])],42,H$))),128))]))],64))]))}}),ej=bt(Z$,[["__scopeId","data-v-acc2fdca"]]);function tj(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 Dy(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!tj(e))throw new Error("Copy failed")}const nj={class:"right-git-panel"},oj={class:"rgp-review-label"},rj={class:"rgp-review-delta"},aj={class:"rgp-added"},sj={class:"rgp-removed"},ij={class:"rgp-state"},lj={class:"rgp-state-label"},cj={class:"rgp-state-value"},uj={key:0,class:"rgp-state-meta"},dj=["href"],fj={key:2,class:"rgp-section"},pj={class:"rgp-section-title"},hj={class:"rgp-file-list"},mj=["title","onClick"],vj={class:"rgp-file-status"},gj={class:"rgp-file-path"},yj={key:0,class:"rgp-file-previous-path"},wj={class:"rgp-section"},bj={class:"rgp-section-title"},kj={class:"rgp-search-wrap"},Cj=["placeholder"],Tj={class:"rgp-branches",role:"listbox"},Sj={class:"rgp-branch-row"},_j=["disabled","onClick"],xj={class:"rgp-branch-name"},Aj={key:0,class:"rgp-branch-meta"},Pj={key:1,class:"rgp-branch-meta"},Ij=["disabled","onClick"],Ej={key:0,class:"rgp-empty"},Rj={class:"rgp-section"},Mj={class:"rgp-section-title"},$j={class:"rgp-search-wrap"},jj=["placeholder"],Lj={class:"rgp-toggle-row"},Nj={class:"rgp-commit-list"},Oj={key:0,class:"rgp-empty"},Dj={key:1,class:"rgp-empty"},Fj={key:2,class:"rgp-empty is-error"},Uj=["disabled","title","onClick"],Bj={class:"rgp-commit-top"},qj=["title","onClick","onKeydown"],zj={class:"rgp-commit-meta"},Hj={key:0,class:"rgp-branch-meta"},Wj={class:"rgp-commit-subject"},Vj={key:0,class:"rgp-empty"},Gj={key:3,class:"rgp-section"},Kj={class:"rgp-section-title"},Yj=["title"],Jj=["disabled"],Qj={class:"rgp-commit-detail-subject"},Xj={class:"rgp-file-list"},Zj={key:0,class:"rgp-empty"},eL={key:1,class:"rgp-empty is-error"},tL=["title","onClick"],nL={class:"rgp-file-meta-row"},oL={class:"rgp-file-status"},rL={class:"rgp-file-delta"},aL={class:"rgp-added"},sL={class:"rgp-removed"},iL={class:"rgp-file-path"},lL={key:0,class:"rgp-file-previous-path"},cL={key:0,class:"rgp-empty"},uL=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}=Ep(),{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,Dy(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 bs(()=>{ae(),Wt(()=>{var te;return(te=r.value)==null?void 0:te.focus()})}),nt(()=>[n.currentBranch,n.branches.map(te=>te.value).join(`
64
+ `)],()=>{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",nj,[_.value?(S(),I("button",{key:0,class:"rgp-review",type:"button",onClick:oe[0]||(oe[0]=z=>o("toggleReview"))},[Ie(zi,{class:"rgp-review-icon"}),p("span",oj,T(e.reviewOpen?g(J)("Review Worktree Changes (Open)"):g(J)("Review Worktree Changes")),1),p("span",rj,[p("span",aj,"+"+T(e.worktreeChangeSummary.addedLineCount),1),p("span",sj,"-"+T(e.worktreeChangeSummary.removedLineCount),1)])])):ee("",!0),p("div",ij,[p("span",lj,T(e.detached?g(J)("Detached HEAD"):g(J)("Current branch")),1),p("span",cj,T(V.value),1),K.value?(S(),I("span",uj,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,dj)):ee("",!0)],2)):ee("",!0),n.worktreeChanges.length>0?(S(),I("div",fj,[p("div",pj,T(n.worktreeChanges.length)+" "+T(n.worktreeChanges.length===1?g(J)("file changed"):g(J)("files changed")),1),p("div",hj,[(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",vj,T(z.label),1),p("span",gj,T(z.path),1),z.previousPath?(S(),I("span",yj,"← "+T(z.previousPath),1)):ee("",!0)],8,mj))),128))])])):ee("",!0),p("div",wj,[p("div",bj,T(g(J)("Branches")),1),p("div",kj,[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,Cj),[[an,s.value]])]),p("ul",Tj,[(S(!0),I(ze,null,_t($e.value,z=>(S(),I("li",{key:z.value,class:"rgp-branch-item"},[p("div",Sj,[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",xj,T(z.label),1),z.value===e.currentBranch?(S(),I("span",Aj,T(g(J)("current")),1)):z.isRemote?(S(),I("span",Pj,T(g(J)("remote")),1)):ee("",!0)],10,_j),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,Ij)):ee("",!0)])]))),128)),$e.value.length===0?(S(),I("li",Ej,T(g(J)("No branches found.")),1)):ee("",!0)])]),p("div",Rj,[p("div",Mj,T(g(J)("Commits")),1),p("div",$j,[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,jj),[[an,a.value]])]),p("label",Lj,[Lt(p("input",{"onUpdate:modelValue":oe[4]||(oe[4]=z=>y.value=z),type:"checkbox",onChange:Ye},null,544),[[Kg,y.value]]),p("span",null,T(g(J)("Reset-history refs")),1)]),p("div",Nj,[l.value?e.commitsLoadingFor===je.value?(S(),I("div",Dj,T(g(J)("Loading commits...")),1)):e.commitsError?(S(),I("div",Fj,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",Bj,[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,qj),p("span",zj,[He(z)?(S(),I("span",Hj,T(g(J)("current")),1)):ee("",!0),p("span",null,T(z.date),1)])]),p("span",Wj,T(z.subject),1)],10,Uj))),128)),Ae.value.length===0?(S(),I("div",Vj,T(g(J)("No commits found.")),1)):ee("",!0)],64)):(S(),I("div",Oj,T(g(J)("Select a branch.")),1))])]),Te.value?(S(),I("div",Gj,[p("div",Kj,[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,Yj),p("button",{class:"rgp-reset-commit",type:"button",disabled:ye.value||Le.value||!l.value,onClick:et},T(g(J)("Reset")),9,Jj)]),p("p",Qj,T(Te.value.subject),1),p("div",Xj,[e.commitFilesLoadingFor===Te.value.sha?(S(),I("div",Zj,T(g(J)("Loading files...")),1)):e.commitFilesError?(S(),I("div",eL,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",nL,[p("span",oL,T(z.label),1),p("span",rL,[p("span",aL,"+"+T(ft(z.addedLineCount)),1),p("span",sL,"-"+T(ft(z.removedLineCount)),1)])]),p("span",iL,T(z.path),1),z.previousPath?(S(),I("span",lL,"← "+T(z.previousPath),1)):ee("",!0)],8,tL))),128)),xe.value.length===0?(S(),I("div",cL,T(g(J)("No file changes.")),1)):ee("",!0)],64))])])):ee("",!0)]))}}),dL=bt(uL,[["__scopeId","data-v-9fc96999"]]),fL={class:"right-files-panel"},pL={class:"rfp-toolbar"},hL=["placeholder"],mL={key:0,class:"rfp-empty"},vL={key:1,class:"rfp-empty is-error"},gL={key:2,class:"rfp-empty"},yL={key:3,class:"rfp-groups"},wL=["aria-expanded","onClick"],bL={class:"rfp-dir-chevron","aria-hidden":"true"},kL={class:"rfp-dir-icon","aria-hidden":"true"},CL={class:"rfp-dir-name"},TL=["title","onClick"],SL={class:"rfp-file-label"},_L=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 mx(U)}catch(V){s.value=[],l.value=V instanceof Error?V.message:"Failed to load workspace files"}finally{a.value=!1}}return bs(()=>{ce()}),nt(()=>n.cwd,()=>{h.value=new Set,d.value="",ce()}),(U,V)=>(S(),I("div",fL,[p("div",pL,[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,hL),[[an,d.value]])]),a.value?(S(),I("div",mL,T(g(r)("Loading files...")),1)):l.value?(S(),I("div",vL,T(l.value),1)):P.value.length===0?(S(),I("div",gL,T(g(r)("No files in workspace.")),1)):(S(),I("div",yL,[(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",bL,T(j(K.node.relativePath)?"▾":"▸"),1),p("span",kL,T(j(K.node.relativePath)?"📂":"📁"),1),p("span",CL,T(K.node.name),1)],8,wL)):(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",SL,T(K.node.name),1)],8,TL))],4))),128))]))]))}}),xL=bt(_L,[["__scopeId","data-v-686d6084"]]),AL={class:"right-file-preview"},PL={class:"right-file-preview-header"},IL={class:"right-file-preview-title-wrap"},EL={class:"right-file-preview-title"},RL={class:"right-file-preview-path"},ML=["href"],$L={class:"right-file-preview-body"},jL={key:0,class:"right-file-preview-empty"},LL={key:1,class:"right-file-preview-empty is-error"},NL=["src","alt"],OL={key:3,class:"right-file-preview-code"},DL={key:4,class:"right-file-preview-empty"},FL=["href"],UL={key:0,class:"right-file-preview-footer"},BL=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 vx(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",AL,[p("div",PL,[p("div",IL,[p("span",EL,T(e.name),1),p("span",RL,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,ML)]),p("div",$L,[r.value?(S(),I("div",jL,T(g(n)("Loading file…")),1)):s.value?(S(),I("div",LL,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,NL)):o.value&&o.value.isText&&o.value.content!==void 0?(S(),I("pre",OL,T(o.value.content),1)):(S(),I("div",DL,[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,FL)]))]),o.value&&o.value.truncated?(S(),I("div",UL,T(g(n)("File is large; showing the first part.")),1)):ee("",!0)]))}}),qL=bt(BL,[["__scopeId","data-v-0ac31186"]]),zL={},HL={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function WL(e,t){return S(),I("svg",HL,[...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 ov=bt(zL,[["render",WL]]),VL={},GL={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function KL(e,t){return S(),I("svg",GL,[...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 YL=bt(VL,[["render",KL]]),JL={},QL={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function XL(e,t){return S(),I("svg",QL,[...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 ZL=bt(JL,[["render",XL]]),eN={},tN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function nN(e,t){return S(),I("svg",tN,[...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 rv=bt(eN,[["render",nN]]);function Fy(e){var r;const t=e.replace(/\r\n/g,`
65
+ `).trim();if(!t)return null;const n=[],o=[];for(const s of t.split(`
66
+ `)){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=oN(t);return s||null}return{explanation:o.join(`
67
+ `).trim(),steps:n.filter(s=>s.step.length>0)}}function oN(e){var s,a;const t=[],n=[],o=[];for(const l of e.split(`
68
+ `)){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:rN(o.join(`
69
+ `)),steps:r.filter(l=>l.step.length>0)}}function rN(e){return e.split(`
70
+ `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
71
+ `).trim()}function av(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}:Fy(e.text)}function aN(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 sN(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 Uy="codex-web-local.thread-read-state.v1",sv="codex-web-local.thread-unread-cutoff.v1",By="codex-web-local.thread-token-usage.v1",qy="codex-web-local.thread-reasoning.v1",zy="codex-web-local.thread-last-plan.v1",Hy="codex-web-local.live-reasoning-snapshot.v1",iv=8e3,iN=15*60*1e3,lN=1500,lv="codex-web-local.stashed-messages.v1",cv="codex-web-local.auto-compact-threshold.v1",wu=10,Wy="codex-web-local.thread-terminal-open.v1",Vf="codex-web-local.selected-thread-id.v1",Gf="codex-web-local.selected-model-by-context.v1",Vy="codex-web-local.selected-model-id.v1",Gy="codex-web-local.project-order.v1",Ky="codex-web-local.project-display-name.v1",Kf="codex-web-local.collaboration-mode-by-context.v1",cN="codex-web-local.collaboration-mode.v1",ei="__new-thread__",Yy="__new-thread-provider__::",bu=220,uN=1e4,dN=500,fN=3e3,uv=2e3,pN=2e3,hN=2e3,mN=cy,dl="__global__",ca="gpt-5.4-mini",vN="big-pickle",dv="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",gN=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 fv(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function yN(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 wN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function pv(e){typeof window>"u"||window.localStorage.setItem(Uy,JSON.stringify(e))}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 ku(e){if(!(typeof window>"u")){try{window.localStorage.setItem(qy,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&Rx(t,n)}}function kN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function hv(e){if(!(typeof window>"u"))try{window.localStorage.setItem(zy,JSON.stringify(e))}catch{}}function CN(){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)){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 TN(){if(typeof window>"u")return"";const e=window.localStorage.getItem(sv);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(sv,t),t}function SN(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 _N(e,t,n){return SN(e,t??n)}function Jy(e){return e==="plan"?"plan":"default"}function El(e){return typeof e=="string"?e.trim():""}function fa(){return Object.create(null)}function ju(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 mv(e,t){let n=!1;const o=fa();for(const[r,s]of Object.entries(e)){if(r===ei||r.startsWith(Yy)||t.has(r)){o[r]=s;continue}n=!0}return n?o:e}function Gs(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function xN(e){return e===ei}function Cu(e){const t=Gs(e);return t?`${Yy}${t}`:""}function Fi(e){return e.trim()||ei}function AN(){if(typeof window>"u")return fa();try{const n=window.localStorage.getItem(Gf);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=El(a);l&&(r[s]=l)}return r}}catch{}const e=El(window.localStorage.getItem(Vy)),t=fa();return e&&(t[ei]=e),t}function vv(e,t){const n=Fi(t),o=El(e[n]);return o||El(e[ei])}function Tu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Gf):window.localStorage.setItem(Gf,JSON.stringify(e)),window.localStorage.removeItem(Vy)}catch{}}function PN(){if(typeof window>"u")return fa();try{const e=window.localStorage.getItem(Kf);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=Jy(r);s==="plan"&&(n[o]=s)}return n}}catch{}return fa()}function Su(e,t){const n=Fi(t);return Jy(e[n])}function gv(e,t,n){const o=Fi(t);if(xN(o))return vc(e,o);if(n==="plan"){const r=ju(e);return r[o]="plan",r}return vc(e,o)}function wf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Kf):window.localStorage.setItem(Kf,JSON.stringify(e)),window.localStorage.removeItem(cN)}catch{}}function Qy(e,t,n){return Math.min(Math.max(e,t),n)}function vl(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 yv(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:vl(t.totalTokens)??0,inputTokens:vl(t.inputTokens)??0,cachedInputTokens:vl(t.cachedInputTokens)??0,outputTokens:vl(t.outputTokens)??0,reasoningOutputTokens:vl(t.reasoningOutputTokens)??0}}function IN(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=yv(t.total),o=yv(t.last);if(!n||!o)return null;const r=vl(t.modelContextWindow),s=o.totalTokens,a=typeof r=="number"?Math.max(r-s,0):null,l=typeof r=="number"&&r>0?Qy(Math.round((a??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:s,remainingContextTokens:a,remainingContextPercent:l}}function EN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(By);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=IN(r);s&&(n[o]=s)}return n}catch{return{}}}function wv(e){typeof window>"u"||window.localStorage.setItem(By,JSON.stringify(e))}function RN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Wy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t))o&&typeof r=="boolean"&&(n[o]=r);return n}catch{return{}}}function MN(e){typeof window>"u"||window.localStorage.setItem(Wy,JSON.stringify(e))}function $N(){return typeof window>"u"?"":window.localStorage.getItem(Vf)??""}function jN(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Vf);return}window.localStorage.setItem(Vf,e)}}function LN(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Gy);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(Gy,JSON.stringify(e))}function NN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ky);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const s=typeof o=="string"?Hr(o):"";s.length>0&&typeof r=="string"&&(n[s]=r)}return n}catch{return{}}}function bv(e){typeof window>"u"||window.localStorage.setItem(Ky,JSON.stringify(e))}function fl(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 bf(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 ON(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 DN(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function FN(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 UN(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&FN(e.steps,t.steps)}function _u(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 Yf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&us(e.images,t.images)&&BN(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&DN(e.commandExecution,t.commandExecution)&&UN(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function gl(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 kv(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&&Yf(y,v)?y:v});if(n.preserveMissing!==!0)return gl(e,s)?e:s;const a=e.map(v=>{const y=r.get(v.id);return!y||Yf(v,y)?v:y}).filter(v=>!Rp(v)||!zN(v,t)),l=new Set(e.map(v=>v.id)),d=s.filter(v=>!l.has(v.id)),h=[...a,...d];return gl(e,h)?e:h}function BN(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 hs(e){return e.replace(/\s+/gu," ").trim()}function Rp(e){return e.messageType==="userMessage.optimistic"}function qN(e){return e.some(Rp)}function zN(e,t){if(e.role!=="user")return!1;const n=hs(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"||Rp(a))return!1;const l=hs(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 HN(e){const t=[];let n=new Map;for(const o of e){if(!(o.role==="assistant"&&typeof o.messageType=="string"&&(o.messageType==="agentMessage"||o.messageType==="agentMessage.live"))){o.role==="user"&&(n=new Map),t.push(o);continue}const s=hs(o.text);if(s.length===0){t.push(o);continue}const a=n.get(s);if(typeof a=="number"){t.splice(a,1);for(const[l,d]of n)d>a&&n.set(l,d-1);n.set(s,t.length),t.push(o)}else n.set(s,t.length),t.push(o)}return t}function WN(e,t){const n=new Set(t.map(s=>s.id)),o=new Set(t.filter(s=>s.role==="assistant").map(s=>hs(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=hs(s.text);return a.length===0?!1:!o.has(a)});return r.length===e.length?e:r}function xu(e,t){const n=e.findIndex(s=>s.id===t.id);if(n<0)return[...e,t];const o=e[n];if(Yf(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const Xy="worked";function zs(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function VN(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 GN(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function KN(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 YN(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${VN(e.durationMs)}`,messageType:Xy,turnId:e.turnId,durationMs:e.durationMs}}function JN(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function QN(e,t){const n=YN(t),o=e.filter(a=>a.messageType!==Xy),r=JN(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 XN(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 ZN(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 eO(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 tO(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 Cv(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 Au(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&&ZN(h,d)?h:d});return s&&s.projectName===r.projectName&&eO(s.threads,l)?s:{projectName:r.projectName,threads:l}});return tO(e,o)?e:o}function nO(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 qi(e){return Hr(e)}function oO(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function rO(e){const t=e.label||Hr(e.remotePath),n=oO(e.hostId);return n?`${t} ${n}`:t}function Zy(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function yd(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 Jf(e,t){const n=Zy(e);return yd(e).map(o=>{if(n.has(o))return o;const r=ot(o).trim(),s=qi(r);return t.has(s)?r:s})}function Lu(e,t){return ot(e).trim()===t||qi(e)===t}function aO(e,t){const n=new Set;for(const o of e.order)Lu(o,t)&&n.add(o);for(const o of e.active)Lu(o,t)&&n.add(o);for(const o of Object.keys(e.labels))Lu(o,t)&&n.add(o);return n}function sO(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 _=qi(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 yd(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 iO(e,t,n){const o=Jf(t,n);if(o.length===0)return e;const r=new Map(o.map((s,a)=>[s,a]));return[...e].sort((s,a)=>{if(Zf(s)||Zf(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 Qf(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);Xu(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;Xu(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 Xu(e){return e.includes("/.codex/worktrees/")}function lO(e,t){const n=Qf(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),Xu(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=Xu(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 cO(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=Zy(t);for(const a of yd(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=qi(l),h=n.has(d)?l:d;o.has(h)||(r.push({projectName:h,threads:[]}),o.add(h))}return r}const Xf=20;function Hs(e){const t=e.split(`
72
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Xf):"Untitled thread"}function uO(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Zf(e){return e.threads.some(t=>t.cwd.trim().length===0||Ku(t.cwd))}const Xs=new Map;let Nu=0;function kf(e,t){const n=`${e}:${t.id}`,o=Xs.get(n);return o!==void 0?o:(Nu+=1,Xs.set(n,Nu),Nu)}function dO(e){const t=`${e}:`;for(const n of[...Xs.keys()])n.startsWith(t)&&Xs.delete(n)}function Tv(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 fO(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&&Tv(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=Tv(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 pO(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)kf(e,a);return s.sort((a,l)=>kf(e,a)-kf(e,l))}function hO(e,t,n,o,r){const s=pO(e,o,t),a=[...t,...s],l=HN(a);return[...fO(l,n),...r]}function mO(){const e=A([]),t=A([]),n=A($N()),o=A({}),r=A({}),s=A(kN()),a=A({}),l=A({}),d=A(bN()),h=A({}),v=new Map,y=new Map,_=new Map,P=new Map,j=A({}),B=A({}),J=A({});let ce=CN(),U=!1,V=null;function K(){V===null&&(V=setTimeout(()=>{if(V=null,U&&(U=!1,typeof window<"u"))try{window.localStorage.setItem(Hy,JSON.stringify(ce))}catch{}U&&K()},lN))}function ye(i,u){if(!i||J.value[i]!==!0)return;const m=u.length>iv?u.slice(-iv):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>iN||(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(PN()),Qe=A(AN()),et=A(Su(ct.value,n.value)),ft=A(vv(Qe.value,n.value)),mt=A("medium"),kt=A("standard"),at=A(""),ae=A(""),te=A(wN()),oe=A(TN()),z=A(LN()),Be=A(NN()),$=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(EN()),Tn=A(RN()),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 ks(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 oi(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&&ks(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}),ri=X(()=>{const i=[],u=n.value;return u&&Array.isArray(rt.value[u])&&i.push(...rt.value[u]),Array.isArray(rt.value[dl])&&i.push(...rt.value[dl]),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=hs(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=hO(i,u,q,[m,R,E,b],Ne),pt=Se.value[i];return pt?QN(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(Fi(i)===ei){const m=Gs(at.value),b=Cu(m),R=b?El(Qe.value[b]):"";if(R)return R}return vv(Qe.value,i).trim()}function mo(i){const u=i.trim();return Gs(u?H.value[u]??at.value:at.value)}function Vo(i){return Ye.value[i.trim()]??mN}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&&jN(i),ft.value=Bt(sn(i)),Wn(ft.value),et.value=Su(ct.value,i),Hn=!1)}function Vn(i,u){const m=u.trim(),b=Fi(i),R=Gs(at.value),E=b===ei?Cu(R):"",L=E||b;if(m){const q=ju(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===Fi(n.value)?(ft.value=sn(n.value),yn(ft.value),Wn(ft.value)):yn(m),Tu(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=ju(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)),Tu(Qe.value)}function xr(i,u){const m=i.trim();if(!m)return;const b=Gs(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(Gs(m)!=="opencode-zen")return b;const E=sn(i).trim();return E&&!/^gpt-/i.test(E)?E:b&&!/^gpt-/i.test(b)?b:vN}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),wv(Tt.value);return}const b=Tt.value[m];if(b&&JSON.stringify(b)===JSON.stringify(u))return;Tt.value={...Tt.value,[m]:u},wv(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):ki(m))}function Ko(i){const u=i==="plan"?"plan":"default",m=Fi(n.value);Su(ct.value,n.value)===u&&et.value===u||(et.value=u,ct.value=gv(ct.value,m,u),wf(ct.value))}function Eo(i,u){const m=u==="plan"?"plan":"default";ct.value=gv(ct.value,i,m),i.trim()===n.value&&(et.value=m),wf(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 uf(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 cf(i);m.model&&vo(i,Go(i,m.model,m.modelProvider)),m.modelProvider&&xr(i,m.modelProvider),ie.value={...ie.value,[i]:!0}}await df(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 W_(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 Z_();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 Ty(),m=u.model.trim(),b=Gs(u.providerId);at.value=b;const R=mo(n.value),E=R!=="codex"&&R!=="custom",L=sn(n.value),q=await Cy({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=Cu(R),Ne=he?El(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=ju(Qe.value);it[he]=ft.value.trim();const Mt=Cu(b);Mt&&Mt!==he&&m&&(it[Mt]=m),Qe.value=it,Tu(Qe.value)}mt.value=En(ft.value,u.reasoningEffort),kt.value=u.speedMode}catch(u){fv(u)?ae.value=dv:ae.value=""}}async function jt(){if(Ao){await Ao;return}Ao=(async()=>{try{const i=await A_();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()},dN)}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()},fN);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:Hs(b.title)}))})):i.map(m=>({projectName:m.projectName,threads:m.threads.map(b=>{const R=u[b.id];return{...b,title:Hs(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 Cs(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=Cs(Qr(b.id)),q=n.value===b.id,Z=Ae.value[b.id]===!0,he=_N(b.updatedAtIso,te.value[b.id],oe.value);return{...b,inProgress:E,unread:!q&&!E&&(Z||he),pendingRequestState:L,...R?{externalSession:R}:{}}})}));e.value=Au(e.value,u)}function ai(i,u,m){const b=new Date().toISOString(),R=ot(u),E=Hr(R),L={id:i,title:Hs(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=fl(z.value,t.value);us(z.value,Z)||(z.value=Z,rc(z.value)),_n()}function Vi(i){const u=new Set(i.map(Z=>Z.id)),m=n.value.trim();m&&u.add(m);const b=mv(Qe.value,u);b!==Qe.value&&(Qe.value=b,ft.value=Bt(sn(n.value)),Tu(b));const R=mv(ct.value,u);R!==ct.value&&(ct.value=R,et.value=Su(R,n.value),wf(R));const E=kn(te.value,u);if(E!==te.value&&(te.value=E,pv(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(Xs.size>0)for(const Z of[...Xs.keys()]){const he=Z.indexOf(":"),Ne=he>0?Z.slice(0,he):"";u.has(Ne)||Xs.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===dl||u.has(Z))&&(q[Z]=he);rt.value=q}function si(i){const u=To(t.value).find(m=>m.id===i);u&&(te.value={...te.value,[i]:u.updatedAtIso},pv(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(GN(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),ki(i)),_n(),!u&&!ko()&&Jn&&gi())}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 Ts(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 ii(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};KN(m,L)||(be.value={...be.value,[i]:L})}function Zt(i,u,m={}){if(!i)return;const b=se.value[i],R=u?hs(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 li(i){var u;i&&(u=se.value[i])!=null&&u.transient&&Zt(i,null)}function Ss(){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,MN(m)}function Gi(){const i=n.value;i&&dr(i,!Tr.value)}function fr(i,u){const m=o.value[i]??[];gl(m,u)||(o.value={...o.value,[i]:u})}function ci(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]??[];gl(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]??[];gl(m,u)||(B.value={...B.value,[i]:u})}function ui(i,u){const m=r.value[i]??[];gl(m,u)||(r.value={...r.value,[i]:u})}function di(i,u){const m=r.value[i]??[],b=xu(m,u);ui(i,b),Ki(i,u)}function Ki(i,u){!i||!u||(s.value={...s.value,[i]:u},hv(s.value))}function _s(i,u){const m=a.value[i]??[];let b=xu(m,u);const R=hs(u.text);if(u.role==="assistant"&&R.length>0){const E=b.filter(L=>L.id===u.id||hs(L.text)!==R);E.length!==b.length&&(b=E)}_a(i,b)}function $l(i,u){const m=B.value[i]??[],b=xu(m,u);Va(i,b)}function fi(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]??"";fi(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},ku(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},ku(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},hv(s.value)}pr(i),dO(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(`
73
+ `).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?Qy(Math.round((L??0)/R*100),0,100):null;return{total:m,last:b,modelContextWindow:R,currentContextTokens:E,remainingContextTokens:L,remainingContextPercent:q}}function xs(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)||dl,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 pi(i){const u=i.threadId||dl,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||dl,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&&pi(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=zs(ke(b==null?void 0:b.startedAt))??zs(ke(u.startedAt))??zs(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=zs(ke(b==null?void 0:b.completedAt))??zs(ke(u.completedAt))??zs(i.atIso)??Date.now(),L=zs(ke(b==null?void 0:b.startedAt))??zs(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 hi(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 As(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(`
74
+ `).trim()}function Yi(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(`
75
+ `)?`
76
+
77
+ `:"";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 Ps(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:Fy(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"}}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=Uf(m.changes),Z=fy(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=xu(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 Is(i){return Nr.add(i),()=>{Nr.delete(i)}}function mi(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 vi(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 Es(i){var Vc,Gc,Kc,al,Yc,Jc;if(wn(i))return;if(oo(i),i.method==="turn/started"){const Re=cn(i);Re&&_.delete(Re)}if(gN.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"){Ms({force:!0});return}if(i.method==="hook/started"||i.method==="hook/completed"){Ji({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"?mi(Ot,ke(Re==null?void 0:Re.itemId),Uf(Re==null?void 0:Re.changes)):vi(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),Os=ke(Re==null?void 0:Re.threadName);if(Ot&&Os){const Qc=Hs(Os);W.value={...W.value,[Ot]:Qc},_n(),mu(Ot,Qc)}}if(i.method==="thread/compacted"){const Re=qe(i.params),Ot=ke(Re==null?void 0:Re.threadId);Ot&&($s(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=qS(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(yy(i.params));return}const u=xs(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&&li(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&&_u(new Error(q));if(L){gt.value[L.threadId];const Re=Xn.get(L.turnId);Re&&Xn.delete(L.turnId);const Ot=Un((Vc=qe(i.params))==null?void 0:Vc.durationMs)??Un((Kc=qe((Gc=qe(i.params))==null?void 0:Gc.turn))==null?void 0:Kc.durationMs)??(typeof L.startedAtMs=="number"?L.completedAtMs-L.startedAtMs:null)??(Re?L.completedAtMs-Re.startedAtMs:null),Os=typeof Ot=="number"?Math.max(0,Ot):0;ln(L.threadId,{turnId:L.turnId,durationMs:Os}),Ee.value[L.threadId]&&(Ee.value=St(Ee.value,L.threadId)),hn(L.threadId,!1),Gt(L.threadId,null),ii(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&&_u(new Error(R.message))&&(Re?ne(Re):go())}const Je=wo(i);Je&&(di(Je.threadId,Je.message),Gt(Je.threadId,{label:"Planning",details:((al=Je.message.plan)==null?void 0:al.steps.map(Re=>Re.step).slice(0,2))??[]}));const pt=Rr(i);pt&&(di(pt.threadId,pt.message),Gt(pt.threadId,{label:"Planning",details:[]}));const it=Ps(i);if(it&&(di(it.threadId,it.message),Gt(it.threadId,{label:"Planning",details:((Yc=it.message.plan)==null?void 0:Yc.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(Os=>Os.id===Mt.messageId),Ot=`${(Re==null?void 0:Re.text)??""}${Mt.delta}`;_s(b,{id:Mt.messageId,role:"assistant",text:Ot,messageType:"agentMessage.live"})}const Oa=w(i);Oa&&_s(b,Oa);const js=D(i);js&&_s(b,js),As(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 Ls=Yi(i);if(Ls&&(Jt(b,Ls.itemId,Ls.text),Xr(b)),Lr(i)){const Re=h.value[b]??"";Re.trim().length>0&&!Re.endsWith(`
78
+
79
+ `)&&fi(b,`${Re}
80
+
81
+ `)}ra(i);const os=Ce(i);os&&(Kt(b,os),Gt(b,{label:"Running command",details:[((Jc=os.commandExecution)==null?void 0:Jc.command)??""]}));const Ns=st(i);if(Ns){const Re=(j.value[b]??[]).find(Ot=>Ot.id===Ns.itemId);Re!=null&&Re.commandExecution&&Kt(b,{...Re,commandExecution:{...Re.commandExecution,aggregatedOutput:`${Re.commandExecution.aggregatedOutput}${Ns.delta}`}})}const Hc=Rt(i);Hc&&Kt(b,Hc);const Wc=$o(i);if(Wc&&$l(b,Wc),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),ii(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()},bu))}async function Lo(i,u){if(!po){po=!0;try{if(!u)return;const m=[];for(const b of yd(u)){const R=qi(b);m.includes(R)||m.push(R)}if(m.length>0){const b=u.projectOrder.length>0?fl(m,i):fl(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=[qi(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=qi(E),q=Hr(Tl(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=rO(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 Ix();if(Object.keys(u.titles).length>0){const m={};for(const[b,R]of Object.entries(u.titles))m[b]=Hs(R);W.value=m}}catch{}}async function Lc(){try{return await ml()}catch{return null}}function $a(i,u,m){const b=i.trim();if(b)return Hs(b);const R=m.map(E=>E.label.trim()).find(E=>E.length>0);return R?Hs(R):u.length>0?Hs("[Image]"):"Untitled thread"}async function Nc(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(),mu(i,q);return}const L=E.length>300?E.slice(0,300):E;try{const q=await Nx(L,m);if(!q||W.value[i])return;const Z=q.length>Xf?q.slice(0,Xf):q;W.value={...W.value,[i]:Z},_n(),mu(i,Z)}catch{}}function wd(i,u){const m=Qf(i,u),b=lO(i,u),R=cO(b,u,m);if(!u||u.order.length===0&&(u.remoteProjects??[]).length===0)return R;const E=new Set;for(const q of Jf(u,m))E.add(q);const L=R.filter(q=>E.has(q.projectName)?!0:Zf(q));return iO(L,u,m)}function ja(i,u){const m=wd(i,u),b=!!(u&&(u.order.length>0||u.projectOrder.length>0||(u.remoteProjects??[]).length>0)),R=u!=null&&u.projectOrder.length?fl(Jf(u,Qf(i,u)),m):fl(z.value,m);us(z.value,R)||(z.value=R,b||rc(z.value));const E=bf(m,z.value);Ts(new Set(To(E).map(Z=>Z.id)));const L=nO(t.value,E,J.value);t.value=Au(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(){ox(Or(de.value)).catch(()=>{})}async function Ol(){if(!xe){xe=!0;try{de.value=await Lm()}catch{}}}function Bn(i){$t=Cv($t,i),t.value=Cv(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 gi(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)},uN)}}async function Dr(i){if(!(Po||!Jn||ko())){Po=!0;try{const u=await Tm(Jn,e_());Jn=u.nextCursor,Pt=u.nextCursor===null,Nt.value=Pt,$t=No($t,u.groups),ja($t,i)}catch{}finally{Po=!1,Jn&&!ko()&&gi(i)}}}async function Rs(i={}){if(sr){await sr;return}i.force!==!0&&zo.value&&Date.now()-ba<pN||(sr=(async()=>{var u;zo.value||(Ze.value=!0);try{const[m,b]=await Promise.all([Tm(),Lc(),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||gi(b);const E=To(e.value);Vi(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)<uv;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)<uv;if(u.force===!0?!1:R&&(Ne||(Z.length===0||he===Z)&&J.value[i]!==!0)){si(i);return}const it=ie.value[i]!==!0?await cf(i):null,Mt=it??await lf(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:js,activeTurnId:ia,turnIndexByTurnId:wr}=Mt;G.value={...G.value,[i]:Mt.hasMoreOlder===!0},Sa(i,Oa),Qa(i,wr),hi(i);const Ls=o.value[i]??[],zc=kv(Ls,Oa,{preserveMissing:u.silent===!0||qN(Ls)});fr(i,zc);const os=a.value[i]??[];if(js){const Ns=WN(os,Oa);_a(i,Ns)}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,js),Mt.externalSession&&($e.value={...$e.value,[i]:Mt.externalSession}),li(i),ia?Ee.value={...Ee.value,[i]:ia}:Ee.value[i]&&(Ee.value=St(Ee.value,i)),js||Mo(i),si(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 n_(i,u),b=o.value[i]??[],R=kv(m.messages,b,{preserveMissing:!0});fr(i,R),Qa(i,{...re.value[i]??{},...m.turnIndexByTurnId}),hi(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 yi(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 Ms(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<hN||(Yn=(async()=>{try{Y.value=await Dx(u?[u]:void 0),Ha=!0,In=Date.now(),Gr=m}catch{}finally{Yn=null}})(),await Yn)}async function Ji(i={}){if(lr){await lr;return}i.force!==!0&&Dn||(We.value=!0,lr=(async()=>{try{Oe.value=await c_(),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(),Ms()])}function Dl(i={}){const u=()=>{La(i)};if(typeof window>"u"){u();return}window.setTimeout(u,0)}async function wi(i={}){ut.value="",ae.value="";const u=i.includeSelectedThreadMessages!==!1,m=i.awaitAncillaryRefreshes===!0;try{if(await Ol(),await Rs({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",fv(b)?ae.value=dv:ae.value=""}}async function Na(i){fn(i);try{return await sa(i),await Xt({includeProviderModels:!0}),Ms(),"ok"}catch(u){const m=u instanceof Error?u.message:"Unknown application error";ut.value=m;const b=yN(u)?"not-found":"error";return i.trim()&&Zt(i,m,{transient:!0}),b}}async function Fl(i){const u=n.value===i,m=u?sN(To(e.value),i):"";u&&(fn(m),m&&sa(m,{silent:!0}));try{await j_(i),Bn(i),await Rs(),u&&m&&n.value===m&&await yi(m,{silent:!0})}catch(b){ut.value=b instanceof Error?b.message:"Unknown application error"}}async function Qi(i,u){const m=u.trim();if(!(!i||!m))try{await O_(i,m),W.value={...W.value,[i]:m},_n(),mu(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 Im(u,b||void 0,E||void 0),he=Z.threadId.trim();return he?(ai(he,b,R),vo(he,Z.model),ie.value={...ie.value,[he]:!0},fn(he),await Rs(),await sa(he),he):""}catch(Z){return ut.value=Z instanceof Error?Z.message:"Unknown application error",""}}async function bi(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 Im(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=uO((E==null?void 0:E.title)||(E==null?void 0:E.preview)||"Untitled thread");ai(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 uf(Z,Je);fr(Z,pt)}return await Qi(Z,Ne),fn(Z),Rs().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:ol({id:q.id,result:{answers:{[Z[0]]:{answers:[u.trim()]}}}})}function Rn(){if(typeof window>"u")return{};try{const i=window.localStorage.getItem(lv);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(lv,JSON.stringify(je.value))}function ts(){if(typeof window>"u")return wu;try{const i=window.localStorage.getItem(cv);if(i===null)return wu;const u=Number(i);return Number.isFinite(u)&&u>=0?Math.round(u):wu}catch{return wu}}function Oc(i){const u=Number.isFinite(i)&&i>0?Math.round(i):0;u!==fe.value&&(fe.value=u,!(typeof window>"u")&&window.localStorage.setItem(cv,String(u)))}async function bd(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 ki(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 Xi(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments,void 0,b.collaborationMode)}catch{}}finally{Te=!1}}async function Xi(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 bd(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,Zi(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 Zi(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 Ci(i,u,m=[],b=[],R=[]){if(co.value)return"";const E=i.trim(),L=u.trim(),q=sn(ei).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 Pm(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&&_u(it)){await go();const Mt=await Pm(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"";ai(he,L,E||"[Image]"),ci(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 Zi(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}),Nc(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 Zi(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&&oi(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 cf(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 df(i,u,he,pt||void 0,L||void 0,b.length>0?b:void 0,R,q)}catch(Mt){if(pt&&pt!==ca&&_u(Mt))await go(i),M(i,{text:Z,imageUrls:[...he],skills:Ne,fileAttachments:Je,effort:L,collaborationMode:q,fallbackRetried:!0}),it=await df(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 el(i){if(Le.value[i]!==!0){Le.value={...Le.value,[i]:!0};try{de.value=await Lm()}catch{}finally{Le.value=St(Le.value,i)}}}function Bl(i){el(i),!(typeof window>"u")&&window.setTimeout(()=>{el(i)},650)}async function Dc(){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 lf(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 H_(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},ku(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 kd(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 Dc();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 F_(u,i,he);const Ne=await uf(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 $s(i,u){const m=new Set(fo.value);u?m.add(i):m.delete(i),fo.value=m}function tl(i){Qt=i.trim(),Cr.value=[]}async function zl(i){const u=i.trim();if(!(!u||fo.value.has(u))){$s(u,!0),yr(u,"pending");try{await N_(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 lf(u)).messages.some(Z=>Z.messageType==="compaction.done")){$s(u,!1),n.value===u&&await sa(u,{silent:!0,force:!0}),yr(u,"done"),ki(u);break}E+=1,await aN(m)}fo.value.has(u)&&($s(u,!1),yr(u,"done"),ki(u))}catch(m){ut.value=m instanceof Error?m.message:"Failed to compact thread",$s(u,!1),yr(u,"done"),ki(u)}}}let mn=null;async function nl(i,u){try{const m=await ml(),b={...m.labels};let R=!1;for(const E of m.order){if(!Lu(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 ff({order:m.order,labels:b,active:m.active,projectOrder:m.projectOrder})}catch{}}function Cd(i,u){i.length===0||(Be.value[i]??"")===u||(Be.value={...Be.value,[i]:u},bv(Be.value),mn!==null&&clearTimeout(mn),mn=setTimeout(()=>{mn=null,nl(i,u)},500))}async function Ti(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,bv(L)}_n();const m=To(e.value);Vi(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 ml();aO(L,i).forEach(q=>{R.add(q)})}catch{}if(R.size>0)try{const L=await ml(),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 ff({order:q,labels:XN(L.labels,R),active:he,projectOrder:L.projectOrder.filter(Ne=>Ne!==i&&!R.has(Ne))});return}catch{}await Si()}function Td(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=ON(m,b,R);if(E===m)return;const L=fl(E,t.value);z.value=L,rc(z.value);const q=bf(t.value,z.value);t.value=Au(t.value,q),_n(),Si()}function Fc(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=bf(t.value,z.value);t.value=Au(t.value,b),_n(),Si()}async function Si(){try{const i=await ml(),u=sO(i,z.value,t.value);await ff({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()},bu));return}gn.value=!0;const i=nn,u=Kr,m=new Set(Yt);nn=!1,Kr=!1,Yt.clear();try{i&&await Rs({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()},bu))}}async function Uc(){await qc(),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()},bu))}function Bc(){typeof window>"u"||Ut||(qc(),Sd(),Ut=T_(i=>{if(i.method==="ready"){Ss(),Uc();return}if(i.method==="externalSessionChanged"){Hl(i);return}Es(i),Ma(i)}))}async function qc(){try{const u=(await xm()).map(m=>Ka(m)).filter(m=>m!==null);vr(u)}catch{}}async function Sd(){try{const i=await Ex(),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,ku(m))}catch{}}async function ol(i){try{return await x_(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 xm();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 _d(){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(),Xs.clear(),Nu=0,ge.value={},Fe.value={},Me.value={},de.value={},Le.value={},je.value={},gr(),aa(),It.value=null,Tt.value={}}const _i=X(()=>{const i=n.value;if(!i)return[];const u=de.value[i]??[];return[...(je.value[i]??[]).map(R=>({...R,awaitingCompaction:!0})),...u]});function rl(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){rl(i),Ko(b.collaborationMode),Te=!0,Xi(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&&(rl(i),Ko(E.collaborationMode),Xi(E.text,E.imageUrls,E.skills,"steer",E.fileAttachments))}function xd(i,u={}){fn(i,u)}return{projectGroups:e,projectDisplayNameById:Be,selectedThread:ho,selectedThreadTokenUsage:cr,selectedThreadTerminalOpen:Tr,isSelectedThreadInterruptPending:Sr,selectedThreadServerRequests:ri,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:tl,error:ut,refreshAll:wi,refreshSkills:Ms,refreshHooks:Ji,hooksList:Oe,isHooksLoading:We,onRealtimeEvent:Is,selectThread:Na,loadMessages:sa,loadOlderMessages:Fr,ensureThreadMessagesLoaded:yi,setThreadTerminalOpen:dr,toggleSelectedThreadTerminal:Gi,archiveThreadById:Fl,compactThreadById:zl,renameThreadById:Qi,forkThreadById:Ul,forkThreadFromTurn:bi,rollbackSelectedThread:kd,sendMessageToSelectedThread:Xi,sendMessageToNewThread:Ci,interruptSelectedThreadTurn:Dc,interruptedUnsubmittedMessage:ur,clearInterruptedUnsubmittedMessage:ql,selectedThreadQueuedMessages:_i,removeQueuedMessage:rl,reorderQueuedMessage:Vl,steerQueuedMessage:ns,autoCompactThreshold:fe,setAutoCompactThreshold:Oc,setSelectedCollaborationMode:Ko,readModelIdForThread:sn,setSelectedModelIdForThread:Vn,setSelectedModelId:Zn,setSelectedReasoningEffort:Pe,updateSelectedSpeedMode:Ge,respondToPendingServerRequest:ol,pendingReplyErrorForRequest:Xo,renameProject:Cd,removeProject:Ti,reorderProject:Td,pinProjectToTop:Fc,startPolling:Bc,stopPolling:_d,primeSelectedThread:xd}}const vO={class:"sidebar-root"},gO=["aria-pressed","aria-label","title"],yO={key:1,class:"sidebar-search-bar"},wO=["placeholder"],bO=["aria-label"],kO={class:"sidebar-skills-link-icon","aria-hidden":"true"},CO={class:"sidebar-skills-link-copy"},TO={class:"sidebar-skills-link-title"},SO={class:"sidebar-skills-link-subtitle"},_O={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},xO={class:"sidebar-skills-link-copy"},AO={class:"sidebar-skills-link-title"},PO={class:"sidebar-skills-link-subtitle"},IO=["aria-label"],EO={class:"settings-dialog-header"},RO={class:"settings-dialog-title"},MO=["aria-label","title"],$O={class:"settings-dialog-body"},jO=["aria-label"],LO=["aria-current","onClick"],NO={class:"settings-group-content"},OO=["title"],DO={class:"sidebar-settings-label"},FO=["title"],UO={class:"sidebar-settings-label"},BO={class:"sidebar-settings-value"},qO=["title"],zO={class:"sidebar-settings-label"},HO={class:"sidebar-settings-value"},WO=["title"],VO={class:"sidebar-settings-label"},GO=["title"],KO={class:"sidebar-settings-label"},YO={class:"sidebar-settings-value"},JO=["title"],QO={class:"sidebar-settings-label"},XO=["title"],ZO={class:"sidebar-settings-label"},e2=["title"],t2={class:"sidebar-settings-label"},n2=["title"],o2={class:"sidebar-settings-label"},r2=["href"],a2={class:"sidebar-settings-label"},s2={class:"sidebar-settings-value"},i2=["title"],l2={class:"sidebar-settings-label"},c2={key:0,class:"sidebar-settings-row sidebar-settings-error"},u2=["href"],d2={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},f2={class:"sidebar-settings-provider-info"},p2={class:"sidebar-settings-label"},h2={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},m2={class:"sidebar-settings-key-group"},v2={class:"sidebar-settings-key-masked"},g2=["disabled","title"],y2=["placeholder"],w2=["disabled"],b2={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},k2={class:"sidebar-settings-label"},C2=["aria-label"],T2=["disabled"],S2=["disabled"],_2={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},x2={class:"sidebar-settings-provider-info"},A2={class:"sidebar-settings-label"},P2={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},I2={class:"sidebar-settings-key-group"},E2=["placeholder"],R2=["disabled"],M2={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},$2={class:"sidebar-settings-label"},j2={class:"sidebar-settings-key-group"},L2=["placeholder"],N2={class:"sidebar-settings-label",style:{"margin-top":"4px"}},O2={class:"sidebar-settings-key-group"},D2=["placeholder"],F2=["disabled"],U2={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},B2={class:"sidebar-settings-label"},q2=["aria-label"],z2={class:"sidebar-settings-label"},H2={class:"sidebar-settings-value"},W2={key:0,class:"sidebar-settings-telegram-panel"},V2={class:"sidebar-settings-field"},G2={class:"sidebar-settings-field-label"},K2={class:"sidebar-settings-field"},Y2={class:"sidebar-settings-field-label"},J2={class:"sidebar-settings-field-help"},Q2={key:0,class:"sidebar-settings-telegram-error"},X2=["href"],Z2={class:"sidebar-settings-telegram-actions"},eD=["disabled"],tD={class:"sidebar-settings-hooks-section"},nD={class:"sidebar-settings-hooks-header"},oD={class:"sidebar-settings-hooks-title"},rD=["disabled","title"],aD={key:0,class:"sidebar-settings-hooks-empty"},sD={key:0,class:"sidebar-settings-hooks-empty"},iD={key:1,class:"sidebar-settings-hooks-empty"},lD={key:2,class:"sidebar-settings-hooks-list"},cD={class:"sidebar-settings-hooks-cwd"},uD={class:"sidebar-settings-hooks-event"},dD={class:"sidebar-settings-hooks-command"},fD={class:"sidebar-settings-remote-section"},pD={class:"sidebar-settings-remote-header"},hD={class:"sidebar-settings-remote-title"},mD=["disabled","title"],vD={class:"sidebar-settings-remote-toggle-label"},gD={key:0,class:"sidebar-settings-remote-empty"},yD={key:0,class:"sidebar-settings-remote-error"},wD={key:1,class:"sidebar-settings-remote-notice"},bD={key:2,class:"sidebar-settings-remote-empty"},kD=["disabled"],CD={class:"sidebar-settings-remote-label"},TD={class:"sidebar-settings-remote-value"},SD={class:"sidebar-settings-remote-clients"},_D={class:"sidebar-settings-remote-clients-header"},xD={class:"sidebar-settings-remote-label"},AD=["disabled"],PD={key:0,class:"sidebar-settings-remote-empty"},ID={class:"sidebar-settings-remote-client-name"},ED=["disabled","onClick"],RD={class:"sidebar-settings-rate-limits"},MD=["aria-label"],$D={class:"sidebar-settings-actions"},jD=["title","aria-label"],LD=["title","aria-label"],ND={class:"content-root-wrap"},OD={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},DD={key:1,class:"skills-route-header-icon","aria-hidden":"true"},FD={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},UD=["aria-label","title"],BD={class:"content-body"},qD={key:2,class:"content-grid content-grid-home"},zD={class:"new-thread-empty"},HD={class:"new-thread-hero"},WD=["title"],VD={class:"new-thread-folder-actions"},GD=["disabled"],KD={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},YD={class:"new-thread-launch-card-copy"},JD={class:"new-thread-launch-card-topline"},QD={class:"new-thread-launch-card-badge","aria-hidden":"true"},XD={class:"new-thread-launch-card-eyebrow"},ZD={class:"new-thread-launch-card-title"},eF={class:"new-thread-launch-card-text"},tF={class:"new-thread-launch-card-actions"},nF=["aria-label","onKeydown"],oF={class:"new-thread-open-folder-header"},rF={class:"new-thread-open-folder-title"},aF={class:"new-thread-open-folder-label"},sF={class:"new-thread-open-folder-current"},iF=["placeholder","title","disabled","onKeydown"],lF=["disabled"],cF={class:"new-thread-open-folder-actions"},uF={class:"new-thread-open-folder-toggle"},dF=["aria-pressed","disabled"],fF={key:0,class:"new-thread-open-folder-create"},pF={class:"new-thread-open-folder-create-composer"},hF=["placeholder","onKeydown"],mF=["disabled"],vF={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},gF=["href"],yF=["placeholder","onKeydown"],wF={key:1,class:"new-thread-open-folder-error-actions"},bF={class:"new-thread-open-folder-error visible-error-with-feedback"},kF=["href"],CF=["disabled"],TF={key:2,class:"new-thread-open-folder-status"},SF={key:3,class:"new-thread-open-folder-status"},_F={key:4,class:"new-thread-open-folder-list"},xF=["title","disabled","onClick"],AF={class:"new-thread-open-folder-item-name"},PF=["disabled","onClick"],IF=["aria-label","onKeydown"],EF={class:"new-thread-open-folder-header"},RF={class:"new-thread-open-folder-title"},MF=["disabled"],$F=["aria-label"],jF=["aria-selected","disabled"],LF=["aria-selected","disabled"],NF={class:"new-thread-project-field"},OF={class:"new-thread-open-folder-label"},DF=["disabled","placeholder"],FF={key:0,class:"new-thread-project-field"},UF={class:"new-thread-open-folder-label"},BF=["disabled","placeholder","onKeydown"],qF={key:1,class:"new-thread-project-field"},zF={class:"new-thread-open-folder-label"},HF=["disabled","onKeydown"],WF={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},VF=["href"],GF={class:"new-thread-project-modal-actions"},KF=["disabled"],YF=["disabled"],JF={key:3,class:"new-thread-branch-select"},QF={class:"new-thread-branch-select-label"},XF={class:"new-thread-branch-select-help"},ZF={key:4,class:"new-thread-runtime-help"},eU={class:"worktree-init-status-title"},tU={class:"worktree-init-status-message"},nU={class:"composer-with-queue"},oU={key:0,class:"composer-runtime-error",role:"alert"},rU=["href"],aU={key:3,class:"content-grid"},sU={class:"content-thread"},iU={key:0,class:"external-session-banner",role:"alert"},lU={key:1,class:"composer-runtime-error",role:"alert"},cU=["href"],uU={key:2,class:"interrupt-recovered-banner",role:"status"},dU=["aria-label"],fU={class:"content-right-panel-header"},pU={class:"content-right-panel-tabs",role:"tablist"},hU=["aria-selected"],mU=["aria-selected"],vU=["aria-selected","title","onClick"],gU={class:"content-right-panel-tab-label"},yU=["aria-label","title","onClick"],wU={class:"content-right-panel-actions"},bU={class:"content-right-panel-add-wrap"},kU=["aria-label","title"],CU={key:0,class:"content-right-panel-menu"},TU=["aria-label","title"],SU={class:"content-right-panel-body"},_U={key:0,class:"project-zip-modal-backdrop",role:"presentation"},xU=["aria-label"],AU={class:"project-zip-modal-header"},PU={class:"project-zip-modal-title"},IU=["aria-label","disabled"],EU={class:"project-zip-modal-copy"},RU={class:"project-zip-progress-label",role:"status","aria-live":"polite"},MU={class:"project-zip-progress-track"},$U={key:0,class:"project-zip-modal-error",role:"alert"},jU={class:"project-zip-modal-actions"},LU=["disabled"],NU=["disabled"],OU=["disabled"],DU=["aria-label"],FU={class:"codex-login-modal-header"},UU={class:"codex-login-modal-title"},BU=["aria-label","disabled"],qU={class:"codex-login-modal-copy"},zU=["href"],HU=["placeholder","disabled"],WU={key:1,class:"codex-login-modal-error visible-error-with-feedback"},VU=["href"],GU={class:"codex-login-modal-actions"},KU=["disabled"],YU=["disabled"],Sv="codex-web-local.sidebar-collapsed.v1",_v="codex-web-local.accounts-section-collapsed.v1",xv="codex-web-local.right-panel-width.v1",JU=260,QU=640,Av=320,XU=400,Pv="codex-web-local.send-with-enter.v1",Iv="codex-web-local.in-progress-send-mode.v1",Ev="codex-web-local.dark-mode.v1",Rv="codex-web-local.dictation-click-to-toggle.v1",Mv="codex-web-local.dictation-auto-send.v1",$v="codex-web-local.dictation-language.v1",jv="codex-web-local.chat-width.v1",ZU=400,eB=tn({__name:"App",setup(e){var uh,dh;const t=Zl(()=>nc(()=>import("./ThreadConversation-BS09bMfR.js"),__vite__mapDeps([0,1,2]))),n=Zl(()=>nc(()=>import("./ThreadTerminalPanel-juDCK2c0.js"),__vite__mapDeps([3,4]))),o=Zl(()=>nc(()=>import("./ReviewPane-C02hbV2G.js"),__vite__mapDeps([5,6]))),r=Zl(()=>nc(()=>import("./DirectoryHub-BunsdSMs.js"),__vite__mapDeps([7,1,8]))),s=Zl(()=>nc(()=>import("./AutomationsPanel-CnK1Yuru.js"),__vite__mapDeps([9,10]))),{t:a,uiLanguage:l,uiLanguageOptions:d,setUiLanguage:h}=io(),v="codex-mobile",y="0.1.103",_={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:ks,rollbackSelectedThread:oi}=mO(),Et=ZT(),Ut=XT(),{isMobile:ht}=Cp();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}=Ep(),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(QU,Math.max(JU,c))}function Sr(){if(typeof window>"u")return Av;const c=window.localStorage.getItem(xv),f=Number(c);return Number.isFinite(f)?Tr(f):Av}function ri(c){typeof window>"u"||window.localStorage.setItem(xv,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=()=>{ri(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(e0()),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<XU||(jt.value=!0)}const Qr=A(n0()),Gn=A(!1),Cs=A(!1),_n=A(new Set);async function ai(){try{_n.value=new Set(await i_())}catch{}finally{Cs.value=!0}}const Vi=X(()=>!Cs.value||_n.value.has("hooks/list")),si=X(()=>!Cs.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(c=>_n.value.has(c)));nt(jt,c=>{c&&($(),ci(),si.value&&ui())});const ln=A({enabled:!1,clients:[]}),hn=A(null),Ro=A(!1),eo=A(!1),to=A(""),Yo=A(""),Ts=A("");let Sa=null,ii=!1,Gt=null;const Zt=A("never"),li=A(!1),Ss=A(!1),no=A(""),dr=A("");let Gi=!1;const fr=A(!1);async function ci(c={}){if(!(c.force!==!0&&Gi)){li.value=!0,no.value="";try{Zt.value=await f_(),Gi=!0}catch(f){no.value=f instanceof Error?f.message:"Failed to load approval policy"}finally{li.value=!1}}}function _a(c){Zt.value=c}async function $n(){Ss.value=!0,no.value="",dr.value="";try{await p_(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{Ss.value=!1}}let Va=null;async function ui(c={}){if(!(c.force!==!0&&ii)){Ro.value=!0,Yo.value="";try{const f=await d_();ln.value=f,ii=!0}catch(f){Yo.value=f instanceof Error?f.message:"Failed to load remote control status"}finally{Ro.value=!1}}}async function di(){const c=!ln.value.enabled;eo.value=!0,to.value=c?"enable":"disable";try{await h_(c),ln.value={...ln.value,enabled:c},fi(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 Ki(){eo.value=!0,to.value="pairing";try{hn.value=await m_()}catch(c){Yo.value=c instanceof Error?c.message:"Failed to start pairing"}finally{eo.value=!1,to.value=""}}async function _s(){eo.value=!0,to.value="clients";try{ln.value={...ln.value,clients:await v_()}}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 g_(c),ln.value={...ln.value,clients:ln.value.clients.filter(f=>f.clientId!==c)},fi("Remote client removed")}catch(f){Yo.value=f instanceof Error?f.message:"Failed to remove remote client"}finally{eo.value=!1,to.value=""}}function fi(c){Ts.value=c,Sa&&clearTimeout(Sa),Sa=setTimeout(()=>{Ts.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(""),xs=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(""),pi=A(null),Qo=A(""),Xo=A(""),vr=A(""),wn=A(""),ta=A(Od(Pv,!0)),Ea=A(Fb()),na=A(Db()),Ja=A(Ub()),Zo=A(Od(Rv,!1)),oa=A(Od(Mv,!0)),Ra=A(Xb()),Qa=X(()=>Zb()),Ll=X(()=>{const{loaded:c,total:f}=xt.value,x=Np(c);return f&&f>0?`${x} / ${Np(f)}`:c>0?x:a("Preparing...")}),hi=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)))}%`}),As=A(!1),jr=A(!1),Lr=A(!1),ra=A(""),Xa=A(!1),Yi=A(null),Jt=A(!1),oo=A(""),xn=A("codex"),Ps=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"),Is=A(""),mi=A(""),vi=A(""),Es=A(!1),Ma=A(""),Lo=A(!1),Nl=A(null),Lc=A(null),$a=A(!1),Nc=A(null),wd=A(null),ja=A(""),Or=A(""),aa=A(""),Ol=A([]),Bn=A(""),No=A(!1),ko=A(!1),gi=A(!1),Dr=A(""),Rs=[oe,Ue,Rr,Un,wn,oo,Rt,bn,Ma,Bn],sa=X(()=>Rs.some(c=>c.value.trim().length>0)),Fr=A({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),yi=A(null),Ms=A(!1),Ji=A(!1),La=A(typeof window<"u"?((uh=window.visualViewport)==null?void 0:uh.height)??window.innerHeight:0),Dl=A(typeof window<"u"?((dh=window.visualViewport)==null?void 0:dh.offsetTop)??0:0),wi=A(typeof window<"u"?window.innerHeight:0);let Na=null,Fl=!1,Qi=!1,Ul=!1,bi=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"),Oc=X(()=>{const c=Et.query.automationId;return typeof c=="string"?c:""}),bd=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")}),ki=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Xi=X(()=>{var f,x;return(((x=(f=ce.value)==null?void 0:f.title)==null?void 0:x.trim())??"")||ki}),Ci=X(()=>At.value.filter(c=>{const f=r0(c.messageType,c.role);return f==="worked"?!0:!(f==="turnActivity.live"||f==="turnError.live"||f==="agentReasoning.live")})),Zi=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),el=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&&Zi.has(Q.messageType??""))}function Dc(c,f){return c.some(x=>typeof x.turnIndex=="number"&&x.turnIndex>=f&&Zi.has(x.messageType??""))}const ql=X(()=>{const c=Ci.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=av(De);if(!on||el.value!==null&&De.id===el.value)return null;const u0=f?!0:Bl(c,De,ve);return{id:De.id,streaming:De.messageType==="plan.live",explanation:on.explanation,steps:on.steps,implemented:u0}}const x=de.value?ye.value[de.value]??null:null;if(!x)return null;const N=av(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?Dc(c,Q):!1}}),kd=X(()=>K.value),yr=X(()=>Rn.value?"__new-thread__":de.value),$s=X(()=>Nt(yr.value)),tl=X(()=>{const c=V.value;return c.length>0?c[c.length-1]:null}),zl=X(()=>tl.value?fo(tl.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())??""}),nl=X(()=>Pt.value&&(Rn.value&&mn.value.length>0||Et.name==="thread"&&de.value.length>0)),Cd=X(()=>nl.value&&$t.value==="terminal"),Ti=X(()=>!ht.value||La.value<=0||wi.value<=0?!1:wi.value-La.value>120),Td=X(()=>Ti.value||Cd.value&&Po.value),Fc=X(()=>{var c,f;return((f=(c=ce.value)==null?void 0:c.cwd)==null?void 0:f.trim())??Ct.value.trim()}),Si=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)}),Uc=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||Si.value||V.value.length>0);function Bc(){As.value&&(As.value=!1,Lx(!0))}function qc(){Bc(),Ut.push({name:"skills",query:{tab:"plugins"}})}function Sd(){const c=de.value;c&&se(c)}function ol(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 ol(x,ve)?x:Q}function _d(){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 _i(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 ol(f,x)?f:br(f)}function rl(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=ol(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 _d()){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)||Ku(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}),xd=X(()=>{var f,x;const c={};for(const N of B.value){const Q=sl(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=mi.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),L=X(()=>Is.value.trim()?jo.value==="create"?E.value:vi.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,wi.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`}}),js=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}`});bs(()=>{var c,f;document.addEventListener("pointerdown",zp),window.addEventListener("keydown",Up),document.addEventListener("visibilitychange",Hp),window.addEventListener("pageshow",Wp),window.addEventListener("focus",Vp),window.addEventListener("resize",ia),(c=window.visualViewport)==null||c.addEventListener("resize",ia),(f=window.visualViewport)==null||f.addEventListener("scroll",ia),ia(),au(),it==null||it.addEventListener("change",au),Yn=ue(x=>{ir.value&&ir.value.refreshFromNotification(x)}),Gt=ue(x=>{x==="remoteControl/status/changed"&&ui({force:!0})}),a0(),Eb(),ai(),Hc(),Fs(),la(),Ns(),os(),Fd(),Qw(),ci()}),nt(Rs,(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}),Rc(()=>{var c,f;document.removeEventListener("pointerdown",zp),window.removeEventListener("keydown",Up),document.removeEventListener("visibilitychange",Hp),window.removeEventListener("pageshow",Wp),window.removeEventListener("focus",Vp),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",au),Yt&&(Yt.disconnect(),Yt=null),Na!==null&&(window.clearInterval(Na),Na=null),Eo&&(clearTimeout(Eo),Eo=null),tu(),zo(),Yn&&(Yn(),Yn=null),Gt&&(Gt(),Gt=null),Sa&&(clearTimeout(Sa),Sa=null)});function ia(){var c,f;typeof window>"u"||(wi.value=Math.max(wi.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(()=>{_x(f,1e3).then(x=>{fn.value.trim()===f&&(Ko.value=x.threadIds)}).catch(()=>{fn.value.trim()===f&&(Ko.value=null)})},220)}),nt(Ti,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(!Qi||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 Am();jn.value=x.accounts}catch{await Gl({silent:!0})}const f=JSON.stringify(jn.value.map(x=>x.accountId).sort());return c!==f}function Ls(){Be({force:!0})}function zc(c){c&&Se(c,{silent:!0,force:!0})}async function os(){try{Fr.value=await Px()}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 Ns(){try{const c=await Ax();Ce.value=c.botToken,st.value=c.allowedUserIds.map(f=>String(f)).join(`
82
+ `),Rt.value=""}catch(c){Rt.value=c instanceof Error?c.message:"Failed to load Telegram configuration"}}async function Hc(){const c=await jx();As.value=c.dismissed!==!0}function Wc(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 Vc(){const c=Ce.value.trim(),f=Wc(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 xx(c,f),st.value=f.map(x=>String(x)).join(`
83
+ `),await Promise.all([Ns(),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 Gc(){Vn.value=!Vn.value,Vn.value?Wt(()=>{var c;return(c=vo.value)==null?void 0:c.focus()}):fn.value=""}function Kc(){var c;fn.value="",(c=vo.value)==null||c.focus()}function al(){return Zn.value?Zn.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function Yc(c){if(Bt.value||F)return;const f=c==null?void 0:c.currentTarget,x=f instanceof HTMLElement?f:al();go=(x==null?void 0:x.scrollTop)??go}function Jc(){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=al();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 Os(c){Et.name==="automations"&&Oc.value!==c&&Ut.replace({name:"automations",query:c?{automationId:c}:{}})}async function Qc(c){var f;Bt.value&&(Co(!1),await Wt()),(f=dn.value)==null||f.openAutomationEditorFromPanel(c)}async function ew(){var c;Bt.value&&(Co(!1),await Wt()),(c=dn.value)==null||c.openAutomationCreatorFromPanel()}function tw(){var c;Et.name==="automations"&&((c=sr.value)==null||c.loadAutomations())}async function nw(c){c&&de.value===c&&await Lb()}function ow(c){return c.length>8?c.slice(-8):c}function Mp(c){const f=[c.planType||a("unknown")];return c.authMode&&f.unshift(c.authMode),f.join(" · ")}function rw(c){if(!c)return!1;const f=c.toLowerCase();return f.includes("payment required")||/\b402\b/.test(f)}function Xc(c){return c.unavailableReason==="payment_required"||rw(c.quotaError)}function aw(c){return Jo.value||bo.value||Mr.value||Ln.value||Qo.value.length>0||c.isActive&&Qo.value!==c.storageId&&Hl.value}function Ad(c){return Xo.value===c.storageId}function sw(c){return vr.value===c.storageId||Ad(c)}function iw(c){return Xc(c)?a("Unavailable"):c.isActive?a("Active"):bo.value?a("Switching…"):a("Switch")}function lw(c){return Qo.value===c.storageId?a("Removing…"):Ad(c)?a("Click again to remove"):a("Remove")}function cw(c){vr.value=c}function uw(c){vr.value===c&&(vr.value=""),Qo.value!==c&&Xo.value===c&&(Xo.value="")}function dw(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 fw(c){if(typeof c!="number"||!Number.isFinite(c))return"";const f=new Date(c*1e3);return`${f.getMonth()+1}月${f.getDate()}日`}function $p(c){var ve,De;if(Xc(c))return c.quotaError||a("402 Payment Required");const f=c.quotaSnapshot,x=dw(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=fw(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 pw(c){return[c.email||a("Account"),Mp(c),Xc(c)?a("Unavailable account"):null,$p(c),`${a("Workspace")} ${c.accountId}`].filter(Boolean).join(`
84
+ `)}async function Gl(c={}){try{const f=await P_();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 hw(){if(!(Jo.value||bo.value||Mr.value||Ln.value)){wn.value="",vr.value="",Xo.value="",Jo.value=!0;try{const c=await Am();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 mw(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 R_(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 vw(){var c;if(!(Jo.value||bo.value||Mr.value||Ln.value)){wn.value="",$r.value="",Mr.value=!0;try{const f=await I_();Ia.value=f,Ya.value=!0,window.open(f,"_blank","noopener,noreferrer"),await Wt(),(c=pi.value)==null||c.focus()}catch(f){wn.value=f instanceof Error?f.message:a("Failed to start Codex login")}finally{Mr.value=!1}}}function Pd(){Ln.value||(Ya.value=!1,$r.value="")}async function gw(){const c=$r.value.trim();c&&await yw(c)}async function yw(c){if(!(Ln.value||c.length===0)){wn.value="",Ln.value=!0;try{const f=await E_(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 ww(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 M_(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 bw(c){pe(c)}function kw(c){z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function Cw(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 jp(c){const f=c.trim().replace(/\\/gu,"/");return f?f.includes("/.codex/worktrees/")||f.includes("/.git/worktrees/"):!1}function sl(c,f=""){var ve,De,on;const x=B.value.find(nr=>nr.projectName===c);if(!x)return rl(c)||f.trim();const N=x.threads.find(nr=>!jp(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())??"")||rl(c)||f.trim()}function Tw(c){var N,Q;const f=B.value.find(ve=>ve.projectName===c),x=sl(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 Sw(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 Zc(c){var x,N;const f=B.value.find(Q=>Q.projectName===c);return sl(c,((N=(x=f==null?void 0:f.threads[0])==null?void 0:x.cwd)==null?void 0:N.trim())??"")}const Lp=X(()=>Object.fromEntries(B.value.map(c=>[c.projectName,Zc(c.projectName).trim()]).filter(([,c])=>c.length>0)));function _w(c){return(J.value[c]??c).trim()||c}function xw(c){return _w(c).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function Aw(c){const f=Zc(c);!f||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(f)}`,"_blank","noopener,noreferrer")}async function Pw(c){const f=Zc(c);await Dp(f)}async function Iw(c){const f=Ew(c);await Dp(f)}function Ew(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 Np(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 Rw(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 Mw(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 Op(){xt.value.phase!=="exporting"&&(xt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function $w(){const{blob:c,fileName:f}=xt.value;!c||!f||(xt.value={...xt.value,error:""},Rw(c,f))}async function jw(){const{blob:c,fileName:f}=xt.value;if(!(!c||!f))try{xt.value={...xt.value,error:""},await Mw(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 Dp(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 wx(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 Lw(c){const f=Zc(c);if(!f||typeof window>"u"||(await eu(f),Sn.value[f]!==!0))return;const x=`${xw(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 ax(f,Q),De=await hu(ve.cwd,{createIfMissing:!1,label:""});if(!De)return;Ct.value=De,Fn.value="local",ut(_i(De)),await Fs(),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 Nw(){var x,N,Q;const c=ce.value;if(!c)return"";const f=((x=c.projectName)==null?void 0:x.trim())??"";return f?sl(f,((Q=c.cwd)==null?void 0:Q.trim())??""):((N=c.cwd)==null?void 0:N.trim())??""}function Id(){const c=Nw();c&&(Ct.value=c),Fn.value="local",ht.value&&Co(!0),!Rn.value&&Ut.push({name:"home"})}function Ow(){Ct.value="",Fn.value="local",ht.value&&Co(!0),!Rn.value&&Ut.push({name:"home"})}async function eu(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=lx(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 Dw(c){za(c.projectName,c.displayName)}function Fw(c){Ve(c.threadId,c.title)}async function Uw(c){await Cr(c),await Fs(),la()}function Bw(c){Qt(c.projectName,c.toIndex)}function qw(c){var N,Q;const f=B.value.find(ve=>ve.projectName===c),x=sl(c,((Q=(N=f==null?void 0:f.threads[0])==null?void 0:N.cwd)==null?void 0:Q.trim())??"");eu(x)}function Fp(c){zw(c)}async function zw(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 Hw(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=al())==null?void 0:f.scrollTop;typeof x=="number"&&(x>0||go===0)&&(go=x)}Bt.value=c,t0(c),c||Jc()}}function Up(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(),Bp();return}f==="j"&&Rn.value&&mn.value&&(c.preventDefault(),Bp())}function Bp(){nl.value&&(ht.value&&!Mn.value&&(Mn.value=!0),ht.value||(Io.value=!1),$t.value=$t.value==="terminal"?"git":"terminal",$t.value!=="terminal"&&Ai())}function xi(c){$t.value=c,Xn.value=!1,ht.value||(Io.value=!1),ht.value&&(Mn.value=!0),c!=="terminal"&&Ai()}function Ww(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}xi("preview")}function Vw(c){zn.value.some(f=>f.key===c)&&(po.value=c,xi("preview"))}function Gw(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 qp(){if(ht.value){Mn.value=!1;return}Io.value=!0,Xn.value=!1,Ai()}function Kw(){if(ht.value){Mn.value=!Mn.value;return}Io.value=!Io.value,Io.value&&(Xn.value=!1,Ai())}function Yw(){$t.value="git",ht.value&&(Mn.value=!1),Ai()}function Jw(c){if(Qn.value=c,!c){Po.value=!1,tu();return}Po.value=!0,tu(),Ar=setTimeout(()=>{Ar=null,Ti.value||(Po.value=!1)},1500)}function Ai(){Qn.value=!1,Po.value=!1,tu()}function tu(){Ar&&(clearTimeout(Ar),Ar=null)}async function Qw(){try{const c=await __();Pt.value=c.available,!c.available&&$t.value==="terminal"&&($t.value="git",Ai())}catch{Pt.value=!1,$t.value==="terminal"&&($t.value="git")}}function zp(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")||Ai()}jt.value&&((x=Go.value)!=null&&x.contains(f)||(N=Jr.value)!=null&&N.contains(f)||(Ta=Date.now(),jt.value=!1))}}function Xw(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 Zw(){var c;(c=dn.value)==null||c.openRecycleBin()}function Hp(){if(!(typeof document>"u")&&ht.value){if(document.visibilityState==="hidden"){yi.value=Date.now(),Ms.value=!1;return}Ed()}}function Wp(c){c.persisted&&Ed()}function Vp(){Et.name==="home"&&(Fs(),la()),Ed()}function Ed(){typeof window>"u"||typeof document>"u"||!ht.value||document.visibilityState!=="visible"||Ms.value||yi.value===null||Date.now()-yi.value<ZU||(Ms.value=!0,yi.value=null,eb())}async function eb(){if(!Ji.value){Ji.value=!0;try{await z({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Bd()}finally{Ji.value=!1}}}function Gp(c){const f=c.text;nu();const x=Wa.value,N=c.mode==="queue"&&x&&x.threadId===de.value?x.queueIndex:void 0;if(Wa.value=null,Rn.value){s0(f,c.imageUrls,c.skills,c.fileAttachments);return}gt(f,c.imageUrls,c.skills,c.mode,c.fileAttachments,N)}function tb(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 nu(){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 nb(c){Ct.value=c.trim(),bn.value=""}function ob(c){mo.value=c.trim()}function Ds(c){const f=mn.value.trim();return!c||f!==c?!1:Et.name==="thread"||Et.name==="home"&&ns.value}function Kp(){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="",xs.value="",Rr.value="",cn.value=!1}function Yp(c){const f=c.trim();if(!f){Er.value={addedLineCount:0,removedLineCount:0};return}const x=++qt;px(f,"unstaged").then(N=>{x!==qt||!Ds(f)||(Er.value={addedLineCount:N.addedLineCount,removedLineCount:N.removedLineCount})}).catch(()=>{x!==qt||!Ds(f)||(Er.value={addedLineCount:0,removedLineCount:0})})}async function Kl(c){var N,Q,ve;const f=c.trim();if(!f){Kp();return}const x=++ne;cn.value=!0,Rr.value="";try{const De=await ix(f);if(x!==ne||!Ds(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,Yp(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&&Jp({branch:on,includeResetHistory:!0})}catch{if(x!==ne||!Ds(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 rb(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,Yp(mn.value)}function ab(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="",cx(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 sb(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="",fx(N,f,x).then(Q=>(rb(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 Jp(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,ux(N,f,{includeResetHistory:x}).then(De=>{ve!==Pe||!Ds(N)||(qe.value={...qe.value,[Q]:De})}).catch(De=>{ve!==Pe||!Ds(N)||(Un.value=De instanceof Error?De.message:"Failed to load branch commits")}).finally(()=>{ve===Pe&&ke.value===Q&&(ke.value="")})}function ib(c){const f=c.trim(),x=mn.value.trim();if(!f||!x||mr.value===f||(xs.value="",Pa.value[f]))return;const N=++Ge;mr.value=f,dx(x,f).then(Q=>{N!==Ge||!Ds(x)||(Pa.value={...Pa.value,[f]:Q})}).catch(Q=>{N!==Ge||!Ds(x)||(xs.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{N===Ge&&mr.value===f&&(mr.value="")})}function lb(c){const f=c.path.trim(),x=c.sha.trim();!f||!x||(Ir.value=f,Xr.value=x,Gn.value=!0)}function cb(){Ir.value="",Xr.value="",Gn.value=!Gn.value}function ub(){!Ir.value&&!Xr.value||(Ir.value="",Xr.value="",Gn.value=!1)}async function db(){const c=await ru();c&&(await la(),Is.value=c,mi.value=pn.value.trim()||"New Project (1)",vi.value="",Ma.value="",jo.value="create",Nr.value=!0,Wt(()=>{var f;return(f=Nl.value)==null?void 0:f.focus()}))}function ou(){Lo.value||(Nr.value=!1,Ma.value="")}let Rd=!1,Md=!1;function fb(){Rd=!0}function pb(){Rd&&(Rd=!1,il())}function hb(){Md=!0}function mb(){Md&&(Md=!1,ou())}async function vb(){const c=Is.value.trim(),f=mi.value.trim();if(!E.value)throw new Error("Enter a single project folder name.");const x=eh(Zp(c,f));return x?hu(x,{createIfMissing:!0,label:""}):""}async function gb(){const c=Is.value.trim(),f=vi.value.trim();return f?Cx(f,c):""}async function $d(){if(!(!L.value||Lo.value)){Ma.value="",Lo.value=!0;try{const c=jo.value==="clone"?await gb():await vb();if(!c)return;Ct.value=c,ut(_i(c)),await Fs(),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 yb(){wb(Lc.value)}function wb(c){Es.value||!c||(c.value="",c.click())}async function bb(c,f,x){Es.value=!0;try{const N=await ru();if(!N)return;const Q=await f(N);if(!Q.path)return;Ct.value=Q.path,ut(_i(Q.path)),await Fs(),await z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await la()}catch(N){const Q=N instanceof Error?N.message:x;window.alert(Q)}finally{Es.value=!1,c&&(c.value="")}}async function kb(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||Es.value||await bb(f,Q=>bx(x,Q),"Failed to import project.")}async function Cb(){const c=Ct.value.trim()||await ru();c&&(Kt.value=!1,$a.value=!0,Dr.value="",await Us(c),Bn.value||Wt(()=>{var f;return(f=Nc.value)==null?void 0:f.focus()}))}function il(){bi+=1,$a.value=!1,No.value=!1,Bn.value="",Dr.value="",ja.value="",Yl()}async function Tb(c){!c||No.value||(Dr.value="",await Us(c))}function Sb(){const c=Or.value.trim();!$a.value||!c||Us(c)}function _b(){const c=q.value;!$a.value||!c||No.value||Us(c)}function xb(){if(!$a.value||No.value||ko.value)return;const c=q.value,f=Or.value.trim();!c||c===f||Us(c)}function Ab(){const c=q.value,f=Or.value.trim();if(c){if(c!==f){Us(c);return}jd(c)}}async function jd(c=q.value){const f=ot(c).trim();if(f){Bn.value="",ko.value=!0;try{const x=await hu(f,{createIfMissing:!1,label:""});if(!x){Bn.value="Failed to open the selected folder.";return}Ct.value=x,ut(_i(x)),await Fs(),await z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await la(),il()}catch(x){Bn.value=x instanceof Error?x.message:"Failed to open the selected folder."}finally{ko.value=!1}}}async function Pb(){if(bn.value="",Kt.value){Yl();return}if(!$a.value){const c=Ct.value.trim()||await ru();if(!c||($a.value=!0,Dr.value="",await Us(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 Qp(){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=eh(Zp(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 kx(x);if(!N){bn.value="Failed to create the folder.";return}bn.value="",Dr.value="",await Us(N),Yl()}catch(N){bn.value=N instanceof Error?N.message:"Failed to create folder."}finally{tr.value=!1}}async function Ib(){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 hu(c,{createIfMissing:!1,label:""});if(!x)return!1;Ct.value=x,ut(_i(x)),await Ut.replace({name:"home"}),await Fs();const N=new URL(window.location.href);return N.searchParams.delete("openProjectPath"),window.history.replaceState({},"",N.toString()),!0}catch{return!1}}async function ru(){const c=Xp();if(c)return c;try{const f=await Nm();if(f)return Xt.value=f,f}catch{}return""}async function la(){const c=Xp();if(!c){pn.value="New Project (1)";return}try{const f=await Sx(c);pn.value=f.name||"New Project (1)"}catch{pn.value="New Project (1)"}}function Xp(){var x,N;const c=Ct.value.trim();if(c)return Tl(c);const f=((N=(x=Vl.value[0])==null?void 0:x.value)==null?void 0:N.trim())??"";return f?Tl(f):Xt.value.trim()}async function Eb(){try{Xt.value=await Nm()}catch{Xt.value=""}}async function Fs(){try{const c=await ml();Wn.value={order:[...c.order],labels:{...c.labels},projectOrder:[...c.projectOrder]}}catch{Wn.value={order:[],labels:{},projectOrder:[]}}}async function Us(c){const f=++bi,x=ot(c).trim();ja.value=x,Or.value=x,Bn.value="",No.value=!0;try{const N=await hx(c,{showHidden:gi.value});if(f!==bi)return;ja.value=N.path,Or.value=N.path,aa.value=N.parentPath,Ol.value=N.entries}catch(N){if(f!==bi)return;Bn.value=N instanceof Error?N.message:"Failed to load local folders.",aa.value=Tl(Or.value),Ol.value=[],Yl()}finally{f===bi&&(No.value=!1)}}function Zp(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 eh(c){const f=ot(c).trim();if(!f)return"";const x=f.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(x){const[,Q,ve,De=""]=x,on=Ld(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=Ld(ve.split(/[\\/]+/u));return on.length>0?`${Q}${De}${on.join(De)}`:`${Q}${De}`}if(f.startsWith("/")){const Q=Ld(f.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return f}function Ld(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 Rb(c){me(c.draggedId,c.targetId)}function th(c){Kn(yr.value,c)}function nh(c){lo(c)}function oh(c){co(c)}function Mb(){Tt()}const Jl=A("");let Nd=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."),Nd&&clearTimeout(Nd),Nd=setTimeout(()=>{Jl.value=""},6e3),H(yr.value))});function rh(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":Id();break;case"skills":gr.value||Ut.push({name:"skills"});break}}function $b(c){const f=c.turnId.trim();if(f.length>0){const x=[...Ci.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)}oi(c.turnId)}function jb(){Rn.value||!de.value||(ql.value&&(el.value=ql.value.id),Ft("default"),nu(),gt("Implement",[],[],"steer",[],void 0,"default"))}async function Lb(){if(Rn.value||gr.value||ts.value||!ce.value||Ci.value.length===0)return;const c=Nb();try{await Dy(c)}catch{}}function Nb(){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(`# ${Ob(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 Ci.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(`
85
+ `).trimEnd()}
86
+ `}function Ob(c){return c.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Od(c,f){if(typeof window>"u")return f;const x=window.localStorage.getItem(c);return x===null?f:x==="1"}function Db(){if(typeof window>"u")return"system";const c=window.localStorage.getItem(Ev);return c==="light"||c==="dark"?c:"system"}function Fb(){if(typeof window>"u")return"steer";const c=window.localStorage.getItem(Iv);return c==="steer"||c==="queue"?c:"queue"}function Ub(){if(typeof window>"u")return"standard";const c=window.localStorage.getItem(jv);return c==="standard"||c==="wide"||c==="extra-wide"?c:"standard"}function Bb(){ta.value=!ta.value,window.localStorage.setItem(Pv,ta.value?"1":"0")}function qb(){Ea.value=Ea.value==="steer"?"queue":"steer",window.localStorage.setItem(Iv,Ea.value)}function zb(){const c=["system","light","dark"],f=c.indexOf(na.value);na.value=c[(f+1)%c.length],window.localStorage.setItem(Ev,na.value),au()}function Hb(){const c=["standard","wide","extra-wide"],f=c.indexOf(Ja.value);Ja.value=c[(f+1)%c.length],window.localStorage.setItem(jv,Ja.value)}function Wb(){Zo.value=!Zo.value,window.localStorage.setItem(Rv,Zo.value?"1":"0")}function Vb(){oa.value=!oa.value,window.localStorage.setItem(Mv,oa.value?"1":"0")}async function Gb(c){if(!Lr.value){Lr.value=!0;try{if(c==="codex"){xn.value="codex";const f=await Mm(!1);jr.value=f.enabled}else if(c==="openrouter"){xn.value="openrouter";const f=await Mm(!0);jr.value=f.enabled,await ul("","",{wireApi:k.value,provider:"openrouter"})}else c==="opencode-zen"?(xn.value="opencode-zen",await ul("",C.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),jr.value=!0):c==="custom"&&(xn.value="custom",er.value.trim()&&Za.value.trim()&&(await ul(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 Dd(){if(Jt.value)return;const c=er.value.trim();if(c){Jt.value=!0;try{oo.value="",await ul(c,Za.value.trim(),{wireApi:w.value}),jr.value=!0;const f=await Rm();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 ah(c){if(Jt.value||Lr.value||k.value===c)return;const f=k.value;k.value=c,Jt.value=!0;try{oo.value="",await ul("","",{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 sh(){if(Jt.value)return;const c=C.value.trim();if(c){Jt.value=!0;try{oo.value="",await ul("",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 ih(){if(!Jt.value){Jt.value=!0;try{const c=ra.value.trim();await $m(c),ra.value="",await Fd(),await z({includeSelectedThreadMessages:!1})}catch{}finally{Jt.value=!1}}}async function Kb(){if(!Jt.value){Jt.value=!0;try{await $m(""),ra.value="",await Fd(),await z({includeSelectedThreadMessages:!1})}catch{}finally{Jt.value=!1}}}async function Fd(){try{const c=xn.value,f=await Rm();jr.value=f.enabled,Xa.value=f.customKey??!1,Yi.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",Qi=f.hasCodexAuth===!0,Qi||(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 Yb(c){const x=Ud(c.trim())||"auto";Ra.value=x,window.localStorage.setItem($v,x)}function Jb(c){Ze(Number(c))}const Qb=[{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 Xb(){var x;if(typeof window>"u")return"auto";const c=((x=window.localStorage.getItem($v))==null?void 0:x.trim())||"auto";return Ud(c)||"auto"}function Zb(){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=Ud(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 Ud(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 au(){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 e0(){return typeof window>"u"?!1:window.localStorage.getItem(Sv)==="1"}function t0(c){typeof window>"u"||window.localStorage.setItem(Sv,c?"1":"0")}function n0(){if(typeof window>"u")return!0;const c=window.localStorage.getItem(_v);return c===null?!0:c==="1"}function o0(){Qr.value=!Qr.value,!(typeof window>"u")&&window.localStorage.setItem(_v,Qr.value?"1":"0")}function r0(c,f){const x=(c??"").trim();return x.length>0?x:f.trim()||"message"}function lh(c){Ft(c)}async function a0(){await Ut.isReady(),Et.name==="thread"&&es.value?ks(es.value):(Et.name==="home"||Et.name==="skills"||Et.name==="automations")&&ks("",{persist:!1}),await z({includeSelectedThreadMessages:Et.name==="thread"}),Gl({silent:!0}),await Ib(),ur.value=!0,await Bd(),gn()}async function Bd(){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 Bd()}),nt(()=>[de.value,mn.value],()=>{ub()}),nt(()=>[Et.name,mn.value],([c,f])=>{c==="thread"&&eu(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"&&eu(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||ch(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&&jp(x)){const N=((f=ce.value)==null?void 0:f.projectName)??br(x),Q=sl(N,"");Q&&(Ct.value=Q)}return}ns.value&&ch(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)){Kp();return}Pe+=1,qe.value={},ke.value="",Un.value="",Kl(f)},{immediate:!0}),nt(Xi,c=>{typeof document>"u"||(document.title=c)},{immediate:!0}),nt(ht,c=>{c&&!Bt.value&&Co(!0)},{immediate:!0});async function s0(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 rx(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 Tx(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}}),nu()}catch{}}function i0(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 l0(c){return`${c.kind}:${c.name}:${c.skillPath??""}`}async function c0(c){var N;if(cr.value)return;cr.value=l0(c);const f=i0(c),x=(N=c.attachedSkills)!=null&&N.length?c.attachedSkills:c.kind==="skill"&&c.skillPath?[{name:c.name,path:c.skillPath}]:[];try{const Q=Fc.value.trim()||mn.value.trim(),ve=await It(f,Q,[],x,[]);if(!ve)return;await Ut.replace({name:"thread",params:{threadId:ve}}),nu()}catch{}finally{cr.value=""}}async function ch(c){var x;const f=c.trim();if(!f){Vo.value=[],mo.value="";return}En.value=!0;try{const N=await sx(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(aS,{"is-sidebar-collapsed":Bt.value,onCloseSidebar:f[47]||(f[47]=x=>Co(!0))},{sidebar:yt(()=>{var x;return[p("section",vO,[p("div",{ref_key:"sidebarScrollableRef",ref:Zn,class:"sidebar-scrollable",onScroll:Yc},[Bt.value?ee("",!0):(S(),tt(nv,{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:Id},{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:Gc},[Ie(ov,{class:"sidebar-search-toggle-icon"})],8,gO)]),_:1},8,["is-sidebar-collapsed"])),!Bt.value&&Vn.value?(S(),I("div",yO,[Ie(ov,{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,wO),[[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:Kc},[Ie($u,{class:"sidebar-search-clear-icon"})],8,bO)):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",kO,[Ie(Js)]),p("span",CO,[p("span",TO,T(g(a)("Skills")),1),p("span",SO,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",_O,[Ie(Js)]),p("span",xO,[p("span",AO,T(g(a)("Automations")),1),p("span",PO,T(g(a)("Scheduled work")),1)])],2)),Bt.value?ee("",!0):(S(),tt(rI,{key:4,ref_key:"sidebarThreadTreeRef",ref:dn,groups:g(B),"project-display-name-by-id":g(J),"project-git-repo-by-name":xd.value,"project-cwd-by-name":Lp.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:bw,onStartNewThread:Tw,onRenameProject:Dw,onBrowseThreadFiles:Sw,onSaveThreadProject:Iw,onBrowseProjectFiles:Aw,onSaveProject:Pw,onRequestProjectGitStatus:qw,onCreateProjectWorktree:Lw,onRenameThread:Fw,onForkThread:Cw,onRemoveProject:Uw,onReorderProject:Bw,onCopyThreadChat:nw,onAutomationsChanged:tw,onRestoreThread:kw,onStartNewChat:Ow},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:Xw},[(S(),tt(Zs,{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",EO,[p("h2",RO,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($u,{class:"settings-dialog-close-icon"})],8,MO)]),p("div",$O,[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,LO)),64))],8,jO),p("div",NO,[Lt(p("div",null,[Ie(ej,{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":Xc,"is-remove-confirmation-active":Ad,"is-remove-visible":sw,"build-account-title":pw,"format-account-meta":Mp,"format-account-quota":$p,"short-account-id":ow,"is-account-action-disabled":aw,"get-account-switch-label":iw,"get-account-remove-label":lw,"on-refresh-accounts":hw,"on-start-codex-login":vw,"on-switch-account":mw,"on-remove-account":ww,"on-account-card-pointer-enter":cw,"on-account-card-pointer-leave":uw,"toggle-accounts-section-collapsed":o0,"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:Bb},[p("span",DO,T(g(a)("Require ⌘ + enter to send")),1),p("span",{class:Ke(["sidebar-settings-toggle",{"is-on":!ta.value}])},null,2)],8,OO),p("button",{class:"sidebar-settings-row",type:"button",title:_.inProgressSendMode,onClick:qb},[p("span",UO,T(g(a)("When busy, send as")),1),p("span",BO,T(Ea.value==="steer"?g(a)("Steer"):g(a)("Queue")),1)],8,FO),p("button",{class:"sidebar-settings-row",type:"button",title:_.appearance,onClick:zb},[p("span",zO,T(g(a)("Appearance")),1),p("span",HO,T(na.value==="system"?g(a)("System"):na.value==="dark"?g(a)("Dark"):g(a)("Light")),1)],8,qO),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g(a)("Choose the interface language for the app.")},[p("span",VO,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,WO),p("button",{class:"sidebar-settings-row",type:"button",title:_.chatWidth,onClick:Hb},[p("span",KO,T(g(a)("Chat width")),1),p("span",YO,T(Mt.value),1)],8,GO),p("button",{class:"sidebar-settings-row",type:"button",title:_.dictationClickToToggle,onClick:Wb},[p("span",QO,T(g(a)("Click to toggle dictation")),1),p("span",{class:Ke(["sidebar-settings-toggle",{"is-on":Zo.value}])},null,2)],8,JO),p("button",{class:"sidebar-settings-row",type:"button",title:_.dictationAutoSend,onClick:Vb},[p("span",ZO,T(g(a)("Auto send dictation")),1),p("span",{class:Ke(["sidebar-settings-toggle",{"is-on":oa.value}])},null,2)],8,XO),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:_.dictationLanguage},[p("span",t2,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":Yb},null,8,["model-value","options","placeholder","search-placeholder"])],8,e2),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",o2,T(g(a)("Auto-compact before send")),1),Ie(or,{class:"sidebar-settings-auto-compact-dropdown","model-value":String(g(We)),options:Qb,placeholder:g(a)("Off"),"menu-align":"end","onUpdate:modelValue":Jb},null,8,["model-value","placeholder"])],8,n2),sa.value?(S(),I("a",{key:0,class:"sidebar-settings-row sidebar-settings-feedback-row",href:g(Dn),onClick:In},[p("span",a2,T(g(a)("Send feedback")),1),p("span",s2,T(g(a)("Issue detected")),1)],8,r2)):ee("",!0)],512),[[du,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",l2,T(g(a)("Provider")),1),Ie(or,{class:"sidebar-settings-provider-dropdown","model-value":xn.value,options:Ps.value,placeholder:g(a)("Provider"),disabled:Lr.value,"menu-align":"end","onUpdate:modelValue":Gb},null,8,["model-value","options","placeholder","disabled"])],8,i2),oo.value?(S(),I("div",c2,[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,u2)])):ee("",!0),xn.value==="openrouter"?(S(),I("div",d2,[p("div",f2,[p("span",p2,T(g(a)("OpenRouter API key")),1),p("a",h2,T(g(a)("Get API key")),1)]),p("div",m2,[Xa.value&&!ra.value?(S(),I(ze,{key:0},[p("span",v2,T(Yi.value),1),p("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Jt.value,title:g(a)("Remove custom key, use community keys"),onClick:Kb},"✕",8,g2)],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(ih,["enter"])},null,40,y2),[[an,ra.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Jt.value||!ra.value.trim(),onClick:ih},T(Jt.value?"...":g(a)("Set")),9,w2)],64))]),p("div",b2,[p("span",k2,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=>ah("responses"))},T(g(a)("Responses")),11,T2),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=>ah("chat"))},T(g(a)("Completions")),11,S2)],8,C2)])])):ee("",!0),xn.value==="opencode-zen"?(S(),I("div",_2,[p("div",x2,[p("span",A2,T(g(a)("OpenCode Zen API key")),1),p("a",P2,T(g(a)("Get API key")),1)]),p("div",I2,[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(sh,["enter"])},null,40,E2),[[an,C.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Jt.value||!C.value.trim(),onClick:sh},T(Jt.value?"...":g(a)("Save")),9,R2)])])):ee("",!0),xn.value==="custom"?(S(),I("div",M2,[p("span",$2,T(g(a)("Custom endpoint URL")),1),p("div",j2,[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(Dd,["enter"])},null,40,L2),[[an,er.value]])]),p("span",N2,T(g(a)("API key")),1),p("div",O2,[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(Dd,["enter"])},null,40,D2),[[an,Za.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Jt.value||!er.value.trim(),onClick:Dd},T(Jt.value?"...":g(a)("Save")),9,F2)]),p("div",U2,[p("span",B2,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,q2)])])):ee("",!0)],512),[[du,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",z2,T(g(a)("Telegram")),1),p("span",H2,T(js.value),1)]),D.value?(S(),I("div",W2,[p("label",V2,[p("span",G2,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",K2,[p("span",Y2,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
87
+ 987654321`,spellcheck:"false"},null,512),[[an,st.value]])]),p("div",J2,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",Q2,[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,X2)])):ee("",!0),p("div",Z2,[p("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:$o.value,onClick:Vc},T($o.value?g(a)("Saving…"):g(a)("Save Telegram config")),9,eD)])])):ee("",!0),p("div",tD,[p("div",nD,[p("span",oD,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,rD)]),Vi.value?(S(),I(ze,{key:1},[g(G)?(S(),I("p",sD,T(g(a)("Loading hooks…")),1)):g(O).length===0?(S(),I("p",iD,T(g(a)("No hooks registered.")),1)):(S(),I("div",lD,[(S(!0),I(ze,null,_t(g(O),N=>(S(),I("div",{key:N.cwd||"__global__",class:"sidebar-settings-hooks-entry"},[p("p",cD,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",uD,T(Q.event),1),p("code",dD,T(Q.command),1)]))),128))]))),128))]))],64)):(S(),I("p",aD,T(g(a)("Hooks are not supported by this Codex version.")),1))]),p("div",fD,[p("div",pD,[p("span",hD,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:di},[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",vD,T(ln.value.enabled?g(a)("Enabled"):g(a)("Disabled")),1)],8,mD)]),si.value?(S(),I(ze,{key:1},[Yo.value?(S(),I("p",yD,T(Yo.value),1)):ee("",!0),Ts.value?(S(),I("p",wD,T(Ts.value),1)):ee("",!0),Ro.value?(S(),I("p",bD,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:Ki},[p("span",CD,T(g(a)("Pair a new device")),1),p("span",TD,T(to.value==="pairing"?g(a)("Starting…"):(x=hn.value)!=null&&x.pairingCode?hn.value.pairingCode:g(a)("Generate code")),1)],8,kD),p("div",SD,[p("div",_D,[p("span",xD,T(g(a)("Paired devices")),1),p("button",{class:"sidebar-settings-remote-reload",type:"button",disabled:eo.value,onClick:_s},T(to.value==="clients"?g(a)("Reloading…"):g(a)("Reload")),9,AD)]),ln.value.clients.length===0?(S(),I("p",PD,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",ID,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,ED)]))),128))])],64))],64)):(S(),I("p",gD,T(g(a)("Remote control is not supported by this Codex version.")),1))])],512),[[du,yo.value==="integrations"]]),Lt(p("div",null,[p("div",RD,[Ie(f$,{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,MD)],512),[[du,yo.value==="usage"]])])])],8,IO)])):ee("",!0)])),p("div",$D,[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(YL,{class:"sidebar-settings-icon"})],8,jD),p("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:g(a)("Recycle bin"),"aria-label":g(a)("Recycle bin"),onClick:lt(Zw,["stop"])},[Ie(Ny,{class:"sidebar-settings-icon"})],8,LD)])],512))])]}),content:yt(()=>[p("div",ND,[p("section",{class:Ke(["content-root",{"is-virtual-keyboard-open":Td.value}]),style:kr(Oa.value)},[Ti.value?(S(),I("span",OD)):ee("",!0),Ie(cI,{title:bd.value,accent:gr.value||ts.value},{leading:yt(()=>[Bt.value||g(ht)?(S(),tt(nv,{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:Id},null,8,["is-sidebar-collapsed"])):ee("",!0),gr.value?(S(),I("span",DD,[Ie(Js)])):ts.value?(S(),I("span",FD,[Ie(Js)])):ee("",!0)]),actions:yt(()=>[nl.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:Kw},[Ie(Oy,{class:"content-header-right-panel-toggle-icon"})],8,UD)):ee("",!0)]),_:1},8,["title","accent"]),p("section",BD,[gr.value?(S(),tt(g(r),{key:0,ref_key:"directoryHubRef",ref:ir,cwd:Fc.value,"thread-id":es.value,"try-in-flight-key":cr.value,onSkillsChanged:Ls,onTryItem:c0},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":Lp.value,"project-display-name-by-id":g(J),"selected-automation-id":Oc.value,onSelectAutomation:Os,onEditAutomation:Qc,onCreateAutomation:ew},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):Rn.value?(S(),I("div",qD,[p("div",zD,[p("p",HD,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":nb},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,WD)):ee("",!0),p("div",VD,[p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Cb},T(g(a)("Select folder")),1),p("button",{class:"new-thread-folder-action",type:"button",onClick:db},T(g(a)("Create Project")),1),p("button",{class:"new-thread-folder-action",type:"button",disabled:Es.value,onClick:yb},T(Es.value?g(a)("Importing…"):g(a)("Import Project")),9,GD),p("input",{ref_key:"projectImportInputRef",ref:Lc,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:kb},null,544)]),As.value?(S(),I("section",KD,[p("div",YD,[p("div",JD,[p("span",QD,[Ie(Js)]),p("p",XD,T(g(a)("New in Codex")),1)]),p("h2",ZD,T(g(a)("Plugins are here")),1),p("p",eF,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",tF,[p("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:qc},T(g(a)("Explore Plugins & Apps")),1),p("button",{class:"new-thread-launch-card-button",type:"button",onClick:Bc},T(g(a)("Dismiss")),1)])])):ee("",!0),(S(),tt(Zs,{to:"body"},[$a.value?(S(),I("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:lt(fb,["self"]),onMouseup:pb},[p("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":g(a)("Select folder"),onKeydown:An(lt(il,["prevent"]),["esc"])},[p("div",oF,[p("p",rF,T(g(a)("Select folder")),1),p("button",{class:"new-thread-open-folder-close",type:"button",onClick:il},T(g(a)("Cancel")),1)]),p("p",aF,T(g(a)("Current folder")),1),p("div",sF,[Lt(p("input",{ref_key:"existingFolderPathInputRef",ref:Nc,"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:xb,onKeydown:[An(lt(Ab,["prevent"]),["enter"]),An(lt(il,["prevent"]),["esc"])]},null,40,iF),[[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=>jd())},T(ko.value?g(a)("Opening…"):g(a)("Open")),9,lF)]),p("div",cF,[p("label",uF,[Lt(p("input",{"onUpdate:modelValue":f[25]||(f[25]=x=>gi.value=x),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Sb},null,544),[[Kg,gi.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:Pb},T(g(a)("New folder")),11,dF)]),Kt.value?(S(),I("div",fF,[p("div",pF,[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(Qp,["prevent"]),["enter"]),An(lt(Yl,["prevent"]),["esc"])]},null,40,hF),[[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:Qp},T(Z.value),9,mF)]),bn.value?(S(),I("div",vF,[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,gF)])):ee("",!0)])):ee("",!0),Lt(p("input",{ref_key:"existingFolderFilterInputRef",ref:wd,"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(il,["prevent"]),["esc"])},null,40,yF),[[an,Dr.value]]),Bn.value?(S(),I("div",wF,[p("div",bF,[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,kF)]),p("button",{class:"new-thread-folder-action",type:"button",disabled:No.value||ko.value,onClick:_b},T(g(a)("Retry")),9,CF)])):ee("",!0),No.value?(S(),I("p",TF,T(g(a)("Loading folders…")),1)):!Bn.value&&pt.value.length===0?(S(),I("p",SF,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",_F,[(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=>Tb(x.path)},[p("span",AF,T(x.name),1)],8,xF),x.kind==="directory"?(S(),I("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:No.value||ko.value,onClick:N=>jd(x.path)},T(g(a)("Open")),9,PF)):ee("",!0)]))),128))])):ee("",!0)],40,nF)],32)):ee("",!0)])),(S(),tt(Zs,{to:"body"},[Nr.value?(S(),I("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:lt(hb,["self"]),onMouseup:mb},[p("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":g(a)("Create or clone project"),onKeydown:An(lt(ou,["prevent"]),["esc"])},[p("div",EF,[p("p",RF,T(g(a)("Create or clone project")),1),p("button",{class:"new-thread-open-folder-close",type:"button",disabled:Lo.value,onClick:ou},T(g(a)("Cancel")),9,MF)]),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,jF),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,LF)],8,$F),p("label",NF,[p("span",OF,T(g(a)("Destination folder")),1),Lt(p("input",{"onUpdate:modelValue":f[32]||(f[32]=x=>Is.value=x),class:"new-thread-open-folder-path",type:"text",disabled:Lo.value,placeholder:g(a)("Destination folder")},null,8,DF),[[an,Is.value]])]),jo.value==="create"?(S(),I("label",FF,[p("span",UF,T(g(a)("Project name")),1),Lt(p("input",{ref_key:"projectSetupPrimaryInputRef",ref:Nl,"onUpdate:modelValue":f[33]||(f[33]=x=>mi.value=x),class:"new-thread-open-folder-create-input",type:"text",disabled:Lo.value,placeholder:g(a)("Project name"),onKeydown:An(lt($d,["prevent"]),["enter"])},null,40,BF),[[an,mi.value]])])):jo.value==="clone"?(S(),I("label",qF,[p("span",zF,T(g(a)("GitHub repository URL")),1),Lt(p("input",{ref_key:"projectSetupPrimaryInputRef",ref:Nl,"onUpdate:modelValue":f[34]||(f[34]=x=>vi.value=x),class:"new-thread-open-folder-create-input",type:"url",disabled:Lo.value,placeholder:"https://github.com/owner/repo",onKeydown:An(lt($d,["prevent"]),["enter"])},null,40,HF),[[an,vi.value]])])):ee("",!0),Ma.value?(S(),I("div",WF,[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,VF)])):ee("",!0),p("div",GF,[p("button",{class:"new-thread-folder-action",type:"button",disabled:Lo.value,onClick:ou},T(g(a)("Cancel")),9,KF),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!L.value||Lo.value,onClick:$d},T(he.value),9,YF)])],40,IF)],32)):ee("",!0)])),ns.value?(S(),tt(g$,{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",JF,[p("p",QF,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":ob},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),p("p",XF,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",ZF,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",eU,T(yn.value.title),1),p("span",tU,T(yn.value.message),1)],2)):ee("",!0)]),p("div",nU,[g(Ue)?(S(),I("div",oU,[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,rU)])):ee("",!0),Ie(tv,{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":$s.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:Gp,"onUpdate:selectedCollaborationMode":lh,"onUpdate:selectedModel":th,"onUpdate:selectedReasoningEffort":nh,"onUpdate:selectedSpeedMode":oh,"approval-policy":Zt.value,"is-approval-policy-saving":Ss.value,"approval-policy-error":no.value,"approval-policy-notice":dr.value,"onUpdate:approvalPolicy":_a,onSaveApprovalPolicy:$n,onSlashCommand:rh},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",aU,[Gn.value&&g(de)&&mn.value?(S(),tt(g(o),{key:0,"thread-id":g(de),cwd:mn.value,"is-thread-in-progress":Si.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",sU,[Ie(g(t),{ref_key:"threadConversationRef",ref:ka,messages:Ci.value,"is-loading":g(ft),"active-thread-id":yr.value,cwd:mn.value,"live-overlay":kd.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:Hw,onRollback:$b,onFileChangesChanged:zc,onRespondServerRequest:Fp},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},[Uc.value?(S(),I("div",iU,T(g(a)("This thread is running in the Codex TUI")),1)):ee("",!0),g(Ue)?(S(),I("div",lU,[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,cU)])):ee("",!0),Ie(o$,{messages:g(W),onEdit:tb,onSteer:g(Oe),onDelete:g(Y),onReorder:Rb},null,8,["messages","onSteer","onDelete"]),Jl.value?(S(),I("div",uU,[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,dU)])):ee("",!0),tl.value?(S(),tt(WM,{key:3,request:tl.value,"request-count":g(V).length,"has-queue-above":g(W).length>0,"panel-width":Kr.value,"visual-viewport-height":Ti.value?La.value:0,"panel-error":zl.value,onRespondServerRequest:Fp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(S(),tt(tv,{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":$s.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":Si.value,"is-stop-pending":g(ae),"is-interrupting-turn":g(at),"is-compacting":Ur.value,"external-session-active":Uc.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":lh,onSubmit:Gp,"onUpdate:selectedModel":th,"onUpdate:selectedReasoningEffort":nh,"onUpdate:selectedSpeedMode":oh,"approval-policy":Zt.value,"is-approval-policy-saving":Ss.value,"approval-policy-error":no.value,"approval-policy-notice":dr.value,"onUpdate:approvalPolicy":_a,onSaveApprovalPolicy:$n,"plan-panel":ql.value,onInterrupt:Mb,onSlashCommand:rh,onImplementPlan:jb,onCompactContext:Sd},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:qp})):ee("",!0),nl.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",fU,[p("div",pU,[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=>xi("git"))},[Ie(Ju,{class:"content-right-panel-tab-icon"}),ps(" "+T(g(a)("Git")),1)],10,hU),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=>xi("files"))},[Ie(rv,{class:"content-right-panel-tab-icon"}),ps(" "+T(g(a)("Files")),1)],10,mU),(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=>Vw(x.key)},[Ie(zi,{class:"content-right-panel-tab-icon"}),p("span",gU,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=>Gw(x.key),["stop"])},"×",8,yU)],10,vU))),128))]),p("div",wU,[p("div",bU,[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,kU),Ie($c,{name:"right-panel-menu"},{default:yt(()=>[Xn.value?(S(),I("div",CU,[p("button",{type:"button",onClick:f[44]||(f[44]=x=>xi("terminal"))},[Ie(ZL,{class:"content-right-panel-menu-icon"}),ps(" "+T(g(a)("Terminal panel")),1)]),p("button",{type:"button",onClick:f[45]||(f[45]=x=>xi("git"))},[Ie(Ju,{class:"content-right-panel-menu-icon"}),ps(" "+T(g(a)("Git panel")),1)]),p("button",{type:"button",onClick:f[46]||(f[46]=x=>xi("files"))},[Ie(rv,{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:qp},[Ie($u,{class:"content-right-panel-close-icon"})],8,TU)])]),p("div",SU,[$t.value==="git"?(S(),tt(dL,{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":xs.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:cb,onCheckoutBranch:ab,onResetBranchToCommit:sb,onLoadCommits:Jp,onLoadCommitFiles:ib,onOpenCommitFile:lb},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(xL,{key:1,cwd:mn.value,onOpenPreview:Ww},null,8,["cwd"])):$t.value==="preview"&&Hn.value?(S(),tt(qL,{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:Yw,onTerminalFocusChange:Jw},null,8,["thread-id","cwd"]))])],6)):ee("",!0)])]),_:1},8,["is-sidebar-collapsed"]),xt.value.phase!=="idle"?(S(),I("div",_U,[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",AU,[p("h2",PU,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:Op}," × ",8,IU)]),p("p",EU,T(xt.value.phase==="exporting"?g(a)("Preparing project ZIP..."):xt.value.fileName),1),p("div",RU,[p("span",null,T(xt.value.phase==="exporting"?g(a)("Exporting"):g(a)("Ready")),1),p("span",null,T(Ll.value),1)]),p("div",MU,[p("div",{class:"project-zip-progress-fill",style:kr({width:hi.value})},null,4)]),xt.value.error?(S(),I("p",$U,T(xt.value.error),1)):ee("",!0),p("div",jU,[p("button",{class:"project-zip-modal-cancel",type:"button",disabled:xt.value.phase==="exporting",onClick:Op},T(g(a)("Close")),9,LU),p("button",{class:"project-zip-modal-action",type:"button",disabled:!xt.value.blob,onClick:$w},T(g(a)("Download")),9,NU),p("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!xt.value.blob,onClick:jw},T(g(a)("Share")),9,OU)])],8,xU)])):ee("",!0),Ya.value?(S(),I("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Pd},[p("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":g(a)("Complete Codex login"),onSubmit:lt(gw,["prevent"]),onClick:f[51]||(f[51]=lt(()=>{},["stop"]))},[p("div",FU,[p("h2",UU,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:Pd}," × ",8,BU)]),p("p",qU,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,zU)):ee("",!0),Lt(p("input",{ref_key:"codexLoginCallbackInputRef",ref:pi,"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,HU),[[an,$r.value]]),wn.value?(S(),I("div",WU,[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,VU)])):ee("",!0),p("div",GU,[p("button",{class:"codex-login-modal-cancel",type:"button",disabled:Ln.value,onClick:Pd},T(g(a)("Cancel")),9,KU),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,YU)])],40,DU)])):ee("",!0)],64))}}),tB=bt(eB,[["__scopeId","data-v-0cb5f599"]]),Pu={render:()=>null},nB=QT({history:IT(),routes:[{path:"/",name:"home",component:Pu},{path:"/thread/:threadId",name:"thread",component:Pu},{path:"/skills",name:"skills",component:Pu},{path:"/automations",name:"automations",component:Pu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-mobile-re. github: https://github.com/cattails-lgao/codex-mobile");k1();UC(tB).use(nB).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Ey("Service worker registration failed."),e)})});export{An as $,gu as A,Cp as B,Wt as C,av as D,rB as E,ze as F,pp as G,mI as H,$u as I,nc as J,tj as K,D_ as L,VN as M,bs as N,T_ as O,hB as P,fB as Q,mB as R,pB as S,Zs as T,vB as U,or as V,$B as W,LB as X,jB as Y,oB as Z,bt as _,I as a,Ip as a0,Lt as a1,an as a2,ZT as a3,XT as a4,i_ as a5,gB as a6,aB as a7,sB as a8,iB as a9,CB as aa,AB as ab,PB as ac,yB as ad,xB as ae,cB as af,lB as ag,uB as ah,dB as ai,IB as aj,RB as ak,MB as al,wB as am,bB as an,kB as ao,TB as ap,_B as aq,SB as ar,EB as as,y_ as at,w_ as au,Js as av,AI as aw,p as b,tt as c,tn as d,ee as e,ps as f,Ie as g,$c as h,yt as i,io as j,X as k,nt as l,Hi as m,Ke as n,S as o,kr as p,A as q,_t as r,Dy as s,T as t,g as u,Ep as v,lt as w,Ju as x,rr as y,Qs as z};