codex-phone 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -0
- package/README.md +278 -0
- package/dist/assets/AutomationsPanel-CVRRdwJX.css +1 -0
- package/dist/assets/AutomationsPanel-uscQHN1e.js +1 -0
- package/dist/assets/DirectoryHub-C8N1e8Jl.css +1 -0
- package/dist/assets/DirectoryHub-DPAFmuRH.js +2 -0
- package/dist/assets/ReviewPane-BZOe7axm.js +1 -0
- package/dist/assets/ReviewPane-CoYYQ3xu.css +1 -0
- package/dist/assets/ThreadConversation-BTpe8eca.js +39 -0
- package/dist/assets/ThreadConversation-DruQC3Ap.css +1 -0
- package/dist/assets/ThreadTerminalPanel-BTLjAaIQ.js +38 -0
- package/dist/assets/ThreadTerminalPanel-V1YtpglL.css +32 -0
- package/dist/assets/common-BeuopZEI.js +5 -0
- package/dist/assets/index-BzkJYDSJ.css +1 -0
- package/dist/assets/index-Dp2k2aGg.js +73 -0
- package/dist/assets/index.esm-CXKcZNKa.js +376 -0
- package/dist/assets/index.esm-ChJ56zLV.js +1651 -0
- package/dist/assets/index.esm-rglDf0Dn.js +16 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/codexui-icon.svg +52 -0
- package/dist/icons/maskable-512x512.png +0 -0
- package/dist/icons/pwa-192x192.png +0 -0
- package/dist/icons/pwa-512x512.png +0 -0
- package/dist/icons/pwa-icon.svg +38 -0
- package/dist/icons/pwa-maskable.svg +36 -0
- package/dist/index.html +21 -0
- package/dist/manifest.webmanifest +36 -0
- package/dist/sw.js +92 -0
- package/dist-cli/index.js +15263 -0
- package/dist-cli/index.js.map +1 -0
- package/package.json +93 -0
- package/scripts/dev-random-home.cjs +21 -0
- package/scripts/dev.cjs +62 -0
- package/scripts/fix-pty-native-build.cjs +70 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-BTpe8eca.js","assets/ThreadConversation-DruQC3Ap.css","assets/ThreadTerminalPanel-BTLjAaIQ.js","assets/ThreadTerminalPanel-V1YtpglL.css","assets/ReviewPane-BZOe7axm.js","assets/ReviewPane-CoYYQ3xu.css","assets/DirectoryHub-DPAFmuRH.js","assets/DirectoryHub-C8N1e8Jl.css","assets/AutomationsPanel-uscQHN1e.js","assets/AutomationsPanel-CVRRdwJX.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
|
|
3
|
+
* @vue/shared v3.5.35
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function sd(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const nn={},ci=[],xa=()=>{},Up=()=>!1,gu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),yu=e=>e.startsWith("onUpdate:"),Mn=Object.assign,id=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},aw=Object.prototype.hasOwnProperty,Bt=(e,t)=>aw.call(e,t),dt=Array.isArray,di=e=>vl(e)==="[object Map]",wu=e=>vl(e)==="[object Set]",Tf=e=>vl(e)==="[object Date]",mt=e=>typeof e=="function",ln=e=>typeof e=="string",oa=e=>typeof e=="symbol",qt=e=>e!==null&&typeof e=="object",Bp=e=>(qt(e)||mt(e))&&mt(e.then)&&mt(e.catch),qp=Object.prototype.toString,vl=e=>qp.call(e),sw=e=>vl(e).slice(8,-1),Hp=e=>vl(e)==="[object Object]",ld=e=>ln(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Zi=sd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),bu=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},iw=/-\w/g,xr=bu(e=>e.replace(iw,t=>t.slice(1).toUpperCase())),lw=/\B([A-Z])/g,cs=bu(e=>e.replace(lw,"-$1").toLowerCase()),_u=bu(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zu=bu(e=>e?`on${_u(e)}`:""),Qo=(e,t)=>!Object.is(e,t),eu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},zp=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ud=e=>{const t=parseFloat(e);return isNaN(t)?e:t},uw=e=>{const t=ln(e)?Number(e):NaN;return isNaN(t)?e:t};let Cf;const ku=()=>Cf||(Cf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ea(e){if(dt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=ln(r)?hw(r):ea(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(ln(e)||qt(e))return e}const cw=/;(?![^(]*\))/g,dw=/:([^]+)/,fw=/\/\*[^]*?\*\//g;function hw(e){const t={};return e.replace(fw,"").split(cw).forEach(n=>{if(n){const r=n.split(dw);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function Ze(e){let t="";if(ln(e))t=e;else if(dt(e))for(let n=0;n<e.length;n++){const r=Ze(e[n]);r&&(t+=r+" ")}else if(qt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const pw="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mw=sd(pw);function Wp(e){return!!e||e===""}function vw(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=gl(e[r],t[r]);return n}function gl(e,t){if(e===t)return!0;let n=Tf(e),r=Tf(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=oa(e),r=oa(t),n||r)return e===t;if(n=dt(e),r=dt(t),n||r)return n&&r?vw(e,t):!1;if(n=qt(e),r=qt(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const s in e){const u=e.hasOwnProperty(s),f=t.hasOwnProperty(s);if(u&&!f||!u&&f||!gl(e[s],t[s]))return!1}}return String(e)===String(t)}function Vp(e,t){return e.findIndex(n=>gl(n,t))}const Gp=e=>!!(e&&e.__v_isRef===!0),E=e=>ln(e)?e:e==null?"":dt(e)||qt(e)&&(e.toString===qp||!mt(e.toString))?Gp(e)?E(e.value):JSON.stringify(e,Kp,2):String(e),Kp=(e,t)=>Gp(t)?Kp(e,t.value):di(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[ec(r,a)+" =>"]=o,n),{})}:wu(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ec(n))}:oa(t)?ec(t):qt(t)&&!dt(t)&&!Hp(t)?String(t):t,ec=(e,t="")=>{var n;return oa(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
7
|
+
* @vue/reactivity v3.5.35
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let Qn;class gw{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&&Qn&&(Qn.active?(this.parent=Qn,this.index=(Qn.scopes||(Qn.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)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[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)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=Qn;try{return Qn=this,t()}finally{Qn=n}}}on(){++this._on===1&&(this.prevScope=Qn,Qn=this)}off(){if(this._on>0&&--this._on===0){if(Qn===this)Qn=this.prevScope;else{let t=Qn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function yw(){return Qn}let rn;const tc=new WeakSet;class Yp{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,Qn&&(Qn.active?Qn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,tc.has(this)&&(tc.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Qp(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Sf(this),Xp(this);const t=rn,n=ta;rn=this,ta=!0;try{return this.fn()}finally{Zp(this),rn=t,ta=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)fd(t);this.deps=this.depsTail=void 0,Sf(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?tc.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Rc(this)&&this.run()}get dirty(){return Rc(this)}}let Jp=0,el,tl;function Qp(e,t=!1){if(e.flags|=8,t){e.next=tl,tl=e;return}e.next=el,el=e}function cd(){Jp++}function dd(){if(--Jp>0)return;if(tl){let t=tl;for(tl=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;el;){let t=el;for(el=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Xp(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Zp(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),fd(r),ww(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Rc(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(em(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function em(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ll)||(e.globalVersion=ll,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Rc(e))))return;e.flags|=2;const t=e.dep,n=rn,r=ta;rn=e,ta=!0;try{Xp(e);const o=e.fn(e._value);(t.version===0||Qo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{rn=n,ta=r,Zp(e),e.flags&=-3}}function fd(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)fd(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ww(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let ta=!0;const tm=[];function Ha(){tm.push(ta),ta=!1}function za(){const e=tm.pop();ta=e===void 0?!0:e}function Sf(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=rn;rn=void 0;try{t()}finally{rn=n}}}let ll=0;class bw{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 hd{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||!ta||rn===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==rn)n=this.activeLink=new bw(rn,this),rn.deps?(n.prevDep=rn.depsTail,rn.depsTail.nextDep=n,rn.depsTail=n):rn.deps=rn.depsTail=n,nm(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=rn.depsTail,n.nextDep=void 0,rn.depsTail.nextDep=n,rn.depsTail=n,rn.deps===n&&(rn.deps=r)}return n}trigger(t){this.version++,ll++,this.notify(t)}notify(t){cd();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{dd()}}}function nm(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)nm(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Mc=new WeakMap,$s=Symbol(""),$c=Symbol(""),ul=Symbol("");function ur(e,t,n){if(ta&&rn){let r=Mc.get(e);r||Mc.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new hd),o.map=r,o.key=n),o.track()}}function Ba(e,t,n,r,o,a){const s=Mc.get(e);if(!s){ll++;return}const u=f=>{f&&f.trigger()};if(cd(),t==="clear")s.forEach(u);else{const f=dt(e),m=f&&ld(n);if(f&&n==="length"){const h=Number(r);s.forEach((y,C)=>{(C==="length"||C===ul||!oa(C)&&C>=h)&&u(y)})}else switch((n!==void 0||s.has(void 0))&&u(s.get(n)),m&&u(s.get(ul)),t){case"add":f?m&&u(s.get("length")):(u(s.get($s)),di(e)&&u(s.get($c)));break;case"delete":f||(u(s.get($s)),di(e)&&u(s.get($c)));break;case"set":di(e)&&u(s.get($s));break}}dd()}function Qs(e){const t=Ot(e);return t===e?t:(ur(t,"iterate",ul),_o(e)?t:t.map(aa))}function Tu(e){return ur(e=Ot(e),"iterate",ul),e}function Ta(e,t){return Wa(e)?wi(js(e)?aa(t):t):aa(t)}const _w={__proto__:null,[Symbol.iterator](){return nc(this,Symbol.iterator,e=>Ta(this,e))},concat(...e){return Qs(this).concat(...e.map(t=>dt(t)?Qs(t):t))},entries(){return nc(this,"entries",e=>(e[1]=Ta(this,e[1]),e))},every(e,t){return La(this,"every",e,t,void 0,arguments)},filter(e,t){return La(this,"filter",e,t,n=>n.map(r=>Ta(this,r)),arguments)},find(e,t){return La(this,"find",e,t,n=>Ta(this,n),arguments)},findIndex(e,t){return La(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return La(this,"findLast",e,t,n=>Ta(this,n),arguments)},findLastIndex(e,t){return La(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return La(this,"forEach",e,t,void 0,arguments)},includes(...e){return rc(this,"includes",e)},indexOf(...e){return rc(this,"indexOf",e)},join(e){return Qs(this).join(e)},lastIndexOf(...e){return rc(this,"lastIndexOf",e)},map(e,t){return La(this,"map",e,t,void 0,arguments)},pop(){return qi(this,"pop")},push(...e){return qi(this,"push",e)},reduce(e,...t){return xf(this,"reduce",e,t)},reduceRight(e,...t){return xf(this,"reduceRight",e,t)},shift(){return qi(this,"shift")},some(e,t){return La(this,"some",e,t,void 0,arguments)},splice(...e){return qi(this,"splice",e)},toReversed(){return Qs(this).toReversed()},toSorted(e){return Qs(this).toSorted(e)},toSpliced(...e){return Qs(this).toSpliced(...e)},unshift(...e){return qi(this,"unshift",e)},values(){return nc(this,"values",e=>Ta(this,e))}};function nc(e,t,n){const r=Tu(e),o=r[t]();return r!==e&&!_o(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const kw=Array.prototype;function La(e,t,n,r,o,a){const s=Tu(e),u=s!==e&&!_o(e),f=s[t];if(f!==kw[t]){const y=f.apply(e,a);return u?aa(y):y}let m=n;s!==e&&(u?m=function(y,C){return n.call(this,Ta(e,y),C,e)}:n.length>2&&(m=function(y,C){return n.call(this,y,C,e)}));const h=f.call(s,m,r);return u&&o?o(h):h}function xf(e,t,n,r){const o=Tu(e),a=o!==e&&!_o(e);let s=n,u=!1;o!==e&&(a?(u=r.length===0,s=function(m,h,y){return u&&(u=!1,m=Ta(e,m)),n.call(this,m,Ta(e,h),y,e)}):n.length>3&&(s=function(m,h,y){return n.call(this,m,h,y,e)}));const f=o[t](s,...r);return u?Ta(e,f):f}function rc(e,t,n){const r=Ot(e);ur(r,"iterate",ul);const o=r[t](...n);return(o===-1||o===!1)&&vd(n[0])?(n[0]=Ot(n[0]),r[t](...n)):o}function qi(e,t,n=[]){Ha(),cd();const r=Ot(e)[t].apply(e,n);return dd(),za(),r}const Tw=sd("__proto__,__v_isRef,__isVue"),rm=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(oa));function Cw(e){oa(e)||(e=String(e));const t=Ot(this);return ur(t,"has",e),t.hasOwnProperty(e)}class om{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return a;if(n==="__v_raw")return r===(o?a?jw:lm:a?im:sm).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=dt(t);if(!o){let f;if(s&&(f=_w[n]))return f;if(n==="hasOwnProperty")return Cw}const u=Reflect.get(t,n,dr(t)?t:r);if((oa(n)?rm.has(n):Tw(n))||(o||ur(t,"get",n),a))return u;if(dr(u)){const f=s&&ld(n)?u:u.value;return o&&qt(f)?Lc(f):f}return qt(u)?o?Lc(u):Cu(u):u}}class am extends om{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=dt(t)&&ld(n);if(!this._isShallow){const m=Wa(a);if(!_o(r)&&!Wa(r)&&(a=Ot(a),r=Ot(r)),!s&&dr(a)&&!dr(r))return m||(a.value=r),!0}const u=s?Number(n)<t.length:Bt(t,n),f=Reflect.set(t,n,r,dr(t)?t:o);return t===Ot(o)&&(u?Qo(r,a)&&Ba(t,"set",n,r):Ba(t,"add",n,r)),f}deleteProperty(t,n){const r=Bt(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&Ba(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!oa(n)||!rm.has(n))&&ur(t,"has",n),r}ownKeys(t){return ur(t,"iterate",dt(t)?"length":$s),Reflect.ownKeys(t)}}class Sw extends om{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const xw=new am,Aw=new Sw,Ew=new am(!0);const jc=e=>e,Dl=e=>Reflect.getPrototypeOf(e);function Pw(e,t,n){return function(...r){const o=this.__v_raw,a=Ot(o),s=di(a),u=e==="entries"||e===Symbol.iterator&&s,f=e==="keys"&&s,m=o[e](...r),h=n?jc:t?wi:aa;return!t&&ur(a,"iterate",f?$c:$s),Mn(Object.create(m),{next(){const{value:y,done:C}=m.next();return C?{value:y,done:C}:{value:u?[h(y[0]),h(y[1])]:h(y),done:C}}})}}function Fl(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Iw(e,t){const n={get(o){const a=this.__v_raw,s=Ot(a),u=Ot(o);e||(Qo(o,u)&&ur(s,"get",o),ur(s,"get",u));const{has:f}=Dl(s),m=t?jc:e?wi:aa;if(f.call(s,o))return m(a.get(o));if(f.call(s,u))return m(a.get(u));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&ur(Ot(o),"iterate",$s),o.size},has(o){const a=this.__v_raw,s=Ot(a),u=Ot(o);return e||(Qo(o,u)&&ur(s,"has",o),ur(s,"has",u)),o===u?a.has(o):a.has(o)||a.has(u)},forEach(o,a){const s=this,u=s.__v_raw,f=Ot(u),m=t?jc:e?wi:aa;return!e&&ur(f,"iterate",$s),u.forEach((h,y)=>o.call(a,m(h),m(y),s))}};return Mn(n,e?{add:Fl("add"),set:Fl("set"),delete:Fl("delete"),clear:Fl("clear")}:{add(o){const a=Ot(this),s=Dl(a),u=Ot(o),f=!t&&!_o(o)&&!Wa(o)?u:o;return s.has.call(a,f)||Qo(o,f)&&s.has.call(a,o)||Qo(u,f)&&s.has.call(a,u)||(a.add(f),Ba(a,"add",f,f)),this},set(o,a){!t&&!_o(a)&&!Wa(a)&&(a=Ot(a));const s=Ot(this),{has:u,get:f}=Dl(s);let m=u.call(s,o);m||(o=Ot(o),m=u.call(s,o));const h=f.call(s,o);return s.set(o,a),m?Qo(a,h)&&Ba(s,"set",o,a):Ba(s,"add",o,a),this},delete(o){const a=Ot(this),{has:s,get:u}=Dl(a);let f=s.call(a,o);f||(o=Ot(o),f=s.call(a,o)),u&&u.call(a,o);const m=a.delete(o);return f&&Ba(a,"delete",o,void 0),m},clear(){const o=Ot(this),a=o.size!==0,s=o.clear();return a&&Ba(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=Pw(o,e,t)}),n}function pd(e,t){const n=Iw(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Bt(n,o)&&o in r?n:r,o,a)}const Rw={get:pd(!1,!1)},Mw={get:pd(!1,!0)},$w={get:pd(!0,!1)};const sm=new WeakMap,im=new WeakMap,lm=new WeakMap,jw=new WeakMap;function Lw(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Cu(e){return Wa(e)?e:md(e,!1,xw,Rw,sm)}function um(e){return md(e,!1,Ew,Mw,im)}function Lc(e){return md(e,!0,Aw,$w,lm)}function md(e,t,n,r,o){if(!qt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=o.get(e);if(a)return a;const s=Lw(sw(e));if(s===0)return e;const u=new Proxy(e,s===2?r:n);return o.set(e,u),u}function js(e){return Wa(e)?js(e.__v_raw):!!(e&&e.__v_isReactive)}function Wa(e){return!!(e&&e.__v_isReadonly)}function _o(e){return!!(e&&e.__v_isShallow)}function vd(e){return e?!!e.__v_raw:!1}function Ot(e){const t=e&&e.__v_raw;return t?Ot(t):e}function Nw(e){return!Bt(e,"__v_skip")&&Object.isExtensible(e)&&zp(e,"__v_skip",!0),e}const aa=e=>qt(e)?Cu(e):e,wi=e=>qt(e)?Lc(e):e;function dr(e){return e?e.__v_isRef===!0:!1}function x(e){return cm(e,!1)}function Ow(e){return cm(e,!0)}function cm(e,t){return dr(e)?e:new Dw(e,t)}class Dw{constructor(t,n){this.dep=new hd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Ot(t),this._value=n?t:aa(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||_o(t)||Wa(t);t=r?t:Ot(t),Qo(t,n)&&(this._rawValue=t,this._value=r?t:aa(t),this.dep.trigger())}}function T(e){return dr(e)?e.value:e}const Fw={get:(e,t,n)=>t==="__v_raw"?e:T(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return dr(o)&&!dr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function dm(e){return js(e)?e:new Proxy(e,Fw)}class Uw{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new hd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ll-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&rn!==this)return Qp(this,!0),!0}get value(){const t=this.dep.track();return em(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Bw(e,t,n=!1){let r,o;return mt(e)?r=e:(r=e.get,o=e.set),new Uw(r,o,n)}const Ul={},su=new WeakMap;let xs;function qw(e,t=!1,n=xs){if(n){let r=su.get(n);r||su.set(n,r=[]),r.push(e)}}function Hw(e,t,n=nn){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:u,call:f}=n,m=se=>o?se:_o(se)||o===!1||o===0?qa(se,1):qa(se);let h,y,C,I,F=!1,B=!1;if(dr(e)?(y=()=>e.value,F=_o(e)):js(e)?(y=()=>m(e),F=!0):dt(e)?(B=!0,F=e.some(se=>js(se)||_o(se)),y=()=>e.map(se=>{if(dr(se))return se.value;if(js(se))return m(se);if(mt(se))return f?f(se,2):se()})):mt(e)?t?y=f?()=>f(e,2):e:y=()=>{if(C){Ha();try{C()}finally{za()}}const se=xs;xs=h;try{return f?f(e,3,[I]):e(I)}finally{xs=se}}:y=xa,t&&o){const se=y,Te=o===!0?1/0:o;y=()=>qa(se(),Te)}const oe=yw(),V=()=>{h.stop(),oe&&oe.active&&id(oe.effects,h)};if(a&&t){const se=t;t=(...Te)=>{se(...Te),V()}}let O=B?new Array(e.length).fill(Ul):Ul;const ee=se=>{if(!(!(h.flags&1)||!h.dirty&&!se))if(t){const Te=h.run();if(o||F||(B?Te.some((Fe,ae)=>Qo(Fe,O[ae])):Qo(Te,O))){C&&C();const Fe=xs;xs=h;try{const ae=[Te,O===Ul?void 0:B&&O[0]===Ul?[]:O,I];O=Te,f?f(t,3,ae):t(...ae)}finally{xs=Fe}}}else h.run()};return u&&u(ee),h=new Yp(y),h.scheduler=s?()=>s(ee,!1):ee,I=se=>qw(se,!1,h),C=h.onStop=()=>{const se=su.get(h);if(se){if(f)f(se,4);else for(const Te of se)Te();su.delete(h)}},t?r?ee(!0):O=h.run():s?s(ee.bind(null,!0),!0):h.run(),V.pause=h.pause.bind(h),V.resume=h.resume.bind(h),V.stop=V,V}function qa(e,t=1/0,n){if(t<=0||!qt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,dr(e))qa(e.value,t,n);else if(dt(e))for(let r=0;r<e.length;r++)qa(e[r],t,n);else if(wu(e)||di(e))e.forEach(r=>{qa(r,t,n)});else if(Hp(e)){for(const r in e)qa(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&qa(e[r],t,n)}return e}/**
|
|
11
|
+
* @vue/runtime-core v3.5.35
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function yl(e,t,n,r){try{return r?e(...r):e()}catch(o){wl(o,t,n)}}function To(e,t,n,r){if(mt(e)){const o=yl(e,t,n,r);return o&&Bp(o)&&o.catch(a=>{wl(a,t,n)}),o}if(dt(e)){const o=[];for(let a=0;a<e.length;a++)o.push(To(e[a],t,n,r));return o}}function wl(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||nn;if(t){let u=t.parent;const f=t.proxy,m=`https://vuejs.org/error-reference/#runtime-${n}`;for(;u;){const h=u.ec;if(h){for(let y=0;y<h.length;y++)if(h[y](e,f,m)===!1)return}u=u.parent}if(a){Ha(),yl(a,null,10,[e,f,m]),za();return}}zw(e,n,o,r,s)}function zw(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const Cr=[];let ka=-1;const fi=[];let as=null,ri=0;const fm=Promise.resolve();let iu=null;function zt(e){const t=iu||fm;return e?t.then(this?e.bind(this):e):t}function Ww(e){let t=ka+1,n=Cr.length;for(;t<n;){const r=t+n>>>1,o=Cr[r],a=cl(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function gd(e){if(!(e.flags&1)){const t=cl(e),n=Cr[Cr.length-1];!n||!(e.flags&2)&&t>=cl(n)?Cr.push(e):Cr.splice(Ww(t),0,e),e.flags|=1,hm()}}function hm(){iu||(iu=fm.then(mm))}function Vw(e){dt(e)?fi.push(...e):as&&e.id===-1?as.splice(ri+1,0,e):e.flags&1||(fi.push(e),e.flags|=1),hm()}function Af(e,t,n=ka+1){for(;n<Cr.length;n++){const r=Cr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Cr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function pm(e){if(fi.length){const t=[...new Set(fi)].sort((n,r)=>cl(n)-cl(r));if(fi.length=0,as){as.push(...t);return}for(as=t,ri=0;ri<as.length;ri++){const n=as[ri];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}as=null,ri=0}}const cl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function mm(e){try{for(ka=0;ka<Cr.length;ka++){const t=Cr[ka];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),yl(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ka<Cr.length;ka++){const t=Cr[ka];t&&(t.flags&=-2)}ka=-1,Cr.length=0,pm(),iu=null,(Cr.length||fi.length)&&mm()}}let Zn=null,vm=null;function lu(e){const t=Zn;return Zn=e,vm=e&&e.type.__scopeId||null,t}function yt(e,t=Zn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&du(-1);const a=lu(t);let s;try{s=e(...o)}finally{lu(a),r._d&&du(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function Yt(e,t){if(Zn===null)return e;const n=Pu(Zn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,u,f=nn]=t[o];a&&(mt(a)&&(a={mounted:a,updated:a}),a.deep&&qa(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:u,modifiers:f}))}return e}function ks(e,t,n,r){const o=e.dirs,a=t&&t.dirs;for(let s=0;s<o.length;s++){const u=o[s];a&&(u.oldValue=a[s].value);let f=u.dir[r];f&&(Ha(),To(f,n,8,[e.el,u,e,t]),za())}}function tu(e,t){if(Xn){let n=Xn.provides;const r=Xn.parent&&Xn.parent.provides;r===n&&(n=Xn.provides=Object.create(r)),n[e]=t}}function na(e,t,n=!1){const r=Cd();if(r||pi){let o=pi?pi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&mt(t)?t.call(r&&r.proxy):t}}const Gw=Symbol.for("v-scx"),Kw=()=>na(Gw);function ft(e,t,n){return gm(e,t,n)}function gm(e,t,n=nn){const{immediate:r,deep:o,flush:a,once:s}=n,u=Mn({},n),f=t&&r||!t&&a!=="post";let m;if(_i){if(a==="sync"){const I=Kw();m=I.__watcherHandles||(I.__watcherHandles=[])}else if(!f){const I=()=>{};return I.stop=xa,I.resume=xa,I.pause=xa,I}}const h=Xn;u.call=(I,F,B)=>To(I,h,F,B);let y=!1;a==="post"?u.scheduler=I=>{kr(I,h&&h.suspense)}:a!=="sync"&&(y=!0,u.scheduler=(I,F)=>{F?I():gd(I)}),u.augmentJob=I=>{t&&(I.flags|=4),y&&(I.flags|=2,h&&(I.id=h.uid,I.i=h))};const C=Hw(e,t,u);return _i&&(m?m.push(C):f&&C()),C}function Yw(e,t,n){const r=this.proxy,o=ln(e)?e.includes(".")?ym(r,e):()=>r[e]:e.bind(r,r);let a;mt(t)?a=t:(a=t.handler,n=t);const s=_l(this),u=gm(o,a.bind(r),n);return s(),u}function ym(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}const rs=new WeakMap,wm=Symbol("_vte"),bm=e=>e.__isTeleport,Es=e=>e&&(e.disabled||e.disabled===""),Jw=e=>e&&(e.defer||e.defer===""),Ef=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Pf=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Nc=(e,t)=>{const n=e&&e.to;return ln(n)?t?t(n):null:n},Qw={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,u,f,m){const{mc:h,pc:y,pbc:C,o:{insert:I,querySelector:F,createText:B,createComment:oe,parentNode:V}}=m,O=Es(t.props);let{dynamicChildren:ee}=t;const se=(ae,xe,le)=>{ae.shapeFlag&16&&h(ae.children,xe,le,o,a,s,u,f)},Te=(ae=t)=>{const xe=Es(ae.props),le=ae.target=Nc(ae.props,F),be=Oc(le,ae,B,I);le&&(s!=="svg"&&Ef(le)?s="svg":s!=="mathml"&&Pf(le)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(le),xe||(se(ae,le,be),Yi(ae,!1)))},Fe=ae=>{const xe=()=>{if(rs.get(ae)===xe){if(rs.delete(ae),Es(ae.props)){const le=V(ae.el)||n;se(ae,le,ae.anchor),Yi(ae,!0)}Te(ae)}};rs.set(ae,xe),kr(xe,a)};if(e==null){const ae=t.el=B(""),xe=t.anchor=B("");if(I(ae,n,r),I(xe,n,r),Jw(t.props)||a&&a.pendingBranch){Fe(t);return}O&&(se(t,n,xe),Yi(t,!0)),Te()}else{t.el=e.el;const ae=t.anchor=e.anchor,xe=rs.get(e);if(xe){xe.flags|=8,rs.delete(e),Fe(t);return}t.targetStart=e.targetStart;const le=t.target=e.target,be=t.targetAnchor=e.targetAnchor,Ue=Es(e.props),ce=Ue?n:le,fe=Ue?ae:be;if(s==="svg"||Ef(le)?s="svg":(s==="mathml"||Pf(le))&&(s="mathml"),ee?(C(e.dynamicChildren,ee,ce,o,a,s,u),kd(e,t,!0)):f||y(e,t,ce,fe,o,a,s,u,!1),O)Ue?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Bl(t,n,ae,m,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const Se=t.target=Nc(t.props,F);Se&&Bl(t,Se,null,m,0)}else Ue&&Bl(t,le,be,m,1);Yi(t,O)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:u,anchor:f,targetStart:m,targetAnchor:h,target:y,props:C}=e,I=a||!Es(C),F=rs.get(e);if(F&&(F.flags|=8,rs.delete(e)),y&&(o(m),o(h)),a&&o(f),!F&&s&16)for(let B=0;B<u.length;B++){const oe=u[B];r(oe,t,n,I,!!oe.dynamicChildren)}},move:Bl,hydrate:Xw};function Bl(e,t,n,{o:{insert:r},m:o},a=2){a===0&&r(e.targetAnchor,t,n);const{el:s,anchor:u,shapeFlag:f,children:m,props:h}=e,y=a===2;if(y&&r(s,t,n),!rs.has(e)&&(!y||Es(h))&&f&16)for(let C=0;C<m.length;C++)o(m[C],t,n,2);y&&r(u,t,n)}function Xw(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:u,querySelector:f,insert:m,createText:h}},y){function C(oe,V){let O=V;for(;O;){if(O&&O.nodeType===8){if(O.data==="teleport start anchor")t.targetStart=O;else if(O.data==="teleport anchor"){t.targetAnchor=O,oe._lpa=t.targetAnchor&&s(t.targetAnchor);break}}O=s(O)}}function I(oe,V){V.anchor=y(s(oe),V,u(oe),n,r,o,a)}const F=t.target=Nc(t.props,f),B=Es(t.props);if(F){const oe=F._lpa||F.firstChild;t.shapeFlag&16&&(B?(I(e,t),C(F,oe),t.targetAnchor||Oc(F,t,h,m,u(e)===F?e:null)):(t.anchor=s(e),C(F,oe),t.targetAnchor||Oc(F,t,h,m),y(oe&&s(oe),t,F,n,r,o,a))),Yi(t,B)}else B&&t.shapeFlag&16&&(I(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const is=Qw;function Yi(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Oc(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[wm]=s,e&&(r(a,e,o),r(s,e,o)),s}const bo=Symbol("_leaveCb"),Hi=Symbol("_enterCb");function Zw(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ga(()=>{e.isMounted=!0}),ds(()=>{e.isUnmounting=!0}),e}const wo=[Function,Array],_m={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:wo,onEnter:wo,onAfterEnter:wo,onEnterCancelled:wo,onBeforeLeave:wo,onLeave:wo,onAfterLeave:wo,onLeaveCancelled:wo,onBeforeAppear:wo,onAppear:wo,onAfterAppear:wo,onAppearCancelled:wo},km=e=>{const t=e.subTree;return t.component?km(t.component):t},eb={name:"BaseTransition",props:_m,setup(e,{slots:t}){const n=Cd(),r=Zw();return()=>{const o=t.default&&Sm(t.default(),!0),a=o&&o.length?Tm(o):n.subTree?Z():void 0;if(!a)return;const s=Ot(e),{mode:u}=s;if(r.isLeaving)return oc(a);const f=If(a);if(!f)return oc(a);let m=Dc(f,s,r,n,y=>m=y);f.type!==cr&&dl(f,m);let h=n.subTree&&If(n.subTree);if(h&&h.type!==cr&&!Ps(h,f)&&km(n).type!==cr){let y=Dc(h,s,r,n);if(dl(h,y),u==="out-in"&&f.type!==cr)return r.isLeaving=!0,y.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete y.afterLeave,h=void 0},oc(a);u==="in-out"&&f.type!==cr?y.delayLeave=(C,I,F)=>{const B=Cm(r,h);B[String(h.key)]=h,C[bo]=()=>{I(),C[bo]=void 0,delete m.delayedLeave,h=void 0},m.delayedLeave=()=>{F(),delete m.delayedLeave,h=void 0}}:h=void 0}else h&&(h=void 0);return a}}};function Tm(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==cr){t=n;break}}return t}const tb=eb;function Cm(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Dc(e,t,n,r,o){const{appear:a,mode:s,persisted:u=!1,onBeforeEnter:f,onEnter:m,onAfterEnter:h,onEnterCancelled:y,onBeforeLeave:C,onLeave:I,onAfterLeave:F,onLeaveCancelled:B,onBeforeAppear:oe,onAppear:V,onAfterAppear:O,onAppearCancelled:ee}=t,se=String(e.key),Te=Cm(n,e),Fe=(le,be)=>{le&&To(le,r,9,be)},ae=(le,be)=>{const Ue=be[1];Fe(le,be),dt(le)?le.every(ce=>ce.length<=1)&&Ue():le.length<=1&&Ue()},xe={mode:s,persisted:u,beforeEnter(le){let be=f;if(!n.isMounted)if(a)be=oe||f;else return;le[bo]&&le[bo](!0);const Ue=Te[se];Ue&&Ps(e,Ue)&&Ue.el[bo]&&Ue.el[bo](),Fe(be,[le])},enter(le){if(Te[se]===e)return;let be=m,Ue=h,ce=y;if(!n.isMounted)if(a)be=V||m,Ue=O||h,ce=ee||y;else return;let fe=!1;le[Hi]=De=>{fe||(fe=!0,De?Fe(ce,[le]):Fe(Ue,[le]),xe.delayedLeave&&xe.delayedLeave(),le[Hi]=void 0)};const Se=le[Hi].bind(null,!1);be?ae(be,[le,Se]):Se()},leave(le,be){const Ue=String(e.key);if(le[Hi]&&le[Hi](!0),n.isUnmounting)return be();Fe(C,[le]);let ce=!1;le[bo]=Se=>{ce||(ce=!0,be(),Se?Fe(B,[le]):Fe(F,[le]),le[bo]=void 0,Te[Ue]===e&&delete Te[Ue])};const fe=le[bo].bind(null,!1);Te[Ue]=e,I?ae(I,[le,fe]):fe()},clone(le){const be=Dc(le,t,n,r,o);return o&&o(be),be}};return xe}function oc(e){if(bl(e))return e=us(e),e.children=null,e}function If(e){if(!bl(e))return bm(e.type)&&e.children?Tm(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&&mt(n.default))return n.default()}}function dl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,dl(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Sm(e,t=!1,n){let r=[],o=0;for(let a=0;a<e.length;a++){let s=e[a];const u=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===tt?(s.patchFlag&128&&o++,r=r.concat(Sm(s.children,t,u))):(t||s.type!==cr)&&r.push(u!=null?us(s,{key:u}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function er(e,t){return mt(e)?Mn({name:e.name},t,{setup:e}):e}function yd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Rf(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const uu=new WeakMap;function nl(e,t,n,r,o=!1){if(dt(e)){e.forEach((B,oe)=>nl(B,t&&(dt(t)?t[oe]:t),n,r,o));return}if(hi(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&nl(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?Pu(r.component):r.el,s=o?null:a,{i:u,r:f}=e,m=t&&t.r,h=u.refs===nn?u.refs={}:u.refs,y=u.setupState,C=Ot(y),I=y===nn?Up:B=>Rf(h,B)?!1:Bt(C,B),F=(B,oe)=>!(oe&&Rf(h,oe));if(m!=null&&m!==f){if(Mf(t),ln(m))h[m]=null,I(m)&&(y[m]=null);else if(dr(m)){const B=t;F(m,B.k)&&(m.value=null),B.k&&(h[B.k]=null)}}if(mt(f))yl(f,u,12,[s,h]);else{const B=ln(f),oe=dr(f);if(B||oe){const V=()=>{if(e.f){const O=B?I(f)?y[f]:h[f]:F()||!e.k?f.value:h[e.k];if(o)dt(O)&&id(O,a);else if(dt(O))O.includes(a)||O.push(a);else if(B)h[f]=[a],I(f)&&(y[f]=h[f]);else{const ee=[a];F(f,e.k)&&(f.value=ee),e.k&&(h[e.k]=ee)}}else B?(h[f]=s,I(f)&&(y[f]=s)):oe&&(F(f,e.k)&&(f.value=s),e.k&&(h[e.k]=s))};if(s){const O=()=>{V(),uu.delete(e)};O.id=-1,uu.set(e,O),kr(O,n)}else Mf(e),V()}}}function Mf(e){const t=uu.get(e);t&&(t.flags|=8,uu.delete(e))}const $f=e=>e.nodeType===8;ku().requestIdleCallback;ku().cancelIdleCallback;function nb(e,t){if($f(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if($f(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const hi=e=>!!e.type.__asyncLoader;function zi(e){mt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:a,timeout:s,suspensible:u=!0,onError:f}=e;let m=null,h,y=0;const C=()=>(y++,m=null,I()),I=()=>{let F;return m||(F=m=t().catch(B=>{if(B=B instanceof Error?B:new Error(String(B)),f)return new Promise((oe,V)=>{f(B,()=>oe(C()),()=>V(B),y+1)});throw B}).then(B=>F!==m&&m?m:(B&&(B.__esModule||B[Symbol.toStringTag]==="Module")&&(B=B.default),h=B,B)))};return er({name:"AsyncComponentWrapper",__asyncLoader:I,__asyncHydrate(F,B,oe){let V=!1;(B.bu||(B.bu=[])).push(()=>V=!0);const O=()=>{V||oe()},ee=a?()=>{const se=a(O,Te=>nb(F,Te));se&&(B.bum||(B.bum=[])).push(se)}:O;h?ee():I().then(()=>!B.isUnmounted&&ee())},get __asyncResolved(){return h},setup(){const F=Xn;if(yd(F),h)return()=>ql(h,F);const B=ee=>{m=null,wl(ee,F,13,!r)};if(u&&F.suspense||_i)return I().then(ee=>()=>ql(ee,F)).catch(ee=>(B(ee),()=>r?je(r,{error:ee}):null));const oe=x(!1),V=x(),O=x(!!o);return o&&setTimeout(()=>{O.value=!1},o),s!=null&&setTimeout(()=>{if(!oe.value&&!V.value){const ee=new Error(`Async component timed out after ${s}ms.`);B(ee),V.value=ee}},s),I().then(()=>{oe.value=!0,F.parent&&bl(F.parent.vnode)&&F.parent.update()}).catch(ee=>{B(ee),V.value=ee}),()=>{if(oe.value&&h)return ql(h,F);if(V.value&&r)return je(r,{error:V.value});if(n&&!O.value)return ql(n,F)}}})}function ql(e,t){const{ref:n,props:r,children:o,ce:a}=t.vnode,s=je(e,r,o);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const bl=e=>e.type.__isKeepAlive;function rb(e,t){xm(e,"a",t)}function ob(e,t){xm(e,"da",t)}function xm(e,t,n=Xn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Su(t,r,n),n){let o=n.parent;for(;o&&o.parent;)bl(o.parent.vnode)&&ab(r,t,n,o),o=o.parent}}function ab(e,t,n,r){const o=Su(t,e,r,!0);xu(()=>{id(r[t],o)},n)}function Su(e,t,n=Xn,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Ha();const u=_l(n),f=To(t,n,e,s);return u(),za(),f});return r?o.unshift(a):o.push(a),a}}const Va=e=>(t,n=Xn)=>{(!_i||e==="sp")&&Su(e,(...r)=>t(...r),n)},sb=Va("bm"),Ga=Va("m"),ib=Va("bu"),lb=Va("u"),ds=Va("bum"),xu=Va("um"),ub=Va("sp"),cb=Va("rtg"),db=Va("rtc");function fb(e,t=Xn){Su("ec",e,t)}const hb="components",Am=Symbol.for("v-ndc");function wd(e){return ln(e)?pb(hb,e,!1)||e:e||Am}function pb(e,t,n=!0,r=!1){const o=Zn||Xn;if(o){const a=o.type;{const u=Xb(a,!1);if(u&&(u===t||u===xr(t)||u===_u(xr(t))))return a}const s=jf(o[e]||a[e],t)||jf(o.appContext[e],t);return!s&&r?a:s}}function jf(e,t){return e&&(e[t]||e[xr(t)]||e[_u(xr(t))])}function an(e,t,n,r){let o;const a=n,s=dt(e);if(s||ln(e)){const u=s&&js(e);let f=!1,m=!1;u&&(f=!_o(e),m=Wa(e),e=Tu(e)),o=new Array(e.length);for(let h=0,y=e.length;h<y;h++)o[h]=t(f?m?wi(aa(e[h])):aa(e[h]):e[h],h,void 0,a)}else if(typeof e=="number"){o=new Array(e);for(let u=0;u<e;u++)o[u]=t(u+1,u,void 0,a)}else if(qt(e))if(e[Symbol.iterator])o=Array.from(e,(u,f)=>t(u,f,void 0,a));else{const u=Object.keys(e);o=new Array(u.length);for(let f=0,m=u.length;f<m;f++){const h=u[f];o[f]=t(e[h],h,f,a)}}else o=[];return o}function Sa(e,t,n={},r,o){if(Zn.ce||Zn.parent&&hi(Zn.parent)&&Zn.parent.ce){const m=Object.keys(n).length>0;return t!=="default"&&(n.name=t),S(),rt(tt,null,[je("slot",n,r)],m?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),S();const s=a&&Em(a(n)),u=n.key||s&&s.key,f=rt(tt,{key:(u&&!oa(u)?u:`_${t}`)+(!s&&r?"_fb":"")},s||[],s&&e._===1?64:-2);return a&&a._c&&(a._d=!0),f}function Em(e){return e.some(t=>fl(t)?!(t.type===cr||t.type===tt&&!Em(t.children)):!0)?e:null}const Fc=e=>e?Km(e)?Pu(e):Fc(e.parent):null,rl=Mn(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=>Fc(e.parent),$root:e=>Fc(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Im(e),$forceUpdate:e=>e.f||(e.f=()=>{gd(e.update)}),$nextTick:e=>e.n||(e.n=zt.bind(e.proxy)),$watch:e=>Yw.bind(e)}),ac=(e,t)=>e!==nn&&!e.__isScriptSetup&&Bt(e,t),mb={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:a,accessCache:s,type:u,appContext:f}=e;if(t[0]!=="$"){const C=s[t];if(C!==void 0)switch(C){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return a[t]}else{if(ac(r,t))return s[t]=1,r[t];if(o!==nn&&Bt(o,t))return s[t]=2,o[t];if(Bt(a,t))return s[t]=3,a[t];if(n!==nn&&Bt(n,t))return s[t]=4,n[t];Uc&&(s[t]=0)}}const m=rl[t];let h,y;if(m)return t==="$attrs"&&ur(e.attrs,"get",""),m(e);if((h=u.__cssModules)&&(h=h[t]))return h;if(n!==nn&&Bt(n,t))return s[t]=4,n[t];if(y=f.config.globalProperties,Bt(y,t))return y[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return ac(o,t)?(o[t]=n,!0):r!==nn&&Bt(r,t)?(r[t]=n,!0):Bt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:a,type:s}},u){let f;return!!(n[u]||e!==nn&&u[0]!=="$"&&Bt(e,u)||ac(t,u)||Bt(a,u)||Bt(r,u)||Bt(rl,u)||Bt(o.config.globalProperties,u)||(f=s.__cssModules)&&f[u])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Bt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function vb(){return gb().slots}function gb(e){const t=Cd();return t.setupContext||(t.setupContext=Jm(t))}function Lf(e){return dt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Uc=!0;function yb(e){const t=Im(e),n=e.proxy,r=e.ctx;Uc=!1,t.beforeCreate&&Nf(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:u,provide:f,inject:m,created:h,beforeMount:y,mounted:C,beforeUpdate:I,updated:F,activated:B,deactivated:oe,beforeDestroy:V,beforeUnmount:O,destroyed:ee,unmounted:se,render:Te,renderTracked:Fe,renderTriggered:ae,errorCaptured:xe,serverPrefetch:le,expose:be,inheritAttrs:Ue,components:ce,directives:fe,filters:Se}=t;if(m&&wb(m,r,null),s)for(const Re in s){const Ie=s[Re];mt(Ie)&&(r[Re]=Ie.bind(n))}if(o){const Re=o.call(n,n);qt(Re)&&(e.data=Cu(Re))}if(Uc=!0,a)for(const Re in a){const Ie=a[Re],Qe=mt(Ie)?Ie.bind(n,n):mt(Ie.get)?Ie.get.bind(n,n):xa,et=!mt(Ie)&&mt(Ie.set)?Ie.set.bind(n):xa,Me=Q({get:Qe,set:et});Object.defineProperty(r,Re,{enumerable:!0,configurable:!0,get:()=>Me.value,set:We=>Me.value=We})}if(u)for(const Re in u)Pm(u[Re],r,n,Re);if(f){const Re=mt(f)?f.call(n):f;Reflect.ownKeys(Re).forEach(Ie=>{tu(Ie,Re[Ie])})}h&&Nf(h,e,"c");function Ee(Re,Ie){dt(Ie)?Ie.forEach(Qe=>Re(Qe.bind(n))):Ie&&Re(Ie.bind(n))}if(Ee(sb,y),Ee(Ga,C),Ee(ib,I),Ee(lb,F),Ee(rb,B),Ee(ob,oe),Ee(fb,xe),Ee(db,Fe),Ee(cb,ae),Ee(ds,O),Ee(xu,se),Ee(ub,le),dt(be))if(be.length){const Re=e.exposed||(e.exposed={});be.forEach(Ie=>{Object.defineProperty(Re,Ie,{get:()=>n[Ie],set:Qe=>n[Ie]=Qe,enumerable:!0})})}else e.exposed||(e.exposed={});Te&&e.render===xa&&(e.render=Te),Ue!=null&&(e.inheritAttrs=Ue),ce&&(e.components=ce),fe&&(e.directives=fe),le&&yd(e)}function wb(e,t,n=xa){dt(e)&&(e=Bc(e));for(const r in e){const o=e[r];let a;qt(o)?"default"in o?a=na(o.from||r,o.default,!0):a=na(o.from||r):a=na(o),dr(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function Nf(e,t,n){To(dt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Pm(e,t,n,r){let o=r.includes(".")?ym(n,r):()=>n[r];if(ln(e)){const a=t[e];mt(a)&&ft(o,a)}else if(mt(e))ft(o,e.bind(n));else if(qt(e))if(dt(e))e.forEach(a=>Pm(a,t,n,r));else{const a=mt(e.handler)?e.handler.bind(n):t[e.handler];mt(a)&&ft(o,a,e)}}function Im(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,u=a.get(t);let f;return u?f=u:!o.length&&!n&&!r?f=t:(f={},o.length&&o.forEach(m=>cu(f,m,s,!0)),cu(f,t,s)),qt(t)&&a.set(t,f),f}function cu(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&cu(e,a,n,!0),o&&o.forEach(s=>cu(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const u=bb[s]||n&&n[s];e[s]=u?u(e[s],t[s]):t[s]}return e}const bb={data:Of,props:Df,emits:Df,methods:Ji,computed:Ji,beforeCreate:_r,created:_r,beforeMount:_r,mounted:_r,beforeUpdate:_r,updated:_r,beforeDestroy:_r,beforeUnmount:_r,destroyed:_r,unmounted:_r,activated:_r,deactivated:_r,errorCaptured:_r,serverPrefetch:_r,components:Ji,directives:Ji,watch:kb,provide:Of,inject:_b};function Of(e,t){return t?e?function(){return Mn(mt(e)?e.call(this,this):e,mt(t)?t.call(this,this):t)}:t:e}function _b(e,t){return Ji(Bc(e),Bc(t))}function Bc(e){if(dt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function _r(e,t){return e?[...new Set([].concat(e,t))]:t}function Ji(e,t){return e?Mn(Object.create(null),e,t):t}function Df(e,t){return e?dt(e)&&dt(t)?[...new Set([...e,...t])]:Mn(Object.create(null),Lf(e),Lf(t??{})):t}function kb(e,t){if(!e)return t;if(!t)return e;const n=Mn(Object.create(null),e);for(const r in t)n[r]=_r(e[r],t[r]);return n}function Rm(){return{app:null,config:{isNativeTag:Up,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 Tb=0;function Cb(e,t){return function(r,o=null){mt(r)||(r=Mn({},r)),o!=null&&!qt(o)&&(o=null);const a=Rm(),s=new WeakSet,u=[];let f=!1;const m=a.app={_uid:Tb++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:t0,get config(){return a.config},set config(h){},use(h,...y){return s.has(h)||(h&&mt(h.install)?(s.add(h),h.install(m,...y)):mt(h)&&(s.add(h),h(m,...y))),m},mixin(h){return a.mixins.includes(h)||a.mixins.push(h),m},component(h,y){return y?(a.components[h]=y,m):a.components[h]},directive(h,y){return y?(a.directives[h]=y,m):a.directives[h]},mount(h,y,C){if(!f){const I=m._ceVNode||je(r,o);return I.appContext=a,C===!0?C="svg":C===!1&&(C=void 0),e(I,h,C),f=!0,m._container=h,h.__vue_app__=m,Pu(I.component)}},onUnmount(h){u.push(h)},unmount(){f&&(To(u,m._instance,16),e(null,m._container),delete m._container.__vue_app__)},provide(h,y){return a.provides[h]=y,m},runWithContext(h){const y=pi;pi=m;try{return h()}finally{pi=y}}};return m}}let pi=null;const Sb=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${xr(t)}Modifiers`]||e[`${cs(t)}Modifiers`];function xb(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||nn;let o=n;const a=t.startsWith("update:"),s=a&&Sb(r,t.slice(7));s&&(s.trim&&(o=n.map(h=>ln(h)?h.trim():h)),s.number&&(o=n.map(ud)));let u,f=r[u=Zu(t)]||r[u=Zu(xr(t))];!f&&a&&(f=r[u=Zu(cs(t))]),f&&To(f,e,6,o);const m=r[u+"Once"];if(m){if(!e.emitted)e.emitted={};else if(e.emitted[u])return;e.emitted[u]=!0,To(m,e,6,o)}}const Ab=new WeakMap;function Mm(e,t,n=!1){const r=n?Ab:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const a=e.emits;let s={},u=!1;if(!mt(e)){const f=m=>{const h=Mm(m,t,!0);h&&(u=!0,Mn(s,h))};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}return!a&&!u?(qt(e)&&r.set(e,null),null):(dt(a)?a.forEach(f=>s[f]=null):Mn(s,a),qt(e)&&r.set(e,s),s)}function Au(e,t){return!e||!gu(t)?!1:(t=t.slice(2).replace(/Once$/,""),Bt(e,t[0].toLowerCase()+t.slice(1))||Bt(e,cs(t))||Bt(e,t))}function Ff(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:u,emit:f,render:m,renderCache:h,props:y,data:C,setupState:I,ctx:F,inheritAttrs:B}=e,oe=lu(e);let V,O;try{if(n.shapeFlag&4){const se=o||r,Te=se;V=Ca(m.call(Te,se,h,y,I,C,F)),O=u}else{const se=t;V=Ca(se.length>1?se(y,{attrs:u,slots:s,emit:f}):se(y,null)),O=t.props?u:Eb(u)}}catch(se){ol.length=0,wl(se,e,1),V=je(cr)}let ee=V;if(O&&B!==!1){const se=Object.keys(O),{shapeFlag:Te}=ee;se.length&&Te&7&&(a&&se.some(yu)&&(O=Pb(O,a)),ee=us(ee,O,!1,!0))}return n.dirs&&(ee=us(ee,null,!1,!0),ee.dirs=ee.dirs?ee.dirs.concat(n.dirs):n.dirs),n.transition&&dl(ee,n.transition),V=ee,lu(oe),V}const Eb=e=>{let t;for(const n in e)(n==="class"||n==="style"||gu(n))&&((t||(t={}))[n]=e[n]);return t},Pb=(e,t)=>{const n={};for(const r in e)(!yu(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ib(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:u,patchFlag:f}=t,m=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&f>=0){if(f&1024)return!0;if(f&16)return r?Uf(r,s,m):!!s;if(f&8){const h=t.dynamicProps;for(let y=0;y<h.length;y++){const C=h[y];if($m(s,r,C)&&!Au(m,C))return!0}}}else return(o||u)&&(!u||!u.$stable)?!0:r===s?!1:r?s?Uf(r,s,m):!0:!!s;return!1}function Uf(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const a=r[o];if($m(t,e,a)&&!Au(n,a))return!0}return!1}function $m(e,t,n){const r=e[n],o=t[n];return n==="style"&&qt(r)&&qt(o)?!gl(r,o):r!==o}function Rb({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const jm={},Lm=()=>Object.create(jm),Nm=e=>Object.getPrototypeOf(e)===jm;function Mb(e,t,n,r=!1){const o={},a=Lm();e.propsDefaults=Object.create(null),Om(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:um(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function $b(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,u=Ot(o),[f]=e.propsOptions;let m=!1;if((r||s>0)&&!(s&16)){if(s&8){const h=e.vnode.dynamicProps;for(let y=0;y<h.length;y++){let C=h[y];if(Au(e.emitsOptions,C))continue;const I=t[C];if(f)if(Bt(a,C))I!==a[C]&&(a[C]=I,m=!0);else{const F=xr(C);o[F]=qc(f,u,F,I,e,!1)}else I!==a[C]&&(a[C]=I,m=!0)}}}else{Om(e,t,o,a)&&(m=!0);let h;for(const y in u)(!t||!Bt(t,y)&&((h=cs(y))===y||!Bt(t,h)))&&(f?n&&(n[y]!==void 0||n[h]!==void 0)&&(o[y]=qc(f,u,y,void 0,e,!0)):delete o[y]);if(a!==u)for(const y in a)(!t||!Bt(t,y))&&(delete a[y],m=!0)}m&&Ba(e.attrs,"set","")}function Om(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,u;if(t)for(let f in t){if(Zi(f))continue;const m=t[f];let h;o&&Bt(o,h=xr(f))?!a||!a.includes(h)?n[h]=m:(u||(u={}))[h]=m:Au(e.emitsOptions,f)||(!(f in r)||m!==r[f])&&(r[f]=m,s=!0)}if(a){const f=Ot(n),m=u||nn;for(let h=0;h<a.length;h++){const y=a[h];n[y]=qc(o,f,y,m[y],e,!Bt(m,y))}}return s}function qc(e,t,n,r,o,a){const s=e[n];if(s!=null){const u=Bt(s,"default");if(u&&r===void 0){const f=s.default;if(s.type!==Function&&!s.skipFactory&&mt(f)){const{propsDefaults:m}=o;if(n in m)r=m[n];else{const h=_l(o);r=m[n]=f.call(null,t),h()}}else r=f;o.ce&&o.ce._setProp(n,r)}s[0]&&(a&&!u?r=!1:s[1]&&(r===""||r===cs(n))&&(r=!0))}return r}const jb=new WeakMap;function Dm(e,t,n=!1){const r=n?jb:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},u=[];let f=!1;if(!mt(e)){const h=y=>{f=!0;const[C,I]=Dm(y,t,!0);Mn(s,C),I&&u.push(...I)};!n&&t.mixins.length&&t.mixins.forEach(h),e.extends&&h(e.extends),e.mixins&&e.mixins.forEach(h)}if(!a&&!f)return qt(e)&&r.set(e,ci),ci;if(dt(a))for(let h=0;h<a.length;h++){const y=xr(a[h]);Bf(y)&&(s[y]=nn)}else if(a)for(const h in a){const y=xr(h);if(Bf(y)){const C=a[h],I=s[y]=dt(C)||mt(C)?{type:C}:Mn({},C),F=I.type;let B=!1,oe=!0;if(dt(F))for(let V=0;V<F.length;++V){const O=F[V],ee=mt(O)&&O.name;if(ee==="Boolean"){B=!0;break}else ee==="String"&&(oe=!1)}else B=mt(F)&&F.name==="Boolean";I[0]=B,I[1]=oe,(B||Bt(I,"default"))&&u.push(y)}}const m=[s,u];return qt(e)&&r.set(e,m),m}function Bf(e){return e[0]!=="$"&&!Zi(e)}const bd=e=>e==="_"||e==="_ctx"||e==="$stable",_d=e=>dt(e)?e.map(Ca):[Ca(e)],Lb=(e,t,n)=>{if(t._n)return t;const r=yt((...o)=>_d(t(...o)),n);return r._c=!1,r},Fm=(e,t,n)=>{const r=e._ctx;for(const o in e){if(bd(o))continue;const a=e[o];if(mt(a))t[o]=Lb(o,a,r);else if(a!=null){const s=_d(a);t[o]=()=>s}}},Um=(e,t)=>{const n=_d(t);e.slots.default=()=>n},Bm=(e,t,n)=>{for(const r in t)(n||!bd(r))&&(e[r]=t[r])},Nb=(e,t,n)=>{const r=e.slots=Lm();if(e.vnode.shapeFlag&32){const o=t._;o?(Bm(r,t,n),n&&zp(r,"_",o,!0)):Fm(t,r)}else t&&Um(e,t)},Ob=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=nn;if(r.shapeFlag&32){const u=t._;u?n&&u===1?a=!1:Bm(o,t,n):(a=!t.$stable,Fm(t,o)),s=t}else t&&(Um(e,t),s={default:1});if(a)for(const u in o)!bd(u)&&s[u]==null&&delete o[u]},kr=qb;function Db(e){return Fb(e)}function Fb(e,t){const n=ku();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:u,createComment:f,setText:m,setElementText:h,parentNode:y,nextSibling:C,setScopeId:I=xa,insertStaticContent:F}=e,B=(P,L,W,D=null,J=null,U=null,ge=void 0,we=null,_e=!!L.dynamicChildren)=>{if(P===L)return;P&&!Ps(P,L)&&(D=te(P),We(P,J,U,!0),P=null),L.patchFlag===-2&&(_e=!1,L.dynamicChildren=null);const{type:X,ref:qe,shapeFlag:Pe}=L;switch(X){case Eu:oe(P,L,W,D);break;case cr:V(P,L,W,D);break;case nu:P==null&&O(L,W,D,ge);break;case tt:ce(P,L,W,D,J,U,ge,we,_e);break;default:Pe&1?Te(P,L,W,D,J,U,ge,we,_e):Pe&6?fe(P,L,W,D,J,U,ge,we,_e):(Pe&64||Pe&128)&&X.process(P,L,W,D,J,U,ge,we,_e,ke)}qe!=null&&J?nl(qe,P&&P.ref,U,L||P,!L):qe==null&&P&&P.ref!=null&&nl(P.ref,null,U,P,!0)},oe=(P,L,W,D)=>{if(P==null)r(L.el=u(L.children),W,D);else{const J=L.el=P.el;L.children!==P.children&&m(J,L.children)}},V=(P,L,W,D)=>{P==null?r(L.el=f(L.children||""),W,D):L.el=P.el},O=(P,L,W,D)=>{[P.el,P.anchor]=F(P.children,L,W,D,P.el,P.anchor)},ee=({el:P,anchor:L},W,D)=>{let J;for(;P&&P!==L;)J=C(P),r(P,W,D),P=J;r(L,W,D)},se=({el:P,anchor:L})=>{let W;for(;P&&P!==L;)W=C(P),o(P),P=W;o(L)},Te=(P,L,W,D,J,U,ge,we,_e)=>{if(L.type==="svg"?ge="svg":L.type==="math"&&(ge="mathml"),P==null)Fe(L,W,D,J,U,ge,we,_e);else{const X=P.el&&P.el._isVueCE?P.el:null;try{X&&X._beginPatch(),le(P,L,J,U,ge,we,_e)}finally{X&&X._endPatch()}}},Fe=(P,L,W,D,J,U,ge,we)=>{let _e,X;const{props:qe,shapeFlag:Pe,transition:He,dirs:ze}=P;if(_e=P.el=s(P.type,U,qe&&qe.is,qe),Pe&8?h(_e,P.children):Pe&16&&xe(P.children,_e,null,D,J,sc(P,U),ge,we),ze&&ks(P,null,D,"created"),ae(_e,P,P.scopeId,ge,D),qe){for(const pt in qe)pt!=="value"&&!Zi(pt)&&a(_e,pt,null,qe[pt],U,D);"value"in qe&&a(_e,"value",null,qe.value,U),(X=qe.onVnodeBeforeMount)&&_a(X,D,P)}ze&&ks(P,null,D,"beforeMount");const nt=Ub(J,He);nt&&He.beforeEnter(_e),r(_e,L,W),((X=qe&&qe.onVnodeMounted)||nt||ze)&&kr(()=>{try{X&&_a(X,D,P),nt&&He.enter(_e),ze&&ks(P,null,D,"mounted")}finally{}},J)},ae=(P,L,W,D,J)=>{if(W&&I(P,W),D)for(let U=0;U<D.length;U++)I(P,D[U]);if(J){let U=J.subTree;if(L===U||zm(U.type)&&(U.ssContent===L||U.ssFallback===L)){const ge=J.vnode;ae(P,ge,ge.scopeId,ge.slotScopeIds,J.parent)}}},xe=(P,L,W,D,J,U,ge,we,_e=0)=>{for(let X=_e;X<P.length;X++){const qe=P[X]=we?Fa(P[X]):Ca(P[X]);B(null,qe,L,W,D,J,U,ge,we)}},le=(P,L,W,D,J,U,ge)=>{const we=L.el=P.el;let{patchFlag:_e,dynamicChildren:X,dirs:qe}=L;_e|=P.patchFlag&16;const Pe=P.props||nn,He=L.props||nn;let ze;if(W&&Ts(W,!1),(ze=He.onVnodeBeforeUpdate)&&_a(ze,W,L,P),qe&&ks(L,P,W,"beforeUpdate"),W&&Ts(W,!0),(Pe.innerHTML&&He.innerHTML==null||Pe.textContent&&He.textContent==null)&&h(we,""),X?be(P.dynamicChildren,X,we,W,D,sc(L,J),U):ge||Ie(P,L,we,null,W,D,sc(L,J),U,!1),_e>0){if(_e&16)Ue(we,Pe,He,W,J);else if(_e&2&&Pe.class!==He.class&&a(we,"class",null,He.class,J),_e&4&&a(we,"style",Pe.style,He.style,J),_e&8){const nt=L.dynamicProps;for(let pt=0;pt<nt.length;pt++){const Ve=nt[pt],wt=Pe[Ve],kt=He[Ve];(kt!==wt||Ve==="value")&&a(we,Ve,wt,kt,J,W)}}_e&1&&P.children!==L.children&&h(we,L.children)}else!ge&&X==null&&Ue(we,Pe,He,W,J);((ze=He.onVnodeUpdated)||qe)&&kr(()=>{ze&&_a(ze,W,L,P),qe&&ks(L,P,W,"updated")},D)},be=(P,L,W,D,J,U,ge)=>{for(let we=0;we<L.length;we++){const _e=P[we],X=L[we],qe=_e.el&&(_e.type===tt||!Ps(_e,X)||_e.shapeFlag&198)?y(_e.el):W;B(_e,X,qe,null,D,J,U,ge,!0)}},Ue=(P,L,W,D,J)=>{if(L!==W){if(L!==nn)for(const U in L)!Zi(U)&&!(U in W)&&a(P,U,L[U],null,J,D);for(const U in W){if(Zi(U))continue;const ge=W[U],we=L[U];ge!==we&&U!=="value"&&a(P,U,we,ge,J,D)}"value"in W&&a(P,"value",L.value,W.value,J)}},ce=(P,L,W,D,J,U,ge,we,_e)=>{const X=L.el=P?P.el:u(""),qe=L.anchor=P?P.anchor:u("");let{patchFlag:Pe,dynamicChildren:He,slotScopeIds:ze}=L;ze&&(we=we?we.concat(ze):ze),P==null?(r(X,W,D),r(qe,W,D),xe(L.children||[],W,qe,J,U,ge,we,_e)):Pe>0&&Pe&64&&He&&P.dynamicChildren&&P.dynamicChildren.length===He.length?(be(P.dynamicChildren,He,W,J,U,ge,we),(L.key!=null||J&&L===J.subTree)&&kd(P,L,!0)):Ie(P,L,W,qe,J,U,ge,we,_e)},fe=(P,L,W,D,J,U,ge,we,_e)=>{L.slotScopeIds=we,P==null?L.shapeFlag&512?J.ctx.activate(L,W,D,ge,_e):Se(L,W,D,J,U,ge,_e):De(P,L,_e)},Se=(P,L,W,D,J,U,ge)=>{const we=P.component=Kb(P,D,J);if(bl(P)&&(we.ctx.renderer=ke),Yb(we,!1,ge),we.asyncDep){if(J&&J.registerDep(we,Ee,ge),!P.el){const _e=we.subTree=je(cr);V(null,_e,L,W),P.placeholder=_e.el}}else Ee(we,P,L,W,J,U,ge)},De=(P,L,W)=>{const D=L.component=P.component;if(Ib(P,L,W))if(D.asyncDep&&!D.asyncResolved){Re(D,L,W);return}else D.next=L,D.update();else L.el=P.el,D.vnode=L},Ee=(P,L,W,D,J,U,ge)=>{const we=()=>{if(P.isMounted){let{next:Pe,bu:He,u:ze,parent:nt,vnode:pt}=P;{const G=qm(P);if(G){Pe&&(Pe.el=pt.el,Re(P,Pe,ge)),G.asyncDep.then(()=>{kr(()=>{P.isUnmounted||X()},J)});return}}let Ve=Pe,wt;Ts(P,!1),Pe?(Pe.el=pt.el,Re(P,Pe,ge)):Pe=pt,He&&eu(He),(wt=Pe.props&&Pe.props.onVnodeBeforeUpdate)&&_a(wt,nt,Pe,pt),Ts(P,!0);const kt=Ff(P),H=P.subTree;P.subTree=kt,B(H,kt,y(H.el),te(H),P,J,U),Pe.el=kt.el,Ve===null&&Rb(P,kt.el),ze&&kr(ze,J),(wt=Pe.props&&Pe.props.onVnodeUpdated)&&kr(()=>_a(wt,nt,Pe,pt),J)}else{let Pe;const{el:He,props:ze}=L,{bm:nt,m:pt,parent:Ve,root:wt,type:kt}=P,H=hi(L);Ts(P,!1),nt&&eu(nt),!H&&(Pe=ze&&ze.onVnodeBeforeMount)&&_a(Pe,Ve,L),Ts(P,!0);{wt.ce&&wt.ce._hasShadowRoot()&&wt.ce._injectChildStyle(kt,P.parent?P.parent.type:void 0);const G=P.subTree=Ff(P);B(null,G,W,D,P,J,U),L.el=G.el}if(pt&&kr(pt,J),!H&&(Pe=ze&&ze.onVnodeMounted)){const G=L;kr(()=>_a(Pe,Ve,G),J)}(L.shapeFlag&256||Ve&&hi(Ve.vnode)&&Ve.vnode.shapeFlag&256)&&P.a&&kr(P.a,J),P.isMounted=!0,L=W=D=null}};P.scope.on();const _e=P.effect=new Yp(we);P.scope.off();const X=P.update=_e.run.bind(_e),qe=P.job=_e.runIfDirty.bind(_e);qe.i=P,qe.id=P.uid,_e.scheduler=()=>gd(qe),Ts(P,!0),X()},Re=(P,L,W)=>{L.component=P;const D=P.vnode.props;P.vnode=L,P.next=null,$b(P,L.props,D,W),Ob(P,L.children,W),Ha(),Af(P),za()},Ie=(P,L,W,D,J,U,ge,we,_e=!1)=>{const X=P&&P.children,qe=P?P.shapeFlag:0,Pe=L.children,{patchFlag:He,shapeFlag:ze}=L;if(He>0){if(He&128){et(X,Pe,W,D,J,U,ge,we,_e);return}else if(He&256){Qe(X,Pe,W,D,J,U,ge,we,_e);return}}ze&8?(qe&16&&Je(X,J,U),Pe!==X&&h(W,Pe)):qe&16?ze&16?et(X,Pe,W,D,J,U,ge,we,_e):Je(X,J,U,!0):(qe&8&&h(W,""),ze&16&&xe(Pe,W,D,J,U,ge,we,_e))},Qe=(P,L,W,D,J,U,ge,we,_e)=>{P=P||ci,L=L||ci;const X=P.length,qe=L.length,Pe=Math.min(X,qe);let He;for(He=0;He<Pe;He++){const ze=L[He]=_e?Fa(L[He]):Ca(L[He]);B(P[He],ze,W,null,J,U,ge,we,_e)}X>qe?Je(P,J,U,!0,!1,Pe):xe(L,W,D,J,U,ge,we,_e,Pe)},et=(P,L,W,D,J,U,ge,we,_e)=>{let X=0;const qe=L.length;let Pe=P.length-1,He=qe-1;for(;X<=Pe&&X<=He;){const ze=P[X],nt=L[X]=_e?Fa(L[X]):Ca(L[X]);if(Ps(ze,nt))B(ze,nt,W,null,J,U,ge,we,_e);else break;X++}for(;X<=Pe&&X<=He;){const ze=P[Pe],nt=L[He]=_e?Fa(L[He]):Ca(L[He]);if(Ps(ze,nt))B(ze,nt,W,null,J,U,ge,we,_e);else break;Pe--,He--}if(X>Pe){if(X<=He){const ze=He+1,nt=ze<qe?L[ze].el:D;for(;X<=He;)B(null,L[X]=_e?Fa(L[X]):Ca(L[X]),W,nt,J,U,ge,we,_e),X++}}else if(X>He)for(;X<=Pe;)We(P[X],J,U,!0),X++;else{const ze=X,nt=X,pt=new Map;for(X=nt;X<=He;X++){const Ae=L[X]=_e?Fa(L[X]):Ca(L[X]);Ae.key!=null&&pt.set(Ae.key,X)}let Ve,wt=0;const kt=He-nt+1;let H=!1,G=0;const K=new Array(kt);for(X=0;X<kt;X++)K[X]=0;for(X=ze;X<=Pe;X++){const Ae=P[X];if(wt>=kt){We(Ae,J,U,!0);continue}let Ne;if(Ae.key!=null)Ne=pt.get(Ae.key);else for(Ve=nt;Ve<=He;Ve++)if(K[Ve-nt]===0&&Ps(Ae,L[Ve])){Ne=Ve;break}Ne===void 0?We(Ae,J,U,!0):(K[Ne-nt]=X+1,Ne>=G?G=Ne:H=!0,B(Ae,L[Ne],W,null,J,U,ge,we,_e),wt++)}const he=H?Bb(K):ci;for(Ve=he.length-1,X=kt-1;X>=0;X--){const Ae=nt+X,Ne=L[Ae],Be=L[Ae+1],Ct=Ae+1<qe?Be.el||Hm(Be):D;K[X]===0?B(null,Ne,W,Ct,J,U,ge,we,_e):H&&(Ve<0||X!==he[Ve]?Me(Ne,W,Ct,2):Ve--)}}},Me=(P,L,W,D,J=null)=>{const{el:U,type:ge,transition:we,children:_e,shapeFlag:X}=P;if(X&6){Me(P.component.subTree,L,W,D);return}if(X&128){P.suspense.move(L,W,D);return}if(X&64){ge.move(P,L,W,ke);return}if(ge===tt){r(U,L,W);for(let Pe=0;Pe<_e.length;Pe++)Me(_e[Pe],L,W,D);r(P.anchor,L,W);return}if(ge===nu){ee(P,L,W);return}if(D!==2&&X&1&&we)if(D===0)we.persisted&&!U[bo]?r(U,L,W):(we.beforeEnter(U),r(U,L,W),kr(()=>we.enter(U),J));else{const{leave:Pe,delayLeave:He,afterLeave:ze}=we,nt=()=>{P.ctx.isUnmounted?o(U):r(U,L,W)},pt=()=>{const Ve=U._isLeaving||!!U[bo];U._isLeaving&&U[bo](!0),we.persisted&&!Ve?nt():Pe(U,()=>{nt(),ze&&ze()})};He?He(U,nt,pt):pt()}else r(U,L,W)},We=(P,L,W,D=!1,J=!1)=>{const{type:U,props:ge,ref:we,children:_e,dynamicChildren:X,shapeFlag:qe,patchFlag:Pe,dirs:He,cacheIndex:ze,memo:nt}=P;if(Pe===-2&&(J=!1),we!=null&&(Ha(),nl(we,null,W,P,!0),za()),ze!=null&&(L.renderCache[ze]=void 0),qe&256){L.ctx.deactivate(P);return}const pt=qe&1&&He,Ve=!hi(P);let wt;if(Ve&&(wt=ge&&ge.onVnodeBeforeUnmount)&&_a(wt,L,P),qe&6)at(P.component,W,D);else{if(qe&128){P.suspense.unmount(W,D);return}pt&&ks(P,null,L,"beforeUnmount"),qe&64?P.type.remove(P,L,W,ke,D):X&&!X.hasOnce&&(U!==tt||Pe>0&&Pe&64)?Je(X,L,W,!1,!0):(U===tt&&Pe&384||!J&&qe&16)&&Je(_e,L,W),D&&it(P)}const kt=nt!=null&&ze==null;(Ve&&(wt=ge&&ge.onVnodeUnmounted)||pt||kt)&&kr(()=>{wt&&_a(wt,L,P),pt&&ks(P,null,L,"unmounted"),kt&&(P.el=null)},W)},it=P=>{const{type:L,el:W,anchor:D,transition:J}=P;if(L===tt){ct(W,D);return}if(L===nu){se(P);return}const U=()=>{o(W),J&&!J.persisted&&J.afterLeave&&J.afterLeave()};if(P.shapeFlag&1&&J&&!J.persisted){const{leave:ge,delayLeave:we}=J,_e=()=>ge(W,U);we?we(P.el,U,_e):_e()}else U()},ct=(P,L)=>{let W;for(;P!==L;)W=C(P),o(P),P=W;o(L)},at=(P,L,W)=>{const{bum:D,scope:J,job:U,subTree:ge,um:we,m:_e,a:X}=P;qf(_e),qf(X),D&&eu(D),J.stop(),U&&(U.flags|=8,We(ge,P,L,W)),we&&kr(we,L),kr(()=>{P.isUnmounted=!0},L)},Je=(P,L,W,D=!1,J=!1,U=0)=>{for(let ge=U;ge<P.length;ge++)We(P[ge],L,W,D,J)},te=P=>{if(P.shapeFlag&6)return te(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const L=C(P.anchor||P.el),W=L&&L[wm];return W?C(W):L};let pe=!1;const ve=(P,L,W)=>{let D;P==null?L._vnode&&(We(L._vnode,null,null,!0),D=L._vnode.component):B(L._vnode||null,P,L,null,null,null,W),L._vnode=P,pe||(pe=!0,Af(D),pm(),pe=!1)},ke={p:B,um:We,m:Me,r:it,mt:Se,mc:xe,pc:Ie,pbc:be,n:te,o:e};return{render:ve,hydrate:void 0,createApp:Cb(ve)}}function sc({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 Ts({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Ub(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function kd(e,t,n=!1){const r=e.children,o=t.children;if(dt(r)&&dt(o))for(let a=0;a<r.length;a++){const s=r[a];let u=o[a];u.shapeFlag&1&&!u.dynamicChildren&&((u.patchFlag<=0||u.patchFlag===32)&&(u=o[a]=Fa(o[a]),u.el=s.el),!n&&u.patchFlag!==-2&&kd(s,u)),u.type===Eu&&(u.patchFlag===-1&&(u=o[a]=Fa(u)),u.el=s.el),u.type===cr&&!u.el&&(u.el=s.el)}}function Bb(e){const t=e.slice(),n=[0];let r,o,a,s,u;const f=e.length;for(r=0;r<f;r++){const m=e[r];if(m!==0){if(o=n[n.length-1],e[o]<m){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)u=a+s>>1,e[n[u]]<m?a=u+1:s=u;m<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function qm(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:qm(t)}function qf(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Hm(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Hm(t.subTree):null}const zm=e=>e.__isSuspense;function qb(e,t){t&&t.pendingBranch?dt(e)?t.effects.push(...e):t.effects.push(e):Vw(e)}const tt=Symbol.for("v-fgt"),Eu=Symbol.for("v-txt"),cr=Symbol.for("v-cmt"),nu=Symbol.for("v-stc"),ol=[];let Sr=null;function S(e=!1){ol.push(Sr=e?null:[])}function Hb(){ol.pop(),Sr=ol[ol.length-1]||null}let bi=1;function du(e,t=!1){bi+=e,e<0&&Sr&&t&&(Sr.hasOnce=!0)}function Wm(e){return e.dynamicChildren=bi>0?Sr||ci:null,Hb(),bi>0&&Sr&&Sr.push(e),e}function A(e,t,n,r,o,a){return Wm(p(e,t,n,r,o,a,!0))}function rt(e,t,n,r,o){return Wm(je(e,t,n,r,o,!0))}function fl(e){return e?e.__v_isVNode===!0:!1}function Ps(e,t){return e.type===t.type&&e.key===t.key}const Vm=({key:e})=>e??null,ru=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?ln(e)||dr(e)||mt(e)?{i:Zn,r:e,k:t,f:!!n}:e:null);function p(e,t=null,n=null,r=0,o=null,a=e===tt?0:1,s=!1,u=!1){const f={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Vm(t),ref:t&&ru(t),scopeId:vm,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Zn};return u?(Td(f,n),a&128&&e.normalize(f)):n&&(f.shapeFlag|=ln(n)?8:16),bi>0&&!s&&Sr&&(f.patchFlag>0||a&6)&&f.patchFlag!==32&&Sr.push(f),f}const je=zb;function zb(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===Am)&&(e=cr),fl(e)){const u=us(e,t,!0);return n&&Td(u,n),bi>0&&!a&&Sr&&(u.shapeFlag&6?Sr[Sr.indexOf(e)]=u:Sr.push(u)),u.patchFlag=-2,u}if(Zb(e)&&(e=e.__vccOpts),t){t=Wb(t);let{class:u,style:f}=t;u&&!ln(u)&&(t.class=Ze(u)),qt(f)&&(vd(f)&&!dt(f)&&(f=Mn({},f)),t.style=ea(f))}const s=ln(e)?1:zm(e)?128:bm(e)?64:qt(e)?4:mt(e)?2:0;return p(e,t,n,r,o,s,a,!0)}function Wb(e){return e?vd(e)||Nm(e)?Mn({},e):e:null}function us(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:u,transition:f}=e,m=t?Gm(o||{},t):o,h={__v_isVNode:!0,__v_skip:!0,type:e.type,props:m,key:m&&Vm(m),ref:t&&t.ref?n&&a?dt(a)?a.concat(ru(t)):[a,ru(t)]:ru(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:u,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==tt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:f,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&us(e.ssContent),ssFallback:e.ssFallback&&us(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return f&&r&&dl(h,f.clone(h)),h}function Ns(e=" ",t=0){return je(Eu,null,e,t)}function JN(e,t){const n=je(nu,null,e);return n.staticCount=t,n}function Z(e="",t=!1){return t?(S(),rt(cr,null,e)):je(cr,null,e)}function Ca(e){return e==null||typeof e=="boolean"?je(cr):dt(e)?je(tt,null,e.slice()):fl(e)?Fa(e):je(Eu,null,String(e))}function Fa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:us(e)}function Td(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(dt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Td(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Nm(t)?t._ctx=Zn:o===3&&Zn&&(Zn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else mt(t)?(t={default:t,_ctx:Zn},n=32):(t=String(t),r&64?(n=16,t=[Ns(t)]):n=8);e.children=t,e.shapeFlag|=n}function Gm(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=Ze([t.class,r.class]));else if(o==="style")t.style=ea([t.style,r.style]);else if(gu(o)){const a=t[o],s=r[o];s&&a!==s&&!(dt(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!yu(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function _a(e,t,n,r=null){To(e,t,7,[n,r])}const Vb=Rm();let Gb=0;function Kb(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Vb,a={uid:Gb++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new gw(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Dm(r,o),emitsOptions:Mm(r,o),emit:null,emitted:null,propsDefaults:nn,inheritAttrs:r.inheritAttrs,ctx:nn,data:nn,props:nn,attrs:nn,slots:nn,refs:nn,setupState:nn,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=xb.bind(null,a),e.ce&&e.ce(a),a}let Xn=null;const Cd=()=>Xn||Zn;let fu,Hc;{const e=ku(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),a=>{o.length>1?o.forEach(s=>s(a)):o[0](a)}};fu=t("__VUE_INSTANCE_SETTERS__",n=>Xn=n),Hc=t("__VUE_SSR_SETTERS__",n=>_i=n)}const _l=e=>{const t=Xn;return fu(e),e.scope.on(),()=>{e.scope.off(),fu(t)}},Hf=()=>{Xn&&Xn.scope.off(),fu(null)};function Km(e){return e.vnode.shapeFlag&4}let _i=!1;function Yb(e,t=!1,n=!1){t&&Hc(t);const{props:r,children:o}=e.vnode,a=Km(e);Mb(e,r,a,t),Nb(e,o,n||t);const s=a?Jb(e,t):void 0;return t&&Hc(!1),s}function Jb(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,mb);const{setup:r}=n;if(r){Ha();const o=e.setupContext=r.length>1?Jm(e):null,a=_l(e),s=yl(r,e,0,[e.props,o]),u=Bp(s);if(za(),a(),(u||e.sp)&&!hi(e)&&yd(e),u){if(s.then(Hf,Hf),t)return s.then(f=>{zf(e,f)}).catch(f=>{wl(f,e,0)});e.asyncDep=s}else zf(e,s)}else Ym(e)}function zf(e,t,n){mt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:qt(t)&&(e.setupState=dm(t)),Ym(e)}function Ym(e,t,n){const r=e.type;e.render||(e.render=r.render||xa);{const o=_l(e);Ha();try{yb(e)}finally{za(),o()}}}const Qb={get(e,t){return ur(e,"get",""),e[t]}};function Jm(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Qb),slots:e.slots,emit:e.emit,expose:t}}function Pu(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(dm(Nw(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in rl)return rl[n](e)},has(t,n){return n in t||n in rl}})):e.proxy}function Xb(e,t=!0){return mt(e)?e.displayName||e.name:e.name||t&&e.__name}function Zb(e){return mt(e)&&"__vccOpts"in e}const Q=(e,t)=>Bw(e,t,_i);function Sd(e,t,n){try{du(-1);const r=arguments.length;return r===2?qt(t)&&!dt(t)?fl(t)?je(e,null,[t]):je(e,t):je(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&fl(n)&&(n=[n]),je(e,t,n))}finally{du(1)}}function QN(e,t,n,r){const o=n[r];if(o&&e0(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function e0(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Qo(n[r],t[r]))return!1;return bi>0&&Sr&&Sr.push(e),!0}const t0="3.5.35";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.35
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let zc;const Wf=typeof window<"u"&&window.trustedTypes;if(Wf)try{zc=Wf.createPolicy("vue",{createHTML:e=>e})}catch{}const Qm=zc?e=>zc.createHTML(e):e=>e,n0="http://www.w3.org/2000/svg",r0="http://www.w3.org/1998/Math/MathML",Da=typeof document<"u"?document:null,Vf=Da&&Da.createElement("template"),o0={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Da.createElementNS(n0,e):t==="mathml"?Da.createElementNS(r0,e):n?Da.createElement(e,{is:n}):Da.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Da.createTextNode(e),createComment:e=>Da.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Da.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,a){const s=n?n.previousSibling:t.lastChild;if(o&&(o===a||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===a||!(o=o.nextSibling)););else{Vf.innerHTML=Qm(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const u=Vf.content;if(r==="svg"||r==="mathml"){const f=u.firstChild;for(;f.firstChild;)u.appendChild(f.firstChild);u.removeChild(f)}t.insertBefore(u,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},es="transition",Wi="animation",hl=Symbol("_vtc"),Xm={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},a0=Mn({},_m,Xm),s0=e=>(e.displayName="Transition",e.props=a0,e),Zm=s0((e,{slots:t})=>Sd(tb,i0(e),t)),Cs=(e,t=[])=>{dt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Gf=e=>e?dt(e)?e.some(t=>t.length>1):e.length>1:!1;function i0(e){const t={};for(const ce in e)ce in Xm||(t[ce]=e[ce]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:u=`${n}-enter-to`,appearFromClass:f=a,appearActiveClass:m=s,appearToClass:h=u,leaveFromClass:y=`${n}-leave-from`,leaveActiveClass:C=`${n}-leave-active`,leaveToClass:I=`${n}-leave-to`}=e,F=l0(o),B=F&&F[0],oe=F&&F[1],{onBeforeEnter:V,onEnter:O,onEnterCancelled:ee,onLeave:se,onLeaveCancelled:Te,onBeforeAppear:Fe=V,onAppear:ae=O,onAppearCancelled:xe=ee}=t,le=(ce,fe,Se,De)=>{ce._enterCancelled=De,Ss(ce,fe?h:u),Ss(ce,fe?m:s),Se&&Se()},be=(ce,fe)=>{ce._isLeaving=!1,Ss(ce,y),Ss(ce,I),Ss(ce,C),fe&&fe()},Ue=ce=>(fe,Se)=>{const De=ce?ae:O,Ee=()=>le(fe,ce,Se);Cs(De,[fe,Ee]),Kf(()=>{Ss(fe,ce?f:a),Na(fe,ce?h:u),Gf(De)||Yf(fe,r,B,Ee)})};return Mn(t,{onBeforeEnter(ce){Cs(V,[ce]),Na(ce,a),Na(ce,s)},onBeforeAppear(ce){Cs(Fe,[ce]),Na(ce,f),Na(ce,m)},onEnter:Ue(!1),onAppear:Ue(!0),onLeave(ce,fe){ce._isLeaving=!0;const Se=()=>be(ce,fe);Na(ce,y),ce._enterCancelled?(Na(ce,C),Xf(ce)):(Xf(ce),Na(ce,C)),Kf(()=>{ce._isLeaving&&(Ss(ce,y),Na(ce,I),Gf(se)||Yf(ce,r,oe,Se))}),Cs(se,[ce,Se])},onEnterCancelled(ce){le(ce,!1,void 0,!0),Cs(ee,[ce])},onAppearCancelled(ce){le(ce,!0,void 0,!0),Cs(xe,[ce])},onLeaveCancelled(ce){be(ce),Cs(Te,[ce])}})}function l0(e){if(e==null)return null;if(qt(e))return[ic(e.enter),ic(e.leave)];{const t=ic(e);return[t,t]}}function ic(e){return uw(e)}function Na(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[hl]||(e[hl]=new Set)).add(t)}function Ss(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[hl];n&&(n.delete(t),n.size||(e[hl]=void 0))}function Kf(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let u0=0;function Yf(e,t,n,r){const o=e._endId=++u0,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:u,propCount:f}=c0(e,t);if(!s)return r();const m=s+"end";let h=0;const y=()=>{e.removeEventListener(m,C),a()},C=I=>{I.target===e&&++h>=f&&y()};setTimeout(()=>{h<f&&y()},u+1),e.addEventListener(m,C)}function c0(e,t){const n=window.getComputedStyle(e),r=F=>(n[F]||"").split(", "),o=r(`${es}Delay`),a=r(`${es}Duration`),s=Jf(o,a),u=r(`${Wi}Delay`),f=r(`${Wi}Duration`),m=Jf(u,f);let h=null,y=0,C=0;t===es?s>0&&(h=es,y=s,C=a.length):t===Wi?m>0&&(h=Wi,y=m,C=f.length):(y=Math.max(s,m),h=y>0?s>m?es:Wi:null,C=h?h===es?a.length:f.length:0);const I=h===es&&/\b(?:transform|all)(?:,|$)/.test(r(`${es}Property`).toString());return{type:h,timeout:y,propCount:C,hasTransform:I}}function Jf(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Qf(n)+Qf(e[r])))}function Qf(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Xf(e){return(e?e.ownerDocument:document).body.offsetHeight}function d0(e,t,n){const r=e[hl];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Zf=Symbol("_vod"),f0=Symbol("_vsh"),h0=Symbol(""),p0=/(?:^|;)\s*display\s*:/;function m0(e,t,n){const r=e.style,o=ln(n);let a=!1;if(n&&!o){if(t)if(ln(t))for(const s of t.split(";")){const u=s.slice(0,s.indexOf(":")).trim();n[u]==null&&Qi(r,u,"")}else for(const s in t)n[s]==null&&Qi(r,s,"");for(const s in n){s==="display"&&(a=!0);const u=n[s];u!=null?g0(e,s,!ln(t)&&t?t[s]:void 0,u)||Qi(r,s,u):Qi(r,s,"")}}else if(o){if(t!==n){const s=r[h0];s&&(n+=";"+s),r.cssText=n,a=p0.test(n)}}else t&&e.removeAttribute("style");Zf in e&&(e[Zf]=a?r.display:"",e[f0]&&(r.display="none"))}const eh=/\s*!important$/;function Qi(e,t,n){if(dt(n))n.forEach(r=>Qi(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=v0(e,t);eh.test(n)?e.setProperty(cs(r),n.replace(eh,""),"important"):e[r]=n}}const th=["Webkit","Moz","ms"],lc={};function v0(e,t){const n=lc[t];if(n)return n;let r=xr(t);if(r!=="filter"&&r in e)return lc[t]=r;r=_u(r);for(let o=0;o<th.length;o++){const a=th[o]+r;if(a in e)return lc[t]=a}return t}function g0(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&ln(r)&&n===r}const nh="http://www.w3.org/1999/xlink";function rh(e,t,n,r,o,a=mw(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(nh,t.slice(6,t.length)):e.setAttributeNS(nh,t,n):n==null||a&&!Wp(n)?e.removeAttribute(t):e.setAttribute(t,a?"":oa(n)?String(n):n)}function oh(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Qm(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const u=a==="OPTION"?e.getAttribute("value")||"":e.value,f=n==null?e.type==="checkbox"?"on":"":String(n);(u!==f||!("_value"in e))&&(e.value=f),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const u=typeof e[t];u==="boolean"?n=Wp(n):n==null&&u==="string"?(n="",s=!0):u==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function Is(e,t,n,r){e.addEventListener(t,n,r)}function y0(e,t,n,r){e.removeEventListener(t,n,r)}const ah=Symbol("_vei");function w0(e,t,n,r,o=null){const a=e[ah]||(e[ah]={}),s=a[t];if(r&&s)s.value=r;else{const[u,f]=b0(t);if(r){const m=a[t]=T0(r,o);Is(e,u,m,f)}else s&&(y0(e,u,s,f),a[t]=void 0)}}const sh=/(?:Once|Passive|Capture)$/;function b0(e){let t;if(sh.test(e)){t={};let r;for(;r=e.match(sh);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):cs(e.slice(2)),t]}let uc=0;const _0=Promise.resolve(),k0=()=>uc||(_0.then(()=>uc=0),uc=Date.now());function T0(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const o=n.value;if(dt(o)){const a=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{a.call(r),r._stopped=!0};const s=o.slice(),u=[r];for(let f=0;f<s.length&&!r._stopped;f++){const m=s[f];m&&To(m,t,5,u)}}else To(o,t,5,[r])};return n.value=e,n.attached=k0(),n}const ih=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,C0=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?d0(e,r,s):t==="style"?m0(e,n,r):gu(t)?yu(t)||w0(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):S0(e,t,r,s))?(oh(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&rh(e,t,r,s,a,t!=="value")):e._isVueCE&&(x0(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ln(r)))?oh(e,xr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),rh(e,t,r,s))};function S0(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&ih(t)&&mt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return ih(t)&&ln(n)?!1:t in e}function x0(e,t){const n=e._def.props;if(!n)return!1;const r=xr(t);return Array.isArray(n)?n.some(o=>xr(o)===r):Object.keys(n).some(o=>xr(o)===r)}const hu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return dt(t)?n=>eu(t,n):t};function A0(e){e.target.composing=!0}function lh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const mi=Symbol("_assign");function uh(e,t,n){return t&&(e=e.trim()),n&&(e=ud(e)),e}const on={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[mi]=hu(o);const a=r||o.props&&o.props.type==="number";Is(e,t?"change":"input",s=>{s.target.composing||e[mi](uh(e.value,n,a))}),(n||a)&&Is(e,"change",()=>{e.value=uh(e.value,n,a)}),t||(Is(e,"compositionstart",A0),Is(e,"compositionend",lh),Is(e,"change",lh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[mi]=hu(s),e.composing)return;const u=(a||e.type==="number")&&!/^0\d/.test(e.value)?ud(e.value):e.value,f=t??"";if(u===f)return;const m=e.getRootNode();(m instanceof Document||m instanceof ShadowRoot)&&m.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===f)||(e.value=f)}},ev={deep:!0,created(e,t,n){e[mi]=hu(n),Is(e,"change",()=>{const r=e._modelValue,o=E0(e),a=e.checked,s=e[mi];if(dt(r)){const u=Vp(r,o),f=u!==-1;if(a&&!f)s(r.concat(o));else if(!a&&f){const m=[...r];m.splice(u,1),s(m)}}else if(wu(r)){const u=new Set(r);a?u.add(o):u.delete(o),s(u)}else s(tv(e,a))})},mounted:ch,beforeUpdate(e,t,n){e[mi]=hu(n),ch(e,t,n)}};function ch(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(dt(t))o=Vp(t,r.props.value)>-1;else if(wu(t))o=t.has(r.props.value);else{if(t===n)return;o=gl(t,tv(e,!0))}e.checked!==o&&(e.checked=o)}function E0(e){return"_value"in e?e._value:e.value}function tv(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const P0=["ctrl","shift","alt","meta"],I0={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)=>P0.some(n=>e[`${n}Key`]&&!t.includes(n))},Ye=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...a)=>{for(let s=0;s<t.length;s++){const u=I0[t[s]];if(u&&u(o,t))return}return e(o,...a)}))},R0={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},tn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const a=cs(o.key);if(t.some(s=>s===a||R0[s]===a))return e(o)}))},M0=Mn({patchProp:C0},o0);let dh;function $0(){return dh||(dh=Db(M0))}const j0=((...e)=>{const t=$0().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=N0(r);if(!o)return;const a=t._component;!mt(a)&&!a.render&&!a.template&&(a.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,L0(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t});function L0(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function N0(e){return ln(e)?document.querySelector(e):e}const O0="modulepreload",D0=function(e){return"/"+e},fh={},Vi=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));o=s(n.map(m=>{if(m=D0(m),m in fh)return;fh[m]=!0;const h=m.endsWith(".css"),y=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${y}`))return;const C=document.createElement("link");if(C.rel=h?"stylesheet":O0,h||(C.as="script"),C.crossOrigin="",C.href=m,f&&C.setAttribute("nonce",f),document.head.appendChild(C),h)return new Promise((I,F)=>{C.addEventListener("load",I),C.addEventListener("error",()=>F(new Error(`Unable to preload CSS for ${m}`)))})}))}function a(s){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=s,window.dispatchEvent(u),!u.defaultPrevented)throw s}return o.then(s=>{for(const u of s||[])u.status==="rejected"&&a(u.reason);return t().catch(a)})};/*!
|
|
19
|
+
* vue-router v4.6.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/const oi=typeof document<"u";function nv(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function F0(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&nv(e.default)}const Ut=Object.assign;function cc(e,t){const n={};for(const r in t){const o=t[r];n[r]=sa(o)?o.map(e):e(o)}return n}const al=()=>{},sa=Array.isArray;function hh(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const rv=/#/g,U0=/&/g,B0=/\//g,q0=/=/g,H0=/\?/g,ov=/\+/g,z0=/%5B/g,W0=/%5D/g,av=/%5E/g,V0=/%60/g,sv=/%7B/g,G0=/%7C/g,iv=/%7D/g,K0=/%20/g;function xd(e){return e==null?"":encodeURI(""+e).replace(G0,"|").replace(z0,"[").replace(W0,"]")}function Y0(e){return xd(e).replace(sv,"{").replace(iv,"}").replace(av,"^")}function Wc(e){return xd(e).replace(ov,"%2B").replace(K0,"+").replace(rv,"%23").replace(U0,"%26").replace(V0,"`").replace(sv,"{").replace(iv,"}").replace(av,"^")}function J0(e){return Wc(e).replace(q0,"%3D")}function Q0(e){return xd(e).replace(rv,"%23").replace(H0,"%3F")}function X0(e){return Q0(e).replace(B0,"%2F")}function pl(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Z0=/\/$/,e_=e=>e.replace(Z0,"");function dc(e,t,n="/"){let r,o={},a="",s="";const u=t.indexOf("#");let f=t.indexOf("?");return f=u>=0&&f>u?-1:f,f>=0&&(r=t.slice(0,f),a=t.slice(f,u>0?u:t.length),o=e(a.slice(1))),u>=0&&(r=r||t.slice(0,u),s=t.slice(u,t.length)),r=o_(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:pl(s)}}function t_(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function ph(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function n_(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&ki(t.matched[r],n.matched[o])&&lv(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ki(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function lv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!r_(e[n],t[n]))return!1;return!0}function r_(e,t){return sa(e)?mh(e,t):sa(t)?mh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function mh(e,t){return sa(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function o_(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),o=r[r.length-1];(o===".."||o===".")&&r.push("");let a=n.length-1,s,u;for(s=0;s<r.length;s++)if(u=r[s],u!==".")if(u==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+r.slice(s).join("/")}const ts={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Vc=(function(e){return e.pop="pop",e.push="push",e})({}),fc=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function a_(e){if(!e)if(oi){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),e_(e)}const s_=/^[^#]+#/;function i_(e,t){return e.replace(s_,"#")+t}function l_(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const Iu=()=>({left:window.scrollX,top:window.scrollY});function u_(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=l_(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function vh(e,t){return(history.state?history.state.position-t:-1)+e}const Gc=new Map;function c_(e,t){Gc.set(e,t)}function d_(e){const t=Gc.get(e);return Gc.delete(e),t}function f_(e){return typeof e=="string"||e&&typeof e=="object"}function uv(e){return typeof e=="string"||typeof e=="symbol"}let yn=(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 cv=Symbol("");yn.MATCHER_NOT_FOUND+"",yn.NAVIGATION_GUARD_REDIRECT+"",yn.NAVIGATION_ABORTED+"",yn.NAVIGATION_CANCELLED+"",yn.NAVIGATION_DUPLICATED+"";function Ti(e,t){return Ut(new Error,{type:e,[cv]:!0},t)}function Oa(e,t){return e instanceof Error&&cv in e&&(t==null||!!(e.type&t))}const h_=["params","query","hash"];function p_(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of h_)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function m_(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const o=n[r].replace(ov," "),a=o.indexOf("="),s=pl(a<0?o:o.slice(0,a)),u=a<0?null:pl(o.slice(a+1));if(s in t){let f=t[s];sa(f)||(f=t[s]=[f]),f.push(u)}else t[s]=u}return t}function gh(e){let t="";for(let n in e){const r=e[n];if(n=J0(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(sa(r)?r.map(o=>o&&Wc(o)):[r&&Wc(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function v_(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=sa(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const g_=Symbol(""),yh=Symbol(""),Ru=Symbol(""),Ad=Symbol(""),Kc=Symbol("");function Gi(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function ss(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((u,f)=>{const m=C=>{C===!1?f(Ti(yn.NAVIGATION_ABORTED,{from:n,to:t})):C instanceof Error?f(C):f_(C)?f(Ti(yn.NAVIGATION_GUARD_REDIRECT,{from:t,to:C})):(s&&r.enterCallbacks[o]===s&&typeof C=="function"&&s.push(C),u())},h=a(()=>e.call(r&&r.instances[o],t,n,m));let y=Promise.resolve(h);e.length<3&&(y=y.then(m)),y.catch(C=>f(C))})}function hc(e,t,n,r,o=a=>a()){const a=[];for(const s of e)for(const u in s.components){let f=s.components[u];if(!(t!=="beforeRouteEnter"&&!s.instances[u]))if(nv(f)){const m=(f.__vccOpts||f)[t];m&&a.push(ss(m,n,r,s,u,o))}else{let m=f();a.push(()=>m.then(h=>{if(!h)throw new Error(`Couldn't resolve component "${u}" at "${s.path}"`);const y=F0(h)?h.default:h;s.mods[u]=h,s.components[u]=y;const C=(y.__vccOpts||y)[t];return C&&ss(C,n,r,s,u,o)()}))}}return a}function y_(e,t){const n=[],r=[],o=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const u=t.matched[s];u&&(e.matched.find(m=>ki(m,u))?r.push(u):n.push(u));const f=e.matched[s];f&&(t.matched.find(m=>ki(m,f))||o.push(f))}return[n,r,o]}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/let w_=()=>location.protocol+"//"+location.host;function dv(e,t){const{pathname:n,search:r,hash:o}=t,a=e.indexOf("#");if(a>-1){let s=o.includes(e.slice(a))?e.slice(a).length:1,u=o.slice(s);return u[0]!=="/"&&(u="/"+u),ph(u,"")}return ph(n,e)+r+o}function b_(e,t,n,r){let o=[],a=[],s=null;const u=({state:C})=>{const I=dv(e,location),F=n.value,B=t.value;let oe=0;if(C){if(n.value=I,t.value=C,s&&s===F){s=null;return}oe=B?C.position-B.position:0}else r(I);o.forEach(V=>{V(n.value,F,{delta:oe,type:Vc.pop,direction:oe?oe>0?fc.forward:fc.back:fc.unknown})})};function f(){s=n.value}function m(C){o.push(C);const I=()=>{const F=o.indexOf(C);F>-1&&o.splice(F,1)};return a.push(I),I}function h(){if(document.visibilityState==="hidden"){const{history:C}=window;if(!C.state)return;C.replaceState(Ut({},C.state,{scroll:Iu()}),"")}}function y(){for(const C of a)C();a=[],window.removeEventListener("popstate",u),window.removeEventListener("pagehide",h),document.removeEventListener("visibilitychange",h)}return window.addEventListener("popstate",u),window.addEventListener("pagehide",h),document.addEventListener("visibilitychange",h),{pauseListeners:f,listen:m,destroy:y}}function wh(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?Iu():null}}function __(e){const{history:t,location:n}=window,r={value:dv(e,n)},o={value:t.state};o.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(f,m,h){const y=e.indexOf("#"),C=y>-1?(n.host&&document.querySelector("base")?e:e.slice(y))+f:w_()+e+f;try{t[h?"replaceState":"pushState"](m,"",C),o.value=m}catch(I){console.error(I),n[h?"replace":"assign"](C)}}function s(f,m){a(f,Ut({},t.state,wh(o.value.back,f,o.value.forward,!0),m,{position:o.value.position}),!0),r.value=f}function u(f,m){const h=Ut({},o.value,t.state,{forward:f,scroll:Iu()});a(h.current,h,!0),a(f,Ut({},wh(r.value,f,null),{position:h.position+1},m),!1),r.value=f}return{location:r,state:o,push:u,replace:s}}function k_(e){e=a_(e);const t=__(e),n=b_(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=Ut({location:"",base:e,go:r,createHref:i_.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function T_(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),k_(e)}let Rs=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Rn=(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})(Rn||{});const C_={type:Rs.Static,value:""},S_=/[a-zA-Z0-9_]/;function x_(e){if(!e)return[[]];if(e==="/")return[[C_]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(I){throw new Error(`ERR (${n})/"${m}": ${I}`)}let n=Rn.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let u=0,f,m="",h="";function y(){m&&(n===Rn.Static?a.push({type:Rs.Static,value:m}):n===Rn.Param||n===Rn.ParamRegExp||n===Rn.ParamRegExpEnd?(a.length>1&&(f==="*"||f==="+")&&t(`A repeatable param (${m}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Rs.Param,value:m,regexp:h,repeatable:f==="*"||f==="+",optional:f==="*"||f==="?"})):t("Invalid state to consume buffer"),m="")}function C(){m+=f}for(;u<e.length;){if(f=e[u++],f==="\\"&&n!==Rn.ParamRegExp){r=n,n=Rn.EscapeNext;continue}switch(n){case Rn.Static:f==="/"?(m&&y(),s()):f===":"?(y(),n=Rn.Param):C();break;case Rn.EscapeNext:C(),n=r;break;case Rn.Param:f==="("?n=Rn.ParamRegExp:S_.test(f)?C():(y(),n=Rn.Static,f!=="*"&&f!=="?"&&f!=="+"&&u--);break;case Rn.ParamRegExp:f===")"?h[h.length-1]=="\\"?h=h.slice(0,-1)+f:n=Rn.ParamRegExpEnd:h+=f;break;case Rn.ParamRegExpEnd:y(),n=Rn.Static,f!=="*"&&f!=="?"&&f!=="+"&&u--,h="";break;default:t("Unknown state");break}}return n===Rn.ParamRegExp&&t(`Unfinished custom RegExp for param "${m}"`),y(),s(),o}const bh="[^/]+?",A_={sensitive:!1,strict:!1,start:!0,end:!0};var Tr=(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})(Tr||{});const E_=/[.+*?^${}()[\]/\\]/g;function P_(e,t){const n=Ut({},A_,t),r=[];let o=n.start?"^":"";const a=[];for(const m of e){const h=m.length?[]:[Tr.Root];n.strict&&!m.length&&(o+="/");for(let y=0;y<m.length;y++){const C=m[y];let I=Tr.Segment+(n.sensitive?Tr.BonusCaseSensitive:0);if(C.type===Rs.Static)y||(o+="/"),o+=C.value.replace(E_,"\\$&"),I+=Tr.Static;else if(C.type===Rs.Param){const{value:F,repeatable:B,optional:oe,regexp:V}=C;a.push({name:F,repeatable:B,optional:oe});const O=V||bh;if(O!==bh){I+=Tr.BonusCustomRegExp;try{`${O}`}catch(se){throw new Error(`Invalid custom RegExp for param "${F}" (${O}): `+se.message)}}let ee=B?`((?:${O})(?:/(?:${O}))*)`:`(${O})`;y||(ee=oe&&m.length<2?`(?:/${ee})`:"/"+ee),oe&&(ee+="?"),o+=ee,I+=Tr.Dynamic,oe&&(I+=Tr.BonusOptional),B&&(I+=Tr.BonusRepeatable),O===".*"&&(I+=Tr.BonusWildcard)}h.push(I)}r.push(h)}if(n.strict&&n.end){const m=r.length-1;r[m][r[m].length-1]+=Tr.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function u(m){const h=m.match(s),y={};if(!h)return null;for(let C=1;C<h.length;C++){const I=h[C]||"",F=a[C-1];y[F.name]=I&&F.repeatable?I.split("/"):I}return y}function f(m){let h="",y=!1;for(const C of e){(!y||!h.endsWith("/"))&&(h+="/"),y=!1;for(const I of C)if(I.type===Rs.Static)h+=I.value;else if(I.type===Rs.Param){const{value:F,repeatable:B,optional:oe}=I,V=F in m?m[F]:"";if(sa(V)&&!B)throw new Error(`Provided param "${F}" is an array but it is not repeatable (* or + modifiers)`);const O=sa(V)?V.join("/"):V;if(!O)if(oe)C.length<2&&(h.endsWith("/")?h=h.slice(0,-1):y=!0);else throw new Error(`Missing required param "${F}"`);h+=O}}return h||"/"}return{re:s,score:r,keys:a,parse:u,stringify:f}}function I_(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===Tr.Static+Tr.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Tr.Static+Tr.Segment?1:-1:0}function fv(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=I_(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(_h(r))return 1;if(_h(o))return-1}return o.length-r.length}function _h(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const R_={strict:!1,end:!0,sensitive:!1};function M_(e,t,n){const r=P_(x_(e.path),n),o=Ut(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function $_(e,t){const n=[],r=new Map;t=hh(R_,t);function o(y){return r.get(y)}function a(y,C,I){const F=!I,B=Th(y);B.aliasOf=I&&I.record;const oe=hh(t,y),V=[B];if("alias"in y){const se=typeof y.alias=="string"?[y.alias]:y.alias;for(const Te of se)V.push(Th(Ut({},B,{components:I?I.record.components:B.components,path:Te,aliasOf:I?I.record:B})))}let O,ee;for(const se of V){const{path:Te}=se;if(C&&Te[0]!=="/"){const Fe=C.record.path,ae=Fe[Fe.length-1]==="/"?"":"/";se.path=C.record.path+(Te&&ae+Te)}if(O=M_(se,C,oe),I?I.alias.push(O):(ee=ee||O,ee!==O&&ee.alias.push(O),F&&y.name&&!Ch(O)&&s(y.name)),hv(O)&&f(O),B.children){const Fe=B.children;for(let ae=0;ae<Fe.length;ae++)a(Fe[ae],O,I&&I.children[ae])}I=I||O}return ee?()=>{s(ee)}:al}function s(y){if(uv(y)){const C=r.get(y);C&&(r.delete(y),n.splice(n.indexOf(C),1),C.children.forEach(s),C.alias.forEach(s))}else{const C=n.indexOf(y);C>-1&&(n.splice(C,1),y.record.name&&r.delete(y.record.name),y.children.forEach(s),y.alias.forEach(s))}}function u(){return n}function f(y){const C=N_(y,n);n.splice(C,0,y),y.record.name&&!Ch(y)&&r.set(y.record.name,y)}function m(y,C){let I,F={},B,oe;if("name"in y&&y.name){if(I=r.get(y.name),!I)throw Ti(yn.MATCHER_NOT_FOUND,{location:y});oe=I.record.name,F=Ut(kh(C.params,I.keys.filter(ee=>!ee.optional).concat(I.parent?I.parent.keys.filter(ee=>ee.optional):[]).map(ee=>ee.name)),y.params&&kh(y.params,I.keys.map(ee=>ee.name))),B=I.stringify(F)}else if(y.path!=null)B=y.path,I=n.find(ee=>ee.re.test(B)),I&&(F=I.parse(B),oe=I.record.name);else{if(I=C.name?r.get(C.name):n.find(ee=>ee.re.test(C.path)),!I)throw Ti(yn.MATCHER_NOT_FOUND,{location:y,currentLocation:C});oe=I.record.name,F=Ut({},C.params,y.params),B=I.stringify(F)}const V=[];let O=I;for(;O;)V.unshift(O.record),O=O.parent;return{name:oe,path:B,params:F,matched:V,meta:L_(V)}}e.forEach(y=>a(y));function h(){n.length=0,r.clear()}return{addRoute:a,resolve:m,removeRoute:s,clearRoutes:h,getRoutes:u,getRecordMatcher:o}}function kh(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Th(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:j_(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 j_(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Ch(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function L_(e){return e.reduce((t,n)=>Ut(t,n.meta),{})}function N_(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;fv(e,t[a])<0?r=a:n=a+1}const o=O_(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function O_(e){let t=e;for(;t=t.parent;)if(hv(t)&&fv(e,t)===0)return t}function hv({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Sh(e){const t=na(Ru),n=na(Ad),r=Q(()=>{const f=T(e.to);return t.resolve(f)}),o=Q(()=>{const{matched:f}=r.value,{length:m}=f,h=f[m-1],y=n.matched;if(!h||!y.length)return-1;const C=y.findIndex(ki.bind(null,h));if(C>-1)return C;const I=xh(f[m-2]);return m>1&&xh(h)===I&&y[y.length-1].path!==I?y.findIndex(ki.bind(null,f[m-2])):C}),a=Q(()=>o.value>-1&&q_(n.params,r.value.params)),s=Q(()=>o.value>-1&&o.value===n.matched.length-1&&lv(n.params,r.value.params));function u(f={}){if(B_(f)){const m=t[T(e.replace)?"replace":"push"](T(e.to)).catch(al);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>m),m}return Promise.resolve()}return{route:r,href:Q(()=>r.value.href),isActive:a,isExactActive:s,navigate:u}}function D_(e){return e.length===1?e[0]:e}const F_=er({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:Sh,setup(e,{slots:t}){const n=Cu(Sh(e)),{options:r}=na(Ru),o=Q(()=>({[Ah(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ah(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&D_(t.default(n));return e.custom?a:Sd("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),U_=F_;function B_(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 q_(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!sa(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function xh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ah=(e,t,n)=>e??t??n,H_=er({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=na(Kc),o=Q(()=>e.route||r.value),a=na(yh,0),s=Q(()=>{let m=T(a);const{matched:h}=o.value;let y;for(;(y=h[m])&&!y.components;)m++;return m}),u=Q(()=>o.value.matched[s.value]);tu(yh,Q(()=>s.value+1)),tu(g_,u),tu(Kc,o);const f=x();return ft(()=>[f.value,u.value,e.name],([m,h,y],[C,I,F])=>{h&&(h.instances[y]=m,I&&I!==h&&m&&m===C&&(h.leaveGuards.size||(h.leaveGuards=I.leaveGuards),h.updateGuards.size||(h.updateGuards=I.updateGuards))),m&&h&&(!I||!ki(h,I)||!C)&&(h.enterCallbacks[y]||[]).forEach(B=>B(m))},{flush:"post"}),()=>{const m=o.value,h=e.name,y=u.value,C=y&&y.components[h];if(!C)return Eh(n.default,{Component:C,route:m});const I=y.props[h],F=I?I===!0?m.params:typeof I=="function"?I(m):I:null,oe=Sd(C,Ut({},F,t,{onVnodeUnmounted:V=>{V.component.isUnmounted&&(y.instances[h]=null)},ref:f}));return Eh(n.default,{Component:oe,route:m})||oe}}});function Eh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const z_=H_;function W_(e){const t=$_(e.routes,e),n=e.parseQuery||m_,r=e.stringifyQuery||gh,o=e.history,a=Gi(),s=Gi(),u=Gi(),f=Ow(ts);let m=ts;oi&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const h=cc.bind(null,te=>""+te),y=cc.bind(null,X0),C=cc.bind(null,pl);function I(te,pe){let ve,ke;return uv(te)?(ve=t.getRecordMatcher(te),ke=pe):ke=te,t.addRoute(ke,ve)}function F(te){const pe=t.getRecordMatcher(te);pe&&t.removeRoute(pe)}function B(){return t.getRoutes().map(te=>te.record)}function oe(te){return!!t.getRecordMatcher(te)}function V(te,pe){if(pe=Ut({},pe||f.value),typeof te=="string"){const W=dc(n,te,pe.path),D=t.resolve({path:W.path},pe),J=o.createHref(W.fullPath);return Ut(W,D,{params:C(D.params),hash:pl(W.hash),redirectedFrom:void 0,href:J})}let ve;if(te.path!=null)ve=Ut({},te,{path:dc(n,te.path,pe.path).path});else{const W=Ut({},te.params);for(const D in W)W[D]==null&&delete W[D];ve=Ut({},te,{params:y(W)}),pe.params=y(pe.params)}const ke=t.resolve(ve,pe),Xe=te.hash||"";ke.params=h(C(ke.params));const P=t_(r,Ut({},te,{hash:Y0(Xe),path:ke.path})),L=o.createHref(P);return Ut({fullPath:P,hash:Xe,query:r===gh?v_(te.query):te.query||{}},ke,{redirectedFrom:void 0,href:L})}function O(te){return typeof te=="string"?dc(n,te,f.value.path):Ut({},te)}function ee(te,pe){if(m!==te)return Ti(yn.NAVIGATION_CANCELLED,{from:pe,to:te})}function se(te){return ae(te)}function Te(te){return se(Ut(O(te),{replace:!0}))}function Fe(te,pe){const ve=te.matched[te.matched.length-1];if(ve&&ve.redirect){const{redirect:ke}=ve;let Xe=typeof ke=="function"?ke(te,pe):ke;return typeof Xe=="string"&&(Xe=Xe.includes("?")||Xe.includes("#")?Xe=O(Xe):{path:Xe},Xe.params={}),Ut({query:te.query,hash:te.hash,params:Xe.path!=null?{}:te.params},Xe)}}function ae(te,pe){const ve=m=V(te),ke=f.value,Xe=te.state,P=te.force,L=te.replace===!0,W=Fe(ve,ke);if(W)return ae(Ut(O(W),{state:typeof W=="object"?Ut({},Xe,W.state):Xe,force:P,replace:L}),pe||ve);const D=ve;D.redirectedFrom=pe;let J;return!P&&n_(r,ke,ve)&&(J=Ti(yn.NAVIGATION_DUPLICATED,{to:D,from:ke}),Me(ke,ke,!0,!1)),(J?Promise.resolve(J):be(D,ke)).catch(U=>Oa(U)?Oa(U,yn.NAVIGATION_GUARD_REDIRECT)?U:et(U):Ie(U,D,ke)).then(U=>{if(U){if(Oa(U,yn.NAVIGATION_GUARD_REDIRECT))return ae(Ut({replace:L},O(U.to),{state:typeof U.to=="object"?Ut({},Xe,U.to.state):Xe,force:P}),pe||D)}else U=ce(D,ke,!0,L,Xe);return Ue(D,ke,U),U})}function xe(te,pe){const ve=ee(te,pe);return ve?Promise.reject(ve):Promise.resolve()}function le(te){const pe=ct.values().next().value;return pe&&typeof pe.runWithContext=="function"?pe.runWithContext(te):te()}function be(te,pe){let ve;const[ke,Xe,P]=y_(te,pe);ve=hc(ke.reverse(),"beforeRouteLeave",te,pe);for(const W of ke)W.leaveGuards.forEach(D=>{ve.push(ss(D,te,pe))});const L=xe.bind(null,te,pe);return ve.push(L),Je(ve).then(()=>{ve=[];for(const W of a.list())ve.push(ss(W,te,pe));return ve.push(L),Je(ve)}).then(()=>{ve=hc(Xe,"beforeRouteUpdate",te,pe);for(const W of Xe)W.updateGuards.forEach(D=>{ve.push(ss(D,te,pe))});return ve.push(L),Je(ve)}).then(()=>{ve=[];for(const W of P)if(W.beforeEnter)if(sa(W.beforeEnter))for(const D of W.beforeEnter)ve.push(ss(D,te,pe));else ve.push(ss(W.beforeEnter,te,pe));return ve.push(L),Je(ve)}).then(()=>(te.matched.forEach(W=>W.enterCallbacks={}),ve=hc(P,"beforeRouteEnter",te,pe,le),ve.push(L),Je(ve))).then(()=>{ve=[];for(const W of s.list())ve.push(ss(W,te,pe));return ve.push(L),Je(ve)}).catch(W=>Oa(W,yn.NAVIGATION_CANCELLED)?W:Promise.reject(W))}function Ue(te,pe,ve){u.list().forEach(ke=>le(()=>ke(te,pe,ve)))}function ce(te,pe,ve,ke,Xe){const P=ee(te,pe);if(P)return P;const L=pe===ts,W=oi?history.state:{};ve&&(ke||L?o.replace(te.fullPath,Ut({scroll:L&&W&&W.scroll},Xe)):o.push(te.fullPath,Xe)),f.value=te,Me(te,pe,ve,L),et()}let fe;function Se(){fe||(fe=o.listen((te,pe,ve)=>{if(!at.listening)return;const ke=V(te),Xe=Fe(ke,at.currentRoute.value);if(Xe){ae(Ut(Xe,{replace:!0,force:!0}),ke).catch(al);return}m=ke;const P=f.value;oi&&c_(vh(P.fullPath,ve.delta),Iu()),be(ke,P).catch(L=>Oa(L,yn.NAVIGATION_ABORTED|yn.NAVIGATION_CANCELLED)?L:Oa(L,yn.NAVIGATION_GUARD_REDIRECT)?(ae(Ut(O(L.to),{force:!0}),ke).then(W=>{Oa(W,yn.NAVIGATION_ABORTED|yn.NAVIGATION_DUPLICATED)&&!ve.delta&&ve.type===Vc.pop&&o.go(-1,!1)}).catch(al),Promise.reject()):(ve.delta&&o.go(-ve.delta,!1),Ie(L,ke,P))).then(L=>{L=L||ce(ke,P,!1),L&&(ve.delta&&!Oa(L,yn.NAVIGATION_CANCELLED)?o.go(-ve.delta,!1):ve.type===Vc.pop&&Oa(L,yn.NAVIGATION_ABORTED|yn.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),Ue(ke,P,L)}).catch(al)}))}let De=Gi(),Ee=Gi(),Re;function Ie(te,pe,ve){et(te);const ke=Ee.list();return ke.length?ke.forEach(Xe=>Xe(te,pe,ve)):console.error(te),Promise.reject(te)}function Qe(){return Re&&f.value!==ts?Promise.resolve():new Promise((te,pe)=>{De.add([te,pe])})}function et(te){return Re||(Re=!te,Se(),De.list().forEach(([pe,ve])=>te?ve(te):pe()),De.reset()),te}function Me(te,pe,ve,ke){const{scrollBehavior:Xe}=e;if(!oi||!Xe)return Promise.resolve();const P=!ve&&d_(vh(te.fullPath,0))||(ke||!ve)&&history.state&&history.state.scroll||null;return zt().then(()=>Xe(te,pe,P)).then(L=>L&&u_(L)).catch(L=>Ie(L,te,pe))}const We=te=>o.go(te);let it;const ct=new Set,at={currentRoute:f,listening:!0,addRoute:I,removeRoute:F,clearRoutes:t.clearRoutes,hasRoute:oe,getRoutes:B,resolve:V,options:e,push:se,replace:Te,go:We,back:()=>We(-1),forward:()=>We(1),beforeEach:a.add,beforeResolve:s.add,afterEach:u.add,onError:Ee.add,isReady:Qe,install(te){te.component("RouterLink",U_),te.component("RouterView",z_),te.config.globalProperties.$router=at,Object.defineProperty(te.config.globalProperties,"$route",{enumerable:!0,get:()=>T(f)}),oi&&!it&&f.value===ts&&(it=!0,se(o.location).catch(ke=>{}));const pe={};for(const ke in ts)Object.defineProperty(pe,ke,{get:()=>f.value[ke],enumerable:!0});te.provide(Ru,at),te.provide(Ad,um(pe)),te.provide(Kc,f);const ve=te.unmount;ct.add(te),te.unmount=function(){ct.delete(te),ct.size<1&&(m=ts,fe&&fe(),fe=null,f.value=ts,it=!1,Re=!1),ve()}}};function Je(te){return te.reduce((pe,ve)=>pe.then(()=>le(ve)),Promise.resolve())}return at}function V_(){return na(Ru)}function G_(e){return na(Ad)}const Ph=768;function Ed(){const e=x(typeof window<"u"?window.innerWidth<Ph:!1);let t=null;function n(r){e.value=r.matches}return Ga(()=>{t=window.matchMedia(`(max-width: ${Ph-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),xu(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const K_={key:0,class:"desktop-sidebar"},Y_={class:"desktop-main"},Ih="codex-web-local.sidebar-width.v1",J_=260,Q_=620,Rh=320,X_=er({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Ed();function r(m){return Math.min(Q_,Math.max(J_,m))}function o(){if(typeof window>"u")return Rh;const m=window.localStorage.getItem(Ih),h=Number(m);return Number.isFinite(h)?r(h):Rh}const a=x(o()),s=Q(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function u(m){typeof window>"u"||window.localStorage.setItem(Ih,String(m))}function f(m){m.preventDefault();const h=m.clientX,y=a.value,C=F=>{const B=F.clientX-h;a.value=r(y+B)},I=()=>{u(a.value),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",C),window.addEventListener("mouseup",I)}return(m,h)=>(S(),A("div",{class:Ze(["desktop-layout",{"is-mobile":T(n)}]),style:ea(s.value)},[T(n)?(S(),rt(is,{key:0,to:"body"},[je(Zm,{name:"drawer"},{default:yt(()=>[e.isSidebarCollapsed?Z("",!0):(S(),A("div",{key:0,class:"mobile-drawer-backdrop",onClick:h[1]||(h[1]=y=>m.$emit("close-sidebar"))},[p("aside",{class:"mobile-drawer",onClick:h[0]||(h[0]=Ye(()=>{},["stop"]))},[Sa(m.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):Z("",!0),T(n)?Z("",!0):(S(),A(tt,{key:1},[e.isSidebarCollapsed?Z("",!0):(S(),A("aside",K_,[Sa(m.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?Z("",!0):(S(),A("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:f},null,32))],64)),p("section",Y_,[Sa(m.$slots,"content",{},void 0)])],6))}}),At=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},Z_=At(X_,[["__scopeId","data-v-782e512b"]]);function Mh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class ra extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function So(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Mh(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=Mh(r);return o&&typeof o.message=="string"&&o.message.length>0?o.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function ia(e,t,n){return e instanceof ra?e:e instanceof Error?new ra(e.message||t,{code:"unknown_error",method:n}):new ra(t,{code:"unknown_error",method:n})}function pv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function ek(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(u){throw new ra(u instanceof Error?u.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,a=null;try{a=await r.text(),o=JSON.parse(a)}catch{o=null}if(!r.ok){const u=So(o,"")||(a==null?void 0:a.slice(0,500))||"",f=`RPC ${e} failed with HTTP ${r.status}`;throw new ra(u?`${f}: ${u}`:f,{code:"http_error",method:e,status:r.status})}const s=o;if(!s||typeof s!="object"||!("result"in s))throw new ra(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function tk(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new ra(So(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 nk(e){const t=pv(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 $h(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function rk(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(m,h)=>{if(n||r!==null)return;const y=Math.min(1e3*2**h,1e4);r=window.setTimeout(()=>{r=null,!n&&m()},y)},s=m=>{const h=nk(m);h&&e(h)},u=(m=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const h=new EventSource("/codex-api/events");let y=!1;h.onmessage=C=>{try{s(JSON.parse(C.data))}catch{}},h.addEventListener("ready",C=>{try{const I=C.data?JSON.parse(C.data):{ok:!0};$h(e,I)}catch{$h(e)}}),h.onerror=()=>{n||y||h.readyState===EventSource.CLOSED&&(y=!0,h.close(),a(()=>u(m+1),m))},t=()=>{y=!0,h.close()}},f=(m=0)=>{if(typeof WebSocket>"u"||n){u();return}t==null||t();const h=window.location.protocol==="https:"?"wss:":"ws:",y=new WebSocket(`${h}//${window.location.host}/codex-api/ws`);let C=!1,I=!1,F=window.setTimeout(()=>{C||n||I||(I=!0,y.close(),u())},2500);y.onopen=()=>{C=!0,o(),F!==null&&(window.clearTimeout(F),F=null)},y.onmessage=B=>{try{s(JSON.parse(String(B.data)))}catch{}},y.onerror=()=>{},y.onclose=()=>{if(F!==null&&(window.clearTimeout(F),F=null),!(n||I)){if(!C){u();return}a(()=>f(m+1),m)}},t=()=>{I=!0,F!==null&&(window.clearTimeout(F),F=null),y.close()}};return typeof WebSocket<"u"?f():u(),()=>{n=!0,o(),t==null||t()}}async function ok(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new ra(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new ra(So(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function ak(){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 ra(So(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=pv(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function sk(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function ut(e){return sk(e)}function mv(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function ik(e){const t=ut(e);return t.startsWith("/")||mv(t)}function lk(e){const t=ut(e).replace(/[\\/]+/gu,"/");return mv(t)?t.toLowerCase():t}function eo(e){const t=ut(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function vi(e){const t=ut(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function ko(e){return eo(e)||ut(e)||"Projectless"}function pu(e){const t=ut(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function jh(e){return new Date(e*1e3).toISOString()}function uk(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ck(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const dk=/^##\s+(.+?):\s+(.+?)\s*$/,fk=/^#\s*files mentioned by the user\s*:?\s*$/i;function hk(e){var o,a;const t=e.split(`
|
|
27
|
+
`).findIndex(s=>fk.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
+
`).slice(t+1),r=[];for(const s of n){const u=s.trim();if(!u)continue;const f=u.match(dk);if(!f)break;const m=(o=f[1])==null?void 0:o.trim(),h=(a=f[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");m&&h&&r.push({label:m,path:h})}return r}function pk(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const o=r.index+r[0].length;return e.slice(o).trim()}function vv(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function mk(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 vk(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function pc(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?vk(n[1].trim()):""}function gk(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=pc(t,"current_time_iso"),r=pc(t,"instructions");return!n||!r?null:{automationId:pc(t,"automation_id"),currentTimeIso:n,instructions:r}}function yk(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[];for(const[m,h]of t.entries()){if(h.type==="text"&&typeof h.text=="string"&&h.text.length>0&&n.push(h.text),h.type==="image"&&typeof h.url=="string"&&h.url.trim().length>0&&r.push(h.url.trim()),h.type==="localImage"&&typeof h.path=="string"&&h.path.trim().length>0&&r.push(vv(h.path.trim())),h.type==="skill"){const y=typeof h.name=="string"?h.name.trim():"",C=typeof h.path=="string"?h.path.trim():"";y&&C&&o.push({name:y,path:C})}h.type!=="text"&&h.type!=="image"&&h.type!=="localImage"&&h.type!=="skill"&&a.push({id:`${e}:user-content:${m}`,role:"user",text:"",messageType:`userContent.${h.type}`,rawPayload:uk(h),isUnhandled:!0})}const s=n.join(`
|
|
29
|
+
`),u=hk(s),f=gk(s);return{text:(f==null?void 0:f.instructions)??pk(s),images:r,skills:o,fileAttachments:u,rawBlocks:a,isAutomationRun:f!==null,automationDisplayName:(f==null?void 0:f.automationId)||null}}function wk(e){var a;const t=e.replace(/\r\n/g,`
|
|
30
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
+
`),r=[],o=[];for(const s of n){const u=s.trim();if(!u){r.length===0&&o.push("");continue}const f=u.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(f){const m=(f[1]??" ").toLowerCase(),h=(a=f[2])==null?void 0:a.trim();if(!h)continue;let y="pending";m==="x"&&(y="completed"),(m==="~"||m===">"||m==="-")&&(y="inProgress"),r.push({step:h,status:y});continue}o.push(u)}return r.length===0?null:{explanation:o.join(`
|
|
32
|
+
`).trim()||void 0,steps:r}}function Lh(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
|
|
33
|
+
`),n=t.endsWith(`
|
|
34
|
+
`)?t.slice(0,-1):t;return n?n.split(`
|
|
35
|
+
`).length:0}function bk(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
|
|
36
|
+
`).split(`
|
|
37
|
+
`))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function gv(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function yv(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,a=typeof o.path=="string"?o.path:"",s=typeof o.diff=="string"?o.diff:"",u=o.kind,f=u==null?void 0:u.type;if(!a||f!=="add"&&f!=="delete"&&f!=="update")continue;const m=f==="update"&&typeof(u==null?void 0:u.move_path)=="string"?u.move_path:null,h=f==="update"?bk(s):f==="add"?{addedLineCount:Lh(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:Lh(s)};n.push({path:a,operation:f,movedToPath:m,diff:s,...h})}return n}function _k(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=yk(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:[vv(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?mk(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning")return[];if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:wk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=kk(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:o,status:n,aggregatedOutput:a,exitCode:s}}]}if(e.type==="fileChange"){const t=yv(e.changes),n=gv(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return[]}function kk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Tk(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function Ck(e){const t=Tk(e);return t.length>0?t:"Untitled thread"}function Pd(e){return(e==null?void 0:e.status)==="inProgress"}function wv(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const n=t.status;if(n&&typeof n=="object"){const a=n.type;if(a==="active"||a==="inProgress")return!0}const o=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Pd(o)}function bv(e){const t=e,n=ut(typeof t.cwd=="string"?t.cwd:e.cwd),r=lk(n),o=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:Ck(e),projectName:ko(n),cwd:n,hasWorktree:o,createdAtIso:jh(e.createdAt),updatedAtIso:jh(e.updatedAt),preview:e.preview,unread:!1,inProgress:wv(e)}}function Sk(e){return bv(e.thread)}function xk(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((o,a)=>new Date(a.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var s,u;const o=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((u=r.threads[0])==null?void 0:u.updatedAtIso)??0).getTime()-o})}function Ak(e){const t=e.data.map(bv);return xk(t)}function kl(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let o=0;o<n.length;o++){const a=t+o,s=n[o],u=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",f=u.length>0?u:void 0,m=Array.isArray(s.items)?s.items:[];for(const y of m)for(const C of _k(y))r.push({...C,turnId:f,turnIndex:a});const h=ck(s);if(s.status==="failed"&&h){const y=f??`turn-${a}`;r.push({id:`${y}-error`,role:"system",text:h,messageType:"turnError",turnId:f,turnIndex:a})}}return r}function Id(e){if(wv(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Pd(t.at(-1))}function Rd(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Pd(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const Ek=5e3;function mc(e){return e&&e.length>0?e:null}function vc(e){return e&&e.length>0?e:null}let Hl=null,sl=null;const Nh=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function ot(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function de(e){return typeof e=="string"&&e.length>0?e:null}function wn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Co(e){return typeof e=="boolean"?e:null}function ii(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function Pk(e){return e==="payment_required"?e:null}function Ik(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Oh(e){const t=ot(e);if(!t)return null;const n=wn(t.usedPercent??t.used_percent);if(n===null)return null;const r=wn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:wn(t.resetsAt??t.resets_at)}}function Rk(e){const t=ot(e);if(!t)return null;const n=Co(t.hasCredits??t.has_credits),r=Co(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:de(t.balance)}}function Yc(e){const t=ot(e);if(!t)return null;const n=Oh(t.primary),r=Oh(t.secondary),o=Rk(t.credits);return!n&&!r&&!o?null:{limitId:de(t.limitId??t.limit_id),limitName:de(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:de(t.planType??t.plan_type)}}function _v(e,t=null,n=null){const r=ot(e);if(!r)return null;const o=de(r.accountId),a=de(r.storageId)??o,s=de(r.quotaStatus),u=s==="loading"||s==="ready"||s==="error"?s:"idle";return o?{accountId:o,storageId:a??o,userId:de(r.userId),authMode:de(r.authMode),email:de(r.email),planType:de(r.planType),lastRefreshedAtIso:de(r.lastRefreshedAtIso)??"",lastActivatedAtIso:de(r.lastActivatedAtIso),quotaSnapshot:Yc(r.quotaSnapshot),quotaUpdatedAtIso:de(r.quotaUpdatedAtIso),quotaStatus:u,quotaError:de(r.quotaError),unavailableReason:Pk(r.unavailableReason)??(Ik(de(r.quotaError))?"payment_required":null),isActive:Co(r.isActive)??(a===n||o===t)}:null}function kv(e){const t=ot(e);if(!t)return null;const n=ot(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Yc(n==null?void 0:n.codex);return r||Yc(t.rateLimits??t.rate_limits)}async function Wt(e,t){try{return await ek(e,t)}catch(n){throw ia(n,`RPC ${e} failed`,e)}}function Md(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let o=0;o<n.length;o+=1){const a=t+o,s=n[o];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=a)}return r}function Mu(e){const t=ot(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function Mk(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function $k(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const jk=50,Lk=100;async function Nk(e,t){const n=await Wt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:Ak(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function Ok(e){const t=await Wt("thread/read",{threadId:e,includeTurns:!1});return Sk(t)}async function Dk(e){const t=await Wt("thread/read",{threadId:e,includeTurns:!0}),n=Mu(t),r=kl(t,n);return{model:ml(t),modelProvider:ju(t),messages:r,inProgress:Id(t),activeTurnId:Rd(t),hasMoreOlder:n>0,turnIndexByTurnId:Md(t,n)}}async function Fk(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),o=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!o.ok)throw new Error(`Older thread page request failed with ${o.status}`);const a=await o.json();if(!a.result)throw new Error("Older thread page response did not include a thread result");const s=Math.max(0,Math.floor(typeof a.startTurnIndex=="number"?a.startTurnIndex:0));return{messages:kl(a.result,s),inProgress:Id(a.result),activeTurnId:Rd(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:Md(a.result,s)}}async function Dh(e=null,t=jk){try{return await Nk(e,t)}catch(n){throw ia(n,"Failed to load thread groups","thread/list")}}function Uk(){return Lk}async function Bk(e){try{return await Ok(e)}catch(t){throw ia(t,`Failed to load thread ${e}`,"thread/read")}}async function Fh(e){try{return await Dk(e)}catch(t){throw ia(t,`Failed to load thread ${e}`,"thread/read")}}async function qk(e,t,n){try{return await Fk(e,t,n)}catch(r){throw ia(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}function Hk(e){const t=ot(e);if(!t)return null;const n=de(t.key),r=typeof t.text=="string"?t.text:"",o=de(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:wn(t.oldLine),newLine:wn(t.newLine)}}function zk(e){const t=ot(e);if(!t)return null;const n=de(t.id),r=typeof t.header=="string"?t.header:"",o=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:o,addedLineCount:wn(t.addedLineCount)??0,removedLineCount:wn(t.removedLineCount)??0,oldStart:wn(t.oldStart),oldLineCount:wn(t.oldLineCount)??0,newStart:wn(t.newStart),newLineCount:wn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>Hk(a)).filter(a=>a!==null):[]}:null}function Wk(e){const t=ot(e);if(!t)return null;const n=de(t.id),r=de(t.path),o=de(t.absolutePath),a=de(t.operation);return!n||!r||!o||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:de(t.previousPath),previousAbsolutePath:de(t.previousAbsolutePath),operation:a,addedLineCount:wn(t.addedLineCount)??0,removedLineCount:wn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>zk(s)).filter(s=>s!==null):[]}}function Tv(e){const t=ot(e),n=ot(t==null?void 0:t.data),r=ot(n==null?void 0:n.summary),o=de(n==null?void 0:n.scope),a=o==="baseBranch"||o==="commit"?o:"workspace",s=de(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:de(n==null?void 0:n.cwd)??"",gitRoot:de(n==null?void 0:n.gitRoot),isGitRepo:Co(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:de(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(u=>de(u)).filter(u=>typeof u=="string"&&u.length>0):[],commitSha:de(n==null?void 0:n.commitSha),headBranch:de(n==null?void 0:n.headBranch),mergeBaseSha:de(n==null?void 0:n.mergeBaseSha),generatedAtIso:de(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:wn(r==null?void 0:r.fileCount)??0,addedLineCount:wn(r==null?void 0:r.addedLineCount)??0,removedLineCount:wn(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(u=>Wk(u)).filter(u=>u!==null):[]}}function Vk(e){const t=ot(e),n=ot(t==null?void 0:t.data);return{fileCount:wn(n==null?void 0:n.fileCount)??0,addedLineCount:wn(n==null?void 0:n.addedLineCount)??0,removedLineCount:wn(n==null?void 0:n.removedLineCount)??0}}async function XN(){return tk()}function mu(e){const t=ot(e);if(!t)return null;const n=de(t.id),r=de(t.kind),o=de(t.name),a=de(t.prompt),s=de(t.rrule),u=de(t.status);return!n||!o||!a||!s||r!=="heartbeat"&&r!=="cron"||u!=="ACTIVE"&&u!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:a,rrule:s,status:u,targetThreadId:de(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(f=>typeof f=="string"&&f.trim().length>0):[],createdAtMs:wn(t.createdAtMs),updatedAtMs:wn(t.updatedAtMs),nextRunAtMs:wn(t.nextRunAtMs)}}function Cv(e){if(Array.isArray(e))return e.flatMap(n=>{const r=mu(n);return r?[r]:[]});const t=mu(e);return t?[t]:[]}async function Gk(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(So(t,"Failed to load thread automations"));const n=ot((o=ot(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const u=Cv(s);u.length>0&&(r[a]=u)}return r}async function Kk(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(So(t,"Failed to load project automations"));const n=ot((o=ot(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const u=Cv(s);u.length>0&&(r[a]=u)}return r}async function Yk(e){var o;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(So(n,"Failed to save thread automation"));const r=mu((o=ot(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function Jk(e){var o;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(So(n,"Failed to save project automation"));const r=mu((o=ot(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function Uh(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(So(o,"Failed to delete thread automation"))}async function Bh(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(So(o,"Failed to delete project automation"))}async function Qk(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(So(r,"Failed to run thread automation"))}function Xk(e){return rk(e)}function Zk(e){const t=ot(e);if(!t)return null;const n=de(t.id),r=de(t.threadId),o=de(t.cwd),a=de(t.shell);return!n||!r||!o||!a?null:{id:n,threadId:r,cwd:o,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Co(t.truncated)??!1}}async function Ai(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(So(r,`Terminal request failed with HTTP ${n.status}`));return r}async function ZN(e){var r;const t=await Ai("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=Zk((r=ot(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function eT(){const e=await Ai("/codex-api/thread-terminal/status"),t=ot(e);return{available:Co(t==null?void 0:t.available)??!1,reason:de(t==null?void 0:t.reason)||null}}async function tT(e){const t=await Ai(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=ot(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(o=>{const a=ot(o),s=de(a==null?void 0:a.label),u=de(a==null?void 0:a.value),f=de(a==null?void 0:a.source);return!s||!u||f!=="package"&&f!=="script"&&f!=="make"?[]:[{label:s,value:u,source:f}]})}async function eO(e,t){await Ai("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function tO(e,t,n){await Ai("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function nO(e){await Ai("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function nT(e,t){await ok({id:e,...t})}async function rT(){return ak()}async function oT(){try{const e=await Wt("account/rateLimits/read");return kv(e)}catch(e){throw ia(e,"Failed to load account rate limits","account/rateLimits/read")}}function $u(e){const t=ot(e),n=de(t==null?void 0:t.activeAccountId),r=de(t==null?void 0:t.activeStorageId),o=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:r,importedAccountId:de(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:de(t==null?void 0:t.importedStorageId)??void 0,accounts:o.map(a=>_v(a,n,r)).filter(a=>a!==null)}}async function aT(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(bn(t,"Failed to load accounts"));const n=ot(t);return $u(n==null?void 0:n.data)}async function qh(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(bn(t,"Failed to refresh accounts"));const n=ot(t);return $u(n==null?void 0:n.data)}async function sT(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(bn(t,"Failed to start Codex login"));const n=ot(t),r=ot(n==null?void 0:n.data),o=de(r==null?void 0:r.loginUrl);if(!o)throw new Error("Failed to start Codex login");return o}async function iT(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(bn(n,"Failed to complete Codex login"));const r=ot(n);return $u(r==null?void 0:r.data)}async function lT(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(bn(n,"Failed to switch account"));const r=ot(n),o=ot(r==null?void 0:r.data),a=_v(o==null?void 0:o.account,de(o==null?void 0:o.activeAccountId),de(o==null?void 0:o.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function uT(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(bn(n,"Failed to remove account"));const r=ot(n);return $u(r==null?void 0:r.data)}const cT=3e4,Xs=new Map;async function gc(e){const t=Xs.get(e);if(t)return t;const n=(async()=>{const o=await Wt("thread/resume",{threadId:e}),a=Mu(o),s=kl(o,a);return{model:ml(o),modelProvider:ju(o),messages:s,inProgress:Id(o),activeTurnId:Rd(o),hasMoreOlder:a>0,turnIndexByTurnId:Md(o,a)}})();Xs.set(e,n);const r=globalThis.setTimeout(()=>{Xs.get(e)===n&&Xs.delete(e)},cT);return n.finally(()=>{globalThis.clearTimeout(r),globalThis.setTimeout(()=>{Xs.get(e)===n&&Xs.delete(e)},2e3)}).catch(()=>{}),n}async function dT(e){await Wt("thread/archive",{threadId:e})}async function fT(e,t){await Wt("thread/name/set",{threadId:e,name:t})}async function yc(e,t){const n=await Wt("thread/rollback",{threadId:e,numTurns:t});return kl(n,Mu(n))}async function hT(e,t,n,r,o,a){try{const s=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n,action:r,patchIds:o,scope:a})}),u=await s.json().catch(()=>({}));if(!s.ok){const f=typeof u.message=="string"&&u.message.trim()?u.message.trim():typeof u.error=="string"&&u.error.trim()?u.error.trim():"Server error";return{changed:0,errors:Array.isArray(u.errors)&&u.errors.length>0?u.errors:[f],message:u.message}}return{changed:u.changed??u.reverted??u.applied??0,errors:Array.isArray(u.errors)?u.errors:[],message:u.message,revertedPatchIds:Array.isArray(u.revertedPatchIds)?u.revertedPatchIds:[],appliedPatchIds:Array.isArray(u.appliedPatchIds)?u.appliedPatchIds:[]}}catch(s){return{changed:0,errors:[s instanceof Error?s.message:"Network error"]}}}async function pT(e,t,n){const r=await hT(e,t,n,"undo");return{reverted:r.changed,errors:r.errors}}function Jc(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}function mT(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}function ml(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function ju(e){var o,a;const t=ot(e);if(!t)return"";const n=((o=de(t.modelProvider))==null?void 0:o.trim())??"";if(n)return n;const r=ot(t.thread);return((a=de(r==null?void 0:r.modelProvider))==null?void 0:a.trim())??""}async function Hh(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await Wt("thread/start",n),o=Jc(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:ml(r),modelProvider:ju(r)}}catch(n){throw ia(n,"Failed to start a new thread","thread/start")}}async function zh(e,t,n){if(arguments.length<=1)try{const r=await Wt("thread/fork",{threadId:e,persistExtendedHistory:!0}),o=Jc(r);if(!o)throw new Error("thread/fork did not return a thread id");return{threadId:o,cwd:mT(r),model:ml(r),messages:kl(r,Mu(r))}}catch(r){throw ia(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const o={threadId:r};typeof t=="string"&&t.trim().length>0&&(o.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(o.model=n.trim());const a=await Wt("thread/fork",o),s=Jc(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:ml(a),modelProvider:ju(a)}}catch(r){throw ia(r,`Failed to fork thread ${e}`,"thread/fork")}}function Wh(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const r=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return r.length>0?r:null}catch{return null}}function vT(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
38
|
+
`;for(const r of t)n+=`
|
|
39
|
+
## ${r.label}: ${r.path}
|
|
40
|
+
`;return`${n}
|
|
41
|
+
## My request for Codex:
|
|
42
|
+
|
|
43
|
+
${e}
|
|
44
|
+
`}function gT(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function yT(e,t,n){var f;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?mc(n):vc(n)};let o=null;try{o=await xv()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?mc(n??(o==null?void 0:o.reasoningEffort)):vc(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await Sv()}catch{s=[]}const u=((f=s.find(m=>m.trim().length>0))==null?void 0:f.trim())??"";if(u)return{model:u,reasoningEffort:e==="plan"?mc(n??(o==null?void 0:o.reasoningEffort)):vc(n??(o==null?void 0:o.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function wc(e,t,n=[],r,o,a,s=[],u){var f;try{const m=(r==null?void 0:r.trim())??"",h=[];for(const O of n){const ee=Wh(O.trim());ee&&h.push({label:gT(ee),path:ee,fsPath:ee})}const y=[...s,...h],C=y.filter((O,ee)=>y.findIndex(se=>se.fsPath===O.fsPath)===ee),F=[{type:"text",text:vT(t,C)}];for(const O of n){const ee=O.trim();if(!ee)continue;const se=Wh(ee);if(se){F.push({type:"localImage",path:se});continue}F.push({type:"image",url:ee,image_url:ee})}if(a)for(const O of a)F.push({type:"skill",name:O.name,path:O.path});const B=C.map(O=>({label:O.label,path:O.path,fsPath:O.fsPath})),oe={threadId:e,input:F};if(B.length>0&&(oe.attachments=B),m&&(oe.model=m),typeof o=="string"&&o.length>0&&(oe.effort=o),u){const O=await yT(u,m,o);oe.collaborationMode={mode:u,settings:{model:O.model,reasoning_effort:O.reasoningEffort,developer_instructions:null}}}const V=await Wt("turn/start",oe);return typeof((f=V==null?void 0:V.turn)==null?void 0:f.id)=="string"?V.turn.id.trim():""}catch(m){throw ia(m,`Failed to start turn for thread ${e}`,"turn/start")}}async function wT(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await Wt("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw ia(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function bT(e){const t=e==="fast"?"fast":"standard";await Wt("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 _T(){return await(await fetch("/codex-api/free-mode/status")).json()}async function Vh(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function Gh(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 Zs(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 kT(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",r=await fetch(n,{signal:AbortSignal.timeout(Ek)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data))return{ids:o.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,u)=>a.length>0&&u.indexOf(a)===s),exclusive:o.exclusive===!0}}catch{}return null}async function Sv(e={}){const t=e.includeProviderModels!==!1,n=t?await kT(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return(n==null?void 0:n.ids)??[];const r=await Wt("model/list",{}),o=[];for(const a of r.data){const s=a.id||a.model;!s||o.includes(s)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.includes(a)||o.push(a);return o}async function xv(){const e=await Wt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=Mk(e.config.model_reasoning_effort),o=$k(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function Av(e){const t=ot(e);if(!t)return null;const n=de(t.id),r=de(t.name);return!n||!r?null:{id:n,name:r,description:de(t.description)??"",installUrl:de(t.installUrl??t.install_url)??"",needsAuth:Co(t.needsAuth??t.needs_auth)??!1}}function TT(e){const t=ot(e);if(!t)return null;const n=de(t.name),r=de(t.path);if(!n||!r)return null;const o=ot(t.interface);return{name:n,path:r,description:de(t.description)??"",enabled:Co(t.enabled)??!0,displayName:de((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??n,shortDescription:de(t.shortDescription??t.short_description)??""}}function Ev(e,t={}){const n=ot(e);if(!n)return null;const r=de(n.id),o=de(n.name);if(!r||!o)return null;const a=ot(n.interface),s=ot(n.source),u=de(s==null?void 0:s.type)??"",f=de(s==null?void 0:s.path),m=de(s==null?void 0:s.url)??"",h=u==="remote"?t.name??null:null,y=t.path??(u==="local"?f:null),C=de((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,I=de((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),F=de((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,displayName:C,description:I??F,longDescription:F,developerName:de((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:de(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:y,remoteMarketplaceName:h,sourceType:u,sourceUrl:m,installed:Co(n.installed)??!1,enabled:Co(n.enabled)??!0,installPolicy:de(n.installPolicy??n.install_policy)??"",authPolicy:de(n.authPolicy??n.auth_policy)??"",logoUrl:de((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:de(a==null?void 0:a.logo)??"",composerIconUrl:de((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:de((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:de((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:ii(a==null?void 0:a.capabilities),defaultPrompt:ii((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:ii((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:ii(a==null?void 0:a.screenshots),websiteUrl:de((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:de((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:de((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function CT(e,t=0){const n=ot(e);if(!n)return null;const r=de(n.id),o=de(n.name);if(!r||!o)return null;const a=ot(n.branding),s=ot(n.appMetadata??n.app_metadata);return{id:r,name:o,description:de(n.description)??de((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:de(n.logoUrl??n.logo_url)??"",logoUrlDark:de(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:de(n.distributionChannel??n.distribution_channel)??"",installUrl:de(n.installUrl??n.install_url)??"",isAccessible:Co(n.isAccessible??n.is_accessible)??!1,isEnabled:Co(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:ii(n.pluginDisplayNames??n.plugin_display_names),category:de(a==null?void 0:a.category)??"",developer:de(a==null?void 0:a.developer)??de(s==null?void 0:s.developer)??"",website:de(a==null?void 0:a.website)??"",privacyPolicy:de((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:de((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function ST(e){const t=ot(e);if(!t)return null;const n=de(t.name);if(!n)return null;const r=ot(t.tools)??{},o=Object.entries(r).map(([f,m])=>{const h=ot(m);return{name:de(h==null?void 0:h.name)??f,title:de(h==null?void 0:h.title)??"",description:de(h==null?void 0:h.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(f=>{const m=ot(f);return{name:de(m==null?void 0:m.name)??"",title:de(m==null?void 0:m.title)??"",uri:de(m==null?void 0:m.uri)??"",description:de(m==null?void 0:m.description)??""}}).filter(f=>f.name||f.uri):[],s=t.resourceTemplates??t.resource_templates,u=Array.isArray(s)?s.map(f=>{const m=ot(f);return{name:de(m==null?void 0:m.name)??"",title:de(m==null?void 0:m.title)??"",uriTemplate:de((m==null?void 0:m.uriTemplate)??(m==null?void 0:m.uri_template))??"",description:de(m==null?void 0:m.description)??""}}).filter(f=>f.name||f.uriTemplate):[];return{name:n,authStatus:de(t.authStatus??t.auth_status)??"unsupported",tools:o,resources:a,resourceTemplates:u}}async function rO(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await Wt("plugin/list",t),r=[];for(const o of n.marketplaces??[]){const a=ot(o);if(!a)continue;const s=ot(a.interface),u={name:de(a.name)??"",displayName:de((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:de(a.path)},f=Array.isArray(a.plugins)?a.plugins:[];for(const m of f){const h=Ev(m,u);h&&r.push(h)}}return r}async function oO(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await Wt("plugin/read",t),r=ot(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const o=Ev(r.summary,{name:de(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:de(r.marketplacePath)??e.marketplacePath})??e;return{summary:o,description:de(r.description)??o.longDescription,apps:Array.isArray(r.apps)?r.apps.map(Av).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(TT).filter(a=>a!==null):[],mcpServers:ii(r.mcpServers??r.mcp_servers)}}async function aO(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await Wt("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:de(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(Av).filter(o=>o!==null)}}async function sO(e){await Wt("plugin/uninstall",{pluginId:e})}async function iO(e,t){await Wt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function lO(e){const t=[];let n=null,r=0;do{const o={limit:100};n&&(o.cursor=n),e&&(o.threadId=e);const a=await Wt("app/list",o);for(const s of a.data??[]){const u=CT(s,r);u&&t.push(u),r+=1}n=de(a.nextCursor??a.next_cursor)}while(n);return t}async function uO(e,t){await Wt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function cO(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await Wt("mcpServerStatus/list",n);for(const o of r.data??[]){const a=ST(o);a&&e.push(a)}t=de(r.nextCursor??r.next_cursor)}while(t);return e}async function dO(){await Wt("config/mcpServer/reload",{})}async function fO(e){const t=await Wt("mcpServer/oauth/login",{name:e});return{authorizationUrl:de(t.authorizationUrl??t.authorization_url)??""}}async function hO(){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 pO(e="",t=null,n=50){const r=new URLSearchParams;e.trim()&&r.set("query",e.trim()),t&&r.set("cursor",t),n&&Number.isFinite(n)&&r.set("limit",String(Math.max(1,Math.floor(n))));const o=r.toString(),a=await fetch(`/codex-api/composio/connectors${o?`?${o}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function mO(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 vO(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 gO(){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 yO(){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 xT(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function AT(){try{const e=await Wt("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"||t.has(o)||(t.add(o),n.push({value:o,label:xT(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of Nh)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return Nh}function ET(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const u of a)typeof u=="string"&&u.length>0&&!s.includes(u)&&s.push(u);return s},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const u=typeof a=="string"?ut(a):"";u.length>0&&typeof s=="string"&&(o[u]=s)}return{order:n(t.order).map(a=>ut(a)),labels:o,active:n(t.active).map(a=>ut(a)),projectOrder:n(t.projectOrder).map(a=>ut(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,u=typeof s.id=="string"?s.id.trim():"";return u?[{id:u,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?ut(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}function PT(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const r=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],o=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const u=s,f=typeof u.name=="string"?u.name.trim():"",m=typeof u.path=="string"?u.path.trim():"";return f&&m?[{name:f,path:m}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const u=s,f=typeof u.label=="string"?u.label.trim():"",m=typeof u.path=="string"?u.path.trim():"",h=typeof u.fsPath=="string"?u.fsPath.trim():"";return f&&m&&h?[{label:f,path:m,fsPath:h}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:o,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function Pv(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();if(!o||!Array.isArray(r))continue;const a=r.flatMap(s=>{const u=PT(s);return u?[u]:[]});a.length>0&&(t[o]=a)}return t}async function ai(){return sl?Qc(sl):(Hl||(Hl=IT().then(e=>(sl=e,e)).finally(()=>{Hl=null})),Qc(await Hl))}async function IT(){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 ET(n.data)}function Qc(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 $d(){sl=null}async function Kh(){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 Pv(n.data)}async function RT(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Pv(e))})).ok)throw new Error("Failed to save thread queue state")}async function MT(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:ut(o.data.cwd),gitRoot:ut(o.data.gitRoot)}}async function $T(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:ut(r.data.cwd),gitRoot:ut(r.data.gitRoot)}}async function jT(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load branches");const a=Array.isArray(o.data)?o.data:[],s=[],u=new Set;for(const f of a){if(!f||typeof f!="object"||Array.isArray(f))continue;const m=f,h=typeof m.value=="string"?m.value.trim():"",y=typeof m.label=="string"?m.label.trim():"";!h||u.has(h)||(u.add(h),s.push({value:h,label:y||h}))}return s}async function LT(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load Git branch state");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=a.currentBranch,u=typeof s=="string"&&s.trim()?s.trim():null,f=Array.isArray(a.options)?a.options:[],m=[],h=new Set;for(const B of f){if(!B||typeof B!="object"||Array.isArray(B))continue;const oe=B,V=typeof oe.value=="string"?oe.value.trim():"",O=typeof oe.label=="string"?oe.label.trim():"";!V||h.has(V)||(h.add(V),m.push({value:V,label:O||V,isCurrent:oe.isCurrent===!0,isRemote:oe.isRemote===!0}))}u&&!h.has(u)&&m.unshift({value:u,label:u,isCurrent:!0});const y=a.headSha,C=a.headSubject,I=a.headDate,F=a.gitRoot;return{currentBranch:u,headSha:typeof y=="string"&&y.trim()?y.trim():null,headSubject:typeof C=="string"&&C.trim()?C.trim():null,headDate:typeof I=="string"&&I.trim()?I.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof F=="string"?ut(F):"",options:m}}async function NT(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?ut(a.gitRoot):""}}async function OT(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to switch branch");const o=(a=r.data)==null?void 0:a.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function DT(e,t,n={}){const r=e.trim(),o=t.trim();if(!r||!o)return[];const a=new URLSearchParams({cwd:r,branch:o,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),s=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),u=await s.json();if(!s.ok)throw new Error(u.error||"Failed to load branch commits");return(Array.isArray(u.data)?u.data:[]).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const h=m,y=typeof h.sha=="string"?h.sha.trim():"",C=typeof h.shortSha=="string"?h.shortSha.trim():"",I=typeof h.subject=="string"?h.subject.trim():"",F=typeof h.date=="string"?h.date.trim():"";return!y||!C?[]:[{sha:y,shortSha:C,subject:I||C,date:F}]})}async function FT(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const o=new URLSearchParams({cwd:n,sha:r}),a=await fetch(`/codex-api/git/commit-files?${o.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load commit files");return(Array.isArray(s.data)?s.data:[]).flatMap(f=>{if(!f||typeof f!="object"||Array.isArray(f))return[];const m=f,h=typeof m.path=="string"?m.path:"",y=typeof m.previousPath=="string"&&m.previousPath.length>0?m.previousPath:null,C=typeof m.status=="string"?m.status.trim():"",I=typeof m.label=="string"?m.label.trim():"",F=typeof m.addedLineCount=="number"&&Number.isFinite(m.addedLineCount)?m.addedLineCount:null,B=typeof m.removedLineCount=="number"&&Number.isFinite(m.removedLineCount)?m.removedLineCount:null;return!h||!C?[]:[{path:h,previousPath:y,status:C,label:I||C,addedLineCount:F,removedLineCount:B}]})}async function UT(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?ut(a.gitRoot):"",options:[]}}async function wO(e,t,n,r,o){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim()),o&&o.trim()&&a.set("commitSha",o.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),u=await s.json();if(!s.ok)throw new Error(bn(u,"Failed to load review snapshot"));return Tv(u)}async function BT(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),r=await fetch(`/codex-api/review/summary?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(bn(o,"Failed to load review summary"));return Vk(o)}async function bO(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(bn(n,"Failed to apply review action"));return Tv(n)}async function _O(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(bn(n,"Failed to initialize Git"))}async function Yh(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function qT(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const r=await fetch(`/codex-local-directories?${n.toString()}`),o=await Tl(r);if(!r.ok){const f=bn(o,"Failed to load local directories");throw new Error(f)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},u=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?ut(s.path):"",parentPath:typeof s.parentPath=="string"?ut(s.parentPath):"",entries:u.flatMap(f=>{if(!f||typeof f!="object"||Array.isArray(f))return[];const m=f,h=typeof m.name=="string"?m.name.trim():"",y=typeof m.path=="string"?ut(m.path):"";return h&&y?[{name:h,path:y}]:[]})}}async function Tl(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 bc(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");sl=Qc(e)}async function zl(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const u=bn(r,"Failed to open project root");throw new Error(u)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?ut(a.path):"";return $d(),s}function HT(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function zT(e,t){var a;const n=e.headers.get("content-disposition")??"",r=n.match(/filename\*=UTF-8''([^;]+)/iu);if(r!=null&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}const o=n.match(/filename="?([^";]+)"?/iu);return((a=o==null?void 0:o[1])==null?void 0:a.trim())||t}async function WT(e,t){var h;const n=await fetch(HT(e));if(!n.ok){const y=await n.json().catch(()=>null),C="Failed to export project",I=bn(y,C),F=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),B=I!==C?I:F?`Failed to export project: ${F}`:C;throw new Error(B)}const r=Number(n.headers.get("content-length")??""),o=Number.isFinite(r)&&r>0?r:null,a=zT(n,"project.zip"),s=(h=n.body)==null?void 0:h.getReader();if(!s){const y=await n.blob();return t==null||t({loaded:y.size,total:y.size||o}),{blob:y,fileName:a}}const u=[];let f=0;for(t==null||t({loaded:f,total:o});;){const{done:y,value:C}=await s.read();if(y)break;C&&(u.push(new Uint8Array(C)),f+=C.byteLength,t==null||t({loaded:f,total:o}))}const m=u.map(y=>{const C=new Uint8Array(y.byteLength);return C.set(y),C.buffer});return{blob:new Blob(m,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function VT(e,t){const n=new URLSearchParams({parent:t}),r=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),o=await Tl(r);if(!r.ok){const f=bn(o,"Failed to import project");throw new Error(f)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},u=typeof s.path=="string"?ut(s.path):"";return u&&$d(),{path:u,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function GT(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Tl(t);if(!t.ok){const s=bn(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.path=="string"?ut(o.path):"";return a&&$d(),a}async function KT(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),r=await Tl(n);if(!n.ok){const s=bn(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?ut(a.path):""}async function YT(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 Tl(t);if(!t.ok){const s=bn(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.cwd=="string"?ut(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?ut(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?ut(o.workspaceRoot):""}}async function JT(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const s=bn(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?ut(a.path):""}}async function QT(e,t,n=20){const r=e.trim();if(!r)return[];const o=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),a=await o.json();if(!o.ok){const m=bn(a,"Failed to search files");throw new Error(m)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},u=Array.isArray(s.data)?s.data:[],f=[];for(const m of u){if(!m||typeof m!="object"||Array.isArray(m))continue;const y=m.path,C=typeof y=="string"?y.trim():"";C&&f.push({path:C})}return f}async function XT(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}async function ZT(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),r=await n.json();if(!n.ok){const o=bn(r,"Failed to connect Telegram bot");throw new Error(o)}}async function eC(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=bn(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],a=[];for(const s of o){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:a}}async function tC(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=bn(t,"Failed to load Telegram status");throw new Error(o)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}function bn(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const o=n.error;return typeof o=="string"&&o.trim().length>0?o:t}async function nC(){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 _c(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 rC(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function oC(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function aC(){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 sC(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 iC(e,t){var n;try{return((n=(await Wt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function Xc(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function lC(e,t){const n=Xc(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const o=r.lastIndexOf("skills");if(o>=2){const f=r[o-2]??"";if(f){const m=`/${[...r.slice(0,o+1),f,"SKILL.md"].join("/")}`;if(t.has(m))return{rootPath:m,rootName:f,isNested:m!==n}}}const a=r.indexOf("skills");if(a<0||a+1>=r.length-1)return null;const s=r[a+1]??"";if(!s)return null;const u=`/${[...r.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(u)?{rootPath:u,rootName:s,isNested:u!==n}:{rootPath:u,rootName:s,isNested:u!==n}}async function uC(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await Wt("skills/list",t),r=n.data.flatMap(s=>s.skills),o=new Set(r.map(s=>Xc(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const u of s.skills){if(!u.name)continue;const f=lC(u.path,o),m=Xc(u.path),y=!!(f!=null&&f.isNested&&o.has(f.rootPath))?f.rootPath:m,C=m===y,I=a.get(y),F={name:u.name,displayName:f&&y===f.rootPath?f.rootName:void 0,description:u.shortDescription||u.description||"",path:y,scope:u.scope,enabled:u.enabled,__hasRoot:C};if(!I){a.set(y,F);continue}if(I.enabled=I.enabled||u.enabled,!I.__hasRoot&&C){a.set(y,F);continue}!I.displayName&&F.displayName&&(I.displayName=F.displayName),!I.description&&F.description&&(I.description=F.description)}return Array.from(a.values()).map(({__hasRoot:s,...u})=>u)}catch{return[]}}async function cC(){try{const e=await fetch("/codex-api/prompts");if(!e.ok)return[];const t=await e.json();return Array.isArray(t.data)?t.data:[]}catch{return[]}}async function dC(e,t){try{const n=await fetch("/codex-api/prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,content:t})});return n.ok?(await n.json()).data??null:null}catch{return null}}async function fC(e){try{const t=new URLSearchParams({path:e});return(await fetch(`/codex-api/prompts?${t.toString()}`,{method:"DELETE"})).ok}catch{return!1}}const hC=6e4;async function kc(e){const t=new AbortController,n=setTimeout(()=>t.abort(),hC);try{const r=new FormData;r.append("file",e);const o=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return o.ok?(await o.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}const pC={},mC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vC(e,t){return S(),A("svg",mC,[...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 Ms=At(pC,[["render",vC]]),gC={},yC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wC(e,t){return S(),A("svg",yC,[...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 Wl=At(gC,[["render",wC]]),bC={},_C={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function kC(e,t){return S(),A("svg",_C,[...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 ei=At(bC,[["render",kC]]),TC={},CC={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function SC(e,t){return S(),A("svg",CC,[...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 Ci=At(TC,[["render",SC]]),xC={},AC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function EC(e,t){return S(),A("svg",AC,[...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 jd=At(xC,[["render",EC]]),PC={},IC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function RC(e,t){return S(),A("svg",IC,[...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 MC=At(PC,[["render",RC]]),$C={},jC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function LC(e,t){return S(),A("svg",jC,[...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 li=At($C,[["render",LC]]),NC={},OC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function DC(e,t){return S(),A("svg",OC,[...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 Xo=At(NC,[["render",DC]]),FC={},UC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function BC(e,t){return S(),A("svg",UC,[...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 Vl=At(FC,[["render",BC]]),Iv="codex-web-local.ui-language.v1",qC={English:"English","Simplified Chinese":"简体中文","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:"设置","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:"停止","Queue message":"加入队列","Send message":"发送消息",Send:"发送","Drop images or files":"拖放图片或文件","Selected image":"已选图片","Loading messages...":"加载消息中...",Plan:"计划",Updating:"更新中","Edit this message":"编辑此消息","Edit message":"编辑消息","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:"跳过",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:"动作","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...":"正在为规划模式加载模型...","Type a message... (@ for files)":"输入消息...(@ 选择文件)",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:"编辑",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":"超宽"},Jh={en:"English","zh-CN":"简体中文"};function HC(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Iv))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Lu=x(HC());function Rv(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Rv(Lu.value);function zC(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function WC(e){Lu.value=e,Rv(e),typeof window<"u"&&window.localStorage.setItem(Iv,e)}function Mv(e,t){const n=Lu.value==="zh-CN"?qC[e]??e:e;return zC(n,t)}function fs(){return{uiLanguage:Lu,uiLanguageOptions:[{value:"en",label:Jh.en},{value:"zh-CN",label:Jh["zh-CN"]}],t:Mv,setUiLanguage:WC}}const $v="brutalstrikedevs@gmail.com",VC=20,GC=6500,Qh=1800,Tc=12,Xh=240,Zh=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,gi=x([]);let ep=!1,Cc=!1,Sc=null;function Xi(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 KC(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function YC(e,t){var r;const n=(r=t==null?void 0:t.method)==null?void 0:r.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function jv(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function tp(e){return encodeURIComponent(e)}function JC(){return`mailto:${$v}`}function QC(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
|
|
45
|
+
`).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
|
|
46
|
+
|
|
47
|
+
`).trim())??"";return e?e.length>Qh?`${e.slice(0,Qh)}
|
|
48
|
+
...[truncated]`:e:"No visible page text captured."}function XC(e,t){const n=t.replace(/\r\n/g,`
|
|
49
|
+
`).replace(/[ \t]+/g," ").trim();return n?Zh.test(e)||Zh.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Xh?`${n.slice(0,Xh)}...[truncated, ${n.length} chars total]`:n:""}function np(e,t){if(!e)return`${t}: unavailable`;try{const n=[],r=Math.min(e.length,Tc);for(let a=0;a<r;a+=1){const s=e.key(a);s&&n.push(`${s}=${XC(s,e.getItem(s)??"")}`)}const o=e.length>Tc?`
|
|
50
|
+
...${e.length-Tc} more item(s)`:"";return`${t}:
|
|
51
|
+
${n.join(`
|
|
52
|
+
`)||"empty"}${o}`}catch(n){return`${t}: unavailable (${jv(Xi(n))})`}}function ZC(){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}`,np(window.localStorage,"localStorage"),np(window.sessionStorage,"sessionStorage")].join(`
|
|
53
|
+
`)}function As(e){const t=e.message.trim();if(!t)return;const n=gi.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const r={...e,message:t,atIso:e.atIso??new Date().toISOString()};gi.value=[r,...gi.value].slice(0,VC)}function Lv(e=gi.value){var m;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,r=typeof navigator>"u"?"unknown":navigator.userAgent,o="1.0.0",a="codex-mobile",s=e.slice(0,12).map((h,y)=>[`${y+1}. [${h.atIso}] ${h.kind}`,h.method?`${h.method}`:"",h.url??"",typeof h.status=="number"?`${h.status} ${h.statusText??""}`.trim():"",h.message].filter(Boolean).join(" | ")).join(`
|
|
54
|
+
`),u=["What happened?","","","Context",`URL: ${n}`,`User agent: ${r}`,`Viewport: ${t}`,`App version: ${o}`,`Worktree: ${a}`,"","Browser/app state",ZC(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",QC()].join(`
|
|
55
|
+
`).slice(0,GC),f=`Codex Web feedback: ${jv((m=e[0])==null?void 0:m.message)}`;return`mailto:${$v}?subject=${tp(f)}&body=${tp(u)}`}function e1(){typeof window>"u"||(window.location.href=Lv())}function t1(){if(!(typeof window>"u")&&(ep||(ep=!0,window.addEventListener("error",e=>{As({kind:"window-error",message:e.error?Xi(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{As({kind:"unhandled-rejection",message:Xi(e.reason),url:window.location.href})})),!Cc)){if(typeof window.fetch!="function"){As({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{Sc=window.fetch.bind(window),window.fetch=(async(e,t)=>{const n=KC(e),r=YC(e,t);try{const o=await Sc(e,t);return o.ok||As({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${o.status}`,url:n,method:r,status:o.status,statusText:o.statusText}),o}catch(o){throw As({kind:"fetch-error",message:Xi(o),url:n,method:r}),o}}),Cc=!0}catch(e){Sc=null,Cc=!1;try{As({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${Xi(e)}`,url:window.location.href})}catch{}}}}function Ld(){const e=Q(()=>gi.value.length>0);function t(n,r){As({kind:"visible-error",message:n,url:r||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:gi,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:e1,buildFeedbackMailto:Lv,feedbackMailtoBase:JC}}const n1=["title","aria-label","disabled"],r1={key:1,class:"composer-dropdown-value"},o1={key:0,class:"composer-dropdown-search-wrap"},a1=["placeholder","onKeydown"],s1={class:"composer-dropdown-options",role:"listbox"},i1=["onClick"],l1={key:0,class:"composer-dropdown-empty"},u1=er({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},menuAlign:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,o=x(null),a=x(null),s=x(null),u=x(null),f=x(!1),m=x(""),h=x({});let y=!1;const C=Q(()=>{var Se;const fe=n.options.find(De=>De.value===n.modelValue);return fe?fe.label:((Se=n.placeholder)==null?void 0:Se.trim())||""}),I=Q(()=>n.openDirection??"down"),F=Q(()=>n.menuAlign??"start"),B=Q(()=>n.iconOnly===!0),oe=Q(()=>n.enableSearch===!0),V=Q(()=>{var fe;return((fe=n.searchPlaceholder)==null?void 0:fe.trim())||"Quick search projects"}),O=Q(()=>{var fe;return((fe=n.emptyLabel)==null?void 0:fe.trim())||"No results"}),ee=Q(()=>{var fe;return C.value||((fe=n.placeholder)==null?void 0:fe.trim())||"Select option"}),se=Q(()=>{const fe=m.value.trim().toLowerCase();return fe?n.options.filter(Se=>Se.label.toLowerCase().includes(fe)||Se.value.toLowerCase().includes(fe)):n.options});function Te(){n.disabled||(f.value=!f.value)}function Fe(fe,Se,De){return Math.min(De,Math.max(Se,fe))}function ae(){var te,pe,ve,ke;if(!f.value)return;const fe=o.value;if(!fe||typeof window>"u")return;const Se=fe.getBoundingClientRect(),De=window.innerWidth,Ee=window.innerHeight,Re=8,Ie=8,Qe=Math.max(0,De-Re*2),et=((te=s.value)==null?void 0:te.offsetWidth)??((pe=a.value)==null?void 0:pe.offsetWidth)??224,Me=((ve=s.value)==null?void 0:ve.offsetHeight)??((ke=a.value)==null?void 0:ke.offsetHeight)??0,We=Math.min(et,Qe),it=Math.max(Re,De-We-Re),ct=F.value==="end"?Se.right-We:Se.left,at=Fe(ct,Re,it);let Je=I.value==="up"?Se.top-Me-Ie:Se.bottom+Ie;Me>0&&Je+Me>Ee-Re&&(Je=Ee-Me-Re),Je=Math.max(Re,Je),h.value={position:"fixed",left:`${at}px`,right:"auto",top:`${Je}px`,bottom:"auto",width:`${We}px`}}function xe(){y||typeof window>"u"||(window.addEventListener("resize",ae),window.addEventListener("scroll",ae,!0),y=!0)}function le(){!y||typeof window>"u"||(window.removeEventListener("resize",ae),window.removeEventListener("scroll",ae,!0),y=!1)}function be(fe){r("update:modelValue",fe),f.value=!1,m.value=""}function Ue(){if(m.value.length>0){m.value="";return}f.value=!1}function ce(fe){if(!f.value)return;const Se=o.value;if(!Se)return;const De=fe.target;De instanceof Node&&(Se.contains(De)||(f.value=!1,m.value=""))}return ft(f,fe=>{if(!fe){le(),h.value={};return}xe(),zt(()=>{var Se;ae(),window.requestAnimationFrame(ae),oe.value&&((Se=u.value)==null||Se.focus())})}),Ga(()=>{window.addEventListener("pointerdown",ce)}),ds(()=>{window.removeEventListener("pointerdown",ce),le()}),(fe,Se)=>(S(),A("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[p("button",{class:"composer-dropdown-trigger",type:"button",title:ee.value,"aria-label":ee.value,disabled:e.disabled,onClick:Te},[e.selectedPrefixIcon?(S(),rt(wd(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):Z("",!0),B.value?Z("",!0):(S(),A("span",r1,E(C.value),1)),je(Ms,{class:"composer-dropdown-chevron"})],8,n1),f.value?(S(),A("div",{key:0,ref_key:"menuWrapRef",ref:a,class:Ze(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":I.value==="up","composer-dropdown-menu-wrap-down":I.value==="down"}]),style:ea(h.value)},[p("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[oe.value?(S(),A("div",o1,[Yt(p("input",{ref_key:"searchInputRef",ref:u,"onUpdate:modelValue":Se[0]||(Se[0]=De=>m.value=De),class:"composer-dropdown-search-input",type:"text",placeholder:V.value,onKeydown:tn(Ye(Ue,["prevent"]),["esc"])},null,40,a1),[[on,m.value]])])):Z("",!0),p("ul",s1,[(S(!0),A(tt,null,an(se.value,De=>(S(),A("li",{key:De.value},[p("button",{class:Ze(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:Ee=>be(De.value)},E(De.label),11,i1)]))),128)),se.value.length===0?(S(),A("li",l1,E(O.value),1)):Z("",!0)])],512)],6)):Z("",!0)],512))}}),Ur=At(u1,[["__scopeId","data-v-58bfb8ac"]]),c1={key:0,class:"sidebar-menu-row-left"},d1={class:"sidebar-menu-row-main"},f1={key:1,class:"sidebar-menu-row-right"},h1={key:0,class:"sidebar-menu-row-right-default"},p1={key:1,class:"sidebar-menu-row-right-hover"},m1=er({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=vb(),r=Q(()=>!!n.left),o=Q(()=>!!n.right),a=Q(()=>!!n["right-hover"]),s=Q(()=>o.value||a.value);return(u,f)=>(S(),rt(wd(t.as),Gm({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},u.$attrs),{default:yt(()=>[r.value?(S(),A("span",c1,[Sa(u.$slots,"left",{},void 0,!0)])):Z("",!0),p("span",d1,[Sa(u.$slots,"default",{},void 0,!0)]),s.value?(S(),A("span",f1,[o.value?(S(),A("span",h1,[Sa(u.$slots,"right",{},void 0,!0)])):Z("",!0),a.value?(S(),A("span",p1,[Sa(u.$slots,"right-hover",{},void 0,!0)])):Z("",!0)])):Z("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Yo=At(m1,[["__scopeId","data-v-5fc666fb"]]);function v1(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}const g1={key:0,class:"pinned-section"},y1={class:"thread-tree-header"},w1={key:0,class:"thread-list"},b1=["data-menu-open"],_1={class:"thread-left-stack"},k1=["data-state"],T1=["data-confirming","title","onClick"],C1={key:0,class:"thread-delete-confirm-label"},S1=["onClick"],x1={class:"thread-row-title-wrap"},A1={class:"thread-row-title-line"},E1={class:"thread-row-title"},P1=["title"],I1={key:0,class:"thread-row-automation-count"},R1=["data-state"],M1={class:"thread-row-time"},$1=["onClick"],j1={class:"projects-section"},L1={class:"thread-tree-header"},N1=["aria-expanded","aria-label","title"],O1={class:"organize-menu-title"},D1=["data-active"],F1={key:0},U1=["data-active"],B1={key:0},q1=["data-active"],H1={key:0},z1={class:"organize-menu-title"},W1=["data-active"],V1={key:0},G1=["data-active"],K1={key:0},Y1={key:0,class:"thread-tree-action-error"},J1={key:1,class:"thread-tree-no-results"},Q1={key:2,class:"thread-tree-loading"},X1={key:3,class:"thread-list thread-list-global"},Z1=["data-menu-open"],eS={class:"thread-left-stack"},tS=["data-state"],nS=["data-confirming","title","onClick"],rS={key:0,class:"thread-delete-confirm-label"},oS=["onClick"],aS={class:"thread-row-title-wrap"},sS={class:"thread-row-title-line"},iS={class:"thread-row-title"},lS=["title"],uS={key:0,class:"thread-row-automation-count"},cS=["data-state"],dS={class:"thread-row-time"},fS=["onClick"],hS=["data-project-name","data-expanded","data-dragging"],pS={class:"project-icon-stack"},mS={class:"project-icon-folder"},vS={class:"project-icon-chevron"},gS=["data-dragging-handle","onMousedown"],yS=["title"],wS=["title"],bS={key:0,class:"thread-row-automation-count"},_S={class:"project-hover-controls"},kS=["onClick"],TS=["data-open-direction"],CS=["onClick"],SS=["onClick"],xS=["onClick"],AS=["onClick"],ES=["onClick"],PS=["onClick"],IS={class:"project-menu-label"},RS=["onInput"],MS=["aria-label","title","onClick"],$S={key:0,class:"thread-list"},jS=["data-menu-open"],LS={class:"thread-left-stack"},NS=["data-state"],OS=["data-confirming","title","onClick"],DS={key:0,class:"thread-delete-confirm-label"},FS=["onClick"],US={class:"thread-row-title-wrap"},BS={class:"thread-row-title-line"},qS={class:"thread-row-title"},HS=["title"],zS={key:0,class:"thread-row-automation-count"},WS=["data-state"],VS={class:"thread-row-time"},GS=["onClick"],KS={class:"project-empty"},YS=["onClick"],JS={class:"chats-section"},QS={class:"thread-tree-header"},XS={class:"chats-section-actions"},ZS=["aria-label","title"],ex={key:0,class:"thread-tree-no-results"},tx={key:1,class:"thread-list thread-list-global"},nx=["data-menu-open"],rx={class:"thread-left-stack"},ox=["data-state"],ax=["data-confirming","title","onClick"],sx={key:0,class:"thread-delete-confirm-label"},ix=["onClick"],lx={class:"thread-row-title-wrap"},ux={class:"thread-row-title-line"},cx={class:"thread-row-title"},dx=["title"],fx={key:0,class:"thread-row-automation-count"},hx=["data-state"],px={class:"thread-row-time"},mx=["onClick"],vx=["data-open-direction"],gx=["disabled","title"],yx={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},wx={class:"rename-thread-title"},bx=["onKeydown"],_x={class:"rename-thread-actions"},kx={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},Tx={class:"rename-thread-title"},Cx={class:"rename-thread-subtitle"},Sx={class:"rename-thread-actions"},xx=["aria-label"],Ax={class:"rename-thread-title"},Ex={class:"rename-thread-subtitle"},Px={key:0,class:"automation-target-picker"},Ix={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},Rx={class:"automation-target-dropdown"},Mx=["aria-label"],$x=["onClick"],jx={class:"automation-thread-field"},Lx={class:"automation-thread-field"},Nx={class:"automation-thread-field"},Ox={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},Dx={key:0,class:"automation-schedule-row"},Fx={key:1,class:"automation-schedule-row"},Ux={class:"automation-schedule-preview"},Bx={class:"automation-thread-field"},qx={key:2,class:"rename-thread-subtitle automation-thread-error"},Hx={key:3,class:"rename-thread-subtitle automation-thread-notice"},zx={class:"rename-thread-actions"},Wx=["disabled"],Vx=["disabled"],Gx=["disabled"],Kx=["disabled"],Yx=4,rp=6,op="codex-web-local.sidebar-section-expansion.v1",ap="codex-web-local.sidebar-chats-first.v1",sp="codex-web-local.sidebar-chat-sort-mode.v1",ip="codex-web-local.thread-view-mode.v1",lp="codex-web-local.collapsed-projects.v1",Jx=er({__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"],setup(e,{expose:t,emit:n}){const r=e,{t:o}=fs(),{recordVisibleFailure:a}=Ld(),s=n,u=x({}),f=x({}),m=x(!0),h=x(!0),y=x(!0),C=x(!1),I=x(la(ap,!1)),F=x(to());let B=!1;const oe=x([]),V=x({}),O=x(""),ee=x([]),se=x(""),Te=x(""),Fe=x({}),ae=x({}),xe=x({}),le=x("actions"),be=x(""),Ue=x(!1),ce=x(""),fe=x(""),Se=x(null),De=x(!1),Ee=x(""),Re=x(""),Ie=x({}),Qe=x({}),et=x(!1),Me=x("thread"),We=x(""),it=x(""),ct=x(""),at=x("create"),Je=x(!1),te=x("thread"),pe=x(""),ve=x(""),ke=x(""),Xe=x(""),P=x(!1),L=x(!1),W=x({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),D=x({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),J=Q(()=>{if(Me.value==="project"){const b=it.value;return b?Qe.value[b]??[]:[]}const v=We.value;return v?Ie.value[v]??[]:[]}),U=Q(()=>mr(W.value.rrule)),ge=Q(()=>Je.value&&at.value==="create"?te.value==="thread"?"This creates a heartbeat automation attached to the selected chat.":"This creates a project automation attached to the selected project folder.":Me.value==="project"?"This creates project automations attached to the selected project folder.":"This creates heartbeat automations attached to the selected thread."),we=Q(()=>{var b;const v=[];for(const w of r.groups)for(const M of w.threads){const ye=((b=M.title)==null?void 0:b.trim())||M.id,st=Ce(w.projectName);v.push({value:M.id,label:`${ye} · ${st}`,searchText:`${ye} ${st} ${M.id}`.toLowerCase()})}return v}),_e=Q(()=>{const v=[];for(const b of r.groups){const w=fo(b.projectName);if(!w)continue;const M=Ce(b.projectName);v.push({value:w,label:M,searchText:`${M} ${w}`.toLowerCase()})}return v}),X=Q(()=>(te.value==="project"?_e.value:we.value).map(b=>({value:b.value,label:b.label}))),qe=[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}],Pe=Q(()=>[{value:"ACTIVE",label:o("Active")},{value:"PAUSED",label:o("Paused")}]);ft(X,v=>{var b;Je.value&&(v.some(w=>w.value===pe.value)||(pe.value=((b=v[0])==null?void 0:b.value)??""))});const He=x(null),ze=x(null),nt=x(null);let pt=null,Ve=null;const wt=x(""),kt=x({}),H=new Map,G=new Map,K=new Map,he=new WeakMap,Ae=x(null),Ne=x(null),Be=x(!1),Ct=x(Mt()),Oe=typeof window<"u"?new ResizeObserver(v=>{for(const b of v){const w=b.target,M=he.get(w);M&&On(M,w)}}):null;function Jt(){if(typeof window>"u")return{};try{const v=window.localStorage.getItem(lp);if(!v)return{};const b=JSON.parse(v);return!b||typeof b!="object"||Array.isArray(b)?{}:b}catch{return{}}}function Mt(){return typeof window>"u"?"project":window.localStorage.getItem(ip)==="chronological"?"chronological":"project"}function la(v,b){if(typeof window>"u")return b;const w=window.localStorage.getItem(v);return w==="true"?!0:w==="false"?!1:b}function to(){return typeof window>"u"?"updated":window.localStorage.getItem(sp)==="created"?"created":"updated"}f.value=Jt();function fr(){if(!(typeof window>"u"))try{const v=JSON.parse(window.localStorage.getItem(op)||"{}");typeof v.pinned=="boolean"&&(m.value=v.pinned),typeof v.projects=="boolean"&&(h.value=v.projects),typeof v.chats=="boolean"&&(y.value=v.chats)}catch{}}function Ar(){typeof window>"u"||window.localStorage.setItem(op,JSON.stringify({pinned:m.value,projects:h.value,chats:y.value}))}fr(),ft(f,v=>{typeof window>"u"||window.localStorage.setItem(lp,JSON.stringify(v))},{deep:!0}),ft(Ct,v=>{typeof window>"u"||window.localStorage.setItem(ip,v)}),ft(I,v=>{typeof window>"u"||window.localStorage.setItem(ap,String(v))}),ft(F,v=>{typeof window>"u"||window.localStorage.setItem(sp,v)}),ft([m,h,y],Ar);const no=Q(()=>r.searchQuery.trim().toLowerCase()),Dt=Q(()=>no.value.length>0),Qt=Q(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),ro=Q(()=>new Set(oe.value)),Er=Q(()=>new Set(ee.value));function $n(v){if(Er.value.has(v.id))return!1;if(!Dt.value)return!0;if(Qt.value)return Qt.value.has(v.id);const b=no.value;return v.title.toLowerCase().includes(b)||v.preview.toLowerCase().includes(b)}const Br=Q(()=>r.groups.flatMap(v=>{const b=v.threads.filter(w=>!pu(w.cwd)&&$n(w));return b.length>0?[{...v,threads:b}]:!Dt.value&&v.threads.length===0?[{...v,threads:b}]:[]})),ua=Q(()=>Ct.value==="chronological"),tr=Q(()=>{const v=[];for(const b of r.groups)for(const w of b.threads)ro.value.has(w.id)||$n(w)&&v.push(w);return v.sort((b,w)=>{const M=new Date(b.updatedAtIso||b.createdAtIso).getTime();return new Date(w.updatedAtIso||w.createdAtIso).getTime()-M})}),hr=Q(()=>{const v=tr.value.filter(w=>pu(w.cwd)),b=F.value==="created"?"createdAtIso":"updatedAtIso";return v.sort((w,M)=>{const ye=new Date(w[b]||w.updatedAtIso||w.createdAtIso).getTime();return new Date(M[b]||M.updatedAtIso||M.createdAtIso).getTime()-ye})}),fn=Q(()=>Dt.value||C.value?hr.value:hr.value.slice(0,10)),xo=Q(()=>Dt.value?!1:hr.value.length>10),Dn=Q(()=>{const v=new Map;for(const b of r.groups)for(const w of b.threads)Er.value.has(w.id)||v.set(w.id,w);return v});ft(oe,v=>{B&&oC(v)}),ft([Dn,()=>r.isThreadListFullyLoaded],([v])=>{const b=v1(oe.value,new Set(v.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(b.length===oe.value.length)return;const w=new Set(b),M=Object.fromEntries(Object.entries(V.value).filter(([ye])=>w.has(ye)));V.value=M,oe.value=b});let Ao=0;async function Aa(){if(r.isLoading)return;const v=oe.value.filter(ye=>!Dn.value.has(ye)&&!V.value[ye]);if(v.length===0)return;const b=Ao+=1,w=await Promise.all(v.map(async ye=>{try{return await Bk(ye)}catch{return null}}));if(b!==Ao)return;const M={...V.value};for(const ye of w)ye&&(M[ye.id]=ye);V.value=M}ft([oe,Dn,()=>r.isLoading],()=>{B&&Aa()}),Ga(async()=>{const{threadIds:v}=await rC(),b=Array.isArray(v)?v.filter(w=>typeof w=="string").map(w=>w.trim()).filter((w,M,ye)=>w.length>0&&ye.indexOf(w)===M):[];b.length>0&&(oe.value=b);try{Ie.value=await Gk()}catch{Ie.value={}}try{await $r()}catch{Qe.value={}}B=!0,Aa()});const Eo=Q(()=>Ln(Ee.value)),ca=Q(()=>{const v=new Map;for(const b of r.groups)for(const w of b.threads)v.set(w.id,b.projectName);return v}),Po=Q(()=>{const v=new Map;for(const b of r.groups){const w=b.threads.filter(M=>!ro.value.has(M.id)&&!Er.value.has(M.id));v.set(b.projectName,w)}return v}),Ea=Q(()=>{const v=new Map;for(const b of r.groups)for(const w of b.threads){const M=new Date(w.updatedAtIso||w.createdAtIso).getTime();v.set(w.id,M)}return v}),sn=Q(()=>{const v=Te.value;return v?Dn.value.get(v)??null:null}),lt=Q(()=>oe.value.map(v=>Dn.value.get(v)??V.value[v]??null).filter(v=>v!==null).filter($n));function Fn(){m.value=!m.value}function _n(){h.value=!h.value}function da(){y.value=!y.value}const un=Q(()=>{const v=nt.value;if(!v||v.dropTargetIndexFull===null||r.groups.length===0)return null;const b=Math.max(0,Math.min(v.dropTargetIndexFull,r.groups.length)),w=b>v.fromIndex?b-1:b,M=Math.max(0,Math.min(w,r.groups.length-1));return M===v.fromIndex?null:M}),qr=Q(()=>{const b=(Dt.value?Br.value:r.groups).map(Gt=>Gt.projectName),w=nt.value,M=un.value;if(!w||M===null)return b;const ye=[...b],[st]=ye.splice(w.fromIndex,1);return st?(ye.splice(M,0,st),ye):b}),An=Q(()=>{const v={};let b=0;for(const w of qr.value)v[w]=b,b+=Cn(w);return v}),hn=Q(()=>{let v=0;for(const b of qr.value)v+=Cn(b);return{height:`${Math.max(0,v)}px`}});function gt(v){if(Number.isNaN(v))return"n/a";const b=Math.abs(Date.now()-v);if(b<6e4)return"now";const w=Math.floor(b/6e4);if(w<60)return`${w}m`;const M=Math.floor(w/60);return M<24?`${M}h`:`${Math.floor(M/24)}d`}function cn(v){const b=Ea.value.get(v.id);return gt(typeof b=="number"?b:new Date(v.updatedAtIso||v.createdAtIso).getTime())}function Lt(v){return ro.value.has(v)}function jn(v){if(Lt(v)){oe.value=oe.value.filter(b=>b!==v);return}oe.value=[v,...oe.value]}function Hr(v){jn(v),Pt()}function Un(v){O.value="",s("select",v)}function Ln(v){return kn(v)>0}function kn(v){var b;return((b=Ie.value[v])==null?void 0:b.length)??0}function pr(v){return Pr(v)>0}function Pr(v){var w;const b=fo(v);return b?((w=Qe.value[b])==null?void 0:w.length)??0:0}function Io(v){if(v.length===0)return"";if(v.length>1){const M=v.filter(ye=>ye.status==="ACTIVE").length;return`${v.length} automations • ${M} active`}const[b]=v,w=b.status==="PAUSED"?"-":b.nextRunAtMs?new Date(b.nextRunAtMs).toLocaleString():"Not scheduled";return`${b.name} • Next run: ${w}`}function Nn(v){return Io(Ie.value[v]??[])}function Ro(v){const b=fo(v);return Io(b?Qe.value[b]??[]:[])}function Bn(v){return String(Math.max(0,v)).padStart(2,"0")}function oo(v,b){const w=typeof v=="number"?v:Number(v);return Number.isFinite(w)?Math.max(1,Math.floor(w)):b}function Mo(v){const[b,w]=v.split(":"),M=Math.min(23,Math.max(0,Number(b)||0)),ye=Math.min(59,Math.max(0,Number(w)||0));return`FREQ=DAILY;BYHOUR=${M};BYMINUTE=${ye}`}function ao(v,b){const w=oo(v,1);return b==="minutes"?`FREQ=MINUTELY;INTERVAL=${w}`:b==="hours"?`FREQ=HOURLY;INTERVAL=${w}`:`FREQ=DAILY;INTERVAL=${w}`}function Ir(v){return Object.fromEntries(v.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[w,...M]=b.split("=");return[w.toUpperCase(),M.join("=").trim()]}).filter(([b,w])=>b&&w))}function zr(v){var ye;const b=Ir(v),w=(ye=b.FREQ)==null?void 0:ye.toUpperCase(),M=oo(b.INTERVAL,1);if(w==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&M===1){const st=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Gt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Bn(st)}:${Bn(Gt)}`,interval:1,intervalUnit:"hours"}}return w==="MINUTELY"||w==="HOURLY"||w==="DAILY"&&b.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:M,intervalUnit:w==="MINUTELY"?"minutes":w==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function mr(v){var ye;const b=Ir(v),w=(ye=b.FREQ)==null?void 0:ye.toUpperCase(),M=oo(b.INTERVAL,1);if(w==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&M===1){const st=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Gt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return`RRULE: ${v} · runs daily at ${Bn(st)}:${Bn(Gt)}`}return w==="MINUTELY"?`RRULE: ${v} · runs every ${M} minute${M===1?"":"s"}`:w==="HOURLY"?`RRULE: ${v} · runs every ${M} hour${M===1?"":"s"}`:w==="DAILY"&&b.INTERVAL!==void 0?`RRULE: ${v} · runs every ${M} day${M===1?"":"s"}`:v?`RRULE: ${v}`:"RRULE is required."}function vr(){const v=D.value;v.mode==="daily"?W.value.rrule=Mo(v.dailyTime):v.mode==="interval"&&(W.value.rrule=ao(v.interval,v.intervalUnit))}function $o(v){v!=="minutes"&&v!=="hours"&&v!=="days"||(D.value={...D.value,intervalUnit:v},vr())}function gr(v){v!=="ACTIVE"&&v!=="PAUSED"||(W.value={...W.value,status:v})}function Et(){D.value=zr(W.value.rrule)}function Sn(v){D.value={...D.value,mode:v},vr()}function Wr(v){v===r.selectedThreadId&&(s("copy-thread-chat",v),Pt())}function Vr(v){s("fork-thread",v),Pt()}function qn(v){return`start new thread ${Ce(v)}`}function Xt(v){s("start-new-thread",v)}function nr(v){s("browse-thread-files",v),Pt()}function so(v){s("save-thread-project",v),Pt()}async function Rr(v){var w,M;const b=((M=(w=Dn.value.get(v))==null?void 0:w.cwd)==null?void 0:M.trim())??"";if(Pt(),!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b)}catch{}}function rr(v,b){if(Te.value===v){if(b){const w=b.relatedTarget,M=Ne.value;if(w instanceof Node&&M&&M.contains(w))return}Pt()}}function mn(v){return Te.value===v}function Pt(){Te.value="",xe.value={}}function En(v){if(O.value="",Te.value===v){Pt();return}vn(),Be.value=!1,Te.value=v,zt(()=>{In(v)})}function $t(v,b){v.preventDefault(),O.value="",Te.value=b}function It(v,b){ce.value=v,fe.value=b,Ue.value=!0,Pt(),zt(()=>{var w,M;(w=Se.value)==null||w.focus(),(M=Se.value)==null||M.select()})}function Hn(){Ue.value=!1,ce.value="",fe.value=""}function io(){const v=ce.value,b=fe.value.trim();!v||!b||(s("rename-thread",{threadId:v,title:b}),Hn())}function Gr(v,b){O.value="",Ee.value=v,Re.value=b,De.value=!0,Pt()}function Kr(){De.value=!1,Ee.value="",Re.value=""}async function fa(){const v=Ee.value;v&&(q(v),Kr())}function Nt(v){return O.value===v}function R(v){if(O.value!==v){O.value=v,Pt();return}q(v),O.value=""}function q(v){Er.value.has(v)||(ee.value=[v,...ee.value]),O.value="",Pt(),oe.value=oe.value.filter(b=>b!==v),s("archive",v),Ln(v)&&(Uh(v).catch(()=>{}),Ie.value=or(Ie.value,v))}function re(v){var w;Me.value="thread",We.value=v,it.value="",Je.value=!1,ve.value="",ke.value="";const b=(w=Ie.value[v])==null?void 0:w[0];b?en(b.id):Ht(),et.value=!0,Pt()}function Le(v){var M;const b=fo(v);if(!b){Me.value="project",We.value="",it.value="",Je.value=!1,ve.value="Project automation requires a resolved absolute project path.",ke.value="",et.value=!0,vn();return}Me.value="project",We.value="",it.value=b,Je.value=!1,ve.value="",ke.value="";const w=(M=Qe.value[b])==null?void 0:M[0];w?en(w.id):Ht(),et.value=!0,vn()}function bt(v){Me.value=v.scope,We.value=v.scope==="thread"?v.target:"",it.value=v.scope==="project"?v.target:"",Je.value=!1,ve.value="",ke.value="",v.scope==="project"?Qe.value=dn(Qe.value,v.target,v.automation):Ie.value=yr(Ie.value,v.target,v.automation),en(v.automation.id),et.value=!0,vn(),Pt()}function Zt(){var v;Je.value=!0,te.value="thread",pe.value=((v=we.value[0])==null?void 0:v.value)??"",Me.value="thread",We.value="",it.value="",ve.value="",ke.value="",Ht(),et.value=!0,vn(),Pt()}function Rt(v){var b;te.value=v,pe.value="",Me.value=v==="project"?"project":"thread",pe.value=((b=X.value[0])==null?void 0:b.value)??""}function Ht(){ct.value="",at.value="create",ve.value="",ke.value="",W.value={name:Me.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},D.value=zr(W.value.rrule)}function en(v){const b=J.value.find(w=>w.id===v);b&&(ct.value=b.id,at.value="edit",ve.value="",ke.value="",W.value={name:b.name,prompt:b.prompt,rrule:b.rrule,status:b.status},D.value=zr(b.rrule))}function zn(){et.value=!1,Me.value="thread",We.value="",it.value="",ct.value="",ve.value="",ke.value="",P.value=!1,L.value=!1}function or(v,b){return Object.fromEntries(Object.entries(v).filter(([w])=>w!==b))}function yr(v,b,w){const M=v[b]??[],ye=M.findIndex(Gt=>Gt.id===w.id),st=[...M];return ye>=0?st.splice(ye,1,w):st.push(w),{...v,[b]:st}}function Mr(v,b,w){const M=(v[b]??[]).filter(ye=>ye.id!==w);return M.length>0?{...v,[b]:M}:or(v,b)}function Yr(v,b){return Object.fromEntries(Object.entries(v).filter(([w])=>w!==b))}function dn(v,b,w){const M=v[b]??[],ye=M.findIndex(Gt=>Gt.id===w.id),st=[...M];return ye>=0?st.splice(ye,1,w):st.push(w),{...v,[b]:st}}async function $r(){Qe.value=await Kk()}async function ha(){let v=We.value,b=it.value;P.value=!0,ve.value="",ke.value="";try{if(vr(),Je.value&&at.value==="create"&&(te.value==="thread"?(v=pe.value,b="",Me.value="thread",We.value=v,it.value=""):(b=pe.value,v="",Me.value="project",We.value="",it.value=b)),Me.value==="thread"&&!v)throw new Error("Select a chat target for this automation");if(Me.value==="project"&&!b)throw new Error("Select a project target for this automation");const w={id:ct.value||void 0,name:W.value.name,prompt:W.value.prompt,rrule:W.value.rrule,status:W.value.status},M=Me.value==="project"?await Jk({...w,projectName:b}):await Yk({...w,threadId:v});Me.value==="project"?await $r():Ie.value=yr(Ie.value,v,M),s("automations-changed"),en(M.id),ke.value="Automation saved.",P.value=!1}catch(w){ve.value=w instanceof Error?w.message:"Failed to save automation",P.value=!1}}async function jo(){const v=We.value,b=it.value,w=ct.value;if(w&&!(Me.value==="thread"&&!v)&&!(Me.value==="project"&&!b)){P.value=!0,ve.value="",ke.value="";try{Me.value==="project"?(await Bh(b,w),await $r()):(await Uh(v,w),Ie.value=Mr(Ie.value,v,w));const M=J.value[0];M?en(M.id):Ht(),s("automations-changed"),P.value=!1}catch(M){ve.value=M instanceof Error?M.message:"Failed to remove automation",P.value=!1}}}async function Ke(){const v=We.value,b=ct.value;if(!(!v||!b)){L.value=!0,ve.value="",ke.value="";try{await Qk(v,b),ke.value="Automation run queued."}catch(w){ve.value=w instanceof Error?w.message:"Failed to run automation"}finally{L.value=!1}}}function Ce(v){return r.projectDisplayNameById[v]??v}t({openAutomationEditorFromPanel:bt,openAutomationCreatorFromPanel:Zt});function xn(v){return v.includes("/")||v.includes("\\")}function pa(v){return xn(v)?v:Ce(v)}function Os(v){const b=eo(v);if(!b)return!1;let w=0;for(const M of r.groups)if(xn(M.projectName)&&eo(M.projectName)===b&&(w+=1,w>1))return!0;return!1}function Ds(v){const b=r.projectDisplayNameById[v.projectName],w=Ce(v.projectName),M=v.projectName;if(b&&!xn(M)&&M!==w)return w.includes(M)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(M)?w:`${w} ${M}`;if(b&&xn(M)){const Gt=eo(M),Nr=eo(vi(M)),vt=Os(M)?Nr:Gt;return vt&&vt!==w?`${w} ${vt}`:w}if(!w.includes("/")&&!w.includes("\\"))return w;const ye=eo(w)||w,st=eo(vi(w));return st.startsWith(".")&&st!==ye?`${ye} ${st}`:v.threads.length>0||!Os(M)?ye:st?`${ye} ${st}`:ye}function Wn(v){return se.value===v}function vn(){se.value="",le.value="actions",be.value=""}function lo(){const v=!Be.value;v&&(vn(),Pt()),Be.value=v}function Jr(v){Ct.value=v,Be.value=!1}function Lo(){I.value=!I.value}function hs(v){F.value=v}function ps(v){s("request-project-git-status",v),zt(()=>{vo(v)})}function Vt(v){if(se.value===v){vn();return}Pt(),Be.value=!1,se.value=v,le.value="actions",be.value=Ce(v),ps(v)}function ar(v){Pt(),Be.value=!1,se.value=v,le.value="actions",be.value=Ce(v),ps(v)}function Pn(v){return r.projectDisplayNameById[v.projectName]??Ds(v)}function Ei(v){Pt();const b=v.projectName;se.value=b,le.value="rename",be.value=Pn(v),zt(()=>{vo(b)})}function No(v){s("browse-project-files",v),vn()}function Pa(v){s("save-project",v),vn()}function uo(v){s("create-project-worktree",v),vn()}function co(v){s("rename-project",{projectName:v,displayName:be.value})}function Ia(v){const b=fo(v);if(s("remove-project",v),b&&pr(v)){Xe.value="";const w=Qe.value;Qe.value=Yr(Qe.value,b),Bh(b).then($r).catch(async M=>{Qe.value=w;const ye=M instanceof Error?M.message:"Failed to delete project automation";Xe.value=ye,a(ye);try{await $r()}catch{Qe.value=w}}).finally(()=>{s("automations-changed")})}vn()}function fo(v){var w;const b=((w=r.projectCwdByName[v])==null?void 0:w.trim())??"";return ik(b)?b:""}function Ka(v,b){if(!v.altKey||v.key!=="ArrowUp"&&v.key!=="ArrowDown")return;const w=r.groups.findIndex(st=>st.projectName===b);if(w<0)return;const M=v.key==="ArrowUp"?-1:1,ye=Math.max(0,Math.min(w+M,r.groups.length-1));ye!==w&&(v.preventDefault(),s("reorder-project",{projectName:b,toIndex:ye}))}function Oo(v){return u.value[v]===!0}function Tn(v){return f.value[v]===!0}function Do(v){u.value={...u.value,[v]:!Oo(v)}}function ho(){C.value=!C.value}function po(v){if(wt.value===v){wt.value="";return}f.value={...f.value,[v]:!Tn(v)}}function Cn(v){const b=kt.value[v]??0,w=nt.value,ye=((w==null?void 0:w.projectName)===v?w.groupHeight:null)??b,st=Tn(v)?0:rp;return Math.max(0,ye+st)}function mo(v,b){const w=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(w){G.set(v,w);return}G.delete(v)}function Fo(v,b){const w=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(w){K.set(v,w);return}K.delete(v)}function Vn(v){let b=v.parentElement;for(;b;){const w=window.getComputedStyle(b),M=w.overflowY||w.overflow;if(M==="auto"||M==="scroll"||M==="hidden"||M==="clip")return b.getBoundingClientRect();b=b.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Uo(v,b){const w=v.getBoundingClientRect(),M=Vn(v),ye=6,st=M.bottom-w.bottom,Gt=w.top-M.top;return st>=b+ye?"down":Gt>st?"up":"down"}function Ra(v,b){const w=K.get(v);if(!w)return"down";const M=Uo(w,b);return ae.value={...ae.value,[v]:M},M}function Ma(v){return ae.value[v]??"down"}function vo(v){const b=G.get(v);if(!b)return;const w=b.querySelector(".project-menu-panel"),M=(w==null?void 0:w.getBoundingClientRect().height)??0;Fe.value={...Fe.value,[v]:Uo(b,M)}}function jr(v,b,w){return Math.min(Math.max(v,b),w)}function In(v){const b=K.get(v);if(!b)return;const w=Ne.value,M=w==null?void 0:w.getBoundingClientRect(),ye=(M==null?void 0:M.height)||(w==null?void 0:w.offsetHeight)||112,st=(M==null?void 0:M.width)||(w==null?void 0:w.offsetWidth)||160,Gt=Ra(v,ye),Nr=b.getBoundingClientRect(),vt=8,Jn=4,Vo=Math.max(vt,window.innerWidth-st-vt),Or=jr(Nr.right-st,vt,Vo),ba=jr(Gt==="up"?Nr.top-ye-Jn:Nr.bottom+Jn,vt,Math.max(vt,window.innerHeight-ye-vt));xe.value={left:`${Math.round(Or)}px`,top:`${Math.round(ba)}px`}}function ma(){const v=Te.value;v&&In(v)}function Fs(){window.addEventListener("resize",ma),document.addEventListener("scroll",ma,!0)}function Qr(){window.removeEventListener("resize",ma),document.removeEventListener("scroll",ma,!0)}function ms(v){const b=se.value;if(!b)return!1;const w=G.get(b);if(!w)return!1;if((typeof v.composedPath=="function"?v.composedPath():[]).includes(w))return!0;const ye=v.target;return ye instanceof Node?w.contains(ye):!1}function Us(v){const b=Te.value;if(!b)return!1;const w=K.get(b);if(!w)return!1;const M=typeof v.composedPath=="function"?v.composedPath():[];if(M.includes(w))return!0;const ye=Ne.value;if(ye&&M.includes(ye))return!0;const st=v.target;return st instanceof Node?!!(w.contains(st)||ye&&ye.contains(st)):!1}function go(v){if(Be.value){const b=Ae.value,w=typeof v.composedPath=="function"?v.composedPath():[];!!b&&(w.includes(b)||v.target instanceof Node&&b.contains(v.target))||(Be.value=!1)}se.value&&(ms(v)||vn(),Te.value&&(Us(v)||Pt()))}function Gn(v){se.value&&!ms(v)&&vn(),Te.value&&!Us(v)&&Pt()}function va(){Be.value&&(Be.value=!1),se.value&&vn(),Te.value&&Pt()}function vs(){window.addEventListener("pointerdown",go,{capture:!0}),window.addEventListener("focusin",Gn,{capture:!0}),window.addEventListener("blur",va)}function gn(){window.removeEventListener("pointerdown",go,{capture:!0}),window.removeEventListener("focusin",Gn,{capture:!0}),window.removeEventListener("blur",va)}function On(v,b){const w=b.getBoundingClientRect().height;if(!Number.isFinite(w)||w<=0)return;const M=kt.value[v];M!==void 0&&Math.abs(M-w)<.5||(kt.value={...kt.value,[v]:w})}function Lr(v,b){const w=H.get(v);w&&w!==b&&Oe&&Oe.unobserve(w);const M=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(M){H.set(v,M),he.set(M,v),On(v,M),Oe==null||Oe.observe(M);return}w&&(Oe==null||Oe.unobserve(w)),H.delete(v)}function gs(v,b){if(v.button!==0||Dt.value||ze.value||nt.value)return;const w=r.groups.findIndex(Gt=>Gt.projectName===b),M=H.get(b);if(w<0||!M)return;const ye=M.getBoundingClientRect(),st=Tn(b)?0:rp;ze.value={projectName:b,fromIndex:w,startClientX:v.clientX,startClientY:v.clientY,pointerOffsetY:v.clientY-ye.top,groupLeft:ye.left,groupWidth:ye.width,groupHeight:ye.height,groupOuterHeight:ye.height+st},v.preventDefault(),Xr()}function Xr(){window.addEventListener("mousemove",qs),window.addEventListener("mouseup",wr),window.addEventListener("keydown",ga)}function Bs(){window.removeEventListener("mousemove",qs),window.removeEventListener("mouseup",wr),window.removeEventListener("keydown",ga)}function qs(v){pt={clientX:v.clientX,clientY:v.clientY},Bo()}function wr(v){qo({clientX:v.clientX,clientY:v.clientY});const b=nt.value;if(b&&un.value!==null){const w=r.groups.findIndex(M=>M.projectName===b.projectName);if(w>=0){const M=un.value;M!==w&&s("reorder-project",{projectName:b.projectName,toIndex:M})}}ya({preserveToggleSuppression:!!b})}function ga(v){v.key==="Escape"&&(!ze.value&&!nt.value||(v.preventDefault(),ya()))}function ya(v={}){Ve!==null&&(window.cancelAnimationFrame(Ve),Ve=null),pt=null,ze.value=null,nt.value=null,v.preserveToggleSuppression||(wt.value=""),Bs()}function Bo(){Ve===null&&(Ve=window.requestAnimationFrame(()=>{if(Ve=null,!pt)return;const v=pt;pt=null,qo(v)}))}function qo(v){const b=ze.value;if(!nt.value&&b){const w=v.clientX-b.startClientX,M=v.clientY-b.startClientY;if(Math.hypot(w,M)<Yx)return;vn(),wt.value=b.projectName,nt.value={projectName:b.projectName,fromIndex:b.fromIndex,pointerOffsetY:b.pointerOffsetY,groupLeft:b.groupLeft,groupWidth:b.groupWidth,groupHeight:b.groupHeight,groupOuterHeight:b.groupOuterHeight,ghostTop:v.clientY-b.pointerOffsetY,dropTargetIndexFull:null}}nt.value&&ys(v)}function ys(v){const b=nt.value;if(!b)return;if(b.ghostTop=v.clientY-b.pointerOffsetY,!wa(v)){b.dropTargetIndexFull=null;return}const w=v.clientY,M=He.value;if(!M){b.dropTargetIndexFull=null;return}const ye=M.getBoundingClientRect(),st=new Map(r.groups.map((Jn,Vo)=>[Jn.projectName,Vo])),Gt=r.groups.map(Jn=>Jn.projectName).filter(Jn=>Jn!==b.projectName);let Nr=0,vt=r.groups.length;for(const Jn of Gt){const Vo=st.get(Jn);if(Vo===void 0)continue;const Or=Cn(Jn),ba=ye.top+Nr+Or/2;if(w<ba){vt=Vo;break}Nr+=Or}b.dropTargetIndexFull=vt}function wa(v){const b=He.value;if(!b)return!1;const w=b.getBoundingClientRect(),M=v.clientX>=w.left&&v.clientX<=w.right,ye=v.clientY>=w.top-32&&v.clientY<=w.bottom+32;return M&&ye}function Kn(v){var b;return((b=nt.value)==null?void 0:b.projectName)===v}function $a(v){const b=nt.value,w=An.value[v]??0,M=Te.value?ca.value.get(Te.value)??"":"",ye=se.value===v||M===v;return!b||b.projectName!==v?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ye?"40":"1",transform:`translate3d(0, ${w}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${b.groupLeft}px`,width:`${b.groupWidth}px`,height:`${b.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${b.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Ho(v){return Po.value.get(v.projectName)??[]}function zo(v){if(Dt.value)return Ho(v);if(Tn(v.projectName))return[];const b=Ho(v);return Oo(v.projectName)?b:b.slice(0,10)}function sr(v){return Dt.value?!1:!Tn(v.projectName)&&Ho(v).length>10}function Wo(v){return Ho(v).length>0}function jt(v){return!!v.pendingRequestState||v.inProgress||v.unread}function Yn(v){return v.pendingRequestState==="approval"?"Awaiting approval":"Awaiting response"}function ir(v){return v.pendingRequestState==="approval"?"awaiting-approval":v.pendingRequestState==="response"?"awaiting-response":v.inProgress?"working":v.unread?"unread":"idle"}ft(()=>r.groups.map(v=>v.projectName),v=>{var ye,st;const b=((ye=nt.value)==null?void 0:ye.projectName)??((st=ze.value)==null?void 0:st.projectName)??"";b&&!r.groups.some(Gt=>Gt.projectName===b)&&ya();const w=new Set(v),M=Object.fromEntries(Object.entries(kt.value).filter(([Gt])=>w.has(Gt)));Object.keys(M).length!==Object.keys(kt.value).length&&(kt.value=M)}),ft(()=>{const v=se.value;return v?r.projectGitRepoByName[v]:void 0},()=>{const v=se.value;v&&zt(()=>{se.value===v&&vo(v)})});const Hs=Q(()=>Be.value||se.value!==""||Te.value!=="");return ft(Hs,v=>{if(v){vs();return}gn()}),ft(Te,v=>{if(!v){Qr();return}Fs(),zt(()=>{In(v)})}),ds(()=>{for(const v of H.values())Oe==null||Oe.unobserve(v);H.clear(),G.clear(),Qr(),gn(),ya()}),(v,b)=>(S(),A("section",{class:Ze(["thread-tree-root",{"chats-first":I.value}])},[lt.value.length>0?(S(),A("section",g1,[je(Yo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":m.value,onClick:Fn},{left:yt(()=>[m.value?(S(),rt(Ms,{key:1,class:"thread-icon"})):(S(),rt(Wl,{key:0,class:"thread-icon"}))]),default:yt(()=>[p("span",y1,E(T(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),m.value?(S(),A("ul",w1,[(S(!0),A(tt,null,an(lt.value,w=>(S(),A("li",{key:w.id,class:"thread-row-item","data-menu-open":mn(w.id)?"true":"false"},[je(Yo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Lt(w.id),"data-menu-open":mn(w.id)?"true":"false","force-right-hover":mn(w.id),onClick:M=>Un(w.id),onMouseleave:M=>rr(w.id,M),onContextmenu:M=>$t(M,w.id)},{left:yt(()=>[p("span",_1,[jt(w)?(S(),A("span",{key:0,class:"thread-status-indicator","data-state":ir(w)},null,8,k1)):Z("",!0),p("button",{class:"thread-delete-button",type:"button","data-confirming":Nt(w.id),title:Nt(w.id)?"Confirm delete":T(o)("Delete thread"),onClick:Ye(M=>R(w.id),["stop"])},[Nt(w.id)?(S(),A("span",C1,"Confirm")):(S(),rt(Vl,{key:1,class:"thread-icon"}))],8,T1)])]),right:yt(()=>[p("span",M1,E(cn(w)),1)]),"right-hover":yt(()=>[p("div",{ref_for:!0,ref:M=>Fo(w.id,M),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ye(M=>En(w.id),["stop"])},[je(ei,{class:"thread-icon"})],8,$1)],512)]),default:yt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Ye(M=>Un(w.id),["stop"])},[p("span",x1,[p("span",A1,[p("span",E1,E(w.title),1),w.hasWorktree?(S(),rt(li,{key:0,class:"thread-row-worktree-icon",title:T(o)("Worktree thread")},null,8,["title"])):Z("",!0),Ln(w.id)?(S(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(w.id)},[je(Xo,{class:"thread-row-automation-icon"}),kn(w.id)>1?(S(),A("span",I1,E(kn(w.id)),1)):Z("",!0)],8,P1)):Z("",!0),w.pendingRequestState?(S(),A("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},E(Yn(w)),9,R1)):Z("",!0)])])],8,S1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,b1))),128))])):Z("",!0)])):Z("",!0),p("section",j1,[je(Yo,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":h.value,onClick:_n},{left:yt(()=>[h.value?(S(),rt(Ms,{key:1,class:"thread-icon"})):(S(),rt(Wl,{key:0,class:"thread-icon"}))]),right:yt(()=>[p("div",{ref_key:"organizeMenuWrapRef",ref:Ae,class:"organize-menu-wrap"},[p("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Be.value,"aria-label":T(o)("Organize threads"),title:T(o)("Organize threads"),onClick:Ye(lo,["stop"])},[je(ei,{class:"thread-icon"})],8,N1),Be.value?(S(),A("div",{key:0,class:"organize-menu-panel",onClick:b[4]||(b[4]=Ye(()=>{},["stop"]))},[p("p",O1,E(T(o)("Organize")),1),p("button",{class:"organize-menu-item","data-active":Ct.value==="project",type:"button",onClick:b[0]||(b[0]=w=>Jr("project"))},[p("span",null,E(T(o)("By project")),1),Ct.value==="project"?(S(),A("span",F1,"✓")):Z("",!0)],8,D1),p("button",{class:"organize-menu-item","data-active":Ct.value==="chronological",type:"button",onClick:b[1]||(b[1]=w=>Jr("chronological"))},[p("span",null,E(T(o)("Chronological list")),1),Ct.value==="chronological"?(S(),A("span",B1,"✓")):Z("",!0)],8,U1),p("button",{class:"organize-menu-item","data-active":I.value,type:"button",onClick:Lo},[p("span",null,E(T(o)("Chats first")),1),I.value?(S(),A("span",H1,"✓")):Z("",!0)],8,q1),b[30]||(b[30]=p("div",{class:"organize-menu-separator"},null,-1)),p("p",z1,E(T(o)("Sort by")),1),p("button",{class:"organize-menu-item","data-active":F.value==="created",type:"button",onClick:b[2]||(b[2]=w=>hs("created"))},[p("span",null,E(T(o)("Created")),1),F.value==="created"?(S(),A("span",V1,"✓")):Z("",!0)],8,W1),p("button",{class:"organize-menu-item","data-active":F.value==="updated",type:"button",onClick:b[3]||(b[3]=w=>hs("updated"))},[p("span",null,E(T(o)("Updated")),1),F.value==="updated"?(S(),A("span",K1,"✓")):Z("",!0)],8,G1)])):Z("",!0)],512)]),default:yt(()=>[p("span",L1,E(T(o)("Projects")),1)]),_:1},8,["aria-expanded"]),h.value?(S(),A(tt,{key:0},[Xe.value?(S(),A("p",Y1,E(Xe.value),1)):Z("",!0),Dt.value&&Br.value.length===0?(S(),A("p",J1,E(T(o)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(S(),A("p",Q1,E(T(o)("Loading threads...")),1)):ua.value?(S(),A("ul",X1,[(S(!0),A(tt,null,an(tr.value,w=>(S(),A("li",{key:w.id,class:"thread-row-item","data-menu-open":mn(w.id)?"true":"false"},[je(Yo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Lt(w.id),"data-menu-open":mn(w.id)?"true":"false","force-right-hover":mn(w.id),onClick:M=>Un(w.id),onMouseleave:M=>rr(w.id,M),onContextmenu:M=>$t(M,w.id)},{left:yt(()=>[p("span",eS,[jt(w)?(S(),A("span",{key:0,class:"thread-status-indicator","data-state":ir(w)},null,8,tS)):Z("",!0),p("button",{class:"thread-delete-button",type:"button","data-confirming":Nt(w.id),title:Nt(w.id)?"Confirm delete":T(o)("Delete thread"),onClick:Ye(M=>R(w.id),["stop"])},[Nt(w.id)?(S(),A("span",rS,"Confirm")):(S(),rt(Vl,{key:1,class:"thread-icon"}))],8,nS)])]),right:yt(()=>[p("span",dS,E(cn(w)),1)]),"right-hover":yt(()=>[p("div",{ref_for:!0,ref:M=>Fo(w.id,M),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ye(M=>En(w.id),["stop"])},[je(ei,{class:"thread-icon"})],8,fS)],512)]),default:yt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Ye(M=>Un(w.id),["stop"])},[p("span",aS,[p("span",sS,[p("span",iS,E(w.title),1),w.hasWorktree?(S(),rt(li,{key:0,class:"thread-row-worktree-icon",title:T(o)("Worktree thread")},null,8,["title"])):Z("",!0),Ln(w.id)?(S(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(w.id)},[je(Xo,{class:"thread-row-automation-icon"}),kn(w.id)>1?(S(),A("span",uS,E(kn(w.id)),1)):Z("",!0)],8,lS)):Z("",!0),w.pendingRequestState?(S(),A("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},E(Yn(w)),9,cS)):Z("",!0)])])],8,oS)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,Z1))),128))])):(S(),A("div",{key:4,ref_key:"groupsContainerRef",ref:He,class:"thread-tree-groups",style:ea(hn.value)},[(S(!0),A(tt,null,an(Br.value,w=>(S(),A("article",{key:w.projectName,ref_for:!0,ref:M=>Lr(w.projectName,M),class:"project-group","data-project-name":w.projectName,"data-expanded":!Tn(w.projectName),"data-dragging":Kn(w.projectName),style:ea($a(w.projectName))},[je(Yo,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:M=>po(w.projectName),onContextmenu:Ye(M=>ar(w.projectName),["prevent"]),onKeydown:[M=>Ka(M,w.projectName),tn(Ye(M=>po(w.projectName),["prevent"]),["enter"]),tn(Ye(M=>po(w.projectName),["prevent"]),["space"])]},{left:yt(()=>[p("span",pS,[p("span",mS,[Tn(w.projectName)?(S(),rt(jd,{key:0,class:"thread-icon"})):(S(),rt(MC,{key:1,class:"thread-icon"}))]),p("span",vS,[Tn(w.projectName)?(S(),rt(Wl,{key:0,class:"thread-icon"})):(S(),rt(Ms,{key:1,class:"thread-icon"}))])])]),right:yt(()=>[p("div",_S,[p("div",{ref_for:!0,ref:M=>mo(w.projectName,M),class:"project-menu-wrap"},[p("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Ye(M=>Vt(w.projectName),["stop"])},[je(ei,{class:"thread-icon"})],8,kS),Wn(w.projectName)?(S(),A("div",{key:0,class:"project-menu-panel","data-open-direction":Fe.value[w.projectName]??"down",onClick:b[6]||(b[6]=Ye(()=>{},["stop"]))},[le.value==="actions"?(S(),A(tt,{key:0},[p("button",{class:"project-menu-item",type:"button",onClick:M=>No(w.projectName)}," Browse files ",8,CS),p("button",{class:"project-menu-item",type:"button",onClick:M=>Pa(w.projectName)}," Export Project ",8,SS),p("button",{class:"project-menu-item",type:"button",onClick:M=>Le(w.projectName)},E(pr(w.projectName)?"Manage automations…":"Add automation…"),9,xS),e.projectGitRepoByName[w.projectName]?(S(),A("button",{key:0,class:"project-menu-item",type:"button",onClick:M=>uo(w.projectName)}," New worktree ",8,AS)):Z("",!0),p("button",{class:"project-menu-item",type:"button",onClick:M=>Ei(w)}," Rename project ",8,ES),p("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:M=>Ia(w.projectName)}," Remove ",8,PS)],64)):(S(),A(tt,{key:1},[p("label",IS,E(T(o)("Project name")),1),Yt(p("input",{"onUpdate:modelValue":b[5]||(b[5]=M=>be.value=M),class:"project-menu-input",type:"text",onInput:M=>co(w.projectName)},null,40,RS),[[on,be.value]])],64))],8,TS)):Z("",!0)],512),p("button",{class:"thread-start-button",type:"button","aria-label":qn(w.projectName),title:qn(w.projectName),onClick:Ye(M=>Xt(w.projectName),["stop"])},[je(Ci,{class:"thread-icon"})],8,MS)])]),default:yt(()=>[p("span",{class:"project-main-button","data-dragging-handle":Kn(w.projectName),onMousedown:Ye(M=>gs(M,w.projectName),["left"])},[p("span",{class:"project-title",title:pa(w.projectName)},E(Ds(w)),9,yS),pr(w.projectName)?(S(),A("span",{key:0,class:"thread-row-automation-chip",title:Ro(w.projectName)},[je(Xo,{class:"thread-row-automation-icon"}),Pr(w.projectName)>1?(S(),A("span",bS,E(Pr(w.projectName)),1)):Z("",!0)],8,wS)):Z("",!0)],40,gS)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Wo(w)?(S(),A("ul",$S,[(S(!0),A(tt,null,an(zo(w),M=>(S(),A("li",{key:M.id,class:"thread-row-item","data-menu-open":mn(M.id)?"true":"false"},[je(Yo,{class:"thread-row","data-active":M.id===e.selectedThreadId,"data-pinned":Lt(M.id),"data-menu-open":mn(M.id)?"true":"false","force-right-hover":mn(M.id),onClick:ye=>Un(M.id),onMouseleave:ye=>rr(M.id,ye),onContextmenu:ye=>$t(ye,M.id)},{left:yt(()=>[p("span",LS,[jt(M)?(S(),A("span",{key:0,class:"thread-status-indicator","data-state":ir(M)},null,8,NS)):Z("",!0),p("button",{class:"thread-delete-button",type:"button","data-confirming":Nt(M.id),title:Nt(M.id)?"Confirm delete":T(o)("Delete thread"),onClick:Ye(ye=>R(M.id),["stop"])},[Nt(M.id)?(S(),A("span",DS,"Confirm")):(S(),rt(Vl,{key:1,class:"thread-icon"}))],8,OS)])]),right:yt(()=>[p("span",VS,E(cn(M)),1)]),"right-hover":yt(()=>[p("div",{ref_for:!0,ref:ye=>Fo(M.id,ye),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ye(ye=>En(M.id),["stop"])},[je(ei,{class:"thread-icon"})],8,GS)],512)]),default:yt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Ye(ye=>Un(M.id),["stop"])},[p("span",US,[p("span",BS,[p("span",qS,E(M.title),1),M.hasWorktree?(S(),rt(li,{key:0,class:"thread-row-worktree-icon",title:T(o)("Worktree thread")},null,8,["title"])):Z("",!0),Ln(M.id)?(S(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(M.id)},[je(Xo,{class:"thread-row-automation-icon"}),kn(M.id)>1?(S(),A("span",zS,E(kn(M.id)),1)):Z("",!0)],8,HS)):Z("",!0),M.pendingRequestState?(S(),A("span",{key:2,class:"thread-row-request-chip","data-state":M.pendingRequestState},E(Yn(M)),9,WS)):Z("",!0)])])],8,FS)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,jS))),128))])):(S(),rt(Yo,{key:1,as:"p",class:"project-empty-row"},{left:yt(()=>[...b[31]||(b[31]=[p("span",{class:"project-empty-spacer"},null,-1)])]),default:yt(()=>[p("span",KS,E(T(o)("No threads")),1)]),_:1})),sr(w)?(S(),rt(Yo,{key:2,class:"thread-show-more-row"},{left:yt(()=>[...b[32]||(b[32]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:yt(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:M=>Do(w.projectName)},E(Oo(w.projectName)?"Show less":"Show more"),9,YS)]),_:2},1024)):Z("",!0)],12,hS))),128))],4))],64)):Z("",!0)]),p("section",JS,[je(Yo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":y.value,onClick:da},{left:yt(()=>[y.value?(S(),rt(Ms,{key:1,class:"thread-icon"})):(S(),rt(Wl,{key:0,class:"thread-icon"}))]),right:yt(()=>[p("div",XS,[p("button",{class:"chats-section-action",type:"button","aria-label":T(o)("New chat"),title:T(o)("New chat"),onClick:b[7]||(b[7]=Ye(w=>v.$emit("start-new-chat"),["stop"]))},[je(Ci,{class:"thread-icon"})],8,ZS)])]),default:yt(()=>[p("span",QS,E(T(o)("Chats")),1)]),_:1},8,["aria-expanded"]),y.value&&hr.value.length===0?(S(),A("p",ex,E(T(o)("No chats")),1)):y.value?(S(),A("ul",tx,[(S(!0),A(tt,null,an(fn.value,w=>(S(),A("li",{key:w.id,class:"thread-row-item","data-menu-open":mn(w.id)?"true":"false"},[je(Yo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Lt(w.id),"data-menu-open":mn(w.id)?"true":"false","force-right-hover":mn(w.id),onClick:M=>Un(w.id),onMouseleave:M=>rr(w.id,M),onContextmenu:M=>$t(M,w.id)},{left:yt(()=>[p("span",rx,[jt(w)?(S(),A("span",{key:0,class:"thread-status-indicator","data-state":ir(w)},null,8,ox)):Z("",!0),p("button",{class:"thread-delete-button",type:"button","data-confirming":Nt(w.id),title:Nt(w.id)?"Confirm delete":T(o)("Delete thread"),onClick:Ye(M=>R(w.id),["stop"])},[Nt(w.id)?(S(),A("span",sx,"Confirm")):(S(),rt(Vl,{key:1,class:"thread-icon"}))],8,ax)])]),right:yt(()=>[p("span",px,E(cn(w)),1)]),"right-hover":yt(()=>[p("div",{ref_for:!0,ref:M=>Fo(w.id,M),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ye(M=>En(w.id),["stop"])},[je(ei,{class:"thread-icon"})],8,mx)],512)]),default:yt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Ye(M=>Un(w.id),["stop"])},[p("span",lx,[p("span",ux,[p("span",cx,E(w.title),1),w.hasWorktree?(S(),rt(li,{key:0,class:"thread-row-worktree-icon",title:T(o)("Worktree thread")},null,8,["title"])):Z("",!0),Ln(w.id)?(S(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(w.id)},[je(Xo,{class:"thread-row-automation-icon"}),kn(w.id)>1?(S(),A("span",fx,E(kn(w.id)),1)):Z("",!0)],8,dx)):Z("",!0),w.pendingRequestState?(S(),A("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},E(Yn(w)),9,hx)):Z("",!0)])])],8,ix)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,nx))),128))])):Z("",!0),y.value&&xo.value?(S(),rt(Yo,{key:2,class:"thread-show-more-row"},{left:yt(()=>[...b[33]||(b[33]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:yt(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:ho},E(C.value?"Show less":"Show more"),1)]),_:1})):Z("",!0)]),(S(),rt(is,{to:"body"},[sn.value?(S(),A("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Ne,class:"thread-menu-panel thread-menu-panel-fixed",style:ea(xe.value),"data-open-direction":Ma(sn.value.id),onClick:b[17]||(b[17]=Ye(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:b[8]||(b[8]=w=>re(sn.value.id))},E(Ln(sn.value.id)?"Manage automations…":"Add automation…"),1),p("button",{class:"thread-menu-item",type:"button",onClick:b[9]||(b[9]=w=>nr(sn.value.id))}," Browse files "),p("button",{class:"thread-menu-item",type:"button",onClick:b[10]||(b[10]=w=>so(sn.value.id))}," Export Project "),p("button",{class:"thread-menu-item",type:"button",onClick:b[11]||(b[11]=w=>Rr(sn.value.id))}," Copy path "),p("button",{class:"thread-menu-item",type:"button",disabled:sn.value.id!==e.selectedThreadId,title:sn.value.id===e.selectedThreadId?"Copy chat":"Open this chat before copying",onClick:b[12]||(b[12]=w=>Wr(sn.value.id))}," Copy chat ",8,gx),p("button",{class:"thread-menu-item",type:"button",onClick:b[13]||(b[13]=w=>Vr(sn.value.id))}," Create chat fork "),p("button",{class:"thread-menu-item",type:"button",onClick:b[14]||(b[14]=w=>Hr(sn.value.id))},E(Lt(sn.value.id)?"Unpin thread":"Pin thread"),1),p("button",{class:"thread-menu-item",type:"button",onClick:b[15]||(b[15]=w=>It(sn.value.id,sn.value.title))},E(T(o)("Rename thread")),1),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:b[16]||(b[16]=w=>Gr(sn.value.id,sn.value.title))},E(T(o)("Delete thread")),1)],12,vx)):Z("",!0)])),(S(),rt(is,{to:"body"},[Ue.value?(S(),A("div",{key:0,class:"rename-thread-overlay",onClick:Ye(Hn,["self"])},[p("div",yx,[p("h3",wx,E(T(o)("Rename thread")),1),b[34]||(b[34]=p("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Yt(p("input",{ref_key:"renameThreadInputRef",ref:Se,"onUpdate:modelValue":b[18]||(b[18]=w=>fe.value=w),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[tn(Ye(io,["prevent"]),["enter"]),tn(Ye(Hn,["prevent"]),["esc"])]},null,40,bx),[[on,fe.value]]),p("div",_x,[p("button",{class:"rename-thread-button",type:"button",onClick:Hn},E(T(o)("Cancel")),1),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:io},E(T(o)("Save")),1)])])])):Z("",!0)])),(S(),rt(is,{to:"body"},[De.value?(S(),A("div",{key:0,class:"rename-thread-overlay",onClick:Ye(Kr,["self"])},[p("div",kx,[p("h3",Tx,E(Eo.value?"Archive chat and remove automations?":"Delete thread?"),1),p("p",Cx,[Eo.value?(S(),A(tt,{key:0},[Ns(' This will archive the thread "'+E(Re.value)+'" and remove the attached heartbeat automations. ',1)],64)):(S(),A(tt,{key:1},[Ns(' This will archive the thread "'+E(Re.value)+'". You can find it later in archived threads. ',1)],64))]),p("div",Sx,[p("button",{class:"rename-thread-button",type:"button",onClick:Kr},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:fa},E(Eo.value?"Archive and remove":"Delete"),1)])])])):Z("",!0)])),(S(),rt(is,{to:"body"},[et.value?(S(),A("div",{key:0,class:"rename-thread-overlay",onClick:Ye(zn,["self"])},[p("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":Me.value==="project"?"Project automation":"Thread automation"},[p("h3",Ax,E(at.value==="edit"?"Edit automation":"Add automation"),1),p("p",Ex,E(ge.value),1),Je.value&&at.value==="create"?(S(),A("div",Px,[b[35]||(b[35]=p("span",{class:"automation-thread-label"},"Target",-1)),p("div",Ix,[p("button",{class:Ze(["automation-target-mode",{"is-active":te.value==="thread"}]),type:"button",onClick:b[19]||(b[19]=w=>Rt("thread"))}," Existing chat ",2),p("button",{class:Ze(["automation-target-mode",{"is-active":te.value==="project"}]),type:"button",onClick:b[20]||(b[20]=w=>Rt("project"))}," Project ",2)]),p("div",Rx,[je(Ur,{modelValue:pe.value,"onUpdate:modelValue":b[21]||(b[21]=w=>pe.value=w),class:"automation-thread-dropdown",options:X.value,placeholder:te.value==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":te.value==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):Z("",!0),J.value.length>0?(S(),A("div",{key:1,class:"automation-thread-list","aria-label":Me.value==="project"?"Project automations":"Thread automations"},[(S(!0),A(tt,null,an(J.value,w=>(S(),A("button",{key:w.id,class:Ze(["automation-thread-list-item",{"is-active":w.id===ct.value}]),type:"button",onClick:M=>en(w.id)},[p("span",null,E(w.name),1),p("small",null,E(w.status==="PAUSED"?"Paused":"Active"),1)],10,$x))),128)),p("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:Ht}," Add another automation ")],8,Mx)):Z("",!0),p("label",jx,[b[36]||(b[36]=p("span",{class:"automation-thread-label"},"Name",-1)),Yt(p("input",{"onUpdate:modelValue":b[22]||(b[22]=w=>W.value.name=w),class:"rename-thread-input",type:"text",placeholder:"Automation name"},null,512),[[on,W.value.name]])]),p("label",Lx,[b[37]||(b[37]=p("span",{class:"automation-thread-label"},"Prompt",-1)),Yt(p("textarea",{"onUpdate:modelValue":b[23]||(b[23]=w=>W.value.prompt=w),class:"automation-thread-textarea",rows:"6",placeholder:"Describe what the automation should do"},null,512),[[on,W.value.prompt]])]),p("div",Nx,[b[40]||(b[40]=p("span",{class:"automation-thread-label"},"Schedule",-1)),p("div",Ox,[p("button",{class:Ze(["automation-schedule-mode",{"is-active":D.value.mode==="daily"}]),type:"button",onClick:b[24]||(b[24]=w=>Sn("daily"))}," Daily ",2),p("button",{class:Ze(["automation-schedule-mode",{"is-active":D.value.mode==="interval"}]),type:"button",onClick:b[25]||(b[25]=w=>Sn("interval"))}," Interval ",2),p("button",{class:Ze(["automation-schedule-mode",{"is-active":D.value.mode==="advanced"}]),type:"button",onClick:b[26]||(b[26]=w=>Sn("advanced"))}," RRULE ",2)]),D.value.mode==="daily"?(S(),A("div",Dx,[b[38]||(b[38]=p("span",{class:"automation-schedule-copy"},"Run every day at",-1)),Yt(p("input",{"onUpdate:modelValue":b[27]||(b[27]=w=>D.value.dailyTime=w),class:"automation-schedule-time",type:"time",onInput:vr},null,544),[[on,D.value.dailyTime]])])):D.value.mode==="interval"?(S(),A("div",Fx,[b[39]||(b[39]=p("span",{class:"automation-schedule-copy"},"Run every",-1)),Yt(p("input",{"onUpdate:modelValue":b[28]||(b[28]=w=>D.value.interval=w),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:vr},null,544),[[on,D.value.interval,void 0,{number:!0}]]),je(Ur,{class:"automation-schedule-unit-dropdown","model-value":D.value.intervalUnit,options:qe,placeholder:"Unit","onUpdate:modelValue":$o},null,8,["model-value"])])):Z("",!0),D.value.mode==="advanced"?Yt((S(),A("input",{key:2,"onUpdate:modelValue":b[29]||(b[29]=w=>W.value.rrule=w),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:Et},null,544)),[[on,W.value.rrule]]):Z("",!0),p("p",Ux,E(U.value),1)]),p("div",Bx,[b[41]||(b[41]=p("span",{class:"automation-thread-label"},"Status",-1)),je(Ur,{class:"automation-thread-dropdown","model-value":W.value.status,options:Pe.value,placeholder:T(o)("Status"),"onUpdate:modelValue":gr},null,8,["model-value","options","placeholder"])]),ve.value?(S(),A("p",qx,E(ve.value),1)):ke.value?(S(),A("p",Hx,E(ke.value),1)):Z("",!0),p("div",zx,[at.value==="edit"&&Me.value==="thread"?(S(),A("button",{key:0,class:"rename-thread-button",type:"button",disabled:P.value||L.value,onClick:Ke},E(L.value?"Running…":"Run now"),9,Wx)):Z("",!0),at.value==="edit"?(S(),A("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:P.value||L.value,onClick:jo}," Remove ",8,Vx)):Z("",!0),p("button",{class:"rename-thread-button",type:"button",disabled:P.value||L.value,onClick:zn},E(T(o)("Cancel")),9,Gx),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:P.value||L.value,onClick:ha},E(P.value?"Saving…":"Save"),9,Kx)])],8,xx)])):Z("",!0)]))],2))}}),Qx=At(Jx,[["__scopeId","data-v-fc96bbaa"]]),Xx={class:"content-header"},Zx=["title"],eA={class:"content-actions"},tA=er({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(S(),A("header",Xx,[p("div",{class:Ze(["content-leading",{"is-accent":e.accent}])},[Sa(t.$slots,"leading",{},void 0)],2),p("h1",{class:Ze(["content-title",{"is-accent":e.accent}]),title:e.title},E(e.title),11,Zx),p("div",eA,[Sa(t.$slots,"actions",{},void 0)])]))}}),nA=At(tA,[["__scopeId","data-v-21ba993b"]]),up=.0025,xc=3,cp=2,rA=256;function oA(e){var Ue;const t=x("idle"),n=x(typeof navigator<"u"&&!!((Ue=navigator.mediaDevices)!=null&&Ue.getUserMedia)),r=x(0),o=x(null);let a=null,s=null,u=[],f=null,m=null,h=null,y=null,C=[],I=!1,F=!1,B=null;function oe(){B&&(B.abort(),B=null),t.value==="transcribing"&&(t.value="idle")}function V(){const ce=o.value;if(!ce||typeof window>"u")return;const fe=ce.getContext("2d");if(!fe)return;const Se=Math.max(1,Math.floor(ce.clientWidth)),De=Math.max(1,Math.floor(ce.clientHeight||36)),Ee=window.devicePixelRatio||1,Re=Math.max(1,Math.floor(Se*Ee)),Ie=Math.max(1,Math.floor(De*Ee));(ce.width!==Re||ce.height!==Ie)&&(ce.width=Re,ce.height=Ie),fe.setTransform(Ee,0,0,Ee,0,0),fe.clearRect(0,0,Se,De);const Qe=Math.max(12,Math.floor(Se/(xc+cp))),et=C.slice(-Qe),Me=Math.max(0,Qe-et.length),We=De/2,it=getComputedStyle(ce).color||"#000000";for(let ct=0;ct<Qe;ct+=1){const at=et[ct-Me]??0,te=Math.max(.08,Math.min(1,at*18))*We,pe=ct*(xc+cp);fe.globalAlpha=at<=up?.35:1,fe.fillStyle=it,fe.fillRect(pe,We-te,xc,te*2)}fe.globalAlpha=1}function O(){C=[],r.value=0,V()}function ee(){h&&(h.disconnect(),h.onaudioprocess=null,h=null),m&&(m.disconnect(),m=null),f&&(f.close(),f=null),y=null}function se(ce){if(typeof window>"u")return;const fe=window.webkitAudioContext,Se=window.AudioContext??fe;Se&&(ee(),O(),f=new Se,m=f.createMediaStreamSource(ce),h=f.createScriptProcessor(2048,1,1),y=performance.now(),h.onaudioprocess=De=>{const Ee=De.inputBuffer.getChannelData(0);let Re=0;for(let Ie=0;Ie<Ee.length;Ie+=1){const Qe=Math.abs(Ee[Ie]??0);Re+=Qe<up?0:Qe}C.push(Re/Ee.length),C.length>rA&&C.shift(),y!==null&&(r.value=Math.max(0,performance.now()-y)),V()},m.connect(h),h.connect(f.destination),V())}async function Te(){var ce;if(t.value==="transcribing"&&oe(),!(t.value!=="idle"||!n.value||I)){I=!0,F=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),u=[],a=new MediaRecorder(s),a.ondataavailable=fe=>{fe.data.size>0&&u.push(fe.data)},a.onstop=()=>{var De;const fe=u,Se=(a==null?void 0:a.mimeType)||((De=fe[0])==null?void 0:De.type)||"audio/webm";le(),xe(fe,Se)},se(s),a.start(250),t.value="recording",F&&Fe()}catch(fe){le(),t.value="idle",(ce=e.onError)==null||ce.call(e,fe)}finally{I=!1}}}function Fe(){if(I&&t.value==="idle"){F=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function ae(){F=!1,oe(),le(),t.value="idle"}async function xe(ce,fe){var Ee,Re,Ie,Qe,et;if(ce.length===0){(Ee=e.onEmpty)==null||Ee.call(e),t.value="idle";return}const Se=new Blob(ce,{type:fe});t.value="transcribing";let De=null;try{const Me=fe.split(/[/;]/)[1]??"webm",We=new FormData;We.append("file",Se,`codex.${Me}`);const it=((Re=e.getLanguage)==null?void 0:Re.call(e).trim())??"";it&&it.toLowerCase()!=="auto"&&We.append("language",it),De=new AbortController,B=De;const ct=await fetch("/codex-api/transcribe",{method:"POST",body:We,signal:De.signal}),at=await ct.text();let Je=null;try{Je=at.trim()?JSON.parse(at):null}catch{Je=null}if(!ct.ok){const pe=(Ie=Je==null?void 0:Je.error)==null?void 0:Ie.trim(),ve=at.trim();throw new Error(pe||ve||`Transcription failed: ${ct.status}`)}const te=((Je==null?void 0:Je.text)??"").trim();te.length>0?e.onTranscript(te):(Qe=e.onEmpty)==null||Qe.call(e)}catch(Me){if(Me instanceof DOMException&&Me.name==="AbortError")return;(et=e.onError)==null||et.call(e,Me)}finally{De&&B===De&&(B=null),t.value==="transcribing"&&(t.value="idle")}}function le(){ee(),O(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(ce=>ce.stop()),s=null),u=[]}ds(()=>{ae()});function be(){if(t.value==="recording"){Fe();return}(t.value==="idle"||t.value==="transcribing")&&Te()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:Te,stopRecording:Fe,toggleRecording:be,cancel:ae}}const aA={},sA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function iA(e,t){return S(),A("svg",sA,[...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 lA=At(aA,[["render",iA]]),uA={},cA={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function dA(e,t){return S(),A("svg",cA,[...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 fA=At(uA,[["render",dA]]),hA={},pA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mA(e,t){return S(),A("svg",pA,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 2m0 3a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3zM5 10a7 7 0 0 0 14 0M8 21h8M12 17v4"},null,-1)])])}const vA=At(hA,[["render",mA]]),gA={},yA={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function wA(e,t){return S(),A("svg",yA,[...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 bA=At(gA,[["render",wA]]),_A={},kA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function TA(e,t){return S(),A("svg",kA,[...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 dp=At(_A,[["render",TA]]),CA=["disabled"],SA={class:"search-dropdown-value"},xA={class:"search-dropdown-search-wrap"},AA={class:"search-dropdown-search-row"},EA=["placeholder","onKeydown"],PA=["aria-label","title"],IA={key:0,class:"search-dropdown-list",role:"listbox"},RA=["onPointerenter"],MA=["onClick"],$A={class:"search-dropdown-option-check"},jA=["title"],LA={class:"search-dropdown-option-copy"},NA={class:"search-dropdown-option-label-row"},OA={class:"search-dropdown-option-label"},DA={key:0,class:"search-dropdown-option-type"},FA={key:0,class:"search-dropdown-option-desc"},UA=["aria-label","title","onClick"],BA={key:1,class:"search-dropdown-empty"},qA=er({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{},createLabel:{},allowRemove:{type:Boolean},removeLabel:{},displayLabelOverride:{}},emits:["toggle","create","remove"],setup(e,{emit:t}){const n=e,r=t,o=x(null),a=x(null),s=x(null),u=x(!1),f=x(""),m=x(0),h=x({}),{t:y}=fs(),C=Q(()=>n.openDirection??"down"),I=Q(()=>new Set(n.selectedValues)),F=Q(()=>{var ae;if((ae=n.displayLabelOverride)!=null&&ae.trim())return n.displayLabelOverride.trim();if(n.selectedValues.length===0)return n.placeholder||y("Select...");if(n.selectedValues.length===1){const xe=n.options.find(le=>le.value===n.selectedValues[0]);return(xe==null?void 0:xe.label)||n.placeholder||y("Select...")}return`${n.selectedValues.length} ${y("selected")}`}),B=Q(()=>{const ae=f.value.toLowerCase().trim();return ae?n.options.filter(xe=>{var le;return xe.label.toLowerCase().includes(ae)||(((le=xe.description)==null?void 0:le.toLowerCase().includes(ae))??!1)}):n.options});function oe(){const ae=a.value,xe=o.value;if(!ae||!xe)return;const le=xe.getBoundingClientRect(),be=window.innerWidth,Ue=window.innerHeight,ce=Math.min(384,be-16),fe=Math.max(8,Math.min(le.right-ce,be-ce-8));if(be<640){h.value={position:"fixed",left:"0.5rem",right:"0.5rem",width:"auto",top:C.value==="up"?"auto":`${le.bottom+8}px`,bottom:C.value==="up"?`${Ue-le.top+8}px`:"auto",zIndex:"120"};return}h.value={position:"fixed",width:`${ce}px`,left:`${fe}px`,top:C.value==="up"?"auto":`${le.bottom+8}px`,bottom:C.value==="up"?`${Ue-le.top+8}px`:"auto",zIndex:"120"}}function V(){n.disabled||(u.value=!u.value,u.value&&(f.value="",m.value=0,zt(()=>{var ae;zt(()=>{oe()}),(ae=s.value)==null||ae.focus()})))}function O(ae){r("toggle",ae.value,!I.value.has(ae.value)),u.value=!1}function ee(ae){B.value.length!==0&&(m.value=(m.value+ae+B.value.length)%B.value.length)}function se(){const ae=B.value[m.value];ae&&O(ae)}function Te(ae){if(!u.value)return;const xe=o.value,le=a.value;if(!xe)return;const be=ae.target;be instanceof Node&&(xe.contains(be)||le!=null&&le.contains(be)||(u.value=!1))}ft(f,()=>{m.value=0});function Fe(){u.value&&oe()}return Ga(()=>{window.addEventListener("pointerdown",Te),window.addEventListener("resize",Fe),window.addEventListener("scroll",Fe,!0)}),ds(()=>{window.removeEventListener("pointerdown",Te),window.removeEventListener("resize",Fe),window.removeEventListener("scroll",Fe,!0)}),(ae,xe)=>(S(),A("div",{ref_key:"rootRef",ref:o,class:"search-dropdown"},[p("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:V},[p("span",SA,E(F.value),1),je(Ms,{class:"search-dropdown-chevron"})],8,CA),(S(),rt(is,{to:"body"},[u.value?(S(),A("div",{key:0,ref_key:"menuRef",ref:a,class:Ze(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":C.value==="up","search-dropdown-menu-wrap-down":C.value==="down"}]),style:ea(h.value)},[p("div",xA,[p("div",AA,[Yt(p("input",{ref_key:"searchRef",ref:s,"onUpdate:modelValue":xe[0]||(xe[0]=le=>f.value=le),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[xe[1]||(xe[1]=tn(Ye(le=>u.value=!1,["prevent"]),["escape"])),tn(Ye(se,["prevent"]),["enter"]),xe[2]||(xe[2]=tn(Ye(le=>ee(1),["prevent"]),["arrow-down"])),xe[3]||(xe[3]=tn(Ye(le=>ee(-1),["prevent"]),["arrow-up"]))]},null,40,EA),[[on,f.value]]),e.createLabel?(S(),A("button",{key:0,class:"search-dropdown-create-icon",type:"button","aria-label":e.createLabel,title:e.createLabel,onClick:xe[4]||(xe[4]=le=>r("create"))}," + ",8,PA)):Z("",!0)]),e.createLabel?(S(),A("button",{key:0,class:"search-dropdown-create",type:"button",onClick:xe[5]||(xe[5]=le=>r("create"))},E(e.createLabel),1)):Z("",!0)]),B.value.length>0?(S(),A("ul",IA,[(S(!0),A(tt,null,an(B.value,(le,be)=>(S(),A("li",{key:le.value},[p("div",{class:Ze(["search-dropdown-option",{"is-selected":I.value.has(le.value),"is-highlighted":be===m.value}]),onPointerenter:Ue=>m.value=be},[p("button",{class:"search-dropdown-option-main",type:"button",onClick:Ue=>O(le)},[p("span",$A,E(I.value.has(le.value)?"✓":""),1),le.badge?(S(),A("span",{key:0,class:Ze(["search-dropdown-option-badge",le.badgeTone?`is-${le.badgeTone}`:""]),title:le.badgeLabel||le.badge,"aria-hidden":"true"},E(le.badge),11,jA)):Z("",!0),p("span",LA,[p("span",NA,[p("span",OA,E(le.label),1),le.badgeLabel?(S(),A("span",DA,E(le.badgeLabel),1)):Z("",!0)]),le.description?(S(),A("span",FA,E(le.description),1)):Z("",!0)])],8,MA),e.allowRemove&&le.removable?(S(),A("button",{key:0,class:"search-dropdown-option-remove",type:"button","aria-label":`${e.removeLabel} ${le.label}`,title:`${e.removeLabel} ${le.label}`,onClick:Ye(Ue=>r("remove",le.value),["stop"])}," × ",8,UA)):Z("",!0)],42,RA)]))),128))])):(S(),A("div",BA,E(T(y)("No results")),1))],6)):Z("",!0)]))],512))}}),HA=At(qA,[["__scopeId","data-v-ea9577fa"]]),zA={key:0,class:"thread-composer-dictation-error"},WA={key:0,class:"thread-composer-attachments"},VA=["src","alt"],GA=["aria-label","disabled","onClick"],KA={key:1,class:"thread-composer-folder-chips"},YA=["title"],JA={class:"thread-composer-folder-chip-meta"},QA=["aria-label","disabled","onClick"],XA={key:2,class:"thread-composer-file-chips"},ZA=["title"],eE=["aria-label","disabled","onClick"],tE={key:3,class:"thread-composer-skill-chips"},nE=["title","aria-label","onClick"],rE=["aria-label","onClick"],oE={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},aE={key:1,class:"thread-composer-file-mentions"},sE=["onMousedown"],iE={key:1,class:"thread-composer-file-mention-icon-markdown"},lE={class:"thread-composer-file-mention-text"},uE={class:"thread-composer-file-mention-name"},cE={key:0,class:"thread-composer-file-mention-dir"},dE={key:1,class:"thread-composer-file-mention-empty"},fE=["placeholder","disabled"],hE=["aria-label","title","disabled"],pE=["aria-label","disabled"],mE={key:0,class:"thread-composer-attach-menu"},vE=["disabled"],gE=["disabled"],yE=["disabled"],wE={class:"thread-composer-attach-mode"},bE={class:"thread-composer-attach-mode-label"},_E={class:"thread-composer-attach-mode-buttons"},kE=["disabled"],TE=["disabled"],CE=["aria-checked","aria-label","disabled"],SE={class:"thread-composer-attach-setting-copy"},xE={class:"thread-composer-attach-setting-label"},AE={class:"thread-composer-attach-setting-description"},EE=["aria-checked","aria-label","disabled"],PE={class:"thread-composer-attach-setting-copy"},IE={class:"thread-composer-attach-setting-label"},RE={class:"thread-composer-attach-setting-description"},ME={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},$E={key:1,class:"thread-composer-dictation-timer"},jE=["aria-label","title","disabled"],LE=["aria-label","title","disabled"],NE={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},OE=["aria-label","title","disabled"],DE=["disabled"],FE=["disabled"],UE=["disabled"],BE=2e3,Ac="prompt:",qE="codex-web-local.thread-draft.v1.",HE=er({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,o=n,{t:a}=fs(),s=x(""),u=x([]),f=x([]),m=x([]),h=x([]),y=x([]),C=x(""),I=x(0),F=x(null),B=x(!1),{state:oe,isSupported:V,recordingDurationMs:O,waveformCanvasRef:ee,startRecording:se,stopRecording:Te,toggleRecording:Fe,cancel:ae}=oA({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:R=>{if(s.value=s.value?`${s.value}
|
|
56
|
+
${R}`:R,C.value="",r.dictationAutoSend!==!1){const q=r.isTurnInProgress?Ve.value:"steer";Be(q);return}zt(()=>{var q;return(q=ce.value)==null?void 0:q.focus()})},onEmpty:()=>{C.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:R=>{if(R instanceof DOMException&&R.name==="NotAllowedError"){C.value="Microphone access was denied.";return}C.value=R instanceof Error?R.message:"Dictation failed."}}),xe=x(null),le=x(null),be=x(null),Ue=x(null),ce=x(null),{isMobile:fe}=Ed(),Se=x(!1),De=x(null),Ee=x(""),Re=x([]),Ie=x(!1),Qe=x(0),et=x(!1),Me=x(!1);let We=!1;const it=x(0);let ct=0,at=null,Je=!1,te=0,pe=0;const ve=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let ke="";const Xe=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}];function P(R){return R.trim().replace(/^gpt/i,"GPT")}const L=Q(()=>r.models.map(R=>({value:R,label:P(R)}))),W=Q(()=>r.selectedCollaborationMode==="plan"),D=Q(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),J=Q(()=>f.value.map(R=>R.path)),U=Q(()=>[...(r.skills??[]).map(R=>{const q=Kr(R);return{value:R.path,label:R.name,description:R.description,badge:q.badge,badgeLabel:q.badgeLabel,badgeTone:q.badgeTone,removable:!1}}),...m.value.map(R=>({value:so(R.path),label:R.name,description:R.description,badge:"T",badgeLabel:"Prompt",badgeTone:"prompt",removable:!0}))]),ge=Q(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||D.value||I.value>0?!1:s.value.trim().length>0||u.value.length>0||h.value.length>0),we=Q(()=>s.value.trim().length>0||u.value.length>0||f.value.length>0||h.value.length>0||y.value.length>0),_e=Q(()=>{const R=new Set;for(const q of y.value)for(const re of q.filePaths)R.add(re);return h.value.filter(q=>!R.has(q.fsPath))}),X=Q(()=>r.disabled||!r.activeThreadId),qe=Q(()=>r.disabled||!r.activeThreadId),Pe=Q(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(r.selectedModel.trim())),He=Q(()=>r.selectedSpeedMode==="fast"&&Pe.value),ze=Q(()=>X.value||r.isUpdatingSpeedMode===!0),nt=Q(()=>r.isUpdatingSpeedMode?a("Saving speed setting..."):r.selectedSpeedMode==="fast"?a("About 1.5x faster, with credits used at 2x"):a("Default speed with normal credit usage")),pt=Q(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),Ve=x(pt.value),wt=Q(()=>oe.value==="recording"),kt=Q(()=>oe.value==="recording"?a("Stop dictation"):r.dictationClickToToggle?a("Click to dictate"):a("Hold to dictate")),H=Q(()=>oe.value==="idle"?C.value.trim():""),G=Q(()=>{const R=Math.max(0,Math.floor(O.value/1e3)),q=Math.floor(R/60),re=R%60;return`${q}:${String(re).padStart(2,"0")}`}),K=Q(()=>r.activeThreadId?D.value?a("Loading models for plan mode..."):a("Type a message... (@ for files)"):a("Select a thread to send a message")),he=Q(()=>s.value.trim().length>0||u.value.length>0||h.value.length>0),Ae=Q(()=>s.value.split(`
|
|
57
|
+
`).length),Ne=Q(()=>et.value||Ae.value>=6||Me.value);function Be(R="steer"){var re;const q=s.value.trim();if(ge.value){if(o("submit",{text:q,imageUrls:u.value.map(Le=>Le.url),fileAttachments:[...h.value],skills:f.value.map(Le=>({name:Le.name,path:Le.path})),mode:R}),fr(r.activeThreadId),Jt(),et.value=!1,y.value=[],Se.value=!1,Et(),ve||fe.value){(re=ce.value)==null||re.blur();return}zt(()=>{var Le;return(Le=ce.value)==null?void 0:Le.focus()})}}function Ct(R){Ve.value=R}function Oe(R){it.value+=1,s.value=R.text,u.value=R.imageUrls.map((q,re)=>({id:`queued-${Date.now()}-${re}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${re+1}`,url:q})),f.value=R.skills.map(q=>(r.skills??[]).find(re=>re.path===q.path)??{name:q.name,displayName:void 0,description:"",path:q.path}),h.value=R.fileAttachments.map(q=>({...q})),y.value=[],C.value="",F.value=null,I.value=0,Se.value=!1,Et(),pe+=1}function Jt(){Oe({text:"",imageUrls:[],fileAttachments:[],skills:[]}),et.value=!1}function Mt(R){return`${qE}${R}`}function la(R){if(typeof window>"u")return null;const q=R.trim();if(!q)return null;try{const re=window.localStorage.getItem(Mt(q));if(!re)return null;const Le=JSON.parse(re);return typeof Le=="string"?{text:Le,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Le.text=="string"?Le.text:"",imageUrls:Array.isArray(Le.imageUrls)?Le.imageUrls.filter(bt=>typeof bt=="string"):[],fileAttachments:Array.isArray(Le.fileAttachments)?Le.fileAttachments.filter(bt=>!!bt&&typeof bt.label=="string"&&typeof bt.path=="string"&&typeof bt.fsPath=="string"):[],skills:Array.isArray(Le.skills)?Le.skills.filter(bt=>!!bt&&typeof bt.name=="string"&&typeof bt.path=="string"):[]}}catch{return null}}function to(R,q){if(typeof window>"u")return;const re=R.trim();if(re)try{if(q.text.trim().length>0||q.imageUrls.length>0||q.fileAttachments.length>0||q.skills.length>0){window.localStorage.setItem(Mt(re),JSON.stringify(q));return}window.localStorage.removeItem(Mt(re))}catch{}}function fr(R){to(R,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Ar(){return{text:s.value,imageUrls:u.value.map(R=>R.url),fileAttachments:h.value.map(R=>({...R})),skills:f.value.map(R=>({name:R.name,path:R.path}))}}function no(){o("interrupt")}function Dt(){const R=ce.value;if(!R){Me.value=!1;return}Me.value=R.scrollHeight>R.clientHeight+2}function Qt(){We||(We=!0,zt(()=>{We=!1,Dt()}))}function ro(){X.value||(et.value=!et.value,Qt(),zt(()=>{var R;return(R=ce.value)==null?void 0:R.focus()}))}function Er(R){o("update:selected-model",R)}function $n(){o("update:selected-collaboration-mode",W.value?"default":"plan")}function Br(R){o("update:selected-reasoning-effort",R)}function ua(){ze.value||o("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function tr(){r.dictationClickToToggle&&(C.value&&(C.value=""),Fe())}function hr(R){if(r.dictationClickToToggle||(R.preventDefault(),Je))return;Je=!0;const q=R.currentTarget;if(q)try{q.setPointerCapture(R.pointerId)}catch{}C.value&&(C.value=""),window.addEventListener("pointerup",fn),window.addEventListener("pointercancel",fn),window.addEventListener("blur",fn),se()}function fn(){r.dictationClickToToggle||Je&&(Je=!1,window.removeEventListener("pointerup",fn),window.removeEventListener("pointercancel",fn),window.removeEventListener("blur",fn),Te())}function xo(){X.value||(Se.value=!Se.value)}function Dn(){var R;(R=le.value)==null||R.click()}function Ao(){var R;(R=be.value)==null||R.click()}function Aa(){var R;(R=Ue.value)==null||R.click()}function Eo(R){u.value=u.value.filter(q=>q.id!==R)}function ca(R){f.value=f.value.filter(q=>q.path!==R)}function Po(R){const q=R.trim();return q?q.endsWith("/SKILL.md")?q:`${q.replace(/\/+$/,"")}/SKILL.md`:""}function Ea(R){const q=Po(R.path);!q||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(q)}`,"_blank","noopener,noreferrer")}function sn(R){h.value=h.value.filter(q=>q.fsPath!==R)}function lt(R){const q=y.value.find(Le=>Le.id===R);if(!q)return;const re=new Set(q.filePaths);h.value=h.value.filter(Le=>!re.has(Le.fsPath)),y.value=y.value.filter(Le=>Le.id!==R)}function Fn(R){return R.total<=0?0:Math.round(R.processed/R.total*100)}function _n(R,q){const re=R.replace(/\\/g,"/");if(h.value.some(Zt=>Zt.fsPath===re))return;const Le=re.split("/").filter(Boolean),bt=(q==null?void 0:q.trim())||Le[Le.length-1]||re;h.value=[...h.value,{label:bt,path:re,fsPath:re}]}function da(R){return R.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(R.name)}function un(R){return R?Array.from(R):[]}function qr(R){return R!==pe?!1:(I.value+=1,!0)}function An(R){R===pe&&(I.value=Math.max(0,I.value-1))}function hn(R){if(R<=0)return;const q=F.value,re=q?q.succeeded+q.failed:0;if(!q||re>=q.total){F.value={total:R,succeeded:0,failed:0};return}F.value={...q,total:q.total+R}}function gt(R){const q=F.value;q&&(F.value={...q,succeeded:q.succeeded+(R==="success"?1:0),failed:q.failed+(R==="failure"?1:0)})}function cn(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Lt(R){const q=new Date,re=[q.getFullYear(),String(q.getMonth()+1).padStart(2,"0"),String(q.getDate()).padStart(2,"0"),String(q.getHours()).padStart(2,"0"),String(q.getMinutes()).padStart(2,"0"),String(q.getSeconds()).padStart(2,"0")].join("-"),Le=R.type.startsWith("image/")&&R.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${re}.${Le}`}function jn(){const R=new Date;return`pasted-text-${[R.getFullYear(),String(R.getMonth()+1).padStart(2,"0"),String(R.getDate()).padStart(2,"0"),String(R.getHours()).padStart(2,"0"),String(R.getMinutes()).padStart(2,"0"),String(R.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Hr(R){return R.name.trim()?R:new File([R],Lt(R),{type:R.type||"image/png",lastModified:Date.now()})}async function Un(R,q){if(qr(q))try{const re=Hr(R),Le=await kc(re);if(q!==pe)return;if(!Le){gt("failure");return}u.value=[...u.value,{id:cn(),name:re.name,url:`/codex-local-image?path=${encodeURIComponent(Le)}`}],gt("success")}catch{q===pe&>("failure")}finally{An(q)}}async function Ln(R,q){if(qr(q))try{const re=await kc(R);if(q!==pe)return;if(!re){gt("failure");return}_n(re),gt("success")}catch{q===pe&>("failure")}finally{An(q)}}function kn(R){const q=un(R);if(q.length===0)return;hn(q.length),Se.value=!1,Et();const re=pe;for(const Le of q)da(Le)?Un(Le,re):Ln(Le,re)}function pr(){te=0,B.value=!1}function Pr(R){return R?Array.from(R.types??[]).includes("Files"):!1}async function Io(R){if(!R||R.length===0)return;const q=it.value,re=Array.from(R),bt=(re[0].webkitRelativePath||re[0].name).split("/").filter(Boolean)[0]||"Folder",Zt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;y.value=[...y.value,{id:Zt,name:bt,total:re.length,processed:0,filePaths:[],isUploading:!0}];const Rt=Ht=>{q===it.value&&(y.value=y.value.map(en=>en.id===Zt?Ht(en):en))};for(const Ht of re)try{const en=await kc(Ht);if(q!==it.value)return;if(en){const zn=Ht.webkitRelativePath||Ht.name;_n(en,zn),Rt(or=>({...or,processed:or.processed+1,filePaths:[...or.filePaths,en]}));continue}Rt(zn=>({...zn,processed:zn.processed+1}))}catch{Rt(en=>({...en,processed:en.processed+1}))}Rt(Ht=>({...Ht,isUploading:!1}))}function Nn(R){R&&(R.value="")}function Ro(R){const q=R.target;kn((q==null?void 0:q.files)??null),Nn(q),Se.value=!1}function Bn(R){const q=R.target;kn((q==null?void 0:q.files)??null),Nn(q),Se.value=!1}function oo(R){const q=R.target;Io((q==null?void 0:q.files)??null),Nn(q),Se.value=!1}function Mo(R){X.value||!Pr(R.dataTransfer)||(R.preventDefault(),te+=1,B.value=!0)}function ao(R){X.value||!Pr(R.dataTransfer)||(R.preventDefault(),R.dataTransfer&&(R.dataTransfer.dropEffect="copy"),B.value=!0)}function Ir(R){B.value&&(R.preventDefault(),te=Math.max(0,te-1),te===0&&pr())}function zr(R){var q;X.value||!Pr(R.dataTransfer)||(R.preventDefault(),pr(),kn(((q=R.dataTransfer)==null?void 0:q.files)??null))}function mr(){!B.value&&te===0||pr()}function vr(R){var Zt,Rt;if(X.value)return;const q=((Zt=R.clipboardData)==null?void 0:Zt.getData("text/plain"))??"";if(q.length>=BE){R.preventDefault();const Ht=new File([q],jn(),{type:"text/plain",lastModified:Date.now()});kn([Ht]);return}const re=Array.from(((Rt=R.clipboardData)==null?void 0:Rt.items)??[]);if(re.length===0)return;const Le=q.length>0,bt=re.filter(Ht=>Ht.kind==="file"&&Ht.type.startsWith("image/")).map(Ht=>Ht.getAsFile()).filter(Ht=>Ht instanceof File);bt.length!==0&&(Le||R.preventDefault(),kn(bt))}function $o(){C.value&&(C.value=""),Qt(),Sn()}function gr(R){if(Ie.value){if(R.key==="Escape"){R.preventDefault(),Et();return}if(R.key==="ArrowDown"){R.preventDefault(),Re.value.length>0&&(Qe.value=(Qe.value+1)%Re.value.length);return}if(R.key==="ArrowUp"){if(R.preventDefault(),Re.value.length>0){const re=Re.value.length;Qe.value=(Qe.value+re-1)%re}return}if(R.key==="Enter"||R.key==="Tab"){R.preventDefault();const re=Re.value[Qe.value];re?Vr(re):Et();return}}if(r.sendWithEnter!==!1?R.key==="Enter"&&!R.shiftKey:R.key==="Enter"&&(R.metaKey||R.ctrlKey)){R.preventDefault(),Be(r.isTurnInProgress?Ve.value:"steer");return}}function Et(){Ie.value=!1,De.value=null,Ee.value="",Re.value=[],Qe.value=0}function Sn(){const R=ce.value;if(!R){Et();return}const q=R.selectionStart??s.value.length,Le=s.value.slice(0,q).match(/(^|\s)(@[^\s@]*)$/);if(!Le){Et();return}const bt=Le[2]??"",Zt=bt.length,Rt=q-Zt;De.value=Rt,Ee.value=bt.slice(1),Ie.value=!0,Wr()}async function Wr(){if(!Ie.value)return;const R=(r.cwd??"").trim();if(!R){Re.value=[];return}at&&clearTimeout(at);const q=++ct;at=setTimeout(async()=>{try{const re=await QT(R,Ee.value,20);if(!Ie.value||q!==ct)return;Re.value=re,Qe.value=0}catch{if(!Ie.value||q!==ct)return;Re.value=[]}},120)}function Vr(R){const q=ce.value,re=De.value;if(re!==null&&q){const Le=q.selectionStart??s.value.length;s.value=`${s.value.slice(0,re)}${s.value.slice(Le)}`.trimEnd()}_n(R.path),Et(),zt(()=>q==null?void 0:q.focus())}function qn(R){ae(),Oe(R),zt(()=>{var q;(q=ce.value)==null||q.focus(),Dt()})}function Xt(R){const q=R.trim();q&&(ae(),s.value.trim().length>0?s.value=`${s.value.trimEnd()}
|
|
58
|
+
${q}`:s.value=q,zt(()=>{var re;return(re=ce.value)==null?void 0:re.focus()}))}async function nr(){m.value=await cC()}function so(R){return`${Ac}${R}`}function Rr(R){return R.startsWith(Ac)?R.slice(Ac.length):null}async function rr(){var Le;const R=((Le=window.prompt(a("Prompt name")))==null?void 0:Le.trim())??"";if(!R)return;const q=window.prompt(a("Prompt content"))??"";if(!q.trim())return;const re=await dC(R,q);re&&(await nr(),Xt(re.content))}async function mn(R){const q=Rr(R)??R,re=m.value.find(Zt=>Zt.path===q);!window.confirm(re?`${a("Remove prompt")} "${re.name}"?`:a("Remove prompt"))||!await fC(q)||await nr()}function Pt(R){const q=m.value.find(re=>re.path===R);q&&Xt(q.content)}function En(R){const q=R.lastIndexOf("/");return q<0?R:R.slice(q+1)}function $t(R){const q=R.lastIndexOf("/");return q<=0?"":R.slice(0,q)}function It(R){const q=En(R),re=q.lastIndexOf(".");return re<=0?"":q.slice(re+1).toLowerCase()}function Hn(R){const q=It(R);return q==="ts"?"TS":q==="tsx"?"TSX":q==="js"?"JS":q==="jsx"?"JSX":q==="json"?"{}":""}function io(R){const q=It(R);return q.startsWith("ts")?"ts":q.startsWith("js")?"js":q==="json"?"json":"default"}function Gr(R){const q=It(R);return q==="md"||q==="mdx"}function Kr(R){return R.path.toLowerCase().includes("/plugins/cache/")?{badge:"P",badgeLabel:"Plugin",badgeTone:"plugin"}:R.scope==="repo"?{badge:"R",badgeLabel:"Repo",badgeTone:"repo"}:R.scope==="system"?{badge:"S",badgeLabel:"System",badgeTone:"system"}:{badge:"U",badgeLabel:"User",badgeTone:"user"}}function fa(R,q){const re=Rr(R);if(re){Pt(re);return}if(q){const Le=(r.skills??[]).find(bt=>bt.path===R);Le&&!f.value.some(bt=>bt.path===R)&&(f.value=[...f.value,Le])}else f.value=f.value.filter(Le=>Le.path!==R)}function Nt(R){if(!Se.value)return;const q=xe.value;if(!q)return;const re=R.target;!re||q.contains(re)||(Se.value=!1)}return Ga(()=>{document.addEventListener("click",Nt),window.addEventListener("drop",mr),window.addEventListener("dragend",mr),window.addEventListener("blur",mr),nr(),Qt()}),t({hydrateDraft:qn,appendTextToDraft:Xt,hasUnsavedDraft:()=>we.value}),ds(()=>{document.removeEventListener("click",Nt),window.removeEventListener("drop",mr),window.removeEventListener("dragend",mr),window.removeEventListener("blur",mr),window.removeEventListener("pointerup",fn),window.removeEventListener("pointercancel",fn),window.removeEventListener("blur",fn),at&&clearTimeout(at)}),ft(()=>r.activeThreadId,R=>{ae(),ke&&to(ke,Ar()),Jt();const q=la(R);q&&(Oe(q),$o()),ke=R.trim()},{immediate:!0}),ft([s,u,h,f],()=>{ke&&to(ke,Ar())},{deep:!0}),ft(s,()=>{Qt()}),ft(()=>r.cwd,()=>{Ie.value&&Wr()}),ft(pt,R=>{Ve.value=R}),(R,q)=>(S(),A("form",{class:"thread-composer",onSubmit:q[4]||(q[4]=Ye(re=>Be(e.isTurnInProgress?Ve.value:"steer"),["prevent"]))},[H.value?(S(),A("p",zA,E(H.value),1)):Z("",!0),p("div",{class:Ze(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":B.value}])},[u.value.length>0?(S(),A("div",WA,[(S(!0),A(tt,null,an(u.value,re=>(S(),A("div",{key:re.id,class:"thread-composer-attachment"},[p("img",{class:"thread-composer-attachment-image",src:re.url,alt:re.name||"Selected image"},null,8,VA),p("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${re.name||"image"}`,disabled:X.value,onClick:Le=>Eo(re.id)}," x ",8,GA)]))),128))])):Z("",!0),y.value.length>0?(S(),A("div",KA,[(S(!0),A(tt,null,an(y.value,re=>(S(),A("span",{key:re.id,class:"thread-composer-folder-chip"},[je(jd,{class:"thread-composer-folder-chip-icon"}),p("span",{class:"thread-composer-folder-chip-name",title:re.name},E(re.name),9,YA),p("span",JA,[re.isUploading?(S(),A(tt,{key:0},[Ns(E(Fn(re))+"% uploading ("+E(re.processed)+"/"+E(re.total)+") ",1)],64)):(S(),A(tt,{key:1},[Ns(E(re.filePaths.length)+" file"+E(re.filePaths.length===1?"":"s"),1)],64))]),p("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${re.name}`,disabled:X.value,onClick:Le=>lt(re.id)},"×",8,QA)]))),128))])):Z("",!0),_e.value.length>0?(S(),A("div",XA,[(S(!0),A(tt,null,an(_e.value,re=>(S(),A("span",{key:re.fsPath,class:"thread-composer-file-chip"},[je(Ci,{class:"thread-composer-file-chip-icon"}),p("span",{class:"thread-composer-file-chip-name",title:re.fsPath},E(re.label),9,ZA),p("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${re.label}`,disabled:X.value,onClick:Le=>sn(re.fsPath)},"×",8,eE)]))),128))])):Z("",!0),f.value.length>0?(S(),A("div",tE,[(S(!0),A(tt,null,an(f.value,re=>(S(),A("span",{key:re.path,class:"thread-composer-skill-chip"},[p("button",{class:"thread-composer-skill-chip-name",type:"button",title:Po(re.path),"aria-label":`Open ${re.displayName||re.name} SKILL.md`,onClick:Le=>Ea(re)},E(re.displayName||re.name),9,nE),p("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${re.displayName||re.name}`,onClick:Le=>ca(re.path)},"×",8,rE)]))),128))])):Z("",!0),p("div",{class:Ze(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":B.value,"thread-composer-input-wrap--expanded":et.value}]),onDragenter:Mo,onDragover:ao,onDragleave:Ir,onDrop:zr},[B.value?(S(),A("div",oE,[...q[5]||(q[5]=[p("span",{class:"thread-composer-drop-overlay-copy"},"Drop images or files",-1)])])):Z("",!0),Ie.value?(S(),A("div",aE,[Re.value.length>0?(S(!0),A(tt,{key:0},an(Re.value,(re,Le)=>(S(),A("button",{key:re.path,class:Ze(["thread-composer-file-mention-row",{"is-active":Le===Qe.value}]),type:"button",onMousedown:Ye(bt=>Vr(re),["prevent"])},[Hn(re.path)?(S(),A("span",{key:0,class:Ze(["thread-composer-file-mention-icon-badge",`is-${io(re.path)}`])},E(Hn(re.path)),3)):Gr(re.path)?(S(),A("span",iE,"↓")):(S(),rt(Ci,{key:2,class:"thread-composer-file-mention-icon-file"})),p("span",lE,[p("span",uE,E(En(re.path)),1),$t(re.path)?(S(),A("span",cE,E($t(re.path)),1)):Z("",!0)])],42,sE))),128)):(S(),A("div",dE,E(T(a)("No matching files")),1))])):Z("",!0),Yt(p("textarea",{ref_key:"inputRef",ref:ce,"onUpdate:modelValue":q[0]||(q[0]=re=>s.value=re),class:"thread-composer-input",placeholder:K.value,disabled:X.value,onInput:$o,onKeydown:gr,onPaste:vr},null,40,fE),[[on,s.value]]),Ne.value?(S(),A("button",{key:2,class:"thread-composer-expand",type:"button","aria-label":et.value?T(a)("Exit full screen composer"):T(a)("Expand composer"),title:et.value?T(a)("Exit full screen composer"):T(a)("Expand composer"),disabled:X.value,onClick:ro},[et.value?(S(),rt(bA,{key:0,class:"thread-composer-expand-icon"})):(S(),rt(fA,{key:1,class:"thread-composer-expand-icon"}))],8,hE)):Z("",!0)],34),p("div",{class:Ze(["thread-composer-controls",{"thread-composer-controls--recording":wt.value}])},[p("div",{ref_key:"attachMenuRootRef",ref:xe,class:"thread-composer-attach"},[p("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":T(a)("Add photos & files"),disabled:X.value,onClick:xo}," + ",8,pE),Se.value?(S(),A("div",mE,[p("button",{class:"thread-composer-attach-item",type:"button",disabled:X.value,onClick:Dn},E(T(a)("Add photos & files")),9,vE),p("button",{class:"thread-composer-attach-item",type:"button",disabled:X.value,onClick:Aa},E(T(a)("Add folder")),9,gE),p("button",{class:"thread-composer-attach-item",type:"button",disabled:X.value,onClick:Ao},E(T(a)("Take photo")),9,yE),q[6]||(q[6]=p("div",{class:"thread-composer-attach-separator"},null,-1)),p("div",wE,[p("span",bE,E(T(a)("In-progress send")),1),p("div",_E,[p("button",{class:Ze(["thread-composer-attach-mode-button",{"is-active":Ve.value==="steer"}]),type:"button",disabled:X.value,onClick:q[1]||(q[1]=re=>Ct("steer"))},E(T(a)("Steer")),11,kE),p("button",{class:Ze(["thread-composer-attach-mode-button",{"is-active":Ve.value==="queue"}]),type:"button",disabled:X.value,onClick:q[2]||(q[2]=re=>Ct("queue"))},E(T(a)("Queue")),11,TE)])]),q[7]||(q[7]=p("div",{class:"thread-composer-attach-separator"},null,-1)),Pe.value?(S(),A("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`${T(a)("Fast mode")} ${e.selectedSpeedMode==="fast"?T(a)("enabled"):T(a)("disabled")}`,disabled:ze.value,onClick:ua},[p("span",SE,[p("span",xE,E(T(a)("Fast mode")),1),p("span",AE,E(nt.value),1)]),p("span",{class:Ze(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":ze.value}])},null,2)],8,CE)):Z("",!0),p("button",{class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":W.value,"aria-label":W.value?T(a)("Disable plan mode"):T(a)("Enable plan mode"),disabled:qe.value,onClick:$n},[p("span",PE,[p("span",IE,E(T(a)("Plan mode")),1),p("span",RE,E(T(a)("Agent proposes a plan before acting")),1)]),p("span",{class:Ze(["thread-composer-attach-switch",{"is-on":W.value}])},null,2)],8,EE)])):Z("",!0)],512),wt.value?Z("",!0):(S(),A(tt,{key:0},[je(Ur,{class:"thread-composer-control","model-value":e.selectedModel,options:L.value,"selected-prefix-icon":He.value?Xo:null,placeholder:T(a)("Model"),"open-direction":"up",disabled:qe.value||e.models.length===0,"enable-search":"","search-placeholder":T(a)("Search models..."),"onUpdate:modelValue":Er},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),je(HA,{class:"thread-composer-control",options:U.value,"selected-values":J.value,placeholder:T(a)("Skills"),"search-placeholder":T(a)("Search skills and prompts..."),"create-label":T(a)("Add new prompt"),"allow-remove":!0,"remove-label":T(a)("Remove prompt"),"open-direction":"up",disabled:qe.value,onToggle:fa,onCreate:rr,onRemove:mn},null,8,["options","selected-values","placeholder","search-placeholder","create-label","remove-label","disabled"]),je(Ur,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Xe,placeholder:T(a)("Thinking"),"open-direction":"up",disabled:qe.value,"onUpdate:modelValue":Br},null,8,["model-value","placeholder","disabled"])],64)),p("div",{class:Ze(["thread-composer-actions",{"thread-composer-actions--recording":wt.value}])},[T(oe)==="recording"?(S(),A("div",ME,[p("canvas",{ref_key:"dictationWaveformCanvasRef",ref:ee,class:"thread-composer-dictation-waveform"},null,512)])):Z("",!0),T(oe)==="recording"?(S(),A("span",$E,E(G.value),1)):Z("",!0),T(V)?(S(),A("button",{key:2,class:Ze(["thread-composer-mic",{"thread-composer-mic--active":T(oe)==="recording"}]),type:"button","aria-label":kt.value,title:kt.value,disabled:X.value,onClick:tr,onPointerdown:hr,onPointerup:fn,onPointercancel:fn},[T(oe)==="recording"?(S(),rt(dp,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(S(),rt(vA,{key:1,class:"thread-composer-mic-icon"}))],42,jE)):Z("",!0),e.isTurnInProgress&&!he.value?(S(),A("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?T(a)("Saving thread before stop is available"):T(a)("Stop"),title:e.isStopPending?T(a)("Saving thread before stop is available"):T(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending,onClick:no},[e.isStopPending?(S(),A("span",NE)):(S(),rt(dp,{key:1,class:"thread-composer-stop-icon"}))],8,LE)):(S(),A("button",{key:4,class:Ze(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ve.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&Ve.value==="queue"?T(a)("Queue message"):T(a)("Send message"),title:e.isTurnInProgress?`${T(a)("Send")} ${Ve.value==="queue"?T(a)("Queue"):T(a)("Steer")}`:T(a)("Send"),disabled:!ge.value,onClick:q[3]||(q[3]=re=>Be(e.isTurnInProgress?Ve.value:"steer"))},[je(lA,{class:"thread-composer-submit-icon"})],10,OE))],2)],2)],2),p("input",{ref_key:"photoLibraryInputRef",ref:le,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:X.value,onChange:Ro},null,40,DE),p("input",{ref_key:"cameraCaptureInputRef",ref:be,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:X.value,onChange:Bn},null,40,FE),p("input",{ref_key:"folderPickerInputRef",ref:Ue,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:X.value,onChange:oo},null,40,UE)],32))}}),fp=At(HE,[["__scopeId","data-v-ccbf96ca"]]),zE={key:0,class:"thread-pending-request"},WE={class:"thread-pending-request-title"},VE=["title"],GE={class:"thread-pending-request-approval"},KE=["aria-label"],YE=["aria-pressed","onClick"],JE={class:"thread-pending-request-option-index"},QE={class:"thread-pending-request-option-label"},XE={class:"thread-pending-request-footer thread-pending-request-footer--approval"},ZE=["value","placeholder"],eP={class:"thread-pending-request-header"},tP={class:"thread-pending-request-heading"},nP={class:"thread-pending-request-eyebrow"},rP={class:"thread-pending-request-title"},oP={key:0,class:"thread-pending-request-counter"},aP={key:0,class:"thread-pending-request-preview"},sP={class:"thread-pending-request-preview-code"},iP={key:1,class:"thread-pending-request-user-input"},lP={key:0,class:"thread-pending-request-question-description"},uP=["href"],cP={class:"thread-pending-request-question-title"},dP={key:0},fP={key:0,class:"thread-pending-request-question-text"},hP={key:1,class:"thread-pending-request-input-wrap"},pP={class:"thread-pending-request-select-label"},mP=["type","value","onInput"],vP={key:2,class:"thread-pending-request-select-wrap"},gP={class:"thread-pending-request-select-label"},yP={key:3,class:"thread-pending-request-select-wrap"},wP={class:"thread-pending-request-select-label"},bP={key:4,class:"thread-pending-request-question-options"},_P=["checked","onChange"],kP={class:"thread-pending-request-checkbox-label"},TP={key:2,class:"thread-pending-request-validation-error"},CP={class:"thread-pending-request-footer"},SP={key:2,class:"thread-pending-request-user-input"},xP={class:"thread-pending-request-question-title"},AP={key:0,class:"thread-pending-request-question-text"},EP={key:1,class:"thread-pending-request-question-options"},PP={class:"thread-pending-request-select-wrap"},IP={class:"thread-pending-request-select-label"},RP={key:0,class:"thread-pending-request-question-description"},MP={key:2,class:"thread-pending-request-input-wrap"},$P={class:"thread-pending-request-select-label"},jP=["value","placeholder","onInput"],LP={class:"thread-pending-request-footer"},NP={key:3,class:"thread-pending-request-actions"},OP={key:4,class:"thread-pending-request-actions"},DP=er({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,r=t,o=x("accept"),a=x(""),s=x({}),u=x({}),f=x({}),m=x(""),{t:h}=fs();function y(H){return H!==null&&typeof H=="object"&&!Array.isArray(H)?H:null}function C(H){return typeof H=="string"?H.trim():""}function I(H){return typeof H=="string"?H:null}function F(H){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(H)?H:JSON.stringify(H)}function B(H){const K=(Array.isArray(H.commandActions)?H.commandActions:[]).map(he=>y(he)).map(he=>C(he==null?void 0:he.command)).find(he=>he.length>0);if(K)return K.replace(/\s+/g," ").trim();if(Array.isArray(H.command)){const he=H.command.filter(Ae=>typeof Ae=="string").map(Ae=>Ae.trim()).filter(Ae=>Ae.length>0);if(he.length>0)return he.map(Ae=>F(Ae)).join(" ")}return xe(C(H.command))}function oe(H){return H.method==="item/commandExecution/requestApproval"||H.method==="execCommandApproval"}function V(H){return H.method==="item/fileChange/requestApproval"||H.method==="applyPatchApproval"}function O(H){return H.method==="item/permissions/requestApproval"}function ee(H){return oe(H)||V(H)||O(H)}function se(H){return H.method==="mcpServer/elicitation/request"}function Te(H){const G=y(H.params);return C(G==null?void 0:G.reason)||C(G==null?void 0:G.prompt)||C(G==null?void 0:G.message)}function Fe(H){return ee(H)?"Awaiting approval":se(H)?"MCP server input required":H.method==="item/tool/requestUserInput"?"Awaiting response":H.method==="item/tool/call"?"Tool call waiting for response":H.method}function ae(H){const G=Te(H);return G||(oe(H)?"Do you want to run this command?":V(H)?"Do you want to make these changes?":O(H)?"Do you want to grant these permissions?":se(H)?"An MCP server needs your input before Codex can continue.":H.method==="item/tool/requestUserInput"?"Codex needs your answer before it can continue.":"Codex is waiting for a response before it can continue.")}function xe(H){var Ne;const G=H.trim();if(!G)return"";const K=G.match(/-Command\s+(.+)$/i),he=((Ne=K==null?void 0:K[1])==null?void 0:Ne.trim())??G;return(he.startsWith('"')&&he.endsWith('"')?he.slice(1,-1):he).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function le(H){const G=y(H.params);if(!G)return"";if(oe(H))return B(G);if(V(H)){const K=C(G.grantRoot)||C(G.grant_root);if(K)return K.replace(/\s+/g," ").trim();const he=y(G.fileChanges)??y(G.changes);if(!he)return"";const Ae=Object.keys(he).map(Ne=>Ne.trim()).filter(Ne=>Ne.length>0);return Ae.length===0?"":Ae.slice(0,3).join(", ")}return O(H)?be(G.permissions):se(H)?C(G.serverName)||C(G.url):""}function be(H){const G=y(H);if(!G)return"";const K=[],he=y(G.fileSystem),Ae=y(G.network),Ne=Array.isArray(he==null?void 0:he.read)?he.read.filter(Ct=>typeof Ct=="string"):[],Be=Array.isArray(he==null?void 0:he.write)?he.write.filter(Ct=>typeof Ct=="string"):[];return Ne.length>0&&K.push(`Read: ${Ne.join(", ")}`),Be.length>0&&K.push(`Write: ${Be.join(", ")}`),(Ae==null?void 0:Ae.enabled)===!0&&K.push("Network access"),K.join(" • ")}function Ue(H){return!H||!ee(H)?[]:[{id:"accept",label:"Yes"},{id:"acceptForSession",label:"Yes for Session"}]}const ce=Q(()=>Ue(n.request));ft(()=>{var H;return((H=n.request)==null?void 0:H.id)??0},()=>{var H;a.value="",s.value={},u.value={},f.value={},m.value="",o.value=((H=ce.value[0])==null?void 0:H.id)??"accept"},{immediate:!0}),ft(ce,H=>{var G;o.value!=="decline"&&(H.some(K=>K.id===o.value)||(o.value=((G=H[0])==null?void 0:G.id)??"accept"))},{immediate:!0});function fe(H,G){return`${String(H)}:${G}`}function Se(H){const G=y(H.params),K=Array.isArray(G==null?void 0:G.questions)?G.questions:[],he=[];for(const Ae of K){const Ne=y(Ae);if(!Ne)continue;const Be=C(Ne.id);if(!Be)continue;const Ct=Array.isArray(Ne.options)?Ne.options.map(Oe=>y(Oe)).map(Oe=>({label:C(Oe==null?void 0:Oe.label),description:C(Oe==null?void 0:Oe.description)})).filter(Oe=>Oe.label.length>0):[];he.push({id:Be,header:C(Ne.header),question:C(Ne.question),isOther:Ne.isOther===!0,options:Ct})}return he}function De(H,G,K){const he=fe(H,G),Ae=s.value[he];return typeof Ae=="string"&&Ae.length>0?Ae:K}function Ee(H,G){return u.value[fe(H,G)]??""}function Re(H,G,K){const he=fe(H,G);s.value={...s.value,[he]:K}}function Ie(H){return H.options.map(G=>({value:G.label,label:G.label}))}function Qe(H,G,K){const he=K.target;if(!(he instanceof HTMLInputElement))return;const Ae=fe(H,G);u.value={...u.value,[Ae]:he.value}}function et(H,G,K){var Ae,Ne;const he=De(H,G,((Ae=K[0])==null?void 0:Ae.label)||"");return((Ne=K.find(Be=>Be.label===he))==null?void 0:Ne.description)??""}function Me(H,G){return`${String(H)}:${G}`}function We(H){var G;return C((G=y(H.params))==null?void 0:G.serverName)}function it(H){var K;const G=C((K=y(H.params))==null?void 0:K.url);if(!G)return"";try{const he=new URL(G),Ae=he.protocol.toLowerCase();return Ae==="https:"||Ae==="http:"?he.toString():""}catch{return""}}function ct(H){const G=y(H.params),K=y(G==null?void 0:G.requestedSchema),he=y(K==null?void 0:K.properties);if(!he)return[];const Ae=new Set(Array.isArray(K==null?void 0:K.required)?K.required.filter(Ne=>typeof Ne=="string"):[]);return Object.entries(he).map(([Ne,Be])=>at(Ne,y(Be),Ae.has(Ne))).filter(Ne=>Ne!==null)}function at(H,G,K){if(!G)return null;const he=C(G.title)||H,Ae=C(G.description),Ne=C(G.type);if(Ne==="boolean")return{key:H,label:he,description:Ae,required:K,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof G.default=="boolean"?G.default:null,hasExplicitDefault:typeof G.default=="boolean"};if(Ne==="number"||Ne==="integer")return{key:H,label:he,description:Ae,required:K,kind:"number",inputType:"number",options:[],defaultValue:typeof G.default=="number"?G.default:null,hasExplicitDefault:typeof G.default=="number"};const Be=Je(G);if(Ne==="array")return{key:H,label:he,description:Ae,required:K,kind:"multiEnum",inputType:"checkbox",options:Be,defaultValue:Array.isArray(G.default)?G.default.filter(Oe=>typeof Oe=="string"):[],hasExplicitDefault:Array.isArray(G.default)};const Ct=I(G.default);return Be.length>0?{key:H,label:he,description:Ae,required:K,kind:"singleEnum",inputType:"select",options:Be,defaultValue:Ct,hasExplicitDefault:Ct!==null}:{key:H,label:he,description:Ae,required:K,kind:"string",inputType:te(G),options:[],defaultValue:Ct,hasExplicitDefault:Ct!==null}}function Je(H){const K=(Array.isArray(H.oneOf)?H.oneOf:Array.isArray(H.anyOf)?H.anyOf:[]).map(Be=>y(Be)).map(Be=>({value:C(Be==null?void 0:Be.const),label:C(Be==null?void 0:Be.title)||C(Be==null?void 0:Be.const)})).filter(Be=>Be.value.length>0);if(K.length>0)return K;const he=y(H.items);if(he){const Be=Je(he);if(Be.length>0)return Be}const Ae=Array.isArray(H.enum)?H.enum.filter(Be=>typeof Be=="string"):[],Ne=Array.isArray(H.enumNames)?H.enumNames.filter(Be=>typeof Be=="string"):[];return Ae.map((Be,Ct)=>({value:Be,label:Ne[Ct]||Be}))}function te(H){const G=C(H.format);return G==="email"?"email":G==="uri"?"url":G==="date"?"date":G==="date-time"?"datetime-local":"text"}function pe(H,G){const K=f.value[Me(H,G.key)];return K!==void 0?K:G.defaultValue}function ve(H,G){const K=pe(H,G);return Array.isArray(K)?K.filter(he=>typeof he=="string"):[]}function ke(H,G,K){const he=K.target;he instanceof HTMLInputElement&&Xe(H,G,he.value)}function Xe(H,G,K){const he=(G.kind==="number",K);f.value={...f.value,[Me(H,G.key)]:K.length>0?he:null},m.value=""}function P(H,G,K){let he=null;K==="true"?he=!0:K==="false"&&(he=!1),f.value={...f.value,[Me(H,G.key)]:he},m.value=""}function L(H,G,K,he){const Ae=he.target;if(!(Ae instanceof HTMLInputElement))return;const Ne=new Set(ve(H,G));Ae.checked?Ne.add(K):Ne.delete(K),f.value={...f.value,[Me(H,G.key)]:Array.from(Ne)},m.value=""}function W(H){return H===!0?"true":H===!1?"false":""}function D(H){const G=[{value:"true",label:h("True")},{value:"false",label:h("False")}];return H.hasExplicitDefault||G.unshift({value:"",label:h("Select true or false")}),G}function J(H){const G=H.options.map(K=>({value:K.value,label:K.label}));return H.hasExplicitDefault||G.unshift({value:"",label:h("Select an option")}),G}function U(H,G){const K=pe(H,G);return G.kind==="multiEnum"?Array.isArray(K)&&K.length>0:G.kind==="boolean"?typeof K=="boolean":G.kind==="number"&&typeof K=="number"?!0:typeof K=="string"&&K.trim().length>0}function ge(H){const G=ct(H).filter(K=>K.required&&!U(H.id,K)).map(K=>K.label);return G.length===0?"":G.length===1?`Answer the required field: ${G[0]}.`:`Answer the required fields: ${G.join(", ")}.`}function we(H){const G={};for(const K of ct(H)){const he=pe(H.id,K);if(K.kind==="multiEnum"){const Ne=Array.isArray(he)?he:[];(Ne.length>0||K.required)&&(G[K.key]=Ne);continue}if(K.kind==="boolean"){typeof he=="boolean"&&(G[K.key]=he);continue}if(K.kind==="number"){const Ne=typeof he=="number"?he:Number(String(he).trim());Number.isNaN(Ne)||(G[K.key]=Ne);continue}const Ae=String(he??"").trim();(Ae.length>0||K.required)&&(G[K.key]=Ae)}return G}function _e(H){o.value=H}function X(){o.value="decline"}function qe(H){const G=H.target;G instanceof HTMLInputElement&&(a.value=G.value,o.value="decline")}function Pe(H,G){var K;if(O(H)){if(G==="decline"||G==="cancel"){r("respondServerRequest",{id:H.id,error:{code:-32e3,message:G==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const he=y((K=y(H.params))==null?void 0:K.permissions)??{};r("respondServerRequest",{id:H.id,result:{permissions:he,scope:G==="acceptForSession"?"session":"turn"}});return}r("respondServerRequest",{id:H.id,result:{decision:G}})}function He(H){const G=a.value.trim(),K=G.length>0?"decline":o.value;if(O(H)){Pe(H,K);return}r("respondServerRequest",{id:H.id,result:{decision:K},followUpMessageText:G||void 0})}function ze(H,G){const K=y(H.params),he={action:G};if(G==="accept"&&C(K==null?void 0:K.mode)==="form"){const Ae=ge(H);if(Ae){m.value=Ae;return}he.content=we(H)}r("respondServerRequest",{id:H.id,result:he})}function nt(H){var he;const G=Se(H),K={};for(const Ae of G){const Ne=De(H.id,Ae.id,((he=Ae.options[0])==null?void 0:he.label)||""),Be=Ee(H.id,Ae.id).trim(),Ct=[Ne,Be].map(Oe=>Oe.trim()).filter(Oe=>Oe.length>0);K[Ae.id]={answers:Ct}}r("respondServerRequest",{id:H.id,result:{answers:K}})}function pt(H){r("respondServerRequest",{id:H.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function Ve(H){r("respondServerRequest",{id:H.id,result:{success:!0,contentItems:[]}})}function wt(H){r("respondServerRequest",{id:H.id,result:{}})}function kt(H){r("respondServerRequest",{id:H.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(H,G)=>e.request?(S(),A("section",zE,[p("article",{class:Ze(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[ee(e.request)?(S(),A(tt,{key:0},[p("p",WE,E(ae(e.request)),1),le(e.request)?(S(),A("p",{key:0,class:"thread-pending-request-command-line",title:le(e.request)},E(le(e.request)),9,VE)):Z("",!0),p("section",GE,[p("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":T(h)("Approval choices")},[(S(!0),A(tt,null,an(ce.value,(K,he)=>(S(),A("button",{key:K.id,type:"button",class:Ze(["thread-pending-request-option",{"is-selected":o.value===K.id}]),"aria-pressed":o.value===K.id,onClick:Ae=>_e(K.id)},[p("span",JE,E(he+1)+".",1),p("span",QE,E(K.label),1)],10,YE))),128))],8,KE),p("footer",XE,[p("label",{class:Ze(["thread-pending-request-inline-input",{"is-active":o.value==="decline"||a.value.length>0}])},[G[11]||(G[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:T(h)("No, and tell Codex what to do differently"),onFocus:X,onInput:qe,onKeydown:G[0]||(G[0]=tn(Ye(K=>He(e.request),["prevent"]),["enter"]))},null,40,ZE)],2),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[1]||(G[1]=K=>Pe(e.request,"cancel"))},E(T(h)("Skip")),1),p("button",{type:"button",class:"thread-pending-request-primary",onClick:G[2]||(G[2]=K=>He(e.request))},E(T(h)("Send")),1)])])],64)):(S(),A(tt,{key:1},[p("header",eP,[p("div",tP,[p("p",nP,E(Fe(e.request)),1),p("p",rP,E(ae(e.request)),1)]),(e.requestCount??0)>1?(S(),A("span",oP,E(e.requestCount??0)+" pending",1)):Z("",!0)]),le(e.request)?(S(),A("div",aP,[p("code",sP,E(le(e.request)),1)])):Z("",!0),e.request.method==="mcpServer/elicitation/request"?(S(),A("section",iP,[We(e.request)?(S(),A("p",lP,E(T(h)("Server"))+": "+E(We(e.request)),1)):Z("",!0),it(e.request)?(S(),A("a",{key:1,class:"thread-pending-request-link",href:it(e.request),target:"_blank",rel:"noopener noreferrer"},E(T(h)("Open authorization link")),9,uP)):Z("",!0),(S(!0),A(tt,null,an(ct(e.request),K=>(S(),A("div",{key:`${e.request.id}:${K.key}`,class:"thread-pending-request-question"},[p("p",cP,[Ns(E(K.label),1),K.required?(S(),A("span",dP," *")):Z("",!0)]),K.description?(S(),A("p",fP,E(K.description),1)):Z("",!0),K.kind==="string"||K.kind==="number"?(S(),A("label",hP,[p("span",pP,E(T(h)("Value")),1),p("input",{class:"thread-pending-request-input",type:K.inputType,value:String(pe(e.request.id,K)??""),onInput:he=>ke(e.request.id,K,he)},null,40,mP)])):K.kind==="boolean"?(S(),A("div",vP,[p("span",gP,E(T(h)("Choice")),1),je(Ur,{class:"thread-pending-request-dropdown","model-value":W(pe(e.request.id,K)),options:D(K),placeholder:T(h)("Select true or false"),"onUpdate:modelValue":he=>P(e.request.id,K,he)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):K.kind==="singleEnum"?(S(),A("div",yP,[p("span",wP,E(T(h)("Choice")),1),je(Ur,{class:"thread-pending-request-dropdown","model-value":String(pe(e.request.id,K)??""),options:J(K),placeholder:T(h)("Select an option"),"enable-search":"","search-placeholder":T(h)("Search options..."),"onUpdate:modelValue":he=>Xe(e.request.id,K,he)},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])])):(S(),A("div",bP,[(S(!0),A(tt,null,an(K.options,he=>(S(),A("label",{key:`${e.request.id}:${K.key}:${he.value}`,class:"thread-pending-request-checkbox-row"},[p("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:ve(e.request.id,K).includes(he.value),onChange:Ae=>L(e.request.id,K,he.value,Ae)},null,40,_P),p("span",kP,E(he.label),1)]))),128))]))]))),128)),m.value?(S(),A("p",TP,E(m.value),1)):Z("",!0),p("footer",CP,[p("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[3]||(G[3]=K=>ze(e.request,"cancel"))},E(T(h)("Cancel")),1),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[4]||(G[4]=K=>ze(e.request,"decline"))},E(T(h)("Decline")),1),p("button",{type:"button",class:"thread-pending-request-primary",onClick:G[5]||(G[5]=K=>ze(e.request,"accept"))},E(T(h)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(S(),A("section",SP,[(S(!0),A(tt,null,an(Se(e.request),K=>{var he;return S(),A("div",{key:`${e.request.id}:${K.id}`,class:"thread-pending-request-question"},[p("p",xP,E(K.header||K.question),1),K.question?(S(),A("p",AP,E(K.question),1)):Z("",!0),K.options.length>0?(S(),A("div",EP,[p("div",PP,[p("span",IP,E(T(h)("Choice")),1),je(Ur,{class:"thread-pending-request-dropdown","model-value":De(e.request.id,K.id,((he=K.options[0])==null?void 0:he.label)||""),options:Ie(K),placeholder:T(h)("Choice"),"onUpdate:modelValue":Ae=>Re(e.request.id,K.id,Ae)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),et(e.request.id,K.id,K.options)?(S(),A("p",RP,E(et(e.request.id,K.id,K.options)),1)):Z("",!0)])):Z("",!0),K.isOther?(S(),A("label",MP,[p("span",$P,E(T(h)("Other answer")),1),p("input",{class:"thread-pending-request-input",type:"text",value:Ee(e.request.id,K.id),placeholder:T(h)("Other answer"),onInput:Ae=>Qe(e.request.id,K.id,Ae)},null,40,jP)])):Z("",!0)])}),128)),p("footer",LP,[p("button",{type:"button",class:"thread-pending-request-primary",onClick:G[6]||(G[6]=K=>nt(e.request))},E(T(h)("Send")),1)])])):e.request.method==="item/tool/call"?(S(),A("section",NP,[p("button",{type:"button",class:"thread-pending-request-primary",onClick:G[7]||(G[7]=K=>pt(e.request))},E(T(h)("Fail Tool Call")),1),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[8]||(G[8]=K=>Ve(e.request))},E(T(h)("Success (Empty)")),1)])):(S(),A("section",OP,[p("button",{type:"button",class:"thread-pending-request-primary",onClick:G[9]||(G[9]=K=>wt(e.request))},E(T(h)("Return Empty Result")),1),p("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[10]||(G[10]=K=>kt(e.request))},E(T(h)("Reject Request")),1)]))],64))],2)])):Z("",!0)}}),FP=At(DP,[["__scopeId","data-v-6a4f0d22"]]),UP={key:0,class:"queued-messages"},BP={class:"queued-messages-inner"},qP=["onDragstart","onDragover","onDragleave","onDrop"],HP=["aria-label","title"],zP={class:"queued-row-text"},WP={class:"queued-row-actions"},VP=["title","onClick"],GP=["title","onClick"],KP=["aria-label","title","onClick"],YP=er({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:r}=fs(),o=x(""),a=x("");function s(C,I){var F;o.value=I,a.value="",(F=C.dataTransfer)==null||F.setData("text/plain",I),C.dataTransfer&&(C.dataTransfer.effectAllowed="move")}function u(C){!o.value||o.value===C||(a.value=C)}function f(C){a.value===C&&(a.value="")}function m(C){const I=o.value;h(),!(!I||I===C)&&n("reorder",{draggedId:I,targetId:C})}function h(){o.value="",a.value=""}function y(C){var O,ee,se;const I=C.text.trim();if(I)return I;const F=[],B=((O=C.imageUrls)==null?void 0:O.length)??0,oe=((ee=C.fileAttachments)==null?void 0:ee.length)??0,V=((se=C.skills)==null?void 0:se.length)??0;return B>0&&F.push(`${B} ${r(B===1?"image":"images")}`),oe>0&&F.push(`${oe} ${r(oe===1?"file":"files")}`),V>0&&F.push(`${V} ${r(V===1?"skill":"skills")}`),F.join(", ")||r("(empty queued message)")}return(C,I)=>e.messages.length>0?(S(),A("div",UP,[p("div",BP,[(S(!0),A(tt,null,an(e.messages,F=>(S(),A("div",{key:F.id,class:Ze(["queued-row",{"is-dragging":o.value===F.id,"is-drop-target":a.value===F.id&&o.value!==F.id}]),draggable:"true",onDragstart:B=>s(B,F.id),onDragover:Ye(B=>u(F.id),["prevent"]),onDragleave:B=>f(F.id),onDrop:Ye(B=>m(F.id),["prevent"]),onDragend:h},[p("button",{class:"queued-row-drag",type:"button","aria-label":T(r)("Drag to reorder queued message"),title:T(r)("Drag to reorder queued message")},[...I[0]||(I[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,HP),I[2]||(I[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",zP,E(y(F)),1),p("div",WP,[p("button",{class:"queued-row-edit",type:"button",title:T(r)("Edit queued message"),onClick:B=>C.$emit("edit",F.id)},E(T(r)("Edit")),9,VP),p("button",{class:"queued-row-steer",type:"button",title:T(r)("Send now without interrupting work"),onClick:B=>C.$emit("steer",F.id)},E(T(r)("Steer")),9,GP),p("button",{class:"queued-row-delete",type:"button","aria-label":T(r)("Delete queued message"),title:T(r)("Delete queued message"),onClick:B=>C.$emit("delete",F.id)},[...I[1]||(I[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,KP)])],42,qP))),128))])])):Z("",!0)}}),JP=At(YP,[["__scopeId","data-v-bc9ce7a9"]]),QP={key:0,class:"rate-limit-status","aria-live":"polite"},XP=["title"],ZP={class:"rate-limit-card-header"},eI={class:"rate-limit-card-title"},tI={key:0,class:"rate-limit-card-plan"},nI={class:"rate-limit-card-metrics"},rI={key:0,class:"rate-limit-card-footer"},oI=er({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(V){var O,ee;return((O=V.limitId)==null?void 0:O.trim())||((ee=V.limitName)==null?void 0:ee.trim())||"__default__"}function n(V){var O,ee;return((O=V.limitName)==null?void 0:O.trim())||((ee=V.limitId)==null?void 0:ee.trim())||"Rate limits"}function r(V){const O=V.trim();return O?O.replace(/[_-]+/g," ").replace(/\b\w/g,ee=>ee.toUpperCase()):""}function o(V){return!V||V<=0?"Window":V%1440===0?`${V/1440}d`:V%60===0?`${V/60}h`:V<60?`${V}m`:`${Math.round(V/60*10)/10}h`}function a(V){const O=Math.max(0,Math.min(100,100-V));return`${Math.round(O)}% left`}function s(V){return`${Math.round(V)}%`}function u(V,O){return{key:O,label:`${o(V.windowDurationMins)} ${a(V.usedPercent)}`}}function f(V){const O=[];return V.primary&&O.push(u(V.primary,"primary")),V.secondary&&O.push(u(V.secondary,"secondary")),O}function m(V){if(!V)return"";const O=new Date(V*1e3),ee=O.getMonth()+1,se=String(O.getDate()).padStart(2,"0"),Te=String(O.getHours()).padStart(2,"0"),Fe=String(O.getMinutes()).padStart(2,"0");return`${ee}.${se} ${Te}:${Fe}`}function h(V){if(!(V!=null&&V.resetsAt))return"";const O=V.resetsAt*1e3-Date.now();if(O<=0)return"Resetting now";const ee=Math.round(O/6e4);if(ee<60)return`Resets in ${ee}m`;const se=Math.round(ee/60);return se<24?`Resets in ${se}h`:`Resets in ${Math.round(se/24)}d`}function y(V){return[V.primary,V.secondary].filter(O=>O!==null)}function C(V){const O=y(V);return O.length===0?null:[...O].sort((ee,se)=>{const Te=ee.windowDurationMins??Number.MAX_SAFE_INTEGER,Fe=se.windowDurationMins??Number.MAX_SAFE_INTEGER;return Te!==Fe?Te-Fe:(ee.resetsAt??Number.MAX_SAFE_INTEGER)-(se.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function I(V){const O=y(V);if(O.length===0)return"";const ee=[...O].sort((Te,Fe)=>{const ae=Te.windowDurationMins??-1,xe=Fe.windowDurationMins??-1;return ae!==xe?xe-ae:(Fe.resetsAt??-1)-(Te.resetsAt??-1)})[0],se=m(ee.resetsAt);return se||""}function F(V){const O=V.credits;return O?O.unlimited?"Unlimited credits":O.balance?`Credits ${O.balance}`:O.hasCredits?"Credits available":"":""}function B(V){return[h(C(V)),I(V),F(V)].filter(O=>O.length>0)}function oe(V){const O=[n(V)];for(const ee of f(V))O.push(ee.label);for(const ee of y(V))O.push(`${o(ee.windowDurationMins)} used ${s(ee.usedPercent)}`);for(const ee of B(V))O.push(ee);return O.join(`
|
|
59
|
+
`)}return(V,O)=>e.snapshots.length>0?(S(),A("aside",QP,[(S(!0),A(tt,null,an(e.snapshots,ee=>(S(),A("div",{key:t(ee),class:"rate-limit-card",title:oe(ee)},[p("div",ZP,[p("span",eI,E(n(ee)),1),ee.planType?(S(),A("span",tI,E(r(ee.planType)),1)):Z("",!0)]),p("div",nI,[(S(!0),A(tt,null,an(f(ee),se=>(S(),A("span",{key:se.key,class:"rate-limit-card-metric"},E(se.label),1))),128))]),B(ee).length>0?(S(),A("div",rI,E(B(ee).join(" | ")),1)):Z("",!0)],8,XP))),128))])):Z("",!0)}}),aI=At(oI,[["__scopeId","data-v-d5ccacfd"]]);function sI(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 Nv(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!sI(e))throw new Error("Copy failed")}const iI=["disabled","title","aria-label"],lI={class:"header-git-trigger-label"},uI={key:0,class:"header-git-dirty-dot","aria-label":"Uncommitted changes"},cI={key:0,class:"header-git-menu-wrap"},dI={class:"header-git-review-label"},fI={class:"header-git-review-delta"},hI={class:"header-git-file-added"},pI={class:"header-git-file-removed"},mI={class:"header-git-state"},vI={class:"header-git-state-label"},gI={class:"header-git-state-value"},yI={key:0,class:"header-git-state-meta"},wI=["href"],bI={key:0,class:"header-git-commit-detail-panel","aria-label":"Commit files"},_I={class:"header-git-commit-detail-head"},kI={class:"header-git-commit-detail-title"},TI=["title"],CI={class:"header-git-commit-detail-subject"},SI=["disabled"],xI={class:"header-git-file-list"},AI={key:0,class:"header-git-files-empty"},EI={key:1,class:"header-git-files-empty is-error"},PI=["title","onClick"],II={class:"header-git-file-meta-row"},RI={class:"header-git-file-status"},MI={class:"header-git-file-delta"},$I={class:"header-git-file-added"},jI={class:"header-git-file-removed"},LI={class:"header-git-file-path"},NI={key:0,class:"header-git-file-previous-path"},OI={key:0,class:"header-git-files-empty"},DI={class:"header-git-commit-panel","aria-label":"Branch commits"},FI={class:"header-git-search-wrap"},UI=["onKeydown"],BI={class:"header-git-toggle-row"},qI={class:"header-git-commit-list"},HI={key:0,class:"header-git-commits-empty"},zI={key:1,class:"header-git-commits-empty"},WI={key:2,class:"header-git-commits-empty is-error"},VI=["disabled","title","onClick"],GI={class:"header-git-commit-top"},KI=["title","onClick","onKeydown"],YI={class:"header-git-commit-meta"},JI={key:0,class:"header-git-branch-meta"},QI={class:"header-git-commit-subject"},XI={key:0,class:"header-git-commits-empty"},ZI={class:"header-git-branch-panel","aria-label":"Branches"},eR={class:"header-git-search-wrap"},tR=["onKeydown"],nR={class:"header-git-branches",role:"listbox"},rR={class:"header-git-branch-row"},oR=["disabled","onClick"],aR={class:"header-git-branch-name"},sR={key:0,class:"header-git-branch-meta"},iR={key:1,class:"header-git-branch-meta"},lR=["disabled","onClick"],uR={key:0,class:"header-git-empty"},cR=er({__name:"HeaderGitBranchDropdown",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},worktreeChangeSummary:{},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,r=t,o=x(null),a=x(null),s=x(!1),u=x(""),f=x(""),m=x(""),h=x(""),y=x(""),C=x(""),I=x(!0),F=Q(()=>n.showReview!==!1),{buildFeedbackMailto:B,feedbackMailtoBase:oe,recordVisibleFailure:V}=Ld(),O=oe();function ee(D,J){V(J);const U=D.currentTarget;U instanceof HTMLAnchorElement&&(U.href=B())}const se=Q(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`Detached ${n.headSha}`:n.loading?"Loading branch...":"Detached HEAD"),Te=Q(()=>{var U;const D=[n.headSha,n.headDate].filter(Boolean).join(" · "),J=((U=n.headSubject)==null?void 0:U.trim())??"";return J&&D?`${J} (${D})`:J||D}),Fe=Q(()=>`Git branch: ${se.value}`),ae=Q(()=>n.loading&&n.branches.length===0),xe=Q(()=>n.busy||n.loading),le=Q(()=>n.error||(n.dirty?"Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"")),be=Q(()=>n.error?"error":"info"),Ue=Q(()=>{const D=u.value.trim().toLowerCase(),J=[...n.branches].sort((U,ge)=>U.isRemote===!0&&ge.isRemote!==!0?1:U.isRemote!==!0&&ge.isRemote===!0?-1:0);return D?J.filter(U=>U.label.toLowerCase().includes(D)||U.value.toLowerCase().includes(D)):J}),ce=Q(()=>n.branches.find(D=>D.value===m.value)??null),fe=Q(()=>{var D;return((D=ce.value)==null?void 0:D.isRemote)===!0}),Se=Q(()=>m.value?`${m.value}\0${I.value?"with-reset-history":"without-reset-history"}`:""),De=Q(()=>Se.value?n.commitsByBranch[Se.value]||[]:[]),Ee=Q(()=>De.value.find(D=>D.sha===h.value)??null),Re=Q(()=>Ee.value?n.commitFilesBySha[Ee.value.sha]||[]:[]),Ie=Q(()=>{const D=f.value.trim().toLowerCase(),J=De.value;return D?J.filter(U=>U.sha.toLowerCase().includes(D)||U.shortSha.toLowerCase().includes(D)||U.subject.toLowerCase().includes(D)||U.date.toLowerCase().includes(D)):J});function Qe(){ae.value||(s.value=!s.value)}function et(){r("toggleReview")}function Me(D){m.value=D,h.value="",r("loadCommits",{branch:D,includeResetHistory:I.value})}function We(){m.value&&r("loadCommits",{branch:m.value,includeResetHistory:I.value})}function it(D){var U;const J=((U=n.headSha)==null?void 0:U.trim())??"";return J?D.sha===J||D.shortSha===J||D.sha.startsWith(J):!1}function ct(D){return`Show ${D.shortSha} files`}function at(D){h.value=D.sha,r("loadCommitFiles",D.sha)}function Je(D){const J=D.sha.trim()||D.shortSha.trim();J&&(y.value=D.sha,Nv(J).catch(()=>{y.value=""}))}function te(){!m.value||!Ee.value||fe.value||r("resetBranchToCommit",{branch:m.value,sha:Ee.value.sha})}function pe(D){return typeof D=="number"&&Number.isFinite(D)?String(D):"-"}function ve(D){Ee.value&&(r("openCommitFile",{sha:Ee.value.sha,path:D}),s.value=!1,u.value="",f.value="",h.value="",y.value="")}function ke(){if(u.value){u.value="";return}s.value=!1,h.value="",y.value=""}function Xe(){if(f.value){f.value="";return}s.value=!1,h.value="",y.value=""}function P(D){if(!s.value)return;const J=o.value,U=D.target;!J||!(U instanceof Node)||J.contains(U)||(s.value=!1,u.value="",f.value="",h.value="")}function L(){var J,U;const D=(J=n.currentBranch)==null?void 0:J.trim();return D||(((U=n.branches[0])==null?void 0:U.value)??"")}function W(){const D=m.value||L();D&&(m.value=D,r("loadCommits",{branch:D,includeResetHistory:I.value}))}return ft(s,D=>{D&&(W(),zt(()=>{var J;return(J=a.value)==null?void 0:J.focus()}))}),ft(()=>[n.currentBranch,n.branches.map(D=>D.value).join(`
|
|
60
|
+
`)],()=>{var ge;const D=L();if(!D){m.value="",C.value="";return}const J=((ge=n.currentBranch)==null?void 0:ge.trim())??"",U=J!==C.value;C.value=J,(U||!m.value||!n.branches.some(we=>we.value===m.value))&&(m.value=D),s.value&&m.value&&r("loadCommits",{branch:m.value,includeResetHistory:I.value})},{immediate:!0}),ft(De,D=>{h.value&&(D.some(J=>J.sha===h.value)||(h.value=""))}),Ga(()=>window.addEventListener("pointerdown",P)),ds(()=>window.removeEventListener("pointerdown",P)),(D,J)=>(S(),A("div",{ref_key:"rootRef",ref:o,class:Ze(["header-git-dropdown",{"is-review-open":e.reviewOpen}])},[p("button",{class:"header-git-trigger",type:"button",disabled:ae.value,title:Fe.value,"aria-label":Fe.value,onClick:Qe},[je(li,{class:"header-git-trigger-icon"}),p("span",lI,E(se.value),1),e.dirty?(S(),A("span",uI)):Z("",!0),je(Ms,{class:"header-git-trigger-chevron"})],8,iI),s.value?(S(),A("div",cI,[p("div",{class:Ze(["header-git-menu",{"has-commit-files":!!Ee.value}])},[F.value?(S(),A("button",{key:0,class:"header-git-review-row",type:"button",onClick:et},[je(Ci,{class:"header-git-row-icon"}),p("span",dI,E(e.reviewOpen?"Review Worktree Changes (Open)":"Review Worktree Changes"),1),p("span",fI,[p("span",hI,"+"+E(e.worktreeChangeSummary.addedLineCount),1),p("span",pI,"-"+E(e.worktreeChangeSummary.removedLineCount),1)])])):Z("",!0),p("div",mI,[p("span",vI,E(e.detached?"Detached HEAD":"Current branch"),1),p("span",gI,E(se.value),1),Te.value?(S(),A("span",yI,E(Te.value),1)):Z("",!0)]),le.value?(S(),A("div",{key:1,class:Ze(["header-git-status",{"is-error":be.value==="error"}])},[p("span",null,E(le.value),1),be.value==="error"?(S(),A("a",{key:0,class:"header-git-feedback",href:T(O),onClick:J[0]||(J[0]=U=>ee(U,le.value))},"Send feedback",8,wI)):Z("",!0)],2)):Z("",!0),p("div",{class:Ze(["header-git-columns",{"has-commit-files":!!Ee.value}])},[Ee.value?(S(),A("section",bI,[p("div",_I,[p("div",kI,[p("button",{class:"header-git-ref",type:"button",title:y.value===Ee.value.sha?"Copied commit ref":`Copy ${Ee.value.sha}`,onClick:J[1]||(J[1]=Ye(U=>Je(Ee.value),["stop"]))},E(Ee.value.shortSha),9,TI),p("span",null,E(Ee.value.date),1)]),p("p",CI,E(Ee.value.subject),1),p("button",{class:"header-git-reset-commit",type:"button",disabled:xe.value||fe.value||!m.value,onClick:te}," Reset ",8,SI)]),p("div",xI,[e.commitFilesLoadingFor===Ee.value.sha?(S(),A("div",AI,"Loading files...")):e.commitFilesError?(S(),A("div",EI,E(e.commitFilesError),1)):(S(),A(tt,{key:2},[(S(!0),A(tt,null,an(Re.value,U=>(S(),A("button",{key:`${U.status}:${U.previousPath??""}:${U.path}`,class:"header-git-file",type:"button",title:U.previousPath?`${U.previousPath} → ${U.path}`:U.path,onClick:ge=>ve(U.path)},[p("span",II,[p("span",RI,E(U.label),1),p("span",MI,[p("span",$I,"+"+E(pe(U.addedLineCount)),1),p("span",jI,"-"+E(pe(U.removedLineCount)),1)])]),p("span",LI,E(U.path),1),U.previousPath?(S(),A("span",NI,"← "+E(U.previousPath),1)):Z("",!0)],8,PI))),128)),Re.value.length===0?(S(),A("div",OI,"No file changes.")):Z("",!0)],64))])])):Z("",!0),p("section",DI,[p("div",FI,[Yt(p("input",{"onUpdate:modelValue":J[2]||(J[2]=U=>f.value=U),class:"header-git-search",type:"text",placeholder:"Search commits...",onKeydown:tn(Ye(Xe,["prevent"]),["esc"])},null,40,UI),[[on,f.value]])]),p("label",BI,[Yt(p("input",{"onUpdate:modelValue":J[3]||(J[3]=U=>I.value=U),type:"checkbox",onChange:We},null,544),[[ev,I.value]]),J[5]||(J[5]=p("span",null,"Reset-history refs",-1))]),p("div",qI,[m.value?e.commitsLoadingFor===Se.value?(S(),A("div",zI,"Loading commits...")):e.commitsError?(S(),A("div",WI,E(e.commitsError),1)):(S(),A(tt,{key:3},[(S(!0),A(tt,null,an(Ie.value,U=>(S(),A("button",{key:U.sha,class:Ze(["header-git-commit",{"is-current":it(U),"is-selected":U.sha===h.value}]),type:"button",disabled:xe.value,title:ct(U),onClick:ge=>at(U)},[p("span",GI,[p("span",{class:"header-git-ref",role:"button",tabindex:"0",title:y.value===U.sha?"Copied commit ref":`Copy ${U.sha}`,onClick:Ye(ge=>Je(U),["stop"]),onKeydown:[tn(Ye(ge=>Je(U),["prevent","stop"]),["enter"]),tn(Ye(ge=>Je(U),["prevent","stop"]),["space"])]},E(U.shortSha),41,KI),p("span",YI,[it(U)?(S(),A("span",JI,"current")):Z("",!0),p("span",null,E(U.date),1)])]),p("span",QI,E(U.subject),1)],10,VI))),128)),Ie.value.length===0?(S(),A("div",XI,"No commits found.")):Z("",!0)],64)):(S(),A("div",HI,"Select a branch."))])]),p("section",ZI,[p("div",eR,[Yt(p("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":J[4]||(J[4]=U=>u.value=U),class:"header-git-search",type:"text",placeholder:"Search branches...",onKeydown:tn(Ye(ke,["prevent"]),["esc"])},null,40,tR),[[on,u.value]])]),p("ul",nR,[(S(!0),A(tt,null,an(Ue.value,U=>(S(),A("li",{key:U.value,class:"header-git-branch-item"},[p("div",rR,[p("button",{class:Ze(["header-git-branch-button",{"is-current":U.value===e.currentBranch,"is-selected":U.value===m.value}]),type:"button",disabled:xe.value,onClick:ge=>Me(U.value)},[p("span",aR,E(U.label),1),U.value===e.currentBranch?(S(),A("span",sR,"current")):U.isRemote?(S(),A("span",iR,"remote")):Z("",!0)],10,oR),U.value===m.value&&U.value!==e.currentBranch&&!U.isRemote?(S(),A("button",{key:0,class:"header-git-branch-checkout",type:"button",disabled:xe.value,onClick:ge=>r("checkoutBranch",U.value)}," Checkout ",8,lR)):Z("",!0)])]))),128)),Ue.value.length===0?(S(),A("li",uR,"No branches found.")):Z("",!0)])])],2)],2)])):Z("",!0)],2))}}),dR=At(cR,[["__scopeId","data-v-014fda06"]]),fR=["aria-label"],hR=["aria-checked","onClick"],pR={class:"runtime-toggle-option-label"},mR=er({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=fs(),o=[{value:"local",label:r("Local project"),icon:jd},{value:"worktree",label:r("New worktree"),icon:li}];function a(s){n("update:modelValue",s)}return(s,u)=>(S(),A("div",{class:"runtime-toggle",role:"radiogroup","aria-label":T(r)("Continue in")},[(S(),A(tt,null,an(o,f=>p("button",{key:f.value,class:Ze(["runtime-toggle-option",{"is-selected":e.modelValue===f.value}]),type:"button",role:"radio","aria-checked":e.modelValue===f.value,onClick:m=>a(f.value)},[(S(),rt(wd(f.icon),{class:"runtime-toggle-option-icon"})),p("span",pR,E(f.label),1)],10,hR)),64))],8,fR))}}),vR=At(mR,[["__scopeId","data-v-4d282f1a"]]),gR={},yR={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 wR(e,t){return S(),A("svg",yR,[...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 bR=At(gR,[["render",wR]]),_R={},kR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function TR(e,t){return S(),A("svg",kR,[...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 CR=At(_R,[["render",TR]]),SR={class:"sidebar-thread-controls"},xR=["aria-label","title"],AR=["aria-label","title"],ER=er({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=fs();return(n,r)=>(S(),A("div",SR,[p("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?T(t)("Expand sidebar"):T(t)("Collapse sidebar"),title:e.isSidebarCollapsed?T(t)("Expand sidebar"):T(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(S(),rt(CR,{key:0,class:"sidebar-thread-controls-icon"})):(S(),rt(bR,{key:1,class:"sidebar-thread-controls-icon"}))],8,xR),Sa(n.$slots,"default",{},void 0),e.showNewThreadButton?(S(),A("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":T(t)("Start new thread"),title:T(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[je(Ci,{class:"sidebar-thread-controls-icon"})],8,AR)):Z("",!0)]))}}),hp=At(ER,[["__scopeId","data-v-39c4ec05"]]),PR={},IR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function RR(e,t){return S(),A("svg",IR,[...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 pp=At(PR,[["render",RR]]),MR={},$R={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function jR(e,t){return S(),A("svg",$R,[...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 LR=At(MR,[["render",jR]]),NR={},OR={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function DR(e,t){return S(),A("svg",OR,[...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 FR=At(NR,[["render",DR]]),UR={},BR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qR(e,t){return S(),A("svg",BR,[...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 HR=At(UR,[["render",qR]]);function Fr(e){return e.flatMap(t=>t.threads)}function zR(e,t){var r,o;const n=e.findIndex(a=>a.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((o=e[n-1])==null?void 0:o.id)??""}const Ov="codex-web-local.thread-read-state.v1",mp="codex-web-local.thread-unread-cutoff.v1",Dv="codex-web-local.thread-token-usage.v1",Fv="codex-web-local.thread-terminal-open.v1",Zc="codex-web-local.selected-thread-id.v1",ed="codex-web-local.selected-model-by-context.v1",Uv="codex-web-local.selected-model-id.v1",Bv="codex-web-local.project-order.v1",qv="codex-web-local.project-display-name.v1",td="codex-web-local.collaboration-mode-by-context.v1",WR="codex-web-local.collaboration-mode.v1",ls="__new-thread__",Hv="__new-thread-provider__::",Ec=220,VR=1e4,GR=500,KR=3e3,vp=2e3,YR=2e3,JR=2e3,gp=["none","minimal","low","medium","high","xhigh"],ti="__global__",Jo="gpt-5.4-mini",QR="big-pickle",yp="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.";function wp(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function XR(e){if(e instanceof ra&&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 ZR(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ov);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function bp(e){typeof window>"u"||window.localStorage.setItem(Ov,JSON.stringify(e))}function eM(){if(typeof window>"u")return"";const e=window.localStorage.getItem(mp);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(mp,t),t}function tM(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),r=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!1:n>r}function nM(e,t,n){return tM(e,t??n)}function zv(e){return e==="plan"?"plan":"default"}function Si(e){return typeof e=="string"?e.trim():""}function Zo(){return Object.create(null)}function ou(e){const t=Zo();for(const[n,r]of Object.entries(e))t[n]=r;return t}function il(e,t){if(!(t in e))return e;const n=Zo();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function _p(e,t){let n=!1;const r=Zo();for(const[o,a]of Object.entries(e)){if(o===ls||o.startsWith(Hv)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function os(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function rM(e){return e===ls}function Gl(e){const t=os(e);return t?`${Hv}${t}`:""}function yi(e){return e.trim()||ls}function oM(){if(typeof window>"u")return Zo();try{const n=window.localStorage.getItem(ed);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Zo();const o=Zo();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const u=Si(s);u&&(o[a]=u)}return o}}catch{}const e=Si(window.localStorage.getItem(Uv)),t=Zo();return e&&(t[ls]=e),t}function kp(e,t){const n=yi(t),r=Si(e[n]);return r||Si(e[ls])}function Kl(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(ed):window.localStorage.setItem(ed,JSON.stringify(e)),window.localStorage.removeItem(Uv)}catch{}}function aM(){if(typeof window>"u")return Zo();try{const e=window.localStorage.getItem(td);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Zo();const n=Zo();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=zv(o);a==="plan"&&(n[r]=a)}return n}}catch{}return Zo()}function Yl(e,t){const n=yi(t);return zv(e[n])}function Tp(e,t,n){const r=yi(t);if(rM(r))return il(e,r);if(n==="plan"){const o=ou(e);return o[r]="plan",o}return il(e,r)}function Pc(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(td):window.localStorage.setItem(td,JSON.stringify(e)),window.localStorage.removeItem(WR)}catch{}}function Wv(e,t,n){return Math.min(Math.max(e,t),n)}function si(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 Cp(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:si(t.totalTokens)??0,inputTokens:si(t.inputTokens)??0,cachedInputTokens:si(t.cachedInputTokens)??0,outputTokens:si(t.outputTokens)??0,reasoningOutputTokens:si(t.reasoningOutputTokens)??0}}function sM(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Cp(t.total),r=Cp(t.last);if(!n||!r)return null;const o=si(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,u=typeof o=="number"&&o>0?Wv(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:u}}function iM(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dv);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=sM(o);a&&(n[r]=a)}return n}catch{return{}}}function Sp(e){typeof window>"u"||window.localStorage.setItem(Dv,JSON.stringify(e))}function lM(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fv);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))r&&typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function uM(e){typeof window>"u"||window.localStorage.setItem(Fv,JSON.stringify(e))}function cM(){return typeof window>"u"?"":window.localStorage.getItem(Zc)??""}function dM(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Zc);return}window.localStorage.setItem(Zc,e)}}function fM(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Bv);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const o=ko(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function Ki(e){typeof window>"u"||window.localStorage.setItem(Bv,JSON.stringify(e))}function hM(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qv);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=typeof r=="string"?ko(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function xp(e){typeof window>"u"||window.localStorage.setItem(qv,JSON.stringify(e))}function ni(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return Ua(e,n)?e:n}function Ic(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Ua(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==r[o])return!1;return!0}function pM(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function mM(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function vM(e=[],t=[]){var n,r,o,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((r=t[s])==null?void 0:r.step)||((o=e[s])==null?void 0:o.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function gM(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&vM(e.steps,t.steps)}function Jl(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 nd(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ua(e.images,t.images)&&yM(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&mM(e.commandExecution,t.commandExecution)&&gM(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function ui(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 Ap(e,t,n={}){const r=new Map(e.map(h=>[h.id,h])),o=new Map(t.map(h=>[h.id,h])),a=t.map(h=>{const y=r.get(h.id);return y&&nd(y,h)?y:h});if(n.preserveMissing!==!0)return ui(e,a)?e:a;const s=e.map(h=>{const y=o.get(h.id);return!y||nd(h,y)?h:y}).filter(h=>!Nd(h)||!bM(h,t)),u=new Set(e.map(h=>h.id)),f=a.filter(h=>!u.has(h.id)),m=[...s,...f];return ui(e,m)?e:m}function yM(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r.path!==o.path||r.operation!==o.operation||r.movedToPath!==o.movedToPath||r.diff!==o.diff||r.addedLineCount!==o.addedLineCount||r.removedLineCount!==o.removedLineCount)return!1}return!0}function xi(e){return e.replace(/\s+/gu," ").trim()}function Nd(e){return e.messageType==="userMessage.optimistic"}function wM(e){return e.some(Nd)}function bM(e,t){if(e.role!=="user")return!1;const n=xi(e.text),r=Array.isArray(e.images)?e.images:[],o=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||s.role!=="user"||Nd(s))return!1;const u=xi(s.text),f=Array.isArray(s.images)?s.images:[],m=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,h=Array.isArray(s.skills)?s.skills.length:0;return u===n&&Ua(f,r)&&m===o&&h===a})}function _M(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>xi(a.text)).filter(a=>a.length>0));if(r.size===0)return e;const o=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=xi(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function Ql(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(nd(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const Vv="worked";function ns(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function kM(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60,a=[];n>0&&a.push(`${n}h`),(r>0||n>0)&&a.push(`${r}m`);const s=o>0||a.length===0?o:0;return a.push(`${s}s`),a.join(" ")}function TM(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function CM(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 SM(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${kM(e.durationMs)}`,messageType:Vv,turnId:e.turnId}}function xM(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function AM(e,t){const n=SM(t),r=e.filter(s=>s.messageType!==Vv),o=xM(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function xt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function EM(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[o,a]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=a}return n?r:e}function PM(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 IM(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 RM(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 pn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Ep(e,t){const n=t.trim();if(!n)return e;let r=!1;const o=[];for(const a of e){const s=a.threads.filter(f=>f.id!==n),u=s.length!==a.threads.length;u&&(r=!0),s.length>0?o.push(u?{...a,threads:s}:a):a.threads.length===0&&o.push(a)}return r?o:e}function Xl(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const a=n.get(o.projectName),s=new Map((a==null?void 0:a.threads.map(f=>[f.id,f]))??[]),u=o.threads.map(f=>{const m=s.get(f.id);return m&&PM(m,f)?m:f});return a&&a.projectName===o.projectName&&IM(a.threads,u)?a:{projectName:o.projectName,threads:u}});return RM(e,r)?e:r}function MM(e,t,n){const r=new Set(Fr(t).map(u=>u.id)),o=Fr(e).filter(u=>n[u.id]===!0&&!r.has(u.id));if(o.length===0)return t;const a=new Map(t.map(u=>[u.projectName,u])),s=t.map(u=>({projectName:u.projectName,threads:[...u.threads]}));for(const u of o){if(a.get(u.projectName)){const m=s.findIndex(h=>h.projectName===u.projectName);m>=0&&(s[m]={projectName:s[m].projectName,threads:[u,...s[m].threads]});continue}s.push({projectName:u.projectName,threads:[u]})}return s}function Ls(e){return ko(e)}function $M(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function jM(e){const t=e.label||ko(e.remotePath),n=$M(e.hostId);return n?`${t} ${n}`:t}function Gv(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function Nu(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(o=>o.id)),r=e.projectOrder.filter(o=>t.has(o)||n.has(o));for(const o of e.order)r.includes(o)||r.push(o);for(const o of n)r.includes(o)||r.push(o);return r}function rd(e,t){const n=Gv(e);return Nu(e).map(r=>{if(n.has(r))return r;const o=ut(r).trim(),a=Ls(o);return t.has(a)?o:a})}function au(e,t){return ut(e).trim()===t||Ls(e)===t}function LM(e,t){const n=new Set;for(const r of e.order)au(r,t)&&n.add(r);for(const r of e.active)au(r,t)&&n.add(r);for(const r of Object.keys(e.labels))au(r,t)&&n.add(r);return n}function NM(e,t,n){var m,h;const r=new Set((e.remoteProjects??[]).map(y=>y.id)),o=new Map;for(const y of e.order){const C=Ls(y);o.has(C)||o.set(C,y)}for(const y of n){const C=((h=(m=y.threads[0])==null?void 0:m.cwd)==null?void 0:h.trim())??"";C&&o.set(y.projectName,C)}const a=[],s=y=>{y&&!a.includes(y)&&a.push(y)};for(const y of t){if(r.has(y)){s(y);continue}const C=o.get(y);C&&s(C)}for(const y of Nu(e))s(y);const u=a.filter(y=>e.order.includes(y));for(const y of e.order)u.includes(y)||u.push(y);const f=e.active.filter(y=>u.includes(y));return f.length===0&&u.length>0&&f.push(u[0]),{order:u,active:f,projectOrder:a}}function OM(e,t,n){const r=rd(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(ad(a)||ad(s))return 0;const u=o.get(a.projectName)??Number.POSITIVE_INFINITY,f=o.get(s.projectName)??Number.POSITIVE_INFINITY;return u===f?0:u-f})}function od(e,t){const n=new Map,r=new Map,o=s=>{const u=ut(s).trim();if(!u)return;const f=ko(u),m=n.get(f)??new Set;m.add(u),n.set(f,m)};for(const s of(t==null?void 0:t.order)??[]){const u=ut(s).trim();if(!u)continue;const f=ko(u);vu(u)||r.set(f,(r.get(f)??0)+1),o(s)}for(const s of e)for(const u of s.threads){const f=ut(u.cwd).trim(),m=ko(f),h=(t==null?void 0:t.order.some(y=>ut(y).trim()===f))===!0;vu(f)&&!h&&r.get(m)===1||o(u.cwd)}const a=new Set;for(const[s,u]of n.entries())u.size>1&&a.add(s);return a}function vu(e){return e.includes("/.codex/worktrees/")}function DM(e,t){const n=od(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const m of(t==null?void 0:t.order)??[]){const h=ut(m).trim();if(!h||(s.add(h),vu(h)))continue;const y=ko(h);r.has(y)?(r.delete(y),o.add(y),a.delete(y)):o.has(y)||(r.add(y),a.set(y,h))}const u=[],f=new Map;for(const m of e)for(const h of m.threads){const y=ut(h.cwd).trim(),C=ko(y),I=s.has(y),F=vu(y)&&!I&&r.has(C);let B=m.projectName;F&&n.has(C)?B=a.get(C)??m.projectName:y&&n.has(C)&&(B=y);const oe=h.projectName===B?h:{...h,projectName:B},V=f.get(B);if(V)V.threads.push(oe);else{const O={projectName:B,threads:[oe]};f.set(B,O),u.push(O)}}return u}function FM(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),o=[...e],a=Gv(t);for(const s of Nu(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const u=ut(s).trim();if(!u)continue;const f=Ls(u),m=n.has(f)?u:f;r.has(m)||(o.push({projectName:m,threads:[]}),r.add(m))}return o}function UM(e){const t=e.split(`
|
|
61
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function BM(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function ad(e){return e.threads.some(t=>t.cwd.trim().length===0||pu(t.cwd))}function qM(){const e=x([]),t=x([]),n=x(cM()),r=x({}),o=x({}),a=x({}),s=x({}),u=x({}),f=x({}),m=x({}),h=x({}),y=x({});let C=!1;const I=x({}),F=x([]),B=x([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),oe=x(aM()),V=x(oM()),O=x(Yl(oe.value,n.value)),ee=x(kp(V.value,n.value)),se=x("medium"),Te=x("standard"),Fe=x(""),ae=x(""),xe=x(ZR()),le=x(eM()),be=x(fM()),Ue=x(hM()),ce=x({}),fe=x({}),Se=x({}),De=x({}),Ee=x({}),Re=x({}),Ie=x({}),Qe=x({}),et=x({}),Me=x({}),We=x({}),it=x({}),ct=x({}),at=x({}),Je=x({}),te=x(null),pe=x(iM()),ve=x(lM()),ke=x({}),Xe=x({}),P=x([]),L=x([]),W=x(!1),D=x(!1),J=x(!1),U=x(!1),ge=x(!1),we=x(!1),_e=x(!1),X=x(""),qe=x(!1),Pe=x(!1);function He(i){var c;try{const g=new URL(i,"http://localhost");return g.pathname!=="/codex-local-image"?"":((c=g.searchParams.get("path"))==null?void 0:c.trim())??""}catch{return""}}function ze(i){const c=i.trim().toLowerCase();return c?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(c):!1}function nt(i){var g;const c=r.value[i]??[];for(let k=c.length-1;k>=0;k-=1){const $=c[k];if(!($.role!=="user"||!Array.isArray($.images)||$.images.length===0))for(let j=$.images.length-1;j>=0;j-=1){const z=((g=$.images[j])==null?void 0:g.trim())??"";if(z&&He(z))return z}}return""}let pt=null,Ve=null,wt=null;const kt=new Map;let H=null;const G=new Map;let K=null,he=0,Ae=!1,Ne=0,Be="",Ct=null,Oe=!1,Jt=!1;const Mt=new Set,la=new Map,to=new Map;let fr=null,Ar=null,no=!1,Dt=!1,Qt=[],ro=null,Er=!1,$n=!1;const Br=new Map,ua=new Set,tr=Q(()=>Fr(e.value)),hr=Q(()=>tr.value.find(i=>i.id===n.value)??null),fn=Q(()=>{const i=n.value;return!!(i&&ve.value[i]===!0)}),xo=Q(()=>{const i=n.value;return i?We.value[i]===!0:!1}),Dn=Q(()=>{const i=[],c=n.value;return c&&Array.isArray(at.value[c])&&i.push(...at.value[c]),Array.isArray(at.value[ti])&&i.push(...at.value[ti]),i.sort((g,k)=>g.receivedAtIso.localeCompare(k.receivedAtIso))}),Ao=Q(()=>{var Y;const i=n.value;if(!i)return null;const c=m.value[i]===!0,g=c?Qe.value[i]:void 0,k=c?(s.value[i]??"").trim():"",$=(((Y=et.value[i])==null?void 0:Y.message)??"").trim();let j="";if(!c&&$){const ie=r.value[i]??[];for(let me=ie.length-1;me>=0;me-=1){const Ge=ie[me];if(Ge.messageType==="turnError"){j=xi(Ge.text);break}}}const z=!c&&$&&j===$?"":$;return!c&&!g&&!k&&!z?null:{activityLabel:(g==null?void 0:g.label)||"Thinking",activityDetails:(g==null?void 0:g.details)??[],reasoningText:k,errorText:z}}),Aa=Q(()=>te.value),Eo=Q(()=>{const i=n.value;return i?pe.value[i]??null:null}),ca=Q(()=>{const i=n.value;if(!i)return[];const c=r.value[i]??[],g=o.value[i]??[],k=a.value[i]??[],$=u.value[i]??[],j=f.value[i]??[],z=[...c,...g,...$,...j,...k],Y=Ie.value[i];return Y?AM(z,Y):z}),Po=Q(()=>{const i=n.value;return i?Se.value[i]===!0:!1}),Ea=Q(()=>{const i=n.value;return i?De.value[i]===!0:!1});function sn(i){var g;const c=r.value[i]??[];for(const k of c){const $=((g=k.turnId)==null?void 0:g.trim())??"";if($)return $}return""}function lt(i){if(yi(i)===ls){const g=os(Fe.value),k=Gl(g),$=k?Si(V.value[k]):"";if($)return $}return kp(V.value,i).trim()}function Fn(i){const c=i.trim();return os(c?ke.value[c]??Fe.value:Fe.value)}function _n(...i){const c=[...F.value];for(const g of i){const k=g.trim();k&&!c.includes(k)&&c.push(k)}Ua(F.value,c)||(F.value=c)}function da(i){const c=i.trim();return F.value.length===0||c&&F.value.includes(c)?c:F.value[0]??""}function un(i,c={}){n.value!==i&&(n.value=i,c.persist!==!1&&dM(i),ee.value=da(lt(i)),O.value=Yl(oe.value,i),$n=!1)}function qr(i,c){const g=c.trim(),k=yi(i),$=os(Fe.value),j=k===ls?Gl($):"",z=j||k;if(g){const Y=ou(V.value);Y[z]=g,j&&delete Y[k],V.value=Y}else{let Y=il(V.value,z);j&&(Y=il(Y,k)),V.value=Y}i.trim()===n.value?(ee.value=lt(n.value),_n(ee.value)):_n(g),Kl(V.value)}function An(i){qr(n.value,i)}function hn(i,c){const g=i.trim();if(!g)return;const k=c.trim();if(k){const $=ou(V.value);$[g]=k,V.value=$}else V.value=il(V.value,g);_n(k),n.value===g&&(ee.value=lt(n.value)),Kl(V.value)}function gt(i,c){const g=i.trim();if(!g)return;const k=os(c);k?ke.value={...ke.value,[g]:k}:ke.value[g]&&(ke.value=xt(ke.value,g))}function cn(i,c,g){const k=c.trim();if(os(g)!=="opencode-zen")return k;const j=lt(i).trim();return j&&!/^gpt-/i.test(j)?j:k&&!/^gpt-/i.test(k)?k:QR}function Lt(i,c){const g=i.trim();if(!g)return;if(!c){if(!(g in pe.value))return;pe.value=xt(pe.value,g),Sp(pe.value);return}const k=pe.value[g];k&&JSON.stringify(k)===JSON.stringify(c)||(pe.value={...pe.value,[g]:c},Sp(pe.value))}function jn(i){const c=i==="plan"?"plan":"default",g=yi(n.value);Yl(oe.value,n.value)===c&&O.value===c||(O.value=c,oe.value=Tp(oe.value,g,c),Pc(oe.value))}function Hr(i,c){const g=c==="plan"?"plan":"default";oe.value=Tp(oe.value,i,g),i.trim()===n.value&&(O.value=g),Pc(oe.value)}function Un(i){te.value=i}async function Ln(i=n.value){i.trim()?hn(i,Jo):An(Jo),_n(Jo)}function kn(i,c){Je.value={...Je.value,[i]:c}}function pr(i){Je.value[i]&&(Je.value=xt(Je.value,i))}async function Pr(i){if(ua.has(i))return;const c=Je.value[i];if(!(!c||c.fallbackRetried)){ua.add(i),kn(i,{...c,fallbackRetried:!0});try{await Ln(i);try{const g=await yc(i,1);Nt(i,g),yr(i),q(i,[]),or(i),u.value[i]&&(u.value=xt(u.value,i))}catch{}if(It(i,null),X.value="",qn(i,null),$t(i,{label:"Thinking",details:Bn(Jo,c.effort,c.collaborationMode)}),Xt(i,!0),Ee.value[i]!==!0){const g=await gc(i);g.model&&hn(i,cn(i,g.model,g.modelProvider)),g.modelProvider&>(i,g.modelProvider),Ee.value={...Ee.value,[i]:!0}}await wc(i,c.text,c.imageUrls,Jo,c.effort||void 0,c.skills.length>0?c.skills:void 0,c.fileAttachments,c.collaborationMode),ao(),Mt.add(i),await Go()}catch(g){const k=g instanceof Error?g.message:"Unknown application error";It(i,k),X.value=k,Xt(i,!1),$t(i,null)}finally{ua.delete(i)}}}function Io(i){i&&!gp.includes(i)||(se.value=i)}async function Nn(i){const c=i==="fast"?"fast":"standard";if(we.value||Te.value===c)return;const g=Te.value;Te.value=c,we.value=!0,X.value="";try{await bT(c)}catch(k){Te.value=g,X.value=k instanceof Error?k.message:"Failed to update Fast mode"}finally{we.value=!1}}async function Ro(){try{const i=await AT();B.value=i,i.some(c=>c.value===O.value)||jn("default")}catch{}}function Bn(i,c,g=O.value){const k=i.trim()||"default",$=c||"default",j=g==="plan"?"Plan":"Default",z=Te.value==="fast"?"Fast":"Standard";return[`Mode: ${j}`,`Model: ${k}`,`Thinking: ${$}`,`Speed: ${z}`]}async function oo(i){ae.value="";try{const c=await xv(),g=c.model.trim(),k=os(c.providerId);Fe.value=k;const $=Fn(n.value),j=$!=="codex",z=lt(n.value),Y=await Sv({includeProviderModels:j||(i==null?void 0:i.includeProviderModels)!==!1,requireProviderModels:j,providerId:j?$:void 0}),ie=Gl($),me=ie?Si(V.value[ie]):"",Ge=[...Y];!(i!=null&&i.providerChanged)&&j&&$===k&&g&&!Ge.includes(g)&&Ge.push(g),F.value=Ge;const St=z&&Y.includes(z);if(!z||!St||i!=null&&i.providerChanged?i!=null&&i.providerChanged&&Ge.length>0?me&&Y.includes(me)?An(me):$===k&&g&&Ge.includes(g)?An(g):An(Ge[0]):$===k&&g&&Ge.includes(g)?An(c.model):Ge.length>0?An(Ge[0]):An(""):ee.value.trim()!==z&&An(z),ie&&ee.value.trim().length>0){const _t=ou(V.value);_t[ie]=ee.value.trim();const Tt=Gl(k);Tt&&Tt!==ie&&g&&(_t[Tt]=g),V.value=_t,Kl(V.value)}c.reasoningEffort&&gp.includes(c.reasoningEffort)&&(se.value=c.reasoningEffort),Te.value=c.speedMode}catch(c){wp(c)?ae.value=yp:ae.value=""}}async function Mo(){if(Ct){await Ct;return}Ct=(async()=>{try{const i=await oT();Un(i),L.value=i?[i]:[]}catch{}finally{Ct=null}})(),await Ct}function ao(){if(typeof window>"u"){Mo();return}wt!==null&&window.clearTimeout(wt),wt=window.setTimeout(()=>{wt=null,Mo()},GR)}function Ir(i){if(!i||typeof window>"u")return;const c=kt.get(i);c!==void 0&&(window.clearTimeout(c),kt.delete(i))}function zr(i){if(!i||typeof window>"u")return;Ir(i);const c=window.setTimeout(()=>{kt.delete(i),Mt.add(i),Go()},KR);kt.set(i,c)}function mr(i){const c=Xe.value;return Object.keys(c).length===0?i:i.map(g=>({projectName:g.projectName,threads:g.threads.map(k=>{const $=c[k.id];return $?{...k,title:$}:k})}))}function vr(i){return i?Array.isArray(at.value[i])?at.value[i]:[]:[]}function $o(i){return i==="item/commandExecution/requestApproval"||i==="item/fileChange/requestApproval"||i==="item/permissions/requestApproval"||i==="execCommandApproval"||i==="applyPatchApproval"}function gr(i){return i.some(c=>$o(c.method))?"approval":i.length>0?"response":null}function Et(){const c=mr(t.value).map(g=>({projectName:g.projectName,threads:g.threads.map(k=>{const $=m.value[k.id]===!0,j=gr(vr(k.id)),z=n.value===k.id,Y=I.value[k.id]===!0,ie=nM(k.updatedAtIso,xe.value[k.id],le.value);return{...k,inProgress:$,unread:!z&&!$&&(Y||ie),pendingRequestState:j}})}));e.value=Xl(e.value,c)}function Sn(i,c,g){const k=new Date().toISOString(),$=ut(c),j=ko($),z={id:i,title:UM(g),projectName:j,cwd:$,hasWorktree:$.includes("/.codex/worktrees/")||$.includes("/.git/worktrees/"),createdAtIso:k,updatedAtIso:k,preview:g,unread:!1,inProgress:!1},Y=t.value.findIndex(me=>me.projectName===j);if(Y>=0){const Ge=t.value[Y].threads.filter(Tt=>Tt.id!==i),St={projectName:j,threads:[z,...Ge]},_t=[...t.value];_t.splice(Y,1,St),t.value=_t}else t.value=[{projectName:j,threads:[z]},...t.value];const ie=ni(be.value,t.value);Ua(be.value,ie)||(be.value=ie,Ki(be.value)),Et()}function Wr(i){const c=new Set(i.map(ie=>ie.id)),g=n.value.trim();g&&c.add(g);const k=_p(V.value,c);k!==V.value&&(V.value=k,ee.value=da(lt(n.value)),Kl(k));const $=_p(oe.value,c);$!==oe.value&&(oe.value=$,O.value=Yl($,n.value),Pc($));const j=pn(xe.value,c);j!==xe.value&&(xe.value=j,bp(j)),fe.value=pn(fe.value,c),ce.value=pn(ce.value,c),Ee.value=pn(Ee.value,c),Re.value=pn(Re.value,c),r.value=pn(r.value,c),a.value=pn(a.value,c),s.value=pn(s.value,c),u.value=pn(u.value,c),f.value=pn(f.value,c),Ie.value=pn(Ie.value,c),Qe.value=pn(Qe.value,c),et.value=pn(et.value,c),Me.value=pn(Me.value,c),We.value=pn(We.value,c),it.value=pn(it.value,c),ct.value=pn(ct.value,c),ke.value=pn(ke.value,c);const z=pn(h.value,c);z!==h.value&&(h.value=z,Bo()),pe.value=pn(pe.value,c),I.value=pn(I.value,c),m.value=pn(m.value,c);const Y={};for(const[ie,me]of Object.entries(at.value))(ie===ti||c.has(ie))&&(Y[ie]=me);at.value=Y}function Vr(i){const c=Fr(t.value).find(g=>g.id===i);c&&(xe.value={...xe.value,[i]:c.updatedAtIso},bp(xe.value),I.value[i]&&(I.value=xt(I.value,i)),Et())}function qn(i,c){if(!i)return;const g=Ie.value[i];if(c){if(TM(g,c))return;Ie.value={...Ie.value,[i]:c}}else g&&(Ie.value=xt(Ie.value,i))}function Xt(i,c){!i||m.value[i]===!0===c||(c?m.value={...m.value,[i]:!0}:(m.value=xt(m.value,i),Yr(i),nr(i)),Et(),!c&&!Kn()&&fr&&$a())}function nr(i){i&&(We.value[i]&&(We.value=xt(We.value,i)),it.value[i]&&(it.value=xt(it.value,i)),ct.value[i]&&(ct.value=xt(ct.value,i)))}function so(i){i&&(We.value={...We.value,[i]:!0},it.value[i]&&(it.value=xt(it.value,i)),ct.value[i]&&(ct.value=xt(ct.value,i)))}function Rr(i){i&&We.value[i]===!0&&it.value[i]===!0&&ct.value[i]===!0&&nr(i)}function rr(i,c){!i||!c||We.value[i]===!0&&nr(i)}function mn(i){const c=Object.keys(We.value);if(c.length===0)return;let g=it.value,k=!1;for(const $ of c)!i.has($)||g[$]===!0||(g={...g,[$]:!0},k=!0);if(k){it.value=g;for(const $ of c)Rr($)}}function Pt(i,c){i&&We.value[i]===!0&&c.some(g=>g.role==="user")&&(ct.value[i]!==!0&&(ct.value={...ct.value,[i]:!0}),Rr(i))}function En(i){i&&i!==n.value&&I.value[i]!==!0&&(I.value={...I.value,[i]:!0},Et())}function $t(i,c){if(!i)return;const g=Qe.value[i];if(!c){g&&(Qe.value=xt(Qe.value,i));return}const k=fo(c.label)||"Thinking",$=c.details.map(Y=>fo(Y)).filter(Y=>Y.length>0&&Y!==k),j=Array.from(new Set([...(g==null?void 0:g.details)??[],...$])).slice(-3),z={label:k,details:j};CM(g,z)||(Qe.value={...Qe.value,[i]:z})}function It(i,c,g={}){if(!i)return;const k=et.value[i],$=c?xi(c):"";if(!$){k&&(et.value=xt(et.value,i));return}const j=g.transient===!0;(k==null?void 0:k.message)===$&&k.transient===j||(et.value={...et.value,[i]:{message:$,transient:j}})}function Hn(i){var c;i&&(c=et.value[i])!=null&&c.transient&&It(i,null)}function io(){const i=Object.entries(et.value).filter(([,g])=>g==null?void 0:g.transient).map(([g])=>g);if(i.length===0)return;let c=et.value;for(const g of i)c=xt(c,g);et.value=c}function Gr(i){const c=Fr(t.value).find(g=>g.id===i);return(c==null?void 0:c.updatedAtIso)??""}function Kr(i,c){if(!i)return;const g={...ve.value};c?g[i]=!0:delete g[i],ve.value=g,uM(g)}function fa(){const i=n.value;i&&Kr(i,!fn.value)}function Nt(i,c){const g=r.value[i]??[];ui(g,c)||(r.value={...r.value,[i]:c})}function R(i,c,g=[],k=[],$=[]){const j=r.value[i]??[],z={id:`optimistic-user:${i}:${Date.now()}`,role:"user",text:c,images:g.length>0?[...g]:void 0,skills:k.length>0?k.map(Y=>({name:Y.name,path:Y.path})):void 0,fileAttachments:$.length>0?$.map(Y=>({...Y})):void 0,messageType:"userMessage.optimistic"};Nt(i,[...j,z])}function q(i,c){const g=a.value[i]??[];ui(g,c)||(a.value={...a.value,[i]:c})}function re(i){i&&i in a.value&&(a.value=xt(a.value,i))}function Le(i,c){const g=f.value[i]??[];ui(g,c)||(f.value={...f.value,[i]:c})}function bt(i,c){const g=o.value[i]??[];ui(g,c)||(o.value={...o.value,[i]:c})}function Zt(i,c){const g=o.value[i]??[],k=Ql(g,c);bt(i,k)}function Rt(i,c){const g=a.value[i]??[],k=Ql(g,c);q(i,k)}function Ht(i,c){const g=f.value[i]??[],k=Ql(g,c);Le(i,k)}function en(i,c){if(!i)return;const g=c.trim(),k=s.value[i]??"";if(g.length===0){if(!k)return;s.value=xt(s.value,i);return}k!==g&&(s.value={...s.value,[i]:g})}function zn(i,c){if(!i)return;const g=s.value[i]??"";en(i,`${g}${c}`)}function or(i){i&&i in s.value&&(s.value=xt(s.value,i))}function yr(i){i&&i in o.value&&(o.value=xt(o.value,i))}function Mr(i){i&&i in f.value&&(f.value=xt(f.value,i))}function Yr(i){i&&(yr(i),or(i),$t(i,null),n.value,u.value[i]&&(u.value=xt(u.value,i)),Me.value[i]&&(Me.value=xt(Me.value,i)),pr(i))}function dn(i){return i==="completed"?"completed":i==="inProgress"||i==="in_progress"?"inProgress":"pending"}function $r(i){var g;const c=[];(g=i.explanation)!=null&&g.trim()&&c.push(i.explanation.trim());for(const k of i.steps){const $=k.status==="completed"?"x":k.status==="inProgress"?"~":" ";c.push(`- [${$}] ${k.step}`)}return c.join(`
|
|
62
|
+
`).trim()}function ha(i){if(i.method!=="turn/plan/updated")return null;const c=Ke(i.params),g=Wn(i),k=Ce(c==null?void 0:c.turnId)||Ce(c==null?void 0:c.turn_id),j=(Array.isArray(c==null?void 0:c.plan)?c==null?void 0:c.plan:[]).map(ie=>Ke(ie)).map(ie=>({step:Ce(ie==null?void 0:ie.step),status:dn(ie==null?void 0:ie.status)})).filter(ie=>ie.step.length>0);if(!g||!k)return null;const Y={explanation:Ce(c==null?void 0:c.explanation).trim()||void 0,steps:j,isStreaming:!0};return{threadId:g,message:{id:`${k}:plan`,role:"assistant",text:$r(Y),messageType:"plan.live",plan:Y}}}function jo(i){if(i.method!=="item/plan/delta")return null;const c=Ke(i.params),g=Wn(i),k=Ce(c==null?void 0:c.turnId)||Ce(c==null?void 0:c.turn_id),$=Ce(c==null?void 0:c.delta);if(!g||!k||!$)return null;const j=`${k}:plan`,z=(o.value[g]??[]).find(me=>me.id===j),Y=`${(z==null?void 0:z.text)??""}${$}`,ie=z!=null&&z.plan?{...z.plan,isStreaming:!0}:void 0;return{threadId:g,message:{id:j,role:"assistant",text:Y,messageType:"plan.live",plan:ie}}}function Ke(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:null}function Ce(i){return typeof i=="string"?i:""}function xn(i){return typeof i=="number"&&Number.isFinite(i)?i:null}function pa(i){const c=Ke(i);if(!c)return null;const g=xn(c.totalTokens??c.total_tokens),k=xn(c.inputTokens??c.input_tokens),$=xn(c.cachedInputTokens??c.cached_input_tokens),j=xn(c.outputTokens??c.output_tokens),z=xn(c.reasoningOutputTokens??c.reasoning_output_tokens);return g===null||k===null||$===null||j===null||z===null?null:{totalTokens:g,inputTokens:k,cachedInputTokens:$,outputTokens:j,reasoningOutputTokens:z}}function Os(i){const c=Ke(i);if(!c)return null;const g=pa(c.total),k=pa(c.last);if(!g||!k)return null;const $=xn(c.modelContextWindow??c.model_context_window),j=k.totalTokens,z=typeof $=="number"?Math.max($-j,0):null,Y=typeof $=="number"&&$>0?Wv(Math.round((z??0)/$*100),0,100):null;return{total:g,last:k,modelContextWindow:$,currentContextTokens:j,remainingContextTokens:z,remainingContextPercent:Y}}function Ds(i){if(i.method!=="thread/tokenUsage/updated")return null;const c=Ke(i.params),g=Wn(i),k=Os((c==null?void 0:c.tokenUsage)??(c==null?void 0:c.token_usage));return!g||!k?null:{threadId:g,usage:k}}function Wn(i){const c=Ke(i.params);if(!c)return"";const g=Ce(c.threadId);if(g)return g;const k=Ce(c.thread_id);if(k)return k;const $=Ce(c.conversationId);if($)return $;const j=Ce(c.conversation_id);if(j)return j;const z=Ke(c.thread),Y=Ce(z==null?void 0:z.id);if(Y)return Y;const ie=Ke(c.turn),me=Ce(ie==null?void 0:ie.threadId);if(me)return me;const Ge=Ce(ie==null?void 0:ie.thread_id);return Ge||""}function vn(i){if(i.method!=="turn/completed")return"";const c=Ke(i.params),g=Ke(c==null?void 0:c.turn);if(!g||g.status!=="failed")return"";const k=Ke(g.error);return Ce(k==null?void 0:k.message)}function lo(i){var k;if(i.method!=="error")return null;const c=Ke(i.params),g=Ce(c==null?void 0:c.message)||Ce((k=Ke(c==null?void 0:c.error))==null?void 0:k.message);return g?{message:g,transient:(c==null?void 0:c.willRetry)===!0}:null}function Jr(i){const c=Ke(i);if(!c)return null;const g=c.id,k=Ce(c.method),$=c.params;if(typeof g!="number"||!Number.isInteger(g)||!k)return null;const j=Ke($),z=Lo(k,j),Y=Ce(j==null?void 0:j.threadId)||Ce(j==null?void 0:j.thread_id)||Ce(j==null?void 0:j.conversationId)||Ce(j==null?void 0:j.conversation_id)||ti,ie=Ce(j==null?void 0:j.turnId)||Ce(j==null?void 0:j.turn_id),me=Ce(j==null?void 0:j.itemId)||Ce(j==null?void 0:j.item_id)||Ce(j==null?void 0:j.callId)||Ce(j==null?void 0:j.call_id),Ge=Ce(c.receivedAtIso)||new Date().toISOString();return{id:g,method:z,threadId:Y,turnId:ie,itemId:me,receivedAtIso:Ge,params:$??null}}function Lo(i,c){const g=i.trim();return g&&(g==="item/commandExecution/requestApproval"||g==="execCommandApproval"||g==="exec_approval_request"||hs(c)?"item/commandExecution/requestApproval":g==="item/fileChange/requestApproval"||g==="applyPatchApproval"||g==="apply_patch_approval_request"||ps(c)?"item/fileChange/requestApproval":g==="item/tool/requestUserInput"||g==="request_user_input"||Vt(c)?"item/tool/requestUserInput":g==="mcpServer/elicitation/request"||g==="elicitation_request"||Pn(c)?"mcpServer/elicitation/request":g==="item/permissions/requestApproval"||Ei(c)?"item/permissions/requestApproval":g==="item/tool/call"||g==="dynamic_tool_call_request"||ar(c)?"item/tool/call":g)}function hs(i){if(!i)return!1;const c=i.command;return Array.isArray(c)&&c.some(g=>typeof g=="string"&&g.trim().length>0)||typeof c=="string"&&c.trim().length>0?!0:Array.isArray(i.commandActions)}function ps(i){return i?typeof i.grantRoot=="string"&&i.grantRoot.trim().length>0||typeof i.grant_root=="string"&&i.grant_root.trim().length>0||Ke(i.fileChanges)?!0:Ke(i.changes)!==null:!1}function Vt(i){return!!(i&&Array.isArray(i.questions))}function ar(i){return i?typeof i.toolName=="string"||typeof i.tool_name=="string"||typeof i.name=="string"||Array.isArray(i.arguments):!1}function Pn(i){if(!i)return!1;const c=Ce(i.mode);return typeof i.serverName=="string"&&typeof i.threadId=="string"&&typeof i.message=="string"&&(c==="form"||c==="url")}function Ei(i){return i?typeof i.threadId=="string"&&typeof i.turnId=="string"&&typeof i.itemId=="string"&&Ke(i.permissions)!==null:!1}function No(i){if(i.method!=="item/tool/requestUserInput")return[];const c=Ke(i.params),g=Array.isArray(c==null?void 0:c.questions)?c.questions:[],k=[];for(const $ of g){const j=Ke($),z=Ce(j==null?void 0:j.id).trim();z&&k.push(z)}return k}function Pa(i){const c=i.threadId||ti,g=at.value[c]??[],k=g.findIndex(j=>j.id===i.id),$=[...g];k>=0?$.splice(k,1,i):$.push(i),at.value={...at.value,[c]:$.sort((j,z)=>j.receivedAtIso.localeCompare(z.receivedAtIso))},Et()}function uo(i){const c={};for(const[g,k]of Object.entries(at.value)){const $=k.filter(j=>j.id!==i);$.length>0&&(c[g]=$)}at.value=c,Et()}function co(i){const c={};for(const g of i){const k=g.threadId||ti,$=c[k]??[];$.push(g),c[k]=$}for(const g of Object.values(c))g.sort((k,$)=>k.receivedAtIso.localeCompare($.receivedAtIso));at.value=c}function Ia(i){if(i.method==="server/request"){const c=Jr(i.params);return c&&Pa(c),!0}if(i.method==="server/request/resolved"){const c=Ke(i.params),g=c==null?void 0:c.id;return typeof g=="number"&&Number.isInteger(g)&&uo(g),!0}return!1}function fo(i){return i.replace(/\s+/gu," ").trim()}function Ka(i){const c=Wn(i);if(!c)return null;if(i.method==="turn/started")return{threadId:c,activity:{label:"Thinking",details:[]}};if(i.method==="item/started"){const g=Ke(i.params),k=Ke(g==null?void 0:g.item),$=Ce(k==null?void 0:k.type).toLowerCase();if($==="reasoning")return{threadId:c,activity:{label:"Thinking",details:[]}};if($==="agentmessage")return{threadId:c,activity:{label:"Writing response",details:[]}};if($==="commandexecution"){const j=Ce(k==null?void 0:k.command);return{threadId:c,activity:{label:"Running command",details:j?[j]:[]}}}if($==="filechange"){const z=(Array.isArray(k==null?void 0:k.changes)?k.changes:[])[0],Y=Ce(z==null?void 0:z.path);return{threadId:c,activity:{label:"Applying changes",details:Y?[Y]:[]}}}}return i.method==="item/commandExecution/outputDelta"?{threadId:c,activity:{label:"Running command",details:[]}}:i.method==="item/fileChange/outputDelta"?{threadId:c,activity:{label:"Applying changes",details:[]}}:i.method==="item/reasoning/summaryTextDelta"||i.method==="item/reasoning/summaryPartAdded"||i.method==="item/reasoning/textDelta"?{threadId:c,activity:{label:"Thinking",details:[]}}:i.method==="item/agentMessage/delta"?{threadId:c,activity:{label:"Writing response",details:[]}}:null}function Oo(i){if(i.method!=="turn/started")return null;const c=Ke(i.params);if(!c)return null;const g=Wn(i);if(!g)return null;const k=Ke(c.turn),$=Ce(k==null?void 0:k.id)||Ce(c.turnId)||`${g}:unknown`;if(!$)return null;const j=ns(Ce(k==null?void 0:k.startedAt))??ns(Ce(c.startedAt))??ns(i.atIso)??Date.now();return{threadId:g,turnId:$,startedAtMs:j}}function Tn(i){if(i.method!=="turn/completed")return null;const c=Ke(i.params);if(!c)return null;const g=Wn(i);if(!g)return null;const k=Ke(c.turn),$=Ce(k==null?void 0:k.id)||Ce(c.turnId)||`${g}:unknown`;if(!$)return null;const j=ns(Ce(k==null?void 0:k.completedAt))??ns(Ce(c.completedAt))??ns(i.atIso)??Date.now(),z=ns(Ce(k==null?void 0:k.startedAt))??ns(Ce(c.startedAt))??void 0;return{threadId:g,turnId:$,completedAtMs:j,startedAtMs:z}}function Do(i){return`${i}:live-reasoning`}function ho(i){const c=r.value[i]??[];let g=-1;for(const k of c)typeof k.turnIndex=="number"&&Number.isFinite(k.turnIndex)&&(g=Math.max(g,k.turnIndex));return g+1}function po(i,c,g){if(!i||!c||!Number.isInteger(g)||g<0)return;const k=Re.value[i]??{};k[c]!==g&&(Re.value={...Re.value,[i]:{...k,[c]:g}})}function Cn(i,c){const g=Re.value[i]??{},k=Object.entries(g),$=Object.entries(c);k.length===$.length&&k.every(([j,z])=>c[j]===z)||(Re.value={...Re.value,[i]:{...c}})}function mo(i){const c=f.value[i];if(!c||c.length===0)return;const g=Re.value[i]??{};let k=!1;const $=c.map(j=>{if(typeof j.turnIndex=="number"||!j.turnId)return j;const z=g[j.turnId];return typeof z!="number"?j:(k=!0,{...j,turnIndex:z})});k&&(f.value={...f.value,[i]:$})}function Fo(i){const c=Ke(i.params);if(!c)return"";if(i.method==="item/started"){const g=Ke(c.item);return!g||g.type!=="reasoning"?"":Ce(g.id)}return""}function Vn(i){const c=Ke(i.params);if(!c)return null;if(i.method==="item/reasoning/summaryTextDelta"){const g=Ce(c.itemId),k=Ce(c.delta);return!g||!k?null:{messageId:Do(g),delta:k}}if(i.method==="item/reasoning/textDelta"){const g=Ce(c.itemId),k=Ce(c.delta);return!g||!k?null:{messageId:Do(g),delta:k}}return null}function Uo(i){const c=Ke(i.params);if(!c)return"";if(i.method==="item/reasoning/summaryPartAdded"){const g=Ce(c.itemId);return g?Do(g):""}return""}function Ra(i){const c=Ke(i.params);if(!c)return"";if(i.method==="item/completed"){const g=Ke(c.item);return!g||g.type!=="reasoning"?"":Do(Ce(g.id))}return""}function Ma(i){const c=Ke(i.params);if(!c)return"";if(i.method==="item/started"){const g=Ke(c.item);return!g||g.type!=="agentMessage"?"":Ce(g.id)}return""}function vo(i){const c=Ke(i.params);if(!c)return null;if(i.method==="item/agentMessage/delta"){const g=Ce(c.itemId),k=Ce(c.delta);return!g||!k?null:{messageId:g,delta:k}}return null}function jr(i){const c=Ke(i.params);if(!c)return null;if(i.method==="item/completed"){const g=Ke(c.item);if(!g||g.type!=="agentMessage")return null;const k=Ce(g.id),$=Ce(g.text);return!k||!$?null:{id:k,role:"assistant",text:$,messageType:"agentMessage.live"}}return null}function In(i){return`/codex-local-image?path=${encodeURIComponent(i)}`}function ma(i){const c=i.trim();if(!c)return"";if(c.startsWith("data:")||c.startsWith("http://")||c.startsWith("https://")||c.startsWith("/codex-local-image?"))return c;const g=c.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(g)?`data:image/png;base64,${g}`:""}function Fs(i){if(i.method!=="item/completed")return null;const c=Ke(i.params),g=Ke(c==null?void 0:c.item);if(!g)return null;const k=Ce(g.id);if(!k)return null;if(g.type==="imageView"){const z=Ce(g.path);return z?{id:k,role:"assistant",text:"",images:[In(z)],messageType:"imageView"}:null}if(g.type!=="imageGeneration"&&g.type!=="image_generation")return null;const $=Ce(g.result),j=$?ma($):"";return j?{id:k,role:"assistant",text:"",images:[j],messageType:"imageView"}:null}function Qr(i){var me;if(i.method!=="item/started")return null;const c=Ke(i.params),g=Ke(c==null?void 0:c.item);if(!g||g.type!=="commandExecution")return null;const k=Ce(g.id),$=Ce(g.command);if(!k)return null;const j=typeof g.cwd=="string"?g.cwd:null,z=Wn(i),Y=Ce(c==null?void 0:c.turnId)||Ce(c==null?void 0:c.turn_id),ie=z&&Y?(me=Re.value[z])==null?void 0:me[Y]:void 0;return{id:k,role:"system",text:$,messageType:"commandExecution",commandExecution:{command:$,cwd:j,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:Y||void 0,turnIndex:typeof ie=="number"?ie:void 0}}function ms(i){if(i.method!=="item/commandExecution/outputDelta")return null;const c=Ke(i.params);if(!c)return null;const g=Ce(c.itemId),k=Ce(c.delta);return!g||!k?null:{itemId:g,delta:k}}function Us(i){var Tt;if(i.method!=="item/completed")return null;const c=Ke(i.params),g=Ke(c==null?void 0:c.item);if(!g||g.type!=="commandExecution")return null;const k=Ce(g.id),$=Ce(g.command);if(!k)return null;const j=typeof g.cwd=="string"?g.cwd:null,z=Ce(g.status),Y=z==="failed"?"failed":z==="declined"?"declined":z==="interrupted"?"interrupted":"completed",ie=typeof g.aggregatedOutput=="string"?g.aggregatedOutput:"",me=typeof g.exitCode=="number"?g.exitCode:null,Ge=Wn(i),St=Ce(c==null?void 0:c.turnId)||Ce(c==null?void 0:c.turn_id),_t=Ge&&St?(Tt=Re.value[Ge])==null?void 0:Tt[St]:void 0;return{id:k,role:"system",text:$,messageType:"commandExecution",commandExecution:{command:$,cwd:j,status:Y,aggregatedOutput:ie,exitCode:me},turnId:St||void 0,turnIndex:typeof _t=="number"?_t:void 0}}function go(i){var me;if(i.method!=="item/completed")return null;const c=Ke(i.params),g=Ke(c==null?void 0:c.item);if(!g||g.type!=="fileChange")return null;const k=Ce(g.id);if(!k)return null;const $=Ce(c==null?void 0:c.threadId),j=Ce(c==null?void 0:c.turnId),z=$&&j?(me=Re.value[$])==null?void 0:me[j]:void 0,Y=yv(g.changes),ie=gv(g.status);return Y.length===0||ie!=="completed"?null:{id:k,role:"system",text:"",messageType:"fileChange",fileChangeStatus:ie,fileChanges:Y,turnId:j||void 0,turnIndex:typeof z=="number"?z:void 0}}function Gn(i,c){const g=u.value[i]??[],k=Ql(g,c);k!==g&&(u.value={...u.value,[i]:k})}function va(i,c){const g=u.value[i];if(!g||g.length===0)return;const k=new Set(c.map(j=>j.id)),$=g.filter(j=>!k.has(j.id));$.length!==g.length&&($.length===0?u.value=xt(u.value,i):u.value={...u.value,[i]:$})}function vs(i,c){const g=f.value[i];if(!g||g.length===0)return;const k=new Set(c.map(Y=>Y.id)),$=new Set(c.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnId=="string"&&Y.turnId.length>0).map(Y=>Y.turnId)),j=new Set(c.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnIndex=="number").map(Y=>Y.turnIndex)),z=g.filter(Y=>!k.has(Y.id)&&!(Y.turnId&&$.has(Y.turnId))&&!(typeof Y.turnIndex=="number"&&j.has(Y.turnIndex)));z.length!==g.length&&(z.length===0?f.value=xt(f.value,i):f.value={...f.value,[i]:z})}function gn(i){if(i.method==="item/agentMessage/delta")return!0;const c=Ke(i.params);if(!c)return!1;if(i.method==="item/completed"){const g=Ke(c.item);return(g==null?void 0:g.type)==="agentMessage"}return!1}function On(i){var yo,Li,Pl,Ks,Ni;if(Ia(i))return;if(i.method==="account/rateLimits/updated"&&ao(),i.method==="thread/name/updated"){const ht=Ke(i.params),Dr=Ce(ht==null?void 0:ht.threadId),ja=Ce(ht==null?void 0:ht.threadName);Dr&&ja&&(Xe.value={...Xe.value,[Dr]:ja},Et(),_c(Dr,ja))}if(i.method==="account/rateLimits/updated"){Un(kv(i.params));return}const c=Ds(i);if(c){Lt(c.threadId,c.usage);return}const g=Ka(i);g&&$t(g.threadId,g.activity);const k=Wn(i),$=lo(i);!$&&k&&Hn(k);const j=Oo(i);j&&(Br.set(j.turnId,j),po(j.threadId,j.turnId,ho(j.threadId)),Me.value={...Me.value,[j.threadId]:j.turnId},rr(j.threadId,j.turnId),yr(j.threadId),Mr(j.threadId),qn(j.threadId,null),It(j.threadId,null),Xt(j.threadId,!0),Or(j.threadId),I.value[j.threadId]&&(I.value=xt(I.value,j.threadId)));const z=Tn(i),Y=vn(i),ie=(z==null?void 0:z.threadId)??Wn(i),me=ie?lt(ie):"",Ge=!!ie&&!!Y&&me!==Jo&&Jl(new Error(Y));if(z){Je.value[z.threadId];const ht=Br.get(z.turnId);ht&&Br.delete(z.turnId);const Dr=xn((yo=Ke(i.params))==null?void 0:yo.durationMs)??xn((Pl=Ke((Li=Ke(i.params))==null?void 0:Li.turn))==null?void 0:Pl.durationMs)??(typeof z.startedAtMs=="number"?z.completedAtMs-z.startedAtMs:null)??(ht?z.completedAtMs-ht.startedAtMs:null),ja=typeof Dr=="number"?Math.max(0,Dr):0;qn(z.threadId,{turnId:z.turnId,durationMs:ja}),Me.value[z.threadId]&&(Me.value=xt(Me.value,z.threadId)),Xt(z.threadId,!1),$t(z.threadId,null),En(z.threadId),Ge||(pr(z.threadId),Or(z.threadId))}if(Y){const ht=(z==null?void 0:z.threadId)||Wn(i);ht&&It(ht,Y),X.value=Y,ht&&Ge&&Pr(ht)}else z&&It(z.threadId,null);if($){const ht=k,Dr=ht?lt(ht):ee.value.trim();ht&&It(ht,$.message,{transient:$.transient}),X.value=$.message,Dr!==Jo&&Jl(new Error($.message))&&(ht?Pr(ht):Ln())}const St=ha(i);St&&(Zt(St.threadId,St.message),$t(St.threadId,{label:"Planning",details:((Ks=St.message.plan)==null?void 0:Ks.steps.map(ht=>ht.step).slice(0,2))??[]}));const _t=jo(i);if(_t&&(Zt(_t.threadId,_t.message),$t(_t.threadId,{label:"Planning",details:[]})),!k||k!==n.value)return;Ma(i);const Tt=vo(i);if(Tt){const ht=(a.value[k]??[]).find(ja=>ja.id===Tt.messageId),Dr=`${(ht==null?void 0:ht.text)??""}${Tt.delta}`;Rt(k,{id:Tt.messageId,role:"assistant",text:Dr,messageType:"agentMessage.live"})}const Ft=jr(i);Ft&&Rt(k,Ft);const br=Fs(i);br&&Rt(k,br),Fo(i);const Ya=Vn(i);if(Ya&&zn(k,Ya.delta),Uo(i)){const ht=s.value[k]??"";ht.trim().length>0&&!ht.endsWith(`
|
|
63
|
+
|
|
64
|
+
`)&&en(k,`${ht}
|
|
65
|
+
|
|
66
|
+
`)}Ra(i);const _s=Qr(i);_s&&(Gn(k,_s),$t(k,{label:"Running command",details:[((Ni=_s.commandExecution)==null?void 0:Ni.command)??""]}));const Ja=ms(i);if(Ja){const ht=(u.value[k]??[]).find(Dr=>Dr.id===Ja.itemId);ht!=null&&ht.commandExecution&&Gn(k,{...ht,commandExecution:{...ht.commandExecution,aggregatedOutput:`${ht.commandExecution.aggregatedOutput}${Ja.delta}`}})}const Vs=Us(i);Vs&&Gn(k,Vs);const Gs=go(i);if(Gs&&Ht(k,Gs),gn(i)&&or(k),i.method==="turn/completed"){$n=!1,or(k),u.value[k]&&(u.value=xt(u.value,k));const ht=Wn(i);ht&&(Ir(ht),Xt(ht,!1),$t(ht,null),En(ht),Ge||(pr(ht),Or(ht)))}}function Lr(i){if(i.method==="thread/tokenUsage/updated")return;const c=i.method,g=c==="turn/started"||c==="turn/completed"||c==="error",k=c.startsWith("thread/")||c==="turn/completed";if(!g&&!k)return;const $=Wn(i);$&&g&&Mt.add($),k&&(Oe=!0,Jt=!0),!(Ve!==null||typeof window>"u")&&(Ve=window.setTimeout(()=>{Ve=null,Go()},Ec))}async function gs(i,c){if(!Er){Er=!0;try{if(!c)return;const g=[];for(const k of Nu(c)){const $=Ls(k);g.includes($)||g.push($)}if(g.length>0){const k=c.projectOrder.length>0?ni(g,i):ni(be.value,i);Ua(be.value,k)||(be.value=k)}if(Object.keys(c.labels).length>0||(c.remoteProjects??[]).length>0){const k={...Ue.value};let $=!1;for(const[j,z]of Object.entries(c.labels)){const Y=ut(j).trim(),ie=[Ls(j)];Y&&ie.push(Y);for(const me of ie)k[me]!==z&&(k[me]=z,$=!0)}for(const j of c.order){const z=Ls(j),Y=ko(vi(j));if(!Y.startsWith(".")||Y===z)continue;const ie=`${z} ${Y}`;k[z]!==void 0||k[z]===ie||(k[z]=ie,$=!0)}for(const j of c.remoteProjects??[]){const z=jM(j);k[j.id]!==z&&(k[j.id]=z,$=!0)}$&&(Ue.value=k)}}catch{}}}async function Xr(i={}){if(!(i.force!==!0&&Object.keys(Xe.value).length>0))try{const c=await nC();Object.keys(c.titles).length>0&&(Xe.value=c.titles)}catch{}}async function Bs(){try{return await ai()}catch{return null}}async function qs(i,c,g){if(Xe.value[i])return;const k=c.trim();if(!k)return;const $=k.length>300?k.slice(0,300):k;try{const j=await iC($,g);if(!j||Xe.value[i])return;Xe.value={...Xe.value,[i]:j},Et(),_c(i,j)}catch{}}function wr(i,c){const g=od(i,c),k=DM(i,c),$=FM(k,c,g);if(!c||c.order.length===0&&(c.remoteProjects??[]).length===0)return $;const j=new Set;for(const Y of rd(c,g))j.add(Y);const z=$.filter(Y=>j.has(Y.projectName)?!0:ad(Y));return OM(z,c,g)}function ga(i,c){const g=wr(i,c),k=!!(c&&(c.order.length>0||c.projectOrder.length>0||(c.remoteProjects??[]).length>0)),$=c!=null&&c.projectOrder.length?ni(rd(c,od(i,c)),g):ni(be.value,g);Ua(be.value,$)||(be.value=$,k||Ki(be.value));const j=Ic(g,be.value);mn(new Set(Fr(j).map(Y=>Y.id)));const z=MM(t.value,j,m.value);t.value=Xl(t.value,z),m.value=pn(m.value,new Set(Fr(t.value).map(Y=>Y.id))),Et()}function ya(i){const c={};for(const[g,k]of Object.entries(i)){const $=g.trim();!$||k.length===0||(c[$]=k.map(j=>({id:j.id,text:j.text,imageUrls:[...j.imageUrls],skills:j.skills.map(z=>({name:z.name,path:z.path})),fileAttachments:j.fileAttachments.map(z=>({label:z.label,path:z.path,fsPath:z.fsPath})),collaborationMode:j.collaborationMode})))}return c}function Bo(){RT(ya(h.value)).catch(()=>{})}async function qo(){if(!C){C=!0;try{h.value=await Kh()}catch{}}}function ys(i){Qt=Ep(Qt,i),t.value=Ep(t.value,i),m.value=xt(m.value,i),Et()}function wa(i,c){if(i.length===0)return c;if(c.length===0)return i;const g=new Map;for(const $ of Fr(i))g.set($.id,$);for(const $ of Fr(c))g.set($.id,$);const k=new Map;for(const $ of g.values()){const j=k.get($.projectName);j?j.push($):k.set($.projectName,[$])}return Array.from(k.entries()).map(([$,j])=>({projectName:$,threads:j.sort((z,Y)=>new Date(Y.updatedAtIso).getTime()-new Date(z.updatedAtIso).getTime())})).sort(($,j)=>{var ie,me;const z=new Date(((ie=$.threads[0])==null?void 0:ie.updatedAtIso)??0).getTime();return new Date(((me=j.threads[0])==null?void 0:me.updatedAtIso)??0).getTime()-z})}function Kn(){return Object.values(m.value).some(i=>i===!0)}function $a(i=ro){if(!(!fr||no||Kn())){if(ro=i,typeof window>"u"){Ho(i);return}Ar!==null&&window.clearTimeout(Ar),Ar=window.setTimeout(()=>{Ar=null,!(!fr||Kn())&&Ho(ro)},VR)}}async function Ho(i){if(!(no||!fr||Kn())){no=!0;try{const c=await Dh(fr,Uk());fr=c.nextCursor,Dt=c.nextCursor===null,J.value=Dt,Qt=wa(Qt,c.groups),ga(Qt,i)}catch{}finally{no=!1,fr&&!Kn()&&$a(i)}}}async function zo(i={}){if(H){await H;return}i.force!==!0&&Pe.value&&Date.now()-he<YR||(H=(async()=>{var c;Pe.value||(W.value=!0);try{const[g,k]=await Promise.all([Dh(),Bs(),Xr({force:i.force===!0})]);ro=k;const $=g.groups;Qt=Pe.value?wa(Qt,$):$,fr=Pe.value&&!Dt?fr:g.nextCursor,Dt=g.nextCursor===null,J.value=Dt,await gs($,k),ga(Qt,k),Pe.value=!0,he=Date.now(),Dt||$a(k);const j=Fr(e.value);Wr(j),!j.some(Y=>Y.id===n.value)&&!n.value&&un(((c=j[0])==null?void 0:c.id)??"")}finally{W.value=!1}})().finally(()=>{H=null}),await H)}async function sr(i,c={}){var Y;if(!i)return;const g=Date.now()-(to.get(i)??0)<vp;if((Y=et.value[i])!=null&&Y.transient&&(c.silent===!0||g))return;const k=G.get(i);if(k){await k;return}const $=fe.value[i]===!0,j=c.silent!==!0&&!$;j&&(D.value=!0);const z=(async()=>{try{const ie=Gr(i),me=ce.value[i]??"",Ge=Date.now()-(la.get(i)??0)<vp;if($&&(Ge||(ie.length===0||me===ie)&&m.value[i]!==!0)){Vr(i);return}const Tt=Ee.value[i]!==!0?await gc(i):null,Ft=Tt??await Fh(i);Ft.modelProvider&>(i,Ft.modelProvider),Ft.model&&hn(i,cn(i,Ft.model,Ft.modelProvider)),Tt&&(Ee.value={...Ee.value,[i]:!0});const{messages:br,inProgress:Ya,activeTurnId:ji,turnIndexByTurnId:_s}=Ft;Se.value={...Se.value,[i]:Ft.hasMoreOlder===!0},Pt(i,br),Cn(i,_s),mo(i);const Ja=r.value[i]??[],Vs=Ap(Ja,br,{preserveMissing:c.silent===!0||wM(Ja)});Nt(i,Vs);const Gs=a.value[i]??[];if(Ya){const yo=_M(Gs,br);q(i,yo)}else re(i);va(i,br),vs(i,br),fe.value={...fe.value,[i]:!0},la.set(i,Date.now()),to.delete(i),ie&&(ce.value={...ce.value,[i]:ie}),Xt(i,Ya),Hn(i),ji?Me.value={...Me.value,[i]:ji}:Me.value[i]&&(Me.value=xt(Me.value,i)),Ya||Yr(i),Vr(i)}catch(ie){const me=ie instanceof Error?ie.message:"Unknown application error";throw n.value===i&&It(i,me,{transient:!0}),to.set(i,Date.now()),ie}finally{j&&(D.value=!1)}})().finally(()=>{G.delete(i)});G.set(i,z),await z}async function Wo(i=n.value){if(!i||De.value[i]===!0||Se.value[i]!==!0)return;const c=sn(i);if(!c){Se.value={...Se.value,[i]:!1};return}De.value={...De.value,[i]:!0};try{const g=await qk(i,c),k=r.value[i]??[],$=Ap(g.messages,k,{preserveMissing:!0});Nt(i,$),Cn(i,{...Re.value[i]??{},...g.turnIndexByTurnId}),mo(i),Se.value={...Se.value,[i]:g.hasMoreOlder}}catch(g){throw X.value=g instanceof Error?g.message:"Failed to load earlier messages",g}finally{De.value={...De.value,[i]:!1}}}async function jt(i,c={}){var g;i&&fe.value[i]!==!0&&(c.silent===!0&&((g=et.value[i])!=null&&g.transient)||await sr(i,c))}async function Yn(i={}){var k,$;const c=(($=(k=hr.value)==null?void 0:k.cwd)==null?void 0:$.trim())??"",g=c||"__global__";if(K){await K;return}i.force!==!0&&Ae&&Be===g&&Date.now()-Ne<JR||(K=(async()=>{try{P.value=await uC(c?[c]:void 0),Ae=!0,Ne=Date.now(),Be=g}catch{}finally{K=null}})(),await K)}async function ir(i={}){await Promise.allSettled([oo({providerChanged:i.providerChanged,includeProviderModels:i.includeProviderModels}),Mo(),Ro(),Yn()])}function Hs(i={}){const c=()=>{ir(i)};if(typeof window>"u"){c();return}window.setTimeout(c,0)}async function v(i={}){X.value="",ae.value="";const c=i.includeSelectedThreadMessages!==!1,g=i.awaitAncillaryRefreshes===!0;try{if(await qo(),await zo({force:i.forceThreadRefresh===!0}),c)try{await sr(n.value)}catch(k){X.value=k instanceof Error?k.message:"Unknown application error"}g?await ir({providerChanged:i.providerChanged,includeProviderModels:i.providerChanged===!0||g}):Hs({providerChanged:i.providerChanged,includeProviderModels:!1})}catch(k){X.value=k instanceof Error?k.message:"Unknown application error",wp(k)?ae.value=yp:ae.value=""}}async function b(i){un(i);try{return await sr(i),await oo({includeProviderModels:!0}),Yn(),"ok"}catch(c){const g=c instanceof Error?c.message:"Unknown application error";X.value=g;const k=XR(c)?"not-found":"error";return i.trim()&&It(i,g,{transient:!0}),k}}async function w(i){const c=n.value===i,g=c?zR(Fr(e.value),i):"";c&&(un(g),g&&sr(g,{silent:!0}));try{await dT(i),ys(i),await zo(),c&&g&&n.value===g&&await jt(g,{silent:!0})}catch(k){X.value=k instanceof Error?k.message:"Unknown application error"}}async function M(i,c){const g=c.trim();if(!(!i||!g))try{await fT(i,g),Xe.value={...Xe.value,[i]:g},Et(),_c(i,g)}catch(k){X.value=k instanceof Error?k.message:"Unknown application error"}}async function ye(i){var z,Y;const c=i.trim();if(!c)return"";const g=Fr(t.value).find(ie=>ie.id===c),k=((z=g==null?void 0:g.cwd)==null?void 0:z.trim())??"",$=((Y=g==null?void 0:g.title)==null?void 0:Y.trim())??"Forked chat",j=lt(c);X.value="";try{const ie=await zh(c,k||void 0,j||void 0),me=ie.threadId.trim();return me?(Sn(me,k,$),hn(me,ie.model),Ee.value={...Ee.value,[me]:!0},un(me),await zo(),await sr(me),me):""}catch(ie){return X.value=ie instanceof Error?ie.message:"Unknown application error",""}}async function st(i,c){var z;const g=i.trim();if(!g||!Number.isInteger(c)||c<0)return"";if(m.value[g]===!0)return X.value="Finish the current turn before forking from a response.","";if(fe.value[g]!==!0)try{await sr(g)}catch(Y){return X.value=Y instanceof Error?Y.message:"Unknown application error",""}const k=r.value[g]??[];let $=-1;for(const Y of k)typeof Y.turnIndex=="number"&&Number.isFinite(Y.turnIndex)&&($=Math.max($,Y.turnIndex));if($>=0&&c>$)return"";const j=Fr(t.value).find(Y=>Y.id===g)??null;try{X.value="";const Y=await zh(g),ie=Y.threadId.trim();if(!ie)return"";const me=Y.cwd.trim()||((z=j==null?void 0:j.cwd)==null?void 0:z.trim())||"",Ge=BM((j==null?void 0:j.title)||(j==null?void 0:j.preview)||"Untitled thread");Sn(ie,me,Ge),hn(ie,Y.model),Nt(ie,Y.messages),fe.value={...fe.value,[ie]:!0},Ee.value={...Ee.value,[ie]:!0},yr(ie),q(ie,[]),or(ie),u.value[ie]&&(u.value=xt(u.value,ie)),qn(ie,null),$t(ie,null),It(ie,null),Xt(ie,!1);const St=$-c;if(St>0){const _t=await yc(ie,St);Nt(ie,_t)}return await M(ie,Ge),un(ie),zo().catch(()=>{}),ie}catch(Y){return X.value=Y instanceof Error?Y.message:"Unknown application error",""}}async function Gt(i,c,g=[],k=[],$=[]){if(!i||!c.trim()||g.length>0||k.length>0||$.length>0)return!1;const z=(at.value[i]??[]).filter(me=>me.method==="item/tool/requestUserInput");if(z.length!==1)return!1;const[Y]=z,ie=No(Y);return ie.length!==1?!1:xl({id:Y.id,result:{answers:{[ie[0]]:{answers:[c.trim()]}}}})}async function Nr(i,c=[],g=[],k="steer",$=[],j,z){if(we.value)return;const Y=n.value,ie=i.trim();if(!Y||!ie&&c.length===0&&$.length===0||await Gt(Y,ie,c,g,$))return;const me=m.value[Y]===!0;if(me&&k==="queue"){const Ge=h.value[Y]??[],St=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,_t=[...Ge],Tt=typeof j=="number"?Math.max(0,Math.min(j,_t.length)):_t.length;_t.splice(Tt,0,{id:St,text:ie,imageUrls:c,skills:g,fileAttachments:$,collaborationMode:z==="plan"?"plan":z==="default"?"default":O.value}),h.value={...h.value,[Y]:_t},Bo();return}if(me){$n=!0,Jn(Y,ie,c,g,$,z).catch(Ge=>{const St=Ge instanceof Error?Ge.message:"Unknown application error";It(Y,St),X.value=St});return}X.value="",$n=!0,qn(Y,null),$t(Y,{label:"Thinking",details:Bn(lt(Y),se.value,z==="plan"?"plan":z==="default"?"default":O.value)}),It(Y,null),Xt(Y,!0);try{await Jn(Y,ie,c,g,$,z)}catch(Ge){$n=!1,Xt(Y,!1),$t(Y,null);const St=Ge instanceof Error?Ge.message:"Unknown application error";throw It(Y,St),X.value=St,Ge}}async function vt(i,c,g=[],k=[],$=[]){if(we.value)return"";const j=i.trim(),z=c.trim(),Y=lt(ls).trim(),ie=O.value;if(!j&&g.length===0&&$.length===0)return"";U.value=!0,X.value="";let me="";try{try{const Tt=await Hh(z||void 0,Y||void 0);me=Tt.threadId,hn(me,Tt.model),gt(me,Tt.modelProvider||Fe.value),Hr(me,ie)}catch(Tt){if(Y&&Y!==Jo&&Jl(Tt)){await Ln();const Ft=await Hh(z||void 0,Jo);me=Ft.threadId,hn(me,Ft.model),gt(me,Ft.modelProvider||Fe.value),Hr(me,ie)}else throw Tt}if(!me)return"";Sn(me,z,j||"[Image]"),R(me,j,g,k,$),so(me),Ee.value={...Ee.value,[me]:!0},un(me),$n=!0,qn(me,null),$t(me,{label:"Thinking",details:Bn(lt(me),se.value,ie)}),It(me,null),Xt(me,!0);const Ge=me,St=z||null,_t=j;return Jn(me,j,g,k,$,ie).catch(Tt=>{$n=!1,Xt(me,!1),$t(me,null);const Ft=Tt instanceof Error?Tt.message:"Unknown application error";It(me,Ft),X.value=Ft}).finally(()=>{U.value=!1}),qs(Ge,_t,St),me}catch(Ge){$n=!1,me&&(Xt(me,!1),$t(me,null));const St=Ge instanceof Error?Ge.message:"Unknown application error";throw me&&It(me,St),X.value=St,U.value=!1,Ge}}async function Jn(i,c,g=[],k=[],$=[],j){const z=se.value,Y=j==="plan"?"plan":j==="default"?"default":O.value,ie=c.trim(),me=[...g];if(me.length===0&&ze(ie)){const _t=nt(i);_t&&me.push(_t)}const Ge=k.map(_t=>({name:_t.name,path:_t.path})),St=$.map(_t=>({..._t}));kn(i,{text:ie,imageUrls:[...me],skills:Ge,fileAttachments:St,effort:z,collaborationMode:Y,fallbackRetried:!1});try{if(Ee.value[i]!==!0){const Ft=await gc(i);Ft.model&&hn(i,cn(i,Ft.model,Ft.modelProvider)),Ft.modelProvider&>(i,Ft.modelProvider),Ee.value={...Ee.value,[i]:!0}}const _t=lt(i);let Tt="";try{Tt=await wc(i,c,me,_t||void 0,z||void 0,k.length>0?k:void 0,$,Y)}catch(Ft){if(_t&&_t!==Jo&&Jl(Ft))await Ln(i),kn(i,{text:ie,imageUrls:[...me],skills:Ge,fileAttachments:St,effort:z,collaborationMode:Y,fallbackRetried:!0}),Tt=await wc(i,c,me,Jo,z||void 0,k.length>0?k:void 0,$,Y);else throw Ft}Tt&&(Me.value={...Me.value,[i]:Tt},rr(i,Tt)),Mt.add(i),await Go(),zr(i)}catch(_t){throw _t}}async function Vo(i){if(y.value[i]!==!0){y.value={...y.value,[i]:!0};try{h.value=await Kh()}catch{}finally{y.value=xt(y.value,i)}}}function Or(i){Vo(i),!(typeof window>"u")&&window.setTimeout(()=>{Vo(i)},650)}async function ba(){const i=n.value;if(!i||m.value[i]!==!0||We.value[i]===!0)return;let c=Me.value[i];if(!c){const{activeTurnId:g}=await Fh(i);c=g,c&&(Me.value={...Me.value,[i]:c})}if(!c)throw new Error("Could not determine active turn id for interrupt");ge.value=!0,X.value="";try{await wT(i,c),Xt(i,!1),$t(i,null),It(i,null),Me.value[i]&&(Me.value=xt(Me.value,i)),Mt.add(i),Oe=!0,await Go()}catch(g){const k=g instanceof Error?g.message:"Failed to interrupt active turn";It(i,k),X.value=k}finally{ge.value=!1}}async function Ou(i){var Y,ie;const c=n.value;if(!c||_e.value||!i.trim())return;const g=r.value[c]??[],k=g.find(me=>me.turnId===i),$=typeof(k==null?void 0:k.turnIndex)=="number"?k.turnIndex:-1;if($<0)return;const j=g.reduce((me,Ge)=>typeof Ge.turnIndex=="number"&&Ge.turnIndex>me?Ge.turnIndex:me,-1);if(j<0||$>j)return;const z=j-$+1;if(!(z<1)){_e.value=!0,X.value="";try{const me=((ie=(Y=hr.value)==null?void 0:Y.cwd)==null?void 0:ie.trim())??"";me&&await pT(c,i,me);const Ge=await yc(c,z);Nt(c,Ge),q(c,[]),or(c),u.value[c]&&(u.value=xt(u.value,c)),qn(c,null),$t(c,null),It(c,null),Oe=!0,await Go()}catch(me){X.value=me instanceof Error?me.message:"Failed to rollback thread"}finally{_e.value=!1}}}let ws=null;async function Pi(i,c){try{const g=await ai(),k={...g.labels};let $=!1;for(const j of g.order){if(!au(j,i))continue;const z=c.trim();z.length===0?k[j]!==void 0&&(delete k[j],$=!0):k[j]!==z&&(k[j]=z,$=!0)}$&&await bc({order:g.order,labels:k,active:g.active,projectOrder:g.projectOrder})}catch{}}function Du(i,c){i.length===0||(Ue.value[i]??"")===c||(Ue.value={...Ue.value,[i]:c},xp(Ue.value),ws!==null&&clearTimeout(ws),ws=setTimeout(()=>{ws=null,Pi(i,c)},500))}async function Ii(i){var j;if(i.length===0)return;const c=be.value.filter(z=>z!==i);if(Ua(be.value,c)||(be.value=c,Ki(be.value)),t.value=t.value.filter(z=>z.projectName!==i),Ue.value[i]!==void 0){const z={...Ue.value};delete z[i],Ue.value=z,xp(z)}Et();const g=Fr(e.value);Wr(g),g.some(z=>z.id===n.value)||un(((j=g[0])==null?void 0:j.id)??"");const $=new Set;try{const z=await ai();LM(z,i).forEach(Y=>{$.add(Y)})}catch{}if($.size>0)try{const z=await ai(),Y=z.order.filter(Ge=>!$.has(Ge)),ie=z.active.filter(Ge=>!$.has(Ge)),me=ie.length===0&&Y.length>0?[Y[0]]:ie;await bc({order:Y,labels:EM(z.labels,$),active:me,projectOrder:z.projectOrder.filter(Ge=>Ge!==i&&!$.has(Ge))});return}catch{}await Ws()}function zs(i,c){if(i.length===0||t.value.length===0)return;const g=t.value.map(ie=>ie.projectName),k=g.indexOf(i);if(k===-1)return;const $=Math.max(0,Math.min(c,g.length-1)),j=pM(g,k,$);if(j===g)return;const z=ni(j,t.value);be.value=z,Ki(be.value);const Y=Ic(t.value,be.value);t.value=Xl(t.value,Y),Et(),Ws()}function Fu(i){const c=i.trim();if(!c)return;const g=[c,...be.value.filter($=>$!==c)];if(Ua(be.value,g))return;be.value=g,Ki(be.value);const k=Ic(t.value,be.value);t.value=Xl(t.value,k),Et(),Ws()}async function Ws(){try{const i=await ai(),c=NM(i,be.value,t.value);await bc({order:c.order,labels:i.labels,active:c.active,projectOrder:c.projectOrder})}catch{}}async function Go(){if(qe.value){typeof window<"u"&&Ve===null&&(Ve=window.setTimeout(()=>{Ve=null,Go()},Ec));return}qe.value=!0;const i=Oe,c=Jt,g=new Set(Mt);Oe=!1,Jt=!1,Mt.clear();try{i&&await zo({force:c});const k=n.value;if(!k)return;const $=g.has(k),j=m.value[k]===!0,z=Gr(k),Y=ce.value[k]??"";(z.length>0&&z!==Y||$||j&&fe.value[k]!==!0||i&&fe.value[k]!==!0)&&await sr(k,{silent:!0})}catch{}finally{qe.value=!1,(Oe||Mt.size>0)&&typeof window<"u"&&Ve===null&&(Ve=window.setTimeout(()=>{Ve=null,Go()},Ec))}}async function Cl(){await Sl(),Oe=!Pe.value,n.value&&fe.value[n.value]!==!0&&Mt.add(n.value),await Go()}function Uu(){typeof window>"u"||pt||(Sl(),pt=Xk(i=>{if(i.method==="ready"){io(),Cl();return}On(i),Lr(i)}))}async function Sl(){try{const c=(await rT()).map(g=>Jr(g)).filter(g=>g!==null);co(c)}catch{}}async function xl(i){try{return await nT(i.id,{result:i.result,error:i.error}),uo(i.id),!0}catch(c){return X.value=c instanceof Error?c.message:"Failed to reply to server request",!1}}function Ri(){if(pt&&(pt(),pt=null),Oe=!1,Mt.clear(),Br.clear(),Ve!==null&&typeof window<"u"&&(window.clearTimeout(Ve),Ve=null),wt!==null&&typeof window<"u"&&(window.clearTimeout(wt),wt=null),Ar!==null&&typeof window<"u"&&(window.clearTimeout(Ar),Ar=null),typeof window<"u")for(const i of kt.values())window.clearTimeout(i);kt.clear(),$n=!1,r.value={},o.value={},a.value={},s.value={},u.value={},f.value={},Re.value={},Qe.value={},Ie.value={},et.value={},Me.value={},We.value={},it.value={},ct.value={},h.value={},y.value={},Bo(),te.value=null,pe.value={}}const Mi=Q(()=>{const i=n.value;return i?h.value[i]??[]:[]});function Al(i){const c=n.value;if(!c)return;const g=h.value[c];if(!g)return;const k=g.filter($=>$.id!==i);h.value=k.length>0?{...h.value,[c]:k}:xt(h.value,c),Bo()}function bs(i,c){const g=n.value;if(!g)return;const k=h.value[g];if(!k)return;const $=k.findIndex(ie=>ie.id===i),j=k.findIndex(ie=>ie.id===c);if($<0||j<0||$===j)return;const z=[...k],[Y]=z.splice($,1);z.splice(j,0,Y),h.value={...h.value,[g]:z},Bo()}function El(i){const c=n.value;if(!c)return;const g=h.value[c];if(!g)return;const k=g.find($=>$.id===i);k&&(Al(i),jn(k.collaborationMode),Nr(k.text,k.imageUrls,k.skills,"steer",k.fileAttachments))}function $i(i,c={}){un(i,c)}return{projectGroups:e,projectDisplayNameById:Ue,selectedThread:hr,selectedThreadTokenUsage:Eo,selectedThreadTerminalOpen:fn,isSelectedThreadInterruptPending:xo,selectedThreadServerRequests:Dn,selectedLiveOverlay:Ao,codexQuota:Aa,selectedThreadId:n,availableCollaborationModes:B,availableModelIds:F,selectedCollaborationMode:O,selectedModelId:ee,selectedReasoningEffort:se,selectedSpeedMode:Te,codexCliMissingError:ae,installedSkills:P,accountRateLimitSnapshots:L,messages:ca,hasMoreOlderMessages:Po,isLoadingThreads:W,isThreadListFullyLoaded:J,isLoadingMessages:D,isLoadingOlderMessages:Ea,isSendingMessage:U,isInterruptingTurn:ge,isUpdatingSpeedMode:we,isRollingBack:_e,error:X,refreshAll:v,refreshSkills:Yn,selectThread:b,loadMessages:sr,loadOlderMessages:Wo,ensureThreadMessagesLoaded:jt,setThreadTerminalOpen:Kr,toggleSelectedThreadTerminal:fa,archiveThreadById:w,renameThreadById:M,forkThreadById:ye,forkThreadFromTurn:st,rollbackSelectedThread:Ou,sendMessageToSelectedThread:Nr,sendMessageToNewThread:vt,interruptSelectedThreadTurn:ba,selectedThreadQueuedMessages:Mi,removeQueuedMessage:Al,reorderQueuedMessage:bs,steerQueuedMessage:El,setSelectedCollaborationMode:jn,readModelIdForThread:lt,setSelectedModelIdForThread:qr,setSelectedModelId:An,setSelectedReasoningEffort:Io,updateSelectedSpeedMode:Nn,respondToPendingServerRequest:xl,renameProject:Du,removeProject:Ii,reorderProject:zs,pinProjectToTop:Fu,startPolling:Uu,stopPolling:Ri,primeSelectedThread:$i}}const HM={class:"sidebar-root"},zM=["aria-pressed","aria-label","title"],WM={key:1,class:"sidebar-search-bar"},VM=["placeholder"],GM=["aria-label"],KM={class:"sidebar-skills-link-icon","aria-hidden":"true"},YM={class:"sidebar-skills-link-copy"},JM={class:"sidebar-skills-link-title"},QM={class:"sidebar-skills-link-subtitle"},XM={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},ZM={class:"sidebar-skills-link-copy"},e$={class:"sidebar-skills-link-title"},t$={class:"sidebar-skills-link-subtitle"},n$={class:"sidebar-settings-account-section"},r$={class:"sidebar-settings-account-header"},o$={class:"sidebar-settings-account-header-main"},a$=["aria-expanded","title"],s$={class:"sidebar-settings-account-collapse-icon"},i$={class:"sidebar-settings-account-title"},l$={class:"sidebar-settings-account-count"},u$=["disabled"],c$={key:0,class:"sidebar-settings-account-error visible-error-with-feedback"},d$=["href"],f$={class:"sidebar-settings-account-login"},h$=["disabled"],p$=["href"],m$={key:1,class:"sidebar-settings-account-empty"},v$={key:2,class:"sidebar-settings-account-list"},g$=["title","onMouseenter","onMouseleave"],y$={class:"sidebar-settings-account-main"},w$={class:"sidebar-settings-account-email"},b$={class:"sidebar-settings-account-meta"},_$={class:"sidebar-settings-account-quota"},k$={class:"sidebar-settings-account-id"},T$={class:"sidebar-settings-account-actions"},C$=["disabled","onClick"],S$=["disabled","onClick"],x$=["title"],A$={class:"sidebar-settings-label"},E$=["title"],P$={class:"sidebar-settings-label"},I$={class:"sidebar-settings-value"},R$=["title"],M$={class:"sidebar-settings-label"},$$={class:"sidebar-settings-value"},j$=["title"],L$={class:"sidebar-settings-label"},N$=["title"],O$={class:"sidebar-settings-label"},D$={class:"sidebar-settings-value"},F$=["title"],U$={class:"sidebar-settings-label"},B$=["title"],q$={class:"sidebar-settings-label"},H$=["href"],z$={class:"sidebar-settings-label"},W$={class:"sidebar-settings-value"},V$=["title"],G$={class:"sidebar-settings-label"},K$={key:1,class:"sidebar-settings-row sidebar-settings-error"},Y$=["href"],J$={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},Q$={class:"sidebar-settings-provider-info"},X$={class:"sidebar-settings-label"},Z$={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},ej={class:"sidebar-settings-key-group"},tj={class:"sidebar-settings-key-masked"},nj=["disabled","title"],rj=["placeholder"],oj=["disabled"],aj={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},sj={class:"sidebar-settings-label"},ij=["aria-label"],lj=["disabled"],uj=["disabled"],cj={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},dj={class:"sidebar-settings-provider-info"},fj={class:"sidebar-settings-label"},hj={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},pj={class:"sidebar-settings-key-group"},mj=["placeholder"],vj=["disabled"],gj={key:4,class:"sidebar-settings-row sidebar-settings-row--input"},yj={class:"sidebar-settings-label"},wj={class:"sidebar-settings-key-group"},bj=["placeholder"],_j={class:"sidebar-settings-label",style:{"margin-top":"4px"}},kj={class:"sidebar-settings-key-group"},Tj=["placeholder"],Cj=["disabled"],Sj={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},xj={class:"sidebar-settings-label"},Aj=["aria-label"],Ej=["title"],Pj={class:"sidebar-settings-label"},Ij={class:"sidebar-settings-label"},Rj={class:"sidebar-settings-value"},Mj={key:5,class:"sidebar-settings-telegram-panel"},$j={class:"sidebar-settings-field"},jj={class:"sidebar-settings-field-label"},Lj={class:"sidebar-settings-field"},Nj={class:"sidebar-settings-field-label"},Oj={class:"sidebar-settings-field-help"},Dj={key:0,class:"sidebar-settings-telegram-error"},Fj=["href"],Uj={class:"sidebar-settings-telegram-actions"},Bj=["disabled"],qj=["data-state","title"],Hj={class:"sidebar-settings-label"},zj=["data-state"],Wj={class:"sidebar-settings-context-meta"},Vj={class:"sidebar-settings-rate-limits"},Gj=["aria-label"],Kj={class:"sidebar-settings-button-version"},Yj={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},Jj={key:1,class:"skills-route-header-icon","aria-hidden":"true"},Qj={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},Xj={class:"content-body"},Zj={key:2,class:"content-grid content-grid-home"},eL={class:"new-thread-empty"},tL={class:"new-thread-hero"},nL=["title"],rL={class:"new-thread-folder-actions"},oL=["disabled"],aL={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},sL={class:"new-thread-launch-card-copy"},iL={class:"new-thread-launch-card-topline"},lL={class:"new-thread-launch-card-badge","aria-hidden":"true"},uL={class:"new-thread-launch-card-eyebrow"},cL={class:"new-thread-launch-card-title"},dL={class:"new-thread-launch-card-text"},fL={class:"new-thread-launch-card-actions"},hL=["aria-label","onKeydown"],pL={class:"new-thread-open-folder-header"},mL={class:"new-thread-open-folder-title"},vL={class:"new-thread-open-folder-label"},gL={class:"new-thread-open-folder-current"},yL=["placeholder","title","disabled","onKeydown"],wL=["disabled"],bL={class:"new-thread-open-folder-actions"},_L={class:"new-thread-open-folder-toggle"},kL=["aria-pressed","disabled"],TL={key:0,class:"new-thread-open-folder-create"},CL={class:"new-thread-open-folder-create-composer"},SL=["placeholder","onKeydown"],xL=["disabled"],AL={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},EL=["href"],PL=["placeholder","onKeydown"],IL={key:1,class:"new-thread-open-folder-error-actions"},RL={class:"new-thread-open-folder-error visible-error-with-feedback"},ML=["href"],$L=["disabled"],jL={key:2,class:"new-thread-open-folder-status"},LL={key:3,class:"new-thread-open-folder-status"},NL={key:4,class:"new-thread-open-folder-list"},OL=["title","disabled","onClick"],DL={class:"new-thread-open-folder-item-name"},FL=["disabled","onClick"],UL=["aria-label","onKeydown"],BL={class:"new-thread-open-folder-header"},qL={class:"new-thread-open-folder-title"},HL=["disabled"],zL=["aria-label"],WL=["aria-selected","disabled"],VL=["aria-selected","disabled"],GL={class:"new-thread-project-field"},KL={class:"new-thread-open-folder-label"},YL=["disabled","placeholder"],JL={key:0,class:"new-thread-project-field"},QL={class:"new-thread-open-folder-label"},XL=["disabled","placeholder","onKeydown"],ZL={key:1,class:"new-thread-project-field"},eN={class:"new-thread-open-folder-label"},tN=["disabled","onKeydown"],nN={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},rN=["href"],oN={class:"new-thread-project-modal-actions"},aN=["disabled"],sN=["disabled"],iN={key:3,class:"new-thread-branch-select"},lN={class:"new-thread-branch-select-label"},uN={class:"new-thread-branch-select-help"},cN={key:4,class:"new-thread-runtime-help"},dN={class:"worktree-init-status-title"},fN={class:"worktree-init-status-message"},hN={class:"composer-with-queue"},pN={key:0,class:"composer-runtime-error",role:"alert"},mN=["href"],vN={key:3,class:"content-grid"},gN={class:"content-thread"},yN={class:"composer-with-queue"},wN={key:0,class:"composer-runtime-error",role:"alert"},bN=["href"],_N={key:0,class:"project-zip-modal-backdrop",role:"presentation"},kN=["aria-label"],TN={class:"project-zip-modal-header"},CN={class:"project-zip-modal-title"},SN=["aria-label","disabled"],xN={class:"project-zip-modal-copy"},AN={class:"project-zip-progress-label",role:"status","aria-live":"polite"},EN={class:"project-zip-progress-track"},PN={key:0,class:"project-zip-modal-error",role:"alert"},IN={class:"project-zip-modal-actions"},RN=["disabled"],MN=["disabled"],$N=["disabled"],jN=["aria-label"],LN={class:"codex-login-modal-header"},NN={class:"codex-login-modal-title"},ON=["aria-label","disabled"],DN={class:"codex-login-modal-copy"},FN=["href"],UN=["placeholder","disabled"],BN={key:1,class:"codex-login-modal-error visible-error-with-feedback"},qN=["href"],HN={class:"codex-login-modal-actions"},zN=["disabled"],WN=["disabled"],Pp="codex-web-local.sidebar-collapsed.v1",Ip="codex-web-local.accounts-section-collapsed.v1",Rp="codex-web-local.terminal-quick-commands.v1",Mp="__toggle_terminal__",$p="codex-web-local.send-with-enter.v1",jp="codex-web-local.in-progress-send-mode.v1",Lp="codex-web-local.dark-mode.v1",Np="codex-web-local.dictation-click-to-toggle.v1",Op="codex-web-local.dictation-auto-send.v1",Dp="codex-web-local.dictation-language.v1",Fp="codex-web-local.chat-width.v1",VN=400,GN=er({__name:"App",setup(e){var _f,kf;const t=zi(()=>Vi(()=>import("./ThreadConversation-BTpe8eca.js"),__vite__mapDeps([0,1]))),n=zi(()=>Vi(()=>import("./ThreadTerminalPanel-BTLjAaIQ.js"),__vite__mapDeps([2,3]))),r=zi(()=>Vi(()=>import("./ReviewPane-BZOe7axm.js"),__vite__mapDeps([4,5]))),o=zi(()=>Vi(()=>import("./DirectoryHub-DPAFmuRH.js"),__vite__mapDeps([6,7]))),a=zi(()=>Vi(()=>import("./AutomationsPanel-uscQHN1e.js"),__vite__mapDeps([8,9]))),{t:s,uiLanguage:u,uiLanguageOptions:f,setUiLanguage:m}=fs(),h="codex-mobile",y="1.0.0",C={sendWithEnter:s("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:s("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:s("Switch between system theme, light mode, and dark mode."),chatWidth:s("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:s("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:s("Automatically send transcribed dictation when recording stops."),dictationLanguage:s("Choose transcription language or keep auto-detect.")},I={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},F={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:oe,selectedThread:V,selectedThreadTokenUsage:O,selectedThreadTerminalOpen:ee,selectedThreadServerRequests:se,selectedLiveOverlay:Te,codexQuota:Fe,selectedThreadId:ae,availableCollaborationModes:xe,availableModelIds:le,selectedCollaborationMode:be,selectedReasoningEffort:Ue,selectedSpeedMode:ce,codexCliMissingError:fe,installedSkills:Se,accountRateLimitSnapshots:De,messages:Ee,hasMoreOlderMessages:Re,isLoadingThreads:Ie,isThreadListFullyLoaded:Qe,isLoadingMessages:et,isLoadingOlderMessages:Me,isSendingMessage:We,isInterruptingTurn:it,isSelectedThreadInterruptPending:ct,isUpdatingSpeedMode:at,error:Je,refreshAll:te,refreshSkills:pe,selectThread:ve,ensureThreadMessagesLoaded:ke,loadOlderMessages:Xe,setThreadTerminalOpen:P,toggleSelectedThreadTerminal:L,archiveThreadById:W,forkThreadById:D,renameThreadById:J,forkThreadFromTurn:U,sendMessageToSelectedThread:ge,sendMessageToNewThread:we,interruptSelectedThreadTurn:_e,selectedThreadQueuedMessages:X,removeQueuedMessage:qe,reorderQueuedMessage:Pe,steerQueuedMessage:He,setSelectedCollaborationMode:ze,readModelIdForThread:nt,setSelectedModelIdForThread:pt,setSelectedReasoningEffort:Ve,updateSelectedSpeedMode:wt,respondToPendingServerRequest:kt,renameProject:H,removeProject:G,reorderProject:K,pinProjectToTop:he,startPolling:Ae,stopPolling:Ne,primeSelectedThread:Be,rollbackSelectedThread:Ct}=qM(),Oe=G_(),Jt=V_(),{isMobile:Mt}=Ed(),la=x(null),to=x(null),{buildFeedbackMailto:fr,feedbackMailtoBase:Ar,recordVisibleFailure:no}=Ld(),Dt=Ar();function Qt(l,d){d&&no(d);const _=l.currentTarget;_ instanceof HTMLAnchorElement&&(_.href=fr())}const ro=x(null),Er=x(null),$n=x(null),Br=x(null),ua=x(null),tr=x(!1),hr=x(!1),fn=x(!1),xo=x(!0),Dn=x([]),Ao=x(Yg()),Aa=x(""),Eo=x(null),ca=x(!1),Po=x("");let Ea=!1;const sn=x(!1),lt=x(""),Fn=x("local"),_n=x({}),da=new Map,un=x(""),qr=x([]),An=x(!1),hn=x({order:[],labels:{},projectOrder:[]}),gt=x({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),cn=x({phase:"idle",title:"",message:""}),Lt=x(Yy()),jn=x(""),Hr=x(!1),Un=x(null),Ln=x(null),kn=x(null),pr=x(null),Pr=x(null),Io=x(null);let Nn=null,Ro=null,Bn=0,oo=0,Mo=!1,ao=0,Ir=0,zr=0,mr=0;const vr=x("New Project (1)"),$o=x(""),gr=x(!1),Et=x(Qy()),Sn=x(!1),Wr=x(""),Vr=x(""),qn=x([]),Xt=x(null),nr=x(null),so=x(null),Rr=x(null),rr=x(!1),mn=x(!1),Pt=x({addedLineCount:0,removedLineCount:0}),En=x(""),$t=x({}),It=x(""),Hn=x(""),io=x({}),Gr=x(""),Kr=x(""),fa=x(!1),Nt=x(!1);function R(l,d){return`${l}\0${d?"with-reset-history":"without-reset-history"}`}const q=x(null),re=x([]),Le=x(!1),bt=x(!1),Zt=x(!1),Rt=x(!1),Ht=x(!1),en=x(""),zn=x(""),or=x(null),yr=x(""),Mr=x(""),Yr=x(""),dn=x(""),$r=x(Ku($p,!0)),ha=x(Ny()),jo=x(Ly()),Ke=x(Oy()),Ce=x(Ku(Np,!1)),xn=x(Ku(Op,!0)),pa=x(Gy()),Os=Q(()=>Ky()),Ds=Q(()=>{const{loaded:l,total:d}=gt.value,_=Hd(l);return d&&d>0?`${_} / ${Hd(d)}`:l>0?_:s("Preparing...")}),Wn=Q(()=>{const{loaded:l,total:d,phase:_}=gt.value;return _==="ready"?"100%":!d||d<=0?l>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(l/d*100)))}%`}),vn=x(!1),lo=x(!1),Jr=x(!1),Lo=x(""),hs=x(!1),ps=x(null),Vt=x(!1),ar=x(""),Pn=x("codex"),Ei=Q(()=>[{value:"codex",label:s("Codex")},{value:"openrouter",label:s("OpenRouter")},{value:"opencode-zen",label:s("OpenCode Zen")},{value:"custom",label:s("Custom endpoint")}]),No=x(""),Pa=x(""),uo=x("responses"),co=x("responses"),Ia=x(""),fo=x(!1),Ka=x(""),Oo=x(""),Tn=x(""),Do=x(!1),ho=x(!1),po=x(""),Cn=x(""),mo=x(!1),Fo=x(!1),Vn=x("create"),Uo=x(""),Ra=x(""),Ma=x(""),vo=x(!1),jr=x(""),In=x(!1),ma=x(null),Fs=x(null),Qr=x(!1),ms=x(null),Us=x(null),go=x(""),Gn=x(""),va=x(""),vs=x([]),gn=x(""),On=x(!1),Lr=x(!1),gs=x(!1),Xr=x(""),Bs=[Je,fe,En,Hn,dn,ar,Tn,Cn,jr,gn],qs=Q(()=>Bs.some(l=>l.value.trim().length>0)),wr=x({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),ga=x(null),ya=x(!1),Bo=x(!1),qo=x(typeof window<"u"?((_f=window.visualViewport)==null?void 0:_f.height)??window.innerHeight:0),ys=x(typeof window<"u"?((kf=window.visualViewport)==null?void 0:kf.offsetTop)??0:0),wa=x(typeof window<"u"?window.innerHeight:0);let Kn=null,$a=!1,Ho=!1,zo=!1,sr=0;const Wo=Q(()=>{const l=Oe.params.threadId;return typeof l=="string"?l:""}),jt=Q(()=>Oe.name==="home"),Yn=Q(()=>Oe.name==="skills"),ir=Q(()=>Oe.name==="automations"),Hs=Q(()=>{const l=Oe.query.automationId;return typeof l=="string"?l:""}),v=Q(()=>{var l;return ir.value?s("Automations"):Yn.value?s("Skills"):jt.value?s("Start new thread"):((l=V.value)==null?void 0:l.title)??s("Choose a thread")}),b=typeof window<"u"&&(window.location.hostname||window.location.host)||"codex-phone",w=Q(()=>{var d,_;return(((_=(d=V.value)==null?void 0:d.title)==null?void 0:_.trim())??"")||b}),M=Q(()=>Ee.value.filter(l=>{const d=Zy(l.messageType,l.role);return d==="worked"?!0:!(d==="turnActivity.live"||d==="turnError.live"||d==="agentReasoning.live")})),ye=Q(()=>Te.value),st=Q(()=>jt.value?"__new-thread__":ae.value),Gt=Q(()=>nt(st.value)),Nr=Q(()=>{const l=se.value;return l.length>0?l[l.length-1]:null}),vt=Q(()=>{var l,d;return jt.value?lt.value.trim():((d=(l=V.value)==null?void 0:l.cwd)==null?void 0:d.trim())??""}),Jn=Q(()=>xo.value&&(jt.value&&vt.value.length>0||Oe.name==="thread"&&ae.value.length>0)),Vo=Q(()=>Oe.name==="thread"&&ae.value.length>0||jt.value&&i.value),Or=Q(()=>jt.value?tr.value:ee.value),ba=Q(()=>!Mt.value||qo.value<=0||wa.value<=0?!1:wa.value-qo.value>120),Ou=Q(()=>ba.value||Or.value&&fn.value),ws=Q(()=>{var l,d;return((d=(l=V.value)==null?void 0:l.cwd)==null?void 0:d.trim())??lt.value.trim()}),Pi=Q(()=>{var l;return!jt.value&&((l=V.value)==null?void 0:l.inProgress)===!0}),Du=Q(()=>!jt.value&&!Yn.value&&!ir.value&&ae.value.trim().length>0),Ii=Q(()=>We.value||it.value||Pi.value||se.value.length>0);function zs(l){return Number.isFinite(l)?new Intl.NumberFormat("en-US",{notation:l>=1e3?"compact":"standard",maximumFractionDigits:l>=1e5?0:1}).format(Math.max(0,Math.trunc(l))):"0"}function Fu(l){if(!l)return s("Waiting for Codex thread/tokenUsage/updated events for this thread.");const d=[`${s("Current context usage")}: ${l.currentContextTokens.toLocaleString()} ${s("tokens")}`,`${s("Cumulative thread usage")}: ${l.total.totalTokens.toLocaleString()} ${s("tokens")}`];return typeof l.modelContextWindow=="number"?(d.unshift(`${s("Model context window")}: ${l.modelContextWindow.toLocaleString()} ${s("tokens")}`),d.push(`${s("Remaining context")}: ${(l.remainingContextTokens??0).toLocaleString()} ${s("tokens")}`)):d.push(s("Model context window is unavailable in the latest usage event.")),d.join(`
|
|
67
|
+
`)}function Ws(){vn.value&&(vn.value=!1,sC(!0))}function Go(){Ws(),Jt.push({name:"skills",query:{tab:"plugins"}})}const Cl=Q(()=>{var d;const l=(d=O.value)==null?void 0:d.remainingContextPercent;return l===null||typeof l!="number"?"pending":l<=10?"danger":l<=25?"warning":"ok"}),Uu=Q(()=>{const l=O.value;return l?typeof l.remainingContextTokens=="number"?`${zs(l.remainingContextTokens)} ${s("left")}`:`${zs(l.currentContextTokens)} ${s("used")}`:s("Awaiting data")}),Sl=Q(()=>{const l=O.value;return l?typeof l.modelContextWindow=="number"?`${zs(l.currentContextTokens)} ${s("used")} / ${zs(l.modelContextWindow)}`:s("Window size unavailable"):s("Updates after the next token usage event")}),xl=Q(()=>Fu(O.value));function Ri(l,d){const _=ut(l).trim(),N=eo(_);return!_||!N?!1:d.some(ne=>{const ue=ut(ne).trim();return ue!==_&&eo(ue)===N})}function Mi(l,d=""){const _=ut(l).trim(),N=d.trim();if(N)return N;const ne=eo(_),ue=[...hn.value.order,...B.value.map($e=>{var Kt,Zr;return((Zr=(Kt=$e.threads[0])==null?void 0:Kt.cwd)==null?void 0:Zr.trim())??""}).filter(Boolean)];return Ri(_,ue)?_:ne}function Al(){const l=new Set(hn.value.order),d=hn.value.projectOrder.filter(_=>l.has(_));for(const _ of hn.value.order)d.includes(_)||d.push(_);return d}function bs(l){const d=ut(l).trim(),_=[...hn.value.order,...B.value.map(N=>{var ne,ue;return((ue=(ne=N.threads[0])==null?void 0:ne.cwd)==null?void 0:ue.trim())??""}).filter(Boolean)];return Ri(d,_)?d:eo(d)}function El(l){const d=ut(l).trim();if(!d)return"";const _=[...hn.value.order,...B.value.map(N=>{var ne,ue;return((ue=(ne=N.threads[0])==null?void 0:ne.cwd)==null?void 0:ue.trim())??""}).filter(Boolean)];for(const N of hn.value.order){const ne=ut(N).trim();if(!ne)continue;const ue=eo(ne),$e=Ri(ne,_)?ne:ue;if(ne===d||$e===d||ue===d)return ne}return""}const $i=Q(()=>{var N,ne;const l=[],d=new Set;for(const ue of Al()){const $e=ue.trim();!$e||d.has($e)||(d.add($e),l.push({value:$e,label:Mi($e,hn.value.labels[$e])}))}for(const ue of B.value){const $e=((ne=(N=ue.threads[0])==null?void 0:N.cwd)==null?void 0:ne.trim())??"";!$e||d.has($e)||pu($e)||(d.add($e),l.push({value:$e,label:Mi($e,oe.value[ue.projectName])}))}const _=lt.value.trim();return _&&!d.has(_)&&l.unshift({value:_,label:Mi(_)}),l}),i=Q(()=>{const l=lt.value.trim();return l?_n.value[l]===!0:!1}),c=Q(()=>{var d,_;const l={};for(const N of B.value){const ne=Ys(N.projectName,((_=(d=N.threads[0])==null?void 0:d.cwd)==null?void 0:_.trim())??"");l[N.projectName]=ne?_n.value[ne]===!0:!1}return l}),g=Q(()=>{const l=un.value.trim(),d=[...qr.value];return l&&!d.some(_=>_.value===l)&&d.unshift({value:l,label:l}),d}),k=Q(()=>{const l=un.value.trim();if(!l)return"";const d=g.value.find(_=>_.value===l);return(d==null?void 0:d.label)??l}),$=Q(()=>Gn.value.trim()),j=Q(()=>{const l=po.value.trim();return!l||l==="."||l===".."?!1:!/[\\/]/u.test(l)}),z=Q(()=>j.value&&$.value.trim().length>0&&!gn.value),Y=Q(()=>{const l=Ra.value.trim();return!l||l==="."||l===".."?!1:!/[\\/]/u.test(l)}),ie=Q(()=>Uo.value.trim()?Vn.value==="create"?Y.value:Ma.value.trim().length>0:!1),me=Q(()=>{const l=ut(go.value).trim();return l||Gn.value.trim()}),Ge=Q(()=>mo.value?"Creating…":"Create"),St=Q(()=>In.value?Vn.value==="clone"?s("Cloning…"):s("Creating…"):Vn.value==="clone"?s("Clone repository"):s("Create project")),_t=Q(()=>{const l=Gn.value.trim(),d=va.value.trim();return!!(l&&d&&l!==d)}),Tt=Q(()=>{const l=[];_t.value&&l.push({key:`parent:${va.value}`,name:"..",path:va.value,kind:"parent"});for(const d of vs.value)l.push({key:`directory:${d.path}`,name:d.name,path:d.path,kind:"directory"});return l}),Ft=Q(()=>{const l=Xr.value.trim().toLowerCase();return l?Tt.value.filter(d=>d.kind==="parent"||d.name.toLowerCase().includes(l)):Tt.value}),br=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Ya=Q(()=>s(I[Ke.value].label)),ji=Q(()=>Or.value?s("Terminal"):s("Open terminal")),_s=Q(()=>{const l=new Map(Ao.value.map(_=>[_.value,_]));return[...Dn.value.map((_,N)=>({label:_.label,value:_.value,usageCount:0,lastUsedAt:0,...l.get(_.value)??{},custom:!1,sourceIndex:N}))].sort(Kg)}),Ja=Q(()=>[{label:Or.value?s("Hide terminal"):s("Open terminal"),value:Mp},..._s.value.map(l=>({label:l.label,value:l.value}))]),Vs=Q(()=>{const l=I[Ke.value],d=Math.max(0,wa.value-qo.value-ys.value);return{"--chat-column-max":l.columnMax,"--chat-card-max":l.cardMax,"--visual-viewport-height":qo.value>0?`${qo.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,ys.value)}px`,"--virtual-keyboard-inset":`${d}px`}}),Gs=Q(()=>{if(!wr.value.configured)return s("Not configured");const l=wr.value.active?s("Online"):s("Configured (offline)"),d=wr.value.allowAllUsers?s("allow all users"):`${wr.value.allowedUsers} ${s("allowed user(s)")}`,_=`${wr.value.mappedChats} ${s("chat(s)")}, ${wr.value.mappedThreads} ${s("thread(s)")}, ${d}`,N=wr.value.lastError?`, ${s("error")}: ${wr.value.lastError}`:"";return`${l}, ${_}${N}`});Ga(()=>{var l,d;document.addEventListener("pointerdown",ef),window.addEventListener("keydown",Kd),document.addEventListener("visibilitychange",tf),window.addEventListener("pageshow",nf),window.addEventListener("focus",rf),window.addEventListener("resize",yo),(l=window.visualViewport)==null||l.addEventListener("resize",yo),(d=window.visualViewport)==null||d.addEventListener("scroll",yo),yo(),Ol(),br==null||br.addEventListener("change",Ol),ew(),Ay(),ht(),Xa(),Ko(),Ni(),Ks(),Ju(),Zg(),Yd()}),ft(Bs,(l,d)=>{l.forEach((_,N)=>{if(_===d[N])return;const ne=_.trim();ne&&no(ne)})}),xu(()=>{var l,d;document.removeEventListener("pointerdown",ef),window.removeEventListener("keydown",Kd),document.removeEventListener("visibilitychange",tf),window.removeEventListener("pageshow",nf),window.removeEventListener("focus",rf),window.removeEventListener("resize",yo),(l=window.visualViewport)==null||l.removeEventListener("resize",yo),(d=window.visualViewport)==null||d.removeEventListener("scroll",yo),br==null||br.removeEventListener("change",Ol),Kn!==null&&(window.clearInterval(Kn),Kn=null),Nn&&(clearTimeout(Nn),Nn=null),$l(),Ne()});function yo(){var l,d;typeof window>"u"||(wa.value=Math.max(wa.value,window.innerHeight),qo.value=((l=window.visualViewport)==null?void 0:l.height)??window.innerHeight,ys.value=((d=window.visualViewport)==null?void 0:d.offsetTop)??0)}ft(jn,l=>{const d=l.trim();if(Nn&&(clearTimeout(Nn),Nn=null),!d){Io.value=null;return}Nn=setTimeout(()=>{XT(d,1e3).then(_=>{jn.value.trim()===d&&(Io.value=_.threadIds)}).catch(()=>{jn.value.trim()===d&&(Io.value=null)})},220)}),ft(ba,l=>{l||(fn.value=!1)}),ft(re,()=>{if(typeof window>"u")return;if(!re.value.some(d=>d.quotaStatus==="loading")){Kn!==null&&(window.clearInterval(Kn),Kn=null);return}Kn===null&&(Kn=window.setInterval(()=>{$a||($a=!0,Di({silent:!0}).finally(()=>{$a=!1}))},1500))},{deep:!0}),ft(De,()=>{Li().then(l=>{l&&te({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function Li(){if(!Ho||zo||Pn.value!=="codex"||re.value.length>0||De.value.length===0)return!1;zo=!0;const l=JSON.stringify(re.value.map(_=>_.accountId).sort());try{const _=await qh();re.value=_.accounts}catch{await Di({silent:!0})}const d=JSON.stringify(re.value.map(_=>_.accountId).sort());return l!==d}function Pl(){pe({force:!0})}async function Ks(){try{wr.value=await tC()}catch(l){const d=l instanceof Error?l.message:"Failed to load Telegram status";wr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:d}}}async function Ni(){try{const l=await eC();Ka.value=l.botToken,Oo.value=l.allowedUserIds.map(d=>String(d)).join(`
|
|
68
|
+
`),Tn.value=""}catch(l){Tn.value=l instanceof Error?l.message:"Failed to load Telegram configuration"}}async function ht(){const l=await aC();vn.value=l.dismissed!==!0}function Dr(l){const d=l.split(/[\n,]/).map(ne=>ne.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),_=d.includes("*"),N=Array.from(new Set(d.filter(ne=>/^-?\d+$/.test(ne)).map(ne=>Number.parseInt(ne,10))));return _?["*",...N]:N}async function ja(){const l=Ka.value.trim(),d=Dr(Oo.value);if(!l){Tn.value=s("Telegram bot token is required.");return}if(d.length===0){Tn.value=s("At least one allowed Telegram user ID or * is required.");return}Do.value=!0,Tn.value="";try{await ZT(l,d),Oo.value=d.map(_=>String(_)).join(`
|
|
69
|
+
`),await Promise.all([Ni(),Ks()]),window.alert(s("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(_){Tn.value=_ instanceof Error?_.message:s("Failed to connect Telegram bot"),Ks()}finally{Do.value=!1}}function Kv(){Hr.value=!Hr.value,Hr.value?zt(()=>{var l;return(l=Ln.value)==null?void 0:l.focus()}):jn.value=""}function Yv(){var l;jn.value="",(l=Ln.value)==null||l.focus()}function Bu(){return Un.value?Un.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function Jv(l){if(Lt.value||Mo)return;const d=l==null?void 0:l.currentTarget,_=d instanceof HTMLElement?d:Bu();Bn=(_==null?void 0:_.scrollTop)??Bn}function Qv(){const l=++oo,d=Bn,_=90;Mo=!0;const N=()=>{l===oo&&(Bn=d,Mo=!1)},ne=ue=>{if(l!==oo)return;if(Lt.value){N();return}const $e=Bu();if($e&&($e.scrollTop=d,Math.abs($e.scrollTop-d)<=1||ue>=_)){N();return}if(ue>=_||typeof window>"u"){N();return}window.requestAnimationFrame(()=>ne(ue+1))};zt(()=>ne(0))}function Xv(l){l.key==="Escape"&&(Hr.value=!1,jn.value="")}function Zv(l){l&&(Oe.name==="thread"&&Wo.value===l||(Jt.push({name:"thread",params:{threadId:l}}),Mt.value&&lr(!0)))}function eg(l){Oe.name==="automations"&&Hs.value!==l&&Jt.replace({name:"automations",query:l?{automationId:l}:{}})}async function tg(l){var d;Lt.value&&(lr(!1),await zt()),(d=la.value)==null||d.openAutomationEditorFromPanel(l)}async function ng(){var l;Lt.value&&(lr(!1),await zt()),(l=la.value)==null||l.openAutomationCreatorFromPanel()}function rg(){var l;Oe.name==="automations"&&((l=to.value)==null||l.loadAutomations())}async function og(l){l&&ae.value===l&&await My()}function ag(l){return l.length>8?l.slice(-8):l}function Od(l){const d=[l.planType||s("unknown")];return l.authMode&&d.unshift(l.authMode),d.join(" · ")}function sg(l){if(!l)return!1;const d=l.toLowerCase();return d.includes("payment required")||/\b402\b/.test(d)}function Oi(l){return l.unavailableReason==="payment_required"||sg(l.quotaError)}function Dd(l){return Le.value||bt.value||Zt.value||Rt.value||yr.value.length>0||l.isActive&&yr.value!==l.storageId&&Ii.value}function Il(l){return Mr.value===l.storageId}function Fd(l){return Yr.value===l.storageId||Il(l)}function ig(l){return Oi(l)?s("Unavailable"):l.isActive?s("Active"):bt.value?s("Switching…"):s("Switch")}function lg(l){return yr.value===l.storageId?s("Removing…"):Il(l)?s("Click again to remove"):s("Remove")}function ug(l){Yr.value=l}function cg(l){Yr.value===l&&(Yr.value=""),yr.value!==l&&Mr.value===l&&(Mr.value="")}function dg(l){const d=l.quotaSnapshot;if(!d)return null;const _=[d==null?void 0:d.primary,d==null?void 0:d.secondary].filter(ue=>ue!==null),N=_.find(ue=>ue.windowMinutes===10080);if(N)return N;const ne=_.filter(ue=>typeof ue.windowMinutes=="number"&&ue.windowMinutes>=10080).sort((ue,$e)=>(ue.windowMinutes??0)-($e.windowMinutes??0))[0]??null;return ne||(d.secondary??null)}function fg(l){if(typeof l!="number"||!Number.isFinite(l))return"";const d=new Date(l*1e3);return`${d.getMonth()+1}月${d.getDate()}日`}function Ud(l){var ue,$e;if(Oi(l))return l.quotaError||s("402 Payment Required");const d=l.quotaSnapshot,_=dg(l),N=(d==null?void 0:d.primary)??(d==null?void 0:d.secondary)??null,ne=_??N;if(ne){const Kt=Math.max(0,Math.min(100,100-Math.round(ne.usedPercent))),Zr=fg(ne.resetsAt);return Zr?`${Kt}% ${s("weekly remaining")} · ${Zr}`:`${Kt}% ${s("weekly remaining")}`}return(ue=d==null?void 0:d.credits)!=null&&ue.unlimited?s("Unlimited credits"):($e=d==null?void 0:d.credits)!=null&&$e.hasCredits&&d.credits.balance?`${d.credits.balance} ${s("credits")}`:l.quotaStatus==="loading"?s("Loading quota…"):l.quotaStatus==="error"?l.quotaError||s("Quota unavailable"):l.quotaStatus==="ready"||l.quotaStatus==="idle"?s("Quota unavailable"):s("Fetching account details…")}function hg(l){return[l.email||s("Account"),Od(l),Oi(l)?s("Unavailable account"):null,Ud(l),`${s("Workspace")} ${l.accountId}`].filter(Boolean).join(`
|
|
70
|
+
`)}async function Di(l={}){try{const d=await aT();re.value=d.accounts,d.accounts.some(_=>_.storageId===Yr.value)||(Yr.value=""),d.accounts.some(_=>_.storageId===Mr.value)||(Mr.value="")}catch(d){if(l.silent===!0)return;dn.value=d instanceof Error?d.message:s("Failed to load accounts")}}async function pg(){if(!(Le.value||bt.value||Zt.value||Rt.value)){dn.value="",Yr.value="",Mr.value="",Le.value=!0;try{const l=await qh();re.value=l.accounts,Ne(),Ae(),te({includeSelectedThreadMessages:!0})}catch(l){dn.value=l instanceof Error?l.message:s("Failed to refresh accounts")}finally{Le.value=!1}}}async function mg(l){if(!(bt.value||Le.value||Zt.value||Rt.value)){if(Ii.value){dn.value=s("Finish the current turn and pending requests before switching accounts.");return}dn.value="",Yr.value="",Mr.value="",bt.value=!0;try{const d=await lT(l);re.value=re.value.map(_=>_.storageId===l?d:{..._,isActive:!1}),Ne(),Ae(),te({includeSelectedThreadMessages:!0}),Di({silent:!0})}catch(d){dn.value=d instanceof Error?d.message:s("Failed to switch account")}finally{bt.value=!1}}}async function vg(){var l;if(!(Le.value||bt.value||Zt.value||Rt.value)){dn.value="",zn.value="",Zt.value=!0;try{const d=await sT();en.value=d,Ht.value=!0,window.open(d,"_blank","noopener,noreferrer"),await zt(),(l=or.value)==null||l.focus()}catch(d){dn.value=d instanceof Error?d.message:s("Failed to start Codex login")}finally{Zt.value=!1}}}function qu(){Rt.value||(Ht.value=!1,zn.value="")}async function gg(){const l=zn.value.trim();l&&await yg(l)}async function yg(l){if(!(Rt.value||l.length===0)){dn.value="",Rt.value=!0;try{const d=await iT(l);re.value=d.accounts,en.value="",zn.value="",Ht.value=!1,Ne(),Ae(),te({includeSelectedThreadMessages:!0})}catch(d){dn.value=d instanceof Error?d.message:s("Failed to complete Codex login")}finally{Rt.value=!1}}}async function wg(l){if(Le.value||bt.value||Zt.value||Rt.value||yr.value.length>0)return;const d=re.value.find(N=>N.storageId===l)??null;if(!d)return;if(Mr.value!==l){Mr.value=l;return}if(d.isActive&&Ii.value){dn.value=s("Finish the current turn and pending requests before removing the active account.");return}const _=d.isActive;dn.value="",Mr.value="",yr.value=l;try{const N=await uT(l);re.value=N.accounts,Ne(),Ae(),_&&te({includeSelectedThreadMessages:!0}),Di({silent:!0})}catch(N){dn.value=N instanceof Error?N.message:s("Failed to remove account")}finally{yr.value=""}}function bg(l){W(l)}async function _g(l){const d=await D(l);d&&(jt.value?await Jt.replace({name:"thread",params:{threadId:d}}):await Jt.push({name:"thread",params:{threadId:d}}),Mt.value&&lr(!0))}function Bd(l){const d=l.trim().replace(/\\/gu,"/");return d?d.includes("/.codex/worktrees/")||d.includes("/.git/worktrees/"):!1}function Ys(l,d=""){var ue,$e,Kt;const _=B.value.find(Zr=>Zr.projectName===l);if(!_)return El(l)||d.trim();const N=_.threads.find(Zr=>!Bd(Zr.cwd));return(((ue=N==null?void 0:N.cwd)==null?void 0:ue.trim())??((Kt=($e=_.threads[0])==null?void 0:$e.cwd)==null?void 0:Kt.trim())??"")||El(l)||d.trim()}function kg(l){var N,ne;const d=B.value.find(ue=>ue.projectName===l),_=Ys(l,((ne=(N=d==null?void 0:d.threads[0])==null?void 0:N.cwd)==null?void 0:ne.trim())??"");_&&(lt.value=_),Mt.value&&lr(!0),!jt.value&&Jt.push({name:"home"})}function Tg(l){var _;let d="";for(const N of B.value){const ne=N.threads.find(ue=>ue.id===l);if((_=ne==null?void 0:ne.cwd)!=null&&_.trim()){d=ne.cwd.trim();break}}!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}function Rl(l){var _,N;const d=B.value.find(ne=>ne.projectName===l);return Ys(l,((N=(_=d==null?void 0:d.threads[0])==null?void 0:_.cwd)==null?void 0:N.trim())??"")}const qd=Q(()=>Object.fromEntries(B.value.map(l=>[l.projectName,Rl(l.projectName).trim()]).filter(([,l])=>l.length>0)));function Cg(l){return(oe.value[l]??l).trim()||l}function Sg(l){return Cg(l).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function xg(l){const d=Rl(l);!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}async function Ag(l){const d=Rl(l);await Wd(d)}async function Eg(l){const d=Pg(l);await Wd(d)}function Pg(l){var d;for(const _ of B.value){const N=_.threads.find(ne=>ne.id===l);if((d=N==null?void 0:N.cwd)!=null&&d.trim())return N.cwd.trim()}return""}function Hd(l){if(!Number.isFinite(l)||l<=0)return"0 B";const d=["B","KB","MB","GB"];let _=l,N=0;for(;_>=1024&&N<d.length-1;)_/=1024,N+=1;return`${_>=10||N===0?_.toFixed(0):_.toFixed(1)} ${d[N]}`}function Ig(l,d){const _=URL.createObjectURL(l),N=document.createElement("a");N.href=_,N.download=d,document.body.appendChild(N),N.click(),document.body.removeChild(N),window.setTimeout(()=>URL.revokeObjectURL(_),3e4)}async function Rg(l,d){const N={files:[new File([l],d,{type:l.type||"application/zip"})],title:d};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 zd(){gt.value.phase!=="exporting"&&(gt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function Mg(){const{blob:l,fileName:d}=gt.value;!l||!d||(gt.value={...gt.value,error:""},Ig(l,d))}async function $g(){const{blob:l,fileName:d}=gt.value;if(!(!l||!d))try{gt.value={...gt.value,error:""},await Rg(l,d)}catch(_){if(_ instanceof DOMException&&_.name==="AbortError")return;const N=_ instanceof Error?_.message:"",ne=_ instanceof DOMException&&_.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(N);gt.value={...gt.value,error:ne?s("This browser blocked sharing the ZIP. Use Download instead."):N||s("Failed to share project. Use Download instead.")}}}async function Wd(l){if(!(!l||typeof document>"u")){gt.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:d,fileName:_}=await WT(l,({loaded:N,total:ne})=>{gt.value={...gt.value,phase:"exporting",loaded:N,total:ne}});gt.value={phase:"ready",loaded:d.size,total:d.size,blob:d,fileName:_,error:""}}catch(d){if(gt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},d instanceof DOMException&&d.name==="AbortError")return;const _=d instanceof Error?d.message:"Failed to export project.";window.alert(_)}}}async function jg(l){const d=Rl(l);if(!d||typeof window>"u"||(await Ml(d),_n.value[d]!==!0))return;const _=`${Sg(l)}-`,N=window.prompt("New worktree folder name",_);if(N===null)return;const ne=N.trim();if(ne){if(ne.includes("/")||ne.includes("\\")||ne==="."||ne===".."){window.alert("Worktree name must be a single folder name.");return}try{const ue=await $T(d,ne),$e=await zl(ue.cwd,{createIfMissing:!1,label:""});if(!$e)return;lt.value=$e,Fn.value="local",he(bs($e)),await Xa(),await Ko(),Mt.value&&lr(!0),jt.value||await Jt.push({name:"home"})}catch(ue){const $e=ue instanceof Error?ue.message:"Failed to create worktree.";window.alert($e)}}}function Lg(){var _,N,ne;const l=V.value;if(!l)return"";const d=((_=l.projectName)==null?void 0:_.trim())??"";return d?Ys(d,((ne=l.cwd)==null?void 0:ne.trim())??""):((N=l.cwd)==null?void 0:N.trim())??""}function Vd(){const l=Lg();l&&(lt.value=l),Fn.value="local",Mt.value&&lr(!0),!jt.value&&Jt.push({name:"home"})}function Ng(){lt.value="",Fn.value="local",Mt.value&&lr(!0),!jt.value&&Jt.push({name:"home"})}async function Ml(l){const d=l.trim();if(!d||Object.prototype.hasOwnProperty.call(_n.value,d))return;const _=da.get(d);if(_){const ue=await _;Object.prototype.hasOwnProperty.call(_n.value,d)||(_n.value={..._n.value,[d]:ue});return}const N=NT(d).then(ue=>ue.isGitRepo).catch(()=>!1).finally(()=>{da.delete(d)});da.set(d,N);const ne=await N;Object.prototype.hasOwnProperty.call(_n.value,d)||(_n.value={..._n.value,[d]:ne})}function Og(l){H(l.projectName,l.displayName)}function Dg(l){J(l.threadId,l.title)}async function Fg(l){await G(l),await Xa(),Ko()}function Ug(l){K(l.projectName,l.toIndex)}function Bg(l){var N,ne;const d=B.value.find(ue=>ue.projectName===l),_=Ys(l,((ne=(N=d==null?void 0:d.threads[0])==null?void 0:N.cwd)==null?void 0:ne.trim())??"");Ml(_)}function Gd(l){qg(l)}async function qg(l){var N;const d=await kt(l),_=((N=l.followUpMessageText)==null?void 0:N.trim())??"";if(!(!d||!_||jt.value))try{await ge(_,[],[],"steer",[])}catch{}}async function Hg(l){const d=await U(l.threadId,l.turnIndex);d&&(await Jt.push({name:"thread",params:{threadId:d}}),ae.value!==d&&await ve(d),Mt.value&&lr(!0))}function lr(l){var d;if(Lt.value!==l){if(l){const _=(d=Bu())==null?void 0:d.scrollTop;typeof _=="number"&&(_>0||Bn===0)&&(Bn=_)}Lt.value=l,Jy(l),l||Qv()}}function Kd(l){if(l.defaultPrevented)return;if(l.key==="Escape"&&gr.value){gr.value=!1;return}if(!l.ctrlKey&&!l.metaKey||l.shiftKey||l.altKey)return;const d=l.key.toLowerCase();if(d==="b"){l.preventDefault(),lr(!Lt.value);return}if(d==="j"&&Oe.name==="thread"&&ae.value){l.preventDefault(),Hu();return}d==="j"&&jt.value&&vt.value&&(l.preventDefault(),Hu())}function Hu(){if(xo.value){if(jt.value){if(!vt.value)return;tr.value=!tr.value,tr.value||Fi();return}L(),ee.value||Fi()}}function zg(l){if(Aa.value="",!!l){if(l===Mp){Hu();return}Wg(l)}}async function Wg(l){if(!xo.value||!vt.value)return;if(jt.value)tr.value=!0;else if(ae.value)P(ae.value,!0);else return;const d=await Vg();if(d)try{await d.runQuickCommand(l),Gg(l)}catch{}}async function Vg(){for(let l=0;l<20;l+=1){await zt();const d=jt.value?Br.value:ua.value;if(d)return d;await new Promise(_=>window.setTimeout(_,25))}return null}async function Yd(){const l=vt.value.trim();if(!l){Dn.value=[];return}try{Dn.value=await tT(l)}catch{Dn.value=[]}}function Gg(l){const d=Jd(l);if(!d)return;const _=Ao.value.find(Kt=>Kt.value===d),N=Dn.value.findIndex(Kt=>Kt.value===d),ne=N>=0?Dn.value[N]:null;if(!ne)return;const ue={label:(_==null?void 0:_.label)||(ne==null?void 0:ne.label)||d,value:d,custom:!1,usageCount:((_==null?void 0:_.usageCount)??0)+1,lastUsedAt:Date.now(),sourceIndex:N>=0?N:void 0},$e=[...Ao.value.filter(Kt=>Kt.value!==d),ue];Ao.value=$e,Jg($e)}function Jd(l){return l.trim().replace(/\s+/g," ")}function Kg(l,d){if(d.usageCount!==l.usageCount)return d.usageCount-l.usageCount;if(d.lastUsedAt!==l.lastUsedAt)return d.lastUsedAt-l.lastUsedAt;const _=typeof l.sourceIndex=="number"?l.sourceIndex:Number.MAX_SAFE_INTEGER,N=typeof d.sourceIndex=="number"?d.sourceIndex:Number.MAX_SAFE_INTEGER;return _-N}function Yg(){if(typeof window>"u")return[];try{const l=window.localStorage.getItem(Rp);if(!l)return[];const d=JSON.parse(l);if(!Array.isArray(d))return[];const _=new Set,N=[];for(const ne of d){const ue=ne!==null&&typeof ne=="object"&&!Array.isArray(ne)?ne:null,$e=Jd(Qd(ue==null?void 0:ue.value));!$e||_.has($e)||(_.add($e),N.push({label:Qd(ue==null?void 0:ue.label)||$e,value:$e,custom:(ue==null?void 0:ue.custom)!==!1,usageCount:Xd(ue==null?void 0:ue.usageCount),lastUsedAt:Xd(ue==null?void 0:ue.lastUsedAt)}))}return N}catch{return[]}}function Jg(l){typeof window>"u"||window.localStorage.setItem(Rp,JSON.stringify(l.map(d=>({label:d.label,value:d.value,custom:d.custom===!0,usageCount:d.usageCount,lastUsedAt:d.lastUsedAt}))))}function Qd(l){return typeof l=="string"?l:""}function Xd(l){if(typeof l=="number"&&Number.isFinite(l))return Math.max(0,Math.trunc(l));if(typeof l=="string"){const d=Number(l);if(Number.isFinite(d))return Math.max(0,Math.trunc(d))}return 0}function Zd(l){if(hr.value=l,!l){fn.value=!1,$l();return}fn.value=!0,$l(),Ro=setTimeout(()=>{Ro=null,ba.value||(fn.value=!1)},1500)}function Qg(){tr.value=!1,Fi()}function Xg(){ae.value&&P(ae.value,!1),Fi()}function Fi(){hr.value=!1,fn.value=!1,$l()}function $l(){Ro&&(clearTimeout(Ro),Ro=null)}async function Zg(){try{const l=await eT();xo.value=l.available,l.available||(tr.value=!1,ae.value&&P(ae.value,!1))}catch{xo.value=!1,tr.value=!1}}function ef(l){var _,N;const d=l.target;if(d instanceof Node){if(hr.value){const ne=d instanceof Element?d:d.parentElement;ne!=null&&ne.closest(".thread-terminal-panel")||Fi()}gr.value&&((_=pr.value)!=null&&_.contains(d)||(N=Pr.value)!=null&&N.contains(d)||(gr.value=!1))}}function ey(l){var _,N;if(!gr.value)return;const d=l.target;d instanceof Node&&((_=pr.value)!=null&&_.contains(d)||(N=Pr.value)!=null&&N.contains(d)||(gr.value=!1))}function tf(){if(!(typeof document>"u")&&Mt.value){if(document.visibilityState==="hidden"){ga.value=Date.now(),ya.value=!1;return}zu()}}function nf(l){l.persisted&&zu()}function rf(){Oe.name==="home"&&(Xa(),Ko()),zu()}function zu(){typeof window>"u"||typeof document>"u"||!Mt.value||document.visibilityState!=="visible"||ya.value||ga.value===null||Date.now()-ga.value<VN||(ya.value=!0,ga.value=null,ty())}async function ty(){if(!Bo.value){Bo.value=!0;try{await te({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Xu()}finally{Bo.value=!1}}}function of(l){const d=l.text;jl();const _=Eo.value,N=l.mode==="queue"&&_&&_.threadId===ae.value?_.queueIndex:void 0;if(Eo.value=null,jt.value){tw(d,l.imageUrls,l.skills,l.fileAttachments);return}ge(d,l.imageUrls,l.skills,l.mode,l.fileAttachments,N)}function ny(l){const d=X.value.findIndex(ue=>ue.id===l),_=d>=0?X.value[d]:void 0,N=Er.value;if(!_||!N||N.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Eo.value=ae.value?{threadId:ae.value,queueIndex:d}:null;const ne={text:_.text,imageUrls:[..._.imageUrls],fileAttachments:_.fileAttachments.map(ue=>({...ue})),skills:_.skills.map(ue=>({...ue}))};N.hydrateDraft(ne),qe(l)}function jl(){if(!Mt.value||jt.value)return;const l=()=>{var d;(d=$n.value)==null||d.jumpToLatest()};l(),zt(()=>{l(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{l(),window.requestAnimationFrame(l)})})}function ry(l){lt.value=l.trim(),Cn.value=""}function oy(l){un.value=l.trim()}function Qa(l){const d=vt.value.trim();return!l||d!==l?!1:Oe.name==="thread"||Oe.name==="home"&&i.value}function af(){ao+=1,Ir+=1,zr+=1,mr+=1,qn.value=[],Xt.value=null,nr.value=null,so.value=null,Rr.value=null,rr.value=!1,mn.value=!1,Pt.value={addedLineCount:0,removedLineCount:0},$t.value={},It.value="",Hn.value="",io.value={},Gr.value="",Kr.value="",En.value="",fa.value=!1}function sf(l){const d=l.trim();if(!d){Pt.value={addedLineCount:0,removedLineCount:0};return}const _=++mr;BT(d,"unstaged").then(N=>{_!==mr||!Qa(d)||(Pt.value={addedLineCount:N.addedLineCount,removedLineCount:N.removedLineCount})}).catch(()=>{_!==mr||!Qa(d)||(Pt.value={addedLineCount:0,removedLineCount:0})})}async function Ui(l){var N,ne,ue;const d=l.trim();if(!d){af();return}const _=++ao;fa.value=!0,En.value="";try{const $e=await LT(d);if(_!==ao||!Qa(d))return;qn.value=$e.options,Xt.value=$e.currentBranch,nr.value=$e.headSha,so.value=$e.headSubject,Rr.value=$e.headDate,rr.value=$e.detached,mn.value=$e.dirty,sf(d);const Kt=((N=$e.currentBranch)==null?void 0:N.trim())||((ue=(ne=$e.options[0])==null?void 0:ne.value)==null?void 0:ue.trim())||"";Kt&&lf({branch:Kt,includeResetHistory:!0})}catch{if(_!==ao||!Qa(d))return;qn.value=[],Xt.value=null,nr.value=null,so.value=null,Rr.value=null,rr.value=!1,mn.value=!1,Pt.value={addedLineCount:0,removedLineCount:0}}finally{_===ao&&(fa.value=!1)}}function ay(l){Xt.value=l.currentBranch,nr.value=l.headSha,so.value=l.headSubject,Rr.value=l.headDate,rr.value=l.detached,mn.value=l.dirty,sf(vt.value)}function sy(l){if(Nt.value)return;const d=l.trim();if(!d||d===(Xt.value??""))return;const _=vt.value.trim();_&&(Nt.value=!0,En.value="",OT(_,d).then(N=>(Xt.value=N||d,nr.value=null,so.value=null,Rr.value=null,rr.value=!1,Sn.value=!1,Ui(_))).catch(N=>{const ne=N instanceof Error?N.message:"Failed to switch branch";Ui(_).finally(()=>{En.value=ne})}).finally(()=>{Nt.value=!1}))}function iy(l){if(Nt.value)return;const d=l.branch.trim(),_=l.sha.trim(),N=vt.value.trim();!d||!_||!N||(Nt.value=!0,En.value="",UT(N,d,_).then(ne=>(ay(ne),Sn.value=!1,Ui(N))).catch(ne=>{const ue=ne instanceof Error?ne.message:"Failed to reset branch to commit";Ui(N).finally(()=>{En.value=ue})}).finally(()=>{Nt.value=!1}))}function lf(l){const d=(typeof l=="string"?l:l.branch).trim(),_=typeof l=="string"?!0:l.includeResetHistory!==!1,N=vt.value.trim(),ne=R(d,_);if(!d||!N||It.value===ne||(Hn.value="",$t.value[ne]))return;const ue=++Ir;It.value=ne,DT(N,d,{includeResetHistory:_}).then($e=>{ue!==Ir||!Qa(N)||($t.value={...$t.value,[ne]:$e})}).catch($e=>{ue!==Ir||!Qa(N)||(Hn.value=$e instanceof Error?$e.message:"Failed to load branch commits")}).finally(()=>{ue===Ir&&It.value===ne&&(It.value="")})}function ly(l){const d=l.trim(),_=vt.value.trim();if(!d||!_||Gr.value===d||(Kr.value="",io.value[d]))return;const N=++zr;Gr.value=d,FT(_,d).then(ne=>{N!==zr||!Qa(_)||(io.value={...io.value,[d]:ne})}).catch(ne=>{N!==zr||!Qa(_)||(Kr.value=ne instanceof Error?ne.message:"Failed to load commit files")}).finally(()=>{N===zr&&Gr.value===d&&(Gr.value="")})}function uy(l){const d=l.path.trim(),_=l.sha.trim();!d||!_||(Wr.value=d,Vr.value=_,Sn.value=!0)}function cy(){Wr.value="",Vr.value="",Sn.value=!Sn.value}function dy(){!Wr.value&&!Vr.value||(Wr.value="",Vr.value="",Sn.value=!1)}async function fy(){const l=await Nl();l&&(await Ko(),Uo.value=l,Ra.value=vr.value.trim()||"New Project (1)",Ma.value="",jr.value="",Vn.value="create",Fo.value=!0,zt(()=>{var d;return(d=ma.value)==null?void 0:d.focus()}))}function Ll(){In.value||(Fo.value=!1,jr.value="")}async function hy(){const l=Uo.value.trim(),d=Ra.value.trim();if(!Y.value)throw new Error("Enter a single project folder name.");const _=ff(df(l,d));return _?zl(_,{createIfMissing:!0,label:""}):""}async function py(){const l=Uo.value.trim(),d=Ma.value.trim();return d?KT(d,l):""}async function Wu(){if(!(!ie.value||In.value)){jr.value="",In.value=!0;try{const l=Vn.value==="clone"?await py():await hy();if(!l)return;lt.value=l,he(bs(l)),await Xa(),await Ko(),Fo.value=!1}catch(l){jr.value=l instanceof Error?l.message:"Failed to create or clone project."}finally{In.value=!1}}}function my(){vy(Fs.value)}function vy(l){vo.value||!l||(l.value="",l.click())}async function gy(l,d,_){vo.value=!0;try{const N=await Nl();if(!N)return;const ne=await d(N);if(!ne.path)return;lt.value=ne.path,he(bs(ne.path)),await Xa(),await te({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ko()}catch(N){const ne=N instanceof Error?N.message:_;window.alert(ne)}finally{vo.value=!1,l&&(l.value="")}}async function yy(l){var N;const d=l.target instanceof HTMLInputElement?l.target:null,_=((N=d==null?void 0:d.files)==null?void 0:N[0])??null;!_||vo.value||await gy(d,ne=>VT(_,ne),"Failed to import project.")}async function wy(){const l=lt.value.trim()||await Nl();l&&(ho.value=!1,Qr.value=!0,Xr.value="",await Za(l),gn.value||zt(()=>{var d;return(d=ms.value)==null?void 0:d.focus()}))}function Js(){sr+=1,Qr.value=!1,On.value=!1,gn.value="",Xr.value="",go.value="",Bi()}async function by(l){!l||On.value||(Xr.value="",await Za(l))}function _y(){const l=Gn.value.trim();!Qr.value||!l||Za(l)}function ky(){const l=me.value;!Qr.value||!l||On.value||Za(l)}function Ty(){if(!Qr.value||On.value||Lr.value)return;const l=me.value,d=Gn.value.trim();!l||l===d||Za(l)}function Cy(){const l=me.value,d=Gn.value.trim();if(l){if(l!==d){Za(l);return}Vu(l)}}async function Vu(l=me.value){const d=ut(l).trim();if(d){gn.value="",Lr.value=!0;try{const _=await zl(d,{createIfMissing:!1,label:""});if(!_){gn.value="Failed to open the selected folder.";return}lt.value=_,he(bs(_)),await Xa(),await te({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ko(),Js()}catch(_){gn.value=_ instanceof Error?_.message:"Failed to open the selected folder."}finally{Lr.value=!1}}}async function Sy(){if(Cn.value="",ho.value){Bi();return}if(!Qr.value){const l=lt.value.trim()||await Nl();if(!l||(Qr.value=!0,Xr.value="",await Za(l),gn.value))return}gn.value||(po.value=vr.value,ho.value=!0,zt(()=>{var l;return(l=q.value)==null?void 0:l.focus()}))}function Bi(){Cn.value="",po.value="",ho.value=!1}async function uf(){const l=po.value.trim();if(!l)return;if(Cn.value="",gn.value){Cn.value="Reload the current folder before creating a new one.";return}mo.value=!0;const d=$.value.trim(),_=ff(df(d,l));if(!_){Cn.value="Unable to determine where the new folder should be created.",mo.value=!1;return}if(!j.value){Cn.value="Enter a single folder name.",mo.value=!1;return}try{const N=await GT(_);if(!N){Cn.value="Failed to create the folder.";return}Cn.value="",Xr.value="",await Za(N),Bi()}catch(N){Cn.value=N instanceof Error?N.message:"Failed to create folder."}finally{mo.value=!1}}async function xy(){var d;if(typeof window>"u")return!1;const l=((d=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:d.trim())??"";if(!l)return!1;try{const _=await zl(l,{createIfMissing:!1,label:""});if(!_)return!1;lt.value=_,he(bs(_)),await Jt.replace({name:"home"}),await Xa();const N=new URL(window.location.href);return N.searchParams.delete("openProjectPath"),window.history.replaceState({},"",N.toString()),!0}catch{return!1}}async function Nl(){const l=cf();if(l)return l;try{const d=await Yh();if(d)return $o.value=d,d}catch{}return""}async function Ko(){const l=cf();if(!l){vr.value="New Project (1)";return}try{const d=await JT(l);vr.value=d.name||"New Project (1)"}catch{vr.value="New Project (1)"}}function cf(){var _,N;const l=lt.value.trim();if(l)return vi(l);const d=((N=(_=$i.value[0])==null?void 0:_.value)==null?void 0:N.trim())??"";return d?vi(d):$o.value.trim()}async function Ay(){try{$o.value=await Yh()}catch{$o.value=""}}async function Xa(){try{const l=await ai();hn.value={order:[...l.order],labels:{...l.labels},projectOrder:[...l.projectOrder]}}catch{hn.value={order:[],labels:{},projectOrder:[]}}}async function Za(l){const d=++sr,_=ut(l).trim();go.value=_,Gn.value=_,gn.value="",On.value=!0;try{const N=await qT(l,{showHidden:gs.value});if(d!==sr)return;go.value=N.path,Gn.value=N.path,va.value=N.parentPath,vs.value=N.entries}catch(N){if(d!==sr)return;gn.value=N instanceof Error?N.message:"Failed to load local folders.",va.value=vi(Gn.value),vs.value=[],Bi()}finally{d===sr&&(On.value=!1)}}function df(l,d){const _=ut(l).trim(),N=ut(d).trim().replace(/^[\\/]+/u,"");if(!_||!N)return"";const ne=_.includes("\\")&&!_.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(_))return`${_.slice(0,2)}${ne}${N}`;if(/^\/+$/u.test(_))return`/${N}`;const ue=_.replace(/[\\/]+$/u,"");return ue?`${ue}${ne}${N}`:""}function ff(l){const d=ut(l).trim();if(!d)return"";const _=d.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(_){const[,ne,ue,$e=""]=_,Kt=Gu($e.split(/[\\/]+/u));return Kt.length>0?`\\\\${ne}\\${ue}\\${Kt.join("\\")}`:`\\\\${ne}\\${ue}`}const N=d.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(N){const[,ne,ue=""]=N,$e=d.includes("\\")&&!d.includes("/")?"\\":"/",Kt=Gu(ue.split(/[\\/]+/u));return Kt.length>0?`${ne}${$e}${Kt.join($e)}`:`${ne}${$e}`}if(d.startsWith("/")){const ne=Gu(d.split("/"));return ne.length>0?`/${ne.join("/")}`:"/"}return d}function Gu(l){const d=[];for(const _ of l){const N=_.trim();if(!(!N||N===".")){if(N===".."){d.length>0&&d.pop();continue}d.push(N)}}return d}function Ey(l){Pe(l.draggedId,l.targetId)}function hf(l){pt(st.value,l)}function pf(l){Ve(l)}function mf(l){wt(l)}function Py(){_e()}function Iy(l){const d=l.turnId.trim();if(d.length>0){const _=[...M.value].reverse().find(N=>{var ne;return N.role==="user"&&(((ne=N.turnId)==null?void 0:ne.trim())??"")===d&&N.text.trim().length>0});_!=null&&_.text&&Er.value&&Er.value.appendTextToDraft(_.text)}Ct(l.turnId)}function Ry(l){jt.value||!ae.value||(ze("default"),jl(),ge("Implement",[],[],"steer",[],void 0,"default"))}async function My(){if(jt.value||Yn.value||ir.value||!V.value||M.value.length===0)return;const l=$y();try{await Nv(l)}catch{}}function $y(){var _,N,ne;const l=[],d=((N=(_=V.value)==null?void 0:_.title)==null?void 0:N.trim())||"Untitled thread";l.push(`# ${jy(d)}`),l.push(""),l.push(`- Exported: ${new Date().toISOString()}`),l.push(`- Thread ID: ${((ne=V.value)==null?void 0:ne.id)??""}`),l.push(""),l.push("---"),l.push("");for(const ue of M.value){const $e=ue.role?ue.role.toUpperCase():"MESSAGE";l.push(`## ${$e}`),l.push("");const Kt=ue.text.trim();if(Kt&&(l.push(Kt),l.push("")),ue.commandExecution&&(l.push("```text"),l.push(`command: ${ue.commandExecution.command}`),l.push(`status: ${ue.commandExecution.status}`),ue.commandExecution.cwd&&l.push(`cwd: ${ue.commandExecution.cwd}`),ue.commandExecution.exitCode!==null&&l.push(`exitCode: ${ue.commandExecution.exitCode}`),l.push(ue.commandExecution.aggregatedOutput||"(no output)"),l.push("```"),l.push("")),ue.fileAttachments&&ue.fileAttachments.length>0){l.push("Attachments:");for(const Zr of ue.fileAttachments)l.push(`- ${Zr.path}`);l.push("")}if(ue.images&&ue.images.length>0){l.push("Images:");for(const Zr of ue.images)l.push(`- ${Zr}`);l.push("")}}return`${l.join(`
|
|
71
|
+
`).trimEnd()}
|
|
72
|
+
`}function jy(l){return l.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Ku(l,d){if(typeof window>"u")return d;const _=window.localStorage.getItem(l);return _===null?d:_==="1"}function Ly(){if(typeof window>"u")return"system";const l=window.localStorage.getItem(Lp);return l==="light"||l==="dark"?l:"system"}function Ny(){if(typeof window>"u")return"steer";const l=window.localStorage.getItem(jp);return l==="steer"||l==="queue"?l:"queue"}function Oy(){if(typeof window>"u")return"standard";const l=window.localStorage.getItem(Fp);return l==="standard"||l==="wide"||l==="extra-wide"?l:"standard"}function Dy(){$r.value=!$r.value,window.localStorage.setItem($p,$r.value?"1":"0")}function Fy(){ha.value=ha.value==="steer"?"queue":"steer",window.localStorage.setItem(jp,ha.value)}function Uy(){const l=["system","light","dark"],d=l.indexOf(jo.value);jo.value=l[(d+1)%l.length],window.localStorage.setItem(Lp,jo.value),Ol()}function By(){const l=["standard","wide","extra-wide"],d=l.indexOf(Ke.value);Ke.value=l[(d+1)%l.length],window.localStorage.setItem(Fp,Ke.value)}function qy(){Ce.value=!Ce.value,window.localStorage.setItem(Np,Ce.value?"1":"0")}function Hy(){xn.value=!xn.value,window.localStorage.setItem(Op,xn.value?"1":"0")}async function zy(l){if(!Jr.value){Jr.value=!0;try{if(l==="codex"){Pn.value="codex";const d=await Vh(!1);lo.value=d.enabled}else if(l==="openrouter"){Pn.value="openrouter";const d=await Vh(!0);lo.value=d.enabled,await Zs("","",{wireApi:co.value,provider:"openrouter"})}else l==="opencode-zen"?(Pn.value="opencode-zen",await Zs("",Ia.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),lo.value=!0):l==="custom"&&(Pn.value="custom",No.value.trim()&&Pa.value.trim()&&(await Zs(No.value.trim(),Pa.value.trim(),{wireApi:uo.value}),lo.value=!0));ar.value="",await te({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(d){ar.value=d instanceof Error?d.message:"Failed to switch provider"}finally{Jr.value=!1}}}async function Yu(){if(Vt.value)return;const l=No.value.trim();if(l){Vt.value=!0;try{ar.value="",await Zs(l,Pa.value.trim(),{wireApi:uo.value}),lo.value=!0,await te({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(d){ar.value=d instanceof Error?d.message:"Failed to save custom endpoint"}finally{Vt.value=!1}}}async function vf(l){if(Vt.value||Jr.value||co.value===l)return;const d=co.value;co.value=l,Vt.value=!0;try{ar.value="",await Zs("","",{wireApi:l,provider:"openrouter"}),lo.value=!0,await te({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(_){co.value=d,ar.value=_ instanceof Error?_.message:"Failed to save OpenRouter API format"}finally{Vt.value=!1}}async function gf(){if(Vt.value)return;const l=Ia.value.trim();if(l){Vt.value=!0;try{ar.value="",await Zs("",l,{wireApi:"responses",provider:"opencode-zen"}),lo.value=!0,await te({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(d){ar.value=d instanceof Error?d.message:"Failed to save OpenCode Zen config"}finally{Vt.value=!1}}}async function yf(){if(!Vt.value){Vt.value=!0;try{const l=Lo.value.trim();await Gh(l),Lo.value="",await Ju(),await te({includeSelectedThreadMessages:!1})}catch{}finally{Vt.value=!1}}}async function Wy(){if(!Vt.value){Vt.value=!0;try{await Gh(""),Lo.value="",await Ju(),await te({includeSelectedThreadMessages:!1})}catch{}finally{Vt.value=!1}}}async function Ju(){try{const l=Pn.value,d=await _T();lo.value=d.enabled,hs.value=d.customKey??!1,ps.value=d.maskedKey??null,d.enabled?d.provider==="opencode-zen"?Pn.value="opencode-zen":d.provider==="custom"?(Pn.value="custom",No.value=d.customBaseUrl??"",uo.value=d.wireApi==="chat"?"chat":"responses"):(Pn.value="openrouter",co.value=d.wireApi==="chat"?"chat":"responses"):Pn.value="codex",Ho=d.hasCodexAuth===!0,Ho||(zo=!1);const _=Pn.value!==l;_&&await te({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const N=await Li();N&&await te({includeSelectedThreadMessages:!1,providerChanged:_||N,awaitAncillaryRefreshes:!0})}catch{}}function Vy(l){const _=Qu(l.trim())||"auto";pa.value=_,window.localStorage.setItem(Dp,_)}function Gy(){var _;if(typeof window>"u")return"auto";const l=((_=window.localStorage.getItem(Dp))==null?void 0:_.trim())||"auto";return Qu(l)||"auto"}function Ky(){const l=[{value:"auto",label:s("Auto-detect")}],d=new Set(["auto"]);function _(ne){const ue=F[ne]||ne;return`${ue.charAt(0).toUpperCase()+ue.slice(1)} (${ne})`}for(const ne of typeof navigator<"u"?navigator.languages??[]:[]){const ue=Qu(ne);!ue||d.has(ue)||(d.add(ue),l.push({value:ue,label:`Preferred: ${_(ue)}`}))}for(const ne of Object.keys(F))d.has(ne)||(d.add(ne),l.push({value:ne,label:_(ne)}));const N=pa.value.trim();return N&&!d.has(N)&&l.push({value:N,label:_(N)}),l}function Qu(l){const d=l.trim().toLowerCase();if(!d||d==="auto")return"";if(d in F)return d;const _=d.split("-")[0]??d;return _ in F?_:""}function Ol(){const l=document.documentElement;if(jo.value==="dark")l.classList.add("dark");else if(jo.value==="light")l.classList.remove("dark");else{const d=window.matchMedia("(prefers-color-scheme: dark)").matches;l.classList.toggle("dark",d)}}function Yy(){return typeof window>"u"?!1:window.localStorage.getItem(Pp)==="1"}function Jy(l){typeof window>"u"||window.localStorage.setItem(Pp,l?"1":"0")}function Qy(){if(typeof window>"u")return!0;const l=window.localStorage.getItem(Ip);return l===null?!0:l==="1"}function Xy(){Et.value=!Et.value,!(typeof window>"u")&&window.localStorage.setItem(Ip,Et.value?"1":"0")}function Zy(l,d){const _=(l??"").trim();return _.length>0?_:d.trim()||"message"}function wf(l){ze(l)}async function ew(){await Jt.isReady(),Oe.name==="thread"&&Wo.value?Be(Wo.value):(Oe.name==="home"||Oe.name==="skills"||Oe.name==="automations")&&Be("",{persist:!1}),await te({includeSelectedThreadMessages:Oe.name==="thread"}),Di({silent:!0}),await xy(),sn.value=!0,await Xu(),Ae()}async function Xu(){if(ca.value){Ea=!0;return}ca.value=!0;try{do{if(Ea=!1,Oe.name==="home"||Oe.name==="skills"||Oe.name==="automations"){ae.value!==""&&await ve("");continue}if(Oe.name==="thread"){const l=Wo.value;if(!l)continue;if(ae.value!==l){if(await ve(l)==="not-found")continue}else ke(l,{silent:!0}).catch(()=>{})}}while(Ea)}finally{ca.value=!1}}ft(()=>[Oe.name,Wo.value,Ie.value,ae.value],async()=>{sn.value&&await Xu()}),ft(()=>vt.value,()=>{Yd()}),ft(()=>[ae.value,vt.value],()=>{dy()}),ft(()=>[Oe.name,vt.value],([l,d])=>{l==="thread"&&Ml(d)},{immediate:!0}),ft(()=>ae.value,async l=>{if(sn.value&&!ca.value&&!(jt.value||Yn.value||ir.value)){if(!l){Oe.name!=="home"&&await Jt.replace({name:"home"});return}Oe.name==="thread"&&Wo.value===l||await Jt.replace({name:"thread",params:{threadId:l}})}}),ft(()=>$i.value,l=>{if(l.length===0){lt.value="",Ko();return}const d=lt.value.trim();d&&(l.some(N=>N.value===d)||(lt.value="")),Ko()},{immediate:!0}),ft(()=>lt.value,()=>{cn.value={phase:"idle",title:"",message:""},Ko()}),ft(()=>[Oe.name,lt.value],([l,d])=>{l==="home"&&Ml(d)},{immediate:!0}),ft(i,l=>{!l&&Fn.value==="worktree"&&(Fn.value="local")},{immediate:!0}),ft(()=>[Fn.value,lt.value],([l,d])=>{l!=="worktree"||!i.value||bf(d)},{immediate:!0}),ft(()=>Fn.value,l=>{var d;if(l==="local"){cn.value={phase:"idle",title:"",message:""};const _=lt.value.trim();if(_&&Bd(_)){const N=((d=V.value)==null?void 0:d.projectName)??eo(_),ne=Ys(N,"");ne&&(lt.value=ne)}return}i.value&&bf(lt.value)}),ft(()=>Oe.name,l=>{l!=="home"&&(cn.value={phase:"idle",title:"",message:""}),l!=="thread"&&(Sn.value=!1)}),ft(()=>ae.value,()=>{cn.value={phase:"idle",title:"",message:""}}),ft(()=>[Oe.name,vt.value,i.value],([l,d,_])=>{if(!(l==="thread"||l==="home"&&_)){af();return}Ir+=1,$t.value={},It.value="",Hn.value="",Ui(d)},{immediate:!0}),ft(w,l=>{typeof document>"u"||(document.title=l)},{immediate:!0}),ft(Mt,l=>{l&&!Lt.value&&lr(!0)},{immediate:!0});async function tw(l,d=[],_=[],N=[]){try{cn.value={phase:"idle",title:"",message:""};let ne=lt.value;if(Fn.value==="worktree"){cn.value={phase:"running",title:s("Creating worktree"),message:s("Creating a worktree and running setup.")};try{const $e=await MT(lt.value,un.value);ne=$e.cwd,lt.value=$e.cwd,cn.value={phase:"idle",title:"",message:""}}catch{cn.value={phase:"error",title:s("Worktree setup failed"),message:s("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!ne.trim()){const $e=await YT(l);ne=$e.cwd,lt.value=$e.cwd}const ue=await we(l,ne,d,_,N);if(!ue)return;await Jt.replace({name:"thread",params:{threadId:ue}}),jl()}catch{}}function nw(l){var N;if((N=l.prompt)!=null&&N.trim())return l.prompt.trim();const d=l.displayName.trim()||l.name.trim(),_=l.kind==="skill"?"skill":l.kind==="plugin"?"plugin":l.kind==="composio"?"Composio connector":"app";return`Test ${d} ${_}. Give me a list of what it can do and one useful example.`}function rw(l){return`${l.kind}:${l.name}:${l.skillPath??""}`}async function ow(l){var N;if(Po.value)return;Po.value=rw(l);const d=nw(l),_=(N=l.attachedSkills)!=null&&N.length?l.attachedSkills:l.kind==="skill"&&l.skillPath?[{name:l.name,path:l.skillPath}]:[];try{const ne=ws.value.trim()||vt.value.trim(),ue=await we(d,ne,[],_,[]);if(!ue)return;await Jt.replace({name:"thread",params:{threadId:ue}}),jl()}catch{}finally{Po.value=""}}async function bf(l){var _;const d=l.trim();if(!d){qr.value=[],un.value="";return}An.value=!0;try{const N=await jT(d);qr.value=N;const ne=un.value.trim();if(!(ne.length>0&&N.some($e=>$e.value===ne))){const $e=N.find(Kt=>Kt.value.trim()==="main");un.value=($e==null?void 0:$e.value)??((_=N[0])==null?void 0:_.value)??""}}catch{qr.value=[],un.value=""}finally{An.value=!1}}return(l,d)=>(S(),A(tt,null,[je(Z_,{"is-sidebar-collapsed":Lt.value,onCloseSidebar:d[39]||(d[39]=_=>lr(!0))},{sidebar:yt(()=>[p("section",HM,[p("div",{ref_key:"sidebarScrollableRef",ref:Un,class:"sidebar-scrollable",onScroll:Jv},[Lt.value?Z("",!0):(S(),rt(hp,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Lt.value,"show-new-thread-button":!0,onToggleSidebar:d[0]||(d[0]=_=>lr(!Lt.value)),onStartNewThread:Vd},{default:yt(()=>[p("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Hr.value,"aria-label":T(s)("Search threads"),title:T(s)("Search threads"),onClick:Kv},[je(pp,{class:"sidebar-search-toggle-icon"})],8,zM)]),_:1},8,["is-sidebar-collapsed"])),!Lt.value&&Hr.value?(S(),A("div",WM,[je(pp,{class:"sidebar-search-bar-icon"}),Yt(p("input",{ref_key:"sidebarSearchInputRef",ref:Ln,"onUpdate:modelValue":d[1]||(d[1]=_=>jn.value=_),class:"sidebar-search-input",type:"text",placeholder:T(s)("Filter threads..."),onKeydown:Xv},null,40,VM),[[on,jn.value]]),jn.value.length>0?(S(),A("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":T(s)("Clear search"),onClick:Yv},[je(HR,{class:"sidebar-search-clear-icon"})],8,GM)):Z("",!0)])):Z("",!0),Lt.value?Z("",!0):(S(),A("button",{key:2,class:Ze(["sidebar-skills-link sidebar-skills-hub-link",{"is-active":Yn.value}]),type:"button",onClick:d[2]||(d[2]=_=>{T(Jt).push({name:"skills"}),T(Mt)&&lr(!0)})},[p("span",KM,[je(Xo)]),p("span",YM,[p("span",JM,E(T(s)("Skills")),1),p("span",QM,E(T(s)("Plugins, apps, MCPs")),1)])],2)),Lt.value?Z("",!0):(S(),A("button",{key:3,class:Ze(["sidebar-skills-link sidebar-automations-link",{"is-active":ir.value}]),type:"button",onClick:d[3]||(d[3]=_=>{T(Jt).push({name:"automations"}),T(Mt)&&lr(!0)})},[p("span",XM,[je(Xo)]),p("span",ZM,[p("span",e$,E(T(s)("Automations")),1),p("span",t$,E(T(s)("Scheduled work")),1)])],2)),Lt.value?Z("",!0):(S(),rt(Qx,{key:4,ref_key:"sidebarThreadTreeRef",ref:la,groups:T(B),"project-display-name-by-id":T(oe),"project-git-repo-by-name":c.value,"project-cwd-by-name":qd.value,"selected-thread-id":T(ae),"is-loading":T(Ie),"is-thread-list-fully-loaded":T(Qe),"search-query":jn.value,"search-matched-thread-ids":Io.value,onSelect:Zv,onArchive:bg,onStartNewThread:kg,onRenameProject:Og,onBrowseThreadFiles:Tg,onSaveThreadProject:Eg,onBrowseProjectFiles:xg,onSaveProject:Ag,onRequestProjectGitStatus:Bg,onCreateProjectWorktree:jg,onRenameThread:Dg,onForkThread:_g,onRemoveProject:Fg,onReorderProject:Ug,onCopyThreadChat:og,onAutomationsChanged:rg,onStartNewChat:Ng},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),Lt.value?Z("",!0):(S(),A("div",{key:0,ref_key:"settingsAreaRef",ref:kn,class:"sidebar-settings-area",onClick:ey},[je(Zm,{name:"settings-panel"},{default:yt(()=>[gr.value?(S(),A("div",{key:0,ref_key:"settingsPanelRef",ref:pr,class:"sidebar-settings-panel",onClick:d[19]||(d[19]=Ye(()=>{},["stop"]))},[p("div",n$,[p("div",r$,[p("div",o$,[p("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!Et.value,title:Et.value?T(s)("Expand accounts"):T(s)("Collapse accounts"),onClick:Xy},[p("span",s$,E(Et.value?"▸":"▾"),1)],8,a$),p("span",i$,E(T(s)("Accounts")),1),p("span",l$,E(re.value.length),1)]),p("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:Le.value||bt.value||Zt.value||Rt.value,onClick:pg},E(Le.value?T(s)("Reloading…"):T(s)("Reload")),9,u$)]),Et.value?Z("",!0):(S(),A(tt,{key:0},[dn.value?(S(),A("div",c$,[p("span",null,E(dn.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[4]||(d[4]=_=>Qt(_,dn.value))},E(T(s)("Send feedback")),9,d$)])):Z("",!0),p("div",f$,[p("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:Le.value||bt.value||Zt.value||Rt.value,onClick:vg},E(Zt.value?T(s)("Starting login…"):T(s)("Login")),9,h$),en.value?(S(),A("a",{key:0,class:"sidebar-settings-account-login-link",href:en.value,target:"_blank",rel:"noreferrer"},E(T(s)("Open login URL")),9,p$)):Z("",!0)]),re.value.length===0?(S(),A("p",m$,E(T(s)("Click Login, or run `codex login`, then click reload.")),1)):(S(),A("div",v$,[(S(!0),A(tt,null,an(re.value,_=>(S(),A("article",{key:_.storageId,class:Ze(["sidebar-settings-account-item",{"is-active":_.isActive,"is-unavailable":Oi(_),"is-confirming-remove":Il(_),"is-remove-visible":Fd(_)}]),title:hg(_),onMouseenter:N=>ug(_.storageId),onMouseleave:N=>cg(_.storageId)},[p("div",y$,[p("p",w$,E(_.email||T(s)("Account")),1),p("p",b$,E(Od(_)),1),p("p",_$,E(Ud(_)),1),p("p",k$," Workspace "+E(ag(_.accountId)),1)]),p("div",T$,[p("button",{class:"sidebar-settings-account-switch",type:"button",disabled:Dd(_)||_.isActive||Oi(_),onClick:N=>mg(_.storageId)},E(ig(_)),9,C$),p("button",{class:Ze(["sidebar-settings-account-remove",{"is-visible":Fd(_),"is-confirming":Il(_)}]),type:"button",disabled:Dd(_),onClick:N=>wg(_.storageId)},E(lg(_)),11,S$)])],42,g$))),128))]))],64))]),p("button",{class:"sidebar-settings-row",type:"button",title:C.sendWithEnter,onClick:Dy},[p("span",A$,E(T(s)("Require ⌘ + enter to send")),1),p("span",{class:Ze(["sidebar-settings-toggle",{"is-on":!$r.value}])},null,2)],8,x$),p("button",{class:"sidebar-settings-row",type:"button",title:C.inProgressSendMode,onClick:Fy},[p("span",P$,E(T(s)("When busy, send as")),1),p("span",I$,E(ha.value==="steer"?T(s)("Steer"):T(s)("Queue")),1)],8,E$),p("button",{class:"sidebar-settings-row",type:"button",title:C.appearance,onClick:Uy},[p("span",M$,E(T(s)("Appearance")),1),p("span",$$,E(jo.value==="system"?T(s)("System"):jo.value==="dark"?T(s)("Dark"):T(s)("Light")),1)],8,R$),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:T(s)("Choose the interface language for the app.")},[p("span",L$,E(T(s)("UI language")),1),je(Ur,{class:"sidebar-settings-provider-dropdown","model-value":T(u),options:T(f),placeholder:T(s)("UI language"),"menu-align":"end","onUpdate:modelValue":d[5]||(d[5]=_=>T(m)(_))},null,8,["model-value","options","placeholder"])],8,j$),p("button",{class:"sidebar-settings-row",type:"button",title:C.chatWidth,onClick:By},[p("span",O$,E(T(s)("Chat width")),1),p("span",D$,E(Ya.value),1)],8,N$),p("button",{class:"sidebar-settings-row",type:"button",title:C.dictationClickToToggle,onClick:qy},[p("span",U$,E(T(s)("Click to toggle dictation")),1),p("span",{class:Ze(["sidebar-settings-toggle",{"is-on":Ce.value}])},null,2)],8,F$),p("button",{class:"sidebar-settings-row",type:"button",title:C.dictationAutoSend,onClick:Hy},[p("span",q$,E(T(s)("Auto send dictation")),1),p("span",{class:Ze(["sidebar-settings-toggle",{"is-on":xn.value}])},null,2)],8,B$),qs.value?(S(),A("a",{key:0,class:"sidebar-settings-row sidebar-settings-feedback-row",href:T(Dt),onClick:Qt},[p("span",z$,E(T(s)("Send feedback")),1),p("span",W$,E(T(s)("Issue detected")),1)],8,H$)):Z("",!0),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:T(s)("Choose the API provider for the Codex backend")},[p("span",G$,E(T(s)("Provider")),1),je(Ur,{class:"sidebar-settings-provider-dropdown","model-value":Pn.value,options:Ei.value,placeholder:T(s)("Provider"),disabled:Jr.value,"menu-align":"end","onUpdate:modelValue":zy},null,8,["model-value","options","placeholder","disabled"])],8,V$),ar.value?(S(),A("div",K$,[p("span",null,E(ar.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[6]||(d[6]=_=>Qt(_,ar.value))},E(T(s)("Send feedback")),9,Y$)])):Z("",!0),Pn.value==="openrouter"?(S(),A("div",J$,[p("div",Q$,[p("span",X$,E(T(s)("OpenRouter API key")),1),p("a",Z$,E(T(s)("Get API key")),1)]),p("div",ej,[hs.value&&!Lo.value?(S(),A(tt,{key:0},[p("span",tj,E(ps.value),1),p("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Vt.value,title:T(s)("Remove custom key, use community keys"),onClick:Wy},"✕",8,nj)],64)):(S(),A(tt,{key:1},[Yt(p("input",{"onUpdate:modelValue":d[7]||(d[7]=_=>Lo.value=_),class:"sidebar-settings-key-input",type:"password",placeholder:T(s)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:tn(yf,["enter"])},null,40,rj),[[on,Lo.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Vt.value||!Lo.value.trim(),onClick:yf},E(Vt.value?"...":T(s)("Set")),9,oj)],64))]),p("div",aj,[p("span",sj,E(T(s)("API format")),1),p("div",{class:"sidebar-settings-segmented",role:"group","aria-label":T(s)("OpenRouter API format")},[p("button",{type:"button",class:Ze(["sidebar-settings-segmented-option",{"is-active":co.value==="responses"}]),disabled:Vt.value||Jr.value,onClick:d[8]||(d[8]=_=>vf("responses"))}," Responses ",10,lj),p("button",{type:"button",class:Ze(["sidebar-settings-segmented-option",{"is-active":co.value==="chat"}]),disabled:Vt.value||Jr.value,onClick:d[9]||(d[9]=_=>vf("chat"))}," Completions ",10,uj)],8,ij)])])):Z("",!0),Pn.value==="opencode-zen"?(S(),A("div",cj,[p("div",dj,[p("span",fj,E(T(s)("OpenCode Zen API key")),1),p("a",hj,E(T(s)("Get API key")),1)]),p("div",pj,[Yt(p("input",{"onUpdate:modelValue":d[10]||(d[10]=_=>Ia.value=_),class:"sidebar-settings-key-input",type:"password",placeholder:T(s)("sk-..."),onKeydown:tn(gf,["enter"])},null,40,mj),[[on,Ia.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Vt.value||!Ia.value.trim(),onClick:gf},E(Vt.value?"...":T(s)("Save")),9,vj)])])):Z("",!0),Pn.value==="custom"?(S(),A("div",gj,[p("span",yj,E(T(s)("Custom endpoint URL")),1),p("div",wj,[Yt(p("input",{"onUpdate:modelValue":d[11]||(d[11]=_=>No.value=_),class:"sidebar-settings-key-input",type:"url",placeholder:T(s)("https://api.example.com/v1"),onKeydown:tn(Yu,["enter"])},null,40,bj),[[on,No.value]])]),p("span",_j,E(T(s)("API key")),1),p("div",kj,[Yt(p("input",{"onUpdate:modelValue":d[12]||(d[12]=_=>Pa.value=_),class:"sidebar-settings-key-input",type:"password",placeholder:T(s)("Bearer token (optional)"),onKeydown:tn(Yu,["enter"])},null,40,Tj),[[on,Pa.value]]),p("button",{class:"sidebar-settings-key-save",type:"button",disabled:Vt.value||!No.value.trim(),onClick:Yu},E(Vt.value?"...":T(s)("Save")),9,Cj)]),p("div",Sj,[p("span",xj,E(T(s)("API format")),1),p("div",{class:"sidebar-settings-segmented",role:"group","aria-label":T(s)("Custom endpoint API format")},[p("button",{type:"button",class:Ze(["sidebar-settings-segmented-option",{"is-active":uo.value==="responses"}]),onClick:d[13]||(d[13]=_=>uo.value="responses")}," Responses ",2),p("button",{type:"button",class:Ze(["sidebar-settings-segmented-option",{"is-active":uo.value==="chat"}]),onClick:d[14]||(d[14]=_=>uo.value="chat")}," Completions ",2)],8,Aj)])])):Z("",!0),p("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:C.dictationLanguage},[p("span",Pj,E(T(s)("Dictation language")),1),je(Ur,{class:"sidebar-settings-language-dropdown","model-value":pa.value,options:Os.value,placeholder:T(s)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":T(s)("Search language..."),"onUpdate:modelValue":Vy},null,8,["model-value","options","placeholder","search-placeholder"])],8,Ej),p("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:d[15]||(d[15]=_=>fo.value=!fo.value)},[p("span",Ij,E(T(s)("Telegram")),1),p("span",Rj,E(Gs.value),1)]),fo.value?(S(),A("div",Mj,[p("label",$j,[p("span",jj,E(T(s)("Bot token")),1),Yt(p("input",{"onUpdate:modelValue":d[16]||(d[16]=_=>Ka.value=_),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[on,Ka.value]])]),p("label",Lj,[p("span",Nj,E(T(s)("Allowed Telegram user IDs")),1),Yt(p("textarea",{"onUpdate:modelValue":d[17]||(d[17]=_=>Oo.value=_),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
|
|
73
|
+
987654321`,spellcheck:"false"},null,512),[[on,Oo.value]])]),p("div",Oj,E(T(s)("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),Tn.value?(S(),A("div",Dj,[p("span",null,E(Tn.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[18]||(d[18]=_=>Qt(_,Tn.value))},E(T(s)("Send feedback")),9,Fj)])):Z("",!0),p("div",Uj,[p("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:Do.value,onClick:ja},E(Do.value?T(s)("Saving…"):T(s)("Save Telegram config")),9,Bj)])])):Z("",!0),Du.value?(S(),A("div",{key:6,class:"sidebar-settings-row sidebar-settings-context-row","data-state":Cl.value,title:xl.value},[p("span",Hj,E(T(s)("Context")),1),p("span",{class:"sidebar-settings-context-value","data-state":Cl.value},[Ns(E(Uu.value)+" ",1),p("span",Wj,E(Sl.value),1)],8,zj)],8,qj)):Z("",!0),p("div",Vj,[je(aI,{snapshots:T(De)},null,8,["snapshots"])]),p("div",{class:"sidebar-settings-build-label","aria-label":T(s)("Worktree name and version")}," WT "+E(T(h))+" · v"+E(T(y)),9,Gj)],512)):Z("",!0)]),_:1}),p("button",{ref_key:"settingsButtonRef",ref:Pr,class:"sidebar-settings-button",type:"button",onClick:d[20]||(d[20]=Ye(_=>gr.value=!gr.value,["stop"]))},[je(LR,{class:"sidebar-settings-icon"}),p("span",null,E(T(s)("Settings")),1),p("span",Kj,E(T(h))+" · v"+E(T(y)),1)],512)],512))])]),content:yt(()=>[p("section",{class:Ze(["content-root",{"is-virtual-keyboard-open":Ou.value,"is-terminal-open":Or.value}]),style:ea(Vs.value)},[ba.value?(S(),A("span",Yj)):Z("",!0),je(nA,{title:v.value,accent:Yn.value||ir.value},{leading:yt(()=>[Lt.value||T(Mt)?(S(),rt(hp,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Lt.value,"show-new-thread-button":!0,onToggleSidebar:d[21]||(d[21]=_=>lr(!Lt.value)),onStartNewThread:Vd},null,8,["is-sidebar-collapsed"])):Z("",!0),Yn.value?(S(),A("span",Jj,[je(Xo)])):ir.value?(S(),A("span",Qj,[je(Xo)])):Z("",!0)]),actions:yt(()=>[Jn.value?(S(),rt(Ur,{key:0,class:Ze(["content-header-terminal-command",{"is-open":Or.value}]),"model-value":Aa.value,options:Ja.value,placeholder:ji.value,"selected-prefix-icon":FR,"icon-only":!0,"menu-align":"end","empty-label":T(s)("No commands"),"onUpdate:modelValue":zg},null,8,["class","model-value","options","placeholder","empty-label"])):Z("",!0),Vo.value?(S(),rt(dR,{key:1,class:"content-header-branch-dropdown","current-branch":Xt.value,"head-sha":nr.value,"head-subject":so.value,"head-date":Rr.value,detached:rr.value,dirty:mn.value,"worktree-change-summary":Pt.value,branches:qn.value,"commits-by-branch":$t.value,"commits-loading-for":It.value,"commits-error":Hn.value,"commit-files-by-sha":io.value,"commit-files-loading-for":Gr.value,"commit-files-error":Kr.value,loading:fa.value,busy:Nt.value,error:En.value,"review-open":Sn.value,"show-review":T(Oe).name==="thread"&&T(ae).length>0,onToggleReview:cy,onCheckoutBranch:sy,onResetBranchToCommit:iy,onLoadCommits:lf,onLoadCommitFiles:ly,onOpenCommitFile:uy},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","worktree-change-summary","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"])):Z("",!0)]),_:1},8,["title","accent"]),p("section",Xj,[Yn.value?(S(),rt(T(o),{key:0,cwd:ws.value,"thread-id":Wo.value,"try-in-flight-key":Po.value,onSkillsChanged:Pl,onTryItem:ow},null,8,["cwd","thread-id","try-in-flight-key"])):ir.value?(S(),rt(T(a),{key:1,ref_key:"automationsPanelRef",ref:to,groups:T(B),"project-cwd-by-name":qd.value,"project-display-name-by-id":T(oe),"selected-automation-id":Hs.value,onSelectAutomation:eg,onEditAutomation:tg,onCreateAutomation:ng},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):jt.value?(S(),A("div",Zj,[p("div",eL,[p("p",tL,E(T(s)("Let's build")),1),je(Ur,{class:"new-thread-folder-dropdown","model-value":lt.value,options:$i.value,placeholder:T(s)("Choose folder"),"enable-search":!0,"search-placeholder":T(s)("Quick search project"),disabled:!1,"onUpdate:modelValue":ry},null,8,["model-value","options","placeholder","search-placeholder"]),lt.value?(S(),A("p",{key:0,class:"new-thread-folder-selected",title:lt.value},E(T(s)("Selected folder"))+": "+E(lt.value),9,nL)):Z("",!0),p("div",rL,[p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:wy},E(T(s)("Select folder")),1),p("button",{class:"new-thread-folder-action",type:"button",onClick:fy},E(T(s)("Create Project")),1),p("button",{class:"new-thread-folder-action",type:"button",disabled:vo.value,onClick:my},E(vo.value?T(s)("Importing…"):T(s)("Import Project")),9,oL),p("input",{ref_key:"projectImportInputRef",ref:Fs,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:yy},null,544)]),vn.value?(S(),A("section",aL,[p("div",sL,[p("div",iL,[p("span",lL,[je(Xo)]),p("p",uL,E(T(s)("New in Codex")),1)]),p("h2",cL,E(T(s)("Plugins are here")),1),p("p",dL,E(T(s)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),d[44]||(d[44]=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",fL,[p("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Go},E(T(s)("Explore Plugins & Apps")),1),p("button",{class:"new-thread-launch-card-button",type:"button",onClick:Ws},E(T(s)("Dismiss")),1)])])):Z("",!0),(S(),rt(is,{to:"body"},[Qr.value?(S(),A("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Ye(Js,["self"])},[p("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":T(s)("Select folder"),onKeydown:tn(Ye(Js,["prevent"]),["esc"])},[p("div",pL,[p("p",mL,E(T(s)("Select folder")),1),p("button",{class:"new-thread-open-folder-close",type:"button",onClick:Js},E(T(s)("Cancel")),1)]),p("p",vL,E(T(s)("Current folder")),1),p("div",gL,[Yt(p("input",{ref_key:"existingFolderPathInputRef",ref:ms,"onUpdate:modelValue":d[22]||(d[22]=_=>go.value=_),class:"new-thread-open-folder-path",type:"text",placeholder:T(s)("Current folder"),title:go.value||T(s)("Unavailable"),disabled:On.value||Lr.value,onBlur:Ty,onKeydown:[tn(Ye(Cy,["prevent"]),["enter"]),tn(Ye(Js,["prevent"]),["esc"])]},null,40,yL),[[on,go.value]]),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!me.value||On.value||Lr.value,onClick:d[23]||(d[23]=_=>Vu())},E(Lr.value?T(s)("Opening…"):T(s)("Open")),9,wL)]),p("div",bL,[p("label",_L,[Yt(p("input",{"onUpdate:modelValue":d[24]||(d[24]=_=>gs.value=_),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:_y},null,544),[[ev,gs.value]]),p("span",null,E(T(s)("Show hidden folders")),1)]),p("button",{class:Ze(["new-thread-folder-action",{"new-thread-folder-action-primary":ho.value}]),type:"button","aria-pressed":ho.value,disabled:!Gn.value||On.value||Lr.value||mo.value||!!gn.value&&!ho.value,onClick:Sy},E(T(s)("New folder")),11,kL)]),ho.value?(S(),A("div",TL,[p("div",CL,[Yt(p("input",{ref_key:"createFolderInputRef",ref:q,"onUpdate:modelValue":d[25]||(d[25]=_=>po.value=_),class:"new-thread-open-folder-create-input",type:"text",placeholder:T(s)("Folder name"),onKeydown:[tn(Ye(uf,["prevent"]),["enter"]),tn(Ye(Bi,["prevent"]),["esc"])]},null,40,SL),[[on,po.value]]),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!z.value||mo.value,onClick:uf},E(Ge.value),9,xL)]),Cn.value?(S(),A("div",AL,[p("span",null,E(Cn.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[26]||(d[26]=_=>Qt(_,Cn.value))},E(T(s)("Send feedback")),9,EL)])):Z("",!0)])):Z("",!0),Yt(p("input",{ref_key:"existingFolderFilterInputRef",ref:Us,"onUpdate:modelValue":d[27]||(d[27]=_=>Xr.value=_),class:"new-thread-open-folder-filter",type:"text",placeholder:T(s)("Filter folders..."),onKeydown:tn(Ye(Js,["prevent"]),["esc"])},null,40,PL),[[on,Xr.value]]),gn.value?(S(),A("div",IL,[p("div",RL,[p("span",null,E(gn.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[28]||(d[28]=_=>Qt(_,gn.value))},E(T(s)("Send feedback")),9,ML)]),p("button",{class:"new-thread-folder-action",type:"button",disabled:On.value||Lr.value,onClick:ky},E(T(s)("Retry")),9,$L)])):Z("",!0),On.value?(S(),A("p",jL,E(T(s)("Loading folders…")),1)):!gn.value&&Ft.value.length===0?(S(),A("p",LL,E(Xr.value.trim()?T(s)("No folders match this filter."):T(s)("No subfolders found here.")),1)):Ft.value.length>0?(S(),A("ul",NL,[(S(!0),A(tt,null,an(Ft.value,_=>(S(),A("li",{key:_.key,class:"new-thread-open-folder-item"},[p("button",{class:"new-thread-open-folder-item-main",type:"button",title:_.path,disabled:On.value||Lr.value,onClick:N=>by(_.path)},[p("span",DL,E(_.name),1)],8,OL),_.kind==="directory"?(S(),A("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:On.value||Lr.value,onClick:N=>Vu(_.path)},E(T(s)("Open")),9,FL)):Z("",!0)]))),128))])):Z("",!0)],40,hL)])):Z("",!0)])),(S(),rt(is,{to:"body"},[Fo.value?(S(),A("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Ye(Ll,["self"])},[p("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":T(s)("Create or clone project"),onKeydown:tn(Ye(Ll,["prevent"]),["esc"])},[p("div",BL,[p("p",qL,E(T(s)("Create or clone project")),1),p("button",{class:"new-thread-open-folder-close",type:"button",disabled:In.value,onClick:Ll},E(T(s)("Cancel")),9,HL)]),p("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":T(s)("Project source")},[p("button",{class:Ze(["new-thread-project-mode-tab",{"is-active":Vn.value==="create"}]),type:"button",role:"tab","aria-selected":Vn.value==="create",disabled:In.value,onClick:d[29]||(d[29]=_=>Vn.value="create")},E(T(s)("New project")),11,WL),p("button",{class:Ze(["new-thread-project-mode-tab",{"is-active":Vn.value==="clone"}]),type:"button",role:"tab","aria-selected":Vn.value==="clone",disabled:In.value,onClick:d[30]||(d[30]=_=>Vn.value="clone")},E(T(s)("Clone from GitHub")),11,VL)],8,zL),p("label",GL,[p("span",KL,E(T(s)("Destination folder")),1),Yt(p("input",{"onUpdate:modelValue":d[31]||(d[31]=_=>Uo.value=_),class:"new-thread-open-folder-path",type:"text",disabled:In.value,placeholder:T(s)("Destination folder")},null,8,YL),[[on,Uo.value]])]),Vn.value==="create"?(S(),A("label",JL,[p("span",QL,E(T(s)("Project name")),1),Yt(p("input",{ref_key:"projectSetupPrimaryInputRef",ref:ma,"onUpdate:modelValue":d[32]||(d[32]=_=>Ra.value=_),class:"new-thread-open-folder-create-input",type:"text",disabled:In.value,placeholder:T(s)("Project name"),onKeydown:tn(Ye(Wu,["prevent"]),["enter"])},null,40,XL),[[on,Ra.value]])])):Vn.value==="clone"?(S(),A("label",ZL,[p("span",eN,E(T(s)("GitHub repository URL")),1),Yt(p("input",{ref_key:"projectSetupPrimaryInputRef",ref:ma,"onUpdate:modelValue":d[33]||(d[33]=_=>Ma.value=_),class:"new-thread-open-folder-create-input",type:"url",disabled:In.value,placeholder:"https://github.com/owner/repo",onKeydown:tn(Ye(Wu,["prevent"]),["enter"])},null,40,tN),[[on,Ma.value]])])):Z("",!0),jr.value?(S(),A("div",nN,[p("span",null,E(jr.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[34]||(d[34]=_=>Qt(_,jr.value))},E(T(s)("Send feedback")),9,rN)])):Z("",!0),p("div",oN,[p("button",{class:"new-thread-folder-action",type:"button",disabled:In.value,onClick:Ll},E(T(s)("Cancel")),9,aN),p("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ie.value||In.value,onClick:Wu},E(St.value),9,sN)])],40,UL)])):Z("",!0)])),i.value?(S(),rt(vR,{key:2,class:"new-thread-runtime-dropdown",modelValue:Fn.value,"onUpdate:modelValue":d[35]||(d[35]=_=>Fn.value=_)},null,8,["modelValue"])):Z("",!0),Fn.value==="worktree"?(S(),A("div",iN,[p("p",lN,E(T(s)("Base branch")),1),je(Ur,{class:"new-thread-branch-dropdown","model-value":un.value,options:g.value,placeholder:T(s)("Select branch"),"enable-search":!0,"search-placeholder":T(s)("Search branches..."),disabled:An.value||g.value.length===0,"onUpdate:modelValue":oy},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),p("p",uN,E(An.value?T(s)("Loading branches…"):k.value?T(s)("New worktree branch will start from {branch}.",{branch:k.value}):T(s)("No Git branches found for this folder.")),1)])):Z("",!0),i.value?(S(),A("p",cN,E(T(s)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):Z("",!0),cn.value.phase!=="idle"?(S(),A("div",{key:5,class:Ze(["worktree-init-status",{"is-running":cn.value.phase==="running","is-error":cn.value.phase==="error"}])},[p("strong",dN,E(cn.value.title),1),p("span",fN,E(cn.value.message),1)],2)):Z("",!0)]),p("div",hN,[T(fe)?(S(),A("div",pN,[p("span",null,E(T(s)(T(fe))),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[36]||(d[36]=_=>Qt(_,T(fe)))},E(T(s)("Send feedback")),9,mN)])):Z("",!0),tr.value&&vt.value?(S(),rt(T(n),{key:1,ref_key:"homeTerminalPanelRef",ref:Br,class:"content-thread-terminal-panel","thread-id":st.value,cwd:vt.value,onHide:Qg,onTerminalFocusChange:Zd},null,8,["thread-id","cwd"])):Z("",!0),je(fp,{ref_key:"homeThreadComposerRef",ref:ro,"active-thread-id":st.value,cwd:vt.value,"collaboration-modes":T(xe),"selected-collaboration-mode":T(be),models:T(le),"selected-model":Gt.value,"selected-reasoning-effort":T(Ue),"selected-speed-mode":T(ce),"is-updating-speed-mode":T(at),skills:T(Se),"thread-token-usage":T(O),"codex-quota":T(Fe),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":$r.value,"in-progress-submit-mode":ha.value,"dictation-click-to-toggle":Ce.value,"dictation-auto-send":xn.value,"dictation-language":pa.value,onSubmit:of,"onUpdate:selectedCollaborationMode":wf,"onUpdate:selectedModel":hf,"onUpdate:selectedReasoningEffort":pf,"onUpdate:selectedSpeedMode":mf},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","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"])])])):(S(),A("div",vN,[Sn.value&&T(ae)&&vt.value?(S(),rt(T(r),{key:0,"thread-id":T(ae),cwd:vt.value,"is-thread-in-progress":Pi.value,"initial-file-path":Wr.value,"commit-sha":Vr.value,onClose:d[37]||(d[37]=_=>Sn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(S(),A(tt,{key:1},[p("div",gN,[je(T(t),{ref_key:"threadConversationRef",ref:$n,messages:M.value,"is-loading":T(et),"active-thread-id":st.value,cwd:vt.value,"live-overlay":ye.value,"pending-requests":T(se),"has-more-persisted-above":T(Re),"is-loading-persisted-above":T(Me),"load-earlier-messages":T(Xe),onForkThread:Hg,onRollback:Iy,onImplementPlan:Ry,onRespondServerRequest:Gd},null,8,["messages","is-loading","active-thread-id","cwd","live-overlay","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),p("div",yN,[T(fe)?(S(),A("div",wN,[p("span",null,E(T(s)(T(fe))),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[38]||(d[38]=_=>Qt(_,T(fe)))},E(T(s)("Send feedback")),9,bN)])):Z("",!0),je(JP,{messages:T(X),onEdit:ny,onSteer:T(He),onDelete:T(qe),onReorder:Ey},null,8,["messages","onSteer","onDelete"]),T(ee)&&T(ae)&&vt.value?(S(),rt(T(n),{key:1,ref_key:"threadTerminalPanelRef",ref:ua,class:"content-thread-terminal-panel","thread-id":T(ae),cwd:vt.value,onHide:Xg,onTerminalFocusChange:Zd},null,8,["thread-id","cwd"])):Z("",!0),Nr.value?(S(),rt(FP,{key:2,request:Nr.value,"request-count":T(se).length,"has-queue-above":T(X).length>0,onRespondServerRequest:Gd},null,8,["request","request-count","has-queue-above"])):(S(),rt(fp,{key:3,ref_key:"threadComposerRef",ref:Er,"active-thread-id":st.value,cwd:vt.value,"collaboration-modes":T(xe),"selected-collaboration-mode":T(be),models:T(le),"selected-model":Gt.value,"selected-reasoning-effort":T(Ue),"selected-speed-mode":T(ce),"is-updating-speed-mode":T(at),skills:T(Se),"thread-token-usage":T(O),"codex-quota":T(Fe),"is-turn-in-progress":Pi.value,"is-stop-pending":T(ct),"is-interrupting-turn":T(it),"has-queue-above":T(X).length>0,"send-with-enter":$r.value,"in-progress-submit-mode":ha.value,"dictation-click-to-toggle":Ce.value,"dictation-auto-send":xn.value,"dictation-language":pa.value,"onUpdate:selectedCollaborationMode":wf,onSubmit:of,"onUpdate:selectedModel":hf,"onUpdate:selectedReasoningEffort":pf,"onUpdate:selectedSpeedMode":mf,onInterrupt:Py},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","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","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language"]))])],64))]))])],6)]),_:1},8,["is-sidebar-collapsed"]),gt.value.phase!=="idle"?(S(),A("div",_N,[p("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":T(s)("Export Project"),onClick:d[40]||(d[40]=Ye(()=>{},["stop"]))},[p("div",TN,[p("h2",CN,E(T(s)("Export Project")),1),p("button",{class:"project-zip-modal-close",type:"button","aria-label":T(s)("Close"),disabled:gt.value.phase==="exporting",onClick:zd}," × ",8,SN)]),p("p",xN,E(gt.value.phase==="exporting"?T(s)("Preparing project ZIP..."):gt.value.fileName),1),p("div",AN,[p("span",null,E(gt.value.phase==="exporting"?T(s)("Exporting"):T(s)("Ready")),1),p("span",null,E(Ds.value),1)]),p("div",EN,[p("div",{class:"project-zip-progress-fill",style:ea({width:Wn.value})},null,4)]),gt.value.error?(S(),A("p",PN,E(gt.value.error),1)):Z("",!0),p("div",IN,[p("button",{class:"project-zip-modal-cancel",type:"button",disabled:gt.value.phase==="exporting",onClick:zd},E(T(s)("Close")),9,RN),p("button",{class:"project-zip-modal-action",type:"button",disabled:!gt.value.blob,onClick:Mg},E(T(s)("Download")),9,MN),p("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!gt.value.blob,onClick:$g},E(T(s)("Share")),9,$N)])],8,kN)])):Z("",!0),Ht.value?(S(),A("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:qu},[p("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":T(s)("Complete Codex login"),onSubmit:Ye(gg,["prevent"]),onClick:d[43]||(d[43]=Ye(()=>{},["stop"]))},[p("div",LN,[p("h2",NN,E(T(s)("Complete Codex login")),1),p("button",{class:"codex-login-modal-close",type:"button","aria-label":T(s)("Close"),disabled:Rt.value,onClick:qu}," × ",8,ON)]),p("p",DN,E(T(s)("Finish login in the browser, then paste the localhost callback URL here.")),1),en.value?(S(),A("a",{key:0,class:"codex-login-modal-link",href:en.value,target:"_blank",rel:"noreferrer"},E(T(s)("Open login URL")),9,FN)):Z("",!0),Yt(p("input",{ref_key:"codexLoginCallbackInputRef",ref:or,"onUpdate:modelValue":d[41]||(d[41]=_=>zn.value=_),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:T(s)("Paste localhost callback URL"),disabled:Rt.value},null,8,UN),[[on,zn.value]]),dn.value?(S(),A("div",BN,[p("span",null,E(dn.value),1),p("a",{class:"visible-error-feedback",href:T(Dt),onClick:d[42]||(d[42]=_=>Qt(_,dn.value))},E(T(s)("Send feedback")),9,qN)])):Z("",!0),p("div",HN,[p("button",{class:"codex-login-modal-cancel",type:"button",disabled:Rt.value,onClick:qu},E(T(s)("Cancel")),9,zN),p("button",{class:"codex-login-modal-submit",type:"submit",disabled:Rt.value||zn.value.trim().length===0},E(Rt.value?T(s)("Completing…"):T(s)("Complete")),9,WN)])],40,jN)])):Z("",!0)],64))}}),KN=At(GN,[["__scopeId","data-v-adff4e39"]]),Zl={render:()=>null},YN=W_({history:T_(),routes:[{path:"/",name:"home",component:Zl},{path:"/thread/:threadId",name:"thread",component:Zl},{path:"/skills",name:"skills",component:Zl},{path:"/automations",name:"automations",component:Zl},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-phone.");t1();j0(KN).use(YN).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Mv("Service worker registration failed."),e)})});export{G_ as $,hT as A,Nv as B,sI as C,Ld as D,rt as E,tt as F,wd as G,Xk as H,Ci as I,eO as J,ZN as K,tO as L,tT as M,fs as N,nO as O,Ur as P,wO as Q,_O as R,bO as S,Zm as T,jd as U,is as V,Yt as W,on as X,Wl as Y,Sa as Z,At as _,p as a,V_ as a0,JN as a1,XN as a2,rO as a3,lO as a4,hO as a5,pO as a6,oO as a7,fO as a8,mO as a9,gO as aa,yO as ab,aO as ac,sO as ad,iO as ae,uO as af,dO as ag,cO as ah,vO as ai,Gk as aj,Kk as ak,Xo as al,tn as am,dp as an,Ga as b,A as c,er as d,ds as e,Z as f,Ze as g,je as h,Ns as i,QN as j,T as k,li as l,lA as m,zt as n,S as o,HR as p,Ye as q,an as r,ea as s,E as t,Ed as u,yt as v,ft as w,x,Q as y,Vi as z};
|