@xopcai/xopc 0.0.163 → 0.0.164

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 (166) 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-Xj95LzTv.js → activity-store-DkALQFJT.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C-QeUFwU.js → agent-avatar-dicebear-RpxkQtQ3.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-CxpwxMPE.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-BTLmAm1_.js → api-DPIXEcIq.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-zc6Gf-S5.js → app-management-settings-panel-DLdjfMXB.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-0fMLnOWn.js → appearance-settings-C89-uxkq.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-k-tZbaRB.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-DOiR_E21.js → archive-plugin-CqbH5geE.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-BxmYl1D1.js → attachment-load-CeU4Qiot.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-BhZOirad.js → automation-suggestion-card-WiOuqXq9.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-page-Bdn3dgC_.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-DTTKsvgk.js → binary-plugins-C5TdzrhJ.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-C7se7iqg.js → block-editor-BjvWhphG.js} +47 -47
  16. package/dist/gateway/static/root/assets/browser-settings-page-GsVTGfGs.js +8 -0
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-kxmStCcv.js → browser-workflow-inputs-DXmzQ3nk.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-CwYf9OM_.js → browser-workflows-page-C1-ptRe4.js} +2 -2
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-6d4kVjzl.js +2 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BZKh2cWX.js → capability-presets-api-C0pVlUyc.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DCxy5Ls_.js +2 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-r7tdbnJE.js → channel-recipient-api-B5rLegwk.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-Bg3P8k0f.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +1 -0
  25. package/dist/gateway/static/root/assets/{connector-logo-BpnQYAxA.js → connector-logo-CuI5w4qM.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-6UR7yhIZ.js +2 -0
  27. package/dist/gateway/static/root/assets/desktop-pet-BvG8vDXZ.js +1 -0
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-uv8Grtgk.js → desktop-pet-settings-CR__kZ8C.js} +1 -1
  29. package/dist/gateway/static/root/assets/{directory-picker-path-field-C4TTvf7p.js → directory-picker-path-field-BblWMz3e.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dreaming-settings-CzJAUPvM.js → dreaming-settings-DHMPugDE.js} +3 -3
  31. package/dist/gateway/static/root/assets/{extension-debug-page-Ci2mOYUt.js → extension-debug-page-ByVY1gZg.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-DeXdmhXQ.js → extension-page-DLCKKtbK.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-C93vaOsU.js → extension-settings-page-M-rhlFBC.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-config-api-C31Hlblp.js → gateway-config-api-DZHqhbXH.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-D3zS6RZh.js → gateway-settings-CZswIehx.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-startup-retry-CSRvCqxh.js → gateway-startup-retry-ulwTJovP.js} +1 -1
  37. package/dist/gateway/static/root/assets/goal-create-dialog-TbyRfDas.js +1 -0
  38. package/dist/gateway/static/root/assets/goal-detail-page-B-QBVOf2.js +4 -0
  39. package/dist/gateway/static/root/assets/{goals-config-api-D4wYNRrf.js → goals-config-api-DMxG6f0N.js} +1 -1
  40. package/dist/gateway/static/root/assets/goals-page-BGxki8BR.js +2 -0
  41. package/dist/gateway/static/root/assets/{goals-settings-Bx2jVvhQ.js → goals-settings-G-w1gCYD.js} +1 -1
  42. package/dist/gateway/static/root/assets/{heartbeat-settings-BEIF1eXy.js → heartbeat-settings-Csb90R59.js} +1 -1
  43. package/dist/gateway/static/root/assets/{index-HZdBKfk_.js → index-CGwuxvzr.js} +70 -70
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DOEDpvTM.js → keyboard-shortcuts-settings-C_Bl3YOr.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-BR2tBhO3.js +2 -0
  46. package/dist/gateway/static/root/assets/{local-apps-page-B0OpGpxv.js → local-apps-page-_8Rv-tSk.js} +1 -1
  47. package/dist/gateway/static/root/assets/{locale-store-Ys6RP7Be.js → locale-store-C_ax27uc.js} +1 -1
  48. package/dist/gateway/static/root/assets/logs-page-CwF0C_Z2.js +7 -0
  49. package/dist/gateway/static/root/assets/{markdown-split-CEZwysCH.js → markdown-split-CZnZS6gq.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-CpGKE7B0.js → media-plugins-C2XLYC6G.js} +1 -1
  51. package/dist/gateway/static/root/assets/{messages-BzI9Wx30.js → messages-C96Zjb0V.js} +2 -2
  52. package/dist/gateway/static/root/assets/{notes-page-CdiuDZ5a.js → notes-page-BkuZxTFo.js} +1 -1
  53. package/dist/gateway/static/root/assets/notes-workbench-CD4FADi7.js +4 -0
  54. package/dist/gateway/static/root/assets/{page-tabs-BkH5AVV2.js → page-tabs-DR2FGC4E.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-CQai8f9D.js → preview-open-alternatives-B65O8wBL.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-B2kSdB2b.js → product-open-page-Cag-utLH.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-COKtUblD.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-QYmqanBN.js +1 -0
  59. package/dist/gateway/static/root/assets/remote-access-hub-BU_gBU0f.js +1 -0
  60. package/dist/gateway/static/root/assets/{save-bar-controls-NGYnO7n7.js → save-bar-controls-DCWpFnPc.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schedule-field-nLOphnv3.js → schedule-field-ClacZdvE.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schema-form-D0e90ndE.js → schema-form-BVlbEipU.js} +1 -1
  63. package/dist/gateway/static/root/assets/sessions-page-u-Pjbzfm.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-1Yck1PKq.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-X2Sl-EAk.js → settings-form-section-GSNlQWSW.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DOnUabm7.js → settings-loading-skeleton-08Ae5sB_.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-C4UUNi1n.js → settings-page-BseJD4I-.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-layout-C1yYqbT6.js → settings-page-layout-bSliH-Y3.js} +1 -1
  69. package/dist/gateway/static/root/assets/setup-status-panel-CGRhJVlt.js +1 -0
  70. package/dist/gateway/static/root/assets/{share-preview-page-Cfy_pH7V.js → share-preview-page-C114OpTx.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-BRFpWFgI.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-cVjU2GnN.js +1 -0
  73. package/dist/gateway/static/root/assets/skills-page-CoMTjtRT.js +2 -0
  74. package/dist/gateway/static/root/assets/{system-settings-panel-Da81RJ6G.js → system-settings-panel-El8cDcTY.js} +1 -1
  75. package/dist/gateway/static/root/assets/{theme-store-DflSp9o4.js → theme-store-D37XLD_C.js} +1 -1
  76. package/dist/gateway/static/root/assets/{time-picker-BIkOW-2L.js → time-picker-CU7hhD8T.js} +1 -1
  77. package/dist/gateway/static/root/assets/{typed-models-lib--HptwFcD.js → typed-models-lib-kToxD7Rc.js} +1 -1
  78. package/dist/gateway/static/root/assets/{use-channel-catalog-CMHY4ZfW.js → use-channel-catalog-DBh0dOC9.js} +1 -1
  79. package/dist/gateway/static/root/assets/user-context-page-C0xYCSXB.js +1 -0
  80. package/dist/gateway/static/root/assets/{voice-api-key-field-nvIZerol.js → voice-api-key-field-DzEpwYaU.js} +1 -1
  81. package/dist/gateway/static/root/assets/work-discovery-page-DakZqR85.js +1 -0
  82. package/dist/gateway/static/root/assets/work-item-detail-page-CswqPbTT.js +1 -0
  83. package/dist/gateway/static/root/assets/work-page-DYRXEk8m.js +1 -0
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D96MHABy.js → workflow-run-setup-panel-BwSxyVMM.js} +2 -2
  85. package/dist/gateway/static/root/assets/workflows-page-CiLSYGuN.js +11 -0
  86. package/dist/gateway/static/root/index.html +6 -6
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/embedded/model-runtime.d.ts +4 -0
  89. package/dist/src/agent/embedded/model-runtime.js +49 -0
  90. package/dist/src/agent/embedded/session-runner.js +3 -3
  91. package/dist/src/auth/credentials.js +45 -2
  92. package/dist/src/auth/index.js +2 -1
  93. package/dist/src/auth/oauth/anthropic.js +27 -24
  94. package/dist/src/auth/oauth/github-copilot.js +20 -15
  95. package/dist/src/auth/oauth/google-antigravity.js +9 -2
  96. package/dist/src/auth/oauth/google-gemini-cli.js +9 -2
  97. package/dist/src/auth/oauth/google-oauth/google-antigravity.js +47 -40
  98. package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js +48 -41
  99. package/dist/src/auth/oauth/google-oauth/oauth-page.js +7 -2
  100. package/dist/src/auth/oauth/google-oauth/pkce.js +4 -1
  101. package/dist/src/auth/oauth/index.d.ts +2 -0
  102. package/dist/src/auth/oauth/index.js +24 -10
  103. package/dist/src/auth/oauth/kimi-coding.js +76 -71
  104. package/dist/src/auth/oauth/minimax-cn.js +78 -73
  105. package/dist/src/auth/oauth/minimax.js +78 -73
  106. package/dist/src/auth/oauth/openai-codex.js +31 -25
  107. package/dist/src/auth/oauth/pkce.js +4 -1
  108. package/dist/src/auth/oauth/registry.d.ts +13 -0
  109. package/dist/src/auth/oauth/registry.js +65 -0
  110. package/dist/src/auth/oauth/xopc-cloud.d.ts +2 -0
  111. package/dist/src/auth/oauth/xopc-cloud.js +101 -0
  112. package/dist/src/auth/sync-provider-auth.js +5 -0
  113. package/dist/src/cli/utils/oauth-providers.d.ts +3 -26
  114. package/dist/src/cli/utils/oauth-providers.js +6 -80
  115. package/dist/src/config/models-json.js +8 -0
  116. package/dist/src/gateway/heartbeat/service.js +1 -1
  117. package/dist/src/gateway/hono/oauth-async.js +3 -19
  118. package/dist/src/gateway/hono/oauth.js +3 -19
  119. package/dist/src/gateway/hono/routes/models.js +1 -55
  120. package/dist/src/heartbeat/index.js +1 -1
  121. package/dist/src/providers/domestic-presets.d.ts +0 -20
  122. package/dist/src/providers/domestic-presets.js +0 -25
  123. package/dist/src/providers/index.js +9 -0
  124. package/dist/src/providers/model-catalog-store.d.ts +20 -58
  125. package/dist/src/providers/model-catalog-store.js +18 -57
  126. package/dist/src/providers/model-catalog-sync-service.d.ts +3 -4
  127. package/dist/src/providers/model-catalog-sync-service.js +3 -13
  128. package/dist/src/providers/model-registry.js +0 -2
  129. package/dist/src/providers/xopc-cloud-model-source.d.ts +30 -0
  130. package/dist/src/providers/xopc-cloud-model-source.js +68 -0
  131. package/dist/src/work-discovery/analyzer.js +27 -14
  132. package/package.json +1 -1
  133. package/dist/gateway/static/root/assets/agents-DVKlWKJE.js +0 -2
  134. package/dist/gateway/static/root/assets/apps-page-BZXEJDIV.js +0 -1
  135. package/dist/gateway/static/root/assets/automations-page-B8CnkoXv.js +0 -6
  136. package/dist/gateway/static/root/assets/browser-settings-page-BCPWKI9V.js +0 -8
  137. package/dist/gateway/static/root/assets/capabilities-settings-panel-C7lr_mX2.js +0 -2
  138. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Ble9kHRu.js +0 -2
  139. package/dist/gateway/static/root/assets/channels-settings-CtQQQHrv.js +0 -1
  140. package/dist/gateway/static/root/assets/channels-status-swr-_VirfMKW.js +0 -1
  141. package/dist/gateway/static/root/assets/connectors-page-BXWJSJeY.js +0 -2
  142. package/dist/gateway/static/root/assets/desktop-pet-B86W4a5c.js +0 -1
  143. package/dist/gateway/static/root/assets/goal-create-dialog-CWp2b7__.js +0 -1
  144. package/dist/gateway/static/root/assets/goal-detail-page-Dtm29FxD.js +0 -4
  145. package/dist/gateway/static/root/assets/goals-page-jMzBJs6e.js +0 -2
  146. package/dist/gateway/static/root/assets/local-app-workbench-page-CseW9jD3.js +0 -2
  147. package/dist/gateway/static/root/assets/logs-page-DVqPbth5.js +0 -7
  148. package/dist/gateway/static/root/assets/notes-workbench-mrc3xtpn.js +0 -4
  149. package/dist/gateway/static/root/assets/project-detail-page-CfhPJLkH.js +0 -1
  150. package/dist/gateway/static/root/assets/projects-page-BfMoKjdm.js +0 -1
  151. package/dist/gateway/static/root/assets/remote-access-hub-CrDtcsZ9.js +0 -1
  152. package/dist/gateway/static/root/assets/sessions-page-D3DbF3dV.js +0 -1
  153. package/dist/gateway/static/root/assets/settings-advanced-gate-BZp0O2dH.js +0 -1
  154. package/dist/gateway/static/root/assets/setup-status-panel-84iao4DZ.js +0 -1
  155. package/dist/gateway/static/root/assets/shares-settings-DtcwQvRG.js +0 -1
  156. package/dist/gateway/static/root/assets/skill-reload-api-L7j5Gc8Z.js +0 -1
  157. package/dist/gateway/static/root/assets/skills-page-1Ps8PjsP.js +0 -2
  158. package/dist/gateway/static/root/assets/user-context-page-BYAAs2iW.js +0 -1
  159. package/dist/gateway/static/root/assets/work-discovery-page-J35JkJ7_.js +0 -1
  160. package/dist/gateway/static/root/assets/work-item-detail-page-C4wYDYqV.js +0 -1
  161. package/dist/gateway/static/root/assets/work-page-DMvitV6c.js +0 -1
  162. package/dist/gateway/static/root/assets/workflows-page-JMN0nMbM.js +0 -11
  163. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +0 -19
  164. package/dist/src/agent/embedded/xopc-auth-storage.js +0 -40
  165. package/dist/src/providers/xopc-cloud-connection.d.ts +0 -51
  166. package/dist/src/providers/xopc-cloud-connection.js +0 -196
@@ -1 +0,0 @@
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-JdwAhgNB.js";import{t as c}from"./messages-BzI9Wx30.js";import{n as ee}from"./locale-store-Ys6RP7Be.js";import{A as te,Aa as ne,Au as l,Dl as re,Fl as u,Gl as ie,Js as d,Lc as ae,Oc as oe,Os as f,Vl as se,Ws as ce,_u as p,a as m,bc as h,bo as g,f as le,l as ue,m as de,o as fe,p as pe,qc as _,rs as v,s as y,ts as me,u as b,uu as he,vt as x,xc as S}from"./index-HZdBKfk_.js";var C=n(),w=e(t(),1),T=r();function ge(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 E(e){return e?x(new Date(e)):``}function _e(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 ve(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)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function D(e){let t=(0,C.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,T.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,T.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ye(e){let t=(0,C.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,T.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,T.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,T.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:E(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,T.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function O(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function k(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=O(i),s=0;for(let e of O(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function A(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=o(),t=i(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,x]=(0,w.useState)(null),[C,O]=(0,w.useState)(null),[j,M]=(0,w.useState)([]),[N,be]=(0,w.useState)([]),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),W=(0,w.useRef)(null),G=g(e=>e.setPageHeader),K=g(e=>e.clearPageHeader),q=(0,w.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,w.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([ue(e),b(e).catch(()=>({events:[]}))]);x(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([ne(t.item.projectId).catch(()=>null),te().catch(()=>[])]),a=A(t.item,r,i);O(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,w.useEffect)(()=>{J()},[J]);let Y=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await le(r.id);x(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await m(r.id);x(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,w.useCallback)(async e=>{M((await b(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await pe(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});x(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,w.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await de(r.id,e);x(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,w.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await fe(r.id,e.id);x(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,w.useCallback)(async e=>{if(r){U(null);try{await y(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,C,e)>0).slice(0,3):[],[r,C,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,w.useLayoutEffect)(()=>(G({startExtra:(0,T.jsx)(a,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":C?.name?n.detail.backToProject.replace(`{{name}}`,C.name):n.detail.backToProjects,children:(0,T.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),main:(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(p,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,T.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,C?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,C?.name,q,G,n,C]),R?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,T.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(l,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(p,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,T.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,ge(r.status)),children:n.statuses[r.status]}),(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,T.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,T.jsx)(D,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,T.jsx)(D,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,T.jsx)(D,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,T.jsx)(D,{label:n.updated,value:E(r.updatedAt)})]})]}),(0,T.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,T.jsxs)(`section`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,T.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,T.jsx)(ye,{events:j,t:n})]}),(0,T.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(re,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,T.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,T.jsxs)(me,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,T.jsx)(v,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(v,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,T.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,T.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,T.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,T.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(ae,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,T.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,T.jsx)(u,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,T.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,_e(e.size)]})]}),(0,T.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:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,T.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0})}),(0,T.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:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,T.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,T.jsxs)(a,{to:ve(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,T.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,T.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,T.jsx)(se,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,T.jsxs)(a,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(he,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:C?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
@@ -1 +0,0 @@
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}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BzI9Wx30.js";import{n as u,o as d,r as f,s as p}from"./locale-store-Ys6RP7Be.js";import{n as m}from"./activity-store-Xj95LzTv.js";import{Ao as h,Bl as g,Bo as _,Eo as v,Fu as y,Ho as b,Ia as x,Ml as S,Oa as C,Oc as w,Os as T,Qa as E,Qc as D,Ro as O,So as k,Uo as A,Us as j,Vo as M,Wo as N,Ws as P,Yc as ee,bo as te,eu as ne,fu as F,hl as I,hu as re,ic as ie,js as ae,ku as L,mc as oe,nt as se,uu as ce,vt as le,zo as ue}from"./index-HZdBKfk_.js";var R=e(t(),1),z=n();function B(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function V(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=B(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=B(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function H(e,t){let n=e.kind===`goal`?`/api/goals/${encodeURIComponent(e.id)}`:`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var U=r(),W=3,de={info:{Icon:I,className:`text-accent-fg bg-accent-soft`},success:{Icon:ce,className:`text-success bg-success-soft`},warning:{Icon:j,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function G(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function K(e){let t=(0,z.c)(55),{item:n,targetAvailability:r}=e,i=u(J),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(q),{Icon:f,className:p}=de[n.tone],h;t[2]===p?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,p),t[2]=p,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,U.jsx)(D,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,U.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,U.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,U.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,U.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,U.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,U.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let C;t[22]!==n.updatedAt||t[23]!==i?(C=G(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,U.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let T;t[27]===n.occurrences?T=t[28]:(T=n.occurrences>1?(0,U.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=T);let O;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(O=n.href&&r===`available`?(0,U.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,U.jsx)(F,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,U.jsx)(E,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,U.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=O):O=t[34];let k;t[35]!==w||t[36]!==T||t[37]!==O||t[38]!==S?(k=(0,U.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,w,T,O]}),t[35]=w,t[36]=T,t[37]=O,t[38]=S,t[39]=k):k=t[39];let A;t[40]!==k||t[41]!==b||t[42]!==x?(A=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,k]}),t[40]=k,t[41]=b,t[42]=x,t[43]=A):A=t[43];let j;t[44]!==n.id||t[45]!==d?(j=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=j):j=t[46];let M;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,U.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),t[47]=M):M=t[47];let N;t[48]!==s.activityRemove||t[49]!==j?(N=(0,U.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:j,children:M}),t[48]=s.activityRemove,t[49]=j,t[50]=N):N=t[50];let P;return t[51]!==A||t[52]!==N||t[53]!==_?(P=(0,U.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,A,N]}),t[51]=A,t[52]=N,t[53]=_,t[54]=P):P=t[54],P}function q(e){return e.remove}function J(e){return e.language}function fe(){let e=(0,z.c)(12),t=l(u(ve)).projectsPage.workHome,n=m(_e),r=m(ge),i=m(he),[a,s]=(0,R.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,R.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(me),e[1]=n,e[2]=p);let h=p.length,g;e[3]===n?g=e[4]:(g=n.filter(pe),e[3]=n,e[4]=g);let _=g.length,v;e[5]!==a||e[6]!==n?(v=a?n:n.slice(0,W),e[5]=a,e[6]=n,e[7]=v):v=e[7];let b=v,x,S;e[8]===n?(x=e[9],S=e[10]):(x=()=>{let e=new AbortController,t=new Map(n.flatMap($));return f(Object.fromEntries([...t.keys()].map(Q))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await H(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(Z),()=>e.abort()},S=[n],e[8]=n,e[9]=x,e[10]=S),(0,R.useEffect)(x,S);let C;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,U.jsx)(y,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[11]=C):C=e[11],(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsx)(`div`,{children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,(0,U.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,U.jsx)(D,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):_>0?(0,U.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[_,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_>0?(0,U.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,U.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(X)?(0,U.jsxs)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,U.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,U.jsxs)(`div`,{className:`mt-3 px-1`,children:[b.map(e=>(0,U.jsx)(K,{item:e,targetAvailability:e.href&&V(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>W?(0,U.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(Y),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,U.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,U.jsx)(ne,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`p`,{children:t.activityEmpty})]})]})}function Y(e){return!e}function X(e){return e.status===`done`}function Z(){}function Q(e){return[e,`checking`]}function $(e){let t=V(e.href);return e.href&&t?[[e.href,t]]:[]}function pe(e){return!e.read}function me(e){return e.status===`running`}function he(e){return e.clearFinished}function ge(e){return e.markAllRead}function _e(e){return e.items}function ve(e){return e.language}function ye(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function be(e,t){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})})}function xe(e){return p(f(`/api/proactive/insights/${encodeURIComponent(e)}/approve`),{method:`POST`})}function Se(e,t){return p(f(`/api/focuses/${encodeURIComponent(e)}/calendar/${encodeURIComponent(t)}/prepare`),{method:`POST`})}function Ce(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function we(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Te(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:le(n)}function Ee(e){let t=(0,z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function De(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,U.jsx)(E,{className:`h-20 rounded-2xl`}),(0,U.jsx)(E,{className:`h-72 rounded-2xl`}),(0,U.jsx)(E,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Oe(e){let t=(0,z.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,U.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function ke(e){let t=(0,z.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,U.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,U.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,U.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,U.jsx)(T,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,U.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function Ae(e){let t=(0,z.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(S,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,U.jsx)(L,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=Te(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,U.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,U.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function je(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=i(),o=te(e=>e.setPageHeader),c=te(e=>e.clearPageHeader),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)([]),[y,S]=(0,R.useState)([]),[E,D]=(0,R.useState)(!0),[j,P]=(0,R.useState)(null),[F,I]=(0,R.useState)(null),[L,ce]=(0,R.useState)(``),[le,z]=(0,R.useState)(!1),[B,V]=(0,R.useState)(``),[H,W]=(0,R.useState)(!1),[de,G]=(0,R.useState)(null),[K,q]=(0,R.useState)(null),[J,Y]=(0,R.useState)(null),X=(0,R.useCallback)(async()=>{D(!0),P(null);try{let[t,n,r]=await Promise.all([ye(e),x({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),v()]);f(t),m(n.items),S(r)}catch(e){P(e instanceof Error?e.message:String(e))}finally{D(!1)}},[e]);(0,R.useEffect)(()=>{X()},[X]);let Z=(0,R.useMemo)(()=>{let e=L.trim().toLocaleLowerCase(),t=p.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[p,L]),Q=(0,R.useMemo)(()=>d?.decisions??[],[d]),$=(0,R.useMemo)(()=>d?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[d]),pe=(0,R.useCallback)(async t=>{t.preventDefault();let n=B.trim();if(!(!n||H)){W(!0),I(null);try{let t=await C({outcome:n,uiLocale:e});V(``),z(!1),r(`/projects/${encodeURIComponent(t.project.id)}`)}catch(e){I(e instanceof Error?e.message:String(e))}finally{W(!1)}}},[H,e,r,B]),me=(0,R.useMemo)(()=>(0,U.jsxs)(T,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>z(!0),children:[(0,U.jsx)(w,{className:`size-4`,"aria-hidden":!0}),n.workHome.newWork]}),[n.workHome.newWork]),he=(0,R.useCallback)(async(e,t)=>{if(e.response){G(e.id),P(null);try{await Ce(e.response,t),await X()}catch(e){P(e instanceof Error?e.message:String(e))}finally{G(null)}}},[X]),ge=(0,R.useCallback)(async(e,t)=>{q(e.id),P(null);try{let n=e.watches.find(e=>e.kind===t&&e.status===`active`);n?await h(e.id,n.id):await k(e.id,t),S(await v())}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}},[]),_e=(0,R.useCallback)(async(e,t)=>{Y(e),P(null);try{t===`approved`?await xe(e):await be(e,`dismissed`),f(t=>t&&{...t,proactiveInsights:t.proactiveInsights.filter(t=>t.id!==e)})}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}},[]),ve=(0,R.useCallback)(async(e,t)=>{q(e),P(null);try{await Se(e,t),S(await v())}catch(e){P(e instanceof Error?e.message:String(e))}finally{q(null)}},[]);return(0,R.useLayoutEffect)(()=>(o({startExtra:null,main:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,U.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:me}),()=>c()),[c,me,o,n.title,n.workHome.subtitle]),(0,U.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,U.jsx)(O,{open:le,onOpenChange:e=>{!e&&H||(z(e),e||I(null))},children:(0,U.jsxs)(A,{children:[(0,U.jsx)(b,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,U.jsxs)(_,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -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,U.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(N,{className:`text-base font-semibold text-fg`,children:n.workHome.delegateTitle}),(0,U.jsx)(M,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.workHome.delegateDescription})]}),(0,U.jsx)(ue,{asChild:!0,children:(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,disabled:H,children:(0,U.jsx)(ae,{className:`size-4`,"aria-hidden":!0})})})]}),(0,U.jsxs)(`form`,{onSubmit:pe,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,U.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.workHome.outcomeLabel}),(0,U.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:B,onChange:e=>V(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.workHome.outcomePlaceholder,maxLength:12e3,disabled:H,autoFocus:!0}),(0,U.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,U.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[B.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),F?(0,U.jsx)(`p`,{className:`mt-3 rounded-lg bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:F}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,U.jsx)(ue,{asChild:!0,children:(0,U.jsx)(T,{type:`button`,variant:`ghost`,disabled:H,children:n.cancel})}),(0,U.jsxs)(T,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:H||!B.trim(),children:[(0,U.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),H?n.workHome.delegating:n.workHome.delegate]})]})]})]})]})}),j?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,U.jsx)(`span`,{children:j}),(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.workHome.retry})]}):null,E?(0,U.jsx)(De,{}):d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,U.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:d.decisions.length>0?we(n.workHome.todaySummary,{attention:d.decisions.length,moving:d.briefing.progress.movingCount}):we(n.workHome.todaySummaryClear,{moving:d.briefing.progress.movingCount})}),d.briefing.summary?(0,U.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:d.briefing.summary}):null]}),d.proactiveInsights.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/20 p-5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(ie,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.insightsTitle}),(0,U.jsx)(Ee,{children:n.workHome.insightsBadge})]}),(0,U.jsx)(`div`,{className:`mt-4 space-y-3`,children:d.proactiveInsights.map(e=>(0,U.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,U.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.whyItMatters,`: `]}),e.whyItMatters]}),(0,U.jsxs)(`p`,{className:`mt-2 rounded-lg bg-surface-base px-3 py-2 text-xs leading-5 text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg`,children:[n.workHome.suggestedNext,`: `]}),e.nextAction]}),(0,U.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.evidence.map((e,t)=>(0,U.jsxs)(`span`,{className:`rounded-full border border-edge-subtle px-2 py-1 text-[11px] text-fg-subtle`,children:[e.label,e.source?` · ${e.source}`:``]},`${e.label}-${t}`))}),(0,U.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-edge-subtle pt-3`,children:[(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void _e(e.id,`dismissed`),children:n.workHome.dismissInsight}),(0,U.jsx)(T,{type:`button`,variant:`primary`,className:`h-8 px-2 text-xs`,disabled:J===e.id,onClick:()=>void _e(e.id,`approved`),children:n.workHome.investigateInsight})]})]},e.id))})]}):null,d.calendarSignals.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(re,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.relatedCalendarTitle}),(0,U.jsx)(Ee,{children:n.workHome.relatedCalendarBadge})]}),(0,U.jsx)(`div`,{className:`mt-4 divide-y divide-edge-subtle`,children:d.calendarSignals.map(e=>(0,U.jsxs)(`article`,{className:`flex flex-col gap-3 py-3 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.focusTitle,` · `,Te(e.startsAt,``)]})]}),(0,U.jsx)(T,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2 text-xs`,disabled:K===e.focusId,onClick:()=>void ve(e.focusId,e.id),children:K===e.focusId?n.workHome.focusWatchUpdating:n.workHome.prepareForEvent})]},e.id))})]}):null,y.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(g,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.focusesTitle}),(0,U.jsx)(Ee,{children:n.workHome.focusesBadge})]}),(0,U.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:y.slice(0,6).map(e=>{let t=e.watches.some(e=>e.kind===`progress`&&e.status===`active`),r=e.watches.some(e=>e.kind===`intelligence`&&e.status===`active`),i=t||r;return(0,U.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,U.jsx)(`span`,{className:`mt-0.5 size-2 shrink-0 rounded-full ${i?`bg-success`:`bg-fg-subtle/40`}`,"aria-hidden":!0})]}),e.blockedReason||e.nextAction?(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 border-t border-edge-subtle pt-3 text-xs leading-5 text-fg-muted`,children:e.blockedReason||e.nextAction}):null,(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:i?n.workHome.focusWatchActive:n.workHome.focusWatchInactive}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:K===e.id,onClick:()=>void ge(e,`progress`),children:K===e.id?n.workHome.focusWatchUpdating:t?n.workHome.pauseProgressWatch:n.workHome.startFocusWatch}),(0,U.jsx)(T,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:K===e.id,onClick:()=>void ge(e,`intelligence`),children:K===e.id?n.workHome.focusWatchUpdating:r?n.workHome.pauseNewsWatch:n.workHome.startNewsWatch})]})]})]},e.id)})})]}):null,d.work.current.length===0&&d.workflowRuns.active.length===0&&d.decisions.length===0&&d.upcomingAutomations.length===0&&y.length===0?(0,U.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,U.jsx)(ee,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,U.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,U.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,U.jsx)(T,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:n.workHome.startChat}),(0,U.jsx)(T,{type:`button`,variant:`secondary`,onClick:()=>z(!0),children:n.workHome.startLongWork})]})]}):null,(0,U.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Q.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.needsYou})]}),(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:Q.map(e=>(0,U.jsx)(ke,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:de===e.id,onRespond:t=>void he(e,t)},e.id))})]}):(0,U.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(ne,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.continueTitle})]}),(0,U.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[d.workflowRuns.active.map(e=>(0,U.jsxs)(a,{to:se(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),$.map(e=>(0,U.jsx)(`div`,{className:`py-1`,children:(0,U.jsx)(Oe,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),d.workflowRuns.active.length===0&&$.length===0?(0,U.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.workHome.noCurrentWork}):null]})]})]}),(0,U.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,U.jsx)(`div`,{className:`px-1`,children:(0,U.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle})}),d.upcomingAutomations.length>0?(0,U.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(re,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,U.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:d.upcomingAutomations.slice(0,3).map(e=>(0,U.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,U.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Te(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,U.jsx)(fe,{}),d.briefing.wins.length>0?(0,U.jsxs)(a,{to:d.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,U.jsx)(`span`,{children:we(n.workHome.completedSummary,{count:d.briefing.wins.length})}),(0,U.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]})]}):null,(0,U.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.workHome.spacesTitle}),(0,U.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),p.filter(e=>e.status!==`archived`).length>6?(0,U.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,U.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,U.jsx)(oe,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,U.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:L,onChange:e=>ce(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,U.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:Z.map(e=>(0,U.jsx)(Ae,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!E&&Z.length===0?(0,U.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{je as WorkPage};