@xopcai/xopc 0.0.151 → 0.0.153

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 (115) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-uu1xu9Pl.js → activity-store-XA9328eM.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BuO-OVfD.js → agent-avatar-dicebear-E09Jv6kW.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-Bpv3h31T.js → agents-BA46Lyc7.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-CwL38LEV.js → api-kQEpNIa-.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B6OU3Eol.js → app-management-settings-panel-BzrND8g7.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BaP4GFvN.js → appearance-settings-CKMCWf75.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DZKNIMRg.js → apps-page-DPP_gFCc.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-CJX3zIh_.js → archive-plugin-DNOroxSq.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CI1ejk_l.js → attachment-load-PtKuOOfL.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-CjmhICbv.js → automation-suggestion-card-C7HQ5bAK.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-BtZl3B8m.js → automations-page-BuMTtTYy.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-CZ8nOXqK.js → binary-plugins-DDFoTNKm.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-BoSfyS_j.js → block-editor-CH_e8EXF.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-CL1UiPcb.js → browser-settings-page-43uOCSrE.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capability-presets-api-XzDKxPZ8.js → capability-presets-api-Cby6Utaf.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dc_uHYgl.js → capability-presets-settings-panel-BZvp3H2p.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channel-recipient-api-DYLBAhFF.js → channel-recipient-api-COdmaOO4.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-settings-mALvXpJj.js → channels-settings-BAPRTSF4.js} +1 -1
  21. package/dist/gateway/static/root/assets/channels-status-swr-DvB_8J5B.js +1 -0
  22. package/dist/gateway/static/root/assets/chunk-KS7C4IRE-uQ0fehio.js +4 -0
  23. package/dist/gateway/static/root/assets/{connector-logo-BSjlInHT.js → connector-logo-CinEws2y.js} +1 -1
  24. package/dist/gateway/static/root/assets/{connectors-page-Cm_E3mmI.js → connectors-page-P-Ur9mlf.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-DcJc91-C.js → desktop-pet-O3wyOYRG.js} +1 -1
  26. package/dist/gateway/static/root/assets/{desktop-pet-settings-CdeqTa3Q.js → desktop-pet-settings-nbvEKluo.js} +1 -1
  27. package/dist/gateway/static/root/assets/{directory-picker-path-field-Cp3fpm0k.js → directory-picker-path-field-DyZJo5xz.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dreaming-settings-Bwj1O3zr.js → dreaming-settings-CruD-NNs.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-debug-page-D_1xpKbZ.js → extension-debug-page-CV7SDe48.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-page-CqZNCj96.js → extension-page-DJCYwgB_.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-settings-page-5MWbtQaQ.js → extension-settings-page-6kJQVKbq.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-config-api-Co_IaS34.js → gateway-config-api-DOewYtbP.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-settings-kmeWm2Pt.js → gateway-settings-BjjXod61.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-startup-retry-BM_xvzl0.js → gateway-startup-retry-ewVb05iS.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goal-create-dialog-FoO-R4_U.js → goal-create-dialog-BStw0m9M.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goal-detail-page-CkJq7N5g.js → goal-detail-page-BOChQ7i7.js} +1 -1
  37. package/dist/gateway/static/root/assets/{goals-config-api-DrtsYjXz.js → goals-config-api-CYNvVerg.js} +1 -1
  38. package/dist/gateway/static/root/assets/{goals-page-DRAN-R64.js → goals-page-BrNRDv8T.js} +1 -1
  39. package/dist/gateway/static/root/assets/{goals-settings-wq9TKhIZ.js → goals-settings-CHZcm6es.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-B5zDoHbo.js → heartbeat-settings-B5oMLvbo.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-B5cSZcER.js +196 -0
  42. package/dist/gateway/static/root/assets/index-CNr0KWZU.css +1 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-3tC9iD21.js → keyboard-shortcuts-settings-Eb8IqcMd.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-CT-vDTLK.js → local-app-workbench-page-L-MQ_dJY.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-B9ruF9GV.js → local-apps-page-Zb0f5eNc.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-GfSwnwIZ.js → locale-store-CQDaFvDN.js} +1 -1
  47. package/dist/gateway/static/root/assets/{logs-page-Ca1X8X2P.js → logs-page-ToUMpW7t.js} +1 -1
  48. package/dist/gateway/static/root/assets/{markdown-split-CzuhSQAB.js → markdown-split-RnzQRPvB.js} +1 -1
  49. package/dist/gateway/static/root/assets/{media-plugins-a3R4y-EL.js → media-plugins-BoX0SWrl.js} +1 -1
  50. package/dist/gateway/static/root/assets/messages--cnUi8Ld.js +5 -0
  51. package/dist/gateway/static/root/assets/{models-hub-panel-CbTlz9Of.js → models-hub-panel-BQuynkNz.js} +1 -1
  52. package/dist/gateway/static/root/assets/{notes-page-BCxDy2dV.js → notes-page-CSOXTk0P.js} +1 -1
  53. package/dist/gateway/static/root/assets/{notes-workbench-z6sBX9B2.js → notes-workbench-B7NIQBqd.js} +2 -2
  54. package/dist/gateway/static/root/assets/{page-tabs-CJfk6M78.js → page-tabs-Dl9G6Pm3.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-MFopTSgF.js → preview-open-alternatives-B8R5o1uN.js} +1 -1
  56. package/dist/gateway/static/root/assets/{project-detail-page-DU29deIr.js → project-detail-page-DoN-qkzc.js} +1 -1
  57. package/dist/gateway/static/root/assets/{projects-page-Ck3DLTlZ.js → projects-page-BBOW0A-s.js} +1 -1
  58. package/dist/gateway/static/root/assets/{remote-access-hub-gLsLyAyi.js → remote-access-hub-BzXHX9bU.js} +1 -1
  59. package/dist/gateway/static/root/assets/{save-bar-controls-D0uhU3Z8.js → save-bar-controls-D6OGeVDa.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schedule-field-NGOH-7wV.js → schedule-field-CKrch41X.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-BJz5LoqG.js → schema-form-FroNrvKO.js} +1 -1
  62. package/dist/gateway/static/root/assets/{sessions-page-TmNoWpa_.js → sessions-page-c4n4TLc2.js} +1 -1
  63. package/dist/gateway/static/root/assets/settings-advanced-gate-BEsX3iAM.js +1 -0
  64. package/dist/gateway/static/root/assets/{settings-collapsible-section-oDnUHnX_.js → settings-collapsible-section-1SeKT26L.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-form-section-DND90dDt.js → settings-form-section-Cz4xOOt4.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-loading-skeleton-CEJtaoQp.js → settings-loading-skeleton-rBI7xqmM.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-B1LJlRi9.js → settings-page-7SlGFgmR.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-layout-CsrLuDsW.js → settings-page-layout-C7B19AHf.js} +1 -1
  69. package/dist/gateway/static/root/assets/{setup-status-panel-BPCJPHHY.js → setup-status-panel-_x53a0I_.js} +1 -1
  70. package/dist/gateway/static/root/assets/{share-preview-page-C1PwLh-p.js → share-preview-page-DwcX1sXG.js} +1 -1
  71. package/dist/gateway/static/root/assets/{shares-settings-DCuqr7js.js → shares-settings-BwfS4kkk.js} +1 -1
  72. package/dist/gateway/static/root/assets/skill-reload-api-BkjO4n_a.js +1 -0
  73. package/dist/gateway/static/root/assets/{skills-page-k6VIqTkK.js → skills-page-sCuywwN5.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-BEsrEkSx.js → system-settings-panel-CZkASLIv.js} +1 -1
  75. package/dist/gateway/static/root/assets/{theme-store-Bi6hMBDb.js → theme-store-DP5WlsZg.js} +1 -1
  76. package/dist/gateway/static/root/assets/{typed-models-lib-dOypdlMf.js → typed-models-lib-C2TbyW3H.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-channel-catalog-f8A-PVuq.js → use-channel-catalog-4WYXfEXk.js} +1 -1
  78. package/dist/gateway/static/root/assets/{user-context-page-B9Y_Ciav.js → user-context-page-0MO96b3-.js} +1 -1
  79. package/dist/gateway/static/root/assets/{user-profile-fields-editor-DGC38Lx7.js → user-profile-fields-editor-Cqalx8iJ.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-profile-settings-panel-DFkZ-tan.js → user-profile-settings-panel-CVbTC44o.js} +1 -1
  81. package/dist/gateway/static/root/assets/{utils-CEIYZihF.js → utils-DOvyuYat.js} +1 -1
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-DK6gaQsA.js → voice-api-key-field-ClOb2PfC.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-page-DSJb9Kq7.js → work-discovery-page-Ci_rGhsb.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-item-detail-page-DVavwV3D.js → work-item-detail-page-DnJeDqJB.js} +1 -1
  85. package/dist/gateway/static/root/assets/{work-page-foJDp0nz.js → work-page-n9XZM9PY.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BYqZpFCC.js → workflow-run-setup-panel-pNCz37MS.js} +1 -1
  87. package/dist/gateway/static/root/assets/{workflows-page-DgO0WAzs.js → workflows-page-BFTxMEH6.js} +1 -1
  88. package/dist/gateway/static/root/index.html +8 -8
  89. package/dist/package.js +1 -1
  90. package/dist/packages/gateway-contract/src/product-delivery.js +63 -0
  91. package/dist/src/agent/code-intelligence/tool-gating.d.ts +5 -0
  92. package/dist/src/agent/code-intelligence/tool-gating.js +6 -0
  93. package/dist/src/agent/tools/automation-tool.js +1 -1
  94. package/dist/src/agent/tools/factory.js +2 -1
  95. package/dist/src/agent/tools/goal-tool.js +1 -1
  96. package/dist/src/agent/tools/workflow-tool.js +1 -1
  97. package/dist/src/agent/tools/write.js +1 -1
  98. package/dist/src/agent/tools/xopc-use-tool.js +1 -1
  99. package/dist/src/config/agent-profile.js +1 -1
  100. package/dist/src/config/index.js +2 -2
  101. package/dist/src/config/paths.d.ts +1 -0
  102. package/dist/src/config/paths.js +10 -3
  103. package/dist/src/gateway/agents-admin.js +1 -1
  104. package/dist/src/gateway/heartbeat/service.js +1 -1
  105. package/dist/src/gateway/hono/routes/status.d.ts +8 -0
  106. package/dist/src/gateway/hono/routes/status.js +71 -1
  107. package/dist/src/heartbeat/index.js +1 -1
  108. package/package.json +15 -6
  109. package/dist/gateway/static/root/assets/channels-status-swr-CZuEsO5b.js +0 -1
  110. package/dist/gateway/static/root/assets/chunk-QUQL4437-DXsxWP7r.js +0 -4
  111. package/dist/gateway/static/root/assets/index-DIlxvrlG.css +0 -1
  112. package/dist/gateway/static/root/assets/index-apLU0Hun.js +0 -196
  113. package/dist/gateway/static/root/assets/messages-B0B40tpO.js +0 -5
  114. package/dist/gateway/static/root/assets/settings-advanced-gate-CtPhh2m9.js +0 -1
  115. package/dist/gateway/static/root/assets/skill-reload-api-kn1Vypcy.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{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./check-BODqo66o.js";import{t as l}from"./circle-alert-RzVebuX2.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages-B0B40tpO.js";import{l as f,n as p,o as m}from"./locale-store-GfSwnwIZ.js";import{$a as h,Ba as g,Bo as _,Cc as v,Cs as y,Cu as b,Dc as x,El as S,Fa as C,Fl as w,Fo as T,Fs as E,Ga as D,Ha as O,Ia as k,Io as A,Ja as j,Jr as M,Ka as N,Ks as P,La as F,Lo as I,Ml as L,Ni as R,Nl as z,No as B,Oc as V,Pa as H,Po as ee,Qa as te,R as ne,Ra as re,Rc as ie,Rl as ae,Ro as oe,Ss as se,Tl as ce,Ua as le,Ul as ue,Vr as de,Wa as fe,Xa as pe,Xc as me,Ya as he,Yo as ge,Za as _e,Zo as ve,a as ye,aa as be,ac as xe,as as Se,au as Ce,bl as U,bu as we,c as W,ca as Te,cc as Ee,d as De,da as Oe,dl as ke,et as Ae,f as je,fa as Me,ft as Ne,h as Pe,i as Fe,ia as Ie,is as Le,la as Re,lo as ze,m as Be,na as Ve,nl as He,no as Ue,ns as We,o as Ge,oa as Ke,oo as qe,or as Je,os as Ye,qa as Xe,ra as Ze,ro as Qe,rs as $e,s as et,sa as tt,tc as nt,tr as rt,tu as it,u as at,ua as ot,uc as st,ut as ct,wc as lt,wt as ut,x as dt,xc as ft,xl as pt,xt as mt,yc as ht,ys as G,yt as gt,zo as _t,zs as vt}from"./index-apLU0Hun.js";import{t as yt}from"./notes-workbench-z6sBX9B2.js";import{t as bt}from"./page-tabs-CJfk6M78.js";import{t as xt}from"./directory-picker-path-field-Cp3fpm0k.js";import{t as St}from"./goals-config-api-DrtsYjXz.js";import{n as Ct,t as wt}from"./goal-create-dialog-FoO-R4_U.js";var K=n(),q=e(t(),1),J=r(),Tt=`application/x-xopc-work-item`,Et=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Dt=[`low`,`normal`,`high`,`urgent`];function Ot(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function kt(e){return e?Ae(new Date(e)):``}function At(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function jt(e){return`${e.name}:${e.size}:${e.lastModified}`}function Mt(e,t){return Ve(e,t)!==`unsupported`}function Nt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Pt(e,t){return{id:e.id,name:e.fileName,type:Nt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Ft(e,t){let n=Ie(e.name||`upload`,e.type||`application/octet-stream`),r=Ue(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Nt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function It(e){let t=(0,K.c)(3),[n,r]=(0,q.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,q.useEffect)(i,a),n}function Lt(e,t){let n=(0,K.c)(5),[r,i]=(0,q.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await m(Pe(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,q.useEffect)(a,o),r}function Rt(e){let t=(0,K.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(S,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function zt(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function Bt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Vt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Ht(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:o,onDragStart:c,onDragEnd:l,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==c?(f=e=>c(n,e),t[0]=n,t[1]=c,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=s(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,m),t[3]=m,t[4]=h);let g=d?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=s(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=d?u.markTodo:u.markDone,y=d?u.markTodo:u.markDone,b;t[7]!==n||t[8]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(it,{className:`size-3`,"aria-hidden":!0}):null,t[10]=d,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==i?(C=()=>i(n),t[18]=n,t[19]=i,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==u?(T=Vt(n,u),t[23]=n,t[24]=u,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ot(n.status)),t[35]=n.status,t[36]=k);let A=u.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=u.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(V,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,R;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(L,{className:`size-3`,"aria-hidden":!0}),t[46]=R):R=t[46];let z;t[47]!==u.detail.openItem||t[48]!==I?(z=(0,J.jsxs)(a,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[u.detail.openItem,R]}),t[47]=u.detail.openItem,t[48]=I,t[49]=z):z=t[49];let B;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==z?(B=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,z]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=z,t[55]=B):B=t[55];let H;return t[56]!==l||t[57]!==u.dragToUpdate||t[58]!==f||t[59]!==O||t[60]!==B||t[61]!==h?(H=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:l,title:p,className:h,children:[O,B]}),t[56]=l,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=B,t[61]=h,t[62]=H):H=t[62],H}function Ut(){let e=(0,K.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function Wt(e){let t=(0,K.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=Ie(n.name||`upload`,n.type||`application/octet-stream`),d=Mt(n.name||`upload`,u),f=It,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),h=n.name||`upload`,g=i||a,_;t[5]!==n||t[6]!==c?(_=()=>c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==m?(v=(0,J.jsx)(Rt,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:_}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=_,t[13]=m,t[14]=v):v=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=s(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||i||a,C;t[17]!==n||t[18]!==c?(C=()=>c(n),t[17]=n,t[18]=c,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=At(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==o.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[36]=i,t[37]=o.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==v?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[v,O,j]}),t[40]=O,t[41]=j,t[42]=v,t[43]=M):M=t[43],M}function Gt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:c,onDownload:l,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=Mt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=Lt(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==c?(h=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=h):h=t[6];let g;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==f||t[10]!==m||t[11]!==h||t[12]!==p?(g=(0,J.jsx)(Rt,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:p,previewable:f,disabled:m,onOpen:h}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=f,t[10]=m,t[11]=h,t[12]=p,t[13]=g):g=t[13];let _=f?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,v;t[14]===_?v=t[15]:(v=s(`min-w-0 flex-1 text-left`,_),t[14]=_,t[15]=v);let y=!f||i||a,b;t[16]!==r||t[17]!==n||t[18]!==c?(b=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,t[19]=b):b=t[19];let x;t[20]===r.fileName?x=t[21]:(x=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=x);let S=r.mimeType,C;t[22]===r.size?C=t[23]:(C=At(r.size),t[22]=r.size,t[23]=C);let T;t[24]!==r.mimeType||t[25]!==C?(T=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[S,` · `,C]}),t[24]=r.mimeType,t[25]=C,t[26]=T):T=t[26];let D;t[27]!==T||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(D=(0,J.jsxs)(`button`,{type:`button`,className:v,disabled:y,onClick:b,children:[x,T]}),t[27]=T,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=D):D=t[32];let O;t[33]!==r||t[34]!==n||t[35]!==l?(O=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,J.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),t[37]=k):k=t[37];let A;t[38]!==i||t[39]!==o.attachments.download||t[40]!==O?(A=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.download,"aria-label":o.attachments.download,disabled:i,onClick:O,children:k}),t[38]=i,t[39]=o.attachments.download,t[40]=O,t[41]=A):A=t[41];let j;t[42]!==r||t[43]!==n||t[44]!==u?(j=()=>u(n,r),t[42]=r,t[43]=n,t[44]=u,t[45]=j):j=t[45];let M;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),t[46]=M):M=t[46];let N;t[47]!==i||t[48]!==o.attachments.remove||t[49]!==j?(N=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:j,children:M}),t[47]=i,t[48]=o.attachments.remove,t[49]=j,t[50]=N):N=t[50];let P;return t[51]!==D||t[52]!==A||t[53]!==N||t[54]!==g?(P=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[g,D,A,N]}),t[51]=D,t[52]=A,t[53]=N,t[54]=g,t[55]=P):P=t[55],P}function Kt({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:c,onDownload:l,onPreviewError:u}){let d=(0,q.useRef)(null),[p,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=f(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(jt)),s=[...n];for(let e of r){let t=jt(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function T(e){a(n.filter((t,n)=>n!==e))}async function E(e){let t=jt(e);x(`pending:${t}`);try{y(await Ft(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await m(Pe(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Pt(t,Ue(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:s(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,p&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),w(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(V,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(ht,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(Wt,{file:e,index:t,busy:r,previewBusy:b===`pending:${jt(e)}`,t:i,onOpen:e=>void E(e),onRemove:T},jt(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Gt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void D(e,t),onDownload:l,onRemove:c},e.id))}):null,!n.length&&!C.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.attachments.empty}):null]}),(0,J.jsx)(ct,{open:g,attachment:v,authToken:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function qt(e){let t=(0,K.c)(169),{mode:n,item:r,initialStatus:i,events:o,busy:c,error:l,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:b,onPreviewError:x}=e,S=n!==null,[C,w]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(`todo`),[j,M]=(0,q.useState)(`normal`),[N,P]=(0,q.useState)(``),[F,R]=(0,q.useState)(``),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[0]=z):z=t[0];let[V,H]=(0,q.useState)(z),te,ne;t[1]!==i||t[2]!==r||t[3]!==n?(te=()=>{if(n===`create`){w(``),D(``),k(i),M(`normal`),P(``),R(``),H([]);return}n===`detail`&&r&&(w(r.title),D(r.description??``),k(r.status),M(r.priority),P(r.nextAction??``),R(r.blockedReason??``),H([]))},ne=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=te,t[5]=ne):(te=t[4],ne=t[5]),(0,q.useEffect)(te,ne);let re;t[6]!==F||t[7]!==E||t[8]!==r||t[9]!==n||t[10]!==N||t[11]!==p||t[12]!==m||t[13]!==V||t[14]!==j||t[15]!==O||t[16]!==C?(re=function(e){e.preventDefault();let t=C.trim();if(t){if(n===`create`){p({title:t,description:E.trim()||void 0,priority:j,status:O,nextAction:N.trim()||void 0,blockedReason:F.trim()||void 0,attachments:V});return}r&&m(r,{title:t,description:E.trim()||null,status:O,priority:j,nextAction:N.trim()||null,blockedReason:F.trim()||null})}},t[6]=F,t[7]=E,t[8]=r,t[9]=n,t[10]=N,t[11]=p,t[12]=m,t[13]=V,t[14]=j,t[15]=O,t[16]=C,t[17]=re):re=t[17];let ae=re,se;t[18]===f?se=t[19]:(se=e=>!e&&f(),t[18]=f,t[19]=se);let ce;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ce):ce=t[20];let le=n===`create`?d.create.title:r?.title||d.title,ue;t[21]===le?ue=t[22]:(ue=(0,J.jsx)(_t,{className:`truncate text-base font-semibold text-fg`,children:le}),t[21]=le,t[22]=ue);let de;t[23]===d.detail.description?de=t[24]:(de=(0,J.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=de);let fe;t[25]!==ue||t[26]!==de?(fe=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[ue,de]}),t[25]=ue,t[26]=de,t[27]=fe):fe=t[27];let pe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,J.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[28]=pe):pe=t[28];let me;t[29]===c?me=t[30]:(me=(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:c,children:pe})}),t[29]=c,t[30]=me);let he;t[31]!==fe||t[32]!==me?(he=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[fe,me]}),t[31]=fe,t[32]=me,t[33]=he):he=t[33];let _e;t[34]===l?_e=t[35]:(_e=l?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:l}):null,t[34]=l,t[35]=_e);let ye;t[36]!==l||t[37]!==u?(ye=!l&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(it,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=l,t[37]=u,t[38]=ye):ye=t[38];let be;t[39]===d.create.titleLabel?be=t[40]:(be=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>w(e.target.value),t[41]=xe):xe=t[41];let Se;t[42]===C?Se=t[43]:(Se=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:C,onChange:xe}),t[42]=C,t[43]=Se);let Ce;t[44]!==be||t[45]!==Se?(Ce=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[be,Se]}),t[44]=be,t[45]=Se,t[46]=Ce):Ce=t[46];let U;t[47]===d.detail.status?U=t[48]:(U=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[47]=d.detail.status,t[48]=U);let we;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>k(e.target.value),t[49]=we):we=t[49];let W;t[50]===d.statuses?W=t[51]:(W=Et.map(e=>(0,J.jsx)(ve,{value:e,children:d.statuses[e]},e)),t[50]=d.statuses,t[51]=W);let Te;t[52]!==O||t[53]!==W?(Te=(0,J.jsx)(ge,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:O,onChange:we,children:W}),t[52]=O,t[53]=W,t[54]=Te):Te=t[54];let Ee;t[55]!==U||t[56]!==Te?(Ee=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[U,Te]}),t[55]=U,t[56]=Te,t[57]=Ee):Ee=t[57];let De;t[58]===d.create.priorityLabel?De=t[59]:(De=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[58]=d.create.priorityLabel,t[59]=De);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>M(e.target.value),t[60]=Oe):Oe=t[60];let ke;t[61]===d.priorities?ke=t[62]:(ke=Dt.map(e=>(0,J.jsx)(ve,{value:e,children:d.priorities[e]},e)),t[61]=d.priorities,t[62]=ke);let Ae;t[63]!==j||t[64]!==ke?(Ae=(0,J.jsx)(ge,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Oe,children:ke}),t[63]=j,t[64]=ke,t[65]=Ae):Ae=t[65];let je;t[66]!==De||t[67]!==Ae?(je=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[De,Ae]}),t[66]=De,t[67]=Ae,t[68]=je):je=t[68];let Me;t[69]!==Ee||t[70]!==je?(Me=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Ee,je]}),t[69]=Ee,t[70]=je,t[71]=Me):Me=t[71];let Ne;t[72]===d.create.descriptionLabel?Ne=t[73]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[72]=d.create.descriptionLabel,t[73]=Ne);let Pe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>D(e.target.value),t[74]=Pe):Pe=t[74];let Fe;t[75]===E?Fe=t[76]:(Fe=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:E,onChange:Pe}),t[75]=E,t[76]=Fe);let Ie;t[77]!==Ne||t[78]!==Fe?(Ie=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[77]=Ne,t[78]=Fe,t[79]=Ie):Ie=t[79];let Le;t[80]!==c||t[81]!==r||t[82]!==n||t[83]!==_||t[84]!==b||t[85]!==x||t[86]!==v||t[87]!==V||t[88]!==d?(Le=(0,J.jsx)(Kt,{mode:n,item:r,pendingFiles:V,busy:c,t:d,onPendingFilesChange:H,onUpload:_,onRemove:v,onDownload:b,onPreviewError:x}),t[80]=c,t[81]=r,t[82]=n,t[83]=_,t[84]=b,t[85]=x,t[86]=v,t[87]=V,t[88]=d,t[89]=Le):Le=t[89];let Re;t[90]!==F||t[91]!==n||t[92]!==N||t[93]!==O||t[94]!==d.blockedReason||t[95]!==d.nextAction?(Re=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:N,onChange:e=>P(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:s(`font-medium`,O===`blocked`||O===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:s(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,O===`blocked`||O===`needs_input`?`border-red-500/40`:`border-edge`),value:F,onChange:e=>R(e.target.value)})]})]}):null,t[90]=F,t[91]=n,t[92]=N,t[93]=O,t[94]=d.blockedReason,t[95]=d.nextAction,t[96]=Re):Re=t[96];let ze;t[97]!==_e||t[98]!==ye||t[99]!==Ce||t[100]!==Me||t[101]!==Ie||t[102]!==Le||t[103]!==Re?(ze=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[_e,ye,Ce,Me,Ie,Le,Re]}),t[97]=_e,t[98]=ye,t[99]=Ce,t[100]=Me,t[101]=Ie,t[102]=Le,t[103]=Re,t[104]=ze):ze=t[104];let Be;t[105]!==c||t[106]!==r||t[107]!==n||t[108]!==g||t[109]!==h||t[110]!==d.detail.actions||t[111]!==d.detail.createGoal||t[112]!==d.detail.openItem||t[113]!==d.detail.startChat?(Be=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>h(r),children:[(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>g(r),children:[(0,J.jsx)(vt,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(G,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(a,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(L,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[105]=c,t[106]=r,t[107]=n,t[108]=g,t[109]=h,t[110]=d.detail.actions,t[111]=d.detail.createGoal,t[112]=d.detail.openItem,t[113]=d.detail.startChat,t[114]=Be):Be=t[114];let Ve;t[115]===d.detail.links?Ve=t[116]:(Ve=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[115]=d.detail.links,t[116]=Ve);let He;t[117]!==r||t[118]!==d.detail.noLinks||t[119]!==d.linkKinds?(He=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(a,{to:zt(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[d.linkKinds[e.kind],(0,J.jsx)(L,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[117]=r,t[118]=d.detail.noLinks,t[119]=d.linkKinds,t[120]=He):He=t[120];let Ue;t[121]===He?Ue=t[122]:(Ue=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:He}),t[121]=He,t[122]=Ue);let We;t[123]!==Ve||t[124]!==Ue?(We=(0,J.jsxs)(`section`,{children:[Ve,Ue]}),t[123]=Ve,t[124]=Ue,t[125]=We):We=t[125];let Ge;t[126]===d.detail.activity?Ge=t[127]:(Ge=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[126]=d.detail.activity,t[127]=Ge);let Ke;t[128]!==o||t[129]!==d.detail.noActivity||t[130]!==d.eventTypes?(Ke=o.length?o.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:d.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:kt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[128]=o,t[129]=d.detail.noActivity,t[130]=d.eventTypes,t[131]=Ke):Ke=t[131];let qe;t[132]===Ke?qe=t[133]:(qe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ke}),t[132]=Ke,t[133]=qe);let Je;t[134]!==Ge||t[135]!==qe?(Je=(0,J.jsxs)(`section`,{children:[Ge,qe]}),t[134]=Ge,t[135]=qe,t[136]=Je):Je=t[136];let Ye;t[137]!==Be||t[138]!==We||t[139]!==Je?(Ye=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Be,We,Je]}),t[137]=Be,t[138]=We,t[139]=Je,t[140]=Ye):Ye=t[140];let Xe;t[141]!==ze||t[142]!==Ye?(Xe=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[ze,Ye]}),t[141]=ze,t[142]=Ye,t[143]=Xe):Xe=t[143];let Ze;t[144]!==c||t[145]!==f||t[146]!==d.create.cancel?(Ze=(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:c,children:d.create.cancel}),t[144]=c,t[145]=f,t[146]=d.create.cancel,t[147]=Ze):Ze=t[147];let Qe;t[148]!==c||t[149]!==C?(Qe=c||!C.trim(),t[148]=c,t[149]=C,t[150]=Qe):Qe=t[150];let $e;t[151]===n?$e=t[152]:($e=n===`create`?(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}):null,t[151]=n,t[152]=$e);let et=n===`create`?d.create.submit:d.detail.save,tt;t[153]!==Qe||t[154]!==$e||t[155]!==et?(tt=(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:Qe,children:[$e,et]}),t[153]=Qe,t[154]=$e,t[155]=et,t[156]=tt):tt=t[156];let nt;t[157]!==Ze||t[158]!==tt?(nt=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Ze,tt]}),t[157]=Ze,t[158]=tt,t[159]=nt):nt=t[159];let rt;t[160]!==ae||t[161]!==he||t[162]!==Xe||t[163]!==nt?(rt=(0,J.jsxs)(oe,{children:[ce,(0,J.jsx)(T,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,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)(`form`,{onSubmit:ae,className:`flex min-h-0 flex-1 flex-col`,children:[he,Xe,nt]})})]}),t[160]=ae,t[161]=he,t[162]=Xe,t[163]=nt,t[164]=rt):rt=t[164];let at;return t[165]!==S||t[166]!==se||t[167]!==rt?(at=(0,J.jsx)(B,{open:S,onOpenChange:se,children:rt}),t[165]=S,t[166]=se,t[167]=rt,t[168]=at):at=t[168],at}function Jt({projectId:e,createRequestKey:t=0}){let n=i(),r=d(p(e=>e.language)).projectDetailPage.workItems,a=(0,q.useRef)(null),o=(0,q.useRef)(null),[c,l]=(0,q.useState)([]),[u,f]=(0,q.useState)(!0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{f(!0),h(null);try{let r=await W(e,{limit:100,offset:n});l(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),h(null),_(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Et.map(e=>({status:e,title:r.statuses[e],items:c.filter(t=>t.status===e)})),[c,r.statuses]),R=(0,q.useCallback)(e=>{l(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),B=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await De(e.id,t);n.item.archivedAt?(l(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(n.item),_({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,R]),V=(0,q.useCallback)(async e=>{N(e),F([]),h(null),_(null);let t=await at(e.id).catch(()=>null);t&&F(t.events)},[]),H=(0,q.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Fe(e,t);l(e=>[n.item,...e]),k(!1),N(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events),_({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),ee=(0,q.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await Be(e.id,t);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[R]),te=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ge(e.id,t.id);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[R]),ne=(0,q.useCallback)(async(e,t)=>{h(null),_(null);try{await et(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await je(e.id);R(t.item),await V(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,V,R]),ie=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await ye(e.id);R(t.item),await V(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,V,R]),ae=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Tt,e.id),x(e.id)},[]),oe=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Tt)||b;C(null),x(null);let r=c.find(e=>e.id===n);!r||r.status===e||B(r,{status:e})},[b,c,B]),se=(0,q.useCallback)(e=>{B(e,{status:e.status===`done`?`todo`:`done`})},[B]),ce=(0,q.useCallback)(e=>{N(null),F([]),h(null),_(null),j(e),k(!0)},[]),le=(0,q.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),ue=(0,q.useCallback)(e=>{if(e.button!==0||b||Bt(e.target))return;let t=a.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),de=(0,q.useCallback)(e=>{let t=o.current,n=a.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,T(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[m?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:m}):null,(0,J.jsx)(`section`,{ref:a,className:s(`min-h-0 flex-1 overflow-x-auto rounded-lg p-2 transition-opacity`,u&&`opacity-60`,w?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:ue,onPointerMove:de,onPointerUp:le,onPointerCancel:le,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:s(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,S===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,C(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||C(null)},onDrop:t=>oe(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(z,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(Ht,{item:e,dragging:b===e.id,onOpen:V,onToggleDone:se,onDragStart:ae,onDragEnd:()=>{x(null),C(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ut,{}),(0,J.jsx)(Ut,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),u?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&E?(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,c.length),children:r.loadMore}):null,(0,J.jsx)(qt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:v,error:m,notice:g,t:r,onClose:()=>{k(!1),N(null),F([]),h(null),_(null)},onCreate:H,onSave:(e,t)=>void B(e,t),onStartChat:re,onCreateGoal:ie,onAddAttachments:(e,t)=>void ee(e,t),onRemoveAttachment:(e,t)=>void te(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var Yt=[{id:`overview`,icon:He},{id:`work-items`,icon:me},{id:`sessions`,icon:ie},{id:`goals`,icon:vt},{id:`workflows`,icon:ft},{id:`files`,icon:U},{id:`activity`,icon:ke},{id:`automations`,icon:se},{id:`notes`,icon:ce},{id:`settings`,icon:nt}],Xt=new Set(Yt.map(e=>e.id)),Zt=`xopc.projectFiles.panelWidthPx`,Qt=320,$t=220,en=560;function tn(e){return Math.min(en,Math.max($t,Math.round(e)))}function nn(){try{let e=window.localStorage.getItem(Zt);if(e==null)return Qt;let t=Number.parseInt(e,10);return Number.isFinite(t)?tn(t):Qt}catch{return Qt}}function rn(e){try{window.localStorage.setItem(Zt,String(tn(e)))}catch{}}function an(e){return!!(e&&Xt.has(e))}function on(e){return e===`overview`?`overview`:e===`work-items`||e===`goals`||e===`workflows`||e===`automations`?`work`:`context`}function sn(e){return e===`work`?`work-items`:e===`context`?`files`:`overview`}function cn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function ln(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ae(n)}function un(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 dn(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function fn(e){let t=(0,K.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 pn(e=!1){return s(`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 mn(e){let t=(0,K.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 c=a&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=s(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,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 hn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function gn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function _n(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function vn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function yn(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 bn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function xn(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 Sn(e){let t=e.sourceChannel?.trim();if(t)return Cn(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 Cn(r||``)}function Cn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function wn(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 Tn(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 En(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:En(e.children,t,n)}:e)}function Dn({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,l]=(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,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`new`),[S,w]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(!1),[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(null),F=(0,q.useCallback)(async()=>{h(!0),_(null);try{let t=await Xe({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)(()=>{o&&F()},[F,o]);let L=(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=hn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>gn(t)-gn(e))},[e.id,u,f]),R=e=>t.statuses[e.status]??e.status,z=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,V=e=>{x(e),w(``),D(``),M(null),y(!0),l(!1)},H=(0,q.useCallback)(async(e={})=>{let t=E.trim(),n=S.trim()||(b===`directory`?_n(t):``);if(n){k(!0),M(null),P(null);try{let r=await C({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),D(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=vn(e);t?(P(t),y(!1)):M(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[b,S,a,E]),te=(0,q.useCallback)(e=>{e.preventDefault(),H()},[H]),ne=(0,q.useCallback)(()=>{H({createWorkspaceRoot:!0})},[H]),re=(0,q.useCallback)(()=>{P(null),y(!0)},[]),ie=e=>{D(e),b===`directory`&&!S.trim()&&w(_n(e))},ae=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:s(`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:()=>{l(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(c,{className:s(`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:z(e)})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,un(e.status)),children:R(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Se,{open:o,onOpenChange:l,children:[(0,J.jsx)(Ye,{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:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,un(e.status)),children:R(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:z(e)})]}),(0,J.jsx)(Ce,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(Le,{children:(0,J.jsxs)($e,{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)(xe,{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}),ae(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&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,L.map(e=>ae(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:()=>V(`new`),children:[(0,J.jsx)(ht,{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:()=>V(`directory`),children:[(0,J.jsx)(U,{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:()=>{l(!1),a(`/projects`)},children:[(0,J.jsx)(nt,{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)(B,{open:v,onOpenChange:e=>!O&&y(e),children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:b===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:b===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,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:[j?(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:j}):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:S,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)(xt,{value:E,onChange:ie,disabled:O,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)(ee,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:O,children:n.cancel})}),(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:O||!(S.trim()||b===`directory`&&_n(E)),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(B,{open:!!N,onOpenChange:e=>{e||P(null)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:N?cn(n.workspaceMissingDescription,{workspace:N}):null})]}),N?(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)(U,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:N})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:O,children:n.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:O,children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function On(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),c=d(p(e=>e.language)),f=c.chat.workingDirectory,m=c.projectDetailPage,S=c.projectsPage,C=_(e=>e.setPageHeader),w=_(e=>e.clearPageHeader),[L,z]=(0,q.useState)(null),[V,ye]=(0,q.useState)(null),[W,De]=(0,q.useState)([]),[ke,Ae]=(0,q.useState)(``),[je,Pe]=(0,q.useState)([]),[Fe,Ie]=(0,q.useState)([]),[Be,Ue]=(0,q.useState)([]),[Ge,Xe]=(0,q.useState)([]),[et,nt]=(0,q.useState)([]),[it,at]=(0,q.useState)(!1),[ct,vt]=(0,q.useState)(null),[K,Tt]=(0,q.useState)([]),[Et,Dt]=(0,q.useState)(0),[Ot,kt]=(0,q.useState)(!1),[At,jt]=(0,q.useState)(!1),[Mt,Nt]=(0,q.useState)(!1),[Pt,Ft]=(0,q.useState)([]),It=(0,q.useRef)(new Set),[Lt,Rt]=(0,q.useState)(null),[zt,Bt]=(0,q.useState)(nn),[Vt,Ht]=(0,q.useState)(!1),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(``),[qt,Xt]=(0,q.useState)([]),[Zt,Qt]=(0,q.useState)(!1),[$t,en]=(0,q.useState)(null),[hn,gn]=(0,q.useState)(!1),[_n,Cn]=(0,q.useState)(null),[On,kn]=(0,q.useState)([]),[Y,An]=(0,q.useState)(``),[jn,Mn]=(0,q.useState)(!0),[Nn,Pn]=(0,q.useState)(!1),[Fn,In]=(0,q.useState)(!1),[Ln,Rn]=(0,q.useState)(null),[zn,Bn]=(0,q.useState)(!1),[X,Vn]=(0,q.useState)(`fixed`),[Hn,Un]=(0,q.useState)(``),[Wn,Gn]=(0,q.useState)(null),[Kn,qn]=(0,q.useState)(!1),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(0),[Qn,$n]=(0,q.useState)(!1),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[Q,pr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),mr=`overview`,$=n?`notes`:an(t)?t:mr,hr=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),gr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),_r=(0,q.useCallback)(e=>{let t=gr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[gr]),vr=(0,q.useCallback)(t=>{e&&r(gr(t),{replace:!0})},[r,e,gr]),yr=(0,q.useCallback)((e,t)=>{vr(e),r(t)},[r,vr]),br=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||vr(e)},[vr]),xr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||an(t)||r(`/projects/${encodeURIComponent(e)}/${mr}`,{replace:!0})},[mr,r,e,t]),(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Mn(!0),Z(null),Promise.all([D(e),N(e),fe(e),M().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;z(a),ye(e),De(n),Pe(r),kn(i?.agents??[]),An(a.defaultAgentId??``),pr({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Mn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([M(),rt(),qe()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=L?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?St(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[L?.defaultAgentId,Y]);let Sr=(0,q.useCallback)(async()=>{if(L){$n(!0),Z(null);try{let[e,t]=await Promise.all([gt(),mt(100,{ownerAgentId:Y||void 0,projectId:L.id})]);Ie(e),Ue(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(!1)}}},[L,Y]);(0,q.useEffect)(()=>{L&&Sr()},[L,Sr]);let Cr=(0,q.useCallback)(async()=>{if(L){at(!0),Z(null);try{let[e,t]=await Promise.all([dt.list({projectId:L.id}),dt.runs(50,void 0,{projectId:L.id})]);Xe(e.automations),nt(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{at(!1)}}},[L]);(0,q.useEffect)(()=>{$===`automations`&&Cr()},[Cr,$]);let wr=(0,q.useCallback)(async()=>{if(L){kt(!0),Z(null);try{let e=await O(L.id,{includeRelated:At,limit:100});Tt(e.items),Dt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{kt(!1)}}},[L,At]);(0,q.useEffect)(()=>{$===`activity`&&wr()},[wr,$]);let Tr=(0,q.useCallback)(async e=>{vt(`run:${e.id}`),Z(null);try{await dt.runNow(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{vt(null)}},[Cr]),Er=(0,q.useCallback)(async e=>{vt(`toggle:${e.id}`),Z(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{vt(null)}},[Cr]),Dr=(0,q.useCallback)(async()=>{if(!L?.effectiveWorkspaceRoot?.trim()){Ft([]),It.current.clear(),Cn(null);return}gn(!0),Cn(null),It.current.clear();try{Ft(Tn((await le(L.id,``)).entries)),It.current.add(``)}catch(e){Ft([]),It.current.clear(),Cn(e instanceof Error?e.message:String(e))}finally{gn(!1)}},[L]),Or=(0,q.useCallback)(async e=>{if(!(!L?.effectiveWorkspaceRoot?.trim()||It.current.has(e))){It.current.add(e),Cn(null);try{let t=await le(L.id,e);Ft(n=>En(n,e,Tn(t.entries)))}catch(t){It.current.delete(e),Cn(t instanceof Error?t.message:String(t))}}},[L]);(0,q.useEffect)(()=>{$===`files`&&Dr()},[Dr,$]);let kr=Gt.trim();(0,q.useEffect)(()=>{if($!==`files`||!L||!Ut||!kr){Xt([]),Qt(!1),en(null);return}let e=!1;Qt(!0),en(null),Xt([]);let t=window.setTimeout(()=>{_e(L.id,kr,50).then(t=>{e||Xt(t)}).catch(t=>{e||en(t instanceof Error?t.message:String(t))}).finally(()=>{e||Qt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[kr,L,Ut,$]);let Ar=(0,q.useCallback)(async()=>{if(L){Yn(!0),Z(null);try{let e=await re(L.id);yr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[yr,L]),jr=(0,q.useCallback)(()=>{hr(`work-items`),Zn(e=>e+1)},[hr]),Mr=(0,q.useCallback)(async()=>{if(!L)return;let[e,t]=await Promise.all([D(L.id),fe(L.id)]);ye(e),z(e.project),Pe(t)},[L]),Nr=(0,q.useCallback)(async e=>{if(!L||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await F(L.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:Ct(e.evidencePlan),criteria:Ct(e.checklist)}}),sr(!1),hr(`goals`),await Mr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[hr,L,Mr]),Pr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!L||!dr.title.trim())){ar(!0),Z(null);try{await k(L.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Mr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,L,Mr]),Fr=(0,q.useCallback)(async e=>{if(L){tr(`retry:${e.id}`),Z(null);try{let t=await ut(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||L.id});await Sr(),yr(`workflows`,ne(t.runId,{ownerAgentId:Y||e.metadata?.agentId||L.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}}},[yr,L,Sr,Y]),Ir=(0,q.useCallback)(async e=>{tr(`cancel:${e.id}`),Z(null);try{await Ne(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await Sr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}},[Sr,Y]),Lr=(0,q.useMemo)(()=>(0,J.jsx)(a,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.backToProjects,children:(0,J.jsx)(we,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Rr=(0,q.useMemo)(()=>L?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jr,children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(G,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Ar(),disabled:Jn,children:[(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[jr,m.common.newChat,m.workItems.create.header,L,Ar,Jn]);(0,q.useLayoutEffect)(()=>(C({startExtra:Lr,main:L?(0,J.jsx)(Dn,{currentProject:L,pm:m,projectsText:S,wd:f}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:m.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:m.fallbackContext})]}),end:Rr}),()=>w()),[w,Rr,Lr,m,L,S,C,f]);function zr(e){z(t=>t?{...t,...e}:null),ye(t=>t?{...t,project:{...t.project,...e}}:null),An(e.defaultAgentId??``),pr(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Br(){if(!(!L||!Q.name.trim())){Pn(!0),Z(null),Rn(null);try{zr(await h(L.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=vn(e);t?Rn(t):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}function Vr(e){e.preventDefault(),Br()}let Hr=(0,q.useCallback)(()=>{if(!L)return;let e=L.workspaceRoot?.trim()??``;Vn(e?`fixed`:`follow`),Un(e||L.effectiveWorkspaceRoot||``),Bn(!0)},[L]);async function Ur(e={}){if(!L)return;let t=X===`fixed`?Hn.trim():``;if(!(X===`fixed`&&!t)){Pn(!0),Z(null),Rn(null);try{zr(await h(L.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Bn(!1),Rn(null)}catch(e){let t=vn(e);t?(Rn(t),Bn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}async function Wr(){if(!(!L||Wn)){Gn(`pin`),Z(null);try{zr(L.pinnedAt?await te(L.id):await j(L.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Gr(){if(!(!L||Wn)){Gn(`archive`),Z(null);try{zr(L.status===`archived`?await he(L.id):await H(L.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Kr(){if(L){qn(!0),Z(null);try{await g(L.id),In(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qn(!1)}}}async function qr(){if(!(!L||Mt)){Nt(!0),Z(null);try{await pe(L.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nt(!1)}}}let Jr=(0,q.useCallback)(e=>{Rt(e)},[]),Yr=(0,q.useCallback)((e,t)=>{t||Rt(e)},[]),Xr=(0,q.useCallback)(async(e,t,n)=>{let r=L?.id;if(r)switch(e){case`preview`:t.isDirectory||Rt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Ze(t.path);if(be(Ve(e))!==`text`){let n=await Te(t.path,{projectId:r}),i=Qe(e)??`application/octet-stream`;Ke(e,await n.arrayBuffer(),i)}else{let{content:n}=await Re(t.path,{projectId:r});tt(e,n)}}catch(e){Me(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&Me(`success`,c.workspace.pathCopied,void 0,{duration:2500})}catch{Me(`warning`,c.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}},[c.clipboard.copyFailed,c.workspace.pathCopied,L?.id]),Zr=(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),Ht(!0);let r=e.clientX,i=zt,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=tn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ht(!1),Bt(c),rn(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)},[zt]);if((0,q.useEffect)(()=>{$!==`files`&&Rt(null)},[e,$]),jn)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:m.loading});if(!L)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)(a,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(we,{className:`size-4`,"aria-hidden":!0}),m.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:cr||m.notFound})]});let Qr=V?.recentSessions.length?V.recentSessions:L.recentSessions,$r=V?.attentionItems??[],ei=e=>m.statuses[e]??e,ti=e=>cn(m.common.messages,{count:e}),ni=ke.trim().toLowerCase(),ri=ni?W.filter(e=>{let t=ln(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=ti(e.messageCount??0),a=Sn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(ni)}):W,ii=W.length>0&&ri.length===0,ai=On.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,oi=On.find(e=>e.id===Q.defaultAgentId),si=L.workspaceRoot?.trim()||``,ci=L.status===`archived`,li=!!L.pinnedAt,ui=!si,di=si||oi?.workspace||L.effectiveWorkspaceRoot||m.common.defaultWorkspace,fi=X===`fixed`?Hn.trim()||m.settings.workspacePlaceholder:oi?.workspace||L.effectiveWorkspaceRoot||m.common.defaultWorkspace,pi=(X===`fixed`?Hn.trim():``)!==si&&(X===`follow`||!!Hn.trim()),mi=[{id:`overview`,icon:He,label:m.surfaceTabs.overview},{id:`work`,icon:me,label:m.surfaceTabs.work},{id:`context`,icon:U,label:m.surfaceTabs.context}],hi=Yt.filter(e=>e.id!==`overview`&&e.id!==`work-items`&&e.id!==`files`);async function gi(){if(!di)return;let e=await u(di);Me(e?`success`:`warning`,e?c.workspace.pathCopied:c.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function _i(){Rn(null),Bn(!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)(bt,{items:mi,activeTab:on($),onChange:e=>hr(sn(e)),ariaLabel:m.navAria,tabIdPrefix:`project-surface-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(Se,{children:[(0,J.jsx)(Ye,{asChild:!0,children:(0,J.jsxs)(G,{type:`button`,variant:hi.some(e=>e.id===$)?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,children:[m.surfaceTabs.details,(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(Le,{children:(0,J.jsx)($e,{align:`end`,sideOffset:6,className:`z-[70] w-48 rounded-xl border border-edge bg-surface-panel p-1.5 shadow-float`,children:hi.map(e=>{let t=e.icon,n=e.id===`work-items`?m.workItems.tab:m.tabs[e.id];return(0,J.jsx)(We,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-surface-hover`,$===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted`),onClick:()=>hr(e.id),children:[(0,J.jsx)(t,{className:`size-4`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:n})]})},e.id)})})})]})]}),cr?(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:cr}):null,(0,J.jsxs)(`div`,{className:s(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-surface-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:m.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:V?.digest?.summary||V?.recommendedAction||L.description||L.brief||m.overview.directionFallback}),V?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:cn(m.overview.recommendedNext,{action:V.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,onClick:()=>void qr(),disabled:Mt,children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),Mt?m.overview.savingDigest:m.overview.saveDigest]})})]})}),(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.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.nextActions}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:V?.nextActions.length?V.nextActions.map(e=>(0,J.jsxs)(a,{to:_r(e.goalId),onClick:br(`goals`),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.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noNextActions})})]})]}),(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:m.overview.attention}),$r.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:$r.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)(l,{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:[m.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${ei(e.status)}`:``]})]});return e.href?(0,J.jsx)(a,{to:e.href,onClick:br(xr(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:m.overview.noBlockedGoals}),(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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(G,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?m.overview.addingBlocker:m.overview.addBlocker,title:ir?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(ht,{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)(ue,{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:m.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>hr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Qr.length?Qr.map(e=>(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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:ln(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||m.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.surfaceTabs.workHint}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[`goals`,`workflows`,`automations`].map(e=>(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(Jt,{projectId:L.id,createRequestKey:Xn})})]}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.workflows.runsHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Sr(),disabled:Qn,children:[(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Qn&&Be.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Be.length?Be.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center 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:()=>yr(`workflows`,ne(e.id,{ownerAgentId:Y||e.metadata?.agentId||L.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(e.status)),children:ei(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:cn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:ln(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>yr(`workflows`,ne(e.id,{ownerAgentId:Y||e.metadata?.agentId||L.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`retry:${e.id}`,onClick:()=>void Fr(e),children:[(0,J.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`cancel:${e.id}`,onClick:()=>void Ir(e),children:[(0,J.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),m.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:Fe.length?Fe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>r(`/workflows/${e.id}?projectId=${encodeURIComponent(L.id)}${Y?`&agentId=${encodeURIComponent(Y)}`:``}`),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(ft,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:m.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Cr(),disabled:it,children:[(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(L.id)}&action=create`),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:it&&Ge.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Ge.length?Ge.map(e=>{let t=et.find(t=>t.automationId===e.id),n=e.state.runningRunId?et.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center 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:()=>yr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:s(`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?m.automations.enabled:m.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:cn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?ln(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:ct===`run:${e.id}`||!!n,onClick:()=>void Tr(e),children:[(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:ct===`toggle:${e.id}`,onClick:()=>void Er(e),children:[e.enabled?(0,J.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?m.automations.pause:m.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(L.id)}&action=create`),children:[(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0}),m.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,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:m.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:et.length?et.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:ln(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:L.workspaceRoot||L.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(yt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(L.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${L.id}`,captureTags:[`project:${L.id}`,L.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${L.id}`})}):null,$===`files`?(0,J.jsxs)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.surfaceTabs.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:L.brief||L.instructions||L.description||m.surfaceTabs.contextFallback})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[`sessions`,`notes`,`settings`].map(e=>(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:L.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:s(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Vt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${zt}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)(R,{workspacePath:di}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:s(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ut&&`bg-surface-hover text-fg`),onClick:()=>Wt(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Ut,children:(0,J.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(Oe,{className:`size-7 shrink-0 rounded-md p-0`,loading:hn,label:c.cron.refresh,onClick:()=>void Dr()})]})]}),Ut?(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)(xe,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Gt,onChange:e=>Kt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.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":m.files.clearSearch,title:m.files.clearSearch,onClick:()=>{Kt(``),Wt(!1)},children:(0,J.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,_n?(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:_n}):null,kr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Zt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(ze,{className:`h-11 w-full`}),(0,J.jsx)(ze,{className:`h-11 w-full`}),(0,J.jsx)(ze,{className:`h-11 w-full`})]}):$t?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[c.workspace.loadError,`: `,$t]}):qt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):qt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Lt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Rt(e.path),title:e.path,children:[(0,J.jsx)(ce,{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))}):hn&&Pt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(ot,{tree:Pt,selectedPath:Lt,onSelectFile:Jr,onSelectEntry:Yr,onExpandDir:e=>void Or(e),onAction:Xr,actionLabels:{preview:c.workspace.preview,download:c.workspace.download,copyPath:c.workspace.copyPath,openDefault:c.workspace.openSystemApp,openWith:c.workspace.openWith,revealInFolder:c.workspace.revealInFolder,recommendedApps:c.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:s(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Vt&&`bg-surface-hover`),onPointerDown:Zr,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:Lt?(0,J.jsx)(Je,{filePath:Lt,projectId:L.id,onClose:()=>Rt(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)(U,{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:m.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.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:m.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>hr(`settings`),children:m.files.openSettings})})]})})]}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`grid min-h-full content-start gap-3`,children:[W.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)(xe,{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:ke,onChange:e=>Ae(e.currentTarget.value),placeholder:m.sessions.searchPlaceholder,"aria-label":m.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`}),ke?(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":m.sessions.clearSearch,onClick:()=>Ae(``),children:(0,J.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ri.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ri.map(e=>{let t=ln(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=Sn(e),i=e.name?.trim()||m.sessions.fallbackTitle,o=ti(e.messageCount??0);return(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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)(ie,{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:[m.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:o})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ii?(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:m.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:m.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:m.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.goals.title})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:je.length?je.map(e=>(0,J.jsxs)(a,{to:_r(e.id),onClick:br(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex 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.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||m.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:m.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,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:m.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:cn(m.activity.count,{count:Et})})]}),(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:At,onChange:e=>jt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void wr(),disabled:Ot,children:[(0,J.jsx)(st,{className:s(`size-4`,Ot&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Ot&&K.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):K.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:K.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=wn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===L.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:m.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,bn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:ln(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:[m.activity.actor,`: `,yn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,xn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,onSubmit:Vr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.contextHint})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(Q.status)),children:m.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(mn,{label:m.settings.workspaceRoot,value:di,mono:!0}),(0,J.jsx)(mn,{label:m.settings.defaultAgent,value:ai}),(0,J.jsx)(mn,{label:m.settings.pinState,value:li?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(mn,{label:m.settings.createdAt,value:ln(L.createdAt)||m.common.never}),(0,J.jsx)(mn,{label:m.settings.updatedAt,value:ln(L.updatedAt)||m.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(fn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:pn(),value:Q.name,onChange:e=>pr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(fn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(ge,{className:pn(),value:Q.defaultAgentId,onChange:e=>pr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(ve,{value:``,children:m.settings.globalDefaultAgent}),On.map(e=>(0,J.jsx)(ve,{value:e.id,children:de(e,c.agentsSettings)},e.id))]})}),(0,J.jsx)(fn,{label:m.settings.status,children:ci?(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:m.settings.statuses.archived}):(0,J.jsxs)(ge,{className:pn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>pr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(ve,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(ve,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(fn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:pn(!0),value:Q.description,onChange:e=>pr(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:ui?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:di,children:di})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void gi(),children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(R,{workspacePath:di}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Hr,children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),m.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationHint})]})]})}),(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:m.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.agentContextHint})]}),(0,J.jsx)(fn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:pn(!0),value:Q.brief,onChange:e=>pr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(fn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:pn(!0),value:Q.instructions,onChange:e=>pr(t=>({...t,instructions: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:m.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,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:li?m.settings.pinnedTitle:m.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:m.settings.pinHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`pin`,onClick:()=>void Wr(),children:[li?(0,J.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(lt,{className:`size-4`,"aria-hidden":!0}),li?m.settings.unpinProject:m.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:ci?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ci?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(G,{type:`button`,variant:ci?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`archive`,onClick:()=>void Gr(),children:[ci?(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(b,{className:`size-4`,"aria-hidden":!0}),ci?m.settings.restoreProject:m.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:m.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:m.settings.dangerHint})]}),(0,J.jsxs)(G,{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:()=>In(!0),children:[(0,J.jsx)(E,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(G,{type:`submit`,variant:`primary`,disabled:Nn||!Q.name.trim(),children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(B,{open:Fn,onOpenChange:e=>{Kn||In(e)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(l,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(_t,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:L?cn(m.settings.deleteConfirm,{name:L.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Kn,children:m.common.cancel})}),(0,J.jsxs)(G,{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:Kn||!L,onClick:()=>void Kr(),children:[(0,J.jsx)(E,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(B,{open:zn,onOpenChange:e=>{Nn||Bn(e)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.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:m.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:s(`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:()=>Vn(`fixed`),disabled:Nn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:s(`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:()=>Vn(`follow`),disabled:Nn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(xt,{value:Hn,onChange:Un,disabled:Nn,wd:f,placeholder:m.settings.workspacePlaceholder,inputClassName:pn(),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:m.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:cn(m.settings.workspaceCurrent,{workspace:fi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Nn,children:m.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Nn||!pi,onClick:()=>void Ur(),children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(B,{open:!!Ln,onOpenChange:e=>{e||Rn(null)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ln?cn(m.settings.workspaceMissingDescription,{workspace:Ln}):null})]}),Ln?(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)(U,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Ln})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:_i,disabled:Nn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Ur({createWorkspaceRoot:!0}),disabled:Nn,children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(wt,{open:or,t:c.goalsPage,chat:c.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Nr})]})}export{On 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{l as i,t as a,u as o}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./check-BODqo66o.js";import{t as l}from"./circle-alert-RzVebuX2.js";import{t as u}from"./copy-to-clipboard-HOJ79TWv.js";import{t as d}from"./messages--cnUi8Ld.js";import{l as f,n as p,o as m}from"./locale-store-CQDaFvDN.js";import{$a as h,Ba as g,Bo as _,Cc as v,Cs as y,Cu as b,Dc as x,El as S,Fa as C,Fl as w,Fo as T,Fs as E,Ga as D,Ha as O,Ia as k,Io as A,Ja as j,Jr as M,Ka as N,Ks as P,La as F,Lo as I,Ml as L,Ni as R,Nl as z,No as B,Oc as V,Pa as H,Po as ee,Qa as te,R as ne,Ra as re,Rc as ie,Rl as ae,Ro as oe,Ss as se,Tl as ce,Ua as le,Ul as ue,Vr as de,Wa as fe,Xa as pe,Xc as me,Ya as he,Yo as ge,Za as _e,Zo as ve,a as ye,aa as be,ac as xe,as as Se,au as Ce,bl as U,bu as we,c as W,ca as Te,cc as Ee,d as De,da as Oe,dl as ke,et as Ae,f as je,fa as Me,ft as Ne,h as Pe,i as Fe,ia as Ie,is as Le,la as Re,lo as ze,m as Be,na as Ve,nl as He,no as Ue,ns as We,o as Ge,oa as Ke,oo as qe,or as Je,os as Ye,qa as Xe,ra as Ze,ro as Qe,rs as $e,s as et,sa as tt,tc as nt,tr as rt,tu as it,u as at,ua as ot,uc as st,ut as ct,wc as lt,wt as ut,x as dt,xc as ft,xl as pt,xt as mt,yc as ht,ys as G,yt as gt,zo as _t,zs as vt}from"./index-B5cSZcER.js";import{t as yt}from"./notes-workbench-B7NIQBqd.js";import{t as bt}from"./page-tabs-Dl9G6Pm3.js";import{t as xt}from"./directory-picker-path-field-DyZJo5xz.js";import{t as St}from"./goals-config-api-CYNvVerg.js";import{n as Ct,t as wt}from"./goal-create-dialog-BStw0m9M.js";var K=n(),q=e(t(),1),J=r(),Tt=`application/x-xopc-work-item`,Et=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Dt=[`low`,`normal`,`high`,`urgent`];function Ot(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function kt(e){return e?Ae(new Date(e)):``}function At(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function jt(e){return`${e.name}:${e.size}:${e.lastModified}`}function Mt(e,t){return Ve(e,t)!==`unsupported`}function Nt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Pt(e,t){return{id:e.id,name:e.fileName,type:Nt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Ft(e,t){let n=Ie(e.name||`upload`,e.type||`application/octet-stream`),r=Ue(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Nt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function It(e){let t=(0,K.c)(3),[n,r]=(0,q.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,q.useEffect)(i,a),n}function Lt(e,t){let n=(0,K.c)(5),[r,i]=(0,q.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await m(Pe(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,q.useEffect)(a,o),r}function Rt(e){let t=(0,K.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(S,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function zt(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function Bt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Vt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Ht(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:i,onToggleDone:o,onDragStart:c,onDragEnd:l,t:u}=e,d=n.status===`done`,f;t[0]!==n||t[1]!==c?(f=e=>c(n,e),t[0]=n,t[1]=c,t[2]=f):f=t[2];let p=u.dragToUpdate,m=r&&`opacity-50`,h;t[3]===m?h=t[4]:(h=s(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,m),t[3]=m,t[4]=h);let g=d?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=s(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=d?u.markTodo:u.markDone,y=d?u.markTodo:u.markDone,b;t[7]!==n||t[8]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===d?x=t[11]:(x=d?(0,J.jsx)(it,{className:`size-3`,"aria-hidden":!0}):null,t[10]=d,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==i?(C=()=>i(n),t[18]=n,t[19]=i,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==u?(T=Vt(n,u),t[23]=n,t[24]=u,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ot(n.status)),t[35]=n.status,t[36]=k);let A=u.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=u.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(V,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,R;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(L,{className:`size-3`,"aria-hidden":!0}),t[46]=R):R=t[46];let z;t[47]!==u.detail.openItem||t[48]!==I?(z=(0,J.jsxs)(a,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[u.detail.openItem,R]}),t[47]=u.detail.openItem,t[48]=I,t[49]=z):z=t[49];let B;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==z?(B=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,z]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=z,t[55]=B):B=t[55];let H;return t[56]!==l||t[57]!==u.dragToUpdate||t[58]!==f||t[59]!==O||t[60]!==B||t[61]!==h?(H=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:f,onDragEnd:l,title:p,className:h,children:[O,B]}),t[56]=l,t[57]=u.dragToUpdate,t[58]=f,t[59]=O,t[60]=B,t[61]=h,t[62]=H):H=t[62],H}function Ut(){let e=(0,K.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function Wt(e){let t=(0,K.c)(44),{file:n,index:r,busy:i,previewBusy:a,t:o,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=Ie(n.name||`upload`,n.type||`application/octet-stream`),d=Mt(n.name||`upload`,u),f=It,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),h=n.name||`upload`,g=i||a,_;t[5]!==n||t[6]!==c?(_=()=>c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==m?(v=(0,J.jsx)(Rt,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:_}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=_,t[13]=m,t[14]=v):v=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=s(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||i||a,C;t[17]!==n||t[18]!==c?(C=()=>c(n),t[17]=n,t[18]=c,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=At(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==o.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:k,children:A}),t[36]=i,t[37]=o.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==v?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[v,O,j]}),t[40]=O,t[41]=j,t[42]=v,t[43]=M):M=t[43],M}function Gt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:i,previewBusy:a,t:o,onOpen:c,onDownload:l,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=Mt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=Lt(n.id,r),m=i||a,h;t[3]!==r||t[4]!==n||t[5]!==c?(h=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=h):h=t[6];let g;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==f||t[10]!==m||t[11]!==h||t[12]!==p?(g=(0,J.jsx)(Rt,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:p,previewable:f,disabled:m,onOpen:h}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=f,t[10]=m,t[11]=h,t[12]=p,t[13]=g):g=t[13];let _=f?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,v;t[14]===_?v=t[15]:(v=s(`min-w-0 flex-1 text-left`,_),t[14]=_,t[15]=v);let y=!f||i||a,b;t[16]!==r||t[17]!==n||t[18]!==c?(b=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,t[19]=b):b=t[19];let x;t[20]===r.fileName?x=t[21]:(x=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=x);let S=r.mimeType,C;t[22]===r.size?C=t[23]:(C=At(r.size),t[22]=r.size,t[23]=C);let T;t[24]!==r.mimeType||t[25]!==C?(T=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[S,` · `,C]}),t[24]=r.mimeType,t[25]=C,t[26]=T):T=t[26];let D;t[27]!==T||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(D=(0,J.jsxs)(`button`,{type:`button`,className:v,disabled:y,onClick:b,children:[x,T]}),t[27]=T,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=D):D=t[32];let O;t[33]!==r||t[34]!==n||t[35]!==l?(O=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,J.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),t[37]=k):k=t[37];let A;t[38]!==i||t[39]!==o.attachments.download||t[40]!==O?(A=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:o.attachments.download,"aria-label":o.attachments.download,disabled:i,onClick:O,children:k}),t[38]=i,t[39]=o.attachments.download,t[40]=O,t[41]=A):A=t[41];let j;t[42]!==r||t[43]!==n||t[44]!==u?(j=()=>u(n,r),t[42]=r,t[43]=n,t[44]=u,t[45]=j):j=t[45];let M;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),t[46]=M):M=t[46];let N;t[47]!==i||t[48]!==o.attachments.remove||t[49]!==j?(N=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:o.attachments.remove,"aria-label":o.attachments.remove,disabled:i,onClick:j,children:M}),t[47]=i,t[48]=o.attachments.remove,t[49]=j,t[50]=N):N=t[50];let P;return t[51]!==D||t[52]!==A||t[53]!==N||t[54]!==g?(P=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel p-2 text-sm`,children:[g,D,A,N]}),t[51]=D,t[52]=A,t[53]=N,t[54]=g,t[55]=P):P=t[55],P}function Kt({mode:e,item:t,pendingFiles:n,busy:r,t:i,onPendingFilesChange:a,onUpload:o,onRemove:c,onDownload:l,onPreviewError:u}){let d=(0,q.useRef)(null),[p,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=f(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){o(t,r);return}let i=new Set(n.map(jt)),s=[...n];for(let e of r){let t=jt(e);i.has(t)||(i.add(t),s.push(e))}a(s)}function T(e){a(n.filter((t,n)=>n!==e))}async function E(e){let t=jt(e);x(`pending:${t}`);try{y(await Ft(e,`pending:${t}`)),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await m(Pe(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Pt(t,Ue(await n.arrayBuffer()))),_(!0)}catch(e){u(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:s(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,p&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),w(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(V,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:i.attachments.title})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>d.current?.click(),children:[(0,J.jsx)(ht,{className:`size-3.5`,"aria-hidden":!0}),i.attachments.add]}),(0,J.jsx)(`input`,{ref:d,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(Wt,{file:e,index:t,busy:r,previewBusy:b===`pending:${jt(e)}`,t:i,onOpen:e=>void E(e),onRemove:T},jt(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Gt,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:i,onOpen:(e,t)=>void D(e,t),onDownload:l,onRemove:c},e.id))}):null,!n.length&&!C.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.attachments.empty}):null]}),(0,J.jsx)(ct,{open:g,attachment:v,authToken:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function qt(e){let t=(0,K.c)(169),{mode:n,item:r,initialStatus:i,events:o,busy:c,error:l,notice:u,t:d,onClose:f,onCreate:p,onSave:m,onStartChat:h,onCreateGoal:g,onAddAttachments:_,onRemoveAttachment:v,onDownloadAttachment:b,onPreviewError:x}=e,S=n!==null,[C,w]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(`todo`),[j,M]=(0,q.useState)(`normal`),[N,P]=(0,q.useState)(``),[F,R]=(0,q.useState)(``),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[0]=z):z=t[0];let[V,H]=(0,q.useState)(z),te,ne;t[1]!==i||t[2]!==r||t[3]!==n?(te=()=>{if(n===`create`){w(``),D(``),k(i),M(`normal`),P(``),R(``),H([]);return}n===`detail`&&r&&(w(r.title),D(r.description??``),k(r.status),M(r.priority),P(r.nextAction??``),R(r.blockedReason??``),H([]))},ne=[i,r,n],t[1]=i,t[2]=r,t[3]=n,t[4]=te,t[5]=ne):(te=t[4],ne=t[5]),(0,q.useEffect)(te,ne);let re;t[6]!==F||t[7]!==E||t[8]!==r||t[9]!==n||t[10]!==N||t[11]!==p||t[12]!==m||t[13]!==V||t[14]!==j||t[15]!==O||t[16]!==C?(re=function(e){e.preventDefault();let t=C.trim();if(t){if(n===`create`){p({title:t,description:E.trim()||void 0,priority:j,status:O,nextAction:N.trim()||void 0,blockedReason:F.trim()||void 0,attachments:V});return}r&&m(r,{title:t,description:E.trim()||null,status:O,priority:j,nextAction:N.trim()||null,blockedReason:F.trim()||null})}},t[6]=F,t[7]=E,t[8]=r,t[9]=n,t[10]=N,t[11]=p,t[12]=m,t[13]=V,t[14]=j,t[15]=O,t[16]=C,t[17]=re):re=t[17];let ae=re,se;t[18]===f?se=t[19]:(se=e=>!e&&f(),t[18]=f,t[19]=se);let ce;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ce):ce=t[20];let le=n===`create`?d.create.title:r?.title||d.title,ue;t[21]===le?ue=t[22]:(ue=(0,J.jsx)(_t,{className:`truncate text-base font-semibold text-fg`,children:le}),t[21]=le,t[22]=ue);let de;t[23]===d.detail.description?de=t[24]:(de=(0,J.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:d.detail.description}),t[23]=d.detail.description,t[24]=de);let fe;t[25]!==ue||t[26]!==de?(fe=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[ue,de]}),t[25]=ue,t[26]=de,t[27]=fe):fe=t[27];let pe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,J.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[28]=pe):pe=t[28];let me;t[29]===c?me=t[30]:(me=(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:c,children:pe})}),t[29]=c,t[30]=me);let he;t[31]!==fe||t[32]!==me?(he=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[fe,me]}),t[31]=fe,t[32]=me,t[33]=he):he=t[33];let _e;t[34]===l?_e=t[35]:(_e=l?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:l}):null,t[34]=l,t[35]=_e);let ye;t[36]!==l||t[37]!==u?(ye=!l&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(it,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=l,t[37]=u,t[38]=ye):ye=t[38];let be;t[39]===d.create.titleLabel?be=t[40]:(be=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.titleLabel}),t[39]=d.create.titleLabel,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>w(e.target.value),t[41]=xe):xe=t[41];let Se;t[42]===C?Se=t[43]:(Se=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:C,onChange:xe}),t[42]=C,t[43]=Se);let Ce;t[44]!==be||t[45]!==Se?(Ce=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[be,Se]}),t[44]=be,t[45]=Se,t[46]=Ce):Ce=t[46];let U;t[47]===d.detail.status?U=t[48]:(U=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.detail.status}),t[47]=d.detail.status,t[48]=U);let we;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(we=e=>k(e.target.value),t[49]=we):we=t[49];let W;t[50]===d.statuses?W=t[51]:(W=Et.map(e=>(0,J.jsx)(ve,{value:e,children:d.statuses[e]},e)),t[50]=d.statuses,t[51]=W);let Te;t[52]!==O||t[53]!==W?(Te=(0,J.jsx)(ge,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:O,onChange:we,children:W}),t[52]=O,t[53]=W,t[54]=Te):Te=t[54];let Ee;t[55]!==U||t[56]!==Te?(Ee=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[U,Te]}),t[55]=U,t[56]=Te,t[57]=Ee):Ee=t[57];let De;t[58]===d.create.priorityLabel?De=t[59]:(De=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.priorityLabel}),t[58]=d.create.priorityLabel,t[59]=De);let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>M(e.target.value),t[60]=Oe):Oe=t[60];let ke;t[61]===d.priorities?ke=t[62]:(ke=Dt.map(e=>(0,J.jsx)(ve,{value:e,children:d.priorities[e]},e)),t[61]=d.priorities,t[62]=ke);let Ae;t[63]!==j||t[64]!==ke?(Ae=(0,J.jsx)(ge,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Oe,children:ke}),t[63]=j,t[64]=ke,t[65]=Ae):Ae=t[65];let je;t[66]!==De||t[67]!==Ae?(je=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[De,Ae]}),t[66]=De,t[67]=Ae,t[68]=je):je=t[68];let Me;t[69]!==Ee||t[70]!==je?(Me=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Ee,je]}),t[69]=Ee,t[70]=je,t[71]=Me):Me=t[71];let Ne;t[72]===d.create.descriptionLabel?Ne=t[73]:(Ne=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.create.descriptionLabel}),t[72]=d.create.descriptionLabel,t[73]=Ne);let Pe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>D(e.target.value),t[74]=Pe):Pe=t[74];let Fe;t[75]===E?Fe=t[76]:(Fe=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:E,onChange:Pe}),t[75]=E,t[76]=Fe);let Ie;t[77]!==Ne||t[78]!==Fe?(Ie=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ne,Fe]}),t[77]=Ne,t[78]=Fe,t[79]=Ie):Ie=t[79];let Le;t[80]!==c||t[81]!==r||t[82]!==n||t[83]!==_||t[84]!==b||t[85]!==x||t[86]!==v||t[87]!==V||t[88]!==d?(Le=(0,J.jsx)(Kt,{mode:n,item:r,pendingFiles:V,busy:c,t:d,onPendingFilesChange:H,onUpload:_,onRemove:v,onDownload:b,onPreviewError:x}),t[80]=c,t[81]=r,t[82]=n,t[83]=_,t[84]=b,t[85]=x,t[86]=v,t[87]=V,t[88]=d,t[89]=Le):Le=t[89];let Re;t[90]!==F||t[91]!==n||t[92]!==N||t[93]!==O||t[94]!==d.blockedReason||t[95]!==d.nextAction?(Re=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:d.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:N,onChange:e=>P(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:s(`font-medium`,O===`blocked`||O===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:d.blockedReason}),(0,J.jsx)(`textarea`,{className:s(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,O===`blocked`||O===`needs_input`?`border-red-500/40`:`border-edge`),value:F,onChange:e=>R(e.target.value)})]})]}):null,t[90]=F,t[91]=n,t[92]=N,t[93]=O,t[94]=d.blockedReason,t[95]=d.nextAction,t[96]=Re):Re=t[96];let ze;t[97]!==_e||t[98]!==ye||t[99]!==Ce||t[100]!==Me||t[101]!==Ie||t[102]!==Le||t[103]!==Re?(ze=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[_e,ye,Ce,Me,Ie,Le,Re]}),t[97]=_e,t[98]=ye,t[99]=Ce,t[100]=Me,t[101]=Ie,t[102]=Le,t[103]=Re,t[104]=ze):ze=t[104];let Be;t[105]!==c||t[106]!==r||t[107]!==n||t[108]!==g||t[109]!==h||t[110]!==d.detail.actions||t[111]!==d.detail.createGoal||t[112]!==d.detail.openItem||t[113]!==d.detail.startChat?(Be=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>h(r),children:[(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),d.detail.startChat]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:c,onClick:()=>g(r),children:[(0,J.jsx)(vt,{className:`size-4`,"aria-hidden":!0}),d.detail.createGoal]}),(0,J.jsx)(G,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(a,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(L,{className:`size-4`,"aria-hidden":!0}),d.detail.openItem]})})]})]}):null,t[105]=c,t[106]=r,t[107]=n,t[108]=g,t[109]=h,t[110]=d.detail.actions,t[111]=d.detail.createGoal,t[112]=d.detail.openItem,t[113]=d.detail.startChat,t[114]=Be):Be=t[114];let Ve;t[115]===d.detail.links?Ve=t[116]:(Ve=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.links}),t[115]=d.detail.links,t[116]=Ve);let He;t[117]!==r||t[118]!==d.detail.noLinks||t[119]!==d.linkKinds?(He=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(a,{to:zt(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[d.linkKinds[e.kind],(0,J.jsx)(L,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noLinks}),t[117]=r,t[118]=d.detail.noLinks,t[119]=d.linkKinds,t[120]=He):He=t[120];let Ue;t[121]===He?Ue=t[122]:(Ue=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:He}),t[121]=He,t[122]=Ue);let We;t[123]!==Ve||t[124]!==Ue?(We=(0,J.jsxs)(`section`,{children:[Ve,Ue]}),t[123]=Ve,t[124]=Ue,t[125]=We):We=t[125];let Ge;t[126]===d.detail.activity?Ge=t[127]:(Ge=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.detail.activity}),t[126]=d.detail.activity,t[127]=Ge);let Ke;t[128]!==o||t[129]!==d.detail.noActivity||t[130]!==d.eventTypes?(Ke=o.length?o.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:d.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:kt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.detail.noActivity}),t[128]=o,t[129]=d.detail.noActivity,t[130]=d.eventTypes,t[131]=Ke):Ke=t[131];let qe;t[132]===Ke?qe=t[133]:(qe=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Ke}),t[132]=Ke,t[133]=qe);let Je;t[134]!==Ge||t[135]!==qe?(Je=(0,J.jsxs)(`section`,{children:[Ge,qe]}),t[134]=Ge,t[135]=qe,t[136]=Je):Je=t[136];let Ye;t[137]!==Be||t[138]!==We||t[139]!==Je?(Ye=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Be,We,Je]}),t[137]=Be,t[138]=We,t[139]=Je,t[140]=Ye):Ye=t[140];let Xe;t[141]!==ze||t[142]!==Ye?(Xe=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[ze,Ye]}),t[141]=ze,t[142]=Ye,t[143]=Xe):Xe=t[143];let Ze;t[144]!==c||t[145]!==f||t[146]!==d.create.cancel?(Ze=(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:f,disabled:c,children:d.create.cancel}),t[144]=c,t[145]=f,t[146]=d.create.cancel,t[147]=Ze):Ze=t[147];let Qe;t[148]!==c||t[149]!==C?(Qe=c||!C.trim(),t[148]=c,t[149]=C,t[150]=Qe):Qe=t[150];let $e;t[151]===n?$e=t[152]:($e=n===`create`?(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}):null,t[151]=n,t[152]=$e);let et=n===`create`?d.create.submit:d.detail.save,tt;t[153]!==Qe||t[154]!==$e||t[155]!==et?(tt=(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:Qe,children:[$e,et]}),t[153]=Qe,t[154]=$e,t[155]=et,t[156]=tt):tt=t[156];let nt;t[157]!==Ze||t[158]!==tt?(nt=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Ze,tt]}),t[157]=Ze,t[158]=tt,t[159]=nt):nt=t[159];let rt;t[160]!==ae||t[161]!==he||t[162]!==Xe||t[163]!==nt?(rt=(0,J.jsxs)(oe,{children:[ce,(0,J.jsx)(T,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,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)(`form`,{onSubmit:ae,className:`flex min-h-0 flex-1 flex-col`,children:[he,Xe,nt]})})]}),t[160]=ae,t[161]=he,t[162]=Xe,t[163]=nt,t[164]=rt):rt=t[164];let at;return t[165]!==S||t[166]!==se||t[167]!==rt?(at=(0,J.jsx)(B,{open:S,onOpenChange:se,children:rt}),t[165]=S,t[166]=se,t[167]=rt,t[168]=at):at=t[168],at}function Jt({projectId:e,createRequestKey:t=0}){let n=i(),r=d(p(e=>e.language)).projectDetailPage.workItems,a=(0,q.useRef)(null),o=(0,q.useRef)(null),[c,l]=(0,q.useState)([]),[u,f]=(0,q.useState)(!0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(null),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{f(!0),h(null);try{let r=await W(e,{limit:100,offset:n});l(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),h(null),_(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Et.map(e=>({status:e,title:r.statuses[e],items:c.filter(t=>t.status===e)})),[c,r.statuses]),R=(0,q.useCallback)(e=>{l(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),B=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await De(e.id,t);n.item.archivedAt?(l(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(n.item),_({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,R]),V=(0,q.useCallback)(async e=>{N(e),F([]),h(null),_(null);let t=await at(e.id).catch(()=>null);t&&F(t.events)},[]),H=(0,q.useCallback)(async t=>{y(!0),h(null),_(null);try{let n=await Fe(e,t);l(e=>[n.item,...e]),k(!1),N(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events),_({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),ee=(0,q.useCallback)(async(e,t)=>{if(t.length){y(!0),h(null),_(null);try{let n=await Be(e.id,t);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[R]),te=(0,q.useCallback)(async(e,t)=>{y(!0),h(null),_(null);try{let n=await Ge(e.id,t.id);R(n.item),F((await at(n.item.id).catch(()=>({events:[]}))).events)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[R]),ne=(0,q.useCallback)(async(e,t)=>{h(null),_(null);try{await et(e.id,t)}catch(e){h(e instanceof Error?e.message:String(e))}},[]),re=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await je(e.id);R(t.item),await V(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,V,R]),ie=(0,q.useCallback)(async e=>{y(!0),h(null),_(null);try{let t=await ye(e.id);R(t.item),await V(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){h(e instanceof Error?e.message:String(e))}finally{y(!1)}},[n,V,R]),ae=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Tt,e.id),x(e.id)},[]),oe=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Tt)||b;C(null),x(null);let r=c.find(e=>e.id===n);!r||r.status===e||B(r,{status:e})},[b,c,B]),se=(0,q.useCallback)(e=>{B(e,{status:e.status===`done`?`todo`:`done`})},[B]),ce=(0,q.useCallback)(e=>{N(null),F([]),h(null),_(null),j(e),k(!0)},[]),le=(0,q.useCallback)(e=>{let t=o.current;!t||t.pointerId!==e.pointerId||(o.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),ue=(0,q.useCallback)(e=>{if(e.button!==0||b||Bt(e.target))return;let t=a.current;t&&(o.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[b]),de=(0,q.useCallback)(e=>{let t=o.current,n=a.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,T(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[m?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:m}):null,(0,J.jsx)(`section`,{ref:a,className:s(`min-h-0 flex-1 overflow-x-auto rounded-lg p-2 transition-opacity`,u&&`opacity-60`,w?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":u,onPointerDown:ue,onPointerMove:de,onPointerUp:le,onPointerCancel:le,onLostPointerCapture:e=>{o.current?.pointerId===e.pointerId&&(o.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:s(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,S===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{b&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,C(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||C(null)},onDrop:t=>oe(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(z,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(Ht,{item:e,dragging:b===e.id,onOpen:V,onToggleDone:se,onDragStart:ae,onDragEnd:()=>{x(null),C(null)},t:r},e.id)):u?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ut,{}),(0,J.jsx)(Ut,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),u?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!u&&E?(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,c.length),children:r.loadMore}):null,(0,J.jsx)(qt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:v,error:m,notice:g,t:r,onClose:()=>{k(!1),N(null),F([]),h(null),_(null)},onCreate:H,onSave:(e,t)=>void B(e,t),onStartChat:re,onCreateGoal:ie,onAddAttachments:(e,t)=>void ee(e,t),onRemoveAttachment:(e,t)=>void te(e,t),onDownloadAttachment:(e,t)=>void ne(e,t),onPreviewError:e=>{_(null),h(e)}})]})}var Yt=[{id:`overview`,icon:He},{id:`work-items`,icon:me},{id:`sessions`,icon:ie},{id:`goals`,icon:vt},{id:`workflows`,icon:ft},{id:`files`,icon:U},{id:`activity`,icon:ke},{id:`automations`,icon:se},{id:`notes`,icon:ce},{id:`settings`,icon:nt}],Xt=new Set(Yt.map(e=>e.id)),Zt=`xopc.projectFiles.panelWidthPx`,Qt=320,$t=220,en=560;function tn(e){return Math.min(en,Math.max($t,Math.round(e)))}function nn(){try{let e=window.localStorage.getItem(Zt);if(e==null)return Qt;let t=Number.parseInt(e,10);return Number.isFinite(t)?tn(t):Qt}catch{return Qt}}function rn(e){try{window.localStorage.setItem(Zt,String(tn(e)))}catch{}}function an(e){return!!(e&&Xt.has(e))}function on(e){return e===`overview`?`overview`:e===`work-items`||e===`goals`||e===`workflows`||e===`automations`?`work`:`context`}function sn(e){return e===`work`?`work-items`:e===`context`?`files`:`overview`}function cn(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function ln(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):Ae(n)}function un(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 dn(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function fn(e){let t=(0,K.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 pn(e=!1){return s(`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 mn(e){let t=(0,K.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 c=a&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=s(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,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 hn(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function gn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function _n(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function vn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function yn(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 bn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function xn(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 Sn(e){let t=e.sourceChannel?.trim();if(t)return Cn(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 Cn(r||``)}function Cn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function wn(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 Tn(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 En(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:En(e.children,t,n)}:e)}function Dn({currentProject:e,pm:t,projectsText:n,wd:r}){let a=i(),[o,l]=(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,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`new`),[S,w]=(0,q.useState)(``),[E,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(!1),[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(null),F=(0,q.useCallback)(async()=>{h(!0),_(null);try{let t=await Xe({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)(()=>{o&&F()},[F,o]);let L=(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=hn(e);return t.every(e=>n.includes(e))}).sort((e,t)=>gn(t)-gn(e))},[e.id,u,f]),R=e=>t.statuses[e.status]??e.status,z=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,V=e=>{x(e),w(``),D(``),M(null),y(!0),l(!1)},H=(0,q.useCallback)(async(e={})=>{let t=E.trim(),n=S.trim()||(b===`directory`?_n(t):``);if(n){k(!0),M(null),P(null);try{let r=await C({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});y(!1),w(``),D(``),d(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=vn(e);t?(P(t),y(!1)):M(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[b,S,a,E]),te=(0,q.useCallback)(e=>{e.preventDefault(),H()},[H]),ne=(0,q.useCallback)(()=>{H({createWorkspaceRoot:!0})},[H]),re=(0,q.useCallback)(()=>{P(null),y(!0)},[]),ie=e=>{D(e),b===`directory`&&!S.trim()&&w(_n(e))},ae=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:s(`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:()=>{l(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(c,{className:s(`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:z(e)})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,un(e.status)),children:R(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(Se,{open:o,onOpenChange:l,children:[(0,J.jsx)(Ye,{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:s(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,un(e.status)),children:R(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:z(e)})]}),(0,J.jsx)(Ce,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(Le,{children:(0,J.jsxs)($e,{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)(xe,{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}),ae(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&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!m&&L.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,L.map(e=>ae(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:()=>V(`new`),children:[(0,J.jsx)(ht,{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:()=>V(`directory`),children:[(0,J.jsx)(U,{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:()=>{l(!1),a(`/projects`)},children:[(0,J.jsx)(nt,{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)(B,{open:v,onOpenChange:e=>!O&&y(e),children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:b===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:b===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,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:[j?(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:j}):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:S,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)(xt,{value:E,onChange:ie,disabled:O,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)(ee,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:O,children:n.cancel})}),(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:O||!(S.trim()||b===`directory`&&_n(E)),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(B,{open:!!N,onOpenChange:e=>{e||P(null)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:N?cn(n.workspaceMissingDescription,{workspace:N}):null})]}),N?(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)(U,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:N})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:O,children:n.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:O,children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function On(){let{projectId:e=``,tabId:t,noteId:n}=o(),r=i(),c=d(p(e=>e.language)),f=c.chat.workingDirectory,m=c.projectDetailPage,S=c.projectsPage,C=_(e=>e.setPageHeader),w=_(e=>e.clearPageHeader),[L,z]=(0,q.useState)(null),[V,ye]=(0,q.useState)(null),[W,De]=(0,q.useState)([]),[ke,Ae]=(0,q.useState)(``),[je,Pe]=(0,q.useState)([]),[Fe,Ie]=(0,q.useState)([]),[Be,Ue]=(0,q.useState)([]),[Ge,Xe]=(0,q.useState)([]),[et,nt]=(0,q.useState)([]),[it,at]=(0,q.useState)(!1),[ct,vt]=(0,q.useState)(null),[K,Tt]=(0,q.useState)([]),[Et,Dt]=(0,q.useState)(0),[Ot,kt]=(0,q.useState)(!1),[At,jt]=(0,q.useState)(!1),[Mt,Nt]=(0,q.useState)(!1),[Pt,Ft]=(0,q.useState)([]),It=(0,q.useRef)(new Set),[Lt,Rt]=(0,q.useState)(null),[zt,Bt]=(0,q.useState)(nn),[Vt,Ht]=(0,q.useState)(!1),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(``),[qt,Xt]=(0,q.useState)([]),[Zt,Qt]=(0,q.useState)(!1),[$t,en]=(0,q.useState)(null),[hn,gn]=(0,q.useState)(!1),[_n,Cn]=(0,q.useState)(null),[On,kn]=(0,q.useState)([]),[Y,An]=(0,q.useState)(``),[jn,Mn]=(0,q.useState)(!0),[Nn,Pn]=(0,q.useState)(!1),[Fn,In]=(0,q.useState)(!1),[Ln,Rn]=(0,q.useState)(null),[zn,Bn]=(0,q.useState)(!1),[X,Vn]=(0,q.useState)(`fixed`),[Hn,Un]=(0,q.useState)(``),[Wn,Gn]=(0,q.useState)(null),[Kn,qn]=(0,q.useState)(!1),[Jn,Yn]=(0,q.useState)(!1),[Xn,Zn]=(0,q.useState)(0),[Qn,$n]=(0,q.useState)(!1),[er,tr]=(0,q.useState)(null),[nr,rr]=(0,q.useState)(!1),[ir,ar]=(0,q.useState)(!1),[or,sr]=(0,q.useState)(!1),[cr,Z]=(0,q.useState)(null),[lr,ur]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[dr,fr]=(0,q.useState)({title:``,reason:``}),[Q,pr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),mr=`overview`,$=n?`notes`:an(t)?t:mr,hr=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),gr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),_r=(0,q.useCallback)(e=>{let t=gr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[gr]),vr=(0,q.useCallback)(t=>{e&&r(gr(t),{replace:!0})},[r,e,gr]),yr=(0,q.useCallback)((e,t)=>{vr(e),r(t)},[r,vr]),br=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||vr(e)},[vr]),xr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||an(t)||r(`/projects/${encodeURIComponent(e)}/${mr}`,{replace:!0})},[mr,r,e,t]),(0,q.useEffect)(()=>{if(!e)return;let t=!1;return Mn(!0),Z(null),Promise.all([D(e),N(e),fe(e),M().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;z(a),ye(e),De(n),Pe(r),kn(i?.agents??[]),An(a.defaultAgentId??``),pr({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||Mn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([M(),rt(),qe()]);e||ur(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=L?.defaultAgentId||Y||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?St(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[L?.defaultAgentId,Y]);let Sr=(0,q.useCallback)(async()=>{if(L){$n(!0),Z(null);try{let[e,t]=await Promise.all([gt(),mt(100,{ownerAgentId:Y||void 0,projectId:L.id})]);Ie(e),Ue(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{$n(!1)}}},[L,Y]);(0,q.useEffect)(()=>{L&&Sr()},[L,Sr]);let Cr=(0,q.useCallback)(async()=>{if(L){at(!0),Z(null);try{let[e,t]=await Promise.all([dt.list({projectId:L.id}),dt.runs(50,void 0,{projectId:L.id})]);Xe(e.automations),nt(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{at(!1)}}},[L]);(0,q.useEffect)(()=>{$===`automations`&&Cr()},[Cr,$]);let wr=(0,q.useCallback)(async()=>{if(L){kt(!0),Z(null);try{let e=await O(L.id,{includeRelated:At,limit:100});Tt(e.items),Dt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{kt(!1)}}},[L,At]);(0,q.useEffect)(()=>{$===`activity`&&wr()},[wr,$]);let Tr=(0,q.useCallback)(async e=>{vt(`run:${e.id}`),Z(null);try{await dt.runNow(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{vt(null)}},[Cr]),Er=(0,q.useCallback)(async e=>{vt(`toggle:${e.id}`),Z(null);try{e.enabled?await dt.pause(e.id):await dt.resume(e.id),await Cr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{vt(null)}},[Cr]),Dr=(0,q.useCallback)(async()=>{if(!L?.effectiveWorkspaceRoot?.trim()){Ft([]),It.current.clear(),Cn(null);return}gn(!0),Cn(null),It.current.clear();try{Ft(Tn((await le(L.id,``)).entries)),It.current.add(``)}catch(e){Ft([]),It.current.clear(),Cn(e instanceof Error?e.message:String(e))}finally{gn(!1)}},[L]),Or=(0,q.useCallback)(async e=>{if(!(!L?.effectiveWorkspaceRoot?.trim()||It.current.has(e))){It.current.add(e),Cn(null);try{let t=await le(L.id,e);Ft(n=>En(n,e,Tn(t.entries)))}catch(t){It.current.delete(e),Cn(t instanceof Error?t.message:String(t))}}},[L]);(0,q.useEffect)(()=>{$===`files`&&Dr()},[Dr,$]);let kr=Gt.trim();(0,q.useEffect)(()=>{if($!==`files`||!L||!Ut||!kr){Xt([]),Qt(!1),en(null);return}let e=!1;Qt(!0),en(null),Xt([]);let t=window.setTimeout(()=>{_e(L.id,kr,50).then(t=>{e||Xt(t)}).catch(t=>{e||en(t instanceof Error?t.message:String(t))}).finally(()=>{e||Qt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[kr,L,Ut,$]);let Ar=(0,q.useCallback)(async()=>{if(L){Yn(!0),Z(null);try{let e=await re(L.id);yr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Yn(!1)}}},[yr,L]),jr=(0,q.useCallback)(()=>{hr(`work-items`),Zn(e=>e+1)},[hr]),Mr=(0,q.useCallback)(async()=>{if(!L)return;let[e,t]=await Promise.all([D(L.id),fe(L.id)]);ye(e),z(e.project),Pe(t)},[L]),Nr=(0,q.useCallback)(async e=>{if(!L||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;rr(!0),Z(null);try{await F(L.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:Ct(e.evidencePlan),criteria:Ct(e.checklist)}}),sr(!1),hr(`goals`),await Mr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{rr(!1)}},[hr,L,Mr]),Pr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!L||!dr.title.trim())){ar(!0),Z(null);try{await k(L.id,{title:dr.title.trim(),reason:dr.reason.trim()||void 0}),fr({title:``,reason:``}),await Mr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ar(!1)}}},[dr.reason,dr.title,L,Mr]),Fr=(0,q.useCallback)(async e=>{if(L){tr(`retry:${e.id}`),Z(null);try{let t=await ut(e.id,{ownerAgentId:Y||e.metadata?.agentId,projectId:e.metadata?.projectId||L.id});await Sr(),yr(`workflows`,ne(t.runId,{ownerAgentId:Y||e.metadata?.agentId||L.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}}},[yr,L,Sr,Y]),Ir=(0,q.useCallback)(async e=>{tr(`cancel:${e.id}`),Z(null);try{await Ne(e.id,{ownerAgentId:Y||e.metadata?.agentId}),await Sr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{tr(null)}},[Sr,Y]),Lr=(0,q.useMemo)(()=>(0,J.jsx)(a,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":m.backToProjects,children:(0,J.jsx)(we,{className:`size-4`,"aria-hidden":!0})}),[m.backToProjects]),Rr=(0,q.useMemo)(()=>L?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:jr,children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.workItems.create.header]}),(0,J.jsxs)(G,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Ar(),disabled:Jn,children:[(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),m.common.newChat]})]}):null,[jr,m.common.newChat,m.workItems.create.header,L,Ar,Jn]);(0,q.useLayoutEffect)(()=>(C({startExtra:Lr,main:L?(0,J.jsx)(Dn,{currentProject:L,pm:m,projectsText:S,wd:f}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:m.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:m.fallbackContext})]}),end:Rr}),()=>w()),[w,Rr,Lr,m,L,S,C,f]);function zr(e){z(t=>t?{...t,...e}:null),ye(t=>t?{...t,project:{...t.project,...e}}:null),An(e.defaultAgentId??``),pr(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Br(){if(!(!L||!Q.name.trim())){Pn(!0),Z(null),Rn(null);try{zr(await h(L.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=vn(e);t?Rn(t):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}function Vr(e){e.preventDefault(),Br()}let Hr=(0,q.useCallback)(()=>{if(!L)return;let e=L.workspaceRoot?.trim()??``;Vn(e?`fixed`:`follow`),Un(e||L.effectiveWorkspaceRoot||``),Bn(!0)},[L]);async function Ur(e={}){if(!L)return;let t=X===`fixed`?Hn.trim():``;if(!(X===`fixed`&&!t)){Pn(!0),Z(null),Rn(null);try{zr(await h(L.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Bn(!1),Rn(null)}catch(e){let t=vn(e);t?(Rn(t),Bn(!1)):Z(e instanceof Error?e.message:String(e))}finally{Pn(!1)}}}async function Wr(){if(!(!L||Wn)){Gn(`pin`),Z(null);try{zr(L.pinnedAt?await te(L.id):await j(L.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Gr(){if(!(!L||Wn)){Gn(`archive`),Z(null);try{zr(L.status===`archived`?await he(L.id):await H(L.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Gn(null)}}}async function Kr(){if(L){qn(!0),Z(null);try{await g(L.id),In(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qn(!1)}}}async function qr(){if(!(!L||Mt)){Nt(!0),Z(null);try{await pe(L.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Nt(!1)}}}let Jr=(0,q.useCallback)(e=>{Rt(e)},[]),Yr=(0,q.useCallback)((e,t)=>{t||Rt(e)},[]),Xr=(0,q.useCallback)(async(e,t,n)=>{let r=L?.id;if(r)switch(e){case`preview`:t.isDirectory||Rt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Ze(t.path);if(be(Ve(e))!==`text`){let n=await Te(t.path,{projectId:r}),i=Qe(e)??`application/octet-stream`;Ke(e,await n.arrayBuffer(),i)}else{let{content:n}=await Re(t.path,{projectId:r});tt(e,n)}}catch(e){Me(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await u(t.absolutePath??t.path)&&Me(`success`,c.workspace.pathCopied,void 0,{duration:2500})}catch{Me(`warning`,c.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}},[c.clipboard.copyFailed,c.workspace.pathCopied,L?.id]),Zr=(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),Ht(!0);let r=e.clientX,i=zt,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=tn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ht(!1),Bt(c),rn(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)},[zt]);if((0,q.useEffect)(()=>{$!==`files`&&Rt(null)},[e,$]),jn)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:m.loading});if(!L)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)(a,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(we,{className:`size-4`,"aria-hidden":!0}),m.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:cr||m.notFound})]});let Qr=V?.recentSessions.length?V.recentSessions:L.recentSessions,$r=V?.attentionItems??[],ei=e=>m.statuses[e]??e,ti=e=>cn(m.common.messages,{count:e}),ni=ke.trim().toLowerCase(),ri=ni?W.filter(e=>{let t=ln(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=e.name?.trim()||m.sessions.fallbackTitle,i=ti(e.messageCount??0),a=Sn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(ni)}):W,ii=W.length>0&&ri.length===0,ai=On.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||m.settings.globalDefaultAgent,oi=On.find(e=>e.id===Q.defaultAgentId),si=L.workspaceRoot?.trim()||``,ci=L.status===`archived`,li=!!L.pinnedAt,ui=!si,di=si||oi?.workspace||L.effectiveWorkspaceRoot||m.common.defaultWorkspace,fi=X===`fixed`?Hn.trim()||m.settings.workspacePlaceholder:oi?.workspace||L.effectiveWorkspaceRoot||m.common.defaultWorkspace,pi=(X===`fixed`?Hn.trim():``)!==si&&(X===`follow`||!!Hn.trim()),mi=[{id:`overview`,icon:He,label:m.surfaceTabs.overview},{id:`work`,icon:me,label:m.surfaceTabs.work},{id:`context`,icon:U,label:m.surfaceTabs.context}],hi=Yt.filter(e=>e.id!==`overview`&&e.id!==`work-items`&&e.id!==`files`);async function gi(){if(!di)return;let e=await u(di);Me(e?`success`:`warning`,e?c.workspace.pathCopied:c.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function _i(){Rn(null),Bn(!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)(bt,{items:mi,activeTab:on($),onChange:e=>hr(sn(e)),ariaLabel:m.navAria,tabIdPrefix:`project-surface-tab`,className:`min-w-0 flex-1`}),(0,J.jsxs)(Se,{children:[(0,J.jsx)(Ye,{asChild:!0,children:(0,J.jsxs)(G,{type:`button`,variant:hi.some(e=>e.id===$)?`secondary`:`ghost`,className:`h-9 shrink-0 rounded-lg px-3`,children:[m.surfaceTabs.details,(0,J.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})]})}),(0,J.jsx)(Le,{children:(0,J.jsx)($e,{align:`end`,sideOffset:6,className:`z-[70] w-48 rounded-xl border border-edge bg-surface-panel p-1.5 shadow-float`,children:hi.map(e=>{let t=e.icon,n=e.id===`work-items`?m.workItems.tab:m.tabs[e.id];return(0,J.jsx)(We,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm hover:bg-surface-hover`,$===e.id?`bg-accent-soft text-accent-fg`:`text-fg-muted`),onClick:()=>hr(e.id),children:[(0,J.jsx)(t,{className:`size-4`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:n})]})},e.id)})})})]})]}),cr?(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:cr}):null,(0,J.jsxs)(`div`,{className:s(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-surface-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:m.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:V?.digest?.summary||V?.recommendedAction||L.description||L.brief||m.overview.directionFallback}),V?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:cn(m.overview.recommendedNext,{action:V.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,onClick:()=>void qr(),disabled:Mt,children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),Mt?m.overview.savingDigest:m.overview.saveDigest]})})]})}),(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.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.overview.nextActions}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>sr(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:V?.nextActions.length?V.nextActions.map(e=>(0,J.jsxs)(a,{to:_r(e.goalId),onClick:br(`goals`),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.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noNextActions})})]})]}),(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:m.overview.attention}),$r.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:$r.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)(l,{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:[m.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${ei(e.status)}`:``]})]});return e.href?(0,J.jsx)(a,{to:e.href,onClick:br(xr(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:m.overview.noBlockedGoals}),(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:dr.title,onChange:e=>fr(t=>({...t,title:e.target.value})),placeholder:m.overview.blockerTitlePlaceholder}),(0,J.jsx)(G,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ir||!dr.title.trim(),"aria-label":ir?m.overview.addingBlocker:m.overview.addBlocker,title:ir?m.overview.addingBlocker:m.overview.addBlocker,children:(0,J.jsx)(ht,{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)(ue,{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:m.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>hr(`sessions`),children:m.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Qr.length?Qr.map(e=>(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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:ln(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||m.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-3 py-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.surfaceTabs.workHint}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[`goals`,`workflows`,`automations`].map(e=>(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(Jt,{projectId:L.id,createRequestKey:Xn})})]}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.workflows.runsHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Sr(),disabled:Qn,children:[(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Qn&&Be.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.loadingRuns}):Be.length?Be.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center 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:()=>yr(`workflows`,ne(e.id,{ownerAgentId:Y||e.metadata?.agentId||L.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(e.status)),children:ei(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:cn(m.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:ln(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>yr(`workflows`,ne(e.id,{ownerAgentId:Y||e.metadata?.agentId||L.defaultAgentId})),children:m.common.open}),n?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`retry:${e.id}`,onClick:()=>void Fr(e),children:[(0,J.jsx)(st,{className:`size-3.5`,"aria-hidden":!0}),m.common.retry]}):null,t?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:er===`cancel:${e.id}`,onClick:()=>void Ir(e),children:[(0,J.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),m.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:Fe.length?Fe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>r(`/workflows/${e.id}?projectId=${encodeURIComponent(L.id)}${Y?`&agentId=${encodeURIComponent(Y)}`:``}`),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(ft,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:m.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:m.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Cr(),disabled:it,children:[(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}),m.common.refresh]}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(L.id)}&action=create`),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:it&&Ge.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.loading}):Ge.length?Ge.map(e=>{let t=et.find(t=>t.automationId===e.id),n=e.state.runningRunId?et.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center 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:()=>yr(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:s(`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?m.automations.enabled:m.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:cn(m.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?ln(t.createdAtMs):m.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:ct===`run:${e.id}`||!!n,onClick:()=>void Tr(e),children:[(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),m.automations.run]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:ct===`toggle:${e.id}`,onClick:()=>void Er(e),children:[e.enabled?(0,J.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(ft,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?m.automations.pause:m.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:m.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>yr(`automations`,`/automations?projectId=${encodeURIComponent(L.id)}&action=create`),children:[(0,J.jsx)(se,{className:`size-4`,"aria-hidden":!0}),m.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,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:m.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:et.length?et.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:ln(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:m.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:L.workspaceRoot||L.effectiveWorkspaceRoot||m.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(yt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(L.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${L.id}`,captureTags:[`project:${L.id}`,L.slug],listTitle:m.notes.title,listDescription:m.notes.hint,emptyText:m.notes.emptyTitle,emptyDescription:m.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${L.id}`})}):null,$===`files`?(0,J.jsxs)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`flex h-full min-h-[28rem] flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.surfaceTabs.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:L.brief||L.instructions||L.description||m.surfaceTabs.contextFallback})]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-1`,children:[`sessions`,`notes`,`settings`].map(e=>(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-7 rounded-md px-2 text-xs`,onClick:()=>hr(e),children:m.tabs[e]},e))})]}),(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:L.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:s(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Vt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${zt}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)(R,{workspacePath:di}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:s(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,Ut&&`bg-surface-hover text-fg`),onClick:()=>Wt(!0),"aria-label":m.files.search,title:m.files.search,"aria-pressed":Ut,children:(0,J.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(Oe,{className:`size-7 shrink-0 rounded-md p-0`,loading:hn,label:c.cron.refresh,onClick:()=>void Dr()})]})]}),Ut?(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)(xe,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Gt,onChange:e=>Kt(e.target.value),placeholder:m.files.searchPlaceholder,"aria-label":m.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":m.files.clearSearch,title:m.files.clearSearch,onClick:()=>{Kt(``),Wt(!1)},children:(0,J.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,_n?(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:_n}):null,kr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Zt?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(ze,{className:`h-11 w-full`}),(0,J.jsx)(ze,{className:`h-11 w-full`}),(0,J.jsx)(ze,{className:`h-11 w-full`})]}):$t?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[c.workspace.loadError,`: `,$t]}):qt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:m.files.noSearchResults}):qt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:s(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,Lt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Rt(e.path),title:e.path,children:[(0,J.jsx)(ce,{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))}):hn&&Pt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:m.files.loading}):(0,J.jsx)(ot,{tree:Pt,selectedPath:Lt,onSelectFile:Jr,onSelectEntry:Yr,onExpandDir:e=>void Or(e),onAction:Xr,actionLabels:{preview:c.workspace.preview,download:c.workspace.download,copyPath:c.workspace.copyPath,openDefault:c.workspace.openSystemApp,openWith:c.workspace.openWith,revealInFolder:c.workspace.revealInFolder,recommendedApps:c.workspace.recommendedApps},emptyHint:m.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m.files.resizeHandle,className:s(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Vt&&`bg-surface-hover`),onPointerDown:Zr,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:Lt?(0,J.jsx)(Je,{filePath:Lt,projectId:L.id,onClose:()=>Rt(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)(U,{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:m.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.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:m.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>hr(`settings`),children:m.files.openSettings})})]})})]}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,className:`grid min-h-full content-start gap-3`,children:[W.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)(xe,{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:ke,onChange:e=>Ae(e.currentTarget.value),placeholder:m.sessions.searchPlaceholder,"aria-label":m.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`}),ke?(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":m.sessions.clearSearch,onClick:()=>Ae(``),children:(0,J.jsx)(y,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ri.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ri.map(e=>{let t=ln(e.updatedAt),n=e.routing?.agentId||e.agentId||m.common.agent,r=Sn(e),i=e.name?.trim()||m.sessions.fallbackTitle,o=ti(e.messageCount??0);return(0,J.jsxs)(a,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:br(`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)(ie,{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:[m.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:o})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[m.sessions.updated,`: `,t]}):null]})]},e.key)})}):ii?(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:m.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:m.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:m.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-work`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.goals.title})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:nr,onClick:()=>sr(!0),children:[(0,J.jsx)(ht,{className:`size-4`,"aria-hidden":!0}),m.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:je.length?je.map(e=>(0,J.jsxs)(a,{to:_r(e.id),onClick:br(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex 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.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(e.status)),children:ei(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||m.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:m.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,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:m.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:cn(m.activity.count,{count:Et})})]}),(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:At,onChange:e=>jt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),m.activity.includeRelated]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void wr(),disabled:Ot,children:[(0,J.jsx)(st,{className:s(`size-4`,Ot&&`animate-spin`),"aria-hidden":!0}),m.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Ot&&K.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.loading}):K.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:K.map(e=>{let t=m.activity.types[e.type]??e.type,n=m.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=wn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===L.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:m.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,bn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:ln(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:[m.activity.actor,`: `,yn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[m.activity.source,`: `,xn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:m.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-surface-tab-context`,onSubmit:Vr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.contextHint})]}),(0,J.jsx)(`span`,{className:s(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,un(Q.status)),children:m.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(mn,{label:m.settings.workspaceRoot,value:di,mono:!0}),(0,J.jsx)(mn,{label:m.settings.defaultAgent,value:ai}),(0,J.jsx)(mn,{label:m.settings.pinState,value:li?m.settings.pinned:m.settings.notPinned}),(0,J.jsx)(mn,{label:m.settings.createdAt,value:ln(L.createdAt)||m.common.never}),(0,J.jsx)(mn,{label:m.settings.updatedAt,value:ln(L.updatedAt)||m.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(fn,{label:m.settings.name,children:(0,J.jsx)(`input`,{className:pn(),value:Q.name,onChange:e=>pr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(fn,{label:m.settings.defaultAgent,children:(0,J.jsxs)(ge,{className:pn(),value:Q.defaultAgentId,onChange:e=>pr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(ve,{value:``,children:m.settings.globalDefaultAgent}),On.map(e=>(0,J.jsx)(ve,{value:e.id,children:de(e,c.agentsSettings)},e.id))]})}),(0,J.jsx)(fn,{label:m.settings.status,children:ci?(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:m.settings.statuses.archived}):(0,J.jsxs)(ge,{className:pn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>pr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(ve,{value:`active`,children:m.settings.statuses.active}),(0,J.jsx)(ve,{value:`paused`,children:m.settings.statuses.paused})]})}),(0,J.jsx)(fn,{label:m.settings.description,hint:m.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:pn(!0),value:Q.description,onChange:e=>pr(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:m.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:ui?m.settings.workspaceModeFollow:m.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:di,children:di})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void gi(),children:[(0,J.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),m.settings.copyWorkspacePath]}),(0,J.jsx)(R,{workspacePath:di}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Hr,children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),m.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationHint})]})]})}),(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:m.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.agentContextHint})]}),(0,J.jsx)(fn,{label:m.settings.brief,hint:m.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:pn(!0),value:Q.brief,onChange:e=>pr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(fn,{label:m.settings.instructions,hint:m.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:pn(!0),value:Q.instructions,onChange:e=>pr(t=>({...t,instructions: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:m.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,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:li?m.settings.pinnedTitle:m.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:m.settings.pinHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`pin`,onClick:()=>void Wr(),children:[li?(0,J.jsx)(v,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(lt,{className:`size-4`,"aria-hidden":!0}),li?m.settings.unpinProject:m.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:ci?m.settings.restoreTitle:m.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:ci?m.settings.restoreHint:m.settings.archiveHint})]}),(0,J.jsxs)(G,{type:`button`,variant:ci?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Wn===`archive`,onClick:()=>void Gr(),children:[ci?(0,J.jsx)(st,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(b,{className:`size-4`,"aria-hidden":!0}),ci?m.settings.restoreProject:m.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:m.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:m.settings.dangerHint})]}),(0,J.jsxs)(G,{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:()=>In(!0),children:[(0,J.jsx)(E,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(G,{type:`submit`,variant:`primary`,disabled:Nn||!Q.name.trim(),children:[(0,J.jsx)(Ee,{className:`size-4`,"aria-hidden":!0}),m.common.save]})})]}):null]}),(0,J.jsx)(B,{open:Fn,onOpenChange:e=>{Kn||In(e)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(l,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(_t,{className:`text-base font-semibold text-fg`,children:m.settings.deleteConfirmTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:L?cn(m.settings.deleteConfirm,{name:L.name}):m.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Kn,children:m.common.cancel})}),(0,J.jsxs)(G,{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:Kn||!L,onClick:()=>void Kr(),children:[(0,J.jsx)(E,{className:`size-4`,"aria-hidden":!0}),m.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(B,{open:zn,onOpenChange:e=>{Nn||Bn(e)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMigrationTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:m.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:m.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:s(`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:()=>Vn(`fixed`),disabled:Nn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:s(`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:()=>Vn(`follow`),disabled:Nn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:m.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:m.settings.workspaceHint})]})]})]})]}),X===`fixed`?(0,J.jsx)(xt,{value:Hn,onChange:Un,disabled:Nn,wd:f,placeholder:m.settings.workspacePlaceholder,inputClassName:pn(),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:m.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:cn(m.settings.workspaceCurrent,{workspace:fi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(ee,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Nn,children:m.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Nn||!pi,onClick:()=>void Ur(),children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(B,{open:!!Ln,onOpenChange:e=>{e||Rn(null)},children:(0,J.jsxs)(oe,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(T,{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)(_t,{className:`text-base font-semibold text-fg`,children:m.settings.workspaceMissingTitle}),(0,J.jsx)(A,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Ln?cn(m.settings.workspaceMissingDescription,{workspace:Ln}):null})]}),Ln?(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)(U,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Ln})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:_i,disabled:Nn,children:m.settings.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Ur({createWorkspaceRoot:!0}),disabled:Nn,children:[(0,J.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),m.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(wt,{open:or,t:c.goalsPage,chat:c.chat,busy:nr,options:lr,onClose:()=>!nr&&sr(!1),onCreate:Nr})]})}export{On as ProjectDetailPage};