@promptctl/rich-js 0.7.0 → 0.8.0

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 (137) hide show
  1. package/README.md +31 -30
  2. package/dist/core/box.d.ts +3 -3
  3. package/dist/core/box.d.ts.map +1 -1
  4. package/dist/core/box.js.map +1 -1
  5. package/dist/core/cells.d.ts +46 -1
  6. package/dist/core/cells.d.ts.map +1 -1
  7. package/dist/core/cells.js +55 -14
  8. package/dist/core/cells.js.map +1 -1
  9. package/dist/core/console.d.ts +28 -10
  10. package/dist/core/console.d.ts.map +1 -1
  11. package/dist/core/console.js +141 -80
  12. package/dist/core/console.js.map +1 -1
  13. package/dist/core/markup.d.ts +0 -2
  14. package/dist/core/markup.d.ts.map +1 -1
  15. package/dist/core/markup.js +31 -17
  16. package/dist/core/markup.js.map +1 -1
  17. package/dist/core/measure.d.ts +11 -0
  18. package/dist/core/measure.d.ts.map +1 -1
  19. package/dist/core/measure.js +15 -3
  20. package/dist/core/measure.js.map +1 -1
  21. package/dist/core/oklch.d.ts +22 -0
  22. package/dist/core/oklch.d.ts.map +1 -1
  23. package/dist/core/oklch.js +62 -18
  24. package/dist/core/oklch.js.map +1 -1
  25. package/dist/core/pretty.d.ts +87 -0
  26. package/dist/core/pretty.d.ts.map +1 -0
  27. package/dist/core/pretty.js +304 -0
  28. package/dist/core/pretty.js.map +1 -0
  29. package/dist/core/protocol.d.ts +64 -0
  30. package/dist/core/protocol.d.ts.map +1 -1
  31. package/dist/core/protocol.js +72 -0
  32. package/dist/core/protocol.js.map +1 -1
  33. package/dist/core/segment.d.ts +21 -0
  34. package/dist/core/segment.d.ts.map +1 -1
  35. package/dist/core/segment.js +40 -1
  36. package/dist/core/segment.js.map +1 -1
  37. package/dist/core/subscription.d.ts +13 -0
  38. package/dist/core/subscription.d.ts.map +1 -0
  39. package/dist/core/subscription.js +13 -0
  40. package/dist/core/subscription.js.map +1 -0
  41. package/dist/core/text.d.ts.map +1 -1
  42. package/dist/core/text.js +45 -13
  43. package/dist/core/text.js.map +1 -1
  44. package/dist/host/host-stream.d.ts +31 -0
  45. package/dist/host/host-stream.d.ts.map +1 -0
  46. package/dist/host/host-stream.js +36 -0
  47. package/dist/host/host-stream.js.map +1 -0
  48. package/dist/host/index.d.ts +4 -0
  49. package/dist/host/index.d.ts.map +1 -0
  50. package/dist/host/index.js +3 -0
  51. package/dist/host/index.js.map +1 -0
  52. package/dist/host/terminal-host.d.ts +144 -0
  53. package/dist/host/terminal-host.d.ts.map +1 -0
  54. package/dist/host/terminal-host.js +133 -0
  55. package/dist/host/terminal-host.js.map +1 -0
  56. package/dist/index.d.ts +10 -33
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +33 -21
  59. package/dist/index.js.map +1 -1
  60. package/dist/node/terminal-host.d.ts +85 -0
  61. package/dist/node/terminal-host.d.ts.map +1 -0
  62. package/dist/node/terminal-host.js +161 -0
  63. package/dist/node/terminal-host.js.map +1 -0
  64. package/dist/node/traceback.d.ts +28 -0
  65. package/dist/node/traceback.d.ts.map +1 -0
  66. package/dist/node/traceback.js +113 -0
  67. package/dist/node/traceback.js.map +1 -0
  68. package/dist/renderables/columns.d.ts +24 -2
  69. package/dist/renderables/columns.d.ts.map +1 -1
  70. package/dist/renderables/columns.js +91 -32
  71. package/dist/renderables/columns.js.map +1 -1
  72. package/dist/renderables/layout.d.ts +61 -5
  73. package/dist/renderables/layout.d.ts.map +1 -1
  74. package/dist/renderables/layout.js +191 -19
  75. package/dist/renderables/layout.js.map +1 -1
  76. package/dist/renderables/padding.d.ts +15 -2
  77. package/dist/renderables/padding.d.ts.map +1 -1
  78. package/dist/renderables/padding.js +92 -37
  79. package/dist/renderables/padding.js.map +1 -1
  80. package/dist/renderables/panel.d.ts +44 -3
  81. package/dist/renderables/panel.d.ts.map +1 -1
  82. package/dist/renderables/panel.js +149 -80
  83. package/dist/renderables/panel.js.map +1 -1
  84. package/dist/renderables/table.d.ts +40 -4
  85. package/dist/renderables/table.d.ts.map +1 -1
  86. package/dist/renderables/table.js +276 -158
  87. package/dist/renderables/table.js.map +1 -1
  88. package/dist/renderables/traceback.d.ts +6 -2
  89. package/dist/renderables/traceback.d.ts.map +1 -1
  90. package/dist/renderables/traceback.js +6 -10
  91. package/dist/renderables/traceback.js.map +1 -1
  92. package/dist/renderables/tree.d.ts +27 -2
  93. package/dist/renderables/tree.d.ts.map +1 -1
  94. package/dist/renderables/tree.js +82 -23
  95. package/dist/renderables/tree.js.map +1 -1
  96. package/dist/template-bindings/color-funcs.d.ts +3 -3
  97. package/dist/template-bindings/color-funcs.js +3 -3
  98. package/dist/template-bindings/index.d.ts +6 -7
  99. package/dist/template-bindings/index.d.ts.map +1 -1
  100. package/dist/template-bindings/index.js +6 -7
  101. package/dist/template-bindings/index.js.map +1 -1
  102. package/dist/template-bindings/palette-funcs.d.ts +17 -5
  103. package/dist/template-bindings/palette-funcs.d.ts.map +1 -1
  104. package/dist/template-bindings/palette-funcs.js +69 -6
  105. package/dist/template-bindings/palette-funcs.js.map +1 -1
  106. package/dist/template-bindings/style-funcs.d.ts +1 -1
  107. package/dist/template-bindings/style-funcs.js +1 -1
  108. package/dist/themes/ramp.d.ts +84 -0
  109. package/dist/themes/ramp.d.ts.map +1 -0
  110. package/dist/themes/ramp.js +123 -0
  111. package/dist/themes/ramp.js.map +1 -0
  112. package/dist/widgets/dropdown.d.ts +1 -1
  113. package/dist/widgets/dropdown.js +1 -1
  114. package/dist/widgets/event-router.d.ts +3 -2
  115. package/dist/widgets/event-router.d.ts.map +1 -1
  116. package/dist/widgets/focus-manager.d.ts +2 -1
  117. package/dist/widgets/focus-manager.d.ts.map +1 -1
  118. package/dist/widgets/index.d.ts +3 -6
  119. package/dist/widgets/index.d.ts.map +1 -1
  120. package/dist/widgets/index.js +4 -3
  121. package/dist/widgets/index.js.map +1 -1
  122. package/dist/widgets/screen.d.ts +1 -1
  123. package/dist/widgets/screen.d.ts.map +1 -1
  124. package/dist/widgets/terminal-host.d.ts +13 -63
  125. package/dist/widgets/terminal-host.d.ts.map +1 -1
  126. package/dist/widgets/terminal-host.js +11 -142
  127. package/dist/widgets/terminal-host.js.map +1 -1
  128. package/dist/widgets/text-input.d.ts +2 -3
  129. package/dist/widgets/text-input.d.ts.map +1 -1
  130. package/dist/widgets/text-input.js +4 -12
  131. package/dist/widgets/text-input.js.map +1 -1
  132. package/dist/widgets/types.d.ts +1 -1
  133. package/dist/widgets/types.d.ts.map +1 -1
  134. package/dist/widgets/types.js.map +1 -1
  135. package/dist/widgets/widget-base.d.ts +2 -1
  136. package/dist/widgets/widget-base.d.ts.map +1 -1
  137. package/package.json +20 -4
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,WAAW,EACX,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EACL,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EACL,eAAe,EACf,aAAa,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B,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClF,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Core primitives
2
- export { cellLen, setCellSize, splitText, chopCells, cellFit, cellFitFrom, cellColToCodeUnitOffset, asCellCol, asCodeUnit, asCodePoint, nextCodePoint, prevCodePoint, } from "./core/cells.js";
2
+ export { cellLen, setCellSize, splitText, chopCells, cellFit, asCellCol, asCodePoint, } from "./core/cells.js";
3
3
  export { ColorRgba, ColorTable, ColorDepth, ColorSpec, ColorParseError, TerminalTheme, parseRgbHex, parseRgbaHex, blendRgb, resolveColorSystem, detectColorSystem, STANDARD_TABLE, EIGHT_BIT_TABLE, WINDOWS_TABLE, ANSI_COLOR_NAMES, } from "./core/color.js";
4
4
  // Perceptually-uniform color space (manipulation, transposition).
5
5
  export { Oklch, IDENTITY, INVERT_LIGHTNESS, isIdentityKey, } from "./core/oklch.js";
@@ -22,12 +22,17 @@ export { transposePalette, themeKeyForRoot, isAnchored, ANCHORED_ROOTS, } from "
22
22
  // menu cell lightening its inherited background) without re-deriving from a
23
23
  // palette name. Negative levels invert (lighten(c,-n) === darken(c,n)).
24
24
  export { lighten, darken, relativeLuminance, contrastRatio, contrastFor, ensureContrast, } from "./themes/colorMath.js";
25
+ // A number → a color through ordered stops, interpolated in OKLCH — the one
26
+ // color operation whose input is a measurement rather than a color, so a
27
+ // gradient (or, with the `step` easing, a threshold cascade) stays inside the
28
+ // theme system instead of being computed beside it.
29
+ export { ColorRamp, RAMP_EASING_NAMES, parseRampEasing } from "./themes/ramp.js";
25
30
  export { Style, StyleSyntaxError, StyleStack, Theme, NULL_STYLE, DEFAULT_STYLES, } from "./core/style.js";
26
31
  export { Segment, ControlType, } from "./core/segment.js";
27
32
  export { Box } from "./core/box.js";
28
33
  export { ASCII, ASCII2, ASCII_DOUBLE_HEAD, SQUARE, SQUARE_DOUBLE_HEAD, MINIMAL, MINIMAL_HEAVY_HEAD, MINIMAL_DOUBLE_HEAD, SIMPLE, SIMPLE_HEAD, SIMPLE_HEAVY, HORIZONTALS, ROUNDED, HEAVY, HEAVY_EDGE, HEAVY_HEAD, DOUBLE, DOUBLE_EDGE, MARKDOWN, } from "./core/box.js";
29
34
  // Protocol
30
- export { isRenderable, isMeasurable, } from "./core/protocol.js";
35
+ export { isRenderable, isMeasurable, withCellWidth, withBoundedWidth, } from "./core/protocol.js";
31
36
  // Measurement
32
37
  export { Measurement, measureRenderables } from "./core/measure.js";
33
38
  // Text
@@ -37,13 +42,15 @@ export { Strip, PowerlineJoiner, CapsuleJoiner, PlainJoiner, GradientJoiner, } f
37
42
  // renderToString — stateless one-shot emission
38
43
  export { renderToString, segmentToString, segmentsToString, } from "./core/render.js";
39
44
  // Markup plugin tags
40
- export { MarkupRegistry, globalMarkupRegistry, registerMarkupTag, unregisterMarkupTag, renderMarkup, } from "./core/markup.js";
45
+ export { MarkupRegistry, globalMarkupRegistry, renderMarkup, } from "./core/markup.js";
41
46
  // Emoji
42
47
  export { EMOJI, emojiReplace, Emoji, NoEmoji } from "./core/emoji.js";
43
48
  // Markup
44
- export { Tag, MarkupError, escape as escapeMarkup, } from "./core/markup.js";
49
+ export { MarkupError, escape as escapeMarkup } from "./core/markup.js";
45
50
  // Highlighter
46
51
  export { Highlighter, NullHighlighter, RegexHighlighter, ReprHighlighter, JSONHighlighter, ISO8601Highlighter, } from "./core/highlighter.js";
52
+ // Pretty
53
+ export { Pretty } from "./core/pretty.js";
47
54
  // Spinner data
48
55
  export { SPINNERS, DEFAULT_SPINNER } from "./core/spinnerData.js";
49
56
  // Console
@@ -60,7 +67,6 @@ export { Spinner } from "./renderables/spinner.js";
60
67
  export { Table, Column } from "./renderables/table.js";
61
68
  export { Tree } from "./renderables/tree.js";
62
69
  export { JSONRenderable } from "./renderables/json.js";
63
- export { Pretty } from "./renderables/pretty.js";
64
70
  export { Columns } from "./renderables/columns.js";
65
71
  export { FlexStrip } from "./renderables/flexStrip.js";
66
72
  export { Live } from "./renderables/live.js";
@@ -71,20 +77,26 @@ export { Traceback } from "./renderables/traceback.js";
71
77
  export { Syntax } from "./renderables/syntax.js";
72
78
  export { Markdown } from "./renderables/markdown.js";
73
79
  export { Layout } from "./renderables/layout.js";
74
- export { FLOW, KeyEvent, hasOverlay } from "./widgets/types.js";
75
- export { StaticItem } from "./widgets/static-item.js";
76
- export { WidgetBase } from "./widgets/widget-base.js";
77
- export { DefaultFocusManager } from "./widgets/focus-manager.js";
78
- export { DefaultScreen } from "./widgets/screen.js";
79
- export { Button } from "./widgets/button.js";
80
- export { Checkbox } from "./widgets/checkbox.js";
81
- export { Toggle } from "./widgets/toggle.js";
82
- export { TextInput } from "./widgets/text-input.js";
83
- export { Dropdown } from "./widgets/dropdown.js";
84
- export { Slider } from "./widgets/slider.js";
85
- export { EventRouter } from "./widgets/event-router.js";
86
- export { NodeTerminalHost, BrowserTerminalHost } from "./widgets/terminal-host.js";
87
- export { hostStream } from "./widgets/host-stream.js";
88
- // Template bindings — register rich-js styling as @promptctl/go-template-js functions
89
- export { createRichTextEngine, richTextFuncs } from "./template-bindings/index.js";
80
+ // The barrel stops at `renderables/`, and the two subsystems above it are reached
81
+ // through their own `package.json#exports` subpaths instead:
82
+ //
83
+ // `@promptctl/rich-js/widgets` — the interactive layer (pulls in `mobx`)
84
+ // `@promptctl/rich-js/template-bindings` — the styling vocabulary (pulls in
85
+ // `@promptctl/go-template-js`)
86
+ //
87
+ // `@promptctl/rich-js/host` is a third subpath but a different kind of thing: the
88
+ // terminal seam has no third-party dependency at all, and sits on its own subpath
89
+ // because it is what a *non*-interactive program reaches for. Folding it into either
90
+ // neighbour is what the split was undoing — inside `widgets/` it charged mobx to
91
+ // consumers who only wanted to write bytes; in this barrel it would put an I/O
92
+ // capability in front of consumers who never touch a terminal directly.
93
+ //
94
+ // `export … from` is a static edge, so anything named here is *evaluated* by every
95
+ // consumer, including one that only wanted a Table. Re-exporting the two subsystems
96
+ // therefore charged their dependencies to the whole package — mobx and, transitively,
97
+ // @noble/hashes. The subpaths make that cost something a consumer opts into, the same
98
+ // bargain `src/node/` strikes for Node built-ins.
99
+ //
100
+ // This is also why there is no widget list here to keep in sync: `src/widgets/index.ts`
101
+ // is that list, and a copy of it in this file would be a second one to drift from.
90
102
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EACL,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,WAAW,EACX,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,g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,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,KAAK,GACN,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,kFAAkF;AAClF,6DAA6D;AAC7D,EAAE;AACF,uFAAuF;AACvF,+EAA+E;AAC/E,2EAA2E;AAC3E,EAAE;AACF,kFAAkF;AAClF,kFAAkF;AAClF,qFAAqF;AACrF,iFAAiF;AACjF,+EAA+E;AAC/E,wEAAwE;AACxE,EAAE;AACF,mFAAmF;AACnF,oFAAoF;AACpF,sFAAsF;AACtF,sFAAsF;AACtF,kDAAkD;AAClD,EAAE;AACF,wFAAwF;AACxF,mFAAmF"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * node:terminal-host — the `TerminalHost` implementation backed by node's
3
+ * process streams.
4
+ *
5
+ * [LAW:locality-or-seam] The `TerminalHost` interface is the seam and lives
6
+ * in `widgets/terminal-host.ts`, importable anywhere. *This* file is one
7
+ * value satisfying that interface, and it reads `process.stdin` /
8
+ * `process.stdout`, so it is a node subpath:
9
+ *
10
+ * import { NodeTerminalHost } from "@promptctl/rich-js/node/terminal-host";
11
+ * const screen = new Screen(new NodeTerminalHost());
12
+ *
13
+ * The ambient `process` global is not an import, so it slips past the
14
+ * module-graph reasoning that keeps the main barrel browser-safe: reading
15
+ * `process.stdin` inside a constructor throws in a browser only when someone
16
+ * constructs it. Moving the class here makes the boundary structural — a
17
+ * browser bundle that never reaches for this subpath cannot reach the global
18
+ * either.
19
+ *
20
+ * [LAW:no-shared-mutable-globals] Which files may read the host, and what
21
+ * each takes off it, is `HOST_ACCESS` in `test/seam/ambient-process.ts` —
22
+ * this file's entry carries its `why`, and a test fails when anything joins
23
+ * the list. Deliberately not restated here: the sole-ownership sentence that
24
+ * used to stand in this spot is what that list replaced.
25
+ *
26
+ * So if you find yourself reaching for `process.stdin`, `process.stdout`, or
27
+ * `setRawMode` in the runtime or in a demo, take a `TerminalHost` parameter
28
+ * instead. The seam is already here.
29
+ */
30
+ import type { DataHandler, ResizeHandler, TerminalHost, TerminalSize } from "../host/terminal-host.js";
31
+ import type { Unsubscribe } from "../core/subscription.js";
32
+ /**
33
+ * Subset of NodeJS stream API the node host actually depends on. Tests
34
+ * construct a host over PassThrough / Writable mocks; production wires it
35
+ * to `process.stdin` / `process.stdout`.
36
+ */
37
+ interface NodeReadable {
38
+ on(event: "data", listener: (chunk: Buffer | string) => void): unknown;
39
+ off(event: "data", listener: (chunk: Buffer | string) => void): unknown;
40
+ setRawMode?(raw: boolean): unknown;
41
+ resume?(): unknown;
42
+ pause?(): unknown;
43
+ readonly isTTY?: boolean;
44
+ }
45
+ interface NodeWritable {
46
+ write(chunk: string | Uint8Array): unknown;
47
+ on(event: "resize", listener: () => void): unknown;
48
+ off(event: "resize", listener: () => void): unknown;
49
+ readonly columns?: number;
50
+ readonly rows?: number;
51
+ readonly isTTY?: boolean;
52
+ }
53
+ export interface NodeTerminalHostOptions {
54
+ /**
55
+ * Input stream. Defaults to `process.stdin` so production code does not
56
+ * have to construct one explicitly. Tests pass a `PassThrough`.
57
+ */
58
+ stdin?: NodeReadable;
59
+ /**
60
+ * Output stream. Defaults to `process.stdout` for the same reason.
61
+ * Tests pass a `Writable` mock.
62
+ */
63
+ stdout?: NodeWritable;
64
+ }
65
+ export declare class NodeTerminalHost implements TerminalHost {
66
+ private readonly stdin;
67
+ private readonly stdout;
68
+ private readonly dataHandlers;
69
+ private readonly resizeHandlers;
70
+ private dataListener;
71
+ private resizeListener;
72
+ private rawModeRequested;
73
+ constructor(options?: NodeTerminalHostOptions);
74
+ get isTTY(): boolean;
75
+ write(data: Uint8Array | string): void;
76
+ size(): TerminalSize;
77
+ setRawMode(raw: boolean): void;
78
+ private applyRawMode;
79
+ onData(handler: DataHandler): Unsubscribe;
80
+ onResize(handler: ResizeHandler): Unsubscribe;
81
+ start(): void;
82
+ stop(): void;
83
+ }
84
+ export {};
85
+ //# sourceMappingURL=terminal-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-host.d.ts","sourceRoot":"","sources":["../../src/node/terminal-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,UAAU,YAAY;IACpB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC;IACvE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC;IACxE,UAAU,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IACnC,MAAM,CAAC,IAAI,OAAO,CAAC;IACnB,KAAK,CAAC,IAAI,OAAO,CAAC;IAClB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,YAAY;IACpB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;IACnD,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAKD,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IACvD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,YAAY,CAAiD;IACrE,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,gBAAgB,CAAS;gBAErB,OAAO,GAAE,uBAA4B;IAKjD,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAItC,IAAI,IAAI,YAAY;IAOpB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAwB9B,OAAO,CAAC,YAAY;IASpB,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW;IA2BzC,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW;IAkB7C,KAAK,IAAI,IAAI;IAMb,IAAI,IAAI,IAAI;CAsBb"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * node:terminal-host — the `TerminalHost` implementation backed by node's
3
+ * process streams.
4
+ *
5
+ * [LAW:locality-or-seam] The `TerminalHost` interface is the seam and lives
6
+ * in `widgets/terminal-host.ts`, importable anywhere. *This* file is one
7
+ * value satisfying that interface, and it reads `process.stdin` /
8
+ * `process.stdout`, so it is a node subpath:
9
+ *
10
+ * import { NodeTerminalHost } from "@promptctl/rich-js/node/terminal-host";
11
+ * const screen = new Screen(new NodeTerminalHost());
12
+ *
13
+ * The ambient `process` global is not an import, so it slips past the
14
+ * module-graph reasoning that keeps the main barrel browser-safe: reading
15
+ * `process.stdin` inside a constructor throws in a browser only when someone
16
+ * constructs it. Moving the class here makes the boundary structural — a
17
+ * browser bundle that never reaches for this subpath cannot reach the global
18
+ * either.
19
+ *
20
+ * [LAW:no-shared-mutable-globals] Which files may read the host, and what
21
+ * each takes off it, is `HOST_ACCESS` in `test/seam/ambient-process.ts` —
22
+ * this file's entry carries its `why`, and a test fails when anything joins
23
+ * the list. Deliberately not restated here: the sole-ownership sentence that
24
+ * used to stand in this spot is what that list replaced.
25
+ *
26
+ * So if you find yourself reaching for `process.stdin`, `process.stdout`, or
27
+ * `setRawMode` in the runtime or in a demo, take a `TerminalHost` parameter
28
+ * instead. The seam is already here.
29
+ */
30
+ const DEFAULT_COLS = 80;
31
+ const DEFAULT_ROWS = 24;
32
+ export class NodeTerminalHost {
33
+ stdin;
34
+ stdout;
35
+ dataHandlers = new Set();
36
+ resizeHandlers = new Set();
37
+ dataListener;
38
+ resizeListener;
39
+ rawModeRequested = false;
40
+ constructor(options = {}) {
41
+ this.stdin = options.stdin ?? process.stdin;
42
+ this.stdout = options.stdout ?? process.stdout;
43
+ }
44
+ get isTTY() {
45
+ return !!this.stdin.isTTY && !!this.stdout.isTTY;
46
+ }
47
+ write(data) {
48
+ this.stdout.write(data);
49
+ }
50
+ size() {
51
+ return {
52
+ cols: this.stdout.columns ?? DEFAULT_COLS,
53
+ rows: this.stdout.rows ?? DEFAULT_ROWS,
54
+ };
55
+ }
56
+ setRawMode(raw) {
57
+ this.rawModeRequested = raw;
58
+ this.applyRawMode(raw);
59
+ }
60
+ // [LAW:single-enforcer] One site decides what to do when toggling raw
61
+ // mode on the underlying transport fails. Both `setRawMode` (call from
62
+ // outside) and `stop` (cleanup) go through this helper so neither
63
+ // caller has to branch on capability or exception-handling.
64
+ //
65
+ // [LAW:dataflow-not-control-flow] Two shapes of "the transport can't do
66
+ // this" are absorbed identically: the optional chain handles "method
67
+ // missing" (non-TTY streams, PassThrough in tests); the try/catch
68
+ // handles "method exists but threw" (node's `setRawMode` throws on
69
+ // closed or non-TTY streams). Callers see neither shape — they always
70
+ // call `setRawMode(bool)`, and the host decides what's possible.
71
+ //
72
+ // The catch is silent because the only call sites are lifecycle
73
+ // transitions: if the stream is already gone, there is nothing
74
+ // semantically meaningful for the host to do, and surfacing the
75
+ // exception would only make teardown brittle without giving the caller
76
+ // a recovery path. The demos this replaces did `try { ... } catch {}`
77
+ // at every call site for exactly this reason — absorbing it once here
78
+ // means the pattern stops spreading.
79
+ applyRawMode(raw) {
80
+ try {
81
+ this.stdin.setRawMode?.(raw);
82
+ }
83
+ catch {
84
+ // Underlying stream couldn't honor the request (closed, no longer
85
+ // a TTY, etc.). Lifecycle continues.
86
+ }
87
+ }
88
+ onData(handler) {
89
+ this.dataHandlers.add(handler);
90
+ // [LAW:single-enforcer] One underlying `data` listener fans out to all
91
+ // subscribers — keeps stdin's flowing/paused state derivable from
92
+ // "any subscribers?" instead of from per-call ref-counts scattered
93
+ // through the runtime.
94
+ if (!this.dataListener) {
95
+ this.dataListener = (chunk) => {
96
+ for (const h of this.dataHandlers)
97
+ h(chunk);
98
+ };
99
+ this.stdin.on("data", this.dataListener);
100
+ this.stdin.resume?.();
101
+ }
102
+ return () => {
103
+ this.dataHandlers.delete(handler);
104
+ if (this.dataHandlers.size === 0 && this.dataListener) {
105
+ this.stdin.off("data", this.dataListener);
106
+ this.dataListener = undefined;
107
+ // Returning stdin to paused state mirrors the symmetric "no
108
+ // subscribers → no flow" invariant. Without this, removing the
109
+ // last subscriber leaves stdin in flowing mode and the process
110
+ // hangs forever waiting for an event nobody is listening for.
111
+ this.stdin.pause?.();
112
+ }
113
+ };
114
+ }
115
+ onResize(handler) {
116
+ this.resizeHandlers.add(handler);
117
+ if (!this.resizeListener) {
118
+ this.resizeListener = () => {
119
+ const size = this.size();
120
+ for (const h of this.resizeHandlers)
121
+ h(size);
122
+ };
123
+ this.stdout.on("resize", this.resizeListener);
124
+ }
125
+ return () => {
126
+ this.resizeHandlers.delete(handler);
127
+ if (this.resizeHandlers.size === 0 && this.resizeListener) {
128
+ this.stdout.off("resize", this.resizeListener);
129
+ this.resizeListener = undefined;
130
+ }
131
+ };
132
+ }
133
+ start() {
134
+ // No-op on node: stdin/stdout are always available. Lifecycle exists
135
+ // so `BrowserTerminalHost` can attach to the DOM here without the
136
+ // runtime branching on "do I need to start?"
137
+ }
138
+ stop() {
139
+ // [LAW:one-source-of-truth] Symmetric teardown: drop every subscriber
140
+ // and detach the underlying stream listeners. After stop(), the host
141
+ // is in the same shape a freshly-constructed one would be in. Calling
142
+ // stop() repeatedly is safe — the dataListener/resizeListener guards
143
+ // make later calls no-ops.
144
+ if (this.dataListener) {
145
+ this.stdin.off("data", this.dataListener);
146
+ this.dataListener = undefined;
147
+ this.stdin.pause?.();
148
+ }
149
+ if (this.resizeListener) {
150
+ this.stdout.off("resize", this.resizeListener);
151
+ this.resizeListener = undefined;
152
+ }
153
+ this.dataHandlers.clear();
154
+ this.resizeHandlers.clear();
155
+ if (this.rawModeRequested) {
156
+ this.applyRawMode(false);
157
+ this.rawModeRequested = false;
158
+ }
159
+ }
160
+ }
161
+ //# sourceMappingURL=terminal-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-host.js","sourceRoot":"","sources":["../../src/node/terminal-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA8CH,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,OAAO,gBAAgB;IACV,KAAK,CAAe;IACpB,MAAM,CAAe;IACrB,YAAY,GAAG,IAAI,GAAG,EAAe,CAAC;IACtC,cAAc,GAAG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AC;QAC5B,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAChC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * node:traceback — install `Traceback` as the process-wide crash renderer.
3
+ *
4
+ * [LAW:locality-or-seam] `process.on` / `process.exit` live only here, on the
5
+ * node side of the API boundary. The `Traceback` renderable itself is pure
6
+ * rendering and stays in the browser-safe barrel; installing it as a global
7
+ * handler is a node capability, so it is a node subpath:
8
+ *
9
+ * import { installTraceback } from "@promptctl/rich-js/node/traceback";
10
+ * installTraceback({ suppress: ["node_modules"] });
11
+ *
12
+ * [LAW:dataflow-not-control-flow] Both crash channels register the same
13
+ * `report` function, unadapted. Neither payload is trusted to be an `Error`:
14
+ * `@types/node` annotates `uncaughtException` with `Error`, but `throw "boom"`
15
+ * delivers the raw string, so the annotation is a claim about the common case
16
+ * rather than a guarantee. `report` takes `unknown` and both channels are
17
+ * literally one code path.
18
+ */
19
+ import type { TracebackOptions } from "../renderables/traceback.js";
20
+ /**
21
+ * Register rich tracebacks for uncaught exceptions and unhandled rejections.
22
+ *
23
+ * Calling this more than once replaces the previous handler — the last call
24
+ * wins, options included — so a process always has exactly one rich crash
25
+ * renderer no matter how many entry points reach for it.
26
+ */
27
+ export declare function installTraceback(options?: TracebackOptions): void;
28
+ //# sourceMappingURL=traceback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceback.d.ts","sourceRoot":"","sources":["../../src/node/traceback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAmDpE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAsCjE"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * node:traceback — install `Traceback` as the process-wide crash renderer.
3
+ *
4
+ * [LAW:locality-or-seam] `process.on` / `process.exit` live only here, on the
5
+ * node side of the API boundary. The `Traceback` renderable itself is pure
6
+ * rendering and stays in the browser-safe barrel; installing it as a global
7
+ * handler is a node capability, so it is a node subpath:
8
+ *
9
+ * import { installTraceback } from "@promptctl/rich-js/node/traceback";
10
+ * installTraceback({ suppress: ["node_modules"] });
11
+ *
12
+ * [LAW:dataflow-not-control-flow] Both crash channels register the same
13
+ * `report` function, unadapted. Neither payload is trusted to be an `Error`:
14
+ * `@types/node` annotates `uncaughtException` with `Error`, but `throw "boom"`
15
+ * delivers the raw string, so the annotation is a claim about the common case
16
+ * rather than a guarantee. `report` takes `unknown` and both channels are
17
+ * literally one code path.
18
+ */
19
+ import { inspect, types } from "node:util";
20
+ import { Console } from "../core/console.js";
21
+ import { Traceback } from "../renderables/traceback.js";
22
+ /** A payload's own stack, when it carries one, or `""` when it does not. */
23
+ function stackOf(reason) {
24
+ if (typeof reason !== "object" || reason === null)
25
+ return "";
26
+ if (!("stack" in reason))
27
+ return "";
28
+ return typeof reason.stack === "string" ? reason.stack : "";
29
+ }
30
+ /**
31
+ * [LAW:parse-dont-validate] The checkpoint between a crash payload, which node
32
+ * allows to be any value at all, and `Traceback`, which renders an `Error`.
33
+ * The return type is the proof: nothing downstream re-asks whether the payload
34
+ * was throwable, and no raw value can reach the renderable to have `.name` and
35
+ * `.message` read off it as `undefined`.
36
+ *
37
+ * The gate is `isNativeError`, not `instanceof Error`. An error thrown inside a
38
+ * `node:vm` context is a real error with real frames, but its prototype comes
39
+ * from that realm, so `instanceof` answers false and the frames would be
40
+ * discarded by the one component that exists to show them. `isNativeError`
41
+ * reads V8's internal error slot and is realm-independent.
42
+ *
43
+ * Whatever survives that gate is not an error, so it has no call site of its
44
+ * own; `stackOf` salvages a stack from a duck-typed thrower and otherwise
45
+ * leaves it empty rather than reporting the frames of this function, which
46
+ * point into rich-js and describe nothing about the fault. `inspect` renders
47
+ * every payload shape, including circular objects, where `String(reason)`
48
+ * would collapse them to `[object Object]`.
49
+ */
50
+ function toError(reason) {
51
+ if (types.isNativeError(reason))
52
+ return reason;
53
+ const error = new Error(inspect(reason));
54
+ error.name = "NonError";
55
+ error.stack = stackOf(reason);
56
+ return error;
57
+ }
58
+ /**
59
+ * The handler currently registered, or a no-op standing in for "none yet".
60
+ *
61
+ * [LAW:no-shared-mutable-globals] The process listener registry is a shared
62
+ * global, so the handler installed into it gets a single owner here rather
63
+ * than a caller appending to it once per call. Holding the reference is what
64
+ * lets `installTraceback` replace rather than accumulate.
65
+ *
66
+ * [LAW:types-are-the-program] A no-op rather than `null`: `process.off` on an
67
+ * unregistered listener does nothing, so the first call needs no null check
68
+ * and no "have we installed yet" branch. There is no absent case to handle.
69
+ */
70
+ let installed = () => { };
71
+ /**
72
+ * Register rich tracebacks for uncaught exceptions and unhandled rejections.
73
+ *
74
+ * Calling this more than once replaces the previous handler — the last call
75
+ * wins, options included — so a process always has exactly one rich crash
76
+ * renderer no matter how many entry points reach for it.
77
+ */
78
+ export function installTraceback(options) {
79
+ // [LAW:no-ambient-temporal-coupling] "This process is already crashing" is
80
+ // lifecycle state with one owner, not a fact left to the interleaving of two
81
+ // writes. A cascade — cleanup code rejecting a promise while the first
82
+ // report is still draining — would otherwise start a second write and a
83
+ // second `process.exit(1)`, and whichever drained first would cut the other
84
+ // off mid-frame. The first crash is the fault and the rest is its wake, so
85
+ // one complete report of the fault beats two corrupt ones.
86
+ let crashing = false;
87
+ const report = (reason) => {
88
+ if (crashing)
89
+ return;
90
+ crashing = true;
91
+ // [LAW:effects-at-boundaries] Render to a string first, then perform one
92
+ // write. `beginCapture` redirects the console's sink without setting
93
+ // `file:`, so stderr's TTY status still drives colour depth — a `file:`
94
+ // sink would report `isTTY === false` and silently strip colour.
95
+ const out = new Console({ stderr: true });
96
+ out.beginCapture();
97
+ out.print(new Traceback(toError(reason), options));
98
+ // [LAW:no-silent-failure] Exit only once the bytes have drained. When
99
+ // stderr is a pipe (CI logs, `2>&1 | tee`), writes are asynchronous and
100
+ // an immediate `process.exit(1)` truncates the traceback at the pipe
101
+ // buffer — the longer the traceback, the more of it is lost, which is
102
+ // the reverse of what a crash report should do.
103
+ process.stderr.write(out.endCapture(), () => {
104
+ process.exit(1);
105
+ });
106
+ };
107
+ process.off("uncaughtException", installed);
108
+ process.off("unhandledRejection", installed);
109
+ process.on("uncaughtException", report);
110
+ process.on("unhandledRejection", report);
111
+ installed = report;
112
+ }
113
+ //# sourceMappingURL=traceback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceback.js","sourceRoot":"","sources":["../../src/node/traceback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,4EAA4E;AAC5E,SAAS,OAAO,CAAC,MAAe;IAC9B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC7D,IAAI,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,OAAO,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,OAAO,CAAC,MAAe;IAC9B,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,KAAK,CAAC,IAAI,GAAG,UAAU,CAA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E,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IACzC,SAAS,GAAG,MAAM,CAAC;AACrB,CAAC"}
@@ -19,8 +19,30 @@ export declare class Columns implements Renderable, Measurable {
19
19
  readonly columnFirst: boolean;
20
20
  readonly gutterWidth: number;
21
21
  constructor(items?: Iterable<unknown>, options?: ColumnsOptions);
22
- render(options: RenderOptions): Iterable<Segment>;
23
- measure(options: RenderOptions): {
22
+ render(rawOptions: RenderOptions): Iterable<Segment>;
23
+ /**
24
+ * The requested width divided into columns, once.
25
+ *
26
+ * [LAW:single-enforcer] The three modes disagree only about how many columns
27
+ * there are and how wide each one is, so they disagree in one place. `render`
28
+ * lays out against this division and `_naturalWidth` is the width at which it
29
+ * comes out as one row of every item.
30
+ */
31
+ private _divide;
32
+ /**
33
+ * The widest any one item wants to be.
34
+ *
35
+ * An item that cannot measure itself wants the offer, which is what `Panel`,
36
+ * `Padding`, `Layout` and `Tree` all answer for the same case — and under an
37
+ * unbounded offer that is `Infinity`, so `withBoundedWidth` throws and says
38
+ * the request was unanswerable. Counting it as one cell instead reported a
39
+ * natural width of 1, which resolved an unbounded offer to a single column and
40
+ * cropped forty cells of content down to `"x"` with no error at all.
41
+ */
42
+ private _itemWidth;
43
+ /** The width at which every item sits on one row: n columns and the gutters between them. */
44
+ private _naturalWidth;
45
+ measure(rawOptions: RenderOptions): {
24
46
  minimum: number;
25
47
  maximum: number;
26
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../../src/renderables/columns.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IAC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