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
@@ -1,2 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,n,r}from"./vendor-react-DwNgTV1j.js";import{f as i,p as a}from"./i18n-B7QmqfvO.js";import{t as o}from"./use-i18n-8V6eRMcE.js";import{p as s}from"./query-DFQayLF5.js";import{t as c}from"./useQuery-DfOU-27z.js";import{t as l}from"./createLucideIcon-Cd-3GVxJ.js";import{t as u}from"./arrow-up-DST6-qVQ.js";import{t as d}from"./braces-DQcXLGFF.js";import{t as f}from"./check-2vYc6QaP.js";import{t as p}from"./chevron-right-C3t2Rckj.js";import{t as m}from"./chevrons-up-down-C2sEPdAh.js";import{t as h}from"./message-square-text-C5MJw0FL.js";import{t as g}from"./pencil-U08v_vV9.js";import{t as _}from"./refresh-cw-TbWxTY4K.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./square-bHHVTT3G.js";import{t as b}from"./users-CCtFZzwl.js";import{t as x}from"./wrench-6pg6_bqI.js";import{t as S}from"./x-07u4-129.js";import{i as C,t as w}from"./dist-41X0pdUs.js";import{c as T,n as E}from"./dist-BsRXXcSL.js";import{a as D,o as O,r as k,t as A}from"./dist-BHkR6BLP.js";import{i as j,n as M,t as N}from"./popover-C5U02alK.js";import{t as P}from"./slider-De8rWVNs.js";import{t as F}from"./utils-C8uzG5AZ.js";import{n as ee}from"./button-CCcCN8tE.js";import{t as te}from"./kbd-CAufZTkl.js";import{s as ne}from"./shortcuts-DRfz9B_B.js";import{n as re,o as ie,r as ae,t as oe}from"./sheet-BTaIEX4w.js";import{n as se,t as ce}from"./chat-api-DQyHZl-V.js";import{r as I}from"./format-DMJQzoZ7.js";import{t as le}from"./StatusGlyph-1KgitlUg.js";import{i as ue,s as de}from"./run-activity-CwfO0cui.js";import"./dialog-D23yIdOZ.js";import{n as fe,t as pe}from"./input-group-h8z63MzW.js";import{t as me}from"./model-display-kDwvtxrW.js";var he=l(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ge=l(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),_e=l(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),L=e(t(),1);function ve(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function R(e,t,n,r){return n.length?[{invocation:`/${e}`,description:t},...n.map(t=>({invocation:`/${e} ${t.value}`,description:t.label,current:t.current,run:()=>r(t.value)}))]:[]}function ye({t:e,models:t,model:n,onModel:r,thinkingLevels:i,thinkingLevel:a,thinkingLabel:o,onThinking:s,executionModes:c,executionMode:l,executionLabel:u,onExecutionMode:d,runModes:f,runMode:p,runModeLabel:m,onRunMode:h}){return[...R(`model`,e(`chat:commands.builtin.model`),t.map(e=>({value:e.key,label:e.providerName?`${e.label} · ${e.providerName}`:e.label,current:e.key===n})),r),...R(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...R(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?R(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:m(e),current:e===p})),h):[]]}function be(e,t,n){let r=e=>e.toLocaleLowerCase(n),i=r(t),a=i.search(/\s/);if(a<0)return e.filter(e=>!e.invocation.includes(` `)&&r(`${e.invocation} ${e.description}`).includes(i));let o=`/${i.slice(0,a)} `,s=i.slice(a).trim();return e.filter(e=>r(e.invocation).startsWith(o)&&r(`${e.invocation} ${e.description}`).includes(s))}var xe=10485760,Se=20971520,Ce=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),we=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),Te=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),Ee=[`image/*`,`text/*`,`application/json`,...[...we,...Ce,...Te].map(e=>`.${e}`)].join(`,`);function De(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function Oe(e){return[...e?.types||[]].includes(`Files`)}function ke(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(String(i.result).split(`,`)[1]||``),i.onerror=()=>r(i.error||Error(t(`chat:attachments.couldNotReadFile`))),i.readAsDataURL(e)})}function Ae(e){return e.toLowerCase().split(`.`).at(-1)||``}async function je(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>xe)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=Ae(e.name),i={id:`${e.name}-${e.lastModified}-${e.size}`,name:e.name,mimeType:e.type||`application/octet-stream`,size:e.size};if(e.type.startsWith(`image/`)||we.has(n))r.push({...i,kind:`image`,data:await ke(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||Ce.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(Te.has(n))r.push({...i,kind:`document`,extension:n,data:await ke(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function Me(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function Ne(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:Me(e),path:e}))}function Pe(e=[],t,n){let r=(0,L.useCallback)((e,t)=>a(e,i(),t),[]),[o,s]=(0,L.useState)(()=>[...e]),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)([]),f=(0,L.useRef)(new Map),p=(0,L.useRef)(0),m=(0,L.useRef)(n);m.current=n,(0,L.useEffect)(()=>{let e=f.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let h=(0,L.useRef)([...e]),g=(0,L.useCallback)(e=>{h.current=e,s(e),t?.(e)},[t]),_=(0,L.useCallback)(async e=>{let t=n,i=[...e||[]].slice(0,8).map(e=>{let t=`preparing-${++p.current}`,n={name:e.name,cancelled:!1};return f.current.set(t,n),{id:t,job:n,file:e}}),a=()=>d([...f.current].map(([e,t])=>({id:e,name:t.name})));a(),l(``);let o=!1;for(let{id:e,job:n,file:s}of i)try{let i=await je([s],r);if(n.cancelled||m.current!==t||!f.current.has(e))continue;let a=[...h.current,...i].slice(0,8);if(a.filter(e=>e.kind!==`path`).reduce((e,t)=>e+(t.size||0),0)>Se)throw Error(r(`chat:attachments.totalAttachmentSizeCannotExceed20MB`));g(a),o=!0}catch(e){!n.cancelled&&m.current===t&&l(e instanceof Error?e.message:String(e))}finally{f.current.delete(e),m.current===t&&a()}return o},[n,g,r]);return{attachments:o,attachmentError:c,preparingAttachments:u,addFiles:_,pasteFiles:(0,L.useCallback)(e=>{let t=De(e.clipboardData);t.length&&(e.preventDefault(),_(t))},[_]),dropFiles:(0,L.useCallback)(e=>{if(!Oe(e.dataTransfer))return;e.preventDefault();let t=De(e.dataTransfer);t.length&&_(t)},[_]),removeAttachment:(0,L.useCallback)(e=>{let t=f.current.get(e);if(t){t.cancelled=!0,f.current.delete(e),d([...f.current].map(([e,t])=>({id:e,name:t.name})));return}g(h.current.filter(t=>t.id!==e))},[g]),clearAttachments:(0,L.useCallback)(()=>{for(let e of f.current.values())e.cancelled=!0;f.current.clear(),d([]),g([])},[g]),addAttachments:(0,L.useCallback)(e=>{if(m.current!==n)return;l(``);let t=[...h.current];for(let n of e)t.some(e=>e.id===n.id)||t.push(n);g(t.slice(0,8))},[n,g]),replaceAttachments:g,setError:(0,L.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var Fe=`new-task`,z=new Map,B=new Map;function Ie(e,t){let n=t.match(/^\/[^\s]*(?:\s+([\s\S]*))?$/),r=(n?n[1]||``:t).trim();return`${e}${r?` ${r}`:` `}`}function Le(e){return{text:e?.text||``,attachments:[...e?.attachments||[]]}}function V(e){return Le(z.get(e))}function H(e,t){if(!e)return;let n={...V(e),...t};n.attachments=[...n.attachments];let r=V(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&B.set(e,(B.get(e)||0)+1),z.delete(e),!(!n.text&&!n.attachments.length)&&z.set(e,n))}function Re(e){B.set(e,(B.get(e)||0)+1),z.delete(e)}function ze(e,t){let n=[...e.attachments],r=new Set(n.map(e=>e.id));for(let e of t.attachments){let t=e.id;if(!t||r.has(t)){let n=1;do t=`${e.id||`attachment`}-restored-${n++}`;while(r.has(t))}r.add(t),n.push({...e,id:t})}return{text:e.text&&t.text?`${e.text}\n${t.text}`:e.text||t.text,attachments:n}}function Be(e){let t=(0,L.useRef)(e);t.current=e;let n=(0,L.useRef)(!0);(0,L.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,L.useRef)(V(e)),[i,a]=(0,L.useState)(r.current.text),o=(0,L.useCallback)(t=>H(e,{attachments:t}),[e]),s=Pe(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,L.useEffect)(()=>{let t=V(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,L.useCallback)(t=>{a(t),H(e,{text:t})},[e]),selection:s,clearDraft:(0,L.useCallback)(()=>{let r=V(e);r.text!==i||r.attachments.length!==s.attachments.length||r.attachments.some((e,t)=>e!==s.attachments[t])||(Re(e),!(!n.current||t.current!==e)&&(a(``),l()))},[l,s.attachments,e,i]),restoreDraft:(0,L.useCallback)(r=>{let i=ze(V(e),r);return H(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,L.useCallback)(()=>{let r=V(e),i=B.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=V(e),l={text:(B.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};H(e,l),!(!n.current||t.current!==e)&&(a(l.text),c(l.attachments))}}},[c,e])}}var Ve=e(n(),1);function He({anchor:e,menu:t,viewport:n,placement:r=`top`,align:i=`start`,maxHeight:a=1/0}){let o=n.top+8,s=Math.max(o,n.top+n.height-8),c=n.left+8,l=Math.max(c,n.left+n.width-8),u={top:Math.max(0,Math.min(e.top,s)-o-8),bottom:Math.max(0,s-Math.max(e.bottom,o)-8)},d=Math.min(t.height,a),f=r===`top`?`bottom`:`top`,p=d>u[r]&&u[f]>u[r]?f:r,m=Math.min(a,u[p]),h=Math.min(d,m),g=Math.min(t.width,l-c);return{side:p,left:Math.max(c,Math.min(i===`end`?e.right-g:e.left,l-g)),top:Math.max(o,Math.min(p===`top`?e.top-8-h:e.bottom+8,s-h)),width:g,maxHeight:m}}var U=r();function Ue({open:e,anchorRef:t,menuRef:n,placement:r=`top`,align:i=`start`,matchAnchorWidth:a=!1,maxHeight:o,id:s,className:c,role:l,ariaLabel:u,onClose:d,children:f}){return(0,L.useEffect)(()=>{if(!e||!d)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),d())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,d]),(0,L.useLayoutEffect)(()=>{if(!e)return;let s=()=>{let e=n.current,s=t.current;if(!e||!s)return;let c=s.getBoundingClientRect(),l=window.visualViewport;e.style.width=a?`${c.width}px`:``;let u=He({anchor:c,menu:{width:e.getBoundingClientRect().width,height:e.scrollHeight},viewport:{left:l?.offsetLeft??0,top:l?.offsetTop??0,width:l?.width??window.innerWidth,height:l?.height??window.innerHeight},placement:r,align:i,maxHeight:o});e.dataset.side=u.side,e.style.maxHeight=`${u.maxHeight}px`,e.style.overflowY=`auto`,e.style.width=`${u.width}px`,e.style.top=`${u.top}px`,e.style.bottom=`auto`,e.style.right=`auto`,e.style.left=`${u.left}px`};s();let c=null,l=()=>{c===null&&(c=window.requestAnimationFrame(()=>{c=null,s()}))},u=typeof ResizeObserver>`u`?null:new ResizeObserver(l);return n.current&&u?.observe(n.current),t.current&&u?.observe(t.current),window.addEventListener(`resize`,s),window.addEventListener(`scroll`,s,!0),window.visualViewport?.addEventListener(`resize`,l),window.visualViewport?.addEventListener(`scroll`,l),()=>{u?.disconnect(),c!==null&&window.cancelAnimationFrame(c),window.removeEventListener(`resize`,s),window.removeEventListener(`scroll`,s,!0),window.visualViewport?.removeEventListener(`resize`,l),window.visualViewport?.removeEventListener(`scroll`,l)}},[e,t,n,r,i,a,o]),e?(0,Ve.createPortal)((0,U.jsx)(`div`,{ref:n,id:s,className:c,style:{position:`fixed`,zIndex:65},role:l,"aria-label":u,children:f}),document.body):null}function We({resourceKey:e,loadCommands:t,builtinCommands:n=[],value:r,onChange:i,inputRef:a,placement:s=`top`}){let{t:c,language:l}=o(),u=(0,L.useId)(),p=(0,L.useRef)(null),m=r.match(/^\/([^\n]{0,120})$/),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(0),T=m?.[1]||``,E=/\s/.test(T),D=(0,L.useRef)(t);D.current=t;let O=(0,L.useMemo)(()=>be(n,T,l),[n,l,T]),k=!!(m&&h!==r&&(!E||O.length));(0,L.useEffect)(()=>{g(``),v(null),S(!1)},[e]),(0,L.useEffect)(()=>{if(!k||_)return;let e=!0;return b(!0),S(!1),D.current().then(t=>{e&&v(t.commands||[])}).catch(()=>{e&&(v([]),S(!0))}).finally(()=>e&&b(!1)),()=>{e=!1}},[_,k,e]);let A=(0,L.useMemo)(()=>{let e=O.map(e=>({kind:`builtin`,command:e}));if(E)return e;let t=T.toLocaleLowerCase(l),n=(_||[]).filter(e=>!t||`${e.invocation} ${e.name} ${e.description}`.toLocaleLowerCase(l).includes(t));return[...e,...n.map(e=>({kind:`resource`,command:e}))]},[E,O,_,l,T]);(0,L.useEffect)(()=>{w(0)},[T,_]);let j=()=>{g(r)},M=e=>{if(e.kind===`builtin`){let t=e.command.run?``:`${e.command.invocation} `;i(t),g(``),w(0),e.command.run&&e.command.run(),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length))});return}let t=Ie(e.command.invocation,r);i(t),g(t),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)})};(0,L.useEffect)(()=>{if(!k)return;let e=e=>{if(document.activeElement===a.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),j();return}A.length&&(e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),w(e=>(e+1)%A.length)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),w(e=>(e-1+A.length)%A.length)):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),M(A[Math.min(C,A.length-1)])))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}),(0,L.useEffect)(()=>{let e=a.current;if(!k||!e)return;let t={role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":u,"aria-activedescendant":A.length?`${u}-${Math.min(C,A.length-1)}`:``},n=Object.keys(t).map(t=>[t,e.getAttribute(t)]);for(let[n,r]of Object.entries(t))r?e.setAttribute(n,r):e.removeAttribute(n);return()=>{for(let[t,r]of n)t&&(r===null?e.removeAttribute(t):e.setAttribute(t,r))}},[C,a,u,k,A.length]);let N={user:c(`chat:commands.scope.user`),project:c(`chat:commands.scope.project`),package:c(`chat:commands.scope.package`),custom:c(`chat:commands.scope.custom`)};return(0,U.jsx)(Ue,{open:k,anchorRef:a,menuRef:p,placement:s,matchAnchorWidth:!0,maxHeight:330,id:u,role:`listbox`,ariaLabel:c(`chat:commands.open`),className:`permission-mode-menu composer-command-menu overflow-y-auto rounded-md bg-solid p-1 text-content shadow-float`,children:(0,U.jsxs)(`div`,{className:`chat-resource-list composer-command-list flex min-h-0 [flex:1_1_0] flex-col gap-px overflow-y-auto [overscroll-behavior:contain] [scrollbar-gutter:stable] [touch-action:pan-y] [&_>_button]:grid [&_>_button]:w-full [&_>_button]:cursor-pointer [&_>_button]:grid-cols-[28px_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-2 [&_>_button]:rounded-sm [&_>_button]:px-1.5 [&_>_button]:py-1 [&_>_button]:text-left [&_>_button]:text-content [&_>_button.active]:bg-surface-hover max-[650px]:[&_>_button]:min-h-11 [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-[13px] [&_strong]:font-medium [&_small]:truncate [&_small]:font-sans [&_small]:text-xs [&_small]:font-normal [&_small]:text-content-muted [&_em]:text-xs [&_em]:whitespace-nowrap [&_em]:text-content-muted [&_em]:not-italic [&_>_p]:m-auto [&_>_p]:px-2 [&_>_p]:py-1.5 [&_>_p]:text-xs [&_>_p]:text-content-muted`,children:[A.map((e,t)=>{let{command:n}=e,r=e.kind===`builtin`?e.command.current?f:_e:e.command.source===`prompt`?ge:d,i=e.kind===`resource`?e.command:null;return(0,U.jsxs)(`button`,{type:`button`,role:`option`,id:`${u}-${t}`,"aria-selected":t===C,className:t===C?`active`:``,onMouseEnter:()=>w(t),onMouseDown:e=>e.preventDefault(),onClick:()=>M(e),children:[(0,U.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,U.jsx)(r,{size:15})}),(0,U.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,U.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,U.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,U.jsx)(`small`,{children:n.description||c(`chat:commands.noDescription`)})]}),(0,U.jsx)(`em`,{children:i?(0,U.jsxs)(U.Fragment,{children:[i.source===`prompt`?c(`chat:commands.prompt`):c(`chat:commands.skill`),` · `,N[i.scope]]}):e.kind===`builtin`&&e.command.current?c(`chat:commands.builtin.current`):c(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!A.length&&(0,U.jsx)(`p`,{children:c(y?`chat:commands.loading`:x?`chat:commands.loadError`:`chat:commands.empty`)})]})})}var W=`relative max-[650px]:after:absolute max-[650px]:after:-inset-1`,Ge=`inline-flex h-7 min-w-0 shrink cursor-pointer items-center gap-1.5 rounded-sm border border-transparent px-2 text-[13px] text-content-secondary transition-colors hover:bg-surface-hover hover:text-content aria-expanded:bg-surface-hover aria-expanded:text-content max-[650px]:h-9 max-[650px]:rounded-full max-[650px]:bg-surface-muted max-[650px]:dark:bg-surface-active max-[650px]:px-3 max-[650px]:text-content min-[651px]:pointer-coarse:h-11 ${W}`,Ke=`grid size-8 min-w-8 flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent text-content-muted transition-colors hover:bg-surface-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50 max-[650px]:size-9 max-[650px]:min-w-9 min-[651px]:pointer-coarse:size-11 min-[651px]:pointer-coarse:min-w-11 ${W}`,qe=`max-[650px]:size-4`;function Je(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}function Ye({startedAt:e}){let[t,n]=(0,L.useState)(()=>Date.now());(0,L.useEffect)(()=>{let e=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let r=de(e,null,t);return r?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-mono text-[12.5px] text-content-muted tabular-nums`,"data-tray-clock":!0,children:Je(r)}):null}var G=`flex min-h-[34px] min-w-0 items-center gap-2 pr-1.5 pl-3 text-[13px] max-[650px]:min-h-11 max-[650px]:pr-0 pointer-coarse:min-h-11`,Xe=`grid size-[26px] flex-none cursor-pointer place-items-center rounded-sm text-content-muted opacity-0 transition-opacity duration-(--d-fast) group-hover/queued:opacity-100 group-focus-within/queued:opacity-100 hover:bg-surface-hover hover:text-content focus-visible:opacity-100 disabled:cursor-default disabled:opacity-40 max-[650px]:size-11 max-[650px]:opacity-100 pointer-coarse:size-11 pointer-coarse:opacity-100 [@media(hover:none)]:opacity-100`,Ze=`inline-flex h-[26px] shrink-0 cursor-pointer items-center gap-1.5 rounded-sm px-2 text-[13px] text-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60 max-[650px]:h-11 max-[650px]:min-w-[72px] max-[650px]:justify-center pointer-coarse:h-11 pointer-coarse:min-w-[72px]`,Qe=`inline-block h-[18px] max-w-[40%] flex-none truncate max-[650px]:max-w-full rounded-xs border border-stroke bg-solid px-1.5 text-[11.5px] leading-4 text-content-muted`,$e=3;function et({workspace:e,streaming:t,onDeliver:n,onDismiss:r}){let{t:i}=o(),[a,s]=(0,L.useState)(!1),c=i(`chat:chatHistoryPage.untitledChat`),{neighbours:l,messages:u}=e,d=e=>{!e||a||(s(!0),e().finally(()=>s(!1)))},f=l[0],p=f?l.length===1?i(`chat:workspaceActivity.neighbour`,{title:f.title||c,count:f.fileCount}):i(`chat:workspaceActivity.neighbours`,{count:l.length}):``,m=l.map(e=>`${e.title||c}: ${e.files.join(`, `)}`).join(`
2
- `);return(0,U.jsxs)(U.Fragment,{children:[f&&(0,U.jsxs)(`div`,{className:G,"data-workspace-neighbours":l.length,children:[(0,U.jsx)(b,{size:14,"aria-hidden":`true`,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:m,children:p})]}),u.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex min-w-0 list-none flex-col p-0 [&>*+*]:border-t [&>*+*]:border-stroke-soft`,"aria-label":i(`chat:workspaceActivity.label`),"data-session-messages":u.length,children:u.slice(0,$e).map((e,o)=>(0,U.jsxs)(`li`,{className:G,children:[(0,U.jsx)(h,{size:14,"aria-hidden":`true`,className:`flex-none text-content-muted max-[650px]:hidden`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 max-[650px]:py-1.5`,children:[(0,U.jsx)(`span`,{className:Qe,children:i(`chat:workspaceActivity.from`,{title:e.from.title||c})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content [overflow-wrap:anywhere] max-[650px]:line-clamp-2 max-[650px]:w-full max-[650px]:whitespace-normal`,title:e.text,children:e.text})]}),o===0&&!t&&(0,U.jsxs)(U.Fragment,{children:[n&&(0,U.jsx)(`button`,{type:`button`,className:Ze,disabled:a,"aria-busy":a||void 0,"data-session-messages-deliver":!0,onClick:()=>d(n),children:i(`chat:workspaceActivity.deliver`)}),r&&(0,U.jsx)(`button`,{type:`button`,className:F(Xe,`opacity-100`),"aria-label":i(`chat:workspaceActivity.dismiss`),title:i(`chat:workspaceActivity.dismiss`),disabled:a,"data-session-messages-dismiss":!0,onClick:()=>d(r),children:(0,U.jsx)(S,{size:14,"aria-hidden":`true`})})]})]},e.id))})]})}function tt({streaming:e,compaction:t,startedAt:n,stopping:r=!1,onStop:i,queuedInputs:a=[],withdrawingInputIds:s=[],onEdit:c,onCancel:l,onSendNow:u,runRow:d=!0,queueList:f=!0,workspace:p=null,onDeliverSessionMessages:m,onDismissSessionMessages:h}){let{t:_}=o(),v=!!t?.active,b=!!e&&d||v,x=f?a:[];if(!b&&!x.length&&!p)return null;let C=_(`chat:focusSession.sentToTheRunningAgent`);return(0,U.jsxs)(`div`,{className:`composer-tray mx-3.5 flex min-w-0 flex-col overflow-hidden rounded-t-(--r-lg) border border-b-0 border-stroke bg-well text-content-secondary max-[650px]:mx-2 [&>*+*]:border-t [&>*+*]:border-stroke`,"data-composer-tray":!0,children:[p&&(0,U.jsx)(et,{workspace:p,streaming:!!e,onDeliver:m,onDismiss:h}),b&&(0,U.jsxs)(`div`,{className:G,"data-run-bar":v?`compacting`:`running`,children:[(0,U.jsxs)(`span`,{role:`status`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[v?(0,U.jsx)(ee,{className:`size-3.5 flex-none text-content-secondary`}):(0,U.jsx)(le,{status:`run`,className:`size-4`}),(0,U.jsx)(`span`,{className:`shrink-0 text-content`,children:_(v?`chat:focusSession.compactingContext`:`chat:focusSession.running`)}),e&&(0,U.jsx)(Ye,{startedAt:n})]}),e&&i&&(0,U.jsxs)(`button`,{type:`button`,className:Ze,"aria-label":_(r?`chat:focusSession.stopping`:`chat:focusSession.stop`),title:_(`chat:focusSession.stopRunShortcut`),"aria-busy":r||void 0,disabled:r,onClick:i,"data-run-stop":!0,children:[(0,U.jsx)(y,{size:10,fill:`currentColor`,"aria-hidden":`true`}),_(r?`chat:focusSession.stopping`:`chat:focusSession.stop`),(0,U.jsx)(te,{className:`max-[650px]:hidden pointer-coarse:hidden`,children:`Esc`})]})]}),x.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex max-h-[136px] min-w-0 list-none flex-col overflow-x-hidden overflow-y-auto overscroll-contain p-0 [&>*+*]:border-t [&>*+*]:border-stroke-soft`,"aria-label":C,"data-pisper-queue-size":x.length,tabIndex:x.length>3?0:void 0,children:x.map((e,t)=>{let n=typeof e.id==`string`?e.id:``,r=s.includes(n),i=!n||r,a=String(e.text||``);return(0,U.jsxs)(`li`,{className:F(G,`group/queued`),"aria-busy":r||void 0,children:[(0,U.jsx)(`span`,{className:`inline-flex h-[18px] flex-none items-center rounded-xs border border-stroke bg-solid px-1.5 text-[11.5px] text-content-muted`,"data-queued-behavior":e.behavior===`steer`?`steer`:`followUp`,children:e.behavior===`steer`?_(`board:composer.queuedSteer`):_(`board:composer.queuedFollowUp`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content [overflow-wrap:anywhere]`,title:a,children:a}),u&&(0,U.jsx)(`button`,{type:`button`,className:Xe,"aria-label":_(`board:composer.sendQueuedNow`),title:_(`board:composer.sendQueuedNow`),disabled:i,"data-queued-send-now":!0,onClick:()=>u(n),children:(0,U.jsx)(he,{size:14,"aria-hidden":`true`})}),c&&(0,U.jsx)(`button`,{type:`button`,className:Xe,"aria-label":_(`board:composer.editQueued`),title:_(`board:composer.editQueued`),disabled:i,"data-queued-edit":!0,onClick:()=>void c(n),children:(0,U.jsx)(g,{size:14,"aria-hidden":`true`})}),l&&(0,U.jsx)(`button`,{type:`button`,className:Xe,"aria-label":_(`board:composer.cancelQueued`),title:_(`board:composer.cancelQueued`),disabled:i,"data-queued-cancel":!0,onClick:()=>void l(n),children:(0,U.jsx)(S,{size:14,"aria-hidden":`true`})})]},n||`${e.behavior}-${t}`)})})]})}function nt({invocation:e,onRemove:t}){let{t:n}=o();return(0,U.jsxs)(`div`,{className:`composer-resource-chip [&.workflow]:border-success-border [&.workflow]:bg-success-soft [&.workflow]:text-success-strong [&_button]:grid [&_button]:size-6 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:text-content-muted [&_button]:hover:bg-surface-hover [&_button]:hover:text-content inline-flex h-7 self-start items-center gap-1.5 rounded-sm border border-star-border bg-star-soft pr-0.5 pl-2 text-xs font-medium text-star-strong max-[650px]:h-11 max-[650px]:[&_button]:size-11 ${e.kind}`,children:[e.kind===`tool`?(0,U.jsx)(x,{size:13}):(0,U.jsx)(d,{size:13}),(0,U.jsxs)(`span`,{children:[e.kind===`skill`?`Skill`:e.kind===`tool`?n(`chat:resourcePicker.tool`):n(`chat:resourcePicker.workflow`),` `,`· `,e.resourceName]}),(0,U.jsx)(`button`,{type:`button`,"aria-label":n(`chat:resourcePicker.remove`),onClick:t,children:(0,U.jsx)(S,{size:13})})]})}function rt({streaming:e,queueing:t,submitting:n=!1,stopping:r=!1,preparing:i=!1,hasDraft:a=!1,canQueue:s=!1,blockedReason:c,disabled:l,onLongPress:d,longPressHint:f,onStop:p}){let{t:m}=o(),h=ne(`sendMessage`),g=(0,L.useRef)(null),v=(0,L.useRef)(!1),b=()=>{g.current&&clearTimeout(g.current),g.current=null};(0,L.useEffect)(()=>{let e=g;return()=>{e.current&&clearTimeout(e.current)}},[]);let x=!!(p&&e&&!a),S=!!(e&&!(a&&s))&&!x,C=t||n||r||i,w=l||C||S||!!c,T=m(i?`chat:focusSession.preparingAttachments`:r?`chat:focusSession.stopping`:x?`chat:focusSession.stop`:`chat:focusSession.sendMessage`);return(0,U.jsx)(`button`,{type:x?`button`:`submit`,"data-send-mode":x?`stop`:`send`,className:`send-button grid size-8 min-w-8 flex-none cursor-pointer place-items-center rounded-full border border-transparent bg-star text-on-accent transition-[background-color,opacity] select-none [-webkit-touch-callout:none] hover:enabled:bg-star-hover active:enabled:translate-y-px disabled:cursor-not-allowed disabled:opacity-30 aria-disabled:opacity-30 max-[650px]:disabled:bg-surface-muted max-[650px]:disabled:text-content max-[650px]:disabled:opacity-100 max-[650px]:aria-disabled:bg-surface-muted max-[650px]:aria-disabled:text-content max-[650px]:aria-disabled:opacity-100 max-[650px]:dark:disabled:bg-surface-active max-[650px]:dark:aria-disabled:bg-surface-active data-[send-mode=stop]:bg-surface-muted data-[send-mode=stop]:text-content data-[send-mode=stop]:hover:enabled:bg-surface-hover dark:data-[send-mode=stop]:bg-surface-active max-[650px]:size-9 max-[650px]:min-w-9 min-[651px]:pointer-coarse:size-11 min-[651px]:pointer-coarse:min-w-11 ${W}`,title:c||(!C&&h?`${T} (${h})`:T),"aria-label":c?`${T}: ${c}`:T,"aria-busy":C||void 0,"aria-disabled":w||void 0,"aria-description":d&&!x?f:void 0,"data-long-press":d&&!x?`steer`:void 0,onPointerDown:e=>{v.current=!1,!(!d||x||w||e.pointerType===`mouse`)&&(b(),g.current=setTimeout(()=>{g.current=null,v.current=!0,d()},500))},onPointerUp:b,onPointerCancel:b,onPointerLeave:b,onContextMenu:e=>{d&&e.preventDefault()},onClick:e=>{if(v.current){v.current=!1,e.preventDefault();return}if(w){e.preventDefault();return}x&&p?.()},disabled:!c&&w,children:C?(0,U.jsx)(_,{className:`animate-spin ${qe}`,size:17}):x?(0,U.jsx)(y,{size:13,fill:`currentColor`,"aria-hidden":`true`}):(0,U.jsx)(u,{size:17,strokeWidth:2.1,className:qe})})}function it({levels:e,value:t,labelFor:n,onCommit:r,disabled:i=!1,ariaLabel:a,title:o,trailing:s,className:c}){let[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),p=(0,L.useRef)(!1),m=Math.max(0,e.indexOf(t)),h=l??m,g=n(e[h]||t),_=i||d||e.length<2,v=e.join(`|`);(0,L.useEffect)(()=>{u(null)},[t,v]);let y=async n=>{let i=e[n];if(_||p.current||!i||i===t){u(null);return}p.current=!0,f(!0);try{await r(i)}finally{p.current=!1,f(!1),u(null)}};return(0,U.jsxs)(`div`,{className:F(`min-w-0`,c),children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 px-0.5 pb-1`,children:[o&&(0,U.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:o}),(0,U.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] leading-5 font-medium text-accent-fg`,"aria-live":`polite`,children:g}),s]})]}),(0,U.jsx)(P,{className:F(`h-7`,`[&_[data-slot=slider-range]]:bg-[linear-gradient(90deg,var(--star-border),var(--star))]`,`[&_[data-slot=slider-thumb]]:size-4 [&_[data-slot=slider-thumb]]:bg-[radial-gradient(circle,var(--star)_0_2px,var(--key-bg)_2.5px)]`),showSteps:!0,min:0,max:Math.max(1,e.length-1),step:1,value:[h],disabled:_,"aria-label":a,valueText:g,onValueChange:([e])=>u(e),onValueCommit:([e])=>void y(e)}),e.length>1&&(0,U.jsxs)(`div`,{className:`flex justify-between px-0.5 pt-0.5 text-xs text-content-faint`,"aria-hidden":`true`,children:[(0,U.jsx)(`span`,{children:n(e[0])}),(0,U.jsx)(`span`,{children:n(e.at(-1)||``)})]})]})}var at=96,ot=.6,st=`10%`;function ct({onDismiss:e,className:t}){let n=(0,L.useRef)(null),r=e=>{e.sheet.style.transform=``,e.sheet.style.transition=``},i=e=>{if(e.button!==0)return;let t=e.currentTarget.closest(`[data-slot="sheet-content"]`);t&&(e.currentTarget.setPointerCapture?.(e.pointerId),t.style.transition=`none`,n.current={pointerId:e.pointerId,startY:e.clientY,startAt:performance.now(),sheet:t,offset:0})},a=e=>{let t=n.current;!t||t.pointerId!==e.pointerId||(t.offset=Math.max(0,e.clientY-t.startY),t.sheet.style.transform=`translateY(${t.offset}px)`)},o=t=>{let{sheet:n}=t;n.style.setProperty(`--tw-exit-translate-y`,`calc(${t.offset}px + ${st})`);let i=()=>{n.removeEventListener(`animationstart`,a),r(t),n.style.removeProperty(`--tw-exit-translate-y`)},a=e=>{e.target===n&&n.dataset.state!==`closed`&&i()};n.addEventListener(`animationstart`,a),e(),requestAnimationFrame(()=>{n.isConnected&&n.dataset.state!==`closed`&&i()})},s=e=>{let t=n.current;if(!t||t.pointerId!==e.pointerId)return;n.current=null;let i=t.offset/Math.max(1,performance.now()-t.startAt);if(t.offset>=at||t.offset>24&&i>=ot){o(t);return}r(t)},c=()=>{let e=n.current;n.current=null,e&&r(e)};return(0,U.jsx)(`div`,{"aria-hidden":`true`,"data-sheet-drag-handle":!0,className:F(`flex h-8 w-full flex-none cursor-grab touch-none items-start justify-center select-none active:cursor-grabbing`,t),onPointerDown:i,onPointerMove:a,onPointerUp:s,onPointerCancel:c,onLostPointerCapture:c,children:(0,U.jsx)(`span`,{className:`mt-2.5 h-1 w-9 rounded-full bg-stroke-strong`})})}function lt({sheet:e,title:t,trigger:n,children:r,open:i,onOpenChange:a,align:o,side:s,sideOffset:c,className:l,sheetClassName:u}){let[d,f]=(0,L.useState)(!1),p=i??d,m=e=>{i===void 0&&f(e),a?.(e)};return e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(w,{"aria-haspopup":`dialog`,"aria-expanded":p,onClick:()=>m(!0),children:n}),(0,U.jsx)(oe,{open:p,onOpenChange:m,children:(0,U.jsxs)(re,{side:`bottom`,showCloseButton:!1,"data-popover-sheet":!0,className:F(`max-h-[85dvh] gap-1 overflow-y-auto rounded-t-(--r-sheet) px-3 pt-1 pb-[calc(12px+var(--pisper-safe-area-bottom))]`,u),children:[(0,U.jsx)(ct,{onDismiss:()=>m(!1)}),(0,U.jsx)(ie,{className:`px-2 pt-1 pb-1 text-base font-semibold`,children:t}),(0,U.jsx)(ae,{className:`sr-only`,children:t}),r]})})]}):(0,U.jsxs)(N,{open:p,onOpenChange:m,children:[(0,U.jsx)(j,{asChild:!0,children:n}),(0,U.jsx)(M,{align:o,side:s,sideOffset:c,className:l,children:r})]})}var ut=1,dt=.9,ft=.8,pt=.17,mt=.1,ht=.999,gt=.9999,_t=.99,vt=/[\\\/_+.#"@\[\(\{&]/,yt=/[\\\/_+.#"@\[\(\{&]/g,bt=/[\s-]/,xt=/[\s-]/g;function St(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ut:_t;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=St(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ut:vt.test(e.charAt(l-1))?(d*=ft,p=e.slice(i,l-1).match(yt),p&&i>0&&(d*=ht**+p.length)):bt.test(e.charAt(l-1))?(d*=dt,m=e.slice(i,l-1).match(xt),m&&i>0&&(d*=ht**+m.length)):(d*=pt,i>0&&(d*=ht**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=gt)),(d<mt&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=St(e,t,n,r,l+1,a+2,o),f*mt>d&&(d=f*mt)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ct(e){return e.toLowerCase().replace(xt,` `)}function wt(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,St(e,t,Ct(e),Ct(t),0,0,{})}var K=`[cmdk-group=""]`,Tt=`[cmdk-group-items=""]`,Et=`[cmdk-group-heading=""]`,Dt=`[cmdk-item=""]`,Ot=`${Dt}:not([aria-disabled="true"])`,kt=`cmdk-item-select`,q=`data-value`,At=(e,t,n)=>wt(e,t,n),jt=L.createContext(void 0),J=()=>L.useContext(jt),Mt=L.createContext(void 0),Nt=()=>L.useContext(Mt),Pt=L.createContext(void 0),Ft=L.forwardRef((e,t)=>{let n=Z(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Z(()=>new Set),i=Z(()=>new Map),a=Z(()=>new Map),o=Z(()=>new Set),s=Kt(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=E(),y=E(),b=E(),x=L.useRef(null),S=Jt();X(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),X(()=>{S(6,j)},[]);let C=L.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),S(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=M()?.id,C.emit()}),r||S(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=L.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),S(2,()=>{O(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{A(),O(),n.current.value||k(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();S(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function D(e,t){let r=s.current?.filter??At;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Tt);t?t.appendChild(e.parentElement===t?e:e.closest(`${Tt} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Tt} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${K}[${q}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(q);C.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(K)?.querySelector(Et))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return x.current?.querySelector(`${Dt}[aria-selected="true"]`)}function N(){return Array.from(x.current?.querySelectorAll(Ot)||[])}function P(e){let t=N()[e];t&&C.setState(`value`,t.getAttribute(q))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(q))}function ee(e){let t=M()?.closest(K),n;for(;t&&!n;)t=e>0?Wt(t,K):Gt(t,K),n=t?.querySelector(Ot);n?C.setState(`value`,n.getAttribute(q)):F(e)}let te=()=>P(N().length-1),ne=e=>{e.preventDefault(),e.metaKey?te():e.altKey?ee(1):F(1)},re=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?ee(-1):F(-1)};return L.createElement(T.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ne(e);break;case`ArrowDown`:ne(e);break;case`p`:case`k`:g&&e.ctrlKey&&re(e);break;case`ArrowUp`:re(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),te();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(kt);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Zt},c),Xt(e,e=>L.createElement(Mt.Provider,{value:C},L.createElement(jt.Provider,{value:w},e))))}),It=L.forwardRef((e,t)=>{let n=E(),r=L.useRef(null),i=L.useContext(Pt),a=J(),o=Kt(e),s=o.current?.forceMount??i?.forceMount;X(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=qt(n,r,[e.value,e.children,r],e.keywords),l=Nt(),u=Q(e=>e.value&&e.value===c.current),d=Q(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(kt,f),()=>t.removeEventListener(kt,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return L.createElement(T.div,{ref:C(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Lt=L.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=E(),s=L.useRef(null),c=L.useRef(null),l=E(),u=J(),d=Q(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));X(()=>u.group(o),[]),qt(o,s,[e.value,e.heading,c]);let f=L.useMemo(()=>({id:o,forceMount:i}),[i]);return L.createElement(T.div,{ref:C(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&L.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Xt(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},L.createElement(Pt.Provider,{value:f},e))))}),Rt=L.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=L.useRef(null),a=Q(e=>!e.search);return!n&&!a?null:L.createElement(T.div,{ref:C(i,t),...r,"cmdk-separator":``,role:`separator`})}),zt=L.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Nt(),o=Q(e=>e.search),s=Q(e=>e.selectedItemId),c=J();return L.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),L.createElement(T.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Bt=L.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=L.useRef(null),o=L.useRef(null),s=Q(e=>e.selectedItemId),c=J();return L.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(T.div,{ref:C(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Xt(e,e=>L.createElement(`div`,{ref:C(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Vt=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(A,{open:n,onOpenChange:r},L.createElement(O,{container:o},L.createElement(D,{"cmdk-overlay":``,className:i}),L.createElement(k,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(Ft,{ref:t,...s}))))}),Ht=L.forwardRef((e,t)=>Q(e=>e.filtered.count===0)?L.createElement(T.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Ut=L.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return L.createElement(T.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Xt(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),Y=Object.assign(Ft,{List:Bt,Item:It,Input:zt,Group:Lt,Separator:Rt,Dialog:Vt,Empty:Ht,Loading:Ut});function Wt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Gt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Kt(e){let t=L.useRef(e);return X(()=>{t.current=e}),t}var X=typeof window>`u`?L.useEffect:L.useLayoutEffect;function Z(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=Nt(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function qt(e,t,n,r=[]){let i=L.useRef(),a=J();return X(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(q,s),i.current=s}),i}var Jt=()=>{let[e,t]=L.useState(),n=Z(()=>new Map);return X(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Yt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Xt({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(Yt(t),{ref:t.ref},n(t.props.children)):n(t)}var Zt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Qt({className:e,...t}){return(0,U.jsx)(Y,{"data-slot":`command`,className:F(`flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground`,e),...t})}function $t({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,U.jsxs)(pe,{className:`h-8! rounded-sm! border-stroke bg-surface-subtle shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,U.jsx)(Y.Input,{"data-slot":`command-input`,className:F(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,U.jsx)(fe,{children:(0,U.jsx)(v,{className:`size-4 shrink-0 opacity-50`})})]})})}function en({className:e,...t}){return(0,U.jsx)(Y.List,{"data-slot":`command-list`,className:F(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function tn({className:e,...t}){return(0,U.jsx)(Y.Empty,{"data-slot":`command-empty`,className:F(`py-6 text-center text-sm`,e),...t})}function nn({className:e,...t}){return(0,U.jsx)(Y.Group,{"data-slot":`command-group`,className:F(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function rn({className:e,children:t,...n}){return(0,U.jsxs)(Y.Item,{"data-slot":`command-item`,className:F(`group/command-item relative flex min-h-7.5 max-[650px]:min-h-11 pointer-coarse:min-h-11 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,U.jsx)(f,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}var an={system:`var(--viz-1)`,project:`var(--viz-2)`,skills:`var(--viz-3)`,tools:`var(--viz-4)`,mcp:`var(--viz-5)`,messages:`var(--viz-6)`,toolResults:`var(--viz-7)`},on=`grid grid-cols-[8px_minmax(0,1fr)_auto_2.25rem] items-center gap-x-2 rounded-[4px] px-1 py-0.5 text-xs`;function sn({percent:e,compactAtPercent:t}){let{t:n}=o();return(0,U.jsxs)(`div`,{"aria-hidden":`true`,className:`relative h-1 rounded-full bg-surface-active`,children:[e>0&&(0,U.jsx)(`span`,{className:`absolute inset-y-0 left-0 min-w-1 rounded-full bg-content-secondary`,style:{width:`${Math.min(100,e)}%`}}),t!==null&&(0,U.jsx)(`span`,{"data-context-compact-line":!0,title:n(`board:composer.context.compactAt`,{percent:t}),className:`absolute -top-[3px] -bottom-[3px] w-[2px] -translate-x-1/2 rounded-full bg-content`,style:{left:`${t}%`}})]})}function cn({breakdown:e}){let{t}=o(),[n,r]=(0,L.useState)(null),{contextWindow:i,usedTokens:a,freeTokens:s,compactAtPercent:c}=e,l=e.categories.filter(e=>e.tokens>0),u=e.categories.filter(e=>e.tokens>0||e.id===`mcp`&&e.deferred>0),d={system:t(`board:composer.context.system`),project:t(`board:composer.context.project`),skills:t(`board:composer.context.skills`),tools:t(`board:composer.context.tools`),mcp:t(`board:composer.context.mcp`),messages:t(`board:composer.context.messages`),toolResults:t(`board:composer.context.toolResults`)},f=e=>se(e,a),p=e=>({onMouseEnter:()=>r(e),onMouseLeave:()=>r(null)}),m=[t(`board:composer.context.free`,{tokens:I(s)}),c===null?``:t(`board:composer.context.compactAt`,{percent:c})].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{className:`grid gap-2`,"data-context-breakdown":!0,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(sn,{percent:i?a/i*100:0,compactAtPercent:c}),(0,U.jsx)(`span`,{className:`text-[11px] leading-4 text-content-muted`,"data-context-capacity":!0,children:m})]}),l.length>0&&(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-[11px] leading-4 text-content-muted`,children:t(`board:composer.context.composition`)}),(0,U.jsx)(`div`,{role:`img`,"aria-label":l.map(e=>`${d[e.id]} ${f(e.tokens)}`).join(`, `),className:`flex h-2.5 w-full gap-[2px]`,children:l.map(e=>(0,U.jsx)(`span`,{"data-context-segment":e.id,title:`${d[e.id]} · ${I(e.tokens)} · ${f(e.tokens)}`,className:F(`min-w-[3px] rounded-[2px] transition-opacity duration-(--d-fast)`,n&&n!==e.id&&`opacity-30`),style:{flexGrow:e.tokens,flexBasis:0,backgroundColor:an[e.id]},...p(e.id)},e.id))})]}),(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-0 p-0`,children:u.map(e=>(0,U.jsxs)(`li`,{className:`contents`,children:[(0,U.jsxs)(`div`,{"data-context-row":e.id,className:F(on,n===e.id&&`bg-surface-hover`),...p(e.id),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-[2px]`,style:{backgroundColor:an[e.id]}}),(0,U.jsxs)(`span`,{className:`min-w-0 truncate text-content-secondary`,children:[d[e.id],e.id===`tools`&&e.count?(0,U.jsxs)(`span`,{className:`text-content-muted`,children:[` · `,e.count]}):null]}),(0,U.jsx)(`span`,{className:`font-medium text-content tabular-nums`,children:I(e.tokens)}),(0,U.jsx)(`span`,{className:`text-right text-content-muted tabular-nums`,children:f(e.tokens)})]}),e.servers.map(e=>{let n=[e.name,e.tools>0?t(`board:composer.context.toolCount`,{count:e.tools}):``,e.calls>0?t(`board:composer.context.callCount`,{count:e.calls}):``].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{"data-context-server":e.name,className:F(on,`py-0 text-content-muted`),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:n,children:n}),(0,U.jsx)(`span`,{className:`tabular-nums`,children:I(e.tokens)}),(0,U.jsx)(`span`,{})]},e.name)}),e.deferred>0&&(0,U.jsxs)(`div`,{"data-context-deferred":!0,className:F(on,`py-0 text-content-muted`),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`col-span-3 min-w-0`,children:t(`board:composer.context.deferred`,{count:e.deferred})})]})]},e.id))}),(0,U.jsx)(`p`,{className:`m-0 text-[11px] leading-4 text-content-muted`,"data-context-hint":!0,children:e.prefixKnown?e.totalKnown?t(`board:composer.context.estimated`):t(`board:composer.context.allEstimated`):t(`board:composer.context.prefixUnknown`)})]})}function ln(e,t){let n=t.find(t=>t.key===e);return n?`${n.providerName} · ${n.label}`:e.split(`/`).at(-1)||e}function un({label:e,value:t,wide:n=!1,usageKey:r,title:i}){return(0,U.jsxs)(`div`,{className:F(`grid min-w-0 gap-0.5 rounded-[var(--r-md)] bg-surface-subtle px-2 py-1.5 dark:bg-surface-active`,n&&`col-span-2`),"data-usage-row":r,title:i,children:[(0,U.jsx)(`span`,{className:`truncate text-[11px] leading-4 text-content-muted`,children:e}),(0,U.jsx)(`strong`,{className:`truncate text-[13px] leading-4 font-medium text-content`,children:t})]})}function dn({model:e,availableModels:t,sessionUsage:n}){let{t:r,language:i}=o(),a=n?.timing&&typeof n.timing==`object`?n.timing:null,s=Math.max(0,Number(a?.firstTokenSamples)||0),c=Math.max(0,Number(a?.requests)||0),l=s>0?Number(a?.firstTokenTotalMs)/s:null,u=c>0?Number(a?.durationTotalMs)/c:null,d=!!n?.cacheReported,f=[[r(`chat:focusSession.statCurrentModel`),e?ln(e,t||[]):`—`],[r(`chat:focusSession.statInputTokens`),I(n?.input)],[r(`chat:focusSession.statOutputTokens`),I(n?.output)],[r(`chat:focusSession.statCacheReadTokens`),d?I(n?.cacheRead):`—`],[r(`chat:focusSession.statCacheWriteTokens`),d?I(n?.cacheWrite):`—`],[r(`chat:focusSession.statReasoningTokens`),I(n?.reasoning)],[r(`chat:focusSession.statRequests`),String(Math.max(0,Number(n?.requests)||0))],[r(`chat:focusSession.statAvgFirstToken`),l==null?`—`:ue(l,i)],[r(`chat:focusSession.statAvgDuration`),u==null?`—`:ue(u,i)]];return(0,U.jsxs)(`div`,{className:`session-stats-panel grid grid-cols-2 gap-1`,"aria-label":r(`chat:focusSession.sessionStats`),children:[f.map(([e,t],n)=>(0,U.jsx)(un,{label:e,value:t,wide:n===0},e)),(0,U.jsx)(`small`,{className:`col-span-2 text-[11px] leading-4 text-content-muted`,children:r(`chat:focusSession.sessionStatsHint`)})]})}function fn({sessionId:e,usage:t,sessionUsage:n,model:r,availableModels:i,onThresholdChange:a}){let{t:l}=o(),u=Number(t?.contextWindow)||0,d=t?.compactAtPercent==null?80:Number(t.compactAtPercent),f=Number.isFinite(d)?Math.round(d):80,[m,h]=(0,L.useState)(f),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(``),b=(0,L.useRef)(f),x=(0,L.useRef)(void 0);(0,L.useEffect)(()=>{window.clearTimeout(x.current),h(f),b.current=f},[f]),(0,L.useEffect)(()=>()=>window.clearTimeout(x.current),[]);let S=c({queryKey:[`context-breakdown`,e,t?.tokens??null,u],queryFn:({signal:t})=>ce.getContextBreakdown(String(e),t),enabled:!!e&&u>0,retry:!1,staleTime:5e3,placeholderData:s}).data,C=t?.percent!=null&&Number.isFinite(Number(t.percent))?Math.max(0,Number(t?.percent)):null,w=Math.max(0,Number(n?.processedTokens)||0),T=Number(n?.cacheHitRate),E=n?.cacheHitRate!=null&&Number.isFinite(T),D=t?.tokens==null?S?`≈${I(S.usedTokens)}`:`—`:I(t.tokens),O=u?`${D} / ${I(u)}${C==null?``:` · ${Math.round(C)}%`}`:``,k=t?.autoCompactEnabled&&t.compactionCapacityPercent!=null?l(`chat:focusSession.contextUsageToCompactionTokensPercent`,{percent:Math.round(Number(t.compactionCapacityPercent)),tokens:I(t.remainingBeforeCompaction)}):``,A=async e=>{let t=Math.min(95,Math.max(10,Math.round(e)));if(h(t),!(!a||t===b.current)){_(!0),y(``);try{await a(t),b.current=t}catch(e){y(e instanceof Error?e.message:String(e))}finally{_(!1)}}},j=e=>{window.clearTimeout(x.current),h(e),x.current=window.setTimeout(()=>void A(e),250)},M=e=>{window.clearTimeout(x.current),A(e)};return(0,U.jsxs)(`div`,{className:`context-usage-section grid gap-1.5 border-t border-stroke-soft px-2 pt-2 pb-1.5`,"data-context-usage":!0,children:[O&&(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[((e,t,n,r)=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-usage-row":n,title:r,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:e}),(0,U.jsx)(`strong`,{className:`min-w-0 truncate text-right font-medium text-content tabular-nums`,children:t})]}))(l(`board:composer.contextUsage`),O,`context`),S?(0,U.jsx)(cn,{breakdown:S}):(0,U.jsx)(sn,{percent:C??0,compactAtPercent:t?.autoCompactEnabled?d:null})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-1`,children:[(0,U.jsx)(un,{label:l(`board:composer.sessionTokens`),value:w>0?l(`board:composer.tokens`,{tokens:I(w)}):`—`,usageKey:`tokens`}),(0,U.jsx)(un,{label:l(`board:composer.cacheHitLabel`),value:E?`${Math.round(Math.max(0,T))}%`:`—`,usageKey:`cache`,title:E?void 0:l(`chat:focusSession.cacheHitRateUnavailable`)})]}),u>0&&(0,U.jsxs)(`details`,{className:`group/usage min-w-0 text-xs`,onToggle:e=>{let t=e.currentTarget;t.open&&requestAnimationFrame(()=>t.scrollIntoView({block:`nearest`}))},children:[(0,U.jsxs)(`summary`,{className:`flex min-h-7 cursor-pointer list-none items-center gap-1 rounded-sm text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:outline-focus max-[650px]:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(p,{size:13,"aria-hidden":`true`,className:`transition-transform duration-(--d-fast) group-open/usage:rotate-90`}),l(`chat:focusSession.sessionStats`)]}),(0,U.jsxs)(`div`,{className:`grid gap-2 pt-1.5`,children:[(0,U.jsx)(dn,{model:r,availableModels:i,sessionUsage:n}),k&&(0,U.jsx)(`small`,{className:`text-content-muted`,children:k}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between font-medium text-content`,children:[(0,U.jsx)(`span`,{children:l(`chat:focusSession.autoCompactionThreshold`)}),(0,U.jsxs)(`output`,{className:`tabular-nums`,children:[m,`%`]})]}),(0,U.jsx)(P,{min:10,max:95,step:1,value:[m],className:`h-5 w-full`,"aria-label":l(`chat:focusSession.autoCompactionThreshold`),valueText:`${m}%`,disabled:g,onValueChange:([e])=>j(e),onValueCommit:([e])=>M(e)}),(0,U.jsx)(`small`,{className:v?`text-danger`:`text-content-muted`,children:v||(g?l(`chat:focusSession.savingCompactionThreshold`):`\xA0`)})]})]})]})}function $(e,t){return{off:e(`chat:focusSession.thinkingLabel.off`),minimal:e(`chat:focusSession.thinkingLabel.minimal`),low:e(`chat:focusSession.thinkingLabel.low`),medium:e(`chat:focusSession.thinkingLabel.medium`),high:e(`chat:focusSession.thinkingLabel.high`),xhigh:e(`chat:focusSession.thinkingLabel.xhigh`),max:e(`chat:focusSession.thinkingLabel.max`)}[t]||t}function pn({model:e,models:t,onModelChange:n,thinkingLevel:r,levels:i,status:a,message:s,onThinkingChange:c,modelDisabled:l,thinkingDisabled:u,deferred:d=!1,pendingModel:f=!1,usage:p,sheet:h=!1,side:g=`top`,thinkingIsDefault:_=!1,onThinkingReset:v,triggerClassName:y}){let{t:b}=o(),[x,S]=(0,L.useState)(!1),C=t.find(t=>t.key===e),w=t.map(e=>e.label),T=C?.label||e.split(`/`).at(-1)||``,E=T?me(T,w):b(`chat:focusSession.toolbarModel`),D=[...t.reduce((e,t)=>{let n=e.get(t.providerName)||[];return n.push(t),e.set(t.providerName,n)},new Map)],O=a!==`unsupported`&&i.length>0,k=O?$(b,r||i[0]):`—`,A=f?b(`chat:focusSession.thinkingAfterModelSwitch`):O?k:s||b(a===`unsupported`?`chat:focusSession.thinkingLevelUnsupported`:`chat:focusSession.loadingThinkingLevels`),j=u||x||!O||i.length<2,M=`${b(`chat:focusSession.modelAndThinking`)} · ${ln(e,t)} · ${A}`;return(0,U.jsxs)(lt,{sheet:h,title:b(`chat:focusSession.modelAndThinking`),align:`end`,side:g,sideOffset:8,className:`model-effort-popover w-[272px] max-w-[calc(100vw_-_24px)] gap-0 p-1`,trigger:(0,U.jsxs)(`button`,{type:`button`,className:F(`model-effort-pill inline-flex h-[30px] min-w-0 max-w-[260px] cursor-pointer items-center gap-1.5 rounded-sm border border-transparent pr-1.5 pl-2.5 text-[13px] text-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60 aria-expanded:bg-surface-hover max-[650px]:h-9 max-[650px]:gap-1 max-[650px]:rounded-full max-[650px]:bg-surface-muted max-[650px]:dark:bg-surface-active max-[650px]:px-3 max-[650px]:text-sm min-[651px]:pointer-coarse:h-11`,W,y),"aria-label":M,title:M,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium max-[650px]:hidden`,children:E}),(0,U.jsx)(`span`,{className:`hidden font-medium whitespace-nowrap max-[650px]:inline`,children:b(`chat:focusSession.modelChipShort`)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint max-[650px]:hidden`,children:`·`}),(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted max-[650px]:hidden`,children:O?$(b,r||i[0]):`—`}),(0,U.jsx)(m,{size:14,className:`shrink-0 text-content-muted max-[650px]:hidden`,"aria-hidden":`true`})]}),children:[(0,U.jsxs)(`div`,{className:`model-effort-model flex flex-col gap-1 p-1.5 pb-2`,children:[(0,U.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-content-muted`,children:b(`chat:focusSession.toolbarModel`)}),(0,U.jsxs)(Qt,{defaultValue:e,filter:(e,t,n)=>+!![e,...n||[]].join(` `).toLowerCase().includes(t.trim().toLowerCase()),className:`rounded-sm! border border-stroke-soft bg-transparent p-0`,"aria-label":b(`chat:focusSession.currentChatModel`),children:[t.length>6&&(0,U.jsx)($t,{placeholder:b(`chat:focusSession.searchModels`)}),(0,U.jsxs)(en,{className:`max-h-56`,children:[(0,U.jsx)(tn,{className:`py-4 text-xs text-content-muted`,children:t.length?b(`chat:focusSession.noMatchingModels`):b(`chat:focusSession.noModelsAvailable`)}),!C&&e&&(0,U.jsx)(nn,{children:(0,U.jsx)(rn,{value:e,"data-checked":!0,disabled:!0,children:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:E})})}),D.map(([t,r])=>(0,U.jsx)(nn,{heading:t,children:r.map(t=>{let r=me(t.label,w);return(0,U.jsx)(rn,{value:t.key,keywords:[t.label,t.providerName],"data-checked":t.key===e,disabled:l||x,onSelect:()=>{t.key!==e&&n(t.key)},children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,title:t.label,children:[(0,U.jsx)(`span`,{className:`wrap-anywhere`,children:r}),r!==t.label&&(0,U.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:t.label})]})},t.key)})},t))]})]})]}),O&&(0,U.jsx)(it,{className:`border-t border-stroke-soft p-1.5 pt-2`,title:b(`chat:focusSession.thinkingLevelTitle`),levels:i,value:r,labelFor:e=>$(b,e),onCommit:async e=>{S(!0);try{await c(e)}finally{S(!1)}},disabled:j,ariaLabel:b(`chat:focusSession.currentThinkingLevel`),trailing:_?(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-content-faint`,children:b(`chat:focusSession.thinkingModelDefault`)}):v?(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 cursor-pointer rounded-sm text-xs text-content-muted underline-offset-2 hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-focus`,onClick:v,children:b(`chat:focusSession.thinkingReset`)}):void 0}),d&&(0,U.jsx)(`p`,{className:`px-2 pt-1 pb-2 text-xs leading-4 text-content-muted`,role:`status`,children:b(`chat:focusSession.runtimeSelectionDeferred`)}),(!O||i.length===1)&&(0,U.jsx)(`p`,{className:`border-t border-stroke-soft px-2 pt-2 pb-1.5 text-xs leading-relaxed text-content-muted`,role:`status`,children:O?b(`chat:focusSession.thinkingLevelFixed`,{level:k}):A}),p]})}export{ve as C,ye as S,Ie as _,ct as a,Oe as b,qe as c,rt as d,tt as f,Re as g,Fe as h,lt as i,W as l,We as m,pn as n,Ge as o,Je as p,$ as r,Ke as s,fn as t,nt as u,Be as v,ge as w,Ne as x,Ee as y};
@@ -1 +0,0 @@
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"./arrow-down-CDGua-ue.js";import{t as a}from"./arrow-up-DST6-qVQ.js";import{n as o,t as s}from"./useCatalogProjects-DKjmAJ2x.js";import{i as c,t as l}from"./workspace-order-store-DmEFuNUL.js";import{t as u}from"./pencil-U08v_vV9.js";import{t as d}from"./rotate-ccw-C0v8V77_.js";import{t as f}from"./trash-2-CNrPOoPR.js";import{t as p}from"./utils-C8uzG5AZ.js";import{n as m,t as h}from"./button-CCcCN8tE.js";import{t as g}from"./useSessionListQuery-DtpEX8a5.js";import{s as _}from"./card-presentation-1oph2b8P.js";import{a as v,i as y,l as b,n as x,o as S,s as C,t as w}from"./dialog-D23yIdOZ.js";var T=e(t(),1),E=n(),D=`flex-none pointer-coarse:size-11 in-data-[phone-shell]:size-11`;function O({open:e,onOpenChange:t,commands:n}){let{t:O}=r(),k=g(),A=l(e=>e.rememberWorkspaces),j=l(e=>e.moveWorkspace),M=(0,T.useRef)(null),N=(0,T.useRef)(null),[P,F]=(0,T.useState)(null),[I,L]=(0,T.useState)(null),R=s(),z=(0,T.useMemo)(()=>R.map(e=>e.key),[R]);(0,T.useEffect)(()=>{e&&z.length&&A(z)},[z,e,A]),(0,T.useEffect)(()=>{if(!P)return;let e=M.current,t=t=>e?.querySelector(`[data-project-move="${t}"][data-project-key="${CSS.escape(P.key)}"]`),n=t(P.offset);(n&&!n.disabled?n:t(P.offset===-1?1:-1))?.focus(),F(null)},[P,R]),(0,T.useEffect)(()=>{I&&(L(null),!R.some(e=>e.key===I.key)&&((I.next?M.current?.querySelector(`[data-project-remove][data-project-key="${CSS.escape(I.next)}"]`):null)??N.current)?.focus())},[R,I]);let B=(e,t)=>{j(e.key,t,z),F({key:e.key,offset:t})},V=async(e,t)=>{let r=R[t+1]?.key??R[t-1]?.key??``;e.count===0?n.unregister(e):await n.remove(e),L({key:e.key,next:r})},H=!!n.busyKey,U;return U=k.isPending?(0,E.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-6 text-sm text-content-muted`,children:[(0,E.jsx)(m,{className:`size-4`}),O(`board:project.loading`)]}):k.error&&!k.data?(0,E.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 py-6 text-sm`,children:[(0,E.jsx)(`p`,{className:`text-content`,children:O(`board:project.error`)}),(0,E.jsx)(h,{variant:`secondary`,size:`sm`,onClick:()=>void k.refetch(),children:O(`board:page.retry`)})]}):R.length===0?(0,E.jsxs)(`div`,{className:`flex flex-col gap-1 py-6 text-sm`,children:[(0,E.jsx)(`p`,{className:`font-medium text-content`,children:O(`board:project.empty`)}),(0,E.jsx)(`p`,{className:`text-content-muted`,children:O(`board:project.emptyHint`)})]}):(0,E.jsx)(`ul`,{ref:M,"aria-label":O(`board:project.listLabel`),className:`flex flex-col divide-y divide-stroke-soft`,"data-manage-projects":!0,children:R.map((e,t)=>{let r=n.busyKey===e.key,s=e.cwd&&e.key!==`\0`,c=e.count===0,l=O(c?`board:project.removeNamed`:`board:project.deleteWithChatsNamed`,{project:e.label});return(0,E.jsxs)(`li`,{"data-project-row":e.key,"data-project-registered-only":c||void 0,"aria-busy":r||void 0,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 py-2`,children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 flex-none place-items-center rounded-sm border border-stroke-strong bg-solid font-mono text-xs font-semibold text-content uppercase`,children:Array.from(e.label)[0]||`·`}),(0,E.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,E.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-content`,children:e.label}),(0,E.jsx)(`span`,{className:`truncate font-mono text-xs text-content-muted`,title:e.cwd||void 0,children:e.custom?`${O(`board:project.folderName`,{name:e.folderLabel})} · ${_(e.cwd)}`:e.cwd?_(e.cwd):``})]}),(0,E.jsx)(`span`,{className:`flex-none text-xs text-content-muted tabular-nums max-[480px]:hidden`,children:r?O(`board:project.deleting`):O(`board:project.sessions`,{count:e.count})}),(0,E.jsxs)(`span`,{className:`flex flex-none items-center max-[480px]:w-full max-[480px]:justify-end`,children:[(0,E.jsx)(h,{variant:`ghost`,size:`icon-sm`,className:D,"data-project-move":`-1`,"data-project-key":e.key,disabled:t===0,"aria-label":O(`board:project.moveUp`,{project:e.label}),title:O(`board:project.moveUp`,{project:e.label}),onClick:()=>B(e,-1),children:(0,E.jsx)(a,{"aria-hidden":`true`})}),(0,E.jsx)(h,{variant:`ghost`,size:`icon-sm`,className:D,"data-project-move":`1`,"data-project-key":e.key,disabled:t===R.length-1,"aria-label":O(`board:project.moveDown`,{project:e.label}),title:O(`board:project.moveDown`,{project:e.label}),onClick:()=>B(e,1),children:(0,E.jsx)(i,{"aria-hidden":`true`})}),s&&(0,E.jsx)(h,{variant:`ghost`,size:`icon-sm`,className:D,"aria-label":O(`board:project.renameNamed`,{project:e.label}),title:O(`board:project.renameNamed`,{project:e.label}),onClick:()=>void n.rename(e),children:(0,E.jsx)(u,{"aria-hidden":`true`})}),s&&e.custom&&(0,E.jsx)(h,{variant:`ghost`,size:`icon-sm`,className:D,"aria-label":O(`board:project.resetNamed`,{project:e.label}),title:O(`board:project.resetNamed`,{project:e.label}),onClick:()=>n.resetName(e),children:(0,E.jsx)(d,{"aria-hidden":`true`})}),(0,E.jsx)(h,{variant:`ghost`,size:`icon-sm`,className:p(D,!c&&`text-danger hover:text-danger`),disabled:H,"data-project-remove":c?`unregister`:`delete`,"data-project-key":e.key,"aria-label":l,title:l,onClick:()=>void V(e,t),children:r?(0,E.jsx)(m,{className:`size-4`}):c?(0,E.jsx)(o,{"aria-hidden":`true`}):(0,E.jsx)(f,{"aria-hidden":`true`})})]})]},e.key)})}),(0,E.jsx)(w,{open:e,onOpenChange:t,children:(0,E.jsxs)(y,{size:`wide`,scrollMode:`body`,"aria-describedby":`board-manage-projects`,onOpenAutoFocus:e=>{e.preventDefault(),N.current?.focus()},children:[(0,E.jsxs)(C,{children:[(0,E.jsx)(b,{children:O(`board:project.manageTitle`)}),(0,E.jsx)(v,{id:`board-manage-projects`,children:O(`board:project.manageDescription`)})]}),(0,E.jsx)(x,{className:`-mx-1 px-1`,children:U}),(0,E.jsxs)(S,{children:[(0,E.jsxs)(h,{variant:`outline`,size:`dialogAction`,disabled:n.picking,onClick:()=>{t(!1),n.newProject()},children:[(0,E.jsx)(c,{"aria-hidden":`true`}),O(`board:project.new`)]}),(0,E.jsx)(h,{ref:N,size:`dialogAction`,onClick:()=>t(!1),children:O(`board:project.done`)})]})]})})}export{O as ManageProjectsDialog};
@@ -1 +0,0 @@
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{C as i,O as a,S as o,g as s,o as c,u as l,y as u}from"./query-DFQayLF5.js";import{r as d,t as f}from"./useQuery-DfOU-27z.js";import{n as p}from"./mutation-b4pPvB7p.js";import{t as m}from"./queryOptions-Dfvzj6n2.js";import{t as h}from"./http-response-B2n7HFQ4.js";import{n as g}from"./http-DtkTCrZ4.js";import{t as _}from"./check-2vYc6QaP.js";import{t as v}from"./copy-DHmIFc52.js";import{t as ee}from"./key-round-C29uZbsf.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./server-BgNvmqwJ.js";import{t as C}from"./trash-2-CNrPOoPR.js";import{t as w}from"./wrench-6pg6_bqI.js";import{t as T}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{t as D}from"./switch-D_G8wFhs.js";import{t as O}from"./utils-C8uzG5AZ.js";import{n as k,t as A}from"./button-CCcCN8tE.js";import{s as te}from"./shortcuts-DRfz9B_B.js";import{a as j}from"./format-DMJQzoZ7.js";import{a as M,i as N,l as P,o as F,s as ne,t as re}from"./dialog-D23yIdOZ.js";import{t as I}from"./textarea-DmATpOqT.js";import{n as L,t as R}from"./PageState-Cz6vFMXv.js";import{t as z}from"./alert-DRIrgNI4.js";import{a as ie,i as B,n as V,o as ae,r as oe,s as se}from"./FeaturePage-C0bAQ4el.js";var ce=class extends a{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),o(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){c.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},H=e(t(),1);function le(e,t){let n=d(t);return ue({filters:{...e,status:`pending`}},n).length}function U(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ue(e={},t){let n=d(t).getMutationCache(),r=H.useRef(e),i=H.useRef(null);return i.current===null&&(i.current=U(n,e)),H.useEffect(()=>{r.current=e}),H.useSyncExternalStore(H.useCallback(e=>n.subscribe(()=>{let t=u(i.current,U(n,r.current));i.current!==t&&(i.current=t,c.schedule(e))}),[n]),()=>i.current,()=>i.current)}function de(e,t){let n=d(t),[r]=H.useState(()=>new ce(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);let a=H.useSyncExternalStore(H.useCallback(e=>r.subscribe(c.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=H.useCallback((e,t)=>{r.mutate(e,t).catch(s)},[r]);if(a.error&&i(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function W(e){if(!e||typeof e!=`object`||Array.isArray(e))throw h();return Object.fromEntries(Object.entries(e))}function G(e,t=!1){if(e==null&&!t)return``;if(typeof e!=`string`||t&&!e)throw h();return e}function K(e,t=0){if(e==null)return t;if(typeof e!=`number`||!Number.isFinite(e))throw h();return e}function q(e){if(typeof e!=`boolean`)throw h();return e}function fe(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw h();return e.map(t)}function pe(e){let t=W(e);return{id:G(t.id,!0),name:G(t.name,!0),status:G(t.status),transport:G(t.transport),endpoint:G(t.endpoint),command:G(t.command),workingDirectory:G(t.workingDirectory),enabled:q(t.enabled),error:G(t.error),latencyMs:t.latencyMs==null?null:K(t.latencyMs),lastPingAt:G(t.lastPingAt),auth:G(t.auth),authCount:K(t.authCount)}}function me(e){let t=W(e);return{serviceId:G(t.serviceId,!0),serviceName:G(t.serviceName),name:G(t.name,!0),piName:G(t.piName,!0),description:G(t.description),enabled:q(t.enabled),serviceEnabled:q(t.serviceEnabled),risk:G(t.risk)}}function he(e){let t=W(e);return{id:G(t.id,!0),serviceId:G(t.serviceId,!0),toolName:G(t.toolName),timestamp:G(t.timestamp),status:G(t.status),error:G(t.error),durationMs:K(t.durationMs)}}function J(e){let t=W(e);if(!Array.isArray(t.services))throw h();let n=t.metrics===void 0?{}:W(t.metrics);return{services:t.services.map(pe),tools:fe(t.tools,me),calls:fe(t.calls,he),metrics:{totalServices:K(n.totalServices),onlineServices:K(n.onlineServices),availableTools:K(n.availableTools),restrictedTools:K(n.restrictedTools),errorRate:K(n.errorRate)}}}var Y=e=>`/api/mcp/${encodeURIComponent(e)}`,X={dashboard:e=>g(`/api/mcp?refresh=0`,{signal:e,parse:J}),add:e=>g(`/api/mcp`,{method:`POST`,body:{spec:e},parse:J}),setServerEnabled:(e,t)=>g(Y(e),{method:`PATCH`,body:{enabled:t},parse:J}),setToolEnabled:(e,t,n)=>g(`${Y(e)}/tools/${encodeURIComponent(t)}`,{method:`PATCH`,body:{enabled:n},parse:J}),test:e=>g(`${Y(e)}/test`,{method:`POST`,body:{},parse:J}),remove:async e=>(await g(Y(e),{method:`DELETE`}),X.dashboard())};function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw h();return Object.fromEntries(Object.entries(e))}function _e(e){let t=ge(e);if(typeof t.enabled!=`boolean`||typeof t.listening!=`boolean`||typeof t.host!=`string`||typeof t.port!=`number`||!Number.isInteger(t.port)||typeof t.url!=`string`||t.error!==null&&typeof t.error!=`string`)throw h();return{enabled:t.enabled,listening:t.listening,host:t.host,port:t.port,url:t.url,error:t.error}}function ve(e){let t=ge(e);if(typeof t.url!=`string`||!t.url||typeof t.token!=`string`||!t.token)throw h();return{url:t.url,token:t.token}}var Z={status:e=>g(`/api/mcp-host`,{signal:e,parse:_e}),setEnabled:e=>g(`/api/mcp-host`,{method:`PATCH`,body:{enabled:e},parse:_e}),credentials:e=>g(`/api/mcp-host/credentials`,{method:`POST`,body:{},signal:e,parse:ve}),rotateToken:e=>g(`/api/mcp-host/rotate-token`,{method:`POST`,body:{},signal:e,parse:ve})},Q=n(),ye=[`mcp-host`,`status`];function be(e){return JSON.stringify({mcpServers:{pisper:{url:e.url,headers:{Authorization:`Bearer ${e.token}`}}}},null,2)}function xe({notify:e,requestConfirm:t}){let{t:n}=r(),i=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(``),_=(0,H.useRef)(null),y=(0,H.useRef)(null),x=typeof window<`u`&&!!window.__PISPER_MOBILE_APP__,C=f({queryKey:ye,queryFn:({signal:e})=>Z.status(e),enabled:!x&&!a,refetchInterval:15e3});if((0,H.useEffect)(()=>()=>{_.current?.abort()},[]),x)return null;let w=C.data,T=p?be(p):``,E=()=>{_.current?.abort(),_.current=null,m(null),g(``),u(!1)},te=async()=>{_.current?.abort();let e=new AbortController;_.current=e,c(!0),m(null),g(``),u(!0);try{let t=await Z.credentials(e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||g(t instanceof Error?t.message:n(`mcp:hostLoadFailed`))}finally{_.current===e&&(_.current=null,c(!1))}},j=async t=>{o(!0);try{let r=await Z.setEnabled(t);i.setQueryData(ye,r),t||E(),e(r.error||n(t?`mcp:hostEnabledNotice`:`mcp:hostDisabledNotice`),r.error?`error`:`success`)}catch(t){e(t instanceof Error?t.message:n(`mcp:hostUpdateFailed`),`error`)}finally{o(!1)}},L=async()=>{if(t&&!await t({title:n(`mcp:hostRotateTitle`),message:n(`mcp:hostRotateWarning`),confirmLabel:n(`mcp:hostRotate`),tone:`danger`}))return;_.current?.abort();let r=new AbortController;_.current=r,c(!0),g(``),m(null);try{let t=await Z.rotateToken(r.signal);r.signal.aborted||(m(t),e(n(`mcp:hostRotatedNotice`),`success`))}catch(e){r.signal.aborted||g(e instanceof Error?e.message:n(`mcp:hostRotateFailed`))}finally{_.current===r&&(_.current=null,c(!1))}},R=async()=>{try{await navigator.clipboard.writeText(T),e(n(`mcp:hostCopied`),`success`)}catch{y.current?.select(),e(n(`mcp:hostCopyManually`),`error`)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{className:`mcp-host mt-7`,children:(0,Q.jsx)(B,{"data-mcp-host":!0,icon:(0,Q.jsx)(S,{}),name:n(`mcp:hostTitle`),description:n(`mcp:hostDescription`),status:w&&(0,Q.jsxs)(`span`,{className:O(`flex items-center gap-1.5`,!w.listening&&w.enabled&&`font-medium text-st-attn`),children:[!w.listening&&w.enabled&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),w.listening?n(`mcp:hostReady`):w.enabled?n(`mcp:hostUnavailable`):n(`mcp:disabled`)]}),actions:(0,Q.jsx)(D,{checked:!!w?.enabled,disabled:!w||a,"aria-label":n(`mcp:hostEnabled`),title:n(`mcp:hostEnabled`),onCheckedChange:e=>void j(e)}),detail:C.isPending||C.error||w?.error||w?.listening?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[C.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-content-muted`,children:n(`mcp:loading`)}),C.error&&(0,Q.jsxs)(z,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:C.error.message}),(0,Q.jsx)(A,{size:`sm`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:()=>void C.refetch(),children:n(`mcp:retry`)})]}),w?.error&&(0,Q.jsx)(z,{role:`status`,className:`text-xs text-muted-foreground`,children:w.error}),w?.listening&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Q.jsx)(`code`,{className:`max-w-full min-w-0 rounded-xs border border-stroke bg-code px-2 py-0.5 font-mono text-xs break-all text-content`,children:w.url}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void te(),children:[(0,Q.jsx)(ee,{"data-icon":`inline-start`}),n(`mcp:hostShowConfig`)]})]})]}):void 0})}),(0,Q.jsx)(re,{open:l,onOpenChange:e=>!e&&E(),children:(0,Q.jsxs)(N,{className:`min-w-0 grid-cols-[minmax(0,1fr)] sm:max-w-xl`,children:[(0,Q.jsxs)(ne,{className:`min-w-0 pr-8 text-left`,children:[(0,Q.jsx)(P,{children:n(`mcp:hostConfigTitle`)}),(0,Q.jsx)(M,{className:`leading-5`,children:n(`mcp:hostConfigDescription`)})]}),s&&(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-content-muted`,children:[(0,Q.jsx)(k,{}),n(`mcp:hostLoadingConfig`)]}),h&&(0,Q.jsx)(z,{role:`alert`,className:`text-sm text-muted-foreground`,children:h}),p&&(0,Q.jsx)(I,{ref:y,value:T,readOnly:!0,spellCheck:!1,"aria-label":n(`mcp:hostConfigTitle`),className:`h-52 max-h-[45dvh] resize-y bg-code font-mono text-xs [overflow-wrap:anywhere]`,onFocus:e=>e.currentTarget.select()}),(0,Q.jsxs)(F,{className:`min-w-0 flex-wrap`,children:[(0,Q.jsxs)(A,{variant:`secondary`,disabled:s,onClick:()=>void L(),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),n(`mcp:hostRotate`)]}),(0,Q.jsxs)(A,{disabled:!p||s,onClick:()=>void R(),children:[(0,Q.jsx)(v,{"data-icon":`inline-start`}),n(`mcp:hostCopyConfig`)]})]})]})})]})}var $=[`mcp`,`dashboard`],Se=[`mcp`,`change`];function Ce(){return m({queryKey:$,queryFn:({signal:e})=>X.dashboard(e),staleTime:0,retry:!1})}function we(e){return{mutationKey:Se,scope:{id:`mcp-dashboard`},retry:!1,mutationFn:async t=>(await e.cancelQueries({queryKey:$}),t()),onSuccess:t=>e.setQueryData($,t),onSettled:()=>e.invalidateQueries({queryKey:$})}}function Te(){let e=d(),t=le({mutationKey:Se})>0,n=f({...Ce(),enabled:!t,refetchInterval:!t&&1e4}),r=de(we(e));return{data:n.data,loading:n.isPending,error:r.error||n.error,busy:t,change:r.mutateAsync,reload:()=>(r.reset(),n.refetch())}}var Ee=`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`;function De(e,t){return e===`online`?[t(`mcp:online`),!1]:e===`connecting`?[t(`mcp:connecting`),!1]:e===`unauthorized`?[t(`mcp:unauthorized`),!0]:e===`disabled`?[t(`mcp:disabled`),!1]:[t(`mcp:offline`),!0]}function Oe(e,t){return e===`high`||e===`高风险`?t(`mcp:highRisk`):e===`medium`||e===`中风险`?t(`mcp:mediumRisk`):e===`low`||e===`低风险`?t(`mcp:lowRisk`):String(e||``)}function ke(e,t){return e.auth===`headers`?t(`mcp:countRequestHeaders`,{count:e.authCount}):e.auth===`environment`?t(`mcp:configuredEnvironmentVariables`):e.auth===`local`?t(`mcp:localProcess`):t(`mcp:none`)}function Ae({notify:e,onBack:t,requestText:n,requestConfirm:i}){let{t:a,language:o}=r(),s=te(`focusSearch`),{data:c,busy:l,loading:u,error:d,change:f,reload:p}=Te(),[m,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),ee=(0,H.useCallback)(async()=>{let t=await n?.({title:a(`mcp:addMCPService`),message:a(`mcp:enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv`),inputLabel:a(`mcp:serverConfiguration`),placeholder:`https://server.example.com/mcp`,maxLength:12e3,confirmLabel:a(`mcp:continue`)});if(t?.trim()&&await i?.({title:a(`mcp:connectMCPServer`),message:a(`mcp:mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust`),confirmLabel:a(`mcp:connect`),tone:`danger`})!==!1)try{let n=await f(()=>X.add(t));v(n.services.at(-1)?.id||``),e(a(`mcp:mcpServerAdded`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},[f,e,i,n,a]),k=m.trim().toLowerCase(),M=c?.services||[],N=M.filter(e=>`${e.name} ${e.endpoint}`.toLowerCase().includes(k)),P=(c?.tools||[]).filter(e=>`${e.name} ${e.serviceName} ${e.description}`.toLowerCase().includes(k)),F=c?.metrics||{totalServices:0,onlineServices:0,availableTools:0,restrictedTools:0,errorRate:0},ne=async(t,n)=>{try{await f(()=>X.setToolEnabled(t.serviceId,t.name,n))}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},re=async(t,n)=>{try{await f(()=>X.setServerEnabled(t.id,n)),e(a(n?`mcp:mcpServerEnabled`:`mcp:mcpServerDisabled`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},I=async t=>{try{await f(()=>X.test(t.id)),e(a(`mcp:mcpConnectionTestPassed`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ce=async t=>{if(await i?.({title:a(`mcp:deleteMCPServer`),message:a(`mcp:afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns`),confirmLabel:a(`mcp:delete`),tone:`danger`})!==!1)try{await f(()=>X.remove(t.id)),v(``),e(a(`mcp:mcpServerDeleted`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},le=e=>{let t=(c?.calls||[]).filter(t=>t.serviceId===e.id);return(0,Q.jsxs)(`div`,{className:`mcp-service-detail grid gap-3`,children:[(0,Q.jsx)(`p`,{className:O(`text-xs leading-normal [overflow-wrap:anywhere]`,e.error?`font-mono text-content-secondary`:`text-content-muted`),children:e.error||a(`mcp:thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes`)}),(0,Q.jsx)(`dl`,{className:Ee,children:[[a(`mcp:transport`),e.transport===`stdio`?`stdio`:e.transport===`sse`?`HTTP + SSE`:`Streamable HTTP`,!1],...e.transport===`stdio`?[[a(`mcp:executable`),e.command||`—`,!0],[a(`mcp:workingDirectory`),e.workingDirectory||`—`,!0]]:[[a(`mcp:serverAddress`),e.endpoint||`—`,!0]],[a(`mcp:latency`),e.latencyMs==null?`—`:`${e.latencyMs} ms`,!1],[a(`mcp:lastPing`),e.lastPingAt?j(e.lastPingAt,o):`—`,!1],[a(`mcp:authentication`),ke(e,a),!1]].map(([e,t,n])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:e}),(0,Q.jsx)(`dd`,{className:n?`font-mono`:`tabular-nums`,children:t})]},e))}),(0,Q.jsxs)(`section`,{className:`mcp-calls-panel min-w-0`,"aria-label":a(`mcp:recentCalls`),children:[(0,Q.jsxs)(`h3`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[a(`mcp:recentCalls`),t.length>0&&(0,Q.jsxs)(`span`,{children:[` · `,Math.min(t.length,8)]})]}),t.length?(0,Q.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.slice(0,8).map(e=>{let t=e.status===`ok`;return(0,Q.jsxs)(`li`,{className:O(`activity-row grid min-h-10 min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-center gap-2.5 py-1.5`,t?`completed`:`failed`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 place-items-center text-content-muted [&_svg]:size-3.5 [&_svg]:stroke-[2]`,children:t?(0,Q.jsx)(_,{}):(0,Q.jsx)(T,{})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`strong`,{className:`truncate font-mono text-xs font-medium text-content`,children:e.toolName}),(0,Q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:t?a(`mcp:callSucceeded`):e.error||a(`mcp:callFailed`)})]}),(0,Q.jsxs)(`span`,{className:`flex flex-col items-end text-xs text-content-muted tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-content-secondary`,children:[e.durationMs,` ms`]}),(0,Q.jsx)(`span`,{children:j(e.timestamp,o)})]})]},e.id)})}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 py-1 text-xs text-content-muted`,children:[(0,Q.jsx)(x,{className:`size-3.5`,"aria-hidden":`true`}),a(`mcp:noRecentCalls`)]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsxs)(A,{size:`sm`,variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:l,onClick:()=>void ce(e),children:[(0,Q.jsx)(C,{"data-icon":`inline-start`}),a(`mcp:delete`)]}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,loading:l,disabled:!e.enabled||l,onClick:()=>void I(e),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),a(`mcp:testConnection`)]})]})]})};return(0,Q.jsxs)(oe,{title:a(`navigation:navigation.mcp`),description:a(`mcp:lede`),back:t&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Q.jsx)(se,{search:(0,Q.jsx)(ie,{id:E,value:m,onValueChange:h,placeholder:a(`navigation:pageHeader.searchServicesOrTools`),shortcut:s,clearLabel:a(`navigation:more.clearSearch`)}),actions:(0,Q.jsxs)(A,{type:`button`,className:`h-9`,"data-mcp-add":!0,disabled:l,onClick:()=>void ee(),children:[(0,Q.jsx)(y,{}),a(`navigation:pageHeader.addService`)]})}),children:[(0,Q.jsx)(xe,{notify:e,requestConfirm:i}),u&&!c&&!d?(0,Q.jsx)(L,{kind:`loading`,title:a(`mcp:loading`)}):!c&&d?(0,Q.jsx)(L,{kind:`error`,title:a(`mcp:loadFailed`),description:d.message,action:(0,Q.jsx)(A,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})}):c&&(0,Q.jsxs)(Q.Fragment,{children:[d&&(0,Q.jsxs)(z,{role:`status`,className:`mt-4 flex min-w-0 items-center justify-between gap-3 text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{children:d.message}),(0,Q.jsx)(A,{variant:`ghost`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})]}),(0,Q.jsx)(ae,{className:`mcp-services`,title:a(`mcp:services`),count:N.length,meta:M.length>0&&a(`mcp:serviceSummary`,{online:F.onlineServices,total:F.totalServices,rate:F.errorRate}),children:N.length?(0,Q.jsx)(V,{children:N.map(e=>{let[t,n]=De(e.status,a),r=e.transport===`stdio`?e.workingDirectory||e.command:e.endpoint;return(0,Q.jsx)(B,{className:`service-row`,"data-mcp-service":e.id,icon:(0,Q.jsx)(S,{}),name:e.name,description:(0,Q.jsx)(`span`,{className:`font-mono text-xs`,title:r,children:r}),status:(0,Q.jsxs)(`span`,{"data-mcp-status":e.status||`offline`,className:O(`flex items-center gap-1.5`,n&&`font-medium text-st-attn`),children:[n&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),t]}),actions:(0,Q.jsx)(D,{checked:e.enabled,disabled:l,"aria-label":a(`mcp:toggleServiceName`,{name:e.name}),onCheckedChange:t=>void re(e,t)}),expanded:g===e.id,onExpandedChange:t=>v(t?e.id:``),toggleLabel:a(`mcp:toggleServiceDetails`,{name:e.name}),detail:le(e)},e.id)})}):(0,Q.jsx)(R,{icon:S,title:a(`mcp:noServerConfigured`),description:M.length?void 0:a(`mcp:emptyAddHint`)})}),(0,Q.jsx)(ae,{className:`mcp-tools-panel`,title:a(`mcp:toolCapabilities`),count:P.length,meta:F.restrictedTools>0&&a(`mcp:toolSummary`,{count:F.restrictedTools}),children:P.length?(0,Q.jsx)(V,{children:P.map(e=>(0,Q.jsx)(B,{className:`tool-row`,"data-mcp-tool":e.piName,icon:(0,Q.jsx)(w,{}),name:(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),description:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.serviceName}),e.description&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,e.description]})]}),status:Oe(e.risk,a),actions:(0,Q.jsx)(D,{checked:!!e.enabled,disabled:l||!e.serviceEnabled,"aria-label":a(`mcp:toggleToolName`,{name:e.name}),onCheckedChange:t=>void ne(e,t)})},e.piName))}):(0,Q.jsx)(R,{compact:!0,icon:w,title:a(`mcp:noToolsAvailable`)})})]})]})}export{Ae as McpPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryEvolution-DBjU-Nr7.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/vendor-router-CSN_DGvx.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/info-DATxy0fb.js","assets/pause-CYWpPg1R.js","assets/play-DNDjDNGn.js","assets/x-07u4-129.js","assets/popover-C5U02alK.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/dialog-D23yIdOZ.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/slider-De8rWVNs.js","assets/dist-DzGQ7sLi.js","assets/dist-BS3ekNDj.js","assets/segmented-control-xkrEOP_d.js","assets/dist-BaBySQmo.js","assets/PageState-Cz6vFMXv.js","assets/motion-DTR4ZVle.js","assets/memory-api-DHLgFXzZ.js","assets/api-Cm58F7OP.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-B2n7HFQ4.js","assets/event-stream-BrDcABQx.js","assets/http-DtkTCrZ4.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t,u as n}from"./vendor-router-CSN_DGvx.js";import{t as r}from"./index-79gEOxmD.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{f as o}from"./routes-DIeaqWVc.js";import{t as s}from"./use-i18n-8V6eRMcE.js";import{t as c}from"./storage-DtvZ_lEu.js";import{i as l}from"./http-response-B2n7HFQ4.js";import"./http-DtkTCrZ4.js";import{t as u}from"./createLucideIcon-Cd-3GVxJ.js";import{t as d}from"./archive-ojKJT7Fp.js";import{t as f}from"./book-open-BuHHD9os.js";import{t as p}from"./ellipsis-CfGKfbq6.js";import{t as m}from"./file-code-corner-BnE1ljT0.js";import{n as h,r as g,t as _}from"./undo-2-C-xQ0UVT.js";import{t as v}from"./message-square-text-C5MJw0FL.js";import{t as y}from"./pencil-U08v_vV9.js";import{t as b}from"./pin-off-BpRu_vrC.js";import{t as x}from"./pin-CU0FG0lI.js";import{t as S}from"./plus-fQbSqB1n.js";import{t as C}from"./refresh-cw-TbWxTY4K.js";import{t as w}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as ee}from"./rotate-ccw-C0v8V77_.js";import{t as T}from"./sliders-horizontal-Dryf1XyC.js";import{t as E}from"./trash-2-CNrPOoPR.js";import{t as te}from"./triangle-alert-CE1q54ci.js";import{t as D}from"./x-07u4-129.js";import{t as ne}from"./more-pages-D_PnxLN0.js";import{c as re,i as O,p as ie,r as ae,t as oe}from"./dropdown-menu-Ds0gD8S8.js";import{i as k,n as A,r as se,t as ce}from"./tabs-DsgBuvJv.js";import{t as le}from"./segmented-control-xkrEOP_d.js";import{t as ue}from"./utils-C8uzG5AZ.js";import{n as j,t as M}from"./button-CCcCN8tE.js";import{s as de}from"./shortcuts-DRfz9B_B.js";import{a as N,i as fe,l as P,o as F,s as I,t as L}from"./dialog-D23yIdOZ.js";import{t as R}from"./input-CPw-zkYh.js";import{t as pe}from"./textarea-DmATpOqT.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{a as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be}from"./FeaturePage-C0bAQ4el.js";import{n as V}from"./field-DoLEb0np.js";import{t as xe}from"./AppSelect-DQYKUW5E.js";import{t as H}from"./badge-CWB3lj2H.js";import{i as U}from"./app-primitives-Drz_SjnR.js";import{a as Se,c as Ce,f as W,g as we,h as Te,i as G,l as K,m as Ee,n as De,o as Oe,p as ke,r as Ae,s as je,t as Me,u as Ne}from"./memory-api-DHLgFXzZ.js";var Pe=u(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Fe=u(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ie=u(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Le=u(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Re=u(`milestone`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z`,key:`8gz4t4`}]]),ze=u(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),q=e(i(),1),Be={concept:g,file:m,risk:te,preference:T,decision:Re,fact:f,task:h};function Ve(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function He(e,t){return t(e===`manual`?`memory:memoryPage.sourceManual`:e===`user_confirmed`?`memory:memoryPage.sourceUserRequest`:e===`agent`?`memory:memoryPage.sourceAgent`:e===`tool_verified`?`memory:memoryPage.sourceTool`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.sourceConversation`)}function Ue(e,t){return t(e===`assistant`?`memory:memoryPage.roleAssistant`:e===`tool`?`memory:memoryPage.roleTool`:e===`external`?`memory:memoryPage.roleExternal`:e===`manual`?`memory:memoryPage.roleManual`:`memory:memoryPage.roleUser`)}function We(e,t){return[e.pinned&&t(`memory:memoryPage.pinnedBadge`),e.status===`stale`&&t(`memory:memoryPage.staleBadge`),e.tainted&&t(`memory:memoryPage.taintedBadge`),e.status===`archived`&&t(`memory:memoryPage.archivedBadge`),e.status===`superseded`&&t(`memory:memoryPage.supersededBadge`)].filter(e=>!!e)}function J(e,t){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function Y(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function Ge(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`}).format(n)}function Ke(e,t){let n={add:{icon:S,label:()=>t(`memory:memoryPage.eventAdd`)},supersede:{icon:ze,label:()=>t(`memory:memoryPage.eventSupersede`)},merge:{icon:Le,label:()=>t(`memory:memoryPage.eventMerge`)},archive:{icon:d,label:()=>t(`memory:memoryPage.eventArchive`)},expire:{icon:Fe,label:()=>t(`memory:memoryPage.eventExpire`)},stale:{icon:te,label:()=>t(`memory:memoryPage.eventStale`)},confirm:{icon:Pe,label:()=>t(`memory:memoryPage.eventConfirm`)},restore:{icon:ee,label:()=>t(`memory:memoryPage.eventRestore`)},edit:{icon:y,label:()=>t(`memory:memoryPage.eventEdit`)},pin:{icon:x,label:()=>t(`memory:memoryPage.eventPin`)},unpin:{icon:b,label:()=>t(`memory:memoryPage.eventUnpin`)},delete:{icon:E,label:()=>t(`memory:memoryPage.eventDelete`)},purge:{icon:Ie,label:()=>t(`memory:memoryPage.eventPurge`)},undo:{icon:_,label:()=>t(`memory:memoryPage.eventUndo`)},reinforce:{icon:C,label:()=>t(`memory:memoryPage.eventReinforce`)},migrate:{icon:w,label:()=>t(`memory:memoryPage.eventMigrate`)},consolidate:{icon:Le,label:()=>t(`memory:memoryPage.eventConsolidate`)}}[e];return n?{icon:n.icon,label:n.label()}:{icon:w,label:t(`memory:memoryPage.eventGeneric`)}}function qe(e,t){return e===`user`||e===`manual`||e===`user_confirmed`?t(`memory:memoryPage.actorYou`):[`consolidator`,`reconcile`,`lifecycle`].includes(e)?t(`memory:memoryPage.actorConsolidator`):t(e===`conversation`?`memory:memoryPage.actorConversation`:e===`agent`||e===`tool_verified`?`memory:memoryPage.actorAgent`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.actorSystem`)}function Je(e,t){if(e===`same_identity`)return t(`memory:memoryPage.reasonSameIdentity`);if(e===`lower_authority_conflict`)return t(`memory:memoryPage.reasonLowerAuthority`);if(e===`expired`||e===`retention_expired`)return t(`memory:memoryPage.reasonExpired`);if(e===`unused`||e===`low_utility`)return t(`memory:memoryPage.reasonLowUtility`);if(e===`user_deleted`)return t(`memory:memoryPage.reasonUserDeleted`);if(e===`user_requested`)return t(`memory:memoryPage.reasonUserRequested`);let n=/^digests:(\d+) merged:(\d+)$/.exec(e);if(n){let e=Number(n[1]),r=Number(n[2]);return e&&r?t(`memory:memoryPage.reasonConsolidatedBoth`,{digests:e,merged:r}):r?t(`memory:memoryPage.reasonConsolidatedMerged`,{merged:r}):t(`memory:memoryPage.reasonConsolidatedDigests`,{digests:e})}let r=/^promoted (\d+) pending candidates$/.exec(e);return r?t(`memory:memoryPage.reasonPromoted`,{count:Number(r[1])}):e}var X=a(),Ye=50;function Xe({spaceId:e,refreshKey:t,onChanged:n}){let{t:r,language:i}=s(),[a,o]=(0,q.useState)([]),[c,u]=(0,q.useState)(!0),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[v,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(``),S=(0,q.useRef)(0),C=e===`all`?``:e,w=(0,q.useCallback)(async()=>{let e=++S.current;u(!0),y(``);try{let t=await Ne({spaceId:C,limit:Ye});if(e!==S.current)return;o(t.events),m(t.events.length>=Ye),g(!1)}catch(t){if(e!==S.current)return;t instanceof l&&t.status===404?g(!0):y(t instanceof Error?t.message:String(t))}finally{e===S.current&&u(!1)}},[C]);(0,q.useEffect)(()=>(w(),()=>{S.current+=1}),[w,t]);let ee=async()=>{let e=a.at(-1)?.at;if(!e||d)return;let t=S.current;f(!0);try{let n=await Ne({spaceId:C,before:e,limit:Ye});if(t!==S.current)return;o(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.events.filter(e=>!t.has(e.id))]}),m(n.events.length>=Ye)}catch(e){t===S.current&&y(e instanceof Error?e.message:String(e))}finally{f(!1)}},T=async e=>{if(!b){x(e.id),y(``);try{await Te(e.id),await n(r(`memory:memoryPage.eventUndone`))}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(``)}}};return h?(0,X.jsx)(B,{compact:!0,title:r(`memory:memoryPage.activityUnsupported`)}):c&&!a.length?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):v&&!a.length?(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.activityLoadFailed`),description:v,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):a.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[v&&(0,X.jsx)(be,{className:`mt-0`,children:v}),(0,X.jsx)(ge,{children:a.map(e=>{let{icon:t,label:n}=Ke(e.action,r),a=e.reason?Je(e.reason,r):``;return(0,X.jsx)(he,{"data-memory-event":e.action,icon:(0,X.jsx)(t,{}),name:n,description:[...new Set(e.titles||[])].join(`、`)||void 0,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(e.at,i),` · `,qe(e.actor,r),a?` · ${a}`:``]}),status:e.undoneAt?r(`memory:memoryPage.undone`):void 0,actions:e.undoable?(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,disabled:!!b,"aria-label":`${r(`memory:memoryPage.undo`)}: ${n}`,onClick:()=>void T(e),children:[(0,X.jsx)(_,{}),r(`memory:memoryPage.undo`)]}):void 0},e.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void ee(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(B,{compact:!0,title:r(`memory:memoryPage.noActivity`)})}var Z=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content [&>dt]:shrink-0 [&>dt]:text-content-muted`;function Ze({labels:e}){return(0,X.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map(e=>(0,X.jsx)(H,{children:e},e))})}function Qe({id:e,fallback:t=null,spaces:n,refreshKey:r=0,withHeading:i=!1,onClose:a,onEdit:o,onChanged:c,onDeleted:l,requestConfirm:u}){let{t:d,language:f}=s(),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(!0),[_,v]=(0,q.useState)(``),[S,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(!1),[te,ne]=(0,q.useState)(0);(0,q.useEffect)(()=>{let t=new AbortController;return g(!0),v(``),K(e,t.signal).then(e=>{t.signal.aborted||(m(e),g(!1))}).catch(e=>{t.signal.aborted||(v(e instanceof Error?e.message:String(e)),g(!1))}),()=>t.abort()},[e,r,te]);let re=(0,q.useCallback)(async(e,t)=>{T(!0),C(``);try{await e(),await c(t)}catch(e){C(e instanceof Error?e.message:String(e))}finally{T(!1)}},[c]),O=p?.item?.id===e?p.item:t,ie=p?.item?.id===e?p.history:[],ae=async()=>{if(O&&await u({title:d(`memory:memoryPage.deleteMemory`),message:d(`memory:memoryPage.deleteMemoryName`,{name:O.title}),confirmLabel:d(`memory:memoryPage.delete`)})){T(!0),C(``);try{await Se(O.id),await l(d(`memory:memoryPage.memoryDeleted`))}catch(e){C(e instanceof Error?e.message:String(e)),T(!1)}}};if(!O)return(0,X.jsx)(`div`,{className:`flex min-h-16 items-center gap-2 text-xs text-content-muted`,children:h?(0,X.jsx)(j,{className:`size-4`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{className:`my-0`,children:_||d(`memory:memoryPage.detailLoadFailed`)}),(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>ne(e=>e+1),children:d(`memory:memoryPage.retry`)})]})});let oe=n.find(e=>e.id===O.spaceId),k=O.status===`active`||O.status===`stale`||!O.status,A=We(O,d);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,"aria-busy":h||w||void 0,children:[i&&(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:O.title}),A.length>0&&(0,X.jsx)(Ze,{labels:A})]}),a&&(0,X.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`-mt-0.5 flex-none max-[650px]:size-11`,"aria-label":d(`memory:memoryPage.closeDetail`),onClick:a,children:(0,X.jsx)(D,{})})]}),(0,X.jsx)(`p`,{className:`text-[13px] leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:O.content}),O.status===`stale`&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.staleHint`)}),O.tainted&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.taintedHint`)}),(0,X.jsxs)(`dl`,{className:`m-0`,children:[(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memoryType`)}),(0,X.jsx)(`dd`,{children:Ve(O.type,d)})]}),oe&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memorySpace`)}),(0,X.jsx)(`dd`,{children:J(oe,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.source`)}),(0,X.jsx)(`dd`,{children:He(O.sourceType,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validFrom`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(O.validFrom,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validTo`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:O.validTo?Y(O.validTo,f):d(`memory:memoryPage.stillValid`)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.created`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(O.createdAt,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.confirmCount`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:O.confirmCount??1})]}),O.expiresAt&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.expires`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(O.expiresAt,f)})]}),O.sourcePath&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.relatedFilePath`)}),(0,X.jsx)(`dd`,{className:`font-mono text-xs`,title:O.sourcePath,children:O.sourcePath})]}),O.archiveReason&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.archiveReason`)}),(0,X.jsx)(`dd`,{title:Je(O.archiveReason,d),children:Je(O.archiveReason,d)})]})]}),O.evidence&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.evidence`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted`,children:[d(`memory:memoryPage.evidenceFrom`),` · `,Ue(O.evidenceRole,d)]}),(0,X.jsx)(`blockquote`,{className:`m-0 border-l-2 border-stroke pl-2.5 text-xs leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:O.evidence})]}),ie.length>1&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.versionHistory`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[d(`memory:memoryPage.versionHistory`),` · `,ie.length]}),(0,X.jsx)(`ol`,{"data-memory-history":!0,className:`m-0 flex list-none flex-col p-0`,children:ie.map(e=>{let t=e.status===`active`||e.status===`stale`;return(0,X.jsxs)(`li`,{"aria-current":e.id===O.id||void 0,className:ue(`flex min-w-0 flex-col gap-0.5 border-t border-stroke-soft py-1.5 text-xs leading-normal`,!t&&`text-content-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 tabular-nums`,children:[Ge(e.validFrom,f),t&&(0,X.jsx)(H,{children:d(`memory:memoryPage.currentVersion`)})]}),(0,X.jsx)(`span`,{className:`break-words whitespace-pre-wrap`,children:e.content})]},e.id)})})]}),S&&(0,X.jsx)(U,{className:`my-0`,children:S}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:w,onClick:()=>void ae(),children:[(0,X.jsx)(E,{}),d(`memory:memoryPage.delete`)]}),k?(0,X.jsxs)(X.Fragment,{children:[O.status===`stale`&&(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:w,onClick:()=>void re(()=>ke(O.id,`confirm`),d(`memory:memoryPage.confirmed`)),children:[(0,X.jsx)(Pe,{}),d(`memory:memoryPage.confirmStillValid`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:w,onClick:()=>void re(()=>ke(O.id,O.pinned?`unpin`:`pin`),O.pinned?d(`memory:memoryPage.unpinned`):d(`memory:memoryPage.pinned`)),children:[O.pinned?(0,X.jsx)(b,{}):(0,X.jsx)(x,{}),O.pinned?d(`memory:memoryPage.unpin`):d(`memory:memoryPage.pin`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:w,onClick:()=>o(O),children:[(0,X.jsx)(y,{}),d(`memory:memoryPage.edit`)]})]}):(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:w,onClick:()=>void re(()=>ke(O.id,`restore`),d(`memory:memoryPage.restored`)),children:[(0,X.jsx)(ee,{}),d(`memory:memoryPage.restore`)]})]})]})}var $e=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],et=[.3,.5,.8,1];function tt(e){let t=e??.5;return et.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function nt(e){return e instanceof Error?e.message:String(e)}function rt({spaces:e,node:t,initialSpaceId:n,onClose:r,onSaved:i}){let{t:a}=s(),[o,c]=(0,q.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:tt(t?.importance)}),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(``),p=a(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),m=async e=>{if(e.preventDefault(),!l){u(!0),f(``);try{t?await we(t.id,o):await Ae(o),await i(a(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){f(nt(e))}finally{u(!1)}}};return(0,X.jsx)(L,{open:!0,busy:l,onOpenChange:e=>!e&&r(),children:(0,X.jsx)(fe,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void m(e),children:[(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{children:p}),(0,X.jsx)(N,{children:a(`memory:memoryPage.memoryDialogHint`)})]}),(0,X.jsxs)(V,{variant:`control`,children:[a(`memory:memoryPage.memoryTitle`),(0,X.jsx)(R,{value:o.title,onChange:e=>c({...o,title:e.target.value}),placeholder:a(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,X.jsxs)(V,{variant:`control`,children:[a(`memory:memoryPage.memoryContent`),(0,X.jsx)(pe,{value:o.content,onChange:e=>c({...o,content:e.target.value}),placeholder:a(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,X.jsxs)(V,{variant:`control`,children:[a(`memory:memoryPage.memorySpace`),(0,X.jsx)(xe,{value:o.spaceId,onChange:e=>c({...o,spaceId:e.target.value}),children:e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:J(e,a)},e.id))})]}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-x-2.5 gap-y-3 sm:grid-cols-2`,children:[(0,X.jsxs)(V,{variant:`control`,children:[a(`memory:memoryPage.memoryType`),(0,X.jsx)(xe,{value:o.type,onChange:e=>c({...o,type:e.target.value}),children:$e.map(e=>(0,X.jsx)(`option`,{value:e,children:Ve(e,a)},e))})]}),(0,X.jsxs)(V,{variant:`control`,children:[a(`memory:memoryPage.importance`),(0,X.jsxs)(xe,{value:o.importance,onChange:e=>c({...o,importance:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:`0.3`,children:a(`memory:memoryPage.normal`)}),(0,X.jsx)(`option`,{value:`0.5`,children:a(`memory:memoryPage.common`)}),(0,X.jsx)(`option`,{value:`0.8`,children:a(`memory:memoryPage.important`)}),(0,X.jsx)(`option`,{value:`1`,children:a(`memory:memoryPage.strict`)})]})]})]}),(0,X.jsxs)(V,{variant:`control`,children:[a(`memory:memoryPage.relatedFilePath`),(0,X.jsx)(R,{value:o.sourcePath,onChange:e=>c({...o,sourcePath:e.target.value}),placeholder:a(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),d&&(0,X.jsx)(U,{children:d}),(0,X.jsxs)(F,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:l,onClick:r,children:a(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:l||!o.spaceId||!o.title.trim()||!o.content.trim(),children:[l&&(0,X.jsx)(j,{className:`text-current`}),a(l?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}function it({space:e,onClose:t,onSaved:n}){let{t:r}=s(),[i,a]=(0,q.useState)(e?.name||``),[o,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(``),d=r(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),f=async t=>{if(t.preventDefault(),!o){c(!0),u(``);try{await n(e?await Ee(e.id,i):await G(i),r(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){u(nt(e))}finally{c(!1)}}};return(0,X.jsx)(L,{open:!0,busy:o,onOpenChange:e=>!e&&t(),children:(0,X.jsx)(fe,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void f(e),children:[(0,X.jsxs)(I,{children:[(0,X.jsx)(P,{children:d}),(0,X.jsx)(N,{children:r(`memory:memoryPage.memorySpaceHint`)})]}),(0,X.jsxs)(V,{variant:`control`,children:[r(`memory:memoryPage.memorySpaceName`),(0,X.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:r(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),l&&(0,X.jsx)(U,{children:l}),(0,X.jsxs)(F,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:o,onClick:t,children:r(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:o||!i.trim(),children:[o&&(0,X.jsx)(j,{className:`text-current`}),r(o?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}var at=30;function ot({digest:e}){let{t}=s(),r=n(),[i,a]=(0,q.useState)([]);return(0,q.useEffect)(()=>{let t=new AbortController;return K(e.id,t.signal).then(e=>a(e.children||[]),()=>a([])),()=>t.abort()},[e.id]),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed break-words whitespace-pre-wrap`,children:e.text}),i.length>0&&(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`m-0 text-xs font-medium text-content-muted`,children:t(`memory:memoryPage.sessionFacts`)}),(0,X.jsx)(`ul`,{className:`m-0 mt-1 list-disc pl-4 text-sm leading-relaxed`,children:i.map(e=>(0,X.jsx)(`li`,{className:`break-words`,children:e.title},e.id))})]}),e.sessionAvailable&&(0,X.jsx)(`div`,{children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>r(o(e.sessionId)),children:t(`memory:memoryPage.openSession`)})})]})}function st({spaceId:e,spaces:t,refreshKey:n}){let{t:r,language:i}=s(),[a,o]=(0,q.useState)([]),[c,u]=(0,q.useState)(!0),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(``),S=(0,q.useRef)(0),C=e===`all`?``:e,w=(0,q.useCallback)(async()=>{let e=++S.current;u(!0),y(``);try{let t=await W({spaceId:C,limit:at});if(e!==S.current)return;o(t.sessions),m(t.sessions.length>=at),g(!1)}catch(t){if(e!==S.current)return;t instanceof l&&t.status===404?g(!0):y(t instanceof Error?t.message:String(t))}finally{e===S.current&&u(!1)}},[C]);(0,q.useEffect)(()=>(w(),()=>{S.current+=1}),[w,n]);let ee=async()=>{let e=a.at(-1)?.windowEnd;if(!e||d)return;let t=S.current;f(!0);try{let n=await W({spaceId:C,before:e,limit:at});if(t!==S.current)return;o(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.sessions.filter(e=>!t.has(e.id))]}),m(n.sessions.length>=at)}catch(e){t===S.current&&y(e instanceof Error?e.message:String(e))}finally{f(!1)}};return h?(0,X.jsx)(B,{compact:!0,title:r(`memory:memoryPage.sessionsUnsupported`)}):c&&!a.length?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):_&&!a.length?(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.sessionsLoadFailed`),description:_,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):a.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[_&&(0,X.jsx)(be,{className:`mt-0`,children:_}),(0,X.jsx)(ge,{children:a.map(n=>{let a=n.sessionName||r(`memory:memoryPage.sessionUntitled`),o=t.find(e=>e.id===n.spaceId);return(0,X.jsx)(he,{"data-memory-session":n.sessionId,icon:(0,X.jsx)(v,{}),name:a,description:b===n.id?void 0:n.text,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(n.windowEnd,i),e===`all`&&o?` · ${J(o,r)}`:``]}),expanded:b===n.id,onExpandedChange:e=>x(e?n.id:``),toggleLabel:a,detail:(0,X.jsx)(ot,{digest:n})},n.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void ee(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(B,{compact:!0,title:r(`memory:memoryPage.noSessionDigests`)})}var ct=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate());function lt(e){let t=ct(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7)}function ut(e,t,n=Date.now()){let r=new Date(n),i=ct(r).getTime(),a=i-864e5,o=lt(r).getTime(),s=new Map,c=(e,t)=>{let n=s.get(e.key);n?n.items.push(t):s.set(e.key,{...e,items:[t]})};for(let n of e){let e=Date.parse(t(n)||``);if(Number.isNaN(e))c({key:`unknown`,kind:`unknown`},n);else if(e>=i)c({key:`today`,kind:`today`},n);else if(e>=a)c({key:`yesterday`,kind:`yesterday`},n);else if(e>=o)c({key:`week`,kind:`week`},n);else{let t=new Date(e);c({key:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}`,kind:`month`,month:new Date(t.getFullYear(),t.getMonth(),1)},n)}}return[...s.values()]}var dt=(0,q.lazy)(()=>t(()=>import(`./MemoryEvolution-DBjU-Nr7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38]))),Q=`all`;function ft(){try{let e=r.getItem(c.memoryView);return e===`timeline`||e===`sessions`||e===`activity`?e:`evolution`}catch{return`evolution`}}function pt(e){try{r.setItem(c.memoryView,e)}catch{}}function $(e){return e instanceof Error?e.message:String(e)}var mt={spaces:[],selectedSpaceId:``,nodes:[]};function ht({notify:e,onBack:t,requestConfirm:n}){let{t:r,language:i}=s(),a=de(`focusSearch`),[o,c]=(0,q.useState)(``),[l,u]=(0,q.useState)(ft),[d,f]=(0,q.useState)(Q),[m,h]=(0,q.useState)(`current`),[g,_]=(0,q.useState)(mt),[v,y]=(0,q.useState)(!0),[b,x]=(0,q.useState)(!1),[w,ee]=(0,q.useState)(!1),[T,E]=(0,q.useState)(``),[te,D]=(0,q.useState)(``),[ue,j]=(0,q.useState)(null),[N,fe]=(0,q.useState)(0),[P,F]=(0,q.useState)(null),[I,L]=(0,q.useState)(null),[R,pe]=(0,q.useState)(!1),V=(0,q.useRef)(0),H=(0,q.useCallback)(async()=>{let e=++V.current;y(!0),E(``);try{let t=await Ce({spaceId:d,query:o,status:m});if(e!==V.current)return;_(t),ee(!0),t.selectedSpaceId&&t.selectedSpaceId!==d&&f(t.selectedSpaceId)}catch(t){e===V.current&&E($(t))}finally{e===V.current&&y(!1)}},[o,d,m]);(0,q.useEffect)(()=>(H(),()=>{V.current+=1}),[H,N]);let U=async()=>{let e=g.nodes.at(-1),t=e?.validFrom||e?.createdAt;if(!t||b)return;let n=V.current;x(!0);try{let e=await Ce({spaceId:d,status:m,before:t});if(n!==V.current)return;_(t=>{let n=new Set(t.nodes.map(e=>e.id));return{...e,nodes:[...t.nodes,...e.nodes.filter(e=>!n.has(e.id))]}})}catch(e){n===V.current&&E($(e))}finally{x(!1)}},Se=(0,q.useCallback)(()=>fe(e=>e+1),[]),W=(0,q.useCallback)(t=>{e(t),Se()},[e,Se]),we=(0,q.useCallback)(e=>{D(``),j(null),W(e)},[W]),Te=(0,q.useMemo)(()=>[...g.spaces].sort((e,t)=>Number(t.kind===`global`)-Number(e.kind===`global`)),[g.spaces]),G=g.spaces.find(e=>e.id===d)||null,K=!!o.trim(),Ee=(0,q.useMemo)(()=>ut(g.nodes,e=>e.validFrom||e.createdAt),[g.nodes]),ke=e=>{let t=e;u(t),pt(t)},Ae=e=>{c(e),D(``),e.trim()&&l!==`timeline`&&u(`timeline`)},Ne=e=>{f(e),D(``),j(null)},Pe=async()=>{if(G&&await n({title:r(`memory:memoryPage.deleteMemorySpace`),message:r(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:J(G,r)}),confirmLabel:r(`memory:memoryPage.delete`)}))try{await Oe(G.id),Ne(Q),W(r(`memory:memoryPage.memorySpaceDeleted`))}catch(e){E($(e))}},Fe=async()=>{try{let{markdown:t}=await je(d===Q?``:d),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),i=document.createElement(`a`);i.href=n,i.download=`pisper-memory-${new Date().toISOString().slice(0,10)}.md`,i.click(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),e(r(`memory:memoryPage.exported`))}catch(e){E($(e))}},Ie=async()=>{if(!R){pe(!0),E(``);try{let e=await De();W(e.ran?r(`memory:memoryPage.consolidated`):r(`memory:memoryPage.nothingToConsolidate`))}catch(e){E($(e))}finally{pe(!1)}}},Le=async()=>{if(await n({title:r(`memory:memoryPage.clearEpisodes`),message:r(`memory:memoryPage.clearEpisodesConfirm`),confirmLabel:r(`memory:memoryPage.clearEpisodesAction`)}))try{let{cleared:e}=await Me(d===Q?``:d);W(r(`memory:memoryPage.episodesCleared`,{count:e}))}catch(e){E($(e))}},Re=!!G&&G?.kind!==`global`,ze=e=>(0,X.jsx)(Qe,{id:e.id,fallback:e,spaces:g.spaces,refreshKey:N,onEdit:F,onChanged:W,onDeleted:we,requestConfirm:n}),Ue=e=>{let t=Be[e.type]||Be.concept,n=We(e,r),a=g.spaces.find(t=>t.id===e.spaceId);return(0,X.jsx)(he,{"data-memory-node":e.id,icon:(0,X.jsx)(t,{}),name:e.title,nameMeta:Ve(e.type,r),description:te===e.id?void 0:e.content,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Ge(e.validFrom||e.createdAt,i),d===Q&&a?` · ${J(a,r)}`:``,` · ${He(e.sourceType,r)}`]}),status:n.length?(0,X.jsx)(Ze,{labels:n}):void 0,expanded:te===e.id,onExpandedChange:t=>D(t?e.id:``),toggleLabel:e.title,detail:ze(e)},e.id)},Y=e=>e.kind===`today`?r(`memory:memoryPage.groupToday`):e.kind===`yesterday`?r(`memory:memoryPage.groupYesterday`):e.kind===`week`?r(`memory:memoryPage.groupThisWeek`):e.kind===`unknown`||!e.month?r(`memory:memoryPage.groupUnknown`):new Intl.DateTimeFormat(i,{year:`numeric`,month:`long`}).format(e.month),Ke=r(K?`memory:memoryPage.noMatchingMemories`:m===`archived`?`memory:memoryPage.noArchivedMemories`:m===`history`?`memory:memoryPage.noHistoryVersions`:`memory:memoryPage.noMemoriesInSpace`);return(0,X.jsx)(ce,{asChild:!0,value:l,onValueChange:ke,className:`gap-0`,children:(0,X.jsxs)(ve,{title:r(`navigation:navigation.memory`),description:r(`memory:memoryPage.lede`),back:t&&{label:r(`navigation:sidebar.features`),ariaLabel:r(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,X.jsx)(ye,{search:(0,X.jsx)(me,{id:ne,value:o,onValueChange:Ae,placeholder:r(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:r(`navigation:more.clearSearch`)}),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(M,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F({spaceId:d===Q?`global`:d}),children:[(0,X.jsx)(S,{}),r(`memory:memoryPage.addMemory`)]}),(0,X.jsxs)(oe,{children:[(0,X.jsx)(ie,{asChild:!0,children:(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`icon-lg`,className:`max-[650px]:max-w-11`,disabled:!w,"aria-label":r(`memory:memoryPage.moreActions`),title:r(`memory:memoryPage.moreActions`),children:(0,X.jsx)(p,{})})}),(0,X.jsxs)(ae,{align:`end`,children:[(0,X.jsx)(O,{onSelect:()=>L(`new`),children:r(`memory:memoryPage.newMemorySpace`)}),(0,X.jsx)(O,{disabled:!Re,onSelect:()=>G&&L(G),children:r(`memory:memoryPage.renameMemorySpace`)}),(0,X.jsx)(O,{variant:`destructive`,disabled:!Re,onSelect:()=>void Pe(),children:r(`memory:memoryPage.deleteMemorySpace`)}),(0,X.jsx)(re,{}),(0,X.jsx)(O,{onSelect:()=>void Fe(),children:r(`memory:memoryPage.exportMarkdown`)}),(0,X.jsx)(O,{disabled:R,onSelect:()=>void Ie(),children:r(`memory:memoryPage.consolidateNow`)}),(0,X.jsx)(O,{onSelect:()=>void Le(),children:r(`memory:memoryPage.clearEpisodes`)})]})]})]}),filters:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(se,{"aria-label":r(`memory:memoryPage.viewsLabel`),children:[(0,X.jsx)(k,{value:`evolution`,children:r(`memory:memoryPage.evolutionView`)}),(0,X.jsx)(k,{value:`timeline`,children:r(`memory:memoryPage.timelineView`)}),(0,X.jsx)(k,{value:`sessions`,children:r(`memory:memoryPage.sessionsView`)}),(0,X.jsx)(k,{value:`activity`,children:r(`memory:memoryPage.activityView`)})]}),(0,X.jsxs)(xe,{className:`w-[200px] max-w-full max-[650px]:w-full`,"aria-label":r(`memory:memoryPage.memorySpace`),value:d,disabled:!w,onChange:e=>Ne(e.target.value),children:[(0,X.jsx)(`option`,{value:Q,children:r(`memory:memoryPage.allSpaces`)}),Te.map(e=>(0,X.jsx)(`option`,{value:e.id,children:`${J(e,r)} · ${e.nodeCount}`},e.id))]})]}),l===`timeline`&&w&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[K?(0,X.jsxs)(`p`,{className:`m-0 text-[13px] font-medium text-content-muted tabular-nums`,children:[r(`memory:memoryPage.searchResults`),` · `,g.nodes.length]}):(0,X.jsx)(le,{"aria-label":r(`memory:memoryPage.statusFilterLabel`),value:m,onValueChange:e=>{h(e),D(``)},options:[{value:`current`,label:r(`memory:memoryPage.statusCurrent`),count:g.counts?.current},{value:`archived`,label:r(`memory:memoryPage.statusArchived`),count:g.counts?.archived},{value:`history`,label:r(`memory:memoryPage.statusHistory`),count:g.counts?.history}]}),(0,X.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11`,loading:v,disabled:v,"aria-label":r(`memory:memoryPage.refresh`),title:r(`memory:memoryPage.refresh`),onClick:Se,children:(0,X.jsx)(C,{})})]})]})}),children:[!w&&v?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):w?(0,X.jsxs)(X.Fragment,{children:[T&&(0,X.jsx)(be,{children:T}),(0,X.jsxs)(`div`,{className:`mt-5 min-w-0`,"aria-busy":v,children:[(0,X.jsxs)(A,{value:`evolution`,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(q.Suspense,{fallback:(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}),children:(0,X.jsx)(dt,{spaceId:d,refreshKey:N,selectedId:ue,onSelect:j})}),(0,X.jsx)(`div`,{role:`region`,"data-memory-detail":!0,"aria-label":r(`memory:memoryPage.selectedMemory`),className:`min-w-0 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:ue?(0,X.jsx)(Qe,{id:ue,spaces:g.spaces,refreshKey:N,withHeading:!0,onClose:()=>j(null),onEdit:F,onChanged:W,onDeleted:we,requestConfirm:n}):(0,X.jsx)(`p`,{className:`m-0 text-xs leading-normal text-content-muted`,children:r(`memory:memoryPage.selectAMemoryToViewDetails`)})})]}),(0,X.jsxs)(A,{value:`timeline`,className:`min-w-0`,"data-memory-timeline":!0,children:[g.nodes.length?K?(0,X.jsx)(ge,{children:g.nodes.map(Ue)}):Ee.map(e=>(0,X.jsx)(_e,{"data-memory-group":e.key,className:`mt-5 first:mt-0`,title:Y(e),count:e.items.length,children:(0,X.jsx)(ge,{children:e.items.map(Ue)})},e.key)):(0,X.jsx)(B,{compact:!0,title:Ke}),!K&&g.hasMore&&(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:b,disabled:b,onClick:()=>void U(),children:r(`memory:memoryPage.loadMore`)})})]}),(0,X.jsx)(A,{value:`sessions`,className:`min-w-0`,children:(0,X.jsx)(st,{spaceId:d,spaces:g.spaces,refreshKey:N})}),(0,X.jsx)(A,{value:`activity`,className:`min-w-0`,children:(0,X.jsx)(Xe,{spaceId:d,refreshKey:N,onChanged:W})})]})]}):(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.loadFailed`),description:T,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void H(),children:r(`common:pageTemplate.retry`)})}),P&&(0,X.jsx)(rt,{spaces:Te,node:`id`in P?P:null,initialSpaceId:P.spaceId,onClose:()=>F(null),onSaved:e=>{F(null),W(e)}}),I&&(0,X.jsx)(it,{space:I===`new`?null:I,onClose:()=>L(null),onSaved:(e,t)=>{L(null),Ne(e.id),W(t)}})]})})}export{ht as MemoryPage};
@@ -1 +0,0 @@
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{i}from"./http-response-B2n7HFQ4.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-DmEFuNUL.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-D23yIdOZ.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-DS_-qn8W.js";import{r as S,t as C}from"./folder-paths-D0-7xV2n.js";import{n as w,t as T}from"./alert-DRIrgNI4.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
@@ -1 +0,0 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-8V6eRMcE.js";import{t as n}from"./PhoneMenuButton-uG_T93KL.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
@@ -1 +0,0 @@
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"./api-Cm58F7OP.js";import{i as a}from"./runtime-capabilities-CPDBo3tu.js";import{t as o}from"./runtime-capabilities-store-Y9MaywP8.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 ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as E,i as D,l as O,n as k,o as ne,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-DRfz9B_B.js";import{a as ce,i as M,l as N,o as P,s as F,t as I}from"./dialog-D23yIdOZ.js";import{t as L}from"./input-CPw-zkYh.js";import{t as R}from"./pick-system-directory-DS_-qn8W.js";import{n as le,t as ue}from"./PageState-Cz6vFMXv.js";import{a as de,i as z,n as B,o as V,r as fe,s as pe,t as H}from"./FeaturePage-C0bAQ4el.js";import{t as U}from"./AppSelect-DQYKUW5E.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-D-3gybP7.js";var K=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`}]]),q=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`}]]),J=e(t(),1),Y=n(),X=Object.defineProperty,Z=(e,t)=>X(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[O]),Q=O(),we=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(E,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ne,{...r,...n})},`AlertDialogPortal`),Ee=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[$,De]=Se(`AlertDialogContent`),Oe=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=J.useRef(null),s=S(t,o),c=J.useRef(null);return(0,Y.jsx)($,{scope:n,cancelRef:c,children:(0,Y.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),ke=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),Ae=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(D,{...i,...r,ref:t})},`AlertDialogDescription`)),je=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(k,{...i,...r,ref:t})},`AlertDialogAction`)),Me=`AlertDialogCancel`,Ne=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=De(Me,n),a=Q(n),o=S(t,i);return(0,Y.jsx)(k,{...a,...r,ref:o})},`AlertDialogCancel`)),Pe=we,Fe=Te,Ie=Ee,Le=Oe,Re=je,ze=Ne,Be=ke,Ve=Ae;function He({...e}){return(0,Y.jsx)(Pe,{"data-slot":`alert-dialog`,...e})}function Ue({...e}){return(0,Y.jsx)(Fe,{"data-slot":`alert-dialog-portal`,...e})}function We({className:e,...t}){return(0,Y.jsx)(Ie,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ge({className:e,size:t=`default`,...n}){return(0,Y.jsxs)(Ue,{children:[(0,Y.jsx)(We,{}),(0,Y.jsx)(Le,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ke({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function qe({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Je({className:e,...t}){return(0,Y.jsx)(Be,{"data-slot":`alert-dialog-title`,className:A(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Ye({className:e,...t}){return(0,Y.jsx)(Ve,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Xe({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Y.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Re,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Ze({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Y.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(ze,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Qe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function $e({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``);return(0,J.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,Y.jsx)(I,{open:e,onOpenChange:e=>!d&&t(e),children:(0,Y.jsxs)(M,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsxs)(N,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,Y.jsx)(ce,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,Y.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(L,{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,Y.jsx)(j,{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 R(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,Y.jsx)(p,{})})]})]}),l&&(0,Y.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,Y.jsx)(c,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,Y.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`),` · `,Qe(l.byteCount)]})]})]}),(0,Y.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,Y.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,Y.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,Y.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,Y.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,Y.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,Y.jsxs)(he,{className:`m-0`,children:[(0,Y.jsx)(b,{size:14}),(0,Y.jsx)(`span`,{children:m})]})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,Y.jsxs)(j,{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,Y.jsx)(oe,{className:`text-current`}):l?(0,Y.jsx)(q,{}):(0,Y.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var et=[`tool`,`prompt`,`skill`];function tt(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>et.includes(e)):[];return t.length?t:[`tool`]}function nt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var rt=[`all`,`builtin`,`local`],it={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,computer_use:K,generate_visual:m};function at(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function ot(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function st(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 ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,Y.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,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,Y.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,Y.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,Y.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,Y.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,Y.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,Y.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,Y.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,Y.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,Y.jsx)(L,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,Y.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(null),[f,p]=(0,J.useState)([]),[m,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),[ee,b]=(0,J.useState)(``),x=(0,J.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,J.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=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(``)}}},w=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 C(e.trim())},T=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 x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},E=et.map(e=>({type:e,items:f.filter(t=>tt(t).includes(e))})).filter(e=>e.items.length>0);return(0,Y.jsxs)(Y.Fragment,{children:[E.map(e=>(0,Y.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${nt(e.type,o)}`,count:e.items.length,children:(0,Y.jsx)(B,{children:e.items.map(t=>(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,Y.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,Y.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,Y.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Y.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,Y.jsx)(q,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,Y.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,Y.jsx)(L,{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,Y.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,Y.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,Y.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,Y.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?rt:rt.slice(0,2),[p,m]=(0,J.useState)(``),[h,v]=(0,J.useState)(null),[y,S]=(0,J.useState)([]),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(`all`),[D,O]=(0,J.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[k,ne]=(0,J.useState)(!1),[re,ie]=(0,J.useState)(!1),[ae,ce]=(0,J.useState)(!1),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(!1),[I,L]=(0,J.useState)(``),[R,H]=(0,J.useState)(!1),U=(0,J.useCallback)(e=>{v(e),S(e.plugins),O(e.webSearch)},[]),W=(0,J.useCallback)(async()=>{L(``);try{U(await i(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[U]);(0,J.useEffect)(()=>{W()},[W]);let G=(0,J.useMemo)(()=>st(y),[y]),K=(0,J.useMemo)(()=>ot(y),[y]),X=h?!lt(K,h.enabledTools)||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(D)!==JSON.stringify(h.webSearch):!1,Z=(0,J.useCallback)(async()=>{if(!k){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}ne(!0),L(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:K,webSearch:D,piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{ne(!1)}}},[U,h,X,y,K,e,k,c,D]),Se=async()=>{ie(!0),L(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(D)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);L(n),e(n,`error`)}finally{ie(!1)}},Ce=(e,t,n)=>{S(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)}}))},Q=()=>!X||(L(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),we=async()=>{if(!(!M||P)){F(!0),L(``);try{U(await i(`/api/plugins/${encodeURIComponent(M.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:M.pluginName})),w(``),N(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}},Te=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,Y.jsxs)(fe,{title:Te,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Y.jsx)(pe,{search:(0,Y.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Te}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Y.jsxs)(Y.Fragment,{children:[d&&(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Q()&&ce(!0),children:[(0,Y.jsx)(q,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,Y.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:k,disabled:!h||k,onClick:()=>void Z(),children:[(0,Y.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,Y.jsx)(me,{options:f.map(e=>at(e,c)),value:at(T,c),onChange:e=>E(f.find(t=>at(t,c)===e)||`all`)})}),children:[h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,Y.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,Y.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,Y.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=it[e.name]||g,n=ut(e,c);return(0,Y.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,Y.jsx)(t,{}),name:(0,Y.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,Y.jsx)(ge,{value:e.enabled,onChange:t=>Ce(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,Y.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,Y.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,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,Y.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,Y.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,Y.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,Y.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,Y.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,Y.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,Y.jsx)(ft,{value:D,testing:re,onChange:O,onTest:Se}),!e.pluginBuiltIn&&(0,Y.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Q()&&N(e),children:[(0,Y.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,Y.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,Y.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):I?(0,Y.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:I,action:(0,Y.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:R,disabled:R,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,Y.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,Y.jsx)($e,{open:ae,onOpenChange:ce,onInstalled:W}),(0,Y.jsx)(He,{open:!!M,onOpenChange:e=>!e&&!P&&N(null),children:(0,Y.jsxs)(Ge,{className:`z-[220]`,children:[(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,Y.jsx)(Ye,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:M?.pluginName||``})})]}),(0,Y.jsxs)(qe,{children:[(0,Y.jsx)(Ze,{disabled:P,children:c(`common:ui.cancel`)}),(0,Y.jsxs)(Xe,{variant:`destructive`,disabled:P,onClick:we,children:[P&&(0,Y.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&h&&(0,Y.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,Y.jsx)(b,{size:13}),I]})]})}export{mt as PluginsPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-hHSTzUJk.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/vendor-router-CSN_DGvx.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.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-BgEZwyTb.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-BTCVpAHF.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-Z_9HeVX5.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-BdMgsecO.js","assets/api-Cm58F7OP.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-B2n7HFQ4.js","assets/event-stream-BrDcABQx.js","assets/http-DtkTCrZ4.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-D23yIdOZ.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-CktdHgKM.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-8V6eRMcE.js";import{t as a}from"./useQuery-DfOU-27z.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-left-B8oVrQ2S.js";import{t as c}from"./arrow-right-DqLOhpA2.js";import{t as l}from"./arrow-up-DST6-qVQ.js";import{t as u}from"./check-2vYc6QaP.js";import{t as d}from"./chevron-down-CxtxIjiP.js";import{t as f}from"./chevron-right-C3t2Rckj.js";import{t as p}from"./download-BCfIiuaL.js";import{t as m}from"./earth-Ddy13fHh.js";import{t as h}from"./external-link-CEQqPcqc.js";import{i as g}from"./GitDiffViewer-hHSTzUJk.js";import{t as _}from"./file-Bllajneu.js";import{E as v,a as y,h as b,i as x,m as S,o as C,r as w,u as T}from"./side-chat-context-CRQ33Q0D.js";import{t as E}from"./git-branch-N7LGjtzt.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 A}from"./message-square-SKjZyY3v.js";import{t as j}from"./pause-CYWpPg1R.js";import{t as M}from"./refresh-cw-TbWxTY4K.js";import{t as ee}from"./square-bHHVTT3G.js";import{t as N}from"./triangle-alert-CE1q54ci.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 te,r as ne}from"./shortcuts-DRfz9B_B.js";import{t as L}from"./chat-api-DQyHZl-V.js";import{t as R}from"./input-CPw-zkYh.js";import{n as re}from"./session-change-summary-api-Dp9vVPv_.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{n as ie,t as ae}from"./alert-DRIrgNI4.js";import{t as oe}from"./AppSelect-DQYKUW5E.js";import{t as se}from"./session-web-preview-guvsmkWE.js";import"./collapsible-Dcoy-qnz.js";import{o as V}from"./session-tree-summary-BTcPaCgY.js";import{n as H,r as U,t as W}from"./web-preview-C7DdG9JP.js";import{n as G}from"./useNativeBrowser-C0j3zafh.js";var K=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ce=o(`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`}]]),q=o(`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=o(`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`}]]),J=e(n(),1),Y=r(),X={completed:`completed`,in_progress:`running`,paused:`pending`,blocked:`blocked`,pending:`pending`};function ue(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 de({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,Y.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 ${X[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,Y.jsx)(u,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,Y.jsx)(F,{className:`size-3.5`}):e===`paused`?(0,Y.jsx)(j,{size:11,strokeWidth:2}):e===`blocked`?(0,Y.jsx)(q,{size:11,strokeWidth:2}):(0,Y.jsx)(K,{size:11,strokeWidth:2}),(0,Y.jsx)(`span`,{className:`sr-only`,children:n})]})}function fe({item:e,current:t,running:n,t:r}){return(0,Y.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,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,Y.jsx)(de,{status:e.blocked?`blocked`:e.status===`in_progress`&&!n?`paused`:e.status,t:r}),(0,Y.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,Y.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,Y.jsx)(v,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,Y.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:r(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,Y.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,Y.jsx)(q,{size:11,className:`flex-none`}),(0,Y.jsx)(`span`,{className:`truncate`,children:r(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function pe({plan:e,running:t,header:n,collapsible:r=!1}){let{t:a}=i(),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(!0),l=e?.items||[],u=ue(l),f=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,J.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ce,{className:`flex-none text-content-muted`,size:15}),(0,Y.jsx)(`strong`,{className:`tabular-nums`,children:a(`chat:planBoard.progress`,{completed:f,total:l.length})}),g?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:g.title,children:g.title}):null,(0,Y.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,Y.jsx)(`span`,{children:a(t?`chat:planBoard.countInProgress`:`chat:planBoard.countPaused`,{count:p})}),m>0&&(0,Y.jsx)(`span`,{className:`blocked text-danger`,children:a(`chat:planBoard.countBlocked`,{count:m})})]}),n,r?(0,Y.jsx)(d,{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,Y.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,Y.jsx)(fe,{running:t,item:e,current:e.id===h,t:a},e.id))});return r?(0,Y.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,Y.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,Y.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,Y.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 me=(0,J.memo)(pe),he=(0,J.lazy)(()=>t(()=>import(`./GitDiffViewer-hHSTzUJk.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 Z({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({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,Y.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,Y.jsx)(F,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,Y.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,Y.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(he,{position:o,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:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>L.getVcsChanges(e,{signal:t})}),l=g(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),u=(0,J.useMemo)(()=>S(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)),p=c.error?.message||c.data?.error,m=c.data?.files||[];return(0,Y.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.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,Y.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&&!p&&(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.added]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.removed]})]}),(0,Y.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,Y.jsx)(M,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,Y.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,Y.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,Y.jsx)(E,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(I,{variant:`ghost`,size:`sm`,disabled:!m.length||!!p,onClick:()=>o({expandedFiles:m.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,Y.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!p&&d.map(e=>(0,Y.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,Y.jsx)(z,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):p?(0,Y.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:p}):c.data?.isRepo?m.length?(0,Y.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,Y.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,Y.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:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,Y.jsx)(f,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,Y.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,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.files[t.path].added]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.files[t.path].removed]})]})]}),n&&(0,Y.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,Y.jsx)(Z,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,Y.jsx)(B,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,Y.jsx)(B,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Q(e){return e instanceof Error?e.message:String(e)}function _e({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,J.useState)(0),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!0),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),T=(0,J.useRef)(!1),E=(0,J.useRef)(0),D=(0,J.useRef)(0),O=(0,J.useRef)(!0),k=(0,J.useRef)(!1),A=(0,J.useRef)(t);return(0,J.useLayoutEffect)(()=>{A.current=t},[t]),(0,J.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,J.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),L.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Q(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,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(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await L.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Q(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.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;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(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`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await L.approveSessionFileChanges(e,t.path):await L.revertSessionFileChanges(e,t.path);if(re(e),!T.current||i!==E.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){T.current&&i===E.current&&g(Q(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var ve=(0,J.lazy)(()=>t(()=>import(`./TaskTerminalView-BTCVpAHF.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]))),ye=(0,J.lazy)(()=>t(()=>import(`./TaskProcessesPane-Z_9HeVX5.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]))),be=(0,J.lazy)(()=>t(()=>import(`./FileAttachmentPreview-BdMgsecO.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=g(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,J.useContext)(b),[s,c]=(0,J.useState)(``),l=(0,J.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,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,Y.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,Y.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,Y.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,Y.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Y.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,Y.jsxs)(oe,{"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,Y.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,Y.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,Y.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,Y.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,Y.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!d.length&&(0,Y.jsx)(B,{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:_;return(0,Y.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,Y.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,Y.jsx)(f,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,Y.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,Y.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,Y.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,Y.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,Y.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,Y.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,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(be,{attachment:u.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof u.attachment.downloadUrl==`string`&&window.open(u.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function Se({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:s}=w(e),c=r.session?.id??``,u=(0,J.useMemo)(()=>e=>a.subscribeSessionState(c,e),[a,c]),d=(0,J.useMemo)(()=>()=>a.getSessionState(c),[a,c]),f=(0,J.useSyncExternalStore)(u,d),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(``),b=(0,J.useRef)(!1),S=(0,J.useRef)(!1),E=(0,J.useRef)(r.draft);E.current=r.draft;let D=(0,J.useRef)(null),O=te(e=>e.bindings),k=x(f,r.session);(0,J.useEffect)(()=>{t&&o(e)},[t,o,e]);let j=async t=>{t.preventDefault();let n=E.current.trim();if(!(!n||b.current||k||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;E.current.trim()===n&&s(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){v(V(e))}finally{b.current=!1,m(!1)}}},M=(0,J.useCallback)(async()=>{if(!(!c||a.getSessionState(c).streaming)){v(``);try{await a.retry(c),await o(e)}catch(e){v(V(e))}}},[o,e,a,c]),N=async()=>{if(!(!c||h)){g(!0);try{v(``),await a.abort(c)}catch(e){v(V(e))}finally{g(!1)}}},P=(0,Y.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,Y.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,Y.jsx)(A,{className:`size-4`,"aria-hidden":`true`})}),(0,Y.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,Y.jsxs)(I,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&D.current?.focus()},children:[r.loading&&(0,Y.jsx)(F,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),L=_||r.error||f.error;return(0,Y.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,Y.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,Y.jsx)(C,{sessionId:c,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:P,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:k,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:M}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:P}),(0,Y.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:j,children:[L&&(0,Y.jsx)(T,{error:L,onRetry:r.error||!f.loaded?async()=>{await o(e)}:M}),(0,Y.jsx)(y,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(c,e,t)}catch{}}}),(0,Y.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,Y.jsx)(`textarea`,{ref:D,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:()=>{S.current=!0},onCompositionEnd:()=>{S.current=!1},onKeyDown:e=>{!S.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&ne(e.nativeEvent,O.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,Y.jsx)(I,{type:k?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(k?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:k?h:p||r.loading||r.expired||!r.draft.trim(),onClick:k?()=>void N():void 0,children:p||h?(0,Y.jsx)(F,{className:`size-4 text-current`}):k?(0,Y.jsx)(ee,{size:13,fill:`currentColor`}):(0,Y.jsx)(l,{size:17})})]})]})]})}var $=(0,J.createContext)(null),Ce=()=>{let e=(0,J.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},we=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,J.useState)(n),[s,c]=(0,J.useState)(!1),l=(0,J.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,J.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,Y.jsx)($.Provider,{value:u,children:(0,Y.jsx)(`div`,{className:P(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},Te=({className:e,loading:t,src:n,...r})=>{let{url:i}=Ce();return(0,Y.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,Y.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]})};function Ee(e){let t=window.pisperDesktop;return!t||!/Windows|Macintosh/.test(navigator.userAgent)?null:t.browser?e?`failed`:null:`outdated`}function De({sessionId:e,page:t,onChange:n,onClosed:r}){let{t:a}=i(),{draft:o,url:l}=t,[u,d]=(0,J.useState)(!1),f=G({enabled:!!window.pisperDesktop?.browser,url:l,popupId:t.resourceId,keepAlive:t.agent,onNavigated:e=>{e!==l&&n(o===l?{url:e,draft:e}:{url:e})},onTitle:e=>n({title:e}),onNewWindow:(t,n)=>se(e,t,n),onClosed:r}),g=Ee(f.unavailable);return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":a(`common:webPreview.title`),children:[(0,Y.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let t=U(o,window.location.href);d(!t),t&&n({url:t})},children:[f.active&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,Y.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.back`),title:a(`common:webPreview.back`),onClick:()=>f.act(`back`),children:(0,Y.jsx)(s,{size:14})}),(0,Y.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.forward`),title:a(`common:webPreview.forward`),onClick:()=>f.act(`forward`),children:(0,Y.jsx)(c,{size:14})}),(0,Y.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.reload`),title:a(`common:webPreview.reload`),"aria-busy":f.loading,onClick:()=>f.act(`reload`),children:f.loading?(0,Y.jsx)(k,{size:14,className:`animate-spin`}):(0,Y.jsx)(le,{size:14})})]}),(0,Y.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,Y.jsx)(I,{type:`submit`,variant:`secondary`,children:a(`chat:sessionContext.openUrl`)})]}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a(`chat:sessionContext.invalidUrl`)}),f.active?(0,Y.jsx)(`div`,{ref:f.slotRef,role:`group`,"aria-label":a(`common:webPreview.title`),"aria-busy":f.loading,"data-native-browser-slot":!0,className:`min-h-0 flex-1 overflow-hidden rounded-md border border-stroke bg-background`}):l?(0,Y.jsx)(we,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:l,children:(0,Y.jsx)(Te,{src:l,title:a(`common:webPreview.title`),...H(l)?{sandbox:W}:{}})},l):(0,Y.jsx)(B,{icon:m,className:`min-h-0 flex-1`,title:a(`chat:sessionContext.browserEmpty`)}),l&&(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(l,`_blank`,`noopener,noreferrer`),children:[(0,Y.jsx)(h,{size:14}),a(`common:webPreview.openExternal`)]}),!f.active&&g&&l&&(0,Y.jsxs)(ae,{"data-native-browser-fallback":g,children:[(0,Y.jsx)(N,{}),(0,Y.jsxs)(ie,{className:`flex flex-col items-start gap-2`,children:[a(g===`outdated`?`common:webPreview.shellOutdated`:`common:webPreview.nativeFailed`),g===`outdated`&&(0,Y.jsxs)(I,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void window.pisperDesktop?.openReleases(),children:[(0,Y.jsx)(p,{size:14}),a(`common:webPreview.downloadDesktop`)]})]})]}),!f.active&&!(g&&l)&&(0,Y.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`common:webPreview.embedNotice`)})]})}export{ve as a,Z as c,ye as i,me as l,Se as n,_e as o,xe as r,ge as s,De as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-hHSTzUJk.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-8V6eRMcE.js","assets/i18n-B7QmqfvO.js","assets/vendor-router-CSN_DGvx.js","assets/index-79gEOxmD.js","assets/index-XwGsScbB.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-BgEZwyTb.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-8V6eRMcE.js";import{i as a}from"./runtime-capabilities-CPDBo3tu.js";import{t as o}from"./runtime-capabilities-store-Y9MaywP8.js";import{r as s}from"./permission-rules-api-BZn4yp-J.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}from"./SessionBrowserPane-y7gPArTV.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-hHSTzUJk.js";import{k as C}from"./side-chat-context-CRQ33Q0D.js";import{n as w,t as T}from"./undo-2-C-xQ0UVT.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./message-square-SKjZyY3v.js";import{t as O}from"./plus-fQbSqB1n.js";import{t as k}from"./refresh-cw-TbWxTY4K.js";import{t as A}from"./square-terminal-BVG6cUT1.js";import{t as j}from"./x-07u4-129.js";import{n as M,t as N}from"./button-CCcCN8tE.js";import{s as P}from"./events-BgEZwyTb.js";import{a as F,n as I,o as L,t as ee}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{a as te,o as ne,r as V}from"./session-web-preview-guvsmkWE.js";import"./public-B8mbf50i.js";import{n as re}from"./terminal-context-aIsIJPn8.js";import{r as H}from"./web-preview-C7DdG9JP.js";var U=e(n(),1),W=r(),G=(0,U.lazy)(()=>t(()=>import(`./GitDiffViewer-hHSTzUJk.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]))),K=100;function ie({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=x(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,U.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:C,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:A,notice:j,viewDiff:P,runAction:F,refresh:I}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,W.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,W.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,W.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:I,children:(0,W.jsx)(k,{className:_?`animate-spin`:``,size:15})})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,W.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,W.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsxs)(N,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void F({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,W.jsx)(k,{className:`animate-spin`,size:14}):(0,W.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,W.jsxs)(N,{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:[v?.kind===`revert`&&!v.path?(0,W.jsx)(k,{className:`animate-spin`,size:14}):(0,W.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsx)(N,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,K).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,W.jsx)(N,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),A&&(0,W.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:A}),j&&!A&&(0,W.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:j}),_&&!h?(0,W.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,W.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,K).map(t=>{let n=p.includes(t.path);return(0,W.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,W.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,W.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:_||!!v,"aria-busy":C===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,W.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,W.jsx)(M,{className:`size-3.5`}):(0,W.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,W.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,W.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,W.jsx)(N,{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,W.jsx)(l,{size:14})}),(0,W.jsx)(N,{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,W.jsx)(T,{size:14})})]}),n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,W.jsx)(N,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void P(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>K&&(0,W.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-K})})]}):!A&&(0,W.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(G,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function ae({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(!1);return(0,W.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,W.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,W.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=H(a,window.location.href);c(!t),t&&n(t)},children:[(0,W.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,W.jsx)(N,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,W.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,W.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,W.jsxs)(N,{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,W.jsx)(r,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function q({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:T,plansAvailable:k,requestConfirm:M,onTabChange:R,onClose:z,onBack:H}){let{t:G}=i(),K=re(),q=o(e=>e.capabilities),J=[{id:`terminal`,icon:A,label:G(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:G(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:G(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:G(`chat:workbench.sources`)},{id:`files`,icon:C,label:G(`chat:workbench.taskSnapshots`)},...k?[{id:`plan`,icon:w,label:G(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:G(`common:webPreview.title`)},{id:`side-chat`,icon:D,label:G(`chat:sideChat.title`)}],oe=(0,U.useMemo)(()=>te(g),[g]),Y=V(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??oe,se=(0,U.useRef)(null),X=Y.pages.find(e=>e.id===Y.activeId)??Y.pages[0],Z=e=>e.kind===`new`?{id:`new`,icon:O,label:G(`chat:workbench.newTab`)}:J.find(t=>t.id===e.kind)??J[0],ce=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),le=(0,U.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${Y.activeId}-tab`)?.focus()});(0,U.useEffect)(()=>{let e=requestAnimationFrame(()=>le());return()=>cancelAnimationFrame(e)},[e,Y.activeId]);let Q=e=>{if(e.type===`view`&&!V.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(P));let t=ne(Y,e);V.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&ce(t.activeId),e.type===`close`&&Y.pages.length===1&&z()},$=G(`chat:sessionContext.addPage`),ue=G(`chat:sessionContext.pageLimit`),de=(0,W.jsx)(N,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:Y.pages.length>=12,"aria-label":$,title:Y.pages.length>=12?ue:$,onClick:()=>Q({type:`add`,kind:`new`}),children:(0,W.jsx)(O,{size:16})}),fe=(0,W.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,W.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:[H&&(0,W.jsx)(N,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":G(`chat:workbench.backToConversation`),title:G(`chat:workbench.backToConversation`),onClick:H,children:(0,W.jsx)(c,{size:16})}),(0,W.jsx)(`div`,{ref:se,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":G(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Q({type:`close`,id:X.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Y.pages.findIndex(e=>e.id===X.id),n=e.key===`Home`?0:e.key===`End`?Y.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+Y.pages.length)%Y.pages.length;Q({type:`select`,id:Y.pages[n].id})},children:Y.pages.map(t=>{let{icon:n,label:r}=Z(t);return(0,W.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===X.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,W.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===X.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===X.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:()=>Q({type:`select`,id:t.id}),children:[(0,W.jsx)(n,{size:14,className:`shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:r})]}),(0,W.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":`${G(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Q({type:`close`,id:t.id}),children:(0,W.jsx)(j,{size:12})})]},t.id)})}),de]}),Y.pages.map(t=>{let n=Z(t),r=X.id===t.id;return(0,W.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,W.jsx)(ae,{tools:J.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!K||!a(q,`terminal`):e.id===`changes`&&!a(q,`vcs`)})),onOpenUrl:e=>{Q({type:`open`,kind:`browser`,replaceId:t.id}),V.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Q({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,W.jsx)(v,{sessionId:l,cwd:u,streaming:T,view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,W.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,W.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>V.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,W.jsx)(p,{view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Q({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,W.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,W.jsx)(y,{sessionId:l,page:t,onChange:e=>Q({type:`browser`,id:t.id,...e}),onClosed:()=>Q({type:`close`,id:t.id})}):r&&(n.id===`files`?(0,W.jsx)(ie,{view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:T,requestConfirm:M}):(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,W.jsx)(m,{plan:x,running:T}):(0,W.jsx)(B,{compact:!0,title:G(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,W.jsx)(ee,{open:!0,onOpenChange:e=>!e&&z(),children:(0,W.jsxs)(I,{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,W.jsx)(F,{className:`sr-only`,children:(0,W.jsx)(L,{children:G(`chat:sessionContext.title`)})}),fe]})}):(0,W.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":G(`chat:sessionContext.title`),children:fe})}export{q as SessionContextPanel};
@@ -1 +0,0 @@
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{f as i,t as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-8V6eRMcE.js";import{n as s,t as c}from"./usePhoneShell-DRZTDDgZ.js";import{t as l}from"./PhoneMenuButton-uG_T93KL.js";import{t as u}from"./button-CCcCN8tE.js";import{t as d}from"./useSessionListQuery-DtpEX8a5.js";import"./public-Be05c5M9.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-DqEkX19H.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=d(),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)(l,{})}),(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)(u,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(u,{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};