@muyichengshayu/promptx 0.2.6 → 0.2.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.7
4
+
5
+ - 新增 `Aqua Classic` 主题:以复古 macOS Aqua / Snow Leopard 的银灰工具窗口为方向,补齐工作台、设置弹窗、按钮、输入框、消息卡片、确认删除等核心区域的主题 token 与专属样式。
6
+ - 继续打磨主题一致性:修复 `Aqua Classic` 下 Agent 选择器、任务 / 项目选中态、危险按钮颜色等细节,并同步补齐 `Glass Light` 下 Agent 选择器的圆角和玻璃质感。
7
+ - 优化设置页通用表单:语言选择从下拉改为卡片式单选,发送消息方式的单选控件统一放到右侧,让 radio / checkbox 的布局保持一致。
8
+
3
9
  ## 0.2.6
4
10
 
5
11
  - 修复切换任务时中栏消息偶发没有自动滚到底部的问题:任务切换后会进入一段短暂的强制跟底窗口,在 run 历史刷新、异步渲染和内容补齐期间持续补滚;如果用户主动手势滚动,则立即退出自动跟随,避免抢控制。
@@ -1,3 +1,3 @@
1
- import{W as dt,j as ht,o as Mt,s as jt,p as It,q as ut,h as Et,t as tt,f as At,v as ct,w as ft,x as Pt,y as qe,z as Dt,A as et}from"./WorkbenchView-BqHMDZ1g.js";import{u as Ve,f as Rt,e as Tt}from"./index-7F-RPTS_.js";import{w as oe,n as me,ak as at,aD as c,aI as re,aJ as De,aF as n,aQ as d,u as i,aG as I,aW as Lt,aU as Bt,aX as Ft,aE as g,aR as he,aS as Se,aL as O,aN as M,aV as Nt,aK as nt,b as $,c as C,o as Ot,aZ as yt,r as Ut}from"./vendor-misc-u-M8sNMf.js";import{c as zt,L as Ge,F as Xe,e as Ht,b as st,X as pt,C as Kt,O as qt,j as Vt,x as Wt,P as Qt,i as gt,E as Gt,Q as Xt,q as Yt,r as Jt,Y as Zt}from"./vendor-ui-BglsaDbv.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";import"./vendor-router-Dn8q3tJM.js";const en={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},tn={class:"theme-muted-text mt-1 text-xs leading-5"},nn={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},sn={class:"flex items-start gap-2 text-xs leading-5"},an={class:"theme-muted-text shrink-0"},ln={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},on={class:"theme-muted-text mt-4 block text-xs"},rn={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},dn=["placeholder"],un={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},cn={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},fn={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},pn={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},gn={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},vn={key:4,class:"theme-empty-state px-3 py-8 text-sm"},mn={key:5,class:"theme-empty-state px-3 py-8 text-sm"},hn={key:6,class:"theme-empty-state px-3 py-8 text-sm"},yn={key:7,class:"space-y-1"},xn=["onClick"],bn={class:"min-w-0 flex-1"},wn=["innerHTML"],Sn=["innerHTML"],kn={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},Cn={key:8,class:"space-y-1"},_n={class:"flex items-start gap-1.5"},$n=["onClick"],Mn=["onClick"],jn={class:"min-w-0 flex-1"},In={key:0,class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all"},En={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},An={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},Pn=["disabled"],Dn=["disabled"],Rn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(r,{emit:q}){const j=r,P=q,{t:y}=Ve(),B=$(""),D=$(null),p=$(!1),S=$(""),E=$(!1),o=$(""),b=$([]),A=$(!1),u=$(""),_=$(""),de=$(null);let V=null,U=0,F=null;const z=new Map,H=C(()=>$e(D.value?[D.value]:[])),G=C(()=>String(u.value||"").trim()),X=C(()=>G.value.length>=dt),R=C(()=>!!G.value),Q=C(()=>R.value?b.value:H.value),Z=C(()=>Q.value.map(e=>{const l=m((e==null?void 0:e.path)||""),s=e!=null&&e.expanded?1:0,f=e!=null&&e.loading?1:0;return`${l}:${s}:${f}`}).join("|")),ge=C(()=>R.value&&!X.value&&!E.value&&!o.value),ae=C(()=>R.value&&X.value&&!E.value&&!o.value&&!b.value.length),Y=C(()=>!R.value&&!p.value&&!S.value&&!H.value.length);function h(e=""){const l=String(e||"").trim();return/^[a-z]:[\\/]/i.test(l)||l.includes("\\")}function m(e=""){const l=String(e||"").trim();if(!l)return"";const s=h(l);let f=l.replace(/\\/g,"/");return f.length>1&&!/^[a-z]:\/?$/i.test(f)&&f!=="/"&&(f=f.replace(/\/+$/,"")),s?f.toLowerCase():f}function v(e="",l=""){const s=m(e),f=m(l);return!s||!f?!1:s===f||s.startsWith(`${f}/`)}function K(e="",l=""){const s=String(e||"").trim(),f=String(l||"").trim();return s?f?h(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${f}`:`${s.replace(/[\\/]+$/,"")}\\${f}`:s==="/"?`/${f}`:`${s.replace(/\/+$/,"")}/${f}`:s:f}function ee(e="",l=""){const s=m(e),f=m(l);if(!s||!f||!v(f,s))return[];const W=f===s?"":f.slice(s.length).replace(/^\//,"");return W?W.split("/").filter(Boolean):[]}function w(e=""){const l=String(e||"").trim();if(!l||m(l)===m(B.value))return"";const s=h(l),f=l.replace(/\\/g,"/");if(s){const ie=f.replace(/\/+$/,""),le=ie.lastIndexOf("/");if(le<=2)return"";const He=ie.slice(0,le).replace(/\//g,"\\");return v(He,B.value)?He:""}const W=f.replace(/\/+$/,""),se=W.lastIndexOf("/");if(se<=0)return"";const we=W.slice(0,se)||"/";return v(we,B.value)?we:""}function ke(e){return(e==null?void 0:e.name)||(e==null?void 0:e.path)||y("directoryPicker.unnamedDirectory")}function Ye(e=""){const l=String(e||"").trim();return l?l.split(/[\\/]/).filter(Boolean).at(-1)||l:"Home"}function ue(e=""){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ce(e="",l=""){const s=String(e||""),f=String(l||"").trim().toLowerCase();if(!s||!f)return null;const W=s.toLowerCase(),se=W.indexOf(f);if(se>=0)return{start:se,end:se+f.length};const we=f.split(/[\\/\s_.-]+/).filter(Boolean).sort((ie,le)=>le.length-ie.length);for(const ie of we){if(ie.length<2)continue;const le=W.indexOf(ie);if(le>=0)return{start:le,end:le+ie.length}}return null}function _e(e="",l=""){const s=String(e||""),f=Ce(s,l);return f?`${ue(s.slice(0,f.start))}<mark class="theme-search-highlight">${ue(s.slice(f.start,f.end))}</mark>${ue(s.slice(f.end))}`:ue(s)}function ce(e){return _e(ke(e),u.value)}function T(e){return _e((e==null?void 0:e.path)||"",u.value)}function Re(e,l=0){return{...e,depth:l,expanded:!1,loaded:!1,loading:!1,children:[]}}function $e(e=[],l=[]){return e.forEach(s=>{l.push(s),s.expanded&&s.children.length&&$e(s.children,l)}),l}function fe(){D.value&&(D.value={...D.value})}function ye(){V&&(window.clearTimeout(V),V=null),F&&(F.abort(),F=null)}function xe(e,l=D.value?[D.value]:[]){const s=m(e);if(!s)return null;for(const f of l){if(m(f.path)===s)return f;if(f.children.length){const W=xe(e,f.children);if(W)return W}}return null}function J(e){_.value=String((e==null?void 0:e.path)||"").trim()}function pe(e=""){return m(e)}function Te(e,l){const s=pe(e);if(s){if(l){z.set(s,l);return}z.delete(s)}}function be(){var l;const e=z.get(pe(_.value));(l=e==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})}function We(){me(()=>{var e,l;(l=(e=de.value)==null?void 0:e.focus)==null||l.call(e)})}function Je(){const e=Q.value;if(!e.length){_.value="";return}const l=pe(_.value);l&&e.some(s=>pe((s==null?void 0:s.path)||"")===l)||J(e[0])}function Me(){const e=Q.value;if(!e.length)return-1;const l=pe(_.value),s=e.findIndex(f=>pe((f==null?void 0:f.path)||"")===l);return s>=0?s:0}function te(){const e=Q.value,l=Me();return l<0||!e.length?null:e[l]||null}function ve(e=1){const l=Q.value;if(!l.length)return!1;const s=Me(),f=s<0?0:(s+e+l.length)%l.length;return J(l[f]),me(be),!0}async function Qe(){if(R.value)return!1;const e=te();if(!e||!e.hasChildren)return!1;if(!e.expanded)return await ne(e),!0;const l=Q.value,s=Me(),f=l[s+1];return f&&w(f.path)===e.path?(J(f),me(be),!0):!1}function Le(){if(R.value)return!1;const e=te();if(!e)return!1;if(e.expanded&&e.hasChildren)return e.expanded=!1,fe(),J(e),!0;const l=w(e.path);if(!l)return!1;const s=xe(l);return s?(J(s),me(be),!0):!1}function je(e){var l,s,f;if((l=e==null?void 0:e.preventDefault)==null||l.call(e),G.value){(s=e==null?void 0:e.stopPropagation)==null||s.call(e),u.value="";return}(f=e==null?void 0:e.stopPropagation)==null||f.call(e),P("close")}function Be(e){const l=String((e==null?void 0:e.key)||"");if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter","Escape"].includes(l)&&!(R.value&&(l==="ArrowLeft"||l==="ArrowRight"))){if(l==="ArrowDown"){e.preventDefault(),ve(1);return}if(l==="ArrowUp"){e.preventDefault(),ve(-1);return}if(l==="Escape"){je(e);return}if(R.value){if(l==="Enter"){e.preventDefault();const s=te();s&&Ue(s)}return}if(l==="ArrowRight"){e.preventDefault(),Qe();return}if(l==="ArrowLeft"){e.preventDefault(),Le();return}l==="Enter"&&(e.preventDefault(),ze())}}async function Ie(e,l={}){if(!(!e||e.loading)&&!(e.loaded&&!l.force)){e.loading=!0,S.value="",fe();try{const s=await ut({path:e.path,limit:240});e.children=(s.items||[]).map(f=>Re(f,e.depth+1)),e.loaded=!0}catch(s){S.value=s.message||y("directoryPicker.loadFailed")}finally{e.loading=!1,fe()}}}async function Ee(){p.value=!0,S.value="";try{const e=await ut({limit:240});B.value=String(e.path||""),D.value=Re({name:Ye(e.path||""),path:String(e.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),D.value.children=(e.items||[]).map(l=>Re(l,1)),D.value.loaded=!0,D.value.expanded=!0,J(D.value)}catch(e){S.value=e.message||y("directoryPicker.treeLoadFailed"),D.value=null,B.value=""}finally{p.value=!1}}async function Fe(e=""){const l=String(e||"").trim();if(!l||!B.value||!v(l,B.value))return;let s=D.value;if(!s)return;J(s);const f=ee(B.value,l);for(const W of f){await Ie(s),s.expanded=!0,fe();const se=xe(K(s.path,W),s.children);if(!se)break;s=se,J(s)}}async function Ae(){u.value="",b.value=[],o.value="",A.value=!1,_.value="",await Ee();const e=String(j.initialPath||"").trim();e&&v(e,B.value)&&await Fe(e)}async function ne(e){if(e!=null&&e.path&&(J(e),!!e.hasChildren)){if(!e.loaded){e.expanded=!0,fe(),await Ie(e);return}e.expanded=!e.expanded,fe()}}function Pe(e){e!=null&&e.path&&J(e)}async function Ne(){const e=String(u.value||"").trim();U+=1;const l=U;if(ye(),!j.open||!e||!B.value||!X.value){E.value=!1,o.value="",b.value=[],A.value=!1;return}E.value=!0,o.value="",F=new AbortController;try{const s=await jt(e,{path:B.value,limit:80,signal:F.signal});if(l!==U)return;b.value=Array.isArray(s.items)?s.items:[],A.value=!!s.truncated}catch(s){if(It(s)||l!==U)return;o.value=s.message||y("directoryPicker.searchFailed"),b.value=[],A.value=!1}finally{l===U&&(F=null),l===U&&(E.value=!1)}}function Oe(){if(ye(),!String(u.value||"").trim()||!X.value){E.value=!1,o.value="",b.value=[],A.value=!1;return}E.value=!0,o.value="",V=window.setTimeout(()=>{V=null,Ne()},Mt)}async function Ue(e){e!=null&&e.path&&(await Fe(e.path),u.value="")}function ze(){_.value&&(P("select",_.value),P("close"))}return oe(u,()=>{Oe()}),oe(Z,()=>{Je(),me(be)},{immediate:!0}),oe(()=>j.open,e=>{if(e){Ae().catch(()=>{}),We();return}ye()}),at(()=>{ye()}),(e,l)=>(c(),re(ht,{open:r.open,"stack-level":1,"panel-class":"settings-dialog-panel h-[calc(100dvh-1rem)] max-w-4xl sm:h-[96vh] sm:max-h-[96vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5","close-disabled":p.value||E.value,"close-on-backdrop":!(p.value||E.value),"close-on-escape":!(p.value||E.value),onClose:l[2]||(l[2]=s=>P("close"))},{title:De(()=>[n("div",null,[n("div",en,[I(i(Xe),{class:"h-4 w-4"}),n("span",null,d(i(y)("directoryPicker.title")),1)]),n("p",tn,d(i(y)("directoryPicker.intro")),1)])]),default:De(()=>[n("div",{class:"flex min-h-0 flex-1 flex-col overflow-hidden",onKeydown:Be},[n("div",nn,[n("div",sn,[n("span",an,d(i(y)("directoryPicker.currentSelection")),1),n("span",ln,d(_.value||i(y)("directoryPicker.selectionPlaceholder")),1)])]),n("label",on,[n("span",null,d(i(y)("directoryPicker.searchLabel")),1),n("div",rn,[I(i(zt),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Lt(n("input",{ref_key:"searchInputRef",ref:de,"onUpdate:modelValue":l[0]||(l[0]=s=>u.value=s),type:"text",placeholder:i(y)("directoryPicker.searchPlaceholder"),class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]",onKeydown:Bt(je,["esc"])},null,40,dn),[[Ft,u.value]])])]),n("div",un,[R.value&&o.value?(c(),g("div",cn,d(o.value),1)):!R.value&&S.value?(c(),g("div",fn,d(S.value),1)):R.value&&E.value?(c(),g("div",pn,[I(i(Ge),{class:"h-4 w-4 animate-spin"}),n("span",null,d(i(y)("directoryPicker.searching")),1)])):!R.value&&p.value?(c(),g("div",gn,[I(i(Ge),{class:"h-4 w-4 animate-spin"}),n("span",null,d(i(y)("directoryPicker.treeLoading")),1)])):ge.value?(c(),g("div",vn,d(i(y)("directoryPicker.searchMinKeywordHint",{count:i(dt)})),1)):ae.value?(c(),g("div",mn,d(i(y)("directoryPicker.noSearchResults")),1)):Y.value?(c(),g("div",hn,d(i(y)("directoryPicker.emptyTree")),1)):R.value?(c(),g("div",yn,[(c(!0),g(he,null,Se(b.value,s=>(c(),g("button",{key:s.path,ref_for:!0,ref:f=>Te(s.path,f),type:"button",class:O(["theme-list-row focus:outline-none",m(_.value)===m(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:f=>Ue(s)},[I(i(Xe),{class:"theme-list-item-icon"}),n("div",bn,[n("div",null,[n("span",{class:"theme-list-item-title block break-all",innerHTML:ce(s)},null,8,wn)]),n("div",{class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all",innerHTML:T(s)},null,8,Sn)])],10,xn))),128)),A.value?(c(),g("p",kn,d(i(y)("directoryPicker.truncatedHint")),1)):M("",!0)])):(c(),g("div",Cn,[(c(!0),g(he,null,Se(H.value,s=>(c(),g("div",{key:s.path,ref_for:!0,ref:f=>Te(s.path,f),class:O(["theme-list-tree-item outline-none focus:outline-none focus-visible:outline-none",m(_.value)===m(s.path)?"theme-list-item-active":s.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:Nt({paddingLeft:`${s.depth*16+6}px`})},[n("div",_n,[n("button",{type:"button",class:O(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:nt(f=>ne(s),["stop"])},[s.loading?(c(),re(i(Ge),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(c(),re(i(Ht),{key:1,class:O(["h-3.5 w-3.5 transition",s.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,$n),n("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:f=>Pe(s)},[I(i(Xe),{class:O(["h-4 w-4 shrink-0",m(_.value)===m(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),n("div",jn,[n("div",{class:O(["theme-list-item-title truncate",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},d(ke(s)),3),s.isHomeRoot?(c(),g("div",In,d(s.path),1)):M("",!0)])],8,Mn)])],6))),128))]))])],32),n("div",En,[n("div",An,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:p.value||E.value,onClick:l[1]||(l[1]=s=>P("close"))},d(i(y)("directoryPicker.cancel")),9,Pn),n("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:p.value||E.value||!_.value,onClick:ze},[I(i(st),{class:"h-4 w-4"}),n("span",null,d(i(y)("directoryPicker.useCurrentDirectory")),1)],8,Dn)])])]),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"]))}},Tn={class:"grid gap-4"},Ln={class:"theme-muted-text block text-xs"},Bn=["value","disabled"],Fn={class:"theme-muted-text block text-xs"},Nn={class:"mt-1 flex gap-2"},On={class:"relative min-w-0 flex-1"},Un=["value","disabled"],zn=["disabled"],Hn=["disabled"],Kn={id:"codex-manager-workspace-suggestions"},qn=["value"],Vn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},Wn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},Qn={class:"theme-muted-text block text-xs"},Gn={class:"mt-1"},Xn={class:"flex items-center gap-2 text-sm"},Yn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Jn=["disabled","onClick"],Zn={class:"flex items-center justify-between gap-3"},es={class:"min-w-0 flex-1 truncate"},ts={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},ns={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},ss={class:"theme-muted-text block text-xs"},as={class:"mt-2 grid gap-2"},is=["disabled","onClick"],ls={class:"min-w-0"},os={class:"text-sm text-[var(--theme-textPrimary)]"},rs={class:"theme-muted-text mt-0.5 text-[11px] leading-5"},ds={class:"theme-muted-text mt-2 text-[11px] leading-5"},us={class:"theme-muted-text block text-xs"},cs={class:"mt-1 flex gap-2"},fs=["value","disabled"],ps=["disabled"],gs={key:1,class:"theme-popover theme-divider absolute left-0 right-0 top-[calc(100%+0.375rem)] z-20 overflow-hidden rounded-sm border border-solid shadow-sm"},vs={class:"flex items-center justify-between gap-2 border-b border-solid px-3 py-2 text-[11px] leading-5"},ms={class:"font-medium text-[var(--theme-textPrimary)]"},hs={key:0,class:"theme-muted-text"},ys={key:0,class:"max-h-72 overflow-y-auto p-2"},xs=["disabled","onClick"],bs={class:"flex min-w-0 items-center justify-between gap-3"},ws={class:"min-w-0 flex-1 truncate text-xs font-medium text-[var(--theme-textPrimary)]"},Ss={class:"shrink-0 text-[11px] leading-4 text-[var(--theme-textMuted)]"},ks={key:1,class:"theme-empty-state px-3 py-4 text-xs"},Cs=["disabled"],_s={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},$s={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},vt={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},agentEngines:{type:Array,default:()=>[]},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},canEditSessionId:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},sessionId:{type:String,default:""},sessionIdCopied:{type:Boolean,default:!1},sessionIdReadonlyMessage:{type:String,default:""},sessionCandidates:{type:Array,default:()=>[]},sessionCandidatesLoading:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["copy-session-id","open-directory-picker","select-session-candidate","update:agentEngines","update:cwd","update:engine","update:sessionId","update:title"],setup(r,{emit:q}){const j=r,P=q,{t:y}=Ve(),B=$(null),D=$(null),p=$(!1),S=$(-1),E=C(()=>{const h=String(j.engine||"").trim();return j.engineOptions.find(m=>String((m==null?void 0:m.value)||"").trim()===h)||null}),o=C(()=>{const h=Array.isArray(j.agentEngines)?j.agentEngines:[];return[...new Set(h.map(m=>String(m||"").trim()).filter(Boolean))]}),b=C(()=>j.engineOptions.filter(h=>String((h==null?void 0:h.value)||"").trim()!==String(j.engine||"").trim())),A=C(()=>!!String(j.cwd||"").trim()),u=C(()=>String(j.sessionId||"").trim()),_=C(()=>u.value.toLowerCase()),de=C(()=>j.sessionCandidates.filter(h=>h==null?void 0:h.matchedCwd)),V=C(()=>{const h=_.value,m=de.value;return h?m.filter(v=>[v==null?void 0:v.label,v==null?void 0:v.id,v==null?void 0:v.cwd].map(ee=>String(ee||"").toLowerCase()).some(ee=>ee.includes(h))).slice(0,10):m.slice(0,10)});function U(){j.busy||!j.canEditSessionId||!A.value||(p.value=!0)}function F(){p.value=!1,S.value=-1}function z(){const h=V.value;if(!h.length){S.value=-1;return}const m=h.findIndex(v=>v.id===u.value);S.value=m>=0?m:0}function H(){me(()=>{var h,m;(m=(h=D.value)==null?void 0:h.focus)==null||m.call(h)})}function G(){if(p.value){F();return}U(),H()}function X(){P("update:cwd","")}function R(h){if(!j.canEditEngine||j.busy)return;const m=String(h||"").trim(),v=o.value.includes(m)?o.value.filter(K=>K!==m):[...o.value,m];P("update:agentEngines",v)}function Q(){P("update:sessionId",""),F(),H()}function Z(h){var m;P("update:sessionId",((m=h==null?void 0:h.target)==null?void 0:m.value)||""),A.value&&U()}function ge(h){P("select-session-candidate",h),F(),H()}function ae(h){if(j.busy||!j.canEditSessionId||!A.value)return;const m=V.value;if(h.key==="ArrowDown"){if(h.preventDefault(),!p.value){U(),z();return}if(!m.length)return;S.value=S.value<0?0:Math.min(m.length-1,S.value+1);return}if(h.key==="ArrowUp"){if(h.preventDefault(),!p.value){U(),z();return}if(!m.length)return;S.value=S.value<0?m.length-1:Math.max(0,S.value-1);return}if(h.key==="Enter"&&p.value&&m.length&&S.value>=0){h.preventDefault(),ge(m[S.value]);return}h.key==="Escape"&&p.value&&(h.preventDefault(),F())}function Y(h){!p.value||!B.value||B.value.contains(h.target)||F()}return oe(V,()=>{z()}),oe(()=>j.canEditSessionId,h=>{(!h||!A.value)&&F()}),oe(A,h=>{h||F()}),Ot(()=>{document.addEventListener("pointerdown",Y)}),at(()=>{document.removeEventListener("pointerdown",Y)}),(h,m)=>(c(),g("div",Tn,[n("label",Ln,[n("span",null,d(i(y)("projectManager.projectTitleOptional")),1),n("input",{value:r.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:r.busy,onInput:m[0]||(m[0]=v=>P("update:title",v.target.value))},null,40,Bn)]),n("label",Fn,[n("span",null,d(i(y)("projectManager.workingDirectoryField")),1),n("div",Nn,[n("div",On,[n("input",{value:r.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:O(["tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",r.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:r.busy||!r.canEditCwd,onInput:m[1]||(m[1]=v=>P("update:cwd",v.target.value))},null,42,Un),r.cwd&&r.canEditCwd?(c(),g("button",{key:0,type:"button",class:"theme-muted-text absolute right-2 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm transition hover:bg-[var(--theme-appPanelHover)] hover:text-[var(--theme-textPrimary)]",disabled:r.busy,onClick:X},[I(i(pt),{class:"h-3.5 w-3.5"})],8,zn)):M("",!0)]),n("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:r.busy||!r.canEditCwd,onClick:m[2]||(m[2]=v=>P("open-directory-picker"))},[I(i(Xe),{class:"h-4 w-4"}),n("span",null,d(r.mobile?i(y)("projectManager.choose"):i(y)("projectManager.chooseDirectory")),1)],8,Hn)]),n("datalist",Kn,[(c(!0),g(he,null,Se(r.workspaceSuggestions,v=>(c(),g("option",{key:v,value:v},null,8,qn))),128))]),r.duplicateCwdMessage?(c(),g("p",Vn,d(r.duplicateCwdMessage),1)):r.cwdReadonlyMessage?(c(),g("p",Wn,d(r.cwdReadonlyMessage),1)):M("",!0)]),n("label",Qn,[n("span",null,d(i(y)("projectManager.engineField")),1),n("div",Gn,[I(Et,{"model-value":r.engine,options:r.engineOptions,disabled:r.busy||!r.canEditEngine,placeholder:i(y)("projectManager.selectEngine"),"empty-text":i(y)("projectManager.noEngines"),"get-option-value":v=>(v==null?void 0:v.value)||"","onUpdate:modelValue":m[3]||(m[3]=v=>P("update:engine",v))},{trigger:De(({disabled:v})=>{var K;return[n("div",Xn,[n("span",{class:O(["min-w-0 flex-1 truncate",v?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},d(((K=E.value)==null?void 0:K.label)||i(y)("projectManager.selectEngine")),3),E.value&&E.value.enabled===!1?(c(),g("span",Yn,d(i(y)("projectManager.comingSoon")),1)):M("",!0)])]}),option:De(({option:v,selected:K,select:ee})=>[n("button",{type:"button",class:O(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",K?"theme-filter-active":"theme-filter-idle"]),disabled:(v==null?void 0:v.enabled)===!1,onClick:ee},[n("div",Zn,[n("span",es,d(v.label),1),(v==null?void 0:v.enabled)===!1?(c(),g("span",ts,d(i(y)("projectManager.comingSoon")),1)):M("",!0)])],10,Jn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),r.engineReadonlyMessage?(c(),g("p",ns,d(r.engineReadonlyMessage),1)):M("",!0)]),n("div",ss,[n("span",null,d(i(y)("projectManager.collaborationAgents")),1),n("div",as,[(c(!0),g(he,null,Se(b.value,v=>(c(),g("button",{key:v.value,type:"button",class:O(["theme-list-row flex items-center justify-between gap-3 rounded-sm border border-solid px-3 py-2 text-left transition",o.value.includes(v.value)?"theme-list-item-active":"theme-list-item-hover"]),disabled:r.busy||!r.canEditEngine,onClick:K=>R(v.value)},[n("div",ls,[n("div",os,d(v.label),1),n("div",rs,d(o.value.includes(v.value)?i(y)("projectManager.agentEnabled"):i(y)("projectManager.agentDisabled")),1)]),o.value.includes(v.value)?(c(),re(i(st),{key:0,class:"h-4 w-4 shrink-0 text-[var(--theme-textPrimary)]"})):M("",!0)],10,is))),128))]),n("p",ds,d(i(y)("projectManager.collaborationAgentsHint")),1)]),n("label",us,[n("span",null,d(i(y)("projectManager.sessionId")),1),n("div",cs,[n("div",{ref_key:"sessionComboboxRef",ref:B,class:"relative min-w-0 flex-1"},[n("input",{ref_key:"sessionInputRef",ref:D,value:r.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",disabled:r.busy||!r.canEditSessionId,onFocus:U,onInput:Z,onKeydown:ae},null,40,fs),r.canEditSessionId?(c(),g("button",{key:0,type:"button",class:"theme-muted-text absolute right-2 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm transition hover:bg-[var(--theme-appPanelHover)] hover:text-[var(--theme-textPrimary)]",disabled:r.busy||!A.value,onClick:G},[r.sessionCandidatesLoading?(c(),re(i(Ge),{key:0,class:"h-3.5 w-3.5 animate-spin"})):u.value?(c(),re(i(pt),{key:1,class:"h-3.5 w-3.5",onClick:nt(Q,["stop"])})):(c(),re(i(Kt),{key:2,class:O(["h-3.5 w-3.5 transition",p.value?"rotate-180":""])},null,8,["class"]))],8,ps)):M("",!0),r.canEditSessionId&&p.value?(c(),g("div",gs,[n("div",vs,[n("span",ms,d(i(y)("projectManager.sessionCandidates")),1),r.sessionCandidatesLoading?(c(),g("span",hs,d(i(y)("projectManager.sessionCandidatesLoading")),1)):M("",!0)]),V.value.length?(c(),g("div",ys,[(c(!0),g(he,null,Se(V.value,(v,K)=>(c(),g("button",{key:`${v.engine}:${v.id}`,type:"button",class:O(["theme-list-row mb-1 w-full px-2 py-1.5 text-left last:mb-0",K===S.value?"theme-list-item-active":"theme-list-item-hover"]),disabled:r.busy,onMousedown:m[4]||(m[4]=nt(()=>{},["prevent"])),onClick:ee=>ge(v)},[n("div",bs,[n("span",ws,d(v.label||v.id),1),n("span",Ss,d(v.updatedAtLabel||i(y)("projectManager.unknown")),1)])],42,xs))),128))])):(c(),g("div",ks,d(A.value?i(y)("projectManager.noSessionCandidates"):i(y)("projectManager.sessionCandidatesNeedDirectory")),1))])):M("",!0)],512),u.value?(c(),g("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:r.busy,onClick:m[5]||(m[5]=v=>P("copy-session-id"))},[r.sessionIdCopied?(c(),re(i(st),{key:0,class:"h-4 w-4"})):(c(),re(i(qt),{key:1,class:"h-4 w-4"})),n("span",null,d(r.sessionIdCopied?i(y)("projectManager.sessionIdCopied"):i(y)("projectManager.copySessionId")),1)],8,Cs)):M("",!0)]),r.sessionIdReadonlyMessage?(c(),g("p",_s,d(r.sessionIdReadonlyMessage),1)):(c(),g("p",$s,d(A.value?i(y)("projectManager.sessionIdHint"):i(y)("projectManager.sessionCandidatesNeedDirectory")),1))])]))}},Ms={class:"flex items-center justify-between gap-3"},js={class:"theme-heading text-sm font-medium"},Is={key:0,class:"theme-muted-text mt-1 text-xs"},Es=["disabled"],As=["onClick"],Ps={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Ds={class:"flex w-full flex-col gap-2 text-left"},Rs={class:"theme-heading min-w-0 text-sm font-medium"},Ts=["title"],Ls=["title"],Bs={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Fs={key:0,"aria-hidden":"true"},Ns={key:1},Os={class:"flex flex-wrap items-center gap-2 pt-1"},Us={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},mt={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:r=>r},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(r,{emit:q}){const j=r,P=q,{t:y}=Ve();function B(S){return j.mode==="edit"&&j.editingSessionId===S.id?"theme-card-selected":j.isSessionRunning(S.id)?"theme-card-warning":"theme-card-idle-strong"}function D(S){return j.isCurrentSession(S.id)?y("projectManager.current"):y("projectManager.regular")}function p(S){return j.isCurrentSession(S.id)?"theme-status-info":"theme-status-neutral"}return(S,E)=>(c(),g("div",{class:O(r.mobile?"flex h-full min-h-0 flex-col":"")},[n("div",Ms,[n("div",null,[n("div",js,d(i(y)("projectManager.projectList")),1),r.hasSessions?M("",!0):(c(),g("p",Is,d(i(y)("projectManager.noProjects")),1))]),n("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:r.busy,onClick:E[0]||(E[0]=o=>P("create"))},[I(i(Vt),{class:"h-4 w-4"}),n("span",null,d(i(y)("projectManager.create")),1)],8,Es)]),n("div",{class:O(["mt-4 space-y-2",r.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(c(!0),g(he,null,Se(r.sessions,o=>{var b;return c(),g("article",{key:o.id,class:O(["relative cursor-pointer rounded-sm border p-3 transition",B(o)]),onClick:A=>P("select",o.id)},[r.mode==="edit"&&r.editingSessionId===o.id?(c(),g("span",Ps)):M("",!0),n("div",Ds,[n("div",Rs,[n("span",{class:"block truncate",title:o.title||i(y)("projectManager.untitledProject")},d(o.title||i(y)("projectManager.untitledProject")),9,Ts)]),n("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:o.cwd},d(o.cwd),9,Ls),n("div",Bs,[n("span",null,d(((b=o==null?void 0:o.agentBindings)==null?void 0:b.length)>1?i(y)("projectManager.agentCount",{count:o.agentBindings.length}):i(tt)(o.engine)),1),r.mobile?M("",!0):(c(),g("span",Fs,"·")),r.mobile?M("",!0):(c(),g("span",Ns,d(r.formatUpdatedAt(o.updatedAt)),1))]),n("div",Os,[n("span",{class:O(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",p(o)])},d(D(o)),3),n("span",{class:O(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",r.getRuntimeStatusClass(o.id)])},[r.isSessionRunning(o.id)?(c(),g("span",Us)):M("",!0),yt(" "+d(r.getRuntimeStatusLabel(o.id)),1)],2),n("span",{class:O(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",r.getThreadStatusClass(o)])},d(r.getThreadStatusLabel(o)),3)])])],10,As)}),128))],2)],2))}},zs={class:"space-y-3"},Hs={class:"dashed-panel px-3 py-3"},Ks={class:"theme-muted-text text-[11px]"},qs={class:"mt-2 flex flex-wrap gap-2"},Vs={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},Ws={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},Qs={class:"dashed-panel px-3 py-3"},Gs={class:"theme-muted-text text-[11px]"},Xs={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Ys={key:0,class:"mt-2 flex flex-wrap gap-1.5"},Js={class:"dashed-panel px-3 py-3"},Zs={class:"theme-muted-text text-[11px]"},ea={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},ta={class:"dashed-panel px-3 py-3"},na={class:"theme-muted-text text-[11px]"},sa={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},aa={class:"dashed-panel px-3 py-3"},ia={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},la={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},oa={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:r=>r},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(r){const{t:q}=Ve();return(j,P)=>{var y,B,D,p,S,E,o,b,A;return c(),g("div",zs,[n("div",Hs,[n("div",Ks,d(i(q)("projectManager.runtimeStatus")),1),n("div",qs,[n("span",{class:O(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",r.getRuntimeStatusClass((y=r.activeSession)==null?void 0:y.id)])},[r.isSessionRunning((B=r.activeSession)==null?void 0:B.id)?(c(),g("span",Vs)):M("",!0),yt(" "+d(r.getRuntimeStatusLabel((D=r.activeSession)==null?void 0:D.id)),1)],2),n("span",{class:O(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",r.getThreadStatusClass(r.activeSession)])},d(r.getThreadStatusLabel(r.activeSession)),3),(p=r.activeSession)!=null&&p.id&&r.isCurrentSession(r.activeSession.id)?(c(),g("span",Ws,d(i(q)("projectManager.currentProject")),1)):M("",!0)])]),n("div",Qs,[n("div",Gs,d(i(q)("projectManager.engine")),1),n("div",Xs,d(i(tt)((S=r.activeSession)==null?void 0:S.engine)),1),((o=(E=r.activeSession)==null?void 0:E.agentBindings)==null?void 0:o.length)>1?(c(),g("div",Ys,[(c(!0),g(he,null,Se(r.activeSession.agentBindings,u=>(c(),g("span",{key:u.engine,class:"theme-status-neutral inline-flex items-center rounded-sm border border-solid px-1.5 py-0.5 text-[10px]"},d(i(tt)(u.engine)),1))),128))])):M("",!0)]),n("div",Js,[n("div",Zs,d(i(q)("projectManager.workingDirectory")),1),n("div",ea,d(((b=r.activeSession)==null?void 0:b.cwd)||i(q)("projectManager.notSet")),1)]),n("div",ta,[n("div",na,d(i(q)("projectManager.updatedAt")),1),n("div",sa,d(r.formatUpdatedAt((A=r.activeSession)==null?void 0:A.updatedAt)),1)]),n("div",aa,[n("div",ia,[I(i(Wt),{class:"h-3.5 w-3.5"}),n("span",null,d(i(q)("projectManager.note")),1)]),n("p",la,d(i(q)("projectManager.noteDescription")),1)])])}}},ra={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},da={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},ua={class:"theme-divider theme-muted-panel border-b px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},ca={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},fa={class:"flex flex-wrap items-start justify-between gap-3"},pa={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ga={class:"mt-5"},va={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},ma={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},ha={class:"flex flex-wrap items-center gap-2"},ya=["disabled"],xa=["disabled"],ba=["disabled"],wa={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Sa=["disabled"],ka=["disabled"],Ca=["disabled"],_a={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},$a={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ma={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},ja={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ia={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Ea=["disabled"],Aa={class:"min-w-0 flex-1"},Pa={class:"theme-heading truncate text-sm font-medium"},Da={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Ra={class:"theme-divider border-b px-4 py-3"},Ta={class:"grid grid-cols-2 gap-2"},La=["disabled"],Ba={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Fa={key:0},Na={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Oa={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ua=["disabled"],za=["disabled"],Ha=["disabled"],Ka=["disabled"],qa=3e3,Za={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null},onReset:{type:Function,default:null}},emits:["close","project-created","select-session","open-source-browser"],setup(r,{expose:q,emit:j}){const P=new Map;function y(t="",a=""){const x=qe(t),k=et(a);return!x||!k?"":`${x}
1
+ import{W as dt,j as ht,o as Mt,s as jt,p as It,q as ut,h as Et,t as tt,f as At,v as ct,w as ft,x as Pt,y as qe,z as Dt,A as et}from"./WorkbenchView-gbRu02Lv.js";import{u as Ve,f as Rt,e as Tt}from"./index-5LxHpYf5.js";import{w as oe,n as me,ak as at,aD as c,aI as re,aJ as De,aF as n,aQ as d,u as i,aG as I,aW as Lt,aU as Bt,aX as Ft,aE as g,aR as he,aS as Se,aL as O,aN as M,aV as Nt,aK as nt,b as $,c as C,o as Ot,aZ as yt,r as Ut}from"./vendor-misc-u-M8sNMf.js";import{c as zt,L as Ge,F as Xe,e as Ht,b as st,X as pt,C as Kt,O as qt,j as Vt,x as Wt,P as Qt,i as gt,E as Gt,Q as Xt,q as Yt,r as Jt,Y as Zt}from"./vendor-ui-BglsaDbv.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";import"./vendor-router-Dn8q3tJM.js";const en={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},tn={class:"theme-muted-text mt-1 text-xs leading-5"},nn={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},sn={class:"flex items-start gap-2 text-xs leading-5"},an={class:"theme-muted-text shrink-0"},ln={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},on={class:"theme-muted-text mt-4 block text-xs"},rn={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},dn=["placeholder"],un={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},cn={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},fn={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},pn={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},gn={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},vn={key:4,class:"theme-empty-state px-3 py-8 text-sm"},mn={key:5,class:"theme-empty-state px-3 py-8 text-sm"},hn={key:6,class:"theme-empty-state px-3 py-8 text-sm"},yn={key:7,class:"space-y-1"},xn=["onClick"],bn={class:"min-w-0 flex-1"},wn=["innerHTML"],Sn=["innerHTML"],kn={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},Cn={key:8,class:"space-y-1"},_n={class:"flex items-start gap-1.5"},$n=["onClick"],Mn=["onClick"],jn={class:"min-w-0 flex-1"},In={key:0,class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all"},En={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},An={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},Pn=["disabled"],Dn=["disabled"],Rn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(r,{emit:q}){const j=r,P=q,{t:y}=Ve(),B=$(""),D=$(null),p=$(!1),S=$(""),E=$(!1),o=$(""),b=$([]),A=$(!1),u=$(""),_=$(""),de=$(null);let V=null,U=0,F=null;const z=new Map,H=C(()=>$e(D.value?[D.value]:[])),G=C(()=>String(u.value||"").trim()),X=C(()=>G.value.length>=dt),R=C(()=>!!G.value),Q=C(()=>R.value?b.value:H.value),Z=C(()=>Q.value.map(e=>{const l=m((e==null?void 0:e.path)||""),s=e!=null&&e.expanded?1:0,f=e!=null&&e.loading?1:0;return`${l}:${s}:${f}`}).join("|")),ge=C(()=>R.value&&!X.value&&!E.value&&!o.value),ae=C(()=>R.value&&X.value&&!E.value&&!o.value&&!b.value.length),Y=C(()=>!R.value&&!p.value&&!S.value&&!H.value.length);function h(e=""){const l=String(e||"").trim();return/^[a-z]:[\\/]/i.test(l)||l.includes("\\")}function m(e=""){const l=String(e||"").trim();if(!l)return"";const s=h(l);let f=l.replace(/\\/g,"/");return f.length>1&&!/^[a-z]:\/?$/i.test(f)&&f!=="/"&&(f=f.replace(/\/+$/,"")),s?f.toLowerCase():f}function v(e="",l=""){const s=m(e),f=m(l);return!s||!f?!1:s===f||s.startsWith(`${f}/`)}function K(e="",l=""){const s=String(e||"").trim(),f=String(l||"").trim();return s?f?h(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${f}`:`${s.replace(/[\\/]+$/,"")}\\${f}`:s==="/"?`/${f}`:`${s.replace(/\/+$/,"")}/${f}`:s:f}function ee(e="",l=""){const s=m(e),f=m(l);if(!s||!f||!v(f,s))return[];const W=f===s?"":f.slice(s.length).replace(/^\//,"");return W?W.split("/").filter(Boolean):[]}function w(e=""){const l=String(e||"").trim();if(!l||m(l)===m(B.value))return"";const s=h(l),f=l.replace(/\\/g,"/");if(s){const ie=f.replace(/\/+$/,""),le=ie.lastIndexOf("/");if(le<=2)return"";const He=ie.slice(0,le).replace(/\//g,"\\");return v(He,B.value)?He:""}const W=f.replace(/\/+$/,""),se=W.lastIndexOf("/");if(se<=0)return"";const we=W.slice(0,se)||"/";return v(we,B.value)?we:""}function ke(e){return(e==null?void 0:e.name)||(e==null?void 0:e.path)||y("directoryPicker.unnamedDirectory")}function Ye(e=""){const l=String(e||"").trim();return l?l.split(/[\\/]/).filter(Boolean).at(-1)||l:"Home"}function ue(e=""){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ce(e="",l=""){const s=String(e||""),f=String(l||"").trim().toLowerCase();if(!s||!f)return null;const W=s.toLowerCase(),se=W.indexOf(f);if(se>=0)return{start:se,end:se+f.length};const we=f.split(/[\\/\s_.-]+/).filter(Boolean).sort((ie,le)=>le.length-ie.length);for(const ie of we){if(ie.length<2)continue;const le=W.indexOf(ie);if(le>=0)return{start:le,end:le+ie.length}}return null}function _e(e="",l=""){const s=String(e||""),f=Ce(s,l);return f?`${ue(s.slice(0,f.start))}<mark class="theme-search-highlight">${ue(s.slice(f.start,f.end))}</mark>${ue(s.slice(f.end))}`:ue(s)}function ce(e){return _e(ke(e),u.value)}function T(e){return _e((e==null?void 0:e.path)||"",u.value)}function Re(e,l=0){return{...e,depth:l,expanded:!1,loaded:!1,loading:!1,children:[]}}function $e(e=[],l=[]){return e.forEach(s=>{l.push(s),s.expanded&&s.children.length&&$e(s.children,l)}),l}function fe(){D.value&&(D.value={...D.value})}function ye(){V&&(window.clearTimeout(V),V=null),F&&(F.abort(),F=null)}function xe(e,l=D.value?[D.value]:[]){const s=m(e);if(!s)return null;for(const f of l){if(m(f.path)===s)return f;if(f.children.length){const W=xe(e,f.children);if(W)return W}}return null}function J(e){_.value=String((e==null?void 0:e.path)||"").trim()}function pe(e=""){return m(e)}function Te(e,l){const s=pe(e);if(s){if(l){z.set(s,l);return}z.delete(s)}}function be(){var l;const e=z.get(pe(_.value));(l=e==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})}function We(){me(()=>{var e,l;(l=(e=de.value)==null?void 0:e.focus)==null||l.call(e)})}function Je(){const e=Q.value;if(!e.length){_.value="";return}const l=pe(_.value);l&&e.some(s=>pe((s==null?void 0:s.path)||"")===l)||J(e[0])}function Me(){const e=Q.value;if(!e.length)return-1;const l=pe(_.value),s=e.findIndex(f=>pe((f==null?void 0:f.path)||"")===l);return s>=0?s:0}function te(){const e=Q.value,l=Me();return l<0||!e.length?null:e[l]||null}function ve(e=1){const l=Q.value;if(!l.length)return!1;const s=Me(),f=s<0?0:(s+e+l.length)%l.length;return J(l[f]),me(be),!0}async function Qe(){if(R.value)return!1;const e=te();if(!e||!e.hasChildren)return!1;if(!e.expanded)return await ne(e),!0;const l=Q.value,s=Me(),f=l[s+1];return f&&w(f.path)===e.path?(J(f),me(be),!0):!1}function Le(){if(R.value)return!1;const e=te();if(!e)return!1;if(e.expanded&&e.hasChildren)return e.expanded=!1,fe(),J(e),!0;const l=w(e.path);if(!l)return!1;const s=xe(l);return s?(J(s),me(be),!0):!1}function je(e){var l,s,f;if((l=e==null?void 0:e.preventDefault)==null||l.call(e),G.value){(s=e==null?void 0:e.stopPropagation)==null||s.call(e),u.value="";return}(f=e==null?void 0:e.stopPropagation)==null||f.call(e),P("close")}function Be(e){const l=String((e==null?void 0:e.key)||"");if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter","Escape"].includes(l)&&!(R.value&&(l==="ArrowLeft"||l==="ArrowRight"))){if(l==="ArrowDown"){e.preventDefault(),ve(1);return}if(l==="ArrowUp"){e.preventDefault(),ve(-1);return}if(l==="Escape"){je(e);return}if(R.value){if(l==="Enter"){e.preventDefault();const s=te();s&&Ue(s)}return}if(l==="ArrowRight"){e.preventDefault(),Qe();return}if(l==="ArrowLeft"){e.preventDefault(),Le();return}l==="Enter"&&(e.preventDefault(),ze())}}async function Ie(e,l={}){if(!(!e||e.loading)&&!(e.loaded&&!l.force)){e.loading=!0,S.value="",fe();try{const s=await ut({path:e.path,limit:240});e.children=(s.items||[]).map(f=>Re(f,e.depth+1)),e.loaded=!0}catch(s){S.value=s.message||y("directoryPicker.loadFailed")}finally{e.loading=!1,fe()}}}async function Ee(){p.value=!0,S.value="";try{const e=await ut({limit:240});B.value=String(e.path||""),D.value=Re({name:Ye(e.path||""),path:String(e.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),D.value.children=(e.items||[]).map(l=>Re(l,1)),D.value.loaded=!0,D.value.expanded=!0,J(D.value)}catch(e){S.value=e.message||y("directoryPicker.treeLoadFailed"),D.value=null,B.value=""}finally{p.value=!1}}async function Fe(e=""){const l=String(e||"").trim();if(!l||!B.value||!v(l,B.value))return;let s=D.value;if(!s)return;J(s);const f=ee(B.value,l);for(const W of f){await Ie(s),s.expanded=!0,fe();const se=xe(K(s.path,W),s.children);if(!se)break;s=se,J(s)}}async function Ae(){u.value="",b.value=[],o.value="",A.value=!1,_.value="",await Ee();const e=String(j.initialPath||"").trim();e&&v(e,B.value)&&await Fe(e)}async function ne(e){if(e!=null&&e.path&&(J(e),!!e.hasChildren)){if(!e.loaded){e.expanded=!0,fe(),await Ie(e);return}e.expanded=!e.expanded,fe()}}function Pe(e){e!=null&&e.path&&J(e)}async function Ne(){const e=String(u.value||"").trim();U+=1;const l=U;if(ye(),!j.open||!e||!B.value||!X.value){E.value=!1,o.value="",b.value=[],A.value=!1;return}E.value=!0,o.value="",F=new AbortController;try{const s=await jt(e,{path:B.value,limit:80,signal:F.signal});if(l!==U)return;b.value=Array.isArray(s.items)?s.items:[],A.value=!!s.truncated}catch(s){if(It(s)||l!==U)return;o.value=s.message||y("directoryPicker.searchFailed"),b.value=[],A.value=!1}finally{l===U&&(F=null),l===U&&(E.value=!1)}}function Oe(){if(ye(),!String(u.value||"").trim()||!X.value){E.value=!1,o.value="",b.value=[],A.value=!1;return}E.value=!0,o.value="",V=window.setTimeout(()=>{V=null,Ne()},Mt)}async function Ue(e){e!=null&&e.path&&(await Fe(e.path),u.value="")}function ze(){_.value&&(P("select",_.value),P("close"))}return oe(u,()=>{Oe()}),oe(Z,()=>{Je(),me(be)},{immediate:!0}),oe(()=>j.open,e=>{if(e){Ae().catch(()=>{}),We();return}ye()}),at(()=>{ye()}),(e,l)=>(c(),re(ht,{open:r.open,"stack-level":1,"panel-class":"settings-dialog-panel h-[calc(100dvh-1rem)] max-w-4xl sm:h-[96vh] sm:max-h-[96vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5","close-disabled":p.value||E.value,"close-on-backdrop":!(p.value||E.value),"close-on-escape":!(p.value||E.value),onClose:l[2]||(l[2]=s=>P("close"))},{title:De(()=>[n("div",null,[n("div",en,[I(i(Xe),{class:"h-4 w-4"}),n("span",null,d(i(y)("directoryPicker.title")),1)]),n("p",tn,d(i(y)("directoryPicker.intro")),1)])]),default:De(()=>[n("div",{class:"flex min-h-0 flex-1 flex-col overflow-hidden",onKeydown:Be},[n("div",nn,[n("div",sn,[n("span",an,d(i(y)("directoryPicker.currentSelection")),1),n("span",ln,d(_.value||i(y)("directoryPicker.selectionPlaceholder")),1)])]),n("label",on,[n("span",null,d(i(y)("directoryPicker.searchLabel")),1),n("div",rn,[I(i(zt),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Lt(n("input",{ref_key:"searchInputRef",ref:de,"onUpdate:modelValue":l[0]||(l[0]=s=>u.value=s),type:"text",placeholder:i(y)("directoryPicker.searchPlaceholder"),class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]",onKeydown:Bt(je,["esc"])},null,40,dn),[[Ft,u.value]])])]),n("div",un,[R.value&&o.value?(c(),g("div",cn,d(o.value),1)):!R.value&&S.value?(c(),g("div",fn,d(S.value),1)):R.value&&E.value?(c(),g("div",pn,[I(i(Ge),{class:"h-4 w-4 animate-spin"}),n("span",null,d(i(y)("directoryPicker.searching")),1)])):!R.value&&p.value?(c(),g("div",gn,[I(i(Ge),{class:"h-4 w-4 animate-spin"}),n("span",null,d(i(y)("directoryPicker.treeLoading")),1)])):ge.value?(c(),g("div",vn,d(i(y)("directoryPicker.searchMinKeywordHint",{count:i(dt)})),1)):ae.value?(c(),g("div",mn,d(i(y)("directoryPicker.noSearchResults")),1)):Y.value?(c(),g("div",hn,d(i(y)("directoryPicker.emptyTree")),1)):R.value?(c(),g("div",yn,[(c(!0),g(he,null,Se(b.value,s=>(c(),g("button",{key:s.path,ref_for:!0,ref:f=>Te(s.path,f),type:"button",class:O(["theme-list-row focus:outline-none",m(_.value)===m(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:f=>Ue(s)},[I(i(Xe),{class:"theme-list-item-icon"}),n("div",bn,[n("div",null,[n("span",{class:"theme-list-item-title block break-all",innerHTML:ce(s)},null,8,wn)]),n("div",{class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all",innerHTML:T(s)},null,8,Sn)])],10,xn))),128)),A.value?(c(),g("p",kn,d(i(y)("directoryPicker.truncatedHint")),1)):M("",!0)])):(c(),g("div",Cn,[(c(!0),g(he,null,Se(H.value,s=>(c(),g("div",{key:s.path,ref_for:!0,ref:f=>Te(s.path,f),class:O(["theme-list-tree-item outline-none focus:outline-none focus-visible:outline-none",m(_.value)===m(s.path)?"theme-list-item-active":s.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:Nt({paddingLeft:`${s.depth*16+6}px`})},[n("div",_n,[n("button",{type:"button",class:O(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:nt(f=>ne(s),["stop"])},[s.loading?(c(),re(i(Ge),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(c(),re(i(Ht),{key:1,class:O(["h-3.5 w-3.5 transition",s.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,$n),n("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:f=>Pe(s)},[I(i(Xe),{class:O(["h-4 w-4 shrink-0",m(_.value)===m(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),n("div",jn,[n("div",{class:O(["theme-list-item-title truncate",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},d(ke(s)),3),s.isHomeRoot?(c(),g("div",In,d(s.path),1)):M("",!0)])],8,Mn)])],6))),128))]))])],32),n("div",En,[n("div",An,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:p.value||E.value,onClick:l[1]||(l[1]=s=>P("close"))},d(i(y)("directoryPicker.cancel")),9,Pn),n("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:p.value||E.value||!_.value,onClick:ze},[I(i(st),{class:"h-4 w-4"}),n("span",null,d(i(y)("directoryPicker.useCurrentDirectory")),1)],8,Dn)])])]),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"]))}},Tn={class:"grid gap-4"},Ln={class:"theme-muted-text block text-xs"},Bn=["value","disabled"],Fn={class:"theme-muted-text block text-xs"},Nn={class:"mt-1 flex gap-2"},On={class:"relative min-w-0 flex-1"},Un=["value","disabled"],zn=["disabled"],Hn=["disabled"],Kn={id:"codex-manager-workspace-suggestions"},qn=["value"],Vn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},Wn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},Qn={class:"theme-muted-text block text-xs"},Gn={class:"mt-1"},Xn={class:"flex items-center gap-2 text-sm"},Yn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Jn=["disabled","onClick"],Zn={class:"flex items-center justify-between gap-3"},es={class:"min-w-0 flex-1 truncate"},ts={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},ns={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},ss={class:"theme-muted-text block text-xs"},as={class:"mt-2 grid gap-2"},is=["disabled","onClick"],ls={class:"min-w-0"},os={class:"text-sm text-[var(--theme-textPrimary)]"},rs={class:"theme-muted-text mt-0.5 text-[11px] leading-5"},ds={class:"theme-muted-text mt-2 text-[11px] leading-5"},us={class:"theme-muted-text block text-xs"},cs={class:"mt-1 flex gap-2"},fs=["value","disabled"],ps=["disabled"],gs={key:1,class:"theme-popover theme-divider absolute left-0 right-0 top-[calc(100%+0.375rem)] z-20 overflow-hidden rounded-sm border border-solid shadow-sm"},vs={class:"flex items-center justify-between gap-2 border-b border-solid px-3 py-2 text-[11px] leading-5"},ms={class:"font-medium text-[var(--theme-textPrimary)]"},hs={key:0,class:"theme-muted-text"},ys={key:0,class:"max-h-72 overflow-y-auto p-2"},xs=["disabled","onClick"],bs={class:"flex min-w-0 items-center justify-between gap-3"},ws={class:"min-w-0 flex-1 truncate text-xs font-medium text-[var(--theme-textPrimary)]"},Ss={class:"shrink-0 text-[11px] leading-4 text-[var(--theme-textMuted)]"},ks={key:1,class:"theme-empty-state px-3 py-4 text-xs"},Cs=["disabled"],_s={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},$s={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},vt={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},agentEngines:{type:Array,default:()=>[]},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},canEditSessionId:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},sessionId:{type:String,default:""},sessionIdCopied:{type:Boolean,default:!1},sessionIdReadonlyMessage:{type:String,default:""},sessionCandidates:{type:Array,default:()=>[]},sessionCandidatesLoading:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["copy-session-id","open-directory-picker","select-session-candidate","update:agentEngines","update:cwd","update:engine","update:sessionId","update:title"],setup(r,{emit:q}){const j=r,P=q,{t:y}=Ve(),B=$(null),D=$(null),p=$(!1),S=$(-1),E=C(()=>{const h=String(j.engine||"").trim();return j.engineOptions.find(m=>String((m==null?void 0:m.value)||"").trim()===h)||null}),o=C(()=>{const h=Array.isArray(j.agentEngines)?j.agentEngines:[];return[...new Set(h.map(m=>String(m||"").trim()).filter(Boolean))]}),b=C(()=>j.engineOptions.filter(h=>String((h==null?void 0:h.value)||"").trim()!==String(j.engine||"").trim())),A=C(()=>!!String(j.cwd||"").trim()),u=C(()=>String(j.sessionId||"").trim()),_=C(()=>u.value.toLowerCase()),de=C(()=>j.sessionCandidates.filter(h=>h==null?void 0:h.matchedCwd)),V=C(()=>{const h=_.value,m=de.value;return h?m.filter(v=>[v==null?void 0:v.label,v==null?void 0:v.id,v==null?void 0:v.cwd].map(ee=>String(ee||"").toLowerCase()).some(ee=>ee.includes(h))).slice(0,10):m.slice(0,10)});function U(){j.busy||!j.canEditSessionId||!A.value||(p.value=!0)}function F(){p.value=!1,S.value=-1}function z(){const h=V.value;if(!h.length){S.value=-1;return}const m=h.findIndex(v=>v.id===u.value);S.value=m>=0?m:0}function H(){me(()=>{var h,m;(m=(h=D.value)==null?void 0:h.focus)==null||m.call(h)})}function G(){if(p.value){F();return}U(),H()}function X(){P("update:cwd","")}function R(h){if(!j.canEditEngine||j.busy)return;const m=String(h||"").trim(),v=o.value.includes(m)?o.value.filter(K=>K!==m):[...o.value,m];P("update:agentEngines",v)}function Q(){P("update:sessionId",""),F(),H()}function Z(h){var m;P("update:sessionId",((m=h==null?void 0:h.target)==null?void 0:m.value)||""),A.value&&U()}function ge(h){P("select-session-candidate",h),F(),H()}function ae(h){if(j.busy||!j.canEditSessionId||!A.value)return;const m=V.value;if(h.key==="ArrowDown"){if(h.preventDefault(),!p.value){U(),z();return}if(!m.length)return;S.value=S.value<0?0:Math.min(m.length-1,S.value+1);return}if(h.key==="ArrowUp"){if(h.preventDefault(),!p.value){U(),z();return}if(!m.length)return;S.value=S.value<0?m.length-1:Math.max(0,S.value-1);return}if(h.key==="Enter"&&p.value&&m.length&&S.value>=0){h.preventDefault(),ge(m[S.value]);return}h.key==="Escape"&&p.value&&(h.preventDefault(),F())}function Y(h){!p.value||!B.value||B.value.contains(h.target)||F()}return oe(V,()=>{z()}),oe(()=>j.canEditSessionId,h=>{(!h||!A.value)&&F()}),oe(A,h=>{h||F()}),Ot(()=>{document.addEventListener("pointerdown",Y)}),at(()=>{document.removeEventListener("pointerdown",Y)}),(h,m)=>(c(),g("div",Tn,[n("label",Ln,[n("span",null,d(i(y)("projectManager.projectTitleOptional")),1),n("input",{value:r.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:r.busy,onInput:m[0]||(m[0]=v=>P("update:title",v.target.value))},null,40,Bn)]),n("label",Fn,[n("span",null,d(i(y)("projectManager.workingDirectoryField")),1),n("div",Nn,[n("div",On,[n("input",{value:r.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:O(["tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",r.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:r.busy||!r.canEditCwd,onInput:m[1]||(m[1]=v=>P("update:cwd",v.target.value))},null,42,Un),r.cwd&&r.canEditCwd?(c(),g("button",{key:0,type:"button",class:"theme-muted-text absolute right-2 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm transition hover:bg-[var(--theme-appPanelHover)] hover:text-[var(--theme-textPrimary)]",disabled:r.busy,onClick:X},[I(i(pt),{class:"h-3.5 w-3.5"})],8,zn)):M("",!0)]),n("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:r.busy||!r.canEditCwd,onClick:m[2]||(m[2]=v=>P("open-directory-picker"))},[I(i(Xe),{class:"h-4 w-4"}),n("span",null,d(r.mobile?i(y)("projectManager.choose"):i(y)("projectManager.chooseDirectory")),1)],8,Hn)]),n("datalist",Kn,[(c(!0),g(he,null,Se(r.workspaceSuggestions,v=>(c(),g("option",{key:v,value:v},null,8,qn))),128))]),r.duplicateCwdMessage?(c(),g("p",Vn,d(r.duplicateCwdMessage),1)):r.cwdReadonlyMessage?(c(),g("p",Wn,d(r.cwdReadonlyMessage),1)):M("",!0)]),n("label",Qn,[n("span",null,d(i(y)("projectManager.engineField")),1),n("div",Gn,[I(Et,{"model-value":r.engine,options:r.engineOptions,disabled:r.busy||!r.canEditEngine,placeholder:i(y)("projectManager.selectEngine"),"empty-text":i(y)("projectManager.noEngines"),"get-option-value":v=>(v==null?void 0:v.value)||"","onUpdate:modelValue":m[3]||(m[3]=v=>P("update:engine",v))},{trigger:De(({disabled:v})=>{var K;return[n("div",Xn,[n("span",{class:O(["min-w-0 flex-1 truncate",v?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},d(((K=E.value)==null?void 0:K.label)||i(y)("projectManager.selectEngine")),3),E.value&&E.value.enabled===!1?(c(),g("span",Yn,d(i(y)("projectManager.comingSoon")),1)):M("",!0)])]}),option:De(({option:v,selected:K,select:ee})=>[n("button",{type:"button",class:O(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",K?"theme-filter-active":"theme-filter-idle"]),disabled:(v==null?void 0:v.enabled)===!1,onClick:ee},[n("div",Zn,[n("span",es,d(v.label),1),(v==null?void 0:v.enabled)===!1?(c(),g("span",ts,d(i(y)("projectManager.comingSoon")),1)):M("",!0)])],10,Jn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),r.engineReadonlyMessage?(c(),g("p",ns,d(r.engineReadonlyMessage),1)):M("",!0)]),n("div",ss,[n("span",null,d(i(y)("projectManager.collaborationAgents")),1),n("div",as,[(c(!0),g(he,null,Se(b.value,v=>(c(),g("button",{key:v.value,type:"button",class:O(["theme-list-row flex items-center justify-between gap-3 rounded-sm border border-solid px-3 py-2 text-left transition",o.value.includes(v.value)?"theme-list-item-active":"theme-list-item-hover"]),disabled:r.busy||!r.canEditEngine,onClick:K=>R(v.value)},[n("div",ls,[n("div",os,d(v.label),1),n("div",rs,d(o.value.includes(v.value)?i(y)("projectManager.agentEnabled"):i(y)("projectManager.agentDisabled")),1)]),o.value.includes(v.value)?(c(),re(i(st),{key:0,class:"h-4 w-4 shrink-0 text-[var(--theme-textPrimary)]"})):M("",!0)],10,is))),128))]),n("p",ds,d(i(y)("projectManager.collaborationAgentsHint")),1)]),n("label",us,[n("span",null,d(i(y)("projectManager.sessionId")),1),n("div",cs,[n("div",{ref_key:"sessionComboboxRef",ref:B,class:"relative min-w-0 flex-1"},[n("input",{ref_key:"sessionInputRef",ref:D,value:r.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",disabled:r.busy||!r.canEditSessionId,onFocus:U,onInput:Z,onKeydown:ae},null,40,fs),r.canEditSessionId?(c(),g("button",{key:0,type:"button",class:"theme-muted-text absolute right-2 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-sm transition hover:bg-[var(--theme-appPanelHover)] hover:text-[var(--theme-textPrimary)]",disabled:r.busy||!A.value,onClick:G},[r.sessionCandidatesLoading?(c(),re(i(Ge),{key:0,class:"h-3.5 w-3.5 animate-spin"})):u.value?(c(),re(i(pt),{key:1,class:"h-3.5 w-3.5",onClick:nt(Q,["stop"])})):(c(),re(i(Kt),{key:2,class:O(["h-3.5 w-3.5 transition",p.value?"rotate-180":""])},null,8,["class"]))],8,ps)):M("",!0),r.canEditSessionId&&p.value?(c(),g("div",gs,[n("div",vs,[n("span",ms,d(i(y)("projectManager.sessionCandidates")),1),r.sessionCandidatesLoading?(c(),g("span",hs,d(i(y)("projectManager.sessionCandidatesLoading")),1)):M("",!0)]),V.value.length?(c(),g("div",ys,[(c(!0),g(he,null,Se(V.value,(v,K)=>(c(),g("button",{key:`${v.engine}:${v.id}`,type:"button",class:O(["theme-list-row mb-1 w-full px-2 py-1.5 text-left last:mb-0",K===S.value?"theme-list-item-active":"theme-list-item-hover"]),disabled:r.busy,onMousedown:m[4]||(m[4]=nt(()=>{},["prevent"])),onClick:ee=>ge(v)},[n("div",bs,[n("span",ws,d(v.label||v.id),1),n("span",Ss,d(v.updatedAtLabel||i(y)("projectManager.unknown")),1)])],42,xs))),128))])):(c(),g("div",ks,d(A.value?i(y)("projectManager.noSessionCandidates"):i(y)("projectManager.sessionCandidatesNeedDirectory")),1))])):M("",!0)],512),u.value?(c(),g("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:r.busy,onClick:m[5]||(m[5]=v=>P("copy-session-id"))},[r.sessionIdCopied?(c(),re(i(st),{key:0,class:"h-4 w-4"})):(c(),re(i(qt),{key:1,class:"h-4 w-4"})),n("span",null,d(r.sessionIdCopied?i(y)("projectManager.sessionIdCopied"):i(y)("projectManager.copySessionId")),1)],8,Cs)):M("",!0)]),r.sessionIdReadonlyMessage?(c(),g("p",_s,d(r.sessionIdReadonlyMessage),1)):(c(),g("p",$s,d(A.value?i(y)("projectManager.sessionIdHint"):i(y)("projectManager.sessionCandidatesNeedDirectory")),1))])]))}},Ms={class:"flex items-center justify-between gap-3"},js={class:"theme-heading text-sm font-medium"},Is={key:0,class:"theme-muted-text mt-1 text-xs"},Es=["disabled"],As=["onClick"],Ps={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Ds={class:"flex w-full flex-col gap-2 text-left"},Rs={class:"theme-heading min-w-0 text-sm font-medium"},Ts=["title"],Ls=["title"],Bs={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Fs={key:0,"aria-hidden":"true"},Ns={key:1},Os={class:"flex flex-wrap items-center gap-2 pt-1"},Us={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},mt={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:r=>r},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(r,{emit:q}){const j=r,P=q,{t:y}=Ve();function B(S){return j.mode==="edit"&&j.editingSessionId===S.id?"theme-card-selected":j.isSessionRunning(S.id)?"theme-card-warning":"theme-card-idle-strong"}function D(S){return j.isCurrentSession(S.id)?y("projectManager.current"):y("projectManager.regular")}function p(S){return j.isCurrentSession(S.id)?"theme-status-info":"theme-status-neutral"}return(S,E)=>(c(),g("div",{class:O(r.mobile?"flex h-full min-h-0 flex-col":"")},[n("div",Ms,[n("div",null,[n("div",js,d(i(y)("projectManager.projectList")),1),r.hasSessions?M("",!0):(c(),g("p",Is,d(i(y)("projectManager.noProjects")),1))]),n("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:r.busy,onClick:E[0]||(E[0]=o=>P("create"))},[I(i(Vt),{class:"h-4 w-4"}),n("span",null,d(i(y)("projectManager.create")),1)],8,Es)]),n("div",{class:O(["mt-4 space-y-2",r.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(c(!0),g(he,null,Se(r.sessions,o=>{var b;return c(),g("article",{key:o.id,class:O(["relative cursor-pointer rounded-sm border p-3 transition",B(o)]),onClick:A=>P("select",o.id)},[r.mode==="edit"&&r.editingSessionId===o.id?(c(),g("span",Ps)):M("",!0),n("div",Ds,[n("div",Rs,[n("span",{class:"block truncate",title:o.title||i(y)("projectManager.untitledProject")},d(o.title||i(y)("projectManager.untitledProject")),9,Ts)]),n("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:o.cwd},d(o.cwd),9,Ls),n("div",Bs,[n("span",null,d(((b=o==null?void 0:o.agentBindings)==null?void 0:b.length)>1?i(y)("projectManager.agentCount",{count:o.agentBindings.length}):i(tt)(o.engine)),1),r.mobile?M("",!0):(c(),g("span",Fs,"·")),r.mobile?M("",!0):(c(),g("span",Ns,d(r.formatUpdatedAt(o.updatedAt)),1))]),n("div",Os,[n("span",{class:O(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",p(o)])},d(D(o)),3),n("span",{class:O(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",r.getRuntimeStatusClass(o.id)])},[r.isSessionRunning(o.id)?(c(),g("span",Us)):M("",!0),yt(" "+d(r.getRuntimeStatusLabel(o.id)),1)],2),n("span",{class:O(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",r.getThreadStatusClass(o)])},d(r.getThreadStatusLabel(o)),3)])])],10,As)}),128))],2)],2))}},zs={class:"space-y-3"},Hs={class:"dashed-panel px-3 py-3"},Ks={class:"theme-muted-text text-[11px]"},qs={class:"mt-2 flex flex-wrap gap-2"},Vs={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},Ws={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},Qs={class:"dashed-panel px-3 py-3"},Gs={class:"theme-muted-text text-[11px]"},Xs={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Ys={key:0,class:"mt-2 flex flex-wrap gap-1.5"},Js={class:"dashed-panel px-3 py-3"},Zs={class:"theme-muted-text text-[11px]"},ea={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},ta={class:"dashed-panel px-3 py-3"},na={class:"theme-muted-text text-[11px]"},sa={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},aa={class:"dashed-panel px-3 py-3"},ia={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},la={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},oa={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:r=>r},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(r){const{t:q}=Ve();return(j,P)=>{var y,B,D,p,S,E,o,b,A;return c(),g("div",zs,[n("div",Hs,[n("div",Ks,d(i(q)("projectManager.runtimeStatus")),1),n("div",qs,[n("span",{class:O(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",r.getRuntimeStatusClass((y=r.activeSession)==null?void 0:y.id)])},[r.isSessionRunning((B=r.activeSession)==null?void 0:B.id)?(c(),g("span",Vs)):M("",!0),yt(" "+d(r.getRuntimeStatusLabel((D=r.activeSession)==null?void 0:D.id)),1)],2),n("span",{class:O(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",r.getThreadStatusClass(r.activeSession)])},d(r.getThreadStatusLabel(r.activeSession)),3),(p=r.activeSession)!=null&&p.id&&r.isCurrentSession(r.activeSession.id)?(c(),g("span",Ws,d(i(q)("projectManager.currentProject")),1)):M("",!0)])]),n("div",Qs,[n("div",Gs,d(i(q)("projectManager.engine")),1),n("div",Xs,d(i(tt)((S=r.activeSession)==null?void 0:S.engine)),1),((o=(E=r.activeSession)==null?void 0:E.agentBindings)==null?void 0:o.length)>1?(c(),g("div",Ys,[(c(!0),g(he,null,Se(r.activeSession.agentBindings,u=>(c(),g("span",{key:u.engine,class:"theme-status-neutral inline-flex items-center rounded-sm border border-solid px-1.5 py-0.5 text-[10px]"},d(i(tt)(u.engine)),1))),128))])):M("",!0)]),n("div",Js,[n("div",Zs,d(i(q)("projectManager.workingDirectory")),1),n("div",ea,d(((b=r.activeSession)==null?void 0:b.cwd)||i(q)("projectManager.notSet")),1)]),n("div",ta,[n("div",na,d(i(q)("projectManager.updatedAt")),1),n("div",sa,d(r.formatUpdatedAt((A=r.activeSession)==null?void 0:A.updatedAt)),1)]),n("div",aa,[n("div",ia,[I(i(Wt),{class:"h-3.5 w-3.5"}),n("span",null,d(i(q)("projectManager.note")),1)]),n("p",la,d(i(q)("projectManager.noteDescription")),1)])])}}},ra={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},da={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},ua={class:"theme-divider theme-muted-panel border-b px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},ca={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},fa={class:"flex flex-wrap items-start justify-between gap-3"},pa={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ga={class:"mt-5"},va={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},ma={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},ha={class:"flex flex-wrap items-center gap-2"},ya=["disabled"],xa=["disabled"],ba=["disabled"],wa={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Sa=["disabled"],ka=["disabled"],Ca=["disabled"],_a={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},$a={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ma={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},ja={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ia={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Ea=["disabled"],Aa={class:"min-w-0 flex-1"},Pa={class:"theme-heading truncate text-sm font-medium"},Da={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Ra={class:"theme-divider border-b px-4 py-3"},Ta={class:"grid grid-cols-2 gap-2"},La=["disabled"],Ba={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Fa={key:0},Na={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Oa={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ua=["disabled"],za=["disabled"],Ha=["disabled"],Ka=["disabled"],qa=3e3,Za={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null},onReset:{type:Function,default:null}},emits:["close","project-created","select-session","open-source-browser"],setup(r,{expose:q,emit:j}){const P=new Map;function y(t="",a=""){const x=qe(t),k=et(a);return!x||!k?"":`${x}
2
2
  ${k}`}function B(t=""){if(!t)return null;const a=P.get(t);return a?a.expiresAt<=Date.now()?(P.delete(t),null):Array.isArray(a.items)?a.items:[]:null}function D(t="",a=[]){t&&P.set(t,{expiresAt:Date.now()+qa,items:Array.isArray(a)?a:[]})}const p=r,S=j,{locale:E,t:o}=Ve(),b=$("edit"),A=$(""),u=Ut({title:"",engine:"codex",agentEngines:[],cwd:"",sessionId:""}),_=$(""),de=$(!1),V=$(!1),U=$(!1),F=$(!1),z=$(!1),H=$(!1),G=$(!1),X=$(!1),{matches:R}=At("(max-width: 767px)"),Q=$("list"),Z=$("basic"),ge=$(ct()),ae=$([]),Y=$(!1);let h=null,m=null,v=null,K=0;const ee=C(()=>Qe(p.sessions)),w=C(()=>p.sessions.find(t=>t.id===A.value)||null),ke=C(()=>p.sessions.length>0),Ye=C(()=>p.sessions.find(t=>t.id===p.selectedSessionId)||null),ue=C(()=>!!(w.value&&te(w.value.id))),Ce=C(()=>{var t;return!((t=w.value)!=null&&t.started)}),_e=C(()=>{var t;return!((t=w.value)!=null&&t.started)}),ce=C(()=>{var t;return!((t=w.value)!=null&&t.started)}),T=C(()=>p.loading||de.value||V.value||U.value||F.value),Re=C(()=>String(u.sessionId||"").trim()),$e=C(()=>{var x,k;const t=new Set,a=[];return[u.cwd,(x=w.value)==null?void 0:x.cwd,(k=Ye.value)==null?void 0:k.cwd,...p.workspaces,...p.sessions.map(N=>N.cwd)].forEach(N=>{const L=String(N||"").trim();!L||t.has(L)||(t.add(L),a.push(L))}),a.slice(0,12)}),fe=C(()=>ge.value),ye=C(()=>ae.value.map(t=>({...t,updatedAtLabel:t.updatedAt?Ee(t.updatedAt):""}))),xe=C(()=>{const t=et(u.cwd);return t?p.sessions.filter(a=>{var x;return a.id===((x=w.value)==null?void 0:x.id)?!1:et(a.cwd)===t}):[]}),J=C(()=>{if(!xe.value.length)return"";const t=xe.value.slice(0,3).map(a=>{const x=a.title||o("projectManager.untitledProject");return E.value==="en-US"?`"${x}"`:`「${x}」`}).join(E.value==="en-US"?", ":"、");return o("projectManager.duplicateDirectory",{labels:t,count:xe.value.length})}),pe=C(()=>b.value!=="edit"||Ce.value?"":o("projectManager.cwdReadonly")),Te=C(()=>b.value!=="edit"||!w.value||_e.value?"":o("projectManager.engineReadonly")),be=C(()=>b.value!=="edit"||!w.value||ce.value?"":o("projectManager.sessionIdReadonly")),We=C(()=>b.value==="create"?de.value?o("projectManager.creatingProject"):o("projectManager.createProject"):V.value?o("projectManager.savingChanges"):o("projectManager.saveChanges")),Je=C(()=>{var t;return b.value==="create"?o("projectManager.newProject"):((t=w.value)==null?void 0:t.title)||o("projectManager.untitledProject")});function Me(t=""){const a=Date.parse(String(t||""));return Number.isFinite(a)?a:0}function te(t){var a;return!!((a=p.sessions.find(x=>x.id===t))!=null&&a.running)}function ve(t){return!!t&&t===p.selectedSessionId}function Qe(t=[]){return[...t].sort((a,x)=>{const k=Number(te(x.id))-Number(te(a.id));if(k)return k;const N=Number(ve(x.id))-Number(ve(a.id));if(N)return N;const L=Me(x.updatedAt)-Me(a.updatedAt);return L||Tt(String(a.title||a.cwd||a.id),String(x.title||x.cwd||x.id))})}function Le(t){return te(t)?o("projectManager.running"):o("projectManager.idle")}function je(t){return te(t)?"theme-status-warning":"theme-status-success"}function Be(t){return t!=null&&t.started?o("projectManager.threadBound"):o("projectManager.notStarted")}function Ie(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function Ee(t=""){if(!t)return o("projectManager.unknown");const a=new Date(t);return Number.isNaN(a.getTime())?t:Rt(a.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Fe(t){u.title=String((t==null?void 0:t.title)||""),u.engine=qe(t==null?void 0:t.engine),u.agentEngines=(Array.isArray(t==null?void 0:t.agentBindings)?t.agentBindings:[]).map(a=>qe(a==null?void 0:a.engine)).filter(a=>a&&a!==u.engine),u.cwd=String((t==null?void 0:t.cwd)||""),u.sessionId=String((t==null?void 0:t.sessionId)||(t==null?void 0:t.engineSessionId)||(t==null?void 0:t.engineThreadId)||(t==null?void 0:t.codexThreadId)||"").trim()}function Ae(){b.value="create",A.value="",_.value="",u.title="",u.engine="codex",u.agentEngines=[],u.cwd="",u.sessionId=""}function ne(t){const a=p.sessions.find(x=>x.id===t);a&&(b.value="edit",A.value=a.id,_.value="",Fe(a))}function Pe(){var t;return p.selectedSessionId&&p.sessions.some(a=>a.id===p.selectedSessionId)?p.selectedSessionId:((t=ee.value[0])==null?void 0:t.id)||""}function Ne(t="basic"){Q.value="detail",Z.value=t}function Oe(){Q.value="list",Z.value="basic"}function Ue(){Ae(),R.value&&Ne("basic")}function ze(t){T.value||(ne(t),R.value&&Ne("basic"))}function e(t){u.cwd=String(t||"").trim()}async function l(){var a,x;const t=((a=w.value)==null?void 0:a.id)||Pe();return!t||((!w.value||w.value.id!==t)&&(ne(t),await me()),!((x=w.value)!=null&&x.cwd))?!1:(R.value&&Ne("basic"),S("open-source-browser",w.value),S("close"),!0)}function s(){return z.value?(z.value=!1,!0):H.value?(H.value=!1,!0):G.value?(G.value=!1,!0):p.open?(S("close"),!0):!1}function f(t){u.title=String(t||"")}function W(t){u.engine=qe(t),u.agentEngines=u.agentEngines.filter(a=>a!==u.engine)}function se(t){u.agentEngines=[...new Set((Array.isArray(t)?t:[]).map(a=>qe(a)).filter(a=>a&&a!==u.engine))]}function we(t){u.cwd=String(t||"")}function ie(t){u.sessionId=String(t||"")}function le(t){u.sessionId=String((t==null?void 0:t.id)||"").trim()}function He(){_.value="",z.value=!1,H.value=!1,X.value=!1,Z.value="basic",Q.value=R.value?"list":"detail";const t=Pe();if(t){ne(t);return}Ae()}async function xt(){if(!(T.value||typeof p.onRefresh!="function")){_.value="";try{await Promise.all([p.onRefresh(),it()])}catch(t){_.value=t.message}}}async function it(){try{ge.value=await Pt()}catch{ge.value=ct()}}function Ze(){m&&(clearTimeout(m),m=null)}function Ke(){v&&(v.abort(),v=null)}async function bt(){const t=String(u.cwd||"").trim();if(!p.open||!ce.value||!t){ae.value=[],Y.value=!1,Ke();return}const a=++K;Ke();const x=y(u.engine,t),k=B(x);if(k){ae.value=k,Y.value=!1;return}v=new AbortController,Y.value=!0;try{const N=await Dt({engine:u.engine,cwd:t,limit:50,signal:v.signal});if(a!==K)return;const L=Array.isArray(N==null?void 0:N.items)?N.items:[];ae.value=L,D(x,L)}catch(N){if((N==null?void 0:N.name)==="AbortError")return;a===K&&(ae.value=[])}finally{a===K&&(Y.value=!1,v=null)}}function lt(t=250){if(Ze(),!p.open||!ce.value||!String(u.cwd||"").trim()){ae.value=[],Y.value=!1,Ke();return}m=setTimeout(()=>{m=null,bt().catch(()=>{})},t)}async function wt(t){var x;if((x=navigator.clipboard)!=null&&x.writeText&&window.isSecureContext){await navigator.clipboard.writeText(t);return}const a=document.createElement("textarea");a.value=t,a.setAttribute("readonly","true"),a.style.position="fixed",a.style.opacity="0",a.style.pointerEvents="none",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}async function ot(){const t=Re.value;if(t)try{await wt(t),X.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{X.value=!1,h=null},1800)}catch(a){_.value=(a==null?void 0:a.message)||o("projectManager.copySessionIdFailed")}}async function rt(){if(!T.value){_.value="";try{const t=St();if(!t)return;await kt(t)}catch(t){_.value=t.message}}}function St(){if(b.value==="create"){const a=String(u.cwd||"").trim();return a?{type:"create",cwd:a,payload:{title:u.title,engine:u.engine,agentEngines:[u.engine,...u.agentEngines],cwd:a,sessionId:String(u.sessionId||"").trim()}}:(_.value=o("projectManager.directoryRequired"),null)}if(!w.value)return _.value=o("projectManager.projectMissing"),null;const t={title:u.title,engine:u.engine,agentEngines:[u.engine,...u.agentEngines]};return Ce.value&&(t.cwd=u.cwd),ce.value&&(t.sessionId=String(u.sessionId||"").trim()),{type:"update",sessionId:w.value.id,payload:t}}async function kt(t){var a,x;if(t.type==="create"){de.value=!0;try{const k=await((a=p.onCreate)==null?void 0:a.call(p,t.payload));k!=null&&k.id&&(ne(k.id),S("select-session",k.id),await me(),S("project-created",k),S("close"));return}finally{de.value=!1}}V.value=!0;try{const k=await((x=p.onUpdate)==null?void 0:x.call(p,t.sessionId,t.payload));k!=null&&k.id&&ne(k.id)}finally{V.value=!1}}async function Ct(){var a,x;if(!w.value||U.value)return;const t=w.value.id;_.value="",U.value=!0;try{const k=await((a=p.onDelete)==null?void 0:a.call(p,t));z.value=!1;const N=p.sessions.filter($t=>$t.id!==t),L=(k==null?void 0:k.selectedSessionId)||((x=Qe(N)[0])==null?void 0:x.id)||"";S("select-session",L),L?(ne(L),R.value&&Oe()):(Ae(),R.value&&Oe())}catch(k){_.value=k.message}finally{U.value=!1}}async function _t(){var a;if(!w.value||F.value)return;const t=w.value.id;_.value="",F.value=!0;try{const x=await((a=p.onReset)==null?void 0:a.call(p,t));H.value=!1;const k=(x==null?void 0:x.session)||p.sessions.find(N=>N.id===t)||null;k!=null&&k.id&&ne(k.id)}catch(x){_.value=x.message}finally{F.value=!1}}return oe(()=>p.open,t=>{if(t){He(),typeof p.onRefresh=="function"?xt().catch(()=>{}):it().catch(()=>{});return}G.value=!1,z.value=!1,H.value=!1,X.value=!1,_.value="",Ze(),Ke(),ae.value=[],Y.value=!1},{immediate:!0}),oe(R,t=>{t||(Q.value="detail")},{immediate:!0}),oe(()=>p.sessions,()=>{if(!p.open)return;if(b.value==="create"){if(!!(String(u.title||"").trim()||String(u.cwd||"").trim())||!!String(u.sessionId||"").trim())return;const x=Pe();x&&ne(x);return}if(w.value){Fe(w.value);return}const t=Pe();if(t){ne(t);return}Ae()}),oe(()=>[p.open,b.value,u.engine,u.cwd,ce.value].join(`
3
3
  `),()=>{lt(250)},{immediate:!0}),oe(()=>{var t;return((t=w.value)==null?void 0:t.id)||""},()=>{lt(0)}),at(()=>{h&&(clearTimeout(h),h=null),Ze(),Ke()}),q({closeTopDialog:s}),(t,a)=>(c(),g(he,null,[I(ft,{open:H.value,title:i(o)("projectManager.confirmResetTitle"),description:w.value?i(o)("projectManager.confirmResetDescription",{title:w.value.title||i(o)("projectManager.untitledProject")}):"","confirm-text":i(o)("projectManager.confirmReset"),"cancel-text":i(o)("projectManager.keep"),loading:F.value,onCancel:a[0]||(a[0]=x=>H.value=!1),onConfirm:_t},null,8,["open","title","description","confirm-text","cancel-text","loading"]),I(ft,{open:z.value,title:i(o)("projectManager.confirmDeleteTitle"),description:w.value?i(o)("projectManager.confirmDeleteDescription",{title:w.value.title||i(o)("projectManager.untitledProject")}):"","confirm-text":i(o)("projectManager.confirmDelete"),"cancel-text":i(o)("projectManager.keep"),loading:U.value,danger:"",onCancel:a[1]||(a[1]=x=>z.value=!1),onConfirm:Ct},null,8,["open","title","description","confirm-text","cancel-text","loading"]),I(Rn,{open:G.value,"initial-path":u.cwd,suggestions:$e.value,onClose:a[2]||(a[2]=x=>G.value=!1),onSelect:e},null,8,["open","initial-path","suggestions"]),I(ht,{open:r.open,"panel-class":"settings-dialog-panel h-[calc(100dvh-1rem)] max-w-5xl sm:h-[96vh] sm:max-h-[96vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 overflow-hidden","close-disabled":T.value,"close-on-backdrop":!T.value,"close-on-escape":!T.value,onClose:a[12]||(a[12]=x=>S("close"))},{title:De(()=>[n("div",ra,[I(i(Zt),{class:"h-4 w-4"}),n("span",null,d(i(o)("projectManager.managingTitle")),1)])]),default:De(()=>{var x,k,N;return[i(R)?(c(),g("div",_a,[Q.value==="list"?(c(),g("div",$a,[n("div",Ma,[I(mt,{mobile:"",busy:T.value,"editing-session-id":A.value,"format-updated-at":Ee,"get-runtime-status-class":je,"get-runtime-status-label":Le,"get-thread-status-class":Ie,"get-thread-status-label":Be,"has-sessions":ke.value,"is-current-session":ve,"is-session-running":te,mode:b.value,sessions:ee.value,onCreate:Ue,onSelect:ze},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(c(),g("div",ja,[n("div",Ia,[n("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:T.value,onClick:Oe},[I(i(Jt),{class:"h-4 w-4"}),n("span",null,d(i(o)("projectManager.projectList")),1)],8,Ea),n("div",Aa,[n("div",Pa,d(Je.value),1),b.value==="edit"&&((k=w.value)!=null&&k.cwd)?(c(),g("p",Da,d(w.value.cwd),1)):M("",!0)])]),n("div",Ra,[n("div",Ta,[n("button",{type:"button",class:O(["tool-button px-3 py-2 text-sm",Z.value==="basic"?"tool-button-accent-subtle":""]),onClick:a[7]||(a[7]=L=>Z.value="basic")},d(i(o)("projectManager.basicInfo")),3),n("button",{type:"button",class:O(["tool-button px-3 py-2 text-sm",Z.value==="status"?"tool-button-accent-subtle":""]),disabled:b.value==="create",onClick:a[8]||(a[8]=L=>Z.value="status")},d(i(o)("projectManager.status")),11,La)])]),n("div",Ba,[Z.value==="basic"?(c(),g("div",Fa,[I(vt,{mobile:"",busy:T.value,"can-edit-engine":b.value!=="edit"||_e.value,"can-edit-cwd":b.value!=="edit"||Ce.value,"can-edit-session-id":b.value!=="edit"||ce.value,cwd:u.cwd,"cwd-readonly-message":pe.value,"duplicate-cwd-message":J.value,engine:u.engine,"agent-engines":u.agentEngines,"engine-options":fe.value,"engine-readonly-message":Te.value,"session-candidates":ye.value,"session-candidates-loading":Y.value,"session-id":u.sessionId,"session-id-copied":X.value,"session-id-readonly-message":be.value,title:u.title,"workspace-suggestions":$e.value,onCopySessionId:ot,onOpenDirectoryPicker:a[9]||(a[9]=L=>G.value=!0),onSelectSessionCandidate:le,"onUpdate:cwd":we,"onUpdate:engine":W,"onUpdate:agentEngines":se,"onUpdate:sessionId":ie,"onUpdate:title":f},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","agent-engines","engine-options","engine-readonly-message","session-candidates","session-candidates-loading","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"]),_.value?(c(),g("p",Na,[I(i(gt),{class:"h-4 w-4"}),n("span",null,d(_.value),1)])):M("",!0),n("div",Oa,[n("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:T.value,onClick:rt},d(We.value),9,Ua),b.value==="edit"&&w.value?(c(),g("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:T.value||!((N=w.value)!=null&&N.cwd),onClick:l},d(i(o)("projectManager.viewSource")),9,za)):M("",!0),b.value==="edit"&&w.value?(c(),g("button",{key:1,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:T.value||ue.value,onClick:a[10]||(a[10]=L=>H.value=!0)},d(F.value?i(o)("projectManager.resettingSession"):i(o)("projectManager.newSession")),9,Ha)):M("",!0),b.value==="edit"&&w.value?(c(),g("button",{key:2,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:T.value||ue.value,onClick:a[11]||(a[11]=L=>z.value=!0)},d(U.value?i(o)("projectManager.deletingProject"):i(o)("projectManager.deleteProject")),9,Ka)):M("",!0)])])):(c(),re(oa,{key:1,"active-session":w.value,"format-updated-at":Ee,"get-runtime-status-class":je,"get-runtime-status-label":Le,"get-thread-status-class":Ie,"get-thread-status-label":Be,"is-current-session":ve,"is-session-running":te},null,8,["active-session"]))])]))])):(c(),g("div",da,[n("aside",ua,[I(mt,{busy:T.value,"editing-session-id":A.value,"format-updated-at":Ee,"get-runtime-status-class":je,"get-runtime-status-label":Le,"get-thread-status-class":Ie,"get-thread-status-label":Be,"has-sessions":ke.value,"is-current-session":ve,"is-session-running":te,mode:b.value,sessions:ee.value,onCreate:Ue,onSelect:ze},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),n("div",ca,[n("div",fa,[n("div",null,[n("div",pa,[I(i(Qt),{class:"h-4 w-4"}),n("span",null,d(b.value==="create"?i(o)("projectManager.createTitle"):i(o)("projectManager.editTitle")),1)])])]),n("div",ga,[I(vt,{busy:T.value,"can-edit-engine":b.value!=="edit"||_e.value,"can-edit-cwd":b.value!=="edit"||Ce.value,"can-edit-session-id":b.value!=="edit"||ce.value,cwd:u.cwd,"cwd-readonly-message":pe.value,"duplicate-cwd-message":J.value,engine:u.engine,"agent-engines":u.agentEngines,"engine-options":fe.value,"engine-readonly-message":Te.value,"session-candidates":ye.value,"session-candidates-loading":Y.value,"session-id":u.sessionId,"session-id-copied":X.value,"session-id-readonly-message":be.value,title:u.title,"workspace-suggestions":$e.value,onCopySessionId:ot,onOpenDirectoryPicker:a[3]||(a[3]=L=>G.value=!0),onSelectSessionCandidate:le,"onUpdate:cwd":we,"onUpdate:engine":W,"onUpdate:agentEngines":se,"onUpdate:sessionId":ie,"onUpdate:title":f},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","agent-engines","engine-options","engine-readonly-message","session-candidates","session-candidates-loading","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"])]),_.value?(c(),g("p",va,[I(i(gt),{class:"h-4 w-4"}),n("span",null,d(_.value),1)])):M("",!0),n("div",ma,[n("div",ha,[b.value==="edit"&&w.value?(c(),g("button",{key:0,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||!((x=w.value)!=null&&x.cwd),onClick:l},[I(i(Gt),{class:"h-4 w-4"}),n("span",null,d(i(o)("projectManager.viewSource")),1)],8,ya)):M("",!0),b.value==="edit"&&w.value?(c(),g("button",{key:1,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||ue.value,onClick:a[4]||(a[4]=L=>H.value=!0)},[I(i(Xt),{class:"h-4 w-4"}),n("span",null,d(F.value?i(o)("projectManager.resettingSession"):i(o)("projectManager.newSession")),1)],8,xa)):M("",!0),b.value==="edit"&&w.value?(c(),g("button",{key:2,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||ue.value,onClick:a[5]||(a[5]=L=>z.value=!0)},[I(i(Yt),{class:"h-4 w-4"}),n("span",null,d(U.value?i(o)("projectManager.deletingProject"):i(o)("projectManager.deleteProject")),1)],8,ba)):M("",!0)]),n("div",wa,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:T.value,onClick:a[6]||(a[6]=L=>S("close"))},d(i(o)("projectManager.close")),9,Sa),b.value==="create"&&ke.value?(c(),g("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:T.value,onClick:He},d(i(o)("projectManager.backToList")),9,ka)):M("",!0),n("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:T.value,onClick:rt},d(We.value),9,Ca)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{Za as default};
@@ -1,4 +1,4 @@
1
- import{g as ut,t as U,f as tt,u as ke,a as st,b as ct}from"./index-7F-RPTS_.js";import{u as ft,g as He,b as ht,l as mt,_ as vt,a as gt,c as pt,r as xt,e as yt,D as Be,d as bt,i as wt,f as kt,h as St,j as Rt}from"./WorkbenchView-BqHMDZ1g.js";import{w as te,c as z,b as Q,n as at,aD as c,aE as h,aF as a,aR as he,aS as Ie,aL as Z,aQ as o,aG as V,u as t,aW as Ue,aX as $t,aN as O,aI as ve,aT as Ft,ak as _t,aJ as we,f as Pt,a$ as We}from"./vendor-misc-u-M8sNMf.js";import{c as Ct,D as Te,f as Ke,M as Lt,V as Tt,p as It,k as Ge,C as Je,R as Qe,b as Dt,i as Mt,h as nt,F as Xe,z as Ye}from"./vendor-ui-BglsaDbv.js";import"./vendor-router-Dn8q3tJM.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";function oe(e,r,i=""){const w=r==="run"?"run":r==="task"?"task":"workspace";return[String(e||"").trim(),w,String(i||"").trim()].join("::")}function Ne(e="",r=""){return`${String(e||"").trim()}::${String(r||"").trim()}`}function jt(e=""){return`${String(e||"").trim()}::`}function it(e){if(!e||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ye(e,r){const i=e.get(r);return i?(e.delete(r),e.set(r,i),it(i)):null}function be(e,r,i,w=0){for(e.delete(r),e.set(r,it(i));w>0&&e.size>w;){const b=e.keys().next().value;if(typeof b>"u")break;e.delete(b)}}function fe(e=""){const r=String(e||"").trim().toUpperCase();return r==="A"||r==="D"?r:"M"}function At(e=""){const r=String(e||"");if(!r)return[];const i=r.split(`
1
+ import{g as ut,t as U,f as tt,u as ke,a as st,b as ct}from"./index-5LxHpYf5.js";import{u as ft,g as He,b as ht,l as mt,_ as vt,a as gt,c as pt,r as xt,e as yt,D as Be,d as bt,i as wt,f as kt,h as St,j as Rt}from"./WorkbenchView-gbRu02Lv.js";import{w as te,c as z,b as Q,n as at,aD as c,aE as h,aF as a,aR as he,aS as Ie,aL as Z,aQ as o,aG as V,u as t,aW as Ue,aX as $t,aN as O,aI as ve,aT as Ft,ak as _t,aJ as we,f as Pt,a$ as We}from"./vendor-misc-u-M8sNMf.js";import{c as Ct,D as Te,f as Ke,M as Lt,V as Tt,p as It,k as Ge,C as Je,R as Qe,b as Dt,i as Mt,h as nt,F as Xe,z as Ye}from"./vendor-ui-BglsaDbv.js";import"./vendor-router-Dn8q3tJM.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";function oe(e,r,i=""){const w=r==="run"?"run":r==="task"?"task":"workspace";return[String(e||"").trim(),w,String(i||"").trim()].join("::")}function Ne(e="",r=""){return`${String(e||"").trim()}::${String(r||"").trim()}`}function jt(e=""){return`${String(e||"").trim()}::`}function it(e){if(!e||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ye(e,r){const i=e.get(r);return i?(e.delete(r),e.set(r,i),it(i)):null}function be(e,r,i,w=0){for(e.delete(r),e.set(r,it(i));w>0&&e.size>w;){const b=e.keys().next().value;if(typeof b>"u")break;e.delete(b)}}function fe(e=""){const r=String(e||"").trim().toUpperCase();return r==="A"||r==="D"?r:"M"}function At(e=""){const r=String(e||"");if(!r)return[];const i=r.split(`
2
2
  `),w=[];let b=0,T=0;return i.forEach((v,u)=>{const I=v.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(I){b=Number(I[1]),T=Number(I[2]),w.push({id:`hunk-${u}`,kind:"hunk",oldNumber:"",newNumber:"",content:v});return}if(v.startsWith("+")&&!v.startsWith("+++")){w.push({id:`line-${u}`,kind:"add",oldNumber:"",newNumber:T,content:v}),T+=1;return}if(v.startsWith("-")&&!v.startsWith("---")){w.push({id:`line-${u}`,kind:"delete",oldNumber:b,newNumber:"",content:v}),b+=1;return}if(v.startsWith(" ")){w.push({id:`line-${u}`,kind:"context",oldNumber:b,newNumber:T,content:v}),b+=1,T+=1;return}w.push({id:`line-${u}`,kind:"meta",oldNumber:"",newNumber:"",content:v})}),w}function Ht(e=""){const r=String(e||"").trim();if(!r)return"";const i=r.match(/^当前分支已从 (.+) 切换到 (.+)$/);return i?U("diffReview.warningBranchChanged",{from:i[1],to:i[2]}):r==="当前 HEAD 已不在基线 commit 的后续历史中,仓库可能经历了 reset、rebase 或切分支"?U("diffReview.warningHeadDetachedFromBaseline"):r}function De(e=""){const r=String(e||"").trim();if(!r)return"";const w=new Map([["二进制文件暂不支持在线 diff 预览。","diffReview.binaryPreviewUnavailable"],["文件内容较大,暂不展示具体 diff。","diffReview.fileTooLarge"],["diff 内容较长,暂不在页面内完整展示。","diffReview.diffTooLong"],["diff 内容较长,当前仅展示摘要预览。","diffReview.diffPreviewOnly"],["当前工作目录不是 Git 仓库,暂不支持代码变更审查。","diffReview.notGitRepo"],["任务不存在。","diffReview.taskNotFound"],["请选择一轮执行后再查看本轮代码变更。","diffReview.runRequired"],["没有找到对应的执行记录。","diffReview.runNotFound"],["这轮执行还没有建立代码变更基线,暂时无法查看本轮 diff。","diffReview.runBaselineMissing"],["当前任务还没有建立代码变更基线,请先让 Codex 执行一轮。","diffReview.taskBaselineMissing"],["这轮执行缺少结束快照,暂时无法准确还原本轮代码变更。","diffReview.runSnapshotMissing"],["原工作目录已不是有效的 Git 仓库,暂时无法读取代码变更。","diffReview.originalRepoInvalid"],["基线对应的 commit 已不存在,仓库可能被 reset、rebase 或切换到无关历史,暂时无法准确读取该范围的代码变更。","diffReview.baselineCommitMissing"]]).get(r);return w?U(w):/^git diff 计算超时(>\d+ms)[。.]?$/.test(r)||r==="该文件 diff 计算超时,暂不在线展示详细内容。"?U("diffReview.fileDiffTimedOut"):r}function Ve(e=null){return!e||typeof e!="object"?e:{...e,reason:De(e.reason),warnings:Array.isArray(e.warnings)?e.warnings.map(r=>Ht(r)).filter(Boolean):[],files:Array.isArray(e.files)?e.files.map(r=>({...r,message:De(r==null?void 0:r.message)})):[]}}function Bt(e=[],r="",i=0){const w=Math.max(0,Number(i)||0);if(!w)return[];const b=String(r||"").trim(),T=Array.isArray(e)?e:[],v=[],u=new Set;return b&&T.find(R=>String((R==null?void 0:R.path)||"").trim()===b)&&(v.push(b),u.add(b)),T.forEach(I=>{const R=String((I==null?void 0:I.path)||"").trim();!R||u.has(R)||v.length>=w||(v.push(R),u.add(R))}),v}function Nt(e){const r=Q("workspace"),i=Q(""),w=Q(""),b=Q("all"),T=Q(""),v=Q([]),u=Q(null),I=Q(!1),R=Q(!1),M=Q(""),N=Q(!1),G=Q(null),j=Q(0),E=new Map,se=ft();let _=0,$=0,f="",C="",p="",g=-1;const X=new Map,J=new Map,q=new Map,Y=new Map,W=12e3,re=3,de=z(()=>v.value.filter(s=>s.completed)),n=z(()=>{var l;const s={all:0,A:0,M:0,D:0};return(((l=u.value)==null?void 0:l.files)||[]).forEach(m=>{const y=fe(m==null?void 0:m.status);s.all+=1,s[y]+=1}),s}),d=z(()=>{var m;const s=((m=u.value)==null?void 0:m.files)||[],l=String(T.value||"").trim().toLowerCase();return s.filter(y=>b.value!=="all"&&fe(y==null?void 0:y.status)!==b.value?!1:l?String((y==null?void 0:y.path)||"").toLowerCase().includes(l):!0)}),k=z(()=>{const s=d.value;return s.find(l=>l.path===w.value)||s[0]||null}),A=z(()=>{var s;return At(((s=k.value)==null?void 0:s.patch)||"")}),P=z(()=>A.value.map((s,l)=>({...s,index:l})).filter(s=>s.kind==="hunk")),ae=z(()=>Bt(d.value,w.value,re)),x=z(()=>{var s,l;return R.value&&!((l=(s=u.value)==null?void 0:s.summary)!=null&&l.statsComplete)}),H=z(()=>{var m;const s=((m=u.value)==null?void 0:m.baseline)||null;if(!(s!=null&&s.createdAt)&&!(s!=null&&s.headShort))return"";const l=[];return s.createdAt&&l.push(U("diffReview.baselineTime",{value:tt(s.createdAt)})),s.branch&&l.push(U("diffReview.baselineBranch",{value:s.branch})),s.headShort&&l.push(U("diffReview.baselineCommit",{value:s.headShort})),s.currentHeadShort&&l.push(U("diffReview.currentHead",{value:s.currentHeadShort})),l.join(" · ")});function L(s){return(s==null?void 0:s.status)==="completed"?U("diffReview.completed"):(s==null?void 0:s.status)==="error"?U("diffReview.failed"):(s==null?void 0:s.status)==="interrupted"?U("diffReview.interrupted"):U("diffReview.stopped")}function me(s,l){if(s){if(l){E.set(s,l);return}E.delete(s)}}function ue(s,l={}){const m=P.value;if(!m.length)return;const y=Math.min(Math.max(0,Number(s)||0),m.length-1),K=m[y],B=E.get(K.id);B&&(j.value=y,B.scrollIntoView({block:l.block||"center",behavior:l.behavior||"smooth"}))}function le(s=1){P.value.length&&ue(j.value+s)}function S(s){return`${new Date((s==null?void 0:s.startedAt)||(s==null?void 0:s.createdAt)).toLocaleString(ut())} · ${L(s)}`}function Se(){const s=de.value;if(!s.length){i.value="";return}s.some(l=>l.id===i.value)||(i.value=s[0].id)}function ce(){const s=d.value;if(!s.length){w.value="";return}s.some(l=>l.path===w.value)||(w.value=s[0].path)}function Re(s=""){return fe(s)==="A"?U("diffReview.added"):fe(s)==="D"?U("diffReview.deleted"):U("diffReview.modified")}function $e(s=""){return fe(s)==="A"?"theme-status-success":fe(s)==="D"?"theme-status-danger":"theme-status-warning"}function Fe(s="all"){return s==="A"?U("diffReview.added"):s==="D"?U("diffReview.deleted"):s==="M"?U("diffReview.modified"):U("diffReview.all")}function F(s="all"){return b.value===s?"theme-filter-active":"theme-filter-idle"}function _e(s="context"){return s==="add"?"theme-patch-add":s==="delete"?"theme-patch-delete":s==="hunk"?"theme-patch-hunk":s==="meta"?"theme-patch-meta":"theme-patch-context"}function ge(s,l=""){const m=String(l||"").trim();m&&Array.from(s.keys()).forEach(y=>{String(y||"").startsWith(m)&&s.delete(y)})}function lt(){const s=jt(e.taskSlug);ge(X,s),ge(J,s),ge(q,s)}function Me(){const s=r.value==="run"?"run":r.value==="task"?"task":"workspace",l=s==="run"?i.value:"",m=oe(e.taskSlug,s,l);return{scope:s,runId:l,signature:m}}function rt(s,l="after"){const m=String((s==null?void 0:s.path)||"").trim();if(!e.taskSlug||!m)return"";const y=Me();return ht(e.taskSlug,{scope:y.scope,runId:y.runId,filePath:m,side:l})}function ze(s=""){var m;const l=String(s||"").trim();return l&&(((m=u.value)==null?void 0:m.files)||[]).find(y=>y.path===l)||null}function Oe(s=null){return!!s&&!s.patchLoaded&&!s.binary&&!s.tooLarge&&!s.message}function pe(s="",l="",m=null,y=null){var B;const K=oe(e.taskSlug,r.value,r.value==="run"?i.value:"");return s!==K||!m||!((B=u.value)!=null&&B.files)?!1:(u.value={...u.value,baseline:(y==null?void 0:y.baseline)||u.value.baseline||null,warnings:(y==null?void 0:y.warnings)||u.value.warnings||[],files:u.value.files.map(D=>D.path===l?m:D)},!0)}async function Ee(s="",l={}){const m=String(s||"").trim(),y=String(l.signature||"").trim();if(!m||!y)return null;const K=Ne(y,m),B=ye(q,K);if(B)return{detailedFile:B,normalizedPayload:null};const D=Y.get(K);if(D)return D;const ne=(async()=>{try{const ee=await He(e.taskSlug,{scope:l.scope,runId:l.runId,filePath:m,timeoutMs:W}),ie=Ve(ee),xe=(ie.files||[]).find(Le=>Le.path===m);if(!xe)throw new Error(U("diffReview.noFileDiffContent"));return be(q,K,xe,120),{detailedFile:xe,normalizedPayload:ie}}catch(ee){return{error:ee}}finally{Y.delete(K)}})();return Y.set(K,ne),ne}async function je(){var l,m;if(!e.taskSlug||!e.active||!((l=u.value)!=null&&l.supported))return;const s=Me();for(const y of ae.value){const K=ze(y);if(!Oe(K))continue;const B=oe(e.taskSlug,r.value,r.value==="run"?i.value:"");if(s.signature!==B)return;const D=await Ee(y,s);if(D){if(D.error){const ne=De(((m=D.error)==null?void 0:m.message)||"")||U("diffReview.fileDiffTimedOut"),ee={...K,patch:"",patchLoaded:!0,tooLarge:!0,message:ne};be(q,Ne(s.signature,y),ee,120),pe(s.signature,y,ee,null);continue}pe(s.signature,y,D.detailedFile,D.normalizedPayload)}}}async function ot(){if(!e.taskSlug){v.value=[],i.value="",p="",g=-1;return}const s=se.getTaskRunSyncVersion(e.taskSlug);if(p===e.taskSlug&&g===s)return;const l=await mt(e.taskSlug,{limit:20,events:"none"});v.value=l.items||[],p=e.taskSlug,g=s,Se()}async function Ae(){if(!e.taskSlug||!e.active)return;const s=++_;I.value=!0,R.value=!1,M.value="";try{const l=r.value==="run"?"run":r.value==="task"?"task":"workspace";l==="run"&&await ot();const m=oe(e.taskSlug,l,l==="run"?i.value:"");if(l==="run"&&!i.value){u.value={supported:!1,reason:U("diffReview.noReviewRuns"),repoRoot:"",summary:{fileCount:0,additions:0,deletions:0,statsComplete:!0},files:[]},ce();return}const y=ye(X,m);if(y){u.value=y,f=m;const D=ye(J,m);D?(u.value={...y,baseline:D.baseline||y.baseline||null,warnings:D.warnings||y.warnings||[],summary:D.summary||y.summary},C=m):C="",ce(),Pe().catch(()=>{}),je().catch(()=>{}),D||qe().catch(()=>{});return}const K=await He(e.taskSlug,{scope:l,runId:l==="run"?i.value:"",includeStats:!1});if(s!==_)return;const B=Ve(K);u.value=B,be(X,m,B,36),f=m,C="",ce(),Pe().catch(()=>{}),je().catch(()=>{}),qe().catch(()=>{})}catch(l){if(s!==_)return;M.value=l.message,u.value=null}finally{s===_&&(I.value=!1)}}async function qe(){var K,B,D;if(!e.taskSlug||!e.active||!((K=u.value)!=null&&K.supported))return;const s=r.value==="run"?"run":r.value==="task"?"task":"workspace",l=s==="run"?i.value:"",m=oe(e.taskSlug,s,l);if(C===m&&((D=(B=u.value)==null?void 0:B.summary)!=null&&D.statsComplete))return;const y=ye(J,m);if(y){u.value={...u.value,baseline:y.baseline||u.value.baseline||null,warnings:y.warnings||u.value.warnings||[],summary:y.summary||u.value.summary},C=m,R.value=!1;return}R.value=!0;try{const ne=await He(e.taskSlug,{scope:s,runId:l,includeFiles:!1,includeStats:!0}),ee=oe(e.taskSlug,r.value,r.value==="run"?i.value:"");if(m!==ee||!u.value)return;const ie=Ve(ne);u.value={...u.value,baseline:ie.baseline||u.value.baseline||null,warnings:ie.warnings||u.value.warnings||[],summary:ie.summary||u.value.summary},be(J,m,{baseline:ie.baseline||null,warnings:ie.warnings||[],summary:ie.summary||null},36),C=m}catch{}finally{const ne=oe(e.taskSlug,r.value,r.value==="run"?i.value:"");m===ne&&(R.value=!1)}}async function Pe(){var D,ne;const s=String(w.value||"").trim();if(!e.taskSlug||!e.active||!s)return;const l=Me(),m=ze(s);if(!Oe(m))return;const y=Ne(l.signature,s),K=ye(q,y);if(K&&((D=u.value)!=null&&D.files)){pe(l.signature,s,K,null);return}const B=++$;N.value=!0;try{const ee=await Ee(s,l);if(B!==$||!ee)return;const ie=oe(e.taskSlug,r.value,r.value==="run"?i.value:"");if(l.signature!==ie)return;if(ee.error){const xe=De(((ne=ee.error)==null?void 0:ne.message)||"")||U("diffReview.fileDiffTimedOut"),Le={...m,patch:"",patchLoaded:!0,tooLarge:!0,message:xe};be(q,y,Le,120),pe(l.signature,s,Le,null);return}pe(l.signature,s,ee.detailedFile,ee.normalizedPayload)}finally{B===$&&(N.value=!1,String(w.value||"").trim()!==s&&Pe().catch(()=>{}))}}function Ce({force:s=!1}={}){if(!e.taskSlug||!e.active)return;const l=oe(e.taskSlug,r.value,r.value==="run"?i.value:"");!s&&l===f||Ae().catch(()=>{})}async function dt(){!e.taskSlug||!e.active||I.value||(lt(),f="",C="",p="",g=-1,await Ae())}return te(()=>[e.taskSlug,e.active,r.value,i.value],([s,l],m=[])=>{const y=m[0]||"";s!==y&&(w.value="",f="",v.value=[],i.value="",p="",g=-1,C=""),!(!s||!l)&&Ce()},{immediate:!0}),te(()=>{var s,l;return[b.value,((l=(s=u.value)==null?void 0:s.files)==null?void 0:l.length)||0]},()=>{ce()}),te(()=>[w.value,P.value.length],()=>{j.value=0,E.clear(),at(()=>{var s,l;P.value.length?ue(0,{behavior:"auto",block:"start"}):(l=(s=G.value)==null?void 0:s.scrollTo)==null||l.call(s,{top:0,behavior:"auto"})})}),te(()=>w.value,()=>{Pe().catch(()=>{})},{immediate:!0}),te(()=>{var s;return[e.active,(s=u.value)==null?void 0:s.supported,ae.value.join(`
3
3
  `)]},([s,l])=>{!s||!l||je().catch(()=>{})}),te(()=>[e.preferredScope,e.preferredRunId,e.focusToken],([s,l,m],y=[])=>{const K=Number(y[2]||0),B=s==="run"?"run":s==="task"?"task":"workspace",D=B==="run"&&l?String(l||""):"",ne=r.value!==B,ee=B==="run"&&D&&i.value!==D;r.value=B,D&&(i.value=D),B!=="run"&&(i.value=""),!ne&&!ee&&e.active&&e.taskSlug&&m!==K&&(f="",Ce())},{immediate:!0}),te(()=>se.readyVersion.value,()=>{!e.active||!e.taskSlug||(p="",g=-1,f="",C="",Ce({force:!0}))}),te(()=>se.getTaskDiffSyncVersion(e.taskSlug),()=>{!e.active||!e.taskSlug||(p="",g=-1,C="",f="",Ce({force:!0}))}),{activeHunkIndex:j,baselineMetaText:H,diffPayload:u,diffScope:r,error:M,fileSearch:T,filteredFiles:d,getFilterButtonClass:F,getFilterLabel:Fe,getFileBlobUrl:rt,getPatchLineClass:_e,getRunStatusLabel:L,getStatusClass:$e,getStatusLabel:Re,jumpToAdjacentHunk:le,loadDiff:Ae,loading:I,normalizeFileStatus:fe,patchLoading:N,patchViewportRef:G,runs:v,selectedFile:k,selectedFilePath:w,selectedPatchHunks:P,selectedPatchLines:A,selectedRunId:i,setPatchLineRef:me,showSummarySkeleton:x,statsLoading:R,statusCounts:n,statusFilter:b,terminalRuns:de,formatRunOptionLabel:S,refreshDiff:dt}}const Vt={class:"mb-3 grid grid-cols-2 gap-2"},Ut=["onClick"],zt={class:"theme-input-shell mb-3 flex items-center gap-2 rounded-sm border px-3 py-2 text-xs text-[var(--theme-textMuted)]"},Ot=["placeholder"],Et={key:0,class:"theme-empty-state theme-empty-state-strong mb-3 px-3 py-2 text-[11px]"},qt={key:1,class:"theme-empty-state px-3 py-4 text-xs"},Wt={key:2,class:"theme-empty-state px-3 py-4 text-xs"},Kt={key:3,class:"space-y-1"},Gt=["onClick","onKeydown"],Jt={class:"min-w-0 flex-1"},Qt={class:"flex items-start gap-2"},Xt={class:"theme-list-item-title min-w-0 flex-1 break-all"},Yt={key:0,class:"theme-status-info inline-flex shrink-0 items-center rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Zt={class:"theme-list-item-meta mt-1"},Ze={__name:"TaskDiffFileList",props:{diffPayload:{type:Object,default:null},fileSearch:{type:String,default:""},autoFocusSelected:{type:Boolean,default:!1},filteredFiles:{type:Array,default:()=>[]},focusToken:{type:Number,default:0},getFilterButtonClass:{type:Function,default:()=>""},getFilterLabel:{type:Function,default:e=>e},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},selectedFilePath:{type:String,default:""},showSummarySkeleton:{type:Boolean,default:!1},statusCounts:{type:Object,default:()=>({})},statusFilter:{type:String,default:"all"}},emits:["select-file","update:fileSearch","update:statusFilter"],setup(e,{emit:r}){const i=e,w=r,{t:b}=ke(),T=new Map,v=Q(0),u=Q(0),I=z({get:()=>i.fileSearch,set:_=>w("update:fileSearch",_)}),R=z({get:()=>i.statusFilter,set:_=>w("update:statusFilter",_)}),M=z(()=>{var _;return Array.isArray((_=i.diffPayload)==null?void 0:_.files)&&i.diffPayload.files.length>0});function N(_,$){if($){T.set(_,$);return}T.delete(_)}function G(_){at(()=>{var f,C;const $=T.get(_);(f=$==null?void 0:$.focus)==null||f.call($),(C=$==null?void 0:$.scrollIntoView)==null||C.call($,{block:"nearest",inline:"nearest"})})}function j(){!i.autoFocusSelected||!i.selectedFilePath||v.value===u.value||(u.value=v.value,G(i.selectedFilePath))}function E(_=1,$=""){const f=Array.isArray(i.filteredFiles)?i.filteredFiles:[];if(!f.length)return;const C=f.findIndex(q=>q.path===$),p=f.findIndex(q=>q.path===i.selectedFilePath),X=(Math.max(0,C>=0?C:p)+_+f.length)%f.length,J=f[X];J!=null&&J.path&&(w("select-file",J.path),G(J.path))}function se(_,$){const f=String((_==null?void 0:_.key)||"");if(f==="ArrowDown"){_.preventDefault(),E(1,$);return}if(f==="ArrowUp"){_.preventDefault(),E(-1,$);return}(f==="Enter"||f===" ")&&$&&(_.preventDefault(),w("select-file",$))}return te(()=>i.focusToken,_=>{v.value=_,j()},{immediate:!0}),te(()=>i.selectedFilePath,()=>{j()}),(_,$)=>(c(),h(he,null,[a("div",Vt,[(c(),h(he,null,Ie(["all","A","M","D"],f=>a("button",{key:f,type:"button",class:Z(["inline-flex w-full items-center justify-center gap-1 whitespace-nowrap rounded-sm border px-2 py-1 text-[11px] transition",e.getFilterButtonClass(f)]),onClick:C=>R.value=f},o(e.getFilterLabel(f))+" "+o(e.statusCounts[f]||0),11,Ut)),64))]),a("label",zt,[V(t(Ct),{class:"h-3.5 w-3.5 shrink-0"}),Ue(a("input",{"onUpdate:modelValue":$[0]||($[0]=f=>I.value=f),type:"text",placeholder:t(b)("diffReview.searchFilePath"),class:"min-w-0 flex-1 bg-transparent text-xs text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,8,Ot),[[$t,I.value]])]),e.showSummarySkeleton?(c(),h("div",Et,o(t(b)("diffReview.statsPending")),1)):O("",!0),M.value?e.filteredFiles.length?(c(),h("div",Kt,[(c(!0),h(he,null,Ie(e.filteredFiles,f=>{var C;return c(),h("button",{key:f.path,ref_for:!0,ref:p=>N(f.path,p),type:"button",class:Z(["theme-list-row focus:outline-none",f.path===e.selectedFilePath?"theme-list-item-active":"theme-list-item-hover"]),onClick:p=>w("select-file",f.path),onKeydown:p=>se(p,f.path)},[a("span",{class:Z(["theme-list-item-badge",e.getStatusClass(f.status)])},o(e.getStatusLabel(f.status)),3),a("div",Jt,[a("div",Qt,[a("div",Xt,o(f.path),1),f.binary?(c(),h("span",Yt,o(t(b)("diffReview.binaryTag")),1)):O("",!0)]),a("div",Zt,o(f.binary?((C=f.binaryPreview)==null?void 0:C.mimeType)||t(b)("diffReview.binaryPreviewTitle"):f.statsLoaded?`+${f.additions} / -${f.deletions}`:t(b)("diffReview.statsOnDemand")),1)])],42,Gt)}),128))])):(c(),h("div",Wt,o(t(b)("diffReview.noMatches")),1)):(c(),h("div",qt,o(t(b)("diffReview.noChanges")),1))],64))}},es={class:"flex h-full min-h-0 flex-col overflow-hidden"},ts={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-[12px]"},ss={class:"flex flex-wrap items-center gap-2"},as={class:"font-medium text-[var(--theme-textPrimary)]"},ns={class:"theme-muted-text"},is={class:"min-h-0 flex-1 overflow-auto p-4"},ls={key:0,class:"grid min-h-full gap-4 md:grid-cols-2"},rs={class:"theme-inline-panel flex min-h-[20rem] flex-col rounded-sm border p-3"},os={class:"mb-3 flex items-center justify-between gap-2"},ds={class:"min-w-0"},us={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},cs={class:"theme-muted-text mt-1 text-[11px]"},fs=["href","download","title"],hs={key:0,class:"theme-empty-state flex min-h-[16rem] flex-1 items-center justify-center text-[12px]"},ms={key:1,class:"theme-empty-state flex min-h-[16rem] flex-1 items-center justify-center text-[12px]"},vs={key:2,class:"theme-empty-state flex min-h-[16rem] flex-1 items-center justify-center text-[12px]"},gs=["title"],ps=["src","alt"],xs=["src"],ys=["src"],bs=["src","title"],ws={class:"theme-inline-panel flex min-h-[20rem] flex-col rounded-sm border p-3"},ks={class:"mb-3 flex items-center justify-between gap-2"},Ss={class:"min-w-0"},Rs={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},$s={class:"theme-muted-text mt-1 text-[11px]"},Fs=["href","download","title"],_s={key:0,class:"theme-empty-state flex min-h-[16rem] flex-1 items-center justify-center text-[12px]"},Ps={key:1,class:"theme-empty-state flex min-h-[16rem] flex-1 items-center justify-center text-[12px]"},Cs={key:2,class:"theme-empty-state flex min-h-[16rem] flex-1 items-center justify-center text-[12px]"},Ls=["title"],Ts=["src","alt"],Is=["src"],Ds=["src"],Ms=["src","title"],js={key:1,class:"theme-inline-panel flex min-h-full flex-col rounded-sm border p-4"},As={class:"flex items-center gap-2"},Hs={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},Bs={class:"mt-4 grid gap-3 md:grid-cols-2"},Ns={class:"rounded-sm border border-dashed px-3 py-3"},Vs={class:"text-xs font-medium text-[var(--theme-textPrimary)]"},Us={class:"theme-muted-text mt-2 space-y-1 text-[12px]"},zs={key:0},Os=["href","download"],Es={class:"rounded-sm border border-dashed px-3 py-3"},qs={class:"text-xs font-medium text-[var(--theme-textPrimary)]"},Ws={class:"theme-muted-text mt-2 space-y-1 text-[12px]"},Ks={key:0},Gs=["href","download"],Js={__name:"TaskDiffBinaryPreview",props:{getFileBlobUrl:{type:Function,default:()=>""},selectedFile:{type:Object,default:null}},setup(e){const r=e,{t:i}=ke(),w=Q(""),b=Q({before:!1,after:!1});function T(p=0){const g=Math.max(0,Number(p)||0);return g<1024?`${g} B`:g<1024*1024?`${(g/1024).toFixed(g<10*1024?1:0)} KB`:`${(g/(1024*1024)).toFixed(g<10*1024*1024?1:0)} MB`}function v(p="after"){var g,X;return((X=(g=r.selectedFile)==null?void 0:g.binaryPreview)==null?void 0:X[p])||{exists:!1,size:0,hashShort:"",mimeType:"",previewKind:"binary",tooLarge:!1}}function u(p="after"){return r.selectedFile?r.getFileBlobUrl(r.selectedFile,p):""}function I(p="binary"){return p==="image"?Ke:p==="audio"?Lt:p==="video"?Tt:p==="pdf"?It:Ke}const R=z(()=>{var p,g;return String(((g=(p=r.selectedFile)==null?void 0:p.binaryPreview)==null?void 0:g.kind)||"binary")}),M=z(()=>v("before")),N=z(()=>v("after")),G=z(()=>u("before")),j=z(()=>u("after")),E=z(()=>{var p;return String(((p=r.selectedFile)==null?void 0:p.path)||"").trim()}),se=z(()=>["image","audio","video","pdf"].includes(R.value)),_=z(()=>R.value!=="image"?[]:[M.value.exists&&!M.value.tooLarge&&!b.value.before?G.value:"",N.value.exists&&!N.value.tooLarge&&!b.value.after?j.value:""].filter(Boolean));function $(p){return(p==null?void 0:p.exists)&&!(p!=null&&p.tooLarge)}function f(p="before"){b.value={...b.value,[p]:!0}}function C(p=""){const g=String(p||"").trim();g&&(w.value=g)}return te(()=>{var p,g,X,J,q,Y,W;return[String(((p=r.selectedFile)==null?void 0:p.path)||"").trim(),String(G.value||"").trim(),String(j.value||"").trim(),String(((J=(X=(g=r.selectedFile)==null?void 0:g.binaryPreview)==null?void 0:X.before)==null?void 0:J.hash)||"").trim(),String(((W=(Y=(q=r.selectedFile)==null?void 0:q.binaryPreview)==null?void 0:Y.after)==null?void 0:W.hash)||"").trim()].join(`
4
4
  `)},()=>{w.value="",b.value={before:!1,after:!1}},{immediate:!0}),(p,g)=>{var X,J,q,Y;return c(),h("div",es,[a("div",ts,[a("div",ss,[a("span",as,o(E.value),1),a("span",ns,o(t(i)("diffReview.binaryPreviewTitle")),1)])]),a("div",is,[se.value?(c(),h("div",ls,[a("section",rs,[a("div",os,[a("div",ds,[a("p",us,o(t(i)("diffReview.binaryBefore")),1),a("p",cs,o(M.value.exists?`${T(M.value.size)} · ${M.value.hashShort||"-"}`:t(i)("diffReview.binarySideMissing")),1)]),$(M.value)?(c(),h("a",{key:0,class:"theme-icon-button h-8 w-8",href:G.value,download:((X=e.selectedFile)==null?void 0:X.path)||"before.bin",title:t(i)("diffReview.downloadBinarySide")},[V(t(Te),{class:"h-4 w-4"})],8,fs)):O("",!0)]),M.value.exists?M.value.tooLarge?(c(),h("div",ms,o(t(i)("diffReview.binaryPreviewTooLarge")),1)):b.value.before?(c(),h("div",vs,o(t(i)("diffReview.binaryPreviewUnavailable")),1)):R.value==="image"?(c(),h("button",{key:3,type:"button",class:"task-diff-binary-image-wrap flex min-h-[16rem] flex-1 cursor-zoom-in items-center justify-center rounded-sm border p-3",title:t(i)("diffReview.openImagePreview"),onClick:g[1]||(g[1]=W=>C(G.value))},[a("img",{src:G.value,alt:`${E.value} before`,class:"max-h-full max-w-full object-contain",onError:g[0]||(g[0]=W=>f("before"))},null,40,ps)],8,gs)):R.value==="audio"?(c(),h("audio",{key:4,class:"w-full",src:G.value,controls:"",preload:"metadata",onError:g[2]||(g[2]=W=>f("before"))},null,40,xs)):R.value==="video"?(c(),h("video",{key:5,class:"max-h-[26rem] w-full rounded-sm border bg-black",src:G.value,controls:"",preload:"metadata",onError:g[3]||(g[3]=W=>f("before"))},null,40,ys)):R.value==="pdf"?(c(),h("iframe",{key:6,class:"min-h-[26rem] w-full rounded-sm border bg-white",src:G.value,title:`${E.value} before`,onError:g[4]||(g[4]=W=>f("before"))},null,40,bs)):O("",!0):(c(),h("div",hs,o(t(i)("diffReview.binarySideMissing")),1))]),a("section",ws,[a("div",ks,[a("div",Ss,[a("p",Rs,o(t(i)("diffReview.binaryAfter")),1),a("p",$s,o(N.value.exists?`${T(N.value.size)} · ${N.value.hashShort||"-"}`:t(i)("diffReview.binarySideMissing")),1)]),$(N.value)?(c(),h("a",{key:0,class:"theme-icon-button h-8 w-8",href:j.value,download:((J=e.selectedFile)==null?void 0:J.path)||"after.bin",title:t(i)("diffReview.downloadBinarySide")},[V(t(Te),{class:"h-4 w-4"})],8,Fs)):O("",!0)]),N.value.exists?N.value.tooLarge?(c(),h("div",Ps,o(t(i)("diffReview.binaryPreviewTooLarge")),1)):b.value.after?(c(),h("div",Cs,o(t(i)("diffReview.binaryPreviewUnavailable")),1)):R.value==="image"?(c(),h("button",{key:3,type:"button",class:"task-diff-binary-image-wrap flex min-h-[16rem] flex-1 cursor-zoom-in items-center justify-center rounded-sm border p-3",title:t(i)("diffReview.openImagePreview"),onClick:g[6]||(g[6]=W=>C(j.value))},[a("img",{src:j.value,alt:`${E.value} after`,class:"max-h-full max-w-full object-contain",onError:g[5]||(g[5]=W=>f("after"))},null,40,Ts)],8,Ls)):R.value==="audio"?(c(),h("audio",{key:4,class:"w-full",src:j.value,controls:"",preload:"metadata",onError:g[7]||(g[7]=W=>f("after"))},null,40,Is)):R.value==="video"?(c(),h("video",{key:5,class:"max-h-[26rem] w-full rounded-sm border bg-black",src:j.value,controls:"",preload:"metadata",onError:g[8]||(g[8]=W=>f("after"))},null,40,Ds)):R.value==="pdf"?(c(),h("iframe",{key:6,class:"min-h-[26rem] w-full rounded-sm border bg-white",src:j.value,title:`${E.value} after`,onError:g[9]||(g[9]=W=>f("after"))},null,40,Ms)):O("",!0):(c(),h("div",_s,o(t(i)("diffReview.binarySideMissing")),1))])])):(c(),h("div",js,[a("div",As,[(c(),ve(Ft(I(R.value)),{class:"h-5 w-5 text-[var(--theme-textSecondary)]"})),a("span",Hs,o(t(i)("diffReview.binaryMetaTitle")),1)]),a("div",Bs,[a("div",Ns,[a("div",Vs,o(t(i)("diffReview.binaryBefore")),1),a("div",Us,[a("p",null,o(M.value.exists?`${T(M.value.size)} · ${M.value.hashShort||"-"}`:t(i)("diffReview.binarySideMissing")),1),M.value.mimeType?(c(),h("p",zs,o(M.value.mimeType),1)):O("",!0)]),$(M.value)?(c(),h("a",{key:0,class:"tool-button mt-3 inline-flex items-center gap-2 px-3 py-2 text-xs",href:G.value,download:((q=e.selectedFile)==null?void 0:q.path)||"before.bin"},[V(t(Te),{class:"h-3.5 w-3.5"}),a("span",null,o(t(i)("diffReview.downloadBinarySide")),1)],8,Os)):O("",!0)]),a("div",Es,[a("div",qs,o(t(i)("diffReview.binaryAfter")),1),a("div",Ws,[a("p",null,o(N.value.exists?`${T(N.value.size)} · ${N.value.hashShort||"-"}`:t(i)("diffReview.binarySideMissing")),1),N.value.mimeType?(c(),h("p",Ks,o(N.value.mimeType),1)):O("",!0)]),$(N.value)?(c(),h("a",{key:0,class:"tool-button mt-3 inline-flex items-center gap-2 px-3 py-2 text-xs",href:j.value,download:((Y=e.selectedFile)==null?void 0:Y.path)||"after.bin"},[V(t(Te),{class:"h-3.5 w-3.5"}),a("span",null,o(t(i)("diffReview.downloadBinarySide")),1)],8,Gs)):O("",!0)])])]))]),V(vt,{modelValue:w.value,"onUpdate:modelValue":g[10]||(g[10]=W=>w.value=W),images:_.value},null,8,["modelValue","images"])])}}},Qs=st(Js,[["__scopeId","data-v-4703ec91"]]),Xs={key:0,class:"flex h-full min-h-0 flex-col overflow-hidden"},Ys={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-[12px]"},Zs={class:"space-y-3 sm:hidden"},ea={class:"flex items-start gap-2"},ta={class:"min-w-0 break-all font-medium text-[var(--theme-textPrimary)]"},sa={class:"flex items-center justify-between gap-3"},aa={class:"min-w-0"},na={class:"opacity-75"},ia={key:0,class:"theme-muted-text mt-1 text-[11px]"},la=["disabled"],ra={class:"min-w-[64px] text-center text-[12px] text-[var(--theme-textSecondary)]"},oa=["disabled"],da={class:"hidden items-center gap-3 sm:flex"},ua={class:"flex min-w-0 flex-1 flex-wrap items-center gap-2"},ca={class:"break-all font-medium text-[var(--theme-textPrimary)]"},fa={class:"opacity-75"},ha={key:0,class:"theme-muted-text text-[11px]"},ma=["disabled"],va={class:"min-w-[64px] text-center text-[12px] text-[var(--theme-textSecondary)]"},ga=["disabled"],pa={key:1,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-[12px]"},xa={class:"theme-empty-state px-4 py-4"},ya={key:2,class:"theme-muted-text flex-1 overflow-y-auto px-4 py-4 text-[12px]"},ba={class:"task-diff-view min-w-max px-4 py-4 font-mono"},wa={key:0,class:"theme-inline-panel theme-secondary-text mb-3 rounded-sm border border-dashed px-3 py-2 text-[12px]"},ka=["data-line-id","data-line-kind"],Sa={class:"task-diff-row__number select-none"},Ra={class:"task-diff-row__number select-none"},$a=["innerHTML"],Fa={key:4,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-[12px]"},_a={class:"theme-empty-state px-4 py-4"},Pa={key:1,class:"theme-muted-text flex h-full items-center justify-center px-5 text-[12px]"},Ca={__name:"TaskDiffPatchView",props:{activeHunkIndex:{type:Number,default:0},getPatchLineClass:{type:Function,default:()=>""},getFileBlobUrl:{type:Function,default:()=>""},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},jumpToAdjacentHunk:{type:Function,default:()=>{}},patchLoading:{type:Boolean,default:!1},selectedFile:{type:Object,default:null},selectedPatchHunks:{type:Array,default:()=>[]},selectedPatchLines:{type:Array,default:()=>[]},setPatchLineRef:{type:Function,default:()=>{}},setPatchViewportRef:{type:Function,default:()=>{}}},emits:["insert-code-context"],setup(e,{emit:r}){const i=e,w=r,{t:b}=ke(),{isDark:T}=ct(),v=Q([]),u=z(()=>{var n;return wt(((n=i.selectedFile)==null?void 0:n.path)||"")}),I=Q(null),R=new Map,M=z(()=>{var n,d;return!!((n=i.selectedFile)!=null&&n.binary&&((d=i.selectedFile)!=null&&d.binaryPreview))});function N(n={}){return["add","delete","context"].includes(String((n==null?void 0:n.kind)||"").trim())}function G(n=""){const d=String(n||"").trim();return d&&v.value.find(k=>k.id===d)||null}const{selectedRows:j,selectionAction:E,clearSelectionState:se,handleSelectionMouseUp:_,updateSelectionActionFromDom:$}=gt({getContainer:()=>I.value,isActive:()=>!!(i.selectedFile&&i.selectedPatchLines.length),rowSelector:".task-diff-row[data-line-id]",getOrderedRowElements:n=>[...n.querySelectorAll(".task-diff-row[data-line-id]")].filter(d=>N(G(d.getAttribute("data-line-id")))),mapRowElement:n=>{var d;return G(((d=n==null?void 0:n.getAttribute)==null?void 0:d.call(n,"data-line-id"))||"")},getCodeLeft:n=>{var ae,x,H;const d=(ae=n==null?void 0:n.querySelector)==null?void 0:ae.call(n,".task-diff-line");if(!d)return 0;const k=(x=d.getBoundingClientRect)==null?void 0:x.call(d),A=(H=window.getComputedStyle)==null?void 0:H.call(window,d),P=Number.parseFloat((A==null?void 0:A.paddingLeft)||"0")||0;return((k==null?void 0:k.left)||0)+P},debounceMs:72});function f(n=[]){const d=n.flatMap(P=>[Number((P==null?void 0:P.oldNumber)||0),Number((P==null?void 0:P.newNumber)||0)]).filter(P=>P>0);if(!d.length)return{start:0,end:0,label:""};const k=Math.min(...d),A=Math.max(...d);return{start:k,end:A,label:k===A?`L${k}`:`L${k}-L${A}`}}function C(n=[]){return n.map(d=>String((d==null?void 0:d.content)||"")).join(`
@@ -0,0 +1 @@
1
+ import{aD as l,aE as c,aF as e,aQ as a,u as i,aR as j,aS as F,aL as I,aV as Ht,aI as T,aN as v,c as x,w as at,ak as qt,aJ as it,aG as K,aW as U,b2 as Kt,aY as ot,aX as fe,b3 as Wt,b as m,r as be}from"./vendor-misc-u-M8sNMf.js";import{k as Q,m as zt,j as Jt,n as Gt}from"./WorkbenchView-gbRu02Lv.js";import{u as mt,b as Yt,W as De,c as Qt,f as Xt,d as lt}from"./index-5LxHpYf5.js";import{b as gt,K as Ce,L as ue,H as rt,E as Zt,g as es,J as ct,t as ts,N as ss,x as ns}from"./vendor-ui-BglsaDbv.js";import"./vendor-markdown-9aQhqbjm.js";import"./vendor-tiptap-rwYdQb1L.js";import"./vendor-router-Dn8q3tJM.js";function as(){return Q("/api/relay/config",{cache:"no-store"})}function dt(L){return Q("/api/relay/config",{method:"PUT",body:JSON.stringify(L)})}function is(){return Q("/api/relay/reconnect",{method:"POST"})}function os(){return Q("/api/system/config",{cache:"no-store"})}function ut(L){return Q("/api/system/config",{method:"PUT",body:JSON.stringify(L)})}function ls(){return Q("/api/diagnostics/runtime",{cache:"no-store"})}const rs={class:"space-y-4"},cs={class:"flex items-center justify-between gap-3"},ds={class:"theme-heading text-sm font-medium"},us={class:"theme-toggle-current theme-badge-muted theme-muted-text rounded-sm border border-dashed px-2 py-1 text-[11px]"},ms={class:"theme-muted-text theme-note-text mt-1"},gs={class:"space-y-4"},hs={class:"theme-muted-text px-1 text-[10px] font-medium uppercase tracking-[0.16em]"},vs=["onClick"],xs={class:"flex items-start gap-3"},ys={class:"mt-0.5 flex items-center gap-1.5"},ps={class:"min-w-0 flex-1"},_s={class:"flex items-center justify-between gap-2"},fs={class:"truncate text-sm font-medium"},bs={class:"theme-muted-text theme-note-text mt-1"},Ds={__name:"ThemeToggle",setup(L){const{currentTheme:X,setTheme:Z,themes:me}=Yt(),{t:R}=mt(),ke=x(()=>{const C=me.value.filter(y=>y.mode==="light"),ee=me.value.filter(y=>y.mode==="dark");return[{id:"light",label:R("theme.groupLight"),items:C},{id:"dark",label:R("theme.groupDark"),items:ee}].filter(y=>y.items.length)});function we(C){Z(C)}function s(C){return R(`theme.description.${C.id}`,{},C.description)}return(C,ee)=>(l(),c("div",rs,[e("div",null,[e("div",cs,[e("div",ds,a(i(R)("theme.heading")),1),e("div",us,a(i(R)("theme.currentTheme",{name:i(X).shortName})),1)]),e("div",ms,a(i(R)("theme.helper")),1)]),e("div",gs,[(l(!0),c(j,null,F(ke.value,y=>(l(),c("section",{key:y.id,class:"space-y-1.5"},[e("div",hs,a(y.label),1),(l(!0),c(j,null,F(y.items,b=>(l(),c("button",{key:b.id,type:"button",class:I(["theme-option theme-toggle-card w-full rounded-sm border px-3 py-2 text-left transition",b.id===i(X).id?"theme-option-active":"theme-option-idle"]),onClick:O=>we(b.id)},[e("div",xs,[e("div",ys,[(l(!0),c(j,null,F(b.swatches,(O,P)=>(l(),c("span",{key:`${b.id}-${P}`,class:"h-3 w-3 rounded-full border border-black/10",style:Ht({backgroundColor:O})},null,4))),128))]),e("div",ps,[e("div",_s,[e("span",fs,a(b.shortName),1),b.id===i(X).id?(l(),T(i(gt),{key:0,class:"h-4 w-4 shrink-0"})):v("",!0)]),e("div",bs,a(s(b)),1)])])],10,vs))),128))]))),128))])]))}},Cs={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ks={class:"settings-dialog-content min-h-0 flex-1 overflow-y-auto px-5 py-5"},ws={key:0,class:"space-y-4"},Ss={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},Ts={class:"settings-section-card space-y-4 px-4 py-4"},Rs={class:"theme-heading text-sm font-medium"},Ps={class:"theme-muted-text mt-1 text-xs leading-5"},Es={class:"grid gap-3"},Ms={class:"min-w-0"},Bs={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},Ns={class:"theme-muted-text mt-1 text-xs leading-5"},$s=["value","onChange"],Us={class:"settings-section-card space-y-4 px-4 py-4"},Is={class:"theme-heading text-sm font-medium"},js={class:"theme-muted-text mt-1 text-xs leading-5"},Fs={class:"settings-form-card flex items-center justify-between gap-3 px-3 py-3"},Ls={class:"min-w-0"},Os={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},As={class:"theme-muted-text mt-1 text-xs leading-5"},Vs={class:"settings-section-card space-y-4 px-4 py-4"},Hs={class:"theme-heading text-sm font-medium"},qs={class:"theme-muted-text mt-1 text-xs leading-5"},Ks={class:"space-y-1.5"},Ws={class:"theme-muted-text text-xs"},zs={class:"space-y-2"},Js={class:"min-w-0"},Gs={class:"truncate text-sm font-medium text-[var(--theme-textPrimary)]"},Ys={class:"theme-muted-text mt-1 truncate text-xs"},Qs=["checked","value","onChange"],Xs={class:"theme-muted-text theme-note-text"},Zs={class:"settings-section-card space-y-4 px-4 py-4"},en={class:"theme-heading text-sm font-medium"},tn={class:"theme-muted-text mt-1 text-xs leading-5"},sn={class:"space-y-1.5"},nn={class:"theme-muted-text text-xs"},an={class:"space-y-2"},on={class:"min-w-0"},ln={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},rn={class:"theme-muted-text mt-1 text-xs leading-5"},cn=["checked"],dn={class:"min-w-0"},un={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},mn={class:"theme-muted-text mt-1 text-xs leading-5"},gn=["checked"],hn={class:"min-w-0"},vn={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},xn={class:"theme-muted-text mt-1 text-xs leading-5"},yn=["checked"],pn={key:0,class:"space-y-1.5"},_n={class:"theme-muted-text text-xs"},fn=["placeholder"],bn={key:0,class:"theme-muted-text text-xs leading-5"},Dn={class:"theme-muted-text text-xs leading-5"},Cn={class:"settings-form-card px-3 py-3"},kn={class:"text-xs leading-5 text-[var(--theme-warningText)]"},wn={class:"settings-form-footer flex flex-wrap items-center justify-end gap-3"},Sn={class:"flex flex-wrap items-center gap-2"},Tn=["disabled"],Rn={key:1,class:"space-y-4"},Pn={class:"theme-heading text-base font-medium"},En={class:"theme-muted-text mt-1 text-xs leading-5"},Mn={class:"settings-section-card px-4 py-4"},Bn={key:2,class:"space-y-4"},Nn={class:"flex items-start justify-between gap-3"},$n={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},Un={class:"settings-section-card space-y-4 px-4 py-4"},In={class:"settings-form-card flex items-center justify-between gap-3 px-3 py-2"},jn={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},Fn={class:"theme-muted-text mt-1 text-xs"},Ln=["disabled"],On={class:"grid gap-4 sm:grid-cols-2"},An={class:"space-y-1.5 sm:col-span-2"},Vn={class:"theme-muted-text text-xs"},Hn=["disabled"],qn={class:"space-y-1.5"},Kn={class:"theme-muted-text text-xs"},Wn=["disabled"],zn={class:"space-y-1.5"},Jn={class:"theme-muted-text text-xs"},Gn={class:"relative"},Yn=["type","placeholder","disabled"],Qn=["disabled"],Xn={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},Zn={class:"min-w-0 space-y-1"},ea={key:0,class:"theme-danger-text theme-note-text"},ta={key:1,class:"theme-status-warning theme-note-text"},sa={key:2,class:"theme-danger-text theme-note-text"},na={key:3,class:"theme-status-success theme-note-text"},aa={key:4,class:"theme-danger-text theme-note-text"},ia={key:5,class:"theme-muted-text theme-note-text"},oa={key:6,class:"theme-muted-text theme-note-text"},la={key:7,class:"theme-muted-text theme-note-text"},ra={key:8,class:"theme-status-success theme-note-text"},ca={key:9,class:"theme-muted-text theme-note-text"},da={class:"flex flex-wrap items-center gap-2"},ua=["disabled"],ma=["disabled"],ga=["disabled"],ha={key:3,class:"space-y-4"},va={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},xa={class:"theme-muted-text mt-1 text-xs leading-5"},ya={class:"settings-section-card space-y-4 px-4 py-4"},pa={class:"space-y-1.5"},_a={class:"theme-muted-text text-xs"},fa=["disabled"],ba={class:"theme-muted-text text-xs leading-5"},Da={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},Ca={class:"min-w-0 space-y-1"},ka={key:0,class:"theme-status-warning theme-note-text"},wa={key:1,class:"theme-danger-text theme-note-text"},Sa={key:2,class:"theme-status-success theme-note-text"},Ta={key:3,class:"theme-muted-text theme-note-text"},Ra={class:"flex flex-wrap items-center gap-2"},Pa=["disabled"],Ea={class:"settings-section-card space-y-4 px-4 py-4"},Ma={class:"flex flex-wrap items-start justify-between gap-3"},Ba={class:"theme-heading text-sm font-medium"},Na={class:"theme-muted-text mt-1 text-xs leading-5"},$a={class:"flex flex-wrap items-center gap-2"},Ua=["disabled"],Ia={class:"min-w-0 space-y-1"},ja={key:0,class:"theme-danger-text theme-note-text"},Fa={key:1,class:"theme-status-success theme-note-text"},La={key:2,class:"theme-muted-text theme-note-text"},Oa={key:0,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4"},Aa={class:"settings-form-card space-y-1 px-3 py-3"},Va={class:"theme-heading text-lg font-medium"},Ha={class:"theme-muted-text text-xs"},qa={class:"settings-form-card space-y-1 px-3 py-3"},Ka={class:"theme-heading text-lg font-medium"},Wa={class:"theme-muted-text text-xs"},za={class:"settings-form-card space-y-1 px-3 py-3"},Ja={class:"theme-heading text-lg font-medium"},Ga={class:"theme-muted-text text-xs"},Ya={class:"settings-form-card space-y-1 px-3 py-3"},Qa={class:"theme-heading text-lg font-medium"},Xa={class:"theme-muted-text text-xs"},Za={key:1,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4"},ei={class:"settings-form-card space-y-1 px-3 py-3"},ti={class:"theme-heading text-lg font-medium"},si={class:"theme-muted-text text-xs"},ni={class:"settings-form-card space-y-1 px-3 py-3"},ai={class:"theme-heading text-lg font-medium"},ii={class:"theme-muted-text text-xs"},oi={class:"settings-form-card space-y-1 px-3 py-3"},li={class:"theme-heading text-lg font-medium"},ri={class:"theme-muted-text text-xs"},ci={class:"settings-form-card space-y-1 px-3 py-3"},di={class:"theme-heading text-lg font-medium"},ui={class:"theme-muted-text text-xs"},mi={key:2,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3"},gi={class:"settings-form-card space-y-1 px-3 py-3"},hi={class:"theme-heading text-lg font-medium"},vi={class:"theme-muted-text text-xs"},xi={class:"settings-form-card space-y-1 px-3 py-3"},yi={class:"theme-heading text-lg font-medium"},pi={class:"theme-muted-text text-xs"},_i={class:"settings-form-card space-y-1 px-3 py-3"},fi={class:"theme-heading text-sm font-medium"},bi={class:"theme-muted-text text-xs"},Di={class:"grid gap-4 lg:grid-cols-2"},Ci={class:"settings-form-card space-y-3 px-3 py-3"},ki={class:"theme-heading text-sm font-medium"},wi={class:"space-y-2 text-xs"},Si={class:"flex items-center justify-between gap-3"},Ti={class:"truncate text-right text-[var(--theme-textPrimary)]"},Ri={class:"flex items-center justify-between gap-3"},Pi={class:"text-right text-[var(--theme-textPrimary)]"},Ei={class:"flex items-center justify-between gap-3"},Mi={class:"text-right text-[var(--theme-textPrimary)]"},Bi={class:"flex items-center justify-between gap-3"},Ni={class:"text-right text-[var(--theme-textPrimary)]"},$i={class:"flex items-center justify-between gap-3"},Ui={class:"text-right text-[var(--theme-textPrimary)]"},Ii={class:"settings-form-card space-y-3 px-3 py-3"},ji={class:"theme-heading text-sm font-medium"},Fi={class:"space-y-2 text-xs"},Li={class:"theme-muted-text"},Oi={class:"text-[var(--theme-textPrimary)]"},Ai={key:3,class:"settings-form-card space-y-3 px-3 py-3"},Vi={class:"theme-heading text-sm font-medium"},Hi={class:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3 text-xs"},qi={class:"theme-muted-text"},Ki={class:"text-[var(--theme-textPrimary)]"},Wi={key:4,class:"settings-form-card space-y-2 px-3 py-3"},zi={class:"theme-heading text-sm font-medium"},Ji={class:"theme-muted-text text-xs leading-5"},Gi={class:"theme-muted-text text-xs leading-5"},Yi={key:4,class:"space-y-4"},Qi={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},Xi={class:"theme-muted-text mt-1 text-xs leading-5"},Zi={class:"settings-section-card space-y-3 px-4 py-4"},eo={class:"min-w-0"},to={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},so={class:"theme-muted-text mt-1 text-xs leading-5"},no={class:"flex flex-wrap items-center gap-2"},ao={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] px-2.5 py-1 text-xs font-medium text-[var(--theme-textPrimary)]"},io={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] px-2.5 py-1 text-xs font-medium text-[var(--theme-textPrimary)]"},oo={class:"theme-muted-text theme-note-text"},lo={key:5,class:"space-y-4"},ro={class:"theme-heading text-base font-medium"},co={class:"theme-muted-text mt-1 text-xs leading-5"},uo={class:"settings-section-card px-4 py-4"},mo={class:"flex items-center justify-between gap-3"},go={class:"theme-heading text-sm font-medium"},ho={class:"theme-muted-text mt-1 text-xs leading-5"},vo={class:"theme-badge-strong rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium"},Co={__name:"WorkbenchSettingsDialog",props:{open:{type:Boolean,default:!1}},emits:["close"],setup(L,{emit:X}){const Z=L,me=X,{locale:R,localeOptions:ke,setLocale:we,t:s}=mt(),{getPreference:C,setPreference:ee}=Qt(),y=m(""),b=m(!1),O=m(""),P=m(!1),A=m(!1),E=m(!1),_=m(""),k=m(""),ge=m(!1),W=m(!1),M=m(""),te=m(""),se=m(!1),z=m(!1),he=m(!1),J=m(!1),ne=m(""),w=m(null),u=m(null),f=m(!1),G=be({runnerMaxConcurrentRuns:!1}),ae=m(!1),ve=m(!1),xe=m(!1),ye=m(!1),d=be({enabled:!1,relayUrl:"",deviceId:"",deviceToken:""}),Y=be({runnerMaxConcurrentRuns:3}),h=be({sendBehavior:"",notificationSoundEnabled:!1,remoteCommandSecurityMode:"disabled",trustedProxyToken:""}),S=m("general");let V=null,H=null,pe=null,ie=null;const ht=x(()=>[{id:"general",label:s("settingsDialog.general.sectionLabel"),description:s("settingsDialog.general.sectionDescription"),icon:Ce},{id:"theme",label:s("theme.title"),description:s("theme.sectionDescription"),icon:ss},{id:"relay",label:s("settingsDialog.relay.sectionLabel"),description:s("settingsDialog.relay.sectionDescription"),icon:rt},{id:"system",label:s("settingsDialog.system.sectionLabel"),description:s("settingsDialog.system.sectionDescription"),icon:ct},{id:"shortcuts",label:s("settingsDialog.shortcuts.sectionLabel"),description:s("settingsDialog.shortcuts.sectionDescription"),icon:Ce},{id:"about",label:s("settingsDialog.about.sectionLabel"),description:s("settingsDialog.about.sectionDescription"),icon:ns}]),vt=x(()=>lt.map(t=>({value:t.value,label:s(t.labelKey),description:s(t.descriptionKey)})));function xt(t=null,n=""){const o=String((t==null?void 0:t.messageKey)||"").trim();if(o){const g=s(o);if(g&&g!==o)return g}return String((t==null?void 0:t.message)||"").trim()||(n?s(n):"")}function _e(t="",n=""){const o=String(t||"").trim();if(o){const g=`settingsDialog.relay.reason.${o}`,D=s(g);if(D!==g)return D}return String(n||"").trim()||s("common.notAvailable")}function yt(t=null){const n=String((t==null?void 0:t.type)||"").trim()||"unknown",o=`settingsDialog.relay.event.${n}`,g=s(o);return g!==o?g:n}function pt(t=null){const n=String((t==null?void 0:t.lastErrorKey)||"").trim(),o=t!=null&&t.lastErrorParams&&typeof t.lastErrorParams=="object"?t.lastErrorParams:{};return n==="connect_failed"?s("settingsDialog.relay.error.connect_failed"):n==="disconnected"?s("settingsDialog.relay.error.disconnected",{reason:_e(o.reasonCode,t==null?void 0:t.lastCloseReason)}):n==="rejected"?s("settingsDialog.relay.error.rejected",{reason:_e(o.reasonCode,t==null?void 0:t.lastCloseReason)}):n==="closed_with_code"?s("settingsDialog.relay.error.closedWithCode",{code:o.code||(t==null?void 0:t.lastCloseCode)||0}):String((t==null?void 0:t.lastError)||"").trim()}const _t=x(()=>{var t,n,o,g;return E.value?s("settingsDialog.relay.status.reconnecting"):A.value||ae.value?s("settingsDialog.relay.status.saving"):P.value?s("settingsDialog.relay.status.loading"):(t=u.value)!=null&&t.reconnectPaused?s("settingsDialog.relay.status.paused"):(n=u.value)!=null&&n.connected?s("settingsDialog.relay.status.connected"):(((o=u.value)==null?void 0:o.enabled)??d.enabled)&&Number(((g=u.value)==null?void 0:g.nextReconnectDelayMs)||0)>0?s("settingsDialog.relay.status.waitingReconnect"):d.enabled?s("settingsDialog.relay.status.disconnected"):s("settingsDialog.relay.status.disabled")}),ft=x(()=>{var t,n;return(t=u.value)!=null&&t.reconnectPaused?"theme-status-danger":(n=u.value)!=null&&n.connected?"theme-status-success":d.enabled?"theme-status-warning":"theme-status-neutral"}),bt=x(()=>[{id:"open-settings",label:s("settingsDialog.shortcuts.openSettingsTitle"),description:s("settingsDialog.shortcuts.openSettingsDescription"),mac:"⌘ ⇧ ,",windows:"Ctrl + Shift + ,"},{id:"open-project-manager",label:s("settingsDialog.shortcuts.openProjectManagerTitle"),description:s("settingsDialog.shortcuts.openProjectManagerDescription"),mac:"⌘ ⇧ K",windows:"Ctrl + Shift + K"},{id:"open-source-browser",label:s("settingsDialog.shortcuts.openSourceBrowserTitle"),description:s("settingsDialog.shortcuts.openSourceBrowserDescription"),mac:"⌘ ⇧ O",windows:"Ctrl + Shift + O"},{id:"open-diff-review",label:s("settingsDialog.shortcuts.openDiffReviewTitle"),description:s("settingsDialog.shortcuts.openDiffReviewDescription"),mac:"⌘ ⇧ D",windows:"Ctrl + Shift + D"},{id:"close-top-dialog",label:s("settingsDialog.shortcuts.closeTopDialogTitle"),description:s("settingsDialog.shortcuts.closeTopDialogDescription"),mac:"Esc",windows:"Esc"}]),Dt=x(()=>{var t,n,o;return!f.value&&!_.value&&!k.value&&!((t=u.value)!=null&&t.lastError)&&!((n=u.value)!=null&&n.lastCloseReason)&&!((o=u.value)!=null&&o.lastConnectedAt)}),Ct=x(()=>{const t=d.deviceToken?`${"*".repeat(Math.max(0,d.deviceToken.length-4))}${d.deviceToken.slice(-4)}`:"";return JSON.stringify({generatedAt:new Date().toISOString(),source:"local-settings",config:{enabled:d.enabled,relayUrl:d.relayUrl,deviceId:d.deviceId,deviceTokenMasked:t,managedByEnv:f.value},status:u.value||null},null,2)}),q=x(()=>{var t,n;return((n=(t=w.value)==null?void 0:t.runner)==null?void 0:n.runner)||null}),oe=x(()=>{var t,n;return!!((n=(t=w.value)==null?void 0:t.runner)!=null&&n.ok&&q.value)}),p=x(()=>{var t;return((t=q.value)==null?void 0:t.metrics)||null}),Me=x(()=>{var t;return((t=w.value)==null?void 0:t.recovery)||null}),Be=x(()=>{var t;return((t=w.value)==null?void 0:t.maintenance)||null}),kt=x(()=>{var t;return((t=w.value)==null?void 0:t.gitDiffWorker)||null}),wt=x(()=>JSON.stringify({generatedAt:new Date().toISOString(),source:"local-settings",config:{runner:{maxConcurrentRuns:Y.runnerMaxConcurrentRuns,managedByEnv:G.runnerMaxConcurrentRuns}},diagnostics:w.value||null},null,2));function le(t){const n=String(t||"").trim();if(!n)return s("common.notAvailable");const o=new Date(n);return Number.isNaN(o.getTime())?n:Xt(o.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}const St=x(()=>{var t,n,o,g,D,B,N,$;return[{key:"queued_cancelled",label:s("settingsDialog.system.stopReasons.queued_cancelled"),value:Math.max(0,Number((n=(t=p.value)==null?void 0:t.stopReasons)==null?void 0:n.queued_cancelled)||0)},{key:"user_requested",label:s("settingsDialog.system.stopReasons.user_requested"),value:Math.max(0,Number((g=(o=p.value)==null?void 0:o.stopReasons)==null?void 0:g.user_requested)||0)},{key:"user_requested_after_error",label:s("settingsDialog.system.stopReasons.user_requested_after_error"),value:Math.max(0,Number((B=(D=p.value)==null?void 0:D.stopReasons)==null?void 0:B.user_requested_after_error)||0)},{key:"stop_timeout",label:s("settingsDialog.system.stopReasons.stop_timeout"),value:Math.max(0,Number(($=(N=p.value)==null?void 0:N.stopReasons)==null?void 0:$.stop_timeout)||0)}]}),Tt=x(()=>{var t,n,o,g,D,B,N,$,ce,de;return[{key:"runner_timeout_without_stop_request",label:s("settingsDialog.system.stopTimeoutPhases.runner_timeout_without_stop_request"),value:Math.max(0,Number((n=(t=p.value)==null?void 0:t.stopTimeoutPhases)==null?void 0:n.runner_timeout_without_stop_request)||0)},{key:"runner_timeout_before_cancel",label:s("settingsDialog.system.stopTimeoutPhases.runner_timeout_before_cancel"),value:Math.max(0,Number((g=(o=p.value)==null?void 0:o.stopTimeoutPhases)==null?void 0:g.runner_timeout_before_cancel)||0)},{key:"cli_not_exiting",label:s("settingsDialog.system.stopTimeoutPhases.cli_not_exiting"),value:Math.max(0,Number((B=(D=p.value)==null?void 0:D.stopTimeoutPhases)==null?void 0:B.cli_not_exiting)||0)},{key:"os_kill_slow",label:s("settingsDialog.system.stopTimeoutPhases.os_kill_slow"),value:Math.max(0,Number(($=(N=p.value)==null?void 0:N.stopTimeoutPhases)==null?void 0:$.os_kill_slow)||0)},{key:"runner_finalize_after_exit",label:s("settingsDialog.system.stopTimeoutPhases.runner_finalize_after_exit"),value:Math.max(0,Number((de=(ce=p.value)==null?void 0:ce.stopTimeoutPhases)==null?void 0:de.runner_finalize_after_exit)||0)}]}),Rt=x(()=>ke.value.map(t=>({value:t.value,label:t.value==="zh-CN"?s("locale.zhHans"):s("locale.enUs"),englishLabel:t.englishLabel})));async function Pt(){b.value=!0,O.value="";try{const t=await Gt(),n=String((t==null?void 0:t.version)||"").trim();y.value=n,n||(O.value=s("settingsDialog.about.versionPending"))}catch(t){y.value="",O.value=(t==null?void 0:t.message)||s("settingsDialog.about.versionLoadFailed")}finally{b.value=!1}}function Se(t={}){d.enabled=!!(t!=null&&t.enabled),d.relayUrl=String((t==null?void 0:t.relayUrl)||""),d.deviceId=String((t==null?void 0:t.deviceId)||""),d.deviceToken=String((t==null?void 0:t.deviceToken)||"")}function Te(t={}){var n,o,g;Y.runnerMaxConcurrentRuns=Math.max(1,Number((n=t==null?void 0:t.runner)==null?void 0:n.maxConcurrentRuns)||3),h.remoteCommandSecurityMode=String(((o=t==null?void 0:t.remoteCommandSecurity)==null?void 0:o.mode)||"disabled").trim()||"disabled",h.trustedProxyToken="",he.value=!!((g=t==null?void 0:t.remoteCommandSecurity)!=null&&g.trustedProxyTokenConfigured)}function Et(){var t;h.sendBehavior=String(C(De.SEND_BEHAVIOR)||((t=lt[1])==null?void 0:t.value)||""),h.notificationSoundEnabled=!!C(De.NOTIFICATION_SOUND_ENABLED)}async function Ne(){P.value=!0,_.value="",k.value="";try{const t=await as();Se((t==null?void 0:t.config)||{}),f.value=!!(t!=null&&t.managedByEnv),u.value=(t==null?void 0:t.relay)||null}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayConfigLoadFailed"),u.value=null}finally{P.value=!1}}async function Mt(){var t,n;ge.value=!0,M.value="",te.value="";try{const o=await os();Te((o==null?void 0:o.config)||{}),G.runnerMaxConcurrentRuns=!!((n=(t=o==null?void 0:o.managedByEnv)==null?void 0:t.runner)!=null&&n.maxConcurrentRuns),re()}catch(o){M.value=(o==null?void 0:o.message)||s("settingsDialog.system.systemConfigLoadFailed")}finally{ge.value=!1}}async function re(){J.value=!0,ne.value="";try{w.value=await ls()}catch(t){ne.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemDiagnosticsLoadFailed")}finally{J.value=!1}}async function Bt(){A.value=!0,_.value="",k.value="";try{const t=await dt({enabled:d.enabled,relayUrl:d.relayUrl,deviceId:d.deviceId,deviceToken:d.deviceToken});Se((t==null?void 0:t.config)||{}),f.value=!!(t!=null&&t.managedByEnv),u.value=(t==null?void 0:t.relay)||null,k.value=d.enabled?s("settingsDialog.relay.relayConfigSavedEnabled"):s("settingsDialog.relay.relayConfigSavedDisabled")}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayConfigSaveFailed")}finally{A.value=!1}}async function Nt(){E.value=!0,_.value="",k.value="";try{const t=await is();u.value=(t==null?void 0:t.relay)||null,k.value=s("settingsDialog.relay.relayReconnectTriggered"),setTimeout(()=>{Ne()},1200)}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayReconnectFailed")}finally{E.value=!1}}async function $t(){var t,n;W.value=!0,M.value="",te.value="";try{const o=await ut({runner:{maxConcurrentRuns:Y.runnerMaxConcurrentRuns}});Te((o==null?void 0:o.config)||{}),G.runnerMaxConcurrentRuns=!!((n=(t=o==null?void 0:o.managedByEnv)==null?void 0:t.runner)!=null&&n.maxConcurrentRuns),te.value=s("settingsDialog.system.systemConfigSaved"),re()}catch(o){M.value=(o==null?void 0:o.message)||s("settingsDialog.system.systemConfigSaveFailed")}finally{W.value=!1}}function $e(){ie&&(clearTimeout(ie),ie=null),z.value=!1}async function Ut(){se.value=!0,M.value="";try{const t=await ut({remoteCommandSecurity:It()});Te((t==null?void 0:t.config)||{}),$e(),z.value=!0,ie=setTimeout(()=>{z.value=!1,ie=null},1200)}catch(t){M.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemConfigSaveFailed")}finally{se.value=!1}}function It(){const t={mode:h.remoteCommandSecurityMode},n=String(h.trustedProxyToken||"").trim();return h.remoteCommandSecurityMode==="trusted-proxy"&&n&&(t.trustedProxyToken=n),t}function Re(t){h.remoteCommandSecurityMode=t}function jt(){return!!(String(d.relayUrl||"").trim()&&String(d.deviceId||"").trim()&&String(d.deviceToken||"").trim())}async function Ft(){var t;if(!f.value){if(_.value="",k.value="",d.enabled&&!jt()){d.enabled=!1,_.value=s("settingsDialog.relay.relayFieldsRequired");return}ae.value=!0;try{const n=await dt({enabled:d.enabled,relayUrl:d.relayUrl,deviceId:d.deviceId,deviceToken:d.deviceToken});Se((n==null?void 0:n.config)||{}),f.value=!!(n!=null&&n.managedByEnv),u.value=(n==null?void 0:n.relay)||null,k.value=d.enabled?s("settingsDialog.relay.relayEnabledSaved"):s("settingsDialog.relay.relayConfigSavedDisabled")}catch(n){d.enabled=!!((t=u.value)!=null&&t.enabled),_.value=(n==null?void 0:n.message)||s("settingsDialog.relay.relayToggleFailed")}finally{ae.value=!1}}}async function Ue(t){var o;if((o=navigator.clipboard)!=null&&o.writeText&&window.isSecureContext){await navigator.clipboard.writeText(t);return}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}async function Lt(){try{await Ue(Ct.value),xe.value=!0,V&&clearTimeout(V),V=setTimeout(()=>{xe.value=!1,V=null},2e3)}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayDiagnosticsCopyFailed")}}async function Ot(){try{await Ue(wt.value),ye.value=!0,H&&clearTimeout(H),H=setTimeout(()=>{ye.value=!1,H=null},2e3)}catch(t){ne.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemDiagnosticsCopyFailed")}}function At(t){we(t)}function Pe(){pe&&(clearInterval(pe),pe=null)}function Vt(){Pe(),!(!Z.open||S.value!=="system")&&(re(),pe=setInterval(()=>{re()},5e3))}return at(()=>Z.open,t=>{if(t){S.value="general",Et(),Pt(),Ne(),Mt();return}},{immediate:!0}),at([()=>Z.open,S],([t,n])=>{if(t&&n==="system"){Vt();return}Pe()},{immediate:!0}),qt(()=>{V&&(clearTimeout(V),V=null),H&&(clearTimeout(H),H=null),$e(),Pe()}),(t,n)=>(l(),T(Jt,{open:L.open,"stack-level":2,"panel-class":"settings-dialog-panel h-[calc(100dvh-1rem)] max-w-5xl sm:h-[96vh] sm:max-h-[96vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body min-h-0 flex flex-1 flex-col sm:flex-row",onClose:n[14]||(n[14]=o=>me("close"))},{title:it(()=>[e("div",Cs,[K(i(ts),{class:"h-4 w-4"}),e("span",null,a(i(s)("common.settings")),1)])]),default:it(()=>{var o,g,D,B,N,$,ce,de,Ie,je,Fe,Le,Oe,Ae,Ve,He,qe,Ke,We,ze,Je,Ge,Ye,Qe,Xe,Ze,et,tt,st,nt;return[K(zt,{modelValue:S.value,"onUpdate:modelValue":n[0]||(n[0]=r=>S.value=r),sections:ht.value},null,8,["modelValue","sections"]),e("div",ks,[S.value==="general"?(l(),c("section",ws,[e("div",null,[e("div",Ss,[K(i(Ce),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.general.title")),1)])]),e("section",Ts,[e("div",null,[e("div",Rs,a(i(s)("settingsDialog.general.sendBehavior.title")),1),e("p",Ps,a(i(s)("settingsDialog.general.sendBehavior.description")),1)]),e("div",Es,[(l(!0),c(j,null,F(vt.value,r=>(l(),c("label",{key:r.value,class:I(["settings-form-card flex cursor-pointer items-start justify-between gap-3 px-3 py-3",h.sendBehavior===r.value?"ring-1 ring-[var(--theme-accent)]":""])},[e("div",Ms,[e("div",Bs,a(r.label),1),e("p",Ns,a(r.description),1)]),U(e("input",{"onUpdate:modelValue":n[1]||(n[1]=Ee=>h.sendBehavior=Ee),value:r.value,type:"radio",name:"workbench-send-behavior",class:"mt-0.5 h-4 w-4 shrink-0",onChange:Ee=>i(ee)(i(De).SEND_BEHAVIOR,r.value)},null,40,$s),[[Kt,h.sendBehavior]])],2))),128))])]),e("section",Us,[e("div",null,[e("div",Is,a(i(s)("settingsDialog.general.notificationSound.title")),1),e("p",js,a(i(s)("settingsDialog.general.notificationSound.description")),1)]),e("label",Fs,[e("div",Ls,[e("div",Os,a(i(s)("settingsDialog.general.notificationSound.switchLabel")),1),e("p",As,a(i(s)("settingsDialog.general.notificationSound.switchHint")),1)]),U(e("input",{"onUpdate:modelValue":n[2]||(n[2]=r=>h.notificationSoundEnabled=r),type:"checkbox",class:"h-4 w-4 shrink-0",onChange:n[3]||(n[3]=r=>i(ee)(i(De).NOTIFICATION_SOUND_ENABLED,h.notificationSoundEnabled))},null,544),[[ot,h.notificationSoundEnabled]])])]),e("section",Vs,[e("div",null,[e("div",Hs,a(i(s)("locale.title")),1),e("p",qs,a(i(s)("locale.description")),1)]),e("div",Ks,[e("span",Ws,a(i(s)("locale.field")),1),e("div",zs,[(l(!0),c(j,null,F(Rt.value,r=>(l(),c("label",{key:r.value,class:I(["settings-form-card flex cursor-pointer items-center justify-between gap-3 px-3 py-3",i(R)===r.value?"ring-1 ring-[var(--theme-accent)]":""])},[e("div",Js,[e("div",Gs,a(r.label),1),e("div",Ys,a(r.englishLabel),1)]),e("input",{checked:i(R)===r.value,value:r.value,name:"promptx-locale",type:"radio",class:"h-4 w-4 shrink-0",onChange:Ee=>At(r.value)},null,40,Qs)],2))),128))])]),e("p",Xs,a(i(s)("locale.immediateHint")),1)]),e("section",Zs,[e("div",null,[e("div",en,a(i(s)("settingsDialog.general.remoteCommandSecurityTitle")),1),e("p",tn,a(i(s)("settingsDialog.general.remoteCommandSecurityDescription")),1)]),e("div",sn,[e("span",nn,a(i(s)("settingsDialog.general.remoteCommandSecurityModeField")),1),e("div",an,[e("label",{class:I(["settings-form-card flex cursor-pointer items-start justify-between gap-3 px-3 py-3",h.remoteCommandSecurityMode==="disabled"?"ring-1 ring-[var(--theme-primary)]":""])},[e("div",on,[e("div",ln,a(i(s)("settingsDialog.general.remoteCommandSecurityModeDisabled")),1),e("p",rn,a(i(s)("settingsDialog.general.remoteCommandSecurityModeDisabledDescription")),1)]),e("input",{checked:h.remoteCommandSecurityMode==="disabled",type:"checkbox",class:"mt-0.5 h-4 w-4 shrink-0",onChange:n[4]||(n[4]=r=>Re("disabled"))},null,40,cn)],2),e("label",{class:I(["settings-form-card flex cursor-pointer items-start justify-between gap-3 px-3 py-3",h.remoteCommandSecurityMode==="relay"?"ring-1 ring-[var(--theme-primary)]":""])},[e("div",dn,[e("div",un,a(i(s)("settingsDialog.general.remoteCommandSecurityModeRelay")),1),e("p",mn,a(i(s)("settingsDialog.general.remoteCommandSecurityModeRelayDescription")),1)]),e("input",{checked:h.remoteCommandSecurityMode==="relay",type:"checkbox",class:"mt-0.5 h-4 w-4 shrink-0",onChange:n[5]||(n[5]=r=>Re("relay"))},null,40,gn)],2),e("label",{class:I(["settings-form-card flex cursor-pointer items-start justify-between gap-3 px-3 py-3",h.remoteCommandSecurityMode==="trusted-proxy"?"ring-1 ring-[var(--theme-primary)]":""])},[e("div",hn,[e("div",vn,a(i(s)("settingsDialog.general.remoteCommandSecurityModeTrustedProxy")),1),e("p",xn,a(i(s)("settingsDialog.general.remoteCommandSecurityModeTrustedProxyDescription")),1)]),e("input",{checked:h.remoteCommandSecurityMode==="trusted-proxy",type:"checkbox",class:"mt-0.5 h-4 w-4 shrink-0",onChange:n[6]||(n[6]=r=>Re("trusted-proxy"))},null,40,yn)],2)])]),h.remoteCommandSecurityMode==="trusted-proxy"?(l(),c("label",pn,[e("span",_n,a(i(s)("settingsDialog.general.trustedProxyTokenField")),1),U(e("input",{"onUpdate:modelValue":n[7]||(n[7]=r=>h.trustedProxyToken=r),type:"password",class:"tool-input",placeholder:he.value?i(s)("settingsDialog.general.trustedProxyTokenReplacePlaceholder"):i(s)("settingsDialog.general.trustedProxyTokenPlaceholder")},null,8,fn),[[fe,h.trustedProxyToken]]),he.value?(l(),c("p",bn,a(i(s)("settingsDialog.general.trustedProxyTokenConfiguredHint")),1)):v("",!0),e("p",Dn,a(he.value?i(s)("settingsDialog.general.trustedProxyTokenReplaceHint"):i(s)("settingsDialog.general.trustedProxyTokenHint")),1)])):v("",!0),e("div",Cn,[e("p",kn,a(i(s)("settingsDialog.general.remoteCommandSecurityWarning")),1)]),e("div",wn,[e("div",Sn,[e("button",{type:"button",class:I(["tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",z.value?"tool-button-accent-subtle":"tool-button-primary"]),disabled:se.value,onClick:Ut},[se.value?(l(),T(i(ue),{key:0,class:"h-4 w-4 animate-spin"})):z.value?(l(),T(i(gt),{key:1,class:"h-4 w-4"})):v("",!0),e("span",null,a(se.value?i(s)("common.saving"):z.value?i(s)("settingsDialog.general.remoteCommandSecuritySaved"):i(s)("settingsDialog.general.remoteCommandSecuritySave")),1)],10,Tn)])])])])):S.value==="theme"?(l(),c("section",Rn,[e("div",null,[e("div",Pn,a(i(s)("theme.title")),1),e("p",En,a(i(s)("theme.sectionDescription")),1)]),e("section",Mn,[K(Ds)])])):S.value==="relay"?(l(),c("section",Bn,[e("div",Nn,[e("div",null,[e("div",$n,[K(i(rt),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.relay.title")),1)])]),e("span",{class:I(["rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium",ft.value])},a(_t.value),3)]),e("section",Un,[e("label",In,[e("div",null,[e("div",jn,a(i(s)("settingsDialog.relay.enableTitle")),1),e("p",Fn,a(i(s)("settingsDialog.relay.enableDescription")),1)]),U(e("input",{"onUpdate:modelValue":n[8]||(n[8]=r=>d.enabled=r),type:"checkbox",class:"h-4 w-4",disabled:f.value,onChange:Ft},null,40,Ln),[[ot,d.enabled]])]),e("div",On,[e("label",An,[e("span",Vn,a(i(s)("settingsDialog.relay.relayUrl")),1),U(e("input",{"onUpdate:modelValue":n[9]||(n[9]=r=>d.relayUrl=r),type:"text",placeholder:"https://user1.promptx.example.com",class:"tool-input",disabled:f.value},null,8,Hn),[[fe,d.relayUrl]])]),e("label",qn,[e("span",Kn,a(i(s)("settingsDialog.relay.deviceId")),1),U(e("input",{"onUpdate:modelValue":n[10]||(n[10]=r=>d.deviceId=r),type:"text",placeholder:"my-macbook",class:"tool-input",disabled:f.value},null,8,Wn),[[fe,d.deviceId]])]),e("label",zn,[e("span",Jn,a(i(s)("settingsDialog.relay.deviceToken")),1),e("div",Gn,[U(e("input",{"onUpdate:modelValue":n[11]||(n[11]=r=>d.deviceToken=r),type:ve.value?"text":"password",placeholder:i(s)("settingsDialog.relay.deviceTokenPlaceholder"),class:"tool-input pr-10",disabled:f.value},null,8,Yn),[[Wt,d.deviceToken]]),e("button",{type:"button",class:"theme-icon-button absolute inset-y-1 right-1 flex h-auto w-8 items-center justify-center",disabled:f.value,onClick:n[12]||(n[12]=r=>ve.value=!ve.value)},[ve.value?(l(),T(i(es),{key:1,class:"h-4 w-4"})):(l(),T(i(Zt),{key:0,class:"h-4 w-4"}))],8,Qn)])])]),e("div",Xn,[e("div",Zn,[(o=u.value)!=null&&o.reconnectPausedReason?(l(),c("p",ea,a(i(s)("settingsDialog.relay.pausedReconnect",{reason:_e(u.value.reconnectPausedReasonCode,u.value.reconnectPausedReason)})),1)):v("",!0),f.value?(l(),c("p",ta,a(i(s)("settingsDialog.relay.managedByEnv")),1)):v("",!0),_.value?(l(),c("p",sa,a(_.value),1)):k.value?(l(),c("p",na,a(k.value),1)):(g=u.value)!=null&&g.lastError?(l(),c("p",aa,a(i(s)("settingsDialog.relay.lastError",{value:pt(u.value)})),1)):(D=u.value)!=null&&D.lastCloseReason?(l(),c("p",ia,a(i(s)("settingsDialog.relay.lastClosed",{reason:_e(u.value.lastCloseReasonCode,u.value.lastCloseReason),code:u.value.lastCloseCode})),1)):(B=u.value)!=null&&B.lastConnectedAt?(l(),c("p",oa,a(i(s)("settingsDialog.relay.lastConnected",{value:le(u.value.lastConnectedAt)})),1)):v("",!0),($=(N=u.value)==null?void 0:N.recentEvents)!=null&&$.length?(l(),c("p",la,a(i(s)("settingsDialog.relay.recentEvent",{value:yt(u.value.recentEvents[0])})),1)):v("",!0),xe.value?(l(),c("p",ra,a(i(s)("settingsDialog.relay.copied")),1)):v("",!0),Dt.value?(l(),c("p",ca,a(i(s)("settingsDialog.relay.defaultHint")),1)):v("",!0)]),e("div",da,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:P.value||A.value||ae.value||E.value||!(((ce=u.value)==null?void 0:ce.enabled)??d.enabled),onClick:Nt},[E.value?(l(),T(i(ue),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(E.value?i(s)("settingsDialog.relay.reconnecting"):i(s)("settingsDialog.relay.reconnectNow")),1)],8,ua),e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:P.value||E.value,onClick:Lt},[e("span",null,a(xe.value?i(s)("settingsDialog.relay.diagnosticsCopied"):i(s)("settingsDialog.relay.copyDiagnostics")),1)],8,ma),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:P.value||A.value||ae.value||E.value||f.value,onClick:Bt},[A.value?(l(),T(i(ue),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(A.value?i(s)("common.saving"):i(s)("settingsDialog.relay.saveConfig")),1)],8,ga)])])])])):S.value==="system"?(l(),c("section",ha,[e("div",null,[e("div",va,[K(i(ct),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.system.title")),1)]),e("p",xa,a(i(s)("settingsDialog.system.intro")),1)]),e("section",ya,[e("label",pa,[e("span",_a,a(i(s)("settingsDialog.system.maxConcurrentRuns")),1),U(e("input",{"onUpdate:modelValue":n[13]||(n[13]=r=>Y.runnerMaxConcurrentRuns=r),type:"number",min:"1",max:"16",step:"1",class:"tool-input",disabled:G.runnerMaxConcurrentRuns||ge.value||W.value},null,8,fa),[[fe,Y.runnerMaxConcurrentRuns,void 0,{number:!0}]]),e("p",ba,a(i(s)("settingsDialog.system.maxConcurrentRunsHint")),1)]),e("div",Da,[e("div",Ca,[G.runnerMaxConcurrentRuns?(l(),c("p",ka,a(i(s)("settingsDialog.system.managedByEnv")),1)):M.value?(l(),c("p",wa,a(M.value),1)):te.value?(l(),c("p",Sa,a(te.value),1)):(l(),c("p",Ta,a(i(s)("settingsDialog.system.diagnosticsHint")),1))]),e("div",Ra,[e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:G.runnerMaxConcurrentRuns||ge.value||W.value,onClick:$t},[W.value?(l(),T(i(ue),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(W.value?i(s)("common.saving"):i(s)("settingsDialog.system.saveConfig")),1)],8,Pa)])])]),e("section",Ea,[e("div",Ma,[e("div",null,[e("div",Ba,a(i(s)("settingsDialog.system.runtimeDiagnostics")),1),e("p",Na,a(i(s)("settingsDialog.system.runtimeDiagnosticsHint")),1)]),e("div",$a,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:J.value,onClick:re},[J.value?(l(),T(i(ue),{key:0,class:"h-4 w-4 animate-spin"})):v("",!0),e("span",null,a(J.value?i(s)("settingsDialog.system.refreshingDiagnostics"):i(s)("settingsDialog.system.refreshDiagnostics")),1)],8,Ua),e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",onClick:Ot},[e("span",null,a(ye.value?i(s)("settingsDialog.system.diagnosticsCopied"):i(s)("settingsDialog.system.copyDiagnostics")),1)])])]),e("div",Ia,[ne.value?(l(),c("p",ja,a(ne.value),1)):ye.value?(l(),c("p",Fa,a(i(s)("settingsDialog.system.diagnosticsCopiedHint")),1)):(l(),c("p",La,a(i(s)("settingsDialog.system.diagnosticsHint")),1))]),oe.value?(l(),c("div",Oa,[e("div",Aa,[n[15]||(n[15]=e("div",{class:"theme-muted-text text-xs"},"active",-1)),e("div",Va,a(((de=q.value)==null?void 0:de.activeRunCount)||0),1),e("p",Ha,a(i(s)("settingsDialog.system.active")),1)]),e("div",qa,[n[16]||(n[16]=e("div",{class:"theme-muted-text text-xs"},"tracked",-1)),e("div",Ka,a(((Ie=q.value)==null?void 0:Ie.trackedRunCount)||0),1),e("p",Wa,a(i(s)("settingsDialog.system.tracked")),1)]),e("div",za,[n[17]||(n[17]=e("div",{class:"theme-muted-text text-xs"},"queued",-1)),e("div",Ja,a(((je=q.value)==null?void 0:je.queuedRunCount)||0),1),e("p",Ga,a(i(s)("settingsDialog.system.queued")),1)]),e("div",Ya,[n[18]||(n[18]=e("div",{class:"theme-muted-text text-xs"},"maxConcurrent",-1)),e("div",Qa,a(((Le=(Fe=q.value)==null?void 0:Fe.config)==null?void 0:Le.maxConcurrentRuns)||Y.runnerMaxConcurrentRuns),1),e("p",Xa,a(i(s)("settingsDialog.system.maxConcurrent")),1)])])):v("",!0),oe.value?(l(),c("div",Za,[e("div",ei,[n[19]||(n[19]=e("div",{class:"theme-muted-text text-xs"},"completed",-1)),e("div",ti,a(((Oe=p.value)==null?void 0:Oe.totalCompleted)||0),1),e("p",si,a(i(s)("settingsDialog.system.completed")),1)]),e("div",ni,[n[20]||(n[20]=e("div",{class:"theme-muted-text text-xs"},"stopped",-1)),e("div",ai,a(((Ae=p.value)==null?void 0:Ae.totalStopped)||0),1),e("p",ii,a(i(s)("settingsDialog.system.stopped")),1)]),e("div",oi,[n[21]||(n[21]=e("div",{class:"theme-muted-text text-xs"},"error",-1)),e("div",li,a(((Ve=p.value)==null?void 0:Ve.totalErrored)||0),1),e("p",ri,a(i(s)("settingsDialog.system.error")),1)]),e("div",ci,[n[22]||(n[22]=e("div",{class:"theme-muted-text text-xs"},"stop_timeout",-1)),e("div",di,a(((He=p.value)==null?void 0:He.totalStopTimeout)||0),1),e("p",ui,a(i(s)("settingsDialog.system.stopTimeout")),1)])])):v("",!0),oe.value?(l(),c("div",mi,[e("div",gi,[n[23]||(n[23]=e("div",{class:"theme-muted-text text-xs"},"event flush failures",-1)),e("div",hi,a(((qe=p.value)==null?void 0:qe.eventFlushFailureCount)||0),1),e("p",vi,a(i(s)("settingsDialog.system.eventWriteFailures")),1)]),e("div",xi,[n[24]||(n[24]=e("div",{class:"theme-muted-text text-xs"},"recovered runs",-1)),e("div",yi,a(((We=(Ke=Me.value)==null?void 0:Ke.metrics)==null?void 0:We.totalRecovered)||0),1),e("p",pi,a(i(s)("settingsDialog.system.recoveredRuns")),1)]),e("div",_i,[n[25]||(n[25]=e("div",{class:"theme-muted-text text-xs"},"last cleanup",-1)),e("div",fi,a(le((Je=(ze=Be.value)==null?void 0:ze.lastCleanup)==null?void 0:Je.finishedAt)),1),e("p",bi,a(i(s)("settingsDialog.system.lastMaintenanceAt")),1)])])):v("",!0),e("div",Di,[e("div",Ci,[e("div",ki,a(i(s)("settingsDialog.system.baseStatus")),1),e("div",wi,[e("div",Si,[n[26]||(n[26]=e("span",{class:"theme-muted-text"},"runner baseUrl",-1)),e("span",Ti,a(((Ye=(Ge=w.value)==null?void 0:Ge.runner)==null?void 0:Ye.baseUrl)||"-"),1)]),e("div",Ri,[n[27]||(n[27]=e("span",{class:"theme-muted-text"},"runner startedAt",-1)),e("span",Pi,a(le((Qe=q.value)==null?void 0:Qe.startedAt)),1)]),e("div",Ei,[n[28]||(n[28]=e("span",{class:"theme-muted-text"},"last sweep",-1)),e("span",Mi,a(le((Ze=(Xe=Me.value)==null?void 0:Xe.metrics)==null?void 0:Ze.lastSweepFinishedAt)),1)]),e("div",Bi,[n[29]||(n[29]=e("span",{class:"theme-muted-text"},"git diff worker",-1)),e("span",Ni,a(kt.value?i(s)("settingsDialog.system.available"):i(s)("settingsDialog.system.unknown")),1)]),e("div",$i,[n[30]||(n[30]=e("span",{class:"theme-muted-text"},"db vacuum",-1)),e("span",Ui,a(le((et=Be.value)==null?void 0:et.lastVacuumAt)),1)])])]),e("div",Ii,[e("div",ji,a(i(s)("settingsDialog.system.stopReasonTitle")),1),e("div",Fi,[(l(!0),c(j,null,F(St.value,r=>(l(),c("div",{key:r.key,class:"flex items-center justify-between gap-3"},[e("span",Li,a(r.label),1),e("span",Oi,a(r.value),1)]))),128))])])]),oe.value?(l(),c("div",Ai,[e("div",Vi,a(i(s)("settingsDialog.system.stopTimeoutPhaseTitle")),1),e("div",Hi,[(l(!0),c(j,null,F(Tt.value,r=>(l(),c("div",{key:r.key,class:"flex items-center justify-between gap-3 rounded-sm border border-dashed border-[var(--theme-borderMuted)] px-2.5 py-2"},[e("span",qi,a(r.label),1),e("span",Ki,a(r.value),1)]))),128))])])):v("",!0),!oe.value&&!J.value?(l(),c("div",Wi,[e("div",zi,a(i(s)("settingsDialog.system.runnerUnavailable")),1),e("p",Ji,a(xt((tt=w.value)==null?void 0:tt.runner,"settingsDialog.system.runnerUnavailableDescription")),1),e("p",Gi," baseUrl: "+a(((nt=(st=w.value)==null?void 0:st.runner)==null?void 0:nt.baseUrl)||"-"),1)])):v("",!0)])])):S.value==="shortcuts"?(l(),c("section",Yi,[e("div",null,[e("div",Qi,[K(i(Ce),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.shortcuts.title")),1)]),e("p",Xi,a(i(s)("settingsDialog.shortcuts.intro")),1)]),e("section",Zi,[(l(!0),c(j,null,F(bt.value,r=>(l(),c("div",{key:r.id,class:"settings-form-card flex flex-col justify-between gap-3 px-3 py-3 sm:flex-row sm:items-center"},[e("div",eo,[e("div",to,a(r.label),1),e("p",so,a(r.description),1)]),e("div",no,[e("span",ao,a(r.mac),1),e("span",io,a(r.windows),1)])]))),128)),e("p",oo,a(i(s)("settingsDialog.shortcuts.note")),1)])])):(l(),c("section",lo,[e("div",null,[e("div",ro,a(i(s)("settingsDialog.about.title")),1),e("p",co,a(i(s)("settingsDialog.about.intro")),1)]),e("section",uo,[e("div",mo,[e("div",null,[e("div",go,a(i(s)("settingsDialog.about.versionTitle")),1),e("p",ho,a(O.value||i(s)("settingsDialog.about.versionDescription")),1)]),e("span",vo,a(b.value?i(s)("common.loading"):y.value?`v${y.value}`:i(s)("common.unavailable")),1)])])]))])]}),_:1},8,["open"]))}};export{Co as default};