@xopcai/xopc 0.0.193 → 0.0.194

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 (105) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DmNq0t2n.js → agent-avatar-dicebear-4ln7j-oZ.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-BOo1rVn9.js → agents-C1Z-rurI.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-B3xStqSX.js → app-management-settings-panel-B0IMpHk8.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-DglyenDq.js → appearance-settings-BG6ZGIUf.js} +1 -1
  8. package/dist/gateway/static/root/assets/{apps-page-DC9qPFTx.js → apps-page-CwsZENTk.js} +1 -1
  9. package/dist/gateway/static/root/assets/{archive-plugin-DvtcrBss.js → archive-plugin-BNpjG4FR.js} +1 -1
  10. package/dist/gateway/static/root/assets/{attachment-load-CALdq4xM.js → attachment-load-BK25C_hA.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-BIGGKb0T.js → automations-page-BedezAfO.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-GaVuvrDI.js → binary-plugins-fbFe6Jqc.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-C2KrMYa_.js → block-editor-SQHwWg1e.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-CPW_E-xj.js → browser-settings-page-CC0_TfTy.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-workflow-inputs-FfEEjhIS.js → browser-workflow-inputs-DuUQ_Ycz.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-workflows-page-DFP9_UQk.js → browser-workflows-page-B8I2FmrM.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CsD8aGHU.js → capabilities-settings-panel-ditT6VRs.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-NCeyWH6Z.js → capability-presets-settings-panel-bNVds1ta.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channels-settings-CknzwxNC.js → channels-settings-DhsWSbJ2.js} +1 -1
  20. package/dist/gateway/static/root/assets/{connectors-api-vaSrhPF8.js → connectors-api-Ne8mQrYN.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connectors-page-DEGE7xp_.js → connectors-page-hZA9M1z_.js} +1 -1
  22. package/dist/gateway/static/root/assets/{cron-expression-BjFuXlGY.js → cron-expression-DtWb3YAh.js} +1 -1
  23. package/dist/gateway/static/root/assets/{dependency-picker-DOdkHdPv.js → dependency-picker-3vjdusik.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-Dz-Yf8Uu.js → desktop-pet-NmW7VWdO.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-settings-C8EHFEtd.js → desktop-pet-settings-DrdSI9lX.js} +1 -1
  26. package/dist/gateway/static/root/assets/{directory-picker-path-field-DKbfmZlZ.js → directory-picker-path-field-CG5XR1UD.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-Dq0xsr_e.js → extension-debug-page-RjIezQyy.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-IgSLUyWP.js → extension-page-D9Elz9mr.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-VC-8Pjn2.js → extension-settings-page-BvVjqFvm.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-config-api-CH2R7yqo.js → gateway-config-api-C-rYVz-n.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-settings-DLQJWaBQ.js → gateway-settings-CLS25-gm.js} +1 -1
  32. package/dist/gateway/static/root/assets/{heartbeat-settings-43loWoGb.js → heartbeat-settings-DSgDxtwJ.js} +1 -1
  33. package/dist/gateway/static/root/assets/{home-page-DqvpI6LC.js → home-page-CDpUUelT.js} +1 -1
  34. package/dist/gateway/static/root/assets/{index-BpkdvHH0.js → index-Cb9y6tVR.js} +8 -8
  35. package/dist/gateway/static/root/assets/index-DtEVsSU1.css +1 -0
  36. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DJDZes_8.js → keyboard-shortcuts-settings-RcHmSHYI.js} +1 -1
  37. package/dist/gateway/static/root/assets/{local-app-workbench-page-CvNQM6qm.js → local-app-workbench-page-DvzXo7dx.js} +1 -1
  38. package/dist/gateway/static/root/assets/{local-apps-page-C2ajOn1D.js → local-apps-page-s7PKLTvO.js} +1 -1
  39. package/dist/gateway/static/root/assets/{logs-page-BLm5yWqQ.js → logs-page-CNm5fu3L.js} +1 -1
  40. package/dist/gateway/static/root/assets/{management-settings--_eXnFVr.js → management-settings-CWUHBXje.js} +1 -1
  41. package/dist/gateway/static/root/assets/{markdown-split-iL2oi-x2.js → markdown-split-B-IuPr4L.js} +1 -1
  42. package/dist/gateway/static/root/assets/{media-plugins-BIbkLVpQ.js → media-plugins-CiejHVt4.js} +1 -1
  43. package/dist/gateway/static/root/assets/{notes-page-xFxaZ6gT.js → notes-page-BSJAwHqy.js} +1 -1
  44. package/dist/gateway/static/root/assets/{notes-workbench-PAftxL3V.js → notes-workbench-DTWRQ_EU.js} +2 -2
  45. package/dist/gateway/static/root/assets/{page-tabs-CROi9zm1.js → page-tabs-D6YJ6_l_.js} +1 -1
  46. package/dist/gateway/static/root/assets/{preview-open-alternatives-BwYcPjOM.js → preview-open-alternatives-Tw_G-6jb.js} +1 -1
  47. package/dist/gateway/static/root/assets/{product-open-page-BezeuVFd.js → product-open-page-BlB3QjTV.js} +1 -1
  48. package/dist/gateway/static/root/assets/{project-detail-page-CCdfZcw-.js → project-detail-page-DT7aWLWT.js} +1 -1
  49. package/dist/gateway/static/root/assets/{projects-page-DOG9zm5e.js → projects-page-B-i3U2fU.js} +1 -1
  50. package/dist/gateway/static/root/assets/{remote-access-hub-DQBFgveI.js → remote-access-hub-v-kXavTc.js} +1 -1
  51. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bs6tpSyX.js → runtime-tools-settings-panel-D59bftC7.js} +1 -1
  52. package/dist/gateway/static/root/assets/{schema-form-CWoSjz9s.js → schema-form-DyXqGA71.js} +1 -1
  53. package/dist/gateway/static/root/assets/{sessions-page-Db6L6M2H.js → sessions-page-tEfg1Pru.js} +1 -1
  54. package/dist/gateway/static/root/assets/settings-advanced-gate-tbguNxVJ.js +1 -0
  55. package/dist/gateway/static/root/assets/{settings-form-section-BJaMEHsX.js → settings-form-section-DZUGXwFO.js} +1 -1
  56. package/dist/gateway/static/root/assets/{settings-loading-skeleton-sn4k17x7.js → settings-loading-skeleton-Lz1ec5lN.js} +1 -1
  57. package/dist/gateway/static/root/assets/{settings-page-D2hfeFPX.js → settings-page-DLofKC7q.js} +1 -1
  58. package/dist/gateway/static/root/assets/{settings-page-layout-CLtUsWsu.js → settings-page-layout-BdkN2U81.js} +1 -1
  59. package/dist/gateway/static/root/assets/{setup-status-panel-UmQC_uZ1.js → setup-status-panel-DQgoV7gj.js} +1 -1
  60. package/dist/gateway/static/root/assets/{share-preview-page-BJ58AluH.js → share-preview-page-DrZVv8tB.js} +1 -1
  61. package/dist/gateway/static/root/assets/{shares-settings-BZKn6Fdc.js → shares-settings-I2bBkyDb.js} +1 -1
  62. package/dist/gateway/static/root/assets/{skill-reload-api-Cx3i24w_.js → skill-reload-api-gFdcImEc.js} +1 -1
  63. package/dist/gateway/static/root/assets/{skills-page-DjUllGtk.js → skills-page-zOD__-H5.js} +1 -1
  64. package/dist/gateway/static/root/assets/{skills-page.utils-CZYIuE26.js → skills-page.utils-ZDcx95iD.js} +1 -1
  65. package/dist/gateway/static/root/assets/{system-settings-panel-DUrgdQMk.js → system-settings-panel-BJhat70L.js} +1 -1
  66. package/dist/gateway/static/root/assets/{task-detail-page-BGG2cFe9.js → task-detail-page-DoyREaFj.js} +1 -1
  67. package/dist/gateway/static/root/assets/{typed-models-lib-CRNMvvFX.js → typed-models-lib-B1p3wMFK.js} +1 -1
  68. package/dist/gateway/static/root/assets/{use-autosave-Dle3-zdQ.js → use-autosave-Frcfbncl.js} +1 -1
  69. package/dist/gateway/static/root/assets/{user-context-page-BLLmw5S1.js → user-context-page-DniWcH92.js} +1 -1
  70. package/dist/gateway/static/root/assets/{voice-api-key-field-BrWH0dCl.js → voice-api-key-field-CSNOUNF4.js} +1 -1
  71. package/dist/gateway/static/root/assets/{work-discovery-overlay-BZ1l9CFM.js → work-discovery-overlay-DTJGssPz.js} +1 -1
  72. package/dist/gateway/static/root/assets/work-discovery-page-Bt2-fzHu.js +1 -0
  73. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK6e9yzK.js → workflow-run-setup-panel-D3uCmyag.js} +1 -1
  74. package/dist/gateway/static/root/assets/{workflows-page-Bp5JxQJa.js → workflows-page-Ba5fVQWY.js} +1 -1
  75. package/dist/gateway/static/root/index.html +2 -2
  76. package/dist/package.js +1 -1
  77. package/dist/src/agent/agent-manager.js +1 -1
  78. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  79. package/dist/src/agent-runtime/index.js +1 -1
  80. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  81. package/dist/src/cli/commands/channels.js +1 -1
  82. package/dist/src/cli/commands/connectors.js +1 -1
  83. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  84. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  85. package/dist/src/cli/commands/models.js +1 -1
  86. package/dist/src/cli/commands/onboard.js +1 -1
  87. package/dist/src/cli/commands/update.js +1 -1
  88. package/dist/src/config/agent-profile.js +1 -1
  89. package/dist/src/extensions/sdk/index.js +1 -1
  90. package/dist/src/gateway/agents-admin.js +1 -1
  91. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  92. package/dist/src/gateway/hono/routes/update.js +2 -2
  93. package/dist/src/gateway/index.js +1 -1
  94. package/dist/src/gateway/run-loop.js +1 -1
  95. package/dist/src/gateway/service.js +6 -6
  96. package/dist/src/infra/gateway-processes.js +1 -1
  97. package/dist/src/infra/update-restart.js +1 -1
  98. package/dist/src/infra/update-runner.js +2 -2
  99. package/dist/src/infra/update-startup.js +1 -1
  100. package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
  101. package/dist/src/work-discovery/analyzer.js +1 -2
  102. package/package.json +4 -4
  103. package/dist/gateway/static/root/assets/index-CFVjH-EK.css +0 -1
  104. package/dist/gateway/static/root/assets/settings-advanced-gate-CcO2bd6q.js +0 -1
  105. package/dist/gateway/static/root/assets/work-discovery-page-BnPF2vx7.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DQ5X6cXp.js";import{n as f,r as p,s as m}from"./locale-store-Bjvw7jtg.js";import{$o as h,$r as g,Ai as _,Al as v,Ao as y,As as b,Bs as x,Cc as S,Da as C,Di as w,Dn as T,Et as E,Fc as D,Go as O,Kc as k,La as A,Ll as j,Mi as M,Mo as N,Ni as P,No as ee,Oi as F,Oo as I,Os as L,Pi as R,Pl as z,Po as B,Ps as V,Pt as H,Qc as U,Sl as te,Sn as ne,Su as re,Ti as ie,Tu as ae,Ul as oe,Wo as W,Zc as se,_a as ce,_c as le,_l as G,_s as K,aa as ue,ac as de,au as fe,bc as pe,bi as me,bs as he,ca as ge,cl as _e,da as ve,dr as ye,ec as be,es as xe,eu as Se,fa as Ce,ga as we,gt as Te,ha as Ee,hc as De,hl as Oe,ht as ke,ia as Ae,ic as je,iu as Me,ji as Ne,jo as Pe,ki as Fe,ko as Ie,l as Le,la as Re,ma as ze,na as Be,ns as Ve,oa as He,ou as Ue,pa as We,qs as Ge,ra as Ke,rs as qe,rt as Je,ru as Ye,sa as Xe,sc as Ze,sl as Qe,su as $e,ts as et,tu as tt,ua as nt,va as rt,vl as it,vr as at,wa as ot,wc as st,wi as ct,wl as lt,xi as ut,yc as dt,ys as ft,yt as pt,zl as mt}from"./index-BpkdvHH0.js";import{t as ht}from"./notes-workbench-PAftxL3V.js";import{n as gt,t as _t}from"./use-autosave-Dle3-zdQ.js";import{t as vt}from"./page-tabs-CROi9zm1.js";import{t as yt}from"./directory-picker-path-field-DKbfmZlZ.js";import{i as bt,p as xt,s as St}from"./skills-page.utils-CZYIuE26.js";import{t as Ct}from"./dependency-picker-DOdkHdPv.js";import{c as wt,l as Tt,n as Et,o as Dt,r as Ot,t as kt}from"./style-TIDOdKy0.js";var q=e(t(),1),At=n();function jt(e){return m(p(`/api/projects/${encodeURIComponent(e)}/skills`))}function Mt(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Nt(e,t){let n=new FormData;return n.set(`file`,t),m(p(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Pt(e,t,n={}){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Ft(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function It(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var J=r();function Lt({projectId:e,copy:t}){let[n,r]=(0,q.useState)([]),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(!0),[c,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(null),[_,S]=(0,q.useState)(null),[w,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(1),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(!1),[M,P]=(0,q.useState)(``),[F,L]=(0,q.useState)(``),R=(0,q.useRef)(null),H=(0,q.useCallback)(async()=>{s(!0),m(``);try{let t=await jt(e);r(t.items),a(t.skillsRoot)}catch(e){m(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,q.useEffect)(()=>{H()},[H]),(0,q.useEffect)(()=>{if(h!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{j(!0),P(``),xt({q:w,page:E,pageSize:8,sort:`downloads`,signal:e.signal}).then(k).catch(t=>{e.signal.aborted||P(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||j(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[h,E,w]);async function U(e,t){u(!0),f(t??null),m(``);try{await e(),g(null),L(``),await H()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1),f(null)}}async function te(t){m(``);try{S((await Mt(e,t)).skill)}catch(e){m(e instanceof Error?e.message:String(e))}}async function ne(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await It(e,n.id),await H()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,J.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,J.jsxs)(Ve,{children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsxs)(K,{type:`button`,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),t.add,(0,J.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(et,{children:(0,J.jsxs)(xe,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,J.jsx)(Rt,{icon:x,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>g(`marketplace`)}),(0,J.jsx)(Rt,{icon:Oe,title:t.source,hint:t.sourceHint,onClick:()=>g(`source`)}),(0,J.jsx)(Rt,{icon:b,title:t.upload,hint:t.uploadHint,onClick:()=>R.current?.click()})]})})]}),(0,J.jsx)(`input`,{ref:R,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&U(()=>Nt(e,n)),t.target.value=``}})]}),i?(0,J.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),p?(0,J.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:p}):null,o?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,J.jsx)(C,{className:`h-36 rounded-lg`},e))}):n.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,J.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ae,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void te(e.id),children:[(0,J.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void ne(e),children:[(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,J.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,J.jsx)(I,{open:h!==null,onOpenChange:e=>{e||g(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(y,{className:l(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,h===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:h===`marketplace`?t.marketplace:t.source}),(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(he,{className:`size-4`})})})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:h===`marketplace`?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,J.jsxs)(`div`,{className:`relative mt-3`,children:[(0,J.jsx)(je,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:w,onChange:e=>{T(e.target.value),D(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),M?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:M}):null,A&&!O?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,J.jsx)(C,{className:`h-32 rounded-lg`},e))}):O?.items.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:O.items.map(r=>{let i=r.providerId??O.provider,a=bt(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=d===a;return(0,J.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(St,{name:r.name,className:`size-10`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,J.jsx)(K,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void U(()=>Pt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):A?null:(0,J.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),O&&O.meta.totalPages>1?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(O.meta.page)).replace(`{{total}}`,String(O.meta.totalPages))}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:A||E<=1,onClick:()=>D(e=>Math.max(1,e-1)),children:[(0,J.jsx)(fe,{className:`size-4`}),t.marketplacePrevious]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:A||E>=O.meta.totalPages,onClick:()=>D(e=>e+1),children:[t.marketplaceNext,(0,J.jsx)(Me,{className:`size-4`})]})]})]}):null]}):(0,J.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,J.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:F,onChange:e=>L(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,J.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`secondary`,children:t.close})}),(0,J.jsx)(K,{type:`button`,disabled:c||!F.trim(),onClick:()=>void U(()=>Ft(e,F.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,J.jsx)(I,{open:!!_,onOpenChange:e=>{e||S(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:_?.name}),(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(he,{className:`size-4`})})})]}),(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:_?.bodyMarkdown})]})]})})]})}function Rt(e){let t=(0,At.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,J.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,J.jsx)(h,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var zt=[`ready`,`moving`,`waiting`,`needs_user`,`done`];function Bt(e){return{ready:e.filter(e=>e.lane===`ready`),moving:e.filter(e=>e.lane===`moving`),waiting:e.filter(e=>e.lane===`waiting`),needs_user:e.filter(e=>e.lane===`needs_user`),done:e.filter(e=>e.lane===`done`)}}function Vt(e,t){if(t===`ready`&&e.allowedCommands.includes(`add_wait`))return`pause`;if(t===`moving`&&e.allowedCommands.includes(`start`))return`run`;if(t===`moving`&&e.allowedCommands.includes(`resolve_wait`))return`resume`;if(t===`done`&&e.allowedCommands.includes(`request_review`))return`verify`}function Ht(e){if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`request_review`))return`verify`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Ut(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Wt(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Ut(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Gt(e,t){let{incoming:n}=Ut(t),r=new Set(e.filter(e=>e.lane===`waiting`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Kt(e,t){let{incoming:n,outgoing:r}=Ut(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var qt={ready:`border-edge`,moving:`border-accent ring-2 ring-accent/15`,waiting:`border-violet-400/70`,needs_user:`border-amber-400/80`,done:`border-emerald-400/60`};function Jt(e){let t=(0,At.c)(25),{data:n,selected:r}=e,i=n.task,a=i.lane===`waiting`,o=qt[i.lane],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,u;t[0]!==o||t[1]!==s||t[2]!==c?(u=l(`w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(Ot,{type:`target`,position:Tt.Left,className:`!invisible`}),t[4]=d):d=t[4];let f;t[5]===i.title?f=t[6]:(f=(0,J.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=f);let p;t[7]===a?p=t[8]:(p=a?(0,J.jsx)(Qe,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.laneLabel?h=t[13]:(h=(0,J.jsx)(`span`,{children:n.laneLabel}),t[12]=n.laneLabel,t[13]=h);let g;t[14]!==a||t[15]!==i.blockedBy?(g=a&&i.blockedBy.length>0?(0,J.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=g):g=t[16];let _;t[17]!==g||t[18]!==h?(_=(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[h,g]}),t[17]=g,t[18]=h,t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(Ot,{type:`source`,position:Tt.Right,className:`!invisible`}),t[20]=v):v=t[20];let y;return t[21]!==_||t[22]!==u||t[23]!==m?(y=(0,J.jsxs)(`div`,{className:u,children:[d,m,_,v]}),t[21]=_,t[22]=u,t[23]=m,t[24]=y):y=t[24],y}var Yt={taskNode:Jt};function Xt(e){let t=(0,At.c)(74),{tasks:n,dependencyEdges:r,returnTo:i,copy:a}=e,[o,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(),m=(0,q.useRef)(null),h;t[0]!==r||t[1]!==n?(h=Gt(n,r),t[0]=r,t[1]=n,t[2]=h):h=t[2];let g=h,_;t[3]!==g||t[4]!==u||t[5]!==o||t[6]!==n?(_=u?n.filter(e=>g.has(e.id)):o?n:n.filter(tn),t[3]=g,t[4]=u,t[5]=o,t[6]=n,t[7]=_):_=t[7];let y=_,b;t[8]===y?b=t[9]:(b=new Set(y.map(en)),t[8]=y,t[9]=b);let x=b,S;if(t[10]!==r||t[11]!==x){let e;t[13]===x?e=t[14]:(e=e=>x.has(e.dependencyTaskId)&&x.has(e.dependentTaskId),t[13]=x,t[14]=e),S=r.filter(e),t[10]=r,t[11]=x,t[12]=S}else S=t[12];let C=S,w;t[15]!==C||t[16]!==y?(w=Wt(y,C),t[15]=C,t[16]=y,t[17]=w):w=t[17];let T=w,E;t[18]!==f||t[19]!==C?(E=f?Kt(f,C):void 0,t[18]=f,t[19]=C,t[20]=E):E=t[20];let D=E,O;t[21]===f?O=t[22]:(O=e=>e.id===f,t[21]=f,t[22]=O);let k=y.find(O),A;t[23]===y?A=t[24]:(A=new Map(y.map($t)),t[23]=y,t[24]=A);let j=A,M;if(t[25]!==a.lanes||t[26]!==T||t[27]!==D||t[28]!==y){let e;t[30]!==a.lanes||t[31]!==T||t[32]!==D?(e=e=>({id:e.id,type:`taskNode`,position:T.get(e.id)??{x:0,y:0},data:{task:e,laneLabel:a.lanes[e.lane],dimmed:!!(D&&!D.has(e.id))}}),t[30]=a.lanes,t[31]=T,t[32]=D,t[33]=e):e=t[33],M=y.map(e),t[25]=a.lanes,t[26]=T,t[27]=D,t[28]=y,t[29]=M}else M=t[29];let N=M,P;if(t[34]!==D||t[35]!==j||t[36]!==C){let e;t[38]!==D||t[39]!==j?(e=e=>{let t=j.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(D&&(!D.has(e.dependencyTaskId)||!D.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:wt.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=D,t[39]=j,t[40]=e):e=t[40],P=C.map(e),t[34]=D,t[35]=j,t[36]=C,t[37]=P}else P=t[37];let ee=P,F,I;t[41]!==f||t[42]!==x?(F=()=>{f&&!x.has(f)&&p(void 0)},I=[f,x],t[41]=f,t[42]=x,t[43]=F,t[44]=I):(F=t[43],I=t[44]),(0,q.useEffect)(F,I);let L;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=window.requestAnimationFrame(()=>{m.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[45]=L):L=t[45];let R;t[46]!==u||t[47]!==o||t[48]!==y.length?(R=[u,o,y.length],t[46]=u,t[47]=o,t[48]=y.length,t[49]=R):R=t[49],(0,q.useEffect)(L,R);let z;t[50]===f?z=t[51]:(z=()=>{f&&m.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[50]=f,t[51]=z);let B=z,V;t[52]===a.hint?V=t[53]:(V=(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.hint}),t[52]=a.hint,t[53]=V);let H=u?`secondary`:`ghost`,U;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>d(Qt),t[54]=U):U=t[54];let re=u?a.allTasks:a.blockedChains,ie;t[55]!==u||t[56]!==H||t[57]!==re?(ie=(0,J.jsx)(K,{type:`button`,variant:H,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:U,children:re}),t[55]=u,t[56]=H,t[57]=re,t[58]=ie):ie=t[58];let ae;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>c(Y),t[59]=ae):ae=t[59];let oe=o?a.hideCompleted:a.showCompleted,W;t[60]!==u||t[61]!==o||t[62]!==oe?(W=(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":o,onClick:ae,disabled:u,children:oe}),t[60]=u,t[61]=o,t[62]=oe,t[63]=W):W=t[63];let se=k?(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:B,children:[(0,J.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,ce;t[64]!==ie||t[65]!==W||t[66]!==se?(ce=(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ie,W,se]}),t[64]=ie,t[65]=W,t[66]=se,t[67]=ce):ce=t[67];let le;t[68]!==V||t[69]!==ce?(le=(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[V,ce]}),t[68]=V,t[69]=ce,t[70]=le):le=t[70];let G=y.length>0?(0,J.jsxs)(`div`,{className:l(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,k&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,J.jsxs)(Dt,{nodes:N,edges:ee,nodeTypes:Yt,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onPaneClick:()=>p(void 0),onInit:e=>{m.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,J.jsx)(kt,{color:`var(--color-edge)`,gap:22,size:1}),(0,J.jsx)(Et,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),k?(0,J.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.lanes[k.lane]}),(0,J.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:k.title}),k.lane===`waiting`&&k.blockedBy.length>0?(0,J.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(k.blockedBy.length))}),(0,J.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:k.blockedBy.map(Zt)})]}):null,(0,J.jsxs)(s,{to:ne(i,k.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,J.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,J.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ue;return t[71]!==le||t[72]!==G?(ue=(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[le,G]}),t[71]=le,t[72]=G,t[73]=ue):ue=t[73],ue}function Zt(e){return(0,J.jsx)(`li`,{children:e.title},e.id)}function Y(e){return!e}function Qt(e){return!e}function $t(e){return[e.id,e]}function en(e){return e.id}function tn(e){return e.phase!==`closed`}var nn={ready:Se,moving:k,waiting:Qe,needs_user:L,done:tt},rn={ready:`text-fg-muted`,moving:`text-accent-fg`,waiting:`text-violet-700 dark:text-violet-300`,needs_user:`text-amber-700 dark:text-amber-300`,done:`text-emerald-700 dark:text-emerald-300`};function an(e){let t=(0,At.c)(57),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c}=e,u;t[0]===n?u=t[1]:(u=Ht(n),t[0]=n,t[1]=u);let d=u,f=!!d,p;t[2]!==c||t[3]!==n.id?(p=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=p):p=t[4];let m;t[5]===c?m=t[6]:(m=()=>c(``),t[5]=c,t[6]=m);let h;t[7]!==r||t[8]!==n.id?(h=ne(r,n.id),t[7]=r,t[8]=n.id,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,J.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==i||t[13]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[12]=i,t[13]=n.priority,t[14]=_):_=t[14];let v;t[15]!==g||t[16]!==_?(v=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.attention[0]?y=t[19]:(y=n.attention[0]?(0,J.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[18]=n.attention[0],t[19]=y);let b;t[20]!==i||t[21]!==n.blockedBy||t[22]!==n.lane?(b=n.lane===`waiting`&&n.blockedBy.length>0?(0,J.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,J.jsx)(Qe,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(X).join(`、`)})]}):null,t[20]=i,t[21]=n.blockedBy,t[22]=n.lane,t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==n.latestVerification?(x=n.latestVerification?(0,J.jsx)(`span`,{className:l(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[24]=i,t[25]=n.latestVerification,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.acceptanceCriteriaCount?(S=n.acceptanceCriteriaCount>0?(0,J.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[27]=i,t[28]=n.acceptanceCriteriaCount,t[29]=S):S=t[29];let C;t[30]===n.dueAt?C=t[31]:(C=n.dueAt?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)($e,{className:`size-3`,"aria-hidden":!0}),Je(new Date(n.dueAt))]}):null,t[30]=n.dueAt,t[31]=C);let w;t[32]===n.nextCheckAt?w=t[33]:(w=n.nextCheckAt?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,J.jsx)($e,{className:`size-3`,"aria-hidden":!0}),Je(new Date(n.nextCheckAt))]}):null,t[32]=n.nextCheckAt,t[33]=w);let T;t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w?(T=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[x,S,C,w]}),t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;t[39]!==b||t[40]!==T||t[41]!==h||t[42]!==v||t[43]!==y?(E=(0,J.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[v,y,b,T]}),t[39]=b,t[40]=T,t[41]=h,t[42]=v,t[43]=y,t[44]=E):E=t[44];let D;t[45]!==a||t[46]!==i||t[47]!==o||t[48]!==d||t[49]!==n?(D=d?(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`verify`&&n.allowedCommands.includes(`request_review`)?(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`verify`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.verify}):null]}):null,t[45]=a,t[46]=i,t[47]=o,t[48]=d,t[49]=n,t[50]=D):D=t[50];let O;return t[51]!==E||t[52]!==D||t[53]!==f||t[54]!==p||t[55]!==m?(O=(0,J.jsxs)(`article`,{draggable:f,onDragStart:p,onDragEnd:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[E,D]}),t[51]=E,t[52]=D,t[53]=f,t[54]=p,t[55]=m,t[56]=O):O=t[56],O}function X(e){return e.title}function on({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onCreate:a,actionBusyId:o,ref:s}){let[c,u]=(0,q.useState)(null),[p,m]=(0,q.useState)(`board`),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(()=>crypto.randomUUID()),[b,x]=(0,q.useState)(``),[S,C]=(0,q.useState)(`normal`),[w,T]=(0,q.useState)(``),[D,k]=(0,q.useState)([]),[A,j]=(0,q.useState)(!1),[M,P]=(0,q.useState)(null),F=E({chat:d(f(e=>e.language)).chat}),L=Bt(e),R=e.filter(e=>e.phase!==`closed`),z=(e,t)=>{i(e,t)},V=async e=>{e.preventDefault();let t=b.trim();if(!(!t||A)){j(!0),P(null);try{let e=w?new Date(`${w}T23:59:59.999`).getTime():void 0;await a({requestId:_,objective:t,priority:S,dependsOnTaskIds:D,attachments:F.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),x(``),C(`normal`),T(``),k([]),F.clearAttachments(),v(crypto.randomUUID()),g(!1)}catch(e){P(e instanceof Error?e.message:r.createFailed)}finally{j(!1)}}},U=()=>{v(crypto.randomUUID()),x(``),C(`normal`),T(``),k([]),F.clearAttachments(),P(null),g(!0)};return(0,q.useImperativeHandle)(s,()=>({openCreate:U})),(0,J.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":p===`board`,onClick:()=>m(`board`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,J.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":p===`graph`,onClick:()=>m(`graph`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,J.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})]}),p===`board`?(0,J.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,J.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:zt.map(t=>{let i=nn[t],a=L[t];return(0,J.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===c);r&&Vt(r,t)&&n.preventDefault()},onDrop:n=>{n.preventDefault();let r=e.find(e=>e.id===c),i=r?Vt(r,t):void 0;u(null),r&&i&&z(r,i)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,J.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,J.jsxs)(`div`,{className:l(`flex items-center gap-2`,rn[t]),children:[(0,J.jsx)(i,{className:`size-4`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.lanes[t]})]}),(0,J.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,J.jsx)(an,{task:e,returnTo:n,copy:r,busy:o===e.id,onAction:z,onDragStart:u},e.id)):(0,J.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:r.empty})})})]},t)})})}):(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,J.jsx)(Xt,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,lanes:r.lanes}})}),(0,J.jsx)(I,{open:h,onOpenChange:e=>{A||g(e)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,J.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void V(e),children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,J.jsxs)(`div`,{className:l(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,F.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),A||F.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||F.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),F.setIsDragging(!1),A||F.processFiles(Array.from(e.dataTransfer.files))},children:[(0,J.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:b,onChange:e=>{x(e.target.value),P(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:A}),(0,J.jsx)(H,{attachments:F.attachments,topPadded:!1,onRemove:e=>{A||F.removeAttachment(e)}}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:A,onClick:()=>F.fileInputRef.current?.click(),children:[(0,J.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,J.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,J.jsx)(`input`,{ref:F.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{F.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,J.jsx)(W,{value:S,onChange:e=>C(e.target.value),disabled:A,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,J.jsx)(O,{value:e,children:r.priorityOptions[e]},e))})]}),(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,J.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,J.jsx)(`input`,{type:`date`,className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:e=>T(e.target.value),disabled:A})]})]}),(0,J.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,J.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,J.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,J.jsx)(Ct,{candidates:R,selectedIds:D,disabled:A,onChange:k,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),M?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:M}):null]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:r.cancel})}),(0,J.jsx)(K,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!b.trim(),children:A?r.creating:r.create})]})]})]})]})})]})}var sn=new Set([{id:`overview`,icon:U},{id:`tasks`,icon:mt},{id:`automations`,icon:ft},{id:`files`,icon:G},{id:`notes`,icon:lt},{id:`skills`,icon:Ge},{id:`sessions`,icon:D},{id:`progress`,icon:_e},{id:`settings`,icon:be}].map(e=>e.id)),cn=`xopc.projectFiles.panelWidthPx`,ln=320,un=220,dn=560;function fn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function pn(e){return Math.min(dn,Math.max(un,Math.round(e)))}function mn(){try{let e=window.localStorage.getItem(cn);if(e==null)return ln;let t=Number.parseInt(e,10);return Number.isFinite(t)?pn(t):ln}catch{return ln}}function hn(e){try{window.localStorage.setItem(cn,String(pn(e)))}catch{}}function gn(e){return!!(e&&sn.has(e))}function _n(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Je(n)}function yn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function bn(e){let t=(0,At.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,J.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function xn(e=!1){return l(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Sn(e){let t=(0,At.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,J.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Cn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function wn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Tn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function En(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Dn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function On(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function kn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function An(e){let t=e.sourceChannel?.trim();if(t)return jn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return jn(r||``)}function jn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Mn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Nn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Pn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Pn(e.children,t,n)}:e)}function Fn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,q.useState)(!1),[u,d]=(0,q.useState)([e]),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(null),[v,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(`new`),[C,w]=(0,q.useState)(``),[T,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(null),[j,M]=(0,q.useState)(null),P=(0,q.useCallback)(async()=>{h(!0),_(null);try{let t=await Ce({limit:100});d(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,q.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{a&&P()},[P,a]);let F=(0,q.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Cn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>wn(t)-wn(e))},[e.id,u,f]),L=e=>t.statuses[e.status]??e.status,R=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,z=e=>{S(e),w(``),E(``),A(null),b(!0),s(!1)},V=(0,q.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?Tn(t):``);if(n){O(!0),A(null),M(null);try{let r=await Ke({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});b(!1),w(``),E(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=En(e);t?(M(t),b(!1)):A(e instanceof Error?e.message:String(e))}finally{O(!1)}}},[x,C,i,T]),H=(0,q.useCallback)(e=>{e.preventDefault(),V()},[V]),U=(0,q.useCallback)(()=>{V({createWorkspaceRoot:!0})},[V]),te=(0,q.useCallback)(()=>{M(null),b(!0)},[]),ne=e=>{E(e),x===`directory`&&!C.trim()&&w(Tn(e))},re=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:l(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(c,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:R(e)})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:L(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Ve,{open:a,onOpenChange:s,children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:L(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:R(e)})]}),(0,J.jsx)(Ue,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(et,{children:(0,J.jsxs)(xe,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(je,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),re(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,J.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&F.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&F.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,F.map(e=>re(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>z(`new`),children:[(0,J.jsx)(De,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>z(`directory`),children:[(0,J.jsx)(G,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,J.jsx)(be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(I,{open:v,onOpenChange:e=>!D&&b(e),children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:H,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[k?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:k}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(yt,{value:T,onChange:ne,disabled:D,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:D,children:n.cancel})}),(0,J.jsxs)(K,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:D||!(C.trim()||x===`directory`&&Tn(T)),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(I,{open:!!j,onOpenChange:e=>{e||M(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j?_n(n.workspaceMissingDescription,{workspace:j}):null})]}),j?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(G,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:j})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:te,disabled:D,children:n.workspaceMissingBack}),(0,J.jsxs)(K,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:U,disabled:D,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function In(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),p=f(e=>e.language),m=d(p),h=m.chat.workingDirectory,v=m.projectDetailPage,b=m.projectsPage,x=A(e=>e.setPageHeader),E=A(e=>e.clearPageHeader),[k,L]=(0,q.useState)(null),[z,H]=(0,q.useState)(null),[te,se]=(0,q.useState)([]),[fe,xe]=(0,q.useState)(``),[Se,Ce]=(0,q.useState)([]),[Oe,Me]=(0,q.useState)(!1),[Ve,Ue]=(0,q.useState)(null),[Ke,qe]=(0,q.useState)([]),[Je,Qe]=(0,q.useState)(0),[$e,et]=(0,q.useState)(!1),[tt,st]=(0,q.useState)(!1),[bt,xt]=(0,q.useState)(!1),[St,Ct]=(0,q.useState)([]),wt=(0,q.useRef)(new Set),[Tt,Et]=(0,q.useState)(null),[Dt,Ot]=(0,q.useState)(mn),[kt,At]=(0,q.useState)(!1),[jt,Mt]=(0,q.useState)(!1),[Nt,Pt]=(0,q.useState)(``),[Ft,It]=(0,q.useState)([]),[Rt,zt]=(0,q.useState)(!1),[Bt,Vt]=(0,q.useState)(null),[Ht,Ut]=(0,q.useState)(!1),[Wt,Gt]=(0,q.useState)(null),[Kt,qt]=(0,q.useState)([]),[Jt,Yt]=(0,q.useState)(``),[Xt,Zt]=(0,q.useState)(!0),[Y,Qt]=(0,q.useState)(!1),[$t,en]=(0,q.useState)(!1),[tn,nn]=(0,q.useState)(null),[rn,an]=(0,q.useState)(!1),[X,sn]=(0,q.useState)(`fixed`),[cn,ln]=(0,q.useState)(``),[un,dn]=(0,q.useState)(null),[Cn,wn]=(0,q.useState)(!1),[Tn,jn]=(0,q.useState)(!1),[In,Ln]=(0,q.useState)(!1),[Rn,zn]=(0,q.useState)(null),Bn=(0,q.useRef)(null),Vn=(0,q.useRef)(!1),[Hn,Z]=(0,q.useState)(null),[Un,Wn]=(0,q.useState)({title:``,reason:``}),[Q,Gn]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Kn=(0,q.useRef)(Q),qn=`overview`,$=n?`notes`:gn(t)?t:qn,Jn=(0,q.useMemo)(()=>me(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Yn=(0,q.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Jn===`/projects`?n:ut(n,Jn)},[Jn,e]),Xn=(0,q.useCallback)(t=>{e&&r(Yn(t))},[r,e,Yn]),Zn=(0,q.useCallback)(()=>{if($===`tasks`&&Bn.current){Bn.current.openCreate();return}Vn.current=!0,Xn(`tasks`)},[Xn,$]);(0,q.useEffect)(()=>{$!==`tasks`||!Vn.current||(Vn.current=!1,Bn.current?.openCreate())},[$]);let Qn=(0,q.useCallback)(t=>{e&&r(Yn(t),{replace:!0})},[r,e,Yn]),$n=(0,q.useCallback)((e,t)=>{Qn(e),r(t)},[r,Qn]),er=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Qn(e)},[Qn]),tr=(0,q.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||gn(t)||r(Yn(qn),{replace:!0})},[qn,r,e,Yn,t]),(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Zt(!0),Z(null),Promise.all([Xe(e),nt(e),ve(e),at().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;L(e),H(n),se(r),qt(i?.agents??[]),Yt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Kn.current=a,Gn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Zt(!1)}),()=>{t=!0}},[e]);let nr=(0,q.useCallback)(async()=>{e&&H(await nt(e))},[e]);(0,q.useEffect)(()=>{let t=t=>{t.detail?.projectId===e&&nr()};return window.addEventListener(`task-created-v2`,t),window.addEventListener(`task-commanded-v2`,t),window.addEventListener(`task-phase-changed-v2`,t),()=>{window.removeEventListener(`task-created-v2`,t),window.removeEventListener(`task-commanded-v2`,t),window.removeEventListener(`task-phase-changed-v2`,t)}},[e,nr]);let rr=(0,q.useCallback)(async(e,t)=>{zn(e.id),Z(null);try{let n=await pt(e.id),r=t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??`main`}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`verify`?{type:`request_review`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);await ke(e.id,r,n.task.version),await nr()}catch(e){Z(e instanceof Error?e.message:v.board.actionFailed)}finally{zn(null)}},[z,v.board.actionFailed,nr]),ir=(0,q.useCallback)(async t=>{e&&(Z(null),await Te({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:p,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await nr())},[p,e,nr]),ar=(0,q.useCallback)(async()=>{if(k){Me(!0),Z(null);try{Ce((await Le.list({projectId:k.id})).automations)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Me(!1)}}},[k]);(0,q.useEffect)(()=>{$===`automations`&&ar()},[ar,$]);let or=(0,q.useCallback)(async()=>{if(k){et(!0),Z(null);try{let e=await ge(k.id,{includeRelated:tt,limit:100});qe(e.items),Qe(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{et(!1)}}},[k,tt]);(0,q.useEffect)(()=>{$===`progress`&&or()},[or,$]);let sr=(0,q.useCallback)(async e=>{Ue(`toggle:${e.id}`),Z(null);try{e.enabled?await Le.pause(e.id):await Le.resume(e.id),await ar()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ue(null)}},[ar]),cr=(0,q.useCallback)(async()=>{if(!k?.effectiveWorkspaceRoot?.trim()){Ct([]),wt.current.clear(),Gt(null);return}Ut(!0),Gt(null),wt.current.clear();try{Ct(Nn((await Re(k.id,``)).entries)),wt.current.add(``)}catch(e){Ct([]),wt.current.clear(),Gt(e instanceof Error?e.message:String(e))}finally{Ut(!1)}},[k]),lr=(0,q.useCallback)(async e=>{if(!(!k?.effectiveWorkspaceRoot?.trim()||wt.current.has(e))){wt.current.add(e),Gt(null);try{let t=await Re(k.id,e);Ct(n=>Pn(n,e,Nn(t.entries)))}catch(t){wt.current.delete(e),Gt(t instanceof Error?t.message:String(t))}}},[k]);(0,q.useEffect)(()=>{$===`files`&&cr()},[cr,$]);let ur=Nt.trim();(0,q.useEffect)(()=>{if($!==`files`||!k||!jt||!ur){It([]),zt(!1),Vt(null);return}let e=!1;zt(!0),Vt(null),It([]);let t=window.setTimeout(()=>{we(k.id,ur,50).then(t=>{e||It(t)}).catch(t=>{e||Vt(t instanceof Error?t.message:String(t))}).finally(()=>{e||zt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[ur,k,jt,$]);let dr=(0,q.useCallback)(async()=>{if(k){jn(!0),Z(null);try{let e=await ue(k.id);$n(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{jn(!1)}}},[$n,k]),fr=(0,q.useCallback)(async()=>{if(!k)return;let[e,t]=await Promise.all([Xe(k.id),nt(k.id)]);H(t),L(e)},[k]),pr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!k||!Un.title.trim())){Ln(!0),Z(null);try{await Ae(k.id,{title:Un.title.trim(),reason:Un.reason.trim()||void 0}),Wn({title:``,reason:``}),await fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ln(!1)}}},[Un.reason,Un.title,k,fr]),mr=(0,q.useMemo)(()=>(0,J.jsx)(s,{to:Jn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Jn===`/projects`?v.backToProjects:m.sidebar.back,children:(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),[Jn,m.sidebar.back,v.backToProjects]),hr=(0,q.useMemo)(()=>k?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(K,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Zn,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),v.board.create]}),(0,J.jsxs)(K,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void dr(),disabled:Tn,children:[(0,J.jsx)(D,{className:`size-4`,"aria-hidden":!0}),v.common.newChat]})]}):null,[Zn,v.board.create,v.common.newChat,k,dr,Tn]);(0,q.useLayoutEffect)(()=>(x({startExtra:mr,main:k?(0,J.jsx)(Fn,{currentProject:k,pm:v,projectsText:b,wd:h}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:v.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:v.fallbackContext})]}),end:hr}),()=>E()),[E,hr,mr,v,k,b,x,h]);function gr(e){L(t=>t?{...t,...e}:null),Yt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function _r(e=Kn.current){if(!(!k||!fn(e,k))){Z(null),nn(null);try{let t=await rt(k.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});gr(t);let n=Kn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Kn.current=r,Gn(r)}catch(e){let t=En(e);throw t?nn(t):Z(e instanceof Error?e.message:String(e)),e}}}function vr(e){e.preventDefault(),jr.flush()}function yr(e,t=!1){let n={...Kn.current,...e};Kn.current=n,Gn(n),t&&jr.saveNow(n)}let br=(0,q.useCallback)(()=>{if(!k)return;let e=k.workspaceRoot?.trim()??``;sn(e?`fixed`:`follow`),ln(e||k.effectiveWorkspaceRoot||``),an(!0)},[k]);async function xr(e={}){if(!k)return;let t=X===`fixed`?cn.trim():``;if(!(X===`fixed`&&!t)){Qt(!0),Z(null),nn(null);try{let n=await rt(k.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});gr(n),yr({workspaceRoot:n.workspaceRoot??``}),an(!1),nn(null)}catch(e){let t=En(e);t?(nn(t),an(!1)):Z(e instanceof Error?e.message:String(e))}finally{Qt(!1)}}}async function Sr(){if(!(!k||un)){dn(`pin`),Z(null);try{gr(k.pinnedAt?await ce(k.id):await We(k.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function Cr(){if(!(!k||un)){dn(`archive`),Z(null);try{let e=k.status===`archived`?await ze(k.id):await Be(k.id);gr(e),yr({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function wr(){if(k){wn(!0),Z(null);try{await He(k.id),en(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{wn(!1)}}}async function Tr(){if(!(!k||bt)){xt(!0),Z(null);try{await Ee(k.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{xt(!1)}}}let Er=(0,q.useCallback)(e=>{Et(e)},[]),Dr=(0,q.useCallback)((e,t)=>{t||Et(e)},[]),Or=(0,q.useCallback)(async(e,t,n)=>{let r=k?.id;if(r)switch(e){case`preview`:t.isDirectory||Et(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ie(t.path);if(w(ct(e))!==`text`){let n=await _(t.path,{projectId:r}),i=ot(e)??`application/octet-stream`;F(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ne(t.path,{projectId:r});Fe(e,n)}}catch(e){R(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&R(`success`,m.workspace.pathCopied,void 0,{duration:2500})}catch{R(`warning`,m.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[m.clipboard.copyFailed,m.workspace.pathCopied,k?.id]),kr=(0,q.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),At(!0);let r=e.clientX,i=Dt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=pn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}At(!1),Ot(c),hn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Dt]);(0,q.useEffect)(()=>{$!==`files`&&Et(null)},[e,$]);let Ar=!!(k&&fn(Q,k)),jr=_t({value:k?Q:null,dirty:Ar,onSave:_r,validate:e=>e.name.trim()?null:v.settings.nameRequired});if(Xt)return(0,J.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:v.loading});if(!k)return(0,J.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(s,{to:Jn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0}),Jn===`/projects`?v.backToProjects:m.sidebar.back]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Hn||v.notFound})]});let Mr=te.slice(0,6),Nr=z?.blockers??[],Pr=z?.tasks.filter(e=>e.lane!==`done`)??[],Fr=e=>v.statuses[e]??e,Ir=e=>_n(v.common.messages,{count:e}),Lr=fe.trim().toLowerCase(),Rr=Lr?te.filter(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||v.common.agent,r=e.name?.trim()||v.sessions.fallbackTitle,i=Ir(e.messageCount??0),a=An(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Lr)}):te,zr=te.length>0&&Rr.length===0,Br=Kt.find(e=>e.id===k.defaultAgentId)?.name||k.defaultAgentId||v.settings.globalDefaultAgent,Vr=Kt.find(e=>e.id===Q.defaultAgentId),Hr=k.workspaceRoot?.trim()||``,Ur=k.status===`archived`,Wr=!!k.pinnedAt,Gr=!Hr,Kr=Hr||Vr?.workspace||k.effectiveWorkspaceRoot||v.common.defaultWorkspace,qr=X===`fixed`?cn.trim()||v.settings.workspacePlaceholder:Vr?.workspace||k.effectiveWorkspaceRoot||v.common.defaultWorkspace,Jr=(X===`fixed`?cn.trim():``)!==Hr&&(X===`follow`||!!cn.trim()),Yr=[{id:`overview`,icon:U,label:v.tabs.overview},{id:`tasks`,icon:mt,label:v.tabs.tasks},{id:`automations`,icon:ft,label:v.tabs.automations},{id:`files`,icon:G,label:v.tabs.files},{id:`notes`,icon:lt,label:v.tabs.notes},{id:`skills`,icon:Ge,label:v.tabs.skills},{id:`sessions`,icon:D,label:v.tabs.sessions},{id:`progress`,icon:_e,label:v.tabs.progress}];async function Xr(){if(!Kr)return;let e=await u(Kr);R(e?`success`:`warning`,e?m.workspace.pathCopied:m.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Zr(){nn(null),an(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,J.jsx)(vt,{items:Yr,activeTab:$,onChange:Xn,ariaLabel:v.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(K,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Xn(`settings`),children:[(0,J.jsx)(be,{className:`size-4`,"aria-hidden":!0}),v.tabs.settings,Ar?(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":v.settings.unsavedChanges}):null]})]}),Hn?(0,J.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Hn}):null,(0,J.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:k.outcome||z?.digest.summary||k.description||k.brief||v.overview.directionFallback}),z?.digest.recommendedAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:_n(v.overview.recommendedNext,{action:z.digest.recommendedAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(K,{type:`button`,variant:`secondary`,onClick:()=>void Tr(),disabled:bt,children:[(0,J.jsx)(de,{className:`size-4`,"aria-hidden":!0}),bt?v.overview.savingDigest:v.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.nextActions})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Pr.length?Pr.map(e=>(0,J.jsxs)(s,{to:ne(Yn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:v.overview.noNextActions})})]}),z?.recentReceipts.length?(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.recentResults})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:z.recentReceipts.slice(0,5).map(e=>(0,J.jsx)(`div`,{className:`px-4 py-3`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.summary}),(0,J.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]})},e.runId))})]}):null,(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.milestones})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:k.milestones.length?k.milestones.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,J.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:v.overview.noMilestones})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.projectUpdates})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:k.recentUpdates.length?k.recentUpdates.slice(0,3).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,J.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:v.overview.noProjectUpdates})})]})]})]}),(0,J.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.attention}),Nr.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Nr.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(Ye,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[v.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Fr(e.status)}`:``]})]});return e.href?(0,J.jsx)(s,{to:e.href,onClick:er(tr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:v.overview.noBlockedTasks}),(0,J.jsxs)(`form`,{onSubmit:pr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Un.title,onChange:e=>Wn(t=>({...t,title:e.target.value})),placeholder:v.overview.blockerTitlePlaceholder}),(0,J.jsx)(K,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:In||!Un.title.trim(),"aria-label":In?v.overview.addingBlocker:v.overview.addBlocker,title:In?v.overview.addingBlocker:v.overview.addBlocker,children:(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:v.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Xn(`sessions`),children:v.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Mr.length?Mr.map(e=>(0,J.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:vn(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||v.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:v.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,J.jsx)(on,{ref:Bn,tasks:z?.tasks??[],dependencyEdges:z?.dependencyEdges??[],returnTo:Yn(`tasks`),copy:v.board,onAction:rr,onCreate:ir,actionBusyId:Rn}):null,$===`automations`?(0,J.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,J.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ft,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.automations.title})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ar(),disabled:Oe,children:[(0,J.jsx)(Ze,{className:l(`size-4`,Oe&&`animate-spin`),"aria-hidden":!0}),v.common.refresh]}),(0,J.jsxs)(K,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>$n(`automations`,`/automations?projectId=${encodeURIComponent(k.id)}&action=create`),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),v.automations.create]})]})]}),Oe&&Se.length===0?(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,J.jsx)(C,{className:`h-24 rounded-lg`}),(0,J.jsx)(C,{className:`h-24 rounded-lg`})]}):Se.length?(0,J.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Se.map(e=>(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?v.automations.enabled:v.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:v.common.open}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Ve===`toggle:${e.id}`,onClick:()=>void sr(e),children:[e.enabled?(0,J.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?v.automations.pause:v.automations.resume]})]})]},e.id))}):(0,J.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:v.automations.empty})]})}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(ht,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(k.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:k.id,listTitle:v.notes.title,listDescription:v.notes.hint,emptyText:v.notes.emptyTitle,emptyDescription:v.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${k.id}`})}):null,$===`skills`?(0,J.jsx)(Lt,{projectId:k.id,copy:v.skills}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:k.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,kt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Dt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(g,{workspacePath:Kr}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,jt&&`bg-surface-hover text-fg`),onClick:()=>Mt(!0),"aria-label":v.files.search,title:v.files.search,"aria-pressed":jt,children:(0,J.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(P,{className:`size-7 shrink-0 rounded-md p-0`,loading:Ht,label:m.cron.refresh,onClick:()=>void cr()})]})]}),jt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,J.jsx)(je,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Nt,onChange:e=>Pt(e.target.value),placeholder:v.files.searchPlaceholder,"aria-label":v.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":v.files.clearSearch,title:v.files.clearSearch,onClick:()=>{Pt(``),Mt(!1)},children:(0,J.jsx)(he,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Wt?(0,J.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Wt}):null,ur?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Rt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(C,{className:`h-11 w-full`}),(0,J.jsx)(C,{className:`h-11 w-full`}),(0,J.jsx)(C,{className:`h-11 w-full`})]}):Bt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[m.workspace.loadError,`: `,Bt]}):Ft.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:v.files.noSearchResults}):Ft.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Tt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Et(e.path),title:e.path,children:[(0,J.jsx)(lt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Ht&&St.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:v.files.loading}):(0,J.jsx)(M,{tree:St,selectedPath:Tt,onSelectFile:Er,onSelectEntry:Dr,onExpandDir:e=>void lr(e),onAction:Or,actionLabels:{preview:m.workspace.preview,download:m.workspace.download,copyPath:m.workspace.copyPath,openDefault:m.workspace.openSystemApp,openWith:m.workspace.openWith,revealInFolder:m.workspace.revealInFolder,recommendedApps:m.workspace.recommendedApps},emptyHint:v.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":v.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,kt&&`bg-surface-hover`),onPointerDown:kr,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Tt?(0,J.jsx)(T,{filePath:Tt,projectId:k.id,agentId:k.defaultAgentId||Jt||void 0,onClose:()=>Et(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(G,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:v.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:v.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(K,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Xn(`settings`),children:v.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[te.length?(0,J.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,J.jsx)(je,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:fe,onChange:e=>xe(e.currentTarget.value),placeholder:v.sessions.searchPlaceholder,"aria-label":v.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),fe?(0,J.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":v.sessions.clearSearch,onClick:()=>xe(``),children:(0,J.jsx)(he,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Rr.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Rr.map(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||v.common.agent,r=An(e),i=e.name?.trim()||v.sessions.fallbackTitle,a=Ir(e.messageCount??0);return(0,J.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,J.jsx)(D,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,J.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[v.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[v.sessions.updated,`: `,t]}):null]})]},e.key)})}):zr?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:v.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,J.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.progress.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_n(v.progress.count,{count:Je})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:tt,onChange:e=>st(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),v.progress.includeRelated]}),(0,J.jsxs)(K,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void or(),disabled:$e,children:[(0,J.jsx)(Ze,{className:l(`size-4`,$e&&`animate-spin`),"aria-hidden":!0}),v.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:$e&&Ke.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:v.progress.loading}):Ke.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ke.map(e=>{let t=v.progress.types[e.type]??e.type,n=v.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Mn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===k.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:v.progress.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,On(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:vn(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[v.progress.actor,`: `,Dn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[v.progress.source,`: `,kn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:v.progress.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:vr,onBlurCapture:jr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,J.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.summaryTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:v.settings.summaryHint})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,J.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs font-medium`,yn(Q.status)),children:v.settings.statuses[Q.status]}),(0,J.jsx)(gt,{status:jr.status,error:jr.error})]})]}),(0,J.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`grid gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.detailsTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.settings.detailsHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(bn,{label:v.settings.name,children:(0,J.jsx)(`input`,{className:xn(),value:Q.name,onChange:e=>yr({name:e.target.value})})}),(0,J.jsx)(bn,{label:v.settings.defaultAgent,children:(0,J.jsxs)(W,{className:xn(),value:Q.defaultAgentId,onChange:e=>yr({defaultAgentId:e.target.value},!0),children:[(0,J.jsx)(O,{value:``,children:v.settings.globalDefaultAgent}),Kt.map(e=>(0,J.jsx)(O,{value:e.id,children:ye(e,m.agentsSettings)},e.id))]})}),(0,J.jsx)(bn,{label:v.settings.status,children:Ur?(0,J.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:v.settings.statuses.archived}):(0,J.jsxs)(W,{className:xn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>yr({status:e.target.value},!0),children:[(0,J.jsx)(O,{value:`active`,children:v.settings.statuses.active}),(0,J.jsx)(O,{value:`paused`,children:v.settings.statuses.paused})]})}),(0,J.jsx)(bn,{label:v.settings.description,hint:v.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:xn(!0),value:Q.description,onChange:e=>yr({description:e.target.value})})})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.projectGuidanceTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.settings.projectGuidanceHint})]}),(0,J.jsx)(bn,{label:v.settings.brief,hint:v.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:xn(!0),value:Q.brief,onChange:e=>yr({brief:e.target.value})})}),(0,J.jsx)(bn,{label:v.settings.instructions,hint:v.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:xn(!0),value:Q.instructions,onChange:e=>yr({instructions:e.target.value})})})]})]}),(0,J.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.workspaceRoot}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:v.settings.workspaceIndependentHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Gr?v.settings.workspaceModeFollow:v.settings.workspaceModeFixed}),(0,J.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Kr,children:Kr}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Xr(),children:[(0,J.jsx)(j,{className:`size-4`,"aria-hidden":!0}),v.settings.copyWorkspacePath]}),(0,J.jsx)(g,{workspacePath:Kr}),(0,J.jsxs)(K,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:br,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.settings.migrateWorkspace]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.currentProjectTitle}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(Sn,{label:v.settings.defaultAgent,value:Br}),(0,J.jsx)(Sn,{label:v.settings.pinState,value:Wr?v.settings.pinned:v.settings.notPinned}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,J.jsx)(Sn,{label:v.settings.createdAt,value:vn(k.createdAt)||v.common.never}),(0,J.jsx)(Sn,{label:v.settings.updatedAt,value:vn(k.updatedAt)||v.common.never})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:v.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?v.settings.pinnedTitle:v.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:v.settings.pinHint})]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:un===`pin`,onClick:()=>void Sr(),children:[Wr?(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),Wr?v.settings.unpinProject:v.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?v.settings.restoreTitle:v.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Ur?v.settings.restoreHint:v.settings.archiveHint})]}),(0,J.jsxs)(K,{type:`button`,variant:Ur?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:un===`archive`,onClick:()=>void Cr(),children:[Ur?(0,J.jsx)(Ze,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),Ur?v.settings.restoreProject:v.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:v.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:v.settings.dangerHint})]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>en(!0),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),v.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,J.jsx)(I,{open:$t,onOpenChange:e=>{Cn||en(e)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,J.jsx)(Ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:v.settings.deleteConfirmTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:k?_n(v.settings.deleteConfirm,{name:k.name}):v.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Cn,children:v.common.cancel})}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Cn||!k,onClick:()=>void wr(),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),v.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(I,{open:rn,onOpenChange:e=>{Y||an(e)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:v.settings.workspaceMigrationTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:v.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>sn(`fixed`),disabled:Y}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:v.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:v.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>sn(`follow`),disabled:Y}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:v.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:v.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(yt,{value:cn,onChange:ln,disabled:Y,wd:h,placeholder:v.settings.workspacePlaceholder,inputClassName:xn(),autoFocus:!0}):null,(0,J.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:v.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:_n(v.settings.workspaceCurrent,{workspace:qr})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Y,children:v.common.cancel})}),(0,J.jsxs)(K,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Y||!Jr,onClick:()=>void xr(),children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(I,{open:!!tn,onOpenChange:e=>{e||nn(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:v.settings.workspaceMissingTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:tn?_n(v.settings.workspaceMissingDescription,{workspace:tn}):null})]}),tn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(G,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:tn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Zr,disabled:Y,children:v.settings.workspaceMissingBack}),(0,J.jsxs)(K,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void xr({createWorkspaceRoot:!0}),disabled:Y,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.settings.workspaceMissingCreate]})]})]})]})})]})}export{In as ProjectDetailPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./check-DUBLcKHA.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-DQ5X6cXp.js";import{n as f,r as p,s as m}from"./locale-store-Bjvw7jtg.js";import{$o as h,$r as g,Ai as _,Al as v,Ao as y,As as b,Bs as x,Cc as S,Da as C,Di as w,Dn as T,Et as E,Fc as D,Go as O,Kc as k,La as A,Ll as j,Mi as M,Mo as N,Ni as P,No as ee,Oi as F,Oo as I,Os as L,Pi as R,Pl as z,Po as B,Ps as V,Pt as H,Qc as U,Sl as te,Sn as ne,Su as re,Ti as ie,Tu as ae,Ul as oe,Wo as W,Zc as se,_a as ce,_c as le,_l as G,_s as K,aa as ue,ac as de,au as fe,bc as pe,bi as me,bs as he,ca as ge,cl as _e,da as ve,dr as ye,ec as be,es as xe,eu as Se,fa as Ce,ga as we,gt as Te,ha as Ee,hc as De,hl as Oe,ht as ke,ia as Ae,ic as je,iu as Me,ji as Ne,jo as Pe,ki as Fe,ko as Ie,l as Le,la as Re,ma as ze,na as Be,ns as Ve,oa as He,ou as Ue,pa as We,qs as Ge,ra as Ke,rs as qe,rt as Je,ru as Ye,sa as Xe,sc as Ze,sl as Qe,su as $e,ts as et,tu as tt,ua as nt,va as rt,vl as it,vr as at,wa as ot,wc as st,wi as ct,wl as lt,xi as ut,yc as dt,ys as ft,yt as pt,zl as mt}from"./index-Cb9y6tVR.js";import{t as ht}from"./notes-workbench-DTWRQ_EU.js";import{n as gt,t as _t}from"./use-autosave-Frcfbncl.js";import{t as vt}from"./page-tabs-D6YJ6_l_.js";import{t as yt}from"./directory-picker-path-field-CG5XR1UD.js";import{i as bt,p as xt,s as St}from"./skills-page.utils-ZDcx95iD.js";import{t as Ct}from"./dependency-picker-3vjdusik.js";import{c as wt,l as Tt,n as Et,o as Dt,r as Ot,t as kt}from"./style-TIDOdKy0.js";var q=e(t(),1),At=n();function jt(e){return m(p(`/api/projects/${encodeURIComponent(e)}/skills`))}function Mt(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`))}function Nt(e,t){let n=new FormData;return n.set(`file`,t),m(p(`/api/projects/${encodeURIComponent(e)}/skills/upload`),{method:`POST`,body:n})}function Pt(e,t,n={}){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/marketplace/install`),{method:`POST`,body:JSON.stringify({name:t,...n})})}function Ft(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/source/install`),{method:`POST`,body:JSON.stringify({source:t})})}function It(e,t){return m(p(`/api/projects/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}`),{method:`DELETE`})}var J=r();function Lt({projectId:e,copy:t}){let[n,r]=(0,q.useState)([]),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(!0),[c,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(null),[_,S]=(0,q.useState)(null),[w,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(1),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(!1),[M,P]=(0,q.useState)(``),[F,L]=(0,q.useState)(``),R=(0,q.useRef)(null),H=(0,q.useCallback)(async()=>{s(!0),m(``);try{let t=await jt(e);r(t.items),a(t.skillsRoot)}catch(e){m(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e]);(0,q.useEffect)(()=>{H()},[H]),(0,q.useEffect)(()=>{if(h!==`marketplace`)return;let e=new AbortController,t=window.setTimeout(()=>{j(!0),P(``),xt({q:w,page:E,pageSize:8,sort:`downloads`,signal:e.signal}).then(k).catch(t=>{e.signal.aborted||P(t instanceof Error?t.message:String(t))}).finally(()=>{e.signal.aborted||j(!1)})},250);return()=>{window.clearTimeout(t),e.abort()}},[h,E,w]);async function U(e,t){u(!0),f(t??null),m(``);try{await e(),g(null),L(``),await H()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1),f(null)}}async function te(t){m(``);try{S((await Mt(e,t)).skill)}catch(e){m(e instanceof Error?e.message:String(e))}}async function ne(n){if(window.confirm(t.removeConfirm.replace(`{{name}}`,n.name))){u(!0);try{await It(e,n.id),await H()}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}}return(0,J.jsxs)(`section`,{id:`project-panel-skills`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-skills`,className:`grid content-start gap-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.description})]}),(0,J.jsxs)(Ve,{children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsxs)(K,{type:`button`,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),t.add,(0,J.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(et,{children:(0,J.jsxs)(xe,{align:`end`,sideOffset:8,className:`z-50 w-72 rounded-lg border border-edge bg-surface-panel p-1.5 shadow-xl`,children:[(0,J.jsx)(Rt,{icon:x,title:t.marketplace,hint:t.marketplaceHint,onClick:()=>g(`marketplace`)}),(0,J.jsx)(Rt,{icon:Oe,title:t.source,hint:t.sourceHint,onClick:()=>g(`source`)}),(0,J.jsx)(Rt,{icon:b,title:t.upload,hint:t.uploadHint,onClick:()=>R.current?.click()})]})})]}),(0,J.jsx)(`input`,{ref:R,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:t=>{let n=t.target.files?.[0];n&&U(()=>Nt(e,n)),t.target.value=``}})]}),i?(0,J.jsxs)(`p`,{className:`mt-3 break-all font-mono text-xs text-fg-subtle`,children:[t.path,`: `,i]}):null]}),p?(0,J.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:p}):null,o?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(e=>(0,J.jsx)(C,{className:`h-36 rounded-lg`},e))}):n.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:n.map(e=>(0,J.jsxs)(`article`,{className:`flex min-h-36 flex-col rounded-lg border border-edge bg-surface-panel p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ae,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:e.name})]}),(0,J.jsx)(`p`,{className:`mt-2 line-clamp-2 flex-1 text-sm leading-5 text-fg-muted`,children:e.description||e.id}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void te(e.id),children:[(0,J.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),t.view]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-red-600`,disabled:c,onClick:()=>void ne(e),children:[(0,J.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),t.remove]})]})]},e.id))}):(0,J.jsxs)(`div`,{className:`rounded-lg border border-dashed border-edge bg-surface-panel px-6 py-12 text-center`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.empty}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t.emptyHint})]}),(0,J.jsx)(I,{open:h!==null,onOpenChange:e=>{e||g(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(y,{className:l(`fixed left-1/2 top-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,h===`marketplace`?`h-[min(46rem,calc(100vh-2rem))] w-[min(58rem,calc(100vw-2rem))]`:`h-[min(22rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))]`),children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:h===`marketplace`?t.marketplace:t.source}),(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(he,{className:`size-4`})})})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:h===`marketplace`?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.marketplace}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.marketplaceHint}),(0,J.jsxs)(`div`,{className:`relative mt-3`,children:[(0,J.jsx)(je,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{className:`h-10 w-full rounded-md border border-edge bg-surface-base pl-9 pr-3 text-sm outline-none focus:border-accent`,value:w,onChange:e=>{T(e.target.value),D(1)},placeholder:t.marketplacePlaceholder,autoFocus:!0})]}),M?(0,J.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-300`,children:M}):null,A&&!O?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[0,1,2,3].map(e=>(0,J.jsx)(C,{className:`h-32 rounded-lg`},e))}):O?.items.length?(0,J.jsx)(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:O.items.map(r=>{let i=r.providerId??O.provider,a=bt(r,i),o=n.some(e=>e.id===r.id||e.id===a||e.name===r.name),s=d===a;return(0,J.jsxs)(`article`,{className:`group flex min-h-32 gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(St,{name:r.name,className:`size-10`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:r.name}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:r.description||`—`}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-end justify-between gap-2 pt-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-fg-subtle`,children:[(0,J.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),t.marketplaceDownloads,` `,r.downloads]}),(0,J.jsx)(K,{type:`button`,className:`h-8 px-2.5 text-xs`,variant:o?`secondary`:`primary`,disabled:c||o,onClick:()=>void U(()=>Pt(e,a,{provider:i}),a),children:o?t.marketplaceInstalled:s?t.installing:t.install})]})]})]},`${i??`default`}:${r.id}`)})}):A?null:(0,J.jsx)(`p`,{className:`mt-6 text-center text-sm text-fg-muted`,children:t.marketplaceEmpty}),O&&O.meta.totalPages>1?(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t.marketplacePage.replace(`{{page}}`,String(O.meta.page)).replace(`{{total}}`,String(O.meta.totalPages))}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:A||E<=1,onClick:()=>D(e=>Math.max(1,e-1)),children:[(0,J.jsx)(fe,{className:`size-4`}),t.marketplacePrevious]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:A||E>=O.meta.totalPages,onClick:()=>D(e=>e+1),children:[t.marketplaceNext,(0,J.jsx)(Me,{className:`size-4`})]})]})]}):null]}):(0,J.jsxs)(`section`,{className:`flex h-full flex-col`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:t.sourceHint}),(0,J.jsx)(`input`,{className:`mt-4 h-10 w-full rounded-md border border-edge bg-surface-base px-3 text-sm outline-none focus:border-accent`,value:F,onChange:e=>L(e.target.value),placeholder:t.sourcePlaceholder,autoFocus:!0}),(0,J.jsxs)(`div`,{className:`mt-auto flex justify-end gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`secondary`,children:t.close})}),(0,J.jsx)(K,{type:`button`,disabled:c||!F.trim(),onClick:()=>void U(()=>Ft(e,F.trim())),children:c?t.installing:t.install})]})]})})]})]})}),(0,J.jsx)(I,{open:!!_,onOpenChange:e=>{e||S(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-50 bg-black/45`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(48rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-xl`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:_?.name}),(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`size-9 p-0`,children:(0,J.jsx)(he,{className:`size-4`})})})]}),(0,J.jsx)(`pre`,{className:`min-h-0 flex-1 overflow-auto whitespace-pre-wrap p-5 text-sm leading-6 text-fg-muted`,children:_?.bodyMarkdown})]})]})})]})}function Rt(e){let t=(0,At.c)(13),{icon:n,title:r,hint:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,J.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,J.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,J.jsxs)(`span`,{className:`min-w-0`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==a||t[10]!==o||t[11]!==l?(u=(0,J.jsx)(h,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 rounded-md px-3 py-2.5 text-left hover:bg-surface-hover`,onClick:a,children:[o,l]})}),t[9]=a,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}var zt=[`ready`,`moving`,`waiting`,`needs_user`,`done`];function Bt(e){return{ready:e.filter(e=>e.lane===`ready`),moving:e.filter(e=>e.lane===`moving`),waiting:e.filter(e=>e.lane===`waiting`),needs_user:e.filter(e=>e.lane===`needs_user`),done:e.filter(e=>e.lane===`done`)}}function Vt(e,t){if(t===`ready`&&e.allowedCommands.includes(`add_wait`))return`pause`;if(t===`moving`&&e.allowedCommands.includes(`start`))return`run`;if(t===`moving`&&e.allowedCommands.includes(`resolve_wait`))return`resume`;if(t===`done`&&e.allowedCommands.includes(`request_review`))return`verify`}function Ht(e){if(e.allowedCommands.includes(`start`))return`run`;if(e.allowedCommands.includes(`resolve_wait`))return`resume`;if(e.allowedCommands.includes(`request_review`))return`verify`;if(e.allowedCommands.includes(`add_wait`))return`pause`}function Ut(e){let t=new Map,n=new Map;for(let r of e)t.set(r.dependencyTaskId,[...t.get(r.dependencyTaskId)??[],r.dependentTaskId]),n.set(r.dependentTaskId,[...n.get(r.dependentTaskId)??[],r.dependencyTaskId]);return{outgoing:t,incoming:n}}function Wt(e,t){let n=new Set(e.map(e=>e.id)),{outgoing:r,incoming:i}=Ut(t.filter(e=>n.has(e.dependencyTaskId)&&n.has(e.dependentTaskId))),a=new Map(e.map(e=>[e.id,i.get(e.id)?.length??0])),o=new Map(e.map(e=>[e.id,0])),s=e.filter(e=>a.get(e.id)===0).sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>e.id);for(let e=0;e<s.length;e+=1){let t=s[e];for(let e of r.get(t)??[]){o.set(e,Math.max(o.get(e)??0,(o.get(t)??0)+1));let n=(a.get(e)??1)-1;a.set(e,n),n===0&&s.push(e)}}let c=new Map;for(let t of e){let e=o.get(t.id)??0;c.set(e,[...c.get(e)??[],t.id])}let l=new Map;for(let[e,t]of c)t.forEach((t,n)=>l.set(t,{x:e*300,y:n*136}));return l}function Gt(e,t){let{incoming:n}=Ut(t),r=new Set(e.filter(e=>e.lane===`waiting`).map(e=>e.id)),i=[...r];for(let e=0;e<i.length;e+=1)for(let t of n.get(i[e])??[])r.has(t)||(r.add(t),i.push(t));return r}function Kt(e,t){let{incoming:n,outgoing:r}=Ut(t),i=new Set([e]);for(let t of[n,r]){let n=[e],r=new Set(n);for(let e=0;e<n.length;e+=1)for(let a of t.get(n[e])??[])r.has(a)||(r.add(a),i.add(a),n.push(a))}return i}var qt={ready:`border-edge`,moving:`border-accent ring-2 ring-accent/15`,waiting:`border-violet-400/70`,needs_user:`border-amber-400/80`,done:`border-emerald-400/60`};function Jt(e){let t=(0,At.c)(25),{data:n,selected:r}=e,i=n.task,a=i.lane===`waiting`,o=qt[i.lane],s=r&&`ring-2 ring-accent/30`,c=n.dimmed&&`opacity-30`,u;t[0]!==o||t[1]!==s||t[2]!==c?(u=l(`w-56 rounded-xl border bg-surface-panel p-3 shadow-surface transition-opacity`,o,s,c),t[0]=o,t[1]=s,t[2]=c,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(Ot,{type:`target`,position:Tt.Left,className:`!invisible`}),t[4]=d):d=t[4];let f;t[5]===i.title?f=t[6]:(f=(0,J.jsx)(`strong`,{className:`line-clamp-2 min-w-0 text-sm font-medium leading-5 text-fg`,children:i.title}),t[5]=i.title,t[6]=f);let p;t[7]===a?p=t[8]:(p=a?(0,J.jsx)(Qe,{className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-300`,"aria-hidden":!0}):null,t[7]=a,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.laneLabel?h=t[13]:(h=(0,J.jsx)(`span`,{children:n.laneLabel}),t[12]=n.laneLabel,t[13]=h);let g;t[14]!==a||t[15]!==i.blockedBy?(g=a&&i.blockedBy.length>0?(0,J.jsx)(`span`,{children:i.blockedBy.length}):null,t[14]=a,t[15]=i.blockedBy,t[16]=g):g=t[16];let _;t[17]!==g||t[18]!==h?(_=(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[h,g]}),t[17]=g,t[18]=h,t[19]=_):_=t[19];let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(Ot,{type:`source`,position:Tt.Right,className:`!invisible`}),t[20]=v):v=t[20];let y;return t[21]!==_||t[22]!==u||t[23]!==m?(y=(0,J.jsxs)(`div`,{className:u,children:[d,m,_,v]}),t[21]=_,t[22]=u,t[23]=m,t[24]=y):y=t[24],y}var Yt={taskNode:Jt};function Xt(e){let t=(0,At.c)(74),{tasks:n,dependencyEdges:r,returnTo:i,copy:a}=e,[o,c]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(),m=(0,q.useRef)(null),h;t[0]!==r||t[1]!==n?(h=Gt(n,r),t[0]=r,t[1]=n,t[2]=h):h=t[2];let g=h,_;t[3]!==g||t[4]!==u||t[5]!==o||t[6]!==n?(_=u?n.filter(e=>g.has(e.id)):o?n:n.filter(tn),t[3]=g,t[4]=u,t[5]=o,t[6]=n,t[7]=_):_=t[7];let y=_,b;t[8]===y?b=t[9]:(b=new Set(y.map(en)),t[8]=y,t[9]=b);let x=b,S;if(t[10]!==r||t[11]!==x){let e;t[13]===x?e=t[14]:(e=e=>x.has(e.dependencyTaskId)&&x.has(e.dependentTaskId),t[13]=x,t[14]=e),S=r.filter(e),t[10]=r,t[11]=x,t[12]=S}else S=t[12];let C=S,w;t[15]!==C||t[16]!==y?(w=Wt(y,C),t[15]=C,t[16]=y,t[17]=w):w=t[17];let T=w,E;t[18]!==f||t[19]!==C?(E=f?Kt(f,C):void 0,t[18]=f,t[19]=C,t[20]=E):E=t[20];let D=E,O;t[21]===f?O=t[22]:(O=e=>e.id===f,t[21]=f,t[22]=O);let k=y.find(O),A;t[23]===y?A=t[24]:(A=new Map(y.map($t)),t[23]=y,t[24]=A);let j=A,M;if(t[25]!==a.lanes||t[26]!==T||t[27]!==D||t[28]!==y){let e;t[30]!==a.lanes||t[31]!==T||t[32]!==D?(e=e=>({id:e.id,type:`taskNode`,position:T.get(e.id)??{x:0,y:0},data:{task:e,laneLabel:a.lanes[e.lane],dimmed:!!(D&&!D.has(e.id))}}),t[30]=a.lanes,t[31]=T,t[32]=D,t[33]=e):e=t[33],M=y.map(e),t[25]=a.lanes,t[26]=T,t[27]=D,t[28]=y,t[29]=M}else M=t[29];let N=M,P;if(t[34]!==D||t[35]!==j||t[36]!==C){let e;t[38]!==D||t[39]!==j?(e=e=>{let t=j.get(e.dependencyTaskId),n=t?.phase===`closed`&&t.resolution===`done`,r=!!(D&&(!D.has(e.dependencyTaskId)||!D.has(e.dependentTaskId)));return{id:`${e.dependencyTaskId}:${e.dependentTaskId}`,source:e.dependencyTaskId,target:e.dependentTaskId,markerEnd:{type:wt.ArrowClosed},style:{stroke:n?`var(--color-edge-strong)`:`var(--color-accent)`,strokeWidth:n?1.25:1.75,opacity:r?.18:1,strokeDasharray:n?`5 5`:void 0}}},t[38]=D,t[39]=j,t[40]=e):e=t[40],P=C.map(e),t[34]=D,t[35]=j,t[36]=C,t[37]=P}else P=t[37];let ee=P,F,I;t[41]!==f||t[42]!==x?(F=()=>{f&&!x.has(f)&&p(void 0)},I=[f,x],t[41]=f,t[42]=x,t[43]=F,t[44]=I):(F=t[43],I=t[44]),(0,q.useEffect)(F,I);let L;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=window.requestAnimationFrame(()=>{m.current?.fitView({padding:.2,minZoom:.35,maxZoom:1,duration:250})});return()=>window.cancelAnimationFrame(e)},t[45]=L):L=t[45];let R;t[46]!==u||t[47]!==o||t[48]!==y.length?(R=[u,o,y.length],t[46]=u,t[47]=o,t[48]=y.length,t[49]=R):R=t[49],(0,q.useEffect)(L,R);let z;t[50]===f?z=t[51]:(z=()=>{f&&m.current?.fitView({nodes:[{id:f}],padding:1.5,minZoom:.7,maxZoom:1,duration:250})},t[50]=f,t[51]=z);let B=z,V;t[52]===a.hint?V=t[53]:(V=(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.hint}),t[52]=a.hint,t[53]=V);let H=u?`secondary`:`ghost`,U;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>d(Qt),t[54]=U):U=t[54];let re=u?a.allTasks:a.blockedChains,ie;t[55]!==u||t[56]!==H||t[57]!==re?(ie=(0,J.jsx)(K,{type:`button`,variant:H,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":u,onClick:U,children:re}),t[55]=u,t[56]=H,t[57]=re,t[58]=ie):ie=t[58];let ae;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>c(Y),t[59]=ae):ae=t[59];let oe=o?a.hideCompleted:a.showCompleted,W;t[60]!==u||t[61]!==o||t[62]!==oe?(W=(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,"aria-pressed":o,onClick:ae,disabled:u,children:oe}),t[60]=u,t[61]=o,t[62]=oe,t[63]=W):W=t[63];let se=k?(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:B,children:[(0,J.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),a.locateTask]}):null,ce;t[64]!==ie||t[65]!==W||t[66]!==se?(ce=(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[ie,W,se]}),t[64]=ie,t[65]=W,t[66]=se,t[67]=ce):ce=t[67];let le;t[68]!==V||t[69]!==ce?(le=(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-edge bg-surface-panel px-3 py-2.5`,children:[V,ce]}),t[68]=V,t[69]=ce,t[70]=le):le=t[70];let G=y.length>0?(0,J.jsxs)(`div`,{className:l(`grid h-[min(42rem,calc(100vh-14rem))] min-h-[28rem]`,k&&`lg:grid-cols-[minmax(0,1fr)_18rem]`),children:[(0,J.jsxs)(Dt,{nodes:N,edges:ee,nodeTypes:Yt,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:(e,t)=>p(t.id),onPaneClick:()=>p(void 0),onInit:e=>{m.current=e},fitView:!0,minZoom:.25,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:{hideAttribution:!0},children:[(0,J.jsx)(kt,{color:`var(--color-edge)`,gap:22,size:1}),(0,J.jsx)(Et,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}),k?(0,J.jsxs)(`aside`,{className:`overflow-y-auto border-t border-edge bg-surface-panel p-4 lg:border-l lg:border-t-0`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:a.lanes[k.lane]}),(0,J.jsx)(`h3`,{className:`mt-2 text-sm font-semibold leading-6 text-fg`,children:k.title}),k.lane===`waiting`&&k.blockedBy.length>0?(0,J.jsxs)(`div`,{className:`mt-4 rounded-lg bg-violet-500/8 p-3`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-violet-700 dark:text-violet-300`,children:a.blockedBy.replace(`{{count}}`,String(k.blockedBy.length))}),(0,J.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:k.blockedBy.map(Zt)})]}):null,(0,J.jsxs)(s,{to:ne(i,k.id),className:`mt-4 inline-flex items-center gap-1.5 text-xs font-medium text-accent-fg hover:underline`,children:[(0,J.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),a.openTask]})]}):null]}):(0,J.jsx)(`div`,{className:`flex min-h-72 items-center justify-center px-6 text-center text-sm text-fg-muted`,children:a.empty}),ue;return t[71]!==le||t[72]!==G?(ue=(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-base/40`,children:[le,G]}),t[71]=le,t[72]=G,t[73]=ue):ue=t[73],ue}function Zt(e){return(0,J.jsx)(`li`,{children:e.title},e.id)}function Y(e){return!e}function Qt(e){return!e}function $t(e){return[e.id,e]}function en(e){return e.id}function tn(e){return e.phase!==`closed`}var nn={ready:Se,moving:k,waiting:Qe,needs_user:L,done:tt},rn={ready:`text-fg-muted`,moving:`text-accent-fg`,waiting:`text-violet-700 dark:text-violet-300`,needs_user:`text-amber-700 dark:text-amber-300`,done:`text-emerald-700 dark:text-emerald-300`};function an(e){let t=(0,At.c)(57),{task:n,returnTo:r,copy:i,busy:a,onAction:o,onDragStart:c}=e,u;t[0]===n?u=t[1]:(u=Ht(n),t[0]=n,t[1]=u);let d=u,f=!!d,p;t[2]!==c||t[3]!==n.id?(p=e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id),c(n.id)},t[2]=c,t[3]=n.id,t[4]=p):p=t[4];let m;t[5]===c?m=t[6]:(m=()=>c(``),t[5]=c,t[6]=m);let h;t[7]!==r||t[8]!==n.id?(h=ne(r,n.id),t[7]=r,t[8]=n.id,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,J.jsx)(`h3`,{className:`min-w-0 break-words text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==i||t[13]!==n.priority?(_=n.priority===`critical`||n.priority===`high`?(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,n.priority===`critical`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:i.priorityOptions[n.priority]}):null,t[12]=i,t[13]=n.priority,t[14]=_):_=t[14];let v;t[15]!==g||t[16]!==_?(v=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.attention[0]?y=t[19]:(y=n.attention[0]?(0,J.jsx)(`p`,{className:`mt-2 line-clamp-3 text-xs leading-5 text-fg-muted`,children:n.attention[0].summary}):null,t[18]=n.attention[0],t[19]=y);let b;t[20]!==i||t[21]!==n.blockedBy||t[22]!==n.lane?(b=n.lane===`waiting`&&n.blockedBy.length>0?(0,J.jsxs)(`div`,{className:`mt-2 rounded-md bg-violet-500/8 px-2.5 py-2 text-xs text-violet-700 dark:text-violet-300`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium`,children:[(0,J.jsx)(Qe,{className:`size-3.5`,"aria-hidden":!0}),i.blockedBy.replace(`{{count}}`,String(n.blockedBy.length))]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 leading-5 text-fg-muted`,children:n.blockedBy.map(X).join(`、`)})]}):null,t[20]=i,t[21]=n.blockedBy,t[22]=n.lane,t[23]=b):b=t[23];let x;t[24]!==i||t[25]!==n.latestVerification?(x=n.latestVerification?(0,J.jsx)(`span`,{className:l(`font-medium`,n.latestVerification===`passed`?`text-emerald-700 dark:text-emerald-300`:n.latestVerification===`failed`?`text-red-700 dark:text-red-300`:`text-fg-subtle`),children:i.verification[n.latestVerification]}):null,t[24]=i,t[25]=n.latestVerification,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==n.acceptanceCriteriaCount?(S=n.acceptanceCriteriaCount>0?(0,J.jsx)(`span`,{children:i.acceptanceCriteria.replace(`{{count}}`,String(n.acceptanceCriteriaCount))}):null,t[27]=i,t[28]=n.acceptanceCriteriaCount,t[29]=S):S=t[29];let C;t[30]===n.dueAt?C=t[31]:(C=n.dueAt?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)($e,{className:`size-3`,"aria-hidden":!0}),Je(new Date(n.dueAt))]}):null,t[30]=n.dueAt,t[31]=C);let w;t[32]===n.nextCheckAt?w=t[33]:(w=n.nextCheckAt?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[(0,J.jsx)($e,{className:`size-3`,"aria-hidden":!0}),Je(new Date(n.nextCheckAt))]}):null,t[32]=n.nextCheckAt,t[33]=w);let T;t[34]!==x||t[35]!==S||t[36]!==C||t[37]!==w?(T=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-fg-subtle`,children:[x,S,C,w]}),t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;t[39]!==b||t[40]!==T||t[41]!==h||t[42]!==v||t[43]!==y?(E=(0,J.jsxs)(s,{to:h,className:`block min-w-0 p-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[v,y,b,T]}),t[39]=b,t[40]=T,t[41]=h,t[42]=v,t[43]=y,t[44]=E):E=t[44];let D;t[45]!==a||t[46]!==i||t[47]!==o||t[48]!==d||t[49]!==n?(D=d?(0,J.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-edge-subtle px-3 py-2`,children:[(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,d),className:`text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions[d]}),d!==`verify`&&n.allowedCommands.includes(`request_review`)?(0,J.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>o(n,`verify`),className:`text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:cursor-wait disabled:opacity-50`,children:i.actions.verify}):null]}):null,t[45]=a,t[46]=i,t[47]=o,t[48]=d,t[49]=n,t[50]=D):D=t[50];let O;return t[51]!==E||t[52]!==D||t[53]!==f||t[54]!==p||t[55]!==m?(O=(0,J.jsxs)(`article`,{draggable:f,onDragStart:p,onDragEnd:m,className:`min-h-max min-w-0 shrink-0 overflow-hidden rounded-lg border border-edge-subtle bg-surface-panel transition-colors hover:border-edge hover:bg-surface-hover`,children:[E,D]}),t[51]=E,t[52]=D,t[53]=f,t[54]=p,t[55]=m,t[56]=O):O=t[56],O}function X(e){return e.title}function on({tasks:e,dependencyEdges:t,returnTo:n,copy:r,onAction:i,onCreate:a,actionBusyId:o,ref:s}){let[c,u]=(0,q.useState)(null),[p,m]=(0,q.useState)(`board`),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(()=>crypto.randomUUID()),[b,x]=(0,q.useState)(``),[S,C]=(0,q.useState)(`normal`),[w,T]=(0,q.useState)(``),[D,k]=(0,q.useState)([]),[A,j]=(0,q.useState)(!1),[M,P]=(0,q.useState)(null),F=E({chat:d(f(e=>e.language)).chat}),L=Bt(e),R=e.filter(e=>e.phase!==`closed`),z=(e,t)=>{i(e,t)},V=async e=>{e.preventDefault();let t=b.trim();if(!(!t||A)){j(!0),P(null);try{let e=w?new Date(`${w}T23:59:59.999`).getTime():void 0;await a({requestId:_,objective:t,priority:S,dependsOnTaskIds:D,attachments:F.wireAttachmentsPayload(),...e===void 0?{}:{dueAt:e}}),x(``),C(`normal`),T(``),k([]),F.clearAttachments(),v(crypto.randomUUID()),g(!1)}catch(e){P(e instanceof Error?e.message:r.createFailed)}finally{j(!1)}}},U=()=>{v(crypto.randomUUID()),x(``),C(`normal`),T(``),k([]),F.clearAttachments(),P(null),g(!0)};return(0,q.useImperativeHandle)(s,()=>({openCreate:U})),(0,J.jsxs)(`section`,{id:`project-panel-board`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-board`,className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex shrink-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.description})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 rounded-lg border border-edge bg-surface-panel p-0.5`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":p===`board`,onClick:()=>m(`board`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`board`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,J.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),r.views.board]}),(0,J.jsxs)(`button`,{type:`button`,"aria-pressed":p===`graph`,onClick:()=>m(`graph`),className:l(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium`,p===`graph`?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),children:[(0,J.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),r.views.graph]})]})]}),p===`board`?(0,J.jsx)(`div`,{className:`min-h-0 w-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain pb-2 [scrollbar-width:thin]`,children:(0,J.jsx)(`div`,{className:`grid h-full min-h-0 min-w-[103rem] grid-cols-5 gap-3`,children:zt.map(t=>{let i=nn[t],a=L[t];return(0,J.jsxs)(`section`,{onDragOver:n=>{let r=e.find(e=>e.id===c);r&&Vt(r,t)&&n.preventDefault()},onDrop:n=>{n.preventDefault();let r=e.find(e=>e.id===c),i=r?Vt(r,t):void 0;u(null),r&&i&&z(r,i)},className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-surface-muted/60 p-2.5`,children:[(0,J.jsxs)(`header`,{className:`mb-2.5 flex shrink-0 items-center justify-between gap-2 px-1`,children:[(0,J.jsxs)(`div`,{className:l(`flex items-center gap-2`,rn[t]),children:[(0,J.jsx)(i,{className:`size-4`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.lanes[t]})]}),(0,J.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-subtle`,children:a.length})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain pr-1 [scrollbar-gutter:stable] [scrollbar-width:thin]`,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.length?a.map(e=>(0,J.jsx)(an,{task:e,returnTo:n,copy:r,busy:o===e.id,onAction:z,onDragStart:u},e.id)):(0,J.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-5 text-center text-xs text-fg-subtle`,children:r.empty})})})]},t)})})}):(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,J.jsx)(Xt,{tasks:e,dependencyEdges:t,returnTo:n,copy:{...r.graph,lanes:r.lanes}})}),(0,J.jsx)(I,{open:h,onOpenChange:e=>{A||g(e)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.createDescription})]}),(0,J.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>void V(e),children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`label`,{htmlFor:`project-task-objective`,className:`font-medium text-fg-muted`,children:r.objective}),(0,J.jsxs)(`div`,{className:l(`overflow-hidden rounded-lg border border-edge bg-surface-base transition-colors focus-within:border-accent`,F.isDragging&&`border-accent bg-accent-soft/30`),onDragOver:e=>{e.preventDefault(),A||F.setIsDragging(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||F.setIsDragging(!1)},onDrop:e=>{e.preventDefault(),F.setIsDragging(!1),A||F.processFiles(Array.from(e.dataTransfer.files))},children:[(0,J.jsx)(`textarea`,{id:`project-task-objective`,autoFocus:!0,className:`min-h-28 w-full resize-y bg-transparent px-3 py-3 text-sm leading-6 text-fg outline-none placeholder:text-fg-subtle`,value:b,onChange:e=>{x(e.target.value),P(null)},placeholder:r.objectivePlaceholder,maxLength:12e3,disabled:A}),(0,J.jsx)(H,{attachments:F.attachments,topPadded:!1,onRemove:e=>{A||F.removeAttachment(e)}}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-edge-subtle px-2.5 py-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:A,onClick:()=>F.fileInputRef.current?.click(),children:[(0,J.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),r.addFiles]}),(0,J.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:r.attachmentsDescription}),(0,J.jsx)(`input`,{ref:F.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{F.processFiles(Array.from(e.target.files??[])),e.currentTarget.value=``}})]})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.priority}),(0,J.jsx)(W,{value:S,onChange:e=>C(e.target.value),disabled:A,children:[`low`,`normal`,`high`,`critical`].map(e=>(0,J.jsx)(O,{value:e,children:r.priorityOptions[e]},e))})]}),(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[(0,J.jsxs)(`span`,{className:`font-medium text-fg-muted`,children:[r.dueDate,` `,(0,J.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,J.jsx)(`input`,{type:`date`,className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:w,onChange:e=>T(e.target.value),disabled:A})]})]}),(0,J.jsxs)(`fieldset`,{className:`grid gap-2`,children:[(0,J.jsxs)(`legend`,{className:`text-sm font-medium text-fg-muted`,children:[r.dependencies,` `,(0,J.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:r.optional})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:r.dependenciesDescription}),(0,J.jsx)(Ct,{candidates:R,selectedIds:D,disabled:A,onChange:k,labels:{link:r.linkDependencies,linked:r.linkedDependencies,searchPlaceholder:r.dependencySearchPlaceholder,noMatches:r.noDependencyMatches,noCandidates:r.noDependencyCandidates,remove:r.removeDependency}})]}),M?(0,J.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:M}):null]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:r.cancel})}),(0,J.jsx)(K,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!b.trim(),children:A?r.creating:r.create})]})]})]})]})})]})}var sn=new Set([{id:`overview`,icon:U},{id:`tasks`,icon:mt},{id:`automations`,icon:ft},{id:`files`,icon:G},{id:`notes`,icon:lt},{id:`skills`,icon:Ge},{id:`sessions`,icon:D},{id:`progress`,icon:_e},{id:`settings`,icon:be}].map(e=>e.id)),cn=`xopc.projectFiles.panelWidthPx`,ln=320,un=220,dn=560;function fn(e,t){return e.name!==t.name||e.description!==(t.description??``)||e.status!==t.status||e.defaultAgentId!==(t.defaultAgentId??``)||e.brief!==(t.brief??``)||e.instructions!==(t.instructions??``)}function pn(e){return Math.min(dn,Math.max(un,Math.round(e)))}function mn(){try{let e=window.localStorage.getItem(cn);if(e==null)return ln;let t=Number.parseInt(e,10);return Number.isFinite(t)?pn(t):ln}catch{return ln}}function hn(e){try{window.localStorage.setItem(cn,String(pn(e)))}catch{}}function gn(e){return!!(e&&sn.has(e))}function _n(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function vn(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Je(n)}function yn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function bn(e){let t=(0,At.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,J.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function xn(e=!1){return l(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function Sn(e){let t=(0,At.c)(10),{label:n,value:r,mono:i}=e,a=i===void 0?!1:i,o;t[0]===n?o=t[1]:(o=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`font-mono text-xs`,c;t[2]===s?c=t[3]:(c=l(`mt-1 min-w-0 truncate text-sm text-fg`,s),t[2]=s,t[3]=c);let u;t[4]!==c||t[5]!==r?(u=(0,J.jsx)(`div`,{className:c,title:r,children:r}),t[4]=c,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[o,u]}),t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Cn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function wn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function Tn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function En(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function Dn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function On(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function kn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function An(e){let t=e.sourceChannel?.trim();if(t)return jn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return jn(r||``)}function jn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Mn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Nn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function Pn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Pn(e.children,t,n)}:e)}function Fn({currentProject:e,pm:t,projectsText:n,wd:r}){let i=o(),[a,s]=(0,q.useState)(!1),[u,d]=(0,q.useState)([e]),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(null),[v,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(`new`),[C,w]=(0,q.useState)(``),[T,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(null),[j,M]=(0,q.useState)(null),P=(0,q.useCallback)(async()=>{h(!0),_(null);try{let t=await Ce({limit:100});d(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){_(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,q.useEffect)(()=>{d(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{a&&P()},[P,a]);let F=(0,q.useMemo)(()=>{let t=f.trim().toLowerCase().split(/\s+/).filter(Boolean);return u.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=Cn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>wn(t)-wn(e))},[e.id,u,f]),L=e=>t.statuses[e.status]??e.status,R=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,z=e=>{S(e),w(``),E(``),A(null),b(!0),s(!1)},V=(0,q.useCallback)(async(e={})=>{let t=T.trim(),n=C.trim()||(x===`directory`?Tn(t):``);if(n){O(!0),A(null),M(null);try{let r=await Ke({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});b(!1),w(``),E(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),i(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=En(e);t?(M(t),b(!1)):A(e instanceof Error?e.message:String(e))}finally{O(!1)}}},[x,C,i,T]),H=(0,q.useCallback)(e=>{e.preventDefault(),V()},[V]),U=(0,q.useCallback)(()=>{V({createWorkspaceRoot:!0})},[V]),te=(0,q.useCallback)(()=>{M(null),b(!0)},[]),ne=e=>{E(e),x===`directory`&&!C.trim()&&w(Tn(e))},re=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:l(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md p-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||i(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(c,{className:l(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:R(e)})]}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:L(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Ve,{open:a,onOpenChange:s,children:[(0,J.jsx)(qe,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,yn(e.status)),children:L(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:R(e)})]}),(0,J.jsx)(Ue,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(et,{children:(0,J.jsxs)(xe,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(je,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:f,onChange:e=>p(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),re(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),g?(0,J.jsx)(`div`,{className:`p-2 text-xs text-red-600 dark:text-red-400`,children:g}):null,m&&F.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&F.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,F.map(e=>re(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>z(`new`),children:[(0,J.jsx)(De,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>z(`directory`),children:[(0,J.jsx)(G,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),i(`/projects`)},children:[(0,J.jsx)(be,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(I,{open:v,onOpenChange:e=>!D&&b(e),children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:x===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm text-fg-muted`,children:x===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:H,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[k?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:k}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:C,onChange:e=>w(e.target.value),placeholder:`xopc`})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(yt,{value:T,onChange:ne,disabled:D,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:D,children:n.cancel})}),(0,J.jsxs)(K,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:D||!(C.trim()||x===`directory`&&Tn(T)),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(I,{open:!!j,onOpenChange:e=>{e||M(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j?_n(n.workspaceMissingDescription,{workspace:j}):null})]}),j?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(G,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:j})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:te,disabled:D,children:n.workspaceMissingBack}),(0,J.jsxs)(K,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:U,disabled:D,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function In(){let{projectId:e=``,tabId:t,noteId:n}=i(),r=o(),[c]=a(),p=f(e=>e.language),m=d(p),h=m.chat.workingDirectory,v=m.projectDetailPage,b=m.projectsPage,x=A(e=>e.setPageHeader),E=A(e=>e.clearPageHeader),[k,L]=(0,q.useState)(null),[z,H]=(0,q.useState)(null),[te,se]=(0,q.useState)([]),[fe,xe]=(0,q.useState)(``),[Se,Ce]=(0,q.useState)([]),[Oe,Me]=(0,q.useState)(!1),[Ve,Ue]=(0,q.useState)(null),[Ke,qe]=(0,q.useState)([]),[Je,Qe]=(0,q.useState)(0),[$e,et]=(0,q.useState)(!1),[tt,st]=(0,q.useState)(!1),[bt,xt]=(0,q.useState)(!1),[St,Ct]=(0,q.useState)([]),wt=(0,q.useRef)(new Set),[Tt,Et]=(0,q.useState)(null),[Dt,Ot]=(0,q.useState)(mn),[kt,At]=(0,q.useState)(!1),[jt,Mt]=(0,q.useState)(!1),[Nt,Pt]=(0,q.useState)(``),[Ft,It]=(0,q.useState)([]),[Rt,zt]=(0,q.useState)(!1),[Bt,Vt]=(0,q.useState)(null),[Ht,Ut]=(0,q.useState)(!1),[Wt,Gt]=(0,q.useState)(null),[Kt,qt]=(0,q.useState)([]),[Jt,Yt]=(0,q.useState)(``),[Xt,Zt]=(0,q.useState)(!0),[Y,Qt]=(0,q.useState)(!1),[$t,en]=(0,q.useState)(!1),[tn,nn]=(0,q.useState)(null),[rn,an]=(0,q.useState)(!1),[X,sn]=(0,q.useState)(`fixed`),[cn,ln]=(0,q.useState)(``),[un,dn]=(0,q.useState)(null),[Cn,wn]=(0,q.useState)(!1),[Tn,jn]=(0,q.useState)(!1),[In,Ln]=(0,q.useState)(!1),[Rn,zn]=(0,q.useState)(null),Bn=(0,q.useRef)(null),Vn=(0,q.useRef)(!1),[Hn,Z]=(0,q.useState)(null),[Un,Wn]=(0,q.useState)({title:``,reason:``}),[Q,Gn]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),Kn=(0,q.useRef)(Q),qn=`overview`,$=n?`notes`:gn(t)?t:qn,Jn=(0,q.useMemo)(()=>me(c.get(`returnTo`),`/projects`,[`/chat`]),[c]),Yn=(0,q.useCallback)(t=>{if(!e)return`/projects`;let n=`/projects/${encodeURIComponent(e)}/${t}`;return Jn===`/projects`?n:ut(n,Jn)},[Jn,e]),Xn=(0,q.useCallback)(t=>{e&&r(Yn(t))},[r,e,Yn]),Zn=(0,q.useCallback)(()=>{if($===`tasks`&&Bn.current){Bn.current.openCreate();return}Vn.current=!0,Xn(`tasks`)},[Xn,$]);(0,q.useEffect)(()=>{$!==`tasks`||!Vn.current||(Vn.current=!1,Bn.current?.openCreate())},[$]);let Qn=(0,q.useCallback)(t=>{e&&r(Yn(t),{replace:!0})},[r,e,Yn]),$n=(0,q.useCallback)((e,t)=>{Qn(e),r(t)},[r,Qn]),er=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||Qn(e)},[Qn]),tr=(0,q.useCallback)(e=>e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||gn(t)||r(Yn(qn),{replace:!0})},[qn,r,e,Yn,t]),(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Zt(!0),Z(null),Promise.all([Xe(e),nt(e),ve(e),at().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;L(e),H(n),se(r),qt(i?.agents??[]),Yt(e.defaultAgentId??``);let a={name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``};Kn.current=a,Gn(a)}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Zt(!1)}),()=>{t=!0}},[e]);let nr=(0,q.useCallback)(async()=>{e&&H(await nt(e))},[e]);(0,q.useEffect)(()=>{let t=t=>{t.detail?.projectId===e&&nr()};return window.addEventListener(`task-created-v2`,t),window.addEventListener(`task-commanded-v2`,t),window.addEventListener(`task-phase-changed-v2`,t),()=>{window.removeEventListener(`task-created-v2`,t),window.removeEventListener(`task-commanded-v2`,t),window.removeEventListener(`task-phase-changed-v2`,t)}},[e,nr]);let rr=(0,q.useCallback)(async(e,t)=>{zn(e.id),Z(null);try{let n=await pt(e.id),r=t===`run`?{type:`start`,executor:{kind:`agent`,agentId:n.task.delegateAgentId??`main`}}:t===`pause`?{type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}:t===`verify`?{type:`request_review`}:{type:`resolve_wait`,waitId:n.waits[0]?.id??``};if(r.type===`resolve_wait`&&!r.waitId)throw Error(`No active wait to resolve`);await ke(e.id,r,n.task.version),await nr()}catch(e){Z(e instanceof Error?e.message:v.board.actionFailed)}finally{zn(null)}},[z,v.board.actionFailed,nr]),ir=(0,q.useCallback)(async t=>{e&&(Z(null),await Te({idempotencyKey:t.requestId,title:t.objective,projectId:e,priority:t.priority,dueAt:t.dueAt,locale:p,contract:{objective:t.objective,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:t.dependsOnTaskIds,context:t.attachments.map((e,t)=>({targetKind:`file`,targetId:e.uri??e.name??`attachment-${t+1}`,role:`input`,title:e.name,pinned:!0,retrievalPolicy:{},metadata:{mimeType:e.mimeType,size:e.size,data:e.data}})),authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}}),await nr())},[p,e,nr]),ar=(0,q.useCallback)(async()=>{if(k){Me(!0),Z(null);try{Ce((await Le.list({projectId:k.id})).automations)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Me(!1)}}},[k]);(0,q.useEffect)(()=>{$===`automations`&&ar()},[ar,$]);let or=(0,q.useCallback)(async()=>{if(k){et(!0),Z(null);try{let e=await ge(k.id,{includeRelated:tt,limit:100});qe(e.items),Qe(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{et(!1)}}},[k,tt]);(0,q.useEffect)(()=>{$===`progress`&&or()},[or,$]);let sr=(0,q.useCallback)(async e=>{Ue(`toggle:${e.id}`),Z(null);try{e.enabled?await Le.pause(e.id):await Le.resume(e.id),await ar()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ue(null)}},[ar]),cr=(0,q.useCallback)(async()=>{if(!k?.effectiveWorkspaceRoot?.trim()){Ct([]),wt.current.clear(),Gt(null);return}Ut(!0),Gt(null),wt.current.clear();try{Ct(Nn((await Re(k.id,``)).entries)),wt.current.add(``)}catch(e){Ct([]),wt.current.clear(),Gt(e instanceof Error?e.message:String(e))}finally{Ut(!1)}},[k]),lr=(0,q.useCallback)(async e=>{if(!(!k?.effectiveWorkspaceRoot?.trim()||wt.current.has(e))){wt.current.add(e),Gt(null);try{let t=await Re(k.id,e);Ct(n=>Pn(n,e,Nn(t.entries)))}catch(t){wt.current.delete(e),Gt(t instanceof Error?t.message:String(t))}}},[k]);(0,q.useEffect)(()=>{$===`files`&&cr()},[cr,$]);let ur=Nt.trim();(0,q.useEffect)(()=>{if($!==`files`||!k||!jt||!ur){It([]),zt(!1),Vt(null);return}let e=!1;zt(!0),Vt(null),It([]);let t=window.setTimeout(()=>{we(k.id,ur,50).then(t=>{e||It(t)}).catch(t=>{e||Vt(t instanceof Error?t.message:String(t))}).finally(()=>{e||zt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[ur,k,jt,$]);let dr=(0,q.useCallback)(async()=>{if(k){jn(!0),Z(null);try{let e=await ue(k.id);$n(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{jn(!1)}}},[$n,k]),fr=(0,q.useCallback)(async()=>{if(!k)return;let[e,t]=await Promise.all([Xe(k.id),nt(k.id)]);H(t),L(e)},[k]),pr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!k||!Un.title.trim())){Ln(!0),Z(null);try{await Ae(k.id,{title:Un.title.trim(),reason:Un.reason.trim()||void 0}),Wn({title:``,reason:``}),await fr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ln(!1)}}},[Un.reason,Un.title,k,fr]),mr=(0,q.useMemo)(()=>(0,J.jsx)(s,{to:Jn,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Jn===`/projects`?v.backToProjects:m.sidebar.back,children:(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),[Jn,m.sidebar.back,v.backToProjects]),hr=(0,q.useMemo)(()=>k?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(K,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Zn,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),v.board.create]}),(0,J.jsxs)(K,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void dr(),disabled:Tn,children:[(0,J.jsx)(D,{className:`size-4`,"aria-hidden":!0}),v.common.newChat]})]}):null,[Zn,v.board.create,v.common.newChat,k,dr,Tn]);(0,q.useLayoutEffect)(()=>(x({startExtra:mr,main:k?(0,J.jsx)(Fn,{currentProject:k,pm:v,projectsText:b,wd:h}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:v.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:v.fallbackContext})]}),end:hr}),()=>E()),[E,hr,mr,v,k,b,x,h]);function gr(e){L(t=>t?{...t,...e}:null),Yt(e.defaultAgentId??``),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function _r(e=Kn.current){if(!(!k||!fn(e,k))){Z(null),nn(null);try{let t=await rt(k.id,{name:e.name.trim(),status:e.status,description:e.description,defaultAgentId:e.defaultAgentId,brief:e.brief,instructions:e.instructions});gr(t);let n=Kn.current,r={...n,name:n.name===e.name?t.name:n.name,description:n.description===e.description?t.description??``:n.description,status:n.status===e.status?t.status:n.status,defaultAgentId:n.defaultAgentId===e.defaultAgentId?t.defaultAgentId??``:n.defaultAgentId,brief:n.brief===e.brief?t.brief??``:n.brief,instructions:n.instructions===e.instructions?t.instructions??``:n.instructions};Kn.current=r,Gn(r)}catch(e){let t=En(e);throw t?nn(t):Z(e instanceof Error?e.message:String(e)),e}}}function vr(e){e.preventDefault(),jr.flush()}function yr(e,t=!1){let n={...Kn.current,...e};Kn.current=n,Gn(n),t&&jr.saveNow(n)}let br=(0,q.useCallback)(()=>{if(!k)return;let e=k.workspaceRoot?.trim()??``;sn(e?`fixed`:`follow`),ln(e||k.effectiveWorkspaceRoot||``),an(!0)},[k]);async function xr(e={}){if(!k)return;let t=X===`fixed`?cn.trim():``;if(!(X===`fixed`&&!t)){Qt(!0),Z(null),nn(null);try{let n=await rt(k.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});gr(n),yr({workspaceRoot:n.workspaceRoot??``}),an(!1),nn(null)}catch(e){let t=En(e);t?(nn(t),an(!1)):Z(e instanceof Error?e.message:String(e))}finally{Qt(!1)}}}async function Sr(){if(!(!k||un)){dn(`pin`),Z(null);try{gr(k.pinnedAt?await ce(k.id):await We(k.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function Cr(){if(!(!k||un)){dn(`archive`),Z(null);try{let e=k.status===`archived`?await ze(k.id):await Be(k.id);gr(e),yr({status:e.status})}catch(e){Z(e instanceof Error?e.message:String(e))}finally{dn(null)}}}async function wr(){if(k){wn(!0),Z(null);try{await He(k.id),en(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{wn(!1)}}}async function Tr(){if(!(!k||bt)){xt(!0),Z(null);try{await Ee(k.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{xt(!1)}}}let Er=(0,q.useCallback)(e=>{Et(e)},[]),Dr=(0,q.useCallback)((e,t)=>{t||Et(e)},[]),Or=(0,q.useCallback)(async(e,t,n)=>{let r=k?.id;if(r)switch(e){case`preview`:t.isDirectory||Et(t.path);break;case`download`:if(t.isDirectory)return;try{let e=ie(t.path);if(w(ct(e))!==`text`){let n=await _(t.path,{projectId:r}),i=ot(e)??`application/octet-stream`;F(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ne(t.path,{projectId:r});Fe(e,n)}}catch(e){R(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&R(`success`,m.workspace.pathCopied,void 0,{duration:2500})}catch{R(`warning`,m.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[m.clipboard.copyFailed,m.workspace.pathCopied,k?.id]),kr=(0,q.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),At(!0);let r=e.clientX,i=Dt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=pn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}At(!1),Ot(c),hn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Dt]);(0,q.useEffect)(()=>{$!==`files`&&Et(null)},[e,$]);let Ar=!!(k&&fn(Q,k)),jr=_t({value:k?Q:null,dirty:Ar,onSave:_r,validate:e=>e.name.trim()?null:v.settings.nameRequired});if(Xt)return(0,J.jsx)(`main`,{className:`w-full flex-1 p-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:v.loading});if(!k)return(0,J.jsxs)(`main`,{className:`w-full flex-1 p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(s,{to:Jn,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(re,{className:`size-4`,"aria-hidden":!0}),Jn===`/projects`?v.backToProjects:m.sidebar.back]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:Hn||v.notFound})]});let Mr=te.slice(0,6),Nr=z?.blockers??[],Pr=z?.tasks.filter(e=>e.lane!==`done`)??[],Fr=e=>v.statuses[e]??e,Ir=e=>_n(v.common.messages,{count:e}),Lr=fe.trim().toLowerCase(),Rr=Lr?te.filter(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||v.common.agent,r=e.name?.trim()||v.sessions.fallbackTitle,i=Ir(e.messageCount??0),a=An(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(Lr)}):te,zr=te.length>0&&Rr.length===0,Br=Kt.find(e=>e.id===k.defaultAgentId)?.name||k.defaultAgentId||v.settings.globalDefaultAgent,Vr=Kt.find(e=>e.id===Q.defaultAgentId),Hr=k.workspaceRoot?.trim()||``,Ur=k.status===`archived`,Wr=!!k.pinnedAt,Gr=!Hr,Kr=Hr||Vr?.workspace||k.effectiveWorkspaceRoot||v.common.defaultWorkspace,qr=X===`fixed`?cn.trim()||v.settings.workspacePlaceholder:Vr?.workspace||k.effectiveWorkspaceRoot||v.common.defaultWorkspace,Jr=(X===`fixed`?cn.trim():``)!==Hr&&(X===`follow`||!!cn.trim()),Yr=[{id:`overview`,icon:U,label:v.tabs.overview},{id:`tasks`,icon:mt,label:v.tabs.tasks},{id:`automations`,icon:ft,label:v.tabs.automations},{id:`files`,icon:G,label:v.tabs.files},{id:`notes`,icon:lt,label:v.tabs.notes},{id:`skills`,icon:Ge,label:v.tabs.skills},{id:`sessions`,icon:D,label:v.tabs.sessions},{id:`progress`,icon:_e,label:v.tabs.progress}];async function Xr(){if(!Kr)return;let e=await u(Kr);R(e?`success`:`warning`,e?m.workspace.pathCopied:m.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function Zr(){nn(null),an(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden p-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,J.jsx)(vt,{items:Yr,activeTab:$,onChange:Xn,ariaLabel:v.navAria,tabIdPrefix:`project-primary-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(K,{id:`project-primary-tab-settings`,type:`button`,variant:$===`settings`?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,"aria-current":$===`settings`?`page`:void 0,onClick:()=>Xn(`settings`),children:[(0,J.jsx)(be,{className:`size-4`,"aria-hidden":!0}),v.tabs.settings,Ar?(0,J.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500`,"aria-label":v.settings.unsavedChanges}):null]})]}),Hn?(0,J.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Hn}):null,(0,J.jsxs)(`div`,{className:l(`mt-3 min-h-0 flex-1`,$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:$===`tasks`?`overflow-hidden`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:k.outcome||z?.digest.summary||k.description||k.brief||v.overview.directionFallback}),z?.digest.recommendedAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:_n(v.overview.recommendedNext,{action:z.digest.recommendedAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(K,{type:`button`,variant:`secondary`,onClick:()=>void Tr(),disabled:bt,children:[(0,J.jsx)(de,{className:`size-4`,"aria-hidden":!0}),bt?v.overview.savingDigest:v.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.nextActions})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Pr.length?Pr.map(e=>(0,J.jsxs)(s,{to:ne(Yn(`overview`),e.id),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:[e.phase,` · `,e.operationalState]})]}),e.attention[0]?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.attention[0].summary}):null]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:v.overview.noNextActions})})]}),z?.recentReceipts.length?(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.recentResults})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:z.recentReceipts.slice(0,5).map(e=>(0,J.jsx)(`div`,{className:`px-4 py-3`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.summary}),(0,J.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:[e.status,` · `,e.verification.status]})]})},e.runId))})]}):null,(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.milestones})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:k.milestones.length?k.milestones.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.status})]},e.id)):(0,J.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:v.overview.noMilestones})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.projectUpdates})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:k.recentUpdates.length?k.recentUpdates.slice(0,3).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-5 text-fg`,children:e.summary}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.health})]},e.id)):(0,J.jsx)(`p`,{className:`px-4 py-5 text-sm text-fg-muted`,children:v.overview.noProjectUpdates})})]})]})]}),(0,J.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.overview.attention}),Nr.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:Nr.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(Ye,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[v.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${Fr(e.status)}`:``]})]});return e.href?(0,J.jsx)(s,{to:e.href,onClick:er(tr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:v.overview.noBlockedTasks}),(0,J.jsxs)(`form`,{onSubmit:pr,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:Un.title,onChange:e=>Wn(t=>({...t,title:e.target.value})),placeholder:v.overview.blockerTitlePlaceholder}),(0,J.jsx)(K,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:In||!Un.title.trim(),"aria-label":In?v.overview.addingBlocker:v.overview.addBlocker,title:In?v.overview.addingBlocker:v.overview.addBlocker,children:(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:v.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>Xn(`sessions`),children:v.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Mr.length?Mr.map(e=>(0,J.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:vn(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||v.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:v.overview.noSessions})})]})]})]}):null,$===`tasks`?(0,J.jsx)(on,{ref:Bn,tasks:z?.tasks??[],dependencyEdges:z?.dependencyEdges??[],returnTo:Yn(`tasks`),copy:v.board,onAction:rr,onCreate:ir,actionBusyId:Rn}):null,$===`automations`?(0,J.jsx)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-automations`,className:`grid min-h-full content-start gap-4`,children:(0,J.jsxs)(`div`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ft,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.automations.title})]}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void ar(),disabled:Oe,children:[(0,J.jsx)(Ze,{className:l(`size-4`,Oe&&`animate-spin`),"aria-hidden":!0}),v.common.refresh]}),(0,J.jsxs)(K,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>$n(`automations`,`/automations?projectId=${encodeURIComponent(k.id)}&action=create`),children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),v.automations.create]})]})]}),Oe&&Se.length===0?(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,"aria-busy":!0,children:[(0,J.jsx)(C,{className:`h-24 rounded-lg`}),(0,J.jsx)(C,{className:`h-24 rounded-lg`})]}):Se.length?(0,J.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Se.map(e=>(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:l(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?v.automations.enabled:v.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,onClick:()=>$n(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:v.common.open}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 text-xs`,disabled:Ve===`toggle:${e.id}`,onClick:()=>void sr(e),children:[e.enabled?(0,J.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?v.automations.pause:v.automations.resume]})]})]},e.id))}):(0,J.jsx)(`p`,{className:`rounded-lg border border-dashed border-edge px-3 py-4 text-sm text-fg-muted`,children:v.automations.empty})]})}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(ht,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(k.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,projectId:k.id,listTitle:v.notes.title,listDescription:v.notes.hint,emptyText:v.notes.emptyTitle,emptyDescription:v.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${k.id}`})}):null,$===`skills`?(0,J.jsx)(Lt,{projectId:k.id,copy:v.skills}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-files`,className:`flex h-full min-h-[28rem] flex-col`,children:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:k.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:l(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,kt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Dt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(g,{workspacePath:Kr}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:l(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,jt&&`bg-surface-hover text-fg`),onClick:()=>Mt(!0),"aria-label":v.files.search,title:v.files.search,"aria-pressed":jt,children:(0,J.jsx)(je,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(P,{className:`size-7 shrink-0 rounded-md p-0`,loading:Ht,label:m.cron.refresh,onClick:()=>void cr()})]})]}),jt?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,J.jsx)(je,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Nt,onChange:e=>Pt(e.target.value),placeholder:v.files.searchPlaceholder,"aria-label":v.files.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":v.files.clearSearch,title:v.files.clearSearch,onClick:()=>{Pt(``),Mt(!1)},children:(0,J.jsx)(he,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Wt?(0,J.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Wt}):null,ur?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Rt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(C,{className:`h-11 w-full`}),(0,J.jsx)(C,{className:`h-11 w-full`}),(0,J.jsx)(C,{className:`h-11 w-full`})]}):Bt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[m.workspace.loadError,`: `,Bt]}):Ft.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:v.files.noSearchResults}):Ft.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:l(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Tt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Et(e.path),title:e.path,children:[(0,J.jsx)(lt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Ht&&St.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:v.files.loading}):(0,J.jsx)(M,{tree:St,selectedPath:Tt,onSelectFile:Er,onSelectEntry:Dr,onExpandDir:e=>void lr(e),onAction:Or,actionLabels:{preview:m.workspace.preview,download:m.workspace.download,copyPath:m.workspace.copyPath,openDefault:m.workspace.openSystemApp,openWith:m.workspace.openWith,revealInFolder:m.workspace.revealInFolder,recommendedApps:m.workspace.recommendedApps},emptyHint:v.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":v.files.resizeHandle,className:l(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,kt&&`bg-surface-hover`),onPointerDown:kr,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:Tt?(0,J.jsx)(T,{filePath:Tt,projectId:k.id,agentId:k.defaultAgentId||Jt||void 0,onClose:()=>Et(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(G,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:v.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:v.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(K,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Xn(`settings`),children:v.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[te.length?(0,J.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,J.jsx)(je,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:fe,onChange:e=>xe(e.currentTarget.value),placeholder:v.sessions.searchPlaceholder,"aria-label":v.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),fe?(0,J.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":v.sessions.clearSearch,onClick:()=>xe(``),children:(0,J.jsx)(he,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,Rr.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Rr.map(e=>{let t=vn(e.updatedAt),n=e.routing?.agentId||e.agentId||v.common.agent,r=An(e),i=e.name?.trim()||v.sessions.fallbackTitle,a=Ir(e.messageCount??0);return(0,J.jsxs)(s,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:er(`sessions`),className:`group flex min-h-[8.75rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,J.jsx)(D,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,J.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[v.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[v.sessions.updated,`: `,t]}):null]})]},e.key)})}):zr?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:v.sessions.emptyDescription})]})})]}):null,$===`progress`?(0,J.jsxs)(`section`,{id:`project-panel-progress`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-progress`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.progress.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_n(v.progress.count,{count:Je})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:tt,onChange:e=>st(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),v.progress.includeRelated]}),(0,J.jsxs)(K,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void or(),disabled:$e,children:[(0,J.jsx)(Ze,{className:l(`size-4`,$e&&`animate-spin`),"aria-hidden":!0}),v.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:$e&&Ke.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:v.progress.loading}):Ke.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ke.map(e=>{let t=v.progress.types[e.type]??e.type,n=v.progress.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Mn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===k.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:v.progress.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,On(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:vn(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[v.progress.actor,`: `,Dn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[v.progress.source,`: `,kn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:v.progress.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-primary-tab-settings`,onSubmit:vr,onBlurCapture:jr.onBlurCapture,className:`grid min-h-full content-start gap-4 pb-1`,children:[(0,J.jsxs)(`section`,{className:`flex min-w-0 items-start justify-between gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.summaryTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:v.settings.summaryHint})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,J.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs font-medium`,yn(Q.status)),children:v.settings.statuses[Q.status]}),(0,J.jsx)(gt,{status:jr.status,error:jr.error})]})]}),(0,J.jsxs)(`div`,{className:`grid items-start gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`grid gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.detailsTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.settings.detailsHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(bn,{label:v.settings.name,children:(0,J.jsx)(`input`,{className:xn(),value:Q.name,onChange:e=>yr({name:e.target.value})})}),(0,J.jsx)(bn,{label:v.settings.defaultAgent,children:(0,J.jsxs)(W,{className:xn(),value:Q.defaultAgentId,onChange:e=>yr({defaultAgentId:e.target.value},!0),children:[(0,J.jsx)(O,{value:``,children:v.settings.globalDefaultAgent}),Kt.map(e=>(0,J.jsx)(O,{value:e.id,children:ye(e,m.agentsSettings)},e.id))]})}),(0,J.jsx)(bn,{label:v.settings.status,children:Ur?(0,J.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:v.settings.statuses.archived}):(0,J.jsxs)(W,{className:xn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>yr({status:e.target.value},!0),children:[(0,J.jsx)(O,{value:`active`,children:v.settings.statuses.active}),(0,J.jsx)(O,{value:`paused`,children:v.settings.statuses.paused})]})}),(0,J.jsx)(bn,{label:v.settings.description,hint:v.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:xn(!0),value:Q.description,onChange:e=>yr({description:e.target.value})})})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.projectGuidanceTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.settings.projectGuidanceHint})]}),(0,J.jsx)(bn,{label:v.settings.brief,hint:v.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:xn(!0),value:Q.brief,onChange:e=>yr({brief:e.target.value})})}),(0,J.jsx)(bn,{label:v.settings.instructions,hint:v.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:xn(!0),value:Q.instructions,onChange:e=>yr({instructions:e.target.value})})})]})]}),(0,J.jsxs)(`aside`,{className:`grid gap-4 xl:sticky xl:top-0`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.workspaceRoot}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:v.settings.workspaceIndependentHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsx)(`span`,{className:`w-fit rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:Gr?v.settings.workspaceModeFollow:v.settings.workspaceModeFixed}),(0,J.jsx)(`div`,{className:`break-all font-mono text-xs leading-5 text-fg`,title:Kr,children:Kr}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void Xr(),children:[(0,J.jsx)(j,{className:`size-4`,"aria-hidden":!0}),v.settings.copyWorkspacePath]}),(0,J.jsx)(g,{workspacePath:Kr}),(0,J.jsxs)(K,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:br,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.settings.migrateWorkspace]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.currentProjectTitle}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(Sn,{label:v.settings.defaultAgent,value:Br}),(0,J.jsx)(Sn,{label:v.settings.pinState,value:Wr?v.settings.pinned:v.settings.notPinned}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,J.jsx)(Sn,{label:v.settings.createdAt,value:vn(k.createdAt)||v.common.never}),(0,J.jsx)(Sn,{label:v.settings.updatedAt,value:vn(k.updatedAt)||v.common.never})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:v.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:v.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Wr?v.settings.pinnedTitle:v.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:v.settings.pinHint})]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:un===`pin`,onClick:()=>void Sr(),children:[Wr?(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),Wr?v.settings.unpinProject:v.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:Ur?v.settings.restoreTitle:v.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:Ur?v.settings.restoreHint:v.settings.archiveHint})]}),(0,J.jsxs)(K,{type:`button`,variant:Ur?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:un===`archive`,onClick:()=>void Cr(),children:[Ur?(0,J.jsx)(Ze,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),Ur?v.settings.restoreProject:v.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:v.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-red-700/80 dark:text-red-200/80`,children:v.settings.dangerHint})]}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>en(!0),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),v.settings.deleteConfirmAction]})]})]})]})]}):null]}),(0,J.jsx)(I,{open:$t,onOpenChange:e=>{Cn||en(e)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,J.jsx)(Ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:v.settings.deleteConfirmTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:k?_n(v.settings.deleteConfirm,{name:k.name}):v.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Cn,children:v.common.cancel})}),(0,J.jsxs)(K,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Cn||!k,onClick:()=>void wr(),children:[(0,J.jsx)(V,{className:`size-4`,"aria-hidden":!0}),v.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(I,{open:rn,onOpenChange:e=>{Y||an(e)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:v.settings.workspaceMigrationTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:v.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`fixed`,onChange:()=>sn(`fixed`),disabled:Y}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:v.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:v.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:l(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,X===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:X===`follow`,onChange:()=>sn(`follow`),disabled:Y}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:v.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:v.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(yt,{value:cn,onChange:ln,disabled:Y,wd:h,placeholder:v.settings.workspacePlaceholder,inputClassName:xn(),autoFocus:!0}):null,(0,J.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:v.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:_n(v.settings.workspaceCurrent,{workspace:qr})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Y,children:v.common.cancel})}),(0,J.jsxs)(K,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Y||!Jr,onClick:()=>void xr(),children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(I,{open:!!tn,onOpenChange:e=>{e||nn(null)},children:(0,J.jsxs)(ee,{children:[(0,J.jsx)(N,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(B,{className:`text-base font-semibold text-fg`,children:v.settings.workspaceMissingTitle}),(0,J.jsx)(Pe,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:tn?_n(v.settings.workspaceMissingDescription,{workspace:tn}):null})]}),tn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(G,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:tn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(K,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Zr,disabled:Y,children:v.settings.workspaceMissingBack}),(0,J.jsxs)(K,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void xr({createWorkspaceRoot:!0}),disabled:Y,children:[(0,J.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.settings.workspaceMissingCreate]})]})]})]})})]})}export{In as ProjectDetailPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as ee}from"./messages-DQ5X6cXp.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{Ao as s,Da as c,Dt as l,La as u,Mo as d,No as f,Oo as p,Po as m,Tu as h,_a as g,_s as _,bc as v,bl as y,fa as b,hc as x,ic as S,jo as C,jt as w,ko as T,ma as E,na as D,nt as O,pa as k,ra as A,sc as j,xu as M,yc as N,yl as P,zc as F}from"./index-BpkdvHH0.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:O(n)}function te(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function ne(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(c,{className:`h-40 rounded-xl`},t)}function re(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:s}=e,c=o(ie),l,u,d,f,p,m,g,b;if(t[0]!==c||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(c).projectsPage;l=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,R.jsx)(y,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),s;t[20]===o?s=t[21]:(s=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=s);let h;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,R.jsx)(M,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=h):h=t[22];let _;t[23]===s?_=t[24]:(_=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[s,h]}),t[23]=s,t[24]=_),b=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[_,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-[11px] text-fg-subtle`,p=(0,R.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),u=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=c,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=g,t[16]=b}else l=t[9],u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],b=t[16];let x;t[25]!==u||t[26]!==d?(x=(0,R.jsx)(`p`,{className:u,children:d}),t[25]=u,t[26]=d,t[27]=x):x=t[27];let S;t[28]!==f||t[29]!==p||t[30]!==x?(S=(0,R.jsxs)(`div`,{className:f,children:[p,x]}),t[28]=f,t[29]=p,t[30]=x,t[31]=S):S=t[31];let C=n.pinnedAt?l.unpin:l.pin,w=n.pinnedAt?l.unpin:l.pin,T;t[32]===n.pinnedAt?T=t[33]:(T=n.pinnedAt?(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=T);let E;t[34]!==r||t[35]!==a||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,R.jsx)(_,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":C,title:w,children:T}),t[34]=r,t[35]=a,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D=n.status===`archived`?l.restore:l.archive,O=n.status===`archived`?l.restore:l.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let A;t[42]!==r||t[43]!==s||t[44]!==D||t[45]!==O||t[46]!==k?(A=(0,R.jsx)(_,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:s,"aria-label":D,title:O,children:k}),t[42]=r,t[43]=s,t[44]=D,t[45]=O,t[46]=k,t[47]=A):A=t[47];let P;t[48]!==E||t[49]!==A?(P=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[E,A]}),t[48]=E,t[49]=A,t[50]=P):P=t[50];let F;t[51]!==P||t[52]!==m||t[53]!==S?(F=(0,R.jsxs)(`div`,{className:m,children:[S,P]}),t[51]=P,t[52]=m,t[53]=S,t[54]=F):F=t[54];let L;return t[55]!==F||t[56]!==g||t[57]!==b?(L=(0,R.jsxs)(`article`,{className:g,children:[b,F]}),t[55]=F,t[56]=g,t[57]=b,t[58]=L):L=t[58],L}function ie(e){return e.language}function V(){let e=ee(o(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=u(e=>e.setPageHeader),c=u(e=>e.clearPageHeader),[h,v]=(0,L.useState)([]),[O,j]=(0,L.useState)(!0),[M,N]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,ie]=(0,L.useState)(`active`),[V,ae]=(0,L.useState)(null),[oe,H]=(0,L.useState)(!1),[U,W]=(0,L.useState)(null),[G,K]=(0,L.useState)(!1),[q,J]=(0,L.useState)(``),[Y,X]=(0,L.useState)(``),[Z,se]=(0,L.useState)(``),Q=w({initialPath:Z,onPicked:se}),$=(0,L.useCallback)(async()=>{j(!0),N(null);try{v(te((await b({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},[]);(0,L.useEffect)(()=>{$()},[$]);let ce=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return h.filter(e=>B===`all`||e.status===B).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[B,h,I]),le=(0,L.useMemo)(()=>(0,R.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,R.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:le}),()=>c()),[c,le,n.subtitle,n.title,i]);let ue=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Z.trim();if(!(!t||!n||G)){K(!0),W(null);try{let e=await A({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});v(t=>[e,...t.filter(t=>t.id!==e.id)]),J(``),X(``),se(``),H(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[G,Y,q,Z]),de=(0,L.useCallback)(async(e,t)=>{ae(e.id),N(null);try{let n;n=t===`pin`?e.pinnedAt?await g(e.id):await k(e.id):e.status===`archived`?await E(e.id):await D(e.id),v(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){N(e instanceof Error?e.message:String(e))}finally{ae(null)}},[]),fe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}];return(0,R.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,R.jsx)(p,{open:oe,onOpenChange:e=>{H(e),e||W(null)},children:(0,R.jsxs)(f,{children:[(0,R.jsx)(d,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(s,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(C,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ue,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>J(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>X(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Q.pick,disabled:G||Q.picking,children:[Q.picking?(0,R.jsx)(F,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(P,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Z?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:a(`mt-0.5 block truncate font-mono text-xs font-normal`,Z?`text-fg-muted`:`text-fg-subtle`),title:Z||void 0,children:Z||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),U?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:U}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(T,{asChild:!0,children:(0,R.jsx)(_,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(_,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Z.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),Q.hasNativePicker?null:(0,R.jsx)(l,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:Z||void 0,onConfirm:Q.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n.filterLabel,children:fe.map(e=>(0,R.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,B===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>ie(e.id),children:e.label},e.id))}),(0,R.jsxs)(`label`,{className:`relative block min-w-0 sm:w-64`,children:[(0,R.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder})]})]}),M?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:M}),(0,R.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:t.home.retry})]}):null,O?(0,R.jsx)(ne,{}):ce.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ce.map(e=>(0,R.jsx)(re,{project:e,busy:V===e.id,onTogglePin:()=>void de(e,`pin`),onToggleArchive:()=>void de(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,R.jsx)(y,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{V as ProjectsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as ee}from"./messages-DQ5X6cXp.js";import{n as o}from"./locale-store-Bjvw7jtg.js";import{Ao as s,Da as c,Dt as l,La as u,Mo as d,No as f,Oo as p,Po as m,Tu as h,_a as g,_s as _,bc as v,bl as y,fa as b,hc as x,ic as S,jo as C,jt as w,ko as T,ma as E,na as D,nt as O,pa as k,ra as A,sc as j,xu as M,yc as N,yl as P,zc as F}from"./index-Cb9y6tVR.js";var I=n(),L=e(t(),1),R=r();function z(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:O(n)}function te(e){return[...e].sort((e,t)=>{let n=Number(!!t.pinnedAt)-Number(!!e.pinnedAt);return n===0?new Date(t.lastActiveAt??t.updatedAt).getTime()-new Date(e.lastActiveAt??e.updatedAt).getTime():n})}function ne(){let e=(0,I.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,"aria-busy":!0,children:Array.from({length:6},B)}),e[0]=t):t=e[0],t}function B(e,t){return(0,R.jsx)(c,{className:`h-40 rounded-xl`},t)}function re(e){let t=(0,I.c)(59),{project:n,busy:r,onTogglePin:a,onToggleArchive:s}=e,c=o(ie),l,u,d,f,p,m,g,b;if(t[0]!==c||t[1]!==n.brief||t[2]!==n.description||t[3]!==n.id||t[4]!==n.lastActiveAt||t[5]!==n.name||t[6]!==n.status||t[7]!==n.updatedAt||t[8]!==n.workspaceRoot){let e=ee(c).projectsPage;l=e.management,g=`flex h-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4`;let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:(0,R.jsx)(y,{className:`size-4`,"aria-hidden":!0})}),t[17]=r):r=t[17];let a;t[18]===n.name?a=t[19]:(a=(0,R.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[18]=n.name,t[19]=a);let o=(0,R.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.statuses[n.status]})]}),s;t[20]===o?s=t[21]:(s=(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r,o]}),t[20]=o,t[21]=s);let h;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,R.jsx)(M,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[22]=h):h=t[22];let _;t[23]===s?_=t[24]:(_=(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[s,h]}),t[23]=s,t[24]=_),b=(0,R.jsxs)(i,{to:`/projects/${encodeURIComponent(n.id)}`,className:`group flex min-w-0 flex-1 flex-col rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[_,(0,R.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-xs leading-5 text-fg-muted`,children:n.description||n.brief||e.noDescription})]}),m=`mt-3 flex shrink-0 items-end justify-between gap-3 border-t border-edge-subtle pt-3`,f=`min-w-0 text-[11px] text-fg-subtle`,p=(0,R.jsx)(`p`,{className:`truncate`,children:n.workspaceRoot||e.agentDefault}),u=`mt-1`,d=z(n.lastActiveAt??n.updatedAt,e.never),t[0]=c,t[1]=n.brief,t[2]=n.description,t[3]=n.id,t[4]=n.lastActiveAt,t[5]=n.name,t[6]=n.status,t[7]=n.updatedAt,t[8]=n.workspaceRoot,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p,t[14]=m,t[15]=g,t[16]=b}else l=t[9],u=t[10],d=t[11],f=t[12],p=t[13],m=t[14],g=t[15],b=t[16];let x;t[25]!==u||t[26]!==d?(x=(0,R.jsx)(`p`,{className:u,children:d}),t[25]=u,t[26]=d,t[27]=x):x=t[27];let S;t[28]!==f||t[29]!==p||t[30]!==x?(S=(0,R.jsxs)(`div`,{className:f,children:[p,x]}),t[28]=f,t[29]=p,t[30]=x,t[31]=S):S=t[31];let C=n.pinnedAt?l.unpin:l.pin,w=n.pinnedAt?l.unpin:l.pin,T;t[32]===n.pinnedAt?T=t[33]:(T=n.pinnedAt?(0,R.jsx)(N,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[32]=n.pinnedAt,t[33]=T);let E;t[34]!==r||t[35]!==a||t[36]!==C||t[37]!==w||t[38]!==T?(E=(0,R.jsx)(_,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:a,"aria-label":C,title:w,children:T}),t[34]=r,t[35]=a,t[36]=C,t[37]=w,t[38]=T,t[39]=E):E=t[39];let D=n.status===`archived`?l.restore:l.archive,O=n.status===`archived`?l.restore:l.archive,k;t[40]===n.status?k=t[41]:(k=n.status===`archived`?(0,R.jsx)(j,{className:`size-4`,"aria-hidden":!0}):(0,R.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[40]=n.status,t[41]=k);let A;t[42]!==r||t[43]!==s||t[44]!==D||t[45]!==O||t[46]!==k?(A=(0,R.jsx)(_,{type:`button`,variant:`ghost`,className:`size-8 p-0`,disabled:r,onClick:s,"aria-label":D,title:O,children:k}),t[42]=r,t[43]=s,t[44]=D,t[45]=O,t[46]=k,t[47]=A):A=t[47];let P;t[48]!==E||t[49]!==A?(P=(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[E,A]}),t[48]=E,t[49]=A,t[50]=P):P=t[50];let F;t[51]!==P||t[52]!==m||t[53]!==S?(F=(0,R.jsxs)(`div`,{className:m,children:[S,P]}),t[51]=P,t[52]=m,t[53]=S,t[54]=F):F=t[54];let L;return t[55]!==F||t[56]!==g||t[57]!==b?(L=(0,R.jsxs)(`article`,{className:g,children:[b,F]}),t[55]=F,t[56]=g,t[57]=b,t[58]=L):L=t[58],L}function ie(e){return e.language}function V(){let e=ee(o(e=>e.language)),t=e.projectsPage,n=t.management,r=e.chat.workingDirectory,i=u(e=>e.setPageHeader),c=u(e=>e.clearPageHeader),[h,v]=(0,L.useState)([]),[O,j]=(0,L.useState)(!0),[M,N]=(0,L.useState)(null),[I,z]=(0,L.useState)(``),[B,ie]=(0,L.useState)(`active`),[V,ae]=(0,L.useState)(null),[oe,H]=(0,L.useState)(!1),[U,W]=(0,L.useState)(null),[G,K]=(0,L.useState)(!1),[q,J]=(0,L.useState)(``),[Y,X]=(0,L.useState)(``),[Z,se]=(0,L.useState)(``),Q=w({initialPath:Z,onPicked:se}),$=(0,L.useCallback)(async()=>{j(!0),N(null);try{v(te((await b({limit:100,sortBy:`updatedAt`,sortOrder:`desc`})).items))}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},[]);(0,L.useEffect)(()=>{$()},[$]);let ce=(0,L.useMemo)(()=>{let e=I.trim().toLocaleLowerCase();return h.filter(e=>B===`all`||e.status===B).filter(t=>!e||[t.name,t.description,t.brief,t.workspaceRoot].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e)))},[B,h,I]),le=(0,L.useMemo)(()=>(0,R.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,R.jsx)(x,{className:`size-4`,"aria-hidden":!0}),t.create]}),[t.create]);(0,L.useLayoutEffect)(()=>(i({startExtra:null,main:(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,R.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:le}),()=>c()),[c,le,n.subtitle,n.title,i]);let ue=(0,L.useCallback)(async e=>{e.preventDefault();let t=q.trim(),n=Z.trim();if(!(!t||!n||G)){K(!0),W(null);try{let e=await A({name:t,...Y.trim()?{description:Y.trim()}:{},workspaceRoot:n});v(t=>[e,...t.filter(t=>t.id!==e.id)]),J(``),X(``),se(``),H(!1),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){W(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[G,Y,q,Z]),de=(0,L.useCallback)(async(e,t)=>{ae(e.id),N(null);try{let n;n=t===`pin`?e.pinnedAt?await g(e.id):await k(e.id):e.status===`archived`?await E(e.id):await D(e.id),v(e=>e.map(e=>e.id===n.id?n:e)),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}catch(e){N(e instanceof Error?e.message:String(e))}finally{ae(null)}},[]),fe=[{id:`active`,label:t.statuses.active},{id:`paused`,label:t.statuses.paused},{id:`archived`,label:t.statuses.archived},{id:`all`,label:t.all}];return(0,R.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,R.jsx)(p,{open:oe,onOpenChange:e=>{H(e),e||W(null)},children:(0,R.jsxs)(f,{children:[(0,R.jsx)(d,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,R.jsxs)(s,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,R.jsx)(m,{className:`text-base font-semibold text-fg`,children:t.createTitle}),(0,R.jsx)(C,{className:`mt-1 text-sm text-fg-muted`,children:t.createDescription})]}),(0,R.jsxs)(`form`,{onSubmit:ue,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.projectName,(0,R.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 font-normal outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:q,onChange:e=>J(e.target.value),maxLength:160})]}),(0,R.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[n.descriptionLabel,(0,R.jsx)(`textarea`,{className:`min-h-28 resize-none rounded-lg border border-edge bg-surface-base px-3 py-2 font-normal leading-6 outline-none focus:border-accent focus:ring-2 focus:ring-accent/20`,value:Y,onChange:e=>X(e.target.value),maxLength:2e3,placeholder:n.descriptionPlaceholder})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-fg`,children:t.workspaceRoot}),(0,R.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full items-center gap-3 rounded-lg border border-edge bg-surface-base px-3 py-2 text-left outline-none transition-colors hover:bg-surface-hover focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/20 disabled:cursor-not-allowed disabled:opacity-60`,onClick:Q.pick,disabled:G||Q.picking,children:[Q.picking?(0,R.jsx)(F,{className:`size-5 shrink-0 animate-spin text-accent`,"aria-hidden":!0}):(0,R.jsx)(P,{className:`size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Z?r.chooseFolder:r.selectWorkingDirectory}),(0,R.jsx)(`span`,{className:a(`mt-0.5 block truncate font-mono text-xs font-normal`,Z?`text-fg-muted`:`text-fg-subtle`),title:Z||void 0,children:Z||t.workspaceSelectionPlaceholder})]})]}),(0,R.jsx)(`p`,{className:`text-xs font-normal text-fg-subtle`,children:t.workspaceSelectionHint})]}),U?(0,R.jsx)(`p`,{className:`rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:U}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,R.jsx)(T,{asChild:!0,children:(0,R.jsx)(_,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,R.jsx)(_,{type:`submit`,variant:`primary`,disabled:G||!q.trim()||!Z.trim(),children:G?t.home.creating:t.create})]})]})]})]})}),Q.hasNativePicker?null:(0,R.jsx)(l,{open:Q.modalOpen,onOpenChange:Q.setModalOpen,initialAbsolutePath:Z||void 0,onConfirm:Q.confirmPick,wd:r}),(0,R.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n.filterLabel,children:fe.map(e=>(0,R.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,B===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>ie(e.id),children:e.label},e.id))}),(0,R.jsxs)(`label`,{className:`relative block min-w-0 sm:w-64`,children:[(0,R.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`input`,{className:`h-9 w-full rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>z(e.target.value),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder})]})]}),M?(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,role:`alert`,children:[(0,R.jsx)(`span`,{children:M}),(0,R.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:t.home.retry})]}):null,O?(0,R.jsx)(ne,{}):ce.length?(0,R.jsx)(`section`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ce.map(e=>(0,R.jsx)(re,{project:e,busy:V===e.id,onTogglePin:()=>void de(e,`pin`),onToggleArchive:()=>void de(e,`archive`)},e.id))}):(0,R.jsxs)(`section`,{className:`rounded-xl border border-dashed border-edge p-10 text-center`,children:[(0,R.jsx)(y,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,R.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.emptyTitle}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.emptyHint})]})]})}export{V as ProjectsPage};