pisper 0.6.43 → 0.6.44

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 (128) hide show
  1. package/package.json +6 -6
  2. package/web/.vite/manifest.json +690 -690
  3. package/web/assets/{AppDialog-Cv4YvRrF.js → AppDialog-BmhtqPq6.js} +1 -1
  4. package/web/assets/{AppOverlays-Du54VkDZ.js → AppOverlays-cyz0mMc9.js} +1 -1
  5. package/web/assets/{AssetsPage-TiFEC32s.js → AssetsPage-a_DNQXQF.js} +1 -1
  6. package/web/assets/{AttachmentTray-BI4I9xoX.js → AttachmentTray-Fx0RVdj2.js} +1 -1
  7. package/web/assets/{BoardPage-BBa6v_6k.js → BoardPage-CQF_701M.js} +3 -3
  8. package/web/assets/{ChannelsPage-BsQCgczL.js → ChannelsPage-C4sSuXef.js} +1 -1
  9. package/web/assets/{ChatAppearancePage-By82YAjZ.js → ChatAppearancePage-BA77E4RG.js} +1 -1
  10. package/web/assets/{ChatHistoryPage-a6EHRkRQ.js → ChatHistoryPage-Bo932avi.js} +1 -1
  11. package/web/assets/{ChatMessage-CrCe2TLj.js → ChatMessage-DyRMVDmJ.js} +3 -3
  12. package/web/assets/{ChatPage-BixfWP4y.js → ChatPage-Bh2srQ5Q.js} +3 -3
  13. package/web/assets/{ConfigPage-CcwhlyGO.js → ConfigPage-CRMPpPxz.js} +3 -3
  14. package/web/assets/{DesktopWindowControls-D3YeNjmV.js → DesktopWindowControls-QTt7BkHB.js} +1 -1
  15. package/web/assets/{FeaturePage-DyRo_I02.js → FeaturePage-DEjUrI25.js} +1 -1
  16. package/web/assets/{FileAttachmentPreview-LLowX6R-.js → FileAttachmentPreview-CU3DVCec.js} +1 -1
  17. package/web/assets/{FloatingWidgets-CgXdrX0y.js → FloatingWidgets-DsEUT3hG.js} +1 -1
  18. package/web/assets/{FocusRuntimeControls-LaHQWOPc.js → FocusRuntimeControls-CoxLbl8K.js} +1 -1
  19. package/web/assets/{GitDiffViewer-D6X8UoVx.js → GitDiffViewer-BFdi1mxr.js} +1 -1
  20. package/web/assets/{ManageProjectsDialog-D4HGh_Lh.js → ManageProjectsDialog-BpsBTKv5.js} +1 -1
  21. package/web/assets/{MarkdownMessage-COsYrsCd.js → MarkdownMessage-B9Bb9VQU.js} +1 -1
  22. package/web/assets/{McpPage-Bfqrm6Ua.js → McpPage-D1onf9RA.js} +1 -1
  23. package/web/assets/MemoryEvolution-D4d8ELda.js +1 -0
  24. package/web/assets/MemoryPage-BxeQ1cdR.js +2 -0
  25. package/web/assets/{MobileNavigation-Ci_zzYIj.js → MobileNavigation-DQcTpoYc.js} +1 -1
  26. package/web/assets/{MorePage-0bECKmUj.js → MorePage-DqfRiueD.js} +1 -1
  27. package/web/assets/{NewFolderDialog-Ctuw8Xt9.js → NewFolderDialog-dNstknkT.js} +1 -1
  28. package/web/assets/{PageHeader-DDHU5m0R.js → PageHeader-Bn_vZ-th.js} +1 -1
  29. package/web/assets/{PhoneDrawer-DZMbkdza.js → PhoneDrawer-BnWXS2P1.js} +1 -1
  30. package/web/assets/{PhoneMenuButton-BtAGHyzX.js → PhoneMenuButton-Coocnsrf.js} +1 -1
  31. package/web/assets/{PhoneTopBar-Cx1lw-iS.js → PhoneTopBar-DUJ9aeM3.js} +1 -1
  32. package/web/assets/{PluginsPage-iBWJo-Ux.js → PluginsPage-Z7Fx-eAU.js} +1 -1
  33. package/web/assets/{SafeModePrompt-CEOQ01Bl.js → SafeModePrompt-DaxOzv7_.js} +1 -1
  34. package/web/assets/{SchedulesPage-Dw3CQw8g.js → SchedulesPage-ZGP3g3Vt.js} +1 -1
  35. package/web/assets/{SessionBrowserPane-DzZvN-iz.js → SessionBrowserPane-DeOqkbLQ.js} +2 -2
  36. package/web/assets/{SessionContextPanel-D2MIRUxU.js → SessionContextPanel-Co419auw.js} +2 -2
  37. package/web/assets/{SessionHome-BTl_EcTv.js → SessionHome-3GRisRUv.js} +1 -1
  38. package/web/assets/{SessionInspector-BY9P2WuS.js → SessionInspector-KjdRXk-P.js} +1 -1
  39. package/web/assets/{SessionShell-DzIXzmYM.js → SessionShell-DrMljmEy.js} +1 -1
  40. package/web/assets/{SettingsSidebar-DxFdOSKE.js → SettingsSidebar-Bfgryx3X.js} +1 -1
  41. package/web/assets/{ShortcutHelpDialog-BhD8_tZa.js → ShortcutHelpDialog-BEv4kDZo.js} +1 -1
  42. package/web/assets/{ShortcutKeys-CAiqwRJW.js → ShortcutKeys-CFnZogMX.js} +1 -1
  43. package/web/assets/{SidebarUpdateStatus-StFlsvF7.js → SidebarUpdateStatus-BaQLz9Ha.js} +1 -1
  44. package/web/assets/{SkillsPage-9ff7FB_P.js → SkillsPage-DiBdvo55.js} +1 -1
  45. package/web/assets/{TaskProcessesPane-Cjti3REL.js → TaskProcessesPane-CgzN0Oqf.js} +1 -1
  46. package/web/assets/{TaskTerminalView-Bj9xJWSN.js → TaskTerminalView-E0ZkafSN.js} +1 -1
  47. package/web/assets/{TerminalPanel-BsVTDd6P.js → TerminalPanel-KwRTV-hb.js} +1 -1
  48. package/web/assets/{WebDesktopPet-B1QzBZFt.js → WebDesktopPet-CGpI6-UL.js} +1 -1
  49. package/web/assets/{WorkflowsPage-BW0PAk_6.js → WorkflowsPage-BCfAr_BN.js} +1 -1
  50. package/web/assets/{WorkspacePicker-Di59Kt67.js → WorkspacePicker-DyL_8DP0.js} +1 -1
  51. package/web/assets/{api-DMqZSAib.js → api-D1flkoh7.js} +1 -1
  52. package/web/assets/{app-update-B3x5F3G0.js → app-update-DWy3AK8N.js} +1 -1
  53. package/web/assets/{approval-confirm-2JlrhCJj.js → approval-confirm-CDGLUuxy.js} +1 -1
  54. package/web/assets/{assets-api-BYWPazKD.js → assets-api-BGMZsyC4.js} +1 -1
  55. package/web/assets/{board-projects-wULJ4QMT.js → board-projects-DjGBcX8k.js} +1 -1
  56. package/web/assets/{bots-store-BFSwqKxI.js → bots-store-Ck_jncK7.js} +1 -1
  57. package/web/assets/{chat-api-CbddSAiB.js → chat-api-BqA8nXly.js} +1 -1
  58. package/web/assets/{client-store-CQELNb0e.js → client-store-e4OXhDNK.js} +1 -1
  59. package/web/assets/{command-BLb6loUF.js → command-LVPgEdXI.js} +1 -1
  60. package/web/assets/{config-search-CEVepeo_.js → config-search-a0xjM1yz.js} +1 -1
  61. package/web/assets/{desktop-hosts-D5V4ltEO.js → desktop-hosts-DsTa6yr4.js} +2 -2
  62. package/web/assets/{dialog-nax_z9Og.js → dialog-DldLiTwf.js} +1 -1
  63. package/web/assets/{event-stream-CuxX_nc8.js → event-stream-DRv0u06j.js} +1 -1
  64. package/web/assets/{events-BgoXNekW.js → events-C8OUQmIW.js} +1 -1
  65. package/web/assets/{folder-paths-BxUl5vo9.js → folder-paths-CfRbR0Ik.js} +1 -1
  66. package/web/assets/{hosts-yZPjlvMS.js → hosts-DbXwJrWt.js} +1 -1
  67. package/web/assets/{http-D4AhfBV1.js → http-B-XVZUum.js} +1 -1
  68. package/web/assets/{http-response-BHt8SJKV.js → http-response-DEs9jkgT.js} +1 -1
  69. package/web/assets/i18n-DyMZgkZI.js +1 -0
  70. package/web/assets/{index-Dw3Kz26s.js → index-CiyAfWLi.js} +2 -2
  71. package/web/assets/{machine-messages-Dy3k2jL6.js → machine-messages-CKHf8pyL.js} +1 -1
  72. package/web/assets/{machines-api-C8KK5tCO.js → machines-api-BeimiMiu.js} +1 -1
  73. package/web/assets/{memory-api-apQzknw7.js → memory-api-Cu3MEsQE.js} +1 -1
  74. package/web/assets/{mount-app-CI5QAfkX.js → mount-app-ISo-f47e.js} +2 -2
  75. package/web/assets/{permission-rules-api-Ci2nr5hD.js → permission-rules-api-bHINce43.js} +1 -1
  76. package/web/assets/{pick-system-directory-BeHwgRu7.js → pick-system-directory-D1GGkOTf.js} +1 -1
  77. package/web/assets/{placements-Bca0DPqX.js → placements-9_rV4h0k.js} +2 -2
  78. package/web/assets/{popover-2hW0lH2e.js → popover-DGWRnOht.js} +1 -1
  79. package/web/assets/{public-BWzxxlQu.js → public-B7wKOz_X.js} +2 -2
  80. package/web/assets/{public-bMk6lfoD.js → public-DRF_OfnY.js} +1 -1
  81. package/web/assets/{public-CUh5RfpQ.js → public-Dr8_scp5.js} +2 -2
  82. package/web/assets/{public-components-COcMq_cr.js → public-components-by-7di2-.js} +1 -1
  83. package/web/assets/public-diff-pNrf0LGG.js +1 -0
  84. package/web/assets/public-events-DmLE1dVC.js +1 -0
  85. package/web/assets/{public-flags-2sXN0jOy.js → public-flags-DHN44K2T.js} +1 -1
  86. package/web/assets/{public-folder-dialog-BrY1IUjD.js → public-folder-dialog-Gkbm4LRI.js} +1 -1
  87. package/web/assets/{public-greeting-F27_o7CG.js → public-greeting-Bdpk4piS.js} +1 -1
  88. package/web/assets/{public-CvQSuCpU.js → public-lAWjPSYc.js} +1 -1
  89. package/web/assets/{public-session-BXcmWF--.js → public-session-CtusCiv8.js} +1 -1
  90. package/web/assets/{public-sidebar-rxvfp6cZ.js → public-sidebar-DmWVSBL3.js} +1 -1
  91. package/web/assets/{runtime-capabilities-store-BA14peh5.js → runtime-capabilities-store-MtXRlSIi.js} +1 -1
  92. package/web/assets/{safe-mode-instance-CpApZsNO.js → safe-mode-instance-CpOBP8Nz.js} +1 -1
  93. package/web/assets/safe-mode-sentinel-BGslsjrl.js +1 -0
  94. package/web/assets/{session-change-summary-api-zrzUcWPa.js → session-change-summary-api-CAkw4_-l.js} +1 -1
  95. package/web/assets/{session-home-cMbldWP4.js → session-home-CJcIlNWK.js} +1 -1
  96. package/web/assets/{session-inspector-store-CVt788oh.js → session-inspector-store-C3BluNoW.js} +1 -1
  97. package/web/assets/{session-questions-CFzjCrxi.js → session-questions-BPKyVhzp.js} +1 -1
  98. package/web/assets/{session-scope-DSz16bMk.js → session-scope-ddZfvpZE.js} +1 -1
  99. package/web/assets/{session-tree-actions-DejUCyUM.js → session-tree-actions-_YCQsWye.js} +1 -1
  100. package/web/assets/{session-tree-summary-Bjg79Vc5.js → session-tree-summary-BLsTrwUq.js} +1 -1
  101. package/web/assets/{session-web-preview-BUv0rBHy.js → session-web-preview-DZOVkeBU.js} +1 -1
  102. package/web/assets/{shortcuts-lvsdkhJa.js → shortcuts-C6ddcUau.js} +1 -1
  103. package/web/assets/{side-chat-context-D9g8NFwu.js → side-chat-context-C7vwSBGo.js} +4 -4
  104. package/web/assets/{sidebar-CtLMqJCy.js → sidebar-B7HP3-3A.js} +1 -1
  105. package/web/assets/{sidebar-store-QQPSgdSc.js → sidebar-store-Bv_D4lVD.js} +1 -1
  106. package/web/assets/{speech-session-C_7w5AfS.js → speech-session-DI3T3jpW.js} +1 -1
  107. package/web/assets/{startup-queries-CbAKsBHA.js → startup-queries-B2k6wlnS.js} +1 -1
  108. package/web/assets/{use-i18n-47vsdOU3.js → use-i18n-CsOCclo6.js} +1 -1
  109. package/web/assets/{use-open-bot-CHjqcvJF.js → use-open-bot-BPSaOfrG.js} +1 -1
  110. package/web/assets/{use-studio-actions-CMpatayc.js → use-studio-actions-Cvz4jiDa.js} +1 -1
  111. package/web/assets/{useCatalogProjects-t9qTve0q.js → useCatalogProjects-D3mDdYej.js} +1 -1
  112. package/web/assets/{useMachines-deaqc_F-.js → useMachines-BwvKcPVd.js} +1 -1
  113. package/web/assets/useNativeBrowser-CF8AHTRL.js +1 -0
  114. package/web/assets/{useNewProjectPicker-D5M2WzCG.js → useNewProjectPicker-DfE1or_O.js} +2 -2
  115. package/web/assets/{useNow-D1gmERNF.js → useNow-CuwOIh4H.js} +1 -1
  116. package/web/assets/{usePhoneShell-Bn3ZlBYr.js → usePhoneShell-e-CScTJH.js} +1 -1
  117. package/web/assets/{useSessionRowActions-C59wvHhe.js → useSessionRowActions-DUufel_k.js} +1 -1
  118. package/web/assets/{useSidebarModel-B9j6QP07.js → useSidebarModel-CShQi_Fw.js} +1 -1
  119. package/web/assets/{workspace-folders-VL22twQS.js → workspace-folders-Dq7V_wOF.js} +1 -1
  120. package/web/assets/{workspace-order-store-Cz2oC0mc.js → workspace-order-store-PI98x5sR.js} +1 -1
  121. package/web/index.html +1 -1
  122. package/web/assets/MemoryEvolution-B3gyPy3a.js +0 -1
  123. package/web/assets/MemoryPage-CpBDpgyx.js +0 -2
  124. package/web/assets/i18n-CHUj56MI.js +0 -1
  125. package/web/assets/public-diff-7U99QOFO.js +0 -1
  126. package/web/assets/public-events-DaY2zYrz.js +0 -1
  127. package/web/assets/safe-mode-sentinel-b5M49bjO.js +0 -1
  128. package/web/assets/useNativeBrowser-C0j3zafh.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-47vsdOU3.js";import{t as i}from"./x-07u4-129.js";import{t as a}from"./label-CVWjEcfV.js";import{t as o}from"./button-CCcCN8tE.js";import{a as s,i as c,l,n as u,t as d}from"./dialog-nax_z9Og.js";import{t as f}from"./input-CPw-zkYh.js";var p=e(t(),1),m=n();function h({dialog:e,onClose:t,onFinish:n,busy:h=!1}){let{t:g}=r(),[_,v]=(0,p.useState)(e?.value||``),y=(0,p.useRef)(null),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null),T=(0,p.useRef)(e);T.current=e;let E=h||b;(0,p.useEffect)(()=>()=>{T.current=null},[]),(0,p.useEffect)(()=>{v(e?.value||``),C(``),x(!1),w.current=null},[e]);let D=async r=>{if(r.preventDefault(),!e||E||w.current===e||e.type===`prompt`&&!_.trim())return;let i=e;w.current=e,x(!0),C(``);try{let r=n(e.type!==`prompt`||_.trim());r&&(await r,T.current===i&&t())}catch{T.current===i&&C(g(`common:ui.actionFailed`))}finally{w.current===i&&(w.current=null),T.current===i&&x(!1)}};return(0,m.jsx)(d,{open:!!e,busy:E,onOpenChange:e=>!e&&t(),children:e&&(0,m.jsx)(c,{showCloseButton:!1,size:`compact`,surface:`confirmation`,scrollMode:`body`,className:`gap-0 p-6`,onOpenAutoFocus:t=>{e.type===`prompt`&&(t.preventDefault(),y.current?.focus(),y.current?.select())},children:(0,m.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:e=>void D(e),children:[(0,m.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,m.jsx)(`div`,{className:`min-w-0`,children:(0,m.jsx)(l,{className:`text-[15px] leading-6 font-semibold tracking-[-.01em]`,children:e.title})}),(0,m.jsx)(o,{type:`button`,variant:`ghost`,size:`toolbar`,"aria-label":g(`common:ui.closeDialog`),title:g(`common:ui.closeDialog`),className:`size-7 shrink-0 px-0 text-content-muted`,disabled:E,onClick:t,children:(0,m.jsx)(i,{className:`size-4`})})]}),(0,m.jsxs)(u,{children:[(0,m.jsx)(s,{className:e.message?`mt-1.5 text-[13px] leading-5 whitespace-pre-line text-content-muted`:`sr-only`,children:e.message||e.title}),e.type===`prompt`&&(0,m.jsxs)(a,{className:`mt-4 block text-[13px] leading-5 font-medium text-content`,children:[e.inputLabel||g(`common:ui.name`),(0,m.jsx)(f,{ref:y,className:`mt-2 h-[34px] px-2.5 text-[13px]`,disabled:E,value:_,placeholder:e.placeholder,maxLength:e.maxLength||120,onChange:e=>v(e.target.value)})]}),S&&(0,m.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:S})]}),(0,m.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,m.jsx)(o,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:E,onClick:t,children:g(`common:ui.cancel`)}),(0,m.jsx)(o,{type:`submit`,size:`dialogAction`,loading:E,variant:e.tone===`danger`?`destructive`:`default`,disabled:e.type===`prompt`&&!_.trim(),children:e.confirmLabel||g(`common:ui.confirm`)})]})]})})})}export{h as AppDialog};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CsOCclo6.js";import{t as i}from"./x-07u4-129.js";import{t as a}from"./label-CVWjEcfV.js";import{t as o}from"./button-CCcCN8tE.js";import{a as s,i as c,l,n as u,t as d}from"./dialog-DldLiTwf.js";import{t as f}from"./input-CPw-zkYh.js";var p=e(t(),1),m=n();function h({dialog:e,onClose:t,onFinish:n,busy:h=!1}){let{t:g}=r(),[_,v]=(0,p.useState)(e?.value||``),y=(0,p.useRef)(null),[b,x]=(0,p.useState)(!1),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null),T=(0,p.useRef)(e);T.current=e;let E=h||b;(0,p.useEffect)(()=>()=>{T.current=null},[]),(0,p.useEffect)(()=>{v(e?.value||``),C(``),x(!1),w.current=null},[e]);let D=async r=>{if(r.preventDefault(),!e||E||w.current===e||e.type===`prompt`&&!_.trim())return;let i=e;w.current=e,x(!0),C(``);try{let r=n(e.type!==`prompt`||_.trim());r&&(await r,T.current===i&&t())}catch{T.current===i&&C(g(`common:ui.actionFailed`))}finally{w.current===i&&(w.current=null),T.current===i&&x(!1)}};return(0,m.jsx)(d,{open:!!e,busy:E,onOpenChange:e=>!e&&t(),children:e&&(0,m.jsx)(c,{showCloseButton:!1,size:`compact`,surface:`confirmation`,scrollMode:`body`,className:`gap-0 p-6`,onOpenAutoFocus:t=>{e.type===`prompt`&&(t.preventDefault(),y.current?.focus(),y.current?.select())},children:(0,m.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:e=>void D(e),children:[(0,m.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,m.jsx)(`div`,{className:`min-w-0`,children:(0,m.jsx)(l,{className:`text-[15px] leading-6 font-semibold tracking-[-.01em]`,children:e.title})}),(0,m.jsx)(o,{type:`button`,variant:`ghost`,size:`toolbar`,"aria-label":g(`common:ui.closeDialog`),title:g(`common:ui.closeDialog`),className:`size-7 shrink-0 px-0 text-content-muted`,disabled:E,onClick:t,children:(0,m.jsx)(i,{className:`size-4`})})]}),(0,m.jsxs)(u,{children:[(0,m.jsx)(s,{className:e.message?`mt-1.5 text-[13px] leading-5 whitespace-pre-line text-content-muted`:`sr-only`,children:e.message||e.title}),e.type===`prompt`&&(0,m.jsxs)(a,{className:`mt-4 block text-[13px] leading-5 font-medium text-content`,children:[e.inputLabel||g(`common:ui.name`),(0,m.jsx)(f,{ref:y,className:`mt-2 h-[34px] px-2.5 text-[13px]`,disabled:E,value:_,placeholder:e.placeholder,maxLength:e.maxLength||120,onChange:e=>v(e.target.value)})]}),S&&(0,m.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:S})]}),(0,m.jsxs)(`div`,{className:`mt-6 flex shrink-0 justify-end gap-2`,children:[(0,m.jsx)(o,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:E,onClick:t,children:g(`common:ui.cancel`)}),(0,m.jsx)(o,{type:`submit`,size:`dialogAction`,loading:E,variant:e.tone===`danger`?`destructive`:`default`,disabled:e.type===`prompt`&&!_.trim(),children:e.confirmLabel||g(`common:ui.confirm`)})]})]})})})}export{h as AppDialog};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-47vsdOU3.js";import{t as i}from"./useQuery-DfOU-27z.js";import{o as a}from"./startup-queries-CbAKsBHA.js";import{i as o}from"./runtime-capabilities-ChJVNwRz.js";import{t as s}from"./runtime-capabilities-store-BA14peh5.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./circle-alert-DCChabnT.js";import{t as u}from"./loader-circle-BOwQzHB-.js";import{t as ee}from"./message-square-SKjZyY3v.js";import{t as te}from"./plus-fQbSqB1n.js";import{t as d}from"./search-D0mqDaf_.js";import{t as ne}from"./square-terminal-BVG6cUT1.js";import{t as re}from"./tag-CqkeJlBf.js";import{t as ie}from"./utils-C8uzG5AZ.js";import{t as ae}from"./kbd-CAufZTkl.js";import{T as oe}from"./events-BgoXNekW.js";import{s as f}from"./shortcuts-lvsdkhJa.js";import{t as se}from"./chat-api-CbddSAiB.js";import{a as ce}from"./format-DMJQzoZ7.js";import{a as le,i as ue,l as de,t as fe}from"./dialog-nax_z9Og.js";import{t as pe}from"./useOverlayFocusReturn-NkxBSSjb.js";var me=c(`sun-moon`,[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715`,key:`xlf6rm`}],[`path`,{d:`M16 12a4 4 0 0 0-4-4`,key:`6vsxu`}],[`path`,{d:`m19 5-1.256 1.256`,key:`1yg6a6`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}]]),p=e(t(),1),m=n(),h=[`sessions`,`labels`,`actions`,`pages`];function he(e){let t=(e||``).replace(/[\\/]+$/,``);return t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1)}function g({navigation:e,onClose:t,onNavigate:n,onOpenSession:c,onNewChat:g,onToggleTheme:_}){let{t:v,language:y}=r(),b=f(`primaryAction`),x=f(`toggleTerminal`),S=(0,p.useId)(),ge=pe(!0),C=(0,p.useRef)(null),w=(0,p.useRef)(null),T=(0,p.useRef)(!1),E=(0,p.useRef)(!1),D=(0,p.useRef)({x:-1,y:-1}),[O,_e]=(0,p.useState)(oe),k=O.trim(),ve=s(e=>e.capabilities),A=!!window.pisperDesktop?.terminalProfiles&&o(ve,`terminal`),j=i(a(`sessions`)),{isError:M,refetch:N}=j,P=(0,p.useMemo)(()=>j.data?.sessions||[],[j.data]),[F,I]=(0,p.useState)([]),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(!1),[ye,be]=(0,p.useState)(0),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(``),[G,K]=(0,p.useState)(``),[q,J]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(B(!1),I([]),!k){R(!1);return}let e=new AbortController;R(!0);let t=window.setTimeout(()=>{se.searchSessionTreeLabels(k,12,e.signal).then(t=>{e.signal.aborted||(I(t.labels||[]),R(!1))},()=>{e.signal.aborted||(B(!0),R(!1))})},250);return()=>{e.abort(),window.clearTimeout(t)}},[k,ye]);let Y={actions:v(`navigation:appOverlays.actions`),pages:v(`navigation:appOverlays.pages`),labels:v(`navigation:appOverlays.labels`),sessions:v(`navigation:appOverlays.agentsAndSessions`)},xe=(0,p.useMemo)(()=>{let t=k.toLocaleLowerCase(y),r=(...e)=>!t||e.some(e=>String(e||``).toLocaleLowerCase(y).includes(t)),i=[],a=v(`navigation:appOverlays.newTask`);r(a,v(`navigation:appOverlays.newChat`),v(`navigation:appOverlays.actions`))&&i.push({id:`action:new-chat`,group:`actions`,Icon:te,label:a,hint:v(`navigation:appOverlays.actions`),shortcut:b,run:g});let o=v(`navigation:appOverlays.toggleTheme`);_&&r(o,v(`navigation:appOverlays.actions`),`theme`)&&i.push({id:`action:toggle-theme`,group:`actions`,Icon:me,label:o,hint:v(`navigation:appOverlays.actions`),run:_});let s=v(`navigation:pageHeader.toggleTerminal`);A&&r(s,v(`navigation:appOverlays.actions`),`terminal`)&&i.push({id:`action:toggle-terminal`,group:`actions`,Icon:ne,label:s,hint:v(`navigation:appOverlays.actions`),shortcut:x,run:()=>{window.dispatchEvent(new Event(`pisper:toggle-terminal`))}});for(let[t,a]of e)for(let[e,o,s]of a)r(o,t,e)&&i.push({id:`page:${e}`,group:`pages`,Icon:s,label:o,hint:t,run:()=>n(e)});let u=e=>{let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(y,{dateStyle:`medium`,timeStyle:`short`}).format(t):v(`navigation:appOverlays.unknownTime`)};for(let e of F){let t=u(e.sessionCreated||e.sessionModified),n=u(e.nodeTimestamp);i.push({id:`label:${e.sessionId}:${e.entryId}`,group:`labels`,Icon:re,label:e.label,hint:e.sessionName||v(`navigation:appOverlays.untitledChat`),meta:v(`navigation:appOverlays.labelResultTimes`,{sessionTime:t,nodeTime:n}),title:e.summary||e.label,run:()=>c(e.sessionId,e.entryId,e.active)})}z&&i.push({id:`retry:labels`,group:`labels`,Icon:l,label:v(`navigation:appOverlays.searchLabelsFailed`),hint:v(`common:pageTemplate.retry`),run:()=>be(e=>e+1),keepOpen:!0});let d=0;for(let e of[...P].sort((e,t)=>Date.parse(t.modified)-Date.parse(e.modified)))if(r(e.name,e.firstMessage)&&(i.push({id:`session:${e.id}`,group:`sessions`,Icon:ee,label:e.name||v(`navigation:appOverlays.untitledChat`),tag:!e.projectless&&he(e.cwd)||void 0,title:e.cwd||void 0,hint:ce(e.modified,y),run:()=>c(e.id)}),++d>=8))break;return M&&i.push({id:`retry:sessions`,group:`sessions`,Icon:l,label:v(`navigation:appOverlays.loadChatsFailed`),hint:v(`common:pageTemplate.retry`),run:()=>N(),keepOpen:!0}),h.flatMap(e=>i.filter(t=>t.group===e))},[k,y,F,z,e,n,g,c,_,P,M,N,v,A,x,b]),X=q?.query===O?q.entries:xe,Z=Math.max(0,X.findIndex(e=>e.id===V)),Q=X[Z];(0,p.useEffect)(()=>{w.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})},[V]);let Se=async e=>{if(!(!e||E.current)){E.current=!0,J(null),W(e.id),K(``);try{await e.run(),e.keepOpen||t()}catch{K(e.group===`labels`?v(`navigation:appOverlays.openLabeledTurnFailed`):v(`navigation:appOverlays.openResultFailed`))}finally{E.current=!1,W(``),C.current?.focus()}}},Ce=e=>{if(e.nativeEvent.isComposing||T.current||e.keyCode===229)return;if(E.current){e.preventDefault();return}let t=e=>{J(null),H(X[e]?.id??null)};if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;t(X.length?(Z+n+X.length)%X.length:0)}else if(e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey){let n=X.flatMap((e,t)=>t===0||e.group!==X[t-1].group?[t]:[]);if(n.length<2)return;e.preventDefault(),t(n[(n.findIndex(e=>X[e].group===Q?.group)+(e.shiftKey?-1:1)+n.length)%n.length])}else e.key===`Enter`&&(e.preventDefault(),Se(Q))},we=e=>{let t=k?e.toLocaleLowerCase(y).indexOf(k.toLocaleLowerCase(y)):-1;return t<0?e:(0,m.jsxs)(m.Fragment,{children:[e.slice(0,t),(0,m.jsx)(`mark`,{className:`bg-transparent font-semibold text-foreground`,children:e.slice(t,t+k.length)}),e.slice(t+k.length)]})},$=L||j.isPending;return(0,m.jsx)(fe,{open:!0,onOpenChange:e=>!e&&!E.current&&t(),children:(0,m.jsxs)(ue,{showCloseButton:!1,"aria-busy":!!U,"data-command-palette":!0,onCloseAutoFocus:ge,onEscapeKeyDown:e=>{(T.current||E.current)&&e.preventDefault()},onPointerDownOutside:e=>{E.current&&e.preventDefault()},className:`command-palette top-[max(16px,min(11vh,calc((100dvh-min(560px,90dvh))/2)))]! flex w-[min(620px,calc(100vw-32px))]! max-w-none! translate-y-0! flex-col gap-0 overflow-hidden rounded-[var(--r-lg)] border border-stroke bg-solid p-0 text-sm shadow-float ring-0 max-[650px]:w-[calc(100vw-16px)]!`,children:[(0,m.jsx)(de,{className:`sr-only`,children:v(`navigation:appOverlays.commandPalette`)}),(0,m.jsx)(le,{className:`sr-only`,children:v(`navigation:appOverlays.searchPagesChatsOrActions`)}),(0,m.jsxs)(`label`,{className:`flex min-h-[52px] shrink-0 items-center gap-2.5 border-b border-stroke-soft px-4 text-content-muted`,children:[(0,m.jsx)(d,{className:`size-[18px] shrink-0`,strokeWidth:1.75,"aria-hidden":`true`}),(0,m.jsx)(`input`,{ref:C,autoFocus:!0,role:`combobox`,"aria-label":v(`navigation:appOverlays.searchPagesChatsOrActions`),"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":S,"aria-activedescendant":Q?`${S}-${Z}`:void 0,className:`h-[52px] min-w-0 flex-1 border-0 bg-transparent text-base text-content caret-focus outline-none placeholder:text-content-muted`,value:O,readOnly:!!U,onChange:e=>{_e(e.target.value),H(null),J(null),K(``)},onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:Ce,placeholder:v(`navigation:appOverlays.searchPagesChatsOrActions`)}),U&&(0,m.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":`true`})]}),U&&(0,m.jsx)(`span`,{role:`status`,className:`sr-only`,children:U.startsWith(`label:`)?v(`navigation:appOverlays.locatingLabel`):v(`common:pageTemplate.loading`)}),G&&(0,m.jsx)(`div`,{role:`alert`,className:`border-b border-stroke-soft px-4 py-2 text-sm text-content`,children:G}),(0,m.jsxs)(`div`,{id:S,ref:w,className:`max-h-[min(440px,max(120px,calc(90dvh-104px)))] overflow-y-auto overscroll-contain px-2 pb-2`,role:`listbox`,"aria-busy":$,"aria-label":v(`navigation:appOverlays.commandPalette`),onPointerMove:e=>{let t=D.current;D.current={x:e.clientX,y:e.clientY},e.pointerType!==`touch`&&X.length&&(e.clientX!==t.x||e.clientY!==t.y)&&q?.query!==O&&J({query:O,entries:X})},onPointerLeave:()=>{D.current={x:-1,y:-1},J(null)},onPointerCancel:()=>J(null),children:[h.map(e=>{let t=X.filter(t=>t.group===e);return t.length?(0,m.jsxs)(`div`,{role:`group`,"aria-label":Y[e],className:`-mx-2 px-2 [&+&]:border-t [&+&]:border-stroke-soft`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 pt-2.5 pb-1 text-xs text-content-muted`,children:[Y[e],e===`labels`&&L&&(0,m.jsx)(u,{className:`size-3 animate-spin`,"aria-hidden":`true`})]}),t.map(e=>{let t=X.indexOf(e);return(0,m.jsxs)(`button`,{id:`${S}-${t}`,type:`button`,tabIndex:-1,role:`option`,"aria-selected":t===Z,"aria-disabled":!!U,"aria-busy":U===e.id,title:e.title,className:ie(`palette-item flex min-h-9 w-full items-center gap-2.5 rounded-[var(--r-md)] px-2.5 py-1.5 text-left text-sm text-content outline-none hover:bg-surface-hover focus-visible:bg-surface-hover aria-disabled:opacity-40 max-[650px]:min-h-11 pointer-coarse:min-h-11 [&_svg]:text-content-muted`,t===Z&&`bg-surface-hover`),onPointerMove:()=>{E.current||H(e.id)},onMouseDown:e=>e.preventDefault(),onClick:()=>void Se(e),children:[U===e.id?(0,m.jsx)(u,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":`true`}):(0,m.jsx)(e.Icon,{className:`size-4 shrink-0`,strokeWidth:1.75,"aria-hidden":`true`}),(0,m.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,m.jsx)(`span`,{className:`min-w-0 truncate`,children:we(e.label)}),e.tag&&(0,m.jsx)(`span`,{className:`min-w-0 shrink-[2] truncate font-mono text-xs text-content-muted`,children:e.tag})]}),e.meta&&(0,m.jsx)(`span`,{className:`block truncate text-xs text-content-muted`,children:e.meta})]}),e.shortcut?(0,m.jsx)(ae,{"aria-hidden":`true`,className:`shrink-0 border-transparent bg-transparent text-content-muted shadow-none pointer-coarse:hidden`,children:e.shortcut}):(0,m.jsx)(`span`,{className:`max-w-28 shrink-0 truncate text-right text-xs text-content-muted tabular-nums`,children:e.hint})]},e.id)})]},e):null}),$&&(0,m.jsx)(`div`,{role:`status`,className:`px-2.5 py-2 text-sm text-content-muted`,children:v(`navigation:appOverlays.searchingLabels`)}),!X.length&&!$&&(0,m.jsx)(`div`,{role:`status`,className:`px-3 py-6 text-center text-sm text-content-muted`,children:v(`navigation:appOverlays.noMatchingResults`)})]}),(0,m.jsxs)(`div`,{"aria-hidden":`true`,"data-palette-hints":!0,className:`flex h-9 flex-none items-center gap-3 border-t border-stroke-soft px-4 text-xs text-content-muted pointer-coarse:hidden max-[650px]:hidden`,children:[(0,m.jsxs)(`span`,{children:[`↑↓ `,v(`navigation:appOverlays.hintSelect`)]}),(0,m.jsxs)(`span`,{children:[`↵ `,v(`navigation:appOverlays.hintOpen`)]}),(0,m.jsxs)(`span`,{children:[`Tab `,v(`navigation:appOverlays.hintGroups`)]}),(0,m.jsxs)(`span`,{className:`ml-auto`,children:[`Esc `,v(`navigation:appOverlays.hintClose`)]})]})]})})}export{g as CommandPalette};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CsOCclo6.js";import{t as i}from"./useQuery-DfOU-27z.js";import{o as a}from"./startup-queries-B2k6wlnS.js";import{i as o}from"./runtime-capabilities-ChJVNwRz.js";import{t as s}from"./runtime-capabilities-store-MtXRlSIi.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./circle-alert-DCChabnT.js";import{t as u}from"./loader-circle-BOwQzHB-.js";import{t as ee}from"./message-square-SKjZyY3v.js";import{t as te}from"./plus-fQbSqB1n.js";import{t as d}from"./search-D0mqDaf_.js";import{t as ne}from"./square-terminal-BVG6cUT1.js";import{t as re}from"./tag-CqkeJlBf.js";import{t as ie}from"./utils-C8uzG5AZ.js";import{t as ae}from"./kbd-CAufZTkl.js";import{T as oe}from"./events-C8OUQmIW.js";import{s as f}from"./shortcuts-C6ddcUau.js";import{t as se}from"./chat-api-BqA8nXly.js";import{a as ce}from"./format-DMJQzoZ7.js";import{a as le,i as ue,l as de,t as fe}from"./dialog-DldLiTwf.js";import{t as pe}from"./useOverlayFocusReturn-NkxBSSjb.js";var me=c(`sun-moon`,[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715`,key:`xlf6rm`}],[`path`,{d:`M16 12a4 4 0 0 0-4-4`,key:`6vsxu`}],[`path`,{d:`m19 5-1.256 1.256`,key:`1yg6a6`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}]]),p=e(t(),1),m=n(),h=[`sessions`,`labels`,`actions`,`pages`];function he(e){let t=(e||``).replace(/[\\/]+$/,``);return t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1)}function g({navigation:e,onClose:t,onNavigate:n,onOpenSession:c,onNewChat:g,onToggleTheme:_}){let{t:v,language:y}=r(),b=f(`primaryAction`),x=f(`toggleTerminal`),S=(0,p.useId)(),ge=pe(!0),C=(0,p.useRef)(null),w=(0,p.useRef)(null),T=(0,p.useRef)(!1),E=(0,p.useRef)(!1),D=(0,p.useRef)({x:-1,y:-1}),[O,_e]=(0,p.useState)(oe),k=O.trim(),ve=s(e=>e.capabilities),A=!!window.pisperDesktop?.terminalProfiles&&o(ve,`terminal`),j=i(a(`sessions`)),{isError:M,refetch:N}=j,P=(0,p.useMemo)(()=>j.data?.sessions||[],[j.data]),[F,I]=(0,p.useState)([]),[L,R]=(0,p.useState)(!1),[z,B]=(0,p.useState)(!1),[ye,be]=(0,p.useState)(0),[V,H]=(0,p.useState)(null),[U,W]=(0,p.useState)(``),[G,K]=(0,p.useState)(``),[q,J]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(B(!1),I([]),!k){R(!1);return}let e=new AbortController;R(!0);let t=window.setTimeout(()=>{se.searchSessionTreeLabels(k,12,e.signal).then(t=>{e.signal.aborted||(I(t.labels||[]),R(!1))},()=>{e.signal.aborted||(B(!0),R(!1))})},250);return()=>{e.abort(),window.clearTimeout(t)}},[k,ye]);let Y={actions:v(`navigation:appOverlays.actions`),pages:v(`navigation:appOverlays.pages`),labels:v(`navigation:appOverlays.labels`),sessions:v(`navigation:appOverlays.agentsAndSessions`)},xe=(0,p.useMemo)(()=>{let t=k.toLocaleLowerCase(y),r=(...e)=>!t||e.some(e=>String(e||``).toLocaleLowerCase(y).includes(t)),i=[],a=v(`navigation:appOverlays.newTask`);r(a,v(`navigation:appOverlays.newChat`),v(`navigation:appOverlays.actions`))&&i.push({id:`action:new-chat`,group:`actions`,Icon:te,label:a,hint:v(`navigation:appOverlays.actions`),shortcut:b,run:g});let o=v(`navigation:appOverlays.toggleTheme`);_&&r(o,v(`navigation:appOverlays.actions`),`theme`)&&i.push({id:`action:toggle-theme`,group:`actions`,Icon:me,label:o,hint:v(`navigation:appOverlays.actions`),run:_});let s=v(`navigation:pageHeader.toggleTerminal`);A&&r(s,v(`navigation:appOverlays.actions`),`terminal`)&&i.push({id:`action:toggle-terminal`,group:`actions`,Icon:ne,label:s,hint:v(`navigation:appOverlays.actions`),shortcut:x,run:()=>{window.dispatchEvent(new Event(`pisper:toggle-terminal`))}});for(let[t,a]of e)for(let[e,o,s]of a)r(o,t,e)&&i.push({id:`page:${e}`,group:`pages`,Icon:s,label:o,hint:t,run:()=>n(e)});let u=e=>{let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(y,{dateStyle:`medium`,timeStyle:`short`}).format(t):v(`navigation:appOverlays.unknownTime`)};for(let e of F){let t=u(e.sessionCreated||e.sessionModified),n=u(e.nodeTimestamp);i.push({id:`label:${e.sessionId}:${e.entryId}`,group:`labels`,Icon:re,label:e.label,hint:e.sessionName||v(`navigation:appOverlays.untitledChat`),meta:v(`navigation:appOverlays.labelResultTimes`,{sessionTime:t,nodeTime:n}),title:e.summary||e.label,run:()=>c(e.sessionId,e.entryId,e.active)})}z&&i.push({id:`retry:labels`,group:`labels`,Icon:l,label:v(`navigation:appOverlays.searchLabelsFailed`),hint:v(`common:pageTemplate.retry`),run:()=>be(e=>e+1),keepOpen:!0});let d=0;for(let e of[...P].sort((e,t)=>Date.parse(t.modified)-Date.parse(e.modified)))if(r(e.name,e.firstMessage)&&(i.push({id:`session:${e.id}`,group:`sessions`,Icon:ee,label:e.name||v(`navigation:appOverlays.untitledChat`),tag:!e.projectless&&he(e.cwd)||void 0,title:e.cwd||void 0,hint:ce(e.modified,y),run:()=>c(e.id)}),++d>=8))break;return M&&i.push({id:`retry:sessions`,group:`sessions`,Icon:l,label:v(`navigation:appOverlays.loadChatsFailed`),hint:v(`common:pageTemplate.retry`),run:()=>N(),keepOpen:!0}),h.flatMap(e=>i.filter(t=>t.group===e))},[k,y,F,z,e,n,g,c,_,P,M,N,v,A,x,b]),X=q?.query===O?q.entries:xe,Z=Math.max(0,X.findIndex(e=>e.id===V)),Q=X[Z];(0,p.useEffect)(()=>{w.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})},[V]);let Se=async e=>{if(!(!e||E.current)){E.current=!0,J(null),W(e.id),K(``);try{await e.run(),e.keepOpen||t()}catch{K(e.group===`labels`?v(`navigation:appOverlays.openLabeledTurnFailed`):v(`navigation:appOverlays.openResultFailed`))}finally{E.current=!1,W(``),C.current?.focus()}}},Ce=e=>{if(e.nativeEvent.isComposing||T.current||e.keyCode===229)return;if(E.current){e.preventDefault();return}let t=e=>{J(null),H(X[e]?.id??null)};if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let n=e.key===`ArrowDown`?1:-1;t(X.length?(Z+n+X.length)%X.length:0)}else if(e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey){let n=X.flatMap((e,t)=>t===0||e.group!==X[t-1].group?[t]:[]);if(n.length<2)return;e.preventDefault(),t(n[(n.findIndex(e=>X[e].group===Q?.group)+(e.shiftKey?-1:1)+n.length)%n.length])}else e.key===`Enter`&&(e.preventDefault(),Se(Q))},we=e=>{let t=k?e.toLocaleLowerCase(y).indexOf(k.toLocaleLowerCase(y)):-1;return t<0?e:(0,m.jsxs)(m.Fragment,{children:[e.slice(0,t),(0,m.jsx)(`mark`,{className:`bg-transparent font-semibold text-foreground`,children:e.slice(t,t+k.length)}),e.slice(t+k.length)]})},$=L||j.isPending;return(0,m.jsx)(fe,{open:!0,onOpenChange:e=>!e&&!E.current&&t(),children:(0,m.jsxs)(ue,{showCloseButton:!1,"aria-busy":!!U,"data-command-palette":!0,onCloseAutoFocus:ge,onEscapeKeyDown:e=>{(T.current||E.current)&&e.preventDefault()},onPointerDownOutside:e=>{E.current&&e.preventDefault()},className:`command-palette top-[max(16px,min(11vh,calc((100dvh-min(560px,90dvh))/2)))]! flex w-[min(620px,calc(100vw-32px))]! max-w-none! translate-y-0! flex-col gap-0 overflow-hidden rounded-[var(--r-lg)] border border-stroke bg-solid p-0 text-sm shadow-float ring-0 max-[650px]:w-[calc(100vw-16px)]!`,children:[(0,m.jsx)(de,{className:`sr-only`,children:v(`navigation:appOverlays.commandPalette`)}),(0,m.jsx)(le,{className:`sr-only`,children:v(`navigation:appOverlays.searchPagesChatsOrActions`)}),(0,m.jsxs)(`label`,{className:`flex min-h-[52px] shrink-0 items-center gap-2.5 border-b border-stroke-soft px-4 text-content-muted`,children:[(0,m.jsx)(d,{className:`size-[18px] shrink-0`,strokeWidth:1.75,"aria-hidden":`true`}),(0,m.jsx)(`input`,{ref:C,autoFocus:!0,role:`combobox`,"aria-label":v(`navigation:appOverlays.searchPagesChatsOrActions`),"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":S,"aria-activedescendant":Q?`${S}-${Z}`:void 0,className:`h-[52px] min-w-0 flex-1 border-0 bg-transparent text-base text-content caret-focus outline-none placeholder:text-content-muted`,value:O,readOnly:!!U,onChange:e=>{_e(e.target.value),H(null),J(null),K(``)},onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:Ce,placeholder:v(`navigation:appOverlays.searchPagesChatsOrActions`)}),U&&(0,m.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":`true`})]}),U&&(0,m.jsx)(`span`,{role:`status`,className:`sr-only`,children:U.startsWith(`label:`)?v(`navigation:appOverlays.locatingLabel`):v(`common:pageTemplate.loading`)}),G&&(0,m.jsx)(`div`,{role:`alert`,className:`border-b border-stroke-soft px-4 py-2 text-sm text-content`,children:G}),(0,m.jsxs)(`div`,{id:S,ref:w,className:`max-h-[min(440px,max(120px,calc(90dvh-104px)))] overflow-y-auto overscroll-contain px-2 pb-2`,role:`listbox`,"aria-busy":$,"aria-label":v(`navigation:appOverlays.commandPalette`),onPointerMove:e=>{let t=D.current;D.current={x:e.clientX,y:e.clientY},e.pointerType!==`touch`&&X.length&&(e.clientX!==t.x||e.clientY!==t.y)&&q?.query!==O&&J({query:O,entries:X})},onPointerLeave:()=>{D.current={x:-1,y:-1},J(null)},onPointerCancel:()=>J(null),children:[h.map(e=>{let t=X.filter(t=>t.group===e);return t.length?(0,m.jsxs)(`div`,{role:`group`,"aria-label":Y[e],className:`-mx-2 px-2 [&+&]:border-t [&+&]:border-stroke-soft`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 pt-2.5 pb-1 text-xs text-content-muted`,children:[Y[e],e===`labels`&&L&&(0,m.jsx)(u,{className:`size-3 animate-spin`,"aria-hidden":`true`})]}),t.map(e=>{let t=X.indexOf(e);return(0,m.jsxs)(`button`,{id:`${S}-${t}`,type:`button`,tabIndex:-1,role:`option`,"aria-selected":t===Z,"aria-disabled":!!U,"aria-busy":U===e.id,title:e.title,className:ie(`palette-item flex min-h-9 w-full items-center gap-2.5 rounded-[var(--r-md)] px-2.5 py-1.5 text-left text-sm text-content outline-none hover:bg-surface-hover focus-visible:bg-surface-hover aria-disabled:opacity-40 max-[650px]:min-h-11 pointer-coarse:min-h-11 [&_svg]:text-content-muted`,t===Z&&`bg-surface-hover`),onPointerMove:()=>{E.current||H(e.id)},onMouseDown:e=>e.preventDefault(),onClick:()=>void Se(e),children:[U===e.id?(0,m.jsx)(u,{className:`size-4 shrink-0 animate-spin`,"aria-hidden":`true`}):(0,m.jsx)(e.Icon,{className:`size-4 shrink-0`,strokeWidth:1.75,"aria-hidden":`true`}),(0,m.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,m.jsx)(`span`,{className:`min-w-0 truncate`,children:we(e.label)}),e.tag&&(0,m.jsx)(`span`,{className:`min-w-0 shrink-[2] truncate font-mono text-xs text-content-muted`,children:e.tag})]}),e.meta&&(0,m.jsx)(`span`,{className:`block truncate text-xs text-content-muted`,children:e.meta})]}),e.shortcut?(0,m.jsx)(ae,{"aria-hidden":`true`,className:`shrink-0 border-transparent bg-transparent text-content-muted shadow-none pointer-coarse:hidden`,children:e.shortcut}):(0,m.jsx)(`span`,{className:`max-w-28 shrink-0 truncate text-right text-xs text-content-muted tabular-nums`,children:e.hint})]},e.id)})]},e):null}),$&&(0,m.jsx)(`div`,{role:`status`,className:`px-2.5 py-2 text-sm text-content-muted`,children:v(`navigation:appOverlays.searchingLabels`)}),!X.length&&!$&&(0,m.jsx)(`div`,{role:`status`,className:`px-3 py-6 text-center text-sm text-content-muted`,children:v(`navigation:appOverlays.noMatchingResults`)})]}),(0,m.jsxs)(`div`,{"aria-hidden":`true`,"data-palette-hints":!0,className:`flex h-9 flex-none items-center gap-3 border-t border-stroke-soft px-4 text-xs text-content-muted pointer-coarse:hidden max-[650px]:hidden`,children:[(0,m.jsxs)(`span`,{children:[`↑↓ `,v(`navigation:appOverlays.hintSelect`)]}),(0,m.jsxs)(`span`,{children:[`↵ `,v(`navigation:appOverlays.hintOpen`)]}),(0,m.jsxs)(`span`,{children:[`Tab `,v(`navigation:appOverlays.hintGroups`)]}),(0,m.jsxs)(`span`,{className:`ml-auto`,children:[`Esc `,v(`navigation:appOverlays.hintClose`)]})]})]})})}export{g as CommandPalette};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-47vsdOU3.js";import{r as i,t as a}from"./useQuery-DfOU-27z.js";import{t as o}from"./queryOptions-Dfvzj6n2.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./download-BCfIiuaL.js";import{t as l}from"./external-link-CEQqPcqc.js";import{t as u}from"./file-Bllajneu.js";import{t as d}from"./link-2-mgasYn21.js";import{t as f}from"./paperclip-BCXrwYpb.js";import{t as p}from"./plus-fQbSqB1n.js";import{t as m}from"./refresh-cw-TbWxTY4K.js";import{t as h}from"./trash-2-CNrPOoPR.js";import{t as g}from"./triangle-alert-CE1q54ci.js";import{t as _}from"./x-07u4-129.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{a as y,c as ee,n as b,o as x,p as te,r as ne,s as re,t as ie}from"./dropdown-menu-Ds0gD8S8.js";import{n as ae,t as S}from"./button-CCcCN8tE.js";import{s as oe}from"./shortcuts-lvsdkhJa.js";import{n as C}from"./format-DMJQzoZ7.js";import{a as w,i as T,l as E,n as D,o as O,s as k,t as A}from"./dialog-nax_z9Og.js";import{t as j}from"./input-CPw-zkYh.js";import{n as M}from"./PageState-Cz6vFMXv.js";import{a as se,i as N,n as ce,o as le,r as ue,s as de,t as P}from"./FeaturePage-DyRo_I02.js";import{n as F}from"./mobile-runtime-recovery-tbTyacip.js";import{n as I}from"./field-DoLEb0np.js";import{i as L,n as R,r as z}from"./assets-api-BYWPazKD.js";import{t as B}from"./MarkdownMessage-COsYrsCd.js";var V=s(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),H=s(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),fe=s(`list-filter`,[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]),U=e(t(),1),W=134217728;function G(e){let t=document.createElement(`a`);t.href=`/api/assets/${encodeURIComponent(e.id)}/download`,t.download=e.name,t.hidden=!0,document.body.append(t),t.click(),t.remove()}function K(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error||Error(`读取资产失败。`)),r.onload=()=>{let e=typeof r.result==`string`?r.result:``,i=e.indexOf(`,`);i<0?n(Error(`资产编码失败。`)):t(e.slice(i+1))},r.readAsDataURL(e)})}function q(){if(typeof window>`u`)return!1;let e=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return!!(window.pisperDesktop?.openAsset||window.__PISPER_MOBILE_APP__&&e)}async function pe(e){let t=window.pisperDesktop?.openAsset,n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;if(!t&&!(window.__PISPER_MOBILE_APP__&&n))return G(e),`download`;await F();let r=await fetch(`/api/assets/${encodeURIComponent(e.id)}/download`);if(!r.ok)throw Error(`资产下载失败 (${r.status})`);if((Number(r.headers.get(`content-length`))||0)>W)throw Error(`资产超过 128 MB 原生打开限制。`);let i=await r.blob();if(!i.size||i.size>W)throw Error(`资产内容为空或超过 128 MB 原生打开限制。`);let a=await K(i);return t?await t({name:e.name,data:a}):await n?.(`mobile_open_asset`,{input:{name:e.name,mimeType:e.mimeType||i.type||`application/octet-stream`,data:a}}),`application`}var J=n();function me({onClose:e,onCreated:t}){let{t:n}=r(),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(``),f=(0,U.useRef)(!1),m=(0,U.useRef)(!0);return(0,U.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,J.jsx)(A,{open:!0,busy:c,onOpenChange:t=>{!t&&!f.current&&e()},children:(0,J.jsx)(T,{size:`compact`,scrollMode:`body`,children:(0,J.jsxs)(`form`,{className:`flex min-h-0 flex-col gap-4`,onSubmit:async e=>{if(e.preventDefault(),f.current)return;f.current=!0,l(!0),d(``);let n=!1;try{await z.createLink({name:i,url:o}),n=!0}catch(e){m.current&&d(e instanceof Error?e.message:String(e))}finally{f.current=!1,m.current&&l(!1)}n&&t()},"aria-busy":c||void 0,children:[(0,J.jsxs)(k,{className:`pr-8`,children:[(0,J.jsx)(E,{children:n(`assets:assetsPage.addLinkAsset`)}),(0,J.jsx)(w,{children:n(`assets:assetsPage.linksCanBeArchivedOpenedOrAddedToAChatAsContext`)})]}),(0,J.jsxs)(D,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(I,{variant:`control`,children:[n(`assets:assetsPage.name`),(0,J.jsx)(j,{value:i,disabled:c,onChange:e=>a(e.target.value),placeholder:n(`assets:assetsPage.forExampleOpenAIAPIDocs`)})]}),(0,J.jsxs)(I,{variant:`control`,children:[`URL`,(0,J.jsx)(j,{className:`font-mono`,value:o,disabled:c,onChange:e=>s(e.target.value),placeholder:`https://example.com/docs`})]}),u&&(0,J.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:u})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(S,{variant:`secondary`,size:`dialogAction`,disabled:c,onClick:e,children:n(`assets:assetsPage.cancel`)}),(0,J.jsxs)(S,{type:`submit`,size:`dialogAction`,loading:c,disabled:c||!o.trim(),children:[(0,J.jsx)(p,{}),n(c?`assets:assetsPage.adding`:`assets:assetsPage.addLink`)]})]})]})})})}var Y=[`assets`,`list`];function he(e={}){let t=L(e);return o({queryKey:[...Y,t],queryFn:({signal:e})=>z.list(t,e),staleTime:0,retry:!1})}function X(e,t){return o({queryKey:[`assets`,`preview`,e,t],queryFn:({signal:t})=>z.preview(e,t),staleTime:0,gcTime:0,retry:!1})}async function Z(e){await e.cancelQueries({queryKey:Y}),await e.invalidateQueries({queryKey:Y})}function ge({asset:e,generation:t,trigger:n,fallback:i,onClose:o,onUse:s,onOpen:d,busy:p,actionError:m}){let{t:h}=r(),_=e.mimeType?.startsWith(`video/`),v=e.kind===`image`||_,y=a({...X(e.id,t),enabled:!v&&e.kind!==`link`}),[ee,b]=(0,U.useState)(!1),[x,te]=(0,U.useState)(0),ne=/\.md$/i.test(e.name)||e.mimeType===`text/markdown`;return(0,J.jsx)(A,{open:!0,onOpenChange:e=>{e||o()},children:(0,J.jsxs)(T,{size:`wide`,scrollMode:`body`,className:`w-[min(96vw,1200px)] max-w-[min(96vw,1200px)]`,onCloseAutoFocus:e=>{e.preventDefault();let t=e=>e?.isConnected&&e.getClientRects().length&&getComputedStyle(e).visibility!==`hidden`,r=t(n)?n:i();t(r)&&r?.focus({preventScroll:!0})},children:[(0,J.jsxs)(k,{className:`pr-8`,children:[(0,J.jsx)(E,{className:`break-words leading-6`,children:e.name}),(0,J.jsx)(w,{className:`font-mono break-words tabular-nums`,children:e.kind===`link`?e.url:`${e.mimeType||``} · ${C(e.size)}`})]}),(0,J.jsxs)(D,{className:`min-h-[min(240px,30dvh)] rounded-md border border-stroke bg-surface-subtle p-3`,children:[v?ee?(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 p-4 text-sm`,children:[(0,J.jsx)(g,{className:`size-5 text-danger`}),(0,J.jsx)(`p`,{children:h(`assets:assetsPage.mediaFailed`)}),(0,J.jsx)(S,{variant:`secondary`,onClick:()=>{b(!1),te(e=>e+1)},children:h(`assets:assetsPage.retry`)})]}):_?(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,className:`mx-auto max-h-[65dvh] w-full object-contain`,src:R(e.id),onError:()=>b(!0)},x):(0,J.jsx)(`img`,{className:`mx-auto max-h-[65dvh] max-w-full object-contain`,src:R(e.id),alt:e.name,onError:()=>b(!0)},x):e.kind===`link`?(0,J.jsxs)(`a`,{className:`flex items-center gap-2 font-mono text-sm break-all text-content underline underline-offset-4`,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(l,{className:`shrink-0`}),e.url]}):y.isPending?(0,J.jsxs)(`div`,{role:`status`,className:`flex items-center justify-center gap-2 p-8 text-sm text-content-muted`,children:[(0,J.jsx)(ae,{}),h(`assets:assetsPage.loadingPreview`)]}):y.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 p-4 text-sm text-danger`,children:[(0,J.jsx)(g,{className:`size-4 shrink-0`}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:y.error.message}),(0,J.jsx)(S,{variant:`secondary`,onClick:()=>{y.refetch()},children:h(`assets:assetsPage.retry`)})]}):y.data?.kind===`text`?ne?(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl text-left`,children:(0,J.jsx)(B,{children:y.data.text||``})}):(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl whitespace-pre-wrap font-sans text-base leading-7 [overflow-wrap:anywhere]`,"data-asset-plain":!0,children:y.data.text}):(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2 p-6 text-center text-sm`,children:[(0,J.jsx)(u,{className:`size-8 text-content-faint`,strokeWidth:1.5}),(0,J.jsx)(`strong`,{className:`font-medium break-words`,children:e.name}),(0,J.jsx)(`p`,{className:`max-w-md text-xs text-content-muted`,children:h(`assets:assetsPage.thisFileTypeCanBeDownloadedSupportedDocumentsCanAlsoBeAddedToAChatForAnalysis`)})]}),y.data?.truncated&&(0,J.jsx)(`p`,{className:`mt-3 text-xs text-content-muted`,children:h(`assets:assetsPage.previewTruncated`)})]}),m&&(0,J.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:m}),(0,J.jsxs)(O,{children:[e.kind!==`link`&&(0,J.jsxs)(S,{variant:`secondary`,size:`dialogAction`,disabled:!!p,loading:p===`open`,onClick:d,children:[q()?(0,J.jsx)(l,{}):(0,J.jsx)(c,{}),q()?h(`assets:assetsPage.openInApplication`):h(`assets:assetsPage.download`)]}),(0,J.jsxs)(S,{size:`dialogAction`,disabled:!!p,loading:p===`use`,onClick:s,children:[(0,J.jsx)(f,{}),h(`assets:assetsPage.useInChat`)]})]})]})})}var _e=[`all`,`image`,`video`,`file`,`link`];function Q(e,t){return t(e===`image`?`assets:assetsPage.images`:e===`video`?`assets:assetsPage.videos`:e===`file`?`assets:assetsPage.files`:e===`link`?`assets:assetsPage.links`:`assets:assetsPage.all`)}function $({activeSessionId:e,onBack:t,notify:n,onUse:o,requestConfirm:s}){let{t:c}=r(),l=i(),u=oe(`focusSearch`),[f,p]=(0,U.useState)(``),[h,g]=(0,U.useState)(`all`),[C,w]=(0,U.useState)(!1),[T,E]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),k=(0,U.useRef)(0),A=(0,U.useRef)(null),j=(0,U.useRef)(!0),N=(0,U.useRef)(e);N.current=e;let F=(0,U.useRef)(new Map),[I,L]=(0,U.useState)({}),[R,B]=(0,U.useState)({}),V=C&&!e,H=a({...he({query:f,kind:h,sessionId:C?e:``}),enabled:!V}),W=V?[]:H.data;(0,U.useEffect)(()=>{j.current=!0;let e=F.current;return()=>{j.current=!1;for(let t of e.values())t.controller?.abort()}},[]),(0,U.useEffect)(()=>{let e=F.current;return()=>{for(let t of e.values())t.controller?.abort()}},[e]);let G=async(t,r)=>{if(F.current.has(t.id))return;let i=r===`use`?new AbortController:void 0,a=e;F.current.set(t.id,{action:r,controller:i}),L(e=>({...e,[t.id]:r})),B(e=>({...e,[t.id]:``}));try{if(r===`delete`){if(!await s({title:c(`assets:assetsPage.deleteAsset`),message:c(`assets:assetsPage.deleteAssetName`,{name:t.name}),confirmLabel:c(`assets:assetsPage.delete`)})||!j.current)return;await l.cancelQueries({queryKey:Y}),await z.remove(t.id),l.setQueriesData({queryKey:Y},e=>e?.filter(e=>e.id!==t.id)),j.current&&n(c(`assets:assetsPage.assetDeleted`)),await Z(l)}else if(r===`use`){let e=await z.content(t.id,i?.signal);if(!j.current||i?.signal.aborted||N.current!==a)return;o(e),n(c(`assets:assetsPage.nameAddedToChat`,{name:t.name}))}else{let e=await pe(t);j.current&&n(c(e===`application`?`assets:assetsPage.openedInApplication`:`assets:assetsPage.downloadStarted`))}}catch(e){j.current&&!i?.signal.aborted&&B(n=>({...n,[t.id]:e instanceof Error?e.message:String(e)}))}finally{F.current.delete(t.id),j.current&&L(e=>({...e,[t.id]:void 0}))}},K=!!(f.trim()||h!==`all`),q=c(C?`assets:assetsPage.noCurrentAssets`:K?`assets:assetsPage.noMatchingAssets`:`assets:assetsPage.nothingHasGatheredHereYet`),X=`border-star-border bg-star-soft text-star-strong hover:bg-star-soft hover:text-star-strong max-[650px]:h-11`,$=c(`navigation:navigation.assets`),ye=(0,J.jsx)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>{H.refetch()},children:c(`assets:assetsPage.retry`)});return(0,J.jsxs)(ue,{title:$,description:c(`assets:assetsPage.conversationAttachmentsAndAgentOutputsGatherHereAutomatically`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(de,{search:(0,J.jsx)(se,{id:v,value:f,onValueChange:p,placeholder:c(`navigation:pageHeader.searchPage`,{page:$}),shortcut:u,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(S,{type:`button`,className:`h-9`,onClick:()=>E(!0),children:[(0,J.jsx)(d,{}),c(`assets:assetsPage.addLink`)]}),filters:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(ie,{children:[(0,J.jsx)(te,{asChild:!0,children:(0,J.jsxs)(S,{ref:A,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,children:[(0,J.jsx)(fe,{}),c(`assets:assetsPage.filters`)]})}),(0,J.jsxs)(ne,{align:`start`,children:[(0,J.jsx)(y,{children:c(`assets:assetsPage.assetType`)}),(0,J.jsx)(x,{value:h,onValueChange:e=>{_e.includes(e)&&g(e)},children:_e.map(e=>(0,J.jsx)(re,{value:e,className:`max-[650px]:min-h-11`,onSelect:e=>e.preventDefault(),children:Q(e,c)},e))}),(0,J.jsx)(ee,{}),(0,J.jsx)(b,{checked:C,className:`max-[650px]:min-h-11`,onCheckedChange:e=>w(e===!0),children:c(`assets:assetsPage.fromCurrentChat`)})]})]}),h!==`all`&&(0,J.jsxs)(S,{variant:`outline`,size:`sm`,className:X,onClick:()=>g(`all`),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:Q(h,c)}),children:[Q(h,c),(0,J.jsx)(_,{})]}),C&&(0,J.jsxs)(S,{variant:`outline`,size:`sm`,className:X,onClick:()=>w(!1),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:c(`assets:assetsPage.fromCurrentChat`)}),children:[c(`assets:assetsPage.fromCurrentChat`),(0,J.jsx)(_,{})]}),(0,J.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`ml-auto text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:H.isFetching&&!V,disabled:V||H.isFetching,"aria-label":c(`assets:assetsPage.refreshAssets`),title:c(`assets:assetsPage.refreshAssets`),onClick:()=>{H.refetch()},children:(0,J.jsx)(m,{})})]})}),children:[V?(0,J.jsx)(M,{kind:`empty`,title:c(`assets:assetsPage.noActiveSession`)}):H.isPending&&!H.isError?(0,J.jsx)(M,{kind:`loading`,title:c(`assets:assetsPage.loadingAssets`)}):W?(0,J.jsxs)(le,{"data-assets-results":!0,title:Q(h,c),count:W.length,meta:H.isFetching&&(0,J.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5`,children:[(0,J.jsx)(ae,{className:`size-3.5`}),c(`assets:assetsPage.refreshingAssets`)]}),children:[H.isError&&(0,J.jsx)(P,{className:`mt-0 mb-2`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:H.error.message}),ye]})}),W.length?(0,J.jsx)(ce,{children:W.map(e=>(0,J.jsx)(ve,{asset:e,busy:I[e.id],error:R[e.id],onPreview:t=>O({asset:e,trigger:t,generation:++k.current}),onAction:t=>{G(e,t)}},e.id))}):!H.isError&&(0,J.jsx)(M,{kind:`empty`,title:q,description:c(C||K?`assets:assetsPage.tryOtherFilters`:`assets:assetsPage.bringInALinkOrAttachAFileInAConversationPisperWillGatherTheOutputsCreatedAlongTheWay`)})]}):(0,J.jsx)(M,{kind:`error`,title:c(`assets:assetsPage.loadFailed`),description:H.error?.message,action:ye}),D&&(0,J.jsx)(ge,{...D,fallback:()=>A.current,onClose:()=>O(null),onUse:()=>{G(D.asset,`use`)},onOpen:()=>{G(D.asset,`open`)},busy:I[D.asset.id],actionError:R[D.asset.id]},D.generation),T&&(0,J.jsx)(me,{onClose:()=>E(!1),onCreated:()=>{j.current&&(E(!1),n(c(`assets:assetsPage.linkAssetAdded`))),Z(l)}})]})}function ve({asset:e,busy:t,error:n,onPreview:i,onAction:a}){let{t:o}=r(),[s,p]=(0,U.useState)(!1),m=e.mimeType?.startsWith(`video/`),g=e.kind===`image`?V:m?H:e.kind===`link`?d:u,_=e.kind===`link`?e.url&&new URL(e.url).hostname:/\.([a-z0-9]{1,6})$/i.exec(e.name)?.[1],v=!s&&e.kind===`image`?(0,J.jsx)(`img`,{className:`size-full rounded-[inherit] object-cover`,src:R(e.id),alt:``,loading:`lazy`,onError:()=>p(!0)}):!s&&m?(0,J.jsx)(`video`,{className:`size-full rounded-[inherit] object-cover`,src:R(e.id),muted:!0,preload:`metadata`,onError:()=>p(!0)}):(0,J.jsx)(g,{});return(0,J.jsx)(N,{className:`asset-row`,"data-asset-id":e.id,icon:v,onOpen:e=>i(e.currentTarget),openLabel:`${o(`assets:assetsPage.preview`)}: ${e.name}`,name:(0,J.jsx)(`span`,{title:e.name,children:e.name}),nameMeta:_||void 0,description:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:e.kind===`link`?`font-mono`:`tabular-nums`,title:e.kind===`link`?e.url:void 0,children:e.kind===`link`?e.url:C(e.size)}),(0,J.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),e.source===`agent`?o(`assets:assetsPage.agentOutputs`):e.source===`attachment`?o(`assets:assetsPage.chatAttachments`):o(`assets:assetsPage.manualUploads`)]}),meta:(e.sessionName||s)&&(0,J.jsxs)(J.Fragment,{children:[e.sessionName&&(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:e.sessionName,children:o(`assets:assetsPage.fromName`,{name:e.sessionName})}),e.sessionName&&s&&(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),s&&(0,J.jsx)(`span`,{className:`shrink-0`,children:o(`assets:assetsPage.mediaFailed`)})]}),actions:(0,J.jsxs)(`div`,{className:`asset-row-actions flex items-center gap-1`,children:[(0,J.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`use`,onClick:()=>a(`use`),children:[(0,J.jsx)(f,{}),(0,J.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.useInChat`)})]}),e.kind===`link`?(0,J.jsx)(S,{asChild:!0,variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,children:(0,J.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(l,{}),(0,J.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.open`)})]})}):(0,J.jsxs)(S,{variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`open`,onClick:()=>a(`open`),children:[q()?(0,J.jsx)(l,{}):(0,J.jsx)(c,{}),(0,J.jsx)(`span`,{className:`max-[650px]:sr-only`,children:q()?o(`assets:assetsPage.openInApplication`):o(`assets:assetsPage.download`)})]}),(0,J.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,disabled:!!t,loading:t===`delete`,"aria-label":`${o(`assets:assetsPage.deleteAsset`)}: ${e.name}`,onClick:()=>a(`delete`),children:(0,J.jsx)(h,{})})]}),detail:n?(0,J.jsx)(P,{className:`mt-0`,children:n}):void 0})}export{$ as AssetsPage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CsOCclo6.js";import{r as i,t as a}from"./useQuery-DfOU-27z.js";import{t as o}from"./queryOptions-Dfvzj6n2.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./download-BCfIiuaL.js";import{t as l}from"./external-link-CEQqPcqc.js";import{t as u}from"./file-Bllajneu.js";import{t as d}from"./link-2-mgasYn21.js";import{t as f}from"./paperclip-BCXrwYpb.js";import{t as p}from"./plus-fQbSqB1n.js";import{t as m}from"./refresh-cw-TbWxTY4K.js";import{t as h}from"./trash-2-CNrPOoPR.js";import{t as g}from"./triangle-alert-CE1q54ci.js";import{t as _}from"./x-07u4-129.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{a as y,c as ee,n as b,o as x,p as te,r as ne,s as re,t as ie}from"./dropdown-menu-Ds0gD8S8.js";import{n as ae,t as S}from"./button-CCcCN8tE.js";import{s as oe}from"./shortcuts-C6ddcUau.js";import{n as C}from"./format-DMJQzoZ7.js";import{a as w,i as T,l as E,n as D,o as O,s as k,t as A}from"./dialog-DldLiTwf.js";import{t as j}from"./input-CPw-zkYh.js";import{n as M}from"./PageState-Cz6vFMXv.js";import{a as se,i as N,n as ce,o as le,r as ue,s as de,t as P}from"./FeaturePage-DEjUrI25.js";import{n as F}from"./mobile-runtime-recovery-tbTyacip.js";import{n as I}from"./field-DoLEb0np.js";import{i as L,n as R,r as z}from"./assets-api-BGMZsyC4.js";import{t as B}from"./MarkdownMessage-B9Bb9VQU.js";var V=s(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),H=s(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),fe=s(`list-filter`,[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]),U=e(t(),1),W=134217728;function G(e){let t=document.createElement(`a`);t.href=`/api/assets/${encodeURIComponent(e.id)}/download`,t.download=e.name,t.hidden=!0,document.body.append(t),t.click(),t.remove()}function K(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error||Error(`读取资产失败。`)),r.onload=()=>{let e=typeof r.result==`string`?r.result:``,i=e.indexOf(`,`);i<0?n(Error(`资产编码失败。`)):t(e.slice(i+1))},r.readAsDataURL(e)})}function q(){if(typeof window>`u`)return!1;let e=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;return!!(window.pisperDesktop?.openAsset||window.__PISPER_MOBILE_APP__&&e)}async function pe(e){let t=window.pisperDesktop?.openAsset,n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;if(!t&&!(window.__PISPER_MOBILE_APP__&&n))return G(e),`download`;await F();let r=await fetch(`/api/assets/${encodeURIComponent(e.id)}/download`);if(!r.ok)throw Error(`资产下载失败 (${r.status})`);if((Number(r.headers.get(`content-length`))||0)>W)throw Error(`资产超过 128 MB 原生打开限制。`);let i=await r.blob();if(!i.size||i.size>W)throw Error(`资产内容为空或超过 128 MB 原生打开限制。`);let a=await K(i);return t?await t({name:e.name,data:a}):await n?.(`mobile_open_asset`,{input:{name:e.name,mimeType:e.mimeType||i.type||`application/octet-stream`,data:a}}),`application`}var J=n();function me({onClose:e,onCreated:t}){let{t:n}=r(),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(``),f=(0,U.useRef)(!1),m=(0,U.useRef)(!0);return(0,U.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,J.jsx)(A,{open:!0,busy:c,onOpenChange:t=>{!t&&!f.current&&e()},children:(0,J.jsx)(T,{size:`compact`,scrollMode:`body`,children:(0,J.jsxs)(`form`,{className:`flex min-h-0 flex-col gap-4`,onSubmit:async e=>{if(e.preventDefault(),f.current)return;f.current=!0,l(!0),d(``);let n=!1;try{await z.createLink({name:i,url:o}),n=!0}catch(e){m.current&&d(e instanceof Error?e.message:String(e))}finally{f.current=!1,m.current&&l(!1)}n&&t()},"aria-busy":c||void 0,children:[(0,J.jsxs)(k,{className:`pr-8`,children:[(0,J.jsx)(E,{children:n(`assets:assetsPage.addLinkAsset`)}),(0,J.jsx)(w,{children:n(`assets:assetsPage.linksCanBeArchivedOpenedOrAddedToAChatAsContext`)})]}),(0,J.jsxs)(D,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(I,{variant:`control`,children:[n(`assets:assetsPage.name`),(0,J.jsx)(j,{value:i,disabled:c,onChange:e=>a(e.target.value),placeholder:n(`assets:assetsPage.forExampleOpenAIAPIDocs`)})]}),(0,J.jsxs)(I,{variant:`control`,children:[`URL`,(0,J.jsx)(j,{className:`font-mono`,value:o,disabled:c,onChange:e=>s(e.target.value),placeholder:`https://example.com/docs`})]}),u&&(0,J.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:u})]}),(0,J.jsxs)(O,{children:[(0,J.jsx)(S,{variant:`secondary`,size:`dialogAction`,disabled:c,onClick:e,children:n(`assets:assetsPage.cancel`)}),(0,J.jsxs)(S,{type:`submit`,size:`dialogAction`,loading:c,disabled:c||!o.trim(),children:[(0,J.jsx)(p,{}),n(c?`assets:assetsPage.adding`:`assets:assetsPage.addLink`)]})]})]})})})}var Y=[`assets`,`list`];function he(e={}){let t=L(e);return o({queryKey:[...Y,t],queryFn:({signal:e})=>z.list(t,e),staleTime:0,retry:!1})}function X(e,t){return o({queryKey:[`assets`,`preview`,e,t],queryFn:({signal:t})=>z.preview(e,t),staleTime:0,gcTime:0,retry:!1})}async function Z(e){await e.cancelQueries({queryKey:Y}),await e.invalidateQueries({queryKey:Y})}function ge({asset:e,generation:t,trigger:n,fallback:i,onClose:o,onUse:s,onOpen:d,busy:p,actionError:m}){let{t:h}=r(),_=e.mimeType?.startsWith(`video/`),v=e.kind===`image`||_,y=a({...X(e.id,t),enabled:!v&&e.kind!==`link`}),[ee,b]=(0,U.useState)(!1),[x,te]=(0,U.useState)(0),ne=/\.md$/i.test(e.name)||e.mimeType===`text/markdown`;return(0,J.jsx)(A,{open:!0,onOpenChange:e=>{e||o()},children:(0,J.jsxs)(T,{size:`wide`,scrollMode:`body`,className:`w-[min(96vw,1200px)] max-w-[min(96vw,1200px)]`,onCloseAutoFocus:e=>{e.preventDefault();let t=e=>e?.isConnected&&e.getClientRects().length&&getComputedStyle(e).visibility!==`hidden`,r=t(n)?n:i();t(r)&&r?.focus({preventScroll:!0})},children:[(0,J.jsxs)(k,{className:`pr-8`,children:[(0,J.jsx)(E,{className:`break-words leading-6`,children:e.name}),(0,J.jsx)(w,{className:`font-mono break-words tabular-nums`,children:e.kind===`link`?e.url:`${e.mimeType||``} · ${C(e.size)}`})]}),(0,J.jsxs)(D,{className:`min-h-[min(240px,30dvh)] rounded-md border border-stroke bg-surface-subtle p-3`,children:[v?ee?(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 p-4 text-sm`,children:[(0,J.jsx)(g,{className:`size-5 text-danger`}),(0,J.jsx)(`p`,{children:h(`assets:assetsPage.mediaFailed`)}),(0,J.jsx)(S,{variant:`secondary`,onClick:()=>{b(!1),te(e=>e+1)},children:h(`assets:assetsPage.retry`)})]}):_?(0,J.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,className:`mx-auto max-h-[65dvh] w-full object-contain`,src:R(e.id),onError:()=>b(!0)},x):(0,J.jsx)(`img`,{className:`mx-auto max-h-[65dvh] max-w-full object-contain`,src:R(e.id),alt:e.name,onError:()=>b(!0)},x):e.kind===`link`?(0,J.jsxs)(`a`,{className:`flex items-center gap-2 font-mono text-sm break-all text-content underline underline-offset-4`,href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(l,{className:`shrink-0`}),e.url]}):y.isPending?(0,J.jsxs)(`div`,{role:`status`,className:`flex items-center justify-center gap-2 p-8 text-sm text-content-muted`,children:[(0,J.jsx)(ae,{}),h(`assets:assetsPage.loadingPreview`)]}):y.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 p-4 text-sm text-danger`,children:[(0,J.jsx)(g,{className:`size-4 shrink-0`}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:y.error.message}),(0,J.jsx)(S,{variant:`secondary`,onClick:()=>{y.refetch()},children:h(`assets:assetsPage.retry`)})]}):y.data?.kind===`text`?ne?(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl text-left`,children:(0,J.jsx)(B,{children:y.data.text||``})}):(0,J.jsx)(`div`,{className:`mx-auto max-w-3xl whitespace-pre-wrap font-sans text-base leading-7 [overflow-wrap:anywhere]`,"data-asset-plain":!0,children:y.data.text}):(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2 p-6 text-center text-sm`,children:[(0,J.jsx)(u,{className:`size-8 text-content-faint`,strokeWidth:1.5}),(0,J.jsx)(`strong`,{className:`font-medium break-words`,children:e.name}),(0,J.jsx)(`p`,{className:`max-w-md text-xs text-content-muted`,children:h(`assets:assetsPage.thisFileTypeCanBeDownloadedSupportedDocumentsCanAlsoBeAddedToAChatForAnalysis`)})]}),y.data?.truncated&&(0,J.jsx)(`p`,{className:`mt-3 text-xs text-content-muted`,children:h(`assets:assetsPage.previewTruncated`)})]}),m&&(0,J.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:m}),(0,J.jsxs)(O,{children:[e.kind!==`link`&&(0,J.jsxs)(S,{variant:`secondary`,size:`dialogAction`,disabled:!!p,loading:p===`open`,onClick:d,children:[q()?(0,J.jsx)(l,{}):(0,J.jsx)(c,{}),q()?h(`assets:assetsPage.openInApplication`):h(`assets:assetsPage.download`)]}),(0,J.jsxs)(S,{size:`dialogAction`,disabled:!!p,loading:p===`use`,onClick:s,children:[(0,J.jsx)(f,{}),h(`assets:assetsPage.useInChat`)]})]})]})})}var _e=[`all`,`image`,`video`,`file`,`link`];function Q(e,t){return t(e===`image`?`assets:assetsPage.images`:e===`video`?`assets:assetsPage.videos`:e===`file`?`assets:assetsPage.files`:e===`link`?`assets:assetsPage.links`:`assets:assetsPage.all`)}function $({activeSessionId:e,onBack:t,notify:n,onUse:o,requestConfirm:s}){let{t:c}=r(),l=i(),u=oe(`focusSearch`),[f,p]=(0,U.useState)(``),[h,g]=(0,U.useState)(`all`),[C,w]=(0,U.useState)(!1),[T,E]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),k=(0,U.useRef)(0),A=(0,U.useRef)(null),j=(0,U.useRef)(!0),N=(0,U.useRef)(e);N.current=e;let F=(0,U.useRef)(new Map),[I,L]=(0,U.useState)({}),[R,B]=(0,U.useState)({}),V=C&&!e,H=a({...he({query:f,kind:h,sessionId:C?e:``}),enabled:!V}),W=V?[]:H.data;(0,U.useEffect)(()=>{j.current=!0;let e=F.current;return()=>{j.current=!1;for(let t of e.values())t.controller?.abort()}},[]),(0,U.useEffect)(()=>{let e=F.current;return()=>{for(let t of e.values())t.controller?.abort()}},[e]);let G=async(t,r)=>{if(F.current.has(t.id))return;let i=r===`use`?new AbortController:void 0,a=e;F.current.set(t.id,{action:r,controller:i}),L(e=>({...e,[t.id]:r})),B(e=>({...e,[t.id]:``}));try{if(r===`delete`){if(!await s({title:c(`assets:assetsPage.deleteAsset`),message:c(`assets:assetsPage.deleteAssetName`,{name:t.name}),confirmLabel:c(`assets:assetsPage.delete`)})||!j.current)return;await l.cancelQueries({queryKey:Y}),await z.remove(t.id),l.setQueriesData({queryKey:Y},e=>e?.filter(e=>e.id!==t.id)),j.current&&n(c(`assets:assetsPage.assetDeleted`)),await Z(l)}else if(r===`use`){let e=await z.content(t.id,i?.signal);if(!j.current||i?.signal.aborted||N.current!==a)return;o(e),n(c(`assets:assetsPage.nameAddedToChat`,{name:t.name}))}else{let e=await pe(t);j.current&&n(c(e===`application`?`assets:assetsPage.openedInApplication`:`assets:assetsPage.downloadStarted`))}}catch(e){j.current&&!i?.signal.aborted&&B(n=>({...n,[t.id]:e instanceof Error?e.message:String(e)}))}finally{F.current.delete(t.id),j.current&&L(e=>({...e,[t.id]:void 0}))}},K=!!(f.trim()||h!==`all`),q=c(C?`assets:assetsPage.noCurrentAssets`:K?`assets:assetsPage.noMatchingAssets`:`assets:assetsPage.nothingHasGatheredHereYet`),X=`border-star-border bg-star-soft text-star-strong hover:bg-star-soft hover:text-star-strong max-[650px]:h-11`,$=c(`navigation:navigation.assets`),ye=(0,J.jsx)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>{H.refetch()},children:c(`assets:assetsPage.retry`)});return(0,J.jsxs)(ue,{title:$,description:c(`assets:assetsPage.conversationAttachmentsAndAgentOutputsGatherHereAutomatically`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(de,{search:(0,J.jsx)(se,{id:v,value:f,onValueChange:p,placeholder:c(`navigation:pageHeader.searchPage`,{page:$}),shortcut:u,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(S,{type:`button`,className:`h-9`,onClick:()=>E(!0),children:[(0,J.jsx)(d,{}),c(`assets:assetsPage.addLink`)]}),filters:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(ie,{children:[(0,J.jsx)(te,{asChild:!0,children:(0,J.jsxs)(S,{ref:A,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,children:[(0,J.jsx)(fe,{}),c(`assets:assetsPage.filters`)]})}),(0,J.jsxs)(ne,{align:`start`,children:[(0,J.jsx)(y,{children:c(`assets:assetsPage.assetType`)}),(0,J.jsx)(x,{value:h,onValueChange:e=>{_e.includes(e)&&g(e)},children:_e.map(e=>(0,J.jsx)(re,{value:e,className:`max-[650px]:min-h-11`,onSelect:e=>e.preventDefault(),children:Q(e,c)},e))}),(0,J.jsx)(ee,{}),(0,J.jsx)(b,{checked:C,className:`max-[650px]:min-h-11`,onCheckedChange:e=>w(e===!0),children:c(`assets:assetsPage.fromCurrentChat`)})]})]}),h!==`all`&&(0,J.jsxs)(S,{variant:`outline`,size:`sm`,className:X,onClick:()=>g(`all`),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:Q(h,c)}),children:[Q(h,c),(0,J.jsx)(_,{})]}),C&&(0,J.jsxs)(S,{variant:`outline`,size:`sm`,className:X,onClick:()=>w(!1),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:c(`assets:assetsPage.fromCurrentChat`)}),children:[c(`assets:assetsPage.fromCurrentChat`),(0,J.jsx)(_,{})]}),(0,J.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`ml-auto text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:H.isFetching&&!V,disabled:V||H.isFetching,"aria-label":c(`assets:assetsPage.refreshAssets`),title:c(`assets:assetsPage.refreshAssets`),onClick:()=>{H.refetch()},children:(0,J.jsx)(m,{})})]})}),children:[V?(0,J.jsx)(M,{kind:`empty`,title:c(`assets:assetsPage.noActiveSession`)}):H.isPending&&!H.isError?(0,J.jsx)(M,{kind:`loading`,title:c(`assets:assetsPage.loadingAssets`)}):W?(0,J.jsxs)(le,{"data-assets-results":!0,title:Q(h,c),count:W.length,meta:H.isFetching&&(0,J.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5`,children:[(0,J.jsx)(ae,{className:`size-3.5`}),c(`assets:assetsPage.refreshingAssets`)]}),children:[H.isError&&(0,J.jsx)(P,{className:`mt-0 mb-2`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:H.error.message}),ye]})}),W.length?(0,J.jsx)(ce,{children:W.map(e=>(0,J.jsx)(ve,{asset:e,busy:I[e.id],error:R[e.id],onPreview:t=>O({asset:e,trigger:t,generation:++k.current}),onAction:t=>{G(e,t)}},e.id))}):!H.isError&&(0,J.jsx)(M,{kind:`empty`,title:q,description:c(C||K?`assets:assetsPage.tryOtherFilters`:`assets:assetsPage.bringInALinkOrAttachAFileInAConversationPisperWillGatherTheOutputsCreatedAlongTheWay`)})]}):(0,J.jsx)(M,{kind:`error`,title:c(`assets:assetsPage.loadFailed`),description:H.error?.message,action:ye}),D&&(0,J.jsx)(ge,{...D,fallback:()=>A.current,onClose:()=>O(null),onUse:()=>{G(D.asset,`use`)},onOpen:()=>{G(D.asset,`open`)},busy:I[D.asset.id],actionError:R[D.asset.id]},D.generation),T&&(0,J.jsx)(me,{onClose:()=>E(!1),onCreated:()=>{j.current&&(E(!1),n(c(`assets:assetsPage.linkAssetAdded`))),Z(l)}})]})}function ve({asset:e,busy:t,error:n,onPreview:i,onAction:a}){let{t:o}=r(),[s,p]=(0,U.useState)(!1),m=e.mimeType?.startsWith(`video/`),g=e.kind===`image`?V:m?H:e.kind===`link`?d:u,_=e.kind===`link`?e.url&&new URL(e.url).hostname:/\.([a-z0-9]{1,6})$/i.exec(e.name)?.[1],v=!s&&e.kind===`image`?(0,J.jsx)(`img`,{className:`size-full rounded-[inherit] object-cover`,src:R(e.id),alt:``,loading:`lazy`,onError:()=>p(!0)}):!s&&m?(0,J.jsx)(`video`,{className:`size-full rounded-[inherit] object-cover`,src:R(e.id),muted:!0,preload:`metadata`,onError:()=>p(!0)}):(0,J.jsx)(g,{});return(0,J.jsx)(N,{className:`asset-row`,"data-asset-id":e.id,icon:v,onOpen:e=>i(e.currentTarget),openLabel:`${o(`assets:assetsPage.preview`)}: ${e.name}`,name:(0,J.jsx)(`span`,{title:e.name,children:e.name}),nameMeta:_||void 0,description:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:e.kind===`link`?`font-mono`:`tabular-nums`,title:e.kind===`link`?e.url:void 0,children:e.kind===`link`?e.url:C(e.size)}),(0,J.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),e.source===`agent`?o(`assets:assetsPage.agentOutputs`):e.source===`attachment`?o(`assets:assetsPage.chatAttachments`):o(`assets:assetsPage.manualUploads`)]}),meta:(e.sessionName||s)&&(0,J.jsxs)(J.Fragment,{children:[e.sessionName&&(0,J.jsx)(`span`,{className:`min-w-0 truncate`,title:e.sessionName,children:o(`assets:assetsPage.fromName`,{name:e.sessionName})}),e.sessionName&&s&&(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),s&&(0,J.jsx)(`span`,{className:`shrink-0`,children:o(`assets:assetsPage.mediaFailed`)})]}),actions:(0,J.jsxs)(`div`,{className:`asset-row-actions flex items-center gap-1`,children:[(0,J.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`use`,onClick:()=>a(`use`),children:[(0,J.jsx)(f,{}),(0,J.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.useInChat`)})]}),e.kind===`link`?(0,J.jsx)(S,{asChild:!0,variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,children:(0,J.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(l,{}),(0,J.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.open`)})]})}):(0,J.jsxs)(S,{variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`open`,onClick:()=>a(`open`),children:[q()?(0,J.jsx)(l,{}):(0,J.jsx)(c,{}),(0,J.jsx)(`span`,{className:`max-[650px]:sr-only`,children:q()?o(`assets:assetsPage.openInApplication`):o(`assets:assetsPage.download`)})]}),(0,J.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,disabled:!!t,loading:t===`delete`,"aria-label":`${o(`assets:assetsPage.deleteAsset`)}: ${e.name}`,onClick:()=>a(`delete`),children:(0,J.jsx)(h,{})})]}),detail:n?(0,J.jsx)(P,{className:`mt-0`,children:n}):void 0})}export{$ as AssetsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-47vsdOU3.js";import{n as i}from"./client-store-CQELNb0e.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{x as o,y as s}from"./FocusRuntimeControls-LaHQWOPc.js";import{t as c}from"./file-Bllajneu.js";import{t as l}from"./paperclip-BCXrwYpb.js";import{t as u}from"./x-07u4-129.js";import{n as d}from"./button-CCcCN8tE.js";import{n as f}from"./format-DMJQzoZ7.js";var p=a(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),m=e(t(),1),h=n();function g({cwd:e,selection:t}){let{t:n}=r(),a=i(),c=(0,m.useRef)(null);return{input:(0,h.jsx)(`input`,{ref:c,type:`file`,className:`hidden`,accept:s,multiple:!0,"aria-label":n(`chat:focusSession.addAttachment`),onChange:e=>{let n=[...e.currentTarget.files||[]];e.currentTarget.value=``,n.length&&t.addFiles(n)}}),choose:async()=>{if(a){c.current?.click();return}if(window.pisperDesktop?.pickFiles){try{let n=await window.pisperDesktop.pickFiles(e);t.addAttachments(o(n||[]))}catch(e){t.setError(e)}return}c.current?.click()}}}function _({cwd:e,selection:t}){let{t:n}=r(),{input:i,choose:a}=g({cwd:e,selection:t});return(0,h.jsxs)(h.Fragment,{children:[i,(0,h.jsxs)(`button`,{type:`button`,className:`relative grid size-[30px] min-w-[30px] flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent text-content-muted transition-colors hover:bg-surface-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50 max-[650px]:size-11 max-[650px]:min-w-11 pointer-coarse:size-11 pointer-coarse:min-w-11`,title:n(`chat:focusSession.addAttachment`),"aria-label":n(`chat:focusSession.addAttachment`),onClick:()=>void a(),children:[(0,h.jsx)(l,{size:16}),t.attachments.length>0&&(0,h.jsx)(`span`,{className:`absolute -top-1 -right-1 grid h-4 min-w-4 place-items-center rounded-full border-2 border-panel bg-star px-0.5 text-[10px] leading-none font-medium text-on-accent tabular-nums`,children:t.attachments.length})]})]})}function v({attachments:e,preparing:t=[],onRemove:n,compact:i=!1}){let{t:a}=r();return!e.length&&!t.length?null:(0,h.jsxs)(`div`,{className:`attachment-tray [&.compact]:max-h-[58px] flex max-h-[116px] flex-wrap gap-[6px] overflow-auto ${i?`compact`:``}`,children:[t.map(e=>(0,h.jsxs)(`div`,{className:`flex min-h-[42px] max-w-64 items-center gap-2 rounded-sm border border-stroke bg-surface-subtle pr-1 pl-2.5`,"aria-busy":`true`,children:[(0,h.jsx)(d,{className:`size-3.5`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-content`,children:e.name}),(0,h.jsx)(`span`,{className:`sr-only`,children:a(`chat:focusSession.preparingAttachments`)}),(0,h.jsx)(`button`,{type:`button`,className:`grid size-8 shrink-0 cursor-pointer place-items-center rounded-sm text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":a(`chat:focusSession.removeName`,{name:e.name}),onClick:()=>n(e.id),children:(0,h.jsx)(u,{size:14})})]},e.id)),e.map(e=>(0,h.jsxs)(`div`,{className:`attachment-chip grid min-h-[42px] min-w-[150px] max-w-[250px] grid-cols-[30px_minmax(0,1fr)_auto] items-center gap-2 rounded-sm border border-stroke bg-surface-subtle p-1.5 pr-1 [&_>_button]:grid [&_>_button]:size-7 [&_>_button]:cursor-pointer [&_>_button]:place-items-center [&_>_button]:rounded-xs [&_>_button]:text-content-muted [&_>_button:hover]:bg-danger-soft [&_>_button:hover]:text-danger max-[650px]:[&_>_button]:size-11 [&_>_img]:size-[30px] [&_>_img]:rounded-xs [&_>_img]:object-cover [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_small]:text-xs [&_small]:text-content-muted [&_small]:tabular-nums [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content`,children:[e.kind===`image`?(0,h.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:``}):(0,h.jsx)(`span`,{className:`grid size-[30px] place-items-center rounded-xs border border-key-border bg-key text-content-muted`,children:(0,h.jsx)(c,{size:13})}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:e.name}),(0,h.jsxs)(`small`,{children:[e.kind===`path`?a(`chat:focusSession.localPath`):e.kind===`image`?a(`chat:focusSession.image`):e.kind===`document`?a(`chat:focusSession.document`):a(`chat:focusSession.text`),e.kind===`path`?``:` · ${f(e.size)}`,e.truncated?` · ${a(`chat:focusSession.truncated`)}`:``]})]}),(0,h.jsx)(`button`,{type:`button`,"aria-label":a(`chat:focusSession.removeName`,{name:e.name}),onClick:()=>n(String(e.id||``)),children:(0,h.jsx)(u,{size:12})})]},e.id))]})}export{p as i,_ as n,g as r,v as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CsOCclo6.js";import{n as i}from"./client-store-e4OXhDNK.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{x as o,y as s}from"./FocusRuntimeControls-CoxLbl8K.js";import{t as c}from"./file-Bllajneu.js";import{t as l}from"./paperclip-BCXrwYpb.js";import{t as u}from"./x-07u4-129.js";import{n as d}from"./button-CCcCN8tE.js";import{n as f}from"./format-DMJQzoZ7.js";var p=a(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),m=e(t(),1),h=n();function g({cwd:e,selection:t}){let{t:n}=r(),a=i(),c=(0,m.useRef)(null);return{input:(0,h.jsx)(`input`,{ref:c,type:`file`,className:`hidden`,accept:s,multiple:!0,"aria-label":n(`chat:focusSession.addAttachment`),onChange:e=>{let n=[...e.currentTarget.files||[]];e.currentTarget.value=``,n.length&&t.addFiles(n)}}),choose:async()=>{if(a){c.current?.click();return}if(window.pisperDesktop?.pickFiles){try{let n=await window.pisperDesktop.pickFiles(e);t.addAttachments(o(n||[]))}catch(e){t.setError(e)}return}c.current?.click()}}}function _({cwd:e,selection:t}){let{t:n}=r(),{input:i,choose:a}=g({cwd:e,selection:t});return(0,h.jsxs)(h.Fragment,{children:[i,(0,h.jsxs)(`button`,{type:`button`,className:`relative grid size-[30px] min-w-[30px] flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent text-content-muted transition-colors hover:bg-surface-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50 max-[650px]:size-11 max-[650px]:min-w-11 pointer-coarse:size-11 pointer-coarse:min-w-11`,title:n(`chat:focusSession.addAttachment`),"aria-label":n(`chat:focusSession.addAttachment`),onClick:()=>void a(),children:[(0,h.jsx)(l,{size:16}),t.attachments.length>0&&(0,h.jsx)(`span`,{className:`absolute -top-1 -right-1 grid h-4 min-w-4 place-items-center rounded-full border-2 border-panel bg-star px-0.5 text-[10px] leading-none font-medium text-on-accent tabular-nums`,children:t.attachments.length})]})]})}function v({attachments:e,preparing:t=[],onRemove:n,compact:i=!1}){let{t:a}=r();return!e.length&&!t.length?null:(0,h.jsxs)(`div`,{className:`attachment-tray [&.compact]:max-h-[58px] flex max-h-[116px] flex-wrap gap-[6px] overflow-auto ${i?`compact`:``}`,children:[t.map(e=>(0,h.jsxs)(`div`,{className:`flex min-h-[42px] max-w-64 items-center gap-2 rounded-sm border border-stroke bg-surface-subtle pr-1 pl-2.5`,"aria-busy":`true`,children:[(0,h.jsx)(d,{className:`size-3.5`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-content`,children:e.name}),(0,h.jsx)(`span`,{className:`sr-only`,children:a(`chat:focusSession.preparingAttachments`)}),(0,h.jsx)(`button`,{type:`button`,className:`grid size-8 shrink-0 cursor-pointer place-items-center rounded-sm text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":a(`chat:focusSession.removeName`,{name:e.name}),onClick:()=>n(e.id),children:(0,h.jsx)(u,{size:14})})]},e.id)),e.map(e=>(0,h.jsxs)(`div`,{className:`attachment-chip grid min-h-[42px] min-w-[150px] max-w-[250px] grid-cols-[30px_minmax(0,1fr)_auto] items-center gap-2 rounded-sm border border-stroke bg-surface-subtle p-1.5 pr-1 [&_>_button]:grid [&_>_button]:size-7 [&_>_button]:cursor-pointer [&_>_button]:place-items-center [&_>_button]:rounded-xs [&_>_button]:text-content-muted [&_>_button:hover]:bg-danger-soft [&_>_button:hover]:text-danger max-[650px]:[&_>_button]:size-11 [&_>_img]:size-[30px] [&_>_img]:rounded-xs [&_>_img]:object-cover [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_small]:text-xs [&_small]:text-content-muted [&_small]:tabular-nums [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content`,children:[e.kind===`image`?(0,h.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:``}):(0,h.jsx)(`span`,{className:`grid size-[30px] place-items-center rounded-xs border border-key-border bg-key text-content-muted`,children:(0,h.jsx)(c,{size:13})}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:e.name}),(0,h.jsxs)(`small`,{children:[e.kind===`path`?a(`chat:focusSession.localPath`):e.kind===`image`?a(`chat:focusSession.image`):e.kind===`document`?a(`chat:focusSession.document`):a(`chat:focusSession.text`),e.kind===`path`?``:` · ${f(e.size)}`,e.truncated?` · ${a(`chat:focusSession.truncated`)}`:``]})]}),(0,h.jsx)(`button`,{type:`button`,"aria-label":a(`chat:focusSession.removeName`,{name:e.name}),onClick:()=>n(String(e.id||``)),children:(0,h.jsx)(u,{size:12})})]},e.id))]})}export{p as i,_ as n,g as r,v as t};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ManageProjectsDialog-D4HGh_Lh.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-47vsdOU3.js","assets/i18n-CHUj56MI.js","assets/vendor-router-CSN_DGvx.js","assets/index-Dw3Kz26s.js","assets/index-j6s460ui.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/arrow-down-CDGua-ue.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/arrow-up-DST6-qVQ.js","assets/folder-minus-BhfTnypT.js","assets/folder-plus-OPHZsJho.js","assets/pencil-U08v_vV9.js","assets/rotate-ccw-C0v8V77_.js","assets/trash-2-CNrPOoPR.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/board-projects-wULJ4QMT.js","assets/query-DFQayLF5.js","assets/useQuery-DfOU-27z.js","assets/startup-queries-CbAKsBHA.js","assets/mutation-b4pPvB7p.js","assets/api-DMqZSAib.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-BHt8SJKV.js","assets/event-stream-CuxX_nc8.js","assets/http-D4AhfBV1.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-BA14peh5.js","assets/runtime-capabilities-ChJVNwRz.js","assets/session-board-status-D_Tz3HJm.js","assets/chat-api-CbddSAiB.js","assets/session-questions-CFzjCrxi.js","assets/events-BgoXNekW.js","assets/room-changes-DMfb5VNn.js","assets/session-workspaces-Brm-8lHh.js","assets/card-presentation-zU6WKfgu.js","assets/workspace-order-store-Cz2oC0mc.js","assets/dialog-nax_z9Og.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/useCatalogProjects-t9qTve0q.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-47vsdOU3.js";import{t as a}from"./useQuery-DfOU-27z.js";import{r as o,u as s}from"./placements-Bca0DPqX.js";import{r as c,u as l}from"./session-board-status-D_Tz3HJm.js";import{i as u}from"./use-mobile-C2tPBAza.js";import{t as d}from"./usePhoneShell-Bn3ZlBYr.js";import{t as f}from"./createLucideIcon-Cd-3GVxJ.js";import{t as p}from"./arrow-down-CDGua-ue.js";import{t as m}from"./arrow-right-DqLOhpA2.js";import{t as h}from"./arrow-up-DST6-qVQ.js";import{t as g}from"./chevron-down-CxtxIjiP.js";import{t as _}from"./chevron-right-C3t2Rckj.js";import{t as v}from"./corner-down-right--hxi-Ihy.js";import{t as y}from"./ellipsis-CfGKfbq6.js";import{t as b}from"./folder-minus-BhfTnypT.js";import{t as x}from"./folder-plus-OPHZsJho.js";import{t as S}from"./folder-DPM8D8cf.js";import{t as C}from"./pin-CU0FG0lI.js";import{t as w}from"./plus-fQbSqB1n.js";import{t as T}from"./rotate-ccw-C0v8V77_.js";import{t as E}from"./square-pen-hYbjKh6A.js";import{t as D}from"./trash-2-CNrPOoPR.js";import{t as O}from"./x-07u4-129.js";import{t as k}from"./brand-DIEc3fK8.js";import{c as A,i as j,p as M,r as N,t as P}from"./dropdown-menu-Ds0gD8S8.js";import{t as F}from"./segmented-control-xkrEOP_d.js";import{i as I,n as L,r as R,t as ee}from"./tooltip-D4MFbqcG.js";import{t as z}from"./utils-C8uzG5AZ.js";import{t as B}from"./button-CCcCN8tE.js";import{t as V}from"./kbd-CAufZTkl.js";import{a as te,c as H,g as U,n as ne,t as W}from"./shortcuts-lvsdkhJa.js";import{r as G}from"./session-questions-CFzjCrxi.js";import{d as re,i as ie}from"./board-projects-wULJ4QMT.js";import{a as K,f as ae,l as q,n as oe,o as se,s as ce,t as le}from"./useNow-D1gmERNF.js";import{d as ue}from"./session-workspaces-Brm-8lHh.js";import{a as de,i as fe,o as pe,r as me,s as he,t as J}from"./useNewProjectPicker-D5M2WzCG.js";import{c as ge,i as Y,l as _e,n as X,o as ve,r as Z,t as ye}from"./card-presentation-zU6WKfgu.js";import{n as be,r as xe}from"./format-DMJQzoZ7.js";import{t as Se}from"./StatusGlyph-1KgitlUg.js";import{t as Ce}from"./session-change-summary-api-zrzUcWPa.js";import{n as we,t as Te}from"./workspace-order-store-Cz2oC0mc.js";import{c as Ee,i as De,o as Oe,s as ke}from"./folder-paths-BxUl5vo9.js";import{n as Ae}from"./PageState-Cz6vFMXv.js";import{n as je,t as Me}from"./esm-DCV8yILT.js";import{c as Ne,i as Pe,l as Fe,n as Ie,o as Le,s as Re,t as ze,u as Be}from"./useSessionRowActions-C59wvHhe.js";import{n as Ve}from"./BotAvatar-SFQi6bVG.js";import{t as He}from"./AppSelect-B15Hpk2W.js";import{t as Ue}from"./new-task-DG4I6cda.js";import{t as We}from"./useCatalogProjects-t9qTve0q.js";var Ge=f(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ke=f(`folder-pen`,[[`path`,{d:`M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5`,key:`a8xqs0`}],[`path`,{d:`M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`1saktj`}]]),Q=e(n(),1);function qe(){let{t:e}=i();return{name:{attention:e(`board:lane.attention`),running:e(`board:lane.running`),queued:e(`board:lane.queued`),done:e(`board:lane.done`)},order:{attention:e(`board:lane.orderAttention`),running:e(`board:lane.orderRunning`),queued:e(`board:lane.orderQueued`),done:e(`board:lane.orderDone`)}}}function Je(e){return e>30}var Ye={attention:0,running:1,queued:2,done:3};function Xe(){return{attention:0,running:0,queued:0,done:0}}function Ze(e){return typeof e==`number`&&Number.isFinite(e)?e:null}var Qe=K(e=>e.since),$e=K(e=>Ze(e.startedAt)??Ze(e.since)),et=K(e=>e.since,!0);function tt(e,t){return Ye[e.lane]-Ye[t.lane]||(e.lane===`running`?$e(e,t):e.lane===`done`?et(e,t):Qe(e,t))}function nt(e,{now:t,capabilities:n,timeZoneOffsetMinutes:r}){let i=new Set;return e.filter(e=>!e||!e.id||i.has(e.id)||(i.add(e.id),e.session?.archived===!0)?!1:e.lane===`queued`?n?.sessionQueue===!0:e.lane!==`done`||l(e.since,{now:t,timeZoneOffsetMinutes:r,doneWindow:`today`}))}function rt(e,t){let n=nt(e,t).sort(tt),r=t.lanes?.length?new Set(t.lanes):null,i=t.projects?.length?new Set(t.projects):null,a=n.filter(e=>(!r||r.has(e.lane))&&(!i||i.has(e.workspaceKey))),o=Xe();for(let e of n)o[e.lane]+=1;let s=new Set(n.map(e=>e.workspaceKey)),l=[];if(t.groupBy===`project`){let e=[...t.projectOrder??[]],n=new Set(e.map(e=>e.key));for(let t of a)n.has(t.workspaceKey)||(n.add(t.workspaceKey),e.push({key:t.workspaceKey,cwd:t.projectCwd}));for(let t of e){let e=a.filter(e=>e.workspaceKey===t.key);if(!e.length)continue;let n=Xe();for(let t of e)n[t.lane]+=1;l.push({kind:`project`,key:t.key,cwd:t.cwd,counts:n,items:e})}}else for(let e of c){let t=a.filter(t=>t.lane===e),n=e===`attention`||e===`running`;r&&!r.has(e)||!t.length&&!n||l.push({kind:`status`,id:e,items:t})}let u=l.flatMap(e=>e.kind===`status`&&e.id===`done`&&t.doneCollapsed?[]:e.items);return{total:n.length,projectCount:s.size,running:o.running,counts:o,sections:l,order:u,attention:u.filter(e=>e.lane===`attention`),attentionAll:n.filter(e=>e.lane===`attention`),filteredEmpty:n.length>0&&a.length===0}}function it(e,t){let n=Xe(),r={},i=nt(e,t);for(let e of i)n[e.lane]+=1,r[e.workspaceKey]=(r[e.workspaceKey]??0)+1;return{total:i.length,lanes:n,projects:r}}var $=r();function at({files:e,added:t,removed:n}){let{t:r}=i();return(0,$.jsxs)(`span`,{"data-change-stats":!0,className:`flex min-w-0 items-center gap-1.5 text-xs whitespace-nowrap text-content-secondary`,children:[(0,$.jsx)(`span`,{children:r(`board:card.files`,{count:e})}),(0,$.jsxs)(`span`,{className:`font-mono text-success tabular-nums`,children:[`+`,t]}),(0,$.jsxs)(`span`,{className:`font-mono text-danger tabular-nums`,children:[`−`,n]})]})}function ot({sessionId:e,completedAt:t}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=n.current;if(!e||r)return;if(typeof IntersectionObserver>`u`){i(!0);return}let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(i(!0),t.disconnect())},{rootMargin:`120px`});return t.observe(e),()=>t.disconnect()},[r]);let{data:o}=a({queryKey:[`session-change-summary`,e,t],queryFn:()=>Ce(e),enabled:r,staleTime:6e4,retry:0});return o?.status!==`known`||!o.changedFiles?(0,$.jsx)(`span`,{ref:n}):(0,$.jsx)(`span`,{ref:n,className:`contents`,children:(0,$.jsx)(at,{files:o.changedFiles,added:o.added||0,removed:o.removed||0})})}function st({text:e,prefix:t,phone:n=!1,args:r=!1,variant:a=`well`,tabIndex:o,lead:s}){let{t:c}=i(),l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1);(0,Q.useLayoutEffect)(()=>{let e=l.current;if(!e||f)return;let t=()=>d(e.scrollHeight>e.clientHeight+1);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[f,e]);let m=a===`plain`,h=(0,Q.useMemo)(()=>e.split(/(\s+)/).filter(Boolean),[e]),g=(u||f)&&(0,$.jsx)(`button`,{type:`button`,"data-card-stop":!0,tabIndex:o,className:z(`text-left text-xs text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:min-h-11`,m?`mt-0.5 rounded-xs underline underline-offset-2`:`w-full border-t border-well-stroke px-2.5 py-1`),"aria-expanded":f,onClick:()=>p(e=>!e),children:c(f?`board:card.collapse`:r?`board:card.expandArgs`:`board:card.expand`)}),_=(0,$.jsxs)(`pre`,{ref:l,"data-command-text":!0,"aria-label":r?c(`board:confirm.fullArgs`):void 0,className:z(`min-w-0 font-mono text-xs leading-5 whitespace-pre-wrap`,m?`text-content-secondary`:`text-well-text`,!f&&`line-clamp-3 max-h-15`,n&&`text-sm`),children:[s&&(0,$.jsx)(`span`,{className:`font-sans select-none`,children:s}),t&&(0,$.jsxs)(`span`,{className:z(`select-none`,m?`text-content-muted`:`text-well-muted`),children:[t,` `]}),h.map((e,t)=>/^\s+$/.test(e)?e:(0,$.jsx)(`span`,{"data-command-token":!0,className:`inline-block max-w-full align-top break-all`,children:e},t))]});return m?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start`,children:[_,g]}):(0,$.jsxs)(`div`,{className:`min-w-0 rounded-sm border border-well-stroke bg-well`,children:[(0,$.jsx)(`div`,{className:`px-2.5 py-1.5`,children:_}),g]})}function ct(e){return e instanceof Element&&!!e.closest(`button, a, input, textarea, [role="menuitem"], [data-card-stop]`)}function lt({binding:e}){let t=e&&/^Key[A-Z]$/.test(e)?e.slice(3):``;return t?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60 pointer-coarse:hidden`,children:t}):null}function ut(e){return e.split(`
3
- `).map(e=>e.trim()).find(Boolean)??``}function dt({item:e,now:t,project:n,active:r,dimmed:a,phase:o,bindings:s,handlers:c,menu:l,onStartNow:u,card:d=!1}){let{t:f}=i(),p=(0,Q.useRef)(null),m=r?0:-1,h=e.lane===`attention`,g=e.approvals[0]??null,_=g?.severity===`critical`,y=se(e),b=e.title||f(`navigation:shell.untitledSession`),x=()=>c.onOpen(e.id),S=`${e.lane}:${e.status}`,w=(0,Q.useRef)(S);(0,Q.useLayoutEffect)(()=>{w.current!==S&&(w.current=S,p.current?.getAnimations?.().forEach(e=>e.cancel()))},[S]);let T=(0,Q.useRef)(!1),E=e=>{let t=T.current;T.current=!1,!(t||ct(e.target))&&x()},D=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),x())},O=``;O=h?Ne(f,ce(e)):e.status===`failed`?f(`board:status.failedHandled`):e.status===`stopped`?f(`board:status.stopped`):e.lane===`running`?f(`board:status.running`):e.lane===`queued`?f(`board:status.queued`):e.unread?f(`board:overview.doneUnread`):f(`board:status.done`);let k=e.status===`approval`&&e.approvalsState===`ready`&&g?g.toolName||`—`:``,A=``,j=``;if(h&&e.since!==null)A=Re(t-e.since),j=f(`board:overview.waited`,{wait:A});else if(e.lane===`running`){let n=e.startedAt??e.since;A=Pe(n===null?null:t-n),j=A?f(`board:overview.ran`,{time:A}):``}else e.lane===`done`&&(A=Le(e.since),j=A?f(`board:overview.finishedAt`,{time:A}):``);let M=null,N=null,P=(0,$.jsxs)(B,{size:`sm`,tabIndex:m,onClick:x,children:[f(`board:overview.openToHandle`),!d&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60 pointer-coarse:hidden`,children:`↵`})]});if(e.status===`approval`){if(e.approvalsState!==`ready`||!g)M=(0,$.jsx)(`p`,{role:`status`,className:`text-xs leading-5 text-content-muted`,children:e.approvalsState===`error`?f(`board:card.approvalUnavailable`):f(`board:card.approvalLoading`)});else{let t=Y(g.reason),n=_&&t?Z(g.reason):``,r=g.toolName===`bash`&&g.command,i=g.command||g.path,a=i?``:ye(g),o=!i&&g.reason&&!t?g.reason:``,s=e.approvals.length-1,c=e.approvals.slice(1).some(e=>e.severity===`critical`),l=_?(0,$.jsxs)(`span`,{"data-severity":`critical`,className:`font-medium text-warning-strong`,children:[n?f(`board:card.criticalWithReason`,{reason:n}):f(`board:card.critical`),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `})]}):null;M=(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[i?(0,$.jsx)(st,{text:i,prefix:r?`$`:``,variant:`plain`,tabIndex:m,lead:l}):a?(0,$.jsx)(st,{text:a,prefix:``,variant:`plain`,args:!0,tabIndex:m,lead:l}):l&&(0,$.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5`,children:l}),o&&(0,$.jsx)(`p`,{className:`min-w-0 text-xs break-words text-content-secondary`,children:o}),s>0&&(0,$.jsx)(`p`,{className:`text-xs leading-5 text-content-muted`,children:f(c?`board:card.moreApprovalsCritical`:`board:card.moreApprovals`,{count:s})})]})}if(y.kind===`decide`&&g){let t=c.isPending(`approve`,e.id,g.id),n=c.isPending(`deny`,e.id,g.id);N=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(B,{variant:`outline`,size:`sm`,tabIndex:m,disabled:t||n,loading:n,"aria-label":f(`board:sidebar.denyNamed`,{title:b}),"aria-keyshortcuts":W(s.deny)||void 0,onClick:()=>c.onDeny(e,g),children:[f(`board:card.deny`),(0,$.jsx)(lt,{binding:s.deny})]}),(0,$.jsxs)(B,{size:`sm`,tabIndex:m,disabled:t||n,loading:t,"aria-label":f(`board:sidebar.approveNamed`,{title:b}),"aria-keyshortcuts":W(s.approve)||void 0,onClick:()=>c.onApprove(e,g),children:[f(`board:card.approve`),(0,$.jsx)(lt,{binding:s.approve})]})]})}else N=P}else if(e.status===`question`){let t=e.question,n=G(t),r=t?c.isPending(`answer`,e.id,t.id):!1,i=t?.questions[0];M=t?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,$.jsxs)(`p`,{"data-row-question":!0,className:`min-w-0 text-[13px] leading-5 break-words text-content`,children:[i?.header&&(0,$.jsxs)(`span`,{className:`text-content-muted`,children:[i.header,` · `]}),i?.question,t.questions.length>1&&(0,$.jsxs)(`span`,{className:`text-content-muted`,children:[` `,`· `,f(`board:sidebar.reason.questions`,{count:t.questions.length})]})]}),n&&(0,$.jsxs)(`div`,{"data-question-pills":!0,role:`group`,"aria-label":i?.question,className:`flex min-w-0 flex-wrap gap-1.5`,children:[n.map((t,n)=>(0,$.jsxs)(B,{variant:`outline`,size:`sm`,tabIndex:m,disabled:r,"data-question-pill":t,"aria-label":f(`board:question.answerNamed`,{title:b,option:t}),"aria-keyshortcuts":String(n+1),className:z(`h-auto min-h-7 max-w-full whitespace-normal`,d&&`min-h-11`),onClick:()=>c.onAnswer(e,t),children:[!d&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-[11px] opacity-60 pointer-coarse:hidden`,children:n+1}),(0,$.jsx)(`span`,{className:`break-words text-left`,children:t})]},t)),(0,$.jsx)(B,{variant:`ghost`,size:`sm`,tabIndex:m,className:z(`h-auto min-h-7`,d&&`min-h-11`),onClick:x,children:f(`board:question.other`)})]})]}):null,N=n?null:P}else if(e.status===`failed`&&h){let t=ut(e.error)||[...e.tail].reverse().find(ge)?.trim()||``,n=c.isPending(`retry`,e.id);M=t?(0,$.jsx)(`p`,{"data-card-error":!0,className:`min-w-0 truncate font-mono text-xs leading-5 text-content-secondary`,children:t}):null,N=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{variant:`outline`,size:`sm`,tabIndex:m,onClick:x,children:f(`board:overview.log`)}),(0,$.jsxs)(B,{size:`sm`,tabIndex:m,loading:n,disabled:n,"aria-label":f(`board:overview.retryNamed`,{title:b}),"aria-keyshortcuts":W(s.retry)||void 0,onClick:()=>c.onRetry(e),children:[f(`board:card.retry`),(0,$.jsx)(lt,{binding:s.retry})]})]})}else if(e.lane===`running`){let n=e.activity,r=e.agents,i=null;if(n?.type===`tool`){let e=n.startedAt?Date.parse(n.startedAt):NaN,r=[n.name,n.summary].filter(Boolean).join(` · `),a=Number.isFinite(e)?Re(Math.max(0,t-e)):``;i=(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r,a&&(0,$.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,a]})]})}else if(e.tail.length)i=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.tail.at(-1)});else if(n?.type===`model`){let e={starting:f(`board:activity.starting`),thinking:f(`board:activity.thinking`),responding:f(`board:activity.responding`),compacting:f(`board:activity.compacting`)}[n.stage]||f(`board:activity.working`);i=(0,$.jsx)(`span`,{className:`min-w-0 truncate font-sans`,children:e})}(i||r&&r.total>0)&&(M=(0,$.jsxs)(`p`,{"data-card-activity":!0,className:`flex min-w-0 items-center gap-2 font-mono text-xs leading-5 text-content-secondary`,children:[i,r&&r.total>0&&(0,$.jsxs)(`span`,{"data-card-agents":!0,className:`flex flex-none items-center gap-1 font-sans text-content-muted`,title:f(`board:card.subAgentProgress`,r),children:[(0,$.jsx)(v,{className:`size-3`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:f(`board:overview.subAgents`,{running:r.running,total:r.total})}),(0,$.jsx)(`span`,{className:`sr-only`,children:f(`board:card.subAgentProgress`,r)})]})]}))}else if(e.lane===`queued`){let t=e.queue?.startAfterTitle?f(`board:overview.queuedAfter`,{title:e.queue.startAfterTitle}):f(`board:overview.queuedAfterUnknown`);M=(0,$.jsx)(`p`,{"data-queue-detail":!0,className:`min-w-0 truncate text-xs leading-5 text-content-secondary`,children:e.queuePosition?`${t} · ${f(`board:overview.queuePosition`,{n:e.queuePosition})}`:t}),u&&(N=(0,$.jsx)(B,{variant:`outline`,size:`sm`,tabIndex:m,disabled:c.isPending(`start`,e.id),"data-start-now":e.id,onClick:()=>u(e),children:f(`board:overview.startNow`)}))}else if(e.lane===`done`){let t=ut(e.preview);M=t?(0,$.jsx)(`p`,{"data-card-preview":!0,className:`min-w-0 truncate text-xs leading-5 text-content-secondary`,children:t}):null;let n=_e(e);N=n?(0,$.jsx)(at,{...n}):e.changeStats?null:(0,$.jsx)(ot,{sessionId:e.id,completedAt:typeof e.session.lastCompletedAt==`string`?e.session.lastCompletedAt:null})}return d&&h?(0,$.jsxs)(`article`,{ref:p,"data-board-card":e.id,"data-overview-row":!0,"data-overview-card":!0,"data-lane":e.lane,"data-status":e.status,"data-severity":e.severity??void 0,tabIndex:m,"aria-label":f(`board:card.label`,{title:b,status:O}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{T.current=ct(e.target)},onClick:E,onKeyDown:D,className:z(`relative flex min-w-0 cursor-pointer flex-col gap-2 rounded-[14px] border border-st-attn-border bg-panel p-3.5 shadow-edge transition-opacity duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`,a&&`opacity-50`),children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-start gap-x-2.5`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 grid size-4 place-items-center`,children:(0,$.jsx)(Se,{status:X(e),phase:o})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-base leading-5 font-medium text-content`,children:[e.bot&&(0,$.jsx)(Ve,{character:e.bot.character,color:e.bot.color,size:18}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:b})]}),(0,$.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1 text-xs leading-5`,children:[(0,$.jsxs)(`span`,{"data-row-status":!0,className:`flex-none text-warning-strong`,children:[O,k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:k})]})]}),n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,$.jsx)(`span`,{"data-row-project":!0,className:`min-w-0 truncate font-mono text-content-muted`,title:e.cwd||void 0,children:n})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[A&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:`text-xs text-content-muted tabular-nums`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:A}),(0,$.jsx)(`span`,{className:`sr-only`,children:j})]}),(0,$.jsx)(Fe,{row:{id:e.id,title:b,pinned:e.pinned},actions:l,canMarkHandled:e.status===`failed`,align:`end`,tabIndex:m,className:`size-11`})]})]}),M&&(0,$.jsx)(`div`,{className:`min-w-0 pl-[26px]`,children:M}),N&&(0,$.jsx)(`div`,{"data-card-actions":!0,className:`grid grid-cols-2 gap-2 [&>button]:h-11 [&>button]:w-full [&>button]:text-sm [&>button:only-child]:col-span-2`,children:N})]}):(0,$.jsxs)(`article`,{ref:p,"data-board-card":e.id,"data-overview-row":!0,"data-lane":e.lane,"data-status":e.status,"data-severity":e.severity??void 0,tabIndex:m,"aria-label":f(`board:card.label`,{title:b,status:O}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{T.current=ct(e.target)},onClick:E,onKeyDown:D,className:z(`group/row relative grid min-h-[52px] min-w-0 cursor-pointer grid-cols-[16px_minmax(0,1fr)_auto] items-start gap-x-3 rounded-[var(--r-md)] px-3 py-[11px] transition-[opacity,background-color] duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,a&&`opacity-50`),children:[(0,$.jsx)(`span`,{className:`mt-0.5 grid size-4 place-items-center`,children:(0,$.jsx)(Se,{status:X(e),phase:o})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-2.5 leading-5`,children:[e.bot&&(0,$.jsx)(Ve,{character:e.bot.character,color:e.bot.color,size:18,className:`self-center`}),(0,$.jsx)(`span`,{className:z(`min-w-0 truncate text-base font-medium`,e.lane===`done`?`text-content-secondary`:`text-content`),children:b}),(0,$.jsxs)(`span`,{"data-row-status":!0,className:z(`flex-none text-xs`,h?`text-warning-strong`:`text-content-muted`),children:[O,k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:k})]})]}),n&&(0,$.jsx)(`span`,{"data-row-project":!0,className:`min-w-0 shrink truncate font-mono text-xs text-content-muted`,title:e.cwd||void 0,children:n}),e.pinned&&(0,$.jsx)(C,{className:`size-3 flex-none self-center text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":f(`board:card.pinned`)})]}),M]}),(0,$.jsxs)(`div`,{className:`flex min-h-[30px] items-center gap-2 self-start`,children:[N&&(0,$.jsx)(`div`,{className:`flex items-center gap-1.5`,children:N}),(0,$.jsxs)(`div`,{className:z(`relative flex min-h-[30px] items-center justify-end pointer-coarse:gap-2`,!A&&`min-w-[26px]`),children:[A&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:z(`min-w-[44px] text-right text-xs text-content-muted tabular-nums transition-opacity duration-(--d-fast) group-focus-within/row:opacity-0 group-hover/row:opacity-0 group-has-[[data-state=open]]/row:opacity-0 pointer-coarse:opacity-100`,e.lane===`running`&&`font-mono text-content-secondary`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:A}),(0,$.jsx)(`span`,{className:`sr-only`,children:j})]}),(0,$.jsx)(Fe,{row:{id:e.id,title:b,pinned:e.pinned},actions:l,canMarkHandled:h&&e.status===`failed`,align:`end`,tabIndex:m,className:`absolute top-1/2 right-0 -translate-y-1/2 opacity-0 group-focus-within/row:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100 pointer-coarse:static pointer-coarse:translate-y-0 pointer-coarse:opacity-100`})]})]})]})}var ft=(0,Q.memo)(dt),pt=(0,Q.lazy)(()=>t(()=>import(`./ManageProjectsDialog-D4HGh_Lh.js`).then(e=>({default:e.ManageProjectsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48])));function mt({commands:e,manageMounted:t,manageOpen:n,onManageOpenChange:r}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(de,{picker:e.picker,folderDialog:e.folderDialog}),t&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(pt,{open:n,onOpenChange:r,commands:e})})]})}function ht({notify:e,requestConfirm:t,requestText:n,onProjectChosen:r,announceChoice:a}){let{t:o}=i(),[s,c]=(0,Q.useState)(``),l=(0,Q.useRef)(``),{newProject:u,picking:d,picker:f,folderDialog:p}=J({onProjectChosen:r,onError:t=>e(t,`error`),onRemembered:a?t=>e(o(`board:project.chosen`,{project:ve(t)}),`info`):void 0}),m={t:o,notify:e,requestConfirm:t,requestText:n},h=e=>ke(e,ve(e.cwd),m,{description:o(`board:project.renameDescription`)}),g=e=>Ee(e,m),_=e=>{let t=fe.getState();t.cwd&&ue(t.cwd)===e.key&&t.rememberLaunch({cwd:``});let n=q.getState();n.projects.includes(e.key)&&n.setProjectFilter(n.projects.filter(t=>t!==e.key))};return{newProject:u,picking:d,rename:h,resetName:g,remove:async e=>{if(!l.current){l.current=e.key,c(e.key);try{await De(e,m)===`deleted`&&_(e)}finally{l.current=``,c(``)}}},unregister:e=>{l.current||Oe(e,m)&&_(e)},busyKey:s,picker:f,folderDialog:p}}function gt({notify:e,requestConfirm:t,requestText:n,onNewTask:r,keys:i}){let a=ht({notify:e,requestConfirm:t,requestText:n,onProjectChosen:r,announceChoice:!0}),o=Te(e=>e.moveWorkspace),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d=()=>{c(!0),u(!0)},{rename:f,resetName:p,remove:m,unregister:h}=a;return{actions:(0,Q.useMemo)(()=>({onNewTask:e=>{fe.getState().rememberLaunch(me(e.cwd)),r()},onRename:e=>void f(e),onResetName:e=>p(e),onMove:(e,t)=>o(e.key,t,i),onManage:()=>{c(!0),u(!0)},onDelete:e=>e.count===0?h(e):void m(e)}),[i,o,r,m,f,p,h]),deleting:!!a.busyKey,newProject:a.newProject,picking:a.picking,openManage:d,dialogs:{commands:a,manageMounted:s,manageOpen:l,onManageOpenChange:u}}}var _t=`all`,vt=[`attention`,`running`,`queued`,`done`];function yt({items:e,now:t,capabilities:n,laneName:r,notify:a,requestConfirm:o,requestText:s,onNewTask:c}){let{t:l}=i(),u=q(e=>e.lanes),d=q(e=>e.projects),f=q(e=>e.setLaneFilter),p=q(e=>e.setProjectFilter),m=We(),h=gt({notify:a,requestConfirm:o,requestText:s,onNewTask:c,keys:(0,Q.useMemo)(()=>m.map(e=>e.key),[m])}),g=(0,Q.useRef)(null),_=(0,Q.useMemo)(()=>it(e,{now:t,capabilities:n}),[n,e,t]),v=vt.filter(e=>e!==`queued`||n.sessionQueue===!0&&_.lanes.queued>0),S=u[0]??_t,C=d[0]??``,E=m.find(e=>e.key===C),O=!!E?.cwd&&E?.key!==`\0`;return(0,$.jsxs)(`div`,{"data-overview-filters":!0,className:`mb-4 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(F,{id:Ue,"aria-label":l(`board:filter.statuses`),value:S,onValueChange:e=>f(e===_t?[]:[e]),options:[{value:_t,label:l(`board:sidebar.filter.all`),count:_.total},...v.map(e=>({value:e,label:r[e],count:_.lanes[e]}))]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,$.jsxs)(He,{"aria-label":l(`board:filter.projects`),className:`w-48`,value:C,onChange:e=>p(e.target.value?[e.target.value]:[]),children:[(0,$.jsx)(`option`,{value:``,children:l(`board:filter.allProjects`)}),m.map(e=>(0,$.jsx)(`option`,{value:e.key,children:e.label},e.key))]}),(0,$.jsxs)(P,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`icon`,"data-overview-project-menu":!0,"aria-label":E?l(`board:project.actionsFor`,{project:E.label}):l(`board:sidebar.filter.projectActions`),title:E?l(`board:project.actionsFor`,{project:E.label}):l(`board:sidebar.filter.projectActions`),children:(0,$.jsx)(y,{"aria-hidden":`true`})})}),(0,$.jsxs)(N,{align:`end`,className:`w-52`,onCloseAutoFocus:e=>{let t=g.current;t&&(g.current=null,e.preventDefault(),t())},children:[E&&(0,$.jsxs)($.Fragment,{children:[O&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(j,{onSelect:()=>g.current=()=>h.actions.onNewTask(E),children:[(0,$.jsx)(w,{"aria-hidden":`true`}),l(`board:project.newTaskHere`)]}),(0,$.jsxs)(j,{onSelect:()=>h.actions.onRename(E),children:[(0,$.jsx)(Ke,{"aria-hidden":`true`}),l(`board:project.rename`)]}),E.custom&&(0,$.jsxs)(j,{onSelect:()=>h.actions.onResetName(E),children:[(0,$.jsx)(T,{"aria-hidden":`true`}),l(`board:project.resetName`)]})]}),(0,$.jsxs)(j,{variant:`destructive`,disabled:h.deleting,onSelect:()=>h.actions.onDelete(E),children:[E.count===0?(0,$.jsx)(b,{"aria-hidden":`true`}):(0,$.jsx)(D,{"aria-hidden":`true`}),E.count===0?l(`board:project.remove`):l(`board:project.delete`)]}),(0,$.jsx)(A,{})]}),(0,$.jsxs)(j,{disabled:h.picking,onSelect:()=>g.current=()=>void h.newProject(),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),l(`board:sidebar.filter.addProject`)]}),(0,$.jsxs)(j,{onSelect:()=>g.current=h.openManage,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),l(`board:project.manage`)]})]})]})]}),(0,$.jsx)(mt,{...h.dialogs})]})}function bt({project:e,first:t,last:n,deleting:r,actions:a}){let{t:o}=i(),s=(0,Q.useRef)(null),c=!!e.cwd;return(0,$.jsxs)(P,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":o(`board:project.actionsFor`,{project:e.label}),title:o(`board:project.actionsFor`,{project:e.label}),children:(0,$.jsx)(y,{"aria-hidden":`true`})})}),(0,$.jsxs)(N,{align:`end`,className:`w-52`,onCloseAutoFocus:e=>{let t=s.current;t&&(s.current=null,e.preventDefault(),t())},children:[c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(j,{onSelect:()=>s.current=()=>a.onNewTask(e),children:[(0,$.jsx)(w,{"aria-hidden":`true`}),o(`board:project.newTaskHere`)]}),(0,$.jsxs)(j,{onSelect:()=>a.onRename(e),children:[(0,$.jsx)(Ke,{"aria-hidden":`true`}),o(`board:project.rename`)]}),e.custom&&(0,$.jsxs)(j,{onSelect:()=>a.onResetName(e),children:[(0,$.jsx)(T,{"aria-hidden":`true`}),o(`board:project.resetName`)]})]}),(0,$.jsxs)(j,{disabled:t,onSelect:()=>a.onMove(e,-1),children:[(0,$.jsx)(h,{"aria-hidden":`true`}),o(`board:project.moveUpShort`)]}),(0,$.jsxs)(j,{disabled:n,onSelect:()=>a.onMove(e,1),children:[(0,$.jsx)(p,{"aria-hidden":`true`}),o(`board:project.moveDownShort`)]}),(0,$.jsxs)(j,{onSelect:()=>s.current=a.onManage,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),o(`board:project.manage`)]}),(0,$.jsx)(A,{}),(0,$.jsxs)(j,{variant:`destructive`,disabled:r,onSelect:()=>a.onDelete(e),children:[e.count===0?(0,$.jsx)(b,{"aria-hidden":`true`}):(0,$.jsx)(D,{"aria-hidden":`true`}),e.count===0?o(`board:project.remove`):o(`board:project.delete`)]})]})]})}var xt=1200;function St({items:e,laneName:t,template:n,separator:r,skipAttention:i}){let a=(0,Q.useRef)(null),o=(0,Q.useRef)([]),s=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(``),u=(0,Q.useCallback)(e=>{o.current.push(e),!s.current&&(s.current=setTimeout(()=>{s.current=null,l(o.current.splice(0).join(r))},xt))},[r]);return(0,Q.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,Q.useLayoutEffect)(()=>{let r=a.current;if(a.current=new Map(e.map(e=>[e.id,e.lane])),r)for(let a of e){let e=r.get(a.id);e!==void 0&&e!==a.lane&&(i&&a.lane===`attention`||u(n(a.title,t[a.lane])))}},[u,e,t,i,n]),c}var Ct=null;function wt(e){Ct=e}function Tt(){return Ct}function Et(){Ct=null}var Dt=1600,Ot=`[data-overview-scroller]`;function kt(e,t){return e?.querySelector(`[data-board-card="${CSS.escape(t)}"]`)??null}function At(e){return e.dataset.overviewScroller===void 0?`other`:`overview`}function jt(e){let t=se(e);return t.kind===`decide`?e.approvals.find(e=>e.id===t.approvalId)??null:null}function Mt(){return new Promise(e=>requestAnimationFrame(()=>e()))}function Nt({rootRef:e,order:t,attention:n,attentionAll:r,onRevealAttention:a,reveal:o,ready:s,notify:c,sessionHref:l,onOpenSession:u,onToggleGrouping:d}){let{t:f}=i(),p=ae(),m=H(e=>e.boardBindings),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(p);y.current=p;let b=(0,Q.useRef)(t);b.current=t;let x=(0,Q.useRef)(n);x.current=n;let S=(0,Q.useRef)(r);S.current=r;let C=(0,Q.useRef)(o);C.current=o;let[w,T]=(0,Q.useState)(!1),E=(0,Q.useMemo)(()=>t.map(e=>e.id),[t]),D=E.includes(h)?h:E[0]??``,O=(0,Q.useCallback)(async t=>{if(!t)return;g(t),await Mt();let n=(C.current?await C.current(t):null)??kt(e.current,t);n?.scrollIntoView({block:`nearest`}),n?.focus({preventScroll:!0})},[e]),k=(0,Q.useCallback)(e=>{let t=x.current,n=t.findIndex(t=>t.id===e);return n<0?t[0]?.id??``:t[n+1]?.id??t[n-1]?.id??``},[]),A=(0,Q.useCallback)(t=>{let n={};e.current?.querySelectorAll(Ot).forEach(e=>{n[At(e)]=e.scrollTop}),wt({focusId:t,scroll:n}),u(t)},[u,e]),j=(0,Q.useCallback)(e=>{e.ok||e.reason===`pending`||c(f(`board:action.failed`),`error`)},[c,f]),M=(0,Q.useCallback)(t=>Ie(kt(e.current,t),{duration:180,scale:.9}),[e]),N=(0,Q.useCallback)(t=>kt(e.current,t)?.getAnimations().forEach(e=>e.cancel()),[e]),P=(0,Q.useCallback)(async(e,t)=>{let n=k(e.id),r=e.approvals.length<=1;r&&await M(e.id);let i=await y.current.approve(e.id,t.id,{confirmCritical:!1});return i.ok?(r&&n&&O(n),i):(N(e.id),i)},[M,O,k,N]),F=(0,Q.useMemo)(()=>({onFocusCard:g,onOpen:A,onApprove:(e,t)=>{if(t.severity===`critical`){A(e.id);return}P(e,t).then(t=>{!t.ok&&t.reason===`confirmation-required`?A(e.id):j(t)})},onDeny:(e,t)=>{let n=k(e.id),r=e.approvals.length<=1;(async()=>{r&&await M(e.id);let i=await y.current.deny(e.id,t.id);i.ok||N(e.id),j(i),i.ok&&r&&n&&O(n)})()},onRetry:e=>{let t=k(e.id);(async()=>{await M(e.id);let n=await y.current.retry(e.id);n.ok||N(e.id),j(n),n.ok&&t&&O(t)})()},onAnswer:(e,t)=>{let n=e.question;if(!n||!G(n)?.includes(t)){A(e.id);return}let r=k(e.id);(async()=>{await M(e.id);let i=await y.current.answer(e.id,n.id,t);!i.ok&&i.reason===`closed`?c(f(`board:question.closed`),`info`):(i.ok||N(e.id),j(i)),i.ok&&r&&O(r)})()},onStartNow:e=>void y.current.startNow(e.id).then(j),onMarkHandled:e=>void y.current.markHandled(e.id).then(j),onPin:e=>void y.current.pin(e.id,!e.pinned).then(j),onArchive:e=>void y.current.archive(e.id,!0).then(t=>{t.ok?c(f(`board:action.archived`,{title:e.title})):j(t)}),onCopyLink:e=>{let t=l(e.id),n=typeof navigator<`u`?navigator.clipboard:void 0;if(!n){c(f(`board:action.copyFailed`),`error`);return}n.writeText(t).then(()=>c(f(`board:action.copied`)),()=>c(f(`board:action.copyFailed`),`error`))},isPending:(e,t,n)=>p.isPending(e,t,n)}),[p,P,M,O,k,c,A,j,N,l,f]),I=(0,Q.useCallback)(()=>{if(S.current.length-x.current.length>0&&a){T(!0),a();return}let e=x.current[0];if(!e){c(f(`board:triage.nothing`));return}v({total:x.current.length,finished:!1}),O(e.id)},[O,c,a,f]);(0,Q.useEffect)(()=>{!w||n.length<r.length||(T(!1),I())},[n.length,r.length,I,w]);let L=(0,Q.useCallback)(()=>v(null),[]);(0,Q.useEffect)(()=>{if(!_||_.finished)return;if(n.length===0){v({..._,finished:!0});return}let e=_.total-Math.min(_.total,n.length);e+n.length>_.total&&v({..._,total:e+n.length})},[n.length,_]),(0,Q.useEffect)(()=>{if(!_?.finished)return;let e=setTimeout(()=>v(null),Dt);return()=>clearTimeout(e)},[_?.finished]);let R=(0,Q.useCallback)(e=>{let t=_?x.current:b.current;if(!t.length)return;let n=t.findIndex(e=>e.id===D),r=n<0?0:Math.max(0,Math.min(t.length-1,n+e));O(t[r].id)},[D,O,_]);(0,Q.useEffect)(()=>{let t=t=>{if(te(t)||ne(t.target))return;let n=e.current,r=t.target instanceof HTMLElement?t.target:null,i=!!r?.closest(`[data-board-card]`);if(!(r&&n?.contains(r)||r===document.body))return;let a=!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey,o=i||!!_,s=b.current.find(e=>e.id===D),c=o&&a&&/^[1-4]$/.test(t.key)&&s?.status===`question`?G(s.question)?.[Number(t.key)-1]:void 0,l=!0;if(t.key===`Escape`&&_)L();else if(U(t,m.boardNext)||i&&a&&t.key===`ArrowDown`)R(1);else if(U(t,m.boardPrevious)||i&&a&&t.key===`ArrowUp`)R(-1);else if(U(t,m.boardToggleGrouping))d();else if(U(t,m.boardTriage))_?L():I();else if(o&&U(t,m.boardApprove)&&s?.status===`approval`){let e=jt(s);e&&F.onApprove(s,e)}else if(o&&U(t,m.boardDeny)&&s?.status===`approval`){let e=jt(s);e&&F.onDeny(s,e)}else o&&U(t,m.boardRetry)&&s?.status===`failed`&&s.lane===`attention`?F.onRetry(s):s&&c?F.onAnswer(s,c):t.key===`Enter`&&a&&!i&&s&&_?A(s.id):l=!1;l&&t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[m,D,L,F,R,d,A,e,I,_]),(0,Q.useLayoutEffect)(()=>{let t=e.current;return()=>{if(!t||Tt())return;let e=document.activeElement,n=e instanceof HTMLElement&&t.contains(e)?e.closest(`[data-board-card]`):null,r={};t.querySelectorAll(Ot).forEach(e=>{r[At(e)]=e.scrollTop}),wt({focusId:n?.dataset.boardCard??``,scroll:r})}},[e]),(0,Q.useLayoutEffect)(()=>{let t=Tt();!t||!s||!E.length||(Et(),e.current?.querySelectorAll(Ot).forEach(e=>{let n=At(e);n in t.scroll&&(e.scrollTop=t.scroll[n])}),E.includes(t.focusId)&&(g(t.focusId),requestAnimationFrame(()=>{(async()=>{((C.current?await C.current(t.focusId):null)??kt(e.current,t.focusId))?.focus({preventScroll:!0})})()})))},[E,s,e]);let ee=_?Math.min(_.total,_.total-Math.min(_.total,n.length)+1):0;return{actions:p,handlers:F,activeId:D,focusCard:O,triage:_?{..._,index:ee}:null,startTriage:I,exitTriage:L,bindings:m}}function Pt(e){let{t}=i(),n=Te(e=>e.names),r=Te(e=>e.order),a=we(e=>e.projects);return(0,Q.useMemo)(()=>re(ie([...e],a),r).map(e=>({...e,label:n[e.key]||(e.cwd?ve(e.cwd):t(`board:filter.noProject`)),custom:!!(e.cwd&&n[e.key])})),[n,r,e,a,t])}var Ft=Object.freeze({approve:null,deny:null,retry:null}),It=(0,Q.lazy)(()=>t(()=>import(`./ManageProjectsDialog-D4HGh_Lh.js`).then(e=>({default:e.ManageProjectsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))),Lt=`(min-width: 1280px)`;function Rt(e){let t=d(),{t:n}=i();return(0,Q.useEffect)(()=>(document.title=`${n(`board:page.title`)} · ${k}`,()=>{document.title=k}),[n]),(0,$.jsx)(zt,{...e,phone:t},t?`phone`:`desktop`)}function zt({activeSessionId:e,onOpenSession:t,onOpenHistory:n,sessionHref:r,notify:a,requestConfirm:c,requestText:l,onNewTask:d,phone:f}){let{t:p}=i(),m=s(`overview-card`).placed,h=u(Lt),g=m.length?f?`phone`:h?`column`:`popover`:null,_=n=>(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(o,{placed:m,layout:n,activeSessionId:e,notify:a,onOpenSession:t})}),v=he({doneWindow:`today`}),y=q(),b=qe(),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C=le(),w=Pt(v.projects),T=y.collapsedLanes.includes(`done`),D=f?y.groupBy:`lane`,O=(0,Q.useMemo)(()=>rt(v.all,{now:C,groupBy:D,capabilities:v.capabilities,lanes:y.lanes,projects:y.projects,projectOrder:w,doneCollapsed:T}),[v.all,v.capabilities,T,C,w,D,y.lanes,y.projects]),k=(0,Q.useMemo)(()=>new Map(w.map(e=>[e.key,e])),[w]),A=O.counts.attention+O.counts.running>0,j=oe(A),M=!v.isLoading&&!(v.error&&v.total===0),N=(0,Q.useMemo)(()=>{let e=[];for(let t of O.sections){let n=t.kind===`status`?`status:${t.id}`:`project:${t.key}`;if(e.push({kind:`header`,key:n,section:t}),t.kind===`status`&&t.id===`done`&&T)continue;!t.items.length&&t.kind===`status`&&e.push({kind:`empty`,key:`${n}:empty`,lane:t.id});let r=0;for(let n of t.items)e.push({kind:`row`,key:n.id,item:n,phase:n.lane===`running`?r++*.381966%1:0})}return e},[T,O.sections]),P=O.order.length,I=Je(P),L=(0,Q.useRef)(-1),R=Me({count:I?N.length:0,getScrollElement:()=>S.current,estimateSize:e=>N[e]?.kind===`row`?64:40,overscan:8,getItemKey:e=>N[e]?.key??e,rangeExtractor:e=>{let t=je(e),n=L.current;return n<0||n>=e.count||t.includes(n)?t:[...t,n].sort((e,t)=>e-t)}}),ee=(0,Q.useCallback)(async e=>{let t=()=>x.current?.querySelector(`[data-board-card="${CSS.escape(e)}"]`)??null;if(!I||t())return t();let n=N.findIndex(t=>t.kind===`row`&&t.key===e);if(n<0)return null;R.scrollToIndex(n,{align:`auto`});for(let e=0;e<3&&!t();e+=1)await new Promise(e=>requestAnimationFrame(()=>e()));return t()},[N,I,R]),V=Nt({rootRef:x,order:O.order,attention:O.attention,attentionAll:O.attentionAll,onRevealAttention:y.clearFilters,reveal:ee,ready:!v.isLoading,notify:a,sessionHref:r,onOpenSession:t,onToggleGrouping:()=>{f&&y.setGroupBy(y.groupBy===`lane`?`project`:`lane`)}});L.current=I?N.findIndex(e=>e.kind===`row`&&e.key===V.activeId):-1;let te=ze({notify:a,requestText:l,onOpenSession:V.handlers.onOpen}),[H,U]=(0,Q.useState)(``),ne=V.focusCard,G=(0,Q.useRef)(O.order);G.current=O.order;let re=(0,Q.useRef)(O.attentionAll);re.current=O.attentionAll,(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.sessionId;if(t){if(G.current.some(e=>e.id===t)){ne(t);return}re.current.some(e=>e.id===t)&&(U(t),q.getState().clearFilters())}};return window.addEventListener(Be,e),()=>window.removeEventListener(Be,e)},[ne]),(0,Q.useEffect)(()=>{!H||!O.order.some(e=>e.id===H)||(U(``),ne(H))},[ne,O.order,H]);let ie=St({items:v.all,laneName:b.name,template:(0,Q.useCallback)((e,t)=>p(`board:announce.moved`,{title:e,lane:t}),[p]),separator:p(`board:sidebar.announceSeparator`),skipAttention:!0}),K=ht({notify:a,requestConfirm:c,requestText:l,onProjectChosen:d,announceChoice:!0}),[ae,se]=(0,Q.useState)(!1),[ce,ue]=(0,Q.useState)(!1),pe=Te(e=>e.moveWorkspace),J=(0,Q.useMemo)(()=>O.sections.flatMap(e=>e.kind===`project`&&k.has(e.key)?[e.key]:[]),[O.sections,k]),ge=(0,Q.useMemo)(()=>({onNewTask:e=>{fe.getState().rememberLaunch(me(e.cwd)),d()},onRename:e=>void K.rename(e),onResetName:e=>K.resetName(e),onMove:(e,t)=>pe(e.key,t,J),onManage:()=>{se(!0),ue(!0)},onDelete:e=>void K.remove(e)}),[K,pe,d,J]),Y=V.bindings,_e=(0,Q.useMemo)(()=>({approve:Y.boardApprove,deny:Y.boardDeny,retry:Y.boardRetry}),[Y.boardApprove,Y.boardDeny,Y.boardRetry]),X=V.triage,ve=D===`lane`,Z=e=>{let t=N[0]!==e;if(e.kind===`header`)return e.section.kind===`status`?(0,$.jsx)(Ut,{spaced:t,lane:e.section.id,count:e.section.items.length,collapsed:e.section.id===`done`&&T,dimmed:!!X&&e.section.id!==`attention`,onToggle:e.section.id===`done`?()=>y.setLaneCollapsed(`done`,!T):void 0}):(0,$.jsx)(Wt,{spaced:t,section:e.section,project:k.get(e.section.key),first:J[0]===e.section.key,last:J.at(-1)===e.section.key,actions:ge,deleting:!!K.busyKey});if(e.kind===`empty`)return(0,$.jsx)(`p`,{className:z(`py-2 pr-3 pl-[40px] text-xs leading-5 text-content-muted`,X&&e.lane!==`attention`&&`opacity-50`),children:e.lane===`attention`?p(`board:sidebar.emptyAttention`):p(`board:sidebar.emptyRunning`)});let n=e.item,r=f&&n.lane===`attention`,i=(0,$.jsx)(ft,{item:n,now:j,project:ve?k.get(n.workspaceKey)?.label??``:``,active:n.id===V.activeId,dimmed:!!X&&n.lane!==`attention`,phase:e.phase,bindings:f?Ft:_e,handlers:V.handlers,menu:te,card:r,onStartNow:V.handlers.onStartNow});return r?(0,$.jsx)(`div`,{className:`py-1`,children:i}):i},ye;ye=v.isLoading?(0,$.jsx)(Ae,{kind:`loading`,title:p(`board:page.loading`)}):v.error&&v.total===0?(0,$.jsx)(Ae,{kind:`error`,title:p(`board:page.error`),description:p(`board:page.errorHint`),action:(0,$.jsx)(B,{variant:`secondary`,onClick:()=>void v.refresh(),children:p(`board:page.retry`)})}):O.total===0?(0,$.jsxs)(`div`,{"data-overview-empty":!0,className:`flex flex-col items-center gap-3 py-24 text-center`,children:[(0,$.jsx)(`p`,{className:`text-base text-content-secondary`,children:p(`board:overview.empty`)}),(0,$.jsxs)(B,{variant:`outline`,onClick:d,children:[(0,$.jsx)(E,{"aria-hidden":`true`}),p(`board:overview.newTask`)]}),!v.catalogEmpty&&(0,$.jsx)(Bt,{onClick:n})]}):O.filteredEmpty?(0,$.jsx)(Ae,{kind:`empty`,title:p(`board:filter.emptyTitle`),description:p(`board:filter.emptyHint`),action:(0,$.jsx)(B,{variant:`secondary`,onClick:y.clearFilters,children:p(`board:filter.clear`)})}):I?(0,$.jsx)(`div`,{"data-overview-list":!0,"data-virtual":!0,className:`relative w-full`,style:{height:R.getTotalSize()},children:R.getVirtualItems().map(e=>{let t=N[e.index];return t?(0,$.jsx)(`div`,{ref:R.measureElement,"data-index":e.index,className:`absolute inset-x-0 top-0`,style:{transform:`translateY(${e.start}px)`},children:Z(t)},e.key):null})}):(0,$.jsx)(`div`,{"data-overview-list":!0,className:`flex flex-col`,children:O.sections.map(e=>{let t=e.kind===`status`?`status:${e.id}`:`project:${e.key}`,[n,...r]=N.filter(n=>n.key===t||n.key===`${t}:empty`||n.kind===`row`&&e.items.includes(n.item)),i=r.filter(e=>e.kind===`row`),a=r.find(e=>e.kind===`empty`);return(0,$.jsxs)(`section`,{"aria-labelledby":`overview-${t}`,"data-overview-section":e.kind===`status`?e.id:e.key,children:[n&&Z(n),a&&Z(a),i.length>0&&(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,$.jsx)(`li`,{"data-card":f&&e.item.lane===`attention`||void 0,className:`relative [&+&]:before:absolute [&+&]:before:top-0 [&+&]:before:right-3 [&+&]:before:left-10 [&+&]:before:h-px [&+&]:before:bg-stroke data-[card]:before:hidden [[data-card]+&]:before:hidden`,children:Z(e)},e.key))})]},t)})});let be=y.lanes.length>0||y.projects.length>0;return(0,$.jsxs)(`div`,{ref:x,"data-board-root":!0,"data-overview":!0,className:`relative flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,children:[!f&&(0,$.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,$.jsx)(`div`,{ref:S,"data-overview-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-20`,children:(0,$.jsxs)(`div`,{className:z(`mx-auto flex w-full gap-10 px-6 max-[650px]:px-4`,g===`column`?`max-w-[1280px]`:`max-w-[928px]`),children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f&&(0,$.jsx)(`h1`,{className:`sr-only`,children:p(`board:page.title`)}),f?M&&O.total>0&&(0,$.jsx)(`div`,{className:`sticky top-0 z-[1] -mx-4 mb-2 bg-background px-4 pt-1 pb-2`,children:(0,$.jsx)(F,{size:`default`,"aria-label":p(`board:group.label`),value:y.groupBy,onValueChange:y.setGroupBy,className:`grid h-11 w-full grid-cols-2 [&>button]:h-full`,options:[{value:`lane`,label:p(`board:group.lane`)},{value:`project`,label:p(`board:group.project`)}]})}):(0,$.jsxs)(`header`,{"data-focus-region":`header`,className:`mb-5 flex min-w-0 flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,children:p(`board:page.title`)}),M&&O.total>0&&(0,$.jsx)(Vt,{agents:O.total,projects:O.projectCount,running:O.running})]}),g===`popover`&&_(`popover`),M&&O.total>0&&(0,$.jsxs)(B,{variant:`outline`,onClick:d,children:[(0,$.jsx)(E,{"aria-hidden":`true`}),p(`board:overview.newTask`)]})]}),!f&&M&&v.total>0&&(0,$.jsx)(yt,{items:v.all,now:C,capabilities:v.capabilities,laneName:b.name,notify:a,requestConfirm:c,requestText:l,onNewTask:d}),M&&be&&f&&O.total>0&&(0,$.jsx)(Ht,{lanes:y.lanes,projects:y.projects.map(e=>k.get(e)?.label??``).filter(Boolean),laneName:b.name,onClear:y.clearFilters}),ye,M&&O.total>0&&!O.filteredEmpty&&(0,$.jsx)(`div`,{className:z(`mt-3 pl-1`,X&&`opacity-50`),children:(0,$.jsx)(Bt,{onClick:n})}),g===`phone`&&(0,$.jsx)(`section`,{"aria-label":p(`board:overview.widgets`),"data-overview-widgets":`phone`,children:_(`phone`)})]}),g===`column`&&(0,$.jsx)(`aside`,{"data-overview-widgets":`column`,"aria-label":p(`board:overview.widgets`),className:z(`w-80 flex-none`,X&&`opacity-50`),children:_(`column`)})]})}),X&&(0,$.jsx)(Gt,{index:X.index,total:X.total,finished:X.finished,answers:v.capabilities.askUser,keys:{approve:W(Y.boardApprove),deny:W(Y.boardDeny),retry:W(Y.boardRetry)},onExit:V.exitTriage}),(0,$.jsx)(`p`,{"aria-live":`polite`,role:`status`,className:`sr-only`,children:ie}),(0,$.jsx)(de,{picker:K.picker,folderDialog:K.folderDialog}),ae&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(It,{open:ce,onOpenChange:ue,commands:K})})]})}function Bt({onClick:e}){let{t}=i();return(0,$.jsxs)(`button`,{type:`button`,"data-overview-history":!0,className:`inline-flex h-8 items-center gap-1 rounded-[var(--r-sm)] px-2 text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:e,children:[t(`board:lane.history`),(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`})]})}function Vt({agents:e,projects:t,running:n}){let{t:r}=i(),[a,o]=(0,Q.useState)(!1),s=pe(a),c=s.data?[s.data.subAgents?r(`board:overview.subAgentSlots`,{running:s.data.subAgents.running,max:s.data.subAgents.max}):``,s.data.todayTokens===null?``:r(`board:overview.todayTokens`,{tokens:xe(s.data.todayTokens)}),s.data.memoryBytes===null?``:r(`board:overview.memory`,{memory:be(s.data.memoryBytes)})].filter(Boolean):[],l=s.isPending?r(`board:overview.systemLoading`):c.length?c.join(` · `):r(`board:overview.systemUnavailable`);return(0,$.jsx)(R,{children:(0,$.jsxs)(ee,{open:a,onOpenChange:o,children:[(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`p`,{tabIndex:0,"data-overview-summary":!0,className:`mt-1 w-fit max-w-full truncate rounded-xs text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`,children:r(`board:page.summary`,{agents:e,projects:t,running:n})})}),(0,$.jsx)(L,{side:`bottom`,align:`start`,sideOffset:6,"data-overview-system":!0,children:l})]})})}function Ht({lanes:e,projects:t,laneName:n,onClear:r}){let{t:a}=i(),o=a(`board:filter.listSeparator`),s=[e.length?a(`board:filter.statusTitle`,{statuses:e.map(e=>n[e]).join(o)}):``,t.length?a(`board:filter.projectsTitle`,{projects:t.join(o)}):``].filter(Boolean);return(0,$.jsxs)(`div`,{"data-overview-filter":!0,className:`mb-3 flex min-w-0 items-center gap-2 rounded-[var(--r-md)] bg-surface-subtle py-1 pr-1 pl-3 text-xs text-content-secondary`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:s.join(` · `)}),(0,$.jsxs)(B,{variant:`ghost`,size:`xs`,onClick:r,children:[(0,$.jsx)(O,{"aria-hidden":`true`}),a(`board:filter.clear`)]})]})}function Ut({spaced:e,lane:t,count:n,collapsed:r,dimmed:a,onToggle:o}){let{t:s}=i(),c=s(t===`attention`?`board:sidebar.group.attention`:t===`running`?`board:sidebar.group.running`:t===`queued`?`board:sidebar.group.queued`:`board:sidebar.group.done`),l=t===`attention`&&n>0,u=`overview-status:${t}`,d=(0,$.jsxs)($.Fragment,{children:[c,(0,$.jsx)(`span`,{"data-overview-count":!0,className:z(`tabular-nums`,l?`inline-grid h-[18px] min-w-[18px] place-items-center rounded-full bg-warning-soft px-1.5 text-[11.5px] font-semibold ring-1 ring-st-attn-border ring-inset`:`text-content-muted`),children:n}),o&&(r?(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`}):(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}))]}),f=z(`flex h-8 items-center gap-2 px-3 text-[13px] font-medium`,l?`text-warning-strong`:`text-content-secondary`);return(0,$.jsx)(`h2`,{id:u,"data-overview-heading":t,className:z(`m-0 transition-opacity duration-(--d-fast)`,e&&`mt-5`,a&&`opacity-50`),children:o?(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!r,className:z(f,`rounded-[var(--r-md)] hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`),onClick:o,children:d}):(0,$.jsx)(`span`,{className:f,children:d})})}function Wt({spaced:e,section:t,project:n,first:r,last:a,actions:o,deleting:s}){let{t:c}=i(),l=n?.label||c(`board:filter.noProject`),u=t.counts,d=[u.running?c(`board:overview.projectRunning`,{count:u.running}):``,u.queued?c(`board:overview.projectQueued`,{count:u.queued}):``,u.done?c(`board:overview.projectDone`,{count:u.done}):``].filter(Boolean);return(0,$.jsxs)(`div`,{"data-overview-heading":t.key,className:z(`flex h-9 min-w-0 items-center gap-2.5 pr-1 pl-3`,e&&`mt-6`),children:[(0,$.jsx)(S,{className:`size-3.5 flex-none text-content-muted`,strokeWidth:1.75,"aria-hidden":`true`}),(0,$.jsx)(`h2`,{id:`overview-project:${t.key}`,className:`m-0 min-w-0 truncate font-mono text-[13.5px] font-semibold text-content`,title:t.cwd||void 0,children:l}),(0,$.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-content-muted`,children:[u.attention>0&&(0,$.jsx)(`b`,{className:`font-medium text-warning-strong`,children:c(`board:overview.projectAttention`,{count:u.attention})}),u.attention>0&&d.length>0&&(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),d.join(` · `)]}),n&&(0,$.jsx)(bt,{project:n,first:r,last:a,deleting:s,actions:o})]})}function Gt({index:e,total:t,finished:n,answers:r,keys:a,onExit:o}){let{t:s}=i(),c=(e,t)=>e?(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(V,{children:e}),t]}):null;return(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-triage-bar":!0,className:`absolute bottom-5 left-1/2 z-20 flex h-10 max-w-[calc(100%-32px)] -translate-x-1/2 items-center gap-3 overflow-hidden rounded-[var(--r-lg)] border border-stroke bg-solid px-3.5 text-[12.5px] whitespace-nowrap text-content-secondary shadow-float`,children:n?(0,$.jsx)(`b`,{className:`font-medium text-content`,children:s(`board:triage.finished`)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`b`,{className:`font-medium text-content tabular-nums`,children:s(`board:triage.progress`,{index:e,total:t})}),c(a.approve,s(`board:triage.approve`)),c(a.deny,s(`board:triage.deny`)),c(a.retry,s(`board:triage.retry`)),r&&c(`1–4`,s(`board:triage.answer`)),c(`↵`,s(`board:triage.open`)),(0,$.jsxs)(B,{variant:`ghost`,size:`xs`,className:`-mr-1.5`,onClick:o,children:[(0,$.jsx)(V,{children:`Esc`}),s(`board:triage.exit`)]})]})})}export{Rt as BoardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ManageProjectsDialog-BpsBTKv5.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CsOCclo6.js","assets/i18n-DyMZgkZI.js","assets/vendor-router-CSN_DGvx.js","assets/index-CiyAfWLi.js","assets/index-j6s460ui.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/arrow-down-CDGua-ue.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/arrow-up-DST6-qVQ.js","assets/folder-minus-BhfTnypT.js","assets/folder-plus-OPHZsJho.js","assets/pencil-U08v_vV9.js","assets/rotate-ccw-C0v8V77_.js","assets/trash-2-CNrPOoPR.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/board-projects-DjGBcX8k.js","assets/query-DFQayLF5.js","assets/useQuery-DfOU-27z.js","assets/startup-queries-B2k6wlnS.js","assets/mutation-b4pPvB7p.js","assets/api-D1flkoh7.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-DEs9jkgT.js","assets/event-stream-DRv0u06j.js","assets/http-B-XVZUum.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-MtXRlSIi.js","assets/runtime-capabilities-ChJVNwRz.js","assets/session-board-status-D_Tz3HJm.js","assets/chat-api-BqA8nXly.js","assets/session-questions-BPKyVhzp.js","assets/events-C8OUQmIW.js","assets/room-changes-DMfb5VNn.js","assets/session-workspaces-Brm-8lHh.js","assets/card-presentation-zU6WKfgu.js","assets/workspace-order-store-PI98x5sR.js","assets/dialog-DldLiTwf.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/useCatalogProjects-D3mDdYej.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-CsOCclo6.js";import{t as a}from"./useQuery-DfOU-27z.js";import{r as o,u as s}from"./placements-9_rV4h0k.js";import{r as c,u as l}from"./session-board-status-D_Tz3HJm.js";import{i as u}from"./use-mobile-C2tPBAza.js";import{t as d}from"./usePhoneShell-e-CScTJH.js";import{t as f}from"./createLucideIcon-Cd-3GVxJ.js";import{t as p}from"./arrow-down-CDGua-ue.js";import{t as m}from"./arrow-right-DqLOhpA2.js";import{t as h}from"./arrow-up-DST6-qVQ.js";import{t as g}from"./chevron-down-CxtxIjiP.js";import{t as _}from"./chevron-right-C3t2Rckj.js";import{t as v}from"./corner-down-right--hxi-Ihy.js";import{t as y}from"./ellipsis-CfGKfbq6.js";import{t as b}from"./folder-minus-BhfTnypT.js";import{t as x}from"./folder-plus-OPHZsJho.js";import{t as S}from"./folder-DPM8D8cf.js";import{t as C}from"./pin-CU0FG0lI.js";import{t as w}from"./plus-fQbSqB1n.js";import{t as T}from"./rotate-ccw-C0v8V77_.js";import{t as E}from"./square-pen-hYbjKh6A.js";import{t as D}from"./trash-2-CNrPOoPR.js";import{t as O}from"./x-07u4-129.js";import{t as k}from"./brand-DIEc3fK8.js";import{c as A,i as j,p as M,r as N,t as P}from"./dropdown-menu-Ds0gD8S8.js";import{t as F}from"./segmented-control-xkrEOP_d.js";import{i as I,n as L,r as R,t as ee}from"./tooltip-D4MFbqcG.js";import{t as z}from"./utils-C8uzG5AZ.js";import{t as B}from"./button-CCcCN8tE.js";import{t as V}from"./kbd-CAufZTkl.js";import{a as te,c as H,g as U,n as ne,t as W}from"./shortcuts-C6ddcUau.js";import{r as G}from"./session-questions-BPKyVhzp.js";import{d as re,i as ie}from"./board-projects-DjGBcX8k.js";import{a as K,f as ae,l as q,n as oe,o as se,s as ce,t as le}from"./useNow-CuwOIh4H.js";import{d as ue}from"./session-workspaces-Brm-8lHh.js";import{a as de,i as fe,o as pe,r as me,s as he,t as J}from"./useNewProjectPicker-DfE1or_O.js";import{c as ge,i as Y,l as _e,n as X,o as ve,r as Z,t as ye}from"./card-presentation-zU6WKfgu.js";import{n as be,r as xe}from"./format-DMJQzoZ7.js";import{t as Se}from"./StatusGlyph-1KgitlUg.js";import{t as Ce}from"./session-change-summary-api-CAkw4_-l.js";import{n as we,t as Te}from"./workspace-order-store-PI98x5sR.js";import{c as Ee,i as De,o as Oe,s as ke}from"./folder-paths-CfRbR0Ik.js";import{n as Ae}from"./PageState-Cz6vFMXv.js";import{n as je,t as Me}from"./esm-DCV8yILT.js";import{c as Ne,i as Pe,l as Fe,n as Ie,o as Le,s as Re,t as ze,u as Be}from"./useSessionRowActions-DUufel_k.js";import{n as Ve}from"./BotAvatar-SFQi6bVG.js";import{t as He}from"./AppSelect-B15Hpk2W.js";import{t as Ue}from"./new-task-DG4I6cda.js";import{t as We}from"./useCatalogProjects-D3mDdYej.js";var Ge=f(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ke=f(`folder-pen`,[[`path`,{d:`M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5`,key:`a8xqs0`}],[`path`,{d:`M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`1saktj`}]]),Q=e(n(),1);function qe(){let{t:e}=i();return{name:{attention:e(`board:lane.attention`),running:e(`board:lane.running`),queued:e(`board:lane.queued`),done:e(`board:lane.done`)},order:{attention:e(`board:lane.orderAttention`),running:e(`board:lane.orderRunning`),queued:e(`board:lane.orderQueued`),done:e(`board:lane.orderDone`)}}}function Je(e){return e>30}var Ye={attention:0,running:1,queued:2,done:3};function Xe(){return{attention:0,running:0,queued:0,done:0}}function Ze(e){return typeof e==`number`&&Number.isFinite(e)?e:null}var Qe=K(e=>e.since),$e=K(e=>Ze(e.startedAt)??Ze(e.since)),et=K(e=>e.since,!0);function tt(e,t){return Ye[e.lane]-Ye[t.lane]||(e.lane===`running`?$e(e,t):e.lane===`done`?et(e,t):Qe(e,t))}function nt(e,{now:t,capabilities:n,timeZoneOffsetMinutes:r}){let i=new Set;return e.filter(e=>!e||!e.id||i.has(e.id)||(i.add(e.id),e.session?.archived===!0)?!1:e.lane===`queued`?n?.sessionQueue===!0:e.lane!==`done`||l(e.since,{now:t,timeZoneOffsetMinutes:r,doneWindow:`today`}))}function rt(e,t){let n=nt(e,t).sort(tt),r=t.lanes?.length?new Set(t.lanes):null,i=t.projects?.length?new Set(t.projects):null,a=n.filter(e=>(!r||r.has(e.lane))&&(!i||i.has(e.workspaceKey))),o=Xe();for(let e of n)o[e.lane]+=1;let s=new Set(n.map(e=>e.workspaceKey)),l=[];if(t.groupBy===`project`){let e=[...t.projectOrder??[]],n=new Set(e.map(e=>e.key));for(let t of a)n.has(t.workspaceKey)||(n.add(t.workspaceKey),e.push({key:t.workspaceKey,cwd:t.projectCwd}));for(let t of e){let e=a.filter(e=>e.workspaceKey===t.key);if(!e.length)continue;let n=Xe();for(let t of e)n[t.lane]+=1;l.push({kind:`project`,key:t.key,cwd:t.cwd,counts:n,items:e})}}else for(let e of c){let t=a.filter(t=>t.lane===e),n=e===`attention`||e===`running`;r&&!r.has(e)||!t.length&&!n||l.push({kind:`status`,id:e,items:t})}let u=l.flatMap(e=>e.kind===`status`&&e.id===`done`&&t.doneCollapsed?[]:e.items);return{total:n.length,projectCount:s.size,running:o.running,counts:o,sections:l,order:u,attention:u.filter(e=>e.lane===`attention`),attentionAll:n.filter(e=>e.lane===`attention`),filteredEmpty:n.length>0&&a.length===0}}function it(e,t){let n=Xe(),r={},i=nt(e,t);for(let e of i)n[e.lane]+=1,r[e.workspaceKey]=(r[e.workspaceKey]??0)+1;return{total:i.length,lanes:n,projects:r}}var $=r();function at({files:e,added:t,removed:n}){let{t:r}=i();return(0,$.jsxs)(`span`,{"data-change-stats":!0,className:`flex min-w-0 items-center gap-1.5 text-xs whitespace-nowrap text-content-secondary`,children:[(0,$.jsx)(`span`,{children:r(`board:card.files`,{count:e})}),(0,$.jsxs)(`span`,{className:`font-mono text-success tabular-nums`,children:[`+`,t]}),(0,$.jsxs)(`span`,{className:`font-mono text-danger tabular-nums`,children:[`−`,n]})]})}function ot({sessionId:e,completedAt:t}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=n.current;if(!e||r)return;if(typeof IntersectionObserver>`u`){i(!0);return}let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(i(!0),t.disconnect())},{rootMargin:`120px`});return t.observe(e),()=>t.disconnect()},[r]);let{data:o}=a({queryKey:[`session-change-summary`,e,t],queryFn:()=>Ce(e),enabled:r,staleTime:6e4,retry:0});return o?.status!==`known`||!o.changedFiles?(0,$.jsx)(`span`,{ref:n}):(0,$.jsx)(`span`,{ref:n,className:`contents`,children:(0,$.jsx)(at,{files:o.changedFiles,added:o.added||0,removed:o.removed||0})})}function st({text:e,prefix:t,phone:n=!1,args:r=!1,variant:a=`well`,tabIndex:o,lead:s}){let{t:c}=i(),l=(0,Q.useRef)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1);(0,Q.useLayoutEffect)(()=>{let e=l.current;if(!e||f)return;let t=()=>d(e.scrollHeight>e.clientHeight+1);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[f,e]);let m=a===`plain`,h=(0,Q.useMemo)(()=>e.split(/(\s+)/).filter(Boolean),[e]),g=(u||f)&&(0,$.jsx)(`button`,{type:`button`,"data-card-stop":!0,tabIndex:o,className:z(`text-left text-xs text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:min-h-11`,m?`mt-0.5 rounded-xs underline underline-offset-2`:`w-full border-t border-well-stroke px-2.5 py-1`),"aria-expanded":f,onClick:()=>p(e=>!e),children:c(f?`board:card.collapse`:r?`board:card.expandArgs`:`board:card.expand`)}),_=(0,$.jsxs)(`pre`,{ref:l,"data-command-text":!0,"aria-label":r?c(`board:confirm.fullArgs`):void 0,className:z(`min-w-0 font-mono text-xs leading-5 whitespace-pre-wrap`,m?`text-content-secondary`:`text-well-text`,!f&&`line-clamp-3 max-h-15`,n&&`text-sm`),children:[s&&(0,$.jsx)(`span`,{className:`font-sans select-none`,children:s}),t&&(0,$.jsxs)(`span`,{className:z(`select-none`,m?`text-content-muted`:`text-well-muted`),children:[t,` `]}),h.map((e,t)=>/^\s+$/.test(e)?e:(0,$.jsx)(`span`,{"data-command-token":!0,className:`inline-block max-w-full align-top break-all`,children:e},t))]});return m?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start`,children:[_,g]}):(0,$.jsxs)(`div`,{className:`min-w-0 rounded-sm border border-well-stroke bg-well`,children:[(0,$.jsx)(`div`,{className:`px-2.5 py-1.5`,children:_}),g]})}function ct(e){return e instanceof Element&&!!e.closest(`button, a, input, textarea, [role="menuitem"], [data-card-stop]`)}function lt({binding:e}){let t=e&&/^Key[A-Z]$/.test(e)?e.slice(3):``;return t?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60 pointer-coarse:hidden`,children:t}):null}function ut(e){return e.split(`
3
+ `).map(e=>e.trim()).find(Boolean)??``}function dt({item:e,now:t,project:n,active:r,dimmed:a,phase:o,bindings:s,handlers:c,menu:l,onStartNow:u,card:d=!1}){let{t:f}=i(),p=(0,Q.useRef)(null),m=r?0:-1,h=e.lane===`attention`,g=e.approvals[0]??null,_=g?.severity===`critical`,y=se(e),b=e.title||f(`navigation:shell.untitledSession`),x=()=>c.onOpen(e.id),S=`${e.lane}:${e.status}`,w=(0,Q.useRef)(S);(0,Q.useLayoutEffect)(()=>{w.current!==S&&(w.current=S,p.current?.getAnimations?.().forEach(e=>e.cancel()))},[S]);let T=(0,Q.useRef)(!1),E=e=>{let t=T.current;T.current=!1,!(t||ct(e.target))&&x()},D=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),x())},O=``;O=h?Ne(f,ce(e)):e.status===`failed`?f(`board:status.failedHandled`):e.status===`stopped`?f(`board:status.stopped`):e.lane===`running`?f(`board:status.running`):e.lane===`queued`?f(`board:status.queued`):e.unread?f(`board:overview.doneUnread`):f(`board:status.done`);let k=e.status===`approval`&&e.approvalsState===`ready`&&g?g.toolName||`—`:``,A=``,j=``;if(h&&e.since!==null)A=Re(t-e.since),j=f(`board:overview.waited`,{wait:A});else if(e.lane===`running`){let n=e.startedAt??e.since;A=Pe(n===null?null:t-n),j=A?f(`board:overview.ran`,{time:A}):``}else e.lane===`done`&&(A=Le(e.since),j=A?f(`board:overview.finishedAt`,{time:A}):``);let M=null,N=null,P=(0,$.jsxs)(B,{size:`sm`,tabIndex:m,onClick:x,children:[f(`board:overview.openToHandle`),!d&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`font-normal opacity-60 pointer-coarse:hidden`,children:`↵`})]});if(e.status===`approval`){if(e.approvalsState!==`ready`||!g)M=(0,$.jsx)(`p`,{role:`status`,className:`text-xs leading-5 text-content-muted`,children:e.approvalsState===`error`?f(`board:card.approvalUnavailable`):f(`board:card.approvalLoading`)});else{let t=Y(g.reason),n=_&&t?Z(g.reason):``,r=g.toolName===`bash`&&g.command,i=g.command||g.path,a=i?``:ye(g),o=!i&&g.reason&&!t?g.reason:``,s=e.approvals.length-1,c=e.approvals.slice(1).some(e=>e.severity===`critical`),l=_?(0,$.jsxs)(`span`,{"data-severity":`critical`,className:`font-medium text-warning-strong`,children:[n?f(`board:card.criticalWithReason`,{reason:n}):f(`board:card.critical`),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `})]}):null;M=(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[i?(0,$.jsx)(st,{text:i,prefix:r?`$`:``,variant:`plain`,tabIndex:m,lead:l}):a?(0,$.jsx)(st,{text:a,prefix:``,variant:`plain`,args:!0,tabIndex:m,lead:l}):l&&(0,$.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5`,children:l}),o&&(0,$.jsx)(`p`,{className:`min-w-0 text-xs break-words text-content-secondary`,children:o}),s>0&&(0,$.jsx)(`p`,{className:`text-xs leading-5 text-content-muted`,children:f(c?`board:card.moreApprovalsCritical`:`board:card.moreApprovals`,{count:s})})]})}if(y.kind===`decide`&&g){let t=c.isPending(`approve`,e.id,g.id),n=c.isPending(`deny`,e.id,g.id);N=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(B,{variant:`outline`,size:`sm`,tabIndex:m,disabled:t||n,loading:n,"aria-label":f(`board:sidebar.denyNamed`,{title:b}),"aria-keyshortcuts":W(s.deny)||void 0,onClick:()=>c.onDeny(e,g),children:[f(`board:card.deny`),(0,$.jsx)(lt,{binding:s.deny})]}),(0,$.jsxs)(B,{size:`sm`,tabIndex:m,disabled:t||n,loading:t,"aria-label":f(`board:sidebar.approveNamed`,{title:b}),"aria-keyshortcuts":W(s.approve)||void 0,onClick:()=>c.onApprove(e,g),children:[f(`board:card.approve`),(0,$.jsx)(lt,{binding:s.approve})]})]})}else N=P}else if(e.status===`question`){let t=e.question,n=G(t),r=t?c.isPending(`answer`,e.id,t.id):!1,i=t?.questions[0];M=t?(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,$.jsxs)(`p`,{"data-row-question":!0,className:`min-w-0 text-[13px] leading-5 break-words text-content`,children:[i?.header&&(0,$.jsxs)(`span`,{className:`text-content-muted`,children:[i.header,` · `]}),i?.question,t.questions.length>1&&(0,$.jsxs)(`span`,{className:`text-content-muted`,children:[` `,`· `,f(`board:sidebar.reason.questions`,{count:t.questions.length})]})]}),n&&(0,$.jsxs)(`div`,{"data-question-pills":!0,role:`group`,"aria-label":i?.question,className:`flex min-w-0 flex-wrap gap-1.5`,children:[n.map((t,n)=>(0,$.jsxs)(B,{variant:`outline`,size:`sm`,tabIndex:m,disabled:r,"data-question-pill":t,"aria-label":f(`board:question.answerNamed`,{title:b,option:t}),"aria-keyshortcuts":String(n+1),className:z(`h-auto min-h-7 max-w-full whitespace-normal`,d&&`min-h-11`),onClick:()=>c.onAnswer(e,t),children:[!d&&(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-[11px] opacity-60 pointer-coarse:hidden`,children:n+1}),(0,$.jsx)(`span`,{className:`break-words text-left`,children:t})]},t)),(0,$.jsx)(B,{variant:`ghost`,size:`sm`,tabIndex:m,className:z(`h-auto min-h-7`,d&&`min-h-11`),onClick:x,children:f(`board:question.other`)})]})]}):null,N=n?null:P}else if(e.status===`failed`&&h){let t=ut(e.error)||[...e.tail].reverse().find(ge)?.trim()||``,n=c.isPending(`retry`,e.id);M=t?(0,$.jsx)(`p`,{"data-card-error":!0,className:`min-w-0 truncate font-mono text-xs leading-5 text-content-secondary`,children:t}):null,N=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{variant:`outline`,size:`sm`,tabIndex:m,onClick:x,children:f(`board:overview.log`)}),(0,$.jsxs)(B,{size:`sm`,tabIndex:m,loading:n,disabled:n,"aria-label":f(`board:overview.retryNamed`,{title:b}),"aria-keyshortcuts":W(s.retry)||void 0,onClick:()=>c.onRetry(e),children:[f(`board:card.retry`),(0,$.jsx)(lt,{binding:s.retry})]})]})}else if(e.lane===`running`){let n=e.activity,r=e.agents,i=null;if(n?.type===`tool`){let e=n.startedAt?Date.parse(n.startedAt):NaN,r=[n.name,n.summary].filter(Boolean).join(` · `),a=Number.isFinite(e)?Re(Math.max(0,t-e)):``;i=(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r,a&&(0,$.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,a]})]})}else if(e.tail.length)i=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.tail.at(-1)});else if(n?.type===`model`){let e={starting:f(`board:activity.starting`),thinking:f(`board:activity.thinking`),responding:f(`board:activity.responding`),compacting:f(`board:activity.compacting`)}[n.stage]||f(`board:activity.working`);i=(0,$.jsx)(`span`,{className:`min-w-0 truncate font-sans`,children:e})}(i||r&&r.total>0)&&(M=(0,$.jsxs)(`p`,{"data-card-activity":!0,className:`flex min-w-0 items-center gap-2 font-mono text-xs leading-5 text-content-secondary`,children:[i,r&&r.total>0&&(0,$.jsxs)(`span`,{"data-card-agents":!0,className:`flex flex-none items-center gap-1 font-sans text-content-muted`,title:f(`board:card.subAgentProgress`,r),children:[(0,$.jsx)(v,{className:`size-3`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:f(`board:overview.subAgents`,{running:r.running,total:r.total})}),(0,$.jsx)(`span`,{className:`sr-only`,children:f(`board:card.subAgentProgress`,r)})]})]}))}else if(e.lane===`queued`){let t=e.queue?.startAfterTitle?f(`board:overview.queuedAfter`,{title:e.queue.startAfterTitle}):f(`board:overview.queuedAfterUnknown`);M=(0,$.jsx)(`p`,{"data-queue-detail":!0,className:`min-w-0 truncate text-xs leading-5 text-content-secondary`,children:e.queuePosition?`${t} · ${f(`board:overview.queuePosition`,{n:e.queuePosition})}`:t}),u&&(N=(0,$.jsx)(B,{variant:`outline`,size:`sm`,tabIndex:m,disabled:c.isPending(`start`,e.id),"data-start-now":e.id,onClick:()=>u(e),children:f(`board:overview.startNow`)}))}else if(e.lane===`done`){let t=ut(e.preview);M=t?(0,$.jsx)(`p`,{"data-card-preview":!0,className:`min-w-0 truncate text-xs leading-5 text-content-secondary`,children:t}):null;let n=_e(e);N=n?(0,$.jsx)(at,{...n}):e.changeStats?null:(0,$.jsx)(ot,{sessionId:e.id,completedAt:typeof e.session.lastCompletedAt==`string`?e.session.lastCompletedAt:null})}return d&&h?(0,$.jsxs)(`article`,{ref:p,"data-board-card":e.id,"data-overview-row":!0,"data-overview-card":!0,"data-lane":e.lane,"data-status":e.status,"data-severity":e.severity??void 0,tabIndex:m,"aria-label":f(`board:card.label`,{title:b,status:O}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{T.current=ct(e.target)},onClick:E,onKeyDown:D,className:z(`relative flex min-w-0 cursor-pointer flex-col gap-2 rounded-[14px] border border-st-attn-border bg-panel p-3.5 shadow-edge transition-opacity duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus`,a&&`opacity-50`),children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-start gap-x-2.5`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 grid size-4 place-items-center`,children:(0,$.jsx)(Se,{status:X(e),phase:o})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-base leading-5 font-medium text-content`,children:[e.bot&&(0,$.jsx)(Ve,{character:e.bot.character,color:e.bot.color,size:18}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:b})]}),(0,$.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1 text-xs leading-5`,children:[(0,$.jsxs)(`span`,{"data-row-status":!0,className:`flex-none text-warning-strong`,children:[O,k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:k})]})]}),n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,$.jsx)(`span`,{"data-row-project":!0,className:`min-w-0 truncate font-mono text-content-muted`,title:e.cwd||void 0,children:n})]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[A&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:`text-xs text-content-muted tabular-nums`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:A}),(0,$.jsx)(`span`,{className:`sr-only`,children:j})]}),(0,$.jsx)(Fe,{row:{id:e.id,title:b,pinned:e.pinned},actions:l,canMarkHandled:e.status===`failed`,align:`end`,tabIndex:m,className:`size-11`})]})]}),M&&(0,$.jsx)(`div`,{className:`min-w-0 pl-[26px]`,children:M}),N&&(0,$.jsx)(`div`,{"data-card-actions":!0,className:`grid grid-cols-2 gap-2 [&>button]:h-11 [&>button]:w-full [&>button]:text-sm [&>button:only-child]:col-span-2`,children:N})]}):(0,$.jsxs)(`article`,{ref:p,"data-board-card":e.id,"data-overview-row":!0,"data-lane":e.lane,"data-status":e.status,"data-severity":e.severity??void 0,tabIndex:m,"aria-label":f(`board:card.label`,{title:b,status:O}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{T.current=ct(e.target)},onClick:E,onKeyDown:D,className:z(`group/row relative grid min-h-[52px] min-w-0 cursor-pointer grid-cols-[16px_minmax(0,1fr)_auto] items-start gap-x-3 rounded-[var(--r-md)] px-3 py-[11px] transition-[opacity,background-color] duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,a&&`opacity-50`),children:[(0,$.jsx)(`span`,{className:`mt-0.5 grid size-4 place-items-center`,children:(0,$.jsx)(Se,{status:X(e),phase:o})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-2.5 leading-5`,children:[e.bot&&(0,$.jsx)(Ve,{character:e.bot.character,color:e.bot.color,size:18,className:`self-center`}),(0,$.jsx)(`span`,{className:z(`min-w-0 truncate text-base font-medium`,e.lane===`done`?`text-content-secondary`:`text-content`),children:b}),(0,$.jsxs)(`span`,{"data-row-status":!0,className:z(`flex-none text-xs`,h?`text-warning-strong`:`text-content-muted`),children:[O,k&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:k})]})]}),n&&(0,$.jsx)(`span`,{"data-row-project":!0,className:`min-w-0 shrink truncate font-mono text-xs text-content-muted`,title:e.cwd||void 0,children:n}),e.pinned&&(0,$.jsx)(C,{className:`size-3 flex-none self-center text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":f(`board:card.pinned`)})]}),M]}),(0,$.jsxs)(`div`,{className:`flex min-h-[30px] items-center gap-2 self-start`,children:[N&&(0,$.jsx)(`div`,{className:`flex items-center gap-1.5`,children:N}),(0,$.jsxs)(`div`,{className:z(`relative flex min-h-[30px] items-center justify-end pointer-coarse:gap-2`,!A&&`min-w-[26px]`),children:[A&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:z(`min-w-[44px] text-right text-xs text-content-muted tabular-nums transition-opacity duration-(--d-fast) group-focus-within/row:opacity-0 group-hover/row:opacity-0 group-has-[[data-state=open]]/row:opacity-0 pointer-coarse:opacity-100`,e.lane===`running`&&`font-mono text-content-secondary`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:A}),(0,$.jsx)(`span`,{className:`sr-only`,children:j})]}),(0,$.jsx)(Fe,{row:{id:e.id,title:b,pinned:e.pinned},actions:l,canMarkHandled:h&&e.status===`failed`,align:`end`,tabIndex:m,className:`absolute top-1/2 right-0 -translate-y-1/2 opacity-0 group-focus-within/row:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100 pointer-coarse:static pointer-coarse:translate-y-0 pointer-coarse:opacity-100`})]})]})]})}var ft=(0,Q.memo)(dt),pt=(0,Q.lazy)(()=>t(()=>import(`./ManageProjectsDialog-BpsBTKv5.js`).then(e=>({default:e.ManageProjectsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48])));function mt({commands:e,manageMounted:t,manageOpen:n,onManageOpenChange:r}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(de,{picker:e.picker,folderDialog:e.folderDialog}),t&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(pt,{open:n,onOpenChange:r,commands:e})})]})}function ht({notify:e,requestConfirm:t,requestText:n,onProjectChosen:r,announceChoice:a}){let{t:o}=i(),[s,c]=(0,Q.useState)(``),l=(0,Q.useRef)(``),{newProject:u,picking:d,picker:f,folderDialog:p}=J({onProjectChosen:r,onError:t=>e(t,`error`),onRemembered:a?t=>e(o(`board:project.chosen`,{project:ve(t)}),`info`):void 0}),m={t:o,notify:e,requestConfirm:t,requestText:n},h=e=>ke(e,ve(e.cwd),m,{description:o(`board:project.renameDescription`)}),g=e=>Ee(e,m),_=e=>{let t=fe.getState();t.cwd&&ue(t.cwd)===e.key&&t.rememberLaunch({cwd:``});let n=q.getState();n.projects.includes(e.key)&&n.setProjectFilter(n.projects.filter(t=>t!==e.key))};return{newProject:u,picking:d,rename:h,resetName:g,remove:async e=>{if(!l.current){l.current=e.key,c(e.key);try{await De(e,m)===`deleted`&&_(e)}finally{l.current=``,c(``)}}},unregister:e=>{l.current||Oe(e,m)&&_(e)},busyKey:s,picker:f,folderDialog:p}}function gt({notify:e,requestConfirm:t,requestText:n,onNewTask:r,keys:i}){let a=ht({notify:e,requestConfirm:t,requestText:n,onProjectChosen:r,announceChoice:!0}),o=Te(e=>e.moveWorkspace),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d=()=>{c(!0),u(!0)},{rename:f,resetName:p,remove:m,unregister:h}=a;return{actions:(0,Q.useMemo)(()=>({onNewTask:e=>{fe.getState().rememberLaunch(me(e.cwd)),r()},onRename:e=>void f(e),onResetName:e=>p(e),onMove:(e,t)=>o(e.key,t,i),onManage:()=>{c(!0),u(!0)},onDelete:e=>e.count===0?h(e):void m(e)}),[i,o,r,m,f,p,h]),deleting:!!a.busyKey,newProject:a.newProject,picking:a.picking,openManage:d,dialogs:{commands:a,manageMounted:s,manageOpen:l,onManageOpenChange:u}}}var _t=`all`,vt=[`attention`,`running`,`queued`,`done`];function yt({items:e,now:t,capabilities:n,laneName:r,notify:a,requestConfirm:o,requestText:s,onNewTask:c}){let{t:l}=i(),u=q(e=>e.lanes),d=q(e=>e.projects),f=q(e=>e.setLaneFilter),p=q(e=>e.setProjectFilter),m=We(),h=gt({notify:a,requestConfirm:o,requestText:s,onNewTask:c,keys:(0,Q.useMemo)(()=>m.map(e=>e.key),[m])}),g=(0,Q.useRef)(null),_=(0,Q.useMemo)(()=>it(e,{now:t,capabilities:n}),[n,e,t]),v=vt.filter(e=>e!==`queued`||n.sessionQueue===!0&&_.lanes.queued>0),S=u[0]??_t,C=d[0]??``,E=m.find(e=>e.key===C),O=!!E?.cwd&&E?.key!==`\0`;return(0,$.jsxs)(`div`,{"data-overview-filters":!0,className:`mb-4 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(F,{id:Ue,"aria-label":l(`board:filter.statuses`),value:S,onValueChange:e=>f(e===_t?[]:[e]),options:[{value:_t,label:l(`board:sidebar.filter.all`),count:_.total},...v.map(e=>({value:e,label:r[e],count:_.lanes[e]}))]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,$.jsxs)(He,{"aria-label":l(`board:filter.projects`),className:`w-48`,value:C,onChange:e=>p(e.target.value?[e.target.value]:[]),children:[(0,$.jsx)(`option`,{value:``,children:l(`board:filter.allProjects`)}),m.map(e=>(0,$.jsx)(`option`,{value:e.key,children:e.label},e.key))]}),(0,$.jsxs)(P,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`icon`,"data-overview-project-menu":!0,"aria-label":E?l(`board:project.actionsFor`,{project:E.label}):l(`board:sidebar.filter.projectActions`),title:E?l(`board:project.actionsFor`,{project:E.label}):l(`board:sidebar.filter.projectActions`),children:(0,$.jsx)(y,{"aria-hidden":`true`})})}),(0,$.jsxs)(N,{align:`end`,className:`w-52`,onCloseAutoFocus:e=>{let t=g.current;t&&(g.current=null,e.preventDefault(),t())},children:[E&&(0,$.jsxs)($.Fragment,{children:[O&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(j,{onSelect:()=>g.current=()=>h.actions.onNewTask(E),children:[(0,$.jsx)(w,{"aria-hidden":`true`}),l(`board:project.newTaskHere`)]}),(0,$.jsxs)(j,{onSelect:()=>h.actions.onRename(E),children:[(0,$.jsx)(Ke,{"aria-hidden":`true`}),l(`board:project.rename`)]}),E.custom&&(0,$.jsxs)(j,{onSelect:()=>h.actions.onResetName(E),children:[(0,$.jsx)(T,{"aria-hidden":`true`}),l(`board:project.resetName`)]})]}),(0,$.jsxs)(j,{variant:`destructive`,disabled:h.deleting,onSelect:()=>h.actions.onDelete(E),children:[E.count===0?(0,$.jsx)(b,{"aria-hidden":`true`}):(0,$.jsx)(D,{"aria-hidden":`true`}),E.count===0?l(`board:project.remove`):l(`board:project.delete`)]}),(0,$.jsx)(A,{})]}),(0,$.jsxs)(j,{disabled:h.picking,onSelect:()=>g.current=()=>void h.newProject(),children:[(0,$.jsx)(x,{"aria-hidden":`true`}),l(`board:sidebar.filter.addProject`)]}),(0,$.jsxs)(j,{onSelect:()=>g.current=h.openManage,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),l(`board:project.manage`)]})]})]})]}),(0,$.jsx)(mt,{...h.dialogs})]})}function bt({project:e,first:t,last:n,deleting:r,actions:a}){let{t:o}=i(),s=(0,Q.useRef)(null),c=!!e.cwd;return(0,$.jsxs)(P,{children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":o(`board:project.actionsFor`,{project:e.label}),title:o(`board:project.actionsFor`,{project:e.label}),children:(0,$.jsx)(y,{"aria-hidden":`true`})})}),(0,$.jsxs)(N,{align:`end`,className:`w-52`,onCloseAutoFocus:e=>{let t=s.current;t&&(s.current=null,e.preventDefault(),t())},children:[c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(j,{onSelect:()=>s.current=()=>a.onNewTask(e),children:[(0,$.jsx)(w,{"aria-hidden":`true`}),o(`board:project.newTaskHere`)]}),(0,$.jsxs)(j,{onSelect:()=>a.onRename(e),children:[(0,$.jsx)(Ke,{"aria-hidden":`true`}),o(`board:project.rename`)]}),e.custom&&(0,$.jsxs)(j,{onSelect:()=>a.onResetName(e),children:[(0,$.jsx)(T,{"aria-hidden":`true`}),o(`board:project.resetName`)]})]}),(0,$.jsxs)(j,{disabled:t,onSelect:()=>a.onMove(e,-1),children:[(0,$.jsx)(h,{"aria-hidden":`true`}),o(`board:project.moveUpShort`)]}),(0,$.jsxs)(j,{disabled:n,onSelect:()=>a.onMove(e,1),children:[(0,$.jsx)(p,{"aria-hidden":`true`}),o(`board:project.moveDownShort`)]}),(0,$.jsxs)(j,{onSelect:()=>s.current=a.onManage,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),o(`board:project.manage`)]}),(0,$.jsx)(A,{}),(0,$.jsxs)(j,{variant:`destructive`,disabled:r,onSelect:()=>a.onDelete(e),children:[e.count===0?(0,$.jsx)(b,{"aria-hidden":`true`}):(0,$.jsx)(D,{"aria-hidden":`true`}),e.count===0?o(`board:project.remove`):o(`board:project.delete`)]})]})]})}var xt=1200;function St({items:e,laneName:t,template:n,separator:r,skipAttention:i}){let a=(0,Q.useRef)(null),o=(0,Q.useRef)([]),s=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(``),u=(0,Q.useCallback)(e=>{o.current.push(e),!s.current&&(s.current=setTimeout(()=>{s.current=null,l(o.current.splice(0).join(r))},xt))},[r]);return(0,Q.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,Q.useLayoutEffect)(()=>{let r=a.current;if(a.current=new Map(e.map(e=>[e.id,e.lane])),r)for(let a of e){let e=r.get(a.id);e!==void 0&&e!==a.lane&&(i&&a.lane===`attention`||u(n(a.title,t[a.lane])))}},[u,e,t,i,n]),c}var Ct=null;function wt(e){Ct=e}function Tt(){return Ct}function Et(){Ct=null}var Dt=1600,Ot=`[data-overview-scroller]`;function kt(e,t){return e?.querySelector(`[data-board-card="${CSS.escape(t)}"]`)??null}function At(e){return e.dataset.overviewScroller===void 0?`other`:`overview`}function jt(e){let t=se(e);return t.kind===`decide`?e.approvals.find(e=>e.id===t.approvalId)??null:null}function Mt(){return new Promise(e=>requestAnimationFrame(()=>e()))}function Nt({rootRef:e,order:t,attention:n,attentionAll:r,onRevealAttention:a,reveal:o,ready:s,notify:c,sessionHref:l,onOpenSession:u,onToggleGrouping:d}){let{t:f}=i(),p=ae(),m=H(e=>e.boardBindings),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),y=(0,Q.useRef)(p);y.current=p;let b=(0,Q.useRef)(t);b.current=t;let x=(0,Q.useRef)(n);x.current=n;let S=(0,Q.useRef)(r);S.current=r;let C=(0,Q.useRef)(o);C.current=o;let[w,T]=(0,Q.useState)(!1),E=(0,Q.useMemo)(()=>t.map(e=>e.id),[t]),D=E.includes(h)?h:E[0]??``,O=(0,Q.useCallback)(async t=>{if(!t)return;g(t),await Mt();let n=(C.current?await C.current(t):null)??kt(e.current,t);n?.scrollIntoView({block:`nearest`}),n?.focus({preventScroll:!0})},[e]),k=(0,Q.useCallback)(e=>{let t=x.current,n=t.findIndex(t=>t.id===e);return n<0?t[0]?.id??``:t[n+1]?.id??t[n-1]?.id??``},[]),A=(0,Q.useCallback)(t=>{let n={};e.current?.querySelectorAll(Ot).forEach(e=>{n[At(e)]=e.scrollTop}),wt({focusId:t,scroll:n}),u(t)},[u,e]),j=(0,Q.useCallback)(e=>{e.ok||e.reason===`pending`||c(f(`board:action.failed`),`error`)},[c,f]),M=(0,Q.useCallback)(t=>Ie(kt(e.current,t),{duration:180,scale:.9}),[e]),N=(0,Q.useCallback)(t=>kt(e.current,t)?.getAnimations().forEach(e=>e.cancel()),[e]),P=(0,Q.useCallback)(async(e,t)=>{let n=k(e.id),r=e.approvals.length<=1;r&&await M(e.id);let i=await y.current.approve(e.id,t.id,{confirmCritical:!1});return i.ok?(r&&n&&O(n),i):(N(e.id),i)},[M,O,k,N]),F=(0,Q.useMemo)(()=>({onFocusCard:g,onOpen:A,onApprove:(e,t)=>{if(t.severity===`critical`){A(e.id);return}P(e,t).then(t=>{!t.ok&&t.reason===`confirmation-required`?A(e.id):j(t)})},onDeny:(e,t)=>{let n=k(e.id),r=e.approvals.length<=1;(async()=>{r&&await M(e.id);let i=await y.current.deny(e.id,t.id);i.ok||N(e.id),j(i),i.ok&&r&&n&&O(n)})()},onRetry:e=>{let t=k(e.id);(async()=>{await M(e.id);let n=await y.current.retry(e.id);n.ok||N(e.id),j(n),n.ok&&t&&O(t)})()},onAnswer:(e,t)=>{let n=e.question;if(!n||!G(n)?.includes(t)){A(e.id);return}let r=k(e.id);(async()=>{await M(e.id);let i=await y.current.answer(e.id,n.id,t);!i.ok&&i.reason===`closed`?c(f(`board:question.closed`),`info`):(i.ok||N(e.id),j(i)),i.ok&&r&&O(r)})()},onStartNow:e=>void y.current.startNow(e.id).then(j),onMarkHandled:e=>void y.current.markHandled(e.id).then(j),onPin:e=>void y.current.pin(e.id,!e.pinned).then(j),onArchive:e=>void y.current.archive(e.id,!0).then(t=>{t.ok?c(f(`board:action.archived`,{title:e.title})):j(t)}),onCopyLink:e=>{let t=l(e.id),n=typeof navigator<`u`?navigator.clipboard:void 0;if(!n){c(f(`board:action.copyFailed`),`error`);return}n.writeText(t).then(()=>c(f(`board:action.copied`)),()=>c(f(`board:action.copyFailed`),`error`))},isPending:(e,t,n)=>p.isPending(e,t,n)}),[p,P,M,O,k,c,A,j,N,l,f]),I=(0,Q.useCallback)(()=>{if(S.current.length-x.current.length>0&&a){T(!0),a();return}let e=x.current[0];if(!e){c(f(`board:triage.nothing`));return}v({total:x.current.length,finished:!1}),O(e.id)},[O,c,a,f]);(0,Q.useEffect)(()=>{!w||n.length<r.length||(T(!1),I())},[n.length,r.length,I,w]);let L=(0,Q.useCallback)(()=>v(null),[]);(0,Q.useEffect)(()=>{if(!_||_.finished)return;if(n.length===0){v({..._,finished:!0});return}let e=_.total-Math.min(_.total,n.length);e+n.length>_.total&&v({..._,total:e+n.length})},[n.length,_]),(0,Q.useEffect)(()=>{if(!_?.finished)return;let e=setTimeout(()=>v(null),Dt);return()=>clearTimeout(e)},[_?.finished]);let R=(0,Q.useCallback)(e=>{let t=_?x.current:b.current;if(!t.length)return;let n=t.findIndex(e=>e.id===D),r=n<0?0:Math.max(0,Math.min(t.length-1,n+e));O(t[r].id)},[D,O,_]);(0,Q.useEffect)(()=>{let t=t=>{if(te(t)||ne(t.target))return;let n=e.current,r=t.target instanceof HTMLElement?t.target:null,i=!!r?.closest(`[data-board-card]`);if(!(r&&n?.contains(r)||r===document.body))return;let a=!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey,o=i||!!_,s=b.current.find(e=>e.id===D),c=o&&a&&/^[1-4]$/.test(t.key)&&s?.status===`question`?G(s.question)?.[Number(t.key)-1]:void 0,l=!0;if(t.key===`Escape`&&_)L();else if(U(t,m.boardNext)||i&&a&&t.key===`ArrowDown`)R(1);else if(U(t,m.boardPrevious)||i&&a&&t.key===`ArrowUp`)R(-1);else if(U(t,m.boardToggleGrouping))d();else if(U(t,m.boardTriage))_?L():I();else if(o&&U(t,m.boardApprove)&&s?.status===`approval`){let e=jt(s);e&&F.onApprove(s,e)}else if(o&&U(t,m.boardDeny)&&s?.status===`approval`){let e=jt(s);e&&F.onDeny(s,e)}else o&&U(t,m.boardRetry)&&s?.status===`failed`&&s.lane===`attention`?F.onRetry(s):s&&c?F.onAnswer(s,c):t.key===`Enter`&&a&&!i&&s&&_?A(s.id):l=!1;l&&t.preventDefault()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[m,D,L,F,R,d,A,e,I,_]),(0,Q.useLayoutEffect)(()=>{let t=e.current;return()=>{if(!t||Tt())return;let e=document.activeElement,n=e instanceof HTMLElement&&t.contains(e)?e.closest(`[data-board-card]`):null,r={};t.querySelectorAll(Ot).forEach(e=>{r[At(e)]=e.scrollTop}),wt({focusId:n?.dataset.boardCard??``,scroll:r})}},[e]),(0,Q.useLayoutEffect)(()=>{let t=Tt();!t||!s||!E.length||(Et(),e.current?.querySelectorAll(Ot).forEach(e=>{let n=At(e);n in t.scroll&&(e.scrollTop=t.scroll[n])}),E.includes(t.focusId)&&(g(t.focusId),requestAnimationFrame(()=>{(async()=>{((C.current?await C.current(t.focusId):null)??kt(e.current,t.focusId))?.focus({preventScroll:!0})})()})))},[E,s,e]);let ee=_?Math.min(_.total,_.total-Math.min(_.total,n.length)+1):0;return{actions:p,handlers:F,activeId:D,focusCard:O,triage:_?{..._,index:ee}:null,startTriage:I,exitTriage:L,bindings:m}}function Pt(e){let{t}=i(),n=Te(e=>e.names),r=Te(e=>e.order),a=we(e=>e.projects);return(0,Q.useMemo)(()=>re(ie([...e],a),r).map(e=>({...e,label:n[e.key]||(e.cwd?ve(e.cwd):t(`board:filter.noProject`)),custom:!!(e.cwd&&n[e.key])})),[n,r,e,a,t])}var Ft=Object.freeze({approve:null,deny:null,retry:null}),It=(0,Q.lazy)(()=>t(()=>import(`./ManageProjectsDialog-BpsBTKv5.js`).then(e=>({default:e.ManageProjectsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))),Lt=`(min-width: 1280px)`;function Rt(e){let t=d(),{t:n}=i();return(0,Q.useEffect)(()=>(document.title=`${n(`board:page.title`)} · ${k}`,()=>{document.title=k}),[n]),(0,$.jsx)(zt,{...e,phone:t},t?`phone`:`desktop`)}function zt({activeSessionId:e,onOpenSession:t,onOpenHistory:n,sessionHref:r,notify:a,requestConfirm:c,requestText:l,onNewTask:d,phone:f}){let{t:p}=i(),m=s(`overview-card`).placed,h=u(Lt),g=m.length?f?`phone`:h?`column`:`popover`:null,_=n=>(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(o,{placed:m,layout:n,activeSessionId:e,notify:a,onOpenSession:t})}),v=he({doneWindow:`today`}),y=q(),b=qe(),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C=le(),w=Pt(v.projects),T=y.collapsedLanes.includes(`done`),D=f?y.groupBy:`lane`,O=(0,Q.useMemo)(()=>rt(v.all,{now:C,groupBy:D,capabilities:v.capabilities,lanes:y.lanes,projects:y.projects,projectOrder:w,doneCollapsed:T}),[v.all,v.capabilities,T,C,w,D,y.lanes,y.projects]),k=(0,Q.useMemo)(()=>new Map(w.map(e=>[e.key,e])),[w]),A=O.counts.attention+O.counts.running>0,j=oe(A),M=!v.isLoading&&!(v.error&&v.total===0),N=(0,Q.useMemo)(()=>{let e=[];for(let t of O.sections){let n=t.kind===`status`?`status:${t.id}`:`project:${t.key}`;if(e.push({kind:`header`,key:n,section:t}),t.kind===`status`&&t.id===`done`&&T)continue;!t.items.length&&t.kind===`status`&&e.push({kind:`empty`,key:`${n}:empty`,lane:t.id});let r=0;for(let n of t.items)e.push({kind:`row`,key:n.id,item:n,phase:n.lane===`running`?r++*.381966%1:0})}return e},[T,O.sections]),P=O.order.length,I=Je(P),L=(0,Q.useRef)(-1),R=Me({count:I?N.length:0,getScrollElement:()=>S.current,estimateSize:e=>N[e]?.kind===`row`?64:40,overscan:8,getItemKey:e=>N[e]?.key??e,rangeExtractor:e=>{let t=je(e),n=L.current;return n<0||n>=e.count||t.includes(n)?t:[...t,n].sort((e,t)=>e-t)}}),ee=(0,Q.useCallback)(async e=>{let t=()=>x.current?.querySelector(`[data-board-card="${CSS.escape(e)}"]`)??null;if(!I||t())return t();let n=N.findIndex(t=>t.kind===`row`&&t.key===e);if(n<0)return null;R.scrollToIndex(n,{align:`auto`});for(let e=0;e<3&&!t();e+=1)await new Promise(e=>requestAnimationFrame(()=>e()));return t()},[N,I,R]),V=Nt({rootRef:x,order:O.order,attention:O.attention,attentionAll:O.attentionAll,onRevealAttention:y.clearFilters,reveal:ee,ready:!v.isLoading,notify:a,sessionHref:r,onOpenSession:t,onToggleGrouping:()=>{f&&y.setGroupBy(y.groupBy===`lane`?`project`:`lane`)}});L.current=I?N.findIndex(e=>e.kind===`row`&&e.key===V.activeId):-1;let te=ze({notify:a,requestText:l,onOpenSession:V.handlers.onOpen}),[H,U]=(0,Q.useState)(``),ne=V.focusCard,G=(0,Q.useRef)(O.order);G.current=O.order;let re=(0,Q.useRef)(O.attentionAll);re.current=O.attentionAll,(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.sessionId;if(t){if(G.current.some(e=>e.id===t)){ne(t);return}re.current.some(e=>e.id===t)&&(U(t),q.getState().clearFilters())}};return window.addEventListener(Be,e),()=>window.removeEventListener(Be,e)},[ne]),(0,Q.useEffect)(()=>{!H||!O.order.some(e=>e.id===H)||(U(``),ne(H))},[ne,O.order,H]);let ie=St({items:v.all,laneName:b.name,template:(0,Q.useCallback)((e,t)=>p(`board:announce.moved`,{title:e,lane:t}),[p]),separator:p(`board:sidebar.announceSeparator`),skipAttention:!0}),K=ht({notify:a,requestConfirm:c,requestText:l,onProjectChosen:d,announceChoice:!0}),[ae,se]=(0,Q.useState)(!1),[ce,ue]=(0,Q.useState)(!1),pe=Te(e=>e.moveWorkspace),J=(0,Q.useMemo)(()=>O.sections.flatMap(e=>e.kind===`project`&&k.has(e.key)?[e.key]:[]),[O.sections,k]),ge=(0,Q.useMemo)(()=>({onNewTask:e=>{fe.getState().rememberLaunch(me(e.cwd)),d()},onRename:e=>void K.rename(e),onResetName:e=>K.resetName(e),onMove:(e,t)=>pe(e.key,t,J),onManage:()=>{se(!0),ue(!0)},onDelete:e=>void K.remove(e)}),[K,pe,d,J]),Y=V.bindings,_e=(0,Q.useMemo)(()=>({approve:Y.boardApprove,deny:Y.boardDeny,retry:Y.boardRetry}),[Y.boardApprove,Y.boardDeny,Y.boardRetry]),X=V.triage,ve=D===`lane`,Z=e=>{let t=N[0]!==e;if(e.kind===`header`)return e.section.kind===`status`?(0,$.jsx)(Ut,{spaced:t,lane:e.section.id,count:e.section.items.length,collapsed:e.section.id===`done`&&T,dimmed:!!X&&e.section.id!==`attention`,onToggle:e.section.id===`done`?()=>y.setLaneCollapsed(`done`,!T):void 0}):(0,$.jsx)(Wt,{spaced:t,section:e.section,project:k.get(e.section.key),first:J[0]===e.section.key,last:J.at(-1)===e.section.key,actions:ge,deleting:!!K.busyKey});if(e.kind===`empty`)return(0,$.jsx)(`p`,{className:z(`py-2 pr-3 pl-[40px] text-xs leading-5 text-content-muted`,X&&e.lane!==`attention`&&`opacity-50`),children:e.lane===`attention`?p(`board:sidebar.emptyAttention`):p(`board:sidebar.emptyRunning`)});let n=e.item,r=f&&n.lane===`attention`,i=(0,$.jsx)(ft,{item:n,now:j,project:ve?k.get(n.workspaceKey)?.label??``:``,active:n.id===V.activeId,dimmed:!!X&&n.lane!==`attention`,phase:e.phase,bindings:f?Ft:_e,handlers:V.handlers,menu:te,card:r,onStartNow:V.handlers.onStartNow});return r?(0,$.jsx)(`div`,{className:`py-1`,children:i}):i},ye;ye=v.isLoading?(0,$.jsx)(Ae,{kind:`loading`,title:p(`board:page.loading`)}):v.error&&v.total===0?(0,$.jsx)(Ae,{kind:`error`,title:p(`board:page.error`),description:p(`board:page.errorHint`),action:(0,$.jsx)(B,{variant:`secondary`,onClick:()=>void v.refresh(),children:p(`board:page.retry`)})}):O.total===0?(0,$.jsxs)(`div`,{"data-overview-empty":!0,className:`flex flex-col items-center gap-3 py-24 text-center`,children:[(0,$.jsx)(`p`,{className:`text-base text-content-secondary`,children:p(`board:overview.empty`)}),(0,$.jsxs)(B,{variant:`outline`,onClick:d,children:[(0,$.jsx)(E,{"aria-hidden":`true`}),p(`board:overview.newTask`)]}),!v.catalogEmpty&&(0,$.jsx)(Bt,{onClick:n})]}):O.filteredEmpty?(0,$.jsx)(Ae,{kind:`empty`,title:p(`board:filter.emptyTitle`),description:p(`board:filter.emptyHint`),action:(0,$.jsx)(B,{variant:`secondary`,onClick:y.clearFilters,children:p(`board:filter.clear`)})}):I?(0,$.jsx)(`div`,{"data-overview-list":!0,"data-virtual":!0,className:`relative w-full`,style:{height:R.getTotalSize()},children:R.getVirtualItems().map(e=>{let t=N[e.index];return t?(0,$.jsx)(`div`,{ref:R.measureElement,"data-index":e.index,className:`absolute inset-x-0 top-0`,style:{transform:`translateY(${e.start}px)`},children:Z(t)},e.key):null})}):(0,$.jsx)(`div`,{"data-overview-list":!0,className:`flex flex-col`,children:O.sections.map(e=>{let t=e.kind===`status`?`status:${e.id}`:`project:${e.key}`,[n,...r]=N.filter(n=>n.key===t||n.key===`${t}:empty`||n.kind===`row`&&e.items.includes(n.item)),i=r.filter(e=>e.kind===`row`),a=r.find(e=>e.kind===`empty`);return(0,$.jsxs)(`section`,{"aria-labelledby":`overview-${t}`,"data-overview-section":e.kind===`status`?e.id:e.key,children:[n&&Z(n),a&&Z(a),i.length>0&&(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,$.jsx)(`li`,{"data-card":f&&e.item.lane===`attention`||void 0,className:`relative [&+&]:before:absolute [&+&]:before:top-0 [&+&]:before:right-3 [&+&]:before:left-10 [&+&]:before:h-px [&+&]:before:bg-stroke data-[card]:before:hidden [[data-card]+&]:before:hidden`,children:Z(e)},e.key))})]},t)})});let be=y.lanes.length>0||y.projects.length>0;return(0,$.jsxs)(`div`,{ref:x,"data-board-root":!0,"data-overview":!0,className:`relative flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,children:[!f&&(0,$.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,$.jsx)(`div`,{ref:S,"data-overview-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-20`,children:(0,$.jsxs)(`div`,{className:z(`mx-auto flex w-full gap-10 px-6 max-[650px]:px-4`,g===`column`?`max-w-[1280px]`:`max-w-[928px]`),children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f&&(0,$.jsx)(`h1`,{className:`sr-only`,children:p(`board:page.title`)}),f?M&&O.total>0&&(0,$.jsx)(`div`,{className:`sticky top-0 z-[1] -mx-4 mb-2 bg-background px-4 pt-1 pb-2`,children:(0,$.jsx)(F,{size:`default`,"aria-label":p(`board:group.label`),value:y.groupBy,onValueChange:y.setGroupBy,className:`grid h-11 w-full grid-cols-2 [&>button]:h-full`,options:[{value:`lane`,label:p(`board:group.lane`)},{value:`project`,label:p(`board:group.project`)}]})}):(0,$.jsxs)(`header`,{"data-focus-region":`header`,className:`mb-5 flex min-w-0 flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,children:p(`board:page.title`)}),M&&O.total>0&&(0,$.jsx)(Vt,{agents:O.total,projects:O.projectCount,running:O.running})]}),g===`popover`&&_(`popover`),M&&O.total>0&&(0,$.jsxs)(B,{variant:`outline`,onClick:d,children:[(0,$.jsx)(E,{"aria-hidden":`true`}),p(`board:overview.newTask`)]})]}),!f&&M&&v.total>0&&(0,$.jsx)(yt,{items:v.all,now:C,capabilities:v.capabilities,laneName:b.name,notify:a,requestConfirm:c,requestText:l,onNewTask:d}),M&&be&&f&&O.total>0&&(0,$.jsx)(Ht,{lanes:y.lanes,projects:y.projects.map(e=>k.get(e)?.label??``).filter(Boolean),laneName:b.name,onClear:y.clearFilters}),ye,M&&O.total>0&&!O.filteredEmpty&&(0,$.jsx)(`div`,{className:z(`mt-3 pl-1`,X&&`opacity-50`),children:(0,$.jsx)(Bt,{onClick:n})}),g===`phone`&&(0,$.jsx)(`section`,{"aria-label":p(`board:overview.widgets`),"data-overview-widgets":`phone`,children:_(`phone`)})]}),g===`column`&&(0,$.jsx)(`aside`,{"data-overview-widgets":`column`,"aria-label":p(`board:overview.widgets`),className:z(`w-80 flex-none`,X&&`opacity-50`),children:_(`column`)})]})}),X&&(0,$.jsx)(Gt,{index:X.index,total:X.total,finished:X.finished,answers:v.capabilities.askUser,keys:{approve:W(Y.boardApprove),deny:W(Y.boardDeny),retry:W(Y.boardRetry)},onExit:V.exitTriage}),(0,$.jsx)(`p`,{"aria-live":`polite`,role:`status`,className:`sr-only`,children:ie}),(0,$.jsx)(de,{picker:K.picker,folderDialog:K.folderDialog}),ae&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(It,{open:ce,onOpenChange:ue,commands:K})})]})}function Bt({onClick:e}){let{t}=i();return(0,$.jsxs)(`button`,{type:`button`,"data-overview-history":!0,className:`inline-flex h-8 items-center gap-1 rounded-[var(--r-sm)] px-2 text-[13px] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:e,children:[t(`board:lane.history`),(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`})]})}function Vt({agents:e,projects:t,running:n}){let{t:r}=i(),[a,o]=(0,Q.useState)(!1),s=pe(a),c=s.data?[s.data.subAgents?r(`board:overview.subAgentSlots`,{running:s.data.subAgents.running,max:s.data.subAgents.max}):``,s.data.todayTokens===null?``:r(`board:overview.todayTokens`,{tokens:xe(s.data.todayTokens)}),s.data.memoryBytes===null?``:r(`board:overview.memory`,{memory:be(s.data.memoryBytes)})].filter(Boolean):[],l=s.isPending?r(`board:overview.systemLoading`):c.length?c.join(` · `):r(`board:overview.systemUnavailable`);return(0,$.jsx)(R,{children:(0,$.jsxs)(ee,{open:a,onOpenChange:o,children:[(0,$.jsx)(I,{asChild:!0,children:(0,$.jsx)(`p`,{tabIndex:0,"data-overview-summary":!0,className:`mt-1 w-fit max-w-full truncate rounded-xs text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus`,children:r(`board:page.summary`,{agents:e,projects:t,running:n})})}),(0,$.jsx)(L,{side:`bottom`,align:`start`,sideOffset:6,"data-overview-system":!0,children:l})]})})}function Ht({lanes:e,projects:t,laneName:n,onClear:r}){let{t:a}=i(),o=a(`board:filter.listSeparator`),s=[e.length?a(`board:filter.statusTitle`,{statuses:e.map(e=>n[e]).join(o)}):``,t.length?a(`board:filter.projectsTitle`,{projects:t.join(o)}):``].filter(Boolean);return(0,$.jsxs)(`div`,{"data-overview-filter":!0,className:`mb-3 flex min-w-0 items-center gap-2 rounded-[var(--r-md)] bg-surface-subtle py-1 pr-1 pl-3 text-xs text-content-secondary`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:s.join(` · `)}),(0,$.jsxs)(B,{variant:`ghost`,size:`xs`,onClick:r,children:[(0,$.jsx)(O,{"aria-hidden":`true`}),a(`board:filter.clear`)]})]})}function Ut({spaced:e,lane:t,count:n,collapsed:r,dimmed:a,onToggle:o}){let{t:s}=i(),c=s(t===`attention`?`board:sidebar.group.attention`:t===`running`?`board:sidebar.group.running`:t===`queued`?`board:sidebar.group.queued`:`board:sidebar.group.done`),l=t===`attention`&&n>0,u=`overview-status:${t}`,d=(0,$.jsxs)($.Fragment,{children:[c,(0,$.jsx)(`span`,{"data-overview-count":!0,className:z(`tabular-nums`,l?`inline-grid h-[18px] min-w-[18px] place-items-center rounded-full bg-warning-soft px-1.5 text-[11.5px] font-semibold ring-1 ring-st-attn-border ring-inset`:`text-content-muted`),children:n}),o&&(r?(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":`true`}):(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":`true`}))]}),f=z(`flex h-8 items-center gap-2 px-3 text-[13px] font-medium`,l?`text-warning-strong`:`text-content-secondary`);return(0,$.jsx)(`h2`,{id:u,"data-overview-heading":t,className:z(`m-0 transition-opacity duration-(--d-fast)`,e&&`mt-5`,a&&`opacity-50`),children:o?(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!r,className:z(f,`rounded-[var(--r-md)] hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`),onClick:o,children:d}):(0,$.jsx)(`span`,{className:f,children:d})})}function Wt({spaced:e,section:t,project:n,first:r,last:a,actions:o,deleting:s}){let{t:c}=i(),l=n?.label||c(`board:filter.noProject`),u=t.counts,d=[u.running?c(`board:overview.projectRunning`,{count:u.running}):``,u.queued?c(`board:overview.projectQueued`,{count:u.queued}):``,u.done?c(`board:overview.projectDone`,{count:u.done}):``].filter(Boolean);return(0,$.jsxs)(`div`,{"data-overview-heading":t.key,className:z(`flex h-9 min-w-0 items-center gap-2.5 pr-1 pl-3`,e&&`mt-6`),children:[(0,$.jsx)(S,{className:`size-3.5 flex-none text-content-muted`,strokeWidth:1.75,"aria-hidden":`true`}),(0,$.jsx)(`h2`,{id:`overview-project:${t.key}`,className:`m-0 min-w-0 truncate font-mono text-[13.5px] font-semibold text-content`,title:t.cwd||void 0,children:l}),(0,$.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-content-muted`,children:[u.attention>0&&(0,$.jsx)(`b`,{className:`font-medium text-warning-strong`,children:c(`board:overview.projectAttention`,{count:u.attention})}),u.attention>0&&d.length>0&&(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),d.join(` · `)]}),n&&(0,$.jsx)(bt,{project:n,first:r,last:a,deleting:s,actions:o})]})}function Gt({index:e,total:t,finished:n,answers:r,keys:a,onExit:o}){let{t:s}=i(),c=(e,t)=>e?(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(V,{children:e}),t]}):null;return(0,$.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-triage-bar":!0,className:`absolute bottom-5 left-1/2 z-20 flex h-10 max-w-[calc(100%-32px)] -translate-x-1/2 items-center gap-3 overflow-hidden rounded-[var(--r-lg)] border border-stroke bg-solid px-3.5 text-[12.5px] whitespace-nowrap text-content-secondary shadow-float`,children:n?(0,$.jsx)(`b`,{className:`font-medium text-content`,children:s(`board:triage.finished`)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`b`,{className:`font-medium text-content tabular-nums`,children:s(`board:triage.progress`,{index:e,total:t})}),c(a.approve,s(`board:triage.approve`)),c(a.deny,s(`board:triage.deny`)),c(a.retry,s(`board:triage.retry`)),r&&c(`1–4`,s(`board:triage.answer`)),c(`↵`,s(`board:triage.open`)),(0,$.jsxs)(B,{variant:`ghost`,size:`xs`,className:`-mr-1.5`,onClick:o,children:[(0,$.jsx)(V,{children:`Esc`}),s(`board:triage.exit`)]})]})})}export{Rt as BoardPage};