codexui-android 0.1.107 → 0.1.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{DirectoryHub-BjsbwciN.css → DirectoryHub-BuG9gBQw.css} +1 -1
- package/dist/assets/DirectoryHub-DvExS-9c.js +2 -0
- package/dist/assets/ReviewPane-AzgWKh85.css +1 -0
- package/dist/assets/ReviewPane-Ckuqkl-S.js +1 -0
- package/dist/assets/{ThreadConversation-BwA4BCDu.css → ThreadConversation-BVrT3Y63.css} +1 -1
- package/dist/assets/{ThreadConversation-BJcbG7R6.js → ThreadConversation-DjMDsjfX.js} +18 -18
- package/dist/assets/{ThreadTerminalPanel-nYqGBGVO.css → ThreadTerminalPanel-BcVTRuCH.css} +1 -1
- package/dist/assets/{ThreadTerminalPanel-zjPFLNlu.js → ThreadTerminalPanel-DWgrDp2e.js} +1 -1
- package/dist/assets/index-AFrh-w0S.css +1 -0
- package/dist/assets/index-ZXDbBStq.js +63 -0
- package/dist/assets/{index.esm-Bh22Jgzp.js → index.esm--s_sgTDk.js} +2 -2
- package/dist/assets/{index.esm-D7eMWmxV.js → index.esm-D_uN0D-X.js} +1 -1
- package/dist/assets/{index.esm-aDL62PRZ.js → index.esm-DvadSfWE.js} +2 -2
- package/dist/index.html +2 -2
- package/dist-cli/index.js +231 -15
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/DirectoryHub-CDkPMYL8.js +0 -2
- package/dist/assets/ReviewPane-BAfo9D_N.css +0 -1
- package/dist/assets/ReviewPane-CiJXnK-p.js +0 -1
- package/dist/assets/index-7uudGTMH.js +0 -63
- package/dist/assets/index-D3-QOh5C.css +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-DjMDsjfX.js","assets/ThreadConversation-BVrT3Y63.css","assets/ThreadTerminalPanel-DWgrDp2e.js","assets/ThreadTerminalPanel-BcVTRuCH.css","assets/ReviewPane-Ckuqkl-S.js","assets/ReviewPane-AzgWKh85.css","assets/DirectoryHub-DvExS-9c.js","assets/DirectoryHub-BuG9gBQw.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();/**
|
|
3
|
+
* @vue/shared v3.5.31
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function Lc(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Wt={},Es=[],Wo=()=>{},Kh=()=>!1,Ol=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Dl=e=>e.startsWith("onUpdate:"),kn=Object.assign,jc=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Sg=Object.prototype.hasOwnProperty,Rt=(e,t)=>Sg.call(e,t),st=Array.isArray,Is=e=>Mi(e)==="[object Map]",Hs=e=>Mi(e)==="[object Set]",Dd=e=>Mi(e)==="[object Date]",ft=e=>typeof e=="function",un=e=>typeof e=="string",To=e=>typeof e=="symbol",Mt=e=>e!==null&&typeof e=="object",Yh=e=>(Mt(e)||ft(e))&&ft(e.then)&&ft(e.catch),Qh=Object.prototype.toString,Mi=e=>Qh.call(e),xg=e=>Mi(e).slice(8,-1),Jh=e=>Mi(e)==="[object Object]",Oc=e=>un(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,pi=Lc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Fl=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Ag=/-\w/g,cr=Fl(e=>e.replace(Ag,t=>t.slice(1).toUpperCase())),Eg=/\B([A-Z])/g,La=Fl(e=>e.replace(Eg,"-$1").toLowerCase()),Ul=Fl(e=>e.charAt(0).toUpperCase()+e.slice(1)),Au=Fl(e=>e?`on${Ul(e)}`:""),yo=(e,t)=>!Object.is(e,t),wl=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Xh=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Bl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Ig=e=>{const t=un(e)?Number(e):NaN;return isNaN(t)?e:t};let Fd;const ql=()=>Fd||(Fd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ca(e){if(st(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],a=un(r)?$g(r):ca(r);if(a)for(const o in a)t[o]=a[o]}return t}else if(un(e)||Mt(e))return e}const Pg=/;(?![^(]*\))/g,Rg=/:([^]+)/,Mg=/\/\*[^]*?\*\//g;function $g(e){const t={};return e.replace(Mg,"").split(Pg).forEach(n=>{if(n){const r=n.split(Rg);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function rt(e){let t="";if(un(e))t=e;else if(st(e))for(let n=0;n<e.length;n++){const r=rt(e[n]);r&&(t+=r+" ")}else if(Mt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Ng="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Lg=Lc(Ng);function Zh(e){return!!e||e===""}function jg(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ws(e[r],t[r]);return n}function Ws(e,t){if(e===t)return!0;let n=Dd(e),r=Dd(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=To(e),r=To(t),n||r)return e===t;if(n=st(e),r=st(t),n||r)return n&&r?jg(e,t):!1;if(n=Mt(e),r=Mt(t),n||r){if(!n||!r)return!1;const a=Object.keys(e).length,o=Object.keys(t).length;if(a!==o)return!1;for(const s in e){const l=e.hasOwnProperty(s),c=t.hasOwnProperty(s);if(l&&!c||!l&&c||!Ws(e[s],t[s]))return!1}}return String(e)===String(t)}function Dc(e,t){return e.findIndex(n=>Ws(n,t))}const ep=e=>!!(e&&e.__v_isRef===!0),R=e=>un(e)?e:e==null?"":st(e)||Mt(e)&&(e.toString===Qh||!ft(e.toString))?ep(e)?R(e.value):JSON.stringify(e,tp,2):String(e),tp=(e,t)=>ep(t)?tp(e,t.value):Is(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,a],o)=>(n[Eu(r,o)+" =>"]=a,n),{})}:Hs(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Eu(n))}:To(t)?Eu(t):Mt(t)&&!st(t)&&!Jh(t)?String(t):t,Eu=(e,t="")=>{var n;return To(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
7
|
+
* @vue/reactivity v3.5.31
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let _r;class Og{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=_r,!t&&_r&&(this.index=(_r.scopes||(_r.scopes=[])).push(this)-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=_r;try{return _r=this,t()}finally{_r=n}}}on(){++this._on===1&&(this.prevScope=_r,_r=this)}off(){this._on>0&&--this._on===0&&(_r=this.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 a=this.parent.scopes.pop();a&&a!==this&&(this.parent.scopes[this.index]=a,a.index=this.index)}this.parent=void 0}}}function Dg(){return _r}let Gt;const Iu=new WeakSet;class np{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,_r&&_r.active&&_r.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Iu.has(this)&&(Iu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||op(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Ud(this),ap(this);const t=Gt,n=bo;Gt=this,bo=!0;try{return this.fn()}finally{sp(this),Gt=t,bo=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Bc(t);this.deps=this.depsTail=void 0,Ud(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Iu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){oc(this)&&this.run()}get dirty(){return oc(this)}}let rp=0,mi,vi;function op(e,t=!1){if(e.flags|=8,t){e.next=vi,vi=e;return}e.next=mi,mi=e}function Fc(){rp++}function Uc(){if(--rp>0)return;if(vi){let t=vi;for(vi=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;mi;){let t=mi;for(mi=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 ap(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function sp(e){let t,n=e.depsTail,r=n;for(;r;){const a=r.prevDep;r.version===-1?(r===n&&(n=a),Bc(r),Fg(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=a}e.deps=t,e.depsTail=n}function oc(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ip(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ip(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ci)||(e.globalVersion=Ci,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!oc(e))))return;e.flags|=2;const t=e.dep,n=Gt,r=bo;Gt=e,bo=!0;try{ap(e);const a=e.fn(e._value);(t.version===0||yo(a,e._value))&&(e.flags|=128,e._value=a,t.version++)}catch(a){throw t.version++,a}finally{Gt=n,bo=r,sp(e),e.flags&=-3}}function Bc(e,t=!1){const{dep:n,prevSub:r,nextSub:a}=e;if(r&&(r.nextSub=a,e.prevSub=void 0),a&&(a.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)Bc(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Fg(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let bo=!0;const lp=[];function fa(){lp.push(bo),bo=!1}function ha(){const e=lp.pop();bo=e===void 0?!0:e}function Ud(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Gt;Gt=void 0;try{t()}finally{Gt=n}}}let Ci=0;class Ug{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 qc{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(!Gt||!bo||Gt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Gt)n=this.activeLink=new Ug(Gt,this),Gt.deps?(n.prevDep=Gt.depsTail,Gt.depsTail.nextDep=n,Gt.depsTail=n):Gt.deps=Gt.depsTail=n,up(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=Gt.depsTail,n.nextDep=void 0,Gt.depsTail.nextDep=n,Gt.depsTail=n,Gt.deps===n&&(Gt.deps=r)}return n}trigger(t){this.version++,Ci++,this.notify(t)}notify(t){Fc();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Uc()}}}function up(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)up(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const ac=new WeakMap,as=Symbol(""),sc=Symbol(""),Si=Symbol("");function Jn(e,t,n){if(bo&&Gt){let r=ac.get(e);r||ac.set(e,r=new Map);let a=r.get(n);a||(r.set(n,a=new qc),a.map=r,a.key=n),a.track()}}function la(e,t,n,r,a,o){const s=ac.get(e);if(!s){Ci++;return}const l=c=>{c&&c.trigger()};if(Fc(),t==="clear")s.forEach(l);else{const c=st(e),h=c&&Oc(n);if(c&&n==="length"){const f=Number(r);s.forEach((g,T)=>{(T==="length"||T===Si||!To(T)&&T>=f)&&l(g)})}else switch((n!==void 0||s.has(void 0))&&l(s.get(n)),h&&l(s.get(Si)),t){case"add":c?h&&l(s.get("length")):(l(s.get(as)),Is(e)&&l(s.get(sc)));break;case"delete":c||(l(s.get(as)),Is(e)&&l(s.get(sc)));break;case"set":Is(e)&&l(s.get(as));break}}Uc()}function ms(e){const t=Et(e);return t===e?t:(Jn(t,"iterate",Si),Yr(e)?t:t.map(ko))}function Hl(e){return Jn(e=Et(e),"iterate",Si),e}function Bo(e,t){return pa(e)?Ls(ss(e)?ko(t):t):ko(t)}const Bg={__proto__:null,[Symbol.iterator](){return Pu(this,Symbol.iterator,e=>Bo(this,e))},concat(...e){return ms(this).concat(...e.map(t=>st(t)?ms(t):t))},entries(){return Pu(this,"entries",e=>(e[1]=Bo(this,e[1]),e))},every(e,t){return ra(this,"every",e,t,void 0,arguments)},filter(e,t){return ra(this,"filter",e,t,n=>n.map(r=>Bo(this,r)),arguments)},find(e,t){return ra(this,"find",e,t,n=>Bo(this,n),arguments)},findIndex(e,t){return ra(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ra(this,"findLast",e,t,n=>Bo(this,n),arguments)},findLastIndex(e,t){return ra(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ra(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ru(this,"includes",e)},indexOf(...e){return Ru(this,"indexOf",e)},join(e){return ms(this).join(e)},lastIndexOf(...e){return Ru(this,"lastIndexOf",e)},map(e,t){return ra(this,"map",e,t,void 0,arguments)},pop(){return si(this,"pop")},push(...e){return si(this,"push",e)},reduce(e,...t){return Bd(this,"reduce",e,t)},reduceRight(e,...t){return Bd(this,"reduceRight",e,t)},shift(){return si(this,"shift")},some(e,t){return ra(this,"some",e,t,void 0,arguments)},splice(...e){return si(this,"splice",e)},toReversed(){return ms(this).toReversed()},toSorted(e){return ms(this).toSorted(e)},toSpliced(...e){return ms(this).toSpliced(...e)},unshift(...e){return si(this,"unshift",e)},values(){return Pu(this,"values",e=>Bo(this,e))}};function Pu(e,t,n){const r=Hl(e),a=r[t]();return r!==e&&!Yr(e)&&(a._next=a.next,a.next=()=>{const o=a._next();return o.done||(o.value=n(o.value)),o}),a}const qg=Array.prototype;function ra(e,t,n,r,a,o){const s=Hl(e),l=s!==e&&!Yr(e),c=s[t];if(c!==qg[t]){const g=c.apply(e,o);return l?ko(g):g}let h=n;s!==e&&(l?h=function(g,T){return n.call(this,Bo(e,g),T,e)}:n.length>2&&(h=function(g,T){return n.call(this,g,T,e)}));const f=c.call(s,h,r);return l&&a?a(f):f}function Bd(e,t,n,r){const a=Hl(e),o=a!==e&&!Yr(e);let s=n,l=!1;a!==e&&(o?(l=r.length===0,s=function(h,f,g){return l&&(l=!1,h=Bo(e,h)),n.call(this,h,Bo(e,f),g,e)}):n.length>3&&(s=function(h,f,g){return n.call(this,h,f,g,e)}));const c=a[t](s,...r);return l?Bo(e,c):c}function Ru(e,t,n){const r=Et(e);Jn(r,"iterate",Si);const a=r[t](...n);return(a===-1||a===!1)&&Vc(n[0])?(n[0]=Et(n[0]),r[t](...n)):a}function si(e,t,n=[]){fa(),Fc();const r=Et(e)[t].apply(e,n);return Uc(),ha(),r}const Hg=Lc("__proto__,__v_isRef,__isVue"),cp=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(To));function Wg(e){To(e)||(e=String(e));const t=Et(this);return Jn(t,"has",e),t.hasOwnProperty(e)}class dp{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const a=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!a;if(n==="__v_isReadonly")return a;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(a?o?ey:mp:o?pp:hp).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=st(t);if(!a){let c;if(s&&(c=Bg[n]))return c;if(n==="hasOwnProperty")return Wg}const l=Reflect.get(t,n,Zn(t)?t:r);if((To(n)?cp.has(n):Hg(n))||(a||Jn(t,"get",n),o))return l;if(Zn(l)){const c=s&&Oc(n)?l:l.value;return a&&Mt(c)?lc(c):c}return Mt(l)?a?lc(l):Wl(l):l}}class fp extends dp{constructor(t=!1){super(!1,t)}set(t,n,r,a){let o=t[n];const s=st(t)&&Oc(n);if(!this._isShallow){const h=pa(o);if(!Yr(r)&&!pa(r)&&(o=Et(o),r=Et(r)),!s&&Zn(o)&&!Zn(r))return h||(o.value=r),!0}const l=s?Number(n)<t.length:Rt(t,n),c=Reflect.set(t,n,r,Zn(t)?t:a);return t===Et(a)&&(l?yo(r,o)&&la(t,"set",n,r):la(t,"add",n,r)),c}deleteProperty(t,n){const r=Rt(t,n);t[n];const a=Reflect.deleteProperty(t,n);return a&&r&&la(t,"delete",n,void 0),a}has(t,n){const r=Reflect.has(t,n);return(!To(n)||!cp.has(n))&&Jn(t,"has",n),r}ownKeys(t){return Jn(t,"iterate",st(t)?"length":as),Reflect.ownKeys(t)}}class Vg extends dp{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const zg=new fp,Gg=new Vg,Kg=new fp(!0);const ic=e=>e,ol=e=>Reflect.getPrototypeOf(e);function Yg(e,t,n){return function(...r){const a=this.__v_raw,o=Et(a),s=Is(o),l=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,h=a[e](...r),f=n?ic:t?Ls:ko;return!t&&Jn(o,"iterate",c?sc:as),kn(Object.create(h),{next(){const{value:g,done:T}=h.next();return T?{value:g,done:T}:{value:l?[f(g[0]),f(g[1])]:f(g),done:T}}})}}function al(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Qg(e,t){const n={get(a){const o=this.__v_raw,s=Et(o),l=Et(a);e||(yo(a,l)&&Jn(s,"get",a),Jn(s,"get",l));const{has:c}=ol(s),h=t?ic:e?Ls:ko;if(c.call(s,a))return h(o.get(a));if(c.call(s,l))return h(o.get(l));o!==s&&o.get(a)},get size(){const a=this.__v_raw;return!e&&Jn(Et(a),"iterate",as),a.size},has(a){const o=this.__v_raw,s=Et(o),l=Et(a);return e||(yo(a,l)&&Jn(s,"has",a),Jn(s,"has",l)),a===l?o.has(a):o.has(a)||o.has(l)},forEach(a,o){const s=this,l=s.__v_raw,c=Et(l),h=t?ic:e?Ls:ko;return!e&&Jn(c,"iterate",as),l.forEach((f,g)=>a.call(o,h(f),h(g),s))}};return kn(n,e?{add:al("add"),set:al("set"),delete:al("delete"),clear:al("clear")}:{add(a){const o=Et(this),s=ol(o),l=Et(a),c=!t&&!Yr(a)&&!pa(a)?l:a;return s.has.call(o,c)||yo(a,c)&&s.has.call(o,a)||yo(l,c)&&s.has.call(o,l)||(o.add(c),la(o,"add",c,c)),this},set(a,o){!t&&!Yr(o)&&!pa(o)&&(o=Et(o));const s=Et(this),{has:l,get:c}=ol(s);let h=l.call(s,a);h||(a=Et(a),h=l.call(s,a));const f=c.call(s,a);return s.set(a,o),h?yo(o,f)&&la(s,"set",a,o):la(s,"add",a,o),this},delete(a){const o=Et(this),{has:s,get:l}=ol(o);let c=s.call(o,a);c||(a=Et(a),c=s.call(o,a)),l&&l.call(o,a);const h=o.delete(a);return c&&la(o,"delete",a,void 0),h},clear(){const a=Et(this),o=a.size!==0,s=a.clear();return o&&la(a,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(a=>{n[a]=Yg(a,e,t)}),n}function Hc(e,t){const n=Qg(e,t);return(r,a,o)=>a==="__v_isReactive"?!e:a==="__v_isReadonly"?e:a==="__v_raw"?r:Reflect.get(Rt(n,a)&&a in r?n:r,a,o)}const Jg={get:Hc(!1,!1)},Xg={get:Hc(!1,!0)},Zg={get:Hc(!0,!1)};const hp=new WeakMap,pp=new WeakMap,mp=new WeakMap,ey=new WeakMap;function ty(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ny(e){return e.__v_skip||!Object.isExtensible(e)?0:ty(xg(e))}function Wl(e){return pa(e)?e:Wc(e,!1,zg,Jg,hp)}function vp(e){return Wc(e,!1,Kg,Xg,pp)}function lc(e){return Wc(e,!0,Gg,Zg,mp)}function Wc(e,t,n,r,a){if(!Mt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=ny(e);if(o===0)return e;const s=a.get(e);if(s)return s;const l=new Proxy(e,o===2?r:n);return a.set(e,l),l}function ss(e){return pa(e)?ss(e.__v_raw):!!(e&&e.__v_isReactive)}function pa(e){return!!(e&&e.__v_isReadonly)}function Yr(e){return!!(e&&e.__v_isShallow)}function Vc(e){return e?!!e.__v_raw:!1}function Et(e){const t=e&&e.__v_raw;return t?Et(t):e}function ry(e){return!Rt(e,"__v_skip")&&Object.isExtensible(e)&&Xh(e,"__v_skip",!0),e}const ko=e=>Mt(e)?Wl(e):e,Ls=e=>Mt(e)?lc(e):e;function Zn(e){return e?e.__v_isRef===!0:!1}function x(e){return gp(e,!1)}function oy(e){return gp(e,!0)}function gp(e,t){return Zn(e)?e:new ay(e,t)}class ay{constructor(t,n){this.dep=new qc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Et(t),this._value=n?t:ko(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Yr(t)||pa(t);t=r?t:Et(t),yo(t,n)&&(this._rawValue=t,this._value=r?t:ko(t),this.dep.trigger())}}function S(e){return Zn(e)?e.value:e}const sy={get:(e,t,n)=>t==="__v_raw"?e:S(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const a=e[t];return Zn(a)&&!Zn(n)?(a.value=n,!0):Reflect.set(e,t,n,r)}};function yp(e){return ss(e)?e:new Proxy(e,sy)}class iy{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new qc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ci-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Gt!==this)return op(this,!0),!0}get value(){const t=this.dep.track();return ip(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function ly(e,t,n=!1){let r,a;return ft(e)?r=e:(r=e.get,a=e.set),new iy(r,a,n)}const sl={},Al=new WeakMap;let ts;function uy(e,t=!1,n=ts){if(n){let r=Al.get(n);r||Al.set(n,r=[]),r.push(e)}}function cy(e,t,n=Wt){const{immediate:r,deep:a,once:o,scheduler:s,augmentJob:l,call:c}=n,h=ee=>a?ee:Yr(ee)||a===!1||a===0?ua(ee,1):ua(ee);let f,g,T,I,j=!1,B=!1;if(Zn(e)?(g=()=>e.value,j=Yr(e)):ss(e)?(g=()=>h(e),j=!0):st(e)?(B=!0,j=e.some(ee=>ss(ee)||Yr(ee)),g=()=>e.map(ee=>{if(Zn(ee))return ee.value;if(ss(ee))return h(ee);if(ft(ee))return c?c(ee,2):ee()})):ft(e)?t?g=c?()=>c(e,2):e:g=()=>{if(T){fa();try{T()}finally{ha()}}const ee=ts;ts=f;try{return c?c(e,3,[I]):e(I)}finally{ts=ee}}:g=Wo,t&&a){const ee=g,be=a===!0?1/0:a;g=()=>ua(ee(),be)}const X=Dg(),U=()=>{f.stop(),X&&X.active&&jc(X.effects,f)};if(o&&t){const ee=t;t=(...be)=>{ee(...be),U()}}let O=B?new Array(e.length).fill(sl):sl;const G=ee=>{if(!(!(f.flags&1)||!f.dirty&&!ee))if(t){const be=f.run();if(a||j||(B?be.some((pe,Te)=>yo(pe,O[Te])):yo(be,O))){T&&T();const pe=ts;ts=f;try{const Te=[be,O===sl?void 0:B&&O[0]===sl?[]:O,I];O=be,c?c(t,3,Te):t(...Te)}finally{ts=pe}}}else f.run()};return l&&l(G),f=new np(g),f.scheduler=s?()=>s(G,!1):G,I=ee=>uy(ee,!1,f),T=f.onStop=()=>{const ee=Al.get(f);if(ee){if(c)c(ee,4);else for(const be of ee)be();Al.delete(f)}},t?r?G(!0):O=f.run():s?s(G.bind(null,!0),!0):f.run(),U.pause=f.pause.bind(f),U.resume=f.resume.bind(f),U.stop=U,U}function ua(e,t=1/0,n){if(t<=0||!Mt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Zn(e))ua(e.value,t,n);else if(st(e))for(let r=0;r<e.length;r++)ua(e[r],t,n);else if(Hs(e)||Is(e))e.forEach(r=>{ua(r,t,n)});else if(Jh(e)){for(const r in e)ua(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ua(e[r],t,n)}return e}/**
|
|
11
|
+
* @vue/runtime-core v3.5.31
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function $i(e,t,n,r){try{return r?e(...r):e()}catch(a){Ni(a,t,n)}}function Co(e,t,n,r){if(ft(e)){const a=$i(e,t,n,r);return a&&Yh(a)&&a.catch(o=>{Ni(o,t,n)}),a}if(st(e)){const a=[];for(let o=0;o<e.length;o++)a.push(Co(e[o],t,n,r));return a}}function Ni(e,t,n,r=!0){const a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Wt;if(t){let l=t.parent;const c=t.proxy,h=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const f=l.ec;if(f){for(let g=0;g<f.length;g++)if(f[g](e,c,h)===!1)return}l=l.parent}if(o){fa(),$i(o,null,10,[e,c,h]),ha();return}}dy(e,n,a,r,s)}function dy(e,t,n,r=!0,a=!1){if(a)throw e;console.error(e)}const lr=[];let Fo=-1;const Ps=[];let Ea=null,bs=0;const wp=Promise.resolve();let El=null;function Kt(e){const t=El||wp;return e?t.then(this?e.bind(this):e):t}function fy(e){let t=Fo+1,n=lr.length;for(;t<n;){const r=t+n>>>1,a=lr[r],o=xi(a);o<e||o===e&&a.flags&2?t=r+1:n=r}return t}function zc(e){if(!(e.flags&1)){const t=xi(e),n=lr[lr.length-1];!n||!(e.flags&2)&&t>=xi(n)?lr.push(e):lr.splice(fy(t),0,e),e.flags|=1,bp()}}function bp(){El||(El=wp.then(Tp))}function hy(e){st(e)?Ps.push(...e):Ea&&e.id===-1?Ea.splice(bs+1,0,e):e.flags&1||(Ps.push(e),e.flags|=1),bp()}function qd(e,t,n=Fo+1){for(;n<lr.length;n++){const r=lr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;lr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function _p(e){if(Ps.length){const t=[...new Set(Ps)].sort((n,r)=>xi(n)-xi(r));if(Ps.length=0,Ea){Ea.push(...t);return}for(Ea=t,bs=0;bs<Ea.length;bs++){const n=Ea[bs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ea=null,bs=0}}const xi=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Tp(e){try{for(Fo=0;Fo<lr.length;Fo++){const t=lr[Fo];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),$i(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Fo<lr.length;Fo++){const t=lr[Fo];t&&(t.flags&=-2)}Fo=-1,lr.length=0,_p(),El=null,(lr.length||Ps.length)&&Tp()}}let Dn=null,kp=null;function Il(e){const t=Dn;return Dn=e,kp=e&&e.type.__scopeId||null,t}function mt(e,t=Dn,n){if(!t||e._n)return e;const r=(...a)=>{r._d&&Ml(-1);const o=Il(t);let s;try{s=e(...a)}finally{Il(o),r._d&&Ml(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function jt(e,t){if(Dn===null)return e;const n=Yl(Dn),r=e.dirs||(e.dirs=[]);for(let a=0;a<t.length;a++){let[o,s,l,c=Wt]=t[a];o&&(ft(o)&&(o={mounted:o,updated:o}),o.deep&&ua(s),r.push({dir:o,instance:n,value:s,oldValue:void 0,arg:l,modifiers:c}))}return e}function Ja(e,t,n,r){const a=e.dirs,o=t&&t.dirs;for(let s=0;s<a.length;s++){const l=a[s];o&&(l.oldValue=o[s].value);let c=l.dir[r];c&&(fa(),Co(c,n,8,[e.el,l,e,t]),ha())}}function bl(e,t){if(On){let n=On.provides;const r=On.parent&&On.parent.provides;r===n&&(n=On.provides=Object.create(r)),n[e]=t}}function _o(e,t,n=!1){const r=Zc();if(r||Ms){let a=Ms?Ms._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(a&&e in a)return a[e];if(arguments.length>1)return n&&ft(t)?t.call(r&&r.proxy):t}}const py=Symbol.for("v-scx"),my=()=>_o(py);function pt(e,t,n){return Cp(e,t,n)}function Cp(e,t,n=Wt){const{immediate:r,deep:a,flush:o,once:s}=n,l=kn({},n),c=t&&r||!t&&o!=="post";let h;if(Os){if(o==="sync"){const I=my();h=I.__watcherHandles||(I.__watcherHandles=[])}else if(!c){const I=()=>{};return I.stop=Wo,I.resume=Wo,I.pause=Wo,I}}const f=On;l.call=(I,j,B)=>Co(I,f,j,B);let g=!1;o==="post"?l.scheduler=I=>{Qn(I,f&&f.suspense)}:o!=="sync"&&(g=!0,l.scheduler=(I,j)=>{j?I():zc(I)}),l.augmentJob=I=>{t&&(I.flags|=4),g&&(I.flags|=2,f&&(I.id=f.uid,I.i=f))};const T=cy(e,t,l);return Os&&(h?h.push(T):c&&T()),T}function vy(e,t,n){const r=this.proxy,a=un(e)?e.includes(".")?Sp(r,e):()=>r[e]:e.bind(r,r);let o;ft(t)?o=t:(o=t.handler,n=t);const s=ji(this),l=Cp(a,o.bind(r),n);return s(),l}function Sp(e,t){const n=t.split(".");return()=>{let r=e;for(let a=0;a<n.length&&r;a++)r=r[n[a]];return r}}const xp=Symbol("_vte"),Ap=e=>e.__isTeleport,gi=e=>e&&(e.disabled||e.disabled===""),gy=e=>e&&(e.defer||e.defer===""),Hd=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Wd=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,uc=(e,t)=>{const n=e&&e.to;return un(n)?t?t(n):null:n},Ep={name:"Teleport",__isTeleport:!0,process(e,t,n,r,a,o,s,l,c,h){const{mc:f,pc:g,pbc:T,o:{insert:I,querySelector:j,createText:B,createComment:X}}=h,U=gi(t.props);let{shapeFlag:O,children:G,dynamicChildren:ee}=t;if(e==null){const be=t.el=B(""),pe=t.anchor=B("");I(be,n,r),I(pe,n,r);const Te=(K,ge)=>{O&16&&f(G,K,ge,a,o,s,l,c)},Pe=()=>{const K=t.target=uc(t.props,j),ge=cc(K,t,B,I);K&&(s!=="svg"&&Hd(K)?s="svg":s!=="mathml"&&Wd(K)&&(s="mathml"),a&&a.isCE&&(a.ce._teleportTargets||(a.ce._teleportTargets=new Set)).add(K),U||(Te(K,ge),_l(t,!1)))};U&&(Te(n,pe),_l(t,!0)),gy(t.props)||o&&o.pendingBranch?(t.el.__isMounted=!1,Qn(()=>{t.el.__isMounted===!1&&(Pe(),delete t.el.__isMounted)},o)):Pe()}else{t.el=e.el,t.targetStart=e.targetStart;const be=t.anchor=e.anchor,pe=t.target=e.target,Te=t.targetAnchor=e.targetAnchor;if(e.el.__isMounted===!1){Qn(()=>{Ep.process(e,t,n,r,a,o,s,l,c,h)},o);return}const Pe=gi(e.props),K=Pe?n:pe,ge=Pe?be:Te;if(s==="svg"||Hd(pe)?s="svg":(s==="mathml"||Wd(pe))&&(s="mathml"),ee?(T(e.dynamicChildren,ee,K,a,o,s,l),Jc(e,t,!0)):c||g(e,t,K,ge,a,o,s,l,!1),U)Pe?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):il(t,n,be,h,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ke=t.target=uc(t.props,j);ke&&il(t,ke,null,h,0)}else Pe&&il(t,pe,Te,h,1);_l(t,U)}},remove(e,t,n,{um:r,o:{remove:a}},o){const{shapeFlag:s,children:l,anchor:c,targetStart:h,targetAnchor:f,target:g,props:T}=e;if(g&&(a(h),a(f)),o&&a(c),s&16){const I=o||!gi(T);for(let j=0;j<l.length;j++){const B=l[j];r(B,t,n,I,!!B.dynamicChildren)}}},move:il,hydrate:yy};function il(e,t,n,{o:{insert:r},m:a},o=2){o===0&&r(e.targetAnchor,t,n);const{el:s,anchor:l,shapeFlag:c,children:h,props:f}=e,g=o===2;if(g&&r(s,t,n),(!g||gi(f))&&c&16)for(let T=0;T<h.length;T++)a(h[T],t,n,2);g&&r(l,t,n)}function yy(e,t,n,r,a,o,{o:{nextSibling:s,parentNode:l,querySelector:c,insert:h,createText:f}},g){function T(X,U){let O=U;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,X._lpa=t.targetAnchor&&s(t.targetAnchor);break}}O=s(O)}}function I(X,U){U.anchor=g(s(X),U,l(X),n,r,a,o)}const j=t.target=uc(t.props,c),B=gi(t.props);if(j){const X=j._lpa||j.firstChild;t.shapeFlag&16&&(B?(I(e,t),T(j,X),t.targetAnchor||cc(j,t,f,h,l(e)===j?e:null)):(t.anchor=s(e),T(j,X),t.targetAnchor||cc(j,t,f,h),g(X&&s(X),t,j,n,r,a,o))),_l(t,B)}else B&&t.shapeFlag&16&&(I(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Ma=Ep;function _l(e,t){const n=e.ctx;if(n&&n.ut){let r,a;for(t?(r=e.el,a=e.anchor):(r=e.targetStart,a=e.targetAnchor);r&&r!==a;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function cc(e,t,n,r,a=null){const o=t.targetStart=n(""),s=t.targetAnchor=n("");return o[xp]=s,e&&(r(o,e,a),r(s,e,a)),s}const Uo=Symbol("_leaveCb"),ii=Symbol("_enterCb");function wy(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return va(()=>{e.isMounted=!0}),ja(()=>{e.isUnmounting=!0}),e}const Kr=[Function,Array],Ip={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Kr,onEnter:Kr,onAfterEnter:Kr,onEnterCancelled:Kr,onBeforeLeave:Kr,onLeave:Kr,onAfterLeave:Kr,onLeaveCancelled:Kr,onBeforeAppear:Kr,onAppear:Kr,onAfterAppear:Kr,onAppearCancelled:Kr},Pp=e=>{const t=e.subTree;return t.component?Pp(t.component):t},by={name:"BaseTransition",props:Ip,setup(e,{slots:t}){const n=Zc(),r=wy();return()=>{const a=t.default&&$p(t.default(),!0);if(!a||!a.length)return;const o=Rp(a),s=Et(e),{mode:l}=s;if(r.isLeaving)return Mu(o);const c=Vd(o);if(!c)return Mu(o);let h=dc(c,s,r,n,g=>h=g);c.type!==Xn&&Ai(c,h);let f=n.subTree&&Vd(n.subTree);if(f&&f.type!==Xn&&!ns(f,c)&&Pp(n).type!==Xn){let g=dc(f,s,r,n);if(Ai(f,g),l==="out-in"&&c.type!==Xn)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,f=void 0},Mu(o);l==="in-out"&&c.type!==Xn?g.delayLeave=(T,I,j)=>{const B=Mp(r,f);B[String(f.key)]=f,T[Uo]=()=>{I(),T[Uo]=void 0,delete h.delayedLeave,f=void 0},h.delayedLeave=()=>{j(),delete h.delayedLeave,f=void 0}}:f=void 0}else f&&(f=void 0);return o}}};function Rp(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Xn){t=n;break}}return t}const _y=by;function Mp(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,a){const{appear:o,mode:s,persisted:l=!1,onBeforeEnter:c,onEnter:h,onAfterEnter:f,onEnterCancelled:g,onBeforeLeave:T,onLeave:I,onAfterLeave:j,onLeaveCancelled:B,onBeforeAppear:X,onAppear:U,onAfterAppear:O,onAppearCancelled:G}=t,ee=String(e.key),be=Mp(n,e),pe=(K,ge)=>{K&&Co(K,r,9,ge)},Te=(K,ge)=>{const ke=ge[1];pe(K,ge),st(K)?K.every(oe=>oe.length<=1)&&ke():K.length<=1&&ke()},Pe={mode:s,persisted:l,beforeEnter(K){let ge=c;if(!n.isMounted)if(o)ge=X||c;else return;K[Uo]&&K[Uo](!0);const ke=be[ee];ke&&ns(e,ke)&&ke.el[Uo]&&ke.el[Uo](),pe(ge,[K])},enter(K){if(be[ee]===e)return;let ge=h,ke=f,oe=g;if(!n.isMounted)if(o)ge=U||h,ke=O||f,oe=G||g;else return;let Re=!1;K[ii]=He=>{Re||(Re=!0,He?pe(oe,[K]):pe(ke,[K]),Pe.delayedLeave&&Pe.delayedLeave(),K[ii]=void 0)};const ze=K[ii].bind(null,!1);ge?Te(ge,[K,ze]):ze()},leave(K,ge){const ke=String(e.key);if(K[ii]&&K[ii](!0),n.isUnmounting)return ge();pe(T,[K]);let oe=!1;K[Uo]=ze=>{oe||(oe=!0,ge(),ze?pe(B,[K]):pe(j,[K]),K[Uo]=void 0,be[ke]===e&&delete be[ke])};const Re=K[Uo].bind(null,!1);be[ke]=e,I?Te(I,[K,Re]):Re()},clone(K){const ge=dc(K,t,n,r,a);return a&&a(ge),ge}};return Pe}function Mu(e){if(Li(e))return e=Na(e),e.children=null,e}function Vd(e){if(!Li(e))return Ap(e.type)&&e.children?Rp(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ft(n.default))return n.default()}}function Ai(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ai(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 $p(e,t=!1,n){let r=[],a=0;for(let o=0;o<e.length;o++){let s=e[o];const l=n==null?s.key:String(n)+String(s.key!=null?s.key:o);s.type===Qe?(s.patchFlag&128&&a++,r=r.concat($p(s.children,t,l))):(t||s.type!==Xn)&&r.push(l!=null?Na(s,{key:l}):s)}if(a>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Fn(e,t){return ft(e)?kn({name:e.name},t,{setup:e}):e}function Gc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function zd(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Pl=new WeakMap;function yi(e,t,n,r,a=!1){if(st(e)){e.forEach((B,X)=>yi(B,t&&(st(t)?t[X]:t),n,r,a));return}if(Rs(r)&&!a){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&yi(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Yl(r.component):r.el,s=a?null:o,{i:l,r:c}=e,h=t&&t.r,f=l.refs===Wt?l.refs={}:l.refs,g=l.setupState,T=Et(g),I=g===Wt?Kh:B=>zd(f,B)?!1:Rt(T,B),j=(B,X)=>!(X&&zd(f,X));if(h!=null&&h!==c){if(Gd(t),un(h))f[h]=null,I(h)&&(g[h]=null);else if(Zn(h)){const B=t;j(h,B.k)&&(h.value=null),B.k&&(f[B.k]=null)}}if(ft(c))$i(c,l,12,[s,f]);else{const B=un(c),X=Zn(c);if(B||X){const U=()=>{if(e.f){const O=B?I(c)?g[c]:f[c]:j()||!e.k?c.value:f[e.k];if(a)st(O)&&jc(O,o);else if(st(O))O.includes(o)||O.push(o);else if(B)f[c]=[o],I(c)&&(g[c]=f[c]);else{const G=[o];j(c,e.k)&&(c.value=G),e.k&&(f[e.k]=G)}}else B?(f[c]=s,I(c)&&(g[c]=s)):X&&(j(c,e.k)&&(c.value=s),e.k&&(f[e.k]=s))};if(s){const O=()=>{U(),Pl.delete(e)};O.id=-1,Pl.set(e,O),Qn(O,n)}else Gd(e),U()}}}function Gd(e){const t=Pl.get(e);t&&(t.flags|=8,Pl.delete(e))}const Kd=e=>e.nodeType===8;ql().requestIdleCallback;ql().cancelIdleCallback;function Ty(e,t){if(Kd(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Kd(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const Rs=e=>!!e.type.__asyncLoader;function ll(e){ft(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:a=200,hydrate:o,timeout:s,suspensible:l=!0,onError:c}=e;let h=null,f,g=0;const T=()=>(g++,h=null,I()),I=()=>{let j;return h||(j=h=t().catch(B=>{if(B=B instanceof Error?B:new Error(String(B)),c)return new Promise((X,U)=>{c(B,()=>X(T()),()=>U(B),g+1)});throw B}).then(B=>j!==h&&h?h:(B&&(B.__esModule||B[Symbol.toStringTag]==="Module")&&(B=B.default),f=B,B)))};return Fn({name:"AsyncComponentWrapper",__asyncLoader:I,__asyncHydrate(j,B,X){let U=!1;(B.bu||(B.bu=[])).push(()=>U=!0);const O=()=>{U||X()},G=o?()=>{const ee=o(O,be=>Ty(j,be));ee&&(B.bum||(B.bum=[])).push(ee)}:O;f?G():I().then(()=>!B.isUnmounted&&G())},get __asyncResolved(){return f},setup(){const j=On;if(Gc(j),f)return()=>ul(f,j);const B=G=>{h=null,Ni(G,j,13,!r)};if(l&&j.suspense||Os)return I().then(G=>()=>ul(G,j)).catch(G=>(B(G),()=>r?Be(r,{error:G}):null));const X=x(!1),U=x(),O=x(!!a);return a&&setTimeout(()=>{O.value=!1},a),s!=null&&setTimeout(()=>{if(!X.value&&!U.value){const G=new Error(`Async component timed out after ${s}ms.`);B(G),U.value=G}},s),I().then(()=>{X.value=!0,j.parent&&Li(j.parent.vnode)&&j.parent.update()}).catch(G=>{B(G),U.value=G}),()=>{if(X.value&&f)return ul(f,j);if(U.value&&r)return Be(r,{error:U.value});if(n&&!O.value)return ul(n,j)}}})}function ul(e,t){const{ref:n,props:r,children:a,ce:o}=t.vnode,s=Be(e,r,a);return s.ref=n,s.ce=o,delete t.vnode.ce,s}const Li=e=>e.type.__isKeepAlive;function ky(e,t){Np(e,"a",t)}function Cy(e,t){Np(e,"da",t)}function Np(e,t,n=On){const r=e.__wdc||(e.__wdc=()=>{let a=n;for(;a;){if(a.isDeactivated)return;a=a.parent}return e()});if(Vl(t,r,n),n){let a=n.parent;for(;a&&a.parent;)Li(a.parent.vnode)&&Sy(r,t,n,a),a=a.parent}}function Sy(e,t,n,r){const a=Vl(t,e,r,!0);zl(()=>{jc(r[t],a)},n)}function Vl(e,t,n=On,r=!1){if(n){const a=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...s)=>{fa();const l=ji(n),c=Co(t,n,e,s);return l(),ha(),c});return r?a.unshift(o):a.push(o),o}}const ma=e=>(t,n=On)=>{(!Os||e==="sp")&&Vl(e,(...r)=>t(...r),n)},xy=ma("bm"),va=ma("m"),Ay=ma("bu"),Ey=ma("u"),ja=ma("bum"),zl=ma("um"),Iy=ma("sp"),Py=ma("rtg"),Ry=ma("rtc");function My(e,t=On){Vl("ec",e,t)}const $y="components",Lp=Symbol.for("v-ndc");function Kc(e){return un(e)?Ny($y,e,!1)||e:e||Lp}function Ny(e,t,n=!0,r=!1){const a=Dn||On;if(a){const o=a.type;{const l=yw(o,!1);if(l&&(l===t||l===cr(t)||l===Ul(cr(t))))return o}const s=Yd(a[e]||o[e],t)||Yd(a.appContext[e],t);return!s&&r?o:s}}function Yd(e,t){return e&&(e[t]||e[cr(t)]||e[Ul(cr(t))])}function Ot(e,t,n,r){let a;const o=n,s=st(e);if(s||un(e)){const l=s&&ss(e);let c=!1,h=!1;l&&(c=!Yr(e),h=pa(e),e=Hl(e)),a=new Array(e.length);for(let f=0,g=e.length;f<g;f++)a[f]=t(c?h?Ls(ko(e[f])):ko(e[f]):e[f],f,void 0,o)}else if(typeof e=="number"){a=new Array(e);for(let l=0;l<e;l++)a[l]=t(l+1,l,void 0,o)}else if(Mt(e))if(e[Symbol.iterator])a=Array.from(e,(l,c)=>t(l,c,void 0,o));else{const l=Object.keys(e);a=new Array(l.length);for(let c=0,h=l.length;c<h;c++){const f=l[c];a[c]=t(e[f],f,c,o)}}else a=[];return a}function Ho(e,t,n={},r,a){if(Dn.ce||Dn.parent&&Rs(Dn.parent)&&Dn.parent.ce){const h=Object.keys(n).length>0;return t!=="default"&&(n.name=t),k(),at(Qe,null,[Be("slot",n,r)],h?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),k();const s=o&&jp(o(n)),l=n.key||s&&s.key,c=at(Qe,{key:(l&&!To(l)?l:`_${t}`)+(!s&&r?"_fb":"")},s||[],s&&e._===1?64:-2);return o&&o._c&&(o._d=!0),c}function jp(e){return e.some(t=>Ei(t)?!(t.type===Xn||t.type===Qe&&!jp(t.children)):!0)?e:null}const fc=e=>e?nm(e)?Yl(e):fc(e.parent):null,wi=kn(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=>Dp(e),$forceUpdate:e=>e.f||(e.f=()=>{zc(e.update)}),$nextTick:e=>e.n||(e.n=Kt.bind(e.proxy)),$watch:e=>vy.bind(e)}),$u=(e,t)=>e!==Wt&&!e.__isScriptSetup&&Rt(e,t),Ly={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:a,props:o,accessCache:s,type:l,appContext:c}=e;if(t[0]!=="$"){const T=s[t];if(T!==void 0)switch(T){case 1:return r[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else{if($u(r,t))return s[t]=1,r[t];if(a!==Wt&&Rt(a,t))return s[t]=2,a[t];if(Rt(o,t))return s[t]=3,o[t];if(n!==Wt&&Rt(n,t))return s[t]=4,n[t];hc&&(s[t]=0)}}const h=wi[t];let f,g;if(h)return t==="$attrs"&&Jn(e.attrs,"get",""),h(e);if((f=l.__cssModules)&&(f=f[t]))return f;if(n!==Wt&&Rt(n,t))return s[t]=4,n[t];if(g=c.config.globalProperties,Rt(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:a,ctx:o}=e;return $u(a,t)?(a[t]=n,!0):r!==Wt&&Rt(r,t)?(r[t]=n,!0):Rt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:a,props:o,type:s}},l){let c;return!!(n[l]||e!==Wt&&l[0]!=="$"&&Rt(e,l)||$u(t,l)||Rt(o,l)||Rt(r,l)||Rt(wi,l)||Rt(a.config.globalProperties,l)||(c=s.__cssModules)&&c[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Rt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function jy(){return Oy().slots}function Oy(e){const t=Zc();return t.setupContext||(t.setupContext=om(t))}function Qd(e){return st(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let hc=!0;function Dy(e){const t=Dp(e),n=e.proxy,r=e.ctx;hc=!1,t.beforeCreate&&Jd(t.beforeCreate,e,"bc");const{data:a,computed:o,methods:s,watch:l,provide:c,inject:h,created:f,beforeMount:g,mounted:T,beforeUpdate:I,updated:j,activated:B,deactivated:X,beforeDestroy:U,beforeUnmount:O,destroyed:G,unmounted:ee,render:be,renderTracked:pe,renderTriggered:Te,errorCaptured:Pe,serverPrefetch:K,expose:ge,inheritAttrs:ke,components:oe,directives:Re,filters:ze}=t;if(h&&Fy(h,r,null),s)for(const Fe in s){const Le=s[Fe];ft(Le)&&(r[Fe]=Le.bind(n))}if(a){const Fe=a.call(n,n);Mt(Fe)&&(e.data=Wl(Fe))}if(hc=!0,o)for(const Fe in o){const Le=o[Fe],et=ft(Le)?Le.bind(n,n):ft(Le.get)?Le.get.bind(n,n):Wo,Ge=!ft(Le)&&ft(Le.set)?Le.set.bind(n):Wo,Je=Z({get:et,set:Ge});Object.defineProperty(r,Fe,{enumerable:!0,configurable:!0,get:()=>Je.value,set:Ke=>Je.value=Ke})}if(l)for(const Fe in l)Op(l[Fe],r,n,Fe);if(c){const Fe=ft(c)?c.call(n):c;Reflect.ownKeys(Fe).forEach(Le=>{bl(Le,Fe[Le])})}f&&Jd(f,e,"c");function Ne(Fe,Le){st(Le)?Le.forEach(et=>Fe(et.bind(n))):Le&&Fe(Le.bind(n))}if(Ne(xy,g),Ne(va,T),Ne(Ay,I),Ne(Ey,j),Ne(ky,B),Ne(Cy,X),Ne(My,Pe),Ne(Ry,pe),Ne(Py,Te),Ne(ja,O),Ne(zl,ee),Ne(Iy,K),st(ge))if(ge.length){const Fe=e.exposed||(e.exposed={});ge.forEach(Le=>{Object.defineProperty(Fe,Le,{get:()=>n[Le],set:et=>n[Le]=et,enumerable:!0})})}else e.exposed||(e.exposed={});be&&e.render===Wo&&(e.render=be),ke!=null&&(e.inheritAttrs=ke),oe&&(e.components=oe),Re&&(e.directives=Re),K&&Gc(e)}function Fy(e,t,n=Wo){st(e)&&(e=pc(e));for(const r in e){const a=e[r];let o;Mt(a)?"default"in a?o=_o(a.from||r,a.default,!0):o=_o(a.from||r):o=_o(a),Zn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:s=>o.value=s}):t[r]=o}}function Jd(e,t,n){Co(st(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Op(e,t,n,r){let a=r.includes(".")?Sp(n,r):()=>n[r];if(un(e)){const o=t[e];ft(o)&&pt(a,o)}else if(ft(e))pt(a,e.bind(n));else if(Mt(e))if(st(e))e.forEach(o=>Op(o,t,n,r));else{const o=ft(e.handler)?e.handler.bind(n):t[e.handler];ft(o)&&pt(a,o,e)}}function Dp(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:a,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,l=o.get(t);let c;return l?c=l:!a.length&&!n&&!r?c=t:(c={},a.length&&a.forEach(h=>Rl(c,h,s,!0)),Rl(c,t,s)),Mt(t)&&o.set(t,c),c}function Rl(e,t,n,r=!1){const{mixins:a,extends:o}=t;o&&Rl(e,o,n,!0),a&&a.forEach(s=>Rl(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const l=Uy[s]||n&&n[s];e[s]=l?l(e[s],t[s]):t[s]}return e}const Uy={data:Xd,props:Zd,emits:Zd,methods:di,computed:di,beforeCreate:sr,created:sr,beforeMount:sr,mounted:sr,beforeUpdate:sr,updated:sr,beforeDestroy:sr,beforeUnmount:sr,destroyed:sr,unmounted:sr,activated:sr,deactivated:sr,errorCaptured:sr,serverPrefetch:sr,components:di,directives:di,watch:qy,provide:Xd,inject:By};function Xd(e,t){return t?e?function(){return kn(ft(e)?e.call(this,this):e,ft(t)?t.call(this,this):t)}:t:e}function By(e,t){return di(pc(e),pc(t))}function pc(e){if(st(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function sr(e,t){return e?[...new Set([].concat(e,t))]:t}function di(e,t){return e?kn(Object.create(null),e,t):t}function Zd(e,t){return e?st(e)&&st(t)?[...new Set([...e,...t])]:kn(Object.create(null),Qd(e),Qd(t??{})):t}function qy(e,t){if(!e)return t;if(!t)return e;const n=kn(Object.create(null),e);for(const r in t)n[r]=sr(e[r],t[r]);return n}function Fp(){return{app:null,config:{isNativeTag:Kh,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 Hy=0;function Wy(e,t){return function(r,a=null){ft(r)||(r=kn({},r)),a!=null&&!Mt(a)&&(a=null);const o=Fp(),s=new WeakSet,l=[];let c=!1;const h=o.app={_uid:Hy++,_component:r,_props:a,_container:null,_context:o,_instance:null,version:_w,get config(){return o.config},set config(f){},use(f,...g){return s.has(f)||(f&&ft(f.install)?(s.add(f),f.install(h,...g)):ft(f)&&(s.add(f),f(h,...g))),h},mixin(f){return o.mixins.includes(f)||o.mixins.push(f),h},component(f,g){return g?(o.components[f]=g,h):o.components[f]},directive(f,g){return g?(o.directives[f]=g,h):o.directives[f]},mount(f,g,T){if(!c){const I=h._ceVNode||Be(r,a);return I.appContext=o,T===!0?T="svg":T===!1&&(T=void 0),e(I,f,T),c=!0,h._container=f,f.__vue_app__=h,Yl(I.component)}},onUnmount(f){l.push(f)},unmount(){c&&(Co(l,h._instance,16),e(null,h._container),delete h._container.__vue_app__)},provide(f,g){return o.provides[f]=g,h},runWithContext(f){const g=Ms;Ms=h;try{return f()}finally{Ms=g}}};return h}}let Ms=null;const Vy=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${cr(t)}Modifiers`]||e[`${La(t)}Modifiers`];function zy(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Wt;let a=n;const o=t.startsWith("update:"),s=o&&Vy(r,t.slice(7));s&&(s.trim&&(a=n.map(f=>un(f)?f.trim():f)),s.number&&(a=n.map(Bl)));let l,c=r[l=Au(t)]||r[l=Au(cr(t))];!c&&o&&(c=r[l=Au(La(t))]),c&&Co(c,e,6,a);const h=r[l+"Once"];if(h){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Co(h,e,6,a)}}const Gy=new WeakMap;function Up(e,t,n=!1){const r=n?Gy:t.emitsCache,a=r.get(e);if(a!==void 0)return a;const o=e.emits;let s={},l=!1;if(!ft(e)){const c=h=>{const f=Up(h,t,!0);f&&(l=!0,kn(s,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!l?(Mt(e)&&r.set(e,null),null):(st(o)?o.forEach(c=>s[c]=null):kn(s,o),Mt(e)&&r.set(e,s),s)}function Gl(e,t){return!e||!Ol(t)?!1:(t=t.slice(2).replace(/Once$/,""),Rt(e,t[0].toLowerCase()+t.slice(1))||Rt(e,La(t))||Rt(e,t))}function ef(e){const{type:t,vnode:n,proxy:r,withProxy:a,propsOptions:[o],slots:s,attrs:l,emit:c,render:h,renderCache:f,props:g,data:T,setupState:I,ctx:j,inheritAttrs:B}=e,X=Il(e);let U,O;try{if(n.shapeFlag&4){const ee=a||r,be=ee;U=qo(h.call(be,ee,f,g,I,T,j)),O=l}else{const ee=t;U=qo(ee.length>1?ee(g,{attrs:l,slots:s,emit:c}):ee(g,null)),O=t.props?l:Ky(l)}}catch(ee){bi.length=0,Ni(ee,e,1),U=Be(Xn)}let G=U;if(O&&B!==!1){const ee=Object.keys(O),{shapeFlag:be}=G;ee.length&&be&7&&(o&&ee.some(Dl)&&(O=Yy(O,o)),G=Na(G,O,!1,!0))}return n.dirs&&(G=Na(G,null,!1,!0),G.dirs=G.dirs?G.dirs.concat(n.dirs):n.dirs),n.transition&&Ai(G,n.transition),U=G,Il(X),U}const Ky=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ol(n))&&((t||(t={}))[n]=e[n]);return t},Yy=(e,t)=>{const n={};for(const r in e)(!Dl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Qy(e,t,n){const{props:r,children:a,component:o}=e,{props:s,children:l,patchFlag:c}=t,h=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?tf(r,s,h):!!s;if(c&8){const f=t.dynamicProps;for(let g=0;g<f.length;g++){const T=f[g];if(Bp(s,r,T)&&!Gl(h,T))return!0}}}else return(a||l)&&(!l||!l.$stable)?!0:r===s?!1:r?s?tf(r,s,h):!0:!!s;return!1}function tf(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let a=0;a<r.length;a++){const o=r[a];if(Bp(t,e,o)&&!Gl(n,o))return!0}return!1}function Bp(e,t,n){const r=e[n],a=t[n];return n==="style"&&Mt(r)&&Mt(a)?!Ws(r,a):r!==a}function Jy({vnode:e,parent:t,suspense:n},r){for(;t;){const a=t.subTree;if(a.suspense&&a.suspense.activeBranch===e&&(a.suspense.vnode.el=a.el=r,e=a),a===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const qp={},Hp=()=>Object.create(qp),Wp=e=>Object.getPrototypeOf(e)===qp;function Xy(e,t,n,r=!1){const a={},o=Hp();e.propsDefaults=Object.create(null),Vp(e,t,a,o);for(const s in e.propsOptions[0])s in a||(a[s]=void 0);n?e.props=r?a:vp(a):e.type.props?e.props=a:e.props=o,e.attrs=o}function Zy(e,t,n,r){const{props:a,attrs:o,vnode:{patchFlag:s}}=e,l=Et(a),[c]=e.propsOptions;let h=!1;if((r||s>0)&&!(s&16)){if(s&8){const f=e.vnode.dynamicProps;for(let g=0;g<f.length;g++){let T=f[g];if(Gl(e.emitsOptions,T))continue;const I=t[T];if(c)if(Rt(o,T))I!==o[T]&&(o[T]=I,h=!0);else{const j=cr(T);a[j]=mc(c,l,j,I,e,!1)}else I!==o[T]&&(o[T]=I,h=!0)}}}else{Vp(e,t,a,o)&&(h=!0);let f;for(const g in l)(!t||!Rt(t,g)&&((f=La(g))===g||!Rt(t,f)))&&(c?n&&(n[g]!==void 0||n[f]!==void 0)&&(a[g]=mc(c,l,g,void 0,e,!0)):delete a[g]);if(o!==l)for(const g in o)(!t||!Rt(t,g))&&(delete o[g],h=!0)}h&&la(e.attrs,"set","")}function Vp(e,t,n,r){const[a,o]=e.propsOptions;let s=!1,l;if(t)for(let c in t){if(pi(c))continue;const h=t[c];let f;a&&Rt(a,f=cr(c))?!o||!o.includes(f)?n[f]=h:(l||(l={}))[f]=h:Gl(e.emitsOptions,c)||(!(c in r)||h!==r[c])&&(r[c]=h,s=!0)}if(o){const c=Et(n),h=l||Wt;for(let f=0;f<o.length;f++){const g=o[f];n[g]=mc(a,c,g,h[g],e,!Rt(h,g))}}return s}function mc(e,t,n,r,a,o){const s=e[n];if(s!=null){const l=Rt(s,"default");if(l&&r===void 0){const c=s.default;if(s.type!==Function&&!s.skipFactory&&ft(c)){const{propsDefaults:h}=a;if(n in h)r=h[n];else{const f=ji(a);r=h[n]=c.call(null,t),f()}}else r=c;a.ce&&a.ce._setProp(n,r)}s[0]&&(o&&!l?r=!1:s[1]&&(r===""||r===La(n))&&(r=!0))}return r}const ew=new WeakMap;function zp(e,t,n=!1){const r=n?ew:t.propsCache,a=r.get(e);if(a)return a;const o=e.props,s={},l=[];let c=!1;if(!ft(e)){const f=g=>{c=!0;const[T,I]=zp(g,t,!0);kn(s,T),I&&l.push(...I)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!o&&!c)return Mt(e)&&r.set(e,Es),Es;if(st(o))for(let f=0;f<o.length;f++){const g=cr(o[f]);nf(g)&&(s[g]=Wt)}else if(o)for(const f in o){const g=cr(f);if(nf(g)){const T=o[f],I=s[g]=st(T)||ft(T)?{type:T}:kn({},T),j=I.type;let B=!1,X=!0;if(st(j))for(let U=0;U<j.length;++U){const O=j[U],G=ft(O)&&O.name;if(G==="Boolean"){B=!0;break}else G==="String"&&(X=!1)}else B=ft(j)&&j.name==="Boolean";I[0]=B,I[1]=X,(B||Rt(I,"default"))&&l.push(g)}}const h=[s,l];return Mt(e)&&r.set(e,h),h}function nf(e){return e[0]!=="$"&&!pi(e)}const Yc=e=>e==="_"||e==="_ctx"||e==="$stable",Qc=e=>st(e)?e.map(qo):[qo(e)],tw=(e,t,n)=>{if(t._n)return t;const r=mt((...a)=>Qc(t(...a)),n);return r._c=!1,r},Gp=(e,t,n)=>{const r=e._ctx;for(const a in e){if(Yc(a))continue;const o=e[a];if(ft(o))t[a]=tw(a,o,r);else if(o!=null){const s=Qc(o);t[a]=()=>s}}},Kp=(e,t)=>{const n=Qc(t);e.slots.default=()=>n},Yp=(e,t,n)=>{for(const r in t)(n||!Yc(r))&&(e[r]=t[r])},nw=(e,t,n)=>{const r=e.slots=Hp();if(e.vnode.shapeFlag&32){const a=t._;a?(Yp(r,t,n),n&&Xh(r,"_",a,!0)):Gp(t,r)}else t&&Kp(e,t)},rw=(e,t,n)=>{const{vnode:r,slots:a}=e;let o=!0,s=Wt;if(r.shapeFlag&32){const l=t._;l?n&&l===1?o=!1:Yp(a,t,n):(o=!t.$stable,Gp(t,a)),s=t}else t&&(Kp(e,t),s={default:1});if(o)for(const l in a)!Yc(l)&&s[l]==null&&delete a[l]},Qn=lw;function ow(e){return aw(e)}function aw(e,t){const n=ql();n.__VUE__=!0;const{insert:r,remove:a,patchProp:o,createElement:s,createText:l,createComment:c,setText:h,setElementText:f,parentNode:g,nextSibling:T,setScopeId:I=Wo,insertStaticContent:j}=e,B=(A,$,V,ne=null,le=null,ae=null,he=void 0,ue=null,ye=!!$.dynamicChildren)=>{if(A===$)return;A&&!ns(A,$)&&(ne=Q(A),Ke(A,le,ae,!0),A=null),$.patchFlag===-2&&(ye=!1,$.dynamicChildren=null);const{type:de,ref:Me,shapeFlag:xe}=$;switch(de){case Kl:X(A,$,V,ne);break;case Xn:U(A,$,V,ne);break;case Tl:A==null&&O($,V,ne,he);break;case Qe:oe(A,$,V,ne,le,ae,he,ue,ye);break;default:xe&1?be(A,$,V,ne,le,ae,he,ue,ye):xe&6?Re(A,$,V,ne,le,ae,he,ue,ye):(xe&64||xe&128)&&de.process(A,$,V,ne,le,ae,he,ue,ye,Oe)}Me!=null&&le?yi(Me,A&&A.ref,ae,$||A,!$):Me==null&&A&&A.ref!=null&&yi(A.ref,null,ae,A,!0)},X=(A,$,V,ne)=>{if(A==null)r($.el=l($.children),V,ne);else{const le=$.el=A.el;$.children!==A.children&&h(le,$.children)}},U=(A,$,V,ne)=>{A==null?r($.el=c($.children||""),V,ne):$.el=A.el},O=(A,$,V,ne)=>{[A.el,A.anchor]=j(A.children,$,V,ne,A.el,A.anchor)},G=({el:A,anchor:$},V,ne)=>{let le;for(;A&&A!==$;)le=T(A),r(A,V,ne),A=le;r($,V,ne)},ee=({el:A,anchor:$})=>{let V;for(;A&&A!==$;)V=T(A),a(A),A=V;a($)},be=(A,$,V,ne,le,ae,he,ue,ye)=>{if($.type==="svg"?he="svg":$.type==="math"&&(he="mathml"),A==null)pe($,V,ne,le,ae,he,ue,ye);else{const de=A.el&&A.el._isVueCE?A.el:null;try{de&&de._beginPatch(),K(A,$,le,ae,he,ue,ye)}finally{de&&de._endPatch()}}},pe=(A,$,V,ne,le,ae,he,ue)=>{let ye,de;const{props:Me,shapeFlag:xe,transition:$e,dirs:je}=A;if(ye=A.el=s(A.type,ae,Me&&Me.is,Me),xe&8?f(ye,A.children):xe&16&&Pe(A.children,ye,null,ne,le,Nu(A,ae),he,ue),je&&Ja(A,null,ne,"created"),Te(ye,A,A.scopeId,he,ne),Me){for(const D in Me)D!=="value"&&!pi(D)&&o(ye,D,null,Me[D],ae,ne);"value"in Me&&o(ye,"value",null,Me.value,ae),(de=Me.onVnodeBeforeMount)&&Do(de,ne,A)}je&&Ja(A,null,ne,"beforeMount");const tt=sw(le,$e);tt&&$e.beforeEnter(ye),r(ye,$,V),((de=Me&&Me.onVnodeMounted)||tt||je)&&Qn(()=>{try{de&&Do(de,ne,A),tt&&$e.enter(ye),je&&Ja(A,null,ne,"mounted")}finally{}},le)},Te=(A,$,V,ne,le)=>{if(V&&I(A,V),ne)for(let ae=0;ae<ne.length;ae++)I(A,ne[ae]);if(le){let ae=le.subTree;if($===ae||Xp(ae.type)&&(ae.ssContent===$||ae.ssFallback===$)){const he=le.vnode;Te(A,he,he.scopeId,he.slotScopeIds,le.parent)}}},Pe=(A,$,V,ne,le,ae,he,ue,ye=0)=>{for(let de=ye;de<A.length;de++){const Me=A[de]=ue?ia(A[de]):qo(A[de]);B(null,Me,$,V,ne,le,ae,he,ue)}},K=(A,$,V,ne,le,ae,he)=>{const ue=$.el=A.el;let{patchFlag:ye,dynamicChildren:de,dirs:Me}=$;ye|=A.patchFlag&16;const xe=A.props||Wt,$e=$.props||Wt;let je;if(V&&Xa(V,!1),(je=$e.onVnodeBeforeUpdate)&&Do(je,V,$,A),Me&&Ja($,A,V,"beforeUpdate"),V&&Xa(V,!0),(xe.innerHTML&&$e.innerHTML==null||xe.textContent&&$e.textContent==null)&&f(ue,""),de?ge(A.dynamicChildren,de,ue,V,ne,Nu($,le),ae):he||Le(A,$,ue,null,V,ne,Nu($,le),ae,!1),ye>0){if(ye&16)ke(ue,xe,$e,V,le);else if(ye&2&&xe.class!==$e.class&&o(ue,"class",null,$e.class,le),ye&4&&o(ue,"style",xe.style,$e.style,le),ye&8){const tt=$.dynamicProps;for(let D=0;D<tt.length;D++){const q=tt[D],W=xe[q],se=$e[q];(se!==W||q==="value")&&o(ue,q,W,se,le,V)}}ye&1&&A.children!==$.children&&f(ue,$.children)}else!he&&de==null&&ke(ue,xe,$e,V,le);((je=$e.onVnodeUpdated)||Me)&&Qn(()=>{je&&Do(je,V,$,A),Me&&Ja($,A,V,"updated")},ne)},ge=(A,$,V,ne,le,ae,he)=>{for(let ue=0;ue<$.length;ue++){const ye=A[ue],de=$[ue],Me=ye.el&&(ye.type===Qe||!ns(ye,de)||ye.shapeFlag&198)?g(ye.el):V;B(ye,de,Me,null,ne,le,ae,he,!0)}},ke=(A,$,V,ne,le)=>{if($!==V){if($!==Wt)for(const ae in $)!pi(ae)&&!(ae in V)&&o(A,ae,$[ae],null,le,ne);for(const ae in V){if(pi(ae))continue;const he=V[ae],ue=$[ae];he!==ue&&ae!=="value"&&o(A,ae,ue,he,le,ne)}"value"in V&&o(A,"value",$.value,V.value,le)}},oe=(A,$,V,ne,le,ae,he,ue,ye)=>{const de=$.el=A?A.el:l(""),Me=$.anchor=A?A.anchor:l("");let{patchFlag:xe,dynamicChildren:$e,slotScopeIds:je}=$;je&&(ue=ue?ue.concat(je):je),A==null?(r(de,V,ne),r(Me,V,ne),Pe($.children||[],V,Me,le,ae,he,ue,ye)):xe>0&&xe&64&&$e&&A.dynamicChildren&&A.dynamicChildren.length===$e.length?(ge(A.dynamicChildren,$e,V,le,ae,he,ue),($.key!=null||le&&$===le.subTree)&&Jc(A,$,!0)):Le(A,$,V,Me,le,ae,he,ue,ye)},Re=(A,$,V,ne,le,ae,he,ue,ye)=>{$.slotScopeIds=ue,A==null?$.shapeFlag&512?le.ctx.activate($,V,ne,he,ye):ze($,V,ne,le,ae,he,ye):He(A,$,ye)},ze=(A,$,V,ne,le,ae,he)=>{const ue=A.component=pw(A,ne,le);if(Li(A)&&(ue.ctx.renderer=Oe),mw(ue,!1,he),ue.asyncDep){if(le&&le.registerDep(ue,Ne,he),!A.el){const ye=ue.subTree=Be(Xn);U(null,ye,$,V),A.placeholder=ye.el}}else Ne(ue,A,$,V,le,ae,he)},He=(A,$,V)=>{const ne=$.component=A.component;if(Qy(A,$,V))if(ne.asyncDep&&!ne.asyncResolved){Fe(ne,$,V);return}else ne.next=$,ne.update();else $.el=A.el,ne.vnode=$},Ne=(A,$,V,ne,le,ae,he)=>{const ue=()=>{if(A.isMounted){let{next:xe,bu:$e,u:je,parent:tt,vnode:D}=A;{const Ce=Qp(A);if(Ce){xe&&(xe.el=D.el,Fe(A,xe,he)),Ce.asyncDep.then(()=>{Qn(()=>{A.isUnmounted||de()},le)});return}}let q=xe,W;Xa(A,!1),xe?(xe.el=D.el,Fe(A,xe,he)):xe=D,$e&&wl($e),(W=xe.props&&xe.props.onVnodeBeforeUpdate)&&Do(W,tt,xe,D),Xa(A,!0);const se=ef(A),me=A.subTree;A.subTree=se,B(me,se,g(me.el),Q(me),A,le,ae),xe.el=se.el,q===null&&Jy(A,se.el),je&&Qn(je,le),(W=xe.props&&xe.props.onVnodeUpdated)&&Qn(()=>Do(W,tt,xe,D),le)}else{let xe;const{el:$e,props:je}=$,{bm:tt,m:D,parent:q,root:W,type:se}=A,me=Rs($);Xa(A,!1),tt&&wl(tt),!me&&(xe=je&&je.onVnodeBeforeMount)&&Do(xe,q,$),Xa(A,!0);{W.ce&&W.ce._hasShadowRoot()&&W.ce._injectChildStyle(se,A.parent?A.parent.type:void 0);const Ce=A.subTree=ef(A);B(null,Ce,V,ne,A,le,ae),$.el=Ce.el}if(D&&Qn(D,le),!me&&(xe=je&&je.onVnodeMounted)){const Ce=$;Qn(()=>Do(xe,q,Ce),le)}($.shapeFlag&256||q&&Rs(q.vnode)&&q.vnode.shapeFlag&256)&&A.a&&Qn(A.a,le),A.isMounted=!0,$=V=ne=null}};A.scope.on();const ye=A.effect=new np(ue);A.scope.off();const de=A.update=ye.run.bind(ye),Me=A.job=ye.runIfDirty.bind(ye);Me.i=A,Me.id=A.uid,ye.scheduler=()=>zc(Me),Xa(A,!0),de()},Fe=(A,$,V)=>{$.component=A;const ne=A.vnode.props;A.vnode=$,A.next=null,Zy(A,$.props,ne,V),rw(A,$.children,V),fa(),qd(A),ha()},Le=(A,$,V,ne,le,ae,he,ue,ye=!1)=>{const de=A&&A.children,Me=A?A.shapeFlag:0,xe=$.children,{patchFlag:$e,shapeFlag:je}=$;if($e>0){if($e&128){Ge(de,xe,V,ne,le,ae,he,ue,ye);return}else if($e&256){et(de,xe,V,ne,le,ae,he,ue,ye);return}}je&8?(Me&16&&nt(de,le,ae),xe!==de&&f(V,xe)):Me&16?je&16?Ge(de,xe,V,ne,le,ae,he,ue,ye):nt(de,le,ae,!0):(Me&8&&f(V,""),je&16&&Pe(xe,V,ne,le,ae,he,ue,ye))},et=(A,$,V,ne,le,ae,he,ue,ye)=>{A=A||Es,$=$||Es;const de=A.length,Me=$.length,xe=Math.min(de,Me);let $e;for($e=0;$e<xe;$e++){const je=$[$e]=ye?ia($[$e]):qo($[$e]);B(A[$e],je,V,null,le,ae,he,ue,ye)}de>Me?nt(A,le,ae,!0,!1,xe):Pe($,V,ne,le,ae,he,ue,ye,xe)},Ge=(A,$,V,ne,le,ae,he,ue,ye)=>{let de=0;const Me=$.length;let xe=A.length-1,$e=Me-1;for(;de<=xe&&de<=$e;){const je=A[de],tt=$[de]=ye?ia($[de]):qo($[de]);if(ns(je,tt))B(je,tt,V,null,le,ae,he,ue,ye);else break;de++}for(;de<=xe&&de<=$e;){const je=A[xe],tt=$[$e]=ye?ia($[$e]):qo($[$e]);if(ns(je,tt))B(je,tt,V,null,le,ae,he,ue,ye);else break;xe--,$e--}if(de>xe){if(de<=$e){const je=$e+1,tt=je<Me?$[je].el:ne;for(;de<=$e;)B(null,$[de]=ye?ia($[de]):qo($[de]),V,tt,le,ae,he,ue,ye),de++}}else if(de>$e)for(;de<=xe;)Ke(A[de],le,ae,!0),de++;else{const je=de,tt=de,D=new Map;for(de=tt;de<=$e;de++){const ht=$[de]=ye?ia($[de]):qo($[de]);ht.key!=null&&D.set(ht.key,de)}let q,W=0;const se=$e-tt+1;let me=!1,Ce=0;const Ue=new Array(se);for(de=0;de<se;de++)Ue[de]=0;for(de=je;de<=xe;de++){const ht=A[de];if(W>=se){Ke(ht,le,ae,!0);continue}let ot;if(ht.key!=null)ot=D.get(ht.key);else for(q=tt;q<=$e;q++)if(Ue[q-tt]===0&&ns(ht,$[q])){ot=q;break}ot===void 0?Ke(ht,le,ae,!0):(Ue[ot-tt]=de+1,ot>=Ce?Ce=ot:me=!0,B(ht,$[ot],V,null,le,ae,he,ue,ye),W++)}const vt=me?iw(Ue):Es;for(q=vt.length-1,de=se-1;de>=0;de--){const ht=tt+de,ot=$[ht],bt=$[ht+1],Dt=ht+1<Me?bt.el||Jp(bt):ne;Ue[de]===0?B(null,ot,V,Dt,le,ae,he,ue,ye):me&&(q<0||de!==vt[q]?Je(ot,V,Dt,2):q--)}}},Je=(A,$,V,ne,le=null)=>{const{el:ae,type:he,transition:ue,children:ye,shapeFlag:de}=A;if(de&6){Je(A.component.subTree,$,V,ne);return}if(de&128){A.suspense.move($,V,ne);return}if(de&64){he.move(A,$,V,Oe);return}if(he===Qe){r(ae,$,V);for(let xe=0;xe<ye.length;xe++)Je(ye[xe],$,V,ne);r(A.anchor,$,V);return}if(he===Tl){G(A,$,V);return}if(ne!==2&&de&1&&ue)if(ne===0)ue.beforeEnter(ae),r(ae,$,V),Qn(()=>ue.enter(ae),le);else{const{leave:xe,delayLeave:$e,afterLeave:je}=ue,tt=()=>{A.ctx.isUnmounted?a(ae):r(ae,$,V)},D=()=>{ae._isLeaving&&ae[Uo](!0),xe(ae,()=>{tt(),je&&je()})};$e?$e(ae,tt,D):D()}else r(ae,$,V)},Ke=(A,$,V,ne=!1,le=!1)=>{const{type:ae,props:he,ref:ue,children:ye,dynamicChildren:de,shapeFlag:Me,patchFlag:xe,dirs:$e,cacheIndex:je,memo:tt}=A;if(xe===-2&&(le=!1),ue!=null&&(fa(),yi(ue,null,V,A,!0),ha()),je!=null&&($.renderCache[je]=void 0),Me&256){$.ctx.deactivate(A);return}const D=Me&1&&$e,q=!Rs(A);let W;if(q&&(W=he&&he.onVnodeBeforeUnmount)&&Do(W,$,A),Me&6)Xe(A.component,V,ne);else{if(Me&128){A.suspense.unmount(V,ne);return}D&&Ja(A,null,$,"beforeUnmount"),Me&64?A.type.remove(A,$,V,Oe,ne):de&&!de.hasOnce&&(ae!==Qe||xe>0&&xe&64)?nt(de,$,V,!1,!0):(ae===Qe&&xe&384||!le&&Me&16)&&nt(ye,$,V),ne&&it(A)}const se=tt!=null&&je==null;(q&&(W=he&&he.onVnodeUnmounted)||D||se)&&Qn(()=>{W&&Do(W,$,A),D&&Ja(A,null,$,"unmounted"),se&&(A.el=null)},V)},it=A=>{const{type:$,el:V,anchor:ne,transition:le}=A;if($===Qe){qe(V,ne);return}if($===Tl){ee(A);return}const ae=()=>{a(V),le&&!le.persisted&&le.afterLeave&&le.afterLeave()};if(A.shapeFlag&1&&le&&!le.persisted){const{leave:he,delayLeave:ue}=le,ye=()=>he(V,ae);ue?ue(A.el,ae,ye):ye()}else ae()},qe=(A,$)=>{let V;for(;A!==$;)V=T(A),a(A),A=V;a($)},Xe=(A,$,V)=>{const{bum:ne,scope:le,job:ae,subTree:he,um:ue,m:ye,a:de}=A;rf(ye),rf(de),ne&&wl(ne),le.stop(),ae&&(ae.flags|=8,Ke(he,A,$,V)),ue&&Qn(ue,$),Qn(()=>{A.isUnmounted=!0},$)},nt=(A,$,V,ne=!1,le=!1,ae=0)=>{for(let he=ae;he<A.length;he++)Ke(A[he],$,V,ne,le)},Q=A=>{if(A.shapeFlag&6)return Q(A.component.subTree);if(A.shapeFlag&128)return A.suspense.next();const $=T(A.anchor||A.el),V=$&&$[xp];return V?T(V):$};let Ee=!1;const ve=(A,$,V)=>{let ne;A==null?$._vnode&&(Ke($._vnode,null,null,!0),ne=$._vnode.component):B($._vnode||null,A,$,null,null,null,V),$._vnode=A,Ee||(Ee=!0,qd(ne),_p(),Ee=!1)},Oe={p:B,um:Ke,m:Je,r:it,mt:ze,mc:Pe,pc:Le,pbc:ge,n:Q,o:e};return{render:ve,hydrate:void 0,createApp:Wy(ve)}}function Nu({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 Xa({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function sw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Jc(e,t,n=!1){const r=e.children,a=t.children;if(st(r)&&st(a))for(let o=0;o<r.length;o++){const s=r[o];let l=a[o];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=a[o]=ia(a[o]),l.el=s.el),!n&&l.patchFlag!==-2&&Jc(s,l)),l.type===Kl&&(l.patchFlag===-1&&(l=a[o]=ia(l)),l.el=s.el),l.type===Xn&&!l.el&&(l.el=s.el)}}function iw(e){const t=e.slice(),n=[0];let r,a,o,s,l;const c=e.length;for(r=0;r<c;r++){const h=e[r];if(h!==0){if(a=n[n.length-1],e[a]<h){t[r]=a,n.push(r);continue}for(o=0,s=n.length-1;o<s;)l=o+s>>1,e[n[l]]<h?o=l+1:s=l;h<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,s=n[o-1];o-- >0;)n[o]=s,s=t[s];return n}function Qp(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Qp(t)}function rf(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Jp(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Jp(t.subTree):null}const Xp=e=>e.__isSuspense;function lw(e,t){t&&t.pendingBranch?st(e)?t.effects.push(...e):t.effects.push(e):hy(e)}const Qe=Symbol.for("v-fgt"),Kl=Symbol.for("v-txt"),Xn=Symbol.for("v-cmt"),Tl=Symbol.for("v-stc"),bi=[];let ur=null;function k(e=!1){bi.push(ur=e?null:[])}function uw(){bi.pop(),ur=bi[bi.length-1]||null}let js=1;function Ml(e,t=!1){js+=e,e<0&&ur&&t&&(ur.hasOnce=!0)}function Zp(e){return e.dynamicChildren=js>0?ur||Es:null,uw(),js>0&&ur&&ur.push(e),e}function E(e,t,n,r,a,o){return Zp(m(e,t,n,r,a,o,!0))}function at(e,t,n,r,a){return Zp(Be(e,t,n,r,a,!0))}function Ei(e){return e?e.__v_isVNode===!0:!1}function ns(e,t){return e.type===t.type&&e.key===t.key}const em=({key:e})=>e??null,kl=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?un(e)||Zn(e)||ft(e)?{i:Dn,r:e,k:t,f:!!n}:e:null);function m(e,t=null,n=null,r=0,a=null,o=e===Qe?0:1,s=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&em(t),ref:t&&kl(t),scopeId:kp,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:o,patchFlag:r,dynamicProps:a,dynamicChildren:null,appContext:null,ctx:Dn};return l?(Xc(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=un(n)?8:16),js>0&&!s&&ur&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&ur.push(c),c}const Be=cw;function cw(e,t=null,n=null,r=0,a=null,o=!1){if((!e||e===Lp)&&(e=Xn),Ei(e)){const l=Na(e,t,!0);return n&&Xc(l,n),js>0&&!o&&ur&&(l.shapeFlag&6?ur[ur.indexOf(e)]=l:ur.push(l)),l.patchFlag=-2,l}if(ww(e)&&(e=e.__vccOpts),t){t=dw(t);let{class:l,style:c}=t;l&&!un(l)&&(t.class=rt(l)),Mt(c)&&(Vc(c)&&!st(c)&&(c=kn({},c)),t.style=ca(c))}const s=un(e)?1:Xp(e)?128:Ap(e)?64:Mt(e)?4:ft(e)?2:0;return m(e,t,n,r,a,s,o,!0)}function dw(e){return e?Vc(e)||Wp(e)?kn({},e):e:null}function Na(e,t,n=!1,r=!1){const{props:a,ref:o,patchFlag:s,children:l,transition:c}=e,h=t?tm(a||{},t):a,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:h,key:h&&em(h),ref:t&&t.ref?n&&o?st(o)?o.concat(kl(t)):[o,kl(t)]:kl(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Qe?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Na(e.ssContent),ssFallback:e.ssFallback&&Na(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Ai(f,c.clone(f)),f}function ls(e=" ",t=0){return Be(Kl,null,e,t)}function R$(e,t){const n=Be(Tl,null,e);return n.staticCount=t,n}function J(e="",t=!1){return t?(k(),at(Xn,null,e)):Be(Xn,null,e)}function qo(e){return e==null||typeof e=="boolean"?Be(Xn):st(e)?Be(Qe,null,e.slice()):Ei(e)?ia(e):Be(Kl,null,String(e))}function ia(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Na(e)}function Xc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(st(t))n=16;else if(typeof t=="object")if(r&65){const a=t.default;a&&(a._c&&(a._d=!1),Xc(e,a()),a._c&&(a._d=!0));return}else{n=32;const a=t._;!a&&!Wp(t)?t._ctx=Dn:a===3&&Dn&&(Dn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ft(t)?(t={default:t,_ctx:Dn},n=32):(t=String(t),r&64?(n=16,t=[ls(t)]):n=8);e.children=t,e.shapeFlag|=n}function tm(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const a in r)if(a==="class")t.class!==r.class&&(t.class=rt([t.class,r.class]));else if(a==="style")t.style=ca([t.style,r.style]);else if(Ol(a)){const o=t[a],s=r[a];s&&o!==s&&!(st(o)&&o.includes(s))?t[a]=o?[].concat(o,s):s:s==null&&o==null&&!Dl(a)&&(t[a]=s)}else a!==""&&(t[a]=r[a])}return t}function Do(e,t,n,r=null){Co(e,t,7,[n,r])}const fw=Fp();let hw=0;function pw(e,t,n){const r=e.type,a=(t?t.appContext:e.appContext)||fw,o={uid:hw++,vnode:e,type:r,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Og(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:zp(r,a),emitsOptions:Up(r,a),emit:null,emitted:null,propsDefaults:Wt,inheritAttrs:r.inheritAttrs,ctx:Wt,data:Wt,props:Wt,attrs:Wt,slots:Wt,refs:Wt,setupState:Wt,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 o.ctx={_:o},o.root=t?t.root:o,o.emit=zy.bind(null,o),e.ce&&e.ce(o),o}let On=null;const Zc=()=>On||Dn;let $l,vc;{const e=ql(),t=(n,r)=>{let a;return(a=e[n])||(a=e[n]=[]),a.push(r),o=>{a.length>1?a.forEach(s=>s(o)):a[0](o)}};$l=t("__VUE_INSTANCE_SETTERS__",n=>On=n),vc=t("__VUE_SSR_SETTERS__",n=>Os=n)}const ji=e=>{const t=On;return $l(e),e.scope.on(),()=>{e.scope.off(),$l(t)}},of=()=>{On&&On.scope.off(),$l(null)};function nm(e){return e.vnode.shapeFlag&4}let Os=!1;function mw(e,t=!1,n=!1){t&&vc(t);const{props:r,children:a}=e.vnode,o=nm(e);Xy(e,r,o,t),nw(e,a,n||t);const s=o?vw(e,t):void 0;return t&&vc(!1),s}function vw(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Ly);const{setup:r}=n;if(r){fa();const a=e.setupContext=r.length>1?om(e):null,o=ji(e),s=$i(r,e,0,[e.props,a]),l=Yh(s);if(ha(),o(),(l||e.sp)&&!Rs(e)&&Gc(e),l){if(s.then(of,of),t)return s.then(c=>{af(e,c)}).catch(c=>{Ni(c,e,0)});e.asyncDep=s}else af(e,s)}else rm(e)}function af(e,t,n){ft(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Mt(t)&&(e.setupState=yp(t)),rm(e)}function rm(e,t,n){const r=e.type;e.render||(e.render=r.render||Wo);{const a=ji(e);fa();try{Dy(e)}finally{ha(),a()}}}const gw={get(e,t){return Jn(e,"get",""),e[t]}};function om(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,gw),slots:e.slots,emit:e.emit,expose:t}}function Yl(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(yp(ry(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wi)return wi[n](e)},has(t,n){return n in t||n in wi}})):e.proxy}function yw(e,t=!0){return ft(e)?e.displayName||e.name:e.name||t&&e.__name}function ww(e){return ft(e)&&"__vccOpts"in e}const Z=(e,t)=>ly(e,t,Os);function ed(e,t,n){try{Ml(-1);const r=arguments.length;return r===2?Mt(t)&&!st(t)?Ei(t)?Be(e,null,[t]):Be(e,t):Be(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ei(n)&&(n=[n]),Be(e,t,n))}finally{Ml(1)}}function M$(e,t,n,r){const a=n[r];if(a&&bw(a,e))return a;const o=t();return o.memo=e.slice(),o.cacheIndex=r,n[r]=o}function bw(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(yo(n[r],t[r]))return!1;return js>0&&ur&&ur.push(e),!0}const _w="3.5.31";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.31
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let gc;const sf=typeof window<"u"&&window.trustedTypes;if(sf)try{gc=sf.createPolicy("vue",{createHTML:e=>e})}catch{}const am=gc?e=>gc.createHTML(e):e=>e,Tw="http://www.w3.org/2000/svg",kw="http://www.w3.org/1998/Math/MathML",sa=typeof document<"u"?document:null,lf=sa&&sa.createElement("template"),Cw={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 a=t==="svg"?sa.createElementNS(Tw,e):t==="mathml"?sa.createElementNS(kw,e):n?sa.createElement(e,{is:n}):sa.createElement(e);return e==="select"&&r&&r.multiple!=null&&a.setAttribute("multiple",r.multiple),a},createText:e=>sa.createTextNode(e),createComment:e=>sa.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>sa.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,a,o){const s=n?n.previousSibling:t.lastChild;if(a&&(a===o||a.nextSibling))for(;t.insertBefore(a.cloneNode(!0),n),!(a===o||!(a=a.nextSibling)););else{lf.innerHTML=am(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=lf.content;if(r==="svg"||r==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Sa="transition",li="animation",Ii=Symbol("_vtc"),sm={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},Sw=kn({},Ip,sm),xw=e=>(e.displayName="Transition",e.props=Sw,e),im=xw((e,{slots:t})=>ed(_y,Aw(e),t)),Za=(e,t=[])=>{st(e)?e.forEach(n=>n(...t)):e&&e(...t)},uf=e=>e?st(e)?e.some(t=>t.length>1):e.length>1:!1;function Aw(e){const t={};for(const oe in e)oe in sm||(t[oe]=e[oe]);if(e.css===!1)return t;const{name:n="v",type:r,duration:a,enterFromClass:o=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:h=s,appearToClass:f=l,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:T=`${n}-leave-active`,leaveToClass:I=`${n}-leave-to`}=e,j=Ew(a),B=j&&j[0],X=j&&j[1],{onBeforeEnter:U,onEnter:O,onEnterCancelled:G,onLeave:ee,onLeaveCancelled:be,onBeforeAppear:pe=U,onAppear:Te=O,onAppearCancelled:Pe=G}=t,K=(oe,Re,ze,He)=>{oe._enterCancelled=He,es(oe,Re?f:l),es(oe,Re?h:s),ze&&ze()},ge=(oe,Re)=>{oe._isLeaving=!1,es(oe,g),es(oe,I),es(oe,T),Re&&Re()},ke=oe=>(Re,ze)=>{const He=oe?Te:O,Ne=()=>K(Re,oe,ze);Za(He,[Re,Ne]),cf(()=>{es(Re,oe?c:o),oa(Re,oe?f:l),uf(He)||df(Re,r,B,Ne)})};return kn(t,{onBeforeEnter(oe){Za(U,[oe]),oa(oe,o),oa(oe,s)},onBeforeAppear(oe){Za(pe,[oe]),oa(oe,c),oa(oe,h)},onEnter:ke(!1),onAppear:ke(!0),onLeave(oe,Re){oe._isLeaving=!0;const ze=()=>ge(oe,Re);oa(oe,g),oe._enterCancelled?(oa(oe,T),pf(oe)):(pf(oe),oa(oe,T)),cf(()=>{oe._isLeaving&&(es(oe,g),oa(oe,I),uf(ee)||df(oe,r,X,ze))}),Za(ee,[oe,ze])},onEnterCancelled(oe){K(oe,!1,void 0,!0),Za(G,[oe])},onAppearCancelled(oe){K(oe,!0,void 0,!0),Za(Pe,[oe])},onLeaveCancelled(oe){ge(oe),Za(be,[oe])}})}function Ew(e){if(e==null)return null;if(Mt(e))return[Lu(e.enter),Lu(e.leave)];{const t=Lu(e);return[t,t]}}function Lu(e){return Ig(e)}function oa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ii]||(e[Ii]=new Set)).add(t)}function es(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ii];n&&(n.delete(t),n.size||(e[Ii]=void 0))}function cf(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Iw=0;function df(e,t,n,r){const a=e._endId=++Iw,o=()=>{a===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:s,timeout:l,propCount:c}=Pw(e,t);if(!s)return r();const h=s+"end";let f=0;const g=()=>{e.removeEventListener(h,T),o()},T=I=>{I.target===e&&++f>=c&&g()};setTimeout(()=>{f<c&&g()},l+1),e.addEventListener(h,T)}function Pw(e,t){const n=window.getComputedStyle(e),r=j=>(n[j]||"").split(", "),a=r(`${Sa}Delay`),o=r(`${Sa}Duration`),s=ff(a,o),l=r(`${li}Delay`),c=r(`${li}Duration`),h=ff(l,c);let f=null,g=0,T=0;t===Sa?s>0&&(f=Sa,g=s,T=o.length):t===li?h>0&&(f=li,g=h,T=c.length):(g=Math.max(s,h),f=g>0?s>h?Sa:li:null,T=f?f===Sa?o.length:c.length:0);const I=f===Sa&&/\b(?:transform|all)(?:,|$)/.test(r(`${Sa}Property`).toString());return{type:f,timeout:g,propCount:T,hasTransform:I}}function ff(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>hf(n)+hf(e[r])))}function hf(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function pf(e){return(e?e.ownerDocument:document).body.offsetHeight}function Rw(e,t,n){const r=e[Ii];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const mf=Symbol("_vod"),Mw=Symbol("_vsh"),$w=Symbol(""),Nw=/(?:^|;)\s*display\s*:/;function Lw(e,t,n){const r=e.style,a=un(n);let o=!1;if(n&&!a){if(t)if(un(t))for(const s of t.split(";")){const l=s.slice(0,s.indexOf(":")).trim();n[l]==null&&Cl(r,l,"")}else for(const s in t)n[s]==null&&Cl(r,s,"");for(const s in n)s==="display"&&(o=!0),Cl(r,s,n[s])}else if(a){if(t!==n){const s=r[$w];s&&(n+=";"+s),r.cssText=n,o=Nw.test(n)}}else t&&e.removeAttribute("style");mf in e&&(e[mf]=o?r.display:"",e[Mw]&&(r.display="none"))}const vf=/\s*!important$/;function Cl(e,t,n){if(st(n))n.forEach(r=>Cl(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=jw(e,t);vf.test(n)?e.setProperty(La(r),n.replace(vf,""),"important"):e[r]=n}}const gf=["Webkit","Moz","ms"],ju={};function jw(e,t){const n=ju[t];if(n)return n;let r=cr(t);if(r!=="filter"&&r in e)return ju[t]=r;r=Ul(r);for(let a=0;a<gf.length;a++){const o=gf[a]+r;if(o in e)return ju[t]=o}return t}const yf="http://www.w3.org/1999/xlink";function wf(e,t,n,r,a,o=Lg(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(yf,t.slice(6,t.length)):e.setAttributeNS(yf,t,n):n==null||o&&!Zh(n)?e.removeAttribute(t):e.setAttribute(t,o?"":To(n)?String(n):n)}function bf(e,t,n,r,a){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?am(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const l=o==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(l!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=Zh(n):n==null&&l==="string"?(n="",s=!0):l==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(a||t)}function Ra(e,t,n,r){e.addEventListener(t,n,r)}function Ow(e,t,n,r){e.removeEventListener(t,n,r)}const _f=Symbol("_vei");function Dw(e,t,n,r,a=null){const o=e[_f]||(e[_f]={}),s=o[t];if(r&&s)s.value=r;else{const[l,c]=Fw(t);if(r){const h=o[t]=qw(r,a);Ra(e,l,h,c)}else s&&(Ow(e,l,s,c),o[t]=void 0)}}const Tf=/(?:Once|Passive|Capture)$/;function Fw(e){let t;if(Tf.test(e)){t={};let r;for(;r=e.match(Tf);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):La(e.slice(2)),t]}let Ou=0;const Uw=Promise.resolve(),Bw=()=>Ou||(Uw.then(()=>Ou=0),Ou=Date.now());function qw(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Co(Hw(r,n.value),t,5,[r])};return n.value=e,n.attached=Bw(),n}function Hw(e,t){if(st(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>a=>!a._stopped&&r&&r(a))}else return t}const kf=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ww=(e,t,n,r,a,o)=>{const s=a==="svg";t==="class"?Rw(e,r,s):t==="style"?Lw(e,n,r):Ol(t)?Dl(t)||Dw(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Vw(e,t,r,s))?(bf(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&wf(e,t,r,s,o,t!=="value")):e._isVueCE&&(zw(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!un(r)))?bf(e,cr(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),wf(e,t,r,s))};function Vw(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&kf(t)&&ft(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const a=e.tagName;if(a==="IMG"||a==="VIDEO"||a==="CANVAS"||a==="SOURCE")return!1}return kf(t)&&un(n)?!1:t in e}function zw(e,t){const n=e._def.props;if(!n)return!1;const r=cr(t);return Array.isArray(n)?n.some(a=>cr(a)===r):Object.keys(n).some(a=>cr(a)===r)}const Ds=e=>{const t=e.props["onUpdate:modelValue"]||!1;return st(t)?n=>wl(t,n):t};function Gw(e){e.target.composing=!0}function Cf(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const da=Symbol("_assign");function Sf(e,t,n){return t&&(e=e.trim()),n&&(e=Bl(e)),e}const tn={created(e,{modifiers:{lazy:t,trim:n,number:r}},a){e[da]=Ds(a);const o=r||a.props&&a.props.type==="number";Ra(e,t?"change":"input",s=>{s.target.composing||e[da](Sf(e.value,n,o))}),(n||o)&&Ra(e,"change",()=>{e.value=Sf(e.value,n,o)}),t||(Ra(e,"compositionstart",Gw),Ra(e,"compositionend",Cf),Ra(e,"change",Cf))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:a,number:o}},s){if(e[da]=Ds(s),e.composing)return;const l=(o||e.type==="number")&&!/^0\d/.test(e.value)?Bl(e.value):e.value,c=t??"";if(l===c)return;const h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(r&&t===n||a&&e.value.trim()===c)||(e.value=c)}},Kw={deep:!0,created(e,t,n){e[da]=Ds(n),Ra(e,"change",()=>{const r=e._modelValue,a=Pi(e),o=e.checked,s=e[da];if(st(r)){const l=Dc(r,a),c=l!==-1;if(o&&!c)s(r.concat(a));else if(!o&&c){const h=[...r];h.splice(l,1),s(h)}}else if(Hs(r)){const l=new Set(r);o?l.add(a):l.delete(a),s(l)}else s(lm(e,o))})},mounted:xf,beforeUpdate(e,t,n){e[da]=Ds(n),xf(e,t,n)}};function xf(e,{value:t,oldValue:n},r){e._modelValue=t;let a;if(st(t))a=Dc(t,r.props.value)>-1;else if(Hs(t))a=t.has(r.props.value);else{if(t===n)return;a=Ws(t,lm(e,!0))}e.checked!==a&&(e.checked=a)}const Af={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const a=Hs(t);Ra(e,"change",()=>{const o=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?Bl(Pi(s)):Pi(s));e[da](e.multiple?a?new Set(o):o:o[0]),e._assigning=!0,Kt(()=>{e._assigning=!1})}),e[da]=Ds(r)},mounted(e,{value:t}){Ef(e,t)},beforeUpdate(e,t,n){e[da]=Ds(n)},updated(e,{value:t}){e._assigning||Ef(e,t)}};function Ef(e,t){const n=e.multiple,r=st(t);if(!(n&&!r&&!Hs(t))){for(let a=0,o=e.options.length;a<o;a++){const s=e.options[a],l=Pi(s);if(n)if(r){const c=typeof l;c==="string"||c==="number"?s.selected=t.some(h=>String(h)===String(l)):s.selected=Dc(t,l)>-1}else s.selected=t.has(l);else if(Ws(Pi(s),t)){e.selectedIndex!==a&&(e.selectedIndex=a);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Pi(e){return"_value"in e?e._value:e.value}function lm(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Yw=["ctrl","shift","alt","meta"],Qw={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)=>Yw.some(n=>e[`${n}Key`]&&!t.includes(n))},Ze=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((a,...o)=>{for(let s=0;s<t.length;s++){const l=Qw[t[s]];if(l&&l(a,t))return}return e(a,...o)}))},Jw={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},nn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(a=>{if(!("key"in a))return;const o=La(a.key);if(t.some(s=>s===o||Jw[s]===o))return e(a)}))},Xw=kn({patchProp:Ww},Cw);let If;function Zw(){return If||(If=ow(Xw))}const eb=((...e)=>{const t=Zw().createApp(...e),{mount:n}=t;return t.mount=r=>{const a=nb(r);if(!a)return;const o=t._component;!ft(o)&&!o.render&&!o.template&&(o.template=a.innerHTML),a.nodeType===1&&(a.textContent="");const s=n(a,!1,tb(a));return a instanceof Element&&(a.removeAttribute("v-cloak"),a.setAttribute("data-v-app","")),s},t});function tb(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function nb(e){return un(e)?document.querySelector(e):e}const rb="modulepreload",ob=function(e){return"/"+e},Pf={},cl=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let s=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=s(n.map(h=>{if(h=ob(h),h in Pf)return;Pf[h]=!0;const f=h.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const T=document.createElement("link");if(T.rel=f?"stylesheet":rb,f||(T.as="script"),T.crossOrigin="",T.href=h,c&&T.setAttribute("nonce",c),document.head.appendChild(T),f)return new Promise((I,j)=>{T.addEventListener("load",I),T.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return a.then(s=>{for(const l of s||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})};/*!
|
|
19
|
+
* vue-router v4.6.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/const _s=typeof document<"u";function um(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function ab(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&um(e.default)}const Pt=Object.assign;function Du(e,t){const n={};for(const r in t){const a=t[r];n[r]=So(a)?a.map(e):e(a)}return n}const _i=()=>{},So=Array.isArray;function Rf(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const cm=/#/g,sb=/&/g,ib=/\//g,lb=/=/g,ub=/\?/g,dm=/\+/g,cb=/%5B/g,db=/%5D/g,fm=/%5E/g,fb=/%60/g,hm=/%7B/g,hb=/%7C/g,pm=/%7D/g,pb=/%20/g;function td(e){return e==null?"":encodeURI(""+e).replace(hb,"|").replace(cb,"[").replace(db,"]")}function mb(e){return td(e).replace(hm,"{").replace(pm,"}").replace(fm,"^")}function yc(e){return td(e).replace(dm,"%2B").replace(pb,"+").replace(cm,"%23").replace(sb,"%26").replace(fb,"`").replace(hm,"{").replace(pm,"}").replace(fm,"^")}function vb(e){return yc(e).replace(lb,"%3D")}function gb(e){return td(e).replace(cm,"%23").replace(ub,"%3F")}function yb(e){return gb(e).replace(ib,"%2F")}function Ri(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const wb=/\/$/,bb=e=>e.replace(wb,"");function Fu(e,t,n="/"){let r,a={},o="",s="";const l=t.indexOf("#");let c=t.indexOf("?");return c=l>=0&&c>l?-1:c,c>=0&&(r=t.slice(0,c),o=t.slice(c,l>0?l:t.length),a=e(o.slice(1))),l>=0&&(r=r||t.slice(0,l),s=t.slice(l,t.length)),r=Cb(r??t,n),{fullPath:r+o+s,path:r,query:a,hash:Ri(s)}}function _b(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Mf(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Tb(e,t,n){const r=t.matched.length-1,a=n.matched.length-1;return r>-1&&r===a&&Fs(t.matched[r],n.matched[a])&&mm(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Fs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function mm(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!kb(e[n],t[n]))return!1;return!0}function kb(e,t){return So(e)?$f(e,t):So(t)?$f(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function $f(e,t){return So(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Cb(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),a=r[r.length-1];(a===".."||a===".")&&r.push("");let o=n.length-1,s,l;for(s=0;s<r.length;s++)if(l=r[s],l!==".")if(l==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(s).join("/")}const xa={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let wc=(function(e){return e.pop="pop",e.push="push",e})({}),Uu=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Sb(e){if(!e)if(_s){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),bb(e)}const xb=/^[^#]+#/;function Ab(e,t){return e.replace(xb,"#")+t}function Eb(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 Ql=()=>({left:window.scrollX,top:window.scrollY});function Ib(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),a=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!a)return;t=Eb(a,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 Nf(e,t){return(history.state?history.state.position-t:-1)+e}const bc=new Map;function Pb(e,t){bc.set(e,t)}function Rb(e){const t=bc.get(e);return bc.delete(e),t}function Mb(e){return typeof e=="string"||e&&typeof e=="object"}function vm(e){return typeof e=="string"||typeof e=="symbol"}let hn=(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 gm=Symbol("");hn.MATCHER_NOT_FOUND+"",hn.NAVIGATION_GUARD_REDIRECT+"",hn.NAVIGATION_ABORTED+"",hn.NAVIGATION_CANCELLED+"",hn.NAVIGATION_DUPLICATED+"";function Us(e,t){return Pt(new Error,{type:e,[gm]:!0},t)}function aa(e,t){return e instanceof Error&&gm in e&&(t==null||!!(e.type&t))}const $b=["params","query","hash"];function Nb(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of $b)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Lb(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 a=n[r].replace(dm," "),o=a.indexOf("="),s=Ri(o<0?a:a.slice(0,o)),l=o<0?null:Ri(a.slice(o+1));if(s in t){let c=t[s];So(c)||(c=t[s]=[c]),c.push(l)}else t[s]=l}return t}function Lf(e){let t="";for(let n in e){const r=e[n];if(n=vb(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(So(r)?r.map(a=>a&&yc(a)):[r&&yc(r)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function jb(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=So(r)?r.map(a=>a==null?null:""+a):r==null?r:""+r)}return t}const Ob=Symbol(""),jf=Symbol(""),Jl=Symbol(""),nd=Symbol(""),_c=Symbol("");function ui(){let e=[];function t(r){return e.push(r),()=>{const a=e.indexOf(r);a>-1&&e.splice(a,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Ia(e,t,n,r,a,o=s=>s()){const s=r&&(r.enterCallbacks[a]=r.enterCallbacks[a]||[]);return()=>new Promise((l,c)=>{const h=T=>{T===!1?c(Us(hn.NAVIGATION_ABORTED,{from:n,to:t})):T instanceof Error?c(T):Mb(T)?c(Us(hn.NAVIGATION_GUARD_REDIRECT,{from:t,to:T})):(s&&r.enterCallbacks[a]===s&&typeof T=="function"&&s.push(T),l())},f=o(()=>e.call(r&&r.instances[a],t,n,h));let g=Promise.resolve(f);e.length<3&&(g=g.then(h)),g.catch(T=>c(T))})}function Bu(e,t,n,r,a=o=>o()){const o=[];for(const s of e)for(const l in s.components){let c=s.components[l];if(!(t!=="beforeRouteEnter"&&!s.instances[l]))if(um(c)){const h=(c.__vccOpts||c)[t];h&&o.push(Ia(h,n,r,s,l,a))}else{let h=c();o.push(()=>h.then(f=>{if(!f)throw new Error(`Couldn't resolve component "${l}" at "${s.path}"`);const g=ab(f)?f.default:f;s.mods[l]=f,s.components[l]=g;const T=(g.__vccOpts||g)[t];return T&&Ia(T,n,r,s,l,a)()}))}}return o}function Db(e,t){const n=[],r=[],a=[],o=Math.max(t.matched.length,e.matched.length);for(let s=0;s<o;s++){const l=t.matched[s];l&&(e.matched.find(h=>Fs(h,l))?r.push(l):n.push(l));const c=e.matched[s];c&&(t.matched.find(h=>Fs(h,c))||a.push(c))}return[n,r,a]}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/let Fb=()=>location.protocol+"//"+location.host;function ym(e,t){const{pathname:n,search:r,hash:a}=t,o=e.indexOf("#");if(o>-1){let s=a.includes(e.slice(o))?e.slice(o).length:1,l=a.slice(s);return l[0]!=="/"&&(l="/"+l),Mf(l,"")}return Mf(n,e)+r+a}function Ub(e,t,n,r){let a=[],o=[],s=null;const l=({state:T})=>{const I=ym(e,location),j=n.value,B=t.value;let X=0;if(T){if(n.value=I,t.value=T,s&&s===j){s=null;return}X=B?T.position-B.position:0}else r(I);a.forEach(U=>{U(n.value,j,{delta:X,type:wc.pop,direction:X?X>0?Uu.forward:Uu.back:Uu.unknown})})};function c(){s=n.value}function h(T){a.push(T);const I=()=>{const j=a.indexOf(T);j>-1&&a.splice(j,1)};return o.push(I),I}function f(){if(document.visibilityState==="hidden"){const{history:T}=window;if(!T.state)return;T.replaceState(Pt({},T.state,{scroll:Ql()}),"")}}function g(){for(const T of o)T();o=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",f),document.addEventListener("visibilitychange",f),{pauseListeners:c,listen:h,destroy:g}}function Of(e,t,n,r=!1,a=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:a?Ql():null}}function Bb(e){const{history:t,location:n}=window,r={value:ym(e,n)},a={value:t.state};a.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(c,h,f){const g=e.indexOf("#"),T=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+c:Fb()+e+c;try{t[f?"replaceState":"pushState"](h,"",T),a.value=h}catch(I){console.error(I),n[f?"replace":"assign"](T)}}function s(c,h){o(c,Pt({},t.state,Of(a.value.back,c,a.value.forward,!0),h,{position:a.value.position}),!0),r.value=c}function l(c,h){const f=Pt({},a.value,t.state,{forward:c,scroll:Ql()});o(f.current,f,!0),o(c,Pt({},Of(r.value,c,null),{position:f.position+1},h),!1),r.value=c}return{location:r,state:a,push:l,replace:s}}function qb(e){e=Sb(e);const t=Bb(e),n=Ub(e,t.state,t.location,t.replace);function r(o,s=!0){s||n.pauseListeners(),history.go(o)}const a=Pt({location:"",base:e,go:r,createHref:Ab.bind(null,e)},t,n);return Object.defineProperty(a,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(a,"state",{enumerable:!0,get:()=>t.state.value}),a}function Hb(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),qb(e)}let rs=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var _n=(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})(_n||{});const Wb={type:rs.Static,value:""},Vb=/[a-zA-Z0-9_]/;function zb(e){if(!e)return[[]];if(e==="/")return[[Wb]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(I){throw new Error(`ERR (${n})/"${h}": ${I}`)}let n=_n.Static,r=n;const a=[];let o;function s(){o&&a.push(o),o=[]}let l=0,c,h="",f="";function g(){h&&(n===_n.Static?o.push({type:rs.Static,value:h}):n===_n.Param||n===_n.ParamRegExp||n===_n.ParamRegExpEnd?(o.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${h}) must be alone in its segment. eg: '/:ids+.`),o.push({type:rs.Param,value:h,regexp:f,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),h="")}function T(){h+=c}for(;l<e.length;){if(c=e[l++],c==="\\"&&n!==_n.ParamRegExp){r=n,n=_n.EscapeNext;continue}switch(n){case _n.Static:c==="/"?(h&&g(),s()):c===":"?(g(),n=_n.Param):T();break;case _n.EscapeNext:T(),n=r;break;case _n.Param:c==="("?n=_n.ParamRegExp:Vb.test(c)?T():(g(),n=_n.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--);break;case _n.ParamRegExp:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=_n.ParamRegExpEnd:f+=c;break;case _n.ParamRegExpEnd:g(),n=_n.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--,f="";break;default:t("Unknown state");break}}return n===_n.ParamRegExp&&t(`Unfinished custom RegExp for param "${h}"`),g(),s(),a}const Df="[^/]+?",Gb={sensitive:!1,strict:!1,start:!0,end:!0};var ir=(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})(ir||{});const Kb=/[.+*?^${}()[\]/\\]/g;function Yb(e,t){const n=Pt({},Gb,t),r=[];let a=n.start?"^":"";const o=[];for(const h of e){const f=h.length?[]:[ir.Root];n.strict&&!h.length&&(a+="/");for(let g=0;g<h.length;g++){const T=h[g];let I=ir.Segment+(n.sensitive?ir.BonusCaseSensitive:0);if(T.type===rs.Static)g||(a+="/"),a+=T.value.replace(Kb,"\\$&"),I+=ir.Static;else if(T.type===rs.Param){const{value:j,repeatable:B,optional:X,regexp:U}=T;o.push({name:j,repeatable:B,optional:X});const O=U||Df;if(O!==Df){I+=ir.BonusCustomRegExp;try{`${O}`}catch(ee){throw new Error(`Invalid custom RegExp for param "${j}" (${O}): `+ee.message)}}let G=B?`((?:${O})(?:/(?:${O}))*)`:`(${O})`;g||(G=X&&h.length<2?`(?:/${G})`:"/"+G),X&&(G+="?"),a+=G,I+=ir.Dynamic,X&&(I+=ir.BonusOptional),B&&(I+=ir.BonusRepeatable),O===".*"&&(I+=ir.BonusWildcard)}f.push(I)}r.push(f)}if(n.strict&&n.end){const h=r.length-1;r[h][r[h].length-1]+=ir.BonusStrict}n.strict||(a+="/?"),n.end?a+="$":n.strict&&!a.endsWith("/")&&(a+="(?:/|$)");const s=new RegExp(a,n.sensitive?"":"i");function l(h){const f=h.match(s),g={};if(!f)return null;for(let T=1;T<f.length;T++){const I=f[T]||"",j=o[T-1];g[j.name]=I&&j.repeatable?I.split("/"):I}return g}function c(h){let f="",g=!1;for(const T of e){(!g||!f.endsWith("/"))&&(f+="/"),g=!1;for(const I of T)if(I.type===rs.Static)f+=I.value;else if(I.type===rs.Param){const{value:j,repeatable:B,optional:X}=I,U=j in h?h[j]:"";if(So(U)&&!B)throw new Error(`Provided param "${j}" is an array but it is not repeatable (* or + modifiers)`);const O=So(U)?U.join("/"):U;if(!O)if(X)T.length<2&&(f.endsWith("/")?f=f.slice(0,-1):g=!0);else throw new Error(`Missing required param "${j}"`);f+=O}}return f||"/"}return{re:s,score:r,keys:o,parse:l,stringify:c}}function Qb(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]===ir.Static+ir.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===ir.Static+ir.Segment?1:-1:0}function wm(e,t){let n=0;const r=e.score,a=t.score;for(;n<r.length&&n<a.length;){const o=Qb(r[n],a[n]);if(o)return o;n++}if(Math.abs(a.length-r.length)===1){if(Ff(r))return 1;if(Ff(a))return-1}return a.length-r.length}function Ff(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Jb={strict:!1,end:!0,sensitive:!1};function Xb(e,t,n){const r=Yb(zb(e.path),n),a=Pt(r,{record:e,parent:t,children:[],alias:[]});return t&&!a.record.aliasOf==!t.record.aliasOf&&t.children.push(a),a}function Zb(e,t){const n=[],r=new Map;t=Rf(Jb,t);function a(g){return r.get(g)}function o(g,T,I){const j=!I,B=Bf(g);B.aliasOf=I&&I.record;const X=Rf(t,g),U=[B];if("alias"in g){const ee=typeof g.alias=="string"?[g.alias]:g.alias;for(const be of ee)U.push(Bf(Pt({},B,{components:I?I.record.components:B.components,path:be,aliasOf:I?I.record:B})))}let O,G;for(const ee of U){const{path:be}=ee;if(T&&be[0]!=="/"){const pe=T.record.path,Te=pe[pe.length-1]==="/"?"":"/";ee.path=T.record.path+(be&&Te+be)}if(O=Xb(ee,T,X),I?I.alias.push(O):(G=G||O,G!==O&&G.alias.push(O),j&&g.name&&!qf(O)&&s(g.name)),bm(O)&&c(O),B.children){const pe=B.children;for(let Te=0;Te<pe.length;Te++)o(pe[Te],O,I&&I.children[Te])}I=I||O}return G?()=>{s(G)}:_i}function s(g){if(vm(g)){const T=r.get(g);T&&(r.delete(g),n.splice(n.indexOf(T),1),T.children.forEach(s),T.alias.forEach(s))}else{const T=n.indexOf(g);T>-1&&(n.splice(T,1),g.record.name&&r.delete(g.record.name),g.children.forEach(s),g.alias.forEach(s))}}function l(){return n}function c(g){const T=n0(g,n);n.splice(T,0,g),g.record.name&&!qf(g)&&r.set(g.record.name,g)}function h(g,T){let I,j={},B,X;if("name"in g&&g.name){if(I=r.get(g.name),!I)throw Us(hn.MATCHER_NOT_FOUND,{location:g});X=I.record.name,j=Pt(Uf(T.params,I.keys.filter(G=>!G.optional).concat(I.parent?I.parent.keys.filter(G=>G.optional):[]).map(G=>G.name)),g.params&&Uf(g.params,I.keys.map(G=>G.name))),B=I.stringify(j)}else if(g.path!=null)B=g.path,I=n.find(G=>G.re.test(B)),I&&(j=I.parse(B),X=I.record.name);else{if(I=T.name?r.get(T.name):n.find(G=>G.re.test(T.path)),!I)throw Us(hn.MATCHER_NOT_FOUND,{location:g,currentLocation:T});X=I.record.name,j=Pt({},T.params,g.params),B=I.stringify(j)}const U=[];let O=I;for(;O;)U.unshift(O.record),O=O.parent;return{name:X,path:B,params:j,matched:U,meta:t0(U)}}e.forEach(g=>o(g));function f(){n.length=0,r.clear()}return{addRoute:o,resolve:h,removeRoute:s,clearRoutes:f,getRoutes:l,getRecordMatcher:a}}function Uf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Bf(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:e0(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 e0(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 qf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function t0(e){return e.reduce((t,n)=>Pt(t,n.meta),{})}function n0(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;wm(e,t[o])<0?r=o:n=o+1}const a=r0(e);return a&&(r=t.lastIndexOf(a,r-1)),r}function r0(e){let t=e;for(;t=t.parent;)if(bm(t)&&wm(e,t)===0)return t}function bm({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Hf(e){const t=_o(Jl),n=_o(nd),r=Z(()=>{const c=S(e.to);return t.resolve(c)}),a=Z(()=>{const{matched:c}=r.value,{length:h}=c,f=c[h-1],g=n.matched;if(!f||!g.length)return-1;const T=g.findIndex(Fs.bind(null,f));if(T>-1)return T;const I=Wf(c[h-2]);return h>1&&Wf(f)===I&&g[g.length-1].path!==I?g.findIndex(Fs.bind(null,c[h-2])):T}),o=Z(()=>a.value>-1&&l0(n.params,r.value.params)),s=Z(()=>a.value>-1&&a.value===n.matched.length-1&&mm(n.params,r.value.params));function l(c={}){if(i0(c)){const h=t[S(e.replace)?"replace":"push"](S(e.to)).catch(_i);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>h),h}return Promise.resolve()}return{route:r,href:Z(()=>r.value.href),isActive:o,isExactActive:s,navigate:l}}function o0(e){return e.length===1?e[0]:e}const a0=Fn({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:Hf,setup(e,{slots:t}){const n=Wl(Hf(e)),{options:r}=_o(Jl),a=Z(()=>({[Vf(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Vf(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&o0(t.default(n));return e.custom?o:ed("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:a.value},o)}}}),s0=a0;function i0(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 l0(e,t){for(const n in t){const r=t[n],a=e[n];if(typeof r=="string"){if(r!==a)return!1}else if(!So(a)||a.length!==r.length||r.some((o,s)=>o.valueOf()!==a[s].valueOf()))return!1}return!0}function Wf(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Vf=(e,t,n)=>e??t??n,u0=Fn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=_o(_c),a=Z(()=>e.route||r.value),o=_o(jf,0),s=Z(()=>{let h=S(o);const{matched:f}=a.value;let g;for(;(g=f[h])&&!g.components;)h++;return h}),l=Z(()=>a.value.matched[s.value]);bl(jf,Z(()=>s.value+1)),bl(Ob,l),bl(_c,a);const c=x();return pt(()=>[c.value,l.value,e.name],([h,f,g],[T,I,j])=>{f&&(f.instances[g]=h,I&&I!==f&&h&&h===T&&(f.leaveGuards.size||(f.leaveGuards=I.leaveGuards),f.updateGuards.size||(f.updateGuards=I.updateGuards))),h&&f&&(!I||!Fs(f,I)||!T)&&(f.enterCallbacks[g]||[]).forEach(B=>B(h))},{flush:"post"}),()=>{const h=a.value,f=e.name,g=l.value,T=g&&g.components[f];if(!T)return zf(n.default,{Component:T,route:h});const I=g.props[f],j=I?I===!0?h.params:typeof I=="function"?I(h):I:null,X=ed(T,Pt({},j,t,{onVnodeUnmounted:U=>{U.component.isUnmounted&&(g.instances[f]=null)},ref:c}));return zf(n.default,{Component:X,route:h})||X}}});function zf(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const c0=u0;function d0(e){const t=Zb(e.routes,e),n=e.parseQuery||Lb,r=e.stringifyQuery||Lf,a=e.history,o=ui(),s=ui(),l=ui(),c=oy(xa);let h=xa;_s&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=Du.bind(null,Q=>""+Q),g=Du.bind(null,yb),T=Du.bind(null,Ri);function I(Q,Ee){let ve,Oe;return vm(Q)?(ve=t.getRecordMatcher(Q),Oe=Ee):Oe=Q,t.addRoute(Oe,ve)}function j(Q){const Ee=t.getRecordMatcher(Q);Ee&&t.removeRoute(Ee)}function B(){return t.getRoutes().map(Q=>Q.record)}function X(Q){return!!t.getRecordMatcher(Q)}function U(Q,Ee){if(Ee=Pt({},Ee||c.value),typeof Q=="string"){const V=Fu(n,Q,Ee.path),ne=t.resolve({path:V.path},Ee),le=a.createHref(V.fullPath);return Pt(V,ne,{params:T(ne.params),hash:Ri(V.hash),redirectedFrom:void 0,href:le})}let ve;if(Q.path!=null)ve=Pt({},Q,{path:Fu(n,Q.path,Ee.path).path});else{const V=Pt({},Q.params);for(const ne in V)V[ne]==null&&delete V[ne];ve=Pt({},Q,{params:g(V)}),Ee.params=g(Ee.params)}const Oe=t.resolve(ve,Ee),We=Q.hash||"";Oe.params=f(T(Oe.params));const A=_b(r,Pt({},Q,{hash:mb(We),path:Oe.path})),$=a.createHref(A);return Pt({fullPath:A,hash:We,query:r===Lf?jb(Q.query):Q.query||{}},Oe,{redirectedFrom:void 0,href:$})}function O(Q){return typeof Q=="string"?Fu(n,Q,c.value.path):Pt({},Q)}function G(Q,Ee){if(h!==Q)return Us(hn.NAVIGATION_CANCELLED,{from:Ee,to:Q})}function ee(Q){return Te(Q)}function be(Q){return ee(Pt(O(Q),{replace:!0}))}function pe(Q,Ee){const ve=Q.matched[Q.matched.length-1];if(ve&&ve.redirect){const{redirect:Oe}=ve;let We=typeof Oe=="function"?Oe(Q,Ee):Oe;return typeof We=="string"&&(We=We.includes("?")||We.includes("#")?We=O(We):{path:We},We.params={}),Pt({query:Q.query,hash:Q.hash,params:We.path!=null?{}:Q.params},We)}}function Te(Q,Ee){const ve=h=U(Q),Oe=c.value,We=Q.state,A=Q.force,$=Q.replace===!0,V=pe(ve,Oe);if(V)return Te(Pt(O(V),{state:typeof V=="object"?Pt({},We,V.state):We,force:A,replace:$}),Ee||ve);const ne=ve;ne.redirectedFrom=Ee;let le;return!A&&Tb(r,Oe,ve)&&(le=Us(hn.NAVIGATION_DUPLICATED,{to:ne,from:Oe}),Je(Oe,Oe,!0,!1)),(le?Promise.resolve(le):ge(ne,Oe)).catch(ae=>aa(ae)?aa(ae,hn.NAVIGATION_GUARD_REDIRECT)?ae:Ge(ae):Le(ae,ne,Oe)).then(ae=>{if(ae){if(aa(ae,hn.NAVIGATION_GUARD_REDIRECT))return Te(Pt({replace:$},O(ae.to),{state:typeof ae.to=="object"?Pt({},We,ae.to.state):We,force:A}),Ee||ne)}else ae=oe(ne,Oe,!0,$,We);return ke(ne,Oe,ae),ae})}function Pe(Q,Ee){const ve=G(Q,Ee);return ve?Promise.reject(ve):Promise.resolve()}function K(Q){const Ee=qe.values().next().value;return Ee&&typeof Ee.runWithContext=="function"?Ee.runWithContext(Q):Q()}function ge(Q,Ee){let ve;const[Oe,We,A]=Db(Q,Ee);ve=Bu(Oe.reverse(),"beforeRouteLeave",Q,Ee);for(const V of Oe)V.leaveGuards.forEach(ne=>{ve.push(Ia(ne,Q,Ee))});const $=Pe.bind(null,Q,Ee);return ve.push($),nt(ve).then(()=>{ve=[];for(const V of o.list())ve.push(Ia(V,Q,Ee));return ve.push($),nt(ve)}).then(()=>{ve=Bu(We,"beforeRouteUpdate",Q,Ee);for(const V of We)V.updateGuards.forEach(ne=>{ve.push(Ia(ne,Q,Ee))});return ve.push($),nt(ve)}).then(()=>{ve=[];for(const V of A)if(V.beforeEnter)if(So(V.beforeEnter))for(const ne of V.beforeEnter)ve.push(Ia(ne,Q,Ee));else ve.push(Ia(V.beforeEnter,Q,Ee));return ve.push($),nt(ve)}).then(()=>(Q.matched.forEach(V=>V.enterCallbacks={}),ve=Bu(A,"beforeRouteEnter",Q,Ee,K),ve.push($),nt(ve))).then(()=>{ve=[];for(const V of s.list())ve.push(Ia(V,Q,Ee));return ve.push($),nt(ve)}).catch(V=>aa(V,hn.NAVIGATION_CANCELLED)?V:Promise.reject(V))}function ke(Q,Ee,ve){l.list().forEach(Oe=>K(()=>Oe(Q,Ee,ve)))}function oe(Q,Ee,ve,Oe,We){const A=G(Q,Ee);if(A)return A;const $=Ee===xa,V=_s?history.state:{};ve&&(Oe||$?a.replace(Q.fullPath,Pt({scroll:$&&V&&V.scroll},We)):a.push(Q.fullPath,We)),c.value=Q,Je(Q,Ee,ve,$),Ge()}let Re;function ze(){Re||(Re=a.listen((Q,Ee,ve)=>{if(!Xe.listening)return;const Oe=U(Q),We=pe(Oe,Xe.currentRoute.value);if(We){Te(Pt(We,{replace:!0,force:!0}),Oe).catch(_i);return}h=Oe;const A=c.value;_s&&Pb(Nf(A.fullPath,ve.delta),Ql()),ge(Oe,A).catch($=>aa($,hn.NAVIGATION_ABORTED|hn.NAVIGATION_CANCELLED)?$:aa($,hn.NAVIGATION_GUARD_REDIRECT)?(Te(Pt(O($.to),{force:!0}),Oe).then(V=>{aa(V,hn.NAVIGATION_ABORTED|hn.NAVIGATION_DUPLICATED)&&!ve.delta&&ve.type===wc.pop&&a.go(-1,!1)}).catch(_i),Promise.reject()):(ve.delta&&a.go(-ve.delta,!1),Le($,Oe,A))).then($=>{$=$||oe(Oe,A,!1),$&&(ve.delta&&!aa($,hn.NAVIGATION_CANCELLED)?a.go(-ve.delta,!1):ve.type===wc.pop&&aa($,hn.NAVIGATION_ABORTED|hn.NAVIGATION_DUPLICATED)&&a.go(-1,!1)),ke(Oe,A,$)}).catch(_i)}))}let He=ui(),Ne=ui(),Fe;function Le(Q,Ee,ve){Ge(Q);const Oe=Ne.list();return Oe.length?Oe.forEach(We=>We(Q,Ee,ve)):console.error(Q),Promise.reject(Q)}function et(){return Fe&&c.value!==xa?Promise.resolve():new Promise((Q,Ee)=>{He.add([Q,Ee])})}function Ge(Q){return Fe||(Fe=!Q,ze(),He.list().forEach(([Ee,ve])=>Q?ve(Q):Ee()),He.reset()),Q}function Je(Q,Ee,ve,Oe){const{scrollBehavior:We}=e;if(!_s||!We)return Promise.resolve();const A=!ve&&Rb(Nf(Q.fullPath,0))||(Oe||!ve)&&history.state&&history.state.scroll||null;return Kt().then(()=>We(Q,Ee,A)).then($=>$&&Ib($)).catch($=>Le($,Q,Ee))}const Ke=Q=>a.go(Q);let it;const qe=new Set,Xe={currentRoute:c,listening:!0,addRoute:I,removeRoute:j,clearRoutes:t.clearRoutes,hasRoute:X,getRoutes:B,resolve:U,options:e,push:ee,replace:be,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:o.add,beforeResolve:s.add,afterEach:l.add,onError:Ne.add,isReady:et,install(Q){Q.component("RouterLink",s0),Q.component("RouterView",c0),Q.config.globalProperties.$router=Xe,Object.defineProperty(Q.config.globalProperties,"$route",{enumerable:!0,get:()=>S(c)}),_s&&!it&&c.value===xa&&(it=!0,ee(a.location).catch(Oe=>{}));const Ee={};for(const Oe in xa)Object.defineProperty(Ee,Oe,{get:()=>c.value[Oe],enumerable:!0});Q.provide(Jl,Xe),Q.provide(nd,vp(Ee)),Q.provide(_c,c);const ve=Q.unmount;qe.add(Q),Q.unmount=function(){qe.delete(Q),qe.size<1&&(h=xa,Re&&Re(),Re=null,c.value=xa,it=!1,Fe=!1),ve()}}};function nt(Q){return Q.reduce((Ee,ve)=>Ee.then(()=>K(ve)),Promise.resolve())}return Xe}function f0(){return _o(Jl)}function h0(e){return _o(nd)}const Gf=768;function rd(){const e=x(typeof window<"u"?window.innerWidth<Gf:!1);let t=null;function n(r){e.value=r.matches}return va(()=>{t=window.matchMedia(`(max-width: ${Gf-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),zl(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const p0={key:0,class:"desktop-sidebar"},m0={class:"desktop-main"},Kf="codex-web-local.sidebar-width.v1",v0=260,g0=620,Yf=320,y0=Fn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=rd();function r(h){return Math.min(g0,Math.max(v0,h))}function a(){if(typeof window>"u")return Yf;const h=window.localStorage.getItem(Kf),f=Number(h);return Number.isFinite(f)?r(f):Yf}const o=x(a()),s=Z(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function l(h){typeof window>"u"||window.localStorage.setItem(Kf,String(h))}function c(h){h.preventDefault();const f=h.clientX,g=o.value,T=j=>{const B=j.clientX-f;o.value=r(g+B)},I=()=>{l(o.value),window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",I)}return(h,f)=>(k(),E("div",{class:rt(["desktop-layout",{"is-mobile":S(n)}]),style:ca(s.value)},[S(n)?(k(),at(Ma,{key:0,to:"body"},[Be(im,{name:"drawer"},{default:mt(()=>[e.isSidebarCollapsed?J("",!0):(k(),E("div",{key:0,class:"mobile-drawer-backdrop",onClick:f[1]||(f[1]=g=>h.$emit("close-sidebar"))},[m("aside",{class:"mobile-drawer",onClick:f[0]||(f[0]=Ze(()=>{},["stop"]))},[Ho(h.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):J("",!0),S(n)?J("",!0):(k(),E(Qe,{key:1},[e.isSidebarCollapsed?J("",!0):(k(),E("aside",p0,[Ho(h.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?J("",!0):(k(),E("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:c},null,32))],64)),m("section",m0,[Ho(h.$slots,"content",{},void 0)])],6))}}),xt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,a]of t)n[r]=a;return n},w0=xt(y0,[["__scopeId","data-v-4c6dbcd7"]]);function Qf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Vo extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function ga(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Qf(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const a=Qf(r);return a&&typeof a.message=="string"&&a.message.length>0?a.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function xo(e,t,n){return e instanceof Vo?e:e instanceof Error?new Vo(e.message||t,{code:"unknown_error",method:n}):new Vo(t,{code:"unknown_error",method:n})}function _m(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function b0(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(l){throw new Vo(l instanceof Error?l.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let a=null,o=null;try{o=await r.text(),a=JSON.parse(o)}catch{a=null}if(!r.ok){const l=ga(a,"")||(o==null?void 0:o.slice(0,500))||"",c=`RPC ${e} failed with HTTP ${r.status}`;throw new Vo(l?`${c}: ${l}`:c,{code:"http_error",method:e,status:r.status})}const s=a;if(!s||typeof s!="object"||!("result"in s))throw new Vo(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function _0(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Vo(ga(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 T0(e){const t=_m(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 Jf(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function k0(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const a=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(h,f)=>{if(n||r!==null)return;const g=Math.min(1e3*2**f,1e4);r=window.setTimeout(()=>{r=null,!n&&h()},g)},s=h=>{const f=T0(h);f&&e(f)},l=(h=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const f=new EventSource("/codex-api/events");let g=!1;f.onmessage=T=>{try{s(JSON.parse(T.data))}catch{}},f.addEventListener("ready",T=>{try{const I=T.data?JSON.parse(T.data):{ok:!0};Jf(e,I)}catch{Jf(e)}}),f.onerror=()=>{n||g||f.readyState===EventSource.CLOSED&&(g=!0,f.close(),o(()=>l(h+1),h))},t=()=>{g=!0,f.close()}},c=(h=0)=>{if(typeof WebSocket>"u"||n){l();return}t==null||t();const f=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${f}//${window.location.host}/codex-api/ws`);let T=!1,I=!1,j=window.setTimeout(()=>{T||n||I||(I=!0,g.close(),l())},2500);g.onopen=()=>{T=!0,a(),j!==null&&(window.clearTimeout(j),j=null)},g.onmessage=B=>{try{s(JSON.parse(String(B.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(j!==null&&(window.clearTimeout(j),j=null),!(n||I)){if(!T){l();return}o(()=>c(h+1),h)}},t=()=>{I=!0,j!==null&&(window.clearTimeout(j),j=null),g.close()}};return typeof WebSocket<"u"?c():l(),()=>{n=!0,a(),t==null||t()}}async function C0(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 Vo(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 Vo(ga(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function S0(){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 Vo(ga(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=_m(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function x0(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function ut(e){return x0(e)}function A0(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function E0(e){const t=ut(e).replace(/[\\/]+/gu,"/");return A0(t)?t.toLowerCase():t}function Mr(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 $s(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 Qr(e){return Mr(e)||ut(e)||"Projectless"}function Nl(e){const t=ut(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function Xf(e){return new Date(e*1e3).toISOString()}function I0(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const P0=/^##\s+(.+?):\s+(.+?)\s*$/,R0=/^#\s*files mentioned by the user\s*:?\s*$/i;function M0(e){var a,o;const t=e.split(`
|
|
27
|
+
`).findIndex(s=>R0.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
+
`).slice(t+1),r=[];for(const s of n){const l=s.trim();if(!l)continue;const c=l.match(P0);if(!c)break;const h=(a=c[1])==null?void 0:a.trim(),f=(o=c[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");h&&f&&r.push({label:h,path:f})}return r}function $0(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 a=r.index+r[0].length;return e.slice(a).trim()}function Tm(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function N0(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 L0(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function qu(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?L0(n[1].trim()):""}function j0(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=qu(t,"current_time_iso"),r=qu(t,"instructions");return!n||!r?null:{automationId:qu(t,"automation_id"),currentTimeIso:n,instructions:r}}function O0(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],a=[],o=[];for(const[h,f]of t.entries()){if(f.type==="text"&&typeof f.text=="string"&&f.text.length>0&&n.push(f.text),f.type==="image"&&typeof f.url=="string"&&f.url.trim().length>0&&r.push(f.url.trim()),f.type==="localImage"&&typeof f.path=="string"&&f.path.trim().length>0&&r.push(Tm(f.path.trim())),f.type==="skill"){const g=typeof f.name=="string"?f.name.trim():"",T=typeof f.path=="string"?f.path.trim():"";g&&T&&a.push({name:g,path:T})}f.type!=="text"&&f.type!=="image"&&f.type!=="localImage"&&f.type!=="skill"&&o.push({id:`${e}:user-content:${h}`,role:"user",text:"",messageType:`userContent.${f.type}`,rawPayload:I0(f),isUnhandled:!0})}const s=n.join(`
|
|
29
|
+
`),l=M0(s),c=j0(s);return{text:(c==null?void 0:c.instructions)??$0(s),images:r,skills:a,fileAttachments:l,rawBlocks:o,isAutomationRun:c!==null,automationDisplayName:(c==null?void 0:c.automationId)||null}}function D0(e){var o;const t=e.replace(/\r\n/g,`
|
|
30
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
+
`),r=[],a=[];for(const s of n){const l=s.trim();if(!l){r.length===0&&a.push("");continue}const c=l.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(c){const h=(c[1]??" ").toLowerCase(),f=(o=c[2])==null?void 0:o.trim();if(!f)continue;let g="pending";h==="x"&&(g="completed"),(h==="~"||h===">"||h==="-")&&(g="inProgress"),r.push({step:f,status:g});continue}a.push(l)}return r.length===0?null:{explanation:a.join(`
|
|
32
|
+
`).trim()||void 0,steps:r}}function Zf(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 F0(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 km(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Cm(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const a=r,o=typeof a.path=="string"?a.path:"",s=typeof a.diff=="string"?a.diff:"",l=a.kind,c=l==null?void 0:l.type;if(!o||c!=="add"&&c!=="delete"&&c!=="update")continue;const h=c==="update"&&typeof(l==null?void 0:l.move_path)=="string"?l.move_path:null,f=c==="update"?F0(s):c==="add"?{addedLineCount:Zf(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:Zf(s)};n.push({path:o,operation:c,movedToPath:h,diff:s,...f})}return n}function U0(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=O0(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:[Tm(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?N0(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:D0(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=B0(t.status),r=typeof t.command=="string"?t.command:"",a=typeof t.cwd=="string"?t.cwd:null,o=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:a,status:n,aggregatedOutput:o,exitCode:s}}]}if(e.type==="fileChange"){const t=Cm(e.changes),n=km(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return[]}function B0(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function q0(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 H0(e){const t=q0(e);return t.length>0?t:"Untitled thread"}function od(e){return(e==null?void 0:e.status)==="inProgress"}function W0(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return od(r)}function Sm(e){const t=e,n=ut(typeof t.cwd=="string"?t.cwd:e.cwd),r=E0(n),a=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:H0(e),projectName:Qr(n),cwd:n,hasWorktree:a,createdAtIso:Xf(e.createdAt),updatedAtIso:Xf(e.updatedAt),preview:e.preview,unread:!1,inProgress:W0(e)}}function V0(e){return Sm(e.thread)}function z0(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((a,o)=>new Date(o.updatedAtIso).getTime()-new Date(a.updatedAtIso).getTime())})).sort((n,r)=>{var s,l;const a=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((l=r.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-a})}function G0(e){const t=e.data.map(Sm);return z0(t)}function Oi(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let a=0;a<n.length;a++){const o=t+a,s=n[a],l=typeof(s==null?void 0:s.id)=="string"?s.id:void 0,c=Array.isArray(s.items)?s.items:[];for(const h of c)for(const f of U0(h))r.push({...f,turnId:l,turnIndex:o})}return r}function ad(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return od(t.at(-1))}function sd(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(od(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const K0=5e3;function Hu(e){return e&&e.length>0?e:null}function Wu(e){return e&&e.length>0?e:null}let dl=null,Ti=null;const eh=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function dt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function fe(e){return typeof e=="string"&&e.length>0?e:null}function Tn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Jr(e){return typeof e=="boolean"?e:null}function Cs(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function Y0(e){return e==="payment_required"?e:null}function Q0(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function th(e){const t=dt(e);if(!t)return null;const n=Tn(t.usedPercent??t.used_percent);if(n===null)return null;const r=Tn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Tn(t.resetsAt??t.resets_at)}}function J0(e){const t=dt(e);if(!t)return null;const n=Jr(t.hasCredits??t.has_credits),r=Jr(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:fe(t.balance)}}function Tc(e){const t=dt(e);if(!t)return null;const n=th(t.primary),r=th(t.secondary),a=J0(t.credits);return!n&&!r&&!a?null:{limitId:fe(t.limitId??t.limit_id),limitName:fe(t.limitName??t.limit_name),primary:n,secondary:r,credits:a,planType:fe(t.planType??t.plan_type)}}function xm(e,t=null){const n=dt(e);if(!n)return null;const r=fe(n.accountId),a=fe(n.quotaStatus),o=a==="loading"||a==="ready"||a==="error"?a:"idle";return r?{accountId:r,authMode:fe(n.authMode),email:fe(n.email),planType:fe(n.planType),lastRefreshedAtIso:fe(n.lastRefreshedAtIso)??"",lastActivatedAtIso:fe(n.lastActivatedAtIso),quotaSnapshot:Tc(n.quotaSnapshot),quotaUpdatedAtIso:fe(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:fe(n.quotaError),unavailableReason:Y0(n.unavailableReason)??(Q0(fe(n.quotaError))?"payment_required":null),isActive:Jr(n.isActive)??r===t}:null}function Am(e){const t=dt(e);if(!t)return null;const n=dt(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Tc(n==null?void 0:n.codex);return r||Tc(t.rateLimits??t.rate_limits)}async function It(e,t){try{return await b0(e,t)}catch(n){throw xo(n,`RPC ${e} failed`,e)}}function id(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let a=0;a<n.length;a+=1){const o=t+a,s=n[a];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=o)}return r}function Xl(e){const t=dt(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function X0(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function Z0(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const e_=50,t_=100;async function n_(e,t){const n=await It("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:G0(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function r_(e){const t=await It("thread/read",{threadId:e,includeTurns:!1});return V0(t)}async function o_(e){const t=await It("thread/read",{threadId:e,includeTurns:!0}),n=Xl(t);return{messages:Oi(t,n),inProgress:ad(t),activeTurnId:sd(t),hasMoreOlder:n>0,turnIndexByTurnId:id(t,n)}}async function a_(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),a=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!a.ok)throw new Error(`Older thread page request failed with ${a.status}`);const o=await a.json();if(!o.result)throw new Error("Older thread page response did not include a thread result");const s=Math.max(0,Math.floor(typeof o.startTurnIndex=="number"?o.startTurnIndex:0));return{messages:Oi(o.result,s),inProgress:ad(o.result),activeTurnId:sd(o.result),hasMoreOlder:o.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:id(o.result,s)}}async function nh(e=null,t=e_){try{return await n_(e,t)}catch(n){throw xo(n,"Failed to load thread groups","thread/list")}}function s_(){return t_}async function i_(e){try{return await r_(e)}catch(t){throw xo(t,`Failed to load thread ${e}`,"thread/read")}}async function rh(e){try{return await o_(e)}catch(t){throw xo(t,`Failed to load thread ${e}`,"thread/read")}}async function l_(e,t,n){try{return await a_(e,t,n)}catch(r){throw xo(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}function u_(e){const t=dt(e);if(!t)return null;const n=fe(t.key),r=typeof t.text=="string"?t.text:"",a=fe(t.kind);return!n||!a||a!=="meta"&&a!=="hunk"&&a!=="add"&&a!=="remove"&&a!=="context"?null:{key:n,kind:a,text:r,oldLine:Tn(t.oldLine),newLine:Tn(t.newLine)}}function c_(e){const t=dt(e);if(!t)return null;const n=fe(t.id),r=typeof t.header=="string"?t.header:"",a=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:a,addedLineCount:Tn(t.addedLineCount)??0,removedLineCount:Tn(t.removedLineCount)??0,oldStart:Tn(t.oldStart),oldLineCount:Tn(t.oldLineCount)??0,newStart:Tn(t.newStart),newLineCount:Tn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(o=>u_(o)).filter(o=>o!==null):[]}:null}function d_(e){const t=dt(e);if(!t)return null;const n=fe(t.id),r=fe(t.path),a=fe(t.absolutePath),o=fe(t.operation);return!n||!r||!a||!o||o!=="add"&&o!=="delete"&&o!=="update"&&o!=="rename"?null:{id:n,path:r,absolutePath:a,previousPath:fe(t.previousPath),previousAbsolutePath:fe(t.previousAbsolutePath),operation:o,addedLineCount:Tn(t.addedLineCount)??0,removedLineCount:Tn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>c_(s)).filter(s=>s!==null):[]}}function Em(e){const t=dt(e),n=dt(t==null?void 0:t.data),r=dt(n==null?void 0:n.summary),a=fe(n==null?void 0:n.scope)==="baseBranch"?"baseBranch":"workspace",o=fe(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:fe(n==null?void 0:n.cwd)??"",gitRoot:fe(n==null?void 0:n.gitRoot),isGitRepo:Jr(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:o,baseBranch:fe(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(s=>fe(s)).filter(s=>typeof s=="string"&&s.length>0):[],headBranch:fe(n==null?void 0:n.headBranch),mergeBaseSha:fe(n==null?void 0:n.mergeBaseSha),generatedAtIso:fe(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Tn(r==null?void 0:r.fileCount)??0,addedLineCount:Tn(r==null?void 0:r.addedLineCount)??0,removedLineCount:Tn(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(s=>d_(s)).filter(s=>s!==null):[]}}function f_(e){var r;const t=e.trim();if(!t)return{absolutePath:null,startLine:null,endLine:null};const n=t.match(/^(.*?):(\d+)-(\d+)$/u);return n?{absolutePath:((r=n[1])==null?void 0:r.trim())||null,startLine:Number(n[2]),endLine:Number(n[3])}:{absolutePath:t||null,startLine:null,endLine:null}}function h_(e){var s;const t=e.replace(/\r\n/g,`
|
|
38
|
+
`).trim();if(!t)return{reviewText:"",summary:"",findings:[]};const n=t.search(/\n(?:Full review comments|Review comment):\n/iu),r=n>=0?t.slice(0,n).trim():t,a=n>=0?t.slice(n).trim():"",o=[];if(a){const c=a.replace(/^(?:Full review comments|Review comment):\n*/iu,"").trim().matchAll(/^- (.+?) — (.+)\n?((?: .*(?:\n|$))*)/gmu);let h=0;for(const f of c){const g=((s=f[1])==null?void 0:s.trim())??"",T=f_(f[2]??""),I=(f[0]??"").trim(),j=(f[3]??"").split(`
|
|
39
|
+
`).map(B=>B.replace(/^ /u,"")).join(`
|
|
40
|
+
`).trim();o.push({id:`finding:${h}`,title:g||`Finding ${h+1}`,body:j,path:T.absolutePath?T.absolutePath.split("/").filter(Boolean).slice(-1)[0]??T.absolutePath:null,absolutePath:T.absolutePath,startLine:T.startLine,endLine:T.endLine,rawText:I}),h+=1}}return{reviewText:t,summary:r,findings:o}}function oh(e,t){const n=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let r=n.length-1;r>=0;r-=1){const a=n[r],o=Array.isArray(a==null?void 0:a.items)?a.items:[];for(let s=o.length-1;s>=0;s-=1){const l=o[s];if((l==null?void 0:l.type)!==t)continue;const c=typeof l.review=="string"?l.review.trim():"";if(c)return c}}return null}async function $$(e){const t=await It("thread/read",{threadId:e,includeTurns:!0}),n=oh(t,"exitedReviewMode");return{enteredReviewLabel:oh(t,"enteredReviewMode"),result:n?h_(n):null}}async function N$(){return _0()}function kc(e){const t=dt(e);if(!t)return null;const n=fe(t.id),r=fe(t.kind),a=fe(t.name),o=fe(t.prompt),s=fe(t.rrule),l=fe(t.status);return!n||!a||!o||!s||r!=="heartbeat"&&r!=="cron"||l!=="ACTIVE"&&l!=="PAUSED"?null:{id:n,kind:r,name:a,prompt:o,rrule:s,status:l,targetThreadId:fe(t.targetThreadId),createdAtMs:Tn(t.createdAtMs),updatedAtMs:Tn(t.updatedAtMs),nextRunAtMs:Tn(t.nextRunAtMs)}}function p_(e){if(Array.isArray(e))return e.flatMap(n=>{const r=kc(n);return r?[r]:[]});const t=kc(e);return t?[t]:[]}async function m_(){var a;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(ga(t,"Failed to load thread automations"));const n=dt((a=dt(t))==null?void 0:a.data),r={};if(!n)return r;for(const[o,s]of Object.entries(n)){const l=p_(s);l.length>0&&(r[o]=l)}return r}async function v_(e){var a;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(ga(n,"Failed to save thread automation"));const r=kc((a=dt(n))==null?void 0:a.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function ah(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"}),a=await r.json().catch(()=>null);if(!r.ok)throw new Error(ga(a,"Failed to delete thread automation"))}async function g_(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(ga(r,"Failed to run thread automation"))}function y_(e){return k0(e)}function w_(e){const t=dt(e);if(!t)return null;const n=fe(t.id),r=fe(t.threadId),a=fe(t.cwd),o=fe(t.shell);return!n||!r||!a||!o?null:{id:n,threadId:r,cwd:a,shell:o,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Jr(t.truncated)??!1}}async function Vs(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(ga(r,`Terminal request failed with HTTP ${n.status}`));return r}async function L$(e){var r;const t=await Vs("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=w_((r=dt(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function b_(){const e=await Vs("/codex-api/thread-terminal/status"),t=dt(e);return{available:Jr(t==null?void 0:t.available)??!1,reason:fe(t==null?void 0:t.reason)||null}}async function __(e){const t=await Vs(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=dt(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(a=>{const o=dt(a),s=fe(o==null?void 0:o.label),l=fe(o==null?void 0:o.value),c=fe(o==null?void 0:o.source);return!s||!l||c!=="package"&&c!=="script"&&c!=="make"?[]:[{label:s,value:l,source:c}]})}async function j$(e,t){await Vs("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function O$(e,t,n){await Vs("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function D$(e){await Vs("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function T_(e,t){await C0({id:e,...t})}async function k_(){return S0()}async function C_(){try{const e=await It("account/rateLimits/read");return Am(e)}catch(e){throw xo(e,"Failed to load account rate limits","account/rateLimits/read")}}function Zl(e){const t=dt(e),n=fe(t==null?void 0:t.activeAccountId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,importedAccountId:fe(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(a=>xm(a,n)).filter(a=>a!==null)}}async function S_(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Cn(t,"Failed to load accounts"));const n=dt(t);return Zl(n==null?void 0:n.data)}async function x_(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Cn(t,"Failed to refresh accounts"));const n=dt(t);return Zl(n==null?void 0:n.data)}async function A_(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Cn(t,"Failed to start Codex login"));const n=dt(t),r=dt(n==null?void 0:n.data),a=fe(r==null?void 0:r.loginUrl);if(!a)throw new Error("Failed to start Codex login");return a}async function E_(e){const t=await fetch("/codex-api/accounts/login/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:e})}),n=await t.json();if(!t.ok)throw new Error(Cn(n,"Failed to complete Codex login"));const r=dt(n);return Zl(r==null?void 0:r.data)}async function I_(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Cn(n,"Failed to switch account"));const r=dt(n),a=dt(r==null?void 0:r.data),o=xm(a==null?void 0:a.account,fe(a==null?void 0:a.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function P_(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Cn(n,"Failed to remove account"));const r=dt(n);return Zl(r==null?void 0:r.data)}async function Vu(e){const t=await It("thread/resume",{threadId:e}),n=Xl(t),r=Oi(t,n);return{model:Ll(t),messages:r,inProgress:ad(t),activeTurnId:sd(t),hasMoreOlder:n>0,turnIndexByTurnId:id(t,n)}}async function R_(e){await It("thread/archive",{threadId:e})}async function M_(e,t){await It("thread/name/set",{threadId:e,name:t})}async function zu(e,t){const n=await It("thread/rollback",{threadId:e,numTurns:t});return Oi(n,Xl(n))}async function $_(e,t,n){try{const r=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n})});return r.ok?await r.json():{reverted:0,errors:["Server error"]}}catch{return{reverted:0,errors:["Network error"]}}}function Cc(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 N_(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 Ll(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}async function sh(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 It("thread/start",n),a=Cc(r);if(!a)throw new Error("thread/start did not return a thread id");return{threadId:a,model:Ll(r)}}catch(n){throw xo(n,"Failed to start a new thread","thread/start")}}async function ih(e,t,n){if(arguments.length<=1)try{const r=await It("thread/fork",{threadId:e,persistExtendedHistory:!0}),a=Cc(r);if(!a)throw new Error("thread/fork did not return a thread id");return{threadId:a,cwd:N_(r),model:Ll(r),messages:Oi(r,Xl(r))}}catch(r){throw xo(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const a={threadId:r};typeof t=="string"&&t.trim().length>0&&(a.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(a.model=n.trim());const o=await It("thread/fork",a),s=Cc(o);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:Ll(o)}}catch(r){throw xo(r,`Failed to fork thread ${e}`,"thread/fork")}}function lh(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 L_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
41
|
+
`;for(const r of t)n+=`
|
|
42
|
+
## ${r.label}: ${r.path}
|
|
43
|
+
`;return`${n}
|
|
44
|
+
## My request for Codex:
|
|
45
|
+
|
|
46
|
+
${e}
|
|
47
|
+
`}function j_(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function O_(e,t,n){var c;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Hu(n):Wu(n)};let a=null;try{a=await Pm()}catch{a=null}const o=(a==null?void 0:a.model.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?Hu(n??(a==null?void 0:a.reasoningEffort)):Wu(n??(a==null?void 0:a.reasoningEffort))};let s=[];try{s=await Im()}catch{s=[]}const l=((c=s.find(h=>h.trim().length>0))==null?void 0:c.trim())??"";if(l)return{model:l,reasoningEffort:e==="plan"?Hu(n??(a==null?void 0:a.reasoningEffort)):Wu(n??(a==null?void 0:a.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function Gu(e,t,n=[],r,a,o,s=[],l){var c;try{const h=(r==null?void 0:r.trim())??"",f=[];for(const O of n){const G=lh(O.trim());G&&f.push({label:j_(G),path:G,fsPath:G})}const g=[...s,...f],T=g.filter((O,G)=>g.findIndex(ee=>ee.fsPath===O.fsPath)===G),j=[{type:"text",text:L_(t,T)}];for(const O of n){const G=O.trim();if(!G)continue;const ee=lh(G);if(ee){j.push({type:"localImage",path:ee});continue}j.push({type:"image",url:G,image_url:G})}if(o)for(const O of o)j.push({type:"skill",name:O.name,path:O.path});const B=T.map(O=>({label:O.label,path:O.path,fsPath:O.fsPath})),X={threadId:e,input:j};if(B.length>0&&(X.attachments=B),h&&(X.model=h),typeof a=="string"&&a.length>0&&(X.effort=a),l){const O=await O_(l,h,a);X.collaborationMode={mode:l,settings:{model:O.model,reasoning_effort:O.reasoningEffort,developer_instructions:null}}}const U=await It("turn/start",X);return typeof((c=U==null?void 0:U.turn)==null?void 0:c.id)=="string"?U.turn.id.trim():""}catch(h){throw xo(h,`Failed to start turn for thread ${e}`,"turn/start")}}async function D_(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 It("turn/interrupt",{threadId:n,turnId:r})}catch(a){throw xo(a,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function F_(e){const t=e==="fast"?"fast":"standard";await It("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 U_(){return await(await fetch("/codex-api/free-mode/status")).json()}async function uh(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function ch(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 vs(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 Im(e={}){const t=await It("model/list",{}),n=[];for(const r of t.data){const a=r.id||r.model;!a||n.includes(a)||n.push(a)}if(e.includeProviderModels===!1)return n;try{const r=await fetch("/codex-api/provider-models",{signal:AbortSignal.timeout(K0)});let a=null;try{a=await r.json()}catch{a=null}if(r.ok&&Array.isArray(a==null?void 0:a.data)){if(a.exclusive)return a.data.filter(o=>typeof o=="string"&&o.trim().length>0);for(const o of a.data){if(typeof o!="string")continue;const s=o.trim();!s||n.includes(s)||n.push(s)}}}catch{}return n}async function Pm(){const e=await It("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=X0(e.config.model_reasoning_effort),a=Z0(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:a}}function Rm(e){const t=dt(e);if(!t)return null;const n=fe(t.id),r=fe(t.name);return!n||!r?null:{id:n,name:r,description:fe(t.description)??"",installUrl:fe(t.installUrl??t.install_url)??"",needsAuth:Jr(t.needsAuth??t.needs_auth)??!1}}function B_(e){const t=dt(e);if(!t)return null;const n=fe(t.name),r=fe(t.path);if(!n||!r)return null;const a=dt(t.interface);return{name:n,path:r,description:fe(t.description)??"",enabled:Jr(t.enabled)??!0,displayName:fe((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??n,shortDescription:fe(t.shortDescription??t.short_description)??""}}function Mm(e,t={}){const n=dt(e);if(!n)return null;const r=fe(n.id),a=fe(n.name);if(!r||!a)return null;const o=dt(n.interface),s=dt(n.source),l=fe(s==null?void 0:s.type)??"",c=fe(s==null?void 0:s.path),h=fe(s==null?void 0:s.url)??"",f=l==="remote"?t.name??null:null,g=t.path??(l==="local"?c:null),T=fe((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??a,I=fe((o==null?void 0:o.shortDescription)??(o==null?void 0:o.short_description)),j=fe((o==null?void 0:o.longDescription)??(o==null?void 0:o.long_description))??"";return{id:r,name:a,displayName:T,description:I??j,longDescription:j,developerName:fe((o==null?void 0:o.developerName)??(o==null?void 0:o.developer_name))??"",category:fe(o==null?void 0:o.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:g,remoteMarketplaceName:f,sourceType:l,sourceUrl:h,installed:Jr(n.installed)??!1,enabled:Jr(n.enabled)??!0,installPolicy:fe(n.installPolicy??n.install_policy)??"",authPolicy:fe(n.authPolicy??n.auth_policy)??"",logoUrl:fe((o==null?void 0:o.logoUrl)??(o==null?void 0:o.logo_url))??"",logoPath:fe(o==null?void 0:o.logo)??"",composerIconUrl:fe((o==null?void 0:o.composerIconUrl)??(o==null?void 0:o.composer_icon_url))??"",composerIconPath:fe((o==null?void 0:o.composerIcon)??(o==null?void 0:o.composer_icon))??"",brandColor:fe((o==null?void 0:o.brandColor)??(o==null?void 0:o.brand_color))??"",capabilities:Cs(o==null?void 0:o.capabilities),defaultPrompt:Cs((o==null?void 0:o.defaultPrompt)??(o==null?void 0:o.default_prompt)),screenshotUrls:Cs((o==null?void 0:o.screenshotUrls)??(o==null?void 0:o.screenshot_urls)),screenshots:Cs(o==null?void 0:o.screenshots),websiteUrl:fe((o==null?void 0:o.websiteUrl)??(o==null?void 0:o.website_url))??"",privacyPolicyUrl:fe((o==null?void 0:o.privacyPolicyUrl)??(o==null?void 0:o.privacy_policy_url))??"",termsOfServiceUrl:fe((o==null?void 0:o.termsOfServiceUrl)??(o==null?void 0:o.terms_of_service_url))??""}}function q_(e,t=0){const n=dt(e);if(!n)return null;const r=fe(n.id),a=fe(n.name);if(!r||!a)return null;const o=dt(n.branding),s=dt(n.appMetadata??n.app_metadata);return{id:r,name:a,description:fe(n.description)??fe((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:fe(n.logoUrl??n.logo_url)??"",logoUrlDark:fe(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:fe(n.distributionChannel??n.distribution_channel)??"",installUrl:fe(n.installUrl??n.install_url)??"",isAccessible:Jr(n.isAccessible??n.is_accessible)??!1,isEnabled:Jr(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Cs(n.pluginDisplayNames??n.plugin_display_names),category:fe(o==null?void 0:o.category)??"",developer:fe(o==null?void 0:o.developer)??fe(s==null?void 0:s.developer)??"",website:fe(o==null?void 0:o.website)??"",privacyPolicy:fe((o==null?void 0:o.privacyPolicy)??(o==null?void 0:o.privacy_policy))??"",termsOfService:fe((o==null?void 0:o.termsOfService)??(o==null?void 0:o.terms_of_service))??"",catalogRank:t}}function H_(e){const t=dt(e);if(!t)return null;const n=fe(t.name);if(!n)return null;const r=dt(t.tools)??{},a=Object.entries(r).map(([c,h])=>{const f=dt(h);return{name:fe(f==null?void 0:f.name)??c,title:fe(f==null?void 0:f.title)??"",description:fe(f==null?void 0:f.description)??""}}),o=Array.isArray(t.resources)?t.resources.map(c=>{const h=dt(c);return{name:fe(h==null?void 0:h.name)??"",title:fe(h==null?void 0:h.title)??"",uri:fe(h==null?void 0:h.uri)??"",description:fe(h==null?void 0:h.description)??""}}).filter(c=>c.name||c.uri):[],s=t.resourceTemplates??t.resource_templates,l=Array.isArray(s)?s.map(c=>{const h=dt(c);return{name:fe(h==null?void 0:h.name)??"",title:fe(h==null?void 0:h.title)??"",uriTemplate:fe((h==null?void 0:h.uriTemplate)??(h==null?void 0:h.uri_template))??"",description:fe(h==null?void 0:h.description)??""}}).filter(c=>c.name||c.uriTemplate):[];return{name:n,authStatus:fe(t.authStatus??t.auth_status)??"unsupported",tools:a,resources:o,resourceTemplates:l}}async function F$(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await It("plugin/list",t),r=[];for(const a of n.marketplaces??[]){const o=dt(a);if(!o)continue;const s=dt(o.interface),l={name:fe(o.name)??"",displayName:fe((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:fe(o.path)},c=Array.isArray(o.plugins)?o.plugins:[];for(const h of c){const f=Mm(h,l);f&&r.push(f)}}return r}async function U$(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await It("plugin/read",t),r=dt(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const a=Mm(r.summary,{name:fe(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:fe(r.marketplacePath)??e.marketplacePath})??e;return{summary:a,description:fe(r.description)??a.longDescription,apps:Array.isArray(r.apps)?r.apps.map(Rm).filter(o=>o!==null):[],skills:Array.isArray(r.skills)?r.skills.map(B_).filter(o=>o!==null):[],mcpServers:Cs(r.mcpServers??r.mcp_servers)}}async function B$(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await It("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:fe(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(Rm).filter(a=>a!==null)}}async function q$(e){await It("plugin/uninstall",{pluginId:e})}async function H$(e,t){await It("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function W$(e){const t=[];let n=null,r=0;do{const a={limit:100};n&&(a.cursor=n),e&&(a.threadId=e);const o=await It("app/list",a);for(const s of o.data??[]){const l=q_(s,r);l&&t.push(l),r+=1}n=fe(o.nextCursor??o.next_cursor)}while(n);return t}async function V$(e,t){await It("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function z$(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await It("mcpServerStatus/list",n);for(const a of r.data??[]){const o=H_(a);o&&e.push(o)}t=fe(r.nextCursor??r.next_cursor)}while(t);return e}async function G$(){await It("config/mcpServer/reload",{})}async function K$(e){const t=await It("mcpServer/oauth/login",{name:e});return{authorizationUrl:fe(t.authorizationUrl??t.authorization_url)??""}}async function Y$(){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 Q$(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 a=r.toString(),o=await fetch(`/codex-api/composio/connectors${a?`?${a}`:""}`);if(!o.ok)throw new Error(`Failed to list Composio connectors (${o.status})`);const s=await o.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 J$(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 X$(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 Z$(){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 eN(){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 W_(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function V_(){try{const e=await It("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const a=r.mode;a!=="default"&&a!=="plan"||t.has(a)||(t.add(a),n.push({value:a,label:W_(r.name||a)||(a==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of eh)t.has(r.value)||n.push(r);return n.sort((r,a)=>r.value===a.value?0:r.value==="default"?-1:1)}}catch{}return eh}function z_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const s=[];for(const l of o)typeof l=="string"&&l.length>0&&!s.includes(l)&&s.push(l);return s},r=t.labels,a={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,s]of Object.entries(r)){const l=typeof o=="string"?ut(o):"";l.length>0&&typeof s=="string"&&(a[l]=s)}return{order:n(t.order).map(o=>ut(o)),labels:a,active:n(t.active).map(o=>ut(o)),projectOrder:n(t.projectOrder).map(o=>ut(o)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];const s=o,l=typeof s.id=="string"?s.id.trim():"";return l?[{id:l,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 G_(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):[],a=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const l=s,c=typeof l.name=="string"?l.name.trim():"",h=typeof l.path=="string"?l.path.trim():"";return c&&h?[{name:c,path:h}]:[]}):[],o=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const l=s,c=typeof l.label=="string"?l.label.trim():"",h=typeof l.path=="string"?l.path.trim():"",f=typeof l.fsPath=="string"?l.fsPath.trim():"";return c&&h&&f?[{label:c,path:h,fsPath:f}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:a,fileAttachments:o,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function $m(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const a=n.trim();if(!a||!Array.isArray(r))continue;const o=r.flatMap(s=>{const l=G_(s);return l?[l]:[]});o.length>0&&(t[a]=o)}return t}async function Ts(){return Ti?Sc(Ti):(dl||(dl=K_().then(e=>(Ti=e,e)).finally(()=>{dl=null})),Sc(await dl))}async function K_(){const e=await fetch("/codex-api/workspace-roots-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load workspace roots state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return z_(n.data)}function Sc(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 Nm(){Ti=null}async function dh(){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 $m(n.data)}async function Y_(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify($m(e))})).ok)throw new Error("Failed to save thread queue state")}async function Q_(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})}),a=await r.json();if(!r.ok||!a.data)throw new Error(a.error||"Failed to create worktree");return{...a.data,cwd:ut(a.data.cwd),gitRoot:ut(a.data.gitRoot)}}async function J_(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 X_(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to load branches");const o=Array.isArray(a.data)?a.data:[],s=[],l=new Set;for(const c of o){if(!c||typeof c!="object"||Array.isArray(c))continue;const h=c,f=typeof h.value=="string"?h.value.trim():"",g=typeof h.label=="string"?h.label.trim():"";!f||l.has(f)||(l.add(f),s.push({value:f,label:g||f}))}return s}async function Z_(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()}`),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to load Git branch state");const o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},s=o.currentBranch,l=typeof s=="string"&&s.trim()?s.trim():null,c=Array.isArray(o.options)?o.options:[],h=[],f=new Set;for(const B of c){if(!B||typeof B!="object"||Array.isArray(B))continue;const X=B,U=typeof X.value=="string"?X.value.trim():"",O=typeof X.label=="string"?X.label.trim():"";!U||f.has(U)||(f.add(U),h.push({value:U,label:O||U,isCurrent:X.isCurrent===!0,isRemote:X.isRemote===!0}))}l&&!f.has(l)&&h.unshift({value:l,label:l,isCurrent:!0});const g=o.headSha,T=o.headSubject,I=o.headDate,j=o.gitRoot;return{currentBranch:l,headSha:typeof g=="string"&&g.trim()?g.trim():null,headSubject:typeof T=="string"&&T.trim()?T.trim():null,headDate:typeof I=="string"&&I.trim()?I.trim():null,detached:o.detached===!0,dirty:o.dirty===!0,gitRoot:typeof j=="string"?ut(j):"",options:h}}async function eT(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()}`),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to read Git repository status");const o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return{isGitRepo:o.isGitRepo===!0,gitRoot:typeof o.gitRoot=="string"?ut(o.gitRoot):""}}async function tT(e,t){var o;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 a=(o=r.data)==null?void 0:o.currentBranch;return typeof a=="string"&&a.trim()?a.trim():null}async function nT(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const a=new URLSearchParams({cwd:n,branch:r}),o=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),s=await o.json();if(!o.ok)throw new Error(s.error||"Failed to load branch commits");return(Array.isArray(s.data)?s.data:[]).flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const h=c,f=typeof h.sha=="string"?h.sha.trim():"",g=typeof h.shortSha=="string"?h.shortSha.trim():"",T=typeof h.subject=="string"?h.subject.trim():"",I=typeof h.date=="string"?h.date.trim():"";return!f||!g?[]:[{sha:f,shortSha:g,subject:T||g,date:I}]})}async function rT(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()})}),a=await r.json();if(!r.ok)throw new Error(a.error||"Failed to reset branch to commit");const o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return{currentBranch:typeof o.currentBranch=="string"&&o.currentBranch.trim()?o.currentBranch.trim():null,headSha:typeof o.headSha=="string"&&o.headSha.trim()?o.headSha.trim():null,headSubject:typeof o.headSubject=="string"&&o.headSubject.trim()?o.headSubject.trim():null,headDate:typeof o.headDate=="string"&&o.headDate.trim()?o.headDate.trim():null,detached:o.detached===!0,dirty:o.dirty===!0,gitRoot:typeof o.gitRoot=="string"?ut(o.gitRoot):"",options:[]}}async function tN(e,t,n,r){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim());const o=await fetch(`/codex-api/review/snapshot?${a.toString()}`),s=await o.json();if(!o.ok)throw new Error(Cn(s,"Failed to load review snapshot"));return Em(s)}async function nN(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(Cn(n,"Failed to apply review action"));return Em(n)}async function rN(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(Cn(n,"Failed to initialize Git"))}async function oN(e,t,n,r){const a=t==="baseBranch"?{type:"baseBranch",branch:(r??"").trim()}:{type:"uncommittedChanges"};if(a.type==="baseBranch"&&!a.branch)throw new Error("Base branch is unavailable");await It("review/start",{threadId:e,target:a,delivery:"inline"})}async function fh(){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 oT(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()}`),a=await eu(r);if(!r.ok){const c=Cn(a,"Failed to load local directories");throw new Error(c)}const o=a&&typeof a=="object"&&!Array.isArray(a)?a:{},s=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},l=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?ut(s.path):"",parentPath:typeof s.parentPath=="string"?ut(s.parentPath):"",entries:l.flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const h=c,f=typeof h.name=="string"?h.name.trim():"",g=typeof h.path=="string"?ut(h.path):"";return f&&g?[{name:f,path:g}]:[]})}}async function eu(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 Ku(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");Ti=Sc(e)}async function fl(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 l=Cn(r,"Failed to open project root");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},s=typeof o.path=="string"?ut(o.path):"";return Nm(),s}async function aT(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await eu(t);if(!t.ok){const s=Cn(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},o=typeof a.path=="string"?ut(a.path):"";return o&&Nm(),o}async function sT(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 eu(n);if(!n.ok){const s=Cn(r,"Failed to clone GitHub repository");throw new Error(s)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return typeof o.path=="string"?ut(o.path):""}async function iT(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 eu(t);if(!t.ok){const s=Cn(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},o=typeof a.cwd=="string"?ut(a.cwd):"";if(!o)throw new Error("Failed to create new chat folder");return{cwd:o,outputDirectory:typeof a.outputDirectory=="string"?ut(a.outputDirectory):o,workspaceRoot:typeof a.workspaceRoot=="string"?ut(a.workspaceRoot):""}}async function lT(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=Cn(r,"Failed to suggest project name");throw new Error(s)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?ut(o.path):""}}async function uT(e,t,n=20){const r=e.trim();if(!r)return[];const a=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),o=await a.json();if(!a.ok){const h=Cn(o,"Failed to search files");throw new Error(h)}const s=o&&typeof o=="object"&&!Array.isArray(o)?o:{},l=Array.isArray(s.data)?s.data:[],c=[];for(const h of l){if(!h||typeof h!="object"||Array.isArray(h))continue;const g=h.path,T=typeof g=="string"?g.trim():"";T&&c.push({path:T})}return c}async function cT(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 dT(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 a=Cn(r,"Failed to connect Telegram bot");throw new Error(a)}}async function fT(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Cn(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:{},a=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],o=[];for(const s of a){if(s==="*"){o.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&o.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:o}}async function hT(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const a=Cn(t,"Failed to load Telegram status");throw new Error(a)}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 Cn(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 a=n.error;return typeof a=="string"&&a.trim().length>0?a:t}async function pT(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function Yu(e,t){try{await fetch("/codex-api/thread-titles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,title:t})})}catch{}}async function mT(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function vT(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function gT(){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 yT(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 wT(e,t){var n;try{return((n=(await It("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 bT(e,t){const n=xc(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const a=r.lastIndexOf("skills");if(a>=2){const c=r[a-2]??"";if(c){const h=`/${[...r.slice(0,a+1),c,"SKILL.md"].join("/")}`;if(t.has(h))return{rootPath:h,rootName:c,isNested:h!==n}}}const o=r.indexOf("skills");if(o<0||o+1>=r.length-1)return null;const s=r[o+1]??"";if(!s)return null;const l=`/${[...r.slice(0,o+2),"SKILL.md"].join("/")}`;return t.has(l)?{rootPath:l,rootName:s,isNested:l!==n}:{rootPath:l,rootName:s,isNested:l!==n}}async function _T(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await It("skills/list",t),r=n.data.flatMap(s=>s.skills),a=new Set(r.map(s=>xc(s.path)).filter(Boolean)),o=new Map;for(const s of n.data)for(const l of s.skills){if(!l.name)continue;const c=bT(l.path,a),h=xc(l.path),g=!!(c!=null&&c.isNested&&a.has(c.rootPath))?c.rootPath:h,T=h===g,I=o.get(g),j={name:l.name,displayName:c&&g===c.rootPath?c.rootName:void 0,description:l.shortDescription||l.description||"",path:g,scope:l.scope,enabled:l.enabled,__hasRoot:T};if(!I){o.set(g,j);continue}if(I.enabled=I.enabled||l.enabled,!I.__hasRoot&&T){o.set(g,j);continue}!I.displayName&&j.displayName&&(I.displayName=j.displayName),!I.description&&j.description&&(I.description=j.description)}return Array.from(o.values()).map(({__hasRoot:s,...l})=>l)}catch{return[]}}async function TT(){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 kT(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 CT(e){try{const t=new URLSearchParams({path:e});return(await fetch(`/codex-api/prompts?${t.toString()}`,{method:"DELETE"})).ok}catch{return!1}}const ST=6e4;async function Qu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),ST);try{const r=new FormData;r.append("file",e);const a=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return a.ok?(await a.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}const xT={},AT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ET(e,t){return k(),E("svg",AT,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const os=xt(xT,[["render",ET]]),IT={},PT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function RT(e,t){return k(),E("svg",PT,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const fi=xt(IT,[["render",RT]]),MT={},$T={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function NT(e,t){return k(),E("svg",$T,[...t[0]||(t[0]=[m("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 gs=xt(MT,[["render",NT]]),LT={},jT={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function OT(e,t){return k(),E("svg",jT,[...t[0]||(t[0]=[m("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 Bs=xt(LT,[["render",OT]]),DT={},FT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function UT(e,t){return k(),E("svg",FT,[...t[0]||(t[0]=[m("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 ld=xt(DT,[["render",UT]]),BT={},qT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function HT(e,t){return k(),E("svg",qT,[...t[0]||(t[0]=[m("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 WT=xt(BT,[["render",HT]]),VT={},zT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function GT(e,t){return k(),E("svg",zT,[...t[0]||(t[0]=[m("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 Ss=xt(VT,[["render",GT]]),KT={},YT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function QT(e,t){return k(),E("svg",YT,[...t[0]||(t[0]=[m("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 hl=xt(KT,[["render",QT]]),Lm="codex-web-local.ui-language.v1",JT={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:"审查","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Reviewing…":"审查中…","Run review":"运行审查","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":"此范围内没有更改","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要","No structured findings yet":"暂时没有结构化发现","The latest review only returned summary text.":"最近一次审查仅返回了摘要文本。","Run review to populate this pane.":"运行审查后会填充此面板。",Findings:"发现",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":"超宽"},hh={en:"English","zh-CN":"简体中文"};function XT(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Lm))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const tu=x(XT());function jm(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}jm(tu.value);function ZT(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function ek(e){tu.value=e,jm(e),typeof window<"u"&&window.localStorage.setItem(Lm,e)}function Om(e,t){const n=tu.value==="zh-CN"?JT[e]??e:e;return ZT(n,t)}function Oa(){return{uiLanguage:tu,uiLanguageOptions:[{value:"en",label:hh.en},{value:"zh-CN",label:hh["zh-CN"]}],t:Om,setUiLanguage:ek}}const tk={key:0,class:"sidebar-menu-row-left"},nk={class:"sidebar-menu-row-main"},rk={key:1,class:"sidebar-menu-row-right"},ok={key:0,class:"sidebar-menu-row-right-default"},ak={key:1,class:"sidebar-menu-row-right-hover"},sk=Fn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=jy(),r=Z(()=>!!n.left),a=Z(()=>!!n.right),o=Z(()=>!!n["right-hover"]),s=Z(()=>a.value||o.value);return(l,c)=>(k(),at(Kc(t.as),tm({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},l.$attrs),{default:mt(()=>[r.value?(k(),E("span",tk,[Ho(l.$slots,"left",{},void 0,!0)])):J("",!0),m("span",nk,[Ho(l.$slots,"default",{},void 0,!0)]),s.value?(k(),E("span",rk,[a.value?(k(),E("span",ok,[Ho(l.$slots,"right",{},void 0,!0)])):J("",!0),o.value?(k(),E("span",ak,[Ho(l.$slots,"right-hover",{},void 0,!0)])):J("",!0)])):J("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),vo=xt(sk,[["__scopeId","data-v-36239f39"]]);function ik(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}const lk={key:0,class:"pinned-section"},uk={class:"thread-tree-header"},ck={key:0,class:"thread-list"},dk=["data-menu-open"],fk={class:"thread-left-stack"},hk=["data-state"],pk=["data-confirming","title","onClick"],mk={key:0,class:"thread-delete-confirm-label"},vk=["onClick"],gk={class:"thread-row-title-wrap"},yk={class:"thread-row-title-line"},wk={class:"thread-row-title"},bk=["title"],_k=["data-state"],Tk={class:"thread-row-time"},kk=["onClick"],Ck={class:"projects-section"},Sk={class:"thread-tree-header"},xk=["aria-expanded","aria-label","title"],Ak={class:"organize-menu-title"},Ek=["data-active"],Ik={key:0},Pk=["data-active"],Rk={key:0},Mk=["data-active"],$k={key:0},Nk={class:"organize-menu-title"},Lk=["data-active"],jk={key:0},Ok=["data-active"],Dk={key:0},Fk={key:0,class:"thread-tree-no-results"},Uk={key:1,class:"thread-tree-loading"},Bk={key:2,class:"thread-list thread-list-global"},qk=["data-menu-open"],Hk={class:"thread-left-stack"},Wk=["data-state"],Vk=["data-confirming","title","onClick"],zk={key:0,class:"thread-delete-confirm-label"},Gk=["onClick"],Kk={class:"thread-row-title-wrap"},Yk={class:"thread-row-title-line"},Qk={class:"thread-row-title"},Jk=["title"],Xk=["data-state"],Zk={class:"thread-row-time"},e1=["onClick"],t1=["data-project-name","data-expanded","data-dragging"],n1={class:"project-icon-stack"},r1={class:"project-icon-folder"},o1={class:"project-icon-chevron"},a1=["data-dragging-handle","onMousedown"],s1=["title"],i1={class:"project-hover-controls"},l1=["onClick"],u1=["data-open-direction"],c1=["onClick"],d1=["onClick"],f1=["onClick"],h1=["onClick"],p1={class:"project-menu-label"},m1=["onInput"],v1=["aria-label","title","onClick"],g1={key:0,class:"thread-list"},y1=["data-menu-open"],w1={class:"thread-left-stack"},b1=["data-state"],_1=["data-confirming","title","onClick"],T1={key:0,class:"thread-delete-confirm-label"},k1=["onClick"],C1={class:"thread-row-title-wrap"},S1={class:"thread-row-title-line"},x1={class:"thread-row-title"},A1=["title"],E1=["data-state"],I1={class:"thread-row-time"},P1=["onClick"],R1={class:"project-empty"},M1=["onClick"],$1={class:"chats-section"},N1={class:"thread-tree-header"},L1={class:"chats-section-actions"},j1=["aria-label","title"],O1={key:0,class:"thread-tree-no-results"},D1={key:1,class:"thread-list thread-list-global"},F1=["data-menu-open"],U1={class:"thread-left-stack"},B1=["data-state"],q1=["data-confirming","title","onClick"],H1={key:0,class:"thread-delete-confirm-label"},W1=["onClick"],V1={class:"thread-row-title-wrap"},z1={class:"thread-row-title-line"},G1={class:"thread-row-title"},K1=["title"],Y1=["data-state"],Q1={class:"thread-row-time"},J1=["onClick"],X1=["data-open-direction"],Z1={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},eC={class:"rename-thread-title"},tC=["onKeydown"],nC={class:"rename-thread-actions"},rC={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},oC={class:"rename-thread-title"},aC={class:"rename-thread-subtitle"},sC={class:"rename-thread-actions"},iC={class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread automation"},lC={class:"rename-thread-title"},uC={key:0,class:"automation-thread-list","aria-label":"Thread automations"},cC=["onClick"],dC={class:"automation-thread-field"},fC={class:"automation-thread-field"},hC={class:"automation-thread-field"},pC={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},mC={key:0,class:"automation-schedule-row"},vC={key:1,class:"automation-schedule-row"},gC={class:"automation-schedule-preview"},yC={class:"automation-thread-field"},wC={value:"ACTIVE"},bC={value:"PAUSED"},_C={key:1,class:"rename-thread-subtitle automation-thread-error"},TC={key:2,class:"rename-thread-subtitle automation-thread-notice"},kC={class:"rename-thread-actions"},CC=["disabled"],SC=["disabled"],xC=["disabled"],AC=["disabled"],EC=4,ph=6,mh="codex-web-local.sidebar-section-expansion.v1",vh="codex-web-local.sidebar-chats-first.v1",gh="codex-web-local.sidebar-chat-sort-mode.v1",yh="codex-web-local.thread-view-mode.v1",wh="codex-web-local.collapsed-projects.v1",IC=Fn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},projectGitRepoByName:{},selectedThreadId:{},isLoading:{type:Boolean},isThreadListFullyLoaded:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","browse-project-files","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread","start-new-chat"],setup(e,{emit:t}){const n=e,{t:r}=Oa(),a=t,o=x({}),s=x({}),l=x(!0),c=x(!0),h=x(!0),f=x(!1),g=x(D(vh,!1)),T=x(q());let I=!1;const j=x([]),B=x({}),X=x(""),U=x([]),O=x(""),G=x(""),ee=x({}),be=x({}),pe=x({}),Te=x("actions"),Pe=x(""),K=x(!1),ge=x(""),ke=x(""),oe=x(null),Re=x(!1),ze=x(""),He=x(""),Ne=x({}),Fe=x(!1),Le=x(""),et=x(""),Ge=x("create"),Je=x(""),Ke=x(""),it=x(!1),qe=x(!1),Xe=x({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),nt=x({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),Q=Z(()=>{const y=Le.value;return y?Ne.value[y]??[]:[]}),Ee=Z(()=>Mn(Xe.value.rrule)),ve=x(null),Oe=x(null),We=x(null);let A=null,$=null;const V=x(""),ne=x({}),le=new Map,ae=new Map,he=new Map,ue=new WeakMap,ye=x(null),de=x(null),Me=x(!1),xe=x(tt()),$e=typeof window<"u"?new ResizeObserver(y=>{for(const b of y){const w=b.target,L=ue.get(w);L&&uo(L,w)}}):null;function je(){if(typeof window>"u")return{};try{const y=window.localStorage.getItem(wh);if(!y)return{};const b=JSON.parse(y);return!b||typeof b!="object"||Array.isArray(b)?{}:b}catch{return{}}}function tt(){return typeof window>"u"?"project":window.localStorage.getItem(yh)==="chronological"?"chronological":"project"}function D(y,b){if(typeof window>"u")return b;const w=window.localStorage.getItem(y);return w==="true"?!0:w==="false"?!1:b}function q(){return typeof window>"u"?"updated":window.localStorage.getItem(gh)==="created"?"created":"updated"}s.value=je();function W(){if(!(typeof window>"u"))try{const y=JSON.parse(window.localStorage.getItem(mh)||"{}");typeof y.pinned=="boolean"&&(l.value=y.pinned),typeof y.projects=="boolean"&&(c.value=y.projects),typeof y.chats=="boolean"&&(h.value=y.chats)}catch{}}function se(){typeof window>"u"||window.localStorage.setItem(mh,JSON.stringify({pinned:l.value,projects:c.value,chats:h.value}))}W(),pt(s,y=>{typeof window>"u"||window.localStorage.setItem(wh,JSON.stringify(y))},{deep:!0}),pt(xe,y=>{typeof window>"u"||window.localStorage.setItem(yh,y)}),pt(g,y=>{typeof window>"u"||window.localStorage.setItem(vh,String(y))}),pt(T,y=>{typeof window>"u"||window.localStorage.setItem(gh,y)}),pt([l,c,h],se);const me=Z(()=>n.searchQuery.trim().toLowerCase()),Ce=Z(()=>me.value.length>0),Ue=Z(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null),vt=Z(()=>new Set(j.value)),ht=Z(()=>new Set(U.value));function ot(y){if(ht.value.has(y.id))return!1;if(!Ce.value)return!0;if(Ue.value)return Ue.value.has(y.id);const b=me.value;return y.title.toLowerCase().includes(b)||y.preview.toLowerCase().includes(b)}const bt=Z(()=>n.groups.flatMap(y=>{const b=y.threads.filter(w=>!Nl(w.cwd)&&ot(w));return b.length>0?[{...y,threads:b}]:!Ce.value&&y.threads.length===0?[{...y,threads:b}]:[]})),Dt=Z(()=>xe.value==="chronological"),Tr=Z(()=>{const y=[];for(const b of n.groups)for(const w of b.threads)vt.value.has(w.id)||ot(w)&&y.push(w);return y.sort((b,w)=>{const L=new Date(b.updatedAtIso||b.createdAtIso).getTime();return new Date(w.updatedAtIso||w.createdAtIso).getTime()-L})}),cn=Z(()=>{const y=Tr.value.filter(w=>Nl(w.cwd)),b=T.value==="created"?"createdAtIso":"updatedAtIso";return y.sort((w,L)=>{const _e=new Date(w[b]||w.updatedAtIso||w.createdAtIso).getTime();return new Date(L[b]||L.updatedAtIso||L.createdAtIso).getTime()-_e})}),Xr=Z(()=>Ce.value||f.value?cn.value:cn.value.slice(0,10)),zo=Z(()=>Ce.value?!1:cn.value.length>10),pn=Z(()=>{const y=new Map;for(const b of n.groups)for(const w of b.threads)ht.value.has(w.id)||y.set(w.id,w);return y});pt(j,y=>{I&&vT(y)}),pt([pn,()=>n.isThreadListFullyLoaded],([y])=>{const b=ik(j.value,new Set(y.keys()),{canPruneMissing:n.isThreadListFullyLoaded});if(b.length===j.value.length)return;const w=new Set(b),L=Object.fromEntries(Object.entries(B.value).filter(([_e])=>w.has(_e)));B.value=L,j.value=b});let gn=0;async function $r(){if(n.isLoading)return;const y=j.value.filter(_e=>!pn.value.has(_e)&&!B.value[_e]);if(y.length===0)return;const b=gn+=1,w=await Promise.all(y.map(async _e=>{try{return await i_(_e)}catch{return null}}));if(b!==gn)return;const L={...B.value};for(const _e of w)_e&&(L[_e.id]=_e);B.value=L}pt([j,pn,()=>n.isLoading],()=>{I&&$r()}),va(async()=>{const{threadIds:y}=await mT(),b=Array.isArray(y)?y.filter(w=>typeof w=="string").map(w=>w.trim()).filter((w,L,_e)=>w.length>0&&_e.indexOf(w)===L):[];b.length>0&&(j.value=b);try{Ne.value=await m_()}catch{Ne.value={}}I=!0,$r()});const dr=Z(()=>$t(ze.value)),kr=Z(()=>{const y=new Map;for(const b of n.groups)for(const w of b.threads)y.set(w.id,b.projectName);return y}),rn=Z(()=>{const y=new Map;for(const b of n.groups){const w=b.threads.filter(L=>!vt.value.has(L.id)&&!ht.value.has(L.id));y.set(b.projectName,w)}return y}),Ao=Z(()=>{const y=new Map;for(const b of n.groups)for(const w of b.threads){const L=new Date(w.updatedAtIso||w.createdAtIso).getTime();y.set(w.id,L)}return y}),mn=Z(()=>{const y=G.value;return y?pn.value.get(y)??null:null}),Eo=Z(()=>j.value.map(y=>pn.value.get(y)??B.value[y]??null).filter(y=>y!==null).filter(ot));function Io(){l.value=!l.value}function Po(){c.value=!c.value}function Go(){h.value=!h.value}const Nr=Z(()=>{const y=We.value;if(!y||y.dropTargetIndexFull===null||n.groups.length===0)return null;const b=Math.max(0,Math.min(y.dropTargetIndexFull,n.groups.length)),w=b>y.fromIndex?b-1:b,L=Math.max(0,Math.min(w,n.groups.length-1));return L===y.fromIndex?null:L}),gt=Z(()=>{const b=(Ce.value?bt.value:n.groups).map(Xt=>Xt.projectName),w=We.value,L=Nr.value;if(!w||L===null)return b;const _e=[...b],[De]=_e.splice(w.fromIndex,1);return De?(_e.splice(L,0,De),_e):b}),Un=Z(()=>{const y={};let b=0;for(const w of gt.value)y[w]=b,b+=oo(w);return y}),Lt=Z(()=>{let y=0;for(const b of gt.value)y+=oo(b);return{height:`${Math.max(0,y)}px`}});function er(y){if(Number.isNaN(y))return"n/a";const b=Math.abs(Date.now()-y);if(b<6e4)return"now";const w=Math.floor(b/6e4);if(w<60)return`${w}m`;const L=Math.floor(w/60);return L<24?`${L}h`:`${Math.floor(L/24)}d`}function Ft(y){const b=Ao.value.get(y.id);return er(typeof b=="number"?b:new Date(y.updatedAtIso||y.createdAtIso).getTime())}function Bn(y){return vt.value.has(y)}function Rn(y){if(Bn(y)){j.value=j.value.filter(b=>b!==y);return}j.value=[y,...j.value]}function on(y){Rn(y),ct()}function Ut(y){X.value="",a("select",y)}function $t(y){var b;return(((b=Ne.value[y])==null?void 0:b.length)??0)>0}function Yt(y){const b=Ne.value[y]??[];if(b.length===0)return"";if(b.length>1){const _e=b.filter(De=>De.status==="ACTIVE").length;return`${b.length} automations • ${_e} active`}const[w]=b,L=w.status==="PAUSED"?"-":w.nextRunAtMs?new Date(w.nextRunAtMs).toLocaleString():"Not scheduled";return`${w.name} • Next run: ${L}`}function qn(y){return String(Math.max(0,y)).padStart(2,"0")}function fr(y,b){const w=typeof y=="number"?y:Number(y);return Number.isFinite(w)?Math.max(1,Math.floor(w)):b}function Ko(y){const[b,w]=y.split(":"),L=Math.min(23,Math.max(0,Number(b)||0)),_e=Math.min(59,Math.max(0,Number(w)||0));return`FREQ=DAILY;BYHOUR=${L};BYMINUTE=${_e}`}function Zr(y,b){const w=fr(y,1);return b==="minutes"?`FREQ=MINUTELY;INTERVAL=${w}`:b==="hours"?`FREQ=HOURLY;INTERVAL=${w}`:`FREQ=DAILY;INTERVAL=${w}`}function eo(y){return Object.fromEntries(y.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[w,...L]=b.split("=");return[w.toUpperCase(),L.join("=").trim()]}).filter(([b,w])=>b&&w))}function Lr(y){var _e;const b=eo(y),w=(_e=b.FREQ)==null?void 0:_e.toUpperCase(),L=fr(b.INTERVAL,1);if(w==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&L===1){const De=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Xt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return{mode:"daily",dailyTime:`${qn(De)}:${qn(Xt)}`,interval:1,intervalUnit:"hours"}}return w==="MINUTELY"||w==="HOURLY"||w==="DAILY"&&b.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:L,intervalUnit:w==="MINUTELY"?"minutes":w==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function Mn(y){var _e;const b=eo(y),w=(_e=b.FREQ)==null?void 0:_e.toUpperCase(),L=fr(b.INTERVAL,1);if(w==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&L===1){const De=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Xt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return`RRULE: ${y} · runs daily at ${qn(De)}:${qn(Xt)}`}return w==="MINUTELY"?`RRULE: ${y} · runs every ${L} minute${L===1?"":"s"}`:w==="HOURLY"?`RRULE: ${y} · runs every ${L} hour${L===1?"":"s"}`:w==="DAILY"&&b.INTERVAL!==void 0?`RRULE: ${y} · runs every ${L} day${L===1?"":"s"}`:y?`RRULE: ${y}`:"RRULE is required."}function $n(){const y=nt.value;y.mode==="daily"?Xe.value.rrule=Ko(y.dailyTime):y.mode==="interval"&&(Xe.value.rrule=Zr(y.interval,y.intervalUnit))}function tr(){nt.value=Lr(Xe.value.rrule)}function hr(y){nt.value={...nt.value,mode:y},$n()}function nr(y){a("export-thread",y),ct()}function to(y){a("fork-thread",y),ct()}function Hn(y){return`start new thread ${An(y)}`}function Cr(y){a("start-new-thread",y)}function pr(y){a("browse-thread-files",y),ct()}async function Ro(y){var w,L;const b=((L=(w=pn.value.get(y))==null?void 0:w.cwd)==null?void 0:L.trim())??"";if(ct(),!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b)}catch{}}function Wn(y,b){if(G.value===y){if(b){const w=b.relatedTarget,L=de.value;if(w instanceof Node&&L&&L.contains(w))return}ct()}}function an(y){return G.value===y}function ct(){G.value="",pe.value={}}function Nn(y){if(X.value="",G.value===y){ct();return}Ae(),Me.value=!1,G.value=y,Kt(()=>{Er(y)})}function Ln(y,b){y.preventDefault(),X.value="",G.value=b}function jr(y,b){ge.value=y,ke.value=b,K.value=!0,ct(),Kt(()=>{var w,L;(w=oe.value)==null||w.focus(),(L=oe.value)==null||L.select()})}function Nt(){K.value=!1,ge.value="",ke.value=""}function Qt(){const y=ge.value,b=ke.value.trim();!y||!b||(a("rename-thread",{threadId:y,title:b}),Nt())}function Vn(y,b){X.value="",ze.value=y,He.value=b,Re.value=!0,ct()}function mr(){Re.value=!1,ze.value="",He.value=""}async function no(){const y=ze.value;y&&(yn(y),mr())}function Bt(y){return X.value===y}function Sr(y){if(X.value!==y){X.value=y,ct();return}yn(y),X.value=""}function yn(y){ht.value.has(y)||(U.value=[y,...U.value]),X.value="",ct(),j.value=j.value.filter(b=>b!==y),a("archive",y),$t(y)&&(ah(y).catch(()=>{}),Ne.value=Or(Ne.value,y))}function Sn(y){var w;Le.value=y,Je.value="",Ke.value="";const b=(w=Ne.value[y])==null?void 0:w[0];b?Tt(b.id):Ct(),Fe.value=!0,ct()}function Ct(){et.value="",Ge.value="create",Je.value="",Ke.value="",Xe.value={name:"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},nt.value=Lr(Xe.value.rrule)}function Tt(y){const b=Q.value.find(w=>w.id===y);b&&(et.value=b.id,Ge.value="edit",Je.value="",Ke.value="",Xe.value={name:b.name,prompt:b.prompt,rrule:b.rrule,status:b.status},nt.value=Lr(b.rrule))}function sn(){Fe.value=!1,Le.value="",et.value="",Je.value="",Ke.value="",it.value=!1,qe.value=!1}function Or(y,b){return Object.fromEntries(Object.entries(y).filter(([w])=>w!==b))}function vr(y,b,w){const L=y[b]??[],_e=L.findIndex(Xt=>Xt.id===w.id),De=[...L];return _e>=0?De.splice(_e,1,w):De.push(w),{...y,[b]:De}}function zn(y,b,w){const L=(y[b]??[]).filter(_e=>_e.id!==w);return L.length>0?{...y,[b]:L}:Or(y,b)}async function Yo(){const y=Le.value;if(y){it.value=!0,Je.value="",Ke.value="";try{$n();const b=await v_({threadId:y,id:et.value||void 0,name:Xe.value.name,prompt:Xe.value.prompt,rrule:Xe.value.rrule,status:Xe.value.status});Ne.value=vr(Ne.value,y,b),Tt(b.id),Ke.value="Automation saved.",it.value=!1}catch(b){Je.value=b instanceof Error?b.message:"Failed to save automation",it.value=!1}}}async function xn(){var w;const y=Le.value,b=et.value;if(!(!y||!b)){it.value=!0,Je.value="",Ke.value="";try{await ah(y,b),Ne.value=zn(Ne.value,y,b);const L=(w=Ne.value[y])==null?void 0:w[0];L?Tt(L.id):Ct(),it.value=!1}catch(L){Je.value=L instanceof Error?L.message:"Failed to remove automation",it.value=!1}}}async function vn(){const y=Le.value,b=et.value;if(!(!y||!b)){qe.value=!0,Je.value="",Ke.value="";try{await g_(y,b),Ke.value="Automation run queued."}catch(w){Je.value=w instanceof Error?w.message:"Failed to run automation"}finally{qe.value=!1}}}function An(y){return n.projectDisplayNameById[y]??y}function Vt(y){return y.includes("/")||y.includes("\\")}function xr(y){return Vt(y)?y:An(y)}function P(y){const b=Mr(y);if(!b)return!1;let w=0;for(const L of n.groups)if(Vt(L.projectName)&&Mr(L.projectName)===b&&(w+=1,w>1))return!0;return!1}function F(y){const b=n.projectDisplayNameById[y.projectName],w=An(y.projectName),L=y.projectName;if(b&&!Vt(L)&&L!==w)return w.includes(L)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(L)?w:`${w} ${L}`;if(b&&Vt(L)){const Xt=Mr(L),Vr=Mr($s(L)),Zt=P(L)?Vr:Xt;return Zt&&Zt!==w?`${w} ${Zt}`:w}if(!w.includes("/")&&!w.includes("\\"))return w;const _e=Mr(w)||w,De=Mr($s(w));return De.startsWith(".")&&De!==_e?`${_e} ${De}`:y.threads.length>0||!P(L)?_e:De?`${_e} ${De}`:_e}function te(y){return O.value===y}function Ae(){O.value="",Te.value="actions",Pe.value=""}function wt(){const y=!Me.value;y&&(Ae(),ct()),Me.value=y}function qt(y){xe.value=y,Me.value=!1}function En(){g.value=!g.value}function zt(y){T.value=y}function Jt(y){a("request-project-git-status",y),Kt(()=>{Mo(y)})}function Gn(y){if(O.value===y){Ae();return}ct(),Me.value=!1,O.value=y,Te.value="actions",Pe.value=An(y),Jt(y)}function rr(y){ct(),Me.value=!1,O.value=y,Te.value="actions",Pe.value=An(y),Jt(y)}function us(y){return n.projectDisplayNameById[y.projectName]??F(y)}function cs(y){ct();const b=y.projectName;O.value=b,Te.value="rename",Pe.value=us(y),Kt(()=>{Mo(b)})}function Ie(y){a("browse-project-files",y),Ae()}function Se(y){a("create-project-worktree",y),Ae()}function ln(y){a("rename-project",{projectName:y,displayName:Pe.value})}function Dr(y){a("remove-project",y),Ae()}function Qo(y,b){if(!y.altKey||y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;const w=n.groups.findIndex(De=>De.projectName===b);if(w<0)return;const L=y.key==="ArrowUp"?-1:1,_e=Math.max(0,Math.min(w+L,n.groups.length-1));_e!==w&&(y.preventDefault(),a("reorder-project",{projectName:b,toIndex:_e}))}function Ar(y){return o.value[y]===!0}function At(y){return s.value[y]===!0}function Jo(y){o.value={...o.value,[y]:!Ar(y)}}function Da(){f.value=!f.value}function ro(y){if(V.value===y){V.value="";return}s.value={...s.value,[y]:!At(y)}}function oo(y){const b=ne.value[y]??0,w=We.value,_e=((w==null?void 0:w.projectName)===y?w.groupHeight:null)??b,De=At(y)?0:ph;return Math.max(0,_e+De)}function Fr(y,b){const w=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(w){ae.set(y,w);return}ae.delete(y)}function ao(y,b){const w=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(w){he.set(y,w);return}he.delete(y)}function Ur(y){let b=y.parentElement;for(;b;){const w=window.getComputedStyle(b),L=w.overflowY||w.overflow;if(L==="auto"||L==="scroll"||L==="hidden"||L==="clip")return b.getBoundingClientRect();b=b.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function so(y,b){const w=y.getBoundingClientRect(),L=Ur(y),_e=6,De=L.bottom-w.bottom,Xt=w.top-L.top;return De>=b+_e?"down":Xt>De?"up":"down"}function Kn(y,b){const w=he.get(y);if(!w)return"down";const L=so(w,b);return be.value={...be.value,[y]:L},L}function io(y){return be.value[y]??"down"}function Mo(y){const b=ae.get(y);if(!b)return;const w=b.querySelector(".project-menu-panel"),L=(w==null?void 0:w.getBoundingClientRect().height)??0;ee.value={...ee.value,[y]:so(b,L)}}function In(y,b,w){return Math.min(Math.max(y,b),w)}function Er(y){const b=he.get(y);if(!b)return;const w=de.value,L=w==null?void 0:w.getBoundingClientRect(),_e=(L==null?void 0:L.height)||(w==null?void 0:w.offsetHeight)||112,De=(L==null?void 0:L.width)||(w==null?void 0:w.offsetWidth)||160,Xt=Kn(y,_e),Vr=b.getBoundingClientRect(),Zt=8,dn=4,zr=Math.max(Zt,window.innerWidth-De-Zt),Lo=In(Vr.right-De,Zt,zr),Pr=In(Xt==="up"?Vr.top-_e-dn:Vr.bottom+dn,Zt,Math.max(Zt,window.innerHeight-_e-Zt));pe.value={left:`${Math.round(Lo)}px`,top:`${Math.round(Pr)}px`}}function Br(){const y=G.value;y&&Er(y)}function Xo(){window.addEventListener("resize",Br),document.addEventListener("scroll",Br,!0)}function qr(){window.removeEventListener("resize",Br),document.removeEventListener("scroll",Br,!0)}function Pn(y){const b=O.value;if(!b)return!1;const w=ae.get(b);if(!w)return!1;if((typeof y.composedPath=="function"?y.composedPath():[]).includes(w))return!0;const _e=y.target;return _e instanceof Node?w.contains(_e):!1}function ya(y){const b=G.value;if(!b)return!1;const w=he.get(b);if(!w)return!1;const L=typeof y.composedPath=="function"?y.composedPath():[];if(L.includes(w))return!0;const _e=de.value;if(_e&&L.includes(_e))return!0;const De=y.target;return De instanceof Node?!!(w.contains(De)||_e&&_e.contains(De)):!1}function Ir(y){if(Me.value){const b=ye.value,w=typeof y.composedPath=="function"?y.composedPath():[];!!b&&(w.includes(b)||y.target instanceof Node&&b.contains(y.target))||(Me.value=!1)}O.value&&(Pn(y)||Ae(),G.value&&(ya(y)||ct()))}function Zo(y){O.value&&!Pn(y)&&Ae(),G.value&&!ya(y)&&ct()}function ds(){Me.value&&(Me.value=!1),O.value&&Ae(),G.value&&ct()}function lo(){window.addEventListener("pointerdown",Ir,{capture:!0}),window.addEventListener("focusin",Zo,{capture:!0}),window.addEventListener("blur",ds)}function Yn(){window.removeEventListener("pointerdown",Ir,{capture:!0}),window.removeEventListener("focusin",Zo,{capture:!0}),window.removeEventListener("blur",ds)}function uo(y,b){const w=b.getBoundingClientRect().height;if(!Number.isFinite(w)||w<=0)return;const L=ne.value[y];L!==void 0&&Math.abs(L-w)<.5||(ne.value={...ne.value,[y]:w})}function Fa(y,b){const w=le.get(y);w&&w!==b&&$e&&$e.unobserve(w);const L=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(L){le.set(y,L),ue.set(L,y),uo(y,L),$e==null||$e.observe(L);return}w&&($e==null||$e.unobserve(w)),le.delete(y)}function wn(y,b){if(y.button!==0||Ce.value||Oe.value||We.value)return;const w=n.groups.findIndex(Xt=>Xt.projectName===b),L=le.get(b);if(w<0||!L)return;const _e=L.getBoundingClientRect(),De=At(b)?0:ph;Oe.value={projectName:b,fromIndex:w,startClientX:y.clientX,startClientY:y.clientY,pointerOffsetY:y.clientY-_e.top,groupLeft:_e.left,groupWidth:_e.width,groupHeight:_e.height,groupOuterHeight:_e.height+De},y.preventDefault(),jn()}function jn(){window.addEventListener("mousemove",wa),window.addEventListener("mouseup",yr),window.addEventListener("keydown",or)}function gr(){window.removeEventListener("mousemove",wa),window.removeEventListener("mouseup",yr),window.removeEventListener("keydown",or)}function wa(y){A={clientX:y.clientX,clientY:y.clientY},Ua()}function yr(y){ba({clientX:y.clientX,clientY:y.clientY});const b=We.value;if(b&&Nr.value!==null){const w=n.groups.findIndex(L=>L.projectName===b.projectName);if(w>=0){const L=Nr.value;L!==w&&a("reorder-project",{projectName:b.projectName,toIndex:L})}}co({preserveToggleSuppression:!!b})}function or(y){y.key==="Escape"&&(!Oe.value&&!We.value||(y.preventDefault(),co()))}function co(y={}){$!==null&&(window.cancelAnimationFrame($),$=null),A=null,Oe.value=null,We.value=null,y.preserveToggleSuppression||(V.value=""),gr()}function Ua(){$===null&&($=window.requestAnimationFrame(()=>{if($=null,!A)return;const y=A;A=null,ba(y)}))}function ba(y){const b=Oe.value;if(!We.value&&b){const w=y.clientX-b.startClientX,L=y.clientY-b.startClientY;if(Math.hypot(w,L)<EC)return;Ae(),V.value=b.projectName,We.value={projectName:b.projectName,fromIndex:b.fromIndex,pointerOffsetY:b.pointerOffsetY,groupLeft:b.groupLeft,groupWidth:b.groupWidth,groupHeight:b.groupHeight,groupOuterHeight:b.groupOuterHeight,ghostTop:y.clientY-b.pointerOffsetY,dropTargetIndexFull:null}}We.value&&$o(y)}function $o(y){const b=We.value;if(!b)return;if(b.ghostTop=y.clientY-b.pointerOffsetY,!Ba(y)){b.dropTargetIndexFull=null;return}const w=y.clientY,L=ve.value;if(!L){b.dropTargetIndexFull=null;return}const _e=L.getBoundingClientRect(),De=new Map(n.groups.map((dn,zr)=>[dn.projectName,zr])),Xt=n.groups.map(dn=>dn.projectName).filter(dn=>dn!==b.projectName);let Vr=0,Zt=n.groups.length;for(const dn of Xt){const zr=De.get(dn);if(zr===void 0)continue;const Lo=oo(dn),Pr=_e.top+Vr+Lo/2;if(w<Pr){Zt=zr;break}Vr+=Lo}b.dropTargetIndexFull=Zt}function Ba(y){const b=ve.value;if(!b)return!1;const w=b.getBoundingClientRect(),L=y.clientX>=w.left&&y.clientX<=w.right,_e=y.clientY>=w.top-32&&y.clientY<=w.bottom+32;return L&&_e}function No(y){var b;return((b=We.value)==null?void 0:b.projectName)===y}function Hr(y){const b=We.value,w=Un.value[y]??0,L=G.value?kr.value.get(G.value)??"":"",_e=O.value===y||L===y;return!b||b.projectName!==y?{position:"absolute",top:"0",left:"0",right:"0",zIndex:_e?"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 Wr(y){return rn.value.get(y.projectName)??[]}function ea(y){if(Ce.value)return Wr(y);if(At(y.projectName))return[];const b=Wr(y);return Ar(y.projectName)?b:b.slice(0,10)}function fo(y){return Ce.value?!1:!At(y.projectName)&&Wr(y).length>10}function Ht(y){return Wr(y).length>0}function ar(y){return!!y.pendingRequestState||y.inProgress||y.unread}function _a(y){return y.pendingRequestState==="approval"?"Awaiting approval":"Awaiting response"}function Ta(y){return y.pendingRequestState==="approval"?"awaiting-approval":y.pendingRequestState==="response"?"awaiting-response":y.inProgress?"working":y.unread?"unread":"idle"}pt(()=>n.groups.map(y=>y.projectName),y=>{var _e,De;const b=((_e=We.value)==null?void 0:_e.projectName)??((De=Oe.value)==null?void 0:De.projectName)??"";b&&!n.groups.some(Xt=>Xt.projectName===b)&&co();const w=new Set(y),L=Object.fromEntries(Object.entries(ne.value).filter(([Xt])=>w.has(Xt)));Object.keys(L).length!==Object.keys(ne.value).length&&(ne.value=L)}),pt(()=>{const y=O.value;return y?n.projectGitRepoByName[y]:void 0},()=>{const y=O.value;y&&Kt(()=>{O.value===y&&Mo(y)})});const zs=Z(()=>Me.value||O.value!==""||G.value!=="");return pt(zs,y=>{if(y){lo();return}Yn()}),pt(G,y=>{if(!y){qr();return}Xo(),Kt(()=>{Er(y)})}),ja(()=>{for(const y of le.values())$e==null||$e.unobserve(y);le.clear(),ae.clear(),qr(),Yn(),co()}),(y,b)=>(k(),E("section",{class:rt(["thread-tree-root",{"chats-first":g.value}])},[Eo.value.length>0?(k(),E("section",lk,[Be(vo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":l.value,onClick:Io},{left:mt(()=>[l.value?(k(),at(os,{key:1,class:"thread-icon"})):(k(),at(fi,{key:0,class:"thread-icon"}))]),default:mt(()=>[m("span",uk,R(S(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),l.value?(k(),E("ul",ck,[(k(!0),E(Qe,null,Ot(Eo.value,w=>(k(),E("li",{key:w.id,class:"thread-row-item","data-menu-open":an(w.id)?"true":"false"},[Be(vo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Bn(w.id),"data-menu-open":an(w.id)?"true":"false","force-right-hover":an(w.id),onClick:L=>Ut(w.id),onMouseleave:L=>Wn(w.id,L),onContextmenu:L=>Ln(L,w.id)},{left:mt(()=>[m("span",fk,[ar(w)?(k(),E("span",{key:0,class:"thread-status-indicator","data-state":Ta(w)},null,8,hk)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Bt(w.id),title:Bt(w.id)?"Confirm delete":S(r)("Delete thread"),onClick:Ze(L=>Sr(w.id),["stop"])},[Bt(w.id)?(k(),E("span",mk,"Confirm")):(k(),at(hl,{key:1,class:"thread-icon"}))],8,pk)])]),right:mt(()=>[m("span",Tk,R(Ft(w)),1)]),"right-hover":mt(()=>[m("div",{ref_for:!0,ref:L=>ao(w.id,L),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ze(L=>Nn(w.id),["stop"])},[Be(gs,{class:"thread-icon"})],8,kk)],512)]),default:mt(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Ze(L=>Ut(w.id),["stop"])},[m("span",gk,[m("span",yk,[m("span",wk,R(w.title),1),w.hasWorktree?(k(),at(Ss,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),$t(w.id)?(k(),E("span",{key:1,class:"thread-row-automation-chip",title:Yt(w.id)}," Auto ",8,bk)):J("",!0),w.pendingRequestState?(k(),E("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},R(_a(w)),9,_k)):J("",!0)])])],8,vk)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,dk))),128))])):J("",!0)])):J("",!0),m("section",Ck,[Be(vo,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":c.value,onClick:Po},{left:mt(()=>[c.value?(k(),at(os,{key:1,class:"thread-icon"})):(k(),at(fi,{key:0,class:"thread-icon"}))]),right:mt(()=>[m("div",{ref_key:"organizeMenuWrapRef",ref:ye,class:"organize-menu-wrap"},[m("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Me.value,"aria-label":S(r)("Organize threads"),title:S(r)("Organize threads"),onClick:Ze(wt,["stop"])},[Be(gs,{class:"thread-icon"})],8,xk),Me.value?(k(),E("div",{key:0,class:"organize-menu-panel",onClick:b[4]||(b[4]=Ze(()=>{},["stop"]))},[m("p",Ak,R(S(r)("Organize")),1),m("button",{class:"organize-menu-item","data-active":xe.value==="project",type:"button",onClick:b[0]||(b[0]=w=>qt("project"))},[m("span",null,R(S(r)("By project")),1),xe.value==="project"?(k(),E("span",Ik,"✓")):J("",!0)],8,Ek),m("button",{class:"organize-menu-item","data-active":xe.value==="chronological",type:"button",onClick:b[1]||(b[1]=w=>qt("chronological"))},[m("span",null,R(S(r)("Chronological list")),1),xe.value==="chronological"?(k(),E("span",Rk,"✓")):J("",!0)],8,Pk),m("button",{class:"organize-menu-item","data-active":g.value,type:"button",onClick:En},[m("span",null,R(S(r)("Chats first")),1),g.value?(k(),E("span",$k,"✓")):J("",!0)],8,Mk),b[28]||(b[28]=m("div",{class:"organize-menu-separator"},null,-1)),m("p",Nk,R(S(r)("Sort by")),1),m("button",{class:"organize-menu-item","data-active":T.value==="created",type:"button",onClick:b[2]||(b[2]=w=>zt("created"))},[m("span",null,R(S(r)("Created")),1),T.value==="created"?(k(),E("span",jk,"✓")):J("",!0)],8,Lk),m("button",{class:"organize-menu-item","data-active":T.value==="updated",type:"button",onClick:b[3]||(b[3]=w=>zt("updated"))},[m("span",null,R(S(r)("Updated")),1),T.value==="updated"?(k(),E("span",Dk,"✓")):J("",!0)],8,Ok)])):J("",!0)],512)]),default:mt(()=>[m("span",Sk,R(S(r)("Projects")),1)]),_:1},8,["aria-expanded"]),c.value?(k(),E(Qe,{key:0},[Ce.value&&bt.value.length===0?(k(),E("p",Fk,R(S(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(k(),E("p",Uk,R(S(r)("Loading threads...")),1)):Dt.value?(k(),E("ul",Bk,[(k(!0),E(Qe,null,Ot(Tr.value,w=>(k(),E("li",{key:w.id,class:"thread-row-item","data-menu-open":an(w.id)?"true":"false"},[Be(vo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Bn(w.id),"data-menu-open":an(w.id)?"true":"false","force-right-hover":an(w.id),onClick:L=>Ut(w.id),onMouseleave:L=>Wn(w.id,L),onContextmenu:L=>Ln(L,w.id)},{left:mt(()=>[m("span",Hk,[ar(w)?(k(),E("span",{key:0,class:"thread-status-indicator","data-state":Ta(w)},null,8,Wk)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Bt(w.id),title:Bt(w.id)?"Confirm delete":S(r)("Delete thread"),onClick:Ze(L=>Sr(w.id),["stop"])},[Bt(w.id)?(k(),E("span",zk,"Confirm")):(k(),at(hl,{key:1,class:"thread-icon"}))],8,Vk)])]),right:mt(()=>[m("span",Zk,R(Ft(w)),1)]),"right-hover":mt(()=>[m("div",{ref_for:!0,ref:L=>ao(w.id,L),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ze(L=>Nn(w.id),["stop"])},[Be(gs,{class:"thread-icon"})],8,e1)],512)]),default:mt(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Ze(L=>Ut(w.id),["stop"])},[m("span",Kk,[m("span",Yk,[m("span",Qk,R(w.title),1),w.hasWorktree?(k(),at(Ss,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),$t(w.id)?(k(),E("span",{key:1,class:"thread-row-automation-chip",title:Yt(w.id)}," Auto ",8,Jk)):J("",!0),w.pendingRequestState?(k(),E("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},R(_a(w)),9,Xk)):J("",!0)])])],8,Gk)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,qk))),128))])):(k(),E("div",{key:3,ref_key:"groupsContainerRef",ref:ve,class:"thread-tree-groups",style:ca(Lt.value)},[(k(!0),E(Qe,null,Ot(bt.value,w=>(k(),E("article",{key:w.projectName,ref_for:!0,ref:L=>Fa(w.projectName,L),class:"project-group","data-project-name":w.projectName,"data-expanded":!At(w.projectName),"data-dragging":No(w.projectName),style:ca(Hr(w.projectName))},[Be(vo,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:L=>ro(w.projectName),onContextmenu:Ze(L=>rr(w.projectName),["prevent"]),onKeydown:[L=>Qo(L,w.projectName),nn(Ze(L=>ro(w.projectName),["prevent"]),["enter"]),nn(Ze(L=>ro(w.projectName),["prevent"]),["space"])]},{left:mt(()=>[m("span",n1,[m("span",r1,[At(w.projectName)?(k(),at(ld,{key:0,class:"thread-icon"})):(k(),at(WT,{key:1,class:"thread-icon"}))]),m("span",o1,[At(w.projectName)?(k(),at(fi,{key:0,class:"thread-icon"})):(k(),at(os,{key:1,class:"thread-icon"}))])])]),right:mt(()=>[m("div",i1,[m("div",{ref_for:!0,ref:L=>Fr(w.projectName,L),class:"project-menu-wrap"},[m("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Ze(L=>Gn(w.projectName),["stop"])},[Be(gs,{class:"thread-icon"})],8,l1),te(w.projectName)?(k(),E("div",{key:0,class:"project-menu-panel","data-open-direction":ee.value[w.projectName]??"down",onClick:b[6]||(b[6]=Ze(()=>{},["stop"]))},[Te.value==="actions"?(k(),E(Qe,{key:0},[m("button",{class:"project-menu-item",type:"button",onClick:L=>Ie(w.projectName)}," Browse files ",8,c1),e.projectGitRepoByName[w.projectName]?(k(),E("button",{key:0,class:"project-menu-item",type:"button",onClick:L=>Se(w.projectName)}," New worktree ",8,d1)):J("",!0),m("button",{class:"project-menu-item",type:"button",onClick:L=>cs(w)}," Rename project ",8,f1),m("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:L=>Dr(w.projectName)}," Remove ",8,h1)],64)):(k(),E(Qe,{key:1},[m("label",p1,R(S(r)("Project name")),1),jt(m("input",{"onUpdate:modelValue":b[5]||(b[5]=L=>Pe.value=L),class:"project-menu-input",type:"text",onInput:L=>ln(w.projectName)},null,40,m1),[[tn,Pe.value]])],64))],8,u1)):J("",!0)],512),m("button",{class:"thread-start-button",type:"button","aria-label":Hn(w.projectName),title:Hn(w.projectName),onClick:Ze(L=>Cr(w.projectName),["stop"])},[Be(Bs,{class:"thread-icon"})],8,v1)])]),default:mt(()=>[m("span",{class:"project-main-button","data-dragging-handle":No(w.projectName),onMousedown:Ze(L=>wn(L,w.projectName),["left"])},[m("span",{class:"project-title",title:xr(w.projectName)},R(F(w)),9,s1)],40,a1)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Ht(w)?(k(),E("ul",g1,[(k(!0),E(Qe,null,Ot(ea(w),L=>(k(),E("li",{key:L.id,class:"thread-row-item","data-menu-open":an(L.id)?"true":"false"},[Be(vo,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":Bn(L.id),"data-menu-open":an(L.id)?"true":"false","force-right-hover":an(L.id),onClick:_e=>Ut(L.id),onMouseleave:_e=>Wn(L.id,_e),onContextmenu:_e=>Ln(_e,L.id)},{left:mt(()=>[m("span",w1,[ar(L)?(k(),E("span",{key:0,class:"thread-status-indicator","data-state":Ta(L)},null,8,b1)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Bt(L.id),title:Bt(L.id)?"Confirm delete":S(r)("Delete thread"),onClick:Ze(_e=>Sr(L.id),["stop"])},[Bt(L.id)?(k(),E("span",T1,"Confirm")):(k(),at(hl,{key:1,class:"thread-icon"}))],8,_1)])]),right:mt(()=>[m("span",I1,R(Ft(L)),1)]),"right-hover":mt(()=>[m("div",{ref_for:!0,ref:_e=>ao(L.id,_e),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ze(_e=>Nn(L.id),["stop"])},[Be(gs,{class:"thread-icon"})],8,P1)],512)]),default:mt(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Ze(_e=>Ut(L.id),["stop"])},[m("span",C1,[m("span",S1,[m("span",x1,R(L.title),1),L.hasWorktree?(k(),at(Ss,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),$t(L.id)?(k(),E("span",{key:1,class:"thread-row-automation-chip",title:Yt(L.id)}," Auto ",8,A1)):J("",!0),L.pendingRequestState?(k(),E("span",{key:2,class:"thread-row-request-chip","data-state":L.pendingRequestState},R(_a(L)),9,E1)):J("",!0)])])],8,k1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,y1))),128))])):(k(),at(vo,{key:1,as:"p",class:"project-empty-row"},{left:mt(()=>[...b[29]||(b[29]=[m("span",{class:"project-empty-spacer"},null,-1)])]),default:mt(()=>[m("span",R1,R(S(r)("No threads")),1)]),_:1})),fo(w)?(k(),at(vo,{key:2,class:"thread-show-more-row"},{left:mt(()=>[...b[30]||(b[30]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:mt(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:L=>Jo(w.projectName)},R(Ar(w.projectName)?"Show less":"Show more"),9,M1)]),_:2},1024)):J("",!0)],12,t1))),128))],4))],64)):J("",!0)]),m("section",$1,[Be(vo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":h.value,onClick:Go},{left:mt(()=>[h.value?(k(),at(os,{key:1,class:"thread-icon"})):(k(),at(fi,{key:0,class:"thread-icon"}))]),right:mt(()=>[m("div",L1,[m("button",{class:"chats-section-action",type:"button","aria-label":S(r)("New chat"),title:S(r)("New chat"),onClick:b[7]||(b[7]=Ze(w=>y.$emit("start-new-chat"),["stop"]))},[Be(Bs,{class:"thread-icon"})],8,j1)])]),default:mt(()=>[m("span",N1,R(S(r)("Chats")),1)]),_:1},8,["aria-expanded"]),h.value&&cn.value.length===0?(k(),E("p",O1,R(S(r)("No chats")),1)):h.value?(k(),E("ul",D1,[(k(!0),E(Qe,null,Ot(Xr.value,w=>(k(),E("li",{key:w.id,class:"thread-row-item","data-menu-open":an(w.id)?"true":"false"},[Be(vo,{class:"thread-row","data-active":w.id===e.selectedThreadId,"data-pinned":Bn(w.id),"data-menu-open":an(w.id)?"true":"false","force-right-hover":an(w.id),onClick:L=>Ut(w.id),onMouseleave:L=>Wn(w.id,L),onContextmenu:L=>Ln(L,w.id)},{left:mt(()=>[m("span",U1,[ar(w)?(k(),E("span",{key:0,class:"thread-status-indicator","data-state":Ta(w)},null,8,B1)):J("",!0),m("button",{class:"thread-delete-button",type:"button","data-confirming":Bt(w.id),title:Bt(w.id)?"Confirm delete":S(r)("Delete thread"),onClick:Ze(L=>Sr(w.id),["stop"])},[Bt(w.id)?(k(),E("span",H1,"Confirm")):(k(),at(hl,{key:1,class:"thread-icon"}))],8,q1)])]),right:mt(()=>[m("span",Q1,R(Ft(w)),1)]),"right-hover":mt(()=>[m("div",{ref_for:!0,ref:L=>ao(w.id,L),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Ze(L=>Nn(w.id),["stop"])},[Be(gs,{class:"thread-icon"})],8,J1)],512)]),default:mt(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Ze(L=>Ut(w.id),["stop"])},[m("span",V1,[m("span",z1,[m("span",G1,R(w.title),1),w.hasWorktree?(k(),at(Ss,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):J("",!0),$t(w.id)?(k(),E("span",{key:1,class:"thread-row-automation-chip",title:Yt(w.id)}," Auto ",8,K1)):J("",!0),w.pendingRequestState?(k(),E("span",{key:2,class:"thread-row-request-chip","data-state":w.pendingRequestState},R(_a(w)),9,Y1)):J("",!0)])])],8,W1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,F1))),128))])):J("",!0),h.value&&zo.value?(k(),at(vo,{key:2,class:"thread-show-more-row"},{left:mt(()=>[...b[31]||(b[31]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:mt(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:Da},R(f.value?"Show less":"Show more"),1)]),_:1})):J("",!0)]),(k(),at(Ma,{to:"body"},[mn.value?(k(),E("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:de,class:"thread-menu-panel thread-menu-panel-fixed",style:ca(pe.value),"data-open-direction":io(mn.value.id),onClick:b[16]||(b[16]=Ze(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:b[8]||(b[8]=w=>Sn(mn.value.id))},R($t(mn.value.id)?"Manage automations…":"Add automation…"),1),m("button",{class:"thread-menu-item",type:"button",onClick:b[9]||(b[9]=w=>pr(mn.value.id))}," Browse files "),m("button",{class:"thread-menu-item",type:"button",onClick:b[10]||(b[10]=w=>Ro(mn.value.id))}," Copy path "),m("button",{class:"thread-menu-item",type:"button",onClick:b[11]||(b[11]=w=>nr(mn.value.id))}," Export chat "),m("button",{class:"thread-menu-item",type:"button",onClick:b[12]||(b[12]=w=>to(mn.value.id))}," Create chat fork "),m("button",{class:"thread-menu-item",type:"button",onClick:b[13]||(b[13]=w=>on(mn.value.id))},R(Bn(mn.value.id)?"Unpin thread":"Pin thread"),1),m("button",{class:"thread-menu-item",type:"button",onClick:b[14]||(b[14]=w=>jr(mn.value.id,mn.value.title))},R(S(r)("Rename thread")),1),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:b[15]||(b[15]=w=>Vn(mn.value.id,mn.value.title))},R(S(r)("Delete thread")),1)],12,X1)):J("",!0)])),(k(),at(Ma,{to:"body"},[K.value?(k(),E("div",{key:0,class:"rename-thread-overlay",onClick:Ze(Nt,["self"])},[m("div",Z1,[m("h3",eC,R(S(r)("Rename thread")),1),b[32]||(b[32]=m("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),jt(m("input",{ref_key:"renameThreadInputRef",ref:oe,"onUpdate:modelValue":b[17]||(b[17]=w=>ke.value=w),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[nn(Ze(Qt,["prevent"]),["enter"]),nn(Ze(Nt,["prevent"]),["esc"])]},null,40,tC),[[tn,ke.value]]),m("div",nC,[m("button",{class:"rename-thread-button",type:"button",onClick:Nt},R(S(r)("Cancel")),1),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Qt},R(S(r)("Save")),1)])])])):J("",!0)])),(k(),at(Ma,{to:"body"},[Re.value?(k(),E("div",{key:0,class:"rename-thread-overlay",onClick:Ze(mr,["self"])},[m("div",rC,[m("h3",oC,R(dr.value?"Archive chat and remove automations?":"Delete thread?"),1),m("p",aC,[dr.value?(k(),E(Qe,{key:0},[ls(' This will archive the thread "'+R(He.value)+'" and remove the attached heartbeat automations. ',1)],64)):(k(),E(Qe,{key:1},[ls(' This will archive the thread "'+R(He.value)+'". You can find it later in archived threads. ',1)],64))]),m("div",sC,[m("button",{class:"rename-thread-button",type:"button",onClick:mr},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:no},R(dr.value?"Archive and remove":"Delete"),1)])])])):J("",!0)])),(k(),at(Ma,{to:"body"},[Fe.value?(k(),E("div",{key:0,class:"rename-thread-overlay",onClick:Ze(sn,["self"])},[m("div",iC,[m("h3",lC,R(Ge.value==="edit"?"Edit automation":"Add automation"),1),b[40]||(b[40]=m("p",{class:"rename-thread-subtitle"},"This creates heartbeat automations attached to the selected thread.",-1)),Q.value.length>0?(k(),E("div",uC,[(k(!0),E(Qe,null,Ot(Q.value,w=>(k(),E("button",{key:w.id,class:rt(["automation-thread-list-item",{"is-active":w.id===et.value}]),type:"button",onClick:L=>Tt(w.id)},[m("span",null,R(w.name),1),m("small",null,R(w.status==="PAUSED"?"Paused":"Active"),1)],10,cC))),128)),m("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:Ct}," Add another automation ")])):J("",!0),m("label",dC,[b[33]||(b[33]=m("span",{class:"automation-thread-label"},"Name",-1)),jt(m("input",{"onUpdate:modelValue":b[18]||(b[18]=w=>Xe.value.name=w),class:"rename-thread-input",type:"text",placeholder:"Automation name"},null,512),[[tn,Xe.value.name]])]),m("label",fC,[b[34]||(b[34]=m("span",{class:"automation-thread-label"},"Prompt",-1)),jt(m("textarea",{"onUpdate:modelValue":b[19]||(b[19]=w=>Xe.value.prompt=w),class:"automation-thread-textarea",rows:"6",placeholder:"Describe what the automation should do"},null,512),[[tn,Xe.value.prompt]])]),m("div",hC,[b[38]||(b[38]=m("span",{class:"automation-thread-label"},"Schedule",-1)),m("div",pC,[m("button",{class:rt(["automation-schedule-mode",{"is-active":nt.value.mode==="daily"}]),type:"button",onClick:b[20]||(b[20]=w=>hr("daily"))}," Daily ",2),m("button",{class:rt(["automation-schedule-mode",{"is-active":nt.value.mode==="interval"}]),type:"button",onClick:b[21]||(b[21]=w=>hr("interval"))}," Interval ",2),m("button",{class:rt(["automation-schedule-mode",{"is-active":nt.value.mode==="advanced"}]),type:"button",onClick:b[22]||(b[22]=w=>hr("advanced"))}," RRULE ",2)]),nt.value.mode==="daily"?(k(),E("div",mC,[b[35]||(b[35]=m("span",{class:"automation-schedule-copy"},"Run every day at",-1)),jt(m("input",{"onUpdate:modelValue":b[23]||(b[23]=w=>nt.value.dailyTime=w),class:"automation-schedule-time",type:"time",onInput:$n},null,544),[[tn,nt.value.dailyTime]])])):nt.value.mode==="interval"?(k(),E("div",vC,[b[37]||(b[37]=m("span",{class:"automation-schedule-copy"},"Run every",-1)),jt(m("input",{"onUpdate:modelValue":b[24]||(b[24]=w=>nt.value.interval=w),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:$n},null,544),[[tn,nt.value.interval,void 0,{number:!0}]]),jt(m("select",{"onUpdate:modelValue":b[25]||(b[25]=w=>nt.value.intervalUnit=w),class:"automation-schedule-unit",onChange:$n},[...b[36]||(b[36]=[m("option",{value:"minutes"},"minutes",-1),m("option",{value:"hours"},"hours",-1),m("option",{value:"days"},"days",-1)])],544),[[Af,nt.value.intervalUnit]])])):J("",!0),nt.value.mode==="advanced"?jt((k(),E("input",{key:2,"onUpdate:modelValue":b[26]||(b[26]=w=>Xe.value.rrule=w),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:tr},null,544)),[[tn,Xe.value.rrule]]):J("",!0),m("p",gC,R(Ee.value),1)]),m("label",yC,[b[39]||(b[39]=m("span",{class:"automation-thread-label"},"Status",-1)),jt(m("select",{"onUpdate:modelValue":b[27]||(b[27]=w=>Xe.value.status=w),class:"automation-thread-select"},[m("option",wC,R(S(r)("Active")),1),m("option",bC,R(S(r)("Paused")),1)],512),[[Af,Xe.value.status]])]),Je.value?(k(),E("p",_C,R(Je.value),1)):Ke.value?(k(),E("p",TC,R(Ke.value),1)):J("",!0),m("div",kC,[Ge.value==="edit"?(k(),E("button",{key:0,class:"rename-thread-button",type:"button",disabled:it.value||qe.value,onClick:vn},R(qe.value?"Running…":"Run now"),9,CC)):J("",!0),Ge.value==="edit"?(k(),E("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:it.value||qe.value,onClick:xn}," Remove ",8,SC)):J("",!0),m("button",{class:"rename-thread-button",type:"button",disabled:it.value||qe.value,onClick:sn},R(S(r)("Cancel")),9,xC),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:it.value||qe.value,onClick:Yo},R(it.value?"Saving…":"Save"),9,AC)])])])):J("",!0)]))],2))}}),PC=xt(IC,[["__scopeId","data-v-fc4cffd1"]]),RC={class:"content-header"},MC=["title"],$C={class:"content-actions"},NC=Fn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(k(),E("header",RC,[m("div",{class:rt(["content-leading",{"is-accent":e.accent}])},[Ho(t.$slots,"leading",{},void 0)],2),m("h1",{class:rt(["content-title",{"is-accent":e.accent}]),title:e.title},R(e.title),11,MC),m("div",$C,[Ho(t.$slots,"actions",{},void 0)])]))}}),LC=xt(NC,[["__scopeId","data-v-f96f7210"]]),bh=.0025,Ju=3,_h=2,jC=256;function OC(e){var ke;const t=x("idle"),n=x(typeof navigator<"u"&&!!((ke=navigator.mediaDevices)!=null&&ke.getUserMedia)),r=x(0),a=x(null);let o=null,s=null,l=[],c=null,h=null,f=null,g=null,T=[],I=!1,j=!1,B=null;function X(){B&&(B.abort(),B=null),t.value==="transcribing"&&(t.value="idle")}function U(){const oe=a.value;if(!oe||typeof window>"u")return;const Re=oe.getContext("2d");if(!Re)return;const ze=Math.max(1,Math.floor(oe.clientWidth)),He=Math.max(1,Math.floor(oe.clientHeight||36)),Ne=window.devicePixelRatio||1,Fe=Math.max(1,Math.floor(ze*Ne)),Le=Math.max(1,Math.floor(He*Ne));(oe.width!==Fe||oe.height!==Le)&&(oe.width=Fe,oe.height=Le),Re.setTransform(Ne,0,0,Ne,0,0),Re.clearRect(0,0,ze,He);const et=Math.max(12,Math.floor(ze/(Ju+_h))),Ge=T.slice(-et),Je=Math.max(0,et-Ge.length),Ke=He/2,it=getComputedStyle(oe).color||"#000000";for(let qe=0;qe<et;qe+=1){const Xe=Ge[qe-Je]??0,Q=Math.max(.08,Math.min(1,Xe*18))*Ke,Ee=qe*(Ju+_h);Re.globalAlpha=Xe<=bh?.35:1,Re.fillStyle=it,Re.fillRect(Ee,Ke-Q,Ju,Q*2)}Re.globalAlpha=1}function O(){T=[],r.value=0,U()}function G(){f&&(f.disconnect(),f.onaudioprocess=null,f=null),h&&(h.disconnect(),h=null),c&&(c.close(),c=null),g=null}function ee(oe){if(typeof window>"u")return;const Re=window.webkitAudioContext,ze=window.AudioContext??Re;ze&&(G(),O(),c=new ze,h=c.createMediaStreamSource(oe),f=c.createScriptProcessor(2048,1,1),g=performance.now(),f.onaudioprocess=He=>{const Ne=He.inputBuffer.getChannelData(0);let Fe=0;for(let Le=0;Le<Ne.length;Le+=1){const et=Math.abs(Ne[Le]??0);Fe+=et<bh?0:et}T.push(Fe/Ne.length),T.length>jC&&T.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),U()},h.connect(f),f.connect(c.destination),U())}async function be(){var oe;if(t.value==="transcribing"&&X(),!(t.value!=="idle"||!n.value||I)){I=!0,j=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],o=new MediaRecorder(s),o.ondataavailable=Re=>{Re.data.size>0&&l.push(Re.data)},o.onstop=()=>{var He;const Re=l,ze=(o==null?void 0:o.mimeType)||((He=Re[0])==null?void 0:He.type)||"audio/webm";K(),Pe(Re,ze)},ee(s),o.start(250),t.value="recording",j&&pe()}catch(Re){K(),t.value="idle",(oe=e.onError)==null||oe.call(e,Re)}finally{I=!1}}}function pe(){if(I&&t.value==="idle"){j=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function Te(){j=!1,X(),K(),t.value="idle"}async function Pe(oe,Re){var Ne,Fe,Le,et,Ge;if(oe.length===0){(Ne=e.onEmpty)==null||Ne.call(e),t.value="idle";return}const ze=new Blob(oe,{type:Re});t.value="transcribing";let He=null;try{const Je=Re.split(/[/;]/)[1]??"webm",Ke=new FormData;Ke.append("file",ze,`codex.${Je}`);const it=((Fe=e.getLanguage)==null?void 0:Fe.call(e).trim())??"";it&&it.toLowerCase()!=="auto"&&Ke.append("language",it),He=new AbortController,B=He;const qe=await fetch("/codex-api/transcribe",{method:"POST",body:Ke,signal:He.signal}),Xe=await qe.text();let nt=null;try{nt=Xe.trim()?JSON.parse(Xe):null}catch{nt=null}if(!qe.ok){const Ee=(Le=nt==null?void 0:nt.error)==null?void 0:Le.trim(),ve=Xe.trim();throw new Error(Ee||ve||`Transcription failed: ${qe.status}`)}const Q=((nt==null?void 0:nt.text)??"").trim();Q.length>0?e.onTranscript(Q):(et=e.onEmpty)==null||et.call(e)}catch(Je){if(Je instanceof DOMException&&Je.name==="AbortError")return;(Ge=e.onError)==null||Ge.call(e,Je)}finally{He&&B===He&&(B=null),t.value==="transcribing"&&(t.value="idle")}}function K(){G(),O(),o&&(o.ondataavailable=null,o.onstop=null,o=null),s&&(s.getTracks().forEach(oe=>oe.stop()),s=null),l=[]}ja(()=>{Te()});function ge(){if(t.value==="recording"){pe();return}(t.value==="idle"||t.value==="transcribing")&&be()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:a,startRecording:be,stopRecording:pe,toggleRecording:ge,cancel:Te}}const DC={},FC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function UC(e,t){return k(),E("svg",FC,[...t[0]||(t[0]=[m("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 BC=xt(DC,[["render",UC]]),qC={},HC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function WC(e,t){return k(),E("svg",HC,[...t[0]||(t[0]=[m("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 Sl=xt(qC,[["render",WC]]),VC={},zC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function GC(e,t){return k(),E("svg",zC,[...t[0]||(t[0]=[m("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 KC=xt(VC,[["render",GC]]),YC={},QC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function JC(e,t){return k(),E("svg",QC,[...t[0]||(t[0]=[m("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),m("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 Th=xt(YC,[["render",JC]]),XC=["title","aria-label","disabled"],ZC={key:1,class:"composer-dropdown-value"},eS={class:"composer-dropdown-menu"},tS={key:0,class:"composer-dropdown-search-wrap"},nS=["placeholder","onKeydown"],rS={class:"composer-dropdown-options",role:"listbox"},oS=["onClick"],aS={key:0,class:"composer-dropdown-empty"},sS=Fn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,a=x(null),o=x(null),s=x(!1),l=x(""),c=Z(()=>{var be;const ee=n.options.find(pe=>pe.value===n.modelValue);return ee?ee.label:((be=n.placeholder)==null?void 0:be.trim())||""}),h=Z(()=>n.openDirection??"down"),f=Z(()=>n.iconOnly===!0),g=Z(()=>n.enableSearch===!0),T=Z(()=>{var ee;return((ee=n.searchPlaceholder)==null?void 0:ee.trim())||"Quick search projects"}),I=Z(()=>{var ee;return((ee=n.emptyLabel)==null?void 0:ee.trim())||"No results"}),j=Z(()=>{var ee;return c.value||((ee=n.placeholder)==null?void 0:ee.trim())||"Select option"}),B=Z(()=>{const ee=l.value.trim().toLowerCase();return ee?n.options.filter(be=>be.label.toLowerCase().includes(ee)||be.value.toLowerCase().includes(ee)):n.options});function X(){n.disabled||(s.value=!s.value)}function U(ee){r("update:modelValue",ee),s.value=!1,l.value=""}function O(){if(l.value.length>0){l.value="";return}s.value=!1}function G(ee){if(!s.value)return;const be=a.value;if(!be)return;const pe=ee.target;pe instanceof Node&&(be.contains(pe)||(s.value=!1,l.value=""))}return pt(s,ee=>{ee&&g.value&&Kt(()=>{var be;return(be=o.value)==null?void 0:be.focus()})}),va(()=>{window.addEventListener("pointerdown",G)}),ja(()=>{window.removeEventListener("pointerdown",G)}),(ee,be)=>(k(),E("div",{ref_key:"rootRef",ref:a,class:"composer-dropdown"},[m("button",{class:"composer-dropdown-trigger",type:"button",title:j.value,"aria-label":j.value,disabled:e.disabled,onClick:X},[e.selectedPrefixIcon?(k(),at(Kc(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):J("",!0),f.value?J("",!0):(k(),E("span",ZC,R(c.value),1)),Be(os,{class:"composer-dropdown-chevron"})],8,XC),s.value?(k(),E("div",{key:0,class:rt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":h.value==="up","composer-dropdown-menu-wrap-down":h.value==="down"}])},[m("div",eS,[g.value?(k(),E("div",tS,[jt(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":be[0]||(be[0]=pe=>l.value=pe),class:"composer-dropdown-search-input",type:"text",placeholder:T.value,onKeydown:nn(Ze(O,["prevent"]),["esc"])},null,40,nS),[[tn,l.value]])])):J("",!0),m("ul",rS,[(k(!0),E(Qe,null,Ot(B.value,pe=>(k(),E("li",{key:pe.value},[m("button",{class:rt(["composer-dropdown-option",{"is-selected":pe.value===e.modelValue}]),type:"button",onClick:Te=>U(pe.value)},R(pe.label),11,oS)]))),128)),B.value.length===0?(k(),E("li",aS,R(I.value),1)):J("",!0)])])],2)):J("",!0)],512))}}),xs=xt(sS,[["__scopeId","data-v-5243a93d"]]),iS=["disabled"],lS={class:"search-dropdown-value"},uS={class:"search-dropdown-search-wrap"},cS={class:"search-dropdown-search-row"},dS=["placeholder","onKeydown"],fS=["aria-label","title"],hS={key:0,class:"search-dropdown-list",role:"listbox"},pS=["onPointerenter"],mS=["onClick"],vS={class:"search-dropdown-option-check"},gS=["title"],yS={class:"search-dropdown-option-copy"},wS={class:"search-dropdown-option-label-row"},bS={class:"search-dropdown-option-label"},_S={key:0,class:"search-dropdown-option-type"},TS={key:0,class:"search-dropdown-option-desc"},kS=["aria-label","title","onClick"],CS={key:1,class:"search-dropdown-empty"},SS=Fn({__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,a=x(null),o=x(null),s=x(null),l=x(!1),c=x(""),h=x(0),f=x({}),{t:g}=Oa(),T=Z(()=>n.openDirection??"down"),I=Z(()=>new Set(n.selectedValues)),j=Z(()=>{var Te;if((Te=n.displayLabelOverride)!=null&&Te.trim())return n.displayLabelOverride.trim();if(n.selectedValues.length===0)return n.placeholder||g("Select...");if(n.selectedValues.length===1){const Pe=n.options.find(K=>K.value===n.selectedValues[0]);return(Pe==null?void 0:Pe.label)||n.placeholder||g("Select...")}return`${n.selectedValues.length} ${g("selected")}`}),B=Z(()=>{const Te=c.value.toLowerCase().trim();return Te?n.options.filter(Pe=>{var K;return Pe.label.toLowerCase().includes(Te)||(((K=Pe.description)==null?void 0:K.toLowerCase().includes(Te))??!1)}):n.options});function X(){const Te=o.value,Pe=a.value;if(!Te||!Pe)return;const K=Pe.getBoundingClientRect(),ge=window.innerWidth,ke=window.innerHeight,oe=Math.min(384,ge-16),Re=Math.max(8,Math.min(K.right-oe,ge-oe-8));if(ge<640){f.value={position:"fixed",left:"0.5rem",right:"0.5rem",width:"auto",top:T.value==="up"?"auto":`${K.bottom+8}px`,bottom:T.value==="up"?`${ke-K.top+8}px`:"auto",zIndex:"120"};return}f.value={position:"fixed",width:`${oe}px`,left:`${Re}px`,top:T.value==="up"?"auto":`${K.bottom+8}px`,bottom:T.value==="up"?`${ke-K.top+8}px`:"auto",zIndex:"120"}}function U(){n.disabled||(l.value=!l.value,l.value&&(c.value="",h.value=0,Kt(()=>{var Te;Kt(()=>{X()}),(Te=s.value)==null||Te.focus()})))}function O(Te){r("toggle",Te.value,!I.value.has(Te.value)),l.value=!1}function G(Te){B.value.length!==0&&(h.value=(h.value+Te+B.value.length)%B.value.length)}function ee(){const Te=B.value[h.value];Te&&O(Te)}function be(Te){if(!l.value)return;const Pe=a.value,K=o.value;if(!Pe)return;const ge=Te.target;ge instanceof Node&&(Pe.contains(ge)||K!=null&&K.contains(ge)||(l.value=!1))}pt(c,()=>{h.value=0});function pe(){l.value&&X()}return va(()=>{window.addEventListener("pointerdown",be),window.addEventListener("resize",pe),window.addEventListener("scroll",pe,!0)}),ja(()=>{window.removeEventListener("pointerdown",be),window.removeEventListener("resize",pe),window.removeEventListener("scroll",pe,!0)}),(Te,Pe)=>(k(),E("div",{ref_key:"rootRef",ref:a,class:"search-dropdown"},[m("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:U},[m("span",lS,R(j.value),1),Be(os,{class:"search-dropdown-chevron"})],8,iS),(k(),at(Ma,{to:"body"},[l.value?(k(),E("div",{key:0,ref_key:"menuRef",ref:o,class:rt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":T.value==="up","search-dropdown-menu-wrap-down":T.value==="down"}]),style:ca(f.value)},[m("div",uS,[m("div",cS,[jt(m("input",{ref_key:"searchRef",ref:s,"onUpdate:modelValue":Pe[0]||(Pe[0]=K=>c.value=K),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[Pe[1]||(Pe[1]=nn(Ze(K=>l.value=!1,["prevent"]),["escape"])),nn(Ze(ee,["prevent"]),["enter"]),Pe[2]||(Pe[2]=nn(Ze(K=>G(1),["prevent"]),["arrow-down"])),Pe[3]||(Pe[3]=nn(Ze(K=>G(-1),["prevent"]),["arrow-up"]))]},null,40,dS),[[tn,c.value]]),e.createLabel?(k(),E("button",{key:0,class:"search-dropdown-create-icon",type:"button","aria-label":e.createLabel,title:e.createLabel,onClick:Pe[4]||(Pe[4]=K=>r("create"))}," + ",8,fS)):J("",!0)]),e.createLabel?(k(),E("button",{key:0,class:"search-dropdown-create",type:"button",onClick:Pe[5]||(Pe[5]=K=>r("create"))},R(e.createLabel),1)):J("",!0)]),B.value.length>0?(k(),E("ul",hS,[(k(!0),E(Qe,null,Ot(B.value,(K,ge)=>(k(),E("li",{key:K.value},[m("div",{class:rt(["search-dropdown-option",{"is-selected":I.value.has(K.value),"is-highlighted":ge===h.value}]),onPointerenter:ke=>h.value=ge},[m("button",{class:"search-dropdown-option-main",type:"button",onClick:ke=>O(K)},[m("span",vS,R(I.value.has(K.value)?"✓":""),1),K.badge?(k(),E("span",{key:0,class:rt(["search-dropdown-option-badge",K.badgeTone?`is-${K.badgeTone}`:""]),title:K.badgeLabel||K.badge,"aria-hidden":"true"},R(K.badge),11,gS)):J("",!0),m("span",yS,[m("span",wS,[m("span",bS,R(K.label),1),K.badgeLabel?(k(),E("span",_S,R(K.badgeLabel),1)):J("",!0)]),K.description?(k(),E("span",TS,R(K.description),1)):J("",!0)])],8,mS),e.allowRemove&&K.removable?(k(),E("button",{key:0,class:"search-dropdown-option-remove",type:"button","aria-label":`${e.removeLabel} ${K.label}`,title:`${e.removeLabel} ${K.label}`,onClick:Ze(ke=>r("remove",K.value),["stop"])}," × ",8,kS)):J("",!0)],42,pS)]))),128))])):(k(),E("div",CS,R(S(g)("No results")),1))],6)):J("",!0)]))],512))}}),xS=xt(SS,[["__scopeId","data-v-65ed7fdf"]]),AS={key:0,class:"thread-composer-dictation-error"},ES={key:0,class:"thread-composer-attachments"},IS=["src","alt"],PS=["aria-label","disabled","onClick"],RS={key:1,class:"thread-composer-folder-chips"},MS=["title"],$S={class:"thread-composer-folder-chip-meta"},NS=["aria-label","disabled","onClick"],LS={key:2,class:"thread-composer-file-chips"},jS=["title"],OS=["aria-label","disabled","onClick"],DS={key:3,class:"thread-composer-skill-chips"},FS=["title","aria-label","onClick"],US=["aria-label","onClick"],BS={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},qS={key:1,class:"thread-composer-file-mentions"},HS=["onMousedown"],WS={key:1,class:"thread-composer-file-mention-icon-markdown"},VS={class:"thread-composer-file-mention-text"},zS={class:"thread-composer-file-mention-name"},GS={key:0,class:"thread-composer-file-mention-dir"},KS={key:1,class:"thread-composer-file-mention-empty"},YS=["placeholder","disabled"],QS=["aria-label","disabled"],JS={key:0,class:"thread-composer-attach-menu"},XS=["disabled"],ZS=["disabled"],ex=["disabled"],tx={class:"thread-composer-attach-mode"},nx={class:"thread-composer-attach-mode-label"},rx={class:"thread-composer-attach-mode-buttons"},ox=["disabled"],ax=["disabled"],sx=["aria-checked","aria-label","disabled"],ix={class:"thread-composer-attach-setting-copy"},lx={class:"thread-composer-attach-setting-label"},ux={class:"thread-composer-attach-setting-description"},cx=["aria-checked","aria-label","disabled"],dx={class:"thread-composer-attach-setting-copy"},fx={class:"thread-composer-attach-setting-label"},hx={class:"thread-composer-attach-setting-description"},px={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},mx={key:1,class:"thread-composer-dictation-timer"},vx=["aria-label","title","disabled"],gx=["aria-label","title","disabled"],yx={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},wx=["aria-label","title","disabled"],bx=["disabled"],_x=["disabled"],Tx=["disabled"],kx=2e3,Xu="prompt:",Cx="codex-web-local.thread-draft.v1.",Sx=Fn({__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,a=n,{t:o}=Oa(),s=x(""),l=x([]),c=x([]),h=x([]),f=x([]),g=x([]),T=x(""),I=x(0),j=x(null),B=x(!1),{state:X,isSupported:U,recordingDurationMs:O,waveformCanvasRef:G,startRecording:ee,stopRecording:be,toggleRecording:pe,cancel:Te}=OC({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:P=>{if(s.value=s.value?`${s.value}
|
|
48
|
+
${P}`:P,T.value="",r.dictationAutoSend!==!1){const F=r.isTurnInProgress?je.value:"steer";Ce(F);return}Kt(()=>{var F;return(F=oe.value)==null?void 0:F.focus()})},onEmpty:()=>{T.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:P=>{if(P instanceof DOMException&&P.name==="NotAllowedError"){T.value="Microphone access was denied.";return}T.value=P instanceof Error?P.message:"Dictation failed."}}),Pe=x(null),K=x(null),ge=x(null),ke=x(null),oe=x(null),{isMobile:Re}=rd(),ze=x(!1),He=x(null),Ne=x(""),Fe=x([]),Le=x(!1),et=x(0),Ge=x(0);let Je=0,Ke=null,it=!1,qe=0,Xe=0;const nt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let Q="";const Ee=[{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 ve(P){return P.trim().replace(/^gpt/i,"GPT")}const Oe=Z(()=>r.models.map(P=>({value:P,label:ve(P)}))),We=Z(()=>r.selectedCollaborationMode==="plan"),A=Z(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),$=Z(()=>c.value.map(P=>P.path)),V=Z(()=>[...(r.skills??[]).map(P=>{const F=An(P);return{value:P.path,label:P.name,description:P.description,badge:F.badge,badgeLabel:F.badgeLabel,badgeTone:F.badgeTone,removable:!1}}),...h.value.map(P=>({value:yn(P.path),label:P.name,description:P.description,badge:"T",badgeLabel:"Prompt",badgeTone:"prompt",removable:!0}))]),ne=Z(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||A.value||I.value>0?!1:s.value.trim().length>0||l.value.length>0||f.value.length>0),le=Z(()=>s.value.trim().length>0||l.value.length>0||c.value.length>0||f.value.length>0||g.value.length>0),ae=Z(()=>{const P=new Set;for(const F of g.value)for(const te of F.filePaths)P.add(te);return f.value.filter(F=>!P.has(F.fsPath))}),he=Z(()=>r.disabled||!r.activeThreadId),ue=Z(()=>r.disabled||!r.activeThreadId),ye=Z(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(r.selectedModel.trim())),de=Z(()=>r.selectedSpeedMode==="fast"&&ye.value),Me=Z(()=>he.value||r.isUpdatingSpeedMode===!0),xe=Z(()=>r.isUpdatingSpeedMode?o("Saving speed setting..."):r.selectedSpeedMode==="fast"?o("About 1.5x faster, with credits used at 2x"):o("Default speed with normal credit usage")),$e=Z(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),je=x($e.value),tt=Z(()=>X.value==="recording"),D=Z(()=>X.value==="recording"?o("Stop dictation"):r.dictationClickToToggle?o("Click to dictate"):o("Hold to dictate")),q=Z(()=>X.value==="idle"?T.value.trim():""),W=Z(()=>{const P=Math.max(0,Math.floor(O.value/1e3)),F=Math.floor(P/60),te=P%60;return`${F}:${String(te).padStart(2,"0")}`}),se=Z(()=>r.activeThreadId?A.value?o("Loading models for plan mode..."):o("Type a message... (@ for files)"):o("Select a thread to send a message")),me=Z(()=>s.value.trim().length>0||l.value.length>0||f.value.length>0);function Ce(P="steer"){var te;const F=s.value.trim();if(ne.value){if(a("submit",{text:F,imageUrls:l.value.map(Ae=>Ae.url),fileAttachments:[...f.value],skills:c.value.map(Ae=>({name:Ae.name,path:Ae.path})),mode:P}),Tr(r.activeThreadId),ht(),g.value=[],ze.value=!1,Nt(),nt||Re.value){(te=oe.value)==null||te.blur();return}Kt(()=>{var Ae;return(Ae=oe.value)==null?void 0:Ae.focus()})}}function Ue(P){je.value=P}function vt(P){Ge.value+=1,s.value=P.text,l.value=P.imageUrls.map((F,te)=>({id:`queued-${Date.now()}-${te}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${te+1}`,url:F})),c.value=P.skills.map(F=>(r.skills??[]).find(te=>te.path===F.path)??{name:F.name,displayName:void 0,description:"",path:F.path}),f.value=P.fileAttachments.map(F=>({...F})),g.value=[],T.value="",j.value=null,I.value=0,ze.value=!1,Nt(),Xe+=1}function ht(){vt({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function ot(P){return`${Cx}${P}`}function bt(P){if(typeof window>"u")return null;const F=P.trim();if(!F)return null;try{const te=window.localStorage.getItem(ot(F));if(!te)return null;const Ae=JSON.parse(te);return typeof Ae=="string"?{text:Ae,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Ae.text=="string"?Ae.text:"",imageUrls:Array.isArray(Ae.imageUrls)?Ae.imageUrls.filter(wt=>typeof wt=="string"):[],fileAttachments:Array.isArray(Ae.fileAttachments)?Ae.fileAttachments.filter(wt=>!!wt&&typeof wt.label=="string"&&typeof wt.path=="string"&&typeof wt.fsPath=="string"):[],skills:Array.isArray(Ae.skills)?Ae.skills.filter(wt=>!!wt&&typeof wt.name=="string"&&typeof wt.path=="string"):[]}}catch{return null}}function Dt(P,F){if(typeof window>"u")return;const te=P.trim();if(te)try{if(F.text.trim().length>0||F.imageUrls.length>0||F.fileAttachments.length>0||F.skills.length>0){window.localStorage.setItem(ot(te),JSON.stringify(F));return}window.localStorage.removeItem(ot(te))}catch{}}function Tr(P){Dt(P,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function cn(){return{text:s.value,imageUrls:l.value.map(P=>P.url),fileAttachments:f.value.map(P=>({...P})),skills:c.value.map(P=>({name:P.name,path:P.path}))}}function Xr(){a("interrupt")}function zo(P){a("update:selected-model",P)}function pn(){a("update:selected-collaboration-mode",We.value?"default":"plan")}function gn(P){a("update:selected-reasoning-effort",P)}function $r(){Me.value||a("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function dr(){r.dictationClickToToggle&&(T.value&&(T.value=""),pe())}function kr(P){if(r.dictationClickToToggle||(P.preventDefault(),it))return;it=!0;const F=P.currentTarget;if(F)try{F.setPointerCapture(P.pointerId)}catch{}T.value&&(T.value=""),window.addEventListener("pointerup",rn),window.addEventListener("pointercancel",rn),window.addEventListener("blur",rn),ee()}function rn(){r.dictationClickToToggle||it&&(it=!1,window.removeEventListener("pointerup",rn),window.removeEventListener("pointercancel",rn),window.removeEventListener("blur",rn),be())}function Ao(){he.value||(ze.value=!ze.value)}function mn(){var P;(P=K.value)==null||P.click()}function Eo(){var P;(P=ge.value)==null||P.click()}function Io(){var P;(P=ke.value)==null||P.click()}function Po(P){l.value=l.value.filter(F=>F.id!==P)}function Go(P){c.value=c.value.filter(F=>F.path!==P)}function Nr(P){const F=P.trim();return F?F.endsWith("/SKILL.md")?F:`${F.replace(/\/+$/,"")}/SKILL.md`:""}function gt(P){const F=Nr(P.path);!F||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(F)}`,"_blank","noopener,noreferrer")}function Un(P){f.value=f.value.filter(F=>F.fsPath!==P)}function Lt(P){const F=g.value.find(Ae=>Ae.id===P);if(!F)return;const te=new Set(F.filePaths);f.value=f.value.filter(Ae=>!te.has(Ae.fsPath)),g.value=g.value.filter(Ae=>Ae.id!==P)}function er(P){return P.total<=0?0:Math.round(P.processed/P.total*100)}function Ft(P,F){const te=P.replace(/\\/g,"/");if(f.value.some(qt=>qt.fsPath===te))return;const Ae=te.split("/").filter(Boolean),wt=(F==null?void 0:F.trim())||Ae[Ae.length-1]||te;f.value=[...f.value,{label:wt,path:te,fsPath:te}]}function Bn(P){return P.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(P.name)}function Rn(P){return P?Array.from(P):[]}function on(P){return P!==Xe?!1:(I.value+=1,!0)}function Ut(P){P===Xe&&(I.value=Math.max(0,I.value-1))}function $t(P){if(P<=0)return;const F=j.value,te=F?F.succeeded+F.failed:0;if(!F||te>=F.total){j.value={total:P,succeeded:0,failed:0};return}j.value={...F,total:F.total+P}}function Yt(P){const F=j.value;F&&(j.value={...F,succeeded:F.succeeded+(P==="success"?1:0),failed:F.failed+(P==="failure"?1:0)})}function qn(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function fr(P){const F=new Date,te=[F.getFullYear(),String(F.getMonth()+1).padStart(2,"0"),String(F.getDate()).padStart(2,"0"),String(F.getHours()).padStart(2,"0"),String(F.getMinutes()).padStart(2,"0"),String(F.getSeconds()).padStart(2,"0")].join("-"),Ae=P.type.startsWith("image/")&&P.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${te}.${Ae}`}function Ko(){const P=new Date;return`pasted-text-${[P.getFullYear(),String(P.getMonth()+1).padStart(2,"0"),String(P.getDate()).padStart(2,"0"),String(P.getHours()).padStart(2,"0"),String(P.getMinutes()).padStart(2,"0"),String(P.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Zr(P){return P.name.trim()?P:new File([P],fr(P),{type:P.type||"image/png",lastModified:Date.now()})}async function eo(P,F){if(on(F))try{const te=Zr(P),Ae=await Qu(te);if(F!==Xe)return;if(!Ae){Yt("failure");return}l.value=[...l.value,{id:qn(),name:te.name,url:`/codex-local-image?path=${encodeURIComponent(Ae)}`}],Yt("success")}catch{F===Xe&&Yt("failure")}finally{Ut(F)}}async function Lr(P,F){if(on(F))try{const te=await Qu(P);if(F!==Xe)return;if(!te){Yt("failure");return}Ft(te),Yt("success")}catch{F===Xe&&Yt("failure")}finally{Ut(F)}}function Mn(P){const F=Rn(P);if(F.length===0)return;$t(F.length),ze.value=!1,Nt();const te=Xe;for(const Ae of F)Bn(Ae)?eo(Ae,te):Lr(Ae,te)}function $n(){qe=0,B.value=!1}function tr(P){return P?Array.from(P.types??[]).includes("Files"):!1}async function hr(P){if(!P||P.length===0)return;const F=Ge.value,te=Array.from(P),wt=(te[0].webkitRelativePath||te[0].name).split("/").filter(Boolean)[0]||"Folder",qt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;g.value=[...g.value,{id:qt,name:wt,total:te.length,processed:0,filePaths:[],isUploading:!0}];const En=zt=>{F===Ge.value&&(g.value=g.value.map(Jt=>Jt.id===qt?zt(Jt):Jt))};for(const zt of te)try{const Jt=await Qu(zt);if(F!==Ge.value)return;if(Jt){const Gn=zt.webkitRelativePath||zt.name;Ft(Jt,Gn),En(rr=>({...rr,processed:rr.processed+1,filePaths:[...rr.filePaths,Jt]}));continue}En(Gn=>({...Gn,processed:Gn.processed+1}))}catch{En(Jt=>({...Jt,processed:Jt.processed+1}))}En(zt=>({...zt,isUploading:!1}))}function nr(P){P&&(P.value="")}function to(P){const F=P.target;Mn((F==null?void 0:F.files)??null),nr(F),ze.value=!1}function Hn(P){const F=P.target;Mn((F==null?void 0:F.files)??null),nr(F),ze.value=!1}function Cr(P){const F=P.target;hr((F==null?void 0:F.files)??null),nr(F),ze.value=!1}function pr(P){he.value||!tr(P.dataTransfer)||(P.preventDefault(),qe+=1,B.value=!0)}function Ro(P){he.value||!tr(P.dataTransfer)||(P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="copy"),B.value=!0)}function Wn(P){B.value&&(P.preventDefault(),qe=Math.max(0,qe-1),qe===0&&$n())}function an(P){var F;he.value||!tr(P.dataTransfer)||(P.preventDefault(),$n(),Mn(((F=P.dataTransfer)==null?void 0:F.files)??null))}function ct(){!B.value&&qe===0||$n()}function Nn(P){var qt,En;if(he.value)return;const F=((qt=P.clipboardData)==null?void 0:qt.getData("text/plain"))??"";if(F.length>=kx){P.preventDefault();const zt=new File([F],Ko(),{type:"text/plain",lastModified:Date.now()});Mn([zt]);return}const te=Array.from(((En=P.clipboardData)==null?void 0:En.items)??[]);if(te.length===0)return;const Ae=F.length>0,wt=te.filter(zt=>zt.kind==="file"&&zt.type.startsWith("image/")).map(zt=>zt.getAsFile()).filter(zt=>zt instanceof File);wt.length!==0&&(Ae||P.preventDefault(),Mn(wt))}function Ln(){T.value&&(T.value=""),Qt()}function jr(P){if(Le.value){if(P.key==="Escape"){P.preventDefault(),Nt();return}if(P.key==="ArrowDown"){P.preventDefault(),Fe.value.length>0&&(et.value=(et.value+1)%Fe.value.length);return}if(P.key==="ArrowUp"){if(P.preventDefault(),Fe.value.length>0){const te=Fe.value.length;et.value=(et.value+te-1)%te}return}if(P.key==="Enter"||P.key==="Tab"){P.preventDefault();const te=Fe.value[et.value];te?mr(te):Nt();return}}if(r.sendWithEnter!==!1?P.key==="Enter"&&!P.shiftKey:P.key==="Enter"&&(P.metaKey||P.ctrlKey)){P.preventDefault(),Ce(r.isTurnInProgress?je.value:"steer");return}}function Nt(){Le.value=!1,He.value=null,Ne.value="",Fe.value=[],et.value=0}function Qt(){const P=oe.value;if(!P){Nt();return}const F=P.selectionStart??s.value.length,Ae=s.value.slice(0,F).match(/(^|\s)(@[^\s@]*)$/);if(!Ae){Nt();return}const wt=Ae[2]??"",qt=wt.length,En=F-qt;He.value=En,Ne.value=wt.slice(1),Le.value=!0,Vn()}async function Vn(){if(!Le.value)return;const P=(r.cwd??"").trim();if(!P){Fe.value=[];return}Ke&&clearTimeout(Ke);const F=++Je;Ke=setTimeout(async()=>{try{const te=await uT(P,Ne.value,20);if(!Le.value||F!==Je)return;Fe.value=te,et.value=0}catch{if(!Le.value||F!==Je)return;Fe.value=[]}},120)}function mr(P){const F=oe.value,te=He.value;if(te!==null&&F){const Ae=F.selectionStart??s.value.length;s.value=`${s.value.slice(0,te)}${s.value.slice(Ae)}`.trimEnd()}Ft(P.path),Nt(),Kt(()=>F==null?void 0:F.focus())}function no(P){Te(),vt(P),Kt(()=>{var F;return(F=oe.value)==null?void 0:F.focus()})}function Bt(P){const F=P.trim();F&&(Te(),s.value.trim().length>0?s.value=`${s.value.trimEnd()}
|
|
49
|
+
${F}`:s.value=F,Kt(()=>{var te;return(te=oe.value)==null?void 0:te.focus()}))}async function Sr(){h.value=await TT()}function yn(P){return`${Xu}${P}`}function Sn(P){return P.startsWith(Xu)?P.slice(Xu.length):null}async function Ct(){var Ae;const P=((Ae=window.prompt(o("Prompt name")))==null?void 0:Ae.trim())??"";if(!P)return;const F=window.prompt(o("Prompt content"))??"";if(!F.trim())return;const te=await kT(P,F);te&&(await Sr(),Bt(te.content))}async function Tt(P){const F=Sn(P)??P,te=h.value.find(qt=>qt.path===F);!window.confirm(te?`${o("Remove prompt")} "${te.name}"?`:o("Remove prompt"))||!await CT(F)||await Sr()}function sn(P){const F=h.value.find(te=>te.path===P);F&&Bt(F.content)}function Or(P){const F=P.lastIndexOf("/");return F<0?P:P.slice(F+1)}function vr(P){const F=P.lastIndexOf("/");return F<=0?"":P.slice(0,F)}function zn(P){const F=Or(P),te=F.lastIndexOf(".");return te<=0?"":F.slice(te+1).toLowerCase()}function Yo(P){const F=zn(P);return F==="ts"?"TS":F==="tsx"?"TSX":F==="js"?"JS":F==="jsx"?"JSX":F==="json"?"{}":""}function xn(P){const F=zn(P);return F.startsWith("ts")?"ts":F.startsWith("js")?"js":F==="json"?"json":"default"}function vn(P){const F=zn(P);return F==="md"||F==="mdx"}function An(P){return P.path.toLowerCase().includes("/plugins/cache/")?{badge:"P",badgeLabel:"Plugin",badgeTone:"plugin"}:P.scope==="repo"?{badge:"R",badgeLabel:"Repo",badgeTone:"repo"}:P.scope==="system"?{badge:"S",badgeLabel:"System",badgeTone:"system"}:{badge:"U",badgeLabel:"User",badgeTone:"user"}}function Vt(P,F){const te=Sn(P);if(te){sn(te);return}if(F){const Ae=(r.skills??[]).find(wt=>wt.path===P);Ae&&!c.value.some(wt=>wt.path===P)&&(c.value=[...c.value,Ae])}else c.value=c.value.filter(Ae=>Ae.path!==P)}function xr(P){if(!ze.value)return;const F=Pe.value;if(!F)return;const te=P.target;!te||F.contains(te)||(ze.value=!1)}return va(()=>{document.addEventListener("click",xr),window.addEventListener("drop",ct),window.addEventListener("dragend",ct),window.addEventListener("blur",ct),Sr()}),t({hydrateDraft:no,appendTextToDraft:Bt,hasUnsavedDraft:()=>le.value}),ja(()=>{document.removeEventListener("click",xr),window.removeEventListener("drop",ct),window.removeEventListener("dragend",ct),window.removeEventListener("blur",ct),window.removeEventListener("pointerup",rn),window.removeEventListener("pointercancel",rn),window.removeEventListener("blur",rn),Ke&&clearTimeout(Ke)}),pt(()=>r.activeThreadId,P=>{Te(),Q&&Dt(Q,cn()),ht();const F=bt(P);F&&(vt(F),Ln()),Q=P.trim()},{immediate:!0}),pt([s,l,f,c],()=>{Q&&Dt(Q,cn())},{deep:!0}),pt(()=>r.cwd,()=>{Le.value&&Vn()}),pt($e,P=>{je.value=P}),(P,F)=>(k(),E("form",{class:"thread-composer",onSubmit:F[4]||(F[4]=Ze(te=>Ce(e.isTurnInProgress?je.value:"steer"),["prevent"]))},[q.value?(k(),E("p",AS,R(q.value),1)):J("",!0),m("div",{class:rt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":B.value}])},[l.value.length>0?(k(),E("div",ES,[(k(!0),E(Qe,null,Ot(l.value,te=>(k(),E("div",{key:te.id,class:"thread-composer-attachment"},[m("img",{class:"thread-composer-attachment-image",src:te.url,alt:te.name||"Selected image"},null,8,IS),m("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${te.name||"image"}`,disabled:he.value,onClick:Ae=>Po(te.id)}," x ",8,PS)]))),128))])):J("",!0),g.value.length>0?(k(),E("div",RS,[(k(!0),E(Qe,null,Ot(g.value,te=>(k(),E("span",{key:te.id,class:"thread-composer-folder-chip"},[Be(ld,{class:"thread-composer-folder-chip-icon"}),m("span",{class:"thread-composer-folder-chip-name",title:te.name},R(te.name),9,MS),m("span",$S,[te.isUploading?(k(),E(Qe,{key:0},[ls(R(er(te))+"% uploading ("+R(te.processed)+"/"+R(te.total)+") ",1)],64)):(k(),E(Qe,{key:1},[ls(R(te.filePaths.length)+" file"+R(te.filePaths.length===1?"":"s"),1)],64))]),m("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${te.name}`,disabled:he.value,onClick:Ae=>Lt(te.id)},"×",8,NS)]))),128))])):J("",!0),ae.value.length>0?(k(),E("div",LS,[(k(!0),E(Qe,null,Ot(ae.value,te=>(k(),E("span",{key:te.fsPath,class:"thread-composer-file-chip"},[Be(Bs,{class:"thread-composer-file-chip-icon"}),m("span",{class:"thread-composer-file-chip-name",title:te.fsPath},R(te.label),9,jS),m("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${te.label}`,disabled:he.value,onClick:Ae=>Un(te.fsPath)},"×",8,OS)]))),128))])):J("",!0),c.value.length>0?(k(),E("div",DS,[(k(!0),E(Qe,null,Ot(c.value,te=>(k(),E("span",{key:te.path,class:"thread-composer-skill-chip"},[m("button",{class:"thread-composer-skill-chip-name",type:"button",title:Nr(te.path),"aria-label":`Open ${te.displayName||te.name} SKILL.md`,onClick:Ae=>gt(te)},R(te.displayName||te.name),9,FS),m("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${te.displayName||te.name}`,onClick:Ae=>Go(te.path)},"×",8,US)]))),128))])):J("",!0),m("div",{class:rt(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":B.value}]),onDragenter:pr,onDragover:Ro,onDragleave:Wn,onDrop:an},[B.value?(k(),E("div",BS,[...F[5]||(F[5]=[m("span",{class:"thread-composer-drop-overlay-copy"},"Drop images or files",-1)])])):J("",!0),Le.value?(k(),E("div",qS,[Fe.value.length>0?(k(!0),E(Qe,{key:0},Ot(Fe.value,(te,Ae)=>(k(),E("button",{key:te.path,class:rt(["thread-composer-file-mention-row",{"is-active":Ae===et.value}]),type:"button",onMousedown:Ze(wt=>mr(te),["prevent"])},[Yo(te.path)?(k(),E("span",{key:0,class:rt(["thread-composer-file-mention-icon-badge",`is-${xn(te.path)}`])},R(Yo(te.path)),3)):vn(te.path)?(k(),E("span",WS,"↓")):(k(),at(Bs,{key:2,class:"thread-composer-file-mention-icon-file"})),m("span",VS,[m("span",zS,R(Or(te.path)),1),vr(te.path)?(k(),E("span",GS,R(vr(te.path)),1)):J("",!0)])],42,HS))),128)):(k(),E("div",KS,R(S(o)("No matching files")),1))])):J("",!0),jt(m("textarea",{ref_key:"inputRef",ref:oe,"onUpdate:modelValue":F[0]||(F[0]=te=>s.value=te),class:"thread-composer-input",placeholder:se.value,disabled:he.value,onInput:Ln,onKeydown:jr,onPaste:Nn},null,40,YS),[[tn,s.value]])],34),m("div",{class:rt(["thread-composer-controls",{"thread-composer-controls--recording":tt.value}])},[m("div",{ref_key:"attachMenuRootRef",ref:Pe,class:"thread-composer-attach"},[m("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":S(o)("Add photos & files"),disabled:he.value,onClick:Ao}," + ",8,QS),ze.value?(k(),E("div",JS,[m("button",{class:"thread-composer-attach-item",type:"button",disabled:he.value,onClick:mn},R(S(o)("Add photos & files")),9,XS),m("button",{class:"thread-composer-attach-item",type:"button",disabled:he.value,onClick:Io},R(S(o)("Add folder")),9,ZS),m("button",{class:"thread-composer-attach-item",type:"button",disabled:he.value,onClick:Eo},R(S(o)("Take photo")),9,ex),F[6]||(F[6]=m("div",{class:"thread-composer-attach-separator"},null,-1)),m("div",tx,[m("span",nx,R(S(o)("In-progress send")),1),m("div",rx,[m("button",{class:rt(["thread-composer-attach-mode-button",{"is-active":je.value==="steer"}]),type:"button",disabled:he.value,onClick:F[1]||(F[1]=te=>Ue("steer"))},R(S(o)("Steer")),11,ox),m("button",{class:rt(["thread-composer-attach-mode-button",{"is-active":je.value==="queue"}]),type:"button",disabled:he.value,onClick:F[2]||(F[2]=te=>Ue("queue"))},R(S(o)("Queue")),11,ax)])]),F[7]||(F[7]=m("div",{class:"thread-composer-attach-separator"},null,-1)),ye.value?(k(),E("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`${S(o)("Fast mode")} ${e.selectedSpeedMode==="fast"?S(o)("enabled"):S(o)("disabled")}`,disabled:Me.value,onClick:$r},[m("span",ix,[m("span",lx,R(S(o)("Fast mode")),1),m("span",ux,R(xe.value),1)]),m("span",{class:rt(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":Me.value}])},null,2)],8,sx)):J("",!0),m("button",{class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":We.value,"aria-label":We.value?S(o)("Disable plan mode"):S(o)("Enable plan mode"),disabled:ue.value,onClick:pn},[m("span",dx,[m("span",fx,R(S(o)("Plan mode")),1),m("span",hx,R(S(o)("Agent proposes a plan before acting")),1)]),m("span",{class:rt(["thread-composer-attach-switch",{"is-on":We.value}])},null,2)],8,cx)])):J("",!0)],512),tt.value?J("",!0):(k(),E(Qe,{key:0},[Be(xs,{class:"thread-composer-control","model-value":e.selectedModel,options:Oe.value,"selected-prefix-icon":de.value?Sl:null,placeholder:S(o)("Model"),"open-direction":"up",disabled:ue.value||e.models.length===0,"enable-search":"","search-placeholder":S(o)("Search models..."),"onUpdate:modelValue":zo},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Be(xS,{class:"thread-composer-control",options:V.value,"selected-values":$.value,placeholder:S(o)("Skills"),"search-placeholder":S(o)("Search skills and prompts..."),"create-label":S(o)("Add new prompt"),"allow-remove":!0,"remove-label":S(o)("Remove prompt"),"open-direction":"up",disabled:ue.value,onToggle:Vt,onCreate:Ct,onRemove:Tt},null,8,["options","selected-values","placeholder","search-placeholder","create-label","remove-label","disabled"]),Be(xs,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Ee,placeholder:S(o)("Thinking"),"open-direction":"up",disabled:ue.value,"onUpdate:modelValue":gn},null,8,["model-value","placeholder","disabled"])],64)),m("div",{class:rt(["thread-composer-actions",{"thread-composer-actions--recording":tt.value}])},[S(X)==="recording"?(k(),E("div",px,[m("canvas",{ref_key:"dictationWaveformCanvasRef",ref:G,class:"thread-composer-dictation-waveform"},null,512)])):J("",!0),S(X)==="recording"?(k(),E("span",mx,R(W.value),1)):J("",!0),S(U)?(k(),E("button",{key:2,class:rt(["thread-composer-mic",{"thread-composer-mic--active":S(X)==="recording"}]),type:"button","aria-label":D.value,title:D.value,disabled:he.value,onClick:dr,onPointerdown:kr,onPointerup:rn,onPointercancel:rn},[S(X)==="recording"?(k(),at(Th,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(k(),at(KC,{key:1,class:"thread-composer-mic-icon"}))],42,vx)):J("",!0),e.isTurnInProgress&&!me.value?(k(),E("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?S(o)("Saving thread before stop is available"):S(o)("Stop"),title:e.isStopPending?S(o)("Saving thread before stop is available"):S(o)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending,onClick:Xr},[e.isStopPending?(k(),E("span",yx)):(k(),at(Th,{key:1,class:"thread-composer-stop-icon"}))],8,gx)):(k(),E("button",{key:4,class:rt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&je.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&je.value==="queue"?S(o)("Queue message"):S(o)("Send message"),title:e.isTurnInProgress?`${S(o)("Send")} ${je.value==="queue"?S(o)("Queue"):S(o)("Steer")}`:S(o)("Send"),disabled:!ne.value,onClick:F[3]||(F[3]=te=>Ce(e.isTurnInProgress?je.value:"steer"))},[Be(BC,{class:"thread-composer-submit-icon"})],10,wx))],2)],2)],2),m("input",{ref_key:"photoLibraryInputRef",ref:K,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:he.value,onChange:to},null,40,bx),m("input",{ref_key:"cameraCaptureInputRef",ref:ge,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:he.value,onChange:Hn},null,40,_x),m("input",{ref_key:"folderPickerInputRef",ref:ke,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:he.value,onChange:Cr},null,40,Tx)],32))}}),kh=xt(Sx,[["__scopeId","data-v-9f6b9876"]]),xx={key:0,class:"thread-pending-request"},Ax={class:"thread-pending-request-title"},Ex=["title"],Ix={class:"thread-pending-request-approval"},Px=["aria-label"],Rx=["aria-pressed","onClick"],Mx={class:"thread-pending-request-option-index"},$x={class:"thread-pending-request-option-label"},Nx={class:"thread-pending-request-footer thread-pending-request-footer--approval"},Lx=["value","placeholder"],jx={class:"thread-pending-request-header"},Ox={class:"thread-pending-request-heading"},Dx={class:"thread-pending-request-eyebrow"},Fx={class:"thread-pending-request-title"},Ux={key:0,class:"thread-pending-request-counter"},Bx={key:0,class:"thread-pending-request-preview"},qx={class:"thread-pending-request-preview-code"},Hx={key:1,class:"thread-pending-request-user-input"},Wx={key:0,class:"thread-pending-request-question-description"},Vx=["href"],zx={class:"thread-pending-request-question-title"},Gx={key:0},Kx={key:0,class:"thread-pending-request-question-text"},Yx={key:1,class:"thread-pending-request-input-wrap"},Qx={class:"thread-pending-request-select-label"},Jx=["type","value","onInput"],Xx={key:2,class:"thread-pending-request-select-wrap"},Zx={class:"thread-pending-request-select-label"},eA=["value","onChange"],tA={key:0,value:""},nA={value:"true"},rA={value:"false"},oA={key:3,class:"thread-pending-request-select-wrap"},aA={class:"thread-pending-request-select-label"},sA=["value","onChange"],iA={key:0,value:""},lA=["value"],uA={key:4,class:"thread-pending-request-question-options"},cA=["checked","onChange"],dA={class:"thread-pending-request-checkbox-label"},fA={key:2,class:"thread-pending-request-validation-error"},hA={class:"thread-pending-request-footer"},pA={key:2,class:"thread-pending-request-user-input"},mA={class:"thread-pending-request-question-title"},vA={key:0,class:"thread-pending-request-question-text"},gA={key:1,class:"thread-pending-request-question-options"},yA={class:"thread-pending-request-select-wrap"},wA={class:"thread-pending-request-select-label"},bA=["value","onChange"],_A=["value"],TA={key:0,class:"thread-pending-request-question-description"},kA={key:2,class:"thread-pending-request-input-wrap"},CA={class:"thread-pending-request-select-label"},SA=["value","placeholder","onInput"],xA={class:"thread-pending-request-footer"},AA={key:3,class:"thread-pending-request-actions"},EA={key:4,class:"thread-pending-request-actions"},IA=Fn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,r=t,a=x("accept"),o=x(""),s=x({}),l=x({}),c=x({}),h=x(""),{t:f}=Oa();function g(D){return D!==null&&typeof D=="object"&&!Array.isArray(D)?D:null}function T(D){return typeof D=="string"?D.trim():""}function I(D){return typeof D=="string"?D:null}function j(D){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(D)?D:JSON.stringify(D)}function B(D){const W=(Array.isArray(D.commandActions)?D.commandActions:[]).map(se=>g(se)).map(se=>T(se==null?void 0:se.command)).find(se=>se.length>0);if(W)return W.replace(/\s+/g," ").trim();if(Array.isArray(D.command)){const se=D.command.filter(me=>typeof me=="string").map(me=>me.trim()).filter(me=>me.length>0);if(se.length>0)return se.map(me=>j(me)).join(" ")}return Pe(T(D.command))}function X(D){return D.method==="item/commandExecution/requestApproval"||D.method==="execCommandApproval"}function U(D){return D.method==="item/fileChange/requestApproval"||D.method==="applyPatchApproval"}function O(D){return D.method==="item/permissions/requestApproval"}function G(D){return X(D)||U(D)||O(D)}function ee(D){return D.method==="mcpServer/elicitation/request"}function be(D){const q=g(D.params);return T(q==null?void 0:q.reason)||T(q==null?void 0:q.prompt)||T(q==null?void 0:q.message)}function pe(D){return G(D)?"Awaiting approval":ee(D)?"MCP server input required":D.method==="item/tool/requestUserInput"?"Awaiting response":D.method==="item/tool/call"?"Tool call waiting for response":D.method}function Te(D){const q=be(D);return q||(X(D)?"Do you want to run this command?":U(D)?"Do you want to make these changes?":O(D)?"Do you want to grant these permissions?":ee(D)?"An MCP server needs your input before Codex can continue.":D.method==="item/tool/requestUserInput"?"Codex needs your answer before it can continue.":"Codex is waiting for a response before it can continue.")}function Pe(D){var Ce;const q=D.trim();if(!q)return"";const W=q.match(/-Command\s+(.+)$/i),se=((Ce=W==null?void 0:W[1])==null?void 0:Ce.trim())??q;return(se.startsWith('"')&&se.endsWith('"')?se.slice(1,-1):se).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function K(D){const q=g(D.params);if(!q)return"";if(X(D))return B(q);if(U(D)){const W=T(q.grantRoot)||T(q.grant_root);if(W)return W.replace(/\s+/g," ").trim();const se=g(q.fileChanges)??g(q.changes);if(!se)return"";const me=Object.keys(se).map(Ce=>Ce.trim()).filter(Ce=>Ce.length>0);return me.length===0?"":me.slice(0,3).join(", ")}return O(D)?ge(q.permissions):ee(D)?T(q.serverName)||T(q.url):""}function ge(D){const q=g(D);if(!q)return"";const W=[],se=g(q.fileSystem),me=g(q.network),Ce=Array.isArray(se==null?void 0:se.read)?se.read.filter(vt=>typeof vt=="string"):[],Ue=Array.isArray(se==null?void 0:se.write)?se.write.filter(vt=>typeof vt=="string"):[];return Ce.length>0&&W.push(`Read: ${Ce.join(", ")}`),Ue.length>0&&W.push(`Write: ${Ue.join(", ")}`),(me==null?void 0:me.enabled)===!0&&W.push("Network access"),W.join(" • ")}function ke(D){return!D||!G(D)?[]:[{id:"accept",label:"Yes"},{id:"acceptForSession",label:"Yes for Session"}]}const oe=Z(()=>ke(n.request));pt(()=>{var D;return((D=n.request)==null?void 0:D.id)??0},()=>{var D;o.value="",s.value={},l.value={},c.value={},h.value="",a.value=((D=oe.value[0])==null?void 0:D.id)??"accept"},{immediate:!0}),pt(oe,D=>{var q;a.value!=="decline"&&(D.some(W=>W.id===a.value)||(a.value=((q=D[0])==null?void 0:q.id)??"accept"))},{immediate:!0});function Re(D,q){return`${String(D)}:${q}`}function ze(D){const q=g(D.params),W=Array.isArray(q==null?void 0:q.questions)?q.questions:[],se=[];for(const me of W){const Ce=g(me);if(!Ce)continue;const Ue=T(Ce.id);if(!Ue)continue;const vt=Array.isArray(Ce.options)?Ce.options.map(ht=>g(ht)).map(ht=>({label:T(ht==null?void 0:ht.label),description:T(ht==null?void 0:ht.description)})).filter(ht=>ht.label.length>0):[];se.push({id:Ue,header:T(Ce.header),question:T(Ce.question),isOther:Ce.isOther===!0,options:vt})}return se}function He(D,q,W){const se=Re(D,q),me=s.value[se];return typeof me=="string"&&me.length>0?me:W}function Ne(D,q){return l.value[Re(D,q)]??""}function Fe(D,q,W){const se=W.target;if(!(se instanceof HTMLSelectElement))return;const me=Re(D,q);s.value={...s.value,[me]:se.value}}function Le(D,q,W){const se=W.target;if(!(se instanceof HTMLInputElement))return;const me=Re(D,q);l.value={...l.value,[me]:se.value}}function et(D,q,W){var me,Ce;const se=He(D,q,((me=W[0])==null?void 0:me.label)||"");return((Ce=W.find(Ue=>Ue.label===se))==null?void 0:Ce.description)??""}function Ge(D,q){return`${String(D)}:${q}`}function Je(D){var q;return T((q=g(D.params))==null?void 0:q.serverName)}function Ke(D){var W;const q=T((W=g(D.params))==null?void 0:W.url);if(!q)return"";try{const se=new URL(q),me=se.protocol.toLowerCase();return me==="https:"||me==="http:"?se.toString():""}catch{return""}}function it(D){const q=g(D.params),W=g(q==null?void 0:q.requestedSchema),se=g(W==null?void 0:W.properties);if(!se)return[];const me=new Set(Array.isArray(W==null?void 0:W.required)?W.required.filter(Ce=>typeof Ce=="string"):[]);return Object.entries(se).map(([Ce,Ue])=>qe(Ce,g(Ue),me.has(Ce))).filter(Ce=>Ce!==null)}function qe(D,q,W){if(!q)return null;const se=T(q.title)||D,me=T(q.description),Ce=T(q.type);if(Ce==="boolean")return{key:D,label:se,description:me,required:W,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof q.default=="boolean"?q.default:null,hasExplicitDefault:typeof q.default=="boolean"};if(Ce==="number"||Ce==="integer")return{key:D,label:se,description:me,required:W,kind:"number",inputType:"number",options:[],defaultValue:typeof q.default=="number"?q.default:null,hasExplicitDefault:typeof q.default=="number"};const Ue=Xe(q);if(Ce==="array")return{key:D,label:se,description:me,required:W,kind:"multiEnum",inputType:"checkbox",options:Ue,defaultValue:Array.isArray(q.default)?q.default.filter(ht=>typeof ht=="string"):[],hasExplicitDefault:Array.isArray(q.default)};const vt=I(q.default);return Ue.length>0?{key:D,label:se,description:me,required:W,kind:"singleEnum",inputType:"select",options:Ue,defaultValue:vt,hasExplicitDefault:vt!==null}:{key:D,label:se,description:me,required:W,kind:"string",inputType:nt(q),options:[],defaultValue:vt,hasExplicitDefault:vt!==null}}function Xe(D){const W=(Array.isArray(D.oneOf)?D.oneOf:Array.isArray(D.anyOf)?D.anyOf:[]).map(Ue=>g(Ue)).map(Ue=>({value:T(Ue==null?void 0:Ue.const),label:T(Ue==null?void 0:Ue.title)||T(Ue==null?void 0:Ue.const)})).filter(Ue=>Ue.value.length>0);if(W.length>0)return W;const se=g(D.items);if(se){const Ue=Xe(se);if(Ue.length>0)return Ue}const me=Array.isArray(D.enum)?D.enum.filter(Ue=>typeof Ue=="string"):[],Ce=Array.isArray(D.enumNames)?D.enumNames.filter(Ue=>typeof Ue=="string"):[];return me.map((Ue,vt)=>({value:Ue,label:Ce[vt]||Ue}))}function nt(D){const q=T(D.format);return q==="email"?"email":q==="uri"?"url":q==="date"?"date":q==="date-time"?"datetime-local":"text"}function Q(D,q){const W=c.value[Ge(D,q.key)];return W!==void 0?W:q.defaultValue}function Ee(D,q){const W=Q(D,q);return Array.isArray(W)?W.filter(se=>typeof se=="string"):[]}function ve(D,q,W){const se=W.target;if(!(se instanceof HTMLInputElement)&&!(se instanceof HTMLSelectElement))return;const me=se.value,Ce=(q.kind==="number",me);c.value={...c.value,[Ge(D,q.key)]:me.length>0?Ce:null},h.value=""}function Oe(D,q,W){const se=W.target;if(!(se instanceof HTMLSelectElement))return;let me=null;se.value==="true"?me=!0:se.value==="false"&&(me=!1),c.value={...c.value,[Ge(D,q.key)]:me},h.value=""}function We(D,q,W,se){const me=se.target;if(!(me instanceof HTMLInputElement))return;const Ce=new Set(Ee(D,q));me.checked?Ce.add(W):Ce.delete(W),c.value={...c.value,[Ge(D,q.key)]:Array.from(Ce)},h.value=""}function A(D){return D===!0?"true":D===!1?"false":""}function $(D,q){const W=Q(D,q);return q.kind==="multiEnum"?Array.isArray(W)&&W.length>0:q.kind==="boolean"?typeof W=="boolean":q.kind==="number"&&typeof W=="number"?!0:typeof W=="string"&&W.trim().length>0}function V(D){const q=it(D).filter(W=>W.required&&!$(D.id,W)).map(W=>W.label);return q.length===0?"":q.length===1?`Answer the required field: ${q[0]}.`:`Answer the required fields: ${q.join(", ")}.`}function ne(D){const q={};for(const W of it(D)){const se=Q(D.id,W);if(W.kind==="multiEnum"){const Ce=Array.isArray(se)?se:[];(Ce.length>0||W.required)&&(q[W.key]=Ce);continue}if(W.kind==="boolean"){typeof se=="boolean"&&(q[W.key]=se);continue}if(W.kind==="number"){const Ce=typeof se=="number"?se:Number(String(se).trim());Number.isNaN(Ce)||(q[W.key]=Ce);continue}const me=String(se??"").trim();(me.length>0||W.required)&&(q[W.key]=me)}return q}function le(D){a.value=D}function ae(){a.value="decline"}function he(D){const q=D.target;q instanceof HTMLInputElement&&(o.value=q.value,a.value="decline")}function ue(D,q){var W;if(O(D)){if(q==="decline"||q==="cancel"){r("respondServerRequest",{id:D.id,error:{code:-32e3,message:q==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const se=g((W=g(D.params))==null?void 0:W.permissions)??{};r("respondServerRequest",{id:D.id,result:{permissions:se,scope:q==="acceptForSession"?"session":"turn"}});return}r("respondServerRequest",{id:D.id,result:{decision:q}})}function ye(D){const q=o.value.trim(),W=q.length>0?"decline":a.value;if(O(D)){ue(D,W);return}r("respondServerRequest",{id:D.id,result:{decision:W},followUpMessageText:q||void 0})}function de(D,q){const W=g(D.params),se={action:q};if(q==="accept"&&T(W==null?void 0:W.mode)==="form"){const me=V(D);if(me){h.value=me;return}se.content=ne(D)}r("respondServerRequest",{id:D.id,result:se})}function Me(D){var se;const q=ze(D),W={};for(const me of q){const Ce=He(D.id,me.id,((se=me.options[0])==null?void 0:se.label)||""),Ue=Ne(D.id,me.id).trim(),vt=[Ce,Ue].map(ht=>ht.trim()).filter(ht=>ht.length>0);W[me.id]={answers:vt}}r("respondServerRequest",{id:D.id,result:{answers:W}})}function xe(D){r("respondServerRequest",{id:D.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function $e(D){r("respondServerRequest",{id:D.id,result:{success:!0,contentItems:[]}})}function je(D){r("respondServerRequest",{id:D.id,result:{}})}function tt(D){r("respondServerRequest",{id:D.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(D,q)=>e.request?(k(),E("section",xx,[m("article",{class:rt(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[G(e.request)?(k(),E(Qe,{key:0},[m("p",Ax,R(Te(e.request)),1),K(e.request)?(k(),E("p",{key:0,class:"thread-pending-request-command-line",title:K(e.request)},R(K(e.request)),9,Ex)):J("",!0),m("section",Ix,[m("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":S(f)("Approval choices")},[(k(!0),E(Qe,null,Ot(oe.value,(W,se)=>(k(),E("button",{key:W.id,type:"button",class:rt(["thread-pending-request-option",{"is-selected":a.value===W.id}]),"aria-pressed":a.value===W.id,onClick:me=>le(W.id)},[m("span",Mx,R(se+1)+".",1),m("span",$x,R(W.label),1)],10,Rx))),128))],8,Px),m("footer",Nx,[m("label",{class:rt(["thread-pending-request-inline-input",{"is-active":a.value==="decline"||o.value.length>0}])},[q[11]||(q[11]=m("span",{class:"thread-pending-request-option-index"},"3.",-1)),m("input",{class:"thread-pending-request-inline-control",type:"text",value:o.value,placeholder:S(f)("No, and tell Codex what to do differently"),onFocus:ae,onInput:he,onKeydown:q[0]||(q[0]=nn(Ze(W=>ye(e.request),["prevent"]),["enter"]))},null,40,Lx)],2),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:q[1]||(q[1]=W=>ue(e.request,"cancel"))},R(S(f)("Skip")),1),m("button",{type:"button",class:"thread-pending-request-primary",onClick:q[2]||(q[2]=W=>ye(e.request))},R(S(f)("Send")),1)])])],64)):(k(),E(Qe,{key:1},[m("header",jx,[m("div",Ox,[m("p",Dx,R(pe(e.request)),1),m("p",Fx,R(Te(e.request)),1)]),(e.requestCount??0)>1?(k(),E("span",Ux,R(e.requestCount??0)+" pending",1)):J("",!0)]),K(e.request)?(k(),E("div",Bx,[m("code",qx,R(K(e.request)),1)])):J("",!0),e.request.method==="mcpServer/elicitation/request"?(k(),E("section",Hx,[Je(e.request)?(k(),E("p",Wx,R(S(f)("Server"))+": "+R(Je(e.request)),1)):J("",!0),Ke(e.request)?(k(),E("a",{key:1,class:"thread-pending-request-link",href:Ke(e.request),target:"_blank",rel:"noopener noreferrer"},R(S(f)("Open authorization link")),9,Vx)):J("",!0),(k(!0),E(Qe,null,Ot(it(e.request),W=>(k(),E("div",{key:`${e.request.id}:${W.key}`,class:"thread-pending-request-question"},[m("p",zx,[ls(R(W.label),1),W.required?(k(),E("span",Gx," *")):J("",!0)]),W.description?(k(),E("p",Kx,R(W.description),1)):J("",!0),W.kind==="string"||W.kind==="number"?(k(),E("label",Yx,[m("span",Qx,R(S(f)("Value")),1),m("input",{class:"thread-pending-request-input",type:W.inputType,value:String(Q(e.request.id,W)??""),onInput:se=>ve(e.request.id,W,se)},null,40,Jx)])):W.kind==="boolean"?(k(),E("label",Xx,[m("span",Zx,R(S(f)("Choice")),1),m("select",{class:"thread-pending-request-select",value:A(Q(e.request.id,W)),onChange:se=>Oe(e.request.id,W,se)},[W.hasExplicitDefault?J("",!0):(k(),E("option",tA,R(S(f)("Select true or false")),1)),m("option",nA,R(S(f)("True")),1),m("option",rA,R(S(f)("False")),1)],40,eA)])):W.kind==="singleEnum"?(k(),E("label",oA,[m("span",aA,R(S(f)("Choice")),1),m("select",{class:"thread-pending-request-select",value:String(Q(e.request.id,W)??""),onChange:se=>ve(e.request.id,W,se)},[W.hasExplicitDefault?J("",!0):(k(),E("option",iA,R(S(f)("Select an option")),1)),(k(!0),E(Qe,null,Ot(W.options,se=>(k(),E("option",{key:`${e.request.id}:${W.key}:${se.value}`,value:se.value},R(se.label),9,lA))),128))],40,sA)])):(k(),E("div",uA,[(k(!0),E(Qe,null,Ot(W.options,se=>(k(),E("label",{key:`${e.request.id}:${W.key}:${se.value}`,class:"thread-pending-request-checkbox-row"},[m("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:Ee(e.request.id,W).includes(se.value),onChange:me=>We(e.request.id,W,se.value,me)},null,40,cA),m("span",dA,R(se.label),1)]))),128))]))]))),128)),h.value?(k(),E("p",fA,R(h.value),1)):J("",!0),m("footer",hA,[m("button",{type:"button",class:"thread-pending-request-secondary",onClick:q[3]||(q[3]=W=>de(e.request,"cancel"))},R(S(f)("Cancel")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:q[4]||(q[4]=W=>de(e.request,"decline"))},R(S(f)("Decline")),1),m("button",{type:"button",class:"thread-pending-request-primary",onClick:q[5]||(q[5]=W=>de(e.request,"accept"))},R(S(f)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(k(),E("section",pA,[(k(!0),E(Qe,null,Ot(ze(e.request),W=>{var se;return k(),E("div",{key:`${e.request.id}:${W.id}`,class:"thread-pending-request-question"},[m("p",mA,R(W.header||W.question),1),W.question?(k(),E("p",vA,R(W.question),1)):J("",!0),W.options.length>0?(k(),E("div",gA,[m("label",yA,[m("span",wA,R(S(f)("Choice")),1),m("select",{class:"thread-pending-request-select",value:He(e.request.id,W.id,((se=W.options[0])==null?void 0:se.label)||""),onChange:me=>Fe(e.request.id,W.id,me)},[(k(!0),E(Qe,null,Ot(W.options,me=>(k(),E("option",{key:`${e.request.id}:${W.id}:${me.label}`,value:me.label},R(me.label),9,_A))),128))],40,bA)]),et(e.request.id,W.id,W.options)?(k(),E("p",TA,R(et(e.request.id,W.id,W.options)),1)):J("",!0)])):J("",!0),W.isOther?(k(),E("label",kA,[m("span",CA,R(S(f)("Other answer")),1),m("input",{class:"thread-pending-request-input",type:"text",value:Ne(e.request.id,W.id),placeholder:S(f)("Other answer"),onInput:me=>Le(e.request.id,W.id,me)},null,40,SA)])):J("",!0)])}),128)),m("footer",xA,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:q[6]||(q[6]=W=>Me(e.request))},R(S(f)("Send")),1)])])):e.request.method==="item/tool/call"?(k(),E("section",AA,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:q[7]||(q[7]=W=>xe(e.request))},R(S(f)("Fail Tool Call")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:q[8]||(q[8]=W=>$e(e.request))},R(S(f)("Success (Empty)")),1)])):(k(),E("section",EA,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:q[9]||(q[9]=W=>je(e.request))},R(S(f)("Return Empty Result")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:q[10]||(q[10]=W=>tt(e.request))},R(S(f)("Reject Request")),1)]))],64))],2)])):J("",!0)}}),PA=xt(IA,[["__scopeId","data-v-72a9d2d9"]]),RA={key:0,class:"queued-messages"},MA={class:"queued-messages-inner"},$A=["onDragstart","onDragover","onDragleave","onDrop"],NA=["aria-label","title"],LA={class:"queued-row-text"},jA={class:"queued-row-actions"},OA=["title","onClick"],DA=["title","onClick"],FA=["aria-label","title","onClick"],UA=Fn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:r}=Oa(),a=x(""),o=x("");function s(T,I){var j;a.value=I,o.value="",(j=T.dataTransfer)==null||j.setData("text/plain",I),T.dataTransfer&&(T.dataTransfer.effectAllowed="move")}function l(T){!a.value||a.value===T||(o.value=T)}function c(T){o.value===T&&(o.value="")}function h(T){const I=a.value;f(),!(!I||I===T)&&n("reorder",{draggedId:I,targetId:T})}function f(){a.value="",o.value=""}function g(T){var O,G,ee;const I=T.text.trim();if(I)return I;const j=[],B=((O=T.imageUrls)==null?void 0:O.length)??0,X=((G=T.fileAttachments)==null?void 0:G.length)??0,U=((ee=T.skills)==null?void 0:ee.length)??0;return B>0&&j.push(`${B} ${r(B===1?"image":"images")}`),X>0&&j.push(`${X} ${r(X===1?"file":"files")}`),U>0&&j.push(`${U} ${r(U===1?"skill":"skills")}`),j.join(", ")||r("(empty queued message)")}return(T,I)=>e.messages.length>0?(k(),E("div",RA,[m("div",MA,[(k(!0),E(Qe,null,Ot(e.messages,j=>(k(),E("div",{key:j.id,class:rt(["queued-row",{"is-dragging":a.value===j.id,"is-drop-target":o.value===j.id&&a.value!==j.id}]),draggable:"true",onDragstart:B=>s(B,j.id),onDragover:Ze(B=>l(j.id),["prevent"]),onDragleave:B=>c(j.id),onDrop:Ze(B=>h(j.id),["prevent"]),onDragend:f},[m("button",{class:"queued-row-drag",type:"button","aria-label":S(r)("Drag to reorder queued message"),title:S(r)("Drag to reorder queued message")},[...I[0]||(I[0]=[m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("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,NA),I[2]||(I[2]=m("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("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)),m("span",LA,R(g(j)),1),m("div",jA,[m("button",{class:"queued-row-edit",type:"button",title:S(r)("Edit queued message"),onClick:B=>T.$emit("edit",j.id)},R(S(r)("Edit")),9,OA),m("button",{class:"queued-row-steer",type:"button",title:S(r)("Send now without interrupting work"),onClick:B=>T.$emit("steer",j.id)},R(S(r)("Steer")),9,DA),m("button",{class:"queued-row-delete",type:"button","aria-label":S(r)("Delete queued message"),title:S(r)("Delete queued message"),onClick:B=>T.$emit("delete",j.id)},[...I[1]||(I[1]=[m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("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,FA)])],42,$A))),128))])])):J("",!0)}}),BA=xt(UA,[["__scopeId","data-v-b7a3edb8"]]),qA={key:0,class:"rate-limit-status","aria-live":"polite"},HA=["title"],WA={class:"rate-limit-card-header"},VA={class:"rate-limit-card-title"},zA={key:0,class:"rate-limit-card-plan"},GA={class:"rate-limit-card-metrics"},KA={key:0,class:"rate-limit-card-footer"},YA=Fn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(U){var O,G;return((O=U.limitId)==null?void 0:O.trim())||((G=U.limitName)==null?void 0:G.trim())||"__default__"}function n(U){var O,G;return((O=U.limitName)==null?void 0:O.trim())||((G=U.limitId)==null?void 0:G.trim())||"Rate limits"}function r(U){const O=U.trim();return O?O.replace(/[_-]+/g," ").replace(/\b\w/g,G=>G.toUpperCase()):""}function a(U){return!U||U<=0?"Window":U%1440===0?`${U/1440}d`:U%60===0?`${U/60}h`:U<60?`${U}m`:`${Math.round(U/60*10)/10}h`}function o(U){const O=Math.max(0,Math.min(100,100-U));return`${Math.round(O)}% left`}function s(U){return`${Math.round(U)}%`}function l(U,O){return{key:O,label:`${a(U.windowDurationMins)} ${o(U.usedPercent)}`}}function c(U){const O=[];return U.primary&&O.push(l(U.primary,"primary")),U.secondary&&O.push(l(U.secondary,"secondary")),O}function h(U){if(!U)return"";const O=new Date(U*1e3),G=O.getMonth()+1,ee=String(O.getDate()).padStart(2,"0"),be=String(O.getHours()).padStart(2,"0"),pe=String(O.getMinutes()).padStart(2,"0");return`${G}.${ee} ${be}:${pe}`}function f(U){if(!(U!=null&&U.resetsAt))return"";const O=U.resetsAt*1e3-Date.now();if(O<=0)return"Resetting now";const G=Math.round(O/6e4);if(G<60)return`Resets in ${G}m`;const ee=Math.round(G/60);return ee<24?`Resets in ${ee}h`:`Resets in ${Math.round(ee/24)}d`}function g(U){return[U.primary,U.secondary].filter(O=>O!==null)}function T(U){const O=g(U);return O.length===0?null:[...O].sort((G,ee)=>{const be=G.windowDurationMins??Number.MAX_SAFE_INTEGER,pe=ee.windowDurationMins??Number.MAX_SAFE_INTEGER;return be!==pe?be-pe:(G.resetsAt??Number.MAX_SAFE_INTEGER)-(ee.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function I(U){const O=g(U);if(O.length===0)return"";const G=[...O].sort((be,pe)=>{const Te=be.windowDurationMins??-1,Pe=pe.windowDurationMins??-1;return Te!==Pe?Pe-Te:(pe.resetsAt??-1)-(be.resetsAt??-1)})[0],ee=h(G.resetsAt);return ee||""}function j(U){const O=U.credits;return O?O.unlimited?"Unlimited credits":O.balance?`Credits ${O.balance}`:O.hasCredits?"Credits available":"":""}function B(U){return[f(T(U)),I(U),j(U)].filter(O=>O.length>0)}function X(U){const O=[n(U)];for(const G of c(U))O.push(G.label);for(const G of g(U))O.push(`${a(G.windowDurationMins)} used ${s(G.usedPercent)}`);for(const G of B(U))O.push(G);return O.join(`
|
|
50
|
+
`)}return(U,O)=>e.snapshots.length>0?(k(),E("aside",qA,[(k(!0),E(Qe,null,Ot(e.snapshots,G=>(k(),E("div",{key:t(G),class:"rate-limit-card",title:X(G)},[m("div",WA,[m("span",VA,R(n(G)),1),G.planType?(k(),E("span",zA,R(r(G.planType)),1)):J("",!0)]),m("div",GA,[(k(!0),E(Qe,null,Ot(c(G),ee=>(k(),E("span",{key:ee.key,class:"rate-limit-card-metric"},R(ee.label),1))),128))]),B(G).length>0?(k(),E("div",KA,R(B(G).join(" | ")),1)):J("",!0)],8,HA))),128))])):J("",!0)}}),QA=xt(YA,[["__scopeId","data-v-df88906b"]]),JA=["disabled","title","aria-label"],XA={class:"header-git-trigger-label"},ZA={key:0,class:"header-git-dirty-dot","aria-label":"Uncommitted changes"},eE={key:0,class:"header-git-menu-wrap"},tE={class:"header-git-menu"},nE={class:"header-git-state"},rE={class:"header-git-state-label"},oE={class:"header-git-state-value"},aE={key:0,class:"header-git-state-meta"},sE={class:"header-git-search-wrap"},iE=["onKeydown"],lE={class:"header-git-branches",role:"listbox"},uE={class:"header-git-branch-row"},cE=["aria-label","onClick"],dE=["disabled","onClick"],fE={class:"header-git-branch-name"},hE={key:0,class:"header-git-branch-meta"},pE={key:1,class:"header-git-branch-meta"},mE={key:0,class:"header-git-commits"},vE={key:0,class:"header-git-commits-empty"},gE={key:1,class:"header-git-commits-empty is-error"},yE=["disabled","title","onClick"],wE={class:"header-git-commit-top"},bE={class:"header-git-commit-meta"},_E={key:0,class:"header-git-branch-meta"},TE={class:"header-git-commit-subject"},kE={key:2,class:"header-git-commits-empty"},CE={key:0,class:"header-git-empty"},SE=Fn({__name:"HeaderGitBranchDropdown",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits"],setup(e,{emit:t}){const n=e,r=t,a=x(null),o=x(null),s=x(!1),l=x(""),c=x(""),h=Z(()=>n.showReview!==!1),f=Z(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`Detached ${n.headSha}`:n.loading?"Loading branch...":"Detached HEAD"),g=Z(()=>n.detached?[n.headSha,n.headDate].filter(Boolean).join(" · "):""),T=Z(()=>`Git branch: ${f.value}`),I=Z(()=>n.loading&&n.branches.length===0),j=Z(()=>n.busy||n.loading),B=Z(()=>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.":"")),X=Z(()=>n.error?"error":"info"),U=Z(()=>{const K=l.value.trim().toLowerCase(),ge=n.branches;return K?ge.filter(ke=>ke.label.toLowerCase().includes(K)||ke.value.toLowerCase().includes(K)):ge});function O(){I.value||(s.value=!s.value)}function G(K){c.value=c.value===K?"":K,c.value&&r("loadCommits",K)}function ee(K){var ke;const ge=((ke=n.headSha)==null?void 0:ke.trim())??"";return ge?K.sha===ge||K.shortSha===ge||K.sha.startsWith(ge):!1}function be(K,ge){return K.isRemote?"Remote branches cannot be reset from this menu":`Reset ${K.value} to ${ge.shortSha}`}function pe(K,ge){K.isRemote||r("resetBranchToCommit",{branch:K.value,sha:ge.sha})}function Te(){if(l.value){l.value="";return}s.value=!1}function Pe(K){if(!s.value)return;const ge=a.value,ke=K.target;!ge||!(ke instanceof Node)||ge.contains(ke)||(s.value=!1,l.value="")}return pt(s,K=>{K&&Kt(()=>{var ge;return(ge=o.value)==null?void 0:ge.focus()})}),va(()=>window.addEventListener("pointerdown",Pe)),ja(()=>window.removeEventListener("pointerdown",Pe)),(K,ge)=>(k(),E("div",{ref_key:"rootRef",ref:a,class:rt(["header-git-dropdown",{"is-review-open":e.reviewOpen}])},[m("button",{class:"header-git-trigger",type:"button",disabled:I.value,title:T.value,"aria-label":T.value,onClick:O},[Be(Ss,{class:"header-git-trigger-icon"}),m("span",XA,R(f.value),1),e.dirty?(k(),E("span",ZA)):J("",!0),Be(os,{class:"header-git-trigger-chevron"})],8,JA),s.value?(k(),E("div",eE,[m("div",tE,[h.value?(k(),E("button",{key:0,class:"header-git-review-row",type:"button",onClick:ge[0]||(ge[0]=ke=>r("toggleReview"))},[Be(Bs,{class:"header-git-row-icon"}),m("span",null,R(e.reviewOpen?"Review (Open)":"Review"),1)])):J("",!0),m("div",nE,[m("span",rE,R(e.detached?"Detached HEAD":"Current branch"),1),m("span",oE,R(f.value),1),g.value?(k(),E("span",aE,R(g.value),1)):J("",!0)]),B.value?(k(),E("div",{key:1,class:rt(["header-git-status",{"is-error":X.value==="error"}])},R(B.value),3)):J("",!0),m("div",sE,[jt(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":ge[1]||(ge[1]=ke=>l.value=ke),class:"header-git-search",type:"text",placeholder:"Search branches...",onKeydown:nn(Ze(Te,["prevent"]),["esc"])},null,40,iE),[[tn,l.value]])]),m("ul",lE,[(k(!0),E(Qe,null,Ot(U.value,ke=>(k(),E("li",{key:ke.value,class:"header-git-branch-item"},[m("div",uE,[m("button",{class:"header-git-branch-expand",type:"button","aria-label":c.value===ke.value?"Hide commits":"Show commits",onClick:oe=>G(ke.value)},[Be(fi,{class:rt(["header-git-expand-icon",{"is-expanded":c.value===ke.value}])},null,8,["class"])],8,cE),m("button",{class:rt(["header-git-branch-button",{"is-current":ke.value===e.currentBranch}]),type:"button",disabled:j.value,onClick:oe=>r("checkoutBranch",ke.value)},[m("span",fE,R(ke.label),1),ke.value===e.currentBranch?(k(),E("span",hE,"current")):ke.isRemote?(k(),E("span",pE,"remote")):J("",!0)],10,dE)]),c.value===ke.value?(k(),E("div",mE,[e.commitsLoadingFor===ke.value?(k(),E("div",vE,"Loading commits...")):e.commitsError?(k(),E("div",gE,R(e.commitsError),1)):J("",!0),(k(!0),E(Qe,null,Ot(e.commitsByBranch[ke.value]||[],oe=>(k(),E("button",{key:oe.sha,class:rt(["header-git-commit",{"is-current":ee(oe)}]),type:"button",disabled:j.value||ke.isRemote,title:be(ke,oe),onClick:Re=>pe(ke,oe)},[m("span",wE,[m("code",null,R(oe.shortSha),1),m("span",bE,[ee(oe)?(k(),E("span",_E,"current")):J("",!0),m("span",null,R(oe.date),1)])]),m("span",TE,R(oe.subject),1)],10,yE))),128)),e.commitsLoadingFor!==ke.value&&!e.commitsError&&(e.commitsByBranch[ke.value]||[]).length===0?(k(),E("div",kE," No commits found. ")):J("",!0)])):J("",!0)]))),128)),U.value.length===0?(k(),E("li",CE,"No branches found.")):J("",!0)])])])):J("",!0)],2))}}),xE=xt(SE,[["__scopeId","data-v-5f4121b3"]]),AE=["aria-label"],EE=["aria-checked","onClick"],IE={class:"runtime-toggle-option-label"},PE=Fn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=Oa(),a=[{value:"local",label:r("Local project"),icon:ld},{value:"worktree",label:r("New worktree"),icon:Ss}];function o(s){n("update:modelValue",s)}return(s,l)=>(k(),E("div",{class:"runtime-toggle",role:"radiogroup","aria-label":S(r)("Continue in")},[(k(),E(Qe,null,Ot(a,c=>m("button",{key:c.value,class:rt(["runtime-toggle-option",{"is-selected":e.modelValue===c.value}]),type:"button",role:"radio","aria-checked":e.modelValue===c.value,onClick:h=>o(c.value)},[(k(),at(Kc(c.icon),{class:"runtime-toggle-option-icon"})),m("span",IE,R(c.label),1)],10,EE)),64))],8,AE))}}),RE=xt(PE,[["__scopeId","data-v-0f175c28"]]),ME={},$E={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 NE(e,t){return k(),E("svg",$E,[...t[0]||(t[0]=[m("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),m("path",{d:"M9 4l0 16"},null,-1)])])}const LE=xt(ME,[["render",NE]]),jE={},OE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function DE(e,t){return k(),E("svg",OE,[...t[0]||(t[0]=[m("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 FE=xt(jE,[["render",DE]]),UE={class:"sidebar-thread-controls"},BE=["aria-label","title"],qE=["aria-label","title"],HE=Fn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=Oa();return(n,r)=>(k(),E("div",UE,[m("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?S(t)("Expand sidebar"):S(t)("Collapse sidebar"),title:e.isSidebarCollapsed?S(t)("Expand sidebar"):S(t)("Collapse sidebar"),onClick:r[0]||(r[0]=a=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(k(),at(FE,{key:0,class:"sidebar-thread-controls-icon"})):(k(),at(LE,{key:1,class:"sidebar-thread-controls-icon"}))],8,BE),Ho(n.$slots,"default",{},void 0),e.showNewThreadButton?(k(),E("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":S(t)("Start new thread"),title:S(t)("Start new thread"),onClick:r[1]||(r[1]=a=>n.$emit("start-new-thread"))},[Be(Bs,{class:"sidebar-thread-controls-icon"})],8,qE)):J("",!0)]))}}),Ch=xt(HE,[["__scopeId","data-v-2369affb"]]),WE={},VE={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function zE(e,t){return k(),E("svg",VE,[...t[0]||(t[0]=[m("circle",{cx:"11",cy:"11",r:"8"},null,-1),m("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Sh=xt(WE,[["render",zE]]),GE={},KE={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function YE(e,t){return k(),E("svg",KE,[...t[0]||(t[0]=[m("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[m("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"}),m("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const QE=xt(GE,[["render",YE]]),JE={},XE={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function ZE(e,t){return k(),E("svg",XE,[...t[0]||(t[0]=[m("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),m("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const eI=xt(JE,[["render",ZE]]),tI={},nI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function rI(e,t){return k(),E("svg",nI,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const oI=xt(tI,[["render",rI]]);function br(e){return e.flatMap(t=>t.threads)}function aI(e,t){var r,a;const n=e.findIndex(o=>o.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((a=e[n-1])==null?void 0:a.id)??""}const Dm="codex-web-local.thread-read-state.v1",xh="codex-web-local.thread-unread-cutoff.v1",Fm="codex-web-local.thread-token-usage.v1",Um="codex-web-local.thread-terminal-open.v1",Ac="codex-web-local.selected-thread-id.v1",Ec="codex-web-local.selected-model-by-context.v1",Bm="codex-web-local.selected-model-id.v1",qm="codex-web-local.project-order.v1",Hm="codex-web-local.project-display-name.v1",Ic="codex-web-local.collaboration-mode-by-context.v1",sI="codex-web-local.collaboration-mode.v1",$a="__new-thread__",Wm="__new-thread-provider__::",Zu=220,iI=1e4,lI=500,uI=3e3,cI=2e3,Ah=["none","minimal","low","medium","high","xhigh"],ys="__global__",go="gpt-5.4-mini";function dI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dm);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Eh(e){typeof window>"u"||window.localStorage.setItem(Dm,JSON.stringify(e))}function fI(){if(typeof window>"u")return"";const e=window.localStorage.getItem(xh);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(xh,t),t}function hI(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 pI(e,t,n){return hI(e,t??n)}function Vm(e){return e==="plan"?"plan":"default"}function qs(e){return typeof e=="string"?e.trim():""}function wo(){return Object.create(null)}function hi(e){const t=wo();for(const[n,r]of Object.entries(e))t[n]=r;return t}function ki(e,t){if(!(t in e))return e;const n=wo();for(const[r,a]of Object.entries(e))r!==t&&(n[r]=a);return n}function Ih(e,t){let n=!1;const r=wo();for(const[a,o]of Object.entries(e)){if(a===$a||a.startsWith(Wm)||t.has(a)){r[a]=o;continue}n=!0}return n?r:e}function zm(e){return e.trim().toLowerCase()||"codex"}function mI(e){return e===$a}function ec(e){const t=zm(e);return`${Wm}${t}`}function Ns(e){return e.trim()||$a}function vI(){if(typeof window>"u")return wo();try{const n=window.localStorage.getItem(Ec);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return wo();const a=wo();for(const[o,s]of Object.entries(r)){if(typeof o!="string"||o.length===0)continue;const l=qs(s);l&&(a[o]=l)}return a}}catch{}const e=qs(window.localStorage.getItem(Bm)),t=wo();return e&&(t[$a]=e),t}function Ph(e,t){const n=Ns(t),r=qs(e[n]);return r||qs(e[$a])}function pl(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Ec):window.localStorage.setItem(Ec,JSON.stringify(e)),window.localStorage.removeItem(Bm)}catch{}}function gI(){if(typeof window>"u")return wo();try{const e=window.localStorage.getItem(Ic);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return wo();const n=wo();for(const[r,a]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const o=Vm(a);o==="plan"&&(n[r]=o)}return n}}catch{}return wo()}function ml(e,t){const n=Ns(t);return Vm(e[n])}function Rh(e,t,n){const r=Ns(t);if(mI(r))return ki(e,r);if(n==="plan"){const a=hi(e);return a[r]="plan",a}return ki(e,r)}function tc(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Ic):window.localStorage.setItem(Ic,JSON.stringify(e)),window.localStorage.removeItem(sI)}catch{}}function Gm(e,t,n){return Math.min(Math.max(e,t),n)}function ks(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 Mh(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:ks(t.totalTokens)??0,inputTokens:ks(t.inputTokens)??0,cachedInputTokens:ks(t.cachedInputTokens)??0,outputTokens:ks(t.outputTokens)??0,reasoningOutputTokens:ks(t.reasoningOutputTokens)??0}}function yI(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Mh(t.total),r=Mh(t.last);if(!n||!r)return null;const a=ks(t.modelContextWindow),o=r.totalTokens,s=typeof a=="number"?Math.max(a-o,0):null,l=typeof a=="number"&&a>0?Gm(Math.round((s??0)/a*100),0,100):null;return{total:n,last:r,modelContextWindow:a,currentContextTokens:o,remainingContextTokens:s,remainingContextPercent:l}}function wI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fm);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t)){if(!r)continue;const o=yI(a);o&&(n[r]=o)}return n}catch{return{}}}function $h(e){typeof window>"u"||window.localStorage.setItem(Fm,JSON.stringify(e))}function bI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Um);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t))r&&typeof a=="boolean"&&(n[r]=a);return n}catch{return{}}}function _I(e){typeof window>"u"||window.localStorage.setItem(Um,JSON.stringify(e))}function TI(){return typeof window>"u"?"":window.localStorage.getItem(Ac)??""}function kI(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Ac);return}window.localStorage.setItem(Ac,e)}}function CI(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(qm);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 a=Qr(r);a.length>0&&!n.includes(a)&&n.push(a)}return n}catch{return[]}}function ci(e){typeof window>"u"||window.localStorage.setItem(qm,JSON.stringify(e))}function SI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Hm);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t)){const o=typeof r=="string"?Qr(r):"";o.length>0&&typeof a=="string"&&(n[o]=a)}return n}catch{return{}}}function Nh(e){typeof window>"u"||window.localStorage.setItem(Hm,JSON.stringify(e))}function ws(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 Pa(e,n)?e:n}function nc(e,t){const n=new Map(e.map(a=>[a.projectName,a])),r=t.map(a=>n.get(a)??null).filter(a=>a!==null);for(const a of e)t.includes(a.projectName)||r.push(a);return r}function Pa(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let a=0;a<n.length;a+=1)if(n[a]!==r[a])return!1;return!0}function xI(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[a]=r.splice(t,1);return r.splice(n,0,a),r}function AI(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function EI(e=[],t=[]){var n,r,a,o;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)||((a=e[s])==null?void 0:a.status)!==((o=t[s])==null?void 0:o.status))return!1;return!0}function II(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&EI(e.steps,t.steps)}function vl(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 Pc(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Pa(e.images,t.images)&&PI(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&AI(e.commandExecution,t.commandExecution)&&II(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function As(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 Lh(e,t,n={}){const r=new Map(e.map(f=>[f.id,f])),a=new Map(t.map(f=>[f.id,f])),o=t.map(f=>{const g=r.get(f.id);return g&&Pc(g,f)?g:f});if(n.preserveMissing!==!0)return As(e,o)?e:o;const s=e.map(f=>{const g=a.get(f.id);return!g||Pc(f,g)?f:g}),l=new Set(e.map(f=>f.id)),c=o.filter(f=>!l.has(f.id)),h=[...s,...c];return As(e,h)?e:h}function PI(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],a=t[n];if(r.path!==a.path||r.operation!==a.operation||r.movedToPath!==a.movedToPath||r.diff!==a.diff||r.addedLineCount!==a.addedLineCount||r.removedLineCount!==a.removedLineCount)return!1}return!0}function Rc(e){return e.replace(/\s+/gu," ").trim()}function RI(e,t){const n=new Set(t.map(o=>o.id)),r=new Set(t.filter(o=>o.role==="assistant").map(o=>Rc(o.text)).filter(o=>o.length>0));if(r.size===0)return e;const a=e.filter(o=>{if(o.messageType!=="agentMessage.live")return!0;if(n.has(o.id))return!1;const s=Rc(o.text);return s.length===0?!1:!r.has(s)});return a.length===e.length?e:a}function gl(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Pc(r,t))return e;const a=[...e];return a.splice(n,1,t),a}const Km="worked";function Aa(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function MI(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),a=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const s=a>0||o.length===0?a:0;return o.push(`${s}s`),o.join(" ")}function $I(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function NI(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 LI(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${MI(e.durationMs)}`,messageType:Km,turnId:e.turnId}}function jI(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function OI(e,t){const n=LI(t),r=e.filter(s=>s.messageType!==Km),a=jI(r);if(a<0)return[...r,n];const o=[...r];return o.splice(a,0,n),o}function St(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function DI(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[a,o]of Object.entries(e)){if(t.has(a)){n=!0;continue}r[a]=o}return n?r:e}function FI(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 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 BI(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 fn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function jh(e,t){const n=t.trim();if(!n)return e;let r=!1;const a=[];for(const o of e){const s=o.threads.filter(c=>c.id!==n),l=s.length!==o.threads.length;l&&(r=!0),s.length>0?a.push(l?{...o,threads:s}:o):o.threads.length===0&&a.push(o)}return r?a:e}function yl(e,t){const n=new Map(e.map(a=>[a.projectName,a])),r=t.map(a=>{const o=n.get(a.projectName),s=new Map((o==null?void 0:o.threads.map(c=>[c.id,c]))??[]),l=a.threads.map(c=>{const h=s.get(c.id);return h&&FI(h,c)?h:c});return o&&o.projectName===a.projectName&&UI(o.threads,l)?o:{projectName:a.projectName,threads:l}});return BI(e,r)?e:r}function qI(e,t,n){const r=new Set(br(t).map(l=>l.id)),a=br(e).filter(l=>n[l.id]===!0&&!r.has(l.id));if(a.length===0)return t;const o=new Map(t.map(l=>[l.projectName,l])),s=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of a){if(o.get(l.projectName)){const h=s.findIndex(f=>f.projectName===l.projectName);h>=0&&(s[h]={projectName:s[h].projectName,threads:[l,...s[h].threads]});continue}s.push({projectName:l.projectName,threads:[l]})}return s}function is(e){return Qr(e)}function HI(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function WI(e){const t=e.label||Qr(e.remotePath),n=HI(e.hostId);return n?`${t} ${n}`:t}function Ym(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(a=>a.id)),r=e.projectOrder.filter(a=>t.has(a)||n.has(a));for(const a of e.order)r.includes(a)||r.push(a);for(const a of n)r.includes(a)||r.push(a);return r}function Mc(e,t){const n=Ym(e);return nu(e).map(r=>{if(n.has(r))return r;const a=ut(r).trim(),o=is(a);return t.has(o)?a:o})}function xl(e,t){return ut(e).trim()===t||is(e)===t}function VI(e,t){const n=new Set;for(const r of e.order)xl(r,t)&&n.add(r);for(const r of e.active)xl(r,t)&&n.add(r);for(const r of Object.keys(e.labels))xl(r,t)&&n.add(r);return n}function zI(e,t,n){var h,f;const r=new Set((e.remoteProjects??[]).map(g=>g.id)),a=new Map;for(const g of e.order){const T=is(g);a.has(T)||a.set(T,g)}for(const g of n){const T=((f=(h=g.threads[0])==null?void 0:h.cwd)==null?void 0:f.trim())??"";T&&a.set(g.projectName,T)}const o=[],s=g=>{g&&!o.includes(g)&&o.push(g)};for(const g of t){if(r.has(g)){s(g);continue}const T=a.get(g);T&&s(T)}for(const g of nu(e))s(g);const l=o.filter(g=>e.order.includes(g));for(const g of e.order)l.includes(g)||l.push(g);const c=e.active.filter(g=>l.includes(g));return c.length===0&&l.length>0&&c.push(l[0]),{order:l,active:c,projectOrder:o}}function GI(e,t,n){const r=Mc(t,n);if(r.length===0)return e;const a=new Map(r.map((o,s)=>[o,s]));return[...e].sort((o,s)=>{if(Nc(o)||Nc(s))return 0;const l=a.get(o.projectName)??Number.POSITIVE_INFINITY,c=a.get(s.projectName)??Number.POSITIVE_INFINITY;return l===c?0:l-c})}function $c(e,t){const n=new Map,r=new Map,a=s=>{const l=ut(s).trim();if(!l)return;const c=Qr(l),h=n.get(c)??new Set;h.add(l),n.set(c,h)};for(const s of(t==null?void 0:t.order)??[]){const l=ut(s).trim();if(!l)continue;const c=Qr(l);jl(l)||r.set(c,(r.get(c)??0)+1),a(s)}for(const s of e)for(const l of s.threads){const c=ut(l.cwd).trim(),h=Qr(c),f=(t==null?void 0:t.order.some(g=>ut(g).trim()===c))===!0;jl(c)&&!f&&r.get(h)===1||a(l.cwd)}const o=new Set;for(const[s,l]of n.entries())l.size>1&&o.add(s);return o}function jl(e){return e.includes("/.codex/worktrees/")}function KI(e,t){const n=$c(e,t);if(n.size===0)return e;const r=new Set,a=new Set,o=new Map,s=new Set;for(const h of(t==null?void 0:t.order)??[]){const f=ut(h).trim();if(!f||(s.add(f),jl(f)))continue;const g=Qr(f);r.has(g)?(r.delete(g),a.add(g),o.delete(g)):a.has(g)||(r.add(g),o.set(g,f))}const l=[],c=new Map;for(const h of e)for(const f of h.threads){const g=ut(f.cwd).trim(),T=Qr(g),I=s.has(g),j=jl(g)&&!I&&r.has(T);let B=h.projectName;j&&n.has(T)?B=o.get(T)??h.projectName:g&&n.has(T)&&(B=g);const X=f.projectName===B?f:{...f,projectName:B},U=c.get(B);if(U)U.threads.push(X);else{const O={projectName:B,threads:[X]};c.set(B,O),l.push(O)}}return l}function YI(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),a=[...e],o=Ym(t);for(const s of nu(t)){if(o.has(s)){if(r.has(s))continue;a.push({projectName:s,threads:[]}),r.add(s);continue}const l=ut(s).trim();if(!l)continue;const c=is(l),h=n.has(c)?l:c;r.has(h)||(a.push({projectName:h,threads:[]}),r.add(h))}return a}function QI(e){const t=e.split(`
|
|
51
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function JI(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Nc(e){return e.threads.some(t=>t.cwd.trim().length===0||Nl(t.cwd))}function XI(){const e=x([]),t=x([]),n=x(TI()),r=x({}),a=x({}),o=x({}),s=x({}),l=x({}),c=x({}),h=x({}),f=x({}),g=x({});let T=!1;const I=x({}),j=x([]),B=x([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),X=x(gI()),U=x(vI()),O=x(ml(X.value,n.value)),G=x(Ph(U.value,n.value)),ee=x("medium"),be=x("standard"),pe=x(""),Te=x(dI()),Pe=x(fI()),K=x(CI()),ge=x(SI()),ke=x({}),oe=x({}),Re=x({}),ze=x({}),He=x({}),Ne=x({}),Fe=x({}),Le=x({}),et=x({}),Ge=x({}),Je=x({}),Ke=x({}),it=x({}),qe=x({}),Xe=x({}),nt=x(null),Q=x(wI()),Ee=x(bI()),ve=x({}),Oe=x([]),We=x([]),A=x(!1),$=x(!1),V=x(!1),ne=x(!1),le=x(!1),ae=x(!1),he=x(!1),ue=x(""),ye=x(!1),de=x(!1);function Me(i){var d;try{const v=new URL(i,"http://localhost");return v.pathname!=="/codex-local-image"?"":((d=v.searchParams.get("path"))==null?void 0:d.trim())??""}catch{return""}}function xe(i){const d=i.trim().toLowerCase();return d?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(d):!1}function $e(i){var v;const d=r.value[i]??[];for(let _=d.length-1;_>=0;_-=1){const M=d[_];if(!(M.role!=="user"||!Array.isArray(M.images)||M.images.length===0))for(let N=M.images.length-1;N>=0;N-=1){const H=((v=M.images[N])==null?void 0:v.trim())??"";if(H&&Me(H))return H}}return""}let je=null,tt=null,D=null;const q=new Map;let W=null;const se=new Map;let me=null,Ce=null,Ue=!1;const vt=new Set,ht=new Map;let ot=null,bt=null,Dt=!1,Tr=!1,cn=[],Xr=null,zo=!1,pn=!1;const gn=new Map,$r=new Set,dr=Z(()=>br(e.value)),kr=Z(()=>dr.value.find(i=>i.id===n.value)??null),rn=Z(()=>{const i=n.value;return!!(i&&Ee.value[i]===!0)}),Ao=Z(()=>{const i=n.value;return i?Je.value[i]===!0:!1}),mn=Z(()=>{const i=[],d=n.value;return d&&Array.isArray(qe.value[d])&&i.push(...qe.value[d]),Array.isArray(qe.value[ys])&&i.push(...qe.value[ys]),i.sort((v,_)=>v.receivedAtIso.localeCompare(_.receivedAtIso))}),Eo=Z(()=>{var N;const i=n.value;if(!i)return null;const d=h.value[i]===!0,v=d?Le.value[i]:void 0,_=d?(s.value[i]??"").trim():"",M=(((N=et.value[i])==null?void 0:N.message)??"").trim();return!v&&!_&&!M?null:{activityLabel:(v==null?void 0:v.label)||"Thinking",activityDetails:(v==null?void 0:v.details)??[],reasoningText:_,errorText:M}}),Io=Z(()=>nt.value),Po=Z(()=>{const i=n.value;return i?Q.value[i]??null:null}),Go=Z(()=>{const i=n.value;if(!i)return[];const d=r.value[i]??[],v=a.value[i]??[],_=o.value[i]??[],M=l.value[i]??[],N=c.value[i]??[],H=[...d,...v,...M,...N,..._],Y=Fe.value[i];return Y?OI(H,Y):H}),Nr=Z(()=>{const i=n.value;return i?Re.value[i]===!0:!1}),gt=Z(()=>{const i=n.value;return i?ze.value[i]===!0:!1});function Un(i){var v;const d=r.value[i]??[];for(const _ of d){const M=((v=_.turnId)==null?void 0:v.trim())??"";if(M)return M}return""}function Lt(i){if(Ns(i)===$a){const v=ec(pe.value),_=v?qs(U.value[v]):"";if(_)return _}return Ph(U.value,i).trim()}function er(...i){const d=[...j.value];for(const v of i){const _=v.trim();_&&!d.includes(_)&&d.push(_)}Pa(j.value,d)||(j.value=d)}function Ft(i){n.value!==i&&(n.value=i,kI(i),G.value=Lt(i),er(G.value),O.value=ml(X.value,i),pn=!1)}function Bn(i,d){const v=d.trim(),_=Ns(i);if(v){const M=hi(U.value);M[_]=v,U.value=M}else U.value=ki(U.value,_);if(i.trim()===n.value?(G.value=Lt(n.value),er(G.value)):er(v),_===$a){const M=ec(pe.value);if(M)if(v){const N=hi(U.value);N[M]=v,U.value=N}else U.value=ki(U.value,M)}pl(U.value)}function Rn(i){Bn(n.value,i)}function on(i,d){const v=i.trim();if(!v)return;const _=d.trim();if(_){const M=hi(U.value);M[v]=_,U.value=M}else U.value=ki(U.value,v);er(_),n.value===v&&(G.value=Lt(n.value)),pl(U.value)}function Ut(i,d){const v=i.trim();if(!v)return;if(!d){if(!(v in Q.value))return;Q.value=St(Q.value,v),$h(Q.value);return}const _=Q.value[v];_&&JSON.stringify(_)===JSON.stringify(d)||(Q.value={...Q.value,[v]:d},$h(Q.value))}function $t(i){const d=i==="plan"?"plan":"default",v=Ns(n.value);ml(X.value,n.value)===d&&O.value===d||(O.value=d,X.value=Rh(X.value,v,d),tc(X.value))}function Yt(i,d){const v=d==="plan"?"plan":"default";X.value=Rh(X.value,i,v),i.trim()===n.value&&(O.value=v),tc(X.value)}function qn(i){nt.value=i}async function fr(i=n.value){i.trim()?on(i,go):Rn(go),er(go)}function Ko(i,d){Xe.value={...Xe.value,[i]:d}}function Zr(i){Xe.value[i]&&(Xe.value=St(Xe.value,i))}async function eo(i){if($r.has(i))return;const d=Xe.value[i];if(!(!d||d.fallbackRetried)){$r.add(i),Ko(i,{...d,fallbackRetried:!0});try{await fr(i);try{const v=await zu(i,1);xn(i,v),En(i),vn(i,[]),qt(i),l.value[i]&&(l.value=St(l.value,i))}catch{}Tt(i,null),ue.value="",Nt(i,null),Ct(i,{label:"Thinking",details:tr(go,d.effort,d.collaborationMode)}),Qt(i,!0),He.value[i]!==!0&&await Vu(i),await Gu(i,d.text,d.imageUrls,go,d.effort||void 0,d.skills.length>0?d.skills:void 0,d.fileAttachments,d.collaborationMode),He.value={...He.value,[i]:!0},to(),vt.add(i),await po()}catch(v){const _=v instanceof Error?v.message:"Unknown application error";Tt(i,_),ue.value=_,Qt(i,!1),Ct(i,null)}finally{$r.delete(i)}}}function Lr(i){i&&!Ah.includes(i)||(ee.value=i)}async function Mn(i){const d=i==="fast"?"fast":"standard";if(ae.value||be.value===d)return;const v=be.value;be.value=d,ae.value=!0,ue.value="";try{await F_(d)}catch(_){be.value=v,ue.value=_ instanceof Error?_.message:"Failed to update Fast mode"}finally{ae.value=!1}}async function $n(){try{const i=await V_();B.value=i,i.some(d=>d.value===O.value)||$t("default")}catch{}}function tr(i,d,v=O.value){const _=i.trim()||"default",M=d||"default",N=v==="plan"?"Plan":"Default",H=be.value==="fast"?"Fast":"Standard";return[`Mode: ${N}`,`Model: ${_}`,`Thinking: ${M}`,`Speed: ${H}`]}async function hr(i){try{const[d,v]=await Promise.all([Im({includeProviderModels:(i==null?void 0:i.includeProviderModels)!==!1}),Pm()]),_=Lt(n.value),M=v.model.trim(),N=zm(v.providerId);pe.value=N;const H=ec(N),Y=H?qs(U.value[H]):"",ie=[...d];if(!(i!=null&&i.providerChanged))for(const Ye of[_,M])Ye&&!ie.includes(Ye)&&ie.push(Ye);j.value=ie;const we=_&&d.includes(_);if((!_||!we||i!=null&&i.providerChanged)&&(i!=null&&i.providerChanged&&ie.length>0?Y&&ie.includes(Y)?Rn(Y):M&&ie.includes(M)?Rn(M):Rn(ie[0]):M&&ie.includes(M)?Rn(v.model):ie.length>0?Rn(ie[0]):Rn("")),H&&G.value.trim().length>0){const Ye=hi(U.value);Ye[H]=G.value.trim(),U.value=Ye,pl(U.value)}v.reasoningEffort&&Ah.includes(v.reasoningEffort)&&(ee.value=v.reasoningEffort),be.value=v.speedMode}catch{}}async function nr(){if(Ce){await Ce;return}Ce=(async()=>{try{const i=await C_();qn(i),We.value=i?[i]:[]}catch{}finally{Ce=null}})(),await Ce}function to(){if(typeof window>"u"){nr();return}D!==null&&window.clearTimeout(D),D=window.setTimeout(()=>{D=null,nr()},lI)}function Hn(i){if(!i||typeof window>"u")return;const d=q.get(i);d!==void 0&&(window.clearTimeout(d),q.delete(i))}function Cr(i){if(!i||typeof window>"u")return;Hn(i);const d=window.setTimeout(()=>{q.delete(i),vt.add(i),po()},uI);q.set(i,d)}function pr(i){const d=ve.value;return Object.keys(d).length===0?i:i.map(v=>({projectName:v.projectName,threads:v.threads.map(_=>{const M=d[_.id];return M?{..._,title:M}:_})}))}function Ro(i){return i?Array.isArray(qe.value[i])?qe.value[i]:[]:[]}function Wn(i){return i==="item/commandExecution/requestApproval"||i==="item/fileChange/requestApproval"||i==="item/permissions/requestApproval"||i==="execCommandApproval"||i==="applyPatchApproval"}function an(i){return i.some(d=>Wn(d.method))?"approval":i.length>0?"response":null}function ct(){const d=pr(t.value).map(v=>({projectName:v.projectName,threads:v.threads.map(_=>{const M=h.value[_.id]===!0,N=an(Ro(_.id)),H=n.value===_.id,Y=I.value[_.id]===!0,ie=pI(_.updatedAtIso,Te.value[_.id],Pe.value);return{..._,inProgress:M,unread:!H&&!M&&(Y||ie),pendingRequestState:N}})}));e.value=yl(e.value,d)}function Nn(i,d,v){const _=new Date().toISOString(),M=ut(d),N=Qr(M),H={id:i,title:QI(v),projectName:N,cwd:M,hasWorktree:M.includes("/.codex/worktrees/")||M.includes("/.git/worktrees/"),createdAtIso:_,updatedAtIso:_,preview:v,unread:!1,inProgress:!1},Y=t.value.findIndex(we=>we.projectName===N);if(Y>=0){const Ye=t.value[Y].threads.filter(kt=>kt.id!==i),_t={projectName:N,threads:[H,...Ye]},yt=[...t.value];yt.splice(Y,1,_t),t.value=yt}else t.value=[{projectName:N,threads:[H]},...t.value];const ie=ws(K.value,t.value);Pa(K.value,ie)||(K.value=ie,ci(K.value)),ct()}function Ln(i){const d=new Set(i.map(ie=>ie.id)),v=n.value.trim();v&&d.add(v);const _=Ih(U.value,d);_!==U.value&&(U.value=_,G.value=Lt(n.value),er(G.value),pl(_));const M=Ih(X.value,d);M!==X.value&&(X.value=M,O.value=ml(M,n.value),tc(M));const N=fn(Te.value,d);N!==Te.value&&(Te.value=N,Eh(N)),oe.value=fn(oe.value,d),ke.value=fn(ke.value,d),He.value=fn(He.value,d),Ne.value=fn(Ne.value,d),r.value=fn(r.value,d),o.value=fn(o.value,d),s.value=fn(s.value,d),l.value=fn(l.value,d),c.value=fn(c.value,d),Fe.value=fn(Fe.value,d),Le.value=fn(Le.value,d),et.value=fn(et.value,d),Ge.value=fn(Ge.value,d),Je.value=fn(Je.value,d),Ke.value=fn(Ke.value,d),it.value=fn(it.value,d);const H=fn(f.value,d);H!==f.value&&(f.value=H,De()),Q.value=fn(Q.value,d),I.value=fn(I.value,d),h.value=fn(h.value,d);const Y={};for(const[ie,we]of Object.entries(qe.value))(ie===ys||d.has(ie))&&(Y[ie]=we);qe.value=Y}function jr(i){const d=br(t.value).find(v=>v.id===i);d&&(Te.value={...Te.value,[i]:d.updatedAtIso},Eh(Te.value),I.value[i]&&(I.value=St(I.value,i)),ct())}function Nt(i,d){if(!i)return;const v=Fe.value[i];if(d){if($I(v,d))return;Fe.value={...Fe.value,[i]:d}}else v&&(Fe.value=St(Fe.value,i))}function Qt(i,d){!i||h.value[i]===!0===d||(d?h.value={...h.value,[i]:!0}:(h.value=St(h.value,i),Jt(i),Vn(i)),ct(),!d&&!dn()&&ot&&zr())}function Vn(i){i&&(Je.value[i]&&(Je.value=St(Je.value,i)),Ke.value[i]&&(Ke.value=St(Ke.value,i)),it.value[i]&&(it.value=St(it.value,i)))}function mr(i){i&&(Je.value={...Je.value,[i]:!0},Ke.value[i]&&(Ke.value=St(Ke.value,i)),it.value[i]&&(it.value=St(it.value,i)))}function no(i){i&&Je.value[i]===!0&&Ke.value[i]===!0&&it.value[i]===!0&&Vn(i)}function Bt(i,d){!i||!d||Je.value[i]===!0&&Vn(i)}function Sr(i){const d=Object.keys(Je.value);if(d.length===0)return;let v=Ke.value,_=!1;for(const M of d)!i.has(M)||v[M]===!0||(v={...v,[M]:!0},_=!0);if(_){Ke.value=v;for(const M of d)no(M)}}function yn(i,d){i&&Je.value[i]===!0&&d.some(v=>v.role==="user")&&(it.value[i]!==!0&&(it.value={...it.value,[i]:!0}),no(i))}function Sn(i){i&&i!==n.value&&I.value[i]!==!0&&(I.value={...I.value,[i]:!0},ct())}function Ct(i,d){if(!i)return;const v=Le.value[i];if(!d){v&&(Le.value=St(Le.value,i));return}const _=qr(d.label)||"Thinking",M=d.details.map(Y=>qr(Y)).filter(Y=>Y.length>0&&Y!==_),N=Array.from(new Set([...(v==null?void 0:v.details)??[],...M])).slice(-3),H={label:_,details:N};NI(v,H)||(Le.value={...Le.value,[i]:H})}function Tt(i,d,v={}){if(!i)return;const _=et.value[i],M=d?Rc(d):"";if(!M){_&&(et.value=St(et.value,i));return}const N=v.transient===!0;(_==null?void 0:_.message)===M&&_.transient===N||(et.value={...et.value,[i]:{message:M,transient:N}})}function sn(i){var d;i&&(d=et.value[i])!=null&&d.transient&&Tt(i,null)}function Or(){const i=Object.entries(et.value).filter(([,v])=>v==null?void 0:v.transient).map(([v])=>v);if(i.length===0)return;let d=et.value;for(const v of i)d=St(d,v);et.value=d}function vr(i){const d=br(t.value).find(v=>v.id===i);return(d==null?void 0:d.updatedAtIso)??""}function zn(i,d){if(!i)return;const v={...Ee.value};d?v[i]=!0:delete v[i],Ee.value=v,_I(v)}function Yo(){const i=n.value;i&&zn(i,!rn.value)}function xn(i,d){const v=r.value[i]??[];As(v,d)||(r.value={...r.value,[i]:d})}function vn(i,d){const v=o.value[i]??[];As(v,d)||(o.value={...o.value,[i]:d})}function An(i){i&&i in o.value&&(o.value=St(o.value,i))}function Vt(i,d){const v=c.value[i]??[];As(v,d)||(c.value={...c.value,[i]:d})}function xr(i,d){const v=a.value[i]??[];As(v,d)||(a.value={...a.value,[i]:d})}function P(i,d){const v=a.value[i]??[],_=gl(v,d);xr(i,_)}function F(i,d){const v=o.value[i]??[],_=gl(v,d);vn(i,_)}function te(i,d){const v=c.value[i]??[],_=gl(v,d);Vt(i,_)}function Ae(i,d){if(!i)return;const v=d.trim(),_=s.value[i]??"";if(v.length===0){if(!_)return;s.value=St(s.value,i);return}_!==v&&(s.value={...s.value,[i]:v})}function wt(i,d){if(!i)return;const v=s.value[i]??"";Ae(i,`${v}${d}`)}function qt(i){i&&i in s.value&&(s.value=St(s.value,i))}function En(i){i&&i in a.value&&(a.value=St(a.value,i))}function zt(i){i&&i in c.value&&(c.value=St(c.value,i))}function Jt(i){i&&(En(i),qt(i),Ct(i,null),n.value,l.value[i]&&(l.value=St(l.value,i)),Ge.value[i]&&(Ge.value=St(Ge.value,i)),Zr(i))}function Gn(i){return i==="completed"?"completed":i==="inProgress"||i==="in_progress"?"inProgress":"pending"}function rr(i){var v;const d=[];(v=i.explanation)!=null&&v.trim()&&d.push(i.explanation.trim());for(const _ of i.steps){const M=_.status==="completed"?"x":_.status==="inProgress"?"~":" ";d.push(`- [${M}] ${_.step}`)}return d.join(`
|
|
52
|
+
`).trim()}function us(i){if(i.method!=="turn/plan/updated")return null;const d=Ie(i.params),v=At(i),_=Se(d==null?void 0:d.turnId)||Se(d==null?void 0:d.turn_id),N=(Array.isArray(d==null?void 0:d.plan)?d==null?void 0:d.plan:[]).map(ie=>Ie(ie)).map(ie=>({step:Se(ie==null?void 0:ie.step),status:Gn(ie==null?void 0:ie.status)})).filter(ie=>ie.step.length>0);if(!v||!_)return null;const Y={explanation:Se(d==null?void 0:d.explanation).trim()||void 0,steps:N,isStreaming:!0};return{threadId:v,message:{id:`${_}:plan`,role:"assistant",text:rr(Y),messageType:"plan.live",plan:Y}}}function cs(i){if(i.method!=="item/plan/delta")return null;const d=Ie(i.params),v=At(i),_=Se(d==null?void 0:d.turnId)||Se(d==null?void 0:d.turn_id),M=Se(d==null?void 0:d.delta);if(!v||!_||!M)return null;const N=`${_}:plan`,H=(a.value[v]??[]).find(we=>we.id===N),Y=`${(H==null?void 0:H.text)??""}${M}`,ie=H!=null&&H.plan?{...H.plan,isStreaming:!0}:void 0;return{threadId:v,message:{id:N,role:"assistant",text:Y,messageType:"plan.live",plan:ie}}}function Ie(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:null}function Se(i){return typeof i=="string"?i:""}function ln(i){return typeof i=="number"&&Number.isFinite(i)?i:null}function Dr(i){const d=Ie(i);if(!d)return null;const v=ln(d.totalTokens??d.total_tokens),_=ln(d.inputTokens??d.input_tokens),M=ln(d.cachedInputTokens??d.cached_input_tokens),N=ln(d.outputTokens??d.output_tokens),H=ln(d.reasoningOutputTokens??d.reasoning_output_tokens);return v===null||_===null||M===null||N===null||H===null?null:{totalTokens:v,inputTokens:_,cachedInputTokens:M,outputTokens:N,reasoningOutputTokens:H}}function Qo(i){const d=Ie(i);if(!d)return null;const v=Dr(d.total),_=Dr(d.last);if(!v||!_)return null;const M=ln(d.modelContextWindow??d.model_context_window),N=_.totalTokens,H=typeof M=="number"?Math.max(M-N,0):null,Y=typeof M=="number"&&M>0?Gm(Math.round((H??0)/M*100),0,100):null;return{total:v,last:_,modelContextWindow:M,currentContextTokens:N,remainingContextTokens:H,remainingContextPercent:Y}}function Ar(i){if(i.method!=="thread/tokenUsage/updated")return null;const d=Ie(i.params),v=At(i),_=Qo((d==null?void 0:d.tokenUsage)??(d==null?void 0:d.token_usage));return!v||!_?null:{threadId:v,usage:_}}function At(i){const d=Ie(i.params);if(!d)return"";const v=Se(d.threadId);if(v)return v;const _=Se(d.thread_id);if(_)return _;const M=Se(d.conversationId);if(M)return M;const N=Se(d.conversation_id);if(N)return N;const H=Ie(d.thread),Y=Se(H==null?void 0:H.id);if(Y)return Y;const ie=Ie(d.turn),we=Se(ie==null?void 0:ie.threadId);if(we)return we;const Ye=Se(ie==null?void 0:ie.thread_id);return Ye||""}function Jo(i){if(i.method!=="turn/completed")return"";const d=Ie(i.params),v=Ie(d==null?void 0:d.turn);if(!v||v.status!=="failed")return"";const _=Ie(v.error);return Se(_==null?void 0:_.message)}function Da(i){var _;if(i.method!=="error")return null;const d=Ie(i.params),v=Se(d==null?void 0:d.message)||Se((_=Ie(d==null?void 0:d.error))==null?void 0:_.message);return v?{message:v,transient:(d==null?void 0:d.willRetry)===!0}:null}function ro(i){const d=Ie(i);if(!d)return null;const v=d.id,_=Se(d.method),M=d.params;if(typeof v!="number"||!Number.isInteger(v)||!_)return null;const N=Ie(M),H=oo(_,N),Y=Se(N==null?void 0:N.threadId)||Se(N==null?void 0:N.thread_id)||Se(N==null?void 0:N.conversationId)||Se(N==null?void 0:N.conversation_id)||ys,ie=Se(N==null?void 0:N.turnId)||Se(N==null?void 0:N.turn_id),we=Se(N==null?void 0:N.itemId)||Se(N==null?void 0:N.item_id)||Se(N==null?void 0:N.callId)||Se(N==null?void 0:N.call_id),Ye=Se(d.receivedAtIso)||new Date().toISOString();return{id:v,method:H,threadId:Y,turnId:ie,itemId:we,receivedAtIso:Ye,params:M??null}}function oo(i,d){const v=i.trim();return v&&(v==="item/commandExecution/requestApproval"||v==="execCommandApproval"||v==="exec_approval_request"||Fr(d)?"item/commandExecution/requestApproval":v==="item/fileChange/requestApproval"||v==="applyPatchApproval"||v==="apply_patch_approval_request"||ao(d)?"item/fileChange/requestApproval":v==="item/tool/requestUserInput"||v==="request_user_input"||Ur(d)?"item/tool/requestUserInput":v==="mcpServer/elicitation/request"||v==="elicitation_request"||Kn(d)?"mcpServer/elicitation/request":v==="item/permissions/requestApproval"||io(d)?"item/permissions/requestApproval":v==="item/tool/call"||v==="dynamic_tool_call_request"||so(d)?"item/tool/call":v)}function Fr(i){if(!i)return!1;const d=i.command;return Array.isArray(d)&&d.some(v=>typeof v=="string"&&v.trim().length>0)||typeof d=="string"&&d.trim().length>0?!0:Array.isArray(i.commandActions)}function ao(i){return i?typeof i.grantRoot=="string"&&i.grantRoot.trim().length>0||typeof i.grant_root=="string"&&i.grant_root.trim().length>0||Ie(i.fileChanges)?!0:Ie(i.changes)!==null:!1}function Ur(i){return!!(i&&Array.isArray(i.questions))}function so(i){return i?typeof i.toolName=="string"||typeof i.tool_name=="string"||typeof i.name=="string"||Array.isArray(i.arguments):!1}function Kn(i){if(!i)return!1;const d=Se(i.mode);return typeof i.serverName=="string"&&typeof i.threadId=="string"&&typeof i.message=="string"&&(d==="form"||d==="url")}function io(i){return i?typeof i.threadId=="string"&&typeof i.turnId=="string"&&typeof i.itemId=="string"&&Ie(i.permissions)!==null:!1}function Mo(i){if(i.method!=="item/tool/requestUserInput")return[];const d=Ie(i.params),v=Array.isArray(d==null?void 0:d.questions)?d.questions:[],_=[];for(const M of v){const N=Ie(M),H=Se(N==null?void 0:N.id).trim();H&&_.push(H)}return _}function In(i){const d=i.threadId||ys,v=qe.value[d]??[],_=v.findIndex(N=>N.id===i.id),M=[...v];_>=0?M.splice(_,1,i):M.push(i),qe.value={...qe.value,[d]:M.sort((N,H)=>N.receivedAtIso.localeCompare(H.receivedAtIso))},ct()}function Er(i){const d={};for(const[v,_]of Object.entries(qe.value)){const M=_.filter(N=>N.id!==i);M.length>0&&(d[v]=M)}qe.value=d,ct()}function Br(i){const d={};for(const v of i){const _=v.threadId||ys,M=d[_]??[];M.push(v),d[_]=M}for(const v of Object.values(d))v.sort((_,M)=>_.receivedAtIso.localeCompare(M.receivedAtIso));qe.value=d}function Xo(i){if(i.method==="server/request"){const d=ro(i.params);return d&&In(d),!0}if(i.method==="server/request/resolved"){const d=Ie(i.params),v=d==null?void 0:d.id;return typeof v=="number"&&Number.isInteger(v)&&Er(v),!0}return!1}function qr(i){return i.replace(/\s+/gu," ").trim()}function Pn(i){const d=At(i);if(!d)return null;if(i.method==="turn/started")return{threadId:d,activity:{label:"Thinking",details:[]}};if(i.method==="item/started"){const v=Ie(i.params),_=Ie(v==null?void 0:v.item),M=Se(_==null?void 0:_.type).toLowerCase();if(M==="reasoning")return{threadId:d,activity:{label:"Thinking",details:[]}};if(M==="agentmessage")return{threadId:d,activity:{label:"Writing response",details:[]}};if(M==="commandexecution"){const N=Se(_==null?void 0:_.command);return{threadId:d,activity:{label:"Running command",details:N?[N]:[]}}}if(M==="filechange"){const H=(Array.isArray(_==null?void 0:_.changes)?_.changes:[])[0],Y=Se(H==null?void 0:H.path);return{threadId:d,activity:{label:"Applying changes",details:Y?[Y]:[]}}}}return i.method==="item/commandExecution/outputDelta"?{threadId:d,activity:{label:"Running command",details:[]}}:i.method==="item/fileChange/outputDelta"?{threadId:d,activity:{label:"Applying changes",details:[]}}:i.method==="item/reasoning/summaryTextDelta"||i.method==="item/reasoning/summaryPartAdded"?{threadId:d,activity:{label:"Thinking",details:[]}}:i.method==="item/agentMessage/delta"?{threadId:d,activity:{label:"Writing response",details:[]}}:null}function ya(i){if(i.method!=="turn/started")return null;const d=Ie(i.params);if(!d)return null;const v=At(i);if(!v)return null;const _=Ie(d.turn),M=Se(_==null?void 0:_.id)||Se(d.turnId)||`${v}:unknown`;if(!M)return null;const N=Aa(Se(_==null?void 0:_.startedAt))??Aa(Se(d.startedAt))??Aa(i.atIso)??Date.now();return{threadId:v,turnId:M,startedAtMs:N}}function Ir(i){if(i.method!=="turn/completed")return null;const d=Ie(i.params);if(!d)return null;const v=At(i);if(!v)return null;const _=Ie(d.turn),M=Se(_==null?void 0:_.id)||Se(d.turnId)||`${v}:unknown`;if(!M)return null;const N=Aa(Se(_==null?void 0:_.completedAt))??Aa(Se(d.completedAt))??Aa(i.atIso)??Date.now(),H=Aa(Se(_==null?void 0:_.startedAt))??Aa(Se(d.startedAt))??void 0;return{threadId:v,turnId:M,completedAtMs:N,startedAtMs:H}}function Zo(i){return`${i}:live-reasoning`}function ds(i){const d=r.value[i]??[];let v=-1;for(const _ of d)typeof _.turnIndex=="number"&&Number.isFinite(_.turnIndex)&&(v=Math.max(v,_.turnIndex));return v+1}function lo(i,d,v){if(!i||!d||!Number.isInteger(v)||v<0)return;const _=Ne.value[i]??{};_[d]!==v&&(Ne.value={...Ne.value,[i]:{..._,[d]:v}})}function Yn(i,d){const v=Ne.value[i]??{},_=Object.entries(v),M=Object.entries(d);_.length===M.length&&_.every(([N,H])=>d[N]===H)||(Ne.value={...Ne.value,[i]:{...d}})}function uo(i){const d=c.value[i];if(!d||d.length===0)return;const v=Ne.value[i]??{};let _=!1;const M=d.map(N=>{if(typeof N.turnIndex=="number"||!N.turnId)return N;const H=v[N.turnId];return typeof H!="number"?N:(_=!0,{...N,turnIndex:H})});_&&(c.value={...c.value,[i]:M})}function Fa(i){const d=Ie(i.params);if(!d)return"";if(i.method==="item/started"){const v=Ie(d.item);return!v||v.type!=="reasoning"?"":Se(v.id)}return""}function wn(i){const d=Ie(i.params);if(!d)return null;if(i.method==="item/reasoning/summaryTextDelta"){const v=Se(d.itemId),_=Se(d.delta);return!v||!_?null:{messageId:Zo(v),delta:_}}return null}function jn(i){const d=Ie(i.params);if(!d)return"";if(i.method==="item/reasoning/summaryPartAdded"){const v=Se(d.itemId);return v?Zo(v):""}return""}function gr(i){const d=Ie(i.params);if(!d)return"";if(i.method==="item/completed"){const v=Ie(d.item);return!v||v.type!=="reasoning"?"":Zo(Se(v.id))}return""}function wa(i){const d=Ie(i.params);if(!d)return"";if(i.method==="item/started"){const v=Ie(d.item);return!v||v.type!=="agentMessage"?"":Se(v.id)}return""}function yr(i){const d=Ie(i.params);if(!d)return null;if(i.method==="item/agentMessage/delta"){const v=Se(d.itemId),_=Se(d.delta);return!v||!_?null:{messageId:v,delta:_}}return null}function or(i){const d=Ie(i.params);if(!d)return null;if(i.method==="item/completed"){const v=Ie(d.item);if(!v||v.type!=="agentMessage")return null;const _=Se(v.id),M=Se(v.text);return!_||!M?null:{id:_,role:"assistant",text:M,messageType:"agentMessage.live"}}return null}function co(i){return`/codex-local-image?path=${encodeURIComponent(i)}`}function Ua(i){const d=i.trim();if(!d)return"";if(d.startsWith("data:")||d.startsWith("http://")||d.startsWith("https://")||d.startsWith("/codex-local-image?"))return d;const v=d.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(v)?`data:image/png;base64,${v}`:""}function ba(i){if(i.method!=="item/completed")return null;const d=Ie(i.params),v=Ie(d==null?void 0:d.item);if(!v)return null;const _=Se(v.id);if(!_)return null;if(v.type==="imageView"){const H=Se(v.path);return H?{id:_,role:"assistant",text:"",images:[co(H)],messageType:"imageView"}:null}if(v.type!=="imageGeneration"&&v.type!=="image_generation")return null;const M=Se(v.result),N=M?Ua(M):"";return N?{id:_,role:"assistant",text:"",images:[N],messageType:"imageView"}:null}function $o(i){var we;if(i.method!=="item/started")return null;const d=Ie(i.params),v=Ie(d==null?void 0:d.item);if(!v||v.type!=="commandExecution")return null;const _=Se(v.id),M=Se(v.command);if(!_)return null;const N=typeof v.cwd=="string"?v.cwd:null,H=At(i),Y=Se(d==null?void 0:d.turnId)||Se(d==null?void 0:d.turn_id),ie=H&&Y?(we=Ne.value[H])==null?void 0:we[Y]:void 0;return{id:_,role:"system",text:M,messageType:"commandExecution",commandExecution:{command:M,cwd:N,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:Y||void 0,turnIndex:typeof ie=="number"?ie:void 0}}function Ba(i){if(i.method!=="item/commandExecution/outputDelta")return null;const d=Ie(i.params);if(!d)return null;const v=Se(d.itemId),_=Se(d.delta);return!v||!_?null:{itemId:v,delta:_}}function No(i){var kt;if(i.method!=="item/completed")return null;const d=Ie(i.params),v=Ie(d==null?void 0:d.item);if(!v||v.type!=="commandExecution")return null;const _=Se(v.id),M=Se(v.command);if(!_)return null;const N=typeof v.cwd=="string"?v.cwd:null,H=Se(v.status),Y=H==="failed"?"failed":H==="declined"?"declined":H==="interrupted"?"interrupted":"completed",ie=typeof v.aggregatedOutput=="string"?v.aggregatedOutput:"",we=typeof v.exitCode=="number"?v.exitCode:null,Ye=At(i),_t=Se(d==null?void 0:d.turnId)||Se(d==null?void 0:d.turn_id),yt=Ye&&_t?(kt=Ne.value[Ye])==null?void 0:kt[_t]:void 0;return{id:_,role:"system",text:M,messageType:"commandExecution",commandExecution:{command:M,cwd:N,status:Y,aggregatedOutput:ie,exitCode:we},turnId:_t||void 0,turnIndex:typeof yt=="number"?yt:void 0}}function Hr(i){var we;if(i.method!=="item/completed")return null;const d=Ie(i.params),v=Ie(d==null?void 0:d.item);if(!v||v.type!=="fileChange")return null;const _=Se(v.id);if(!_)return null;const M=Se(d==null?void 0:d.threadId),N=Se(d==null?void 0:d.turnId),H=M&&N?(we=Ne.value[M])==null?void 0:we[N]:void 0,Y=Cm(v.changes),ie=km(v.status);return Y.length===0||ie!=="completed"?null:{id:_,role:"system",text:"",messageType:"fileChange",fileChangeStatus:ie,fileChanges:Y,turnId:N||void 0,turnIndex:typeof H=="number"?H:void 0}}function Wr(i,d){const v=l.value[i]??[],_=gl(v,d);_!==v&&(l.value={...l.value,[i]:_})}function ea(i,d){const v=l.value[i];if(!v||v.length===0)return;const _=new Set(d.map(N=>N.id)),M=v.filter(N=>!_.has(N.id));M.length!==v.length&&(M.length===0?l.value=St(l.value,i):l.value={...l.value,[i]:M})}function fo(i,d){const v=c.value[i];if(!v||v.length===0)return;const _=new Set(d.map(Y=>Y.id)),M=new Set(d.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnId=="string"&&Y.turnId.length>0).map(Y=>Y.turnId)),N=new Set(d.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnIndex=="number").map(Y=>Y.turnIndex)),H=v.filter(Y=>!_.has(Y.id)&&!(Y.turnId&&M.has(Y.turnId))&&!(typeof Y.turnIndex=="number"&&N.has(Y.turnIndex)));H.length!==v.length&&(H.length===0?c.value=St(c.value,i):c.value={...c.value,[i]:H})}function Ht(i){if(i.method==="item/agentMessage/delta")return!0;const d=Ie(i.params);if(!d)return!1;if(i.method==="item/completed"){const v=Ie(d.item);return(v==null?void 0:v.type)==="agentMessage"}return!1}function ar(i){var Ki,Yi,Qi,ti,Ji;if(Xo(i))return;if(i.method==="account/rateLimits/updated"&&to(),i.method==="thread/name/updated"){const lt=Ie(i.params),wr=Se(lt==null?void 0:lt.threadId),na=Se(lt==null?void 0:lt.threadName);wr&&na&&(ve.value={...ve.value,[wr]:na},ct(),Yu(wr,na))}if(i.method==="account/rateLimits/updated"){qn(Am(i.params));return}const d=Ar(i);if(d){Ut(d.threadId,d.usage);return}const v=Pn(i);v&&Ct(v.threadId,v.activity);const _=At(i),M=Da(i);!M&&_&&sn(_);const N=ya(i);N&&(gn.set(N.turnId,N),lo(N.threadId,N.turnId,ds(N.threadId)),Ge.value={...Ge.value,[N.threadId]:N.turnId},Bt(N.threadId,N.turnId),En(N.threadId),zt(N.threadId),Nt(N.threadId,null),Tt(N.threadId,null),Qt(N.threadId,!0),Xs(N.threadId),I.value[N.threadId]&&(I.value=St(I.value,N.threadId)));const H=Ir(i),Y=Jo(i),ie=(H==null?void 0:H.threadId)??At(i),we=ie?Lt(ie):"",Ye=!!ie&&!!Y&&we!==go&&vl(new Error(Y));if(H){Xe.value[H.threadId];const lt=gn.get(H.turnId);lt&&gn.delete(H.turnId);const wr=ln((Ki=Ie(i.params))==null?void 0:Ki.durationMs)??ln((Qi=Ie((Yi=Ie(i.params))==null?void 0:Yi.turn))==null?void 0:Qi.durationMs)??(typeof H.startedAtMs=="number"?H.completedAtMs-H.startedAtMs:null)??(lt?H.completedAtMs-lt.startedAtMs:null),na=typeof wr=="number"?Math.max(0,wr):0;Nt(H.threadId,{turnId:H.turnId,durationMs:na}),Ge.value[H.threadId]&&(Ge.value=St(Ge.value,H.threadId)),Qt(H.threadId,!1),Ct(H.threadId,null),Sn(H.threadId),Ye||(Zr(H.threadId),Xs(H.threadId))}if(Y){const lt=(H==null?void 0:H.threadId)||At(i);lt&&Tt(lt,Y),ue.value=Y,lt&&Ye&&eo(lt)}else H&&Tt(H.threadId,null);if(M){const lt=_,wr=lt?Lt(lt):G.value.trim();lt&&Tt(lt,M.message,{transient:M.transient}),ue.value=M.message,wr!==go&&vl(new Error(M.message))&&(lt?eo(lt):fr())}const _t=us(i);_t&&(P(_t.threadId,_t.message),Ct(_t.threadId,{label:"Planning",details:((ti=_t.message.plan)==null?void 0:ti.steps.map(lt=>lt.step).slice(0,2))??[]}));const yt=cs(i);if(yt&&(P(yt.threadId,yt.message),Ct(yt.threadId,{label:"Planning",details:[]})),!_||_!==n.value)return;wa(i);const kt=yr(i);if(kt){const lt=(o.value[_]??[]).find(na=>na.id===kt.messageId),wr=`${(lt==null?void 0:lt.text)??""}${kt.delta}`;F(_,{id:kt.messageId,role:"assistant",text:wr,messageType:"agentMessage.live"})}const bn=or(i);bn&&F(_,bn);const mo=ba(i);mo&&F(_,mo),Fa(i);const Ga=wn(i);if(Ga&&wt(_,Ga.delta),jn(i)){const lt=s.value[_]??"";lt.trim().length>0&&!lt.endsWith(`
|
|
53
|
+
|
|
54
|
+
`)&&Ae(_,`${lt}
|
|
55
|
+
|
|
56
|
+
`)}gr(i);const ka=$o(i);ka&&(Wr(_,ka),Ct(_,{label:"Running command",details:[((Ji=ka.commandExecution)==null?void 0:Ji.command)??""]}));const Ya=Ba(i);if(Ya){const lt=(l.value[_]??[]).find(wr=>wr.id===Ya.itemId);lt!=null&<.commandExecution&&Wr(_,{...lt,commandExecution:{...lt.commandExecution,aggregatedOutput:`${lt.commandExecution.aggregatedOutput}${Ya.delta}`}})}const hs=No(i);hs&&Wr(_,hs);const Gi=Hr(i);if(Gi&&te(_,Gi),Ht(i)&&qt(_),i.method==="turn/completed"){pn=!1,qt(_),l.value[_]&&(l.value=St(l.value,_));const lt=At(i);lt&&(Qt(lt,!1),Ct(lt,null),Sn(lt),Ye||(Zr(lt),Xs(lt)))}}function _a(i){if(i.method==="thread/tokenUsage/updated")return;const d=i.method,v=d==="turn/started"||d==="turn/completed"||d==="error",_=d.startsWith("thread/")||d==="turn/completed";if(!v&&!_)return;const M=At(i);M&&v&&vt.add(M),_&&(Ue=!0),!(tt!==null||typeof window>"u")&&(tt=window.setTimeout(()=>{tt=null,po()},Zu))}async function Ta(i,d){if(!zo){zo=!0;try{if(!d)return;const v=[];for(const _ of nu(d)){const M=is(_);v.includes(M)||v.push(M)}if(v.length>0){const _=d.projectOrder.length>0?ws(v,i):ws(K.value,i);Pa(K.value,_)||(K.value=_)}if(Object.keys(d.labels).length>0||(d.remoteProjects??[]).length>0){const _={...ge.value};let M=!1;for(const[N,H]of Object.entries(d.labels)){const Y=ut(N).trim(),ie=[is(N)];Y&&ie.push(Y);for(const we of ie)_[we]!==H&&(_[we]=H,M=!0)}for(const N of d.order){const H=is(N),Y=Qr($s(N));if(!Y.startsWith(".")||Y===H)continue;const ie=`${H} ${Y}`;_[H]!==void 0||_[H]===ie||(_[H]=ie,M=!0)}for(const N of d.remoteProjects??[]){const H=WI(N);_[N.id]!==H&&(_[N.id]=H,M=!0)}M&&(ge.value=_)}}catch{}}}async function zs(){if(!(Object.keys(ve.value).length>0))try{const i=await pT();Object.keys(i.titles).length>0&&(ve.value=i.titles)}catch{}}async function y(){try{return await Ts()}catch{return null}}async function b(i,d,v){if(ve.value[i])return;const _=d.trim();if(!_)return;const M=_.length>300?_.slice(0,300):_;try{const N=await wT(M,v);if(!N||ve.value[i])return;ve.value={...ve.value,[i]:N},ct(),Yu(i,N)}catch{}}function w(i,d){const v=$c(i,d),_=KI(i,d),M=YI(_,d,v);if(!d||d.order.length===0&&(d.remoteProjects??[]).length===0)return M;const N=new Set;for(const Y of Mc(d,v))N.add(Y);const H=M.filter(Y=>N.has(Y.projectName)?!0:Nc(Y));return GI(H,d,v)}function L(i,d){const v=w(i,d),_=!!(d&&(d.order.length>0||d.projectOrder.length>0||(d.remoteProjects??[]).length>0)),M=d!=null&&d.projectOrder.length?ws(Mc(d,$c(i,d)),v):ws(K.value,v);Pa(K.value,M)||(K.value=M,_||ci(K.value));const N=nc(v,K.value);Sr(new Set(br(N).map(Y=>Y.id)));const H=qI(t.value,N,h.value);t.value=yl(t.value,H),h.value=fn(h.value,new Set(br(t.value).map(Y=>Y.id))),ct()}function _e(i){const d={};for(const[v,_]of Object.entries(i)){const M=v.trim();!M||_.length===0||(d[M]=_.map(N=>({id:N.id,text:N.text,imageUrls:[...N.imageUrls],skills:N.skills.map(H=>({name:H.name,path:H.path})),fileAttachments:N.fileAttachments.map(H=>({label:H.label,path:H.path,fsPath:H.fsPath})),collaborationMode:N.collaborationMode})))}return d}function De(){Y_(_e(f.value)).catch(()=>{})}async function Xt(){if(!T){T=!0;try{f.value=await dh()}catch{}}}function Vr(i){cn=jh(cn,i),t.value=jh(t.value,i),h.value=St(h.value,i),ct()}function Zt(i,d){if(i.length===0)return d;if(d.length===0)return i;const v=new Map;for(const M of br(i))v.set(M.id,M);for(const M of br(d))v.set(M.id,M);const _=new Map;for(const M of v.values()){const N=_.get(M.projectName);N?N.push(M):_.set(M.projectName,[M])}return Array.from(_.entries()).map(([M,N])=>({projectName:M,threads:N.sort((H,Y)=>new Date(Y.updatedAtIso).getTime()-new Date(H.updatedAtIso).getTime())})).sort((M,N)=>{var ie,we;const H=new Date(((ie=M.threads[0])==null?void 0:ie.updatedAtIso)??0).getTime();return new Date(((we=N.threads[0])==null?void 0:we.updatedAtIso)??0).getTime()-H})}function dn(){return Object.values(h.value).some(i=>i===!0)}function zr(i=Xr){if(!(!ot||Dt||dn())){if(Xr=i,typeof window>"u"){Lo(i);return}bt!==null&&window.clearTimeout(bt),bt=window.setTimeout(()=>{bt=null,!(!ot||dn())&&Lo(Xr)},iI)}}async function Lo(i){if(!(Dt||!ot||dn())){Dt=!0;try{const d=await nh(ot,s_());ot=d.nextCursor,Tr=d.nextCursor===null,V.value=Tr,cn=Zt(cn,d.groups),L(cn,i)}catch{}finally{Dt=!1,ot&&!dn()&&zr(i)}}}async function Pr(){if(W){await W;return}W=(async()=>{var i;de.value||(A.value=!0);try{const[d,v]=await Promise.all([nh(),y(),zs()]);Xr=v;const _=d.groups;cn=de.value?Zt(cn,_):_,ot=de.value&&!Tr?ot:d.nextCursor,Tr=d.nextCursor===null,V.value=Tr,await Ta(_,v),L(cn,v),de.value=!0,Tr||zr(v);const M=br(e.value);Ln(M),!M.some(H=>H.id===n.value)&&!n.value&&Ft(((i=M[0])==null?void 0:i.id)??"")}finally{A.value=!1}})().finally(()=>{W=null}),await W}async function jo(i,d={}){if(!i)return;const v=se.get(i);if(v){await v;return}const _=oe.value[i]===!0,M=d.silent!==!0&&!_;M&&($.value=!0);const N=(async()=>{try{const H=vr(i),Y=ke.value[i]??"",ie=Date.now()-(ht.get(i)??0)<cI;if(_&&(ie||(H.length===0||Y===H)&&h.value[i]!==!0)){jr(i);return}const _t=He.value[i]!==!0?await Vu(i):null,yt=_t??await rh(i);_t&&(on(i,_t.model),He.value={...He.value,[i]:!0});const{messages:kt,inProgress:bn,activeTurnId:mo,turnIndexByTurnId:Ga}=yt;Re.value={...Re.value,[i]:yt.hasMoreOlder===!0},yn(i,kt),Yn(i,Ga),uo(i);const Ka=r.value[i]??[],ka=Lh(Ka,kt,{preserveMissing:d.silent===!0});xn(i,ka);const Ya=o.value[i]??[];if(bn){const hs=RI(Ya,kt);vn(i,hs)}else An(i);ea(i,kt),fo(i,kt),oe.value={...oe.value,[i]:!0},ht.set(i,Date.now()),H&&(ke.value={...ke.value,[i]:H}),Qt(i,bn),mo?Ge.value={...Ge.value,[i]:mo}:Ge.value[i]&&(Ge.value=St(Ge.value,i)),bn||Jt(i),jr(i)}finally{M&&($.value=!1)}})().finally(()=>{se.delete(i)});se.set(i,N),await N}async function Gs(i=n.value){if(!i||ze.value[i]===!0||Re.value[i]!==!0)return;const d=Un(i);if(!d){Re.value={...Re.value,[i]:!1};return}ze.value={...ze.value,[i]:!0};try{const v=await l_(i,d),_=r.value[i]??[],M=Lh(v.messages,_,{preserveMissing:!0});xn(i,M),Yn(i,{...Ne.value[i]??{},...v.turnIndexByTurnId}),uo(i),Re.value={...Re.value,[i]:v.hasMoreOlder}}catch(v){throw ue.value=v instanceof Error?v.message:"Failed to load earlier messages",v}finally{ze.value={...ze.value,[i]:!1}}}async function qa(i,d={}){i&&oe.value[i]!==!0&&await jo(i,d)}async function Ks(){if(me){await me;return}me=(async()=>{var i,d;try{const v=((d=(i=kr.value)==null?void 0:i.cwd)==null?void 0:d.trim())??"";Oe.value=await _T(v?[v]:void 0)}catch{}finally{me=null}})(),await me}async function Ys(i={}){await Promise.allSettled([hr({providerChanged:i.providerChanged,includeProviderModels:i.includeProviderModels}),nr(),$n(),Ks()])}function ru(i={}){const d=()=>{Ys(i)};if(typeof window>"u"){d();return}window.setTimeout(d,0)}async function Di(i={}){ue.value="";const d=i.includeSelectedThreadMessages!==!1,v=i.awaitAncillaryRefreshes===!0;try{await Xt(),await Pr(),d&&await jo(n.value),v?await Ys({providerChanged:i.providerChanged,includeProviderModels:i.providerChanged===!0||v}):ru({providerChanged:i.providerChanged,includeProviderModels:!1})}catch(_){ue.value=_ instanceof Error?_.message:"Unknown application error"}}async function ou(i){Ft(i);try{await jo(i),Ks()}catch(d){ue.value=d instanceof Error?d.message:"Unknown application error"}}async function au(i){const d=n.value===i,v=d?aI(br(e.value),i):"";d&&(Ft(v),v&&jo(v,{silent:!0}));try{await R_(i),Vr(i),await Pr(),d&&v&&n.value===v&&await qa(v,{silent:!0})}catch(_){ue.value=_ instanceof Error?_.message:"Unknown application error"}}async function Fi(i,d){const v=d.trim();if(!(!i||!v))try{await M_(i,v),ve.value={...ve.value,[i]:v},ct(),Yu(i,v)}catch(_){ue.value=_ instanceof Error?_.message:"Unknown application error"}}async function Qs(i){var H,Y;const d=i.trim();if(!d)return"";const v=br(t.value).find(ie=>ie.id===d),_=((H=v==null?void 0:v.cwd)==null?void 0:H.trim())??"",M=((Y=v==null?void 0:v.title)==null?void 0:Y.trim())??"Forked chat",N=Lt(d);ue.value="";try{const ie=await ih(d,_||void 0,N||void 0),we=ie.threadId.trim();return we?(Nn(we,_,M),on(we,ie.model),He.value={...He.value,[we]:!0},Ft(we),await Pr(),await jo(we),we):""}catch(ie){return ue.value=ie instanceof Error?ie.message:"Unknown application error",""}}async function Js(i,d){var H;const v=i.trim();if(!v||!Number.isInteger(d)||d<0)return"";if(h.value[v]===!0)return ue.value="Finish the current turn before forking from a response.","";if(oe.value[v]!==!0)try{await jo(v)}catch(Y){return ue.value=Y instanceof Error?Y.message:"Unknown application error",""}const _=r.value[v]??[];let M=-1;for(const Y of _)typeof Y.turnIndex=="number"&&Number.isFinite(Y.turnIndex)&&(M=Math.max(M,Y.turnIndex));if(M>=0&&d>M)return"";const N=br(t.value).find(Y=>Y.id===v)??null;try{ue.value="";const Y=await ih(v),ie=Y.threadId.trim();if(!ie)return"";const we=Y.cwd.trim()||((H=N==null?void 0:N.cwd)==null?void 0:H.trim())||"",Ye=JI((N==null?void 0:N.title)||(N==null?void 0:N.preview)||"Untitled thread");Nn(ie,we,Ye),on(ie,Y.model),xn(ie,Y.messages),oe.value={...oe.value,[ie]:!0},He.value={...He.value,[ie]:!0},En(ie),vn(ie,[]),qt(ie),l.value[ie]&&(l.value=St(l.value,ie)),Nt(ie,null),Ct(ie,null),Tt(ie,null),Qt(ie,!1);const _t=M-d;if(_t>0){const yt=await zu(ie,_t);xn(ie,yt)}return await Fi(ie,Ye),Ft(ie),Pr().catch(()=>{}),ie}catch(Y){return ue.value=Y instanceof Error?Y.message:"Unknown application error",""}}async function su(i,d,v=[],_=[],M=[]){if(!i||!d.trim()||v.length>0||_.length>0||M.length>0)return!1;const H=(qe.value[i]??[]).filter(we=>we.method==="item/tool/requestUserInput");if(H.length!==1)return!1;const[Y]=H,ie=Mo(Y);return ie.length!==1?!1:ta({id:Y.id,result:{answers:{[ie[0]]:{answers:[d.trim()]}}}})}async function Ha(i,d=[],v=[],_="steer",M=[],N,H){if(ae.value)return;const Y=n.value,ie=i.trim();if(!Y||!ie&&d.length===0&&M.length===0||await su(Y,ie,d,v,M))return;const we=h.value[Y]===!0;if(we&&_==="queue"){const Ye=f.value[Y]??[],_t=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,yt=[...Ye],kt=typeof N=="number"?Math.max(0,Math.min(N,yt.length)):yt.length;yt.splice(kt,0,{id:_t,text:ie,imageUrls:d,skills:v,fileAttachments:M,collaborationMode:H==="plan"?"plan":H==="default"?"default":O.value}),f.value={...f.value,[Y]:yt},De();return}if(we){pn=!0,Wa(Y,ie,d,v,M,H).catch(Ye=>{const _t=Ye instanceof Error?Ye.message:"Unknown application error";Tt(Y,_t),ue.value=_t});return}ue.value="",pn=!0,Nt(Y,null),Ct(Y,{label:"Thinking",details:tr(Lt(Y),ee.value,H==="plan"?"plan":H==="default"?"default":O.value)}),Tt(Y,null),Qt(Y,!0);try{await Wa(Y,ie,d,v,M,H)}catch(Ye){pn=!1,Qt(Y,!1),Ct(Y,null);const _t=Ye instanceof Error?Ye.message:"Unknown application error";throw Tt(Y,_t),ue.value=_t,Ye}}async function Ui(i,d,v=[],_=[],M=[]){if(ae.value)return"";const N=i.trim(),H=d.trim(),Y=Lt($a).trim(),ie=O.value;if(!N&&v.length===0&&M.length===0)return"";ne.value=!0,ue.value="";let we="";try{try{const kt=await sh(H||void 0,Y||void 0);we=kt.threadId,on(we,kt.model),Yt(we,ie)}catch(kt){if(Y&&Y!==go&&vl(kt)){await fr();const bn=await sh(H||void 0,go);we=bn.threadId,on(we,bn.model),Yt(we,ie)}else throw kt}if(!we)return"";Nn(we,H,N||"[Image]"),mr(we),He.value={...He.value,[we]:!0},Ft(we),pn=!0,Nt(we,null),Ct(we,{label:"Thinking",details:tr(Lt(we),ee.value,ie)}),Tt(we,null),Qt(we,!0);const Ye=we,_t=H||null,yt=N;return Wa(we,N,v,_,M,ie).catch(kt=>{pn=!1,Qt(we,!1),Ct(we,null);const bn=kt instanceof Error?kt.message:"Unknown application error";Tt(we,bn),ue.value=bn}).finally(()=>{ne.value=!1}),b(Ye,yt,_t),we}catch(Ye){pn=!1,we&&(Qt(we,!1),Ct(we,null));const _t=Ye instanceof Error?Ye.message:"Unknown application error";throw we&&Tt(we,_t),ue.value=_t,ne.value=!1,Ye}}async function Wa(i,d,v=[],_=[],M=[],N){const H=ee.value,Y=N==="plan"?"plan":N==="default"?"default":O.value,ie=d.trim(),we=[...v];if(we.length===0&&xe(ie)){const yt=$e(i);yt&&we.push(yt)}const Ye=_.map(yt=>({name:yt.name,path:yt.path})),_t=M.map(yt=>({...yt}));Ko(i,{text:ie,imageUrls:[...we],skills:Ye,fileAttachments:_t,effort:H,collaborationMode:Y,fallbackRetried:!1});try{if(He.value[i]!==!0){const bn=await Vu(i);on(i,bn.model)}const yt=Lt(i);let kt="";try{kt=await Gu(i,d,we,yt||void 0,H||void 0,_.length>0?_:void 0,M,Y)}catch(bn){if(yt&&yt!==go&&vl(bn))await fr(i),Ko(i,{text:ie,imageUrls:[...we],skills:Ye,fileAttachments:_t,effort:H,collaborationMode:Y,fallbackRetried:!0}),kt=await Gu(i,d,we,go,H||void 0,_.length>0?_:void 0,M,Y);else throw bn}kt&&(Ge.value={...Ge.value,[i]:kt},Bt(i,kt)),He.value={...He.value,[i]:!0},vt.add(i),await po(),Cr(i)}catch(yt){throw yt}}async function ho(i){if(g.value[i]!==!0){g.value={...g.value,[i]:!0};try{f.value=await dh()}catch{}finally{g.value=St(g.value,i)}}}function Xs(i){ho(i),!(typeof window>"u")&&window.setTimeout(()=>{ho(i)},650)}async function Zs(){const i=n.value;if(!i||h.value[i]!==!0||Je.value[i]===!0)return;let d=Ge.value[i];if(!d){const{activeTurnId:v}=await rh(i);d=v,d&&(Ge.value={...Ge.value,[i]:d})}if(!d)throw new Error("Could not determine active turn id for interrupt");le.value=!0,ue.value="";try{await D_(i,d),Qt(i,!1),Ct(i,null),Tt(i,null),Ge.value[i]&&(Ge.value=St(Ge.value,i)),vt.add(i),Ue=!0,await po()}catch(v){const _=v instanceof Error?v.message:"Failed to interrupt active turn";Tt(i,_),ue.value=_}finally{le.value=!1}}async function Bi(i){var Y,ie;const d=n.value;if(!d||he.value||!i.trim())return;const v=r.value[d]??[],_=v.find(we=>we.turnId===i),M=typeof(_==null?void 0:_.turnIndex)=="number"?_.turnIndex:-1;if(M<0)return;const N=v.reduce((we,Ye)=>typeof Ye.turnIndex=="number"&&Ye.turnIndex>we?Ye.turnIndex:we,-1);if(N<0||M>N)return;const H=N-M+1;if(!(H<1)){he.value=!0,ue.value="";try{const we=((ie=(Y=kr.value)==null?void 0:Y.cwd)==null?void 0:ie.trim())??"";we&&await $_(d,i,we);const Ye=await zu(d,H);xn(d,Ye),vn(d,[]),qt(d),l.value[d]&&(l.value=St(l.value,d)),Nt(d,null),Ct(d,null),Tt(d,null),Ue=!0,await po()}catch(we){ue.value=we instanceof Error?we.message:"Failed to rollback thread"}finally{he.value=!1}}}let Va=null;async function qi(i,d){try{const v=await Ts(),_={...v.labels};let M=!1;for(const N of v.order){if(!xl(N,i))continue;const H=d.trim();H.length===0?_[N]!==void 0&&(delete _[N],M=!0):_[N]!==H&&(_[N]=H,M=!0)}M&&await Ku({order:v.order,labels:_,active:v.active,projectOrder:v.projectOrder})}catch{}}function iu(i,d){i.length===0||(ge.value[i]??"")===d||(ge.value={...ge.value,[i]:d},Nh(ge.value),Va!==null&&clearTimeout(Va),Va=setTimeout(()=>{Va=null,qi(i,d)},500))}async function Hi(i){var N;if(i.length===0)return;const d=K.value.filter(H=>H!==i);if(Pa(K.value,d)||(K.value=d,ci(K.value)),t.value=t.value.filter(H=>H.projectName!==i),ge.value[i]!==void 0){const H={...ge.value};delete H[i],ge.value=H,Nh(H)}ct();const v=br(e.value);Ln(v),v.some(H=>H.id===n.value)||Ft(((N=v[0])==null?void 0:N.id)??"");const M=new Set;try{const H=await Ts();VI(H,i).forEach(Y=>{M.add(Y)})}catch{}if(M.size>0)try{const H=await Ts(),Y=H.order.filter(Ye=>!M.has(Ye)),ie=H.active.filter(Ye=>!M.has(Ye)),we=ie.length===0&&Y.length>0?[Y[0]]:ie;await Ku({order:Y,labels:DI(H.labels,M),active:we,projectOrder:H.projectOrder.filter(Ye=>Ye!==i&&!M.has(Ye))});return}catch{}await ei()}function Wi(i,d){if(i.length===0||t.value.length===0)return;const v=t.value.map(ie=>ie.projectName),_=v.indexOf(i);if(_===-1)return;const M=Math.max(0,Math.min(d,v.length-1)),N=xI(v,_,M);if(N===v)return;const H=ws(N,t.value);K.value=H,ci(K.value);const Y=nc(t.value,K.value);t.value=yl(t.value,Y),ct(),ei()}function za(i){const d=i.trim();if(!d)return;const v=[d,...K.value.filter(M=>M!==d)];if(Pa(K.value,v))return;K.value=v,ci(K.value);const _=nc(t.value,K.value);t.value=yl(t.value,_),ct(),ei()}async function ei(){try{const i=await Ts(),d=zI(i,K.value,t.value);await Ku({order:d.order,labels:i.labels,active:d.active,projectOrder:d.projectOrder})}catch{}}async function po(){if(ye.value){typeof window<"u"&&tt===null&&(tt=window.setTimeout(()=>{tt=null,po()},Zu));return}ye.value=!0;const i=Ue,d=new Set(vt);Ue=!1,vt.clear();try{i&&await Pr();const v=n.value;if(!v)return;const _=d.has(v),M=h.value[v]===!0,N=vr(v),H=ke.value[v]??"";(N.length>0&&N!==H||M&&oe.value[v]!==!0||_&&oe.value[v]!==!0||i&&oe.value[v]!==!0)&&await jo(v,{silent:!0})}catch{}finally{ye.value=!1,(Ue||vt.size>0)&&typeof window<"u"&&tt===null&&(tt=window.setTimeout(()=>{tt=null,po()},Zu))}}async function lu(){await fs(),Ue=!de.value,n.value&&oe.value[n.value]!==!0&&vt.add(n.value),await po()}function Vi(){typeof window>"u"||je||(fs(),je=y_(i=>{if(i.method==="ready"){Or(),lu();return}ar(i),_a(i)}))}async function fs(){try{const d=(await k_()).map(v=>ro(v)).filter(v=>v!==null);Br(d)}catch{}}async function ta(i){try{return await T_(i.id,{result:i.result,error:i.error}),Er(i.id),!0}catch(d){return ue.value=d instanceof Error?d.message:"Failed to reply to server request",!1}}function uu(){if(je&&(je(),je=null),Ue=!1,vt.clear(),gn.clear(),tt!==null&&typeof window<"u"&&(window.clearTimeout(tt),tt=null),D!==null&&typeof window<"u"&&(window.clearTimeout(D),D=null),bt!==null&&typeof window<"u"&&(window.clearTimeout(bt),bt=null),typeof window<"u")for(const i of q.values())window.clearTimeout(i);q.clear(),pn=!1,r.value={},a.value={},o.value={},s.value={},l.value={},c.value={},Ne.value={},Le.value={},Fe.value={},et.value={},Ge.value={},Je.value={},Ke.value={},it.value={},f.value={},g.value={},De(),nt.value=null,Q.value={}}const cu=Z(()=>{const i=n.value;return i?f.value[i]??[]:[]});function zi(i){const d=n.value;if(!d)return;const v=f.value[d];if(!v)return;const _=v.filter(M=>M.id!==i);f.value=_.length>0?{...f.value,[d]:_}:St(f.value,d),De()}function du(i,d){const v=n.value;if(!v)return;const _=f.value[v];if(!_)return;const M=_.findIndex(ie=>ie.id===i),N=_.findIndex(ie=>ie.id===d);if(M<0||N<0||M===N)return;const H=[..._],[Y]=H.splice(M,1);H.splice(N,0,Y),f.value={...f.value,[v]:H},De()}function fu(i){const d=n.value;if(!d)return;const v=f.value[d];if(!v)return;const _=v.find(M=>M.id===i);_&&(zi(i),$t(_.collaborationMode),Ha(_.text,_.imageUrls,_.skills,"steer",_.fileAttachments))}function hu(i){Ft(i)}return{projectGroups:e,projectDisplayNameById:ge,selectedThread:kr,selectedThreadTokenUsage:Po,selectedThreadTerminalOpen:rn,isSelectedThreadInterruptPending:Ao,selectedThreadServerRequests:mn,selectedLiveOverlay:Eo,codexQuota:Io,selectedThreadId:n,availableCollaborationModes:B,availableModelIds:j,selectedCollaborationMode:O,selectedModelId:G,selectedReasoningEffort:ee,selectedSpeedMode:be,installedSkills:Oe,accountRateLimitSnapshots:We,messages:Go,hasMoreOlderMessages:Nr,isLoadingThreads:A,isThreadListFullyLoaded:V,isLoadingMessages:$,isLoadingOlderMessages:gt,isSendingMessage:ne,isInterruptingTurn:le,isUpdatingSpeedMode:ae,isRollingBack:he,error:ue,refreshAll:Di,refreshSkills:Ks,selectThread:ou,loadMessages:jo,loadOlderMessages:Gs,ensureThreadMessagesLoaded:qa,setThreadTerminalOpen:zn,toggleSelectedThreadTerminal:Yo,archiveThreadById:au,renameThreadById:Fi,forkThreadById:Qs,forkThreadFromTurn:Js,rollbackSelectedThread:Bi,sendMessageToSelectedThread:Ha,sendMessageToNewThread:Ui,interruptSelectedThreadTurn:Zs,selectedThreadQueuedMessages:cu,removeQueuedMessage:zi,reorderQueuedMessage:du,steerQueuedMessage:fu,setSelectedCollaborationMode:$t,readModelIdForThread:Lt,setSelectedModelIdForThread:Bn,setSelectedModelId:Rn,setSelectedReasoningEffort:Lr,updateSelectedSpeedMode:Mn,respondToPendingServerRequest:ta,renameProject:iu,removeProject:Hi,reorderProject:Wi,pinProjectToTop:za,startPolling:Vi,stopPolling:uu,primeSelectedThread:hu}}const ZI={class:"sidebar-root"},eP={class:"sidebar-scrollable"},tP=["aria-pressed","aria-label","title"],nP={key:1,class:"sidebar-search-bar"},rP=["placeholder"],oP=["aria-label"],aP={class:"sidebar-skills-link-icon","aria-hidden":"true"},sP={class:"sidebar-skills-link-copy"},iP={class:"sidebar-skills-link-title"},lP={class:"sidebar-skills-link-subtitle"},uP={class:"sidebar-settings-account-section"},cP={class:"sidebar-settings-account-header"},dP={class:"sidebar-settings-account-header-main"},fP=["aria-expanded","title"],hP={class:"sidebar-settings-account-collapse-icon"},pP={class:"sidebar-settings-account-title"},mP={class:"sidebar-settings-account-count"},vP=["disabled"],gP={key:0,class:"sidebar-settings-account-error"},yP={class:"sidebar-settings-account-login"},wP=["disabled"],bP=["href"],_P={key:1,class:"sidebar-settings-account-empty"},TP={key:2,class:"sidebar-settings-account-list"},kP=["title","onMouseenter","onMouseleave"],CP={class:"sidebar-settings-account-main"},SP={class:"sidebar-settings-account-email"},xP={class:"sidebar-settings-account-meta"},AP={class:"sidebar-settings-account-quota"},EP={class:"sidebar-settings-account-id"},IP={class:"sidebar-settings-account-actions"},PP=["disabled","onClick"],RP=["disabled","onClick"],MP=["title"],$P={class:"sidebar-settings-label"},NP=["title"],LP={class:"sidebar-settings-label"},jP={class:"sidebar-settings-value"},OP=["title"],DP={class:"sidebar-settings-label"},FP={class:"sidebar-settings-value"},UP=["title"],BP={class:"sidebar-settings-label"},qP=["value"],HP=["value"],WP=["title"],VP={class:"sidebar-settings-label"},zP={class:"sidebar-settings-value"},GP=["title"],KP={class:"sidebar-settings-label"},YP=["title"],QP={class:"sidebar-settings-label"},JP=["title"],XP={class:"sidebar-settings-label"},ZP=["value","disabled"],eR={key:0,class:"sidebar-settings-row sidebar-settings-error"},tR={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},nR={class:"sidebar-settings-provider-info"},rR={class:"sidebar-settings-label"},oR={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},aR={class:"sidebar-settings-key-group"},sR={class:"sidebar-settings-key-masked"},iR=["disabled","title"],lR=["placeholder"],uR=["disabled"],cR={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},dR={class:"sidebar-settings-label"},fR=["aria-label"],hR=["disabled"],pR=["disabled"],mR={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},vR={class:"sidebar-settings-provider-info"},gR={class:"sidebar-settings-label"},yR={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},wR={class:"sidebar-settings-key-group"},bR=["placeholder"],_R=["disabled"],TR={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},kR={class:"sidebar-settings-label"},CR={class:"sidebar-settings-key-group"},SR=["placeholder"],xR={class:"sidebar-settings-label",style:{"margin-top":"4px"}},AR={class:"sidebar-settings-key-group"},ER=["placeholder"],IR=["disabled"],PR={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},RR={class:"sidebar-settings-label"},MR=["aria-label"],$R=["title"],NR={class:"sidebar-settings-label"},LR={class:"sidebar-settings-label"},jR={class:"sidebar-settings-value"},OR={key:4,class:"sidebar-settings-telegram-panel"},DR={class:"sidebar-settings-field"},FR={class:"sidebar-settings-field-label"},UR={class:"sidebar-settings-field"},BR={class:"sidebar-settings-field-label"},qR={class:"sidebar-settings-field-help"},HR={key:0,class:"sidebar-settings-telegram-error"},WR={class:"sidebar-settings-telegram-actions"},VR=["disabled"],zR=["data-state","title"],GR={class:"sidebar-settings-label"},KR=["data-state"],YR={class:"sidebar-settings-context-meta"},QR={class:"sidebar-settings-rate-limits"},JR=["aria-label"],XR={class:"sidebar-settings-button-version"},ZR={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},eM={key:1,class:"skills-route-header-icon","aria-hidden":"true"},tM={class:"content-body"},nM={key:1,class:"content-grid content-grid-home"},rM={class:"new-thread-empty"},oM={class:"new-thread-hero"},aM=["title"],sM={class:"new-thread-folder-actions"},iM={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},lM={class:"new-thread-launch-card-copy"},uM={class:"new-thread-launch-card-topline"},cM={class:"new-thread-launch-card-badge","aria-hidden":"true"},dM={class:"new-thread-launch-card-eyebrow"},fM={class:"new-thread-launch-card-title"},hM={class:"new-thread-launch-card-text"},pM={class:"new-thread-launch-card-actions"},mM=["aria-label","onKeydown"],vM={class:"new-thread-open-folder-header"},gM={class:"new-thread-open-folder-title"},yM={class:"new-thread-open-folder-label"},wM={class:"new-thread-open-folder-current"},bM=["placeholder","title","disabled","onKeydown"],_M=["disabled"],TM={class:"new-thread-open-folder-actions"},kM={class:"new-thread-open-folder-toggle"},CM=["aria-pressed","disabled"],SM={key:0,class:"new-thread-open-folder-create"},xM={class:"new-thread-open-folder-create-composer"},AM=["placeholder","onKeydown"],EM=["disabled"],IM={key:0,class:"new-thread-open-folder-error"},PM=["placeholder","onKeydown"],RM={key:1,class:"new-thread-open-folder-error-actions"},MM={class:"new-thread-open-folder-error"},$M=["disabled"],NM={key:2,class:"new-thread-open-folder-status"},LM={key:3,class:"new-thread-open-folder-status"},jM={key:4,class:"new-thread-open-folder-list"},OM=["title","disabled","onClick"],DM={class:"new-thread-open-folder-item-name"},FM=["disabled","onClick"],UM=["aria-label","onKeydown"],BM={class:"new-thread-open-folder-header"},qM={class:"new-thread-open-folder-title"},HM=["disabled"],WM=["aria-label"],VM=["aria-selected","disabled"],zM=["aria-selected","disabled"],GM={class:"new-thread-project-field"},KM={class:"new-thread-open-folder-label"},YM=["disabled","placeholder"],QM={key:0,class:"new-thread-project-field"},JM={class:"new-thread-open-folder-label"},XM=["disabled","placeholder","onKeydown"],ZM={key:1,class:"new-thread-project-field"},e$={class:"new-thread-open-folder-label"},t$=["disabled","onKeydown"],n$={key:2,class:"new-thread-open-folder-error"},r$={class:"new-thread-project-modal-actions"},o$=["disabled"],a$=["disabled"],s$={key:3,class:"new-thread-branch-select"},i$={class:"new-thread-branch-select-label"},l$={class:"new-thread-branch-select-help"},u$={key:4,class:"new-thread-runtime-help"},c$={class:"worktree-init-status-title"},d$={class:"worktree-init-status-message"},f$={class:"composer-with-queue"},h$={key:2,class:"content-grid"},p$={class:"content-thread"},m$={class:"composer-with-queue"},v$=["aria-label"],g$={class:"codex-login-modal-header"},y$={class:"codex-login-modal-title"},w$=["aria-label","disabled"],b$={class:"codex-login-modal-copy"},_$=["href"],T$=["placeholder","disabled"],k$={key:1,class:"codex-login-modal-error"},C$={class:"codex-login-modal-actions"},S$=["disabled"],x$=["disabled"],Oh="codex-web-local.sidebar-collapsed.v1",Dh="codex-web-local.accounts-section-collapsed.v1",Fh="codex-web-local.terminal-quick-commands.v1",Uh="__toggle_terminal__",Bh="codex-web-local.send-with-enter.v1",qh="codex-web-local.in-progress-send-mode.v1",Hh="codex-web-local.dark-mode.v1",Wh="codex-web-local.dictation-click-to-toggle.v1",Vh="codex-web-local.dictation-auto-send.v1",zh="codex-web-local.dictation-language.v1",Gh="codex-web-local.chat-width.v1",A$=400,E$=Fn({__name:"App",setup(e){var jd,Od;const t=ll(()=>cl(()=>import("./ThreadConversation-DjMDsjfX.js"),__vite__mapDeps([0,1]))),n=ll(()=>cl(()=>import("./ThreadTerminalPanel-DWgrDp2e.js"),__vite__mapDeps([2,3]))),r=ll(()=>cl(()=>import("./ReviewPane-Ckuqkl-S.js"),__vite__mapDeps([4,5]))),a=ll(()=>cl(()=>import("./DirectoryHub-DvExS-9c.js"),__vite__mapDeps([6,7]))),{t:o,uiLanguage:s,uiLanguageOptions:l,setUiLanguage:c}=Oa(),h="codex-web-local",f="0.1.87",g={sendWithEnter:o("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:o("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:o("Switch between system theme, light mode, and dark mode."),chatWidth:o("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:o("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:o("Automatically send transcribed dictation when recording stops."),dictationLanguage:o("Choose transcription language or keep auto-detect.")},T={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},I={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:j,projectDisplayNameById:B,selectedThread:X,selectedThreadTokenUsage:U,selectedThreadTerminalOpen:O,selectedThreadServerRequests:G,selectedLiveOverlay:ee,codexQuota:be,selectedThreadId:pe,availableCollaborationModes:Te,availableModelIds:Pe,selectedCollaborationMode:K,selectedReasoningEffort:ge,selectedSpeedMode:ke,installedSkills:oe,accountRateLimitSnapshots:Re,messages:ze,hasMoreOlderMessages:He,isLoadingThreads:Ne,isThreadListFullyLoaded:Fe,isLoadingMessages:Le,isLoadingOlderMessages:et,isSendingMessage:Ge,isInterruptingTurn:Je,isSelectedThreadInterruptPending:Ke,isUpdatingSpeedMode:it,refreshAll:qe,refreshSkills:Xe,selectThread:nt,ensureThreadMessagesLoaded:Q,loadOlderMessages:Ee,setThreadTerminalOpen:ve,toggleSelectedThreadTerminal:Oe,archiveThreadById:We,forkThreadById:A,renameThreadById:$,forkThreadFromTurn:V,sendMessageToSelectedThread:ne,sendMessageToNewThread:le,interruptSelectedThreadTurn:ae,selectedThreadQueuedMessages:he,removeQueuedMessage:ue,reorderQueuedMessage:ye,steerQueuedMessage:de,setSelectedCollaborationMode:Me,readModelIdForThread:xe,setSelectedModelIdForThread:$e,setSelectedReasoningEffort:je,updateSelectedSpeedMode:tt,respondToPendingServerRequest:D,renameProject:q,removeProject:W,reorderProject:se,pinProjectToTop:me,startPolling:Ce,stopPolling:Ue,primeSelectedThread:vt,rollbackSelectedThread:ht}=XI(),ot=h0(),bt=f0(),{isMobile:Dt}=rd(),Tr=x(null),cn=x(null),Xr=x(null),zo=x(null),pn=x(null),gn=x(!1),$r=x(!1),dr=x(!1),kr=x(!0),rn=x([]),Ao=x(bv()),mn=x(""),Eo=x(null),Io=x(!1),Po=x("");let Go=!1;const Nr=x(!1),gt=x(""),Un=x("local"),Lt=x({}),er=new Map,Ft=x(""),Bn=x([]),Rn=x(!1),on=x({order:[],labels:{},projectOrder:[]}),Ut=x({phase:"idle",title:"",message:""}),$t=x(pg()),Yt=x(""),qn=x(!1),fr=x(null),Ko=x(null),Zr=x(null),eo=x(null),Lr=x(null);let Mn=null,$n=null,tr=0,hr=0;const nr=x("New Project (1)"),to=x(""),Hn=x(!1),Cr=x(vg()),pr=x(!1),Ro=x([]),Wn=x(null),an=x(null),ct=x(null),Nn=x(null),Ln=x(!1),jr=x(!1),Nt=x(""),Qt=x({}),Vn=x(""),mr=x(""),no=x(!1),Bt=x(!1),Sr=x(null),yn=x([]),Sn=x(!1),Ct=x(!1),Tt=x(!1),sn=x(!1),Or=x(!1),vr=x(""),zn=x(""),Yo=x(null),xn=x(""),vn=x(""),An=x(""),Vt=x(""),xr=x(Tu(Bh,!0)),P=x(tg()),F=x(eg()),te=x(ng()),Ae=x(Tu(Wh,!1)),wt=x(Tu(Vh,!0)),qt=x(fg()),En=Z(()=>hg()),zt=x(!1),Jt=x(!1),Gn=x(!1),rr=x(""),us=x(!1),cs=x(null),Ie=x(!1),Se=x(""),ln=x("codex"),Dr=x(""),Qo=x(""),Ar=x("responses"),At=x("responses"),Jo=x(""),Da=x(!1),ro=x(""),oo=x(""),Fr=x(""),ao=x(!1),Ur=x(!1),so=x(""),Kn=x(""),io=x(!1),Mo=x(!1),In=x("create"),Er=x(""),Br=x(""),Xo=x(""),qr=x(""),Pn=x(!1),ya=x(null),Ir=x(!1),Zo=x(null),ds=x(null),lo=x(""),Yn=x(""),uo=x(""),Fa=x([]),wn=x(""),jn=x(!1),gr=x(!1),wa=x(!1),yr=x(""),or=x({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),co=x(null),Ua=x(!1),ba=x(!1),$o=x(typeof window<"u"?((jd=window.visualViewport)==null?void 0:jd.height)??window.innerHeight:0),Ba=x(typeof window<"u"?((Od=window.visualViewport)==null?void 0:Od.offsetTop)??0:0),No=x(typeof window<"u"?window.innerHeight:0);let Hr=null,Wr=!1,ea=0;const fo=Z(()=>{const u=ot.params.threadId;return typeof u=="string"?u:""}),Ht=Z(()=>ot.name==="home"),ar=Z(()=>ot.name==="skills"),_a=Z(()=>{var u;return ar.value?o("Skills"):Ht.value?o("Start new thread"):((u=X.value)==null?void 0:u.title)??o("Choose a thread")}),Ta=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",zs=Z(()=>{var p,C;return(((C=(p=X.value)==null?void 0:p.title)==null?void 0:C.trim())??"")||Ta}),y=Z(()=>ze.value.filter(u=>{const p=yg(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),b=Z(()=>ee.value),w=Z(()=>Ht.value?"__new-thread__":pe.value),L=Z(()=>xe(w.value)),_e=Z(()=>{const u=G.value;return u.length>0?u[u.length-1]:null}),De=Z(()=>{var u,p;return Ht.value?gt.value.trim():((p=(u=X.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),Xt=Z(()=>kr.value&&(Ht.value&&De.value.length>0||ot.name==="thread"&&pe.value.length>0)),Vr=Z(()=>ot.name==="thread"&&pe.value.length>0||Ht.value&&ho.value),Zt=Z(()=>Ht.value?gn.value:O.value),dn=Z(()=>!Dt.value||$o.value<=0||No.value<=0?!1:No.value-$o.value>120),zr=Z(()=>dn.value||Zt.value&&dr.value),Lo=Z(()=>{var u,p;return((p=(u=X.value)==null?void 0:u.cwd)==null?void 0:p.trim())??gt.value.trim()}),Pr=Z(()=>{var u;return!Ht.value&&((u=X.value)==null?void 0:u.inProgress)===!0}),jo=Z(()=>!Ht.value&&!ar.value&&pe.value.trim().length>0),Gs=Z(()=>Ge.value||Je.value||Pr.value||G.value.length>0);function qa(u){return Number.isFinite(u)?new Intl.NumberFormat("en-US",{notation:u>=1e3?"compact":"standard",maximumFractionDigits:u>=1e5?0:1}).format(Math.max(0,Math.trunc(u))):"0"}function Ks(u){if(!u)return o("Waiting for Codex thread/tokenUsage/updated events for this thread.");const p=[`${o("Current context usage")}: ${u.currentContextTokens.toLocaleString()} ${o("tokens")}`,`${o("Cumulative thread usage")}: ${u.total.totalTokens.toLocaleString()} ${o("tokens")}`];return typeof u.modelContextWindow=="number"?(p.unshift(`${o("Model context window")}: ${u.modelContextWindow.toLocaleString()} ${o("tokens")}`),p.push(`${o("Remaining context")}: ${(u.remainingContextTokens??0).toLocaleString()} ${o("tokens")}`)):p.push(o("Model context window is unavailable in the latest usage event.")),p.join(`
|
|
57
|
+
`)}function Ys(){zt.value&&(zt.value=!1,yT(!0))}function ru(){Ys(),bt.push({name:"skills",query:{tab:"plugins"}})}const Di=Z(()=>{var p;const u=(p=U.value)==null?void 0:p.remainingContextPercent;return u===null||typeof u!="number"?"pending":u<=10?"danger":u<=25?"warning":"ok"}),ou=Z(()=>{const u=U.value;return u?typeof u.remainingContextTokens=="number"?`${qa(u.remainingContextTokens)} ${o("left")}`:`${qa(u.currentContextTokens)} ${o("used")}`:o("Awaiting data")}),au=Z(()=>{const u=U.value;return u?typeof u.modelContextWindow=="number"?`${qa(u.currentContextTokens)} ${o("used")} / ${qa(u.modelContextWindow)}`:o("Window size unavailable"):o("Updates after the next token usage event")}),Fi=Z(()=>Ks(U.value));function Qs(u,p){const C=ut(u).trim(),z=Mr(C);return!C||!z?!1:p.some(re=>{const ce=ut(re).trim();return ce!==C&&Mr(ce)===z})}function Js(u,p=""){const C=ut(u).trim(),z=p.trim();if(z)return z;const re=Mr(C),ce=[...on.value.order,...j.value.map(Ve=>{var en,Rr;return((Rr=(en=Ve.threads[0])==null?void 0:en.cwd)==null?void 0:Rr.trim())??""}).filter(Boolean)];return Qs(C,ce)?C:re}function su(){const u=new Set(on.value.order),p=on.value.projectOrder.filter(C=>u.has(C));for(const C of on.value.order)p.includes(C)||p.push(C);return p}function Ha(u){const p=ut(u).trim(),C=[...on.value.order,...j.value.map(z=>{var re,ce;return((ce=(re=z.threads[0])==null?void 0:re.cwd)==null?void 0:ce.trim())??""}).filter(Boolean)];return Qs(p,C)?p:Mr(p)}function Ui(u){const p=ut(u).trim();if(!p)return"";const C=[...on.value.order,...j.value.map(z=>{var re,ce;return((ce=(re=z.threads[0])==null?void 0:re.cwd)==null?void 0:ce.trim())??""}).filter(Boolean)];for(const z of on.value.order){const re=ut(z).trim();if(!re)continue;const ce=Mr(re),Ve=Qs(re,C)?re:ce;if(re===p||Ve===p||ce===p)return re}return""}const Wa=Z(()=>{var z,re;const u=[],p=new Set;for(const ce of su()){const Ve=ce.trim();!Ve||p.has(Ve)||(p.add(Ve),u.push({value:Ve,label:Js(Ve,on.value.labels[Ve])}))}for(const ce of j.value){const Ve=((re=(z=ce.threads[0])==null?void 0:z.cwd)==null?void 0:re.trim())??"";!Ve||p.has(Ve)||Nl(Ve)||(p.add(Ve),u.push({value:Ve,label:Js(Ve,B.value[ce.projectName])}))}const C=gt.value.trim();return C&&!p.has(C)&&u.unshift({value:C,label:Js(C)}),u}),ho=Z(()=>{const u=gt.value.trim();return u?Lt.value[u]===!0:!1}),Xs=Z(()=>{var p,C;const u={};for(const z of j.value){const re=ni(z.projectName,((C=(p=z.threads[0])==null?void 0:p.cwd)==null?void 0:C.trim())??"");u[z.projectName]=re?Lt.value[re]===!0:!1}return u}),Zs=Z(()=>{const u=Ft.value.trim(),p=[...Bn.value];return u&&!p.some(C=>C.value===u)&&p.unshift({value:u,label:u}),p}),Bi=Z(()=>{const u=Ft.value.trim();if(!u)return"";const p=Zs.value.find(C=>C.value===u);return(p==null?void 0:p.label)??u}),Va=Z(()=>Yn.value.trim()),qi=Z(()=>{const u=so.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),iu=Z(()=>qi.value&&Va.value.trim().length>0&&!wn.value),Hi=Z(()=>{const u=Br.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Wi=Z(()=>Er.value.trim()?In.value==="create"?Hi.value:Xo.value.trim().length>0:!1),za=Z(()=>{const u=ut(lo.value).trim();return u||Yn.value.trim()}),ei=Z(()=>io.value?"Creating…":"Create"),po=Z(()=>Pn.value?In.value==="clone"?o("Cloning…"):o("Creating…"):In.value==="clone"?o("Clone repository"):o("Create project")),lu=Z(()=>{const u=Yn.value.trim(),p=uo.value.trim();return!!(u&&p&&u!==p)}),Vi=Z(()=>{const u=[];lu.value&&u.push({key:`parent:${uo.value}`,name:"..",path:uo.value,kind:"parent"});for(const p of Fa.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),fs=Z(()=>{const u=yr.value.trim().toLowerCase();return u?Vi.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):Vi.value}),ta=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,uu=Z(()=>o(T[te.value].label)),cu=Z(()=>Zt.value?o("Terminal"):o("Open terminal")),zi=Z(()=>{const u=new Map(Ao.value.map(C=>[C.value,C]));return[...rn.value.map((C,z)=>({label:C.label,value:C.value,usageCount:0,lastUsedAt:0,...u.get(C.value)??{},custom:!1,sourceIndex:z}))].sort(wv)}),du=Z(()=>[{label:Zt.value?o("Hide terminal"):o("Open terminal"),value:Uh},...zi.value.map(u=>({label:u.label,value:u.value}))]),fu=Z(()=>{const u=T[te.value],p=Math.max(0,No.value-$o.value-Ba.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":$o.value>0?`${$o.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Ba.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),hu=Z(()=>{if(!or.value.configured)return o("Not configured");const u=or.value.active?o("Online"):o("Configured (offline)"),p=or.value.allowAllUsers?o("allow all users"):`${or.value.allowedUsers} ${o("allowed user(s)")}`,C=`${or.value.mappedChats} ${o("chat(s)")}, ${or.value.mappedThreads} ${o("thread(s)")}, ${p}`,z=or.value.lastError?`, ${o("error")}: ${or.value.lastError}`:"";return`${u}, ${C}${z}`});va(()=>{var u,p;document.addEventListener("pointerdown",yd),window.addEventListener("keydown",fd),document.addEventListener("visibilitychange",wd),window.addEventListener("pageshow",bd),window.addEventListener("focus",_d),window.addEventListener("resize",i),(u=window.visualViewport)==null||u.addEventListener("resize",i),(p=window.visualViewport)==null||p.addEventListener("scroll",i),i(),rl(),ta==null||ta.addEventListener("change",rl),wg(),Vv(),M(),Qa(),Oo(),_(),v(),Cu(),Cv(),hd()}),zl(()=>{var u,p;document.removeEventListener("pointerdown",yd),window.removeEventListener("keydown",fd),document.removeEventListener("visibilitychange",wd),window.removeEventListener("pageshow",bd),window.removeEventListener("focus",_d),window.removeEventListener("resize",i),(u=window.visualViewport)==null||u.removeEventListener("resize",i),(p=window.visualViewport)==null||p.removeEventListener("scroll",i),ta==null||ta.removeEventListener("change",rl),Hr!==null&&(window.clearInterval(Hr),Hr=null),Mn&&(clearTimeout(Mn),Mn=null),Zi(),Ue()});function i(){var u,p;typeof window>"u"||(No.value=Math.max(No.value,window.innerHeight),$o.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Ba.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}pt(Yt,u=>{const p=u.trim();if(Mn&&(clearTimeout(Mn),Mn=null),!p){Lr.value=null;return}Mn=setTimeout(()=>{cT(p,1e3).then(C=>{Yt.value.trim()===p&&(Lr.value=C.threadIds)}).catch(()=>{Yt.value.trim()===p&&(Lr.value=null)})},220)}),pt(dn,u=>{u||(dr.value=!1)}),pt(yn,()=>{if(typeof window>"u")return;if(!yn.value.some(p=>p.quotaStatus==="loading")){Hr!==null&&(window.clearInterval(Hr),Hr=null);return}Hr===null&&(Hr=window.setInterval(()=>{Wr||(Wr=!0,lt({silent:!0}).finally(()=>{Wr=!1}))},1500))},{deep:!0});function d(){Xe()}async function v(){try{or.value=await hT()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";or.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function _(){try{const u=await fT();ro.value=u.botToken,oo.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
58
|
+
`),Fr.value=""}catch(u){Fr.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function M(){const u=await gT();zt.value=u.dismissed!==!0}function N(u){const p=u.split(/[\n,]/).map(re=>re.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),C=p.includes("*"),z=Array.from(new Set(p.filter(re=>/^-?\d+$/.test(re)).map(re=>Number.parseInt(re,10))));return C?["*",...z]:z}async function H(){const u=ro.value.trim(),p=N(oo.value);if(!u){Fr.value=o("Telegram bot token is required.");return}if(p.length===0){Fr.value=o("At least one allowed Telegram user ID or * is required.");return}ao.value=!0,Fr.value="";try{await dT(u,p),oo.value=p.map(C=>String(C)).join(`
|
|
59
|
+
`),await Promise.all([_(),v()]),window.alert(o("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(C){Fr.value=C instanceof Error?C.message:o("Failed to connect Telegram bot"),v()}finally{ao.value=!1}}function Y(){qn.value=!qn.value,qn.value?Kt(()=>{var u;return(u=fr.value)==null?void 0:u.focus()}):Yt.value=""}function ie(){var u;Yt.value="",(u=fr.value)==null||u.focus()}function we(u){u.key==="Escape"&&(qn.value=!1,Yt.value="")}function Ye(u){u&&(ot.name==="thread"&&fo.value===u||(bt.push({name:"thread",params:{threadId:u}}),Dt.value&&Gr(!0)))}async function _t(u){u&&(pe.value!==u&&(await nt(u),await bt.push({name:"thread",params:{threadId:u}})),await Kt(),Qv())}function yt(u){return u.length>8?u.slice(-8):u}function kt(u){const p=[u.planType||o("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function bn(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function mo(u){return u.unavailableReason==="payment_required"||bn(u.quotaError)}function Ga(u){return Sn.value||Ct.value||Tt.value||sn.value||xn.value.length>0||u.isActive&&xn.value!==u.accountId&&Gs.value}function Ka(u){return vn.value===u.accountId}function ka(u){return An.value===u.accountId||Ka(u)}function Ya(u){return mo(u)?o("Unavailable"):u.isActive?o("Active"):Ct.value?o("Switching…"):o("Switch")}function hs(u){return xn.value===u.accountId?o("Removing…"):Ka(u)?o("Click again to remove"):o("Remove")}function Gi(u){An.value=u}function Ki(u){An.value===u&&(An.value=""),xn.value!==u&&vn.value===u&&(vn.value="")}function Yi(u){const p=u.quotaSnapshot;if(!p)return null;const C=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(ce=>ce!==null),z=C.find(ce=>ce.windowMinutes===10080);if(z)return z;const re=C.filter(ce=>typeof ce.windowMinutes=="number"&&ce.windowMinutes>=10080).sort((ce,Ve)=>(ce.windowMinutes??0)-(Ve.windowMinutes??0))[0]??null;return re||(p.secondary??null)}function Qi(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function ti(u){var ce,Ve;if(mo(u))return u.quotaError||o("402 Payment Required");const p=u.quotaSnapshot,C=Yi(u),z=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,re=C??z;if(re){const en=Math.max(0,Math.min(100,100-Math.round(re.usedPercent))),Rr=Qi(re.resetsAt);return Rr?`${en}% ${o("weekly remaining")} · ${Rr}`:`${en}% ${o("weekly remaining")}`}return(ce=p==null?void 0:p.credits)!=null&&ce.unlimited?o("Unlimited credits"):(Ve=p==null?void 0:p.credits)!=null&&Ve.hasCredits&&p.credits.balance?`${p.credits.balance} ${o("credits")}`:u.quotaStatus==="loading"?o("Loading quota…"):u.quotaStatus==="error"?u.quotaError||o("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?o("Quota unavailable"):o("Fetching account details…")}function Ji(u){return[u.email||o("Account"),kt(u),mo(u)?o("Unavailable account"):null,ti(u),`${o("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
60
|
+
`)}async function lt(u={}){try{const p=await S_();yn.value=p.accounts,p.accounts.some(C=>C.accountId===An.value)||(An.value=""),p.accounts.some(C=>C.accountId===vn.value)||(vn.value="")}catch(p){if(u.silent===!0)return;Vt.value=p instanceof Error?p.message:o("Failed to load accounts")}}async function wr(){if(!(Sn.value||Ct.value||Tt.value||sn.value)){Vt.value="",An.value="",vn.value="",Sn.value=!0;try{const u=await x_();yn.value=u.accounts,Ue(),Ce(),qe({includeSelectedThreadMessages:!0})}catch(u){Vt.value=u instanceof Error?u.message:o("Failed to refresh accounts")}finally{Sn.value=!1}}}async function na(){var u;if(!(Sn.value||Ct.value||Tt.value||sn.value)){Vt.value="",zn.value="",Tt.value=!0;try{const p=await A_();vr.value=p,Or.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Kt(),(u=Yo.value)==null||u.focus()}catch(p){Vt.value=p instanceof Error?p.message:o("Failed to start Codex login")}finally{Tt.value=!1}}}function pu(){sn.value||(Or.value=!1,zn.value="")}async function Qm(){const u=zn.value.trim();u&&await Jm(u)}async function Jm(u){if(!(sn.value||u.length===0)){Vt.value="",sn.value=!0;try{const p=await E_(u);yn.value=p.accounts,vr.value="",zn.value="",Or.value=!1,Ue(),Ce(),qe({includeSelectedThreadMessages:!0})}catch(p){Vt.value=p instanceof Error?p.message:o("Failed to complete Codex login")}finally{sn.value=!1}}}async function Xm(u){if(!(Ct.value||Sn.value||Tt.value||sn.value)){if(Gs.value){Vt.value=o("Finish the current turn and pending requests before switching accounts.");return}Vt.value="",An.value="",vn.value="",Ct.value=!0;try{const p=await I_(u);yn.value=yn.value.map(C=>C.accountId===u?p:{...C,isActive:!1}),Ue(),Ce(),qe({includeSelectedThreadMessages:!0}),lt({silent:!0})}catch(p){Vt.value=p instanceof Error?p.message:o("Failed to switch account")}finally{Ct.value=!1}}}async function Zm(u){if(Sn.value||Ct.value||Tt.value||sn.value||xn.value.length>0)return;const p=yn.value.find(z=>z.accountId===u)??null;if(!p)return;if(vn.value!==u){vn.value=u;return}if(p.isActive&&Gs.value){Vt.value=o("Finish the current turn and pending requests before removing the active account.");return}const C=p.isActive;Vt.value="",vn.value="",xn.value=u;try{const z=await P_(u);yn.value=z.accounts,Ue(),Ce(),C&&qe({includeSelectedThreadMessages:!0}),lt({silent:!0})}catch(z){Vt.value=z instanceof Error?z.message:o("Failed to remove account")}finally{xn.value=""}}function ev(u){We(u)}async function tv(u){const p=await A(u);p&&(Ht.value?await bt.replace({name:"thread",params:{threadId:p}}):await bt.push({name:"thread",params:{threadId:p}}),Dt.value&&Gr(!0))}function ud(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function ni(u,p=""){var ce,Ve,en;const C=j.value.find(Rr=>Rr.projectName===u);if(!C)return Ui(u)||p.trim();const z=C.threads.find(Rr=>!ud(Rr.cwd));return(((ce=z==null?void 0:z.cwd)==null?void 0:ce.trim())??((en=(Ve=C.threads[0])==null?void 0:Ve.cwd)==null?void 0:en.trim())??"")||Ui(u)||p.trim()}function nv(u){var z,re;const p=j.value.find(ce=>ce.projectName===u),C=ni(u,((re=(z=p==null?void 0:p.threads[0])==null?void 0:z.cwd)==null?void 0:re.trim())??"");C&&(gt.value=C),Dt.value&&Gr(!0),!Ht.value&&bt.push({name:"home"})}function rv(u){var C;let p="";for(const z of j.value){const re=z.threads.find(ce=>ce.id===u);if((C=re==null?void 0:re.cwd)!=null&&C.trim()){p=re.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function cd(u){var C,z;const p=j.value.find(re=>re.projectName===u);return ni(u,((z=(C=p==null?void 0:p.threads[0])==null?void 0:C.cwd)==null?void 0:z.trim())??"")}function ov(u){return(B.value[u]??u).trim()||u}function av(u){return ov(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function sv(u){const p=cd(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function iv(u){const p=cd(u);if(!p||typeof window>"u"||(await Xi(p),Lt.value[p]!==!0))return;const C=`${av(u)}-`,z=window.prompt("New worktree folder name",C);if(z===null)return;const re=z.trim();if(re){if(re.includes("/")||re.includes("\\")||re==="."||re===".."){window.alert("Worktree name must be a single folder name.");return}try{const ce=await J_(p,re),Ve=await fl(ce.cwd,{createIfMissing:!1,label:""});if(!Ve)return;gt.value=Ve,Un.value="local",me(Ha(Ve)),await Qa(),await Oo(),Dt.value&&Gr(!0),Ht.value||await bt.push({name:"home"})}catch(ce){const Ve=ce instanceof Error?ce.message:"Failed to create worktree.";window.alert(Ve)}}}function mu(){gt.value="",Un.value="local",Dt.value&&Gr(!0),!Ht.value&&bt.push({name:"home"})}async function Xi(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(Lt.value,p))return;const C=er.get(p);if(C){const ce=await C;Object.prototype.hasOwnProperty.call(Lt.value,p)||(Lt.value={...Lt.value,[p]:ce});return}const z=eT(p).then(ce=>ce.isGitRepo).catch(()=>!1).finally(()=>{er.delete(p)});er.set(p,z);const re=await z;Object.prototype.hasOwnProperty.call(Lt.value,p)||(Lt.value={...Lt.value,[p]:re})}function lv(u){q(u.projectName,u.displayName)}function uv(u){$(u.threadId,u.title)}async function cv(u){await W(u),await Qa(),Oo()}function dv(u){se(u.projectName,u.toIndex)}function fv(u){var z,re;const p=j.value.find(ce=>ce.projectName===u),C=ni(u,((re=(z=p==null?void 0:p.threads[0])==null?void 0:z.cwd)==null?void 0:re.trim())??"");Xi(C)}function dd(u){hv(u)}async function hv(u){var z;const p=await D(u),C=((z=u.followUpMessageText)==null?void 0:z.trim())??"";if(!(!p||!C||Ht.value))try{await ne(C,[],[],"steer",[])}catch{}}async function pv(u){const p=await V(u.threadId,u.turnIndex);p&&(await bt.push({name:"thread",params:{threadId:p}}),pe.value!==p&&await nt(p),Dt.value&&Gr(!0))}function Gr(u){$t.value!==u&&($t.value=u,mg(u))}function fd(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Hn.value){Hn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){u.preventDefault(),Gr(!$t.value);return}if(p==="j"&&ot.name==="thread"&&pe.value){u.preventDefault(),vu();return}p==="j"&&Ht.value&&De.value&&(u.preventDefault(),vu())}function vu(){if(kr.value){if(Ht.value){if(!De.value)return;gn.value=!gn.value,gn.value||ri();return}Oe(),O.value||ri()}}function mv(u){if(mn.value="",!!u){if(u===Uh){vu();return}vv(u)}}async function vv(u){if(!kr.value||!De.value)return;if(Ht.value)gn.value=!0;else if(pe.value)ve(pe.value,!0);else return;const p=await gv();if(p)try{await p.runQuickCommand(u),yv(u)}catch{}}async function gv(){for(let u=0;u<20;u+=1){await Kt();const p=Ht.value?zo.value:pn.value;if(p)return p;await new Promise(C=>window.setTimeout(C,25))}return null}async function hd(){const u=De.value.trim();if(!u){rn.value=[];return}try{rn.value=await __(u)}catch{rn.value=[]}}function yv(u){const p=pd(u);if(!p)return;const C=Ao.value.find(en=>en.value===p),z=rn.value.findIndex(en=>en.value===p),re=z>=0?rn.value[z]:null;if(!re)return;const ce={label:(C==null?void 0:C.label)||(re==null?void 0:re.label)||p,value:p,custom:!1,usageCount:((C==null?void 0:C.usageCount)??0)+1,lastUsedAt:Date.now(),sourceIndex:z>=0?z:void 0},Ve=[...Ao.value.filter(en=>en.value!==p),ce];Ao.value=Ve,_v(Ve)}function pd(u){return u.trim().replace(/\s+/g," ")}function wv(u,p){if(p.usageCount!==u.usageCount)return p.usageCount-u.usageCount;if(p.lastUsedAt!==u.lastUsedAt)return p.lastUsedAt-u.lastUsedAt;const C=typeof u.sourceIndex=="number"?u.sourceIndex:Number.MAX_SAFE_INTEGER,z=typeof p.sourceIndex=="number"?p.sourceIndex:Number.MAX_SAFE_INTEGER;return C-z}function bv(){if(typeof window>"u")return[];try{const u=window.localStorage.getItem(Fh);if(!u)return[];const p=JSON.parse(u);if(!Array.isArray(p))return[];const C=new Set,z=[];for(const re of p){const ce=re!==null&&typeof re=="object"&&!Array.isArray(re)?re:null,Ve=pd(md(ce==null?void 0:ce.value));!Ve||C.has(Ve)||(C.add(Ve),z.push({label:md(ce==null?void 0:ce.label)||Ve,value:Ve,custom:(ce==null?void 0:ce.custom)!==!1,usageCount:vd(ce==null?void 0:ce.usageCount),lastUsedAt:vd(ce==null?void 0:ce.lastUsedAt)}))}return z}catch{return[]}}function _v(u){typeof window>"u"||window.localStorage.setItem(Fh,JSON.stringify(u.map(p=>({label:p.label,value:p.value,custom:p.custom===!0,usageCount:p.usageCount,lastUsedAt:p.lastUsedAt}))))}function md(u){return typeof u=="string"?u:""}function vd(u){if(typeof u=="number"&&Number.isFinite(u))return Math.max(0,Math.trunc(u));if(typeof u=="string"){const p=Number(u);if(Number.isFinite(p))return Math.max(0,Math.trunc(p))}return 0}function gd(u){if($r.value=u,!u){dr.value=!1,Zi();return}dr.value=!0,Zi(),$n=setTimeout(()=>{$n=null,dn.value||(dr.value=!1)},1500)}function Tv(){gn.value=!1,ri()}function kv(){pe.value&&ve(pe.value,!1),ri()}function ri(){$r.value=!1,dr.value=!1,Zi()}function Zi(){$n&&(clearTimeout($n),$n=null)}async function Cv(){try{const u=await b_();kr.value=u.available,u.available||(gn.value=!1,pe.value&&ve(pe.value,!1))}catch{kr.value=!1,gn.value=!1}}function yd(u){var C,z;const p=u.target;if(p instanceof Node){if($r.value){const re=p instanceof Element?p:p.parentElement;re!=null&&re.closest(".thread-terminal-panel")||ri()}Hn.value&&((C=Zr.value)!=null&&C.contains(p)||(z=eo.value)!=null&&z.contains(p)||(Hn.value=!1))}}function Sv(u){var C,z;if(!Hn.value)return;const p=u.target;p instanceof Node&&((C=Zr.value)!=null&&C.contains(p)||(z=eo.value)!=null&&z.contains(p)||(Hn.value=!1))}function wd(){if(!(typeof document>"u")&&Dt.value){if(document.visibilityState==="hidden"){co.value=Date.now(),Ua.value=!1;return}gu()}}function bd(u){u.persisted&&gu()}function _d(){ot.name==="home"&&(Qa(),Oo()),gu()}function gu(){typeof window>"u"||typeof document>"u"||!Dt.value||document.visibilityState!=="visible"||Ua.value||co.value===null||Date.now()-co.value<A$||(Ua.value=!0,co.value=null,xv())}async function xv(){if(!ba.value){ba.value=!0;try{await qe({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await xu()}finally{ba.value=!1}}}function Td(u){const p=u.text;el();const C=Eo.value,z=u.mode==="queue"&&C&&C.threadId===pe.value?C.queueIndex:void 0;if(Eo.value=null,Ht.value){_g(p,u.imageUrls,u.skills,u.fileAttachments);return}ne(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,z)}function Av(u){const p=he.value.findIndex(ce=>ce.id===u),C=p>=0?he.value[p]:void 0,z=cn.value;if(!C||!z||z.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Eo.value=pe.value?{threadId:pe.value,queueIndex:p}:null;const re={text:C.text,imageUrls:[...C.imageUrls],fileAttachments:C.fileAttachments.map(ce=>({...ce})),skills:C.skills.map(ce=>({...ce}))};z.hydrateDraft(re),ue(u)}function el(){if(!Dt.value||Ht.value)return;const u=()=>{var p;(p=Xr.value)==null||p.jumpToLatest()};u(),Kt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function Ev(u){gt.value=u.trim(),Kn.value=""}function Iv(u){Ft.value=u.trim()}function tl(u){const p=De.value.trim();return!u||p!==u?!1:ot.name==="thread"||ot.name==="home"&&ho.value}function kd(){tr+=1,hr+=1,Ro.value=[],Wn.value=null,an.value=null,ct.value=null,Nn.value=null,Ln.value=!1,jr.value=!1,Qt.value={},Vn.value="",mr.value="",Nt.value="",no.value=!1}async function oi(u){const p=u.trim();if(!p){kd();return}const C=++tr;no.value=!0,Nt.value="";try{const z=await Z_(p);if(C!==tr||!tl(p))return;Ro.value=z.options,Wn.value=z.currentBranch,an.value=z.headSha,ct.value=z.headSubject,Nn.value=z.headDate,Ln.value=z.detached,jr.value=z.dirty}catch{if(C!==tr||!tl(p))return;Ro.value=[],Wn.value=null,an.value=null,ct.value=null,Nn.value=null,Ln.value=!1,jr.value=!1}finally{C===tr&&(no.value=!1)}}function Pv(u){Wn.value=u.currentBranch,an.value=u.headSha,ct.value=u.headSubject,Nn.value=u.headDate,Ln.value=u.detached,jr.value=u.dirty}function Rv(u){if(Bt.value)return;const p=u.trim();if(!p||p===(Wn.value??""))return;const C=De.value.trim();C&&(Bt.value=!0,Nt.value="",tT(C,p).then(z=>(Wn.value=z||p,an.value=null,ct.value=null,Nn.value=null,Ln.value=!1,pr.value=!1,oi(C))).catch(z=>{const re=z instanceof Error?z.message:"Failed to switch branch";oi(C).finally(()=>{Nt.value=re})}).finally(()=>{Bt.value=!1}))}function Mv(u){if(Bt.value)return;const p=u.branch.trim(),C=u.sha.trim(),z=De.value.trim();!p||!C||!z||(Bt.value=!0,Nt.value="",rT(z,p,C).then(re=>(Pv(re),pr.value=!1,oi(z))).catch(re=>{const ce=re instanceof Error?re.message:"Failed to reset branch to commit";oi(z).finally(()=>{Nt.value=ce})}).finally(()=>{Bt.value=!1}))}function $v(u){const p=u.trim(),C=De.value.trim();if(!p||!C||Vn.value===p||Qt.value[p])return;const z=++hr;Vn.value=p,mr.value="",nT(C,p).then(re=>{z!==hr||!tl(C)||(Qt.value={...Qt.value,[p]:re})}).catch(re=>{z!==hr||!tl(C)||(mr.value=re instanceof Error?re.message:"Failed to load branch commits")}).finally(()=>{z===hr&&Vn.value===p&&(Vn.value="")})}async function Nv(){const u=await bu();u&&(await Oo(),Er.value=u,Br.value=nr.value.trim()||"New Project (1)",Xo.value="",qr.value="",In.value="create",Mo.value=!0,Kt(()=>{var p;return(p=ya.value)==null?void 0:p.focus()}))}function nl(){Pn.value||(Mo.value=!1,qr.value="")}async function Lv(){const u=Er.value.trim(),p=Br.value.trim();if(!Hi.value)throw new Error("Enter a single project folder name.");const C=Ad(xd(u,p));return C?fl(C,{createIfMissing:!0,label:""}):""}async function jv(){const u=Er.value.trim(),p=Xo.value.trim();return p?sT(p,u):""}async function yu(){if(!(!Wi.value||Pn.value)){qr.value="",Pn.value=!0;try{const u=In.value==="clone"?await jv():await Lv();if(!u)return;gt.value=u,me(Ha(u)),await Qa(),await Oo(),Mo.value=!1}catch(u){qr.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{Pn.value=!1}}}async function Ov(){const u=gt.value.trim()||await bu();u&&(Ur.value=!1,Ir.value=!0,yr.value="",await Ca(u),wn.value||Kt(()=>{var p;return(p=Zo.value)==null?void 0:p.focus()}))}function ps(){ea+=1,Ir.value=!1,jn.value=!1,wn.value="",yr.value="",lo.value="",ai()}async function Dv(u){!u||jn.value||(yr.value="",await Ca(u))}function Fv(){const u=Yn.value.trim();!Ir.value||!u||Ca(u)}function Uv(){const u=za.value;!Ir.value||!u||jn.value||Ca(u)}function Bv(){if(!Ir.value||jn.value||gr.value)return;const u=za.value,p=Yn.value.trim();!u||u===p||Ca(u)}function qv(){const u=za.value,p=Yn.value.trim();if(u){if(u!==p){Ca(u);return}wu(u)}}async function wu(u=za.value){const p=ut(u).trim();if(p){wn.value="",gr.value=!0;try{const C=await fl(p,{createIfMissing:!1,label:""});if(!C){wn.value="Failed to open the selected folder.";return}gt.value=C,me(Ha(C)),await Qa(),await Oo(),ps()}catch(C){wn.value=C instanceof Error?C.message:"Failed to open the selected folder."}finally{gr.value=!1}}}async function Hv(){if(Kn.value="",Ur.value){ai();return}if(!Ir.value){const u=gt.value.trim()||await bu();if(!u||(Ir.value=!0,yr.value="",await Ca(u),wn.value))return}wn.value||(so.value=nr.value,Ur.value=!0,Kt(()=>{var u;return(u=Sr.value)==null?void 0:u.focus()}))}function ai(){Kn.value="",so.value="",Ur.value=!1}async function Cd(){const u=so.value.trim();if(!u)return;if(Kn.value="",wn.value){Kn.value="Reload the current folder before creating a new one.";return}io.value=!0;const p=Va.value.trim(),C=Ad(xd(p,u));if(!C){Kn.value="Unable to determine where the new folder should be created.",io.value=!1;return}if(!qi.value){Kn.value="Enter a single folder name.",io.value=!1;return}try{const z=await aT(C);if(!z){Kn.value="Failed to create the folder.";return}Kn.value="",yr.value="",await Ca(z),ai()}catch(z){Kn.value=z instanceof Error?z.message:"Failed to create folder."}finally{io.value=!1}}async function Wv(){var p;if(typeof window>"u")return!1;const u=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!u)return!1;try{const C=await fl(u,{createIfMissing:!1,label:""});if(!C)return!1;gt.value=C,me(Ha(C)),await bt.replace({name:"home"}),await Qa();const z=new URL(window.location.href);return z.searchParams.delete("openProjectPath"),window.history.replaceState({},"",z.toString()),!0}catch{return!1}}async function bu(){const u=Sd();if(u)return u;try{const p=await fh();if(p)return to.value=p,p}catch{}return""}async function Oo(){const u=Sd();if(!u){nr.value="New Project (1)";return}try{const p=await lT(u);nr.value=p.name||"New Project (1)"}catch{nr.value="New Project (1)"}}function Sd(){var C,z;const u=gt.value.trim();if(u)return $s(u);const p=((z=(C=Wa.value[0])==null?void 0:C.value)==null?void 0:z.trim())??"";return p?$s(p):to.value.trim()}async function Vv(){try{to.value=await fh()}catch{to.value=""}}async function Qa(){try{const u=await Ts();on.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{on.value={order:[],labels:{},projectOrder:[]}}}async function Ca(u){const p=++ea,C=ut(u).trim();lo.value=C,Yn.value=C,wn.value="",jn.value=!0;try{const z=await oT(u,{showHidden:wa.value});if(p!==ea)return;lo.value=z.path,Yn.value=z.path,uo.value=z.parentPath,Fa.value=z.entries}catch(z){if(p!==ea)return;wn.value=z instanceof Error?z.message:"Failed to load local folders.",uo.value=$s(Yn.value),Fa.value=[],ai()}finally{p===ea&&(jn.value=!1)}}function xd(u,p){const C=ut(u).trim(),z=ut(p).trim().replace(/^[\\/]+/u,"");if(!C||!z)return"";const re=C.includes("\\")&&!C.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(C))return`${C.slice(0,2)}${re}${z}`;if(/^\/+$/u.test(C))return`/${z}`;const ce=C.replace(/[\\/]+$/u,"");return ce?`${ce}${re}${z}`:""}function Ad(u){const p=ut(u).trim();if(!p)return"";const C=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(C){const[,re,ce,Ve=""]=C,en=_u(Ve.split(/[\\/]+/u));return en.length>0?`\\\\${re}\\${ce}\\${en.join("\\")}`:`\\\\${re}\\${ce}`}const z=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(z){const[,re,ce=""]=z,Ve=p.includes("\\")&&!p.includes("/")?"\\":"/",en=_u(ce.split(/[\\/]+/u));return en.length>0?`${re}${Ve}${en.join(Ve)}`:`${re}${Ve}`}if(p.startsWith("/")){const re=_u(p.split("/"));return re.length>0?`/${re.join("/")}`:"/"}return p}function _u(u){const p=[];for(const C of u){const z=C.trim();if(!(!z||z===".")){if(z===".."){p.length>0&&p.pop();continue}p.push(z)}}return p}function zv(u){ye(u.draggedId,u.targetId)}function Ed(u){$e(w.value,u)}function Id(u){je(u)}function Pd(u){tt(u)}function Gv(){ae()}function Kv(u){const p=u.turnId.trim();if(p.length>0){const C=[...y.value].reverse().find(z=>{var re;return z.role==="user"&&(((re=z.turnId)==null?void 0:re.trim())??"")===p&&z.text.trim().length>0});C!=null&&C.text&&cn.value&&cn.value.appendTextToDraft(C.text)}ht(u.turnId)}function Yv(u){Ht.value||!pe.value||(Me("default"),el(),ne("Implement",[],[],"steer",[],void 0,"default"))}function Qv(){if(Ht.value||ar.value||typeof document>"u"||!X.value||y.value.length===0)return;const u=Jv(),p=Xv(),C=new Blob([u],{type:"text/markdown;charset=utf-8"}),z=URL.createObjectURL(C),re=document.createElement("a");re.href=z,re.download=p,document.body.appendChild(re),re.click(),document.body.removeChild(re),window.setTimeout(()=>URL.revokeObjectURL(z),0)}function Jv(){var C,z,re;const u=[],p=((z=(C=X.value)==null?void 0:C.title)==null?void 0:z.trim())||"Untitled thread";u.push(`# ${Zv(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((re=X.value)==null?void 0:re.id)??""}`),u.push(""),u.push("---"),u.push("");for(const ce of y.value){const Ve=ce.role?ce.role.toUpperCase():"MESSAGE";u.push(`## ${Ve}`),u.push("");const en=ce.text.trim();if(en&&(u.push(en),u.push("")),ce.commandExecution&&(u.push("```text"),u.push(`command: ${ce.commandExecution.command}`),u.push(`status: ${ce.commandExecution.status}`),ce.commandExecution.cwd&&u.push(`cwd: ${ce.commandExecution.cwd}`),ce.commandExecution.exitCode!==null&&u.push(`exitCode: ${ce.commandExecution.exitCode}`),u.push(ce.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),ce.fileAttachments&&ce.fileAttachments.length>0){u.push("Attachments:");for(const Rr of ce.fileAttachments)u.push(`- ${Rr.path}`);u.push("")}if(ce.images&&ce.images.length>0){u.push("Images:");for(const Rr of ce.images)u.push(`- ${Rr}`);u.push("")}}return`${u.join(`
|
|
61
|
+
`).trimEnd()}
|
|
62
|
+
`}function Xv(){var re,ce;const C=(((ce=(re=X.value)==null?void 0:re.title)==null?void 0:ce.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",z=new Date().toISOString().replace(/[:.]/g,"-");return`${C}-${z}.md`}function Zv(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Tu(u,p){if(typeof window>"u")return p;const C=window.localStorage.getItem(u);return C===null?p:C==="1"}function eg(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(Hh);return u==="light"||u==="dark"?u:"system"}function tg(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(qh);return u==="steer"||u==="queue"?u:"queue"}function ng(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(Gh);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function rg(){xr.value=!xr.value,window.localStorage.setItem(Bh,xr.value?"1":"0")}function og(){P.value=P.value==="steer"?"queue":"steer",window.localStorage.setItem(qh,P.value)}function ag(){const u=["system","light","dark"],p=u.indexOf(F.value);F.value=u[(p+1)%u.length],window.localStorage.setItem(Hh,F.value),rl()}function sg(){const u=["standard","wide","extra-wide"],p=u.indexOf(te.value);te.value=u[(p+1)%u.length],window.localStorage.setItem(Gh,te.value)}function ig(){Ae.value=!Ae.value,window.localStorage.setItem(Wh,Ae.value?"1":"0")}function lg(){wt.value=!wt.value,window.localStorage.setItem(Vh,wt.value?"1":"0")}async function ug(u){if(!Gn.value){Gn.value=!0;try{if(u==="codex"){ln.value="codex";const p=await uh(!1);Jt.value=p.enabled}else if(u==="openrouter"){ln.value="openrouter";const p=await uh(!0);Jt.value=p.enabled,await vs("","",{wireApi:At.value,provider:"openrouter"})}else u==="opencode-zen"?(ln.value="opencode-zen",await vs("",Jo.value.trim(),{wireApi:"chat",provider:"opencode-zen"}),Jt.value=!0):u==="custom"&&(ln.value="custom",Dr.value.trim()&&Qo.value.trim()&&(await vs(Dr.value.trim(),Qo.value.trim(),{wireApi:Ar.value}),Jt.value=!0));Se.value="",await qe({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0}),ot.name==="thread"&&bt.push({name:"home"})}catch(p){Se.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Gn.value=!1}}}async function ku(){if(Ie.value)return;const u=Dr.value.trim();if(u){Ie.value=!0;try{Se.value="",await vs(u,Qo.value.trim(),{wireApi:Ar.value}),Jt.value=!0,await qe({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Se.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Ie.value=!1}}}async function Rd(u){if(Ie.value||Gn.value||At.value===u)return;const p=At.value;At.value=u,Ie.value=!0;try{Se.value="",await vs("","",{wireApi:u,provider:"openrouter"}),Jt.value=!0,await qe({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(C){At.value=p,Se.value=C instanceof Error?C.message:"Failed to save OpenRouter API format"}finally{Ie.value=!1}}async function Md(){if(Ie.value)return;const u=Jo.value.trim();if(u){Ie.value=!0;try{Se.value="",await vs("",u,{wireApi:"chat",provider:"opencode-zen"}),Jt.value=!0,await qe({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Se.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Ie.value=!1}}}async function $d(){if(!Ie.value){Ie.value=!0;try{const u=rr.value.trim();await ch(u),rr.value="",await Cu(),await qe({includeSelectedThreadMessages:!1})}catch{}finally{Ie.value=!1}}}async function cg(){if(!Ie.value){Ie.value=!0;try{await ch(""),rr.value="",await Cu(),await qe({includeSelectedThreadMessages:!1})}catch{}finally{Ie.value=!1}}}async function Cu(){try{const u=await U_();Jt.value=u.enabled,us.value=u.customKey??!1,cs.value=u.maskedKey??null,u.enabled?u.provider==="opencode-zen"?ln.value="opencode-zen":u.provider==="custom"?(ln.value="custom",Dr.value=u.customBaseUrl??"",Ar.value=u.wireApi==="chat"?"chat":"responses"):(ln.value="openrouter",At.value=u.wireApi==="chat"?"chat":"responses"):ln.value="codex"}catch{}}function dg(u){const C=Su(u.trim())||"auto";qt.value=C,window.localStorage.setItem(zh,C)}function fg(){var C;if(typeof window>"u")return"auto";const u=((C=window.localStorage.getItem(zh))==null?void 0:C.trim())||"auto";return Su(u)||"auto"}function hg(){const u=[{value:"auto",label:o("Auto-detect")}],p=new Set(["auto"]);function C(re){const ce=I[re]||re;return`${ce.charAt(0).toUpperCase()+ce.slice(1)} (${re})`}for(const re of typeof navigator<"u"?navigator.languages??[]:[]){const ce=Su(re);!ce||p.has(ce)||(p.add(ce),u.push({value:ce,label:`Preferred: ${C(ce)}`}))}for(const re of Object.keys(I))p.has(re)||(p.add(re),u.push({value:re,label:C(re)}));const z=qt.value.trim();return z&&!p.has(z)&&u.push({value:z,label:C(z)}),u}function Su(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in I)return p;const C=p.split("-")[0]??p;return C in I?C:""}function rl(){const u=document.documentElement;if(F.value==="dark")u.classList.add("dark");else if(F.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}function pg(){return typeof window>"u"?!1:window.localStorage.getItem(Oh)==="1"}function mg(u){typeof window>"u"||window.localStorage.setItem(Oh,u?"1":"0")}function vg(){if(typeof window>"u")return!0;const u=window.localStorage.getItem(Dh);return u===null?!0:u==="1"}function gg(){Cr.value=!Cr.value,!(typeof window>"u")&&window.localStorage.setItem(Dh,Cr.value?"1":"0")}function yg(u,p){const C=(u??"").trim();return C.length>0?C:p.trim()||"message"}function Nd(u){Me(u)}async function wg(){await bt.isReady(),ot.name==="thread"&&fo.value&&vt(fo.value),await qe({includeSelectedThreadMessages:ot.name==="thread"}),lt({silent:!0}),await Wv(),Nr.value=!0,await xu(),Ce()}function bg(u){return u?j.value.some(p=>p.threads.some(C=>C.id===u)):!1}async function xu(){if(Io.value){Go=!0;return}Io.value=!0;try{do{if(Go=!1,ot.name==="home"||ot.name==="skills"){pe.value!==""&&await nt("");continue}if(ot.name==="thread"){const u=fo.value;if(!u)continue;if(pe.value!==u){if(!bg(u)){pe.value?await bt.replace({name:"thread",params:{threadId:pe.value}}):await bt.replace({name:"home"});continue}await nt(u)}else Q(u,{silent:!0})}}while(Go)}finally{Io.value=!1}}pt(()=>[ot.name,fo.value,Ne.value,pe.value],async()=>{Nr.value&&await xu()}),pt(()=>De.value,()=>{hd()}),pt(()=>[ot.name,De.value],([u,p])=>{u==="thread"&&Xi(p)},{immediate:!0}),pt(()=>pe.value,async u=>{if(Nr.value&&!Io.value&&!(Ht.value||ar.value)){if(!u){ot.name!=="home"&&await bt.replace({name:"home"});return}ot.name==="thread"&&fo.value===u||await bt.replace({name:"thread",params:{threadId:u}})}}),pt(()=>Wa.value,u=>{if(u.length===0){gt.value="",Oo();return}const p=gt.value.trim();p&&(u.some(z=>z.value===p)||(gt.value="")),Oo()},{immediate:!0}),pt(()=>gt.value,()=>{Ut.value={phase:"idle",title:"",message:""},Oo()}),pt(()=>[ot.name,gt.value],([u,p])=>{u==="home"&&Xi(p)},{immediate:!0}),pt(ho,u=>{!u&&Un.value==="worktree"&&(Un.value="local")},{immediate:!0}),pt(()=>[Un.value,gt.value],([u,p])=>{u!=="worktree"||!ho.value||Ld(p)},{immediate:!0}),pt(()=>Un.value,u=>{var p;if(u==="local"){Ut.value={phase:"idle",title:"",message:""};const C=gt.value.trim();if(C&&ud(C)){const z=((p=X.value)==null?void 0:p.projectName)??Mr(C),re=ni(z,"");re&&(gt.value=re)}return}ho.value&&Ld(gt.value)}),pt(()=>ot.name,u=>{u!=="home"&&(Ut.value={phase:"idle",title:"",message:""}),u!=="thread"&&(pr.value=!1)}),pt(()=>pe.value,()=>{Ut.value={phase:"idle",title:"",message:""}}),pt(()=>[ot.name,De.value,ho.value],([u,p,C])=>{if(!(u==="thread"||u==="home"&&C)){kd();return}hr+=1,Qt.value={},Vn.value="",mr.value="",oi(p)},{immediate:!0}),pt(zs,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),pt(Dt,u=>{u&&!$t.value&&Gr(!0)},{immediate:!0});async function _g(u,p=[],C=[],z=[]){try{Ut.value={phase:"idle",title:"",message:""};let re=gt.value;if(Un.value==="worktree"){Ut.value={phase:"running",title:o("Creating worktree"),message:o("Creating a worktree and running setup.")};try{const Ve=await Q_(gt.value,Ft.value);re=Ve.cwd,gt.value=Ve.cwd,Ut.value={phase:"idle",title:"",message:""}}catch{Ut.value={phase:"error",title:o("Worktree setup failed"),message:o("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!re.trim()){const Ve=await iT(u);re=Ve.cwd,gt.value=Ve.cwd}const ce=await le(u,re,p,C,z);if(!ce)return;await bt.replace({name:"thread",params:{threadId:ce}}),el()}catch{}}function Tg(u){var z;if((z=u.prompt)!=null&&z.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),C=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${C}. Give me a list of what it can do and one useful example.`}function kg(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function Cg(u){var z;if(Po.value)return;Po.value=kg(u);const p=Tg(u),C=(z=u.attachedSkills)!=null&&z.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const re=Lo.value.trim()||De.value.trim(),ce=await le(p,re,[],C,[]);if(!ce)return;await bt.replace({name:"thread",params:{threadId:ce}}),el()}catch{}finally{Po.value=""}}async function Ld(u){var C;const p=u.trim();if(!p){Bn.value=[],Ft.value="";return}Rn.value=!0;try{const z=await X_(p);Bn.value=z;const re=Ft.value.trim();if(!(re.length>0&&z.some(Ve=>Ve.value===re))){const Ve=z.find(en=>en.value.trim()==="main");Ft.value=(Ve==null?void 0:Ve.value)??((C=z[0])==null?void 0:C.value)??""}}catch{Bn.value=[],Ft.value=""}finally{Rn.value=!1}}return(u,p)=>(k(),E(Qe,null,[Be(w0,{"is-sidebar-collapsed":$t.value,onCloseSidebar:p[32]||(p[32]=C=>Gr(!0))},{sidebar:mt(()=>[m("section",ZI,[m("div",eP,[$t.value?J("",!0):(k(),at(Ch,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":$t.value,"show-new-thread-button":!0,onToggleSidebar:p[0]||(p[0]=C=>Gr(!$t.value)),onStartNewThread:mu},{default:mt(()=>[m("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":qn.value,"aria-label":S(o)("Search threads"),title:S(o)("Search threads"),onClick:Y},[Be(Sh,{class:"sidebar-search-toggle-icon"})],8,tP)]),_:1},8,["is-sidebar-collapsed"])),!$t.value&&qn.value?(k(),E("div",nP,[Be(Sh,{class:"sidebar-search-bar-icon"}),jt(m("input",{ref_key:"sidebarSearchInputRef",ref:fr,"onUpdate:modelValue":p[1]||(p[1]=C=>Yt.value=C),class:"sidebar-search-input",type:"text",placeholder:S(o)("Filter threads..."),onKeydown:we},null,40,rP),[[tn,Yt.value]]),Yt.value.length>0?(k(),E("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":S(o)("Clear search"),onClick:ie},[Be(oI,{class:"sidebar-search-clear-icon"})],8,oP)):J("",!0)])):J("",!0),$t.value?J("",!0):(k(),E("button",{key:2,class:rt(["sidebar-skills-link",{"is-active":ar.value}]),type:"button",onClick:p[2]||(p[2]=C=>{S(bt).push({name:"skills"}),S(Dt)&&Gr(!0)})},[m("span",aP,[Be(Sl)]),m("span",sP,[m("span",iP,R(S(o)("Skills")),1),m("span",lP,R(S(o)("Plugins, apps, MCPs")),1)])],2)),$t.value?J("",!0):(k(),at(PC,{key:3,groups:S(j),"project-display-name-by-id":S(B),"project-git-repo-by-name":Xs.value,"selected-thread-id":S(pe),"is-loading":S(Ne),"is-thread-list-fully-loaded":S(Fe),"search-query":Yt.value,"search-matched-thread-ids":Lr.value,onSelect:Ye,onArchive:ev,onStartNewThread:nv,onRenameProject:lv,onBrowseThreadFiles:rv,onBrowseProjectFiles:sv,onRequestProjectGitStatus:fv,onCreateProjectWorktree:iv,onRenameThread:uv,onForkThread:tv,onRemoveProject:cv,onReorderProject:dv,onExportThread:_t,onStartNewChat:mu},null,8,["groups","project-display-name-by-id","project-git-repo-by-name","selected-thread-id","is-loading","is-thread-list-fully-loaded","search-query","search-matched-thread-ids"]))]),$t.value?J("",!0):(k(),E("div",{key:0,ref_key:"settingsAreaRef",ref:Ko,class:"sidebar-settings-area",onClick:Sv},[Be(im,{name:"settings-panel"},{default:mt(()=>[Hn.value?(k(),E("div",{key:0,ref_key:"settingsPanelRef",ref:Zr,class:"sidebar-settings-panel",onClick:p[16]||(p[16]=Ze(()=>{},["stop"]))},[m("div",uP,[m("div",cP,[m("div",dP,[m("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!Cr.value,title:Cr.value?S(o)("Expand accounts"):S(o)("Collapse accounts"),onClick:gg},[m("span",hP,R(Cr.value?"▸":"▾"),1)],8,fP),m("span",pP,R(S(o)("Accounts")),1),m("span",mP,R(yn.value.length),1)]),m("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:Sn.value||Ct.value||Tt.value||sn.value,onClick:wr},R(Sn.value?S(o)("Reloading…"):S(o)("Reload")),9,vP)]),Cr.value?J("",!0):(k(),E(Qe,{key:0},[Vt.value?(k(),E("p",gP,R(Vt.value),1)):J("",!0),m("div",yP,[m("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:Sn.value||Ct.value||Tt.value||sn.value,onClick:na},R(Tt.value?S(o)("Starting login…"):S(o)("Login")),9,wP),vr.value?(k(),E("a",{key:0,class:"sidebar-settings-account-login-link",href:vr.value,target:"_blank",rel:"noreferrer"},R(S(o)("Open login URL")),9,bP)):J("",!0)]),yn.value.length===0?(k(),E("p",_P,R(S(o)("Click Login, or run `codex login`, then click reload.")),1)):(k(),E("div",TP,[(k(!0),E(Qe,null,Ot(yn.value,C=>(k(),E("article",{key:C.accountId,class:rt(["sidebar-settings-account-item",{"is-active":C.isActive,"is-unavailable":mo(C),"is-confirming-remove":Ka(C),"is-remove-visible":ka(C)}]),title:Ji(C),onMouseenter:z=>Gi(C.accountId),onMouseleave:z=>Ki(C.accountId)},[m("div",CP,[m("p",SP,R(C.email||S(o)("Account")),1),m("p",xP,R(kt(C)),1),m("p",AP,R(ti(C)),1),m("p",EP," Workspace "+R(yt(C.accountId)),1)]),m("div",IP,[m("button",{class:"sidebar-settings-account-switch",type:"button",disabled:Ga(C)||C.isActive||mo(C),onClick:z=>Xm(C.accountId)},R(Ya(C)),9,PP),m("button",{class:rt(["sidebar-settings-account-remove",{"is-visible":ka(C),"is-confirming":Ka(C)}]),type:"button",disabled:Ga(C),onClick:z=>Zm(C.accountId)},R(hs(C)),11,RP)])],42,kP))),128))]))],64))]),m("button",{class:"sidebar-settings-row",type:"button",title:g.sendWithEnter,onClick:rg},[m("span",$P,R(S(o)("Require ⌘ + enter to send")),1),m("span",{class:rt(["sidebar-settings-toggle",{"is-on":!xr.value}])},null,2)],8,MP),m("button",{class:"sidebar-settings-row",type:"button",title:g.inProgressSendMode,onClick:og},[m("span",LP,R(S(o)("When busy, send as")),1),m("span",jP,R(P.value==="steer"?S(o)("Steer"):S(o)("Queue")),1)],8,NP),m("button",{class:"sidebar-settings-row",type:"button",title:g.appearance,onClick:ag},[m("span",DP,R(S(o)("Appearance")),1),m("span",FP,R(F.value==="system"?S(o)("System"):F.value==="dark"?S(o)("Dark"):S(o)("Light")),1)],8,OP),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(o)("Choose the interface language for the app.")},[m("span",BP,R(S(o)("UI language")),1),m("select",{class:"sidebar-settings-provider-select",value:S(s),onChange:p[3]||(p[3]=C=>S(c)(C.target.value))},[(k(!0),E(Qe,null,Ot(S(l),C=>(k(),E("option",{key:C.value,value:C.value},R(C.label),9,HP))),128))],40,qP)],8,UP),m("button",{class:"sidebar-settings-row",type:"button",title:g.chatWidth,onClick:sg},[m("span",VP,R(S(o)("Chat width")),1),m("span",zP,R(uu.value),1)],8,WP),m("button",{class:"sidebar-settings-row",type:"button",title:g.dictationClickToToggle,onClick:ig},[m("span",KP,R(S(o)("Click to toggle dictation")),1),m("span",{class:rt(["sidebar-settings-toggle",{"is-on":Ae.value}])},null,2)],8,GP),m("button",{class:"sidebar-settings-row",type:"button",title:g.dictationAutoSend,onClick:lg},[m("span",QP,R(S(o)("Auto send dictation")),1),m("span",{class:rt(["sidebar-settings-toggle",{"is-on":wt.value}])},null,2)],8,YP),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(o)("Choose the API provider for the Codex backend")},[m("span",XP,R(S(o)("Provider")),1),m("select",{class:"sidebar-settings-provider-select",value:ln.value,disabled:Gn.value,onChange:p[4]||(p[4]=C=>ug(C.target.value))},[...p[35]||(p[35]=[m("option",{value:"codex"},"Codex",-1),m("option",{value:"openrouter"},"OpenRouter",-1),m("option",{value:"opencode-zen"},"OpenCode Zen",-1),m("option",{value:"custom"},"Custom endpoint",-1)])],40,ZP)],8,JP),Se.value?(k(),E("div",eR,R(Se.value),1)):J("",!0),ln.value==="openrouter"?(k(),E("div",tR,[m("div",nR,[m("span",rR,R(S(o)("OpenRouter API key")),1),m("a",oR,R(S(o)("Get API key")),1)]),m("div",aR,[us.value&&!rr.value?(k(),E(Qe,{key:0},[m("span",sR,R(cs.value),1),m("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Ie.value,title:S(o)("Remove custom key, use community keys"),onClick:cg},"✕",8,iR)],64)):(k(),E(Qe,{key:1},[jt(m("input",{"onUpdate:modelValue":p[5]||(p[5]=C=>rr.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:nn($d,["enter"])},null,40,lR),[[tn,rr.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:Ie.value||!rr.value.trim(),onClick:$d},R(Ie.value?"...":S(o)("Set")),9,uR)],64))]),m("div",cR,[m("span",dR,R(S(o)("API format")),1),m("div",{class:"sidebar-settings-segmented",role:"group","aria-label":S(o)("OpenRouter API format")},[m("button",{type:"button",class:rt(["sidebar-settings-segmented-option",{"is-active":At.value==="responses"}]),disabled:Ie.value||Gn.value,onClick:p[6]||(p[6]=C=>Rd("responses"))}," Responses ",10,hR),m("button",{type:"button",class:rt(["sidebar-settings-segmented-option",{"is-active":At.value==="chat"}]),disabled:Ie.value||Gn.value,onClick:p[7]||(p[7]=C=>Rd("chat"))}," Completions ",10,pR)],8,fR)])])):J("",!0),ln.value==="opencode-zen"?(k(),E("div",mR,[m("div",vR,[m("span",gR,R(S(o)("OpenCode Zen API key")),1),m("a",yR,R(S(o)("Get API key")),1)]),m("div",wR,[jt(m("input",{"onUpdate:modelValue":p[8]||(p[8]=C=>Jo.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("sk-..."),onKeydown:nn(Md,["enter"])},null,40,bR),[[tn,Jo.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:Ie.value||!Jo.value.trim(),onClick:Md},R(Ie.value?"...":S(o)("Save")),9,_R)])])):J("",!0),ln.value==="custom"?(k(),E("div",TR,[m("span",kR,R(S(o)("Custom endpoint URL")),1),m("div",CR,[jt(m("input",{"onUpdate:modelValue":p[9]||(p[9]=C=>Dr.value=C),class:"sidebar-settings-key-input",type:"url",placeholder:S(o)("https://api.example.com/v1"),onKeydown:nn(ku,["enter"])},null,40,SR),[[tn,Dr.value]])]),m("span",xR,R(S(o)("API key")),1),m("div",AR,[jt(m("input",{"onUpdate:modelValue":p[10]||(p[10]=C=>Qo.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("Bearer token (optional)"),onKeydown:nn(ku,["enter"])},null,40,ER),[[tn,Qo.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:Ie.value||!Dr.value.trim(),onClick:ku},R(Ie.value?"...":S(o)("Save")),9,IR)]),m("div",PR,[m("span",RR,R(S(o)("API format")),1),m("div",{class:"sidebar-settings-segmented",role:"group","aria-label":S(o)("Custom endpoint API format")},[m("button",{type:"button",class:rt(["sidebar-settings-segmented-option",{"is-active":Ar.value==="responses"}]),onClick:p[11]||(p[11]=C=>Ar.value="responses")}," Responses ",2),m("button",{type:"button",class:rt(["sidebar-settings-segmented-option",{"is-active":Ar.value==="chat"}]),onClick:p[12]||(p[12]=C=>Ar.value="chat")}," Completions ",2)],8,MR)])])):J("",!0),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g.dictationLanguage},[m("span",NR,R(S(o)("Dictation language")),1),Be(xs,{class:"sidebar-settings-language-dropdown","model-value":qt.value,options:En.value,placeholder:S(o)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":S(o)("Search language..."),"onUpdate:modelValue":dg},null,8,["model-value","options","placeholder","search-placeholder"])],8,$R),m("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:p[13]||(p[13]=C=>Da.value=!Da.value)},[m("span",LR,R(S(o)("Telegram")),1),m("span",jR,R(hu.value),1)]),Da.value?(k(),E("div",OR,[m("label",DR,[m("span",FR,R(S(o)("Bot token")),1),jt(m("input",{"onUpdate:modelValue":p[14]||(p[14]=C=>ro.value=C),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[tn,ro.value]])]),m("label",UR,[m("span",BR,R(S(o)("Allowed Telegram user IDs")),1),jt(m("textarea",{"onUpdate:modelValue":p[15]||(p[15]=C=>oo.value=C),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
|
|
63
|
+
987654321`,spellcheck:"false"},null,512),[[tn,oo.value]])]),m("div",qR,R(S(o)("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),Fr.value?(k(),E("div",HR,R(Fr.value),1)):J("",!0),m("div",WR,[m("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:ao.value,onClick:H},R(ao.value?S(o)("Saving…"):S(o)("Save Telegram config")),9,VR)])])):J("",!0),jo.value?(k(),E("div",{key:5,class:"sidebar-settings-row sidebar-settings-context-row","data-state":Di.value,title:Fi.value},[m("span",GR,R(S(o)("Context")),1),m("span",{class:"sidebar-settings-context-value","data-state":Di.value},[ls(R(ou.value)+" ",1),m("span",YR,R(au.value),1)],8,KR)],8,zR)):J("",!0),m("div",QR,[Be(QA,{snapshots:S(Re)},null,8,["snapshots"])]),m("div",{class:"sidebar-settings-build-label","aria-label":S(o)("Worktree name and version")}," WT "+R(S(h))+" · v"+R(S(f)),9,JR)],512)):J("",!0)]),_:1}),m("button",{ref_key:"settingsButtonRef",ref:eo,class:"sidebar-settings-button",type:"button",onClick:p[17]||(p[17]=Ze(C=>Hn.value=!Hn.value,["stop"]))},[Be(QE,{class:"sidebar-settings-icon"}),m("span",null,R(S(o)("Settings")),1),m("span",XR,R(S(h))+" · v"+R(S(f)),1)],512)],512))])]),content:mt(()=>[m("section",{class:rt(["content-root",{"is-virtual-keyboard-open":zr.value,"is-terminal-open":Zt.value}]),style:ca(fu.value)},[dn.value?(k(),E("span",ZR)):J("",!0),Be(LC,{title:_a.value,accent:ar.value},{leading:mt(()=>[$t.value||S(Dt)?(k(),at(Ch,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":$t.value,"show-new-thread-button":!0,onToggleSidebar:p[18]||(p[18]=C=>Gr(!$t.value)),onStartNewThread:mu},null,8,["is-sidebar-collapsed"])):J("",!0),ar.value?(k(),E("span",eM,[Be(Sl)])):J("",!0)]),actions:mt(()=>[Xt.value?(k(),at(xs,{key:0,class:rt(["content-header-terminal-command",{"is-open":Zt.value}]),"model-value":mn.value,options:du.value,placeholder:cu.value,"selected-prefix-icon":eI,"icon-only":!0,"empty-label":S(o)("No commands"),"onUpdate:modelValue":mv},null,8,["class","model-value","options","placeholder","empty-label"])):J("",!0),Vr.value?(k(),at(xE,{key:1,class:"content-header-branch-dropdown","current-branch":Wn.value,"head-sha":an.value,"head-subject":ct.value,"head-date":Nn.value,detached:Ln.value,dirty:jr.value,branches:Ro.value,"commits-by-branch":Qt.value,"commits-loading-for":Vn.value,"commits-error":mr.value,loading:no.value,busy:Bt.value,error:Nt.value,"review-open":pr.value,"show-review":S(ot).name==="thread"&&S(pe).length>0,onToggleReview:p[19]||(p[19]=C=>pr.value=!pr.value),onCheckoutBranch:Rv,onResetBranchToCommit:Mv,onLoadCommits:$v},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","branches","commits-by-branch","commits-loading-for","commits-error","loading","busy","error","review-open","show-review"])):J("",!0)]),_:1},8,["title","accent"]),m("section",tM,[ar.value?(k(),at(S(a),{key:0,cwd:Lo.value,"thread-id":fo.value,"try-in-flight-key":Po.value,onSkillsChanged:d,onTryItem:Cg},null,8,["cwd","thread-id","try-in-flight-key"])):Ht.value?(k(),E("div",nM,[m("div",rM,[m("p",oM,R(S(o)("Let's build")),1),Be(xs,{class:"new-thread-folder-dropdown","model-value":gt.value,options:Wa.value,placeholder:S(o)("Choose folder"),"enable-search":!0,"search-placeholder":S(o)("Quick search project"),disabled:!1,"onUpdate:modelValue":Ev},null,8,["model-value","options","placeholder","search-placeholder"]),gt.value?(k(),E("p",{key:0,class:"new-thread-folder-selected",title:gt.value},R(S(o)("Selected folder"))+": "+R(gt.value),9,aM)):J("",!0),m("div",sM,[m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Ov},R(S(o)("Select folder")),1),m("button",{class:"new-thread-folder-action",type:"button",onClick:Nv},R(S(o)("Create Project")),1)]),zt.value?(k(),E("section",iM,[m("div",lM,[m("div",uM,[m("span",cM,[Be(Sl)]),m("p",dM,R(S(o)("New in Codex")),1)]),m("h2",fM,R(S(o)("Plugins are here")),1),m("p",hM,R(S(o)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[36]||(p[36]=m("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[m("span",{class:"new-thread-launch-card-pill"},"Gmail"),m("span",{class:"new-thread-launch-card-pill"},"Calendar"),m("span",{class:"new-thread-launch-card-pill"},"GitHub"),m("span",{class:"new-thread-launch-card-pill"},"Slack"),m("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),m("div",pM,[m("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:ru},R(S(o)("Explore Plugins & Apps")),1),m("button",{class:"new-thread-launch-card-button",type:"button",onClick:Ys},R(S(o)("Dismiss")),1)])])):J("",!0),(k(),at(Ma,{to:"body"},[Ir.value?(k(),E("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Ze(ps,["self"])},[m("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":S(o)("Select folder"),onKeydown:nn(Ze(ps,["prevent"]),["esc"])},[m("div",vM,[m("p",gM,R(S(o)("Select folder")),1),m("button",{class:"new-thread-open-folder-close",type:"button",onClick:ps},R(S(o)("Cancel")),1)]),m("p",yM,R(S(o)("Current folder")),1),m("div",wM,[jt(m("input",{ref_key:"existingFolderPathInputRef",ref:Zo,"onUpdate:modelValue":p[20]||(p[20]=C=>lo.value=C),class:"new-thread-open-folder-path",type:"text",placeholder:S(o)("Current folder"),title:lo.value||S(o)("Unavailable"),disabled:jn.value||gr.value,onBlur:Bv,onKeydown:[nn(Ze(qv,["prevent"]),["enter"]),nn(Ze(ps,["prevent"]),["esc"])]},null,40,bM),[[tn,lo.value]]),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!za.value||jn.value||gr.value,onClick:p[21]||(p[21]=C=>wu())},R(gr.value?S(o)("Opening…"):S(o)("Open")),9,_M)]),m("div",TM,[m("label",kM,[jt(m("input",{"onUpdate:modelValue":p[22]||(p[22]=C=>wa.value=C),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Fv},null,544),[[Kw,wa.value]]),m("span",null,R(S(o)("Show hidden folders")),1)]),m("button",{class:rt(["new-thread-folder-action",{"new-thread-folder-action-primary":Ur.value}]),type:"button","aria-pressed":Ur.value,disabled:!Yn.value||jn.value||gr.value||io.value||!!wn.value&&!Ur.value,onClick:Hv},R(S(o)("New folder")),11,CM)]),Ur.value?(k(),E("div",SM,[m("div",xM,[jt(m("input",{ref_key:"createFolderInputRef",ref:Sr,"onUpdate:modelValue":p[23]||(p[23]=C=>so.value=C),class:"new-thread-open-folder-create-input",type:"text",placeholder:S(o)("Folder name"),onKeydown:[nn(Ze(Cd,["prevent"]),["enter"]),nn(Ze(ai,["prevent"]),["esc"])]},null,40,AM),[[tn,so.value]]),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!iu.value||io.value,onClick:Cd},R(ei.value),9,EM)]),Kn.value?(k(),E("p",IM,R(Kn.value),1)):J("",!0)])):J("",!0),jt(m("input",{ref_key:"existingFolderFilterInputRef",ref:ds,"onUpdate:modelValue":p[24]||(p[24]=C=>yr.value=C),class:"new-thread-open-folder-filter",type:"text",placeholder:S(o)("Filter folders..."),onKeydown:nn(Ze(ps,["prevent"]),["esc"])},null,40,PM),[[tn,yr.value]]),wn.value?(k(),E("div",RM,[m("p",MM,R(wn.value),1),m("button",{class:"new-thread-folder-action",type:"button",disabled:jn.value||gr.value,onClick:Uv},R(S(o)("Retry")),9,$M)])):J("",!0),jn.value?(k(),E("p",NM,R(S(o)("Loading folders…")),1)):!wn.value&&fs.value.length===0?(k(),E("p",LM,R(yr.value.trim()?S(o)("No folders match this filter."):S(o)("No subfolders found here.")),1)):fs.value.length>0?(k(),E("ul",jM,[(k(!0),E(Qe,null,Ot(fs.value,C=>(k(),E("li",{key:C.key,class:"new-thread-open-folder-item"},[m("button",{class:"new-thread-open-folder-item-main",type:"button",title:C.path,disabled:jn.value||gr.value,onClick:z=>Dv(C.path)},[m("span",DM,R(C.name),1)],8,OM),C.kind==="directory"?(k(),E("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:jn.value||gr.value,onClick:z=>wu(C.path)},R(S(o)("Open")),9,FM)):J("",!0)]))),128))])):J("",!0)],40,mM)])):J("",!0)])),(k(),at(Ma,{to:"body"},[Mo.value?(k(),E("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Ze(nl,["self"])},[m("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":S(o)("Create or clone project"),onKeydown:nn(Ze(nl,["prevent"]),["esc"])},[m("div",BM,[m("p",qM,R(S(o)("Create or clone project")),1),m("button",{class:"new-thread-open-folder-close",type:"button",disabled:Pn.value,onClick:nl},R(S(o)("Cancel")),9,HM)]),m("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":S(o)("Project source")},[m("button",{class:rt(["new-thread-project-mode-tab",{"is-active":In.value==="create"}]),type:"button",role:"tab","aria-selected":In.value==="create",disabled:Pn.value,onClick:p[25]||(p[25]=C=>In.value="create")},R(S(o)("New project")),11,VM),m("button",{class:rt(["new-thread-project-mode-tab",{"is-active":In.value==="clone"}]),type:"button",role:"tab","aria-selected":In.value==="clone",disabled:Pn.value,onClick:p[26]||(p[26]=C=>In.value="clone")},R(S(o)("Clone from GitHub")),11,zM)],8,WM),m("label",GM,[m("span",KM,R(S(o)("Destination folder")),1),jt(m("input",{"onUpdate:modelValue":p[27]||(p[27]=C=>Er.value=C),class:"new-thread-open-folder-path",type:"text",disabled:Pn.value,placeholder:S(o)("Destination folder")},null,8,YM),[[tn,Er.value]])]),In.value==="create"?(k(),E("label",QM,[m("span",JM,R(S(o)("Project name")),1),jt(m("input",{ref_key:"projectSetupPrimaryInputRef",ref:ya,"onUpdate:modelValue":p[28]||(p[28]=C=>Br.value=C),class:"new-thread-open-folder-create-input",type:"text",disabled:Pn.value,placeholder:S(o)("Project name"),onKeydown:nn(Ze(yu,["prevent"]),["enter"])},null,40,XM),[[tn,Br.value]])])):(k(),E("label",ZM,[m("span",e$,R(S(o)("GitHub repository URL")),1),jt(m("input",{ref_key:"projectSetupPrimaryInputRef",ref:ya,"onUpdate:modelValue":p[29]||(p[29]=C=>Xo.value=C),class:"new-thread-open-folder-create-input",type:"url",disabled:Pn.value,placeholder:"https://github.com/owner/repo",onKeydown:nn(Ze(yu,["prevent"]),["enter"])},null,40,t$),[[tn,Xo.value]])])),qr.value?(k(),E("p",n$,R(qr.value),1)):J("",!0),m("div",r$,[m("button",{class:"new-thread-folder-action",type:"button",disabled:Pn.value,onClick:nl},R(S(o)("Cancel")),9,o$),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Wi.value||Pn.value,onClick:yu},R(po.value),9,a$)])],40,UM)])):J("",!0)])),ho.value?(k(),at(RE,{key:2,class:"new-thread-runtime-dropdown",modelValue:Un.value,"onUpdate:modelValue":p[30]||(p[30]=C=>Un.value=C)},null,8,["modelValue"])):J("",!0),Un.value==="worktree"?(k(),E("div",s$,[m("p",i$,R(S(o)("Base branch")),1),Be(xs,{class:"new-thread-branch-dropdown","model-value":Ft.value,options:Zs.value,placeholder:S(o)("Select branch"),"enable-search":!0,"search-placeholder":S(o)("Search branches..."),disabled:Rn.value||Zs.value.length===0,"onUpdate:modelValue":Iv},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),m("p",l$,R(Rn.value?S(o)("Loading branches…"):Bi.value?S(o)("New worktree branch will start from {branch}.",{branch:Bi.value}):S(o)("No Git branches found for this folder.")),1)])):J("",!0),ho.value?(k(),E("p",u$,R(S(o)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):J("",!0),Ut.value.phase!=="idle"?(k(),E("div",{key:5,class:rt(["worktree-init-status",{"is-running":Ut.value.phase==="running","is-error":Ut.value.phase==="error"}])},[m("strong",c$,R(Ut.value.title),1),m("span",d$,R(Ut.value.message),1)],2)):J("",!0)]),m("div",f$,[gn.value&&De.value?(k(),at(S(n),{key:0,ref_key:"homeTerminalPanelRef",ref:zo,class:"content-thread-terminal-panel","thread-id":w.value,cwd:De.value,onHide:Tv,onTerminalFocusChange:gd},null,8,["thread-id","cwd"])):J("",!0),Be(kh,{ref_key:"homeThreadComposerRef",ref:Tr,"active-thread-id":w.value,cwd:De.value,"collaboration-modes":S(Te),"selected-collaboration-mode":S(K),models:S(Pe),"selected-model":L.value,"selected-reasoning-effort":S(ge),"selected-speed-mode":S(ke),"is-updating-speed-mode":S(it),skills:S(oe),"thread-token-usage":S(U),"codex-quota":S(be),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":xr.value,"in-progress-submit-mode":P.value,"dictation-click-to-toggle":Ae.value,"dictation-auto-send":wt.value,"dictation-language":qt.value,onSubmit:Td,"onUpdate:selectedCollaborationMode":Nd,"onUpdate:selectedModel":Ed,"onUpdate:selectedReasoningEffort":Id,"onUpdate:selectedSpeedMode":Pd},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"])])])):(k(),E("div",h$,[pr.value&&S(pe)&&De.value?(k(),at(S(r),{key:0,"thread-id":S(pe),cwd:De.value,"is-thread-in-progress":Pr.value,onClose:p[31]||(p[31]=C=>pr.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress"])):(k(),E(Qe,{key:1},[m("div",p$,[Be(S(t),{ref_key:"threadConversationRef",ref:Xr,messages:y.value,"is-loading":S(Le),"active-thread-id":w.value,cwd:De.value,"live-overlay":b.value,"pending-requests":S(G),"has-more-persisted-above":S(He),"is-loading-persisted-above":S(et),"load-earlier-messages":S(Ee),onForkThread:pv,onRollback:Kv,onImplementPlan:Yv,onRespondServerRequest:dd},null,8,["messages","is-loading","active-thread-id","cwd","live-overlay","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),m("div",m$,[Be(BA,{messages:S(he),onEdit:Av,onSteer:S(de),onDelete:S(ue),onReorder:zv},null,8,["messages","onSteer","onDelete"]),S(O)&&S(pe)&&De.value?(k(),at(S(n),{key:0,ref_key:"threadTerminalPanelRef",ref:pn,class:"content-thread-terminal-panel","thread-id":S(pe),cwd:De.value,onHide:kv,onTerminalFocusChange:gd},null,8,["thread-id","cwd"])):J("",!0),_e.value?(k(),at(PA,{key:1,request:_e.value,"request-count":S(G).length,"has-queue-above":S(he).length>0,onRespondServerRequest:dd},null,8,["request","request-count","has-queue-above"])):(k(),at(kh,{key:2,ref_key:"threadComposerRef",ref:cn,"active-thread-id":w.value,cwd:De.value,"collaboration-modes":S(Te),"selected-collaboration-mode":S(K),models:S(Pe),"selected-model":L.value,"selected-reasoning-effort":S(ge),"selected-speed-mode":S(ke),"is-updating-speed-mode":S(it),skills:S(oe),"thread-token-usage":S(U),"codex-quota":S(be),"is-turn-in-progress":Pr.value,"is-stop-pending":S(Ke),"is-interrupting-turn":S(Je),"has-queue-above":S(he).length>0,"send-with-enter":xr.value,"in-progress-submit-mode":P.value,"dictation-click-to-toggle":Ae.value,"dictation-auto-send":wt.value,"dictation-language":qt.value,"onUpdate:selectedCollaborationMode":Nd,onSubmit:Td,"onUpdate:selectedModel":Ed,"onUpdate:selectedReasoningEffort":Id,"onUpdate:selectedSpeedMode":Pd,onInterrupt:Gv},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"]),Or.value?(k(),E("div",{key:0,class:"codex-login-modal-backdrop",role:"presentation",onClick:pu},[m("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":S(o)("Complete Codex login"),onSubmit:Ze(Qm,["prevent"]),onClick:p[34]||(p[34]=Ze(()=>{},["stop"]))},[m("div",g$,[m("h2",y$,R(S(o)("Complete Codex login")),1),m("button",{class:"codex-login-modal-close",type:"button","aria-label":S(o)("Close"),disabled:sn.value,onClick:pu}," × ",8,w$)]),m("p",b$,R(S(o)("Finish login in the browser, then paste the localhost callback URL here.")),1),vr.value?(k(),E("a",{key:0,class:"codex-login-modal-link",href:vr.value,target:"_blank",rel:"noreferrer"},R(S(o)("Open login URL")),9,_$)):J("",!0),jt(m("input",{ref_key:"codexLoginCallbackInputRef",ref:Yo,"onUpdate:modelValue":p[33]||(p[33]=C=>zn.value=C),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:S(o)("Paste localhost callback URL"),disabled:sn.value},null,8,T$),[[tn,zn.value]]),Vt.value?(k(),E("p",k$,R(Vt.value),1)):J("",!0),m("div",C$,[m("button",{class:"codex-login-modal-cancel",type:"button",disabled:sn.value,onClick:pu},R(S(o)("Cancel")),9,S$),m("button",{class:"codex-login-modal-submit",type:"submit",disabled:sn.value||zn.value.trim().length===0},R(sn.value?S(o)("Completing…"):S(o)("Complete")),9,x$)])],40,v$)])):J("",!0)],64))}}),I$=xt(E$,[["__scopeId","data-v-3bdfded6"]]),rc={render:()=>null},P$=d0({history:Hb(),routes:[{path:"/",name:"home",component:rc},{path:"/thread/:threadId",name:"thread",component:rc},{path:"/skills",name:"skills",component:rc},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. github: https://github.com/friuns2/codexUI");eb(I$).use(P$).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Om("Service worker registration failed."),e)})});export{R$ as $,at as A,Kc as B,y_ as C,j$ as D,L$ as E,Qe as F,O$ as G,__ as H,Bs as I,Oa as J,D$ as K,jt as L,Af as M,tN as N,rN as O,oN as P,$$ as Q,nN as R,ld as S,im as T,Ma as U,tn as V,fi as W,Ho as X,h0 as Y,f0 as Z,xt as _,m as a,N$ as a0,F$ as a1,W$ as a2,Y$ as a3,Q$ as a4,U$ as a5,K$ as a6,J$ as a7,Z$ as a8,eN as a9,B$ as aa,q$ as ab,H$ as ac,V$ as ad,G$ as ae,z$ as af,X$ as ag,va as b,E as c,Fn as d,ja as e,J as f,rt as g,M$ as h,Be as i,Ss as j,BC as k,oI as l,Ze as m,Kt as n,k as o,ca as p,S as q,Ot as r,ls as s,R as t,rd as u,mt as v,pt as w,x,Z as y,cl as z};
|