@visulima/tui 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (669) hide show
  1. package/CHANGELOG.md +285 -0
  2. package/LICENSE.md +2650 -55
  3. package/README.md +38 -10
  4. package/dist/components/accordion.d.ts +59 -0
  5. package/dist/components/accordion.js +1 -0
  6. package/dist/components/alert.d.ts +26 -0
  7. package/dist/components/alert.js +1 -0
  8. package/dist/components/animate-presence.d.ts +18 -0
  9. package/dist/components/animate-presence.js +1 -0
  10. package/dist/components/approval-prompt.d.ts +65 -0
  11. package/dist/components/approval-prompt.js +1 -0
  12. package/dist/components/area-chart.d.ts +66 -0
  13. package/dist/components/area-chart.js +1 -0
  14. package/dist/components/badge.d.ts +22 -0
  15. package/dist/components/badge.js +1 -0
  16. package/dist/components/bar-chart.d.ts +67 -0
  17. package/dist/components/bar-chart.js +1 -0
  18. package/dist/components/big-text.d.ts +81 -0
  19. package/dist/components/big-text.js +1 -0
  20. package/dist/components/blink-dot.d.ts +36 -0
  21. package/dist/components/blink-dot.js +1 -0
  22. package/dist/components/box.d.ts +61 -0
  23. package/dist/components/box.js +1 -0
  24. package/dist/components/breadcrumb.d.ts +33 -0
  25. package/dist/components/breadcrumb.js +1 -0
  26. package/dist/components/button.d.ts +45 -0
  27. package/dist/components/button.js +1 -0
  28. package/dist/components/calendar.d.ts +72 -0
  29. package/dist/components/calendar.js +1 -0
  30. package/dist/components/canvas.d.ts +44 -0
  31. package/dist/components/canvas.js +1 -0
  32. package/dist/components/card.d.ts +57 -0
  33. package/dist/components/card.js +1 -0
  34. package/dist/components/checkbox.d.ts +48 -0
  35. package/dist/components/checkbox.js +1 -0
  36. package/dist/components/code.d.ts +48 -0
  37. package/dist/components/code.js +2 -0
  38. package/dist/components/collapsible.d.ts +53 -0
  39. package/dist/components/collapsible.js +1 -0
  40. package/dist/components/command-block.d.ts +47 -0
  41. package/dist/components/command-block.js +4 -0
  42. package/dist/components/command-palette.d.ts +82 -0
  43. package/dist/components/command-palette.js +1 -0
  44. package/dist/components/confirm-dialog.d.ts +75 -0
  45. package/dist/components/confirm-dialog.js +1 -0
  46. package/dist/components/confirm-input.d.ts +38 -0
  47. package/dist/components/confirm-input.js +1 -0
  48. package/dist/components/console-overlay.d.ts +54 -0
  49. package/dist/components/console-overlay.js +1 -0
  50. package/dist/components/content-switcher.d.ts +57 -0
  51. package/dist/components/content-switcher.js +1 -0
  52. package/dist/components/controlled-scroll-view.d.ts +60 -0
  53. package/dist/components/controlled-scroll-view.js +1 -0
  54. package/dist/components/cursor.d.ts +61 -0
  55. package/dist/components/cursor.js +1 -0
  56. package/dist/components/date-picker.d.ts +65 -0
  57. package/dist/components/date-picker.js +1 -0
  58. package/dist/components/definition-list.d.ts +44 -0
  59. package/dist/components/definition-list.js +1 -0
  60. package/dist/components/dialog.d.ts +116 -0
  61. package/dist/components/dialog.js +1 -0
  62. package/dist/components/diff-view.d.ts +85 -0
  63. package/dist/components/diff-view.js +1 -0
  64. package/dist/components/divider.d.ts +49 -0
  65. package/dist/components/divider.js +1 -0
  66. package/dist/components/file-picker-entry.d.ts +104 -0
  67. package/dist/components/file-picker-entry.js +1 -0
  68. package/dist/components/form.d.ts +81 -0
  69. package/dist/components/form.js +1 -0
  70. package/dist/components/gauge.d.ts +87 -0
  71. package/dist/components/gauge.js +1 -0
  72. package/dist/components/gradient.d.ts +59 -0
  73. package/dist/components/gradient.js +4 -0
  74. package/dist/components/heading.d.ts +33 -0
  75. package/dist/components/heading.js +1 -0
  76. package/dist/components/heatmap.d.ts +62 -0
  77. package/dist/components/heatmap.js +1 -0
  78. package/dist/components/help.d.ts +52 -0
  79. package/dist/components/help.js +1 -0
  80. package/dist/components/histogram.d.ts +62 -0
  81. package/dist/components/histogram.js +1 -0
  82. package/dist/components/kbd.d.ts +31 -0
  83. package/dist/components/kbd.js +1 -0
  84. package/dist/components/line-chart.d.ts +109 -0
  85. package/dist/components/line-chart.js +1 -0
  86. package/dist/components/link.d.ts +38 -0
  87. package/dist/components/link.js +1 -0
  88. package/dist/components/loading-indicator.d.ts +29 -0
  89. package/dist/components/loading-indicator.js +1 -0
  90. package/dist/components/markdown.d.ts +40 -0
  91. package/dist/components/markdown.js +1 -0
  92. package/dist/components/masked-input.d.ts +50 -0
  93. package/dist/components/masked-input.js +1 -0
  94. package/dist/components/menu.d.ts +78 -0
  95. package/dist/components/menu.js +1 -0
  96. package/dist/components/message-bubble.d.ts +43 -0
  97. package/dist/components/message-bubble.js +1 -0
  98. package/dist/components/model-badge.d.ts +39 -0
  99. package/dist/components/model-badge.js +1 -0
  100. package/dist/components/multi-select.d.ts +65 -0
  101. package/dist/components/multi-select.js +1 -0
  102. package/dist/components/newline.d.ts +15 -0
  103. package/dist/components/newline.js +2 -0
  104. package/dist/components/operation-tree.d.ts +49 -0
  105. package/dist/components/operation-tree.js +1 -0
  106. package/dist/components/option-list.d.ts +47 -0
  107. package/dist/components/option-list.js +1 -0
  108. package/dist/components/ordered-list.d.ts +24 -0
  109. package/dist/components/ordered-list.js +1 -0
  110. package/dist/components/paginator.d.ts +69 -0
  111. package/dist/components/paginator.js +1 -0
  112. package/dist/components/paragraph.d.ts +38 -0
  113. package/dist/components/paragraph.js +1 -0
  114. package/dist/components/placeholder.d.ts +55 -0
  115. package/dist/components/placeholder.js +1 -0
  116. package/dist/components/progress-bar.d.ts +55 -0
  117. package/dist/components/progress-bar.js +1 -0
  118. package/dist/components/radio-group.d.ts +74 -0
  119. package/dist/components/radio-group.js +1 -0
  120. package/dist/components/scatter-plot.d.ts +35 -0
  121. package/dist/components/scatter-plot.js +1 -0
  122. package/dist/components/scroll-bar-box.d.ts +36 -0
  123. package/dist/components/scroll-bar-box.js +1 -0
  124. package/dist/components/scroll-bar.d.ts +24 -0
  125. package/dist/components/scroll-bar.js +1 -0
  126. package/dist/components/scroll-list.d.ts +19 -0
  127. package/dist/components/scroll-list.js +1 -0
  128. package/dist/components/scroll-view.d.ts +9 -0
  129. package/dist/components/scroll-view.js +1 -0
  130. package/dist/components/search-input.d.ts +55 -0
  131. package/dist/components/search-input.js +1 -0
  132. package/dist/components/select-input-indicator.d.ts +32 -0
  133. package/dist/components/select-input-indicator.js +1 -0
  134. package/dist/components/select-input-item.d.ts +41 -0
  135. package/dist/components/select-input-item.js +1 -0
  136. package/dist/components/select-input.d.ts +110 -0
  137. package/dist/components/select-input.js +1 -0
  138. package/dist/components/shimmer-text.d.ts +47 -0
  139. package/dist/components/shimmer-text.js +1 -0
  140. package/dist/components/slider.d.ts +103 -0
  141. package/dist/components/slider.js +1 -0
  142. package/dist/components/spacer.d.ts +8 -0
  143. package/dist/components/spacer.js +1 -0
  144. package/dist/components/sparkline.d.ts +35 -0
  145. package/dist/components/sparkline.js +1 -0
  146. package/dist/components/spinner.d.ts +17 -0
  147. package/dist/components/spinner.js +1 -0
  148. package/dist/components/static-render.d.ts +54 -0
  149. package/dist/components/static-render.js +1 -0
  150. package/dist/components/static.d.ts +28 -0
  151. package/dist/components/static.js +1 -0
  152. package/dist/components/status-line.d.ts +37 -0
  153. package/dist/components/status-line.js +1 -0
  154. package/dist/components/status-message.d.ts +21 -0
  155. package/dist/components/status-message.js +1 -0
  156. package/dist/components/stepper.d.ts +48 -0
  157. package/dist/components/stepper.js +1 -0
  158. package/dist/components/stopwatch.d.ts +49 -0
  159. package/dist/components/stopwatch.js +1 -0
  160. package/dist/components/streaming-text.d.ts +46 -0
  161. package/dist/components/streaming-text.js +1 -0
  162. package/dist/components/switch.d.ts +55 -0
  163. package/dist/components/switch.js +1 -0
  164. package/dist/components/tab.d.ts +19 -0
  165. package/dist/components/tab.js +1 -0
  166. package/dist/components/table.d.ts +119 -0
  167. package/dist/components/table.js +1 -0
  168. package/dist/components/tabs.d.ts +107 -0
  169. package/dist/components/tabs.js +1 -0
  170. package/dist/components/tag.d.ts +35 -0
  171. package/dist/components/tag.js +1 -0
  172. package/dist/components/text-input.d.ts +48 -0
  173. package/dist/components/text-input.js +1 -0
  174. package/dist/components/text.d.ts +78 -0
  175. package/dist/components/text.js +1 -0
  176. package/dist/components/textarea.d.ts +68 -0
  177. package/dist/components/textarea.js +2 -0
  178. package/dist/components/timer.d.ts +59 -0
  179. package/dist/components/timer.js +1 -0
  180. package/dist/components/toast.d.ts +49 -0
  181. package/dist/components/toast.js +1 -0
  182. package/dist/components/tooltip.d.ts +43 -0
  183. package/dist/components/tooltip.js +1 -0
  184. package/dist/components/transform.d.ts +21 -0
  185. package/dist/components/transform.js +1 -0
  186. package/dist/components/transition.d.ts +74 -0
  187. package/dist/components/transition.js +1 -0
  188. package/dist/components/tree-view-entry.d.ts +356 -0
  189. package/dist/components/tree-view-entry.js +1 -0
  190. package/dist/components/unordered-list.d.ts +30 -0
  191. package/dist/components/unordered-list.js +1 -0
  192. package/dist/core/index.d.ts +57 -5
  193. package/dist/core/index.js +1 -5
  194. package/dist/ink/hooks/use-animation.d.ts +37 -39
  195. package/dist/ink/hooks/use-animation.js +1 -0
  196. package/dist/ink/hooks/use-app.d.ts +36 -4
  197. package/dist/ink/hooks/use-app.js +1 -0
  198. package/dist/ink/hooks/use-box-metrics.d.ts +57 -50
  199. package/dist/ink/hooks/use-box-metrics.js +1 -0
  200. package/dist/ink/hooks/use-clipboard.d.ts +26 -25
  201. package/dist/ink/hooks/use-clipboard.js +1 -0
  202. package/dist/ink/hooks/use-color-blindness.d.ts +29 -29
  203. package/dist/ink/hooks/use-color-blindness.js +1 -0
  204. package/dist/ink/hooks/use-console-capture.d.ts +38 -38
  205. package/dist/ink/hooks/use-console-capture.js +1 -0
  206. package/dist/ink/hooks/use-cursor.d.ts +10 -9
  207. package/dist/ink/hooks/use-cursor.js +1 -0
  208. package/dist/ink/hooks/use-focus-manager.d.ts +53 -38
  209. package/dist/ink/hooks/use-focus-manager.js +1 -0
  210. package/dist/ink/hooks/use-focus.d.ts +29 -25
  211. package/dist/ink/hooks/use-focus.js +1 -0
  212. package/dist/ink/hooks/use-form.d.ts +68 -0
  213. package/dist/ink/hooks/use-form.js +1 -0
  214. package/dist/ink/hooks/use-hotkey.d.ts +37 -0
  215. package/dist/ink/hooks/use-hotkey.js +1 -0
  216. package/dist/ink/hooks/use-input.d.ts +142 -142
  217. package/dist/ink/hooks/use-input.js +2 -0
  218. package/dist/ink/hooks/use-interval.d.ts +25 -0
  219. package/dist/ink/hooks/use-interval.js +1 -0
  220. package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +4 -4
  221. package/dist/ink/hooks/use-is-screen-reader-enabled.js +1 -0
  222. package/dist/ink/hooks/use-key-bindings.d.ts +50 -52
  223. package/dist/ink/hooks/use-key-bindings.js +1 -0
  224. package/dist/ink/hooks/use-key-chord.d.ts +25 -0
  225. package/dist/ink/hooks/use-key-chord.js +1 -0
  226. package/dist/ink/hooks/use-linked-scroll.d.ts +44 -37
  227. package/dist/ink/hooks/use-linked-scroll.js +1 -0
  228. package/dist/ink/hooks/use-paste.d.ts +41 -40
  229. package/dist/ink/hooks/use-paste.js +1 -0
  230. package/dist/ink/hooks/use-persistent-state.d.ts +56 -0
  231. package/dist/ink/hooks/use-persistent-state.js +2 -0
  232. package/dist/ink/hooks/use-scroll-acceleration.d.ts +43 -43
  233. package/dist/ink/hooks/use-scroll-acceleration.js +1 -0
  234. package/dist/ink/hooks/use-scroll-input.d.ts +31 -31
  235. package/dist/ink/hooks/use-scroll-input.js +1 -0
  236. package/dist/ink/hooks/use-stderr.d.ts +14 -4
  237. package/dist/ink/hooks/use-stderr.js +1 -0
  238. package/dist/ink/hooks/use-stdin.d.ts +28 -5
  239. package/dist/ink/hooks/use-stdin.js +1 -0
  240. package/dist/ink/hooks/use-stdout.d.ts +14 -4
  241. package/dist/ink/hooks/use-stdout.js +1 -0
  242. package/dist/ink/hooks/use-stopwatch.d.ts +36 -37
  243. package/dist/ink/hooks/use-stopwatch.js +1 -0
  244. package/dist/ink/hooks/use-terminal-palette.d.ts +17 -16
  245. package/dist/ink/hooks/use-terminal-palette.js +1 -0
  246. package/dist/ink/hooks/use-text-buffer.d.ts +37 -37
  247. package/dist/ink/hooks/use-text-buffer.js +4 -0
  248. package/dist/ink/hooks/use-text-selection.d.ts +40 -41
  249. package/dist/ink/hooks/use-text-selection.js +1 -0
  250. package/dist/ink/hooks/use-timeout.d.ts +24 -0
  251. package/dist/ink/hooks/use-timeout.js +1 -0
  252. package/dist/ink/hooks/use-timer.d.ts +45 -46
  253. package/dist/ink/hooks/use-timer.js +1 -0
  254. package/dist/ink/hooks/use-window-size.d.ts +14 -14
  255. package/dist/ink/hooks/use-window-size.js +1 -0
  256. package/dist/ink/index.d.ts +397 -159
  257. package/dist/ink/index.js +1 -100
  258. package/dist/packem_chunks/devtools.js +3 -26
  259. package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +1 -0
  260. package/dist/packem_shared/Cell-BrXn3jxY.js +1 -0
  261. package/dist/packem_shared/ControlledScrollView-CIc-x1Cx.js +1 -0
  262. package/dist/packem_shared/DevTools-BR7K-5JX.js +1 -0
  263. package/dist/packem_shared/FilePicker-tYj_CIau.js +1 -0
  264. package/dist/packem_shared/FocusContext-Xy0cwJpO.js +1 -0
  265. package/dist/packem_shared/Fullscreen-CxLd1-Zu.js +1 -0
  266. package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +1 -0
  267. package/dist/packem_shared/InputParser-BAqciKJ6.js +2 -0
  268. package/dist/packem_shared/KEY-Bk8B-3h_.js +1 -0
  269. package/dist/packem_shared/LayoutNode-B0qeT8sl.js +1 -0
  270. package/dist/packem_shared/MouseProvider-CHU5DuwC.js +1 -0
  271. package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +1 -0
  272. package/dist/packem_shared/Renderer-DJXooAsp.js +1 -0
  273. package/dist/packem_shared/ResizeObserverEntry-Dq0dk8Kq.js +1 -0
  274. package/dist/packem_shared/ScrollBar-U_37hlIT.js +1 -0
  275. package/dist/packem_shared/ScrollBarBox-DwiCxilX.js +1 -0
  276. package/dist/packem_shared/ScrollList-C7nZ9ufK.js +1 -0
  277. package/dist/packem_shared/ScrollView-DKZ8OM-m.js +1 -0
  278. package/dist/packem_shared/Static-DLynr5pn.js +1 -0
  279. package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +1 -0
  280. package/dist/packem_shared/TreeView-C0Iv3et8.js +1 -0
  281. package/dist/packem_shared/TuiApp-CxBtziW8.js +1 -0
  282. package/dist/packem_shared/TuiContext-BoJvG3NN.js +3 -0
  283. package/dist/packem_shared/_commonjsHelpers-CHNfUHCT.js +1 -0
  284. package/dist/packem_shared/accessibility-context-DDyHTwmA.js +1 -0
  285. package/dist/packem_shared/animation-context-DW3p-vpk.js +1 -0
  286. package/dist/packem_shared/ansi-parser-C5JuL732.js +1 -0
  287. package/dist/packem_shared/ansi-tokenizer-DqX9nJuk.js +1 -0
  288. package/dist/packem_shared/app-context-BVpKlG1z.js +1 -0
  289. package/dist/packem_shared/background-context-rjOaWFki.js +1 -0
  290. package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
  291. package/dist/packem_shared/braille-BBjIoaN0.js +1 -0
  292. package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +39 -0
  293. package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +23 -0
  294. package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +50 -0
  295. package/dist/packem_shared/colorize-gy_cY-wC.js +2 -0
  296. package/dist/packem_shared/comparePoints-Dez5FkH9.js +1 -0
  297. package/dist/packem_shared/constants-D12jy2Zh-RSfxu1eM.js +1 -0
  298. package/dist/packem_shared/controlled-scroll-view-CcUS50jx.js +1 -0
  299. package/dist/packem_shared/createInlineLoop-D0JaKX9A.js +2 -0
  300. package/dist/packem_shared/createScreen-87XLHZq6.js +3 -0
  301. package/dist/packem_shared/cursor-context-CFviBqPX.js +1 -0
  302. package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +12 -0
  303. package/dist/packem_shared/dom-CW6KYzFK.js +8 -0
  304. package/dist/packem_shared/dom.d-DgP_exKU.d.ts +412 -0
  305. package/dist/packem_shared/erase-DKKNxHZ_.js +1 -0
  306. package/dist/packem_shared/focus-context-CsT69klR.js +1 -0
  307. package/dist/packem_shared/format-time-C7Q-hQZq.js +1 -0
  308. package/dist/packem_shared/get-string-width-CbMPWEJO.js +1 -0
  309. package/dist/packem_shared/getPathToRoot-B3q6OlQy.js +1 -0
  310. package/dist/packem_shared/getScrollHeight-ClEOyLHH.js +1 -0
  311. package/dist/packem_shared/index-COPEEDn3.js +9 -0
  312. package/dist/packem_shared/index-CqsHHJkn.js +75 -0
  313. package/dist/packem_shared/index.d-Bk52cbgN.d.ts +14 -0
  314. package/dist/packem_shared/index.server.d-eZWyC2Ku.d.ts +5 -0
  315. package/dist/packem_shared/input-utils-fAxzSlNh.js +1 -0
  316. package/dist/packem_shared/input.d-D-Yxqha8.d.ts +172 -0
  317. package/dist/packem_shared/isIntersecting-B3KbKTmu.js +1 -0
  318. package/dist/packem_shared/isOsc52Supported-DKK7Uee6.js +1 -0
  319. package/dist/packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js +1 -0
  320. package/dist/packem_shared/kittyFlags-C3rZLbcK.js +1 -0
  321. package/dist/packem_shared/layout-BMo200nF.js +2 -0
  322. package/dist/packem_shared/line-chart-kf7uhR0K.js +1 -0
  323. package/dist/packem_shared/measure-text-D-jVetsl.js +3 -0
  324. package/dist/packem_shared/measureElement-BTtTFZg4.js +1 -0
  325. package/dist/packem_shared/mode-BOIU4Roy.js +1 -0
  326. package/dist/packem_shared/mouse-context-DaARgUu1.js +1 -0
  327. package/dist/packem_shared/parseSgrMouse-DoBY7MKw.js +1 -0
  328. package/dist/packem_shared/processLayout-FEKj_mWu.js +1 -0
  329. package/dist/packem_shared/reconciler-CGhHgXXG.js +1 -0
  330. package/dist/packem_shared/reconciler-ClRKkLS4.js +1 -0
  331. package/dist/packem_shared/render-BoukeuYD.js +1 -0
  332. package/dist/packem_shared/render-CBFHzIKj.js +27 -0
  333. package/dist/packem_shared/render.d-DarVJBG2.d.ts +417 -0
  334. package/dist/packem_shared/renderToString-Cx3DmmMR.js +4 -0
  335. package/dist/packem_shared/renderToString-nZdqfdWT.js +2 -0
  336. package/dist/packem_shared/renderTreeToBuffer-LnGZkEUX.js +2 -0
  337. package/dist/packem_shared/renderer-C2ycheBL.js +17 -0
  338. package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +119 -0
  339. package/dist/packem_shared/selection.d-WuD_83yQ.d.ts +62 -0
  340. package/dist/packem_shared/setEnableStyledLineCache-Cke6_ZQt.js +1 -0
  341. package/dist/packem_shared/squashTextNodesWithMap-DCdi3SZ2.js +1 -0
  342. package/dist/packem_shared/stderr-context-BzEaUICS.js +1 -0
  343. package/dist/packem_shared/stdin-context-BTaaFagk.js +1 -0
  344. package/dist/packem_shared/stdout-context-BnblEPez.js +1 -0
  345. package/dist/packem_shared/strip-C6HQYmlg.js +1 -0
  346. package/dist/packem_shared/styles.d-CLJdt-kg.d.ts +492 -0
  347. package/dist/packem_shared/terminal-palette.d-D2SQjfn-.d.ts +19 -0
  348. package/dist/packem_shared/text-width-CI9G0a-z.js +2 -0
  349. package/dist/packem_shared/token-to-elements-BAZpNZsu.js +1 -0
  350. package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +1 -0
  351. package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +1 -0
  352. package/dist/packem_shared/useMouseAction-2dRfU1vE.js +1 -0
  353. package/dist/packem_shared/useMouseContext-C746G7kY.js +1 -0
  354. package/dist/packem_shared/useMousePosition-BTWfV4JK.js +1 -0
  355. package/dist/packem_shared/useOnMouseClick-nY8xLZmt.js +1 -0
  356. package/dist/packem_shared/useOnMouseHover-D3DczIol.js +1 -0
  357. package/dist/packem_shared/useOnMouseState-cRK8QvzD.js +1 -0
  358. package/dist/packem_shared/useTreeView-BoMMeRPq.js +1 -0
  359. package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +1 -0
  360. package/dist/packem_shared/utils-THUhYKG2.js +1 -0
  361. package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
  362. package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
  363. package/dist/packem_shared/waitFor-Dj5zfL5s.js +4 -0
  364. package/dist/packem_shared/wrapOrTruncateStyledLine-kyi6yijx.js +3 -0
  365. package/dist/react/index.d.ts +518 -8
  366. package/dist/react/index.js +1 -9
  367. package/dist/testing/index.d.ts +277 -135
  368. package/dist/testing/index.js +1 -260
  369. package/index.js +52 -52
  370. package/package.json +552 -40
  371. package/dist/core/app.d.ts +0 -50
  372. package/dist/core/cell.d.ts +0 -33
  373. package/dist/core/inline.d.ts +0 -22
  374. package/dist/core/input.d.ts +0 -18
  375. package/dist/core/native-binding.d.ts +0 -22
  376. package/dist/ink/ansi-to-cell.d.ts +0 -5
  377. package/dist/ink/ansi-tokenizer.d.ts +0 -38
  378. package/dist/ink/clipboard.d.ts +0 -29
  379. package/dist/ink/color-matrix.d.ts +0 -49
  380. package/dist/ink/color-utils.d.ts +0 -30
  381. package/dist/ink/colorize.d.ts +0 -4
  382. package/dist/ink/components/AccessibilityContext.d.ts +0 -4
  383. package/dist/ink/components/Alert.d.ts +0 -30
  384. package/dist/ink/components/AnimationContext.d.ts +0 -10
  385. package/dist/ink/components/App.d.ts +0 -19
  386. package/dist/ink/components/AppContext.d.ts +0 -38
  387. package/dist/ink/components/BackgroundContext.d.ts +0 -5
  388. package/dist/ink/components/Badge.d.ts +0 -27
  389. package/dist/ink/components/BigText.d.ts +0 -71
  390. package/dist/ink/components/Box.d.ts +0 -58
  391. package/dist/ink/components/Code.d.ts +0 -46
  392. package/dist/ink/components/ConfirmInput.d.ts +0 -40
  393. package/dist/ink/components/ConsoleOverlay.d.ts +0 -52
  394. package/dist/ink/components/Cursor.d.ts +0 -43
  395. package/dist/ink/components/CursorContext.d.ts +0 -12
  396. package/dist/ink/components/Dialog.d.ts +0 -93
  397. package/dist/ink/components/DiffView.d.ts +0 -71
  398. package/dist/ink/components/ErrorBoundary.d.ts +0 -17
  399. package/dist/ink/components/ErrorOverview.d.ts +0 -6
  400. package/dist/ink/components/FocusContext.d.ts +0 -17
  401. package/dist/ink/components/Gradient.d.ts +0 -38
  402. package/dist/ink/components/Help.d.ts +0 -49
  403. package/dist/ink/components/Link.d.ts +0 -34
  404. package/dist/ink/components/Markdown.d.ts +0 -34
  405. package/dist/ink/components/MultiSelect.d.ts +0 -63
  406. package/dist/ink/components/Newline.d.ts +0 -12
  407. package/dist/ink/components/OrderedList.d.ts +0 -30
  408. package/dist/ink/components/Paginator.d.ts +0 -75
  409. package/dist/ink/components/ProgressBar.d.ts +0 -51
  410. package/dist/ink/components/SelectInput.d.ts +0 -96
  411. package/dist/ink/components/SelectInputIndicator.d.ts +0 -36
  412. package/dist/ink/components/SelectInputItem.d.ts +0 -43
  413. package/dist/ink/components/Slider.d.ts +0 -92
  414. package/dist/ink/components/Spacer.d.ts +0 -7
  415. package/dist/ink/components/Spinner.d.ts +0 -42
  416. package/dist/ink/components/Static.d.ts +0 -24
  417. package/dist/ink/components/StaticRender.d.ts +0 -28
  418. package/dist/ink/components/StatusMessage.d.ts +0 -26
  419. package/dist/ink/components/StderrContext.d.ts +0 -16
  420. package/dist/ink/components/StdinContext.d.ts +0 -29
  421. package/dist/ink/components/StdoutContext.d.ts +0 -16
  422. package/dist/ink/components/Stopwatch.d.ts +0 -44
  423. package/dist/ink/components/Tab.d.ts +0 -25
  424. package/dist/ink/components/Table.d.ts +0 -80
  425. package/dist/ink/components/Tabs.d.ts +0 -104
  426. package/dist/ink/components/Text.d.ts +0 -63
  427. package/dist/ink/components/TextInput.d.ts +0 -48
  428. package/dist/ink/components/Textarea.d.ts +0 -62
  429. package/dist/ink/components/Timer.d.ts +0 -52
  430. package/dist/ink/components/Transform.d.ts +0 -16
  431. package/dist/ink/components/UnorderedList.d.ts +0 -35
  432. package/dist/ink/components/file-picker/FilePicker.d.ts +0 -75
  433. package/dist/ink/components/file-picker/index.d.ts +0 -3
  434. package/dist/ink/components/file-picker/types.d.ts +0 -38
  435. package/dist/ink/components/file-picker/use-file-system.d.ts +0 -16
  436. package/dist/ink/components/scroll/ControlledScrollView.d.ts +0 -43
  437. package/dist/ink/components/scroll/ScrollBar.d.ts +0 -20
  438. package/dist/ink/components/scroll/ScrollBarBox.d.ts +0 -15
  439. package/dist/ink/components/scroll/ScrollList.d.ts +0 -12
  440. package/dist/ink/components/scroll/ScrollView.d.ts +0 -98
  441. package/dist/ink/components/scroll/index.d.ts +0 -10
  442. package/dist/ink/components/scroll/use-state-ref.d.ts +0 -8
  443. package/dist/ink/components/tree-view/TreeView.d.ts +0 -89
  444. package/dist/ink/components/tree-view/TreeViewNode.d.ts +0 -29
  445. package/dist/ink/components/tree-view/index.d.ts +0 -11
  446. package/dist/ink/components/tree-view/theme.d.ts +0 -24
  447. package/dist/ink/components/tree-view/tree-node-map.d.ts +0 -72
  448. package/dist/ink/components/tree-view/types.d.ts +0 -55
  449. package/dist/ink/components/tree-view/use-tree-view-state.d.ts +0 -135
  450. package/dist/ink/components/tree-view/use-tree-view.d.ts +0 -26
  451. package/dist/ink/components/variant-config.d.ts +0 -10
  452. package/dist/ink/cursor-helpers.d.ts +0 -38
  453. package/dist/ink/data-limited-lru-map.d.ts +0 -21
  454. package/dist/ink/devtools-window-polyfill.d.ts +0 -1
  455. package/dist/ink/devtools.d.ts +0 -1
  456. package/dist/ink/dom.d.ts +0 -213
  457. package/dist/ink/get-max-width.d.ts +0 -3
  458. package/dist/ink/highlighter.d.ts +0 -28
  459. package/dist/ink/ime-utils.d.ts +0 -25
  460. package/dist/ink/ink.d.ts +0 -189
  461. package/dist/ink/input-parser.d.ts +0 -10
  462. package/dist/ink/input-utils.d.ts +0 -16
  463. package/dist/ink/instances.d.ts +0 -3
  464. package/dist/ink/kitty-keyboard.d.ts +0 -23
  465. package/dist/ink/layout.d.ts +0 -26
  466. package/dist/ink/log-update-native.d.ts +0 -14
  467. package/dist/ink/log-update.d.ts +0 -21
  468. package/dist/ink/measure-element.d.ts +0 -147
  469. package/dist/ink/measure-text.d.ts +0 -56
  470. package/dist/ink/mouse/Fullscreen.d.ts +0 -8
  471. package/dist/ink/mouse/MouseProvider.d.ts +0 -11
  472. package/dist/ink/mouse/ansi-parser.d.ts +0 -37
  473. package/dist/ink/mouse/constants.d.ts +0 -59
  474. package/dist/ink/mouse/index.d.ts +0 -20
  475. package/dist/ink/mouse/is-intersecting.d.ts +0 -18
  476. package/dist/ink/mouse/mouse-context.d.ts +0 -36
  477. package/dist/ink/mouse/use-element-position.d.ts +0 -29
  478. package/dist/ink/mouse/use-mouse-action.d.ts +0 -7
  479. package/dist/ink/mouse/use-mouse-position.d.ts +0 -7
  480. package/dist/ink/mouse/use-mouse.d.ts +0 -7
  481. package/dist/ink/mouse/use-on-mouse-click.d.ts +0 -14
  482. package/dist/ink/mouse/use-on-mouse-hover.d.ts +0 -8
  483. package/dist/ink/mouse/use-on-mouse-state.d.ts +0 -11
  484. package/dist/ink/output.d.ts +0 -74
  485. package/dist/ink/parse-keypress.d.ts +0 -22
  486. package/dist/ink/reconciler.d.ts +0 -3
  487. package/dist/ink/region.d.ts +0 -99
  488. package/dist/ink/render-background.d.ts +0 -4
  489. package/dist/ink/render-border.d.ts +0 -4
  490. package/dist/ink/render-node-to-output.d.ts +0 -38
  491. package/dist/ink/render-scrollbar.d.ts +0 -9
  492. package/dist/ink/render-sticky.d.ts +0 -44
  493. package/dist/ink/render-to-string.d.ts +0 -37
  494. package/dist/ink/render.d.ts +0 -191
  495. package/dist/ink/renderer.d.ts +0 -17
  496. package/dist/ink/resize-observer.d.ts +0 -44
  497. package/dist/ink/sanitize-ansi.d.ts +0 -2
  498. package/dist/ink/scroll.d.ts +0 -23
  499. package/dist/ink/selection.d.ts +0 -70
  500. package/dist/ink/squash-text-nodes.d.ts +0 -18
  501. package/dist/ink/style-flags.d.ts +0 -17
  502. package/dist/ink/styled-line-factory.d.ts +0 -25
  503. package/dist/ink/styled-line-serializer.d.ts +0 -18
  504. package/dist/ink/styled-line.d.ts +0 -109
  505. package/dist/ink/styles.d.ts +0 -369
  506. package/dist/ink/terminal-palette.d.ts +0 -25
  507. package/dist/ink/text-wrap.d.ts +0 -10
  508. package/dist/ink/token-to-elements.d.ts +0 -22
  509. package/dist/ink/utils/format-time.d.ts +0 -4
  510. package/dist/ink/utils.d.ts +0 -9
  511. package/dist/ink/wrap-text.d.ts +0 -3
  512. package/dist/ink/write-synchronized.d.ts +0 -4
  513. package/dist/packem_shared/AccessibilityContext-BLelHhNU.js +0 -7
  514. package/dist/packem_shared/Alert-Dr3s_LD9.js +0 -17
  515. package/dist/packem_shared/AnimationContext-BcJg8Jr6.js +0 -15
  516. package/dist/packem_shared/AppContext-CP0U6H7O.js +0 -11
  517. package/dist/packem_shared/BackgroundContext-BAUaxfOb.js +0 -5
  518. package/dist/packem_shared/Badge-Dk7EGGM6.js +0 -13
  519. package/dist/packem_shared/BigText-CjMdY63X.js +0 -24
  520. package/dist/packem_shared/Box-D_pSJ9Jp.js +0 -73
  521. package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-BsMy5Ewl.js +0 -81
  522. package/dist/packem_shared/Cell-DCg1kJY-.js +0 -48
  523. package/dist/packem_shared/Code-DjQvPBD9.js +0 -53
  524. package/dist/packem_shared/ConfirmInput-85Y4kRQW.js +0 -44
  525. package/dist/packem_shared/ConsoleOverlay-DBNa4vtj.js +0 -57
  526. package/dist/packem_shared/ControlledScrollView-BlOaxcsN.js +0 -286
  527. package/dist/packem_shared/ControlledScrollView-DfAhcufF.js +0 -5
  528. package/dist/packem_shared/Cursor-DiW7YoSK.js +0 -18
  529. package/dist/packem_shared/CursorContext-JxRzlqAx.js +0 -9
  530. package/dist/packem_shared/DevTools-aMPIsaHx.js +0 -61
  531. package/dist/packem_shared/Dialog-DsSNAVgC.js +0 -71
  532. package/dist/packem_shared/DiffView-hqaw-2S6.js +0 -329
  533. package/dist/packem_shared/FilePicker-DNwFxRhq.js +0 -254
  534. package/dist/packem_shared/FocusContext-CWkYtgcm.js +0 -26
  535. package/dist/packem_shared/FocusContext-D5wFxSRz.js +0 -153
  536. package/dist/packem_shared/Fullscreen-DrElAE1o.js +0 -11
  537. package/dist/packem_shared/Gradient-Ql5P0GUd.js +0 -136
  538. package/dist/packem_shared/Help-6wanGG38.js +0 -112
  539. package/dist/packem_shared/IMECompositionBuffer-Dl3S0KnF.js +0 -55
  540. package/dist/packem_shared/InputParser-BKHpWfvN.js +0 -156
  541. package/dist/packem_shared/LayoutNode-Cjnsodiy.js +0 -131
  542. package/dist/packem_shared/Link-COcKYfGT.js +0 -66
  543. package/dist/packem_shared/Markdown-y1ISztof.js +0 -212
  544. package/dist/packem_shared/MouseProvider-Y9TSSEGl.js +0 -136
  545. package/dist/packem_shared/MultiSelect-ChoLUcDI.js +0 -129
  546. package/dist/packem_shared/NAMED_COLORS-a4QBvb5r.js +0 -262
  547. package/dist/packem_shared/Newline-DBtYEg8x.js +0 -7
  548. package/dist/packem_shared/OrderedList-Cp7pXr6m.js +0 -26
  549. package/dist/packem_shared/Paginator-D1AuD-kj.js +0 -104
  550. package/dist/packem_shared/ProgressBar-DOfpVagn.js +0 -22
  551. package/dist/packem_shared/Renderer-zZ5O3vxc.js +0 -31
  552. package/dist/packem_shared/ResizeObserverEntry-Br4seLeQ.js +0 -102
  553. package/dist/packem_shared/ScrollBar-EWAs2Uc7.js +0 -106
  554. package/dist/packem_shared/ScrollBarBox-DTNNlh7R.js +0 -72
  555. package/dist/packem_shared/ScrollList-DCeIFL8M.js +0 -227
  556. package/dist/packem_shared/ScrollView-v3MCNIyX.js +0 -196
  557. package/dist/packem_shared/SelectInput-BN2TMyxp.js +0 -260
  558. package/dist/packem_shared/SelectInputIndicator-DkRMoH_b.js +0 -9
  559. package/dist/packem_shared/SelectInputItem-BF9LQgKu.js +0 -8
  560. package/dist/packem_shared/Slider-BWD7xZX6.js +0 -116
  561. package/dist/packem_shared/Spacer-Bs4ER-HK.js +0 -8
  562. package/dist/packem_shared/Spinner-BuI-kN4p.js +0 -1799
  563. package/dist/packem_shared/Static-DpTd6Eed.js +0 -22
  564. package/dist/packem_shared/Static-xmD9giJj.js +0 -18
  565. package/dist/packem_shared/StaticRender-tYwH6QXl.js +0 -33
  566. package/dist/packem_shared/StatusMessage-BtSYxzwb.js +0 -14
  567. package/dist/packem_shared/StderrContext-Bj4Mf7v7.js +0 -17
  568. package/dist/packem_shared/StdinContext-Bq_GNJ3z.js +0 -38
  569. package/dist/packem_shared/StdoutContext-CgjWeCdO.js +0 -17
  570. package/dist/packem_shared/Stopwatch-DjtTCyHn.js +0 -23
  571. package/dist/packem_shared/Tab-C6r5q4hR.js +0 -7
  572. package/dist/packem_shared/Table-D-rSVlzb.js +0 -82
  573. package/dist/packem_shared/Tabs-hki-KRnx.js +0 -153
  574. package/dist/packem_shared/Text-DvAUdZcK.js +0 -65
  575. package/dist/packem_shared/TextInput-C79WEQ5U.js +0 -137
  576. package/dist/packem_shared/Textarea-Dj06R6Zd.js +0 -272
  577. package/dist/packem_shared/Timer-wi9zuh4n.js +0 -22
  578. package/dist/packem_shared/Transform-BHxY_dAM.js +0 -14
  579. package/dist/packem_shared/TreeNodeMap-CtJUvBnd.js +0 -155
  580. package/dist/packem_shared/TreeView-C2062dtj.js +0 -148
  581. package/dist/packem_shared/TuiApp-DfxOnXqi.js +0 -120
  582. package/dist/packem_shared/TuiContext-CqEjMyXd.js +0 -415
  583. package/dist/packem_shared/UnorderedList-DhnadWjX.js +0 -33
  584. package/dist/packem_shared/ansi-parser-0BdVTKho.js +0 -41
  585. package/dist/packem_shared/ansi-tokenizer-LHq2LUWA.js +0 -307
  586. package/dist/packem_shared/boxes-oi3WUbyR.js +0 -92
  587. package/dist/packem_shared/colorize-88_Vk8cn.js +0 -48
  588. package/dist/packem_shared/comparePoints-CGMDnd3_.js +0 -287
  589. package/dist/packem_shared/createInlineLoop-BxMmcq9D.js +0 -93
  590. package/dist/packem_shared/createLinkedScrollGroup-Djw4Ceo0.js +0 -44
  591. package/dist/packem_shared/dom-DvzhsAez.js +0 -225
  592. package/dist/packem_shared/format-time-BGmnDukX.js +0 -12
  593. package/dist/packem_shared/getPathToRoot-a1wbwxfL.js +0 -4
  594. package/dist/packem_shared/getScrollHeight-BubfU_df.js +0 -63
  595. package/dist/packem_shared/input-utils-ViAEXa0Z.js +0 -19
  596. package/dist/packem_shared/isIntersecting-fEXHJN5R.js +0 -10
  597. package/dist/packem_shared/isOsc52Supported-G0k4sXJx.js +0 -36
  598. package/dist/packem_shared/isTerminalPaletteQuerySupported-EeiwMKbr.js +0 -93
  599. package/dist/packem_shared/kittyFlags-bNNf_9kX.js +0 -26
  600. package/dist/packem_shared/measure-element-Reza_yfC.js +0 -396
  601. package/dist/packem_shared/measure-text-DItZYotK.js +0 -1189
  602. package/dist/packem_shared/measureElement-CTgFCmKd.js +0 -4
  603. package/dist/packem_shared/mouse-context-BUHWKEIe.js +0 -6
  604. package/dist/packem_shared/parseSgrMouse-BHVBPP9G.js +0 -1
  605. package/dist/packem_shared/processLayout-BQ9kXfd3.js +0 -2
  606. package/dist/packem_shared/reconciler-BXf6miSS.js +0 -211
  607. package/dist/packem_shared/reconciler-gfmqURLy.js +0 -680
  608. package/dist/packem_shared/render-BAwdjfki.js +0 -2806
  609. package/dist/packem_shared/render-Bpjhf0lD.js +0 -195
  610. package/dist/packem_shared/renderToString-Cfg55DRD.js +0 -62
  611. package/dist/packem_shared/renderToString-ClIaXgrC.js +0 -86
  612. package/dist/packem_shared/renderTreeToBuffer-D3mo7M7m.js +0 -308
  613. package/dist/packem_shared/renderer-B3wROkeg.js +0 -1431
  614. package/dist/packem_shared/setEnableStyledLineCache-BpskngSJ.js +0 -2
  615. package/dist/packem_shared/squashTextNodesWithMap-iqm6OMMT.js +0 -100
  616. package/dist/packem_shared/text-width-DhuarWcB.js +0 -42
  617. package/dist/packem_shared/token-to-elements-BRFl_rzw.js +0 -249
  618. package/dist/packem_shared/treeViewTheme-BpSw9TMf.js +0 -52
  619. package/dist/packem_shared/useAnimation-kj31sA-T.js +0 -62
  620. package/dist/packem_shared/useApp-DPQlRzi5.js +0 -6
  621. package/dist/packem_shared/useBoxMetrics-rBjKc-g4.js +0 -54
  622. package/dist/packem_shared/useClipboard-B_9-adw1.js +0 -23
  623. package/dist/packem_shared/useColorBlindness-D_sTIhcb.js +0 -30
  624. package/dist/packem_shared/useConsoleCapture-Dvt7G1W1.js +0 -61
  625. package/dist/packem_shared/useCursor-BIJzc8k9.js +0 -19
  626. package/dist/packem_shared/useElementDimensions-CAoKitVD.js +0 -67
  627. package/dist/packem_shared/useFocus-CNl5QHHf.js +0 -37
  628. package/dist/packem_shared/useFocusManager-BPYaUuKQ.js +0 -16
  629. package/dist/packem_shared/useInput-Cfp5zB2s.js +0 -594
  630. package/dist/packem_shared/useIsScreenReaderEnabled-CnGKCe0f.js +0 -9
  631. package/dist/packem_shared/useKeyBindings-B78l1E1n.js +0 -66
  632. package/dist/packem_shared/useMouseAction-C5gZ2nj7.js +0 -29
  633. package/dist/packem_shared/useMouseContext-D-rFy60Q.js +0 -12
  634. package/dist/packem_shared/useMousePosition-BHBJ-kBk.js +0 -25
  635. package/dist/packem_shared/useOnMouseClick--ZIyBOBO.js +0 -35
  636. package/dist/packem_shared/useOnMouseHover-26diuXUC.js +0 -32
  637. package/dist/packem_shared/useOnMouseState-NO_Kda_C.js +0 -13
  638. package/dist/packem_shared/usePaste-Ct8J4AGR.js +0 -35
  639. package/dist/packem_shared/useScrollAcceleration-R9LfrPVG.js +0 -73
  640. package/dist/packem_shared/useScrollInput-D3CpBq_a.js +0 -72
  641. package/dist/packem_shared/useStderr-CAOVUh4E.js +0 -6
  642. package/dist/packem_shared/useStdin-X-O0kd-n.js +0 -7
  643. package/dist/packem_shared/useStdout-DyF6DSH0.js +0 -6
  644. package/dist/packem_shared/useStopwatch-qC4Beai4.js +0 -33
  645. package/dist/packem_shared/useTerminalPalette-BaWO2c4Q.js +0 -38
  646. package/dist/packem_shared/useTextBuffer-C8fEe9Ly.js +0 -398
  647. package/dist/packem_shared/useTextSelection-mXtxgsPK.js +0 -50
  648. package/dist/packem_shared/useTimer-CPQ7j827.js +0 -46
  649. package/dist/packem_shared/useTreeView-BT57P3Kx.js +0 -101
  650. package/dist/packem_shared/useTreeViewState-BpS_KZ-K.js +0 -502
  651. package/dist/packem_shared/useWindowSize-ugEmGZJm.js +0 -20
  652. package/dist/packem_shared/utils-BgdlrbOH.js +0 -140
  653. package/dist/packem_shared/variant-config-DSZoX5TM.js +0 -8
  654. package/dist/packem_shared/wrapOrTruncateStyledLine-DN3Nogoc.js +0 -147
  655. package/dist/react/devtools.d.ts +0 -27
  656. package/dist/react/focus.d.ts +0 -39
  657. package/dist/react/hooks.d.ts +0 -238
  658. package/dist/react/layout.d.ts +0 -35
  659. package/dist/react/react.d.ts +0 -57
  660. package/dist/react/reconciler.d.ts +0 -4
  661. package/dist/react/render-to-string.d.ts +0 -21
  662. package/dist/react/renderer.d.ts +0 -2
  663. package/dist/react/scene.d.ts +0 -3
  664. package/dist/react/static.d.ts +0 -39
  665. package/dist/react/styles.d.ts +0 -83
  666. package/dist/react/text-width.d.ts +0 -20
  667. package/dist/testing/keys.d.ts +0 -89
  668. package/dist/testing/screen.d.ts +0 -35
  669. package/dist/testing/wait-for.d.ts +0 -21
@@ -0,0 +1,27 @@
1
+ var ii=Object.defineProperty;var b=(e,t)=>ii(e,"name",{value:t,configurable:!0});import{createRequire as ri}from"node:module";import{jsxs as W,jsx as $}from"react/jsx-runtime";import{a as ct,x as ui}from"./constants-D12jy2Zh-RSfxu1eM.js";import{r as vt,c as gt,F as kt,a as li,l as ci,b as di,z as wt,V as hi,N as Mt,h as fi,P as Q,d as J,e as pi,f as mi}from"./erase-DKKNxHZ_.js";import{c as vi,e as gi,k as bi}from"./dom-CW6KYzFK.js";import{ConcurrentRoot as yi,LegacyRoot as wi}from"react-reconciler/constants.js";import H from"yoga-layout";import{a as xi}from"./accessibility-context-DDyHTwmA.js";import{h as Se,e as $e,g as Ce,o as $i}from"./mode-BOIU4Roy.js";import{PureComponent as Ci,useState as Tt,useRef as M,useCallback as x,useEffect as Dt,useMemo as z}from"react";import{e as Ti}from"./animation-context-DW3p-vpk.js";import{t as Ri}from"./app-context-BVpKlG1z.js";import{o as Oi}from"./cursor-context-CFviBqPX.js";import{Box as U}from"../components/box.js";import{Text as j}from"../components/text.js";import{o as Ni}from"./focus-context-CsT69klR.js";import{t as ki}from"./stderr-context-BzEaUICS.js";import{e as Ii}from"./stdin-context-BTaaFagk.js";import{t as Li}from"./stdout-context-BnblEPez.js";import{A as Di,B as _i,r as Bi,R as Ai}from"./renderer-C2ycheBL.js";import{resolveFlags as Wi}from"./kittyFlags-C3rZLbcK.js";import{a as Mi}from"./measure-text-D-jVetsl.js";import{L as _,u as ji}from"./reconciler-CGhHgXXG.js";import{measureAndExtractObservers as Ui}from"./ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as Hi}from"./getScrollHeight-ClEOyLHH.js";import{g as rt}from"./utils-THUhYKG2.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ const require = __cjs_mod__.createRequire(import.meta.url);
3
+ const si=ri(import.meta.url),ot=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yt=b(e=>{if(typeof ot<"u"&&ot.versions&&ot.versions.node){const[t,i]=ot.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return ot.getBuiltinModule(e)}return si(e)},"__cjs_getBuiltinModule"),B=ot,{env:Lt,cwd:ni}=B,{PassThrough:ue,Stream:oi}=yt("node:stream"),{Buffer:le}=yt("node:buffer"),{Console:ai}=yt("node:console"),{EventEmitter:Si}=yt("node:events"),{existsSync:Ei,readFileSync:Pi}=yt("node:fs");var Gi=Object.defineProperty,Ki=b((e,t)=>Gi(e,"name",{value:t,configurable:!0}),"r$3"),Fi=Object.defineProperty,qi=Ki((e,t)=>Fi(e,"name",{value:t,configurable:!0}),"t"),Yi=Object.defineProperty,Te=qi((e,t)=>Yi(e,"name",{value:t,configurable:!0}),"t");const Re=`${ct}?1049h`,Oe=`${ct}?1049l`;Te(()=>Re,"alternativeScreenOn");Te(()=>Oe,"alternativeScreenOff");kt(0,0)+vt(gt.ToEnd);`${li(ci.EntireLine)}${ct}`;const zi=`${ct}H${vt(gt.EntireScreen)}`;di?`${vt(gt.EntireScreen)}${ct}`:`${vt(gt.EntireScreen)}${vt(gt.EntireScreenAndScrollback)}${ct}${ui}`;var Vi=Object.defineProperty,Ji=b((e,t)=>Vi(e,"name",{value:t,configurable:!0}),"t$3");const ce=Ji(e=>e in Lt&&Lt[e]!=="0"&&Lt[e]!=="false","check"),Ee=ce("CI")||ce("CONTINUOUS_INTEGRATION");var Qi=Object.defineProperty,Xi=b((e,t)=>Qi(e,"name",{value:t,configurable:!0}),"s$1");const de=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"];let _t={};const Zi=Xi(e=>{const t=new ue,i=new ue;t.write=s=>{e("stdout",s)},i.write=s=>{e("stderr",s)};const r=new console.Console(t,i);for(const s of de)_t[s]=console[s],console[s]=r[s];return()=>{for(const s of de)console[s]=_t[s];_t={}}},"patchConsole"),ut=[];ut.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&ut.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ut.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var tr=Object.defineProperty,dt=b((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r$2");const Ot=dt(e=>!!e&&!0&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function","processOk"),Bt=Symbol.for("signal-exit emitter"),At=globalThis,er=Object.defineProperty.bind(Object);let ir=class{static{b(this,"y")}static{dt(this,"Emitter")}emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(At[Bt])return At[Bt];er(At,Bt,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,i){this.listeners[t].push(i)}removeListener(t,i){const r=this.listeners[t],s=r.indexOf(i);s!==-1&&(s===0&&r.length===1?r.length=0:r.splice(s,1))}emit(t,i,r){if(this.emitted[t])return!1;this.emitted[t]=!0;let s=!1;for(const n of this.listeners[t])s=n(i,r)===!0||s;return t==="exit"&&(s=this.emit("afterExit",i,r)||s),s}},Pe=class{static{b(this,"c")}static{dt(this,"SignalExitBase")}};const rr=dt(e=>({onExit(t,i){return e.onExit(t,i)},load(){return e.load()},unload(){return e.unload()}}),"signalExitWrap");class sr extends Pe{static{b(this,"_")}static{dt(this,"SignalExitFallback")}onExit(){return()=>{}}load(){}unload(){}}let nr=class extends Pe{static{b(this,"p")}static{dt(this,"SignalExit")}#o=jt.platform==="win32"?"SIGINT":"SIGHUP";#e=new ir;#t;#s;#n;#r={};#i=!1;constructor(t){super(),this.#t=t,this.#r={};for(const i of ut)this.#r[i]=()=>{const r=this.#t.listeners(i);let{count:s}=this.#e;const n=t;if(typeof n.__signal_exit_emitter__=="object"&&typeof n.__signal_exit_emitter__.count=="number"&&(s+=n.__signal_exit_emitter__.count),r.length===s){this.unload();const o=this.#e.emit("exit",null,i),u=i==="SIGHUP"?this.#o:i;o||t.kill(t.pid,u)}};this.#n=t.reallyExit,this.#s=t.emit}onExit(t,i){if(!Ot(this.#t))return()=>{};this.#i===!1&&this.load();const r=i?.alwaysLast?"afterExit":"exit";return this.#e.on(r,t),()=>{this.#e.removeListener(r,t),this.#e.listeners.exit.length===0&&this.#e.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#i){this.#i=!0,this.#e.count+=1;for(const t of ut)try{const i=this.#r[t];i&&this.#t.on(t,i)}catch{}this.#t.emit=(t,...i)=>this.#u(t,...i),this.#t.reallyExit=t=>this.#a(t)}}unload(){this.#i&&(this.#i=!1,ut.forEach(t=>{const i=this.#r[t];if(!i)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,i)}catch{}}),this.#t.emit=this.#s,this.#t.reallyExit=this.#n,this.#e.count-=1)}#a(t){return Ot(this.#t)?(this.#t.exitCode=t||0,this.#e.emit("exit",this.#t.exitCode,null),this.#n.call(this.#t,this.#t.exitCode)):0}#u(t,...i){const r=this.#s;if(t==="exit"&&Ot(this.#t)){typeof i[0]=="number"&&(this.#t.exitCode=i[0]);const s=r.call(this.#t,t,...i);return this.#e.emit("exit",this.#t.exitCode,null),s}else return r.call(this.#t,t,...i)}};const jt=globalThis.process,{onExit:or}=rr(Ot(jt)?new nr(jt):new sr);var ar=Object.defineProperty,L=b((e,t)=>ar(e,"name",{value:t,configurable:!0}),"i$3");const Ne="\x1B[200~",he="\x1B[201~",ur=L(e=>e>=48&&e<=63,"isCsiParameterByte"),lr=L(e=>e>=32&&e<=47,"isCsiIntermediateByte"),ke=L(e=>e>=64&&e<=126,"isCsiFinalByte"),cr=L((e,t,i)=>{const r=t+i+1;let s=r;for(;s<e.length;s++){const n=e.codePointAt(s);if(n===void 0)return"pending";if(!(ur(n)||lr(n))&&!(n===91&&s===r))return ke(n)?{nextIndex:s+1,sequence:e.slice(t,s+1)}:void 0}return"pending"},"parseCsiSequence"),dr=L((e,t,i)=>{const r=t+i+2;if(r>e.length)return"pending";const s=e.codePointAt(r-1);if(!(s===void 0||!ke(s)))return{nextIndex:r,sequence:e.slice(t,r)}},"parseSs3Sequence"),fe=L((e,t,i)=>{const r=e[t+i];if(r===void 0)return"pending";if(r==="[")return cr(e,t,i);if(r==="O")return dr(e,t,i)},"parseControlSequence"),hr=L((e,t)=>{const i=e.codePointAt(t+1),r=i!==void 0&&i>65535?2:1,s=t+1+r;return{nextIndex:s,sequence:e.slice(t,s)}},"parseEscapedCodePoint"),fr=L((e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const r=fe(e,t,2);return r==="pending"?"pending":r||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const i=fe(e,t,1);return i==="pending"?"pending":i||hr(e,t)},"parseEscapeSequence"),pe=L((e,t)=>{let i=0;for(let r=0;r<e.length;r++){const s=e[r];(s===""||s==="\b")&&(r>i&&t.push(e.slice(i,r)),t.push(s),i=r+1)}i<e.length&&t.push(e.slice(i))},"splitDeleteAndBackspace"),pr=L(e=>{const t=[];let i=0;const r=L(s=>({events:t,pending:e.slice(s)}),"pendingFrom");for(;i<e.length;){const s=e.indexOf("\x1B",i);if(s===-1)return pe(e.slice(i),t),{events:t,pending:""};s>i&&pe(e.slice(i,s),t);const n=fr(e,s);if(n==="pending")return r(s);if(n.sequence===Ne){const o=n.nextIndex,u=e.indexOf(he,o);if(u===-1)return r(s);t.push({paste:e.slice(o,u)}),i=u+he.length;continue}t.push(n.sequence),i=n.nextIndex}return{events:t,pending:""}},"parseKeypresses"),mr=L(()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(Ne)&&e!=="\x1B[200"},push(t){const i=pr(e+t);return e=i.pending,i.events},reset(){e=""}}},"createInputParser");var vr=Object.defineProperty,gr=b((e,t)=>vr(e,"name",{value:t,configurable:!0}),"x$1"),br=Object.defineProperty,yr=gr((e,t)=>br(e,"name",{value:t,configurable:!0}),"x"),wr=Object.defineProperty,G=yr((e,t)=>wr(e,"name",{value:t,configurable:!0}),"u");const X=G((e,...t)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${e}`,...t)},"debugLog"),Z="<unknown>",xr=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Sr=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,$r=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Cr=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Tr=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Rr=/in\s(.*)\s\(at\s(.+)\)\sat/,Or=/^(?:.*@)?(.*):(\d+):(\d+)$/,Er=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Pr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Nr=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,me=/\(error: (.*)\)/,kr=/at\s/,Ir=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Lr=/\S*(?:Error: |AggregateError:)/,Ie=/^Anonymous function$/,Dr=/^\s*in\s.*/,_r=/^.*?\s*at\s.*/,Br=/^.*?\s*@.*|\[native code\]/,Le=G((e,t)=>{const i=e.includes("safari-extension"),r=e.includes("safari-web-extension");return i||r?[e.includes("@")?e.split("@")[0]:Z,i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},"extractSafariExtensionDetails"),De=G((e,t)=>{const i=$r.exec(t);i&&(e.file=i[1],e.line=+i[2],e.column=+i[3])},"parseMapped"),Ar=G(e=>{const t=Rr.exec(e);if(t){X(`parse nested node error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const r=t[2].split(":");return{column:r[2]?+r[2]:void 0,file:r[0],line:r[1]?+r[1]:void 0,methodName:t[1]??Z,raw:e,type:void 0}}const i=Tr.exec(e);if(i){X(`parse node error stack line: "${e}"`,`found: ${JSON.stringify(i)}`);const r={column:i[4]?+i[4]:void 0,file:i[2]?i[2].replace(kr,""):void 0,line:i[3]?+i[3]:void 0,methodName:i[1]??Z,raw:e,type:e.startsWith("internal")?"internal":void 0};return De(r,`${i[2]}:${i[3]}:${i[4]}`),r}},"parseNode"),Wr=G(e=>{const t=xr.exec(e);if(t){X(`parse chrome error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const i=t[2]?.startsWith("native"),r=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let s,n;if(r){const l=Sr.exec(e);if(l){const f=Ir.exec(l[1]);f?(t[2]=f[4]??f[1],t[3]=f[5]??f[2],t[4]=f[3]):l[2]&&(t[2]=l[1]),l[2]&&(s={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const f=Cr.exec(e);f&&(n={column:f[4]?+f[4]:void 0,file:f[2],line:f[3]?+f[3]:void 0},s={column:f[6]?+f[6]:void 0,file:f[1],line:f[5]?+f[5]:void 0,methodName:"eval",raw:f[0],type:"eval"})}}const[o,u]=Le(t[1]?t[1].replace(Ie,"<anonymous>"):Z,t[2]),a={column:t[4]?+t[4]:void 0,evalOrigin:s,file:u,line:t[3]?+t[3]:void 0,methodName:o,raw:e,type:r?"eval":i?"native":void 0};return n?(a.column=n.column,a.file=n.file,a.line=n.line):De(a,`${u}:${t[3]}:${t[4]}`),a}},"parseChromium"),Mr=G((e,t)=>{const i=Er.exec(e);if(i){X(`parse gecko error stack line: "${e}"`,`found: ${JSON.stringify(i)}`);const r=i[3]?.includes(" > eval"),s=r&&i[3]&&Pr.exec(i[3]);let n;r&&s&&(i[3]=s[1],n={column:i[5]?+i[5]:void 0,file:i[3],line:i[4]?+i[4]:void 0,methodName:"eval",raw:e,type:"eval"},i[4]=s[2]);const[o,u]=Le(i[1]?i[1].replace(Ie,"<anonymous>"):Z,i[3]);let a;(t?.type==="safari"||!r&&t?.type==="firefox")&&t.column?a=t.column:!r&&i[5]&&(a=+i[5]);let l;return(t?.type==="safari"||!r&&t?.type==="firefox")&&t.line?l=t.line:i[4]&&(l=+i[4]),{column:a,evalOrigin:n,file:u,line:l,methodName:o,raw:e,type:r?"eval":u.includes("[native code]")?"native":void 0}}},"parseGecko"),jr=G((e,t)=>{const i=Nr.exec(e);if(!(i&&i[2].includes(" > eval"))&&i)return X(`parse firefox error stack line: "${e}"`,`found: ${JSON.stringify(i)}`),{column:i[4]?+i[4]:t?.column??void 0,file:i[2],line:i[3]?+i[3]:t?.line??void 0,methodName:i[1]||Z,raw:e,type:void 0}},"parseFirefox"),Ur=G(e=>{const t=Or.exec(e);if(t)return X(`parse react android native error stack line: "${e}"`,`found: ${JSON.stringify(t)}`),{column:t[3]?+t[3]:void 0,file:t[1],line:t[2]?+t[2]:void 0,methodName:Z,raw:e,type:void 0}},"parseReactAndroidNative"),Hr=G((e,{filter:t,frameLimit:i=50}={})=>{const r=e;let s=(typeof r.stacktrace=="string"?r.stacktrace:e.stack??"").split(`
4
+ `).map(n=>(me.test(n)?n.replace(me,"$1"):n).trim()).filter(n=>!Lr.test(n)&&n!=="eval code");return t&&(s=s.filter(n=>t(n))),s=s.slice(0,i),s.reduce((n,o,u)=>{if(!o||o.length>1024)return n;let a;if(Dr.test(o))a=Ar(o);else if(_r.test(o))a=Wr(o);else if(Br.test(o)){let l;if(u===0){const f=e,S=f.columnNumber,v=f.lineNumber,d=f.line,h=f.column;S||v?l={column:S,line:v,type:"firefox"}:(d||h)&&(l={column:h,line:d,type:"safari"})}a=jr(o,l)??Mr(o,l)}else a=Ur(o);return a?n.push(a):X(`parse error stack line: "${o}"`,"not parser found"),n},[])},"parseStacktrace");var Gr=Object.defineProperty,Kr=b((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"r$1");const Fr=Kr((e,t=2)=>e.replace(/^\t+/gm,i=>" ".repeat(i.length*t)),"convertToSpaces");var qr=Object.defineProperty,_e=b((e,t)=>qr(e,"name",{value:t,configurable:!0}),"i$2");const Yr=_e((e,t)=>{const i=[],r=e-t,s=e+t;for(let n=r;n<=s;n++)i.push(n);return i},"generateLineNumbers"),zr=_e((e,t,i={})=>{var r;if(typeof e!="string")throw new TypeError("Source code is missing.");if(!t||t<1)throw new TypeError("Line number must start from `1`.");const s=Fr(e).split(/\r?\n/);if(!(t>s.length))return Yr(t,(r=i.around)!==null&&r!==void 0?r:3).filter(n=>s[n-1]!==void 0).map(n=>({line:n,value:s[n-1]}))},"codeExcerpt");var Vr=Object.defineProperty,Be=b((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"x");const ve=Be(e=>{if(!e)return e;const t=ni();return e.replace(`file://${t}/`,"").replace(`${t}/`,"")},"cleanupPath");function Ae({error:e}){const t=Hr(e),i=t[0],r=ve(i?.file);let s,n=0;if(r&&i?.line&&Ei(r)){const o=Pi(r,"utf8");if(s=zr(o,i.line),s)for(const{line:u}of s)n=Math.max(n,String(u).length)}return W(U,{flexDirection:"column",padding:1,children:[W(U,{children:[W(j,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),W(j,{children:[" ",e.message]})]}),i&&r?$(U,{marginTop:1,children:W(j,{dimColor:!0,children:[r,":",i.line,":",i.column]})}):null,i&&s?$(U,{flexDirection:"column",marginTop:1,children:s.map(({line:o,value:u},a)=>W(U,{children:[$(U,{width:n+1,children:W(j,{"aria-label":o===i.line?`Line ${o}, error`:`Line ${o}`,backgroundColor:o===i.line?"red":void 0,color:o===i.line?"white":void 0,dimColor:o!==i.line,children:[String(o).padStart(n," "),":"]})}),$(j,{backgroundColor:o===i.line?"red":void 0,color:o===i.line?"white":void 0,children:` ${u}`})]},a))}):null,t.length>0?$(U,{flexDirection:"column",marginTop:1,children:t.map((o,u)=>{const a=ve(o.file)??"";return!o.methodName&&!o.file?W(U,{children:[$(j,{dimColor:!0,children:"- "}),$(j,{bold:!0,dimColor:!0,children:o.raw})]},u):W(U,{children:[$(j,{dimColor:!0,children:"- "}),$(j,{bold:!0,dimColor:!0,children:o.methodName??"<anonymous>"}),W(j,{"aria-label":`at ${a} line ${o.line} column ${o.column}`,color:"gray",dimColor:!0,children:[" ","(",a,":",o.line,":",o.column,")"]})]},u)})}):null]})}b(Ae,"B$1");Be(Ae,"ErrorOverview");var Jr=Object.defineProperty,Qr=b((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"o$1");let Xr=class extends Ci{static{b(this,"i")}static{Qr(this,"ErrorBoundary")}static displayName="InternalErrorBoundary";static getDerivedStateFromError(t){return{error:t}}state={error:void 0};componentDidCatch(t){this.props.onError(t)}render(){return this.state.error?$(Ae,{error:this.state.error}):this.props.children}};var Zr=Object.defineProperty,ge=b((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"J");const ts=" ",es="\x1B[Z",is="\x1B",rs=Se($e),be=Ce($e),We=ge(({children:e,exitOnCtrlC:t,interactive:i,onExit:r,onWaitUntilRenderFlush:s,renderThrottleMs:n,setCursorPosition:o,stderr:u,stdin:a,stdout:l,writeToStderr:f,writeToStdout:S})=>{const[v,d]=Tt(!0),[h,y]=Tt(void 0),[,w]=Tt([]),k=M(0),T=M(new Map),D=M(void 0),I=M(0),A=M(!1),P=M(0),[E]=Tt(()=>{const c=new Si;return c.setMaxListeners(1/0),c}),Y=M(void 0),O=M(void 0);O.current??=mr();const K=M(void 0),Ft=M(!1),qe=20,tt=x(()=>{K.current&&(clearTimeout(K.current),K.current=void 0)},[]),et=x(()=>{D.current&&(clearTimeout(D.current),D.current=void 0)},[]),xt=x(()=>{if(et(),T.current.size===0)return;let c=Number.POSITIVE_INFINITY;for(const p of T.current.values())c=Math.min(c,p.nextDueTime);const m=Math.max(0,c-performance.now());D.current=setTimeout(()=>{D.current=void 0;const p=performance.now(),C=[...T.current.values()];for(const N of C){if(p<N.nextDueTime)continue;N.callback(p);const ti=p-N.startTime,ei=Math.floor(ti/N.interval)+1;N.nextDueTime=N.startTime+ei*N.interval}xt()},m)},[et]),qt=x((c,m)=>{const p=performance.now();return T.current.set(c,{callback:c,interval:m,nextDueTime:p+m,startTime:p}),xt(),{startTime:p,unsubscribe(){if(T.current.delete(c),T.current.size===0){et();return}xt()}}},[et,xt]);Dt(()=>()=>{et()},[et]);const F=a.isTTY,Yt=x(()=>{Y.current&&(a.removeListener("readable",Y.current),Y.current=void 0)},[a]),St=x(()=>{O.current?.reset(),tt(),Yt()},[tt,Yt]),it=x(()=>{A.current=!1,a.setRawMode(!1),a.unref(),I.current=0,St()},[a,St]),ft=x(c=>{F&&(I.current>0||A.current)&&it(),r(c)},[F,it,r]),zt=x(c=>{if(c.includes("")&&t){ft();return}c===is&&v&&y(m=>{if(!m)return m})},[t,ft,v]),pt=x(c=>{zt(c),E.emit("input",c)},[zt,E]),Vt=x(()=>{tt(),K.current=setTimeout(()=>{K.current=void 0;const c=O.current.flushPendingEscape();c&&pt(c)},qe)},[tt,pt]),It=x(()=>{tt();let c;for(;(c=a.read())!==null;){const m=O.current.push(c);for(const p of m)if(typeof p=="string")pt(p);else{if(E.listenerCount("paste")===0){Ft.current||(Ft.current=!0,f(`Warning: useInput() received bracketed paste because no usePaste() handler is active. This fallback is deprecated and will be removed in the next major version. Migrate paste handling to usePaste().
5
+ `)),pt(p.paste);continue}E.emit("paste",p.paste)}}O.current.hasPendingEscape()&&Vt()},[a,pt,tt,Vt,f,E]),Jt=x(()=>{Y.current||(Y.current=It,a.addListener("readable",It))},[a,It]),Qt=x(c=>{if(!F)throw a===B.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
6
+ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
7
+ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(a.setEncoding("utf8"),c){if(I.current===0){const m=A.current;A.current=!1,m||(a.ref(),a.setRawMode(!0)),Jt()}I.current++;return}I.current!==0&&--I.current===0&&(St(),A.current=!0,queueMicrotask(()=>{A.current&&it()}))},[F,a,Jt,St,it]),Xt=x(c=>{if(l.isTTY){if(c){P.current===0&&l.write(rs),P.current++;return}P.current!==0&&--P.current===0&&l.write(be)}},[l]),Zt=x((c,m)=>{const p=c.findIndex(C=>C.id===m);for(let C=p+1;C<c.length;C++){const N=c[C];if(N?.isActive)return N.id}},[]),te=x((c,m)=>{const p=c.findIndex(C=>C.id===m);for(let C=p-1;C>=0;C--){const N=c[C];if(N?.isActive)return N.id}},[]),$t=x(()=>{w(c=>(y(m=>{const p=c.find(C=>C.isActive)?.id;return Zt(c,m)??p}),c))},[Zt]),Ct=x(()=>{w(c=>(y(m=>{const p=c.findLast(C=>C.isActive)?.id;return te(c,m)??p}),c))},[te]);Dt(()=>{const c=ge(p=>{!v||k.current===0||(p===ts&&$t(),p===es&&Ct())},"handleTabNavigation");E.on("input",c);const m=E;return()=>{m.off("input",c)}},[v,$t,Ct,E]);const ee=x(()=>{d(!0)},[]),ie=x(()=>{d(!1)},[]),re=x(c=>{w(m=>(m.some(p=>p?.id===c)&&y(c),m))},[]),se=x((c,{autoFocus:m})=>{w(p=>(k.current=p.length+1,[...p,{id:c,isActive:!0}])),m&&y(p=>p||c)},[]),ne=x(c=>{y(m=>{if(m!==c)return m}),w(m=>{const p=m.filter(C=>C.id!==c);return k.current=p.length,p})},[]),oe=x(c=>{w(m=>m.map(p=>p.id!==c?p:{id:c,isActive:!0}))},[]),ae=x(c=>{y(m=>{if(m!==c)return m}),w(m=>m.map(p=>p.id!==c?p:{id:c,isActive:!1}))},[]);Dt(()=>()=>{const c=!l.destroyed&&!l.writableEnded;i&&c&&l.write(wt),F&&(I.current>0||A.current)&&it(),P.current>0&&(l.isTTY&&c&&l.write(be),P.current=0)},[l,F,it,i]);const Ye=z(()=>({exit:ft,waitUntilRenderFlush:s}),[ft,s]),ze=z(()=>({internal_eventEmitter:E,internal_exitOnCtrlC:t,isRawModeSupported:F,setBracketedPasteMode:Xt,setRawMode:Qt,stdin:a}),[a,Qt,Xt,F,t,E]),Ve=z(()=>({stdout:l,write:S}),[l,S]),Je=z(()=>({stderr:u,write:f}),[u,f]),Qe=z(()=>({setCursorPosition:o}),[o]),Xe=z(()=>({activate:oe,activeId:h,add:se,deactivate:ae,disableFocus:ie,enableFocus:ee,focus:re,focusNext:$t,focusPrevious:Ct,remove:ne}),[h,se,ne,oe,ae,ee,ie,$t,Ct,re]),Ze=z(()=>({renderThrottleMs:n,subscribe:qt}),[qt,n]);return $(Ri.Provider,{value:Ye,children:$(Ii.Provider,{value:ze,children:$(Li.Provider,{value:Ve,children:$(ki.Provider,{value:Je,children:$(Ni.Provider,{value:Xe,children:$(Ti.Provider,{value:Ze,children:$(Oi.Provider,{value:Qe,children:$(Xr,{onError:ft,children:e})})})})})})})})},"App");We.displayName="InternalApp";var ss=Object.defineProperty,ns=b((e,t)=>ss(e,"name",{value:t,configurable:!0}),"m$2");const os=ns((e,t,i)=>{if(i<=0||!e.yogaNode)return"";const{yogaNode:r}=e,s=r.getComputedBorder(H.EDGE_LEFT),n=r.getComputedBorder(H.EDGE_RIGHT),o=r.getComputedBorder(H.EDGE_TOP),u=r.getComputedPadding(H.EDGE_LEFT),a=r.getComputedPadding(H.EDGE_RIGHT),l=r.getComputedPadding(H.EDGE_TOP),f=Math.round(r.getComputedWidth()-s-n-u-a);if(f<=0)return"";const S=new Di({height:i,width:f}),v=-(e.internal_scrollState?.scrollLeft??0)-s-u,d=-t-o-l;for(const h of e.childNodes)_i(h,S,{absoluteOffsetX:v,absoluteOffsetY:d,offsetX:v,offsetY:d,skipStaticElements:!1});return S.get().output},"composeBackbufferSlice"),Ut=new WeakMap;var as=Object.defineProperty,ht=b((e,t)=>as(e,"name",{value:t,configurable:!0}),"e");const us={bar:6,"blinking-bar":5,"blinking-block":1,"blinking-underline":3,block:2,default:0,underline:4},ye=ht(e=>hi(us[e]),"buildCursorShapeSequence"),Et=ht((e,t)=>e?.x!==t?.x||e?.y!==t?.y,"cursorPositionChanged"),lt=ht((e,t)=>{if(!t)return"";const i=e-t.y;return(i>0?Mt(i):"")+kt(t.x)+wt},"buildCursorSuffix"),Me=ht((e,t)=>{if(!t)return"";const i=e-1-t.y;return(i>0?fi(i):"")+kt(0)},"buildReturnToBottom"),je=ht(e=>{const t=e.cursorWasShown?Q:"",i=Me(e.previousLineCount,e.previousCursorPosition),r=lt(e.visibleLineCount,e.cursorPosition);return t+i+r},"buildCursorOnlySequence"),Pt=ht((e,t,i)=>e?Q+Me(t,i):"","buildReturnToBottomPrefix");var ls=Object.defineProperty,R=b((e,t)=>ls(e,"name",{value:t,configurable:!0}),"l");const st=R(e=>e??"default","normalizeShape"),Ue=R(()=>{let e,t;return{consumeDelta:R(()=>{if(st(t)===st(e))return"";const i=st(t);return e=t,ye(i)},"consumeDelta"),consumeRestoreOnDone:R(()=>{const i=st(e)!=="default";return e=void 0,t=void 0,i?ye("default"):""},"consumeRestoreOnDone"),isDirty:R(()=>st(t)!==st(e),"isDirty"),setPending:R(i=>{t=i},"setPending")}},"createCursorShapeTracker"),bt=R((e,t)=>t.endsWith(`
8
+ `)?e.length-1:e.length,"visibleLineCount"),He=R(e=>e.rows||1/0,"getViewportRows"),Nt=R((e,t)=>Math.min(e,He(t)),"clampToViewport"),cs=R((e,{showCursor:t=!1}={})=>{let i=0,r="",s=!1,n,o=!1,u,a=!1;const l=Ue(),f=R(()=>o?n:void 0,"getActiveCursor"),S=R((d,h)=>{const y=Et(h,u);return d!==r||y||l.isDirty()},"hasChanges"),v=R(d=>{!t&&!s&&(e.write(Q),s=!0);const h=f();o=!1;const y=Et(h,u);if(!S(d,h))return!1;const w=l.consumeDelta(),k=d.split(`
9
+ `),T=bt(k,d),D=lt(T,h);if(d===r&&y)e.write(w+je({cursorPosition:h,cursorWasShown:a,previousCursorPosition:u,previousLineCount:i,visibleLineCount:T}));else if(d===r&&w!=="")e.write(w);else{r=d;const I=Pt(a,i,u);e.write(w+I+J(Nt(i,e))+d+D),i=k.length}return u=h?{...h}:void 0,a=h!==void 0,!0},"render");return v.clear=()=>{const d=Pt(a,i,u);e.write(d+J(Nt(i,e))),r="",i=0,u=void 0,a=!1},v.done=()=>{r="",i=0,u=void 0,a=!1;const d=l.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(wt),s=!1)},v.reset=()=>{r="",i=0,u=void 0,a=!1},v.sync=d=>{const h=o?n:void 0;o=!1;const y=d.split(`
10
+ `);r=d,i=y.length;const w=l.consumeDelta();w!==""&&e.write(w),!h&&a&&e.write(Q),h&&e.write(lt(bt(y,d),h)),u=h?{...h}:void 0,a=h!==void 0},v.setCursorPosition=d=>{n=d,o=!0},v.setCursorShape=l.setPending,v.isCursorDirty=()=>o||l.isDirty(),v.willRender=d=>S(d,f()),v},"createStandard"),ds=R((e,{showCursor:t=!1}={})=>{let i=[],r="",s=!1,n,o=!1,u,a=!1;const l=Ue(),f=R(()=>o?n:void 0,"getActiveCursor"),S=R((d,h)=>{const y=Et(h,u);return d!==r||y||l.isDirty()},"hasChanges"),v=R(d=>{!t&&!s&&(e.write(Q),s=!0);const h=f();o=!1;const y=Et(h,u);if(!S(d,h))return!1;const w=l.consumeDelta(),k=d.split(`
11
+ `),T=bt(k,d),D=bt(i,r);if(d===r&&y)return e.write(w+je({cursorPosition:h,cursorWasShown:a,previousCursorPosition:u,previousLineCount:i.length,visibleLineCount:T})),u=h?{...h}:void 0,a=h!==void 0,!0;if(d===r&&w!=="")return e.write(w),!0;const I=Pt(a,i.length,u);if(d===`
12
+ `||r.length===0){const O=lt(T,h);return e.write(w+I+J(Nt(i.length,e))+d+O),a=h!==void 0,u=h?{...h}:void 0,r=d,i=k,!0}const A=d.endsWith(`
13
+ `),P=[w,I],E=He(e);if(T<D){const O=r.endsWith(`
14
+ `)?1:0;P.push(J(Math.min(D-T+O,E)),Mt(Math.min(T,E-1)))}else P.push(Mt(Math.min(D-1,E-1)));for(let O=0;O<T;O++){const K=O===T-1;if(k[O]===i[O]){(!K||A)&&P.push(pi());continue}P.push(kt(0)+k[O]+mi+(K&&!A?"":`
15
+ `))}const Y=lt(T,h);return P.push(Y),e.write(P.join("")),a=h!==void 0,u=h?{...h}:void 0,r=d,i=k,!0},"render");return v.clear=()=>{const d=Pt(a,i.length,u);e.write(d+J(Nt(i.length,e))),r="",i=[],u=void 0,a=!1},v.done=()=>{r="",i=[],u=void 0,a=!1;const d=l.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(wt),s=!1)},v.reset=()=>{r="",i=[],u=void 0,a=!1},v.sync=d=>{const h=o?n:void 0;o=!1;const y=d.split(`
16
+ `);r=d,i=y;const w=l.consumeDelta();w!==""&&e.write(w),!h&&a&&e.write(Q),h&&e.write(lt(bt(y,d),h)),u=h?{...h}:void 0,a=h!==void 0},v.setCursorPosition=d=>{n=d,o=!0},v.setCursorShape=l.setPending,v.isCursorDirty=()=>o||l.isDirty(),v.willRender=d=>S(d,f()),v},"createIncremental"),hs=R((e,{incremental:t=!1,showCursor:i=!1}={})=>t?ds(e,{showCursor:i}):cs(e,{showCursor:i}),"create"),fs={create:hs};var ps=Object.defineProperty,ms=b((e,t)=>ps(e,"name",{value:t,configurable:!0}),"t");const Ge=$i(2026),V=Se(Ge),q=Ce(Ge);function Ke(e,t){return"isTTY"in e&&e.isTTY&&(t??!Ee)}b(Ke,"shouldSynchronize");ms(Ke,"shouldSynchronize");var vs=Object.defineProperty,Ht=b((e,t)=>vs(e,"name",{value:t,configurable:!0}),"o");let nt;const gs=Ht(()=>{if(nt!==!1){if(nt!==void 0)return nt;try{return nt=require("../../index.js").Renderer,nt}catch{nt=!1;return}}},"getRendererClass"),bs=Ht(e=>{const t=gs();if(!t)return;let i,r=0,s=0;const n=Ht((o,u)=>{(!i||r!==o||s!==u)&&(i?i.resize(o,u):i=new t(o,u),r=o,s=u)},"ensureRenderer");return{clear(){if(i){const o=new Uint32Array(r*s*2),u=65535;for(let a=0;a<o.length;a+=2)o[a]=32,o[a+1]=u;i.render(o)}},destroy(){i=void 0},render(o,u,a){if(n(u,a),!!i){e.isTTY&&i.writeRaw(V);try{i.render(o)}finally{e.isTTY&&i.writeRaw(q)}}},resize(o,u){n(o,u)}}},"createNative");var ys=Object.defineProperty,at=b((e,t)=>ys(e,"name",{value:t,configurable:!0}),"n$1");function Gt(e,t=0,i={}){const r=i.leading??!0,s=i.trailing??!0;let n,o,u,a;const l=at(()=>{if(o===void 0)return;const h=o;o=void 0,a=e(...h)},"invoke"),f=at(()=>{n!==void 0&&(clearTimeout(n),n=void 0)},"clearTimer"),S=at(()=>{n=void 0,s&&l(),o=void 0,u=void 0},"onTimerEnd"),v=at(()=>{f(),n=setTimeout(S,t)},"scheduleTimer"),d=at(function(...h){const y=Date.now();if(u??=y,y-u>=t)return o=h,l(),u=y,v(),a;o=h;const w=n===void 0;return v(),r&&w&&l(),a},"throttled");return d.cancel=()=>{f(),o=void 0,u=void 0},d.flush=()=>(f(),l(),u=void 0,a),d}b(Gt,"throttle");at(Gt,"throttle");var ws=Object.defineProperty,g=b((e,t)=>ws(e,"name",{value:t,configurable:!0}),"n");console.Console||(console.Console=ai);const mt=g(()=>{},"noop"),we=g(async()=>new Promise(e=>{setImmediate(e)}),"yieldImmediate"),xs=27,Ss=91,$s=63,Cs=117,Ts=48,Rs=57,Os=g(e=>e>=Ts&&e<=Rs,"isDigitByte"),Fe=g((e,t)=>{if(e[t]!==xs||e[t+1]!==Ss||e[t+2]!==$s)return;let i=t+3;const r=i;for(;i<e.length&&Os(e[i]);)i++;if(i!==r){if(i===e.length)return{state:"partial"};if(e[i]===Cs)return{endIndex:i,state:"complete"}}},"matchKittyQueryResponse"),Es=g(e=>{for(let t=0;t<e.length;t++)if(Fe(e,t)?.state==="complete")return!0;return!1},"hasCompleteKittyQueryResponse"),Ps=g(e=>{const t=[];let i=0;for(;i<e.length;){const r=Fe(e,i);if(r?.state==="complete"){i=r.endIndex+1;continue}if(r?.state==="partial")break;t.push(e[i]),i++}return t},"stripKittyQueryResponsesAndTrailingPartial"),Ns=g(({isTty:e,isUnmounting:t,nextOutputHeight:i,previousOutputHeight:r,viewportRows:s})=>{if(!e)return!1;const n=r>0,o=r>=s,u=r>s,a=i>s,l=o&&i<s;return u||a&&n||l||t&&o},"shouldClearTerminalForFrame"),Wt=g(e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]","isErrorInput"),xe=g(e=>{const t=!e.destroyed&&!e.writableEnded&&(e.writable??!0),i=e._writableState!==void 0||e.writableLength!==void 0;return{canWriteToStdout:t,hasWritableState:i}},"getWritableStreamState"),Rt=g((e,t)=>{if(!e||typeof e.flush!="function")return;const i=e;t?i.flush():typeof i.cancel=="function"&&i.cancel()},"settleThrottle");class ks{static{b(this,"yt")}static{g(this,"Ink")}isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;backbufferNode;backbufferMultiWarned=!1;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=vi("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??B.env.INK_SCREEN_READER==="true",this.interactive=this.resolveInteractiveOption(t.interactive),this.alternateScreen=!1;const i=t.debug||this.isScreenReaderEnabled,r=t.maxFps??30,s=r>0?Math.max(1,Math.ceil(1e3/r)):0;this.renderThrottleMs=i?0:s;const n=i?this.onRender:(()=>{const u=Gt(this.onRender,s,{leading:!0,trailing:!0});return this.throttledOnRender=u,()=>{this.hasPendingThrottledRender=!0,u()}})();if(i&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let u=!1;const a=g(()=>{u||(u=!0,queueMicrotask(()=>{u=!1,this.onRender()}))},"deferredRender");this.rootNode.onRender=a,this.rootNode.onImmediateRender=a}else this.rootNode.onRender=n,this.rootNode.onImmediateRender=this.onRender;this.rootNode.onStaticChange=this.handleStaticChange,this.log=fs.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=bs(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=i?this.log:Gt(u=>{const a=this.log.willRender(u),l=this.shouldSync();l&&a&&this.options.stdout.write(V),this.log(u),l&&a&&this.options.stdout.write(q)},void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.isUnmounting=!1,this.isConcurrent=t.concurrent??!1,this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.lastTerminalWidth=rt(this.options.stdout).columns,this.fullStaticOutput="";const o=t.concurrent?yi:wi;this.container=_.createContainer(this.rootNode,o,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=or(this.unmount,{alwaysLast:!1}),this.setAlternateScreen(!!t.alternateScreen),t.patchConsole&&this.patchConsole(),this.interactive&&(t.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{t.stdout.off("resize",this.resized)}),this.initImmediateKittyKeyboard(),B.env.DEV==="true"&&_.injectIntoDevTools(),this.exitPromise=new Promise((u,a)=>{this.resolveExitPromise=u,this.rejectExitPromise=a}),this.exitPromise.catch(mt)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=g(()=>{const t=rt(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),Mi(),this.calculateLayout(),gi(this.rootNode),this.onRender(),this.lastTerminalWidth=t},"resized");resolveExitPromise=g(()=>{},"resolveExitPromise");rejectExitPromise=g(()=>{},"rejectExitPromise");unsubscribeExit=g(()=>{},"unsubscribeExit");handleAppExit=g(t=>{if(!(this.isUnmounted||this.isUnmounting)){if(Wt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}},"handleAppExit");getActiveCursorPosition=g(()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition,"getActiveCursorPosition");setCursorPosition=g(t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())},"setCursorPosition");restoreLastOutput=g(()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
17
+ `))},"restoreLastOutput");calculateLayout=g(()=>{const t=g(r=>{const s=new Map;this.calculateScrollAndTriggerObservers(r,s);for(const[n,o]of s)n.internalTrigger(o)},"flushLayoutObservers");this.backbufferNode=void 0,this.prepareYogaTree(this.rootNode,t);const i=rt(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(i),this.rootNode.yogaNode.calculateLayout(void 0,void 0,H.DIRECTION_LTR),t(this.rootNode)},"calculateLayout");calculateScrollAndTriggerObservers(t,i){if(t.nodeName==="ink-box"){const{style:r}=t,s=r.overflow??"visible",n=r.overflowX??s,o=r.overflowY??s;n==="scroll"||o==="scroll"?(Hi(t),r.overflowToBackbuffer&&(this.backbufferNode&&this.backbufferNode!==t&&!this.backbufferMultiWarned&&(this.backbufferMultiWarned=!0,console.warn("[@visulima/tui] Multiple scrollable regions have `overflowToBackbuffer` enabled; only one is supported. The last one in render order wins.")),this.backbufferNode=t)):t.internal_scrollState&&delete t.internal_scrollState}if(Ui(t,i),!t.internal_static)for(const r of t.childNodes)r.nodeName!=="#text"&&this.calculateScrollAndTriggerObservers(r,i)}recalculateLayout(){this.markAllTextNodesDirty(this.rootNode),this.calculateLayout(),this.onRender()}prepareYogaTree(t,i){if(t.isYogaTreeDetached&&!t.cachedRender&&t.yogaNode){for(t.yogaNode.setWidthAuto(),t.yogaNode.setHeightAuto(),ji(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let r=0;for(const s of t.childNodes){const n=s;s.nodeName!=="#text"&&n.yogaNode&&(t.yogaNode.insertChild(n.yogaNode,r),r++)}t.isYogaTreeDetached=!1,this.markAllTextNodesDirty(t)}for(const r of t.childNodes)r.nodeName!=="#text"&&this.prepareYogaTree(r,i);if(t.nodeName==="ink-static-render"&&!t.cachedRender){const r=rt(this.options.stdout).columns,{width:s}=t.style;t.yogaNode&&(t.yogaNode.setWidth(typeof s=="number"?s:r),t.yogaNode.calculateLayout(void 0,void 0,H.DIRECTION_LTR)),i(t),Bi(t,{skipStaticElements:!1,trackSelection:this.options.trackSelection}),t.internal_onRendered?.()}}markAllTextNodesDirty(t){if(!t.cachedRender){t.nodeName==="ink-text"&&t.yogaNode&&t.yogaNode.markDirty();for(const i of t.childNodes)i.nodeName!=="#text"&&this.markAllTextNodesDirty(i)}}handleStaticChange=g(()=>{this.fullStaticOutput=""},"handleStaticChange");computeBackbufferOutput(){const t=this.backbufferNode;if(!t?.internal_scrollState||!this.interactive||!this.options.stdout.isTTY||this.alternateScreen||this.isScreenReaderEnabled||this.options.debug)return"";const i=Math.round(t.internal_scrollState.scrollTop),r=t.yogaNode?.getComputedPadding(H.EDGE_TOP)??0,s=Math.max(0,i-Math.round(r)),n=t.internal_maxPushedScrollTop??0,{maxScrollbackLength:o}=t.style,u=o===void 0?n:Math.max(n,s-Math.max(0,o)),a=s-u;if(a<=0)return"";const l=os(t,u,a);return l===""?"":(t.internal_maxPushedScrollTop=s,`${l}\x1B[0m
18
+ `)}onRender=g(()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=Ai(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:i,cursorRequested:r,cursorShape:s,output:n,outputBuffer:o,outputHeight:u,outputWidth:a,staticOutput:l}=t;this.renderedCursorRequested=r,this.renderedCursorPosition=i,this.log.setCursorShape(r?s:void 0);const f=this.computeBackbufferOutput();if(this.useNativeRenderer&&this.nativeLog&&o&&a){l&&l!==`
19
+ `&&this.options.stdout.write(l),f&&this.options.stdout.write(f),this.nativeLog.render(o,a,u),this.lastOutputHeight=u;return}r&&this.log.setCursorPosition(this.getActiveCursorPosition());const S=l&&l!==`
20
+ `;if(this.options.debug){S&&(this.fullStaticOutput+=l),this.lastOutput=n,this.lastOutputToRender=n,this.lastOutputHeight=u,this.options.stdout.write(this.fullStaticOutput+n);return}if(!this.interactive){S&&this.options.stdout.write(l),this.lastOutput=n,this.lastOutputToRender=`${n}
21
+ `,this.lastOutputHeight=u;return}if(this.isScreenReaderEnabled){const v=this.shouldSync();if(v&&this.options.stdout.write(V),S){const y=this.lastOutputHeight>0?J(this.lastOutputHeight):"";this.options.stdout.write(y+l),this.lastOutputHeight=0}if(n===this.lastOutput&&!S){v&&this.options.stdout.write(q);return}const d=rt(this.options.stdout).columns,h=bi(n,{trim:!1,width:d,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(S)this.options.stdout.write(h);else{const y=this.lastOutputHeight>0?J(this.lastOutputHeight):"";this.options.stdout.write(y+h)}this.lastOutput=n,this.lastOutputToRender=h,this.lastOutputHeight=h===""?0:h.split(`
22
+ `).length,v&&this.options.stdout.write(q);return}S&&(this.fullStaticOutput+=l),this.renderInteractiveFrame(n,u,S?l:"",f)},"onRender");accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const i=$(xi.Provider,{value:this.accessibilityContextValue,children:$(We,{exitOnCtrlC:this.options.exitOnCtrlC,interactive:this.interactive,onExit:this.handleAppExit,onWaitUntilRenderFlush:this.waitUntilRenderFlush,renderThrottleMs:this.renderThrottleMs,setCursorPosition:this.setCursorPosition,stderr:this.options.stderr,stdin:this.options.stdin,stdout:this.options.stdout,writeToStderr:this.writeToStderr,writeToStdout:this.writeToStdout,children:t})});this.options.concurrent?_.updateContainer(i,this.container,null,mt):(_.updateContainerSync(i,this.container,null,mt),_.flushSyncWork())}writeToStdout=g(t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stdout.write(t+this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stdout.write(t);return}const i=this.shouldSync();i&&this.options.stdout.write(V),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(q)},"writeToStdout");writeToStderr=g(t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stderr.write(t),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stderr.write(t);return}const i=this.shouldSync();i&&this.options.stdout.write(V),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(q)},"writeToStderr");unmount=g(t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(B.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const i=this.options.stdout,{canWriteToStdout:r,hasWritableState:s}=xe(i);Rt(this.throttledOnRender,r),r&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),Rt(this.throttledLog,r),typeof this.restoreConsole=="function"&&this.restoreConsole();const n=g(()=>{typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),this.cancelKittyDetection&&this.cancelKittyDetection(),r&&(this.kittyProtocolEnabled&&this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.alternateScreen?(this.log.clear(),this.log.done(),this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.fullStaticOutput="",this.writeBestEffort(this.options.stdout,Oe),this.writeBestEffort(this.options.stdout,wt),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
23
+ `:`${this.lastOutput}
24
+ `)),this.kittyProtocolEnabled=!1,Ut.delete(this.options.stdout);const{exitResult:u}=this,a=g(()=>{Wt(t)?this.rejectExitPromise(t):this.resolveExitPromise(u)},"resolveOrReject");t!==void 0&&!Wt(t)?a():r&&s?this.options.stdout.write("",a):setImmediate(a)},"finishUnmount"),o=_;this.options.concurrent?(_.updateContainerSync(null,this.container,null,mt),_.flushSyncWork(),o.flushPassiveEffects?.(),n()):(_.updateContainerSync(null,this.container,null,mt),_.flushSyncWork(),n())},"unmount");async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},B.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await we(),this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(this.isConcurrent&&this.hasPendingConcurrentWork()&&(await Promise.race([this.awaitNextRender(),this.awaitExit()]),this.isUnmounted||this.isUnmounting)){this.nextRenderCommit=void 0,await this.awaitExit();return}_.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:i,hasWritableState:r}=xe(t);if(Rt(this.throttledOnRender,i),Rt(this.throttledLog,i),i&&r){await new Promise(s=>{this.options.stdout.write("",()=>{s()})});return}await we()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
25
+ `))}patchConsole(){this.options.debug||(this.restoreConsole=Zi((t,i)=>{t==="stdout"&&this.writeToStdout(i),t==="stderr"&&(i.startsWith("The above error occurred")||this.writeToStderr(i))}))}setAlternateScreen(t){this.alternateScreen=this.resolveAlternateScreenOption(t,this.interactive),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,Re),this.writeBestEffort(this.options.stdout,Q))}resolveInteractiveOption(t){return t??(!Ee&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,i){return!!t&&i&&!!this.options.stdout.isTTY}shouldSync(){return Ke(this.options.stdout,this.interactive)}writeBestEffort(t,i){try{t.write(i)}catch{}}async awaitExit(){try{await this.exitPromise}catch{}}hasPendingConcurrentWork(){const t=this.container;return(t.pendingLanes??0)!==0&&t.callbackNode!==void 0&&t.callbackNode!==null}async awaitNextRender(){if(!this.nextRenderCommit){let t;const i=new Promise(r=>{t=r});this.nextRenderCommit={promise:i,resolve:t}}return this.nextRenderCommit.promise}renderInteractiveFrame(t,i,r,s=""){const n=r+s,o=n!=="",u=this.options.stdout.isTTY,a=u?rt(this.options.stdout).rows:24,l=u&&i>=a?t:`${t}
26
+ `;if(Ns({isTty:u,isUnmounting:this.isUnmounting,nextOutputHeight:i,previousOutputHeight:this.lastOutputHeight,viewportRows:a})){if(this.options.incrementalRendering){o&&(this.log.clear(),this.options.stdout.write(n)),(t!==this.lastOutput||this.log.isCursorDirty()||o)&&this.throttledLog(l),this.lastOutput=t,this.lastOutputToRender=l,this.lastOutputHeight=i;return}const f=this.shouldSync();f&&this.options.stdout.write(V),this.options.stdout.write(zi+this.fullStaticOutput+s+t),this.lastOutput=t,this.lastOutputToRender=l,this.lastOutputHeight=i,this.log.sync(l),f&&this.options.stdout.write(q);return}if(o){const f=this.shouldSync();f&&this.options.stdout.write(V),this.log.clear(),this.options.stdout.write(n),this.log(l),f&&this.options.stdout.write(q)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(l);this.lastOutput=t,this.lastOutputToRender=l,this.lastOutputHeight=i}initImmediateKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="enabled")return;const i=t.flags??["disambiguateEscapeCodes"];this.options.stdin.isTTY&&this.options.stdout.isTTY&&this.enableKittyProtocol(i)}initDeferredKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="auto")return;const i=t.flags??["disambiguateEscapeCodes"];!this.interactive||!this.options.stdin.isTTY||!this.options.stdout.isTTY||this.confirmKittySupport(i)}confirmKittySupport(t){const{stdin:i,stdout:r}=this.options;let s=[];const n=g(()=>{this.cancelKittyDetection=void 0,clearTimeout(u),i.removeListener("data",o);const a=Ps(s);s=[],a.length>0&&i.unshift(le.from(a))},"cleanup"),o=g(a=>{const l=typeof a=="string"?le.from(a):a;for(const f of l)s.push(f);Es(s)&&(n(),this.isUnmounted||this.enableKittyProtocol(t))},"onData");i.on("data",o);const u=setTimeout(n,200);this.cancelKittyDetection=n,r.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${Wi(t)}u`),this.kittyProtocolEnabled=!0}}var Is=Object.defineProperty,Kt=b((e,t)=>Is(e,"name",{value:t,configurable:!0}),"i");const fn=Kt((e,t)=>{const i={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:B.stderr,stdin:B.stdin,stdout:B.stdout,...Ls(t)},r=Ds(i.stdout,()=>new ks(i));return r.render(e),{cleanup(){r.unmount()},clear(){r.clear()},rerender(s){r.render(s)},rootNode:r.rootNode,unmount(){r.unmount()},waitUntilExit(){return r.waitUntilExit()},waitUntilRenderFlush(){return r.waitUntilRenderFlush()}}},"render"),Ls=Kt((e={})=>e instanceof oi?{stdin:B.stdin,stdout:e}:e,"getOptions"),Ds=Kt((e,t)=>{const i=Ut.get(e);if(i===void 0){const r=t();return Ut.set(e,r),r}return B.stderr.write(`Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.
27
+ `),i},"getInstance");export{fn as default};
@@ -0,0 +1,417 @@
1
+ import { ReactNode } from 'react';
2
+ import { D as DOMElement } from "./dom.d-DgP_exKU.js";
3
+ import 'node:stream';
4
+ import { a as CursorPosition } from "./cursor-helpers.d-BONB9tky.js";
5
+ declare const kittyFlags: {
6
+ readonly disambiguateEscapeCodes: 1;
7
+ readonly reportAllKeysAsEscapeCodes: 8;
8
+ readonly reportAlternateKeys: 4;
9
+ readonly reportAssociatedText: 16;
10
+ readonly reportEventTypes: 2;
11
+ };
12
+ type KittyFlagName = keyof typeof kittyFlags;
13
+ declare const kittyModifiers: {
14
+ readonly alt: 2;
15
+ readonly capsLock: 64;
16
+ readonly ctrl: 4;
17
+ readonly hyper: 16;
18
+ readonly meta: 32;
19
+ readonly numLock: 128;
20
+ readonly shift: 1;
21
+ readonly super: 8;
22
+ };
23
+ type KittyKeyboardOptions = {
24
+ flags?: KittyFlagName[];
25
+ mode?: "auto" | "enabled" | "disabled";
26
+ };
27
+ /**
28
+ * Performance metrics for a render operation.
29
+ */
30
+ type RenderMetrics = {
31
+ /**
32
+ * Time spent rendering in milliseconds.
33
+ */
34
+ renderTime: number;
35
+ };
36
+ type Options = {
37
+ /**
38
+ * Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
39
+ *
40
+ * Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
41
+ *
42
+ * Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
43
+ *
44
+ Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
45
+
46
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
47
+
48
+ @default false
49
+
50
+ @see {@link RenderOptions.alternateScreen}
51
+ */
52
+ alternateScreen?: boolean;
53
+ /**
54
+ * Enable React Concurrent Rendering mode.
55
+ *
56
+ * When enabled:
57
+ * - Suspense boundaries work correctly with async data
58
+ * - `useTransition` and `useDeferredValue` are fully functional
59
+ - Updates can be interrupted for higher priority work
60
+
61
+ Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
62
+
63
+ @default false
64
+ @experimental
65
+ */
66
+ concurrent?: boolean;
67
+ debug: boolean;
68
+ exitOnCtrlC: boolean;
69
+ incrementalRendering?: boolean;
70
+ /**
71
+ * Override automatic interactive mode detection.
72
+ *
73
+ * By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
74
+ *
75
+ * When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
76
+ *
77
+ Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
78
+
79
+ Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
80
+
81
+ @default true (false if in CI or `stdout.isTTY` is falsy)
82
+
83
+ @see {@link RenderOptions.interactive}
84
+ */
85
+ interactive?: boolean;
86
+ isScreenReaderEnabled?: boolean;
87
+ kittyKeyboard?: KittyKeyboardOptions;
88
+ maxFps?: number;
89
+ onRender?: (metrics: RenderMetrics) => void;
90
+ patchConsole: boolean;
91
+ standardReactLayoutTiming?: boolean;
92
+ stderr: NodeJS.WriteStream;
93
+ stdin: NodeJS.ReadStream;
94
+ stdout: NodeJS.WriteStream;
95
+ /**
96
+ * Whether to track text selection state during rendering.
97
+ *
98
+ * @default false
99
+ */
100
+ trackSelection?: boolean;
101
+ /**
102
+ * Use the native Rust cell-diff renderer instead of ANSI string-based log-update.
103
+ * Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
104
+ * generating minimal ANSI escape sequences. Significantly reduces GC pressure
105
+ * and improves rendering performance for complex UIs.
106
+ *
107
+ * Falls back to the string-based path if native bindings are not available.
108
+ * @default false
109
+ */
110
+ useNativeRenderer?: boolean;
111
+ waitUntilExit?: () => Promise<unknown>;
112
+ };
113
+ declare class Ink {
114
+ /**
115
+ * Whether this instance is using concurrent rendering mode.
116
+ */
117
+ readonly isConcurrent: boolean;
118
+ private readonly options;
119
+ private readonly log;
120
+ private manualCursorPosition;
121
+ private renderedCursorPosition;
122
+ private renderedCursorRequested;
123
+ private readonly throttledLog;
124
+ private readonly isScreenReaderEnabled;
125
+ private readonly interactive;
126
+ private readonly renderThrottleMs;
127
+ private alternateScreen;
128
+ private isUnmounted;
129
+ private isUnmounting;
130
+ private lastOutput;
131
+ private lastOutputToRender;
132
+ private lastOutputHeight;
133
+ private lastTerminalWidth;
134
+ private readonly nativeLog;
135
+ private readonly useNativeRenderer;
136
+ private readonly container;
137
+ readonly rootNode: DOMElement;
138
+ private fullStaticOutput;
139
+ private backbufferNode;
140
+ private backbufferMultiWarned;
141
+ private readonly exitPromise!;
142
+ private exitResult;
143
+ private beforeExitHandler?;
144
+ private restoreConsole?;
145
+ private unsubscribeResize?;
146
+ private readonly throttledOnRender?;
147
+ private hasPendingThrottledRender;
148
+ private kittyProtocolEnabled;
149
+ private cancelKittyDetection?;
150
+ private nextRenderCommit?;
151
+ private deferredInitDone;
152
+ constructor(options: Options);
153
+ /**
154
+ * Perform deferred initialization on the first render frame.
155
+ * Kitty keyboard auto-detection is deferred here because the CSI ? u
156
+ * query sets up a synchronous stdin listener with a 200ms timeout.
157
+ * "enabled" mode runs immediately in the constructor (it's just a write).
158
+ */
159
+ private runDeferredInit;
160
+ resized: () => void;
161
+ resolveExitPromise: (result?: unknown) => void;
162
+ rejectExitPromise: (reason?: Error) => void;
163
+ unsubscribeExit: () => void;
164
+ handleAppExit: (errorOrResult?: unknown) => void;
165
+ getActiveCursorPosition: () => CursorPosition | undefined;
166
+ setCursorPosition: (position: CursorPosition | undefined) => void;
167
+ restoreLastOutput: () => void;
168
+ calculateLayout: () => void;
169
+ private calculateScrollAndTriggerObservers;
170
+ /**
171
+ * Force a full layout recalculation by marking all text nodes dirty.
172
+ * Useful when the string width function changes or terminal font changes.
173
+ */
174
+ recalculateLayout(): void;
175
+ /**
176
+ * Walks the DOM tree before Yoga layout to handle StaticRender nodes.
177
+ *
178
+ * - Re-attach Yoga children if a cached render was invalidated.
179
+ * - Pre-render ink-static-render nodes that don't have a cached render yet.
180
+ */
181
+ private prepareYogaTree;
182
+ private markAllTextNodesDirty;
183
+ handleStaticChange: () => void;
184
+ /**
185
+ * Compute the slice of lines that newly scrolled off the top of the single
186
+ * `overflowToBackbuffer` region and have not yet been flushed into the
187
+ * terminal's real scrollback. Advances the monotonic
188
+ * `internal_maxPushedScrollTop` bookkeeping so each line is emitted exactly
189
+ * once and scrolling back up is a no-op. Returns a newline-terminated
190
+ * string to write above the live frame, or "" when there is nothing to do.
191
+ *
192
+ * No-op outside inline mode (alternate-screen / non-TTY / non-interactive /
193
+ * screen-reader / debug), since terminal scrollback only exists for an
194
+ * inline, in-place-updated live region. Debug mode is excluded because it
195
+ * re-dumps the full grid every frame and never writes this slice — running
196
+ * it there would advance the monotonic pointer past lines that were never
197
+ * emitted.
198
+ */
199
+ private computeBackbufferOutput;
200
+ onRender: () => void;
201
+ private accessibilityContextValue;
202
+ render(node: ReactNode): void;
203
+ writeToStdout: (data: string) => void;
204
+ writeToStderr: (data: string) => void;
205
+ unmount: (error?: Error | number | null) => void;
206
+ waitUntilExit(): Promise<unknown>;
207
+ waitUntilRenderFlush(): Promise<void>;
208
+ clear(): void;
209
+ patchConsole(): void;
210
+ private setAlternateScreen;
211
+ private resolveInteractiveOption;
212
+ private resolveAlternateScreenOption;
213
+ private shouldSync;
214
+ private writeBestEffort;
215
+ private awaitExit;
216
+ private hasPendingConcurrentWork;
217
+ private awaitNextRender;
218
+ private renderInteractiveFrame;
219
+ /**
220
+ * Handle kitty keyboard "enabled" mode immediately (just a stdout.write).
221
+ * Called from the constructor.
222
+ */
223
+ private initImmediateKittyKeyboard;
224
+ /**
225
+ * Handle kitty keyboard "auto" mode detection. Deferred to first render
226
+ * because the CSI ? u query sets up a stdin listener with a 200ms timeout.
227
+ */
228
+ private initDeferredKittyKeyboard;
229
+ private confirmKittySupport;
230
+ private enableKittyProtocol;
231
+ }
232
+ type RenderOptions = {
233
+ /**
234
+ * Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
235
+ *
236
+ * Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
237
+ *
238
+ * Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
239
+ *
240
+ * Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
241
+ *
242
+ *Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
243
+ * @default false
244
+ */
245
+ alternateScreen?: boolean;
246
+ /**
247
+ * Enable React Concurrent Rendering mode.
248
+ *
249
+ * When enabled:
250
+ * - Suspense boundaries work correctly with async data
251
+ * - `useTransition` and `useDeferredValue` are fully functional
252
+ * - Updates can be interrupted for higher priority work
253
+ *
254
+ *Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
255
+ * @default false
256
+ */
257
+ concurrent?: boolean;
258
+ /**
259
+ * If true, each update will be rendered as separate output, without replacing the previous one.
260
+ * @default false
261
+ */
262
+ debug?: boolean;
263
+ /**
264
+ * Configure whether Ink should listen for Ctrl+C keyboard input and exit the app. This is needed in case `process.stdin` is in raw mode, because then Ctrl+C is ignored by default and the process is expected to handle it manually.
265
+ * @default true
266
+ */
267
+ exitOnCtrlC?: boolean;
268
+ /**
269
+ * Enable incremental rendering mode which only updates changed lines instead of redrawing the entire output.
270
+ *This can reduce flickering and improve performance for frequently updating UIs.
271
+ * @default false
272
+ */
273
+ incrementalRendering?: boolean;
274
+ /**
275
+ * Override automatic interactive mode detection.
276
+ *
277
+ * By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
278
+ *
279
+ * When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
280
+ *
281
+ * Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
282
+ *
283
+ *Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
284
+ * @default true (false if in CI or `stdout.isTTY` is falsy)
285
+ */
286
+ interactive?: boolean;
287
+ /**
288
+ * Enable screen reader support. See https://github.com/vadimdemedes/ink/blob/master/readme.md#screen-reader-support
289
+ * @default process.env['INK_SCREEN_READER'] === 'true'
290
+ */
291
+ isScreenReaderEnabled?: boolean;
292
+ /**
293
+ * Configure kitty keyboard protocol support for enhanced keyboard input.
294
+ * Enables additional modifiers (super, hyper, capsLock, numLock) and
295
+ *disambiguated key events in terminals that support the protocol.
296
+ * @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
297
+ */
298
+ kittyKeyboard?: KittyKeyboardOptions;
299
+ /**
300
+ * Maximum frames per second for render updates.
301
+ * This controls how frequently the UI can update to prevent excessive re-rendering.
302
+ *Higher values allow more frequent updates but may impact performance.
303
+ * @default 30
304
+ */
305
+ maxFps?: number;
306
+ /**
307
+ * Runs the given callback after each render and re-render with render metrics.
308
+ *
309
+ * Note: this callback runs after Ink commits a frame, but it does not wait for `stdout`/`stderr` stream callbacks.
310
+ * To run code after output is flushed, use `waitUntilRenderFlush()`.
311
+ */
312
+ onRender?: (metrics: RenderMetrics) => void;
313
+ /**
314
+ * Patch console methods to ensure console output doesn't mix with Ink's output.
315
+ *
316
+ *Note: Once unmount starts, Ink restores the native console before React cleanup runs. Teardown-time `console.*` output then follows the normal console behavior instead of being rerouted through Ink.
317
+ * @default true
318
+ */
319
+ patchConsole?: boolean;
320
+ /**
321
+ * If true, Ink defers frame output until after React's commit phase completes,
322
+ * ensuring `useLayoutEffect` hooks run before the frame is written to the terminal.
323
+ *
324
+ * This eliminates the one-frame flicker when components measure layout
325
+ * (e.g., scroll position, element size) in `useLayoutEffect` and adjust state.
326
+ *
327
+ * **Warning:** Incompatible with the `&lt;Static>` component, which relies on
328
+ * immediate render timing to append output.
329
+ * @default false
330
+ */
331
+ standardReactLayoutTiming?: boolean;
332
+ /**
333
+ * Error stream.
334
+ * @default process.stderr
335
+ */
336
+ stderr?: NodeJS.WriteStream;
337
+ /**
338
+ * Input stream where app will listen for input.
339
+ * @default process.stdin
340
+ */
341
+ stdin?: NodeJS.ReadStream;
342
+ /**
343
+ * Output stream where the app will be rendered.
344
+ * @default process.stdout
345
+ */
346
+ stdout?: NodeJS.WriteStream;
347
+ /**
348
+ * Use the native Rust cell-diff renderer for terminal output.
349
+ * Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
350
+ * generating minimal ANSI escape sequences. Reduces GC pressure and
351
+ * improves rendering performance for complex UIs.
352
+ *
353
+ * Falls back to string-based rendering if native bindings are not available.
354
+ * @default false
355
+ */
356
+ useNativeRenderer?: boolean;
357
+ };
358
+ type Instance = {
359
+ /**
360
+ * Unmount the current app and remove the internal Ink instance for this stdout.
361
+ *
362
+ * This is mostly useful for advanced cases where you need `render()` to create a fresh instance for the same stream without leaving terminal state such as the alternate screen behind.
363
+ */
364
+ cleanup: () => void;
365
+ /**
366
+ * Clear output.
367
+ */
368
+ clear: () => void;
369
+ /**
370
+ * Replace the previous root node with a new one or update props of the current root node.
371
+ */
372
+ rerender: Ink["render"];
373
+ /**
374
+ * The root DOM element of the rendered tree.
375
+ * Useful for programmatic DOM inspection and advanced measurement.
376
+ */
377
+ rootNode: DOMElement;
378
+ /**
379
+ * Manually unmount the whole Ink app.
380
+ */
381
+ unmount: Ink["unmount"];
382
+ /**
383
+ * Returns a promise that settles when the app is unmounted.
384
+ *
385
+ * It resolves with the value passed to `exit(value)` and rejects with the error passed to `exit(error)`.
386
+ *When `unmount()` is called manually, it settles after unmount-related stdout writes complete.
387
+ * @example
388
+ * ```jsx
389
+ * const {unmount, waitUntilExit} = render(<MyApp />);
390
+ *
391
+ * setTimeout(unmount, 1000);
392
+ *
393
+ * await waitUntilExit(); // resolves after `unmount()` is called
394
+ * ```
395
+ */
396
+ waitUntilExit: Ink["waitUntilExit"];
397
+ /**
398
+ * Returns a promise that settles after pending render output is flushed to stdout.
399
+ *
400
+ *This can be used after `rerender()` when you need to run code only after the frame is written.
401
+ * @example
402
+ * ```jsx
403
+ * const {rerender, waitUntilRenderFlush} = render(<MyApp step="loading" />);
404
+ *
405
+ * rerender(<MyApp step="ready" />);
406
+ * await waitUntilRenderFlush(); // output for "ready" is flushed
407
+ *
408
+ * runNextCommand();
409
+ * ```
410
+ */
411
+ waitUntilRenderFlush: Ink["waitUntilRenderFlush"];
412
+ };
413
+ /**
414
+ * Mount a component and render the output.
415
+ */
416
+ declare const render: (node: ReactNode, options?: NodeJS.WriteStream | RenderOptions) => Instance;
417
+ export { Instance as I, KittyFlagName as K, RenderOptions as R, KittyKeyboardOptions as a, kittyModifiers as b, kittyFlags as k, render as r };
@@ -0,0 +1,4 @@
1
+ var g=Object.defineProperty;var u=(t,n)=>g(t,"name",{value:n,configurable:!0});import{LegacyRoot as N}from"react-reconciler/constants.js";import S from"yoga-layout";import{c as h}from"./dom-CW6KYzFK.js";import{L as c}from"./reconciler-CGhHgXXG.js";import{R as d}from"./renderer-C2ycheBL.js";import{calculateScroll as w}from"./getScrollHeight-ClEOyLHH.js";var R=Object.defineProperty,m=u((t,n)=>R(t,"name",{value:n,configurable:!0}),"u");const I=m((t,n)=>{const y=n?.columns??80,e=h("ink-root");let i="";e.onComputeLayout=()=>{e.yogaNode.setWidth(y),e.yogaNode.calculateLayout(void 0,void 0,S.DIRECTION_LTR);const o=m(r=>{if(r.nodeName==="ink-box"){const a=r.style.overflow??"visible",p=r.style.overflowX??a,v=r.style.overflowY??a;(p==="scroll"||v==="scroll")&&w(r)}for(const a of r.childNodes)a.nodeName!=="#text"&&o(a)},"walkScroll");o(e)},e.onImmediateRender=()=>{const{staticOutput:o}=d(e,!1);o&&o!==`
2
+ `&&(i+=o)};let l;const s=c.createContainer(e,N,null,!1,null,"render-to-string",o=>{l??=o},()=>{},()=>{},()=>{});let f=!1;try{c.updateContainerSync(t,s,null,()=>{}),c.flushSyncWork();const{output:o}=d(e,!1);if(c.updateContainerSync(null,s,null,()=>{}),c.flushSyncWork(),f=!0,e.yogaNode.free(),l!==void 0)throw l instanceof Error?l:new Error(String(l));const r=i.endsWith(`
3
+ `)?i.slice(0,-1):i;return r&&o?`${r}
4
+ ${o}`:r||o}finally{if(!f&&e.yogaNode)try{e.yogaNode.freeRecursive()}catch{}}},"renderToString");export{I as default};
@@ -0,0 +1,2 @@
1
+ var T=Object.defineProperty;var c=(o,r)=>T(o,"name",{value:r,configurable:!0});import y from"react";import{FocusProvider as w}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as v}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as C}from"./LayoutNode-B0qeT8sl.js";import{T as i}from"./reconciler-ClRKkLS4.js";import{renderTreeToBuffer as E}from"./renderTreeToBuffer-LnGZkEUX.js";import{Cell as N}from"./Cell-BrXn3jxY.js";var P=Object.defineProperty,d=c((o,r)=>P(o,"name",{value:r,configurable:!0}),"a");function W(o,r){const e=r?.columns??80,n=r?.rows??24,t=new C;t.yogaNode.setWidth(e),t.yogaNode.setHeight(n);const S={app:null,input:null,writeStderr:d(u=>{},"writeStderr"),writeStdout:d(u=>{},"writeStdout")},g=y.createElement(v.Provider,{value:S},y.createElement(w,null,o)),m=i.createContainer(t,0,null,!1,null,"renderToString",()=>{},null);i.updateContainerSync(g,m,null,()=>{}),i.flushSyncWork(),t.calculateLayout(e,n);const f=new Uint32Array(e*n*2);E(t,f,e,n);const l=[];for(let u=0;u<n;u++){let p="";for(let a=0;a<e;a++){const h=f[(u*e+a)*2],s=N.getChar(h);p+=s===""?" ":s}l.push(p.trimEnd())}for(;l.length>0&&l.at(-1)==="";)l.pop();return i.updateContainerSync(null,m,null,()=>{}),i.flushSyncWork(),t.destroy(),l.join(`
2
+ `)}c(W,"renderToString");d(W,"renderToString");export{W as renderToString};
@@ -0,0 +1,2 @@
1
+ var D=Object.defineProperty;var R=(t,o)=>D(t,"name",{value:o,configurable:!0});import{o as G}from"./boxes-DyY_LXCi.js";import{resolveColor as j}from"./NAMED_COLORS-B9fJsYdg.js";import{g as I}from"./text-width-CI9G0a-z.js";var K=Object.defineProperty,B=R((t,o)=>K(t,"name",{value:o,configurable:!0}),"N");const V=1114112,F=9608,J=9600,Q=9604;function E(t){const o=t?.borderStyle?1:0;return{bottom:t?.borderBottom===!1?0:o,left:t?.borderLeft===!1?0:o,right:t?.borderRight===!1?0:o,top:t?.borderTop===!1?0:o}}R(E,"k");B(E,"getEffectiveBorderWidths");function H(t){let o=0;for(const i of t.children){const b=i.getLayout(),e=b.top+b.height;e>o&&(o=e)}const n=t._style,l=n?.paddingBottom??n?.paddingY??n?.padding??0;return o+l}R(H,"q");B(H,"getScrollContentHeight");function N(t,o,n,l,i,b,e,m,v,_,g,d){const r=E(d),a=m-r.top-r.bottom,u=d.scrollTop??0,h=H(t),M=a;if(h<=M||a<=0)return;const f=a*2,y=Math.max(2,Math.round(M/h*f)),s=h-M,x=f-y,T=s>0?Math.round(u/s*x):0,c=typeof d.scrollbarThumbColor=="string"?j(d.scrollbarThumbColor):v,p=i+e-1-r.right,S=_<<16|65280|c;for(let w=0;w<a;w++){const Y=w*2,X=Y+1,k=Y>=T&&Y<T+y,L=X>=T&&X<T+y;if(!k&&!L)continue;let C=F;k&&!L?C=J:!k&&L&&(C=Q),A(o,n,l,p,b+r.top+w,C,S,g)}}R(N,"z");B(N,"paintScrollbar");function q(t,o,n,l,i,b,e,m,v,_,g,d,r,a){const u=E(a),h=a.scrollTop??0,M=b+u.top;for(const f of t.children){if(!f._style?.sticky)continue;const y=f.getLayout();if(y.top>=h)continue;const s=f.parent;if(s&&s!==t){const S=s.getLayout();if(S.top+S.height<=h)continue}const x=M,T=f.fg===255?v:f.fg,c=f.bg===255?_:f.bg,p=f.styles===0?g:f.styles;O(f,o,n,l,i-y.left,x-y.top,T,c,p,d,r)}}R(q,"G");B(q,"paintStickyHeaders");function Z(t,o,n,l){for(let e=0;e<o.length;e+=2)o[e]=32,o[e+1]=65535;const i=[],b={x0:0,x1:n,y0:0,y1:l};try{O(t,o,n,l,0,0,t.fg,t.bg,t.styles,i,b);for(const e of i)z(e.node,o,n,l,e.absX,e.absY,e.w,e.h,e.fg,e.bg,e.styles,e.clip)}catch(e){console.error("Renderer Error:",e)}}R(Z,"renderTreeToBuffer");B(Z,"renderTreeToBuffer");function A(t,o,n,l,i,b,e,m){if(l<m.x0||l>=m.x1||i<m.y0||i>=m.y1||l<0||l>=o||i<0||i>=n)return;const v=(i*o+l)*2;t[v]=b,t[v+1]=e}R(A,"M");B(A,"writeCell");function z(t,o,n,l,i,b,e,m,v,_,g,d){if(!t._style?.borderStyle||e<=0||m<=0)return;const r=G[t._style.borderStyle],a=t._style.borderColor===void 0?v:j(t._style.borderColor),u=g<<16|_<<8|a,h=t._style.borderTop!==!1,M=t._style.borderBottom!==!1,f=t._style.borderLeft!==!1,y=t._style.borderRight!==!1,s=M&&(m>1||!h);if(h)for(let c=0;c<e;c++){let p;e===1?p=f&&y?r.left:f?r.topLeft:y?r.topRight:r.top:c===0&&f?p=r.topLeft:c===e-1&&y?p=r.topRight:p=r.top,A(o,n,l,i+c,b,p.codePointAt(0),u,d)}if(s)for(let c=0;c<e;c++){let p;e===1?p=f&&y?r.left:f?r.bottomLeft:y?r.bottomRight:r.bottom:c===0&&f?p=r.bottomLeft:c===e-1&&y?p=r.bottomRight:p=r.bottom,A(o,n,l,i+c,b+m-1,p.codePointAt(0),u,d)}const x=h?1:0,T=s?m-1:m;for(let c=x;c<T;c++)f&&A(o,n,l,i,b+c,r.left.codePointAt(0),u,d),y&&A(o,n,l,i+e-1,b+c,r.right.codePointAt(0),u,d)}R(z,"K");B(z,"paintBorder");function W(t){if(t._hidden)return"";if(t.text!==void 0)return t.text;const o=t.children.map(W).join("");return typeof t.transform=="function"?t.transform(o,0):o}R(W,"X");B(W,"collectText");function U(t,o,n,l,i,b,e,m,v,_){if(e<=0||m<=0)return;let g=0,d=0;for(const r of t){if(r===`
2
+ `){g=0,d++;continue}const a=r.codePointAt(0)??32,u=I(r);if(g+u>e&&(g=0,d++),d>=m)break;if(u>e){A(o,n,l,i+g,b+d,32,v,_),g+=1;continue}A(o,n,l,i+g,b+d,a,v,_),u===2&&g+1<e&&A(o,n,l,i+g+1,b+d,V,v,_),g+=u}}R(U,"E");B(U,"paintText");function O(t,o,n,l,i,b,e,m,v,_,g){if(t._hidden)return;const d=t.getLayout(),r=Math.round(i+d.left),a=Math.round(b+d.top),u=Math.round(d.width),h=Math.round(d.height),M=t.fg===255?e:t.fg,f=t.bg===255?m:t.bg,y=t.styles===0?v:t.styles,s={x0:Math.max(g.x0,r),x1:Math.min(g.x1,r+u),y0:Math.max(g.y0,a),y1:Math.min(g.y1,a+h)};if(s.x0>=s.x1||s.y0>=s.y1)return;if(typeof t.transform=="function"){const L=W(t),C=t.transform(L,0),P=y<<16|f<<8|M;U(C,o,n,l,r,a,u,h,P,s);return}if(t.text===void 0){if(f!==255||y!==0){const L=y<<16|f<<8|M;for(let C=0;C<h;C++)for(let P=0;P<u;P++)A(o,n,l,r+P,a+C,32,L,s)}t._style?.borderStyle&&_.push({absX:r,absY:a,bg:f,clip:s,fg:M,h,node:t,styles:y,w:u})}else{const L=y<<16|f<<8|M;if(t.bg!==255)for(let C=0;C<h;C++)for(let P=0;P<u;P++)A(o,n,l,r+P,a+C,32,L,s);U(t.text,o,n,l,r,a,u,h,L,s)}const x=t._style,T=x?.overflow??"visible",c=x?.overflowX??T,p=x?.overflowY??T,S=c==="hidden"||c==="scroll",w=p==="hidden"||p==="scroll";let Y=s,X=0,k=0;if(S||w){const L=E(x);Y={x0:S?Math.max(s.x0,r+L.left):s.x0,x1:S?Math.min(s.x1,r+u-L.right):s.x1,y0:w?Math.max(s.y0,a+L.top):s.y0,y1:w?Math.min(s.y1,a+h-L.bottom):s.y1},p==="scroll"&&typeof x?.scrollTop=="number"&&(k=-x.scrollTop),c==="scroll"&&typeof x?.scrollLeft=="number"&&(X=-x.scrollLeft)}for(const L of t.children)L._style?.internalStickyAlternate||O(L,o,n,l,r+X,a+k,M,f,y,_,Y);(p==="scroll"||c==="scroll")&&x?.scrollbar!==!1&&N(t,o,n,l,r,a,u,h,M,y,s,x),p==="scroll"&&typeof x?.scrollTop=="number"&&q(t,o,n,l,r,a,u,h,M,f,y,_,Y,x)}R(O,"S");B(O,"paintNode");export{Z as renderTreeToBuffer};