@visulima/tui 1.0.0-alpha.10 → 1.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE.md +2115 -72
  3. package/README.md +32 -4
  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 +52 -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 +42 -0
  73. package/dist/components/gradient.js +1 -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 +56 -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 +50 -0
  149. package/dist/components/static-render.js +1 -0
  150. package/dist/components/static.d.ts +29 -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 +79 -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/ink/hooks/use-animation.d.ts +41 -0
  193. package/dist/ink/hooks/use-animation.js +1 -0
  194. package/dist/ink/hooks/use-app.d.ts +38 -0
  195. package/dist/ink/hooks/use-app.js +1 -0
  196. package/dist/ink/hooks/use-box-metrics.d.ts +63 -0
  197. package/dist/ink/hooks/use-box-metrics.js +1 -0
  198. package/dist/ink/hooks/use-clipboard.d.ts +30 -0
  199. package/dist/ink/hooks/use-clipboard.js +1 -0
  200. package/dist/ink/hooks/use-color-blindness.d.ts +33 -0
  201. package/dist/ink/hooks/use-color-blindness.js +1 -0
  202. package/dist/ink/hooks/use-console-capture.d.ts +43 -0
  203. package/dist/ink/hooks/use-console-capture.js +1 -0
  204. package/dist/ink/hooks/use-cursor.d.ts +13 -0
  205. package/dist/ink/hooks/use-cursor.js +1 -0
  206. package/dist/ink/hooks/use-focus-manager.d.ts +56 -0
  207. package/dist/ink/hooks/use-focus-manager.js +1 -0
  208. package/dist/ink/hooks/use-focus.d.ts +34 -0
  209. package/dist/ink/hooks/use-focus.js +1 -0
  210. package/dist/ink/hooks/use-form.d.ts +68 -0
  211. package/dist/ink/hooks/use-form.js +1 -0
  212. package/dist/ink/hooks/use-hotkey.d.ts +37 -0
  213. package/dist/ink/hooks/use-hotkey.js +1 -0
  214. package/dist/ink/hooks/use-input.d.ts +149 -0
  215. package/dist/ink/hooks/use-input.js +2 -0
  216. package/dist/ink/hooks/use-interval.d.ts +25 -0
  217. package/dist/ink/hooks/use-interval.js +1 -0
  218. package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +6 -0
  219. package/dist/ink/hooks/use-is-screen-reader-enabled.js +1 -0
  220. package/dist/ink/hooks/use-key-bindings.d.ts +59 -0
  221. package/dist/ink/hooks/use-key-bindings.js +1 -0
  222. package/dist/ink/hooks/use-key-chord.d.ts +25 -0
  223. package/dist/ink/hooks/use-key-chord.js +1 -0
  224. package/dist/ink/hooks/use-linked-scroll.d.ts +48 -0
  225. package/dist/ink/hooks/use-linked-scroll.js +1 -0
  226. package/dist/ink/hooks/use-paste.d.ts +44 -0
  227. package/dist/ink/hooks/use-paste.js +1 -0
  228. package/dist/ink/hooks/use-persistent-state.d.ts +56 -0
  229. package/dist/ink/hooks/use-persistent-state.js +2 -0
  230. package/dist/ink/hooks/use-scroll-acceleration.d.ts +47 -0
  231. package/dist/ink/hooks/use-scroll-acceleration.js +1 -0
  232. package/dist/ink/hooks/use-scroll-input.d.ts +34 -0
  233. package/dist/ink/hooks/use-scroll-input.js +1 -0
  234. package/dist/ink/hooks/use-stderr.d.ts +16 -0
  235. package/dist/ink/hooks/use-stderr.js +1 -0
  236. package/dist/ink/hooks/use-stdin.d.ts +30 -0
  237. package/dist/ink/hooks/use-stdin.js +1 -0
  238. package/dist/ink/hooks/use-stdout.d.ts +16 -0
  239. package/dist/ink/hooks/use-stdout.js +1 -0
  240. package/dist/ink/hooks/use-stopwatch.d.ts +39 -0
  241. package/dist/ink/hooks/use-stopwatch.js +1 -0
  242. package/dist/ink/hooks/use-terminal-palette.d.ts +20 -0
  243. package/dist/ink/hooks/use-terminal-palette.js +1 -0
  244. package/dist/ink/hooks/use-text-buffer.d.ts +42 -0
  245. package/dist/{packem_shared/useTextBuffer-DekkGLxI.js → ink/hooks/use-text-buffer.js} +3 -3
  246. package/dist/ink/hooks/use-text-selection.d.ts +44 -0
  247. package/dist/ink/hooks/use-text-selection.js +1 -0
  248. package/dist/ink/hooks/use-timeout.d.ts +24 -0
  249. package/dist/ink/hooks/use-timeout.js +1 -0
  250. package/dist/ink/hooks/use-timer.d.ts +48 -0
  251. package/dist/ink/hooks/use-timer.js +1 -0
  252. package/dist/ink/hooks/use-window-size.d.ts +18 -0
  253. package/dist/ink/hooks/use-window-size.js +1 -0
  254. package/dist/ink/index.d.ts +18 -6196
  255. package/dist/ink/index.js +1 -1
  256. package/dist/packem_shared/ControlledScrollView-X_OTc-Cw.js +1 -0
  257. package/dist/packem_shared/{DevTools-O8EbCfHa.js → DevTools-CsxLcAu2.js} +1 -1
  258. package/dist/packem_shared/FilePicker-tYj_CIau.js +1 -0
  259. package/dist/packem_shared/Fullscreen-CxLd1-Zu.js +1 -0
  260. package/dist/packem_shared/{LayoutNode-rxblE317.js → LayoutNode-B8zej4dm.js} +1 -1
  261. package/dist/packem_shared/MouseProvider-PnIUKURs.js +1 -0
  262. package/dist/packem_shared/ScrollBar-U_37hlIT.js +1 -0
  263. package/dist/packem_shared/ScrollBarBox-DwiCxilX.js +1 -0
  264. package/dist/packem_shared/ScrollList-Dxgv-mhZ.js +1 -0
  265. package/dist/packem_shared/ScrollView-Dq2v5zJS.js +1 -0
  266. package/dist/packem_shared/TreeView-GkPr_VYn.js +1 -0
  267. package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +39 -0
  268. package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +23 -0
  269. package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +50 -0
  270. package/dist/packem_shared/controlled-scroll-view-CikQ90_V.js +1 -0
  271. package/dist/packem_shared/cursor-helpers.d-BIvqz0TZ.d.ts +5 -0
  272. package/dist/packem_shared/dom.d-ksOQhC2W.d.ts +400 -0
  273. package/dist/packem_shared/layout-P24eyWyL.js +2 -0
  274. package/dist/packem_shared/line-chart-kf7uhR0K.js +1 -0
  275. package/dist/packem_shared/measureElement-CRKlFSvD.js +1 -0
  276. package/dist/packem_shared/processLayout-Dmgf0LO6.js +1 -0
  277. package/dist/packem_shared/{reconciler-DSYCrIZs.js → reconciler-DIfG72R9.js} +1 -1
  278. package/dist/packem_shared/render-BOqty71z.js +26 -0
  279. package/dist/packem_shared/{render-DDqtMAFN.js → render-F9Hk9p1a.js} +1 -1
  280. package/dist/packem_shared/render.d-CVGLTvTq.d.ts +398 -0
  281. package/dist/packem_shared/{renderToString-DeqOWRP8.js → renderToString-BDk2FZEN.js} +1 -1
  282. package/dist/packem_shared/{renderToString-IYYPyASm.js → renderToString-BbQiRHrd.js} +1 -1
  283. package/dist/packem_shared/renderTreeToBuffer-CZilzyhN.js +2 -0
  284. package/dist/packem_shared/{renderer-D2p6av2X.js → renderer-gqplqpkQ.js} +1 -1
  285. package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +119 -0
  286. package/dist/packem_shared/selection.d-CHKA1ogp.d.ts +62 -0
  287. package/dist/packem_shared/styles.d-C1g4Iwzr.d.ts +368 -0
  288. package/dist/packem_shared/terminal-palette.d-D2SQjfn-.d.ts +19 -0
  289. package/dist/packem_shared/{text-width-CZ9vPvM0.js → text-width-BU2eeTWn.js} +1 -1
  290. package/dist/packem_shared/token-to-elements-BAZpNZsu.js +1 -0
  291. package/dist/packem_shared/useTreeView-BoMMeRPq.js +1 -0
  292. package/dist/packem_shared/utils-CoviI5Vm.js +1 -0
  293. package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
  294. package/dist/react/index.js +1 -1
  295. package/dist/testing/index.d.ts +5 -1
  296. package/dist/testing/index.js +1 -1
  297. package/package.json +553 -19
  298. package/dist/packem_shared/Accordion-BXsqchV-.js +0 -1
  299. package/dist/packem_shared/Alert-BhYVMHtR.js +0 -1
  300. package/dist/packem_shared/AnimatePresence-Eu7Z8KHc.js +0 -1
  301. package/dist/packem_shared/ApprovalPrompt-BSn0FT1g.js +0 -1
  302. package/dist/packem_shared/AreaChart-Chy-frI7.js +0 -1
  303. package/dist/packem_shared/Badge-B8WPyRsK.js +0 -1
  304. package/dist/packem_shared/BarChart-rpZtlMcF.js +0 -1
  305. package/dist/packem_shared/BigText-CRpwUzrt.js +0 -1
  306. package/dist/packem_shared/BlinkDot-BvnRuWP8.js +0 -1
  307. package/dist/packem_shared/Box-BwqSvWuq.js +0 -1
  308. package/dist/packem_shared/Breadcrumb-D0hClbRV.js +0 -1
  309. package/dist/packem_shared/Button-B89Yvbc6.js +0 -1
  310. package/dist/packem_shared/Calendar-Dmflvm2S.js +0 -1
  311. package/dist/packem_shared/Canvas-CKg6WV47.js +0 -1
  312. package/dist/packem_shared/Card-B_9fXdtU.js +0 -1
  313. package/dist/packem_shared/Checkbox-BN71eCWU.js +0 -1
  314. package/dist/packem_shared/Code-HhevcyiH.js +0 -2
  315. package/dist/packem_shared/Collapsible-u6uf_FdV.js +0 -1
  316. package/dist/packem_shared/CommandBlock-B-nslpCv.js +0 -4
  317. package/dist/packem_shared/CommandPalette-CEFdaURo.js +0 -1
  318. package/dist/packem_shared/ConfirmDialog-5Jje_Xpu.js +0 -1
  319. package/dist/packem_shared/ConfirmInput-D44Mb9oo.js +0 -1
  320. package/dist/packem_shared/ConsoleOverlay-CM3APfgP.js +0 -1
  321. package/dist/packem_shared/ContentSwitcher-Dm5BkrCt.js +0 -1
  322. package/dist/packem_shared/ControlledScrollView-DI8KZOQB.js +0 -1
  323. package/dist/packem_shared/Cursor-BoLFIMol.js +0 -1
  324. package/dist/packem_shared/DatePicker-CnSrFFAE.js +0 -1
  325. package/dist/packem_shared/DefinitionList-v8RDuF_R.js +0 -1
  326. package/dist/packem_shared/Dialog-CTaL8pn0.js +0 -1
  327. package/dist/packem_shared/DiffView-BUIFqUB0.js +0 -1
  328. package/dist/packem_shared/Divider-C47bKmqu.js +0 -1
  329. package/dist/packem_shared/FilePicker-CUo7R5Qb.js +0 -1
  330. package/dist/packem_shared/FormField-af3aUpRL.js +0 -1
  331. package/dist/packem_shared/Fullscreen-CuJ8y0s0.js +0 -1
  332. package/dist/packem_shared/Gauge-Dz-usH__.js +0 -1
  333. package/dist/packem_shared/Gradient-DYNc0GZA.js +0 -1
  334. package/dist/packem_shared/Heading-mwEYza3Y.js +0 -1
  335. package/dist/packem_shared/Heatmap-ChL97U1-.js +0 -1
  336. package/dist/packem_shared/Help-Zcelyw_U.js +0 -1
  337. package/dist/packem_shared/Histogram-FIf2F83d.js +0 -1
  338. package/dist/packem_shared/Kbd-DpkPp4jB.js +0 -1
  339. package/dist/packem_shared/LineChart-BXE_girm.js +0 -1
  340. package/dist/packem_shared/Link-i2o2EG4-.js +0 -1
  341. package/dist/packem_shared/LoadingIndicator-TC1Fjwyt.js +0 -1
  342. package/dist/packem_shared/Markdown-R1XqK63D.js +0 -1
  343. package/dist/packem_shared/MaskedInput-J01phOZs.js +0 -1
  344. package/dist/packem_shared/Menu-CfrH4ymk.js +0 -1
  345. package/dist/packem_shared/MessageBubble-BmBBU2Rm.js +0 -1
  346. package/dist/packem_shared/ModelBadge-D3wrXncu.js +0 -1
  347. package/dist/packem_shared/MouseProvider-pjza-lpc.js +0 -1
  348. package/dist/packem_shared/MultiSelect-Dqmn-bVo.js +0 -1
  349. package/dist/packem_shared/Newline-BSG4iUqp.js +0 -2
  350. package/dist/packem_shared/OperationTree-DksxjMIV.js +0 -1
  351. package/dist/packem_shared/OptionList-CNx7r9yN.js +0 -1
  352. package/dist/packem_shared/OrderedList-BeDy035w.js +0 -1
  353. package/dist/packem_shared/Paginator-B56s6bhS.js +0 -1
  354. package/dist/packem_shared/Paragraph-BqJlH0R-.js +0 -1
  355. package/dist/packem_shared/Placeholder-GMpHRGC8.js +0 -1
  356. package/dist/packem_shared/ProgressBar-Bj3fmORR.js +0 -1
  357. package/dist/packem_shared/RadioGroup-Br8BeEwS.js +0 -1
  358. package/dist/packem_shared/ScatterPlot-OhfYco5l.js +0 -1
  359. package/dist/packem_shared/ScrollBar-Da5Y3z7N.js +0 -1
  360. package/dist/packem_shared/ScrollBarBox-Dz6F-Eat.js +0 -1
  361. package/dist/packem_shared/ScrollList-DiVGyEjv.js +0 -1
  362. package/dist/packem_shared/ScrollView-BojONotI.js +0 -1
  363. package/dist/packem_shared/SearchInput-BoPTRbhV.js +0 -1
  364. package/dist/packem_shared/SelectInput-CAJ7SCBq.js +0 -1
  365. package/dist/packem_shared/SelectInputIndicator-N1n8ULHs.js +0 -1
  366. package/dist/packem_shared/SelectInputItem-BEkbmobs.js +0 -1
  367. package/dist/packem_shared/ShimmerText-CuGQ2NDC.js +0 -1
  368. package/dist/packem_shared/Slider-Cg_tJpKa.js +0 -1
  369. package/dist/packem_shared/Spacer-eT3HOrXk.js +0 -1
  370. package/dist/packem_shared/Sparkline-T6_FPVET.js +0 -1
  371. package/dist/packem_shared/Spinner-B0-A50pu.js +0 -1
  372. package/dist/packem_shared/Static-jzLPaHJF.js +0 -1
  373. package/dist/packem_shared/StaticRender-BgD61E7x.js +0 -1
  374. package/dist/packem_shared/StatusLine-Ch4jjef1.js +0 -1
  375. package/dist/packem_shared/StatusMessage-B1qfKeMM.js +0 -1
  376. package/dist/packem_shared/Stepper-CNPAqxiU.js +0 -1
  377. package/dist/packem_shared/Stopwatch-CAx2EWwq.js +0 -1
  378. package/dist/packem_shared/StreamingText-BYOKSB2T.js +0 -1
  379. package/dist/packem_shared/Switch-DzSpKYu7.js +0 -1
  380. package/dist/packem_shared/Tab-BcXzSUdj.js +0 -1
  381. package/dist/packem_shared/Table-DJp1TLrR.js +0 -1
  382. package/dist/packem_shared/Tabs-D68z0SOt.js +0 -1
  383. package/dist/packem_shared/Tag-BvLHnYRn.js +0 -1
  384. package/dist/packem_shared/Text-mTAve9R2.js +0 -1
  385. package/dist/packem_shared/TextInput-C_gYQlnF.js +0 -1
  386. package/dist/packem_shared/Textarea-C2ET_oMb.js +0 -2
  387. package/dist/packem_shared/Timer-CI3aQX65.js +0 -1
  388. package/dist/packem_shared/Toast-Drvc8XfG.js +0 -1
  389. package/dist/packem_shared/Tooltip-C5UnQlLd.js +0 -1
  390. package/dist/packem_shared/Transform-fYmcdqRT.js +0 -1
  391. package/dist/packem_shared/Transition-CJDBKYUB.js +0 -1
  392. package/dist/packem_shared/TreeView-DjhacGJ5.js +0 -1
  393. package/dist/packem_shared/UnorderedList-BnfqexZs.js +0 -1
  394. package/dist/packem_shared/boxes-DyY_LXCi.js +0 -1
  395. package/dist/packem_shared/controlled-scroll-view-CmrAEvJk.js +0 -1
  396. package/dist/packem_shared/createLinkedScrollGroup-BMTJ7rAj.js +0 -1
  397. package/dist/packem_shared/createMemoryStorage-QVZNXbWz.js +0 -2
  398. package/dist/packem_shared/line-chart-DrM8PwnI.js +0 -1
  399. package/dist/packem_shared/measure-element-DSp7YDus.js +0 -2
  400. package/dist/packem_shared/measureElement-DA8WqFP_.js +0 -1
  401. package/dist/packem_shared/processLayout-DXDfFb_d.js +0 -1
  402. package/dist/packem_shared/render-_r0K9K11.js +0 -28
  403. package/dist/packem_shared/render.d-BR3gA-N8.d.ts +0 -1257
  404. package/dist/packem_shared/renderTreeToBuffer-DPkoCgP2.js +0 -2
  405. package/dist/packem_shared/token-to-elements-BYxT6J_Q.js +0 -1
  406. package/dist/packem_shared/useAnimation-B9we6ZzL.js +0 -1
  407. package/dist/packem_shared/useApp-B6fvM42d.js +0 -1
  408. package/dist/packem_shared/useBoxMetrics-D5pkIr6P.js +0 -1
  409. package/dist/packem_shared/useClipboard-CBxy0hT8.js +0 -1
  410. package/dist/packem_shared/useColorBlindness-BvWcu2Bb.js +0 -1
  411. package/dist/packem_shared/useConsoleCapture-BxiG8iLJ.js +0 -1
  412. package/dist/packem_shared/useCursor-CPu8T5Db.js +0 -1
  413. package/dist/packem_shared/useFocus-DSmziO_x.js +0 -1
  414. package/dist/packem_shared/useFocusManager-Uapn3LQo.js +0 -1
  415. package/dist/packem_shared/useForm-CzV-Oext.js +0 -1
  416. package/dist/packem_shared/useHotkey-D0dGey14.js +0 -1
  417. package/dist/packem_shared/useInput-D1_jG26Z.js +0 -2
  418. package/dist/packem_shared/useInterval-AobjZT3u.js +0 -1
  419. package/dist/packem_shared/useIsScreenReaderEnabled-DjWHh-II.js +0 -1
  420. package/dist/packem_shared/useKeyBindings-zabkEJQs.js +0 -1
  421. package/dist/packem_shared/useKeyChord-CICQIxXj.js +0 -1
  422. package/dist/packem_shared/usePaste-CKKB9H-Z.js +0 -1
  423. package/dist/packem_shared/useScrollAcceleration-NrY1oVMs.js +0 -1
  424. package/dist/packem_shared/useScrollInput-Caghtn-Q.js +0 -1
  425. package/dist/packem_shared/useStderr-BDZb6InG.js +0 -1
  426. package/dist/packem_shared/useStdin-DKa4h35k.js +0 -1
  427. package/dist/packem_shared/useStdout-B-2lX4C5.js +0 -1
  428. package/dist/packem_shared/useStopwatch-DffK7iMh.js +0 -1
  429. package/dist/packem_shared/useTerminalPalette-Cv7tSduR.js +0 -1
  430. package/dist/packem_shared/useTextSelection-CGT0GLDR.js +0 -1
  431. package/dist/packem_shared/useTimeout-7LEFYTnG.js +0 -1
  432. package/dist/packem_shared/useTimer-DyoqSyGi.js +0 -1
  433. package/dist/packem_shared/useTreeView-8UlTK6sW.js +0 -1
  434. package/dist/packem_shared/useWindowSize-yDZsXF8z.js +0 -1
  435. package/dist/packem_shared/utils-THUhYKG2.js +0 -1
@@ -0,0 +1,400 @@
1
+ import { Node } from 'yoga-layout';
2
+ import '@visulima/colorize';
3
+ import 'cli-boxes';
4
+ import 'type-fest';
5
+ import { S as Styles } from "./styles.d-C1g4Iwzr.js";
6
+ type StyleSpan = {
7
+ bgColor?: string;
8
+ fgColor?: string;
9
+ formatFlags: number;
10
+ length: number;
11
+ link?: string;
12
+ };
13
+ declare class StyledLine {
14
+ length: number;
15
+ private static readonly emptyCache;
16
+ private text;
17
+ private charData;
18
+ private spans;
19
+ private _cachedTrimmedLength?;
20
+ static empty(length: number): StyledLine;
21
+ getValue(index: number): string;
22
+ /**
23
+ * Get the raw text for a range of characters as a single string slice.
24
+ * Much faster than calling getValue() per character.
25
+ */
26
+ getTextRange(start: number, end: number): string;
27
+ getSpan(index: number): StyleSpan | undefined;
28
+ getFullWidth(index: number): boolean;
29
+ hasStyles(index: number): boolean;
30
+ getFormatFlags(index: number): number;
31
+ getFgColor(index: number): string | undefined;
32
+ getBgColor(index: number): string | undefined;
33
+ getLink(index: number): string | undefined;
34
+ setInverted(index: number, inverted: boolean): void;
35
+ setBackgroundColor(index: number, color: string | undefined): void;
36
+ setForegroundColor(index: number, color: string | undefined): void;
37
+ setChar(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
38
+ /**
39
+ * Optimized setChar for same-length single-byte replacement.
40
+ * Skips string rebuild and offset adjustment when old and new values
41
+ * have the same byte length (the common case for ASCII overwrites on empty lines).
42
+ */
43
+ setCharFast(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
44
+ /**
45
+ * Overwrite a range of this line with content from a source StyledLine.
46
+ * More efficient than calling setChar() per character because it does
47
+ * a single span split + rebuild instead of per-character span manipulation.
48
+ * @param destinationStart — start index in this line
49
+ * @param source — the StyledLine to copy from
50
+ * @param srcStart — start index in source (default 0)
51
+ * @param count — number of characters to copy (default: source.length)
52
+ */
53
+ writeFrom(destinationStart: number, source: StyledLine, srcStart?: number, count?: number): void;
54
+ pushChar(value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
55
+ clone(): StyledLine;
56
+ slice(start: number, end?: number): StyledLine;
57
+ combine(...others: StyledLine[]): StyledLine;
58
+ getTrimmedLength(): number;
59
+ trimEnd(): StyledLine;
60
+ equals(other: StyledLine): boolean;
61
+ getText(): string;
62
+ getSpans(): StyleSpan[];
63
+ getValues(): string[];
64
+ [Symbol.iterator](): Iterator<{
65
+ bgColor?: string;
66
+ fgColor?: string;
67
+ formatFlags: number;
68
+ fullWidth: boolean;
69
+ hasStyles: boolean;
70
+ link?: string;
71
+ value: string;
72
+ }>;
73
+ /**
74
+ * Split the span at `index` into a single-char span, apply the updater,
75
+ * then merge adjacent spans. Shared by setInverted/setBackgroundColor/setForegroundColor.
76
+ */
77
+ private updateSpanAt;
78
+ /**
79
+ * Grow the line to at least `minWidth` columns, filling new cells with
80
+ * empty strings (zero-width placeholders). This matches the behavior of
81
+ * sparse JS arrays in the original ink Output where out-of-bounds writes
82
+ * created gaps that produced no visible output.
83
+ */
84
+ ensureWidth(minWidth: number): void;
85
+ private ensureInitialized;
86
+ private splitSpansAt;
87
+ /**
88
+ * Try to apply a single-char style at `index` by matching or merging
89
+ * with an adjacent span, avoiding splitSpansAt + mergeSpans.
90
+ *
91
+ * Returns true if the style was applied (or was already correct),
92
+ * false if the caller must fall through to the split/update/merge path.
93
+ *
94
+ * Ported from jacob314/ink PR #123 (Google LLC, Apache-2.0).
95
+ */
96
+ private trySetStyleAtIndex;
97
+ private mergeSpans;
98
+ }
99
+ type Region = {
100
+ backgroundColor?: string;
101
+ borderBottom?: number;
102
+ borderTop?: number;
103
+ cachedStickyHeaders?: StickyHeader$1[]; /** Child regions (nested content areas) */
104
+ children: Region[];
105
+ /** Cursor position within this region */
106
+ cursorPosition?: {
107
+ col: number;
108
+ row: number;
109
+ };
110
+ height: number; /** Unique identifier for this region (used for dirty tracking) */
111
+ id: number | string;
112
+ isHorizontallyScrollable?: boolean; /** Whether this region supports scrolling */
113
+ isScrollable: boolean;
114
+ isVerticallyScrollable?: boolean; /** Content buffer — StyledLine per row, relative to (0,0) of this region */
115
+ readonly lines: ReadonlyArray<StyledLine>;
116
+ marginBottom?: number;
117
+ marginRight?: number; /** DOM node reference for debugging/caching */
118
+ nodeId?: number;
119
+ opaque?: boolean; /** Layout properties */
120
+ overflowToBackbuffer?: boolean;
121
+ scrollbarThumbColor?: string;
122
+ scrollbarVisible?: boolean;
123
+ scrollHeight?: number;
124
+ scrollLeft?: number; /** Scroll state */
125
+ scrollTop?: number;
126
+ scrollWidth?: number; /** Selectable text spans for text selection */
127
+ selectableSpans: SelectableSpan[];
128
+ selectableText?: string; /** Whether the scrollback position is stable */
129
+ stableScrollback?: boolean;
130
+ /** Sticky headers for this region */
131
+ stickyHeaders: StickyHeader$1[];
132
+ /** Trimmed output (trailing spaces removed) for final rendering */
133
+ readonly styledOutput: ReadonlyArray<StyledLine>;
134
+ /** Dimensions */
135
+ width: number;
136
+ /** Position relative to parent region */
137
+ x: number;
138
+ y: number;
139
+ };
140
+ type SelectableSpan = {
141
+ endX: number;
142
+ startX: number;
143
+ text: string;
144
+ y: number;
145
+ };
146
+ type StickyHeader$1 = {
147
+ /** Lines in the natural (scrolling) position */
148
+ lines: ReadonlyArray<StyledLine>;
149
+ /** Height of the header in lines */
150
+ maxHeaderHeight: number;
151
+ /** Natural row offset relative to content start */
152
+ naturalRow: number;
153
+ /** Node ID for identification */
154
+ nodeId: number;
155
+ /** Lines in the stuck (fixed) position */
156
+ stuckLines?: ReadonlyArray<StyledLine>;
157
+ /** Stuck X position relative to region */
158
+ x: number;
159
+ /** Stuck Y position relative to region */
160
+ y: number;
161
+ };
162
+ type OutputTransformer = (s: string, index: number) => string;
163
+ type ResizeObserverCallback = (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;
164
+ declare class ResizeObserverEntry {
165
+ readonly target: DOMElement;
166
+ readonly contentRect: Readonly<{
167
+ height: number;
168
+ width: number;
169
+ }>;
170
+ constructor(target: DOMElement, contentRect: Readonly<{
171
+ height: number;
172
+ width: number;
173
+ }>);
174
+ }
175
+ declare class ResizeObserver {
176
+ private readonly callback;
177
+ private readonly observedElements;
178
+ constructor(callback: ResizeObserverCallback);
179
+ observe(element: DOMElement): void;
180
+ unobserve(element: DOMElement): void;
181
+ disconnect(): void;
182
+ /**
183
+ * Internal method called by the layout engine after computing layout.
184
+ */
185
+ internalTrigger(entries: ResizeObserverEntry[]): void;
186
+ }
187
+ /**
188
+ * Measure a node and collect resize observer entries for it.
189
+ * Used by both the main render loop and static render processing.
190
+ */
191
+ type ScrollState = {
192
+ actualScrollHeight: number;
193
+ clientHeight: number;
194
+ clientWidth: number;
195
+ scrollHeight: number;
196
+ scrollLeft: number;
197
+ scrollTop: number;
198
+ scrollWidth: number;
199
+ };
200
+ declare const getScrollHeight: (node: DOMElement) => number;
201
+ declare const getScrollWidth: (node: DOMElement) => number;
202
+ declare const calculateScroll: (node: DOMElement) => void;
203
+ /**
204
+ * Get the effective scroll top position from the pre-computed scroll state.
205
+ * Falls back to computing from style if scroll state hasn't been calculated yet.
206
+ */
207
+ declare const getScrollTop: (node: DOMElement) => number;
208
+ /**
209
+ * Get the effective scroll left position from the pre-computed scroll state.
210
+ * Falls back to computing from style if scroll state hasn't been calculated yet.
211
+ */
212
+ declare const getScrollLeft: (node: DOMElement) => number;
213
+ type InkNode = {
214
+ internal_static?: boolean;
215
+ parentNode: DOMElement | undefined;
216
+ style: Styles;
217
+ yogaNode?: Node;
218
+ };
219
+ type LayoutListener = () => void;
220
+ type TextName = "#text";
221
+ type ElementNames = "ink-root" | "ink-box" | "ink-text" | "ink-cursor" | "ink-virtual-text" | "ink-static-render";
222
+ /**
223
+ * Describes a sticky header that should be composited on top of scrolled content.
224
+ * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
225
+ */
226
+ type StickyHeader = {
227
+ /** Content-relative end row. */
228
+ endRow: number;
229
+ /** Height in rows. */
230
+ height?: number;
231
+ /** If true, natural 'lines' are already in background content. */
232
+ isStuckOnly: boolean;
233
+ /** Lines rendered in the natural (scrolling) position. */
234
+ lines: ReadonlyArray<StyledLine>;
235
+ /** Natural row offset relative to content start. */
236
+ naturalRow: number;
237
+ /** Reference to the DOM node for this header. */
238
+ node?: DOMElement;
239
+ /** Unique ID of the sticky node. */
240
+ nodeId: number;
241
+ /** ID of the scroll container this header belongs to. */
242
+ scrollContainerId: number | string;
243
+ /** Content-relative start row. */
244
+ startRow: number;
245
+ /** Lines rendered in the stuck (pinned) position, if different. */
246
+ stuckLines?: ReadonlyArray<StyledLine>;
247
+ /** Sticky type: top-pinned or bottom-pinned. */
248
+ type?: "top" | "bottom";
249
+ /** Stuck X position relative to region. */
250
+ x: number;
251
+ /** Stuck Y position relative to region. */
252
+ y: number;
253
+ };
254
+ type NodeNames = ElementNames | TextName;
255
+ type CursorAnchorRef = {
256
+ readonly current: DOMElement | undefined | null;
257
+ };
258
+ type CursorMarker = {
259
+ anchorRef?: CursorAnchorRef;
260
+ inline?: boolean;
261
+ x: number;
262
+ y: number;
263
+ };
264
+ type DOMElement = InkNode & {
265
+ attributes: Record<string, DOMNodeAttribute>;
266
+ /**
267
+ * Cached render result (a Region). When set, the entire subtree is
268
+ * skipped during rendering and the cached region is composited directly.
269
+ * Set by setCachedRender(), cleared on unmount by cleanupNodeTree().
270
+ */
271
+ cachedRender?: Region;
272
+ childNodes: DOMNode[];
273
+ internal_accessibility?: {
274
+ role?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
275
+ state?: {
276
+ busy?: boolean;
277
+ checked?: boolean;
278
+ disabled?: boolean;
279
+ expanded?: boolean;
280
+ multiline?: boolean;
281
+ multiselectable?: boolean;
282
+ readonly?: boolean;
283
+ required?: boolean;
284
+ selected?: boolean;
285
+ };
286
+ };
287
+ internal_cursor?: CursorMarker;
288
+ internal_hidden?: boolean;
289
+ /**
290
+ * Auto-incrementing unique identifier for this node.
291
+ */
292
+ internal_id: number;
293
+ /**
294
+ * Whether this element's scrollback buffer is dirty (needs recalculation).
295
+ */
296
+ internal_isScrollbackDirty?: boolean;
297
+ /**
298
+ * Last measured size for ResizeObserver tracking.
299
+ */
300
+ internal_lastMeasuredSize?: {
301
+ height: number;
302
+ width: number;
303
+ };
304
+ internal_layoutListeners?: Set<LayoutListener>;
305
+ /**
306
+ * Maximum scrollTop ever reached, used with stableScrollback.
307
+ */
308
+ internal_maxScrollTop?: number;
309
+ /**
310
+ * Callback invoked after prepareYogaTree() caches the render output for
311
+ * an ink-static-render node. StaticRender uses this to set `isRendered`
312
+ * state, which prevents React from re-reconciling children once cached.
313
+ */
314
+ internal_onRendered?: () => void;
315
+ /**
316
+ * Whether this element is opaque (prevents rendering of covered content beneath it).
317
+ */
318
+ internal_opaque?: boolean;
319
+ /**
320
+ * Whether the scrollbar should be rendered for this scrollable element.
321
+ * Defaults to true for elements with overflow: 'scroll'.
322
+ */
323
+ internal_scrollbar?: boolean;
324
+ /**
325
+ * Scroll state computed by calculateScroll() for elements with overflow: 'scroll'.
326
+ */
327
+ internal_scrollState?: ScrollState;
328
+ /**
329
+ * Whether this element is sticky (pinned during scroll).
330
+ * - `true` or `'top'`: pinned to the top of the scroll container
331
+ * - `'bottom'`: pinned to the bottom of the scroll container
332
+ */
333
+ internal_sticky?: boolean | "top" | "bottom";
334
+ /**
335
+ * Whether this element is the alternate (stuck) version of a sticky header.
336
+ * The stuck version is rendered when the header is pinned.
337
+ */
338
+ internal_stickyAlternate?: boolean;
339
+ /**
340
+ * Whether this element should receive the terminal cursor focus.
341
+ */
342
+ internal_terminalCursorFocus?: boolean;
343
+ /**
344
+ * Terminal cursor position offset within this element.
345
+ */
346
+ internal_terminalCursorPosition?: number;
347
+ /**
348
+ * Cached text squash result for this node's subtree.
349
+ * Invalidated by markNodeAsDirty() when children change.
350
+ */
351
+ internal_textCache?: {
352
+ map: Map<DOMNode, {
353
+ end: number;
354
+ start: number;
355
+ }>;
356
+ text: string;
357
+ };
358
+ internal_transform?: OutputTransformer;
359
+ isStaticDirty?: boolean;
360
+ /**
361
+ * Whether the Yoga subtree has been detached (children removed from Yoga layout)
362
+ * because a cachedRender was set. When cachedRender is invalidated,
363
+ * prepareYogaTree() re-attaches the children before the next layout pass.
364
+ */
365
+ isYogaTreeDetached?: boolean;
366
+ nodeName: ElementNames;
367
+ onComputeLayout?: () => void;
368
+ onImmediateRender?: () => void;
369
+ onRender?: () => void;
370
+ /**
371
+ * Set of ResizeObservers attached to this element.
372
+ */
373
+ resizeObservers?: Set<ResizeObserver>;
374
+ staticNode?: DOMElement;
375
+ };
376
+ type TextNode = InkNode & {
377
+ nodeName: TextName;
378
+ nodeValue: string;
379
+ };
380
+ type DOMNode<T = {
381
+ nodeName: NodeNames;
382
+ }> = T extends {
383
+ nodeName: infer U;
384
+ } ? U extends "#text" ? TextNode : DOMElement : never;
385
+ type DOMNodeAttribute = boolean | string | number;
386
+ /**
387
+ * Get the path from the root to this node (inclusive).
388
+ * Returns an array starting with the root and ending with the node.
389
+ *
390
+ * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
391
+ */
392
+ declare const getPathToRoot: (node: DOMNode) => DOMNode[];
393
+ /**
394
+ * Check if a node is selectable by walking up the tree checking `userSelect` style.
395
+ * Returns true by default unless an ancestor has `userSelect: 'none'`.
396
+ *
397
+ * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
398
+ */
399
+ declare const isNodeSelectable: (node: DOMElement) => boolean;
400
+ export { DOMNode as D, ResizeObserver as R, StyledLine as S, DOMElement as a, ResizeObserverCallback as b, ResizeObserverEntry as c, ScrollState as d, StickyHeader as e, calculateScroll as f, getPathToRoot as g, getScrollHeight as h, getScrollLeft as i, getScrollTop as j, getScrollWidth as k, isNodeSelectable as l };
@@ -0,0 +1,2 @@
1
+ var F=Object.defineProperty;var M=(t,e)=>F(t,"name",{value:e,configurable:!0});import l from"yoga-layout";import{getScrollTop as k,getScrollLeft as W}from"./getScrollHeight-BTEY8ewu.js";import Y from"./squashTextNodesWithMap-Cpqmc45i.js";var A=Object.defineProperty,c=M((t,e)=>A(t,"name",{value:e,configurable:!0}),"u");const Q=c(t=>{const e=j(t);return{height:Math.round(t.yogaNode?.getComputedHeight()??0),width:Math.round(t.yogaNode?.getComputedWidth()??0),x:Math.round(e?.x??0),y:Math.round(e?.y??0)}},"measureElement"),Z=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedWidth()??0,r=e.getComputedBorder(l.EDGE_LEFT),s=e.getComputedBorder(l.EDGE_RIGHT);return Math.round(o-r-s)},"getInnerWidth"),tt=c(t=>{const{yogaNode:e}=t;if(!e)return 0;const o=e.getComputedHeight()??0,r=e.getComputedBorder(l.EDGE_TOP),s=e.getComputedBorder(l.EDGE_BOTTOM);return Math.round(o-r-s)},"getInnerHeight"),O=c(t=>{const{yogaNode:e}=t;if(!e)return{height:0,width:0,x:0,y:0};const o=e.getComputedWidth()??0,r=e.getComputedHeight()??0;let s=e.getComputedLeft(),n=e.getComputedTop(),d=t.parentNode;for(;d?.yogaNode;){if(s+=d.yogaNode.getComputedLeft(),n+=d.yogaNode.getComputedTop(),d.nodeName==="ink-box"){const a=d.style.overflow??"visible",i=d.style.overflowX??a;(d.style.overflowY??a)==="scroll"&&(n-=k(d)),i==="scroll"&&(s-=W(d))}d=d.parentNode}return{height:Math.round(r),width:Math.round(o),x:Math.round(s),y:Math.round(n)}},"getBoundingBox"),et=c(t=>{const e=t.internal_scrollState?.scrollHeight??0,o=t.internal_scrollState?.actualScrollHeight??0;return Math.max(0,e-o)},"getAddedScrollHeight"),G=c(t=>{const{axis:e,clientDimension:o,scrollbarDimension:r,scrollDimension:s,scrollPosition:n}=t,d=r*2,a=Math.max(e==="vertical"?2:1,Math.round(o/s*d)),i=s-o,g=d-a,u=i>0?Math.round(n/i*g):0,m=u,h=u+a,p=Math.floor(m/2);return{endIndex:Math.min(r,Math.ceil(h/2)),startIndex:p,thumbEndHalf:h,thumbStartHalf:m}},"calculateScrollbarThumb"),L=c(t=>{const{axis:e,clientDimension:o,hasOppositeScrollbar:r,height:s,marginBottom:n,marginRight:d,scrollDimension:a,scrollPosition:i,width:g,x:u,y:m}=t;if(a<=o)return;if(e==="vertical"){const{endIndex:x,startIndex:B,thumbEndHalf:v,thumbStartHalf:D}=G({axis:e,clientDimension:o,scrollbarDimension:s,scrollDimension:a,scrollPosition:i}),E=u+g-1-d;return{height:s,thumb:{end:x,endHalf:v,height:x-B,start:B,startHalf:D,width:1,x:E,y:m+B},width:1,x:E,y:m}}const h=g-(r?1:0),{endIndex:p,startIndex:y,thumbEndHalf:C,thumbStartHalf:f}=G({axis:e,clientDimension:o,scrollbarDimension:h,scrollDimension:a,scrollPosition:i}),T=m+s-1-n;return{height:1,thumb:{end:p,endHalf:C,height:1,start:y,startHalf:f,width:p-y,x:u+y,y:T},width:h,x:u,y:T}},"calculateScrollbarLayout"),ot=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowY??r)!=="scroll")return;const s=t.internal_scrollState?.clientHeight??0,n=t.internal_scrollState?.scrollHeight??0;if(n<=s)return;const{x:d,y:a}=e??O(t),i=o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP)-o.getComputedBorder(l.EDGE_BOTTOM);return L({axis:"vertical",clientDimension:s,hasOppositeScrollbar:!1,height:i,marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollTop??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getVerticalScrollbarBoundingBox"),nt=c((t,e)=>{const{yogaNode:o}=t;if(!o)return;const r=t.style.overflow??"visible";if((t.style.overflowX??r)!=="scroll")return;const s=t.internal_scrollState?.clientWidth??0,n=t.internal_scrollState?.scrollWidth??0;if(n<=s)return;const{x:d,y:a}=e??O(t),i=t.style.overflowY??r,g=t.internal_scrollState?.clientHeight??0,u=t.internal_scrollState?.scrollHeight??0,m=i==="scroll"&&u>g;return L({axis:"horizontal",clientDimension:s,hasOppositeScrollbar:m,height:o.getComputedHeight()-o.getComputedBorder(l.EDGE_TOP),marginBottom:o.getComputedBorder(l.EDGE_BOTTOM),marginRight:o.getComputedBorder(l.EDGE_RIGHT),scrollDimension:n,scrollPosition:t.internal_scrollState?.scrollLeft??0,width:o.getComputedWidth()-o.getComputedBorder(l.EDGE_LEFT)-o.getComputedBorder(l.EDGE_RIGHT),x:d+o.getComputedBorder(l.EDGE_LEFT),y:a+o.getComputedBorder(l.EDGE_TOP)})},"getHorizontalScrollbarBoundingBox"),rt=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedTop(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedTop()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeTop"),at=c((t,e)=>{if(!t.yogaNode||t===e)return 0;let o=t.yogaNode.getComputedLeft(),r=t.parentNode;for(;r&&r!==e;)r.yogaNode&&(o+=r.yogaNode.getComputedLeft()),r=r.parentNode;if(!(e!==void 0&&r!==e))return Math.round(o)},"getRelativeLeft"),$=c(t=>t.nodeName==="#text"?t.nodeValue:t.nodeName==="ink-text"||t.nodeName==="ink-virtual-text"?Y(t):"","getText"),V=c(t=>{const e=[],o=c((n,d,a)=>{const{visualX:i,visualY:g,x:u,y:m}=d;let h=0,p=0,y=a;const{userSelect:C}=n.style;if(C==="none"?y=!1:(C==="text"||C==="all")&&(y=!0),n.nodeName==="ink-text"||n.nodeName==="ink-virtual-text"){if(y){const f=$(n);return e.push({height:Math.round(n.yogaNode?.getComputedHeight()??0),node:n,text:f,visualX:Math.round(i),visualY:Math.round(g),width:Math.round(n.yogaNode?.getComputedWidth()??0),x:Math.round(u),y:Math.round(m)}),{h:0,hasContent:!0,v:0}}return{h:n.yogaNode?.getComputedWidth()??0,hasContent:!1,v:n.yogaNode?.getComputedHeight()??0}}if(n.nodeName==="ink-box"||n.nodeName==="ink-root"){if(!n.yogaNode||n.yogaNode.getDisplay()===l.DISPLAY_NONE)return{h:0,hasContent:!1,v:0};const f=n.yogaNode.getComputedBorder(l.EDGE_TOP),T=n.yogaNode.getComputedBorder(l.EDGE_BOTTOM),x=n.yogaNode.getComputedBorder(l.EDGE_LEFT),B=n.yogaNode.getComputedBorder(l.EDGE_RIGHT);h+=f+T,p+=x+B;const v=n.yogaNode.getFlexDirection(),D=v===l.FLEX_DIRECTION_COLUMN||v===l.FLEX_DIRECTION_COLUMN_REVERSE;let E=0,b=0,S=!1;for(const N of n.childNodes)if(N.yogaNode){const w=u+N.yogaNode.getComputedLeft()-x-E,I=m+N.yogaNode.getComputedTop()-f-b,R=i+N.yogaNode.getComputedLeft(),X=g+N.yogaNode.getComputedTop(),H=o(N,{visualX:R,visualY:X,x:w,y:I},y);H.hasContent&&(S=!0),D?b+=H.v:E+=H.h}return D?h+=b:p+=E,{h:p,hasContent:S,v:h}}return{h:0,hasContent:!1,v:0}},"collect"),{h:r,v:s}=o(t,{visualX:0,visualY:0,x:0,y:0},!0);return e.sort((n,d)=>n.y!==d.y?n.y-d.y:n.x-d.x),{fragments:e,removedHorizontal:Math.round(r),removedVertical:Math.round(s)}},"collectSortedFragments");var z=Object.defineProperty,_=M((t,e)=>z(t,"name",{value:e,configurable:!0}),"a");const P=_(t=>{let e=t,o=0,r=0;for(;e?.parentNode;){if(!e.yogaNode)return;o+=e.yogaNode.getComputedLeft(),r+=e.yogaNode.getComputedTop(),e=e.parentNode}return{x:o,y:r}},"getAbsoluteBorderPosition"),j=_(t=>P(t),"getAbsolutePosition"),it=_(t=>{const e=P(t);if(!(!e||!t.yogaNode))return{x:e.x+t.yogaNode.getComputedBorder(l.EDGE_LEFT)+t.yogaNode.getComputedPadding(l.EDGE_LEFT),y:e.y+t.yogaNode.getComputedBorder(l.EDGE_TOP)+t.yogaNode.getComputedPadding(l.EDGE_TOP)}},"getAbsoluteContentPosition"),lt=_((t,e)=>{const{initialState:o,onNewline:r,onSpace:s,onText:n}=e;if(t.nodeName!=="ink-box"&&t.nodeName!=="ink-root"&&t.nodeName!=="ink-text"&&t.nodeName!=="ink-virtual-text"||!t.yogaNode)return{lineBottom:0,state:o()};const{fragments:d}=V(t),a=o();a.currentX=0,a.lineBottom=0,a.yieldedContent=!1;for(const i of d){if(i.y>=a.lineBottom){const g=i.y-a.lineBottom,u=a.yieldedContent?1+g:g;u>0&&(r(u,a),a.currentX=0),a.lineBottom=i.y}if(i.x>a.currentX){const g=i.x-a.currentX;s(g,a),a.currentX=i.x}if(i.text.length>0&&(a.yieldedContent=!0,n(i,a)),(i.text.match(/\n/g)??[]).length>0){const g=i.text.lastIndexOf(`
2
+ `);a.currentX=i.text.length-g-1}else a.currentX+=i.text.length;a.lineBottom=Math.max(a.lineBottom,i.y+i.height)}return{lineBottom:a.lineBottom,state:a}},"processLayout");export{Q as P,G as a,V as b,L as c,O as d,nt as e,tt as f,et as g,Z as h,at as i,rt as j,$ as k,ot as l,it as m,j as n,lt as p};
@@ -0,0 +1 @@
1
+ var T=Object.defineProperty;var I=(e,o)=>T(e,"name",{value:o,configurable:!0});import{jsxs as d,jsx as h}from"react/jsx-runtime";import{useMemo as g}from"react";import{c as E}from"./braille-BBjIoaN0.js";import{Box as u}from"../components/box.js";import{Canvas as b}from"../components/canvas.js";import{Text as f}from"../components/text.js";var P=Object.defineProperty,y=I((e,o)=>P(e,"name",{value:o,configurable:!0}),"i");const C=["cyan","magenta","yellow","green","blue","red"],v=y(e=>e.length===0?[]:typeof e[0]=="number"?e.map((o,t)=>({x:t,y:o})):e,"toPoints"),w=y((e,o,t)=>e.color??t[o%t.length]??"cyan","pickSeriesColor"),Y=y(e=>{let o=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const{points:l}of e)for(const r of l)r.x<o&&(o=r.x),r.x>t&&(t=r.x),r.y<n&&(n=r.y),r.y>s&&(s=r.y);return{xMax:t,xMin:o,yMax:s,yMin:n}},"computeExtents");var _=Object.defineProperty,N=I((e,o)=>_(e,"name",{value:o,configurable:!0}),"x");const F=C,M=N((e,o,t,n)=>{const s=o.xMax-o.xMin||1,l=o.yMax-o.yMin||1,r=(e.x-o.xMin)/s,c=(e.y-o.yMin)/l;return{px:Math.max(0,Math.min(t-1,Math.round(r*(t-1)))),py:Math.max(0,Math.min(n-1,Math.round((1-c)*(n-1))))}},"projectPoint"),S=N((e,o,t)=>{e.clear();const{axisColor:n,seriesList:s}=t,l=Math.max(1,e.width*2),r=Math.max(1,e.height*4);for(let c=0;c<e.width;c+=2)e.setCell(c,e.height-1,"·",{color:n,dim:!0});for(const{color:c,points:p}of s){if(p.length===0)continue;const x=E(e.width,e.height);if(o==="scatter")for(const i of p){const a=M(i,t,l,r);x.plotPoint(a.px,a.py)}else{let i=M(p[0],t,l,r);x.plotPoint(i.px,i.py);for(let a=1;a<p.length;a+=1){const m=M(p[a],t,l,r);x.plotLine(i.px,i.py,m.px,m.py),i=m}}x.flush(e,{color:c})}},"drawSeriesOnCanvas");function L({axisColor:e="gray",height:o=10,maxY:t,minY:n,palette:s=F,series:l,showLegend:r=!0,width:c=40}){const p=g(()=>{const x=l.map((a,m)=>({color:w(a,m,s),points:v(a.data),series:a})),i=Y(x);return{axisColor:e,palette:s,seriesList:x,xMax:i.xMax===Number.NEGATIVE_INFINITY?1:i.xMax,xMin:i.xMin===Number.POSITIVE_INFINITY?0:i.xMin,yMax:t??(i.yMax===Number.NEGATIVE_INFINITY?1:i.yMax),yMin:n??(i.yMin===Number.POSITIVE_INFINITY?0:i.yMin)}},[l,e,s,n,t]);return d(u,{flexDirection:"column",children:[h(b,{draw:I(x=>{S(x,"line",p)},"draw"),height:o,version:[l,c,o,n,t,e,s],width:c}),r?h(u,{gap:2,marginTop:1,children:p.seriesList.map(({color:x,series:i},a)=>d(u,{gap:1,children:[h(f,{color:x,children:"●"}),h(f,{children:i.label??`Series ${a+1}`})]},`${a}:${i.label??""}`))}):void 0]})}I(L,"f");N(L,"LineChart");export{C as D,M as a,Y as c,S as d,L as f,w as p,v as t};
@@ -0,0 +1 @@
1
+ import"yoga-layout";import{c as r,a as g,b as i,P as s,g as c,d as n,e as d,f as u,h as b,i as m,j as B,k as S,l as h}from"./layout-P24eyWyL.js";import"./getScrollHeight-BTEY8ewu.js";import"./squashTextNodesWithMap-Cpqmc45i.js";export{r as calculateScrollbarLayout,g as calculateScrollbarThumb,i as collectSortedFragments,s as default,c as getAddedScrollHeight,n as getBoundingBox,d as getHorizontalScrollbarBoundingBox,u as getInnerHeight,b as getInnerWidth,m as getRelativeLeft,B as getRelativeTop,S as getText,h as getVerticalScrollbarBoundingBox};
@@ -0,0 +1 @@
1
+ import"yoga-layout";import{m as e,n as i,p as n}from"./layout-P24eyWyL.js";export{e as getAbsoluteContentPosition,i as getAbsolutePosition,n as processLayout};
@@ -1 +1 @@
1
- var y=Object.defineProperty;var c=(e,t)=>y(e,"name",{value:t,configurable:!0});import{createContext as b}from"react";import T from"react-reconciler";import{NoEventPriority as C,DefaultEventPriority as I,DiscreteEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as k,unstable_scheduleCallback as x,unstable_now as S,unstable_cancelCallback as E}from"scheduler";import{LayoutNode as f}from"./LayoutNode-rxblE317.js";import{applyStyles as h,resolveColor as g}from"./NAMED_COLORS-B9fJsYdg.js";import{g as N}from"./text-width-CZ9vPvM0.js";var A=Object.defineProperty,n=c((e,t)=>A(e,"name",{value:t,configurable:!0}),"o");let m=null;function _(e){m=e}c(_,"setOnAfterCommit");n(_,"setOnAfterCommit");let u=C;function p(e){const t=g(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=g(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let r;return e.styles===void 0?(r=0,e.bold&&(r|=1),(e.dim||e.dimColor)&&(r|=2),e.italic&&(r|=4),e.underline&&(r|=8),e.blink&&(r|=16),e.inverse&&(r|=32),e.hidden&&(r|=64),e.strikethrough&&(r|=128)):r=e.styles,{bg:o,fg:t,styles:r}}c(p,"m");n(p,"resolveNodeColors");const U={afterActiveInstanceBlur:n(()=>{},"afterActiveInstanceBlur"),appendChild(e,t){e.insertChild(t,e.children.length)},appendChildToContainer(e,t){e.insertChild(t,e.children.length)},appendInitialChild(e,t){e.insertChild(t,e.children.length)},beforeActiveInstanceBlur:n(()=>{},"beforeActiveInstanceBlur"),cancelCallback:E,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,r,a){h(e.yogaNode,r);const{bg:i,fg:s,styles:d}=p(r);e.fg=s,e.bg=i,e.styles=d,e._style=r,e.transform=typeof r.transform=="function"?r.transform:void 0},createInstance(e,t,o,r,a){const i=new f,s={...t};s.flexDirection===void 0&&(s.flexDirection="row"),s.flexShrink===void 0&&(s.flexShrink=1),h(i.yogaNode,s);const{bg:d,fg:l,styles:v}=p(t);return i.fg=l,i.bg=d,i.styles=v,i._style=t,typeof t.transform=="function"&&(i.transform=t.transform),i},createTextInstance(e,t,o,r){const a=new f;return a.text=e,a.yogaNode.setWidth(N(e)),a.yogaNode.setHeight(1),a},detachDeletedInstance:n(e=>{e.destroy()},"detachDeletedInstance"),finalizeInitialChildren(e,t,o,r,a){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:n(()=>P,"getCurrentEventPriority"),getCurrentUpdatePriority:n(()=>u,"getCurrentUpdatePriority"),getInstanceFromNode:n(()=>null,"getInstanceFromNode"),getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:b(null),insertBefore(e,t,o){t.parent&&t.remove();const r=e.children.indexOf(o);e.insertChild(t,r)},isPrimaryRenderer:!0,maySuspendCommit:n(()=>!0,"maySuspendCommit"),noTimeout:-1,NotPendingTransition:void 0,now:S,preloadInstance:n(()=>!0,"preloadInstance"),prepareForCommit(e){return null},preparePortalMount:n(()=>{},"preparePortalMount"),prepareScopeUpdate:n(()=>{},"prepareScopeUpdate"),prepareUpdate(e,t,o,r,a,i){const s=Object.keys(o).filter(l=>l!=="children"),d=Object.keys(r).filter(l=>l!=="children");if(s.length!==d.length)return!0;for(const l of d)if(o[l]!==r[l])return!0;return null},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:n(()=>{},"requestPostPaintCallback"),resetAfterCommit(e){typeof m=="function"&&m()},resolveEventTimeStamp:n(()=>-1.1,"resolveEventTimeStamp"),resolveEventType:n(()=>null,"resolveEventType"),resolveUpdatePriority(){return u!==C?u:I},scheduleCallback:x,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){u=e},shouldAttemptEagerTransition:n(()=>!1,"shouldAttemptEagerTransition"),shouldSetTextContent(e,t){return!1},shouldYield:k,startSuspendingCommit:n(()=>{},"startSuspendingCommit"),supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:n(()=>{},"suspendInstance"),trackSchedulerEvent:n(()=>{},"trackSchedulerEvent"),unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:n(()=>null,"waitForCommitToBeReady"),warnsIfNotActing:!0},j=T(U);export{j as T,_ as s};
1
+ var y=Object.defineProperty;var c=(e,t)=>y(e,"name",{value:t,configurable:!0});import{createContext as b}from"react";import T from"react-reconciler";import{NoEventPriority as C,DefaultEventPriority as I,DiscreteEventPriority as P}from"react-reconciler/constants.js";import{unstable_shouldYield as k,unstable_scheduleCallback as x,unstable_now as S,unstable_cancelCallback as E}from"scheduler";import{LayoutNode as f}from"./LayoutNode-B8zej4dm.js";import{applyStyles as h,resolveColor as g}from"./NAMED_COLORS-B9fJsYdg.js";import{a as N}from"./text-width-BU2eeTWn.js";var A=Object.defineProperty,n=c((e,t)=>A(e,"name",{value:t,configurable:!0}),"o");let m=null;function _(e){m=e}c(_,"setOnAfterCommit");n(_,"setOnAfterCommit");let u=C;function p(e){const t=g(e.fg===void 0?e.color===void 0?void 0:e.color:e.fg),o=g(e.bg===void 0?e.backgroundColor===void 0?void 0:e.backgroundColor:e.bg);let r;return e.styles===void 0?(r=0,e.bold&&(r|=1),(e.dim||e.dimColor)&&(r|=2),e.italic&&(r|=4),e.underline&&(r|=8),e.blink&&(r|=16),e.inverse&&(r|=32),e.hidden&&(r|=64),e.strikethrough&&(r|=128)):r=e.styles,{bg:o,fg:t,styles:r}}c(p,"m");n(p,"resolveNodeColors");const U={afterActiveInstanceBlur:n(()=>{},"afterActiveInstanceBlur"),appendChild(e,t){e.insertChild(t,e.children.length)},appendChildToContainer(e,t){e.insertChild(t,e.children.length)},appendInitialChild(e,t){e.insertChild(t,e.children.length)},beforeActiveInstanceBlur:n(()=>{},"beforeActiveInstanceBlur"),cancelCallback:E,cancelTimeout:clearTimeout,clearContainer(e){},commitTextUpdate(e,t,o){e.text=o,e.yogaNode.markDirty()},commitUpdate(e,t,o,r,a){h(e.yogaNode,r);const{bg:i,fg:s,styles:d}=p(r);e.fg=s,e.bg=i,e.styles=d,e._style=r,e.transform=typeof r.transform=="function"?r.transform:void 0},createInstance(e,t,o,r,a){const i=new f,s={...t};s.flexDirection===void 0&&(s.flexDirection="row"),s.flexShrink===void 0&&(s.flexShrink=1),h(i.yogaNode,s);const{bg:d,fg:l,styles:v}=p(t);return i.fg=l,i.bg=d,i.styles=v,i._style=t,typeof t.transform=="function"&&(i.transform=t.transform),i},createTextInstance(e,t,o,r){const a=new f;return a.text=e,a.yogaNode.setWidth(N(e)),a.yogaNode.setHeight(1),a},detachDeletedInstance:n(e=>{e.destroy()},"detachDeletedInstance"),finalizeInitialChildren(e,t,o,r,a){return!1},getChildHostContext(e,t,o){return{isInsideText:t==="text"}},getCurrentEventPriority:n(()=>P,"getCurrentEventPriority"),getCurrentUpdatePriority:n(()=>u,"getCurrentUpdatePriority"),getInstanceFromNode:n(()=>null,"getInstanceFromNode"),getPublicInstance(e){return e},getRootHostContext(e){return{isInsideText:!1}},hideInstance(e){e._hidden=!0},hideTextInstance(e){e._hidden=!0},HostTransitionContext:b(null),insertBefore(e,t,o){t.parent&&t.remove();const r=e.children.indexOf(o);e.insertChild(t,r)},isPrimaryRenderer:!0,maySuspendCommit:n(()=>!0,"maySuspendCommit"),noTimeout:-1,NotPendingTransition:void 0,now:S,preloadInstance:n(()=>!0,"preloadInstance"),prepareForCommit(e){return null},preparePortalMount:n(()=>{},"preparePortalMount"),prepareScopeUpdate:n(()=>{},"prepareScopeUpdate"),prepareUpdate(e,t,o,r,a,i){const s=Object.keys(o).filter(l=>l!=="children"),d=Object.keys(r).filter(l=>l!=="children");if(s.length!==d.length)return!0;for(const l of d)if(o[l]!==r[l])return!0;return null},removeChild(e,t){t.remove()},removeChildFromContainer(e,t){t.remove()},requestPostPaintCallback:n(()=>{},"requestPostPaintCallback"),resetAfterCommit(e){typeof m=="function"&&m()},resolveEventTimeStamp:n(()=>-1.1,"resolveEventTimeStamp"),resolveEventType:n(()=>null,"resolveEventType"),resolveUpdatePriority(){return u!==C?u:I},scheduleCallback:x,scheduleMicrotask:queueMicrotask,scheduleTimeout:setTimeout,setCurrentUpdatePriority(e){u=e},shouldAttemptEagerTransition:n(()=>!1,"shouldAttemptEagerTransition"),shouldSetTextContent(e,t){return!1},shouldYield:k,startSuspendingCommit:n(()=>{},"startSuspendingCommit"),supportsHydration:!1,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,suspendInstance:n(()=>{},"suspendInstance"),trackSchedulerEvent:n(()=>{},"trackSchedulerEvent"),unhideInstance(e,t){e._hidden=!1},unhideTextInstance(e,t){e._hidden=!1},waitForCommitToBeReady:n(()=>null,"waitForCommitToBeReady"),warnsIfNotActing:!0},j=T(U);export{j as T,_ as s};
@@ -0,0 +1,26 @@
1
+ var Pe=Object.defineProperty;var T=(e,t)=>Pe(e,"name",{value:t,configurable:!0});import{createRequire as Oe}from"node:module";import{jsxs as k,jsx as b}from"react/jsx-runtime";import{setMode as ee,BracketedPasteMode as ie,resetMode as re,cursorShow as ut,cursorUp as Ct,cursorTo as Tt,cursorDown as Ie,cursorHide as z,eraseLines as Y,cursorNextLine as ke,eraseLineEnd as $e,createDecMode as De,ALT_SCREEN_ON as Ae,clearScreenAndHomeCursor as We,ALT_SCREEN_OFF as Be}from"@visulima/ansi";import{wordWrap as Me}from"@visulima/string";import{throttle as jt}from"es-toolkit/compat";import se from"is-in-ci";import Ue from"patch-console";import{ConcurrentRoot as He,LegacyRoot as Ke}from"react-reconciler/constants.js";import{onExit as _e}from"signal-exit";import qt from"yoga-layout";import{a as je}from"./accessibility-context-DDyHTwmA.js";import{PureComponent as Fe,useState as ht,useRef as M,useCallback as g,useEffect as wt,useMemo as q}from"react";import{e as Ye}from"./animation-context-DW3p-vpk.js";import{t as ze}from"./app-context-BVpKlG1z.js";import{o as Ve}from"./cursor-context-CFviBqPX.js";import Ze from"code-excerpt";import Ft from"stack-utils";import{Box as U}from"../components/box.js";import{Text as W}from"../components/text.js";import{o as Ge}from"./focus-context-CsT69klR.js";import{t as Je}from"./stderr-context-BzEaUICS.js";import{e as ti}from"./stdin-context-BTaaFagk.js";import{t as ei}from"./stdout-context-BnblEPez.js";import{c as ii}from"./dom-4y__5fWB.js";import{resolveFlags as ri}from"./kittyFlags-C3rZLbcK.js";import{a as si}from"./measure-text-DDjHT1jD.js";import{L as $,u as oi}from"./reconciler-BuOP-TZ6.js";import{r as ni,R as ui}from"./renderer-gqplqpkQ.js";import{measureAndExtractObservers as ai}from"./ResizeObserverEntry-Dq0dk8Kq.js";import{calculateScroll as li}from"./getScrollHeight-BTEY8ewu.js";import{g as Z}from"./utils-CoviI5Vm.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ const require = __cjs_mod__.createRequire(import.meta.url);
3
+ const Ee=Oe(import.meta.url),J=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nt=T(e=>{if(typeof J<"u"&&J.versions&&J.versions.node){const[t,i]=J.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return J.getBuiltinModule(e)}return Ee(e)},"__cjs_getBuiltinModule"),D=J,{cwd:te}=D,{Stream:Ne}=nt("node:stream"),{Buffer:_t}=nt("node:buffer"),{Console:Le}=nt("node:console"),{EventEmitter:qe}=nt("node:events"),{existsSync:Qe,readFileSync:Xe}=nt("node:fs");var di=Object.defineProperty,L=T((e,t)=>di(e,"name",{value:t,configurable:!0}),"i$2");const oe="\x1B[200~",Yt="\x1B[201~",ci=L(e=>e>=48&&e<=63,"isCsiParameterByte"),hi=L(e=>e>=32&&e<=47,"isCsiIntermediateByte"),ne=L(e=>e>=64&&e<=126,"isCsiFinalByte"),pi=L((e,t,i)=>{const r=t+i+1;let s=r;for(;s<e.length;s++){const l=e.codePointAt(s);if(l===void 0)return"pending";if(!(ci(l)||hi(l))&&!(l===91&&s===r))return ne(l)?{nextIndex:s+1,sequence:e.slice(t,s+1)}:void 0}return"pending"},"parseCsiSequence"),fi=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||!ne(s)))return{nextIndex:r,sequence:e.slice(t,r)}},"parseSs3Sequence"),zt=L((e,t,i)=>{const r=e[t+i];if(r===void 0)return"pending";if(r==="[")return pi(e,t,i);if(r==="O")return fi(e,t,i)},"parseControlSequence"),mi=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"),gi=L((e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const r=zt(e,t,2);return r==="pending"?"pending":r||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const i=zt(e,t,1);return i==="pending"?"pending":i||mi(e,t)},"parseEscapeSequence"),Vt=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"),vi=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 Vt(e.slice(i),t),{events:t,pending:""};s>i&&Vt(e.slice(i,s),t);const l=gi(e,s);if(l==="pending")return r(s);if(l.sequence===oe){const u=l.nextIndex,o=e.indexOf(Yt,u);if(o===-1)return r(s);t.push({paste:e.slice(u,o)}),i=o+Yt.length;continue}t.push(l.sequence),i=l.nextIndex}return{events:t,pending:""}},"parseKeypresses"),wi=L(()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(oe)&&e!=="\x1B[200"},push(t){const i=vi(e+t);return e=i.pending,i.events},reset(){e=""}}},"createInputParser");var yi=Object.defineProperty,ue=T((e,t)=>yi(e,"name",{value:t,configurable:!0}),"p$1");const yt=ue(e=>e?.replace(`file://${te()}/`,""),"cleanupPath"),Qt=new Ft({cwd:te(),internals:Ft.nodeInternals()});function ae({error:e}){const t=e.stack?e.stack.split(`
4
+ `).slice(1):void 0,i=t?Qt.parseLine(t[0]):void 0,r=yt(i?.file);let s,l=0;if(r&&i?.line&&Qe(r)){const u=Xe(r,"utf8");if(s=Ze(u,i.line),s)for(const{line:o}of s)l=Math.max(l,String(o).length)}return k(U,{flexDirection:"column",padding:1,children:[k(U,{children:[k(W,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),k(W,{children:[" ",e.message]})]}),i&&r?b(U,{marginTop:1,children:k(W,{dimColor:!0,children:[r,":",i.line,":",i.column]})}):null,i&&s?b(U,{flexDirection:"column",marginTop:1,children:s.map(({line:u,value:o})=>k(U,{children:[b(U,{width:l+1,children:k(W,{"aria-label":u===i.line?`Line ${u}, error`:`Line ${u}`,backgroundColor:u===i.line?"red":void 0,color:u===i.line?"white":void 0,dimColor:u!==i.line,children:[String(u).padStart(l," "),":"]})}),b(W,{backgroundColor:u===i.line?"red":void 0,color:u===i.line?"white":void 0,children:` ${o}`},u)]},u))}):null,t?b(U,{flexDirection:"column",marginTop:1,children:t.map(u=>{const o=Qt.parseLine(u);return o?k(U,{children:[b(W,{dimColor:!0,children:"- "}),b(W,{bold:!0,dimColor:!0,children:o.function}),k(W,{"aria-label":`at ${yt(o.file)??""} line ${o.line} column ${o.column}`,color:"gray",dimColor:!0,children:[" ","(",yt(o.file)??"",":",o.line,":",o.column,")"]})]},u):k(U,{children:[b(W,{dimColor:!0,children:"- "}),k(W,{bold:!0,dimColor:!0,children:[u,"\\t"," "]})]},u)})}):null]})}T(ae,"B");ue(ae,"ErrorOverview");var bi=Object.defineProperty,Ci=T((e,t)=>bi(e,"name",{value:t,configurable:!0}),"o$1");let xi=class extends Fe{static{T(this,"i")}static{Ci(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?b(ae,{error:this.state.error}):this.props.children}};var Ri=Object.defineProperty,Xt=T((e,t)=>Ri(e,"name",{value:t,configurable:!0}),"V$1");const Ti=" ",Si="\x1B[Z",Pi="\x1B",Oi=ee(ie),Zt=re(ie),le=Xt(({children:e,exitOnCtrlC:t,interactive:i,onExit:r,onWaitUntilRenderFlush:s,renderThrottleMs:l,setCursorPosition:u,stderr:o,stdin:n,stdout:f,writeToStderr:C,writeToStdout:v})=>{const[d,c]=ht(!0),[x,R]=ht(void 0),[,w]=ht([]),B=M(0),I=M(new Map),H=M(void 0),P=M(0),A=M(0),[E]=ht(()=>{const a=new qe;return a.setMaxListeners(1/0),a}),S=M(void 0),K=M(void 0);K.current??=wi();const et=M(void 0),Pt=M(!1),ge=20,V=g(()=>{et.current&&(clearTimeout(et.current),et.current=void 0)},[]),Q=g(()=>{H.current&&(clearTimeout(H.current),H.current=void 0)},[]),lt=g(()=>{if(Q(),I.current.size===0)return;let a=Number.POSITIVE_INFINITY;for(const h of I.current.values())a=Math.min(a,h.nextDueTime);const p=Math.max(0,a-performance.now());H.current=setTimeout(()=>{H.current=void 0;const h=performance.now(),y=[...I.current.values()];for(const O of y){if(h<O.nextDueTime)continue;O.callback(h);const Te=h-O.startTime,Se=Math.floor(Te/O.interval)+1;O.nextDueTime=O.startTime+Se*O.interval}lt()},p)},[Q]),Ot=g((a,p)=>{const h=performance.now();return I.current.set(a,{callback:a,interval:p,nextDueTime:h+p,startTime:h}),lt(),{startTime:h,unsubscribe(){if(I.current.delete(a),I.current.size===0){Q();return}lt()}}},[Q,lt]);wt(()=>()=>{Q()},[Q]);const _=n.isTTY,Et=g(()=>{S.current&&(n.removeListener("readable",S.current),S.current=void 0)},[n]),X=g(()=>{n.setRawMode(!1),Et(),n.unref(),P.current=0,K.current?.reset(),V()},[n,Et,V]),it=g(a=>{_&&P.current>0&&X(),r(a)},[_,X,r]),Nt=g(a=>{if(a.includes("")&&t){it();return}a===Pi&&R(p=>{if(!p)return p})},[t,it]),rt=g(a=>{Nt(a),E.emit("input",a)},[Nt,E]),Lt=g(()=>{V(),et.current=setTimeout(()=>{et.current=void 0;const a=K.current.flushPendingEscape();a&&rt(a)},ge)},[V,rt]),vt=g(()=>{V();let a;for(;(a=n.read())!==null;){const p=K.current.push(a);for(const h of p)if(typeof h=="string")rt(h);else{if(E.listenerCount("paste")===0){Pt.current||(Pt.current=!0,C(`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
+ `)),rt(h.paste);continue}E.emit("paste",h.paste)}}K.current.hasPendingEscape()&&Lt()},[n,rt,V,Lt,C,E]),It=g(a=>{if(!_)throw n===D.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(n.setEncoding("utf8"),a){P.current===0&&(n.ref(),n.setRawMode(!0),S.current=vt,n.addListener("readable",vt)),P.current++;return}P.current!==0&&--P.current===0&&X()},[_,n,vt,X]),kt=g(a=>{if(f.isTTY){if(a){A.current===0&&f.write(Oi),A.current++;return}A.current!==0&&--A.current===0&&f.write(Zt)}},[f]),$t=g((a,p)=>{const h=a.findIndex(y=>y.id===p);for(let y=h+1;y<a.length;y++){const O=a[y];if(O?.isActive)return O.id}},[]),Dt=g((a,p)=>{const h=a.findIndex(y=>y.id===p);for(let y=h-1;y>=0;y--){const O=a[y];if(O?.isActive)return O.id}},[]),dt=g(()=>{w(a=>(R(p=>{const h=a.find(y=>y.isActive)?.id;return $t(a,p)??h}),a))},[$t]),ct=g(()=>{w(a=>(R(p=>{const h=a.findLast(y=>y.isActive)?.id;return Dt(a,p)??h}),a))},[Dt]);wt(()=>{const a=Xt(h=>{!d||B.current===0||(h===Ti&&dt(),h===Si&&ct())},"handleTabNavigation");E.on("input",a);const p=E;return()=>{p.off("input",a)}},[d,dt,ct,E]);const At=g(()=>{c(!0)},[]),Wt=g(()=>{c(!1)},[]),Bt=g(a=>{w(p=>(p.some(h=>h?.id===a)&&R(a),p))},[]),Mt=g((a,{autoFocus:p})=>{w(h=>(B.current=h.length+1,[...h,{id:a,isActive:!0}])),p&&R(h=>h||a)},[]),Ut=g(a=>{R(p=>{if(p!==a)return p}),w(p=>{const h=p.filter(y=>y.id!==a);return B.current=h.length,h})},[]),Ht=g(a=>{w(p=>p.map(h=>h.id!==a?h:{id:a,isActive:!0}))},[]),Kt=g(a=>{R(p=>{if(p!==a)return p}),w(p=>p.map(h=>h.id!==a?h:{id:a,isActive:!1}))},[]);wt(()=>()=>{const a=!f.destroyed&&!f.writableEnded;i&&a&&f.write(ut),_&&P.current>0&&X(),A.current>0&&(f.isTTY&&a&&f.write(Zt),A.current=0)},[f,_,X,i]);const ve=q(()=>({exit:it,waitUntilRenderFlush:s}),[it,s]),we=q(()=>({internal_eventEmitter:E,internal_exitOnCtrlC:t,isRawModeSupported:_,setBracketedPasteMode:kt,setRawMode:It,stdin:n}),[n,It,kt,_,t,E]),ye=q(()=>({stdout:f,write:v}),[f,v]),be=q(()=>({stderr:o,write:C}),[o,C]),Ce=q(()=>({setCursorPosition:u}),[u]),xe=q(()=>({activate:Ht,activeId:x,add:Mt,deactivate:Kt,disableFocus:Wt,enableFocus:At,focus:Bt,focusNext:dt,focusPrevious:ct,remove:Ut}),[x,Mt,Ut,Ht,Kt,At,Wt,dt,ct,Bt]),Re=q(()=>({renderThrottleMs:l,subscribe:Ot}),[Ot,l]);return b(ze.Provider,{value:ve,children:b(ti.Provider,{value:we,children:b(ei.Provider,{value:ye,children:b(Je.Provider,{value:be,children:b(Ge.Provider,{value:xe,children:b(Ye.Provider,{value:Re,children:b(Ve.Provider,{value:Ce,children:b(xi,{onError:it,children:e})})})})})})})})},"App");le.displayName="InternalApp";const xt=new WeakMap;var Ei=Object.defineProperty,at=T((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"e");const ft=at((e,t)=>e?.x!==t?.x||e?.y!==t?.y,"cursorPositionChanged"),tt=at((e,t)=>{if(!t)return"";const i=e-t.y;return(i>0?Ct(i):"")+Tt(t.x)+ut},"buildCursorSuffix"),de=at((e,t)=>{if(!t)return"";const i=e-1-t.y;return(i>0?Ie(i):"")+Tt(0)},"buildReturnToBottom"),ce=at(e=>{const t=e.cursorWasShown?z:"",i=de(e.previousLineCount,e.previousCursorPosition),r=tt(e.visibleLineCount,e.cursorPosition);return t+i+r},"buildCursorOnlySequence"),mt=at((e,t,i)=>e?z+de(t,i):"","buildReturnToBottomPrefix");var Ni=Object.defineProperty,N=T((e,t)=>Ni(e,"name",{value:t,configurable:!0}),"c$2");const ot=N((e,t)=>t.endsWith(`
8
+ `)?e.length-1:e.length,"visibleLineCount"),he=N(e=>e.rows||1/0,"getViewportRows"),gt=N((e,t)=>Math.min(e,he(t)),"clampToViewport"),Li=N((e,{showCursor:t=!1}={})=>{let i=0,r="",s=!1,l,u=!1,o,n=!1;const f=N(()=>u?l:void 0,"getActiveCursor"),C=N((d,c)=>{const x=ft(c,o);return d!==r||x},"hasChanges"),v=N(d=>{!t&&!s&&(e.write(z),s=!0);const c=f();u=!1;const x=ft(c,o);if(!C(d,c))return!1;const R=d.split(`
9
+ `),w=ot(R,d),B=tt(w,c);if(d===r&&x)e.write(ce({cursorPosition:c,cursorWasShown:n,previousCursorPosition:o,previousLineCount:i,visibleLineCount:w}));else{r=d;const I=mt(n,i,o);e.write(I+Y(gt(i,e))+d+B),i=R.length}return o=c?{...c}:void 0,n=c!==void 0,!0},"render");return v.clear=()=>{const d=mt(n,i,o);e.write(d+Y(gt(i,e))),r="",i=0,o=void 0,n=!1},v.done=()=>{r="",i=0,o=void 0,n=!1,t||(e.write(ut),s=!1)},v.reset=()=>{r="",i=0,o=void 0,n=!1},v.sync=d=>{const c=u?l:void 0;u=!1;const x=d.split(`
10
+ `);r=d,i=x.length,!c&&n&&e.write(z),c&&e.write(tt(ot(x,d),c)),o=c?{...c}:void 0,n=c!==void 0},v.setCursorPosition=d=>{l=d,u=!0},v.isCursorDirty=()=>u,v.willRender=d=>C(d,f()),v},"createStandard"),Ii=N((e,{showCursor:t=!1}={})=>{let i=[],r="",s=!1,l,u=!1,o,n=!1;const f=N(()=>u?l:void 0,"getActiveCursor"),C=N((d,c)=>{const x=ft(c,o);return d!==r||x},"hasChanges"),v=N(d=>{!t&&!s&&(e.write(z),s=!0);const c=f();u=!1;const x=ft(c,o);if(!C(d,c))return!1;const R=d.split(`
11
+ `),w=ot(R,d),B=ot(i,r);if(d===r&&x)return e.write(ce({cursorPosition:c,cursorWasShown:n,previousCursorPosition:o,previousLineCount:i.length,visibleLineCount:w})),o=c?{...c}:void 0,n=c!==void 0,!0;const I=mt(n,i.length,o);if(d===`
12
+ `||r.length===0){const S=tt(w,c);return e.write(I+Y(gt(i.length,e))+d+S),n=c!==void 0,o=c?{...c}:void 0,r=d,i=R,!0}const H=d.endsWith(`
13
+ `),P=[I],A=he(e);if(w<B){const S=r.endsWith(`
14
+ `)?1:0;P.push(Y(Math.min(B-w+S,A)),Ct(Math.min(w,A-1)))}else P.push(Ct(Math.min(B-1,A-1)));for(let S=0;S<w;S++){const K=S===w-1;if(R[S]===i[S]){(!K||H)&&P.push(ke());continue}P.push(Tt(0)+R[S]+$e+(K&&!H?"":`
15
+ `))}const E=tt(w,c);return P.push(E),e.write(P.join("")),n=c!==void 0,o=c?{...c}:void 0,r=d,i=R,!0},"render");return v.clear=()=>{const d=mt(n,i.length,o);e.write(d+Y(gt(i.length,e))),r="",i=[],o=void 0,n=!1},v.done=()=>{r="",i=[],o=void 0,n=!1,t||(e.write(ut),s=!1)},v.reset=()=>{r="",i=[],o=void 0,n=!1},v.sync=d=>{const c=u?l:void 0;u=!1;const x=d.split(`
16
+ `);r=d,i=x,!c&&n&&e.write(z),c&&e.write(tt(ot(x,d),c)),o=c?{...c}:void 0,n=c!==void 0},v.setCursorPosition=d=>{l=d,u=!0},v.isCursorDirty=()=>u,v.willRender=d=>C(d,f()),v},"createIncremental"),ki=N((e,{incremental:t=!1,showCursor:i=!1}={})=>t?Ii(e,{showCursor:i}):Li(e,{showCursor:i}),"create"),$i={create:ki};var Di=Object.defineProperty,Ai=T((e,t)=>Di(e,"name",{value:t,configurable:!0}),"t");const pe=De(2026),F=ee(pe),j=re(pe);function fe(e,t){return"isTTY"in e&&e.isTTY&&(t??!se)}T(fe,"shouldSynchronize");Ai(fe,"shouldSynchronize");var Wi=Object.defineProperty,Rt=T((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"o");let G;const Bi=Rt(()=>{if(G!==!1){if(G!==void 0)return G;try{return G=require("../../index.js").Renderer,G}catch{G=!1;return}}},"getRendererClass"),Mi=Rt(e=>{const t=Bi();if(!t)return;let i,r=0,s=0;const l=Rt((u,o)=>{(!i||r!==u||s!==o)&&(i?i.resize(u,o):i=new t(u,o),r=u,s=o)},"ensureRenderer");return{clear(){if(i){const u=new Uint32Array(r*s*2),o=65535;for(let n=0;n<u.length;n+=2)u[n]=32,u[n+1]=o;i.render(u)}},destroy(){i=void 0},render(u,o,n){if(l(o,n),!!i){e.isTTY&&i.writeRaw(F);try{i.render(u)}finally{e.isTTY&&i.writeRaw(j)}}},resize(u,o){l(u,o)}}},"createNative");var Ui=Object.defineProperty,m=T((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"n");console.Console||(console.Console=Le);const st=m(()=>{},"noop"),Gt=m(async()=>new Promise(e=>{setImmediate(e)}),"yieldImmediate"),Hi=27,Ki=91,_i=63,ji=117,qi=48,Fi=57,Yi=m(e=>e>=qi&&e<=Fi,"isDigitByte"),me=m((e,t)=>{if(e[t]!==Hi||e[t+1]!==Ki||e[t+2]!==_i)return;let i=t+3;const r=i;for(;i<e.length&&Yi(e[i]);)i++;if(i!==r){if(i===e.length)return{state:"partial"};if(e[i]===ji)return{endIndex:i,state:"complete"}}},"matchKittyQueryResponse"),zi=m(e=>{for(let t=0;t<e.length;t++)if(me(e,t)?.state==="complete")return!0;return!1},"hasCompleteKittyQueryResponse"),Vi=m(e=>{const t=[];let i=0;for(;i<e.length;){const r=me(e,i);if(r?.state==="complete"){i=r.endIndex+1;continue}if(r?.state==="partial")break;t.push(e[i]),i++}return t},"stripKittyQueryResponsesAndTrailingPartial"),Qi=m(({isTty:e,isUnmounting:t,nextOutputHeight:i,previousOutputHeight:r,viewportRows:s})=>{if(!e)return!1;const l=r>0,u=r>=s,o=r>s,n=i>s,f=u&&i<s;return o||n&&l||f||t&&u},"shouldClearTerminalForFrame"),bt=m(e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]","isErrorInput"),Jt=m(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"),pt=m((e,t)=>{if(!e||typeof e.flush!="function")return;const i=e;t?i.flush():typeof i.cancel=="function"&&i.cancel()},"settleThrottle");class Xi{static{T(this,"ft")}static{m(this,"Ink")}isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=ii("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??D.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 l=i?this.onRender:(()=>{const o=jt(this.onRender,s,{leading:!0,trailing:!0});return this.throttledOnRender=o,()=>{this.hasPendingThrottledRender=!0,o()}})();if(i&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let o=!1;const n=m(()=>{o||(o=!0,queueMicrotask(()=>{o=!1,this.onRender()}))},"deferredRender");this.rootNode.onRender=n,this.rootNode.onImmediateRender=n}else this.rootNode.onRender=l,this.rootNode.onImmediateRender=this.onRender;this.log=$i.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=Mi(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=i?this.log:jt(o=>{const n=this.log.willRender(o),f=this.shouldSync();f&&n&&this.options.stdout.write(F),this.log(o),f&&n&&this.options.stdout.write(j)},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=Z(this.options.stdout).columns,this.fullStaticOutput="";const u=t.concurrent?He:Ke;this.container=$.createContainer(this.rootNode,u,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=_e(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(),D.env.DEV==="true"&&$.injectIntoDevTools(),this.exitPromise=new Promise((o,n)=>{this.resolveExitPromise=o,this.rejectExitPromise=n}),this.exitPromise.catch(st)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=m(()=>{const t=Z(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),si(),this.calculateLayout(),this.onRender(),this.lastTerminalWidth=t},"resized");resolveExitPromise=m(()=>{},"resolveExitPromise");rejectExitPromise=m(()=>{},"rejectExitPromise");unsubscribeExit=m(()=>{},"unsubscribeExit");handleAppExit=m(t=>{if(!(this.isUnmounted||this.isUnmounting)){if(bt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}},"handleAppExit");getActiveCursorPosition=m(()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition,"getActiveCursorPosition");setCursorPosition=m(t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())},"setCursorPosition");restoreLastOutput=m(()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
17
+ `))},"restoreLastOutput");calculateLayout=m(()=>{const t=m(r=>{const s=new Map;this.calculateScrollAndTriggerObservers(r,s);for(const[l,u]of s)l.internalTrigger(u)},"flushLayoutObservers");this.prepareYogaTree(this.rootNode,t);const i=Z(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(i),this.rootNode.yogaNode.calculateLayout(void 0,void 0,qt.DIRECTION_LTR),t(this.rootNode)},"calculateLayout");calculateScrollAndTriggerObservers(t,i){if(t.nodeName==="ink-box"){const{style:r}=t,s=r.overflow??"visible",l=r.overflowX??s,u=r.overflowY??s;l==="scroll"||u==="scroll"?li(t):t.internal_scrollState&&delete t.internal_scrollState}if(ai(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(),oi(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let r=0;for(const s of t.childNodes){const l=s;s.nodeName!=="#text"&&l.yogaNode&&(t.yogaNode.insertChild(l.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=Z(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,qt.DIRECTION_LTR)),i(t),ni(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)}}onRender=m(()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=ui(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:i,cursorRequested:r,output:s,outputBuffer:l,outputHeight:u,outputWidth:o,staticOutput:n}=t;if(this.renderedCursorRequested=r,this.renderedCursorPosition=i,this.useNativeRenderer&&this.nativeLog&&l&&o){n&&n!==`
18
+ `&&this.options.stdout.write(n),this.nativeLog.render(l,o,u),this.lastOutputHeight=u;return}r&&this.log.setCursorPosition(this.getActiveCursorPosition());const f=n&&n!==`
19
+ `;if(this.options.debug){f&&(this.fullStaticOutput+=n),this.lastOutput=s,this.lastOutputToRender=s,this.lastOutputHeight=u,this.options.stdout.write(this.fullStaticOutput+s);return}if(!this.interactive){f&&this.options.stdout.write(n),this.lastOutput=s,this.lastOutputToRender=`${s}
20
+ `,this.lastOutputHeight=u;return}if(this.isScreenReaderEnabled){const C=this.shouldSync();if(C&&this.options.stdout.write(F),f){const c=this.lastOutputHeight>0?Y(this.lastOutputHeight):"";this.options.stdout.write(c+n),this.lastOutputHeight=0}if(s===this.lastOutput&&!f){C&&this.options.stdout.write(j);return}const v=Z(this.options.stdout).columns,d=Me(s,{trim:!1,width:v,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(f)this.options.stdout.write(d);else{const c=this.lastOutputHeight>0?Y(this.lastOutputHeight):"";this.options.stdout.write(c+d)}this.lastOutput=s,this.lastOutputToRender=d,this.lastOutputHeight=d===""?0:d.split(`
21
+ `).length,C&&this.options.stdout.write(j);return}f&&(this.fullStaticOutput+=n),this.renderInteractiveFrame(s,u,f?n:"")},"onRender");accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const i=b(je.Provider,{value:this.accessibilityContextValue,children:b(le,{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,st):($.updateContainerSync(i,this.container,null,st),$.flushSyncWork())}writeToStdout=m(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(F),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(j)},"writeToStdout");writeToStderr=m(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(F),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(j)},"writeToStderr");unmount=m(t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(D.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const i=this.options.stdout,{canWriteToStdout:r,hasWritableState:s}=Jt(i);pt(this.throttledOnRender,r),r&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),pt(this.throttledLog,r),typeof this.restoreConsole=="function"&&this.restoreConsole();const l=m(()=>{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,Be),this.writeBestEffort(this.options.stdout,ut),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
22
+ `:`${this.lastOutput}
23
+ `)),this.kittyProtocolEnabled=!1,xt.delete(this.options.stdout);const{exitResult:o}=this,n=m(()=>{bt(t)?this.rejectExitPromise(t):this.resolveExitPromise(o)},"resolveOrReject");t!==void 0&&!bt(t)?n():r&&s?this.options.stdout.write("",n):setImmediate(n)},"finishUnmount"),u=$;this.options.concurrent?($.updateContainerSync(null,this.container,null,st),$.flushSyncWork(),u.flushPassiveEffects?.(),l()):($.updateContainerSync(null,this.container,null,st),$.flushSyncWork(),l())},"unmount");async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},D.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await Gt(),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}=Jt(t);if(pt(this.throttledOnRender,i),pt(this.throttledLog,i),i&&r){await new Promise(s=>{this.options.stdout.write("",()=>{s()})});return}await Gt()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
24
+ `))}patchConsole(){this.options.debug||(this.restoreConsole=Ue((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,Ae),this.writeBestEffort(this.options.stdout,z))}resolveInteractiveOption(t){return t??(!se&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,i){return!!t&&i&&!!this.options.stdout.isTTY}shouldSync(){return fe(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){const s=r!=="",l=this.options.stdout.isTTY,u=l?Z(this.options.stdout).rows:24,o=l&&i>=u?t:`${t}
25
+ `;if(Qi({isTty:l,isUnmounting:this.isUnmounting,nextOutputHeight:i,previousOutputHeight:this.lastOutputHeight,viewportRows:u})){if(this.options.incrementalRendering){s&&(this.log.clear(),this.options.stdout.write(r)),(t!==this.lastOutput||this.log.isCursorDirty()||s)&&this.throttledLog(o),this.lastOutput=t,this.lastOutputToRender=o,this.lastOutputHeight=i;return}const n=this.shouldSync();n&&this.options.stdout.write(F),this.options.stdout.write(We+this.fullStaticOutput+t),this.lastOutput=t,this.lastOutputToRender=o,this.lastOutputHeight=i,this.log.sync(o),n&&this.options.stdout.write(j);return}if(s){const n=this.shouldSync();n&&this.options.stdout.write(F),this.log.clear(),this.options.stdout.write(r),this.log(o),n&&this.options.stdout.write(j)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(o);this.lastOutput=t,this.lastOutputToRender=o,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 l=m(()=>{this.cancelKittyDetection=void 0,clearTimeout(o),i.removeListener("data",u);const n=Vi(s);s=[],n.length>0&&i.unshift(_t.from(n))},"cleanup"),u=m(n=>{const f=typeof n=="string"?_t.from(n):n;for(const C of f)s.push(C);zi(s)&&(l(),this.isUnmounted||this.enableKittyProtocol(t))},"onData");i.on("data",u);const o=setTimeout(l,200);this.cancelKittyDetection=l,r.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${ri(t)}u`),this.kittyProtocolEnabled=!0}}var Zi=Object.defineProperty,St=T((e,t)=>Zi(e,"name",{value:t,configurable:!0}),"i");const $r=St((e,t)=>{const i={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:D.stderr,stdin:D.stdin,stdout:D.stdout,...Gi(t)},r=Ji(i.stdout,()=>new Xi(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"),Gi=St((e={})=>e instanceof Ne?{stdin:D.stdin,stdout:e}:e,"getOptions"),Ji=St((e,t)=>{const i=xt.get(e);if(i===void 0){const r=t();return xt.set(e,r),r}return D.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.
26
+ `),i},"getInstance");export{$r as default};
@@ -1 +1 @@
1
- var W=Object.defineProperty;var v=(r,s)=>W(r,"name",{value:s,configurable:!0});import l from"react";import{FocusProvider as C,useFocusManager as z}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as T,useInput as B}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as b}from"./LayoutNode-rxblE317.js";import{T as f,s as P}from"./reconciler-DSYCrIZs.js";import{renderTreeToBuffer as F}from"./renderTreeToBuffer-DPkoCgP2.js";import{TuiApp as j}from"./TuiApp-DrjI_i-R.js";import{InputParser as H}from"./InputParser-rZKjY_7Y.js";import{terminalSize as q}from"./Renderer-DJXooAsp.js";import{createInlineLoop as G}from"./createInlineLoop-DRNZ7jqH.js";var M=Object.defineProperty,e=v((r,s)=>M(r,"name",{value:s,configurable:!0}),"e");const R=e(r=>l.createElement("box",r,r.children),"_Box"),ee=e(r=>l.createElement("text",r,r.children),"_Text"),te=e(()=>l.createElement(R,{flexGrow:1}),"_Spacer"),L=e(({children:r})=>{const{disableFocus:s,enableFocus:t,focusNext:c,focusPrevious:i}=z();return B((h,a)=>{a.tab&&!a.shift&&c(),a.tab&&a.shift&&i(),a.escape&&(s(),t())}),l.createElement(l.Fragment,null,r)},"TabHandler");function A(r,s){const t=new j,c=new H(process.stdin),i=new b,{height:h,width:a}=t.getSize();i.yogaNode.setWidth(a),i.yogaNode.setHeight(h);const p=f.createContainer(i,0,null,!1,null,"",o=>console.error(o),null),d=e(o=>l.createElement(T.Provider,{value:{app:t,input:c,writeStderr:e(u=>t.writeStderr(u),"writeStderr"),writeStdout:e(u=>t.writeStdout(u),"writeStdout")}},l.createElement(C,null,l.createElement(L,null,o))),"wrap");f.updateContainer(d(r),p,null,()=>{});const x=e((o,u)=>i.calculateLayout(o,u),"calcLayout"),S=e((o,u,_)=>F(i,o,u,_),"renderBuf"),g=e(()=>t.paintNow(x,S),"paintNow");let E=!1;P(()=>{E=!0});const m=Math.round(1e3/(s?.maxFps??60)),y=setInterval(()=>{E&&(E=!1,g())},m);let N;const n=new Promise(o=>{N=o}),w=e(()=>{clearInterval(y),f.updateContainer(null,p,null,()=>{}),i.destroy(),t.stop(),c.stop(),process.off("SIGWINCH",I),N()},"cleanup");c.on("exit",()=>{w(),process.exit(0)}),t.on("quit",()=>{w(),process.exit(0)}),c.start(),t.start();const I=e(()=>{const o=process.stdout.columns||80,u=process.stdout.rows||24;t.resize(o,u),i.yogaNode.setWidth(o),i.yogaNode.setHeight(u),t.emit("resize"),g()},"onSigwinch");return process.on("SIGWINCH",I),g(),{app:t,input:c,rerender(o){f.updateContainer(d(o),p,null,()=>{})},unmount(){w()},waitUntilExit(){return n}}}v(A,"render");e(A,"render");function O(r,s){const t=q(),c=s?.rows??10,{cols:i}=t,h=Math.min(c,t.rows),a=new H(process.stdin),p=new b;p.yogaNode.setWidth(i),p.yogaNode.setHeight(h);const d=[],x=[],S={quit:e(()=>m.stop(),"quit"),writeStderr:e(n=>x.push(n),"writeStderr"),writeStdout:e(n=>d.push(n),"writeStdout")},g=f.createContainer(p,0,null,!1,null,"",n=>console.error(n),null),E=e(n=>l.createElement(T.Provider,{value:{app:S,input:a,writeStderr:S.writeStderr,writeStdout:S.writeStdout}},l.createElement(C,null,l.createElement(L,null,n))),"wrap");f.updateContainer(E(r),g,null,()=>{}),P(()=>{});const m=G((n,w,I)=>{p.calculateLayout(w,I),F(p,n,w,I)},{...s,fps:s?.maxFps??s?.fps??60,rows:h});a.on("exit",()=>m.stop());let y;const N=new Promise(n=>{y=n});return process.on("exit",()=>{d.length>0&&process.stdout.write(d.join("")),x.length>0&&process.stderr.write(x.join("")),y()}),m.start(),a.start(),{unmount(){m.stop()},waitUntilExit(){return N}}}v(O,"renderInline");e(O,"renderInline");export{R as _Box,te as _Spacer,ee as _Text,A as render,O as renderInline};
1
+ var W=Object.defineProperty;var v=(r,s)=>W(r,"name",{value:s,configurable:!0});import l from"react";import{FocusProvider as C,useFocusManager as z}from"./FocusContext-Xy0cwJpO.js";import{TuiContext as T,useInput as B}from"./TuiContext-BoJvG3NN.js";import{LayoutNode as b}from"./LayoutNode-B8zej4dm.js";import{T as f,s as P}from"./reconciler-DIfG72R9.js";import{renderTreeToBuffer as F}from"./renderTreeToBuffer-CZilzyhN.js";import{TuiApp as j}from"./TuiApp-DrjI_i-R.js";import{InputParser as H}from"./InputParser-rZKjY_7Y.js";import{terminalSize as q}from"./Renderer-DJXooAsp.js";import{createInlineLoop as G}from"./createInlineLoop-DRNZ7jqH.js";var M=Object.defineProperty,e=v((r,s)=>M(r,"name",{value:s,configurable:!0}),"e");const R=e(r=>l.createElement("box",r,r.children),"_Box"),ee=e(r=>l.createElement("text",r,r.children),"_Text"),te=e(()=>l.createElement(R,{flexGrow:1}),"_Spacer"),L=e(({children:r})=>{const{disableFocus:s,enableFocus:t,focusNext:c,focusPrevious:i}=z();return B((h,a)=>{a.tab&&!a.shift&&c(),a.tab&&a.shift&&i(),a.escape&&(s(),t())}),l.createElement(l.Fragment,null,r)},"TabHandler");function A(r,s){const t=new j,c=new H(process.stdin),i=new b,{height:h,width:a}=t.getSize();i.yogaNode.setWidth(a),i.yogaNode.setHeight(h);const p=f.createContainer(i,0,null,!1,null,"",o=>console.error(o),null),d=e(o=>l.createElement(T.Provider,{value:{app:t,input:c,writeStderr:e(u=>t.writeStderr(u),"writeStderr"),writeStdout:e(u=>t.writeStdout(u),"writeStdout")}},l.createElement(C,null,l.createElement(L,null,o))),"wrap");f.updateContainer(d(r),p,null,()=>{});const x=e((o,u)=>i.calculateLayout(o,u),"calcLayout"),S=e((o,u,_)=>F(i,o,u,_),"renderBuf"),g=e(()=>t.paintNow(x,S),"paintNow");let E=!1;P(()=>{E=!0});const m=Math.round(1e3/(s?.maxFps??60)),y=setInterval(()=>{E&&(E=!1,g())},m);let N;const n=new Promise(o=>{N=o}),w=e(()=>{clearInterval(y),f.updateContainer(null,p,null,()=>{}),i.destroy(),t.stop(),c.stop(),process.off("SIGWINCH",I),N()},"cleanup");c.on("exit",()=>{w(),process.exit(0)}),t.on("quit",()=>{w(),process.exit(0)}),c.start(),t.start();const I=e(()=>{const o=process.stdout.columns||80,u=process.stdout.rows||24;t.resize(o,u),i.yogaNode.setWidth(o),i.yogaNode.setHeight(u),t.emit("resize"),g()},"onSigwinch");return process.on("SIGWINCH",I),g(),{app:t,input:c,rerender(o){f.updateContainer(d(o),p,null,()=>{})},unmount(){w()},waitUntilExit(){return n}}}v(A,"render");e(A,"render");function O(r,s){const t=q(),c=s?.rows??10,{cols:i}=t,h=Math.min(c,t.rows),a=new H(process.stdin),p=new b;p.yogaNode.setWidth(i),p.yogaNode.setHeight(h);const d=[],x=[],S={quit:e(()=>m.stop(),"quit"),writeStderr:e(n=>x.push(n),"writeStderr"),writeStdout:e(n=>d.push(n),"writeStdout")},g=f.createContainer(p,0,null,!1,null,"",n=>console.error(n),null),E=e(n=>l.createElement(T.Provider,{value:{app:S,input:a,writeStderr:S.writeStderr,writeStdout:S.writeStdout}},l.createElement(C,null,l.createElement(L,null,n))),"wrap");f.updateContainer(E(r),g,null,()=>{}),P(()=>{});const m=G((n,w,I)=>{p.calculateLayout(w,I),F(p,n,w,I)},{...s,fps:s?.maxFps??s?.fps??60,rows:h});a.on("exit",()=>m.stop());let y;const N=new Promise(n=>{y=n});return process.on("exit",()=>{d.length>0&&process.stdout.write(d.join("")),x.length>0&&process.stderr.write(x.join("")),y()}),m.start(),a.start(),{unmount(){m.stop()},waitUntilExit(){return N}}}v(O,"renderInline");e(O,"renderInline");export{R as _Box,te as _Spacer,ee as _Text,A as render,O as renderInline};