pisper 0.6.35 → 0.6.36

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 (207) hide show
  1. package/lib/executor-node.mjs +31 -7
  2. package/package.json +6 -6
  3. package/web/.vite/manifest.json +1018 -826
  4. package/web/assets/{AppDialog-BIc2uEZh.js → AppDialog-C79lPTAo.js} +1 -1
  5. package/web/assets/{AppOverlays-BlJ0uL_P.js → AppOverlays-CcLTlcPI.js} +1 -1
  6. package/web/assets/AssetsPage-DItvQcTv.js +1 -0
  7. package/web/assets/AttachmentTray-DT4tuA-0.js +1 -0
  8. package/web/assets/BoardPage-BS2Mn5BB.js +3 -0
  9. package/web/assets/BotAvatar-DfRTuJjC.js +1 -0
  10. package/web/assets/{ChannelsPage-DgzuzmFL.js → ChannelsPage-HLl1Exdg.js} +1 -1
  11. package/web/assets/{ChatAppearancePage-98Sa8ZQW.js → ChatAppearancePage-COu9kuXs.js} +1 -1
  12. package/web/assets/ChatHistoryPage-DW7tD7eq.js +1 -0
  13. package/web/assets/ChatMessage-BA6Yf2bc.js +5 -0
  14. package/web/assets/ChatPage-Cz50Wq-F.js +553 -0
  15. package/web/assets/ConfigPage-BBU5Rrn1.js +7 -0
  16. package/web/assets/{DesktopWindowControls-BQ0OvDZ8.js → DesktopWindowControls-BJa4zqE2.js} +1 -1
  17. package/web/assets/{FeaturePage-C0bAQ4el.js → FeaturePage-D2NZ4cLC.js} +1 -1
  18. package/web/assets/{FileAttachmentPreview-BdMgsecO.js → FileAttachmentPreview-CFAdIi3l.js} +1 -1
  19. package/web/assets/{FloatingWidgets-DjMCcqln.js → FloatingWidgets-BzwWhwvZ.js} +1 -1
  20. package/web/assets/FocusRuntimeControls-eXxgJIFt.js +2 -0
  21. package/web/assets/{GitDiffViewer-hHSTzUJk.js → GitDiffViewer-DDd2yMvx.js} +3 -3
  22. package/web/assets/ManageProjectsDialog-Sf4KX5NQ.js +1 -0
  23. package/web/assets/{MarkdownMessage-CktdHgKM.js → MarkdownMessage-CggW-dCt.js} +1 -1
  24. package/web/assets/McpPage-CSaBHKz7.js +1 -0
  25. package/web/assets/{MemoryEvolution-DBjU-Nr7.js → MemoryEvolution-DV0LMrEd.js} +1 -1
  26. package/web/assets/MemoryPage-G0tvVhJb.js +2 -0
  27. package/web/assets/{MobileNavigation-B2NKM8rj.js → MobileNavigation-B1XfXR2s.js} +1 -1
  28. package/web/assets/{MorePage-xB2zBRtU.js → MorePage-DGYxdHLm.js} +1 -1
  29. package/web/assets/NewFolderDialog-CzgCnqfC.js +1 -0
  30. package/web/assets/{PageHeader-BN-qcxte.js → PageHeader-CQ4qg6wC.js} +1 -1
  31. package/web/assets/{PhoneDrawer-utEXi-yp.js → PhoneDrawer-CjUjF454.js} +1 -1
  32. package/web/assets/{PhoneMenuButton-uG_T93KL.js → PhoneMenuButton-DbsLKxdG.js} +1 -1
  33. package/web/assets/PhoneTopBar-DMMlJYcd.js +1 -0
  34. package/web/assets/PluginsPage-BnNOlT_w.js +1 -0
  35. package/web/assets/{SafeModePrompt-jV-PRvrW.js → SafeModePrompt-DpzPKu3D.js} +1 -1
  36. package/web/assets/{SchedulesPage-Diethe4H.js → SchedulesPage-Ds4Q6aNP.js} +1 -1
  37. package/web/assets/SessionBrowserPane-C0P_zk8r.js +2 -0
  38. package/web/assets/SessionContextPanel-CHOeF4Yg.js +2 -0
  39. package/web/assets/SessionHome-BVB1DziO.js +1 -0
  40. package/web/assets/SessionInspector-CI0yM7hn.js +1 -0
  41. package/web/assets/SessionShell-kd6S4sjr.js +1 -0
  42. package/web/assets/SettingsRow-CT0AZ7re.js +1 -0
  43. package/web/assets/{SettingsSidebar-CpAD5iSt.js → SettingsSidebar-Tef3Nnew.js} +1 -1
  44. package/web/assets/{ShortcutHelpDialog-C2QbSvui.js → ShortcutHelpDialog-C8XduaKQ.js} +1 -1
  45. package/web/assets/{ShortcutKeys-Dl4Suwhz.js → ShortcutKeys-CHOVA_5P.js} +1 -1
  46. package/web/assets/{SidebarUpdateStatus-DrS7u_v_.js → SidebarUpdateStatus-BNFx2j6q.js} +1 -1
  47. package/web/assets/{SkillsPage-CDoMtK-E.js → SkillsPage-TBWU04ie.js} +1 -1
  48. package/web/assets/{TaskProcessesPane-Z_9HeVX5.js → TaskProcessesPane-BHe6CquN.js} +1 -1
  49. package/web/assets/{TaskTerminalView-BTCVpAHF.js → TaskTerminalView-ByuB7q2B.js} +1 -1
  50. package/web/assets/{TerminalPanel-DuUtaPyf.js → TerminalPanel-FXsJQMsq.js} +1 -1
  51. package/web/assets/{WebDesktopPet-CWviMnct.js → WebDesktopPet-Bw-jipEg.js} +1 -1
  52. package/web/assets/{WorkflowsPage-CHvyXwCg.js → WorkflowsPage-COT3iS5m.js} +1 -1
  53. package/web/assets/{WorkspacePicker-D6FLo7O1.js → WorkspacePicker-DjW-sAP5.js} +1 -1
  54. package/web/assets/activity-BCxvXCG3.js +1 -0
  55. package/web/assets/alert-dialog-DiUitBB0.js +1 -0
  56. package/web/assets/{api-Cm58F7OP.js → api-BET28sp7.js} +1 -1
  57. package/web/assets/{app-primitives-Drz_SjnR.js → app-primitives-BskZ4ZJj.js} +1 -1
  58. package/web/assets/{app-update-KLjtuCDT.js → app-update-7n8nXaPd.js} +1 -1
  59. package/web/assets/{approval-confirm-BrorOUHg.js → approval-confirm-SBeU3s_9.js} +1 -1
  60. package/web/assets/assets-api-DOGSXB2A.js +1 -0
  61. package/web/assets/board-messages-DDVcGLQp.js +1 -0
  62. package/web/assets/board-projects-31Kch8Or.js +1 -0
  63. package/web/assets/bots-store-CgzHr2dN.js +1 -0
  64. package/web/assets/card-presentation-zU6WKfgu.js +2 -0
  65. package/web/assets/chat-api-DwR_1yAu.js +1 -0
  66. package/web/assets/chip-ZhnvFlFg.js +1 -0
  67. package/web/assets/{client-store-4G-xfNKc.js → client-store-Bv5fkPKC.js} +1 -1
  68. package/web/assets/{dist-DUSSw9eQ.js → collapsible-B-fc7n0u.js} +1 -1
  69. package/web/assets/command-DQJks9Cg.js +1 -0
  70. package/web/assets/{config-search-1BIdouae.js → config-search-1R0m2Dxn.js} +1 -1
  71. package/web/assets/corner-down-left-DalpwXuX.js +1 -0
  72. package/web/assets/{desktop-hosts-uMG7lFRY.js → desktop-hosts-DMZi66Qp.js} +2 -2
  73. package/web/assets/{dialog-D23yIdOZ.js → dialog-C6pJ93kY.js} +1 -1
  74. package/web/assets/{event-stream-BrDcABQx.js → event-stream-DujJnWl2.js} +1 -1
  75. package/web/assets/{events-BgEZwyTb.js → events-BrkEbuk_.js} +1 -1
  76. package/web/assets/folder-minus-BhfTnypT.js +1 -0
  77. package/web/assets/folder-paths-C8UCsQpi.js +1 -0
  78. package/web/assets/folder-plus-OPHZsJho.js +1 -0
  79. package/web/assets/{hosts-DljHKUSO.js → hosts-DCtZi0Vu.js} +1 -1
  80. package/web/assets/{http-DtkTCrZ4.js → http-Da7z8Zhw.js} +1 -1
  81. package/web/assets/http-response-DHqWBecB.js +1 -0
  82. package/web/assets/i18n-CYOV8NO5.js +1 -0
  83. package/web/assets/index-B446sLQy.js +2 -0
  84. package/web/assets/index-Fb-GT4ka.css +2 -0
  85. package/web/assets/list-todo-hpikYm6Q.js +1 -0
  86. package/web/assets/machine-messages-P6rRT5_Y.js +1 -0
  87. package/web/assets/machines-api-Cww34Att.js +1 -0
  88. package/web/assets/mcp-Cnn5t8jD.js +1 -0
  89. package/web/assets/mcp-DKnh78Cw.js +1 -0
  90. package/web/assets/{memory-api-DHLgFXzZ.js → memory-api-Bl58uVxS.js} +1 -1
  91. package/web/assets/mount-app-Dz4ohBAB.js +9 -0
  92. package/web/assets/{palette-navigation-BcPK8UF5.js → palette-navigation-DbWf-z0P.js} +1 -1
  93. package/web/assets/permission-rules-api-DKvt9Ijn.js +1 -0
  94. package/web/assets/{pick-system-directory-DS_-qn8W.js → pick-system-directory-BRdpqAVu.js} +1 -1
  95. package/web/assets/placements-DueXe1Zp.js +2 -0
  96. package/web/assets/popover-Bz5EGqVg.js +1 -0
  97. package/web/assets/public-CL4QGDNW.js +9 -0
  98. package/web/assets/public-C_3jqJ-h.js +2 -0
  99. package/web/assets/{public-B8mbf50i.js → public-WgIAq7m6.js} +1 -1
  100. package/web/assets/public-bzVRS_Ps.js +2 -0
  101. package/web/assets/{public-components-CMbKXCZU.js → public-components-CNnORHGF.js} +1 -1
  102. package/web/assets/public-diff-BiBx9iwa.js +1 -0
  103. package/web/assets/public-events-CUnBp7HK.js +1 -0
  104. package/web/assets/{public-flags-D8CxujmF.js → public-flags-ItOVvu41.js} +1 -1
  105. package/web/assets/{public-folder-dialog-Dnmn6DIU.js → public-folder-dialog-CooqqcGn.js} +1 -1
  106. package/web/assets/{public-greeting-Cs-sacVq.js → public-greeting-C9UC30cx.js} +1 -1
  107. package/web/assets/{public-session-DSLmbBcw.js → public-session-Cb2rGpEN.js} +1 -1
  108. package/web/assets/public-sidebar-DT8uieIs.js +1 -0
  109. package/web/assets/room-changes-DMfb5VNn.js +1 -0
  110. package/web/assets/{routes-DIeaqWVc.js → routes-BYsK6aeM.js} +1 -1
  111. package/web/assets/runtime-capabilities-CxyszNkG.js +1 -0
  112. package/web/assets/{runtime-capabilities-store-Y9MaywP8.js → runtime-capabilities-store-1qxTCxHV.js} +1 -1
  113. package/web/assets/{safe-mode-instance-CYIRMY5i.js → safe-mode-instance-DlkQOfml.js} +1 -1
  114. package/web/assets/safe-mode-sentinel-MZiIHVDW.js +1 -0
  115. package/web/assets/session-board-status-D_Tz3HJm.js +1 -0
  116. package/web/assets/{session-change-summary-api-Dp9vVPv_.js → session-change-summary-api-5OOAmNzo.js} +1 -1
  117. package/web/assets/{session-home-DqEkX19H.js → session-home-fCQ4eKhT.js} +1 -1
  118. package/web/assets/session-inspector-store-Dk8BXrxC.js +1 -0
  119. package/web/assets/session-questions-COno7uhe.js +1 -0
  120. package/web/assets/{session-scope-BJIZo6ty.js → session-scope-B13jJaQq.js} +1 -1
  121. package/web/assets/{session-tree-actions-B8GDKcGe.js → session-tree-actions-CS9J4Eer.js} +1 -1
  122. package/web/assets/session-tree-summary-_F4a4OX7.js +1 -0
  123. package/web/assets/session-web-preview-NBd9P7Kp.js +1 -0
  124. package/web/assets/{settings-navigation-C-nsUyew.js → settings-navigation-BEoTeOkB.js} +1 -1
  125. package/web/assets/{shortcuts-DRfz9B_B.js → shortcuts-CctXrljf.js} +1 -1
  126. package/web/assets/side-chat-context-oyi3ytlS.js +4 -0
  127. package/web/assets/{sidebar-DrzZKq2i.js → sidebar-B1PDwCql.js} +1 -1
  128. package/web/assets/{sidebar-store-BvZAgxJg.js → sidebar-store-D3ZnQB3e.js} +1 -1
  129. package/web/assets/{speech-session-DGkMojp3.js → speech-session-BwcPoFaK.js} +1 -1
  130. package/web/assets/{startup-queries-BjjeYiQ8.js → startup-queries-CNUOrW7A.js} +1 -1
  131. package/web/assets/subagent-view-store-BUvI8piR.js +1 -0
  132. package/web/assets/undo-2-ChaURM4t.js +1 -0
  133. package/web/assets/{use-i18n-8V6eRMcE.js → use-i18n-CbqEZb3r.js} +1 -1
  134. package/web/assets/use-open-bot-Dv66YK0n.js +1 -0
  135. package/web/assets/{use-studio-actions-BsdfCptK.js → use-studio-actions-GplOMwz9.js} +3 -3
  136. package/web/assets/useCatalogProjects-CtZwq4VJ.js +1 -0
  137. package/web/assets/{useMachines-BBeg2uOZ.js → useMachines-DHK5FVXC.js} +1 -1
  138. package/web/assets/useNewProjectPicker-Dum2z5eb.js +2 -0
  139. package/web/assets/useNow-Cm86munt.js +1 -0
  140. package/web/assets/{usePhoneShell-DRZTDDgZ.js → usePhoneShell-BDH8-EY7.js} +1 -1
  141. package/web/assets/useSessionListQuery-D8hWYbAp.js +2 -0
  142. package/web/assets/{useSessionRowActions-DBqnVodk.js → useSessionRowActions-D3-sAs-h.js} +1 -1
  143. package/web/assets/{useSidebarModel-DBH3JLQ1.js → useSidebarModel-CR0sLO4j.js} +1 -1
  144. package/web/assets/{workspace-folders-Bu3t-gEw.js → workspace-folders-DWoX16M_.js} +1 -1
  145. package/web/assets/workspace-order-store-CI03povy.js +1 -0
  146. package/web/index.html +2 -2
  147. package/web/assets/AssetsPage-B9lqKmXy.js +0 -1
  148. package/web/assets/BoardPage-BB_xAnQV.js +0 -3
  149. package/web/assets/BotAvatar-CNL-APwP.js +0 -1
  150. package/web/assets/ChatHistoryPage-BHsZFF4a.js +0 -1
  151. package/web/assets/ChatPage-C3NC9LNG.js +0 -553
  152. package/web/assets/ConfigPage-D3SyAsIs.js +0 -7
  153. package/web/assets/FocusRuntimeControls-DeSe12wJ.js +0 -2
  154. package/web/assets/ManageProjectsDialog-DVLX4ZBu.js +0 -1
  155. package/web/assets/McpPage-7wR_N0eS.js +0 -1
  156. package/web/assets/MemoryPage-DiO4GHc7.js +0 -2
  157. package/web/assets/NewFolderDialog-CjWMsY2Q.js +0 -1
  158. package/web/assets/PhoneTopBar-DuLewk2J.js +0 -1
  159. package/web/assets/PluginsPage-D0hAMgQ_.js +0 -1
  160. package/web/assets/SessionBrowserPane-y7gPArTV.js +0 -2
  161. package/web/assets/SessionContextPanel-Ckca3NrN.js +0 -2
  162. package/web/assets/SessionHome-CcjiU1fU.js +0 -1
  163. package/web/assets/SessionInspector-CNSyVYK6.js +0 -1
  164. package/web/assets/SessionShell-wOw-rTQD.js +0 -1
  165. package/web/assets/accordion-CiJMkjqX.js +0 -1
  166. package/web/assets/board-messages-3qT8nGsd.js +0 -1
  167. package/web/assets/board-projects-CeL6PPiY.js +0 -1
  168. package/web/assets/bots-store-CRGayU4z.js +0 -1
  169. package/web/assets/card-presentation-1oph2b8P.js +0 -2
  170. package/web/assets/chat-api-DQyHZl-V.js +0 -1
  171. package/web/assets/collapsible-Dcoy-qnz.js +0 -1
  172. package/web/assets/folder-paths-D0-7xV2n.js +0 -1
  173. package/web/assets/http-response-B2n7HFQ4.js +0 -1
  174. package/web/assets/i18n-B7QmqfvO.js +0 -1
  175. package/web/assets/index-79gEOxmD.js +0 -2
  176. package/web/assets/index-XwGsScbB.css +0 -2
  177. package/web/assets/machine-messages-Bd6JwiOe.js +0 -1
  178. package/web/assets/machines-api-Kg457H3y.js +0 -1
  179. package/web/assets/mcp-BcCwwm4p.js +0 -1
  180. package/web/assets/mcp-ZCMDzpoJ.js +0 -1
  181. package/web/assets/mount-app-BlaI2VZs.js +0 -9
  182. package/web/assets/permission-rules-api-BZn4yp-J.js +0 -1
  183. package/web/assets/placements-BMxzzGTX.js +0 -2
  184. package/web/assets/popover-C5U02alK.js +0 -1
  185. package/web/assets/public-Be05c5M9.js +0 -2
  186. package/web/assets/public-Bq1VrNr8.js +0 -2
  187. package/web/assets/public-DsjuTTt0.js +0 -3
  188. package/web/assets/public-diff-4sBkfeo8.js +0 -1
  189. package/web/assets/public-events-D2kHUhG2.js +0 -1
  190. package/web/assets/public-sidebar-UNJ9_fD1.js +0 -1
  191. package/web/assets/run-activity-CwfO0cui.js +0 -1
  192. package/web/assets/runtime-capabilities-CPDBo3tu.js +0 -1
  193. package/web/assets/safe-mode-sentinel-Bq9lNJoA.js +0 -1
  194. package/web/assets/session-board-status-D2lpFPiI.js +0 -1
  195. package/web/assets/session-inspector-store-D_mwa4K7.js +0 -1
  196. package/web/assets/session-organization-api-ibzfB8fg.js +0 -1
  197. package/web/assets/session-questions-94KACguh.js +0 -1
  198. package/web/assets/session-tree-summary-BTcPaCgY.js +0 -1
  199. package/web/assets/session-web-preview-guvsmkWE.js +0 -1
  200. package/web/assets/side-chat-context-CRQ33Q0D.js +0 -7
  201. package/web/assets/undo-2-C-xQ0UVT.js +0 -1
  202. package/web/assets/use-open-bot-BEhRmhru.js +0 -1
  203. package/web/assets/useCatalogProjects-DKjmAJ2x.js +0 -1
  204. package/web/assets/useNewProjectPicker-Cmw2SOhW.js +0 -2
  205. package/web/assets/useNow-D-gM4IXU.js +0 -1
  206. package/web/assets/useSessionListQuery-DtpEX8a5.js +0 -2
  207. package/web/assets/workspace-order-store-DmEFuNUL.js +0 -1
@@ -0,0 +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-CbqEZb3r.js";import{t as i}from"./api-BET28sp7.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-1qxTCxHV.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as b}from"./shield-alert-oZqX6MNu.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as x}from"./triangle-alert-CE1q54ci.js";import{t as S}from"./more-pages-D_PnxLN0.js";import{a as C,c as w,i as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./alert-dialog-DiUitBB0.js";import{t as se}from"./utils-C8uzG5AZ.js";import{n as ce,t as T}from"./button-CCcCN8tE.js";import{s as le}from"./shortcuts-CctXrljf.js";import{a as E,i as ue,l as D,o as O,s as de,t as k}from"./dialog-C6pJ93kY.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./pick-system-directory-BRdpqAVu.js";import{n as fe,t as pe}from"./PageState-Cz6vFMXv.js";import{a as me,i as M,n as N,o as P,r as he,s as ge,t as F}from"./FeaturePage-D2NZ4cLC.js";import{t as I}from"./AppSelect-DQYKUW5E.js";import{c as _e,i as ve,s as ye}from"./app-primitives-BskZ4ZJj.js";import{a as L,i as be,n as xe,o as Se,r as Ce,s as we,t as Te}from"./tool-labels-D-3gybP7.js";var R=s(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),z=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),B=e(t(),1),V=n();function H(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ee({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,B.useState)(``),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``);return(0,B.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,V.jsx)(k,{open:e,onOpenChange:e=>!d&&t(e),children:(0,V.jsxs)(ue,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,V.jsxs)(de,{children:[(0,V.jsxs)(D,{className:`flex items-center gap-2`,children:[(0,V.jsx)(z,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,V.jsx)(E,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,V.jsxs)(`div`,{className:`grid gap-3`,children:[(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,V.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,V.jsx)(A,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,V.jsx)(T,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await j(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,V.jsx)(p,{})})]})]}),l&&(0,V.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,V.jsx)(c,{className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,V.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,H(l.byteCount)]})]})]}),(0,V.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,V.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,V.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,V.jsx)(x,{className:`mt-0.5 shrink-0`,size:15}),(0,V.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,V.jsxs)(ve,{className:`m-0`,children:[(0,V.jsx)(x,{size:14}),(0,V.jsx)(`span`,{children:m})]})]}),(0,V.jsxs)(O,{children:[(0,V.jsx)(T,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,V.jsxs)(T,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,V.jsx)(ce,{className:`text-current`}):l?(0,V.jsx)(z,{}):(0,V.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var U=[`tool`,`prompt`,`skill`];function W(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>U.includes(e)):[];return t.length?t:[`tool`]}function G(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var De=[`all`,`builtin`,`local`],Oe={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,computer_use:R,generate_visual:m};function K(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function ke(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function Ae(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function je(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function Me(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Ne(e,t){return L({id:e.name,name:e.label},t)}function q(e,t){return e.pluginSource===`pi`?e.pluginName:Ce(e.pluginName,t)}function Pe({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,V.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,V.jsxs)(I,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,V.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,V.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,V.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,V.jsxs)(I,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,V.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,V.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,V.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,V.jsx)(A,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,V.jsxs)(T,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,V.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function Fe({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,B.useState)(``),[l,d]=(0,B.useState)(null),[f,p]=(0,B.useState)([]),[m,g]=(0,B.useState)(!1),[_,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),S=(0,B.useCallback)(async(e=``)=>{g(!0),x(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){x(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,B.useEffect)(()=>{S(``)},[S]);let C=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),w=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},te=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await w(e.trim())},ne=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await S(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},re=U.map(e=>({type:e,items:f.filter(t=>W(t).includes(e))})).filter(e=>e.items.length>0);return(0,V.jsxs)(V.Fragment,{children:[re.map(e=>(0,V.jsx)(P,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${G(e.type,o)}`,count:e.items.length,children:(0,V.jsx)(N,{children:e.items.map(t=>(0,V.jsx)(M,{icon:(0,V.jsx)(h,{}),name:(0,V.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,V.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void ne(t),children:[(0,V.jsx)(ee,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,V.jsxs)(P,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(T,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,V.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,V.jsxs)(T,{type:`button`,variant:`secondary`,size:`sm`,onClick:te,disabled:!!_,children:[(0,V.jsx)(z,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,V.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),S(s)},children:[(0,V.jsx)(A,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,V.jsxs)(T,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,V.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),b&&(0,V.jsx)(F,{className:`mt-0 mb-3`,children:b}),C.length>0&&(0,V.jsx)(N,{children:C.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,V.jsx)(M,{icon:(0,V.jsx)(h,{}),name:(0,V.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,V.jsx)(T,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void w(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function J({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=le(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?De:De.slice(0,2),[p,m]=(0,B.useState)(``),[h,v]=(0,B.useState)(null),[y,E]=(0,B.useState)([]),[ue,D]=(0,B.useState)(``),[O,de]=(0,B.useState)(`all`),[k,A]=(0,B.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[j,F]=(0,B.useState)(!1),[I,L]=(0,B.useState)(!1),[Ce,R]=(0,B.useState)(!1),[H,U]=(0,B.useState)(null),[W,G]=(0,B.useState)(!1),[J,Y]=(0,B.useState)(``),[Ie,Le]=(0,B.useState)(!1),X=(0,B.useCallback)(e=>{v(e),E(e.plugins),A(e.webSearch)},[]),Z=(0,B.useCallback)(async()=>{Y(``);try{X(await i(`/api/plugins`))}catch(e){Y(e instanceof Error?e.message:String(e))}},[X]);(0,B.useEffect)(()=>{Z()},[Z]);let Re=(0,B.useMemo)(()=>Ae(y),[y]),ze=(0,B.useMemo)(()=>ke(y),[y]),Q=h?!Me(ze,h.enabledTools)||JSON.stringify(je(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(k)!==JSON.stringify(h.webSearch):!1,Be=(0,B.useCallback)(async()=>{if(!j){if(!h||!Q){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}F(!0),Y(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:ze,webSearch:k,piExtensions:je(y)})});X(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[X,h,Q,y,ze,e,j,c,k]),Ve=async()=>{L(!0),Y(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(k)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);Y(n),e(n,`error`)}finally{L(!1)}},He=(e,t,n)=>{E(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},Ue=()=>!Q||(Y(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),We=async()=>{if(!(!H||W)){G(!0),Y(``);try{X(await i(`/api/plugins/${encodeURIComponent(H.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:H.pluginName})),D(``),U(null)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{G(!1)}}},Ge=c(`navigation:navigation.plugins`),Ke=p.trim().toLowerCase(),$=Re.filter(e=>O!==`all`&&e.pluginSource!==O?!1:[Ne(e,c),e.name,e.description,q(e,c),e.pluginId].join(` `).toLowerCase().includes(Ke));return(0,V.jsxs)(he,{title:Ge,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,V.jsx)(ge,{search:(0,V.jsx)(me,{id:S,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Ge}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,V.jsxs)(V.Fragment,{children:[d&&(0,V.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Ue()&&R(!0),children:[(0,V.jsx)(z,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,V.jsxs)(T,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:j,disabled:!h||j,onClick:()=>void Be(),children:[(0,V.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,V.jsx)(_e,{options:f.map(e=>K(e,c)),value:K(O,c),onChange:e=>de(f.find(t=>K(t,c)===e)||`all`)})}),children:[h?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,V.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[Re.filter(e=>e.enabled).length,`/`,Re.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:Q&&(0,V.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,V.jsx)(N,{className:`plugin-tool-grid`,children:$.map(e=>{let t=Oe[e.name]||g,n=Ne(e,c);return(0,V.jsx)(M,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,V.jsx)(t,{}),name:(0,V.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${q(e,c)} · ${Se(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,V.jsx)(ye,{value:e.enabled,onChange:t=>He(e.pluginId,e.name,t),ariaLabel:n}),expanded:ue===e.name,onExpandedChange:t=>D(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,V.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:be({id:e.name,description:e.description},c)}),(0,V.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,V.jsxs)(`dd`,{className:`tabular-nums`,children:[q(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,V.jsx)(`dd`,{className:se((Te(e.risk)||xe(e.risk))&&`font-medium text-content!`),children:Se(e.risk,c)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,V.jsx)(`dd`,{children:we({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,V.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,V.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,V.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,V.jsx)(Pe,{value:k,testing:I,onChange:A,onTest:Ve}),!e.pluginBuiltIn&&(0,V.jsxs)(T,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Ue()&&U(e),children:[(0,V.jsx)(ee,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,V.jsx)(pe,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,V.jsx)(Fe,{query:p,notify:e,requestText:n,requestConfirm:s})]}):J?(0,V.jsx)(fe,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:J,action:(0,V.jsx)(T,{variant:`secondary`,className:`max-[650px]:h-11`,loading:Ie,disabled:Ie,onClick:()=>{Le(!0),Z().finally(()=>Le(!1))},children:c(`common:pageTemplate.retry`)})}):(0,V.jsx)(fe,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,V.jsx)(Ee,{open:Ce,onOpenChange:R,onInstalled:Z}),(0,V.jsx)(oe,{open:!!H,onOpenChange:e=>!e&&!W&&U(null),children:(0,V.jsxs)(te,{className:`z-[220]`,children:[(0,V.jsxs)(ae,{children:[(0,V.jsx)(w,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,V.jsx)(C,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:H?.pluginName||``})})]}),(0,V.jsxs)(re,{children:[(0,V.jsx)(ie,{disabled:W,children:c(`common:ui.cancel`)}),(0,V.jsxs)(ne,{variant:`destructive`,disabled:W,onClick:We,children:[W&&(0,V.jsx)(ce,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),J&&h&&(0,V.jsxs)(ve,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,V.jsx)(x,{size:13}),J]})]})}export{J as PluginsPage};
@@ -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-8V6eRMcE.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-D23yIdOZ.js";import{t as d}from"./safe-mode-instance-CYIRMY5i.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
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-CbqEZb3r.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-C6pJ93kY.js";import{t as d}from"./safe-mode-instance-DlkQOfml.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u 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-8V6eRMcE.js";import{t as a}from"./api-Cm58F7OP.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-D6FLo7O1.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{t as f}from"./message-circle-D-XrK6Ft.js";import{t as p}from"./play-DNDjDNGn.js";import{t as m}from"./plus-fQbSqB1n.js";import{t as h}from"./send-Cj-W03w_.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-DRfz9B_B.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-D23yIdOZ.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-DS_-qn8W.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-C0bAQ4el.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-DQYKUW5E.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:h}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,date:e.date||``,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function ge(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[h,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===h),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===h).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,h]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(m,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=h===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:m,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(p,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:m,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[h,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:h,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:h,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,h,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(m,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u 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-CbqEZb3r.js";import{t as a}from"./api-BET28sp7.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-DjW-sAP5.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{t as f}from"./message-circle-D-XrK6Ft.js";import{t as p}from"./play-DNDjDNGn.js";import{t as m}from"./plus-fQbSqB1n.js";import{t as h}from"./send-Cj-W03w_.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-CctXrljf.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-C6pJ93kY.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-BRdpqAVu.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-D2NZ4cLC.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-DQYKUW5E.js";import{i as L,s as R}from"./app-primitives-BskZ4ZJj.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:h}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,date:e.date||``,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function ge(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[h,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===h),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===h).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,h]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(m,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=h===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:m,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(p,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:m,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[h,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:h,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:h,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,h,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(m,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-DDd2yMvx.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CbqEZb3r.js","assets/i18n-CYOV8NO5.js","assets/vendor-router-CSN_DGvx.js","assets/index-B446sLQy.js","assets/index-Fb-GT4ka.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-BrkEbuk_.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-ByuB7q2B.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-Cz6vFMXv.js","assets/AppSelect-DQYKUW5E.js","assets/use-mobile-C2tPBAza.js","assets/select-Bbk9bmXO.js","assets/check-2vYc6QaP.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/chevrons-up-down-C2sEPdAh.js","assets/dist-BsRXXcSL.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/dist-BS3ekNDj.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-BHe6CquN.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-CFAdIi3l.js","assets/api-BET28sp7.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-DHqWBecB.js","assets/event-stream-DujJnWl2.js","assets/http-Da7z8Zhw.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-DsgBuvJv.js","assets/dist-BaBySQmo.js","assets/format-DMJQzoZ7.js","assets/dialog-C6pJ93kY.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-CggW-dCt.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.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-CbqEZb3r.js";import{o as a}from"./vendor-state-GkUciC5H.js";import{t as o}from"./useQuery-DfOU-27z.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./arrow-right-DqLOhpA2.js";import{t as u}from"./arrow-up-DST6-qVQ.js";import{t as d}from"./check-2vYc6QaP.js";import{t as f}from"./chevron-down-CxtxIjiP.js";import{t as p}from"./chevron-right-C3t2Rckj.js";import{t as m}from"./download-BCfIiuaL.js";import{t as h}from"./earth-Ddy13fHh.js";import{t as g}from"./external-link-CEQqPcqc.js";import{a as _}from"./GitDiffViewer-DDd2yMvx.js";import{t as v}from"./file-Bllajneu.js";import{a as y,c as b,i as ee,o as x,r as S,s as C,y as w}from"./side-chat-context-oyi3ytlS.js";import{t as T}from"./git-branch-N7LGjtzt.js";import{y as E}from"./ChatMessage-BA6Yf2bc.js";import{t as D}from"./image-BY_c3FYU.js";import{t as O}from"./link-2-mgasYn21.js";import{t as k}from"./loader-circle-BOwQzHB-.js";import{t as te}from"./message-square-SKjZyY3v.js";import{t as A}from"./pause-CYWpPg1R.js";import{t as j}from"./refresh-cw-TbWxTY4K.js";import{t as M}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as ne}from"./square-bHHVTT3G.js";import{t as N}from"./trash-2-CNrPOoPR.js";import{t as re}from"./triangle-alert-CE1q54ci.js";import"./collapsible-B-fc7n0u.js";import{a as ie,c as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./alert-dialog-DiUitBB0.js";import{a as fe,r as pe,t as me}from"./popover-Bz5EGqVg.js";import"./tooltip-D4MFbqcG.js";import{t as P}from"./utils-C8uzG5AZ.js";import{n as F,t as I}from"./button-CCcCN8tE.js";import{c as he,r as ge}from"./shortcuts-CctXrljf.js";import{t as L}from"./chat-api-DwR_1yAu.js";import{a as _e,i as ve,n as ye,o as be,r as xe,t as Se}from"./command-DQJks9Cg.js";import{t as R}from"./input-CPw-zkYh.js";import{n as Ce}from"./session-change-summary-api-5OOAmNzo.js";import{n as we,t as z}from"./PageState-Cz6vFMXv.js";import{n as Te,t as Ee}from"./alert-DRIrgNI4.js";import{t as De}from"./AppSelect-DQYKUW5E.js";import{o as B}from"./session-tree-summary-_F4a4OX7.js";import{a as V,i as H,o as Oe,s as ke,t as Ae}from"./session-web-preview-NBd9P7Kp.js";import{i as je,n as Me,r as U,t as Ne}from"./web-preview-C7DdG9JP.js";import{n as Pe}from"./useNativeBrowser-C0j3zafh.js";var Fe=s(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ie=s(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),W=s(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Le=s(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),G=e(n(),1),K=r(),Re={completed:`completed`,in_progress:`running`,paused:`pending`,blocked:`blocked`,pending:`pending`};function ze(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function Be({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`paused`?`chat:planBoard.paused`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,K.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${Re[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,K.jsx)(d,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,K.jsx)(F,{className:`size-3.5`}):e===`paused`?(0,K.jsx)(A,{size:11,strokeWidth:2}):e===`blocked`?(0,K.jsx)(W,{size:11,strokeWidth:2}):(0,K.jsx)(Fe,{size:11,strokeWidth:2}),(0,K.jsx)(`span`,{className:`sr-only`,children:n})]})}function Ve({item:e,current:t,running:n,t:r}){return(0,K.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,K.jsx)(Be,{status:e.blocked?`blocked`:e.status===`in_progress`&&!n?`paused`:e.status,t:r}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,K.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:r(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,K.jsx)(w,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,K.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:r(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,K.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,K.jsx)(W,{size:11,className:`flex-none`}),(0,K.jsx)(`span`,{className:`truncate`,children:r(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function He({plan:e,running:t,header:n,collapsible:r=!1}){let{t:a}=i(),o=(0,G.useRef)(null),[s,c]=(0,G.useState)(!0),l=e?.items||[],u=ze(l),d=u.filter(e=>e.status===`completed`).length,p=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,m=u.filter(e=>e.blocked).length,h=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,G.useLayoutEffect)(()=>{if(r&&!s)return;let e=o.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<n.top?e.scrollTop-=n.top-i.top:i.bottom>n.bottom&&(e.scrollTop+=i.bottom-n.bottom)},[r,h,s,u.length]),!l.length)return null;let g=u.find(e=>e.id===h),_=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ie,{className:`flex-none text-content-muted`,size:15}),(0,K.jsx)(`strong`,{className:`tabular-nums`,children:a(`chat:planBoard.progress`,{completed:d,total:l.length})}),g?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:g.title,children:g.title}):null,(0,K.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[p>0&&(0,K.jsx)(`span`,{children:a(t?`chat:planBoard.countInProgress`:`chat:planBoard.countPaused`,{count:p})}),m>0&&(0,K.jsx)(`span`,{className:`blocked text-danger`,children:a(`chat:planBoard.countBlocked`,{count:m})})]}),n,r?(0,K.jsx)(f,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),v=(0,K.jsx)(`ul`,{ref:o,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,K.jsx)(Ve,{running:t,item:e,current:e.id===h,t:a},e.id))});return r?(0,K.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:s,onToggle:e=>c(e.currentTarget.open),children:[(0,K.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":a(`chat:planBoard.toggleAriaLabel`),children:_}),v]}):(0,K.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":a(`chat:planBoard.ariaLabel`),children:[(0,K.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:_}),v]})}var Ue=(0,G.memo)(He),We=(0,G.lazy)(()=>t(()=>import(`./GitDiffViewer-DDd2yMvx.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function q({sessionId:e,path:t,scope:n,revision:r=0,position:a,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=o({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?L.getFileDiff(e,t,{signal:r}):L.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,K.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,K.jsx)(F,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,K.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,K.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(We,{position:a,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function Ge({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:a}){let{t:s}=i(),c=o({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>L.getVcsChanges(e,{signal:t})}),l=_(r.reading?.list,e=>a({reading:{...r.reading,list:e}})),u=(0,G.useMemo)(()=>C(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),d=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),f=c.error?.message||c.data?.error,m=c.data?.files||[];return(0,K.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,K.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!f&&(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,u.added]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.removed]})]}),(0,K.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,K.jsx)(j,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,K.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,K.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,K.jsx)(T,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,K.jsxs)(`div`,{className:`flex gap-1`,children:[(0,K.jsx)(I,{variant:`ghost`,size:`sm`,disabled:!m.length||!!f,onClick:()=>a({expandedFiles:m.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,K.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>a({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!f&&d.map(e=>(0,K.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,K.jsx)(we,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):f?(0,K.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:f}):c.data?.isRepo?m.length?(0,K.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:m.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,K.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,K.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>a({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,K.jsx)(p,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,K.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(u.files,t.path)&&(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,u.files[t.path].added]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.files[t.path].removed]})]})]}),n&&(0,K.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,K.jsx)(q,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>a({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,K.jsx)(z,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,K.jsx)(z,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function J(e){return e instanceof Error?e.message:String(e)}function Ke({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,G.useState)(0),[s,c]=(0,G.useState)(0),[l,u]=(0,G.useState)(null),[d,f]=(0,G.useState)(!0),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(null),[ee,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),w=(0,G.useRef)(!1),T=(0,G.useRef)(0),E=(0,G.useRef)(0),D=(0,G.useRef)(!0),O=(0,G.useRef)(!1),k=(0,G.useRef)(t);return(0,G.useLayoutEffect)(()=>{k.current=t},[t]),(0,G.useLayoutEffect)(()=>(w.current=!0,()=>{w.current=!1,T.current+=1,E.current+=1}),[]),(0,G.useEffect)(()=>{let t=++T.current;return E.current+=1,x(null),C(null),D.current=!0,f(!0),m(``),L.getSessionFileChanges(e).then(e=>{w.current&&t===T.current&&(u(e),c(e=>e+1))},e=>{w.current&&t===T.current&&m(J(e))}).finally(()=>{w.current&&t===T.current&&(D.current=!1,f(!1))}),()=>{T.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:ee,setDiff:x,diffLoading:S,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(O.current||D.current)return;let n=++E.current;C(t),g(``);try{let i=await L.getSessionFileChangeDiff(e,t);if(!w.current||n!==E.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}x({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){w.current&&n===E.current&&g(J(e))}finally{w.current&&n===E.current&&C(null)}},runAction:async t=>{if(!w.current||O.current||D.current||k.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;O.current=!0,b(t),g(``),v(``);let i=++T.current;E.current+=1,x(null),C(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!w.current||k.current||D.current||i!==T.current)return;a=!0;let o=t.kind===`approve`?await L.approveSessionFileChanges(e,t.path):await L.revertSessionFileChanges(e,t.path);if(Ce(e),!w.current||i!==T.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){w.current&&i===T.current&&g(J(e))}finally{O.current=!1,w.current&&(b(null),a&&(D.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{D.current=!0,f(!0),g(``),o(e=>e+1)}}}var qe=(0,G.lazy)(()=>t(()=>import(`./TaskTerminalView-ByuB7q2B.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,19,10,20,14,13,15,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),Je=(0,G.lazy)(()=>t(()=>import(`./TaskProcessesPane-BHe6CquN.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,39,10,19,20,40,25,15,29,34,12,13,14,21,22,23,24,26,27,28,30,31,32,33,35,36]))),Ye=(0,G.lazy)(()=>t(()=>import(`./FileAttachmentPreview-CFAdIi3l.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,42,43,44,45,46,47,10,48,49,11,50,13,29,15,31,51,12,14,52,53,54,32,55,56,57,58,59,25,60,61])));function Xe({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=_(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,G.useContext)(b),[s,c]=(0,G.useState)(``),l=(0,G.useRef)(null),u=e.find(e=>e.id===s),d=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,K.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,K.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,K.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,K.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,K.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,K.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,K.jsx)(R,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,K.jsxs)(De,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,K.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,K.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,K.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,K.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,K.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!d.length&&(0,K.jsx)(z,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),d.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?D:e.method===`path`?O:v;return(0,K.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,K.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,K.jsx)(p,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,K.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,K.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,K.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,K.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,K.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,K.jsx)(I,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),u&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Ye,{attachment:u.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof u.attachment.downloadUrl==`string`&&window.open(u.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}var Ze=`https://www.bing.com/search?q=`;function Qe(e){let t=e.split(`.`);return t.length===4&&t.every(e=>/^\d{1,3}$/.test(e)&&Number(e)<=255)}function $e(e){let t=e.split(/[/?#]/,1)[0]??``;if(!t||t.includes(`@`))return null;if(t.startsWith(`[`))return/^\[[\da-f:.]+\](?::\d{1,5})?$/i.test(t)?t:null;let n=/^([^:]+)(?::(\d{1,5}))?$/.exec(t);return n?n[1]:null}function et(e){if(/\s/.test(e))return null;let t=$e(e);if(!t)return null;let n=t.toLowerCase();if(n.startsWith(`[`)||n===`localhost`||n.endsWith(`.localhost`)||Qe(n))return`local`;let r=n.split(`.`);if(r.length<2||r.some(e=>!/^[\p{L}\p{N}-]+$/u.test(e)))return null;let i=r[r.length-1];return/^(?:\p{L}{2,}|xn--[a-z\d-]+)$/u.test(i)?`public`:null}function tt(e){return`${Ze}${encodeURIComponent(e)}`}function Y(e,t){let n=e.trim();if(!n)return null;if(/^https?:/i.test(n)||n.startsWith(`//`)){let e=U(n,t);return e?{kind:`url`,url:e}:null}let r=et(n);if(r===`local`){let e=je(`http://${n}`,t)?.href;if(e)return{kind:`url`,url:e}}else if(r===`public`){let e=U(n,t);if(e)return{kind:`url`,url:e}}return{kind:`search`,url:tt(n)}}function nt({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:s}=S(e),c=r.session?.id??``,l=(0,G.useMemo)(()=>e=>a.subscribeSessionState(c,e),[a,c]),d=(0,G.useMemo)(()=>()=>a.getSessionState(c),[a,c]),f=(0,G.useSyncExternalStore)(l,d),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(``),b=(0,G.useRef)(!1),C=(0,G.useRef)(!1),w=(0,G.useRef)(r.draft);w.current=r.draft;let T=(0,G.useRef)(null),D=he(e=>e.bindings),O=ee(f,r.session);(0,G.useEffect)(()=>{t&&o(e)},[t,o,e]);let k=async t=>{t.preventDefault();let n=w.current.trim();if(!(!n||b.current||O||r.expired)){b.current=!0,m(!0),v(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;w.current.trim()===n&&s(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){v(B(e))}finally{b.current=!1,m(!1)}}},A=(0,G.useCallback)(async()=>{if(!(!c||a.getSessionState(c).streaming)){v(``);try{await a.retry(c),await o(e)}catch(e){v(B(e))}}},[o,e,a,c]),j=async()=>{if(!(!c||h)){g(!0);try{v(``),await a.abort(c)}catch(e){v(B(e))}finally{g(!1)}}},M=(0,K.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,K.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,K.jsx)(te,{className:`size-4`,"aria-hidden":`true`})}),(0,K.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,K.jsxs)(I,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&T.current?.focus()},children:[r.loading&&(0,K.jsx)(F,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),N=_||r.error||f.error;return(0,K.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,K.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),c?(0,K.jsx)(x,{sessionId:c,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:M,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:O,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(c),onRetryLastTurn:A}):(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:M}),(0,K.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:k,children:[N&&(0,K.jsx)(E,{error:N,onRetry:r.error||!f.loaded?async()=>{await o(e)}:A}),(0,K.jsx)(y,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(c,e,t)}catch{}}}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,K.jsx)(`textarea`,{ref:T,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>s(e,t.target.value),onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:e=>{!C.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&ge(e.nativeEvent,D.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,K.jsx)(I,{type:O?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(O?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:O?h:p||r.loading||r.expired||!r.draft.trim(),onClick:O?()=>void j():void 0,children:p||h?(0,K.jsx)(F,{className:`size-4 text-current`}):O?(0,K.jsx)(ne,{size:13,fill:`currentColor`}):(0,K.jsx)(u,{size:17})})]})]})]})}var rt=(0,G.createContext)(null),it=()=>{let e=(0,G.useContext)(rt);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},at=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,G.useState)(n),[s,c]=(0,G.useState)(!1),l=(0,G.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,G.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,K.jsx)(rt.Provider,{value:u,children:(0,K.jsx)(`div`,{className:P(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},ot=({className:e,loading:t,src:n,...r})=>{let{url:i}=it();return(0,K.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,K.jsx)(`iframe`,{className:P(`block size-full border-0 bg-background`,e),loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-presentation`,src:(n??i)||void 0,title:`Preview`,...r}),t]})},X=1e6;function st(e,t,n,r,i){let a=V(t,i);if(!a)return e;let o=e.find(e=>e.url===a);return[{url:a,title:H(n)||o?.title||``,lastVisitedAt:Math.max(r,o?.lastVisitedAt??0),visits:Math.min(X,(o?.visits??0)+1)},...e.filter(e=>e.url!==a)].slice(0,500)}function ct(e,t,n,r){let i=V(t,r),a=H(n);if(!i||!a)return e;let o=e.findIndex(e=>e.url===i);return o<0||e[o].title===a?e:e.map((e,t)=>t===o?{...e,title:a}:e)}function lt(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=V(t.url);if(!n)return null;let r=typeof t.lastVisitedAt==`number`&&Number.isSafeInteger(t.lastVisitedAt)?Math.max(0,t.lastVisitedAt):0,i=typeof t.visits==`number`&&Number.isSafeInteger(t.visits)?Math.min(X,Math.max(1,t.visits)):1;return{url:n,title:H(t.title),lastVisitedAt:r,visits:i}}function ut(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!t||typeof t!=`object`||Array.isArray(t))return[];let n=t;if(n.version!==1||!Array.isArray(n.entries))return[];let r=new Map;for(let e of n.entries.slice(0,1e3)){let t=lt(e);if(!t)continue;let n=r.get(t.url);n?r.set(t.url,{url:t.url,title:(n.lastVisitedAt>=t.lastVisitedAt?n:t).title,lastVisitedAt:Math.max(n.lastVisitedAt,t.lastVisitedAt),visits:Math.min(X,n.visits+t.visits)}):r.set(t.url,t)}return[...r.values()].sort((e,t)=>t.lastVisitedAt-e.lastVisitedAt).slice(0,500)}function dt(e){let t=e.slice(0,500);if(!t.length)return null;let n=new TextEncoder,r=JSON.stringify({version:1,entries:t});for(;n.encode(r).byteLength>327680&&t.length;)t.splice(-Math.max(1,Math.ceil(t.length/10))),r=JSON.stringify({version:1,entries:t});return t.length?r:null}function ft(e,t){let n=new Date(t);n.setHours(0,0,0,0);let r=n.getTime(),i=new Date(n);i.setDate(i.getDate()-1);let a=new Date(n);a.setDate(a.getDate()-6);let o={today:[],yesterday:[],week:[],earlier:[]};for(let t of e)o[t.lastVisitedAt>=r?`today`:t.lastVisitedAt>=i.getTime()?`yesterday`:t.lastVisitedAt>=a.getTime()?`week`:`earlier`].push(t);return[`today`,`yesterday`,`week`,`earlier`].filter(e=>o[e].length).map(e=>({key:e,entries:o[e]}))}function pt(e){try{return new URL(e).host}catch{return e.slice(0,200)}}var mt=`pisper-browser-history`,ht=1e3,gt=()=>typeof window>`u`?void 0:window.location.origin,_t=ke(mt),Z=Oe(mt,ht);Z.noteStored(_t);var Q=()=>Z.schedule(()=>dt($.getState().entries)),$=a(e=>({entries:ut(_t),visit:(t,n=``)=>{let r=!1;e(e=>{let i=st(e.entries,t,n,Date.now(),gt());return r=i!==e.entries,r?{entries:i}:e}),r&&Q()},title:(t,n)=>{let r=!1;e(e=>{let i=ct(e.entries,t,n,gt());return r=i!==e.entries,r?{entries:i}:e}),r&&Q()},clear:()=>{e({entries:[]}),Q(),Z.flush()}}));function vt({onOpen:e}){let{t}=i(),n=$(e=>e.entries),[r,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(!1),c=(0,G.useRef)(null),l=t(`common:webPreview.history`),u={today:t(`common:webPreview.historyToday`),yesterday:t(`common:webPreview.historyYesterday`),week:t(`common:webPreview.historyWeek`),earlier:t(`common:webPreview.historyEarlier`)},d=r?ft(n,Date.now()):[];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(me,{open:r,onOpenChange:a,children:[(0,K.jsx)(fe,{asChild:!0,children:(0,K.jsx)(I,{ref:c,type:`button`,variant:`ghost`,size:`icon`,"aria-label":l,title:l,children:(0,K.jsx)(M,{size:14})})}),(0,K.jsx)(pe,{align:`end`,className:`w-80 gap-0 p-0`,children:n.length?(0,K.jsxs)(Se,{className:`bg-transparent`,children:[(0,K.jsx)(ve,{placeholder:t(`common:webPreview.historySearch`)}),(0,K.jsxs)(be,{className:`max-h-80`,children:[(0,K.jsx)(ye,{className:`py-0`,children:(0,K.jsx)(z,{compact:!0,title:t(`common:webPreview.historyNoMatch`)})}),d.map(t=>(0,K.jsx)(xe,{heading:u[t.key],children:t.entries.map(t=>{let n=pt(t.url);return(0,K.jsx)(_e,{value:t.url,keywords:t.title?[t.title]:void 0,title:t.url,onSelect:()=>{a(!1),e(t.url)},children:(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:t.title||n}),(0,K.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:n})]})},t.url)})},t.key))]}),(0,K.jsx)(`div`,{className:`border-t border-stroke-soft p-1`,children:(0,K.jsxs)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`w-full justify-start text-danger`,onClick:()=>{a(!1),s(!0)},children:[(0,K.jsx)(N,{size:14}),t(`common:webPreview.clearHistory`)]})})]}):(0,K.jsx)(z,{compact:!0,icon:M,title:t(`common:webPreview.historyEmpty`)})})]}),(0,K.jsx)(de,{open:o,onOpenChange:s,children:(0,K.jsxs)(oe,{onCloseAutoFocus:e=>{e.preventDefault(),c.current?.focus()},children:[(0,K.jsxs)(ue,{children:[(0,K.jsx)(ae,{children:t(`common:webPreview.clearHistoryTitle`)}),(0,K.jsx)(ie,{children:t(`common:webPreview.clearHistoryDescription`)})]}),(0,K.jsxs)(ce,{children:[(0,K.jsx)(le,{children:t(`common:ui.cancel`)}),(0,K.jsx)(se,{variant:`destructive`,onClick:()=>$.getState().clear(),children:t(`common:webPreview.clearHistoryConfirm`)})]})]})})]})}function yt(e){let t=window.pisperDesktop;return!t||!/Windows|Macintosh/.test(navigator.userAgent)?null:t.browser?e?`failed`:null:`outdated`}function bt({sessionId:e,page:t,onChange:n,onClosed:r}){let{t:a}=i(),{draft:o,url:s}=t,[u,d]=(0,G.useState)(!1),f=(0,G.useRef)(``),p=e=>{!e||e===f.current||(f.current=e,$.getState().visit(e))},_=Pe({enabled:!!window.pisperDesktop?.browser,url:s,popupId:t.resourceId,keepAlive:t.agent,onNavigated:e=>{p(e),e!==s&&n(o===s?{url:e,draft:e}:{url:e})},onTitle:e=>{f.current&&$.getState().title(f.current,e),n({title:e})},onNewWindow:(t,n)=>Ae(e,t,n),onClosed:r}),v=yt(_.unavailable);return(0,G.useEffect)(()=>{_.active||!s||f.current===s||(f.current=s,$.getState().visit(s))},[_.active,s]),(0,K.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":a(`common:webPreview.title`),children:[(0,K.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let t=Y(o,window.location.href);d(!t),t&&n(t.kind===`search`?{url:t.url,draft:t.url}:{url:t.url})},children:[_.active&&(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,K.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.back`),title:a(`common:webPreview.back`),onClick:()=>_.act(`back`),children:(0,K.jsx)(c,{size:14})}),(0,K.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.forward`),title:a(`common:webPreview.forward`),onClick:()=>_.act(`forward`),children:(0,K.jsx)(l,{size:14})}),(0,K.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.reload`),title:a(`common:webPreview.reload`),"aria-busy":_.loading,onClick:()=>_.act(`reload`),children:_.loading?(0,K.jsx)(k,{size:14,className:`animate-spin`}):(0,K.jsx)(Le,{size:14})})]}),(0,K.jsx)(R,{"aria-label":a(`common:webPreview.url`),className:`flex-1 font-mono`,value:o,onChange:e=>n({draft:e.target.value}),placeholder:a(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,K.jsx)(I,{type:`submit`,variant:`secondary`,children:a(`chat:sessionContext.openUrl`)}),(0,K.jsx)(vt,{onOpen:e=>n({url:e,draft:e})})]}),u&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a(`chat:sessionContext.invalidUrl`)}),_.active?(0,K.jsx)(`div`,{ref:_.slotRef,role:`group`,"aria-label":a(`common:webPreview.title`),"aria-busy":_.loading,"data-native-browser-slot":!0,className:`min-h-0 flex-1 overflow-hidden rounded-md border border-stroke bg-background`}):s?(0,K.jsx)(at,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:s,children:(0,K.jsx)(ot,{src:s,title:a(`common:webPreview.title`),...Me(s)?{sandbox:Ne}:{}})},s):(0,K.jsx)(z,{icon:h,className:`min-h-0 flex-1`,title:a(`chat:sessionContext.browserEmpty`)}),s&&(0,K.jsxs)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(s,`_blank`,`noopener,noreferrer`),children:[(0,K.jsx)(g,{size:14}),a(`common:webPreview.openExternal`)]}),!_.active&&v&&s&&(0,K.jsxs)(Ee,{"data-native-browser-fallback":v,children:[(0,K.jsx)(re,{}),(0,K.jsxs)(Te,{className:`flex flex-col items-start gap-2`,children:[a(v===`outdated`?`common:webPreview.shellOutdated`:`common:webPreview.nativeFailed`),v===`outdated`&&(0,K.jsxs)(I,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void window.pisperDesktop?.openReleases(),children:[(0,K.jsx)(m,{size:14}),a(`common:webPreview.downloadDesktop`)]})]})]}),!_.active&&!(v&&s)&&(0,K.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`common:webPreview.embedNotice`)})]})}export{Je as a,Ge as c,Xe as i,q as l,nt as n,qe as o,Y as r,Ke as s,bt as t,Ue as u};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-DDd2yMvx.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CbqEZb3r.js","assets/i18n-CYOV8NO5.js","assets/vendor-router-CSN_DGvx.js","assets/index-B446sLQy.js","assets/index-Fb-GT4ka.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-BrkEbuk_.js","assets/esm-DCV8yILT.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-CbqEZb3r.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-1qxTCxHV.js";import{t as s}from"./activity-BCxvXCG3.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./SessionBrowserPane-C0P_zk8r.js";import{t as x}from"./earth-Ddy13fHh.js";import{a as S,o as C}from"./GitDiffViewer-DDd2yMvx.js";import{b as w}from"./side-chat-context-oyi3ytlS.js";import{t as T}from"./undo-2-ChaURM4t.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./list-todo-hpikYm6Q.js";import{t as O}from"./message-square-SKjZyY3v.js";import{t as k}from"./plus-fQbSqB1n.js";import{t as A}from"./refresh-cw-TbWxTY4K.js";import{t as j}from"./square-terminal-BVG6cUT1.js";import{t as M}from"./x-07u4-129.js";import{n as N,t as P}from"./button-CCcCN8tE.js";import{s as F}from"./events-BrkEbuk_.js";import{a as I,n as L,o as ee,t as te}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{l as ne,r as V,u as re}from"./session-web-preview-NBd9P7Kp.js";import"./public-WgIAq7m6.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-DDd2yMvx.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=S(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),f=r?.expandedFiles||c,p=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:g,running:_,diff:y,setDiff:b,diffLoading:x,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:k,notice:j,viewDiff:M,runAction:F,refresh:I}=v({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":g||!!_,children:[(0,U.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:g||!!_,onClick:I,children:(0,U.jsx)(A,{className:g?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(P,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void F({kind:`approve`}),children:[_?.kind===`approve`&&!_.path?(0,U.jsx)(A,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(P,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void F({kind:`revert`}),children:[_?.kind===`revert`&&!_.path?(0,U.jsx)(A,{className:`animate-spin`,size:14}):(0,U.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(P,{variant:`ghost`,size:`sm`,disabled:g||!h?.files.length,onClick:()=>p(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>p([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),j&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:j}),g&&!h?(0,U.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=f.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:g||!!_,"aria-busy":x===t.path,"aria-expanded":n,onClick:()=>p(n?f.filter(e=>e!==t.path):[...f,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),x===t.path?(0,U.jsx)(N,{className:`size-3.5`}):(0,U.jsx)(C,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void F({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void F({kind:`revert`,path:t.path}),children:(0,U.jsx)(T,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(m,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,U.jsx)(P,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void M(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=_(a,window.location.href);c(!t),t&&n(t.url)},children:[(0,U.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(P,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(P,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:m=[],tab:_,plan:v,streaming:S,plansAvailable:T,requestConfirm:A,onTabChange:N,onClose:R,onBack:z}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:j,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:C,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:W(`chat:workbench.sources`)},{id:`files`,icon:w,label:W(`chat:workbench.taskSnapshots`)},...T?[{id:`plan`,icon:D,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:x,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:O,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>ne(_),[_]),J=V(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:k,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!V.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(F));let t=re(J,e);V.getState().update(l,_,e);let n=t.pages.find(e=>e.id===t.activeId);n&&N(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&R()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(k,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[z&&(0,U.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:z,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(M,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),V.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(f,{sessionId:l,cwd:u,streaming:S,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(p,{sources:m,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(g,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>V.getState().update(l,_,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(d,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{sessionId:l,page:t,onChange:e=>Z({type:`browser`,id:t.id,...e}),onClosed:()=>Z({type:`close`,id:t.id})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:S,requestConfirm:A}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:v?.items?.length?(0,U.jsx)(b,{plan:v,running:S}):(0,U.jsx)(B,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(te,{open:!0,onOpenChange:e=>!e&&R(),children:(0,U.jsxs)(L,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(I,{className:`sr-only`,children:(0,U.jsx)(ee,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{h as i,t as a}from"./routes-BYsK6aeM.js";import{t as o}from"./use-i18n-CbqEZb3r.js";import{n as s,t as c}from"./usePhoneShell-BDH8-EY7.js";import{t as l}from"./button-CCcCN8tE.js";import{t as u}from"./useSessionListQuery-D8hWYbAp.js";import"./public-bzVRS_Ps.js";import{PhoneMenuButton as d}from"./PhoneMenuButton-DbsLKxdG.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-fCQ4eKhT.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=u(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(d,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(l,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(l,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
@@ -0,0 +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-CbqEZb3r.js";import{t as i}from"./useQuery-DfOU-27z.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-1qxTCxHV.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./bot-B3TaBp_T.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-down-CxtxIjiP.js";import{a as d,i as f,l as p,n as m,o as h,s as g,t as _,u as v}from"./SessionBrowserPane-C0P_zk8r.js";import{t as y}from"./corner-down-left-DalpwXuX.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as x}from"./ellipsis-CfGKfbq6.js";import{o as S}from"./GitDiffViewer-DDd2yMvx.js";import{b as ee,o as C,s as w}from"./side-chat-context-oyi3ytlS.js";import{t as T}from"./git-branch-N7LGjtzt.js";import{_ as E,a as D,c as O,f as k,g as te,h as ne,l as re,o as ie,p as A,s as ae,y as oe}from"./ChatMessage-BA6Yf2bc.js";import{t as j}from"./undo-2-ChaURM4t.js";import{t as M}from"./list-todo-hpikYm6Q.js";import{t as se}from"./message-square-SKjZyY3v.js";import{t as ce}from"./plus-fQbSqB1n.js";import{t as N}from"./refresh-cw-TbWxTY4K.js";import{t as le}from"./square-terminal-BVG6cUT1.js";import{t as ue}from"./square-bHHVTT3G.js";import{t as P}from"./x-07u4-129.js";import{c as F,i as I,p as de,r as L,t as R}from"./dropdown-menu-Ds0gD8S8.js";import{a as fe,r as pe,t as me}from"./popover-Bz5EGqVg.js";import{a as z,i as B,n as he,r as ge,t as V}from"./select-Bbk9bmXO.js";import{t as _e}from"./segmented-control-xkrEOP_d.js";import{t as H}from"./utils-C8uzG5AZ.js";import{t as U}from"./button-CCcCN8tE.js";import{t as ve}from"./chat-api-DwR_1yAu.js";import{a as W,r as G}from"./format-DMJQzoZ7.js";import{t as K}from"./StatusGlyph-1KgitlUg.js";import{t as ye}from"./session-change-summary-api-5OOAmNzo.js";import{n as be,t as q}from"./PageState-Cz6vFMXv.js";import{i as xe,n as Se,r as Ce}from"./MarkdownMessage-CggW-dCt.js";import{t as we}from"./route-context-DvWDul4T.js";import{o as Te}from"./session-tree-summary-_F4a4OX7.js";import{c as Ee,r as J}from"./session-web-preview-NBd9P7Kp.js";import"./public-WgIAq7m6.js";import{n as De}from"./terminal-context-aIsIJPn8.js";import{r as Y}from"./session-inspector-store-Dk8BXrxC.js";import{t as Oe}from"./subagent-view-store-BUvI8piR.js";import{o as X}from"./web-preview-C7DdG9JP.js";var ke=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Ae=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Z=e(t(),1),Q=n(),je={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function $(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function Me(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function Ne({title:e,children:t}){return(0,Q.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function Pe({status:e,name:t,detail:n,t:r}){let i=je[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,Q.jsx)(K,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,Q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,Q.jsx)(`span`,{className:`flex-none text-content-muted`,children:$(e,r)})]}),n&&(0,Q.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function Fe(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function Ie({plan:e,streaming:t,goal:n,team:i,activity:a}){let{t:o}=r(),s=Array.isArray(i?.tasks)?i.tasks:[],c=Fe(a),l=!!(n?.id&&String(n.objective||``).trim()),u=!!e?.items?.length;if(!l&&!u&&!s.length&&!c.length)return(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,Q.jsx)(q,{compact:!0,icon:M,title:o(`chat:sessionContext.planEmpty`)})});let d=Number(n?.mode===`team`?n?.teamTokenBudget:n?.tokenBudget)||0;return(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[l&&n&&(0,Q.jsx)(Ne,{title:o(`board:inspector.goal`),children:(0,Q.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(n.objective)}),(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,Q.jsx)(`span`,{children:Me(n,o)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{children:d>0?o(`chat:focusSession.usedBudgetTokensUsed`,{used:G(n.tokensUsed),budget:G(d)}):o(`chat:focusSession.usedUnlimitedGoalTokens`,{used:G(n.tokensUsed)})})]})]})}),u&&(0,Q.jsx)(Ne,{title:o(`board:inspector.plan`),children:(0,Q.jsx)(v,{plan:e,running:t})}),s.length>0&&(0,Q.jsx)(Ne,{title:o(`board:inspector.team`),children:(0,Q.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,Q.jsx)(Pe,{status:e.status,name:e.taskName||o(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:o},e.id||`${e.taskName}-${t}`))})}),c.length>0&&(0,Q.jsx)(Ne,{title:o(`board:inspector.subAgents`),children:(0,Q.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:c.map((e,t)=>(0,Q.jsx)(Pe,{status:e.status,name:String(e.taskName||``).trim()||o(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:o},String(e.id||t)))})})]})}function Le({panelId:e,sessionId:t}){let{t:n}=r(),i=J(e=>e.sessions[t]),a=i?.pages,o=a?.filter(e=>e.kind===`browser`)??[],s=(i&&Ee(i))?.id??``,l=(a?.length??0)>=12,u=(0,Z.useRef)(null),[d,f]=(0,Z.useState)([]);s&&!d.includes(s)&&f([...d,s]),(0,Z.useEffect)(()=>{u.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.closest(`[data-browser-tab]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[s]);let p=t=>`${e}-browser-${t}-tab`,m=t=>`${e}-browser-${t}-panel`,h=e=>J.getState().update(t,`browser`,{type:`browser-tab`,id:e}),g=(e,t,n=``)=>requestAnimationFrame(()=>document.querySelector(`[id="${e(t)}"] ${n}`.trim())?.focus()),v=()=>{let e=J.getState(),n=e.sessions[t]?.contentOpen??!1;if(e.update(t,`browser`,{type:`add`,kind:`browser`})===`limit`)return;n||e.update(t,`browser`,{type:`workspace`,contentOpen:!1});let r=J.getState().sessions[t],i=r&&Ee(r);i&&g(m,i.id,`input`)},y=e=>{let n=J.getState();if(o.length===1){n.update(t,`browser`,{type:`browser`,id:e,url:``,draft:``,agent:!1}),n.update(t,`browser`,{type:`resource`,id:e,resourceId:``});return}n.update(t,`browser`,{type:`close`,id:e});let r=J.getState().sessions[t],i=r&&Ee(r);i&&g(p,i.id)};return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-stroke-soft px-3 py-1.5`,children:[(0,Q.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":n(`common:webPreview.tabs`),className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),s&&y(s);return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=o.findIndex(e=>e.id===s),n=e.key===`Home`?0:e.key===`End`?o.length-1:(t+(e.key===`ArrowRight`?1:-1)+o.length)%o.length,r=o[n];r&&(h(r.id),g(p,r.id))},children:o.map(e=>{let t=e.id===s,r=e.title||(e.url?X(e.url):n(`common:webPreview.newTab`)),i=o.length>1||!!(e.url||e.resourceId);return(0,Q.jsxs)(`div`,{"data-browser-tab":e.id,className:H(`flex min-w-20 flex-[0_1_10rem] items-center rounded-sm text-[13px] transition-colors duration-(--d-fast)`,t?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onAuxClick:t=>{t.button===1&&i&&y(e.id)},children:[(0,Q.jsxs)(`button`,{id:p(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":m(e.id),tabIndex:t?0:-1,title:e.url||r,className:H(`flex h-7 min-w-0 flex-1 items-center rounded-sm pl-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,!i&&`pr-2`),onClick:()=>h(e.id),children:[e.agent&&(0,Q.jsx)(c,{size:12,className:`mr-1 flex-none text-focus`,role:`img`,"aria-label":n(`common:webPreview.agentTab`)}),(0,Q.jsx)(`span`,{className:`truncate`,children:r})]}),i&&(0,Q.jsx)(`button`,{type:`button`,tabIndex:t?0:-1,"aria-label":`${n(`common:webPreview.closeTab`)} · ${r}`,className:`mx-0.5 grid size-5 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:size-11`,onClick:()=>y(e.id),children:(0,Q.jsx)(P,{size:12,"aria-hidden":`true`})})]},e.id)})}),(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none pointer-coarse:size-11`,disabled:l,"aria-label":n(`common:webPreview.newTab`),title:n(l?`chat:sessionContext.pageLimit`:`common:webPreview.newTab`),onClick:v,children:(0,Q.jsx)(ce,{"aria-hidden":`true`})})]}),o.filter(e=>d.includes(e.id)).map(e=>{let n=e.id===s;return(0,Q.jsx)(`div`,{id:m(e.id),role:`tabpanel`,"aria-labelledby":p(e.id),hidden:!n,className:n?`flex min-h-0 flex-1 flex-col`:`hidden`,children:(0,Q.jsx)(_,{sessionId:t,page:e,onChange:n=>J.getState().update(t,`browser`,{type:`browser`,id:e.id,...n}),onClosed:()=>y(e.id)})},e.id)})]})}var Re=100;function ze(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var Be={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Ve={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function He(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function Ue(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function We(e,t){window.dispatchEvent(new CustomEvent(we,{detail:{message:e,tone:t}}))}function Ge({added:e,removed:t}){return e===null||t===null?null:(0,Q.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Ke({status:e,children:t}){let{t:n}=r();return(0,Q.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,Q.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,Q.jsxs)(R,{children:[(0,Q.jsx)(de,{asChild:!0,children:(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,Q.jsx)(x,{"aria-hidden":`true`})})}),(0,Q.jsx)(L,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function qe({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,Q.jsxs)(`span`,{className:H(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Ve[e]),title:n,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:Be[e]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:n})]})}function Je({files:e,selected:t,label:n,onSelect:r}){let i=(0,Z.useRef)(null);return(0,Q.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,Re).map(e=>{let n=e.path===t,{directory:i,name:a}=He(e.path);return(0,Q.jsx)(`li`,{className:`px-1`,children:(0,Q.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Be[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:H(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,Q.jsx)(qe,{status:e.status}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,Q.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,Q.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,Q.jsx)(Ge,{added:e.added,removed:e.removed})]})},e.path)}),e.length>Re&&(0,Q.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,Q.jsx)(Ye,{count:e.length-Re})})]})}function Ye({count:e}){let{t}=r();return(0,Q.jsx)(Q.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Xe=600;function Ze({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:c}=r(),l=Y(e=>e.diffMode),u=Y(e=>e.setDiffMode),d=(0,Z.useRef)(null),[f,m]=(0,Z.useState)(0);(0,Z.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>m(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=f===0||f>=Xe,g=h?l:`unified`,_=h?void 0:c(`board:changes.splitTooNarrow`);return(0,Q.jsxs)(`section`,{ref:d,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,Q.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,Q.jsx)(qe,{status:t.status}),(0,Q.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,Q.jsx)(Ge,{added:t.added,removed:t.removed}),(0,Q.jsx)(_e,{size:`sm`,"aria-label":c(`board:changes.diffView`),title:_,"aria-description":_,value:g,onValueChange:u,options:[{value:`unified`,label:c(`board:changes.unified`)},{value:`split`,label:c(`board:changes.split`),disabled:!h}]})]}),(0,Q.jsx)(p,{sessionId:e,path:t.path,scope:n,revision:i,mode:g,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,Q.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function Qe({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=Ue(e,t);return(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await Ce(i,xe),We(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){We(e instanceof Se&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof Se&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,Q.jsx)(ke,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function $e(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function et(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function tt({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:u,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:h,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:x}=g({sessionId:e,streaming:n,requestConfirm:o}),S=u?.files??[],ee=i?.expandedFiles?.[0],C=S.find(e=>e.path===ee)??S[0],w=e=>a?.({expandedFiles:[e]}),T=(e,t)=>f?.kind===e&&f.path===t,E=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,Q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,Q.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:u?.summary.files??0})}),u&&u.summary.files>0&&(0,Q.jsx)(Ge,{added:u.summary.added,removed:u.summary.removed})]})}),v&&(0,Q.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,Q.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!u?(0,Q.jsx)(be,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):S.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Je,{files:S.map(e=>({...$e(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):et(e.formatChange,s)})),selected:C?.path??``,label:s(`board:changes.files`),onSelect:w}),C&&(0,Q.jsx)(Ze,{sessionId:e,file:$e(C),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:H(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,C.approved?`text-st-done`:`text-content-muted`),"data-change-state":C.reverted?`reverted`:C.approved?`approved`:`pending`,children:[C.approved&&!C.reverted&&(0,Q.jsx)(l,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),C.reverted?s(`board:changes.revertedAt`,{time:W(C.changedAt,c)}):C.approved?s(`board:changes.approvedAt`,{time:W(C.changedAt,c)}):s(`board:changes.pendingAt`,{time:W(C.changedAt,c)})]}),C.pending&&!C.approved&&!C.reverted&&(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:E,onClick:()=>void b({kind:`approve`,path:C.path}),children:[T(`approve`,C.path)?(0,Q.jsx)(N,{className:`animate-spin`}):(0,Q.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||C.reverted||!C.canRevert,title:E,onClick:()=>void b({kind:`revert`,path:C.path}),children:[T(`revert`,C.path)?(0,Q.jsx)(N,{className:`animate-spin`}):(0,Q.jsx)(j,{}),s(`board:changes.revertFile`)]}),(0,Q.jsx)(Qe,{cwd:t,path:C.path})]})})]}):!v&&(0,Q.jsx)(q,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,Q.jsxs)(Ke,{status:f?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):h>0?s(`board:changes.pending`,{count:h}):null,children:[h>0&&(0,Q.jsxs)(I,{disabled:m,title:E,onSelect:()=>void b({kind:`approve`}),children:[(0,Q.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(u?.summary.files??0)>0&&(0,Q.jsxs)(I,{disabled:m||_===0,title:E??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,Q.jsx)(j,{}),s(`board:changes.revertAll`)]}),(h>0||(u?.summary.files??0)>0)&&(0,Q.jsx)(F,{}),(0,Q.jsxs)(I,{disabled:d||!!f,onSelect:x,children:[(0,Q.jsx)(N,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function nt({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>ve.getVcsChanges(e,{signal:t})}),l=(0,Z.useMemo)(()=>w(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:ze(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,Q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,Q.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,Q.jsx)(Ge,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,Q.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,Q.jsx)(T,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,Q.jsx)(be,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,Q.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Je,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,Q.jsx)(Ze,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,Q.jsx)(Qe,{cwd:t,path:p.path})]})})]}):(0,Q.jsx)(q,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,Q.jsx)(q,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,Q.jsx)(Ke,{status:c.isFetching?(0,Q.jsx)(N,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,Q.jsxs)(I,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,Q.jsx)(N,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function rt({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,Q.jsx)(_e,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,Q.jsx)(nt,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,Q.jsx)(tt,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var it=2500,at=1500;function ot({agent:e}){let t=ie[e.status];return(0,Q.jsx)(K,{status:t.kind,spin:t.kind===`run`,className:H(`size-[15px] flex-none`,t.color)})}function st(e){let[t,n]=(0,Z.useState)(()=>Date.now());return(0,Z.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function ct(e,t){let n=e?Date.parse(e):NaN;return Number.isFinite(n)?new Date(n).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`}):``}function lt({sessionId:e,sheet:t=!1}){let{t:n,language:i}=r(),a=Oe(t=>t.selected[e]??``),s=Oe(e=>e.select),{agents:l,reload:d}=E(e,!0),f=o(e=>e.capabilities.features.agentTranscriptEvents),p=(0,Z.useMemo)(()=>l.filter(e=>e.kind!==`command`),[l]),m=p.find(e=>e.id===a),h=!!(m&&A(m)),g=st(h),[_,v]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(``),[S,ee]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),[ie,j]=(0,Z.useState)(0),M=m?.id??``,se=m?.status??``;(0,Z.useEffect)(()=>{v(null),x(``),ee(!1)},[M]),(0,Z.useEffect)(()=>{if(!M)return;let t=new AbortController,n=0;if(f){let r=!1,i=async()=>{let a=null;try{a=await te(e,M,e=>{r=!0,v(e),x(``)},t.signal)}catch(e){if(t.signal.aborted)return;if(!r){x(Te(e));return}}t.signal.aborted||a?.active===!1||(n=window.setTimeout(()=>void i(),at))};return i(),()=>{t.abort(),window.clearTimeout(n)}}let r=async()=>{try{let i=await k(e,M,t.signal);if(t.signal.aborted)return;v(i),x(``),i.active&&(n=window.setTimeout(r,it))}catch(e){t.signal.aborted||x(Te(e))}};return r(),()=>{t.abort(),window.clearTimeout(n)}},[M,ie,f,e,se]);let ce=(0,Z.useCallback)(async()=>{if(M){T(!0);try{await ne(e,M)}catch{}finally{T(!1),d()}}},[M,d,e]),N=(0,Z.useMemo)(()=>({model:``,name:m?.taskName??``}),[m?.taskName]),le=(0,Z.useMemo)(()=>_?.taskShown?_.messages.slice(1):_?.messages??[],[_]);if(!m)return(0,Q.jsx)(q,{compact:!0,icon:c,title:p.length?n(`board:subagent.pick`):n(`board:subagent.empty`)});let P=_?.task||m.message,F=[m.model.split(`/`).pop(),m.toolCallCount?n(`board:subagent.toolCalls`,{count:m.toolCallCount}):``,n(`board:subagent.startedAt`,{time:ct(m.startedAt,i)})].filter(Boolean).join(` · `),I;return I=b?(0,Q.jsx)(`div`,{className:`p-3`,children:(0,Q.jsx)(oe,{error:b,onRetry:()=>j(e=>e+1)})}):_?_.available?(0,Q.jsxs)(D.Provider,{value:N,children:[_.omitted>0&&(0,Q.jsx)(`p`,{className:`m-0 shrink-0 px-3 pt-2 text-xs text-content-muted`,children:n(`board:subagent.omitted`,{count:_.omitted})}),(0,Q.jsx)(C,{sessionId:`${e}:agent:${m.id}`,messages:le,transcriptLoadState:`ready`,emptyState:(0,Q.jsx)(q,{compact:!0,icon:c,title:n(`board:subagent.noMessages`)}),activityFeed:[],tools:[],streaming:_.active,readOnly:!0,onRetryLastTurn:()=>{}})]}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-3`,children:[(0,Q.jsx)(q,{compact:!0,icon:c,title:n(`board:subagent.notRecorded`)}),(m.output||m.error)&&(0,Q.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed whitespace-pre-wrap text-content`,children:m.error||m.output})]}):(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:n(`board:subagent.loading`)}),(0,Q.jsxs)(`section`,{"aria-label":n(`board:subagent.label`,{name:m.taskName}),"data-subagent-pane":m.id,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1.5 border-b border-stroke-soft px-3 pt-2.5 pb-2`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsxs)(V,{value:m.id,onValueChange:t=>s(e,t),children:[(0,Q.jsx)(B,{"aria-label":n(`board:subagent.switch`),className:`min-w-0 flex-1 font-mono text-[13px] font-semibold`,children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(he,{align:`start`,children:p.map(e=>(0,Q.jsxs)(ge,{value:e.id,children:[(0,Q.jsx)(ot,{agent:e}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[13px]`,children:e.taskName})]},e.id))})]}),(0,Q.jsxs)(`span`,{className:`flex-none text-xs text-content-muted tabular-nums`,children:[re(m.status,n),` ·`,` `,O(m.startedAt,m.completedAt,g)]}),h&&(0,Q.jsxs)(U,{type:`button`,variant:`secondary`,size:`sm`,className:`flex-none`,disabled:w,onClick:()=>void ce(),children:[(0,Q.jsx)(ue,{"aria-hidden":`true`}),n(`board:subagent.stop`)]})]}),(0,Q.jsx)(`p`,{className:`m-0 truncate px-1 text-xs text-content-muted`,children:h?`${ae(m,n)} · ${F}`:F}),P&&(0,Q.jsxs)(`div`,{className:`mt-1 rounded-md border border-stroke-soft bg-surface-subtle`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":S,className:`flex w-full min-w-0 items-center gap-2 rounded-md px-2.5 pt-1.5 text-left text-xs font-medium text-content-secondary focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:()=>ee(e=>!e),children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:n(`board:subagent.task`)}),(0,Q.jsx)(u,{"aria-hidden":`true`,className:H(`size-3.5 transition-transform`,S&&`rotate-180`)})]}),(0,Q.jsx)(`p`,{className:H(`m-0 max-h-60 overflow-auto px-2.5 pt-0.5 pb-2 text-[13px] leading-relaxed whitespace-pre-wrap text-content`,!S&&`line-clamp-2`),children:P})]})]}),I,(0,Q.jsxs)(`p`,{className:H(`m-0 flex shrink-0 items-center gap-1.5 border-t border-stroke-soft px-3 text-xs text-content-muted`,t?`min-h-11`:`min-h-9`),children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3.5 flex-none`}),h?n(`board:subagent.footerRunning`):m.status===`completed`?n(`board:subagent.footerReturned`,{time:ct(m.completedAt,i)}):n(`board:subagent.footerEnded`)]})]})}var ut=new Set([`changes`,`terminal`,`files`]),dt=[];function ft(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function pt({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:u,team:p,activity:g,planTab:_,sources:v,mode:y,requestConfirm:x,onClose:C,onOpenComponents:w,componentTabs:T,autoFocus:E=!1,remoteMachine:D=!1}){let{t:O}=r(),k=y===`sheet`,te=De(),ne=o(e=>e.capabilities),re=!!te&&a(ne,`terminal`),ie=a(ne,`vcs`),A=Y(e=>e.tab),ae=Y(e=>e.setTab),oe=Y(e=>e.terminalView),j=Y(e=>e.setTerminalView),N=Y(e=>e.changesView),ue=Y(e=>e.setChangesView),F=J(e=>e.sessions[t]?.pages)??dt,I=F.some(e=>e.kind===`side-chat`),de=Oe(e=>t in e.selected),L=D?`preview`:`changes`,R=A===`running`||A===`side-chat`&&!I||A===`subagent`&&!de||A===`plan`&&!_||D&&ut.has(A)?L:A,z=ft(R,oe,N),B=z?F.find(e=>e.kind===z):void 0,he=!k&&T?T.tabs(n):[],[ge,V]=(0,Z.useState)(null),[ve,W]=(0,Z.useState)(!1),G=he.some(e=>e.id===ge)?ge:null;(0,Z.useEffect)(()=>V(null),[A]);let K=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[R,G]);let be=(0,Z.useRef)(E);(0,Z.useEffect)(()=>{if(!be.current)return;let e=requestAnimationFrame(()=>K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,Z.useEffect)(()=>{if(!z||B||(z===`terminal`||z===`processes`)&&!re)return;let e=J.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,z,{type:`add`,kind:z}),n||e.update(t,z,{type:`workspace`,contentOpen:!1})},[z,B,t,re]);let xe=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>ye(t),staleTime:1e4}),Se=xe.data?.status===`known`?xe.data.changedFiles??0:0,Ce=[...D?[]:[{id:`changes`,icon:S,label:Se>0?O(`board:inspector.changesCount`,{count:Se}):O(`board:inspector.changes`)},{id:`terminal`,icon:le,label:O(`board:inspector.terminal`)}],...D?[]:[{id:`files`,icon:ee,label:O(`board:inspector.files`)}],{id:`preview`,icon:b,label:O(`board:inspector.preview`)},..._?[{id:`plan`,icon:M,label:O(`board:inspector.plan`)}]:[],...I?[{id:`side-chat`,icon:se,label:O(`board:inspector.sideChat`)}]:[],...de?[{id:`subagent`,icon:c,label:O(`board:inspector.subagent`)}]:[]],we=e=>{B&&J.getState().update(t,B.kind,{type:`view`,id:B.id,patch:e})},Te=()=>{let n=F.find(e=>e.kind===`side-chat`);if(n&&J.getState().update(t,`side-chat`,{type:`close`,id:n.id}),ae(`changes`),k){C();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Ee=()=>{if(Oe.getState().close(t),ae(L),k){C();return}requestAnimationFrame(()=>document.getElementById(`${e}-${L}-tab`)?.focus())},X=t=>`${e}-component-${t}-tab`,ke=e=>{V(null),ae(e)},je=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Ce.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),...he.map(e=>({component:e.id,id:X(e.id)}))],r=n.findIndex(e=>G?e.component===G:e.fixed===R),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?V(i.component):i.fixed&&ke(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},$=(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:O(`chat:focusSession.gitLoading`)}),Me;return Me=G&&T?T.render(G,{sessionId:t,cwd:n}):R===`changes`?(0,Q.jsx)(rt,{sessionId:t,cwd:n,streaming:s,scope:N,onScopeChange:ue,vcsAvailable:ie,view:B?.view,onViewChange:B?we:void 0,requestConfirm:x}):R===`terminal`?re?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,Q.jsx)(_e,{size:`sm`,"aria-label":O(`board:inspector.terminalScope`),value:oe,onValueChange:j,options:[{value:`terminal`,label:O(`board:inspector.terminal`)},{value:`processes`,label:O(`board:inspector.processes`)}]})}),(0,Q.jsx)(Z.Suspense,{fallback:$,children:B?oe===`processes`?(0,Q.jsx)(d,{sessionId:t,view:B.view,onViewChange:we,onOpenTerminal:e=>{let n=J.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),j(`terminal`)}}):(0,Q.jsx)(h,{sessionId:t,cwd:n,terminalId:B.resourceId||void 0,onCreated:e=>J.getState().update(t,`terminal`,{type:`resource`,id:B.id,resourceId:e})},B.id):$})]}):(0,Q.jsx)(q,{compact:!0,icon:le,title:O(`board:inspector.terminalUnavailable`)}):R===`files`?B?(0,Q.jsx)(f,{sources:v,view:B.view,onViewChange:we}):$:R===`preview`?B?(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:(0,Q.jsx)(Le,{panelId:e,sessionId:t},t)}):$:R===`plan`?(0,Q.jsx)(Ie,{plan:l,streaming:s,goal:u,team:p,activity:g}):R===`subagent`?(0,Q.jsx)(lt,{sessionId:t,sheet:k}):(0,Q.jsx)(m,{parentId:t,active:!0}),(0,Q.jsxs)(`section`,{id:e,"aria-label":O(`board:inspector.label`),"data-session-inspector":y,"data-inspector-tab":R,"data-inspector-component":G??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,Q.jsxs)(`header`,{className:H(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,k?`h-[52px]`:y===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,Q.jsxs)(`div`,{ref:K,role:`tablist`,"aria-label":O(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:je,children:[Ce.map(({id:t,icon:n,label:r})=>{let i=!G&&t===R;return(0,Q.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:H(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,k?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>ke(t),children:[!k&&(0,Q.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!G&&R===`subagent`&&(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:H(k&&`size-11`),"aria-label":O(`board:inspector.closeTab`,{tab:O(`board:inspector.subagent`)}),onClick:Ee,children:(0,Q.jsx)(P,{"aria-hidden":`true`})}),!G&&R===`side-chat`&&(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:H(k&&`size-11`),"aria-label":O(`board:inspector.closeTab`,{tab:O(`board:inspector.sideChat`)}),onClick:Te,children:(0,Q.jsx)(P,{"aria-hidden":`true`})}),!k&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),he.map(({id:t,label:n})=>{let r=t===G;return(0,Q.jsx)(`button`,{id:X(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:H(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>V(t),children:(0,Q.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!k&&(0,Q.jsxs)(me,{open:ve,onOpenChange:W,children:[(0,Q.jsx)(fe,{asChild:!0,children:(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":O(`board:inspector.add`),title:O(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,Q.jsx)(ce,{"aria-hidden":`true`})})}),(0,Q.jsxs)(pe,{align:`end`,className:`w-64 text-xs`,children:[T?.addMenu?T.addMenu({cwd:n,onAdded:e=>{V(e),W(!1)}}):(0,Q.jsx)(`p`,{className:`text-content-secondary`,children:O(`board:inspector.addHint`)}),w&&(0,Q.jsx)(U,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:w,children:O(`board:inspector.openComponents`)})]})]}),(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:H(`flex-none`,k&&`size-11`),"aria-label":O(`board:inspector.close`),title:O(`board:inspector.close`),"aria-controls":e,onClick:C,children:y===`aside`?(0,Q.jsx)(Ae,{"aria-hidden":`true`}):(0,Q.jsx)(P,{"aria-hidden":`true`})})]}),(0,Q.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":G?X(G):`${e}-${R}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:Me})]})}export{pt as SessionInspector};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{h as o,r as s}from"./routes-BYsK6aeM.js";import{t as c}from"./use-i18n-CbqEZb3r.js";import{a as l,o as u,s as d,u as f}from"./placements-DueXe1Zp.js";import{t as p}from"./client-store-Bv5fkPKC.js";import{t as m}from"./usePhoneShell-BDH8-EY7.js";import{t as h}from"./useSessionListQuery-D8hWYbAp.js";import{t as g}from"./public-bzVRS_Ps.js";import{PhoneMenuButton as _}from"./PhoneMenuButton-DbsLKxdG.js";import{i as v,t as y}from"./session-home-fCQ4eKhT.js";var b=e(i(),1),x=a(),S=`(max-width: 1279px), (max-height: 760px)`,C=`(min-width: 960px) and (min-height: 640px)`;function w(e){let[t,n]=(0,b.useState)(()=>window.matchMedia(e).matches);return(0,b.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function T({context:e,ChatPage:i}){let a=r(),c=n(),{sessionId:l=``}=t(),u=m(),d=p(e=>e.client===`mobile-app`),f=w(`(min-width: 960px) and (min-height: 640px)`)&&d,C=w(S),T=!u||f,D=(0,b.useRef)(l);D.current=l;let O=(0,b.useRef)(c.state);O.current=c.state;let k=(0,b.useCallback)(e=>{if(!e||e===D.current)return;let t=D.current===`new`;a(o(e),{replace:t,state:t?O.current:void 0})},[a]),A=h(),j=!!(l&&l!==`new`&&A.data?.sessions.some(e=>e.id===l));(0,b.useEffect)(()=>{j&&v(l)},[j,l]);let M=E(e.notify,k),N=e.startNewTask,P=l===`new`,F=e.notify,I=g({onError:e=>F(e,`error`)}),L=P?I:void 0,R=(0,b.useMemo)(()=>({compact:C,overlayOnly:d,onOpenComponents:()=>a(s.components),componentTabs:M,onArchived:e=>{y(e),a(`/`,{replace:!0})},onHome:()=>a(`/`),onNewTask:N,newTaskDraft:L}),[C,d,a,M,N,L]),z=(0,b.useMemo)(()=>({...R,phone:{onNewTask:N}}),[R,N]);return(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":T?`desktop`:`phone`,children:(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,x.jsx)(i,{notify:e.notify,navigate:e.navigate,browserNotify:e.browserNotify,pendingAsset:e.pendingAsset,onAssetConsumed:e.onAssetConsumed,requestText:e.requestText,requestConfirm:e.requestConfirm,routeSessionId:l,onRouteSessionChange:k,routeLeading:T?void 0:(0,x.jsx)(_,{}),pageChrome:T?R:z})})})}function E(e,t){let{language:n}=c(),{available:r,placed:i}=f(`session-panel`);return(0,b.useMemo)(()=>{if(r)return{tabs:e=>d(i,e,n),render:(n,{sessionId:r,cwd:a})=>{let o=i.find(e=>e.instance.instanceId===n);return o?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(u,{placed:o,sessionId:r,cwd:a,notify:e,onOpenSession:t})}):null},addMenu:({cwd:t,onAdded:n})=>(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(l,{cwd:t,notify:e,onAdded:n})})}},[r,n,e,t,i])}export{S as SESSION_COMPACT_QUERY,C as SESSION_TABLET_QUERY,T as SessionShell};
@@ -0,0 +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"./utils-C8uzG5AZ.js";var i=e(t(),1),a=n();function o({title:e,description:t,action:n,children:o,className:s,...c}){let l=(0,i.useId)();return(0,a.jsxs)(`section`,{"aria-labelledby":l,className:r(`min-w-0`,s),...c,children:[(0,a.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-4`,children:[(0,a.jsxs)(`div`,{className:`min-w-0`,children:[(0,a.jsx)(`h2`,{id:l,className:`text-[15px] leading-6 font-medium text-content`,children:e}),t&&(0,a.jsx)(`p`,{className:`mt-0.5 text-[13px] text-content-muted`,children:t})]}),n]}),(0,a.jsx)(`div`,{className:`divide-y divide-stroke-soft`,children:o})]})}function s({title:e,description:t,control:n,nested:i,children:o,className:s,...c}){return(0,a.jsxs)(`div`,{className:r(`min-w-0 py-3`,i&&`pl-4`,s),...c,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-6 gap-y-3`,children:[(0,a.jsxs)(`div`,{className:`min-w-0 flex-1 basis-40`,children:[(0,a.jsx)(`div`,{className:`text-[13px] font-medium text-content`,children:e}),t&&(0,a.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-content-muted`,children:t})]}),n&&(0,a.jsx)(`div`,{className:`max-w-full shrink-0`,children:n})]}),o]})}export{o as n,s as t};
@@ -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-8V6eRMcE.js";import{t as i}from"./runtime-capabilities-store-Y9MaywP8.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-C-nsUyew.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-DRfz9B_B.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
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-CbqEZb3r.js";import{t as i}from"./runtime-capabilities-store-1qxTCxHV.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-BEoTeOkB.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-CctXrljf.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
@@ -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-8V6eRMcE.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-DRfz9B_B.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-D23yIdOZ.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-Dl4Suwhz.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};
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-CbqEZb3r.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-CctXrljf.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-C6pJ93kY.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-CHOVA_5P.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};
@@ -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-8V6eRMcE.js";import{t as i}from"./utils-C8uzG5AZ.js";import{n as a,t as o}from"./kbd-CAufZTkl.js";import{t as s}from"./shortcuts-DRfz9B_B.js";var c=e=>({kind:`app`,action:e}),l=e=>({kind:`board`,action:e}),u=(e,...t)=>({kind:`fixed`,id:e,keys:t}),d=[{id:`global`,entries:[c(`commandPalette`),c(`primaryAction`),c(`toggleSidebar`),c(`agentPanel`),c(`openBoard`),c(`openMore`),c(`openSettings`),c(`jumpToAttention`),c(`previousAgent`),c(`nextAgent`),c(`cycleFocusRegion`),c(`toggleTerminal`),c(`shortcutHelp`),c(`focusComposer`),c(`voiceInput`),c(`openSession`),c(`openComponents`)]},{id:`sidebar`,entries:[u(`sidebarMove`,[`↑`],[`↓`]),u(`sidebarOpen`,[`Enter`])]},{id:`board`,entries:[c(`focusSearch`),l(`boardNext`),l(`boardPrevious`),u(`boardMove`,[`↑`],[`↓`]),u(`boardOpen`,[`Enter`]),l(`boardApprove`),l(`boardDeny`),l(`boardRetry`),l(`boardTriage`),u(`boardExitTriage`,[`Esc`]),l(`boardToggleGrouping`)]},{id:`session`,entries:[c(`toggleInspector`),c(`sessionTree`),c(`sideChat`),c(`sendMessage`),c(`steerMessage`),u(`newline`,[`Shift`,`Enter`]),u(`cycleRunMode`,[`Shift`,`Tab`]),u(`stopRun`,[`Esc`])]}];function f(e){return e.kind===`fixed`?`fixed:${e.id}`:e.action}function p(e,t,n){if(e.kind===`fixed`)return e.keys;let r=s(e.kind===`app`?t[e.action]:n[e.action]);return r?[r.split(` + `)]:null}function m(){let{t:e}=r(),t={commandPalette:e(`config:shortcuts.commandPalette`),primaryAction:e(`config:shortcuts.primaryAction`),focusSearch:e(`board:shortcuts.focusSearch`),toggleSidebar:e(`config:shortcuts.toggleSidebar`),toggleTerminal:e(`config:shortcuts.toggleTerminal`),openSettings:e(`config:shortcuts.openSettings`),focusComposer:e(`config:shortcuts.focusComposer`),sendMessage:e(`board:shortcuts.sendMessage`),voiceInput:e(`config:shortcuts.voiceInput`),openBoard:e(`config:shortcuts.openBoard`),openComponents:e(`config:shortcuts.openComponents`),openMore:e(`config:shortcuts.openMore`),jumpToAttention:e(`config:shortcuts.jumpToAttention`),agentPanel:e(`board:shortcuts.agentPanel`),toggleInspector:e(`board:shortcuts.toggleInspector`),previousAgent:e(`board:shortcuts.previousAgent`),nextAgent:e(`board:shortcuts.nextAgent`),steerMessage:e(`board:shortcuts.steerMessage`),shortcutHelp:e(`board:shortcuts.shortcutHelp`),openSession:e(`board:shortcuts.openSession`),sessionTree:e(`board:shortcuts.sessionTree`),sideChat:e(`board:shortcuts.sideChat`),cycleFocusRegion:e(`board:shortcuts.cycleFocusRegion`)},n={boardNext:e(`config:shortcuts.boardNext`),boardPrevious:e(`config:shortcuts.boardPrevious`),boardApprove:e(`config:shortcuts.boardApprove`),boardDeny:e(`config:shortcuts.boardDeny`),boardRetry:e(`config:shortcuts.boardRetry`),boardTriage:e(`config:shortcuts.boardTriage`),boardToggleGrouping:e(`config:shortcuts.boardToggleGrouping`)},i={sidebarMove:e(`board:shortcuts.sidebarMove`),sidebarOpen:e(`board:shortcuts.sidebarOpen`),boardMove:e(`board:shortcuts.boardMove`),boardOpen:e(`board:shortcuts.boardOpen`),boardExitTriage:e(`board:shortcuts.boardExitTriage`),newline:e(`board:shortcuts.newline`),cycleRunMode:e(`board:shortcuts.cycleRunMode`),stopRun:e(`board:shortcuts.stopRun`)};return{actions:t,boardActions:n,groups:{global:{title:e(`board:shortcuts.groupGlobal`),hint:e(`board:shortcuts.globalHint`)},sidebar:{title:e(`board:shortcuts.groupSidebar`),hint:e(`board:shortcuts.sidebarHint`)},board:{title:e(`board:shortcuts.groupBoard`),hint:e(`board:shortcuts.boardHint`)},session:{title:e(`board:shortcuts.groupSession`),hint:e(`board:shortcuts.sessionHint`)}},label:e=>e.kind===`app`?t[e.action]:e.kind===`board`?n[e.action]:i[e.id]}}var h=e(t(),1),g=n();function _({keys:e,className:t}){let{t:n}=r();return e?.length?(0,g.jsx)(`span`,{className:i(`inline-flex min-w-0 flex-wrap items-center gap-1`,t),children:e.map((e,t)=>(0,g.jsxs)(h.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-content-muted`,children:`/`}),(0,g.jsx)(a,{children:e.map(e=>(0,g.jsx)(o,{className:`text-content-secondary`,children:e},e))})]},e.join(`+`)))}):(0,g.jsx)(`span`,{className:i(`text-xs text-content-muted`,t),children:n(`config:shortcuts.disabled`)})}export{m as a,p as i,d as n,f as r,_ as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CbqEZb3r.js";import{t as i}from"./utils-C8uzG5AZ.js";import{n as a,t as o}from"./kbd-CAufZTkl.js";import{t as s}from"./shortcuts-CctXrljf.js";var c=e=>({kind:`app`,action:e}),l=e=>({kind:`board`,action:e}),u=(e,...t)=>({kind:`fixed`,id:e,keys:t}),d=[{id:`global`,entries:[c(`commandPalette`),c(`primaryAction`),c(`toggleSidebar`),c(`agentPanel`),c(`openBoard`),c(`openMore`),c(`openSettings`),c(`jumpToAttention`),c(`previousAgent`),c(`nextAgent`),c(`cycleFocusRegion`),c(`toggleTerminal`),c(`shortcutHelp`),c(`focusComposer`),c(`voiceInput`),c(`openSession`),c(`openComponents`)]},{id:`sidebar`,entries:[u(`sidebarMove`,[`↑`],[`↓`]),u(`sidebarOpen`,[`Enter`])]},{id:`board`,entries:[c(`focusSearch`),l(`boardNext`),l(`boardPrevious`),u(`boardMove`,[`↑`],[`↓`]),u(`boardOpen`,[`Enter`]),l(`boardApprove`),l(`boardDeny`),l(`boardRetry`),l(`boardTriage`),u(`boardExitTriage`,[`Esc`]),l(`boardToggleGrouping`)]},{id:`session`,entries:[c(`toggleInspector`),c(`sessionTree`),c(`sideChat`),c(`sendMessage`),c(`steerMessage`),u(`newline`,[`Shift`,`Enter`]),u(`cycleRunMode`,[`Shift`,`Tab`]),u(`stopRun`,[`Esc`])]}];function f(e){return e.kind===`fixed`?`fixed:${e.id}`:e.action}function p(e,t,n){if(e.kind===`fixed`)return e.keys;let r=s(e.kind===`app`?t[e.action]:n[e.action]);return r?[r.split(` + `)]:null}function m(){let{t:e}=r(),t={commandPalette:e(`config:shortcuts.commandPalette`),primaryAction:e(`config:shortcuts.primaryAction`),focusSearch:e(`board:shortcuts.focusSearch`),toggleSidebar:e(`config:shortcuts.toggleSidebar`),toggleTerminal:e(`config:shortcuts.toggleTerminal`),openSettings:e(`config:shortcuts.openSettings`),focusComposer:e(`config:shortcuts.focusComposer`),sendMessage:e(`board:shortcuts.sendMessage`),voiceInput:e(`config:shortcuts.voiceInput`),openBoard:e(`config:shortcuts.openBoard`),openComponents:e(`config:shortcuts.openComponents`),openMore:e(`config:shortcuts.openMore`),jumpToAttention:e(`config:shortcuts.jumpToAttention`),agentPanel:e(`board:shortcuts.agentPanel`),toggleInspector:e(`board:shortcuts.toggleInspector`),previousAgent:e(`board:shortcuts.previousAgent`),nextAgent:e(`board:shortcuts.nextAgent`),steerMessage:e(`board:shortcuts.steerMessage`),shortcutHelp:e(`board:shortcuts.shortcutHelp`),openSession:e(`board:shortcuts.openSession`),sessionTree:e(`board:shortcuts.sessionTree`),sideChat:e(`board:shortcuts.sideChat`),cycleFocusRegion:e(`board:shortcuts.cycleFocusRegion`)},n={boardNext:e(`config:shortcuts.boardNext`),boardPrevious:e(`config:shortcuts.boardPrevious`),boardApprove:e(`config:shortcuts.boardApprove`),boardDeny:e(`config:shortcuts.boardDeny`),boardRetry:e(`config:shortcuts.boardRetry`),boardTriage:e(`config:shortcuts.boardTriage`),boardToggleGrouping:e(`config:shortcuts.boardToggleGrouping`)},i={sidebarMove:e(`board:shortcuts.sidebarMove`),sidebarOpen:e(`board:shortcuts.sidebarOpen`),boardMove:e(`board:shortcuts.boardMove`),boardOpen:e(`board:shortcuts.boardOpen`),boardExitTriage:e(`board:shortcuts.boardExitTriage`),newline:e(`board:shortcuts.newline`),cycleRunMode:e(`board:shortcuts.cycleRunMode`),stopRun:e(`board:shortcuts.stopRun`)};return{actions:t,boardActions:n,groups:{global:{title:e(`board:shortcuts.groupGlobal`),hint:e(`board:shortcuts.globalHint`)},sidebar:{title:e(`board:shortcuts.groupSidebar`),hint:e(`board:shortcuts.sidebarHint`)},board:{title:e(`board:shortcuts.groupBoard`),hint:e(`board:shortcuts.boardHint`)},session:{title:e(`board:shortcuts.groupSession`),hint:e(`board:shortcuts.sessionHint`)}},label:e=>e.kind===`app`?t[e.action]:e.kind===`board`?n[e.action]:i[e.id]}}var h=e(t(),1),g=n();function _({keys:e,className:t}){let{t:n}=r();return e?.length?(0,g.jsx)(`span`,{className:i(`inline-flex min-w-0 flex-wrap items-center gap-1`,t),children:e.map((e,t)=>(0,g.jsxs)(h.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-content-muted`,children:`/`}),(0,g.jsx)(a,{children:e.map(e=>(0,g.jsx)(o,{className:`text-content-secondary`,children:e},e))})]},e.join(`+`)))}):(0,g.jsx)(`span`,{className:i(`text-xs text-content-muted`,t),children:n(`config:shortcuts.disabled`)})}export{m as a,p as i,d as n,f as r,_ as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-8V6eRMcE.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-sm border border-star-border bg-star-soft text-content transition-colors duration-[var(--d-fast)] hover:bg-surface-hover ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:`shrink-0 text-accent-fg ${f?`animate-spin`:``}`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-xs font-medium`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-xs text-content-muted tabular-nums`,children:h})]})]})}export{s as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CbqEZb3r.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-sm border border-star-border bg-star-soft text-content transition-colors duration-[var(--d-fast)] hover:bg-surface-hover ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:`shrink-0 text-accent-fg ${f?`animate-spin`:``}`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-xs font-medium`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-xs text-content-muted tabular-nums`,children:h})]})]})}export{s as default};