@adea-ai/ui 0.162.5 → 0.162.7

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 (364) hide show
  1. package/dist/components/composites/about-dialog/about-dialog.js +5 -5
  2. package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
  3. package/dist/components/composites/accent-picker/accent-picker.js +3 -3
  4. package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
  5. package/dist/components/composites/accent-picker/custom-color-popover.js +2 -2
  6. package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
  7. package/dist/components/composites/account-menu/account-menu.js +22 -22
  8. package/dist/components/composites/account-menu/account-menu.js.map +1 -1
  9. package/dist/components/composites/action-button/action-button.js +2 -2
  10. package/dist/components/composites/action-button/action-button.js.map +1 -1
  11. package/dist/components/composites/appearance-editor/accent-swatch-groups.js +3 -3
  12. package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
  13. package/dist/components/composites/appearance-editor/appearance-choices.js +10 -10
  14. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  15. package/dist/components/composites/appearance-editor/appearance-editor.js +13 -13
  16. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  17. package/dist/components/composites/appearance-editor/appearance-rows.js +12 -12
  18. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  19. package/dist/components/composites/appearance-editor/font-settings-group.js +13 -13
  20. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
  21. package/dist/components/composites/appearance-editor/theme-preview.js +1 -1
  22. package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
  23. package/dist/components/composites/catalog-browser/catalog-browser-group.js +9 -9
  24. package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
  25. package/dist/components/composites/catalog-browser/catalog-browser.js +10 -10
  26. package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
  27. package/dist/components/composites/catalog-browser/catalog-detail.js +1 -1
  28. package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
  29. package/dist/components/composites/chain-of-thought/chain-of-thought.js +5 -5
  30. package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
  31. package/dist/components/composites/chat/chat.js +7 -7
  32. package/dist/components/composites/chat/chat.js.map +1 -1
  33. package/dist/components/composites/checkpoint/checkpoint.js +5 -5
  34. package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
  35. package/dist/components/composites/confirmation/confirmation.js +13 -13
  36. package/dist/components/composites/confirmation/confirmation.js.map +1 -1
  37. package/dist/components/composites/context/context.js +7 -7
  38. package/dist/components/composites/context/context.js.map +1 -1
  39. package/dist/components/composites/file-tree/build-file-tree.js +1 -1
  40. package/dist/components/composites/file-tree/build-file-tree.js.map +1 -1
  41. package/dist/components/composites/file-tree/file-tree.js +9 -9
  42. package/dist/components/composites/file-tree/file-tree.js.map +1 -1
  43. package/dist/components/composites/help-center/help-center.js +5 -5
  44. package/dist/components/composites/help-center/help-center.js.map +1 -1
  45. package/dist/components/composites/icon-picker/icon-picker.js +10 -10
  46. package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
  47. package/dist/components/composites/icon-picker/image-data-url.js.map +1 -1
  48. package/dist/components/composites/icon-picker/shell-icons.js +117 -117
  49. package/dist/components/composites/icon-picker/shell-icons.js.map +1 -1
  50. package/dist/components/composites/inline-citation/inline-citation.js +7 -7
  51. package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
  52. package/dist/components/composites/list-row/list-row-control.js +1 -1
  53. package/dist/components/composites/list-row/list-row-control.js.map +1 -1
  54. package/dist/components/composites/list-row/list-row.js +2 -2
  55. package/dist/components/composites/list-row/list-row.js.map +1 -1
  56. package/dist/components/composites/message-scroller/message-scroller.js +7 -7
  57. package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
  58. package/dist/components/composites/message-scroller/scroll-anchor.js +1 -1
  59. package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -1
  60. package/dist/components/composites/model-selector/model-selector.js +12 -12
  61. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  62. package/dist/components/composites/plan/plan.js +5 -5
  63. package/dist/components/composites/plan/plan.js.map +1 -1
  64. package/dist/components/composites/prompt-input/prompt-input.js +3 -3
  65. package/dist/components/composites/prompt-input/prompt-input.js.map +1 -1
  66. package/dist/components/composites/queue/queue.js +13 -13
  67. package/dist/components/composites/queue/queue.js.map +1 -1
  68. package/dist/components/composites/reasoning/reasoning.js +5 -5
  69. package/dist/components/composites/reasoning/reasoning.js.map +1 -1
  70. package/dist/components/composites/scene-controls/scene-controls.js +16 -16
  71. package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
  72. package/dist/components/composites/settings/settings-layout.js +2 -2
  73. package/dist/components/composites/settings/settings-layout.js.map +1 -1
  74. package/dist/components/composites/settings/settings-navigation.js +2 -2
  75. package/dist/components/composites/settings/settings-navigation.js.map +1 -1
  76. package/dist/components/composites/settings/settings.js +5 -5
  77. package/dist/components/composites/settings/settings.js.map +1 -1
  78. package/dist/components/composites/sources/sources.js +5 -5
  79. package/dist/components/composites/sources/sources.js.map +1 -1
  80. package/dist/components/composites/stack-trace/parse-stack-trace.js +2 -2
  81. package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -1
  82. package/dist/components/composites/stack-trace/stack-trace.js +10 -10
  83. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
  84. package/dist/components/composites/stat/stat.js +6 -6
  85. package/dist/components/composites/stat/stat.js.map +1 -1
  86. package/dist/components/composites/subagent/subagent.js +5 -5
  87. package/dist/components/composites/subagent/subagent.js.map +1 -1
  88. package/dist/components/composites/suggestion/suggestion.js +2 -2
  89. package/dist/components/composites/suggestion/suggestion.js.map +1 -1
  90. package/dist/components/composites/task/task.js +5 -5
  91. package/dist/components/composites/task/task.js.map +1 -1
  92. package/dist/components/composites/terminal/ansi.js +1 -1
  93. package/dist/components/composites/terminal/ansi.js.map +1 -1
  94. package/dist/components/composites/terminal/terminal.js +18 -18
  95. package/dist/components/composites/terminal/terminal.js.map +1 -1
  96. package/dist/components/composites/test-results/test-results.js +17 -17
  97. package/dist/components/composites/test-results/test-results.js.map +1 -1
  98. package/dist/components/composites/tool/tool.js +5 -5
  99. package/dist/components/composites/tool/tool.js.map +1 -1
  100. package/dist/components/composites/tree/tree.js +6 -6
  101. package/dist/components/composites/tree/tree.js.map +1 -1
  102. package/dist/components/composites/update-dialog/channel-control.js +1 -1
  103. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  104. package/dist/components/composites/update-dialog/update-dialog.js +23 -23
  105. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  106. package/dist/components/composites/workspace-mark/workspace-mark.js +2 -2
  107. package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
  108. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js +6 -6
  109. package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
  110. package/dist/components/composites/workspace-switcher/workspace-switcher.js +11 -11
  111. package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
  112. package/dist/components/conversation/atomic/chat-composer.js +1 -1
  113. package/dist/components/conversation/busy-send-button.js +10 -10
  114. package/dist/components/conversation/busy-send-button.js.map +1 -1
  115. package/dist/components/conversation/chat-composer.js +1 -1
  116. package/dist/components/conversation/composer-core.js +1 -1
  117. package/dist/components/conversation/composer-menu.js +2 -2
  118. package/dist/components/conversation/composer-menu.js.map +1 -1
  119. package/dist/components/conversation/conversation-avatar.js +7 -7
  120. package/dist/components/conversation/conversation-avatar.js.map +1 -1
  121. package/dist/components/conversation/conversation-pane.js +1 -1
  122. package/dist/components/conversation/conversation-pane.js.map +1 -1
  123. package/dist/components/conversation/conversation-surface.js +5 -5
  124. package/dist/components/conversation/conversation-surface.js.map +1 -1
  125. package/dist/components/conversation/internal/chat-composer-shell.js +9 -9
  126. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  127. package/dist/components/conversation/message-composer.js +9 -9
  128. package/dist/components/conversation/message-composer.js.map +1 -1
  129. package/dist/components/conversation/message-row.js +13 -13
  130. package/dist/components/conversation/message-row.js.map +1 -1
  131. package/dist/components/conversation/paste-token-editor.js +1 -1
  132. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  133. package/dist/components/conversation/scroll-follow.js +1 -1
  134. package/dist/components/conversation/thread-panel.js +5 -5
  135. package/dist/components/conversation/thread-panel.js.map +1 -1
  136. package/dist/components/conversation/transcript-composition.js +5 -5
  137. package/dist/components/conversation/transcript-composition.js.map +1 -1
  138. package/dist/components/layout/app-shell/app-shell.js +1 -1
  139. package/dist/components/layout/app-shell/app-shell.js.map +1 -1
  140. package/dist/components/layout/app-shell/skip-link.js +1 -1
  141. package/dist/components/layout/app-shell/skip-link.js.map +1 -1
  142. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js +2 -2
  143. package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
  144. package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js +1 -1
  145. package/dist/components/layout/floating-preview/floating-preview.js +7 -7
  146. package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
  147. package/dist/components/layout/orbit-layout/orbit-layout.js +1 -1
  148. package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
  149. package/dist/components/layout/page/page.js +2 -2
  150. package/dist/components/layout/page/page.js.map +1 -1
  151. package/dist/components/layout/panel/panel.js +1 -1
  152. package/dist/components/layout/panel/panel.js.map +1 -1
  153. package/dist/components/layout/pixel-pane/pixel-pane.js +1 -1
  154. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js +5 -5
  155. package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
  156. package/dist/components/layout/shell-rail/shell-rail.js +5 -5
  157. package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
  158. package/dist/components/layout/shell-top-bar/shell-top-bar.js +2 -2
  159. package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
  160. package/dist/components/layout/side-rail/side-rail.js +2 -2
  161. package/dist/components/layout/side-rail/side-rail.js.map +1 -1
  162. package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js +1 -1
  163. package/dist/components/layout/sidebar-nav/sidebar-nav.js +5 -5
  164. package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
  165. package/dist/components/layout/split-layout/pane-focus.js.map +1 -1
  166. package/dist/components/layout/split-layout/resize-controller-core-retry.js +1 -1
  167. package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
  168. package/dist/components/layout/split-layout/resize-controller-core.js +1 -1
  169. package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
  170. package/dist/components/layout/split-layout/split-layout.js +7 -7
  171. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  172. package/dist/components/layout/status-bar/status-bar.js +1 -1
  173. package/dist/components/layout/status-bar/status-bar.js.map +1 -1
  174. package/dist/components/layout/top-bar/top-bar.js +5 -5
  175. package/dist/components/layout/top-bar/top-bar.js.map +1 -1
  176. package/dist/components/layout/virtual-window/virtual-window.js +1 -1
  177. package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
  178. package/dist/components/motion/presence.js +1 -1
  179. package/dist/components/theme/appearance-panel.js +3 -3
  180. package/dist/components/theme/appearance-panel.js.map +1 -1
  181. package/dist/components/theme/lazy.js +3 -3
  182. package/dist/components/theme/lazy.js.map +1 -1
  183. package/dist/components/theme/script-projection.js +1 -1
  184. package/dist/components/theme/theme-catalogue-source.js +1 -1
  185. package/dist/components/theme/theme-document.js.map +1 -1
  186. package/dist/components/theme/theme-mode-toggle.js +7 -7
  187. package/dist/components/theme/theme-mode-toggle.js.map +1 -1
  188. package/dist/components/theme/theme-picker.js +2 -2
  189. package/dist/components/theme/theme-picker.js.map +1 -1
  190. package/dist/components/theme/theme-provider-value.js +1 -1
  191. package/dist/components/theme/theme-provider-value.js.map +1 -1
  192. package/dist/components/theme/theme-provider.js +1 -1
  193. package/dist/components/theme/theme-toggle.js +7 -7
  194. package/dist/components/theme/theme-toggle.js.map +1 -1
  195. package/dist/components/ui/accordion/accordion.js +13 -13
  196. package/dist/components/ui/accordion/accordion.js.map +1 -1
  197. package/dist/components/ui/alert/alert.js +12 -12
  198. package/dist/components/ui/alert/alert.js.map +1 -1
  199. package/dist/components/ui/alert-dialog/alert-dialog.js +14 -14
  200. package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
  201. package/dist/components/ui/annotation-surface/annotation-surface.js +2 -2
  202. package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
  203. package/dist/components/ui/aspect-ratio/aspect-ratio.js +1 -1
  204. package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
  205. package/dist/components/ui/attachment/attachment.js +16 -16
  206. package/dist/components/ui/attachment/attachment.js.map +1 -1
  207. package/dist/components/ui/avatar/avatar.js +1 -1
  208. package/dist/components/ui/avatar/avatar.js.map +1 -1
  209. package/dist/components/ui/badge/badge.js +2 -2
  210. package/dist/components/ui/badge/badge.js.map +1 -1
  211. package/dist/components/ui/board/board.js +2 -2
  212. package/dist/components/ui/board/board.js.map +1 -1
  213. package/dist/components/ui/breadcrumb/breadcrumb.js +7 -7
  214. package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
  215. package/dist/components/ui/bubble/bubble.js +2 -2
  216. package/dist/components/ui/bubble/bubble.js.map +1 -1
  217. package/dist/components/ui/button/button.js +2 -2
  218. package/dist/components/ui/button-group/button-group.js +2 -2
  219. package/dist/components/ui/button-group/button-group.js.map +1 -1
  220. package/dist/components/ui/calendar/calendar.js +8 -8
  221. package/dist/components/ui/calendar/calendar.js.map +1 -1
  222. package/dist/components/ui/callout/callout.js +2 -2
  223. package/dist/components/ui/callout/callout.js.map +1 -1
  224. package/dist/components/ui/card/card.js +2 -2
  225. package/dist/components/ui/card/card.js.map +1 -1
  226. package/dist/components/ui/carousel/carousel.js +8 -8
  227. package/dist/components/ui/carousel/carousel.js.map +1 -1
  228. package/dist/components/ui/chart/chart.js +2 -2
  229. package/dist/components/ui/chart/chart.js.map +1 -1
  230. package/dist/components/ui/checkbox/checkbox.js +6 -6
  231. package/dist/components/ui/checkbox/checkbox.js.map +1 -1
  232. package/dist/components/ui/code-block/code-block.js +6 -6
  233. package/dist/components/ui/code-block/code-block.js.map +1 -1
  234. package/dist/components/ui/collapsible/collapsible.js +7 -7
  235. package/dist/components/ui/collapsible/collapsible.js.map +1 -1
  236. package/dist/components/ui/combobox/combobox.js +21 -21
  237. package/dist/components/ui/combobox/combobox.js.map +1 -1
  238. package/dist/components/ui/combobox/value-combobox.js +1 -1
  239. package/dist/components/ui/command/command.js +23 -23
  240. package/dist/components/ui/command/command.js.map +1 -1
  241. package/dist/components/ui/context-menu/context-menu.js +2 -2
  242. package/dist/components/ui/detail-panel/detail-panel.js +5 -5
  243. package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
  244. package/dist/components/ui/dialog/dialog-layer.js +2 -2
  245. package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
  246. package/dist/components/ui/dialog/dialog.js +21 -21
  247. package/dist/components/ui/dialog/dialog.js.map +1 -1
  248. package/dist/components/ui/diff-block/diff-block.js +2 -2
  249. package/dist/components/ui/diff-block/diff-block.js.map +1 -1
  250. package/dist/components/ui/drawer/drawer.js +14 -14
  251. package/dist/components/ui/drawer/drawer.js.map +1 -1
  252. package/dist/components/ui/dropdown-menu/dropdown-menu.js +3 -3
  253. package/dist/components/ui/dropdown-menu/menu-parts.js +10 -10
  254. package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
  255. package/dist/components/ui/empty/empty-state.js +5 -5
  256. package/dist/components/ui/empty/empty-state.js.map +1 -1
  257. package/dist/components/ui/empty/empty.js +1 -1
  258. package/dist/components/ui/empty/empty.js.map +1 -1
  259. package/dist/components/ui/entity-icon/entity-icon.js +2 -2
  260. package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
  261. package/dist/components/ui/field/field.js +14 -14
  262. package/dist/components/ui/field/field.js.map +1 -1
  263. package/dist/components/ui/field/number-field.js +2 -2
  264. package/dist/components/ui/field/number-field.js.map +1 -1
  265. package/dist/components/ui/hover-card/hover-card.js +10 -10
  266. package/dist/components/ui/hover-card/hover-card.js.map +1 -1
  267. package/dist/components/ui/input/input-control.js +1 -1
  268. package/dist/components/ui/input/input-control.js.map +1 -1
  269. package/dist/components/ui/input/input.js +2 -2
  270. package/dist/components/ui/input/input.js.map +1 -1
  271. package/dist/components/ui/input-group/input-group.js +2 -2
  272. package/dist/components/ui/input-group/input-group.js.map +1 -1
  273. package/dist/components/ui/input-group/secret-input-group.js +2 -2
  274. package/dist/components/ui/input-otp/input-otp.js +2 -2
  275. package/dist/components/ui/input-otp/input-otp.js.map +1 -1
  276. package/dist/components/ui/item/item.js +2 -2
  277. package/dist/components/ui/item/item.js.map +1 -1
  278. package/dist/components/ui/kbd/kbd.js +2 -2
  279. package/dist/components/ui/kbd/kbd.js.map +1 -1
  280. package/dist/components/ui/label/label.js +1 -1
  281. package/dist/components/ui/label/label.js.map +1 -1
  282. package/dist/components/ui/marker/marker.js +2 -2
  283. package/dist/components/ui/marker/marker.js.map +1 -1
  284. package/dist/components/ui/menubar/menubar.js +7 -7
  285. package/dist/components/ui/menubar/menubar.js.map +1 -1
  286. package/dist/components/ui/message/message.js +3 -3
  287. package/dist/components/ui/message/message.js.map +1 -1
  288. package/dist/components/ui/modal-dialog/modal-dialog.js +2 -2
  289. package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
  290. package/dist/components/ui/native-select/native-select.js +5 -5
  291. package/dist/components/ui/native-select/native-select.js.map +1 -1
  292. package/dist/components/ui/navigation-menu/navigation-menu.js +18 -18
  293. package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
  294. package/dist/components/ui/pagination/pagination.js +28 -28
  295. package/dist/components/ui/pagination/pagination.js.map +1 -1
  296. package/dist/components/ui/popover/popover.js +15 -15
  297. package/dist/components/ui/popover/popover.js.map +1 -1
  298. package/dist/components/ui/progress/progress.js +5 -5
  299. package/dist/components/ui/progress/progress.js.map +1 -1
  300. package/dist/components/ui/questionnaire/questionnaire.js +10 -10
  301. package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
  302. package/dist/components/ui/radio-group/radio-group.js +9 -9
  303. package/dist/components/ui/radio-group/radio-group.js.map +1 -1
  304. package/dist/components/ui/resizable/resizable.js +11 -11
  305. package/dist/components/ui/resizable/resizable.js.map +1 -1
  306. package/dist/components/ui/scroll-area/scroll-area.js +1 -1
  307. package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
  308. package/dist/components/ui/select/select.js +21 -21
  309. package/dist/components/ui/select/select.js.map +1 -1
  310. package/dist/components/ui/separator/separator.js +5 -5
  311. package/dist/components/ui/separator/separator.js.map +1 -1
  312. package/dist/components/ui/sheet/sheet.js +6 -6
  313. package/dist/components/ui/sheet/sheet.js.map +1 -1
  314. package/dist/components/ui/skeleton/skeleton.js +1 -1
  315. package/dist/components/ui/skeleton/skeleton.js.map +1 -1
  316. package/dist/components/ui/slider/slider.js +5 -5
  317. package/dist/components/ui/slider/slider.js.map +1 -1
  318. package/dist/components/ui/spinner/spinner.js +5 -5
  319. package/dist/components/ui/spinner/spinner.js.map +1 -1
  320. package/dist/components/ui/status-chip/status-chip.js +2 -2
  321. package/dist/components/ui/status-chip/status-chip.js.map +1 -1
  322. package/dist/components/ui/switch/switch.js +4 -4
  323. package/dist/components/ui/switch/switch.js.map +1 -1
  324. package/dist/components/ui/table/table.js +1 -1
  325. package/dist/components/ui/table/table.js.map +1 -1
  326. package/dist/components/ui/tabs/tabs.js +7 -7
  327. package/dist/components/ui/tabs/tabs.js.map +1 -1
  328. package/dist/components/ui/text-link/text-link.js +1 -1
  329. package/dist/components/ui/text-link/text-link.js.map +1 -1
  330. package/dist/components/ui/textarea/textarea.js +2 -2
  331. package/dist/components/ui/textarea/textarea.js.map +1 -1
  332. package/dist/components/ui/toast/toast.js +7 -7
  333. package/dist/components/ui/toast/toast.js.map +1 -1
  334. package/dist/components/ui/toggle/toggle.js +6 -6
  335. package/dist/components/ui/toggle/toggle.js.map +1 -1
  336. package/dist/components/ui/toggle-group/toggle-group.js +7 -8
  337. package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
  338. package/dist/components/ui/tooltip/deferred-tooltip.js +6 -6
  339. package/dist/components/ui/tooltip/deferred-tooltip.js.map +1 -1
  340. package/dist/components/ui/tooltip/lazy-tooltip.js +2 -2
  341. package/dist/components/ui/tooltip/tooltip.js +10 -10
  342. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  343. package/dist/components/ui/trace/trace.js +19 -19
  344. package/dist/components/ui/trace/trace.js.map +1 -1
  345. package/dist/components/ui/typography/typography.js +2 -2
  346. package/dist/lib/accent-presets.js +1 -1
  347. package/dist/lib/accent-roles.js +2 -2
  348. package/dist/lib/async-action.js +1 -1
  349. package/dist/lib/create-poll.js +1 -1
  350. package/dist/lib/create-poll.js.map +1 -1
  351. package/dist/lib/external-link.js +1 -1
  352. package/dist/lib/external-link.js.map +1 -1
  353. package/dist/lib/fast-icon.js +1 -1
  354. package/dist/lib/theme-css.js +1 -1
  355. package/dist/lib/theme-engine-light.js +1 -1
  356. package/dist/lib/theme-projection.js +2 -2
  357. package/dist/lib/theme-records.js +1 -1
  358. package/dist/lib/themes.js +1 -1
  359. package/dist/lib/themes.js.map +1 -1
  360. package/dist/lib/tooltip-focus-gate.js.map +1 -1
  361. package/dist/lib/utils.js +1 -1
  362. package/dist/vite/source-parser.js +1 -1
  363. package/dist/vite/tailwind-sources.js +1 -1
  364. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"ansi.js","names":[],"sources":["../../../../src/components/composites/terminal/ansi.ts"],"sourcesContent":["/**\n * A terminal's text, read safely.\n *\n * Command output is untrusted bytes, not text: it carries colour for the human\n * who ran the command, cursor control for a screen that is not here, and, from\n * a hostile program, sequences that ask a terminal emulator to rewrite its\n * title, write to the clipboard (OSC 52) or hide what it printed. This parser\n * accepts exactly the part a transcript can honour and drops the rest:\n *\n * - **Kept:** printable text, `\\n`, `\\r` (the cursor returns to column 0 and\n * later text overwrites, which is how a progress bar redraws itself), `\\b`\n * (the cursor steps back one column), tab, `ESC[…K` (erase in line, which\n * progress bars pair with `\\r`), and SGR `ESC[…m` for the sixteen theme\n * colours, bold, dim, italic, underline, strike-through and reverse video.\n * - **Mapped:** 256-colour and truecolour SGR become the nearest of the sixteen,\n * so the output keeps the theme's palette and its contrast guarantees instead\n * of a program's idea of \"dark blue\" on a light terminal.\n * - **Dropped, never echoed:** every other CSI (cursor movement, scrolling,\n * private modes), OSC, DCS/SOS/PM/APC strings, charset designations, the 8-bit\n * C1 forms of all of these, every other control character, and the Unicode\n * bidirectional overrides that make text read differently from how it is\n * stored. A malformed or truncated sequence is dropped with its payload, so a\n * half-received `ESC[3` never shows up as the text \"3\".\n *\n * Nothing here produces markup. The result is plain strings with a style object,\n * and the renderer decides what a style looks like.\n *\n * ## Why a stateful parser\n *\n * Output arrives in chunks that split anywhere, inside an escape sequence, in\n * the middle of a line. `createAnsiParser` keeps the half-read sequence, the\n * current style and the line being written between `write` calls, so a chunk\n * boundary changes nothing about the result. Finished lines are immutable and\n * never touched again, which is what lets a renderer keep their DOM while the\n * last line keeps growing. `parseAnsi` is the same thing run once.\n */\n\n/** An index into the sixteen-colour palette: 0–7 normal, 8–15 bright. */\nexport type AnsiColor = number\n\nexport type AnsiStyle = Readonly<{\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: true\n dim?: true\n italic?: true\n underline?: true\n strike?: true\n inverse?: true\n}>\n\nexport type AnsiSegment = Readonly<{ text: string; style: AnsiStyle }>\n\nexport type AnsiLine = Readonly<{\n segments: readonly AnsiSegment[]\n /** Characters past `maxLineLength` that were not kept. Zero for most lines. */\n truncated: number\n}>\n\nexport type AnsiParserOptions = {\n /** Characters kept per line; the rest are counted in `truncated`. Default 10 000. */\n maxLineLength?: number\n /**\n * Finished lines kept. The oldest are discarded (and counted in `droppedLines`)\n * past this, so a command that prints for an hour cannot grow the parser\n * without bound. Default 200 000.\n */\n retainLines?: number\n}\n\nexport type AnsiParser = {\n /** Feed the next chunk. Chunks may split anywhere, including inside an escape. */\n write(chunk: string): void\n /** Finished lines, oldest first. The array is mutated in place as lines arrive. */\n readonly lines: readonly AnsiLine[]\n /** The line still being written, or `undefined` while it is empty. */\n openLine(): AnsiLine | undefined\n /** Finished lines discarded because of `retainLines`. */\n readonly droppedLines: number\n}\n\nexport const ANSI_MAX_LINE_LENGTH = 10_000\nexport const ANSI_RETAIN_LINES = 200_000\n\n/** Longest CSI parameter string worth reading; a real SGR is under 40 characters. */\nconst CSI_MAX = 256\n\nconst PLAIN: AnsiStyle = Object.freeze({})\nconst styleCache = new Map<string, AnsiStyle>()\nconst STYLE_CACHE_LIMIT = 4096\n\n/**\n * Styles are shared by value so a long run of identical style compares by\n * reference when cells are merged into segments, and so a million coloured\n * characters do not allocate a million style objects.\n */\nfunction intern(style: {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}): AnsiStyle {\n const key = [\n style.fg ?? '',\n style.bg ?? '',\n style.bold ? 'b' : '',\n style.dim ? 'd' : '',\n style.italic ? 'i' : '',\n style.underline ? 'u' : '',\n style.strike ? 's' : '',\n style.inverse ? 'r' : '',\n ].join('|')\n if (key === '|||||||') return PLAIN\n const cached = styleCache.get(key)\n if (cached) return cached\n const next: AnsiStyle = Object.freeze({\n ...(style.fg !== undefined && { fg: style.fg }),\n ...(style.bg !== undefined && { bg: style.bg }),\n ...(style.bold && { bold: true as const }),\n ...(style.dim && { dim: true as const }),\n ...(style.italic && { italic: true as const }),\n ...(style.underline && { underline: true as const }),\n ...(style.strike && { strike: true as const }),\n ...(style.inverse && { inverse: true as const }),\n })\n if (styleCache.size < STYLE_CACHE_LIMIT) styleCache.set(key, next)\n return next\n}\n\n/** Whether a style paints nothing, so the renderer can emit a bare text node. */\nexport function isPlainStyle(style: AnsiStyle): boolean {\n return (\n style.fg === undefined &&\n style.bg === undefined &&\n !style.bold &&\n !style.dim &&\n !style.italic &&\n !style.underline &&\n !style.strike &&\n !style.inverse\n )\n}\n\n/**\n * The colours a style actually paints. Reverse video swaps them; a swapped side\n * with no colour of its own resolves to the terminal's default foreground or\n * background (`'default-fg'`, `'default-bg'`), which are themselves theme tokens.\n */\nexport type ResolvedColors = Readonly<{\n fg: AnsiColor | 'default-bg' | undefined\n bg: AnsiColor | 'default-fg' | undefined\n}>\n\nexport function resolveColors(style: AnsiStyle): ResolvedColors {\n if (!style.inverse) return { fg: style.fg, bg: style.bg }\n return { fg: style.bg ?? 'default-bg', bg: style.fg ?? 'default-fg' }\n}\n\n// The xterm default palette, used only to decide which of the sixteen theme\n// colours an extended colour is closest to.\nconst XTERM_16: readonly (readonly [number, number, number])[] = [\n [0, 0, 0],\n [205, 0, 0],\n [0, 205, 0],\n [205, 205, 0],\n [0, 0, 238],\n [205, 0, 205],\n [0, 205, 205],\n [229, 229, 229],\n [127, 127, 127],\n [255, 0, 0],\n [0, 255, 0],\n [255, 255, 0],\n [92, 92, 255],\n [255, 0, 255],\n [0, 255, 255],\n [255, 255, 255],\n]\nconst CUBE_LEVELS = [0, 95, 135, 175, 215, 255] as const\n\nconst clamp = (value: number) => Math.min(255, Math.max(0, Math.round(value) || 0))\n\n/** The palette index (0–15) nearest to an RGB colour. Channels are clamped to 0–255. */\nexport function nearestAnsiColor(r: number, g: number, b: number): AnsiColor {\n const red = clamp(r)\n const green = clamp(g)\n const blue = clamp(b)\n let best = 0\n let bestDistance = Infinity\n for (let index = 0; index < XTERM_16.length; index += 1) {\n const [pr, pg, pb] = XTERM_16[index]!\n // The weights are the \"redmean\" approximation: cheap, and much closer to how\n // the eye separates two colours than plain Euclidean distance.\n const meanRed = (red + pr) / 2\n const dr = red - pr\n const dg = green - pg\n const db = blue - pb\n const distance =\n (2 + meanRed / 256) * dr * dr + 4 * dg * dg + (2 + (255 - meanRed) / 256) * db * db\n if (distance < bestDistance) {\n bestDistance = distance\n best = index\n }\n }\n return best\n}\n\n/** Map a 256-colour index to the sixteen. Out-of-range indices give `undefined`. */\nexport function ansi256ToColor(index: number): AnsiColor | undefined {\n if (!Number.isInteger(index) || index < 0 || index > 255) return undefined\n if (index < 16) return index\n if (index >= 232) {\n const grey = 8 + (index - 232) * 10\n return nearestAnsiColor(grey, grey, grey)\n }\n const cube = index - 16\n return nearestAnsiColor(\n CUBE_LEVELS[Math.floor(cube / 36)]!,\n CUBE_LEVELS[Math.floor(cube / 6) % 6]!,\n CUBE_LEVELS[cube % 6]!\n )\n}\n\ntype MutableStyle = {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}\n\n/** A parameter is a short run of digits; anything else is not a number we trust. */\nfunction toNumber(token: string | undefined): number | undefined {\n if (token === undefined) return undefined\n if (token === '') return 0\n if (token.length > 5 || !/^\\d+$/.test(token)) return undefined\n return Number(token)\n}\n\n/**\n * SGR results per interned style. Output repeats a handful of sequences\n * (`\\x1b[32m`, `\\x1b[0m`) on every line, and the style they start from is\n * interned, so a lookup replaces the parse and the intern key on each one.\n */\nconst sgrCache = new WeakMap<AnsiStyle, Map<string, AnsiStyle>>()\nconst SGR_CACHE_LIMIT = 64\n\n/**\n * Apply one SGR parameter list to a style. Unknown parameters are skipped one\n * at a time, so a program using a code we ignore still gets the colours around\n * it. Extended colours (38/48) consume their operands whether or not they are\n * valid, so a malformed one cannot be re-read as unrelated codes.\n */\nfunction applySgr(current: AnsiStyle, params: string): AnsiStyle {\n let byParams = sgrCache.get(current)\n const cached = byParams?.get(params)\n if (cached) return cached\n const next = parseSgr(current, params)\n if (!byParams) sgrCache.set(current, (byParams = new Map()))\n if (byParams.size < SGR_CACHE_LIMIT) byParams.set(params, next)\n return next\n}\n\nfunction parseSgr(current: AnsiStyle, params: string): AnsiStyle {\n const style: MutableStyle = { ...current }\n const tokens = params === '' ? ['0'] : params.split(';')\n\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i]!\n // The colon form `38:2::r:g:b` carries its operands in one token.\n if (token.includes(':')) {\n const parts = token.split(':')\n const head = toNumber(parts[0])\n if (head === 38 || head === 48) {\n const color = extendedColor(parts[1] === undefined ? [] : parts.slice(1), true)\n if (color !== null) assign(style, head, color)\n } else if (head === 4) {\n if (parts[1] === '0') style.underline = false\n else style.underline = true\n }\n continue\n }\n\n const code = toNumber(token)\n if (code === undefined) continue\n\n if (code === 38 || code === 48) {\n const mode = toNumber(tokens[i + 1])\n const count = mode === 5 ? 1 : mode === 2 ? 3 : 0\n const operands = tokens.slice(i + 2, i + 2 + count)\n i += 1 + count\n const color = extendedColor([String(mode ?? ''), ...operands], false)\n if (color !== null) assign(style, code, color)\n continue\n }\n if (code === 58) {\n // Underline colour: consumed so its operands are not read as codes, then ignored.\n const mode = toNumber(tokens[i + 1])\n i += 1 + (mode === 5 ? 1 : mode === 2 ? 3 : 0)\n continue\n }\n\n if (code === 0) {\n delete style.fg\n delete style.bg\n style.bold = style.dim = style.italic = style.underline = false\n style.strike = style.inverse = false\n } else if (code === 1) style.bold = true\n else if (code === 2) style.dim = true\n else if (code === 3) style.italic = true\n else if (code === 4 || code === 21) style.underline = true\n else if (code === 7) style.inverse = true\n else if (code === 9) style.strike = true\n else if (code === 22) style.bold = style.dim = false\n else if (code === 23) style.italic = false\n else if (code === 24) style.underline = false\n else if (code === 27) style.inverse = false\n else if (code === 29) style.strike = false\n else if (code >= 30 && code <= 37) style.fg = code - 30\n else if (code === 39) delete style.fg\n else if (code >= 40 && code <= 47) style.bg = code - 40\n else if (code === 49) delete style.bg\n else if (code >= 90 && code <= 97) style.fg = code - 90 + 8\n else if (code >= 100 && code <= 107) style.bg = code - 100 + 8\n // Blink (5, 6), conceal (8), overline (53) and the rest are ignored. Conceal\n // in particular is not honoured: output must not be able to hide itself.\n }\n return intern(style)\n}\n\n/** The colour an extended-colour operand list names, or `null` when it is invalid. */\nfunction extendedColor(parts: readonly string[], colon: boolean): AnsiColor | null {\n const mode = toNumber(parts[0])\n if (mode === 5) {\n const index = toNumber(parts[1])\n const color = index === undefined ? undefined : ansi256ToColor(index)\n return color ?? null\n }\n if (mode === 2) {\n // In the colon form a colour-space id may precede the channels, empty or not.\n const channels = colon && parts.length > 4 ? parts.slice(2) : parts.slice(1)\n const [r, g, b] = channels.slice(0, 3).map(toNumber)\n if (r === undefined || g === undefined || b === undefined) return null\n if (r > 255 || g > 255 || b > 255) return null\n return nearestAnsiColor(r, g, b)\n }\n return null\n}\n\nfunction assign(style: MutableStyle, code: number, color: AnsiColor): void {\n if (code === 38) style.fg = color\n else style.bg = color\n}\n\n/** Characters that are never rendered: C0 except tab, DEL, C1, and bidi controls. */\nfunction isDroppedControl(code: number): boolean {\n return (\n (code < 0x20 && code !== 0x09) ||\n code === 0x7f ||\n (code >= 0x80 && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n )\n}\n\ntype Run = { text: string; style: AnsiStyle }\n\n/**\n * The line being written. While the cursor only ever moves right it is a list of\n * styled runs, which is cheap; the first time something moves it left (`\\r`,\n * `\\b`) it becomes one cell per UTF-16 unit so later text can overwrite.\n */\nclass LineBuffer {\n private runs: Run[] = []\n private cells: string[] | undefined\n private cellStyles: AnsiStyle[] | undefined\n private cursor = 0\n private length = 0\n private dropped = 0\n /** A `\\r` seen but not yet applied: `\\r\\n` is by far the common case. */\n private pendingReturn = false\n\n constructor(private readonly max: number) {}\n\n isEmpty(): boolean {\n return this.length === 0 && this.dropped === 0\n }\n\n put(text: string, style: AnsiStyle): void {\n if (text === '') return\n this.applyReturn()\n if (this.cells === undefined) {\n const room = this.max - this.length\n if (room <= 0) {\n this.dropped += text.length\n return\n }\n const kept = text.length > room ? text.slice(0, room) : text\n this.dropped += text.length - kept.length\n const last = this.runs[this.runs.length - 1]\n if (last && last.style === style) last.text += kept\n else this.runs.push({ text: kept, style })\n this.length += kept.length\n this.cursor = this.length\n return\n }\n for (let i = 0; i < text.length; i += 1) this.putCell(text[i]!, style)\n }\n\n private putCell(char: string, style: AnsiStyle): void {\n const cells = this.cells!\n const styles = this.cellStyles!\n if (this.cursor >= this.max) {\n this.dropped += 1\n return\n }\n while (cells.length < this.cursor) {\n cells.push(' ')\n styles.push(PLAIN)\n }\n cells[this.cursor] = char\n styles[this.cursor] = style\n this.cursor += 1\n this.length = cells.length\n }\n\n carriageReturn(): void {\n this.pendingReturn = true\n }\n\n backspace(): void {\n this.applyReturn()\n if (this.cursor === 0) return\n this.toCells()\n this.cursor -= 1\n }\n\n /** `ESC[nK`: 0 from the cursor to the end, 1 start to cursor, 2 the whole line. */\n eraseInLine(mode: number): void {\n this.applyReturn()\n if (mode === 0 && this.cursor >= this.length) return\n this.toCells()\n const cells = this.cells!\n const styles = this.cellStyles!\n if (mode === 0) {\n cells.length = this.cursor\n styles.length = this.cursor\n } else if (mode === 1) {\n for (let i = 0; i <= this.cursor && i < cells.length; i += 1) {\n cells[i] = ' '\n styles[i] = PLAIN\n }\n } else if (mode === 2) {\n cells.length = 0\n styles.length = 0\n }\n this.length = cells.length\n }\n\n private applyReturn(): void {\n if (!this.pendingReturn) return\n this.pendingReturn = false\n if (this.length === 0) {\n this.cursor = 0\n return\n }\n this.toCells()\n this.cursor = 0\n }\n\n private toCells(): void {\n if (this.cells !== undefined) return\n const cells: string[] = []\n const styles: AnsiStyle[] = []\n for (const run of this.runs) {\n for (let i = 0; i < run.text.length; i += 1) {\n cells.push(run.text[i]!)\n styles.push(run.style)\n }\n }\n this.cells = cells\n this.cellStyles = styles\n this.runs = []\n this.cursor = Math.min(this.cursor, cells.length)\n }\n\n snapshot(): AnsiLine {\n const segments: AnsiSegment[] = []\n if (this.cells === undefined) {\n for (const run of this.runs) segments.push({ text: run.text, style: run.style })\n } else {\n const cells = this.cells\n const styles = this.cellStyles!\n let start = 0\n for (let i = 1; i <= cells.length; i += 1) {\n if (i === cells.length || styles[i] !== styles[start]) {\n segments.push({ text: cells.slice(start, i).join(''), style: styles[start]! })\n start = i\n }\n }\n }\n return { segments, truncated: this.dropped }\n }\n\n reset(): void {\n this.runs = []\n this.cells = undefined\n this.cellStyles = undefined\n this.cursor = 0\n this.length = 0\n this.dropped = 0\n this.pendingReturn = false\n }\n}\n\ntype State = 'text' | 'esc' | 'esc-intermediate' | 'csi' | 'string' | 'string-esc'\n\nexport function createAnsiParser(options: AnsiParserOptions = {}): AnsiParser {\n const maxLine = Math.max(1, Math.floor(options.maxLineLength ?? ANSI_MAX_LINE_LENGTH))\n const retain = Math.max(1, Math.floor(options.retainLines ?? ANSI_RETAIN_LINES))\n const lines: AnsiLine[] = []\n let droppedLines = 0\n const line = new LineBuffer(maxLine)\n let style: AnsiStyle = PLAIN\n let state: State = 'text'\n let csi = ''\n let csiOverflow = false\n // Only the 7-bit `ESC [` introducer is honoured. The 8-bit form is consumed so\n // its parameters are not echoed, but it never changes the style: it is a rarity\n // in real output and a favourite of filter-evasion payloads.\n let csiHonoured = true\n\n const finishLine = () => {\n lines.push(line.snapshot())\n line.reset()\n // Trim in blocks so the common append stays O(1) amortised.\n if (lines.length > retain + Math.max(64, retain >> 3)) {\n const excess = lines.length - retain\n lines.splice(0, excess)\n droppedLines += excess\n }\n }\n\n const runCsi = (final: string) => {\n if (csiOverflow || !csiHonoured) return\n // Only plain numeric parameters are honoured; a private marker (`?`, `>`,\n // `<`, `=`) or an intermediate byte makes this some other command entirely.\n if (!/^[\\d;:]*$/.test(csi)) return\n if (final === 'm') style = applySgr(style, csi)\n else if (final === 'K') {\n const mode = toNumber(csi.split(';')[0])\n if (mode !== undefined && mode <= 2) line.eraseInLine(mode)\n }\n }\n\n function write(chunk: string): void {\n for (let i = 0; i < chunk.length; i += 1) {\n const code = chunk.charCodeAt(i)\n\n switch (state) {\n case 'text': {\n if (!isDroppedControl(code)) {\n // Take the whole run of ordinary characters at once.\n let end = i + 1\n while (end < chunk.length && !isDroppedControl(chunk.charCodeAt(end))) end += 1\n line.put(chunk.slice(i, end), style)\n i = end - 1\n break\n }\n if (code === 0x1b) state = 'esc'\n else if (code === 0x0a) finishLine()\n else if (code === 0x0d) line.carriageReturn()\n else if (code === 0x08) line.backspace()\n else if (code === 0x9b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = false\n } else if (\n code === 0x9d ||\n code === 0x90 ||\n code === 0x98 ||\n code === 0x9e ||\n code === 0x9f\n ) {\n state = 'string'\n }\n // Every other control character is dropped.\n break\n }\n case 'esc': {\n if (code === 0x5b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = true\n } else if (\n code === 0x5d ||\n code === 0x50 ||\n code === 0x58 ||\n code === 0x5e ||\n code === 0x5f\n ) {\n state = 'string'\n } else if (code >= 0x20 && code <= 0x2f) state = 'esc-intermediate'\n else if (code >= 0x30 && code <= 0x7e) state = 'text'\n else if (code === 0x1b) state = 'esc'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'esc-intermediate': {\n if (code >= 0x20 && code <= 0x2f) break\n if (code >= 0x30 && code <= 0x7e) state = 'text'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'csi': {\n if (code >= 0x20 && code <= 0x3f) {\n if (csi.length < CSI_MAX) csi += chunk[i]\n else csiOverflow = true\n } else if (code >= 0x40 && code <= 0x7e) {\n runCsi(chunk[i]!)\n state = 'text'\n } else if (code === 0x1b) state = 'esc'\n else {\n // A control character or non-ASCII byte cannot be part of a CSI: the\n // sequence was malformed. Drop it and read this character normally.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string': {\n if (code === 0x07 || code === 0x9c) state = 'text'\n else if (code === 0x1b) state = 'string-esc'\n else if (code === 0x0a || code === 0x0d) {\n // No real title or clipboard payload spans a line. Ending here bounds\n // what an unterminated string can swallow to the rest of its line.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string-esc': {\n if (code === 0x5c) state = 'text'\n else {\n state = 'esc'\n i -= 1\n }\n break\n }\n }\n }\n }\n\n return {\n write,\n lines,\n openLine: () => (line.isEmpty() ? undefined : line.snapshot()),\n get droppedLines() {\n return droppedLines\n },\n }\n}\n\n/** Parse a whole output at once: finished lines plus the open one, if any. */\nexport function parseAnsi(text: string, options?: AnsiParserOptions): AnsiLine[] {\n const parser = createAnsiParser(options)\n parser.write(text)\n const open = parser.openLine()\n return open ? [...parser.lines, open] : [...parser.lines]\n}\n\n/**\n * The whole output as a reader sees it, for the clipboard: every line, none\n * shortened, with escape sequences and overwritten text resolved away.\n */\nexport function ansiPlainText(text: string): string {\n const parser = createAnsiParser({\n maxLineLength: Number.POSITIVE_INFINITY,\n retainLines: Number.POSITIVE_INFINITY,\n })\n parser.write(text)\n const open = parser.openLine()\n // Finished lines carry their newline even when only control sequences follow.\n return [...parser.lines.map(ansiLineText), open ? ansiLineText(open) : ''].join('\\n')\n}\n\n/** A line's text with styling removed, for tests and for accessible names. */\nexport function ansiLineText(line: AnsiLine): string {\n return line.segments.map((segment) => segment.text).join('')\n}\n"],"mappings":";AAiFA,IAAa,uBAAuB;AACpC,IAAa,oBAAoB;;AAGjC,IAAM,UAAU;AAEhB,IAAM,QAAmB,OAAO,OAAO,CAAC,CAAC;AACzC,IAAM,6BAAa,IAAI,IAAuB;AAC9C,IAAM,oBAAoB;;;;;;AAO1B,SAAS,OAAO,OASF;CACZ,MAAM,MAAM;EACV,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,MAAM,OAAO,MAAM;EACnB,MAAM,MAAM,MAAM;EAClB,MAAM,SAAS,MAAM;EACrB,MAAM,YAAY,MAAM;EACxB,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,MAAM;CACxB,CAAC,CAAC,KAAK,GAAG;CACV,IAAI,QAAQ,WAAW,OAAO;CAC9B,MAAM,SAAS,WAAW,IAAI,GAAG;CACjC,IAAI,QAAQ,OAAO;CACnB,MAAM,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ansi.ts"],"sourcesContent":["/**\n * A terminal's text, read safely.\n *\n * Command output is untrusted bytes, not text: it carries colour for the human\n * who ran the command, cursor control for a screen that is not here, and, from\n * a hostile program, sequences that ask a terminal emulator to rewrite its\n * title, write to the clipboard (OSC 52) or hide what it printed. This parser\n * accepts exactly the part a transcript can honour and drops the rest:\n *\n * - **Kept:** printable text, `\\n`, `\\r` (the cursor returns to column 0 and\n * later text overwrites, which is how a progress bar redraws itself), `\\b`\n * (the cursor steps back one column), tab, `ESC[…K` (erase in line, which\n * progress bars pair with `\\r`), and SGR `ESC[…m` for the sixteen theme\n * colours, bold, dim, italic, underline, strike-through and reverse video.\n * - **Mapped:** 256-colour and truecolour SGR become the nearest of the sixteen,\n * so the output keeps the theme's palette and its contrast guarantees instead\n * of a program's idea of \"dark blue\" on a light terminal.\n * - **Dropped, never echoed:** every other CSI (cursor movement, scrolling,\n * private modes), OSC, DCS/SOS/PM/APC strings, charset designations, the 8-bit\n * C1 forms of all of these, every other control character, and the Unicode\n * bidirectional overrides that make text read differently from how it is\n * stored. A malformed or truncated sequence is dropped with its payload, so a\n * half-received `ESC[3` never shows up as the text \"3\".\n *\n * Nothing here produces markup. The result is plain strings with a style object,\n * and the renderer decides what a style looks like.\n *\n * ## Why a stateful parser\n *\n * Output arrives in chunks that split anywhere, inside an escape sequence, in\n * the middle of a line. `createAnsiParser` keeps the half-read sequence, the\n * current style and the line being written between `write` calls, so a chunk\n * boundary changes nothing about the result. Finished lines are immutable and\n * never touched again, which is what lets a renderer keep their DOM while the\n * last line keeps growing. `parseAnsi` is the same thing run once.\n */\n\n/** An index into the sixteen-colour palette: 0–7 normal, 8–15 bright. */\nexport type AnsiColor = number\n\nexport type AnsiStyle = Readonly<{\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: true\n dim?: true\n italic?: true\n underline?: true\n strike?: true\n inverse?: true\n}>\n\nexport type AnsiSegment = Readonly<{ text: string; style: AnsiStyle }>\n\nexport type AnsiLine = Readonly<{\n segments: readonly AnsiSegment[]\n /** Characters past `maxLineLength` that were not kept. Zero for most lines. */\n truncated: number\n}>\n\nexport type AnsiParserOptions = {\n /** Characters kept per line; the rest are counted in `truncated`. Default 10 000. */\n maxLineLength?: number\n /**\n * Finished lines kept. The oldest are discarded (and counted in `droppedLines`)\n * past this, so a command that prints for an hour cannot grow the parser\n * without bound. Default 200 000.\n */\n retainLines?: number\n}\n\nexport type AnsiParser = {\n /** Feed the next chunk. Chunks may split anywhere, including inside an escape. */\n write(chunk: string): void\n /** Finished lines, oldest first. The array is mutated in place as lines arrive. */\n readonly lines: readonly AnsiLine[]\n /** The line still being written, or `undefined` while it is empty. */\n openLine(): AnsiLine | undefined\n /** Finished lines discarded because of `retainLines`. */\n readonly droppedLines: number\n}\n\nexport const ANSI_MAX_LINE_LENGTH = 10_000\nexport const ANSI_RETAIN_LINES = 200_000\n\n/** Longest CSI parameter string worth reading; a real SGR is under 40 characters. */\nconst CSI_MAX = 256\n\nconst PLAIN: AnsiStyle = Object.freeze({})\nconst styleCache = new Map<string, AnsiStyle>()\nconst STYLE_CACHE_LIMIT = 4096\n\n/**\n * Styles are shared by value so a long run of identical style compares by\n * reference when cells are merged into segments, and so a million coloured\n * characters do not allocate a million style objects.\n */\nfunction intern(style: {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}): AnsiStyle {\n const key = [\n style.fg ?? '',\n style.bg ?? '',\n style.bold ? 'b' : '',\n style.dim ? 'd' : '',\n style.italic ? 'i' : '',\n style.underline ? 'u' : '',\n style.strike ? 's' : '',\n style.inverse ? 'r' : '',\n ].join('|')\n if (key === '|||||||') return PLAIN\n const cached = styleCache.get(key)\n if (cached) return cached\n const next: AnsiStyle = Object.freeze({\n ...(style.fg !== undefined && { fg: style.fg }),\n ...(style.bg !== undefined && { bg: style.bg }),\n ...(style.bold && { bold: true as const }),\n ...(style.dim && { dim: true as const }),\n ...(style.italic && { italic: true as const }),\n ...(style.underline && { underline: true as const }),\n ...(style.strike && { strike: true as const }),\n ...(style.inverse && { inverse: true as const }),\n })\n if (styleCache.size < STYLE_CACHE_LIMIT) styleCache.set(key, next)\n return next\n}\n\n/** Whether a style paints nothing, so the renderer can emit a bare text node. */\nexport function isPlainStyle(style: AnsiStyle): boolean {\n return (\n style.fg === undefined &&\n style.bg === undefined &&\n !style.bold &&\n !style.dim &&\n !style.italic &&\n !style.underline &&\n !style.strike &&\n !style.inverse\n )\n}\n\n/**\n * The colours a style actually paints. Reverse video swaps them; a swapped side\n * with no colour of its own resolves to the terminal's default foreground or\n * background (`'default-fg'`, `'default-bg'`), which are themselves theme tokens.\n */\nexport type ResolvedColors = Readonly<{\n fg: AnsiColor | 'default-bg' | undefined\n bg: AnsiColor | 'default-fg' | undefined\n}>\n\nexport function resolveColors(style: AnsiStyle): ResolvedColors {\n if (!style.inverse) return { fg: style.fg, bg: style.bg }\n return { fg: style.bg ?? 'default-bg', bg: style.fg ?? 'default-fg' }\n}\n\n// The xterm default palette, used only to decide which of the sixteen theme\n// colours an extended colour is closest to.\nconst XTERM_16: readonly (readonly [number, number, number])[] = [\n [0, 0, 0],\n [205, 0, 0],\n [0, 205, 0],\n [205, 205, 0],\n [0, 0, 238],\n [205, 0, 205],\n [0, 205, 205],\n [229, 229, 229],\n [127, 127, 127],\n [255, 0, 0],\n [0, 255, 0],\n [255, 255, 0],\n [92, 92, 255],\n [255, 0, 255],\n [0, 255, 255],\n [255, 255, 255],\n]\nconst CUBE_LEVELS = [0, 95, 135, 175, 215, 255] as const\n\nconst clamp = (value: number) => Math.min(255, Math.max(0, Math.round(value) || 0))\n\n/** The palette index (0–15) nearest to an RGB colour. Channels are clamped to 0–255. */\nexport function nearestAnsiColor(r: number, g: number, b: number): AnsiColor {\n const red = clamp(r)\n const green = clamp(g)\n const blue = clamp(b)\n let best = 0\n let bestDistance = Infinity\n for (let index = 0; index < XTERM_16.length; index += 1) {\n const [pr, pg, pb] = XTERM_16[index]!\n // The weights are the \"redmean\" approximation: cheap, and much closer to how\n // the eye separates two colours than plain Euclidean distance.\n const meanRed = (red + pr) / 2\n const dr = red - pr\n const dg = green - pg\n const db = blue - pb\n const distance =\n (2 + meanRed / 256) * dr * dr + 4 * dg * dg + (2 + (255 - meanRed) / 256) * db * db\n if (distance < bestDistance) {\n bestDistance = distance\n best = index\n }\n }\n return best\n}\n\n/** Map a 256-colour index to the sixteen. Out-of-range indices give `undefined`. */\nexport function ansi256ToColor(index: number): AnsiColor | undefined {\n if (!Number.isInteger(index) || index < 0 || index > 255) return undefined\n if (index < 16) return index\n if (index >= 232) {\n const grey = 8 + (index - 232) * 10\n return nearestAnsiColor(grey, grey, grey)\n }\n const cube = index - 16\n return nearestAnsiColor(\n CUBE_LEVELS[Math.floor(cube / 36)]!,\n CUBE_LEVELS[Math.floor(cube / 6) % 6]!,\n CUBE_LEVELS[cube % 6]!\n )\n}\n\ntype MutableStyle = {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}\n\n/** A parameter is a short run of digits; anything else is not a number we trust. */\nfunction toNumber(token: string | undefined): number | undefined {\n if (token === undefined) return undefined\n if (token === '') return 0\n if (token.length > 5 || !/^\\d+$/.test(token)) return undefined\n return Number(token)\n}\n\n/**\n * SGR results per interned style. Output repeats a handful of sequences\n * (`\\x1b[32m`, `\\x1b[0m`) on every line, and the style they start from is\n * interned, so a lookup replaces the parse and the intern key on each one.\n */\nconst sgrCache = new WeakMap<AnsiStyle, Map<string, AnsiStyle>>()\nconst SGR_CACHE_LIMIT = 64\n\n/**\n * Apply one SGR parameter list to a style. Unknown parameters are skipped one\n * at a time, so a program using a code we ignore still gets the colours around\n * it. Extended colours (38/48) consume their operands whether or not they are\n * valid, so a malformed one cannot be re-read as unrelated codes.\n */\nfunction applySgr(current: AnsiStyle, params: string): AnsiStyle {\n let byParams = sgrCache.get(current)\n const cached = byParams?.get(params)\n if (cached) return cached\n const next = parseSgr(current, params)\n if (!byParams) sgrCache.set(current, (byParams = new Map()))\n if (byParams.size < SGR_CACHE_LIMIT) byParams.set(params, next)\n return next\n}\n\nfunction parseSgr(current: AnsiStyle, params: string): AnsiStyle {\n const style: MutableStyle = { ...current }\n const tokens = params === '' ? ['0'] : params.split(';')\n\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i]!\n // The colon form `38:2::r:g:b` carries its operands in one token.\n if (token.includes(':')) {\n const parts = token.split(':')\n const head = toNumber(parts[0])\n if (head === 38 || head === 48) {\n const color = extendedColor(parts[1] === undefined ? [] : parts.slice(1), true)\n if (color !== null) assign(style, head, color)\n } else if (head === 4) {\n if (parts[1] === '0') style.underline = false\n else style.underline = true\n }\n continue\n }\n\n const code = toNumber(token)\n if (code === undefined) continue\n\n if (code === 38 || code === 48) {\n const mode = toNumber(tokens[i + 1])\n const count = mode === 5 ? 1 : mode === 2 ? 3 : 0\n const operands = tokens.slice(i + 2, i + 2 + count)\n i += 1 + count\n const color = extendedColor([String(mode ?? ''), ...operands], false)\n if (color !== null) assign(style, code, color)\n continue\n }\n if (code === 58) {\n // Underline colour: consumed so its operands are not read as codes, then ignored.\n const mode = toNumber(tokens[i + 1])\n i += 1 + (mode === 5 ? 1 : mode === 2 ? 3 : 0)\n continue\n }\n\n if (code === 0) {\n delete style.fg\n delete style.bg\n style.bold = style.dim = style.italic = style.underline = false\n style.strike = style.inverse = false\n } else if (code === 1) style.bold = true\n else if (code === 2) style.dim = true\n else if (code === 3) style.italic = true\n else if (code === 4 || code === 21) style.underline = true\n else if (code === 7) style.inverse = true\n else if (code === 9) style.strike = true\n else if (code === 22) style.bold = style.dim = false\n else if (code === 23) style.italic = false\n else if (code === 24) style.underline = false\n else if (code === 27) style.inverse = false\n else if (code === 29) style.strike = false\n else if (code >= 30 && code <= 37) style.fg = code - 30\n else if (code === 39) delete style.fg\n else if (code >= 40 && code <= 47) style.bg = code - 40\n else if (code === 49) delete style.bg\n else if (code >= 90 && code <= 97) style.fg = code - 90 + 8\n else if (code >= 100 && code <= 107) style.bg = code - 100 + 8\n // Blink (5, 6), conceal (8), overline (53) and the rest are ignored. Conceal\n // in particular is not honoured: output must not be able to hide itself.\n }\n return intern(style)\n}\n\n/** The colour an extended-colour operand list names, or `null` when it is invalid. */\nfunction extendedColor(parts: readonly string[], colon: boolean): AnsiColor | null {\n const mode = toNumber(parts[0])\n if (mode === 5) {\n const index = toNumber(parts[1])\n const color = index === undefined ? undefined : ansi256ToColor(index)\n return color ?? null\n }\n if (mode === 2) {\n // In the colon form a colour-space id may precede the channels, empty or not.\n const channels = colon && parts.length > 4 ? parts.slice(2) : parts.slice(1)\n const [r, g, b] = channels.slice(0, 3).map(toNumber)\n if (r === undefined || g === undefined || b === undefined) return null\n if (r > 255 || g > 255 || b > 255) return null\n return nearestAnsiColor(r, g, b)\n }\n return null\n}\n\nfunction assign(style: MutableStyle, code: number, color: AnsiColor): void {\n if (code === 38) style.fg = color\n else style.bg = color\n}\n\n/** Characters that are never rendered: C0 except tab, DEL, C1, and bidi controls. */\nfunction isDroppedControl(code: number): boolean {\n return (\n (code < 0x20 && code !== 0x09) ||\n code === 0x7f ||\n (code >= 0x80 && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n )\n}\n\ntype Run = { text: string; style: AnsiStyle }\n\n/**\n * The line being written. While the cursor only ever moves right it is a list of\n * styled runs, which is cheap; the first time something moves it left (`\\r`,\n * `\\b`) it becomes one cell per UTF-16 unit so later text can overwrite.\n */\nclass LineBuffer {\n private runs: Run[] = []\n private cells: string[] | undefined\n private cellStyles: AnsiStyle[] | undefined\n private cursor = 0\n private length = 0\n private dropped = 0\n /** A `\\r` seen but not yet applied: `\\r\\n` is by far the common case. */\n private pendingReturn = false\n\n constructor(private readonly max: number) {}\n\n isEmpty(): boolean {\n return this.length === 0 && this.dropped === 0\n }\n\n put(text: string, style: AnsiStyle): void {\n if (text === '') return\n this.applyReturn()\n if (this.cells === undefined) {\n const room = this.max - this.length\n if (room <= 0) {\n this.dropped += text.length\n return\n }\n const kept = text.length > room ? text.slice(0, room) : text\n this.dropped += text.length - kept.length\n const last = this.runs[this.runs.length - 1]\n if (last && last.style === style) last.text += kept\n else this.runs.push({ text: kept, style })\n this.length += kept.length\n this.cursor = this.length\n return\n }\n for (let i = 0; i < text.length; i += 1) this.putCell(text[i]!, style)\n }\n\n private putCell(char: string, style: AnsiStyle): void {\n const cells = this.cells!\n const styles = this.cellStyles!\n if (this.cursor >= this.max) {\n this.dropped += 1\n return\n }\n while (cells.length < this.cursor) {\n cells.push(' ')\n styles.push(PLAIN)\n }\n cells[this.cursor] = char\n styles[this.cursor] = style\n this.cursor += 1\n this.length = cells.length\n }\n\n carriageReturn(): void {\n this.pendingReturn = true\n }\n\n backspace(): void {\n this.applyReturn()\n if (this.cursor === 0) return\n this.toCells()\n this.cursor -= 1\n }\n\n /** `ESC[nK`: 0 from the cursor to the end, 1 start to cursor, 2 the whole line. */\n eraseInLine(mode: number): void {\n this.applyReturn()\n if (mode === 0 && this.cursor >= this.length) return\n this.toCells()\n const cells = this.cells!\n const styles = this.cellStyles!\n if (mode === 0) {\n cells.length = this.cursor\n styles.length = this.cursor\n } else if (mode === 1) {\n for (let i = 0; i <= this.cursor && i < cells.length; i += 1) {\n cells[i] = ' '\n styles[i] = PLAIN\n }\n } else if (mode === 2) {\n cells.length = 0\n styles.length = 0\n }\n this.length = cells.length\n }\n\n private applyReturn(): void {\n if (!this.pendingReturn) return\n this.pendingReturn = false\n if (this.length === 0) {\n this.cursor = 0\n return\n }\n this.toCells()\n this.cursor = 0\n }\n\n private toCells(): void {\n if (this.cells !== undefined) return\n const cells: string[] = []\n const styles: AnsiStyle[] = []\n for (const run of this.runs) {\n for (let i = 0; i < run.text.length; i += 1) {\n cells.push(run.text[i]!)\n styles.push(run.style)\n }\n }\n this.cells = cells\n this.cellStyles = styles\n this.runs = []\n this.cursor = Math.min(this.cursor, cells.length)\n }\n\n snapshot(): AnsiLine {\n const segments: AnsiSegment[] = []\n if (this.cells === undefined) {\n for (const run of this.runs) segments.push({ text: run.text, style: run.style })\n } else {\n const cells = this.cells\n const styles = this.cellStyles!\n let start = 0\n for (let i = 1; i <= cells.length; i += 1) {\n if (i === cells.length || styles[i] !== styles[start]) {\n segments.push({ text: cells.slice(start, i).join(''), style: styles[start]! })\n start = i\n }\n }\n }\n return { segments, truncated: this.dropped }\n }\n\n reset(): void {\n this.runs = []\n this.cells = undefined\n this.cellStyles = undefined\n this.cursor = 0\n this.length = 0\n this.dropped = 0\n this.pendingReturn = false\n }\n}\n\ntype State = 'text' | 'esc' | 'esc-intermediate' | 'csi' | 'string' | 'string-esc'\n\nexport function createAnsiParser(options: AnsiParserOptions = {}): AnsiParser {\n const maxLine = Math.max(1, Math.floor(options.maxLineLength ?? ANSI_MAX_LINE_LENGTH))\n const retain = Math.max(1, Math.floor(options.retainLines ?? ANSI_RETAIN_LINES))\n const lines: AnsiLine[] = []\n let droppedLines = 0\n const line = new LineBuffer(maxLine)\n let style: AnsiStyle = PLAIN\n let state: State = 'text'\n let csi = ''\n let csiOverflow = false\n // Only the 7-bit `ESC [` introducer is honoured. The 8-bit form is consumed so\n // its parameters are not echoed, but it never changes the style: it is a rarity\n // in real output and a favourite of filter-evasion payloads.\n let csiHonoured = true\n\n const finishLine = () => {\n lines.push(line.snapshot())\n line.reset()\n // Trim in blocks so the common append stays O(1) amortised.\n if (lines.length > retain + Math.max(64, retain >> 3)) {\n const excess = lines.length - retain\n lines.splice(0, excess)\n droppedLines += excess\n }\n }\n\n const runCsi = (final: string) => {\n if (csiOverflow || !csiHonoured) return\n // Only plain numeric parameters are honoured; a private marker (`?`, `>`,\n // `<`, `=`) or an intermediate byte makes this some other command entirely.\n if (!/^[\\d;:]*$/.test(csi)) return\n if (final === 'm') style = applySgr(style, csi)\n else if (final === 'K') {\n const mode = toNumber(csi.split(';')[0])\n if (mode !== undefined && mode <= 2) line.eraseInLine(mode)\n }\n }\n\n function write(chunk: string): void {\n for (let i = 0; i < chunk.length; i += 1) {\n const code = chunk.charCodeAt(i)\n\n switch (state) {\n case 'text': {\n if (!isDroppedControl(code)) {\n // Take the whole run of ordinary characters at once.\n let end = i + 1\n while (end < chunk.length && !isDroppedControl(chunk.charCodeAt(end))) end += 1\n line.put(chunk.slice(i, end), style)\n i = end - 1\n break\n }\n if (code === 0x1b) state = 'esc'\n else if (code === 0x0a) finishLine()\n else if (code === 0x0d) line.carriageReturn()\n else if (code === 0x08) line.backspace()\n else if (code === 0x9b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = false\n } else if (\n code === 0x9d ||\n code === 0x90 ||\n code === 0x98 ||\n code === 0x9e ||\n code === 0x9f\n ) {\n state = 'string'\n }\n // Every other control character is dropped.\n break\n }\n case 'esc': {\n if (code === 0x5b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = true\n } else if (\n code === 0x5d ||\n code === 0x50 ||\n code === 0x58 ||\n code === 0x5e ||\n code === 0x5f\n ) {\n state = 'string'\n } else if (code >= 0x20 && code <= 0x2f) state = 'esc-intermediate'\n else if (code >= 0x30 && code <= 0x7e) state = 'text'\n else if (code === 0x1b) state = 'esc'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'esc-intermediate': {\n if (code >= 0x20 && code <= 0x2f) break\n if (code >= 0x30 && code <= 0x7e) state = 'text'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'csi': {\n if (code >= 0x20 && code <= 0x3f) {\n if (csi.length < CSI_MAX) csi += chunk[i]\n else csiOverflow = true\n } else if (code >= 0x40 && code <= 0x7e) {\n runCsi(chunk[i]!)\n state = 'text'\n } else if (code === 0x1b) state = 'esc'\n else {\n // A control character or non-ASCII byte cannot be part of a CSI: the\n // sequence was malformed. Drop it and read this character normally.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string': {\n if (code === 0x07 || code === 0x9c) state = 'text'\n else if (code === 0x1b) state = 'string-esc'\n else if (code === 0x0a || code === 0x0d) {\n // No real title or clipboard payload spans a line. Ending here bounds\n // what an unterminated string can swallow to the rest of its line.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string-esc': {\n if (code === 0x5c) state = 'text'\n else {\n state = 'esc'\n i -= 1\n }\n break\n }\n }\n }\n }\n\n return {\n write,\n lines,\n openLine: () => (line.isEmpty() ? undefined : line.snapshot()),\n get droppedLines() {\n return droppedLines\n },\n }\n}\n\n/** Parse a whole output at once: finished lines plus the open one, if any. */\nexport function parseAnsi(text: string, options?: AnsiParserOptions): AnsiLine[] {\n const parser = createAnsiParser(options)\n parser.write(text)\n const open = parser.openLine()\n return open ? [...parser.lines, open] : [...parser.lines]\n}\n\n/**\n * The whole output as a reader sees it, for the clipboard: every line, none\n * shortened, with escape sequences and overwritten text resolved away.\n */\nexport function ansiPlainText(text: string): string {\n const parser = createAnsiParser({\n maxLineLength: Number.POSITIVE_INFINITY,\n retainLines: Number.POSITIVE_INFINITY,\n })\n parser.write(text)\n const open = parser.openLine()\n // Finished lines carry their newline even when only control sequences follow.\n return [...parser.lines.map(ansiLineText), open ? ansiLineText(open) : ''].join('\\n')\n}\n\n/** A line's text with styling removed, for tests and for accessible names. */\nexport function ansiLineText(line: AnsiLine): string {\n return line.segments.map((segment) => segment.text).join('')\n}\n"],"mappings":";AAiFA,IAAa,uBAAuB;AACpC,IAAa,oBAAoB;;AAGjC,IAAM,UAAU;AAEhB,IAAM,QAAmB,OAAO,OAAO,CAAC,CAAC;AACzC,IAAM,6BAAa,IAAI,IAAuB;AAC9C,IAAM,oBAAoB;;;;;;AAO1B,SAAS,OAAO,OASF;CACZ,MAAM,MAAM;EACV,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,MAAM,OAAO,MAAM;EACnB,MAAM,MAAM,MAAM;EAClB,MAAM,SAAS,MAAM;EACrB,MAAM,YAAY,MAAM;EACxB,MAAM,SAAS,M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SAAgB,aAAa,MAAwB;CACnD,OAAO,KAAK,SAAS,KAAK,YAAY,QAAQ,IAAI,CAAC,CAAC,KAAK,EAAE;AAC7D"}
@@ -1,12 +1,12 @@
1
+ import { className, createComponent, effect, insert, memo, readShallow, ref, setAttribute, setStyleProperty, spread, template } from "@solidjs/web";
2
+ import { ArrowDown as ArrowDown$1, Check as Check$1, CircleAlert as CircleAlert$1, CircleSlash as CircleSlash$1, Copy as Copy$1, Eraser as Eraser$1, LoaderCircle as LoaderCircle$1 } from "@lucide/solid";
3
+ import { For, Show, createEffect, createMemo, createSignal, omit } from "solid-js";
1
4
  import { createCopyFeedback } from "../../../lib/clipboard.js";
2
5
  import { cn } from "../../../lib/utils.js";
3
6
  import { Button } from "../../ui/button/button.js";
4
7
  import { ansiPlainText, createAnsiParser, isPlainStyle, resolveColors } from "./ansi.js";
5
8
  import { isAtBottom, isFailedExit, revealEarlier, terminalStatusLabel, terminalWindow } from "./terminal-model.js";
6
9
  import { fastIcon } from "../../../lib/fast-icon.js";
7
- import { className, createComponent, effect, insert, memo, readShallow, ref, setAttribute, setStyleProperty, spread, template } from "@solidjs/web";
8
- import { ArrowDown, Check, CircleAlert, CircleSlash, Copy, Eraser, LoaderCircle } from "@lucide/solid";
9
- import { For, Show, createEffect, createMemo, createSignal, omit } from "solid-js";
10
10
  // src/components/composites/terminal/terminal.tsx
11
11
  var _tmpl$ = /* @__PURE__ */ template(`<div><!><!>`);
12
12
  var _tmpl$2 = /* @__PURE__ */ template(`<span>`);
@@ -20,13 +20,13 @@ var _tmpl$9 = /* @__PURE__ */ template(`<div data-slot=terminal-hidden-note clas
20
20
  var _tmpl$10 = /* @__PURE__ */ template(`<pre>`);
21
21
  var _tmpl$11 = /* @__PURE__ */ template(`<p><span class="font-code text-code">`);
22
22
  var _tmpl$12 = /* @__PURE__ */ template(`<span class="text-muted-foreground tabular-nums">(<!> newer <!>)`);
23
- var ArrowDown$1 = fastIcon(ArrowDown);
24
- var Check$1 = fastIcon(Check);
25
- var CircleAlert$1 = fastIcon(CircleAlert);
26
- var CircleSlash$1 = fastIcon(CircleSlash);
27
- var Copy$1 = fastIcon(Copy);
28
- var Eraser$1 = fastIcon(Eraser);
29
- var LoaderCircle$1 = fastIcon(LoaderCircle);
23
+ var ArrowDown = fastIcon(ArrowDown$1);
24
+ var Check = fastIcon(Check$1);
25
+ var CircleAlert = fastIcon(CircleAlert$1);
26
+ var CircleSlash = fastIcon(CircleSlash$1);
27
+ var Copy = fastIcon(Copy$1);
28
+ var Eraser = fastIcon(Eraser$1);
29
+ var LoaderCircle = fastIcon(LoaderCircle$1);
30
30
  /** Finished lines mounted by default. */
31
31
  var TERMINAL_MAX_LINES = 1e3;
32
32
  var FG_CLASS = [
@@ -139,15 +139,15 @@ function StatusReadout(props) {
139
139
  return props.status.state === "running";
140
140
  });
141
141
  return () => {
142
- return _c$3() ? createComponent(LoaderCircle$1, { class: "motion-safe:animate-spin" }) : createComponent(Show, {
142
+ return _c$3() ? createComponent(LoaderCircle, { class: "motion-safe:animate-spin" }) : createComponent(Show, {
143
143
  get when() {
144
144
  return props.status.state === "cancelled";
145
145
  },
146
146
  get fallback() {
147
- return createComponent(CircleAlert$1, {});
147
+ return createComponent(CircleAlert, {});
148
148
  },
149
149
  get children() {
150
- return createComponent(CircleSlash$1, {});
150
+ return createComponent(CircleSlash, {});
151
151
  }
152
152
  });
153
153
  };
@@ -174,7 +174,7 @@ function StatusReadout(props) {
174
174
  });
175
175
  return _el$9;
176
176
  }
177
- function Terminal$1(props) {
177
+ function Terminal(props) {
178
178
  const local = props;
179
179
  const rest = omit(props, "output", "command", "status", "maxLines", "retainLines", "maxHeight", "wrap", "size", "onClear", "copyLabel", "copiedLabel", "clearLabel", "onCopy", "class");
180
180
  const small = () => local.size === "sm";
@@ -352,7 +352,7 @@ function Terminal$1(props) {
352
352
  },
353
353
  onClick: () => local.onClear?.(),
354
354
  get children() {
355
- return createComponent(Eraser$1, { "aria-hidden": "true" });
355
+ return createComponent(Eraser, { "aria-hidden": "true" });
356
356
  }
357
357
  }) : void 0;
358
358
  };
@@ -378,7 +378,7 @@ function Terminal$1(props) {
378
378
  return memo(() => {
379
379
  return memo(() => {
380
380
  return !!copied();
381
- })() ? createComponent(Check$1, { "aria-hidden": "true" }) : createComponent(Copy$1, { "aria-hidden": "true" });
381
+ })() ? createComponent(Check, { "aria-hidden": "true" }) : createComponent(Copy, { "aria-hidden": "true" });
382
382
  });
383
383
  }
384
384
  }) : void 0;
@@ -516,7 +516,7 @@ function Terminal$1(props) {
516
516
  onClick: jumpToLatest,
517
517
  get children() {
518
518
  return [
519
- createComponent(ArrowDown$1, { "aria-hidden": "true" }),
519
+ createComponent(ArrowDown, { "aria-hidden": "true" }),
520
520
  "Jump to latest",
521
521
  (() => {
522
522
  var _el$32 = _tmpl$12();
@@ -548,6 +548,6 @@ function Terminal$1(props) {
548
548
  });
549
549
  return _el$13;
550
550
  }
551
- export { TERMINAL_MAX_LINES, Terminal$1 as Terminal };
551
+ export { TERMINAL_MAX_LINES, Terminal };
552
552
 
553
553
  //# sourceMappingURL=terminal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminal.js","names":["<For each={props.line.segments}>\n {(segment) =>\n isPlainStyle(segment.style) ? (\n segment.text\n ) : (\n <span class={segmentClass(segment.style)}>{segment.text}</span>\n )\n }\n </For>","<div\n class={cn('min-h-lh', {\n 'whitespace-pre-wrap [overflow-wrap:anywhere]': props.wrap,\n 'w-max min-w-full': !props.wrap,\n })}\n >\n <For each={props.line.segments}>\n {(segment) =>\n isPlainStyle(segment.style) ? (\n segment.text\n ) : (\n <span class={segmentClass(segment.style)}>{segment.text}</span>\n )\n }\n </For>\n <Show when={props.line.truncated > 0}>\n <span class=\"opacity-70 select-none\">\n {' '}\n … {props.line.truncated.toLocaleString()} more characters not shown\n </span>\n </Show>\n </div>","<span class=\"opacity-70 select-none\">\n {' '}\n … {props.line.truncated.toLocaleString()} more characters not shown\n </span>","<LoaderCircle class=\"motion-safe:animate-spin\" />","class=\"motion-safe:animate-spin\"","<Show when={props.status.state === 'cancelled'} fallback={<CircleAlert />}>\n <CircleSlash />\n </Show>","<CircleAlert />","<CircleSlash />","<span\n role=\"status\"\n data-slot=\"terminal-status\"\n data-state={props.status.state}\n class={cn('flex shrink-0 items-center gap-1 text-xs', {\n 'text-destructive': isFailedExit(props.status),\n 'text-info': props.status.state === 'running',\n 'text-muted-foreground': props.status.state !== 'running' && !isFailedExit(props.status),\n })}\n >\n {/* A zero exit gets no glyph: a tick would be this component deciding the\n command succeeded, and some tools exit non-zero on purpose or zero on\n failure. The words carry the fact; only a non-zero code is toned. */}\n <Show when={props.status.state !== 'exited' || isFailedExit(props.status)}>\n <span aria-hidden=\"true\" class=\"grid size-3.5 place-items-center [&_svg]:size-3.5\">\n <Show\n when={props.status.state === 'running'}\n fallback={\n <Show when={props.status.state === 'cancelled'} fallback={<CircleAlert />}>\n <CircleSlash />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>\n </Show>\n {terminalStatusLabel(props.status)}\n </span>","class={cn('flex shrink-0 items-center gap-1 text-xs', {\n 'text-destructive': isFailedExit(props.status),\n 'text-info': props.status.state === 'running',\n 'text-muted-foreground': props.status.state !== 'running' && !isFailedExit(props.status),\n })}","<span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>","<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>","<div class={cn('flex items-center gap-2', small() ? 'px-2 py-0.5' : 'px-3 py-1')}>\n <Show\n when={local.command !== undefined}\n fallback={<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>}\n >\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>\n <code\n title={local.command}\n class=\"line-clamp-2 min-w-0 font-code text-code text-foreground [overflow-wrap:anywhere]\"\n >\n {local.command}\n </code>\n </span>\n </Show>\n <Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>\n {/* Hidden until the terminal is hovered or holds focus, never removed:\n a control that only exists under the pointer is unreachable by\n keyboard, and a touch screen has no hover, so it always shows there. */}\n <div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>\n </div>","<Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>","<StatusReadout status={status()} />","<Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>","variant=\"ghost\"","size=\"icon-2xs\"","onClick={() => local.onClear?.()}","<Eraser aria-hidden=\"true\" />","<div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>","<Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>","copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')","onClick={() => void copy()}","<Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>","<Check aria-hidden=\"true\" />","<Copy aria-hidden=\"true\" />","{lineWindow().hidden.toLocaleString()}","{lineWindow().hidden === 1 ? 'line' : 'lines'}","<Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>","droppedLines().toLocaleString()","<span>\n <Show when={lineWindow().hidden > 0}>\n {lineWindow().hidden.toLocaleString()} earlier{' '}\n {lineWindow().hidden === 1 ? 'line' : 'lines'} hidden\n <Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>\n .\n </Show>\n <Show when={lineWindow().evicted > 0}>\n {' '}\n {lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}\n </Show>\n </span>","{lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}","<Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}\n >\n Show {Math.min(pageSize(), lineWindow().revealable).toLocaleString()} earlier\n </Button>","size=\"2xs\"","onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}","Math.min(pageSize(), lineWindow().revealable).toLocaleString()","<div\n data-slot=\"terminal\"\n data-size={local.size ?? 'default'}\n aria-busy={local.status?.state === 'running' ? 'true' : undefined}\n class={cn(\n 'group/terminal overflow-hidden border border-border bg-card',\n small() ? 'rounded-lg' : 'rounded-xl',\n local.class\n )}\n {...rest}\n >\n <div class={cn('flex items-center gap-2', small() ? 'px-2 py-0.5' : 'px-3 py-1')}>\n <Show\n when={local.command !== undefined}\n fallback={<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>}\n >\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>\n <code\n title={local.command}\n class=\"line-clamp-2 min-w-0 font-code text-code text-foreground [overflow-wrap:anywhere]\"\n >\n {local.command}\n </code>\n </span>\n </Show>\n <Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>\n {/* Hidden until the terminal is hovered or holds focus, never removed:\n a control that only exists under the pointer is unreachable by\n keyboard, and a touch screen has no hover, so it always shows there. */}\n <div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>\n </div>\n\n <Show when={lineWindow().hidden > 0 || lineWindow().evicted > 0}>\n <div\n data-slot=\"terminal-hidden-note\"\n class=\"flex items-center gap-2 border-t border-border px-3 py-1 text-xs text-muted-foreground\"\n >\n <span>\n <Show when={lineWindow().hidden > 0}>\n {lineWindow().hidden.toLocaleString()} earlier{' '}\n {lineWindow().hidden === 1 ? 'line' : 'lines'} hidden\n <Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>\n .\n </Show>\n <Show when={lineWindow().evicted > 0}>\n {' '}\n {lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}\n </Show>\n </span>\n <Show when={lineWindow().revealable > 0}>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}\n >\n Show {Math.min(pageSize(), lineWindow().revealable).toLocaleString()} earlier\n </Button>\n </Show>\n </div>\n </Show>\n\n <div class=\"relative\">\n <div\n ref={(element) => (scroller = element)}\n data-slot=\"terminal-body\"\n // A region that scrolls must be focusable, and a tab stop needs a name.\n role=\"region\"\n tabindex=\"0\"\n aria-label={regionLabel()}\n onScroll={onScroll}\n style={{ 'max-height': maxHeight() }}\n class=\"scroll-fade overflow-auto border-t border-border bg-(--terminal-background) text-(color:--terminal-foreground)\"\n >\n <Show\n when={!empty()}\n fallback={\n <p class={cn('m-0 opacity-70', small() ? 'px-2 py-1.5' : 'px-3 py-2')}>\n <span class=\"font-code text-code\">\n {local.status?.state === 'running' ? 'Waiting for output…' : 'No output'}\n </span>\n </p>\n }\n >\n <pre\n class={cn(\n 'm-0 font-code text-code leading-normal',\n small() ? 'px-2 py-1.5' : 'px-3 py-2'\n )}\n >\n <For each={visibleRows()}>\n {(line) => <LineView line={line} wrap={local.wrap === true} />}\n </For>\n </pre>\n </Show>\n </div>\n <Show when={newerRows() > 0}>\n <Button\n variant=\"secondary\"\n size=\"2xs\"\n class=\"absolute end-3 bottom-2 shadow-sm\"\n onClick={jumpToLatest}\n >\n <ArrowDown aria-hidden=\"true\" />\n Jump to latest\n <span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>\n </Button>\n </Show>\n </div>\n </div>","ref={(element) => (scroller = element)}","<For each={visibleRows()}>\n {(line) => <LineView line={line} wrap={local.wrap === true} />}\n </For>","<LineView line={line} wrap={local.wrap === true} />","<Button\n variant=\"secondary\"\n size=\"2xs\"\n class=\"absolute end-3 bottom-2 shadow-sm\"\n onClick={jumpToLatest}\n >\n <ArrowDown aria-hidden=\"true\" />\n Jump to latest\n <span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>\n </Button>","variant=\"secondary\"","class=\"absolute end-3 bottom-2 shadow-sm\"","onClick={jumpToLatest}","<ArrowDown aria-hidden=\"true\" />","<span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>","aria-label={regionLabel()}","'max-height': maxHeight()","ArrowDown","LucideArrowDown","Check","LucideCheck","CircleAlert","LucideCircleAlert","CircleSlash","LucideCircleSlash","Copy","LucideCopy","Eraser","LucideEraser","LoaderCircle","LucideLoaderCircle","_$readShallow","_$setAttribute","Terminal","_$setStyleProperty"],"sources":["../../../../src/components/composites/terminal/terminal.tsx"],"sourcesContent":["import {\n ArrowDown as LucideArrowDown,\n Check as LucideCheck,\n CircleAlert as LucideCircleAlert,\n CircleSlash as LucideCircleSlash,\n Copy as LucideCopy,\n Eraser as LucideEraser,\n LoaderCircle as LucideLoaderCircle,\n} from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, For, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { createCopyFeedback } from '#lib/clipboard'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n createAnsiParser,\n isPlainStyle,\n resolveColors,\n type AnsiLine,\n type AnsiStyle,\n ansiPlainText,\n} from './ansi'\nimport {\n isAtBottom,\n isFailedExit,\n revealEarlier,\n terminalStatusLabel,\n terminalWindow,\n type TerminalStatus,\n} from './terminal-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ArrowDown = fastIcon(LucideArrowDown)\nconst Check = fastIcon(LucideCheck)\nconst CircleAlert = fastIcon(LucideCircleAlert)\nconst CircleSlash = fastIcon(LucideCircleSlash)\nconst Copy = fastIcon(LucideCopy)\nconst Eraser = fastIcon(LucideEraser)\nconst LoaderCircle = fastIcon(LucideLoaderCircle)\n\n/**\n * Terminal.\n *\n * A command and its output, as it arrives. It is the thing to put inside an\n * agent's \"ran a command\" line (a `TraceLine`, with `size=\"sm\"`) when the output\n * is the evidence; reach for `CodeBlock` instead when the text is source or a\n * finished log that needs no live behaviour, and for `TestResults` when the\n * output is a test run the host can structure.\n *\n * It does not wrap `CodeBlock`. A block's `highlight` seam re-renders the whole\n * body whenever the code changes, which is exactly wrong for output that grows a\n * line at a time, and a terminal has to own its scroller to follow the tail. It\n * keeps the block's header and surface vocabulary so the two read as one family.\n *\n * ## What the output is allowed to do\n *\n * Output is untrusted bytes. It is parsed by `createAnsiParser` into plain text\n * and a fixed set of styles — sixteen theme colours, bold, dim, italic,\n * underline, strike-through, reverse — and everything else (cursor movement,\n * title and clipboard sequences, anything malformed) is dropped, never echoed.\n * Colours come from the theme's `--terminal-ansi-*` tokens, painted on the\n * theme's own terminal background, so a program's colours keep the contrast the\n * theme measured for them. Nothing is rendered as markup.\n *\n * ## Streaming\n *\n * `output` is the whole string so far. When the new value begins with the old\n * one, only the appended text is parsed, so a chunk costs the size of the chunk\n * and not of the transcript. Finished lines are keyed by identity and are never\n * re-rendered; only the line still being written changes, which is what makes a\n * `\\r` progress bar redraw in place. Batch appends per frame — the host sees a\n * prefix check proportional to the output on every change.\n *\n * Only the last `maxLines` finished lines are mounted. The rest are counted in\n * an explicit note with a control to show them a page at a time, because tens of\n * thousands of row elements are a frozen page, not a transcript. Copy still\n * writes `output` exactly as given — not the rendered lines, not the visible tail.\n *\n * ## Following the tail\n *\n * The terminal scrolls inside its own bounded box and follows new output only\n * while the reader is at the bottom of that box. Scrolling up *parks* the view:\n * the lines mounted are the ones that were there when they left, however much\n * output arrives, and \"Jump to latest\" is the only way back to the tail (reaching\n * the bottom of a parked view with nothing newer resumes it, because nothing was\n * missed). If retention discards the lines they were reading the note says how\n * many, and when none are left the oldest retained lines are shown. The page\n * itself is never scrolled. Scrolling is instant, so there is no animation to\n * reduce.\n *\n * ## Status is a claim\n *\n * `status` is drawn only when the host passes it, in words as well as an icon,\n * and only a non-zero exit is toned as a failure: this component does not decide\n * that a command \"passed\". Without a status the header says nothing about whether\n * the command is still running. `onClear` adds a clear button; without it the\n * output is the host's record and nothing here offers to erase it.\n */\nexport type TerminalProps = Omit<ComponentProps<'div'>, 'children'> & {\n /** Everything the command has printed so far, exactly as received. */\n output: string\n /** The command line. Shown as text; the prompt glyph is decoration. */\n command?: string\n status?: TerminalStatus\n /** Finished lines mounted at once; earlier ones are counted and revealed a page at a time. */\n maxLines?: number\n /** Finished lines kept at all; older ones are discarded and counted. Default 200 000. */\n retainLines?: number\n /** Height of the output box, which scrolls past it. A number is pixels. Default `20rem`. */\n maxHeight?: number | string\n /** Soft-wrap long lines instead of scrolling sideways. Off: terminal columns keep their alignment. */\n wrap?: boolean\n /** `sm` is the compact chrome for output nested inside a Trace line. */\n size?: 'default' | 'sm'\n /** Show a clear button. The host empties `output`; the terminal erases nothing itself. */\n onClear?: () => void\n copyLabel?: string\n copiedLabel?: string\n clearLabel?: string\n /** Called after each copy attempt with whether the clipboard accepted it. */\n onCopy?: (ok: boolean) => void\n}\n\n/** Finished lines mounted by default. */\nexport const TERMINAL_MAX_LINES = 1000\n\n// One literal class per colour, written out in full so the stylesheet generator\n// can see each of them; a class assembled from an index would never be emitted.\nconst FG_CLASS = [\n 'text-(color:--terminal-ansi-black)',\n 'text-(color:--terminal-ansi-red)',\n 'text-(color:--terminal-ansi-green)',\n 'text-(color:--terminal-ansi-yellow)',\n 'text-(color:--terminal-ansi-blue)',\n 'text-(color:--terminal-ansi-magenta)',\n 'text-(color:--terminal-ansi-cyan)',\n 'text-(color:--terminal-ansi-white)',\n 'text-(color:--terminal-ansi-bright-black)',\n 'text-(color:--terminal-ansi-bright-red)',\n 'text-(color:--terminal-ansi-bright-green)',\n 'text-(color:--terminal-ansi-bright-yellow)',\n 'text-(color:--terminal-ansi-bright-blue)',\n 'text-(color:--terminal-ansi-bright-magenta)',\n 'text-(color:--terminal-ansi-bright-cyan)',\n 'text-(color:--terminal-ansi-bright-white)',\n] as const\nconst BG_CLASS = [\n 'bg-(--terminal-ansi-black)',\n 'bg-(--terminal-ansi-red)',\n 'bg-(--terminal-ansi-green)',\n 'bg-(--terminal-ansi-yellow)',\n 'bg-(--terminal-ansi-blue)',\n 'bg-(--terminal-ansi-magenta)',\n 'bg-(--terminal-ansi-cyan)',\n 'bg-(--terminal-ansi-white)',\n 'bg-(--terminal-ansi-bright-black)',\n 'bg-(--terminal-ansi-bright-red)',\n 'bg-(--terminal-ansi-bright-green)',\n 'bg-(--terminal-ansi-bright-yellow)',\n 'bg-(--terminal-ansi-bright-blue)',\n 'bg-(--terminal-ansi-bright-magenta)',\n 'bg-(--terminal-ansi-bright-cyan)',\n 'bg-(--terminal-ansi-bright-white)',\n] as const\n\nfunction segmentClass(style: AnsiStyle): string {\n const { fg, bg } = resolveColors(style)\n return cn(\n {\n 'font-bold': style.bold,\n 'opacity-70': style.dim,\n italic: style.italic,\n underline: style.underline && !style.strike,\n 'line-through': style.strike && !style.underline,\n '[text-decoration-line:underline_line-through]': style.underline && style.strike,\n 'text-(color:--terminal-background)': fg === 'default-bg',\n 'bg-(--terminal-foreground)': bg === 'default-fg',\n },\n typeof fg === 'number' && FG_CLASS[fg],\n typeof bg === 'number' && BG_CLASS[bg]\n )\n}\n\nfunction LineView(props: { line: AnsiLine; wrap: boolean }) {\n return (\n // `min-h-lh` keeps an empty line one line tall; a block with no text would\n // collapse and the transcript would lose its blank lines.\n <div\n class={cn('min-h-lh', {\n 'whitespace-pre-wrap [overflow-wrap:anywhere]': props.wrap,\n 'w-max min-w-full': !props.wrap,\n })}\n >\n <For each={props.line.segments}>\n {(segment) =>\n isPlainStyle(segment.style) ? (\n segment.text\n ) : (\n <span class={segmentClass(segment.style)}>{segment.text}</span>\n )\n }\n </For>\n <Show when={props.line.truncated > 0}>\n <span class=\"opacity-70 select-none\">\n {' '}\n … {props.line.truncated.toLocaleString()} more characters not shown\n </span>\n </Show>\n </div>\n )\n}\n\nfunction sameAnsiLine(left: AnsiLine, right: AnsiLine): boolean {\n return (\n left.truncated === right.truncated &&\n left.segments.length === right.segments.length &&\n left.segments.every(\n (segment, index) =>\n segment.text === right.segments[index]?.text &&\n segment.style === right.segments[index]?.style\n )\n )\n}\n\nfunction StatusReadout(props: { status: TerminalStatus }) {\n return (\n // A live region, so a command that finishes while the reader is elsewhere is\n // announced once, in words.\n <span\n role=\"status\"\n data-slot=\"terminal-status\"\n data-state={props.status.state}\n class={cn('flex shrink-0 items-center gap-1 text-xs', {\n 'text-destructive': isFailedExit(props.status),\n 'text-info': props.status.state === 'running',\n 'text-muted-foreground': props.status.state !== 'running' && !isFailedExit(props.status),\n })}\n >\n {/* A zero exit gets no glyph: a tick would be this component deciding the\n command succeeded, and some tools exit non-zero on purpose or zero on\n failure. The words carry the fact; only a non-zero code is toned. */}\n <Show when={props.status.state !== 'exited' || isFailedExit(props.status)}>\n <span aria-hidden=\"true\" class=\"grid size-3.5 place-items-center [&_svg]:size-3.5\">\n <Show\n when={props.status.state === 'running'}\n fallback={\n <Show when={props.status.state === 'cancelled'} fallback={<CircleAlert />}>\n <CircleSlash />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>\n </Show>\n {terminalStatusLabel(props.status)}\n </span>\n )\n}\n\nexport function Terminal(props: TerminalProps) {\n const local = props\n const rest = omit(\n props,\n 'output',\n 'command',\n 'status',\n 'maxLines',\n 'retainLines',\n 'maxHeight',\n 'wrap',\n 'size',\n 'onClear',\n 'copyLabel',\n 'copiedLabel',\n 'clearLabel',\n 'onCopy',\n 'class'\n )\n\n const small = () => local.size === 'sm'\n const pageSize = () => Math.max(1, Math.floor(local.maxLines ?? TERMINAL_MAX_LINES))\n const maxHeight = () =>\n typeof local.maxHeight === 'number' ? `${local.maxHeight}px` : (local.maxHeight ?? '20rem')\n\n // The parser outlives renders: it holds the half-read escape sequence, the\n // current style and the open line. A new `output` that extends the old one is\n // fed only its tail; anything else (a clear, a different command) starts over.\n // Made by the first run of `revision`, which is where `retainLines` is read.\n const newParser = () => createAnsiParser({ retainLines: local.retainLines })\n let parser!: ReturnType<typeof newParser>\n let started = false\n let consumed = ''\n // Bumped when the output restarts, so a parked position from the old output\n // is never applied to the new one.\n let epoch = 0\n const revision = createMemo(\n () => {\n const next = local.output\n if (started && next.length >= consumed.length && next.startsWith(consumed)) {\n parser.write(next.slice(consumed.length))\n } else {\n if (started) epoch += 1\n started = true\n parser = newParser()\n parser.write(next)\n }\n consumed = next\n return epoch\n },\n { equals: false }\n )\n const droppedLines = () => {\n revision()\n return parser.droppedLines\n }\n\n // How many lines are drawn: the page size, and the page size again whenever it\n // changes or the terminal is cleared (the next command starts at one page).\n // \"Show more\" writes it.\n const cleared = createMemo(() => local.output === '')\n const [limit, setLimit] = createSignal(() => {\n cleared()\n return pageSize()\n })\n\n // The retained buffer can hold hundreds of thousands of lines, and only a window\n // of them is drawn, so rows are read by position instead of copying the buffer\n // on every streamed chunk. The open line, when there is one, is the last row.\n const outputRows = {\n get length() {\n return outputRowCount()\n },\n at(index: number): AnsiLine | undefined {\n revision()\n return index === parser.lines.length ? parser.openLine() : parser.lines[index]\n },\n slice(start: number, end: number): AnsiLine[] {\n revision()\n const rows = parser.lines.slice(start, Math.min(end, parser.lines.length))\n const open = parser.openLine()\n if (open && end > parser.lines.length && start <= parser.lines.length) rows.push(open)\n return rows\n },\n }\n const outputRowCount = createMemo(() => {\n revision()\n return parser.lines.length + (parser.openLine() ? 1 : 0)\n })\n // Where the reader parked, as a count of lines since the output began. An open\n // line is a row too: freeze its snapshot so streamed characters and CR redraws\n // do not rewrite the text under a parked reader.\n const [parked, setParked] = createSignal<{ epoch: number; end: number; open?: AnsiLine }>()\n const total = () => droppedLines() + outputRows.length\n const anchorEnd = () => {\n const current = revision()\n const position = parked()\n return position && position.epoch === current ? position.end : undefined\n }\n const lineWindow = createMemo(() => {\n revision()\n return terminalWindow(outputRows.length, parser.droppedLines, limit(), anchorEnd())\n })\n // Finished rows keep their parser identity. If an open row existed when the\n // reader parked, substitute its immutable snapshot until they jump to latest.\n const visibleRows = createMemo(\n () => {\n revision()\n const start = lineWindow().start\n const end = lineWindow().end\n const rows = outputRows.slice(start, end)\n const position = parked()\n if (position?.epoch === revision() && position.open) {\n const retainedIndex = position.end - 1 - parser.droppedLines\n if (retainedIndex >= start && retainedIndex < end) {\n rows[retainedIndex - start] = position.open\n }\n }\n return rows\n },\n { equals: false }\n )\n const changedParkedLine = () => {\n const position = parked()\n if (position?.epoch !== revision() || !position.open) return false\n const retainedIndex = position.end - 1 - parser.droppedLines\n const current = outputRows.at(retainedIndex)\n return current !== undefined && !sameAnsiLine(position.open, current)\n }\n const newerRows = () => lineWindow().later + (changedParkedLine() ? 1 : 0)\n\n let scroller: HTMLDivElement | undefined\n const following = () => anchorEnd() === undefined\n\n const onScroll = () => {\n if (!scroller) return\n const atEnd = isAtBottom(scroller.scrollHeight, scroller.scrollTop, scroller.clientHeight)\n const position = anchorEnd()\n if (!atEnd) {\n if (position === undefined) {\n const currentEpoch = revision()\n setParked({ epoch: currentEpoch, end: total(), open: parser.openLine() })\n }\n } else if (position !== undefined && position >= total() && !changedParkedLine()) {\n // Back at the end of a view with nothing newer: nothing was missed.\n setParked(undefined)\n }\n }\n // Every chunk keeps a following reader at the end; a parked one stays put.\n // `following` is read in the compute: the apply phase reads no signals.\n createEffect(\n () => ({ revision: revision(), following: following() }),\n (read) => {\n if (scroller && read.following) scroller.scrollTop = scroller.scrollHeight\n }\n )\n const jumpToLatest = () => {\n if (!scroller) return\n setParked(undefined)\n scroller.scrollTop = scroller.scrollHeight\n // The button is about to disappear; leave focus somewhere real.\n scroller.focus()\n }\n\n const { copied, failed: copyFailed, copy: copyText } = createCopyFeedback()\n const copy = async () => {\n const ok = await copyText(ansiPlainText(local.output))\n local.onCopy?.(ok)\n }\n\n const empty = () => local.output === ''\n const regionLabel = () =>\n local.command ? `Output of ${local.command.slice(0, 120)}` : 'Terminal output'\n\n return (\n <div\n data-slot=\"terminal\"\n data-size={local.size ?? 'default'}\n aria-busy={local.status?.state === 'running' ? 'true' : undefined}\n class={cn(\n 'group/terminal overflow-hidden border border-border bg-card',\n small() ? 'rounded-lg' : 'rounded-xl',\n local.class\n )}\n {...rest}\n >\n <div class={cn('flex items-center gap-2', small() ? 'px-2 py-0.5' : 'px-3 py-1')}>\n <Show\n when={local.command !== undefined}\n fallback={<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>}\n >\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>\n <code\n title={local.command}\n class=\"line-clamp-2 min-w-0 font-code text-code text-foreground [overflow-wrap:anywhere]\"\n >\n {local.command}\n </code>\n </span>\n </Show>\n <Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>\n {/* Hidden until the terminal is hovered or holds focus, never removed:\n a control that only exists under the pointer is unreachable by\n keyboard, and a touch screen has no hover, so it always shows there. */}\n <div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>\n </div>\n\n <Show when={lineWindow().hidden > 0 || lineWindow().evicted > 0}>\n <div\n data-slot=\"terminal-hidden-note\"\n class=\"flex items-center gap-2 border-t border-border px-3 py-1 text-xs text-muted-foreground\"\n >\n <span>\n <Show when={lineWindow().hidden > 0}>\n {lineWindow().hidden.toLocaleString()} earlier{' '}\n {lineWindow().hidden === 1 ? 'line' : 'lines'} hidden\n <Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>\n .\n </Show>\n <Show when={lineWindow().evicted > 0}>\n {' '}\n {lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}\n </Show>\n </span>\n <Show when={lineWindow().revealable > 0}>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}\n >\n Show {Math.min(pageSize(), lineWindow().revealable).toLocaleString()} earlier\n </Button>\n </Show>\n </div>\n </Show>\n\n <div class=\"relative\">\n <div\n ref={(element) => (scroller = element)}\n data-slot=\"terminal-body\"\n // A region that scrolls must be focusable, and a tab stop needs a name.\n role=\"region\"\n tabindex=\"0\"\n aria-label={regionLabel()}\n onScroll={onScroll}\n style={{ 'max-height': maxHeight() }}\n class=\"scroll-fade overflow-auto border-t border-border bg-(--terminal-background) text-(color:--terminal-foreground)\"\n >\n <Show\n when={!empty()}\n fallback={\n <p class={cn('m-0 opacity-70', small() ? 'px-2 py-1.5' : 'px-3 py-2')}>\n <span class=\"font-code text-code\">\n {local.status?.state === 'running' ? 'Waiting for output…' : 'No output'}\n </span>\n </p>\n }\n >\n <pre\n class={cn(\n 'm-0 font-code text-code leading-normal',\n small() ? 'px-2 py-1.5' : 'px-3 py-2'\n )}\n >\n <For each={visibleRows()}>\n {(line) => <LineView line={line} wrap={local.wrap === true} />}\n </For>\n </pre>\n </Show>\n </div>\n <Show when={newerRows() > 0}>\n <Button\n variant=\"secondary\"\n size=\"2xs\"\n class=\"absolute end-3 bottom-2 shadow-sm\"\n onClick={jumpToLatest}\n >\n <ArrowDown aria-hidden=\"true\" />\n Jump to latest\n <span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>\n </Button>\n </Show>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAMiD,cAAY,SAASC,SAAe;AAC1C,IAAMC,UAAQ,SAASC,KAAW;AAClC,IAAMC,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,gBAAc,SAASC,WAAiB;AAC9C,IAAMC,SAAO,SAASC,IAAU;AAChC,IAAMC,WAAS,SAASC,MAAY;AACpC,IAAMC,iBAAe,SAASC,YAAkB;;AAsFhD,IAAa,qBAAqB;AAIlC,IAAM,WAAW;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAM,WAAW;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAC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,aAAA;;GAAO,GAAAiB,YAAA,GAAG,2BAA2B,MAAM,IAAI,gBAAgB,WAAW,CAAC;GA8F5EhB,GAAY,YAAY;GAEfC,GAAc,UAAU;EAhG2C;CAA3E,IAAA,EAAA,GAAA,GAAA,KAAA,QAAA;EAA2E,UAAA,QAAA,GAAA,KAAA,CAAA;EA8F5E,MAAA,KAAA,KAAAgB,aAAA,QAAA,cAAA,CAAyB;EAEhB,MAAA,KAAA,KAAAE,iBAAA,QAAA,cAAA,CAAwB;CAhG2C,CAAA;CAZpF,OACE7B;AAqJJ"}
1
+ {"version":3,"file":"terminal.js","names":["<For each={props.line.segments}>\n {(segment) =>\n isPlainStyle(segment.style) ? (\n segment.text\n ) : (\n <span class={segmentClass(segment.style)}>{segment.text}</span>\n )\n }\n </For>","<div\n class={cn('min-h-lh', {\n 'whitespace-pre-wrap [overflow-wrap:anywhere]': props.wrap,\n 'w-max min-w-full': !props.wrap,\n })}\n >\n <For each={props.line.segments}>\n {(segment) =>\n isPlainStyle(segment.style) ? (\n segment.text\n ) : (\n <span class={segmentClass(segment.style)}>{segment.text}</span>\n )\n }\n </For>\n <Show when={props.line.truncated > 0}>\n <span class=\"opacity-70 select-none\">\n {' '}\n … {props.line.truncated.toLocaleString()} more characters not shown\n </span>\n </Show>\n </div>","<span class=\"opacity-70 select-none\">\n {' '}\n … {props.line.truncated.toLocaleString()} more characters not shown\n </span>","<LoaderCircle class=\"motion-safe:animate-spin\" />","class=\"motion-safe:animate-spin\"","<Show when={props.status.state === 'cancelled'} fallback={<CircleAlert />}>\n <CircleSlash />\n </Show>","<CircleAlert />","<CircleSlash />","<span\n role=\"status\"\n data-slot=\"terminal-status\"\n data-state={props.status.state}\n class={cn('flex shrink-0 items-center gap-1 text-xs', {\n 'text-destructive': isFailedExit(props.status),\n 'text-info': props.status.state === 'running',\n 'text-muted-foreground': props.status.state !== 'running' && !isFailedExit(props.status),\n })}\n >\n {/* A zero exit gets no glyph: a tick would be this component deciding the\n command succeeded, and some tools exit non-zero on purpose or zero on\n failure. The words carry the fact; only a non-zero code is toned. */}\n <Show when={props.status.state !== 'exited' || isFailedExit(props.status)}>\n <span aria-hidden=\"true\" class=\"grid size-3.5 place-items-center [&_svg]:size-3.5\">\n <Show\n when={props.status.state === 'running'}\n fallback={\n <Show when={props.status.state === 'cancelled'} fallback={<CircleAlert />}>\n <CircleSlash />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>\n </Show>\n {terminalStatusLabel(props.status)}\n </span>","class={cn('flex shrink-0 items-center gap-1 text-xs', {\n 'text-destructive': isFailedExit(props.status),\n 'text-info': props.status.state === 'running',\n 'text-muted-foreground': props.status.state !== 'running' && !isFailedExit(props.status),\n })}","<span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>","<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>","<div class={cn('flex items-center gap-2', small() ? 'px-2 py-0.5' : 'px-3 py-1')}>\n <Show\n when={local.command !== undefined}\n fallback={<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>}\n >\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>\n <code\n title={local.command}\n class=\"line-clamp-2 min-w-0 font-code text-code text-foreground [overflow-wrap:anywhere]\"\n >\n {local.command}\n </code>\n </span>\n </Show>\n <Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>\n {/* Hidden until the terminal is hovered or holds focus, never removed:\n a control that only exists under the pointer is unreachable by\n keyboard, and a touch screen has no hover, so it always shows there. */}\n <div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>\n </div>","<Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>","<StatusReadout status={status()} />","<Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>","variant=\"ghost\"","size=\"icon-2xs\"","onClick={() => local.onClear?.()}","<Eraser aria-hidden=\"true\" />","<div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>","<Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>","copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')","onClick={() => void copy()}","<Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>","<Check aria-hidden=\"true\" />","<Copy aria-hidden=\"true\" />","{lineWindow().hidden.toLocaleString()}","{lineWindow().hidden === 1 ? 'line' : 'lines'}","<Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>","droppedLines().toLocaleString()","<span>\n <Show when={lineWindow().hidden > 0}>\n {lineWindow().hidden.toLocaleString()} earlier{' '}\n {lineWindow().hidden === 1 ? 'line' : 'lines'} hidden\n <Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>\n .\n </Show>\n <Show when={lineWindow().evicted > 0}>\n {' '}\n {lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}\n </Show>\n </span>","{lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}","<Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}\n >\n Show {Math.min(pageSize(), lineWindow().revealable).toLocaleString()} earlier\n </Button>","size=\"2xs\"","onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}","Math.min(pageSize(), lineWindow().revealable).toLocaleString()","<div\n data-slot=\"terminal\"\n data-size={local.size ?? 'default'}\n aria-busy={local.status?.state === 'running' ? 'true' : undefined}\n class={cn(\n 'group/terminal overflow-hidden border border-border bg-card',\n small() ? 'rounded-lg' : 'rounded-xl',\n local.class\n )}\n {...rest}\n >\n <div class={cn('flex items-center gap-2', small() ? 'px-2 py-0.5' : 'px-3 py-1')}>\n <Show\n when={local.command !== undefined}\n fallback={<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>}\n >\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>\n <code\n title={local.command}\n class=\"line-clamp-2 min-w-0 font-code text-code text-foreground [overflow-wrap:anywhere]\"\n >\n {local.command}\n </code>\n </span>\n </Show>\n <Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>\n {/* Hidden until the terminal is hovered or holds focus, never removed:\n a control that only exists under the pointer is unreachable by\n keyboard, and a touch screen has no hover, so it always shows there. */}\n <div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>\n </div>\n\n <Show when={lineWindow().hidden > 0 || lineWindow().evicted > 0}>\n <div\n data-slot=\"terminal-hidden-note\"\n class=\"flex items-center gap-2 border-t border-border px-3 py-1 text-xs text-muted-foreground\"\n >\n <span>\n <Show when={lineWindow().hidden > 0}>\n {lineWindow().hidden.toLocaleString()} earlier{' '}\n {lineWindow().hidden === 1 ? 'line' : 'lines'} hidden\n <Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>\n .\n </Show>\n <Show when={lineWindow().evicted > 0}>\n {' '}\n {lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}\n </Show>\n </span>\n <Show when={lineWindow().revealable > 0}>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}\n >\n Show {Math.min(pageSize(), lineWindow().revealable).toLocaleString()} earlier\n </Button>\n </Show>\n </div>\n </Show>\n\n <div class=\"relative\">\n <div\n ref={(element) => (scroller = element)}\n data-slot=\"terminal-body\"\n // A region that scrolls must be focusable, and a tab stop needs a name.\n role=\"region\"\n tabindex=\"0\"\n aria-label={regionLabel()}\n onScroll={onScroll}\n style={{ 'max-height': maxHeight() }}\n class=\"scroll-fade overflow-auto border-t border-border bg-(--terminal-background) text-(color:--terminal-foreground)\"\n >\n <Show\n when={!empty()}\n fallback={\n <p class={cn('m-0 opacity-70', small() ? 'px-2 py-1.5' : 'px-3 py-2')}>\n <span class=\"font-code text-code\">\n {local.status?.state === 'running' ? 'Waiting for output…' : 'No output'}\n </span>\n </p>\n }\n >\n <pre\n class={cn(\n 'm-0 font-code text-code leading-normal',\n small() ? 'px-2 py-1.5' : 'px-3 py-2'\n )}\n >\n <For each={visibleRows()}>\n {(line) => <LineView line={line} wrap={local.wrap === true} />}\n </For>\n </pre>\n </Show>\n </div>\n <Show when={newerRows() > 0}>\n <Button\n variant=\"secondary\"\n size=\"2xs\"\n class=\"absolute end-3 bottom-2 shadow-sm\"\n onClick={jumpToLatest}\n >\n <ArrowDown aria-hidden=\"true\" />\n Jump to latest\n <span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>\n </Button>\n </Show>\n </div>\n </div>","ref={(element) => (scroller = element)}","<For each={visibleRows()}>\n {(line) => <LineView line={line} wrap={local.wrap === true} />}\n </For>","<LineView line={line} wrap={local.wrap === true} />","<Button\n variant=\"secondary\"\n size=\"2xs\"\n class=\"absolute end-3 bottom-2 shadow-sm\"\n onClick={jumpToLatest}\n >\n <ArrowDown aria-hidden=\"true\" />\n Jump to latest\n <span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>\n </Button>","variant=\"secondary\"","class=\"absolute end-3 bottom-2 shadow-sm\"","onClick={jumpToLatest}","<ArrowDown aria-hidden=\"true\" />","<span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>","aria-label={regionLabel()}","'max-height': maxHeight()","LucideArrowDown","LucideCheck","LucideCircleAlert","LucideCircleSlash","LucideCopy","LucideEraser","LucideLoaderCircle","_$insert","_$effect","_$readShallow","_$className","_$setAttribute","_$spread","_$ref","_$setStyleProperty"],"sources":["../../../../src/components/composites/terminal/terminal.tsx"],"sourcesContent":["import {\n ArrowDown as LucideArrowDown,\n Check as LucideCheck,\n CircleAlert as LucideCircleAlert,\n CircleSlash as LucideCircleSlash,\n Copy as LucideCopy,\n Eraser as LucideEraser,\n LoaderCircle as LucideLoaderCircle,\n} from '@lucide/solid'\nimport { createEffect, createMemo, createSignal, For, Show, omit } from 'solid-js'\nimport { type ComponentProps } from '@solidjs/web'\nimport { createCopyFeedback } from '#lib/clipboard'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n createAnsiParser,\n isPlainStyle,\n resolveColors,\n type AnsiLine,\n type AnsiStyle,\n ansiPlainText,\n} from './ansi'\nimport {\n isAtBottom,\n isFailedExit,\n revealEarlier,\n terminalStatusLabel,\n terminalWindow,\n type TerminalStatus,\n} from './terminal-model'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst ArrowDown = fastIcon(LucideArrowDown)\nconst Check = fastIcon(LucideCheck)\nconst CircleAlert = fastIcon(LucideCircleAlert)\nconst CircleSlash = fastIcon(LucideCircleSlash)\nconst Copy = fastIcon(LucideCopy)\nconst Eraser = fastIcon(LucideEraser)\nconst LoaderCircle = fastIcon(LucideLoaderCircle)\n\n/**\n * Terminal.\n *\n * A command and its output, as it arrives. It is the thing to put inside an\n * agent's \"ran a command\" line (a `TraceLine`, with `size=\"sm\"`) when the output\n * is the evidence; reach for `CodeBlock` instead when the text is source or a\n * finished log that needs no live behaviour, and for `TestResults` when the\n * output is a test run the host can structure.\n *\n * It does not wrap `CodeBlock`. A block's `highlight` seam re-renders the whole\n * body whenever the code changes, which is exactly wrong for output that grows a\n * line at a time, and a terminal has to own its scroller to follow the tail. It\n * keeps the block's header and surface vocabulary so the two read as one family.\n *\n * ## What the output is allowed to do\n *\n * Output is untrusted bytes. It is parsed by `createAnsiParser` into plain text\n * and a fixed set of styles — sixteen theme colours, bold, dim, italic,\n * underline, strike-through, reverse — and everything else (cursor movement,\n * title and clipboard sequences, anything malformed) is dropped, never echoed.\n * Colours come from the theme's `--terminal-ansi-*` tokens, painted on the\n * theme's own terminal background, so a program's colours keep the contrast the\n * theme measured for them. Nothing is rendered as markup.\n *\n * ## Streaming\n *\n * `output` is the whole string so far. When the new value begins with the old\n * one, only the appended text is parsed, so a chunk costs the size of the chunk\n * and not of the transcript. Finished lines are keyed by identity and are never\n * re-rendered; only the line still being written changes, which is what makes a\n * `\\r` progress bar redraw in place. Batch appends per frame — the host sees a\n * prefix check proportional to the output on every change.\n *\n * Only the last `maxLines` finished lines are mounted. The rest are counted in\n * an explicit note with a control to show them a page at a time, because tens of\n * thousands of row elements are a frozen page, not a transcript. Copy still\n * writes `output` exactly as given — not the rendered lines, not the visible tail.\n *\n * ## Following the tail\n *\n * The terminal scrolls inside its own bounded box and follows new output only\n * while the reader is at the bottom of that box. Scrolling up *parks* the view:\n * the lines mounted are the ones that were there when they left, however much\n * output arrives, and \"Jump to latest\" is the only way back to the tail (reaching\n * the bottom of a parked view with nothing newer resumes it, because nothing was\n * missed). If retention discards the lines they were reading the note says how\n * many, and when none are left the oldest retained lines are shown. The page\n * itself is never scrolled. Scrolling is instant, so there is no animation to\n * reduce.\n *\n * ## Status is a claim\n *\n * `status` is drawn only when the host passes it, in words as well as an icon,\n * and only a non-zero exit is toned as a failure: this component does not decide\n * that a command \"passed\". Without a status the header says nothing about whether\n * the command is still running. `onClear` adds a clear button; without it the\n * output is the host's record and nothing here offers to erase it.\n */\nexport type TerminalProps = Omit<ComponentProps<'div'>, 'children'> & {\n /** Everything the command has printed so far, exactly as received. */\n output: string\n /** The command line. Shown as text; the prompt glyph is decoration. */\n command?: string\n status?: TerminalStatus\n /** Finished lines mounted at once; earlier ones are counted and revealed a page at a time. */\n maxLines?: number\n /** Finished lines kept at all; older ones are discarded and counted. Default 200 000. */\n retainLines?: number\n /** Height of the output box, which scrolls past it. A number is pixels. Default `20rem`. */\n maxHeight?: number | string\n /** Soft-wrap long lines instead of scrolling sideways. Off: terminal columns keep their alignment. */\n wrap?: boolean\n /** `sm` is the compact chrome for output nested inside a Trace line. */\n size?: 'default' | 'sm'\n /** Show a clear button. The host empties `output`; the terminal erases nothing itself. */\n onClear?: () => void\n copyLabel?: string\n copiedLabel?: string\n clearLabel?: string\n /** Called after each copy attempt with whether the clipboard accepted it. */\n onCopy?: (ok: boolean) => void\n}\n\n/** Finished lines mounted by default. */\nexport const TERMINAL_MAX_LINES = 1000\n\n// One literal class per colour, written out in full so the stylesheet generator\n// can see each of them; a class assembled from an index would never be emitted.\nconst FG_CLASS = [\n 'text-(color:--terminal-ansi-black)',\n 'text-(color:--terminal-ansi-red)',\n 'text-(color:--terminal-ansi-green)',\n 'text-(color:--terminal-ansi-yellow)',\n 'text-(color:--terminal-ansi-blue)',\n 'text-(color:--terminal-ansi-magenta)',\n 'text-(color:--terminal-ansi-cyan)',\n 'text-(color:--terminal-ansi-white)',\n 'text-(color:--terminal-ansi-bright-black)',\n 'text-(color:--terminal-ansi-bright-red)',\n 'text-(color:--terminal-ansi-bright-green)',\n 'text-(color:--terminal-ansi-bright-yellow)',\n 'text-(color:--terminal-ansi-bright-blue)',\n 'text-(color:--terminal-ansi-bright-magenta)',\n 'text-(color:--terminal-ansi-bright-cyan)',\n 'text-(color:--terminal-ansi-bright-white)',\n] as const\nconst BG_CLASS = [\n 'bg-(--terminal-ansi-black)',\n 'bg-(--terminal-ansi-red)',\n 'bg-(--terminal-ansi-green)',\n 'bg-(--terminal-ansi-yellow)',\n 'bg-(--terminal-ansi-blue)',\n 'bg-(--terminal-ansi-magenta)',\n 'bg-(--terminal-ansi-cyan)',\n 'bg-(--terminal-ansi-white)',\n 'bg-(--terminal-ansi-bright-black)',\n 'bg-(--terminal-ansi-bright-red)',\n 'bg-(--terminal-ansi-bright-green)',\n 'bg-(--terminal-ansi-bright-yellow)',\n 'bg-(--terminal-ansi-bright-blue)',\n 'bg-(--terminal-ansi-bright-magenta)',\n 'bg-(--terminal-ansi-bright-cyan)',\n 'bg-(--terminal-ansi-bright-white)',\n] as const\n\nfunction segmentClass(style: AnsiStyle): string {\n const { fg, bg } = resolveColors(style)\n return cn(\n {\n 'font-bold': style.bold,\n 'opacity-70': style.dim,\n italic: style.italic,\n underline: style.underline && !style.strike,\n 'line-through': style.strike && !style.underline,\n '[text-decoration-line:underline_line-through]': style.underline && style.strike,\n 'text-(color:--terminal-background)': fg === 'default-bg',\n 'bg-(--terminal-foreground)': bg === 'default-fg',\n },\n typeof fg === 'number' && FG_CLASS[fg],\n typeof bg === 'number' && BG_CLASS[bg]\n )\n}\n\nfunction LineView(props: { line: AnsiLine; wrap: boolean }) {\n return (\n // `min-h-lh` keeps an empty line one line tall; a block with no text would\n // collapse and the transcript would lose its blank lines.\n <div\n class={cn('min-h-lh', {\n 'whitespace-pre-wrap [overflow-wrap:anywhere]': props.wrap,\n 'w-max min-w-full': !props.wrap,\n })}\n >\n <For each={props.line.segments}>\n {(segment) =>\n isPlainStyle(segment.style) ? (\n segment.text\n ) : (\n <span class={segmentClass(segment.style)}>{segment.text}</span>\n )\n }\n </For>\n <Show when={props.line.truncated > 0}>\n <span class=\"opacity-70 select-none\">\n {' '}\n … {props.line.truncated.toLocaleString()} more characters not shown\n </span>\n </Show>\n </div>\n )\n}\n\nfunction sameAnsiLine(left: AnsiLine, right: AnsiLine): boolean {\n return (\n left.truncated === right.truncated &&\n left.segments.length === right.segments.length &&\n left.segments.every(\n (segment, index) =>\n segment.text === right.segments[index]?.text &&\n segment.style === right.segments[index]?.style\n )\n )\n}\n\nfunction StatusReadout(props: { status: TerminalStatus }) {\n return (\n // A live region, so a command that finishes while the reader is elsewhere is\n // announced once, in words.\n <span\n role=\"status\"\n data-slot=\"terminal-status\"\n data-state={props.status.state}\n class={cn('flex shrink-0 items-center gap-1 text-xs', {\n 'text-destructive': isFailedExit(props.status),\n 'text-info': props.status.state === 'running',\n 'text-muted-foreground': props.status.state !== 'running' && !isFailedExit(props.status),\n })}\n >\n {/* A zero exit gets no glyph: a tick would be this component deciding the\n command succeeded, and some tools exit non-zero on purpose or zero on\n failure. The words carry the fact; only a non-zero code is toned. */}\n <Show when={props.status.state !== 'exited' || isFailedExit(props.status)}>\n <span aria-hidden=\"true\" class=\"grid size-3.5 place-items-center [&_svg]:size-3.5\">\n <Show\n when={props.status.state === 'running'}\n fallback={\n <Show when={props.status.state === 'cancelled'} fallback={<CircleAlert />}>\n <CircleSlash />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>\n </Show>\n {terminalStatusLabel(props.status)}\n </span>\n )\n}\n\nexport function Terminal(props: TerminalProps) {\n const local = props\n const rest = omit(\n props,\n 'output',\n 'command',\n 'status',\n 'maxLines',\n 'retainLines',\n 'maxHeight',\n 'wrap',\n 'size',\n 'onClear',\n 'copyLabel',\n 'copiedLabel',\n 'clearLabel',\n 'onCopy',\n 'class'\n )\n\n const small = () => local.size === 'sm'\n const pageSize = () => Math.max(1, Math.floor(local.maxLines ?? TERMINAL_MAX_LINES))\n const maxHeight = () =>\n typeof local.maxHeight === 'number' ? `${local.maxHeight}px` : (local.maxHeight ?? '20rem')\n\n // The parser outlives renders: it holds the half-read escape sequence, the\n // current style and the open line. A new `output` that extends the old one is\n // fed only its tail; anything else (a clear, a different command) starts over.\n // Made by the first run of `revision`, which is where `retainLines` is read.\n const newParser = () => createAnsiParser({ retainLines: local.retainLines })\n let parser!: ReturnType<typeof newParser>\n let started = false\n let consumed = ''\n // Bumped when the output restarts, so a parked position from the old output\n // is never applied to the new one.\n let epoch = 0\n const revision = createMemo(\n () => {\n const next = local.output\n if (started && next.length >= consumed.length && next.startsWith(consumed)) {\n parser.write(next.slice(consumed.length))\n } else {\n if (started) epoch += 1\n started = true\n parser = newParser()\n parser.write(next)\n }\n consumed = next\n return epoch\n },\n { equals: false }\n )\n const droppedLines = () => {\n revision()\n return parser.droppedLines\n }\n\n // How many lines are drawn: the page size, and the page size again whenever it\n // changes or the terminal is cleared (the next command starts at one page).\n // \"Show more\" writes it.\n const cleared = createMemo(() => local.output === '')\n const [limit, setLimit] = createSignal(() => {\n cleared()\n return pageSize()\n })\n\n // The retained buffer can hold hundreds of thousands of lines, and only a window\n // of them is drawn, so rows are read by position instead of copying the buffer\n // on every streamed chunk. The open line, when there is one, is the last row.\n const outputRows = {\n get length() {\n return outputRowCount()\n },\n at(index: number): AnsiLine | undefined {\n revision()\n return index === parser.lines.length ? parser.openLine() : parser.lines[index]\n },\n slice(start: number, end: number): AnsiLine[] {\n revision()\n const rows = parser.lines.slice(start, Math.min(end, parser.lines.length))\n const open = parser.openLine()\n if (open && end > parser.lines.length && start <= parser.lines.length) rows.push(open)\n return rows\n },\n }\n const outputRowCount = createMemo(() => {\n revision()\n return parser.lines.length + (parser.openLine() ? 1 : 0)\n })\n // Where the reader parked, as a count of lines since the output began. An open\n // line is a row too: freeze its snapshot so streamed characters and CR redraws\n // do not rewrite the text under a parked reader.\n const [parked, setParked] = createSignal<{ epoch: number; end: number; open?: AnsiLine }>()\n const total = () => droppedLines() + outputRows.length\n const anchorEnd = () => {\n const current = revision()\n const position = parked()\n return position && position.epoch === current ? position.end : undefined\n }\n const lineWindow = createMemo(() => {\n revision()\n return terminalWindow(outputRows.length, parser.droppedLines, limit(), anchorEnd())\n })\n // Finished rows keep their parser identity. If an open row existed when the\n // reader parked, substitute its immutable snapshot until they jump to latest.\n const visibleRows = createMemo(\n () => {\n revision()\n const start = lineWindow().start\n const end = lineWindow().end\n const rows = outputRows.slice(start, end)\n const position = parked()\n if (position?.epoch === revision() && position.open) {\n const retainedIndex = position.end - 1 - parser.droppedLines\n if (retainedIndex >= start && retainedIndex < end) {\n rows[retainedIndex - start] = position.open\n }\n }\n return rows\n },\n { equals: false }\n )\n const changedParkedLine = () => {\n const position = parked()\n if (position?.epoch !== revision() || !position.open) return false\n const retainedIndex = position.end - 1 - parser.droppedLines\n const current = outputRows.at(retainedIndex)\n return current !== undefined && !sameAnsiLine(position.open, current)\n }\n const newerRows = () => lineWindow().later + (changedParkedLine() ? 1 : 0)\n\n let scroller: HTMLDivElement | undefined\n const following = () => anchorEnd() === undefined\n\n const onScroll = () => {\n if (!scroller) return\n const atEnd = isAtBottom(scroller.scrollHeight, scroller.scrollTop, scroller.clientHeight)\n const position = anchorEnd()\n if (!atEnd) {\n if (position === undefined) {\n const currentEpoch = revision()\n setParked({ epoch: currentEpoch, end: total(), open: parser.openLine() })\n }\n } else if (position !== undefined && position >= total() && !changedParkedLine()) {\n // Back at the end of a view with nothing newer: nothing was missed.\n setParked(undefined)\n }\n }\n // Every chunk keeps a following reader at the end; a parked one stays put.\n // `following` is read in the compute: the apply phase reads no signals.\n createEffect(\n () => ({ revision: revision(), following: following() }),\n (read) => {\n if (scroller && read.following) scroller.scrollTop = scroller.scrollHeight\n }\n )\n const jumpToLatest = () => {\n if (!scroller) return\n setParked(undefined)\n scroller.scrollTop = scroller.scrollHeight\n // The button is about to disappear; leave focus somewhere real.\n scroller.focus()\n }\n\n const { copied, failed: copyFailed, copy: copyText } = createCopyFeedback()\n const copy = async () => {\n const ok = await copyText(ansiPlainText(local.output))\n local.onCopy?.(ok)\n }\n\n const empty = () => local.output === ''\n const regionLabel = () =>\n local.command ? `Output of ${local.command.slice(0, 120)}` : 'Terminal output'\n\n return (\n <div\n data-slot=\"terminal\"\n data-size={local.size ?? 'default'}\n aria-busy={local.status?.state === 'running' ? 'true' : undefined}\n class={cn(\n 'group/terminal overflow-hidden border border-border bg-card',\n small() ? 'rounded-lg' : 'rounded-xl',\n local.class\n )}\n {...rest}\n >\n <div class={cn('flex items-center gap-2', small() ? 'px-2 py-0.5' : 'px-3 py-1')}>\n <Show\n when={local.command !== undefined}\n fallback={<span class=\"flex-1 text-xs text-muted-foreground\">Terminal</span>}\n >\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n aria-hidden=\"true\"\n class=\"shrink-0 font-code text-code text-muted-foreground select-none\"\n >\n $\n </span>\n <code\n title={local.command}\n class=\"line-clamp-2 min-w-0 font-code text-code text-foreground [overflow-wrap:anywhere]\"\n >\n {local.command}\n </code>\n </span>\n </Show>\n <Show when={local.status}>{(status) => <StatusReadout status={status()} />}</Show>\n {/* Hidden until the terminal is hovered or holds focus, never removed:\n a control that only exists under the pointer is unreachable by\n keyboard, and a touch screen has no hover, so it always shows there. */}\n <div class=\"flex items-center gap-1 opacity-0 transition-opacity group-focus-within/terminal:opacity-100 group-hover/terminal:opacity-100 [@media(hover:none)]:opacity-100\">\n <Show when={local.onClear !== undefined && !empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={local.clearLabel ?? 'Clear output'}\n onClick={() => local.onClear?.()}\n >\n <Eraser aria-hidden=\"true\" />\n </Button>\n </Show>\n <Show when={!empty()}>\n <Button\n variant=\"ghost\"\n size=\"icon-2xs\"\n aria-label={\n copied() ? (local.copiedLabel ?? 'Copied') : (local.copyLabel ?? 'Copy output')\n }\n title={copyFailed() ? 'Copying is unavailable in this context' : undefined}\n onClick={() => void copy()}\n >\n <Show when={copied()} fallback={<Copy aria-hidden=\"true\" />}>\n <Check aria-hidden=\"true\" />\n </Show>\n </Button>\n </Show>\n </div>\n </div>\n\n <Show when={lineWindow().hidden > 0 || lineWindow().evicted > 0}>\n <div\n data-slot=\"terminal-hidden-note\"\n class=\"flex items-center gap-2 border-t border-border px-3 py-1 text-xs text-muted-foreground\"\n >\n <span>\n <Show when={lineWindow().hidden > 0}>\n {lineWindow().hidden.toLocaleString()} earlier{' '}\n {lineWindow().hidden === 1 ? 'line' : 'lines'} hidden\n <Show when={droppedLines() > 0}>\n {' '}\n ({droppedLines().toLocaleString()} only in the copy)\n </Show>\n .\n </Show>\n <Show when={lineWindow().evicted > 0}>\n {' '}\n {lineWindow().lost\n ? `Older lines dropped. Showing the oldest ${lineWindow().end.toLocaleString()} kept.`\n : `${lineWindow().evicted.toLocaleString()} older lines dropped.`}\n </Show>\n </span>\n <Show when={lineWindow().revealable > 0}>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() => setLimit(revealEarlier(limit(), pageSize(), outputRows.length))}\n >\n Show {Math.min(pageSize(), lineWindow().revealable).toLocaleString()} earlier\n </Button>\n </Show>\n </div>\n </Show>\n\n <div class=\"relative\">\n <div\n ref={(element) => (scroller = element)}\n data-slot=\"terminal-body\"\n // A region that scrolls must be focusable, and a tab stop needs a name.\n role=\"region\"\n tabindex=\"0\"\n aria-label={regionLabel()}\n onScroll={onScroll}\n style={{ 'max-height': maxHeight() }}\n class=\"scroll-fade overflow-auto border-t border-border bg-(--terminal-background) text-(color:--terminal-foreground)\"\n >\n <Show\n when={!empty()}\n fallback={\n <p class={cn('m-0 opacity-70', small() ? 'px-2 py-1.5' : 'px-3 py-2')}>\n <span class=\"font-code text-code\">\n {local.status?.state === 'running' ? 'Waiting for output…' : 'No output'}\n </span>\n </p>\n }\n >\n <pre\n class={cn(\n 'm-0 font-code text-code leading-normal',\n small() ? 'px-2 py-1.5' : 'px-3 py-2'\n )}\n >\n <For each={visibleRows()}>\n {(line) => <LineView line={line} wrap={local.wrap === true} />}\n </For>\n </pre>\n </Show>\n </div>\n <Show when={newerRows() > 0}>\n <Button\n variant=\"secondary\"\n size=\"2xs\"\n class=\"absolute end-3 bottom-2 shadow-sm\"\n onClick={jumpToLatest}\n >\n <ArrowDown aria-hidden=\"true\" />\n Jump to latest\n <span class=\"text-muted-foreground tabular-nums\">\n ({newerRows().toLocaleString()} newer {newerRows() === 1 ? 'line' : 'lines'})\n </span>\n </Button>\n </Show>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAM,YAAY,SAASiD,WAAe;AAC1C,IAAM,QAAQ,SAASC,OAAW;AAClC,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,OAAO,SAASC,MAAU;AAChC,IAAM,SAAS,SAASC,QAAY;AACpC,IAAM,eAAe,SAASC,cAAkB;;AAsFhD,IAAa,qBAAqB;AAIlC,IAAM,WAAW;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAM,WAAW;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,aAAa,OAA0B;CAC9C,MAAM,EAAE,IAAI,OAAO,cAAc,KAAK;CACtC,OAAO,GACL;EACE,aAAa,MAAM;EACnB,cAAc,MAAM;EACpB,QAAQ,MAAM;EACd,WAAW,MAAM,aAAa,CAAC,MAAM;EACrC,gBAAgB,MAAM,UAAU,CAAC,MAAM;EACvC,iDAAiD,MAAM,aAAa,MAAM;EAC1E,sCAAsC,OAAO;EAC7C,8BAA8B,OAAO;CACvC,GACA,OAAO,OAAO,YAAY,SAAS,KACnC,OAAO,OAAO,YAAY,SAAS,GACrC;AACF;AAEA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