codexui-android 0.1.98 → 0.1.100
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-47WzZs4I.js +2 -0
- package/dist/assets/DirectoryHub-DkF7hkxl.css +1 -0
- package/dist/assets/{ReviewPane-BwO2MHvI.js → ReviewPane-W_UvYmui.js} +1 -1
- package/dist/assets/ThreadConversation-CSH0aUWx.js +39 -0
- package/dist/assets/ThreadConversation-DdzQ_R3z.css +1 -0
- package/dist/assets/{ThreadTerminalPanel-pVx2Zv0U.css → ThreadTerminalPanel-BfzQNi0v.css} +1 -1
- package/dist/assets/ThreadTerminalPanel-QkJZ7U3Y.js +38 -0
- package/dist/assets/index-B6Gx9sFJ.css +1 -0
- package/dist/assets/index-Cmr8liLe.js +63 -0
- package/dist/assets/{index.esm-DECIu6Fp.js → index.esm-BMAgl1KF.js} +1 -1
- package/dist/assets/{index.esm-DPq88-QA.js → index.esm-O-ekzJz9.js} +1 -16
- package/dist/assets/{index.esm-Bi-9KxvS.js → index.esm-TywpZG2x.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-cli/index.js +921 -348
- package/dist-cli/index.js.map +1 -1
- package/package.json +2 -1
- package/scripts/dev.cjs +11 -7
- package/dist/assets/DirectoryHub-CAcNjRYF.css +0 -1
- package/dist/assets/DirectoryHub-D6h4lJqw.js +0 -2
- package/dist/assets/ThreadConversation-CsHUh1AP.js +0 -39
- package/dist/assets/ThreadConversation-J3tJ8-9X.css +0 -1
- package/dist/assets/ThreadTerminalPanel-BTHfTRnz.js +0 -38
- package/dist/assets/index-23FodFfK.js +0 -64
- package/dist/assets/index-Wz7G59hk.css +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-CsHUh1AP.js","assets/ThreadConversation-J3tJ8-9X.css","assets/ThreadTerminalPanel-BTHfTRnz.js","assets/ThreadTerminalPanel-pVx2Zv0U.css","assets/ReviewPane-BwO2MHvI.js","assets/ReviewPane-BJuXPOZb.css","assets/DirectoryHub-D6h4lJqw.js","assets/DirectoryHub-CAcNjRYF.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
|
|
3
|
-
* @vue/shared v3.5.33
|
|
4
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
-
* @license MIT
|
|
6
|
-
**/function Wu(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Rt={},Ns=[],Xr=()=>{},Lf=()=>!1,Bi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),qi=e=>e.startsWith("onUpdate:"),hn=Object.assign,zu=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Em=Object.prototype.hasOwnProperty,xt=(e,t)=>Em.call(e,t),Ge=Array.isArray,Ds=e=>ja(e)==="[object Map]",Gs=e=>ja(e)==="[object Set]",Oc=e=>ja(e)==="[object Date]",nt=e=>typeof e=="function",qt=e=>typeof e=="string",Nr=e=>typeof e=="symbol",At=e=>e!==null&&typeof e=="object",jf=e=>(At(e)||nt(e))&&nt(e.then)&&nt(e.catch),Ff=Object.prototype.toString,ja=e=>Ff.call(e),Im=e=>ja(e).slice(8,-1),Uf=e=>ja(e)==="[object Object]",Gu=e=>qt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ta=Wu(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Hi=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Mm=/-\w/g,Qn=Hi(e=>e.replace(Mm,t=>t.slice(1).toUpperCase())),Pm=/\B([A-Z])/g,Fo=Hi(e=>e.replace(Pm,"-$1").toLowerCase()),Vi=Hi(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ul=Hi(e=>e?`on${Vi(e)}`:""),Pr=(e,t)=>!Object.is(e,t),Ai=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Bf=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Wi=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Rm=e=>{const t=qt(e)?Number(e):NaN;return isNaN(t)?e:t};let Nc;const zi=()=>Nc||(Nc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function po(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=qt(r)?Dm(r):po(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(qt(e)||At(e))return e}const $m=/;(?![^(]*\))/g,Om=/:([^]+)/,Nm=/\/\*[^]*?\*\//g;function Dm(e){const t={};return e.replace(Nm,"").split($m).forEach(n=>{if(n){const r=n.split(Om);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function at(e){let t="";if(qt(e))t=e;else if(Ge(e))for(let n=0;n<e.length;n++){const r=at(e[n]);r&&(t+=r+" ")}else if(At(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Lm="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",jm=Wu(Lm);function qf(e){return!!e||e===""}function Fm(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ks(e[r],t[r]);return n}function Ks(e,t){if(e===t)return!0;let n=Oc(e),r=Oc(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Nr(e),r=Nr(t),n||r)return e===t;if(n=Ge(e),r=Ge(t),n||r)return n&&r?Fm(e,t):!1;if(n=At(e),r=At(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,o=Object.keys(t).length;if(s!==o)return!1;for(const i in e){const l=e.hasOwnProperty(i),c=t.hasOwnProperty(i);if(l&&!c||!l&&c||!Ks(e[i],t[i]))return!1}}return String(e)===String(t)}function Ku(e,t){return e.findIndex(n=>Ks(n,t))}const Hf=e=>!!(e&&e.__v_isRef===!0),D=e=>qt(e)?e:e==null?"":Ge(e)||At(e)&&(e.toString===Ff||!nt(e.toString))?Hf(e)?D(e.value):JSON.stringify(e,Vf,2):String(e),Vf=(e,t)=>Hf(t)?Vf(e,t.value):Ds(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[Bl(r,o)+" =>"]=s,n),{})}:Gs(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Bl(n))}:Nr(t)?Bl(t):At(t)&&!Ge(t)&&!Uf(t)?String(t):t,Bl=(e,t="")=>{var n;return Nr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
7
|
-
* @vue/reactivity v3.5.33
|
|
8
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
-
* @license MIT
|
|
10
|
-
**/let Pn;class Um{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=Pn,!t&&Pn&&(this.index=(Pn.scopes||(Pn.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=Pn;try{return Pn=this,t()}finally{Pn=n}}}on(){++this._on===1&&(this.prevScope=Pn,Pn=this)}off(){if(this._on>0&&--this._on===0){if(Pn===this)Pn=this.prevScope;else{let t=Pn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Bm(){return Pn}let Lt;const ql=new WeakSet;class Wf{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,Pn&&Pn.active&&Pn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ql.has(this)&&(ql.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Gf(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Dc(this),Kf(this);const t=Lt,n=$r;Lt=this,$r=!0;try{return this.fn()}finally{Yf(this),Lt=t,$r=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Qu(t);this.deps=this.depsTail=void 0,Dc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ql.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){wu(this)&&this.run()}get dirty(){return wu(this)}}let zf=0,ka,Sa;function Gf(e,t=!1){if(e.flags|=8,t){e.next=Sa,Sa=e;return}e.next=ka,ka=e}function Yu(){zf++}function Ju(){if(--zf>0)return;if(Sa){let t=Sa;for(Sa=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;ka;){let t=ka;for(ka=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 Kf(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Yf(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Qu(r),qm(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function wu(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Jf(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Jf(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ma)||(e.globalVersion=Ma,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!wu(e))))return;e.flags|=2;const t=e.dep,n=Lt,r=$r;Lt=e,$r=!0;try{Kf(e);const s=e.fn(e._value);(t.version===0||Pr(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Lt=n,$r=r,Yf(e),e.flags&=-3}}function Qu(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.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)Qu(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function qm(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let $r=!0;const Qf=[];function go(){Qf.push($r),$r=!1}function vo(){const e=Qf.pop();$r=e===void 0?!0:e}function Dc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Lt;Lt=void 0;try{t()}finally{Lt=n}}}let Ma=0;class Hm{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 Xu{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(!Lt||!$r||Lt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Lt)n=this.activeLink=new Hm(Lt,this),Lt.deps?(n.prevDep=Lt.depsTail,Lt.depsTail.nextDep=n,Lt.depsTail=n):Lt.deps=Lt.depsTail=n,Xf(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=Lt.depsTail,n.nextDep=void 0,Lt.depsTail.nextDep=n,Lt.depsTail=n,Lt.deps===n&&(Lt.deps=r)}return n}trigger(t){this.version++,Ma++,this.notify(t)}notify(t){Yu();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Ju()}}}function Xf(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)Xf(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const bu=new WeakMap,ls=Symbol(""),_u=Symbol(""),Pa=Symbol("");function Rn(e,t,n){if($r&&Lt){let r=bu.get(e);r||bu.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Xu),s.map=r,s.key=n),s.track()}}function fo(e,t,n,r,s,o){const i=bu.get(e);if(!i){Ma++;return}const l=c=>{c&&c.trigger()};if(Yu(),t==="clear")i.forEach(l);else{const c=Ge(e),h=c&&Gu(n);if(c&&n==="length"){const f=Number(r);i.forEach((g,T)=>{(T==="length"||T===Pa||!Nr(T)&&T>=f)&&l(g)})}else switch((n!==void 0||i.has(void 0))&&l(i.get(n)),h&&l(i.get(Pa)),t){case"add":c?h&&l(i.get("length")):(l(i.get(ls)),Ds(e)&&l(i.get(_u)));break;case"delete":c||(l(i.get(ls)),Ds(e)&&l(i.get(_u)));break;case"set":Ds(e)&&l(i.get(ls));break}}Ju()}function Ss(e){const t=bt(e);return t===e?t:(Rn(t,"iterate",Pa),wr(e)?t:t.map(Dr))}function Gi(e){return Rn(e=bt(e),"iterate",Pa),e}function Yr(e,t){return yo(e)?Us(us(e)?Dr(t):t):Dr(t)}const Vm={__proto__:null,[Symbol.iterator](){return Hl(this,Symbol.iterator,e=>Yr(this,e))},concat(...e){return Ss(this).concat(...e.map(t=>Ge(t)?Ss(t):t))},entries(){return Hl(this,"entries",e=>(e[1]=Yr(this,e[1]),e))},every(e,t){return ao(this,"every",e,t,void 0,arguments)},filter(e,t){return ao(this,"filter",e,t,n=>n.map(r=>Yr(this,r)),arguments)},find(e,t){return ao(this,"find",e,t,n=>Yr(this,n),arguments)},findIndex(e,t){return ao(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ao(this,"findLast",e,t,n=>Yr(this,n),arguments)},findLastIndex(e,t){return ao(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ao(this,"forEach",e,t,void 0,arguments)},includes(...e){return Vl(this,"includes",e)},indexOf(...e){return Vl(this,"indexOf",e)},join(e){return Ss(this).join(e)},lastIndexOf(...e){return Vl(this,"lastIndexOf",e)},map(e,t){return ao(this,"map",e,t,void 0,arguments)},pop(){return ha(this,"pop")},push(...e){return ha(this,"push",e)},reduce(e,...t){return Lc(this,"reduce",e,t)},reduceRight(e,...t){return Lc(this,"reduceRight",e,t)},shift(){return ha(this,"shift")},some(e,t){return ao(this,"some",e,t,void 0,arguments)},splice(...e){return ha(this,"splice",e)},toReversed(){return Ss(this).toReversed()},toSorted(e){return Ss(this).toSorted(e)},toSpliced(...e){return Ss(this).toSpliced(...e)},unshift(...e){return ha(this,"unshift",e)},values(){return Hl(this,"values",e=>Yr(this,e))}};function Hl(e,t,n){const r=Gi(e),s=r[t]();return r!==e&&!wr(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const Wm=Array.prototype;function ao(e,t,n,r,s,o){const i=Gi(e),l=i!==e&&!wr(e),c=i[t];if(c!==Wm[t]){const g=c.apply(e,o);return l?Dr(g):g}let h=n;i!==e&&(l?h=function(g,T){return n.call(this,Yr(e,g),T,e)}:n.length>2&&(h=function(g,T){return n.call(this,g,T,e)}));const f=c.call(i,h,r);return l&&s?s(f):f}function Lc(e,t,n,r){const s=Gi(e),o=s!==e&&!wr(e);let i=n,l=!1;s!==e&&(o?(l=r.length===0,i=function(h,f,g){return l&&(l=!1,h=Yr(e,h)),n.call(this,h,Yr(e,f),g,e)}):n.length>3&&(i=function(h,f,g){return n.call(this,h,f,g,e)}));const c=s[t](i,...r);return l?Yr(e,c):c}function Vl(e,t,n){const r=bt(e);Rn(r,"iterate",Pa);const s=r[t](...n);return(s===-1||s===!1)&&tc(n[0])?(n[0]=bt(n[0]),r[t](...n)):s}function ha(e,t,n=[]){go(),Yu();const r=bt(e)[t].apply(e,n);return Ju(),vo(),r}const zm=Wu("__proto__,__v_isRef,__isVue"),Zf=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Nr));function Gm(e){Nr(e)||(e=String(e));const t=bt(this);return Rn(t,"has",e),t.hasOwnProperty(e)}class eh{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?rg:oh:o?rh:nh).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ge(t);if(!s){let c;if(i&&(c=Vm[n]))return c;if(n==="hasOwnProperty")return Gm}const l=Reflect.get(t,n,On(t)?t:r);if((Nr(n)?Zf.has(n):zm(n))||(s||Rn(t,"get",n),o))return l;if(On(l)){const c=i&&Gu(n)?l:l.value;return s&&At(c)?ku(c):c}return At(l)?s?ku(l):Ki(l):l}}class th extends eh{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ge(t)&&Gu(n);if(!this._isShallow){const h=yo(o);if(!wr(r)&&!yo(r)&&(o=bt(o),r=bt(r)),!i&&On(o)&&!On(r))return h||(o.value=r),!0}const l=i?Number(n)<t.length:xt(t,n),c=Reflect.set(t,n,r,On(t)?t:s);return t===bt(s)&&(l?Pr(r,o)&&fo(t,"set",n,r):fo(t,"add",n,r)),c}deleteProperty(t,n){const r=xt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&fo(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!Nr(n)||!Zf.has(n))&&Rn(t,"has",n),r}ownKeys(t){return Rn(t,"iterate",Ge(t)?"length":ls),Reflect.ownKeys(t)}}class Km extends eh{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Ym=new th,Jm=new Km,Qm=new th(!0);const Tu=e=>e,hi=e=>Reflect.getPrototypeOf(e);function Xm(e,t,n){return function(...r){const s=this.__v_raw,o=bt(s),i=Ds(o),l=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,h=s[e](...r),f=n?Tu:t?Us:Dr;return!t&&Rn(o,"iterate",c?_u:ls),hn(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 pi(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Zm(e,t){const n={get(s){const o=this.__v_raw,i=bt(o),l=bt(s);e||(Pr(s,l)&&Rn(i,"get",s),Rn(i,"get",l));const{has:c}=hi(i),h=t?Tu:e?Us:Dr;if(c.call(i,s))return h(o.get(s));if(c.call(i,l))return h(o.get(l));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&Rn(bt(s),"iterate",ls),s.size},has(s){const o=this.__v_raw,i=bt(o),l=bt(s);return e||(Pr(s,l)&&Rn(i,"has",s),Rn(i,"has",l)),s===l?o.has(s):o.has(s)||o.has(l)},forEach(s,o){const i=this,l=i.__v_raw,c=bt(l),h=t?Tu:e?Us:Dr;return!e&&Rn(c,"iterate",ls),l.forEach((f,g)=>s.call(o,h(f),h(g),i))}};return hn(n,e?{add:pi("add"),set:pi("set"),delete:pi("delete"),clear:pi("clear")}:{add(s){const o=bt(this),i=hi(o),l=bt(s),c=!t&&!wr(s)&&!yo(s)?l:s;return i.has.call(o,c)||Pr(s,c)&&i.has.call(o,s)||Pr(l,c)&&i.has.call(o,l)||(o.add(c),fo(o,"add",c,c)),this},set(s,o){!t&&!wr(o)&&!yo(o)&&(o=bt(o));const i=bt(this),{has:l,get:c}=hi(i);let h=l.call(i,s);h||(s=bt(s),h=l.call(i,s));const f=c.call(i,s);return i.set(s,o),h?Pr(o,f)&&fo(i,"set",s,o):fo(i,"add",s,o),this},delete(s){const o=bt(this),{has:i,get:l}=hi(o);let c=i.call(o,s);c||(s=bt(s),c=i.call(o,s)),l&&l.call(o,s);const h=o.delete(s);return c&&fo(o,"delete",s,void 0),h},clear(){const s=bt(this),o=s.size!==0,i=s.clear();return o&&fo(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Xm(s,e,t)}),n}function Zu(e,t){const n=Zm(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(xt(n,s)&&s in r?n:r,s,o)}const eg={get:Zu(!1,!1)},tg={get:Zu(!1,!0)},ng={get:Zu(!0,!1)};const nh=new WeakMap,rh=new WeakMap,oh=new WeakMap,rg=new WeakMap;function og(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function sg(e){return e.__v_skip||!Object.isExtensible(e)?0:og(Im(e))}function Ki(e){return yo(e)?e:ec(e,!1,Ym,eg,nh)}function sh(e){return ec(e,!1,Qm,tg,rh)}function ku(e){return ec(e,!0,Jm,ng,oh)}function ec(e,t,n,r,s){if(!At(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=sg(e);if(o===0)return e;const i=s.get(e);if(i)return i;const l=new Proxy(e,o===2?r:n);return s.set(e,l),l}function us(e){return yo(e)?us(e.__v_raw):!!(e&&e.__v_isReactive)}function yo(e){return!!(e&&e.__v_isReadonly)}function wr(e){return!!(e&&e.__v_isShallow)}function tc(e){return e?!!e.__v_raw:!1}function bt(e){const t=e&&e.__v_raw;return t?bt(t):e}function ag(e){return!xt(e,"__v_skip")&&Object.isExtensible(e)&&Bf(e,"__v_skip",!0),e}const Dr=e=>At(e)?Ki(e):e,Us=e=>At(e)?ku(e):e;function On(e){return e?e.__v_isRef===!0:!1}function P(e){return ah(e,!1)}function ig(e){return ah(e,!0)}function ah(e,t){return On(e)?e:new lg(e,t)}class lg{constructor(t,n){this.dep=new Xu,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:bt(t),this._value=n?t:Dr(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||wr(t)||yo(t);t=r?t:bt(t),Pr(t,n)&&(this._rawValue=t,this._value=r?t:Dr(t),this.dep.trigger())}}function S(e){return On(e)?e.value:e}const ug={get:(e,t,n)=>t==="__v_raw"?e:S(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return On(s)&&!On(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function ih(e){return us(e)?e:new Proxy(e,ug)}class cg{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Xu(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ma-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Lt!==this)return Gf(this,!0),!0}get value(){const t=this.dep.track();return Jf(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function dg(e,t,n=!1){let r,s;return nt(e)?r=e:(r=e.get,s=e.set),new cg(r,s,n)}const mi={},Pi=new WeakMap;let ns;function fg(e,t=!1,n=ns){if(n){let r=Pi.get(n);r||Pi.set(n,r=[]),r.push(e)}}function hg(e,t,n=Rt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:l,call:c}=n,h=Z=>s?Z:wr(Z)||s===!1||s===0?ho(Z,1):ho(Z);let f,g,T,A,B=!1,q=!1;if(On(e)?(g=()=>e.value,B=wr(e)):us(e)?(g=()=>h(e),B=!0):Ge(e)?(q=!0,B=e.some(Z=>us(Z)||wr(Z)),g=()=>e.map(Z=>{if(On(Z))return Z.value;if(us(Z))return h(Z);if(nt(Z))return c?c(Z,2):Z()})):nt(e)?t?g=c?()=>c(e,2):e:g=()=>{if(T){go();try{T()}finally{vo()}}const Z=ns;ns=f;try{return c?c(e,3,[A]):e(A)}finally{ns=Z}}:g=Xr,t&&s){const Z=g,fe=s===!0?1/0:s;g=()=>ho(Z(),fe)}const Q=Bm(),V=()=>{f.stop(),Q&&Q.active&&zu(Q.effects,f)};if(o&&t){const Z=t;t=(...fe)=>{Z(...fe),V()}}let R=q?new Array(e.length).fill(mi):mi;const W=Z=>{if(!(!(f.flags&1)||!f.dirty&&!Z))if(t){const fe=f.run();if(s||B||(q?fe.some((ye,ee)=>Pr(ye,R[ee])):Pr(fe,R))){T&&T();const ye=ns;ns=f;try{const ee=[fe,R===mi?void 0:q&&R[0]===mi?[]:R,A];R=fe,c?c(t,3,ee):t(...ee)}finally{ns=ye}}}else f.run()};return l&&l(W),f=new Wf(g),f.scheduler=i?()=>i(W,!1):W,A=Z=>fg(Z,!1,f),T=f.onStop=()=>{const Z=Pi.get(f);if(Z){if(c)c(Z,4);else for(const fe of Z)fe();Pi.delete(f)}},t?r?W(!0):R=f.run():i?i(W.bind(null,!0),!0):f.run(),V.pause=f.pause.bind(f),V.resume=f.resume.bind(f),V.stop=V,V}function ho(e,t=1/0,n){if(t<=0||!At(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,On(e))ho(e.value,t,n);else if(Ge(e))for(let r=0;r<e.length;r++)ho(e[r],t,n);else if(Gs(e)||Ds(e))e.forEach(r=>{ho(r,t,n)});else if(Uf(e)){for(const r in e)ho(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ho(e[r],t,n)}return e}/**
|
|
11
|
-
* @vue/runtime-core v3.5.33
|
|
12
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
-
* @license MIT
|
|
14
|
-
**/function Fa(e,t,n,r){try{return r?e(...r):e()}catch(s){Ua(s,t,n)}}function Lr(e,t,n,r){if(nt(e)){const s=Fa(e,t,n,r);return s&&jf(s)&&s.catch(o=>{Ua(o,t,n)}),s}if(Ge(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Lr(e[o],t,n,r));return s}}function Ua(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Rt;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){go(),Fa(o,null,10,[e,c,h]),vo();return}}pg(e,n,s,r,i)}function pg(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const Yn=[];let Gr=-1;const Ls=[];let $o=null,Es=0;const lh=Promise.resolve();let Ri=null;function Xt(e){const t=Ri||lh;return e?t.then(this?e.bind(this):e):t}function mg(e){let t=Gr+1,n=Yn.length;for(;t<n;){const r=t+n>>>1,s=Yn[r],o=Ra(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function nc(e){if(!(e.flags&1)){const t=Ra(e),n=Yn[Yn.length-1];!n||!(e.flags&2)&&t>=Ra(n)?Yn.push(e):Yn.splice(mg(t),0,e),e.flags|=1,uh()}}function uh(){Ri||(Ri=lh.then(dh))}function gg(e){Ge(e)?Ls.push(...e):$o&&e.id===-1?$o.splice(Es+1,0,e):e.flags&1||(Ls.push(e),e.flags|=1),uh()}function jc(e,t,n=Gr+1){for(;n<Yn.length;n++){const r=Yn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Yn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function ch(e){if(Ls.length){const t=[...new Set(Ls)].sort((n,r)=>Ra(n)-Ra(r));if(Ls.length=0,$o){$o.push(...t);return}for($o=t,Es=0;Es<$o.length;Es++){const n=$o[Es];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}$o=null,Es=0}}const Ra=e=>e.id==null?e.flags&2?-1:1/0:e.id;function dh(e){try{for(Gr=0;Gr<Yn.length;Gr++){const t=Yn[Gr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Fa(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Gr<Yn.length;Gr++){const t=Yn[Gr];t&&(t.flags&=-2)}Gr=-1,Yn.length=0,ch(),Ri=null,(Yn.length||Ls.length)&&dh()}}let Sn=null,fh=null;function $i(e){const t=Sn;return Sn=e,fh=e&&e.type.__scopeId||null,t}function St(e,t=Sn,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Di(-1);const o=$i(t);let i;try{i=e(...s)}finally{$i(o),r._d&&Di(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function ln(e,t){if(Sn===null)return e;const n=Zi(Sn),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,l,c=Rt]=t[s];o&&(nt(o)&&(o={mounted:o,updated:o}),o.deep&&ho(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:l,modifiers:c}))}return e}function Qo(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const l=s[i];o&&(l.oldValue=o[i].value);let c=l.dir[r];c&&(go(),Lr(c,n,8,[e.el,l,e,t]),vo())}}function Ei(e,t){if(kn){let n=kn.provides;const r=kn.parent&&kn.parent.provides;r===n&&(n=kn.provides=Object.create(r)),n[e]=t}}function Or(e,t,n=!1){const r=uc();if(r||Fs){let s=Fs?Fs._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&nt(t)?t.call(r&&r.proxy):t}}const vg=Symbol.for("v-scx"),yg=()=>Or(vg);function ut(e,t,n){return hh(e,t,n)}function hh(e,t,n=Rt){const{immediate:r,deep:s,flush:o,once:i}=n,l=hn({},n),c=t&&r||!t&&o!=="post";let h;if(qs){if(o==="sync"){const A=yg();h=A.__watcherHandles||(A.__watcherHandles=[])}else if(!c){const A=()=>{};return A.stop=Xr,A.resume=Xr,A.pause=Xr,A}}const f=kn;l.call=(A,B,q)=>Lr(A,f,B,q);let g=!1;o==="post"?l.scheduler=A=>{Gn(A,f&&f.suspense)}:o!=="sync"&&(g=!0,l.scheduler=(A,B)=>{B?A():nc(A)}),l.augmentJob=A=>{t&&(A.flags|=4),g&&(A.flags|=2,f&&(A.id=f.uid,A.i=f))};const T=hg(e,t,l);return qs&&(h?h.push(T):c&&T()),T}function wg(e,t,n){const r=this.proxy,s=qt(e)?e.includes(".")?ph(r,e):()=>r[e]:e.bind(r,r);let o;nt(t)?o=t:(o=t.handler,n=t);const i=qa(this),l=hh(s,o.bind(r),n);return i(),l}function ph(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const Ro=new WeakMap,mh=Symbol("_vte"),gh=e=>e.__isTeleport,os=e=>e&&(e.disabled||e.disabled===""),bg=e=>e&&(e.defer||e.defer===""),Fc=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Uc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Su=(e,t)=>{const n=e&&e.to;return qt(n)?t?t(n):null:n},_g={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,l,c,h){const{mc:f,pc:g,pbc:T,o:{insert:A,querySelector:B,createText:q,createComment:Q,parentNode:V}}=h,R=os(t.props);let{dynamicChildren:W}=t;const Z=(ee,Ae,ge)=>{ee.shapeFlag&16&&f(ee.children,Ae,ge,s,o,i,l,c)},fe=(ee=t)=>{const Ae=os(ee.props),ge=ee.target=Su(ee.props,B),Ue=Cu(ge,ee,q,A);ge&&(i!=="svg"&&Fc(ge)?i="svg":i!=="mathml"&&Uc(ge)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ge),Ae||(Z(ee,ge,Ue),wa(ee,!1)))},ye=ee=>{const Ae=()=>{if(Ro.get(ee)===Ae){if(Ro.delete(ee),os(ee.props)){const ge=V(ee.el)||n;Z(ee,ge,ee.anchor),wa(ee,!0)}fe(ee)}};Ro.set(ee,Ae),Gn(Ae,o)};if(e==null){const ee=t.el=q(""),Ae=t.anchor=q("");if(A(ee,n,r),A(Ae,n,r),bg(t.props)||o&&o.pendingBranch){ye(t);return}R&&(Z(t,n,Ae),wa(t,!0)),fe()}else{t.el=e.el;const ee=t.anchor=e.anchor,Ae=Ro.get(e);if(Ae){Ae.flags|=8,Ro.delete(e),ye(t);return}t.targetStart=e.targetStart;const ge=t.target=e.target,Ue=t.targetAnchor=e.targetAnchor,Ie=os(e.props),re=Ie?n:ge,de=Ie?ee:Ue;if(i==="svg"||Fc(ge)?i="svg":(i==="mathml"||Uc(ge))&&(i="mathml"),W?(T(e.dynamicChildren,W,re,s,o,i,l),ic(e,t,!0)):c||g(e,t,re,de,s,o,i,l,!1),R)Ie?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):gi(t,n,ee,h,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const De=t.target=Su(t.props,B);De&&gi(t,De,null,h,0)}else Ie&&gi(t,ge,Ue,h,1);wa(t,R)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:l,anchor:c,targetStart:h,targetAnchor:f,target:g,props:T}=e;let A=o||!os(T);const B=Ro.get(e);if(B&&(B.flags|=8,Ro.delete(e),A=!1),g&&(s(h),s(f)),o&&s(c),i&16)for(let q=0;q<l.length;q++){const Q=l[q];r(Q,t,n,A,!!Q.dynamicChildren)}},move:gi,hydrate:Tg};function gi(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:l,shapeFlag:c,children:h,props:f}=e,g=o===2;if(g&&r(i,t,n),!Ro.has(e)&&(!g||os(f))&&c&16)for(let T=0;T<h.length;T++)s(h[T],t,n,2);g&&r(l,t,n)}function Tg(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:l,querySelector:c,insert:h,createText:f}},g){function T(Q,V){let R=V;for(;R;){if(R&&R.nodeType===8){if(R.data==="teleport start anchor")t.targetStart=R;else if(R.data==="teleport anchor"){t.targetAnchor=R,Q._lpa=t.targetAnchor&&i(t.targetAnchor);break}}R=i(R)}}function A(Q,V){V.anchor=g(i(Q),V,l(Q),n,r,s,o)}const B=t.target=Su(t.props,c),q=os(t.props);if(B){const Q=B._lpa||B.firstChild;t.shapeFlag&16&&(q?(A(e,t),T(B,Q),t.targetAnchor||Cu(B,t,f,h,l(e)===B?e:null)):(t.anchor=i(e),T(B,Q),t.targetAnchor||Cu(B,t,f,h),g(Q&&i(Q),t,B,n,r,s,o))),wa(t,q)}else q&&t.shapeFlag&16&&(A(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Rs=_g;function wa(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Cu(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[mh]=i,e&&(r(o,e,s),r(i,e,s)),i}const Kr=Symbol("_leaveCb"),pa=Symbol("_enterCb");function kg(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Uo(()=>{e.isMounted=!0}),ds(()=>{e.isUnmounting=!0}),e}const yr=[Function,Array],vh={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:yr,onEnter:yr,onAfterEnter:yr,onEnterCancelled:yr,onBeforeLeave:yr,onLeave:yr,onAfterLeave:yr,onLeaveCancelled:yr,onBeforeAppear:yr,onAppear:yr,onAfterAppear:yr,onAppearCancelled:yr},yh=e=>{const t=e.subTree;return t.component?yh(t.component):t},Sg={name:"BaseTransition",props:vh,setup(e,{slots:t}){const n=uc(),r=kg();return()=>{const s=t.default&&_h(t.default(),!0),o=s&&s.length?wh(s):n.subTree?ue():void 0;if(!o)return;const i=bt(e),{mode:l}=i;if(r.isLeaving)return Wl(o);const c=Bc(o);if(!c)return Wl(o);let h=xu(c,i,r,n,g=>h=g);c.type!==$n&&$a(c,h);let f=n.subTree&&Bc(n.subTree);if(f&&f.type!==$n&&!ss(f,c)&&yh(n).type!==$n){let g=xu(f,i,r,n);if($a(f,g),l==="out-in"&&c.type!==$n)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,f=void 0},Wl(o);l==="in-out"&&c.type!==$n?g.delayLeave=(T,A,B)=>{const q=bh(r,f);q[String(f.key)]=f,T[Kr]=()=>{A(),T[Kr]=void 0,delete h.delayedLeave,f=void 0},h.delayedLeave=()=>{B(),delete h.delayedLeave,f=void 0}}:f=void 0}else f&&(f=void 0);return o}}};function wh(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==$n){t=n;break}}return t}const Cg=Sg;function bh(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 xu(e,t,n,r,s){const{appear:o,mode:i,persisted:l=!1,onBeforeEnter:c,onEnter:h,onAfterEnter:f,onEnterCancelled:g,onBeforeLeave:T,onLeave:A,onAfterLeave:B,onLeaveCancelled:q,onBeforeAppear:Q,onAppear:V,onAfterAppear:R,onAppearCancelled:W}=t,Z=String(e.key),fe=bh(n,e),ye=(ge,Ue)=>{ge&&Lr(ge,r,9,Ue)},ee=(ge,Ue)=>{const Ie=Ue[1];ye(ge,Ue),Ge(ge)?ge.every(re=>re.length<=1)&&Ie():ge.length<=1&&Ie()},Ae={mode:i,persisted:l,beforeEnter(ge){let Ue=c;if(!n.isMounted)if(o)Ue=Q||c;else return;ge[Kr]&&ge[Kr](!0);const Ie=fe[Z];Ie&&ss(e,Ie)&&Ie.el[Kr]&&Ie.el[Kr](),ye(Ue,[ge])},enter(ge){if(fe[Z]===e)return;let Ue=h,Ie=f,re=g;if(!n.isMounted)if(o)Ue=V||h,Ie=R||f,re=W||g;else return;let de=!1;ge[pa]=qe=>{de||(de=!0,qe?ye(re,[ge]):ye(Ie,[ge]),Ae.delayedLeave&&Ae.delayedLeave(),ge[pa]=void 0)};const De=ge[pa].bind(null,!1);Ue?ee(Ue,[ge,De]):De()},leave(ge,Ue){const Ie=String(e.key);if(ge[pa]&&ge[pa](!0),n.isUnmounting)return Ue();ye(T,[ge]);let re=!1;ge[Kr]=De=>{re||(re=!0,Ue(),De?ye(q,[ge]):ye(B,[ge]),ge[Kr]=void 0,fe[Ie]===e&&delete fe[Ie])};const de=ge[Kr].bind(null,!1);fe[Ie]=e,A?ee(A,[ge,de]):de()},clone(ge){const Ue=xu(ge,t,n,r,s);return s&&s(Ue),Ue}};return Ae}function Wl(e){if(Ba(e))return e=jo(e),e.children=null,e}function Bc(e){if(!Ba(e))return gh(e.type)&&e.children?wh(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&&nt(n.default))return n.default()}}function $a(e,t){e.shapeFlag&6&&e.component?(e.transition=t,$a(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 _h(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const l=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===He?(i.patchFlag&128&&s++,r=r.concat(_h(i.children,t,l))):(t||i.type!==$n)&&r.push(l!=null?jo(i,{key:l}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Cn(e,t){return nt(e)?hn({name:e.name},t,{setup:e}):e}function rc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function qc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Oi=new WeakMap;function Ca(e,t,n,r,s=!1){if(Ge(e)){e.forEach((q,Q)=>Ca(q,t&&(Ge(t)?t[Q]:t),n,r,s));return}if(js(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ca(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Zi(r.component):r.el,i=s?null:o,{i:l,r:c}=e,h=t&&t.r,f=l.refs===Rt?l.refs={}:l.refs,g=l.setupState,T=bt(g),A=g===Rt?Lf:q=>qc(f,q)?!1:xt(T,q),B=(q,Q)=>!(Q&&qc(f,Q));if(h!=null&&h!==c){if(Hc(t),qt(h))f[h]=null,A(h)&&(g[h]=null);else if(On(h)){const q=t;B(h,q.k)&&(h.value=null),q.k&&(f[q.k]=null)}}if(nt(c))Fa(c,l,12,[i,f]);else{const q=qt(c),Q=On(c);if(q||Q){const V=()=>{if(e.f){const R=q?A(c)?g[c]:f[c]:B()||!e.k?c.value:f[e.k];if(s)Ge(R)&&zu(R,o);else if(Ge(R))R.includes(o)||R.push(o);else if(q)f[c]=[o],A(c)&&(g[c]=f[c]);else{const W=[o];B(c,e.k)&&(c.value=W),e.k&&(f[e.k]=W)}}else q?(f[c]=i,A(c)&&(g[c]=i)):Q&&(B(c,e.k)&&(c.value=i),e.k&&(f[e.k]=i))};if(i){const R=()=>{V(),Oi.delete(e)};R.id=-1,Oi.set(e,R),Gn(R,n)}else Hc(e),V()}}}function Hc(e){const t=Oi.get(e);t&&(t.flags|=8,Oi.delete(e))}const Vc=e=>e.nodeType===8;zi().requestIdleCallback;zi().cancelIdleCallback;function xg(e,t){if(Vc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Vc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const js=e=>!!e.type.__asyncLoader;function vi(e){nt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:s=200,hydrate:o,timeout:i,suspensible:l=!0,onError:c}=e;let h=null,f,g=0;const T=()=>(g++,h=null,A()),A=()=>{let B;return h||(B=h=t().catch(q=>{if(q=q instanceof Error?q:new Error(String(q)),c)return new Promise((Q,V)=>{c(q,()=>Q(T()),()=>V(q),g+1)});throw q}).then(q=>B!==h&&h?h:(q&&(q.__esModule||q[Symbol.toStringTag]==="Module")&&(q=q.default),f=q,q)))};return Cn({name:"AsyncComponentWrapper",__asyncLoader:A,__asyncHydrate(B,q,Q){let V=!1;(q.bu||(q.bu=[])).push(()=>V=!0);const R=()=>{V||Q()},W=o?()=>{const Z=o(R,fe=>xg(B,fe));Z&&(q.bum||(q.bum=[])).push(Z)}:R;f?W():A().then(()=>!q.isUnmounted&&W())},get __asyncResolved(){return f},setup(){const B=kn;if(rc(B),f)return()=>yi(f,B);const q=W=>{h=null,Ua(W,B,13,!r)};if(l&&B.suspense||qs)return A().then(W=>()=>yi(W,B)).catch(W=>(q(W),()=>r?Fe(r,{error:W}):null));const Q=P(!1),V=P(),R=P(!!s);return s&&setTimeout(()=>{R.value=!1},s),i!=null&&setTimeout(()=>{if(!Q.value&&!V.value){const W=new Error(`Async component timed out after ${i}ms.`);q(W),V.value=W}},i),A().then(()=>{Q.value=!0,B.parent&&Ba(B.parent.vnode)&&B.parent.update()}).catch(W=>{q(W),V.value=W}),()=>{if(Q.value&&f)return yi(f,B);if(V.value&&r)return Fe(r,{error:V.value});if(n&&!R.value)return yi(n,B)}}})}function yi(e,t){const{ref:n,props:r,children:s,ce:o}=t.vnode,i=Fe(e,r,s);return i.ref=n,i.ce=o,delete t.vnode.ce,i}const Ba=e=>e.type.__isKeepAlive;function Ag(e,t){Th(e,"a",t)}function Eg(e,t){Th(e,"da",t)}function Th(e,t,n=kn){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Yi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Ba(s.parent.vnode)&&Ig(r,t,n,s),s=s.parent}}function Ig(e,t,n,r){const s=Yi(t,e,r,!0);Ji(()=>{zu(r[t],s)},n)}function Yi(e,t,n=kn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{go();const l=qa(n),c=Lr(t,n,e,i);return l(),vo(),c});return r?s.unshift(o):s.push(o),o}}const bo=e=>(t,n=kn)=>{(!qs||e==="sp")&&Yi(e,(...r)=>t(...r),n)},Mg=bo("bm"),Uo=bo("m"),Pg=bo("bu"),Rg=bo("u"),ds=bo("bum"),Ji=bo("um"),$g=bo("sp"),Og=bo("rtg"),Ng=bo("rtc");function Dg(e,t=kn){Yi("ec",e,t)}const Lg="components",kh=Symbol.for("v-ndc");function oc(e){return qt(e)?jg(Lg,e,!1)||e:e||kh}function jg(e,t,n=!0,r=!1){const s=Sn||kn;if(s){const o=s.type;{const l=Tv(o,!1);if(l&&(l===t||l===Qn(t)||l===Vi(Qn(t))))return o}const i=Wc(s[e]||o[e],t)||Wc(s.appContext[e],t);return!i&&r?o:i}}function Wc(e,t){return e&&(e[t]||e[Qn(t)]||e[Vi(Qn(t))])}function jt(e,t,n,r){let s;const o=n,i=Ge(e);if(i||qt(e)){const l=i&&us(e);let c=!1,h=!1;l&&(c=!wr(e),h=yo(e),e=Gi(e)),s=new Array(e.length);for(let f=0,g=e.length;f<g;f++)s[f]=t(c?h?Us(Dr(e[f])):Dr(e[f]):e[f],f,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let l=0;l<e;l++)s[l]=t(l+1,l,void 0,o)}else if(At(e))if(e[Symbol.iterator])s=Array.from(e,(l,c)=>t(l,c,void 0,o));else{const l=Object.keys(e);s=new Array(l.length);for(let c=0,h=l.length;c<h;c++){const f=l[c];s[c]=t(e[f],f,c,o)}}else s=[];return s}function Qr(e,t,n={},r,s){if(Sn.ce||Sn.parent&&js(Sn.parent)&&Sn.parent.ce){const h=Object.keys(n).length>0;return t!=="default"&&(n.name=t),x(),lt(He,null,[Fe("slot",n,r)],h?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),x();const i=o&&Sh(o(n)),l=n.key||i&&i.key,c=lt(He,{key:(l&&!Nr(l)?l:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),c}function Sh(e){return e.some(t=>Oa(t)?!(t.type===$n||t.type===He&&!Sh(t.children)):!0)?e:null}const Au=e=>e?Vh(e)?Zi(e):Au(e.parent):null,xa=hn(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=>Au(e.parent),$root:e=>Au(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>xh(e),$forceUpdate:e=>e.f||(e.f=()=>{nc(e.update)}),$nextTick:e=>e.n||(e.n=Xt.bind(e.proxy)),$watch:e=>wg.bind(e)}),zl=(e,t)=>e!==Rt&&!e.__isScriptSetup&&xt(e,t),Fg={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:l,appContext:c}=e;if(t[0]!=="$"){const T=i[t];if(T!==void 0)switch(T){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(zl(r,t))return i[t]=1,r[t];if(s!==Rt&&xt(s,t))return i[t]=2,s[t];if(xt(o,t))return i[t]=3,o[t];if(n!==Rt&&xt(n,t))return i[t]=4,n[t];Eu&&(i[t]=0)}}const h=xa[t];let f,g;if(h)return t==="$attrs"&&Rn(e.attrs,"get",""),h(e);if((f=l.__cssModules)&&(f=f[t]))return f;if(n!==Rt&&xt(n,t))return i[t]=4,n[t];if(g=c.config.globalProperties,xt(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return zl(s,t)?(s[t]=n,!0):r!==Rt&&xt(r,t)?(r[t]=n,!0):xt(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:s,props:o,type:i}},l){let c;return!!(n[l]||e!==Rt&&l[0]!=="$"&&xt(e,l)||zl(t,l)||xt(o,l)||xt(r,l)||xt(xa,l)||xt(s.config.globalProperties,l)||(c=i.__cssModules)&&c[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:xt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Ug(){return Bg().slots}function Bg(e){const t=uc();return t.setupContext||(t.setupContext=zh(t))}function zc(e){return Ge(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Eu=!0;function qg(e){const t=xh(e),n=e.proxy,r=e.ctx;Eu=!1,t.beforeCreate&&Gc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:l,provide:c,inject:h,created:f,beforeMount:g,mounted:T,beforeUpdate:A,updated:B,activated:q,deactivated:Q,beforeDestroy:V,beforeUnmount:R,destroyed:W,unmounted:Z,render:fe,renderTracked:ye,renderTriggered:ee,errorCaptured:Ae,serverPrefetch:ge,expose:Ue,inheritAttrs:Ie,components:re,directives:de,filters:De}=t;if(h&&Hg(h,r,null),i)for(const _e in i){const Ee=i[_e];nt(Ee)&&(r[_e]=Ee.bind(n))}if(s){const _e=s.call(n,n);At(_e)&&(e.data=Ki(_e))}if(Eu=!0,o)for(const _e in o){const Ee=o[_e],Ve=nt(Ee)?Ee.bind(n,n):nt(Ee.get)?Ee.get.bind(n,n):Xr,Qe=!nt(Ee)&&nt(Ee.set)?Ee.set.bind(n):Xr,Ke=se({get:Ve,set:Qe});Object.defineProperty(r,_e,{enumerable:!0,configurable:!0,get:()=>Ke.value,set:Be=>Ke.value=Be})}if(l)for(const _e in l)Ch(l[_e],r,n,_e);if(c){const _e=nt(c)?c.call(n):c;Reflect.ownKeys(_e).forEach(Ee=>{Ei(Ee,_e[Ee])})}f&&Gc(f,e,"c");function Pe(_e,Ee){Ge(Ee)?Ee.forEach(Ve=>_e(Ve.bind(n))):Ee&&_e(Ee.bind(n))}if(Pe(Mg,g),Pe(Uo,T),Pe(Pg,A),Pe(Rg,B),Pe(Ag,q),Pe(Eg,Q),Pe(Dg,Ae),Pe(Ng,ye),Pe(Og,ee),Pe(ds,R),Pe(Ji,Z),Pe($g,ge),Ge(Ue))if(Ue.length){const _e=e.exposed||(e.exposed={});Ue.forEach(Ee=>{Object.defineProperty(_e,Ee,{get:()=>n[Ee],set:Ve=>n[Ee]=Ve,enumerable:!0})})}else e.exposed||(e.exposed={});fe&&e.render===Xr&&(e.render=fe),Ie!=null&&(e.inheritAttrs=Ie),re&&(e.components=re),de&&(e.directives=de),ge&&rc(e)}function Hg(e,t,n=Xr){Ge(e)&&(e=Iu(e));for(const r in e){const s=e[r];let o;At(s)?"default"in s?o=Or(s.from||r,s.default,!0):o=Or(s.from||r):o=Or(s),On(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function Gc(e,t,n){Lr(Ge(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Ch(e,t,n,r){let s=r.includes(".")?ph(n,r):()=>n[r];if(qt(e)){const o=t[e];nt(o)&&ut(s,o)}else if(nt(e))ut(s,e.bind(n));else if(At(e))if(Ge(e))e.forEach(o=>Ch(o,t,n,r));else{const o=nt(e.handler)?e.handler.bind(n):t[e.handler];nt(o)&&ut(s,o,e)}}function xh(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,l=o.get(t);let c;return l?c=l:!s.length&&!n&&!r?c=t:(c={},s.length&&s.forEach(h=>Ni(c,h,i,!0)),Ni(c,t,i)),At(t)&&o.set(t,c),c}function Ni(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Ni(e,o,n,!0),s&&s.forEach(i=>Ni(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const l=Vg[i]||n&&n[i];e[i]=l?l(e[i],t[i]):t[i]}return e}const Vg={data:Kc,props:Yc,emits:Yc,methods:ba,computed:ba,beforeCreate:zn,created:zn,beforeMount:zn,mounted:zn,beforeUpdate:zn,updated:zn,beforeDestroy:zn,beforeUnmount:zn,destroyed:zn,unmounted:zn,activated:zn,deactivated:zn,errorCaptured:zn,serverPrefetch:zn,components:ba,directives:ba,watch:zg,provide:Kc,inject:Wg};function Kc(e,t){return t?e?function(){return hn(nt(e)?e.call(this,this):e,nt(t)?t.call(this,this):t)}:t:e}function Wg(e,t){return ba(Iu(e),Iu(t))}function Iu(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function zn(e,t){return e?[...new Set([].concat(e,t))]:t}function ba(e,t){return e?hn(Object.create(null),e,t):t}function Yc(e,t){return e?Ge(e)&&Ge(t)?[...new Set([...e,...t])]:hn(Object.create(null),zc(e),zc(t??{})):t}function zg(e,t){if(!e)return t;if(!t)return e;const n=hn(Object.create(null),e);for(const r in t)n[r]=zn(e[r],t[r]);return n}function Ah(){return{app:null,config:{isNativeTag:Lf,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 Gg=0;function Kg(e,t){return function(r,s=null){nt(r)||(r=hn({},r)),s!=null&&!At(s)&&(s=null);const o=Ah(),i=new WeakSet,l=[];let c=!1;const h=o.app={_uid:Gg++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Cv,get config(){return o.config},set config(f){},use(f,...g){return i.has(f)||(f&&nt(f.install)?(i.add(f),f.install(h,...g)):nt(f)&&(i.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 A=h._ceVNode||Fe(r,s);return A.appContext=o,T===!0?T="svg":T===!1&&(T=void 0),e(A,f,T),c=!0,h._container=f,f.__vue_app__=h,Zi(A.component)}},onUnmount(f){l.push(f)},unmount(){c&&(Lr(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=Fs;Fs=h;try{return f()}finally{Fs=g}}};return h}}let Fs=null;const Yg=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Qn(t)}Modifiers`]||e[`${Fo(t)}Modifiers`];function Jg(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Rt;let s=n;const o=t.startsWith("update:"),i=o&&Yg(r,t.slice(7));i&&(i.trim&&(s=n.map(f=>qt(f)?f.trim():f)),i.number&&(s=n.map(Wi)));let l,c=r[l=Ul(t)]||r[l=Ul(Qn(t))];!c&&o&&(c=r[l=Ul(Fo(t))]),c&&Lr(c,e,6,s);const h=r[l+"Once"];if(h){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Lr(h,e,6,s)}}const Qg=new WeakMap;function Eh(e,t,n=!1){const r=n?Qg:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},l=!1;if(!nt(e)){const c=h=>{const f=Eh(h,t,!0);f&&(l=!0,hn(i,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!l?(At(e)&&r.set(e,null),null):(Ge(o)?o.forEach(c=>i[c]=null):hn(i,o),At(e)&&r.set(e,i),i)}function Qi(e,t){return!e||!Bi(t)?!1:(t=t.slice(2).replace(/Once$/,""),xt(e,t[0].toLowerCase()+t.slice(1))||xt(e,Fo(t))||xt(e,t))}function Jc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:l,emit:c,render:h,renderCache:f,props:g,data:T,setupState:A,ctx:B,inheritAttrs:q}=e,Q=$i(e);let V,R;try{if(n.shapeFlag&4){const Z=s||r,fe=Z;V=Jr(h.call(fe,Z,f,g,A,T,B)),R=l}else{const Z=t;V=Jr(Z.length>1?Z(g,{attrs:l,slots:i,emit:c}):Z(g,null)),R=t.props?l:Xg(l)}}catch(Z){Aa.length=0,Ua(Z,e,1),V=Fe($n)}let W=V;if(R&&q!==!1){const Z=Object.keys(R),{shapeFlag:fe}=W;Z.length&&fe&7&&(o&&Z.some(qi)&&(R=Zg(R,o)),W=jo(W,R,!1,!0))}return n.dirs&&(W=jo(W,null,!1,!0),W.dirs=W.dirs?W.dirs.concat(n.dirs):n.dirs),n.transition&&$a(W,n.transition),V=W,$i(Q),V}const Xg=e=>{let t;for(const n in e)(n==="class"||n==="style"||Bi(n))&&((t||(t={}))[n]=e[n]);return t},Zg=(e,t)=>{const n={};for(const r in e)(!qi(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function ev(e,t,n){const{props:r,children:s,component:o}=e,{props:i,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?Qc(r,i,h):!!i;if(c&8){const f=t.dynamicProps;for(let g=0;g<f.length;g++){const T=f[g];if(Ih(i,r,T)&&!Qi(h,T))return!0}}}else return(s||l)&&(!l||!l.$stable)?!0:r===i?!1:r?i?Qc(r,i,h):!0:!!i;return!1}function Qc(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const o=r[s];if(Ih(t,e,o)&&!Qi(n,o))return!0}return!1}function Ih(e,t,n){const r=e[n],s=t[n];return n==="style"&&At(r)&&At(s)?!Ks(r,s):r!==s}function tv({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Mh={},Ph=()=>Object.create(Mh),Rh=e=>Object.getPrototypeOf(e)===Mh;function nv(e,t,n,r=!1){const s={},o=Ph();e.propsDefaults=Object.create(null),$h(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:sh(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function rv(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,l=bt(s),[c]=e.propsOptions;let h=!1;if((r||i>0)&&!(i&16)){if(i&8){const f=e.vnode.dynamicProps;for(let g=0;g<f.length;g++){let T=f[g];if(Qi(e.emitsOptions,T))continue;const A=t[T];if(c)if(xt(o,T))A!==o[T]&&(o[T]=A,h=!0);else{const B=Qn(T);s[B]=Mu(c,l,B,A,e,!1)}else A!==o[T]&&(o[T]=A,h=!0)}}}else{$h(e,t,s,o)&&(h=!0);let f;for(const g in l)(!t||!xt(t,g)&&((f=Fo(g))===g||!xt(t,f)))&&(c?n&&(n[g]!==void 0||n[f]!==void 0)&&(s[g]=Mu(c,l,g,void 0,e,!0)):delete s[g]);if(o!==l)for(const g in o)(!t||!xt(t,g))&&(delete o[g],h=!0)}h&&fo(e.attrs,"set","")}function $h(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,l;if(t)for(let c in t){if(Ta(c))continue;const h=t[c];let f;s&&xt(s,f=Qn(c))?!o||!o.includes(f)?n[f]=h:(l||(l={}))[f]=h:Qi(e.emitsOptions,c)||(!(c in r)||h!==r[c])&&(r[c]=h,i=!0)}if(o){const c=bt(n),h=l||Rt;for(let f=0;f<o.length;f++){const g=o[f];n[g]=Mu(s,c,g,h[g],e,!xt(h,g))}}return i}function Mu(e,t,n,r,s,o){const i=e[n];if(i!=null){const l=xt(i,"default");if(l&&r===void 0){const c=i.default;if(i.type!==Function&&!i.skipFactory&&nt(c)){const{propsDefaults:h}=s;if(n in h)r=h[n];else{const f=qa(s);r=h[n]=c.call(null,t),f()}}else r=c;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!l?r=!1:i[1]&&(r===""||r===Fo(n))&&(r=!0))}return r}const ov=new WeakMap;function Oh(e,t,n=!1){const r=n?ov:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},l=[];let c=!1;if(!nt(e)){const f=g=>{c=!0;const[T,A]=Oh(g,t,!0);hn(i,T),A&&l.push(...A)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!o&&!c)return At(e)&&r.set(e,Ns),Ns;if(Ge(o))for(let f=0;f<o.length;f++){const g=Qn(o[f]);Xc(g)&&(i[g]=Rt)}else if(o)for(const f in o){const g=Qn(f);if(Xc(g)){const T=o[f],A=i[g]=Ge(T)||nt(T)?{type:T}:hn({},T),B=A.type;let q=!1,Q=!0;if(Ge(B))for(let V=0;V<B.length;++V){const R=B[V],W=nt(R)&&R.name;if(W==="Boolean"){q=!0;break}else W==="String"&&(Q=!1)}else q=nt(B)&&B.name==="Boolean";A[0]=q,A[1]=Q,(q||xt(A,"default"))&&l.push(g)}}const h=[i,l];return At(e)&&r.set(e,h),h}function Xc(e){return e[0]!=="$"&&!Ta(e)}const sc=e=>e==="_"||e==="_ctx"||e==="$stable",ac=e=>Ge(e)?e.map(Jr):[Jr(e)],sv=(e,t,n)=>{if(t._n)return t;const r=St((...s)=>ac(t(...s)),n);return r._c=!1,r},Nh=(e,t,n)=>{const r=e._ctx;for(const s in e){if(sc(s))continue;const o=e[s];if(nt(o))t[s]=sv(s,o,r);else if(o!=null){const i=ac(o);t[s]=()=>i}}},Dh=(e,t)=>{const n=ac(t);e.slots.default=()=>n},Lh=(e,t,n)=>{for(const r in t)(n||!sc(r))&&(e[r]=t[r])},av=(e,t,n)=>{const r=e.slots=Ph();if(e.vnode.shapeFlag&32){const s=t._;s?(Lh(r,t,n),n&&Bf(r,"_",s,!0)):Nh(t,r)}else t&&Dh(e,t)},iv=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Rt;if(r.shapeFlag&32){const l=t._;l?n&&l===1?o=!1:Lh(s,t,n):(o=!t.$stable,Nh(t,s)),i=t}else t&&(Dh(e,t),i={default:1});if(o)for(const l in s)!sc(l)&&i[l]==null&&delete s[l]},Gn=fv;function lv(e){return uv(e)}function uv(e,t){const n=zi();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:l,createComment:c,setText:h,setElementText:f,parentNode:g,nextSibling:T,setScopeId:A=Xr,insertStaticContent:B}=e,q=(k,E,H,G=null,oe=null,te=null,Te=void 0,ce=null,pe=!!E.dynamicChildren)=>{if(k===E)return;k&&!ss(k,E)&&(G=K(k),Be(k,oe,te,!0),k=null),E.patchFlag===-2&&(pe=!1,E.dynamicChildren=null);const{type:ae,ref:Me,shapeFlag:be}=E;switch(ae){case Xi:Q(k,E,H,G);break;case $n:V(k,E,H,G);break;case Kl:k==null&&R(E,H,G,Te);break;case He:re(k,E,H,G,oe,te,Te,ce,pe);break;default:be&1?fe(k,E,H,G,oe,te,Te,ce,pe):be&6?de(k,E,H,G,oe,te,Te,ce,pe):(be&64||be&128)&&ae.process(k,E,H,G,oe,te,Te,ce,pe,Oe)}Me!=null&&oe?Ca(Me,k&&k.ref,te,E||k,!E):Me==null&&k&&k.ref!=null&&Ca(k.ref,null,te,k,!0)},Q=(k,E,H,G)=>{if(k==null)r(E.el=l(E.children),H,G);else{const oe=E.el=k.el;E.children!==k.children&&h(oe,E.children)}},V=(k,E,H,G)=>{k==null?r(E.el=c(E.children||""),H,G):E.el=k.el},R=(k,E,H,G)=>{[k.el,k.anchor]=B(k.children,E,H,G,k.el,k.anchor)},W=({el:k,anchor:E},H,G)=>{let oe;for(;k&&k!==E;)oe=T(k),r(k,H,G),k=oe;r(E,H,G)},Z=({el:k,anchor:E})=>{let H;for(;k&&k!==E;)H=T(k),s(k),k=H;s(E)},fe=(k,E,H,G,oe,te,Te,ce,pe)=>{if(E.type==="svg"?Te="svg":E.type==="math"&&(Te="mathml"),k==null)ye(E,H,G,oe,te,Te,ce,pe);else{const ae=k.el&&k.el._isVueCE?k.el:null;try{ae&&ae._beginPatch(),ge(k,E,oe,te,Te,ce,pe)}finally{ae&&ae._endPatch()}}},ye=(k,E,H,G,oe,te,Te,ce)=>{let pe,ae;const{props:Me,shapeFlag:be,transition:$e,dirs:Se}=k;if(pe=k.el=i(k.type,te,Me&&Me.is,Me),be&8?f(pe,k.children):be&16&&Ae(k.children,pe,null,G,oe,Gl(k,te),Te,ce),Se&&Qo(k,null,G,"created"),ee(pe,k,k.scopeId,Te,G),Me){for(const O in Me)O!=="value"&&!Ta(O)&&o(pe,O,null,Me[O],te,G);"value"in Me&&o(pe,"value",null,Me.value,te),(ae=Me.onVnodeBeforeMount)&&zr(ae,G,k)}Se&&Qo(k,null,G,"beforeMount");const Xe=cv(oe,$e);Xe&&$e.beforeEnter(pe),r(pe,E,H),((ae=Me&&Me.onVnodeMounted)||Xe||Se)&&Gn(()=>{try{ae&&zr(ae,G,k),Xe&&$e.enter(pe),Se&&Qo(k,null,G,"mounted")}finally{}},oe)},ee=(k,E,H,G,oe)=>{if(H&&A(k,H),G)for(let te=0;te<G.length;te++)A(k,G[te]);if(oe){let te=oe.subTree;if(E===te||Uh(te.type)&&(te.ssContent===E||te.ssFallback===E)){const Te=oe.vnode;ee(k,Te,Te.scopeId,Te.slotScopeIds,oe.parent)}}},Ae=(k,E,H,G,oe,te,Te,ce,pe=0)=>{for(let ae=pe;ae<k.length;ae++){const Me=k[ae]=ce?co(k[ae]):Jr(k[ae]);q(null,Me,E,H,G,oe,te,Te,ce)}},ge=(k,E,H,G,oe,te,Te)=>{const ce=E.el=k.el;let{patchFlag:pe,dynamicChildren:ae,dirs:Me}=E;pe|=k.patchFlag&16;const be=k.props||Rt,$e=E.props||Rt;let Se;if(H&&Xo(H,!1),(Se=$e.onVnodeBeforeUpdate)&&zr(Se,H,E,k),Me&&Qo(E,k,H,"beforeUpdate"),H&&Xo(H,!0),(be.innerHTML&&$e.innerHTML==null||be.textContent&&$e.textContent==null)&&f(ce,""),ae?Ue(k.dynamicChildren,ae,ce,H,G,Gl(E,oe),te):Te||Ee(k,E,ce,null,H,G,Gl(E,oe),te,!1),pe>0){if(pe&16)Ie(ce,be,$e,H,oe);else if(pe&2&&be.class!==$e.class&&o(ce,"class",null,$e.class,oe),pe&4&&o(ce,"style",be.style,$e.style,oe),pe&8){const Xe=E.dynamicProps;for(let O=0;O<Xe.length;O++){const j=Xe[O],F=be[j],J=$e[j];(J!==F||j==="value")&&o(ce,j,F,J,oe,H)}}pe&1&&k.children!==E.children&&f(ce,E.children)}else!Te&&ae==null&&Ie(ce,be,$e,H,oe);((Se=$e.onVnodeUpdated)||Me)&&Gn(()=>{Se&&zr(Se,H,E,k),Me&&Qo(E,k,H,"updated")},G)},Ue=(k,E,H,G,oe,te,Te)=>{for(let ce=0;ce<E.length;ce++){const pe=k[ce],ae=E[ce],Me=pe.el&&(pe.type===He||!ss(pe,ae)||pe.shapeFlag&198)?g(pe.el):H;q(pe,ae,Me,null,G,oe,te,Te,!0)}},Ie=(k,E,H,G,oe)=>{if(E!==H){if(E!==Rt)for(const te in E)!Ta(te)&&!(te in H)&&o(k,te,E[te],null,oe,G);for(const te in H){if(Ta(te))continue;const Te=H[te],ce=E[te];Te!==ce&&te!=="value"&&o(k,te,ce,Te,oe,G)}"value"in H&&o(k,"value",E.value,H.value,oe)}},re=(k,E,H,G,oe,te,Te,ce,pe)=>{const ae=E.el=k?k.el:l(""),Me=E.anchor=k?k.anchor:l("");let{patchFlag:be,dynamicChildren:$e,slotScopeIds:Se}=E;Se&&(ce=ce?ce.concat(Se):Se),k==null?(r(ae,H,G),r(Me,H,G),Ae(E.children||[],H,Me,oe,te,Te,ce,pe)):be>0&&be&64&&$e&&k.dynamicChildren&&k.dynamicChildren.length===$e.length?(Ue(k.dynamicChildren,$e,H,oe,te,Te,ce),(E.key!=null||oe&&E===oe.subTree)&&ic(k,E,!0)):Ee(k,E,H,Me,oe,te,Te,ce,pe)},de=(k,E,H,G,oe,te,Te,ce,pe)=>{E.slotScopeIds=ce,k==null?E.shapeFlag&512?oe.ctx.activate(E,H,G,Te,pe):De(E,H,G,oe,te,Te,pe):qe(k,E,pe)},De=(k,E,H,G,oe,te,Te)=>{const ce=k.component=yv(k,G,oe);if(Ba(k)&&(ce.ctx.renderer=Oe),wv(ce,!1,Te),ce.asyncDep){if(oe&&oe.registerDep(ce,Pe,Te),!k.el){const pe=ce.subTree=Fe($n);V(null,pe,E,H),k.placeholder=pe.el}}else Pe(ce,k,E,H,oe,te,Te)},qe=(k,E,H)=>{const G=E.component=k.component;if(ev(k,E,H))if(G.asyncDep&&!G.asyncResolved){_e(G,E,H);return}else G.next=E,G.update();else E.el=k.el,G.vnode=E},Pe=(k,E,H,G,oe,te,Te)=>{const ce=()=>{if(k.isMounted){let{next:be,bu:$e,u:Se,parent:Xe,vnode:O}=k;{const Ce=jh(k);if(Ce){be&&(be.el=O.el,_e(k,be,Te)),Ce.asyncDep.then(()=>{Gn(()=>{k.isUnmounted||ae()},oe)});return}}let j=be,F;Xo(k,!1),be?(be.el=O.el,_e(k,be,Te)):be=O,$e&&Ai($e),(F=be.props&&be.props.onVnodeBeforeUpdate)&&zr(F,Xe,be,O),Xo(k,!0);const J=Jc(k),me=k.subTree;k.subTree=J,q(me,J,g(me.el),K(me),k,oe,te),be.el=J.el,j===null&&tv(k,J.el),Se&&Gn(Se,oe),(F=be.props&&be.props.onVnodeUpdated)&&Gn(()=>zr(F,Xe,be,O),oe)}else{let be;const{el:$e,props:Se}=E,{bm:Xe,m:O,parent:j,root:F,type:J}=k,me=js(E);Xo(k,!1),Xe&&Ai(Xe),!me&&(be=Se&&Se.onVnodeBeforeMount)&&zr(be,j,E),Xo(k,!0);{F.ce&&F.ce._hasShadowRoot()&&F.ce._injectChildStyle(J,k.parent?k.parent.type:void 0);const Ce=k.subTree=Jc(k);q(null,Ce,H,G,k,oe,te),E.el=Ce.el}if(O&&Gn(O,oe),!me&&(be=Se&&Se.onVnodeMounted)){const Ce=E;Gn(()=>zr(be,j,Ce),oe)}(E.shapeFlag&256||j&&js(j.vnode)&&j.vnode.shapeFlag&256)&&k.a&&Gn(k.a,oe),k.isMounted=!0,E=H=G=null}};k.scope.on();const pe=k.effect=new Wf(ce);k.scope.off();const ae=k.update=pe.run.bind(pe),Me=k.job=pe.runIfDirty.bind(pe);Me.i=k,Me.id=k.uid,pe.scheduler=()=>nc(Me),Xo(k,!0),ae()},_e=(k,E,H)=>{E.component=k;const G=k.vnode.props;k.vnode=E,k.next=null,rv(k,E.props,G,H),iv(k,E.children,H),go(),jc(k),vo()},Ee=(k,E,H,G,oe,te,Te,ce,pe=!1)=>{const ae=k&&k.children,Me=k?k.shapeFlag:0,be=E.children,{patchFlag:$e,shapeFlag:Se}=E;if($e>0){if($e&128){Qe(ae,be,H,G,oe,te,Te,ce,pe);return}else if($e&256){Ve(ae,be,H,G,oe,te,Te,ce,pe);return}}Se&8?(Me&16&&tt(ae,oe,te),be!==ae&&f(H,be)):Me&16?Se&16?Qe(ae,be,H,G,oe,te,Te,ce,pe):tt(ae,oe,te,!0):(Me&8&&f(H,""),Se&16&&Ae(be,H,G,oe,te,Te,ce,pe))},Ve=(k,E,H,G,oe,te,Te,ce,pe)=>{k=k||Ns,E=E||Ns;const ae=k.length,Me=E.length,be=Math.min(ae,Me);let $e;for($e=0;$e<be;$e++){const Se=E[$e]=pe?co(E[$e]):Jr(E[$e]);q(k[$e],Se,H,null,oe,te,Te,ce,pe)}ae>Me?tt(k,oe,te,!0,!1,be):Ae(E,H,G,oe,te,Te,ce,pe,be)},Qe=(k,E,H,G,oe,te,Te,ce,pe)=>{let ae=0;const Me=E.length;let be=k.length-1,$e=Me-1;for(;ae<=be&&ae<=$e;){const Se=k[ae],Xe=E[ae]=pe?co(E[ae]):Jr(E[ae]);if(ss(Se,Xe))q(Se,Xe,H,null,oe,te,Te,ce,pe);else break;ae++}for(;ae<=be&&ae<=$e;){const Se=k[be],Xe=E[$e]=pe?co(E[$e]):Jr(E[$e]);if(ss(Se,Xe))q(Se,Xe,H,null,oe,te,Te,ce,pe);else break;be--,$e--}if(ae>be){if(ae<=$e){const Se=$e+1,Xe=Se<Me?E[Se].el:G;for(;ae<=$e;)q(null,E[ae]=pe?co(E[ae]):Jr(E[ae]),H,Xe,oe,te,Te,ce,pe),ae++}}else if(ae>$e)for(;ae<=be;)Be(k[ae],oe,te,!0),ae++;else{const Se=ae,Xe=ae,O=new Map;for(ae=Xe;ae<=$e;ae++){const je=E[ae]=pe?co(E[ae]):Jr(E[ae]);je.key!=null&&O.set(je.key,ae)}let j,F=0;const J=$e-Xe+1;let me=!1,Ce=0;const ke=new Array(J);for(ae=0;ae<J;ae++)ke[ae]=0;for(ae=Se;ae<=be;ae++){const je=k[ae];if(F>=J){Be(je,oe,te,!0);continue}let wt;if(je.key!=null)wt=O.get(je.key);else for(j=Xe;j<=$e;j++)if(ke[j-Xe]===0&&ss(je,E[j])){wt=j;break}wt===void 0?Be(je,oe,te,!0):(ke[wt-Xe]=ae+1,wt>=Ce?Ce=wt:me=!0,q(je,E[wt],H,null,oe,te,Te,ce,pe),F++)}const Ze=me?dv(ke):Ns;for(j=Ze.length-1,ae=J-1;ae>=0;ae--){const je=Xe+ae,wt=E[je],pn=E[je+1],Xn=je+1<Me?pn.el||Fh(pn):G;ke[ae]===0?q(null,wt,H,Xn,oe,te,Te,ce,pe):me&&(j<0||ae!==Ze[j]?Ke(wt,H,Xn,2):j--)}}},Ke=(k,E,H,G,oe=null)=>{const{el:te,type:Te,transition:ce,children:pe,shapeFlag:ae}=k;if(ae&6){Ke(k.component.subTree,E,H,G);return}if(ae&128){k.suspense.move(E,H,G);return}if(ae&64){Te.move(k,E,H,Oe);return}if(Te===He){r(te,E,H);for(let be=0;be<pe.length;be++)Ke(pe[be],E,H,G);r(k.anchor,E,H);return}if(Te===Kl){W(k,E,H);return}if(G!==2&&ae&1&&ce)if(G===0)ce.beforeEnter(te),r(te,E,H),Gn(()=>ce.enter(te),oe);else{const{leave:be,delayLeave:$e,afterLeave:Se}=ce,Xe=()=>{k.ctx.isUnmounted?s(te):r(te,E,H)},O=()=>{te._isLeaving&&te[Kr](!0),be(te,()=>{Xe(),Se&&Se()})};$e?$e(te,Xe,O):O()}else r(te,E,H)},Be=(k,E,H,G=!1,oe=!1)=>{const{type:te,props:Te,ref:ce,children:pe,dynamicChildren:ae,shapeFlag:Me,patchFlag:be,dirs:$e,cacheIndex:Se,memo:Xe}=k;if(be===-2&&(oe=!1),ce!=null&&(go(),Ca(ce,null,H,k,!0),vo()),Se!=null&&(E.renderCache[Se]=void 0),Me&256){E.ctx.deactivate(k);return}const O=Me&1&&$e,j=!js(k);let F;if(j&&(F=Te&&Te.onVnodeBeforeUnmount)&&zr(F,E,k),Me&6)dt(k.component,H,G);else{if(Me&128){k.suspense.unmount(H,G);return}O&&Qo(k,null,E,"beforeUnmount"),Me&64?k.type.remove(k,E,H,Oe,G):ae&&!ae.hasOnce&&(te!==He||be>0&&be&64)?tt(ae,E,H,!1,!0):(te===He&&be&384||!oe&&Me&16)&&tt(pe,E,H),G&&pt(k)}const J=Xe!=null&&Se==null;(j&&(F=Te&&Te.onVnodeUnmounted)||O||J)&&Gn(()=>{F&&zr(F,E,k),O&&Qo(k,null,E,"unmounted"),J&&(k.el=null)},H)},pt=k=>{const{type:E,el:H,anchor:G,transition:oe}=k;if(E===He){et(H,G);return}if(E===Kl){Z(k);return}const te=()=>{s(H),oe&&!oe.persisted&&oe.afterLeave&&oe.afterLeave()};if(k.shapeFlag&1&&oe&&!oe.persisted){const{leave:Te,delayLeave:ce}=oe,pe=()=>Te(H,te);ce?ce(k.el,te,pe):pe()}else te()},et=(k,E)=>{let H;for(;k!==E;)H=T(k),s(k),k=H;s(E)},dt=(k,E,H)=>{const{bum:G,scope:oe,job:te,subTree:Te,um:ce,m:pe,a:ae}=k;Zc(pe),Zc(ae),G&&Ai(G),oe.stop(),te&&(te.flags|=8,Be(Te,k,E,H)),ce&&Gn(ce,E),Gn(()=>{k.isUnmounted=!0},E)},tt=(k,E,H,G=!1,oe=!1,te=0)=>{for(let Te=te;Te<k.length;Te++)Be(k[Te],E,H,G,oe)},K=k=>{if(k.shapeFlag&6)return K(k.component.subTree);if(k.shapeFlag&128)return k.suspense.next();const E=T(k.anchor||k.el),H=E&&E[mh];return H?T(H):E};let we=!1;const he=(k,E,H)=>{let G;k==null?E._vnode&&(Be(E._vnode,null,null,!0),G=E._vnode.component):q(E._vnode||null,k,E,null,null,null,H),E._vnode=k,we||(we=!0,jc(G),ch(),we=!1)},Oe={p:q,um:Be,m:Ke,r:pt,mt:De,mc:Ae,pc:Ee,pbc:Ue,n:K,o:e};return{render:he,hydrate:void 0,createApp:Kg(he)}}function Gl({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 Xo({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function cv(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ic(e,t,n=!1){const r=e.children,s=t.children;if(Ge(r)&&Ge(s))for(let o=0;o<r.length;o++){const i=r[o];let l=s[o];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=s[o]=co(s[o]),l.el=i.el),!n&&l.patchFlag!==-2&&ic(i,l)),l.type===Xi&&(l.patchFlag===-1&&(l=s[o]=co(l)),l.el=i.el),l.type===$n&&!l.el&&(l.el=i.el)}}function dv(e){const t=e.slice(),n=[0];let r,s,o,i,l;const c=e.length;for(r=0;r<c;r++){const h=e[r];if(h!==0){if(s=n[n.length-1],e[s]<h){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)l=o+i>>1,e[n[l]]<h?o=l+1:i=l;h<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function jh(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:jh(t)}function Zc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Fh(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Fh(t.subTree):null}const Uh=e=>e.__isSuspense;function fv(e,t){t&&t.pendingBranch?Ge(e)?t.effects.push(...e):t.effects.push(e):gg(e)}const He=Symbol.for("v-fgt"),Xi=Symbol.for("v-txt"),$n=Symbol.for("v-cmt"),Kl=Symbol.for("v-stc"),Aa=[];let Jn=null;function x(e=!1){Aa.push(Jn=e?null:[])}function hv(){Aa.pop(),Jn=Aa[Aa.length-1]||null}let Bs=1;function Di(e,t=!1){Bs+=e,e<0&&Jn&&t&&(Jn.hasOnce=!0)}function Bh(e){return e.dynamicChildren=Bs>0?Jn||Ns:null,hv(),Bs>0&&Jn&&Jn.push(e),e}function $(e,t,n,r,s,o){return Bh(m(e,t,n,r,s,o,!0))}function lt(e,t,n,r,s){return Bh(Fe(e,t,n,r,s,!0))}function Oa(e){return e?e.__v_isVNode===!0:!1}function ss(e,t){return e.type===t.type&&e.key===t.key}const qh=({key:e})=>e??null,Ii=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?qt(e)||On(e)||nt(e)?{i:Sn,r:e,k:t,f:!!n}:e:null);function m(e,t=null,n=null,r=0,s=null,o=e===He?0:1,i=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&qh(t),ref:t&&Ii(t),scopeId:fh,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:s,dynamicChildren:null,appContext:null,ctx:Sn};return l?(lc(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=qt(n)?8:16),Bs>0&&!i&&Jn&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&Jn.push(c),c}const Fe=pv;function pv(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===kh)&&(e=$n),Oa(e)){const l=jo(e,t,!0);return n&&lc(l,n),Bs>0&&!o&&Jn&&(l.shapeFlag&6?Jn[Jn.indexOf(e)]=l:Jn.push(l)),l.patchFlag=-2,l}if(kv(e)&&(e=e.__vccOpts),t){t=mv(t);let{class:l,style:c}=t;l&&!qt(l)&&(t.class=at(l)),At(c)&&(tc(c)&&!Ge(c)&&(c=hn({},c)),t.style=po(c))}const i=qt(e)?1:Uh(e)?128:gh(e)?64:At(e)?4:nt(e)?2:0;return m(e,t,n,r,s,i,o,!0)}function mv(e){return e?tc(e)||Rh(e)?hn({},e):e:null}function jo(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:l,transition:c}=e,h=t?Hh(s||{},t):s,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:h,key:h&&qh(h),ref:t&&t.ref?n&&o?Ge(o)?o.concat(Ii(t)):[o,Ii(t)]:Ii(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!==He?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&jo(e.ssContent),ssFallback:e.ssFallback&&jo(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&$a(f,c.clone(f)),f}function cs(e=" ",t=0){return Fe(Xi,null,e,t)}function ue(e="",t=!1){return t?(x(),lt($n,null,e)):Fe($n,null,e)}function Jr(e){return e==null||typeof e=="boolean"?Fe($n):Ge(e)?Fe(He,null,e.slice()):Oa(e)?co(e):Fe(Xi,null,String(e))}function co(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:jo(e)}function lc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ge(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),lc(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Rh(t)?t._ctx=Sn:s===3&&Sn&&(Sn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else nt(t)?(t={default:t,_ctx:Sn},n=32):(t=String(t),r&64?(n=16,t=[cs(t)]):n=8);e.children=t,e.shapeFlag|=n}function Hh(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=at([t.class,r.class]));else if(s==="style")t.style=po([t.style,r.style]);else if(Bi(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ge(o)&&o.includes(i))?t[s]=o?[].concat(o,i):i:i==null&&o==null&&!qi(s)&&(t[s]=i)}else s!==""&&(t[s]=r[s])}return t}function zr(e,t,n,r=null){Lr(e,t,7,[n,r])}const gv=Ah();let vv=0;function yv(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||gv,o={uid:vv++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Um(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Oh(r,s),emitsOptions:Eh(r,s),emit:null,emitted:null,propsDefaults:Rt,inheritAttrs:r.inheritAttrs,ctx:Rt,data:Rt,props:Rt,attrs:Rt,slots:Rt,refs:Rt,setupState:Rt,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=Jg.bind(null,o),e.ce&&e.ce(o),o}let kn=null;const uc=()=>kn||Sn;let Li,Pu;{const e=zi(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};Li=t("__VUE_INSTANCE_SETTERS__",n=>kn=n),Pu=t("__VUE_SSR_SETTERS__",n=>qs=n)}const qa=e=>{const t=kn;return Li(e),e.scope.on(),()=>{e.scope.off(),Li(t)}},ed=()=>{kn&&kn.scope.off(),Li(null)};function Vh(e){return e.vnode.shapeFlag&4}let qs=!1;function wv(e,t=!1,n=!1){t&&Pu(t);const{props:r,children:s}=e.vnode,o=Vh(e);nv(e,r,o,t),av(e,s,n||t);const i=o?bv(e,t):void 0;return t&&Pu(!1),i}function bv(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Fg);const{setup:r}=n;if(r){go();const s=e.setupContext=r.length>1?zh(e):null,o=qa(e),i=Fa(r,e,0,[e.props,s]),l=jf(i);if(vo(),o(),(l||e.sp)&&!js(e)&&rc(e),l){if(i.then(ed,ed),t)return i.then(c=>{td(e,c)}).catch(c=>{Ua(c,e,0)});e.asyncDep=i}else td(e,i)}else Wh(e)}function td(e,t,n){nt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:At(t)&&(e.setupState=ih(t)),Wh(e)}function Wh(e,t,n){const r=e.type;e.render||(e.render=r.render||Xr);{const s=qa(e);go();try{qg(e)}finally{vo(),s()}}}const _v={get(e,t){return Rn(e,"get",""),e[t]}};function zh(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,_v),slots:e.slots,emit:e.emit,expose:t}}function Zi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ih(ag(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in xa)return xa[n](e)},has(t,n){return n in t||n in xa}})):e.proxy}function Tv(e,t=!0){return nt(e)?e.displayName||e.name:e.name||t&&e.__name}function kv(e){return nt(e)&&"__vccOpts"in e}const se=(e,t)=>dg(e,t,qs);function cc(e,t,n){try{Di(-1);const r=arguments.length;return r===2?At(t)&&!Ge(t)?Oa(t)?Fe(e,null,[t]):Fe(e,t):Fe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Oa(n)&&(n=[n]),Fe(e,t,n))}finally{Di(1)}}function hI(e,t,n,r){const s=n[r];if(s&&Sv(s,e))return s;const o=t();return o.memo=e.slice(),o.cacheIndex=r,n[r]=o}function Sv(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Pr(n[r],t[r]))return!1;return Bs>0&&Jn&&Jn.push(e),!0}const Cv="3.5.33";/**
|
|
15
|
-
* @vue/runtime-dom v3.5.33
|
|
16
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
-
* @license MIT
|
|
18
|
-
**/let Ru;const nd=typeof window<"u"&&window.trustedTypes;if(nd)try{Ru=nd.createPolicy("vue",{createHTML:e=>e})}catch{}const Gh=Ru?e=>Ru.createHTML(e):e=>e,xv="http://www.w3.org/2000/svg",Av="http://www.w3.org/1998/Math/MathML",uo=typeof document<"u"?document:null,rd=uo&&uo.createElement("template"),Ev={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 s=t==="svg"?uo.createElementNS(xv,e):t==="mathml"?uo.createElementNS(Av,e):n?uo.createElement(e,{is:n}):uo.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>uo.createTextNode(e),createComment:e=>uo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>uo.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{rd.innerHTML=Gh(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=rd.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[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Eo="transition",ma="animation",Na=Symbol("_vtc"),Kh={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},Iv=hn({},vh,Kh),Mv=e=>(e.displayName="Transition",e.props=Iv,e),Yh=Mv((e,{slots:t})=>cc(Cg,Pv(e),t)),Zo=(e,t=[])=>{Ge(e)?e.forEach(n=>n(...t)):e&&e(...t)},od=e=>e?Ge(e)?e.some(t=>t.length>1):e.length>1:!1;function Pv(e){const t={};for(const re in e)re in Kh||(t[re]=e[re]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:h=i,appearToClass:f=l,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:T=`${n}-leave-active`,leaveToClass:A=`${n}-leave-to`}=e,B=Rv(s),q=B&&B[0],Q=B&&B[1],{onBeforeEnter:V,onEnter:R,onEnterCancelled:W,onLeave:Z,onLeaveCancelled:fe,onBeforeAppear:ye=V,onAppear:ee=R,onAppearCancelled:Ae=W}=t,ge=(re,de,De,qe)=>{re._enterCancelled=qe,es(re,de?f:l),es(re,de?h:i),De&&De()},Ue=(re,de)=>{re._isLeaving=!1,es(re,g),es(re,A),es(re,T),de&&de()},Ie=re=>(de,De)=>{const qe=re?ee:R,Pe=()=>ge(de,re,De);Zo(qe,[de,Pe]),sd(()=>{es(de,re?c:o),io(de,re?f:l),od(qe)||ad(de,r,q,Pe)})};return hn(t,{onBeforeEnter(re){Zo(V,[re]),io(re,o),io(re,i)},onBeforeAppear(re){Zo(ye,[re]),io(re,c),io(re,h)},onEnter:Ie(!1),onAppear:Ie(!0),onLeave(re,de){re._isLeaving=!0;const De=()=>Ue(re,de);io(re,g),re._enterCancelled?(io(re,T),ud(re)):(ud(re),io(re,T)),sd(()=>{re._isLeaving&&(es(re,g),io(re,A),od(Z)||ad(re,r,Q,De))}),Zo(Z,[re,De])},onEnterCancelled(re){ge(re,!1,void 0,!0),Zo(W,[re])},onAppearCancelled(re){ge(re,!0,void 0,!0),Zo(Ae,[re])},onLeaveCancelled(re){Ue(re),Zo(fe,[re])}})}function Rv(e){if(e==null)return null;if(At(e))return[Yl(e.enter),Yl(e.leave)];{const t=Yl(e);return[t,t]}}function Yl(e){return Rm(e)}function io(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Na]||(e[Na]=new Set)).add(t)}function es(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Na];n&&(n.delete(t),n.size||(e[Na]=void 0))}function sd(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let $v=0;function ad(e,t,n,r){const s=e._endId=++$v,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:l,propCount:c}=Ov(e,t);if(!i)return r();const h=i+"end";let f=0;const g=()=>{e.removeEventListener(h,T),o()},T=A=>{A.target===e&&++f>=c&&g()};setTimeout(()=>{f<c&&g()},l+1),e.addEventListener(h,T)}function Ov(e,t){const n=window.getComputedStyle(e),r=B=>(n[B]||"").split(", "),s=r(`${Eo}Delay`),o=r(`${Eo}Duration`),i=id(s,o),l=r(`${ma}Delay`),c=r(`${ma}Duration`),h=id(l,c);let f=null,g=0,T=0;t===Eo?i>0&&(f=Eo,g=i,T=o.length):t===ma?h>0&&(f=ma,g=h,T=c.length):(g=Math.max(i,h),f=g>0?i>h?Eo:ma:null,T=f?f===Eo?o.length:c.length:0);const A=f===Eo&&/\b(?:transform|all)(?:,|$)/.test(r(`${Eo}Property`).toString());return{type:f,timeout:g,propCount:T,hasTransform:A}}function id(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ld(n)+ld(e[r])))}function ld(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ud(e){return(e?e.ownerDocument:document).body.offsetHeight}function Nv(e,t,n){const r=e[Na];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const cd=Symbol("_vod"),Dv=Symbol("_vsh"),Lv=Symbol(""),jv=/(?:^|;)\s*display\s*:/;function Fv(e,t,n){const r=e.style,s=qt(n);let o=!1;if(n&&!s){if(t)if(qt(t))for(const i of t.split(";")){const l=i.slice(0,i.indexOf(":")).trim();n[l]==null&&_a(r,l,"")}else for(const i in t)n[i]==null&&_a(r,i,"");for(const i in n){i==="display"&&(o=!0);const l=n[i];l!=null?Bv(e,i,!qt(t)&&t?t[i]:void 0,l)||_a(r,i,l):_a(r,i,"")}}else if(s){if(t!==n){const i=r[Lv];i&&(n+=";"+i),r.cssText=n,o=jv.test(n)}}else t&&e.removeAttribute("style");cd in e&&(e[cd]=o?r.display:"",e[Dv]&&(r.display="none"))}const dd=/\s*!important$/;function _a(e,t,n){if(Ge(n))n.forEach(r=>_a(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Uv(e,t);dd.test(n)?e.setProperty(Fo(r),n.replace(dd,""),"important"):e[r]=n}}const fd=["Webkit","Moz","ms"],Jl={};function Uv(e,t){const n=Jl[t];if(n)return n;let r=Qn(t);if(r!=="filter"&&r in e)return Jl[t]=r;r=Vi(r);for(let s=0;s<fd.length;s++){const o=fd[s]+r;if(o in e)return Jl[t]=o}return t}function Bv(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&qt(r)&&n===r}const hd="http://www.w3.org/1999/xlink";function pd(e,t,n,r,s,o=jm(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(hd,t.slice(6,t.length)):e.setAttributeNS(hd,t,n):n==null||o&&!qf(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Nr(n)?String(n):n)}function md(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Gh(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 i=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=qf(n):n==null&&l==="string"?(n="",i=!0):l==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function Do(e,t,n,r){e.addEventListener(t,n,r)}function qv(e,t,n,r){e.removeEventListener(t,n,r)}const gd=Symbol("_vei");function Hv(e,t,n,r,s=null){const o=e[gd]||(e[gd]={}),i=o[t];if(r&&i)i.value=r;else{const[l,c]=Vv(t);if(r){const h=o[t]=Gv(r,s);Do(e,l,h,c)}else i&&(qv(e,l,i,c),o[t]=void 0)}}const vd=/(?:Once|Passive|Capture)$/;function Vv(e){let t;if(vd.test(e)){t={};let r;for(;r=e.match(vd);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Fo(e.slice(2)),t]}let Ql=0;const Wv=Promise.resolve(),zv=()=>Ql||(Wv.then(()=>Ql=0),Ql=Date.now());function Gv(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Lr(Kv(r,n.value),t,5,[r])};return n.value=e,n.attached=zv(),n}function Kv(e,t){if(Ge(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const yd=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Yv=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Nv(e,r,i):t==="style"?Fv(e,n,r):Bi(t)?qi(t)||Hv(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Jv(e,t,r,i))?(md(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&pd(e,t,r,i,o,t!=="value")):e._isVueCE&&(Qv(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!qt(r)))?md(e,Qn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),pd(e,t,r,i))};function Jv(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&yd(t)&&nt(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 s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return yd(t)&&qt(n)?!1:t in e}function Qv(e,t){const n=e._def.props;if(!n)return!1;const r=Qn(t);return Array.isArray(n)?n.some(s=>Qn(s)===r):Object.keys(n).some(s=>Qn(s)===r)}const Hs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ge(t)?n=>Ai(t,n):t};function Xv(e){e.target.composing=!0}function wd(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const mo=Symbol("_assign");function bd(e,t,n){return t&&(e=e.trim()),n&&(e=Wi(e)),e}const gn={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[mo]=Hs(s);const o=r||s.props&&s.props.type==="number";Do(e,t?"change":"input",i=>{i.target.composing||e[mo](bd(e.value,n,o))}),(n||o)&&Do(e,"change",()=>{e.value=bd(e.value,n,o)}),t||(Do(e,"compositionstart",Xv),Do(e,"compositionend",wd),Do(e,"change",wd))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[mo]=Hs(i),e.composing)return;const l=(o||e.type==="number")&&!/^0\d/.test(e.value)?Wi(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||s&&e.value.trim()===c)||(e.value=c)}},Zv={deep:!0,created(e,t,n){e[mo]=Hs(n),Do(e,"change",()=>{const r=e._modelValue,s=Da(e),o=e.checked,i=e[mo];if(Ge(r)){const l=Ku(r,s),c=l!==-1;if(o&&!c)i(r.concat(s));else if(!o&&c){const h=[...r];h.splice(l,1),i(h)}}else if(Gs(r)){const l=new Set(r);o?l.add(s):l.delete(s),i(l)}else i(Jh(e,o))})},mounted:_d,beforeUpdate(e,t,n){e[mo]=Hs(n),_d(e,t,n)}};function _d(e,{value:t,oldValue:n},r){e._modelValue=t;let s;if(Ge(t))s=Ku(t,r.props.value)>-1;else if(Gs(t))s=t.has(r.props.value);else{if(t===n)return;s=Ks(t,Jh(e,!0))}e.checked!==s&&(e.checked=s)}const ey={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const s=Gs(t);Do(e,"change",()=>{const o=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?Wi(Da(i)):Da(i));e[mo](e.multiple?s?new Set(o):o:o[0]),e._assigning=!0,Xt(()=>{e._assigning=!1})}),e[mo]=Hs(r)},mounted(e,{value:t}){Td(e,t)},beforeUpdate(e,t,n){e[mo]=Hs(n)},updated(e,{value:t}){e._assigning||Td(e,t)}};function Td(e,t){const n=e.multiple,r=Ge(t);if(!(n&&!r&&!Gs(t))){for(let s=0,o=e.options.length;s<o;s++){const i=e.options[s],l=Da(i);if(n)if(r){const c=typeof l;c==="string"||c==="number"?i.selected=t.some(h=>String(h)===String(l)):i.selected=Ku(t,l)>-1}else i.selected=t.has(l);else if(Ks(Da(i),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Da(e){return"_value"in e?e._value:e.value}function Jh(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const ty=["ctrl","shift","alt","meta"],ny={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)=>ty.some(n=>e[`${n}Key`]&&!t.includes(n))},ot=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...o)=>{for(let i=0;i<t.length;i++){const l=ny[t[i]];if(l&&l(s,t))return}return e(s,...o)}))},ry={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Qt=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Fo(s.key);if(t.some(i=>i===o||ry[i]===o))return e(s)}))},oy=hn({patchProp:Yv},Ev);let kd;function sy(){return kd||(kd=lv(oy))}const ay=((...e)=>{const t=sy().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=ly(r);if(!s)return;const o=t._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,iy(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function iy(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function ly(e){return qt(e)?document.querySelector(e):e}const uy="modulepreload",cy=function(e){return"/"+e},Sd={},wi=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let i=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"));s=i(n.map(h=>{if(h=cy(h),h in Sd)return;Sd[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":uy,f||(T.as="script"),T.crossOrigin="",T.href=h,c&&T.setAttribute("nonce",c),document.head.appendChild(T),f)return new Promise((A,B)=>{T.addEventListener("load",A),T.addEventListener("error",()=>B(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return s.then(i=>{for(const l of i||[])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 Is=typeof document<"u";function Qh(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function dy(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Qh(e.default)}const Ct=Object.assign;function Xl(e,t){const n={};for(const r in t){const s=t[r];n[r]=jr(s)?s.map(e):e(s)}return n}const Ea=()=>{},jr=Array.isArray;function Cd(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Xh=/#/g,fy=/&/g,hy=/\//g,py=/=/g,my=/\?/g,Zh=/\+/g,gy=/%5B/g,vy=/%5D/g,ep=/%5E/g,yy=/%60/g,tp=/%7B/g,wy=/%7C/g,np=/%7D/g,by=/%20/g;function dc(e){return e==null?"":encodeURI(""+e).replace(wy,"|").replace(gy,"[").replace(vy,"]")}function _y(e){return dc(e).replace(tp,"{").replace(np,"}").replace(ep,"^")}function $u(e){return dc(e).replace(Zh,"%2B").replace(by,"+").replace(Xh,"%23").replace(fy,"%26").replace(yy,"`").replace(tp,"{").replace(np,"}").replace(ep,"^")}function Ty(e){return $u(e).replace(py,"%3D")}function ky(e){return dc(e).replace(Xh,"%23").replace(my,"%3F")}function Sy(e){return ky(e).replace(hy,"%2F")}function La(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Cy=/\/$/,xy=e=>e.replace(Cy,"");function Zl(e,t,n="/"){let r,s={},o="",i="";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),s=e(o.slice(1))),l>=0&&(r=r||t.slice(0,l),i=t.slice(l,t.length)),r=My(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:La(i)}}function Ay(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function xd(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Ey(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Vs(t.matched[r],n.matched[s])&&rp(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Vs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function rp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Iy(e[n],t[n]))return!1;return!0}function Iy(e,t){return jr(e)?Ad(e,t):jr(t)?Ad(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Ad(e,t){return jr(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function My(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,l;for(i=0;i<r.length;i++)if(l=r[i],l!==".")if(l==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const Io={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ou=(function(e){return e.pop="pop",e.push="push",e})({}),eu=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Py(e){if(!e)if(Is){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),xy(e)}const Ry=/^[^#]+#/;function $y(e,t){return e.replace(Ry,"#")+t}function Oy(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 el=()=>({left:window.scrollX,top:window.scrollY});function Ny(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=Oy(s,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 Ed(e,t){return(history.state?history.state.position-t:-1)+e}const Nu=new Map;function Dy(e,t){Nu.set(e,t)}function Ly(e){const t=Nu.get(e);return Nu.delete(e),t}function jy(e){return typeof e=="string"||e&&typeof e=="object"}function op(e){return typeof e=="string"||typeof e=="symbol"}let Jt=(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 sp=Symbol("");Jt.MATCHER_NOT_FOUND+"",Jt.NAVIGATION_GUARD_REDIRECT+"",Jt.NAVIGATION_ABORTED+"",Jt.NAVIGATION_CANCELLED+"",Jt.NAVIGATION_DUPLICATED+"";function Ws(e,t){return Ct(new Error,{type:e,[sp]:!0},t)}function lo(e,t){return e instanceof Error&&sp in e&&(t==null||!!(e.type&t))}const Fy=["params","query","hash"];function Uy(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Fy)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function By(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 s=n[r].replace(Zh," "),o=s.indexOf("="),i=La(o<0?s:s.slice(0,o)),l=o<0?null:La(s.slice(o+1));if(i in t){let c=t[i];jr(c)||(c=t[i]=[c]),c.push(l)}else t[i]=l}return t}function Id(e){let t="";for(let n in e){const r=e[n];if(n=Ty(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(jr(r)?r.map(s=>s&&$u(s)):[r&&$u(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function qy(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=jr(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Hy=Symbol(""),Md=Symbol(""),tl=Symbol(""),fc=Symbol(""),Du=Symbol("");function ga(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Oo(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((l,c)=>{const h=T=>{T===!1?c(Ws(Jt.NAVIGATION_ABORTED,{from:n,to:t})):T instanceof Error?c(T):jy(T)?c(Ws(Jt.NAVIGATION_GUARD_REDIRECT,{from:t,to:T})):(i&&r.enterCallbacks[s]===i&&typeof T=="function"&&i.push(T),l())},f=o(()=>e.call(r&&r.instances[s],t,n,h));let g=Promise.resolve(f);e.length<3&&(g=g.then(h)),g.catch(T=>c(T))})}function tu(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const l in i.components){let c=i.components[l];if(!(t!=="beforeRouteEnter"&&!i.instances[l]))if(Qh(c)){const h=(c.__vccOpts||c)[t];h&&o.push(Oo(h,n,r,i,l,s))}else{let h=c();o.push(()=>h.then(f=>{if(!f)throw new Error(`Couldn't resolve component "${l}" at "${i.path}"`);const g=dy(f)?f.default:f;i.mods[l]=f,i.components[l]=g;const T=(g.__vccOpts||g)[t];return T&&Oo(T,n,r,i,l,s)()}))}}return o}function Vy(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const l=t.matched[i];l&&(e.matched.find(h=>Vs(h,l))?r.push(l):n.push(l));const c=e.matched[i];c&&(t.matched.find(h=>Vs(h,c))||s.push(c))}return[n,r,s]}/*!
|
|
23
|
-
* vue-router v4.6.4
|
|
24
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
-
* @license MIT
|
|
26
|
-
*/let Wy=()=>location.protocol+"//"+location.host;function ap(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,l=s.slice(i);return l[0]!=="/"&&(l="/"+l),xd(l,"")}return xd(n,e)+r+s}function zy(e,t,n,r){let s=[],o=[],i=null;const l=({state:T})=>{const A=ap(e,location),B=n.value,q=t.value;let Q=0;if(T){if(n.value=A,t.value=T,i&&i===B){i=null;return}Q=q?T.position-q.position:0}else r(A);s.forEach(V=>{V(n.value,B,{delta:Q,type:Ou.pop,direction:Q?Q>0?eu.forward:eu.back:eu.unknown})})};function c(){i=n.value}function h(T){s.push(T);const A=()=>{const B=s.indexOf(T);B>-1&&s.splice(B,1)};return o.push(A),A}function f(){if(document.visibilityState==="hidden"){const{history:T}=window;if(!T.state)return;T.replaceState(Ct({},T.state,{scroll:el()}),"")}}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 Pd(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?el():null}}function Gy(e){const{history:t,location:n}=window,r={value:ap(e,n)},s={value:t.state};s.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:Wy()+e+c;try{t[f?"replaceState":"pushState"](h,"",T),s.value=h}catch(A){console.error(A),n[f?"replace":"assign"](T)}}function i(c,h){o(c,Ct({},t.state,Pd(s.value.back,c,s.value.forward,!0),h,{position:s.value.position}),!0),r.value=c}function l(c,h){const f=Ct({},s.value,t.state,{forward:c,scroll:el()});o(f.current,f,!0),o(c,Ct({},Pd(r.value,c,null),{position:f.position+1},h),!1),r.value=c}return{location:r,state:s,push:l,replace:i}}function Ky(e){e=Py(e);const t=Gy(e),n=zy(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=Ct({location:"",base:e,go:r,createHref:$y.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function Yy(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Ky(e)}let is=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var dn=(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})(dn||{});const Jy={type:is.Static,value:""},Qy=/[a-zA-Z0-9_]/;function Xy(e){if(!e)return[[]];if(e==="/")return[[Jy]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(A){throw new Error(`ERR (${n})/"${h}": ${A}`)}let n=dn.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let l=0,c,h="",f="";function g(){h&&(n===dn.Static?o.push({type:is.Static,value:h}):n===dn.Param||n===dn.ParamRegExp||n===dn.ParamRegExpEnd?(o.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${h}) must be alone in its segment. eg: '/:ids+.`),o.push({type:is.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!==dn.ParamRegExp){r=n,n=dn.EscapeNext;continue}switch(n){case dn.Static:c==="/"?(h&&g(),i()):c===":"?(g(),n=dn.Param):T();break;case dn.EscapeNext:T(),n=r;break;case dn.Param:c==="("?n=dn.ParamRegExp:Qy.test(c)?T():(g(),n=dn.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--);break;case dn.ParamRegExp:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=dn.ParamRegExpEnd:f+=c;break;case dn.ParamRegExpEnd:g(),n=dn.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--,f="";break;default:t("Unknown state");break}}return n===dn.ParamRegExp&&t(`Unfinished custom RegExp for param "${h}"`),g(),i(),s}const Rd="[^/]+?",Zy={sensitive:!1,strict:!1,start:!0,end:!0};var Kn=(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})(Kn||{});const ew=/[.+*?^${}()[\]/\\]/g;function tw(e,t){const n=Ct({},Zy,t),r=[];let s=n.start?"^":"";const o=[];for(const h of e){const f=h.length?[]:[Kn.Root];n.strict&&!h.length&&(s+="/");for(let g=0;g<h.length;g++){const T=h[g];let A=Kn.Segment+(n.sensitive?Kn.BonusCaseSensitive:0);if(T.type===is.Static)g||(s+="/"),s+=T.value.replace(ew,"\\$&"),A+=Kn.Static;else if(T.type===is.Param){const{value:B,repeatable:q,optional:Q,regexp:V}=T;o.push({name:B,repeatable:q,optional:Q});const R=V||Rd;if(R!==Rd){A+=Kn.BonusCustomRegExp;try{`${R}`}catch(Z){throw new Error(`Invalid custom RegExp for param "${B}" (${R}): `+Z.message)}}let W=q?`((?:${R})(?:/(?:${R}))*)`:`(${R})`;g||(W=Q&&h.length<2?`(?:/${W})`:"/"+W),Q&&(W+="?"),s+=W,A+=Kn.Dynamic,Q&&(A+=Kn.BonusOptional),q&&(A+=Kn.BonusRepeatable),R===".*"&&(A+=Kn.BonusWildcard)}f.push(A)}r.push(f)}if(n.strict&&n.end){const h=r.length-1;r[h][r[h].length-1]+=Kn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function l(h){const f=h.match(i),g={};if(!f)return null;for(let T=1;T<f.length;T++){const A=f[T]||"",B=o[T-1];g[B.name]=A&&B.repeatable?A.split("/"):A}return g}function c(h){let f="",g=!1;for(const T of e){(!g||!f.endsWith("/"))&&(f+="/"),g=!1;for(const A of T)if(A.type===is.Static)f+=A.value;else if(A.type===is.Param){const{value:B,repeatable:q,optional:Q}=A,V=B in h?h[B]:"";if(jr(V)&&!q)throw new Error(`Provided param "${B}" is an array but it is not repeatable (* or + modifiers)`);const R=jr(V)?V.join("/"):V;if(!R)if(Q)T.length<2&&(f.endsWith("/")?f=f.slice(0,-1):g=!0);else throw new Error(`Missing required param "${B}"`);f+=R}}return f||"/"}return{re:i,score:r,keys:o,parse:l,stringify:c}}function nw(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]===Kn.Static+Kn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Kn.Static+Kn.Segment?1:-1:0}function ip(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=nw(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if($d(r))return 1;if($d(s))return-1}return s.length-r.length}function $d(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const rw={strict:!1,end:!0,sensitive:!1};function ow(e,t,n){const r=tw(Xy(e.path),n),s=Ct(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function sw(e,t){const n=[],r=new Map;t=Cd(rw,t);function s(g){return r.get(g)}function o(g,T,A){const B=!A,q=Nd(g);q.aliasOf=A&&A.record;const Q=Cd(t,g),V=[q];if("alias"in g){const Z=typeof g.alias=="string"?[g.alias]:g.alias;for(const fe of Z)V.push(Nd(Ct({},q,{components:A?A.record.components:q.components,path:fe,aliasOf:A?A.record:q})))}let R,W;for(const Z of V){const{path:fe}=Z;if(T&&fe[0]!=="/"){const ye=T.record.path,ee=ye[ye.length-1]==="/"?"":"/";Z.path=T.record.path+(fe&&ee+fe)}if(R=ow(Z,T,Q),A?A.alias.push(R):(W=W||R,W!==R&&W.alias.push(R),B&&g.name&&!Dd(R)&&i(g.name)),lp(R)&&c(R),q.children){const ye=q.children;for(let ee=0;ee<ye.length;ee++)o(ye[ee],R,A&&A.children[ee])}A=A||R}return W?()=>{i(W)}:Ea}function i(g){if(op(g)){const T=r.get(g);T&&(r.delete(g),n.splice(n.indexOf(T),1),T.children.forEach(i),T.alias.forEach(i))}else{const T=n.indexOf(g);T>-1&&(n.splice(T,1),g.record.name&&r.delete(g.record.name),g.children.forEach(i),g.alias.forEach(i))}}function l(){return n}function c(g){const T=lw(g,n);n.splice(T,0,g),g.record.name&&!Dd(g)&&r.set(g.record.name,g)}function h(g,T){let A,B={},q,Q;if("name"in g&&g.name){if(A=r.get(g.name),!A)throw Ws(Jt.MATCHER_NOT_FOUND,{location:g});Q=A.record.name,B=Ct(Od(T.params,A.keys.filter(W=>!W.optional).concat(A.parent?A.parent.keys.filter(W=>W.optional):[]).map(W=>W.name)),g.params&&Od(g.params,A.keys.map(W=>W.name))),q=A.stringify(B)}else if(g.path!=null)q=g.path,A=n.find(W=>W.re.test(q)),A&&(B=A.parse(q),Q=A.record.name);else{if(A=T.name?r.get(T.name):n.find(W=>W.re.test(T.path)),!A)throw Ws(Jt.MATCHER_NOT_FOUND,{location:g,currentLocation:T});Q=A.record.name,B=Ct({},T.params,g.params),q=A.stringify(B)}const V=[];let R=A;for(;R;)V.unshift(R.record),R=R.parent;return{name:Q,path:q,params:B,matched:V,meta:iw(V)}}e.forEach(g=>o(g));function f(){n.length=0,r.clear()}return{addRoute:o,resolve:h,removeRoute:i,clearRoutes:f,getRoutes:l,getRecordMatcher:s}}function Od(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Nd(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:aw(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 aw(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 Dd(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function iw(e){return e.reduce((t,n)=>Ct(t,n.meta),{})}function lw(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;ip(e,t[o])<0?r=o:n=o+1}const s=uw(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function uw(e){let t=e;for(;t=t.parent;)if(lp(t)&&ip(e,t)===0)return t}function lp({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Ld(e){const t=Or(tl),n=Or(fc),r=se(()=>{const c=S(e.to);return t.resolve(c)}),s=se(()=>{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(Vs.bind(null,f));if(T>-1)return T;const A=jd(c[h-2]);return h>1&&jd(f)===A&&g[g.length-1].path!==A?g.findIndex(Vs.bind(null,c[h-2])):T}),o=se(()=>s.value>-1&&pw(n.params,r.value.params)),i=se(()=>s.value>-1&&s.value===n.matched.length-1&&rp(n.params,r.value.params));function l(c={}){if(hw(c)){const h=t[S(e.replace)?"replace":"push"](S(e.to)).catch(Ea);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>h),h}return Promise.resolve()}return{route:r,href:se(()=>r.value.href),isActive:o,isExactActive:i,navigate:l}}function cw(e){return e.length===1?e[0]:e}const dw=Cn({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:Ld,setup(e,{slots:t}){const n=Ki(Ld(e)),{options:r}=Or(tl),s=se(()=>({[Fd(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Fd(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&cw(t.default(n));return e.custom?o:cc("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),fw=dw;function hw(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 pw(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!jr(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function jd(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Fd=(e,t,n)=>e??t??n,mw=Cn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Or(Du),s=se(()=>e.route||r.value),o=Or(Md,0),i=se(()=>{let h=S(o);const{matched:f}=s.value;let g;for(;(g=f[h])&&!g.components;)h++;return h}),l=se(()=>s.value.matched[i.value]);Ei(Md,se(()=>i.value+1)),Ei(Hy,l),Ei(Du,s);const c=P();return ut(()=>[c.value,l.value,e.name],([h,f,g],[T,A,B])=>{f&&(f.instances[g]=h,A&&A!==f&&h&&h===T&&(f.leaveGuards.size||(f.leaveGuards=A.leaveGuards),f.updateGuards.size||(f.updateGuards=A.updateGuards))),h&&f&&(!A||!Vs(f,A)||!T)&&(f.enterCallbacks[g]||[]).forEach(q=>q(h))},{flush:"post"}),()=>{const h=s.value,f=e.name,g=l.value,T=g&&g.components[f];if(!T)return Ud(n.default,{Component:T,route:h});const A=g.props[f],B=A?A===!0?h.params:typeof A=="function"?A(h):A:null,Q=cc(T,Ct({},B,t,{onVnodeUnmounted:V=>{V.component.isUnmounted&&(g.instances[f]=null)},ref:c}));return Ud(n.default,{Component:Q,route:h})||Q}}});function Ud(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const gw=mw;function vw(e){const t=sw(e.routes,e),n=e.parseQuery||By,r=e.stringifyQuery||Id,s=e.history,o=ga(),i=ga(),l=ga(),c=ig(Io);let h=Io;Is&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=Xl.bind(null,K=>""+K),g=Xl.bind(null,Sy),T=Xl.bind(null,La);function A(K,we){let he,Oe;return op(K)?(he=t.getRecordMatcher(K),Oe=we):Oe=K,t.addRoute(Oe,he)}function B(K){const we=t.getRecordMatcher(K);we&&t.removeRoute(we)}function q(){return t.getRoutes().map(K=>K.record)}function Q(K){return!!t.getRecordMatcher(K)}function V(K,we){if(we=Ct({},we||c.value),typeof K=="string"){const H=Zl(n,K,we.path),G=t.resolve({path:H.path},we),oe=s.createHref(H.fullPath);return Ct(H,G,{params:T(G.params),hash:La(H.hash),redirectedFrom:void 0,href:oe})}let he;if(K.path!=null)he=Ct({},K,{path:Zl(n,K.path,we.path).path});else{const H=Ct({},K.params);for(const G in H)H[G]==null&&delete H[G];he=Ct({},K,{params:g(H)}),we.params=g(we.params)}const Oe=t.resolve(he,we),We=K.hash||"";Oe.params=f(T(Oe.params));const k=Ay(r,Ct({},K,{hash:_y(We),path:Oe.path})),E=s.createHref(k);return Ct({fullPath:k,hash:We,query:r===Id?qy(K.query):K.query||{}},Oe,{redirectedFrom:void 0,href:E})}function R(K){return typeof K=="string"?Zl(n,K,c.value.path):Ct({},K)}function W(K,we){if(h!==K)return Ws(Jt.NAVIGATION_CANCELLED,{from:we,to:K})}function Z(K){return ee(K)}function fe(K){return Z(Ct(R(K),{replace:!0}))}function ye(K,we){const he=K.matched[K.matched.length-1];if(he&&he.redirect){const{redirect:Oe}=he;let We=typeof Oe=="function"?Oe(K,we):Oe;return typeof We=="string"&&(We=We.includes("?")||We.includes("#")?We=R(We):{path:We},We.params={}),Ct({query:K.query,hash:K.hash,params:We.path!=null?{}:K.params},We)}}function ee(K,we){const he=h=V(K),Oe=c.value,We=K.state,k=K.force,E=K.replace===!0,H=ye(he,Oe);if(H)return ee(Ct(R(H),{state:typeof H=="object"?Ct({},We,H.state):We,force:k,replace:E}),we||he);const G=he;G.redirectedFrom=we;let oe;return!k&&Ey(r,Oe,he)&&(oe=Ws(Jt.NAVIGATION_DUPLICATED,{to:G,from:Oe}),Ke(Oe,Oe,!0,!1)),(oe?Promise.resolve(oe):Ue(G,Oe)).catch(te=>lo(te)?lo(te,Jt.NAVIGATION_GUARD_REDIRECT)?te:Qe(te):Ee(te,G,Oe)).then(te=>{if(te){if(lo(te,Jt.NAVIGATION_GUARD_REDIRECT))return ee(Ct({replace:E},R(te.to),{state:typeof te.to=="object"?Ct({},We,te.to.state):We,force:k}),we||G)}else te=re(G,Oe,!0,E,We);return Ie(G,Oe,te),te})}function Ae(K,we){const he=W(K,we);return he?Promise.reject(he):Promise.resolve()}function ge(K){const we=et.values().next().value;return we&&typeof we.runWithContext=="function"?we.runWithContext(K):K()}function Ue(K,we){let he;const[Oe,We,k]=Vy(K,we);he=tu(Oe.reverse(),"beforeRouteLeave",K,we);for(const H of Oe)H.leaveGuards.forEach(G=>{he.push(Oo(G,K,we))});const E=Ae.bind(null,K,we);return he.push(E),tt(he).then(()=>{he=[];for(const H of o.list())he.push(Oo(H,K,we));return he.push(E),tt(he)}).then(()=>{he=tu(We,"beforeRouteUpdate",K,we);for(const H of We)H.updateGuards.forEach(G=>{he.push(Oo(G,K,we))});return he.push(E),tt(he)}).then(()=>{he=[];for(const H of k)if(H.beforeEnter)if(jr(H.beforeEnter))for(const G of H.beforeEnter)he.push(Oo(G,K,we));else he.push(Oo(H.beforeEnter,K,we));return he.push(E),tt(he)}).then(()=>(K.matched.forEach(H=>H.enterCallbacks={}),he=tu(k,"beforeRouteEnter",K,we,ge),he.push(E),tt(he))).then(()=>{he=[];for(const H of i.list())he.push(Oo(H,K,we));return he.push(E),tt(he)}).catch(H=>lo(H,Jt.NAVIGATION_CANCELLED)?H:Promise.reject(H))}function Ie(K,we,he){l.list().forEach(Oe=>ge(()=>Oe(K,we,he)))}function re(K,we,he,Oe,We){const k=W(K,we);if(k)return k;const E=we===Io,H=Is?history.state:{};he&&(Oe||E?s.replace(K.fullPath,Ct({scroll:E&&H&&H.scroll},We)):s.push(K.fullPath,We)),c.value=K,Ke(K,we,he,E),Qe()}let de;function De(){de||(de=s.listen((K,we,he)=>{if(!dt.listening)return;const Oe=V(K),We=ye(Oe,dt.currentRoute.value);if(We){ee(Ct(We,{replace:!0,force:!0}),Oe).catch(Ea);return}h=Oe;const k=c.value;Is&&Dy(Ed(k.fullPath,he.delta),el()),Ue(Oe,k).catch(E=>lo(E,Jt.NAVIGATION_ABORTED|Jt.NAVIGATION_CANCELLED)?E:lo(E,Jt.NAVIGATION_GUARD_REDIRECT)?(ee(Ct(R(E.to),{force:!0}),Oe).then(H=>{lo(H,Jt.NAVIGATION_ABORTED|Jt.NAVIGATION_DUPLICATED)&&!he.delta&&he.type===Ou.pop&&s.go(-1,!1)}).catch(Ea),Promise.reject()):(he.delta&&s.go(-he.delta,!1),Ee(E,Oe,k))).then(E=>{E=E||re(Oe,k,!1),E&&(he.delta&&!lo(E,Jt.NAVIGATION_CANCELLED)?s.go(-he.delta,!1):he.type===Ou.pop&&lo(E,Jt.NAVIGATION_ABORTED|Jt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),Ie(Oe,k,E)}).catch(Ea)}))}let qe=ga(),Pe=ga(),_e;function Ee(K,we,he){Qe(K);const Oe=Pe.list();return Oe.length?Oe.forEach(We=>We(K,we,he)):console.error(K),Promise.reject(K)}function Ve(){return _e&&c.value!==Io?Promise.resolve():new Promise((K,we)=>{qe.add([K,we])})}function Qe(K){return _e||(_e=!K,De(),qe.list().forEach(([we,he])=>K?he(K):we()),qe.reset()),K}function Ke(K,we,he,Oe){const{scrollBehavior:We}=e;if(!Is||!We)return Promise.resolve();const k=!he&&Ly(Ed(K.fullPath,0))||(Oe||!he)&&history.state&&history.state.scroll||null;return Xt().then(()=>We(K,we,k)).then(E=>E&&Ny(E)).catch(E=>Ee(E,K,we))}const Be=K=>s.go(K);let pt;const et=new Set,dt={currentRoute:c,listening:!0,addRoute:A,removeRoute:B,clearRoutes:t.clearRoutes,hasRoute:Q,getRoutes:q,resolve:V,options:e,push:Z,replace:fe,go:Be,back:()=>Be(-1),forward:()=>Be(1),beforeEach:o.add,beforeResolve:i.add,afterEach:l.add,onError:Pe.add,isReady:Ve,install(K){K.component("RouterLink",fw),K.component("RouterView",gw),K.config.globalProperties.$router=dt,Object.defineProperty(K.config.globalProperties,"$route",{enumerable:!0,get:()=>S(c)}),Is&&!pt&&c.value===Io&&(pt=!0,Z(s.location).catch(Oe=>{}));const we={};for(const Oe in Io)Object.defineProperty(we,Oe,{get:()=>c.value[Oe],enumerable:!0});K.provide(tl,dt),K.provide(fc,sh(we)),K.provide(Du,c);const he=K.unmount;et.add(K),K.unmount=function(){et.delete(K),et.size<1&&(h=Io,de&&de(),de=null,c.value=Io,pt=!1,_e=!1),he()}}};function tt(K){return K.reduce((we,he)=>we.then(()=>ge(he)),Promise.resolve())}return dt}function yw(){return Or(tl)}function ww(e){return Or(fc)}const Bd=768;function hc(){const e=P(typeof window<"u"?window.innerWidth<Bd:!1);let t=null;function n(r){e.value=r.matches}return Uo(()=>{t=window.matchMedia(`(max-width: ${Bd-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Ji(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const bw={key:0,class:"desktop-sidebar"},_w={class:"desktop-main"},qd="codex-web-local.sidebar-width.v1",Tw=260,kw=620,Hd=320,Sw=Cn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=hc();function r(h){return Math.min(kw,Math.max(Tw,h))}function s(){if(typeof window>"u")return Hd;const h=window.localStorage.getItem(qd),f=Number(h);return Number.isFinite(f)?r(f):Hd}const o=P(s()),i=se(()=>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(qd,String(h))}function c(h){h.preventDefault();const f=h.clientX,g=o.value,T=B=>{const q=B.clientX-f;o.value=r(g+q)},A=()=>{l(o.value),window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",A)}return(h,f)=>(x(),$("div",{class:at(["desktop-layout",{"is-mobile":S(n)}]),style:po(i.value)},[S(n)?(x(),lt(Rs,{key:0,to:"body"},[Fe(Yh,{name:"drawer"},{default:St(()=>[e.isSidebarCollapsed?ue("",!0):(x(),$("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]=ot(()=>{},["stop"]))},[Qr(h.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ue("",!0),S(n)?ue("",!0):(x(),$(He,{key:1},[e.isSidebarCollapsed?ue("",!0):(x(),$("aside",bw,[Qr(h.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ue("",!0):(x(),$("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:c},null,32))],64)),m("section",_w,[Qr(h.$slots,"content",{},void 0)])],6))}}),yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Cw=yt(Sw,[["__scopeId","data-v-4c6dbcd7"]]);function Vd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Zr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Bo(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Vd(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=Vd(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function wo(e,t,n){return e instanceof Zr?e:e instanceof Error?new Zr(e.message||t,{code:"unknown_error",method:n}):new Zr(t,{code:"unknown_error",method:n})}function up(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function xw(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 Zr(l instanceof Error?l.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let s=null,o=null;try{o=await r.text(),s=JSON.parse(o)}catch{s=null}if(!r.ok){const l=Bo(s,"")||(o==null?void 0:o.slice(0,500))||"",c=`RPC ${e} failed with HTTP ${r.status}`;throw new Zr(l?`${c}: ${l}`:c,{code:"http_error",method:e,status:r.status})}const i=s;if(!i||typeof i!="object"||!("result"in i))throw new Zr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return i.result}async function Aw(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Zr(Bo(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 Ew(e){const t=up(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 Wd(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Iw(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{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)},i=h=>{const f=Ew(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{i(JSON.parse(T.data))}catch{}},f.addEventListener("ready",T=>{try{const A=T.data?JSON.parse(T.data):{ok:!0};Wd(e,A)}catch{Wd(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,A=!1,B=window.setTimeout(()=>{T||n||A||(A=!0,g.close(),l())},2500);g.onopen=()=>{T=!0,s(),B!==null&&(window.clearTimeout(B),B=null)},g.onmessage=q=>{try{i(JSON.parse(String(q.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(B!==null&&(window.clearTimeout(B),B=null),!(n||A)){if(!T){l();return}o(()=>c(h+1),h)}},t=()=>{A=!0,B!==null&&(window.clearTimeout(B),B=null),g.close()}};return typeof WebSocket<"u"?c():l(),()=>{n=!0,s(),t==null||t()}}async function Mw(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 Zr(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 Zr(Bo(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Pw(){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 Zr(Bo(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=up(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function Rw(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function rn(e){return Rw(e)}function $w(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function Ow(e){const t=rn(e).replace(/[\\/]+/gu,"/");return $w(t)?t.toLowerCase():t}function rs(e){const t=rn(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function nu(e){const t=rn(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Ha(e){return rs(e)||rn(e)||"unknown-project"}function zd(e){return new Date(e*1e3).toISOString()}function Nw(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Dw=/^##\s+(.+?):\s+(.+?)\s*$/,Lw=/^#\s*files mentioned by the user\s*:?\s*$/i;function jw(e){var s,o;const t=e.split(`
|
|
27
|
-
`).findIndex(i=>Lw.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
-
`).slice(t+1),r=[];for(const i of n){const l=i.trim();if(!l)continue;const c=l.match(Dw);if(!c)break;const h=(s=c[1])==null?void 0:s.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 Fw(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 s=r.index+r[0].length;return e.slice(s).trim()}function cp(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function Uw(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 Gd(e,t){var r;const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return((r=n==null?void 0:n[1])==null?void 0:r.trim())??""}function Bw(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Gd(t,"instructions");return n?{automationId:Gd(t,"automation_id"),instructions:n}:null}function qw(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],s=[];for(const[c,h]of t.entries())h.type==="text"&&typeof h.text=="string"&&h.text.length>0&&n.push(h.text),h.type==="image"&&typeof h.url=="string"&&h.url.trim().length>0&&r.push(h.url.trim()),h.type==="localImage"&&typeof h.path=="string"&&h.path.trim().length>0&&r.push(cp(h.path.trim())),h.type!=="text"&&h.type!=="image"&&h.type!=="localImage"&&s.push({id:`${e}:user-content:${c}`,role:"user",text:"",messageType:`userContent.${h.type}`,rawPayload:Nw(h),isUnhandled:!0});const o=n.join(`
|
|
29
|
-
`),i=jw(o),l=Bw(o);return{text:(l==null?void 0:l.instructions)??Fw(o),images:r,fileAttachments:i,rawBlocks:s,isAutomationRun:l!==null,automationDisplayName:(l==null?void 0:l.automationId)||null}}function Hw(e){var o;const t=e.replace(/\r\n/g,`
|
|
30
|
-
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
-
`),r=[],s=[];for(const i of n){const l=i.trim();if(!l){r.length===0&&s.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}s.push(l)}return r.length===0?null:{explanation:s.join(`
|
|
32
|
-
`).trim()||void 0,steps:r}}function Kd(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 Vw(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 dp(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function fp(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const s=r,o=typeof s.path=="string"?s.path:"",i=typeof s.diff=="string"?s.diff:"",l=s.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"?Vw(i):c==="add"?{addedLineCount:Kd(i),removedLineCount:0}:{addedLineCount:0,removedLineCount:Kd(i)};n.push({path:o,operation:c,movedToPath:h,diff:i,...f})}return n}function Ww(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=qw(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:t.isAutomationRun?"system":"user",text:t.text,images:t.images,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:[cp(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?Uw(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:Hw(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=zw(t.status),r=typeof t.command=="string"?t.command:"",s=typeof t.cwd=="string"?t.cwd:null,o=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",i=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:s,status:n,aggregatedOutput:o,exitCode:i}}]}if(e.type==="fileChange"){const t=fp(e.changes),n=dp(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return[]}function zw(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Gw(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 Kw(e){const t=Gw(e);return t.length>0?t:"Untitled thread"}function pc(e){return(e==null?void 0:e.status)==="inProgress"}function Yw(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 pc(r)}function Jw(e){const t=e,n=rn(typeof t.cwd=="string"?t.cwd:e.cwd),r=Ow(n),s=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:Kw(e),projectName:Ha(n),cwd:n,hasWorktree:s,createdAtIso:zd(e.createdAt),updatedAtIso:zd(e.updatedAt),preview:e.preview,unread:!1,inProgress:Yw(e)}}function Qw(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((s,o)=>new Date(o.updatedAtIso).getTime()-new Date(s.updatedAtIso).getTime())})).sort((n,r)=>{var i,l;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((l=r.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-s})}function Xw(e){const t=e.data.map(Jw);return Qw(t)}function nl(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const s=t[r],o=typeof(s==null?void 0:s.id)=="string"?s.id:void 0,i=Array.isArray(s.items)?s.items:[];for(const l of i)for(const c of Ww(l))n.push({...c,turnId:o,turnIndex:r})}return n}function hp(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return pc(t.at(-1))}function pp(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(pc(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const Zw=5e3;function ru(e){return e&&e.length>0?e:null}function ou(e){return e&&e.length>0?e:null}const Yd=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Jd(e,t){const n=t.trim();if(!n)return"";const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),[s="",o=""]=e.split("/",2),i=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=s&&o?`${i}\\s*/\\s*${l}`:r;return n.replace(/^[★☆*\s:|\-]+/u,"").replace(/^(sponsor|star)\s+/i,"").replace(new RegExp(`^${r}\\s*[-:|]*\\s*`,"i"),"").replace(new RegExp(`^${c}\\s*[-:|]*\\s*`,"i"),"").replace(/^(sponsor|star)\s+/i,"").trim()}function st(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function le(e){return typeof e=="string"&&e.length>0?e:null}function fn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function br(e){return typeof e=="boolean"?e:null}function $s(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function eb(e){return e==="payment_required"?e:null}function tb(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Qd(e){const t=st(e);if(!t)return null;const n=fn(t.usedPercent??t.used_percent);if(n===null)return null;const r=fn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:fn(t.resetsAt??t.resets_at)}}function nb(e){const t=st(e);if(!t)return null;const n=br(t.hasCredits??t.has_credits),r=br(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:le(t.balance)}}function Lu(e){const t=st(e);if(!t)return null;const n=Qd(t.primary),r=Qd(t.secondary),s=nb(t.credits);return!n&&!r&&!s?null:{limitId:le(t.limitId??t.limit_id),limitName:le(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:le(t.planType??t.plan_type)}}function mp(e,t=null){const n=st(e);if(!n)return null;const r=le(n.accountId),s=le(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:le(n.authMode),email:le(n.email),planType:le(n.planType),lastRefreshedAtIso:le(n.lastRefreshedAtIso)??"",lastActivatedAtIso:le(n.lastActivatedAtIso),quotaSnapshot:Lu(n.quotaSnapshot),quotaUpdatedAtIso:le(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:le(n.quotaError),unavailableReason:eb(n.unavailableReason)??(tb(le(n.quotaError))?"payment_required":null),isActive:br(n.isActive)??r===t}:null}function gp(e){const t=st(e);if(!t)return null;const n=st(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Lu(n==null?void 0:n.codex);return r||Lu(t.rateLimits??t.rate_limits)}async function Et(e,t){try{return await xw(e,t)}catch(n){throw wo(n,`RPC ${e} failed`,e)}}function vp(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n={};for(let r=0;r<t.length;r+=1){const s=t[r];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(n[s.id]=r)}return n}function rb(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function ob(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const sb=50,ab=100;async function ib(e,t){const n=await Et("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:Xw(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function lb(e){const t=await Et("thread/read",{threadId:e,includeTurns:!0});return{messages:nl(t),inProgress:hp(t),activeTurnId:pp(t),turnIndexByTurnId:vp(t)}}async function Xd(e=null,t=sb){try{return await ib(e,t)}catch(n){throw wo(n,"Failed to load thread groups","thread/list")}}function ub(){return ab}async function Zd(e){try{return await lb(e)}catch(t){throw wo(t,`Failed to load thread ${e}`,"thread/read")}}function cb(e){const t=st(e);if(!t)return null;const n=le(t.key),r=typeof t.text=="string"?t.text:"",s=le(t.kind);return!n||!s||s!=="meta"&&s!=="hunk"&&s!=="add"&&s!=="remove"&&s!=="context"?null:{key:n,kind:s,text:r,oldLine:fn(t.oldLine),newLine:fn(t.newLine)}}function db(e){const t=st(e);if(!t)return null;const n=le(t.id),r=typeof t.header=="string"?t.header:"",s=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:s,addedLineCount:fn(t.addedLineCount)??0,removedLineCount:fn(t.removedLineCount)??0,oldStart:fn(t.oldStart),oldLineCount:fn(t.oldLineCount)??0,newStart:fn(t.newStart),newLineCount:fn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(o=>cb(o)).filter(o=>o!==null):[]}:null}function fb(e){const t=st(e);if(!t)return null;const n=le(t.id),r=le(t.path),s=le(t.absolutePath),o=le(t.operation);return!n||!r||!s||!o||o!=="add"&&o!=="delete"&&o!=="update"&&o!=="rename"?null:{id:n,path:r,absolutePath:s,previousPath:le(t.previousPath),previousAbsolutePath:le(t.previousAbsolutePath),operation:o,addedLineCount:fn(t.addedLineCount)??0,removedLineCount:fn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(i=>db(i)).filter(i=>i!==null):[]}}function yp(e){const t=st(e),n=st(t==null?void 0:t.data),r=st(n==null?void 0:n.summary),s=le(n==null?void 0:n.scope)==="baseBranch"?"baseBranch":"workspace",o=le(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:le(n==null?void 0:n.cwd)??"",gitRoot:le(n==null?void 0:n.gitRoot),isGitRepo:br(n==null?void 0:n.isGitRepo)??!1,scope:s,workspaceView:o,baseBranch:le(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>le(i)).filter(i=>typeof i=="string"&&i.length>0):[],headBranch:le(n==null?void 0:n.headBranch),mergeBaseSha:le(n==null?void 0:n.mergeBaseSha),generatedAtIso:le(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:fn(r==null?void 0:r.fileCount)??0,addedLineCount:fn(r==null?void 0:r.addedLineCount)??0,removedLineCount:fn(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>fb(i)).filter(i=>i!==null):[]}}function hb(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 pb(e){var i;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,s=n>=0?t.slice(n).trim():"",o=[];if(s){const c=s.replace(/^(?:Full review comments|Review comment):\n*/iu,"").trim().matchAll(/^- (.+?) — (.+)\n?((?: .*(?:\n|$))*)/gmu);let h=0;for(const f of c){const g=((i=f[1])==null?void 0:i.trim())??"",T=hb(f[2]??""),A=(f[0]??"").trim(),B=(f[3]??"").split(`
|
|
39
|
-
`).map(q=>q.replace(/^ /u,"")).join(`
|
|
40
|
-
`).trim();o.push({id:`finding:${h}`,title:g||`Finding ${h+1}`,body:B,path:T.absolutePath?T.absolutePath.split("/").filter(Boolean).slice(-1)[0]??T.absolutePath:null,absolutePath:T.absolutePath,startLine:T.startLine,endLine:T.endLine,rawText:A}),h+=1}}return{reviewText:t,summary:r,findings:o}}function ef(e,t){const n=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let r=n.length-1;r>=0;r-=1){const s=n[r],o=Array.isArray(s==null?void 0:s.items)?s.items:[];for(let i=o.length-1;i>=0;i-=1){const l=o[i];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 pI(e){const t=await Et("thread/read",{threadId:e,includeTurns:!0}),n=ef(t,"exitedReviewMode");return{enteredReviewLabel:ef(t,"enteredReviewMode"),result:n?pb(n):null}}async function mI(){return Aw()}function wp(e){const t=st(e);if(!t)return null;const n=le(t.id),r=le(t.kind),s=le(t.name),o=le(t.prompt),i=le(t.rrule),l=le(t.status);return!n||!s||!o||!i||r!=="heartbeat"&&r!=="cron"||l!=="ACTIVE"&&l!=="PAUSED"?null:{id:n,kind:r,name:s,prompt:o,rrule:i,status:l,targetThreadId:le(t.targetThreadId),createdAtMs:fn(t.createdAtMs),updatedAtMs:fn(t.updatedAtMs),nextRunAtMs:fn(t.nextRunAtMs)}}async function mb(){var s;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Bo(t,"Failed to load thread automations"));const n=st((s=st(t))==null?void 0:s.data),r={};if(!n)return r;for(const[o,i]of Object.entries(n)){const l=wp(i);l&&(r[o]=l)}return r}async function gb(e){var s;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(Bo(n,"Failed to save thread automation"));const r=wp((s=st(n))==null?void 0:s.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function tf(e){const t=await fetch(`/codex-api/thread-automation?threadId=${encodeURIComponent(e)}`,{method:"DELETE"}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(Bo(n,"Failed to delete thread automation"))}function vb(e){return Iw(e)}function yb(e){const t=st(e);if(!t)return null;const n=le(t.id),r=le(t.threadId),s=le(t.cwd),o=le(t.shell);return!n||!r||!s||!o?null:{id:n,threadId:r,cwd:s,shell:o,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:br(t.truncated)??!1}}async function Va(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(Bo(r,`Terminal request failed with HTTP ${n.status}`));return r}async function gI(e){var r;const t=await Va("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=yb((r=st(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function wb(){const e=await Va("/codex-api/thread-terminal/status"),t=st(e);return{available:br(t==null?void 0:t.available)??!1,reason:le(t==null?void 0:t.reason)||null}}async function vI(e,t){await Va("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function yI(e,t,n){await Va("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function wI(e){await Va("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function bb(e,t){await Mw({id:e,...t})}async function _b(){return Pw()}async function Tb(){try{const e=await Et("account/rateLimits/read");return gp(e)}catch(e){throw wo(e,"Failed to load account rate limits","account/rateLimits/read")}}function mc(e){const t=st(e),n=le(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:le(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>mp(s,n)).filter(s=>s!==null)}}async function kb(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Nn(t,"Failed to load accounts"));const n=st(t);return mc(n==null?void 0:n.data)}async function Sb(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Nn(t,"Failed to refresh accounts"));const n=st(t);return mc(n==null?void 0:n.data)}async function Cb(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(Nn(n,"Failed to switch account"));const r=st(n),s=st(r==null?void 0:r.data),o=mp(s==null?void 0:s.account,le(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function xb(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(Nn(n,"Failed to remove account"));const r=st(n);return mc(r==null?void 0:r.data)}async function su(e){const t=await Et("thread/resume",{threadId:e});return{model:ji(t),messages:nl(t),inProgress:hp(t),activeTurnId:pp(t),turnIndexByTurnId:vp(t)}}async function Ab(e){await Et("thread/archive",{threadId:e})}async function Eb(e,t){await Et("thread/name/set",{threadId:e,name:t})}async function au(e,t){const n=await Et("thread/rollback",{threadId:e,numTurns:t});return nl(n)}async function Ib(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 ju(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 Mb(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 ji(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}async function nf(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 Et("thread/start",n),s=ju(r);if(!s)throw new Error("thread/start did not return a thread id");return{threadId:s,model:ji(r)}}catch(n){throw wo(n,"Failed to start a new thread","thread/start")}}async function rf(e,t,n){if(arguments.length<=1)try{const r=await Et("thread/fork",{threadId:e,persistExtendedHistory:!0}),s=ju(r);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,cwd:Mb(r),model:ji(r),messages:nl(r)}}catch(r){throw wo(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const s={threadId:r};typeof t=="string"&&t.trim().length>0&&(s.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(s.model=n.trim());const o=await Et("thread/fork",s),i=ju(o);if(!i)throw new Error("thread/fork did not return a thread id");return{threadId:i,model:ji(o)}}catch(r){throw wo(r,`Failed to fork thread ${e}`,"thread/fork")}}function of(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 Pb(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 Rb(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function $b(e,t,n){var c;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?ru(n):ou(n)};let s=null;try{s=await _p()}catch{s=null}const o=(s==null?void 0:s.model.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?ru(n??(s==null?void 0:s.reasoningEffort)):ou(n??(s==null?void 0:s.reasoningEffort))};let i=[];try{i=await bp()}catch{i=[]}const l=((c=i.find(h=>h.trim().length>0))==null?void 0:c.trim())??"";if(l)return{model:l,reasoningEffort:e==="plan"?ru(n??(s==null?void 0:s.reasoningEffort)):ou(n??(s==null?void 0:s.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function iu(e,t,n=[],r,s,o,i=[],l){var c;try{const h=(r==null?void 0:r.trim())??"",f=[];for(const R of n){const W=of(R.trim());W&&f.push({label:Rb(W),path:W,fsPath:W})}const g=[...i,...f],T=g.filter((R,W)=>g.findIndex(Z=>Z.fsPath===R.fsPath)===W),B=[{type:"text",text:Pb(t,T)}];for(const R of n){const W=R.trim();if(!W)continue;const Z=of(W);if(Z){B.push({type:"localImage",path:Z});continue}B.push({type:"image",url:W,image_url:W})}if(o)for(const R of o)B.push({type:"skill",name:R.name,path:R.path});const q=T.map(R=>({label:R.label,path:R.path,fsPath:R.fsPath})),Q={threadId:e,input:B};if(q.length>0&&(Q.attachments=q),h&&(Q.model=h),typeof s=="string"&&s.length>0&&(Q.effort=s),l&&l!=="default"){const R=await $b(l,h,s);Q.collaborationMode={mode:l,settings:{model:R.model,reasoning_effort:R.reasoningEffort,developer_instructions:null}}}const V=await Et("turn/start",Q);return typeof((c=V==null?void 0:V.turn)==null?void 0:c.id)=="string"?V.turn.id.trim():""}catch(h){throw wo(h,`Failed to start turn for thread ${e}`,"turn/start")}}async function Ob(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 Et("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw wo(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function Nb(e){const t=e==="fast"?"fast":"standard";await Et("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 Db(){return await(await fetch("/codex-api/free-mode/status")).json()}async function sf(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function af(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 Cs(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 bp(e={}){const t=await Et("model/list",{}),n=[];for(const r of t.data){const s=r.id||r.model;!s||n.includes(s)||n.push(s)}if(e.includeProviderModels===!1)return n;try{const r=await fetch("/codex-api/provider-models",{signal:AbortSignal.timeout(Zw)});let s=null;try{s=await r.json()}catch{s=null}if(r.ok&&Array.isArray(s==null?void 0:s.data)){if(s.exclusive)return s.data.filter(o=>typeof o=="string"&&o.trim().length>0);for(const o of s.data){if(typeof o!="string")continue;const i=o.trim();!i||n.includes(i)||n.push(i)}}}catch{}return n}async function _p(){const e=await Et("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=rb(e.config.model_reasoning_effort),s=ob(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:s}}function Tp(e){const t=st(e);if(!t)return null;const n=le(t.id),r=le(t.name);return!n||!r?null:{id:n,name:r,description:le(t.description)??"",installUrl:le(t.installUrl??t.install_url)??"",needsAuth:br(t.needsAuth??t.needs_auth)??!1}}function Lb(e){const t=st(e);if(!t)return null;const n=le(t.name),r=le(t.path);if(!n||!r)return null;const s=st(t.interface);return{name:n,path:r,description:le(t.description)??"",enabled:br(t.enabled)??!0,displayName:le((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??n,shortDescription:le(t.shortDescription??t.short_description)??""}}function kp(e,t={}){const n=st(e);if(!n)return null;const r=le(n.id),s=le(n.name);if(!r||!s)return null;const o=st(n.interface),i=st(n.source),l=le(i==null?void 0:i.type)??"",c=le(i==null?void 0:i.path),h=le(i==null?void 0:i.url)??"",f=l==="remote"?t.name??null:null,g=t.path??(l==="local"?c:null),T=le((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??s,A=le((o==null?void 0:o.shortDescription)??(o==null?void 0:o.short_description)),B=le((o==null?void 0:o.longDescription)??(o==null?void 0:o.long_description))??"";return{id:r,name:s,displayName:T,description:A??B,longDescription:B,developerName:le((o==null?void 0:o.developerName)??(o==null?void 0:o.developer_name))??"",category:le(o==null?void 0:o.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:g,remoteMarketplaceName:f,sourceType:l,sourceUrl:h,installed:br(n.installed)??!1,enabled:br(n.enabled)??!0,installPolicy:le(n.installPolicy??n.install_policy)??"",authPolicy:le(n.authPolicy??n.auth_policy)??"",logoUrl:le((o==null?void 0:o.logoUrl)??(o==null?void 0:o.logo_url))??"",logoPath:le(o==null?void 0:o.logo)??"",composerIconUrl:le((o==null?void 0:o.composerIconUrl)??(o==null?void 0:o.composer_icon_url))??"",composerIconPath:le((o==null?void 0:o.composerIcon)??(o==null?void 0:o.composer_icon))??"",brandColor:le((o==null?void 0:o.brandColor)??(o==null?void 0:o.brand_color))??"",capabilities:$s(o==null?void 0:o.capabilities),defaultPrompt:$s((o==null?void 0:o.defaultPrompt)??(o==null?void 0:o.default_prompt)),screenshotUrls:$s((o==null?void 0:o.screenshotUrls)??(o==null?void 0:o.screenshot_urls)),screenshots:$s(o==null?void 0:o.screenshots),websiteUrl:le((o==null?void 0:o.websiteUrl)??(o==null?void 0:o.website_url))??"",privacyPolicyUrl:le((o==null?void 0:o.privacyPolicyUrl)??(o==null?void 0:o.privacy_policy_url))??"",termsOfServiceUrl:le((o==null?void 0:o.termsOfServiceUrl)??(o==null?void 0:o.terms_of_service_url))??""}}function jb(e,t=0){const n=st(e);if(!n)return null;const r=le(n.id),s=le(n.name);if(!r||!s)return null;const o=st(n.branding),i=st(n.appMetadata??n.app_metadata);return{id:r,name:s,description:le(n.description)??le((i==null?void 0:i.seoDescription)??(i==null?void 0:i.seo_description))??"",logoUrl:le(n.logoUrl??n.logo_url)??"",logoUrlDark:le(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:le(n.distributionChannel??n.distribution_channel)??"",installUrl:le(n.installUrl??n.install_url)??"",isAccessible:br(n.isAccessible??n.is_accessible)??!1,isEnabled:br(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:$s(n.pluginDisplayNames??n.plugin_display_names),category:le(o==null?void 0:o.category)??"",developer:le(o==null?void 0:o.developer)??le(i==null?void 0:i.developer)??"",website:le(o==null?void 0:o.website)??"",privacyPolicy:le((o==null?void 0:o.privacyPolicy)??(o==null?void 0:o.privacy_policy))??"",termsOfService:le((o==null?void 0:o.termsOfService)??(o==null?void 0:o.terms_of_service))??"",catalogRank:t}}function Fb(e){const t=st(e);if(!t)return null;const n=le(t.name);if(!n)return null;const r=st(t.tools)??{},s=Object.entries(r).map(([c,h])=>{const f=st(h);return{name:le(f==null?void 0:f.name)??c,title:le(f==null?void 0:f.title)??"",description:le(f==null?void 0:f.description)??""}}),o=Array.isArray(t.resources)?t.resources.map(c=>{const h=st(c);return{name:le(h==null?void 0:h.name)??"",title:le(h==null?void 0:h.title)??"",uri:le(h==null?void 0:h.uri)??"",description:le(h==null?void 0:h.description)??""}}).filter(c=>c.name||c.uri):[],i=t.resourceTemplates??t.resource_templates,l=Array.isArray(i)?i.map(c=>{const h=st(c);return{name:le(h==null?void 0:h.name)??"",title:le(h==null?void 0:h.title)??"",uriTemplate:le((h==null?void 0:h.uriTemplate)??(h==null?void 0:h.uri_template))??"",description:le(h==null?void 0:h.description)??""}}).filter(c=>c.name||c.uriTemplate):[];return{name:n,authStatus:le(t.authStatus??t.auth_status)??"unsupported",tools:s,resources:o,resourceTemplates:l}}async function bI(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await Et("plugin/list",t),r=[];for(const s of n.marketplaces??[]){const o=st(s);if(!o)continue;const i=st(o.interface),l={name:le(o.name)??"",displayName:le((i==null?void 0:i.displayName)??(i==null?void 0:i.display_name))??"",path:le(o.path)},c=Array.isArray(o.plugins)?o.plugins:[];for(const h of c){const f=kp(h,l);f&&r.push(f)}}return r}async function _I(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await Et("plugin/read",t),r=st(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const s=kp(r.summary,{name:le(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:le(r.marketplacePath)??e.marketplacePath})??e;return{summary:s,description:le(r.description)??s.longDescription,apps:Array.isArray(r.apps)?r.apps.map(Tp).filter(o=>o!==null):[],skills:Array.isArray(r.skills)?r.skills.map(Lb).filter(o=>o!==null):[],mcpServers:$s(r.mcpServers??r.mcp_servers)}}async function TI(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await Et("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:le(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(Tp).filter(s=>s!==null)}}async function kI(e){await Et("plugin/uninstall",{pluginId:e})}async function SI(e,t){await Et("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function CI(e){const t=[];let n=null,r=0;do{const s={limit:100};n&&(s.cursor=n),e&&(s.threadId=e);const o=await Et("app/list",s);for(const i of o.data??[]){const l=jb(i,r);l&&t.push(l),r+=1}n=le(o.nextCursor??o.next_cursor)}while(n);return t}async function xI(e,t){await Et("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function AI(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await Et("mcpServerStatus/list",n);for(const s of r.data??[]){const o=Fb(s);o&&e.push(o)}t=le(r.nextCursor??r.next_cursor)}while(t);return e}async function EI(){await Et("config/mcpServer/reload",{})}async function II(e){const t=await Et("mcpServer/oauth/login",{name:e});return{authorizationUrl:le(t.authorizationUrl??t.authorization_url)??""}}function Ub(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function Bb(){try{const e=await Et("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const s=r.mode;s!=="default"&&s!=="plan"||t.has(s)||(t.add(s),n.push({value:s,label:Ub(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of Yd)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return Yd}function qb(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const l of o)typeof l=="string"&&l.length>0&&!i.includes(l)&&i.push(l);return i},r=t.labels,s={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,i]of Object.entries(r)){const l=typeof o=="string"?rn(o):"";l.length>0&&typeof i=="string"&&(s[l]=i)}return{order:n(t.order).map(o=>rn(o)),labels:s,active:n(t.active).map(o=>rn(o))}}async function Ms(){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 qb(n.data)}async function Hb(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})}),s=await r.json();if(!r.ok||!s.data)throw new Error(s.error||"Failed to create worktree");return{...s.data,cwd:rn(s.data.cwd),gitRoot:rn(s.data.gitRoot)}}async function Vb(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),s=await r.json();if(!r.ok)throw new Error(s.error||"Failed to load branches");const o=Array.isArray(s.data)?s.data:[],i=[],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),i.push({value:f,label:g||f}))}return i}async function Wb(e){const t=e.trim();if(!t)return{currentBranch:null,options:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),s=await r.json();if(!r.ok)throw new Error(s.error||"Failed to load Git branch state");const o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{},i=o.currentBranch,l=typeof i=="string"&&i.trim()?i.trim():null,c=Array.isArray(o.options)?o.options:[],h=[],f=new Set;for(const g of c){if(!g||typeof g!="object"||Array.isArray(g))continue;const T=g,A=typeof T.value=="string"?T.value.trim():"",B=typeof T.label=="string"?T.label.trim():"";!A||f.has(A)||(f.add(A),h.push({value:A,label:B||A}))}return l&&!f.has(l)&&h.unshift({value:l,label:l}),{currentBranch:l,options:h}}async function zb(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 s=(o=r.data)==null?void 0:o.currentBranch;return typeof s=="string"&&s.trim()?s.trim():null}async function MI(e,t,n,r){const s=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&s.set("baseBranch",r.trim());const o=await fetch(`/codex-api/review/snapshot?${s.toString()}`),i=await o.json();if(!o.ok)throw new Error(Nn(i,"Failed to load review snapshot"));return yp(i)}async function PI(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(Nn(n,"Failed to apply review action"));return yp(n)}async function RI(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(Nn(n,"Failed to initialize Git"))}async function $I(e,t,n,r){const s=t==="baseBranch"?{type:"baseBranch",branch:(r??"").trim()}:{type:"uncommittedChanges"};if(s.type==="baseBranch"&&!s.branch)throw new Error("Base branch is unavailable");await Et("review/start",{threadId:e,target:s,delivery:"inline"})}async function lf(){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 Gb(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()}`),s=await Sp(r);if(!r.ok){const c=Nn(s,"Failed to load local directories");throw new Error(c)}const o=s&&typeof s=="object"&&!Array.isArray(s)?s:{},i=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},l=Array.isArray(i.entries)?i.entries:[];return{path:typeof i.path=="string"?rn(i.path):"",parentPath:typeof i.parentPath=="string"?rn(i.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"?rn(h.path):"";return f&&g?[{name:f,path:g}]:[]})}}async function Sp(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 lu(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")}async function uu(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=Nn(r,"Failed to open project root");throw new Error(l)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return typeof o.path=="string"?rn(o.path):""}async function Kb(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Sp(t);if(!t.ok){const o=Nn(n,"Failed to create local directory");throw new Error(o)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof s.path=="string"?rn(s.path):""}async function Yb(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 i=Nn(r,"Failed to suggest project name");throw new Error(i)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?rn(o.path):""}}async function Jb(e,t,n=20){const r=e.trim();if(!r)return[];const s=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 s.json();if(!s.ok){const h=Nn(o,"Failed to search files");throw new Error(h)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},l=Array.isArray(i.data)?i.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 Qb(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 Xb(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 s=Nn(r,"Failed to connect Telegram bot");throw new Error(s)}}async function Zb(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const i=Nn(t,"Failed to load Telegram configuration");throw new Error(i)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},s=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],o=[];for(const i of s){if(i==="*"){o.push("*");continue}typeof i=="number"&&Number.isFinite(i)&&o.push(Math.trunc(i))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:o}}async function e0(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const s=Nn(t,"Failed to load Telegram status");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:{};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 t0(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}async function n0(e,t=6){const n=Math.min(10,Math.max(1,Math.floor(t)));if(e.startsWith("search-")){const f=new Date;e==="search-daily"?f.setUTCDate(f.getUTCDate()-1):e==="search-weekly"?f.setUTCDate(f.getUTCDate()-7):f.setUTCDate(f.getUTCDate()-30);const g=new URLSearchParams({q:`created:>=${t0(f)}`,sort:"stars",order:"desc",per_page:String(n)}),T=await fetch(`https://api.github.com/search/repositories?${g.toString()}`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});if(!T.ok)throw new Error(`Failed to fetch GitHub search projects (${T.status})`);const A=await T.json(),B=A&&typeof A=="object"&&!Array.isArray(A)?A:{},q=Array.isArray(B.items)?B.items:[],Q=[];for(const V of q){if(!V||typeof V!="object"||Array.isArray(V))continue;const R=V,W=typeof R.id=="number"?R.id:0,Z=typeof R.full_name=="string"?R.full_name.trim():"",fe=typeof R.html_url=="string"?R.html_url.trim():"";if(!W||!Z||!fe)continue;const[ye="",ee=""]=Z.split("/",2);Q.push({id:W,fullName:Z,owner:ye,repo:ee,url:fe,description:Jd(Z,typeof R.description=="string"?R.description:""),language:typeof R.language=="string"?R.language.trim():"",stars:typeof R.stargazers_count=="number"?R.stargazers_count:0})}return Q}const r=e==="trending-daily"?"daily":e==="trending-weekly"?"weekly":"monthly",s=new URLSearchParams({since:r,limit:String(n)}),o=await fetch(`/codex-api/github-trending?${s.toString()}`),i=await o.json();if(!o.ok){const f=Nn(i,"Failed to fetch GitHub trending projects");throw new Error(f)}const l=i&&typeof i=="object"&&!Array.isArray(i)?i:{},c=Array.isArray(l.data)?l.data:[],h=[];for(const f of c){if(!f||typeof f!="object"||Array.isArray(f))continue;const g=f,T=typeof g.id=="number"?g.id:0,A=typeof g.fullName=="string"?g.fullName.trim():"",B=typeof g.url=="string"?g.url.trim():"";if(!T||!A||!B)continue;const[q="",Q=""]=A.split("/",2);h.push({id:T,fullName:A,owner:q,repo:Q,url:B,description:Jd(A,typeof g.description=="string"?g.description:""),language:typeof g.language=="string"?g.language.trim():"",stars:typeof g.stars=="number"?g.stars:0})}return h}function Nn(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 s=n.error;return typeof s=="string"&&s.trim().length>0?s:t}async function r0(){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 cu(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 o0(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function s0(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function a0(e,t){var n;try{return((n=(await Et("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function i0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await Et("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}const l0=6e4;async function du(e){const t=new AbortController,n=setTimeout(()=>t.abort(),l0);try{const r=new FormData;r.append("file",e);const s=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return s.ok?(await s.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}const u0={},c0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function d0(e,t){return x(),$("svg",c0,[...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 gc=yt(u0,[["render",d0]]),f0={},h0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function p0(e,t){return x(),$("svg",h0,[...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 m0=yt(f0,[["render",p0]]),g0={},v0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function y0(e,t){return x(),$("svg",v0,[...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 va=yt(g0,[["render",y0]]),w0={},b0={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function _0(e,t){return x(),$("svg",b0,[...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 Fi=yt(w0,[["render",_0]]),T0={},k0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function S0(e,t){return x(),$("svg",k0,[...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 vc=yt(T0,[["render",S0]]),C0={},x0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function A0(e,t){return x(),$("svg",x0,[...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 E0=yt(C0,[["render",A0]]),I0={},M0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function P0(e,t){return x(),$("svg",M0,[...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 Mi=yt(I0,[["render",P0]]),R0={},$0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function O0(e,t){return x(),$("svg",$0,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 4.5l-4 4L7 10l-1.5 1.5l7 7L14 17l1.5-4l4-4M9 15l-4.5 4.5M14.5 4L20 9.5"},null,-1)])])}const fu=yt(R0,[["render",O0]]),Cp="codex-web-local.ui-language.v1",N0={English:"English","Simplified Chinese":"简体中文","Search threads":"搜索线程","Filter threads...":"筛选线程...","Clear search":"清除搜索","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":"语音输入后自动发送","GitHub trending projects":"GitHub 热门项目",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":"切换终端","Search branches...":"搜索分支...","Let's build":"开始构建","Choose folder":"选择文件夹","Quick search project":"快速搜索项目","Selected folder":"已选文件夹","Select folder":"选择文件夹","Create Project":"创建项目","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":"新工作树","Trending GitHub projects":"GitHub 热门项目","Loading trending projects...":"加载热门项目中...","Trending repos are unavailable right now.":"当前无法获取热门仓库。","No description available.":"暂无描述。","Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui":"欢迎使用 codexui。npm: https://www.npmjs.com/package/@nervmor/codexui","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...":"搜索技能...",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:"提示词","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":"还没有类型","Browse and discover skills from the OpenClaw community":"浏览并发现来自 OpenClaw 社区的技能","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})","Search skills... (e.g. flight, docker, react)":"搜索技能...(例如 flight、docker、react)",Search:"搜索","{count} skills":"{count} 个技能","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...",'No skills found for "{query}"':"未找到“{query}”相关技能","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":"刷新账户失败","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, / for skills)":"输入消息...(@ 选择文件,/ 选择技能)",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":"超宽"},uf={en:"English","zh-CN":"简体中文"};function D0(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Cp))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const rl=P(D0());function xp(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}xp(rl.value);function L0(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function j0(e){rl.value=e,xp(e),typeof window<"u"&&window.localStorage.setItem(Cp,e)}function Ap(e,t){const n=rl.value==="zh-CN"?N0[e]??e:e;return L0(n,t)}function _o(){return{uiLanguage:rl,uiLanguageOptions:[{value:"en",label:uf.en},{value:"zh-CN",label:uf["zh-CN"]}],t:Ap,setUiLanguage:j0}}const F0={key:0,class:"sidebar-menu-row-left"},U0={class:"sidebar-menu-row-main"},B0={key:1,class:"sidebar-menu-row-right"},q0={key:0,class:"sidebar-menu-row-right-default"},H0={key:1,class:"sidebar-menu-row-right-hover"},V0=Cn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Ug(),r=se(()=>!!n.left),s=se(()=>!!n.right),o=se(()=>!!n["right-hover"]),i=se(()=>s.value||o.value);return(l,c)=>(x(),lt(oc(t.as),Hh({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},l.$attrs),{default:St(()=>[r.value?(x(),$("span",F0,[Qr(l.$slots,"left",{},void 0,!0)])):ue("",!0),m("span",U0,[Qr(l.$slots,"default",{},void 0,!0)]),i.value?(x(),$("span",B0,[s.value?(x(),$("span",q0,[Qr(l.$slots,"right",{},void 0,!0)])):ue("",!0),o.value?(x(),$("span",H0,[Qr(l.$slots,"right-hover",{},void 0,!0)])):ue("",!0)])):ue("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),ts=yt(V0,[["__scopeId","data-v-36239f39"]]),W0={class:"thread-tree-root"},z0={key:0,class:"pinned-section"},G0={class:"thread-list"},K0=["data-menu-open"],Y0={class:"thread-left-stack"},J0=["data-state"],Q0=["onClick"],X0=["onClick"],Z0={class:"thread-row-title-wrap"},e_={class:"thread-row-title-line"},t_={class:"thread-row-title"},n_=["title"],r_=["data-state"],o_={class:"thread-row-time"},s_=["onClick"],a_={class:"thread-tree-header"},i_=["aria-expanded","aria-label","title"],l_={class:"organize-menu-title"},u_=["data-active"],c_={key:0},d_=["data-active"],f_={key:0},h_={key:1,class:"thread-tree-no-results"},p_={key:2,class:"thread-tree-loading"},m_={key:3,class:"thread-list thread-list-global"},g_=["data-menu-open"],v_={class:"thread-left-stack"},y_=["data-state"],w_=["onClick"],b_=["onClick"],__={class:"thread-row-title-wrap"},T_={class:"thread-row-title-line"},k_={class:"thread-row-title"},S_=["title"],C_=["data-state"],x_={class:"thread-row-time"},A_=["onClick"],E_=["data-project-name","data-expanded","data-dragging"],I_={class:"project-icon-stack"},M_={class:"project-icon-folder"},P_={class:"project-icon-chevron"},R_=["data-dragging-handle","onMousedown"],$_={class:"project-title"},O_={class:"project-hover-controls"},N_=["onClick"],D_=["data-open-direction"],L_=["onClick"],j_=["onClick"],F_={class:"project-menu-label"},U_=["onInput"],B_=["aria-label","title","onClick"],q_={key:0,class:"thread-list"},H_=["data-menu-open"],V_={class:"thread-left-stack"},W_=["data-state"],z_=["onClick"],G_=["onClick"],K_={class:"thread-row-title-wrap"},Y_={class:"thread-row-title-line"},J_={class:"thread-row-title"},Q_=["title"],X_=["data-state"],Z_={class:"thread-row-time"},eT=["onClick"],tT={class:"project-empty"},nT=["onClick"],rT=["data-open-direction"],oT={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},sT={class:"rename-thread-title"},aT=["onKeydown"],iT={class:"rename-thread-actions"},lT={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},uT={class:"rename-thread-title"},cT={class:"rename-thread-subtitle"},dT={class:"rename-thread-actions"},fT={class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread automation"},hT={class:"rename-thread-title"},pT={class:"automation-thread-field"},mT={class:"automation-thread-field"},gT={class:"automation-thread-field"},vT={class:"automation-thread-field"},yT={value:"ACTIVE"},wT={value:"PAUSED"},bT={key:0,class:"rename-thread-subtitle automation-thread-error"},_T={class:"rename-thread-actions"},TT=["disabled"],kT=["disabled"],ST=["disabled"],CT=4,cf=6,df="codex-web-local.thread-view-mode.v1",ff="codex-web-local.collapsed-projects.v1",xT=Cn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread"],setup(e,{emit:t}){const n=e,{t:r}=_o(),s=t,o=P({}),i=P({});let l=!1;const c=P([]),h=P(""),f=P(""),g=P({}),T=P({}),A=P({}),B=P("actions"),q=P(""),Q=P(!1),V=P(""),R=P(""),W=P(null),Z=P(!1),fe=P(""),ye=P(""),ee=P({}),Ae=P(!1),ge=P(""),Ue=P("create"),Ie=P(""),re=P(!1),de=P({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),De=P(null),qe=P(null),Pe=P(null);let _e=null,Ee=null;const Ve=P(""),Qe=P({}),Ke=new Map,Be=new Map,pt=new Map,et=new WeakMap,dt=P(null),tt=P(null),K=P(!1),we=P(We()),he=typeof window<"u"?new ResizeObserver(_=>{for(const w of _){const b=w.target,z=et.get(b);z&&Hn(z,b)}}):null;function Oe(){if(typeof window>"u")return{};try{const _=window.localStorage.getItem(ff);if(!_)return{};const w=JSON.parse(_);return!w||typeof w!="object"||Array.isArray(w)?{}:w}catch{return{}}}function We(){return typeof window>"u"?"project":window.localStorage.getItem(df)==="chronological"?"chronological":"project"}i.value=Oe(),ut(i,_=>{typeof window>"u"||window.localStorage.setItem(ff,JSON.stringify(_))},{deep:!0}),ut(we,_=>{typeof window>"u"||window.localStorage.setItem(df,_)});const k=se(()=>n.searchQuery.trim().toLowerCase()),E=se(()=>k.value.length>0),H=se(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null),G=se(()=>new Set(c.value));function oe(_){if(!E.value)return!0;if(H.value)return H.value.has(_.id);const w=k.value;return _.title.toLowerCase().includes(w)||_.preview.toLowerCase().includes(w)}const te=se(()=>E.value?n.groups.map(_=>({..._,threads:_.threads.filter(oe)})).filter(_=>_.threads.length>0):n.groups),Te=se(()=>we.value==="chronological"),ce=se(()=>{const _=te.value,w=[];for(const b of _)for(const z of b.threads)G.value.has(z.id)||w.push(z);return w.sort((b,z)=>{const Le=new Date(b.updatedAtIso||b.createdAtIso).getTime();return new Date(z.updatedAtIso||z.createdAtIso).getTime()-Le})}),pe=se(()=>{const _=new Map;for(const w of n.groups)for(const b of w.threads)_.set(b.id,b);return _});ut(c,_=>{l&&s0(_)}),ut(pe,_=>{const w=c.value.filter(b=>_.has(b));w.length!==c.value.length&&(c.value=w)}),Uo(async()=>{const{threadIds:_}=await o0(),w=Array.isArray(_)?_.filter(b=>typeof b=="string").map(b=>b.trim()).filter((b,z,Le)=>b.length>0&&Le.indexOf(b)===z):[];w.length>0&&(c.value=w);try{ee.value=await mb()}catch{ee.value={}}l=!0});const ae=se(()=>wt(fe.value)),Me=se(()=>{const _=new Map;for(const w of n.groups)for(const b of w.threads)_.set(b.id,w.projectName);return _}),be=se(()=>{const _=new Map;for(const w of n.groups){const b=w.threads.filter(z=>!G.value.has(z.id));_.set(w.projectName,b)}return _}),$e=se(()=>{const _=new Map;for(const w of n.groups)for(const b of w.threads){const z=new Date(b.updatedAtIso||b.createdAtIso).getTime();_.set(b.id,z)}return _}),Se=se(()=>{const _=f.value;return _?pe.value.get(_)??null:null}),Xe=se(()=>c.value.map(_=>pe.value.get(_)??null).filter(_=>_!==null).filter(oe)),O=se(()=>{const _=Pe.value;if(!_||_.dropTargetIndexFull===null||n.groups.length===0)return null;const w=Math.max(0,Math.min(_.dropTargetIndexFull,n.groups.length)),b=w>_.fromIndex?w-1:w,z=Math.max(0,Math.min(b,n.groups.length-1));return z===_.fromIndex?null:z}),j=se(()=>{const w=(E.value?te.value:n.groups).map(Pt=>Pt.projectName),b=Pe.value,z=O.value;if(!b||z===null)return w;const Le=[...w],[rt]=Le.splice(b.fromIndex,1);return rt?(Le.splice(z,0,rt),Le):w}),F=se(()=>{const _={};let w=0;for(const b of j.value)_[b]=w,w+=Bn(b);return _}),J=se(()=>{let _=0;for(const w of j.value)_+=Bn(w);return{height:`${Math.max(0,_)}px`}});function me(_){if(Number.isNaN(_))return"n/a";const w=Math.abs(Date.now()-_);if(w<6e4)return"now";const b=Math.floor(w/6e4);if(b<60)return`${b}m`;const z=Math.floor(b/60);return z<24?`${z}h`:`${Math.floor(z/24)}d`}function Ce(_){const w=$e.value.get(_.id);return me(typeof w=="number"?w:new Date(_.updatedAtIso||_.createdAtIso).getTime())}function ke(_){return G.value.has(_)}function Ze(_){if(ke(_)){c.value=c.value.filter(w=>w!==_);return}c.value=[_,...c.value]}function je(_){s("select",_)}function wt(_){return!!ee.value[_]}function pn(_){const w=ee.value[_];if(!w)return"";const b=w.status==="PAUSED"?"-":w.nextRunAtMs?new Date(w.nextRunAtMs).toLocaleString():"Not scheduled";return`${w.name} • Next run: ${b}`}function Xn(_){s("export-thread",_),Ft()}function Ht(_){s("fork-thread",_),Ft()}function Zn(_){return`start new thread ${Zt(_)}`}function er(_){s("start-new-thread",_)}function Fr(_){s("browse-thread-files",_),Ft()}function Dn(_,w){if(f.value===_){if(w){const b=w.relatedTarget,z=tt.value;if(b instanceof Node&&z&&z.contains(b))return}Ft()}}function vn(_){return f.value===_}function Ft(){f.value="",A.value={}}function _r(_){if(f.value===_){Ft();return}yn(),K.value=!1,f.value=_,Xt(()=>{cn(_)})}function hr(_,w){_.preventDefault(),f.value=w}function un(_,w){V.value=_,R.value=w,Q.value=!0,Ft(),Xt(()=>{var b,z;(b=W.value)==null||b.focus(),(z=W.value)==null||z.select()})}function pr(){Q.value=!1,V.value="",R.value=""}function ht(){const _=V.value,w=R.value.trim();!_||!w||(s("rename-thread",{threadId:_,title:w}),pr())}function mr(_,w){fe.value=_,ye.value=w,Z.value=!0,Ft()}function _t(){Z.value=!1,fe.value="",ye.value=""}async function Ln(){const _=fe.value;if(_){if(wt(_)){try{await tf(_)}catch{}ee.value=Object.fromEntries(Object.entries(ee.value).filter(([w])=>w!==_))}c.value=c.value.filter(w=>w!==_),s("archive",_),_t()}}function xn(_){const w=ee.value[_];ge.value=_,Ue.value=w?"edit":"create",Ie.value="",de.value={name:(w==null?void 0:w.name)??"Thread automation",prompt:(w==null?void 0:w.prompt)??"",rrule:(w==null?void 0:w.rrule)??"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:(w==null?void 0:w.status)??"ACTIVE"},Ae.value=!0,Ft()}function tr(){Ae.value=!1,ge.value="",Ie.value="",re.value=!1}async function $t(){const _=ge.value;if(_){re.value=!0,Ie.value="";try{const w=await gb({threadId:_,name:de.value.name,prompt:de.value.prompt,rrule:de.value.rrule,status:de.value.status});ee.value={...ee.value,[_]:w},tr()}catch(w){Ie.value=w instanceof Error?w.message:"Failed to save automation",re.value=!1}}}async function Mt(){const _=ge.value;if(_){re.value=!0,Ie.value="";try{await tf(_),ee.value=Object.fromEntries(Object.entries(ee.value).filter(([w])=>w!==_)),tr()}catch(w){Ie.value=w instanceof Error?w.message:"Failed to remove automation",re.value=!1}}}function Zt(_){return n.projectDisplayNameById[_]??_}function jn(_){return h.value===_}function yn(){h.value="",B.value="actions",q.value=""}function Tr(){const _=!K.value;_&&(yn(),Ft()),K.value=_}function ir(_){we.value=_,K.value=!1}function kr(_){if(h.value===_){yn();return}Ft(),K.value=!1,h.value=_,B.value="actions",q.value=Zt(_),Xt(()=>{bn(_)})}function An(_){Ft(),h.value=_,B.value="rename",q.value=Zt(_),Xt(()=>{bn(_)})}function lr(_){s("rename-project",{projectName:_,displayName:q.value})}function Sr(_){s("remove-project",_),yn()}function Cr(_,w){if(!_.altKey||_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;const b=n.groups.findIndex(rt=>rt.projectName===w);if(b<0)return;const z=_.key==="ArrowUp"?-1:1,Le=Math.max(0,Math.min(b+z,n.groups.length-1));Le!==b&&(_.preventDefault(),s("reorder-project",{projectName:w,toIndex:Le}))}function Fn(_){return o.value[_]===!0}function Gt(_){return i.value[_]===!0}function Un(_){o.value={...o.value,[_]:!Fn(_)}}function en(_){if(Ve.value===_){Ve.value="";return}i.value={...i.value,[_]:!Gt(_)}}function Bn(_){const w=Qe.value[_]??0,b=Pe.value,Le=((b==null?void 0:b.projectName)===_?b.groupHeight:null)??w,rt=Gt(_)?0:cf;return Math.max(0,Le+rt)}function En(_,w){const b=w instanceof HTMLElement?w:w&&"$el"in w&&w.$el instanceof HTMLElement?w.$el:null;if(b){Be.set(_,b);return}Be.delete(_)}function xr(_,w){const b=w instanceof HTMLElement?w:w&&"$el"in w&&w.$el instanceof HTMLElement?w.$el:null;if(b){pt.set(_,b);return}pt.delete(_)}function gr(_){let w=_.parentElement;for(;w;){const b=window.getComputedStyle(w),z=b.overflowY||b.overflow;if(z==="auto"||z==="scroll"||z==="hidden"||z==="clip")return w.getBoundingClientRect();w=w.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function eo(_,w){const b=_.getBoundingClientRect(),z=gr(_),Le=6,rt=z.bottom-b.bottom,Pt=b.top-z.top;return rt>=w+Le?"down":Pt>rt?"up":"down"}function wn(_,w){const b=pt.get(_);if(!b)return"down";const z=eo(b,w);return T.value={...T.value,[_]:z},z}function Ot(_){return T.value[_]??"down"}function bn(_){const w=Be.get(_);w&&(g.value={...g.value,[_]:eo(w,112)})}function In(_,w,b){return Math.min(Math.max(_,w),b)}function cn(_){const w=pt.get(_);if(!w)return;const b=tt.value,z=b==null?void 0:b.getBoundingClientRect(),Le=(z==null?void 0:z.height)||(b==null?void 0:b.offsetHeight)||112,rt=(z==null?void 0:z.width)||(b==null?void 0:b.offsetWidth)||160,Pt=wn(_,Le),It=w.getBoundingClientRect(),mn=8,zt=4,sn=Math.max(mn,window.innerWidth-rt-mn),Ir=In(It.right-rt,mn,sn),to=In(Pt==="up"?It.top-Le-zt:It.bottom+zt,mn,Math.max(mn,window.innerHeight-Le-mn));A.value={left:`${Math.round(Ir)}px`,top:`${Math.round(to)}px`}}function Vt(){const _=f.value;_&&cn(_)}function ct(){window.addEventListener("resize",Vt),document.addEventListener("scroll",Vt,!0)}function nr(){window.removeEventListener("resize",Vt),document.removeEventListener("scroll",Vt,!0)}function rr(_){const w=h.value;if(!w)return!1;const b=Be.get(w);if(!b)return!1;if((typeof _.composedPath=="function"?_.composedPath():[]).includes(b))return!0;const Le=_.target;return Le instanceof Node?b.contains(Le):!1}function qn(_){const w=f.value;if(!w)return!1;const b=pt.get(w);if(!b)return!1;const z=typeof _.composedPath=="function"?_.composedPath():[];if(z.includes(b))return!0;const Le=tt.value;if(Le&&z.includes(Le))return!0;const rt=_.target;return rt instanceof Node?!!(b.contains(rt)||Le&&Le.contains(rt)):!1}function ur(_){if(K.value){const w=dt.value,b=typeof _.composedPath=="function"?_.composedPath():[];!!w&&(b.includes(w)||_.target instanceof Node&&w.contains(_.target))||(K.value=!1)}h.value&&(rr(_)||yn(),f.value&&(qn(_)||Ft()))}function on(_){h.value&&!rr(_)&&yn(),f.value&&!qn(_)&&Ft()}function or(){K.value&&(K.value=!1),h.value&&yn(),f.value&&Ft()}function Tt(){window.addEventListener("pointerdown",ur,{capture:!0}),window.addEventListener("focusin",on,{capture:!0}),window.addEventListener("blur",or)}function Nt(){window.removeEventListener("pointerdown",ur,{capture:!0}),window.removeEventListener("focusin",on,{capture:!0}),window.removeEventListener("blur",or)}function Hn(_,w){const b=w.getBoundingClientRect().height;if(!Number.isFinite(b)||b<=0)return;const z=Qe.value[_];z!==void 0&&Math.abs(z-b)<.5||(Qe.value={...Qe.value,[_]:b})}function sr(_,w){const b=Ke.get(_);b&&b!==w&&he&&he.unobserve(b);const z=w instanceof HTMLElement?w:w&&"$el"in w&&w.$el instanceof HTMLElement?w.$el:null;if(z){Ke.set(_,z),et.set(z,_),Hn(_,z),he==null||he.observe(z);return}b&&(he==null||he.unobserve(b)),Ke.delete(_)}function Vn(_,w){if(_.button!==0||qe.value||Pe.value)return;const b=n.groups.findIndex(Pt=>Pt.projectName===w),z=Ke.get(w);if(b<0||!z)return;const Le=z.getBoundingClientRect(),rt=Gt(w)?0:cf;qe.value={projectName:w,fromIndex:b,startClientX:_.clientX,startClientY:_.clientY,pointerOffsetY:_.clientY-Le.top,groupLeft:Le.left,groupWidth:Le.width,groupHeight:Le.height,groupOuterHeight:Le.height+rt},_.preventDefault(),Wn()}function Wn(){window.addEventListener("mousemove",Ur),window.addEventListener("mouseup",ft),window.addEventListener("keydown",tn)}function Ar(){window.removeEventListener("mousemove",Ur),window.removeEventListener("mouseup",ft),window.removeEventListener("keydown",tn)}function Ur(_){_e={clientX:_.clientX,clientY:_.clientY},cr()}function ft(_){dr({clientX:_.clientX,clientY:_.clientY});const w=Pe.value;if(w&&O.value!==null){const b=n.groups.findIndex(z=>z.projectName===w.projectName);if(b>=0){const z=O.value;z!==b&&s("reorder-project",{projectName:w.projectName,toIndex:z})}}nn()}function tn(_){_.key==="Escape"&&(!qe.value&&!Pe.value||(_.preventDefault(),nn()))}function nn(){Ee!==null&&(window.cancelAnimationFrame(Ee),Ee=null),_e=null,qe.value=null,Pe.value=null,Ve.value="",Ar()}function cr(){Ee===null&&(Ee=window.requestAnimationFrame(()=>{if(Ee=null,!_e)return;const _=_e;_e=null,dr(_)}))}function dr(_){const w=qe.value;if(!Pe.value&&w){const b=_.clientX-w.startClientX,z=_.clientY-w.startClientY;if(Math.hypot(b,z)<CT)return;yn(),Ve.value=w.projectName,Pe.value={projectName:w.projectName,fromIndex:w.fromIndex,pointerOffsetY:w.pointerOffsetY,groupLeft:w.groupLeft,groupWidth:w.groupWidth,groupHeight:w.groupHeight,groupOuterHeight:w.groupOuterHeight,ghostTop:_.clientY-w.pointerOffsetY,dropTargetIndexFull:null}}Pe.value&&I(_)}function I(_){const w=Pe.value;if(!w)return;if(w.ghostTop=_.clientY-w.pointerOffsetY,!U(_)){w.dropTargetIndexFull=null;return}const b=_.clientY,z=De.value;if(!z){w.dropTargetIndexFull=null;return}const Le=z.getBoundingClientRect(),rt=new Map(n.groups.map((zt,sn)=>[zt.projectName,sn])),Pt=n.groups.map(zt=>zt.projectName).filter(zt=>zt!==w.projectName);let It=0,mn=n.groups.length;for(const zt of Pt){const sn=rt.get(zt);if(sn===void 0)continue;const Ir=Bn(zt),to=Le.top+It+Ir/2;if(b<to){mn=sn;break}It+=Ir}w.dropTargetIndexFull=mn}function U(_){const w=De.value;if(!w)return!1;const b=w.getBoundingClientRect(),z=_.clientX>=b.left&&_.clientX<=b.right,Le=_.clientY>=b.top-32&&_.clientY<=b.bottom+32;return z&&Le}function ne(_){var w;return((w=Pe.value)==null?void 0:w.projectName)===_}function Ne(_){const w=Pe.value,b=F.value[_]??0,z=f.value?Me.value.get(f.value)??"":"",Le=h.value===_||z===_;return!w||w.projectName!==_?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Le?"40":"1",transform:`translate3d(0, ${b}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${w.groupLeft}px`,width:`${w.groupWidth}px`,height:`${w.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${w.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function mt(_){return be.value.get(_.projectName)??[]}function Wt(_){if(E.value)return mt(_);if(Gt(_.projectName))return[];const w=mt(_);return Fn(_.projectName)?w:w.slice(0,10)}function Ut(_){return E.value?!1:!Gt(_.projectName)&&mt(_).length>10}function Bt(_){return mt(_).length>0}function Dt(_){return!!_.pendingRequestState||_.inProgress||_.unread}function _n(_){return _.pendingRequestState==="approval"?"Awaiting approval":"Awaiting response"}function Kt(_){return _.pendingRequestState==="approval"?"awaiting-approval":_.pendingRequestState==="response"?"awaiting-response":_.inProgress?"working":_.unread?"unread":"idle"}ut(()=>n.groups.map(_=>_.projectName),_=>{var Le,rt;const w=((Le=Pe.value)==null?void 0:Le.projectName)??((rt=qe.value)==null?void 0:rt.projectName)??"";w&&!n.groups.some(Pt=>Pt.projectName===w)&&nn();const b=new Set(_),z=Object.fromEntries(Object.entries(Qe.value).filter(([Pt])=>b.has(Pt)));Object.keys(z).length!==Object.keys(Qe.value).length&&(Qe.value=z)});const Er=se(()=>K.value||h.value!==""||f.value!=="");return ut(Er,_=>{if(_){Tt();return}Nt()}),ut(f,_=>{if(!_){nr();return}ct(),Xt(()=>{cn(_)})}),ds(()=>{for(const _ of Ke.values())he==null||he.unobserve(_);Ke.clear(),Be.clear(),nr(),Nt(),nn()}),(_,w)=>(x(),$("section",W0,[Xe.value.length>0?(x(),$("section",z0,[m("ul",G0,[(x(!0),$(He,null,jt(Xe.value,b=>(x(),$("li",{key:b.id,class:"thread-row-item","data-menu-open":vn(b.id)?"true":"false"},[Fe(ts,{class:"thread-row","data-active":b.id===e.selectedThreadId,"data-pinned":ke(b.id),"data-menu-open":vn(b.id)?"true":"false","force-right-hover":vn(b.id),onClick:z=>je(b.id),onMouseleave:z=>Dn(b.id,z),onContextmenu:z=>hr(z,b.id)},{left:St(()=>[m("span",Y0,[Dt(b)?(x(),$("span",{key:0,class:"thread-status-indicator","data-state":Kt(b)},null,8,J0)):ue("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ot(z=>Ze(b.id),["stop"])},[Fe(fu,{class:"thread-icon"})],8,Q0)])]),right:St(()=>[m("span",o_,D(Ce(b)),1)]),"right-hover":St(()=>[m("div",{ref_for:!0,ref:z=>xr(b.id,z),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:ot(z=>_r(b.id),["stop"])},[Fe(va,{class:"thread-icon"})],8,s_)],512)]),default:St(()=>[m("button",{class:"thread-main-button",type:"button",onClick:ot(z=>je(b.id),["stop"])},[m("span",Z0,[m("span",e_,[m("span",t_,D(b.title),1),b.hasWorktree?(x(),lt(Mi,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):ue("",!0),wt(b.id)?(x(),$("span",{key:1,class:"thread-row-automation-chip",title:pn(b.id)}," Auto ",8,n_)):ue("",!0),b.pendingRequestState?(x(),$("span",{key:2,class:"thread-row-request-chip","data-state":b.pendingRequestState},D(_n(b)),9,r_)):ue("",!0)])])],8,X0)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,K0))),128))])])):ue("",!0),Fe(ts,{as:"header",class:"thread-tree-header-row"},{right:St(()=>[m("div",{ref_key:"organizeMenuWrapRef",ref:dt,class:"organize-menu-wrap"},[m("button",{class:"organize-menu-trigger",type:"button","aria-expanded":K.value,"aria-label":S(r)("Organize threads"),title:S(r)("Organize threads"),onClick:Tr},[Fe(va,{class:"thread-icon"})],8,i_),K.value?(x(),$("div",{key:0,class:"organize-menu-panel",onClick:w[2]||(w[2]=ot(()=>{},["stop"]))},[m("p",l_,D(S(r)("Organize")),1),m("button",{class:"organize-menu-item","data-active":we.value==="project",type:"button",onClick:w[0]||(w[0]=b=>ir("project"))},[m("span",null,D(S(r)("By project")),1),we.value==="project"?(x(),$("span",c_,"✓")):ue("",!0)],8,u_),m("button",{class:"organize-menu-item","data-active":we.value==="chronological",type:"button",onClick:w[1]||(w[1]=b=>ir("chronological"))},[m("span",null,D(S(r)("Chronological list")),1),we.value==="chronological"?(x(),$("span",f_,"✓")):ue("",!0)],8,d_)])):ue("",!0)],512)]),default:St(()=>[m("span",a_,D(S(r)("Threads")),1)]),_:1}),E.value&&te.value.length===0?(x(),$("p",h_,D(S(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(x(),$("p",p_,D(S(r)("Loading threads...")),1)):Te.value?(x(),$("ul",m_,[(x(!0),$(He,null,jt(ce.value,b=>(x(),$("li",{key:b.id,class:"thread-row-item","data-menu-open":vn(b.id)?"true":"false"},[Fe(ts,{class:"thread-row","data-active":b.id===e.selectedThreadId,"data-pinned":ke(b.id),"data-menu-open":vn(b.id)?"true":"false","force-right-hover":vn(b.id),onClick:z=>je(b.id),onMouseleave:z=>Dn(b.id,z),onContextmenu:z=>hr(z,b.id)},{left:St(()=>[m("span",v_,[Dt(b)?(x(),$("span",{key:0,class:"thread-status-indicator","data-state":Kt(b)},null,8,y_)):ue("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ot(z=>Ze(b.id),["stop"])},[Fe(fu,{class:"thread-icon"})],8,w_)])]),right:St(()=>[m("span",x_,D(Ce(b)),1)]),"right-hover":St(()=>[m("div",{ref_for:!0,ref:z=>xr(b.id,z),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:ot(z=>_r(b.id),["stop"])},[Fe(va,{class:"thread-icon"})],8,A_)],512)]),default:St(()=>[m("button",{class:"thread-main-button",type:"button",onClick:ot(z=>je(b.id),["stop"])},[m("span",__,[m("span",T_,[m("span",k_,D(b.title),1),b.hasWorktree?(x(),lt(Mi,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):ue("",!0),wt(b.id)?(x(),$("span",{key:1,class:"thread-row-automation-chip",title:pn(b.id)}," Auto ",8,S_)):ue("",!0),b.pendingRequestState?(x(),$("span",{key:2,class:"thread-row-request-chip","data-state":b.pendingRequestState},D(_n(b)),9,C_)):ue("",!0)])])],8,b_)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,g_))),128))])):(x(),$("div",{key:4,ref_key:"groupsContainerRef",ref:De,class:"thread-tree-groups",style:po(J.value)},[(x(!0),$(He,null,jt(te.value,b=>(x(),$("article",{key:b.projectName,ref_for:!0,ref:z=>sr(b.projectName,z),class:"project-group","data-project-name":b.projectName,"data-expanded":!Gt(b.projectName),"data-dragging":ne(b.projectName),style:po(Ne(b.projectName))},[Fe(ts,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:z=>en(b.projectName),onKeydown:[z=>Cr(z,b.projectName),Qt(ot(z=>en(b.projectName),["prevent"]),["enter"]),Qt(ot(z=>en(b.projectName),["prevent"]),["space"])]},{left:St(()=>[m("span",I_,[m("span",M_,[Gt(b.projectName)?(x(),lt(vc,{key:0,class:"thread-icon"})):(x(),lt(E0,{key:1,class:"thread-icon"}))]),m("span",P_,[Gt(b.projectName)?(x(),lt(m0,{key:0,class:"thread-icon"})):(x(),lt(gc,{key:1,class:"thread-icon"}))])])]),right:St(()=>[m("div",O_,[m("div",{ref_for:!0,ref:z=>En(b.projectName,z),class:"project-menu-wrap"},[m("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:ot(z=>kr(b.projectName),["stop"])},[Fe(va,{class:"thread-icon"})],8,N_),jn(b.projectName)?(x(),$("div",{key:0,class:"project-menu-panel","data-open-direction":g.value[b.projectName]??"down",onClick:w[4]||(w[4]=ot(()=>{},["stop"]))},[B.value==="actions"?(x(),$(He,{key:0},[m("button",{class:"project-menu-item",type:"button",onClick:z=>An(b.projectName)}," Edit name ",8,L_),m("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:z=>Sr(b.projectName)}," Remove ",8,j_)],64)):(x(),$(He,{key:1},[m("label",F_,D(S(r)("Project name")),1),ln(m("input",{"onUpdate:modelValue":w[3]||(w[3]=z=>q.value=z),class:"project-menu-input",type:"text",onInput:z=>lr(b.projectName)},null,40,U_),[[gn,q.value]])],64))],8,D_)):ue("",!0)],512),m("button",{class:"thread-start-button",type:"button","aria-label":Zn(b.projectName),title:Zn(b.projectName),onClick:ot(z=>er(b.projectName),["stop"])},[Fe(Fi,{class:"thread-icon"})],8,B_)])]),default:St(()=>[m("span",{class:"project-main-button","data-dragging-handle":ne(b.projectName),onMousedown:ot(z=>Vn(z,b.projectName),["left"])},[m("span",$_,D(Zt(b.projectName)),1)],40,R_)]),_:2},1032,["onClick","onKeydown"]),Bt(b)?(x(),$("ul",q_,[(x(!0),$(He,null,jt(Wt(b),z=>(x(),$("li",{key:z.id,class:"thread-row-item","data-menu-open":vn(z.id)?"true":"false"},[Fe(ts,{class:"thread-row","data-active":z.id===e.selectedThreadId,"data-pinned":ke(z.id),"data-menu-open":vn(z.id)?"true":"false","force-right-hover":vn(z.id),onClick:Le=>je(z.id),onMouseleave:Le=>Dn(z.id,Le),onContextmenu:Le=>hr(Le,z.id)},{left:St(()=>[m("span",V_,[Dt(z)?(x(),$("span",{key:0,class:"thread-status-indicator","data-state":Kt(z)},null,8,W_)):ue("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ot(Le=>Ze(z.id),["stop"])},[Fe(fu,{class:"thread-icon"})],8,z_)])]),right:St(()=>[m("span",Z_,D(Ce(z)),1)]),"right-hover":St(()=>[m("div",{ref_for:!0,ref:Le=>xr(z.id,Le),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:ot(Le=>_r(z.id),["stop"])},[Fe(va,{class:"thread-icon"})],8,eT)],512)]),default:St(()=>[m("button",{class:"thread-main-button",type:"button",onClick:ot(Le=>je(z.id),["stop"])},[m("span",K_,[m("span",Y_,[m("span",J_,D(z.title),1),z.hasWorktree?(x(),lt(Mi,{key:0,class:"thread-row-worktree-icon",title:S(r)("Worktree thread")},null,8,["title"])):ue("",!0),wt(z.id)?(x(),$("span",{key:1,class:"thread-row-automation-chip",title:pn(z.id)}," Auto ",8,Q_)):ue("",!0),z.pendingRequestState?(x(),$("span",{key:2,class:"thread-row-request-chip","data-state":z.pendingRequestState},D(_n(z)),9,X_)):ue("",!0)])])],8,G_)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,H_))),128))])):(x(),lt(ts,{key:1,as:"p",class:"project-empty-row"},{left:St(()=>[...w[17]||(w[17]=[m("span",{class:"project-empty-spacer"},null,-1)])]),default:St(()=>[m("span",tT,D(S(r)("No threads")),1)]),_:1})),Ut(b)?(x(),lt(ts,{key:2,class:"thread-show-more-row"},{left:St(()=>[...w[18]||(w[18]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:St(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:z=>Un(b.projectName)},D(Fn(b.projectName)?"Show less":"Show more"),9,nT)]),_:2},1024)):ue("",!0)],12,E_))),128))],4)),(x(),lt(Rs,{to:"body"},[Se.value?(x(),$("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:tt,class:"thread-menu-panel thread-menu-panel-fixed",style:po(A.value),"data-open-direction":Ot(Se.value.id),onClick:w[11]||(w[11]=ot(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:w[5]||(w[5]=b=>xn(Se.value.id))},D(wt(Se.value.id)?"Edit automation…":"Add automation…"),1),m("button",{class:"thread-menu-item",type:"button",onClick:w[6]||(w[6]=b=>Fr(Se.value.id))}," Browse files "),m("button",{class:"thread-menu-item",type:"button",onClick:w[7]||(w[7]=b=>Xn(Se.value.id))}," Export chat "),m("button",{class:"thread-menu-item",type:"button",onClick:w[8]||(w[8]=b=>Ht(Se.value.id))}," Create chat fork "),m("button",{class:"thread-menu-item",type:"button",onClick:w[9]||(w[9]=b=>un(Se.value.id,Se.value.title))},D(S(r)("Rename thread")),1),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:w[10]||(w[10]=b=>mr(Se.value.id,Se.value.title))},D(S(r)("Delete thread")),1)],12,rT)):ue("",!0)])),(x(),lt(Rs,{to:"body"},[Q.value?(x(),$("div",{key:0,class:"rename-thread-overlay",onClick:ot(pr,["self"])},[m("div",oT,[m("h3",sT,D(S(r)("Rename thread")),1),w[19]||(w[19]=m("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),ln(m("input",{ref_key:"renameThreadInputRef",ref:W,"onUpdate:modelValue":w[12]||(w[12]=b=>R.value=b),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[Qt(ot(ht,["prevent"]),["enter"]),Qt(ot(pr,["prevent"]),["esc"])]},null,40,aT),[[gn,R.value]]),m("div",iT,[m("button",{class:"rename-thread-button",type:"button",onClick:pr},D(S(r)("Cancel")),1),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:ht},D(S(r)("Save")),1)])])])):ue("",!0)])),(x(),lt(Rs,{to:"body"},[Z.value?(x(),$("div",{key:0,class:"rename-thread-overlay",onClick:ot(_t,["self"])},[m("div",lT,[m("h3",uT,D(ae.value?"Archive chat and remove automation?":"Delete thread?"),1),m("p",cT,[ae.value?(x(),$(He,{key:0},[cs(' This will archive the thread "'+D(ye.value)+'" and remove the attached heartbeat automation. ',1)],64)):(x(),$(He,{key:1},[cs(' This will archive the thread "'+D(ye.value)+'". You can find it later in archived threads. ',1)],64))]),m("div",dT,[m("button",{class:"rename-thread-button",type:"button",onClick:_t},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ln},D(ae.value?"Archive and remove":"Delete"),1)])])])):ue("",!0)])),(x(),lt(Rs,{to:"body"},[Ae.value?(x(),$("div",{key:0,class:"rename-thread-overlay",onClick:ot(tr,["self"])},[m("div",fT,[m("h3",hT,D(Ue.value==="edit"?"Edit automation":"Add automation"),1),w[24]||(w[24]=m("p",{class:"rename-thread-subtitle"},"This creates a heartbeat automation attached to the selected thread.",-1)),m("label",pT,[w[20]||(w[20]=m("span",{class:"automation-thread-label"},"Name",-1)),ln(m("input",{"onUpdate:modelValue":w[13]||(w[13]=b=>de.value.name=b),class:"rename-thread-input",type:"text",placeholder:"Automation name"},null,512),[[gn,de.value.name]])]),m("label",mT,[w[21]||(w[21]=m("span",{class:"automation-thread-label"},"Prompt",-1)),ln(m("textarea",{"onUpdate:modelValue":w[14]||(w[14]=b=>de.value.prompt=b),class:"automation-thread-textarea",rows:"6",placeholder:"Describe what the automation should do"},null,512),[[gn,de.value.prompt]])]),m("label",gT,[w[22]||(w[22]=m("span",{class:"automation-thread-label"},"Schedule (RRULE)",-1)),ln(m("input",{"onUpdate:modelValue":w[15]||(w[15]=b=>de.value.rrule=b),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0"},null,512),[[gn,de.value.rrule]])]),m("label",vT,[w[23]||(w[23]=m("span",{class:"automation-thread-label"},"Status",-1)),ln(m("select",{"onUpdate:modelValue":w[16]||(w[16]=b=>de.value.status=b),class:"automation-thread-select"},[m("option",yT,D(S(r)("Active")),1),m("option",wT,D(S(r)("Paused")),1)],512),[[ey,de.value.status]])]),Ie.value?(x(),$("p",bT,D(Ie.value),1)):ue("",!0),m("div",_T,[Ue.value==="edit"?(x(),$("button",{key:0,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:re.value,onClick:Mt}," Remove ",8,TT)):ue("",!0),m("button",{class:"rename-thread-button",type:"button",disabled:re.value,onClick:tr},D(S(r)("Cancel")),9,kT),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:re.value,onClick:$t},D(re.value?"Saving…":"Save"),9,ST)])])])):ue("",!0)]))]))}}),AT=yt(xT,[["__scopeId","data-v-497dcf12"]]),ET={class:"content-header"},IT={class:"content-leading"},MT=["title"],PT={class:"content-actions"},RT=Cn({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(x(),$("header",ET,[m("div",IT,[Qr(t.$slots,"leading",{},void 0)]),m("h1",{class:"content-title",title:e.title},D(e.title),9,MT),m("div",PT,[Qr(t.$slots,"actions",{},void 0)])]))}}),$T=yt(RT,[["__scopeId","data-v-215dd756"]]),hf=.0025,hu=3,pf=2,OT=256;function NT(e){var Ie;const t=P("idle"),n=P(typeof navigator<"u"&&!!((Ie=navigator.mediaDevices)!=null&&Ie.getUserMedia)),r=P(0),s=P(null);let o=null,i=null,l=[],c=null,h=null,f=null,g=null,T=[],A=!1,B=!1,q=null;function Q(){q&&(q.abort(),q=null),t.value==="transcribing"&&(t.value="idle")}function V(){const re=s.value;if(!re||typeof window>"u")return;const de=re.getContext("2d");if(!de)return;const De=Math.max(1,Math.floor(re.clientWidth)),qe=Math.max(1,Math.floor(re.clientHeight||36)),Pe=window.devicePixelRatio||1,_e=Math.max(1,Math.floor(De*Pe)),Ee=Math.max(1,Math.floor(qe*Pe));(re.width!==_e||re.height!==Ee)&&(re.width=_e,re.height=Ee),de.setTransform(Pe,0,0,Pe,0,0),de.clearRect(0,0,De,qe);const Ve=Math.max(12,Math.floor(De/(hu+pf))),Qe=T.slice(-Ve),Ke=Math.max(0,Ve-Qe.length),Be=qe/2,pt=getComputedStyle(re).color||"#000000";for(let et=0;et<Ve;et+=1){const dt=Qe[et-Ke]??0,K=Math.max(.08,Math.min(1,dt*18))*Be,we=et*(hu+pf);de.globalAlpha=dt<=hf?.35:1,de.fillStyle=pt,de.fillRect(we,Be-K,hu,K*2)}de.globalAlpha=1}function R(){T=[],r.value=0,V()}function W(){f&&(f.disconnect(),f.onaudioprocess=null,f=null),h&&(h.disconnect(),h=null),c&&(c.close(),c=null),g=null}function Z(re){if(typeof window>"u")return;const de=window.webkitAudioContext,De=window.AudioContext??de;De&&(W(),R(),c=new De,h=c.createMediaStreamSource(re),f=c.createScriptProcessor(2048,1,1),g=performance.now(),f.onaudioprocess=qe=>{const Pe=qe.inputBuffer.getChannelData(0);let _e=0;for(let Ee=0;Ee<Pe.length;Ee+=1){const Ve=Math.abs(Pe[Ee]??0);_e+=Ve<hf?0:Ve}T.push(_e/Pe.length),T.length>OT&&T.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),V()},h.connect(f),f.connect(c.destination),V())}async function fe(){var re;if(t.value==="transcribing"&&Q(),!(t.value!=="idle"||!n.value||A)){A=!0,B=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],o=new MediaRecorder(i),o.ondataavailable=de=>{de.data.size>0&&l.push(de.data)},o.onstop=()=>{var qe;const de=l,De=(o==null?void 0:o.mimeType)||((qe=de[0])==null?void 0:qe.type)||"audio/webm";ge(),Ae(de,De)},Z(i),o.start(250),t.value="recording",B&&ye()}catch(de){ge(),t.value="idle",(re=e.onError)==null||re.call(e,de)}finally{A=!1}}}function ye(){if(A&&t.value==="idle"){B=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function ee(){B=!1,Q(),ge(),t.value="idle"}async function Ae(re,de){var Pe,_e,Ee,Ve,Qe;if(re.length===0){(Pe=e.onEmpty)==null||Pe.call(e),t.value="idle";return}const De=new Blob(re,{type:de});t.value="transcribing";let qe=null;try{const Ke=de.split(/[/;]/)[1]??"webm",Be=new FormData;Be.append("file",De,`codex.${Ke}`);const pt=((_e=e.getLanguage)==null?void 0:_e.call(e).trim())??"";pt&&pt.toLowerCase()!=="auto"&&Be.append("language",pt),qe=new AbortController,q=qe;const et=await fetch("/codex-api/transcribe",{method:"POST",body:Be,signal:qe.signal}),dt=await et.text();let tt=null;try{tt=dt.trim()?JSON.parse(dt):null}catch{tt=null}if(!et.ok){const we=(Ee=tt==null?void 0:tt.error)==null?void 0:Ee.trim(),he=dt.trim();throw new Error(we||he||`Transcription failed: ${et.status}`)}const K=((tt==null?void 0:tt.text)??"").trim();K.length>0?e.onTranscript(K):(Ve=e.onEmpty)==null||Ve.call(e)}catch(Ke){if(Ke instanceof DOMException&&Ke.name==="AbortError")return;(Qe=e.onError)==null||Qe.call(e,Ke)}finally{qe&&q===qe&&(q=null),t.value==="transcribing"&&(t.value="idle")}}function ge(){W(),R(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(re=>re.stop()),i=null),l=[]}ds(()=>{ee()});function Ue(){if(t.value==="recording"){ye();return}(t.value==="idle"||t.value==="transcribing")&&fe()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:fe,stopRecording:ye,toggleRecording:Ue,cancel:ee}}const DT={},LT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function jT(e,t){return x(),$("svg",LT,[...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 FT=yt(DT,[["render",jT]]),UT={},BT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qT(e,t){return x(),$("svg",BT,[...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 HT=yt(UT,[["render",qT]]),VT={},WT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function zT(e,t){return x(),$("svg",WT,[...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 GT=yt(VT,[["render",zT]]),KT={},YT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function JT(e,t){return x(),$("svg",YT,[...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 mf=yt(KT,[["render",JT]]),QT=["disabled"],XT={class:"composer-dropdown-value"},ZT={class:"composer-dropdown-menu"},ek={key:0,class:"composer-dropdown-search-wrap"},tk=["placeholder","onKeydown"],nk={class:"composer-dropdown-options",role:"listbox"},rk=["onClick"],ok={key:0,class:"composer-dropdown-empty"},sk=Cn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=P(null),o=P(null),i=P(!1),l=P(""),c=se(()=>{var W;const R=n.options.find(Z=>Z.value===n.modelValue);return R?R.label:((W=n.placeholder)==null?void 0:W.trim())||""}),h=se(()=>n.openDirection??"down"),f=se(()=>n.enableSearch===!0),g=se(()=>{var R;return((R=n.searchPlaceholder)==null?void 0:R.trim())||"Quick search projects"}),T=se(()=>{var R;return((R=n.emptyLabel)==null?void 0:R.trim())||"No results"}),A=se(()=>{const R=l.value.trim().toLowerCase();return R?n.options.filter(W=>W.label.toLowerCase().includes(R)||W.value.toLowerCase().includes(R)):n.options});function B(){n.disabled||(i.value=!i.value)}function q(R){r("update:modelValue",R),i.value=!1,l.value=""}function Q(){if(l.value.length>0){l.value="";return}i.value=!1}function V(R){if(!i.value)return;const W=s.value;if(!W)return;const Z=R.target;Z instanceof Node&&(W.contains(Z)||(i.value=!1,l.value=""))}return ut(i,R=>{R&&f.value&&Xt(()=>{var W;return(W=o.value)==null?void 0:W.focus()})}),Uo(()=>{window.addEventListener("pointerdown",V)}),ds(()=>{window.removeEventListener("pointerdown",V)}),(R,W)=>(x(),$("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[m("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:B},[e.selectedPrefixIcon?(x(),lt(oc(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ue("",!0),m("span",XT,D(c.value),1),Fe(gc,{class:"composer-dropdown-chevron"})],8,QT),i.value?(x(),$("div",{key:0,class:at(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":h.value==="up","composer-dropdown-menu-wrap-down":h.value==="down"}])},[m("div",ZT,[f.value?(x(),$("div",ek,[ln(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":W[0]||(W[0]=Z=>l.value=Z),class:"composer-dropdown-search-input",type:"text",placeholder:g.value,onKeydown:Qt(ot(Q,["prevent"]),["esc"])},null,40,tk),[[gn,l.value]])])):ue("",!0),m("ul",nk,[(x(!0),$(He,null,jt(A.value,Z=>(x(),$("li",{key:Z.value},[m("button",{class:at(["composer-dropdown-option",{"is-selected":Z.value===e.modelValue}]),type:"button",onClick:fe=>q(Z.value)},D(Z.label),11,rk)]))),128)),A.value.length===0?(x(),$("li",ok,D(T.value),1)):ue("",!0)])])],2)):ue("",!0)],512))}}),as=yt(sk,[["__scopeId","data-v-2527acc2"]]),ak=["disabled"],ik={class:"search-dropdown-value"},lk={class:"search-dropdown-search-wrap"},uk=["placeholder","onKeydown"],ck={key:0,class:"search-dropdown-list",role:"listbox"},dk=["onClick","onPointerenter"],fk={class:"search-dropdown-option-check"},hk={class:"search-dropdown-option-label"},pk={key:0,class:"search-dropdown-option-desc"},mk={key:1,class:"search-dropdown-empty"},gk=Cn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=P(null),o=P(null),i=P(null),l=P(!1),c=P(""),h=P(0),{t:f}=_o(),g=se(()=>n.openDirection??"down"),T=se(()=>new Set(n.selectedValues)),A=se(()=>{if(n.selectedValues.length===0)return n.placeholder||f("Select...");if(n.selectedValues.length===1){const fe=n.options.find(ye=>ye.value===n.selectedValues[0]);return(fe==null?void 0:fe.label)||n.placeholder||f("Select...")}return`${n.selectedValues.length} ${f("selected")}`}),B=se(()=>{const fe=c.value.toLowerCase().trim();return fe?n.options.filter(ye=>{var ee;return ye.label.toLowerCase().includes(fe)||(((ee=ye.description)==null?void 0:ee.toLowerCase().includes(fe))??!1)}):n.options});function q(){const fe=o.value,ye=s.value;if(!fe||!ye||window.innerWidth>=640)return;const ee=ye.getBoundingClientRect();g.value==="up"?(fe.style.setProperty("bottom",`${window.innerHeight-ee.top+8}px`,"important"),fe.style.setProperty("top","auto","important")):(fe.style.setProperty("top",`${ee.bottom+8}px`,"important"),fe.style.setProperty("bottom","auto","important"))}function Q(){n.disabled||(l.value=!l.value,l.value&&(c.value="",h.value=0,Xt(()=>{var fe;Xt(()=>{q()}),(fe=i.value)==null||fe.focus()})))}function V(fe){r("toggle",fe.value,!T.value.has(fe.value)),l.value=!1}function R(fe){B.value.length!==0&&(h.value=(h.value+fe+B.value.length)%B.value.length)}function W(){const fe=B.value[h.value];fe&&V(fe)}function Z(fe){if(!l.value)return;const ye=s.value;if(!ye)return;const ee=fe.target;ee instanceof Node&&(ye.contains(ee)||(l.value=!1))}return ut(c,()=>{h.value=0}),Uo(()=>window.addEventListener("pointerdown",Z)),ds(()=>window.removeEventListener("pointerdown",Z)),(fe,ye)=>(x(),$("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[m("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:Q},[m("span",ik,D(A.value),1),Fe(gc,{class:"search-dropdown-chevron"})],8,ak),l.value?(x(),$("div",{key:0,ref_key:"menuRef",ref:o,class:at(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":g.value==="up","search-dropdown-menu-wrap-down":g.value==="down"}])},[m("div",lk,[ln(m("input",{ref_key:"searchRef",ref:i,"onUpdate:modelValue":ye[0]||(ye[0]=ee=>c.value=ee),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[ye[1]||(ye[1]=Qt(ot(ee=>l.value=!1,["prevent"]),["escape"])),Qt(ot(W,["prevent"]),["enter"]),ye[2]||(ye[2]=Qt(ot(ee=>R(1),["prevent"]),["arrow-down"])),ye[3]||(ye[3]=Qt(ot(ee=>R(-1),["prevent"]),["arrow-up"]))]},null,40,uk),[[gn,c.value]])]),B.value.length>0?(x(),$("ul",ck,[(x(!0),$(He,null,jt(B.value,(ee,Ae)=>(x(),$("li",{key:ee.value},[m("button",{class:at(["search-dropdown-option",{"is-selected":T.value.has(ee.value),"is-highlighted":Ae===h.value}]),type:"button",onClick:ge=>V(ee),onPointerenter:ge=>h.value=Ae},[m("span",fk,D(T.value.has(ee.value)?"✓":""),1),m("span",hk,D(ee.label),1),ee.description?(x(),$("span",pk,D(ee.description),1)):ue("",!0)],42,dk)]))),128))])):(x(),$("div",mk,D(S(f)("No results")),1))],2)):ue("",!0)],512))}}),vk=yt(gk,[["__scopeId","data-v-eec51e57"]]),yk={class:"skill-picker-header"},wk=["placeholder","onKeydown"],bk={key:0,class:"skill-picker-list",role:"listbox"},_k=["onClick","onPointerenter"],Tk={class:"skill-picker-name"},kk={key:0,class:"skill-picker-desc"},Sk={key:1,class:"skill-picker-empty"},Ck=Cn({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=P(null),o=P(null),i=P(""),l=P(0),{t:c}=_o(),h=se(()=>{const A=i.value.toLowerCase().trim();return A?n.skills.filter(B=>B.name.toLowerCase().includes(A)||B.description.toLowerCase().includes(A)):n.skills}),f=se(()=>{const A={};return n.anchorBottom!=null&&(A.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(A.left=`${n.anchorLeft}px`),A});function g(A){h.value.length!==0&&(l.value=(l.value+A+h.value.length)%h.value.length)}function T(){const A=h.value[l.value];A&&r("select",A)}return ut(()=>n.visible,A=>{A&&(i.value="",l.value=0,Xt(()=>{var B;return(B=o.value)==null?void 0:B.focus()}))}),ut(i,()=>{l.value=0}),(A,B)=>e.visible?(x(),$("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:po(f.value)},[m("div",yk,[ln(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":B[0]||(B[0]=q=>i.value=q),class:"skill-picker-search",type:"text",placeholder:S(c)("Search skills..."),onKeydown:[B[1]||(B[1]=Qt(ot(q=>A.$emit("close"),["prevent"]),["escape"])),Qt(ot(T,["prevent"]),["enter"]),B[2]||(B[2]=Qt(ot(q=>g(1),["prevent"]),["arrow-down"])),B[3]||(B[3]=Qt(ot(q=>g(-1),["prevent"]),["arrow-up"]))]},null,40,wk),[[gn,i.value]])]),h.value.length>0?(x(),$("ul",bk,[(x(!0),$(He,null,jt(h.value,(q,Q)=>(x(),$("li",{key:q.path},[m("button",{class:at(["skill-picker-item",{"is-highlighted":Q===l.value}]),type:"button",onClick:V=>A.$emit("select",q),onPointerenter:V=>l.value=Q},[m("span",Tk,D(q.name),1),q.description?(x(),$("span",kk,D(q.description),1)):ue("",!0)],42,_k)]))),128))])):(x(),$("div",Sk,D(S(c)("No skills found")),1))],4)):ue("",!0)}}),xk=yt(Ck,[["__scopeId","data-v-cb102b85"]]),Ak={key:0,class:"thread-composer-dictation-error"},Ek={key:0,class:"thread-composer-attachments"},Ik=["src","alt"],Mk=["aria-label","disabled","onClick"],Pk={key:1,class:"thread-composer-folder-chips"},Rk=["title"],$k={class:"thread-composer-folder-chip-meta"},Ok=["aria-label","disabled","onClick"],Nk={key:2,class:"thread-composer-file-chips"},Dk=["title"],Lk=["aria-label","disabled","onClick"],jk={key:3,class:"thread-composer-skill-chips"},Fk={class:"thread-composer-skill-chip-name"},Uk=["aria-label","onClick"],Bk={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},qk={key:1,class:"thread-composer-file-mentions"},Hk=["onMousedown"],Vk={key:1,class:"thread-composer-file-mention-icon-markdown"},Wk={class:"thread-composer-file-mention-text"},zk={class:"thread-composer-file-mention-name"},Gk={key:0,class:"thread-composer-file-mention-dir"},Kk={key:1,class:"thread-composer-file-mention-empty"},Yk=["placeholder","disabled"],Jk=["aria-label","disabled"],Qk={key:0,class:"thread-composer-attach-menu"},Xk=["disabled"],Zk=["disabled"],eS=["disabled"],tS={class:"thread-composer-attach-mode"},nS={class:"thread-composer-attach-mode-label"},rS={class:"thread-composer-attach-mode-buttons"},oS=["disabled"],sS=["disabled"],aS=["aria-checked","aria-label","disabled"],iS={class:"thread-composer-attach-setting-copy"},lS={class:"thread-composer-attach-setting-label"},uS={class:"thread-composer-attach-setting-description"},cS=["aria-checked","aria-label","disabled"],dS={class:"thread-composer-attach-setting-copy"},fS={class:"thread-composer-attach-setting-label"},hS={class:"thread-composer-attach-setting-description"},pS={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},mS={key:1,class:"thread-composer-dictation-timer"},gS=["aria-label","title","disabled"],vS=["aria-label","title","disabled"],yS={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},wS=["aria-label","title","disabled"],bS=["disabled"],_S=["disabled"],TS=["disabled"],kS=2e3,SS="codex-web-local.thread-draft.v1.",CS=Cn({__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,s=n,{t:o}=_o(),i=P(""),l=P([]),c=P([]),h=P([]),f=P([]),g=P(""),T=P(0),A=P(null),B=P(!1),{state:q,isSupported:Q,recordingDurationMs:V,waveformCanvasRef:R,startRecording:W,stopRecording:Z,toggleRecording:fe,cancel:ye}=NT({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:I=>{if(i.value=i.value?`${i.value}
|
|
48
|
-
${I}`:I,g.value="",r.dictationAutoSend!==!1){const U=r.isTurnInProgress?Se.value:"steer";Ce(U);return}Xt(()=>{var U;return(U=Ie.value)==null?void 0:U.focus()})},onEmpty:()=>{g.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:I=>{if(I instanceof DOMException&&I.name==="NotAllowedError"){g.value="Microphone access was denied.";return}g.value=I instanceof Error?I.message:"Dictation failed."}}),ee=P(null),Ae=P(null),ge=P(null),Ue=P(null),Ie=P(null),{isMobile:re}=hc(),de=P(!1),De=P(!1),qe=P(null),Pe=P(""),_e=P([]),Ee=P(!1),Ve=P(0),Qe=P(0);let Ke=0,Be=null,pt=!1,et=0,dt=0;const tt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let K="";const we=[{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 he(I){return I.trim().replace(/^gpt/i,"GPT")}const Oe=se(()=>r.models.map(I=>({value:I,label:he(I)}))),We=se(()=>r.selectedCollaborationMode==="plan"),k=se(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),E=se(()=>r.skills??[]),H=se(()=>c.value.map(I=>I.path)),G=se(()=>(r.skills??[]).map(I=>({value:I.path,label:I.name,description:I.description}))),oe=se(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||k.value||T.value>0?!1:i.value.trim().length>0||l.value.length>0||h.value.length>0),te=se(()=>i.value.trim().length>0||l.value.length>0||c.value.length>0||h.value.length>0||f.value.length>0),Te=se(()=>{const I=new Set;for(const U of f.value)for(const ne of U.filePaths)I.add(ne);return h.value.filter(U=>!I.has(U.fsPath))}),ce=se(()=>r.disabled||!r.activeThreadId),pe=se(()=>r.selectedModel.trim()==="gpt-5.4"),ae=se(()=>r.selectedSpeedMode==="fast"&&pe.value),Me=se(()=>ce.value||r.isUpdatingSpeedMode===!0),be=se(()=>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=se(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),Se=P($e.value),Xe=se(()=>q.value==="recording"),O=se(()=>q.value==="recording"?o("Stop dictation"):r.dictationClickToToggle?o("Click to dictate"):o("Hold to dictate")),j=se(()=>q.value==="idle"?g.value.trim():""),F=se(()=>{const I=Math.max(0,Math.floor(V.value/1e3)),U=Math.floor(I/60),ne=I%60;return`${U}:${String(ne).padStart(2,"0")}`}),J=se(()=>r.activeThreadId?k.value?o("Loading models for plan mode..."):o("Type a message... (@ for files, / for skills)"):o("Select a thread to send a message")),me=se(()=>i.value.trim().length>0||l.value.length>0||h.value.length>0);function Ce(I="steer"){var ne;const U=i.value.trim();if(oe.value){if(s("submit",{text:U,imageUrls:l.value.map(Ne=>Ne.url),fileAttachments:[...h.value],skills:c.value.map(Ne=>({name:Ne.name,path:Ne.path})),mode:I}),Ht(r.activeThreadId),je(),f.value=[],de.value=!1,De.value=!1,on(),tt||re.value){(ne=Ie.value)==null||ne.blur();return}Xt(()=>{var Ne;return(Ne=Ie.value)==null?void 0:Ne.focus()})}}function ke(I){Se.value=I}function Ze(I){Qe.value+=1,i.value=I.text,l.value=I.imageUrls.map((U,ne)=>({id:`queued-${Date.now()}-${ne}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${ne+1}`,url:U})),c.value=I.skills.map(U=>(r.skills??[]).find(ne=>ne.path===U.path)??{name:U.name,description:"",path:U.path}),h.value=I.fileAttachments.map(U=>({...U})),f.value=[],g.value="",A.value=null,T.value=0,de.value=!1,De.value=!1,on(),dt+=1}function je(){Ze({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function wt(I){return`${SS}${I}`}function pn(I){if(typeof window>"u")return null;const U=I.trim();if(!U)return null;try{const ne=window.localStorage.getItem(wt(U));if(!ne)return null;const Ne=JSON.parse(ne);return typeof Ne=="string"?{text:Ne,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Ne.text=="string"?Ne.text:"",imageUrls:Array.isArray(Ne.imageUrls)?Ne.imageUrls.filter(mt=>typeof mt=="string"):[],fileAttachments:Array.isArray(Ne.fileAttachments)?Ne.fileAttachments.filter(mt=>!!mt&&typeof mt.label=="string"&&typeof mt.path=="string"&&typeof mt.fsPath=="string"):[],skills:Array.isArray(Ne.skills)?Ne.skills.filter(mt=>!!mt&&typeof mt.name=="string"&&typeof mt.path=="string"):[]}}catch{return null}}function Xn(I,U){if(typeof window>"u")return;const ne=I.trim();if(ne)try{if(U.text.trim().length>0||U.imageUrls.length>0||U.fileAttachments.length>0||U.skills.length>0){window.localStorage.setItem(wt(ne),JSON.stringify(U));return}window.localStorage.removeItem(wt(ne))}catch{}}function Ht(I){Xn(I,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Zn(){return{text:i.value,imageUrls:l.value.map(I=>I.url),fileAttachments:h.value.map(I=>({...I})),skills:c.value.map(I=>({name:I.name,path:I.path}))}}function er(){s("interrupt")}function Fr(I){s("update:selected-model",I)}function Dn(){s("update:selected-collaboration-mode",We.value?"default":"plan")}function vn(I){s("update:selected-reasoning-effort",I)}function Ft(){Me.value||s("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function _r(){r.dictationClickToToggle&&(g.value&&(g.value=""),fe())}function hr(I){if(r.dictationClickToToggle||(I.preventDefault(),pt))return;pt=!0;const U=I.currentTarget;if(U)try{U.setPointerCapture(I.pointerId)}catch{}g.value&&(g.value=""),window.addEventListener("pointerup",un),window.addEventListener("pointercancel",un),window.addEventListener("blur",un),W()}function un(){r.dictationClickToToggle||pt&&(pt=!1,window.removeEventListener("pointerup",un),window.removeEventListener("pointercancel",un),window.removeEventListener("blur",un),Z())}function pr(){ce.value||(de.value=!de.value)}function ht(){var I;(I=Ae.value)==null||I.click()}function mr(){var I;(I=ge.value)==null||I.click()}function _t(){var I;(I=Ue.value)==null||I.click()}function Ln(I){l.value=l.value.filter(U=>U.id!==I)}function xn(I){c.value=c.value.filter(U=>U.path!==I)}function tr(I){h.value=h.value.filter(U=>U.fsPath!==I)}function $t(I){const U=f.value.find(Ne=>Ne.id===I);if(!U)return;const ne=new Set(U.filePaths);h.value=h.value.filter(Ne=>!ne.has(Ne.fsPath)),f.value=f.value.filter(Ne=>Ne.id!==I)}function Mt(I){return I.total<=0?0:Math.round(I.processed/I.total*100)}function Zt(I,U){const ne=I.replace(/\\/g,"/");if(h.value.some(Wt=>Wt.fsPath===ne))return;const Ne=ne.split("/").filter(Boolean),mt=(U==null?void 0:U.trim())||Ne[Ne.length-1]||ne;h.value=[...h.value,{label:mt,path:ne,fsPath:ne}]}function jn(I){return I.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(I.name)}function yn(I){return I?Array.from(I):[]}function Tr(I){return I!==dt?!1:(T.value+=1,!0)}function ir(I){I===dt&&(T.value=Math.max(0,T.value-1))}function kr(I){if(I<=0)return;const U=A.value,ne=U?U.succeeded+U.failed:0;if(!U||ne>=U.total){A.value={total:I,succeeded:0,failed:0};return}A.value={...U,total:U.total+I}}function An(I){const U=A.value;U&&(A.value={...U,succeeded:U.succeeded+(I==="success"?1:0),failed:U.failed+(I==="failure"?1:0)})}function lr(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Sr(I){const U=new Date,ne=[U.getFullYear(),String(U.getMonth()+1).padStart(2,"0"),String(U.getDate()).padStart(2,"0"),String(U.getHours()).padStart(2,"0"),String(U.getMinutes()).padStart(2,"0"),String(U.getSeconds()).padStart(2,"0")].join("-"),Ne=I.type.startsWith("image/")&&I.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${ne}.${Ne}`}function Cr(){const I=new Date;return`pasted-text-${[I.getFullYear(),String(I.getMonth()+1).padStart(2,"0"),String(I.getDate()).padStart(2,"0"),String(I.getHours()).padStart(2,"0"),String(I.getMinutes()).padStart(2,"0"),String(I.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Fn(I){return I.name.trim()?I:new File([I],Sr(I),{type:I.type||"image/png",lastModified:Date.now()})}async function Gt(I,U){if(Tr(U))try{const ne=Fn(I),Ne=await du(ne);if(U!==dt)return;if(!Ne){An("failure");return}l.value=[...l.value,{id:lr(),name:ne.name,url:`/codex-local-image?path=${encodeURIComponent(Ne)}`}],An("success")}catch{U===dt&&An("failure")}finally{ir(U)}}async function Un(I,U){if(Tr(U))try{const ne=await du(I);if(U!==dt)return;if(!ne){An("failure");return}Zt(ne),An("success")}catch{U===dt&&An("failure")}finally{ir(U)}}function en(I){const U=yn(I);if(U.length===0)return;kr(U.length),de.value=!1,De.value=!1,on();const ne=dt;for(const Ne of U)jn(Ne)?Gt(Ne,ne):Un(Ne,ne)}function Bn(){et=0,B.value=!1}function En(I){return I?Array.from(I.types??[]).includes("Files"):!1}async function xr(I){if(!I||I.length===0)return;const U=Qe.value,ne=Array.from(I),mt=(ne[0].webkitRelativePath||ne[0].name).split("/").filter(Boolean)[0]||"Folder",Wt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;f.value=[...f.value,{id:Wt,name:mt,total:ne.length,processed:0,filePaths:[],isUploading:!0}];const Ut=Bt=>{U===Qe.value&&(f.value=f.value.map(Dt=>Dt.id===Wt?Bt(Dt):Dt))};for(const Bt of ne)try{const Dt=await du(Bt);if(U!==Qe.value)return;if(Dt){const _n=Bt.webkitRelativePath||Bt.name;Zt(Dt,_n),Ut(Kt=>({...Kt,processed:Kt.processed+1,filePaths:[...Kt.filePaths,Dt]}));continue}Ut(_n=>({..._n,processed:_n.processed+1}))}catch{Ut(Dt=>({...Dt,processed:Dt.processed+1}))}Ut(Bt=>({...Bt,isUploading:!1}))}function gr(I){I&&(I.value="")}function eo(I){const U=I.target;en((U==null?void 0:U.files)??null),gr(U),de.value=!1}function wn(I){const U=I.target;en((U==null?void 0:U.files)??null),gr(U),de.value=!1}function Ot(I){const U=I.target;xr((U==null?void 0:U.files)??null),gr(U),de.value=!1}function bn(I){ce.value||!En(I.dataTransfer)||(I.preventDefault(),et+=1,B.value=!0)}function In(I){ce.value||!En(I.dataTransfer)||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="copy"),B.value=!0)}function cn(I){B.value&&(I.preventDefault(),et=Math.max(0,et-1),et===0&&Bn())}function Vt(I){var U;ce.value||!En(I.dataTransfer)||(I.preventDefault(),Bn(),en(((U=I.dataTransfer)==null?void 0:U.files)??null))}function ct(){!B.value&&et===0||Bn()}function nr(I){var Wt,Ut;if(ce.value)return;const U=((Wt=I.clipboardData)==null?void 0:Wt.getData("text/plain"))??"";if(U.length>=kS){I.preventDefault();const Bt=new File([U],Cr(),{type:"text/plain",lastModified:Date.now()});en([Bt]);return}const ne=Array.from(((Ut=I.clipboardData)==null?void 0:Ut.items)??[]);if(ne.length===0)return;const Ne=U.length>0,mt=ne.filter(Bt=>Bt.kind==="file"&&Bt.type.startsWith("image/")).map(Bt=>Bt.getAsFile()).filter(Bt=>Bt instanceof File);mt.length!==0&&(Ne||I.preventDefault(),en(mt))}function rr(){g.value&&(g.value="");const U=i.value.startsWith("/");U!==De.value&&(De.value=U),or()}function qn(I){if(Ee.value){if(I.key==="Escape"){I.preventDefault(),on();return}if(I.key==="ArrowDown"){I.preventDefault(),_e.value.length>0&&(Ve.value=(Ve.value+1)%_e.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),_e.value.length>0){const ne=_e.value.length;Ve.value=(Ve.value+ne-1)%ne}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const ne=_e.value[Ve.value];ne?Nt(ne):on();return}}if(r.sendWithEnter!==!1?I.key==="Enter"&&!I.shiftKey:I.key==="Enter"&&(I.metaKey||I.ctrlKey)){I.preventDefault(),Ce(r.isTurnInProgress?Se.value:"steer");return}if(De.value){if(I.key==="Escape"){I.preventDefault(),ur();return}if(I.key==="ArrowDown"||I.key==="ArrowUp"){I.preventDefault();return}}}function ur(){var I;De.value=!1,(I=Ie.value)==null||I.focus()}function on(){Ee.value=!1,qe.value=null,Pe.value="",_e.value=[],Ve.value=0}function or(){const I=Ie.value;if(!I){on();return}const U=I.selectionStart??i.value.length,Ne=i.value.slice(0,U).match(/(^|\s)(@[^\s@]*)$/);if(!Ne){on();return}const mt=Ne[2]??"",Wt=mt.length,Ut=U-Wt;qe.value=Ut,Pe.value=mt.slice(1),Ee.value=!0,Tt()}async function Tt(){if(!Ee.value)return;const I=(r.cwd??"").trim();if(!I){_e.value=[];return}Be&&clearTimeout(Be);const U=++Ke;Be=setTimeout(async()=>{try{const ne=await Jb(I,Pe.value,20);if(!Ee.value||U!==Ke)return;_e.value=ne,Ve.value=0}catch{if(!Ee.value||U!==Ke)return;_e.value=[]}},120)}function Nt(I){const U=Ie.value,ne=qe.value;if(ne!==null&&U){const Ne=U.selectionStart??i.value.length;i.value=`${i.value.slice(0,ne)}${i.value.slice(Ne)}`.trimEnd()}Zt(I.path),on(),Xt(()=>U==null?void 0:U.focus())}function Hn(I){ye(),Ze(I),Xt(()=>{var U;return(U=Ie.value)==null?void 0:U.focus()})}function sr(I){const U=I.trim();U&&(ye(),i.value.trim().length>0?i.value=`${i.value.trimEnd()}
|
|
49
|
-
${U}`:i.value=U,Xt(()=>{var ne;return(ne=Ie.value)==null?void 0:ne.focus()}))}function Vn(I){const U=I.lastIndexOf("/");return U<0?I:I.slice(U+1)}function Wn(I){const U=I.lastIndexOf("/");return U<=0?"":I.slice(0,U)}function Ar(I){const U=Vn(I),ne=U.lastIndexOf(".");return ne<=0?"":U.slice(ne+1).toLowerCase()}function Ur(I){const U=Ar(I);return U==="ts"?"TS":U==="tsx"?"TSX":U==="js"?"JS":U==="jsx"?"JSX":U==="json"?"{}":""}function ft(I){const U=Ar(I);return U.startsWith("ts")?"ts":U.startsWith("js")?"js":U==="json"?"json":"default"}function tn(I){const U=Ar(I);return U==="md"||U==="mdx"}function nn(I){var U;c.value.some(ne=>ne.path===I.path)||(c.value=[...c.value,I]),i.value=i.value.startsWith("/")?"":i.value,De.value=!1,(U=Ie.value)==null||U.focus()}function cr(I,U){if(U){const ne=(r.skills??[]).find(Ne=>Ne.path===I);ne&&!c.value.some(Ne=>Ne.path===I)&&(c.value=[...c.value,ne])}else c.value=c.value.filter(ne=>ne.path!==I)}function dr(I){if(!de.value)return;const U=ee.value;if(!U)return;const ne=I.target;!ne||U.contains(ne)||(de.value=!1)}return Uo(()=>{document.addEventListener("click",dr),window.addEventListener("drop",ct),window.addEventListener("dragend",ct),window.addEventListener("blur",ct)}),t({hydrateDraft:Hn,appendTextToDraft:sr,hasUnsavedDraft:()=>te.value}),ds(()=>{document.removeEventListener("click",dr),window.removeEventListener("drop",ct),window.removeEventListener("dragend",ct),window.removeEventListener("blur",ct),window.removeEventListener("pointerup",un),window.removeEventListener("pointercancel",un),window.removeEventListener("blur",un),Be&&clearTimeout(Be)}),ut(()=>r.activeThreadId,I=>{ye(),K&&Xn(K,Zn()),je();const U=pn(I);U&&(Ze(U),rr()),K=I.trim()},{immediate:!0}),ut([i,l,h,c],()=>{K&&Xn(K,Zn())},{deep:!0}),ut(()=>r.cwd,()=>{Ee.value&&Tt()}),ut($e,I=>{Se.value=I}),(I,U)=>(x(),$("form",{class:"thread-composer",onSubmit:U[4]||(U[4]=ot(ne=>Ce(e.isTurnInProgress?Se.value:"steer"),["prevent"]))},[j.value?(x(),$("p",Ak,D(j.value),1)):ue("",!0),m("div",{class:at(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":B.value}])},[l.value.length>0?(x(),$("div",Ek,[(x(!0),$(He,null,jt(l.value,ne=>(x(),$("div",{key:ne.id,class:"thread-composer-attachment"},[m("img",{class:"thread-composer-attachment-image",src:ne.url,alt:ne.name||"Selected image"},null,8,Ik),m("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${ne.name||"image"}`,disabled:ce.value,onClick:Ne=>Ln(ne.id)}," x ",8,Mk)]))),128))])):ue("",!0),f.value.length>0?(x(),$("div",Pk,[(x(!0),$(He,null,jt(f.value,ne=>(x(),$("span",{key:ne.id,class:"thread-composer-folder-chip"},[Fe(vc,{class:"thread-composer-folder-chip-icon"}),m("span",{class:"thread-composer-folder-chip-name",title:ne.name},D(ne.name),9,Rk),m("span",$k,[ne.isUploading?(x(),$(He,{key:0},[cs(D(Mt(ne))+"% uploading ("+D(ne.processed)+"/"+D(ne.total)+") ",1)],64)):(x(),$(He,{key:1},[cs(D(ne.filePaths.length)+" file"+D(ne.filePaths.length===1?"":"s"),1)],64))]),m("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${ne.name}`,disabled:ce.value,onClick:Ne=>$t(ne.id)},"×",8,Ok)]))),128))])):ue("",!0),Te.value.length>0?(x(),$("div",Nk,[(x(!0),$(He,null,jt(Te.value,ne=>(x(),$("span",{key:ne.fsPath,class:"thread-composer-file-chip"},[Fe(Fi,{class:"thread-composer-file-chip-icon"}),m("span",{class:"thread-composer-file-chip-name",title:ne.fsPath},D(ne.label),9,Dk),m("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${ne.label}`,disabled:ce.value,onClick:Ne=>tr(ne.fsPath)},"×",8,Lk)]))),128))])):ue("",!0),c.value.length>0?(x(),$("div",jk,[(x(!0),$(He,null,jt(c.value,ne=>(x(),$("span",{key:ne.path,class:"thread-composer-skill-chip"},[m("span",Fk,D(ne.name),1),m("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${ne.name}`,onClick:Ne=>xn(ne.path)},"×",8,Uk)]))),128))])):ue("",!0),m("div",{class:at(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":B.value}]),onDragenter:bn,onDragover:In,onDragleave:cn,onDrop:Vt},[B.value?(x(),$("div",Bk,[...U[5]||(U[5]=[m("span",{class:"thread-composer-drop-overlay-copy"},"Drop images or files",-1)])])):ue("",!0),Ee.value?(x(),$("div",qk,[_e.value.length>0?(x(!0),$(He,{key:0},jt(_e.value,(ne,Ne)=>(x(),$("button",{key:ne.path,class:at(["thread-composer-file-mention-row",{"is-active":Ne===Ve.value}]),type:"button",onMousedown:ot(mt=>Nt(ne),["prevent"])},[Ur(ne.path)?(x(),$("span",{key:0,class:at(["thread-composer-file-mention-icon-badge",`is-${ft(ne.path)}`])},D(Ur(ne.path)),3)):tn(ne.path)?(x(),$("span",Vk,"↓")):(x(),lt(Fi,{key:2,class:"thread-composer-file-mention-icon-file"})),m("span",Wk,[m("span",zk,D(Vn(ne.path)),1),Wn(ne.path)?(x(),$("span",Gk,D(Wn(ne.path)),1)):ue("",!0)])],42,Hk))),128)):(x(),$("div",Kk,D(S(o)("No matching files")),1))])):ue("",!0),ln(m("textarea",{ref_key:"inputRef",ref:Ie,"onUpdate:modelValue":U[0]||(U[0]=ne=>i.value=ne),class:"thread-composer-input",placeholder:J.value,disabled:ce.value,onInput:rr,onKeydown:qn,onPaste:nr},null,40,Yk),[[gn,i.value]]),Fe(xk,{skills:E.value,visible:De.value,"anchor-bottom":44,"anchor-left":0,onSelect:nn,onClose:ur},null,8,["skills","visible"])],34),m("div",{class:at(["thread-composer-controls",{"thread-composer-controls--recording":Xe.value}])},[m("div",{ref_key:"attachMenuRootRef",ref:ee,class:"thread-composer-attach"},[m("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":S(o)("Add photos & files"),disabled:ce.value,onClick:pr}," + ",8,Jk),de.value?(x(),$("div",Qk,[m("button",{class:"thread-composer-attach-item",type:"button",disabled:ce.value,onClick:ht},D(S(o)("Add photos & files")),9,Xk),m("button",{class:"thread-composer-attach-item",type:"button",disabled:ce.value,onClick:_t},D(S(o)("Add folder")),9,Zk),m("button",{class:"thread-composer-attach-item",type:"button",disabled:ce.value,onClick:mr},D(S(o)("Take photo")),9,eS),U[6]||(U[6]=m("div",{class:"thread-composer-attach-separator"},null,-1)),m("div",tS,[m("span",nS,D(S(o)("In-progress send")),1),m("div",rS,[m("button",{class:at(["thread-composer-attach-mode-button",{"is-active":Se.value==="steer"}]),type:"button",disabled:ce.value,onClick:U[1]||(U[1]=ne=>ke("steer"))},D(S(o)("Steer")),11,oS),m("button",{class:at(["thread-composer-attach-mode-button",{"is-active":Se.value==="queue"}]),type:"button",disabled:ce.value,onClick:U[2]||(U[2]=ne=>ke("queue"))},D(S(o)("Queue")),11,sS)])]),U[7]||(U[7]=m("div",{class:"thread-composer-attach-separator"},null,-1)),pe.value?(x(),$("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:Ft},[m("span",iS,[m("span",lS,D(S(o)("Fast mode")),1),m("span",uS,D(be.value),1)]),m("span",{class:at(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":Me.value}])},null,2)],8,aS)):ue("",!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:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:Dn},[m("span",dS,[m("span",fS,D(S(o)("Plan mode")),1),m("span",hS,D(S(o)("Agent proposes a plan before acting")),1)]),m("span",{class:at(["thread-composer-attach-switch",{"is-on":We.value}])},null,2)],8,cS)])):ue("",!0)],512),Xe.value?ue("",!0):(x(),$(He,{key:0},[Fe(as,{class:"thread-composer-control","model-value":e.selectedModel,options:Oe.value,"selected-prefix-icon":ae.value?HT:null,placeholder:S(o)("Model"),"open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"enable-search":"","search-placeholder":S(o)("Search models..."),"onUpdate:modelValue":Fr},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Fe(vk,{class:"thread-composer-control",options:G.value,"selected-values":H.value,placeholder:S(o)("Skills"),"search-placeholder":S(o)("Search skills..."),"open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:cr},null,8,["options","selected-values","placeholder","search-placeholder","disabled"]),Fe(as,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:we,placeholder:S(o)("Thinking"),"open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":vn},null,8,["model-value","placeholder","disabled"])],64)),m("div",{class:at(["thread-composer-actions",{"thread-composer-actions--recording":Xe.value}])},[S(q)==="recording"?(x(),$("div",pS,[m("canvas",{ref_key:"dictationWaveformCanvasRef",ref:R,class:"thread-composer-dictation-waveform"},null,512)])):ue("",!0),S(q)==="recording"?(x(),$("span",mS,D(F.value),1)):ue("",!0),S(Q)?(x(),$("button",{key:2,class:at(["thread-composer-mic",{"thread-composer-mic--active":S(q)==="recording"}]),type:"button","aria-label":O.value,title:O.value,disabled:ce.value,onClick:_r,onPointerdown:hr,onPointerup:un,onPointercancel:un},[S(q)==="recording"?(x(),lt(mf,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(x(),lt(GT,{key:1,class:"thread-composer-mic-icon"}))],42,gS)):ue("",!0),e.isTurnInProgress&&!me.value?(x(),$("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:er},[e.isStopPending?(x(),$("span",yS)):(x(),lt(mf,{key:1,class:"thread-composer-stop-icon"}))],8,vS)):(x(),$("button",{key:4,class:at(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Se.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&Se.value==="queue"?S(o)("Queue message"):S(o)("Send message"),title:e.isTurnInProgress?`${S(o)("Send")} ${Se.value==="queue"?S(o)("Queue"):S(o)("Steer")}`:S(o)("Send"),disabled:!oe.value,onClick:U[3]||(U[3]=ne=>Ce(e.isTurnInProgress?Se.value:"steer"))},[Fe(FT,{class:"thread-composer-submit-icon"})],10,wS))],2)],2)],2),m("input",{ref_key:"photoLibraryInputRef",ref:Ae,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:ce.value,onChange:eo},null,40,bS),m("input",{ref_key:"cameraCaptureInputRef",ref:ge,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:ce.value,onChange:wn},null,40,_S),m("input",{ref_key:"folderPickerInputRef",ref:Ue,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:ce.value,onChange:Ot},null,40,TS)],32))}}),gf=yt(CS,[["__scopeId","data-v-070fe8ac"]]),xS={key:0,class:"thread-pending-request"},AS={class:"thread-pending-request-title"},ES=["title"],IS={class:"thread-pending-request-approval"},MS=["aria-label"],PS=["aria-pressed","onClick"],RS={class:"thread-pending-request-option-index"},$S={class:"thread-pending-request-option-label"},OS={class:"thread-pending-request-footer thread-pending-request-footer--approval"},NS=["value","placeholder"],DS={class:"thread-pending-request-header"},LS={class:"thread-pending-request-heading"},jS={class:"thread-pending-request-eyebrow"},FS={class:"thread-pending-request-title"},US={key:0,class:"thread-pending-request-counter"},BS={key:0,class:"thread-pending-request-preview"},qS={class:"thread-pending-request-preview-code"},HS={key:1,class:"thread-pending-request-user-input"},VS={key:0,class:"thread-pending-request-question-description"},WS=["href"],zS={class:"thread-pending-request-question-title"},GS={key:0},KS={key:0,class:"thread-pending-request-question-text"},YS={key:1,class:"thread-pending-request-input-wrap"},JS={class:"thread-pending-request-select-label"},QS=["type","value","onInput"],XS={key:2,class:"thread-pending-request-select-wrap"},ZS={class:"thread-pending-request-select-label"},e1=["value","onChange"],t1={key:0,value:""},n1={value:"true"},r1={value:"false"},o1={key:3,class:"thread-pending-request-select-wrap"},s1={class:"thread-pending-request-select-label"},a1=["value","onChange"],i1={key:0,value:""},l1=["value"],u1={key:4,class:"thread-pending-request-question-options"},c1=["checked","onChange"],d1={class:"thread-pending-request-checkbox-label"},f1={key:2,class:"thread-pending-request-validation-error"},h1={class:"thread-pending-request-footer"},p1={key:2,class:"thread-pending-request-user-input"},m1={class:"thread-pending-request-question-title"},g1={key:0,class:"thread-pending-request-question-text"},v1={key:1,class:"thread-pending-request-question-options"},y1={class:"thread-pending-request-select-wrap"},w1={class:"thread-pending-request-select-label"},b1=["value","onChange"],_1=["value"],T1={key:0,class:"thread-pending-request-question-description"},k1={key:2,class:"thread-pending-request-input-wrap"},S1={class:"thread-pending-request-select-label"},C1=["value","placeholder","onInput"],x1={class:"thread-pending-request-footer"},A1={key:3,class:"thread-pending-request-actions"},E1={key:4,class:"thread-pending-request-actions"},I1=Cn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,r=t,s=P("accept"),o=P(""),i=P({}),l=P({}),c=P({}),h=P(""),{t:f}=_o();function g(O){return O!==null&&typeof O=="object"&&!Array.isArray(O)?O:null}function T(O){return typeof O=="string"?O.trim():""}function A(O){return typeof O=="string"?O:null}function B(O){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(O)?O:JSON.stringify(O)}function q(O){const F=(Array.isArray(O.commandActions)?O.commandActions:[]).map(J=>g(J)).map(J=>T(J==null?void 0:J.command)).find(J=>J.length>0);if(F)return F.replace(/\s+/g," ").trim();if(Array.isArray(O.command)){const J=O.command.filter(me=>typeof me=="string").map(me=>me.trim()).filter(me=>me.length>0);if(J.length>0)return J.map(me=>B(me)).join(" ")}return Ae(T(O.command))}function Q(O){return O.method==="item/commandExecution/requestApproval"||O.method==="execCommandApproval"}function V(O){return O.method==="item/fileChange/requestApproval"||O.method==="applyPatchApproval"}function R(O){return O.method==="item/permissions/requestApproval"}function W(O){return Q(O)||V(O)||R(O)}function Z(O){return O.method==="mcpServer/elicitation/request"}function fe(O){const j=g(O.params);return T(j==null?void 0:j.reason)||T(j==null?void 0:j.prompt)||T(j==null?void 0:j.message)}function ye(O){return W(O)?"Awaiting approval":Z(O)?"MCP server input required":O.method==="item/tool/requestUserInput"?"Awaiting response":O.method==="item/tool/call"?"Tool call waiting for response":O.method}function ee(O){const j=fe(O);return j||(Q(O)?"Do you want to run this command?":V(O)?"Do you want to make these changes?":R(O)?"Do you want to grant these permissions?":Z(O)?"An MCP server needs your input before Codex can continue.":O.method==="item/tool/requestUserInput"?"Codex needs your answer before it can continue.":"Codex is waiting for a response before it can continue.")}function Ae(O){var Ce;const j=O.trim();if(!j)return"";const F=j.match(/-Command\s+(.+)$/i),J=((Ce=F==null?void 0:F[1])==null?void 0:Ce.trim())??j;return(J.startsWith('"')&&J.endsWith('"')?J.slice(1,-1):J).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function ge(O){const j=g(O.params);if(!j)return"";if(Q(O))return q(j);if(V(O)){const F=T(j.grantRoot)||T(j.grant_root);if(F)return F.replace(/\s+/g," ").trim();const J=g(j.fileChanges)??g(j.changes);if(!J)return"";const me=Object.keys(J).map(Ce=>Ce.trim()).filter(Ce=>Ce.length>0);return me.length===0?"":me.slice(0,3).join(", ")}return R(O)?Ue(j.permissions):Z(O)?T(j.serverName)||T(j.url):""}function Ue(O){const j=g(O);if(!j)return"";const F=[],J=g(j.fileSystem),me=g(j.network),Ce=Array.isArray(J==null?void 0:J.read)?J.read.filter(Ze=>typeof Ze=="string"):[],ke=Array.isArray(J==null?void 0:J.write)?J.write.filter(Ze=>typeof Ze=="string"):[];return Ce.length>0&&F.push(`Read: ${Ce.join(", ")}`),ke.length>0&&F.push(`Write: ${ke.join(", ")}`),(me==null?void 0:me.enabled)===!0&&F.push("Network access"),F.join(" • ")}function Ie(O){return!O||!W(O)?[]:[{id:"accept",label:"Yes"},{id:"acceptForSession",label:"Yes for Session"}]}const re=se(()=>Ie(n.request));ut(()=>{var O;return((O=n.request)==null?void 0:O.id)??0},()=>{var O;o.value="",i.value={},l.value={},c.value={},h.value="",s.value=((O=re.value[0])==null?void 0:O.id)??"accept"},{immediate:!0}),ut(re,O=>{var j;s.value!=="decline"&&(O.some(F=>F.id===s.value)||(s.value=((j=O[0])==null?void 0:j.id)??"accept"))},{immediate:!0});function de(O,j){return`${String(O)}:${j}`}function De(O){const j=g(O.params),F=Array.isArray(j==null?void 0:j.questions)?j.questions:[],J=[];for(const me of F){const Ce=g(me);if(!Ce)continue;const ke=T(Ce.id);if(!ke)continue;const Ze=Array.isArray(Ce.options)?Ce.options.map(je=>g(je)).map(je=>({label:T(je==null?void 0:je.label),description:T(je==null?void 0:je.description)})).filter(je=>je.label.length>0):[];J.push({id:ke,header:T(Ce.header),question:T(Ce.question),isOther:Ce.isOther===!0,options:Ze})}return J}function qe(O,j,F){const J=de(O,j),me=i.value[J];return typeof me=="string"&&me.length>0?me:F}function Pe(O,j){return l.value[de(O,j)]??""}function _e(O,j,F){const J=F.target;if(!(J instanceof HTMLSelectElement))return;const me=de(O,j);i.value={...i.value,[me]:J.value}}function Ee(O,j,F){const J=F.target;if(!(J instanceof HTMLInputElement))return;const me=de(O,j);l.value={...l.value,[me]:J.value}}function Ve(O,j,F){var me,Ce;const J=qe(O,j,((me=F[0])==null?void 0:me.label)||"");return((Ce=F.find(ke=>ke.label===J))==null?void 0:Ce.description)??""}function Qe(O,j){return`${String(O)}:${j}`}function Ke(O){var j;return T((j=g(O.params))==null?void 0:j.serverName)}function Be(O){var F;const j=T((F=g(O.params))==null?void 0:F.url);if(!j)return"";try{const J=new URL(j),me=J.protocol.toLowerCase();return me==="https:"||me==="http:"?J.toString():""}catch{return""}}function pt(O){const j=g(O.params),F=g(j==null?void 0:j.requestedSchema),J=g(F==null?void 0:F.properties);if(!J)return[];const me=new Set(Array.isArray(F==null?void 0:F.required)?F.required.filter(Ce=>typeof Ce=="string"):[]);return Object.entries(J).map(([Ce,ke])=>et(Ce,g(ke),me.has(Ce))).filter(Ce=>Ce!==null)}function et(O,j,F){if(!j)return null;const J=T(j.title)||O,me=T(j.description),Ce=T(j.type);if(Ce==="boolean")return{key:O,label:J,description:me,required:F,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof j.default=="boolean"?j.default:null,hasExplicitDefault:typeof j.default=="boolean"};if(Ce==="number"||Ce==="integer")return{key:O,label:J,description:me,required:F,kind:"number",inputType:"number",options:[],defaultValue:typeof j.default=="number"?j.default:null,hasExplicitDefault:typeof j.default=="number"};const ke=dt(j);if(Ce==="array")return{key:O,label:J,description:me,required:F,kind:"multiEnum",inputType:"checkbox",options:ke,defaultValue:Array.isArray(j.default)?j.default.filter(je=>typeof je=="string"):[],hasExplicitDefault:Array.isArray(j.default)};const Ze=A(j.default);return ke.length>0?{key:O,label:J,description:me,required:F,kind:"singleEnum",inputType:"select",options:ke,defaultValue:Ze,hasExplicitDefault:Ze!==null}:{key:O,label:J,description:me,required:F,kind:"string",inputType:tt(j),options:[],defaultValue:Ze,hasExplicitDefault:Ze!==null}}function dt(O){const F=(Array.isArray(O.oneOf)?O.oneOf:Array.isArray(O.anyOf)?O.anyOf:[]).map(ke=>g(ke)).map(ke=>({value:T(ke==null?void 0:ke.const),label:T(ke==null?void 0:ke.title)||T(ke==null?void 0:ke.const)})).filter(ke=>ke.value.length>0);if(F.length>0)return F;const J=g(O.items);if(J){const ke=dt(J);if(ke.length>0)return ke}const me=Array.isArray(O.enum)?O.enum.filter(ke=>typeof ke=="string"):[],Ce=Array.isArray(O.enumNames)?O.enumNames.filter(ke=>typeof ke=="string"):[];return me.map((ke,Ze)=>({value:ke,label:Ce[Ze]||ke}))}function tt(O){const j=T(O.format);return j==="email"?"email":j==="uri"?"url":j==="date"?"date":j==="date-time"?"datetime-local":"text"}function K(O,j){const F=c.value[Qe(O,j.key)];return F!==void 0?F:j.defaultValue}function we(O,j){const F=K(O,j);return Array.isArray(F)?F.filter(J=>typeof J=="string"):[]}function he(O,j,F){const J=F.target;if(!(J instanceof HTMLInputElement)&&!(J instanceof HTMLSelectElement))return;const me=J.value,Ce=(j.kind==="number",me);c.value={...c.value,[Qe(O,j.key)]:me.length>0?Ce:null},h.value=""}function Oe(O,j,F){const J=F.target;if(!(J instanceof HTMLSelectElement))return;let me=null;J.value==="true"?me=!0:J.value==="false"&&(me=!1),c.value={...c.value,[Qe(O,j.key)]:me},h.value=""}function We(O,j,F,J){const me=J.target;if(!(me instanceof HTMLInputElement))return;const Ce=new Set(we(O,j));me.checked?Ce.add(F):Ce.delete(F),c.value={...c.value,[Qe(O,j.key)]:Array.from(Ce)},h.value=""}function k(O){return O===!0?"true":O===!1?"false":""}function E(O,j){const F=K(O,j);return j.kind==="multiEnum"?Array.isArray(F)&&F.length>0:j.kind==="boolean"?typeof F=="boolean":j.kind==="number"&&typeof F=="number"?!0:typeof F=="string"&&F.trim().length>0}function H(O){const j=pt(O).filter(F=>F.required&&!E(O.id,F)).map(F=>F.label);return j.length===0?"":j.length===1?`Answer the required field: ${j[0]}.`:`Answer the required fields: ${j.join(", ")}.`}function G(O){const j={};for(const F of pt(O)){const J=K(O.id,F);if(F.kind==="multiEnum"){const Ce=Array.isArray(J)?J:[];(Ce.length>0||F.required)&&(j[F.key]=Ce);continue}if(F.kind==="boolean"){typeof J=="boolean"&&(j[F.key]=J);continue}if(F.kind==="number"){const Ce=typeof J=="number"?J:Number(String(J).trim());Number.isNaN(Ce)||(j[F.key]=Ce);continue}const me=String(J??"").trim();(me.length>0||F.required)&&(j[F.key]=me)}return j}function oe(O){s.value=O}function te(){s.value="decline"}function Te(O){const j=O.target;j instanceof HTMLInputElement&&(o.value=j.value,s.value="decline")}function ce(O,j){var F;if(R(O)){if(j==="decline"||j==="cancel"){r("respondServerRequest",{id:O.id,error:{code:-32e3,message:j==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const J=g((F=g(O.params))==null?void 0:F.permissions)??{};r("respondServerRequest",{id:O.id,result:{permissions:J,scope:j==="acceptForSession"?"session":"turn"}});return}r("respondServerRequest",{id:O.id,result:{decision:j}})}function pe(O){const j=o.value.trim(),F=j.length>0?"decline":s.value;if(R(O)){ce(O,F);return}r("respondServerRequest",{id:O.id,result:{decision:F},followUpMessageText:j||void 0})}function ae(O,j){const F=g(O.params),J={action:j};if(j==="accept"&&T(F==null?void 0:F.mode)==="form"){const me=H(O);if(me){h.value=me;return}J.content=G(O)}r("respondServerRequest",{id:O.id,result:J})}function Me(O){var J;const j=De(O),F={};for(const me of j){const Ce=qe(O.id,me.id,((J=me.options[0])==null?void 0:J.label)||""),ke=Pe(O.id,me.id).trim(),Ze=[Ce,ke].map(je=>je.trim()).filter(je=>je.length>0);F[me.id]={answers:Ze}}r("respondServerRequest",{id:O.id,result:{answers:F}})}function be(O){r("respondServerRequest",{id:O.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function $e(O){r("respondServerRequest",{id:O.id,result:{success:!0,contentItems:[]}})}function Se(O){r("respondServerRequest",{id:O.id,result:{}})}function Xe(O){r("respondServerRequest",{id:O.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(O,j)=>e.request?(x(),$("section",xS,[m("article",{class:at(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[W(e.request)?(x(),$(He,{key:0},[m("p",AS,D(ee(e.request)),1),ge(e.request)?(x(),$("p",{key:0,class:"thread-pending-request-command-line",title:ge(e.request)},D(ge(e.request)),9,ES)):ue("",!0),m("section",IS,[m("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":S(f)("Approval choices")},[(x(!0),$(He,null,jt(re.value,(F,J)=>(x(),$("button",{key:F.id,type:"button",class:at(["thread-pending-request-option",{"is-selected":s.value===F.id}]),"aria-pressed":s.value===F.id,onClick:me=>oe(F.id)},[m("span",RS,D(J+1)+".",1),m("span",$S,D(F.label),1)],10,PS))),128))],8,MS),m("footer",OS,[m("label",{class:at(["thread-pending-request-inline-input",{"is-active":s.value==="decline"||o.value.length>0}])},[j[11]||(j[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:te,onInput:Te,onKeydown:j[0]||(j[0]=Qt(ot(F=>pe(e.request),["prevent"]),["enter"]))},null,40,NS)],2),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:j[1]||(j[1]=F=>ce(e.request,"cancel"))},D(S(f)("Skip")),1),m("button",{type:"button",class:"thread-pending-request-primary",onClick:j[2]||(j[2]=F=>pe(e.request))},D(S(f)("Send")),1)])])],64)):(x(),$(He,{key:1},[m("header",DS,[m("div",LS,[m("p",jS,D(ye(e.request)),1),m("p",FS,D(ee(e.request)),1)]),(e.requestCount??0)>1?(x(),$("span",US,D(e.requestCount??0)+" pending",1)):ue("",!0)]),ge(e.request)?(x(),$("div",BS,[m("code",qS,D(ge(e.request)),1)])):ue("",!0),e.request.method==="mcpServer/elicitation/request"?(x(),$("section",HS,[Ke(e.request)?(x(),$("p",VS,D(S(f)("Server"))+": "+D(Ke(e.request)),1)):ue("",!0),Be(e.request)?(x(),$("a",{key:1,class:"thread-pending-request-link",href:Be(e.request),target:"_blank",rel:"noopener noreferrer"},D(S(f)("Open authorization link")),9,WS)):ue("",!0),(x(!0),$(He,null,jt(pt(e.request),F=>(x(),$("div",{key:`${e.request.id}:${F.key}`,class:"thread-pending-request-question"},[m("p",zS,[cs(D(F.label),1),F.required?(x(),$("span",GS," *")):ue("",!0)]),F.description?(x(),$("p",KS,D(F.description),1)):ue("",!0),F.kind==="string"||F.kind==="number"?(x(),$("label",YS,[m("span",JS,D(S(f)("Value")),1),m("input",{class:"thread-pending-request-input",type:F.inputType,value:String(K(e.request.id,F)??""),onInput:J=>he(e.request.id,F,J)},null,40,QS)])):F.kind==="boolean"?(x(),$("label",XS,[m("span",ZS,D(S(f)("Choice")),1),m("select",{class:"thread-pending-request-select",value:k(K(e.request.id,F)),onChange:J=>Oe(e.request.id,F,J)},[F.hasExplicitDefault?ue("",!0):(x(),$("option",t1,D(S(f)("Select true or false")),1)),m("option",n1,D(S(f)("True")),1),m("option",r1,D(S(f)("False")),1)],40,e1)])):F.kind==="singleEnum"?(x(),$("label",o1,[m("span",s1,D(S(f)("Choice")),1),m("select",{class:"thread-pending-request-select",value:String(K(e.request.id,F)??""),onChange:J=>he(e.request.id,F,J)},[F.hasExplicitDefault?ue("",!0):(x(),$("option",i1,D(S(f)("Select an option")),1)),(x(!0),$(He,null,jt(F.options,J=>(x(),$("option",{key:`${e.request.id}:${F.key}:${J.value}`,value:J.value},D(J.label),9,l1))),128))],40,a1)])):(x(),$("div",u1,[(x(!0),$(He,null,jt(F.options,J=>(x(),$("label",{key:`${e.request.id}:${F.key}:${J.value}`,class:"thread-pending-request-checkbox-row"},[m("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:we(e.request.id,F).includes(J.value),onChange:me=>We(e.request.id,F,J.value,me)},null,40,c1),m("span",d1,D(J.label),1)]))),128))]))]))),128)),h.value?(x(),$("p",f1,D(h.value),1)):ue("",!0),m("footer",h1,[m("button",{type:"button",class:"thread-pending-request-secondary",onClick:j[3]||(j[3]=F=>ae(e.request,"cancel"))},D(S(f)("Cancel")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:j[4]||(j[4]=F=>ae(e.request,"decline"))},D(S(f)("Decline")),1),m("button",{type:"button",class:"thread-pending-request-primary",onClick:j[5]||(j[5]=F=>ae(e.request,"accept"))},D(S(f)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(x(),$("section",p1,[(x(!0),$(He,null,jt(De(e.request),F=>{var J;return x(),$("div",{key:`${e.request.id}:${F.id}`,class:"thread-pending-request-question"},[m("p",m1,D(F.header||F.question),1),F.question?(x(),$("p",g1,D(F.question),1)):ue("",!0),F.options.length>0?(x(),$("div",v1,[m("label",y1,[m("span",w1,D(S(f)("Choice")),1),m("select",{class:"thread-pending-request-select",value:qe(e.request.id,F.id,((J=F.options[0])==null?void 0:J.label)||""),onChange:me=>_e(e.request.id,F.id,me)},[(x(!0),$(He,null,jt(F.options,me=>(x(),$("option",{key:`${e.request.id}:${F.id}:${me.label}`,value:me.label},D(me.label),9,_1))),128))],40,b1)]),Ve(e.request.id,F.id,F.options)?(x(),$("p",T1,D(Ve(e.request.id,F.id,F.options)),1)):ue("",!0)])):ue("",!0),F.isOther?(x(),$("label",k1,[m("span",S1,D(S(f)("Other answer")),1),m("input",{class:"thread-pending-request-input",type:"text",value:Pe(e.request.id,F.id),placeholder:S(f)("Other answer"),onInput:me=>Ee(e.request.id,F.id,me)},null,40,C1)])):ue("",!0)])}),128)),m("footer",x1,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:j[6]||(j[6]=F=>Me(e.request))},D(S(f)("Send")),1)])])):e.request.method==="item/tool/call"?(x(),$("section",A1,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:j[7]||(j[7]=F=>be(e.request))},D(S(f)("Fail Tool Call")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:j[8]||(j[8]=F=>$e(e.request))},D(S(f)("Success (Empty)")),1)])):(x(),$("section",E1,[m("button",{type:"button",class:"thread-pending-request-primary",onClick:j[9]||(j[9]=F=>Se(e.request))},D(S(f)("Return Empty Result")),1),m("button",{type:"button",class:"thread-pending-request-secondary",onClick:j[10]||(j[10]=F=>Xe(e.request))},D(S(f)("Reject Request")),1)]))],64))],2)])):ue("",!0)}}),M1=yt(I1,[["__scopeId","data-v-72a9d2d9"]]),P1={key:0,class:"queued-messages"},R1={class:"queued-messages-inner"},$1={class:"queued-row-text"},O1={class:"queued-row-actions"},N1=["title","onClick"],D1=["title","onClick"],L1=["aria-label","title","onClick"],j1=Cn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){const{t}=_o();function n(r){var h,f,g;const s=r.text.trim();if(s)return s;const o=[],i=((h=r.imageUrls)==null?void 0:h.length)??0,l=((f=r.fileAttachments)==null?void 0:f.length)??0,c=((g=r.skills)==null?void 0:g.length)??0;return i>0&&o.push(`${i} ${t(i===1?"image":"images")}`),l>0&&o.push(`${l} ${t(l===1?"file":"files")}`),c>0&&o.push(`${c} ${t(c===1?"skill":"skills")}`),o.join(", ")||t("(empty queued message)")}return(r,s)=>e.messages.length>0?(x(),$("div",P1,[m("div",R1,[(x(!0),$(He,null,jt(e.messages,o=>(x(),$("div",{key:o.id,class:"queued-row"},[s[1]||(s[1]=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",$1,D(n(o)),1),m("div",O1,[m("button",{class:"queued-row-edit",type:"button",title:S(t)("Edit queued message"),onClick:i=>r.$emit("edit",o.id)},D(S(t)("Edit")),9,N1),m("button",{class:"queued-row-steer",type:"button",title:S(t)("Send now without interrupting work"),onClick:i=>r.$emit("steer",o.id)},D(S(t)("Steer")),9,D1),m("button",{class:"queued-row-delete",type:"button","aria-label":S(t)("Delete queued message"),title:S(t)("Delete queued message"),onClick:i=>r.$emit("delete",o.id)},[...s[0]||(s[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:"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,L1)])]))),128))])])):ue("",!0)}}),F1=yt(j1,[["__scopeId","data-v-c84f9964"]]),U1={key:0,class:"rate-limit-status","aria-live":"polite"},B1=["title"],q1={class:"rate-limit-card-header"},H1={class:"rate-limit-card-title"},V1={key:0,class:"rate-limit-card-plan"},W1={class:"rate-limit-card-metrics"},z1={key:0,class:"rate-limit-card-footer"},G1=Cn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(V){var R,W;return((R=V.limitId)==null?void 0:R.trim())||((W=V.limitName)==null?void 0:W.trim())||"__default__"}function n(V){var R,W;return((R=V.limitName)==null?void 0:R.trim())||((W=V.limitId)==null?void 0:W.trim())||"Rate limits"}function r(V){const R=V.trim();return R?R.replace(/[_-]+/g," ").replace(/\b\w/g,W=>W.toUpperCase()):""}function s(V){return!V||V<=0?"Window":V%1440===0?`${V/1440}d`:V%60===0?`${V/60}h`:V<60?`${V}m`:`${Math.round(V/60*10)/10}h`}function o(V){const R=Math.max(0,Math.min(100,100-V));return`${Math.round(R)}% left`}function i(V){return`${Math.round(V)}%`}function l(V,R){return{key:R,label:`${s(V.windowDurationMins)} ${o(V.usedPercent)}`}}function c(V){const R=[];return V.primary&&R.push(l(V.primary,"primary")),V.secondary&&R.push(l(V.secondary,"secondary")),R}function h(V){if(!V)return"";const R=new Date(V*1e3),W=R.getMonth()+1,Z=String(R.getDate()).padStart(2,"0"),fe=String(R.getHours()).padStart(2,"0"),ye=String(R.getMinutes()).padStart(2,"0");return`${W}.${Z} ${fe}:${ye}`}function f(V){if(!(V!=null&&V.resetsAt))return"";const R=V.resetsAt*1e3-Date.now();if(R<=0)return"Resetting now";const W=Math.round(R/6e4);if(W<60)return`Resets in ${W}m`;const Z=Math.round(W/60);return Z<24?`Resets in ${Z}h`:`Resets in ${Math.round(Z/24)}d`}function g(V){return[V.primary,V.secondary].filter(R=>R!==null)}function T(V){const R=g(V);return R.length===0?null:[...R].sort((W,Z)=>{const fe=W.windowDurationMins??Number.MAX_SAFE_INTEGER,ye=Z.windowDurationMins??Number.MAX_SAFE_INTEGER;return fe!==ye?fe-ye:(W.resetsAt??Number.MAX_SAFE_INTEGER)-(Z.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function A(V){const R=g(V);if(R.length===0)return"";const W=[...R].sort((fe,ye)=>{const ee=fe.windowDurationMins??-1,Ae=ye.windowDurationMins??-1;return ee!==Ae?Ae-ee:(ye.resetsAt??-1)-(fe.resetsAt??-1)})[0],Z=h(W.resetsAt);return Z||""}function B(V){const R=V.credits;return R?R.unlimited?"Unlimited credits":R.balance?`Credits ${R.balance}`:R.hasCredits?"Credits available":"":""}function q(V){return[f(T(V)),A(V),B(V)].filter(R=>R.length>0)}function Q(V){const R=[n(V)];for(const W of c(V))R.push(W.label);for(const W of g(V))R.push(`${s(W.windowDurationMins)} used ${i(W.usedPercent)}`);for(const W of q(V))R.push(W);return R.join(`
|
|
50
|
-
`)}return(V,R)=>e.snapshots.length>0?(x(),$("aside",U1,[(x(!0),$(He,null,jt(e.snapshots,W=>(x(),$("div",{key:t(W),class:"rate-limit-card",title:Q(W)},[m("div",q1,[m("span",H1,D(n(W)),1),W.planType?(x(),$("span",V1,D(r(W.planType)),1)):ue("",!0)]),m("div",W1,[(x(!0),$(He,null,jt(c(W),Z=>(x(),$("span",{key:Z.key,class:"rate-limit-card-metric"},D(Z.label),1))),128))]),q(W).length>0?(x(),$("div",z1,D(q(W).join(" | ")),1)):ue("",!0)],8,B1))),128))])):ue("",!0)}}),K1=yt(G1,[["__scopeId","data-v-df88906b"]]),Y1=["aria-label"],J1=["aria-checked","onClick"],Q1={class:"runtime-toggle-option-label"},X1=Cn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=_o(),s=[{value:"local",label:r("Local project"),icon:vc},{value:"worktree",label:r("New worktree"),icon:Mi}];function o(i){n("update:modelValue",i)}return(i,l)=>(x(),$("div",{class:"runtime-toggle",role:"radiogroup","aria-label":S(r)("Continue in")},[(x(),$(He,null,jt(s,c=>m("button",{key:c.value,class:at(["runtime-toggle-option",{"is-selected":e.modelValue===c.value}]),type:"button",role:"radio","aria-checked":e.modelValue===c.value,onClick:h=>o(c.value)},[(x(),lt(oc(c.icon),{class:"runtime-toggle-option-icon"})),m("span",Q1,D(c.label),1)],10,J1)),64))],8,Y1))}}),Z1=yt(X1,[["__scopeId","data-v-0f175c28"]]),eC={},tC={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 nC(e,t){return x(),$("svg",tC,[...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 rC=yt(eC,[["render",nC]]),oC={},sC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function aC(e,t){return x(),$("svg",sC,[...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 iC=yt(oC,[["render",aC]]),lC={class:"sidebar-thread-controls"},uC=["aria-label","title"],cC=["aria-label","title"],dC=Cn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=_o();return(n,r)=>(x(),$("div",lC,[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]=s=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(x(),lt(iC,{key:0,class:"sidebar-thread-controls-icon"})):(x(),lt(rC,{key:1,class:"sidebar-thread-controls-icon"}))],8,uC),Qr(n.$slots,"default",{},void 0),e.showNewThreadButton?(x(),$("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]=s=>n.$emit("start-new-thread"))},[Fe(Fi,{class:"sidebar-thread-controls-icon"})],8,cC)):ue("",!0)]))}}),vf=yt(dC,[["__scopeId","data-v-2369affb"]]),fC={},hC={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function pC(e,t){return x(),$("svg",hC,[...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 yf=yt(fC,[["render",pC]]),mC={},gC={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function vC(e,t){return x(),$("svg",gC,[...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 yC=yt(mC,[["render",vC]]),wC={},bC={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function _C(e,t){return x(),$("svg",bC,[...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 TC=yt(wC,[["render",_C]]),kC={},SC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function CC(e,t){return x(),$("svg",SC,[...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 xC=yt(kC,[["render",CC]]);function fr(e){return e.flatMap(t=>t.threads)}const Ep="codex-web-local.thread-read-state.v1",Ip="codex-web-local.thread-scroll-state.v1",Mp="codex-web-local.thread-token-usage.v1",Pp="codex-web-local.thread-terminal-open.v1",Fu="codex-web-local.selected-thread-id.v1",Uu="codex-web-local.selected-model-by-context.v1",Rp="codex-web-local.selected-model-id.v1",$p="codex-web-local.project-order.v1",Op="codex-web-local.project-display-name.v1",Bu="codex-web-local.collaboration-mode-by-context.v1",Np="codex-web-local.collaboration-mode.v1",Lo="__new-thread__",Dp="__new-thread-provider__::",pu=220,AC=1e4,EC=500,IC=3e3,MC=2e3,wf=["none","minimal","low","medium","high","xhigh"],xs="__global__",Mr="gpt-5.2-codex";function PC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ep);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function bf(e){typeof window>"u"||window.localStorage.setItem(Ep,JSON.stringify(e))}function qu(e){return e==="plan"?"plan":"default"}function zs(e){return typeof e=="string"?e.trim():""}function Rr(){return Object.create(null)}function ya(e){const t=Rr();for(const[n,r]of Object.entries(e))t[n]=r;return t}function bi(e,t){if(!(t in e))return e;const n=Rr();for(const[r,s]of Object.entries(e))r!==t&&(n[r]=s);return n}function _f(e,t){let n=!1;const r=Rr();for(const[s,o]of Object.entries(e)){if(s===Lo||s.startsWith(Dp)||t.has(s)){r[s]=o;continue}n=!0}return n?r:e}function Lp(e){return e.trim().toLowerCase()||"codex"}function mu(e){const t=Lp(e);return`${Dp}${t}`}function Ia(e){return e.trim()||Lo}function RC(){if(typeof window>"u")return Rr();try{const n=window.localStorage.getItem(Uu);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Rr();const s=Rr();for(const[o,i]of Object.entries(r)){if(typeof o!="string"||o.length===0)continue;const l=zs(i);l&&(s[o]=l)}return s}}catch{}const e=zs(window.localStorage.getItem(Rp)),t=Rr();return e&&(t[Lo]=e),t}function Tf(e,t){const n=Ia(t),r=zs(e[n]);return r||zs(e[Lo])}function _i(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Uu):window.localStorage.setItem(Uu,JSON.stringify(e)),window.localStorage.removeItem(Rp)}catch{}}function $C(){if(typeof window>"u")return Rr();try{const n=window.localStorage.getItem(Bu);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Rr();const s=Rr();for(const[o,i]of Object.entries(r)){if(typeof o!="string"||o.length===0)continue;const l=qu(i);l==="plan"&&(s[o]=l)}return s}}catch{}const e=qu(window.localStorage.getItem(Np)),t=Rr();return e==="plan"&&(t[Lo]="plan"),t}function Ti(e,t){const n=Ia(t);return qu(e[n])}function kf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Bu):window.localStorage.setItem(Bu,JSON.stringify(e)),window.localStorage.removeItem(Np)}catch{}}function Ui(e,t,n){return Math.min(Math.max(e,t),n)}function OC(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.scrollTop!="number"||!Number.isFinite(t.scrollTop)||typeof t.isAtBottom!="boolean")return null;const n={scrollTop:Math.max(0,t.scrollTop),isAtBottom:t.isAtBottom};return typeof t.scrollRatio=="number"&&Number.isFinite(t.scrollRatio)&&(n.scrollRatio=Ui(t.scrollRatio,0,1)),n}function NC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ip);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){if(!r)continue;const o=OC(s);o&&(n[r]=o)}return n}catch{return{}}}function Sf(e){typeof window>"u"||window.localStorage.setItem(Ip,JSON.stringify(e))}function Ps(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 Cf(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Ps(t.totalTokens)??0,inputTokens:Ps(t.inputTokens)??0,cachedInputTokens:Ps(t.cachedInputTokens)??0,outputTokens:Ps(t.outputTokens)??0,reasoningOutputTokens:Ps(t.reasoningOutputTokens)??0}}function DC(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Cf(t.total),r=Cf(t.last);if(!n||!r)return null;const s=Ps(t.modelContextWindow),o=r.totalTokens,i=typeof s=="number"?Math.max(s-o,0):null,l=typeof s=="number"&&s>0?Ui(Math.round((i??0)/s*100),0,100):null;return{total:n,last:r,modelContextWindow:s,currentContextTokens:o,remainingContextTokens:i,remainingContextPercent:l}}function LC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Mp);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){if(!r)continue;const o=DC(s);o&&(n[r]=o)}return n}catch{return{}}}function xf(e){typeof window>"u"||window.localStorage.setItem(Mp,JSON.stringify(e))}function jC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Pp);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t))r&&typeof s=="boolean"&&(n[r]=s);return n}catch{return{}}}function FC(e){typeof window>"u"||window.localStorage.setItem(Pp,JSON.stringify(e))}function UC(){return typeof window>"u"?"":window.localStorage.getItem(Fu)??""}function BC(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Fu);return}window.localStorage.setItem(Fu,e)}}function qC(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem($p);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 s=Ha(r);s.length>0&&!n.includes(s)&&n.push(s)}return n}catch{return[]}}function As(e){typeof window>"u"||window.localStorage.setItem($p,JSON.stringify(e))}function HC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Op);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){const o=typeof r=="string"?Ha(r):"";o.length>0&&typeof s=="string"&&(n[o]=s)}return n}catch{return{}}}function gu(e){typeof window>"u"||window.localStorage.setItem(Op,JSON.stringify(e))}function ki(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 No(e,n)?e:n}function vu(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??null).filter(s=>s!==null&&s.threads.length>0);for(const s of e)t.includes(s.projectName)||r.push(s);return r}function No(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s])return!1;return!0}function VC(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}function WC(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function zC(e=[],t=[]){var n,r,s,o;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i+=1)if(((n=e[i])==null?void 0:n.step)!==((r=t[i])==null?void 0:r.step)||((s=e[i])==null?void 0:s.status)!==((o=t[i])==null?void 0:o.status))return!1;return!0}function GC(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&zC(e.steps,t.steps)}function Si(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")}function Hu(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&No(e.images,t.images)&&YC(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&WC(e.commandExecution,t.commandExecution)&&GC(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function Os(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 KC(e,t,n={}){const r=new Map(e.map(f=>[f.id,f])),s=new Map(t.map(f=>[f.id,f])),o=t.map(f=>{const g=r.get(f.id);return g&&Hu(g,f)?g:f});if(n.preserveMissing!==!0)return Os(e,o)?e:o;const i=e.map(f=>{const g=s.get(f.id);return!g||Hu(f,g)?f:g}),l=new Set(e.map(f=>f.id)),c=o.filter(f=>!l.has(f.id)),h=[...i,...c];return Os(e,h)?e:h}function YC(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],s=t[n];if(r.path!==s.path||r.operation!==s.operation||r.movedToPath!==s.movedToPath||r.diff!==s.diff||r.addedLineCount!==s.addedLineCount||r.removedLineCount!==s.removedLineCount)return!1}return!0}function Vu(e){return e.replace(/\s+/gu," ").trim()}function JC(e,t){const n=new Set(t.map(o=>o.id)),r=new Set(t.filter(o=>o.role==="assistant").map(o=>Vu(o.text)).filter(o=>o.length>0));if(r.size===0)return e;const s=e.filter(o=>{if(o.messageType!=="agentMessage.live")return!0;if(n.has(o.id))return!1;const i=Vu(o.text);return i.length===0?!1:!r.has(i)});return s.length===e.length?e:s}function Ci(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Hu(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const jp="worked";function Mo(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function QC(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),s=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const i=s>0||o.length===0?s:0;return o.push(`${i}s`),o.join(" ")}function XC(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function ZC(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 ex(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${QC(e.durationMs)}`,messageType:jp,turnId:e.turnId}}function tx(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function nx(e,t){const n=ex(t),r=e.filter(i=>i.messageType!==jp),s=tx(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function vt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function rx(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[s,o]of Object.entries(e)){if(t.has(s)){n=!0;continue}r[s]=o}return n?r:e}function ox(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 sx(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 ax(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 Yt(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function xi(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>{const o=n.get(s.projectName),i=new Map((o==null?void 0:o.threads.map(c=>[c.id,c]))??[]),l=s.threads.map(c=>{const h=i.get(c.id);return h&&ox(h,c)?h:c});return o&&o.projectName===s.projectName&&sx(o.threads,l)?o:{projectName:s.projectName,threads:l}});return ax(e,r)?e:r}function ix(e,t,n){const r=new Set(fr(t).map(l=>l.id)),s=fr(e).filter(l=>n[l.id]===!0&&!r.has(l.id));if(s.length===0)return t;const o=new Map(t.map(l=>[l.projectName,l])),i=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of s){if(o.get(l.projectName)){const h=i.findIndex(f=>f.projectName===l.projectName);h>=0&&(i[h]={projectName:i[h].projectName,threads:[l,...i[h].threads]});continue}i.push({projectName:l.projectName,threads:[l]})}return i}function Po(e){return Ha(e)}function lx(e){const t=e.split(`
|
|
51
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function ux(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function cx(){const e=P([]),t=P([]),n=P(UC()),r=P({}),s=P({}),o=P({}),i=P({}),l=P({}),c=P({}),h=P({}),f=P({}),g=P({}),T=P({}),A=P([]),B=P([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),q=P($C()),Q=P(RC()),V=P(Ti(q.value,n.value)),R=P(Tf(Q.value,n.value)),W=P("medium"),Z=P("standard"),fe=P(""),ye=P(PC()),ee=P(NC()),Ae=P(qC()),ge=P(HC()),Ue=P({}),Ie=P({}),re=P({}),de=P({}),De=P({}),qe=P({}),Pe=P({}),_e=P({}),Ee=P({}),Ve=P({}),Qe=P({}),Ke=P({}),Be=P({}),pt=P(null),et=P(LC()),dt=P(jC()),tt=P({}),K=P([]),we=P([]),he=P(!1),Oe=P(!1),We=P(!1),k=P(!1),E=P(!1),H=P(!1),G=P(""),oe=P(!1),te=P(!1);function Te(a){var u;try{const p=new URL(a,"http://localhost");return p.pathname!=="/codex-local-image"?"":((u=p.searchParams.get("path"))==null?void 0:u.trim())??""}catch{return""}}function ce(a){const u=a.trim().toLowerCase();return u?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(u):!1}function pe(a){var p;const u=r.value[a]??[];for(let y=u.length-1;y>=0;y-=1){const M=u[y];if(!(M.role!=="user"||!Array.isArray(M.images)||M.images.length===0))for(let N=M.images.length-1;N>=0;N-=1){const L=((p=M.images[N])==null?void 0:p.trim())??"";if(L&&Te(L))return L}}return""}let ae=null,Me=null,be=null;const $e=new Map;let Se=null;const Xe=new Map;let O=null,j=null,F=!1;const J=new Set,me=new Map;let Ce=null,ke=null,Ze=!1,je=!1,wt=[],pn=null,Xn=!1,Ht=!1;const Zn=new Map,er=new Set,Fr=se(()=>fr(e.value)),Dn=se(()=>Fr.value.find(a=>a.id===n.value)??null),vn=se(()=>ee.value[n.value]??null),Ft=se(()=>{const a=n.value;return!!(a&&dt.value[a]===!0)}),_r=se(()=>{const a=n.value;return a?Ee.value[a]===!0:!1}),hr=se(()=>{const a=[],u=n.value;return u&&Array.isArray(Ke.value[u])&&a.push(...Ke.value[u]),Array.isArray(Ke.value[xs])&&a.push(...Ke.value[xs]),a.sort((p,y)=>p.receivedAtIso.localeCompare(y.receivedAtIso))}),un=se(()=>{var N;const a=n.value;if(!a)return null;const u=h.value[a]===!0,p=u?qe.value[a]:void 0,y=u?(i.value[a]??"").trim():"",M=(((N=Pe.value[a])==null?void 0:N.message)??"").trim();return!p&&!y&&!M?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:y,errorText:M}}),pr=se(()=>pt.value),ht=se(()=>{const a=n.value;return a?et.value[a]??null:null}),mr=se(()=>{const a=n.value;if(!a)return[];const u=r.value[a]??[],p=s.value[a]??[],y=o.value[a]??[],M=l.value[a]??[],N=c.value[a]??[],L=[...u,...p,...M,...N,...y],Y=De.value[a];return Y?nx(L,Y):L});function _t(a){if(Ia(a)===Lo){const p=mu(fe.value),y=p?zs(Q.value[p]):"";if(y)return y}return Tf(Q.value,a).trim()}function Ln(...a){const u=[...A.value];for(const p of a){const y=p.trim();y&&!u.includes(y)&&u.push(y)}No(A.value,u)||(A.value=u)}function xn(a){n.value!==a&&(n.value=a,BC(a),R.value=_t(a),Ln(R.value),V.value=Ti(q.value,a),Ht=!1)}function tr(a,u){const p=u.trim(),y=Ia(a);if(p){const M=ya(Q.value);M[y]=p,Q.value=M}else Q.value=bi(Q.value,y);if(a.trim()===n.value?(R.value=_t(n.value),Ln(R.value)):Ln(p),y===Lo){const M=mu(fe.value);if(M)if(p){const N=ya(Q.value);N[M]=p,Q.value=N}else Q.value=bi(Q.value,M)}_i(Q.value)}function $t(a){tr(n.value,a)}function Mt(a,u){const p=a.trim();if(!p)return;const y=u.trim();if(y){const M=ya(Q.value);M[p]=y,Q.value=M}else Q.value=bi(Q.value,p);Ln(y),n.value===p&&(R.value=_t(n.value)),_i(Q.value)}function Zt(a,u){const p=a.trim();if(!p)return;if(!u){if(!(p in et.value))return;et.value=vt(et.value,p),xf(et.value);return}const y=et.value[p];y&&JSON.stringify(y)===JSON.stringify(u)||(et.value={...et.value,[p]:u},xf(et.value))}function jn(a){const u=a==="plan"?"plan":"default",p=Ia(n.value);if(!(Ti(q.value,n.value)===u&&V.value===u)){if(V.value=u,u==="plan"){const M=ya(q.value);M[p]=u,q.value=M}else q.value=bi(q.value,p);kf(q.value)}}function yn(a){pt.value=a}async function Tr(a=n.value){a.trim()?Mt(a,Mr):$t(Mr),Ln(Mr)}function ir(a,u){Be.value={...Be.value,[a]:u}}function kr(a){Be.value[a]&&(Be.value=vt(Be.value,a))}async function An(a){if(er.has(a))return;const u=Be.value[a];if(!(!u||u.fallbackRetried)){er.add(a),ir(a,{...u,fallbackRetried:!0});try{await Tr(a);try{const p=await au(a,1);ft(a,p),Ut(a),tn(a,[]),Wt(a),l.value[a]&&(l.value=vt(l.value,a))}catch{}Nt(a,null),G.value="",Vt(a,null),Tt(a,{label:"Thinking",details:Fn(Mr,u.effort,u.collaborationMode)}),ct(a,!0),re.value[a]!==!0&&await su(a),await iu(a,u.text,u.imageUrls,Mr,u.effort||void 0,u.skills.length>0?u.skills:void 0,u.fileAttachments,u.collaborationMode),re.value={...re.value,[a]:!0},en(),J.add(a),await vr()}catch(p){const y=p instanceof Error?p.message:"Unknown application error";Nt(a,y),G.value=y,ct(a,!1),Tt(a,null)}finally{er.delete(a)}}}function lr(a){a&&!wf.includes(a)||(W.value=a)}async function Sr(a){const u=a==="fast"?"fast":"standard";if(E.value||Z.value===u)return;const p=Z.value;Z.value=u,E.value=!0,G.value="";try{await Nb(u)}catch(y){Z.value=p,G.value=y instanceof Error?y.message:"Failed to update Fast mode"}finally{E.value=!1}}async function Cr(){try{const a=await Bb();B.value=a,a.some(u=>u.value===V.value)||jn("default")}catch{}}function Fn(a,u,p=V.value){const y=a.trim()||"default",M=u||"default",N=p==="plan"?"Plan":"Default",L=Z.value==="fast"?"Fast":"Standard";return[`Mode: ${N}`,`Model: ${y}`,`Thinking: ${M}`,`Speed: ${L}`]}async function Gt(a){try{const[u,p]=await Promise.all([bp({includeProviderModels:(a==null?void 0:a.includeProviderModels)!==!1}),_p()]),y=_t(n.value),M=p.model.trim(),N=Lp(p.providerId);fe.value=N;const L=mu(N),Y=L?zs(Q.value[L]):"",X=[...u];if(!(a!=null&&a.providerChanged))for(const ze of[y,M])ze&&!X.includes(ze)&&X.push(ze);A.value=X;const Re=y&&u.includes(y);if((!y||!Re||a!=null&&a.providerChanged)&&(a!=null&&a.providerChanged&&X.length>0?Y&&X.includes(Y)?$t(Y):M&&X.includes(M)?$t(M):$t(X[0]):M&&X.includes(M)?$t(p.model):X.length>0?$t(X[0]):$t("")),L&&R.value.trim().length>0){const ze=ya(Q.value);ze[L]=R.value.trim(),Q.value=ze,_i(Q.value)}p.reasoningEffort&&wf.includes(p.reasoningEffort)&&(W.value=p.reasoningEffort),Z.value=p.speedMode}catch{}}async function Un(){if(j){await j;return}j=(async()=>{try{const a=await Tb();yn(a),we.value=a?[a]:[]}catch{}finally{j=null}})(),await j}function en(){if(typeof window>"u"){Un();return}be!==null&&window.clearTimeout(be),be=window.setTimeout(()=>{be=null,Un()},EC)}function Bn(a){if(!a||typeof window>"u")return;const u=$e.get(a);u!==void 0&&(window.clearTimeout(u),$e.delete(a))}function En(a){if(!a||typeof window>"u")return;Bn(a);const u=window.setTimeout(()=>{$e.delete(a),J.add(a),vr()},IC);$e.set(a,u)}function xr(a){const u=tt.value;return Object.keys(u).length===0?a:a.map(p=>({projectName:p.projectName,threads:p.threads.map(y=>{const M=u[y.id];return M?{...y,title:M}:y})}))}function gr(a){return a?Array.isArray(Ke.value[a])?Ke.value[a]:[]:[]}function eo(a){return a==="item/commandExecution/requestApproval"||a==="item/fileChange/requestApproval"||a==="item/permissions/requestApproval"||a==="execCommandApproval"||a==="applyPatchApproval"}function wn(a){return a.some(u=>eo(u.method))?"approval":a.length>0?"response":null}function Ot(){const u=xr(t.value).map(p=>({projectName:p.projectName,threads:p.threads.map(y=>{const M=h.value[y.id]===!0,N=wn(gr(y.id)),L=n.value===y.id,Y=ye.value[y.id],X=T.value[y.id]===!0,Re=!L&&!M&&(X||Y!==y.updatedAtIso);return{...y,inProgress:M,unread:Re,pendingRequestState:N}})}));e.value=xi(e.value,u)}function bn(a,u,p){const y=new Date().toISOString(),M=rn(u),N=Ha(M),L={id:a,title:lx(p),projectName:N,cwd:M,hasWorktree:M.includes("/.codex/worktrees/")||M.includes("/.git/worktrees/"),createdAtIso:y,updatedAtIso:y,preview:p,unread:!1,inProgress:!1},Y=t.value.findIndex(Re=>Re.projectName===N);if(Y>=0){const ze=t.value[Y].threads.filter(kt=>kt.id!==a),Ye={projectName:N,threads:[L,...ze]},gt=[...t.value];gt.splice(Y,1,Ye),t.value=gt}else t.value=[{projectName:N,threads:[L]},...t.value];const X=ki(Ae.value,t.value);No(Ae.value,X)||(Ae.value=X,As(Ae.value)),Ot()}function In(a){const u=new Set(a.map(Y=>Y.id)),p=_f(Q.value,u);p!==Q.value&&(Q.value=p,R.value=_t(n.value),Ln(R.value),_i(p));const y=_f(q.value,u);y!==q.value&&(q.value=y,V.value=Ti(y,n.value),kf(y));const M=Yt(ye.value,u);M!==ye.value&&(ye.value=M,bf(M));const N=Yt(ee.value,u);N!==ee.value&&(ee.value=N,Sf(N)),Ie.value=Yt(Ie.value,u),Ue.value=Yt(Ue.value,u),re.value=Yt(re.value,u),de.value=Yt(de.value,u),r.value=Yt(r.value,u),o.value=Yt(o.value,u),i.value=Yt(i.value,u),l.value=Yt(l.value,u),c.value=Yt(c.value,u),De.value=Yt(De.value,u),qe.value=Yt(qe.value,u),Pe.value=Yt(Pe.value,u),_e.value=Yt(_e.value,u),Ee.value=Yt(Ee.value,u),Ve.value=Yt(Ve.value,u),Qe.value=Yt(Qe.value,u),et.value=Yt(et.value,u),T.value=Yt(T.value,u),h.value=Yt(h.value,u);const L={};for(const[Y,X]of Object.entries(Ke.value))(Y===xs||u.has(Y))&&(L[Y]=X);Ke.value=L}function cn(a){const u=fr(t.value).find(p=>p.id===a);u&&(ye.value={...ye.value,[a]:u.updatedAtIso},bf(ye.value),T.value[a]&&(T.value=vt(T.value,a)),Ot())}function Vt(a,u){if(!a)return;const p=De.value[a];if(u){if(XC(p,u))return;De.value={...De.value,[a]:u}}else p&&(De.value=vt(De.value,a))}function ct(a,u){!a||h.value[a]===!0===u||(u?h.value={...h.value,[a]:!0}:(h.value=vt(h.value,a),Dt(a),nr(a)),Ot(),!u&&!Wo()&&Ce&&ra())}function nr(a){a&&(Ee.value[a]&&(Ee.value=vt(Ee.value,a)),Ve.value[a]&&(Ve.value=vt(Ve.value,a)),Qe.value[a]&&(Qe.value=vt(Qe.value,a)))}function rr(a){a&&(Ee.value={...Ee.value,[a]:!0},Ve.value[a]&&(Ve.value=vt(Ve.value,a)),Qe.value[a]&&(Qe.value=vt(Qe.value,a)))}function qn(a){a&&Ee.value[a]===!0&&Ve.value[a]===!0&&Qe.value[a]===!0&&nr(a)}function ur(a){const u=Object.keys(Ee.value);if(u.length===0)return;let p=Ve.value,y=!1;for(const M of u)!a.has(M)||p[M]===!0||(p={...p,[M]:!0},y=!0);if(y){Ve.value=p;for(const M of u)qn(M)}}function on(a,u){a&&Ee.value[a]===!0&&u.some(p=>p.role==="user")&&(Qe.value[a]!==!0&&(Qe.value={...Qe.value,[a]:!0}),qn(a))}function or(a){a&&a!==n.value&&T.value[a]!==!0&&(T.value={...T.value,[a]:!0},Ot())}function Tt(a,u){if(!a)return;const p=qe.value[a];if(!u){p&&(qe.value=vt(qe.value,a));return}const y=Wa(u.label)||"Thinking",M=u.details.map(Y=>Wa(Y)).filter(Y=>Y.length>0&&Y!==y),N=Array.from(new Set([...(p==null?void 0:p.details)??[],...M])).slice(-3),L={label:y,details:N};ZC(p,L)||(qe.value={...qe.value,[a]:L})}function Nt(a,u,p={}){if(!a)return;const y=Pe.value[a],M=u?Vu(u):"";if(!M){y&&(Pe.value=vt(Pe.value,a));return}const N=p.transient===!0;(y==null?void 0:y.message)===M&&y.transient===N||(Pe.value={...Pe.value,[a]:{message:M,transient:N}})}function Hn(a){var u;a&&(u=Pe.value[a])!=null&&u.transient&&Nt(a,null)}function sr(){const a=Object.entries(Pe.value).filter(([,p])=>p==null?void 0:p.transient).map(([p])=>p);if(a.length===0)return;let u=Pe.value;for(const p of a)u=vt(u,p);Pe.value=u}function Vn(a){const u=fr(t.value).find(p=>p.id===a);return(u==null?void 0:u.updatedAtIso)??""}function Wn(a,u){if(!a)return;const p={scrollTop:Math.max(0,u.scrollTop),isAtBottom:u.isAtBottom===!0};typeof u.scrollRatio=="number"&&Number.isFinite(u.scrollRatio)&&(p.scrollRatio=Ui(u.scrollRatio,0,1));const y=ee.value[a];y&&y.scrollTop===p.scrollTop&&y.isAtBottom===p.isAtBottom&&y.scrollRatio===p.scrollRatio||(ee.value={...ee.value,[a]:p},Sf(ee.value))}function Ar(a,u){if(!a)return;const p={...dt.value};u?p[a]=!0:delete p[a],dt.value=p,FC(p)}function Ur(){const a=n.value;a&&Ar(a,!Ft.value)}function ft(a,u){const p=r.value[a]??[];Os(p,u)||(r.value={...r.value,[a]:u})}function tn(a,u){const p=o.value[a]??[];Os(p,u)||(o.value={...o.value,[a]:u})}function nn(a){a&&a in o.value&&(o.value=vt(o.value,a))}function cr(a,u){const p=c.value[a]??[];Os(p,u)||(c.value={...c.value,[a]:u})}function dr(a,u){const p=s.value[a]??[];Os(p,u)||(s.value={...s.value,[a]:u})}function I(a,u){const p=s.value[a]??[],y=Ci(p,u);dr(a,y)}function U(a,u){const p=o.value[a]??[],y=Ci(p,u);tn(a,y)}function ne(a,u){const p=c.value[a]??[],y=Ci(p,u);cr(a,y)}function Ne(a,u){if(!a)return;const p=u.trim(),y=i.value[a]??"";if(p.length===0){if(!y)return;i.value=vt(i.value,a);return}y!==p&&(i.value={...i.value,[a]:p})}function mt(a,u){if(!a)return;const p=i.value[a]??"";Ne(a,`${p}${u}`)}function Wt(a){a&&a in i.value&&(i.value=vt(i.value,a))}function Ut(a){a&&a in s.value&&(s.value=vt(s.value,a))}function Bt(a){a&&a in c.value&&(c.value=vt(c.value,a))}function Dt(a){a&&(Ut(a),Wt(a),Tt(a,null),n.value,l.value[a]&&(l.value=vt(l.value,a)),_e.value[a]&&(_e.value=vt(_e.value,a)),kr(a))}function _n(a){return a==="completed"?"completed":a==="inProgress"||a==="in_progress"?"inProgress":"pending"}function Kt(a){var p;const u=[];(p=a.explanation)!=null&&p.trim()&&u.push(a.explanation.trim());for(const y of a.steps){const M=y.status==="completed"?"x":y.status==="inProgress"?"~":" ";u.push(`- [${M}] ${y.step}`)}return u.join(`
|
|
52
|
-
`).trim()}function Er(a){if(a.method!=="turn/plan/updated")return null;const u=w(a.params),p=It(a),y=b(u==null?void 0:u.turnId)||b(u==null?void 0:u.turn_id),N=(Array.isArray(u==null?void 0:u.plan)?u==null?void 0:u.plan:[]).map(X=>w(X)).map(X=>({step:b(X==null?void 0:X.step),status:_n(X==null?void 0:X.status)})).filter(X=>X.step.length>0);if(!p||!y)return null;const Y={explanation:b(u==null?void 0:u.explanation).trim()||void 0,steps:N,isStreaming:!0};return{threadId:p,message:{id:`${y}:plan`,role:"assistant",text:Kt(Y),messageType:"plan.live",plan:Y}}}function _(a){if(a.method!=="item/plan/delta")return null;const u=w(a.params),p=It(a),y=b(u==null?void 0:u.turnId)||b(u==null?void 0:u.turn_id),M=b(u==null?void 0:u.delta);if(!p||!y||!M)return null;const N=`${y}:plan`,L=(s.value[p]??[]).find(Re=>Re.id===N),Y=`${(L==null?void 0:L.text)??""}${M}`,X=L!=null&&L.plan?{...L.plan,isStreaming:!0}:void 0;return{threadId:p,message:{id:N,role:"assistant",text:Y,messageType:"plan.live",plan:X}}}function w(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)?a:null}function b(a){return typeof a=="string"?a:""}function z(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Le(a){const u=w(a);if(!u)return null;const p=z(u.totalTokens??u.total_tokens),y=z(u.inputTokens??u.input_tokens),M=z(u.cachedInputTokens??u.cached_input_tokens),N=z(u.outputTokens??u.output_tokens),L=z(u.reasoningOutputTokens??u.reasoning_output_tokens);return p===null||y===null||M===null||N===null||L===null?null:{totalTokens:p,inputTokens:y,cachedInputTokens:M,outputTokens:N,reasoningOutputTokens:L}}function rt(a){const u=w(a);if(!u)return null;const p=Le(u.total),y=Le(u.last);if(!p||!y)return null;const M=z(u.modelContextWindow??u.model_context_window),N=y.totalTokens,L=typeof M=="number"?Math.max(M-N,0):null,Y=typeof M=="number"&&M>0?Ui(Math.round((L??0)/M*100),0,100):null;return{total:p,last:y,modelContextWindow:M,currentContextTokens:N,remainingContextTokens:L,remainingContextPercent:Y}}function Pt(a){if(a.method!=="thread/tokenUsage/updated")return null;const u=w(a.params),p=It(a),y=rt((u==null?void 0:u.tokenUsage)??(u==null?void 0:u.token_usage));return!p||!y?null:{threadId:p,usage:y}}function It(a){const u=w(a.params);if(!u)return"";const p=b(u.threadId);if(p)return p;const y=b(u.thread_id);if(y)return y;const M=b(u.conversationId);if(M)return M;const N=b(u.conversation_id);if(N)return N;const L=w(u.thread),Y=b(L==null?void 0:L.id);if(Y)return Y;const X=w(u.turn),Re=b(X==null?void 0:X.threadId);if(Re)return Re;const ze=b(X==null?void 0:X.thread_id);return ze||""}function mn(a){if(a.method!=="turn/completed")return"";const u=w(a.params),p=w(u==null?void 0:u.turn);if(!p||p.status!=="failed")return"";const y=w(p.error);return b(y==null?void 0:y.message)}function zt(a){var y;if(a.method!=="error")return null;const u=w(a.params),p=b(u==null?void 0:u.message)||b((y=w(u==null?void 0:u.error))==null?void 0:y.message);return p?{message:p,transient:(u==null?void 0:u.willRetry)===!0}:null}function sn(a){const u=w(a);if(!u)return null;const p=u.id,y=b(u.method),M=u.params;if(typeof p!="number"||!Number.isInteger(p)||!y)return null;const N=w(M),L=Ir(y,N),Y=b(N==null?void 0:N.threadId)||b(N==null?void 0:N.thread_id)||b(N==null?void 0:N.conversationId)||b(N==null?void 0:N.conversation_id)||xs,X=b(N==null?void 0:N.turnId)||b(N==null?void 0:N.turn_id),Re=b(N==null?void 0:N.itemId)||b(N==null?void 0:N.item_id)||b(N==null?void 0:N.callId)||b(N==null?void 0:N.call_id),ze=b(u.receivedAtIso)||new Date().toISOString();return{id:p,method:L,threadId:Y,turnId:X,itemId:Re,receivedAtIso:ze,params:M??null}}function Ir(a,u){const p=a.trim();return p&&(p==="item/commandExecution/requestApproval"||p==="execCommandApproval"||p==="exec_approval_request"||to(u)?"item/commandExecution/requestApproval":p==="item/fileChange/requestApproval"||p==="applyPatchApproval"||p==="apply_patch_approval_request"||Ys(u)?"item/fileChange/requestApproval":p==="item/tool/requestUserInput"||p==="request_user_input"||To(u)?"item/tool/requestUserInput":p==="mcpServer/elicitation/request"||p==="elicitation_request"||qo(u)?"mcpServer/elicitation/request":p==="item/permissions/requestApproval"||Br(u)?"item/permissions/requestApproval":p==="item/tool/call"||p==="dynamic_tool_call_request"||Js(u)?"item/tool/call":p)}function to(a){if(!a)return!1;const u=a.command;return Array.isArray(u)&&u.some(p=>typeof p=="string"&&p.trim().length>0)||typeof u=="string"&&u.trim().length>0?!0:Array.isArray(a.commandActions)}function Ys(a){return a?typeof a.grantRoot=="string"&&a.grantRoot.trim().length>0||typeof a.grant_root=="string"&&a.grant_root.trim().length>0||w(a.fileChanges)?!0:w(a.changes)!==null:!1}function To(a){return!!(a&&Array.isArray(a.questions))}function Js(a){return a?typeof a.toolName=="string"||typeof a.tool_name=="string"||typeof a.name=="string"||Array.isArray(a.arguments):!1}function qo(a){if(!a)return!1;const u=b(a.mode);return typeof a.serverName=="string"&&typeof a.threadId=="string"&&typeof a.message=="string"&&(u==="form"||u==="url")}function Br(a){return a?typeof a.threadId=="string"&&typeof a.turnId=="string"&&typeof a.itemId=="string"&&w(a.permissions)!==null:!1}function Qs(a){if(a.method!=="item/tool/requestUserInput")return[];const u=w(a.params),p=Array.isArray(u==null?void 0:u.questions)?u.questions:[],y=[];for(const M of p){const N=w(M),L=b(N==null?void 0:N.id).trim();L&&y.push(L)}return y}function Ho(a){const u=a.threadId||xs,p=Ke.value[u]??[],y=p.findIndex(N=>N.id===a.id),M=[...p];y>=0?M.splice(y,1,a):M.push(a),Ke.value={...Ke.value,[u]:M.sort((N,L)=>N.receivedAtIso.localeCompare(L.receivedAtIso))},Ot()}function qr(a){const u={};for(const[p,y]of Object.entries(Ke.value)){const M=y.filter(N=>N.id!==a);M.length>0&&(u[p]=M)}Ke.value=u,Ot()}function an(a){const u={};for(const p of a){const y=p.threadId||xs,M=u[y]??[];M.push(p),u[y]=M}for(const p of Object.values(u))p.sort((y,M)=>y.receivedAtIso.localeCompare(M.receivedAtIso));Ke.value=u}function ko(a){if(a.method==="server/request"){const u=sn(a.params);return u&&Ho(u),!0}if(a.method==="server/request/resolved"){const u=w(a.params),p=u==null?void 0:u.id;return typeof p=="number"&&Number.isInteger(p)&&qr(p),!0}return!1}function Wa(a){return a.replace(/\s+/gu," ").trim()}function ol(a){const u=It(a);if(!u)return null;if(a.method==="turn/started")return{threadId:u,activity:{label:"Thinking",details:[]}};if(a.method==="item/started"){const p=w(a.params),y=w(p==null?void 0:p.item),M=b(y==null?void 0:y.type).toLowerCase();if(M==="reasoning")return{threadId:u,activity:{label:"Thinking",details:[]}};if(M==="agentmessage")return{threadId:u,activity:{label:"Writing response",details:[]}};if(M==="commandexecution"){const N=b(y==null?void 0:y.command);return{threadId:u,activity:{label:"Running command",details:N?[N]:[]}}}if(M==="filechange"){const L=(Array.isArray(y==null?void 0:y.changes)?y.changes:[])[0],Y=b(L==null?void 0:L.path);return{threadId:u,activity:{label:"Applying changes",details:Y?[Y]:[]}}}}return a.method==="item/commandExecution/outputDelta"?{threadId:u,activity:{label:"Running command",details:[]}}:a.method==="item/fileChange/outputDelta"?{threadId:u,activity:{label:"Applying changes",details:[]}}:a.method==="item/reasoning/summaryTextDelta"||a.method==="item/reasoning/summaryPartAdded"?{threadId:u,activity:{label:"Thinking",details:[]}}:a.method==="item/agentMessage/delta"?{threadId:u,activity:{label:"Writing response",details:[]}}:null}function sl(a){if(a.method!=="turn/started")return null;const u=w(a.params);if(!u)return null;const p=It(a);if(!p)return null;const y=w(u.turn),M=b(y==null?void 0:y.id)||b(u.turnId)||`${p}:unknown`;if(!M)return null;const N=Mo(b(y==null?void 0:y.startedAt))??Mo(b(u.startedAt))??Mo(a.atIso)??Date.now();return{threadId:p,turnId:M,startedAtMs:N}}function fs(a){if(a.method!=="turn/completed")return null;const u=w(a.params);if(!u)return null;const p=It(a);if(!p)return null;const y=w(u.turn),M=b(y==null?void 0:y.id)||b(u.turnId)||`${p}:unknown`;if(!M)return null;const N=Mo(b(y==null?void 0:y.completedAt))??Mo(b(u.completedAt))??Mo(a.atIso)??Date.now(),L=Mo(b(y==null?void 0:y.startedAt))??Mo(b(u.startedAt))??void 0;return{threadId:p,turnId:M,completedAtMs:N,startedAtMs:L}}function Xs(a){return`${a}:live-reasoning`}function So(a){const u=r.value[a]??[];let p=-1;for(const y of u)typeof y.turnIndex=="number"&&Number.isFinite(y.turnIndex)&&(p=Math.max(p,y.turnIndex));return p+1}function za(a,u,p){if(!a||!u||!Number.isInteger(p)||p<0)return;const y=de.value[a]??{};y[u]!==p&&(de.value={...de.value,[a]:{...y,[u]:p}})}function Ga(a,u){const p=de.value[a]??{},y=Object.entries(p),M=Object.entries(u);y.length===M.length&&y.every(([N,L])=>u[N]===L)||(de.value={...de.value,[a]:{...u}})}function Tn(a){const u=c.value[a];if(!u||u.length===0)return;const p=de.value[a]??{};let y=!1;const M=u.map(N=>{if(typeof N.turnIndex=="number"||!N.turnId)return N;const L=p[N.turnId];return typeof L!="number"?N:(y=!0,{...N,turnIndex:L})});y&&(c.value={...c.value,[a]:M})}function al(a){const u=w(a.params);if(!u)return"";if(a.method==="item/started"){const p=w(u.item);return!p||p.type!=="reasoning"?"":b(p.id)}return""}function Zs(a){const u=w(a.params);if(!u)return null;if(a.method==="item/reasoning/summaryTextDelta"){const p=b(u.itemId),y=b(u.delta);return!p||!y?null:{messageId:Xs(p),delta:y}}return null}function hs(a){const u=w(a.params);if(!u)return"";if(a.method==="item/reasoning/summaryPartAdded"){const p=b(u.itemId);return p?Xs(p):""}return""}function il(a){const u=w(a.params);if(!u)return"";if(a.method==="item/completed"){const p=w(u.item);return!p||p.type!=="reasoning"?"":Xs(b(p.id))}return""}function Ka(a){const u=w(a.params);if(!u)return"";if(a.method==="item/started"){const p=w(u.item);return!p||p.type!=="agentMessage"?"":b(p.id)}return""}function ea(a){const u=w(a.params);if(!u)return null;if(a.method==="item/agentMessage/delta"){const p=b(u.itemId),y=b(u.delta);return!p||!y?null:{messageId:p,delta:y}}return null}function ll(a){const u=w(a.params);if(!u)return null;if(a.method==="item/completed"){const p=w(u.item);if(!p||p.type!=="agentMessage")return null;const y=b(p.id),M=b(p.text);return!y||!M?null:{id:y,role:"assistant",text:M,messageType:"agentMessage.live"}}return null}function ta(a){return`/codex-local-image?path=${encodeURIComponent(a)}`}function ps(a){const u=a.trim();if(!u)return"";if(u.startsWith("data:")||u.startsWith("http://")||u.startsWith("https://")||u.startsWith("/codex-local-image?"))return u;const p=u.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(p)?`data:image/png;base64,${p}`:""}function ul(a){if(a.method!=="item/completed")return null;const u=w(a.params),p=w(u==null?void 0:u.item);if(!p)return null;const y=b(p.id);if(!y)return null;if(p.type==="imageView"){const L=b(p.path);return L?{id:y,role:"assistant",text:"",images:[ta(L)],messageType:"imageView"}:null}if(p.type!=="imageGeneration"&&p.type!=="image_generation")return null;const M=b(p.result),N=M?ps(M):"";return N?{id:y,role:"assistant",text:"",images:[N],messageType:"imageView"}:null}function Ya(a){var Re;if(a.method!=="item/started")return null;const u=w(a.params),p=w(u==null?void 0:u.item);if(!p||p.type!=="commandExecution")return null;const y=b(p.id),M=b(p.command);if(!y)return null;const N=typeof p.cwd=="string"?p.cwd:null,L=It(a),Y=b(u==null?void 0:u.turnId)||b(u==null?void 0:u.turn_id),X=L&&Y?(Re=de.value[L])==null?void 0:Re[Y]:void 0;return{id:y,role:"system",text:M,messageType:"commandExecution",commandExecution:{command:M,cwd:N,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:Y||void 0,turnIndex:typeof X=="number"?X:void 0}}function cl(a){if(a.method!=="item/commandExecution/outputDelta")return null;const u=w(a.params);if(!u)return null;const p=b(u.itemId),y=b(u.delta);return!p||!y?null:{itemId:p,delta:y}}function dl(a){var kt;if(a.method!=="item/completed")return null;const u=w(a.params),p=w(u==null?void 0:u.item);if(!p||p.type!=="commandExecution")return null;const y=b(p.id),M=b(p.command);if(!y)return null;const N=typeof p.cwd=="string"?p.cwd:null,L=b(p.status),Y=L==="failed"?"failed":L==="declined"?"declined":L==="interrupted"?"interrupted":"completed",X=typeof p.aggregatedOutput=="string"?p.aggregatedOutput:"",Re=typeof p.exitCode=="number"?p.exitCode:null,ze=It(a),Ye=b(u==null?void 0:u.turnId)||b(u==null?void 0:u.turn_id),gt=ze&&Ye?(kt=de.value[ze])==null?void 0:kt[Ye]:void 0;return{id:y,role:"system",text:M,messageType:"commandExecution",commandExecution:{command:M,cwd:N,status:Y,aggregatedOutput:X,exitCode:Re},turnId:Ye||void 0,turnIndex:typeof gt=="number"?gt:void 0}}function fl(a){var Re;if(a.method!=="item/completed")return null;const u=w(a.params),p=w(u==null?void 0:u.item);if(!p||p.type!=="fileChange")return null;const y=b(p.id);if(!y)return null;const M=b(u==null?void 0:u.threadId),N=b(u==null?void 0:u.turnId),L=M&&N?(Re=de.value[M])==null?void 0:Re[N]:void 0,Y=fp(p.changes),X=dp(p.status);return Y.length===0||X!=="completed"?null:{id:y,role:"system",text:"",messageType:"fileChange",fileChangeStatus:X,fileChanges:Y,turnId:N||void 0,turnIndex:typeof L=="number"?L:void 0}}function Vo(a,u){const p=l.value[a]??[],y=Ci(p,u);y!==p&&(l.value={...l.value,[a]:y})}function na(a,u){const p=l.value[a];if(!p||p.length===0)return;const y=new Set(u.map(N=>N.id)),M=p.filter(N=>!y.has(N.id));M.length!==p.length&&(M.length===0?l.value=vt(l.value,a):l.value={...l.value,[a]:M})}function Ja(a,u){const p=c.value[a];if(!p||p.length===0)return;const y=new Set(u.map(Y=>Y.id)),M=new Set(u.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnId=="string"&&Y.turnId.length>0).map(Y=>Y.turnId)),N=new Set(u.filter(Y=>Y.messageType==="fileChange"&&typeof Y.turnIndex=="number").map(Y=>Y.turnIndex)),L=p.filter(Y=>!y.has(Y.id)&&!(Y.turnId&&M.has(Y.turnId))&&!(typeof Y.turnIndex=="number"&&N.has(Y.turnIndex)));L.length!==p.length&&(L.length===0?c.value=vt(c.value,a):c.value={...c.value,[a]:L})}function hl(a){if(a.method==="item/agentMessage/delta")return!0;const u=w(a.params);if(!u)return!1;if(a.method==="item/completed"){const p=w(u.item);return(p==null?void 0:p.type)==="agentMessage"}return!1}function pl(a){var la,ua,ca,_s,ci;if(ko(a))return;if(a.method==="account/rateLimits/updated"&&en(),a.method==="thread/name/updated"){const Je=w(a.params),ar=b(Je==null?void 0:Je.threadId),so=b(Je==null?void 0:Je.threadName);ar&&so&&(tt.value={...tt.value,[ar]:so},Ot(),cu(ar,so))}if(a.method==="account/rateLimits/updated"){yn(gp(a.params));return}const u=Pt(a);if(u){Zt(u.threadId,u.usage);return}const p=ol(a);p&&Tt(p.threadId,p.activity);const y=It(a),M=zt(a);!M&&y&&Hn(y);const N=sl(a);N&&(Zn.set(N.turnId,N),za(N.threadId,N.turnId,So(N.threadId)),_e.value={..._e.value,[N.threadId]:N.turnId},Ut(N.threadId),Bt(N.threadId),Vt(N.threadId,null),Nt(N.threadId,null),ct(N.threadId,!0),T.value[N.threadId]&&(T.value=vt(T.value,N.threadId)));const L=fs(a),Y=mn(a),X=(L==null?void 0:L.threadId)??It(a),Re=X?_t(X):"",ze=!!X&&!!Y&&Re!==Mr&&Si(new Error(Y));if(L){Be.value[L.threadId];const Je=Zn.get(L.turnId);Je&&Zn.delete(L.turnId);const ar=z((la=w(a.params))==null?void 0:la.durationMs)??z((ca=w((ua=w(a.params))==null?void 0:ua.turn))==null?void 0:ca.durationMs)??(typeof L.startedAtMs=="number"?L.completedAtMs-L.startedAtMs:null)??(Je?L.completedAtMs-Je.startedAtMs:null),so=typeof ar=="number"?Math.max(0,ar):0;Vt(L.threadId,{turnId:L.turnId,durationMs:so}),_e.value[L.threadId]&&(_e.value=vt(_e.value,L.threadId)),ct(L.threadId,!1),Tt(L.threadId,null),or(L.threadId),ze||(kr(L.threadId),Co(L.threadId))}if(Y){const Je=(L==null?void 0:L.threadId)||It(a);Je&&Nt(Je,Y),G.value=Y,Je&&ze&&An(Je)}else L&&Nt(L.threadId,null);if(M){const Je=y,ar=Je?_t(Je):R.value.trim();Je&&Nt(Je,M.message,{transient:M.transient}),G.value=M.message,ar!==Mr&&Si(new Error(M.message))&&(Je?An(Je):Tr())}const Ye=Er(a);Ye&&(I(Ye.threadId,Ye.message),Tt(Ye.threadId,{label:"Planning",details:((_s=Ye.message.plan)==null?void 0:_s.steps.map(Je=>Je.step).slice(0,2))??[]}));const gt=_(a);if(gt&&(I(gt.threadId,gt.message),Tt(gt.threadId,{label:"Planning",details:[]})),!y||y!==n.value)return;Ka(a);const kt=ea(a);if(kt){const Je=(o.value[y]??[]).find(so=>so.id===kt.messageId),ar=`${(Je==null?void 0:Je.text)??""}${kt.delta}`;U(y,{id:kt.messageId,role:"assistant",text:ar,messageType:"agentMessage.live"})}const oo=ll(a);oo&&U(y,oo);const Ko=ul(a);Ko&&U(y,Ko),al(a);const bs=Zs(a);if(bs&&mt(y,bs.delta),hs(a)){const Je=i.value[y]??"";Je.trim().length>0&&!Je.endsWith(`
|
|
53
|
-
|
|
54
|
-
`)&&Ne(y,`${Je}
|
|
55
|
-
|
|
56
|
-
`)}il(a);const Vr=Ya(a);Vr&&(Vo(y,Vr),Tt(y,{label:"Running command",details:[((ci=Vr.commandExecution)==null?void 0:ci.command)??""]}));const Yo=cl(a);if(Yo){const Je=(l.value[y]??[]).find(ar=>ar.id===Yo.itemId);Je!=null&&Je.commandExecution&&Vo(y,{...Je,commandExecution:{...Je.commandExecution,aggregatedOutput:`${Je.commandExecution.aggregatedOutput}${Yo.delta}`}})}const Jo=dl(a);Jo&&Vo(y,Jo);const ui=fl(a);if(ui&&ne(y,ui),hl(a)&&(Ht&&n.value&&Wn(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Wt(y)),a.method==="turn/completed"){Ht=!1,Wt(y),l.value[y]&&(l.value=vt(l.value,y));const Je=It(a);Je&&(ct(Je,!1),Tt(Je,null),or(Je),ze||(kr(Je),Co(Je)))}}function Qa(a){if(a.method==="thread/tokenUsage/updated")return;const u=a.method,p=u==="turn/started"||u==="turn/completed"||u==="error",y=u.startsWith("thread/")||u==="turn/completed";if(!p&&!y)return;const M=It(a);M&&p&&J.add(M),y&&(F=!0),!(Me!==null||typeof window>"u")&&(Me=window.setTimeout(()=>{Me=null,vr()},pu))}async function Xa(a,u){if(!Xn){Xn=!0;try{if(!u)return;const p=[];for(const y of u.order){const M=Po(y);p.includes(M)||p.push(M)}if(p.length>0){const y=ki(p,a);No(Ae.value,y)||(Ae.value=y,As(Ae.value))}if(Object.keys(u.labels).length>0){const y={...ge.value};let M=!1;for(const[N,L]of Object.entries(u.labels)){const Y=Po(N);y[Y]!==L&&(y[Y]=L,M=!0)}M&&(ge.value=y,gu(y))}}catch{}}}async function ml(){if(!(Object.keys(tt.value).length>0))try{const a=await r0();Object.keys(a.titles).length>0&&(tt.value=a.titles)}catch{}}async function gl(){try{return await Ms()}catch{return null}}async function vl(a,u,p){if(tt.value[a])return;const y=u.trim();if(!y)return;const M=y.length>300?y.slice(0,300):y;try{const N=await a0(M,p);if(!N||tt.value[a])return;tt.value={...tt.value,[a]:N},Ot(),cu(a,N)}catch{}}function Za(a,u){if(!u||u.order.length===0)return a;const p=new Set(u.order.map(y=>Po(y)));return a.filter(y=>p.has(y.projectName))}function ms(a,u){const p=Za(a,u),y=ki(Ae.value,p);No(Ae.value,y)||(Ae.value=y,As(Ae.value));const M=vu(p,Ae.value);ur(new Set(fr(M).map(L=>L.id)));const N=ix(t.value,M,h.value);t.value=xi(t.value,N),h.value=Yt(h.value,new Set(fr(t.value).map(L=>L.id))),Ot()}function no(a,u){if(a.length===0)return u;if(u.length===0)return a;const p=new Map;for(const M of fr(a))p.set(M.id,M);for(const M of fr(u))p.set(M.id,M);const y=new Map;for(const M of p.values()){const N=y.get(M.projectName);N?N.push(M):y.set(M.projectName,[M])}return Array.from(y.entries()).map(([M,N])=>({projectName:M,threads:N.sort((L,Y)=>new Date(Y.updatedAtIso).getTime()-new Date(L.updatedAtIso).getTime())})).sort((M,N)=>{var X,Re;const L=new Date(((X=M.threads[0])==null?void 0:X.updatedAtIso)??0).getTime();return new Date(((Re=N.threads[0])==null?void 0:Re.updatedAtIso)??0).getTime()-L})}function Wo(){return Object.values(h.value).some(a=>a===!0)}function ra(a=pn){if(!(!Ce||Ze||Wo())){if(pn=a,typeof window>"u"){oa(a);return}ke!==null&&window.clearTimeout(ke),ke=window.setTimeout(()=>{ke=null,!(!Ce||Wo())&&oa(pn)},AC)}}async function oa(a){if(!(Ze||!Ce||Wo())){Ze=!0;try{const u=await Xd(Ce,ub());Ce=u.nextCursor,je=u.nextCursor===null,wt=no(wt,u.groups),ms(wt,a)}catch{}finally{Ze=!1,Ce&&!Wo()&&ra(a)}}}async function zo(){if(Se){await Se;return}Se=(async()=>{var a;te.value||(he.value=!0);try{const[u,p]=await Promise.all([Xd(),gl(),ml()]);pn=p;const y=u.groups;wt=te.value?no(wt,y):y,Ce=te.value&&!je?Ce:u.nextCursor,je=u.nextCursor===null,await Xa(y,p),ms(wt,p),te.value=!0,je||ra(p);const M=fr(e.value);In(M),!M.some(L=>L.id===n.value)&&!n.value&&xn(((a=M[0])==null?void 0:a.id)??"")}finally{he.value=!1}})().finally(()=>{Se=null}),await Se}async function Hr(a,u={}){if(!a)return;const p=Xe.get(a);if(p){await p;return}const y=Ie.value[a]===!0,M=u.silent!==!0&&!y;M&&(Oe.value=!0);const N=(async()=>{try{const L=Vn(a),Y=Ue.value[a]??"",X=Date.now()-(me.get(a)??0)<MC;if(y&&(X||(L.length===0||Y===L)&&h.value[a]!==!0)){cn(a);return}const Ye=re.value[a]!==!0?await su(a):null,gt=Ye??await Zd(a);Ye&&(Mt(a,Ye.model),re.value={...re.value,[a]:!0});const{messages:kt,inProgress:oo,activeTurnId:Ko,turnIndexByTurnId:bs}=gt;on(a,kt),Ga(a,bs),Tn(a);const xo=r.value[a]??[],Vr=KC(xo,kt,{preserveMissing:u.silent===!0});ft(a,Vr);const Yo=o.value[a]??[];if(oo){const Jo=JC(Yo,kt);tn(a,Jo)}else nn(a);na(a,kt),Ja(a,kt),Ie.value={...Ie.value,[a]:!0},me.set(a,Date.now()),L&&(Ue.value={...Ue.value,[a]:L}),ct(a,oo),Ko?_e.value={..._e.value,[a]:Ko}:_e.value[a]&&(_e.value=vt(_e.value,a)),oo||Dt(a),cn(a)}finally{M&&(Oe.value=!1)}})().finally(()=>{Xe.delete(a)});Xe.set(a,N),await N}async function ro(a,u={}){a&&Ie.value[a]!==!0&&await Hr(a,u)}async function sa(){if(O){await O;return}O=(async()=>{var a,u;try{const p=((u=(a=Dn.value)==null?void 0:a.cwd)==null?void 0:u.trim())??"";K.value=await i0(p?[p]:void 0)}catch{}finally{O=null}})(),await O}async function gs(a={}){await Promise.allSettled([Gt({providerChanged:a.providerChanged,includeProviderModels:a.includeProviderModels}),Un(),Cr(),sa()])}function ei(a={}){const u=()=>{gs(a)};if(typeof window>"u"){u();return}window.setTimeout(u,0)}async function yl(a={}){G.value="";const u=a.includeSelectedThreadMessages!==!1,p=a.awaitAncillaryRefreshes===!0;try{await zo(),u&&await Hr(n.value),p?await gs({providerChanged:a.providerChanged,includeProviderModels:a.providerChanged===!0||p}):ei({providerChanged:a.providerChanged,includeProviderModels:!1})}catch(y){G.value=y instanceof Error?y.message:"Unknown application error"}}async function wl(a){xn(a);try{await Hr(a),sa()}catch(u){G.value=u instanceof Error?u.message:"Unknown application error"}}async function bl(a){try{await Ab(a),await zo(),n.value===a&&await Hr(n.value)}catch(u){G.value=u instanceof Error?u.message:"Unknown application error"}}async function ti(a,u){const p=u.trim();if(!(!a||!p))try{await Eb(a,p),tt.value={...tt.value,[a]:p},Ot(),cu(a,p)}catch(y){G.value=y instanceof Error?y.message:"Unknown application error"}}async function _l(a){var L,Y;const u=a.trim();if(!u)return"";const p=fr(t.value).find(X=>X.id===u),y=((L=p==null?void 0:p.cwd)==null?void 0:L.trim())??"",M=((Y=p==null?void 0:p.title)==null?void 0:Y.trim())??"Forked chat",N=_t(u);G.value="";try{const X=await rf(u,y||void 0,N||void 0),Re=X.threadId.trim();return Re?(bn(Re,y,M),Mt(Re,X.model),re.value={...re.value,[Re]:!0},xn(Re),await zo(),await Hr(Re),Re):""}catch(X){return G.value=X instanceof Error?X.message:"Unknown application error",""}}async function Tl(a,u){var L;const p=a.trim();if(!p||!Number.isInteger(u)||u<0)return"";if(h.value[p]===!0)return G.value="Finish the current turn before forking from a response.","";if(Ie.value[p]!==!0)try{await Hr(p)}catch(Y){return G.value=Y instanceof Error?Y.message:"Unknown application error",""}const y=r.value[p]??[];let M=-1;for(const Y of y)typeof Y.turnIndex=="number"&&Number.isFinite(Y.turnIndex)&&(M=Math.max(M,Y.turnIndex));if(M>=0&&u>M)return"";const N=fr(t.value).find(Y=>Y.id===p)??null;try{G.value="";const Y=await rf(p),X=Y.threadId.trim();if(!X)return"";const Re=Y.cwd.trim()||((L=N==null?void 0:N.cwd)==null?void 0:L.trim())||"",ze=ux((N==null?void 0:N.title)||(N==null?void 0:N.preview)||"Untitled thread");bn(X,Re,ze),Mt(X,Y.model),ft(X,Y.messages),Ie.value={...Ie.value,[X]:!0},re.value={...re.value,[X]:!0},Ut(X),tn(X,[]),Wt(X),l.value[X]&&(l.value=vt(l.value,X)),Vt(X,null),Tt(X,null),Nt(X,null),ct(X,!1);const Ye=M-u;if(Ye>0){const gt=await au(X,Ye);ft(X,gt)}return await ti(X,ze),xn(X),zo().catch(()=>{}),X}catch(Y){return G.value=Y instanceof Error?Y.message:"Unknown application error",""}}async function kl(a,u,p=[],y=[],M=[]){if(!a||!u.trim()||p.length>0||y.length>0||M.length>0)return!1;const L=(Ke.value[a]??[]).filter(Re=>Re.method==="item/tool/requestUserInput");if(L.length!==1)return!1;const[Y]=L,X=Qs(Y);return X.length!==1?!1:ai({id:Y.id,result:{answers:{[X[0]]:{answers:[u.trim()]}}}})}async function ni(a,u=[],p=[],y="steer",M=[],N){if(E.value)return;const L=n.value,Y=a.trim();if(!L||!Y&&u.length===0&&M.length===0||await kl(L,Y,u,p,M))return;const X=h.value[L]===!0;if(X&&y==="queue"){const Re=f.value[L]??[],ze=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,Ye=[...Re],gt=typeof N=="number"?Math.max(0,Math.min(N,Ye.length)):Ye.length;Ye.splice(gt,0,{id:ze,text:Y,imageUrls:u,skills:p,fileAttachments:M,collaborationMode:V.value}),f.value={...f.value,[L]:Ye};return}if(X){Ht=!0,vs(L,Y,u,p,M).catch(Re=>{const ze=Re instanceof Error?Re.message:"Unknown application error";Nt(L,ze),G.value=ze});return}G.value="",Ht=!0,Vt(L,null),Tt(L,{label:"Thinking",details:Fn(_t(L),W.value,V.value)}),Nt(L,null),ct(L,!0);try{await vs(L,Y,u,p,M)}catch(Re){Ht=!1,ct(L,!1),Tt(L,null);const ze=Re instanceof Error?Re.message:"Unknown application error";throw Nt(L,ze),G.value=ze,Re}}async function ri(a,u,p=[],y=[],M=[]){if(E.value)return"";const N=a.trim(),L=u.trim(),Y=_t(Lo).trim();if(!N&&p.length===0&&M.length===0)return"";We.value=!0,G.value="";let X="";try{try{const gt=await nf(L||void 0,Y||void 0);X=gt.threadId,Mt(X,gt.model)}catch(gt){if(Y&&Y!==Mr&&Si(gt)){await Tr();const kt=await nf(L||void 0,Mr);X=kt.threadId,Mt(X,kt.model)}else throw gt}if(!X)return"";bn(X,L,N||"[Image]"),rr(X),re.value={...re.value,[X]:!0},xn(X),Ht=!0,Vt(X,null),Tt(X,{label:"Thinking",details:Fn(_t(X),W.value,V.value)}),Nt(X,null),ct(X,!0);const Re=X,ze=L||null,Ye=N;return vs(X,N,p,y,M).catch(gt=>{Ht=!1,ct(X,!1),Tt(X,null);const kt=gt instanceof Error?gt.message:"Unknown application error";Nt(X,kt),G.value=kt}).finally(()=>{We.value=!1}),vl(Re,Ye,ze),X}catch(Re){Ht=!1,X&&(ct(X,!1),Tt(X,null));const ze=Re instanceof Error?Re.message:"Unknown application error";throw X&&Nt(X,ze),G.value=ze,We.value=!1,Re}}async function vs(a,u,p=[],y=[],M=[]){const N=W.value,L=V.value,Y=u.trim(),X=[...p];if(X.length===0&&ce(Y)){const Ye=pe(a);Ye&&X.push(Ye)}const Re=y.map(Ye=>({name:Ye.name,path:Ye.path})),ze=M.map(Ye=>({...Ye}));ir(a,{text:Y,imageUrls:[...X],skills:Re,fileAttachments:ze,effort:N,collaborationMode:L,fallbackRetried:!1});try{if(re.value[a]!==!0){const kt=await su(a);Mt(a,kt.model)}const Ye=_t(a);let gt="";try{gt=await iu(a,u,X,Ye||void 0,N||void 0,y.length>0?y:void 0,M,L)}catch(kt){if(Ye&&Ye!==Mr&&Si(kt))await Tr(a),ir(a,{text:Y,imageUrls:[...X],skills:Re,fileAttachments:ze,effort:N,collaborationMode:L,fallbackRetried:!0}),gt=await iu(a,u,X,Mr,N||void 0,y.length>0?y:void 0,M,L);else throw kt}gt&&(_e.value={..._e.value,[a]:gt}),re.value={...re.value,[a]:!0},J.add(a),await vr(),En(a)}catch(Ye){throw Ye}}async function Co(a){if(g.value[a]===!0)return;const u=f.value[a];if(!u||u.length===0)return;g.value={...g.value,[a]:!0};const[p,...y]=u;f.value=y.length>0?{...f.value,[a]:y}:vt(f.value,a),We.value=!0,G.value="",Ht=!0,Vt(a,null),Tt(a,{label:"Thinking",details:Fn(_t(a),W.value,p.collaborationMode)}),Nt(a,null),ct(a,!0);try{jn(p.collaborationMode),await vs(a,p.text,p.imageUrls,p.skills,p.fileAttachments)}catch{ct(a,!1),Tt(a,null)}finally{g.value=vt(g.value,a),We.value=!1}}async function oi(){const a=n.value;if(!a||h.value[a]!==!0||Ee.value[a]===!0)return;let u=_e.value[a];if(!u){const{activeTurnId:p}=await Zd(a);u=p,u&&(_e.value={..._e.value,[a]:u})}if(!u)throw new Error("Could not determine active turn id for interrupt");k.value=!0,G.value="";try{await Ob(a,u),ct(a,!1),Tt(a,null),Nt(a,null),_e.value[a]&&(_e.value=vt(_e.value,a)),J.add(a),F=!0,await vr()}catch(p){const y=p instanceof Error?p.message:"Failed to interrupt active turn";Nt(a,y),G.value=y}finally{k.value=!1}}async function ys(a){var Y,X;const u=n.value;if(!u||H.value||!a.trim())return;const p=r.value[u]??[],y=p.find(Re=>Re.turnId===a),M=typeof(y==null?void 0:y.turnIndex)=="number"?y.turnIndex:-1;if(M<0)return;const N=p.reduce((Re,ze)=>typeof ze.turnIndex=="number"&&ze.turnIndex>Re?ze.turnIndex:Re,-1);if(N<0||M>N)return;const L=N-M+1;if(!(L<1)){H.value=!0,G.value="";try{const Re=((X=(Y=Dn.value)==null?void 0:Y.cwd)==null?void 0:X.trim())??"";Re&&await Ib(u,a,Re);const ze=await au(u,L);ft(u,ze),tn(u,[]),Wt(u),l.value[u]&&(l.value=vt(l.value,u)),Vt(u,null),Tt(u,null),Nt(u,null),F=!0,await vr()}catch(Re){G.value=Re instanceof Error?Re.message:"Failed to rollback thread"}finally{H.value=!1}}}let Go=null;async function Sl(a,u){try{const p=await Ms(),y={...p.labels};let M=!1;for(const N of p.order){if(Po(N)!==a)continue;const L=u.trim();L.length===0?y[N]!==void 0&&(delete y[N],M=!0):y[N]!==L&&(y[N]=L,M=!0)}M&&await lu({order:p.order,labels:y,active:p.active})}catch{}}function Cl(a,u){a.length===0||(ge.value[a]??"")===u||(ge.value={...ge.value,[a]:u},gu(ge.value),Go!==null&&clearTimeout(Go),Go=setTimeout(()=>{Go=null,Sl(a,u)},500))}async function xl(a){var N;if(a.length===0)return;const u=Ae.value.filter(L=>L!==a);if(No(Ae.value,u)||(Ae.value=u,As(Ae.value)),t.value=t.value.filter(L=>L.projectName!==a),ge.value[a]!==void 0){const L={...ge.value};delete L[a],ge.value=L,gu(L)}Ot();const p=fr(e.value);In(p),p.some(L=>L.id===n.value)||xn(((N=p[0])==null?void 0:N.id)??"");const M=new Set;try{const L=await Ms();for(const Y of L.order)Po(Y)===a&&M.add(Y);for(const Y of L.active)Po(Y)===a&&M.add(Y);for(const Y of Object.keys(L.labels))Po(Y)===a&&M.add(Y)}catch{}if(M.size>0)try{const L=await Ms(),Y=L.order.filter(ze=>!M.has(ze)),X=L.active.filter(ze=>!M.has(ze)),Re=X.length===0&&Y.length>0?[Y[0]]:X;await lu({order:Y,labels:rx(L.labels,M),active:Re});return}catch{}await aa()}function Al(a,u){if(a.length===0||t.value.length===0)return;const p=t.value.map(X=>X.projectName),y=p.indexOf(a);if(y===-1)return;const M=Math.max(0,Math.min(u,p.length-1)),N=VC(p,y,M);if(N===p)return;const L=ki(N,t.value);Ae.value=L,As(Ae.value);const Y=vu(t.value,Ae.value);t.value=xi(t.value,Y),Ot(),aa()}function El(a){const u=a.trim();if(!u)return;const p=[u,...Ae.value.filter(M=>M!==u)];if(No(Ae.value,p))return;Ae.value=p,As(Ae.value);const y=vu(t.value,Ae.value);t.value=xi(t.value,y),Ot(),aa()}async function aa(){var a,u;try{const p=await Ms(),y=new Map;for(const L of p.order){const Y=Po(L);y.has(Y)||y.set(Y,L)}for(const L of t.value){const Y=((u=(a=L.threads[0])==null?void 0:a.cwd)==null?void 0:u.trim())??"";Y&&y.set(L.projectName,Y)}const M=[];for(const L of Ae.value){const Y=y.get(L);Y&&!M.includes(Y)&&M.push(Y)}for(const L of p.order)M.includes(L)||M.push(L);const N=p.active.filter(L=>M.includes(L));N.length===0&&M.length>0&&N.push(M[0]),await lu({order:M,labels:p.labels,active:N})}catch{}}async function vr(){if(oe.value){typeof window<"u"&&Me===null&&(Me=window.setTimeout(()=>{Me=null,vr()},pu));return}oe.value=!0;const a=F,u=new Set(J);F=!1,J.clear();try{a&&await zo();const p=n.value;if(!p)return;const y=u.has(p),M=h.value[p]===!0,N=Vn(p),L=Ue.value[p]??"";(N.length>0&&N!==L||M&&Ie.value[p]!==!0||y&&Ie.value[p]!==!0||a&&Ie.value[p]!==!0)&&await Hr(p,{silent:!0})}catch{}finally{oe.value=!1,(F||J.size>0)&&typeof window<"u"&&Me===null&&(Me=window.setTimeout(()=>{Me=null,vr()},pu))}}async function Il(){await si(),F=!te.value,n.value&&Ie.value[n.value]!==!0&&J.add(n.value),await vr()}function ws(){typeof window>"u"||ae||(si(),ae=vb(a=>{if(a.method==="ready"){sr(),Il();return}pl(a),Qa(a)}))}async function si(){try{const u=(await _b()).map(p=>sn(p)).filter(p=>p!==null);an(u)}catch{}}async function ai(a){try{return await bb(a.id,{result:a.result,error:a.error}),qr(a.id),!0}catch(u){return G.value=u instanceof Error?u.message:"Failed to reply to server request",!1}}function Ml(){if(ae&&(ae(),ae=null),F=!1,J.clear(),Zn.clear(),Me!==null&&typeof window<"u"&&(window.clearTimeout(Me),Me=null),be!==null&&typeof window<"u"&&(window.clearTimeout(be),be=null),ke!==null&&typeof window<"u"&&(window.clearTimeout(ke),ke=null),typeof window<"u")for(const a of $e.values())window.clearTimeout(a);$e.clear(),Ht=!1,r.value={},s.value={},o.value={},i.value={},l.value={},c.value={},de.value={},qe.value={},De.value={},Pe.value={},_e.value={},Ee.value={},Ve.value={},Qe.value={},f.value={},g.value={},pt.value=null,et.value={}}const Pl=se(()=>{const a=n.value;return a?f.value[a]??[]:[]});function ii(a){const u=n.value;if(!u)return;const p=f.value[u];if(!p)return;const y=p.filter(M=>M.id!==a);f.value=y.length>0?{...f.value,[u]:y}:vt(f.value,u)}function li(a){const u=n.value;if(!u)return;const p=f.value[u];if(!p)return;const y=p.find(M=>M.id===a);y&&(ii(a),jn(y.collaborationMode),ni(y.text,y.imageUrls,y.skills,"steer",y.fileAttachments))}function ia(a){xn(a)}return{projectGroups:e,projectDisplayNameById:ge,selectedThread:Dn,selectedThreadTokenUsage:ht,selectedThreadScrollState:vn,selectedThreadTerminalOpen:Ft,isSelectedThreadInterruptPending:_r,selectedThreadServerRequests:hr,selectedLiveOverlay:un,codexQuota:pr,selectedThreadId:n,availableCollaborationModes:B,availableModelIds:A,selectedCollaborationMode:V,selectedModelId:R,selectedReasoningEffort:W,selectedSpeedMode:Z,installedSkills:K,accountRateLimitSnapshots:we,messages:mr,isLoadingThreads:he,isLoadingMessages:Oe,isSendingMessage:We,isInterruptingTurn:k,isUpdatingSpeedMode:E,isRollingBack:H,error:G,refreshAll:yl,refreshSkills:sa,selectThread:wl,loadMessages:Hr,ensureThreadMessagesLoaded:ro,setThreadScrollState:Wn,setThreadTerminalOpen:Ar,toggleSelectedThreadTerminal:Ur,archiveThreadById:bl,renameThreadById:ti,forkThreadById:_l,forkThreadFromTurn:Tl,rollbackSelectedThread:ys,sendMessageToSelectedThread:ni,sendMessageToNewThread:ri,interruptSelectedThreadTurn:oi,selectedThreadQueuedMessages:Pl,removeQueuedMessage:ii,steerQueuedMessage:li,setSelectedCollaborationMode:jn,readModelIdForThread:_t,setSelectedModelIdForThread:tr,setSelectedModelId:$t,setSelectedReasoningEffort:lr,updateSelectedSpeedMode:Sr,respondToPendingServerRequest:ai,renameProject:Cl,removeProject:xl,reorderProject:Al,pinProjectToTop:El,startPolling:ws,stopPolling:Ml,primeSelectedThread:ia}}const dx={class:"sidebar-root"},fx={class:"sidebar-scrollable"},hx=["aria-pressed","aria-label","title"],px={key:1,class:"sidebar-search-bar"},mx=["placeholder"],gx=["aria-label"],vx={class:"sidebar-settings-account-section"},yx={class:"sidebar-settings-account-header"},wx={class:"sidebar-settings-account-header-main"},bx=["aria-expanded","title"],_x={class:"sidebar-settings-account-collapse-icon"},Tx={class:"sidebar-settings-account-title"},kx={class:"sidebar-settings-account-count"},Sx=["disabled"],Cx={key:0,class:"sidebar-settings-account-error"},xx={key:1,class:"sidebar-settings-account-empty"},Ax={key:2,class:"sidebar-settings-account-list"},Ex=["title","onMouseenter","onMouseleave"],Ix={class:"sidebar-settings-account-main"},Mx={class:"sidebar-settings-account-email"},Px={class:"sidebar-settings-account-meta"},Rx={class:"sidebar-settings-account-quota"},$x={class:"sidebar-settings-account-id"},Ox={class:"sidebar-settings-account-actions"},Nx=["disabled","onClick"],Dx=["disabled","onClick"],Lx=["title"],jx={class:"sidebar-settings-label"},Fx=["title"],Ux={class:"sidebar-settings-label"},Bx={class:"sidebar-settings-value"},qx=["title"],Hx={class:"sidebar-settings-label"},Vx={class:"sidebar-settings-value"},Wx=["title"],zx={class:"sidebar-settings-label"},Gx=["value"],Kx=["value"],Yx=["title"],Jx={class:"sidebar-settings-label"},Qx={class:"sidebar-settings-value"},Xx=["title"],Zx={class:"sidebar-settings-label"},eA=["title"],tA={class:"sidebar-settings-label"},nA=["title"],rA={class:"sidebar-settings-label"},oA=["title"],sA={class:"sidebar-settings-label"},aA=["value","disabled"],iA={key:0,class:"sidebar-settings-row sidebar-settings-error"},lA={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},uA={class:"sidebar-settings-provider-info"},cA={class:"sidebar-settings-label"},dA={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},fA={class:"sidebar-settings-key-group"},hA={class:"sidebar-settings-key-masked"},pA=["disabled","title"],mA=["placeholder"],gA=["disabled"],vA={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},yA={class:"sidebar-settings-label"},wA=["aria-label"],bA=["disabled"],_A=["disabled"],TA={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},kA={class:"sidebar-settings-provider-info"},SA={class:"sidebar-settings-label"},CA={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},xA={class:"sidebar-settings-key-group"},AA=["placeholder"],EA=["disabled"],IA={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},MA={class:"sidebar-settings-label"},PA={class:"sidebar-settings-key-group"},RA=["placeholder"],$A={class:"sidebar-settings-label",style:{"margin-top":"4px"}},OA={class:"sidebar-settings-key-group"},NA=["placeholder"],DA=["disabled"],LA={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},jA={class:"sidebar-settings-label"},FA=["aria-label"],UA=["title"],BA={class:"sidebar-settings-label"},qA={class:"sidebar-settings-label"},HA={class:"sidebar-settings-value"},VA={key:4,class:"sidebar-settings-telegram-panel"},WA={class:"sidebar-settings-field"},zA={class:"sidebar-settings-field-label"},GA={class:"sidebar-settings-field"},KA={class:"sidebar-settings-field-label"},YA={class:"sidebar-settings-field-help"},JA={key:0,class:"sidebar-settings-telegram-error"},QA={class:"sidebar-settings-telegram-actions"},XA=["disabled"],ZA=["data-state","title"],eE={class:"sidebar-settings-label"},tE=["data-state"],nE={class:"sidebar-settings-context-meta"},rE={class:"sidebar-settings-rate-limits"},oE=["aria-label"],sE={class:"sidebar-settings-button-version"},aE={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},iE=["aria-pressed","title","aria-label"],lE={class:"content-header-terminal-shortcut"},uE={class:"content-body"},cE={key:1,class:"content-grid content-grid-home"},dE={class:"new-thread-empty"},fE={class:"new-thread-hero"},hE=["title"],pE={class:"new-thread-folder-actions"},mE=["aria-label","onKeydown"],gE={class:"new-thread-open-folder-header"},vE={class:"new-thread-open-folder-title"},yE={class:"new-thread-open-folder-label"},wE={class:"new-thread-open-folder-current"},bE=["title"],_E=["disabled"],TE={class:"new-thread-open-folder-actions"},kE={class:"new-thread-open-folder-toggle"},SE=["aria-pressed","disabled"],CE={key:0,class:"new-thread-open-folder-create"},xE={class:"new-thread-open-folder-create-composer"},AE=["placeholder","onKeydown"],EE=["disabled"],IE={key:0,class:"new-thread-open-folder-error"},ME=["placeholder","onKeydown"],PE={key:1,class:"new-thread-open-folder-error-actions"},RE={class:"new-thread-open-folder-error"},$E=["disabled"],OE={key:2,class:"new-thread-open-folder-status"},NE={key:3,class:"new-thread-open-folder-status"},DE={key:4,class:"new-thread-open-folder-list"},LE=["title","disabled","onClick"],jE={class:"new-thread-open-folder-item-name"},FE=["disabled","onClick"],UE={key:1,class:"new-thread-branch-select"},BE={class:"new-thread-branch-select-label"},qE={class:"new-thread-branch-select-help"},HE={class:"new-thread-runtime-help"},VE={class:"worktree-init-status-title"},WE={class:"worktree-init-status-message"},zE={key:3,class:"new-thread-trending"},GE={class:"new-thread-trending-header"},KE={class:"new-thread-trending-title"},YE={key:0,class:"new-thread-trending-empty"},JE={key:1,class:"new-thread-trending-empty"},QE={key:2,class:"new-thread-trending-list"},XE=["onClick"],ZE=["title"],eI={class:"new-thread-trending-tip-name-owner"},tI={class:"new-thread-trending-tip-name-repo"},nI={key:1,class:"new-thread-trending-tip-name-repo"},rI={class:"new-thread-trending-tip-meta"},oI={class:"new-thread-trending-tip-description"},sI={class:"composer-with-queue"},aI={key:2,class:"content-grid"},iI={class:"content-thread"},lI={class:"composer-with-queue"},Af="codex-web-local.sidebar-collapsed.v1",Ef="codex-web-local.accounts-section-collapsed.v1",If="codex-web-local.send-with-enter.v1",Mf="codex-web-local.in-progress-send-mode.v1",Pf="codex-web-local.dark-mode.v1",Rf="codex-web-local.dictation-click-to-toggle.v1",$f="codex-web-local.dictation-auto-send.v1",Of="codex-web-local.dictation-language.v1",Nf="codex-web-local.github-trending-projects.v1",Df="codex-web-local.chat-width.v1",uI=400,cI=Cn({__name:"App",setup(e){var Rc,$c;const t=vi(()=>wi(()=>import("./ThreadConversation-CsHUh1AP.js"),__vite__mapDeps([0,1]))),n=vi(()=>wi(()=>import("./ThreadTerminalPanel-BTHfTRnz.js"),__vite__mapDeps([2,3]))),r=vi(()=>wi(()=>import("./ReviewPane-BwO2MHvI.js"),__vite__mapDeps([4,5]))),s=vi(()=>wi(()=>import("./DirectoryHub-D6h4lJqw.js"),__vite__mapDeps([6,7]))),{t:o,uiLanguage:i,uiLanguageOptions:l,setUiLanguage:c}=_o(),h="2c53",f="0.1.84",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."),githubTrendingProjects:o("Show or hide GitHub trending project cards on the new thread screen."),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"}},A={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:B,projectDisplayNameById:q,selectedThread:Q,selectedThreadTokenUsage:V,selectedThreadScrollState:R,selectedThreadTerminalOpen:W,selectedThreadServerRequests:Z,selectedLiveOverlay:fe,codexQuota:ye,selectedThreadId:ee,availableCollaborationModes:Ae,availableModelIds:ge,selectedCollaborationMode:Ue,selectedReasoningEffort:Ie,selectedSpeedMode:re,installedSkills:de,accountRateLimitSnapshots:De,messages:qe,isLoadingThreads:Pe,isLoadingMessages:_e,isSendingMessage:Ee,isInterruptingTurn:Ve,isSelectedThreadInterruptPending:Qe,isUpdatingSpeedMode:Ke,refreshAll:Be,refreshSkills:pt,selectThread:et,ensureThreadMessagesLoaded:dt,setThreadScrollState:tt,setThreadTerminalOpen:K,toggleSelectedThreadTerminal:we,archiveThreadById:he,forkThreadById:Oe,renameThreadById:We,forkThreadFromTurn:k,sendMessageToSelectedThread:E,sendMessageToNewThread:H,interruptSelectedThreadTurn:G,selectedThreadQueuedMessages:oe,removeQueuedMessage:te,steerQueuedMessage:Te,setSelectedCollaborationMode:ce,readModelIdForThread:pe,setSelectedModelIdForThread:ae,setSelectedReasoningEffort:Me,updateSelectedSpeedMode:be,respondToPendingServerRequest:$e,renameProject:Se,removeProject:Xe,reorderProject:O,pinProjectToTop:j,startPolling:F,stopPolling:J,primeSelectedThread:me,rollbackSelectedThread:Ce}=cx(),ke=ww(),Ze=yw(),{isMobile:je}=hc(),wt=P(null),pn=P(null),Xn=P(null),Ht=P(!1),Zn=P(!1),er=P(!1),Fr=P(!0),Dn=P([]),vn=P(!1),Ft=P("trending-daily"),_r=P(null),hr=P(!1);let un=!1;const pr=P(!1),ht=P(""),mr=P("local"),_t=P(""),Ln=P([]),xn=P(!1),tr=P({order:[],labels:{}}),$t=P({phase:"idle",title:"",message:""}),Mt=P(wm()),Zt=P(""),jn=P(!1),yn=P(null),Tr=P(null),ir=P(null),kr=P(null),An=P(null);let lr=null,Sr=null;const Cr=P("New Project (1)"),Fn=P(""),Gt=P(!1),Un=P(_m()),en=P(!1),Bn=P([]),En=P(null),xr=P(!1),gr=P(!1),eo=P(null),wn=P([]),Ot=P(!1),bn=P(!1),In=P(""),cn=P(""),Vt=P(""),ct=P(""),nr=P(di(If,!0)),rr=P(sm()),qn=P(om()),ur=P(am()),on=P(di(Rf,!1)),or=P(di($f,!0)),Tt=P(vm()),Nt=se(()=>ym()),Hn=P(di(Nf,!1)),sr=P(!1),Vn=P(!1),Wn=P(""),Ar=P(!1),Ur=P(null),ft=P(!1),tn=P(""),nn=P("codex"),cr=P(""),dr=P(""),I=P("responses"),U=P("responses"),ne=P(""),Ne=P(!1),mt=P(""),Wt=P(""),Ut=P(""),Bt=P(!1),Dt=P(!1),_n=P(""),Kt=P(""),Er=P(!1),_=P(!1),w=P(null),b=P(""),z=P(""),Le=P([]),rt=P(""),Pt=P(!1),It=P(!1),mn=P(!1),zt=P(""),sn=P({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Ir=P(null),to=P(!1),Ys=P(!1),To=P(typeof window<"u"?((Rc=window.visualViewport)==null?void 0:Rc.height)??window.innerHeight:0),Js=P(typeof window<"u"?(($c=window.visualViewport)==null?void 0:$c.offsetTop)??0:0),qo=P(typeof window<"u"?window.innerHeight:0);let Br=null,Qs=!1,Ho=0;const qr=se(()=>{const d=ke.params.threadId;return typeof d=="string"?d:""}),an=se(()=>ke.name==="home"),ko=se(()=>ke.name==="skills"),Wa=se(()=>{var d;return ko.value?o("Directory"):an.value?o("Start new thread"):((d=Q.value)==null?void 0:d.title)??o("Choose a thread")}),ol=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",sl=se(()=>{var v,C;return(((C=(v=Q.value)==null?void 0:v.title)==null?void 0:C.trim())??"")||ol}),fs=se(()=>qe.value.filter(d=>{const v=km(d.messageType,d.role);return v==="worked"?!0:!(v==="turnActivity.live"||v==="turnError.live"||v==="agentReasoning.live")})),Xs=se(()=>fe.value),So=se(()=>an.value?"__new-thread__":ee.value),za=se(()=>pe(So.value)),Ga=se(()=>{const d=Z.value;return d.length>0?d[d.length-1]:null}),Tn=se(()=>{var d,v;return an.value?ht.value.trim():((v=(d=Q.value)==null?void 0:d.cwd)==null?void 0:v.trim())??""}),al=se(()=>Fr.value&&(an.value&&Tn.value.length>0||ke.name==="thread"&&ee.value.length>0)),Zs=se(()=>an.value?Ht.value:W.value),hs=se(()=>!je.value||To.value<=0||qo.value<=0?!1:qo.value-To.value>120),il=se(()=>hs.value||Zs.value&&er.value),Ka=se(()=>{var d,v;return((v=(d=Q.value)==null?void 0:d.cwd)==null?void 0:v.trim())??ht.value.trim()}),ea=se(()=>{var d;return!an.value&&((d=Q.value)==null?void 0:d.inProgress)===!0}),ll=se(()=>!an.value&&!ko.value&&ee.value.trim().length>0),ta=se(()=>Ee.value||Ve.value||ea.value||Z.value.length>0);function ps(d){return Number.isFinite(d)?new Intl.NumberFormat("en-US",{notation:d>=1e3?"compact":"standard",maximumFractionDigits:d>=1e5?0:1}).format(Math.max(0,Math.trunc(d))):"0"}function ul(d){if(!d)return o("Waiting for Codex thread/tokenUsage/updated events for this thread.");const v=[`${o("Current context usage")}: ${d.currentContextTokens.toLocaleString()} ${o("tokens")}`,`${o("Cumulative thread usage")}: ${d.total.totalTokens.toLocaleString()} ${o("tokens")}`];return typeof d.modelContextWindow=="number"?(v.unshift(`${o("Model context window")}: ${d.modelContextWindow.toLocaleString()} ${o("tokens")}`),v.push(`${o("Remaining context")}: ${(d.remainingContextTokens??0).toLocaleString()} ${o("tokens")}`)):v.push(o("Model context window is unavailable in the latest usage event.")),v.join(`
|
|
57
|
-
`)}const Ya=se(()=>{var v;const d=(v=V.value)==null?void 0:v.remainingContextPercent;return d===null||typeof d!="number"?"pending":d<=10?"danger":d<=25?"warning":"ok"}),cl=se(()=>{const d=V.value;return d?typeof d.remainingContextTokens=="number"?`${ps(d.remainingContextTokens)} ${o("left")}`:`${ps(d.currentContextTokens)} ${o("used")}`:o("Awaiting data")}),dl=se(()=>{const d=V.value;return d?typeof d.modelContextWindow=="number"?`${ps(d.currentContextTokens)} ${o("used")} / ${ps(d.modelContextWindow)}`:o("Window size unavailable"):o("Updates after the next token usage event")}),fl=se(()=>ul(V.value)),Vo=se(()=>{var ie,ve;const d=[],v=new Set;for(const xe of tr.value.order){const it=xe.trim();!it||v.has(it)||(v.add(it),d.push({value:it,label:tr.value.labels[it]||rs(it)}))}for(const xe of B.value){const it=((ve=(ie=xe.threads[0])==null?void 0:ie.cwd)==null?void 0:ve.trim())??"";!it||v.has(it)||(v.add(it),d.push({value:it,label:q.value[xe.projectName]??xe.projectName}))}const C=ht.value.trim();return C&&!v.has(C)&&d.unshift({value:C,label:rs(C)}),d}),na=se(()=>{const d=_t.value.trim(),v=[...Ln.value];return d&&!v.some(C=>C.value===d)&&v.unshift({value:d,label:d}),v}),Ja=se(()=>{const d=_t.value.trim();if(!d)return"";const v=na.value.find(C=>C.value===d);return(v==null?void 0:v.label)??d}),hl=se(()=>En.value??"__detached_head__"),pl=se(()=>{var ie;const d=[{value:"__review__",label:en.value?"Review (Open)":"Review"}],v=new Set,C=((ie=En.value)==null?void 0:ie.trim())??"";C?(d.push({value:C,label:C}),v.add(C)):(d.push({value:"__detached_head__",label:"Detached HEAD"}),v.add("__detached_head__"));for(const ve of Bn.value)!ve.value||v.has(ve.value)||(v.add(ve.value),d.push(ve));return d}),Qa=se(()=>b.value.trim()),Xa=se(()=>{const d=_n.value.trim();return!d||d==="."||d===".."?!1:!/[\\/]/u.test(d)}),ml=se(()=>Xa.value&&Qa.value.trim().length>0&&!rt.value),gl=se(()=>Er.value?"Creating…":"Create"),vl=se(()=>{const d=b.value.trim(),v=z.value.trim();return!!(d&&v&&d!==v)}),Za=se(()=>{const d=[];vl.value&&d.push({key:`parent:${z.value}`,name:"..",path:z.value,kind:"parent"});for(const v of Le.value)d.push({key:`directory:${v.path}`,name:v.name,path:v.path,kind:"directory"});return d}),ms=se(()=>{const d=zt.value.trim().toLowerCase();return d?Za.value.filter(v=>v.kind==="parent"||v.name.toLowerCase().includes(d)):Za.value}),no=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Wo=se(()=>[{value:"search-daily",label:o("Search daily")},{value:"search-weekly",label:o("Search weekly")},{value:"search-monthly",label:o("Search monthly")},{value:"trending-daily",label:o("Trending daily")},{value:"trending-weekly",label:o("Trending weekly")},{value:"trending-monthly",label:o("Trending monthly")}]),ra=se(()=>o(T[ur.value].label)),oa=se(()=>typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)?"⌘J":"Ctrl+J"),zo=se(()=>{const d=T[ur.value],v=Math.max(0,qo.value-To.value-Js.value);return{"--chat-column-max":d.columnMax,"--chat-card-max":d.cardMax,"--visual-viewport-height":To.value>0?`${To.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Js.value)}px`,"--virtual-keyboard-inset":`${v}px`}}),Hr=se(()=>{if(!sn.value.configured)return o("Not configured");const d=sn.value.active?o("Online"):o("Configured (offline)"),v=sn.value.allowAllUsers?o("allow all users"):`${sn.value.allowedUsers} ${o("allowed user(s)")}`,C=`${sn.value.mappedChats} ${o("chat(s)")}, ${sn.value.mappedThreads} ${o("thread(s)")}, ${v}`,ie=sn.value.lastError?`, ${o("error")}: ${sn.value.lastError}`:"";return`${d}, ${C}${ie}`});Uo(()=>{var d,v;document.addEventListener("pointerdown",Jo),window.addEventListener("keydown",gt),document.addEventListener("visibilitychange",la),window.addEventListener("pageshow",ua),window.addEventListener("focus",ca),window.addEventListener("resize",ro),(d=window.visualViewport)==null||d.addEventListener("resize",ro),(v=window.visualViewport)==null||v.addEventListener("scroll",ro),ro(),fi(),no==null||no.addEventListener("change",fi),Sm(),Qp(),Ts(),Ao(),ei(),gs(),Ll(),Yo(),Hn.value&&Ol()}),Ji(()=>{var d,v;document.removeEventListener("pointerdown",Jo),window.removeEventListener("keydown",gt),document.removeEventListener("visibilitychange",la),window.removeEventListener("pageshow",ua),window.removeEventListener("focus",ca),window.removeEventListener("resize",ro),(d=window.visualViewport)==null||d.removeEventListener("resize",ro),(v=window.visualViewport)==null||v.removeEventListener("scroll",ro),no==null||no.removeEventListener("change",fi),Br!==null&&(window.clearInterval(Br),Br=null),lr&&(clearTimeout(lr),lr=null),Vr(),J()});function ro(){var d,v;typeof window>"u"||(qo.value=Math.max(qo.value,window.innerHeight),To.value=((d=window.visualViewport)==null?void 0:d.height)??window.innerHeight,Js.value=((v=window.visualViewport)==null?void 0:v.offsetTop)??0)}ut(Zt,d=>{const v=d.trim();if(lr&&(clearTimeout(lr),lr=null),!v){An.value=null;return}lr=setTimeout(()=>{Qb(v,1e3).then(C=>{Zt.value.trim()===v&&(An.value=C.threadIds)}).catch(()=>{Zt.value.trim()===v&&(An.value=null)})},220)}),ut(hs,d=>{d||(er.value=!1)}),ut(wn,()=>{if(typeof window>"u")return;if(!wn.value.some(v=>v.quotaStatus==="loading")){Br!==null&&(window.clearInterval(Br),Br=null);return}Br===null&&(Br=window.setInterval(()=>{Qs||(Qs=!0,ws({silent:!0}).finally(()=>{Qs=!1}))},1500))},{deep:!0});function sa(){pt()}async function gs(){try{sn.value=await e0()}catch(d){const v=d instanceof Error?d.message:"Failed to load Telegram status";sn.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:v}}}async function ei(){try{const d=await Zb();mt.value=d.botToken,Wt.value=d.allowedUserIds.map(v=>String(v)).join(`
|
|
58
|
-
`),Ut.value=""}catch(d){Ut.value=d instanceof Error?d.message:"Failed to load Telegram configuration"}}function yl(d){const v=d.split(/[\n,]/).map(ve=>ve.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),C=v.includes("*"),ie=Array.from(new Set(v.filter(ve=>/^-?\d+$/.test(ve)).map(ve=>Number.parseInt(ve,10))));return C?["*",...ie]:ie}async function wl(){const d=mt.value.trim(),v=yl(Wt.value);if(!d){Ut.value=o("Telegram bot token is required.");return}if(v.length===0){Ut.value=o("At least one allowed Telegram user ID or * is required.");return}Bt.value=!0,Ut.value="";try{await Xb(d,v),Wt.value=v.map(C=>String(C)).join(`
|
|
59
|
-
`),await Promise.all([ei(),gs()]),window.alert(o("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(C){Ut.value=C instanceof Error?C.message:o("Failed to connect Telegram bot"),gs()}finally{Bt.value=!1}}function bl(){jn.value=!jn.value,jn.value?Xt(()=>{var d;return(d=yn.value)==null?void 0:d.focus()}):Zt.value=""}function ti(){var d;Zt.value="",(d=yn.value)==null||d.focus()}function _l(d){d.key==="Escape"&&(jn.value=!1,Zt.value="")}function Tl(d){d&&(ke.name==="thread"&&qr.value===d||(Ze.push({name:"thread",params:{threadId:d}}),je.value&&Ye(!0)))}async function kl(d){d&&(ee.value!==d&&(await et(d),await Ze.push({name:"thread",params:{threadId:d}})),await Xt(),em())}function ni(d){return d.length>8?d.slice(-8):d}function ri(d){const v=[d.planType||o("unknown")];return d.authMode&&v.unshift(d.authMode),v.join(" · ")}function vs(d){if(!d)return!1;const v=d.toLowerCase();return v.includes("payment required")||/\b402\b/.test(v)}function Co(d){return d.unavailableReason==="payment_required"||vs(d.quotaError)}function oi(d){return Ot.value||bn.value||In.value.length>0||d.isActive&&In.value!==d.accountId&&ta.value}function ys(d){return cn.value===d.accountId}function Go(d){return Vt.value===d.accountId||ys(d)}function Sl(d){return Co(d)?o("Unavailable"):d.isActive?o("Active"):bn.value?o("Switching…"):o("Switch")}function Cl(d){return In.value===d.accountId?o("Removing…"):ys(d)?o("Click again to remove"):o("Remove")}function xl(d){Vt.value=d}function Al(d){Vt.value===d&&(Vt.value=""),In.value!==d&&cn.value===d&&(cn.value="")}function El(d){const v=d.quotaSnapshot;if(!v)return null;const C=[v==null?void 0:v.primary,v==null?void 0:v.secondary].filter(xe=>xe!==null),ie=C.find(xe=>xe.windowMinutes===10080);if(ie)return ie;const ve=C.filter(xe=>typeof xe.windowMinutes=="number"&&xe.windowMinutes>=10080).sort((xe,it)=>(xe.windowMinutes??0)-(it.windowMinutes??0))[0]??null;return ve||(v.secondary??null)}function aa(d){if(typeof d!="number"||!Number.isFinite(d))return"";const v=new Date(d*1e3);return`${v.getMonth()+1}月${v.getDate()}日`}function vr(d){var xe,it;if(Co(d))return d.quotaError||o("402 Payment Required");const v=d.quotaSnapshot,C=El(d),ie=(v==null?void 0:v.primary)??(v==null?void 0:v.secondary)??null,ve=C??ie;if(ve){const Mn=Math.max(0,Math.min(100,100-Math.round(ve.usedPercent))),Wr=aa(ve.resetsAt);return Wr?`${Mn}% ${o("weekly remaining")} · ${Wr}`:`${Mn}% ${o("weekly remaining")}`}return(xe=v==null?void 0:v.credits)!=null&&xe.unlimited?o("Unlimited credits"):(it=v==null?void 0:v.credits)!=null&&it.hasCredits&&v.credits.balance?`${v.credits.balance} ${o("credits")}`:d.quotaStatus==="loading"?o("Loading quota…"):d.quotaStatus==="error"?d.quotaError||o("Quota unavailable"):d.quotaStatus==="ready"||d.quotaStatus==="idle"?o("Quota unavailable"):o("Fetching account details…")}function Il(d){return[d.email||o("Account"),ri(d),Co(d)?o("Unavailable account"):null,vr(d),`${o("Workspace")} ${d.accountId}`].filter(Boolean).join(`
|
|
60
|
-
`)}async function ws(d={}){try{const v=await kb();wn.value=v.accounts,v.accounts.some(C=>C.accountId===Vt.value)||(Vt.value=""),v.accounts.some(C=>C.accountId===cn.value)||(cn.value="")}catch(v){if(d.silent===!0)return;ct.value=v instanceof Error?v.message:o("Failed to load accounts")}}async function si(){if(!(Ot.value||bn.value)){ct.value="",Vt.value="",cn.value="",Ot.value=!0;try{const d=await Sb();wn.value=d.accounts,J(),F(),Be({includeSelectedThreadMessages:!0})}catch(d){ct.value=d instanceof Error?d.message:o("Failed to refresh accounts")}finally{Ot.value=!1}}}async function ai(d){if(!(bn.value||Ot.value)){if(ta.value){ct.value=o("Finish the current turn and pending requests before switching accounts.");return}ct.value="",Vt.value="",cn.value="",bn.value=!0;try{const v=await Cb(d);wn.value=wn.value.map(C=>C.accountId===d?v:{...C,isActive:!1}),J(),F(),Be({includeSelectedThreadMessages:!0}),ws({silent:!0})}catch(v){ct.value=v instanceof Error?v.message:o("Failed to switch account")}finally{bn.value=!1}}}async function Ml(d){if(Ot.value||bn.value||In.value.length>0)return;const v=wn.value.find(ie=>ie.accountId===d)??null;if(!v)return;if(cn.value!==d){cn.value=d;return}if(v.isActive&&ta.value){ct.value=o("Finish the current turn and pending requests before removing the active account.");return}const C=v.isActive;ct.value="",cn.value="",In.value=d;try{const ie=await xb(d);wn.value=ie.accounts,J(),F(),C&&Be({includeSelectedThreadMessages:!0}),ws({silent:!0})}catch(ie){ct.value=ie instanceof Error?ie.message:o("Failed to remove account")}finally{In.value=""}}function Pl(d){he(d)}async function ii(d){const v=await Oe(d);v&&(an.value?await Ze.replace({name:"thread",params:{threadId:v}}):await Ze.push({name:"thread",params:{threadId:v}}),je.value&&Ye(!0))}function li(d){const v=d.trim().replace(/\\/gu,"/");return v?v.includes("/.codex/worktrees/")||v.includes("/.git/worktrees/"):!1}function ia(d,v=""){var xe,it,Mn;const C=B.value.find(Wr=>Wr.projectName===d);if(!C)return v.trim();const ie=C.threads.find(Wr=>!li(Wr.cwd));return(((xe=ie==null?void 0:ie.cwd)==null?void 0:xe.trim())??((Mn=(it=C.threads[0])==null?void 0:it.cwd)==null?void 0:Mn.trim())??"")||v.trim()}function a(d){var ie,ve;const v=B.value.find(xe=>xe.projectName===d),C=ia(d,((ve=(ie=v==null?void 0:v.threads[0])==null?void 0:ie.cwd)==null?void 0:ve.trim())??"");C&&(ht.value=C),je.value&&Ye(!0),!an.value&&Ze.push({name:"home"})}function u(d){var C;let v="";for(const ie of B.value){const ve=ie.threads.find(xe=>xe.id===d);if((C=ve==null?void 0:ve.cwd)!=null&&C.trim()){v=ve.cwd.trim();break}}!v||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(v)}`,"_blank","noopener,noreferrer")}function p(){var C;const d=Q.value,v=d?ia(d.projectName,((C=d.cwd)==null?void 0:C.trim())??""):"";v&&(ht.value=v),je.value&&Ye(!0),!an.value&&Ze.push({name:"home"})}function y(d){Se(d.projectName,d.displayName)}function M(d){We(d.threadId,d.title)}async function N(d){await Xe(d),await Ts(),Ao()}function L(d){O(d.projectName,d.toIndex)}function Y(d){tt(d.threadId,d.state)}function X(d){Re(d)}async function Re(d){var ie;const v=await $e(d),C=((ie=d.followUpMessageText)==null?void 0:ie.trim())??"";if(!(!v||!C||an.value))try{await E(C,[],[],"steer",[])}catch{}}async function ze(d){const v=await k(d.threadId,d.turnIndex);v&&(await Ze.push({name:"thread",params:{threadId:v}}),ee.value!==v&&await et(v),je.value&&Ye(!0))}function Ye(d){Mt.value!==d&&(Mt.value=d,bm(d))}function gt(d){if(d.defaultPrevented)return;if(d.key==="Escape"&&Gt.value){Gt.value=!1;return}if(!d.ctrlKey&&!d.metaKey||d.shiftKey||d.altKey)return;const v=d.key.toLowerCase();if(v==="b"){d.preventDefault(),Ye(!Mt.value);return}if(v==="j"&&ke.name==="thread"&&ee.value){d.preventDefault(),kt();return}v==="j"&&an.value&&Tn.value&&(d.preventDefault(),kt())}function kt(){if(Fr.value){if(an.value){if(!Tn.value)return;Ht.value=!Ht.value,Ht.value||xo();return}we(),W.value||xo()}}function oo(d){if(Zn.value=d,!d){er.value=!1,Vr();return}er.value=!0,Vr(),Sr=setTimeout(()=>{Sr=null,hs.value||(er.value=!1)},1500)}function Ko(){Ht.value=!1,xo()}function bs(){ee.value&&K(ee.value,!1),xo()}function xo(){Zn.value=!1,er.value=!1,Vr()}function Vr(){Sr&&(clearTimeout(Sr),Sr=null)}async function Yo(){try{const d=await wb();Fr.value=d.available,d.available||(Ht.value=!1,ee.value&&K(ee.value,!1))}catch{Fr.value=!1,Ht.value=!1}}function Jo(d){var C,ie;const v=d.target;if(v instanceof Node){if(Zn.value){const ve=v instanceof Element?v:v.parentElement;ve!=null&&ve.closest(".thread-terminal-panel")||xo()}Gt.value&&((C=ir.value)!=null&&C.contains(v)||(ie=kr.value)!=null&&ie.contains(v)||(Gt.value=!1))}}function ui(d){var C,ie;if(!Gt.value)return;const v=d.target;v instanceof Node&&((C=ir.value)!=null&&C.contains(v)||(ie=kr.value)!=null&&ie.contains(v)||(Gt.value=!1))}function la(){if(!(typeof document>"u")&&je.value){if(document.visibilityState==="hidden"){Ir.value=Date.now(),to.value=!1;return}_s()}}function ua(d){d.persisted&&_s()}function ca(){ke.name==="home"&&(Ts(),Ao()),_s()}function _s(){typeof window>"u"||typeof document>"u"||!je.value||document.visibilityState!=="visible"||to.value||Ir.value===null||Date.now()-Ir.value<uI||(to.value=!0,Ir.value=null,ci())}async function ci(){if(!Ys.value){Ys.value=!0;try{await Be({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Fl()}finally{Ys.value=!1}}}function Je(d){const v=d.text;Rl();const C=_r.value,ie=d.mode==="queue"&&C&&C.threadId===ee.value?C.queueIndex:void 0;if(_r.value=null,an.value){Cm(v,d.imageUrls,d.skills,d.fileAttachments);return}E(v,d.imageUrls,d.skills,d.mode,d.fileAttachments,ie)}function ar(d){const v=new Intl.NumberFormat().format(d.stars);return d.language?`${d.language} · ★ ${v}`:`★ ${v}`}function so(d){const C=new Set(["search-daily","search-weekly","search-monthly","trending-daily","trending-weekly","trending-monthly"]).has(d)?d:"trending-daily";Ft.value!==C&&(Ft.value=C)}function Fp(d){const v=wt.value;v&&v.hydrateDraft({text:`Clone this GitHub project and run it: ${d.url}
|
|
61
|
-
Then explain what this project does in very simple words a 5th grader can understand.`,imageUrls:[],fileAttachments:[],skills:[]})}function Up(d){const v=oe.value.findIndex(xe=>xe.id===d),C=v>=0?oe.value[v]:void 0,ie=pn.value;if(!C||!ie||ie.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;_r.value=ee.value?{threadId:ee.value,queueIndex:v}:null;const ve={text:C.text,imageUrls:[...C.imageUrls],fileAttachments:C.fileAttachments.map(xe=>({...xe})),skills:C.skills.map(xe=>({...xe}))};ie.hydrateDraft(ve),te(d)}function Rl(){if(!je.value||an.value)return;const d=()=>{var v;(v=Xn.value)==null||v.jumpToLatest()};d(),Xt(()=>{d(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{d(),window.requestAnimationFrame(d)})})}function Bp(d){ht.value=d.trim(),Kt.value=""}function qp(d){_t.value=d.trim()}async function yc(d){const v=d.trim();if(!v||ke.name!=="thread"){Bn.value=[],En.value=null;return}xr.value=!0;try{const C=await Wb(v);Bn.value=C.options,En.value=C.currentBranch}catch{Bn.value=[],En.value=null}finally{xr.value=!1}}function Hp(d){if(d==="__review__"){en.value=!en.value;return}if(d==="__detached_head__"||gr.value)return;const v=d.trim();if(!v||v===(En.value??""))return;const C=Tn.value.trim();C&&(gr.value=!0,zb(C,v).then(ie=>(En.value=ie||v,en.value=!1,yc(C))).catch(ie=>{const ve=ie instanceof Error?ie.message:"Failed to switch branch";window.alert(ve)}).finally(()=>{gr.value=!1}))}async function Vp(){const d=await $l();if(!d)return;await Ao();const v=Cr.value.trim()||"New Project (1)",C=window.prompt(`Create project in ${d}`,v);if(C===null)return;const ie=C.trim();if(!ie)return;const ve=kc(Tc(d,ie));if(ve)try{const xe=await uu(ve,{createIfMissing:!0,label:""});if(!xe)return;ht.value=xe,j(rs(xe)),await Ts(),await Ao()}catch(xe){const it=xe instanceof Error?xe.message:"Failed to create the project.";window.alert(it)}}async function Wp(){const d=ht.value.trim()||await $l();d&&(Dt.value=!1,_.value=!0,zt.value="",await ks(d),rt.value||Xt(()=>{var v;return(v=w.value)==null?void 0:v.focus()}))}function da(){Ho+=1,_.value=!1,Pt.value=!1,rt.value="",zt.value="",fa()}async function zp(d){!d||Pt.value||(zt.value="",await ks(d))}function Gp(){const d=b.value.trim();!_.value||!d||ks(d)}function Kp(){const d=b.value.trim();!_.value||!d||Pt.value||ks(d)}async function wc(d=b.value){const v=d.trim();if(v){rt.value="",It.value=!0;try{const C=await uu(v,{createIfMissing:!1,label:""});if(!C){rt.value="Failed to open the selected folder.";return}ht.value=C,j(rs(C)),await Ts(),await Ao(),da()}catch(C){rt.value=C instanceof Error?C.message:"Failed to open the selected folder."}finally{It.value=!1}}}async function Yp(){if(Kt.value="",Dt.value){fa();return}if(!_.value){const d=ht.value.trim()||await $l();if(!d||(_.value=!0,zt.value="",await ks(d),rt.value))return}rt.value||(_n.value=Cr.value,Dt.value=!0,Xt(()=>{var d;return(d=eo.value)==null?void 0:d.focus()}))}function fa(){Kt.value="",_n.value="",Dt.value=!1}async function bc(){const d=_n.value.trim();if(!d)return;if(Kt.value="",rt.value){Kt.value="Reload the current folder before creating a new one.";return}Er.value=!0;const v=Qa.value.trim(),C=kc(Tc(v,d));if(!C){Kt.value="Unable to determine where the new folder should be created.",Er.value=!1;return}if(!Xa.value){Kt.value="Enter a single folder name.",Er.value=!1;return}try{const ie=await Kb(C);if(!ie){Kt.value="Failed to create the folder.";return}Kt.value="",zt.value="",await ks(ie),fa()}catch(ie){Kt.value=ie instanceof Error?ie.message:"Failed to create folder."}finally{Er.value=!1}}async function Jp(){var v;if(typeof window>"u")return!1;const d=((v=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:v.trim())??"";if(!d)return!1;try{const C=await uu(d,{createIfMissing:!1,label:""});if(!C)return!1;ht.value=C,j(rs(C)),await Ze.replace({name:"home"}),await Ts();const ie=new URL(window.location.href);return ie.searchParams.delete("openProjectPath"),window.history.replaceState({},"",ie.toString()),!0}catch{return!1}}async function $l(){const d=_c();if(d)return d;try{const v=await lf();if(v)return Fn.value=v,v}catch{}return""}async function Ao(){const d=_c();if(!d){Cr.value="New Project (1)";return}try{const v=await Yb(d);Cr.value=v.name||"New Project (1)"}catch{Cr.value="New Project (1)"}}function _c(){var C,ie;const d=ht.value.trim();if(d)return nu(d);const v=((ie=(C=Vo.value[0])==null?void 0:C.value)==null?void 0:ie.trim())??"";return v?nu(v):Fn.value.trim()}async function Qp(){try{Fn.value=await lf()}catch{Fn.value=""}}async function Ts(){try{const d=await Ms();tr.value={order:[...d.order],labels:{...d.labels}}}catch{tr.value={order:[],labels:{}}}}async function ks(d){const v=++Ho;b.value=rn(d).trim(),rt.value="",Pt.value=!0;try{const C=await Gb(d,{showHidden:mn.value});if(v!==Ho)return;b.value=C.path,z.value=C.parentPath,Le.value=C.entries}catch(C){if(v!==Ho)return;rt.value=C instanceof Error?C.message:"Failed to load local folders.",z.value=nu(b.value),Le.value=[],fa()}finally{v===Ho&&(Pt.value=!1)}}async function Ol(){vn.value=!0;try{Dn.value=await n0(Ft.value,6)}catch{Dn.value=[]}finally{vn.value=!1}}function Tc(d,v){const C=rn(d).trim(),ie=rn(v).trim().replace(/^[\\/]+/u,"");if(!C||!ie)return"";const ve=C.includes("\\")&&!C.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(C))return`${C.slice(0,2)}${ve}${ie}`;if(/^\/+$/u.test(C))return`/${ie}`;const xe=C.replace(/[\\/]+$/u,"");return xe?`${xe}${ve}${ie}`:""}function kc(d){const v=rn(d).trim();if(!v)return"";const C=v.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(C){const[,ve,xe,it=""]=C,Mn=Nl(it.split(/[\\/]+/u));return Mn.length>0?`\\\\${ve}\\${xe}\\${Mn.join("\\")}`:`\\\\${ve}\\${xe}`}const ie=v.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(ie){const[,ve,xe=""]=ie,it=v.includes("\\")&&!v.includes("/")?"\\":"/",Mn=Nl(xe.split(/[\\/]+/u));return Mn.length>0?`${ve}${it}${Mn.join(it)}`:`${ve}${it}`}if(v.startsWith("/")){const ve=Nl(v.split("/"));return ve.length>0?`/${ve.join("/")}`:"/"}return v}function Nl(d){const v=[];for(const C of d){const ie=C.trim();if(!(!ie||ie===".")){if(ie===".."){v.length>0&&v.pop();continue}v.push(ie)}}return v}function Sc(d){ae(So.value,d)}function Cc(d){Me(d)}function xc(d){be(d)}function Xp(){G()}function Zp(d){const v=d.turnId.trim();if(v.length>0){const C=[...fs.value].reverse().find(ie=>{var ve;return ie.role==="user"&&(((ve=ie.turnId)==null?void 0:ve.trim())??"")===v&&ie.text.trim().length>0});C!=null&&C.text&&pn.value&&pn.value.appendTextToDraft(C.text)}Ce(d.turnId)}function em(){if(an.value||ko.value||typeof document>"u"||!Q.value||fs.value.length===0)return;const d=tm(),v=nm(),C=new Blob([d],{type:"text/markdown;charset=utf-8"}),ie=URL.createObjectURL(C),ve=document.createElement("a");ve.href=ie,ve.download=v,document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),window.setTimeout(()=>URL.revokeObjectURL(ie),0)}function tm(){var C,ie,ve;const d=[],v=((ie=(C=Q.value)==null?void 0:C.title)==null?void 0:ie.trim())||"Untitled thread";d.push(`# ${rm(v)}`),d.push(""),d.push(`- Exported: ${new Date().toISOString()}`),d.push(`- Thread ID: ${((ve=Q.value)==null?void 0:ve.id)??""}`),d.push(""),d.push("---"),d.push("");for(const xe of fs.value){const it=xe.role?xe.role.toUpperCase():"MESSAGE";d.push(`## ${it}`),d.push("");const Mn=xe.text.trim();if(Mn&&(d.push(Mn),d.push("")),xe.commandExecution&&(d.push("```text"),d.push(`command: ${xe.commandExecution.command}`),d.push(`status: ${xe.commandExecution.status}`),xe.commandExecution.cwd&&d.push(`cwd: ${xe.commandExecution.cwd}`),xe.commandExecution.exitCode!==null&&d.push(`exitCode: ${xe.commandExecution.exitCode}`),d.push(xe.commandExecution.aggregatedOutput||"(no output)"),d.push("```"),d.push("")),xe.fileAttachments&&xe.fileAttachments.length>0){d.push("Attachments:");for(const Wr of xe.fileAttachments)d.push(`- ${Wr.path}`);d.push("")}if(xe.images&&xe.images.length>0){d.push("Images:");for(const Wr of xe.images)d.push(`- ${Wr}`);d.push("")}}return`${d.join(`
|
|
62
|
-
`).trimEnd()}
|
|
63
|
-
`}function nm(){var ve,xe;const C=(((xe=(ve=Q.value)==null?void 0:ve.title)==null?void 0:xe.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",ie=new Date().toISOString().replace(/[:.]/g,"-");return`${C}-${ie}.md`}function rm(d){return d.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function di(d,v){if(typeof window>"u")return v;const C=window.localStorage.getItem(d);return C===null?v:C==="1"}function om(){if(typeof window>"u")return"system";const d=window.localStorage.getItem(Pf);return d==="light"||d==="dark"?d:"system"}function sm(){return typeof window>"u"?"steer":window.localStorage.getItem(Mf)==="queue"?"queue":"steer"}function am(){if(typeof window>"u")return"standard";const d=window.localStorage.getItem(Df);return d==="standard"||d==="wide"||d==="extra-wide"?d:"standard"}function im(){nr.value=!nr.value,window.localStorage.setItem(If,nr.value?"1":"0")}function lm(){rr.value=rr.value==="steer"?"queue":"steer",window.localStorage.setItem(Mf,rr.value)}function um(){const d=["system","light","dark"],v=d.indexOf(qn.value);qn.value=d[(v+1)%d.length],window.localStorage.setItem(Pf,qn.value),fi()}function cm(){const d=["standard","wide","extra-wide"],v=d.indexOf(ur.value);ur.value=d[(v+1)%d.length],window.localStorage.setItem(Df,ur.value)}function dm(){on.value=!on.value,window.localStorage.setItem(Rf,on.value?"1":"0")}function fm(){or.value=!or.value,window.localStorage.setItem($f,or.value?"1":"0")}function hm(){Hn.value=!Hn.value,window.localStorage.setItem(Nf,Hn.value?"1":"0")}async function pm(d){if(!Vn.value){Vn.value=!0;try{if(d==="codex"){nn.value="codex";const v=await sf(!1);sr.value=v.enabled}else if(d==="openrouter"){nn.value="openrouter";const v=await sf(!0);sr.value=v.enabled,await Cs("","",{wireApi:U.value,provider:"openrouter"})}else d==="opencode-zen"?(nn.value="opencode-zen",await Cs("",ne.value.trim(),{wireApi:"chat",provider:"opencode-zen"}),sr.value=!0):d==="custom"&&(nn.value="custom",cr.value.trim()&&dr.value.trim()&&(await Cs(cr.value.trim(),dr.value.trim(),{wireApi:I.value}),sr.value=!0));tn.value="",await Be({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0}),ke.name==="thread"&&Ze.push({name:"home"})}catch(v){tn.value=v instanceof Error?v.message:"Failed to switch provider"}finally{Vn.value=!1}}}async function Dl(){if(ft.value)return;const d=cr.value.trim();if(d){ft.value=!0;try{tn.value="",await Cs(d,dr.value.trim(),{wireApi:I.value}),sr.value=!0,await Be({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(v){tn.value=v instanceof Error?v.message:"Failed to save custom endpoint"}finally{ft.value=!1}}}async function Ac(d){if(ft.value||Vn.value||U.value===d)return;const v=U.value;U.value=d,ft.value=!0;try{tn.value="",await Cs("","",{wireApi:d,provider:"openrouter"}),sr.value=!0,await Be({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(C){U.value=v,tn.value=C instanceof Error?C.message:"Failed to save OpenRouter API format"}finally{ft.value=!1}}async function Ec(){if(ft.value)return;const d=ne.value.trim();if(d){ft.value=!0;try{tn.value="",await Cs("",d,{wireApi:"chat",provider:"opencode-zen"}),sr.value=!0,await Be({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(v){tn.value=v instanceof Error?v.message:"Failed to save OpenCode Zen config"}finally{ft.value=!1}}}async function Ic(){if(!ft.value){ft.value=!0;try{const d=Wn.value.trim();await af(d),Wn.value="",await Ll(),await Be({includeSelectedThreadMessages:!1})}catch{}finally{ft.value=!1}}}async function mm(){if(!ft.value){ft.value=!0;try{await af(""),Wn.value="",await Ll(),await Be({includeSelectedThreadMessages:!1})}catch{}finally{ft.value=!1}}}async function Ll(){try{const d=await Db();sr.value=d.enabled,Ar.value=d.customKey??!1,Ur.value=d.maskedKey??null,d.enabled?d.provider==="opencode-zen"?nn.value="opencode-zen":d.provider==="custom"?(nn.value="custom",cr.value=d.customBaseUrl??"",I.value=d.wireApi==="chat"?"chat":"responses"):(nn.value="openrouter",U.value=d.wireApi==="chat"?"chat":"responses"):nn.value="codex"}catch{}}function gm(d){const C=jl(d.trim())||"auto";Tt.value=C,window.localStorage.setItem(Of,C)}function vm(){var C;if(typeof window>"u")return"auto";const d=((C=window.localStorage.getItem(Of))==null?void 0:C.trim())||"auto";return jl(d)||"auto"}function ym(){const d=[{value:"auto",label:o("Auto-detect")}],v=new Set(["auto"]);function C(ve){const xe=A[ve]||ve;return`${xe.charAt(0).toUpperCase()+xe.slice(1)} (${ve})`}for(const ve of typeof navigator<"u"?navigator.languages??[]:[]){const xe=jl(ve);!xe||v.has(xe)||(v.add(xe),d.push({value:xe,label:`Preferred: ${C(xe)}`}))}for(const ve of Object.keys(A))v.has(ve)||(v.add(ve),d.push({value:ve,label:C(ve)}));const ie=Tt.value.trim();return ie&&!v.has(ie)&&d.push({value:ie,label:C(ie)}),d}function jl(d){const v=d.trim().toLowerCase();if(!v||v==="auto")return"";if(v in A)return v;const C=v.split("-")[0]??v;return C in A?C:""}function fi(){const d=document.documentElement;if(qn.value==="dark")d.classList.add("dark");else if(qn.value==="light")d.classList.remove("dark");else{const v=window.matchMedia("(prefers-color-scheme: dark)").matches;d.classList.toggle("dark",v)}}function wm(){return typeof window>"u"?!1:window.localStorage.getItem(Af)==="1"}function bm(d){typeof window>"u"||window.localStorage.setItem(Af,d?"1":"0")}function _m(){if(typeof window>"u")return!0;const d=window.localStorage.getItem(Ef);return d===null?!0:d==="1"}function Tm(){Un.value=!Un.value,!(typeof window>"u")&&window.localStorage.setItem(Ef,Un.value?"1":"0")}function km(d,v){const C=(d??"").trim();return C.length>0?C:v.trim()||"message"}function Mc(d){ce(d)}async function Sm(){await Ze.isReady(),ke.name==="thread"&&qr.value&&me(qr.value),await Be({includeSelectedThreadMessages:ke.name==="thread"}),ws({silent:!0}),await Jp(),pr.value=!0,await Fl(),F()}async function Fl(){if(hr.value){un=!0;return}hr.value=!0;try{do{if(un=!1,ke.name==="home"||ke.name==="skills"){ee.value!==""&&await et("");continue}if(ke.name==="thread"){const d=qr.value;if(!d)continue;ee.value!==d?await et(d):dt(d,{silent:!0})}}while(un)}finally{hr.value=!1}}ut(()=>[ke.name,qr.value,Pe.value,ee.value],async()=>{pr.value&&await Fl()}),ut(()=>ee.value,async d=>{if(pr.value&&!hr.value&&!(an.value||ko.value)){if(!d){ke.name!=="home"&&await Ze.replace({name:"home"});return}ke.name==="thread"&&qr.value===d||await Ze.replace({name:"thread",params:{threadId:d}})}}),ut(()=>Ft.value,()=>{Hn.value&&Ol()}),ut(()=>Hn.value,d=>{if(!d){Dn.value=[];return}Ol()}),ut(()=>Vo.value,d=>{if(d.length===0){ht.value="";return}d.some(C=>C.value===ht.value)||(ht.value=d[0].value),Ao()},{immediate:!0}),ut(()=>ht.value,()=>{$t.value={phase:"idle",title:"",message:""},Ao()}),ut(()=>[mr.value,ht.value],([d,v])=>{d==="worktree"&&Pc(v)},{immediate:!0}),ut(()=>mr.value,d=>{var v;if(d==="local"){$t.value={phase:"idle",title:"",message:""};const C=ht.value.trim();if(C&&li(C)){const ie=((v=Q.value)==null?void 0:v.projectName)??rs(C),ve=ia(ie,"");ve&&(ht.value=ve)}return}Pc(ht.value)}),ut(()=>ke.name,d=>{d!=="home"&&($t.value={phase:"idle",title:"",message:""}),d!=="thread"&&(en.value=!1)}),ut(()=>ee.value,()=>{$t.value={phase:"idle",title:"",message:""}}),ut(()=>[ke.name,Tn.value],([d,v])=>{if(d!=="thread"){Bn.value=[],En.value=null;return}yc(v)},{immediate:!0}),ut(sl,d=>{typeof document>"u"||(document.title=d)},{immediate:!0}),ut(je,d=>{d&&!Mt.value&&Ye(!0)},{immediate:!0});async function Cm(d,v=[],C=[],ie=[]){try{$t.value={phase:"idle",title:"",message:""};let ve=ht.value;if(mr.value==="worktree"){$t.value={phase:"running",title:o("Creating worktree"),message:o("Creating a worktree and running setup.")};try{const it=await Hb(ht.value,_t.value);ve=it.cwd,ht.value=it.cwd,$t.value={phase:"idle",title:"",message:""}}catch{$t.value={phase:"error",title:o("Worktree setup failed"),message:o("Unable to create worktree. Try again or switch to Local project.")};return}}const xe=await H(d,ve,v,C,ie);if(!xe)return;await Ze.replace({name:"thread",params:{threadId:xe}}),Rl()}catch{}}function xm(d){const v=d.displayName.trim()||d.name.trim(),C=d.kind==="skill"?"skill":d.kind==="plugin"?"plugin":"app";return`Test ${v} ${C}. Give me a list of what it can do and one useful example.`}async function Am(d){const v=xm(d),C=d.kind==="skill"&&d.skillPath?[{name:d.name,path:d.skillPath}]:[];try{const ie=Ka.value.trim()||Tn.value.trim(),ve=await H(v,ie,[],C,[]);if(!ve)return;await Ze.replace({name:"thread",params:{threadId:ve}}),Rl()}catch{}}async function Pc(d){var C;const v=d.trim();if(!v){Ln.value=[],_t.value="";return}xn.value=!0;try{const ie=await Vb(v);Ln.value=ie;const ve=_t.value.trim();if(!(ve.length>0&&ie.some(it=>it.value===ve))){const it=ie.find(Mn=>Mn.value.trim()==="main");_t.value=(it==null?void 0:it.value)??((C=ie[0])==null?void 0:C.value)??""}}catch{Ln.value=[],_t.value=""}finally{xn.value=!1}}return(d,v)=>(x(),lt(Cw,{"is-sidebar-collapsed":Mt.value,onCloseSidebar:v[25]||(v[25]=C=>Ye(!0))},{sidebar:St(()=>[m("section",dx,[m("div",fx,[Mt.value?ue("",!0):(x(),lt(vf,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Mt.value,"show-new-thread-button":!0,onToggleSidebar:v[0]||(v[0]=C=>Ye(!Mt.value)),onStartNewThread:p},{default:St(()=>[m("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":jn.value,"aria-label":S(o)("Search threads"),title:S(o)("Search threads"),onClick:bl},[Fe(yf,{class:"sidebar-search-toggle-icon"})],8,hx)]),_:1},8,["is-sidebar-collapsed"])),!Mt.value&&jn.value?(x(),$("div",px,[Fe(yf,{class:"sidebar-search-bar-icon"}),ln(m("input",{ref_key:"sidebarSearchInputRef",ref:yn,"onUpdate:modelValue":v[1]||(v[1]=C=>Zt.value=C),class:"sidebar-search-input",type:"text",placeholder:S(o)("Filter threads..."),onKeydown:_l},null,40,mx),[[gn,Zt.value]]),Zt.value.length>0?(x(),$("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":S(o)("Clear search"),onClick:ti},[Fe(xC,{class:"sidebar-search-clear-icon"})],8,gx)):ue("",!0)])):ue("",!0),Mt.value?ue("",!0):(x(),$("button",{key:2,class:at(["sidebar-skills-link",{"is-active":ko.value}]),type:"button",onClick:v[2]||(v[2]=C=>{S(Ze).push({name:"skills"}),S(je)&&Ye(!0)})},D(S(o)("Directory")),3)),Mt.value?ue("",!0):(x(),lt(AT,{key:3,groups:S(B),"project-display-name-by-id":S(q),"selected-thread-id":S(ee),"is-loading":S(Pe),"search-query":Zt.value,"search-matched-thread-ids":An.value,onSelect:Tl,onArchive:Pl,onStartNewThread:a,onRenameProject:y,onBrowseThreadFiles:u,onRenameThread:M,onForkThread:ii,onRemoveProject:N,onReorderProject:L,onExportThread:kl},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),Mt.value?ue("",!0):(x(),$("div",{key:0,ref_key:"settingsAreaRef",ref:Tr,class:"sidebar-settings-area",onClick:ui},[Fe(Yh,{name:"settings-panel"},{default:St(()=>[Gt.value?(x(),$("div",{key:0,ref_key:"settingsPanelRef",ref:ir,class:"sidebar-settings-panel",onClick:v[16]||(v[16]=ot(()=>{},["stop"]))},[m("div",vx,[m("div",yx,[m("div",wx,[m("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!Un.value,title:Un.value?S(o)("Expand accounts"):S(o)("Collapse accounts"),onClick:Tm},[m("span",_x,D(Un.value?"▸":"▾"),1)],8,bx),m("span",Tx,D(S(o)("Accounts")),1),m("span",kx,D(wn.value.length),1)]),m("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:Ot.value||bn.value,onClick:si},D(Ot.value?S(o)("Reloading…"):S(o)("Reload")),9,Sx)]),Un.value?ue("",!0):(x(),$(He,{key:0},[ct.value?(x(),$("p",Cx,D(ct.value),1)):ue("",!0),wn.value.length===0?(x(),$("p",xx,D(S(o)("Run `codex login`, then click reload.")),1)):(x(),$("div",Ax,[(x(!0),$(He,null,jt(wn.value,C=>(x(),$("article",{key:C.accountId,class:at(["sidebar-settings-account-item",{"is-active":C.isActive,"is-unavailable":Co(C),"is-confirming-remove":ys(C),"is-remove-visible":Go(C)}]),title:Il(C),onMouseenter:ie=>xl(C.accountId),onMouseleave:ie=>Al(C.accountId)},[m("div",Ix,[m("p",Mx,D(C.email||S(o)("Account")),1),m("p",Px,D(ri(C)),1),m("p",Rx,D(vr(C)),1),m("p",$x," Workspace "+D(ni(C.accountId)),1)]),m("div",Ox,[m("button",{class:"sidebar-settings-account-switch",type:"button",disabled:oi(C)||C.isActive||Co(C),onClick:ie=>ai(C.accountId)},D(Sl(C)),9,Nx),m("button",{class:at(["sidebar-settings-account-remove",{"is-visible":Go(C),"is-confirming":ys(C)}]),type:"button",disabled:oi(C),onClick:ie=>Ml(C.accountId)},D(Cl(C)),11,Dx)])],42,Ex))),128))]))],64))]),m("button",{class:"sidebar-settings-row",type:"button",title:g.sendWithEnter,onClick:im},[m("span",jx,D(S(o)("Require ⌘ + enter to send")),1),m("span",{class:at(["sidebar-settings-toggle",{"is-on":!nr.value}])},null,2)],8,Lx),m("button",{class:"sidebar-settings-row",type:"button",title:g.inProgressSendMode,onClick:lm},[m("span",Ux,D(S(o)("When busy, send as")),1),m("span",Bx,D(rr.value==="steer"?S(o)("Steer"):S(o)("Queue")),1)],8,Fx),m("button",{class:"sidebar-settings-row",type:"button",title:g.appearance,onClick:um},[m("span",Hx,D(S(o)("Appearance")),1),m("span",Vx,D(qn.value==="system"?S(o)("System"):qn.value==="dark"?S(o)("Dark"):S(o)("Light")),1)],8,qx),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(o)("Choose the interface language for the app.")},[m("span",zx,D(S(o)("UI language")),1),m("select",{class:"sidebar-settings-provider-select",value:S(i),onChange:v[3]||(v[3]=C=>S(c)(C.target.value))},[(x(!0),$(He,null,jt(S(l),C=>(x(),$("option",{key:C.value,value:C.value},D(C.label),9,Kx))),128))],40,Gx)],8,Wx),m("button",{class:"sidebar-settings-row",type:"button",title:g.chatWidth,onClick:cm},[m("span",Jx,D(S(o)("Chat width")),1),m("span",Qx,D(ra.value),1)],8,Yx),m("button",{class:"sidebar-settings-row",type:"button",title:g.dictationClickToToggle,onClick:dm},[m("span",Zx,D(S(o)("Click to toggle dictation")),1),m("span",{class:at(["sidebar-settings-toggle",{"is-on":on.value}])},null,2)],8,Xx),m("button",{class:"sidebar-settings-row",type:"button",title:g.dictationAutoSend,onClick:fm},[m("span",tA,D(S(o)("Auto send dictation")),1),m("span",{class:at(["sidebar-settings-toggle",{"is-on":or.value}])},null,2)],8,eA),m("button",{class:"sidebar-settings-row",type:"button",title:g.githubTrendingProjects,onClick:hm},[m("span",rA,D(S(o)("GitHub trending projects")),1),m("span",{class:at(["sidebar-settings-toggle",{"is-on":Hn.value}])},null,2)],8,nA),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(o)("Choose the API provider for the Codex backend")},[m("span",sA,D(S(o)("Provider")),1),m("select",{class:"sidebar-settings-provider-select",value:nn.value,disabled:Vn.value,onChange:v[4]||(v[4]=C=>pm(C.target.value))},[...v[26]||(v[26]=[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,aA)],8,oA),tn.value?(x(),$("div",iA,D(tn.value),1)):ue("",!0),nn.value==="openrouter"?(x(),$("div",lA,[m("div",uA,[m("span",cA,D(S(o)("OpenRouter API key")),1),m("a",dA,D(S(o)("Get API key")),1)]),m("div",fA,[Ar.value&&!Wn.value?(x(),$(He,{key:0},[m("span",hA,D(Ur.value),1),m("button",{class:"sidebar-settings-key-clear",type:"button",disabled:ft.value,title:S(o)("Remove custom key, use community keys"),onClick:mm},"✕",8,pA)],64)):(x(),$(He,{key:1},[ln(m("input",{"onUpdate:modelValue":v[5]||(v[5]=C=>Wn.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:Qt(Ic,["enter"])},null,40,mA),[[gn,Wn.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:ft.value||!Wn.value.trim(),onClick:Ic},D(ft.value?"...":S(o)("Set")),9,gA)],64))]),m("div",vA,[m("span",yA,D(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:at(["sidebar-settings-segmented-option",{"is-active":U.value==="responses"}]),disabled:ft.value||Vn.value,onClick:v[6]||(v[6]=C=>Ac("responses"))}," Responses ",10,bA),m("button",{type:"button",class:at(["sidebar-settings-segmented-option",{"is-active":U.value==="chat"}]),disabled:ft.value||Vn.value,onClick:v[7]||(v[7]=C=>Ac("chat"))}," Completions ",10,_A)],8,wA)])])):ue("",!0),nn.value==="opencode-zen"?(x(),$("div",TA,[m("div",kA,[m("span",SA,D(S(o)("OpenCode Zen API key")),1),m("a",CA,D(S(o)("Get API key")),1)]),m("div",xA,[ln(m("input",{"onUpdate:modelValue":v[8]||(v[8]=C=>ne.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("sk-..."),onKeydown:Qt(Ec,["enter"])},null,40,AA),[[gn,ne.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:ft.value||!ne.value.trim(),onClick:Ec},D(ft.value?"...":S(o)("Save")),9,EA)])])):ue("",!0),nn.value==="custom"?(x(),$("div",IA,[m("span",MA,D(S(o)("Custom endpoint URL")),1),m("div",PA,[ln(m("input",{"onUpdate:modelValue":v[9]||(v[9]=C=>cr.value=C),class:"sidebar-settings-key-input",type:"url",placeholder:S(o)("https://api.example.com/v1"),onKeydown:Qt(Dl,["enter"])},null,40,RA),[[gn,cr.value]])]),m("span",$A,D(S(o)("API key")),1),m("div",OA,[ln(m("input",{"onUpdate:modelValue":v[10]||(v[10]=C=>dr.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(o)("Bearer token (optional)"),onKeydown:Qt(Dl,["enter"])},null,40,NA),[[gn,dr.value]]),m("button",{class:"sidebar-settings-key-save",type:"button",disabled:ft.value||!cr.value.trim(),onClick:Dl},D(ft.value?"...":S(o)("Save")),9,DA)]),m("div",LA,[m("span",jA,D(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:at(["sidebar-settings-segmented-option",{"is-active":I.value==="responses"}]),onClick:v[11]||(v[11]=C=>I.value="responses")}," Responses ",2),m("button",{type:"button",class:at(["sidebar-settings-segmented-option",{"is-active":I.value==="chat"}]),onClick:v[12]||(v[12]=C=>I.value="chat")}," Completions ",2)],8,FA)])])):ue("",!0),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:g.dictationLanguage},[m("span",BA,D(S(o)("Dictation language")),1),Fe(as,{class:"sidebar-settings-language-dropdown","model-value":Tt.value,options:Nt.value,placeholder:S(o)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":S(o)("Search language..."),"onUpdate:modelValue":gm},null,8,["model-value","options","placeholder","search-placeholder"])],8,UA),m("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:v[13]||(v[13]=C=>Ne.value=!Ne.value)},[m("span",qA,D(S(o)("Telegram")),1),m("span",HA,D(Hr.value),1)]),Ne.value?(x(),$("div",VA,[m("label",WA,[m("span",zA,D(S(o)("Bot token")),1),ln(m("input",{"onUpdate:modelValue":v[14]||(v[14]=C=>mt.value=C),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[gn,mt.value]])]),m("label",GA,[m("span",KA,D(S(o)("Allowed Telegram user IDs")),1),ln(m("textarea",{"onUpdate:modelValue":v[15]||(v[15]=C=>Wt.value=C),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
|
|
64
|
-
987654321`,spellcheck:"false"},null,512),[[gn,Wt.value]])]),m("div",YA,D(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),Ut.value?(x(),$("div",JA,D(Ut.value),1)):ue("",!0),m("div",QA,[m("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:Bt.value,onClick:wl},D(Bt.value?S(o)("Saving…"):S(o)("Save Telegram config")),9,XA)])])):ue("",!0),ll.value?(x(),$("div",{key:5,class:"sidebar-settings-row sidebar-settings-context-row","data-state":Ya.value,title:fl.value},[m("span",eE,D(S(o)("Context")),1),m("span",{class:"sidebar-settings-context-value","data-state":Ya.value},[cs(D(cl.value)+" ",1),m("span",nE,D(dl.value),1)],8,tE)],8,ZA)):ue("",!0),m("div",rE,[Fe(K1,{snapshots:S(De)},null,8,["snapshots"])]),m("div",{class:"sidebar-settings-build-label","aria-label":S(o)("Worktree name and version")}," WT "+D(S(h))+" · v"+D(S(f)),9,oE)],512)):ue("",!0)]),_:1}),m("button",{ref_key:"settingsButtonRef",ref:kr,class:"sidebar-settings-button",type:"button",onClick:v[17]||(v[17]=ot(C=>Gt.value=!Gt.value,["stop"]))},[Fe(yC,{class:"sidebar-settings-icon"}),m("span",null,D(S(o)("Settings")),1),m("span",sE,D(S(h))+" · v"+D(S(f)),1)],512)],512))])]),content:St(()=>[m("section",{class:at(["content-root",{"is-virtual-keyboard-open":il.value,"is-terminal-open":Zs.value}]),style:po(zo.value)},[hs.value?(x(),$("span",aE)):ue("",!0),Fe($T,{title:Wa.value},{leading:St(()=>[Mt.value||S(je)?(x(),lt(vf,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Mt.value,"show-new-thread-button":!0,onToggleSidebar:v[18]||(v[18]=C=>Ye(!Mt.value)),onStartNewThread:p},null,8,["is-sidebar-collapsed"])):ue("",!0)]),actions:St(()=>[al.value?(x(),$("button",{key:0,class:"content-header-terminal-toggle",type:"button","aria-pressed":Zs.value,title:`${S(o)("Toggle terminal")} (${oa.value})`,"aria-label":S(o)("Toggle terminal"),onClick:kt},[Fe(TC,{class:"content-header-terminal-toggle-icon"}),m("span",lE,D(oa.value),1)],8,iE)):ue("",!0),S(ke).name==="thread"&&S(ee)?(x(),lt(as,{key:1,class:at(["content-header-branch-dropdown",{"is-review-open":en.value}]),"model-value":hl.value,options:pl.value,disabled:xr.value||gr.value,"enable-search":!0,"search-placeholder":S(o)("Search branches..."),"onUpdate:modelValue":Hp},null,8,["class","model-value","options","disabled","search-placeholder"])):ue("",!0)]),_:1},8,["title"]),m("section",uE,[ko.value?(x(),lt(S(s),{key:0,cwd:Ka.value,"thread-id":qr.value,onSkillsChanged:sa,onTryItem:Am},null,8,["cwd","thread-id"])):an.value?(x(),$("div",cE,[m("div",dE,[m("p",fE,D(S(o)("Let's build")),1),Fe(as,{class:"new-thread-folder-dropdown","model-value":ht.value,options:Vo.value,placeholder:S(o)("Choose folder"),"enable-search":!0,"search-placeholder":S(o)("Quick search project"),disabled:!1,"onUpdate:modelValue":Bp},null,8,["model-value","options","placeholder","search-placeholder"]),ht.value?(x(),$("p",{key:0,class:"new-thread-folder-selected",title:ht.value},D(S(o)("Selected folder"))+": "+D(ht.value),9,hE)):ue("",!0),m("div",pE,[m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Wp},D(S(o)("Select folder")),1),m("button",{class:"new-thread-folder-action",type:"button",onClick:Vp},D(S(o)("Create Project")),1)]),(x(),lt(Rs,{to:"body"},[_.value?(x(),$("div",{key:0,class:"new-thread-open-folder-overlay",onClick:ot(da,["self"])},[m("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":S(o)("Select folder"),onKeydown:Qt(ot(da,["prevent"]),["esc"])},[m("div",gE,[m("p",vE,D(S(o)("Select folder")),1),m("button",{class:"new-thread-open-folder-close",type:"button",onClick:da},D(S(o)("Cancel")),1)]),m("p",yE,D(S(o)("Current folder")),1),m("div",wE,[m("p",{class:"new-thread-open-folder-path",title:b.value||S(o)("Unavailable")},D(b.value||S(o)("Unavailable")),9,bE),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!b.value||!!rt.value||Pt.value||It.value,onClick:v[19]||(v[19]=C=>wc())},D(It.value?S(o)("Opening…"):S(o)("Open")),9,_E)]),m("div",TE,[m("label",kE,[ln(m("input",{"onUpdate:modelValue":v[20]||(v[20]=C=>mn.value=C),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Gp},null,544),[[Zv,mn.value]]),m("span",null,D(S(o)("Show hidden folders")),1)]),m("button",{class:at(["new-thread-folder-action",{"new-thread-folder-action-primary":Dt.value}]),type:"button","aria-pressed":Dt.value,disabled:!b.value||Pt.value||It.value||Er.value||!!rt.value&&!Dt.value,onClick:Yp},D(S(o)("New folder")),11,SE)]),Dt.value?(x(),$("div",CE,[m("div",xE,[ln(m("input",{ref_key:"createFolderInputRef",ref:eo,"onUpdate:modelValue":v[21]||(v[21]=C=>_n.value=C),class:"new-thread-open-folder-create-input",type:"text",placeholder:S(o)("Folder name"),onKeydown:[Qt(ot(bc,["prevent"]),["enter"]),Qt(ot(fa,["prevent"]),["esc"])]},null,40,AE),[[gn,_n.value]]),m("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!ml.value||Er.value,onClick:bc},D(gl.value),9,EE)]),Kt.value?(x(),$("p",IE,D(Kt.value),1)):ue("",!0)])):ue("",!0),ln(m("input",{ref_key:"existingFolderFilterInputRef",ref:w,"onUpdate:modelValue":v[22]||(v[22]=C=>zt.value=C),class:"new-thread-open-folder-filter",type:"text",placeholder:S(o)("Filter folders..."),onKeydown:Qt(ot(da,["prevent"]),["esc"])},null,40,ME),[[gn,zt.value]]),rt.value?(x(),$("div",PE,[m("p",RE,D(rt.value),1),m("button",{class:"new-thread-folder-action",type:"button",disabled:Pt.value||It.value,onClick:Kp},D(S(o)("Retry")),9,$E)])):ue("",!0),Pt.value?(x(),$("p",OE,D(S(o)("Loading folders…")),1)):!rt.value&&ms.value.length===0?(x(),$("p",NE,D(zt.value.trim()?S(o)("No folders match this filter."):S(o)("No subfolders found here.")),1)):ms.value.length>0?(x(),$("ul",DE,[(x(!0),$(He,null,jt(ms.value,C=>(x(),$("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:Pt.value||It.value,onClick:ie=>zp(C.path)},[m("span",jE,D(C.name),1)],8,LE),C.kind==="directory"?(x(),$("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Pt.value||It.value,onClick:ie=>wc(C.path)},D(S(o)("Open")),9,FE)):ue("",!0)]))),128))])):ue("",!0)],40,mE)])):ue("",!0)])),Fe(Z1,{class:"new-thread-runtime-dropdown",modelValue:mr.value,"onUpdate:modelValue":v[23]||(v[23]=C=>mr.value=C)},null,8,["modelValue"]),mr.value==="worktree"?(x(),$("div",UE,[m("p",BE,D(S(o)("Base branch")),1),Fe(as,{class:"new-thread-branch-dropdown","model-value":_t.value,options:na.value,placeholder:S(o)("Select branch"),"enable-search":!0,"search-placeholder":S(o)("Search branches..."),disabled:xn.value||na.value.length===0,"onUpdate:modelValue":qp},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),m("p",qE,D(xn.value?S(o)("Loading branches…"):Ja.value?S(o)("New worktree branch will start from {branch}.",{branch:Ja.value}):S(o)("No Git branches found for this folder.")),1)])):ue("",!0),m("p",HE,D(S(o)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1),$t.value.phase!=="idle"?(x(),$("div",{key:2,class:at(["worktree-init-status",{"is-running":$t.value.phase==="running","is-error":$t.value.phase==="error"}])},[m("strong",VE,D($t.value.title),1),m("span",WE,D($t.value.message),1)],2)):ue("",!0),Hn.value?(x(),$("div",zE,[m("div",GE,[m("p",KE,D(S(o)("Trending GitHub projects")),1),Fe(as,{class:"new-thread-trending-scope-dropdown","model-value":Ft.value,options:Wo.value,"onUpdate:modelValue":so},null,8,["model-value","options"])]),vn.value?(x(),$("p",YE,D(S(o)("Loading trending projects...")),1)):Dn.value.length===0?(x(),$("p",JE,D(S(o)("Trending repos are unavailable right now.")),1)):(x(),$("div",QE,[(x(!0),$(He,null,jt(Dn.value,C=>(x(),$("button",{key:C.id,type:"button",class:"new-thread-trending-tip",onClick:ie=>Fp(C)},[m("span",{class:"new-thread-trending-tip-name",title:C.fullName},[C.owner&&C.repo?(x(),$(He,{key:0},[m("span",eI,D(C.owner),1),v[27]||(v[27]=m("span",{class:"new-thread-trending-tip-name-slash"},"/",-1)),m("span",tI,D(C.repo),1)],64)):(x(),$("span",nI,D(C.fullName),1))],8,ZE),m("span",rI,D(ar(C)),1),m("span",oI,D(C.description||S(o)("No description available.")),1)],8,XE))),128))]))])):ue("",!0)]),m("div",sI,[Ht.value&&Tn.value?(x(),lt(S(n),{key:0,class:"content-thread-terminal-panel","thread-id":So.value,cwd:Tn.value,onHide:Ko,onTerminalFocusChange:oo},null,8,["thread-id","cwd"])):ue("",!0),Fe(gf,{ref_key:"homeThreadComposerRef",ref:wt,"active-thread-id":So.value,cwd:Tn.value,"collaboration-modes":S(Ae),"selected-collaboration-mode":S(Ue),models:S(ge),"selected-model":za.value,"selected-reasoning-effort":S(Ie),"selected-speed-mode":S(re),"is-updating-speed-mode":S(Ke),skills:S(de),"thread-token-usage":S(V),"codex-quota":S(ye),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":nr.value,"in-progress-submit-mode":rr.value,"dictation-click-to-toggle":on.value,"dictation-auto-send":or.value,"dictation-language":Tt.value,onSubmit:Je,"onUpdate:selectedCollaborationMode":Mc,"onUpdate:selectedModel":Sc,"onUpdate:selectedReasoningEffort":Cc,"onUpdate:selectedSpeedMode":xc},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"])])])):(x(),$("div",aI,[en.value&&S(ee)&&Tn.value?(x(),lt(S(r),{key:0,"thread-id":S(ee),cwd:Tn.value,"is-thread-in-progress":ea.value,onClose:v[24]||(v[24]=C=>en.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress"])):(x(),$(He,{key:1},[m("div",iI,[Fe(S(t),{ref_key:"threadConversationRef",ref:Xn,messages:fs.value,"is-loading":S(_e),"active-thread-id":So.value,cwd:Tn.value,"scroll-state":S(R),"live-overlay":Xs.value,"pending-requests":S(Z),onUpdateScrollState:Y,onForkThread:ze,onRollback:Zp,onRespondServerRequest:X},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),m("div",lI,[Fe(F1,{messages:S(oe),onEdit:Up,onSteer:S(Te),onDelete:S(te)},null,8,["messages","onSteer","onDelete"]),S(W)&&S(ee)&&Tn.value?(x(),lt(S(n),{key:0,class:"content-thread-terminal-panel","thread-id":S(ee),cwd:Tn.value,onHide:bs,onTerminalFocusChange:oo},null,8,["thread-id","cwd"])):ue("",!0),Ga.value?(x(),lt(M1,{key:1,request:Ga.value,"request-count":S(Z).length,"has-queue-above":S(oe).length>0,onRespondServerRequest:X},null,8,["request","request-count","has-queue-above"])):(x(),lt(gf,{key:2,ref_key:"threadComposerRef",ref:pn,"active-thread-id":So.value,cwd:Tn.value,"collaboration-modes":S(Ae),"selected-collaboration-mode":S(Ue),models:S(ge),"selected-model":za.value,"selected-reasoning-effort":S(Ie),"selected-speed-mode":S(re),"is-updating-speed-mode":S(Ke),skills:S(de),"thread-token-usage":S(V),"codex-quota":S(ye),"is-turn-in-progress":ea.value,"is-stop-pending":S(Qe),"is-interrupting-turn":S(Ve),"has-queue-above":S(oe).length>0,"send-with-enter":nr.value,"in-progress-submit-mode":rr.value,"dictation-click-to-toggle":on.value,"dictation-auto-send":or.value,"dictation-language":Tt.value,"onUpdate:selectedCollaborationMode":Mc,onSubmit:Je,"onUpdate:selectedModel":Sc,"onUpdate:selectedReasoningEffort":Cc,"onUpdate:selectedSpeedMode":xc,onInterrupt:Xp},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"]))}}),dI=yt(cI,[["__scopeId","data-v-97a1d04e"]]),yu={render:()=>null},fI=vw({history:Yy(),routes:[{path:"/",name:"home",component:yu},{path:"/thread/:threadId",name:"thread",component:yu},{path:"/skills",name:"skills",component:yu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. github: https://github.com/friuns2/codexUI");ay(dI).use(fI).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Ap("Service worker registration failed."),e)})});export{CI as $,lt as A,oc as B,vb as C,vI as D,gI as E,He as F,yI as G,_o as H,Fi as I,wI as J,ln as K,ey as L,MI as M,RI as N,$I as O,pI as P,PI as Q,vc as R,Rs as S,Yh as T,m0 as U,yf as V,gn as W,Qt as X,mI as Y,bI as Z,yt as _,m as a,_I as a0,II as a1,TI as a2,kI as a3,SI as a4,xI as a5,EI as a6,AI as a7,Uo as b,$ as c,Cn as d,ds as e,ue as f,jt as g,at as h,hI as i,Fe as j,Mi as k,FT as l,xC as m,Xt as n,x as o,ot as p,po as q,P as r,S as s,D as t,hc as u,cs as v,ut as w,St as x,se as y,wi as z};
|