@opentui/core 0.5.10 → 0.5.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 (48) hide show
  1. package/README.md +2 -0
  2. package/audio.d.ts +6 -1
  3. package/{chunk-bun-9gqvxy8c.js → chunk-bun-8f4q4e2m.js} +1234 -1039
  4. package/{chunk-bun-9gqvxy8c.js.map → chunk-bun-8f4q4e2m.js.map} +8 -8
  5. package/{chunk-bun-bb3k0yt8.js → chunk-bun-91mz470w.js} +680 -585
  6. package/chunk-bun-91mz470w.js.map +32 -0
  7. package/{chunk-node-f647ts9q.js → chunk-node-1zjyxy5y.js} +1241 -1043
  8. package/chunk-node-1zjyxy5y.js.map +63 -0
  9. package/{chunk-node-6bg8r2m7.js → chunk-node-fyb4fckk.js} +680 -585
  10. package/chunk-node-fyb4fckk.js.map +32 -0
  11. package/editor-view.d.ts +1 -0
  12. package/index.bun.js +1603 -1377
  13. package/index.bun.js.map +8 -8
  14. package/index.node.js +1603 -1377
  15. package/index.node.js.map +8 -8
  16. package/lib/detect-links.d.ts +5 -0
  17. package/lib/tree-sitter/update-assets.js +4 -4
  18. package/lib/tree-sitter/update-assets.js.map +2 -2
  19. package/lib/tree-sitter-styled-text.d.ts +4 -0
  20. package/node-assets.js +6 -2
  21. package/node-assets.js.map +3 -3
  22. package/package.json +13 -9
  23. package/parser.worker.js +7 -12
  24. package/parser.worker.js.map +3 -3
  25. package/renderables/Code.d.ts +6 -0
  26. package/renderables/Diff.d.ts +1 -2
  27. package/renderables/EmbeddedTerminal.d.ts +4 -0
  28. package/renderables/Markdown.d.ts +6 -0
  29. package/renderables/TextBufferRenderable.d.ts +7 -0
  30. package/renderables/TextTable.d.ts +2 -0
  31. package/renderer.d.ts +2 -0
  32. package/runtime-plugin.js +15 -4
  33. package/runtime-plugin.js.map +1 -1
  34. package/testing.bun.js +23 -23
  35. package/testing.bun.js.map +2 -2
  36. package/testing.js +23 -23
  37. package/testing.js.map +2 -2
  38. package/text-buffer-view.d.ts +2 -0
  39. package/types.d.ts +2 -1
  40. package/yoga.bun.js +187 -187
  41. package/yoga.bun.js.map +1 -1
  42. package/yoga.js +187 -187
  43. package/yoga.js.map +1 -1
  44. package/zig-structs.d.ts +8 -1
  45. package/zig.d.ts +6 -0
  46. package/chunk-bun-bb3k0yt8.js.map +0 -32
  47. package/chunk-node-6bg8r2m7.js.map +0 -32
  48. package/chunk-node-f647ts9q.js.map +0 -63
@@ -1,46 +1,242 @@
1
1
  import {
2
- Clipboard,
3
- InternalKeyHandler,
4
- KeyHandler,
5
- NativeMeasureTargetKind,
6
- OptimizedBuffer,
7
- RGBA,
8
- Selection,
9
- SpanInfoStruct,
10
- StdinParser,
11
- StyledText,
12
- SystemClock,
13
- TextBuffer,
14
- borderCharsToArray,
15
- buildTerminalPaletteSignature,
16
- convertGlobalToLocalSelection,
17
- createExtmarksController,
18
- createTerminalPalette,
19
- createTextAttributes,
20
- destroyTreeSitterClient,
21
- env,
22
- getBorderSides,
23
- getTreeSitterClient,
24
- isStyledText,
25
- normalizeTerminalPalette,
26
- parseAlign,
27
- parseAlignItems,
28
- parseBorderStyle,
29
- parseColor,
30
- parseFlexDirection,
31
- parseJustify,
32
- parseOverflow,
33
- parsePositionType,
34
- parseWrap,
35
- registerEnvVar,
36
- resolveRenderLib,
2
+ toArrayBuffer,
37
3
  singleton,
4
+ registerEnvVar2,
5
+ env2,
38
6
  sleep,
39
- stringToStyledText,
40
- toArrayBuffer,
41
- treeSitterToTextChunks,
7
+ RGBA2,
8
+ parseColor2,
9
+ parseBorderStyle2,
10
+ getBorderSides2,
11
+ borderCharsToArray2,
12
+ KeyHandler2,
13
+ InternalKeyHandler2,
14
+ createTextAttributes2,
15
+ getLinkId2,
16
+ isStyledText2,
17
+ StyledText2,
18
+ stringToStyledText2,
19
+ SystemClock2,
20
+ parseAlign2,
21
+ parseAlignItems2,
22
+ parseFlexDirection2,
23
+ parseJustify2,
24
+ parseOverflow2,
25
+ parsePositionType2,
26
+ parseWrap2,
27
+ Selection2,
28
+ convertGlobalToLocalSelection2,
29
+ StdinParser2,
30
+ treeSitterToTextChunks2,
31
+ getTreeSitterClient2,
32
+ destroyTreeSitterClient2,
33
+ createExtmarksController2,
34
+ createTerminalPalette2,
35
+ normalizeTerminalPalette2,
36
+ buildTerminalPaletteSignature2,
37
+ Clipboard2,
38
+ OptimizedBuffer2,
39
+ TextBuffer2,
40
+ SpanInfoStruct,
41
+ NativeMeasureTargetKind2,
42
+ resolveRenderLib2,
42
43
  yoga_default
43
- } from "./chunk-node-f647ts9q.js";
44
+ } from "./chunk-node-1zjyxy5y.js";
45
+
46
+ // src/syntax-style.ts
47
+ function convertThemeToStyles2(theme) {
48
+ const flatStyles = {};
49
+ for (const tokenStyle of theme) {
50
+ const styleDefinition = {};
51
+ if (tokenStyle.style.foreground) {
52
+ styleDefinition.fg = parseColor2(tokenStyle.style.foreground);
53
+ }
54
+ if (tokenStyle.style.background) {
55
+ styleDefinition.bg = parseColor2(tokenStyle.style.background);
56
+ }
57
+ if (tokenStyle.style.bold !== undefined) {
58
+ styleDefinition.bold = tokenStyle.style.bold;
59
+ }
60
+ if (tokenStyle.style.italic !== undefined) {
61
+ styleDefinition.italic = tokenStyle.style.italic;
62
+ }
63
+ if (tokenStyle.style.underline !== undefined) {
64
+ styleDefinition.underline = tokenStyle.style.underline;
65
+ }
66
+ if (tokenStyle.style.dim !== undefined) {
67
+ styleDefinition.dim = tokenStyle.style.dim;
68
+ }
69
+ for (const scope of tokenStyle.scope) {
70
+ flatStyles[scope] = styleDefinition;
71
+ }
72
+ }
73
+ return flatStyles;
74
+ }
75
+
76
+ class SyntaxStyle2 {
77
+ lib;
78
+ stylePtr;
79
+ _destroyed = false;
80
+ nameCache = new Map;
81
+ styleDefs = new Map;
82
+ mergedCache = new Map;
83
+ constructor(lib, ptr) {
84
+ this.lib = lib;
85
+ this.stylePtr = ptr;
86
+ }
87
+ static create() {
88
+ const lib = resolveRenderLib2();
89
+ const ptr = lib.createSyntaxStyle();
90
+ return new SyntaxStyle2(lib, ptr);
91
+ }
92
+ static fromTheme(theme) {
93
+ const style = SyntaxStyle2.create();
94
+ const flatStyles = convertThemeToStyles2(theme);
95
+ for (const [name, styleDef] of Object.entries(flatStyles)) {
96
+ style.registerStyle(name, styleDef);
97
+ }
98
+ return style;
99
+ }
100
+ static fromStyles(styles) {
101
+ const style = SyntaxStyle2.create();
102
+ for (const [name, styleDef] of Object.entries(styles)) {
103
+ style.registerStyle(name, styleDef);
104
+ }
105
+ return style;
106
+ }
107
+ guard() {
108
+ if (this._destroyed)
109
+ throw new Error("NativeSyntaxStyle is destroyed");
110
+ }
111
+ registerStyle(name, style) {
112
+ this.guard();
113
+ const attributes = createTextAttributes2({
114
+ bold: style.bold,
115
+ italic: style.italic,
116
+ underline: style.underline,
117
+ dim: style.dim
118
+ });
119
+ const fg = style.fg ? parseColor2(style.fg) : null;
120
+ const bg = style.bg ? parseColor2(style.bg) : null;
121
+ const id = this.lib.syntaxStyleRegister(this.stylePtr, name, fg, bg, attributes);
122
+ this.nameCache.set(name, id);
123
+ this.styleDefs.set(name, { ...style, fg: fg ?? undefined, bg: bg ?? undefined });
124
+ return id;
125
+ }
126
+ resolveStyleId(name) {
127
+ this.guard();
128
+ const cached = this.nameCache.get(name);
129
+ if (cached !== undefined)
130
+ return cached;
131
+ const id = this.lib.syntaxStyleResolveByName(this.stylePtr, name);
132
+ if (id !== null) {
133
+ this.nameCache.set(name, id);
134
+ }
135
+ return id;
136
+ }
137
+ getStyleId(name) {
138
+ this.guard();
139
+ const id = this.resolveStyleId(name);
140
+ if (id !== null)
141
+ return id;
142
+ if (name.includes(".")) {
143
+ const baseName = name.split(".")[0];
144
+ return this.resolveStyleId(baseName);
145
+ }
146
+ return null;
147
+ }
148
+ get ptr() {
149
+ this.guard();
150
+ return this.stylePtr;
151
+ }
152
+ getStyleCount() {
153
+ this.guard();
154
+ return this.lib.syntaxStyleGetStyleCount(this.stylePtr);
155
+ }
156
+ clearNameCache() {
157
+ this.nameCache.clear();
158
+ }
159
+ getStyle(name) {
160
+ this.guard();
161
+ if (Object.prototype.hasOwnProperty.call(this.styleDefs, name)) {
162
+ return;
163
+ }
164
+ const style = this.styleDefs.get(name);
165
+ if (style)
166
+ return style;
167
+ if (name.includes(".")) {
168
+ const baseName = name.split(".")[0];
169
+ if (Object.prototype.hasOwnProperty.call(this.styleDefs, baseName)) {
170
+ return;
171
+ }
172
+ return this.styleDefs.get(baseName);
173
+ }
174
+ return;
175
+ }
176
+ mergeStyles(...styleNames) {
177
+ this.guard();
178
+ const cacheKey = styleNames.join(":");
179
+ const cached = this.mergedCache.get(cacheKey);
180
+ if (cached)
181
+ return cached;
182
+ const styleDefinition = {};
183
+ for (const name of styleNames) {
184
+ const style = this.getStyle(name);
185
+ if (!style)
186
+ continue;
187
+ if (style.fg)
188
+ styleDefinition.fg = style.fg;
189
+ if (style.bg)
190
+ styleDefinition.bg = style.bg;
191
+ if (style.bold !== undefined)
192
+ styleDefinition.bold = style.bold;
193
+ if (style.italic !== undefined)
194
+ styleDefinition.italic = style.italic;
195
+ if (style.underline !== undefined)
196
+ styleDefinition.underline = style.underline;
197
+ if (style.dim !== undefined)
198
+ styleDefinition.dim = style.dim;
199
+ }
200
+ const attributes = createTextAttributes2({
201
+ bold: styleDefinition.bold,
202
+ italic: styleDefinition.italic,
203
+ underline: styleDefinition.underline,
204
+ dim: styleDefinition.dim
205
+ });
206
+ const merged = {
207
+ fg: styleDefinition.fg,
208
+ bg: styleDefinition.bg,
209
+ attributes
210
+ };
211
+ this.mergedCache.set(cacheKey, merged);
212
+ return merged;
213
+ }
214
+ clearCache() {
215
+ this.guard();
216
+ this.mergedCache.clear();
217
+ }
218
+ getCacheSize() {
219
+ this.guard();
220
+ return this.mergedCache.size;
221
+ }
222
+ getAllStyles() {
223
+ this.guard();
224
+ return new Map(this.styleDefs);
225
+ }
226
+ getRegisteredNames() {
227
+ this.guard();
228
+ return Array.from(this.styleDefs.keys());
229
+ }
230
+ destroy() {
231
+ if (this._destroyed)
232
+ return;
233
+ this._destroyed = true;
234
+ this.nameCache.clear();
235
+ this.styleDefs.clear();
236
+ this.mergedCache.clear();
237
+ this.lib.destroySyntaxStyle(this.stylePtr);
238
+ }
239
+ }
44
240
 
45
241
  // src/Renderable.ts
46
242
  import { EventEmitter } from "events";
@@ -120,22 +316,22 @@ function isSizeType(value) {
120
316
 
121
317
  // src/Renderable.ts
122
318
  var BrandedRenderable = Symbol.for("@opentui/core/Renderable");
123
- var LayoutEvents;
124
- ((LayoutEvents2) => {
125
- LayoutEvents2["LAYOUT_CHANGED"] = "layout-changed";
126
- LayoutEvents2["RESIZED"] = "resized";
127
- })(LayoutEvents ||= {});
128
- var RenderableEvents;
129
- ((RenderableEvents2) => {
130
- RenderableEvents2["FOCUSED"] = "focused";
131
- RenderableEvents2["BLURRED"] = "blurred";
132
- RenderableEvents2["DESTROYED"] = "destroyed";
133
- })(RenderableEvents ||= {});
134
- function isRenderable(obj) {
319
+ var LayoutEvents2;
320
+ ((LayoutEvents) => {
321
+ LayoutEvents["LAYOUT_CHANGED"] = "layout-changed";
322
+ LayoutEvents["RESIZED"] = "resized";
323
+ })(LayoutEvents2 ||= {});
324
+ var RenderableEvents2;
325
+ ((RenderableEvents) => {
326
+ RenderableEvents["FOCUSED"] = "focused";
327
+ RenderableEvents["BLURRED"] = "blurred";
328
+ RenderableEvents["DESTROYED"] = "destroyed";
329
+ })(RenderableEvents2 ||= {});
330
+ function isRenderable2(obj) {
135
331
  return !!obj?.[BrandedRenderable];
136
332
  }
137
333
 
138
- class BaseRenderable extends EventEmitter {
334
+ class BaseRenderable2 extends EventEmitter {
139
335
  [BrandedRenderable] = true;
140
336
  static renderableNumber = 1;
141
337
  _id;
@@ -145,7 +341,7 @@ class BaseRenderable extends EventEmitter {
145
341
  _visible = true;
146
342
  constructor(options) {
147
343
  super();
148
- this.num = BaseRenderable.renderableNumber++;
344
+ this.num = BaseRenderable2.renderableNumber++;
149
345
  this._id = options.id ?? `renderable-${this.num}`;
150
346
  }
151
347
  get id() {
@@ -189,7 +385,7 @@ function bumpRenderListRevision(ctx) {
189
385
  generationContext.__otuiRenderListRevision = getRenderListRevision(ctx) + 1;
190
386
  }
191
387
 
192
- class Renderable extends BaseRenderable {
388
+ class Renderable2 extends BaseRenderable2 {
193
389
  static renderablesByNumber = new Map;
194
390
  _isDestroyed = false;
195
391
  _ctx;
@@ -239,7 +435,7 @@ class Renderable extends BaseRenderable {
239
435
  constructor(ctx, options) {
240
436
  super(options);
241
437
  this._ctx = ctx;
242
- Renderable.renderablesByNumber.set(this.num, this);
438
+ Renderable2.renderablesByNumber.set(this.num, this);
243
439
  validateOptions(this.id, options);
244
440
  this.renderBefore = options.renderBefore;
245
441
  this.renderAfter = options.renderAfter;
@@ -411,7 +607,7 @@ class Renderable extends BaseRenderable {
411
607
  for (const child of this._childrenInLayoutOrder) {
412
608
  if (child.id === id)
413
609
  return child;
414
- if (isRenderable(child)) {
610
+ if (isRenderable2(child)) {
415
611
  const found = child.findDescendantById(id);
416
612
  if (found)
417
613
  return found;
@@ -600,11 +796,11 @@ class Renderable extends BaseRenderable {
600
796
  this._flexShrink = hasExplicitWidth || hasExplicitHeight ? 0 : 1;
601
797
  node.setFlexShrink(this._flexShrink);
602
798
  }
603
- node.setFlexDirection(parseFlexDirection(options.flexDirection));
604
- node.setFlexWrap(parseWrap(options.flexWrap));
605
- node.setAlignItems(parseAlignItems(options.alignItems));
606
- node.setJustifyContent(parseJustify(options.justifyContent));
607
- node.setAlignSelf(parseAlign(options.alignSelf));
799
+ node.setFlexDirection(parseFlexDirection2(options.flexDirection));
800
+ node.setFlexWrap(parseWrap2(options.flexWrap));
801
+ node.setAlignItems(parseAlignItems2(options.alignItems));
802
+ node.setJustifyContent(parseJustify2(options.justifyContent));
803
+ node.setAlignSelf(parseAlign2(options.alignSelf));
608
804
  if (isDimensionType(options.width)) {
609
805
  this._width = options.width;
610
806
  this.yogaNode.setWidth(options.width);
@@ -615,11 +811,11 @@ class Renderable extends BaseRenderable {
615
811
  }
616
812
  this._positionType = options.position === "absolute" ? "absolute" : "relative";
617
813
  if (this._positionType !== "relative") {
618
- node.setPositionType(parsePositionType(this._positionType));
814
+ node.setPositionType(parsePositionType2(this._positionType));
619
815
  }
620
816
  this._overflow = options.overflow === "hidden" ? "hidden" : options.overflow === "scroll" ? "scroll" : "visible";
621
817
  if (this._overflow !== "visible") {
622
- node.setOverflow(parseOverflow(this._overflow));
818
+ node.setOverflow(parseOverflow2(this._overflow));
623
819
  }
624
820
  const hasPositionProps = options.top !== undefined || options.right !== undefined || options.bottom !== undefined || options.left !== undefined;
625
821
  if (hasPositionProps) {
@@ -688,7 +884,7 @@ class Renderable extends BaseRenderable {
688
884
  if (!isPositionTypeType(positionType) || this._positionType === positionType)
689
885
  return;
690
886
  this._positionType = positionType;
691
- this.yogaNode.setPositionType(parsePositionType(positionType));
887
+ this.yogaNode.setPositionType(parsePositionType2(positionType));
692
888
  this.requestRender();
693
889
  }
694
890
  get overflow() {
@@ -698,7 +894,7 @@ class Renderable extends BaseRenderable {
698
894
  if (!isOverflowType(overflow) || this._overflow === overflow)
699
895
  return;
700
896
  this._overflow = overflow;
701
- this.yogaNode.setOverflow(parseOverflow(overflow));
897
+ this.yogaNode.setOverflow(parseOverflow2(overflow));
702
898
  bumpRenderListRevision(this._ctx);
703
899
  this.requestRender();
704
900
  }
@@ -754,23 +950,23 @@ class Renderable extends BaseRenderable {
754
950
  this.requestRender();
755
951
  }
756
952
  set flexDirection(direction) {
757
- this.yogaNode.setFlexDirection(parseFlexDirection(direction));
953
+ this.yogaNode.setFlexDirection(parseFlexDirection2(direction));
758
954
  this.requestRender();
759
955
  }
760
956
  set flexWrap(wrap) {
761
- this.yogaNode.setFlexWrap(parseWrap(wrap));
957
+ this.yogaNode.setFlexWrap(parseWrap2(wrap));
762
958
  this.requestRender();
763
959
  }
764
960
  set alignItems(alignItems) {
765
- this.yogaNode.setAlignItems(parseAlignItems(alignItems));
961
+ this.yogaNode.setAlignItems(parseAlignItems2(alignItems));
766
962
  this.requestRender();
767
963
  }
768
964
  set justifyContent(justifyContent) {
769
- this.yogaNode.setJustifyContent(parseJustify(justifyContent));
965
+ this.yogaNode.setJustifyContent(parseJustify2(justifyContent));
770
966
  this.requestRender();
771
967
  }
772
968
  set alignSelf(alignSelf) {
773
- this.yogaNode.setAlignSelf(parseAlign(alignSelf));
969
+ this.yogaNode.setAlignSelf(parseAlign2(alignSelf));
774
970
  this.requestRender();
775
971
  }
776
972
  set flexBasis(basis) {
@@ -955,7 +1151,7 @@ class Renderable extends BaseRenderable {
955
1151
  }
956
1152
  try {
957
1153
  const widthMethod = this._ctx.widthMethod;
958
- this.frameBuffer = OptimizedBuffer.create(w, h, widthMethod, {
1154
+ this.frameBuffer = OptimizedBuffer2.create(w, h, widthMethod, {
959
1155
  respectAlpha: true,
960
1156
  id: `framebuffer-${this.id}`
961
1157
  });
@@ -978,7 +1174,7 @@ class Renderable extends BaseRenderable {
978
1174
  if (!obj) {
979
1175
  return -1;
980
1176
  }
981
- const renderable = maybeMakeRenderable(this._ctx, obj);
1177
+ const renderable = maybeMakeRenderable2(this._ctx, obj);
982
1178
  if (!renderable) {
983
1179
  return -1;
984
1180
  }
@@ -1023,7 +1219,7 @@ class Renderable extends BaseRenderable {
1023
1219
  if (!obj) {
1024
1220
  return -1;
1025
1221
  }
1026
- const renderable = maybeMakeRenderable(this._ctx, obj);
1222
+ const renderable = maybeMakeRenderable2(this._ctx, obj);
1027
1223
  if (!renderable) {
1028
1224
  return -1;
1029
1225
  }
@@ -1033,7 +1229,7 @@ class Renderable extends BaseRenderable {
1033
1229
  }
1034
1230
  return -1;
1035
1231
  }
1036
- if (!isRenderable(anchor)) {
1232
+ if (!isRenderable2(anchor)) {
1037
1233
  throw new Error("Anchor must be a Renderable");
1038
1234
  }
1039
1235
  if (anchor.isDestroyed) {
@@ -1082,7 +1278,7 @@ class Renderable extends BaseRenderable {
1082
1278
  return this._childrenInLayoutOrder.find((child) => child.id === id);
1083
1279
  }
1084
1280
  remove(child) {
1085
- if (!(child instanceof BaseRenderable)) {
1281
+ if (!(child instanceof BaseRenderable2)) {
1086
1282
  throw new Error("remove expects a renderable child object");
1087
1283
  }
1088
1284
  const index = this._childrenInLayoutOrder.indexOf(child);
@@ -1199,13 +1395,13 @@ class Renderable extends BaseRenderable {
1199
1395
  }
1200
1396
  }
1201
1397
  _hasVisibleChildFilter() {
1202
- return this._getVisibleChildren !== Renderable.prototype._getVisibleChildren;
1398
+ return this._getVisibleChildren !== Renderable2.prototype._getVisibleChildren;
1203
1399
  }
1204
1400
  _getVisibleChildren() {
1205
1401
  return this._childrenInZIndexOrder.map((child) => child.num);
1206
1402
  }
1207
1403
  canReuseRenderCommandList() {
1208
- return this.onUpdate === Renderable.prototype.onUpdate && (this._overflow === "visible" || this.getScissorRect === Renderable.prototype.getScissorRect) && !this._hasVisibleChildFilter();
1404
+ return this.onUpdate === Renderable2.prototype.onUpdate && (this._overflow === "visible" || this.getScissorRect === Renderable2.prototype.getScissorRect) && !this._hasVisibleChildFilter();
1209
1405
  }
1210
1406
  onUpdate(deltaTime) {}
1211
1407
  getScissorRect() {
@@ -1239,7 +1435,7 @@ class Renderable extends BaseRenderable {
1239
1435
  this._childrenInLayoutOrder = [];
1240
1436
  this._childrenInZIndexOrder = [];
1241
1437
  this._shouldUpdateBefore.clear();
1242
- Renderable.renderablesByNumber.delete(this.num);
1438
+ Renderable2.renderablesByNumber.delete(this.num);
1243
1439
  this.blur();
1244
1440
  this.removeAllListeners();
1245
1441
  this.destroySelf();
@@ -1363,7 +1559,7 @@ class Renderable extends BaseRenderable {
1363
1559
  }
1364
1560
  }
1365
1561
 
1366
- class RootRenderable extends Renderable {
1562
+ class RootRenderable2 extends Renderable2 {
1367
1563
  renderList = [];
1368
1564
  _currentRenderable;
1369
1565
  appliedLayoutGeneration = -1;
@@ -1490,7 +1686,7 @@ class RootRenderable extends Renderable {
1490
1686
  import util from "node:util";
1491
1687
  var BrandedVNode = Symbol.for("@opentui/core/VNode");
1492
1688
  function isRenderableConstructor(value) {
1493
- return typeof value === "function" && value.prototype && Renderable.prototype.isPrototypeOf(value.prototype);
1689
+ return typeof value === "function" && value.prototype && Renderable2.prototype.isPrototypeOf(value.prototype);
1494
1690
  }
1495
1691
  function flattenChildren(children) {
1496
1692
  const result = [];
@@ -1503,7 +1699,7 @@ function flattenChildren(children) {
1503
1699
  }
1504
1700
  return result;
1505
1701
  }
1506
- function h(type, props, ...children) {
1702
+ function h2(type, props, ...children) {
1507
1703
  if (typeof type !== "function") {
1508
1704
  throw new TypeError("h() received an invalid vnode type");
1509
1705
  }
@@ -1549,20 +1745,20 @@ function h(type, props, ...children) {
1549
1745
  }
1550
1746
  return vnode;
1551
1747
  }
1552
- function isVNode(node) {
1748
+ function isVNode2(node) {
1553
1749
  return node && node[BrandedVNode];
1554
1750
  }
1555
- function maybeMakeRenderable(ctx, node) {
1556
- if (isRenderable(node))
1751
+ function maybeMakeRenderable2(ctx, node) {
1752
+ if (isRenderable2(node))
1557
1753
  return node;
1558
- if (isVNode(node))
1559
- return instantiate(ctx, node);
1754
+ if (isVNode2(node))
1755
+ return instantiate2(ctx, node);
1560
1756
  if (true) {
1561
1757
  console.warn("maybeMakeRenderable received an invalid node", util.inspect(node, { depth: 2 }));
1562
1758
  }
1563
1759
  return null;
1564
1760
  }
1565
- function wrapWithDelegates(instance, delegateMap) {
1761
+ function wrapWithDelegates2(instance, delegateMap) {
1566
1762
  if (!delegateMap || Object.keys(delegateMap).length === 0)
1567
1763
  return instance;
1568
1764
  const getDescendant = (id) => {
@@ -1594,8 +1790,8 @@ function wrapWithDelegates(instance, delegateMap) {
1594
1790
  });
1595
1791
  return proxy;
1596
1792
  }
1597
- function instantiate(ctx, node) {
1598
- if (isRenderable(node))
1793
+ function instantiate2(ctx, node) {
1794
+ if (isRenderable2(node))
1599
1795
  return node;
1600
1796
  if (!node || typeof node !== "object") {
1601
1797
  throw new TypeError("mount() received an invalid vnode");
@@ -1607,14 +1803,14 @@ function instantiate(ctx, node) {
1607
1803
  if (isRenderableConstructor(type)) {
1608
1804
  const instance = new type(ctx, props || {});
1609
1805
  for (const child of children) {
1610
- if (isRenderable(child)) {
1806
+ if (isRenderable2(child)) {
1611
1807
  instance.add(child);
1612
1808
  } else {
1613
- const mounted = instantiate(ctx, child);
1809
+ const mounted = instantiate2(ctx, child);
1614
1810
  instance.add(mounted);
1615
1811
  }
1616
1812
  }
1617
- const delegatedInstance = wrapWithDelegates(instance, delegateMap);
1813
+ const delegatedInstance = wrapWithDelegates2(instance, delegateMap);
1618
1814
  const pendingCalls = vnode.__pendingCalls;
1619
1815
  if (pendingCalls) {
1620
1816
  for (const call of pendingCalls) {
@@ -1628,12 +1824,12 @@ function instantiate(ctx, node) {
1628
1824
  return delegatedInstance;
1629
1825
  }
1630
1826
  const resolved = type(props || {}, children);
1631
- const inst = instantiate(ctx, resolved);
1632
- return wrapWithDelegates(inst, delegateMap);
1827
+ const inst = instantiate2(ctx, resolved);
1828
+ return wrapWithDelegates2(inst, delegateMap);
1633
1829
  }
1634
- function delegate(mapping, vnode) {
1635
- if (isRenderable(vnode)) {
1636
- return wrapWithDelegates(vnode, mapping);
1830
+ function delegate2(mapping, vnode) {
1831
+ if (isRenderable2(vnode)) {
1832
+ return wrapWithDelegates2(vnode, mapping);
1637
1833
  }
1638
1834
  if (!vnode || typeof vnode !== "object")
1639
1835
  return vnode;
@@ -1642,7 +1838,7 @@ function delegate(mapping, vnode) {
1642
1838
  }
1643
1839
 
1644
1840
  // src/text-buffer-view.ts
1645
- class TextBufferView {
1841
+ class TextBufferView2 {
1646
1842
  lib;
1647
1843
  viewPtr;
1648
1844
  textBuffer;
@@ -1653,9 +1849,9 @@ class TextBufferView {
1653
1849
  this.textBuffer = textBuffer;
1654
1850
  }
1655
1851
  static create(textBuffer) {
1656
- const lib = resolveRenderLib();
1852
+ const lib = resolveRenderLib2();
1657
1853
  const viewPtr = lib.createTextBufferView(textBuffer.ptr);
1658
- return new TextBufferView(lib, viewPtr, textBuffer);
1854
+ return new TextBufferView2(lib, viewPtr, textBuffer);
1659
1855
  }
1660
1856
  guard() {
1661
1857
  if (this._destroyed)
@@ -1713,6 +1909,10 @@ class TextBufferView {
1713
1909
  this.guard();
1714
1910
  this.lib.textBufferViewSetWrapMode(this.viewPtr, mode);
1715
1911
  }
1912
+ setTextAlign(alignment) {
1913
+ this.guard();
1914
+ this.lib.textBufferViewSetTextAlign(this.viewPtr, alignment);
1915
+ }
1716
1916
  setFirstLineOffset(offset) {
1717
1917
  this.guard();
1718
1918
  this.lib.textBufferViewSetFirstLineOffset(this.viewPtr, offset);
@@ -1733,6 +1933,10 @@ class TextBufferView {
1733
1933
  this.guard();
1734
1934
  return this.lib.textBufferViewGetLogicalLineInfo(this.viewPtr);
1735
1935
  }
1936
+ getLineSources(startLine, lineCount) {
1937
+ this.guard();
1938
+ return this.lib.textBufferViewGetLineSources(this.viewPtr, startLine, lineCount);
1939
+ }
1736
1940
  getSelectedText() {
1737
1941
  this.guard();
1738
1942
  const byteSize = this.textBuffer.byteSize;
@@ -1785,7 +1989,7 @@ class TextBufferView {
1785
1989
  // src/edit-buffer.ts
1786
1990
  import { EventEmitter as EventEmitter2 } from "events";
1787
1991
 
1788
- class EditBuffer extends EventEmitter2 {
1992
+ class EditBuffer2 extends EventEmitter2 {
1789
1993
  static registry = new Map;
1790
1994
  static nativeEventsSubscribed = false;
1791
1995
  lib;
@@ -1803,23 +2007,23 @@ class EditBuffer extends EventEmitter2 {
1803
2007
  this.bufferPtr = ptr;
1804
2008
  this.textBufferPtr = lib.editBufferGetTextBuffer(ptr);
1805
2009
  this.id = lib.editBufferGetId(ptr);
1806
- EditBuffer.registry.set(this.id, this);
1807
- EditBuffer.subscribeToNativeEvents(lib);
2010
+ EditBuffer2.registry.set(this.id, this);
2011
+ EditBuffer2.subscribeToNativeEvents(lib);
1808
2012
  }
1809
2013
  static create(widthMethod) {
1810
- const lib = resolveRenderLib();
2014
+ const lib = resolveRenderLib2();
1811
2015
  const ptr = lib.createEditBuffer(widthMethod);
1812
- return new EditBuffer(lib, ptr);
2016
+ return new EditBuffer2(lib, ptr);
1813
2017
  }
1814
2018
  static subscribeToNativeEvents(lib) {
1815
- if (EditBuffer.nativeEventsSubscribed)
2019
+ if (EditBuffer2.nativeEventsSubscribed)
1816
2020
  return;
1817
- EditBuffer.nativeEventsSubscribed = true;
2021
+ EditBuffer2.nativeEventsSubscribed = true;
1818
2022
  lib.onAnyNativeEvent((name, data) => {
1819
2023
  const buffer = new Uint16Array(data);
1820
2024
  if (name.startsWith("eb_") && buffer.length >= 1) {
1821
2025
  const id = buffer[0];
1822
- const instance = EditBuffer.registry.get(id);
2026
+ const instance = EditBuffer2.registry.get(id);
1823
2027
  if (instance) {
1824
2028
  const eventName = name.slice(3);
1825
2029
  const eventData = data.slice(2);
@@ -2098,13 +2302,13 @@ class EditBuffer extends EventEmitter2 {
2098
2302
  if (this._destroyed)
2099
2303
  return;
2100
2304
  this._destroyed = true;
2101
- EditBuffer.registry.delete(this.id);
2305
+ EditBuffer2.registry.delete(this.id);
2102
2306
  this.lib.destroyEditBuffer(this.bufferPtr);
2103
2307
  }
2104
2308
  }
2105
2309
 
2106
2310
  // src/editor-view.ts
2107
- class EditorView {
2311
+ class EditorView2 {
2108
2312
  lib;
2109
2313
  viewPtr;
2110
2314
  editBuffer;
@@ -2117,9 +2321,12 @@ class EditorView {
2117
2321
  this.editBuffer = editBuffer;
2118
2322
  }
2119
2323
  static create(editBuffer, viewportWidth, viewportHeight) {
2120
- const lib = resolveRenderLib();
2324
+ const lib = resolveRenderLib2();
2121
2325
  const viewPtr = lib.createEditorView(editBuffer.ptr, viewportWidth, viewportHeight);
2122
- return new EditorView(lib, viewPtr, editBuffer);
2326
+ return new EditorView2(lib, viewPtr, editBuffer);
2327
+ }
2328
+ get isDestroyed() {
2329
+ return this._destroyed;
2123
2330
  }
2124
2331
  guard() {
2125
2332
  if (this._destroyed)
@@ -2284,7 +2491,7 @@ class EditorView {
2284
2491
  }
2285
2492
  get extmarks() {
2286
2493
  if (!this._extmarksController) {
2287
- this._extmarksController = createExtmarksController(this.editBuffer, this);
2494
+ this._extmarksController = createExtmarksController2(this.editBuffer, this);
2288
2495
  }
2289
2496
  return this._extmarksController;
2290
2497
  }
@@ -2318,201 +2525,6 @@ class EditorView {
2318
2525
  }
2319
2526
  }
2320
2527
 
2321
- // src/syntax-style.ts
2322
- function convertThemeToStyles(theme) {
2323
- const flatStyles = {};
2324
- for (const tokenStyle of theme) {
2325
- const styleDefinition = {};
2326
- if (tokenStyle.style.foreground) {
2327
- styleDefinition.fg = parseColor(tokenStyle.style.foreground);
2328
- }
2329
- if (tokenStyle.style.background) {
2330
- styleDefinition.bg = parseColor(tokenStyle.style.background);
2331
- }
2332
- if (tokenStyle.style.bold !== undefined) {
2333
- styleDefinition.bold = tokenStyle.style.bold;
2334
- }
2335
- if (tokenStyle.style.italic !== undefined) {
2336
- styleDefinition.italic = tokenStyle.style.italic;
2337
- }
2338
- if (tokenStyle.style.underline !== undefined) {
2339
- styleDefinition.underline = tokenStyle.style.underline;
2340
- }
2341
- if (tokenStyle.style.dim !== undefined) {
2342
- styleDefinition.dim = tokenStyle.style.dim;
2343
- }
2344
- for (const scope of tokenStyle.scope) {
2345
- flatStyles[scope] = styleDefinition;
2346
- }
2347
- }
2348
- return flatStyles;
2349
- }
2350
-
2351
- class SyntaxStyle {
2352
- lib;
2353
- stylePtr;
2354
- _destroyed = false;
2355
- nameCache = new Map;
2356
- styleDefs = new Map;
2357
- mergedCache = new Map;
2358
- constructor(lib, ptr) {
2359
- this.lib = lib;
2360
- this.stylePtr = ptr;
2361
- }
2362
- static create() {
2363
- const lib = resolveRenderLib();
2364
- const ptr = lib.createSyntaxStyle();
2365
- return new SyntaxStyle(lib, ptr);
2366
- }
2367
- static fromTheme(theme) {
2368
- const style = SyntaxStyle.create();
2369
- const flatStyles = convertThemeToStyles(theme);
2370
- for (const [name, styleDef] of Object.entries(flatStyles)) {
2371
- style.registerStyle(name, styleDef);
2372
- }
2373
- return style;
2374
- }
2375
- static fromStyles(styles) {
2376
- const style = SyntaxStyle.create();
2377
- for (const [name, styleDef] of Object.entries(styles)) {
2378
- style.registerStyle(name, styleDef);
2379
- }
2380
- return style;
2381
- }
2382
- guard() {
2383
- if (this._destroyed)
2384
- throw new Error("NativeSyntaxStyle is destroyed");
2385
- }
2386
- registerStyle(name, style) {
2387
- this.guard();
2388
- const attributes = createTextAttributes({
2389
- bold: style.bold,
2390
- italic: style.italic,
2391
- underline: style.underline,
2392
- dim: style.dim
2393
- });
2394
- const fg = style.fg ? parseColor(style.fg) : null;
2395
- const bg = style.bg ? parseColor(style.bg) : null;
2396
- const id = this.lib.syntaxStyleRegister(this.stylePtr, name, fg, bg, attributes);
2397
- this.nameCache.set(name, id);
2398
- this.styleDefs.set(name, { ...style, fg: fg ?? undefined, bg: bg ?? undefined });
2399
- return id;
2400
- }
2401
- resolveStyleId(name) {
2402
- this.guard();
2403
- const cached = this.nameCache.get(name);
2404
- if (cached !== undefined)
2405
- return cached;
2406
- const id = this.lib.syntaxStyleResolveByName(this.stylePtr, name);
2407
- if (id !== null) {
2408
- this.nameCache.set(name, id);
2409
- }
2410
- return id;
2411
- }
2412
- getStyleId(name) {
2413
- this.guard();
2414
- const id = this.resolveStyleId(name);
2415
- if (id !== null)
2416
- return id;
2417
- if (name.includes(".")) {
2418
- const baseName = name.split(".")[0];
2419
- return this.resolveStyleId(baseName);
2420
- }
2421
- return null;
2422
- }
2423
- get ptr() {
2424
- this.guard();
2425
- return this.stylePtr;
2426
- }
2427
- getStyleCount() {
2428
- this.guard();
2429
- return this.lib.syntaxStyleGetStyleCount(this.stylePtr);
2430
- }
2431
- clearNameCache() {
2432
- this.nameCache.clear();
2433
- }
2434
- getStyle(name) {
2435
- this.guard();
2436
- if (Object.prototype.hasOwnProperty.call(this.styleDefs, name)) {
2437
- return;
2438
- }
2439
- const style = this.styleDefs.get(name);
2440
- if (style)
2441
- return style;
2442
- if (name.includes(".")) {
2443
- const baseName = name.split(".")[0];
2444
- if (Object.prototype.hasOwnProperty.call(this.styleDefs, baseName)) {
2445
- return;
2446
- }
2447
- return this.styleDefs.get(baseName);
2448
- }
2449
- return;
2450
- }
2451
- mergeStyles(...styleNames) {
2452
- this.guard();
2453
- const cacheKey = styleNames.join(":");
2454
- const cached = this.mergedCache.get(cacheKey);
2455
- if (cached)
2456
- return cached;
2457
- const styleDefinition = {};
2458
- for (const name of styleNames) {
2459
- const style = this.getStyle(name);
2460
- if (!style)
2461
- continue;
2462
- if (style.fg)
2463
- styleDefinition.fg = style.fg;
2464
- if (style.bg)
2465
- styleDefinition.bg = style.bg;
2466
- if (style.bold !== undefined)
2467
- styleDefinition.bold = style.bold;
2468
- if (style.italic !== undefined)
2469
- styleDefinition.italic = style.italic;
2470
- if (style.underline !== undefined)
2471
- styleDefinition.underline = style.underline;
2472
- if (style.dim !== undefined)
2473
- styleDefinition.dim = style.dim;
2474
- }
2475
- const attributes = createTextAttributes({
2476
- bold: styleDefinition.bold,
2477
- italic: styleDefinition.italic,
2478
- underline: styleDefinition.underline,
2479
- dim: styleDefinition.dim
2480
- });
2481
- const merged = {
2482
- fg: styleDefinition.fg,
2483
- bg: styleDefinition.bg,
2484
- attributes
2485
- };
2486
- this.mergedCache.set(cacheKey, merged);
2487
- return merged;
2488
- }
2489
- clearCache() {
2490
- this.guard();
2491
- this.mergedCache.clear();
2492
- }
2493
- getCacheSize() {
2494
- this.guard();
2495
- return this.mergedCache.size;
2496
- }
2497
- getAllStyles() {
2498
- this.guard();
2499
- return new Map(this.styleDefs);
2500
- }
2501
- getRegisteredNames() {
2502
- this.guard();
2503
- return Array.from(this.styleDefs.keys());
2504
- }
2505
- destroy() {
2506
- if (this._destroyed)
2507
- return;
2508
- this._destroyed = true;
2509
- this.nameCache.clear();
2510
- this.styleDefs.clear();
2511
- this.mergedCache.clear();
2512
- this.lib.destroySyntaxStyle(this.stylePtr);
2513
- }
2514
- }
2515
-
2516
2528
  // src/renderables/Box.ts
2517
2529
  function isGapType(value) {
2518
2530
  if (value === undefined) {
@@ -2524,7 +2536,7 @@ function isGapType(value) {
2524
2536
  return isValidPercentage(value);
2525
2537
  }
2526
2538
 
2527
- class BoxRenderable extends Renderable {
2539
+ class BoxRenderable2 extends Renderable2 {
2528
2540
  _backgroundColor;
2529
2541
  _border;
2530
2542
  _borderStyle;
@@ -2554,20 +2566,20 @@ class BoxRenderable extends Renderable {
2554
2566
  if (options.focusable === true) {
2555
2567
  this._focusable = true;
2556
2568
  }
2557
- this._backgroundColor = parseColor(options.backgroundColor || this._defaultOptions.backgroundColor);
2569
+ this._backgroundColor = parseColor2(options.backgroundColor || this._defaultOptions.backgroundColor);
2558
2570
  this._border = options.border ?? this._defaultOptions.border;
2559
2571
  if (!options.border && (options.borderStyle || options.borderColor || options.focusedBorderColor || options.customBorderChars)) {
2560
2572
  this._border = true;
2561
2573
  }
2562
- this._borderStyle = parseBorderStyle(options.borderStyle, this._defaultOptions.borderStyle);
2563
- this._borderColor = parseColor(options.borderColor || this._defaultOptions.borderColor);
2564
- this._focusedBorderColor = parseColor(options.focusedBorderColor || this._defaultOptions.focusedBorderColor);
2574
+ this._borderStyle = parseBorderStyle2(options.borderStyle, this._defaultOptions.borderStyle);
2575
+ this._borderColor = parseColor2(options.borderColor || this._defaultOptions.borderColor);
2576
+ this._focusedBorderColor = parseColor2(options.focusedBorderColor || this._defaultOptions.focusedBorderColor);
2565
2577
  this._customBorderCharsObj = options.customBorderChars;
2566
- this._customBorderChars = this._customBorderCharsObj ? borderCharsToArray(this._customBorderCharsObj) : undefined;
2567
- this.borderSides = getBorderSides(this._border);
2578
+ this._customBorderChars = this._customBorderCharsObj ? borderCharsToArray2(this._customBorderCharsObj) : undefined;
2579
+ this.borderSides = getBorderSides2(this._border);
2568
2580
  this.shouldFill = options.shouldFill ?? this._defaultOptions.shouldFill;
2569
2581
  this._title = options.title;
2570
- this._titleColor = options.titleColor ? parseColor(options.titleColor) : undefined;
2582
+ this._titleColor = options.titleColor ? parseColor2(options.titleColor) : undefined;
2571
2583
  this._titleAlignment = options.titleAlignment || this._defaultOptions.titleAlignment;
2572
2584
  this._bottomTitle = options.bottomTitle;
2573
2585
  this._bottomTitleAlignment = options.bottomTitleAlignment || this._defaultOptions.bottomTitleAlignment;
@@ -2580,7 +2592,7 @@ class BoxRenderable extends Renderable {
2580
2592
  initializeBorder() {
2581
2593
  if (this._border === false) {
2582
2594
  this._border = true;
2583
- this.borderSides = getBorderSides(this._border);
2595
+ this.borderSides = getBorderSides2(this._border);
2584
2596
  this.applyYogaBorders();
2585
2597
  }
2586
2598
  }
@@ -2589,14 +2601,14 @@ class BoxRenderable extends Renderable {
2589
2601
  }
2590
2602
  set customBorderChars(value) {
2591
2603
  this._customBorderCharsObj = value;
2592
- this._customBorderChars = value ? borderCharsToArray(value) : undefined;
2604
+ this._customBorderChars = value ? borderCharsToArray2(value) : undefined;
2593
2605
  this.requestRender();
2594
2606
  }
2595
2607
  get backgroundColor() {
2596
2608
  return this._backgroundColor;
2597
2609
  }
2598
2610
  set backgroundColor(value) {
2599
- const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
2611
+ const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
2600
2612
  if (this._backgroundColor !== newColor) {
2601
2613
  this._backgroundColor = newColor;
2602
2614
  this.requestRender();
@@ -2608,7 +2620,7 @@ class BoxRenderable extends Renderable {
2608
2620
  set border(value) {
2609
2621
  if (this._border !== value) {
2610
2622
  this._border = value;
2611
- this.borderSides = getBorderSides(value);
2623
+ this.borderSides = getBorderSides2(value);
2612
2624
  this.applyYogaBorders();
2613
2625
  this.requestRender();
2614
2626
  }
@@ -2617,7 +2629,7 @@ class BoxRenderable extends Renderable {
2617
2629
  return this._borderStyle;
2618
2630
  }
2619
2631
  set borderStyle(value) {
2620
- const _value = parseBorderStyle(value, this._defaultOptions.borderStyle);
2632
+ const _value = parseBorderStyle2(value, this._defaultOptions.borderStyle);
2621
2633
  if (this._borderStyle !== _value || !this._border) {
2622
2634
  this._borderStyle = _value;
2623
2635
  this._customBorderChars = undefined;
@@ -2629,7 +2641,7 @@ class BoxRenderable extends Renderable {
2629
2641
  return this._borderColor;
2630
2642
  }
2631
2643
  set borderColor(value) {
2632
- const newColor = parseColor(value ?? this._defaultOptions.borderColor);
2644
+ const newColor = parseColor2(value ?? this._defaultOptions.borderColor);
2633
2645
  if (this._borderColor !== newColor) {
2634
2646
  this._borderColor = newColor;
2635
2647
  this.initializeBorder();
@@ -2640,7 +2652,7 @@ class BoxRenderable extends Renderable {
2640
2652
  return this._focusedBorderColor;
2641
2653
  }
2642
2654
  set focusedBorderColor(value) {
2643
- const newColor = parseColor(value ?? this._defaultOptions.focusedBorderColor);
2655
+ const newColor = parseColor2(value ?? this._defaultOptions.focusedBorderColor);
2644
2656
  if (this._focusedBorderColor !== newColor) {
2645
2657
  this._focusedBorderColor = newColor;
2646
2658
  this.initializeBorder();
@@ -2662,7 +2674,7 @@ class BoxRenderable extends Renderable {
2662
2674
  return this._titleColor;
2663
2675
  }
2664
2676
  set titleColor(value) {
2665
- const newColor = value ? parseColor(value) : undefined;
2677
+ const newColor = value ? parseColor2(value) : undefined;
2666
2678
  if (this._titleColor !== newColor) {
2667
2679
  this._titleColor = newColor;
2668
2680
  this.requestRender();
@@ -2780,7 +2792,7 @@ class BoxRenderable extends Renderable {
2780
2792
  }
2781
2793
 
2782
2794
  // src/renderables/TextBufferRenderable.ts
2783
- class TextBufferRenderable extends Renderable {
2795
+ class TextBufferRenderable2 extends Renderable2 {
2784
2796
  selectable = true;
2785
2797
  _defaultFg;
2786
2798
  _defaultBg;
@@ -2788,6 +2800,7 @@ class TextBufferRenderable extends Renderable {
2788
2800
  _selectionBg;
2789
2801
  _selectionFg;
2790
2802
  _wrapMode = "word";
2803
+ _textAlign = "left";
2791
2804
  lastLocalSelection = null;
2792
2805
  _tabIndicator;
2793
2806
  _tabIndicatorColor;
@@ -2800,35 +2813,38 @@ class TextBufferRenderable extends Renderable {
2800
2813
  _textBufferSyntaxStyle;
2801
2814
  nativeRenderable = null;
2802
2815
  _defaultOptions = {
2803
- fg: RGBA.fromValues(1, 1, 1, 1),
2804
- bg: RGBA.fromValues(0, 0, 0, 0),
2816
+ fg: RGBA2.fromValues(1, 1, 1, 1),
2817
+ bg: RGBA2.fromValues(0, 0, 0, 0),
2805
2818
  selectionBg: undefined,
2806
2819
  selectionFg: undefined,
2807
2820
  selectable: true,
2808
2821
  attributes: 0,
2809
2822
  wrapMode: "word",
2823
+ textAlign: "left",
2810
2824
  tabIndicator: undefined,
2811
2825
  tabIndicatorColor: undefined,
2812
2826
  truncate: false
2813
2827
  };
2814
2828
  constructor(ctx, options) {
2815
2829
  super(ctx, options);
2816
- this._defaultFg = parseColor(options.fg ?? this._defaultOptions.fg);
2817
- this._defaultBg = parseColor(options.bg ?? this._defaultOptions.bg);
2830
+ this._defaultFg = parseColor2(options.fg ?? this._defaultOptions.fg);
2831
+ this._defaultBg = parseColor2(options.bg ?? this._defaultOptions.bg);
2818
2832
  this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
2819
- this._selectionBg = options.selectionBg ? parseColor(options.selectionBg) : this._defaultOptions.selectionBg;
2820
- this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) : this._defaultOptions.selectionFg;
2833
+ this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : this._defaultOptions.selectionBg;
2834
+ this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
2821
2835
  this.selectable = options.selectable ?? this._defaultOptions.selectable;
2822
2836
  this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
2837
+ this._textAlign = options.textAlign ?? this._defaultOptions.textAlign;
2823
2838
  this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
2824
- this._tabIndicatorColor = options.tabIndicatorColor ? parseColor(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
2839
+ this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
2825
2840
  this._truncate = options.truncate ?? this._defaultOptions.truncate;
2826
- this.textBuffer = TextBuffer.create(this._ctx.widthMethod);
2827
- this.textBufferView = TextBufferView.create(this.textBuffer);
2841
+ this.textBuffer = TextBuffer2.create(this._ctx.widthMethod);
2842
+ this.textBufferView = TextBufferView2.create(this.textBuffer);
2828
2843
  this._firstLineOffset = ctx.claimFirstLineOffset?.(this) ?? 0;
2829
- this._textBufferSyntaxStyle = SyntaxStyle.create();
2844
+ this._textBufferSyntaxStyle = SyntaxStyle2.create();
2830
2845
  this.textBuffer.setSyntaxStyle(this._textBufferSyntaxStyle);
2831
2846
  this.textBufferView.setWrapMode(this._wrapMode);
2847
+ this.textBufferView.setTextAlign(this._textAlign);
2832
2848
  this.textBufferView.setFirstLineOffset(this._firstLineOffset);
2833
2849
  this.setupNativeRenderable();
2834
2850
  this.textBuffer.setDefaultFg(this._defaultFg);
@@ -2874,6 +2890,23 @@ class TextBufferRenderable extends Renderable {
2874
2890
  get lineInfo() {
2875
2891
  return this.textBufferView.logicalLineInfo;
2876
2892
  }
2893
+ getLineSources(startLine, lineCount) {
2894
+ if (this.needsLineInfoFallback(TextBufferRenderable2.prototype)) {
2895
+ return this.lineInfo.lineSources.slice(startLine, startLine + lineCount);
2896
+ }
2897
+ return this.textBufferView.getLineSources(startLine, lineCount);
2898
+ }
2899
+ needsLineInfoFallback(owner) {
2900
+ let prototype = this;
2901
+ while (prototype && prototype !== owner) {
2902
+ if (Object.hasOwn(prototype, "getLineSources"))
2903
+ return false;
2904
+ if (Object.hasOwn(prototype, "lineInfo"))
2905
+ return true;
2906
+ prototype = Object.getPrototypeOf(prototype);
2907
+ }
2908
+ return false;
2909
+ }
2877
2910
  get lineCount() {
2878
2911
  return this.textBuffer.getLineCount();
2879
2912
  }
@@ -2908,7 +2941,7 @@ class TextBufferRenderable extends Renderable {
2908
2941
  return this.lineInfo.lineWidthColsMax;
2909
2942
  }
2910
2943
  get scrollHeight() {
2911
- return this.lineInfo.lineStartCols.length;
2944
+ return this.virtualLineCount;
2912
2945
  }
2913
2946
  get maxScrollY() {
2914
2947
  return Math.max(0, this.scrollHeight - this.height);
@@ -2931,7 +2964,7 @@ class TextBufferRenderable extends Renderable {
2931
2964
  return this._defaultFg;
2932
2965
  }
2933
2966
  set fg(value) {
2934
- const newColor = parseColor(value ?? this._defaultOptions.fg);
2967
+ const newColor = parseColor2(value ?? this._defaultOptions.fg);
2935
2968
  if (this._defaultFg !== newColor) {
2936
2969
  this._defaultFg = newColor;
2937
2970
  this.textBuffer.setDefaultFg(this._defaultFg);
@@ -2943,7 +2976,7 @@ class TextBufferRenderable extends Renderable {
2943
2976
  return this._selectionBg;
2944
2977
  }
2945
2978
  set selectionBg(value) {
2946
- const newColor = value ? parseColor(value) : this._defaultOptions.selectionBg;
2979
+ const newColor = value ? parseColor2(value) : this._defaultOptions.selectionBg;
2947
2980
  if (this._selectionBg !== newColor) {
2948
2981
  this._selectionBg = newColor;
2949
2982
  if (this.lastLocalSelection) {
@@ -2956,7 +2989,7 @@ class TextBufferRenderable extends Renderable {
2956
2989
  return this._selectionFg;
2957
2990
  }
2958
2991
  set selectionFg(value) {
2959
- const newColor = value ? parseColor(value) : this._defaultOptions.selectionFg;
2992
+ const newColor = value ? parseColor2(value) : this._defaultOptions.selectionFg;
2960
2993
  if (this._selectionFg !== newColor) {
2961
2994
  this._selectionFg = newColor;
2962
2995
  if (this.lastLocalSelection) {
@@ -2969,7 +3002,7 @@ class TextBufferRenderable extends Renderable {
2969
3002
  return this._defaultBg;
2970
3003
  }
2971
3004
  set bg(value) {
2972
- const newColor = parseColor(value ?? this._defaultOptions.bg);
3005
+ const newColor = parseColor2(value ?? this._defaultOptions.bg);
2973
3006
  if (this._defaultBg !== newColor) {
2974
3007
  this._defaultBg = newColor;
2975
3008
  this.textBuffer.setDefaultBg(this._defaultBg);
@@ -3002,6 +3035,16 @@ class TextBufferRenderable extends Renderable {
3002
3035
  this.requestRender();
3003
3036
  }
3004
3037
  }
3038
+ get textAlign() {
3039
+ return this._textAlign;
3040
+ }
3041
+ set textAlign(value) {
3042
+ if (this._textAlign !== value) {
3043
+ this._textAlign = value;
3044
+ this.textBufferView.setTextAlign(this._textAlign);
3045
+ this.requestRender();
3046
+ }
3047
+ }
3005
3048
  get tabIndicator() {
3006
3049
  return this._tabIndicator;
3007
3050
  }
@@ -3018,7 +3061,7 @@ class TextBufferRenderable extends Renderable {
3018
3061
  return this._tabIndicatorColor;
3019
3062
  }
3020
3063
  set tabIndicatorColor(value) {
3021
- const newColor = value ? parseColor(value) : undefined;
3064
+ const newColor = value ? parseColor2(value) : undefined;
3022
3065
  if (this._tabIndicatorColor !== newColor) {
3023
3066
  this._tabIndicatorColor = newColor;
3024
3067
  if (newColor !== undefined) {
@@ -3065,13 +3108,13 @@ class TextBufferRenderable extends Renderable {
3065
3108
  this.emit("line-info-change");
3066
3109
  }
3067
3110
  setupNativeRenderable() {
3068
- const lib = resolveRenderLib();
3111
+ const lib = resolveRenderLib2();
3069
3112
  const nativeRenderable = lib.createNativeRenderable();
3070
3113
  if (!lib.nativeRenderableAttachYogaNode(nativeRenderable, this.yogaNode.ptr)) {
3071
3114
  lib.destroyNativeRenderable(nativeRenderable);
3072
3115
  throw new Error("Failed to attach native renderable Yoga node");
3073
3116
  }
3074
- if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable, NativeMeasureTargetKind.TextBufferView, this.textBufferView.ptr)) {
3117
+ if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable, NativeMeasureTargetKind2.TextBufferView, this.textBufferView.ptr)) {
3075
3118
  lib.destroyNativeRenderable(nativeRenderable);
3076
3119
  throw new Error("Failed to attach text buffer native measure target");
3077
3120
  }
@@ -3085,7 +3128,7 @@ class TextBufferRenderable extends Renderable {
3085
3128
  return localX >= 0 && localX < this.width && localY >= 0 && localY < this.height;
3086
3129
  }
3087
3130
  onSelectionChanged(selection) {
3088
- const localSelection = convertGlobalToLocalSelection(selection, this.x, this.y);
3131
+ const localSelection = convertGlobalToLocalSelection2(selection, this.x, this.y);
3089
3132
  this.lastLocalSelection = localSelection;
3090
3133
  let changed;
3091
3134
  if (!localSelection?.isActive) {
@@ -3131,7 +3174,7 @@ class TextBufferRenderable extends Renderable {
3131
3174
  if (this.isDestroyed)
3132
3175
  return;
3133
3176
  if (this.nativeRenderable) {
3134
- resolveRenderLib().destroyNativeRenderable(this.nativeRenderable);
3177
+ resolveRenderLib2().destroyNativeRenderable(this.nativeRenderable);
3135
3178
  this.nativeRenderable = null;
3136
3179
  }
3137
3180
  this.textBuffer.setSyntaxStyle(null);
@@ -3146,7 +3189,7 @@ class TextBufferRenderable extends Renderable {
3146
3189
  }
3147
3190
 
3148
3191
  // src/renderables/Code.ts
3149
- class CodeRenderable extends TextBufferRenderable {
3192
+ class CodeRenderable2 extends TextBufferRenderable2 {
3150
3193
  _content;
3151
3194
  _filetype;
3152
3195
  _syntaxStyle;
@@ -3181,7 +3224,7 @@ class CodeRenderable extends TextBufferRenderable {
3181
3224
  this._content = options.content ?? this._contentDefaultOptions.content;
3182
3225
  this._filetype = options.filetype;
3183
3226
  this._syntaxStyle = options.syntaxStyle;
3184
- this._treeSitterClient = options.treeSitterClient ?? getTreeSitterClient();
3227
+ this._treeSitterClient = options.treeSitterClient ?? getTreeSitterClient2();
3185
3228
  this._conceal = options.conceal ?? this._contentDefaultOptions.conceal;
3186
3229
  this._drawUnstyledText = options.drawUnstyledText ?? this._contentDefaultOptions.drawUnstyledText;
3187
3230
  this._streaming = options.streaming ?? this._contentDefaultOptions.streaming;
@@ -3215,7 +3258,7 @@ class CodeRenderable extends TextBufferRenderable {
3215
3258
  this.requestRender();
3216
3259
  return;
3217
3260
  }
3218
- if (this._initialStyledText && this._drawUnstyledText) {
3261
+ if (value && this._initialStyledText && this._drawUnstyledText) {
3219
3262
  this.textBuffer.setStyledText(this._initialStyledText);
3220
3263
  } else {
3221
3264
  this.textBuffer.setText(value);
@@ -3224,6 +3267,14 @@ class CodeRenderable extends TextBufferRenderable {
3224
3267
  this.updateTextInfo();
3225
3268
  }
3226
3269
  }
3270
+ updateStreamingPreview(content, initialStyledText) {
3271
+ this._content = content;
3272
+ this._initialStyledText = initialStyledText;
3273
+ this.invalidateHighlights();
3274
+ this.textBuffer.setStyledText(initialStyledText);
3275
+ this.setRenderedLineSources(undefined);
3276
+ this.updateTextInfo();
3277
+ }
3227
3278
  get lineInfo() {
3228
3279
  if (!this._renderedLineSources)
3229
3280
  return super.lineInfo;
@@ -3237,6 +3288,14 @@ class CodeRenderable extends TextBufferRenderable {
3237
3288
  };
3238
3289
  return this._mappedLineInfo;
3239
3290
  }
3291
+ getLineSources(startLine, lineCount) {
3292
+ if (this.needsLineInfoFallback(CodeRenderable2.prototype)) {
3293
+ return this.lineInfo.lineSources.slice(startLine, startLine + lineCount);
3294
+ }
3295
+ const sources = this.textBufferView.getLineSources(startLine, lineCount);
3296
+ const renderedLineSources = this._renderedLineSources;
3297
+ return renderedLineSources ? sources.map((line) => renderedLineSources[line] ?? line) : sources;
3298
+ }
3240
3299
  get wrapMode() {
3241
3300
  return super.wrapMode;
3242
3301
  }
@@ -3295,6 +3354,10 @@ class CodeRenderable extends TextBufferRenderable {
3295
3354
  }
3296
3355
  set initialStyledText(value) {
3297
3356
  if (this._initialStyledText !== value) {
3357
+ if (value && this._streaming && this._drawUnstyledText && this._isHighlighting) {
3358
+ this.updateStreamingPreview(this._content, value);
3359
+ return;
3360
+ }
3298
3361
  this._initialStyledText = value;
3299
3362
  this.invalidateHighlights();
3300
3363
  }
@@ -3422,15 +3485,18 @@ class CodeRenderable extends TextBufferRenderable {
3422
3485
  }
3423
3486
  }
3424
3487
  if (highlights.length > 0 || this._onChunks || this._baseHighlight) {
3488
+ const sourceRanges = this._onChunks ? [] : undefined;
3425
3489
  const context = {
3426
3490
  content,
3427
3491
  filetype,
3428
3492
  syntaxStyle: this._syntaxStyle,
3429
- highlights
3493
+ highlights,
3494
+ sourceRanges
3430
3495
  };
3431
- let chunks = treeSitterToTextChunks(content, highlights, this._syntaxStyle, {
3496
+ let chunks = treeSitterToTextChunks2(content, highlights, this._syntaxStyle, {
3432
3497
  enabled: this._conceal,
3433
- baseHighlight: this._baseHighlight
3498
+ baseHighlight: this._baseHighlight,
3499
+ ranges: sourceRanges
3434
3500
  });
3435
3501
  const renderedLineSources = this._onChunks ? undefined : this.getConcealLinesSourceMap(content, highlights);
3436
3502
  chunks = await this.transformChunks(chunks, context);
@@ -3440,7 +3506,7 @@ class CodeRenderable extends TextBufferRenderable {
3440
3506
  }
3441
3507
  if (this.isDestroyed)
3442
3508
  return;
3443
- const styledText = new StyledText(chunks);
3509
+ const styledText = new StyledText2(chunks);
3444
3510
  this.textBuffer.setStyledText(styledText);
3445
3511
  this.setRenderedLineSources(renderedLineSources);
3446
3512
  } else {
@@ -3529,7 +3595,7 @@ class CodeRenderable extends TextBufferRenderable {
3529
3595
  getConcealLinesSourceMap(content, highlights) {
3530
3596
  if (!this._conceal || content.length === 0)
3531
3597
  return;
3532
- const concealLineRanges = CodeRenderable.getMergedConcealLineRanges(highlights);
3598
+ const concealLineRanges = CodeRenderable2.getMergedConcealLineRanges(highlights);
3533
3599
  if (concealLineRanges.length === 0)
3534
3600
  return;
3535
3601
  const lineSources = [];
@@ -3571,7 +3637,7 @@ class CodeRenderable extends TextBufferRenderable {
3571
3637
  break;
3572
3638
  lineStart = newlineOffset + 1;
3573
3639
  }
3574
- if (lineSources.length === 0 || CodeRenderable.isIdentityLineSources(lineSources))
3640
+ if (lineSources.length === 0 || CodeRenderable2.isIdentityLineSources(lineSources))
3575
3641
  return;
3576
3642
  return lineSources;
3577
3643
  }
@@ -3633,12 +3699,12 @@ class CodeRenderable extends TextBufferRenderable {
3633
3699
 
3634
3700
  // src/renderables/TextNode.ts
3635
3701
  var BrandedTextNodeRenderable = Symbol.for("@opentui/core/TextNodeRenderable");
3636
- function isTextNodeRenderable(obj) {
3702
+ function isTextNodeRenderable2(obj) {
3637
3703
  return !!obj?.[BrandedTextNodeRenderable];
3638
3704
  }
3639
3705
  function styledTextToTextNodes(styledText) {
3640
3706
  return styledText.chunks.map((chunk) => {
3641
- const node = new TextNodeRenderable({
3707
+ const node = new TextNodeRenderable2({
3642
3708
  fg: chunk.fg,
3643
3709
  bg: chunk.bg,
3644
3710
  attributes: chunk.attributes,
@@ -3649,7 +3715,7 @@ function styledTextToTextNodes(styledText) {
3649
3715
  });
3650
3716
  }
3651
3717
 
3652
- class TextNodeRenderable extends BaseRenderable {
3718
+ class TextNodeRenderable2 extends BaseRenderable2 {
3653
3719
  [BrandedTextNodeRenderable] = true;
3654
3720
  _fg;
3655
3721
  _bg;
@@ -3659,8 +3725,8 @@ class TextNodeRenderable extends BaseRenderable {
3659
3725
  parent = null;
3660
3726
  constructor(options) {
3661
3727
  super(options);
3662
- this._fg = options.fg ? parseColor(options.fg) : undefined;
3663
- this._bg = options.bg ? parseColor(options.bg) : undefined;
3728
+ this._fg = options.fg ? parseColor2(options.fg) : undefined;
3729
+ this._bg = options.bg ? parseColor2(options.bg) : undefined;
3664
3730
  this._attributes = options.attributes ?? 0;
3665
3731
  this._link = options.link;
3666
3732
  }
@@ -3669,12 +3735,12 @@ class TextNodeRenderable extends BaseRenderable {
3669
3735
  }
3670
3736
  set children(children) {
3671
3737
  for (const child of this._children) {
3672
- if (isTextNodeRenderable(child) && child.parent === this) {
3738
+ if (isTextNodeRenderable2(child) && child.parent === this) {
3673
3739
  child.parent = null;
3674
3740
  }
3675
3741
  }
3676
3742
  for (const child of children) {
3677
- if (isTextNodeRenderable(child)) {
3743
+ if (isTextNodeRenderable2(child)) {
3678
3744
  if (child.parent && child.parent !== this) {
3679
3745
  child.parent.remove(child);
3680
3746
  }
@@ -3700,14 +3766,14 @@ class TextNodeRenderable extends BaseRenderable {
3700
3766
  this.requestRender();
3701
3767
  return insertIndex;
3702
3768
  }
3703
- if (isTextNodeRenderable(obj)) {
3769
+ if (isTextNodeRenderable2(obj)) {
3704
3770
  const insertIndex = this.prepareChildInsert(obj, index);
3705
3771
  this._children.splice(insertIndex, 0, obj);
3706
3772
  obj.parent = this;
3707
3773
  this.requestRender();
3708
3774
  return insertIndex;
3709
3775
  }
3710
- if (isStyledText(obj)) {
3776
+ if (isStyledText2(obj)) {
3711
3777
  const textNodes = styledTextToTextNodes(obj);
3712
3778
  if (index !== undefined) {
3713
3779
  this._children.splice(index, 0, ...textNodes);
@@ -3739,10 +3805,10 @@ class TextNodeRenderable extends BaseRenderable {
3739
3805
  }
3740
3806
  replace(obj, index) {
3741
3807
  const existing = this._children[index];
3742
- if (isTextNodeRenderable(existing) && existing.parent === this) {
3808
+ if (isTextNodeRenderable2(existing) && existing.parent === this) {
3743
3809
  existing.parent = null;
3744
3810
  }
3745
- if (isTextNodeRenderable(obj)) {
3811
+ if (isTextNodeRenderable2(obj)) {
3746
3812
  if (obj.parent && obj.parent !== this) {
3747
3813
  obj.parent.remove(obj);
3748
3814
  } else if (obj.parent === this) {
@@ -3759,7 +3825,7 @@ class TextNodeRenderable extends BaseRenderable {
3759
3825
  this.requestRender();
3760
3826
  }
3761
3827
  insertBefore(child, anchorNode) {
3762
- if (!anchorNode || !isTextNodeRenderable(anchorNode)) {
3828
+ if (!anchorNode || !isTextNodeRenderable2(anchorNode)) {
3763
3829
  throw new Error("Anchor must be a TextNodeRenderable");
3764
3830
  }
3765
3831
  const anchorIndex = this._children.indexOf(anchorNode);
@@ -3769,13 +3835,13 @@ class TextNodeRenderable extends BaseRenderable {
3769
3835
  if (child === anchorNode) {
3770
3836
  return this;
3771
3837
  }
3772
- if (isTextNodeRenderable(child)) {
3838
+ if (isTextNodeRenderable2(child)) {
3773
3839
  this.add(child, anchorIndex);
3774
3840
  return this;
3775
3841
  }
3776
3842
  if (typeof child === "string") {
3777
3843
  this._children.splice(anchorIndex, 0, child);
3778
- } else if (isStyledText(child)) {
3844
+ } else if (isStyledText2(child)) {
3779
3845
  const textNodes = styledTextToTextNodes(child);
3780
3846
  this._children.splice(anchorIndex, 0, ...textNodes);
3781
3847
  textNodes.forEach((node) => node.parent = this);
@@ -3786,7 +3852,7 @@ class TextNodeRenderable extends BaseRenderable {
3786
3852
  return this;
3787
3853
  }
3788
3854
  remove(child) {
3789
- if (!isTextNodeRenderable(child)) {
3855
+ if (!isTextNodeRenderable2(child)) {
3790
3856
  throw new Error("remove expects a TextNodeRenderable child object");
3791
3857
  }
3792
3858
  const childIndex = this._children.indexOf(child);
@@ -3802,7 +3868,7 @@ class TextNodeRenderable extends BaseRenderable {
3802
3868
  }
3803
3869
  clear() {
3804
3870
  for (const child of this._children) {
3805
- if (isTextNodeRenderable(child) && child.parent === this) {
3871
+ if (isTextNodeRenderable2(child) && child.parent === this) {
3806
3872
  child.parent = null;
3807
3873
  }
3808
3874
  }
@@ -3843,12 +3909,12 @@ class TextNodeRenderable extends BaseRenderable {
3843
3909
  return chunks;
3844
3910
  }
3845
3911
  static fromString(text, options = {}) {
3846
- const node = new TextNodeRenderable(options);
3912
+ const node = new TextNodeRenderable2(options);
3847
3913
  node.add(text);
3848
3914
  return node;
3849
3915
  }
3850
3916
  static fromNodes(nodes, options = {}) {
3851
- const node = new TextNodeRenderable(options);
3917
+ const node = new TextNodeRenderable2(options);
3852
3918
  for (const childNode of nodes) {
3853
3919
  node.add(childNode);
3854
3920
  }
@@ -3871,7 +3937,7 @@ class TextNodeRenderable extends BaseRenderable {
3871
3937
  return this._children.find((child) => typeof child !== "string" && child.id === id);
3872
3938
  }
3873
3939
  getRenderableIndex(id) {
3874
- return this._children.findIndex((child) => isTextNodeRenderable(child) && child.id === id);
3940
+ return this._children.findIndex((child) => isTextNodeRenderable2(child) && child.id === id);
3875
3941
  }
3876
3942
  get fg() {
3877
3943
  return this._fg;
@@ -3882,7 +3948,7 @@ class TextNodeRenderable extends BaseRenderable {
3882
3948
  this.requestRender();
3883
3949
  return;
3884
3950
  }
3885
- this._fg = parseColor(fg);
3951
+ this._fg = parseColor2(fg);
3886
3952
  this.requestRender();
3887
3953
  }
3888
3954
  set bg(bg) {
@@ -3891,7 +3957,7 @@ class TextNodeRenderable extends BaseRenderable {
3891
3957
  this.requestRender();
3892
3958
  return;
3893
3959
  }
3894
- this._bg = parseColor(bg);
3960
+ this._bg = parseColor2(bg);
3895
3961
  this.requestRender();
3896
3962
  }
3897
3963
  get bg() {
@@ -3916,7 +3982,7 @@ class TextNodeRenderable extends BaseRenderable {
3916
3982
  }
3917
3983
  }
3918
3984
 
3919
- class RootTextNodeRenderable extends TextNodeRenderable {
3985
+ class RootTextNodeRenderable2 extends TextNodeRenderable2 {
3920
3986
  ctx;
3921
3987
  textParent;
3922
3988
  constructor(ctx, options, textParent) {
@@ -3931,7 +3997,7 @@ class RootTextNodeRenderable extends TextNodeRenderable {
3931
3997
  }
3932
3998
 
3933
3999
  // src/renderables/Text.ts
3934
- class TextRenderable extends TextBufferRenderable {
4000
+ class TextRenderable2 extends TextBufferRenderable2 {
3935
4001
  _text;
3936
4002
  _hasManualStyledText = false;
3937
4003
  rootTextNode;
@@ -3941,10 +4007,10 @@ class TextRenderable extends TextBufferRenderable {
3941
4007
  constructor(ctx, options) {
3942
4008
  super(ctx, options);
3943
4009
  const content = options.content ?? this._contentDefaultOptions.content;
3944
- const styledText = typeof content === "string" ? stringToStyledText(content) : content;
4010
+ const styledText = typeof content === "string" ? stringToStyledText2(content) : content;
3945
4011
  this._text = styledText;
3946
4012
  this._hasManualStyledText = options.content !== undefined && content !== "";
3947
- this.rootTextNode = new RootTextNodeRenderable(ctx, {
4013
+ this.rootTextNode = new RootTextNodeRenderable2(ctx, {
3948
4014
  id: `${this.id}-root`,
3949
4015
  fg: this._defaultFg,
3950
4016
  bg: this._defaultBg,
@@ -3968,7 +4034,7 @@ class TextRenderable extends TextBufferRenderable {
3968
4034
  }
3969
4035
  set content(value) {
3970
4036
  this._hasManualStyledText = true;
3971
- const styledText = typeof value === "string" ? stringToStyledText(value) : value;
4037
+ const styledText = typeof value === "string" ? stringToStyledText2(value) : value;
3972
4038
  if (this._text !== styledText) {
3973
4039
  this._text = styledText;
3974
4040
  this.updateTextBuffer(styledText);
@@ -3983,7 +4049,7 @@ class TextRenderable extends TextBufferRenderable {
3983
4049
  attributes: this._defaultAttributes,
3984
4050
  link: undefined
3985
4051
  });
3986
- this.textBuffer.setStyledText(new StyledText(chunks));
4052
+ this.textBuffer.setStyledText(new StyledText2(chunks));
3987
4053
  this.refreshLocalSelection();
3988
4054
  this.yogaNode.markDirty();
3989
4055
  }
@@ -4003,7 +4069,7 @@ class TextRenderable extends TextBufferRenderable {
4003
4069
  }
4004
4070
  clear() {
4005
4071
  this.rootTextNode.clear();
4006
- const emptyStyledText = stringToStyledText("");
4072
+ const emptyStyledText = stringToStyledText2("");
4007
4073
  this._text = emptyStyledText;
4008
4074
  this.updateTextBuffer(emptyStyledText);
4009
4075
  this.updateTextInfo();
@@ -4033,11 +4099,11 @@ function toNumber(value) {
4033
4099
  }
4034
4100
  var canThrowAcrossNativeCallback = typeof process !== "undefined" && typeof process.versions === "object" && process.versions !== null && typeof process.versions.bun === "string";
4035
4101
 
4036
- class NativeSpanFeed {
4102
+ class NativeSpanFeed2 {
4037
4103
  static create(options) {
4038
- const lib = resolveRenderLib();
4104
+ const lib = resolveRenderLib2();
4039
4105
  const streamPtr = lib.createNativeSpanFeed(options);
4040
- const stream = new NativeSpanFeed(streamPtr);
4106
+ const stream = new NativeSpanFeed2(streamPtr);
4041
4107
  lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
4042
4108
  const status = lib.attachNativeSpanFeed(streamPtr);
4043
4109
  if (status !== 0) {
@@ -4048,8 +4114,8 @@ class NativeSpanFeed {
4048
4114
  return stream;
4049
4115
  }
4050
4116
  static attach(streamPtr, _options) {
4051
- const lib = resolveRenderLib();
4052
- const stream = new NativeSpanFeed(streamPtr);
4117
+ const lib = resolveRenderLib2();
4118
+ const stream = new NativeSpanFeed2(streamPtr);
4053
4119
  lib.registerNativeSpanFeedStream(streamPtr, stream.eventHandler);
4054
4120
  const status = lib.attachNativeSpanFeed(streamPtr);
4055
4121
  if (status !== 0) {
@@ -4059,7 +4125,7 @@ class NativeSpanFeed {
4059
4125
  return stream;
4060
4126
  }
4061
4127
  streamPtr;
4062
- lib = resolveRenderLib();
4128
+ lib = resolveRenderLib2();
4063
4129
  eventHandler;
4064
4130
  chunkMap = new Map;
4065
4131
  chunkSizes = new Map;
@@ -4533,14 +4599,14 @@ function getCallerInfo() {
4533
4599
  const columnNumber = parseInt(match[4], 10) || 0;
4534
4600
  return { functionName, fullPath, fileName, lineNumber, columnNumber };
4535
4601
  }
4536
- var capture = singleton("ConsoleCapture", () => new Capture);
4537
- registerEnvVar({
4602
+ var capture2 = singleton("ConsoleCapture", () => new Capture);
4603
+ registerEnvVar2({
4538
4604
  name: "OTUI_USE_CONSOLE",
4539
4605
  description: "Whether to use the console. Will not capture console output if set to false.",
4540
4606
  type: "boolean",
4541
4607
  default: true
4542
4608
  });
4543
- registerEnvVar({
4609
+ registerEnvVar2({
4544
4610
  name: "SHOW_CONSOLE",
4545
4611
  description: "Show the console at startup if set to true.",
4546
4612
  type: "boolean",
@@ -4560,7 +4626,7 @@ class TerminalConsoleCache extends EventEmitter4 {
4560
4626
  super();
4561
4627
  }
4562
4628
  activate() {
4563
- if (!env.OTUI_USE_CONSOLE)
4629
+ if (!env2.OTUI_USE_CONSOLE)
4564
4630
  return;
4565
4631
  if (!this._originalConsole) {
4566
4632
  this._originalConsole = global.console;
@@ -4569,10 +4635,10 @@ class TerminalConsoleCache extends EventEmitter4 {
4569
4635
  this.overrideConsoleMethods();
4570
4636
  }
4571
4637
  setupConsoleCapture() {
4572
- if (!env.OTUI_USE_CONSOLE)
4638
+ if (!env2.OTUI_USE_CONSOLE)
4573
4639
  return;
4574
- const mockStdout = new CapturedWritableStream("stdout", capture);
4575
- const mockStderr = new CapturedWritableStream("stderr", capture);
4640
+ const mockStdout = new CapturedWritableStream("stdout", capture2);
4641
+ const mockStderr = new CapturedWritableStream("stderr", capture2);
4576
4642
  global.console = new Console({
4577
4643
  stdout: mockStdout,
4578
4644
  stderr: mockStderr,
@@ -4644,19 +4710,19 @@ class TerminalConsoleCache extends EventEmitter4 {
4644
4710
  }
4645
4711
  }
4646
4712
  var terminalConsoleCache = singleton("TerminalConsoleCache", () => {
4647
- const terminalConsoleCache2 = new TerminalConsoleCache;
4713
+ const terminalConsoleCache = new TerminalConsoleCache;
4648
4714
  process.on("exit", () => {
4649
- terminalConsoleCache2.destroy();
4715
+ terminalConsoleCache.destroy();
4650
4716
  });
4651
- return terminalConsoleCache2;
4717
+ return terminalConsoleCache;
4652
4718
  });
4653
- var ConsolePosition;
4654
- ((ConsolePosition2) => {
4655
- ConsolePosition2["TOP"] = "top";
4656
- ConsolePosition2["BOTTOM"] = "bottom";
4657
- ConsolePosition2["LEFT"] = "left";
4658
- ConsolePosition2["RIGHT"] = "right";
4659
- })(ConsolePosition ||= {});
4719
+ var ConsolePosition2;
4720
+ ((ConsolePosition) => {
4721
+ ConsolePosition["TOP"] = "top";
4722
+ ConsolePosition["BOTTOM"] = "bottom";
4723
+ ConsolePosition["LEFT"] = "left";
4724
+ ConsolePosition["RIGHT"] = "right";
4725
+ })(ConsolePosition2 ||= {});
4660
4726
  var defaultConsoleKeybindings = [
4661
4727
  { name: "up", action: "scroll-up" },
4662
4728
  { name: "down", action: "scroll-down" },
@@ -4679,10 +4745,10 @@ var DEFAULT_CONSOLE_OPTIONS = {
4679
4745
  colorError: "#FF0000",
4680
4746
  colorDebug: "#808080",
4681
4747
  colorDefault: "#FFFFFF",
4682
- backgroundColor: RGBA.fromValues(0.1, 0.1, 0.1, 0.7),
4748
+ backgroundColor: RGBA2.fromValues(0.1, 0.1, 0.1, 0.7),
4683
4749
  startInDebugMode: false,
4684
4750
  title: "Console",
4685
- titleBarColor: RGBA.fromValues(0.05, 0.05, 0.05, 0.7),
4751
+ titleBarColor: RGBA2.fromValues(0.05, 0.05, 0.05, 0.7),
4686
4752
  titleBarTextColor: "#FFFFFF",
4687
4753
  cursorColor: "#00A0FF",
4688
4754
  maxStoredLogs: 2000,
@@ -4690,12 +4756,12 @@ var DEFAULT_CONSOLE_OPTIONS = {
4690
4756
  onCopySelection: undefined,
4691
4757
  keyBindings: undefined,
4692
4758
  keyAliasMap: undefined,
4693
- selectionColor: RGBA.fromValues(0.3, 0.5, 0.8, 0.5),
4759
+ selectionColor: RGBA2.fromValues(0.3, 0.5, 0.8, 0.5),
4694
4760
  copyButtonColor: "#00A0FF"
4695
4761
  };
4696
4762
  var INDENT_WIDTH = 2;
4697
4763
 
4698
- class TerminalConsole extends EventEmitter4 {
4764
+ class TerminalConsole2 extends EventEmitter4 {
4699
4765
  isVisible = false;
4700
4766
  isFocused = false;
4701
4767
  renderer;
@@ -4764,23 +4830,23 @@ class TerminalConsole extends EventEmitter4 {
4764
4830
  constructor(renderer, options = {}) {
4765
4831
  super();
4766
4832
  this.renderer = renderer;
4767
- this.clock = options.clock ?? new SystemClock;
4833
+ this.clock = options.clock ?? new SystemClock2;
4768
4834
  this.options = { ...DEFAULT_CONSOLE_OPTIONS, ...options };
4769
4835
  this.keyHandler = this.handleKeyPress.bind(this);
4770
4836
  this._debugModeEnabled = this.options.startInDebugMode;
4771
4837
  terminalConsoleCache.setCollectCallerInfo(this._debugModeEnabled);
4772
- this._rgbaInfo = parseColor(this.options.colorInfo);
4773
- this._rgbaWarn = parseColor(this.options.colorWarn);
4774
- this._rgbaError = parseColor(this.options.colorError);
4775
- this._rgbaDebug = parseColor(this.options.colorDebug);
4776
- this._rgbaDefault = parseColor(this.options.colorDefault);
4777
- this.backgroundColor = parseColor(this.options.backgroundColor);
4778
- this._rgbaTitleBar = parseColor(this.options.titleBarColor);
4779
- this._rgbaTitleBarText = parseColor(this.options.titleBarTextColor || this.options.colorDefault);
4838
+ this._rgbaInfo = parseColor2(this.options.colorInfo);
4839
+ this._rgbaWarn = parseColor2(this.options.colorWarn);
4840
+ this._rgbaError = parseColor2(this.options.colorError);
4841
+ this._rgbaDebug = parseColor2(this.options.colorDebug);
4842
+ this._rgbaDefault = parseColor2(this.options.colorDefault);
4843
+ this.backgroundColor = parseColor2(this.options.backgroundColor);
4844
+ this._rgbaTitleBar = parseColor2(this.options.titleBarColor);
4845
+ this._rgbaTitleBarText = parseColor2(this.options.titleBarTextColor || this.options.colorDefault);
4780
4846
  this._title = this.options.title;
4781
- this._rgbaCursor = parseColor(this.options.cursorColor);
4782
- this._rgbaSelection = parseColor(this.options.selectionColor);
4783
- this._rgbaCopyButton = parseColor(this.options.copyButtonColor);
4847
+ this._rgbaCursor = parseColor2(this.options.cursorColor);
4848
+ this._rgbaSelection = parseColor2(this.options.selectionColor);
4849
+ this._rgbaCopyButton = parseColor2(this.options.copyButtonColor);
4784
4850
  this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
4785
4851
  this._keyBindings = options.keyBindings || [];
4786
4852
  this._mergedKeyBindings = mergeKeyBindings(defaultConsoleKeybindings, this._keyBindings);
@@ -4792,7 +4858,7 @@ class TerminalConsole extends EventEmitter4 {
4792
4858
  this._handleNewLog(logEntry);
4793
4859
  };
4794
4860
  terminalConsoleCache.on("entry", this._entryListener);
4795
- if (env.SHOW_CONSOLE) {
4861
+ if (env2.SHOW_CONSOLE) {
4796
4862
  this.show();
4797
4863
  }
4798
4864
  }
@@ -5051,7 +5117,7 @@ class TerminalConsole extends EventEmitter4 {
5051
5117
  this._processCachedLogs();
5052
5118
  terminalConsoleCache.setCachingEnabled(false);
5053
5119
  if (!this.frameBuffer) {
5054
- this.frameBuffer = OptimizedBuffer.create(this.consoleWidth, this.consoleHeight, this.renderer.widthMethod, {
5120
+ this.frameBuffer = OptimizedBuffer2.create(this.consoleWidth, this.consoleHeight, this.renderer.widthMethod, {
5055
5121
  respectAlpha: this.backgroundColor.a < 1,
5056
5122
  id: "console framebuffer"
5057
5123
  });
@@ -5098,7 +5164,7 @@ class TerminalConsole extends EventEmitter4 {
5098
5164
  const copyButtonX = this.consoleWidth - copyLabel.length - 1;
5099
5165
  if (copyButtonX >= 0) {
5100
5166
  const copyButtonEnabled = this.hasSelection();
5101
- const disabledColor = RGBA.fromInts(100, 100, 100, 255);
5167
+ const disabledColor = RGBA2.fromInts(100, 100, 100, 255);
5102
5168
  const copyColor = copyButtonEnabled ? this._rgbaCopyButton : disabledColor;
5103
5169
  this.frameBuffer.drawText(copyLabel, copyButtonX, 0, copyColor, this._rgbaTitleBar);
5104
5170
  this._copyButtonBounds = { x: copyButtonX, y: 0, width: copyLabel.length, height: 1 };
@@ -5487,10 +5553,17 @@ class TerminalConsole extends EventEmitter4 {
5487
5553
 
5488
5554
  // src/renderables/EditBufferRenderable.ts
5489
5555
  var BrandedEditBufferRenderable = Symbol.for("@opentui/core/EditBufferRenderable");
5490
- var EditBufferRenderableEvents;
5491
- ((EditBufferRenderableEvents2) => {
5492
- EditBufferRenderableEvents2["TRAITS_CHANGED"] = "traits-changed";
5493
- })(EditBufferRenderableEvents ||= {});
5556
+ var emptyVisualCursor = Object.freeze({
5557
+ visualRow: 0,
5558
+ visualCol: 0,
5559
+ logicalRow: 0,
5560
+ logicalCol: 0,
5561
+ offset: 0
5562
+ });
5563
+ var EditBufferRenderableEvents2;
5564
+ ((EditBufferRenderableEvents) => {
5565
+ EditBufferRenderableEvents["TRAITS_CHANGED"] = "traits-changed";
5566
+ })(EditBufferRenderableEvents2 ||= {});
5494
5567
  function sameCapture(a, b) {
5495
5568
  if (a === b)
5496
5569
  return true;
@@ -5503,11 +5576,11 @@ function sameCapture(a, b) {
5503
5576
  function sameTraits(a, b) {
5504
5577
  return a.suspend === b.suspend && a.status === b.status && sameCapture(a.capture, b.capture);
5505
5578
  }
5506
- function isEditBufferRenderable(obj) {
5579
+ function isEditBufferRenderable2(obj) {
5507
5580
  return !!(obj && typeof obj === "object" && (BrandedEditBufferRenderable in obj));
5508
5581
  }
5509
5582
 
5510
- class EditBufferRenderable extends Renderable {
5583
+ class EditBufferRenderable2 extends Renderable2 {
5511
5584
  [BrandedEditBufferRenderable] = true;
5512
5585
  _focusable = true;
5513
5586
  selectable = true;
@@ -5535,7 +5608,7 @@ class EditBufferRenderable extends Renderable {
5535
5608
  editorView;
5536
5609
  nativeRenderable = null;
5537
5610
  _defaultOptions = {
5538
- textColor: RGBA.fromValues(1, 1, 1, 1),
5611
+ textColor: RGBA2.fromValues(1, 1, 1, 1),
5539
5612
  backgroundColor: "transparent",
5540
5613
  selectionBg: undefined,
5541
5614
  selectionFg: undefined,
@@ -5545,7 +5618,7 @@ class EditBufferRenderable extends Renderable {
5545
5618
  scrollMargin: 0.2,
5546
5619
  scrollSpeed: 16,
5547
5620
  showCursor: true,
5548
- cursorColor: RGBA.fromValues(1, 1, 1, 1),
5621
+ cursorColor: RGBA2.fromValues(1, 1, 1, 1),
5549
5622
  cursorStyle: {
5550
5623
  style: "block",
5551
5624
  blinking: true
@@ -5555,22 +5628,22 @@ class EditBufferRenderable extends Renderable {
5555
5628
  };
5556
5629
  constructor(ctx, options) {
5557
5630
  super(ctx, options);
5558
- this._textColor = parseColor(options.textColor ?? this._defaultOptions.textColor);
5559
- this._backgroundColor = parseColor(options.backgroundColor ?? this._defaultOptions.backgroundColor);
5631
+ this._textColor = parseColor2(options.textColor ?? this._defaultOptions.textColor);
5632
+ this._backgroundColor = parseColor2(options.backgroundColor ?? this._defaultOptions.backgroundColor);
5560
5633
  this._defaultAttributes = options.attributes ?? this._defaultOptions.attributes;
5561
- this._selectionBg = options.selectionBg ? parseColor(options.selectionBg) : this._defaultOptions.selectionBg;
5562
- this._selectionFg = options.selectionFg ? parseColor(options.selectionFg) : this._defaultOptions.selectionFg;
5634
+ this._selectionBg = options.selectionBg ? parseColor2(options.selectionBg) : this._defaultOptions.selectionBg;
5635
+ this._selectionFg = options.selectionFg ? parseColor2(options.selectionFg) : this._defaultOptions.selectionFg;
5563
5636
  this.selectable = options.selectable ?? this._defaultOptions.selectable;
5564
5637
  this._wrapMode = options.wrapMode ?? this._defaultOptions.wrapMode;
5565
5638
  this._scrollMargin = options.scrollMargin ?? this._defaultOptions.scrollMargin;
5566
5639
  this._scrollSpeed = options.scrollSpeed ?? this._defaultOptions.scrollSpeed;
5567
5640
  this._showCursor = options.showCursor ?? this._defaultOptions.showCursor;
5568
- this._cursorColor = parseColor(options.cursorColor ?? this._defaultOptions.cursorColor);
5641
+ this._cursorColor = parseColor2(options.cursorColor ?? this._defaultOptions.cursorColor);
5569
5642
  this._cursorStyle = options.cursorStyle ?? this._defaultOptions.cursorStyle;
5570
5643
  this._tabIndicator = options.tabIndicator ?? this._defaultOptions.tabIndicator;
5571
- this._tabIndicatorColor = options.tabIndicatorColor ? parseColor(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
5572
- this.editBuffer = EditBuffer.create(this._ctx.widthMethod);
5573
- this.editorView = EditorView.create(this.editBuffer, this.width || 80, this.height || 24);
5644
+ this._tabIndicatorColor = options.tabIndicatorColor ? parseColor2(options.tabIndicatorColor) : this._defaultOptions.tabIndicatorColor;
5645
+ this.editBuffer = EditBuffer2.create(this._ctx.widthMethod);
5646
+ this.editorView = EditorView2.create(this.editBuffer, this.width || 80, this.height || 24);
5574
5647
  this.editorView.setWrapMode(this._wrapMode);
5575
5648
  this.editorView.setScrollMargin(this._scrollMargin);
5576
5649
  if (options.selectionOccupancy === "boundary") {
@@ -5631,10 +5704,12 @@ class EditBufferRenderable extends Renderable {
5631
5704
  return this.editBuffer.getCursorPosition();
5632
5705
  }
5633
5706
  get visualCursor() {
5707
+ if (this.editorView.isDestroyed)
5708
+ return emptyVisualCursor;
5634
5709
  return this.editorView.getVisualCursor();
5635
5710
  }
5636
5711
  get cursorOffset() {
5637
- return this.editorView.getVisualCursor().offset;
5712
+ return this.visualCursor.offset;
5638
5713
  }
5639
5714
  set cursorOffset(offset) {
5640
5715
  this.clearSelection();
@@ -5662,7 +5737,7 @@ class EditBufferRenderable extends Renderable {
5662
5737
  return this._textColor;
5663
5738
  }
5664
5739
  set textColor(value) {
5665
- const newColor = parseColor(value ?? this._defaultOptions.textColor);
5740
+ const newColor = parseColor2(value ?? this._defaultOptions.textColor);
5666
5741
  if (this._textColor !== newColor) {
5667
5742
  this._textColor = newColor;
5668
5743
  this.editBuffer.setDefaultFg(newColor);
@@ -5683,7 +5758,7 @@ class EditBufferRenderable extends Renderable {
5683
5758
  this.emit("traits-changed" /* TRAITS_CHANGED */, value, prev);
5684
5759
  }
5685
5760
  set selectionBg(value) {
5686
- const newColor = value ? parseColor(value) : this._defaultOptions.selectionBg;
5761
+ const newColor = value ? parseColor2(value) : this._defaultOptions.selectionBg;
5687
5762
  if (this._selectionBg !== newColor) {
5688
5763
  this._selectionBg = newColor;
5689
5764
  this.refreshSelectionStyle();
@@ -5694,7 +5769,7 @@ class EditBufferRenderable extends Renderable {
5694
5769
  return this._selectionFg;
5695
5770
  }
5696
5771
  set selectionFg(value) {
5697
- const newColor = value ? parseColor(value) : this._defaultOptions.selectionFg;
5772
+ const newColor = value ? parseColor2(value) : this._defaultOptions.selectionFg;
5698
5773
  if (this._selectionFg !== newColor) {
5699
5774
  this._selectionFg = newColor;
5700
5775
  this.refreshSelectionStyle();
@@ -5705,7 +5780,7 @@ class EditBufferRenderable extends Renderable {
5705
5780
  return this._backgroundColor;
5706
5781
  }
5707
5782
  set backgroundColor(value) {
5708
- const newColor = parseColor(value ?? this._defaultOptions.backgroundColor);
5783
+ const newColor = parseColor2(value ?? this._defaultOptions.backgroundColor);
5709
5784
  if (this._backgroundColor !== newColor) {
5710
5785
  this._backgroundColor = newColor;
5711
5786
  this.editBuffer.setDefaultBg(newColor);
@@ -5749,7 +5824,7 @@ class EditBufferRenderable extends Renderable {
5749
5824
  return this._cursorColor;
5750
5825
  }
5751
5826
  set cursorColor(value) {
5752
- const newColor = parseColor(value);
5827
+ const newColor = parseColor2(value);
5753
5828
  if (this._cursorColor !== newColor) {
5754
5829
  this._cursorColor = newColor;
5755
5830
  if (this._focused) {
@@ -5795,7 +5870,7 @@ class EditBufferRenderable extends Renderable {
5795
5870
  return this._tabIndicatorColor;
5796
5871
  }
5797
5872
  set tabIndicatorColor(value) {
5798
- const newColor = value ? parseColor(value) : undefined;
5873
+ const newColor = value ? parseColor2(value) : undefined;
5799
5874
  if (this._tabIndicatorColor !== newColor) {
5800
5875
  this._tabIndicatorColor = newColor;
5801
5876
  if (newColor !== undefined) {
@@ -5867,7 +5942,7 @@ class EditBufferRenderable extends Renderable {
5867
5942
  return localX >= 0 && localX < this.width && localY >= 0 && localY < this.height;
5868
5943
  }
5869
5944
  onSelectionChanged(selection) {
5870
- const localSelection = convertGlobalToLocalSelection(selection, this.x, this.y);
5945
+ const localSelection = convertGlobalToLocalSelection2(selection, this.x, this.y);
5871
5946
  this.lastLocalSelection = localSelection;
5872
5947
  const updateCursor = true;
5873
5948
  const followCursor = this._keyboardSelectionActive;
@@ -6239,13 +6314,13 @@ class EditBufferRenderable extends Renderable {
6239
6314
  return true;
6240
6315
  }
6241
6316
  setupNativeRenderable() {
6242
- const lib = resolveRenderLib();
6317
+ const lib = resolveRenderLib2();
6243
6318
  const nativeRenderable = lib.createNativeRenderable();
6244
6319
  if (!lib.nativeRenderableAttachYogaNode(nativeRenderable, this.yogaNode.ptr)) {
6245
6320
  lib.destroyNativeRenderable(nativeRenderable);
6246
6321
  throw new Error("Failed to attach native renderable Yoga node");
6247
6322
  }
6248
- if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable, NativeMeasureTargetKind.EditorView, this.editorView.ptr)) {
6323
+ if (!lib.nativeRenderableSetMeasureTarget(nativeRenderable, NativeMeasureTargetKind2.EditorView, this.editorView.ptr)) {
6249
6324
  lib.destroyNativeRenderable(nativeRenderable);
6250
6325
  throw new Error("Failed to attach editor native measure target");
6251
6326
  }
@@ -6269,7 +6344,7 @@ class EditBufferRenderable extends Renderable {
6269
6344
  renderCursor(buffer) {
6270
6345
  if (!this._showCursor || !this._focused)
6271
6346
  return;
6272
- const visualCursor = this.editorView.getVisualCursor();
6347
+ const visualCursor = this.visualCursor;
6273
6348
  const screenX = this._screenX;
6274
6349
  const screenY = this._screenY;
6275
6350
  const cursorX = screenX + visualCursor.visualCol + 1;
@@ -6301,7 +6376,7 @@ class EditBufferRenderable extends Renderable {
6301
6376
  this.blur();
6302
6377
  }
6303
6378
  if (this.nativeRenderable) {
6304
- resolveRenderLib().destroyNativeRenderable(this.nativeRenderable);
6379
+ resolveRenderLib2().destroyNativeRenderable(this.nativeRenderable);
6305
6380
  this.nativeRenderable = null;
6306
6381
  }
6307
6382
  this.editorView.destroy();
@@ -6611,7 +6686,7 @@ function oscThemeColorToHex(r, g, b, hex6) {
6611
6686
  return "#000000";
6612
6687
  }
6613
6688
  function inferThemeModeFromBackgroundColor(color) {
6614
- const [r, g, b] = parseColor(color).toInts();
6689
+ const [r, g, b] = parseColor2(color).toInts();
6615
6690
  const brightness = (r * 299 + g * 587 + b * 114) / 1000;
6616
6691
  return brightness > 128 ? "light" : "dark";
6617
6692
  }
@@ -6743,43 +6818,43 @@ class RendererThemeMode {
6743
6818
  }
6744
6819
 
6745
6820
  // src/renderer.ts
6746
- registerEnvVar({
6821
+ registerEnvVar2({
6747
6822
  name: "OTUI_DUMP_CAPTURES",
6748
6823
  description: "Dump captured stdout and console caches when the renderer exit handler runs.",
6749
6824
  type: "boolean",
6750
6825
  default: false
6751
6826
  });
6752
- registerEnvVar({
6827
+ registerEnvVar2({
6753
6828
  name: "OTUI_NO_NATIVE_RENDER",
6754
6829
  description: "Skip the Zig/native frame renderer. Useful for debugging the render loop; split-footer stdout flushing may still write ANSI.",
6755
6830
  type: "boolean",
6756
6831
  default: false
6757
6832
  });
6758
- registerEnvVar({
6833
+ registerEnvVar2({
6759
6834
  name: "OTUI_USE_ALTERNATE_SCREEN",
6760
6835
  description: "When explicitly set, force screen mode selection: true=alternate-screen, false=main-screen.",
6761
6836
  type: "boolean",
6762
6837
  default: true
6763
6838
  });
6764
- registerEnvVar({
6839
+ registerEnvVar2({
6765
6840
  name: "OTUI_OVERRIDE_STDOUT",
6766
6841
  description: "When explicitly set, force stdout routing: false=passthrough, true=capture in split-footer mode.",
6767
6842
  type: "boolean",
6768
6843
  default: true
6769
6844
  });
6770
- registerEnvVar({
6845
+ registerEnvVar2({
6771
6846
  name: "OTUI_DEBUG",
6772
6847
  description: "Enable debug mode to capture all raw input for debugging purposes.",
6773
6848
  type: "boolean",
6774
6849
  default: false
6775
6850
  });
6776
- registerEnvVar({
6851
+ registerEnvVar2({
6777
6852
  name: "OTUI_STDIN_LOG",
6778
6853
  description: "Write the raw stdin byte stream to this file for debugging.",
6779
6854
  type: "string",
6780
6855
  default: ""
6781
6856
  });
6782
- registerEnvVar({
6857
+ registerEnvVar2({
6783
6858
  name: "OTUI_SHOW_STATS",
6784
6859
  description: "Show the debug overlay at startup.",
6785
6860
  type: "boolean",
@@ -6788,7 +6863,7 @@ registerEnvVar({
6788
6863
  var KITTY_IMAGE_TRANSPORTS = ["raw", "zlib", "file"];
6789
6864
  var DEFAULT_FOOTER_HEIGHT = 12;
6790
6865
  var MAX_SCROLLBACK_SURFACE_HEIGHT_PASSES = 4;
6791
- var TRANSPARENT_RGBA = RGBA.fromValues(0, 0, 0, 0);
6866
+ var TRANSPARENT_RGBA = RGBA2.fromValues(0, 0, 0, 0);
6792
6867
  var scrollbackSurfaceCounter = 0;
6793
6868
  function normalizeFooterHeight(footerHeight) {
6794
6869
  if (footerHeight === undefined) {
@@ -6806,12 +6881,12 @@ function normalizeFooterHeight(footerHeight) {
6806
6881
  function resolveModes(config) {
6807
6882
  let screenMode = config.screenMode ?? "alternate-screen";
6808
6883
  if (process.env.OTUI_USE_ALTERNATE_SCREEN !== undefined) {
6809
- screenMode = env.OTUI_USE_ALTERNATE_SCREEN ? "alternate-screen" : "main-screen";
6884
+ screenMode = env2.OTUI_USE_ALTERNATE_SCREEN ? "alternate-screen" : "main-screen";
6810
6885
  }
6811
6886
  const footerHeight = screenMode === "split-footer" ? normalizeFooterHeight(config.footerHeight) : DEFAULT_FOOTER_HEIGHT;
6812
6887
  let externalOutputMode = config.externalOutputMode ?? (screenMode === "split-footer" ? "capture-stdout" : "passthrough");
6813
6888
  if (process.env.OTUI_OVERRIDE_STDOUT !== undefined) {
6814
- externalOutputMode = env.OTUI_OVERRIDE_STDOUT && screenMode === "split-footer" ? "capture-stdout" : "passthrough";
6889
+ externalOutputMode = env2.OTUI_OVERRIDE_STDOUT && screenMode === "split-footer" ? "capture-stdout" : "passthrough";
6815
6890
  }
6816
6891
  if (externalOutputMode === "capture-stdout" && screenMode !== "split-footer") {
6817
6892
  throw new Error('externalOutputMode "capture-stdout" requires screenMode "split-footer"');
@@ -6841,9 +6916,9 @@ class ExternalOutputQueue {
6841
6916
  }
6842
6917
  const clampedLimit = Number.isFinite(limit) ? Math.max(1, Math.trunc(limit)) : this.commits.length;
6843
6918
  if (clampedLimit >= this.commits.length) {
6844
- const output2 = this.commits;
6919
+ const output = this.commits;
6845
6920
  this.commits = [];
6846
- return output2;
6921
+ return output;
6847
6922
  }
6848
6923
  const output = this.commits.slice(0, clampedLimit);
6849
6924
  this.commits = this.commits.slice(clampedLimit);
@@ -6884,8 +6959,8 @@ class ScrollbackSnapshotRenderContext extends EventEmitter5 {
6884
6959
  this.resolution = resolution;
6885
6960
  this.capabilities = capabilities;
6886
6961
  this.widthMethod = widthMethod;
6887
- this.keyInput = new KeyHandler;
6888
- this._internalKeyInput = new InternalKeyHandler;
6962
+ this.keyInput = new KeyHandler2;
6963
+ this._internalKeyInput = new InternalKeyHandler2;
6889
6964
  }
6890
6965
  addToHitGrid(_x, _y, _width, _height, _id) {}
6891
6966
  pushHitGridScissorRect(_x, _y, _width, _height) {}
@@ -6904,7 +6979,7 @@ class ScrollbackSnapshotRenderContext extends EventEmitter5 {
6904
6979
  get currentFocusedEditor() {
6905
6980
  if (!this.currentFocusedRenderable)
6906
6981
  return null;
6907
- if (!isEditBufferRenderable(this.currentFocusedRenderable))
6982
+ if (!isEditBufferRenderable2(this.currentFocusedRenderable))
6908
6983
  return null;
6909
6984
  return this.currentFocusedRenderable;
6910
6985
  }
@@ -6971,7 +7046,7 @@ var KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8;
6971
7046
  var KITTY_FLAG_REPORT_TEXT = 16;
6972
7047
  var DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
6973
7048
  var NATIVE_PALETTE_QUERY_SIZE = 16;
6974
- function buildKittyKeyboardFlags(config) {
7049
+ function buildKittyKeyboardFlags2(config) {
6975
7050
  if (!config) {
6976
7051
  return 0;
6977
7052
  }
@@ -6994,7 +7069,7 @@ function buildKittyKeyboardFlags(config) {
6994
7069
  return flags;
6995
7070
  }
6996
7071
 
6997
- class MouseEvent {
7072
+ class MouseEvent2 {
6998
7073
  type;
6999
7074
  button;
7000
7075
  x;
@@ -7031,19 +7106,19 @@ class MouseEvent {
7031
7106
  this._defaultPrevented = true;
7032
7107
  }
7033
7108
  }
7034
- var MouseButton;
7035
- ((MouseButton2) => {
7036
- MouseButton2[MouseButton2["LEFT"] = 0] = "LEFT";
7037
- MouseButton2[MouseButton2["MIDDLE"] = 1] = "MIDDLE";
7038
- MouseButton2[MouseButton2["RIGHT"] = 2] = "RIGHT";
7039
- MouseButton2[MouseButton2["WHEEL_UP"] = 4] = "WHEEL_UP";
7040
- MouseButton2[MouseButton2["WHEEL_DOWN"] = 5] = "WHEEL_DOWN";
7041
- })(MouseButton ||= {});
7109
+ var MouseButton2;
7110
+ ((MouseButton) => {
7111
+ MouseButton[MouseButton["LEFT"] = 0] = "LEFT";
7112
+ MouseButton[MouseButton["MIDDLE"] = 1] = "MIDDLE";
7113
+ MouseButton[MouseButton["RIGHT"] = 2] = "RIGHT";
7114
+ MouseButton[MouseButton["WHEEL_UP"] = 4] = "WHEEL_UP";
7115
+ MouseButton[MouseButton["WHEEL_DOWN"] = 5] = "WHEEL_DOWN";
7116
+ })(MouseButton2 ||= {});
7042
7117
  var rendererTracker = singleton("RendererTracker", () => ({
7043
7118
  renderers: new Set,
7044
7119
  streamOwners: new WeakMap
7045
7120
  }));
7046
- async function createCliRenderer(config = {}) {
7121
+ async function createCliRenderer2(config = {}) {
7047
7122
  if (process.argv.includes("--delay-start")) {
7048
7123
  await new Promise((resolve) => setTimeout(resolve, 5000));
7049
7124
  }
@@ -7051,7 +7126,7 @@ async function createCliRenderer(config = {}) {
7051
7126
  const stdout = config.stdout ?? process.stdout;
7052
7127
  const width = stdout.columns || config.width || 80;
7053
7128
  const height = stdout.rows || config.height || 24;
7054
- const renderer = new CliRenderer(stdin, stdout, width, height, config);
7129
+ const renderer = new CliRenderer2(stdin, stdout, width, height, config);
7055
7130
  try {
7056
7131
  await renderer.setupTerminal();
7057
7132
  return renderer;
@@ -7064,37 +7139,37 @@ async function createCliRenderer(config = {}) {
7064
7139
  throw error;
7065
7140
  }
7066
7141
  }
7067
- var CliRenderEvents;
7068
- ((CliRenderEvents2) => {
7069
- CliRenderEvents2["RESIZE"] = "resize";
7070
- CliRenderEvents2["FRAME"] = "frame";
7071
- CliRenderEvents2["RENDER_ERROR"] = "render:error";
7072
- CliRenderEvents2["HANDLER_ERROR"] = "handler:error";
7073
- CliRenderEvents2["EXTERNAL_OUTPUT"] = "external_output";
7074
- CliRenderEvents2["FOCUS"] = "focus";
7075
- CliRenderEvents2["BLUR"] = "blur";
7076
- CliRenderEvents2["FOCUSED_RENDERABLE"] = "focused_renderable";
7077
- CliRenderEvents2["FOCUSED_EDITOR"] = "focused_editor";
7078
- CliRenderEvents2["THEME_MODE"] = "theme_mode";
7079
- CliRenderEvents2["PALETTE"] = "palette";
7080
- CliRenderEvents2["CAPABILITIES"] = "capabilities";
7081
- CliRenderEvents2["SELECTION"] = "selection";
7082
- CliRenderEvents2["DEBUG_OVERLAY_TOGGLE"] = "debugOverlay:toggle";
7083
- CliRenderEvents2["DESTROY"] = "destroy";
7084
- CliRenderEvents2["MEMORY_SNAPSHOT"] = "memory:snapshot";
7085
- })(CliRenderEvents ||= {});
7086
- var RendererControlState;
7087
- ((RendererControlState2) => {
7088
- RendererControlState2["IDLE"] = "idle";
7089
- RendererControlState2["AUTO_STARTED"] = "auto_started";
7090
- RendererControlState2["EXPLICIT_STARTED"] = "explicit_started";
7091
- RendererControlState2["EXPLICIT_PAUSED"] = "explicit_paused";
7092
- RendererControlState2["EXPLICIT_SUSPENDED"] = "explicit_suspended";
7093
- RendererControlState2["EXPLICIT_STOPPED"] = "explicit_stopped";
7094
- })(RendererControlState ||= {});
7142
+ var CliRenderEvents2;
7143
+ ((CliRenderEvents) => {
7144
+ CliRenderEvents["RESIZE"] = "resize";
7145
+ CliRenderEvents["FRAME"] = "frame";
7146
+ CliRenderEvents["RENDER_ERROR"] = "render:error";
7147
+ CliRenderEvents["HANDLER_ERROR"] = "handler:error";
7148
+ CliRenderEvents["EXTERNAL_OUTPUT"] = "external_output";
7149
+ CliRenderEvents["FOCUS"] = "focus";
7150
+ CliRenderEvents["BLUR"] = "blur";
7151
+ CliRenderEvents["FOCUSED_RENDERABLE"] = "focused_renderable";
7152
+ CliRenderEvents["FOCUSED_EDITOR"] = "focused_editor";
7153
+ CliRenderEvents["THEME_MODE"] = "theme_mode";
7154
+ CliRenderEvents["PALETTE"] = "palette";
7155
+ CliRenderEvents["CAPABILITIES"] = "capabilities";
7156
+ CliRenderEvents["SELECTION"] = "selection";
7157
+ CliRenderEvents["DEBUG_OVERLAY_TOGGLE"] = "debugOverlay:toggle";
7158
+ CliRenderEvents["DESTROY"] = "destroy";
7159
+ CliRenderEvents["MEMORY_SNAPSHOT"] = "memory:snapshot";
7160
+ })(CliRenderEvents2 ||= {});
7161
+ var RendererControlState2;
7162
+ ((RendererControlState) => {
7163
+ RendererControlState["IDLE"] = "idle";
7164
+ RendererControlState["AUTO_STARTED"] = "auto_started";
7165
+ RendererControlState["EXPLICIT_STARTED"] = "explicit_started";
7166
+ RendererControlState["EXPLICIT_PAUSED"] = "explicit_paused";
7167
+ RendererControlState["EXPLICIT_SUSPENDED"] = "explicit_suspended";
7168
+ RendererControlState["EXPLICIT_STOPPED"] = "explicit_stopped";
7169
+ })(RendererControlState2 ||= {});
7095
7170
  var CLICK_REPEAT_INTERVAL_MS = 500;
7096
7171
 
7097
- class CliRenderer extends EventEmitter5 {
7172
+ class CliRenderer2 extends EventEmitter5 {
7098
7173
  static animationFrameId = 0;
7099
7174
  lib;
7100
7175
  rendererPtr;
@@ -7129,7 +7204,7 @@ class CliRenderer extends EventEmitter5 {
7129
7204
  frameTimes = [];
7130
7205
  maxStatSamples = 300;
7131
7206
  postProcessFns = [];
7132
- backgroundColor = RGBA.fromInts(0, 0, 0, 0);
7207
+ backgroundColor = RGBA2.fromInts(0, 0, 0, 0);
7133
7208
  waitingForPixelResolution = false;
7134
7209
  pixelResolutionRequeryPending = false;
7135
7210
  clock;
@@ -7156,7 +7231,7 @@ class CliRenderer extends EventEmitter5 {
7156
7231
  frameCallbackTime: 0
7157
7232
  };
7158
7233
  debugOverlay = {
7159
- enabled: env.OTUI_SHOW_STATS,
7234
+ enabled: env2.OTUI_SHOW_STATS,
7160
7235
  corner: 3 /* bottomRight */
7161
7236
  };
7162
7237
  _console;
@@ -7241,8 +7316,8 @@ class CliRenderer extends EventEmitter5 {
7241
7316
  themeModeHandler;
7242
7317
  idleResolvers = [];
7243
7318
  _debugInputs = [];
7244
- _debugModeEnabled = env.OTUI_DEBUG;
7245
- stdinLogPath = env.OTUI_STDIN_LOG;
7319
+ _debugModeEnabled = env2.OTUI_DEBUG;
7320
+ stdinLogPath = env2.OTUI_STDIN_LOG;
7246
7321
  handleError = ((error) => {
7247
7322
  console.error(error);
7248
7323
  if (this._openConsoleOnError) {
@@ -7251,7 +7326,7 @@ class CliRenderer extends EventEmitter5 {
7251
7326
  }).bind(this);
7252
7327
  dumpOutputCache(optionalMessage = "") {
7253
7328
  const cachedLogs = this.console.getCachedLogs();
7254
- const capturedConsoleOutput = capture.claimOutput();
7329
+ const capturedConsoleOutput = capture2.claimOutput();
7255
7330
  const capturedExternalOutputCommits = this.externalOutputQueue.claim();
7256
7331
  let capturedExternalOutput = "";
7257
7332
  for (const commit of capturedExternalOutputCommits) {
@@ -7285,7 +7360,7 @@ Captured external output:
7285
7360
  }
7286
7361
  exitHandler = (() => {
7287
7362
  this.destroy();
7288
- if (env.OTUI_DUMP_CAPTURES) {
7363
+ if (env2.OTUI_DUMP_CAPTURES) {
7289
7364
  sleep(100).then(() => {
7290
7365
  this.dumpOutputCache(`=== CAPTURED OUTPUT ===
7291
7366
  `);
@@ -7310,7 +7385,7 @@ Captured external output:
7310
7385
  this.stdout = stdout;
7311
7386
  this._usesProcessStdout = stdout === process.stdout;
7312
7387
  this.realStdoutWrite = stdout.write;
7313
- const lib = resolveRenderLib();
7388
+ const lib = resolveRenderLib2();
7314
7389
  const useMemoryBufferedOutput = config.bufferedOutput === "memory";
7315
7390
  const useFeedOutput = !this._usesProcessStdout && !useMemoryBufferedOutput;
7316
7391
  const { screenMode, footerHeight, externalOutputMode } = resolveModes(config);
@@ -7329,7 +7404,7 @@ Captured external output:
7329
7404
  let feed = null;
7330
7405
  if (useFeedOutput) {
7331
7406
  try {
7332
- feed = NativeSpanFeed.create();
7407
+ feed = NativeSpanFeed2.create();
7333
7408
  } catch (error) {
7334
7409
  throw new Error(`Failed to allocate NativeSpanFeed for custom stdout: ${error instanceof Error ? error.message : String(error)}`);
7335
7410
  }
@@ -7356,7 +7431,7 @@ Captured external output:
7356
7431
  config.useThread = false;
7357
7432
  lib.setUseThread(rendererPtr, config.useThread);
7358
7433
  const kittyConfig = config.useKittyKeyboard ?? {};
7359
- const kittyFlags = buildKittyKeyboardFlags(kittyConfig);
7434
+ const kittyFlags = buildKittyKeyboardFlags2(kittyConfig);
7360
7435
  lib.setKittyKeyboardFlags(rendererPtr, kittyFlags);
7361
7436
  this._feed = feed;
7362
7437
  if (feed) {
@@ -7402,11 +7477,11 @@ Captured external output:
7402
7477
  "SIGBREAK",
7403
7478
  "SIGBUS"
7404
7479
  ];
7405
- this.clipboard = new Clipboard(this.lib, this.rendererPtr);
7480
+ this.clipboard = new Clipboard2(this.lib, this.rendererPtr);
7406
7481
  this.resizeDebounceDelay = config.debounceDelay || 100;
7407
7482
  this.targetFps = config.targetFps || 30;
7408
7483
  this.maxFps = config.maxFps || 60;
7409
- this.clock = config.clock ?? new SystemClock;
7484
+ this.clock = config.clock ?? new SystemClock2;
7410
7485
  this.themeModeState = new RendererThemeMode({
7411
7486
  queryThemeColors: () => {
7412
7487
  this.lib.queryThemeColors(this.rendererPtr);
@@ -7433,7 +7508,7 @@ Captured external output:
7433
7508
  this.currentRenderBuffer = this.lib.getCurrentBuffer(this.rendererPtr);
7434
7509
  this.postProcessFns = config.postProcessFns || [];
7435
7510
  this.prependedInputHandlers = config.prependInputHandlers || [];
7436
- this.root = new RootRenderable(this);
7511
+ this.root = new RootRenderable2(this);
7437
7512
  if (this.memorySnapshotInterval > 0) {
7438
7513
  this.startMemorySnapshotTimer();
7439
7514
  }
@@ -7444,7 +7519,7 @@ Captured external output:
7444
7519
  process.on("uncaughtException", this.handleError);
7445
7520
  process.on("unhandledRejection", this.handleError);
7446
7521
  const useKittyForParsing = kittyConfig !== null;
7447
- this._keyHandler = new InternalKeyHandler;
7522
+ this._keyHandler = new InternalKeyHandler2;
7448
7523
  this._keyHandler.on("keypress", (event) => {
7449
7524
  if (this.exitOnCtrlC && matchesKeyBinding(event, { name: "c", ctrl: true })) {
7450
7525
  process.nextTick(() => {
@@ -7455,7 +7530,7 @@ Captured external output:
7455
7530
  });
7456
7531
  this.addExitListeners();
7457
7532
  const stdinParserMaxBufferBytes = config.stdinParserMaxBufferBytes ?? DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES;
7458
- this.stdinParser = new StdinParser({
7533
+ this.stdinParser = new StdinParser2({
7459
7534
  timeoutMs: 20,
7460
7535
  maxPendingBytes: stdinParserMaxBufferBytes,
7461
7536
  armTimeouts: true,
@@ -7472,7 +7547,7 @@ Captured external output:
7472
7547
  },
7473
7548
  clock: this.clock
7474
7549
  });
7475
- this._console = new TerminalConsole(this, {
7550
+ this._console = new TerminalConsole2(this, {
7476
7551
  ...config.consoleOptions ?? {},
7477
7552
  clock: this.clock
7478
7553
  });
@@ -7486,7 +7561,7 @@ Captured external output:
7486
7561
  this._openConsoleOnError = config.openConsoleOnError ?? true;
7487
7562
  this._onDestroy = config.onDestroy;
7488
7563
  global.requestAnimationFrame = (callback) => {
7489
- const id = CliRenderer.animationFrameId++;
7564
+ const id = CliRenderer2.animationFrameId++;
7490
7565
  this.animationRequest.set(id, callback);
7491
7566
  this.requestLive();
7492
7567
  return id;
@@ -7500,7 +7575,7 @@ Captured external output:
7500
7575
  global.window = {};
7501
7576
  }
7502
7577
  global.window.requestAnimationFrame = requestAnimationFrame;
7503
- if (env.OTUI_NO_NATIVE_RENDER) {
7578
+ if (env2.OTUI_NO_NATIVE_RENDER) {
7504
7579
  this.renderNative = () => {
7505
7580
  if (this._splitHeight > 0) {
7506
7581
  this.flushStdoutCache(this._splitHeight);
@@ -7541,8 +7616,9 @@ Captured external output:
7541
7616
  removeExitListeners() {
7542
7617
  if (!this._exitListenersAdded || this.exitSignals.length === 0)
7543
7618
  return;
7619
+ const processEvents = process;
7544
7620
  this.exitSignals.forEach((signal) => {
7545
- process.removeListener(signal, this.exitHandler);
7621
+ processEvents.removeListener(signal, this.exitHandler);
7546
7622
  });
7547
7623
  this._exitListenersAdded = false;
7548
7624
  }
@@ -7564,7 +7640,7 @@ Captured external output:
7564
7640
  get currentFocusedEditor() {
7565
7641
  if (!this._currentFocusedRenderable)
7566
7642
  return null;
7567
- if (!isEditBufferRenderable(this._currentFocusedRenderable))
7643
+ if (!isEditBufferRenderable2(this._currentFocusedRenderable))
7568
7644
  return null;
7569
7645
  return this._currentFocusedRenderable;
7570
7646
  }
@@ -8058,8 +8134,8 @@ Captured external output:
8058
8134
  enumerable: true,
8059
8135
  configurable: true
8060
8136
  });
8061
- const internalRoot = new RootRenderable(renderContext);
8062
- const publicRoot = new BoxRenderable(renderContext, {
8137
+ const internalRoot = new RootRenderable2(renderContext);
8138
+ const publicRoot = new BoxRenderable2(renderContext, {
8063
8139
  id: `scrollback-surface-root-${surfaceId}`,
8064
8140
  position: "absolute",
8065
8141
  left: 0,
@@ -8082,12 +8158,16 @@ Captured external output:
8082
8158
  let surfaceDestroyed = false;
8083
8159
  let hasRendered = false;
8084
8160
  let nextCommitStartOnNewLine = startOnNewLine;
8085
- let backingBuffer = OptimizedBuffer.create(surfaceWidth, surfaceHeight, surfaceWidthMethod, {
8161
+ let backingBuffer = OptimizedBuffer2.create(surfaceWidth, surfaceHeight, surfaceWidthMethod, {
8086
8162
  id: `scrollback-surface-buffer-${surfaceId}`
8087
8163
  });
8088
8164
  const destroyListener = () => {
8089
8165
  destroySurface();
8090
8166
  };
8167
+ const capabilitiesListener = (capabilities) => {
8168
+ snapshotContext.capabilities = capabilities;
8169
+ renderContext.emit("capabilities" /* CAPABILITIES */, capabilities);
8170
+ };
8091
8171
  const assertNotDestroyed = () => {
8092
8172
  if (surfaceDestroyed) {
8093
8173
  throw new Error("ScrollbackSurface is destroyed");
@@ -8119,7 +8199,7 @@ Captured external output:
8119
8199
  };
8120
8200
  const collectPendingCodeRenderables = (node) => {
8121
8201
  const pending = [];
8122
- if (node instanceof CodeRenderable && node.isHighlighting) {
8202
+ if (node instanceof CodeRenderable2 && node.isHighlighting) {
8123
8203
  pending.push(node);
8124
8204
  }
8125
8205
  for (const child of node.getChildren()) {
@@ -8176,7 +8256,7 @@ Captured external output:
8176
8256
  let targetHeight = Math.max(1, surfaceHeight);
8177
8257
  if (surfaceWidthMethod !== widthMethod) {
8178
8258
  backingBuffer.destroy();
8179
- backingBuffer = OptimizedBuffer.create(width, targetHeight, widthMethod, {
8259
+ backingBuffer = OptimizedBuffer2.create(width, targetHeight, widthMethod, {
8180
8260
  id: `scrollback-surface-buffer-${surfaceId}`
8181
8261
  });
8182
8262
  } else {
@@ -8236,7 +8316,7 @@ Captured external output:
8236
8316
  return;
8237
8317
  }
8238
8318
  const rowCount = endRowExclusive - startRow;
8239
- const commitBuffer = OptimizedBuffer.create(surfaceWidth, rowCount, surfaceWidthMethod, {
8319
+ const commitBuffer = OptimizedBuffer2.create(surfaceWidth, rowCount, surfaceWidthMethod, {
8240
8320
  id: `scrollback-surface-commit-${surfaceId}`
8241
8321
  });
8242
8322
  try {
@@ -8259,6 +8339,7 @@ Captured external output:
8259
8339
  }
8260
8340
  surfaceDestroyed = true;
8261
8341
  renderer.off("destroy" /* DESTROY */, destroyListener);
8342
+ renderer.off("capabilities" /* CAPABILITIES */, capabilitiesListener);
8262
8343
  let destroyError = null;
8263
8344
  try {
8264
8345
  internalRoot.destroyRecursively();
@@ -8279,6 +8360,7 @@ Captured external output:
8279
8360
  }
8280
8361
  };
8281
8362
  renderer.on("destroy" /* DESTROY */, destroyListener);
8363
+ renderer.on("capabilities" /* CAPABILITIES */, capabilitiesListener);
8282
8364
  return {
8283
8365
  get renderContext() {
8284
8366
  return renderContext;
@@ -8325,8 +8407,8 @@ Captured external output:
8325
8407
  snapshotContext.width = snapshotWidth;
8326
8408
  snapshotContext.height = snapshotHeight;
8327
8409
  snapshotContext.widthMethod = this.widthMethod;
8328
- snapshotRoot = new RootRenderable(snapshotContext);
8329
- snapshotBuffer = OptimizedBuffer.create(snapshotWidth, snapshotHeight, this.widthMethod, {
8410
+ snapshotRoot = new RootRenderable2(snapshotContext);
8411
+ snapshotBuffer = OptimizedBuffer2.create(snapshotWidth, snapshotHeight, this.widthMethod, {
8330
8412
  id: "scrollback-snapshot-commit"
8331
8413
  });
8332
8414
  snapshotRoot.add(rootRenderable);
@@ -8485,8 +8567,8 @@ Captured external output:
8485
8567
  const lineCells = [...line];
8486
8568
  const rowColumns = Math.min(lineCells.length, maxWidth);
8487
8569
  const renderedLine = lineCells.slice(0, maxWidth).join("");
8488
- const snapshotRoot = new RootRenderable(snapshotContext);
8489
- const snapshotRenderable = new TextRenderable(snapshotContext, {
8570
+ const snapshotRoot = new RootRenderable2(snapshotContext);
8571
+ const snapshotRenderable = new TextRenderable2(snapshotContext, {
8490
8572
  id: "captured-stdout-snapshot",
8491
8573
  position: "absolute",
8492
8574
  left: 0,
@@ -8495,7 +8577,7 @@ Captured external output:
8495
8577
  height: 1,
8496
8578
  content: renderedLine
8497
8579
  });
8498
- const snapshotBuffer = OptimizedBuffer.create(Math.max(1, rowColumns), 1, this.widthMethod, {
8580
+ const snapshotBuffer = OptimizedBuffer2.create(Math.max(1, rowColumns), 1, this.widthMethod, {
8499
8581
  id: "captured-stdout-snapshot"
8500
8582
  });
8501
8583
  try {
@@ -9168,7 +9250,7 @@ Captured external output:
9168
9250
  this.startTerminalKeepAlive();
9169
9251
  }
9170
9252
  dispatchMouseEvent(target, attributes) {
9171
- const event = new MouseEvent(target, attributes);
9253
+ const event = new MouseEvent2(target, attributes);
9172
9254
  this.sendMouseEvent(target, event);
9173
9255
  if (this.autoFocus && event.type === "down" && event.button === 0 /* LEFT */ && !event.defaultPrevented) {
9174
9256
  let current = target;
@@ -9205,27 +9287,27 @@ Captured external output:
9205
9287
  if (this._console.visible) {
9206
9288
  const consoleBounds = this._console.bounds;
9207
9289
  if (mouseEvent.x >= consoleBounds.x && mouseEvent.x < consoleBounds.x + consoleBounds.width && mouseEvent.y >= consoleBounds.y && mouseEvent.y < consoleBounds.y + consoleBounds.height) {
9208
- const event2 = new MouseEvent(null, mouseEvent);
9209
- const handled = this._console.handleMouse(event2);
9290
+ const event = new MouseEvent2(null, mouseEvent);
9291
+ const handled = this._console.handleMouse(event);
9210
9292
  if (handled)
9211
9293
  return true;
9212
9294
  }
9213
9295
  }
9214
9296
  if (mouseEvent.type === "scroll") {
9215
- const maybeRenderableId2 = this.hitTest(mouseEvent.x, mouseEvent.y);
9216
- const maybeRenderable2 = Renderable.renderablesByNumber.get(maybeRenderableId2);
9297
+ const maybeRenderableId = this.hitTest(mouseEvent.x, mouseEvent.y);
9298
+ const maybeRenderable = Renderable2.renderablesByNumber.get(maybeRenderableId);
9217
9299
  const fallbackTarget = this._currentFocusedRenderable && !this._currentFocusedRenderable.isDestroyed && this._currentFocusedRenderable.focused ? this._currentFocusedRenderable : null;
9218
- const scrollTarget = maybeRenderable2 ?? fallbackTarget;
9300
+ const scrollTarget = maybeRenderable ?? fallbackTarget;
9219
9301
  if (scrollTarget) {
9220
- const event2 = new MouseEvent(scrollTarget, mouseEvent);
9221
- this.sendMouseEvent(scrollTarget, event2);
9302
+ const event = new MouseEvent2(scrollTarget, mouseEvent);
9303
+ this.sendMouseEvent(scrollTarget, event);
9222
9304
  }
9223
9305
  return true;
9224
9306
  }
9225
9307
  const maybeRenderableId = this.hitTest(mouseEvent.x, mouseEvent.y);
9226
9308
  const sameElement = maybeRenderableId === this.lastOverRenderableNum;
9227
9309
  this.lastOverRenderableNum = maybeRenderableId;
9228
- const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
9310
+ const maybeRenderable = Renderable2.renderablesByNumber.get(maybeRenderableId);
9229
9311
  if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && !this.currentSelection?.isDragging && !mouseEvent.modifiers.ctrl) {
9230
9312
  const canStartSelection = Boolean(maybeRenderable && maybeRenderable.selectable && !maybeRenderable.isDestroyed && maybeRenderable.shouldStartSelection(mouseEvent.x, mouseEvent.y));
9231
9313
  if (canStartSelection && maybeRenderable) {
@@ -9237,21 +9319,21 @@ Captured external output:
9237
9319
  if (mouseEvent.type === "drag" && this.currentSelection?.isDragging) {
9238
9320
  this.updateSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
9239
9321
  if (maybeRenderable) {
9240
- const event2 = new MouseEvent(maybeRenderable, {
9322
+ const event = new MouseEvent2(maybeRenderable, {
9241
9323
  ...mouseEvent,
9242
9324
  isDragging: true
9243
9325
  });
9244
- this.sendMouseEvent(maybeRenderable, event2);
9326
+ this.sendMouseEvent(maybeRenderable, event);
9245
9327
  }
9246
9328
  return true;
9247
9329
  }
9248
9330
  if (mouseEvent.type === "up" && mouseEvent.button === 0 /* LEFT */ && this.currentSelection?.isDragging) {
9249
9331
  if (maybeRenderable) {
9250
- const event2 = new MouseEvent(maybeRenderable, {
9332
+ const event = new MouseEvent2(maybeRenderable, {
9251
9333
  ...mouseEvent,
9252
9334
  isDragging: true
9253
9335
  });
9254
- this.sendMouseEvent(maybeRenderable, event2);
9336
+ this.sendMouseEvent(maybeRenderable, event);
9255
9337
  }
9256
9338
  this.finishSelection();
9257
9339
  return true;
@@ -9265,41 +9347,41 @@ Captured external output:
9265
9347
  }
9266
9348
  if (!sameElement && (mouseEvent.type === "drag" || mouseEvent.type === "move")) {
9267
9349
  if (this.lastOverRenderable && this.lastOverRenderable !== this.capturedRenderable && !this.lastOverRenderable.isDestroyed) {
9268
- const event2 = new MouseEvent(this.lastOverRenderable, {
9350
+ const event = new MouseEvent2(this.lastOverRenderable, {
9269
9351
  ...mouseEvent,
9270
9352
  type: "out"
9271
9353
  });
9272
- this.sendMouseEvent(this.lastOverRenderable, event2);
9354
+ this.sendMouseEvent(this.lastOverRenderable, event);
9273
9355
  }
9274
9356
  this.lastOverRenderable = maybeRenderable;
9275
9357
  if (maybeRenderable) {
9276
- const event2 = new MouseEvent(maybeRenderable, {
9358
+ const event = new MouseEvent2(maybeRenderable, {
9277
9359
  ...mouseEvent,
9278
9360
  type: "over",
9279
9361
  source: this.capturedRenderable
9280
9362
  });
9281
- this.sendMouseEvent(maybeRenderable, event2);
9363
+ this.sendMouseEvent(maybeRenderable, event);
9282
9364
  }
9283
9365
  }
9284
9366
  if (this.capturedRenderable && mouseEvent.type !== "up") {
9285
- const event2 = new MouseEvent(this.capturedRenderable, mouseEvent);
9286
- this.sendMouseEvent(this.capturedRenderable, event2);
9367
+ const event = new MouseEvent2(this.capturedRenderable, mouseEvent);
9368
+ this.sendMouseEvent(this.capturedRenderable, event);
9287
9369
  return true;
9288
9370
  }
9289
9371
  if (this.capturedRenderable && mouseEvent.type === "up") {
9290
- const event2 = new MouseEvent(this.capturedRenderable, {
9372
+ const event = new MouseEvent2(this.capturedRenderable, {
9291
9373
  ...mouseEvent,
9292
9374
  type: "drag-end"
9293
9375
  });
9294
- this.sendMouseEvent(this.capturedRenderable, event2);
9295
- this.sendMouseEvent(this.capturedRenderable, new MouseEvent(this.capturedRenderable, mouseEvent));
9376
+ this.sendMouseEvent(this.capturedRenderable, event);
9377
+ this.sendMouseEvent(this.capturedRenderable, new MouseEvent2(this.capturedRenderable, mouseEvent));
9296
9378
  if (maybeRenderable) {
9297
- const event3 = new MouseEvent(maybeRenderable, {
9379
+ const event = new MouseEvent2(maybeRenderable, {
9298
9380
  ...mouseEvent,
9299
9381
  type: "drop",
9300
9382
  source: this.capturedRenderable
9301
9383
  });
9302
- this.sendMouseEvent(maybeRenderable, event3);
9384
+ this.sendMouseEvent(maybeRenderable, event);
9303
9385
  }
9304
9386
  this.lastOverRenderable = this.capturedRenderable;
9305
9387
  this.lastOverRenderableNum = this.capturedRenderable.num;
@@ -9329,7 +9411,7 @@ Captured external output:
9329
9411
  if (this.capturedRenderable)
9330
9412
  return;
9331
9413
  const hitId = this.hitTest(this._latestPointer.x, this._latestPointer.y);
9332
- const hitRenderable = Renderable.renderablesByNumber.get(hitId);
9414
+ const hitRenderable = Renderable2.renderablesByNumber.get(hitId);
9333
9415
  const lastOver = this.lastOverRenderable;
9334
9416
  if (lastOver?.num === hitId) {
9335
9417
  this.lastOverRenderableNum = hitId;
@@ -9343,13 +9425,13 @@ Captured external output:
9343
9425
  modifiers: this._lastPointerModifiers
9344
9426
  };
9345
9427
  if (lastOver && !lastOver.isDestroyed) {
9346
- const event = new MouseEvent(lastOver, { ...baseEvent, type: "out" });
9428
+ const event = new MouseEvent2(lastOver, { ...baseEvent, type: "out" });
9347
9429
  this.sendMouseEvent(lastOver, event);
9348
9430
  }
9349
9431
  this.lastOverRenderable = hitRenderable;
9350
9432
  this.lastOverRenderableNum = hitId;
9351
9433
  if (hitRenderable) {
9352
- const event = new MouseEvent(hitRenderable, {
9434
+ const event = new MouseEvent2(hitRenderable, {
9353
9435
  ...baseEvent,
9354
9436
  type: "over"
9355
9437
  });
@@ -9363,6 +9445,18 @@ Captured external output:
9363
9445
  hitTest(x, y) {
9364
9446
  return this.lib.checkHit(this.rendererPtr, x, y);
9365
9447
  }
9448
+ getLinkIdAt(x, y) {
9449
+ if (this._isDestroyed || !Number.isInteger(x) || !Number.isInteger(y))
9450
+ return 0;
9451
+ const buffer = this.currentRenderBuffer;
9452
+ if (x < 0 || y < 0 || x >= buffer.width || y >= buffer.height)
9453
+ return 0;
9454
+ return getLinkId2(buffer.buffers.attributes[y * buffer.width + x]);
9455
+ }
9456
+ getLinkAt(x, y) {
9457
+ const linkId = this.getLinkIdAt(x, y);
9458
+ return linkId === 0 ? null : this.currentRenderBuffer.lib.linkGetUrl(linkId) || null;
9459
+ }
9366
9460
  takeMemorySnapshot() {
9367
9461
  if (this._isDestroyed)
9368
9462
  return;
@@ -9443,7 +9537,7 @@ Captured external output:
9443
9537
  if (splitFooterActive) {
9444
9538
  let clearStart = null;
9445
9539
  if (width < prevWidth && visiblePreviousSplitHeight > 0) {
9446
- clearStart = Math.max(previousTerminalHeight - visiblePreviousSplitHeight * 2, 1);
9540
+ clearStart = Math.min(this.renderOffset + 1, Math.max(previousTerminalHeight - visiblePreviousSplitHeight * 2, 1));
9447
9541
  }
9448
9542
  if (pendingSplitFooterTransition !== null) {
9449
9543
  clearStart = clearStart === null ? pendingSplitFooterTransition.sourceTopLine : Math.min(clearStart, pendingSplitFooterTransition.sourceTopLine);
@@ -9477,7 +9571,7 @@ Captured external output:
9477
9571
  this.processResize(width, height);
9478
9572
  }
9479
9573
  setBackgroundColor(color) {
9480
- const parsedColor = parseColor(color);
9574
+ const parsedColor = parseColor2(color);
9481
9575
  this.lib.setBackgroundColor(this.rendererPtr, parsedColor);
9482
9576
  this.backgroundColor = parsedColor;
9483
9577
  this.nextRenderBuffer.clear(parsedColor);
@@ -9530,18 +9624,18 @@ Captured external output:
9530
9624
  this.lib.dumpOutputBuffer(this.rendererPtr, timestamp);
9531
9625
  }
9532
9626
  static setCursorPosition(renderer, x, y, visible = true) {
9533
- const lib = resolveRenderLib();
9627
+ const lib = resolveRenderLib2();
9534
9628
  lib.setCursorPosition(renderer.rendererPtr, x, y, visible);
9535
9629
  }
9536
9630
  static setCursorStyle(renderer, options) {
9537
- const lib = resolveRenderLib();
9631
+ const lib = resolveRenderLib2();
9538
9632
  lib.setCursorStyleOptions(renderer.rendererPtr, options);
9539
9633
  if (options.cursor !== undefined) {
9540
9634
  renderer._currentMousePointerStyle = options.cursor;
9541
9635
  }
9542
9636
  }
9543
9637
  static setCursorColor(renderer, color) {
9544
- const lib = resolveRenderLib();
9638
+ const lib = resolveRenderLib2();
9545
9639
  lib.setCursorColor(renderer.rendererPtr, color);
9546
9640
  }
9547
9641
  setCursorPosition(x, y, visible = true) {
@@ -9749,12 +9843,13 @@ Captured external output:
9749
9843
  this.stdout.off("error", this.kittyOutputErrorHandler);
9750
9844
  this.lib.cancelKittyImageTransport(this.rendererPtr, false);
9751
9845
  }
9846
+ const processEvents = process;
9752
9847
  if (this._usesProcessStdout) {
9753
- process.removeListener("SIGWINCH", this.sigwinchHandler);
9848
+ processEvents.removeListener("SIGWINCH", this.sigwinchHandler);
9754
9849
  }
9755
- process.removeListener("uncaughtException", this.handleError);
9756
- process.removeListener("unhandledRejection", this.handleError);
9757
- process.removeListener("warning", this.warningHandler);
9850
+ processEvents.removeListener("uncaughtException", this.handleError);
9851
+ processEvents.removeListener("unhandledRejection", this.handleError);
9852
+ processEvents.removeListener("warning", this.warningHandler);
9758
9853
  this.removeExitListeners();
9759
9854
  if (this.resizeTimeoutId !== null) {
9760
9855
  this.clock.clearTimeout(this.resizeTimeoutId);
@@ -9872,7 +9967,7 @@ Captured external output:
9872
9967
  }
9873
9968
  rendererTracker.renderers.delete(this);
9874
9969
  if (rendererTracker.renderers.size === 0) {
9875
- destroyTreeSitterClient().catch((error) => {
9970
+ destroyTreeSitterClient2().catch((error) => {
9876
9971
  console.error("Failed to destroy tree-sitter client:", error);
9877
9972
  });
9878
9973
  }
@@ -10150,7 +10245,7 @@ Captured external output:
10150
10245
  return;
10151
10246
  this.clearSelectionState();
10152
10247
  this.selectionContainers.push(renderable.parent || this.root);
10153
- this.currentSelection = new Selection(renderable, { x, y }, { x, y }, behavior);
10248
+ this.currentSelection = new Selection2(renderable, { x, y }, { x, y }, behavior);
10154
10249
  this.currentSelection.isStart = true;
10155
10250
  this.notifySelectablesOfSelectionChange();
10156
10251
  }
@@ -10192,7 +10287,7 @@ Captured external output:
10192
10287
  if (this.currentSelection?.isDragging) {
10193
10288
  const pointer = this._latestPointer;
10194
10289
  const maybeRenderableId = this.hitTest(pointer.x, pointer.y);
10195
- const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
10290
+ const maybeRenderable = Renderable2.renderablesByNumber.get(maybeRenderableId);
10196
10291
  this.updateSelection(maybeRenderable, pointer.x, pointer.y);
10197
10292
  }
10198
10293
  }
@@ -10273,7 +10368,7 @@ Captured external output:
10273
10368
  if (!this._paletteDetector) {
10274
10369
  const isTmux = Boolean(this.capabilities?.multiplexer === "tmux" || this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux"));
10275
10370
  const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
10276
- this._paletteDetector = createTerminalPalette({
10371
+ this._paletteDetector = createTerminalPalette2({
10277
10372
  stdin: this.stdin,
10278
10373
  stdout: this.stdout,
10279
10374
  writeFn: (data) => this._isDestroyed ? false : this.writeOut(data),
@@ -10288,18 +10383,18 @@ Captured external output:
10288
10383
  return this._paletteDetector;
10289
10384
  }
10290
10385
  syncNativePaletteState(colors) {
10291
- const signature = buildTerminalPaletteSignature(colors);
10386
+ const signature = buildTerminalPaletteSignature2(colors);
10292
10387
  if (this._nativePaletteSignature !== signature) {
10293
10388
  this._paletteEpoch = this._paletteEpoch + 1 >>> 0;
10294
10389
  }
10295
10390
  this._nativePaletteSignature = signature;
10296
- const normalized = normalizeTerminalPalette(colors);
10391
+ const normalized = normalizeTerminalPalette2(colors);
10297
10392
  this.lib.rendererSetPaletteState(this.rendererPtr, normalized.palette, normalized.defaultForeground, normalized.defaultBackground, this._paletteEpoch);
10298
10393
  }
10299
10394
  emitPaletteChange(colors) {
10300
10395
  if (this.listenerCount("palette" /* PALETTE */) === 0)
10301
10396
  return;
10302
- const signature = buildTerminalPaletteSignature(colors);
10397
+ const signature = buildTerminalPaletteSignature2(colors);
10303
10398
  if (this._emittedPaletteSignature === signature)
10304
10399
  return;
10305
10400
  this._emittedPaletteSignature = signature;
@@ -10405,7 +10500,7 @@ Captured external output:
10405
10500
  }
10406
10501
  }
10407
10502
 
10408
- export { h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, TextBufferView, EditBuffer, EditorView, convertThemeToStyles, SyntaxStyle, ANSI, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, TextRenderable, NativeSpanFeed, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
10503
+ export { convertThemeToStyles2, SyntaxStyle2, h2, isVNode2, maybeMakeRenderable2, wrapWithDelegates2, instantiate2, delegate2, LayoutEvents2, RenderableEvents2, isRenderable2, BaseRenderable2, Renderable2, RootRenderable2, TextBufferView2, EditBuffer2, EditorView2, ANSI, BoxRenderable2, TextBufferRenderable2, CodeRenderable2, isTextNodeRenderable2, TextNodeRenderable2, RootTextNodeRenderable2, TextRenderable2, NativeSpanFeed2, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture2, ConsolePosition2, TerminalConsole2, getObjectsInViewport, EditBufferRenderableEvents2, isEditBufferRenderable2, EditBufferRenderable2, buildKittyKeyboardFlags2, MouseEvent2, MouseButton2, createCliRenderer2, CliRenderEvents2, RendererControlState2, CliRenderer2 };
10409
10504
 
10410
- //# debugId=E69D7F0A21FC1D2B64756E2164756E21
10411
- //# sourceMappingURL=chunk-node-6bg8r2m7.js.map
10505
+ //# debugId=47CBB6DA4E1BD0DC64756E2164756E21
10506
+ //# sourceMappingURL=chunk-node-fyb4fckk.js.map