@fairyhunter13/opentui-core 0.1.132 → 0.1.133

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.
@@ -1969,23 +1969,126 @@ class InternalKeyHandler extends KeyHandler {
1969
1969
  }
1970
1970
 
1971
1971
  // src/lib/RGBA.ts
1972
+ var COLOR_TAG_RGB = 256;
1973
+ var COLOR_TAG_DEFAULT = 257;
1974
+ var DEFAULT_FOREGROUND_RGB = [255, 255, 255];
1975
+ var DEFAULT_BACKGROUND_RGB = [0, 0, 0];
1976
+ var RGBA_BUFFER_STRIDE = 5;
1977
+ var ANSI16_RGB = [
1978
+ [0, 0, 0],
1979
+ [128, 0, 0],
1980
+ [0, 128, 0],
1981
+ [128, 128, 0],
1982
+ [0, 0, 128],
1983
+ [128, 0, 128],
1984
+ [0, 128, 128],
1985
+ [192, 192, 192],
1986
+ [128, 128, 128],
1987
+ [255, 0, 0],
1988
+ [0, 255, 0],
1989
+ [255, 255, 0],
1990
+ [0, 0, 255],
1991
+ [255, 0, 255],
1992
+ [0, 255, 255],
1993
+ [255, 255, 255]
1994
+ ];
1995
+ var ANSI_256_CUBE_LEVELS = [0, 95, 135, 175, 215, 255];
1996
+ function normalizeColorTag(tag) {
1997
+ const normalizedTag = tag != null && Number.isFinite(tag) ? Math.round(tag) : COLOR_TAG_RGB;
1998
+ if (normalizedTag === COLOR_TAG_RGB || normalizedTag === COLOR_TAG_DEFAULT) {
1999
+ return normalizedTag;
2000
+ }
2001
+ if (Number.isInteger(normalizedTag) && normalizedTag >= 0 && normalizedTag <= 255) {
2002
+ return normalizedTag;
2003
+ }
2004
+ return COLOR_TAG_RGB;
2005
+ }
2006
+ function normalizeRGBABuffer(buffer) {
2007
+ if (buffer.length === RGBA_BUFFER_STRIDE) {
2008
+ buffer[4] = normalizeColorTag(buffer[4]);
2009
+ return buffer;
2010
+ }
2011
+ const normalized = new Float32Array(RGBA_BUFFER_STRIDE);
2012
+ normalized[0] = buffer[0] ?? 0;
2013
+ normalized[1] = buffer[1] ?? 0;
2014
+ normalized[2] = buffer[2] ?? 0;
2015
+ normalized[3] = buffer[3] ?? 0;
2016
+ normalized[4] = COLOR_TAG_RGB;
2017
+ return normalized;
2018
+ }
2019
+ function withTag(rgba, tag) {
2020
+ const tagged = RGBA.clone(rgba);
2021
+ tagged.tag = tag;
2022
+ return tagged;
2023
+ }
2024
+ function rgbaForAnsi256Index(index) {
2025
+ const [r, g, b] = ansi256IndexToRgb(index);
2026
+ return RGBA.fromInts(r, g, b);
2027
+ }
2028
+ function normalizeIndexedColorIndex(index) {
2029
+ if (!Number.isInteger(index) || index < 0 || index > 255) {
2030
+ throw new RangeError(`Indexed color must be an integer in the range 0..255, got ${index}`);
2031
+ }
2032
+ return index;
2033
+ }
2034
+ function ansi256IndexToRgb(index) {
2035
+ const normalizedIndex = normalizeIndexedColorIndex(index);
2036
+ if (normalizedIndex < ANSI16_RGB.length) {
2037
+ return ANSI16_RGB[normalizedIndex];
2038
+ }
2039
+ if (normalizedIndex < 232) {
2040
+ const cubeIndex = normalizedIndex - 16;
2041
+ const r = Math.floor(cubeIndex / 36);
2042
+ const g = Math.floor(cubeIndex / 6) % 6;
2043
+ const b = cubeIndex % 6;
2044
+ return [ANSI_256_CUBE_LEVELS[r], ANSI_256_CUBE_LEVELS[g], ANSI_256_CUBE_LEVELS[b]];
2045
+ }
2046
+ const value = 8 + (normalizedIndex - 232) * 10;
2047
+ return [value, value, value];
2048
+ }
2049
+ function decodeColorTag(tag) {
2050
+ if (tag === COLOR_TAG_DEFAULT) {
2051
+ return { kind: "default" };
2052
+ }
2053
+ if (tag === COLOR_TAG_RGB) {
2054
+ return { kind: "rgb" };
2055
+ }
2056
+ return { kind: "indexed", index: normalizeIndexedColorIndex(tag) };
2057
+ }
2058
+
1972
2059
  class RGBA {
1973
2060
  buffer;
1974
2061
  constructor(buffer) {
1975
- this.buffer = buffer;
2062
+ this.buffer = normalizeRGBABuffer(buffer);
1976
2063
  }
1977
2064
  static fromArray(array) {
1978
2065
  return new RGBA(array);
1979
2066
  }
1980
- static fromValues(r, g, b, a = 1) {
1981
- return new RGBA(new Float32Array([r, g, b, a]));
2067
+ static fromValues(r, g, b, a = 1, tag = COLOR_TAG_RGB) {
2068
+ return new RGBA(new Float32Array([r, g, b, a, normalizeColorTag(tag)]));
2069
+ }
2070
+ static clone(rgba) {
2071
+ return RGBA.fromValues(rgba.r, rgba.g, rgba.b, rgba.a, rgba.tag);
1982
2072
  }
1983
- static fromInts(r, g, b, a = 255) {
1984
- return new RGBA(new Float32Array([r / 255, g / 255, b / 255, a / 255]));
2073
+ static fromInts(r, g, b, a = 255, tag = COLOR_TAG_RGB) {
2074
+ return new RGBA(new Float32Array([r / 255, g / 255, b / 255, a / 255, normalizeColorTag(tag)]));
1985
2075
  }
1986
2076
  static fromHex(hex) {
1987
2077
  return hexToRgb(hex);
1988
2078
  }
2079
+ static fromIndex(index, snapshot) {
2080
+ const normalizedIndex = normalizeIndexedColorIndex(index);
2081
+ return withTag(snapshot ? parseColor(snapshot) : rgbaForAnsi256Index(normalizedIndex), normalizedIndex);
2082
+ }
2083
+ static defaultForeground(snapshot) {
2084
+ return withTag(snapshot ? parseColor(snapshot) : RGBA.fromInts(...DEFAULT_FOREGROUND_RGB), COLOR_TAG_DEFAULT);
2085
+ }
2086
+ static defaultBackground(snapshot) {
2087
+ return withTag(snapshot ? parseColor(snapshot) : RGBA.fromInts(...DEFAULT_BACKGROUND_RGB), COLOR_TAG_DEFAULT);
2088
+ }
2089
+ static getIntentTag(rgba) {
2090
+ return rgba.tag;
2091
+ }
1989
2092
  toInts() {
1990
2093
  return [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255), Math.round(this.a * 255)];
1991
2094
  }
@@ -2013,6 +2116,12 @@ class RGBA {
2013
2116
  set a(value) {
2014
2117
  this.buffer[3] = value;
2015
2118
  }
2119
+ get tag() {
2120
+ return normalizeColorTag(this.buffer[4]);
2121
+ }
2122
+ set tag(value) {
2123
+ this.buffer[4] = normalizeColorTag(value);
2124
+ }
2016
2125
  map(fn) {
2017
2126
  return [fn(this.r), fn(this.g), fn(this.b), fn(this.a)];
2018
2127
  }
@@ -2022,9 +2131,15 @@ class RGBA {
2022
2131
  equals(other) {
2023
2132
  if (!other)
2024
2133
  return false;
2025
- return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
2134
+ return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a && this.tag === other.tag;
2026
2135
  }
2027
2136
  }
2137
+ function normalizeColorValue(value) {
2138
+ if (value == null)
2139
+ return null;
2140
+ const rgba = parseColor(value);
2141
+ return { rgba, tag: rgba.tag };
2142
+ }
2028
2143
  function hexToRgb(hex) {
2029
2144
  hex = hex.replace(/^#/, "");
2030
2145
  if (hex.length === 3) {
@@ -10663,6 +10778,38 @@ class TerminalPalette {
10663
10778
  function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux, oscSource, clock) {
10664
10779
  return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux, oscSource, clock);
10665
10780
  }
10781
+ var DEFAULT_FOREGROUND_FALLBACK = RGBA.fromInts(...DEFAULT_FOREGROUND_RGB);
10782
+ var DEFAULT_BACKGROUND_FALLBACK = RGBA.fromInts(...DEFAULT_BACKGROUND_RGB);
10783
+ var fallbackAnsi256Palette = null;
10784
+ function getFallbackAnsi256Palette() {
10785
+ if (!fallbackAnsi256Palette) {
10786
+ fallbackAnsi256Palette = Array.from({ length: 256 }, (_, index) => {
10787
+ const [r, g, b] = ansi256IndexToRgb(index);
10788
+ return RGBA.fromInts(r, g, b);
10789
+ });
10790
+ }
10791
+ return fallbackAnsi256Palette;
10792
+ }
10793
+ function normalizeTerminalPalette(colors) {
10794
+ const fallbackPalette = getFallbackAnsi256Palette();
10795
+ return {
10796
+ palette: Array.from({ length: 256 }, (_, index) => {
10797
+ const detected = colors?.palette[index];
10798
+ return detected ? RGBA.fromHex(detected) : RGBA.clone(fallbackPalette[index]);
10799
+ }),
10800
+ defaultForeground: colors?.defaultForeground ? RGBA.fromHex(colors.defaultForeground) : RGBA.clone(DEFAULT_FOREGROUND_FALLBACK),
10801
+ defaultBackground: colors?.defaultBackground ? RGBA.fromHex(colors.defaultBackground) : RGBA.clone(DEFAULT_BACKGROUND_FALLBACK)
10802
+ };
10803
+ }
10804
+ function buildTerminalPaletteSignature(colors) {
10805
+ const normalized = normalizeTerminalPalette(colors);
10806
+ const paletteSignature = normalized.palette.map((color) => color.toInts().join(",")).join(";");
10807
+ return [
10808
+ paletteSignature,
10809
+ normalized.defaultForeground.toInts().join(","),
10810
+ normalized.defaultBackground.toInts().join(",")
10811
+ ].join("|");
10812
+ }
10666
10813
 
10667
10814
  // src/lib/paste.ts
10668
10815
  var PASTE_TEXT_DECODER = new TextDecoder;
@@ -10760,6 +10907,7 @@ class OptimizedBuffer {
10760
10907
  _widthMethod;
10761
10908
  respectAlpha = false;
10762
10909
  _rawBuffers = null;
10910
+ _rawColorTags = null;
10763
10911
  _destroyed = false;
10764
10912
  get ptr() {
10765
10913
  return this.bufferPtr;
@@ -10768,23 +10916,38 @@ class OptimizedBuffer {
10768
10916
  if (this._destroyed)
10769
10917
  throw new Error(`Buffer ${this.id} is destroyed`);
10770
10918
  }
10919
+ ensureRawBufferViews() {
10920
+ if (this._rawBuffers !== null && this._rawColorTags !== null) {
10921
+ return;
10922
+ }
10923
+ const size = this._width * this._height;
10924
+ const charPtr = this.lib.bufferGetCharPtr(this.bufferPtr);
10925
+ const fgPtr = this.lib.bufferGetFgPtr(this.bufferPtr);
10926
+ const bgPtr = this.lib.bufferGetBgPtr(this.bufferPtr);
10927
+ const fgTagPtr = this.lib.bufferGetFgTagPtr(this.bufferPtr);
10928
+ const bgTagPtr = this.lib.bufferGetBgTagPtr(this.bufferPtr);
10929
+ const attributesPtr = this.lib.bufferGetAttributesPtr(this.bufferPtr);
10930
+ this._rawBuffers = {
10931
+ char: new Uint32Array(toArrayBuffer(charPtr, 0, size * 4)),
10932
+ fg: new Float32Array(toArrayBuffer(fgPtr, 0, size * 4 * 4)),
10933
+ bg: new Float32Array(toArrayBuffer(bgPtr, 0, size * 4 * 4)),
10934
+ attributes: new Uint32Array(toArrayBuffer(attributesPtr, 0, size * 4))
10935
+ };
10936
+ this._rawColorTags = {
10937
+ fg: new Uint16Array(toArrayBuffer(fgTagPtr, 0, size * 2)),
10938
+ bg: new Uint16Array(toArrayBuffer(bgTagPtr, 0, size * 2))
10939
+ };
10940
+ }
10771
10941
  get buffers() {
10772
10942
  this.guard();
10773
- if (this._rawBuffers === null) {
10774
- const size = this._width * this._height;
10775
- const charPtr = this.lib.bufferGetCharPtr(this.bufferPtr);
10776
- const fgPtr = this.lib.bufferGetFgPtr(this.bufferPtr);
10777
- const bgPtr = this.lib.bufferGetBgPtr(this.bufferPtr);
10778
- const attributesPtr = this.lib.bufferGetAttributesPtr(this.bufferPtr);
10779
- this._rawBuffers = {
10780
- char: new Uint32Array(toArrayBuffer(charPtr, 0, size * 4)),
10781
- fg: new Float32Array(toArrayBuffer(fgPtr, 0, size * 4 * 4)),
10782
- bg: new Float32Array(toArrayBuffer(bgPtr, 0, size * 4 * 4)),
10783
- attributes: new Uint32Array(toArrayBuffer(attributesPtr, 0, size * 4))
10784
- };
10785
- }
10943
+ this.ensureRawBufferViews();
10786
10944
  return this._rawBuffers;
10787
10945
  }
10946
+ get rawColorTags() {
10947
+ this.guard();
10948
+ this.ensureRawBufferViews();
10949
+ return this._rawColorTags;
10950
+ }
10788
10951
  constructor(lib, ptr2, width, height, options) {
10789
10952
  this.id = options.id || `fb_${OptimizedBuffer.fbIdCounter++}`;
10790
10953
  this.lib = lib;
@@ -10829,6 +10992,7 @@ class OptimizedBuffer {
10829
10992
  getSpanLines() {
10830
10993
  this.guard();
10831
10994
  const { char, fg: fg2, bg: bg2, attributes } = this.buffers;
10995
+ const { fg: fgTag, bg: bgTag } = this.rawColorTags;
10832
10996
  const lines = [];
10833
10997
  const CHAR_FLAG_CONTINUATION = 3221225472 | 0;
10834
10998
  const CHAR_FLAG_MASK = 3221225472 | 0;
@@ -10843,8 +11007,8 @@ class OptimizedBuffer {
10843
11007
  for (let x = 0;x < this._width; x++) {
10844
11008
  const i = y * this._width + x;
10845
11009
  const cp = char[i];
10846
- const cellFg = RGBA.fromValues(fg2[i * 4], fg2[i * 4 + 1], fg2[i * 4 + 2], fg2[i * 4 + 3]);
10847
- const cellBg = RGBA.fromValues(bg2[i * 4], bg2[i * 4 + 1], bg2[i * 4 + 2], bg2[i * 4 + 3]);
11010
+ const cellFg = RGBA.fromValues(fg2[i * 4], fg2[i * 4 + 1], fg2[i * 4 + 2], fg2[i * 4 + 3], fgTag[i]);
11011
+ const cellBg = RGBA.fromValues(bg2[i * 4], bg2[i * 4 + 1], bg2[i * 4 + 2], bg2[i * 4 + 3], bgTag[i]);
10848
11012
  const cellAttrs = attributes[i] & 255;
10849
11013
  const isContinuation = (cp & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
10850
11014
  const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
@@ -10972,6 +11136,7 @@ class OptimizedBuffer {
10972
11136
  this._width = width;
10973
11137
  this._height = height;
10974
11138
  this._rawBuffers = null;
11139
+ this._rawColorTags = null;
10975
11140
  this.lib.bufferResize(this.bufferPtr, width, height);
10976
11141
  }
10977
11142
  drawBox(options) {
@@ -11665,16 +11830,30 @@ var StyledChunkStruct = defineStruct([
11665
11830
  unpackTransform: rgbaUnpackTransform
11666
11831
  }
11667
11832
  ],
11833
+ ["fg_tag", "u16", { default: COLOR_TAG_RGB }],
11834
+ ["bg_tag", "u16", { default: COLOR_TAG_RGB }],
11668
11835
  ["attributes", "u32", { default: 0 }],
11669
11836
  ["link", "char*", { default: "" }],
11670
11837
  ["link_len", "u64", { lengthOf: "link" }]
11671
11838
  ], {
11672
11839
  mapValue: (chunk) => {
11840
+ const normalizedFg = normalizeColorValue(chunk.fg ?? null);
11841
+ const normalizedBg = normalizeColorValue(chunk.bg ?? null);
11673
11842
  if (!chunk.link || typeof chunk.link === "string") {
11674
- return chunk;
11843
+ return {
11844
+ ...chunk,
11845
+ fg: normalizedFg?.rgba ?? null,
11846
+ bg: normalizedBg?.rgba ?? null,
11847
+ fg_tag: normalizedFg?.tag ?? COLOR_TAG_RGB,
11848
+ bg_tag: normalizedBg?.tag ?? COLOR_TAG_RGB
11849
+ };
11675
11850
  }
11676
11851
  return {
11677
11852
  ...chunk,
11853
+ fg: normalizedFg?.rgba ?? null,
11854
+ bg: normalizedBg?.rgba ?? null,
11855
+ fg_tag: normalizedFg?.tag ?? COLOR_TAG_RGB,
11856
+ bg_tag: normalizedBg?.tag ?? COLOR_TAG_RGB,
11678
11857
  link: chunk.link.url
11679
11858
  };
11680
11859
  }
@@ -11703,6 +11882,7 @@ var TerminalCapabilitiesStruct = defineStruct([
11703
11882
  ["kitty_keyboard", "bool_u8"],
11704
11883
  ["kitty_graphics", "bool_u8"],
11705
11884
  ["rgb", "bool_u8"],
11885
+ ["ansi256", "bool_u8"],
11706
11886
  ["unicode", UnicodeMethodEnum],
11707
11887
  ["sgr_pixels", "bool_u8"],
11708
11888
  ["color_scheme_updates", "bool_u8"],
@@ -11966,10 +12146,18 @@ function getOpenTUILib(libPath) {
11966
12146
  args: ["ptr"],
11967
12147
  returns: "ptr"
11968
12148
  },
12149
+ rendererSetPaletteState: {
12150
+ args: ["ptr", "ptr", "usize", "ptr", "ptr", "u32"],
12151
+ returns: "void"
12152
+ },
11969
12153
  queryPixelResolution: {
11970
12154
  args: ["ptr"],
11971
12155
  returns: "void"
11972
12156
  },
12157
+ queryThemeColors: {
12158
+ args: ["ptr"],
12159
+ returns: "void"
12160
+ },
11973
12161
  createOptimizedBuffer: {
11974
12162
  args: ["u32", "u32", "bool", "u8", "ptr", "usize"],
11975
12163
  returns: "ptr"
@@ -12006,6 +12194,14 @@ function getOpenTUILib(libPath) {
12006
12194
  args: ["ptr"],
12007
12195
  returns: "ptr"
12008
12196
  },
12197
+ bufferGetFgTagPtr: {
12198
+ args: ["ptr"],
12199
+ returns: "ptr"
12200
+ },
12201
+ bufferGetBgTagPtr: {
12202
+ args: ["ptr"],
12203
+ returns: "ptr"
12204
+ },
12009
12205
  bufferGetAttributesPtr: {
12010
12206
  args: ["ptr"],
12011
12207
  returns: "ptr"
@@ -12807,7 +13003,7 @@ function getOpenTUILib(libPath) {
12807
13003
  returns: "void"
12808
13004
  },
12809
13005
  syntaxStyleRegister: {
12810
- args: ["ptr", "ptr", "usize", "ptr", "ptr", "u8"],
13006
+ args: ["ptr", "ptr", "usize", "ptr", "ptr", "u32"],
12811
13007
  returns: "u32"
12812
13008
  },
12813
13009
  syntaxStyleResolveByName: {
@@ -13216,6 +13412,18 @@ class FFIRenderLib {
13216
13412
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
13217
13413
  return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
13218
13414
  }
13415
+ rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
13416
+ const paletteBuffer = new Float32Array(palette.length * 4);
13417
+ for (let index = 0;index < palette.length; index++) {
13418
+ const color = palette[index];
13419
+ const base = index * 4;
13420
+ paletteBuffer[base] = color.r;
13421
+ paletteBuffer[base + 1] = color.g;
13422
+ paletteBuffer[base + 2] = color.b;
13423
+ paletteBuffer[base + 3] = color.a;
13424
+ }
13425
+ this.opentui.symbols.rendererSetPaletteState(renderer, paletteBuffer, palette.length, defaultForeground.buffer, defaultBackground.buffer, paletteEpoch >>> 0);
13426
+ }
13219
13427
  bufferGetCharPtr(buffer) {
13220
13428
  const ptr5 = this.opentui.symbols.bufferGetCharPtr(buffer);
13221
13429
  if (!ptr5) {
@@ -13237,6 +13445,20 @@ class FFIRenderLib {
13237
13445
  }
13238
13446
  return ptr5;
13239
13447
  }
13448
+ bufferGetFgTagPtr(buffer) {
13449
+ const ptr5 = this.opentui.symbols.bufferGetFgTagPtr(buffer);
13450
+ if (!ptr5) {
13451
+ throw new Error("Failed to get fg tag pointer");
13452
+ }
13453
+ return ptr5;
13454
+ }
13455
+ bufferGetBgTagPtr(buffer) {
13456
+ const ptr5 = this.opentui.symbols.bufferGetBgTagPtr(buffer);
13457
+ if (!ptr5) {
13458
+ throw new Error("Failed to get bg tag pointer");
13459
+ }
13460
+ return ptr5;
13461
+ }
13240
13462
  bufferGetAttributesPtr(buffer) {
13241
13463
  const ptr5 = this.opentui.symbols.bufferGetAttributesPtr(buffer);
13242
13464
  if (!ptr5) {
@@ -13494,6 +13716,9 @@ class FFIRenderLib {
13494
13716
  queryPixelResolution(renderer) {
13495
13717
  this.opentui.symbols.queryPixelResolution(renderer);
13496
13718
  }
13719
+ queryThemeColors(renderer) {
13720
+ this.opentui.symbols.queryThemeColors(renderer);
13721
+ }
13497
13722
  writeOut(renderer, data) {
13498
13723
  const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
13499
13724
  if (bytes.length === 0)
@@ -14198,6 +14423,7 @@ class FFIRenderLib {
14198
14423
  kitty_keyboard: caps.kitty_keyboard,
14199
14424
  kitty_graphics: caps.kitty_graphics,
14200
14425
  rgb: caps.rgb,
14426
+ ansi256: caps.ansi256,
14201
14427
  unicode: caps.unicode,
14202
14428
  sgr_pixels: caps.sgr_pixels,
14203
14429
  color_scheme_updates: caps.color_scheme_updates,
@@ -17634,6 +17860,7 @@ class CodeRenderable extends TextBufferRenderable {
17634
17860
  this._highlightsDirty = true;
17635
17861
  this._highlightSnapshotId++;
17636
17862
  if (this._streaming && !this._drawUnstyledText && this._filetype) {
17863
+ this.requestRender();
17637
17864
  return;
17638
17865
  }
17639
17866
  this.textBuffer.setText(value);
@@ -20435,7 +20662,7 @@ function parsePixelResolution(sequence) {
20435
20662
  return null;
20436
20663
  }
20437
20664
 
20438
- // src/renderer.ts
20665
+ // src/renderer-theme-mode.ts
20439
20666
  var OSC_THEME_RESPONSE = /\x1b](10|11);(?:(?:rgb:)([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)|#([0-9a-fA-F]{6}))(?:\x07|\x1b\\)/g;
20440
20667
  function scaleOscThemeComponent(component) {
20441
20668
  const value = parseInt(component, 16);
@@ -20456,6 +20683,134 @@ function inferThemeModeFromBackgroundColor(color) {
20456
20683
  const brightness = (r * 299 + g * 587 + b * 114) / 1000;
20457
20684
  return brightness > 128 ? "light" : "dark";
20458
20685
  }
20686
+
20687
+ class RendererThemeMode {
20688
+ host;
20689
+ clock;
20690
+ static QUERY_TIMEOUT_MS = 250;
20691
+ _themeMode = null;
20692
+ themeQueryPending = true;
20693
+ themeOscForeground = null;
20694
+ themeOscBackground = null;
20695
+ themeRefreshTimeoutId = null;
20696
+ waiters = new Set;
20697
+ constructor(host, clock2) {
20698
+ this.host = host;
20699
+ this.clock = clock2;
20700
+ }
20701
+ get themeMode() {
20702
+ return this._themeMode;
20703
+ }
20704
+ waitForThemeMode(timeoutMs, isDestroyed) {
20705
+ if (this._themeMode !== null || isDestroyed || timeoutMs === 0) {
20706
+ return Promise.resolve(this._themeMode);
20707
+ }
20708
+ return new Promise((resolve4) => {
20709
+ const waiter = {
20710
+ resolve: resolve4,
20711
+ timeoutHandle: null
20712
+ };
20713
+ if (timeoutMs > 0) {
20714
+ waiter.timeoutHandle = this.clock.setTimeout(() => {
20715
+ this.waiters.delete(waiter);
20716
+ waiter.timeoutHandle = null;
20717
+ resolve4(this._themeMode);
20718
+ }, timeoutMs);
20719
+ }
20720
+ this.waiters.add(waiter);
20721
+ });
20722
+ }
20723
+ cancelRefresh() {
20724
+ if (this.themeRefreshTimeoutId === null) {
20725
+ return;
20726
+ }
20727
+ this.clock.clearTimeout(this.themeRefreshTimeoutId);
20728
+ this.themeRefreshTimeoutId = null;
20729
+ this.themeQueryPending = false;
20730
+ }
20731
+ dispose() {
20732
+ this.cancelRefresh();
20733
+ for (const waiter of this.waiters) {
20734
+ if (waiter.timeoutHandle !== null) {
20735
+ this.clock.clearTimeout(waiter.timeoutHandle);
20736
+ }
20737
+ waiter.resolve(this._themeMode);
20738
+ }
20739
+ this.waiters.clear();
20740
+ }
20741
+ handleSequence(sequence) {
20742
+ if (sequence === "\x1B[?997;1n" || sequence === "\x1B[?997;2n") {
20743
+ this.requestThemeOscColors();
20744
+ return { handled: true, changedMode: null };
20745
+ }
20746
+ let handledOscThemeResponse = false;
20747
+ let match;
20748
+ OSC_THEME_RESPONSE.lastIndex = 0;
20749
+ while (match = OSC_THEME_RESPONSE.exec(sequence)) {
20750
+ handledOscThemeResponse = true;
20751
+ const color = oscThemeColorToHex(match[2], match[3], match[4], match[5]);
20752
+ if (match[1] === "10") {
20753
+ this.themeOscForeground = color;
20754
+ } else {
20755
+ this.themeOscBackground = color;
20756
+ }
20757
+ }
20758
+ if (!handledOscThemeResponse) {
20759
+ return { handled: false, changedMode: null };
20760
+ }
20761
+ if (!this.themeQueryPending) {
20762
+ return { handled: true, changedMode: null };
20763
+ }
20764
+ if (!this.themeOscForeground || !this.themeOscBackground) {
20765
+ return { handled: true, changedMode: null };
20766
+ }
20767
+ const nextMode = inferThemeModeFromBackgroundColor(this.themeOscBackground);
20768
+ const changedMode = this.applyThemeMode(nextMode);
20769
+ this.completeThemeQuery();
20770
+ return { handled: true, changedMode };
20771
+ }
20772
+ clearThemeRefreshTimeout() {
20773
+ if (this.themeRefreshTimeoutId === null) {
20774
+ return;
20775
+ }
20776
+ this.clock.clearTimeout(this.themeRefreshTimeoutId);
20777
+ this.themeRefreshTimeoutId = null;
20778
+ }
20779
+ completeThemeQuery() {
20780
+ this.clearThemeRefreshTimeout();
20781
+ this.themeQueryPending = false;
20782
+ }
20783
+ requestThemeOscColors() {
20784
+ if (this.themeRefreshTimeoutId !== null) {
20785
+ return;
20786
+ }
20787
+ this.themeQueryPending = true;
20788
+ this.themeOscForeground = null;
20789
+ this.themeOscBackground = null;
20790
+ this.host.queryThemeColors();
20791
+ this.clearThemeRefreshTimeout();
20792
+ this.themeRefreshTimeoutId = this.clock.setTimeout(() => {
20793
+ this.completeThemeQuery();
20794
+ }, RendererThemeMode.QUERY_TIMEOUT_MS);
20795
+ }
20796
+ applyThemeMode(mode) {
20797
+ const changed = this._themeMode !== mode;
20798
+ this._themeMode = mode;
20799
+ if (!changed) {
20800
+ return null;
20801
+ }
20802
+ for (const waiter of this.waiters) {
20803
+ if (waiter.timeoutHandle !== null) {
20804
+ this.clock.clearTimeout(waiter.timeoutHandle);
20805
+ }
20806
+ waiter.resolve(mode);
20807
+ }
20808
+ this.waiters.clear();
20809
+ return mode;
20810
+ }
20811
+ }
20812
+
20813
+ // src/renderer.ts
20459
20814
  registerEnvVar({
20460
20815
  name: "OTUI_DUMP_CAPTURES",
20461
20816
  description: "Dump captured stdout and console caches when the renderer exit handler runs.",
@@ -20649,6 +21004,7 @@ var KITTY_FLAG_ALTERNATE_KEYS = 4;
20649
21004
  var KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8;
20650
21005
  var KITTY_FLAG_REPORT_TEXT = 16;
20651
21006
  var DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
21007
+ var NATIVE_PALETTE_QUERY_SIZE = 16;
20652
21008
  function buildKittyKeyboardFlags(config) {
20653
21009
  if (!config) {
20654
21010
  return 0;
@@ -20910,18 +21266,20 @@ class CliRenderer extends EventEmitter9 {
20910
21266
  lifecyclePasses = new Set;
20911
21267
  _openConsoleOnError = false;
20912
21268
  _paletteDetector = null;
21269
+ _paletteCache = new Map;
20913
21270
  _cachedPalette = null;
20914
21271
  _paletteDetectionPromise = null;
21272
+ _paletteDetectionSize = 0;
21273
+ _paletteEpoch = 0;
21274
+ _publishedPaletteSignature = null;
21275
+ _palettePublishGeneration = 0;
20915
21276
  _onDestroy;
20916
- _themeMode = null;
20917
- _themeModeSource = "none";
20918
- _themeFallbackPending = true;
20919
- _themeOscForeground = null;
20920
- _themeOscBackground = null;
21277
+ themeModeState;
20921
21278
  _terminalFocusState = null;
20922
21279
  sequenceHandlers = [];
20923
21280
  prependedInputHandlers = [];
20924
21281
  shouldRestoreModesOnNextFocus = false;
21282
+ themeModeHandler;
20925
21283
  idleResolvers = [];
20926
21284
  _debugInputs = [];
20927
21285
  _debugModeEnabled = env.OTUI_DEBUG;
@@ -21001,7 +21359,7 @@ Captured external output:
21001
21359
  this.rendererPtr = rendererPtr;
21002
21360
  this.clearOnShutdown = config.clearOnShutdown ?? true;
21003
21361
  this.lib.setClearOnShutdown(this.rendererPtr, this.clearOnShutdown);
21004
- const forwardEnvKeys = config.forwardEnvKeys ?? [...DEFAULT_FORWARDED_ENV_KEYS];
21362
+ const forwardEnvKeys = config.forwardEnvKeys ?? (config.remote ? [] : [...DEFAULT_FORWARDED_ENV_KEYS]);
21005
21363
  for (const key of forwardEnvKeys) {
21006
21364
  const value = process.env[key];
21007
21365
  if (value === undefined)
@@ -21024,6 +21382,18 @@ Captured external output:
21024
21382
  this.targetFps = config.targetFps || 30;
21025
21383
  this.maxFps = config.maxFps || 60;
21026
21384
  this.clock = config.clock ?? new SystemClock;
21385
+ this.themeModeState = new RendererThemeMode({
21386
+ queryThemeColors: () => {
21387
+ this.lib.queryThemeColors(this.rendererPtr);
21388
+ }
21389
+ }, this.clock);
21390
+ this.themeModeHandler = (sequence) => {
21391
+ const result = this.themeModeState.handleSequence(sequence);
21392
+ if (result.changedMode) {
21393
+ this.emit("theme_mode" /* THEME_MODE */, result.changedMode);
21394
+ }
21395
+ return result.handled;
21396
+ };
21027
21397
  this.memorySnapshotInterval = config.memorySnapshotInterval ?? 0;
21028
21398
  this.gatherStats = config.gatherStats || false;
21029
21399
  this.maxStatSamples = config.maxStatSamples || 300;
@@ -21385,39 +21755,13 @@ Captured external output:
21385
21755
  return this._capabilities;
21386
21756
  }
21387
21757
  get themeMode() {
21388
- return this._themeMode;
21758
+ return this.themeModeState.themeMode;
21389
21759
  }
21390
21760
  waitForThemeMode(timeoutMs = 1000) {
21391
21761
  if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
21392
21762
  throw new Error("timeoutMs must be a non-negative finite number");
21393
21763
  }
21394
- if (this._themeMode !== null || this._isDestroyed || timeoutMs === 0) {
21395
- return Promise.resolve(this._themeMode);
21396
- }
21397
- return new Promise((resolve4) => {
21398
- let timeoutHandle = null;
21399
- const cleanup = () => {
21400
- if (timeoutHandle !== null) {
21401
- this.clock.clearTimeout(timeoutHandle);
21402
- timeoutHandle = null;
21403
- }
21404
- this.off("theme_mode" /* THEME_MODE */, handleThemeMode);
21405
- this.off("destroy" /* DESTROY */, handleDestroy);
21406
- };
21407
- const finish = () => {
21408
- cleanup();
21409
- resolve4(this._themeMode);
21410
- };
21411
- const handleThemeMode = () => {
21412
- finish();
21413
- };
21414
- const handleDestroy = () => {
21415
- finish();
21416
- };
21417
- this.on("theme_mode" /* THEME_MODE */, handleThemeMode);
21418
- this.on("destroy" /* DESTROY */, handleDestroy);
21419
- timeoutHandle = this.clock.setTimeout(finish, timeoutMs);
21420
- });
21764
+ return this.themeModeState.waitForThemeMode(timeoutMs, this._isDestroyed);
21421
21765
  }
21422
21766
  getDebugInputs() {
21423
21767
  return [...this._debugInputs];
@@ -22224,6 +22568,7 @@ Captured external output:
22224
22568
  }, 120);
22225
22569
  }
22226
22570
  this.queryPixelResolution();
22571
+ this.ensureNativePaletteState();
22227
22572
  }
22228
22573
  stdinListener = ((chunk) => {
22229
22574
  const data = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
@@ -22266,6 +22611,10 @@ Captured external output:
22266
22611
  }
22267
22612
  this.lib.processCapabilityResponse(this.rendererPtr, sequence);
22268
22613
  this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
22614
+ if (hasStandardCapabilitySignature) {
22615
+ this.forceFullRepaintRequested = true;
22616
+ this.requestRender();
22617
+ }
22269
22618
  this.emit("capabilities" /* CAPABILITIES */, this._capabilities);
22270
22619
  const hadPendingSplitStartupCursorSeed = this.pendingSplitStartupCursorSeed;
22271
22620
  if (hadPendingSplitStartupCursorSeed && hasCursorReport && this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout") {
@@ -22307,52 +22656,6 @@ Captured external output:
22307
22656
  }
22308
22657
  return false;
22309
22658
  }).bind(this);
22310
- themeModeHandler = ((sequence) => {
22311
- if (sequence === "\x1B[?997;1n") {
22312
- this.applyThemeMode("dark", "csi");
22313
- this._themeFallbackPending = false;
22314
- return true;
22315
- }
22316
- if (sequence === "\x1B[?997;2n") {
22317
- this.applyThemeMode("light", "csi");
22318
- this._themeFallbackPending = false;
22319
- return true;
22320
- }
22321
- let handledOscThemeResponse = false;
22322
- let match;
22323
- OSC_THEME_RESPONSE.lastIndex = 0;
22324
- while (match = OSC_THEME_RESPONSE.exec(sequence)) {
22325
- handledOscThemeResponse = true;
22326
- const color = oscThemeColorToHex(match[2], match[3], match[4], match[5]);
22327
- if (match[1] === "10") {
22328
- this._themeOscForeground = color;
22329
- } else {
22330
- this._themeOscBackground = color;
22331
- }
22332
- }
22333
- if (!handledOscThemeResponse) {
22334
- return false;
22335
- }
22336
- if (!this._themeFallbackPending) {
22337
- return true;
22338
- }
22339
- if (this._themeOscForeground && this._themeOscBackground) {
22340
- this.applyThemeMode(inferThemeModeFromBackgroundColor(this._themeOscBackground), "osc");
22341
- this._themeFallbackPending = false;
22342
- }
22343
- return true;
22344
- }).bind(this);
22345
- applyThemeMode(mode, source) {
22346
- if (source === "osc" && this._themeModeSource === "csi") {
22347
- return;
22348
- }
22349
- const changed = this._themeMode !== mode;
22350
- this._themeMode = mode;
22351
- this._themeModeSource = source;
22352
- if (changed) {
22353
- this.emit("theme_mode" /* THEME_MODE */, mode);
22354
- }
22355
- }
22356
22659
  dispatchSequenceHandlers(sequence) {
22357
22660
  if (this._debugModeEnabled) {
22358
22661
  this._debugInputs.push({
@@ -22887,6 +23190,7 @@ Captured external output:
22887
23190
  });
22888
23191
  this.stdinParser?.reset();
22889
23192
  this.stdin.removeListener("data", this.stdinListener);
23193
+ this.themeModeState.cancelRefresh();
22890
23194
  this.lib.suspendRenderer(this.rendererPtr);
22891
23195
  if (this.stdin.setRawMode) {
22892
23196
  this.stdin.setRawMode(false);
@@ -22987,6 +23291,7 @@ Captured external output:
22987
23291
  this.clock.clearTimeout(this.renderTimeout);
22988
23292
  this.renderTimeout = null;
22989
23293
  }
23294
+ this.themeModeState.cancelRefresh();
22990
23295
  this._isRunning = false;
22991
23296
  this.waitingForPixelResolution = false;
22992
23297
  this.updateStdinParserProtocolContext({
@@ -23023,8 +23328,14 @@ Captured external output:
23023
23328
  this._paletteDetector.cleanup();
23024
23329
  this._paletteDetector = null;
23025
23330
  }
23331
+ this._paletteCache.clear();
23026
23332
  this._paletteDetectionPromise = null;
23333
+ this._paletteDetectionSize = 0;
23027
23334
  this._cachedPalette = null;
23335
+ this._publishedPaletteSignature = null;
23336
+ this._paletteEpoch = 0;
23337
+ this._palettePublishGeneration = 0;
23338
+ this.themeModeState.dispose();
23028
23339
  this.emit("destroy" /* DESTROY */);
23029
23340
  try {
23030
23341
  this.root.destroyRecursively();
@@ -23164,9 +23475,10 @@ Captured external output:
23164
23475
  this.flushPendingSplitCommits(forceSplitRepaint);
23165
23476
  this.pendingSplitFooterTransition = null;
23166
23477
  } else {
23478
+ const force = this.forceFullRepaintRequested;
23167
23479
  this.forceFullRepaintRequested = false;
23168
23480
  this.pendingSplitFooterTransition = null;
23169
- this.lib.render(this.rendererPtr, false);
23481
+ this.lib.render(this.rendererPtr, force);
23170
23482
  }
23171
23483
  this.renderingNative = false;
23172
23484
  }
@@ -23311,13 +23623,63 @@ Captured external output:
23311
23623
  }
23312
23624
  }
23313
23625
  get paletteDetectionStatus() {
23314
- if (this._cachedPalette)
23315
- return "cached";
23316
23626
  if (this._paletteDetectionPromise)
23317
23627
  return "detecting";
23628
+ if (this._paletteCache.size > 0)
23629
+ return "cached";
23318
23630
  return "idle";
23319
23631
  }
23632
+ getCachedPaletteBySize(size) {
23633
+ const exactMatch = this._paletteCache.get(size);
23634
+ if (exactMatch) {
23635
+ return exactMatch;
23636
+ }
23637
+ const largerSize = [...this._paletteCache.keys()].sort((a, b) => a - b).find((candidate) => candidate >= size);
23638
+ if (largerSize === undefined) {
23639
+ return null;
23640
+ }
23641
+ const source = this._paletteCache.get(largerSize);
23642
+ if (!source) {
23643
+ return null;
23644
+ }
23645
+ const projected = {
23646
+ ...source,
23647
+ palette: source.palette.slice(0, size)
23648
+ };
23649
+ this._paletteCache.set(size, projected);
23650
+ return projected;
23651
+ }
23652
+ ensurePaletteDetector() {
23653
+ if (!this._paletteDetector) {
23654
+ const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
23655
+ this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isLegacyTmux, {
23656
+ subscribeOsc: this.subscribeOsc.bind(this)
23657
+ }, this.clock);
23658
+ }
23659
+ return this._paletteDetector;
23660
+ }
23661
+ syncNativePaletteState(colors) {
23662
+ const signature = buildTerminalPaletteSignature(colors);
23663
+ if (this._publishedPaletteSignature !== null && this._publishedPaletteSignature !== signature) {
23664
+ this._paletteEpoch = this._paletteEpoch + 1 >>> 0;
23665
+ }
23666
+ this._publishedPaletteSignature = signature;
23667
+ const normalized = normalizeTerminalPalette(colors);
23668
+ this.lib.rendererSetPaletteState(this.rendererPtr, normalized.palette, normalized.defaultForeground, normalized.defaultBackground, this._paletteEpoch);
23669
+ }
23670
+ ensureNativePaletteState() {
23671
+ if (!this._terminalIsSetup || this._isDestroyed)
23672
+ return;
23673
+ const publishGeneration = this._palettePublishGeneration;
23674
+ this.getPalette({ size: NATIVE_PALETTE_QUERY_SIZE }).then((colors) => {
23675
+ if (this._palettePublishGeneration === publishGeneration) {
23676
+ this.syncNativePaletteState(colors);
23677
+ }
23678
+ this.requestRender();
23679
+ }).catch(() => {});
23680
+ }
23320
23681
  clearPaletteCache() {
23682
+ this._paletteCache.clear();
23321
23683
  this._cachedPalette = null;
23322
23684
  }
23323
23685
  async getPalette(options) {
@@ -23325,31 +23687,65 @@ Captured external output:
23325
23687
  throw new Error("Cannot detect palette while renderer is suspended");
23326
23688
  }
23327
23689
  const requestedSize = options?.size ?? 16;
23328
- if (this._cachedPalette && this._cachedPalette.palette.length !== requestedSize) {
23329
- this._cachedPalette = null;
23330
- }
23331
- if (this._cachedPalette) {
23332
- return this._cachedPalette;
23690
+ const detectionTimeout = options?.timeout;
23691
+ const cachedPalette = this.getCachedPaletteBySize(requestedSize);
23692
+ if (cachedPalette) {
23693
+ this._cachedPalette = cachedPalette;
23694
+ return cachedPalette;
23333
23695
  }
23334
23696
  if (this._paletteDetectionPromise) {
23335
- return this._paletteDetectionPromise;
23336
- }
23337
- if (!this._paletteDetector) {
23338
- const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
23339
- this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isLegacyTmux, {
23340
- subscribeOsc: this.subscribeOsc.bind(this)
23341
- }, this.clock);
23697
+ if (this._paletteDetectionSize >= requestedSize) {
23698
+ return this._paletteDetectionPromise.then((palette) => {
23699
+ const cached = this.getCachedPaletteBySize(requestedSize);
23700
+ if (cached) {
23701
+ this._cachedPalette = cached;
23702
+ return cached;
23703
+ }
23704
+ const projected = {
23705
+ ...palette,
23706
+ palette: palette.palette.slice(0, requestedSize)
23707
+ };
23708
+ this._paletteCache.set(requestedSize, projected);
23709
+ this._cachedPalette = projected;
23710
+ return projected;
23711
+ });
23712
+ }
23713
+ await this._paletteDetectionPromise;
23714
+ const afterWait = this.getCachedPaletteBySize(requestedSize);
23715
+ if (afterWait) {
23716
+ this._cachedPalette = afterWait;
23717
+ return afterWait;
23718
+ }
23342
23719
  }
23343
- this._paletteDetectionPromise = this._paletteDetector.detect(options).then((result) => {
23720
+ const detector = this.ensurePaletteDetector();
23721
+ const publishGeneration = this._palettePublishGeneration;
23722
+ this._paletteDetectionSize = requestedSize;
23723
+ this._paletteDetectionPromise = detector.detect({ ...options, timeout: detectionTimeout }).then((result) => {
23724
+ this._paletteCache.set(result.palette.length, result);
23344
23725
  this._cachedPalette = result;
23345
23726
  this._paletteDetectionPromise = null;
23727
+ this._paletteDetectionSize = 0;
23728
+ if (this._palettePublishGeneration === publishGeneration) {
23729
+ if (result.palette.length >= NATIVE_PALETTE_QUERY_SIZE) {
23730
+ this.syncNativePaletteState(result);
23731
+ } else if (this._terminalIsSetup && !this._paletteCache.has(NATIVE_PALETTE_QUERY_SIZE)) {
23732
+ this.ensureNativePaletteState();
23733
+ }
23734
+ }
23346
23735
  return result;
23736
+ }).catch((error) => {
23737
+ this._paletteDetectionPromise = null;
23738
+ this._paletteDetectionSize = 0;
23739
+ throw error;
23347
23740
  });
23348
- return this._paletteDetectionPromise;
23741
+ const detected = await this._paletteDetectionPromise;
23742
+ const finalPalette = this.getCachedPaletteBySize(requestedSize) ?? detected;
23743
+ this._cachedPalette = finalPalette;
23744
+ return finalPalette;
23349
23745
  }
23350
23746
  }
23351
23747
 
23352
- export { __toESM, __commonJS, __export, __require, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, 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, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, calculateRenderGeometry, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
23748
+ export { __toESM, __commonJS, __export, __require, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, COLOR_TAG_RGB, COLOR_TAG_DEFAULT, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, decodeColorTag, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, 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, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, calculateRenderGeometry, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
23353
23749
 
23354
- //# debugId=8C02D415BAC7A02B64756E2164756E21
23355
- //# sourceMappingURL=index-t3rrpex7.js.map
23750
+ //# debugId=D9BE2EC36AFD1FCD64756E2164756E21
23751
+ //# sourceMappingURL=index-cs6ygy1c.js.map