pisper 0.6.11 → 0.6.12

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 (135) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +667 -597
  3. package/web/assets/{AppDialog-CbXmk5vN.js → AppDialog-B2sA9Pb-.js} +1 -1
  4. package/web/assets/{AppOverlays-BFLcGGx9.js → AppOverlays-BSQhRkJA.js} +1 -1
  5. package/web/assets/{AssetsPage-BoB8pJxi.js → AssetsPage-BYt5ux5w.js} +1 -1
  6. package/web/assets/{BoardPage-C3P69gtK.js → BoardPage-CMlI4ZXS.js} +3 -3
  7. package/web/assets/{ChannelsPage-yPVopq7h.js → ChannelsPage-D_wMSCSQ.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-DPulJWKJ.js → ChatAppearancePage-I3n1MqQQ.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-CZX27BNu.js → ChatHistoryPage-DfYaF_Up.js} +1 -1
  10. package/web/assets/{ChatPage-Bkv4vff9.js → ChatPage-Da-Olqli.js} +5 -5
  11. package/web/assets/{ConfigPage-D1MJyBus.js → ConfigPage-BEor5fZj.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-CKaPEgxw.js → DesktopWindowControls-CNMZrILS.js} +1 -1
  13. package/web/assets/{DispatchOverlay-CGLJLqZo.js → DispatchOverlay-D-gu_80O.js} +1 -1
  14. package/web/assets/{FeaturePage-RH3fTWIk.js → FeaturePage-Bh5TePxl.js} +1 -1
  15. package/web/assets/{FileAttachmentPreview-BhdQDxeP.js → FileAttachmentPreview-BKf_g87y.js} +1 -1
  16. package/web/assets/{FloatingWidgets-UItLK_UZ.js → FloatingWidgets-C1qQaPBd.js} +1 -1
  17. package/web/assets/{FocusRuntimeControls-DyexiBAA.js → FocusRuntimeControls-6ayCBCsE.js} +1 -1
  18. package/web/assets/{GitDiffViewer-dtiUySxH.js → GitDiffViewer-BMyafOfq.js} +1 -1
  19. package/web/assets/LaunchConsole-DM4YN3y3.js +3 -0
  20. package/web/assets/ManageProjectsDialog-B694Yqbw.js +1 -0
  21. package/web/assets/{MarkdownMessage-CYDI17zd.js → MarkdownMessage-mIynIAzE.js} +1 -1
  22. package/web/assets/McpPage-BfGjtNdb.js +1 -0
  23. package/web/assets/{MemoryPage-ObL1zsXe.js → MemoryPage-2htmr0tu.js} +1 -1
  24. package/web/assets/{MobileNavigation-BIPy8A0i.js → MobileNavigation-qjEdcfhX.js} +1 -1
  25. package/web/assets/{MorePage-CFfeYmW_.js → MorePage-B5nQDAQP.js} +1 -1
  26. package/web/assets/NewFolderDialog-D68r0xND.js +1 -0
  27. package/web/assets/{PageHeader-SVPzWuI3.js → PageHeader-BsadnkzI.js} +1 -1
  28. package/web/assets/{PhoneDrawer-C08oZFjf.js → PhoneDrawer-CGi1h7IU.js} +1 -1
  29. package/web/assets/{PhoneMenuButton-BCxDG78_.js → PhoneMenuButton-DkkEDkfk.js} +1 -1
  30. package/web/assets/{PhoneTopBar-6KsMmalq.js → PhoneTopBar-BwIvKnLT.js} +1 -1
  31. package/web/assets/{PluginsPage-jhrfFTbZ.js → PluginsPage-BV0HrLjj.js} +1 -1
  32. package/web/assets/{QuickPromptIdeas-CX8dS2LC.js → QuickPromptIdeas-Do7Bs-V_.js} +1 -1
  33. package/web/assets/{SafeModePrompt-v1_UpOAA.js → SafeModePrompt-zkBI0cAo.js} +1 -1
  34. package/web/assets/SchedulesPage-Dids4PHA.js +1 -0
  35. package/web/assets/{SessionBrowserPane-Bvy_BC-s.js → SessionBrowserPane-DXca3lhC.js} +2 -2
  36. package/web/assets/{SessionContextPanel-B6c71Uom.js → SessionContextPanel-XMQkDDgD.js} +2 -2
  37. package/web/assets/{SessionHome-B-lxCMjh.js → SessionHome-BoPMlfbE.js} +1 -1
  38. package/web/assets/{SessionInspector-FhXk25KK.js → SessionInspector-DoXEstqb.js} +1 -1
  39. package/web/assets/{SessionShell-B-zDO3z-.js → SessionShell-DC0uS7ab.js} +1 -1
  40. package/web/assets/{SettingsSidebar-K4O49gWb.js → SettingsSidebar-D1F4VOzp.js} +1 -1
  41. package/web/assets/{ShortcutHelpDialog-LajY5QoG.js → ShortcutHelpDialog-b1wuKRGr.js} +1 -1
  42. package/web/assets/{ShortcutKeys-BCndDMeY.js → ShortcutKeys-YBlbJmQo.js} +1 -1
  43. package/web/assets/{SidebarUpdateStatus-2eLpofE7.js → SidebarUpdateStatus-Dn95j8CE.js} +1 -1
  44. package/web/assets/{SkillsPage-Z_czQryK.js → SkillsPage-_g13X5ID.js} +1 -1
  45. package/web/assets/{TaskProcessesPane-GyemHu_6.js → TaskProcessesPane-ChitlEI4.js} +1 -1
  46. package/web/assets/{TaskTerminalView-C7WW5feg.js → TaskTerminalView-od0JCnVb.js} +1 -1
  47. package/web/assets/{TerminalPanel-Ddu_dEnz.js → TerminalPanel-CW47PtOX.js} +1 -1
  48. package/web/assets/{WebDesktopPet-DfAoMXEk.js → WebDesktopPet-BgQkrvFd.js} +1 -1
  49. package/web/assets/{WorkflowsPage-D_wAL0Md.js → WorkflowsPage-BFyP0_j_.js} +1 -1
  50. package/web/assets/{WorkspacePicker-DsJ0_nq_.js → WorkspacePicker-tsgOFkg0.js} +1 -1
  51. package/web/assets/{api-DxQIocGp.js → api-DOHQjQrv.js} +1 -1
  52. package/web/assets/{app-update-awVCww9P.js → app-update-C1oLil1b.js} +1 -1
  53. package/web/assets/{approval-confirm-9qU8wa0h.js → approval-confirm-Bpma8HMP.js} +1 -1
  54. package/web/assets/{board-launch-B2PD2yr-.js → board-launch-CM1zjdqN.js} +1 -1
  55. package/web/assets/board-messages-BOWWyhz_.js +1 -0
  56. package/web/assets/board-projects-Cm1I_eWA.js +1 -0
  57. package/web/assets/{chat-api-CjiINBKJ.js → chat-api-tHFjf7aB.js} +1 -1
  58. package/web/assets/{client-store-H1xTSbo-.js → client-store-CpJ1iryH.js} +1 -1
  59. package/web/assets/{config-search-hFrcaQf0.js → config-search-CyM8kWGv.js} +1 -1
  60. package/web/assets/{dialog-Bs9_FZX7.js → dialog-CfgIErMS.js} +1 -1
  61. package/web/assets/{events-DWUUCmbP.js → events-DV8PYjtk.js} +1 -1
  62. package/web/assets/{field-DaxtcBBA.js → field-DoLEb0np.js} +1 -1
  63. package/web/assets/folder-paths-Bky-CpjC.js +1 -0
  64. package/web/assets/{hosts-DsWmhXz4.js → hosts-DJ2bPahU.js} +1 -1
  65. package/web/assets/{i18n-BjpQE1sJ.js → i18n-CHHZADSh.js} +1 -1
  66. package/web/assets/{index-C3xrFlMb.js → index-CKGGgVei.js} +2 -2
  67. package/web/assets/input-group-h8z63MzW.js +1 -0
  68. package/web/assets/mount-app-B1dKgqo5.js +9 -0
  69. package/web/assets/mutation-CEbxdVYy.js +1 -0
  70. package/web/assets/{palette-navigation-Bni8Mp34.js → palette-navigation-ByC1_QS5.js} +1 -1
  71. package/web/assets/{permission-rules-api-BO8nujtv.js → permission-rules-api-DS_p7Lik.js} +1 -1
  72. package/web/assets/{pick-system-directory-C7BKn3Gc.js → pick-system-directory-Bhvwq-o2.js} +1 -1
  73. package/web/assets/placements-DBcA75II.js +2 -0
  74. package/web/assets/{popover-BqqbRCrL.js → popover-4UKNni3P.js} +1 -1
  75. package/web/assets/public-DMzrVWzM.js +1 -0
  76. package/web/assets/{public-Dp3V7Oez.js → public-QbkhsZjX.js} +2 -2
  77. package/web/assets/{public-components-CjL2gwlJ.js → public-components-Bvl5b8HI.js} +1 -1
  78. package/web/assets/public-diff-zWlldwG3.js +1 -0
  79. package/web/assets/public-launch-WirHCXQ8.js +1 -0
  80. package/web/assets/query-Bj-DUNYq.js +1 -0
  81. package/web/assets/runtime-capabilities-4_ZwLBqF.js +1 -0
  82. package/web/assets/{runtime-capabilities-store-BvWnn9Kx.js → runtime-capabilities-store-CLDMF6_P.js} +1 -1
  83. package/web/assets/{safe-mode-instance-UY-RZ5fF.js → safe-mode-instance-DPnZDrTR.js} +1 -1
  84. package/web/assets/safe-mode-sentinel-DNy3YZMh.js +1 -0
  85. package/web/assets/{session-change-summary-api-CI_mYqV8.js → session-change-summary-api-IM8k3njh.js} +1 -1
  86. package/web/assets/{session-home-sBII_AAO.js → session-home-BSH7HEmZ.js} +1 -1
  87. package/web/assets/{session-organization-api-Dt_FNL0d.js → session-organization-api-dGpPgiLe.js} +1 -1
  88. package/web/assets/{session-scope-SQQU-bRA.js → session-scope-_kqXQnb0.js} +1 -1
  89. package/web/assets/{session-tree-actions-AdyVzQwO.js → session-tree-actions-WcOcYBo-.js} +1 -1
  90. package/web/assets/{session-tree-summary-BfBt_ogL.js → session-tree-summary-CpuI5gMj.js} +1 -1
  91. package/web/assets/session-workspaces-BWTBYaGT.js +1 -0
  92. package/web/assets/{settings-navigation-DV3N_utl.js → settings-navigation-_yUm71Uk.js} +1 -1
  93. package/web/assets/{shortcuts-DWF7_dCu.js → shortcuts-BheSJu4D.js} +1 -1
  94. package/web/assets/{side-chat-context-CtRt4VcS.js → side-chat-context-fHd5qktG.js} +3 -3
  95. package/web/assets/sidebar-DQjsKcJn.js +2 -0
  96. package/web/assets/{sidebar-store-Da-3xIaR.js → sidebar-store-0l_ZiIAA.js} +1 -1
  97. package/web/assets/{speech-session-DjxOmcG7.js → speech-session-CrscgV-X.js} +1 -1
  98. package/web/assets/startup-queries-B_DpfvaA.js +1 -0
  99. package/web/assets/{use-i18n-BIJtH0nB.js → use-i18n-BWyVtWF9.js} +1 -1
  100. package/web/assets/{use-studio-actions-e1FiDWGR.js → use-studio-actions-CdzG_H8p.js} +1 -1
  101. package/web/assets/{useBoardItems-CzLK6g45.js → useBoardItems-RCXS90vW.js} +1 -1
  102. package/web/assets/{useFleetSystemInfo-kKFDmOS4.js → useFleetSystemInfo-rj18NGAd.js} +1 -1
  103. package/web/assets/useNewProjectPicker-q3Albbmn.js +1 -0
  104. package/web/assets/useNow-DlbPA2gp.js +1 -0
  105. package/web/assets/{usePhoneShell-BuNqR-TS.js → usePhoneShell-cDHpi_4q.js} +1 -1
  106. package/web/assets/useQuery-DdcpUQhO.js +1 -0
  107. package/web/assets/useSessionListQuery-B-MnlVs6.js +2 -0
  108. package/web/assets/useSessionRowActions-C6dpdoDz.js +1 -0
  109. package/web/assets/{useSidebarModel-CBd3rSxV.js → useSidebarModel-BIzp9khQ.js} +1 -1
  110. package/web/assets/{web-preview-DJZpUrZT.js → web-preview-DZqYC0Ca.js} +1 -1
  111. package/web/assets/{web-preview-events-DRcd0j1W.js → web-preview-events-DQAcSBmI.js} +1 -1
  112. package/web/assets/workspace-order-store-Cw1fZTM7.js +1 -0
  113. package/web/index.html +1 -1
  114. package/web/assets/LaunchConsole-BIiKjt0j.js +0 -2
  115. package/web/assets/ManageProjectsDialog-CLskSna6.js +0 -1
  116. package/web/assets/McpPage-DC_9gmSC.js +0 -1
  117. package/web/assets/SchedulesPage-G1R7ua11.js +0 -1
  118. package/web/assets/board-messages-xFeTO3o6.js +0 -1
  119. package/web/assets/board-projects-Dxd3yet9.js +0 -1
  120. package/web/assets/input-group-CDEyjyK4.js +0 -1
  121. package/web/assets/launch-defaults-store-DTq_ndTa.js +0 -1
  122. package/web/assets/mount-app-DQkz4dfd.js +0 -9
  123. package/web/assets/mutation-Difliohy.js +0 -1
  124. package/web/assets/placements-Dgq244bc.js +0 -2
  125. package/web/assets/public-DjZxpaMo.js +0 -1
  126. package/web/assets/public-diff-BpkmyA3H.js +0 -1
  127. package/web/assets/public-launch-C4NBmnGZ.js +0 -1
  128. package/web/assets/runtime-capabilities-BhAMiYhG.js +0 -1
  129. package/web/assets/safe-mode-sentinel-DnReXgjI.js +0 -1
  130. package/web/assets/sidebar-DTHEZloM.js +0 -2
  131. package/web/assets/startup-queries-_OUFiG02.js +0 -1
  132. package/web/assets/useNow-CpKRH_uQ.js +0 -1
  133. package/web/assets/useQuery-Bg3cTjsY.js +0 -1
  134. package/web/assets/useSessionListQuery-jM0IQ1En.js +0 -2
  135. package/web/assets/useSessionRowActions-BG8yJygF.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-BIJtH0nB.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-Bs9_FZX7.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-BWyVtWF9.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-CfgIErMS.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-BIJtH0nB.js";import{t as i}from"./useQuery-Bg3cTjsY.js";import{o as a}from"./startup-queries-_OUFiG02.js";import{i as o}from"./runtime-capabilities-BhAMiYhG.js";import{t as s}from"./runtime-capabilities-store-BvWnn9Kx.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{C as oe}from"./events-DWUUCmbP.js";import{s as f}from"./shortcuts-DWF7_dCu.js";import{t as se}from"./chat-api-CjiINBKJ.js";import{a as ce}from"./format-DMJQzoZ7.js";import{a as le,i as ue,l as de,t as fe}from"./dialog-Bs9_FZX7.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-BWyVtWF9.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{o as a}from"./startup-queries-B_DpfvaA.js";import{i as o}from"./runtime-capabilities-4_ZwLBqF.js";import{t as s}from"./runtime-capabilities-store-CLDMF6_P.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{C as oe}from"./events-DV8PYjtk.js";import{s as f}from"./shortcuts-BheSJu4D.js";import{t as se}from"./chat-api-tHFjf7aB.js";import{a as ce}from"./format-DMJQzoZ7.js";import{a as le,i as ue,l as de,t as fe}from"./dialog-CfgIErMS.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{d as r}from"./i18n-BjpQE1sJ.js";import{t as i}from"./use-i18n-BIJtH0nB.js";import{r as a,t as o}from"./useQuery-Bg3cTjsY.js";import{t as s}from"./queryOptions-Dfvzj6n2.js";import{a as c,l,u}from"./api-DxQIocGp.js";import{t as d}from"./createLucideIcon-Cd-3GVxJ.js";import{t as f}from"./download-BCfIiuaL.js";import{t as p}from"./external-link-CEQqPcqc.js";import{t as m}from"./file-Bllajneu.js";import{t as h}from"./link-2-mgasYn21.js";import{t as g}from"./paperclip-BCXrwYpb.js";import{t as _}from"./plus-fQbSqB1n.js";import{t as v}from"./refresh-cw-TbWxTY4K.js";import{t as y}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./x-07u4-129.js";import{t as S}from"./more-pages-D_PnxLN0.js";import{a as ee,c as te,n as ne,o as re,p as ie,r as ae,s as oe,t as se}from"./dropdown-menu-CFIFNaKO.js";import{n as ce,t as C}from"./button-CCcCN8tE.js";import{s as le}from"./shortcuts-DWF7_dCu.js";import{n as w}from"./format-DMJQzoZ7.js";import{n as T}from"./PageState-Cz6vFMXv.js";import{a as E,i as D,l as O,n as k,o as A,s as j,t as M}from"./dialog-Bs9_FZX7.js";import{t as N}from"./input-CPw-zkYh.js";import{a as ue,i as P,n as de,o as fe,r as pe,s as me,t as F}from"./FeaturePage-RH3fTWIk.js";import{n as I}from"./mobile-runtime-recovery-tbTyacip.js";import{t as L}from"./field-DaxtcBBA.js";import{t as R}from"./MarkdownMessage-CYDI17zd.js";var z=d(`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`}]]),B=d(`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`}]]),he=d(`list-filter`,[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]),V=e(t(),1),H=134217728;function ge(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 U(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 W(){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 _e(e){let t=window.pisperDesktop?.openAsset,n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;if(!t&&!(window.__PISPER_MOBILE_APP__&&n))return ge(e),`download`;await I();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)>H)throw Error(`资产超过 128 MB 原生打开限制。`);let i=await r.blob();if(!i.size||i.size>H)throw Error(`资产内容为空或超过 128 MB 原生打开限制。`);let a=await U(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`}function G(e){if(!e||typeof e!=`object`||Array.isArray(e))throw l();return Object.fromEntries(Object.entries(e))}function K(e,t=!1){if(!(e===void 0&&!t)){if(typeof e!=`string`||t&&!e)throw l();return e}}function ve(e){if(typeof e==`string`)try{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)?t.href:void 0}catch{return}}function q(e){let t=G(e),n=K(t.id,!0),r=K(t.name,!0),i=K(t.kind,!0);if(t.size!==void 0&&(typeof t.size!=`number`||!Number.isFinite(t.size)||t.size<0))throw l();let a=t.url===void 0?void 0:ve(t.url);if(t.url!==void 0&&!a||i===`link`&&!a)throw l();return{id:n,name:r,kind:i,size:t.size,url:a,mimeType:K(t.mimeType),source:K(t.source),sessionName:K(t.sessionName)}}function ye(e,t){let n=G(e),r=q(n);if(![`text`,`image`,`document`,`file`].includes(r.kind)||r.kind===`text`&&typeof n.text!=`string`||!t&&[`image`,`document`].includes(r.kind)&&typeof n.data!=`string`||n.truncated!==void 0&&typeof n.truncated!=`boolean`)throw l();return{...r,text:K(n.text),data:K(n.data),extension:K(n.extension),truncated:n.truncated}}function be(e={}){return{query:(e.query||``).trim(),kind:e.kind||`all`,sessionId:e.sessionId||``}}var J=e=>`/api/assets/${encodeURIComponent(e)}`,Y=e=>`${J(e)}/download?inline=1`,X={async list(e={},t){let{query:n,kind:r,sessionId:i}=be(e),a=new URLSearchParams;return n&&a.set(`query`,n),r!==`all`&&a.set(`kind`,r===`video`?`file`:r),i&&a.set(`sessionId`,i),c(`/api/assets?${a}`,{signal:t,parse(e){let t=G(e);if(!Array.isArray(t.assets))throw l();let n=t.assets.map(q);return r===`video`?n.filter(e=>e.mimeType?.startsWith(`video/`)):n}})},preview:(e,t)=>c(`${J(e)}/content?preview=1`,{signal:t,parse:e=>ye(e,!0)}),content:(e,t)=>c(`${J(e)}/content`,{signal:t,parse:e=>ye(e,!1)}),async createLink(e){let t=ve(e.url.trim());if(!t)throw new u(r(`assets:assetsPage.invalidLink`),{kind:`protocol`,data:{code:`INVALID_ASSET_URL`}});return c(`/api/assets`,{method:`POST`,body:{kind:`link`,name:e.name,url:t,source:`upload`},parse:q})},remove:e=>c(J(e),{method:`DELETE`,parse(e){if(G(e).deleted!==!0)throw l();return!0}})},Z=n();function xe({onClose:e,onCreated:t}){let{t:n}=i(),[r,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(``),f=(0,V.useRef)(!1),p=(0,V.useRef)(!0);return(0,V.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,Z.jsx)(M,{open:!0,busy:c,onOpenChange:t=>{!t&&!f.current&&e()},children:(0,Z.jsx)(D,{size:`compact`,scrollMode:`body`,children:(0,Z.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 X.createLink({name:r,url:o}),n=!0}catch(e){p.current&&d(e instanceof Error?e.message:String(e))}finally{f.current=!1,p.current&&l(!1)}n&&t()},"aria-busy":c||void 0,children:[(0,Z.jsxs)(j,{className:`pr-8`,children:[(0,Z.jsx)(O,{children:n(`assets:assetsPage.addLinkAsset`)}),(0,Z.jsx)(E,{children:n(`assets:assetsPage.linksCanBeArchivedOpenedOrAddedToAChatAsContext`)})]}),(0,Z.jsxs)(k,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(L,{variant:`control`,children:[n(`assets:assetsPage.name`),(0,Z.jsx)(N,{value:r,disabled:c,onChange:e=>a(e.target.value),placeholder:n(`assets:assetsPage.forExampleOpenAIAPIDocs`)})]}),(0,Z.jsxs)(L,{variant:`control`,children:[`URL`,(0,Z.jsx)(N,{className:`font-mono`,value:o,disabled:c,onChange:e=>s(e.target.value),placeholder:`https://example.com/docs`})]}),u&&(0,Z.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:u})]}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(C,{variant:`secondary`,size:`dialogAction`,disabled:c,onClick:e,children:n(`assets:assetsPage.cancel`)}),(0,Z.jsxs)(C,{type:`submit`,size:`dialogAction`,loading:c,disabled:c||!o.trim(),children:[(0,Z.jsx)(_,{}),n(c?`assets:assetsPage.adding`:`assets:assetsPage.addLink`)]})]})]})})})}var Q=[`assets`,`list`];function Se(e={}){let t=be(e);return s({queryKey:[...Q,t],queryFn:({signal:e})=>X.list(t,e),staleTime:0,retry:!1})}function Ce(e,t){return s({queryKey:[`assets`,`preview`,e,t],queryFn:({signal:t})=>X.preview(e,t),staleTime:0,gcTime:0,retry:!1})}async function we(e){await e.cancelQueries({queryKey:Q}),await e.invalidateQueries({queryKey:Q})}function Te({asset:e,generation:t,trigger:n,fallback:r,onClose:a,onUse:s,onOpen:c,busy:l,actionError:u}){let{t:d}=i(),h=e.mimeType?.startsWith(`video/`),_=e.kind===`image`||h,v=o({...Ce(e.id,t),enabled:!_&&e.kind!==`link`}),[y,x]=(0,V.useState)(!1),[S,ee]=(0,V.useState)(0),te=/\.md$/i.test(e.name)||e.mimeType===`text/markdown`;return(0,Z.jsx)(M,{open:!0,onOpenChange:e=>{e||a()},children:(0,Z.jsxs)(D,{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`,i=t(n)?n:r();t(i)&&i?.focus({preventScroll:!0})},children:[(0,Z.jsxs)(j,{className:`pr-8`,children:[(0,Z.jsx)(O,{className:`break-words leading-6`,children:e.name}),(0,Z.jsx)(E,{className:`font-mono break-words tabular-nums`,children:e.kind===`link`?e.url:`${e.mimeType||``} · ${w(e.size)}`})]}),(0,Z.jsxs)(k,{className:`min-h-[min(240px,30dvh)] rounded-md border border-stroke bg-surface-subtle p-3`,children:[_?y?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 p-4 text-sm`,children:[(0,Z.jsx)(b,{className:`size-5 text-danger`}),(0,Z.jsx)(`p`,{children:d(`assets:assetsPage.mediaFailed`)}),(0,Z.jsx)(C,{variant:`secondary`,onClick:()=>{x(!1),ee(e=>e+1)},children:d(`assets:assetsPage.retry`)})]}):h?(0,Z.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,className:`mx-auto max-h-[65dvh] w-full object-contain`,src:Y(e.id),onError:()=>x(!0)},S):(0,Z.jsx)(`img`,{className:`mx-auto max-h-[65dvh] max-w-full object-contain`,src:Y(e.id),alt:e.name,onError:()=>x(!0)},S):e.kind===`link`?(0,Z.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,Z.jsx)(p,{className:`shrink-0`}),e.url]}):v.isPending?(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-center justify-center gap-2 p-8 text-sm text-content-muted`,children:[(0,Z.jsx)(ce,{}),d(`assets:assetsPage.loadingPreview`)]}):v.isError?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 p-4 text-sm text-danger`,children:[(0,Z.jsx)(b,{className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:v.error.message}),(0,Z.jsx)(C,{variant:`secondary`,onClick:()=>{v.refetch()},children:d(`assets:assetsPage.retry`)})]}):v.data?.kind===`text`?te?(0,Z.jsx)(`div`,{className:`mx-auto max-w-3xl text-left`,children:(0,Z.jsx)(R,{children:v.data.text||``})}):(0,Z.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:v.data.text}):(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 p-6 text-center text-sm`,children:[(0,Z.jsx)(m,{className:`size-8 text-content-faint`,strokeWidth:1.5}),(0,Z.jsx)(`strong`,{className:`font-medium break-words`,children:e.name}),(0,Z.jsx)(`p`,{className:`max-w-md text-xs text-content-muted`,children:d(`assets:assetsPage.thisFileTypeCanBeDownloadedSupportedDocumentsCanAlsoBeAddedToAChatForAnalysis`)})]}),v.data?.truncated&&(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-content-muted`,children:d(`assets:assetsPage.previewTruncated`)})]}),u&&(0,Z.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:u}),(0,Z.jsxs)(A,{children:[e.kind!==`link`&&(0,Z.jsxs)(C,{variant:`secondary`,size:`dialogAction`,disabled:!!l,loading:l===`open`,onClick:c,children:[W()?(0,Z.jsx)(p,{}):(0,Z.jsx)(f,{}),W()?d(`assets:assetsPage.openInApplication`):d(`assets:assetsPage.download`)]}),(0,Z.jsxs)(C,{size:`dialogAction`,disabled:!!l,loading:l===`use`,onClick:s,children:[(0,Z.jsx)(g,{}),d(`assets:assetsPage.useInChat`)]})]})]})})}var Ee=[`all`,`image`,`video`,`file`,`link`];function $(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 De({activeSessionId:e,onBack:t,notify:n,onUse:r,requestConfirm:s}){let{t:c}=i(),l=a(),u=le(`focusSearch`),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(`all`),[g,_]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[w,E]=(0,V.useState)(null),D=(0,V.useRef)(0),O=(0,V.useRef)(null),k=(0,V.useRef)(!0),A=(0,V.useRef)(e);A.current=e;let j=(0,V.useRef)(new Map),[M,N]=(0,V.useState)({}),[P,I]=(0,V.useState)({}),L=g&&!e,R=o({...Se({query:d,kind:p,sessionId:g?e:``}),enabled:!L}),z=L?[]:R.data;(0,V.useEffect)(()=>{k.current=!0;let e=j.current;return()=>{k.current=!1;for(let t of e.values())t.controller?.abort()}},[]),(0,V.useEffect)(()=>{let e=j.current;return()=>{for(let t of e.values())t.controller?.abort()}},[e]);let B=async(t,i)=>{if(j.current.has(t.id))return;let a=i===`use`?new AbortController:void 0,o=e;j.current.set(t.id,{action:i,controller:a}),N(e=>({...e,[t.id]:i})),I(e=>({...e,[t.id]:``}));try{if(i===`delete`){if(!await s({title:c(`assets:assetsPage.deleteAsset`),message:c(`assets:assetsPage.deleteAssetName`,{name:t.name}),confirmLabel:c(`assets:assetsPage.delete`)})||!k.current)return;await l.cancelQueries({queryKey:Q}),await X.remove(t.id),l.setQueriesData({queryKey:Q},e=>e?.filter(e=>e.id!==t.id)),k.current&&n(c(`assets:assetsPage.assetDeleted`)),await we(l)}else if(i===`use`){let e=await X.content(t.id,a?.signal);if(!k.current||a?.signal.aborted||A.current!==o)return;r(e),n(c(`assets:assetsPage.nameAddedToChat`,{name:t.name}))}else{let e=await _e(t);k.current&&n(c(e===`application`?`assets:assetsPage.openedInApplication`:`assets:assetsPage.downloadStarted`))}}catch(e){k.current&&!a?.signal.aborted&&I(n=>({...n,[t.id]:e instanceof Error?e.message:String(e)}))}finally{j.current.delete(t.id),k.current&&N(e=>({...e,[t.id]:void 0}))}},H=!!(d.trim()||p!==`all`),ge=c(g?`assets:assetsPage.noCurrentAssets`:H?`assets:assetsPage.noMatchingAssets`:`assets:assetsPage.nothingHasGatheredHereYet`),U=`border-star-border bg-star-soft text-star-strong hover:bg-star-soft hover:text-star-strong max-[650px]:h-11`,W=c(`navigation:navigation.assets`),G=(0,Z.jsx)(C,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>{R.refetch()},children:c(`assets:assetsPage.retry`)});return(0,Z.jsxs)(pe,{title:W,description:c(`assets:assetsPage.conversationAttachmentsAndAgentOutputsGatherHereAutomatically`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Z.jsx)(me,{search:(0,Z.jsx)(ue,{id:S,value:d,onValueChange:f,placeholder:c(`navigation:pageHeader.searchPage`,{page:W}),shortcut:u,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Z.jsxs)(C,{type:`button`,className:`h-9`,onClick:()=>b(!0),children:[(0,Z.jsx)(h,{}),c(`assets:assetsPage.addLink`)]}),filters:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(se,{children:[(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsxs)(C,{ref:O,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,children:[(0,Z.jsx)(he,{}),c(`assets:assetsPage.filters`)]})}),(0,Z.jsxs)(ae,{align:`start`,children:[(0,Z.jsx)(ee,{children:c(`assets:assetsPage.assetType`)}),(0,Z.jsx)(re,{value:p,onValueChange:e=>{Ee.includes(e)&&m(e)},children:Ee.map(e=>(0,Z.jsx)(oe,{value:e,className:`max-[650px]:min-h-11`,onSelect:e=>e.preventDefault(),children:$(e,c)},e))}),(0,Z.jsx)(te,{}),(0,Z.jsx)(ne,{checked:g,className:`max-[650px]:min-h-11`,onCheckedChange:e=>_(e===!0),children:c(`assets:assetsPage.fromCurrentChat`)})]})]}),p!==`all`&&(0,Z.jsxs)(C,{variant:`outline`,size:`sm`,className:U,onClick:()=>m(`all`),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:$(p,c)}),children:[$(p,c),(0,Z.jsx)(x,{})]}),g&&(0,Z.jsxs)(C,{variant:`outline`,size:`sm`,className:U,onClick:()=>_(!1),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:c(`assets:assetsPage.fromCurrentChat`)}),children:[c(`assets:assetsPage.fromCurrentChat`),(0,Z.jsx)(x,{})]}),(0,Z.jsx)(C,{variant:`ghost`,size:`icon-sm`,className:`ml-auto text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:R.isFetching&&!L,disabled:L||R.isFetching,"aria-label":c(`assets:assetsPage.refreshAssets`),title:c(`assets:assetsPage.refreshAssets`),onClick:()=>{R.refetch()},children:(0,Z.jsx)(v,{})})]})}),children:[L?(0,Z.jsx)(T,{kind:`empty`,title:c(`assets:assetsPage.noActiveSession`)}):R.isPending&&!R.isError?(0,Z.jsx)(T,{kind:`loading`,title:c(`assets:assetsPage.loadingAssets`)}):z?(0,Z.jsxs)(fe,{"data-assets-results":!0,title:$(p,c),count:z.length,meta:R.isFetching&&(0,Z.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(ce,{className:`size-3.5`}),c(`assets:assetsPage.refreshingAssets`)]}),children:[R.isError&&(0,Z.jsx)(F,{className:`mt-0 mb-2`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:R.error.message}),G]})}),z.length?(0,Z.jsx)(de,{children:z.map(e=>(0,Z.jsx)(Oe,{asset:e,busy:M[e.id],error:P[e.id],onPreview:t=>E({asset:e,trigger:t,generation:++D.current}),onAction:t=>{B(e,t)}},e.id))}):!R.isError&&(0,Z.jsx)(T,{kind:`empty`,title:ge,description:c(g||H?`assets:assetsPage.tryOtherFilters`:`assets:assetsPage.bringInALinkOrAttachAFileInAConversationPisperWillGatherTheOutputsCreatedAlongTheWay`)})]}):(0,Z.jsx)(T,{kind:`error`,title:c(`assets:assetsPage.loadFailed`),description:R.error?.message,action:G}),w&&(0,Z.jsx)(Te,{...w,fallback:()=>O.current,onClose:()=>E(null),onUse:()=>{B(w.asset,`use`)},onOpen:()=>{B(w.asset,`open`)},busy:M[w.asset.id],actionError:P[w.asset.id]},w.generation),y&&(0,Z.jsx)(xe,{onClose:()=>b(!1),onCreated:()=>{k.current&&(b(!1),n(c(`assets:assetsPage.linkAssetAdded`))),we(l)}})]})}function Oe({asset:e,busy:t,error:n,onPreview:r,onAction:a}){let{t:o}=i(),[s,c]=(0,V.useState)(!1),l=e.mimeType?.startsWith(`video/`),u=e.kind===`image`?z:l?B:e.kind===`link`?h:m,d=e.kind===`link`?e.url&&new URL(e.url).hostname:/\.([a-z0-9]{1,6})$/i.exec(e.name)?.[1],_=!s&&e.kind===`image`?(0,Z.jsx)(`img`,{className:`size-full rounded-[inherit] object-cover`,src:Y(e.id),alt:``,loading:`lazy`,onError:()=>c(!0)}):!s&&l?(0,Z.jsx)(`video`,{className:`size-full rounded-[inherit] object-cover`,src:Y(e.id),muted:!0,preload:`metadata`,onError:()=>c(!0)}):(0,Z.jsx)(u,{});return(0,Z.jsx)(P,{className:`asset-row`,"data-asset-id":e.id,icon:_,onOpen:e=>r(e.currentTarget),openLabel:`${o(`assets:assetsPage.preview`)}: ${e.name}`,name:(0,Z.jsx)(`span`,{title:e.name,children:e.name}),nameMeta:d||void 0,description:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:e.kind===`link`?`font-mono`:`tabular-nums`,title:e.kind===`link`?e.url:void 0,children:e.kind===`link`?e.url:w(e.size)}),(0,Z.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,Z.jsxs)(Z.Fragment,{children:[e.sessionName&&(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.sessionName,children:o(`assets:assetsPage.fromName`,{name:e.sessionName})}),e.sessionName&&s&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),s&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:o(`assets:assetsPage.mediaFailed`)})]}),actions:(0,Z.jsxs)(`div`,{className:`asset-row-actions flex items-center gap-1`,children:[(0,Z.jsxs)(C,{variant:`secondary`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`use`,onClick:()=>a(`use`),children:[(0,Z.jsx)(g,{}),(0,Z.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.useInChat`)})]}),e.kind===`link`?(0,Z.jsx)(C,{asChild:!0,variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,children:(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(p,{}),(0,Z.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.open`)})]})}):(0,Z.jsxs)(C,{variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`open`,onClick:()=>a(`open`),children:[W()?(0,Z.jsx)(p,{}):(0,Z.jsx)(f,{}),(0,Z.jsx)(`span`,{className:`max-[650px]:sr-only`,children:W()?o(`assets:assetsPage.openInApplication`):o(`assets:assetsPage.download`)})]}),(0,Z.jsx)(C,{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,Z.jsx)(y,{})})]}),detail:n?(0,Z.jsx)(F,{className:`mt-0`,children:n}):void 0})}export{De 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{d as r}from"./i18n-CHHZADSh.js";import{t as i}from"./use-i18n-BWyVtWF9.js";import{r as a,t as o}from"./useQuery-DdcpUQhO.js";import{t as s}from"./queryOptions-Dfvzj6n2.js";import{a as c,l,u}from"./api-DOHQjQrv.js";import{t as d}from"./createLucideIcon-Cd-3GVxJ.js";import{t as f}from"./download-BCfIiuaL.js";import{t as p}from"./external-link-CEQqPcqc.js";import{t as m}from"./file-Bllajneu.js";import{t as h}from"./link-2-mgasYn21.js";import{t as g}from"./paperclip-BCXrwYpb.js";import{t as _}from"./plus-fQbSqB1n.js";import{t as v}from"./refresh-cw-TbWxTY4K.js";import{t as y}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./x-07u4-129.js";import{t as S}from"./more-pages-D_PnxLN0.js";import{a as ee,c as te,n as ne,o as re,p as ie,r as ae,s as oe,t as se}from"./dropdown-menu-CFIFNaKO.js";import{n as ce,t as C}from"./button-CCcCN8tE.js";import{s as le}from"./shortcuts-BheSJu4D.js";import{n as w}from"./format-DMJQzoZ7.js";import{n as T}from"./PageState-Cz6vFMXv.js";import{a as E,i as D,l as O,n as k,o as A,s as j,t as M}from"./dialog-CfgIErMS.js";import{t as N}from"./input-CPw-zkYh.js";import{a as ue,i as P,n as de,o as fe,r as pe,s as me,t as F}from"./FeaturePage-Bh5TePxl.js";import{n as I}from"./mobile-runtime-recovery-tbTyacip.js";import{n as L}from"./field-DoLEb0np.js";import{t as R}from"./MarkdownMessage-mIynIAzE.js";var z=d(`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`}]]),B=d(`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`}]]),he=d(`list-filter`,[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]),V=e(t(),1),H=134217728;function ge(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 U(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 W(){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 _e(e){let t=window.pisperDesktop?.openAsset,n=window.__TAURI__?.core?.invoke??window.__TAURI_INTERNALS__?.invoke;if(!t&&!(window.__PISPER_MOBILE_APP__&&n))return ge(e),`download`;await I();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)>H)throw Error(`资产超过 128 MB 原生打开限制。`);let i=await r.blob();if(!i.size||i.size>H)throw Error(`资产内容为空或超过 128 MB 原生打开限制。`);let a=await U(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`}function G(e){if(!e||typeof e!=`object`||Array.isArray(e))throw l();return Object.fromEntries(Object.entries(e))}function K(e,t=!1){if(!(e===void 0&&!t)){if(typeof e!=`string`||t&&!e)throw l();return e}}function ve(e){if(typeof e==`string`)try{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)?t.href:void 0}catch{return}}function q(e){let t=G(e),n=K(t.id,!0),r=K(t.name,!0),i=K(t.kind,!0);if(t.size!==void 0&&(typeof t.size!=`number`||!Number.isFinite(t.size)||t.size<0))throw l();let a=t.url===void 0?void 0:ve(t.url);if(t.url!==void 0&&!a||i===`link`&&!a)throw l();return{id:n,name:r,kind:i,size:t.size,url:a,mimeType:K(t.mimeType),source:K(t.source),sessionName:K(t.sessionName)}}function ye(e,t){let n=G(e),r=q(n);if(![`text`,`image`,`document`,`file`].includes(r.kind)||r.kind===`text`&&typeof n.text!=`string`||!t&&[`image`,`document`].includes(r.kind)&&typeof n.data!=`string`||n.truncated!==void 0&&typeof n.truncated!=`boolean`)throw l();return{...r,text:K(n.text),data:K(n.data),extension:K(n.extension),truncated:n.truncated}}function be(e={}){return{query:(e.query||``).trim(),kind:e.kind||`all`,sessionId:e.sessionId||``}}var J=e=>`/api/assets/${encodeURIComponent(e)}`,Y=e=>`${J(e)}/download?inline=1`,X={async list(e={},t){let{query:n,kind:r,sessionId:i}=be(e),a=new URLSearchParams;return n&&a.set(`query`,n),r!==`all`&&a.set(`kind`,r===`video`?`file`:r),i&&a.set(`sessionId`,i),c(`/api/assets?${a}`,{signal:t,parse(e){let t=G(e);if(!Array.isArray(t.assets))throw l();let n=t.assets.map(q);return r===`video`?n.filter(e=>e.mimeType?.startsWith(`video/`)):n}})},preview:(e,t)=>c(`${J(e)}/content?preview=1`,{signal:t,parse:e=>ye(e,!0)}),content:(e,t)=>c(`${J(e)}/content`,{signal:t,parse:e=>ye(e,!1)}),async createLink(e){let t=ve(e.url.trim());if(!t)throw new u(r(`assets:assetsPage.invalidLink`),{kind:`protocol`,data:{code:`INVALID_ASSET_URL`}});return c(`/api/assets`,{method:`POST`,body:{kind:`link`,name:e.name,url:t,source:`upload`},parse:q})},remove:e=>c(J(e),{method:`DELETE`,parse(e){if(G(e).deleted!==!0)throw l();return!0}})},Z=n();function xe({onClose:e,onCreated:t}){let{t:n}=i(),[r,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(``),f=(0,V.useRef)(!1),p=(0,V.useRef)(!0);return(0,V.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,Z.jsx)(M,{open:!0,busy:c,onOpenChange:t=>{!t&&!f.current&&e()},children:(0,Z.jsx)(D,{size:`compact`,scrollMode:`body`,children:(0,Z.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 X.createLink({name:r,url:o}),n=!0}catch(e){p.current&&d(e instanceof Error?e.message:String(e))}finally{f.current=!1,p.current&&l(!1)}n&&t()},"aria-busy":c||void 0,children:[(0,Z.jsxs)(j,{className:`pr-8`,children:[(0,Z.jsx)(O,{children:n(`assets:assetsPage.addLinkAsset`)}),(0,Z.jsx)(E,{children:n(`assets:assetsPage.linksCanBeArchivedOpenedOrAddedToAChatAsContext`)})]}),(0,Z.jsxs)(k,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(L,{variant:`control`,children:[n(`assets:assetsPage.name`),(0,Z.jsx)(N,{value:r,disabled:c,onChange:e=>a(e.target.value),placeholder:n(`assets:assetsPage.forExampleOpenAIAPIDocs`)})]}),(0,Z.jsxs)(L,{variant:`control`,children:[`URL`,(0,Z.jsx)(N,{className:`font-mono`,value:o,disabled:c,onChange:e=>s(e.target.value),placeholder:`https://example.com/docs`})]}),u&&(0,Z.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:u})]}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(C,{variant:`secondary`,size:`dialogAction`,disabled:c,onClick:e,children:n(`assets:assetsPage.cancel`)}),(0,Z.jsxs)(C,{type:`submit`,size:`dialogAction`,loading:c,disabled:c||!o.trim(),children:[(0,Z.jsx)(_,{}),n(c?`assets:assetsPage.adding`:`assets:assetsPage.addLink`)]})]})]})})})}var Q=[`assets`,`list`];function Se(e={}){let t=be(e);return s({queryKey:[...Q,t],queryFn:({signal:e})=>X.list(t,e),staleTime:0,retry:!1})}function Ce(e,t){return s({queryKey:[`assets`,`preview`,e,t],queryFn:({signal:t})=>X.preview(e,t),staleTime:0,gcTime:0,retry:!1})}async function we(e){await e.cancelQueries({queryKey:Q}),await e.invalidateQueries({queryKey:Q})}function Te({asset:e,generation:t,trigger:n,fallback:r,onClose:a,onUse:s,onOpen:c,busy:l,actionError:u}){let{t:d}=i(),h=e.mimeType?.startsWith(`video/`),_=e.kind===`image`||h,v=o({...Ce(e.id,t),enabled:!_&&e.kind!==`link`}),[y,x]=(0,V.useState)(!1),[S,ee]=(0,V.useState)(0),te=/\.md$/i.test(e.name)||e.mimeType===`text/markdown`;return(0,Z.jsx)(M,{open:!0,onOpenChange:e=>{e||a()},children:(0,Z.jsxs)(D,{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`,i=t(n)?n:r();t(i)&&i?.focus({preventScroll:!0})},children:[(0,Z.jsxs)(j,{className:`pr-8`,children:[(0,Z.jsx)(O,{className:`break-words leading-6`,children:e.name}),(0,Z.jsx)(E,{className:`font-mono break-words tabular-nums`,children:e.kind===`link`?e.url:`${e.mimeType||``} · ${w(e.size)}`})]}),(0,Z.jsxs)(k,{className:`min-h-[min(240px,30dvh)] rounded-md border border-stroke bg-surface-subtle p-3`,children:[_?y?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-center gap-3 p-4 text-sm`,children:[(0,Z.jsx)(b,{className:`size-5 text-danger`}),(0,Z.jsx)(`p`,{children:d(`assets:assetsPage.mediaFailed`)}),(0,Z.jsx)(C,{variant:`secondary`,onClick:()=>{x(!1),ee(e=>e+1)},children:d(`assets:assetsPage.retry`)})]}):h?(0,Z.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,className:`mx-auto max-h-[65dvh] w-full object-contain`,src:Y(e.id),onError:()=>x(!0)},S):(0,Z.jsx)(`img`,{className:`mx-auto max-h-[65dvh] max-w-full object-contain`,src:Y(e.id),alt:e.name,onError:()=>x(!0)},S):e.kind===`link`?(0,Z.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,Z.jsx)(p,{className:`shrink-0`}),e.url]}):v.isPending?(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-center justify-center gap-2 p-8 text-sm text-content-muted`,children:[(0,Z.jsx)(ce,{}),d(`assets:assetsPage.loadingPreview`)]}):v.isError?(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 p-4 text-sm text-danger`,children:[(0,Z.jsx)(b,{className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words`,children:v.error.message}),(0,Z.jsx)(C,{variant:`secondary`,onClick:()=>{v.refetch()},children:d(`assets:assetsPage.retry`)})]}):v.data?.kind===`text`?te?(0,Z.jsx)(`div`,{className:`mx-auto max-w-3xl text-left`,children:(0,Z.jsx)(R,{children:v.data.text||``})}):(0,Z.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:v.data.text}):(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 p-6 text-center text-sm`,children:[(0,Z.jsx)(m,{className:`size-8 text-content-faint`,strokeWidth:1.5}),(0,Z.jsx)(`strong`,{className:`font-medium break-words`,children:e.name}),(0,Z.jsx)(`p`,{className:`max-w-md text-xs text-content-muted`,children:d(`assets:assetsPage.thisFileTypeCanBeDownloadedSupportedDocumentsCanAlsoBeAddedToAChatForAnalysis`)})]}),v.data?.truncated&&(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-content-muted`,children:d(`assets:assetsPage.previewTruncated`)})]}),u&&(0,Z.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:u}),(0,Z.jsxs)(A,{children:[e.kind!==`link`&&(0,Z.jsxs)(C,{variant:`secondary`,size:`dialogAction`,disabled:!!l,loading:l===`open`,onClick:c,children:[W()?(0,Z.jsx)(p,{}):(0,Z.jsx)(f,{}),W()?d(`assets:assetsPage.openInApplication`):d(`assets:assetsPage.download`)]}),(0,Z.jsxs)(C,{size:`dialogAction`,disabled:!!l,loading:l===`use`,onClick:s,children:[(0,Z.jsx)(g,{}),d(`assets:assetsPage.useInChat`)]})]})]})})}var Ee=[`all`,`image`,`video`,`file`,`link`];function $(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 De({activeSessionId:e,onBack:t,notify:n,onUse:r,requestConfirm:s}){let{t:c}=i(),l=a(),u=le(`focusSearch`),[d,f]=(0,V.useState)(``),[p,m]=(0,V.useState)(`all`),[g,_]=(0,V.useState)(!1),[y,b]=(0,V.useState)(!1),[w,E]=(0,V.useState)(null),D=(0,V.useRef)(0),O=(0,V.useRef)(null),k=(0,V.useRef)(!0),A=(0,V.useRef)(e);A.current=e;let j=(0,V.useRef)(new Map),[M,N]=(0,V.useState)({}),[P,I]=(0,V.useState)({}),L=g&&!e,R=o({...Se({query:d,kind:p,sessionId:g?e:``}),enabled:!L}),z=L?[]:R.data;(0,V.useEffect)(()=>{k.current=!0;let e=j.current;return()=>{k.current=!1;for(let t of e.values())t.controller?.abort()}},[]),(0,V.useEffect)(()=>{let e=j.current;return()=>{for(let t of e.values())t.controller?.abort()}},[e]);let B=async(t,i)=>{if(j.current.has(t.id))return;let a=i===`use`?new AbortController:void 0,o=e;j.current.set(t.id,{action:i,controller:a}),N(e=>({...e,[t.id]:i})),I(e=>({...e,[t.id]:``}));try{if(i===`delete`){if(!await s({title:c(`assets:assetsPage.deleteAsset`),message:c(`assets:assetsPage.deleteAssetName`,{name:t.name}),confirmLabel:c(`assets:assetsPage.delete`)})||!k.current)return;await l.cancelQueries({queryKey:Q}),await X.remove(t.id),l.setQueriesData({queryKey:Q},e=>e?.filter(e=>e.id!==t.id)),k.current&&n(c(`assets:assetsPage.assetDeleted`)),await we(l)}else if(i===`use`){let e=await X.content(t.id,a?.signal);if(!k.current||a?.signal.aborted||A.current!==o)return;r(e),n(c(`assets:assetsPage.nameAddedToChat`,{name:t.name}))}else{let e=await _e(t);k.current&&n(c(e===`application`?`assets:assetsPage.openedInApplication`:`assets:assetsPage.downloadStarted`))}}catch(e){k.current&&!a?.signal.aborted&&I(n=>({...n,[t.id]:e instanceof Error?e.message:String(e)}))}finally{j.current.delete(t.id),k.current&&N(e=>({...e,[t.id]:void 0}))}},H=!!(d.trim()||p!==`all`),ge=c(g?`assets:assetsPage.noCurrentAssets`:H?`assets:assetsPage.noMatchingAssets`:`assets:assetsPage.nothingHasGatheredHereYet`),U=`border-star-border bg-star-soft text-star-strong hover:bg-star-soft hover:text-star-strong max-[650px]:h-11`,W=c(`navigation:navigation.assets`),G=(0,Z.jsx)(C,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>{R.refetch()},children:c(`assets:assetsPage.retry`)});return(0,Z.jsxs)(pe,{title:W,description:c(`assets:assetsPage.conversationAttachmentsAndAgentOutputsGatherHereAutomatically`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Z.jsx)(me,{search:(0,Z.jsx)(ue,{id:S,value:d,onValueChange:f,placeholder:c(`navigation:pageHeader.searchPage`,{page:W}),shortcut:u,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Z.jsxs)(C,{type:`button`,className:`h-9`,onClick:()=>b(!0),children:[(0,Z.jsx)(h,{}),c(`assets:assetsPage.addLink`)]}),filters:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(se,{children:[(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsxs)(C,{ref:O,variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,children:[(0,Z.jsx)(he,{}),c(`assets:assetsPage.filters`)]})}),(0,Z.jsxs)(ae,{align:`start`,children:[(0,Z.jsx)(ee,{children:c(`assets:assetsPage.assetType`)}),(0,Z.jsx)(re,{value:p,onValueChange:e=>{Ee.includes(e)&&m(e)},children:Ee.map(e=>(0,Z.jsx)(oe,{value:e,className:`max-[650px]:min-h-11`,onSelect:e=>e.preventDefault(),children:$(e,c)},e))}),(0,Z.jsx)(te,{}),(0,Z.jsx)(ne,{checked:g,className:`max-[650px]:min-h-11`,onCheckedChange:e=>_(e===!0),children:c(`assets:assetsPage.fromCurrentChat`)})]})]}),p!==`all`&&(0,Z.jsxs)(C,{variant:`outline`,size:`sm`,className:U,onClick:()=>m(`all`),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:$(p,c)}),children:[$(p,c),(0,Z.jsx)(x,{})]}),g&&(0,Z.jsxs)(C,{variant:`outline`,size:`sm`,className:U,onClick:()=>_(!1),"aria-label":c(`assets:assetsPage.removeFilter`,{filter:c(`assets:assetsPage.fromCurrentChat`)}),children:[c(`assets:assetsPage.fromCurrentChat`),(0,Z.jsx)(x,{})]}),(0,Z.jsx)(C,{variant:`ghost`,size:`icon-sm`,className:`ml-auto text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:R.isFetching&&!L,disabled:L||R.isFetching,"aria-label":c(`assets:assetsPage.refreshAssets`),title:c(`assets:assetsPage.refreshAssets`),onClick:()=>{R.refetch()},children:(0,Z.jsx)(v,{})})]})}),children:[L?(0,Z.jsx)(T,{kind:`empty`,title:c(`assets:assetsPage.noActiveSession`)}):R.isPending&&!R.isError?(0,Z.jsx)(T,{kind:`loading`,title:c(`assets:assetsPage.loadingAssets`)}):z?(0,Z.jsxs)(fe,{"data-assets-results":!0,title:$(p,c),count:z.length,meta:R.isFetching&&(0,Z.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(ce,{className:`size-3.5`}),c(`assets:assetsPage.refreshingAssets`)]}),children:[R.isError&&(0,Z.jsx)(F,{className:`mt-0 mb-2`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:R.error.message}),G]})}),z.length?(0,Z.jsx)(de,{children:z.map(e=>(0,Z.jsx)(Oe,{asset:e,busy:M[e.id],error:P[e.id],onPreview:t=>E({asset:e,trigger:t,generation:++D.current}),onAction:t=>{B(e,t)}},e.id))}):!R.isError&&(0,Z.jsx)(T,{kind:`empty`,title:ge,description:c(g||H?`assets:assetsPage.tryOtherFilters`:`assets:assetsPage.bringInALinkOrAttachAFileInAConversationPisperWillGatherTheOutputsCreatedAlongTheWay`)})]}):(0,Z.jsx)(T,{kind:`error`,title:c(`assets:assetsPage.loadFailed`),description:R.error?.message,action:G}),w&&(0,Z.jsx)(Te,{...w,fallback:()=>O.current,onClose:()=>E(null),onUse:()=>{B(w.asset,`use`)},onOpen:()=>{B(w.asset,`open`)},busy:M[w.asset.id],actionError:P[w.asset.id]},w.generation),y&&(0,Z.jsx)(xe,{onClose:()=>b(!1),onCreated:()=>{k.current&&(b(!1),n(c(`assets:assetsPage.linkAssetAdded`))),we(l)}})]})}function Oe({asset:e,busy:t,error:n,onPreview:r,onAction:a}){let{t:o}=i(),[s,c]=(0,V.useState)(!1),l=e.mimeType?.startsWith(`video/`),u=e.kind===`image`?z:l?B:e.kind===`link`?h:m,d=e.kind===`link`?e.url&&new URL(e.url).hostname:/\.([a-z0-9]{1,6})$/i.exec(e.name)?.[1],_=!s&&e.kind===`image`?(0,Z.jsx)(`img`,{className:`size-full rounded-[inherit] object-cover`,src:Y(e.id),alt:``,loading:`lazy`,onError:()=>c(!0)}):!s&&l?(0,Z.jsx)(`video`,{className:`size-full rounded-[inherit] object-cover`,src:Y(e.id),muted:!0,preload:`metadata`,onError:()=>c(!0)}):(0,Z.jsx)(u,{});return(0,Z.jsx)(P,{className:`asset-row`,"data-asset-id":e.id,icon:_,onOpen:e=>r(e.currentTarget),openLabel:`${o(`assets:assetsPage.preview`)}: ${e.name}`,name:(0,Z.jsx)(`span`,{title:e.name,children:e.name}),nameMeta:d||void 0,description:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:e.kind===`link`?`font-mono`:`tabular-nums`,title:e.kind===`link`?e.url:void 0,children:e.kind===`link`?e.url:w(e.size)}),(0,Z.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,Z.jsxs)(Z.Fragment,{children:[e.sessionName&&(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.sessionName,children:o(`assets:assetsPage.fromName`,{name:e.sessionName})}),e.sessionName&&s&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),s&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:o(`assets:assetsPage.mediaFailed`)})]}),actions:(0,Z.jsxs)(`div`,{className:`asset-row-actions flex items-center gap-1`,children:[(0,Z.jsxs)(C,{variant:`secondary`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`use`,onClick:()=>a(`use`),children:[(0,Z.jsx)(g,{}),(0,Z.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.useInChat`)})]}),e.kind===`link`?(0,Z.jsx)(C,{asChild:!0,variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,children:(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(p,{}),(0,Z.jsx)(`span`,{className:`max-[650px]:sr-only`,children:o(`assets:assetsPage.open`)})]})}):(0,Z.jsxs)(C,{variant:`ghost`,size:`sm`,className:`max-[650px]:size-11 max-[650px]:px-0`,disabled:!!t,loading:t===`open`,onClick:()=>a(`open`),children:[W()?(0,Z.jsx)(p,{}):(0,Z.jsx)(f,{}),(0,Z.jsx)(`span`,{className:`max-[650px]:sr-only`,children:W()?o(`assets:assetsPage.openInApplication`):o(`assets:assetsPage.download`)})]}),(0,Z.jsx)(C,{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,Z.jsx)(y,{})})]}),detail:n?(0,Z.jsx)(F,{className:`mt-0`,children:n}):void 0})}export{De as AssetsPage};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePicker-DsJ0_nq_.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BIJtH0nB.js","assets/i18n-BjpQE1sJ.js","assets/vendor-router-CSN_DGvx.js","assets/index-C3xrFlMb.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/check-2vYc6QaP.js","assets/triangle-alert-CE1q54ci.js","assets/button-CCcCN8tE.js","assets/vendor-ui-DvrYggeS.js","assets/dist-41X0pdUs.js","assets/utils-C8uzG5AZ.js","assets/dialog-Bs9_FZX7.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/alert-firawb0H.js","assets/ManageProjectsDialog-CLskSna6.js","assets/arrow-down-CDGua-ue.js","assets/arrow-up-DST6-qVQ.js","assets/folder-plus-OPHZsJho.js","assets/pencil-U08v_vV9.js","assets/rotate-ccw-C0v8V77_.js","assets/trash-2-CNrPOoPR.js","assets/useSessionListQuery-jM0IQ1En.js","assets/useQuery-Bg3cTjsY.js","assets/startup-queries-_OUFiG02.js","assets/mutation-Difliohy.js","assets/api-DxQIocGp.js","assets/abort-signal-f4JsiYKX.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-BvWnn9Kx.js","assets/runtime-capabilities-BhAMiYhG.js","assets/session-board-status-D2lpFPiI.js","assets/chat-api-CjiINBKJ.js","assets/session-organization-api-Dt_FNL0d.js","assets/events-DWUUCmbP.js","assets/session-questions-Cf-1g85h.js","assets/card-presentation-1oph2b8P.js","assets/board-projects-Dxd3yet9.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-BIJtH0nB.js";import{t as a}from"./useQuery-Bg3cTjsY.js";import{r as o,u as s}from"./placements-Dgq244bc.js";import{i as c}from"./use-mobile-DauOEda6.js";import{t as l}from"./usePhoneShell-BuNqR-TS.js";import{t as u}from"./createLucideIcon-Cd-3GVxJ.js";import{t as d}from"./arrow-down-CDGua-ue.js";import{t as f}from"./arrow-right-DqLOhpA2.js";import{t as p}from"./arrow-up-DST6-qVQ.js";import{t as m}from"./chevron-down-CxtxIjiP.js";import{t as h}from"./chevron-right-C3t2Rckj.js";import{t as g}from"./corner-down-right--hxi-Ihy.js";import{t as _}from"./ellipsis-CfGKfbq6.js";import{_ as v,c as y,d as b,f as x,h as S,i as C,l as w,m as T,n as ee,o as E,r as D,t as O,u as k}from"./useSessionRowActions-BG8yJygF.js";import{n as A,r as j}from"./launch-defaults-store-DTq_ndTa.js";import{t as M}from"./pin-CU0FG0lI.js";import{t as N}from"./plus-fQbSqB1n.js";import{t as P}from"./rotate-ccw-C0v8V77_.js";import{t as F}from"./square-pen-hYbjKh6A.js";import{t as I}from"./trash-2-CNrPOoPR.js";import{t as L}from"./x-07u4-129.js";import{t as R}from"./brand-DIEc3fK8.js";import{c as z,i as B,p as V,r as te,t as H}from"./dropdown-menu-CFIFNaKO.js";import{t as ne}from"./segmented-control-BlM_GKV6.js";import{i as re,n as U,r as ie,t as ae}from"./tooltip-D4MFbqcG.js";import{t as W}from"./utils-C8uzG5AZ.js";import{t as G}from"./button-CCcCN8tE.js";import{t as oe}from"./kbd-CAufZTkl.js";import{a as se,c as ce,g as K,n as le,t as q}from"./shortcuts-DWF7_dCu.js";import{t as ue}from"./sidebar-store-Da-3xIaR.js";import{c as de,l as J,n as fe,o as pe,s as me,t as he}from"./useNow-CpKRH_uQ.js";import{r as ge}from"./session-questions-Cf-1g85h.js";import{n as _e,t as ve}from"./useFleetSystemInfo-kKFDmOS4.js";import{c as ye,i as be,l as xe,n as Se,r as Ce,t as Y}from"./card-presentation-1oph2b8P.js";import{n as we,r as X}from"./format-DMJQzoZ7.js";import{n as Te}from"./PageState-Cz6vFMXv.js";import{t as Ee}from"./session-change-summary-api-CI_mYqV8.js";import"./public-launch-C4NBmnGZ.js";import{a as De}from"./board-projects-Dxd3yet9.js";import{n as Oe,t as ke}from"./esm-DCV8yILT.js";import{t as Z}from"./StatusGlyph-1KgitlUg.js";var Ae=u(`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 je(){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`)}}}var $=r();function Me({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 Ne({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:()=>Ee(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)(Me,{files:o.changedFiles,added:o.added||0,removed:o.removed||0})})}function Pe({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:W(`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:W(`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:W(`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 Fe(e){return e instanceof Element&&!!e.closest(`button, a, input, textarea, [role="menuitem"], [data-card-stop]`)}function Ie({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 Le(e){return e.split(`
3
- `).map(e=>e.trim()).find(Boolean)??``}function Re({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`,_=e.approvals[0]??null,v=_?.severity===`critical`,x=pe(e),S=e.title||f(`navigation:shell.untitledSession`),C=()=>c.onOpen(e.id),T=`${e.lane}:${e.status}`,ee=(0,Q.useRef)(T);(0,Q.useLayoutEffect)(()=>{ee.current!==T&&(ee.current=T,p.current?.getAnimations?.().forEach(e=>e.cancel()))},[T]);let D=(0,Q.useRef)(!1),O=e=>{let t=D.current;D.current=!1,!(t||Fe(e.target))&&C()},A=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())},j=``;j=h?k(f,me(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 N=e.status===`approval`&&e.approvalsState===`ready`&&_?_.toolName||`—`:``,P=``,F=``;if(h&&e.since!==null)P=w(t-e.since),F=f(`board:overview.waited`,{wait:P});else if(e.lane===`running`){let n=e.startedAt??e.since;P=E(n===null?null:t-n),F=P?f(`board:overview.ran`,{time:P}):``}else e.lane===`done`&&(P=y(e.since),F=P?f(`board:overview.finishedAt`,{time:P}):``);let I=null,L=null,R=(0,$.jsxs)(G,{size:`sm`,tabIndex:m,onClick:C,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`||!_)I=(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=be(_.reason),n=v&&t?Ce(_.reason):``,r=_.toolName===`bash`&&_.command,i=_.command||_.path,a=i?``:Y(_),o=!i&&_.reason&&!t?_.reason:``,s=e.approvals.length-1,c=e.approvals.slice(1).some(e=>e.severity===`critical`),l=v?(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;I=(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[i?(0,$.jsx)(Pe,{text:i,prefix:r?`$`:``,variant:`plain`,tabIndex:m,lead:l}):a?(0,$.jsx)(Pe,{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(x.kind===`decide`&&_){let t=c.isPending(`approve`,e.id,_.id),n=c.isPending(`deny`,e.id,_.id);L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(G,{variant:`outline`,size:`sm`,tabIndex:m,disabled:t||n,loading:n,"aria-label":f(`board:sidebar.denyNamed`,{title:S}),"aria-keyshortcuts":q(s.deny)||void 0,onClick:()=>c.onDeny(e,_),children:[f(`board:card.deny`),(0,$.jsx)(Ie,{binding:s.deny})]}),(0,$.jsxs)(G,{size:`sm`,tabIndex:m,disabled:t||n,loading:t,"aria-label":f(`board:sidebar.approveNamed`,{title:S}),"aria-keyshortcuts":q(s.approve)||void 0,onClick:()=>c.onApprove(e,_),children:[f(`board:card.approve`),(0,$.jsx)(Ie,{binding:s.approve})]})]})}else L=R}else if(e.status===`question`){let t=e.question,n=ge(t),r=t?c.isPending(`answer`,e.id,t.id):!1,i=t?.questions[0];I=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)(G,{variant:`outline`,size:`sm`,tabIndex:m,disabled:r,"data-question-pill":t,"aria-label":f(`board:question.answerNamed`,{title:S,option:t}),"aria-keyshortcuts":String(n+1),className:W(`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)(G,{variant:`ghost`,size:`sm`,tabIndex:m,className:W(`h-auto min-h-7`,d&&`min-h-11`),onClick:C,children:f(`board:question.other`)})]})]}):null,L=n?null:R}else if(e.status===`failed`&&h){let t=Le(e.error)||[...e.tail].reverse().find(ye)?.trim()||``,n=c.isPending(`retry`,e.id);I=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,L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{variant:`outline`,size:`sm`,tabIndex:m,onClick:C,children:f(`board:overview.log`)}),(0,$.jsxs)(G,{size:`sm`,tabIndex:m,loading:n,disabled:n,"aria-label":f(`board:overview.retryNamed`,{title:S}),"aria-keyshortcuts":q(s.retry)||void 0,onClick:()=>c.onRetry(e),children:[f(`board:card.retry`),(0,$.jsx)(Ie,{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)?w(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)&&(I=(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)(g,{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`);I=(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&&(L=(0,$.jsx)(G,{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=Le(e.preview);I=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=xe(e);L=n?(0,$.jsx)(Me,{...n}):e.changeStats?null:(0,$.jsx)(Ne,{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:S,status:j}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{D.current=Fe(e.target)},onClick:O,onKeyDown:A,className:W(`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)(Z,{status:Se(e),phase:o})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`p`,{className:`min-w-0 truncate text-base leading-5 font-medium text-content`,children:S}),(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:[j,N&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:N})]})]}),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:[P&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:`text-xs text-content-muted tabular-nums`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:P}),(0,$.jsx)(`span`,{className:`sr-only`,children:F})]}),(0,$.jsx)(b,{row:{id:e.id,title:S,pinned:e.pinned},actions:l,canMarkHandled:e.status===`failed`,align:`end`,tabIndex:m,className:`size-11`})]})]}),I&&(0,$.jsx)(`div`,{className:`min-w-0 pl-[26px]`,children:I}),L&&(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:L})]}):(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:S,status:j}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{D.current=Fe(e.target)},onClick:O,onKeyDown:A,className:W(`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)(Z,{status:Se(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:[(0,$.jsx)(`span`,{className:W(`min-w-0 truncate text-base font-medium`,e.lane===`done`?`text-content-secondary`:`text-content`),children:S}),(0,$.jsxs)(`span`,{"data-row-status":!0,className:W(`flex-none text-xs`,h?`text-warning-strong`:`text-content-muted`),children:[j,N&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:N})]})]}),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)(M,{className:`size-3 flex-none self-center text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":f(`board:card.pinned`)})]}),I]}),(0,$.jsxs)(`div`,{className:`flex min-h-[30px] items-center gap-2 self-start`,children:[L&&(0,$.jsx)(`div`,{className:`flex items-center gap-1.5`,children:L}),(0,$.jsxs)(`div`,{className:W(`relative flex min-h-[30px] items-center justify-end pointer-coarse:gap-2`,!P&&`min-w-[26px]`),children:[P&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:W(`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:P}),(0,$.jsx)(`span`,{className:`sr-only`,children:F})]}),(0,$.jsx)(b,{row:{id:e.id,title:S,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 ze=(0,Q.memo)(Re);function Be({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)(H,{children:[(0,$.jsx)(V,{asChild:!0,children:(0,$.jsx)(G,{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)(_,{"aria-hidden":`true`})})}),(0,$.jsxs)(te,{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)(B,{onSelect:()=>s.current=()=>a.onNewTask(e),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),o(`board:project.newTaskHere`)]}),(0,$.jsxs)(B,{onSelect:()=>a.onRename(e),children:[(0,$.jsx)(Ae,{"aria-hidden":`true`}),o(`board:project.rename`)]}),e.custom&&(0,$.jsxs)(B,{onSelect:()=>a.onResetName(e),children:[(0,$.jsx)(P,{"aria-hidden":`true`}),o(`board:project.resetName`)]})]}),(0,$.jsxs)(B,{disabled:t,onSelect:()=>a.onMove(e,-1),children:[(0,$.jsx)(p,{"aria-hidden":`true`}),o(`board:project.moveUpShort`)]}),(0,$.jsxs)(B,{disabled:n,onSelect:()=>a.onMove(e,1),children:[(0,$.jsx)(d,{"aria-hidden":`true`}),o(`board:project.moveDownShort`)]}),(0,$.jsxs)(B,{onSelect:()=>s.current=a.onManage,children:[(0,$.jsx)(v,{"aria-hidden":`true`}),o(`board:project.manage`)]}),(0,$.jsx)(z,{}),(0,$.jsxs)(B,{variant:`destructive`,disabled:r,onSelect:()=>a.onDelete(e),children:[(0,$.jsx)(I,{"aria-hidden":`true`}),o(`board:project.delete`)]})]})]})}var Ve=1200;function He({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))},Ve))},[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 Ue=null;function We(e){Ue=e}function Ge(){return Ue}function Ke(){Ue=null}var qe=1600,Je=`[data-overview-scroller]`;function Ye(e,t){return e?.querySelector(`[data-board-card="${CSS.escape(t)}"]`)??null}function Xe(e){return e.dataset.overviewScroller===void 0?`other`:`overview`}function Ze(e){let t=pe(e);return t.kind===`decide`?e.approvals.find(e=>e.id===t.approvalId)??null:null}function Qe(){return new Promise(e=>requestAnimationFrame(()=>e()))}function $e({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=J(),m=ce(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 w=(0,Q.useRef)(o);w.current=o;let[T,ee]=(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 Qe();let n=(w.current?await w.current(t):null)??Ye(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(Je).forEach(e=>{n[Xe(e)]=e.scrollTop}),We({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=>C(Ye(e.current,t),{duration:180,scale:.9}),[e]),N=(0,Q.useCallback)(t=>Ye(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||!ge(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||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){ee(!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)(()=>{!T||n.length<r.length||(ee(!1),I())},[n.length,r.length,I,T]);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),qe);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(se(t)||le(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`?ge(s.question)?.[Number(t.key)-1]:void 0,l=!0;if(t.key===`Escape`&&_)L();else if(K(t,m.boardNext)||i&&a&&t.key===`ArrowDown`)R(1);else if(K(t,m.boardPrevious)||i&&a&&t.key===`ArrowUp`)R(-1);else if(K(t,m.boardToggleGrouping))d();else if(K(t,m.boardTriage))_?L():I();else if(o&&K(t,m.boardApprove)&&s?.status===`approval`){let e=Ze(s);e&&F.onApprove(s,e)}else if(o&&K(t,m.boardDeny)&&s?.status===`approval`){let e=Ze(s);e&&F.onDeny(s,e)}else o&&K(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||Ge())return;let e=document.activeElement,n=e instanceof HTMLElement&&t.contains(e)?e.closest(`[data-board-card]`):null,r={};t.querySelectorAll(Je).forEach(e=>{r[Xe(e)]=e.scrollTop}),We({focusId:n?.dataset.boardCard??``,scroll:r})}},[e]),(0,Q.useLayoutEffect)(()=>{let t=Ge();!t||!s||!E.length||(Ke(),e.current?.querySelectorAll(Je).forEach(e=>{let n=Xe(e);n in t.scroll&&(e.scrollTop=t.scroll[n])}),E.includes(t.focusId)&&(g(t.focusId),requestAnimationFrame(()=>{(async()=>{((w.current?await w.current(t.focusId):null)??Ye(e.current,t.focusId))?.focus({preventScroll:!0})})()})))},[E,s,e]);let z=_?Math.min(_.total,_.total-Math.min(_.total,n.length)+1):0;return{actions:p,handlers:F,activeId:D,focusCard:O,triage:_?{..._,index:z}:null,startTriage:I,exitTriage:L,bindings:m}}var et=Object.freeze({approve:null,deny:null,retry:null}),tt=(0,Q.lazy)(()=>t(()=>import(`./WorkspacePicker-DsJ0_nq_.js`).then(e=>({default:e.WorkspacePicker})),__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]))),nt=(0,Q.lazy)(()=>t(()=>import(`./ManageProjectsDialog-CLskSna6.js`).then(e=>({default:e.ManageProjectsDialog})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,25,26,27,28,29,30,16,14,13,15,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,17,18,19,20,21,46]))),rt=`(min-width: 1280px)`;function it(e){let t=l(),{t:n}=i();return(0,Q.useEffect)(()=>(document.title=`${n(`board:page.title`)} · ${R}`,()=>{document.title=R}),[n]),(0,$.jsx)(at,{...e,phone:t},t?`phone`:`desktop`)}function at({activeSessionId:e,onOpenSession:t,onOpenHistory:n,sessionHref:r,notify:a,requestConfirm:l,requestText:u,onNewTask:d,phone:f}){let{t:p}=i(),m=s(`overview-card`).placed,h=c(rt),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=_e({doneWindow:`today`}),y=de(),b=ue(e=>e.collapsed),C=je(),w=(0,Q.useRef)(null),E=(0,Q.useRef)(null),k=he(),j=D(v.projects),M=y.collapsedLanes.includes(`done`),N=(0,Q.useMemo)(()=>x(v.all,{now:k,groupBy:y.groupBy,capabilities:v.capabilities,lanes:y.lanes,projects:y.projects,projectOrder:j,doneCollapsed:M}),[v.all,v.capabilities,M,k,j,y.groupBy,y.lanes,y.projects]),P=(0,Q.useMemo)(()=>new Map(j.map(e=>[e.key,e])),[j]),I=N.counts.attention+N.counts.running>0,L=fe(I),R=!v.isLoading&&!(v.error&&v.total===0),z=(0,Q.useMemo)(()=>{let e=[];for(let t of N.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`&&M)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},[M,N.sections]),B=N.order.length,V=T(B),te=(0,Q.useRef)(-1),H=ke({count:V?z.length:0,getScrollElement:()=>E.current,estimateSize:e=>z[e]?.kind===`row`?64:40,overscan:8,getItemKey:e=>z[e]?.key??e,rangeExtractor:e=>{let t=Oe(e),n=te.current;return n<0||n>=e.count||t.includes(n)?t:[...t,n].sort((e,t)=>e-t)}}),re=(0,Q.useCallback)(async e=>{let t=()=>w.current?.querySelector(`[data-board-card="${CSS.escape(e)}"]`)??null;if(!V||t())return t();let n=z.findIndex(t=>t.kind===`row`&&t.key===e);if(n<0)return null;H.scrollToIndex(n,{align:`auto`});for(let e=0;e<3&&!t();e+=1)await new Promise(e=>requestAnimationFrame(()=>e()));return t()},[z,V,H]),U=$e({rootRef:w,order:N.order,attention:N.attention,attentionAll:N.attentionAll,onRevealAttention:y.clearFilters,reveal:re,ready:!v.isLoading,notify:a,sessionHref:r,onOpenSession:t,onToggleGrouping:()=>y.setGroupBy(y.groupBy===`lane`?`project`:`lane`)});te.current=V?z.findIndex(e=>e.kind===`row`&&e.key===U.activeId):-1;let ie=O({notify:a,requestText:u,onOpenSession:U.handlers.onOpen}),[ae,oe]=(0,Q.useState)(``),se=U.focusCard,ce=(0,Q.useRef)(N.order);ce.current=N.order;let K=(0,Q.useRef)(N.attentionAll);K.current=N.attentionAll,(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.sessionId;if(t){if(ce.current.some(e=>e.id===t)){se(t);return}K.current.some(e=>e.id===t)&&(oe(t),de.getState().clearFilters())}};return window.addEventListener(S,e),()=>window.removeEventListener(S,e)},[se]),(0,Q.useEffect)(()=>{!ae||!N.order.some(e=>e.id===ae)||(oe(``),se(ae))},[se,N.order,ae]);let le=He({items:v.all,laneName:C.name,template:(0,Q.useCallback)((e,t)=>p(`board:announce.moved`,{title:e,lane:t}),[p]),separator:p(`board:sidebar.announceSeparator`),skipAttention:!0}),J=ee({notify:a,requestConfirm:l,requestText:u,onProjectChosen:d,announceChoice:!0}),[pe,me]=(0,Q.useState)(!1),[ge,ve]=(0,Q.useState)(!1),ye=De(e=>e.moveWorkspace),be=(0,Q.useMemo)(()=>N.sections.flatMap(e=>e.kind===`project`&&P.has(e.key)?[e.key]:[]),[N.sections,P]),xe=(0,Q.useMemo)(()=>({onNewTask:e=>{A.getState().rememberLaunch({cwd:e.cwd}),d()},onRename:e=>void J.rename(e),onResetName:e=>J.resetName(e),onMove:(e,t)=>ye(e.key,t,be),onManage:()=>{me(!0),ve(!0)},onDelete:e=>void J.remove(e)}),[J,ye,d,be]),{mounted:Se,...Ce}=J.picker,Y=U.bindings,we=(0,Q.useMemo)(()=>({approve:Y.boardApprove,deny:Y.boardDeny,retry:Y.boardRetry}),[Y.boardApprove,Y.boardDeny,Y.boardRetry]),X=U.triage,Ee=y.groupBy===`lane`,Z=e=>{let t=z[0]!==e;if(e.kind===`header`)return e.section.kind===`status`?(0,$.jsx)(lt,{spaced:t,lane:e.section.id,count:e.section.items.length,collapsed:e.section.id===`done`&&M,dimmed:!!X&&e.section.id!==`attention`,onToggle:e.section.id===`done`?()=>y.setLaneCollapsed(`done`,!M):void 0}):(0,$.jsx)(ut,{spaced:t,section:e.section,project:P.get(e.section.key),first:be[0]===e.section.key,last:be.at(-1)===e.section.key,actions:xe,deleting:!!J.busyKey});if(e.kind===`empty`)return(0,$.jsx)(`p`,{className:W(`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)(ze,{item:n,now:L,project:Ee?P.get(n.workspaceKey)?.label??``:``,active:n.id===U.activeId,dimmed:!!X&&n.lane!==`attention`,phase:e.phase,bindings:f?et:we,handlers:U.handlers,menu:ie,card:r,onStartNow:U.handlers.onStartNow});return r?(0,$.jsx)(`div`,{className:`py-1`,children:i}):i},Ae;Ae=v.isLoading?(0,$.jsx)(Te,{kind:`loading`,title:p(`board:page.loading`)}):v.error&&v.total===0?(0,$.jsx)(Te,{kind:`error`,title:p(`board:page.error`),description:p(`board:page.errorHint`),action:(0,$.jsx)(G,{variant:`secondary`,onClick:()=>void v.refresh(),children:p(`board:page.retry`)})}):N.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)(G,{variant:`outline`,onClick:d,children:[(0,$.jsx)(F,{"aria-hidden":`true`}),p(`board:overview.newTask`)]}),!v.catalogEmpty&&(0,$.jsx)(ot,{onClick:n})]}):N.filteredEmpty?(0,$.jsx)(Te,{kind:`empty`,title:p(`board:filter.emptyTitle`),description:p(`board:filter.emptyHint`),action:(0,$.jsx)(G,{variant:`secondary`,onClick:y.clearFilters,children:p(`board:filter.clear`)})}):V?(0,$.jsx)(`div`,{"data-overview-list":!0,"data-virtual":!0,className:`relative w-full`,style:{height:H.getTotalSize()},children:H.getVirtualItems().map(e=>{let t=z[e.index];return t?(0,$.jsx)(`div`,{ref:H.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:N.sections.map(e=>{let t=e.kind===`status`?`status:${e.id}`:`project:${e.key}`,[n,...r]=z.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 Me=y.lanes.length>0||y.projects.length>0;return(0,$.jsxs)(`div`,{ref:w,"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:E,"data-overview-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-20`,children:(0,$.jsxs)(`div`,{className:W(`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?R&&N.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)(ne,{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`)}),R&&N.total>0&&(0,$.jsx)(st,{agents:N.total,projects:N.projectCount,running:N.running})]}),R&&N.total>0&&(0,$.jsx)(ne,{size:`default`,"aria-label":p(`board:group.label`),"aria-keyshortcuts":q(Y.boardToggleGrouping)||void 0,value:y.groupBy,onValueChange:y.setGroupBy,options:[{value:`lane`,label:p(`board:group.lane`)},{value:`project`,label:p(`board:group.project`)}]}),g===`popover`&&_(`popover`),R&&N.total>0&&(0,$.jsxs)(G,{variant:`outline`,onClick:d,children:[(0,$.jsx)(F,{"aria-hidden":`true`}),p(`board:overview.newTask`)]})]}),R&&Me&&(b||f)&&N.total>0&&(0,$.jsx)(ct,{lanes:y.lanes,projects:y.projects.map(e=>P.get(e)?.label??``).filter(Boolean),laneName:C.name,onClear:y.clearFilters}),Ae,R&&N.total>0&&!N.filteredEmpty&&(0,$.jsx)(`div`,{className:W(`mt-3 pl-1`,X&&`opacity-50`),children:(0,$.jsx)(ot,{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:W(`w-80 flex-none`,X&&`opacity-50`),children:_(`column`)})]})}),X&&(0,$.jsx)(dt,{index:X.index,total:X.total,finished:X.finished,answers:v.capabilities.askUser,keys:{approve:q(Y.boardApprove),deny:q(Y.boardDeny),retry:q(Y.boardRetry)},onExit:U.exitTriage}),(0,$.jsx)(`p`,{"aria-live":`polite`,role:`status`,className:`sr-only`,children:le}),Se&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(tt,{...Ce})}),pe&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(nt,{open:ge,onOpenChange:ve,commands:J})})]})}function ot({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)(f,{className:`size-3.5`,"aria-hidden":`true`})]})}function st({agents:e,projects:t,running:n}){let{t:r}=i(),[a,o]=(0,Q.useState)(!1),s=ve(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:X(s.data.todayTokens)}),s.data.memoryBytes===null?``:r(`board:overview.memory`,{memory:we(s.data.memoryBytes)})].filter(Boolean):[],l=s.isPending?r(`board:overview.systemLoading`):c.length?c.join(` · `):r(`board:overview.systemUnavailable`);return(0,$.jsx)(ie,{children:(0,$.jsxs)(ae,{open:a,onOpenChange:o,children:[(0,$.jsx)(re,{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)(U,{side:`bottom`,align:`start`,sideOffset:6,"data-overview-system":!0,children:l})]})})}function ct({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)(G,{variant:`ghost`,size:`xs`,onClick:r,children:[(0,$.jsx)(L,{"aria-hidden":`true`}),a(`board:filter.clear`)]})]})}function lt({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:W(`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)(h,{className:`size-3.5`,"aria-hidden":`true`}):(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`}))]}),f=W(`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:W(`m-0 transition-opacity duration-(--d-fast)`,e&&`mt-5`,a&&`opacity-50`),children:o?(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!r,className:W(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 ut({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:W(`flex h-9 min-w-0 items-center gap-2.5 pr-1 pl-3`,e&&`mt-6`),children:[(0,$.jsx)(j,{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)(Be,{project:n,first:r,last:a,deleting:s,actions:o})]})}function dt({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)(oe,{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)(G,{variant:`ghost`,size:`xs`,className:`-mr-1.5`,onClick:o,children:[(0,$.jsx)(oe,{children:`Esc`}),s(`board:triage.exit`)]})]})})}export{it as BoardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePicker-tsgOFkg0.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BWyVtWF9.js","assets/i18n-CHHZADSh.js","assets/vendor-router-CSN_DGvx.js","assets/index-CKGGgVei.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/check-2vYc6QaP.js","assets/triangle-alert-CE1q54ci.js","assets/button-CCcCN8tE.js","assets/vendor-ui-DvrYggeS.js","assets/dist-41X0pdUs.js","assets/utils-C8uzG5AZ.js","assets/dialog-CfgIErMS.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/alert-firawb0H.js","assets/ManageProjectsDialog-B694Yqbw.js","assets/arrow-down-CDGua-ue.js","assets/arrow-up-DST6-qVQ.js","assets/folder-plus-OPHZsJho.js","assets/pencil-U08v_vV9.js","assets/rotate-ccw-C0v8V77_.js","assets/trash-2-CNrPOoPR.js","assets/useSessionListQuery-B-MnlVs6.js","assets/query-Bj-DUNYq.js","assets/useQuery-DdcpUQhO.js","assets/startup-queries-B_DpfvaA.js","assets/mutation-CEbxdVYy.js","assets/api-DOHQjQrv.js","assets/abort-signal-f4JsiYKX.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-CLDMF6_P.js","assets/runtime-capabilities-4_ZwLBqF.js","assets/session-board-status-D2lpFPiI.js","assets/chat-api-tHFjf7aB.js","assets/session-organization-api-dGpPgiLe.js","assets/events-DV8PYjtk.js","assets/session-workspaces-BWTBYaGT.js","assets/session-questions-Cf-1g85h.js","assets/card-presentation-1oph2b8P.js","assets/workspace-order-store-Cw1fZTM7.js","assets/board-projects-Cm1I_eWA.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-BWyVtWF9.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{r as o,u as s}from"./placements-DBcA75II.js";import{i as c}from"./use-mobile-DauOEda6.js";import{t as l}from"./usePhoneShell-cDHpi_4q.js";import{t as u}from"./createLucideIcon-Cd-3GVxJ.js";import{t as d}from"./arrow-down-CDGua-ue.js";import{t as f}from"./arrow-right-DqLOhpA2.js";import{t as p}from"./arrow-up-DST6-qVQ.js";import{t as m}from"./chevron-down-CxtxIjiP.js";import{t as h}from"./chevron-right-C3t2Rckj.js";import{t as g}from"./corner-down-right--hxi-Ihy.js";import{t as _}from"./ellipsis-CfGKfbq6.js";import{_ as v,c as y,d as b,f as x,h as S,i as C,l as w,m as T,n as ee,o as E,r as D,t as O,u as k}from"./useSessionRowActions-C6dpdoDz.js";import{i as A,r as j}from"./useNewProjectPicker-q3Albbmn.js";import{t as M}from"./pin-CU0FG0lI.js";import{t as N}from"./plus-fQbSqB1n.js";import{t as P}from"./rotate-ccw-C0v8V77_.js";import{t as F}from"./square-pen-hYbjKh6A.js";import{t as I}from"./trash-2-CNrPOoPR.js";import{t as L}from"./x-07u4-129.js";import{t as R}from"./brand-DIEc3fK8.js";import{c as z,i as B,p as V,r as te,t as H}from"./dropdown-menu-CFIFNaKO.js";import{t as ne}from"./segmented-control-BlM_GKV6.js";import{i as re,n as U,r as ie,t as ae}from"./tooltip-D4MFbqcG.js";import{t as W}from"./utils-C8uzG5AZ.js";import{t as G}from"./button-CCcCN8tE.js";import{t as oe}from"./kbd-CAufZTkl.js";import{a as se,c as ce,g as K,n as le,t as q}from"./shortcuts-BheSJu4D.js";import{t as ue}from"./sidebar-store-0l_ZiIAA.js";import{c as de,l as J,n as fe,o as pe,s as me,t as he}from"./useNow-DlbPA2gp.js";import{r as ge}from"./session-questions-Cf-1g85h.js";import{n as _e,t as ve}from"./useFleetSystemInfo-rj18NGAd.js";import{c as ye,i as be,l as xe,n as Se,r as Ce,t as Y}from"./card-presentation-1oph2b8P.js";import{n as we,r as X}from"./format-DMJQzoZ7.js";import{n as Te}from"./PageState-Cz6vFMXv.js";import{t as Ee}from"./session-change-summary-api-IM8k3njh.js";import"./public-launch-WirHCXQ8.js";import{t as De}from"./workspace-order-store-Cw1fZTM7.js";import{n as Oe,t as ke}from"./esm-DCV8yILT.js";import{t as Z}from"./StatusGlyph-1KgitlUg.js";var Ae=u(`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 je(){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`)}}}var $=r();function Me({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 Ne({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:()=>Ee(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)(Me,{files:o.changedFiles,added:o.added||0,removed:o.removed||0})})}function Pe({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:W(`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:W(`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:W(`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 Fe(e){return e instanceof Element&&!!e.closest(`button, a, input, textarea, [role="menuitem"], [data-card-stop]`)}function Ie({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 Le(e){return e.split(`
3
+ `).map(e=>e.trim()).find(Boolean)??``}function Re({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`,_=e.approvals[0]??null,v=_?.severity===`critical`,x=pe(e),S=e.title||f(`navigation:shell.untitledSession`),C=()=>c.onOpen(e.id),T=`${e.lane}:${e.status}`,ee=(0,Q.useRef)(T);(0,Q.useLayoutEffect)(()=>{ee.current!==T&&(ee.current=T,p.current?.getAnimations?.().forEach(e=>e.cancel()))},[T]);let D=(0,Q.useRef)(!1),O=e=>{let t=D.current;D.current=!1,!(t||Fe(e.target))&&C()},A=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),C())},j=``;j=h?k(f,me(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 N=e.status===`approval`&&e.approvalsState===`ready`&&_?_.toolName||`—`:``,P=``,F=``;if(h&&e.since!==null)P=w(t-e.since),F=f(`board:overview.waited`,{wait:P});else if(e.lane===`running`){let n=e.startedAt??e.since;P=E(n===null?null:t-n),F=P?f(`board:overview.ran`,{time:P}):``}else e.lane===`done`&&(P=y(e.since),F=P?f(`board:overview.finishedAt`,{time:P}):``);let I=null,L=null,R=(0,$.jsxs)(G,{size:`sm`,tabIndex:m,onClick:C,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`||!_)I=(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=be(_.reason),n=v&&t?Ce(_.reason):``,r=_.toolName===`bash`&&_.command,i=_.command||_.path,a=i?``:Y(_),o=!i&&_.reason&&!t?_.reason:``,s=e.approvals.length-1,c=e.approvals.slice(1).some(e=>e.severity===`critical`),l=v?(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;I=(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[i?(0,$.jsx)(Pe,{text:i,prefix:r?`$`:``,variant:`plain`,tabIndex:m,lead:l}):a?(0,$.jsx)(Pe,{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(x.kind===`decide`&&_){let t=c.isPending(`approve`,e.id,_.id),n=c.isPending(`deny`,e.id,_.id);L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(G,{variant:`outline`,size:`sm`,tabIndex:m,disabled:t||n,loading:n,"aria-label":f(`board:sidebar.denyNamed`,{title:S}),"aria-keyshortcuts":q(s.deny)||void 0,onClick:()=>c.onDeny(e,_),children:[f(`board:card.deny`),(0,$.jsx)(Ie,{binding:s.deny})]}),(0,$.jsxs)(G,{size:`sm`,tabIndex:m,disabled:t||n,loading:t,"aria-label":f(`board:sidebar.approveNamed`,{title:S}),"aria-keyshortcuts":q(s.approve)||void 0,onClick:()=>c.onApprove(e,_),children:[f(`board:card.approve`),(0,$.jsx)(Ie,{binding:s.approve})]})]})}else L=R}else if(e.status===`question`){let t=e.question,n=ge(t),r=t?c.isPending(`answer`,e.id,t.id):!1,i=t?.questions[0];I=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)(G,{variant:`outline`,size:`sm`,tabIndex:m,disabled:r,"data-question-pill":t,"aria-label":f(`board:question.answerNamed`,{title:S,option:t}),"aria-keyshortcuts":String(n+1),className:W(`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)(G,{variant:`ghost`,size:`sm`,tabIndex:m,className:W(`h-auto min-h-7`,d&&`min-h-11`),onClick:C,children:f(`board:question.other`)})]})]}):null,L=n?null:R}else if(e.status===`failed`&&h){let t=Le(e.error)||[...e.tail].reverse().find(ye)?.trim()||``,n=c.isPending(`retry`,e.id);I=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,L=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{variant:`outline`,size:`sm`,tabIndex:m,onClick:C,children:f(`board:overview.log`)}),(0,$.jsxs)(G,{size:`sm`,tabIndex:m,loading:n,disabled:n,"aria-label":f(`board:overview.retryNamed`,{title:S}),"aria-keyshortcuts":q(s.retry)||void 0,onClick:()=>c.onRetry(e),children:[f(`board:card.retry`),(0,$.jsx)(Ie,{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)?w(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)&&(I=(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)(g,{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`);I=(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&&(L=(0,$.jsx)(G,{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=Le(e.preview);I=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=xe(e);L=n?(0,$.jsx)(Me,{...n}):e.changeStats?null:(0,$.jsx)(Ne,{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:S,status:j}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{D.current=Fe(e.target)},onClick:O,onKeyDown:A,className:W(`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)(Z,{status:Se(e),phase:o})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`p`,{className:`min-w-0 truncate text-base leading-5 font-medium text-content`,children:S}),(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:[j,N&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:N})]})]}),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:[P&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:`text-xs text-content-muted tabular-nums`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:P}),(0,$.jsx)(`span`,{className:`sr-only`,children:F})]}),(0,$.jsx)(b,{row:{id:e.id,title:S,pinned:e.pinned},actions:l,canMarkHandled:e.status===`failed`,align:`end`,tabIndex:m,className:`size-11`})]})]}),I&&(0,$.jsx)(`div`,{className:`min-w-0 pl-[26px]`,children:I}),L&&(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:L})]}):(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:S,status:j}),"aria-keyshortcuts":`Enter`,onFocus:t=>{(t.target===t.currentTarget||t.currentTarget.contains(t.target))&&c.onFocusCard(e.id)},onPointerDownCapture:e=>{D.current=Fe(e.target)},onClick:O,onKeyDown:A,className:W(`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)(Z,{status:Se(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:[(0,$.jsx)(`span`,{className:W(`min-w-0 truncate text-base font-medium`,e.lane===`done`?`text-content-secondary`:`text-content`),children:S}),(0,$.jsxs)(`span`,{"data-row-status":!0,className:W(`flex-none text-xs`,h?`text-warning-strong`:`text-content-muted`),children:[j,N&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`b`,{"data-row-tool":!0,className:`font-mono font-medium`,children:N})]})]}),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)(M,{className:`size-3 flex-none self-center text-content-muted`,strokeWidth:1.75,role:`img`,"aria-label":f(`board:card.pinned`)})]}),I]}),(0,$.jsxs)(`div`,{className:`flex min-h-[30px] items-center gap-2 self-start`,children:[L&&(0,$.jsx)(`div`,{className:`flex items-center gap-1.5`,children:L}),(0,$.jsxs)(`div`,{className:W(`relative flex min-h-[30px] items-center justify-end pointer-coarse:gap-2`,!P&&`min-w-[26px]`),children:[P&&(0,$.jsxs)(`span`,{"data-row-time":!0,className:W(`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:P}),(0,$.jsx)(`span`,{className:`sr-only`,children:F})]}),(0,$.jsx)(b,{row:{id:e.id,title:S,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 ze=(0,Q.memo)(Re);function Be({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)(H,{children:[(0,$.jsx)(V,{asChild:!0,children:(0,$.jsx)(G,{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)(_,{"aria-hidden":`true`})})}),(0,$.jsxs)(te,{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)(B,{onSelect:()=>s.current=()=>a.onNewTask(e),children:[(0,$.jsx)(N,{"aria-hidden":`true`}),o(`board:project.newTaskHere`)]}),(0,$.jsxs)(B,{onSelect:()=>a.onRename(e),children:[(0,$.jsx)(Ae,{"aria-hidden":`true`}),o(`board:project.rename`)]}),e.custom&&(0,$.jsxs)(B,{onSelect:()=>a.onResetName(e),children:[(0,$.jsx)(P,{"aria-hidden":`true`}),o(`board:project.resetName`)]})]}),(0,$.jsxs)(B,{disabled:t,onSelect:()=>a.onMove(e,-1),children:[(0,$.jsx)(p,{"aria-hidden":`true`}),o(`board:project.moveUpShort`)]}),(0,$.jsxs)(B,{disabled:n,onSelect:()=>a.onMove(e,1),children:[(0,$.jsx)(d,{"aria-hidden":`true`}),o(`board:project.moveDownShort`)]}),(0,$.jsxs)(B,{onSelect:()=>s.current=a.onManage,children:[(0,$.jsx)(v,{"aria-hidden":`true`}),o(`board:project.manage`)]}),(0,$.jsx)(z,{}),(0,$.jsxs)(B,{variant:`destructive`,disabled:r,onSelect:()=>a.onDelete(e),children:[(0,$.jsx)(I,{"aria-hidden":`true`}),o(`board:project.delete`)]})]})]})}var Ve=1200;function He({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))},Ve))},[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 Ue=null;function We(e){Ue=e}function Ge(){return Ue}function Ke(){Ue=null}var qe=1600,Je=`[data-overview-scroller]`;function Ye(e,t){return e?.querySelector(`[data-board-card="${CSS.escape(t)}"]`)??null}function Xe(e){return e.dataset.overviewScroller===void 0?`other`:`overview`}function Ze(e){let t=pe(e);return t.kind===`decide`?e.approvals.find(e=>e.id===t.approvalId)??null:null}function Qe(){return new Promise(e=>requestAnimationFrame(()=>e()))}function $e({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=J(),m=ce(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 w=(0,Q.useRef)(o);w.current=o;let[T,ee]=(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 Qe();let n=(w.current?await w.current(t):null)??Ye(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(Je).forEach(e=>{n[Xe(e)]=e.scrollTop}),We({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=>C(Ye(e.current,t),{duration:180,scale:.9}),[e]),N=(0,Q.useCallback)(t=>Ye(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||!ge(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||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){ee(!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)(()=>{!T||n.length<r.length||(ee(!1),I())},[n.length,r.length,I,T]);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),qe);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(se(t)||le(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`?ge(s.question)?.[Number(t.key)-1]:void 0,l=!0;if(t.key===`Escape`&&_)L();else if(K(t,m.boardNext)||i&&a&&t.key===`ArrowDown`)R(1);else if(K(t,m.boardPrevious)||i&&a&&t.key===`ArrowUp`)R(-1);else if(K(t,m.boardToggleGrouping))d();else if(K(t,m.boardTriage))_?L():I();else if(o&&K(t,m.boardApprove)&&s?.status===`approval`){let e=Ze(s);e&&F.onApprove(s,e)}else if(o&&K(t,m.boardDeny)&&s?.status===`approval`){let e=Ze(s);e&&F.onDeny(s,e)}else o&&K(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||Ge())return;let e=document.activeElement,n=e instanceof HTMLElement&&t.contains(e)?e.closest(`[data-board-card]`):null,r={};t.querySelectorAll(Je).forEach(e=>{r[Xe(e)]=e.scrollTop}),We({focusId:n?.dataset.boardCard??``,scroll:r})}},[e]),(0,Q.useLayoutEffect)(()=>{let t=Ge();!t||!s||!E.length||(Ke(),e.current?.querySelectorAll(Je).forEach(e=>{let n=Xe(e);n in t.scroll&&(e.scrollTop=t.scroll[n])}),E.includes(t.focusId)&&(g(t.focusId),requestAnimationFrame(()=>{(async()=>{((w.current?await w.current(t.focusId):null)??Ye(e.current,t.focusId))?.focus({preventScroll:!0})})()})))},[E,s,e]);let z=_?Math.min(_.total,_.total-Math.min(_.total,n.length)+1):0;return{actions:p,handlers:F,activeId:D,focusCard:O,triage:_?{..._,index:z}:null,startTriage:I,exitTriage:L,bindings:m}}var et=Object.freeze({approve:null,deny:null,retry:null}),tt=(0,Q.lazy)(()=>t(()=>import(`./WorkspacePicker-tsgOFkg0.js`).then(e=>({default:e.WorkspacePicker})),__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]))),nt=(0,Q.lazy)(()=>t(()=>import(`./ManageProjectsDialog-B694Yqbw.js`).then(e=>({default:e.ManageProjectsDialog})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,25,26,27,28,29,30,16,14,13,15,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,17,18,19,20,21,48,49]))),rt=`(min-width: 1280px)`;function it(e){let t=l(),{t:n}=i();return(0,Q.useEffect)(()=>(document.title=`${n(`board:page.title`)} · ${R}`,()=>{document.title=R}),[n]),(0,$.jsx)(at,{...e,phone:t},t?`phone`:`desktop`)}function at({activeSessionId:e,onOpenSession:t,onOpenHistory:n,sessionHref:r,notify:a,requestConfirm:l,requestText:u,onNewTask:d,phone:f}){let{t:p}=i(),m=s(`overview-card`).placed,h=c(rt),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=_e({doneWindow:`today`}),y=de(),b=ue(e=>e.collapsed),C=je(),w=(0,Q.useRef)(null),E=(0,Q.useRef)(null),k=he(),A=D(v.projects),M=y.collapsedLanes.includes(`done`),N=(0,Q.useMemo)(()=>x(v.all,{now:k,groupBy:y.groupBy,capabilities:v.capabilities,lanes:y.lanes,projects:y.projects,projectOrder:A,doneCollapsed:M}),[v.all,v.capabilities,M,k,A,y.groupBy,y.lanes,y.projects]),P=(0,Q.useMemo)(()=>new Map(A.map(e=>[e.key,e])),[A]),I=N.counts.attention+N.counts.running>0,L=fe(I),R=!v.isLoading&&!(v.error&&v.total===0),z=(0,Q.useMemo)(()=>{let e=[];for(let t of N.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`&&M)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},[M,N.sections]),B=N.order.length,V=T(B),te=(0,Q.useRef)(-1),H=ke({count:V?z.length:0,getScrollElement:()=>E.current,estimateSize:e=>z[e]?.kind===`row`?64:40,overscan:8,getItemKey:e=>z[e]?.key??e,rangeExtractor:e=>{let t=Oe(e),n=te.current;return n<0||n>=e.count||t.includes(n)?t:[...t,n].sort((e,t)=>e-t)}}),re=(0,Q.useCallback)(async e=>{let t=()=>w.current?.querySelector(`[data-board-card="${CSS.escape(e)}"]`)??null;if(!V||t())return t();let n=z.findIndex(t=>t.kind===`row`&&t.key===e);if(n<0)return null;H.scrollToIndex(n,{align:`auto`});for(let e=0;e<3&&!t();e+=1)await new Promise(e=>requestAnimationFrame(()=>e()));return t()},[z,V,H]),U=$e({rootRef:w,order:N.order,attention:N.attention,attentionAll:N.attentionAll,onRevealAttention:y.clearFilters,reveal:re,ready:!v.isLoading,notify:a,sessionHref:r,onOpenSession:t,onToggleGrouping:()=>y.setGroupBy(y.groupBy===`lane`?`project`:`lane`)});te.current=V?z.findIndex(e=>e.kind===`row`&&e.key===U.activeId):-1;let ie=O({notify:a,requestText:u,onOpenSession:U.handlers.onOpen}),[ae,oe]=(0,Q.useState)(``),se=U.focusCard,ce=(0,Q.useRef)(N.order);ce.current=N.order;let K=(0,Q.useRef)(N.attentionAll);K.current=N.attentionAll,(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.sessionId;if(t){if(ce.current.some(e=>e.id===t)){se(t);return}K.current.some(e=>e.id===t)&&(oe(t),de.getState().clearFilters())}};return window.addEventListener(S,e),()=>window.removeEventListener(S,e)},[se]),(0,Q.useEffect)(()=>{!ae||!N.order.some(e=>e.id===ae)||(oe(``),se(ae))},[se,N.order,ae]);let le=He({items:v.all,laneName:C.name,template:(0,Q.useCallback)((e,t)=>p(`board:announce.moved`,{title:e,lane:t}),[p]),separator:p(`board:sidebar.announceSeparator`),skipAttention:!0}),J=ee({notify:a,requestConfirm:l,requestText:u,onProjectChosen:d,announceChoice:!0}),[pe,me]=(0,Q.useState)(!1),[ge,ve]=(0,Q.useState)(!1),ye=De(e=>e.moveWorkspace),be=(0,Q.useMemo)(()=>N.sections.flatMap(e=>e.kind===`project`&&P.has(e.key)?[e.key]:[]),[N.sections,P]),xe=(0,Q.useMemo)(()=>({onNewTask:e=>{j.getState().rememberLaunch({cwd:e.cwd}),d()},onRename:e=>void J.rename(e),onResetName:e=>J.resetName(e),onMove:(e,t)=>ye(e.key,t,be),onManage:()=>{me(!0),ve(!0)},onDelete:e=>void J.remove(e)}),[J,ye,d,be]),{mounted:Se,...Ce}=J.picker,Y=U.bindings,we=(0,Q.useMemo)(()=>({approve:Y.boardApprove,deny:Y.boardDeny,retry:Y.boardRetry}),[Y.boardApprove,Y.boardDeny,Y.boardRetry]),X=U.triage,Ee=y.groupBy===`lane`,Z=e=>{let t=z[0]!==e;if(e.kind===`header`)return e.section.kind===`status`?(0,$.jsx)(lt,{spaced:t,lane:e.section.id,count:e.section.items.length,collapsed:e.section.id===`done`&&M,dimmed:!!X&&e.section.id!==`attention`,onToggle:e.section.id===`done`?()=>y.setLaneCollapsed(`done`,!M):void 0}):(0,$.jsx)(ut,{spaced:t,section:e.section,project:P.get(e.section.key),first:be[0]===e.section.key,last:be.at(-1)===e.section.key,actions:xe,deleting:!!J.busyKey});if(e.kind===`empty`)return(0,$.jsx)(`p`,{className:W(`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)(ze,{item:n,now:L,project:Ee?P.get(n.workspaceKey)?.label??``:``,active:n.id===U.activeId,dimmed:!!X&&n.lane!==`attention`,phase:e.phase,bindings:f?et:we,handlers:U.handlers,menu:ie,card:r,onStartNow:U.handlers.onStartNow});return r?(0,$.jsx)(`div`,{className:`py-1`,children:i}):i},Ae;Ae=v.isLoading?(0,$.jsx)(Te,{kind:`loading`,title:p(`board:page.loading`)}):v.error&&v.total===0?(0,$.jsx)(Te,{kind:`error`,title:p(`board:page.error`),description:p(`board:page.errorHint`),action:(0,$.jsx)(G,{variant:`secondary`,onClick:()=>void v.refresh(),children:p(`board:page.retry`)})}):N.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)(G,{variant:`outline`,onClick:d,children:[(0,$.jsx)(F,{"aria-hidden":`true`}),p(`board:overview.newTask`)]}),!v.catalogEmpty&&(0,$.jsx)(ot,{onClick:n})]}):N.filteredEmpty?(0,$.jsx)(Te,{kind:`empty`,title:p(`board:filter.emptyTitle`),description:p(`board:filter.emptyHint`),action:(0,$.jsx)(G,{variant:`secondary`,onClick:y.clearFilters,children:p(`board:filter.clear`)})}):V?(0,$.jsx)(`div`,{"data-overview-list":!0,"data-virtual":!0,className:`relative w-full`,style:{height:H.getTotalSize()},children:H.getVirtualItems().map(e=>{let t=z[e.index];return t?(0,$.jsx)(`div`,{ref:H.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:N.sections.map(e=>{let t=e.kind===`status`?`status:${e.id}`:`project:${e.key}`,[n,...r]=z.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 Me=y.lanes.length>0||y.projects.length>0;return(0,$.jsxs)(`div`,{ref:w,"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:E,"data-overview-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-20`,children:(0,$.jsxs)(`div`,{className:W(`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?R&&N.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)(ne,{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`)}),R&&N.total>0&&(0,$.jsx)(st,{agents:N.total,projects:N.projectCount,running:N.running})]}),R&&N.total>0&&(0,$.jsx)(ne,{size:`default`,"aria-label":p(`board:group.label`),"aria-keyshortcuts":q(Y.boardToggleGrouping)||void 0,value:y.groupBy,onValueChange:y.setGroupBy,options:[{value:`lane`,label:p(`board:group.lane`)},{value:`project`,label:p(`board:group.project`)}]}),g===`popover`&&_(`popover`),R&&N.total>0&&(0,$.jsxs)(G,{variant:`outline`,onClick:d,children:[(0,$.jsx)(F,{"aria-hidden":`true`}),p(`board:overview.newTask`)]})]}),R&&Me&&(b||f)&&N.total>0&&(0,$.jsx)(ct,{lanes:y.lanes,projects:y.projects.map(e=>P.get(e)?.label??``).filter(Boolean),laneName:C.name,onClear:y.clearFilters}),Ae,R&&N.total>0&&!N.filteredEmpty&&(0,$.jsx)(`div`,{className:W(`mt-3 pl-1`,X&&`opacity-50`),children:(0,$.jsx)(ot,{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:W(`w-80 flex-none`,X&&`opacity-50`),children:_(`column`)})]})}),X&&(0,$.jsx)(dt,{index:X.index,total:X.total,finished:X.finished,answers:v.capabilities.askUser,keys:{approve:q(Y.boardApprove),deny:q(Y.boardDeny),retry:q(Y.boardRetry)},onExit:U.exitTriage}),(0,$.jsx)(`p`,{"aria-live":`polite`,role:`status`,className:`sr-only`,children:le}),Se&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(tt,{...Ce})}),pe&&(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(nt,{open:ge,onOpenChange:ve,commands:J})})]})}function ot({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)(f,{className:`size-3.5`,"aria-hidden":`true`})]})}function st({agents:e,projects:t,running:n}){let{t:r}=i(),[a,o]=(0,Q.useState)(!1),s=ve(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:X(s.data.todayTokens)}),s.data.memoryBytes===null?``:r(`board:overview.memory`,{memory:we(s.data.memoryBytes)})].filter(Boolean):[],l=s.isPending?r(`board:overview.systemLoading`):c.length?c.join(` · `):r(`board:overview.systemUnavailable`);return(0,$.jsx)(ie,{children:(0,$.jsxs)(ae,{open:a,onOpenChange:o,children:[(0,$.jsx)(re,{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)(U,{side:`bottom`,align:`start`,sideOffset:6,"data-overview-system":!0,children:l})]})})}function ct({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)(G,{variant:`ghost`,size:`xs`,onClick:r,children:[(0,$.jsx)(L,{"aria-hidden":`true`}),a(`board:filter.clear`)]})]})}function lt({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:W(`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)(h,{className:`size-3.5`,"aria-hidden":`true`}):(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`}))]}),f=W(`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:W(`m-0 transition-opacity duration-(--d-fast)`,e&&`mt-5`,a&&`opacity-50`),children:o?(0,$.jsx)(`button`,{type:`button`,"aria-expanded":!r,className:W(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 ut({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:W(`flex h-9 min-w-0 items-center gap-2.5 pr-1 pl-3`,e&&`mt-6`),children:[(0,$.jsx)(A,{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)(Be,{project:n,first:r,last:a,deleting:s,actions:o})]})}function dt({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)(oe,{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)(G,{variant:`ghost`,size:`xs`,className:`-mr-1.5`,onClick:o,children:[(0,$.jsx)(oe,{children:`Esc`}),s(`board:triage.exit`)]})]})})}export{it as BoardPage};
@@ -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-BIJtH0nB.js";import{t as i}from"./api-DxQIocGp.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./external-link-CEQqPcqc.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{n as l,t as u}from"./send-QxBfLFo-.js";import{t as d}from"./message-square-SKjZyY3v.js";import{t as f}from"./plus-fQbSqB1n.js";import{t as p}from"./refresh-cw-TbWxTY4K.js";import{t as m}from"./shield-check-Gvek4RJ7.js";import{t as h}from"./trash-2-CNrPOoPR.js";import{t as g}from"./triangle-alert-CE1q54ci.js";import{t as ee}from"./x-07u4-129.js";import"./brand-DIEc3fK8.js";import{t as _}from"./more-pages-D_PnxLN0.js";import{t as v}from"./utils-C8uzG5AZ.js";import{n as y,t as b}from"./button-CCcCN8tE.js";import{s as x}from"./shortcuts-DWF7_dCu.js";import{a as S}from"./format-DMJQzoZ7.js";import{n as C,t as w}from"./PageState-Cz6vFMXv.js";import{t as T}from"./input-CPw-zkYh.js";import{n as E,r as D,t as O}from"./input-group-CDEyjyK4.js";import{a as k,i as A,n as j,o as te,r as M,s as N,t as ne}from"./FeaturePage-RH3fTWIk.js";import{t as P}from"./field-DaxtcBBA.js";import{t as F}from"./StatusGlyph-1KgitlUg.js";import{a as I,n as L,s as R}from"./app-primitives-Drz_SjnR.js";import{t as z}from"./AppSelect-BGVBQRP1.js";var re=a(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),B=e(t(),1),V=n(),H=Object.entries({feishu:{Icon:o},weixin:{Icon:l},qq:{Icon:l},telegram:{Icon:u}}),U=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft py-1.5 text-sm first:border-t-0 [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`,W=`grid min-w-0 gap-1.5 border-t border-stroke-soft py-3 @min-[600px]/page:grid-cols-[168px_minmax(0,1fr)] @min-[600px]/page:items-center @min-[600px]/page:gap-4`,G=`text-sm font-medium text-content`,ie=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,K=`modal max-h-[calc(100dvh_-_40px)] w-[min(470px,100%)] overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,q=`border border-stroke-soft bg-surface-subtle text-content-secondary [&_strong]:text-content [&>svg]:mt-0.5 [&>svg]:shrink-0`;function J(e,t){return t(e===`feishu`?`channels:channelsPage.feishu`:e===`weixin`?`channels:channelsPage.weChat`:e===`qq`?`channels:channelsPage.qq`:`channels:channelsPage.telegram`)}function ae(e,t){return t(e===`feishu`?`channels:channelsPage.feishuAppBot`:e===`weixin`?`channels:channelsPage.weChat`:e===`qq`?`channels:channelsPage.qqBot`:`channels:channelsPage.telegramBot`)}function oe(e,t){return t(e===`feishu`?`channels:channelsPage.webSocketPersistentConnection`:e===`weixin`?`channels:channelsPage.tencentILinkPersistentConnection`:e===`qq`?`channels:channelsPage.qqPersistentConnection`:`channels:channelsPage.telegramPersistentConnection`)}function Y(e,t){return t(e===`feishu`?`channels:channelsPage.feishuCapabilities`:e===`weixin`?`channels:channelsPage.weChatCapabilities`:e===`qq`?`channels:channelsPage.qqCapabilities`:`channels:channelsPage.telegramCapabilities`)}function X(e){return e===`telegram`}function se(e,t,n){return t?n(`channels:channelsPage.reconnectName`,{name:J(e,n)}):X(e)?n(`channels:channelsPage.configureName`,{name:J(e,n)}):n(`channels:channelsPage.connectNameByQRCode`,{name:J(e,n)})}function Z(e,t){return t(e===`connecting`?`channels:channelsPage.connecting`:e===`connected`?`channels:channelsPage.online`:e===`reconnecting`?`channels:channelsPage.reconnecting`:e===`failed`?`channels:channelsPage.connectionFailed`:`channels:channelsPage.notConnected`)}function ce(e,t){return t(e===`starting`?`channels:channelsPage.requestingLoginQrCode`:e===`waiting`?`channels:channelsPage.scanAndConfirmConnection`:e===`scanned`?`channels:channelsPage.scannedWaitingForConfirmation`:e===`verification_required`?`channels:channelsPage.enterPairingCode`:e===`authorizing`?`channels:channelsPage.confirmingAuthorization`:e===`connecting`?`channels:channelsPage.authorizationSucceededConnecting`:e===`completed`?`channels:channelsPage.channelConnected`:e===`failed`?`channels:channelsPage.connectionFailed`:`channels:channelsPage.cancelled`)}function le(e,t=`zh-CN`){let n=Math.max(0,Math.ceil((new Date(e).getTime()-Date.now())/1e3));return t===`en-US`?n>=60?`in ${Math.ceil(n/60)} min`:`in ${n} sec`:n>=60?`${Math.ceil(n/60)} 分钟后`:`${n} 秒后`}function Q(e){return e instanceof Error?e.message:String(e)}function ue({notify:e,onBack:t,requestConfirm:n}){let{t:a,language:o}=r(),[s,c]=(0,B.useState)({providers:[],connections:{feishu:null,weixin:null,qq:null,telegram:null},scopes:[],models:[]}),[m,g]=(0,B.useState)(!0),[ee,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(``),[x,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(``),[O,k]=(0,B.useState)(null),[M,N]=(0,B.useState)(``),[P,F]=(0,B.useState)(!1),[I,L]=(0,B.useState)(``),R=(0,B.useCallback)(async()=>{try{y(``);let e=await i(`/api/channels`);c(e),_(!0),x&&L(e.connections?.[x]?.defaultCwd||``)}catch(e){y(Q(e))}finally{g(!1)}},[x]);(0,B.useEffect)(()=>{R()},[R]),(0,B.useEffect)(()=>{if(!O?.id||[`completed`,`failed`,`cancelled`].includes(O.status))return;let t=O.id,n=window.setInterval(async()=>{try{let r=O.platform,o=await i(`/api/channels/${r}/onboarding/${encodeURIComponent(t)}`);k({...o,platform:r}),o.status===`completed`&&(window.clearInterval(n),e(a(`channels:channelsPage.nameTwoWayConnectionEstablished`,{name:J(r,a)})),await R(),window.setTimeout(()=>k(null),900))}catch(e){k(t=>t&&{...t,status:`failed`,error:Q(e)})}},1500);return()=>window.clearInterval(n)},[O?.id,O?.platform,O?.status,R,e,a]);let z=async e=>{if(!(s.connections?.[e]&&!await n({title:a(`channels:channelsPage.reconnectName`,{name:J(e,a)}),message:X(e)?a(`channels:channelsPage.configuringAgainWillReplaceTheCurrentNameConnectionContinue`,{name:J(e,a)}):a(`channels:channelsPage.scanningAgainWillReplaceTheCurrentNameConnectionContinue`,{name:J(e,a)}),confirmLabel:X(e)?a(`channels:channelsPage.continueConfiguration`):a(`channels:channelsPage.continueScanning`),tone:`primary`}))){N(e),k({platform:e,status:`starting`});try{let t=await i(`/api/channels/${e}/onboarding`,{method:`POST`,body:`{}`});`mode`in t&&t.mode===`manual`?k({...t,platform:e,status:`starting`,manual:!0}):k({...t,platform:e})}catch(t){k({platform:e,status:`failed`,error:Q(t)})}finally{N(``)}}},re=async()=>{O?.id&&![`completed`,`failed`,`cancelled`].includes(O.status)&&await i(`/api/channels/${O.platform}/onboarding/${encodeURIComponent(O.id)}`,{method:`DELETE`}).catch(()=>{}),k(null)},U=async(t,n,r)=>{F(!0);try{let a=await i(`/api/channels/${t}`,{method:`PATCH`,body:JSON.stringify(n)});c(a),L(a.connections?.[t]?.defaultCwd||``),e(r)}catch(t){e(Q(t),`error`)}finally{F(!1)}},W=async t=>{F(!0);try{c(await i(`/api/channels/${t}/reconnect`,{method:`POST`,body:`{}`})),e(a(`channels:channelsPage.nameReconnected`,{name:J(t,a)}))}catch(t){e(Q(t),`error`),R()}finally{F(!1)}},G=async t=>{if(await n({title:a(`channels:channelsPage.disconnectName`,{name:J(t,a)}),message:a(`channels:channelsPage.localCredentialsAndChatMappingsWillBeDeleted`),confirmLabel:a(`channels:channelsPage.disconnect`)}))try{await i(`/api/channels/${t}`,{method:`DELETE`}),await R(),e(a(`channels:channelsPage.nameDisconnected`,{name:J(t,a)}))}catch(t){e(Q(t),`error`)}},ie=async t=>{if(await n({title:a(`channels:channelsPage.resetChannelChat`),message:a(`channels:channelsPage.resetTheAppChatLinkedToScope`,{scope:t.title,app:`Pisper`}),confirmLabel:a(`channels:channelsPage.reset`)}))try{await i(`/api/channels/scopes/${encodeURIComponent(t.key)}`,{method:`DELETE`}),await R(),e(a(`channels:channelsPage.channelChatReset`))}catch(t){e(Q(t),`error`)}};if(m)return(0,V.jsx)($,{onBack:t,query:E,onQueryChange:D,children:(0,V.jsx)(C,{kind:`loading`,title:a(`channels:channelsPage.loadingChannels`)})});if(v&&!ee)return(0,V.jsx)($,{onBack:t,query:E,onQueryChange:D,children:(0,V.jsx)(C,{kind:`error`,title:a(`channels:channelsPage.loadFailed`),description:v,action:(0,V.jsx)(b,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{g(!0),R()},children:a(`common:pageTemplate.retry`)})})});let K=E.trim().toLocaleLowerCase(),q=H.filter(([e])=>`${ae(e,a)} ${J(e,a)}`.toLocaleLowerCase().includes(K)),Y=K?s.scopes.filter(e=>`${e.title} ${e.lastMessage||``} ${J(e.platform,a)}`.toLocaleLowerCase().includes(K)):s.scopes,Z=H.filter(([e])=>de(s.connections?.[e])===`disconnected`).length;return(0,V.jsxs)($,{onBack:t,query:E,onQueryChange:D,children:[v&&(0,V.jsx)(ne,{children:v}),(0,V.jsx)(te,{title:a(`channels:channelsPage.platforms`),count:H.length,meta:Z?(0,V.jsx)(`span`,{"data-channels-disconnected":!0,className:`font-medium text-st-attn`,children:a(`channels:channelsPage.disconnectedCount`,{count:Z})}):void 0,children:q.length?(0,V.jsx)(j,{children:q.map(([e,t])=>{let n=s.connections?.[e],r=x===e,i=t.Icon;return(0,V.jsx)(A,{"data-channel-platform":e,className:`channel-platform-card`,icon:(0,V.jsx)(i,{}),name:ae(e,a),description:oe(e,a),status:(0,V.jsx)(fe,{connection:n}),actions:(0,V.jsxs)(b,{variant:`secondary`,size:`sm`,className:`max-[650px]:min-w-11`,loading:M===e,disabled:M===e,title:se(e,!!n,a),onClick:()=>void z(e),children:[n?(0,V.jsx)(p,{}):(0,V.jsx)(f,{}),(0,V.jsx)(`span`,{className:`max-[650px]:sr-only`,children:se(e,!!n,a)})]}),expanded:r,onExpandedChange:t=>{T(t?e:``),t&&L(n?.defaultCwd||``)},toggleLabel:a(`channels:channelsPage.togglePlatformDetails`,{name:J(e,a)}),detail:r?(0,V.jsx)(pe,{platform:e,connection:n,models:s.models,cwd:I,saving:P,onCwdChange:L,onUpdate:U,onReconnect:W,onRemove:G}):null},e)})}):(0,V.jsx)(w,{compact:!0,title:a(`channels:channelsPage.noMatchingChannels`)})}),(0,V.jsx)(te,{title:a(`channels:channelsPage.channelChats`),count:s.scopes.length,description:a(`channels:channelsPage.onceConnectedMessagesFromSupportedChannelsWillArriveHereInPisper`),children:Y.length?(0,V.jsx)(j,{children:Y.map(e=>(0,V.jsx)(A,{"data-channel-scope":e.key,className:`route-row`,icon:e.platform===`feishu`?(0,V.jsx)(d,{}):e.platform===`telegram`?(0,V.jsx)(u,{}):(0,V.jsx)(l,{}),name:e.title,nameMeta:J(e.platform,a),description:e.lastMessage||a(`channels:channelsPage.noMessages`),meta:(0,V.jsxs)(`span`,{className:`truncate font-mono`,children:[e.model||a(`channels:channelsPage.defaultModel`),` · `,e.cwd]}),status:S(e.updatedAt,o),actions:(0,V.jsx)(b,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:a(`channels:channelsPage.resetChat`),"aria-label":`${a(`channels:channelsPage.resetChat`)}: ${e.title}`,onClick:()=>void ie(e),children:(0,V.jsx)(h,{})})},e.key))}):(0,V.jsx)(w,{title:s.scopes.length?a(`channels:channelsPage.noMatchingChats`):a(`channels:channelsPage.waitingForTheFirstReplyFromAfar`)})}),O&&(0,V.jsx)(me,{job:O,onClose:re,onRetry:()=>z(O.platform),onSubmitCredentials:async t=>{try{let n=await i(`/api/channels/${O.platform}/onboarding`,{method:`POST`,body:JSON.stringify(t)});`connections`in n?(c(n),k(null),e(a(`channels:channelsPage.nameTwoWayConnectionEstablished`,{name:J(O.platform,a)})),await R()):`mode`in n&&n.mode===`manual`?k({...n,platform:O.platform,status:`starting`,manual:!0}):k({...n,platform:O.platform,manual:n.mode===`manual`})}catch(e){k(t=>t&&{...t,status:`failed`,error:Q(e)})}},notify:e})]})}function $({onBack:e,query:t,onQueryChange:n,children:i}){let{t:a}=r(),o=x(`focusSearch`),s=a(`navigation:navigation.channels`);return(0,V.jsx)(M,{title:s,description:a(`channels:channelsPage.lede`),back:e&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:e},toolbar:(0,V.jsx)(N,{search:(0,V.jsx)(k,{id:_,value:t,onValueChange:n,placeholder:a(`channels:channelsPage.searchPlaceholder`),shortcut:o,clearLabel:a(`navigation:more.clearSearch`)})}),children:i})}function de(e){return e?e.enabled===!1?`paused`:e.status===`connected`?`live`:e.status===`connecting`||e.status===`reconnecting`?`busy`:`disconnected`:`none`}function fe({connection:e}){let{t}=r(),n=de(e),i=n===`none`?t(`channels:channelsPage.notConnected`):n===`paused`?t(`channels:channelsPage.paused`):n===`disconnected`?e?.status===`failed`?t(`channels:channelsPage.connectionFailed`):t(`channels:channelsPage.disconnected`):Z(e?.status||`idle`,t);return(0,V.jsxs)(`span`,{"data-channel-state":n,className:v(`inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap`,n===`disconnected`?`font-medium text-st-attn`:`text-content-secondary`),children:[n===`disconnected`?(0,V.jsx)(F,{status:`attention`,className:`size-3.5`}):n===`busy`?(0,V.jsx)(F,{status:`run`,className:`size-3.5`}):n===`live`?(0,V.jsx)(F,{status:`done`,className:`size-3.5`}):null,i]})}function pe({platform:e,connection:t,models:n,cwd:i,saving:a,onCwdChange:o,onUpdate:s,onReconnect:l,onRemove:u}){let{t:d,language:f}=r();return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,V.jsxs)(`dl`,{className:`rounded-[var(--r-md)] border border-stroke px-3 py-0.5`,children:[(0,V.jsxs)(`div`,{className:U,children:[(0,V.jsx)(`dt`,{children:d(`channels:channelsPage.twoWayCapability`)}),(0,V.jsx)(`dd`,{children:Y(e,d)})]}),(0,V.jsxs)(`div`,{className:U,children:[(0,V.jsx)(`dt`,{children:d(`channels:channelsPage.replyModel`)}),(0,V.jsx)(`dd`,{className:t?.replyModel?`font-mono`:void 0,children:t?.replyModel?`${t.replyModel.provider}/${t.replyModel.model}`:d(`channels:channelsPage.useApplicationDefaultModel`)})]})]}),t?(0,V.jsxs)(`section`,{className:`test-panel min-w-0`,"aria-label":d(`channels:channelsPage.nameSettings`,{name:J(e,d)}),children:[(0,V.jsxs)(`div`,{className:v(`channel-live-status flex min-w-0 items-center gap-2.5 py-2`,t.status),children:[(0,V.jsx)(fe,{connection:t}),(0,V.jsx)(`small`,{className:v(`min-w-0 truncate text-xs tabular-nums`,t.lastError?`text-content-secondary`:`text-content-muted`),children:t.lastError||(t.status===`connected`?d(`channels:channelsPage.connectedTime`,{time:S(t.connectedAt,f)}):d(`channels:channelsPage.establishingPersistentConnection`))})]}),(0,V.jsxs)(`div`,{className:`modal-toggle-row flex min-w-0 items-center justify-between gap-4 border-t border-stroke-soft py-3`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,V.jsx)(`strong`,{className:`text-sm font-medium text-content`,children:d(`channels:channelsPage.enableThisChannel`)}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:d(`channels:channelsPage.turnOffToDisconnectWhileKeepingSignInCredentials`)})]}),(0,V.jsx)(R,{value:t.enabled,disabled:a,ariaLabel:d(`channels:channelsPage.enableThisChannel`),onChange:t=>s(e,{enabled:t},d(t?`channels:channelsPage.channelEnabled`:`channels:channelsPage.channelPaused`))})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.replyModel`)}),(0,V.jsxs)(z,{value:t.replyModel?`${t.replyModel.provider}/${t.replyModel.model}`:``,onChange:t=>{let[n,...r]=t.target.value.split(`/`);s(e,{replyModel:t.target.value?{provider:n,model:r.join(`/`)}:null},d(`channels:channelsPage.channelReplyModelUpdated`))},children:[(0,V.jsx)(`option`,{value:``,children:d(`channels:channelsPage.useApplicationDefaultModel`)}),n.map(e=>(0,V.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.approvalMode`)}),(0,V.jsxs)(z,{value:t.executionMode,onChange:t=>s(e,{executionMode:t.target.value},d(`channels:channelsPage.approvalModeUpdated`)),children:[(0,V.jsx)(`option`,{value:`approval-required`,children:d(`channels:channelsPage.approvalRequired`)}),(0,V.jsx)(`option`,{value:`workspace-write`,children:d(`channels:channelsPage.workspaceWrite`)}),(0,V.jsx)(`option`,{value:`full-access`,children:d(`channels:channelsPage.fullAccess`)})]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.executionMode`)}),(0,V.jsxs)(z,{value:t.runMode,onChange:t=>s(e,{runMode:t.target.value},d(`channels:channelsPage.executionModeUpdated`)),children:[(0,V.jsx)(`option`,{value:`plan`,children:d(`channels:channelsPage.planMode`)}),(0,V.jsx)(`option`,{value:`goal`,children:d(`channels:channelsPage.goalMode`)}),(0,V.jsx)(`option`,{value:`team`,children:d(`channels:channelsPage.teamMode`)})]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.accessScope`)}),(0,V.jsxs)(z,{value:t.accessMode,onChange:t=>s(e,{accessMode:t.target.value===`all`?`all`:`owner`},d(`channels:channelsPage.accessScopeUpdated`)),children:[(0,V.jsx)(`option`,{value:`owner`,disabled:!t.ownerConfigured,children:d(`channels:channelsPage.qrCodeOwnerOnly`)}),(0,V.jsx)(`option`,{value:`all`,children:d(e===`feishu`?`channels:channelsPage.allMembersInTheCurrentTenant`:e===`weixin`?`channels:channelsPage.allWeChatUsersWhoMessageTheBot`:`channels:channelsPage.allUsersWhoMessageTheBot`)})]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.defaultWorkingDirectoryForNewChats`)}),(0,V.jsxs)(O,{className:`channel-setting-input max-[650px]:h-11`,children:[(0,V.jsx)(E,{children:(0,V.jsx)(c,{"aria-hidden":`true`})}),(0,V.jsx)(D,{className:`font-mono text-xs`,value:i,onChange:e=>o(e.target.value)}),(0,V.jsx)(E,{align:`inline-end`,children:(0,V.jsx)(b,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-9`,disabled:a||i===t.defaultCwd,onClick:()=>s(e,{defaultCwd:i},d(`channels:channelsPage.defaultWorkingDirectorySaved`)),children:d(`channels:channelsPage.save`)})})]})]}),(0,V.jsxs)(I,{className:v(`mt-1`,q),children:[(0,V.jsx)(m,{size:15}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:d(`channels:channelsPage.localSecurityBoundary`)}),(0,V.jsx)(`small`,{children:d(`channels:channelsPage.ownerOnlyAccessRespectsToolPermissionsAndExecutionMode`)})]})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-2 max-[650px]:[&>button]:h-11`,children:[(0,V.jsxs)(b,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>u(e),children:[(0,V.jsx)(re,{}),d(`channels:channelsPage.disconnect`)]}),(0,V.jsxs)(b,{variant:`secondary`,size:`sm`,onClick:()=>l(e),disabled:a,children:[(0,V.jsx)(p,{}),d(`channels:channelsPage.reconnect`)]})]})]}):(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:d(`channels:channelsPage.notConnectedHint`)})]})}function me({job:e,onClose:t,onRetry:n,onSubmitCredentials:a,notify:o}){let{t:c,language:l}=r(),[u,d]=(0,B.useState)(``),[h,_]=(0,B.useState)(``),[x,S]=(0,B.useState)(``),[C,w]=(0,B.useState)(``),[E,D]=(0,B.useState)(!1),O=[`completed`,`failed`,`cancelled`].includes(e.status),k=e.manual||X(e.platform)&&e.mode!==`qr`,A=e.platform===`qq`?!!(h.trim()&&(x.trim()||C.trim())):!!C.trim(),j=async()=>{if(A){D(!0);try{await a({...h.trim()?{appId:h.trim()}:{},...x.trim()?{appSecret:x.trim()}:{},...C.trim()?{token:C.trim()}:{}})}finally{D(!1)}}};return(0,V.jsx)(`div`,{className:ie,onMouseDown:e=>e.target===e.currentTarget&&t(),children:(0,V.jsxs)(`section`,{className:v(K,`feishu-onboard-modal`),children:[(0,V.jsxs)(L,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:c(k?`channels:channelsPage.configureName`:`channels:channelsPage.connectNameByQRCode`,{name:J(e.platform,c)})}),(0,V.jsx)(`p`,{children:e.platform===`feishu`?c(`channels:channelsPage.createTheBotAppThroughTheOfficialFeishuAuthorizationPage`):e.platform===`weixin`?c(`channels:channelsPage.signInToPersonalWeChatThroughTencentILinkBot`):e.platform===`qq`?c(`channels:channelsPage.scanWithQQToCreateOfficialBot`):c(`channels:channelsPage.enterBotCredentialsForName`,{name:J(e.platform,c)})})]}),(0,V.jsx)(b,{variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":c(`channels:channelsPage.closeDialog`),onClick:t,children:(0,V.jsx)(ee,{})})]}),k&&!e.id&&!O&&(0,V.jsxs)(`div`,{className:`mt-3.5 grid gap-2.5`,children:[e.platform===`qq`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(P,{variant:`control`,children:[c(`channels:channelsPage.qqAppId`),(0,V.jsx)(T,{value:h,onChange:e=>_(e.target.value)})]}),(0,V.jsxs)(P,{variant:`control`,children:[c(`channels:channelsPage.qqAppSecret`),(0,V.jsx)(T,{type:`password`,value:x,onChange:e=>S(e.target.value)})]}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:c(`channels:channelsPage.qqCredentialsOrToken`)})]}),(0,V.jsxs)(P,{variant:`control`,children:[c(`channels:channelsPage.botToken`),(0,V.jsx)(T,{type:`password`,value:C,onChange:e=>w(e.target.value)})]}),e.setupUrl&&(0,V.jsxs)(I,{className:v(q,`[&_a]:inline-flex [&_a]:items-center [&_a]:gap-1 [&_a]:text-xs [&_a]:text-content [&_a]:underline [&_a]:underline-offset-4`),children:[e.qrDataUrl&&(0,V.jsx)(`img`,{src:e.qrDataUrl,alt:c(`channels:channelsPage.openOfficialSetupQRCode`),className:`size-[120px] rounded-sm bg-[var(--lightbox-action-bg)] p-1`}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:c(`channels:channelsPage.officialSetupRequired`)}),(0,V.jsx)(`small`,{children:c(`channels:channelsPage.officialSetupInstructions`)}),(0,V.jsxs)(`a`,{href:e.setupUrl,target:`_blank`,rel:`noreferrer`,children:[c(`channels:channelsPage.openOfficialSetup`),(0,V.jsx)(s,{size:12})]})]})]}),(0,V.jsxs)(b,{className:`max-[650px]:h-11`,loading:E,disabled:!A||E,onClick:()=>void j(),children:[(0,V.jsx)(f,{}),c(`channels:channelsPage.connect`)]})]}),(!k||e.id||O)&&(0,V.jsxs)(`div`,{className:v(`feishu-qr-stage mt-3.5 flex min-h-[min(330px,52dvh)] flex-col items-center justify-center gap-2.5 rounded-md border border-stroke bg-surface-subtle p-4 text-center [&_img]:w-[248px] [&_img]:max-w-[86%] [&_img]:rounded-md [&_img]:border [&_img]:border-stroke [&_img]:bg-[var(--lightbox-action-bg)] [&_img]:p-2 [&_p]:max-w-[330px] [&_p]:text-xs [&_p]:leading-normal [&_p]:text-content-secondary [&_small]:text-xs [&_small]:text-content-muted [&_small]:tabular-nums [&_strong]:text-sm [&_strong]:font-medium [&.completed]:text-success [&.failed]:text-content-secondary`,e.status),children:[e.qrDataUrl?(0,V.jsx)(`img`,{src:e.qrDataUrl,alt:c(`channels:channelsPage.nameConnectionQRCode`,{name:J(e.platform,c)})}):e.status===`failed`?(0,V.jsx)(g,{className:`size-8`,strokeWidth:1.5}):(0,V.jsx)(y,{className:`size-7`}),(0,V.jsx)(`strong`,{children:k&&!e.id?c(`channels:channelsPage.enterBotCredentialsForName`,{name:J(e.platform,c)}):ce(e.status,c)}),e.error&&(0,V.jsx)(`p`,{children:e.error}),e.expireAt&&!O&&(0,V.jsx)(`small`,{children:c(`channels:channelsPage.qrCodeExpiresTime`,{time:le(e.expireAt,l)})})]}),e.needsVerifyCode&&(0,V.jsxs)(`div`,{className:`weixin-verify-code mt-2.5 grid grid-cols-[minmax(0,1fr)_auto] gap-2`,children:[(0,V.jsx)(T,{className:`font-mono tracking-[.08em] tabular-nums`,inputMode:`numeric`,value:u,onChange:e=>d(e.target.value.replace(/\D/g,``).slice(0,8)),placeholder:c(`channels:channelsPage.enterTheNumberShownOnYourPhone`)}),(0,V.jsx)(b,{className:`max-[650px]:h-11`,disabled:!u,onClick:async()=>{try{await i(`/api/channels/${e.platform}/onboarding/${encodeURIComponent(e.id||``)}/verify`,{method:`POST`,body:JSON.stringify({code:u})}),o(c(`channels:channelsPage.pairingCodeSubmitted`))}catch(e){o(Q(e),`error`)}},children:c(`channels:channelsPage.submitPairingCode`)})]}),e.qrUrl&&!O&&(0,V.jsx)(b,{asChild:!0,variant:`secondary`,className:`mt-2.5 w-full no-underline max-[650px]:h-11`,children:(0,V.jsxs)(`a`,{href:e.qrUrl,target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(s,{}),c(`channels:channelsPage.cannotScanOpenTheSignInLink`)]})}),(0,V.jsxs)(I,{className:q,children:[(0,V.jsx)(m,{size:15}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:c(`channels:channelsPage.persistentTwoWayConnection`)}),(0,V.jsx)(`small`,{children:e.platform===`feishu`?c(`channels:channelsPage.webSocketReceivesDirectMessagesAndGroupMentions`):e.platform===`weixin`?c(`channels:channelsPage.tencentILinkContinuouslyPollsDirectMessagesAndSupportsTextAndMediaReplies`):Y(e.platform,c)})]})]}),(0,V.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,V.jsx)(b,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:t,children:c(O?`channels:channelsPage.off`:`channels:channelsPage.cancel`)}),e.status===`failed`&&(0,V.jsxs)(b,{className:`max-[650px]:h-11`,onClick:n,children:[(0,V.jsx)(p,{}),c(k?`channels:channelsPage.retry`:`channels:channelsPage.generateANewQRCode`)]})]})]})})}export{ue as ChannelsPage};
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-BWyVtWF9.js";import{t as i}from"./api-DOHQjQrv.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./external-link-CEQqPcqc.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{n as l,t as u}from"./send-QxBfLFo-.js";import{t as d}from"./message-square-SKjZyY3v.js";import{t as f}from"./plus-fQbSqB1n.js";import{t as p}from"./refresh-cw-TbWxTY4K.js";import{t as m}from"./shield-check-Gvek4RJ7.js";import{t as h}from"./trash-2-CNrPOoPR.js";import{t as g}from"./triangle-alert-CE1q54ci.js";import{t as ee}from"./x-07u4-129.js";import"./brand-DIEc3fK8.js";import{t as _}from"./more-pages-D_PnxLN0.js";import{t as v}from"./utils-C8uzG5AZ.js";import{n as y,t as b}from"./button-CCcCN8tE.js";import{s as x}from"./shortcuts-BheSJu4D.js";import{a as S}from"./format-DMJQzoZ7.js";import{n as C,t as w}from"./PageState-Cz6vFMXv.js";import{t as T}from"./input-CPw-zkYh.js";import{i as E,n as D,t as O}from"./input-group-h8z63MzW.js";import{a as k,i as A,n as j,o as te,r as M,s as N,t as ne}from"./FeaturePage-Bh5TePxl.js";import{n as P}from"./field-DoLEb0np.js";import{t as F}from"./StatusGlyph-1KgitlUg.js";import{a as I,n as L,s as R}from"./app-primitives-Drz_SjnR.js";import{t as z}from"./AppSelect-BGVBQRP1.js";var re=a(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),B=e(t(),1),V=n(),H=Object.entries({feishu:{Icon:o},weixin:{Icon:l},qq:{Icon:l},telegram:{Icon:u}}),U=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft py-1.5 text-sm first:border-t-0 [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`,W=`grid min-w-0 gap-1.5 border-t border-stroke-soft py-3 @min-[600px]/page:grid-cols-[168px_minmax(0,1fr)] @min-[600px]/page:items-center @min-[600px]/page:gap-4`,G=`text-sm font-medium text-content`,ie=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,K=`modal max-h-[calc(100dvh_-_40px)] w-[min(470px,100%)] overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,q=`border border-stroke-soft bg-surface-subtle text-content-secondary [&_strong]:text-content [&>svg]:mt-0.5 [&>svg]:shrink-0`;function J(e,t){return t(e===`feishu`?`channels:channelsPage.feishu`:e===`weixin`?`channels:channelsPage.weChat`:e===`qq`?`channels:channelsPage.qq`:`channels:channelsPage.telegram`)}function ae(e,t){return t(e===`feishu`?`channels:channelsPage.feishuAppBot`:e===`weixin`?`channels:channelsPage.weChat`:e===`qq`?`channels:channelsPage.qqBot`:`channels:channelsPage.telegramBot`)}function oe(e,t){return t(e===`feishu`?`channels:channelsPage.webSocketPersistentConnection`:e===`weixin`?`channels:channelsPage.tencentILinkPersistentConnection`:e===`qq`?`channels:channelsPage.qqPersistentConnection`:`channels:channelsPage.telegramPersistentConnection`)}function Y(e,t){return t(e===`feishu`?`channels:channelsPage.feishuCapabilities`:e===`weixin`?`channels:channelsPage.weChatCapabilities`:e===`qq`?`channels:channelsPage.qqCapabilities`:`channels:channelsPage.telegramCapabilities`)}function X(e){return e===`telegram`}function se(e,t,n){return t?n(`channels:channelsPage.reconnectName`,{name:J(e,n)}):X(e)?n(`channels:channelsPage.configureName`,{name:J(e,n)}):n(`channels:channelsPage.connectNameByQRCode`,{name:J(e,n)})}function Z(e,t){return t(e===`connecting`?`channels:channelsPage.connecting`:e===`connected`?`channels:channelsPage.online`:e===`reconnecting`?`channels:channelsPage.reconnecting`:e===`failed`?`channels:channelsPage.connectionFailed`:`channels:channelsPage.notConnected`)}function ce(e,t){return t(e===`starting`?`channels:channelsPage.requestingLoginQrCode`:e===`waiting`?`channels:channelsPage.scanAndConfirmConnection`:e===`scanned`?`channels:channelsPage.scannedWaitingForConfirmation`:e===`verification_required`?`channels:channelsPage.enterPairingCode`:e===`authorizing`?`channels:channelsPage.confirmingAuthorization`:e===`connecting`?`channels:channelsPage.authorizationSucceededConnecting`:e===`completed`?`channels:channelsPage.channelConnected`:e===`failed`?`channels:channelsPage.connectionFailed`:`channels:channelsPage.cancelled`)}function le(e,t=`zh-CN`){let n=Math.max(0,Math.ceil((new Date(e).getTime()-Date.now())/1e3));return t===`en-US`?n>=60?`in ${Math.ceil(n/60)} min`:`in ${n} sec`:n>=60?`${Math.ceil(n/60)} 分钟后`:`${n} 秒后`}function Q(e){return e instanceof Error?e.message:String(e)}function ue({notify:e,onBack:t,requestConfirm:n}){let{t:a,language:o}=r(),[s,c]=(0,B.useState)({providers:[],connections:{feishu:null,weixin:null,qq:null,telegram:null},scopes:[],models:[]}),[m,g]=(0,B.useState)(!0),[ee,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(``),[x,T]=(0,B.useState)(``),[E,D]=(0,B.useState)(``),[O,k]=(0,B.useState)(null),[M,N]=(0,B.useState)(``),[P,F]=(0,B.useState)(!1),[I,L]=(0,B.useState)(``),R=(0,B.useCallback)(async()=>{try{y(``);let e=await i(`/api/channels`);c(e),_(!0),x&&L(e.connections?.[x]?.defaultCwd||``)}catch(e){y(Q(e))}finally{g(!1)}},[x]);(0,B.useEffect)(()=>{R()},[R]),(0,B.useEffect)(()=>{if(!O?.id||[`completed`,`failed`,`cancelled`].includes(O.status))return;let t=O.id,n=window.setInterval(async()=>{try{let r=O.platform,o=await i(`/api/channels/${r}/onboarding/${encodeURIComponent(t)}`);k({...o,platform:r}),o.status===`completed`&&(window.clearInterval(n),e(a(`channels:channelsPage.nameTwoWayConnectionEstablished`,{name:J(r,a)})),await R(),window.setTimeout(()=>k(null),900))}catch(e){k(t=>t&&{...t,status:`failed`,error:Q(e)})}},1500);return()=>window.clearInterval(n)},[O?.id,O?.platform,O?.status,R,e,a]);let z=async e=>{if(!(s.connections?.[e]&&!await n({title:a(`channels:channelsPage.reconnectName`,{name:J(e,a)}),message:X(e)?a(`channels:channelsPage.configuringAgainWillReplaceTheCurrentNameConnectionContinue`,{name:J(e,a)}):a(`channels:channelsPage.scanningAgainWillReplaceTheCurrentNameConnectionContinue`,{name:J(e,a)}),confirmLabel:X(e)?a(`channels:channelsPage.continueConfiguration`):a(`channels:channelsPage.continueScanning`),tone:`primary`}))){N(e),k({platform:e,status:`starting`});try{let t=await i(`/api/channels/${e}/onboarding`,{method:`POST`,body:`{}`});`mode`in t&&t.mode===`manual`?k({...t,platform:e,status:`starting`,manual:!0}):k({...t,platform:e})}catch(t){k({platform:e,status:`failed`,error:Q(t)})}finally{N(``)}}},re=async()=>{O?.id&&![`completed`,`failed`,`cancelled`].includes(O.status)&&await i(`/api/channels/${O.platform}/onboarding/${encodeURIComponent(O.id)}`,{method:`DELETE`}).catch(()=>{}),k(null)},U=async(t,n,r)=>{F(!0);try{let a=await i(`/api/channels/${t}`,{method:`PATCH`,body:JSON.stringify(n)});c(a),L(a.connections?.[t]?.defaultCwd||``),e(r)}catch(t){e(Q(t),`error`)}finally{F(!1)}},W=async t=>{F(!0);try{c(await i(`/api/channels/${t}/reconnect`,{method:`POST`,body:`{}`})),e(a(`channels:channelsPage.nameReconnected`,{name:J(t,a)}))}catch(t){e(Q(t),`error`),R()}finally{F(!1)}},G=async t=>{if(await n({title:a(`channels:channelsPage.disconnectName`,{name:J(t,a)}),message:a(`channels:channelsPage.localCredentialsAndChatMappingsWillBeDeleted`),confirmLabel:a(`channels:channelsPage.disconnect`)}))try{await i(`/api/channels/${t}`,{method:`DELETE`}),await R(),e(a(`channels:channelsPage.nameDisconnected`,{name:J(t,a)}))}catch(t){e(Q(t),`error`)}},ie=async t=>{if(await n({title:a(`channels:channelsPage.resetChannelChat`),message:a(`channels:channelsPage.resetTheAppChatLinkedToScope`,{scope:t.title,app:`Pisper`}),confirmLabel:a(`channels:channelsPage.reset`)}))try{await i(`/api/channels/scopes/${encodeURIComponent(t.key)}`,{method:`DELETE`}),await R(),e(a(`channels:channelsPage.channelChatReset`))}catch(t){e(Q(t),`error`)}};if(m)return(0,V.jsx)($,{onBack:t,query:E,onQueryChange:D,children:(0,V.jsx)(C,{kind:`loading`,title:a(`channels:channelsPage.loadingChannels`)})});if(v&&!ee)return(0,V.jsx)($,{onBack:t,query:E,onQueryChange:D,children:(0,V.jsx)(C,{kind:`error`,title:a(`channels:channelsPage.loadFailed`),description:v,action:(0,V.jsx)(b,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{g(!0),R()},children:a(`common:pageTemplate.retry`)})})});let K=E.trim().toLocaleLowerCase(),q=H.filter(([e])=>`${ae(e,a)} ${J(e,a)}`.toLocaleLowerCase().includes(K)),Y=K?s.scopes.filter(e=>`${e.title} ${e.lastMessage||``} ${J(e.platform,a)}`.toLocaleLowerCase().includes(K)):s.scopes,Z=H.filter(([e])=>de(s.connections?.[e])===`disconnected`).length;return(0,V.jsxs)($,{onBack:t,query:E,onQueryChange:D,children:[v&&(0,V.jsx)(ne,{children:v}),(0,V.jsx)(te,{title:a(`channels:channelsPage.platforms`),count:H.length,meta:Z?(0,V.jsx)(`span`,{"data-channels-disconnected":!0,className:`font-medium text-st-attn`,children:a(`channels:channelsPage.disconnectedCount`,{count:Z})}):void 0,children:q.length?(0,V.jsx)(j,{children:q.map(([e,t])=>{let n=s.connections?.[e],r=x===e,i=t.Icon;return(0,V.jsx)(A,{"data-channel-platform":e,className:`channel-platform-card`,icon:(0,V.jsx)(i,{}),name:ae(e,a),description:oe(e,a),status:(0,V.jsx)(fe,{connection:n}),actions:(0,V.jsxs)(b,{variant:`secondary`,size:`sm`,className:`max-[650px]:min-w-11`,loading:M===e,disabled:M===e,title:se(e,!!n,a),onClick:()=>void z(e),children:[n?(0,V.jsx)(p,{}):(0,V.jsx)(f,{}),(0,V.jsx)(`span`,{className:`max-[650px]:sr-only`,children:se(e,!!n,a)})]}),expanded:r,onExpandedChange:t=>{T(t?e:``),t&&L(n?.defaultCwd||``)},toggleLabel:a(`channels:channelsPage.togglePlatformDetails`,{name:J(e,a)}),detail:r?(0,V.jsx)(pe,{platform:e,connection:n,models:s.models,cwd:I,saving:P,onCwdChange:L,onUpdate:U,onReconnect:W,onRemove:G}):null},e)})}):(0,V.jsx)(w,{compact:!0,title:a(`channels:channelsPage.noMatchingChannels`)})}),(0,V.jsx)(te,{title:a(`channels:channelsPage.channelChats`),count:s.scopes.length,description:a(`channels:channelsPage.onceConnectedMessagesFromSupportedChannelsWillArriveHereInPisper`),children:Y.length?(0,V.jsx)(j,{children:Y.map(e=>(0,V.jsx)(A,{"data-channel-scope":e.key,className:`route-row`,icon:e.platform===`feishu`?(0,V.jsx)(d,{}):e.platform===`telegram`?(0,V.jsx)(u,{}):(0,V.jsx)(l,{}),name:e.title,nameMeta:J(e.platform,a),description:e.lastMessage||a(`channels:channelsPage.noMessages`),meta:(0,V.jsxs)(`span`,{className:`truncate font-mono`,children:[e.model||a(`channels:channelsPage.defaultModel`),` · `,e.cwd]}),status:S(e.updatedAt,o),actions:(0,V.jsx)(b,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:a(`channels:channelsPage.resetChat`),"aria-label":`${a(`channels:channelsPage.resetChat`)}: ${e.title}`,onClick:()=>void ie(e),children:(0,V.jsx)(h,{})})},e.key))}):(0,V.jsx)(w,{title:s.scopes.length?a(`channels:channelsPage.noMatchingChats`):a(`channels:channelsPage.waitingForTheFirstReplyFromAfar`)})}),O&&(0,V.jsx)(me,{job:O,onClose:re,onRetry:()=>z(O.platform),onSubmitCredentials:async t=>{try{let n=await i(`/api/channels/${O.platform}/onboarding`,{method:`POST`,body:JSON.stringify(t)});`connections`in n?(c(n),k(null),e(a(`channels:channelsPage.nameTwoWayConnectionEstablished`,{name:J(O.platform,a)})),await R()):`mode`in n&&n.mode===`manual`?k({...n,platform:O.platform,status:`starting`,manual:!0}):k({...n,platform:O.platform,manual:n.mode===`manual`})}catch(e){k(t=>t&&{...t,status:`failed`,error:Q(e)})}},notify:e})]})}function $({onBack:e,query:t,onQueryChange:n,children:i}){let{t:a}=r(),o=x(`focusSearch`),s=a(`navigation:navigation.channels`);return(0,V.jsx)(M,{title:s,description:a(`channels:channelsPage.lede`),back:e&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:e},toolbar:(0,V.jsx)(N,{search:(0,V.jsx)(k,{id:_,value:t,onValueChange:n,placeholder:a(`channels:channelsPage.searchPlaceholder`),shortcut:o,clearLabel:a(`navigation:more.clearSearch`)})}),children:i})}function de(e){return e?e.enabled===!1?`paused`:e.status===`connected`?`live`:e.status===`connecting`||e.status===`reconnecting`?`busy`:`disconnected`:`none`}function fe({connection:e}){let{t}=r(),n=de(e),i=n===`none`?t(`channels:channelsPage.notConnected`):n===`paused`?t(`channels:channelsPage.paused`):n===`disconnected`?e?.status===`failed`?t(`channels:channelsPage.connectionFailed`):t(`channels:channelsPage.disconnected`):Z(e?.status||`idle`,t);return(0,V.jsxs)(`span`,{"data-channel-state":n,className:v(`inline-flex min-w-0 items-center gap-1.5 whitespace-nowrap`,n===`disconnected`?`font-medium text-st-attn`:`text-content-secondary`),children:[n===`disconnected`?(0,V.jsx)(F,{status:`attention`,className:`size-3.5`}):n===`busy`?(0,V.jsx)(F,{status:`run`,className:`size-3.5`}):n===`live`?(0,V.jsx)(F,{status:`done`,className:`size-3.5`}):null,i]})}function pe({platform:e,connection:t,models:n,cwd:i,saving:a,onCwdChange:o,onUpdate:s,onReconnect:l,onRemove:u}){let{t:d,language:f}=r();return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,V.jsxs)(`dl`,{className:`rounded-[var(--r-md)] border border-stroke px-3 py-0.5`,children:[(0,V.jsxs)(`div`,{className:U,children:[(0,V.jsx)(`dt`,{children:d(`channels:channelsPage.twoWayCapability`)}),(0,V.jsx)(`dd`,{children:Y(e,d)})]}),(0,V.jsxs)(`div`,{className:U,children:[(0,V.jsx)(`dt`,{children:d(`channels:channelsPage.replyModel`)}),(0,V.jsx)(`dd`,{className:t?.replyModel?`font-mono`:void 0,children:t?.replyModel?`${t.replyModel.provider}/${t.replyModel.model}`:d(`channels:channelsPage.useApplicationDefaultModel`)})]})]}),t?(0,V.jsxs)(`section`,{className:`test-panel min-w-0`,"aria-label":d(`channels:channelsPage.nameSettings`,{name:J(e,d)}),children:[(0,V.jsxs)(`div`,{className:v(`channel-live-status flex min-w-0 items-center gap-2.5 py-2`,t.status),children:[(0,V.jsx)(fe,{connection:t}),(0,V.jsx)(`small`,{className:v(`min-w-0 truncate text-xs tabular-nums`,t.lastError?`text-content-secondary`:`text-content-muted`),children:t.lastError||(t.status===`connected`?d(`channels:channelsPage.connectedTime`,{time:S(t.connectedAt,f)}):d(`channels:channelsPage.establishingPersistentConnection`))})]}),(0,V.jsxs)(`div`,{className:`modal-toggle-row flex min-w-0 items-center justify-between gap-4 border-t border-stroke-soft py-3`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,V.jsx)(`strong`,{className:`text-sm font-medium text-content`,children:d(`channels:channelsPage.enableThisChannel`)}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:d(`channels:channelsPage.turnOffToDisconnectWhileKeepingSignInCredentials`)})]}),(0,V.jsx)(R,{value:t.enabled,disabled:a,ariaLabel:d(`channels:channelsPage.enableThisChannel`),onChange:t=>s(e,{enabled:t},d(t?`channels:channelsPage.channelEnabled`:`channels:channelsPage.channelPaused`))})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.replyModel`)}),(0,V.jsxs)(z,{value:t.replyModel?`${t.replyModel.provider}/${t.replyModel.model}`:``,onChange:t=>{let[n,...r]=t.target.value.split(`/`);s(e,{replyModel:t.target.value?{provider:n,model:r.join(`/`)}:null},d(`channels:channelsPage.channelReplyModelUpdated`))},children:[(0,V.jsx)(`option`,{value:``,children:d(`channels:channelsPage.useApplicationDefaultModel`)}),n.map(e=>(0,V.jsx)(`option`,{value:`${e.provider}/${e.model}`,children:e.label},`${e.provider}/${e.model}`))]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.approvalMode`)}),(0,V.jsxs)(z,{value:t.executionMode,onChange:t=>s(e,{executionMode:t.target.value},d(`channels:channelsPage.approvalModeUpdated`)),children:[(0,V.jsx)(`option`,{value:`approval-required`,children:d(`channels:channelsPage.approvalRequired`)}),(0,V.jsx)(`option`,{value:`workspace-write`,children:d(`channels:channelsPage.workspaceWrite`)}),(0,V.jsx)(`option`,{value:`full-access`,children:d(`channels:channelsPage.fullAccess`)})]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.executionMode`)}),(0,V.jsxs)(z,{value:t.runMode,onChange:t=>s(e,{runMode:t.target.value},d(`channels:channelsPage.executionModeUpdated`)),children:[(0,V.jsx)(`option`,{value:`plan`,children:d(`channels:channelsPage.planMode`)}),(0,V.jsx)(`option`,{value:`goal`,children:d(`channels:channelsPage.goalMode`)}),(0,V.jsx)(`option`,{value:`team`,children:d(`channels:channelsPage.teamMode`)})]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.accessScope`)}),(0,V.jsxs)(z,{value:t.accessMode,onChange:t=>s(e,{accessMode:t.target.value===`all`?`all`:`owner`},d(`channels:channelsPage.accessScopeUpdated`)),children:[(0,V.jsx)(`option`,{value:`owner`,disabled:!t.ownerConfigured,children:d(`channels:channelsPage.qrCodeOwnerOnly`)}),(0,V.jsx)(`option`,{value:`all`,children:d(e===`feishu`?`channels:channelsPage.allMembersInTheCurrentTenant`:e===`weixin`?`channels:channelsPage.allWeChatUsersWhoMessageTheBot`:`channels:channelsPage.allUsersWhoMessageTheBot`)})]})]}),(0,V.jsxs)(`label`,{className:W,children:[(0,V.jsx)(`span`,{className:G,children:d(`channels:channelsPage.defaultWorkingDirectoryForNewChats`)}),(0,V.jsxs)(O,{className:`channel-setting-input max-[650px]:h-11`,children:[(0,V.jsx)(D,{children:(0,V.jsx)(c,{"aria-hidden":`true`})}),(0,V.jsx)(E,{className:`font-mono text-xs`,value:i,onChange:e=>o(e.target.value)}),(0,V.jsx)(D,{align:`inline-end`,children:(0,V.jsx)(b,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-9`,disabled:a||i===t.defaultCwd,onClick:()=>s(e,{defaultCwd:i},d(`channels:channelsPage.defaultWorkingDirectorySaved`)),children:d(`channels:channelsPage.save`)})})]})]}),(0,V.jsxs)(I,{className:v(`mt-1`,q),children:[(0,V.jsx)(m,{size:15}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:d(`channels:channelsPage.localSecurityBoundary`)}),(0,V.jsx)(`small`,{children:d(`channels:channelsPage.ownerOnlyAccessRespectsToolPermissionsAndExecutionMode`)})]})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-2 max-[650px]:[&>button]:h-11`,children:[(0,V.jsxs)(b,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>u(e),children:[(0,V.jsx)(re,{}),d(`channels:channelsPage.disconnect`)]}),(0,V.jsxs)(b,{variant:`secondary`,size:`sm`,onClick:()=>l(e),disabled:a,children:[(0,V.jsx)(p,{}),d(`channels:channelsPage.reconnect`)]})]})]}):(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:d(`channels:channelsPage.notConnectedHint`)})]})}function me({job:e,onClose:t,onRetry:n,onSubmitCredentials:a,notify:o}){let{t:c,language:l}=r(),[u,d]=(0,B.useState)(``),[h,_]=(0,B.useState)(``),[x,S]=(0,B.useState)(``),[C,w]=(0,B.useState)(``),[E,D]=(0,B.useState)(!1),O=[`completed`,`failed`,`cancelled`].includes(e.status),k=e.manual||X(e.platform)&&e.mode!==`qr`,A=e.platform===`qq`?!!(h.trim()&&(x.trim()||C.trim())):!!C.trim(),j=async()=>{if(A){D(!0);try{await a({...h.trim()?{appId:h.trim()}:{},...x.trim()?{appSecret:x.trim()}:{},...C.trim()?{token:C.trim()}:{}})}finally{D(!1)}}};return(0,V.jsx)(`div`,{className:ie,onMouseDown:e=>e.target===e.currentTarget&&t(),children:(0,V.jsxs)(`section`,{className:v(K,`feishu-onboard-modal`),children:[(0,V.jsxs)(L,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:c(k?`channels:channelsPage.configureName`:`channels:channelsPage.connectNameByQRCode`,{name:J(e.platform,c)})}),(0,V.jsx)(`p`,{children:e.platform===`feishu`?c(`channels:channelsPage.createTheBotAppThroughTheOfficialFeishuAuthorizationPage`):e.platform===`weixin`?c(`channels:channelsPage.signInToPersonalWeChatThroughTencentILinkBot`):e.platform===`qq`?c(`channels:channelsPage.scanWithQQToCreateOfficialBot`):c(`channels:channelsPage.enterBotCredentialsForName`,{name:J(e.platform,c)})})]}),(0,V.jsx)(b,{variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":c(`channels:channelsPage.closeDialog`),onClick:t,children:(0,V.jsx)(ee,{})})]}),k&&!e.id&&!O&&(0,V.jsxs)(`div`,{className:`mt-3.5 grid gap-2.5`,children:[e.platform===`qq`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(P,{variant:`control`,children:[c(`channels:channelsPage.qqAppId`),(0,V.jsx)(T,{value:h,onChange:e=>_(e.target.value)})]}),(0,V.jsxs)(P,{variant:`control`,children:[c(`channels:channelsPage.qqAppSecret`),(0,V.jsx)(T,{type:`password`,value:x,onChange:e=>S(e.target.value)})]}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:c(`channels:channelsPage.qqCredentialsOrToken`)})]}),(0,V.jsxs)(P,{variant:`control`,children:[c(`channels:channelsPage.botToken`),(0,V.jsx)(T,{type:`password`,value:C,onChange:e=>w(e.target.value)})]}),e.setupUrl&&(0,V.jsxs)(I,{className:v(q,`[&_a]:inline-flex [&_a]:items-center [&_a]:gap-1 [&_a]:text-xs [&_a]:text-content [&_a]:underline [&_a]:underline-offset-4`),children:[e.qrDataUrl&&(0,V.jsx)(`img`,{src:e.qrDataUrl,alt:c(`channels:channelsPage.openOfficialSetupQRCode`),className:`size-[120px] rounded-sm bg-[var(--lightbox-action-bg)] p-1`}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:c(`channels:channelsPage.officialSetupRequired`)}),(0,V.jsx)(`small`,{children:c(`channels:channelsPage.officialSetupInstructions`)}),(0,V.jsxs)(`a`,{href:e.setupUrl,target:`_blank`,rel:`noreferrer`,children:[c(`channels:channelsPage.openOfficialSetup`),(0,V.jsx)(s,{size:12})]})]})]}),(0,V.jsxs)(b,{className:`max-[650px]:h-11`,loading:E,disabled:!A||E,onClick:()=>void j(),children:[(0,V.jsx)(f,{}),c(`channels:channelsPage.connect`)]})]}),(!k||e.id||O)&&(0,V.jsxs)(`div`,{className:v(`feishu-qr-stage mt-3.5 flex min-h-[min(330px,52dvh)] flex-col items-center justify-center gap-2.5 rounded-md border border-stroke bg-surface-subtle p-4 text-center [&_img]:w-[248px] [&_img]:max-w-[86%] [&_img]:rounded-md [&_img]:border [&_img]:border-stroke [&_img]:bg-[var(--lightbox-action-bg)] [&_img]:p-2 [&_p]:max-w-[330px] [&_p]:text-xs [&_p]:leading-normal [&_p]:text-content-secondary [&_small]:text-xs [&_small]:text-content-muted [&_small]:tabular-nums [&_strong]:text-sm [&_strong]:font-medium [&.completed]:text-success [&.failed]:text-content-secondary`,e.status),children:[e.qrDataUrl?(0,V.jsx)(`img`,{src:e.qrDataUrl,alt:c(`channels:channelsPage.nameConnectionQRCode`,{name:J(e.platform,c)})}):e.status===`failed`?(0,V.jsx)(g,{className:`size-8`,strokeWidth:1.5}):(0,V.jsx)(y,{className:`size-7`}),(0,V.jsx)(`strong`,{children:k&&!e.id?c(`channels:channelsPage.enterBotCredentialsForName`,{name:J(e.platform,c)}):ce(e.status,c)}),e.error&&(0,V.jsx)(`p`,{children:e.error}),e.expireAt&&!O&&(0,V.jsx)(`small`,{children:c(`channels:channelsPage.qrCodeExpiresTime`,{time:le(e.expireAt,l)})})]}),e.needsVerifyCode&&(0,V.jsxs)(`div`,{className:`weixin-verify-code mt-2.5 grid grid-cols-[minmax(0,1fr)_auto] gap-2`,children:[(0,V.jsx)(T,{className:`font-mono tracking-[.08em] tabular-nums`,inputMode:`numeric`,value:u,onChange:e=>d(e.target.value.replace(/\D/g,``).slice(0,8)),placeholder:c(`channels:channelsPage.enterTheNumberShownOnYourPhone`)}),(0,V.jsx)(b,{className:`max-[650px]:h-11`,disabled:!u,onClick:async()=>{try{await i(`/api/channels/${e.platform}/onboarding/${encodeURIComponent(e.id||``)}/verify`,{method:`POST`,body:JSON.stringify({code:u})}),o(c(`channels:channelsPage.pairingCodeSubmitted`))}catch(e){o(Q(e),`error`)}},children:c(`channels:channelsPage.submitPairingCode`)})]}),e.qrUrl&&!O&&(0,V.jsx)(b,{asChild:!0,variant:`secondary`,className:`mt-2.5 w-full no-underline max-[650px]:h-11`,children:(0,V.jsxs)(`a`,{href:e.qrUrl,target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(s,{}),c(`channels:channelsPage.cannotScanOpenTheSignInLink`)]})}),(0,V.jsxs)(I,{className:q,children:[(0,V.jsx)(m,{size:15}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:c(`channels:channelsPage.persistentTwoWayConnection`)}),(0,V.jsx)(`small`,{children:e.platform===`feishu`?c(`channels:channelsPage.webSocketReceivesDirectMessagesAndGroupMentions`):e.platform===`weixin`?c(`channels:channelsPage.tencentILinkContinuouslyPollsDirectMessagesAndSupportsTextAndMediaReplies`):Y(e.platform,c)})]})]}),(0,V.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,V.jsx)(b,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:t,children:c(O?`channels:channelsPage.off`:`channels:channelsPage.cancel`)}),e.status===`failed`&&(0,V.jsxs)(b,{className:`max-[650px]:h-11`,onClick:n,children:[(0,V.jsx)(p,{}),c(k?`channels:channelsPage.retry`:`channels:channelsPage.generateANewQRCode`)]})]})]})})}export{ue as ChannelsPage};
@@ -1 +1 @@
1
- import{m as e,n as t,r as n}from"./vendor-router-CSN_DGvx.js";import{r}from"./vendor-react-DwNgTV1j.js";import{r as i}from"./routes-Da0OHSy6.js";import{t as a}from"./use-i18n-BIJtH0nB.js";var o=r();function s({appearance:r}){let{t:s}=a(),[c]=e(),l=c.get(`view`);return l===`layout`||l===`widgets`?(0,o.jsx)(n,{to:i.components,replace:!0}):(0,o.jsxs)(`div`,{className:`flex min-h-full min-w-0 flex-col gap-4`,children:[(0,o.jsxs)(t,{to:i.components,"data-components-moved":!0,className:`group flex min-h-11 w-fit max-w-full items-center gap-x-2 gap-y-0.5 rounded-md border border-stroke bg-solid px-3 py-2 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:border-stroke-strong hover:text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:w-full max-[650px]:flex-wrap`,children:[(0,o.jsx)(`span`,{className:`font-medium text-content`,children:s(`custom-ui:moved.title`)}),(0,o.jsx)(`span`,{className:`text-xs text-content-muted`,children:s(`custom-ui:moved.hint`)})]}),r]})}export{s as ChatAppearancePage};
1
+ import{m as e,n as t,r as n}from"./vendor-router-CSN_DGvx.js";import{r}from"./vendor-react-DwNgTV1j.js";import{r as i}from"./routes-Da0OHSy6.js";import{t as a}from"./use-i18n-BWyVtWF9.js";var o=r();function s({appearance:r}){let{t:s}=a(),[c]=e(),l=c.get(`view`);return l===`layout`||l===`widgets`?(0,o.jsx)(n,{to:i.components,replace:!0}):(0,o.jsxs)(`div`,{className:`flex min-h-full min-w-0 flex-col gap-4`,children:[(0,o.jsxs)(t,{to:i.components,"data-components-moved":!0,className:`group flex min-h-11 w-fit max-w-full items-center gap-x-2 gap-y-0.5 rounded-md border border-stroke bg-solid px-3 py-2 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:border-stroke-strong hover:text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:w-full max-[650px]:flex-wrap`,children:[(0,o.jsx)(`span`,{className:`font-medium text-content`,children:s(`custom-ui:moved.title`)}),(0,o.jsx)(`span`,{className:`text-xs text-content-muted`,children:s(`custom-ui:moved.hint`)})]}),r]})}export{s as ChatAppearancePage};