pisper 0.6.39 → 0.6.40

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 (124) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +691 -691
  3. package/web/assets/{AppDialog-B18LKxGz.js → AppDialog-OZpJxSBP.js} +1 -1
  4. package/web/assets/{AppOverlays-CVsIn893.js → AppOverlays-DBsxr-pZ.js} +1 -1
  5. package/web/assets/{AssetsPage-DTUqqVRZ.js → AssetsPage-H1OABD-M.js} +1 -1
  6. package/web/assets/{AttachmentTray-CdgiJGKL.js → AttachmentTray-BB89fdpQ.js} +1 -1
  7. package/web/assets/{BoardPage-C1zvNkyM.js → BoardPage-B2GIOdjF.js} +3 -3
  8. package/web/assets/{ChannelsPage-EXfbi1Uu.js → ChannelsPage-DJOprsIR.js} +1 -1
  9. package/web/assets/{ChatAppearancePage-BpHEGASI.js → ChatAppearancePage-BqY06fK8.js} +1 -1
  10. package/web/assets/{ChatHistoryPage-C-mJV9uR.js → ChatHistoryPage-N1OwflL6.js} +1 -1
  11. package/web/assets/{ChatMessage-CBGpmO8b.js → ChatMessage-Cb3Rzxbr.js} +3 -3
  12. package/web/assets/{ChatPage-AjVB1P4r.js → ChatPage-Di2pvZ7B.js} +3 -3
  13. package/web/assets/{ConfigPage-D7YSSKLJ.js → ConfigPage-Ba8yOTn6.js} +4 -4
  14. package/web/assets/{DesktopWindowControls-D_LAKbeD.js → DesktopWindowControls-Dgr7SBc9.js} +1 -1
  15. package/web/assets/{FeaturePage-DT8W4UlT.js → FeaturePage-xE563vuG.js} +1 -1
  16. package/web/assets/{FileAttachmentPreview-B9i02UCX.js → FileAttachmentPreview-Cx6BlBm7.js} +1 -1
  17. package/web/assets/{FloatingWidgets-CmBCqisu.js → FloatingWidgets-CWGdGGgQ.js} +1 -1
  18. package/web/assets/{FocusRuntimeControls-yUa6cOxD.js → FocusRuntimeControls-CoEB10QW.js} +1 -1
  19. package/web/assets/{GitDiffViewer-LK0S-bDi.js → GitDiffViewer-DplIwM8m.js} +1 -1
  20. package/web/assets/{ManageProjectsDialog-DPdZnbwA.js → ManageProjectsDialog-U8MUgrlm.js} +1 -1
  21. package/web/assets/{MarkdownMessage-CkLJFdr9.js → MarkdownMessage-DylM7nUB.js} +1 -1
  22. package/web/assets/{McpPage-DM00Xr9x.js → McpPage-BG-pc52d.js} +1 -1
  23. package/web/assets/{MemoryEvolution-D4AAcf9c.js → MemoryEvolution-DDiqR1FL.js} +1 -1
  24. package/web/assets/{MemoryPage-CtUzZ4-U.js → MemoryPage-B7zAKyaw.js} +2 -2
  25. package/web/assets/{MobileNavigation-BqPs-o2r.js → MobileNavigation-B9TLGML2.js} +1 -1
  26. package/web/assets/{MorePage-suAYgIS5.js → MorePage-D2qm09O6.js} +1 -1
  27. package/web/assets/{NewFolderDialog-kUUU6qCp.js → NewFolderDialog-CWpNgMKR.js} +1 -1
  28. package/web/assets/{PageHeader-BkPqAK50.js → PageHeader-DsZ5ehNL.js} +1 -1
  29. package/web/assets/{PhoneDrawer-BggePi7m.js → PhoneDrawer-sIG28Onx.js} +1 -1
  30. package/web/assets/{PhoneMenuButton-BOcCSFnH.js → PhoneMenuButton-DiDPv4NZ.js} +1 -1
  31. package/web/assets/{PhoneTopBar-IjowCATK.js → PhoneTopBar-DRQ5EQmK.js} +1 -1
  32. package/web/assets/{PluginsPage-CW9s28T1.js → PluginsPage-CKUCMJjh.js} +1 -1
  33. package/web/assets/{SafeModePrompt-cyd5YWlE.js → SafeModePrompt-OycVdcvt.js} +1 -1
  34. package/web/assets/{SchedulesPage-PTc_ojAJ.js → SchedulesPage-DsHGElm6.js} +1 -1
  35. package/web/assets/{SessionBrowserPane-CAJoHlNh.js → SessionBrowserPane-DGQsDUqd.js} +2 -2
  36. package/web/assets/{SessionContextPanel-CnMlSYsk.js → SessionContextPanel-CQXBX8HL.js} +2 -2
  37. package/web/assets/{SessionHome-1L6ETCUP.js → SessionHome-_X0M5GiH.js} +1 -1
  38. package/web/assets/{SessionInspector-DTvk3cYP.js → SessionInspector-C03rShQ1.js} +1 -1
  39. package/web/assets/{SessionShell-DCZjgm4_.js → SessionShell-Dsfvs_JW.js} +1 -1
  40. package/web/assets/{SettingsSidebar-FNMhjBah.js → SettingsSidebar-Bur_oRZx.js} +1 -1
  41. package/web/assets/{ShortcutHelpDialog-pFOsy2re.js → ShortcutHelpDialog-rAbhuzNm.js} +1 -1
  42. package/web/assets/{ShortcutKeys-BfiFGtIF.js → ShortcutKeys-DFKIS7Us.js} +1 -1
  43. package/web/assets/{SidebarUpdateStatus-BdfPkA-6.js → SidebarUpdateStatus-W1H_IFTb.js} +1 -1
  44. package/web/assets/{SkillsPage-CauQvPAH.js → SkillsPage-Cyg7klwt.js} +1 -1
  45. package/web/assets/{TaskProcessesPane-Kj4R2eFS.js → TaskProcessesPane-CkC-ZQos.js} +1 -1
  46. package/web/assets/{TaskTerminalView-CVBvmwIN.js → TaskTerminalView-CU-kjS_J.js} +1 -1
  47. package/web/assets/{TerminalPanel-BlaqYk_y.js → TerminalPanel-CL7C-bZ3.js} +1 -1
  48. package/web/assets/{WebDesktopPet-B524lpZ8.js → WebDesktopPet-Cc_B2Ihr.js} +1 -1
  49. package/web/assets/{WorkflowsPage-Dr0Mb-lj.js → WorkflowsPage-DExImPqA.js} +1 -1
  50. package/web/assets/{WorkspacePicker-BC-V-qKc.js → WorkspacePicker-Cd0QCRnc.js} +1 -1
  51. package/web/assets/{api-BA-WPJCg.js → api-BbBnrW3n.js} +1 -1
  52. package/web/assets/{app-update-AoFhnKr8.js → app-update-pRA7vtj3.js} +1 -1
  53. package/web/assets/{approval-confirm-B0nXB32b.js → approval-confirm-CLY2H0YG.js} +1 -1
  54. package/web/assets/{assets-api-Dw9uxhK9.js → assets-api-A0ZKJkf3.js} +1 -1
  55. package/web/assets/{board-projects-geCUCUov.js → board-projects-DHtEAHvu.js} +1 -1
  56. package/web/assets/{bots-store-CljyYMIo.js → bots-store-Br31qCcA.js} +1 -1
  57. package/web/assets/{chat-api-DixX49bK.js → chat-api-BSs2idF4.js} +1 -1
  58. package/web/assets/{client-store-JUgMl-Fs.js → client-store-C_ajzmyH.js} +1 -1
  59. package/web/assets/{command-Dugx8Xyc.js → command-Cb876BWo.js} +1 -1
  60. package/web/assets/{config-search-B5mtRMAH.js → config-search-DQ-bCU2h.js} +1 -1
  61. package/web/assets/{desktop-hosts-CLjxzh1F.js → desktop-hosts-qz2OZ5I1.js} +1 -1
  62. package/web/assets/{dialog-BfkdQrrN.js → dialog-CW8GeCdI.js} +1 -1
  63. package/web/assets/{event-stream-C1gqpD-D.js → event-stream-BYSr6laS.js} +1 -1
  64. package/web/assets/{events-BCP3T_26.js → events-CAivTGZK.js} +1 -1
  65. package/web/assets/{folder-paths-hX8Gx2zK.js → folder-paths-CYDY1W9R.js} +1 -1
  66. package/web/assets/{hosts-BqwTes2H.js → hosts-CdsdAvJs.js} +1 -1
  67. package/web/assets/{http-BJXYcBJZ.js → http-CMHs5x9g.js} +1 -1
  68. package/web/assets/{http-response-tU9Jgwk1.js → http-response-DObpyFrX.js} +1 -1
  69. package/web/assets/{i18n-BigTf78f.js → i18n-C_TfFRc2.js} +1 -1
  70. package/web/assets/{index-Cj4werSq.js → index-DL89Jrzh.js} +2 -2
  71. package/web/assets/{machine-messages-C5HnwFMY.js → machine-messages-BZFO3mNM.js} +1 -1
  72. package/web/assets/{machines-api-Bd73Uc9W.js → machines-api-Brwmi001.js} +1 -1
  73. package/web/assets/{memory-api-CizRSxek.js → memory-api-BsElJ4mL.js} +1 -1
  74. package/web/assets/{mount-app-BiyUP9uu.js → mount-app-DdYcKl3f.js} +3 -3
  75. package/web/assets/{permission-rules-api-D26h2i5i.js → permission-rules-api-pDaT7JHN.js} +1 -1
  76. package/web/assets/{pick-system-directory-j8yF4oD7.js → pick-system-directory-C4P5z66U.js} +1 -1
  77. package/web/assets/{placements-DaEYVBYS.js → placements-DY62NlQc.js} +2 -2
  78. package/web/assets/{popover-CYgt88Di.js → popover-CPdjoO3T.js} +1 -1
  79. package/web/assets/{public-fbSrYOz9.js → public--dz5MkXs.js} +2 -2
  80. package/web/assets/{public-uWGpE-xc.js → public-B3nCWERr.js} +1 -1
  81. package/web/assets/{public-DFbbN84l.js → public-BvZGd3OL.js} +1 -1
  82. package/web/assets/{public-CbGNOymN.js → public-CAdIUTea.js} +2 -2
  83. package/web/assets/{public-components-BxT4OWVf.js → public-components-BIhHhBwc.js} +1 -1
  84. package/web/assets/public-diff-Dha1wj7p.js +1 -0
  85. package/web/assets/public-events-CtLbk6Ps.js +1 -0
  86. package/web/assets/{public-flags-DtOWkThd.js → public-flags-CBzwNp70.js} +1 -1
  87. package/web/assets/{public-folder-dialog-BdoTA7R9.js → public-folder-dialog-Dmd5Qull.js} +1 -1
  88. package/web/assets/{public-greeting-WuolFgYD.js → public-greeting-lOuYNysY.js} +1 -1
  89. package/web/assets/{public-session-BHqubfWo.js → public-session-QlZ9_Zsb.js} +1 -1
  90. package/web/assets/{public-sidebar-Dy3GnDnb.js → public-sidebar-DsfBxQWb.js} +1 -1
  91. package/web/assets/{runtime-capabilities-store-CJA8-sSC.js → runtime-capabilities-store-aG2QVT6b.js} +1 -1
  92. package/web/assets/{safe-mode-instance-BdOJv29n.js → safe-mode-instance-HzaYIZf6.js} +1 -1
  93. package/web/assets/safe-mode-sentinel-DfoN8ker.js +1 -0
  94. package/web/assets/{session-change-summary-api-CvAF7fwO.js → session-change-summary-api-Kcf7-e2G.js} +1 -1
  95. package/web/assets/{session-home-DbvyzdI5.js → session-home-DOe7Q-qI.js} +1 -1
  96. package/web/assets/{session-inspector-store-C3ZsefJH.js → session-inspector-store-BolK9Mpy.js} +1 -1
  97. package/web/assets/{session-questions-DLgJUkQv.js → session-questions-l81YErJo.js} +1 -1
  98. package/web/assets/{session-scope-CFdEpHVY.js → session-scope-BCcnPOi0.js} +1 -1
  99. package/web/assets/{session-tree-actions-CYj1yPgQ.js → session-tree-actions-DHSmxj_g.js} +1 -1
  100. package/web/assets/{session-tree-summary-BeUnCg9w.js → session-tree-summary-C0dKEzZx.js} +1 -1
  101. package/web/assets/{session-web-preview-DfdZezsZ.js → session-web-preview-DvDFSKV-.js} +1 -1
  102. package/web/assets/{shortcuts-Cth0vc77.js → shortcuts-DsFEMyT1.js} +1 -1
  103. package/web/assets/{side-chat-context-D0zsA72l.js → side-chat-context-DxeaaCWm.js} +4 -4
  104. package/web/assets/{sidebar-vQzRTtRF.js → sidebar-CmpuB-ul.js} +1 -1
  105. package/web/assets/{sidebar-store-1-20GZhs.js → sidebar-store-BxHuw5mD.js} +1 -1
  106. package/web/assets/{speech-session-BpiqMMm5.js → speech-session-BXAj3OAY.js} +1 -1
  107. package/web/assets/{startup-queries-mAINlcNF.js → startup-queries-Cc9LSolC.js} +1 -1
  108. package/web/assets/{use-i18n-DL1_y_Ge.js → use-i18n-BqDnJFL5.js} +1 -1
  109. package/web/assets/{use-open-bot-CiF65aUO.js → use-open-bot-B_UFxUmd.js} +1 -1
  110. package/web/assets/{use-studio-actions-yGeYtIj_.js → use-studio-actions-BM3RKvXH.js} +1 -1
  111. package/web/assets/{useCatalogProjects-BBTryY8n.js → useCatalogProjects-BhW44QEx.js} +1 -1
  112. package/web/assets/{useMachines-DbkhDwVU.js → useMachines-Cv7VNdjI.js} +1 -1
  113. package/web/assets/{useNewProjectPicker-CW-ndILs.js → useNewProjectPicker-DRZ4v1BJ.js} +2 -2
  114. package/web/assets/{useNow-CyOr3v9y.js → useNow-tTW4r_Vo.js} +1 -1
  115. package/web/assets/{usePhoneShell-E0zpNbPD.js → usePhoneShell-iGegDaj2.js} +1 -1
  116. package/web/assets/{useSessionListQuery-CaaqoetW.js → useSessionListQuery-mhLtsKkB.js} +1 -1
  117. package/web/assets/{useSessionRowActions-BNWcYCP1.js → useSessionRowActions-UT3R_Cfq.js} +1 -1
  118. package/web/assets/{useSidebarModel-zw1ozcJm.js → useSidebarModel-D21Q54-Q.js} +1 -1
  119. package/web/assets/{workspace-folders-Cl8xGY9c.js → workspace-folders-CIuHDEZQ.js} +1 -1
  120. package/web/assets/{workspace-order-store-BlPd8HV9.js → workspace-order-store-Cv4TWT44.js} +1 -1
  121. package/web/index.html +1 -1
  122. package/web/assets/public-diff-L3aHU7Ip.js +0 -1
  123. package/web/assets/public-events-CIldV-8b.js +0 -1
  124. package/web/assets/safe-mode-sentinel-DiBJExnu.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-LK0S-bDi.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-DL1_y_Ge.js","assets/i18n-BigTf78f.js","assets/vendor-router-CSN_DGvx.js","assets/index-Cj4werSq.js","assets/index-PnQKlTEM.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-BCP3T_26.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-DL1_y_Ge.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-CJA8-sSC.js";import{t as s}from"./activity-BCxvXCG3.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./SessionBrowserPane-CAJoHlNh.js";import{t as x}from"./earth-Ddy13fHh.js";import{a as S,o as C}from"./GitDiffViewer-LK0S-bDi.js";import{b as w}from"./side-chat-context-D0zsA72l.js";import{t as T}from"./undo-2-ChaURM4t.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./list-todo-hpikYm6Q.js";import{t as O}from"./message-square-SKjZyY3v.js";import{t as k}from"./plus-fQbSqB1n.js";import{t as A}from"./refresh-cw-TbWxTY4K.js";import{t as j}from"./square-terminal-BVG6cUT1.js";import{t as M}from"./x-07u4-129.js";import{n as N,t as P}from"./button-CCcCN8tE.js";import{s as F}from"./events-BCP3T_26.js";import{a as I,n as L,o as ee,t as te}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{l as ne,r as V,u as re}from"./session-web-preview-DfdZezsZ.js";import"./public-uWGpE-xc.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-LK0S-bDi.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=S(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),f=r?.expandedFiles||c,p=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:g,running:_,diff:y,setDiff:b,diffLoading:x,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:k,notice:j,viewDiff:M,runAction:F,refresh:I}=v({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":g||!!_,children:[(0,U.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:g||!!_,onClick:I,children:(0,U.jsx)(A,{className:g?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(P,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void F({kind:`approve`}),children:[_?.kind===`approve`&&!_.path?(0,U.jsx)(A,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(P,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void F({kind:`revert`}),children:[_?.kind===`revert`&&!_.path?(0,U.jsx)(A,{className:`animate-spin`,size:14}):(0,U.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(P,{variant:`ghost`,size:`sm`,disabled:g||!h?.files.length,onClick:()=>p(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>p([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),j&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:j}),g&&!h?(0,U.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=f.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:g||!!_,"aria-busy":x===t.path,"aria-expanded":n,onClick:()=>p(n?f.filter(e=>e!==t.path):[...f,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),x===t.path?(0,U.jsx)(N,{className:`size-3.5`}):(0,U.jsx)(C,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void F({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void F({kind:`revert`,path:t.path}),children:(0,U.jsx)(T,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(m,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,U.jsx)(P,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void M(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=_(a,window.location.href);c(!t),t&&n(t.url)},children:[(0,U.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(P,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(P,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:m=[],tab:_,plan:v,streaming:S,plansAvailable:T,requestConfirm:A,onTabChange:N,onClose:R,onBack:z}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:j,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:C,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:W(`chat:workbench.sources`)},{id:`files`,icon:w,label:W(`chat:workbench.taskSnapshots`)},...T?[{id:`plan`,icon:D,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:x,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:O,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>ne(_),[_]),J=V(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:k,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!V.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(F));let t=re(J,e);V.getState().update(l,_,e);let n=t.pages.find(e=>e.id===t.activeId);n&&N(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&R()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(k,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[z&&(0,U.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:z,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(M,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),V.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(f,{sessionId:l,cwd:u,streaming:S,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(p,{sources:m,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(g,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>V.getState().update(l,_,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(d,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{sessionId:l,page:t,onChange:e=>Z({type:`browser`,id:t.id,...e}),onClosed:()=>Z({type:`close`,id:t.id})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:S,requestConfirm:A}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:v?.items?.length?(0,U.jsx)(b,{plan:v,running:S}):(0,U.jsx)(B,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(te,{open:!0,onOpenChange:e=>!e&&R(),children:(0,U.jsxs)(L,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(I,{className:`sr-only`,children:(0,U.jsx)(ee,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-DplIwM8m.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BqDnJFL5.js","assets/i18n-C_TfFRc2.js","assets/vendor-router-CSN_DGvx.js","assets/index-DL89Jrzh.js","assets/index-PnQKlTEM.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-CAivTGZK.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-BqDnJFL5.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-aG2QVT6b.js";import{t as s}from"./activity-BCxvXCG3.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./SessionBrowserPane-DGQsDUqd.js";import{t as x}from"./earth-Ddy13fHh.js";import{a as S,o as C}from"./GitDiffViewer-DplIwM8m.js";import{b as w}from"./side-chat-context-DxeaaCWm.js";import{t as T}from"./undo-2-ChaURM4t.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./list-todo-hpikYm6Q.js";import{t as O}from"./message-square-SKjZyY3v.js";import{t as k}from"./plus-fQbSqB1n.js";import{t as A}from"./refresh-cw-TbWxTY4K.js";import{t as j}from"./square-terminal-BVG6cUT1.js";import{t as M}from"./x-07u4-129.js";import{n as N,t as P}from"./button-CCcCN8tE.js";import{s as F}from"./events-CAivTGZK.js";import{a as I,n as L,o as ee,t as te}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{l as ne,r as V,u as re}from"./session-web-preview-DvDFSKV-.js";import"./public-B3nCWERr.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-DplIwM8m.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=S(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),f=r?.expandedFiles||c,p=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:g,running:_,diff:y,setDiff:b,diffLoading:x,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:k,notice:j,viewDiff:M,runAction:F,refresh:I}=v({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":g||!!_,children:[(0,U.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:g||!!_,onClick:I,children:(0,U.jsx)(A,{className:g?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(P,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void F({kind:`approve`}),children:[_?.kind===`approve`&&!_.path?(0,U.jsx)(A,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(P,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void F({kind:`revert`}),children:[_?.kind===`revert`&&!_.path?(0,U.jsx)(A,{className:`animate-spin`,size:14}):(0,U.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(P,{variant:`ghost`,size:`sm`,disabled:g||!h?.files.length,onClick:()=>p(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>p([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),j&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:j}),g&&!h?(0,U.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=f.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:g||!!_,"aria-busy":x===t.path,"aria-expanded":n,onClick:()=>p(n?f.filter(e=>e!==t.path):[...f,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),x===t.path?(0,U.jsx)(N,{className:`size-3.5`}):(0,U.jsx)(C,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void F({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void F({kind:`revert`,path:t.path}),children:(0,U.jsx)(T,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(m,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,U.jsx)(P,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void M(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=_(a,window.location.href);c(!t),t&&n(t.url)},children:[(0,U.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(P,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(P,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:m=[],tab:_,plan:v,streaming:S,plansAvailable:T,requestConfirm:A,onTabChange:N,onClose:R,onBack:z}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:j,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:C,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:W(`chat:workbench.sources`)},{id:`files`,icon:w,label:W(`chat:workbench.taskSnapshots`)},...T?[{id:`plan`,icon:D,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:x,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:O,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>ne(_),[_]),J=V(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:k,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!V.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(F));let t=re(J,e);V.getState().update(l,_,e);let n=t.pages.find(e=>e.id===t.activeId);n&&N(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&R()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(k,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[z&&(0,U.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:z,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(M,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),V.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(f,{sessionId:l,cwd:u,streaming:S,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(p,{sources:m,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(g,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>V.getState().update(l,_,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(d,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{sessionId:l,page:t,onChange:e=>Z({type:`browser`,id:t.id,...e}),onClosed:()=>Z({type:`close`,id:t.id})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:S,requestConfirm:A}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:v?.items?.length?(0,U.jsx)(b,{plan:v,running:S}):(0,U.jsx)(B,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(te,{open:!0,onOpenChange:e=>!e&&R(),children:(0,U.jsxs)(L,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(I,{className:`sr-only`,children:(0,U.jsx)(ee,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{h as i,t as a}from"./routes-BYsK6aeM.js";import{t as o}from"./use-i18n-DL1_y_Ge.js";import{n as s,t as c}from"./usePhoneShell-E0zpNbPD.js";import{t as l}from"./button-CCcCN8tE.js";import{t as u}from"./useSessionListQuery-CaaqoetW.js";import"./public-CbGNOymN.js";import{PhoneMenuButton as d}from"./PhoneMenuButton-BOcCSFnH.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-DbvyzdI5.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=u(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(d,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(l,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(l,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{h as i,t as a}from"./routes-BYsK6aeM.js";import{t as o}from"./use-i18n-BqDnJFL5.js";import{n as s,t as c}from"./usePhoneShell-iGegDaj2.js";import{t as l}from"./button-CCcCN8tE.js";import{t as u}from"./useSessionListQuery-mhLtsKkB.js";import"./public-CAdIUTea.js";import{PhoneMenuButton as d}from"./PhoneMenuButton-DiDPv4NZ.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-DOe7Q-qI.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=u(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(d,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(l,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(l,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./useQuery-DfOU-27z.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-CJA8-sSC.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./bot-B3TaBp_T.js";import{t as l}from"./check-2vYc6QaP.js";import{a as u,i as d,l as f,n as p,o as m,s as h,t as g,u as _}from"./SessionBrowserPane-CAJoHlNh.js";import{t as v}from"./corner-down-left-DalpwXuX.js";import{t as y}from"./earth-Ddy13fHh.js";import{t as b}from"./ellipsis-CfGKfbq6.js";import{o as ee}from"./GitDiffViewer-LK0S-bDi.js";import{b as x,o as te,s as S}from"./side-chat-context-D0zsA72l.js";import{t as C}from"./git-branch-N7LGjtzt.js";import{_ as w,a as T,c as E,f as D,g as O,h as ne,l as re,o as k,p as ie,s as A,y as ae}from"./ChatMessage-CBGpmO8b.js";import{t as j}from"./undo-2-ChaURM4t.js";import{t as oe}from"./list-todo-hpikYm6Q.js";import{t as se}from"./message-square-SKjZyY3v.js";import{t as M}from"./plus-fQbSqB1n.js";import{t as N}from"./refresh-cw-TbWxTY4K.js";import{t as ce}from"./square-terminal-BVG6cUT1.js";import{t as le}from"./square-bHHVTT3G.js";import{t as P}from"./x-07u4-129.js";import{c as ue,i as F,p as de,r as fe,t as pe}from"./dropdown-menu-Ds0gD8S8.js";import{a as me,r as he,t as ge}from"./popover-CYgt88Di.js";import{a as I,i as L,n as R,r as _e,t as ve}from"./select-DyBoNnz-.js";import{t as ye}from"./segmented-control-xkrEOP_d.js";import{t as z}from"./utils-C8uzG5AZ.js";import{t as B}from"./button-CCcCN8tE.js";import{t as V}from"./chat-api-DixX49bK.js";import{a as be,r as H}from"./format-DMJQzoZ7.js";import{t as U}from"./StatusGlyph-1KgitlUg.js";import{t as xe}from"./session-change-summary-api-CvAF7fwO.js";import{n as W,t as G}from"./PageState-Cz6vFMXv.js";import{i as Se,n as Ce,r as we}from"./MarkdownMessage-CkLJFdr9.js";import{t as Te}from"./route-context-DvWDul4T.js";import{o as K}from"./session-tree-summary-BeUnCg9w.js";import{c as q,r as J}from"./session-web-preview-DfdZezsZ.js";import"./public-uWGpE-xc.js";import{n as Ee}from"./terminal-context-aIsIJPn8.js";import{r as Y}from"./session-inspector-store-C3ZsefJH.js";import{t as De}from"./subagent-view-store-BUvI8piR.js";import{o as Oe}from"./web-preview-C7DdG9JP.js";var ke=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Ae=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),X=e(t(),1),Z=n(),je={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function Me(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function Q(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function $({title:e,children:t}){return(0,Z.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function Ne({status:e,name:t,detail:n,t:r}){let i=je[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,Z.jsx)(U,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,Z.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,Z.jsx)(`span`,{className:`flex-none text-content-muted`,children:Me(e,r)})]}),n&&(0,Z.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function Pe(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function Fe({plan:e,streaming:t,goal:n,team:i,activity:a}){let{t:o}=r(),s=Array.isArray(i?.tasks)?i.tasks:[],c=Pe(a),l=!!(n?.id&&String(n.objective||``).trim()),u=!!e?.items?.length;if(!l&&!u&&!s.length&&!c.length)return(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,Z.jsx)(G,{compact:!0,icon:oe,title:o(`chat:sessionContext.planEmpty`)})});let d=Number(n?.mode===`team`?n?.teamTokenBudget:n?.tokenBudget)||0;return(0,Z.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[l&&n&&(0,Z.jsx)($,{title:o(`board:inspector.goal`),children:(0,Z.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(n.objective)}),(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,Z.jsx)(`span`,{children:Q(n,o)}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(`span`,{children:d>0?o(`chat:focusSession.usedBudgetTokensUsed`,{used:H(n.tokensUsed),budget:H(d)}):o(`chat:focusSession.usedUnlimitedGoalTokens`,{used:H(n.tokensUsed)})})]})]})}),u&&(0,Z.jsx)($,{title:o(`board:inspector.plan`),children:(0,Z.jsx)(_,{plan:e,running:t})}),s.length>0&&(0,Z.jsx)($,{title:o(`board:inspector.team`),children:(0,Z.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,Z.jsx)(Ne,{status:e.status,name:e.taskName||o(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:o},e.id||`${e.taskName}-${t}`))})}),c.length>0&&(0,Z.jsx)($,{title:o(`board:inspector.subAgents`),children:(0,Z.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:c.map((e,t)=>(0,Z.jsx)(Ne,{status:e.status,name:String(e.taskName||``).trim()||o(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:o},String(e.id||t)))})})]})}function Ie({panelId:e,sessionId:t}){let{t:n}=r(),i=J(e=>e.sessions[t]),a=i?.pages,o=a?.filter(e=>e.kind===`browser`)??[],s=(i&&q(i))?.id??``,l=(a?.length??0)>=12,u=(0,X.useRef)(null),[d,f]=(0,X.useState)([]);s&&!d.includes(s)&&f([...d,s]),(0,X.useEffect)(()=>{u.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.closest(`[data-browser-tab]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[s]);let p=t=>`${e}-browser-${t}-tab`,m=t=>`${e}-browser-${t}-panel`,h=e=>J.getState().update(t,`browser`,{type:`browser-tab`,id:e}),_=(e,t,n=``)=>requestAnimationFrame(()=>document.querySelector(`[id="${e(t)}"] ${n}`.trim())?.focus()),v=()=>{let e=J.getState(),n=e.sessions[t]?.contentOpen??!1;if(e.update(t,`browser`,{type:`add`,kind:`browser`})===`limit`)return;n||e.update(t,`browser`,{type:`workspace`,contentOpen:!1});let r=J.getState().sessions[t],i=r&&q(r);i&&_(m,i.id,`input`)},y=e=>{let n=J.getState();if(o.length===1){n.update(t,`browser`,{type:`browser`,id:e,url:``,draft:``,agent:!1}),n.update(t,`browser`,{type:`resource`,id:e,resourceId:``});return}n.update(t,`browser`,{type:`close`,id:e});let r=J.getState().sessions[t],i=r&&q(r);i&&_(p,i.id)};return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-stroke-soft px-3 py-1.5`,children:[(0,Z.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":n(`common:webPreview.tabs`),className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),s&&y(s);return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=o.findIndex(e=>e.id===s),n=e.key===`Home`?0:e.key===`End`?o.length-1:(t+(e.key===`ArrowRight`?1:-1)+o.length)%o.length,r=o[n];r&&(h(r.id),_(p,r.id))},children:o.map(e=>{let t=e.id===s,r=e.title||(e.url?Oe(e.url):n(`common:webPreview.newTab`)),i=o.length>1||!!(e.url||e.resourceId);return(0,Z.jsxs)(`div`,{"data-browser-tab":e.id,className:z(`flex min-w-20 flex-[0_1_10rem] items-center rounded-sm text-[13px] transition-colors duration-(--d-fast)`,t?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onAuxClick:t=>{t.button===1&&i&&y(e.id)},children:[(0,Z.jsxs)(`button`,{id:p(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":m(e.id),tabIndex:t?0:-1,title:e.url||r,className:z(`flex h-7 min-w-0 flex-1 items-center rounded-sm pl-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,!i&&`pr-2`),onClick:()=>h(e.id),children:[e.agent&&(0,Z.jsx)(c,{size:12,className:`mr-1 flex-none text-focus`,role:`img`,"aria-label":n(`common:webPreview.agentTab`)}),(0,Z.jsx)(`span`,{className:`truncate`,children:r})]}),i&&(0,Z.jsx)(`button`,{type:`button`,tabIndex:t?0:-1,"aria-label":`${n(`common:webPreview.closeTab`)} · ${r}`,className:`mx-0.5 grid size-5 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:size-11`,onClick:()=>y(e.id),children:(0,Z.jsx)(P,{size:12,"aria-hidden":`true`})})]},e.id)})}),(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none pointer-coarse:size-11`,disabled:l,"aria-label":n(`common:webPreview.newTab`),title:n(l?`chat:sessionContext.pageLimit`:`common:webPreview.newTab`),onClick:v,children:(0,Z.jsx)(M,{"aria-hidden":`true`})})]}),o.filter(e=>d.includes(e.id)).map(e=>{let n=e.id===s;return(0,Z.jsx)(`div`,{id:m(e.id),role:`tabpanel`,"aria-labelledby":p(e.id),hidden:!n,className:n?`flex min-h-0 flex-1 flex-col`:`hidden`,children:(0,Z.jsx)(g,{sessionId:t,page:e,onChange:n=>J.getState().update(t,`browser`,{type:`browser`,id:e.id,...n}),onClosed:()=>y(e.id)})},e.id)})]})}var Le=100;function Re(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var ze={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Be={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function Ve(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function He(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function Ue(e,t){window.dispatchEvent(new CustomEvent(Te,{detail:{message:e,tone:t}}))}function We({added:e,removed:t}){return e===null||t===null?null:(0,Z.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Ge({status:e,children:t}){let{t:n}=r();return(0,Z.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,Z.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,Z.jsxs)(pe,{children:[(0,Z.jsx)(de,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,Z.jsx)(b,{"aria-hidden":`true`})})}),(0,Z.jsx)(fe,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Ke({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,Z.jsxs)(`span`,{className:z(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Be[e]),title:n,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:ze[e]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:n})]})}function qe({files:e,selected:t,label:n,onSelect:r}){let i=(0,X.useRef)(null);return(0,Z.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,Le).map(e=>{let n=e.path===t,{directory:i,name:a}=Ve(e.path);return(0,Z.jsx)(`li`,{className:`px-1`,children:(0,Z.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,ze[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:z(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,Z.jsx)(Ke,{status:e.status}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,Z.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,Z.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,Z.jsx)(We,{added:e.added,removed:e.removed})]})},e.path)}),e.length>Le&&(0,Z.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,Z.jsx)(Je,{count:e.length-Le})})]})}function Je({count:e}){let{t}=r();return(0,Z.jsx)(Z.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Ye=600;function Xe({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:c}=r(),l=Y(e=>e.diffMode),u=Y(e=>e.setDiffMode),d=(0,X.useRef)(null),[p,m]=(0,X.useState)(0);(0,X.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>m(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=p===0||p>=Ye,g=h?l:`unified`,_=h?void 0:c(`board:changes.splitTooNarrow`);return(0,Z.jsxs)(`section`,{ref:d,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,Z.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,Z.jsx)(Ke,{status:t.status}),(0,Z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,Z.jsx)(We,{added:t.added,removed:t.removed}),(0,Z.jsx)(ye,{size:`sm`,"aria-label":c(`board:changes.diffView`),title:_,"aria-description":_,value:g,onValueChange:u,options:[{value:`unified`,label:c(`board:changes.unified`)},{value:`split`,label:c(`board:changes.split`),disabled:!h}]})]}),(0,Z.jsx)(f,{sessionId:e,path:t.path,scope:n,revision:i,mode:g,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,Z.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function Ze({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=He(e,t);return(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await we(i,Se),Ue(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){Ue(e instanceof Ce&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof Ce&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,Z.jsx)(ke,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Qe(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function $e(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function et({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:u,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:g,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=h({sessionId:e,streaming:n,requestConfirm:o}),x=u?.files??[],te=i?.expandedFiles?.[0],S=x.find(e=>e.path===te)??x[0],C=e=>a?.({expandedFiles:[e]}),w=(e,t)=>f?.kind===e&&f.path===t,T=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,Z.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,Z.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:u?.summary.files??0})}),u&&u.summary.files>0&&(0,Z.jsx)(We,{added:u.summary.added,removed:u.summary.removed})]})}),v&&(0,Z.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,Z.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!u?(0,Z.jsx)(W,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qe,{files:x.map(e=>({...Qe(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):$e(e.formatChange,s)})),selected:S?.path??``,label:s(`board:changes.files`),onSelect:C}),S&&(0,Z.jsx)(Xe,{sessionId:e,file:Qe(S),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:z(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,S.approved?`text-st-done`:`text-content-muted`),"data-change-state":S.reverted?`reverted`:S.approved?`approved`:`pending`,children:[S.approved&&!S.reverted&&(0,Z.jsx)(l,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),S.reverted?s(`board:changes.revertedAt`,{time:be(S.changedAt,c)}):S.approved?s(`board:changes.approvedAt`,{time:be(S.changedAt,c)}):s(`board:changes.pendingAt`,{time:be(S.changedAt,c)})]}),S.pending&&!S.approved&&!S.reverted&&(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:T,onClick:()=>void b({kind:`approve`,path:S.path}),children:[w(`approve`,S.path)?(0,Z.jsx)(N,{className:`animate-spin`}):(0,Z.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||S.reverted||!S.canRevert,title:T,onClick:()=>void b({kind:`revert`,path:S.path}),children:[w(`revert`,S.path)?(0,Z.jsx)(N,{className:`animate-spin`}):(0,Z.jsx)(j,{}),s(`board:changes.revertFile`)]}),(0,Z.jsx)(Ze,{cwd:t,path:S.path})]})})]}):!v&&(0,Z.jsx)(G,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,Z.jsxs)(Ge,{status:f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):g>0?s(`board:changes.pending`,{count:g}):null,children:[g>0&&(0,Z.jsxs)(F,{disabled:m,title:T,onSelect:()=>void b({kind:`approve`}),children:[(0,Z.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(u?.summary.files??0)>0&&(0,Z.jsxs)(F,{disabled:m||_===0,title:T??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,Z.jsx)(j,{}),s(`board:changes.revertAll`)]}),(g>0||(u?.summary.files??0)>0)&&(0,Z.jsx)(ue,{}),(0,Z.jsxs)(F,{disabled:d||!!f,onSelect:ee,children:[(0,Z.jsx)(N,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function tt({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>V.getVcsChanges(e,{signal:t})}),l=(0,X.useMemo)(()=>S(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:Re(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,Z.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,Z.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,Z.jsx)(We,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,Z.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,Z.jsx)(C,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,Z.jsx)(W,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,Z.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qe,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,Z.jsx)(Xe,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,Z.jsx)(Ze,{cwd:t,path:p.path})]})})]}):(0,Z.jsx)(G,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,Z.jsx)(G,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,Z.jsx)(Ge,{status:c.isFetching?(0,Z.jsx)(N,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,Z.jsxs)(F,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,Z.jsx)(N,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function nt({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,Z.jsx)(ye,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,Z.jsx)(tt,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,Z.jsx)(et,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,Z.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var rt=2500,it=1500;function at({agent:e}){let t=k[e.status];return(0,Z.jsx)(U,{status:t.kind,spin:t.kind===`run`,className:z(`size-[15px] flex-none`,t.color)})}function ot(e){let[t,n]=(0,X.useState)(()=>Date.now());return(0,X.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function st(e,t){let n=e?Date.parse(e):NaN;return Number.isFinite(n)?new Date(n).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`}):``}var ct=[];function lt(e,t){let n=(0,X.useRef)(null),[r,i]=(0,X.useState)(!1);return(0,X.useLayoutEffect)(()=>{let e=n.current;if(!e||!t)return;let r=()=>i(e.scrollHeight>e.clientHeight+1);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e,t]),[n,r]}function ut({text:e}){let{t}=r(),[n,i]=(0,X.useState)(!1),[a,o]=lt(e,!n),s=(0,X.useId)(),c=(0,X.useId)();return(0,Z.jsxs)(`div`,{role:`group`,"aria-labelledby":c,className:`mx-1.5 mt-2 border-l-2 border-stroke pl-2.5`,children:[(0,Z.jsx)(`p`,{id:c,className:`m-0 text-[11px] leading-4 font-medium text-content-muted`,children:t(`board:subagent.task`)}),(0,Z.jsx)(`p`,{ref:a,id:s,className:z(`m-0 mt-0.5 text-[13px] leading-5 break-words whitespace-pre-wrap text-content-secondary`,n?`max-h-60 overflow-y-auto overscroll-contain`:`line-clamp-2`),children:e}),(o||n)&&(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":n,"aria-controls":s,className:`-ml-2.5 text-xs`,onClick:()=>i(e=>!e),children:t(n?`board:subagent.taskCollapse`:`board:subagent.taskExpand`)})]})}function dt({sessionId:e,sheet:t=!1}){let{t:n,language:i}=r(),a=De(t=>t.selected[e]??``),s=De(e=>e.select),{agents:l,reload:u}=w(e,!0),d=o(e=>e.capabilities.features.agentTranscriptEvents),f=(0,X.useMemo)(()=>l.filter(e=>e.kind!==`command`),[l]),p=f.find(e=>e.id===a),m=!!(p&&ie(p)),h=ot(m),[g,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(``),[ee,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(0),k=p?.id??``,j=p?.status??``;(0,X.useEffect)(()=>{_(null),b(``)},[k]),(0,X.useEffect)(()=>{if(!k)return;let t=new AbortController,n=0;if(d){let r=!1,i=async()=>{let a=null;try{a=await O(e,k,e=>{r=!0,_(e),b(``)},t.signal)}catch(e){if(t.signal.aborted)return;if(!r){b(K(e));return}}t.signal.aborted||a?.active===!1||(n=window.setTimeout(()=>void i(),it))};return i(),()=>{t.abort(),window.clearTimeout(n)}}let r=async()=>{try{let i=await D(e,k,t.signal);if(t.signal.aborted)return;_(i),b(``),i.active&&(n=window.setTimeout(r,rt))}catch(e){t.signal.aborted||b(K(e))}};return r(),()=>{t.abort(),window.clearTimeout(n)}},[k,S,d,e,j]);let oe=(0,X.useCallback)(async()=>{if(k){x(!0);try{await ne(e,k)}catch{}finally{x(!1),u()}}},[k,u,e]),se=(0,X.useMemo)(()=>({model:``,name:p?.taskName??``}),[p?.taskName]),M=(0,X.useMemo)(()=>g?.taskShown?g.messages.slice(1):g?.messages??[],[g]),N=(0,X.useMemo)(()=>{let e=M.at(-1);return g?.active&&e?.role===`agent`&&e.runActivity?e.runActivity:null},[M,g?.active]);if(!p)return(0,Z.jsx)(G,{compact:!0,icon:c,title:f.length?n(`board:subagent.pick`):n(`board:subagent.empty`)});let ce=g?.task||p.message,P=[p.model.split(`/`).pop(),p.toolCallCount?n(`board:subagent.toolCalls`,{count:p.toolCallCount}):``,n(`board:subagent.startedAt`,{time:st(p.startedAt,i)})].filter(Boolean).join(` · `),ue;ue=y?(0,Z.jsx)(`div`,{className:`p-3`,children:(0,Z.jsx)(ae,{error:y,onRetry:()=>C(e=>e+1)})}):g?g.available?(0,Z.jsxs)(T.Provider,{value:se,children:[g.omitted>0&&(0,Z.jsx)(`p`,{className:`m-0 shrink-0 px-3 pt-2 text-xs text-content-muted`,children:n(`board:subagent.omitted`,{count:g.omitted})}),(0,Z.jsx)(te,{sessionId:`${e}:agent:${p.id}`,messages:M,transcriptLoadState:`ready`,emptyState:(0,Z.jsx)(G,{compact:!0,icon:c,title:n(`board:subagent.noMessages`)}),activityFeed:N?.activityFeed??ct,tools:N?.tools??ct,thinkingText:N?.thinkingText,runStartedAt:N?.startedAt??null,lastActivityAt:N?.lastActivityAt??null,streaming:g.active,readOnly:!0,onRetryLastTurn:()=>{}})]}):(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-3`,children:[(0,Z.jsx)(G,{compact:!0,icon:c,title:n(`board:subagent.notRecorded`)}),(p.output||p.error)&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed whitespace-pre-wrap text-content`,children:p.error||p.output})]}):(0,Z.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:n(`board:subagent.loading`)});let F=E(p.startedAt,p.completedAt,h);return(0,Z.jsxs)(`section`,{"aria-label":n(`board:subagent.label`,{name:p.taskName}),"data-subagent-pane":p.id,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-stroke-soft px-2 pt-2 pb-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsxs)(ve,{value:p.id,onValueChange:t=>s(e,t),children:[(0,Z.jsx)(L,{variant:`ghost`,"aria-label":n(`board:subagent.switch`),className:`min-w-0`,children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(at,{agent:p}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-content`,children:p.taskName})]})}),(0,Z.jsx)(R,{align:`start`,children:f.map(e=>(0,Z.jsxs)(_e,{value:e.id,children:[(0,Z.jsx)(at,{agent:e}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.taskName})]},e.id))})]}),(0,Z.jsxs)(`span`,{className:`ml-auto flex-none text-xs whitespace-nowrap text-content-muted tabular-nums`,children:[(0,Z.jsxs)(`span`,{className:`@max-[340px]:sr-only`,children:[re(p.status,n),` · `]}),F]}),m&&(0,Z.jsxs)(B,{type:`button`,variant:`secondary`,size:`sm`,className:`flex-none`,disabled:ee,onClick:()=>void oe(),children:[(0,Z.jsx)(le,{"aria-hidden":`true`}),n(`board:subagent.stop`)]})]}),(0,Z.jsx)(`p`,{className:`m-0 truncate px-1.5 text-xs leading-5 text-content-muted`,children:m?`${A(p,n)} · ${P}`:P}),ce&&(0,Z.jsx)(ut,{text:ce},p.id)]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:ue}),(0,Z.jsxs)(`p`,{className:z(`m-0 flex shrink-0 items-center gap-1.5 border-t border-stroke-soft px-3 py-1.5 text-xs leading-4 text-content-muted`,t?`min-h-11`:`min-h-9`),children:[(0,Z.jsx)(v,{"aria-hidden":`true`,className:`size-3.5 flex-none`}),m?n(`board:subagent.footerRunning`):p.status===`completed`?n(`board:subagent.footerReturned`,{time:st(p.completedAt,i)}):n(`board:subagent.footerEnded`)]})]})}var ft=new Set([`changes`,`terminal`,`files`]),pt=[];function mt(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function ht({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:f,team:h,activity:g,planTab:_,sources:v,mode:b,requestConfirm:te,onClose:S,onOpenComponents:C,componentTabs:w,autoFocus:T=!1,remoteMachine:E=!1}){let{t:D}=r(),O=b===`sheet`,ne=Ee(),re=o(e=>e.capabilities),k=!!ne&&a(re,`terminal`),ie=a(re,`vcs`),A=Y(e=>e.tab),ae=Y(e=>e.setTab),j=Y(e=>e.terminalView),N=Y(e=>e.setTerminalView),le=Y(e=>e.changesView),ue=Y(e=>e.setChangesView),F=J(e=>e.sessions[t]?.pages)??pt,de=F.some(e=>e.kind===`side-chat`),fe=De(e=>t in e.selected),pe=E?`preview`:`changes`,I=A===`running`||A===`side-chat`&&!de||A===`subagent`&&!fe||A===`plan`&&!_||E&&ft.has(A)?pe:A,L=mt(I,j,le),R=L?F.find(e=>e.kind===L):void 0,_e=!O&&w?w.tabs(n):[],[ve,V]=(0,X.useState)(null),[be,H]=(0,X.useState)(!1),U=_e.some(e=>e.id===ve)?ve:null;(0,X.useEffect)(()=>V(null),[A]);let W=(0,X.useRef)(null);(0,X.useEffect)(()=>{W.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[I,U]);let Se=(0,X.useRef)(T);(0,X.useEffect)(()=>{if(!Se.current)return;let e=requestAnimationFrame(()=>W.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,X.useEffect)(()=>{if(!L||R||(L===`terminal`||L===`processes`)&&!k)return;let e=J.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,L,{type:`add`,kind:L}),n||e.update(t,L,{type:`workspace`,contentOpen:!1})},[L,R,t,k]);let Ce=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>xe(t),staleTime:1e4}),we=Ce.data?.status===`known`?Ce.data.changedFiles??0:0,Te=[...E?[]:[{id:`changes`,icon:ee,label:we>0?D(`board:inspector.changesCount`,{count:we}):D(`board:inspector.changes`)},{id:`terminal`,icon:ce,label:D(`board:inspector.terminal`)}],...E?[]:[{id:`files`,icon:x,label:D(`board:inspector.files`)}],{id:`preview`,icon:y,label:D(`board:inspector.preview`)},..._?[{id:`plan`,icon:oe,label:D(`board:inspector.plan`)}]:[],...de?[{id:`side-chat`,icon:se,label:D(`board:inspector.sideChat`)}]:[],...fe?[{id:`subagent`,icon:c,label:D(`board:inspector.subagent`)}]:[]],K=e=>{R&&J.getState().update(t,R.kind,{type:`view`,id:R.id,patch:e})},q=()=>{let n=F.find(e=>e.kind===`side-chat`);if(n&&J.getState().update(t,`side-chat`,{type:`close`,id:n.id}),ae(`changes`),O){S();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Oe=()=>{if(De.getState().close(t),ae(pe),O){S();return}requestAnimationFrame(()=>document.getElementById(`${e}-${pe}-tab`)?.focus())},ke=t=>`${e}-component-${t}-tab`,je=e=>{V(null),ae(e)},Me=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Te.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),..._e.map(e=>({component:e.id,id:ke(e.id)}))],r=n.findIndex(e=>U?e.component===U:e.fixed===I),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?V(i.component):i.fixed&&je(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},Q=(0,Z.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:D(`chat:focusSession.gitLoading`)}),$;return $=U&&w?w.render(U,{sessionId:t,cwd:n}):I===`changes`?(0,Z.jsx)(nt,{sessionId:t,cwd:n,streaming:s,scope:le,onScopeChange:ue,vcsAvailable:ie,view:R?.view,onViewChange:R?K:void 0,requestConfirm:te}):I===`terminal`?k?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,Z.jsx)(ye,{size:`sm`,"aria-label":D(`board:inspector.terminalScope`),value:j,onValueChange:N,options:[{value:`terminal`,label:D(`board:inspector.terminal`)},{value:`processes`,label:D(`board:inspector.processes`)}]})}),(0,Z.jsx)(X.Suspense,{fallback:Q,children:R?j===`processes`?(0,Z.jsx)(u,{sessionId:t,view:R.view,onViewChange:K,onOpenTerminal:e=>{let n=J.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),N(`terminal`)}}):(0,Z.jsx)(m,{sessionId:t,cwd:n,terminalId:R.resourceId||void 0,onCreated:e=>J.getState().update(t,`terminal`,{type:`resource`,id:R.id,resourceId:e})},R.id):Q})]}):(0,Z.jsx)(G,{compact:!0,icon:ce,title:D(`board:inspector.terminalUnavailable`)}):I===`files`?R?(0,Z.jsx)(d,{sources:v,view:R.view,onViewChange:K}):Q:I===`preview`?R?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:(0,Z.jsx)(Ie,{panelId:e,sessionId:t},t)}):Q:I===`plan`?(0,Z.jsx)(Fe,{plan:l,streaming:s,goal:f,team:h,activity:g}):I===`subagent`?(0,Z.jsx)(dt,{sessionId:t,sheet:O}):(0,Z.jsx)(p,{parentId:t,active:!0}),(0,Z.jsxs)(`section`,{id:e,"aria-label":D(`board:inspector.label`),"data-session-inspector":b,"data-inspector-tab":I,"data-inspector-component":U??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,Z.jsxs)(`header`,{className:z(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,O?`h-[52px]`:b===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,Z.jsxs)(`div`,{ref:W,role:`tablist`,"aria-label":D(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Me,children:[Te.map(({id:t,icon:n,label:r})=>{let i=!U&&t===I;return(0,Z.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:z(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,O?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>je(t),children:[!O&&(0,Z.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!U&&I===`subagent`&&(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:z(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.subagent`)}),onClick:Oe,children:(0,Z.jsx)(P,{"aria-hidden":`true`})}),!U&&I===`side-chat`&&(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:z(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.sideChat`)}),onClick:q,children:(0,Z.jsx)(P,{"aria-hidden":`true`})}),!O&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),_e.map(({id:t,label:n})=>{let r=t===U;return(0,Z.jsx)(`button`,{id:ke(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:z(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>V(t),children:(0,Z.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!O&&(0,Z.jsxs)(ge,{open:be,onOpenChange:H,children:[(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":D(`board:inspector.add`),title:D(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,Z.jsx)(M,{"aria-hidden":`true`})})}),(0,Z.jsxs)(he,{align:`end`,className:`w-64 text-xs`,children:[w?.addMenu?w.addMenu({cwd:n,onAdded:e=>{V(e),H(!1)}}):(0,Z.jsx)(`p`,{className:`text-content-secondary`,children:D(`board:inspector.addHint`)}),C&&(0,Z.jsx)(B,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:C,children:D(`board:inspector.openComponents`)})]})]}),(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:z(`flex-none`,O&&`size-11`),"aria-label":D(`board:inspector.close`),title:D(`board:inspector.close`),"aria-controls":e,onClick:S,children:b===`aside`?(0,Z.jsx)(Ae,{"aria-hidden":`true`}):(0,Z.jsx)(P,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":U?ke(U):`${e}-${I}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:$})]})}export{ht as SessionInspector};
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-BqDnJFL5.js";import{t as i}from"./useQuery-DfOU-27z.js";import{i as a}from"./runtime-capabilities-CxyszNkG.js";import{t as o}from"./runtime-capabilities-store-aG2QVT6b.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./bot-B3TaBp_T.js";import{t as l}from"./check-2vYc6QaP.js";import{a as u,i as d,l as f,n as p,o as m,s as h,t as g,u as _}from"./SessionBrowserPane-DGQsDUqd.js";import{t as v}from"./corner-down-left-DalpwXuX.js";import{t as y}from"./earth-Ddy13fHh.js";import{t as b}from"./ellipsis-CfGKfbq6.js";import{o as ee}from"./GitDiffViewer-DplIwM8m.js";import{b as x,o as te,s as S}from"./side-chat-context-DxeaaCWm.js";import{t as C}from"./git-branch-N7LGjtzt.js";import{_ as w,a as T,c as E,f as D,g as O,h as ne,l as re,o as k,p as ie,s as A,y as ae}from"./ChatMessage-Cb3Rzxbr.js";import{t as j}from"./undo-2-ChaURM4t.js";import{t as oe}from"./list-todo-hpikYm6Q.js";import{t as se}from"./message-square-SKjZyY3v.js";import{t as M}from"./plus-fQbSqB1n.js";import{t as N}from"./refresh-cw-TbWxTY4K.js";import{t as ce}from"./square-terminal-BVG6cUT1.js";import{t as le}from"./square-bHHVTT3G.js";import{t as P}from"./x-07u4-129.js";import{c as ue,i as F,p as de,r as fe,t as pe}from"./dropdown-menu-Ds0gD8S8.js";import{a as me,r as he,t as ge}from"./popover-CPdjoO3T.js";import{a as I,i as L,n as R,r as _e,t as ve}from"./select-DyBoNnz-.js";import{t as ye}from"./segmented-control-xkrEOP_d.js";import{t as z}from"./utils-C8uzG5AZ.js";import{t as B}from"./button-CCcCN8tE.js";import{t as V}from"./chat-api-BSs2idF4.js";import{a as be,r as H}from"./format-DMJQzoZ7.js";import{t as U}from"./StatusGlyph-1KgitlUg.js";import{t as xe}from"./session-change-summary-api-Kcf7-e2G.js";import{n as W,t as G}from"./PageState-Cz6vFMXv.js";import{i as Se,n as Ce,r as we}from"./MarkdownMessage-DylM7nUB.js";import{t as Te}from"./route-context-DvWDul4T.js";import{o as K}from"./session-tree-summary-C0dKEzZx.js";import{c as q,r as J}from"./session-web-preview-DvDFSKV-.js";import"./public-B3nCWERr.js";import{n as Ee}from"./terminal-context-aIsIJPn8.js";import{r as Y}from"./session-inspector-store-BolK9Mpy.js";import{t as De}from"./subagent-view-store-BUvI8piR.js";import{o as Oe}from"./web-preview-C7DdG9JP.js";var ke=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Ae=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),X=e(t(),1),Z=n(),je={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function Me(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function Q(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function $({title:e,children:t}){return(0,Z.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function Ne({status:e,name:t,detail:n,t:r}){let i=je[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,Z.jsx)(U,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,Z.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,Z.jsx)(`span`,{className:`flex-none text-content-muted`,children:Me(e,r)})]}),n&&(0,Z.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function Pe(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function Fe({plan:e,streaming:t,goal:n,team:i,activity:a}){let{t:o}=r(),s=Array.isArray(i?.tasks)?i.tasks:[],c=Pe(a),l=!!(n?.id&&String(n.objective||``).trim()),u=!!e?.items?.length;if(!l&&!u&&!s.length&&!c.length)return(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,Z.jsx)(G,{compact:!0,icon:oe,title:o(`chat:sessionContext.planEmpty`)})});let d=Number(n?.mode===`team`?n?.teamTokenBudget:n?.tokenBudget)||0;return(0,Z.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[l&&n&&(0,Z.jsx)($,{title:o(`board:inspector.goal`),children:(0,Z.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(n.objective)}),(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,Z.jsx)(`span`,{children:Q(n,o)}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(`span`,{children:d>0?o(`chat:focusSession.usedBudgetTokensUsed`,{used:H(n.tokensUsed),budget:H(d)}):o(`chat:focusSession.usedUnlimitedGoalTokens`,{used:H(n.tokensUsed)})})]})]})}),u&&(0,Z.jsx)($,{title:o(`board:inspector.plan`),children:(0,Z.jsx)(_,{plan:e,running:t})}),s.length>0&&(0,Z.jsx)($,{title:o(`board:inspector.team`),children:(0,Z.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,Z.jsx)(Ne,{status:e.status,name:e.taskName||o(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:o},e.id||`${e.taskName}-${t}`))})}),c.length>0&&(0,Z.jsx)($,{title:o(`board:inspector.subAgents`),children:(0,Z.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:c.map((e,t)=>(0,Z.jsx)(Ne,{status:e.status,name:String(e.taskName||``).trim()||o(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:o},String(e.id||t)))})})]})}function Ie({panelId:e,sessionId:t}){let{t:n}=r(),i=J(e=>e.sessions[t]),a=i?.pages,o=a?.filter(e=>e.kind===`browser`)??[],s=(i&&q(i))?.id??``,l=(a?.length??0)>=12,u=(0,X.useRef)(null),[d,f]=(0,X.useState)([]);s&&!d.includes(s)&&f([...d,s]),(0,X.useEffect)(()=>{u.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.closest(`[data-browser-tab]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[s]);let p=t=>`${e}-browser-${t}-tab`,m=t=>`${e}-browser-${t}-panel`,h=e=>J.getState().update(t,`browser`,{type:`browser-tab`,id:e}),_=(e,t,n=``)=>requestAnimationFrame(()=>document.querySelector(`[id="${e(t)}"] ${n}`.trim())?.focus()),v=()=>{let e=J.getState(),n=e.sessions[t]?.contentOpen??!1;if(e.update(t,`browser`,{type:`add`,kind:`browser`})===`limit`)return;n||e.update(t,`browser`,{type:`workspace`,contentOpen:!1});let r=J.getState().sessions[t],i=r&&q(r);i&&_(m,i.id,`input`)},y=e=>{let n=J.getState();if(o.length===1){n.update(t,`browser`,{type:`browser`,id:e,url:``,draft:``,agent:!1}),n.update(t,`browser`,{type:`resource`,id:e,resourceId:``});return}n.update(t,`browser`,{type:`close`,id:e});let r=J.getState().sessions[t],i=r&&q(r);i&&_(p,i.id)};return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-stroke-soft px-3 py-1.5`,children:[(0,Z.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":n(`common:webPreview.tabs`),className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),s&&y(s);return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=o.findIndex(e=>e.id===s),n=e.key===`Home`?0:e.key===`End`?o.length-1:(t+(e.key===`ArrowRight`?1:-1)+o.length)%o.length,r=o[n];r&&(h(r.id),_(p,r.id))},children:o.map(e=>{let t=e.id===s,r=e.title||(e.url?Oe(e.url):n(`common:webPreview.newTab`)),i=o.length>1||!!(e.url||e.resourceId);return(0,Z.jsxs)(`div`,{"data-browser-tab":e.id,className:z(`flex min-w-20 flex-[0_1_10rem] items-center rounded-sm text-[13px] transition-colors duration-(--d-fast)`,t?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onAuxClick:t=>{t.button===1&&i&&y(e.id)},children:[(0,Z.jsxs)(`button`,{id:p(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":m(e.id),tabIndex:t?0:-1,title:e.url||r,className:z(`flex h-7 min-w-0 flex-1 items-center rounded-sm pl-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,!i&&`pr-2`),onClick:()=>h(e.id),children:[e.agent&&(0,Z.jsx)(c,{size:12,className:`mr-1 flex-none text-focus`,role:`img`,"aria-label":n(`common:webPreview.agentTab`)}),(0,Z.jsx)(`span`,{className:`truncate`,children:r})]}),i&&(0,Z.jsx)(`button`,{type:`button`,tabIndex:t?0:-1,"aria-label":`${n(`common:webPreview.closeTab`)} · ${r}`,className:`mx-0.5 grid size-5 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:size-11`,onClick:()=>y(e.id),children:(0,Z.jsx)(P,{size:12,"aria-hidden":`true`})})]},e.id)})}),(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none pointer-coarse:size-11`,disabled:l,"aria-label":n(`common:webPreview.newTab`),title:n(l?`chat:sessionContext.pageLimit`:`common:webPreview.newTab`),onClick:v,children:(0,Z.jsx)(M,{"aria-hidden":`true`})})]}),o.filter(e=>d.includes(e.id)).map(e=>{let n=e.id===s;return(0,Z.jsx)(`div`,{id:m(e.id),role:`tabpanel`,"aria-labelledby":p(e.id),hidden:!n,className:n?`flex min-h-0 flex-1 flex-col`:`hidden`,children:(0,Z.jsx)(g,{sessionId:t,page:e,onChange:n=>J.getState().update(t,`browser`,{type:`browser`,id:e.id,...n}),onClosed:()=>y(e.id)})},e.id)})]})}var Le=100;function Re(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var ze={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Be={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function Ve(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function He(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function Ue(e,t){window.dispatchEvent(new CustomEvent(Te,{detail:{message:e,tone:t}}))}function We({added:e,removed:t}){return e===null||t===null?null:(0,Z.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Ge({status:e,children:t}){let{t:n}=r();return(0,Z.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,Z.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,Z.jsxs)(pe,{children:[(0,Z.jsx)(de,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,Z.jsx)(b,{"aria-hidden":`true`})})}),(0,Z.jsx)(fe,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Ke({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,Z.jsxs)(`span`,{className:z(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Be[e]),title:n,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:ze[e]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:n})]})}function qe({files:e,selected:t,label:n,onSelect:r}){let i=(0,X.useRef)(null);return(0,Z.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,Le).map(e=>{let n=e.path===t,{directory:i,name:a}=Ve(e.path);return(0,Z.jsx)(`li`,{className:`px-1`,children:(0,Z.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,ze[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:z(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,Z.jsx)(Ke,{status:e.status}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,Z.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,Z.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,Z.jsx)(We,{added:e.added,removed:e.removed})]})},e.path)}),e.length>Le&&(0,Z.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,Z.jsx)(Je,{count:e.length-Le})})]})}function Je({count:e}){let{t}=r();return(0,Z.jsx)(Z.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Ye=600;function Xe({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:c}=r(),l=Y(e=>e.diffMode),u=Y(e=>e.setDiffMode),d=(0,X.useRef)(null),[p,m]=(0,X.useState)(0);(0,X.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>m(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=p===0||p>=Ye,g=h?l:`unified`,_=h?void 0:c(`board:changes.splitTooNarrow`);return(0,Z.jsxs)(`section`,{ref:d,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,Z.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,Z.jsx)(Ke,{status:t.status}),(0,Z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,Z.jsx)(We,{added:t.added,removed:t.removed}),(0,Z.jsx)(ye,{size:`sm`,"aria-label":c(`board:changes.diffView`),title:_,"aria-description":_,value:g,onValueChange:u,options:[{value:`unified`,label:c(`board:changes.unified`)},{value:`split`,label:c(`board:changes.split`),disabled:!h}]})]}),(0,Z.jsx)(f,{sessionId:e,path:t.path,scope:n,revision:i,mode:g,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,Z.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function Ze({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=He(e,t);return(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await we(i,Se),Ue(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){Ue(e instanceof Ce&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof Ce&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,Z.jsx)(ke,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Qe(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function $e(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function et({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:u,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:g,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=h({sessionId:e,streaming:n,requestConfirm:o}),x=u?.files??[],te=i?.expandedFiles?.[0],S=x.find(e=>e.path===te)??x[0],C=e=>a?.({expandedFiles:[e]}),w=(e,t)=>f?.kind===e&&f.path===t,T=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,Z.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,Z.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:u?.summary.files??0})}),u&&u.summary.files>0&&(0,Z.jsx)(We,{added:u.summary.added,removed:u.summary.removed})]})}),v&&(0,Z.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,Z.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!u?(0,Z.jsx)(W,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qe,{files:x.map(e=>({...Qe(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):$e(e.formatChange,s)})),selected:S?.path??``,label:s(`board:changes.files`),onSelect:C}),S&&(0,Z.jsx)(Xe,{sessionId:e,file:Qe(S),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:z(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,S.approved?`text-st-done`:`text-content-muted`),"data-change-state":S.reverted?`reverted`:S.approved?`approved`:`pending`,children:[S.approved&&!S.reverted&&(0,Z.jsx)(l,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),S.reverted?s(`board:changes.revertedAt`,{time:be(S.changedAt,c)}):S.approved?s(`board:changes.approvedAt`,{time:be(S.changedAt,c)}):s(`board:changes.pendingAt`,{time:be(S.changedAt,c)})]}),S.pending&&!S.approved&&!S.reverted&&(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:T,onClick:()=>void b({kind:`approve`,path:S.path}),children:[w(`approve`,S.path)?(0,Z.jsx)(N,{className:`animate-spin`}):(0,Z.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||S.reverted||!S.canRevert,title:T,onClick:()=>void b({kind:`revert`,path:S.path}),children:[w(`revert`,S.path)?(0,Z.jsx)(N,{className:`animate-spin`}):(0,Z.jsx)(j,{}),s(`board:changes.revertFile`)]}),(0,Z.jsx)(Ze,{cwd:t,path:S.path})]})})]}):!v&&(0,Z.jsx)(G,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,Z.jsxs)(Ge,{status:f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):g>0?s(`board:changes.pending`,{count:g}):null,children:[g>0&&(0,Z.jsxs)(F,{disabled:m,title:T,onSelect:()=>void b({kind:`approve`}),children:[(0,Z.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(u?.summary.files??0)>0&&(0,Z.jsxs)(F,{disabled:m||_===0,title:T??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,Z.jsx)(j,{}),s(`board:changes.revertAll`)]}),(g>0||(u?.summary.files??0)>0)&&(0,Z.jsx)(ue,{}),(0,Z.jsxs)(F,{disabled:d||!!f,onSelect:ee,children:[(0,Z.jsx)(N,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function tt({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>V.getVcsChanges(e,{signal:t})}),l=(0,X.useMemo)(()=>S(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:Re(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,Z.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,Z.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,Z.jsx)(We,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,Z.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,Z.jsx)(C,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,Z.jsx)(W,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,Z.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(qe,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,Z.jsx)(Xe,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,Z.jsx)(Ze,{cwd:t,path:p.path})]})})]}):(0,Z.jsx)(G,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,Z.jsx)(G,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,Z.jsx)(Ge,{status:c.isFetching?(0,Z.jsx)(N,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,Z.jsxs)(F,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,Z.jsx)(N,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function nt({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,Z.jsx)(ye,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,Z.jsx)(tt,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,Z.jsx)(et,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,Z.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var rt=2500,it=1500;function at({agent:e}){let t=k[e.status];return(0,Z.jsx)(U,{status:t.kind,spin:t.kind===`run`,className:z(`size-[15px] flex-none`,t.color)})}function ot(e){let[t,n]=(0,X.useState)(()=>Date.now());return(0,X.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function st(e,t){let n=e?Date.parse(e):NaN;return Number.isFinite(n)?new Date(n).toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`}):``}var ct=[];function lt(e,t){let n=(0,X.useRef)(null),[r,i]=(0,X.useState)(!1);return(0,X.useLayoutEffect)(()=>{let e=n.current;if(!e||!t)return;let r=()=>i(e.scrollHeight>e.clientHeight+1);if(r(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[e,t]),[n,r]}function ut({text:e}){let{t}=r(),[n,i]=(0,X.useState)(!1),[a,o]=lt(e,!n),s=(0,X.useId)(),c=(0,X.useId)();return(0,Z.jsxs)(`div`,{role:`group`,"aria-labelledby":c,className:`mx-1.5 mt-2 border-l-2 border-stroke pl-2.5`,children:[(0,Z.jsx)(`p`,{id:c,className:`m-0 text-[11px] leading-4 font-medium text-content-muted`,children:t(`board:subagent.task`)}),(0,Z.jsx)(`p`,{ref:a,id:s,className:z(`m-0 mt-0.5 text-[13px] leading-5 break-words whitespace-pre-wrap text-content-secondary`,n?`max-h-60 overflow-y-auto overscroll-contain`:`line-clamp-2`),children:e}),(o||n)&&(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":n,"aria-controls":s,className:`-ml-2.5 text-xs`,onClick:()=>i(e=>!e),children:t(n?`board:subagent.taskCollapse`:`board:subagent.taskExpand`)})]})}function dt({sessionId:e,sheet:t=!1}){let{t:n,language:i}=r(),a=De(t=>t.selected[e]??``),s=De(e=>e.select),{agents:l,reload:u}=w(e,!0),d=o(e=>e.capabilities.features.agentTranscriptEvents),f=(0,X.useMemo)(()=>l.filter(e=>e.kind!==`command`),[l]),p=f.find(e=>e.id===a),m=!!(p&&ie(p)),h=ot(m),[g,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(``),[ee,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(0),k=p?.id??``,j=p?.status??``;(0,X.useEffect)(()=>{_(null),b(``)},[k]),(0,X.useEffect)(()=>{if(!k)return;let t=new AbortController,n=0;if(d){let r=!1,i=async()=>{let a=null;try{a=await O(e,k,e=>{r=!0,_(e),b(``)},t.signal)}catch(e){if(t.signal.aborted)return;if(!r){b(K(e));return}}t.signal.aborted||a?.active===!1||(n=window.setTimeout(()=>void i(),it))};return i(),()=>{t.abort(),window.clearTimeout(n)}}let r=async()=>{try{let i=await D(e,k,t.signal);if(t.signal.aborted)return;_(i),b(``),i.active&&(n=window.setTimeout(r,rt))}catch(e){t.signal.aborted||b(K(e))}};return r(),()=>{t.abort(),window.clearTimeout(n)}},[k,S,d,e,j]);let oe=(0,X.useCallback)(async()=>{if(k){x(!0);try{await ne(e,k)}catch{}finally{x(!1),u()}}},[k,u,e]),se=(0,X.useMemo)(()=>({model:``,name:p?.taskName??``}),[p?.taskName]),M=(0,X.useMemo)(()=>g?.taskShown?g.messages.slice(1):g?.messages??[],[g]),N=(0,X.useMemo)(()=>{let e=M.at(-1);return g?.active&&e?.role===`agent`&&e.runActivity?e.runActivity:null},[M,g?.active]);if(!p)return(0,Z.jsx)(G,{compact:!0,icon:c,title:f.length?n(`board:subagent.pick`):n(`board:subagent.empty`)});let ce=g?.task||p.message,P=[p.model.split(`/`).pop(),p.toolCallCount?n(`board:subagent.toolCalls`,{count:p.toolCallCount}):``,n(`board:subagent.startedAt`,{time:st(p.startedAt,i)})].filter(Boolean).join(` · `),ue;ue=y?(0,Z.jsx)(`div`,{className:`p-3`,children:(0,Z.jsx)(ae,{error:y,onRetry:()=>C(e=>e+1)})}):g?g.available?(0,Z.jsxs)(T.Provider,{value:se,children:[g.omitted>0&&(0,Z.jsx)(`p`,{className:`m-0 shrink-0 px-3 pt-2 text-xs text-content-muted`,children:n(`board:subagent.omitted`,{count:g.omitted})}),(0,Z.jsx)(te,{sessionId:`${e}:agent:${p.id}`,messages:M,transcriptLoadState:`ready`,emptyState:(0,Z.jsx)(G,{compact:!0,icon:c,title:n(`board:subagent.noMessages`)}),activityFeed:N?.activityFeed??ct,tools:N?.tools??ct,thinkingText:N?.thinkingText,runStartedAt:N?.startedAt??null,lastActivityAt:N?.lastActivityAt??null,streaming:g.active,readOnly:!0,onRetryLastTurn:()=>{}})]}):(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-3`,children:[(0,Z.jsx)(G,{compact:!0,icon:c,title:n(`board:subagent.notRecorded`)}),(p.output||p.error)&&(0,Z.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed whitespace-pre-wrap text-content`,children:p.error||p.output})]}):(0,Z.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:n(`board:subagent.loading`)});let F=E(p.startedAt,p.completedAt,h);return(0,Z.jsxs)(`section`,{"aria-label":n(`board:subagent.label`,{name:p.taskName}),"data-subagent-pane":p.id,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-stroke-soft px-2 pt-2 pb-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsxs)(ve,{value:p.id,onValueChange:t=>s(e,t),children:[(0,Z.jsx)(L,{variant:`ghost`,"aria-label":n(`board:subagent.switch`),className:`min-w-0`,children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(at,{agent:p}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-semibold text-content`,children:p.taskName})]})}),(0,Z.jsx)(R,{align:`start`,children:f.map(e=>(0,Z.jsxs)(_e,{value:e.id,children:[(0,Z.jsx)(at,{agent:e}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.taskName})]},e.id))})]}),(0,Z.jsxs)(`span`,{className:`ml-auto flex-none text-xs whitespace-nowrap text-content-muted tabular-nums`,children:[(0,Z.jsxs)(`span`,{className:`@max-[340px]:sr-only`,children:[re(p.status,n),` · `]}),F]}),m&&(0,Z.jsxs)(B,{type:`button`,variant:`secondary`,size:`sm`,className:`flex-none`,disabled:ee,onClick:()=>void oe(),children:[(0,Z.jsx)(le,{"aria-hidden":`true`}),n(`board:subagent.stop`)]})]}),(0,Z.jsx)(`p`,{className:`m-0 truncate px-1.5 text-xs leading-5 text-content-muted`,children:m?`${A(p,n)} · ${P}`:P}),ce&&(0,Z.jsx)(ut,{text:ce},p.id)]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:ue}),(0,Z.jsxs)(`p`,{className:z(`m-0 flex shrink-0 items-center gap-1.5 border-t border-stroke-soft px-3 py-1.5 text-xs leading-4 text-content-muted`,t?`min-h-11`:`min-h-9`),children:[(0,Z.jsx)(v,{"aria-hidden":`true`,className:`size-3.5 flex-none`}),m?n(`board:subagent.footerRunning`):p.status===`completed`?n(`board:subagent.footerReturned`,{time:st(p.completedAt,i)}):n(`board:subagent.footerEnded`)]})]})}var ft=new Set([`changes`,`terminal`,`files`]),pt=[];function mt(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function ht({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:f,team:h,activity:g,planTab:_,sources:v,mode:b,requestConfirm:te,onClose:S,onOpenComponents:C,componentTabs:w,autoFocus:T=!1,remoteMachine:E=!1}){let{t:D}=r(),O=b===`sheet`,ne=Ee(),re=o(e=>e.capabilities),k=!!ne&&a(re,`terminal`),ie=a(re,`vcs`),A=Y(e=>e.tab),ae=Y(e=>e.setTab),j=Y(e=>e.terminalView),N=Y(e=>e.setTerminalView),le=Y(e=>e.changesView),ue=Y(e=>e.setChangesView),F=J(e=>e.sessions[t]?.pages)??pt,de=F.some(e=>e.kind===`side-chat`),fe=De(e=>t in e.selected),pe=E?`preview`:`changes`,I=A===`running`||A===`side-chat`&&!de||A===`subagent`&&!fe||A===`plan`&&!_||E&&ft.has(A)?pe:A,L=mt(I,j,le),R=L?F.find(e=>e.kind===L):void 0,_e=!O&&w?w.tabs(n):[],[ve,V]=(0,X.useState)(null),[be,H]=(0,X.useState)(!1),U=_e.some(e=>e.id===ve)?ve:null;(0,X.useEffect)(()=>V(null),[A]);let W=(0,X.useRef)(null);(0,X.useEffect)(()=>{W.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[I,U]);let Se=(0,X.useRef)(T);(0,X.useEffect)(()=>{if(!Se.current)return;let e=requestAnimationFrame(()=>W.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,X.useEffect)(()=>{if(!L||R||(L===`terminal`||L===`processes`)&&!k)return;let e=J.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,L,{type:`add`,kind:L}),n||e.update(t,L,{type:`workspace`,contentOpen:!1})},[L,R,t,k]);let Ce=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>xe(t),staleTime:1e4}),we=Ce.data?.status===`known`?Ce.data.changedFiles??0:0,Te=[...E?[]:[{id:`changes`,icon:ee,label:we>0?D(`board:inspector.changesCount`,{count:we}):D(`board:inspector.changes`)},{id:`terminal`,icon:ce,label:D(`board:inspector.terminal`)}],...E?[]:[{id:`files`,icon:x,label:D(`board:inspector.files`)}],{id:`preview`,icon:y,label:D(`board:inspector.preview`)},..._?[{id:`plan`,icon:oe,label:D(`board:inspector.plan`)}]:[],...de?[{id:`side-chat`,icon:se,label:D(`board:inspector.sideChat`)}]:[],...fe?[{id:`subagent`,icon:c,label:D(`board:inspector.subagent`)}]:[]],K=e=>{R&&J.getState().update(t,R.kind,{type:`view`,id:R.id,patch:e})},q=()=>{let n=F.find(e=>e.kind===`side-chat`);if(n&&J.getState().update(t,`side-chat`,{type:`close`,id:n.id}),ae(`changes`),O){S();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Oe=()=>{if(De.getState().close(t),ae(pe),O){S();return}requestAnimationFrame(()=>document.getElementById(`${e}-${pe}-tab`)?.focus())},ke=t=>`${e}-component-${t}-tab`,je=e=>{V(null),ae(e)},Me=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Te.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),..._e.map(e=>({component:e.id,id:ke(e.id)}))],r=n.findIndex(e=>U?e.component===U:e.fixed===I),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?V(i.component):i.fixed&&je(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},Q=(0,Z.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:D(`chat:focusSession.gitLoading`)}),$;return $=U&&w?w.render(U,{sessionId:t,cwd:n}):I===`changes`?(0,Z.jsx)(nt,{sessionId:t,cwd:n,streaming:s,scope:le,onScopeChange:ue,vcsAvailable:ie,view:R?.view,onViewChange:R?K:void 0,requestConfirm:te}):I===`terminal`?k?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,Z.jsx)(ye,{size:`sm`,"aria-label":D(`board:inspector.terminalScope`),value:j,onValueChange:N,options:[{value:`terminal`,label:D(`board:inspector.terminal`)},{value:`processes`,label:D(`board:inspector.processes`)}]})}),(0,Z.jsx)(X.Suspense,{fallback:Q,children:R?j===`processes`?(0,Z.jsx)(u,{sessionId:t,view:R.view,onViewChange:K,onOpenTerminal:e=>{let n=J.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),N(`terminal`)}}):(0,Z.jsx)(m,{sessionId:t,cwd:n,terminalId:R.resourceId||void 0,onCreated:e=>J.getState().update(t,`terminal`,{type:`resource`,id:R.id,resourceId:e})},R.id):Q})]}):(0,Z.jsx)(G,{compact:!0,icon:ce,title:D(`board:inspector.terminalUnavailable`)}):I===`files`?R?(0,Z.jsx)(d,{sources:v,view:R.view,onViewChange:K}):Q:I===`preview`?R?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:(0,Z.jsx)(Ie,{panelId:e,sessionId:t},t)}):Q:I===`plan`?(0,Z.jsx)(Fe,{plan:l,streaming:s,goal:f,team:h,activity:g}):I===`subagent`?(0,Z.jsx)(dt,{sessionId:t,sheet:O}):(0,Z.jsx)(p,{parentId:t,active:!0}),(0,Z.jsxs)(`section`,{id:e,"aria-label":D(`board:inspector.label`),"data-session-inspector":b,"data-inspector-tab":I,"data-inspector-component":U??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,Z.jsxs)(`header`,{className:z(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,O?`h-[52px]`:b===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,Z.jsxs)(`div`,{ref:W,role:`tablist`,"aria-label":D(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Me,children:[Te.map(({id:t,icon:n,label:r})=>{let i=!U&&t===I;return(0,Z.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:z(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,O?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>je(t),children:[!O&&(0,Z.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!U&&I===`subagent`&&(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:z(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.subagent`)}),onClick:Oe,children:(0,Z.jsx)(P,{"aria-hidden":`true`})}),!U&&I===`side-chat`&&(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:z(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.sideChat`)}),onClick:q,children:(0,Z.jsx)(P,{"aria-hidden":`true`})}),!O&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),_e.map(({id:t,label:n})=>{let r=t===U;return(0,Z.jsx)(`button`,{id:ke(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:z(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>V(t),children:(0,Z.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!O&&(0,Z.jsxs)(ge,{open:be,onOpenChange:H,children:[(0,Z.jsx)(me,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":D(`board:inspector.add`),title:D(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,Z.jsx)(M,{"aria-hidden":`true`})})}),(0,Z.jsxs)(he,{align:`end`,className:`w-64 text-xs`,children:[w?.addMenu?w.addMenu({cwd:n,onAdded:e=>{V(e),H(!1)}}):(0,Z.jsx)(`p`,{className:`text-content-secondary`,children:D(`board:inspector.addHint`)}),C&&(0,Z.jsx)(B,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:C,children:D(`board:inspector.openComponents`)})]})]}),(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:z(`flex-none`,O&&`size-11`),"aria-label":D(`board:inspector.close`),title:D(`board:inspector.close`),"aria-controls":e,onClick:S,children:b===`aside`?(0,Z.jsx)(Ae,{"aria-hidden":`true`}):(0,Z.jsx)(P,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":U?ke(U):`${e}-${I}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:$})]})}export{ht as SessionInspector};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{h as o,r as s}from"./routes-BYsK6aeM.js";import{t as c}from"./use-i18n-DL1_y_Ge.js";import{a as l,o as u,s as d,u as f}from"./placements-DaEYVBYS.js";import{t as p}from"./client-store-JUgMl-Fs.js";import{t as m}from"./usePhoneShell-E0zpNbPD.js";import{t as h}from"./useSessionListQuery-CaaqoetW.js";import{t as g}from"./public-CbGNOymN.js";import{PhoneMenuButton as _}from"./PhoneMenuButton-BOcCSFnH.js";import{i as v,t as y}from"./session-home-DbvyzdI5.js";var b=e(i(),1),x=a(),S=`(max-width: 1279px), (max-height: 760px)`,C=`(min-width: 960px) and (min-height: 640px)`;function w(e){let[t,n]=(0,b.useState)(()=>window.matchMedia(e).matches);return(0,b.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function T({context:e,ChatPage:i}){let a=r(),c=n(),{sessionId:l=``}=t(),u=m(),d=p(e=>e.client===`mobile-app`),f=w(`(min-width: 960px) and (min-height: 640px)`)&&d,C=w(S),T=!u||f,D=(0,b.useRef)(l);D.current=l;let O=(0,b.useRef)(c.state);O.current=c.state;let k=(0,b.useCallback)(e=>{if(!e||e===D.current)return;let t=D.current===`new`;a(o(e),{replace:t,state:t?O.current:void 0})},[a]),A=h(),j=!!(l&&l!==`new`&&A.data?.sessions.some(e=>e.id===l));(0,b.useEffect)(()=>{j&&v(l)},[j,l]);let M=E(e.notify,k),N=e.startNewTask,P=l===`new`,F=e.notify,I=g({onError:e=>F(e,`error`)}),L=P?I:void 0,R=(0,b.useMemo)(()=>({compact:C,overlayOnly:d,onOpenComponents:()=>a(s.components),componentTabs:M,onArchived:e=>{y(e),a(`/`,{replace:!0})},onHome:()=>a(`/`),onNewTask:N,newTaskDraft:L}),[C,d,a,M,N,L]),z=(0,b.useMemo)(()=>({...R,phone:{onNewTask:N}}),[R,N]);return(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":T?`desktop`:`phone`,children:(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,x.jsx)(i,{notify:e.notify,navigate:e.navigate,browserNotify:e.browserNotify,pendingAsset:e.pendingAsset,onAssetConsumed:e.onAssetConsumed,requestText:e.requestText,requestConfirm:e.requestConfirm,routeSessionId:l,onRouteSessionChange:k,routeLeading:T?void 0:(0,x.jsx)(_,{}),pageChrome:T?R:z})})})}function E(e,t){let{language:n}=c(),{available:r,placed:i}=f(`session-panel`);return(0,b.useMemo)(()=>{if(r)return{tabs:e=>d(i,e,n),render:(n,{sessionId:r,cwd:a})=>{let o=i.find(e=>e.instance.instanceId===n);return o?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(u,{placed:o,sessionId:r,cwd:a,notify:e,onOpenSession:t})}):null},addMenu:({cwd:t,onAdded:n})=>(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(l,{cwd:t,notify:e,onAdded:n})})}},[r,n,e,t,i])}export{S as SESSION_COMPACT_QUERY,C as SESSION_TABLET_QUERY,T as SessionShell};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{h as o,r as s}from"./routes-BYsK6aeM.js";import{t as c}from"./use-i18n-BqDnJFL5.js";import{a as l,o as u,s as d,u as f}from"./placements-DY62NlQc.js";import{t as p}from"./client-store-C_ajzmyH.js";import{t as m}from"./usePhoneShell-iGegDaj2.js";import{t as h}from"./useSessionListQuery-mhLtsKkB.js";import{t as g}from"./public-CAdIUTea.js";import{PhoneMenuButton as _}from"./PhoneMenuButton-DiDPv4NZ.js";import{i as v,t as y}from"./session-home-DOe7Q-qI.js";var b=e(i(),1),x=a(),S=`(max-width: 1279px), (max-height: 760px)`,C=`(min-width: 960px) and (min-height: 640px)`;function w(e){let[t,n]=(0,b.useState)(()=>window.matchMedia(e).matches);return(0,b.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function T({context:e,ChatPage:i}){let a=r(),c=n(),{sessionId:l=``}=t(),u=m(),d=p(e=>e.client===`mobile-app`),f=w(`(min-width: 960px) and (min-height: 640px)`)&&d,C=w(S),T=!u||f,D=(0,b.useRef)(l);D.current=l;let O=(0,b.useRef)(c.state);O.current=c.state;let k=(0,b.useCallback)(e=>{if(!e||e===D.current)return;let t=D.current===`new`;a(o(e),{replace:t,state:t?O.current:void 0})},[a]),A=h(),j=!!(l&&l!==`new`&&A.data?.sessions.some(e=>e.id===l));(0,b.useEffect)(()=>{j&&v(l)},[j,l]);let M=E(e.notify,k),N=e.startNewTask,P=l===`new`,F=e.notify,I=g({onError:e=>F(e,`error`)}),L=P?I:void 0,R=(0,b.useMemo)(()=>({compact:C,overlayOnly:d,onOpenComponents:()=>a(s.components),componentTabs:M,onArchived:e=>{y(e),a(`/`,{replace:!0})},onHome:()=>a(`/`),onNewTask:N,newTaskDraft:L}),[C,d,a,M,N,L]),z=(0,b.useMemo)(()=>({...R,phone:{onNewTask:N}}),[R,N]);return(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":T?`desktop`:`phone`,children:(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,x.jsx)(i,{notify:e.notify,navigate:e.navigate,browserNotify:e.browserNotify,pendingAsset:e.pendingAsset,onAssetConsumed:e.onAssetConsumed,requestText:e.requestText,requestConfirm:e.requestConfirm,routeSessionId:l,onRouteSessionChange:k,routeLeading:T?void 0:(0,x.jsx)(_,{}),pageChrome:T?R:z})})})}function E(e,t){let{language:n}=c(),{available:r,placed:i}=f(`session-panel`);return(0,b.useMemo)(()=>{if(r)return{tabs:e=>d(i,e,n),render:(n,{sessionId:r,cwd:a})=>{let o=i.find(e=>e.instance.instanceId===n);return o?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(u,{placed:o,sessionId:r,cwd:a,notify:e,onOpenSession:t})}):null},addMenu:({cwd:t,onAdded:n})=>(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(l,{cwd:t,notify:e,onAdded:n})})}},[r,n,e,t,i])}export{S as SESSION_COMPACT_QUERY,C as SESSION_TABLET_QUERY,T as SessionShell};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./runtime-capabilities-store-CJA8-sSC.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-BEoTeOkB.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-Cth0vc77.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BqDnJFL5.js";import{t as i}from"./runtime-capabilities-store-aG2QVT6b.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-BEoTeOkB.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-DsFEMyT1.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-Cth0vc77.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-BfkdQrrN.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-BfiFGtIF.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BqDnJFL5.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-DsFEMyT1.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-CW8GeCdI.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-DFKIS7Us.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./utils-C8uzG5AZ.js";import{n as a,t as o}from"./kbd-CAufZTkl.js";import{t as s}from"./shortcuts-Cth0vc77.js";var c=e=>({kind:`app`,action:e}),l=e=>({kind:`board`,action:e}),u=(e,...t)=>({kind:`fixed`,id:e,keys:t}),d=[{id:`global`,entries:[c(`commandPalette`),c(`primaryAction`),c(`toggleSidebar`),c(`agentPanel`),c(`openBoard`),c(`openMore`),c(`openSettings`),c(`jumpToAttention`),c(`previousAgent`),c(`nextAgent`),c(`cycleFocusRegion`),c(`toggleTerminal`),c(`shortcutHelp`),c(`focusComposer`),c(`voiceInput`),c(`openSession`),c(`openComponents`)]},{id:`sidebar`,entries:[u(`sidebarMove`,[`↑`],[`↓`]),u(`sidebarOpen`,[`Enter`])]},{id:`board`,entries:[c(`focusSearch`),l(`boardNext`),l(`boardPrevious`),u(`boardMove`,[`↑`],[`↓`]),u(`boardOpen`,[`Enter`]),l(`boardApprove`),l(`boardDeny`),l(`boardRetry`),l(`boardTriage`),u(`boardExitTriage`,[`Esc`]),l(`boardToggleGrouping`)]},{id:`session`,entries:[c(`toggleInspector`),c(`sessionTree`),c(`sideChat`),c(`sendMessage`),c(`steerMessage`),u(`newline`,[`Shift`,`Enter`]),u(`cycleRunMode`,[`Shift`,`Tab`]),u(`stopRun`,[`Esc`])]}];function f(e){return e.kind===`fixed`?`fixed:${e.id}`:e.action}function p(e,t,n){if(e.kind===`fixed`)return e.keys;let r=s(e.kind===`app`?t[e.action]:n[e.action]);return r?[r.split(` + `)]:null}function m(){let{t:e}=r(),t={commandPalette:e(`config:shortcuts.commandPalette`),primaryAction:e(`config:shortcuts.primaryAction`),focusSearch:e(`board:shortcuts.focusSearch`),toggleSidebar:e(`config:shortcuts.toggleSidebar`),toggleTerminal:e(`config:shortcuts.toggleTerminal`),openSettings:e(`config:shortcuts.openSettings`),focusComposer:e(`config:shortcuts.focusComposer`),sendMessage:e(`board:shortcuts.sendMessage`),voiceInput:e(`config:shortcuts.voiceInput`),openBoard:e(`config:shortcuts.openBoard`),openComponents:e(`config:shortcuts.openComponents`),openMore:e(`config:shortcuts.openMore`),jumpToAttention:e(`config:shortcuts.jumpToAttention`),agentPanel:e(`board:shortcuts.agentPanel`),toggleInspector:e(`board:shortcuts.toggleInspector`),previousAgent:e(`board:shortcuts.previousAgent`),nextAgent:e(`board:shortcuts.nextAgent`),steerMessage:e(`board:shortcuts.steerMessage`),shortcutHelp:e(`board:shortcuts.shortcutHelp`),openSession:e(`board:shortcuts.openSession`),sessionTree:e(`board:shortcuts.sessionTree`),sideChat:e(`board:shortcuts.sideChat`),cycleFocusRegion:e(`board:shortcuts.cycleFocusRegion`)},n={boardNext:e(`config:shortcuts.boardNext`),boardPrevious:e(`config:shortcuts.boardPrevious`),boardApprove:e(`config:shortcuts.boardApprove`),boardDeny:e(`config:shortcuts.boardDeny`),boardRetry:e(`config:shortcuts.boardRetry`),boardTriage:e(`config:shortcuts.boardTriage`),boardToggleGrouping:e(`config:shortcuts.boardToggleGrouping`)},i={sidebarMove:e(`board:shortcuts.sidebarMove`),sidebarOpen:e(`board:shortcuts.sidebarOpen`),boardMove:e(`board:shortcuts.boardMove`),boardOpen:e(`board:shortcuts.boardOpen`),boardExitTriage:e(`board:shortcuts.boardExitTriage`),newline:e(`board:shortcuts.newline`),cycleRunMode:e(`board:shortcuts.cycleRunMode`),stopRun:e(`board:shortcuts.stopRun`)};return{actions:t,boardActions:n,groups:{global:{title:e(`board:shortcuts.groupGlobal`),hint:e(`board:shortcuts.globalHint`)},sidebar:{title:e(`board:shortcuts.groupSidebar`),hint:e(`board:shortcuts.sidebarHint`)},board:{title:e(`board:shortcuts.groupBoard`),hint:e(`board:shortcuts.boardHint`)},session:{title:e(`board:shortcuts.groupSession`),hint:e(`board:shortcuts.sessionHint`)}},label:e=>e.kind===`app`?t[e.action]:e.kind===`board`?n[e.action]:i[e.id]}}var h=e(t(),1),g=n();function _({keys:e,className:t}){let{t:n}=r();return e?.length?(0,g.jsx)(`span`,{className:i(`inline-flex min-w-0 flex-wrap items-center gap-1`,t),children:e.map((e,t)=>(0,g.jsxs)(h.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-content-muted`,children:`/`}),(0,g.jsx)(a,{children:e.map(e=>(0,g.jsx)(o,{className:`text-content-secondary`,children:e},e))})]},e.join(`+`)))}):(0,g.jsx)(`span`,{className:i(`text-xs text-content-muted`,t),children:n(`config:shortcuts.disabled`)})}export{m as a,p as i,d as n,f as r,_ as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BqDnJFL5.js";import{t as i}from"./utils-C8uzG5AZ.js";import{n as a,t as o}from"./kbd-CAufZTkl.js";import{t as s}from"./shortcuts-DsFEMyT1.js";var c=e=>({kind:`app`,action:e}),l=e=>({kind:`board`,action:e}),u=(e,...t)=>({kind:`fixed`,id:e,keys:t}),d=[{id:`global`,entries:[c(`commandPalette`),c(`primaryAction`),c(`toggleSidebar`),c(`agentPanel`),c(`openBoard`),c(`openMore`),c(`openSettings`),c(`jumpToAttention`),c(`previousAgent`),c(`nextAgent`),c(`cycleFocusRegion`),c(`toggleTerminal`),c(`shortcutHelp`),c(`focusComposer`),c(`voiceInput`),c(`openSession`),c(`openComponents`)]},{id:`sidebar`,entries:[u(`sidebarMove`,[`↑`],[`↓`]),u(`sidebarOpen`,[`Enter`])]},{id:`board`,entries:[c(`focusSearch`),l(`boardNext`),l(`boardPrevious`),u(`boardMove`,[`↑`],[`↓`]),u(`boardOpen`,[`Enter`]),l(`boardApprove`),l(`boardDeny`),l(`boardRetry`),l(`boardTriage`),u(`boardExitTriage`,[`Esc`]),l(`boardToggleGrouping`)]},{id:`session`,entries:[c(`toggleInspector`),c(`sessionTree`),c(`sideChat`),c(`sendMessage`),c(`steerMessage`),u(`newline`,[`Shift`,`Enter`]),u(`cycleRunMode`,[`Shift`,`Tab`]),u(`stopRun`,[`Esc`])]}];function f(e){return e.kind===`fixed`?`fixed:${e.id}`:e.action}function p(e,t,n){if(e.kind===`fixed`)return e.keys;let r=s(e.kind===`app`?t[e.action]:n[e.action]);return r?[r.split(` + `)]:null}function m(){let{t:e}=r(),t={commandPalette:e(`config:shortcuts.commandPalette`),primaryAction:e(`config:shortcuts.primaryAction`),focusSearch:e(`board:shortcuts.focusSearch`),toggleSidebar:e(`config:shortcuts.toggleSidebar`),toggleTerminal:e(`config:shortcuts.toggleTerminal`),openSettings:e(`config:shortcuts.openSettings`),focusComposer:e(`config:shortcuts.focusComposer`),sendMessage:e(`board:shortcuts.sendMessage`),voiceInput:e(`config:shortcuts.voiceInput`),openBoard:e(`config:shortcuts.openBoard`),openComponents:e(`config:shortcuts.openComponents`),openMore:e(`config:shortcuts.openMore`),jumpToAttention:e(`config:shortcuts.jumpToAttention`),agentPanel:e(`board:shortcuts.agentPanel`),toggleInspector:e(`board:shortcuts.toggleInspector`),previousAgent:e(`board:shortcuts.previousAgent`),nextAgent:e(`board:shortcuts.nextAgent`),steerMessage:e(`board:shortcuts.steerMessage`),shortcutHelp:e(`board:shortcuts.shortcutHelp`),openSession:e(`board:shortcuts.openSession`),sessionTree:e(`board:shortcuts.sessionTree`),sideChat:e(`board:shortcuts.sideChat`),cycleFocusRegion:e(`board:shortcuts.cycleFocusRegion`)},n={boardNext:e(`config:shortcuts.boardNext`),boardPrevious:e(`config:shortcuts.boardPrevious`),boardApprove:e(`config:shortcuts.boardApprove`),boardDeny:e(`config:shortcuts.boardDeny`),boardRetry:e(`config:shortcuts.boardRetry`),boardTriage:e(`config:shortcuts.boardTriage`),boardToggleGrouping:e(`config:shortcuts.boardToggleGrouping`)},i={sidebarMove:e(`board:shortcuts.sidebarMove`),sidebarOpen:e(`board:shortcuts.sidebarOpen`),boardMove:e(`board:shortcuts.boardMove`),boardOpen:e(`board:shortcuts.boardOpen`),boardExitTriage:e(`board:shortcuts.boardExitTriage`),newline:e(`board:shortcuts.newline`),cycleRunMode:e(`board:shortcuts.cycleRunMode`),stopRun:e(`board:shortcuts.stopRun`)};return{actions:t,boardActions:n,groups:{global:{title:e(`board:shortcuts.groupGlobal`),hint:e(`board:shortcuts.globalHint`)},sidebar:{title:e(`board:shortcuts.groupSidebar`),hint:e(`board:shortcuts.sidebarHint`)},board:{title:e(`board:shortcuts.groupBoard`),hint:e(`board:shortcuts.boardHint`)},session:{title:e(`board:shortcuts.groupSession`),hint:e(`board:shortcuts.sessionHint`)}},label:e=>e.kind===`app`?t[e.action]:e.kind===`board`?n[e.action]:i[e.id]}}var h=e(t(),1),g=n();function _({keys:e,className:t}){let{t:n}=r();return e?.length?(0,g.jsx)(`span`,{className:i(`inline-flex min-w-0 flex-wrap items-center gap-1`,t),children:e.map((e,t)=>(0,g.jsxs)(h.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-content-muted`,children:`/`}),(0,g.jsx)(a,{children:e.map(e=>(0,g.jsx)(o,{className:`text-content-secondary`,children:e},e))})]},e.join(`+`)))}):(0,g.jsx)(`span`,{className:i(`text-xs text-content-muted`,t),children:n(`config:shortcuts.disabled`)})}export{m as a,p as i,d as n,f as r,_ as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-DL1_y_Ge.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./package-check-C5B-7aXn.js";import{t as a}from"./refresh-cw-TbWxTY4K.js";import{t as o}from"./rocket-BgLSjoHY.js";var s=e();function c({update:e,collapsed:c,onOpen:l}){let{t:u}=t(),d=e?.status||{state:`idle`},f=!!(e?.info?.desktop||e?.info?.mobile),p=[`available`,`downloading`,`downloaded`].includes(d.state),m=e?.shellInstaller?.status,h=m?.state===`downloaded`&&!!m.availableVersion;if(!p&&!h)return null;let g=!p&&h,_=p&&d.state===`downloading`,v=p&&d.state===`downloaded`,y=u(g?`navigation:appSidebar.installerReady`:v?`navigation:appSidebar.readyToRestart`:_?`navigation:appSidebar.downloading`:f?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),b=g?`v${m.availableVersion}`:_?`${Math.round(d.percent||0)}%`:f&&d.availableVersion?`v${d.availableVersion}`:d.behindBy?u(`navigation:appSidebar.countCommitsBehindBranch`,{branch:d.branch||`main`,count:d.behindBy}):d.availableCommit?d.availableCommit.slice(0,7):u(`navigation:appSidebar.viewUpdateDetails`),x=g?i:v?o:_?a:f?n:r;return(0,s.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-sm border border-star-border bg-star-soft text-content transition-colors duration-[var(--d-fast)] hover:bg-surface-hover ${c?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${y} · ${b}`,"aria-label":`${y} · ${b}`,onClick:l,children:[(0,s.jsx)(x,{className:`shrink-0 text-accent-fg ${_?`animate-spin`:``}`,size:16}),!c&&(0,s.jsxs)(`span`,{className:`min-w-0`,children:[(0,s.jsx)(`strong`,{className:`block truncate text-xs font-medium`,children:y}),(0,s.jsx)(`small`,{className:`mt-0.5 block truncate text-xs text-content-muted tabular-nums`,children:b})]})]})}export{c as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BqDnJFL5.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./package-check-C5B-7aXn.js";import{t as a}from"./refresh-cw-TbWxTY4K.js";import{t as o}from"./rocket-BgLSjoHY.js";var s=e();function c({update:e,collapsed:c,onOpen:l}){let{t:u}=t(),d=e?.status||{state:`idle`},f=!!(e?.info?.desktop||e?.info?.mobile),p=[`available`,`downloading`,`downloaded`].includes(d.state),m=e?.shellInstaller?.status,h=m?.state===`downloaded`&&!!m.availableVersion;if(!p&&!h)return null;let g=!p&&h,_=p&&d.state===`downloading`,v=p&&d.state===`downloaded`,y=u(g?`navigation:appSidebar.installerReady`:v?`navigation:appSidebar.readyToRestart`:_?`navigation:appSidebar.downloading`:f?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),b=g?`v${m.availableVersion}`:_?`${Math.round(d.percent||0)}%`:f&&d.availableVersion?`v${d.availableVersion}`:d.behindBy?u(`navigation:appSidebar.countCommitsBehindBranch`,{branch:d.branch||`main`,count:d.behindBy}):d.availableCommit?d.availableCommit.slice(0,7):u(`navigation:appSidebar.viewUpdateDetails`),x=g?i:v?o:_?a:f?n:r;return(0,s.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-sm border border-star-border bg-star-soft text-content transition-colors duration-[var(--d-fast)] hover:bg-surface-hover ${c?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${y} · ${b}`,"aria-label":`${y} · ${b}`,onClick:l,children:[(0,s.jsx)(x,{className:`shrink-0 text-accent-fg ${_?`animate-spin`:``}`,size:16}),!c&&(0,s.jsxs)(`span`,{className:`min-w-0`,children:[(0,s.jsx)(`strong`,{className:`block truncate text-xs font-medium`,children:y}),(0,s.jsx)(`small`,{className:`mt-0.5 block truncate text-xs text-content-muted tabular-nums`,children:b})]})]})}export{c as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./api-BA-WPJCg.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./package-BOmkLaKS.js";import{t as c}from"./plus-fQbSqB1n.js";import{t as l}from"./save-CHBB52P8.js";import{t as u}from"./sparkles-S_eeuqn9.js";import{t as d}from"./trash-2-CNrPOoPR.js";import{t as f}from"./wrench-6pg6_bqI.js";import{t as p}from"./more-pages-D_PnxLN0.js";import{t as ee}from"./checkbox-BrEHgFV0.js";import{t as m}from"./button-CCcCN8tE.js";import{s as h}from"./shortcuts-Cth0vc77.js";import{n as g,t as _}from"./PageState-Cz6vFMXv.js";import{a as v,i as y,n as b,o as x,r as S,s as te,t as ne}from"./FeaturePage-DT8W4UlT.js";import{c as C,s as w}from"./app-primitives-BskZ4ZJj.js";var T=e(t(),1),E=n(),D=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`],O=`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 k(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function A(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function j(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?s:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?f:u}function re(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function M({notify:e,activeSessionId:t=``,onBack:n,requestText:a,requestConfirm:o}){let{t:u}=r(),f=h(`focusSearch`),[M,ie]=(0,T.useState)(``),[N,P]=(0,T.useState)(null),[F,I]=(0,T.useState)(``),[L,R]=(0,T.useState)(`all`),[z,B]=(0,T.useState)(!1),[V,H]=(0,T.useState)(!0),[U,W]=(0,T.useState)(``),G=(0,T.useCallback)(async()=>{W(``);try{let e=await i(k(`/api/skills`,t));return P(e),I(t=>e.skills.some(e=>e.id===t)?t:``),e}catch(e){return W(e instanceof Error?e.message:String(e)),null}finally{H(!1)}},[t]);(0,T.useEffect)(()=>{G()},[G]);let K=(0,T.useCallback)(async()=>{let n=await a?.({title:u(`skills:skillsPage.importGlobalSkill`),message:u(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:u(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:u(`skills:skillsPage.continue`)});if(n?.trim()&&await o?.({title:u(`skills:skillsPage.importGlobalSkill`),message:u(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:u(`skills:skillsPage.import`),tone:`danger`})!==!1){B(!0),W(``);try{let r=await i(k(`/api/skills/install`,t),{method:`POST`,body:JSON.stringify({source:n})});P(r),I(r.installed?.[0]?.id||``),e(u(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);W(n),e(n,`error`)}finally{B(!1)}}},[t,e,o,a,u]),q=N?.skills||[],J=M.trim().toLowerCase(),Y=q.filter(e=>re(e,L)&&`${e.name} ${e.description}`.toLowerCase().includes(J)),ae=q.filter(e=>e.sourceInfo?.scope!==`project`),oe=q.filter(e=>e.sourceInfo?.scope===`project`),se=Y.filter(e=>e.sourceInfo?.scope!==`project`),ce=Y.filter(e=>e.sourceInfo?.scope===`project`),X=(N?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?u(`skills:skillsPage.projectScopedConfiguration`):u(`skills:skillsPage.userScopedConfiguration`),status:e.installed?u(`skills:skillsPage.locallyReady`):u(`skills:skillsPage.notMaterialized`)})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(J)),Z=async(e,n)=>{if(e){B(!0),W(``);try{let r=await i(k(`/api/skills/${encodeURIComponent(e.id)}`,t),{method:`PATCH`,body:JSON.stringify(n)});P(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(!1)}}},le=async()=>{B(!0),W(``);try{P(await i(k(`/api/skills/reload`,t),{method:`POST`,body:`{}`})),e(u(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(!1)}},ue=async n=>{if(n.removable&&await o?.({title:u(`skills:skillsPage.uninstallSkill`),message:u(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:u(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){B(!0),W(``);try{await i(k(`/api/skills/${encodeURIComponent(n.id)}`,t),{method:`DELETE`}),await G(),I(``),e(u(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);W(n),e(n,`error`)}finally{B(!1)}}},de=e=>(0,E.jsxs)(`div`,{className:`skill-detail grid gap-3`,children:[(0,E.jsx)(`p`,{className:`text-sm leading-relaxed whitespace-pre-line text-content-soft`,children:e.description||u(`skills:skillsPage.addGlobalOrProjectSkill`)}),(0,E.jsx)(`dl`,{className:O,children:[[u(`skills:skillsPage.triggerMode`),e.modelInvocationEnabled?u(`skills:skillsPage.automaticManual`):u(`skills:skillsPage.manualOnly`),!1],[u(`skills:skillsPage.permissions`),e.allowedTools?.length?e.allowedTools.join(`, `):u(`skills:skillsPage.usesChatToolPermissions`),!!e.allowedTools?.length],[u(`skills:skillsPage.scope`),e.sourceInfo?.scope===`project`?u(`skills:skillsPage.project`):u(`skills:skillsPage.global`),!1],[u(`skills:skillsPage.version`),e.version||`latest`,!0],[u(`skills:skillsPage.source`),e.source||`—`,!0]].map(([e,t,n])=>(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{children:e}),(0,E.jsx)(`dd`,{className:n?`font-mono`:void 0,children:t})]},e))}),(0,E.jsxs)(`fieldset`,{className:`grid min-w-0 gap-0.5`,children:[(0,E.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-content-muted`,children:u(`skills:skillsPage.triggerConditions`)}),[[u(`skills:skillsPage.allowAutomaticModelInvocation`),!!e.modelInvocationEnabled,!1,t=>void Z(e,{modelInvocationEnabled:t})],[u(`skills:skillsPage.supportManualSkillCommand`),!!e.command,!0],[u(`skills:skillsPage.projectScopedSkill`),e.sourceInfo?.scope===`project`,!0],[u(`skills:skillsPage.declaresRequiredTools`),!!e.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,E.jsxs)(`label`,{className:`check-row flex min-h-8 items-center gap-2.5 text-sm text-content has-disabled:text-content-muted max-[650px]:min-h-11`,children:[(0,E.jsx)(ee,{checked:t,disabled:z||n,onCheckedChange:e=>r?.(e===!0)}),(0,E.jsx)(`span`,{children:e})]},e))]}),(0,E.jsx)(`div`,{className:`flex justify-end`,children:e.removable?(0,E.jsxs)(m,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:z,onClick:()=>void ue(e),children:[(0,E.jsx)(d,{}),u(`skills:skillsPage.uninstallSkill`)]}):(0,E.jsxs)(m,{variant:`secondary`,className:`max-[650px]:h-11`,loading:z,disabled:z,onClick:le,children:[(0,E.jsx)(l,{}),u(`skills:skillsPage.saveSettings`)]})})]}),Q=(e,t,n,r,i=``)=>(0,E.jsx)(x,{className:`skill-scope`,title:e,count:t.length,description:i&&(0,E.jsx)(`span`,{className:`font-mono`,children:i}),children:t.length?(0,E.jsx)(b,{children:t.map(e=>{let t=j(e);return(0,E.jsx)(y,{className:`skill-row`,"data-skill-row":e.id,icon:(0,E.jsx)(t,{}),name:(0,E.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,actions:(0,E.jsx)(w,{value:e.enabled,disabled:z,ariaLabel:u(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void Z(e,{enabled:t})}),expanded:F===e.id,onExpandedChange:t=>I(t?e.id:``),toggleLabel:u(`skills:skillsPage.toggleSkillDetails`,{name:e.name}),detail:de(e)},e.id)})}):(0,E.jsx)(`p`,{className:`skills-empty-copy border-t border-stroke py-3 text-xs leading-normal text-content-muted`,children:n.length?u(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})}),$=u(`navigation:navigation.skills`);return(0,E.jsx)(S,{title:$,description:u(`skills:skillsPage.lede`),back:n&&{label:u(`navigation:sidebar.features`),ariaLabel:u(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,E.jsx)(te,{search:(0,E.jsx)(v,{id:p,value:M,onValueChange:ie,placeholder:u(`navigation:pageHeader.searchPage`,{page:$}),shortcut:f,clearLabel:u(`navigation:more.clearSearch`)}),actions:(0,E.jsxs)(m,{type:`button`,className:`h-9`,"data-skills-install":!0,disabled:z||!N,onClick:()=>void K(),children:[(0,E.jsx)(c,{}),u(`navigation:pageHeader.installSkill`)]}),filters:(0,E.jsx)(C,{options:D.map(e=>A(e,u)),value:A(L,u),onChange:e=>R(D.find(t=>A(t,u)===e)||`all`)})}),children:V&&!N?(0,E.jsx)(g,{kind:`loading`,title:u(`skills:skillsPage.loadingSkills`),description:u(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)}):N?(0,E.jsxs)(E.Fragment,{children:[U&&(0,E.jsx)(ne,{children:U}),L!==`project`&&Q(u(`skills:skillsPage.globalSkills`),se,ae,u(`skills:skillsPage.noGlobalSkills`),N.locations?.global||`~/.pisper/agent/skills`),L!==`global`&&Q(u(`skills:skillsPage.projectSkills`),ce,oe,u(`skills:skillsPage.noProjectSkills`),N.locations?.project||(N.cwd?`${N.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``)),(0,E.jsx)(x,{className:`skill-packages`,title:u(`skills:skillsPage.configuredSkillPackages`),count:X.length,children:X.length?(0,E.jsx)(b,{children:X.map(e=>(0,E.jsx)(y,{className:`market-row`,icon:(0,E.jsx)(s,{}),name:(0,E.jsx)(`span`,{className:`font-mono`,title:e.source,children:e.source}),description:e.description,status:e.status},e.source))}):(0,E.jsx)(_,{compact:!0,icon:s,title:u(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})})]}):(0,E.jsx)(g,{kind:`error`,title:u(`skills:skillsPage.loadFailed`),description:U,action:(0,E.jsx)(m,{variant:`secondary`,className:`max-[650px]:h-11`,loading:V,disabled:V,onClick:()=>{H(!0),G()},children:u(`common:pageTemplate.retry`)})})})}export{M as SkillsPage};
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-BqDnJFL5.js";import{t as i}from"./api-BbBnrW3n.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./package-BOmkLaKS.js";import{t as c}from"./plus-fQbSqB1n.js";import{t as l}from"./save-CHBB52P8.js";import{t as u}from"./sparkles-S_eeuqn9.js";import{t as d}from"./trash-2-CNrPOoPR.js";import{t as f}from"./wrench-6pg6_bqI.js";import{t as p}from"./more-pages-D_PnxLN0.js";import{t as ee}from"./checkbox-BrEHgFV0.js";import{t as m}from"./button-CCcCN8tE.js";import{s as h}from"./shortcuts-DsFEMyT1.js";import{n as g,t as _}from"./PageState-Cz6vFMXv.js";import{a as v,i as y,n as b,o as x,r as S,s as te,t as ne}from"./FeaturePage-xE563vuG.js";import{c as C,s as w}from"./app-primitives-BskZ4ZJj.js";var T=e(t(),1),E=n(),D=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`],O=`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 k(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function A(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function j(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?s:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?f:u}function re(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function M({notify:e,activeSessionId:t=``,onBack:n,requestText:a,requestConfirm:o}){let{t:u}=r(),f=h(`focusSearch`),[M,ie]=(0,T.useState)(``),[N,P]=(0,T.useState)(null),[F,I]=(0,T.useState)(``),[L,R]=(0,T.useState)(`all`),[z,B]=(0,T.useState)(!1),[V,H]=(0,T.useState)(!0),[U,W]=(0,T.useState)(``),G=(0,T.useCallback)(async()=>{W(``);try{let e=await i(k(`/api/skills`,t));return P(e),I(t=>e.skills.some(e=>e.id===t)?t:``),e}catch(e){return W(e instanceof Error?e.message:String(e)),null}finally{H(!1)}},[t]);(0,T.useEffect)(()=>{G()},[G]);let K=(0,T.useCallback)(async()=>{let n=await a?.({title:u(`skills:skillsPage.importGlobalSkill`),message:u(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:u(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:u(`skills:skillsPage.continue`)});if(n?.trim()&&await o?.({title:u(`skills:skillsPage.importGlobalSkill`),message:u(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:u(`skills:skillsPage.import`),tone:`danger`})!==!1){B(!0),W(``);try{let r=await i(k(`/api/skills/install`,t),{method:`POST`,body:JSON.stringify({source:n})});P(r),I(r.installed?.[0]?.id||``),e(u(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);W(n),e(n,`error`)}finally{B(!1)}}},[t,e,o,a,u]),q=N?.skills||[],J=M.trim().toLowerCase(),Y=q.filter(e=>re(e,L)&&`${e.name} ${e.description}`.toLowerCase().includes(J)),ae=q.filter(e=>e.sourceInfo?.scope!==`project`),oe=q.filter(e=>e.sourceInfo?.scope===`project`),se=Y.filter(e=>e.sourceInfo?.scope!==`project`),ce=Y.filter(e=>e.sourceInfo?.scope===`project`),X=(N?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?u(`skills:skillsPage.projectScopedConfiguration`):u(`skills:skillsPage.userScopedConfiguration`),status:e.installed?u(`skills:skillsPage.locallyReady`):u(`skills:skillsPage.notMaterialized`)})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(J)),Z=async(e,n)=>{if(e){B(!0),W(``);try{let r=await i(k(`/api/skills/${encodeURIComponent(e.id)}`,t),{method:`PATCH`,body:JSON.stringify(n)});P(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(!1)}}},le=async()=>{B(!0),W(``);try{P(await i(k(`/api/skills/reload`,t),{method:`POST`,body:`{}`})),e(u(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(!1)}},ue=async n=>{if(n.removable&&await o?.({title:u(`skills:skillsPage.uninstallSkill`),message:u(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:u(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){B(!0),W(``);try{await i(k(`/api/skills/${encodeURIComponent(n.id)}`,t),{method:`DELETE`}),await G(),I(``),e(u(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);W(n),e(n,`error`)}finally{B(!1)}}},de=e=>(0,E.jsxs)(`div`,{className:`skill-detail grid gap-3`,children:[(0,E.jsx)(`p`,{className:`text-sm leading-relaxed whitespace-pre-line text-content-soft`,children:e.description||u(`skills:skillsPage.addGlobalOrProjectSkill`)}),(0,E.jsx)(`dl`,{className:O,children:[[u(`skills:skillsPage.triggerMode`),e.modelInvocationEnabled?u(`skills:skillsPage.automaticManual`):u(`skills:skillsPage.manualOnly`),!1],[u(`skills:skillsPage.permissions`),e.allowedTools?.length?e.allowedTools.join(`, `):u(`skills:skillsPage.usesChatToolPermissions`),!!e.allowedTools?.length],[u(`skills:skillsPage.scope`),e.sourceInfo?.scope===`project`?u(`skills:skillsPage.project`):u(`skills:skillsPage.global`),!1],[u(`skills:skillsPage.version`),e.version||`latest`,!0],[u(`skills:skillsPage.source`),e.source||`—`,!0]].map(([e,t,n])=>(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{children:e}),(0,E.jsx)(`dd`,{className:n?`font-mono`:void 0,children:t})]},e))}),(0,E.jsxs)(`fieldset`,{className:`grid min-w-0 gap-0.5`,children:[(0,E.jsx)(`legend`,{className:`mb-1 text-xs font-medium text-content-muted`,children:u(`skills:skillsPage.triggerConditions`)}),[[u(`skills:skillsPage.allowAutomaticModelInvocation`),!!e.modelInvocationEnabled,!1,t=>void Z(e,{modelInvocationEnabled:t})],[u(`skills:skillsPage.supportManualSkillCommand`),!!e.command,!0],[u(`skills:skillsPage.projectScopedSkill`),e.sourceInfo?.scope===`project`,!0],[u(`skills:skillsPage.declaresRequiredTools`),!!e.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,E.jsxs)(`label`,{className:`check-row flex min-h-8 items-center gap-2.5 text-sm text-content has-disabled:text-content-muted max-[650px]:min-h-11`,children:[(0,E.jsx)(ee,{checked:t,disabled:z||n,onCheckedChange:e=>r?.(e===!0)}),(0,E.jsx)(`span`,{children:e})]},e))]}),(0,E.jsx)(`div`,{className:`flex justify-end`,children:e.removable?(0,E.jsxs)(m,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:z,onClick:()=>void ue(e),children:[(0,E.jsx)(d,{}),u(`skills:skillsPage.uninstallSkill`)]}):(0,E.jsxs)(m,{variant:`secondary`,className:`max-[650px]:h-11`,loading:z,disabled:z,onClick:le,children:[(0,E.jsx)(l,{}),u(`skills:skillsPage.saveSettings`)]})})]}),Q=(e,t,n,r,i=``)=>(0,E.jsx)(x,{className:`skill-scope`,title:e,count:t.length,description:i&&(0,E.jsx)(`span`,{className:`font-mono`,children:i}),children:t.length?(0,E.jsx)(b,{children:t.map(e=>{let t=j(e);return(0,E.jsx)(y,{className:`skill-row`,"data-skill-row":e.id,icon:(0,E.jsx)(t,{}),name:(0,E.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,actions:(0,E.jsx)(w,{value:e.enabled,disabled:z,ariaLabel:u(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void Z(e,{enabled:t})}),expanded:F===e.id,onExpandedChange:t=>I(t?e.id:``),toggleLabel:u(`skills:skillsPage.toggleSkillDetails`,{name:e.name}),detail:de(e)},e.id)})}):(0,E.jsx)(`p`,{className:`skills-empty-copy border-t border-stroke py-3 text-xs leading-normal text-content-muted`,children:n.length?u(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})}),$=u(`navigation:navigation.skills`);return(0,E.jsx)(S,{title:$,description:u(`skills:skillsPage.lede`),back:n&&{label:u(`navigation:sidebar.features`),ariaLabel:u(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,E.jsx)(te,{search:(0,E.jsx)(v,{id:p,value:M,onValueChange:ie,placeholder:u(`navigation:pageHeader.searchPage`,{page:$}),shortcut:f,clearLabel:u(`navigation:more.clearSearch`)}),actions:(0,E.jsxs)(m,{type:`button`,className:`h-9`,"data-skills-install":!0,disabled:z||!N,onClick:()=>void K(),children:[(0,E.jsx)(c,{}),u(`navigation:pageHeader.installSkill`)]}),filters:(0,E.jsx)(C,{options:D.map(e=>A(e,u)),value:A(L,u),onChange:e=>R(D.find(t=>A(t,u)===e)||`all`)})}),children:V&&!N?(0,E.jsx)(g,{kind:`loading`,title:u(`skills:skillsPage.loadingSkills`),description:u(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)}):N?(0,E.jsxs)(E.Fragment,{children:[U&&(0,E.jsx)(ne,{children:U}),L!==`project`&&Q(u(`skills:skillsPage.globalSkills`),se,ae,u(`skills:skillsPage.noGlobalSkills`),N.locations?.global||`~/.pisper/agent/skills`),L!==`global`&&Q(u(`skills:skillsPage.projectSkills`),ce,oe,u(`skills:skillsPage.noProjectSkills`),N.locations?.project||(N.cwd?`${N.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``)),(0,E.jsx)(x,{className:`skill-packages`,title:u(`skills:skillsPage.configuredSkillPackages`),count:X.length,children:X.length?(0,E.jsx)(b,{children:X.map(e=>(0,E.jsx)(y,{className:`market-row`,icon:(0,E.jsx)(s,{}),name:(0,E.jsx)(`span`,{className:`font-mono`,title:e.source,children:e.source}),description:e.description,status:e.status},e.source))}):(0,E.jsx)(_,{compact:!0,icon:s,title:u(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})})]}):(0,E.jsx)(g,{kind:`error`,title:u(`skills:skillsPage.loadFailed`),description:U,action:(0,E.jsx)(m,{variant:`secondary`,className:`max-[650px]:h-11`,loading:V,disabled:V,onClick:()=>{H(!0),G()},children:u(`common:pageTemplate.retry`)})})})}export{M as SkillsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./chevron-right-C3t2Rckj.js";import{t as a}from"./square-terminal-BVG6cUT1.js";import{t as o}from"./square-bHHVTT3G.js";import{t as s}from"./checkbox-BrEHgFV0.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{n as u}from"./PageState-Cz6vFMXv.js";import{t as d}from"./AppSelect-B15Hpk2W.js";import{n as f,r as p}from"./terminal-context-aIsIJPn8.js";var m=e(t(),1),h=n();function g({record:e,follow:t,initialTop:n,onFollow:i,onScroll:a}){let{t:o}=r(),c=(0,m.useRef)(null),l=(0,m.useRef)(n);return(0,m.useLayoutEffect)(()=>{c.current&&(c.current.scrollTop=l.current)},[]),(0,m.useLayoutEffect)(()=>{t&&c.current&&(c.current.scrollTop=c.current.scrollHeight)},[e.output,t]),(0,h.jsxs)(`div`,{className:`border-t border-stroke-soft bg-code px-3 py-2.5`,children:[(0,h.jsxs)(`label`,{className:`mb-2 flex min-h-6 cursor-pointer items-center gap-2 text-xs text-content-muted pointer-coarse:min-h-11`,children:[(0,h.jsx)(s,{checked:t,onCheckedChange:e=>i(e===!0)}),o(`terminal:workspace.follow`)]}),e.truncated&&(0,h.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:o(`terminal:workspace.truncated`)}),(0,h.jsx)(`pre`,{ref:c,tabIndex:0,onWheel:e=>{e.deltaY<0&&i(!1)},onScroll:e=>{let t=e.currentTarget;t.scrollTop+t.clientHeight<t.scrollHeight-4&&i(!1),a(t.scrollTop)},className:`max-h-80 overflow-auto whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-content-soft focus-visible:-outline-offset-2`,children:e.output||o(`terminal:workspace.noOutput`)})]})}function _({sessionId:e,onOpenTerminal:t,view:n,onViewChange:s}){let{t:_}=r(),v=f(),y=p(e),b=n.filter||`all`,x=new Set(n.expandedProcesses),[S,C]=(0,m.useState)(``);if(!v)return(0,h.jsx)(u,{kind:`empty`,title:_(`terminal:workspace.unavailable`),description:_(`terminal:workspace.nativeOnly`)});let w={starting:_(`terminal:workspace.starting`),running:_(`terminal:workspace.running`),stopping:_(`terminal:workspace.stopping`),exited:_(`terminal:workspace.exited`),error:_(`terminal:workspace.error`)},T=y.filter(e=>b===`all`||e.status===b),E=`max-[650px]:size-11`;return(0,h.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,children:[(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1 text-xs text-content-muted`,children:_(`terminal:workspace.ownedProcesses`)}),(0,h.jsxs)(d,{"aria-label":_(`terminal:workspace.filter`),value:b,onChange:e=>s({filter:e.target.value}),className:`w-auto`,children:[(0,h.jsx)(`option`,{value:`all`,children:_(`terminal:workspace.all`)}),Object.entries(w).map(([e,t])=>(0,h.jsx)(`option`,{value:e,children:t},e))]})]}),S&&(0,h.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:S}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:T.length?T.map(e=>(0,h.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-11 min-w-0 items-center gap-2 py-1 pr-1.5 pl-1.5 ${x.has(e.id)?`bg-surface-subtle`:``}`,children:[(0,h.jsx)(l,{variant:`ghost`,size:`icon`,className:E,"aria-expanded":x.has(e.id),"aria-label":_(`terminal:workspace.logs`),onClick:()=>s({expandedProcesses:x.has(e.id)?n.expandedProcesses.filter(t=>t!==e.id):[...n.expandedProcesses,e.id]}),children:(0,h.jsx)(i,{className:`text-content-muted transition-transform duration-(--d-fast) ${x.has(e.id)?`rotate-90`:``}`})}),e.status===`running`||e.status===`starting`?(0,h.jsx)(c,{className:`size-3.5`}):(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-[2px] ${e.status===`error`?`bg-danger`:`bg-content-faint`}`}),(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`strong`,{className:`block truncate font-mono text-sm font-medium`,children:e.profileId}),(0,h.jsx)(`span`,{className:`block truncate font-mono text-xs text-content-muted`,title:e.cwd,children:e.cwd})]}),(0,h.jsx)(`span`,{className:`shrink-0 text-xs ${e.status===`error`?`text-danger`:`text-content-muted`}`,children:w[e.status]||_(`terminal:workspace.unknown`)}),(0,h.jsx)(l,{variant:`ghost`,size:`icon`,className:E,"aria-label":_(`terminal:workspace.open`),onClick:()=>t(e.id),children:(0,h.jsx)(a,{})}),e.status!==`exited`&&(0,h.jsx)(l,{variant:`ghost`,size:`icon`,className:`${E} hover:text-danger`,disabled:e.status===`stopping`,"aria-label":_(`terminal:workspace.stop`),onClick:()=>{C(``),v.registry.stop(e.id).catch(e=>C(String(e)))},children:(0,h.jsx)(o,{className:`size-3.5`})})]}),e.error&&(0,h.jsx)(`p`,{className:`px-3 pb-2 text-xs text-danger`,children:e.error}),x.has(e.id)&&(0,h.jsx)(g,{record:e,follow:n.processFollow[e.id]!==!1,initialTop:n.processScroll[e.id]||0,onFollow:t=>s({processFollow:{...n.processFollow,[e.id]:t}}),onScroll:t=>s({processScroll:{...n.processScroll,[e.id]:t}})})]},e.id)):(0,h.jsx)(u,{kind:`empty`,title:y.length?_(`terminal:workspace.noMatch`):_(`terminal:workspace.noProcesses`)})})]})}export{_ as TaskProcessesPane};
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-BqDnJFL5.js";import{t as i}from"./chevron-right-C3t2Rckj.js";import{t as a}from"./square-terminal-BVG6cUT1.js";import{t as o}from"./square-bHHVTT3G.js";import{t as s}from"./checkbox-BrEHgFV0.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{n as u}from"./PageState-Cz6vFMXv.js";import{t as d}from"./AppSelect-B15Hpk2W.js";import{n as f,r as p}from"./terminal-context-aIsIJPn8.js";var m=e(t(),1),h=n();function g({record:e,follow:t,initialTop:n,onFollow:i,onScroll:a}){let{t:o}=r(),c=(0,m.useRef)(null),l=(0,m.useRef)(n);return(0,m.useLayoutEffect)(()=>{c.current&&(c.current.scrollTop=l.current)},[]),(0,m.useLayoutEffect)(()=>{t&&c.current&&(c.current.scrollTop=c.current.scrollHeight)},[e.output,t]),(0,h.jsxs)(`div`,{className:`border-t border-stroke-soft bg-code px-3 py-2.5`,children:[(0,h.jsxs)(`label`,{className:`mb-2 flex min-h-6 cursor-pointer items-center gap-2 text-xs text-content-muted pointer-coarse:min-h-11`,children:[(0,h.jsx)(s,{checked:t,onCheckedChange:e=>i(e===!0)}),o(`terminal:workspace.follow`)]}),e.truncated&&(0,h.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:o(`terminal:workspace.truncated`)}),(0,h.jsx)(`pre`,{ref:c,tabIndex:0,onWheel:e=>{e.deltaY<0&&i(!1)},onScroll:e=>{let t=e.currentTarget;t.scrollTop+t.clientHeight<t.scrollHeight-4&&i(!1),a(t.scrollTop)},className:`max-h-80 overflow-auto whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-content-soft focus-visible:-outline-offset-2`,children:e.output||o(`terminal:workspace.noOutput`)})]})}function _({sessionId:e,onOpenTerminal:t,view:n,onViewChange:s}){let{t:_}=r(),v=f(),y=p(e),b=n.filter||`all`,x=new Set(n.expandedProcesses),[S,C]=(0,m.useState)(``);if(!v)return(0,h.jsx)(u,{kind:`empty`,title:_(`terminal:workspace.unavailable`),description:_(`terminal:workspace.nativeOnly`)});let w={starting:_(`terminal:workspace.starting`),running:_(`terminal:workspace.running`),stopping:_(`terminal:workspace.stopping`),exited:_(`terminal:workspace.exited`),error:_(`terminal:workspace.error`)},T=y.filter(e=>b===`all`||e.status===b),E=`max-[650px]:size-11`;return(0,h.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,children:[(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1 text-xs text-content-muted`,children:_(`terminal:workspace.ownedProcesses`)}),(0,h.jsxs)(d,{"aria-label":_(`terminal:workspace.filter`),value:b,onChange:e=>s({filter:e.target.value}),className:`w-auto`,children:[(0,h.jsx)(`option`,{value:`all`,children:_(`terminal:workspace.all`)}),Object.entries(w).map(([e,t])=>(0,h.jsx)(`option`,{value:e,children:t},e))]})]}),S&&(0,h.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:S}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:T.length?T.map(e=>(0,h.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,h.jsxs)(`div`,{className:`flex min-h-11 min-w-0 items-center gap-2 py-1 pr-1.5 pl-1.5 ${x.has(e.id)?`bg-surface-subtle`:``}`,children:[(0,h.jsx)(l,{variant:`ghost`,size:`icon`,className:E,"aria-expanded":x.has(e.id),"aria-label":_(`terminal:workspace.logs`),onClick:()=>s({expandedProcesses:x.has(e.id)?n.expandedProcesses.filter(t=>t!==e.id):[...n.expandedProcesses,e.id]}),children:(0,h.jsx)(i,{className:`text-content-muted transition-transform duration-(--d-fast) ${x.has(e.id)?`rotate-90`:``}`})}),e.status===`running`||e.status===`starting`?(0,h.jsx)(c,{className:`size-3.5`}):(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-[2px] ${e.status===`error`?`bg-danger`:`bg-content-faint`}`}),(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`strong`,{className:`block truncate font-mono text-sm font-medium`,children:e.profileId}),(0,h.jsx)(`span`,{className:`block truncate font-mono text-xs text-content-muted`,title:e.cwd,children:e.cwd})]}),(0,h.jsx)(`span`,{className:`shrink-0 text-xs ${e.status===`error`?`text-danger`:`text-content-muted`}`,children:w[e.status]||_(`terminal:workspace.unknown`)}),(0,h.jsx)(l,{variant:`ghost`,size:`icon`,className:E,"aria-label":_(`terminal:workspace.open`),onClick:()=>t(e.id),children:(0,h.jsx)(a,{})}),e.status!==`exited`&&(0,h.jsx)(l,{variant:`ghost`,size:`icon`,className:`${E} hover:text-danger`,disabled:e.status===`stopping`,"aria-label":_(`terminal:workspace.stop`),onClick:()=>{C(``),v.registry.stop(e.id).catch(e=>C(String(e)))},children:(0,h.jsx)(o,{className:`size-3.5`})})]}),e.error&&(0,h.jsx)(`p`,{className:`px-3 pb-2 text-xs text-danger`,children:e.error}),x.has(e.id)&&(0,h.jsx)(g,{record:e,follow:n.processFollow[e.id]!==!1,initialTop:n.processScroll[e.id]||0,onFollow:t=>s({processFollow:{...n.processFollow,[e.id]:t}}),onScroll:t=>s({processScroll:{...n.processScroll,[e.id]:t}})})]},e.id)):(0,h.jsx)(u,{kind:`empty`,title:y.length?_(`terminal:workspace.noMatch`):_(`terminal:workspace.noProcesses`)})})]})}export{_ as TaskProcessesPane};
@@ -1,4 +1,4 @@
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-DL1_y_Ge.js";import{t as i}from"./square-terminal-BVG6cUT1.js";import{t as a}from"./square-bHHVTT3G.js";import{n as o,t as s}from"./button-CCcCN8tE.js";import{n as c}from"./PageState-Cz6vFMXv.js";import{t as l}from"./AppSelect-B15Hpk2W.js";import{n as u,r as d}from"./terminal-context-aIsIJPn8.js";var f=e(t(),1),p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{for(var i=r>1?void 0:r?m(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&p(t,n,i),i},_=(e,t)=>(n,r)=>t(n,r,e),ee=`Terminal input`,te={get:()=>ee,set:e=>ee=e},ne=`Too much output to announce, navigate to rows manually to read`,re={get:()=>ne,set:e=>ne=e};function ie(e){return e.replace(/\r?\n/g,`\r`)}function ae(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function oe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function se(e,t,n,r){e.stopPropagation(),e.clipboardData&&ce(e.clipboardData.getData(`text/plain`),t,n,r)}function ce(e,t,n,r){e=ie(e),e=ae(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function v(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function le(e,t,n,r,i){v(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function y(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ue(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var de=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},fe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},b=``,pe=` `,me=class e{constructor(){this.fg=0,this.bg=0,this.extended=new he}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},he=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},x=class e extends me{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new he,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?y(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ge=`di$target`,_e=`di$dependencies`,ve=new Map;function S(e){return e[_e]||[]}function C(e){if(ve.has(e))return ve.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);ye(t,e,r)};return t._id=e,ve.set(e,t),t}function ye(e,t,n){t[ge]===t?t[_e].push({id:e,index:n}):(t[_e]=[{id:e,index:n}],t[ge]=t)}var w=C(`BufferService`),be=C(`CoreMouseService`),T=C(`CoreService`),xe=C(`CharsetService`),Se=C(`InstantiationService`),Ce=C(`LogService`),E=C(`OptionsService`),we=C(`OscLinkService`),Te=C(`UnicodeService`),Ee=C(`DecorationService`),De=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new x,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Oe(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};De=g([_(0,w),_(1,E),_(2,we)],De);function Oe(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BqDnJFL5.js";import{t as i}from"./square-terminal-BVG6cUT1.js";import{t as a}from"./square-bHHVTT3G.js";import{n as o,t as s}from"./button-CCcCN8tE.js";import{n as c}from"./PageState-Cz6vFMXv.js";import{t as l}from"./AppSelect-B15Hpk2W.js";import{n as u,r as d}from"./terminal-context-aIsIJPn8.js";var f=e(t(),1),p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},g=(e,t,n,r)=>{for(var i=r>1?void 0:r?m(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&p(t,n,i),i},_=(e,t)=>(n,r)=>t(n,r,e),ee=`Terminal input`,te={get:()=>ee,set:e=>ee=e},ne=`Too much output to announce, navigate to rows manually to read`,re={get:()=>ne,set:e=>ne=e};function ie(e){return e.replace(/\r?\n/g,`\r`)}function ae(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function oe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function se(e,t,n,r){e.stopPropagation(),e.clipboardData&&ce(e.clipboardData.getData(`text/plain`),t,n,r)}function ce(e,t,n,r){e=ie(e),e=ae(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function v(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function le(e,t,n,r,i){v(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function y(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ue(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var de=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},fe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},b=``,pe=` `,me=class e{constructor(){this.fg=0,this.bg=0,this.extended=new he}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},he=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},x=class e extends me{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new he,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?y(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ge=`di$target`,_e=`di$dependencies`,ve=new Map;function S(e){return e[_e]||[]}function C(e){if(ve.has(e))return ve.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);ye(t,e,r)};return t._id=e,ve.set(e,t),t}function ye(e,t,n){t[ge]===t?t[_e].push({id:e,index:n}):(t[_e]=[{id:e,index:n}],t[ge]=t)}var w=C(`BufferService`),be=C(`CoreMouseService`),T=C(`CoreService`),xe=C(`CharsetService`),Se=C(`InstantiationService`),Ce=C(`LogService`),E=C(`OptionsService`),we=C(`OscLinkService`),Te=C(`UnicodeService`),Ee=C(`DecorationService`),De=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new x,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Oe(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};De=g([_(0,w),_(1,E),_(2,we)],De);function Oe(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var ke=C(`CharSizeService`),Ae=C(`CoreBrowserService`),je=C(`MouseService`),Me=C(`RenderService`),Ne=C(`SelectionService`),Pe=C(`CharacterJoinerService`),Fe=C(`ThemeService`),Ie=C(`LinkProviderService`),Le=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ue.isErrorNoTelemetry(e)?new Ue(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-DL1_y_Ge.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./minus-BuutOHSj.js";import{t as o}from"./plus-fQbSqB1n.js";import{t as s}from"./square-terminal-BVG6cUT1.js";import{t as c}from"./x-07u4-129.js";import{t as l}from"./button-CCcCN8tE.js";import{n as u,r as d}from"./terminal-context-aIsIJPn8.js";import{TaskTerminalView as f}from"./TaskTerminalView-CVBvmwIN.js";var p=i(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),m=e(t(),1),h=n(),g=180,_=420;function v(e){return Math.max(g,Math.min(640,Math.floor(e*.62),e-_))}function y({open:e,height:t,labels:n,activeSessionId:i,resolveSessionCwd:_,onOpenChange:y,onHeightChange:b,layout:x=`dock`}){let{t:S}=r(),C=u(),w=d(),[T,E]=(0,m.useState)({}),[D,O]=(0,m.useState)(()=>new Set),[k,A]=(0,m.useState)({}),[j,M]=(0,m.useState)(``),N=(0,m.useRef)(()=>{}),P=w.filter(e=>(e.sessionId===i||e.orphaned)&&e.status!==`exited`&&!D.has(e.id)),F=P.find(e=>e.id===T[i])||P[0],I=k[i],L=async()=>{let e=i;y(!0),M(``);try{let t=await _(e);A(n=>({...n,[e]:{cwd:t,token:crypto.randomUUID()}}))}catch(e){M(String(e))}},R=e=>{O(t=>new Set([...t,e])),E(t=>({...t,[i]:P.find(t=>t.id!==e)?.id||``}))};(0,m.useEffect)(()=>{if(!e||x===`fill`)return;let n=()=>{let e=v(window.innerHeight);t>e&&b(e)};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[t,x,e,b]),(0,m.useEffect)(()=>()=>N.current(),[]);let z=e=>{N.current(),e.currentTarget.setPointerCapture(e.pointerId);let n=e.clientY,r=t,i=e=>b(Math.max(g,Math.min(v(window.innerHeight),r+n-e.clientY))),a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a)};N.current=a,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a,{once:!0}),window.addEventListener(`pointercancel`,a,{once:!0})};if(!C||!e)return null;let B=x===`fill`;return(0,h.jsxs)(`section`,{"aria-label":n.terminal,className:`terminal-panel relative z-3 flex flex-col bg-panel ${B?`h-full min-h-0 flex-1`:`shrink-0 border-t border-stroke`}`,style:B?void 0:{height:t},"data-swipe-ignore":B?!0:void 0,children:[!B&&(0,h.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,"aria-label":n.resizeTerminal,"aria-valuemin":g,"aria-valuemax":v(window.innerHeight),"aria-valuenow":t,onPointerDown:z,onKeyDown:e=>{[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),b(e.key===`Home`?g:e.key===`End`?v(window.innerHeight):Math.max(g,Math.min(v(window.innerHeight),t+(e.key===`ArrowUp`?20:-20)))))},className:`absolute inset-x-0 -top-1 z-10 h-2 cursor-ns-resize outline-none after:absolute after:top-1/2 after:left-1/2 after:h-[3px] after:w-9 after:-translate-1/2 after:rounded-full after:transition-colors after:duration-[var(--d-fast)] hover:after:bg-focus focus-visible:after:bg-focus focus-visible:after:ring-3 focus-visible:after:ring-focus-ring`}),(0,h.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[(0,h.jsx)(s,{className:`size-4 shrink-0 text-content-muted`}),(0,h.jsx)(`div`,{role:`tablist`,"aria-label":n.terminal,className:`flex min-w-0 flex-1 gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,children:P.map(e=>(0,h.jsxs)(`div`,{className:`flex min-w-0 max-w-52 shrink-0 items-center`,children:[(0,h.jsxs)(`button`,{role:`tab`,"aria-selected":!I&&F?.id===e.id,className:`relative h-7 min-w-0 truncate rounded-sm px-2 font-mono text-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:-outline-offset-2 aria-selected:bg-key aria-selected:font-medium aria-selected:text-content aria-selected:shadow-key aria-selected:ring-1 aria-selected:ring-key-border aria-selected:after:absolute aria-selected:after:inset-x-2 aria-selected:after:bottom-0 aria-selected:after:h-0.5 aria-selected:after:rounded-full aria-selected:after:bg-star`,title:`${e.cwd} · ${e.sessionId}`,onClick:()=>{E(t=>({...t,[i]:e.id})),A(e=>{let t={...e};return delete t[i],t})},children:[e.orphaned?`${n.orphanedTerminal} · `:``,e.profileId]}),(0,h.jsx)(l,{variant:`ghost`,size:`icon-xs`,"aria-label":S(`terminal:workspace.closeView`),title:S(`terminal:workspace.closeView`),onClick:()=>R(e.id),children:(0,h.jsx)(c,{className:`size-3`})})]},e.id))}),D.size>0&&(0,h.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>O(new Set),children:S(`terminal:workspace.restoreViews`)}),(0,h.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":n.newTerminal,title:n.newTerminal,onClick:()=>void L(),children:(0,h.jsx)(o,{className:`size-4`})}),!B&&(0,h.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":n.maximizeTerminal,title:n.maximizeTerminal,onClick:()=>b(v(window.innerHeight)),children:(0,h.jsx)(p,{className:`size-4`})}),(0,h.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":n.hideTerminal,title:n.hideTerminal,onClick:()=>y(!1),children:(0,h.jsx)(a,{className:`size-4`})})]}),j&&(0,h.jsx)(`p`,{role:`alert`,className:`p-2 text-xs text-danger`,children:j}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1`,children:I?(0,h.jsx)(f,{viewKey:`bottom`,sessionId:i,cwd:I.cwd,onCreated:e=>{E(t=>({...t,[i]:e})),A(e=>{if(e[i]?.token!==I.token)return e;let t={...e};return delete t[i],t})}},I.token):F?(0,h.jsx)(f,{viewKey:`bottom`,sessionId:F.sessionId,cwd:F.cwd,terminalId:F.id}):(0,h.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2`,children:[(0,h.jsx)(`p`,{className:`text-sm text-content-muted`,children:n.usesActiveSessionWorkspace}),(0,h.jsx)(l,{onClick:()=>void L(),children:n.openTerminal})]})})]})}export{y as TerminalPanel};
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-BqDnJFL5.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./minus-BuutOHSj.js";import{t as o}from"./plus-fQbSqB1n.js";import{t as s}from"./square-terminal-BVG6cUT1.js";import{t as c}from"./x-07u4-129.js";import{t as l}from"./button-CCcCN8tE.js";import{n as u,r as d}from"./terminal-context-aIsIJPn8.js";import{TaskTerminalView as f}from"./TaskTerminalView-CU-kjS_J.js";var p=i(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),m=e(t(),1),h=n(),g=180,_=420;function v(e){return Math.max(g,Math.min(640,Math.floor(e*.62),e-_))}function y({open:e,height:t,labels:n,activeSessionId:i,resolveSessionCwd:_,onOpenChange:y,onHeightChange:b,layout:x=`dock`}){let{t:S}=r(),C=u(),w=d(),[T,E]=(0,m.useState)({}),[D,O]=(0,m.useState)(()=>new Set),[k,A]=(0,m.useState)({}),[j,M]=(0,m.useState)(``),N=(0,m.useRef)(()=>{}),P=w.filter(e=>(e.sessionId===i||e.orphaned)&&e.status!==`exited`&&!D.has(e.id)),F=P.find(e=>e.id===T[i])||P[0],I=k[i],L=async()=>{let e=i;y(!0),M(``);try{let t=await _(e);A(n=>({...n,[e]:{cwd:t,token:crypto.randomUUID()}}))}catch(e){M(String(e))}},R=e=>{O(t=>new Set([...t,e])),E(t=>({...t,[i]:P.find(t=>t.id!==e)?.id||``}))};(0,m.useEffect)(()=>{if(!e||x===`fill`)return;let n=()=>{let e=v(window.innerHeight);t>e&&b(e)};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[t,x,e,b]),(0,m.useEffect)(()=>()=>N.current(),[]);let z=e=>{N.current(),e.currentTarget.setPointerCapture(e.pointerId);let n=e.clientY,r=t,i=e=>b(Math.max(g,Math.min(v(window.innerHeight),r+n-e.clientY))),a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a)};N.current=a,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a,{once:!0}),window.addEventListener(`pointercancel`,a,{once:!0})};if(!C||!e)return null;let B=x===`fill`;return(0,h.jsxs)(`section`,{"aria-label":n.terminal,className:`terminal-panel relative z-3 flex flex-col bg-panel ${B?`h-full min-h-0 flex-1`:`shrink-0 border-t border-stroke`}`,style:B?void 0:{height:t},"data-swipe-ignore":B?!0:void 0,children:[!B&&(0,h.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,"aria-label":n.resizeTerminal,"aria-valuemin":g,"aria-valuemax":v(window.innerHeight),"aria-valuenow":t,onPointerDown:z,onKeyDown:e=>{[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),b(e.key===`Home`?g:e.key===`End`?v(window.innerHeight):Math.max(g,Math.min(v(window.innerHeight),t+(e.key===`ArrowUp`?20:-20)))))},className:`absolute inset-x-0 -top-1 z-10 h-2 cursor-ns-resize outline-none after:absolute after:top-1/2 after:left-1/2 after:h-[3px] after:w-9 after:-translate-1/2 after:rounded-full after:transition-colors after:duration-[var(--d-fast)] hover:after:bg-focus focus-visible:after:bg-focus focus-visible:after:ring-3 focus-visible:after:ring-focus-ring`}),(0,h.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[(0,h.jsx)(s,{className:`size-4 shrink-0 text-content-muted`}),(0,h.jsx)(`div`,{role:`tablist`,"aria-label":n.terminal,className:`flex min-w-0 flex-1 gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,children:P.map(e=>(0,h.jsxs)(`div`,{className:`flex min-w-0 max-w-52 shrink-0 items-center`,children:[(0,h.jsxs)(`button`,{role:`tab`,"aria-selected":!I&&F?.id===e.id,className:`relative h-7 min-w-0 truncate rounded-sm px-2 font-mono text-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:-outline-offset-2 aria-selected:bg-key aria-selected:font-medium aria-selected:text-content aria-selected:shadow-key aria-selected:ring-1 aria-selected:ring-key-border aria-selected:after:absolute aria-selected:after:inset-x-2 aria-selected:after:bottom-0 aria-selected:after:h-0.5 aria-selected:after:rounded-full aria-selected:after:bg-star`,title:`${e.cwd} · ${e.sessionId}`,onClick:()=>{E(t=>({...t,[i]:e.id})),A(e=>{let t={...e};return delete t[i],t})},children:[e.orphaned?`${n.orphanedTerminal} · `:``,e.profileId]}),(0,h.jsx)(l,{variant:`ghost`,size:`icon-xs`,"aria-label":S(`terminal:workspace.closeView`),title:S(`terminal:workspace.closeView`),onClick:()=>R(e.id),children:(0,h.jsx)(c,{className:`size-3`})})]},e.id))}),D.size>0&&(0,h.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>O(new Set),children:S(`terminal:workspace.restoreViews`)}),(0,h.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":n.newTerminal,title:n.newTerminal,onClick:()=>void L(),children:(0,h.jsx)(o,{className:`size-4`})}),!B&&(0,h.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":n.maximizeTerminal,title:n.maximizeTerminal,onClick:()=>b(v(window.innerHeight)),children:(0,h.jsx)(p,{className:`size-4`})}),(0,h.jsx)(l,{variant:`ghost`,size:`icon`,"aria-label":n.hideTerminal,title:n.hideTerminal,onClick:()=>y(!1),children:(0,h.jsx)(a,{className:`size-4`})})]}),j&&(0,h.jsx)(`p`,{role:`alert`,className:`p-2 text-xs text-danger`,children:j}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1`,children:I?(0,h.jsx)(f,{viewKey:`bottom`,sessionId:i,cwd:I.cwd,onCreated:e=>{E(t=>({...t,[i]:e})),A(e=>{if(e[i]?.token!==I.token)return e;let t={...e};return delete t[i],t})}},I.token):F?(0,h.jsx)(f,{viewKey:`bottom`,sessionId:F.sessionId,cwd:F.cwd,terminalId:F.id}):(0,h.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2`,children:[(0,h.jsx)(`p`,{className:`text-sm text-content-muted`,children:n.usesActiveSessionWorkspace}),(0,h.jsx)(l,{onClick:()=>void L(),children:n.openTerminal})]})})]})}export{y as TerminalPanel};