pisper 0.6.11 → 0.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +667 -597
  3. package/web/assets/{AppDialog-CbXmk5vN.js → AppDialog-B2sA9Pb-.js} +1 -1
  4. package/web/assets/{AppOverlays-BFLcGGx9.js → AppOverlays-BSQhRkJA.js} +1 -1
  5. package/web/assets/{AssetsPage-BoB8pJxi.js → AssetsPage-BYt5ux5w.js} +1 -1
  6. package/web/assets/{BoardPage-C3P69gtK.js → BoardPage-CMlI4ZXS.js} +3 -3
  7. package/web/assets/{ChannelsPage-yPVopq7h.js → ChannelsPage-D_wMSCSQ.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-DPulJWKJ.js → ChatAppearancePage-I3n1MqQQ.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-CZX27BNu.js → ChatHistoryPage-DfYaF_Up.js} +1 -1
  10. package/web/assets/{ChatPage-Bkv4vff9.js → ChatPage-Da-Olqli.js} +5 -5
  11. package/web/assets/{ConfigPage-D1MJyBus.js → ConfigPage-BEor5fZj.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-CKaPEgxw.js → DesktopWindowControls-CNMZrILS.js} +1 -1
  13. package/web/assets/{DispatchOverlay-CGLJLqZo.js → DispatchOverlay-D-gu_80O.js} +1 -1
  14. package/web/assets/{FeaturePage-RH3fTWIk.js → FeaturePage-Bh5TePxl.js} +1 -1
  15. package/web/assets/{FileAttachmentPreview-BhdQDxeP.js → FileAttachmentPreview-BKf_g87y.js} +1 -1
  16. package/web/assets/{FloatingWidgets-UItLK_UZ.js → FloatingWidgets-C1qQaPBd.js} +1 -1
  17. package/web/assets/{FocusRuntimeControls-DyexiBAA.js → FocusRuntimeControls-6ayCBCsE.js} +1 -1
  18. package/web/assets/{GitDiffViewer-dtiUySxH.js → GitDiffViewer-BMyafOfq.js} +1 -1
  19. package/web/assets/LaunchConsole-DM4YN3y3.js +3 -0
  20. package/web/assets/ManageProjectsDialog-B694Yqbw.js +1 -0
  21. package/web/assets/{MarkdownMessage-CYDI17zd.js → MarkdownMessage-mIynIAzE.js} +1 -1
  22. package/web/assets/McpPage-BfGjtNdb.js +1 -0
  23. package/web/assets/{MemoryPage-ObL1zsXe.js → MemoryPage-2htmr0tu.js} +1 -1
  24. package/web/assets/{MobileNavigation-BIPy8A0i.js → MobileNavigation-qjEdcfhX.js} +1 -1
  25. package/web/assets/{MorePage-CFfeYmW_.js → MorePage-B5nQDAQP.js} +1 -1
  26. package/web/assets/NewFolderDialog-D68r0xND.js +1 -0
  27. package/web/assets/{PageHeader-SVPzWuI3.js → PageHeader-BsadnkzI.js} +1 -1
  28. package/web/assets/{PhoneDrawer-C08oZFjf.js → PhoneDrawer-CGi1h7IU.js} +1 -1
  29. package/web/assets/{PhoneMenuButton-BCxDG78_.js → PhoneMenuButton-DkkEDkfk.js} +1 -1
  30. package/web/assets/{PhoneTopBar-6KsMmalq.js → PhoneTopBar-BwIvKnLT.js} +1 -1
  31. package/web/assets/{PluginsPage-jhrfFTbZ.js → PluginsPage-BV0HrLjj.js} +1 -1
  32. package/web/assets/{QuickPromptIdeas-CX8dS2LC.js → QuickPromptIdeas-Do7Bs-V_.js} +1 -1
  33. package/web/assets/{SafeModePrompt-v1_UpOAA.js → SafeModePrompt-zkBI0cAo.js} +1 -1
  34. package/web/assets/SchedulesPage-Dids4PHA.js +1 -0
  35. package/web/assets/{SessionBrowserPane-Bvy_BC-s.js → SessionBrowserPane-DXca3lhC.js} +2 -2
  36. package/web/assets/{SessionContextPanel-B6c71Uom.js → SessionContextPanel-XMQkDDgD.js} +2 -2
  37. package/web/assets/{SessionHome-B-lxCMjh.js → SessionHome-BoPMlfbE.js} +1 -1
  38. package/web/assets/{SessionInspector-FhXk25KK.js → SessionInspector-DoXEstqb.js} +1 -1
  39. package/web/assets/{SessionShell-B-zDO3z-.js → SessionShell-DC0uS7ab.js} +1 -1
  40. package/web/assets/{SettingsSidebar-K4O49gWb.js → SettingsSidebar-D1F4VOzp.js} +1 -1
  41. package/web/assets/{ShortcutHelpDialog-LajY5QoG.js → ShortcutHelpDialog-b1wuKRGr.js} +1 -1
  42. package/web/assets/{ShortcutKeys-BCndDMeY.js → ShortcutKeys-YBlbJmQo.js} +1 -1
  43. package/web/assets/{SidebarUpdateStatus-2eLpofE7.js → SidebarUpdateStatus-Dn95j8CE.js} +1 -1
  44. package/web/assets/{SkillsPage-Z_czQryK.js → SkillsPage-_g13X5ID.js} +1 -1
  45. package/web/assets/{TaskProcessesPane-GyemHu_6.js → TaskProcessesPane-ChitlEI4.js} +1 -1
  46. package/web/assets/{TaskTerminalView-C7WW5feg.js → TaskTerminalView-od0JCnVb.js} +1 -1
  47. package/web/assets/{TerminalPanel-Ddu_dEnz.js → TerminalPanel-CW47PtOX.js} +1 -1
  48. package/web/assets/{WebDesktopPet-DfAoMXEk.js → WebDesktopPet-BgQkrvFd.js} +1 -1
  49. package/web/assets/{WorkflowsPage-D_wAL0Md.js → WorkflowsPage-BFyP0_j_.js} +1 -1
  50. package/web/assets/{WorkspacePicker-DsJ0_nq_.js → WorkspacePicker-tsgOFkg0.js} +1 -1
  51. package/web/assets/{api-DxQIocGp.js → api-DOHQjQrv.js} +1 -1
  52. package/web/assets/{app-update-awVCww9P.js → app-update-C1oLil1b.js} +1 -1
  53. package/web/assets/{approval-confirm-9qU8wa0h.js → approval-confirm-Bpma8HMP.js} +1 -1
  54. package/web/assets/{board-launch-B2PD2yr-.js → board-launch-CM1zjdqN.js} +1 -1
  55. package/web/assets/board-messages-BOWWyhz_.js +1 -0
  56. package/web/assets/board-projects-Cm1I_eWA.js +1 -0
  57. package/web/assets/{chat-api-CjiINBKJ.js → chat-api-tHFjf7aB.js} +1 -1
  58. package/web/assets/{client-store-H1xTSbo-.js → client-store-CpJ1iryH.js} +1 -1
  59. package/web/assets/{config-search-hFrcaQf0.js → config-search-CyM8kWGv.js} +1 -1
  60. package/web/assets/{dialog-Bs9_FZX7.js → dialog-CfgIErMS.js} +1 -1
  61. package/web/assets/{events-DWUUCmbP.js → events-DV8PYjtk.js} +1 -1
  62. package/web/assets/{field-DaxtcBBA.js → field-DoLEb0np.js} +1 -1
  63. package/web/assets/folder-paths-Bky-CpjC.js +1 -0
  64. package/web/assets/{hosts-DsWmhXz4.js → hosts-DJ2bPahU.js} +1 -1
  65. package/web/assets/{i18n-BjpQE1sJ.js → i18n-CHHZADSh.js} +1 -1
  66. package/web/assets/{index-C3xrFlMb.js → index-CKGGgVei.js} +2 -2
  67. package/web/assets/input-group-h8z63MzW.js +1 -0
  68. package/web/assets/mount-app-B1dKgqo5.js +9 -0
  69. package/web/assets/mutation-CEbxdVYy.js +1 -0
  70. package/web/assets/{palette-navigation-Bni8Mp34.js → palette-navigation-ByC1_QS5.js} +1 -1
  71. package/web/assets/{permission-rules-api-BO8nujtv.js → permission-rules-api-DS_p7Lik.js} +1 -1
  72. package/web/assets/{pick-system-directory-C7BKn3Gc.js → pick-system-directory-Bhvwq-o2.js} +1 -1
  73. package/web/assets/placements-DBcA75II.js +2 -0
  74. package/web/assets/{popover-BqqbRCrL.js → popover-4UKNni3P.js} +1 -1
  75. package/web/assets/public-DMzrVWzM.js +1 -0
  76. package/web/assets/{public-Dp3V7Oez.js → public-QbkhsZjX.js} +2 -2
  77. package/web/assets/{public-components-CjL2gwlJ.js → public-components-Bvl5b8HI.js} +1 -1
  78. package/web/assets/public-diff-zWlldwG3.js +1 -0
  79. package/web/assets/public-launch-WirHCXQ8.js +1 -0
  80. package/web/assets/query-Bj-DUNYq.js +1 -0
  81. package/web/assets/runtime-capabilities-4_ZwLBqF.js +1 -0
  82. package/web/assets/{runtime-capabilities-store-BvWnn9Kx.js → runtime-capabilities-store-CLDMF6_P.js} +1 -1
  83. package/web/assets/{safe-mode-instance-UY-RZ5fF.js → safe-mode-instance-DPnZDrTR.js} +1 -1
  84. package/web/assets/safe-mode-sentinel-DNy3YZMh.js +1 -0
  85. package/web/assets/{session-change-summary-api-CI_mYqV8.js → session-change-summary-api-IM8k3njh.js} +1 -1
  86. package/web/assets/{session-home-sBII_AAO.js → session-home-BSH7HEmZ.js} +1 -1
  87. package/web/assets/{session-organization-api-Dt_FNL0d.js → session-organization-api-dGpPgiLe.js} +1 -1
  88. package/web/assets/{session-scope-SQQU-bRA.js → session-scope-_kqXQnb0.js} +1 -1
  89. package/web/assets/{session-tree-actions-AdyVzQwO.js → session-tree-actions-WcOcYBo-.js} +1 -1
  90. package/web/assets/{session-tree-summary-BfBt_ogL.js → session-tree-summary-CpuI5gMj.js} +1 -1
  91. package/web/assets/session-workspaces-BWTBYaGT.js +1 -0
  92. package/web/assets/{settings-navigation-DV3N_utl.js → settings-navigation-_yUm71Uk.js} +1 -1
  93. package/web/assets/{shortcuts-DWF7_dCu.js → shortcuts-BheSJu4D.js} +1 -1
  94. package/web/assets/{side-chat-context-CtRt4VcS.js → side-chat-context-fHd5qktG.js} +3 -3
  95. package/web/assets/sidebar-DQjsKcJn.js +2 -0
  96. package/web/assets/{sidebar-store-Da-3xIaR.js → sidebar-store-0l_ZiIAA.js} +1 -1
  97. package/web/assets/{speech-session-DjxOmcG7.js → speech-session-CrscgV-X.js} +1 -1
  98. package/web/assets/startup-queries-B_DpfvaA.js +1 -0
  99. package/web/assets/{use-i18n-BIJtH0nB.js → use-i18n-BWyVtWF9.js} +1 -1
  100. package/web/assets/{use-studio-actions-e1FiDWGR.js → use-studio-actions-CdzG_H8p.js} +1 -1
  101. package/web/assets/{useBoardItems-CzLK6g45.js → useBoardItems-RCXS90vW.js} +1 -1
  102. package/web/assets/{useFleetSystemInfo-kKFDmOS4.js → useFleetSystemInfo-rj18NGAd.js} +1 -1
  103. package/web/assets/useNewProjectPicker-q3Albbmn.js +1 -0
  104. package/web/assets/useNow-DlbPA2gp.js +1 -0
  105. package/web/assets/{usePhoneShell-BuNqR-TS.js → usePhoneShell-cDHpi_4q.js} +1 -1
  106. package/web/assets/useQuery-DdcpUQhO.js +1 -0
  107. package/web/assets/useSessionListQuery-B-MnlVs6.js +2 -0
  108. package/web/assets/useSessionRowActions-C6dpdoDz.js +1 -0
  109. package/web/assets/{useSidebarModel-CBd3rSxV.js → useSidebarModel-BIzp9khQ.js} +1 -1
  110. package/web/assets/{web-preview-DJZpUrZT.js → web-preview-DZqYC0Ca.js} +1 -1
  111. package/web/assets/{web-preview-events-DRcd0j1W.js → web-preview-events-DQAcSBmI.js} +1 -1
  112. package/web/assets/workspace-order-store-Cw1fZTM7.js +1 -0
  113. package/web/index.html +1 -1
  114. package/web/assets/LaunchConsole-BIiKjt0j.js +0 -2
  115. package/web/assets/ManageProjectsDialog-CLskSna6.js +0 -1
  116. package/web/assets/McpPage-DC_9gmSC.js +0 -1
  117. package/web/assets/SchedulesPage-G1R7ua11.js +0 -1
  118. package/web/assets/board-messages-xFeTO3o6.js +0 -1
  119. package/web/assets/board-projects-Dxd3yet9.js +0 -1
  120. package/web/assets/input-group-CDEyjyK4.js +0 -1
  121. package/web/assets/launch-defaults-store-DTq_ndTa.js +0 -1
  122. package/web/assets/mount-app-DQkz4dfd.js +0 -9
  123. package/web/assets/mutation-Difliohy.js +0 -1
  124. package/web/assets/placements-Dgq244bc.js +0 -2
  125. package/web/assets/public-DjZxpaMo.js +0 -1
  126. package/web/assets/public-diff-BpkmyA3H.js +0 -1
  127. package/web/assets/public-launch-C4NBmnGZ.js +0 -1
  128. package/web/assets/runtime-capabilities-BhAMiYhG.js +0 -1
  129. package/web/assets/safe-mode-sentinel-DnReXgjI.js +0 -1
  130. package/web/assets/sidebar-DTHEZloM.js +0 -2
  131. package/web/assets/startup-queries-_OUFiG02.js +0 -1
  132. package/web/assets/useNow-CpKRH_uQ.js +0 -1
  133. package/web/assets/useQuery-Bg3cTjsY.js +0 -1
  134. package/web/assets/useSessionListQuery-jM0IQ1En.js +0 -2
  135. package/web/assets/useSessionRowActions-BG8yJygF.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BIJtH0nB.js";import{t as i}from"./minus-BuutOHSj.js";import{t as a}from"./square-bHHVTT3G.js";import{t as o}from"./x-07u4-129.js";var s=e(t(),1),c=n();function l(){let{t:e}=r(),t={minimize:e(`navigation:window.minimize`),maximize:e(`navigation:window.maximize`),close:e(`navigation:window.close`)},n=window.pisperDesktop;return(0,s.useEffect)(()=>{if(!n?.customTitlebar||!n.windowAction)return;let e=e=>{let t=e.target instanceof Element?e.target:null;e.button!==0||!t?.closest(`[data-window-drag-region]`)||t.closest(`button, a, input, select, textarea, [role="button"], [role="tab"], [contenteditable="true"]`)||e.type===`mousedown`&&e.detail>1||n.windowAction?.(e.type===`dblclick`?`maximize`:`drag`).catch(()=>{})};return document.addEventListener(`mousedown`,e),document.addEventListener(`dblclick`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`dblclick`,e)}},[n]),!n?.customTitlebar||!n.windowAction?null:(0,c.jsx)(`div`,{className:`desktop-window-controls absolute right-0 top-0 z-40 flex h-12`,"aria-label":e(`navigation:window.controls`),children:[`minimize`,`maximize`,`close`].map(e=>{let r=e===`minimize`?i:e===`maximize`?a:o;return(0,c.jsx)(`button`,{type:`button`,title:t[e],"aria-label":t[e],className:`grid w-11 place-items-center text-content-muted transition-colors duration-[var(--d-fast)] ${e===`close`?`hover:bg-red-600 hover:text-white`:`hover:bg-surface-hover hover:text-content`}`,onClick:()=>void n.windowAction?.(e).catch(()=>{}),children:(0,c.jsx)(r,{size:e===`maximize`?12:15})},e)})})}export{l as DesktopWindowControls};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BWyVtWF9.js";import{t as i}from"./minus-BuutOHSj.js";import{t as a}from"./square-bHHVTT3G.js";import{t as o}from"./x-07u4-129.js";var s=e(t(),1),c=n();function l(){let{t:e}=r(),t={minimize:e(`navigation:window.minimize`),maximize:e(`navigation:window.maximize`),close:e(`navigation:window.close`)},n=window.pisperDesktop;return(0,s.useEffect)(()=>{if(!n?.customTitlebar||!n.windowAction)return;let e=e=>{let t=e.target instanceof Element?e.target:null;e.button!==0||!t?.closest(`[data-window-drag-region]`)||t.closest(`button, a, input, select, textarea, [role="button"], [role="tab"], [contenteditable="true"]`)||e.type===`mousedown`&&e.detail>1||n.windowAction?.(e.type===`dblclick`?`maximize`:`drag`).catch(()=>{})};return document.addEventListener(`mousedown`,e),document.addEventListener(`dblclick`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`dblclick`,e)}},[n]),!n?.customTitlebar||!n.windowAction?null:(0,c.jsx)(`div`,{className:`desktop-window-controls absolute right-0 top-0 z-40 flex h-12`,"aria-label":e(`navigation:window.controls`),children:[`minimize`,`maximize`,`close`].map(e=>{let r=e===`minimize`?i:e===`maximize`?a:o;return(0,c.jsx)(`button`,{type:`button`,title:t[e],"aria-label":t[e],className:`grid w-11 place-items-center text-content-muted transition-colors duration-[var(--d-fast)] ${e===`close`?`hover:bg-red-600 hover:text-white`:`hover:bg-surface-hover hover:text-content`}`,onClick:()=>void n.windowAction?.(e).catch(()=>{}),children:(0,c.jsx)(r,{size:e===`maximize`?12:15})},e)})})}export{l as DesktopWindowControls};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BIJtH0nB.js";import{t as n}from"./LaunchConsole-BIiKjt0j.js";import{t as r}from"./info-DATxy0fb.js";import{a as i,n as a,o,r as s,t as c}from"./sheet-BTaIEX4w.js";import{a as l,i as u,l as d,r as f,t as p}from"./dialog-Bs9_FZX7.js";import{t as m}from"./useOverlayFocusReturn-NkxBSSjb.js";var h=e();function g({open:e,phone:g,onOpenChange:_,onDispatched:v,onDetachedFailure:y,onConfigureModels:b}){let{t:x}=t(),S=m(e),C=(0,h.jsx)(n,{variant:g?`sheet`:`overlay`,autoFocus:!0,onDispatched:v,onDetachedFailure:y,onConfigureModels:()=>{_(!1),b()}});return g?(0,h.jsx)(c,{open:e,onOpenChange:_,children:(0,h.jsxs)(a,{side:`bottom`,showCloseButton:!1,"aria-describedby":`board-dispatch-description`,onCloseAutoFocus:S,className:`max-h-[90dvh] gap-3 overflow-y-auto rounded-t-(--r-sheet) px-4 pt-2 pb-[calc(16px+var(--pisper-safe-area-bottom))]`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`mx-auto h-1 w-9 flex-none rounded-full bg-stroke-strong`}),(0,h.jsxs)(i,{className:`p-0`,children:[(0,h.jsx)(o,{children:x(`board:dispatch.title`)}),(0,h.jsx)(s,{id:`board-dispatch-description`,children:x(`board:dispatch.descriptionPhone`)})]}),C]})}):(0,h.jsx)(p,{open:e,onOpenChange:_,children:(0,h.jsxs)(u,{showCloseButton:!1,"aria-describedby":`board-dispatch-description`,"data-dispatch-dialog":!0,onCloseAutoFocus:S,className:`top-[max(16px,13vh)] max-w-[min(92vw,640px)] translate-y-0 gap-0 overflow-visible rounded-[var(--r-lg)] border border-stroke bg-solid p-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 px-5 pt-4 pb-2`,children:[(0,h.jsx)(d,{className:`min-w-0 flex-1 text-[15px] leading-6 font-semibold`,children:x(`board:dispatch.title`)}),(0,h.jsx)(f,{"aria-label":x(`common:ui.closeDialog`),className:`-mr-1.5 h-7 rounded-[var(--r-sm)] px-1.5 text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,children:`Esc`})]}),C,(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-b-[var(--r-lg)] border-t border-stroke-soft bg-surface-subtle px-5 py-2.5 text-xs text-content-muted`,children:[(0,h.jsx)(r,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),(0,h.jsx)(l,{id:`board-dispatch-description`,className:`min-w-0 flex-1 text-xs text-content-muted`,children:x(`board:dispatch.description`)}),(0,h.jsx)(`span`,{className:`flex-none max-[700px]:hidden`,children:x(`board:dispatch.hint`)})]})]})})}export{g as DispatchOverlay};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BWyVtWF9.js";import{t as n}from"./LaunchConsole-DM4YN3y3.js";import{t as r}from"./info-DATxy0fb.js";import{a as i,n as a,o,r as s,t as c}from"./sheet-BTaIEX4w.js";import{a as l,i as u,l as d,r as f,t as p}from"./dialog-CfgIErMS.js";import{t as m}from"./useOverlayFocusReturn-NkxBSSjb.js";var h=e();function g({open:e,phone:g,onOpenChange:_,onDispatched:v,onDetachedFailure:y,onConfigureModels:b}){let{t:x}=t(),S=m(e),C=(0,h.jsx)(n,{variant:g?`sheet`:`overlay`,autoFocus:!0,onDispatched:v,onDetachedFailure:y,onConfigureModels:()=>{_(!1),b()}});return g?(0,h.jsx)(c,{open:e,onOpenChange:_,children:(0,h.jsxs)(a,{side:`bottom`,showCloseButton:!1,"aria-describedby":`board-dispatch-description`,onCloseAutoFocus:S,className:`max-h-[90dvh] gap-3 overflow-y-auto rounded-t-(--r-sheet) px-4 pt-2 pb-[calc(16px+var(--pisper-safe-area-bottom))]`,children:[(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`mx-auto h-1 w-9 flex-none rounded-full bg-stroke-strong`}),(0,h.jsxs)(i,{className:`p-0`,children:[(0,h.jsx)(o,{children:x(`board:dispatch.title`)}),(0,h.jsx)(s,{id:`board-dispatch-description`,children:x(`board:dispatch.descriptionPhone`)})]}),C]})}):(0,h.jsx)(p,{open:e,onOpenChange:_,children:(0,h.jsxs)(u,{showCloseButton:!1,"aria-describedby":`board-dispatch-description`,"data-dispatch-dialog":!0,onCloseAutoFocus:S,className:`top-[max(16px,13vh)] max-w-[min(92vw,640px)] translate-y-0 gap-0 overflow-visible rounded-[var(--r-lg)] border border-stroke bg-solid p-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-3 px-5 pt-4 pb-2`,children:[(0,h.jsx)(d,{className:`min-w-0 flex-1 text-[15px] leading-6 font-semibold`,children:x(`board:dispatch.title`)}),(0,h.jsx)(f,{"aria-label":x(`common:ui.closeDialog`),className:`-mr-1.5 h-7 rounded-[var(--r-sm)] px-1.5 text-xs text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,children:`Esc`})]}),C,(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-b-[var(--r-lg)] border-t border-stroke-soft bg-surface-subtle px-5 py-2.5 text-xs text-content-muted`,children:[(0,h.jsx)(r,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),(0,h.jsx)(l,{id:`board-dispatch-description`,className:`min-w-0 flex-1 text-xs text-content-muted`,children:x(`board:dispatch.description`)}),(0,h.jsx)(`span`,{className:`flex-none max-[700px]:hidden`,children:x(`board:dispatch.hint`)})]})]})})}export{g as DispatchOverlay};
@@ -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"./usePhoneShell-BuNqR-TS.js";import{t as i}from"./chevron-down-CxtxIjiP.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./search-D0mqDaf_.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{t as c}from"./x-07u4-129.js";import{t as l}from"./utils-C8uzG5AZ.js";import{t as u}from"./kbd-CAufZTkl.js";var d=e(t(),1),f=n();function p({title:e,description:t,back:n,toolbar:i,children:o,className:s,...c}){let u=r();return(0,f.jsxs)(`div`,{"data-page-template":`feature`,...c,className:l(`flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,s),children:[!u&&(0,f.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,f.jsx)(`div`,{"data-feature-scroller":!0,className:`@container/page min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain`,children:(0,f.jsxs)(`div`,{"data-feature-column":!0,className:`mx-auto flex w-full max-w-[808px] min-w-0 flex-col px-6 pt-7 pb-16 max-[650px]:px-4 max-[650px]:pt-1 max-[650px]:pb-8`,children:[(0,f.jsxs)(`header`,{"data-focus-region":`header`,className:`flex min-w-0 flex-col items-start`,children:[n&&(0,f.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,"aria-label":n.ariaLabel,onClick:n.onBack,className:`-ml-1.5 mb-2.5 inline-flex h-[26px] items-center gap-1 rounded-[var(--r-sm)] pr-1.5 pl-0.5 text-[13px] text-content-muted 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 max-[650px]:mb-1 max-[650px]:-ml-2.5 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,children:[(0,f.jsx)(a,{className:`size-3.5 max-[650px]:size-5`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{children:n.label})]}),(0,f.jsx)(`h1`,{className:l(`max-w-full text-2xl leading-8 font-semibold tracking-[-.01em] [overflow-wrap:anywhere] text-content`,u&&`sr-only`),children:e}),t&&!u&&(0,f.jsx)(`p`,{className:`mt-1 max-w-full text-sm leading-relaxed text-content-muted`,children:t})]}),i,o]})})]})}function m({search:e,filters:t,actions:n}){return(0,f.jsxs)(`div`,{"data-feature-toolbar":!0,className:`mt-5 flex min-w-0 flex-col gap-2.5 max-[650px]:mt-2`,children:[(e||n)&&(0,f.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[e&&(0,f.jsx)(`div`,{className:`min-w-[min(240px,100%)] flex-1`,children:e}),n&&(0,f.jsx)(`div`,{"data-feature-actions":!0,className:`flex min-w-0 flex-wrap items-center gap-2 max-[650px]:w-full max-[650px]:[&>*]:min-h-11 max-[650px]:[&>*]:flex-1`,children:n})]}),t&&(0,f.jsx)(`div`,{"data-feature-filters":!0,className:`min-w-0 max-[650px]:[&_[role=tab]]:min-h-11`,children:t})]})}function h({id:e,value:t,onValueChange:n,placeholder:r,shortcut:i,clearLabel:a}){return(0,f.jsxs)(`label`,{className:`relative flex h-9 w-full min-w-0 items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,children:[(0,f.jsx)(o,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{className:`sr-only`,children:r}),(0,f.jsx)(`input`,{id:e,type:`search`,value:t,placeholder:r,"aria-keyshortcuts":i||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&t&&(e.preventDefault(),e.stopPropagation(),n(``))}}),t?(0,f.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus max-[650px]:-mr-2 max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":a,onClick:()=>n(``),children:(0,f.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`})}):i&&(0,f.jsx)(u,{"aria-hidden":`true`,className:`flex-none max-[650px]:hidden pointer-coarse:hidden`,children:i})]})}function g({title:e,count:t,meta:n,actions:r,description:i,children:a,className:o,...s}){let c=(0,d.useId)();return(0,f.jsxs)(`section`,{"data-feature-section":!0,"aria-labelledby":c,...s,className:l(`mt-7 min-w-0`,o),children:[(0,f.jsxs)(`div`,{className:`mb-2 flex min-h-7 min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,f.jsxs)(`h2`,{id:c,className:`min-w-0 text-[13px] leading-5 font-medium text-content-muted tabular-nums`,children:[e,t!==void 0&&(0,f.jsxs)(`span`,{children:[` · `,t]})]}),n&&(0,f.jsx)(`div`,{className:`min-w-0 text-xs text-content-muted tabular-nums [overflow-wrap:anywhere]`,children:n}),r&&(0,f.jsx)(`div`,{className:`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1.5 max-[650px]:[&_a]:min-h-11 max-[650px]:[&_button]:min-h-11`,children:r})]}),i&&(0,f.jsx)(`p`,{className:`mb-2 text-xs leading-relaxed [overflow-wrap:anywhere] text-content-muted`,children:i}),a]})}function _({className:e,children:t,...n}){return(0,f.jsxs)(`div`,{role:`alert`,"data-feature-alert":!0,...n,className:l(`mt-4 flex min-w-0 items-start gap-2 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs leading-relaxed [overflow-wrap:anywhere] text-content-secondary`,e),children:[(0,f.jsx)(s,{className:`mt-[3px] size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,f.jsx)(`div`,{className:`min-w-0 flex-1`,children:t})]})}function v({className:e,...t}){return(0,f.jsx)(`ul`,{role:`list`,"data-feature-list":!0,...t,className:l(`m-0 min-w-0 list-none border-t border-stroke p-0`,e)})}var y={1:`grid-cols-[minmax(0,1fr)]`,2:`grid-cols-[minmax(0,1fr)_auto]`,3:`grid-cols-[minmax(0,1fr)_auto_auto]`,4:`grid-cols-[minmax(0,1fr)_auto_auto_auto]`},b={1:`max-[650px]:grid-cols-[minmax(0,1fr)]`,2:`max-[650px]:grid-cols-[minmax(0,1fr)_auto]`,3:`max-[650px]:grid-cols-[minmax(0,1fr)_auto_auto]`},x=`max-[650px]:[&_button:not([role=switch])]:min-h-11 max-[650px]:[&_input:not([type=checkbox]):not([type=radio]):not([type=range])]:min-h-11 max-[650px]:[&_select]:min-h-11`;function S({icon:e,name:t,nameMeta:n,description:r,meta:a,status:o,actions:s,detail:c,expanded:u=!1,onExpandedChange:p,toggleLabel:m,onOpen:h,openLabel:g,className:_,...v}){let S=(0,d.useId)(),C=(0,d.useId)(),w=(0,d.useId)(),T=c!==void 0&&!!p&&!h,E=()=>p?.(!u),D=(0,f.jsxs)(f.Fragment,{children:[e&&(0,f.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-9 flex-none place-items-center rounded-[var(--r-md)] bg-surface-subtle text-content-secondary max-[650px]:size-8 [&_svg]:size-[18px] [&_svg]:stroke-[1.75]`,children:e}),(0,f.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,f.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,f.jsx)(`span`,{id:S,className:`min-w-0 truncate text-sm font-medium text-content`,children:t}),n&&(0,f.jsx)(`span`,{className:`min-w-0 flex-none truncate font-mono text-[11.5px] text-content-muted`,children:n})]}),r&&(0,f.jsx)(`span`,{id:C,className:`line-clamp-2 text-[13px] leading-[1.45] [overflow-wrap:anywhere] text-content-muted`,children:r}),a&&(0,f.jsx)(`span`,{"data-feature-row-meta":!0,className:`flex min-w-0 items-center gap-x-1.5 overflow-hidden text-xs leading-[1.5] whitespace-nowrap text-content-muted`,children:a})]})]});return(0,f.jsxs)(`li`,{"data-feature-row":!0,"data-expanded":T?u:void 0,...v,className:l(`min-w-0 border-b border-stroke`,_),children:[(0,f.jsxs)(`div`,{className:l(`grid min-h-16 min-w-0 items-center gap-x-3 py-3 max-[650px]:min-h-14 max-[650px]:gap-x-2 max-[650px]:py-2`,y[1+Number(!!o)+Number(!!s)+Number(T)],b[1+Number(!!s)+Number(T)],h&&`-mx-2 rounded-[var(--r-md)] px-2 transition-colors duration-(--d-fast) hover:bg-surface-hover`),children:[h?(0,f.jsx)(`button`,{type:`button`,"data-feature-row-open":!0,"aria-label":g,onClick:h,className:`flex min-h-11 min-w-0 items-center gap-3.5 self-stretch rounded-[var(--r-sm)] text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:gap-2.5`,children:D}):T?(0,f.jsx)(`button`,{type:`button`,"data-feature-row-toggle":!0,"aria-labelledby":S,"aria-describedby":r?C:void 0,"aria-expanded":u,"aria-controls":u?w:void 0,onClick:E,className:`flex min-h-11 min-w-0 items-center gap-3.5 self-stretch rounded-[var(--r-sm)] text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:gap-2.5`,children:D}):(0,f.jsx)(`div`,{className:`flex min-w-0 items-center gap-3.5 max-[650px]:gap-2.5`,children:D}),o&&(0,f.jsx)(`div`,{"data-feature-row-status":!0,className:l(`flex max-w-[220px] min-w-0 items-center justify-end gap-1.5 text-right text-xs text-content-muted tabular-nums max-[650px]:col-start-1 max-[650px]:row-start-2 max-[650px]:max-w-none max-[650px]:justify-start max-[650px]:text-left`,e&&`max-[650px]:pl-[42px]`),children:o}),s&&(0,f.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-2 max-[650px]:[&_button:not([role=switch])]:min-h-11`,children:s}),T&&(0,f.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,title:m,onClick:E,className:`grid size-7 place-items-center rounded-[var(--r-sm)] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content max-[650px]:size-11 pointer-coarse:size-11`,children:(0,f.jsx)(i,{className:l(`size-4 transition-transform duration-(--d-base)`,u&&`rotate-180`)})})]}),T?u&&(0,f.jsx)(`div`,{id:w,role:`region`,"aria-labelledby":S,"data-feature-row-detail":!0,className:l(`min-w-0 pb-4 max-[650px]:pl-0`,x,e?`pl-[50px]`:`pl-0`),children:c}):c!==void 0&&(0,f.jsx)(`div`,{"data-feature-row-detail":!0,className:l(`min-w-0 pb-3 max-[650px]:pl-0`,x,e?`pl-[50px]`:`pl-0`),children:c})]})}export{h as a,S as i,v as n,g as o,p as r,m as s,_ 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"./usePhoneShell-cDHpi_4q.js";import{t as i}from"./chevron-down-CxtxIjiP.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./search-D0mqDaf_.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{t as c}from"./x-07u4-129.js";import{t as l}from"./utils-C8uzG5AZ.js";import{t as u}from"./kbd-CAufZTkl.js";var d=e(t(),1),f=n();function p({title:e,description:t,back:n,toolbar:i,children:o,className:s,...c}){let u=r();return(0,f.jsxs)(`div`,{"data-page-template":`feature`,...c,className:l(`flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,s),children:[!u&&(0,f.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,f.jsx)(`div`,{"data-feature-scroller":!0,className:`@container/page min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain`,children:(0,f.jsxs)(`div`,{"data-feature-column":!0,className:`mx-auto flex w-full max-w-[808px] min-w-0 flex-col px-6 pt-7 pb-16 max-[650px]:px-4 max-[650px]:pt-1 max-[650px]:pb-8`,children:[(0,f.jsxs)(`header`,{"data-focus-region":`header`,className:`flex min-w-0 flex-col items-start`,children:[n&&(0,f.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,"aria-label":n.ariaLabel,onClick:n.onBack,className:`-ml-1.5 mb-2.5 inline-flex h-[26px] items-center gap-1 rounded-[var(--r-sm)] pr-1.5 pl-0.5 text-[13px] text-content-muted 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 max-[650px]:mb-1 max-[650px]:-ml-2.5 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,children:[(0,f.jsx)(a,{className:`size-3.5 max-[650px]:size-5`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{children:n.label})]}),(0,f.jsx)(`h1`,{className:l(`max-w-full text-2xl leading-8 font-semibold tracking-[-.01em] [overflow-wrap:anywhere] text-content`,u&&`sr-only`),children:e}),t&&!u&&(0,f.jsx)(`p`,{className:`mt-1 max-w-full text-sm leading-relaxed text-content-muted`,children:t})]}),i,o]})})]})}function m({search:e,filters:t,actions:n}){return(0,f.jsxs)(`div`,{"data-feature-toolbar":!0,className:`mt-5 flex min-w-0 flex-col gap-2.5 max-[650px]:mt-2`,children:[(e||n)&&(0,f.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[e&&(0,f.jsx)(`div`,{className:`min-w-[min(240px,100%)] flex-1`,children:e}),n&&(0,f.jsx)(`div`,{"data-feature-actions":!0,className:`flex min-w-0 flex-wrap items-center gap-2 max-[650px]:w-full max-[650px]:[&>*]:min-h-11 max-[650px]:[&>*]:flex-1`,children:n})]}),t&&(0,f.jsx)(`div`,{"data-feature-filters":!0,className:`min-w-0 max-[650px]:[&_[role=tab]]:min-h-11`,children:t})]})}function h({id:e,value:t,onValueChange:n,placeholder:r,shortcut:i,clearLabel:a}){return(0,f.jsxs)(`label`,{className:`relative flex h-9 w-full min-w-0 items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,children:[(0,f.jsx)(o,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{className:`sr-only`,children:r}),(0,f.jsx)(`input`,{id:e,type:`search`,value:t,placeholder:r,"aria-keyshortcuts":i||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&t&&(e.preventDefault(),e.stopPropagation(),n(``))}}),t?(0,f.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus max-[650px]:-mr-2 max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":a,onClick:()=>n(``),children:(0,f.jsx)(c,{className:`size-3.5`,"aria-hidden":`true`})}):i&&(0,f.jsx)(u,{"aria-hidden":`true`,className:`flex-none max-[650px]:hidden pointer-coarse:hidden`,children:i})]})}function g({title:e,count:t,meta:n,actions:r,description:i,children:a,className:o,...s}){let c=(0,d.useId)();return(0,f.jsxs)(`section`,{"data-feature-section":!0,"aria-labelledby":c,...s,className:l(`mt-7 min-w-0`,o),children:[(0,f.jsxs)(`div`,{className:`mb-2 flex min-h-7 min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,f.jsxs)(`h2`,{id:c,className:`min-w-0 text-[13px] leading-5 font-medium text-content-muted tabular-nums`,children:[e,t!==void 0&&(0,f.jsxs)(`span`,{children:[` · `,t]})]}),n&&(0,f.jsx)(`div`,{className:`min-w-0 text-xs text-content-muted tabular-nums [overflow-wrap:anywhere]`,children:n}),r&&(0,f.jsx)(`div`,{className:`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1.5 max-[650px]:[&_a]:min-h-11 max-[650px]:[&_button]:min-h-11`,children:r})]}),i&&(0,f.jsx)(`p`,{className:`mb-2 text-xs leading-relaxed [overflow-wrap:anywhere] text-content-muted`,children:i}),a]})}function _({className:e,children:t,...n}){return(0,f.jsxs)(`div`,{role:`alert`,"data-feature-alert":!0,...n,className:l(`mt-4 flex min-w-0 items-start gap-2 rounded-[var(--r-md)] border border-stroke bg-surface-subtle px-3 py-2 text-xs leading-relaxed [overflow-wrap:anywhere] text-content-secondary`,e),children:[(0,f.jsx)(s,{className:`mt-[3px] size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,f.jsx)(`div`,{className:`min-w-0 flex-1`,children:t})]})}function v({className:e,...t}){return(0,f.jsx)(`ul`,{role:`list`,"data-feature-list":!0,...t,className:l(`m-0 min-w-0 list-none border-t border-stroke p-0`,e)})}var y={1:`grid-cols-[minmax(0,1fr)]`,2:`grid-cols-[minmax(0,1fr)_auto]`,3:`grid-cols-[minmax(0,1fr)_auto_auto]`,4:`grid-cols-[minmax(0,1fr)_auto_auto_auto]`},b={1:`max-[650px]:grid-cols-[minmax(0,1fr)]`,2:`max-[650px]:grid-cols-[minmax(0,1fr)_auto]`,3:`max-[650px]:grid-cols-[minmax(0,1fr)_auto_auto]`},x=`max-[650px]:[&_button:not([role=switch])]:min-h-11 max-[650px]:[&_input:not([type=checkbox]):not([type=radio]):not([type=range])]:min-h-11 max-[650px]:[&_select]:min-h-11`;function S({icon:e,name:t,nameMeta:n,description:r,meta:a,status:o,actions:s,detail:c,expanded:u=!1,onExpandedChange:p,toggleLabel:m,onOpen:h,openLabel:g,className:_,...v}){let S=(0,d.useId)(),C=(0,d.useId)(),w=(0,d.useId)(),T=c!==void 0&&!!p&&!h,E=()=>p?.(!u),D=(0,f.jsxs)(f.Fragment,{children:[e&&(0,f.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-9 flex-none place-items-center rounded-[var(--r-md)] bg-surface-subtle text-content-secondary max-[650px]:size-8 [&_svg]:size-[18px] [&_svg]:stroke-[1.75]`,children:e}),(0,f.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,f.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,f.jsx)(`span`,{id:S,className:`min-w-0 truncate text-sm font-medium text-content`,children:t}),n&&(0,f.jsx)(`span`,{className:`min-w-0 flex-none truncate font-mono text-[11.5px] text-content-muted`,children:n})]}),r&&(0,f.jsx)(`span`,{id:C,className:`line-clamp-2 text-[13px] leading-[1.45] [overflow-wrap:anywhere] text-content-muted`,children:r}),a&&(0,f.jsx)(`span`,{"data-feature-row-meta":!0,className:`flex min-w-0 items-center gap-x-1.5 overflow-hidden text-xs leading-[1.5] whitespace-nowrap text-content-muted`,children:a})]})]});return(0,f.jsxs)(`li`,{"data-feature-row":!0,"data-expanded":T?u:void 0,...v,className:l(`min-w-0 border-b border-stroke`,_),children:[(0,f.jsxs)(`div`,{className:l(`grid min-h-16 min-w-0 items-center gap-x-3 py-3 max-[650px]:min-h-14 max-[650px]:gap-x-2 max-[650px]:py-2`,y[1+Number(!!o)+Number(!!s)+Number(T)],b[1+Number(!!s)+Number(T)],h&&`-mx-2 rounded-[var(--r-md)] px-2 transition-colors duration-(--d-fast) hover:bg-surface-hover`),children:[h?(0,f.jsx)(`button`,{type:`button`,"data-feature-row-open":!0,"aria-label":g,onClick:h,className:`flex min-h-11 min-w-0 items-center gap-3.5 self-stretch rounded-[var(--r-sm)] text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:gap-2.5`,children:D}):T?(0,f.jsx)(`button`,{type:`button`,"data-feature-row-toggle":!0,"aria-labelledby":S,"aria-describedby":r?C:void 0,"aria-expanded":u,"aria-controls":u?w:void 0,onClick:E,className:`flex min-h-11 min-w-0 items-center gap-3.5 self-stretch rounded-[var(--r-sm)] text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:gap-2.5`,children:D}):(0,f.jsx)(`div`,{className:`flex min-w-0 items-center gap-3.5 max-[650px]:gap-2.5`,children:D}),o&&(0,f.jsx)(`div`,{"data-feature-row-status":!0,className:l(`flex max-w-[220px] min-w-0 items-center justify-end gap-1.5 text-right text-xs text-content-muted tabular-nums max-[650px]:col-start-1 max-[650px]:row-start-2 max-[650px]:max-w-none max-[650px]:justify-start max-[650px]:text-left`,e&&`max-[650px]:pl-[42px]`),children:o}),s&&(0,f.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-2 max-[650px]:[&_button:not([role=switch])]:min-h-11`,children:s}),T&&(0,f.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-hidden":`true`,title:m,onClick:E,className:`grid size-7 place-items-center rounded-[var(--r-sm)] text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content max-[650px]:size-11 pointer-coarse:size-11`,children:(0,f.jsx)(i,{className:l(`size-4 transition-transform duration-(--d-base)`,u&&`rotate-180`)})})]}),T?u&&(0,f.jsx)(`div`,{id:w,role:`region`,"aria-labelledby":S,"data-feature-row-detail":!0,className:l(`min-w-0 pb-4 max-[650px]:pl-0`,x,e?`pl-[50px]`:`pl-0`),children:c}):c!==void 0&&(0,f.jsx)(`div`,{"data-feature-row-detail":!0,className:l(`min-w-0 pb-3 max-[650px]:pl-0`,x,e?`pl-[50px]`:`pl-0`),children:c})]})}export{h as a,S as i,v as n,g as o,p as r,m as s,_ as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BIJtH0nB.js";import{t as a}from"./api-DxQIocGp.js";import{t as o}from"./download-BCfIiuaL.js";import{t as s}from"./file-Bllajneu.js";import{t as c}from"./refresh-cw-TbWxTY4K.js";import{t as l}from"./x-07u4-129.js";import{i as u,n as d,r as f,t as p}from"./tabs-DsgBuvJv.js";import{n as m,t as h}from"./button-CCcCN8tE.js";import{n as g}from"./format-DMJQzoZ7.js";import{a as _,i as v,l as y,r as b,s as x,t as S}from"./dialog-Bs9_FZX7.js";import{t as C}from"./MarkdownMessage-CYDI17zd.js";var w=e(n(),1);async function T(e,t){return e.id&&!e.id.startsWith(`path:`)?a(`/api/assets/${encodeURIComponent(e.id)}/content?preview=1`,{signal:t}):typeof e.text==`string`?{kind:`text`,text:e.text.slice(0,4e5),mimeType:e.mimeType,truncated:e.text.length>4e5}:{kind:`file`}}var E=t({FileAttachmentPreview:()=>O}),D=r();function O({attachment:e,onClose:t,onDownload:n,onRestoreFocus:r}){let{t:a}=i(),[E,O]=(0,w.useState)(null),[k,A]=(0,w.useState)(``),[j,M]=(0,w.useState)(0),[N,P]=(0,w.useState)(!0),[F,I]=(0,w.useState)(!1),L=e.id&&!e.id.startsWith(`path:`)&&/^image\/(png|jpeg|webp|gif|avif)$/.test(e.mimeType||``)?`/api/assets/${encodeURIComponent(e.id)}/download?inline=1`:``,R=e.name||a(`chat:chatMessage.fileAttachment`),z=/\.(md|markdown)$/i.test(R)||(E?.mimeType||e.mimeType)===`text/markdown`;(0,w.useEffect)(()=>{let t=new AbortController;return P(!0),I(!1),O(null),A(``),T(e,t.signal).then(e=>{t.signal.aborted||O(e)}).catch(e=>{t.signal.aborted||A(e instanceof Error?e.message:String(e))}).finally(()=>{t.signal.aborted||P(!1)}),()=>t.abort()},[e,j]);let B=E?.kind===`text`?E.text||``:void 0;return(0,D.jsx)(S,{open:!0,onOpenChange:e=>!e&&t(),children:(0,D.jsxs)(v,{className:`flex h-[min(680px,calc(100dvh-2rem))] w-[calc(100%-2rem)] min-w-0 max-w-[900px] flex-col overflow-hidden rounded-lg sm:max-w-[900px]`,showCloseButton:!1,onCloseAutoFocus:e=>{e.preventDefault(),r()},"aria-describedby":void 0,children:[(0,D.jsxs)(x,{className:`min-w-0 shrink-0 pr-9 text-left`,children:[(0,D.jsx)(y,{className:`truncate text-sm leading-5`,title:R,children:R}),(0,D.jsxs)(_,{className:`truncate text-xs`,children:[e.mimeType||`application/octet-stream`,typeof e.size==`number`&&` · ${g(e.size)}`]})]}),(0,D.jsx)(b,{asChild:!0,children:(0,D.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute right-3 top-3`,"aria-label":a(`chat:chatMessage.closePreview`),title:a(`chat:chatMessage.closePreview`),children:(0,D.jsx)(l,{size:16})})}),(0,D.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:N?(0,D.jsxs)(`div`,{role:`status`,className:`flex flex-1 items-center justify-center gap-2 text-muted-foreground`,children:[(0,D.jsx)(m,{className:`size-4`}),a(`chat:chatMessage.filePreviewLoading`)]}):k?(0,D.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3`,children:[(0,D.jsx)(`p`,{role:`alert`,className:`max-w-full break-words text-sm text-destructive`,children:k}),(0,D.jsxs)(h,{type:`button`,variant:`outline`,onClick:()=>M(e=>e+1),children:[(0,D.jsx)(c,{size:14}),a(`chat:chatMessage.filePreviewRetry`)]})]}):L&&!F?(0,D.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto`,children:(0,D.jsx)(`img`,{src:L,alt:R,className:`max-h-full max-w-full object-contain`,onError:()=>I(!0)})}):B===void 0?(0,D.jsxs)(`div`,{role:`status`,className:`flex flex-1 flex-col items-center justify-center gap-3 text-center text-muted-foreground`,children:[(0,D.jsx)(s,{size:32}),(0,D.jsx)(`p`,{className:`text-sm`,children:a(`chat:chatMessage.filePreviewUnavailable`)})]}):z?(0,D.jsxs)(p,{defaultValue:`preview`,className:`min-h-0 min-w-0 flex-1`,children:[(0,D.jsxs)(f,{className:`shrink-0`,children:[(0,D.jsx)(u,{value:`preview`,children:a(`chat:chatMessage.fileActionPreview`)}),(0,D.jsx)(u,{value:`source`,children:a(`chat:chatMessage.filePreviewSource`)})]}),(0,D.jsx)(d,{value:`preview`,className:`min-h-0 overflow-auto p-1`,children:(0,D.jsx)(C,{children:B})}),(0,D.jsx)(d,{value:`source`,className:`min-h-0 overflow-auto`,children:(0,D.jsx)(`pre`,{className:`m-0 rounded-md border border-stroke-soft bg-code p-3 font-mono text-[12px] leading-[1.65] text-content-soft`,children:B})})]}):(0,D.jsx)(`pre`,{className:`m-0 min-h-0 flex-1 overflow-auto rounded-md border border-stroke-soft bg-code p-3 font-mono text-[12px] leading-[1.65] text-content-soft`,children:B})}),(0,D.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t pt-3`,children:[E?.truncated&&(0,D.jsx)(`p`,{role:`status`,className:`mr-auto text-xs text-muted-foreground`,children:a(`chat:chatMessage.filePreviewTruncated`)}),(0,D.jsxs)(h,{type:`button`,variant:`outline`,disabled:!e.downloadUrl,onClick:n,children:[(0,D.jsx)(o,{size:14}),a(`chat:chatMessage.fileActionDownload`)]})]})]})})}export{E as n,O as t};
1
+ import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BWyVtWF9.js";import{t as a}from"./api-DOHQjQrv.js";import{t as o}from"./download-BCfIiuaL.js";import{t as s}from"./file-Bllajneu.js";import{t as c}from"./refresh-cw-TbWxTY4K.js";import{t as l}from"./x-07u4-129.js";import{i as u,n as d,r as f,t as p}from"./tabs-DsgBuvJv.js";import{n as m,t as h}from"./button-CCcCN8tE.js";import{n as g}from"./format-DMJQzoZ7.js";import{a as _,i as v,l as y,r as b,s as x,t as S}from"./dialog-CfgIErMS.js";import{t as C}from"./MarkdownMessage-mIynIAzE.js";var w=e(n(),1);async function T(e,t){return e.id&&!e.id.startsWith(`path:`)?a(`/api/assets/${encodeURIComponent(e.id)}/content?preview=1`,{signal:t}):typeof e.text==`string`?{kind:`text`,text:e.text.slice(0,4e5),mimeType:e.mimeType,truncated:e.text.length>4e5}:{kind:`file`}}var E=t({FileAttachmentPreview:()=>O}),D=r();function O({attachment:e,onClose:t,onDownload:n,onRestoreFocus:r}){let{t:a}=i(),[E,O]=(0,w.useState)(null),[k,A]=(0,w.useState)(``),[j,M]=(0,w.useState)(0),[N,P]=(0,w.useState)(!0),[F,I]=(0,w.useState)(!1),L=e.id&&!e.id.startsWith(`path:`)&&/^image\/(png|jpeg|webp|gif|avif)$/.test(e.mimeType||``)?`/api/assets/${encodeURIComponent(e.id)}/download?inline=1`:``,R=e.name||a(`chat:chatMessage.fileAttachment`),z=/\.(md|markdown)$/i.test(R)||(E?.mimeType||e.mimeType)===`text/markdown`;(0,w.useEffect)(()=>{let t=new AbortController;return P(!0),I(!1),O(null),A(``),T(e,t.signal).then(e=>{t.signal.aborted||O(e)}).catch(e=>{t.signal.aborted||A(e instanceof Error?e.message:String(e))}).finally(()=>{t.signal.aborted||P(!1)}),()=>t.abort()},[e,j]);let B=E?.kind===`text`?E.text||``:void 0;return(0,D.jsx)(S,{open:!0,onOpenChange:e=>!e&&t(),children:(0,D.jsxs)(v,{className:`flex h-[min(680px,calc(100dvh-2rem))] w-[calc(100%-2rem)] min-w-0 max-w-[900px] flex-col overflow-hidden rounded-lg sm:max-w-[900px]`,showCloseButton:!1,onCloseAutoFocus:e=>{e.preventDefault(),r()},"aria-describedby":void 0,children:[(0,D.jsxs)(x,{className:`min-w-0 shrink-0 pr-9 text-left`,children:[(0,D.jsx)(y,{className:`truncate text-sm leading-5`,title:R,children:R}),(0,D.jsxs)(_,{className:`truncate text-xs`,children:[e.mimeType||`application/octet-stream`,typeof e.size==`number`&&` · ${g(e.size)}`]})]}),(0,D.jsx)(b,{asChild:!0,children:(0,D.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`absolute right-3 top-3`,"aria-label":a(`chat:chatMessage.closePreview`),title:a(`chat:chatMessage.closePreview`),children:(0,D.jsx)(l,{size:16})})}),(0,D.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:N?(0,D.jsxs)(`div`,{role:`status`,className:`flex flex-1 items-center justify-center gap-2 text-muted-foreground`,children:[(0,D.jsx)(m,{className:`size-4`}),a(`chat:chatMessage.filePreviewLoading`)]}):k?(0,D.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3`,children:[(0,D.jsx)(`p`,{role:`alert`,className:`max-w-full break-words text-sm text-destructive`,children:k}),(0,D.jsxs)(h,{type:`button`,variant:`outline`,onClick:()=>M(e=>e+1),children:[(0,D.jsx)(c,{size:14}),a(`chat:chatMessage.filePreviewRetry`)]})]}):L&&!F?(0,D.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto`,children:(0,D.jsx)(`img`,{src:L,alt:R,className:`max-h-full max-w-full object-contain`,onError:()=>I(!0)})}):B===void 0?(0,D.jsxs)(`div`,{role:`status`,className:`flex flex-1 flex-col items-center justify-center gap-3 text-center text-muted-foreground`,children:[(0,D.jsx)(s,{size:32}),(0,D.jsx)(`p`,{className:`text-sm`,children:a(`chat:chatMessage.filePreviewUnavailable`)})]}):z?(0,D.jsxs)(p,{defaultValue:`preview`,className:`min-h-0 min-w-0 flex-1`,children:[(0,D.jsxs)(f,{className:`shrink-0`,children:[(0,D.jsx)(u,{value:`preview`,children:a(`chat:chatMessage.fileActionPreview`)}),(0,D.jsx)(u,{value:`source`,children:a(`chat:chatMessage.filePreviewSource`)})]}),(0,D.jsx)(d,{value:`preview`,className:`min-h-0 overflow-auto p-1`,children:(0,D.jsx)(C,{children:B})}),(0,D.jsx)(d,{value:`source`,className:`min-h-0 overflow-auto`,children:(0,D.jsx)(`pre`,{className:`m-0 rounded-md border border-stroke-soft bg-code p-3 font-mono text-[12px] leading-[1.65] text-content-soft`,children:B})})]}):(0,D.jsx)(`pre`,{className:`m-0 min-h-0 flex-1 overflow-auto rounded-md border border-stroke-soft bg-code p-3 font-mono text-[12px] leading-[1.65] text-content-soft`,children:B})}),(0,D.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t pt-3`,children:[E?.truncated&&(0,D.jsx)(`p`,{role:`status`,className:`mr-auto text-xs text-muted-foreground`,children:a(`chat:chatMessage.filePreviewTruncated`)}),(0,D.jsxs)(h,{type:`button`,variant:`outline`,disabled:!e.downloadUrl,onClick:n,children:[(0,D.jsx)(o,{size:14}),a(`chat:chatMessage.fileActionDownload`)]})]})]})})}export{E as n,O as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./vendor-router-CSN_DGvx.js";import{t as n}from"./index-C3xrFlMb.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{r as a}from"./routes-Da0OHSy6.js";import{f as o,i as s,n as c,p as l,u}from"./placements-Dgq244bc.js";import{n as d}from"./safe-mode-sentinel-DnReXgjI.js";import{t as f}from"./usePhoneShell-BuNqR-TS.js";var p=e(r(),1),m=i(),h=`pisper-floating-widgets`;function g(){(0,p.useEffect)(()=>{try{n.getItem(h)!==null&&n.removeItem(h)}catch{}},[])}function _({activeSessionId:e,notify:n}){let r=f(),i=t().pathname,h=i===a.components||i.startsWith(`${a.components}/`),_=u(`floating`),v=l(),[y]=(0,p.useState)(d),b=o();return g(),(0,m.jsxs)(m.Fragment,{children:[y&&v>0&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(s,{notify:n,disableAll:b})}),!r&&_.placed.length>0&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(c,{placed:_.placed,hidden:h,activeSessionId:e,notify:n})})]})}export{_ as FloatingWidgets};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./vendor-router-CSN_DGvx.js";import{t as n}from"./index-CKGGgVei.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{r as a}from"./routes-Da0OHSy6.js";import{f as o,i as s,n as c,p as l,u}from"./placements-DBcA75II.js";import{n as d}from"./safe-mode-sentinel-DNy3YZMh.js";import{t as f}from"./usePhoneShell-cDHpi_4q.js";var p=e(r(),1),m=i(),h=`pisper-floating-widgets`;function g(){(0,p.useEffect)(()=>{try{n.getItem(h)!==null&&n.removeItem(h)}catch{}},[])}function _({activeSessionId:e,notify:n}){let r=f(),i=t().pathname,h=i===a.components||i.startsWith(`${a.components}/`),_=u(`floating`),v=l(),[y]=(0,p.useState)(d),b=o();return g(),(0,m.jsxs)(m.Fragment,{children:[y&&v>0&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(s,{notify:n,disableAll:b})}),!r&&_.placed.length>0&&(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(c,{placed:_.placed,hidden:h,activeSessionId:e,notify:n})})]})}export{_ as FloatingWidgets};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,n,r}from"./vendor-react-DwNgTV1j.js";import{d as i,u as a}from"./i18n-BjpQE1sJ.js";import{t as o}from"./use-i18n-BIJtH0nB.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./braces-DQcXLGFF.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{r as d}from"./dist-V8chnW6-.js";import{t as f}from"./file-text-N9JICX6E.js";import{t as p}from"./search-D0mqDaf_.js";import{i as m,t as h}from"./dist-41X0pdUs.js";import{c as g,n as _}from"./dist-BsRXXcSL.js";import{a as v,o as y,r as b,t as x}from"./dist-BHkR6BLP.js";import{i as S,n as C,t as w}from"./popover-BqqbRCrL.js";import{t as T}from"./slider-DTmAZl-R.js";import{t as E}from"./utils-C8uzG5AZ.js";import{n as D,o as O,r as k,t as A}from"./sheet-BTaIEX4w.js";import{r as j}from"./format-DMJQzoZ7.js";import"./dialog-Bs9_FZX7.js";import{n as M,t as N}from"./input-group-CDEyjyK4.js";import{t as P}from"./model-display-kDwvtxrW.js";import{i as F}from"./run-activity-CwfO0cui.js";var ee=s(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),I=e(t(),1);function te(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function L(e,t,n,r){return n.length?[{invocation:`/${e}`,description:t},...n.map(t=>({invocation:`/${e} ${t.value}`,description:t.label,current:t.current,run:()=>r(t.value)}))]:[]}function ne({t:e,models:t,model:n,onModel:r,thinkingLevels:i,thinkingLevel:a,thinkingLabel:o,onThinking:s,executionModes:c,executionMode:l,executionLabel:u,onExecutionMode:d,runModes:f,runMode:p,runModeLabel:m,onRunMode:h}){return[...L(`model`,e(`chat:commands.builtin.model`),t.map(e=>({value:e.key,label:e.providerName?`${e.label} · ${e.providerName}`:e.label,current:e.key===n})),r),...L(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...L(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?L(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:m(e),current:e===p})),h):[]]}function re(e,t,n){let r=e=>e.toLocaleLowerCase(n),i=r(t),a=i.search(/\s/);if(a<0)return e.filter(e=>!e.invocation.includes(` `)&&r(`${e.invocation} ${e.description}`).includes(i));let o=`/${i.slice(0,a)} `,s=i.slice(a).trim();return e.filter(e=>r(e.invocation).startsWith(o)&&r(`${e.invocation} ${e.description}`).includes(s))}var ie=10485760,ae=20971520,oe=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),se=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),ce=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),le=[`image/*`,`text/*`,`application/json`,...[...se,...oe,...ce].map(e=>`.${e}`)].join(`,`);function ue(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function de(e){return[...e?.types||[]].includes(`Files`)}function fe(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(String(i.result).split(`,`)[1]||``),i.onerror=()=>r(i.error||Error(t(`chat:attachments.couldNotReadFile`))),i.readAsDataURL(e)})}function pe(e){return e.toLowerCase().split(`.`).at(-1)||``}async function me(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>ie)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=pe(e.name),i={id:`${e.name}-${e.lastModified}-${e.size}`,name:e.name,mimeType:e.type||`application/octet-stream`,size:e.size};if(e.type.startsWith(`image/`)||se.has(n))r.push({...i,kind:`image`,data:await fe(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||oe.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(ce.has(n))r.push({...i,kind:`document`,extension:n,data:await fe(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function he(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function ge(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:he(e),path:e}))}function _e(e=[],t,n){let r=(0,I.useCallback)((e,t)=>i(e,a(),t),[]),[o,s]=(0,I.useState)(()=>[...e]),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)([]),f=(0,I.useRef)(new Map),p=(0,I.useRef)(0),m=(0,I.useRef)(n);m.current=n,(0,I.useEffect)(()=>{let e=f.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let h=(0,I.useRef)([...e]),g=(0,I.useCallback)(e=>{h.current=e,s(e),t?.(e)},[t]),_=(0,I.useCallback)(async e=>{let t=n,i=[...e||[]].slice(0,8).map(e=>{let t=`preparing-${++p.current}`,n={name:e.name,cancelled:!1};return f.current.set(t,n),{id:t,job:n,file:e}}),a=()=>d([...f.current].map(([e,t])=>({id:e,name:t.name})));a(),l(``);let o=!1;for(let{id:e,job:n,file:s}of i)try{let i=await me([s],r);if(n.cancelled||m.current!==t||!f.current.has(e))continue;let a=[...h.current,...i].slice(0,8);if(a.filter(e=>e.kind!==`path`).reduce((e,t)=>e+(t.size||0),0)>ae)throw Error(r(`chat:attachments.totalAttachmentSizeCannotExceed20MB`));g(a),o=!0}catch(e){!n.cancelled&&m.current===t&&l(e instanceof Error?e.message:String(e))}finally{f.current.delete(e),m.current===t&&a()}return o},[n,g,r]);return{attachments:o,attachmentError:c,preparingAttachments:u,addFiles:_,pasteFiles:(0,I.useCallback)(e=>{let t=ue(e.clipboardData);t.length&&(e.preventDefault(),_(t))},[_]),dropFiles:(0,I.useCallback)(e=>{if(!de(e.dataTransfer))return;e.preventDefault();let t=ue(e.dataTransfer);t.length&&_(t)},[_]),removeAttachment:(0,I.useCallback)(e=>{let t=f.current.get(e);if(t){t.cancelled=!0,f.current.delete(e),d([...f.current].map(([e,t])=>({id:e,name:t.name})));return}g(h.current.filter(t=>t.id!==e))},[g]),clearAttachments:(0,I.useCallback)(()=>{for(let e of f.current.values())e.cancelled=!0;f.current.clear(),d([]),g([])},[g]),addAttachments:(0,I.useCallback)(e=>{if(m.current!==n)return;l(``);let t=[...h.current];for(let n of e)t.some(e=>e.id===n.id)||t.push(n);g(t.slice(0,8))},[n,g]),replaceAttachments:g,setError:(0,I.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var R=new Map,z=new Map;function ve(e,t){let n=t.match(/^\/[^\s]*(?:\s+([\s\S]*))?$/),r=(n?n[1]||``:t).trim();return`${e}${r?` ${r}`:` `}`}function ye(e){return{text:e?.text||``,attachments:[...e?.attachments||[]]}}function B(e){return ye(R.get(e))}function V(e,t){if(!e)return;let n={...B(e),...t};n.attachments=[...n.attachments];let r=B(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&z.set(e,(z.get(e)||0)+1),R.delete(e),!(!n.text&&!n.attachments.length)&&R.set(e,n))}function be(e){z.set(e,(z.get(e)||0)+1),R.delete(e)}function xe(e,t){let n=[...e.attachments],r=new Set(n.map(e=>e.id));for(let e of t.attachments){let t=e.id;if(!t||r.has(t)){let n=1;do t=`${e.id||`attachment`}-restored-${n++}`;while(r.has(t))}r.add(t),n.push({...e,id:t})}return{text:e.text&&t.text?`${e.text}\n${t.text}`:e.text||t.text,attachments:n}}function Se(e){let t=(0,I.useRef)(e);t.current=e;let n=(0,I.useRef)(!0);(0,I.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,I.useRef)(B(e)),[i,a]=(0,I.useState)(r.current.text),o=(0,I.useCallback)(t=>V(e,{attachments:t}),[e]),s=_e(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,I.useEffect)(()=>{let t=B(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,I.useCallback)(t=>{a(t),V(e,{text:t})},[e]),selection:s,clearDraft:(0,I.useCallback)(()=>{let r=B(e);r.text!==i||r.attachments.length!==s.attachments.length||r.attachments.some((e,t)=>e!==s.attachments[t])||(be(e),!(!n.current||t.current!==e)&&(a(``),l()))},[l,s.attachments,e,i]),restoreDraft:(0,I.useCallback)(r=>{let i=xe(B(e),r);return V(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,I.useCallback)(()=>{let r=B(e),i=z.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=B(e),l={text:(z.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};V(e,l),!(!n.current||t.current!==e)&&(a(l.text),c(l.attachments))}}},[c,e])}}var Ce=e(n(),1);function we({anchor:e,menu:t,viewport:n,placement:r=`top`,align:i=`start`,maxHeight:a=1/0}){let o=n.top+8,s=Math.max(o,n.top+n.height-8),c=n.left+8,l=Math.max(c,n.left+n.width-8),u={top:Math.max(0,Math.min(e.top,s)-o-8),bottom:Math.max(0,s-Math.max(e.bottom,o)-8)},d=Math.min(t.height,a),f=r===`top`?`bottom`:`top`,p=d>u[r]&&u[f]>u[r]?f:r,m=Math.min(a,u[p]),h=Math.min(d,m),g=Math.min(t.width,l-c);return{side:p,left:Math.max(c,Math.min(i===`end`?e.right-g:e.left,l-g)),top:Math.max(o,Math.min(p===`top`?e.top-8-h:e.bottom+8,s-h)),width:g,maxHeight:m}}var H=r();function Te({open:e,anchorRef:t,menuRef:n,placement:r=`top`,align:i=`start`,matchAnchorWidth:a=!1,maxHeight:o,id:s,className:c,role:l,ariaLabel:u,onClose:d,children:f}){return(0,I.useEffect)(()=>{if(!e||!d)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),d())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,d]),(0,I.useLayoutEffect)(()=>{if(!e)return;let s=()=>{let e=n.current,s=t.current;if(!e||!s)return;let c=s.getBoundingClientRect(),l=window.visualViewport;e.style.width=a?`${c.width}px`:``;let u=we({anchor:c,menu:{width:e.getBoundingClientRect().width,height:e.scrollHeight},viewport:{left:l?.offsetLeft??0,top:l?.offsetTop??0,width:l?.width??window.innerWidth,height:l?.height??window.innerHeight},placement:r,align:i,maxHeight:o});e.dataset.side=u.side,e.style.maxHeight=`${u.maxHeight}px`,e.style.overflowY=`auto`,e.style.width=`${u.width}px`,e.style.top=`${u.top}px`,e.style.bottom=`auto`,e.style.right=`auto`,e.style.left=`${u.left}px`};s();let c=null,l=()=>{c===null&&(c=window.requestAnimationFrame(()=>{c=null,s()}))},u=typeof ResizeObserver>`u`?null:new ResizeObserver(l);return n.current&&u?.observe(n.current),t.current&&u?.observe(t.current),window.addEventListener(`resize`,s),window.addEventListener(`scroll`,s,!0),window.visualViewport?.addEventListener(`resize`,l),window.visualViewport?.addEventListener(`scroll`,l),()=>{u?.disconnect(),c!==null&&window.cancelAnimationFrame(c),window.removeEventListener(`resize`,s),window.removeEventListener(`scroll`,s,!0),window.visualViewport?.removeEventListener(`resize`,l),window.visualViewport?.removeEventListener(`scroll`,l)}},[e,t,n,r,i,a,o]),e?(0,Ce.createPortal)((0,H.jsx)(`div`,{ref:n,id:s,className:c,style:{position:`fixed`,zIndex:65},role:l,"aria-label":u,children:f}),document.body):null}function Ee({resourceKey:e,loadCommands:t,builtinCommands:n=[],value:r,onChange:i,inputRef:a,placement:s=`top`}){let{t:u,language:d}=o(),p=(0,I.useId)(),m=(0,I.useRef)(null),h=r.match(/^\/([^\n]{0,120})$/),[g,_]=(0,I.useState)(``),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(0),E=h?.[1]||``,D=/\s/.test(E),O=(0,I.useRef)(t);O.current=t;let k=(0,I.useMemo)(()=>re(n,E,d),[n,d,E]),A=!!(h&&g!==r&&(!D||k.length));(0,I.useEffect)(()=>{_(``),y(null),C(!1)},[e]),(0,I.useEffect)(()=>{if(!A||v)return;let e=!0;return x(!0),C(!1),O.current().then(t=>{e&&y(t.commands||[])}).catch(()=>{e&&(y([]),C(!0))}).finally(()=>e&&x(!1)),()=>{e=!1}},[v,A,e]);let j=(0,I.useMemo)(()=>{let e=k.map(e=>({kind:`builtin`,command:e}));if(D)return e;let t=E.toLocaleLowerCase(d),n=(v||[]).filter(e=>!t||`${e.invocation} ${e.name} ${e.description}`.toLocaleLowerCase(d).includes(t));return[...e,...n.map(e=>({kind:`resource`,command:e}))]},[D,k,v,d,E]);(0,I.useEffect)(()=>{T(0)},[E,v]);let M=()=>{_(r)},N=e=>{if(e.kind===`builtin`){let t=e.command.run?``:`${e.command.invocation} `;i(t),_(``),T(0),e.command.run&&e.command.run(),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length))});return}let t=ve(e.command.invocation,r);i(t),_(t),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)})};(0,I.useEffect)(()=>{if(!A)return;let e=e=>{if(document.activeElement===a.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),M();return}j.length&&(e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),T(e=>(e+1)%j.length)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),T(e=>(e-1+j.length)%j.length)):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),N(j[Math.min(w,j.length-1)])))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}),(0,I.useEffect)(()=>{let e=a.current;if(!A||!e)return;let t={role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":p,"aria-activedescendant":j.length?`${p}-${Math.min(w,j.length-1)}`:``},n=Object.keys(t).map(t=>[t,e.getAttribute(t)]);for(let[n,r]of Object.entries(t))r?e.setAttribute(n,r):e.removeAttribute(n);return()=>{for(let[t,r]of n)t&&(r===null?e.removeAttribute(t):e.setAttribute(t,r))}},[w,a,p,A,j.length]);let P={user:u(`chat:commands.scope.user`),project:u(`chat:commands.scope.project`),package:u(`chat:commands.scope.package`),custom:u(`chat:commands.scope.custom`)};return(0,H.jsx)(Te,{open:A,anchorRef:a,menuRef:m,placement:s,matchAnchorWidth:!0,maxHeight:330,id:p,role:`listbox`,ariaLabel:u(`chat:commands.open`),className:`permission-mode-menu composer-command-menu overflow-y-auto rounded-md bg-solid p-1 text-content shadow-float`,children:(0,H.jsxs)(`div`,{className:`chat-resource-list composer-command-list flex min-h-0 [flex:1_1_0] flex-col gap-px overflow-y-auto [overscroll-behavior:contain] [scrollbar-gutter:stable] [touch-action:pan-y] [&_>_button]:grid [&_>_button]:w-full [&_>_button]:cursor-pointer [&_>_button]:grid-cols-[28px_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-2 [&_>_button]:rounded-sm [&_>_button]:px-1.5 [&_>_button]:py-1 [&_>_button]:text-left [&_>_button]:text-content [&_>_button.active]:bg-surface-hover max-[650px]:[&_>_button]:min-h-11 [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-[13px] [&_strong]:font-medium [&_small]:truncate [&_small]:font-sans [&_small]:text-xs [&_small]:font-normal [&_small]:text-content-muted [&_em]:text-xs [&_em]:whitespace-nowrap [&_em]:text-content-muted [&_em]:not-italic [&_>_p]:m-auto [&_>_p]:px-2 [&_>_p]:py-1.5 [&_>_p]:text-xs [&_>_p]:text-content-muted`,children:[j.map((e,t)=>{let{command:n}=e,r=e.kind===`builtin`?e.command.current?l:ee:e.command.source===`prompt`?f:c,i=e.kind===`resource`?e.command:null;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,id:`${p}-${t}`,"aria-selected":t===w,className:t===w?`active`:``,onMouseEnter:()=>T(t),onMouseDown:e=>e.preventDefault(),onClick:()=>N(e),children:[(0,H.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,H.jsx)(r,{size:15})}),(0,H.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,H.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,H.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,H.jsx)(`small`,{children:n.description||u(`chat:commands.noDescription`)})]}),(0,H.jsx)(`em`,{children:i?(0,H.jsxs)(H.Fragment,{children:[i.source===`prompt`?u(`chat:commands.prompt`):u(`chat:commands.skill`),` · `,P[i.scope]]}):e.kind===`builtin`&&e.command.current?u(`chat:commands.builtin.current`):u(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!j.length&&(0,H.jsx)(`p`,{children:u(b?`chat:commands.loading`:S?`chat:commands.loadError`:`chat:commands.empty`)})]})})}function De({levels:e,value:t,labelFor:n,onCommit:r,disabled:i=!1,ariaLabel:a,title:o,trailing:s,className:c}){let[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(!1),p=(0,I.useRef)(!1),m=Math.max(0,e.indexOf(t)),h=l??m,g=n(e[h]||t),_=i||d||e.length<2,v=e.join(`|`);(0,I.useEffect)(()=>{u(null)},[t,v]);let y=async n=>{let i=e[n];if(_||p.current||!i||i===t){u(null);return}p.current=!0,f(!0);try{await r(i)}finally{p.current=!1,f(!1),u(null)}};return(0,H.jsxs)(`div`,{className:E(`min-w-0`,c),children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 px-0.5 pb-1`,children:[o&&(0,H.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:o}),(0,H.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-[13px] leading-5 font-medium text-accent-fg`,"aria-live":`polite`,children:g}),s]})]}),(0,H.jsx)(T,{className:E(`h-7`,`[&_[data-slot=slider-range]]:bg-[linear-gradient(90deg,var(--star-border),var(--star))]`,`[&_[data-slot=slider-thumb]]:size-4 [&_[data-slot=slider-thumb]]:bg-[radial-gradient(circle,var(--star)_0_2px,var(--key-bg)_2.5px)]`),showSteps:!0,min:0,max:Math.max(1,e.length-1),step:1,value:[h],disabled:_,"aria-label":a,valueText:g,onValueChange:([e])=>u(e),onValueCommit:([e])=>void y(e)}),e.length>1&&(0,H.jsxs)(`div`,{className:`flex justify-between px-0.5 pt-0.5 text-xs text-content-faint`,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{children:n(e[0])}),(0,H.jsx)(`span`,{children:n(e.at(-1)||``)})]})]})}var Oe=96,ke=.6,Ae=`10%`;function je({onDismiss:e,className:t}){let n=(0,I.useRef)(null),r=e=>{e.sheet.style.transform=``,e.sheet.style.transition=``},i=e=>{if(e.button!==0)return;let t=e.currentTarget.closest(`[data-slot="sheet-content"]`);t&&(e.currentTarget.setPointerCapture?.(e.pointerId),t.style.transition=`none`,n.current={pointerId:e.pointerId,startY:e.clientY,startAt:performance.now(),sheet:t,offset:0})},a=e=>{let t=n.current;!t||t.pointerId!==e.pointerId||(t.offset=Math.max(0,e.clientY-t.startY),t.sheet.style.transform=`translateY(${t.offset}px)`)},o=t=>{let{sheet:n}=t;n.style.setProperty(`--tw-exit-translate-y`,`calc(${t.offset}px + ${Ae})`);let i=()=>{n.removeEventListener(`animationstart`,a),r(t),n.style.removeProperty(`--tw-exit-translate-y`)},a=e=>{e.target===n&&n.dataset.state!==`closed`&&i()};n.addEventListener(`animationstart`,a),e(),requestAnimationFrame(()=>{n.isConnected&&n.dataset.state!==`closed`&&i()})},s=e=>{let t=n.current;if(!t||t.pointerId!==e.pointerId)return;n.current=null;let i=t.offset/Math.max(1,performance.now()-t.startAt);if(t.offset>=Oe||t.offset>24&&i>=ke){o(t);return}r(t)},c=()=>{let e=n.current;n.current=null,e&&r(e)};return(0,H.jsx)(`div`,{"aria-hidden":`true`,"data-sheet-drag-handle":!0,className:E(`flex h-8 w-full flex-none cursor-grab touch-none items-start justify-center select-none active:cursor-grabbing`,t),onPointerDown:i,onPointerMove:a,onPointerUp:s,onPointerCancel:c,onLostPointerCapture:c,children:(0,H.jsx)(`span`,{className:`mt-2.5 h-1 w-9 rounded-full bg-stroke-strong`})})}function Me({sheet:e,title:t,trigger:n,children:r,open:i,onOpenChange:a,align:o,side:s,sideOffset:c,className:l,sheetClassName:u}){let[d,f]=(0,I.useState)(!1),p=i??d,m=e=>{i===void 0&&f(e),a?.(e)};return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{"aria-haspopup":`dialog`,"aria-expanded":p,onClick:()=>m(!0),children:n}),(0,H.jsx)(A,{open:p,onOpenChange:m,children:(0,H.jsxs)(D,{side:`bottom`,showCloseButton:!1,"data-popover-sheet":!0,className:E(`max-h-[85dvh] gap-1 overflow-y-auto rounded-t-(--r-sheet) px-3 pt-1 pb-[calc(12px+var(--pisper-safe-area-bottom))]`,u),children:[(0,H.jsx)(je,{onDismiss:()=>m(!1)}),(0,H.jsx)(O,{className:`px-2 pt-1 pb-1 text-base font-semibold`,children:t}),(0,H.jsx)(k,{className:`sr-only`,children:t}),r]})})]}):(0,H.jsxs)(w,{open:p,onOpenChange:m,children:[(0,H.jsx)(S,{asChild:!0,children:n}),(0,H.jsx)(C,{align:o,side:s,sideOffset:c,className:l,children:r})]})}var Ne=1,Pe=.9,Fe=.8,Ie=.17,U=.1,Le=.999,Re=.9999,ze=.99,Be=/[\\\/_+.#"@\[\(\{&]/,Ve=/[\\\/_+.#"@\[\(\{&]/g,He=/[\s-]/,Ue=/[\s-]/g;function We(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ne:ze;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=We(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ne:Be.test(e.charAt(l-1))?(d*=Fe,p=e.slice(i,l-1).match(Ve),p&&i>0&&(d*=Le**+p.length)):He.test(e.charAt(l-1))?(d*=Pe,m=e.slice(i,l-1).match(Ue),m&&i>0&&(d*=Le**+m.length)):(d*=Ie,i>0&&(d*=Le**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Re)),(d<U&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=We(e,t,n,r,l+1,a+2,o),f*U>d&&(d=f*U)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ge(e){return e.toLowerCase().replace(Ue,` `)}function Ke(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,We(e,t,Ge(e),Ge(t),0,0,{})}var W=`[cmdk-group=""]`,qe=`[cmdk-group-items=""]`,Je=`[cmdk-group-heading=""]`,Ye=`[cmdk-item=""]`,Xe=`${Ye}:not([aria-disabled="true"])`,Ze=`cmdk-item-select`,G=`data-value`,Qe=(e,t,n)=>Ke(e,t,n),$e=I.createContext(void 0),K=()=>I.useContext($e),et=I.createContext(void 0),q=()=>I.useContext(et),tt=I.createContext(void 0),nt=I.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=pt(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:v=!0,...y}=e,b=_(),x=_(),S=_(),C=I.useRef(null),w=ht();Y(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),Y(()=>{w(6,j)},[]);let T=I.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=I.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=s.current?.filter??Qe;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(qe);t?t.appendChild(e.parentElement===t?e:e.closest(`${qe} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qe} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${W}[${G}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(G);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector(Je))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${Ye}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(Xe)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(G))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(G))}function ee(e){let t=M()?.closest(W),n;for(;t&&!n;)t=e>0?dt(t,W):ft(t,W),n=t?.querySelector(Xe);n?T.setState(`value`,n.getAttribute(G)):F(e)}let te=()=>P(N().length-1),L=e=>{e.preventDefault(),e.metaKey?te():e.altKey?ee(1):F(1)},ne=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?ee(-1):F(-1)};return I.createElement(g.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:v&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),te();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(Ze);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:_t},c),Q(e,e=>I.createElement(et.Provider,{value:T},I.createElement($e.Provider,{value:E},e))))}),rt=I.forwardRef((e,t)=>{let n=_(),r=I.useRef(null),i=I.useContext(tt),a=K(),o=pt(e),s=o.current?.forceMount??i?.forceMount;Y(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=mt(n,r,[e.value,e.children,r],e.keywords),l=q(),u=Z(e=>e.value&&e.value===c.current),d=Z(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);I.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ze,f),()=>t.removeEventListener(Ze,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:h,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return I.createElement(g.div,{ref:m(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:p,onClick:h?void 0:f},e.children)}),it=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=_(),s=I.useRef(null),c=I.useRef(null),l=_(),u=K(),d=Z(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Y(()=>u.group(o),[]),mt(o,s,[e.value,e.heading,c]);let f=I.useMemo(()=>({id:o,forceMount:i}),[i]);return I.createElement(g.div,{ref:m(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&I.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},I.createElement(tt.Provider,{value:f},e))))}),at=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),a=Z(e=>!e.search);return!n&&!a?null:I.createElement(g.div,{ref:m(i,t),...r,"cmdk-separator":``,role:`separator`})}),ot=I.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=q(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.createElement(g.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),st=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=I.useRef(null),o=I.useRef(null),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),I.createElement(g.div,{ref:m(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Q(e,e=>I.createElement(`div`,{ref:m(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ct=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(x,{open:n,onOpenChange:r},I.createElement(y,{container:o},I.createElement(v,{"cmdk-overlay":``,className:i}),I.createElement(b,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(nt,{ref:t,...s}))))}),lt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(g.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ut=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.createElement(g.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>I.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(nt,{List:st,Item:rt,Input:ot,Group:it,Separator:at,Dialog:ct,Empty:lt,Loading:ut});function dt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ft(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function pt(e){let t=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function mt(e,t,n,r=[]){let i=I.useRef(),a=K();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(G,s),i.current=s}),i}var ht=()=>{let[e,t]=I.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function gt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&I.isValidElement(t)?I.cloneElement(gt(t),{ref:t.ref},n(t.props.children)):n(t)}var _t={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function vt({className:e,...t}){return(0,H.jsx)(J,{"data-slot":`command`,className:E(`flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground`,e),...t})}function yt({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,H.jsxs)(N,{className:`h-8! rounded-sm! border-stroke bg-surface-subtle shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,H.jsx)(J.Input,{"data-slot":`command-input`,className:E(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,H.jsx)(M,{children:(0,H.jsx)(p,{className:`size-4 shrink-0 opacity-50`})})]})})}function bt({className:e,...t}){return(0,H.jsx)(J.List,{"data-slot":`command-list`,className:E(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function xt({className:e,...t}){return(0,H.jsx)(J.Empty,{"data-slot":`command-empty`,className:E(`py-6 text-center text-sm`,e),...t})}function St({className:e,...t}){return(0,H.jsx)(J.Group,{"data-slot":`command-group`,className:E(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Ct({className:e,children:t,...n}){return(0,H.jsxs)(J.Item,{"data-slot":`command-item`,className:E(`group/command-item relative flex min-h-7.5 max-[650px]:min-h-11 pointer-coarse:min-h-11 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,H.jsx)(l,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function wt(e,t){let n=t.find(t=>t.key===e);return n?`${n.providerName} · ${n.label}`:e.split(`/`).at(-1)||e}function Tt({model:e,availableModels:t,sessionUsage:n,contextUsage:r}){let{t:i,language:a}=o(),s=n?.timing&&typeof n.timing==`object`?n.timing:null,c=Math.max(0,Number(s?.firstTokenSamples)||0),l=Math.max(0,Number(s?.requests)||0),u=c>0?Number(s?.firstTokenTotalMs)/c:null,d=l>0?Number(s?.durationTotalMs)/l:null,f=r?.tokens==null?null:Math.max(0,Number(r.tokens)||0),p=!!n?.cacheReported,m=[[i(`chat:focusSession.statCurrentModel`),e?wt(e,t||[]):`—`],[i(`chat:focusSession.statContextTokens`),f==null?`—`:`${j(f)} / ${j(r?.contextWindow)}`],[i(`chat:focusSession.statInputTokens`),j(n?.input)],[i(`chat:focusSession.statOutputTokens`),j(n?.output)],[i(`chat:focusSession.statCacheReadTokens`),p?j(n?.cacheRead):`—`],[i(`chat:focusSession.statCacheWriteTokens`),p?j(n?.cacheWrite):`—`],[i(`chat:focusSession.statReasoningTokens`),j(n?.reasoning)],[i(`chat:focusSession.statProcessedTokens`),j(n?.processedTokens)],[i(`chat:focusSession.statRequests`),String(Math.max(0,Number(n?.requests)||0))],[i(`chat:focusSession.statAvgFirstToken`),u==null?`—`:F(u,a)],[i(`chat:focusSession.statAvgDuration`),d==null?`—`:F(d,a)]];return(0,H.jsxs)(`div`,{className:`session-stats-panel grid gap-[3px]`,"aria-label":i(`chat:focusSession.sessionStats`),children:[m.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-[10px] text-[length:var(--app-small-size)]`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink-0 text-[var(--text-muted)]`,children:e}),(0,H.jsx)(`strong`,{className:`min-w-0 truncate text-right font-[500] text-[var(--text)] [font-variant-numeric:tabular-nums]`,children:t})]},e)),(0,H.jsx)(`small`,{className:`text-[var(--text-secondary)] text-[length:var(--app-small-size)] leading-normal`,children:i(`chat:focusSession.sessionStatsHint`)})]})}function Et({usage:e,sessionUsage:t,model:n,availableModels:r,onThresholdChange:i}){let{t:a}=o(),s=Number(e?.contextWindow)||0,c=e?.compactAtPercent==null?80:Number(e.compactAtPercent),l=Number.isFinite(c)?Math.round(c):80,[d,f]=(0,I.useState)(l),[p,m]=(0,I.useState)(!1),[h,g]=(0,I.useState)(``),_=(0,I.useRef)(l),v=(0,I.useRef)(void 0);(0,I.useEffect)(()=>{window.clearTimeout(v.current),f(l),_.current=l},[l]),(0,I.useEffect)(()=>()=>window.clearTimeout(v.current),[]);let y=e?.percent!=null&&Number.isFinite(Number(e.percent))?Math.max(0,Number(e?.percent)):null,b=Math.max(0,Number(t?.processedTokens)||0),x=Number(t?.cacheHitRate),S=t?.cacheHitRate!=null&&Number.isFinite(x),C=s?`${e?.tokens==null?`—`:j(e.tokens)} / ${j(s)}${y==null?``:` · ${Math.round(y)}%`}`:``,w=e?.autoCompactEnabled&&e.compactionCapacityPercent!=null?a(`chat:focusSession.contextUsageToCompactionTokensPercent`,{percent:Math.round(Number(e.compactionCapacityPercent)),tokens:j(e.remainingBeforeCompaction)}):``,E=async e=>{let t=Math.min(95,Math.max(10,Math.round(e)));if(f(t),!(!i||t===_.current)){m(!0),g(``);try{await i(t),_.current=t}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},D=e=>{window.clearTimeout(v.current),f(e),v.current=window.setTimeout(()=>void E(e),250)},O=e=>{window.clearTimeout(v.current),E(e)},k=(e,t,n,r)=>(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-usage-row":n,title:r,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:e}),(0,H.jsx)(`strong`,{className:`min-w-0 truncate text-right font-medium text-content tabular-nums`,children:t})]});return(0,H.jsxs)(`div`,{className:`context-usage-section grid gap-1.5 border-t border-stroke-soft px-2 pt-2 pb-1.5`,"data-context-usage":!0,children:[C&&(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[k(a(`board:composer.contextUsage`),C,`context`),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`block h-[3px] overflow-hidden rounded-full bg-surface-active`,children:(0,H.jsx)(`span`,{className:`block h-full rounded-full bg-content-secondary`,style:{width:`${Math.min(100,y||0)}%`}})})]}),b>0&&k(a(`board:composer.sessionTokens`),a(`board:composer.tokens`,{tokens:j(b)}),`tokens`),k(a(`board:composer.cacheHitLabel`),S?`${Math.round(Math.max(0,x))}%`:`—`,`cache`,S?void 0:a(`chat:focusSession.cacheHitRateUnavailable`)),s>0&&(0,H.jsxs)(`details`,{className:`group/usage min-w-0 text-xs`,onToggle:e=>{let t=e.currentTarget;t.open&&requestAnimationFrame(()=>t.scrollIntoView({block:`nearest`}))},children:[(0,H.jsxs)(`summary`,{className:`flex min-h-7 cursor-pointer list-none items-center gap-1 rounded-sm text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:outline-focus max-[650px]:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(u,{size:13,"aria-hidden":`true`,className:`transition-transform duration-(--d-fast) group-open/usage:rotate-90`}),a(`chat:focusSession.sessionStats`)]}),(0,H.jsxs)(`div`,{className:`grid gap-2 pt-1.5`,children:[(0,H.jsx)(Tt,{model:n,availableModels:r,sessionUsage:t,contextUsage:e}),w&&(0,H.jsx)(`small`,{className:`text-content-muted`,children:w}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between font-medium text-content`,children:[(0,H.jsx)(`span`,{children:a(`chat:focusSession.autoCompactionThreshold`)}),(0,H.jsxs)(`output`,{className:`tabular-nums`,children:[d,`%`]})]}),(0,H.jsx)(T,{min:10,max:95,step:1,value:[d],className:`h-5 w-full`,"aria-label":a(`chat:focusSession.autoCompactionThreshold`),valueText:`${d}%`,disabled:p,onValueChange:([e])=>D(e),onValueCommit:([e])=>O(e)}),(0,H.jsx)(`small`,{className:h?`text-danger`:`text-content-muted`,children:h||(p?a(`chat:focusSession.savingCompactionThreshold`):`\xA0`)})]})]})]})}function $(e,t){return{off:e(`chat:focusSession.thinkingLabel.off`),minimal:e(`chat:focusSession.thinkingLabel.minimal`),low:e(`chat:focusSession.thinkingLabel.low`),medium:e(`chat:focusSession.thinkingLabel.medium`),high:e(`chat:focusSession.thinkingLabel.high`),xhigh:e(`chat:focusSession.thinkingLabel.xhigh`),max:e(`chat:focusSession.thinkingLabel.max`)}[t]||t}function Dt({model:e,models:t,onModelChange:n,thinkingLevel:r,levels:i,status:a,message:s,onThinkingChange:c,modelDisabled:l,thinkingDisabled:u,deferred:f=!1,pendingModel:p=!1,usage:m,sheet:h=!1,side:g=`top`,thinkingIsDefault:_=!1,onThinkingReset:v,triggerClassName:y}){let{t:b}=o(),[x,S]=(0,I.useState)(!1),C=t.find(t=>t.key===e),w=t.map(e=>e.label),T=C?.label||e.split(`/`).at(-1)||``,D=T?P(T,w):b(`chat:focusSession.toolbarModel`),O=[...t.reduce((e,t)=>{let n=e.get(t.providerName)||[];return n.push(t),e.set(t.providerName,n)},new Map)],k=a!==`unsupported`&&i.length>0,A=k?$(b,r||i[0]):`—`,j=p?b(`chat:focusSession.thinkingAfterModelSwitch`):k?A:s||b(a===`unsupported`?`chat:focusSession.thinkingLevelUnsupported`:`chat:focusSession.loadingThinkingLevels`),M=u||x||!k||i.length<2,N=`${b(`chat:focusSession.modelAndThinking`)} · ${wt(e,t)} · ${j}`;return(0,H.jsxs)(Me,{sheet:h,title:b(`chat:focusSession.modelAndThinking`),align:`end`,side:g,sideOffset:8,className:`model-effort-popover w-[272px] max-w-[calc(100vw_-_24px)] gap-0 p-1`,trigger:(0,H.jsxs)(`button`,{type:`button`,className:E(`model-effort-pill inline-flex h-[30px] min-w-0 max-w-[260px] cursor-pointer items-center gap-1.5 rounded-sm border border-transparent pr-1.5 pl-2.5 text-[13px] text-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60 aria-expanded:bg-surface-hover max-[650px]:h-11 max-[650px]:gap-1 max-[650px]:rounded-md max-[650px]:border-stroke max-[650px]:pr-2 max-[650px]:pl-2.5 max-[650px]:text-sm pointer-coarse:h-11`,y),"aria-label":N,title:N,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:D}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,H.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:k?$(b,r||i[0]):`—`}),(0,H.jsx)(d,{size:14,className:`shrink-0 text-content-muted`,"aria-hidden":`true`})]}),children:[(0,H.jsxs)(`div`,{className:`model-effort-model flex flex-col gap-1 p-1.5 pb-2`,children:[(0,H.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-content-muted`,children:b(`chat:focusSession.toolbarModel`)}),(0,H.jsxs)(vt,{defaultValue:e,filter:(e,t,n)=>+!![e,...n||[]].join(` `).toLowerCase().includes(t.trim().toLowerCase()),className:`rounded-sm! border border-stroke-soft bg-transparent p-0`,"aria-label":b(`chat:focusSession.currentChatModel`),children:[t.length>6&&(0,H.jsx)(yt,{placeholder:b(`chat:focusSession.searchModels`)}),(0,H.jsxs)(bt,{className:`max-h-56`,children:[(0,H.jsx)(xt,{className:`py-4 text-xs text-content-muted`,children:t.length?b(`chat:focusSession.noMatchingModels`):b(`chat:focusSession.noModelsAvailable`)}),!C&&e&&(0,H.jsx)(St,{children:(0,H.jsx)(Ct,{value:e,"data-checked":!0,disabled:!0,children:(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:D})})}),O.map(([t,r])=>(0,H.jsx)(St,{heading:t,children:r.map(t=>{let r=P(t.label,w);return(0,H.jsx)(Ct,{value:t.key,keywords:[t.label,t.providerName],"data-checked":t.key===e,disabled:l||x,onSelect:()=>{t.key!==e&&n(t.key)},children:(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,title:t.label,children:[(0,H.jsx)(`span`,{className:`wrap-anywhere`,children:r}),r!==t.label&&(0,H.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:t.label})]})},t.key)})},t))]})]})]}),k&&(0,H.jsx)(De,{className:`border-t border-stroke-soft p-1.5 pt-2`,title:b(`chat:focusSession.thinkingLevelTitle`),levels:i,value:r,labelFor:e=>$(b,e),onCommit:async e=>{S(!0);try{await c(e)}finally{S(!1)}},disabled:M,ariaLabel:b(`chat:focusSession.currentThinkingLevel`),trailing:_?(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-content-faint`,children:b(`chat:focusSession.thinkingModelDefault`)}):v?(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 cursor-pointer rounded-sm text-xs text-content-muted underline-offset-2 hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-focus`,onClick:v,children:b(`chat:focusSession.thinkingReset`)}):void 0}),f&&(0,H.jsx)(`p`,{className:`px-2 pt-1 pb-2 text-xs leading-4 text-content-muted`,role:`status`,children:b(`chat:focusSession.runtimeSelectionDeferred`)}),(!k||i.length===1)&&(0,H.jsx)(`p`,{className:`border-t border-stroke-soft px-2 pt-2 pb-1.5 text-xs leading-relaxed text-content-muted`,role:`status`,children:k?b(`chat:focusSession.thinkingLevelFixed`,{level:A}):j}),m]})}export{je as a,ve as c,Se as d,le as f,te as g,ne as h,Me as i,B as l,ge as m,Dt as n,Ee as o,de as p,$ as r,be as s,Et as t,V as u};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,n,r}from"./vendor-react-DwNgTV1j.js";import{d as i,u as a}from"./i18n-CHHZADSh.js";import{t as o}from"./use-i18n-BWyVtWF9.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./braces-DQcXLGFF.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{r as d}from"./dist-V8chnW6-.js";import{t as f}from"./file-text-N9JICX6E.js";import{t as p}from"./search-D0mqDaf_.js";import{i as m,t as h}from"./dist-41X0pdUs.js";import{c as g,n as _}from"./dist-BsRXXcSL.js";import{a as v,o as y,r as b,t as x}from"./dist-BHkR6BLP.js";import{i as S,n as C,t as w}from"./popover-4UKNni3P.js";import{t as T}from"./slider-DTmAZl-R.js";import{t as E}from"./utils-C8uzG5AZ.js";import{n as D,o as O,r as k,t as A}from"./sheet-BTaIEX4w.js";import{r as j}from"./format-DMJQzoZ7.js";import"./dialog-CfgIErMS.js";import{n as M,t as N}from"./input-group-h8z63MzW.js";import{t as P}from"./model-display-kDwvtxrW.js";import{i as F}from"./run-activity-CwfO0cui.js";var ee=s(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),I=e(t(),1);function te(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function L(e,t,n,r){return n.length?[{invocation:`/${e}`,description:t},...n.map(t=>({invocation:`/${e} ${t.value}`,description:t.label,current:t.current,run:()=>r(t.value)}))]:[]}function ne({t:e,models:t,model:n,onModel:r,thinkingLevels:i,thinkingLevel:a,thinkingLabel:o,onThinking:s,executionModes:c,executionMode:l,executionLabel:u,onExecutionMode:d,runModes:f,runMode:p,runModeLabel:m,onRunMode:h}){return[...L(`model`,e(`chat:commands.builtin.model`),t.map(e=>({value:e.key,label:e.providerName?`${e.label} · ${e.providerName}`:e.label,current:e.key===n})),r),...L(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...L(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?L(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:m(e),current:e===p})),h):[]]}function re(e,t,n){let r=e=>e.toLocaleLowerCase(n),i=r(t),a=i.search(/\s/);if(a<0)return e.filter(e=>!e.invocation.includes(` `)&&r(`${e.invocation} ${e.description}`).includes(i));let o=`/${i.slice(0,a)} `,s=i.slice(a).trim();return e.filter(e=>r(e.invocation).startsWith(o)&&r(`${e.invocation} ${e.description}`).includes(s))}var ie=10485760,ae=20971520,oe=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),se=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),ce=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),le=[`image/*`,`text/*`,`application/json`,...[...se,...oe,...ce].map(e=>`.${e}`)].join(`,`);function ue(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function de(e){return[...e?.types||[]].includes(`Files`)}function fe(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(String(i.result).split(`,`)[1]||``),i.onerror=()=>r(i.error||Error(t(`chat:attachments.couldNotReadFile`))),i.readAsDataURL(e)})}function pe(e){return e.toLowerCase().split(`.`).at(-1)||``}async function me(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>ie)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=pe(e.name),i={id:`${e.name}-${e.lastModified}-${e.size}`,name:e.name,mimeType:e.type||`application/octet-stream`,size:e.size};if(e.type.startsWith(`image/`)||se.has(n))r.push({...i,kind:`image`,data:await fe(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||oe.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(ce.has(n))r.push({...i,kind:`document`,extension:n,data:await fe(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function he(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function ge(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:he(e),path:e}))}function _e(e=[],t,n){let r=(0,I.useCallback)((e,t)=>i(e,a(),t),[]),[o,s]=(0,I.useState)(()=>[...e]),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)([]),f=(0,I.useRef)(new Map),p=(0,I.useRef)(0),m=(0,I.useRef)(n);m.current=n,(0,I.useEffect)(()=>{let e=f.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let h=(0,I.useRef)([...e]),g=(0,I.useCallback)(e=>{h.current=e,s(e),t?.(e)},[t]),_=(0,I.useCallback)(async e=>{let t=n,i=[...e||[]].slice(0,8).map(e=>{let t=`preparing-${++p.current}`,n={name:e.name,cancelled:!1};return f.current.set(t,n),{id:t,job:n,file:e}}),a=()=>d([...f.current].map(([e,t])=>({id:e,name:t.name})));a(),l(``);let o=!1;for(let{id:e,job:n,file:s}of i)try{let i=await me([s],r);if(n.cancelled||m.current!==t||!f.current.has(e))continue;let a=[...h.current,...i].slice(0,8);if(a.filter(e=>e.kind!==`path`).reduce((e,t)=>e+(t.size||0),0)>ae)throw Error(r(`chat:attachments.totalAttachmentSizeCannotExceed20MB`));g(a),o=!0}catch(e){!n.cancelled&&m.current===t&&l(e instanceof Error?e.message:String(e))}finally{f.current.delete(e),m.current===t&&a()}return o},[n,g,r]);return{attachments:o,attachmentError:c,preparingAttachments:u,addFiles:_,pasteFiles:(0,I.useCallback)(e=>{let t=ue(e.clipboardData);t.length&&(e.preventDefault(),_(t))},[_]),dropFiles:(0,I.useCallback)(e=>{if(!de(e.dataTransfer))return;e.preventDefault();let t=ue(e.dataTransfer);t.length&&_(t)},[_]),removeAttachment:(0,I.useCallback)(e=>{let t=f.current.get(e);if(t){t.cancelled=!0,f.current.delete(e),d([...f.current].map(([e,t])=>({id:e,name:t.name})));return}g(h.current.filter(t=>t.id!==e))},[g]),clearAttachments:(0,I.useCallback)(()=>{for(let e of f.current.values())e.cancelled=!0;f.current.clear(),d([]),g([])},[g]),addAttachments:(0,I.useCallback)(e=>{if(m.current!==n)return;l(``);let t=[...h.current];for(let n of e)t.some(e=>e.id===n.id)||t.push(n);g(t.slice(0,8))},[n,g]),replaceAttachments:g,setError:(0,I.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var R=new Map,z=new Map;function ve(e,t){let n=t.match(/^\/[^\s]*(?:\s+([\s\S]*))?$/),r=(n?n[1]||``:t).trim();return`${e}${r?` ${r}`:` `}`}function ye(e){return{text:e?.text||``,attachments:[...e?.attachments||[]]}}function B(e){return ye(R.get(e))}function V(e,t){if(!e)return;let n={...B(e),...t};n.attachments=[...n.attachments];let r=B(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&z.set(e,(z.get(e)||0)+1),R.delete(e),!(!n.text&&!n.attachments.length)&&R.set(e,n))}function be(e){z.set(e,(z.get(e)||0)+1),R.delete(e)}function xe(e,t){let n=[...e.attachments],r=new Set(n.map(e=>e.id));for(let e of t.attachments){let t=e.id;if(!t||r.has(t)){let n=1;do t=`${e.id||`attachment`}-restored-${n++}`;while(r.has(t))}r.add(t),n.push({...e,id:t})}return{text:e.text&&t.text?`${e.text}\n${t.text}`:e.text||t.text,attachments:n}}function Se(e){let t=(0,I.useRef)(e);t.current=e;let n=(0,I.useRef)(!0);(0,I.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,I.useRef)(B(e)),[i,a]=(0,I.useState)(r.current.text),o=(0,I.useCallback)(t=>V(e,{attachments:t}),[e]),s=_e(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,I.useEffect)(()=>{let t=B(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,I.useCallback)(t=>{a(t),V(e,{text:t})},[e]),selection:s,clearDraft:(0,I.useCallback)(()=>{let r=B(e);r.text!==i||r.attachments.length!==s.attachments.length||r.attachments.some((e,t)=>e!==s.attachments[t])||(be(e),!(!n.current||t.current!==e)&&(a(``),l()))},[l,s.attachments,e,i]),restoreDraft:(0,I.useCallback)(r=>{let i=xe(B(e),r);return V(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,I.useCallback)(()=>{let r=B(e),i=z.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=B(e),l={text:(z.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};V(e,l),!(!n.current||t.current!==e)&&(a(l.text),c(l.attachments))}}},[c,e])}}var Ce=e(n(),1);function we({anchor:e,menu:t,viewport:n,placement:r=`top`,align:i=`start`,maxHeight:a=1/0}){let o=n.top+8,s=Math.max(o,n.top+n.height-8),c=n.left+8,l=Math.max(c,n.left+n.width-8),u={top:Math.max(0,Math.min(e.top,s)-o-8),bottom:Math.max(0,s-Math.max(e.bottom,o)-8)},d=Math.min(t.height,a),f=r===`top`?`bottom`:`top`,p=d>u[r]&&u[f]>u[r]?f:r,m=Math.min(a,u[p]),h=Math.min(d,m),g=Math.min(t.width,l-c);return{side:p,left:Math.max(c,Math.min(i===`end`?e.right-g:e.left,l-g)),top:Math.max(o,Math.min(p===`top`?e.top-8-h:e.bottom+8,s-h)),width:g,maxHeight:m}}var H=r();function Te({open:e,anchorRef:t,menuRef:n,placement:r=`top`,align:i=`start`,matchAnchorWidth:a=!1,maxHeight:o,id:s,className:c,role:l,ariaLabel:u,onClose:d,children:f}){return(0,I.useEffect)(()=>{if(!e||!d)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),d())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,d]),(0,I.useLayoutEffect)(()=>{if(!e)return;let s=()=>{let e=n.current,s=t.current;if(!e||!s)return;let c=s.getBoundingClientRect(),l=window.visualViewport;e.style.width=a?`${c.width}px`:``;let u=we({anchor:c,menu:{width:e.getBoundingClientRect().width,height:e.scrollHeight},viewport:{left:l?.offsetLeft??0,top:l?.offsetTop??0,width:l?.width??window.innerWidth,height:l?.height??window.innerHeight},placement:r,align:i,maxHeight:o});e.dataset.side=u.side,e.style.maxHeight=`${u.maxHeight}px`,e.style.overflowY=`auto`,e.style.width=`${u.width}px`,e.style.top=`${u.top}px`,e.style.bottom=`auto`,e.style.right=`auto`,e.style.left=`${u.left}px`};s();let c=null,l=()=>{c===null&&(c=window.requestAnimationFrame(()=>{c=null,s()}))},u=typeof ResizeObserver>`u`?null:new ResizeObserver(l);return n.current&&u?.observe(n.current),t.current&&u?.observe(t.current),window.addEventListener(`resize`,s),window.addEventListener(`scroll`,s,!0),window.visualViewport?.addEventListener(`resize`,l),window.visualViewport?.addEventListener(`scroll`,l),()=>{u?.disconnect(),c!==null&&window.cancelAnimationFrame(c),window.removeEventListener(`resize`,s),window.removeEventListener(`scroll`,s,!0),window.visualViewport?.removeEventListener(`resize`,l),window.visualViewport?.removeEventListener(`scroll`,l)}},[e,t,n,r,i,a,o]),e?(0,Ce.createPortal)((0,H.jsx)(`div`,{ref:n,id:s,className:c,style:{position:`fixed`,zIndex:65},role:l,"aria-label":u,children:f}),document.body):null}function Ee({resourceKey:e,loadCommands:t,builtinCommands:n=[],value:r,onChange:i,inputRef:a,placement:s=`top`}){let{t:u,language:d}=o(),p=(0,I.useId)(),m=(0,I.useRef)(null),h=r.match(/^\/([^\n]{0,120})$/),[g,_]=(0,I.useState)(``),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(0),E=h?.[1]||``,D=/\s/.test(E),O=(0,I.useRef)(t);O.current=t;let k=(0,I.useMemo)(()=>re(n,E,d),[n,d,E]),A=!!(h&&g!==r&&(!D||k.length));(0,I.useEffect)(()=>{_(``),y(null),C(!1)},[e]),(0,I.useEffect)(()=>{if(!A||v)return;let e=!0;return x(!0),C(!1),O.current().then(t=>{e&&y(t.commands||[])}).catch(()=>{e&&(y([]),C(!0))}).finally(()=>e&&x(!1)),()=>{e=!1}},[v,A,e]);let j=(0,I.useMemo)(()=>{let e=k.map(e=>({kind:`builtin`,command:e}));if(D)return e;let t=E.toLocaleLowerCase(d),n=(v||[]).filter(e=>!t||`${e.invocation} ${e.name} ${e.description}`.toLocaleLowerCase(d).includes(t));return[...e,...n.map(e=>({kind:`resource`,command:e}))]},[D,k,v,d,E]);(0,I.useEffect)(()=>{T(0)},[E,v]);let M=()=>{_(r)},N=e=>{if(e.kind===`builtin`){let t=e.command.run?``:`${e.command.invocation} `;i(t),_(``),T(0),e.command.run&&e.command.run(),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length))});return}let t=ve(e.command.invocation,r);i(t),_(t),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)})};(0,I.useEffect)(()=>{if(!A)return;let e=e=>{if(document.activeElement===a.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),M();return}j.length&&(e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),T(e=>(e+1)%j.length)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),T(e=>(e-1+j.length)%j.length)):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),N(j[Math.min(w,j.length-1)])))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}),(0,I.useEffect)(()=>{let e=a.current;if(!A||!e)return;let t={role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":p,"aria-activedescendant":j.length?`${p}-${Math.min(w,j.length-1)}`:``},n=Object.keys(t).map(t=>[t,e.getAttribute(t)]);for(let[n,r]of Object.entries(t))r?e.setAttribute(n,r):e.removeAttribute(n);return()=>{for(let[t,r]of n)t&&(r===null?e.removeAttribute(t):e.setAttribute(t,r))}},[w,a,p,A,j.length]);let P={user:u(`chat:commands.scope.user`),project:u(`chat:commands.scope.project`),package:u(`chat:commands.scope.package`),custom:u(`chat:commands.scope.custom`)};return(0,H.jsx)(Te,{open:A,anchorRef:a,menuRef:m,placement:s,matchAnchorWidth:!0,maxHeight:330,id:p,role:`listbox`,ariaLabel:u(`chat:commands.open`),className:`permission-mode-menu composer-command-menu overflow-y-auto rounded-md bg-solid p-1 text-content shadow-float`,children:(0,H.jsxs)(`div`,{className:`chat-resource-list composer-command-list flex min-h-0 [flex:1_1_0] flex-col gap-px overflow-y-auto [overscroll-behavior:contain] [scrollbar-gutter:stable] [touch-action:pan-y] [&_>_button]:grid [&_>_button]:w-full [&_>_button]:cursor-pointer [&_>_button]:grid-cols-[28px_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-2 [&_>_button]:rounded-sm [&_>_button]:px-1.5 [&_>_button]:py-1 [&_>_button]:text-left [&_>_button]:text-content [&_>_button.active]:bg-surface-hover max-[650px]:[&_>_button]:min-h-11 [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-[13px] [&_strong]:font-medium [&_small]:truncate [&_small]:font-sans [&_small]:text-xs [&_small]:font-normal [&_small]:text-content-muted [&_em]:text-xs [&_em]:whitespace-nowrap [&_em]:text-content-muted [&_em]:not-italic [&_>_p]:m-auto [&_>_p]:px-2 [&_>_p]:py-1.5 [&_>_p]:text-xs [&_>_p]:text-content-muted`,children:[j.map((e,t)=>{let{command:n}=e,r=e.kind===`builtin`?e.command.current?l:ee:e.command.source===`prompt`?f:c,i=e.kind===`resource`?e.command:null;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,id:`${p}-${t}`,"aria-selected":t===w,className:t===w?`active`:``,onMouseEnter:()=>T(t),onMouseDown:e=>e.preventDefault(),onClick:()=>N(e),children:[(0,H.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,H.jsx)(r,{size:15})}),(0,H.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,H.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,H.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,H.jsx)(`small`,{children:n.description||u(`chat:commands.noDescription`)})]}),(0,H.jsx)(`em`,{children:i?(0,H.jsxs)(H.Fragment,{children:[i.source===`prompt`?u(`chat:commands.prompt`):u(`chat:commands.skill`),` · `,P[i.scope]]}):e.kind===`builtin`&&e.command.current?u(`chat:commands.builtin.current`):u(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!j.length&&(0,H.jsx)(`p`,{children:u(b?`chat:commands.loading`:S?`chat:commands.loadError`:`chat:commands.empty`)})]})})}function De({levels:e,value:t,labelFor:n,onCommit:r,disabled:i=!1,ariaLabel:a,title:o,trailing:s,className:c}){let[l,u]=(0,I.useState)(null),[d,f]=(0,I.useState)(!1),p=(0,I.useRef)(!1),m=Math.max(0,e.indexOf(t)),h=l??m,g=n(e[h]||t),_=i||d||e.length<2,v=e.join(`|`);(0,I.useEffect)(()=>{u(null)},[t,v]);let y=async n=>{let i=e[n];if(_||p.current||!i||i===t){u(null);return}p.current=!0,f(!0);try{await r(i)}finally{p.current=!1,f(!1),u(null)}};return(0,H.jsxs)(`div`,{className:E(`min-w-0`,c),children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 px-0.5 pb-1`,children:[o&&(0,H.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:o}),(0,H.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-[13px] leading-5 font-medium text-accent-fg`,"aria-live":`polite`,children:g}),s]})]}),(0,H.jsx)(T,{className:E(`h-7`,`[&_[data-slot=slider-range]]:bg-[linear-gradient(90deg,var(--star-border),var(--star))]`,`[&_[data-slot=slider-thumb]]:size-4 [&_[data-slot=slider-thumb]]:bg-[radial-gradient(circle,var(--star)_0_2px,var(--key-bg)_2.5px)]`),showSteps:!0,min:0,max:Math.max(1,e.length-1),step:1,value:[h],disabled:_,"aria-label":a,valueText:g,onValueChange:([e])=>u(e),onValueCommit:([e])=>void y(e)}),e.length>1&&(0,H.jsxs)(`div`,{className:`flex justify-between px-0.5 pt-0.5 text-xs text-content-faint`,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{children:n(e[0])}),(0,H.jsx)(`span`,{children:n(e.at(-1)||``)})]})]})}var Oe=96,ke=.6,Ae=`10%`;function je({onDismiss:e,className:t}){let n=(0,I.useRef)(null),r=e=>{e.sheet.style.transform=``,e.sheet.style.transition=``},i=e=>{if(e.button!==0)return;let t=e.currentTarget.closest(`[data-slot="sheet-content"]`);t&&(e.currentTarget.setPointerCapture?.(e.pointerId),t.style.transition=`none`,n.current={pointerId:e.pointerId,startY:e.clientY,startAt:performance.now(),sheet:t,offset:0})},a=e=>{let t=n.current;!t||t.pointerId!==e.pointerId||(t.offset=Math.max(0,e.clientY-t.startY),t.sheet.style.transform=`translateY(${t.offset}px)`)},o=t=>{let{sheet:n}=t;n.style.setProperty(`--tw-exit-translate-y`,`calc(${t.offset}px + ${Ae})`);let i=()=>{n.removeEventListener(`animationstart`,a),r(t),n.style.removeProperty(`--tw-exit-translate-y`)},a=e=>{e.target===n&&n.dataset.state!==`closed`&&i()};n.addEventListener(`animationstart`,a),e(),requestAnimationFrame(()=>{n.isConnected&&n.dataset.state!==`closed`&&i()})},s=e=>{let t=n.current;if(!t||t.pointerId!==e.pointerId)return;n.current=null;let i=t.offset/Math.max(1,performance.now()-t.startAt);if(t.offset>=Oe||t.offset>24&&i>=ke){o(t);return}r(t)},c=()=>{let e=n.current;n.current=null,e&&r(e)};return(0,H.jsx)(`div`,{"aria-hidden":`true`,"data-sheet-drag-handle":!0,className:E(`flex h-8 w-full flex-none cursor-grab touch-none items-start justify-center select-none active:cursor-grabbing`,t),onPointerDown:i,onPointerMove:a,onPointerUp:s,onPointerCancel:c,onLostPointerCapture:c,children:(0,H.jsx)(`span`,{className:`mt-2.5 h-1 w-9 rounded-full bg-stroke-strong`})})}function Me({sheet:e,title:t,trigger:n,children:r,open:i,onOpenChange:a,align:o,side:s,sideOffset:c,className:l,sheetClassName:u}){let[d,f]=(0,I.useState)(!1),p=i??d,m=e=>{i===void 0&&f(e),a?.(e)};return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{"aria-haspopup":`dialog`,"aria-expanded":p,onClick:()=>m(!0),children:n}),(0,H.jsx)(A,{open:p,onOpenChange:m,children:(0,H.jsxs)(D,{side:`bottom`,showCloseButton:!1,"data-popover-sheet":!0,className:E(`max-h-[85dvh] gap-1 overflow-y-auto rounded-t-(--r-sheet) px-3 pt-1 pb-[calc(12px+var(--pisper-safe-area-bottom))]`,u),children:[(0,H.jsx)(je,{onDismiss:()=>m(!1)}),(0,H.jsx)(O,{className:`px-2 pt-1 pb-1 text-base font-semibold`,children:t}),(0,H.jsx)(k,{className:`sr-only`,children:t}),r]})})]}):(0,H.jsxs)(w,{open:p,onOpenChange:m,children:[(0,H.jsx)(S,{asChild:!0,children:n}),(0,H.jsx)(C,{align:o,side:s,sideOffset:c,className:l,children:r})]})}var Ne=1,Pe=.9,Fe=.8,Ie=.17,U=.1,Le=.999,Re=.9999,ze=.99,Be=/[\\\/_+.#"@\[\(\{&]/,Ve=/[\\\/_+.#"@\[\(\{&]/g,He=/[\s-]/,Ue=/[\s-]/g;function We(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ne:ze;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=We(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ne:Be.test(e.charAt(l-1))?(d*=Fe,p=e.slice(i,l-1).match(Ve),p&&i>0&&(d*=Le**+p.length)):He.test(e.charAt(l-1))?(d*=Pe,m=e.slice(i,l-1).match(Ue),m&&i>0&&(d*=Le**+m.length)):(d*=Ie,i>0&&(d*=Le**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Re)),(d<U&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=We(e,t,n,r,l+1,a+2,o),f*U>d&&(d=f*U)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ge(e){return e.toLowerCase().replace(Ue,` `)}function Ke(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,We(e,t,Ge(e),Ge(t),0,0,{})}var W=`[cmdk-group=""]`,qe=`[cmdk-group-items=""]`,Je=`[cmdk-group-heading=""]`,Ye=`[cmdk-item=""]`,Xe=`${Ye}:not([aria-disabled="true"])`,Ze=`cmdk-item-select`,G=`data-value`,Qe=(e,t,n)=>Ke(e,t,n),$e=I.createContext(void 0),K=()=>I.useContext($e),et=I.createContext(void 0),q=()=>I.useContext(et),tt=I.createContext(void 0),nt=I.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=pt(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:v=!0,...y}=e,b=_(),x=_(),S=_(),C=I.useRef(null),w=ht();Y(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),Y(()=>{w(6,j)},[]);let T=I.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=I.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=s.current?.filter??Qe;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(qe);t?t.appendChild(e.parentElement===t?e:e.closest(`${qe} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qe} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${W}[${G}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(G);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector(Je))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${Ye}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(Xe)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(G))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(G))}function ee(e){let t=M()?.closest(W),n;for(;t&&!n;)t=e>0?dt(t,W):ft(t,W),n=t?.querySelector(Xe);n?T.setState(`value`,n.getAttribute(G)):F(e)}let te=()=>P(N().length-1),L=e=>{e.preventDefault(),e.metaKey?te():e.altKey?ee(1):F(1)},ne=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?ee(-1):F(-1)};return I.createElement(g.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:v&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),te();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(Ze);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:_t},c),Q(e,e=>I.createElement(et.Provider,{value:T},I.createElement($e.Provider,{value:E},e))))}),rt=I.forwardRef((e,t)=>{let n=_(),r=I.useRef(null),i=I.useContext(tt),a=K(),o=pt(e),s=o.current?.forceMount??i?.forceMount;Y(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=mt(n,r,[e.value,e.children,r],e.keywords),l=q(),u=Z(e=>e.value&&e.value===c.current),d=Z(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);I.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ze,f),()=>t.removeEventListener(Ze,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:h,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return I.createElement(g.div,{ref:m(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:p,onClick:h?void 0:f},e.children)}),it=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=_(),s=I.useRef(null),c=I.useRef(null),l=_(),u=K(),d=Z(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Y(()=>u.group(o),[]),mt(o,s,[e.value,e.heading,c]);let f=I.useMemo(()=>({id:o,forceMount:i}),[i]);return I.createElement(g.div,{ref:m(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&I.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},I.createElement(tt.Provider,{value:f},e))))}),at=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),a=Z(e=>!e.search);return!n&&!a?null:I.createElement(g.div,{ref:m(i,t),...r,"cmdk-separator":``,role:`separator`})}),ot=I.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=q(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.createElement(g.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),st=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=I.useRef(null),o=I.useRef(null),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),I.createElement(g.div,{ref:m(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Q(e,e=>I.createElement(`div`,{ref:m(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ct=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(x,{open:n,onOpenChange:r},I.createElement(y,{container:o},I.createElement(v,{"cmdk-overlay":``,className:i}),I.createElement(b,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(nt,{ref:t,...s}))))}),lt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(g.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ut=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.createElement(g.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>I.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(nt,{List:st,Item:rt,Input:ot,Group:it,Separator:at,Dialog:ct,Empty:lt,Loading:ut});function dt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ft(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function pt(e){let t=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function mt(e,t,n,r=[]){let i=I.useRef(),a=K();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(G,s),i.current=s}),i}var ht=()=>{let[e,t]=I.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function gt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&I.isValidElement(t)?I.cloneElement(gt(t),{ref:t.ref},n(t.props.children)):n(t)}var _t={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function vt({className:e,...t}){return(0,H.jsx)(J,{"data-slot":`command`,className:E(`flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground`,e),...t})}function yt({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,H.jsxs)(N,{className:`h-8! rounded-sm! border-stroke bg-surface-subtle shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,H.jsx)(J.Input,{"data-slot":`command-input`,className:E(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,H.jsx)(M,{children:(0,H.jsx)(p,{className:`size-4 shrink-0 opacity-50`})})]})})}function bt({className:e,...t}){return(0,H.jsx)(J.List,{"data-slot":`command-list`,className:E(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function xt({className:e,...t}){return(0,H.jsx)(J.Empty,{"data-slot":`command-empty`,className:E(`py-6 text-center text-sm`,e),...t})}function St({className:e,...t}){return(0,H.jsx)(J.Group,{"data-slot":`command-group`,className:E(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Ct({className:e,children:t,...n}){return(0,H.jsxs)(J.Item,{"data-slot":`command-item`,className:E(`group/command-item relative flex min-h-7.5 max-[650px]:min-h-11 pointer-coarse:min-h-11 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,H.jsx)(l,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function wt(e,t){let n=t.find(t=>t.key===e);return n?`${n.providerName} · ${n.label}`:e.split(`/`).at(-1)||e}function Tt({model:e,availableModels:t,sessionUsage:n,contextUsage:r}){let{t:i,language:a}=o(),s=n?.timing&&typeof n.timing==`object`?n.timing:null,c=Math.max(0,Number(s?.firstTokenSamples)||0),l=Math.max(0,Number(s?.requests)||0),u=c>0?Number(s?.firstTokenTotalMs)/c:null,d=l>0?Number(s?.durationTotalMs)/l:null,f=r?.tokens==null?null:Math.max(0,Number(r.tokens)||0),p=!!n?.cacheReported,m=[[i(`chat:focusSession.statCurrentModel`),e?wt(e,t||[]):`—`],[i(`chat:focusSession.statContextTokens`),f==null?`—`:`${j(f)} / ${j(r?.contextWindow)}`],[i(`chat:focusSession.statInputTokens`),j(n?.input)],[i(`chat:focusSession.statOutputTokens`),j(n?.output)],[i(`chat:focusSession.statCacheReadTokens`),p?j(n?.cacheRead):`—`],[i(`chat:focusSession.statCacheWriteTokens`),p?j(n?.cacheWrite):`—`],[i(`chat:focusSession.statReasoningTokens`),j(n?.reasoning)],[i(`chat:focusSession.statProcessedTokens`),j(n?.processedTokens)],[i(`chat:focusSession.statRequests`),String(Math.max(0,Number(n?.requests)||0))],[i(`chat:focusSession.statAvgFirstToken`),u==null?`—`:F(u,a)],[i(`chat:focusSession.statAvgDuration`),d==null?`—`:F(d,a)]];return(0,H.jsxs)(`div`,{className:`session-stats-panel grid gap-[3px]`,"aria-label":i(`chat:focusSession.sessionStats`),children:[m.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-[10px] text-[length:var(--app-small-size)]`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink-0 text-[var(--text-muted)]`,children:e}),(0,H.jsx)(`strong`,{className:`min-w-0 truncate text-right font-[500] text-[var(--text)] [font-variant-numeric:tabular-nums]`,children:t})]},e)),(0,H.jsx)(`small`,{className:`text-[var(--text-secondary)] text-[length:var(--app-small-size)] leading-normal`,children:i(`chat:focusSession.sessionStatsHint`)})]})}function Et({usage:e,sessionUsage:t,model:n,availableModels:r,onThresholdChange:i}){let{t:a}=o(),s=Number(e?.contextWindow)||0,c=e?.compactAtPercent==null?80:Number(e.compactAtPercent),l=Number.isFinite(c)?Math.round(c):80,[d,f]=(0,I.useState)(l),[p,m]=(0,I.useState)(!1),[h,g]=(0,I.useState)(``),_=(0,I.useRef)(l),v=(0,I.useRef)(void 0);(0,I.useEffect)(()=>{window.clearTimeout(v.current),f(l),_.current=l},[l]),(0,I.useEffect)(()=>()=>window.clearTimeout(v.current),[]);let y=e?.percent!=null&&Number.isFinite(Number(e.percent))?Math.max(0,Number(e?.percent)):null,b=Math.max(0,Number(t?.processedTokens)||0),x=Number(t?.cacheHitRate),S=t?.cacheHitRate!=null&&Number.isFinite(x),C=s?`${e?.tokens==null?`—`:j(e.tokens)} / ${j(s)}${y==null?``:` · ${Math.round(y)}%`}`:``,w=e?.autoCompactEnabled&&e.compactionCapacityPercent!=null?a(`chat:focusSession.contextUsageToCompactionTokensPercent`,{percent:Math.round(Number(e.compactionCapacityPercent)),tokens:j(e.remainingBeforeCompaction)}):``,E=async e=>{let t=Math.min(95,Math.max(10,Math.round(e)));if(f(t),!(!i||t===_.current)){m(!0),g(``);try{await i(t),_.current=t}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},D=e=>{window.clearTimeout(v.current),f(e),v.current=window.setTimeout(()=>void E(e),250)},O=e=>{window.clearTimeout(v.current),E(e)},k=(e,t,n,r)=>(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-usage-row":n,title:r,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:e}),(0,H.jsx)(`strong`,{className:`min-w-0 truncate text-right font-medium text-content tabular-nums`,children:t})]});return(0,H.jsxs)(`div`,{className:`context-usage-section grid gap-1.5 border-t border-stroke-soft px-2 pt-2 pb-1.5`,"data-context-usage":!0,children:[C&&(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[k(a(`board:composer.contextUsage`),C,`context`),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`block h-[3px] overflow-hidden rounded-full bg-surface-active`,children:(0,H.jsx)(`span`,{className:`block h-full rounded-full bg-content-secondary`,style:{width:`${Math.min(100,y||0)}%`}})})]}),b>0&&k(a(`board:composer.sessionTokens`),a(`board:composer.tokens`,{tokens:j(b)}),`tokens`),k(a(`board:composer.cacheHitLabel`),S?`${Math.round(Math.max(0,x))}%`:`—`,`cache`,S?void 0:a(`chat:focusSession.cacheHitRateUnavailable`)),s>0&&(0,H.jsxs)(`details`,{className:`group/usage min-w-0 text-xs`,onToggle:e=>{let t=e.currentTarget;t.open&&requestAnimationFrame(()=>t.scrollIntoView({block:`nearest`}))},children:[(0,H.jsxs)(`summary`,{className:`flex min-h-7 cursor-pointer list-none items-center gap-1 rounded-sm text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:outline-focus max-[650px]:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,H.jsx)(u,{size:13,"aria-hidden":`true`,className:`transition-transform duration-(--d-fast) group-open/usage:rotate-90`}),a(`chat:focusSession.sessionStats`)]}),(0,H.jsxs)(`div`,{className:`grid gap-2 pt-1.5`,children:[(0,H.jsx)(Tt,{model:n,availableModels:r,sessionUsage:t,contextUsage:e}),w&&(0,H.jsx)(`small`,{className:`text-content-muted`,children:w}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between font-medium text-content`,children:[(0,H.jsx)(`span`,{children:a(`chat:focusSession.autoCompactionThreshold`)}),(0,H.jsxs)(`output`,{className:`tabular-nums`,children:[d,`%`]})]}),(0,H.jsx)(T,{min:10,max:95,step:1,value:[d],className:`h-5 w-full`,"aria-label":a(`chat:focusSession.autoCompactionThreshold`),valueText:`${d}%`,disabled:p,onValueChange:([e])=>D(e),onValueCommit:([e])=>O(e)}),(0,H.jsx)(`small`,{className:h?`text-danger`:`text-content-muted`,children:h||(p?a(`chat:focusSession.savingCompactionThreshold`):`\xA0`)})]})]})]})}function $(e,t){return{off:e(`chat:focusSession.thinkingLabel.off`),minimal:e(`chat:focusSession.thinkingLabel.minimal`),low:e(`chat:focusSession.thinkingLabel.low`),medium:e(`chat:focusSession.thinkingLabel.medium`),high:e(`chat:focusSession.thinkingLabel.high`),xhigh:e(`chat:focusSession.thinkingLabel.xhigh`),max:e(`chat:focusSession.thinkingLabel.max`)}[t]||t}function Dt({model:e,models:t,onModelChange:n,thinkingLevel:r,levels:i,status:a,message:s,onThinkingChange:c,modelDisabled:l,thinkingDisabled:u,deferred:f=!1,pendingModel:p=!1,usage:m,sheet:h=!1,side:g=`top`,thinkingIsDefault:_=!1,onThinkingReset:v,triggerClassName:y}){let{t:b}=o(),[x,S]=(0,I.useState)(!1),C=t.find(t=>t.key===e),w=t.map(e=>e.label),T=C?.label||e.split(`/`).at(-1)||``,D=T?P(T,w):b(`chat:focusSession.toolbarModel`),O=[...t.reduce((e,t)=>{let n=e.get(t.providerName)||[];return n.push(t),e.set(t.providerName,n)},new Map)],k=a!==`unsupported`&&i.length>0,A=k?$(b,r||i[0]):`—`,j=p?b(`chat:focusSession.thinkingAfterModelSwitch`):k?A:s||b(a===`unsupported`?`chat:focusSession.thinkingLevelUnsupported`:`chat:focusSession.loadingThinkingLevels`),M=u||x||!k||i.length<2,N=`${b(`chat:focusSession.modelAndThinking`)} · ${wt(e,t)} · ${j}`;return(0,H.jsxs)(Me,{sheet:h,title:b(`chat:focusSession.modelAndThinking`),align:`end`,side:g,sideOffset:8,className:`model-effort-popover w-[272px] max-w-[calc(100vw_-_24px)] gap-0 p-1`,trigger:(0,H.jsxs)(`button`,{type:`button`,className:E(`model-effort-pill inline-flex h-[30px] min-w-0 max-w-[260px] cursor-pointer items-center gap-1.5 rounded-sm border border-transparent pr-1.5 pl-2.5 text-[13px] text-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60 aria-expanded:bg-surface-hover max-[650px]:h-11 max-[650px]:gap-1 max-[650px]:rounded-md max-[650px]:border-stroke max-[650px]:pr-2 max-[650px]:pl-2.5 max-[650px]:text-sm pointer-coarse:h-11`,y),"aria-label":N,title:N,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:D}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,H.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:k?$(b,r||i[0]):`—`}),(0,H.jsx)(d,{size:14,className:`shrink-0 text-content-muted`,"aria-hidden":`true`})]}),children:[(0,H.jsxs)(`div`,{className:`model-effort-model flex flex-col gap-1 p-1.5 pb-2`,children:[(0,H.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-content-muted`,children:b(`chat:focusSession.toolbarModel`)}),(0,H.jsxs)(vt,{defaultValue:e,filter:(e,t,n)=>+!![e,...n||[]].join(` `).toLowerCase().includes(t.trim().toLowerCase()),className:`rounded-sm! border border-stroke-soft bg-transparent p-0`,"aria-label":b(`chat:focusSession.currentChatModel`),children:[t.length>6&&(0,H.jsx)(yt,{placeholder:b(`chat:focusSession.searchModels`)}),(0,H.jsxs)(bt,{className:`max-h-56`,children:[(0,H.jsx)(xt,{className:`py-4 text-xs text-content-muted`,children:t.length?b(`chat:focusSession.noMatchingModels`):b(`chat:focusSession.noModelsAvailable`)}),!C&&e&&(0,H.jsx)(St,{children:(0,H.jsx)(Ct,{value:e,"data-checked":!0,disabled:!0,children:(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:D})})}),O.map(([t,r])=>(0,H.jsx)(St,{heading:t,children:r.map(t=>{let r=P(t.label,w);return(0,H.jsx)(Ct,{value:t.key,keywords:[t.label,t.providerName],"data-checked":t.key===e,disabled:l||x,onSelect:()=>{t.key!==e&&n(t.key)},children:(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,title:t.label,children:[(0,H.jsx)(`span`,{className:`wrap-anywhere`,children:r}),r!==t.label&&(0,H.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:t.label})]})},t.key)})},t))]})]})]}),k&&(0,H.jsx)(De,{className:`border-t border-stroke-soft p-1.5 pt-2`,title:b(`chat:focusSession.thinkingLevelTitle`),levels:i,value:r,labelFor:e=>$(b,e),onCommit:async e=>{S(!0);try{await c(e)}finally{S(!1)}},disabled:M,ariaLabel:b(`chat:focusSession.currentThinkingLevel`),trailing:_?(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-content-faint`,children:b(`chat:focusSession.thinkingModelDefault`)}):v?(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 cursor-pointer rounded-sm text-xs text-content-muted underline-offset-2 hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-focus`,onClick:v,children:b(`chat:focusSession.thinkingReset`)}):void 0}),f&&(0,H.jsx)(`p`,{className:`px-2 pt-1 pb-2 text-xs leading-4 text-content-muted`,role:`status`,children:b(`chat:focusSession.runtimeSelectionDeferred`)}),(!k||i.length===1)&&(0,H.jsx)(`p`,{className:`border-t border-stroke-soft px-2 pt-2 pb-1.5 text-xs leading-relaxed text-content-muted`,role:`status`,children:k?b(`chat:focusSession.thinkingLevelFixed`,{level:A}):j}),m]})}export{je as a,ve as c,Se as d,le as f,te as g,ne as h,Me as i,B as l,ge as m,Dt as n,Ee as o,de as p,$ as r,be as s,Et as t,V as u};
@@ -1,4 +1,4 @@
1
- import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,n as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-BIJtH0nB.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./x-07u4-129.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./button-CCcCN8tE.js";import{a as u,s as d}from"./events-DWUUCmbP.js";import{t as f}from"./esm-DCV8yILT.js";var p=o(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),m=e(n(),1),h=e(r(),1);function g(e){let t=String(e||``).trim().split(` `)[0];if(t.startsWith(`"`)&&t.endsWith(`"`))try{t=JSON.parse(t)}catch{}return t===`/dev/null`?``:t.replace(/^[ab]\//,``)}function _(e){let t=e.match(/^diff --git "a\/(.+)" "b\/(.+)"$/);if(t)return g(`b/${t[2]}`);let n=e.match(/^diff --git a\/(.+) b\/(.+)$/);return n?g(`b/${n[2]}`):``}function v(){return{lineNumber:null,text:``,tone:`empty`}}function y(e){let t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return{oldLine:Number(t?.[1])||0,newLine:Number(t?.[2])||0}}function b(e){let t=String(e||``).replace(/\r\n/g,`
1
+ import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,n as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-BWyVtWF9.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./x-07u4-129.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./button-CCcCN8tE.js";import{a as u,s as d}from"./events-DV8PYjtk.js";import{t as f}from"./esm-DCV8yILT.js";var p=o(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),m=e(n(),1),h=e(r(),1);function g(e){let t=String(e||``).trim().split(` `)[0];if(t.startsWith(`"`)&&t.endsWith(`"`))try{t=JSON.parse(t)}catch{}return t===`/dev/null`?``:t.replace(/^[ab]\//,``)}function _(e){let t=e.match(/^diff --git "a\/(.+)" "b\/(.+)"$/);if(t)return g(`b/${t[2]}`);let n=e.match(/^diff --git a\/(.+) b\/(.+)$/);return n?g(`b/${n[2]}`):``}function v(){return{lineNumber:null,text:``,tone:`empty`}}function y(e){let t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return{oldLine:Number(t?.[1])||0,newLine:Number(t?.[2])||0}}function b(e){let t=String(e||``).replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `),n=[],r=null,i=null,a=0,o=0,s=[],c=[],l=()=>{if(!i||!s.length&&!c.length)return;let e=Math.max(s.length,c.length);for(let t=0;t<e;t+=1){let e=s[t],n=c[t];i.rows.push({kind:`pair`,old:e?{lineNumber:e.lineNumber,text:e.text,tone:`deleted`}:v(),next:n?{lineNumber:n.lineNumber,text:n.text,tone:`added`}:v()})}s=[],c=[]},u=()=>{l(),i=null},d=()=>{u(),r&&=(r.path=r.newPath||r.oldPath||r.path,n.push(r),null)};for(let e of t){if(e.startsWith(`diff --git `)){d(),r={oldPath:``,newPath:``,path:_(e),metadata:[],hunks:[]};continue}if(r){if(e.startsWith(`@@ `)){u();let t=y(e);a=t.oldLine,o=t.newLine,i={header:e,rows:[]},r.hunks.push(i);continue}if(i){if(e.startsWith(`-`))s.push({lineNumber:a,text:e.slice(1)}),a+=1;else if(e.startsWith(`+`))c.push({lineNumber:o,text:e.slice(1)}),o+=1;else if(l(),e.startsWith(` `)){let t=e.slice(1);i.rows.push({kind:`pair`,old:{lineNumber:a,text:t,tone:`context`},next:{lineNumber:o,text:t,tone:`context`}}),a+=1,o+=1}else e.startsWith(`\\ `)&&i.rows.push({kind:`meta`,text:e.slice(2)});continue}e.startsWith(`--- `)?r.oldPath=g(e.slice(4)):e.startsWith(`+++ `)?r.newPath=g(e.slice(4)):e.trim()&&r.metadata.push(e)}}return d(),n}var x=/[\p{L}\p{N}_$]/u;function S(e,t){let n=Array.from(e),r=Array.from(t);if(!n.length||!r.length)return null;let i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=n.length,o=r.length;for(;a>i&&o>i&&n[a-1]===r[o-1];)--a,--o;if(i===a&&i===o)return null;for(;i>0&&x.test(n[i-1])&&x.test(n[i]??r[i]??``);)--i;for(;a<n.length&&a>0&&x.test(n[a])&&x.test(n[a-1]);)a+=1;for(;o<r.length&&o>0&&x.test(r[o])&&x.test(r[o-1]);)o+=1;return Math.max(a-i,o-i)/Math.max(n.length,r.length)>.7?null:{start:i,oldEnd:a,newEnd:o}}function C(e){let t=[];for(let n of e.hunks){t.push({kind:`header`,text:n.header});let e=0;for(;e<n.rows.length;){let r=n.rows[e];if(r.kind===`meta`){t.push({kind:`meta`,text:r.text}),e+=1;continue}if(r.old.tone===`context`){t.push({kind:`line`,tone:`context`,oldLine:r.old.lineNumber,newLine:r.next.lineNumber,text:r.next.text,mark:null}),e+=1;continue}let i=[];for(;e<n.rows.length;){let t=n.rows[e];if(t.kind!==`pair`||t.old.tone===`context`)break;i.push(t),e+=1}let a=i.map(e=>e.old.tone===`deleted`&&e.next.tone===`added`?S(e.old.text,e.next.text):null);i.forEach((e,n)=>{if(e.old.tone!==`deleted`)return;let r=a[n];t.push({kind:`line`,tone:`deleted`,oldLine:e.old.lineNumber,newLine:null,text:e.old.text,mark:r?[r.start,r.oldEnd]:null})}),i.forEach((e,n)=>{if(e.next.tone!==`added`)return;let r=a[n];t.push({kind:`line`,tone:`added`,oldLine:null,newLine:e.next.lineNumber,text:e.next.text,mark:r?[r.start,r.newEnd]:null})})}}return t}function w(e,t,n=``){let[r,i]=(0,m.useState)(null),a=(0,m.useRef)({identity:n,position:e||{top:0,left:0}});a.current={identity:n,position:e||{top:0,left:0}};let o=(0,m.useRef)(t);return o.current=t,(0,m.useLayoutEffect)(()=>{if(!r)return;let e=a.current.position,t=!0,i=null,s=()=>{a.current.identity===n&&!t&&r.isConnected&&r.clientHeight>0&&o.current({top:r.scrollTop,left:r.scrollLeft})},c=()=>{i=null,t&&(r.scrollTo({top:e.top,left:e.left,behavior:`instant`}),Math.abs(r.scrollTop-e.top)<1&&Math.abs(r.scrollLeft-e.left)<1&&(t=!1))},l=()=>{t&&i===null&&(i=requestAnimationFrame(c))},f=()=>{t=!1,s()};c();let p=new ResizeObserver(l);p.observe(r);for(let e of r.children)p.observe(e);return r.addEventListener(`scroll`,s),r.addEventListener(`wheel`,f,{passive:!0}),r.addEventListener(`pointerdown`,f),r.addEventListener(`keydown`,f),window.addEventListener(u,s),window.addEventListener(d,s),()=>{s(),p.disconnect(),i!==null&&cancelAnimationFrame(i),r.removeEventListener(`scroll`,s),r.removeEventListener(`wheel`,f),r.removeEventListener(`pointerdown`,f),r.removeEventListener(`keydown`,f),window.removeEventListener(u,s),window.removeEventListener(d,s)}},[r,n]),{element:r,ref:i}}var T=t({GitDiffDialog:()=>L,InlineGitDiff:()=>R}),E=i();function D({side:e,cell:t}){let n=t.tone===`deleted`?`−`:t.tone===`added`?`+`:` `;return(0,E.jsxs)(`div`,{className:`git-diff-cell grid min-w-0 min-h-[24px] grid-cols-[44px_20px_minmax(0,1fr)] border-b border-stroke-soft font-mono text-[12px] leading-[1.6] tabular-nums [&.next]:border-l [&.next]:border-l-stroke [&.deleted]:bg-[var(--danger-soft)] [&.added]:bg-[var(--success-soft)] [&.deleted]:shadow-[inset_2px_0_var(--danger)] [&.added]:shadow-[inset_2px_0_var(--success)] [&.empty]:bg-surface-subtle [&.context]:bg-code [&_code]:block [&_code]:min-w-0 [&_code]:p-[3px_8px_3px_2px] [&_code]:text-[var(--text)] [&_code]:font-[inherit] [&_code]:whitespace-pre-wrap [&_code]:[overflow-wrap:anywhere] ${e} ${t.tone}`,children:[(0,E.jsx)(`span`,{className:`block border-r border-stroke-soft p-[3px_8px_3px_4px] text-right text-code-gutter select-none`,children:t.lineNumber??``}),(0,E.jsx)(`span`,{className:`git-diff-line-marker [.git-diff-cell.deleted_&]:text-[var(--danger)] [.git-diff-cell.added_&]:text-[var(--success)] block [padding:3px_4px] text-[var(--text-muted)] text-center select-none`,"aria-hidden":`true`,children:t.tone===`empty`?``:n}),(0,E.jsx)(`code`,{children:t.text||`\xA0`})]})}var O={minWidth:0},k={minWidth:0,gridTemplateColumns:`minmax(0,1fr) minmax(0,1fr)`};function A({file:e,scrollElement:t,compact:n=!1}){let r=(0,m.useRef)(null),[i,a]=(0,m.useState)(0),o=(0,m.useMemo)(()=>e.hunks.flatMap((e,t)=>[{kind:`header`,hunkIndex:t,header:e.header},...e.rows.map((e,n)=>({kind:`row`,hunkIndex:t,rowIndex:n,row:e}))]),[e.hunks]);(0,m.useLayoutEffect)(()=>{let e=r.current;if(!t||!e)return;let n=()=>{let n=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);a(e=>Math.abs(e-n)<1?e:n)};n();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return i?.observe(t),i?.observe(e),()=>i?.disconnect()},[t]);let s=f({useFlushSync:!1,count:o.length,getScrollElement:()=>t,estimateSize:()=>25,getItemKey:e=>{let t=o[e];return t.kind===`header`?`hunk-${t.hunkIndex}`:`row-${t.hunkIndex}-${t.rowIndex}`},measureElement:e=>Math.ceil(e.getBoundingClientRect().height),overscan:12,scrollMargin:i}),c=s.getVirtualItems();return(0,E.jsx)(`div`,{className:`relative min-w-[880px] w-full`,"data-pisper-diff-row-count":o.length,"data-diff-mode":n?`split-compact`:`split`,"data-pisper-rendered-count":c.length,ref:r,style:{height:`${s.getTotalSize()}px`,...n?O:{}},children:c.map(e=>{let t=o[e.index];return(0,E.jsx)(`div`,{className:`absolute left-0 w-full`,"data-index":e.index,ref:s.measureElement,style:{top:`${e.start-i}px`},children:t.kind===`header`?(0,E.jsx)(`div`,{className:`git-diff-hunk-header border-b border-stroke-soft bg-surface-subtle p-[4px_10px] font-mono text-[12px] text-content-muted [white-space:pre]`,children:t.header}):t.row.kind===`meta`?(0,E.jsx)(`div`,{className:`git-diff-row-meta border-b border-stroke-soft bg-surface-subtle p-[4px_10px] font-mono text-[12px] text-content-muted [white-space:pre]`,children:t.row.text}):(0,E.jsxs)(`div`,{className:`grid min-w-[880px] grid-cols-[minmax(440px,1fr)_minmax(440px,1fr)]`,style:n?k:void 0,children:[(0,E.jsx)(D,{side:`old`,cell:t.row.old}),(0,E.jsx)(D,{side:`next`,cell:t.row.next})]})},e.key)})})}var j=20;function M(e,t,n){if(!t||t[0]>=t[1])return e||`\xA0`;let r=Array.from(e);return(0,E.jsxs)(E.Fragment,{children:[r.slice(0,t[0]).join(``),(0,E.jsx)(`mark`,{className:c(`rounded-[2px] text-inherit`,n===`added`?`bg-diff-add-mark`:`bg-diff-del-mark`),children:r.slice(t[0],t[1]).join(``)}),r.slice(t[1]).join(``)]})}function N({line:e}){if(e.kind!==`line`)return(0,E.jsx)(`div`,{className:c(`git-diff-hunk-header h-5 bg-surface-subtle px-3 text-content-muted`,e.kind===`meta`&&`italic`),children:e.text});let t=e.tone===`added`?`+`:e.tone===`deleted`?`−`:` `;return(0,E.jsxs)(`div`,{className:c(`git-diff-unified-row grid h-5 grid-cols-[40px_40px_16px_max-content]`,e.tone===`added`&&`bg-diff-add`,e.tone===`deleted`&&`bg-diff-del`),"data-tone":e.tone,children:[(0,E.jsx)(`span`,{className:`pr-2 text-right text-code-gutter select-none`,children:e.oldLine??``}),(0,E.jsx)(`span`,{className:`pr-2 text-right text-code-gutter select-none`,children:e.newLine??``}),(0,E.jsx)(`span`,{"aria-hidden":`true`,className:c(`text-center select-none`,e.tone===`added`&&`text-st-done`,e.tone===`deleted`&&`text-st-fail`),children:t}),(0,E.jsx)(`code`,{className:`pr-4 font-[inherit] text-content`,children:e.tone===`context`?e.text||`\xA0`:M(e.text,e.mark,e.tone)})]})}function P({file:e,scrollElement:t}){let n=(0,m.useRef)(null),[r,i]=(0,m.useState)(0),a=(0,m.useMemo)(()=>C(e),[e]),o=(0,m.useMemo)(()=>a.reduce((e,t)=>Math.max(e,Array.from(t.text.replace(/\t/g,` `)).length),0),[a]);(0,m.useLayoutEffect)(()=>{let e=n.current;if(!t||!e)return;let r=()=>{let n=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);i(e=>Math.abs(e-n)<1?e:n)};r();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return a?.observe(t),a?.observe(e),()=>a?.disconnect()},[t]);let s=f({useFlushSync:!1,count:a.length,getScrollElement:()=>t,estimateSize:()=>j,overscan:24,scrollMargin:r}),c=s.getVirtualItems();return(0,E.jsx)(`div`,{ref:n,className:`relative font-mono text-[12px] leading-5 tabular-nums [tab-size:4] whitespace-pre`,"data-pisper-diff-row-count":a.length,"data-diff-mode":`unified`,style:{height:`${s.getTotalSize()}px`,minWidth:`calc(${o}ch + 112px)`},children:c.map(e=>(0,E.jsx)(`div`,{className:`absolute left-0 w-full`,style:{top:`${e.start-r}px`},children:(0,E.jsx)(N,{line:a[e.index]})},e.key))})}function F(e){let t=e.path.replace(/\\/g,`/`),n=t.split(`/`),r=n.pop()||t,i=0,a=0;for(let t of e.hunks)for(let e of t.rows)e.kind===`pair`&&(e.next.tone===`added`&&(i+=1),e.old.tone===`deleted`&&(a+=1));let o=e.metadata.join(`
4
4
  `),s=/(?:^|\n)new file mode /.test(o)||!e.oldPath&&e.newPath?`added`:/(?:^|\n)deleted file mode /.test(o)||!e.newPath&&e.oldPath?`deleted`:/(?:^|\n)rename (?:from|to) /.test(o)||e.oldPath&&e.newPath&&e.oldPath!==e.newPath?`renamed`:`modified`;return{file:e,name:r,directory:n.join(`/`),added:i,deleted:a,status:s}}function I(e){return e===`added`?`A`:e===`deleted`?`D`:e===`renamed`?`R`:`M`}function L({diff:e,truncated:t,onClose:n}){let{t:r}=a(),i=(0,m.useMemo)(()=>b(e),[e]),o=(0,m.useMemo)(()=>i.map(F),[i]),[c,u]=(0,m.useState)(0),[d,f]=(0,m.useState)(null),g=Math.min(c,Math.max(o.length-1,0)),_=o[g];(0,m.useEffect)(()=>{let e=document.body.style.overflow,t=e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),n())};return document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,t),()=>{document.body.style.overflow=e,document.removeEventListener(`keydown`,t)}},[n]);let v=e=>{u(e),d?.scrollTo({top:0,left:0})};return(0,h.createPortal)((0,E.jsx)(`div`,{className:`git-diff-dialog-backdrop fixed inset-0 z-[120] grid place-items-center bg-[var(--overlay-scrim)] p-[24px] max-[760px]:p-[10px]`,role:`presentation`,onMouseDown:e=>e.target===e.currentTarget&&n(),children:(0,E.jsxs)(`section`,{className:`git-diff-dialog max-[760px]:w-[calc(100vw_-_20px)] max-[760px]:h-[calc(100vh_-_20px)] flex w-[min(1180px,calc(100vw_-_48px))] h-[min(820px,calc(100vh_-_48px))] min-w-0 min-h-0 flex-col overflow-hidden rounded-xl border border-stroke bg-solid shadow-float`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`chat:focusSession.gitViewDiff`),children:[(0,E.jsxs)(`header`,{className:`git-diff-dialog-head [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[2px] [&_strong]:text-[13px] [&_strong]:font-medium [&_small]:text-content-muted [&_small]:text-[12px] [&_small]:tabular-nums grid min-h-[52px] flex-none grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[10px] border-b border-stroke p-[8px_12px]`,children:[(0,E.jsx)(`span`,{className:`grid size-[30px] place-items-center rounded-sm border border-key-border bg-key text-content-secondary shadow-key`,children:(0,E.jsx)(p,{size:16})}),(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`strong`,{children:r(`chat:focusSession.gitViewDiff`)}),(0,E.jsx)(`small`,{children:r(`chat:focusSession.gitDiffFileCount`,{count:i.length})})]}),(0,E.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,title:r(`chat:focusSession.gitCloseDiff`),"aria-label":r(`chat:focusSession.gitCloseDiff`),onClick:n,children:(0,E.jsx)(s,{size:17})})]}),o.length?(0,E.jsxs)(`div`,{className:`git-diff-layout max-[760px]:grid-rows-[minmax(112px,26vh)_minmax(0,1fr)] max-[760px]:grid-cols-[minmax(0,1fr)] grid min-w-0 min-h-0 flex-1 grid-cols-[252px_minmax(0,1fr)] overflow-hidden`,children:[(0,E.jsxs)(`nav`,{className:`git-diff-file-nav flex min-h-0 min-w-0 flex-col overflow-hidden border-r border-stroke bg-chrome max-[760px]:border-r-0 max-[760px]:border-b`,"aria-label":r(`chat:focusSession.gitDiffChangedFiles`),children:[(0,E.jsx)(`strong`,{className:`git-diff-file-nav-title flex-none p-[10px_12px_6px] text-[12px] font-medium tracking-[.02em] text-content-muted max-[760px]:[padding-block:7px_5px]`,children:r(`chat:focusSession.gitDiffChangedFiles`)}),(0,E.jsx)(`div`,{className:`git-diff-file-nav-list max-[760px]:pb-[6px] min-h-0 flex-1 overflow-x-hidden overflow-y-auto [padding:0_6px_8px]`,children:o.map((e,t)=>{let n=t===g;return(0,E.jsxs)(`button`,{type:`button`,className:`git-diff-file-nav-item grid min-h-[42px] w-full cursor-pointer grid-cols-[20px_minmax(0,1fr)_auto] items-center gap-[7px] rounded-sm border-0 bg-transparent p-[5px_7px] text-left text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-foreground [&.selected]:bg-key [&.selected]:text-foreground [&.selected]:shadow-[inset_3px_0_var(--star),var(--key-shadow)] ${e.status} ${n?`selected`:``}`,title:e.file.path,"aria-current":n?`true`:void 0,onClick:()=>v(t),children:[(0,E.jsx)(`span`,{className:`git-diff-file-status text-center font-mono text-[12px] font-medium [.git-diff-file-nav-item.added_&]:text-[var(--success)] [.git-diff-file-nav-item.deleted_&]:text-[var(--danger)] [.git-diff-file-nav-item.renamed_&]:text-[var(--warning-strong)] [.git-diff-file-nav-item.modified_&]:text-content-secondary`,"aria-hidden":`true`,children:I(e.status)}),(0,E.jsxs)(`span`,{className:`git-diff-file-name [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[12px] [&_strong]:font-medium [&_small]:text-content-muted [&_small]:text-[12px] flex min-w-0 flex-col gap-[1px]`,children:[(0,E.jsx)(`strong`,{children:e.name}),e.directory&&(0,E.jsx)(`small`,{children:e.directory})]}),(0,E.jsxs)(`span`,{className:`git-diff-file-stats inline-flex items-center gap-[4px] font-mono text-[12px] tabular-nums [&_em]:[font-style:normal]`,"aria-hidden":`true`,children:[e.added>0&&(0,E.jsxs)(`em`,{className:`added [.git-diff-file-stats_&]:text-[var(--success)]`,children:[`+`,e.added]}),e.deleted>0&&(0,E.jsxs)(`em`,{className:`deleted [.git-diff-file-stats_&]:text-[var(--danger)]`,children:[`−`,e.deleted]})]})]},`${e.file.path}-${t}`)})})]}),(0,E.jsxs)(`div`,{className:`min-w-0 min-h-0 overflow-auto bg-surface-subtle p-[12px]`,ref:f,children:[t&&(0,E.jsx)(`div`,{className:`mb-[12px] rounded-sm border border-[var(--warning-border)] bg-warning-soft p-[8px_10px] text-[12px] text-warning-strong`,children:r(`chat:focusSession.gitDiffTruncated`)}),_&&(0,E.jsxs)(`section`,{className:`min-w-[880px] [overflow:clip] rounded-md border border-stroke bg-panel`,children:[(0,E.jsxs)(`header`,{className:`git-diff-file-head [&_>_svg]:text-content-muted [&_strong]:overflow-hidden [&_strong]:font-mono [&_strong]:text-[12px] [&_strong]:font-medium [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:max-w-[300px] [&_small]:overflow-hidden [&_small]:text-content-muted [&_small]:text-[12px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap sticky top-0 z-[3] grid min-h-[38px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] border-b border-stroke bg-panel p-[7px_10px]`,children:[(0,E.jsx)(p,{size:14}),(0,E.jsx)(`strong`,{title:_.file.path,children:_.file.path}),_.file.oldPath&&_.file.newPath&&_.file.oldPath!==_.file.newPath&&(0,E.jsx)(`small`,{title:_.file.oldPath,children:_.file.oldPath})]}),_.file.metadata.length>0&&(0,E.jsx)(`div`,{className:`git-diff-file-meta border-b border-stroke-soft bg-surface-subtle p-[5px_10px] font-mono text-[12px] text-content-muted`,children:_.file.metadata.join(` · `)}),_.file.hunks.length>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`git-diff-column-head [&_span]:p-[5px_10px] [&_span_+_span]:border-l [&_span_+_span]:border-stroke sticky top-[38px] z-[2] grid grid-cols-[1fr_1fr] border-b border-stroke bg-surface-subtle text-[12px] font-medium text-content-muted`,children:[(0,E.jsx)(`span`,{children:r(`chat:focusSession.gitDiffOriginal`)}),(0,E.jsx)(`span`,{children:r(`chat:focusSession.gitDiffModified`)})]}),(0,E.jsx)(A,{file:_.file,scrollElement:d})]}):(0,E.jsx)(`div`,{className:`[padding:28px_16px] text-[var(--text-muted)] text-[12px] text-center`,children:r(`chat:focusSession.gitDiffNoTextChanges`)})]},_.file.path)]})]}):(0,E.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto bg-surface-subtle p-[12px]`,children:(0,E.jsx)(`div`,{className:`rounded-md border border-stroke bg-panel p-[20px] whitespace-pre-wrap text-content-muted`,children:e||r(`chat:focusSession.gitDiffUnavailable`)})})]})}),document.body)}function R({diff:e,truncated:t,position:n,onReading:r=()=>{},mode:i=`split`,fill:o=!1}){let{t:s}=a(),l=(0,m.useMemo)(()=>b(e),[e]),{element:u,ref:d}=w(n,r);return(0,E.jsxs)(`div`,{className:o?`flex min-h-0 flex-1 flex-col`:void 0,children:[t&&(0,E.jsx)(`p`,{className:`px-3 py-2 text-xs text-content-muted`,children:s(`chat:chatMessage.filePreviewTruncated`)}),(0,E.jsx)(`div`,{ref:d,tabIndex:0,"aria-label":s(`chat:focusSession.gitViewDiff`),"data-diff-scroll":!0,className:c(`min-w-0 overflow-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,o?`min-h-0 flex-1 bg-panel`:`max-h-80 border-y border-border bg-background`),children:!l.length||l.every(e=>!e.hunks.length)?(0,E.jsx)(`p`,{className:`p-3 text-xs text-content-muted`,children:s(`chat:focusSession.gitDiffNoTextChanges`)}):l.map((e,t)=>i===`unified`?(0,E.jsx)(P,{file:e,scrollElement:u},`${e.path}-${t}`):(0,E.jsx)(A,{file:e,scrollElement:u,compact:o},`${e.path}-${t}`))})]})}export{b as a,w as i,T as n,p as o,R as r,L as t};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePicker-tsgOFkg0.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BWyVtWF9.js","assets/i18n-CHHZADSh.js","assets/vendor-router-CSN_DGvx.js","assets/index-CKGGgVei.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/check-2vYc6QaP.js","assets/triangle-alert-CE1q54ci.js","assets/button-CCcCN8tE.js","assets/vendor-ui-DvrYggeS.js","assets/dist-41X0pdUs.js","assets/utils-C8uzG5AZ.js","assets/dialog-CfgIErMS.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/alert-firawb0H.js","assets/NewFolderDialog-D68r0xND.js","assets/api-DOHQjQrv.js","assets/abort-signal-f4JsiYKX.js","assets/folder-open-FIShC5Qk.js","assets/folder-plus-OPHZsJho.js","assets/input-group-h8z63MzW.js","assets/textarea-DmATpOqT.js","assets/pick-system-directory-Bhvwq-o2.js","assets/folder-paths-Bky-CpjC.js","assets/startup-queries-B_DpfvaA.js","assets/query-Bj-DUNYq.js","assets/mutation-CEbxdVYy.js","assets/events-DV8PYjtk.js","assets/session-workspaces-BWTBYaGT.js","assets/workspace-order-store-Cw1fZTM7.js","assets/field-DoLEb0np.js","assets/label-CVWjEcfV.js","assets/separator-BPh_qxvc.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BWyVtWF9.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{o}from"./startup-queries-B_DpfvaA.js";import{t as s}from"./runtime-capabilities-store-CLDMF6_P.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./arrow-right-DqLOhpA2.js";import{t as u}from"./arrow-up-DST6-qVQ.js";import{t as d}from"./chevron-down-CxtxIjiP.js";import{t as f}from"./folder-open-FIShC5Qk.js";import{t as p}from"./folder-plus-OPHZsJho.js";import{i as ee,n as te,r as ne,t as re}from"./useNewProjectPicker-q3Albbmn.js";import{t as ie}from"./shield-alert-oZqX6MNu.js";import{t as ae}from"./shield-B1ruzHd0.js";import{h as oe,l as se,n as ce,o as le,s as ue,u as de}from"./FocusRuntimeControls-6ayCBCsE.js";import{a as m,c as fe,i as pe,o as h,p as me,r as he,s as g,t as ge}from"./dropdown-menu-CFIFNaKO.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as _e}from"./button-CCcCN8tE.js";import{c as ve,r as ye,t as be}from"./shortcuts-BheSJu4D.js";import{t as xe}from"./useSessionListQuery-B-MnlVs6.js";import{t as Se}from"./useBoardItems-RCXS90vW.js";import{a as Ce}from"./card-presentation-1oph2b8P.js";import{i as we,n as Te,t as Ee}from"./board-launch-CM1zjdqN.js";import{t as De}from"./public-launch-WirHCXQ8.js";import{t as Oe}from"./shortcut-aria-jHRmld9z.js";import{t as ke}from"./touch-target-BsyCgjR5.js";import{n as Ae,t as v}from"./workspace-order-store-Cw1fZTM7.js";import{r as y,t as b}from"./board-projects-Cm1I_eWA.js";var je=c(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),x=c(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),S=e(n(),1),Me=`data-[fade=both]:[mask-image:linear-gradient(to_right,transparent,var(--foreground)_1.25rem,var(--foreground)_calc(100%-1.25rem),transparent)] data-[fade=end]:[mask-image:linear-gradient(to_right,var(--foreground)_calc(100%-1.25rem),transparent)] data-[fade=start]:[mask-image:linear-gradient(to_left,var(--foreground)_calc(100%-1.25rem),transparent)]`;function Ne(e,t=``){let[n,r]=(0,S.useState)();return(0,S.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver!=`function`)return;let n=()=>{let e=t.scrollWidth-t.clientWidth,n=Math.abs(t.scrollLeft),i=e>1&&n>1,a=e>1&&n<e-1;r(i&&a?`both`:i?`start`:a?`end`:void 0)};n();let i=new ResizeObserver(n);i.observe(t);for(let e of Array.from(t.children))i.observe(e);return t.addEventListener(`scroll`,n,{passive:!0}),()=>{i.disconnect(),t.removeEventListener(`scroll`,n)}},[e,t]),n}var C=r();function Pe({value:e,onChange:t,size:n,compact:r=!1,className:a}){let{t:o}=i(),{items:s,capabilities:c}=Se(`today`);if(!c.sessionQueue)return null;let l=s.filter(e=>e.lane===`running`||e.lane===`queued`),u=s.find(t=>t.id===e);if(!l.length&&!e)return null;let f=u?.title??o(`board:launch.startAfterGone`),p=e?o(`board:launch.startAfterChip`,{title:f}):o(`board:launch.startNowChip`),ee=e?o(`board:launch.startAfterShort`,{title:f}):p;return(0,C.jsxs)(ge,{children:[(0,C.jsx)(me,{asChild:!0,children:(0,C.jsxs)(we,{size:n,className:_(`min-w-0 max-w-[24ch] shrink`,e?`min-w-[14ch]`:`border-transparent bg-transparent`,a),title:p,"aria-label":`${o(`board:launch.startAfterLabel`)} · ${p}`,"data-launch-start-after":e||`now`,children:[(0,C.jsx)(x,{"aria-hidden":`true`}),(!r||e)&&(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:ee}),(0,C.jsx)(d,{"aria-hidden":`true`})]})}),(0,C.jsxs)(he,{align:`start`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-72 overflow-y-auto`,children:[(0,C.jsx)(m,{children:o(`board:launch.startAfterLabel`)}),(0,C.jsxs)(h,{value:e,onValueChange:t,children:[(0,C.jsx)(g,{value:``,children:o(`board:launch.startNowChip`)}),l.map(e=>(0,C.jsx)(g,{value:e.id,"data-start-after-option":e.id,children:(0,C.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:e.title}),(0,C.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.lane===`running`?o(`board:launch.startAfterRunning`):o(`board:launch.startAfterQueued`)})]})},e.id))]}),(0,C.jsx)(`p`,{className:`px-2 py-1.5 text-xs leading-relaxed text-content-muted`,children:o(`board:launch.startAfterHint`)})]})]})}function w(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function T(e){return typeof e==`string`?e:``}function E(e){return(Array.isArray(w(e).providers)?w(e).providers:[]).flatMap(e=>{let t=w(e),n=T(t.id);return!n||t.configured!==!0||t.enabled===!1?[]:(Array.isArray(t.models)?t.models:[]).flatMap(e=>{let r=w(e),i=T(r.id);return!i||r.kind!==`chat`?[]:[{key:`${n}/${i}`,label:T(r.name)||i,providerName:T(t.name)||n,thinkingLevels:Array.isArray(r.thinkingLevels)?r.thinkingLevels.filter(e=>typeof e==`string`):[]}]})})}function Fe(){let e=a(o(`config`)),t=xe(),n=v(e=>e.names),r=Ae(e=>e.projects),i=s(e=>e.capabilities.features),c=(0,S.useMemo)(()=>E(e.data),[e.data]),l=e.data?.provider&&e.data?.model?`${e.data.provider}/${e.data.model}`:``,u=t.data?.sessions,d=(0,S.useMemo)(()=>y(u??[],r,n),[u,n,r]),f=(0,S.useMemo)(()=>b(u??[],d),[u,d]);return{models:c,defaultModel:l,defaultThinkingLevel:T(e.data?.thinkingLevel)||`medium`,projects:d,defaultCwd:f,goalsAvailable:i.goals!==!1,teamAvailable:i.goals!==!1&&i.multiAgent!==!1,loading:e.isPending,error:e.error??null}}var Ie=(0,S.lazy)(()=>t(()=>import(`./WorkspacePicker-tsgOFkg0.js`).then(e=>({default:e.WorkspacePicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),Le=(0,S.lazy)(()=>t(()=>import(`./NewFolderDialog-D68r0xND.js`).then(e=>({default:e.NewFolderDialog})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,25,26,27,10,28,12,13,14,15,16,17,18,19,20,21,22,29,30,31,32,33,34,35,36,37,38,23,39,40,41]))),Re=`board:launch`,ze=`home:new`,Be=`\0no-project`,Ve=new Set;function He(e,t){let n=se(e).text,r=n.trim()?`${t}\n${n}`:t;de(e,{text:r});for(let t of Ve)t.key===e&&t.apply(r)}function Ue(){let{t:e}=i();return(0,S.useMemo)(()=>({thinking:t=>({off:e(`chat:focusSession.thinkingLabel.off`),minimal:e(`chat:focusSession.thinkingLabel.minimal`),low:e(`chat:focusSession.thinkingLabel.low`),medium:e(`chat:focusSession.thinkingLabel.medium`),high:e(`chat:focusSession.thinkingLabel.high`),xhigh:e(`chat:focusSession.thinkingLabel.xhigh`),max:e(`chat:focusSession.thinkingLabel.max`)})[t]||t,execution:{"approval-required":e(`chat:focusSession.approvalRequired`),"workspace-write":e(`chat:focusSession.workspaceWrite`),"full-access":e(`chat:focusSession.fullAccess`)},runMode:{plan:e(`chat:focusSession.planMode`),goal:e(`chat:focusSession.goalMode`),team:e(`chat:focusSession.teamMode`)}}),[e])}function We(e){return!e.value||e.selectionStart===0&&e.selectionEnd===0}var D=(0,S.forwardRef)(function({variant:e,autoFocus:t,compactChips:n,touch:r,onDispatched:a,onDetachedFailure:o,onConfigureModels:c,className:xe},Ae){let{t:v}=i(),y=Ue(),b=Fe(),x=ne(),w=ve(e=>e.bindings.sendMessage),T=(0,S.useRef)(null),E=(0,S.useRef)(null),D=e===`composer`?ze:Re,Ge=e=>He(D,e),[O,Ke]=(0,S.useState)(()=>se(D).text),[k,A]=(0,S.useState)(null),[j,qe]=(0,S.useState)(0),[M,Je]=(0,S.useState)(!1),[N,Ye]=(0,S.useState)(``),{items:Xe}=Se(`today`),Ze=N?Xe.find(e=>e.id===N)?.title??v(`board:launch.startAfterGone`):``,P=(0,S.useRef)(!0),F=(0,S.useRef)(null),I=re({onProjectChosen:()=>{if(r||e===`sheet`)return;let t=T.current;t&&(t.focus(),t.setSelectionRange(t.value.length,t.value.length))},onError:e=>{P.current&&A({message:e,noModel:!1})}}),{mounted:Qe,...$e}=I.picker,{mounted:et,...tt}=I.folderDialog,nt=s(e=>e.capabilities.features.workspaceFolders),L=`launch-input-${e}`,rt=`launch-error-${e}`;(0,S.useEffect)(()=>{P.current=!0;let e={key:D,apply:e=>Ke(e)};return Ve.add(e),()=>{P.current=!1,Ve.delete(e)}},[D]);let R=(0,S.useCallback)(e=>{Ke(e),de(D,{text:e})},[D]);(0,S.useImperativeHandle)(Ae,()=>({focus:()=>T.current?.focus(),focusEnd:()=>{let e=T.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)},fill:e=>{R(e),T.current?.focus()}}),[R]);let it=b.models.some(e=>e.key===x.model),z=it?x.model:b.defaultModel,B=b.models.find(e=>e.key===z)?.thinkingLevels??[],V=B.includes(x.thinkingLevel)?x.thinkingLevel:``,at=V||(B.includes(b.defaultThinkingLevel)?b.defaultThinkingLevel:``),H=M?`full-access`:x.executionMode||`approval-required`,U=x.runMode===`team`&&!b.teamAvailable||x.runMode===`goal`&&!b.goalsAvailable?`plan`:x.runMode,W=(0,S.useMemo)(()=>{if(!x.cwd||b.projects.some(e=>e.cwd===x.cwd))return b.projects;let e=x.cwd.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||x.cwd;return[{key:x.cwd,cwd:x.cwd,label:e},...b.projects]},[x.cwd,b.projects]),G=(0,S.useMemo)(()=>Ce(W),[W]),K=x.projectless,q=K?``:x.cwd||b.defaultCwd||W[0]?.cwd||``,J=K?void 0:W.find(e=>e.cwd===q),ot=J?.label||v(K?`board:launch.noProject`:`board:launch.defaultProject`),st=!b.loading&&!b.error&&b.models.length===0,ct=e=>{if(W.length<2)return!1;let t=Math.max(0,W.findIndex(e=>e.cwd===q)),n=W[(t+e+W.length)%W.length];return x.rememberLaunch({cwd:n.cwd}),!0},lt=e=>{Je(e===`full-access`),e!==`full-access`&&x.rememberLaunch({executionMode:e})},ut=(0,S.useCallback)(()=>De(q),[q]),dt=oe({t:v,models:b.models,model:z,onModel:e=>x.rememberLaunch({model:e,thinkingLevel:``}),thinkingLevels:B,thinkingLevel:at,thinkingLabel:y.thinking,onThinking:e=>x.rememberLaunch({thinkingLevel:e}),executionModes:te,executionMode:H,executionLabel:e=>y.execution[e]||e,onExecutionMode:e=>lt(e),runModes:[`plan`,...b.goalsAvailable?[`goal`]:[],...b.teamAvailable?[`team`]:[]],runMode:U,runModeLabel:e=>y.runMode[e]||e,onRunMode:e=>x.rememberLaunch({runMode:e})}),ft=(0,C.jsx)(le,{placement:e===`composer`?`top`:`bottom`,resourceKey:q,loadCommands:ut,builtinCommands:dt,value:O,onChange:R,inputRef:T}),Y=e===`composer`,pt=Ne(E,Y?`${q}|${z}|${H}|${U}`:``),X=async e=>{let t=O.trim();if(!t){T.current?.focus();return}if(Y&&j>0)return;if(st){A({message:v(`board:launch.noModel`),noModel:!0});return}A(null),R(``),ue(D),T.current?.focus(),qe(e=>e+1),Je(!1),x.rememberLaunch({...K?{projectless:K}:{cwd:q},model:it?z:``,thinkingLevel:V,executionMode:H,runMode:U});let n=N;Ye(``);try{let r=await Te({prompt:t,cwd:q,projectless:K,model:it?z:``,thinkingLevel:V,executionMode:M?`full-access`:x.executionMode,runMode:U,...n?{startAfter:n}:{}});a?.(r,{open:e})}catch(e){Ge(t),P.current&&n&&Ye(n);let r=e instanceof Ee||e instanceof Error?e.message:``,i=r?v(`board:launch.failedWithReason`,{reason:r}):v(`board:launch.failed`);P.current?A({message:i,noModel:!1}):o?.(i)}finally{P.current&&qe(e=>Math.max(0,e-1))}},mt=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(Y){if(ye(e.nativeEvent,w)){e.preventDefault(),X(!0);return}}else if(e.key===`Enter`&&!e.shiftKey&&!e.altKey){e.preventDefault(),X(e.metaKey||e.ctrlKey);return}e.key===`Tab`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&We(e.currentTarget)&&ct(1)&&e.preventDefault()}},ht=O.split(`
3
+ `).length,Z=e===`sheet`,gt=n||Z,Q=Z||Y?`default`:`sm`,_t=Z?`min-h-11`:Q===`sm`?`pointer-coarse:min-h-11`:void 0,vt=(0,C.jsxs)(ge,{children:[(0,C.jsx)(me,{asChild:!0,children:(0,C.jsxs)(we,{size:Q,className:_(Z?`max-w-[13ch] min-w-0 shrink`:Y&&r?`max-w-[14ch]`:`max-w-[24ch] min-w-0 shrink`,Z?`min-h-11`:Q===`sm`?ke:void 0),title:J?.cwd||void 0,"aria-label":v(`board:launch.projectLabel`,{project:J?G.get(J.key)?`${J.label} (${G.get(J.key)})`:J.label:ot}),children:[(0,C.jsx)(ee,{"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:_(`truncate`,J?.label&&!Z?`min-w-[8ch] font-mono`:`min-w-0`,J?.label&&Z&&`font-mono`),children:ot}),(0,C.jsx)(d,{"aria-hidden":`true`})]})}),(0,C.jsxs)(he,{align:`start`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-64 overflow-y-auto`,onCloseAutoFocus:e=>{let t=F.current;t&&(F.current=null,e.preventDefault(),t())},children:[(0,C.jsxs)(h,{value:K?Be:q,onValueChange:e=>x.rememberLaunch(e===Be?{projectless:!0}:{cwd:e}),children:[(0,C.jsx)(g,{value:Be,children:(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:v(`board:launch.noProject`)})}),(0,C.jsx)(fe,{}),(0,C.jsx)(m,{children:v(`board:launch.projects`)}),W.length===0&&(0,C.jsx)(g,{value:``,children:v(`board:launch.defaultProject`)}),W.map(e=>(0,C.jsxs)(g,{value:e.cwd,title:e.cwd,children:[(0,C.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.label}),G.get(e.key)&&(0,C.jsx)(`span`,{className:`ml-auto min-w-0 truncate pl-2 font-mono text-xs text-content-muted`,children:G.get(e.key)})]},e.key))]}),(0,C.jsx)(fe,{}),(0,C.jsxs)(pe,{disabled:I.picking,"data-launch-new-project":!0,onSelect:()=>F.current=()=>void I.newProject(),children:[(0,C.jsx)(f,{"aria-hidden":`true`}),v(`board:launch.chooseFolder`)]}),nt&&(0,C.jsxs)(pe,{"data-launch-new-folder":!0,onSelect:()=>F.current=()=>I.newFolder(q||b.defaultCwd),children:[(0,C.jsx)(p,{"aria-hidden":`true`}),v(`board:launch.newFolder`)]})]})]}),yt=(Qe||et)&&(0,C.jsxs)(S.Suspense,{fallback:null,children:[Qe&&(0,C.jsx)(Ie,{...$e}),et&&(0,C.jsx)(Le,{...tt})]}),bt=(0,C.jsx)(ce,{sheet:Z,side:Y?`top`:`bottom`,model:z,models:b.models,onModelChange:e=>x.rememberLaunch({model:e,thinkingLevel:``}),thinkingLevel:at,levels:B,status:b.loading?``:`supported`,onThinkingChange:e=>x.rememberLaunch({thinkingLevel:e}),thinkingIsDefault:!V,onThinkingReset:()=>x.rememberLaunch({thinkingLevel:``}),modelDisabled:!b.models.length,triggerClassName:_(Z?`max-w-[13ch]`:`max-w-[24ch]`,_t)}),xt=H===`full-access`?ie:ae,St=U===`plan`?y.execution[H]:`${y.runMode[U]} · ${y.execution[H]}`,Ct=(0,C.jsxs)(ge,{children:[(0,C.jsx)(me,{asChild:!0,children:(0,C.jsxs)(we,{size:Q,className:_(`min-w-0 max-w-[26ch] border-transparent bg-transparent`,Z&&`flex-none`,_t),title:`${v(`chat:focusSession.approvalMode`)} · ${St}${M?` · ${v(`board:launch.fullAccessOnce`)}`:``}`,"aria-label":`${v(`chat:focusSession.approvalMode`)} · ${St}${M?` · ${v(`board:launch.fullAccessOnce`)}`:``}`,"data-launch-mode":`${U}:${H}`,children:[(0,C.jsx)(xt,{"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:`truncate`,children:gt&&U===`plan`&&H!==`full-access`?``:St}),(0,C.jsx)(d,{"aria-hidden":`true`})]})}),(0,C.jsxs)(he,{align:`start`,className:`w-64`,children:[(0,C.jsx)(m,{children:v(`chat:focusSession.approvalMode`)}),(0,C.jsx)(h,{value:H,onValueChange:e=>lt(e),children:te.map(e=>(0,C.jsx)(g,{value:e,children:e===`full-access`?(0,C.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,C.jsx)(`span`,{children:y.execution[e]}),(0,C.jsx)(`span`,{className:`text-xs text-content-muted`,children:v(`board:launch.fullAccessOnce`)})]}):y.execution[e]},e))}),(b.goalsAvailable||b.teamAvailable)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(fe,{}),(0,C.jsx)(m,{children:v(`chat:focusSession.executionMode`)}),(0,C.jsxs)(h,{value:U,onValueChange:e=>x.rememberLaunch({runMode:e}),children:[(0,C.jsx)(g,{value:`plan`,children:y.runMode.plan}),b.goalsAvailable&&(0,C.jsx)(g,{value:`goal`,children:y.runMode.goal}),b.teamAvailable&&(0,C.jsx)(g,{value:`team`,children:y.runMode.team})]})]})]})]}),wt=(0,C.jsx)(Pe,{value:N,onChange:Ye,size:Q,compact:gt,className:_(_t,Z&&`flex-none`)}),Tt=(0,C.jsxs)(`div`,{ref:E,"data-fade":pt,"data-launch-chips":!0,className:_(`flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto [scrollbar-width:none]`,Me),children:[vt,Ct,wt]}),Et=Y?(0,C.jsx)(_e,{type:`button`,size:`icon`,className:_(`flex-none rounded-full`,r?`size-11`:`size-8 pointer-coarse:size-11`),disabled:j>0,"aria-label":v(`board:home.send`),"aria-keyshortcuts":Oe(w),title:w?`${v(`board:home.send`)} (${be(w)})`:void 0,"data-launch-send":!0,onClick:()=>void X(!1),children:(0,C.jsx)(u,{"aria-hidden":`true`})}):(0,C.jsxs)(_e,{type:`button`,size:`sm`,className:_(`flex-none`,Z&&`min-h-11 px-4`),onClick:()=>void X(!1),"aria-keyshortcuts":`Enter`,children:[v(`board:launch.dispatch`),!Z&&(0,C.jsx)(je,{"aria-hidden":`true`,className:`opacity-70`})]}),$=k&&(0,C.jsxs)(`p`,{id:rt,role:`alert`,className:`flex min-w-0 items-center gap-2 text-xs text-st-fail`,children:[(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:k.message}),k.noModel&&(0,C.jsxs)(_e,{variant:`link`,size:`xs`,className:`h-auto px-0`,onClick:c,children:[v(`board:launch.configureModels`),(0,C.jsx)(l,{"aria-hidden":`true`})]})]}),Dt=j>0&&(0,C.jsx)(`span`,{role:`status`,className:`flex-none text-xs text-content-muted`,children:Y?v(`board:home.sending`):v(`board:launch.sending`,{count:j})});return Y?(0,C.jsxs)(`section`,{"aria-label":v(`board:home.composerLabel`),"data-launch-console":e,className:_(`flex min-w-0 flex-col rounded-[var(--composer-radius,22px)] border border-control bg-panel shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) has-[textarea:focus-visible]:border-focus has-[textarea:focus-visible]:ring-3 has-[textarea:focus-visible]:ring-focus-ring max-[650px]:rounded-2xl`,xe),children:[(0,C.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:v(`board:launch.inputLabel`)}),ft,(0,C.jsx)(`textarea`,{ref:T,id:L,"data-launch-input":!0,autoFocus:t,rows:Math.min(6,Math.max(2,ht)),value:O,placeholder:r?v(`board:home.placeholderTouch`):w?v(`board:home.placeholder`,{send:be(w)}):v(`board:home.placeholderUnbound`),"aria-invalid":k?!0:void 0,"aria-describedby":k?rt:void 0,"aria-keyshortcuts":Oe(w),onChange:e=>{R(e.target.value),k&&!k.noModel&&A(null)},onKeyDown:mt,className:_(`max-h-[220px] min-h-11 w-full min-w-0 resize-none bg-transparent px-4 pt-3 pb-1 text-[length:calc(var(--app-message-font-size)*.9375)] leading-5 text-content outline-none placeholder:text-content-muted max-[650px]:px-3.5`,r&&`text-[length:var(--app-message-font-size)]`)}),$&&(0,C.jsx)(`div`,{className:`px-4 max-[650px]:px-3.5`,children:$}),(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-2 pt-1 pb-2`,"data-launch-toolbar":!0,children:[Tt,Dt,(0,C.jsx)(`span`,{className:`flex min-w-0 shrink items-center`,children:bt}),Et]}),yt]}):(0,C.jsxs)(`section`,{"aria-label":v(`board:launch.title`),"data-launch-console":e,className:_(`flex min-w-0 flex-col`,xe),children:[(0,C.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:v(`board:launch.inputLabel`)}),ft,(0,C.jsx)(`textarea`,{ref:T,id:L,"data-launch-input":!0,autoFocus:t,rows:Math.min(8,Math.max(3,ht)),value:O,placeholder:v(Z?`board:launch.placeholderTouch`:`board:launch.placeholder`),"aria-invalid":k?!0:void 0,"aria-describedby":k?rt:void 0,"aria-keyshortcuts":`Enter Meta+Enter Control+Enter Shift+Enter`,onChange:e=>{R(e.target.value),k&&!k.noModel&&A(null)},onKeyDown:mt,className:_(`w-full min-w-0 resize-none bg-transparent text-content caret-st-attn-fill outline-none placeholder:text-content-muted`,Z?`max-h-[40dvh] min-h-[88px] rounded-[var(--r-md)] border border-control bg-panel px-3 py-2.5 text-[16px] leading-6 transition-[border-color,box-shadow] duration-(--d-fast) focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring`:`max-h-[240px] min-h-[72px] px-5 pt-1 pb-2 text-[15px] leading-6`)}),$&&(0,C.jsx)(`div`,{className:Z?`pt-1.5`:`px-5 pb-1`,children:$}),Ze&&(0,C.jsx)(`p`,{"data-launch-start-after-note":!0,className:_(`text-xs text-content-muted`,Z?`pt-1.5`:`px-5 pb-1`),children:v(`board:launch.startAfterNote`,{title:Ze})}),(0,C.jsxs)(`div`,{className:_(`flex min-w-0 items-center gap-1.5`,Z?`pt-2`:`px-3 pb-3`),"data-launch-toolbar":!0,children:[(0,C.jsxs)(`div`,{ref:E,"data-launch-chips":!0,className:`flex min-w-0 flex-[1_1_auto] items-center gap-1.5 overflow-hidden`,children:[vt,Ct,wt]}),Dt,(0,C.jsx)(`span`,{className:`flex min-w-0 shrink items-center`,children:bt}),Et]}),yt]})});export{D as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BWyVtWF9.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./arrow-down-CDGua-ue.js";import{t as o}from"./arrow-up-DST6-qVQ.js";import{t as s}from"./folder-plus-OPHZsJho.js";import{t as c}from"./pencil-U08v_vV9.js";import{t as l}from"./rotate-ccw-C0v8V77_.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./utils-C8uzG5AZ.js";import{n as f,t as p}from"./button-CCcCN8tE.js";import{t as m}from"./useSessionListQuery-B-MnlVs6.js";import{s as h}from"./card-presentation-1oph2b8P.js";import{a as g,i as _,l as v,n as y,o as b,s as x,t as S}from"./dialog-CfgIErMS.js";import{n as C,t as w}from"./workspace-order-store-Cw1fZTM7.js";import{n as T}from"./board-projects-Cm1I_eWA.js";var E=i(`folder-minus`,[[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),D=e(t(),1),O=n(),k=`flex-none pointer-coarse:size-11 in-data-[phone-shell]:size-11`;function A({open:e,onOpenChange:t,commands:n}){let{t:i}=r(),A=m(),j=w(e=>e.order),M=w(e=>e.names),N=C(e=>e.projects),P=w(e=>e.rememberWorkspaces),F=w(e=>e.moveWorkspace),I=(0,D.useRef)(null),L=(0,D.useRef)(null),[R,z]=(0,D.useState)(null),[B,V]=(0,D.useState)(null),H=(0,D.useMemo)(()=>T(A.data?.sessions??[],N,M,j,i(`board:filter.noProject`)),[A.data,M,j,N,i]),U=(0,D.useMemo)(()=>H.map(e=>e.key),[H]);(0,D.useEffect)(()=>{e&&U.length&&P(U)},[U,e,P]),(0,D.useEffect)(()=>{if(!R)return;let e=I.current,t=t=>e?.querySelector(`[data-project-move="${t}"][data-project-key="${CSS.escape(R.key)}"]`),n=t(R.offset);(n&&!n.disabled?n:t(R.offset===-1?1:-1))?.focus(),z(null)},[R,H]),(0,D.useEffect)(()=>{B&&(V(null),!H.some(e=>e.key===B.key)&&((B.next?I.current?.querySelector(`[data-project-remove][data-project-key="${CSS.escape(B.next)}"]`):null)??L.current)?.focus())},[H,B]);let W=(e,t)=>{F(e.key,t,U),z({key:e.key,offset:t})},G=async(e,t)=>{let r=H[t+1]?.key??H[t-1]?.key??``;e.count===0?n.unregister(e):await n.remove(e),V({key:e.key,next:r})},K=!!n.busyKey,q;return q=A.isPending?(0,O.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-6 text-sm text-content-muted`,children:[(0,O.jsx)(f,{className:`size-4`}),i(`board:project.loading`)]}):A.error&&!A.data?(0,O.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 py-6 text-sm`,children:[(0,O.jsx)(`p`,{className:`text-content`,children:i(`board:project.error`)}),(0,O.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>void A.refetch(),children:i(`board:page.retry`)})]}):H.length===0?(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 py-6 text-sm`,children:[(0,O.jsx)(`p`,{className:`font-medium text-content`,children:i(`board:project.empty`)}),(0,O.jsx)(`p`,{className:`text-content-muted`,children:i(`board:project.emptyHint`)})]}):(0,O.jsx)(`ul`,{ref:I,"aria-label":i(`board:project.listLabel`),className:`flex flex-col divide-y divide-stroke-soft`,"data-manage-projects":!0,children:H.map((e,t)=>{let r=n.busyKey===e.key,s=e.cwd&&e.key!==`\0`,m=e.count===0,g=i(m?`board:project.removeNamed`:`board:project.deleteWithChatsNamed`,{project:e.label});return(0,O.jsxs)(`li`,{"data-project-row":e.key,"data-project-registered-only":m||void 0,"aria-busy":r||void 0,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 py-2`,children:[(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 flex-none place-items-center rounded-sm border border-stroke-strong bg-solid font-mono text-xs font-semibold text-content uppercase`,children:Array.from(e.label)[0]||`·`}),(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,O.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-content`,children:e.label}),(0,O.jsx)(`span`,{className:`truncate font-mono text-xs text-content-muted`,title:e.cwd||void 0,children:e.custom?`${i(`board:project.folderName`,{name:e.folderLabel})} · ${h(e.cwd)}`:e.cwd?h(e.cwd):``})]}),(0,O.jsx)(`span`,{className:`flex-none text-xs text-content-muted tabular-nums max-[480px]:hidden`,children:r?i(`board:project.deleting`):i(`board:project.sessions`,{count:e.count})}),(0,O.jsxs)(`span`,{className:`flex flex-none items-center max-[480px]:w-full max-[480px]:justify-end`,children:[(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"data-project-move":`-1`,"data-project-key":e.key,disabled:t===0,"aria-label":i(`board:project.moveUp`,{project:e.label}),title:i(`board:project.moveUp`,{project:e.label}),onClick:()=>W(e,-1),children:(0,O.jsx)(o,{"aria-hidden":`true`})}),(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"data-project-move":`1`,"data-project-key":e.key,disabled:t===H.length-1,"aria-label":i(`board:project.moveDown`,{project:e.label}),title:i(`board:project.moveDown`,{project:e.label}),onClick:()=>W(e,1),children:(0,O.jsx)(a,{"aria-hidden":`true`})}),s&&(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"aria-label":i(`board:project.renameNamed`,{project:e.label}),title:i(`board:project.renameNamed`,{project:e.label}),onClick:()=>void n.rename(e),children:(0,O.jsx)(c,{"aria-hidden":`true`})}),s&&e.custom&&(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"aria-label":i(`board:project.resetNamed`,{project:e.label}),title:i(`board:project.resetNamed`,{project:e.label}),onClick:()=>n.resetName(e),children:(0,O.jsx)(l,{"aria-hidden":`true`})}),(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:d(k,!m&&`text-danger hover:text-danger`),disabled:K,"data-project-remove":m?`unregister`:`delete`,"data-project-key":e.key,"aria-label":g,title:g,onClick:()=>void G(e,t),children:r?(0,O.jsx)(f,{className:`size-4`}):m?(0,O.jsx)(E,{"aria-hidden":`true`}):(0,O.jsx)(u,{"aria-hidden":`true`})})]})]},e.key)})}),(0,O.jsx)(S,{open:e,onOpenChange:t,children:(0,O.jsxs)(_,{size:`wide`,scrollMode:`body`,"aria-describedby":`board-manage-projects`,onOpenAutoFocus:e=>{e.preventDefault(),L.current?.focus()},children:[(0,O.jsxs)(x,{children:[(0,O.jsx)(v,{children:i(`board:project.manageTitle`)}),(0,O.jsx)(g,{id:`board-manage-projects`,children:i(`board:project.manageDescription`)})]}),(0,O.jsx)(y,{className:`-mx-1 px-1`,children:q}),(0,O.jsxs)(b,{children:[(0,O.jsxs)(p,{variant:`outline`,size:`dialogAction`,disabled:n.picking,onClick:()=>{t(!1),n.newProject()},children:[(0,O.jsx)(s,{"aria-hidden":`true`}),i(`board:project.new`)]}),(0,O.jsx)(p,{ref:L,size:`dialogAction`,onClick:()=>t(!1),children:i(`board:project.done`)})]})]})})}export{A as ManageProjectsDialog};
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-markdown-plugins-CT5L3KA9.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-router-CSN_DGvx.js","assets/vendor-react-DwNgTV1j.js","assets/vendor-markdown-plugins-DEcVZfaU.css"])))=>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{n,t as r}from"./vendor-markdown-plugins-CT5L3KA9.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{a as o,i as s,n as c,r as l,t as u}from"./vendor-markdown-CT6Z4fh8.js";import{n as d,r as ee,t as f}from"./vendor-shiki-runtime-DM7fm4Bl.js";import{t as p}from"./use-i18n-BIJtH0nB.js";import{t as te}from"./check-2vYc6QaP.js";import{t as m}from"./copy-DHmIFc52.js";import{t as h}from"./utils-C8uzG5AZ.js";import{t as ne}from"./button-CCcCN8tE.js";import{t as re}from"./route-context-DvWDul4T.js";var g=e(i(),1),_=[`github-dark`,`github-dark`],v=150,y=new Set([`text`,`txt`,`plain`,`plaintext`]),b=new Map;for(let e of d){b.set(e.id,e.id);for(let t of e.aliases??[])b.set(t,e.id)}function x(e){return typeof e==`string`?e:e.name??`custom`}function S(e){let t=String(e||``).trim().toLowerCase();return b.get(t)??`text`}function C(e,t,n){return`${t}:${x(n[0])}:${x(n[1])}:${e.length}:${e.slice(0,64)}:${e.slice(-64)}`}var w=new Map;function ie(e){let t=w.get(e);return t&&(w.delete(e),w.set(e,t)),t}function ae(e,t){for(w.delete(e),w.set(e,t);w.size>v;){let e=w.keys().next().value;if(e===void 0)break;w.delete(e)}}var T=null,E=new Map;function oe(){return T??=ee({themes:[..._],langs:[],engine:f({forgiving:!0})}),T}function se(e,t){if(y.has(t)||e.getLoadedLanguages().includes(t))return Promise.resolve();let n=d.find(e=>e.id===t);if(!n)return Promise.resolve();let r=E.get(t);return r||(r=e.loadLanguage(()=>n.import().then(e=>e.default)).catch(e=>{throw E.delete(t),e}),E.set(t,r)),r}var D=new Map;function ce(){return{name:`shiki`,type:`code-highlighter`,supportsLanguage(e){return b.has(String(e||``).trim().toLowerCase())},getSupportedLanguages(){return d.map(e=>e.id)},getThemes(){return _},highlight({code:e,language:t,themes:n},r){let i=S(t),a=C(e,i,n),o=ie(a);if(o)return o;let s=D.get(a),c=!!s;return s||(s=new Set,D.set(a,s)),r&&s.add(r),c||(async()=>{try{let t=await oe();await se(t,i);let r=t.getLoadedLanguages().includes(i)?i:`text`,o=t.codeToTokens(e,{lang:r,themes:{light:n[0],dark:n[1]}});ae(a,o);let s=D.get(a);if(D.delete(a),s)for(let e of s)e(o)}catch(e){D.delete(a),console.error(`[streamdown] Failed to highlight code:`,e)}})(),null}}}var le=ce(),ue={cjk:n,code:le,math:r};function de(){let e=``,t=[];return n=>{if(n===e)return t;if(t.length>0&&n.startsWith(e)){let r=t[t.length-1],i=e.length-r.length;if(i<0||e.slice(i)!==r)return e=n,t=l(n),t;let a=l(n.slice(i)),o=[...t.slice(0,-1),...a];return e=n,t=o,o}return e=n,t=l(n),t}}var O=100,k=new Map;function A(e){let t=k.get(e);if(t)return k.delete(e),k.set(e,t),t;let n=l(e);if(k.set(e,n),k.size>O){let e=k.keys().next().value;e!==void 0&&k.delete(e)}return n}var j=null;function M(){return j??=t(()=>import(`./vendor-markdown-plugins-CT5L3KA9.js`).then(e=>e.O),__vite__mapDeps([0,1,2,3,4,5])),j}function N(e){return/\$\$|\\\(|\\\[|\$[^\n$]+\$|\\begin\{/.test(e)}var P=160;function F(e,t){let n=String(e||``).match(/language-[\w-]+:(\S+)/)?.[1]||``,r=typeof t==`string`?t:``,i=r.match(/(?:^|\s)(?:title|filename|file)=(?:"([^"]+)"|'([^']+)'|(\S+))/),a=r.split(/\s+/).find(e=>e&&!e.includes(`=`)&&!/^[{[]/.test(e)&&/[/.]/.test(e));return[...(n||i?.[1]||i?.[2]||i?.[3]||a||``).replace(/[\u0000-\u001f\u007f]/g,``).trim()].slice(0,P).join(``)}var I=`https://local-file.pisper.invalid`,L=`/reveal`;function R(e){try{return decodeURIComponent(e)}catch{return e}}function z(e){return[...e].some(e=>{let t=e.codePointAt(0)||0;return t<32||t===127})}function B(e){return/^(?:[A-Za-z]:[\\/]|\/|\\\\)/.test(e)}function V(e){let t=e.match(/:(\d+)(?::(\d+))?$/);if(!t)return{path:e};let n={path:e.slice(0,-t[0].length),line:Number(t[1])};return t[2]&&(n.column=Number(t[2])),n}function H(e){try{let t=new URL(e);if(t.protocol!==`file:`||t.username||t.password||t.port)return null;let n=t.pathname;return t.hostname&&t.hostname!==`localhost`?`//${t.hostname}${n}`:/^\/[A-Za-z]:[\\/]/.test(n)?n.slice(1):n}catch{return null}}function fe(e){return!e||/^[\\/]/.test(e)||/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e)?!1:!e.split(/[\\/]/).includes(`..`)}function pe(e,t){let n=e.replace(/[\\/]+$/,``);if(!n)return e.startsWith(`/`)?`/`+t.replace(/^(?:\.\/)+/,``):``;let r=e.includes(`\\`)?`\\`:`/`,i=t.replace(/^[\\/]+/,``).replace(/^(?:\.[/])+/g,``);return n+r+i}function me(e,t){let n=e.trim();if(!n||z(n))return null;let r=/^file:/i.test(n);if(!r&&/[?#]/.test(n))return null;let i=r?H(n):n;if(!i)return null;let a=V(i),o=R(a.path);if(!o||z(o))return null;let s=/^\/[A-Za-z]:[\\/]/.test(o)?o.slice(1):o;if(B(s))return{...a,path:s};if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(i)&&!a.path.includes(`.`)||!t)return null;let c=t.trim();if(!B(c)||z(c)||!fe(o))return null;let l=pe(c,o);return B(l)?{...a,path:l}:null}function he(e){let t=new URL(L,I);return t.searchParams.set(`path`,e.path),e.line!==void 0&&t.searchParams.set(`line`,String(e.line)),e.column!==void 0&&t.searchParams.set(`column`,String(e.column)),t.href}function ge(e){try{let t=new URL(e);if(t.origin!==I||t.pathname!==L)return null;let n=t.searchParams.get(`path`)||``;if(!B(n)||z(n))return null;let r=Number(t.searchParams.get(`line`)),i=Number(t.searchParams.get(`column`)),a={path:n};return Number.isSafeInteger(r)&&r>0&&(a.line=r),Number.isSafeInteger(i)&&i>0&&(a.column=i),a}catch{return null}}function _e(e){return t=>{let n=t=>{if(t.type===`link`&&typeof t.url==`string`){let n=me(t.url,e);n&&(t.url=he(n))}for(let e of t.children||[])n(e)};n(t)}}async function U(e){let t=await fetch(`/api/desktop/reveal-path`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e})}),n={};try{n=await t.json()}catch{}if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.revealed===!0}var W=class extends Error{reason;constructor(e){super(`local-reveal:${e}`),this.reason=e,this.name=`LocalPathRevealError`}};async function G(e,t){if(typeof t!=`function`)throw new W(`unavailable`);let n;try{if(await Promise.race([Promise.resolve().then(()=>t(e)),new Promise((e,t)=>{n=setTimeout(()=>t(new W(`timeout`)),8e3)})])!==!0)throw new W(`failed`)}finally{clearTimeout(n)}}var K=a(),ve={a:Se,code:Ee,img:Z,strong:Ce,table:we},ye=!1,be={linkMode:`text-only`};function q(e,t){window.dispatchEvent(new CustomEvent(re,{detail:{message:e,tone:t}}))}function J(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(J).join(``):(0,g.isValidElement)(e)?J(e.props.children):``}function xe(e){return String(e||``).match(/language-([\w-]+)/)?.[1]||`text`}function Y({file:e}){return(0,K.jsx)(`span`,{className:`max-w-[min(360px,45vw)] truncate px-1.5 font-mono text-xs text-content-secondary`,title:e,"data-code-file":!0,children:e})}function X(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);let t=document.createElement(`textarea`);return t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select(),document.execCommand(`copy`),t.remove(),Promise.resolve()}function Se({children:e,node:t,className:n,href:r,...i}){let{t:a}=p(),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(``),u=J(e).trim()?e:r;if(!r)return(0,K.jsx)(`span`,{className:h(`markdown-link`,n),children:u});let d=ge(r);if(d){let e=a(`common:markdownMessage.revealLocalPath`,{path:d.path}),t=async()=>{s(!0),l(``);try{await G(d.path,U),q(a(`common:markdownMessage.revealLocalPathOk`,{path:d.path}),`info`)}catch(e){let t=e instanceof W&&e.reason===`unavailable`?a(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof W&&e.reason===`timeout`?a(`common:markdownMessage.revealLocalPathTimeout`):a(`common:markdownMessage.revealLocalPathFailed`,{path:d.path}),n=e instanceof Error?e.message:String(e);console.error(`[markdown] 无法在文件管理器中显示本地路径。`,e),l(`${t} (${n})`),q(t,`error`)}finally{s(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:h(`markdown-link inline cursor-pointer border-0 bg-transparent p-0 [font:inherit]`,n),"data-local-path":d.path,title:e,disabled:o,"aria-busy":o||void 0,onClick:()=>void t(),children:u}),c&&(0,K.jsxs)(`span`,{role:`alert`,className:`ml-2 text-sm text-destructive`,children:[c,` `,(0,K.jsx)(`button`,{type:`button`,className:`cursor-pointer underline underline-offset-2`,onClick:()=>{X(d.path).then(()=>q(a(`common:markdownMessage.copied`),`info`),()=>q(a(`common:markdownMessage.copyPathFailed`),`error`))},children:a(`common:markdownMessage.copyPath`)})]})]})}return(0,K.jsx)(`a`,{...i,className:h(`markdown-link`,n),href:r,target:`_blank`,rel:`noopener noreferrer`,children:u})}function Z({node:e,...t}){return(0,K.jsx)(`img`,{loading:`lazy`,...t})}function Ce({node:e,...t}){return(0,K.jsx)(`strong`,{...t})}function we({node:e,...t}){return(0,K.jsx)(`table`,{...t})}function Q({source:e}){let{t}=p(),[n,r]=(0,g.useState)(!1),i=async()=>{try{await X(e),r(!0),window.setTimeout(()=>r(!1),1800)}catch{r(!1)}},a=t(n?`common:markdownMessage.copied`:`common:markdownMessage.copyCode`);return(0,K.jsx)(ne,{type:`button`,variant:`ghost`,size:`icon-sm`,className:h(`size-[26px] text-[var(--code-toolbar-text)] opacity-0 transition-opacity duration-(--d-fast) hover:bg-surface-hover hover:text-foreground focus-visible:opacity-100 [[data-streamdown=code-block]:hover_&]:opacity-100 [@media(hover:none)]:opacity-100 max-[650px]:size-11 max-[650px]:opacity-100 pointer-coarse:size-11 pointer-coarse:opacity-100`,n&&`opacity-100`),"data-streamdown":`code-block-copy-button`,onClick:i,"aria-label":a,title:a,children:n?(0,K.jsx)(te,{size:14,className:`text-success`}):(0,K.jsx)(m,{size:14})})}function Te({language:e,source:t,file:n}){return(0,K.jsxs)(`div`,{className:`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,"data-incomplete":`true`,"data-language":e,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`},children:[(0,K.jsxs)(`div`,{className:`flex h-8 items-center justify-between text-muted-foreground text-xs`,"data-language":e,"data-streamdown":`code-block-header`,children:[(0,K.jsx)(`span`,{className:`ml-1 font-mono lowercase`,children:e}),(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[n&&(0,K.jsx)(Y,{file:n}),(0,K.jsx)(Q,{source:t})]})]}),(0,K.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`,"data-language":e,"data-streamdown":`code-block-body`,children:(0,K.jsx)(`pre`,{className:`bg-transparent`,children:(0,K.jsx)(`code`,{children:t.split(`
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{n,t as r}from"./vendor-markdown-plugins-CT5L3KA9.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{a as o,i as s,n as c,r as l,t as u}from"./vendor-markdown-CT6Z4fh8.js";import{n as d,r as ee,t as f}from"./vendor-shiki-runtime-DM7fm4Bl.js";import{t as p}from"./use-i18n-BWyVtWF9.js";import{t as te}from"./check-2vYc6QaP.js";import{t as m}from"./copy-DHmIFc52.js";import{t as h}from"./utils-C8uzG5AZ.js";import{t as ne}from"./button-CCcCN8tE.js";import{t as re}from"./route-context-DvWDul4T.js";var g=e(i(),1),_=[`github-dark`,`github-dark`],v=150,y=new Set([`text`,`txt`,`plain`,`plaintext`]),b=new Map;for(let e of d){b.set(e.id,e.id);for(let t of e.aliases??[])b.set(t,e.id)}function x(e){return typeof e==`string`?e:e.name??`custom`}function S(e){let t=String(e||``).trim().toLowerCase();return b.get(t)??`text`}function C(e,t,n){return`${t}:${x(n[0])}:${x(n[1])}:${e.length}:${e.slice(0,64)}:${e.slice(-64)}`}var w=new Map;function ie(e){let t=w.get(e);return t&&(w.delete(e),w.set(e,t)),t}function ae(e,t){for(w.delete(e),w.set(e,t);w.size>v;){let e=w.keys().next().value;if(e===void 0)break;w.delete(e)}}var T=null,E=new Map;function oe(){return T??=ee({themes:[..._],langs:[],engine:f({forgiving:!0})}),T}function se(e,t){if(y.has(t)||e.getLoadedLanguages().includes(t))return Promise.resolve();let n=d.find(e=>e.id===t);if(!n)return Promise.resolve();let r=E.get(t);return r||(r=e.loadLanguage(()=>n.import().then(e=>e.default)).catch(e=>{throw E.delete(t),e}),E.set(t,r)),r}var D=new Map;function ce(){return{name:`shiki`,type:`code-highlighter`,supportsLanguage(e){return b.has(String(e||``).trim().toLowerCase())},getSupportedLanguages(){return d.map(e=>e.id)},getThemes(){return _},highlight({code:e,language:t,themes:n},r){let i=S(t),a=C(e,i,n),o=ie(a);if(o)return o;let s=D.get(a),c=!!s;return s||(s=new Set,D.set(a,s)),r&&s.add(r),c||(async()=>{try{let t=await oe();await se(t,i);let r=t.getLoadedLanguages().includes(i)?i:`text`,o=t.codeToTokens(e,{lang:r,themes:{light:n[0],dark:n[1]}});ae(a,o);let s=D.get(a);if(D.delete(a),s)for(let e of s)e(o)}catch(e){D.delete(a),console.error(`[streamdown] Failed to highlight code:`,e)}})(),null}}}var le=ce(),ue={cjk:n,code:le,math:r};function de(){let e=``,t=[];return n=>{if(n===e)return t;if(t.length>0&&n.startsWith(e)){let r=t[t.length-1],i=e.length-r.length;if(i<0||e.slice(i)!==r)return e=n,t=l(n),t;let a=l(n.slice(i)),o=[...t.slice(0,-1),...a];return e=n,t=o,o}return e=n,t=l(n),t}}var O=100,k=new Map;function A(e){let t=k.get(e);if(t)return k.delete(e),k.set(e,t),t;let n=l(e);if(k.set(e,n),k.size>O){let e=k.keys().next().value;e!==void 0&&k.delete(e)}return n}var j=null;function M(){return j??=t(()=>import(`./vendor-markdown-plugins-CT5L3KA9.js`).then(e=>e.O),__vite__mapDeps([0,1,2,3,4,5])),j}function N(e){return/\$\$|\\\(|\\\[|\$[^\n$]+\$|\\begin\{/.test(e)}var P=160;function F(e,t){let n=String(e||``).match(/language-[\w-]+:(\S+)/)?.[1]||``,r=typeof t==`string`?t:``,i=r.match(/(?:^|\s)(?:title|filename|file)=(?:"([^"]+)"|'([^']+)'|(\S+))/),a=r.split(/\s+/).find(e=>e&&!e.includes(`=`)&&!/^[{[]/.test(e)&&/[/.]/.test(e));return[...(n||i?.[1]||i?.[2]||i?.[3]||a||``).replace(/[\u0000-\u001f\u007f]/g,``).trim()].slice(0,P).join(``)}var I=`https://local-file.pisper.invalid`,L=`/reveal`;function R(e){try{return decodeURIComponent(e)}catch{return e}}function z(e){return[...e].some(e=>{let t=e.codePointAt(0)||0;return t<32||t===127})}function B(e){return/^(?:[A-Za-z]:[\\/]|\/|\\\\)/.test(e)}function V(e){let t=e.match(/:(\d+)(?::(\d+))?$/);if(!t)return{path:e};let n={path:e.slice(0,-t[0].length),line:Number(t[1])};return t[2]&&(n.column=Number(t[2])),n}function H(e){try{let t=new URL(e);if(t.protocol!==`file:`||t.username||t.password||t.port)return null;let n=t.pathname;return t.hostname&&t.hostname!==`localhost`?`//${t.hostname}${n}`:/^\/[A-Za-z]:[\\/]/.test(n)?n.slice(1):n}catch{return null}}function fe(e){return!e||/^[\\/]/.test(e)||/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e)?!1:!e.split(/[\\/]/).includes(`..`)}function pe(e,t){let n=e.replace(/[\\/]+$/,``);if(!n)return e.startsWith(`/`)?`/`+t.replace(/^(?:\.\/)+/,``):``;let r=e.includes(`\\`)?`\\`:`/`,i=t.replace(/^[\\/]+/,``).replace(/^(?:\.[/])+/g,``);return n+r+i}function me(e,t){let n=e.trim();if(!n||z(n))return null;let r=/^file:/i.test(n);if(!r&&/[?#]/.test(n))return null;let i=r?H(n):n;if(!i)return null;let a=V(i),o=R(a.path);if(!o||z(o))return null;let s=/^\/[A-Za-z]:[\\/]/.test(o)?o.slice(1):o;if(B(s))return{...a,path:s};if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(i)&&!a.path.includes(`.`)||!t)return null;let c=t.trim();if(!B(c)||z(c)||!fe(o))return null;let l=pe(c,o);return B(l)?{...a,path:l}:null}function he(e){let t=new URL(L,I);return t.searchParams.set(`path`,e.path),e.line!==void 0&&t.searchParams.set(`line`,String(e.line)),e.column!==void 0&&t.searchParams.set(`column`,String(e.column)),t.href}function ge(e){try{let t=new URL(e);if(t.origin!==I||t.pathname!==L)return null;let n=t.searchParams.get(`path`)||``;if(!B(n)||z(n))return null;let r=Number(t.searchParams.get(`line`)),i=Number(t.searchParams.get(`column`)),a={path:n};return Number.isSafeInteger(r)&&r>0&&(a.line=r),Number.isSafeInteger(i)&&i>0&&(a.column=i),a}catch{return null}}function _e(e){return t=>{let n=t=>{if(t.type===`link`&&typeof t.url==`string`){let n=me(t.url,e);n&&(t.url=he(n))}for(let e of t.children||[])n(e)};n(t)}}async function U(e){let t=await fetch(`/api/desktop/reveal-path`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e})}),n={};try{n=await t.json()}catch{}if(!t.ok)throw Error(n.error||`HTTP ${t.status}`);return n.revealed===!0}var W=class extends Error{reason;constructor(e){super(`local-reveal:${e}`),this.reason=e,this.name=`LocalPathRevealError`}};async function G(e,t){if(typeof t!=`function`)throw new W(`unavailable`);let n;try{if(await Promise.race([Promise.resolve().then(()=>t(e)),new Promise((e,t)=>{n=setTimeout(()=>t(new W(`timeout`)),8e3)})])!==!0)throw new W(`failed`)}finally{clearTimeout(n)}}var K=a(),ve={a:Se,code:Ee,img:Z,strong:Ce,table:we},ye=!1,be={linkMode:`text-only`};function q(e,t){window.dispatchEvent(new CustomEvent(re,{detail:{message:e,tone:t}}))}function J(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(J).join(``):(0,g.isValidElement)(e)?J(e.props.children):``}function xe(e){return String(e||``).match(/language-([\w-]+)/)?.[1]||`text`}function Y({file:e}){return(0,K.jsx)(`span`,{className:`max-w-[min(360px,45vw)] truncate px-1.5 font-mono text-xs text-content-secondary`,title:e,"data-code-file":!0,children:e})}function X(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);let t=document.createElement(`textarea`);return t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select(),document.execCommand(`copy`),t.remove(),Promise.resolve()}function Se({children:e,node:t,className:n,href:r,...i}){let{t:a}=p(),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(``),u=J(e).trim()?e:r;if(!r)return(0,K.jsx)(`span`,{className:h(`markdown-link`,n),children:u});let d=ge(r);if(d){let e=a(`common:markdownMessage.revealLocalPath`,{path:d.path}),t=async()=>{s(!0),l(``);try{await G(d.path,U),q(a(`common:markdownMessage.revealLocalPathOk`,{path:d.path}),`info`)}catch(e){let t=e instanceof W&&e.reason===`unavailable`?a(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof W&&e.reason===`timeout`?a(`common:markdownMessage.revealLocalPathTimeout`):a(`common:markdownMessage.revealLocalPathFailed`,{path:d.path}),n=e instanceof Error?e.message:String(e);console.error(`[markdown] 无法在文件管理器中显示本地路径。`,e),l(`${t} (${n})`),q(t,`error`)}finally{s(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:h(`markdown-link inline cursor-pointer border-0 bg-transparent p-0 [font:inherit]`,n),"data-local-path":d.path,title:e,disabled:o,"aria-busy":o||void 0,onClick:()=>void t(),children:u}),c&&(0,K.jsxs)(`span`,{role:`alert`,className:`ml-2 text-sm text-destructive`,children:[c,` `,(0,K.jsx)(`button`,{type:`button`,className:`cursor-pointer underline underline-offset-2`,onClick:()=>{X(d.path).then(()=>q(a(`common:markdownMessage.copied`),`info`),()=>q(a(`common:markdownMessage.copyPathFailed`),`error`))},children:a(`common:markdownMessage.copyPath`)})]})]})}return(0,K.jsx)(`a`,{...i,className:h(`markdown-link`,n),href:r,target:`_blank`,rel:`noopener noreferrer`,children:u})}function Z({node:e,...t}){return(0,K.jsx)(`img`,{loading:`lazy`,...t})}function Ce({node:e,...t}){return(0,K.jsx)(`strong`,{...t})}function we({node:e,...t}){return(0,K.jsx)(`table`,{...t})}function Q({source:e}){let{t}=p(),[n,r]=(0,g.useState)(!1),i=async()=>{try{await X(e),r(!0),window.setTimeout(()=>r(!1),1800)}catch{r(!1)}},a=t(n?`common:markdownMessage.copied`:`common:markdownMessage.copyCode`);return(0,K.jsx)(ne,{type:`button`,variant:`ghost`,size:`icon-sm`,className:h(`size-[26px] text-[var(--code-toolbar-text)] opacity-0 transition-opacity duration-(--d-fast) hover:bg-surface-hover hover:text-foreground focus-visible:opacity-100 [[data-streamdown=code-block]:hover_&]:opacity-100 [@media(hover:none)]:opacity-100 max-[650px]:size-11 max-[650px]:opacity-100 pointer-coarse:size-11 pointer-coarse:opacity-100`,n&&`opacity-100`),"data-streamdown":`code-block-copy-button`,onClick:i,"aria-label":a,title:a,children:n?(0,K.jsx)(te,{size:14,className:`text-success`}):(0,K.jsx)(m,{size:14})})}function Te({language:e,source:t,file:n}){return(0,K.jsxs)(`div`,{className:`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,"data-incomplete":`true`,"data-language":e,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`},children:[(0,K.jsxs)(`div`,{className:`flex h-8 items-center justify-between text-muted-foreground text-xs`,"data-language":e,"data-streamdown":`code-block-header`,children:[(0,K.jsx)(`span`,{className:`ml-1 font-mono lowercase`,children:e}),(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[n&&(0,K.jsx)(Y,{file:n}),(0,K.jsx)(Q,{source:t})]})]}),(0,K.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`,"data-language":e,"data-streamdown":`code-block-body`,children:(0,K.jsx)(`pre`,{className:`bg-transparent`,children:(0,K.jsx)(`code`,{children:t.split(`
3
3
  `).map((e,t)=>(0,K.jsx)(`span`,{children:e},t))})})})]})}function Ee({children:e,className:t,node:n,metastring:r,...i}){let a=o();if(!Object.hasOwn(i,`data-block`))return(0,K.jsx)(`code`,{className:t||``,...i,children:e});let c=J(e).replace(/\n$/,``),l=xe(t),u=F(t,r);return a?(0,K.jsx)(Te,{language:l,source:c,file:u}):(0,K.jsxs)(s,{code:c,isIncomplete:a,language:l,lineNumbers:!1,children:[u&&(0,K.jsx)(Y,{file:u}),(0,K.jsx)(Q,{source:c})]})}function De({children:e,className:t,streaming:n=!1,cwd:r}){let i=String(e??``),a=(0,g.useMemo)(()=>[...Object.values(u),[_e,r||void 0]],[r]),o=(0,g.useMemo)(()=>N(i),[i]);(0,g.useEffect)(()=>{o&&M()},[o]);let[s]=(0,g.useState)(()=>de()),l=n?s:A;return(0,K.jsx)(`div`,{className:h(`markdown-body`,n&&`markdown-streaming`,t),"aria-busy":n||void 0,children:(0,K.jsx)(c,{className:`markdown-content space-y-0`,components:ve,controls:ye,isAnimating:n,lineNumbers:!1,mode:`streaming`,parseMarkdownIntoBlocksFn:l,plugins:ue,remarkPlugins:a,remend:be,children:i})})}var $=(0,g.memo)(De);$.displayName=`MarkdownMessage`;export{U as i,W as n,G as r,$ as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BWyVtWF9.js";import{D as i,S as a,h as o,o as s,u as c,v as l,x as u}from"./query-Bj-DUNYq.js";import{r as d,t as f}from"./useQuery-DdcpUQhO.js";import{n as p}from"./mutation-CEbxdVYy.js";import{t as m}from"./queryOptions-Dfvzj6n2.js";import{a as h,l as g}from"./api-DOHQjQrv.js";import{t as _}from"./check-2vYc6QaP.js";import{t as v}from"./copy-DHmIFc52.js";import{t as ee}from"./key-round-C29uZbsf.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as te}from"./refresh-cw-TbWxTY4K.js";import{t as b}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as x}from"./server-BgNvmqwJ.js";import{t as S}from"./trash-2-CNrPOoPR.js";import{t as C}from"./wrench-6pg6_bqI.js";import{t as w}from"./x-07u4-129.js";import{t as T}from"./more-pages-D_PnxLN0.js";import{t as E}from"./switch-D_G8wFhs.js";import{t as D}from"./utils-C8uzG5AZ.js";import{n as O,t as k}from"./button-CCcCN8tE.js";import{s as ne}from"./shortcuts-BheSJu4D.js";import{a as A}from"./format-DMJQzoZ7.js";import{n as j,t as M}from"./PageState-Cz6vFMXv.js";import{a as N,i as P,l as F,o as I,s as L,t as re}from"./dialog-CfgIErMS.js";import{t as R}from"./textarea-DmATpOqT.js";import{t as z}from"./alert-firawb0H.js";import{a as ie,i as B,n as V,o as ae,r as oe,s as se}from"./FeaturePage-Bh5TePxl.js";var ce=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),u(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&c(t.mutationKey)!==c(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},H=e(t(),1);function le(e,t){let n=d(t);return ue({filters:{...e,status:`pending`}},n).length}function U(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ue(e={},t){let n=d(t).getMutationCache(),r=H.useRef(e),i=H.useRef(null);return i.current===null&&(i.current=U(n,e)),H.useEffect(()=>{r.current=e}),H.useSyncExternalStore(H.useCallback(e=>n.subscribe(()=>{let t=l(i.current,U(n,r.current));i.current!==t&&(i.current=t,s.schedule(e))}),[n]),()=>i.current,()=>i.current)}function de(e,t){let n=d(t),[r]=H.useState(()=>new ce(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);let i=H.useSyncExternalStore(H.useCallback(e=>r.subscribe(s.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),c=H.useCallback((e,t)=>{r.mutate(e,t).catch(o)},[r]);if(i.error&&a(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:c,mutateAsync:i.mutate}}function W(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function G(e,t=!1){if(e==null&&!t)return``;if(typeof e!=`string`||t&&!e)throw g();return e}function K(e,t=0){if(e==null)return t;if(typeof e!=`number`||!Number.isFinite(e))throw g();return e}function q(e){if(typeof e!=`boolean`)throw g();return e}function fe(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw g();return e.map(t)}function pe(e){let t=W(e);return{id:G(t.id,!0),name:G(t.name,!0),status:G(t.status),transport:G(t.transport),endpoint:G(t.endpoint),command:G(t.command),workingDirectory:G(t.workingDirectory),enabled:q(t.enabled),error:G(t.error),latencyMs:t.latencyMs==null?null:K(t.latencyMs),lastPingAt:G(t.lastPingAt),auth:G(t.auth),authCount:K(t.authCount)}}function me(e){let t=W(e);return{serviceId:G(t.serviceId,!0),serviceName:G(t.serviceName),name:G(t.name,!0),piName:G(t.piName,!0),description:G(t.description),enabled:q(t.enabled),serviceEnabled:q(t.serviceEnabled),risk:G(t.risk)}}function he(e){let t=W(e);return{id:G(t.id,!0),serviceId:G(t.serviceId,!0),toolName:G(t.toolName),timestamp:G(t.timestamp),status:G(t.status),error:G(t.error),durationMs:K(t.durationMs)}}function J(e){let t=W(e);if(!Array.isArray(t.services))throw g();let n=t.metrics===void 0?{}:W(t.metrics);return{services:t.services.map(pe),tools:fe(t.tools,me),calls:fe(t.calls,he),metrics:{totalServices:K(n.totalServices),onlineServices:K(n.onlineServices),availableTools:K(n.availableTools),restrictedTools:K(n.restrictedTools),errorRate:K(n.errorRate)}}}var Y=e=>`/api/mcp/${encodeURIComponent(e)}`,X={dashboard:e=>h(`/api/mcp?refresh=0`,{signal:e,parse:J}),add:e=>h(`/api/mcp`,{method:`POST`,body:{spec:e},parse:J}),setServerEnabled:(e,t)=>h(Y(e),{method:`PATCH`,body:{enabled:t},parse:J}),setToolEnabled:(e,t,n)=>h(`${Y(e)}/tools/${encodeURIComponent(t)}`,{method:`PATCH`,body:{enabled:n},parse:J}),test:e=>h(`${Y(e)}/test`,{method:`POST`,body:{},parse:J}),remove:async e=>(await h(Y(e),{method:`DELETE`}),X.dashboard())};function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function _e(e){let t=ge(e);if(typeof t.enabled!=`boolean`||typeof t.listening!=`boolean`||typeof t.host!=`string`||typeof t.port!=`number`||!Number.isInteger(t.port)||typeof t.url!=`string`||t.error!==null&&typeof t.error!=`string`)throw g();return{enabled:t.enabled,listening:t.listening,host:t.host,port:t.port,url:t.url,error:t.error}}function ve(e){let t=ge(e);if(typeof t.url!=`string`||!t.url||typeof t.token!=`string`||!t.token)throw g();return{url:t.url,token:t.token}}var Z={status:e=>h(`/api/mcp-host`,{signal:e,parse:_e}),setEnabled:e=>h(`/api/mcp-host`,{method:`PATCH`,body:{enabled:e},parse:_e}),credentials:e=>h(`/api/mcp-host/credentials`,{method:`POST`,body:{},signal:e,parse:ve}),rotateToken:e=>h(`/api/mcp-host/rotate-token`,{method:`POST`,body:{},signal:e,parse:ve})},Q=n(),ye=[`mcp-host`,`status`];function be(e){return JSON.stringify({mcpServers:{pisper:{url:e.url,headers:{Authorization:`Bearer ${e.token}`}}}},null,2)}function xe({notify:e,requestConfirm:t}){let{t:n}=r(),i=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(``),_=(0,H.useRef)(null),y=(0,H.useRef)(null),b=typeof window<`u`&&!!window.__PISPER_MOBILE_APP__,S=f({queryKey:ye,queryFn:({signal:e})=>Z.status(e),enabled:!b&&!a,refetchInterval:15e3});if((0,H.useEffect)(()=>()=>{_.current?.abort()},[]),b)return null;let C=S.data,w=p?be(p):``,T=()=>{_.current?.abort(),_.current=null,m(null),g(``),u(!1)},ne=async()=>{_.current?.abort();let e=new AbortController;_.current=e,c(!0),m(null),g(``),u(!0);try{let t=await Z.credentials(e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||g(t instanceof Error?t.message:n(`mcp:hostLoadFailed`))}finally{_.current===e&&(_.current=null,c(!1))}},A=async t=>{o(!0);try{let r=await Z.setEnabled(t);i.setQueryData(ye,r),t||T(),e(r.error||n(t?`mcp:hostEnabledNotice`:`mcp:hostDisabledNotice`),r.error?`error`:`success`)}catch(t){e(t instanceof Error?t.message:n(`mcp:hostUpdateFailed`),`error`)}finally{o(!1)}},j=async()=>{if(t&&!await t({title:n(`mcp:hostRotateTitle`),message:n(`mcp:hostRotateWarning`),confirmLabel:n(`mcp:hostRotate`),tone:`danger`}))return;_.current?.abort();let r=new AbortController;_.current=r,c(!0),g(``),m(null);try{let t=await Z.rotateToken(r.signal);r.signal.aborted||(m(t),e(n(`mcp:hostRotatedNotice`),`success`))}catch(e){r.signal.aborted||g(e instanceof Error?e.message:n(`mcp:hostRotateFailed`))}finally{_.current===r&&(_.current=null,c(!1))}},M=async()=>{try{await navigator.clipboard.writeText(w),e(n(`mcp:hostCopied`),`success`)}catch{y.current?.select(),e(n(`mcp:hostCopyManually`),`error`)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{className:`mcp-host mt-7`,children:(0,Q.jsx)(B,{"data-mcp-host":!0,icon:(0,Q.jsx)(x,{}),name:n(`mcp:hostTitle`),description:n(`mcp:hostDescription`),status:C&&(0,Q.jsxs)(`span`,{className:D(`flex items-center gap-1.5`,!C.listening&&C.enabled&&`font-medium text-st-attn`),children:[!C.listening&&C.enabled&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),C.listening?n(`mcp:hostReady`):C.enabled?n(`mcp:hostUnavailable`):n(`mcp:disabled`)]}),actions:(0,Q.jsx)(E,{checked:!!C?.enabled,disabled:!C||a,"aria-label":n(`mcp:hostEnabled`),title:n(`mcp:hostEnabled`),onCheckedChange:e=>void A(e)}),detail:S.isPending||S.error||C?.error||C?.listening?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[S.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-content-muted`,children:n(`mcp:loading`)}),S.error&&(0,Q.jsxs)(z,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:S.error.message}),(0,Q.jsx)(k,{size:`sm`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:()=>void S.refetch(),children:n(`mcp:retry`)})]}),C?.error&&(0,Q.jsx)(z,{role:`status`,className:`text-xs text-muted-foreground`,children:C.error}),C?.listening&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Q.jsx)(`code`,{className:`max-w-full min-w-0 rounded-xs border border-stroke bg-code px-2 py-0.5 font-mono text-xs break-all text-content`,children:C.url}),(0,Q.jsxs)(k,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void ne(),children:[(0,Q.jsx)(ee,{"data-icon":`inline-start`}),n(`mcp:hostShowConfig`)]})]})]}):void 0})}),(0,Q.jsx)(re,{open:l,onOpenChange:e=>!e&&T(),children:(0,Q.jsxs)(P,{className:`min-w-0 grid-cols-[minmax(0,1fr)] sm:max-w-xl`,children:[(0,Q.jsxs)(L,{className:`min-w-0 pr-8 text-left`,children:[(0,Q.jsx)(F,{children:n(`mcp:hostConfigTitle`)}),(0,Q.jsx)(N,{className:`leading-5`,children:n(`mcp:hostConfigDescription`)})]}),s&&(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-content-muted`,children:[(0,Q.jsx)(O,{}),n(`mcp:hostLoadingConfig`)]}),h&&(0,Q.jsx)(z,{role:`alert`,className:`text-sm text-muted-foreground`,children:h}),p&&(0,Q.jsx)(R,{ref:y,value:w,readOnly:!0,spellCheck:!1,"aria-label":n(`mcp:hostConfigTitle`),className:`h-52 max-h-[45dvh] resize-y bg-code font-mono text-xs [overflow-wrap:anywhere]`,onFocus:e=>e.currentTarget.select()}),(0,Q.jsxs)(I,{className:`min-w-0 flex-wrap`,children:[(0,Q.jsxs)(k,{variant:`secondary`,disabled:s,onClick:()=>void j(),children:[(0,Q.jsx)(te,{"data-icon":`inline-start`}),n(`mcp:hostRotate`)]}),(0,Q.jsxs)(k,{disabled:!p||s,onClick:()=>void M(),children:[(0,Q.jsx)(v,{"data-icon":`inline-start`}),n(`mcp:hostCopyConfig`)]})]})]})})]})}var $=[`mcp`,`dashboard`],Se=[`mcp`,`change`];function Ce(){return m({queryKey:$,queryFn:({signal:e})=>X.dashboard(e),staleTime:0,retry:!1})}function we(e){return{mutationKey:Se,scope:{id:`mcp-dashboard`},retry:!1,mutationFn:async t=>(await e.cancelQueries({queryKey:$}),t()),onSuccess:t=>e.setQueryData($,t),onSettled:()=>e.invalidateQueries({queryKey:$})}}function Te(){let e=d(),t=le({mutationKey:Se})>0,n=f({...Ce(),enabled:!t,refetchInterval:!t&&1e4}),r=de(we(e));return{data:n.data,loading:n.isPending,error:r.error||n.error,busy:t,change:r.mutateAsync,reload:()=>(r.reset(),n.refetch())}}var Ee=`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`;function De(e,t){return e===`online`?[t(`mcp:online`),!1]:e===`connecting`?[t(`mcp:connecting`),!1]:e===`unauthorized`?[t(`mcp:unauthorized`),!0]:e===`disabled`?[t(`mcp:disabled`),!1]:[t(`mcp:offline`),!0]}function Oe(e,t){return e===`high`||e===`高风险`?t(`mcp:highRisk`):e===`medium`||e===`中风险`?t(`mcp:mediumRisk`):e===`low`||e===`低风险`?t(`mcp:lowRisk`):String(e||``)}function ke(e,t){return e.auth===`headers`?t(`mcp:countRequestHeaders`,{count:e.authCount}):e.auth===`environment`?t(`mcp:configuredEnvironmentVariables`):e.auth===`local`?t(`mcp:localProcess`):t(`mcp:none`)}function Ae({notify:e,onBack:t,requestText:n,requestConfirm:i}){let{t:a,language:o}=r(),s=ne(`focusSearch`),{data:c,busy:l,loading:u,error:d,change:f,reload:p}=Te(),[m,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),ee=(0,H.useCallback)(async()=>{let t=await n?.({title:a(`mcp:addMCPService`),message:a(`mcp:enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv`),inputLabel:a(`mcp:serverConfiguration`),placeholder:`https://server.example.com/mcp`,maxLength:12e3,confirmLabel:a(`mcp:continue`)});if(t?.trim()&&await i?.({title:a(`mcp:connectMCPServer`),message:a(`mcp:mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust`),confirmLabel:a(`mcp:connect`),tone:`danger`})!==!1)try{let n=await f(()=>X.add(t));v(n.services.at(-1)?.id||``),e(a(`mcp:mcpServerAdded`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},[f,e,i,n,a]),O=m.trim().toLowerCase(),N=c?.services||[],P=N.filter(e=>`${e.name} ${e.endpoint}`.toLowerCase().includes(O)),F=(c?.tools||[]).filter(e=>`${e.name} ${e.serviceName} ${e.description}`.toLowerCase().includes(O)),I=c?.metrics||{totalServices:0,onlineServices:0,availableTools:0,restrictedTools:0,errorRate:0},L=async(t,n)=>{try{await f(()=>X.setToolEnabled(t.serviceId,t.name,n))}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},re=async(t,n)=>{try{await f(()=>X.setServerEnabled(t.id,n)),e(a(n?`mcp:mcpServerEnabled`:`mcp:mcpServerDisabled`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},R=async t=>{try{await f(()=>X.test(t.id)),e(a(`mcp:mcpConnectionTestPassed`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ce=async t=>{if(await i?.({title:a(`mcp:deleteMCPServer`),message:a(`mcp:afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns`),confirmLabel:a(`mcp:delete`),tone:`danger`})!==!1)try{await f(()=>X.remove(t.id)),v(``),e(a(`mcp:mcpServerDeleted`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},le=e=>{let t=(c?.calls||[]).filter(t=>t.serviceId===e.id);return(0,Q.jsxs)(`div`,{className:`mcp-service-detail grid gap-3`,children:[(0,Q.jsx)(`p`,{className:D(`text-xs leading-normal [overflow-wrap:anywhere]`,e.error?`font-mono text-content-secondary`:`text-content-muted`),children:e.error||a(`mcp:thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes`)}),(0,Q.jsx)(`dl`,{className:Ee,children:[[a(`mcp:transport`),e.transport===`stdio`?`stdio`:e.transport===`sse`?`HTTP + SSE`:`Streamable HTTP`,!1],...e.transport===`stdio`?[[a(`mcp:executable`),e.command||`—`,!0],[a(`mcp:workingDirectory`),e.workingDirectory||`—`,!0]]:[[a(`mcp:serverAddress`),e.endpoint||`—`,!0]],[a(`mcp:latency`),e.latencyMs==null?`—`:`${e.latencyMs} ms`,!1],[a(`mcp:lastPing`),e.lastPingAt?A(e.lastPingAt,o):`—`,!1],[a(`mcp:authentication`),ke(e,a),!1]].map(([e,t,n])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:e}),(0,Q.jsx)(`dd`,{className:n?`font-mono`:`tabular-nums`,children:t})]},e))}),(0,Q.jsxs)(`section`,{className:`mcp-calls-panel min-w-0`,"aria-label":a(`mcp:recentCalls`),children:[(0,Q.jsxs)(`h3`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[a(`mcp:recentCalls`),t.length>0&&(0,Q.jsxs)(`span`,{children:[` · `,Math.min(t.length,8)]})]}),t.length?(0,Q.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.slice(0,8).map(e=>{let t=e.status===`ok`;return(0,Q.jsxs)(`li`,{className:D(`activity-row grid min-h-10 min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-center gap-2.5 py-1.5`,t?`completed`:`failed`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 place-items-center text-content-muted [&_svg]:size-3.5 [&_svg]:stroke-[2]`,children:t?(0,Q.jsx)(_,{}):(0,Q.jsx)(w,{})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`strong`,{className:`truncate font-mono text-xs font-medium text-content`,children:e.toolName}),(0,Q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:t?a(`mcp:callSucceeded`):e.error||a(`mcp:callFailed`)})]}),(0,Q.jsxs)(`span`,{className:`flex flex-col items-end text-xs text-content-muted tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-content-secondary`,children:[e.durationMs,` ms`]}),(0,Q.jsx)(`span`,{children:A(e.timestamp,o)})]})]},e.id)})}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 py-1 text-xs text-content-muted`,children:[(0,Q.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),a(`mcp:noRecentCalls`)]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsxs)(k,{size:`sm`,variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:l,onClick:()=>void ce(e),children:[(0,Q.jsx)(S,{"data-icon":`inline-start`}),a(`mcp:delete`)]}),(0,Q.jsxs)(k,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,loading:l,disabled:!e.enabled||l,onClick:()=>void R(e),children:[(0,Q.jsx)(te,{"data-icon":`inline-start`}),a(`mcp:testConnection`)]})]})]})};return(0,Q.jsxs)(oe,{title:a(`navigation:navigation.mcp`),description:a(`mcp:lede`),back:t&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Q.jsx)(se,{search:(0,Q.jsx)(ie,{id:T,value:m,onValueChange:h,placeholder:a(`navigation:pageHeader.searchServicesOrTools`),shortcut:s,clearLabel:a(`navigation:more.clearSearch`)}),actions:(0,Q.jsxs)(k,{type:`button`,className:`h-9`,"data-mcp-add":!0,disabled:l,onClick:()=>void ee(),children:[(0,Q.jsx)(y,{}),a(`navigation:pageHeader.addService`)]})}),children:[(0,Q.jsx)(xe,{notify:e,requestConfirm:i}),u&&!c&&!d?(0,Q.jsx)(j,{kind:`loading`,title:a(`mcp:loading`)}):!c&&d?(0,Q.jsx)(j,{kind:`error`,title:a(`mcp:loadFailed`),description:d.message,action:(0,Q.jsx)(k,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})}):c&&(0,Q.jsxs)(Q.Fragment,{children:[d&&(0,Q.jsxs)(z,{role:`status`,className:`mt-4 flex min-w-0 items-center justify-between gap-3 text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{children:d.message}),(0,Q.jsx)(k,{variant:`ghost`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})]}),(0,Q.jsx)(ae,{className:`mcp-services`,title:a(`mcp:services`),count:P.length,meta:N.length>0&&a(`mcp:serviceSummary`,{online:I.onlineServices,total:I.totalServices,rate:I.errorRate}),children:P.length?(0,Q.jsx)(V,{children:P.map(e=>{let[t,n]=De(e.status,a),r=e.transport===`stdio`?e.workingDirectory||e.command:e.endpoint;return(0,Q.jsx)(B,{className:`service-row`,"data-mcp-service":e.id,icon:(0,Q.jsx)(x,{}),name:e.name,description:(0,Q.jsx)(`span`,{className:`font-mono text-xs`,title:r,children:r}),status:(0,Q.jsxs)(`span`,{"data-mcp-status":e.status||`offline`,className:D(`flex items-center gap-1.5`,n&&`font-medium text-st-attn`),children:[n&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),t]}),actions:(0,Q.jsx)(E,{checked:e.enabled,disabled:l,"aria-label":a(`mcp:toggleServiceName`,{name:e.name}),onCheckedChange:t=>void re(e,t)}),expanded:g===e.id,onExpandedChange:t=>v(t?e.id:``),toggleLabel:a(`mcp:toggleServiceDetails`,{name:e.name}),detail:le(e)},e.id)})}):(0,Q.jsx)(M,{icon:x,title:a(`mcp:noServerConfigured`),description:N.length?void 0:a(`mcp:emptyAddHint`)})}),(0,Q.jsx)(ae,{className:`mcp-tools-panel`,title:a(`mcp:toolCapabilities`),count:F.length,meta:I.restrictedTools>0&&a(`mcp:toolSummary`,{count:I.restrictedTools}),children:F.length?(0,Q.jsx)(V,{children:F.map(e=>(0,Q.jsx)(B,{className:`tool-row`,"data-mcp-tool":e.piName,icon:(0,Q.jsx)(C,{}),name:(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),description:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.serviceName}),e.description&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,e.description]})]}),status:Oe(e.risk,a),actions:(0,Q.jsx)(E,{checked:!!e.enabled,disabled:l||!e.serviceEnabled,"aria-label":a(`mcp:toggleToolName`,{name:e.name}),onCheckedChange:t=>void L(e,t)})},e.piName))}):(0,Q.jsx)(M,{compact:!0,icon:C,title:a(`mcp:noToolsAvailable`)})})]})]})}export{Ae as McpPage};