@muyichengshayu/promptx 0.2.18 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/apps/web/dist/assets/{CodexSessionManagerDialog-D_72LIMv.js → CodexSessionManagerDialog-C5Cht229.js} +3 -3
  3. package/apps/web/dist/assets/{TaskDiffReviewDialog-CoQgN73y.js → TaskDiffReviewDialog-D2l8KtRI.js} +5 -5
  4. package/apps/web/dist/assets/{WorkbenchSettingsDialog-Bw-fcsXi.js → WorkbenchSettingsDialog-DGj-_tuL.js} +1 -1
  5. package/apps/web/dist/assets/WorkbenchView-ih1G4f79.js +58 -0
  6. package/apps/web/dist/assets/index-4LeM_JQe.js +2 -0
  7. package/apps/web/dist/assets/index-D9Ojj7Lp.css +1 -0
  8. package/apps/web/dist/assets/{vendor-markdown-9aQhqbjm.js → vendor-markdown-C2aIjAg9.js} +1 -1
  9. package/apps/web/dist/assets/{vendor-misc-u-M8sNMf.js → vendor-misc-DqxAnmp9.js} +30 -29
  10. package/apps/web/dist/assets/{vendor-router-Dn8q3tJM.js → vendor-router-4TN1NQvz.js} +1 -1
  11. package/apps/web/dist/assets/{vendor-shiki-core-1BqeTDsZ.js → vendor-shiki-core-UNANE_3B.js} +1 -1
  12. package/apps/web/dist/assets/vendor-shiki-lang-bash-OmlQ8O-f.js +1 -0
  13. package/apps/web/dist/assets/vendor-shiki-lang-c-Bf17QIO6.js +1 -0
  14. package/apps/web/dist/assets/vendor-shiki-lang-cpp-Dz7DCXQD.js +1 -0
  15. package/apps/web/dist/assets/vendor-shiki-lang-csharp-weekbih6.js +1 -0
  16. package/apps/web/dist/assets/vendor-shiki-lang-css-Cc89nYhT.js +1 -0
  17. package/apps/web/dist/assets/vendor-shiki-lang-diff-BKW5_WJa.js +1 -0
  18. package/apps/web/dist/assets/vendor-shiki-lang-dockerfile-DKFA3n9j.js +1 -0
  19. package/apps/web/dist/assets/vendor-shiki-lang-dotenv-BftIlyZY.js +1 -0
  20. package/apps/web/dist/assets/vendor-shiki-lang-fish-DTee4iUj.js +1 -0
  21. package/apps/web/dist/assets/vendor-shiki-lang-go-iEA7Y2np.js +1 -0
  22. package/apps/web/dist/assets/vendor-shiki-lang-html-fEXQcPZb.js +1 -0
  23. package/apps/web/dist/assets/vendor-shiki-lang-ini-BJNPDfrG.js +1 -0
  24. package/apps/web/dist/assets/vendor-shiki-lang-java-CZdBcwkx.js +1 -0
  25. package/apps/web/dist/assets/vendor-shiki-lang-javascript-5n6OdqL_.js +1 -0
  26. package/apps/web/dist/assets/vendor-shiki-lang-json-DkR7bRnH.js +1 -0
  27. package/apps/web/dist/assets/vendor-shiki-lang-less-DN-gfwMv.js +1 -0
  28. package/apps/web/dist/assets/vendor-shiki-lang-markdown-CgfEScgY.js +1 -0
  29. package/apps/web/dist/assets/vendor-shiki-lang-powershell-N9rELqmw.js +1 -0
  30. package/apps/web/dist/assets/vendor-shiki-lang-python-6ZggAICS.js +1 -0
  31. package/apps/web/dist/assets/vendor-shiki-lang-rust-BvkG5Wz9.js +1 -0
  32. package/apps/web/dist/assets/vendor-shiki-lang-sass-DFAXHETo.js +1 -0
  33. package/apps/web/dist/assets/vendor-shiki-lang-scss-ClLYCF3s.js +1 -0
  34. package/apps/web/dist/assets/vendor-shiki-lang-sql-CBrOCv6B.js +1 -0
  35. package/apps/web/dist/assets/vendor-shiki-lang-toml-C0vpllp6.js +1 -0
  36. package/apps/web/dist/assets/vendor-shiki-lang-tsx-DVg_XTuK.js +1 -0
  37. package/apps/web/dist/assets/vendor-shiki-lang-typescript-DV5oo9cD.js +1 -0
  38. package/apps/web/dist/assets/vendor-shiki-lang-vue-QYrDJbPe.js +1 -0
  39. package/apps/web/dist/assets/vendor-shiki-lang-xml-D4OZNqPk.js +1 -0
  40. package/apps/web/dist/assets/vendor-shiki-lang-yaml-BZu-v6Um.js +1 -0
  41. package/apps/web/dist/assets/vendor-shiki-theme-github-dark-default-DVxJvksW.js +1 -0
  42. package/apps/web/dist/assets/vendor-shiki-theme-github-light-BRz4x11q.js +1 -0
  43. package/apps/web/dist/assets/{vendor-tiptap-rwYdQb1L.js → vendor-tiptap-DLVi2vZE.js} +1 -1
  44. package/apps/web/dist/assets/{vendor-ui-BglsaDbv.js → vendor-ui-CnLXY_Zv.js} +31 -26
  45. package/apps/web/dist/index.html +4 -4
  46. package/package.json +1 -1
  47. package/apps/web/dist/assets/WorkbenchView-CsZnW4Q7.js +0 -58
  48. package/apps/web/dist/assets/index-Bt9T2IKp.js +0 -2
  49. package/apps/web/dist/assets/index-DaJU954y.css +0 -1
  50. package/apps/web/dist/assets/vendor-shiki-lang-bash-zsQu0xn-.js +0 -1
  51. package/apps/web/dist/assets/vendor-shiki-lang-c-BDF8vgks.js +0 -1
  52. package/apps/web/dist/assets/vendor-shiki-lang-cpp-DyDAaXl6.js +0 -1
  53. package/apps/web/dist/assets/vendor-shiki-lang-csharp-BWfTXJXw.js +0 -1
  54. package/apps/web/dist/assets/vendor-shiki-lang-css-DbAm1fUO.js +0 -1
  55. package/apps/web/dist/assets/vendor-shiki-lang-diff-DmGC1G26.js +0 -1
  56. package/apps/web/dist/assets/vendor-shiki-lang-dockerfile-3x-8396r.js +0 -1
  57. package/apps/web/dist/assets/vendor-shiki-lang-dotenv--IVOlX2Q.js +0 -1
  58. package/apps/web/dist/assets/vendor-shiki-lang-fish-Bpv3hhJP.js +0 -1
  59. package/apps/web/dist/assets/vendor-shiki-lang-go-CIGC59jP.js +0 -1
  60. package/apps/web/dist/assets/vendor-shiki-lang-html-Bt_TLLZN.js +0 -1
  61. package/apps/web/dist/assets/vendor-shiki-lang-ini-BIllfys4.js +0 -1
  62. package/apps/web/dist/assets/vendor-shiki-lang-java-CXxu9crF.js +0 -1
  63. package/apps/web/dist/assets/vendor-shiki-lang-javascript-Cha7GNZm.js +0 -1
  64. package/apps/web/dist/assets/vendor-shiki-lang-json-CCZCjDUh.js +0 -1
  65. package/apps/web/dist/assets/vendor-shiki-lang-less-DAToytC5.js +0 -1
  66. package/apps/web/dist/assets/vendor-shiki-lang-markdown-C6lwMXFp.js +0 -1
  67. package/apps/web/dist/assets/vendor-shiki-lang-powershell-lrpuM0ez.js +0 -1
  68. package/apps/web/dist/assets/vendor-shiki-lang-python-Bi9rmtY7.js +0 -1
  69. package/apps/web/dist/assets/vendor-shiki-lang-rust-GTGDbY6A.js +0 -1
  70. package/apps/web/dist/assets/vendor-shiki-lang-sass-DFtHupN8.js +0 -1
  71. package/apps/web/dist/assets/vendor-shiki-lang-scss-BrfBNyyi.js +0 -1
  72. package/apps/web/dist/assets/vendor-shiki-lang-sql-H6--iFN-.js +0 -1
  73. package/apps/web/dist/assets/vendor-shiki-lang-toml-aTteTWYL.js +0 -1
  74. package/apps/web/dist/assets/vendor-shiki-lang-tsx-DoKZm6AV.js +0 -1
  75. package/apps/web/dist/assets/vendor-shiki-lang-typescript-B5awnqri.js +0 -1
  76. package/apps/web/dist/assets/vendor-shiki-lang-vue-CnrgQ7Z5.js +0 -1
  77. package/apps/web/dist/assets/vendor-shiki-lang-xml-Bv-TNPJt.js +0 -1
  78. package/apps/web/dist/assets/vendor-shiki-lang-yaml-DpxUxQ6M.js +0 -1
  79. package/apps/web/dist/assets/vendor-shiki-theme-github-dark-default-DBX58552.js +0 -1
  80. package/apps/web/dist/assets/vendor-shiki-theme-github-light-RLAvZv0q.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.19
4
+
5
+ - 工作台 Response 卡片新增图片导出预览:右上角“图片”按钮会按 640px 版式生成 2x 高清 PNG,并在弹窗中展示,方便 PC 右键或手机长按保存、复制和转发。
6
+ - 优化导出图片的移动端可读性:生成图片时会使用导出专用排版,表格和代码块不再横向滚动导致截图不全;宽表和长代码会自动换行,优先保证内容完整。
7
+ - 收敛移动端消息卡片工具栏:Prompt / Response 卡片的“查看”“插入”“图片”等按钮在小屏下只保留图标,桌面端继续显示文字,避免按钮文案被挤成竖排。
8
+
3
9
  ## 0.2.18
4
10
 
5
11
  - 源码浏览新增行作者提示:查看代码时默认启用 Git blame,鼠标悬停到源码行会在本行下方靠右显示最近修改作者、提交摘要、短 hash 与时间;非 Git 仓库、未跟踪文件、大文件和二进制文件会平稳降级为不可用提示。
@@ -1,3 +1,3 @@
1
- import{W as ut,j as yt,o as Mt,s as jt,p as It,q as ct,h as Et,t as st,f as Pt,v as ft,w as pt,x as At,y as We,z as Rt,A as nt}from"./WorkbenchView-CsZnW4Q7.js";import{u as Qe,f as Dt,e as Tt}from"./index-Bt9T2IKp.js";import{w as ie,n as he,ak as lt,aD as p,aI as ue,aJ as Le,aF as n,aQ as u,u as i,aG as I,aW as Lt,aU as Bt,aX as Ft,aE as m,aR as ye,aS as Se,aL as N,aN as M,aV as Nt,aK as at,b as $,c as k,o as Ot,aZ as xt,r as Ut}from"./vendor-misc-u-M8sNMf.js";import{c as Ht,L as Ze,F as et,e as zt,b as it,X as gt,C as Kt,O as qt,j as Vt,x as Wt,P as Qt,i as mt,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"},mn={key:4,class:"theme-empty-state px-3 py-8 text-sm"},vn={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"},Pn={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},An=["disabled"],Rn=["disabled"],Dn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(d,{emit:W}){const j=d,R=W,{t:v}=Qe(),G=$(""),H=$([]),g=$(!1),w=$(""),E=$(!1),r=$(""),b=$([]),P=$(!1),f=$(""),_=$(""),ce=$(null);let Q=null,O=0,B=null;const z=new Map,K=k(()=>Fe(H.value)),X=k(()=>String(f.value||"").trim()),Y=k(()=>X.value.length>=ut),D=k(()=>!!X.value),le=k(()=>Ce(_.value)||G.value),q=k(()=>D.value?b.value:K.value),me=k(()=>q.value.map(e=>{const l=c((e==null?void 0:e.path)||""),s=e!=null&&e.expanded?1:0,o=e!=null&&e.loading?1:0;return`${l}:${s}:${o}`}).join("|")),se=k(()=>D.value&&!Y.value&&!E.value&&!r.value),J=k(()=>D.value&&Y.value&&!E.value&&!r.value&&!b.value.length),h=k(()=>!D.value&&!g.value&&!w.value&&!K.value.length);function x(e=""){const l=String(e||"").trim();return/^[a-z]:[\\/]/i.test(l)||l.includes("\\")}function c(e=""){const l=String(e||"").trim();if(!l)return"";const s=x(l);let o=l.replace(/\\/g,"/");return o.length>1&&!/^[a-z]:\/?$/i.test(o)&&o!=="/"&&(o=o.replace(/\/+$/,"")),s?o.toLowerCase():o}function U(e="",l=""){const s=c(e),o=c(l);if(!s||!o||o==="/"&&s!=="/")return!1;const A=o.endsWith("/")?o:`${o}/`;return s===o||s.startsWith(A)}function ee(e="",l=""){const s=String(e||"").trim(),o=String(l||"").trim();return s?o?x(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${o}`:`${s.replace(/[\\/]+$/,"")}\\${o}`:s==="/"?`/${o}`:`${s.replace(/\/+$/,"")}/${o}`:s:o}function S(e="",l=""){const s=c(e),o=c(l);if(!s||!o||!U(o,s))return[];const A=o===s?"":o.slice(s.length).replace(/^\//,"");return A?A.split("/").filter(Boolean):[]}function ke(e=""){const l=String(e||"").trim(),s=Ce(l);if(!l||!s||c(l)===c(s))return"";const o=x(l),A=l.replace(/\\/g,"/");if(o){const de=A.replace(/\/+$/,""),qe=de.lastIndexOf("/");if(qe<=2)return"";const Te=de.slice(0,qe).replace(/\//g,"\\");return U(Te,s)?Te:""}const V=A.replace(/\/+$/,""),ne=V.lastIndexOf("/");if(ne<=0)return"";const ae=V.slice(0,ne)||"/";return U(ae,s)?ae:""}function Ce(e=""){const l=String(e||"").trim();return l&&H.value.map(o=>String((o==null?void 0:o.path)||"").trim()).filter(o=>o&&U(l,o)).sort((o,A)=>c(A).length-c(o).length)[0]||""}function xe(e){return(e==null?void 0:e.name)||(e==null?void 0:e.path)||v("directoryPicker.unnamedDirectory")}function _e(e=""){const l=String(e||"").trim();return l?l.split(/[\\/]/).filter(Boolean).at(-1)||l:"Home"}function ve(e=""){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function fe(e="",l=""){const s=String(e||""),o=String(l||"").trim().toLowerCase();if(!s||!o)return null;const A=s.toLowerCase(),V=A.indexOf(o);if(V>=0)return{start:V,end:V+o.length};const ne=o.split(/[\\/\s_.-]+/).filter(Boolean).sort((ae,de)=>de.length-ae.length);for(const ae of ne){if(ae.length<2)continue;const de=A.indexOf(ae);if(de>=0)return{start:de,end:de+ae.length}}return null}function T(e="",l=""){const s=String(e||""),o=fe(s,l);return o?`${ve(s.slice(0,o.start))}<mark class="theme-search-highlight">${ve(s.slice(o.start,o.end))}</mark>${ve(s.slice(o.end))}`:ve(s)}function tt(e){return T(xe(e),f.value)}function Be(e){return T((e==null?void 0:e.path)||"",f.value)}function $e(e,l=0){return{...e,depth:l,expanded:!1,loaded:!1,loading:!1,children:[]}}function Fe(e=[],l=[]){return e.forEach(s=>{l.push(s),s.expanded&&s.children.length&&Fe(s.children,l)}),l}function oe(){H.value=[...H.value]}function be(){Q&&(window.clearTimeout(Q),Q=null),B&&(B.abort(),B=null)}function we(e,l=H.value){const s=c(e);if(!s)return null;for(const o of l){if(c(o.path)===s)return o;if(o.children.length){const A=we(e,o.children);if(A)return A}}return null}function Z(e){_.value=String((e==null?void 0:e.path)||"").trim()}function pe(e=""){return c(e)}function Ne(e,l){const s=pe(e);if(s){if(l){z.set(s,l);return}z.delete(s)}}function Me(){var l;const e=z.get(pe(_.value));(l=e==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})}function Ge(){he(()=>{var e,l;(l=(e=ce.value)==null?void 0:e.focus)==null||l.call(e)})}function re(){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)||Z(e[0])}function ge(){const e=q.value;if(!e.length)return-1;const l=pe(_.value),s=e.findIndex(o=>pe((o==null?void 0:o.path)||"")===l);return s>=0?s:0}function je(){const e=q.value,l=ge();return l<0||!e.length?null:e[l]||null}function Ie(e=1){const l=q.value;if(!l.length)return!1;const s=ge(),o=s<0?0:(s+e+l.length)%l.length;return Z(l[o]),he(Me),!0}async function Oe(){if(D.value)return!1;const e=je();if(!e||!e.hasChildren)return!1;if(!e.expanded)return await De(e),!0;const l=q.value,s=ge(),o=l[s+1];return o&&ke(o.path)===e.path?(Z(o),he(Me),!0):!1}function Ue(){if(D.value)return!1;const e=je();if(!e)return!1;if(e.expanded&&e.hasChildren)return e.expanded=!1,oe(),Z(e),!0;const l=ke(e.path);if(!l)return!1;const s=we(l);return s?(Z(s),he(Me),!0):!1}function Ee(e){var l,s,o;if((l=e==null?void 0:e.preventDefault)==null||l.call(e),X.value){(s=e==null?void 0:e.stopPropagation)==null||s.call(e),f.value="";return}(o=e==null?void 0:e.stopPropagation)==null||o.call(e),R("close")}function Pe(e){const l=String((e==null?void 0:e.key)||"");if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter","Escape"].includes(l)&&!(D.value&&(l==="ArrowLeft"||l==="ArrowRight"))){if(l==="ArrowDown"){e.preventDefault(),Ie(1);return}if(l==="ArrowUp"){e.preventDefault(),Ie(-1);return}if(l==="Escape"){Ee(e);return}if(D.value){if(l==="Enter"){e.preventDefault();const s=je();s&&Je(s)}return}if(l==="ArrowRight"){e.preventDefault(),Oe();return}if(l==="ArrowLeft"){e.preventDefault(),Ue();return}l==="Enter"&&(e.preventDefault(),Ke())}}async function He(e,l={}){if(!(!e||e.loading)&&!(e.loaded&&!l.force)){e.loading=!0,w.value="",oe();try{const s=await ct({path:e.path,limit:240});e.children=(s.items||[]).map(o=>$e(o,e.depth+1)),e.loaded=!0}catch(s){w.value=s.message||v("directoryPicker.loadFailed")}finally{e.loading=!1,oe()}}}async function Ae(){g.value=!0,w.value="";try{const e=await ct({limit:240});G.value=String(e.path||"");const l=Array.isArray(e.roots)&&e.roots.length?e.roots:[{name:_e(e.path||""),path:String(e.path||""),type:"directory",hasChildren:!0,isRoot:!0}],s=c(e.path||""),o=l.map(A=>{const V=$e({...A,isHomeRoot:c(A.path||"")===s},0);return V.isHomeRoot&&(V.children=(e.items||[]).map(ne=>$e(ne,1)),V.loaded=!0,V.expanded=!0),V});H.value=o,Z(o.find(A=>A.isHomeRoot)||o[0])}catch(e){w.value=e.message||v("directoryPicker.treeLoadFailed"),H.value=[],G.value=""}finally{g.value=!1}}async function te(e=""){const l=String(e||"").trim(),s=Ce(l);if(!l||!s)return;let o=we(s);if(!o)return;Z(o);const A=S(s,l);for(const V of A){await He(o),o.expanded=!0,oe();const ne=we(ee(o.path,V),o.children);if(!ne)break;o=ne,Z(o)}}async function Re(){f.value="",b.value=[],r.value="",P.value=!1,_.value="",await Ae();const e=String(j.initialPath||"").trim();e&&Ce(e)&&await te(e)}async function De(e){if(e!=null&&e.path&&(Z(e),!!e.hasChildren)){if(!e.loaded){e.expanded=!0,oe(),await He(e);return}e.expanded=!e.expanded,oe()}}function ze(e){e!=null&&e.path&&Z(e)}async function Xe(){const e=String(f.value||"").trim();O+=1;const l=O;if(be(),!j.open||!e||!le.value||!Y.value){E.value=!1,r.value="",b.value=[],P.value=!1;return}E.value=!0,r.value="",B=new AbortController;try{const s=await jt(e,{path:le.value,limit:80,signal:B.signal});if(l!==O)return;b.value=Array.isArray(s.items)?s.items:[],P.value=!!s.truncated}catch(s){if(It(s)||l!==O)return;r.value=s.message||v("directoryPicker.searchFailed"),b.value=[],P.value=!1}finally{l===O&&(B=null),l===O&&(E.value=!1)}}function Ye(){if(be(),!String(f.value||"").trim()||!Y.value){E.value=!1,r.value="",b.value=[],P.value=!1;return}E.value=!0,r.value="",Q=window.setTimeout(()=>{Q=null,Xe()},Mt)}async function Je(e){e!=null&&e.path&&(await te(e.path),f.value="")}function Ke(){_.value&&(R("select",_.value),R("close"))}return ie(f,()=>{Ye()}),ie(me,()=>{re(),he(Me)},{immediate:!0}),ie(()=>j.open,e=>{if(e){Re().catch(()=>{}),Ge();return}be()}),lt(()=>{be()}),(e,l)=>(p(),ue(yt,{open:d.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":g.value||E.value,"close-on-backdrop":!(g.value||E.value),"close-on-escape":!(g.value||E.value),onClose:l[2]||(l[2]=s=>R("close"))},{title:Le(()=>[n("div",null,[n("div",en,[I(i(et),{class:"h-4 w-4"}),n("span",null,u(i(v)("directoryPicker.title")),1)]),n("p",tn,u(i(v)("directoryPicker.intro")),1)])]),default:Le(()=>[n("div",{class:"flex min-h-0 flex-1 flex-col overflow-hidden",onKeydown:Pe},[n("div",nn,[n("div",sn,[n("span",an,u(i(v)("directoryPicker.currentSelection")),1),n("span",ln,u(_.value||i(v)("directoryPicker.selectionPlaceholder")),1)])]),n("label",on,[n("span",null,u(i(v)("directoryPicker.searchLabel")),1),n("div",rn,[I(i(Ht),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Lt(n("input",{ref_key:"searchInputRef",ref:ce,"onUpdate:modelValue":l[0]||(l[0]=s=>f.value=s),type:"text",placeholder:i(v)("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(Ee,["esc"])},null,40,dn),[[Ft,f.value]])])]),n("div",un,[D.value&&r.value?(p(),m("div",cn,u(r.value),1)):!D.value&&w.value?(p(),m("div",fn,u(w.value),1)):D.value&&E.value?(p(),m("div",pn,[I(i(Ze),{class:"h-4 w-4 animate-spin"}),n("span",null,u(i(v)("directoryPicker.searching")),1)])):!D.value&&g.value?(p(),m("div",gn,[I(i(Ze),{class:"h-4 w-4 animate-spin"}),n("span",null,u(i(v)("directoryPicker.treeLoading")),1)])):se.value?(p(),m("div",mn,u(i(v)("directoryPicker.searchMinKeywordHint",{count:i(ut)})),1)):J.value?(p(),m("div",vn,u(i(v)("directoryPicker.noSearchResults")),1)):h.value?(p(),m("div",hn,u(i(v)("directoryPicker.emptyTree")),1)):D.value?(p(),m("div",yn,[(p(!0),m(ye,null,Se(b.value,s=>(p(),m("button",{key:s.path,ref_for:!0,ref:o=>Ne(s.path,o),type:"button",class:N(["theme-list-row focus:outline-none",c(_.value)===c(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:o=>Je(s)},[I(i(et),{class:"theme-list-item-icon"}),n("div",bn,[n("div",null,[n("span",{class:"theme-list-item-title block break-all",innerHTML:tt(s)},null,8,wn)]),n("div",{class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all",innerHTML:Be(s)},null,8,Sn)])],10,xn))),128)),P.value?(p(),m("p",kn,u(i(v)("directoryPicker.truncatedHint")),1)):M("",!0)])):(p(),m("div",Cn,[(p(!0),m(ye,null,Se(K.value,s=>(p(),m("div",{key:s.path,ref_for:!0,ref:o=>Ne(s.path,o),class:N(["theme-list-tree-item outline-none focus:outline-none focus-visible:outline-none",c(_.value)===c(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:N(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:at(o=>De(s),["stop"])},[s.loading?(p(),ue(i(Ze),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),ue(i(zt),{key:1,class:N(["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:o=>ze(s)},[I(i(et),{class:N(["h-4 w-4 shrink-0",c(_.value)===c(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),n("div",jn,[n("div",{class:N(["theme-list-item-title truncate",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},u(xe(s)),3),s.isHomeRoot?(p(),m("div",In,u(s.path),1)):M("",!0)])],8,Mn)])],6))),128))]))])],32),n("div",En,[n("div",Pn,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:g.value||E.value,onClick:l[1]||(l[1]=s=>R("close"))},u(i(v)("directoryPicker.cancel")),9,An),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:g.value||E.value||!_.value,onClick:Ke},[I(i(it),{class:"h-4 w-4"}),n("span",null,u(i(v)("directoryPicker.useCurrentDirectory")),1)],8,Rn)])])]),_: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"],Hn=["disabled"],zn=["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"},ms={class:"flex items-center justify-between gap-2 border-b border-solid px-3 py-2 text-[11px] leading-5"},vs={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(d,{emit:W}){const j=d,R=W,{t:v}=Qe(),G=$(null),H=$(null),g=$(!1),w=$(-1),E=k(()=>{const h=String(j.engine||"").trim();return j.engineOptions.find(x=>String((x==null?void 0:x.value)||"").trim()===h)||null}),r=k(()=>{const h=Array.isArray(j.agentEngines)?j.agentEngines:[];return[...new Set(h.map(x=>String(x||"").trim()).filter(Boolean))]}),b=k(()=>j.engineOptions.filter(h=>String((h==null?void 0:h.value)||"").trim()!==String(j.engine||"").trim())),P=k(()=>!!String(j.cwd||"").trim()),f=k(()=>String(j.sessionId||"").trim()),_=k(()=>f.value.toLowerCase()),ce=k(()=>j.sessionCandidates.filter(h=>h==null?void 0:h.matchedCwd)),Q=k(()=>{const h=_.value,x=ce.value;return h?x.filter(c=>[c==null?void 0:c.label,c==null?void 0:c.id,c==null?void 0:c.cwd].map(ee=>String(ee||"").toLowerCase()).some(ee=>ee.includes(h))).slice(0,10):x.slice(0,10)});function O(){j.busy||!j.canEditSessionId||!P.value||(g.value=!0)}function B(){g.value=!1,w.value=-1}function z(){const h=Q.value;if(!h.length){w.value=-1;return}const x=h.findIndex(c=>c.id===f.value);w.value=x>=0?x:0}function K(){he(()=>{var h,x;(x=(h=H.value)==null?void 0:h.focus)==null||x.call(h)})}function X(){if(g.value){B();return}O(),K()}function Y(){R("update:cwd","")}function D(h){if(!j.canEditEngine||j.busy)return;const x=String(h||"").trim(),c=r.value.includes(x)?r.value.filter(U=>U!==x):[...r.value,x];R("update:agentEngines",c)}function le(){R("update:sessionId",""),B(),K()}function q(h){var x;R("update:sessionId",((x=h==null?void 0:h.target)==null?void 0:x.value)||""),P.value&&O()}function me(h){R("select-session-candidate",h),B(),K()}function se(h){if(j.busy||!j.canEditSessionId||!P.value)return;const x=Q.value;if(h.key==="ArrowDown"){if(h.preventDefault(),!g.value){O(),z();return}if(!x.length)return;w.value=w.value<0?0:Math.min(x.length-1,w.value+1);return}if(h.key==="ArrowUp"){if(h.preventDefault(),!g.value){O(),z();return}if(!x.length)return;w.value=w.value<0?x.length-1:Math.max(0,w.value-1);return}if(h.key==="Enter"&&g.value&&x.length&&w.value>=0){h.preventDefault(),me(x[w.value]);return}h.key==="Escape"&&g.value&&(h.preventDefault(),B())}function J(h){!g.value||!G.value||G.value.contains(h.target)||B()}return ie(Q,()=>{z()}),ie(()=>j.canEditSessionId,h=>{(!h||!P.value)&&B()}),ie(P,h=>{h||B()}),Ot(()=>{document.addEventListener("pointerdown",J)}),lt(()=>{document.removeEventListener("pointerdown",J)}),(h,x)=>(p(),m("div",Tn,[n("label",Ln,[n("span",null,u(i(v)("projectManager.projectTitleOptional")),1),n("input",{value:d.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:d.busy,onInput:x[0]||(x[0]=c=>R("update:title",c.target.value))},null,40,Bn)]),n("label",Fn,[n("span",null,u(i(v)("projectManager.workingDirectoryField")),1),n("div",Nn,[n("div",On,[n("input",{value:d.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:N(["tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",d.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:d.busy||!d.canEditCwd,onInput:x[1]||(x[1]=c=>R("update:cwd",c.target.value))},null,42,Un),d.cwd&&d.canEditCwd?(p(),m("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:d.busy,onClick:Y},[I(i(gt),{class:"h-3.5 w-3.5"})],8,Hn)):M("",!0)]),n("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:d.busy||!d.canEditCwd,onClick:x[2]||(x[2]=c=>R("open-directory-picker"))},[I(i(et),{class:"h-4 w-4"}),n("span",null,u(d.mobile?i(v)("projectManager.choose"):i(v)("projectManager.chooseDirectory")),1)],8,zn)]),n("datalist",Kn,[(p(!0),m(ye,null,Se(d.workspaceSuggestions,c=>(p(),m("option",{key:c,value:c},null,8,qn))),128))]),d.duplicateCwdMessage?(p(),m("p",Vn,u(d.duplicateCwdMessage),1)):d.cwdReadonlyMessage?(p(),m("p",Wn,u(d.cwdReadonlyMessage),1)):M("",!0)]),n("label",Qn,[n("span",null,u(i(v)("projectManager.engineField")),1),n("div",Gn,[I(Et,{"model-value":d.engine,options:d.engineOptions,disabled:d.busy||!d.canEditEngine,placeholder:i(v)("projectManager.selectEngine"),"empty-text":i(v)("projectManager.noEngines"),"get-option-value":c=>(c==null?void 0:c.value)||"","onUpdate:modelValue":x[3]||(x[3]=c=>R("update:engine",c))},{trigger:Le(({disabled:c})=>{var U;return[n("div",Xn,[n("span",{class:N(["min-w-0 flex-1 truncate",c?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},u(((U=E.value)==null?void 0:U.label)||i(v)("projectManager.selectEngine")),3),E.value&&E.value.enabled===!1?(p(),m("span",Yn,u(i(v)("projectManager.comingSoon")),1)):M("",!0)])]}),option:Le(({option:c,selected:U,select:ee})=>[n("button",{type:"button",class:N(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",U?"theme-filter-active":"theme-filter-idle"]),disabled:(c==null?void 0:c.enabled)===!1,onClick:ee},[n("div",Zn,[n("span",es,u(c.label),1),(c==null?void 0:c.enabled)===!1?(p(),m("span",ts,u(i(v)("projectManager.comingSoon")),1)):M("",!0)])],10,Jn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),d.engineReadonlyMessage?(p(),m("p",ns,u(d.engineReadonlyMessage),1)):M("",!0)]),n("div",ss,[n("span",null,u(i(v)("projectManager.collaborationAgents")),1),n("div",as,[(p(!0),m(ye,null,Se(b.value,c=>(p(),m("button",{key:c.value,type:"button",class:N(["theme-list-row flex items-center justify-between gap-3 rounded-sm border border-solid px-3 py-2 text-left transition",r.value.includes(c.value)?"theme-list-item-active":"theme-list-item-hover"]),disabled:d.busy||!d.canEditEngine,onClick:U=>D(c.value)},[n("div",ls,[n("div",os,u(c.label),1),n("div",rs,u(r.value.includes(c.value)?i(v)("projectManager.agentEnabled"):i(v)("projectManager.agentDisabled")),1)]),r.value.includes(c.value)?(p(),ue(i(it),{key:0,class:"h-4 w-4 shrink-0 text-[var(--theme-textPrimary)]"})):M("",!0)],10,is))),128))]),n("p",ds,u(i(v)("projectManager.collaborationAgentsHint")),1)]),n("label",us,[n("span",null,u(i(v)("projectManager.sessionId")),1),n("div",cs,[n("div",{ref_key:"sessionComboboxRef",ref:G,class:"relative min-w-0 flex-1"},[n("input",{ref_key:"sessionInputRef",ref:H,value:d.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",disabled:d.busy||!d.canEditSessionId,onFocus:O,onInput:q,onKeydown:se},null,40,fs),d.canEditSessionId?(p(),m("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:d.busy||!P.value,onClick:X},[d.sessionCandidatesLoading?(p(),ue(i(Ze),{key:0,class:"h-3.5 w-3.5 animate-spin"})):f.value?(p(),ue(i(gt),{key:1,class:"h-3.5 w-3.5",onClick:at(le,["stop"])})):(p(),ue(i(Kt),{key:2,class:N(["h-3.5 w-3.5 transition",g.value?"rotate-180":""])},null,8,["class"]))],8,ps)):M("",!0),d.canEditSessionId&&g.value?(p(),m("div",gs,[n("div",ms,[n("span",vs,u(i(v)("projectManager.sessionCandidates")),1),d.sessionCandidatesLoading?(p(),m("span",hs,u(i(v)("projectManager.sessionCandidatesLoading")),1)):M("",!0)]),Q.value.length?(p(),m("div",ys,[(p(!0),m(ye,null,Se(Q.value,(c,U)=>(p(),m("button",{key:`${c.engine}:${c.id}`,type:"button",class:N(["theme-list-row mb-1 w-full px-2 py-1.5 text-left last:mb-0",U===w.value?"theme-list-item-active":"theme-list-item-hover"]),disabled:d.busy,onMousedown:x[4]||(x[4]=at(()=>{},["prevent"])),onClick:ee=>me(c)},[n("div",bs,[n("span",ws,u(c.label||c.id),1),n("span",Ss,u(c.updatedAtLabel||i(v)("projectManager.unknown")),1)])],42,xs))),128))])):(p(),m("div",ks,u(P.value?i(v)("projectManager.noSessionCandidates"):i(v)("projectManager.sessionCandidatesNeedDirectory")),1))])):M("",!0)],512),f.value?(p(),m("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:d.busy,onClick:x[5]||(x[5]=c=>R("copy-session-id"))},[d.sessionIdCopied?(p(),ue(i(it),{key:0,class:"h-4 w-4"})):(p(),ue(i(qt),{key:1,class:"h-4 w-4"})),n("span",null,u(d.sessionIdCopied?i(v)("projectManager.sessionIdCopied"):i(v)("projectManager.copySessionId")),1)],8,Cs)):M("",!0)]),d.sessionIdReadonlyMessage?(p(),m("p",_s,u(d.sessionIdReadonlyMessage),1)):(p(),m("p",$s,u(P.value?i(v)("projectManager.sessionIdHint"):i(v)("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"],Ps=["onClick"],As={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Rs={class:"flex w-full flex-col gap-2 text-left"},Ds={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"},ht={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:d=>d},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(d,{emit:W}){const j=d,R=W,{t:v}=Qe();function G(w){return j.mode==="edit"&&j.editingSessionId===w.id?"theme-card-selected":j.isSessionRunning(w.id)?"theme-card-warning":"theme-card-idle-strong"}function H(w){return j.isCurrentSession(w.id)?v("projectManager.current"):v("projectManager.regular")}function g(w){return j.isCurrentSession(w.id)?"theme-status-info":"theme-status-neutral"}return(w,E)=>(p(),m("div",{class:N(d.mobile?"flex h-full min-h-0 flex-col":"")},[n("div",Ms,[n("div",null,[n("div",js,u(i(v)("projectManager.projectList")),1),d.hasSessions?M("",!0):(p(),m("p",Is,u(i(v)("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:d.busy,onClick:E[0]||(E[0]=r=>R("create"))},[I(i(Vt),{class:"h-4 w-4"}),n("span",null,u(i(v)("projectManager.create")),1)],8,Es)]),n("div",{class:N(["mt-4 space-y-2",d.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)]"])},[(p(!0),m(ye,null,Se(d.sessions,r=>{var b;return p(),m("article",{key:r.id,class:N(["relative cursor-pointer rounded-sm border p-3 transition",G(r)]),onClick:P=>R("select",r.id)},[d.mode==="edit"&&d.editingSessionId===r.id?(p(),m("span",As)):M("",!0),n("div",Rs,[n("div",Ds,[n("span",{class:"block truncate",title:r.title||i(v)("projectManager.untitledProject")},u(r.title||i(v)("projectManager.untitledProject")),9,Ts)]),n("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:r.cwd},u(r.cwd),9,Ls),n("div",Bs,[n("span",null,u(((b=r==null?void 0:r.agentBindings)==null?void 0:b.length)>1?i(v)("projectManager.agentCount",{count:r.agentBindings.length}):i(st)(r.engine)),1),d.mobile?M("",!0):(p(),m("span",Fs,"·")),d.mobile?M("",!0):(p(),m("span",Ns,u(d.formatUpdatedAt(r.updatedAt)),1))]),n("div",Os,[n("span",{class:N(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",g(r)])},u(H(r)),3),n("span",{class:N(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",d.getRuntimeStatusClass(r.id)])},[d.isSessionRunning(r.id)?(p(),m("span",Us)):M("",!0),xt(" "+u(d.getRuntimeStatusLabel(r.id)),1)],2),n("span",{class:N(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",d.getThreadStatusClass(r)])},u(d.getThreadStatusLabel(r)),3)])])],10,Ps)}),128))],2)],2))}},Hs={class:"space-y-3"},zs={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:d=>d},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(d){const{t:W}=Qe();return(j,R)=>{var v,G,H,g,w,E,r,b,P;return p(),m("div",Hs,[n("div",zs,[n("div",Ks,u(i(W)("projectManager.runtimeStatus")),1),n("div",qs,[n("span",{class:N(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",d.getRuntimeStatusClass((v=d.activeSession)==null?void 0:v.id)])},[d.isSessionRunning((G=d.activeSession)==null?void 0:G.id)?(p(),m("span",Vs)):M("",!0),xt(" "+u(d.getRuntimeStatusLabel((H=d.activeSession)==null?void 0:H.id)),1)],2),n("span",{class:N(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",d.getThreadStatusClass(d.activeSession)])},u(d.getThreadStatusLabel(d.activeSession)),3),(g=d.activeSession)!=null&&g.id&&d.isCurrentSession(d.activeSession.id)?(p(),m("span",Ws,u(i(W)("projectManager.currentProject")),1)):M("",!0)])]),n("div",Qs,[n("div",Gs,u(i(W)("projectManager.engine")),1),n("div",Xs,u(i(st)((w=d.activeSession)==null?void 0:w.engine)),1),((r=(E=d.activeSession)==null?void 0:E.agentBindings)==null?void 0:r.length)>1?(p(),m("div",Ys,[(p(!0),m(ye,null,Se(d.activeSession.agentBindings,f=>(p(),m("span",{key:f.engine,class:"theme-status-neutral inline-flex items-center rounded-sm border border-solid px-1.5 py-0.5 text-[10px]"},u(i(st)(f.engine)),1))),128))])):M("",!0)]),n("div",Js,[n("div",Zs,u(i(W)("projectManager.workingDirectory")),1),n("div",ea,u(((b=d.activeSession)==null?void 0:b.cwd)||i(W)("projectManager.notSet")),1)]),n("div",ta,[n("div",na,u(i(W)("projectManager.updatedAt")),1),n("div",sa,u(d.formatUpdatedAt((P=d.activeSession)==null?void 0:P.updatedAt)),1)]),n("div",aa,[n("div",ia,[I(i(Wt),{class:"h-3.5 w-3.5"}),n("span",null,u(i(W)("projectManager.note")),1)]),n("p",la,u(i(W)("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"},ma={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},va={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"],Pa={class:"min-w-0 flex-1"},Aa={class:"theme-heading truncate text-sm font-medium"},Ra={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Da={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"],Ha=["disabled"],za=["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(d,{expose:W,emit:j}){const R=new Map;function v(t="",a=""){const y=We(t),C=nt(a);return!y||!C?"":`${y}
2
- ${C}`}function G(t=""){if(!t)return null;const a=R.get(t);return a?a.expiresAt<=Date.now()?(R.delete(t),null):Array.isArray(a.items)?a.items:[]:null}function H(t="",a=[]){t&&R.set(t,{expiresAt:Date.now()+qa,items:Array.isArray(a)?a:[]})}const g=d,w=j,{locale:E,t:r}=Qe(),b=$("edit"),P=$(""),f=Ut({title:"",engine:"codex",agentEngines:[],cwd:"",sessionId:""}),_=$(""),ce=$(!1),Q=$(!1),O=$(!1),B=$(!1),z=$(!1),K=$(!1),X=$(!1),Y=$(!1),{matches:D}=Pt("(max-width: 767px)"),le=$("list"),q=$("basic"),me=$(ft()),se=$([]),J=$(!1);let h=null,x=null,c=null,U=0;const ee=k(()=>je(g.sessions)),S=k(()=>g.sessions.find(t=>t.id===P.value)||null),ke=k(()=>g.sessions.length>0),Ce=k(()=>g.sessions.find(t=>t.id===g.selectedSessionId)||null),xe=k(()=>!!(S.value&&re(S.value.id))),_e=k(()=>{var t;return!((t=S.value)!=null&&t.started)}),ve=k(()=>{var t;return!((t=S.value)!=null&&t.started)}),fe=k(()=>{var t;return!((t=S.value)!=null&&t.started)}),T=k(()=>g.loading||ce.value||Q.value||O.value||B.value),tt=k(()=>String(f.sessionId||"").trim()),Be=k(()=>{var y,C;const t=new Set,a=[];return[f.cwd,(y=S.value)==null?void 0:y.cwd,(C=Ce.value)==null?void 0:C.cwd,...g.workspaces,...g.sessions.map(F=>F.cwd)].forEach(F=>{const L=String(F||"").trim();!L||t.has(L)||(t.add(L),a.push(L))}),a.slice(0,12)}),$e=k(()=>me.value),Fe=k(()=>se.value.map(t=>({...t,updatedAtLabel:t.updatedAt?Pe(t.updatedAt):""}))),oe=k(()=>{const t=nt(f.cwd);return t?g.sessions.filter(a=>{var y;return a.id===((y=S.value)==null?void 0:y.id)?!1:nt(a.cwd)===t}):[]}),be=k(()=>{if(!oe.value.length)return"";const t=oe.value.slice(0,3).map(a=>{const y=a.title||r("projectManager.untitledProject");return E.value==="en-US"?`"${y}"`:`「${y}」`}).join(E.value==="en-US"?", ":"、");return r("projectManager.duplicateDirectory",{labels:t,count:oe.value.length})}),we=k(()=>b.value!=="edit"||_e.value?"":r("projectManager.cwdReadonly")),Z=k(()=>b.value!=="edit"||!S.value||ve.value?"":r("projectManager.engineReadonly")),pe=k(()=>b.value!=="edit"||!S.value||fe.value?"":r("projectManager.sessionIdReadonly")),Ne=k(()=>b.value==="create"?ce.value?r("projectManager.creatingProject"):r("projectManager.createProject"):Q.value?r("projectManager.savingChanges"):r("projectManager.saveChanges")),Me=k(()=>{var t;return b.value==="create"?r("projectManager.newProject"):((t=S.value)==null?void 0:t.title)||r("projectManager.untitledProject")});function Ge(t=""){const a=Date.parse(String(t||""));return Number.isFinite(a)?a:0}function re(t){var a;return!!((a=g.sessions.find(y=>y.id===t))!=null&&a.running)}function ge(t){return!!t&&t===g.selectedSessionId}function je(t=[]){return[...t].sort((a,y)=>{const C=Number(re(y.id))-Number(re(a.id));if(C)return C;const F=Number(ge(y.id))-Number(ge(a.id));if(F)return F;const L=Ge(y.updatedAt)-Ge(a.updatedAt);return L||Tt(String(a.title||a.cwd||a.id),String(y.title||y.cwd||y.id))})}function Ie(t){return re(t)?r("projectManager.running"):r("projectManager.idle")}function Oe(t){return re(t)?"theme-status-warning":"theme-status-success"}function Ue(t){return t!=null&&t.started?r("projectManager.threadBound"):r("projectManager.notStarted")}function Ee(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function Pe(t=""){if(!t)return r("projectManager.unknown");const a=new Date(t);return Number.isNaN(a.getTime())?t:Dt(a.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function He(t){f.title=String((t==null?void 0:t.title)||""),f.engine=We(t==null?void 0:t.engine),f.agentEngines=(Array.isArray(t==null?void 0:t.agentBindings)?t.agentBindings:[]).map(a=>We(a==null?void 0:a.engine)).filter(a=>a&&a!==f.engine),f.cwd=String((t==null?void 0:t.cwd)||""),f.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",P.value="",_.value="",f.title="",f.engine="codex",f.agentEngines=[],f.cwd="",f.sessionId=""}function te(t){const a=g.sessions.find(y=>y.id===t);a&&(b.value="edit",P.value=a.id,_.value="",He(a))}function Re(){var t;return g.selectedSessionId&&g.sessions.some(a=>a.id===g.selectedSessionId)?g.selectedSessionId:((t=ee.value[0])==null?void 0:t.id)||""}function De(t="basic"){le.value="detail",q.value=t}function ze(){le.value="list",q.value="basic"}function Xe(){Ae(),D.value&&De("basic")}function Ye(t){T.value||(te(t),D.value&&De("basic"))}function Je(t){f.cwd=String(t||"").trim()}async function Ke(){var a,y;const t=((a=S.value)==null?void 0:a.id)||Re();return!t||((!S.value||S.value.id!==t)&&(te(t),await he()),!((y=S.value)!=null&&y.cwd))?!1:(D.value&&De("basic"),w("open-source-browser",S.value),w("close"),!0)}function e(){return z.value?(z.value=!1,!0):K.value?(K.value=!1,!0):X.value?(X.value=!1,!0):g.open?(w("close"),!0):!1}function l(t){f.title=String(t||"")}function s(t){f.engine=We(t),f.agentEngines=f.agentEngines.filter(a=>a!==f.engine)}function o(t){f.agentEngines=[...new Set((Array.isArray(t)?t:[]).map(a=>We(a)).filter(a=>a&&a!==f.engine))]}function A(t){f.cwd=String(t||"")}function V(t){f.sessionId=String(t||"")}function ne(t){f.sessionId=String((t==null?void 0:t.id)||"").trim()}function ae(){_.value="",z.value=!1,K.value=!1,Y.value=!1,q.value="basic",le.value=D.value?"list":"detail";const t=Re();if(t){te(t);return}Ae()}async function de(){if(!(T.value||typeof g.onRefresh!="function")){_.value="";try{await Promise.all([g.onRefresh(),qe()])}catch(t){_.value=t.message}}}async function qe(){try{me.value=await At()}catch{me.value=ft()}}function Te(){x&&(clearTimeout(x),x=null)}function Ve(){c&&(c.abort(),c=null)}async function bt(){const t=String(f.cwd||"").trim();if(!g.open||!fe.value||!t){se.value=[],J.value=!1,Ve();return}const a=++U;Ve();const y=v(f.engine,t),C=G(y);if(C){se.value=C,J.value=!1;return}c=new AbortController,J.value=!0;try{const F=await Rt({engine:f.engine,cwd:t,limit:50,signal:c.signal});if(a!==U)return;const L=Array.isArray(F==null?void 0:F.items)?F.items:[];se.value=L,H(y,L)}catch(F){if((F==null?void 0:F.name)==="AbortError")return;a===U&&(se.value=[])}finally{a===U&&(J.value=!1,c=null)}}function ot(t=250){if(Te(),!g.open||!fe.value||!String(f.cwd||"").trim()){se.value=[],J.value=!1,Ve();return}x=setTimeout(()=>{x=null,bt().catch(()=>{})},t)}async function wt(t){var y;if((y=navigator.clipboard)!=null&&y.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 rt(){const t=tt.value;if(t)try{await wt(t),Y.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{Y.value=!1,h=null},1800)}catch(a){_.value=(a==null?void 0:a.message)||r("projectManager.copySessionIdFailed")}}async function dt(){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(f.cwd||"").trim();return a?{type:"create",cwd:a,payload:{title:f.title,engine:f.engine,agentEngines:[f.engine,...f.agentEngines],cwd:a,sessionId:String(f.sessionId||"").trim()}}:(_.value=r("projectManager.directoryRequired"),null)}if(!S.value)return _.value=r("projectManager.projectMissing"),null;const t={title:f.title,engine:f.engine,agentEngines:[f.engine,...f.agentEngines]};return _e.value&&(t.cwd=f.cwd),fe.value&&(t.sessionId=String(f.sessionId||"").trim()),{type:"update",sessionId:S.value.id,payload:t}}async function kt(t){var a,y;if(t.type==="create"){ce.value=!0;try{const C=await((a=g.onCreate)==null?void 0:a.call(g,t.payload));C!=null&&C.id&&(te(C.id),w("select-session",C.id),await he(),w("project-created",C),w("close"));return}finally{ce.value=!1}}Q.value=!0;try{const C=await((y=g.onUpdate)==null?void 0:y.call(g,t.sessionId,t.payload));C!=null&&C.id&&te(C.id)}finally{Q.value=!1}}async function Ct(){var a,y;if(!S.value||O.value)return;const t=S.value.id;_.value="",O.value=!0;try{const C=await((a=g.onDelete)==null?void 0:a.call(g,t));z.value=!1;const F=g.sessions.filter($t=>$t.id!==t),L=(C==null?void 0:C.selectedSessionId)||((y=je(F)[0])==null?void 0:y.id)||"";w("select-session",L),L?(te(L),D.value&&ze()):(Ae(),D.value&&ze())}catch(C){_.value=C.message}finally{O.value=!1}}async function _t(){var a;if(!S.value||B.value)return;const t=S.value.id;_.value="",B.value=!0;try{const y=await((a=g.onReset)==null?void 0:a.call(g,t));K.value=!1;const C=(y==null?void 0:y.session)||g.sessions.find(F=>F.id===t)||null;C!=null&&C.id&&te(C.id)}catch(y){_.value=y.message}finally{B.value=!1}}return ie(()=>g.open,t=>{if(t){ae(),typeof g.onRefresh=="function"?de().catch(()=>{}):qe().catch(()=>{});return}X.value=!1,z.value=!1,K.value=!1,Y.value=!1,_.value="",Te(),Ve(),se.value=[],J.value=!1},{immediate:!0}),ie(D,t=>{t||(le.value="detail")},{immediate:!0}),ie(()=>g.sessions,()=>{if(!g.open)return;if(b.value==="create"){if(!!(String(f.title||"").trim()||String(f.cwd||"").trim())||!!String(f.sessionId||"").trim())return;const y=Re();y&&te(y);return}if(S.value){He(S.value);return}const t=Re();if(t){te(t);return}Ae()}),ie(()=>[g.open,b.value,f.engine,f.cwd,fe.value].join(`
3
- `),()=>{ot(250)},{immediate:!0}),ie(()=>{var t;return((t=S.value)==null?void 0:t.id)||""},()=>{ot(0)}),lt(()=>{h&&(clearTimeout(h),h=null),Te(),Ve()}),W({closeTopDialog:e}),(t,a)=>(p(),m(ye,null,[I(pt,{open:K.value,title:i(r)("projectManager.confirmResetTitle"),description:S.value?i(r)("projectManager.confirmResetDescription",{title:S.value.title||i(r)("projectManager.untitledProject")}):"","confirm-text":i(r)("projectManager.confirmReset"),"cancel-text":i(r)("projectManager.keep"),loading:B.value,onCancel:a[0]||(a[0]=y=>K.value=!1),onConfirm:_t},null,8,["open","title","description","confirm-text","cancel-text","loading"]),I(pt,{open:z.value,title:i(r)("projectManager.confirmDeleteTitle"),description:S.value?i(r)("projectManager.confirmDeleteDescription",{title:S.value.title||i(r)("projectManager.untitledProject")}):"","confirm-text":i(r)("projectManager.confirmDelete"),"cancel-text":i(r)("projectManager.keep"),loading:O.value,danger:"",onCancel:a[1]||(a[1]=y=>z.value=!1),onConfirm:Ct},null,8,["open","title","description","confirm-text","cancel-text","loading"]),I(Dn,{open:X.value,"initial-path":f.cwd,suggestions:Be.value,onClose:a[2]||(a[2]=y=>X.value=!1),onSelect:Je},null,8,["open","initial-path","suggestions"]),I(yt,{open:d.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]=y=>w("close"))},{title:Le(()=>[n("div",ra,[I(i(Zt),{class:"h-4 w-4"}),n("span",null,u(i(r)("projectManager.managingTitle")),1)])]),default:Le(()=>{var y,C,F;return[i(D)?(p(),m("div",_a,[le.value==="list"?(p(),m("div",$a,[n("div",Ma,[I(ht,{mobile:"",busy:T.value,"editing-session-id":P.value,"format-updated-at":Pe,"get-runtime-status-class":Oe,"get-runtime-status-label":Ie,"get-thread-status-class":Ee,"get-thread-status-label":Ue,"has-sessions":ke.value,"is-current-session":ge,"is-session-running":re,mode:b.value,sessions:ee.value,onCreate:Xe,onSelect:Ye},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),m("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:ze},[I(i(Jt),{class:"h-4 w-4"}),n("span",null,u(i(r)("projectManager.projectList")),1)],8,Ea),n("div",Pa,[n("div",Aa,u(Me.value),1),b.value==="edit"&&((C=S.value)!=null&&C.cwd)?(p(),m("p",Ra,u(S.value.cwd),1)):M("",!0)])]),n("div",Da,[n("div",Ta,[n("button",{type:"button",class:N(["tool-button px-3 py-2 text-sm",q.value==="basic"?"tool-button-accent-subtle":""]),onClick:a[7]||(a[7]=L=>q.value="basic")},u(i(r)("projectManager.basicInfo")),3),n("button",{type:"button",class:N(["tool-button px-3 py-2 text-sm",q.value==="status"?"tool-button-accent-subtle":""]),disabled:b.value==="create",onClick:a[8]||(a[8]=L=>q.value="status")},u(i(r)("projectManager.status")),11,La)])]),n("div",Ba,[q.value==="basic"?(p(),m("div",Fa,[I(vt,{mobile:"",busy:T.value,"can-edit-engine":b.value!=="edit"||ve.value,"can-edit-cwd":b.value!=="edit"||_e.value,"can-edit-session-id":b.value!=="edit"||fe.value,cwd:f.cwd,"cwd-readonly-message":we.value,"duplicate-cwd-message":be.value,engine:f.engine,"agent-engines":f.agentEngines,"engine-options":$e.value,"engine-readonly-message":Z.value,"session-candidates":Fe.value,"session-candidates-loading":J.value,"session-id":f.sessionId,"session-id-copied":Y.value,"session-id-readonly-message":pe.value,title:f.title,"workspace-suggestions":Be.value,onCopySessionId:rt,onOpenDirectoryPicker:a[9]||(a[9]=L=>X.value=!0),onSelectSessionCandidate:ne,"onUpdate:cwd":A,"onUpdate:engine":s,"onUpdate:agentEngines":o,"onUpdate:sessionId":V,"onUpdate:title":l},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?(p(),m("p",Na,[I(i(mt),{class:"h-4 w-4"}),n("span",null,u(_.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:dt},u(Ne.value),9,Ua),b.value==="edit"&&S.value?(p(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:T.value||!((F=S.value)!=null&&F.cwd),onClick:Ke},u(i(r)("projectManager.viewSource")),9,Ha)):M("",!0),b.value==="edit"&&S.value?(p(),m("button",{key:1,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:T.value||xe.value,onClick:a[10]||(a[10]=L=>K.value=!0)},u(B.value?i(r)("projectManager.resettingSession"):i(r)("projectManager.newSession")),9,za)):M("",!0),b.value==="edit"&&S.value?(p(),m("button",{key:2,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:T.value||xe.value,onClick:a[11]||(a[11]=L=>z.value=!0)},u(O.value?i(r)("projectManager.deletingProject"):i(r)("projectManager.deleteProject")),9,Ka)):M("",!0)])])):(p(),ue(oa,{key:1,"active-session":S.value,"format-updated-at":Pe,"get-runtime-status-class":Oe,"get-runtime-status-label":Ie,"get-thread-status-class":Ee,"get-thread-status-label":Ue,"is-current-session":ge,"is-session-running":re},null,8,["active-session"]))])]))])):(p(),m("div",da,[n("aside",ua,[I(ht,{busy:T.value,"editing-session-id":P.value,"format-updated-at":Pe,"get-runtime-status-class":Oe,"get-runtime-status-label":Ie,"get-thread-status-class":Ee,"get-thread-status-label":Ue,"has-sessions":ke.value,"is-current-session":ge,"is-session-running":re,mode:b.value,sessions:ee.value,onCreate:Xe,onSelect:Ye},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,u(b.value==="create"?i(r)("projectManager.createTitle"):i(r)("projectManager.editTitle")),1)])])]),n("div",ga,[I(vt,{busy:T.value,"can-edit-engine":b.value!=="edit"||ve.value,"can-edit-cwd":b.value!=="edit"||_e.value,"can-edit-session-id":b.value!=="edit"||fe.value,cwd:f.cwd,"cwd-readonly-message":we.value,"duplicate-cwd-message":be.value,engine:f.engine,"agent-engines":f.agentEngines,"engine-options":$e.value,"engine-readonly-message":Z.value,"session-candidates":Fe.value,"session-candidates-loading":J.value,"session-id":f.sessionId,"session-id-copied":Y.value,"session-id-readonly-message":pe.value,title:f.title,"workspace-suggestions":Be.value,onCopySessionId:rt,onOpenDirectoryPicker:a[3]||(a[3]=L=>X.value=!0),onSelectSessionCandidate:ne,"onUpdate:cwd":A,"onUpdate:engine":s,"onUpdate:agentEngines":o,"onUpdate:sessionId":V,"onUpdate:title":l},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?(p(),m("p",ma,[I(i(mt),{class:"h-4 w-4"}),n("span",null,u(_.value),1)])):M("",!0),n("div",va,[n("div",ha,[b.value==="edit"&&S.value?(p(),m("button",{key:0,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||!((y=S.value)!=null&&y.cwd),onClick:Ke},[I(i(Gt),{class:"h-4 w-4"}),n("span",null,u(i(r)("projectManager.viewSource")),1)],8,ya)):M("",!0),b.value==="edit"&&S.value?(p(),m("button",{key:1,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||xe.value,onClick:a[4]||(a[4]=L=>K.value=!0)},[I(i(Xt),{class:"h-4 w-4"}),n("span",null,u(B.value?i(r)("projectManager.resettingSession"):i(r)("projectManager.newSession")),1)],8,xa)):M("",!0),b.value==="edit"&&S.value?(p(),m("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||xe.value,onClick:a[5]||(a[5]=L=>z.value=!0)},[I(i(Yt),{class:"h-4 w-4"}),n("span",null,u(O.value?i(r)("projectManager.deletingProject"):i(r)("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=>w("close"))},u(i(r)("projectManager.close")),9,Sa),b.value==="create"&&ke.value?(p(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:T.value,onClick:ae},u(i(r)("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:dt},u(Ne.value),9,Ca)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{Za as default};
1
+ import{W as ut,j as yt,o as Mt,s as jt,p as It,q as ct,h as Et,t as st,f as Pt,v as ft,w as pt,x as At,y as We,z as Rt,A as nt}from"./WorkbenchView-ih1G4f79.js";import{u as Qe,f as Dt,e as Tt}from"./index-4LeM_JQe.js";import{w as ie,n as he,ak as lt,aD as p,aI as ue,aJ as Le,aF as n,aQ as u,u as i,aG as I,aW as Lt,aU as Bt,aX as Ft,aE as m,aR as ye,aS as Se,aL as N,aN as M,aV as Nt,aK as at,b as $,c as k,o as Ot,aZ as xt,r as Ut}from"./vendor-misc-DqxAnmp9.js";import{c as Ht,L as Je,F as et,e as zt,b as it,X as gt,C as Kt,Q as qt,j as Vt,y as Wt,P as Qt,i as mt,E as Gt,Y as Xt,q as Yt,s as Zt,Z as Jt}from"./vendor-ui-CnLXY_Zv.js";import"./vendor-markdown-C2aIjAg9.js";import"./vendor-tiptap-DLVi2vZE.js";import"./vendor-router-4TN1NQvz.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"},mn={key:4,class:"theme-empty-state px-3 py-8 text-sm"},vn={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"},Pn={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},An=["disabled"],Rn=["disabled"],Dn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(d,{emit:W}){const j=d,R=W,{t:v}=Qe(),G=$(""),H=$([]),g=$(!1),w=$(""),E=$(!1),r=$(""),b=$([]),P=$(!1),f=$(""),_=$(""),ce=$(null);let Q=null,O=0,B=null;const z=new Map,K=k(()=>Fe(H.value)),X=k(()=>String(f.value||"").trim()),Y=k(()=>X.value.length>=ut),D=k(()=>!!X.value),le=k(()=>Ce(_.value)||G.value),q=k(()=>D.value?b.value:K.value),me=k(()=>q.value.map(e=>{const l=c((e==null?void 0:e.path)||""),s=e!=null&&e.expanded?1:0,o=e!=null&&e.loading?1:0;return`${l}:${s}:${o}`}).join("|")),se=k(()=>D.value&&!Y.value&&!E.value&&!r.value),Z=k(()=>D.value&&Y.value&&!E.value&&!r.value&&!b.value.length),h=k(()=>!D.value&&!g.value&&!w.value&&!K.value.length);function x(e=""){const l=String(e||"").trim();return/^[a-z]:[\\/]/i.test(l)||l.includes("\\")}function c(e=""){const l=String(e||"").trim();if(!l)return"";const s=x(l);let o=l.replace(/\\/g,"/");return o.length>1&&!/^[a-z]:\/?$/i.test(o)&&o!=="/"&&(o=o.replace(/\/+$/,"")),s?o.toLowerCase():o}function U(e="",l=""){const s=c(e),o=c(l);if(!s||!o||o==="/"&&s!=="/")return!1;const A=o.endsWith("/")?o:`${o}/`;return s===o||s.startsWith(A)}function ee(e="",l=""){const s=String(e||"").trim(),o=String(l||"").trim();return s?o?x(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${o}`:`${s.replace(/[\\/]+$/,"")}\\${o}`:s==="/"?`/${o}`:`${s.replace(/\/+$/,"")}/${o}`:s:o}function S(e="",l=""){const s=c(e),o=c(l);if(!s||!o||!U(o,s))return[];const A=o===s?"":o.slice(s.length).replace(/^\//,"");return A?A.split("/").filter(Boolean):[]}function ke(e=""){const l=String(e||"").trim(),s=Ce(l);if(!l||!s||c(l)===c(s))return"";const o=x(l),A=l.replace(/\\/g,"/");if(o){const de=A.replace(/\/+$/,""),qe=de.lastIndexOf("/");if(qe<=2)return"";const Te=de.slice(0,qe).replace(/\//g,"\\");return U(Te,s)?Te:""}const V=A.replace(/\/+$/,""),ne=V.lastIndexOf("/");if(ne<=0)return"";const ae=V.slice(0,ne)||"/";return U(ae,s)?ae:""}function Ce(e=""){const l=String(e||"").trim();return l&&H.value.map(o=>String((o==null?void 0:o.path)||"").trim()).filter(o=>o&&U(l,o)).sort((o,A)=>c(A).length-c(o).length)[0]||""}function xe(e){return(e==null?void 0:e.name)||(e==null?void 0:e.path)||v("directoryPicker.unnamedDirectory")}function _e(e=""){const l=String(e||"").trim();return l?l.split(/[\\/]/).filter(Boolean).at(-1)||l:"Home"}function ve(e=""){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function fe(e="",l=""){const s=String(e||""),o=String(l||"").trim().toLowerCase();if(!s||!o)return null;const A=s.toLowerCase(),V=A.indexOf(o);if(V>=0)return{start:V,end:V+o.length};const ne=o.split(/[\\/\s_.-]+/).filter(Boolean).sort((ae,de)=>de.length-ae.length);for(const ae of ne){if(ae.length<2)continue;const de=A.indexOf(ae);if(de>=0)return{start:de,end:de+ae.length}}return null}function T(e="",l=""){const s=String(e||""),o=fe(s,l);return o?`${ve(s.slice(0,o.start))}<mark class="theme-search-highlight">${ve(s.slice(o.start,o.end))}</mark>${ve(s.slice(o.end))}`:ve(s)}function tt(e){return T(xe(e),f.value)}function Be(e){return T((e==null?void 0:e.path)||"",f.value)}function $e(e,l=0){return{...e,depth:l,expanded:!1,loaded:!1,loading:!1,children:[]}}function Fe(e=[],l=[]){return e.forEach(s=>{l.push(s),s.expanded&&s.children.length&&Fe(s.children,l)}),l}function oe(){H.value=[...H.value]}function be(){Q&&(window.clearTimeout(Q),Q=null),B&&(B.abort(),B=null)}function we(e,l=H.value){const s=c(e);if(!s)return null;for(const o of l){if(c(o.path)===s)return o;if(o.children.length){const A=we(e,o.children);if(A)return A}}return null}function J(e){_.value=String((e==null?void 0:e.path)||"").trim()}function pe(e=""){return c(e)}function Ne(e,l){const s=pe(e);if(s){if(l){z.set(s,l);return}z.delete(s)}}function Me(){var l;const e=z.get(pe(_.value));(l=e==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})}function Ge(){he(()=>{var e,l;(l=(e=ce.value)==null?void 0:e.focus)==null||l.call(e)})}function re(){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 ge(){const e=q.value;if(!e.length)return-1;const l=pe(_.value),s=e.findIndex(o=>pe((o==null?void 0:o.path)||"")===l);return s>=0?s:0}function je(){const e=q.value,l=ge();return l<0||!e.length?null:e[l]||null}function Ie(e=1){const l=q.value;if(!l.length)return!1;const s=ge(),o=s<0?0:(s+e+l.length)%l.length;return J(l[o]),he(Me),!0}async function Oe(){if(D.value)return!1;const e=je();if(!e||!e.hasChildren)return!1;if(!e.expanded)return await De(e),!0;const l=q.value,s=ge(),o=l[s+1];return o&&ke(o.path)===e.path?(J(o),he(Me),!0):!1}function Ue(){if(D.value)return!1;const e=je();if(!e)return!1;if(e.expanded&&e.hasChildren)return e.expanded=!1,oe(),J(e),!0;const l=ke(e.path);if(!l)return!1;const s=we(l);return s?(J(s),he(Me),!0):!1}function Ee(e){var l,s,o;if((l=e==null?void 0:e.preventDefault)==null||l.call(e),X.value){(s=e==null?void 0:e.stopPropagation)==null||s.call(e),f.value="";return}(o=e==null?void 0:e.stopPropagation)==null||o.call(e),R("close")}function Pe(e){const l=String((e==null?void 0:e.key)||"");if(["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Enter","Escape"].includes(l)&&!(D.value&&(l==="ArrowLeft"||l==="ArrowRight"))){if(l==="ArrowDown"){e.preventDefault(),Ie(1);return}if(l==="ArrowUp"){e.preventDefault(),Ie(-1);return}if(l==="Escape"){Ee(e);return}if(D.value){if(l==="Enter"){e.preventDefault();const s=je();s&&Ze(s)}return}if(l==="ArrowRight"){e.preventDefault(),Oe();return}if(l==="ArrowLeft"){e.preventDefault(),Ue();return}l==="Enter"&&(e.preventDefault(),Ke())}}async function He(e,l={}){if(!(!e||e.loading)&&!(e.loaded&&!l.force)){e.loading=!0,w.value="",oe();try{const s=await ct({path:e.path,limit:240});e.children=(s.items||[]).map(o=>$e(o,e.depth+1)),e.loaded=!0}catch(s){w.value=s.message||v("directoryPicker.loadFailed")}finally{e.loading=!1,oe()}}}async function Ae(){g.value=!0,w.value="";try{const e=await ct({limit:240});G.value=String(e.path||"");const l=Array.isArray(e.roots)&&e.roots.length?e.roots:[{name:_e(e.path||""),path:String(e.path||""),type:"directory",hasChildren:!0,isRoot:!0}],s=c(e.path||""),o=l.map(A=>{const V=$e({...A,isHomeRoot:c(A.path||"")===s},0);return V.isHomeRoot&&(V.children=(e.items||[]).map(ne=>$e(ne,1)),V.loaded=!0,V.expanded=!0),V});H.value=o,J(o.find(A=>A.isHomeRoot)||o[0])}catch(e){w.value=e.message||v("directoryPicker.treeLoadFailed"),H.value=[],G.value=""}finally{g.value=!1}}async function te(e=""){const l=String(e||"").trim(),s=Ce(l);if(!l||!s)return;let o=we(s);if(!o)return;J(o);const A=S(s,l);for(const V of A){await He(o),o.expanded=!0,oe();const ne=we(ee(o.path,V),o.children);if(!ne)break;o=ne,J(o)}}async function Re(){f.value="",b.value=[],r.value="",P.value=!1,_.value="",await Ae();const e=String(j.initialPath||"").trim();e&&Ce(e)&&await te(e)}async function De(e){if(e!=null&&e.path&&(J(e),!!e.hasChildren)){if(!e.loaded){e.expanded=!0,oe(),await He(e);return}e.expanded=!e.expanded,oe()}}function ze(e){e!=null&&e.path&&J(e)}async function Xe(){const e=String(f.value||"").trim();O+=1;const l=O;if(be(),!j.open||!e||!le.value||!Y.value){E.value=!1,r.value="",b.value=[],P.value=!1;return}E.value=!0,r.value="",B=new AbortController;try{const s=await jt(e,{path:le.value,limit:80,signal:B.signal});if(l!==O)return;b.value=Array.isArray(s.items)?s.items:[],P.value=!!s.truncated}catch(s){if(It(s)||l!==O)return;r.value=s.message||v("directoryPicker.searchFailed"),b.value=[],P.value=!1}finally{l===O&&(B=null),l===O&&(E.value=!1)}}function Ye(){if(be(),!String(f.value||"").trim()||!Y.value){E.value=!1,r.value="",b.value=[],P.value=!1;return}E.value=!0,r.value="",Q=window.setTimeout(()=>{Q=null,Xe()},Mt)}async function Ze(e){e!=null&&e.path&&(await te(e.path),f.value="")}function Ke(){_.value&&(R("select",_.value),R("close"))}return ie(f,()=>{Ye()}),ie(me,()=>{re(),he(Me)},{immediate:!0}),ie(()=>j.open,e=>{if(e){Re().catch(()=>{}),Ge();return}be()}),lt(()=>{be()}),(e,l)=>(p(),ue(yt,{open:d.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":g.value||E.value,"close-on-backdrop":!(g.value||E.value),"close-on-escape":!(g.value||E.value),onClose:l[2]||(l[2]=s=>R("close"))},{title:Le(()=>[n("div",null,[n("div",en,[I(i(et),{class:"h-4 w-4"}),n("span",null,u(i(v)("directoryPicker.title")),1)]),n("p",tn,u(i(v)("directoryPicker.intro")),1)])]),default:Le(()=>[n("div",{class:"flex min-h-0 flex-1 flex-col overflow-hidden",onKeydown:Pe},[n("div",nn,[n("div",sn,[n("span",an,u(i(v)("directoryPicker.currentSelection")),1),n("span",ln,u(_.value||i(v)("directoryPicker.selectionPlaceholder")),1)])]),n("label",on,[n("span",null,u(i(v)("directoryPicker.searchLabel")),1),n("div",rn,[I(i(Ht),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Lt(n("input",{ref_key:"searchInputRef",ref:ce,"onUpdate:modelValue":l[0]||(l[0]=s=>f.value=s),type:"text",placeholder:i(v)("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(Ee,["esc"])},null,40,dn),[[Ft,f.value]])])]),n("div",un,[D.value&&r.value?(p(),m("div",cn,u(r.value),1)):!D.value&&w.value?(p(),m("div",fn,u(w.value),1)):D.value&&E.value?(p(),m("div",pn,[I(i(Je),{class:"h-4 w-4 animate-spin"}),n("span",null,u(i(v)("directoryPicker.searching")),1)])):!D.value&&g.value?(p(),m("div",gn,[I(i(Je),{class:"h-4 w-4 animate-spin"}),n("span",null,u(i(v)("directoryPicker.treeLoading")),1)])):se.value?(p(),m("div",mn,u(i(v)("directoryPicker.searchMinKeywordHint",{count:i(ut)})),1)):Z.value?(p(),m("div",vn,u(i(v)("directoryPicker.noSearchResults")),1)):h.value?(p(),m("div",hn,u(i(v)("directoryPicker.emptyTree")),1)):D.value?(p(),m("div",yn,[(p(!0),m(ye,null,Se(b.value,s=>(p(),m("button",{key:s.path,ref_for:!0,ref:o=>Ne(s.path,o),type:"button",class:N(["theme-list-row focus:outline-none",c(_.value)===c(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:o=>Ze(s)},[I(i(et),{class:"theme-list-item-icon"}),n("div",bn,[n("div",null,[n("span",{class:"theme-list-item-title block break-all",innerHTML:tt(s)},null,8,wn)]),n("div",{class:"theme-list-item-subtitle theme-list-item-subtitle--mono break-all",innerHTML:Be(s)},null,8,Sn)])],10,xn))),128)),P.value?(p(),m("p",kn,u(i(v)("directoryPicker.truncatedHint")),1)):M("",!0)])):(p(),m("div",Cn,[(p(!0),m(ye,null,Se(K.value,s=>(p(),m("div",{key:s.path,ref_for:!0,ref:o=>Ne(s.path,o),class:N(["theme-list-tree-item outline-none focus:outline-none focus-visible:outline-none",c(_.value)===c(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:N(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:at(o=>De(s),["stop"])},[s.loading?(p(),ue(i(Je),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),ue(i(zt),{key:1,class:N(["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:o=>ze(s)},[I(i(et),{class:N(["h-4 w-4 shrink-0",c(_.value)===c(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),n("div",jn,[n("div",{class:N(["theme-list-item-title truncate",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},u(xe(s)),3),s.isHomeRoot?(p(),m("div",In,u(s.path),1)):M("",!0)])],8,Mn)])],6))),128))]))])],32),n("div",En,[n("div",Pn,[n("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:g.value||E.value,onClick:l[1]||(l[1]=s=>R("close"))},u(i(v)("directoryPicker.cancel")),9,An),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:g.value||E.value||!_.value,onClick:Ke},[I(i(it),{class:"h-4 w-4"}),n("span",null,u(i(v)("directoryPicker.useCurrentDirectory")),1)],8,Rn)])])]),_: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"],Hn=["disabled"],zn=["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]"},Zn=["disabled","onClick"],Jn={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"},ms={class:"flex items-center justify-between gap-2 border-b border-solid px-3 py-2 text-[11px] leading-5"},vs={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(d,{emit:W}){const j=d,R=W,{t:v}=Qe(),G=$(null),H=$(null),g=$(!1),w=$(-1),E=k(()=>{const h=String(j.engine||"").trim();return j.engineOptions.find(x=>String((x==null?void 0:x.value)||"").trim()===h)||null}),r=k(()=>{const h=Array.isArray(j.agentEngines)?j.agentEngines:[];return[...new Set(h.map(x=>String(x||"").trim()).filter(Boolean))]}),b=k(()=>j.engineOptions.filter(h=>String((h==null?void 0:h.value)||"").trim()!==String(j.engine||"").trim())),P=k(()=>!!String(j.cwd||"").trim()),f=k(()=>String(j.sessionId||"").trim()),_=k(()=>f.value.toLowerCase()),ce=k(()=>j.sessionCandidates.filter(h=>h==null?void 0:h.matchedCwd)),Q=k(()=>{const h=_.value,x=ce.value;return h?x.filter(c=>[c==null?void 0:c.label,c==null?void 0:c.id,c==null?void 0:c.cwd].map(ee=>String(ee||"").toLowerCase()).some(ee=>ee.includes(h))).slice(0,10):x.slice(0,10)});function O(){j.busy||!j.canEditSessionId||!P.value||(g.value=!0)}function B(){g.value=!1,w.value=-1}function z(){const h=Q.value;if(!h.length){w.value=-1;return}const x=h.findIndex(c=>c.id===f.value);w.value=x>=0?x:0}function K(){he(()=>{var h,x;(x=(h=H.value)==null?void 0:h.focus)==null||x.call(h)})}function X(){if(g.value){B();return}O(),K()}function Y(){R("update:cwd","")}function D(h){if(!j.canEditEngine||j.busy)return;const x=String(h||"").trim(),c=r.value.includes(x)?r.value.filter(U=>U!==x):[...r.value,x];R("update:agentEngines",c)}function le(){R("update:sessionId",""),B(),K()}function q(h){var x;R("update:sessionId",((x=h==null?void 0:h.target)==null?void 0:x.value)||""),P.value&&O()}function me(h){R("select-session-candidate",h),B(),K()}function se(h){if(j.busy||!j.canEditSessionId||!P.value)return;const x=Q.value;if(h.key==="ArrowDown"){if(h.preventDefault(),!g.value){O(),z();return}if(!x.length)return;w.value=w.value<0?0:Math.min(x.length-1,w.value+1);return}if(h.key==="ArrowUp"){if(h.preventDefault(),!g.value){O(),z();return}if(!x.length)return;w.value=w.value<0?x.length-1:Math.max(0,w.value-1);return}if(h.key==="Enter"&&g.value&&x.length&&w.value>=0){h.preventDefault(),me(x[w.value]);return}h.key==="Escape"&&g.value&&(h.preventDefault(),B())}function Z(h){!g.value||!G.value||G.value.contains(h.target)||B()}return ie(Q,()=>{z()}),ie(()=>j.canEditSessionId,h=>{(!h||!P.value)&&B()}),ie(P,h=>{h||B()}),Ot(()=>{document.addEventListener("pointerdown",Z)}),lt(()=>{document.removeEventListener("pointerdown",Z)}),(h,x)=>(p(),m("div",Tn,[n("label",Ln,[n("span",null,u(i(v)("projectManager.projectTitleOptional")),1),n("input",{value:d.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:d.busy,onInput:x[0]||(x[0]=c=>R("update:title",c.target.value))},null,40,Bn)]),n("label",Fn,[n("span",null,u(i(v)("projectManager.workingDirectoryField")),1),n("div",Nn,[n("div",On,[n("input",{value:d.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:N(["tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",d.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:d.busy||!d.canEditCwd,onInput:x[1]||(x[1]=c=>R("update:cwd",c.target.value))},null,42,Un),d.cwd&&d.canEditCwd?(p(),m("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:d.busy,onClick:Y},[I(i(gt),{class:"h-3.5 w-3.5"})],8,Hn)):M("",!0)]),n("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:d.busy||!d.canEditCwd,onClick:x[2]||(x[2]=c=>R("open-directory-picker"))},[I(i(et),{class:"h-4 w-4"}),n("span",null,u(d.mobile?i(v)("projectManager.choose"):i(v)("projectManager.chooseDirectory")),1)],8,zn)]),n("datalist",Kn,[(p(!0),m(ye,null,Se(d.workspaceSuggestions,c=>(p(),m("option",{key:c,value:c},null,8,qn))),128))]),d.duplicateCwdMessage?(p(),m("p",Vn,u(d.duplicateCwdMessage),1)):d.cwdReadonlyMessage?(p(),m("p",Wn,u(d.cwdReadonlyMessage),1)):M("",!0)]),n("label",Qn,[n("span",null,u(i(v)("projectManager.engineField")),1),n("div",Gn,[I(Et,{"model-value":d.engine,options:d.engineOptions,disabled:d.busy||!d.canEditEngine,placeholder:i(v)("projectManager.selectEngine"),"empty-text":i(v)("projectManager.noEngines"),"get-option-value":c=>(c==null?void 0:c.value)||"","onUpdate:modelValue":x[3]||(x[3]=c=>R("update:engine",c))},{trigger:Le(({disabled:c})=>{var U;return[n("div",Xn,[n("span",{class:N(["min-w-0 flex-1 truncate",c?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},u(((U=E.value)==null?void 0:U.label)||i(v)("projectManager.selectEngine")),3),E.value&&E.value.enabled===!1?(p(),m("span",Yn,u(i(v)("projectManager.comingSoon")),1)):M("",!0)])]}),option:Le(({option:c,selected:U,select:ee})=>[n("button",{type:"button",class:N(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",U?"theme-filter-active":"theme-filter-idle"]),disabled:(c==null?void 0:c.enabled)===!1,onClick:ee},[n("div",Jn,[n("span",es,u(c.label),1),(c==null?void 0:c.enabled)===!1?(p(),m("span",ts,u(i(v)("projectManager.comingSoon")),1)):M("",!0)])],10,Zn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),d.engineReadonlyMessage?(p(),m("p",ns,u(d.engineReadonlyMessage),1)):M("",!0)]),n("div",ss,[n("span",null,u(i(v)("projectManager.collaborationAgents")),1),n("div",as,[(p(!0),m(ye,null,Se(b.value,c=>(p(),m("button",{key:c.value,type:"button",class:N(["theme-list-row flex items-center justify-between gap-3 rounded-sm border border-solid px-3 py-2 text-left transition",r.value.includes(c.value)?"theme-list-item-active":"theme-list-item-hover"]),disabled:d.busy||!d.canEditEngine,onClick:U=>D(c.value)},[n("div",ls,[n("div",os,u(c.label),1),n("div",rs,u(r.value.includes(c.value)?i(v)("projectManager.agentEnabled"):i(v)("projectManager.agentDisabled")),1)]),r.value.includes(c.value)?(p(),ue(i(it),{key:0,class:"h-4 w-4 shrink-0 text-[var(--theme-textPrimary)]"})):M("",!0)],10,is))),128))]),n("p",ds,u(i(v)("projectManager.collaborationAgentsHint")),1)]),n("label",us,[n("span",null,u(i(v)("projectManager.sessionId")),1),n("div",cs,[n("div",{ref_key:"sessionComboboxRef",ref:G,class:"relative min-w-0 flex-1"},[n("input",{ref_key:"sessionInputRef",ref:H,value:d.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 w-full pr-9 disabled:cursor-not-allowed disabled:opacity-80",disabled:d.busy||!d.canEditSessionId,onFocus:O,onInput:q,onKeydown:se},null,40,fs),d.canEditSessionId?(p(),m("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:d.busy||!P.value,onClick:X},[d.sessionCandidatesLoading?(p(),ue(i(Je),{key:0,class:"h-3.5 w-3.5 animate-spin"})):f.value?(p(),ue(i(gt),{key:1,class:"h-3.5 w-3.5",onClick:at(le,["stop"])})):(p(),ue(i(Kt),{key:2,class:N(["h-3.5 w-3.5 transition",g.value?"rotate-180":""])},null,8,["class"]))],8,ps)):M("",!0),d.canEditSessionId&&g.value?(p(),m("div",gs,[n("div",ms,[n("span",vs,u(i(v)("projectManager.sessionCandidates")),1),d.sessionCandidatesLoading?(p(),m("span",hs,u(i(v)("projectManager.sessionCandidatesLoading")),1)):M("",!0)]),Q.value.length?(p(),m("div",ys,[(p(!0),m(ye,null,Se(Q.value,(c,U)=>(p(),m("button",{key:`${c.engine}:${c.id}`,type:"button",class:N(["theme-list-row mb-1 w-full px-2 py-1.5 text-left last:mb-0",U===w.value?"theme-list-item-active":"theme-list-item-hover"]),disabled:d.busy,onMousedown:x[4]||(x[4]=at(()=>{},["prevent"])),onClick:ee=>me(c)},[n("div",bs,[n("span",ws,u(c.label||c.id),1),n("span",Ss,u(c.updatedAtLabel||i(v)("projectManager.unknown")),1)])],42,xs))),128))])):(p(),m("div",ks,u(P.value?i(v)("projectManager.noSessionCandidates"):i(v)("projectManager.sessionCandidatesNeedDirectory")),1))])):M("",!0)],512),f.value?(p(),m("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:d.busy,onClick:x[5]||(x[5]=c=>R("copy-session-id"))},[d.sessionIdCopied?(p(),ue(i(it),{key:0,class:"h-4 w-4"})):(p(),ue(i(qt),{key:1,class:"h-4 w-4"})),n("span",null,u(d.sessionIdCopied?i(v)("projectManager.sessionIdCopied"):i(v)("projectManager.copySessionId")),1)],8,Cs)):M("",!0)]),d.sessionIdReadonlyMessage?(p(),m("p",_s,u(d.sessionIdReadonlyMessage),1)):(p(),m("p",$s,u(P.value?i(v)("projectManager.sessionIdHint"):i(v)("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"],Ps=["onClick"],As={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Rs={class:"flex w-full flex-col gap-2 text-left"},Ds={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"},ht={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:d=>d},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(d,{emit:W}){const j=d,R=W,{t:v}=Qe();function G(w){return j.mode==="edit"&&j.editingSessionId===w.id?"theme-card-selected":j.isSessionRunning(w.id)?"theme-card-warning":"theme-card-idle-strong"}function H(w){return j.isCurrentSession(w.id)?v("projectManager.current"):v("projectManager.regular")}function g(w){return j.isCurrentSession(w.id)?"theme-status-info":"theme-status-neutral"}return(w,E)=>(p(),m("div",{class:N(d.mobile?"flex h-full min-h-0 flex-col":"")},[n("div",Ms,[n("div",null,[n("div",js,u(i(v)("projectManager.projectList")),1),d.hasSessions?M("",!0):(p(),m("p",Is,u(i(v)("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:d.busy,onClick:E[0]||(E[0]=r=>R("create"))},[I(i(Vt),{class:"h-4 w-4"}),n("span",null,u(i(v)("projectManager.create")),1)],8,Es)]),n("div",{class:N(["mt-4 space-y-2",d.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)]"])},[(p(!0),m(ye,null,Se(d.sessions,r=>{var b;return p(),m("article",{key:r.id,class:N(["relative cursor-pointer rounded-sm border p-3 transition",G(r)]),onClick:P=>R("select",r.id)},[d.mode==="edit"&&d.editingSessionId===r.id?(p(),m("span",As)):M("",!0),n("div",Rs,[n("div",Ds,[n("span",{class:"block truncate",title:r.title||i(v)("projectManager.untitledProject")},u(r.title||i(v)("projectManager.untitledProject")),9,Ts)]),n("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:r.cwd},u(r.cwd),9,Ls),n("div",Bs,[n("span",null,u(((b=r==null?void 0:r.agentBindings)==null?void 0:b.length)>1?i(v)("projectManager.agentCount",{count:r.agentBindings.length}):i(st)(r.engine)),1),d.mobile?M("",!0):(p(),m("span",Fs,"·")),d.mobile?M("",!0):(p(),m("span",Ns,u(d.formatUpdatedAt(r.updatedAt)),1))]),n("div",Os,[n("span",{class:N(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",g(r)])},u(H(r)),3),n("span",{class:N(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",d.getRuntimeStatusClass(r.id)])},[d.isSessionRunning(r.id)?(p(),m("span",Us)):M("",!0),xt(" "+u(d.getRuntimeStatusLabel(r.id)),1)],2),n("span",{class:N(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",d.getThreadStatusClass(r)])},u(d.getThreadStatusLabel(r)),3)])])],10,Ps)}),128))],2)],2))}},Hs={class:"space-y-3"},zs={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"},Zs={class:"dashed-panel px-3 py-3"},Js={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:d=>d},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(d){const{t:W}=Qe();return(j,R)=>{var v,G,H,g,w,E,r,b,P;return p(),m("div",Hs,[n("div",zs,[n("div",Ks,u(i(W)("projectManager.runtimeStatus")),1),n("div",qs,[n("span",{class:N(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",d.getRuntimeStatusClass((v=d.activeSession)==null?void 0:v.id)])},[d.isSessionRunning((G=d.activeSession)==null?void 0:G.id)?(p(),m("span",Vs)):M("",!0),xt(" "+u(d.getRuntimeStatusLabel((H=d.activeSession)==null?void 0:H.id)),1)],2),n("span",{class:N(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",d.getThreadStatusClass(d.activeSession)])},u(d.getThreadStatusLabel(d.activeSession)),3),(g=d.activeSession)!=null&&g.id&&d.isCurrentSession(d.activeSession.id)?(p(),m("span",Ws,u(i(W)("projectManager.currentProject")),1)):M("",!0)])]),n("div",Qs,[n("div",Gs,u(i(W)("projectManager.engine")),1),n("div",Xs,u(i(st)((w=d.activeSession)==null?void 0:w.engine)),1),((r=(E=d.activeSession)==null?void 0:E.agentBindings)==null?void 0:r.length)>1?(p(),m("div",Ys,[(p(!0),m(ye,null,Se(d.activeSession.agentBindings,f=>(p(),m("span",{key:f.engine,class:"theme-status-neutral inline-flex items-center rounded-sm border border-solid px-1.5 py-0.5 text-[10px]"},u(i(st)(f.engine)),1))),128))])):M("",!0)]),n("div",Zs,[n("div",Js,u(i(W)("projectManager.workingDirectory")),1),n("div",ea,u(((b=d.activeSession)==null?void 0:b.cwd)||i(W)("projectManager.notSet")),1)]),n("div",ta,[n("div",na,u(i(W)("projectManager.updatedAt")),1),n("div",sa,u(d.formatUpdatedAt((P=d.activeSession)==null?void 0:P.updatedAt)),1)]),n("div",aa,[n("div",ia,[I(i(Wt),{class:"h-3.5 w-3.5"}),n("span",null,u(i(W)("projectManager.note")),1)]),n("p",la,u(i(W)("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"},ma={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},va={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"],Pa={class:"min-w-0 flex-1"},Aa={class:"theme-heading truncate text-sm font-medium"},Ra={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Da={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"],Ha=["disabled"],za=["disabled"],Ka=["disabled"],qa=3e3,Ja={__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(d,{expose:W,emit:j}){const R=new Map;function v(t="",a=""){const y=We(t),C=nt(a);return!y||!C?"":`${y}
2
+ ${C}`}function G(t=""){if(!t)return null;const a=R.get(t);return a?a.expiresAt<=Date.now()?(R.delete(t),null):Array.isArray(a.items)?a.items:[]:null}function H(t="",a=[]){t&&R.set(t,{expiresAt:Date.now()+qa,items:Array.isArray(a)?a:[]})}const g=d,w=j,{locale:E,t:r}=Qe(),b=$("edit"),P=$(""),f=Ut({title:"",engine:"codex",agentEngines:[],cwd:"",sessionId:""}),_=$(""),ce=$(!1),Q=$(!1),O=$(!1),B=$(!1),z=$(!1),K=$(!1),X=$(!1),Y=$(!1),{matches:D}=Pt("(max-width: 767px)"),le=$("list"),q=$("basic"),me=$(ft()),se=$([]),Z=$(!1);let h=null,x=null,c=null,U=0;const ee=k(()=>je(g.sessions)),S=k(()=>g.sessions.find(t=>t.id===P.value)||null),ke=k(()=>g.sessions.length>0),Ce=k(()=>g.sessions.find(t=>t.id===g.selectedSessionId)||null),xe=k(()=>!!(S.value&&re(S.value.id))),_e=k(()=>{var t;return!((t=S.value)!=null&&t.started)}),ve=k(()=>{var t;return!((t=S.value)!=null&&t.started)}),fe=k(()=>{var t;return!((t=S.value)!=null&&t.started)}),T=k(()=>g.loading||ce.value||Q.value||O.value||B.value),tt=k(()=>String(f.sessionId||"").trim()),Be=k(()=>{var y,C;const t=new Set,a=[];return[f.cwd,(y=S.value)==null?void 0:y.cwd,(C=Ce.value)==null?void 0:C.cwd,...g.workspaces,...g.sessions.map(F=>F.cwd)].forEach(F=>{const L=String(F||"").trim();!L||t.has(L)||(t.add(L),a.push(L))}),a.slice(0,12)}),$e=k(()=>me.value),Fe=k(()=>se.value.map(t=>({...t,updatedAtLabel:t.updatedAt?Pe(t.updatedAt):""}))),oe=k(()=>{const t=nt(f.cwd);return t?g.sessions.filter(a=>{var y;return a.id===((y=S.value)==null?void 0:y.id)?!1:nt(a.cwd)===t}):[]}),be=k(()=>{if(!oe.value.length)return"";const t=oe.value.slice(0,3).map(a=>{const y=a.title||r("projectManager.untitledProject");return E.value==="en-US"?`"${y}"`:`「${y}」`}).join(E.value==="en-US"?", ":"、");return r("projectManager.duplicateDirectory",{labels:t,count:oe.value.length})}),we=k(()=>b.value!=="edit"||_e.value?"":r("projectManager.cwdReadonly")),J=k(()=>b.value!=="edit"||!S.value||ve.value?"":r("projectManager.engineReadonly")),pe=k(()=>b.value!=="edit"||!S.value||fe.value?"":r("projectManager.sessionIdReadonly")),Ne=k(()=>b.value==="create"?ce.value?r("projectManager.creatingProject"):r("projectManager.createProject"):Q.value?r("projectManager.savingChanges"):r("projectManager.saveChanges")),Me=k(()=>{var t;return b.value==="create"?r("projectManager.newProject"):((t=S.value)==null?void 0:t.title)||r("projectManager.untitledProject")});function Ge(t=""){const a=Date.parse(String(t||""));return Number.isFinite(a)?a:0}function re(t){var a;return!!((a=g.sessions.find(y=>y.id===t))!=null&&a.running)}function ge(t){return!!t&&t===g.selectedSessionId}function je(t=[]){return[...t].sort((a,y)=>{const C=Number(re(y.id))-Number(re(a.id));if(C)return C;const F=Number(ge(y.id))-Number(ge(a.id));if(F)return F;const L=Ge(y.updatedAt)-Ge(a.updatedAt);return L||Tt(String(a.title||a.cwd||a.id),String(y.title||y.cwd||y.id))})}function Ie(t){return re(t)?r("projectManager.running"):r("projectManager.idle")}function Oe(t){return re(t)?"theme-status-warning":"theme-status-success"}function Ue(t){return t!=null&&t.started?r("projectManager.threadBound"):r("projectManager.notStarted")}function Ee(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function Pe(t=""){if(!t)return r("projectManager.unknown");const a=new Date(t);return Number.isNaN(a.getTime())?t:Dt(a.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function He(t){f.title=String((t==null?void 0:t.title)||""),f.engine=We(t==null?void 0:t.engine),f.agentEngines=(Array.isArray(t==null?void 0:t.agentBindings)?t.agentBindings:[]).map(a=>We(a==null?void 0:a.engine)).filter(a=>a&&a!==f.engine),f.cwd=String((t==null?void 0:t.cwd)||""),f.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",P.value="",_.value="",f.title="",f.engine="codex",f.agentEngines=[],f.cwd="",f.sessionId=""}function te(t){const a=g.sessions.find(y=>y.id===t);a&&(b.value="edit",P.value=a.id,_.value="",He(a))}function Re(){var t;return g.selectedSessionId&&g.sessions.some(a=>a.id===g.selectedSessionId)?g.selectedSessionId:((t=ee.value[0])==null?void 0:t.id)||""}function De(t="basic"){le.value="detail",q.value=t}function ze(){le.value="list",q.value="basic"}function Xe(){Ae(),D.value&&De("basic")}function Ye(t){T.value||(te(t),D.value&&De("basic"))}function Ze(t){f.cwd=String(t||"").trim()}async function Ke(){var a,y;const t=((a=S.value)==null?void 0:a.id)||Re();return!t||((!S.value||S.value.id!==t)&&(te(t),await he()),!((y=S.value)!=null&&y.cwd))?!1:(D.value&&De("basic"),w("open-source-browser",S.value),w("close"),!0)}function e(){return z.value?(z.value=!1,!0):K.value?(K.value=!1,!0):X.value?(X.value=!1,!0):g.open?(w("close"),!0):!1}function l(t){f.title=String(t||"")}function s(t){f.engine=We(t),f.agentEngines=f.agentEngines.filter(a=>a!==f.engine)}function o(t){f.agentEngines=[...new Set((Array.isArray(t)?t:[]).map(a=>We(a)).filter(a=>a&&a!==f.engine))]}function A(t){f.cwd=String(t||"")}function V(t){f.sessionId=String(t||"")}function ne(t){f.sessionId=String((t==null?void 0:t.id)||"").trim()}function ae(){_.value="",z.value=!1,K.value=!1,Y.value=!1,q.value="basic",le.value=D.value?"list":"detail";const t=Re();if(t){te(t);return}Ae()}async function de(){if(!(T.value||typeof g.onRefresh!="function")){_.value="";try{await Promise.all([g.onRefresh(),qe()])}catch(t){_.value=t.message}}}async function qe(){try{me.value=await At()}catch{me.value=ft()}}function Te(){x&&(clearTimeout(x),x=null)}function Ve(){c&&(c.abort(),c=null)}async function bt(){const t=String(f.cwd||"").trim();if(!g.open||!fe.value||!t){se.value=[],Z.value=!1,Ve();return}const a=++U;Ve();const y=v(f.engine,t),C=G(y);if(C){se.value=C,Z.value=!1;return}c=new AbortController,Z.value=!0;try{const F=await Rt({engine:f.engine,cwd:t,limit:50,signal:c.signal});if(a!==U)return;const L=Array.isArray(F==null?void 0:F.items)?F.items:[];se.value=L,H(y,L)}catch(F){if((F==null?void 0:F.name)==="AbortError")return;a===U&&(se.value=[])}finally{a===U&&(Z.value=!1,c=null)}}function ot(t=250){if(Te(),!g.open||!fe.value||!String(f.cwd||"").trim()){se.value=[],Z.value=!1,Ve();return}x=setTimeout(()=>{x=null,bt().catch(()=>{})},t)}async function wt(t){var y;if((y=navigator.clipboard)!=null&&y.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 rt(){const t=tt.value;if(t)try{await wt(t),Y.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{Y.value=!1,h=null},1800)}catch(a){_.value=(a==null?void 0:a.message)||r("projectManager.copySessionIdFailed")}}async function dt(){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(f.cwd||"").trim();return a?{type:"create",cwd:a,payload:{title:f.title,engine:f.engine,agentEngines:[f.engine,...f.agentEngines],cwd:a,sessionId:String(f.sessionId||"").trim()}}:(_.value=r("projectManager.directoryRequired"),null)}if(!S.value)return _.value=r("projectManager.projectMissing"),null;const t={title:f.title,engine:f.engine,agentEngines:[f.engine,...f.agentEngines]};return _e.value&&(t.cwd=f.cwd),fe.value&&(t.sessionId=String(f.sessionId||"").trim()),{type:"update",sessionId:S.value.id,payload:t}}async function kt(t){var a,y;if(t.type==="create"){ce.value=!0;try{const C=await((a=g.onCreate)==null?void 0:a.call(g,t.payload));C!=null&&C.id&&(te(C.id),w("select-session",C.id),await he(),w("project-created",C),w("close"));return}finally{ce.value=!1}}Q.value=!0;try{const C=await((y=g.onUpdate)==null?void 0:y.call(g,t.sessionId,t.payload));C!=null&&C.id&&te(C.id)}finally{Q.value=!1}}async function Ct(){var a,y;if(!S.value||O.value)return;const t=S.value.id;_.value="",O.value=!0;try{const C=await((a=g.onDelete)==null?void 0:a.call(g,t));z.value=!1;const F=g.sessions.filter($t=>$t.id!==t),L=(C==null?void 0:C.selectedSessionId)||((y=je(F)[0])==null?void 0:y.id)||"";w("select-session",L),L?(te(L),D.value&&ze()):(Ae(),D.value&&ze())}catch(C){_.value=C.message}finally{O.value=!1}}async function _t(){var a;if(!S.value||B.value)return;const t=S.value.id;_.value="",B.value=!0;try{const y=await((a=g.onReset)==null?void 0:a.call(g,t));K.value=!1;const C=(y==null?void 0:y.session)||g.sessions.find(F=>F.id===t)||null;C!=null&&C.id&&te(C.id)}catch(y){_.value=y.message}finally{B.value=!1}}return ie(()=>g.open,t=>{if(t){ae(),typeof g.onRefresh=="function"?de().catch(()=>{}):qe().catch(()=>{});return}X.value=!1,z.value=!1,K.value=!1,Y.value=!1,_.value="",Te(),Ve(),se.value=[],Z.value=!1},{immediate:!0}),ie(D,t=>{t||(le.value="detail")},{immediate:!0}),ie(()=>g.sessions,()=>{if(!g.open)return;if(b.value==="create"){if(!!(String(f.title||"").trim()||String(f.cwd||"").trim())||!!String(f.sessionId||"").trim())return;const y=Re();y&&te(y);return}if(S.value){He(S.value);return}const t=Re();if(t){te(t);return}Ae()}),ie(()=>[g.open,b.value,f.engine,f.cwd,fe.value].join(`
3
+ `),()=>{ot(250)},{immediate:!0}),ie(()=>{var t;return((t=S.value)==null?void 0:t.id)||""},()=>{ot(0)}),lt(()=>{h&&(clearTimeout(h),h=null),Te(),Ve()}),W({closeTopDialog:e}),(t,a)=>(p(),m(ye,null,[I(pt,{open:K.value,title:i(r)("projectManager.confirmResetTitle"),description:S.value?i(r)("projectManager.confirmResetDescription",{title:S.value.title||i(r)("projectManager.untitledProject")}):"","confirm-text":i(r)("projectManager.confirmReset"),"cancel-text":i(r)("projectManager.keep"),loading:B.value,onCancel:a[0]||(a[0]=y=>K.value=!1),onConfirm:_t},null,8,["open","title","description","confirm-text","cancel-text","loading"]),I(pt,{open:z.value,title:i(r)("projectManager.confirmDeleteTitle"),description:S.value?i(r)("projectManager.confirmDeleteDescription",{title:S.value.title||i(r)("projectManager.untitledProject")}):"","confirm-text":i(r)("projectManager.confirmDelete"),"cancel-text":i(r)("projectManager.keep"),loading:O.value,danger:"",onCancel:a[1]||(a[1]=y=>z.value=!1),onConfirm:Ct},null,8,["open","title","description","confirm-text","cancel-text","loading"]),I(Dn,{open:X.value,"initial-path":f.cwd,suggestions:Be.value,onClose:a[2]||(a[2]=y=>X.value=!1),onSelect:Ze},null,8,["open","initial-path","suggestions"]),I(yt,{open:d.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]=y=>w("close"))},{title:Le(()=>[n("div",ra,[I(i(Jt),{class:"h-4 w-4"}),n("span",null,u(i(r)("projectManager.managingTitle")),1)])]),default:Le(()=>{var y,C,F;return[i(D)?(p(),m("div",_a,[le.value==="list"?(p(),m("div",$a,[n("div",Ma,[I(ht,{mobile:"",busy:T.value,"editing-session-id":P.value,"format-updated-at":Pe,"get-runtime-status-class":Oe,"get-runtime-status-label":Ie,"get-thread-status-class":Ee,"get-thread-status-label":Ue,"has-sessions":ke.value,"is-current-session":ge,"is-session-running":re,mode:b.value,sessions:ee.value,onCreate:Xe,onSelect:Ye},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),m("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:ze},[I(i(Zt),{class:"h-4 w-4"}),n("span",null,u(i(r)("projectManager.projectList")),1)],8,Ea),n("div",Pa,[n("div",Aa,u(Me.value),1),b.value==="edit"&&((C=S.value)!=null&&C.cwd)?(p(),m("p",Ra,u(S.value.cwd),1)):M("",!0)])]),n("div",Da,[n("div",Ta,[n("button",{type:"button",class:N(["tool-button px-3 py-2 text-sm",q.value==="basic"?"tool-button-accent-subtle":""]),onClick:a[7]||(a[7]=L=>q.value="basic")},u(i(r)("projectManager.basicInfo")),3),n("button",{type:"button",class:N(["tool-button px-3 py-2 text-sm",q.value==="status"?"tool-button-accent-subtle":""]),disabled:b.value==="create",onClick:a[8]||(a[8]=L=>q.value="status")},u(i(r)("projectManager.status")),11,La)])]),n("div",Ba,[q.value==="basic"?(p(),m("div",Fa,[I(vt,{mobile:"",busy:T.value,"can-edit-engine":b.value!=="edit"||ve.value,"can-edit-cwd":b.value!=="edit"||_e.value,"can-edit-session-id":b.value!=="edit"||fe.value,cwd:f.cwd,"cwd-readonly-message":we.value,"duplicate-cwd-message":be.value,engine:f.engine,"agent-engines":f.agentEngines,"engine-options":$e.value,"engine-readonly-message":J.value,"session-candidates":Fe.value,"session-candidates-loading":Z.value,"session-id":f.sessionId,"session-id-copied":Y.value,"session-id-readonly-message":pe.value,title:f.title,"workspace-suggestions":Be.value,onCopySessionId:rt,onOpenDirectoryPicker:a[9]||(a[9]=L=>X.value=!0),onSelectSessionCandidate:ne,"onUpdate:cwd":A,"onUpdate:engine":s,"onUpdate:agentEngines":o,"onUpdate:sessionId":V,"onUpdate:title":l},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?(p(),m("p",Na,[I(i(mt),{class:"h-4 w-4"}),n("span",null,u(_.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:dt},u(Ne.value),9,Ua),b.value==="edit"&&S.value?(p(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:T.value||!((F=S.value)!=null&&F.cwd),onClick:Ke},u(i(r)("projectManager.viewSource")),9,Ha)):M("",!0),b.value==="edit"&&S.value?(p(),m("button",{key:1,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:T.value||xe.value,onClick:a[10]||(a[10]=L=>K.value=!0)},u(B.value?i(r)("projectManager.resettingSession"):i(r)("projectManager.newSession")),9,za)):M("",!0),b.value==="edit"&&S.value?(p(),m("button",{key:2,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:T.value||xe.value,onClick:a[11]||(a[11]=L=>z.value=!0)},u(O.value?i(r)("projectManager.deletingProject"):i(r)("projectManager.deleteProject")),9,Ka)):M("",!0)])])):(p(),ue(oa,{key:1,"active-session":S.value,"format-updated-at":Pe,"get-runtime-status-class":Oe,"get-runtime-status-label":Ie,"get-thread-status-class":Ee,"get-thread-status-label":Ue,"is-current-session":ge,"is-session-running":re},null,8,["active-session"]))])]))])):(p(),m("div",da,[n("aside",ua,[I(ht,{busy:T.value,"editing-session-id":P.value,"format-updated-at":Pe,"get-runtime-status-class":Oe,"get-runtime-status-label":Ie,"get-thread-status-class":Ee,"get-thread-status-label":Ue,"has-sessions":ke.value,"is-current-session":ge,"is-session-running":re,mode:b.value,sessions:ee.value,onCreate:Xe,onSelect:Ye},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,u(b.value==="create"?i(r)("projectManager.createTitle"):i(r)("projectManager.editTitle")),1)])])]),n("div",ga,[I(vt,{busy:T.value,"can-edit-engine":b.value!=="edit"||ve.value,"can-edit-cwd":b.value!=="edit"||_e.value,"can-edit-session-id":b.value!=="edit"||fe.value,cwd:f.cwd,"cwd-readonly-message":we.value,"duplicate-cwd-message":be.value,engine:f.engine,"agent-engines":f.agentEngines,"engine-options":$e.value,"engine-readonly-message":J.value,"session-candidates":Fe.value,"session-candidates-loading":Z.value,"session-id":f.sessionId,"session-id-copied":Y.value,"session-id-readonly-message":pe.value,title:f.title,"workspace-suggestions":Be.value,onCopySessionId:rt,onOpenDirectoryPicker:a[3]||(a[3]=L=>X.value=!0),onSelectSessionCandidate:ne,"onUpdate:cwd":A,"onUpdate:engine":s,"onUpdate:agentEngines":o,"onUpdate:sessionId":V,"onUpdate:title":l},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?(p(),m("p",ma,[I(i(mt),{class:"h-4 w-4"}),n("span",null,u(_.value),1)])):M("",!0),n("div",va,[n("div",ha,[b.value==="edit"&&S.value?(p(),m("button",{key:0,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||!((y=S.value)!=null&&y.cwd),onClick:Ke},[I(i(Gt),{class:"h-4 w-4"}),n("span",null,u(i(r)("projectManager.viewSource")),1)],8,ya)):M("",!0),b.value==="edit"&&S.value?(p(),m("button",{key:1,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:T.value||xe.value,onClick:a[4]||(a[4]=L=>K.value=!0)},[I(i(Xt),{class:"h-4 w-4"}),n("span",null,u(B.value?i(r)("projectManager.resettingSession"):i(r)("projectManager.newSession")),1)],8,xa)):M("",!0),b.value==="edit"&&S.value?(p(),m("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||xe.value,onClick:a[5]||(a[5]=L=>z.value=!0)},[I(i(Yt),{class:"h-4 w-4"}),n("span",null,u(O.value?i(r)("projectManager.deletingProject"):i(r)("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=>w("close"))},u(i(r)("projectManager.close")),9,Sa),b.value==="create"&&ke.value?(p(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:T.value,onClick:ae},u(i(r)("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:dt},u(Ne.value),9,Ca)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{Ja as default};