@pierre/diffs 1.2.9 → 1.2.11

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 (52) hide show
  1. package/README.md +6 -6
  2. package/dist/components/CodeView.js +6 -6
  3. package/dist/components/CodeView.js.map +1 -1
  4. package/dist/components/File.d.ts.map +1 -1
  5. package/dist/components/File.js +6 -1
  6. package/dist/components/File.js.map +1 -1
  7. package/dist/components/FileDiff.js +1 -1
  8. package/dist/components/FileDiff.js.map +1 -1
  9. package/dist/components/FileStream.js +4 -2
  10. package/dist/components/FileStream.js.map +1 -1
  11. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  12. package/dist/components/VirtualizedFile.d.ts +6 -2
  13. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  14. package/dist/components/VirtualizedFile.js +82 -21
  15. package/dist/components/VirtualizedFile.js.map +1 -1
  16. package/dist/components/VirtualizedFileDiff.d.ts +7 -2
  17. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  18. package/dist/components/VirtualizedFileDiff.js +77 -15
  19. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  20. package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
  21. package/dist/constants.d.ts.map +1 -1
  22. package/dist/highlighter/themes/themeResolver.d.ts +4 -1
  23. package/dist/highlighter/themes/themeResolver.d.ts.map +1 -1
  24. package/dist/managers/InteractionManager.js +1 -1
  25. package/dist/managers/InteractionManager.js.map +1 -1
  26. package/dist/managers/ResizeManager.js +1 -1
  27. package/dist/managers/ResizeManager.js.map +1 -1
  28. package/dist/react/jsx.d.ts.map +1 -1
  29. package/dist/renderers/DiffHunksRenderer.d.ts +3 -2
  30. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  31. package/dist/renderers/DiffHunksRenderer.js +49 -2
  32. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  33. package/dist/renderers/FileRenderer.js +12 -0
  34. package/dist/renderers/FileRenderer.js.map +1 -1
  35. package/dist/types.d.ts +8 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/utils/includesFileAnnotations.d.ts +17 -0
  38. package/dist/utils/includesFileAnnotations.d.ts.map +1 -0
  39. package/dist/utils/includesFileAnnotations.js +19 -0
  40. package/dist/utils/includesFileAnnotations.js.map +1 -0
  41. package/dist/utils/parseMergeConflictDiffFromFile.js.map +1 -1
  42. package/dist/utils/renderDiffWithHighlighter.js +4 -2
  43. package/dist/utils/renderDiffWithHighlighter.js.map +1 -1
  44. package/dist/utils/renderFileWithHighlighter.js +4 -2
  45. package/dist/utils/renderFileWithHighlighter.js.map +1 -1
  46. package/dist/worker/{wasm-BaDzIkIn.js → wasm-qE0LgnY3.js} +2 -2
  47. package/dist/worker/{wasm-BaDzIkIn.js.map → wasm-qE0LgnY3.js.map} +1 -1
  48. package/dist/worker/worker-portable.js +991 -266
  49. package/dist/worker/worker-portable.js.map +1 -1
  50. package/dist/worker/worker.js +8 -4
  51. package/dist/worker/worker.js.map +1 -1
  52. package/package.json +4 -10
@@ -1,6 +1,3 @@
1
- import { createThemeResolver } from "@pierre/theming";
2
- import { normalizeThemeColors } from "@pierre/theming/color";
3
-
4
1
  //#region rolldown:runtime
5
2
  var __defProp$2 = Object.defineProperty;
6
3
  var __export = (all$1) => {
@@ -13,42 +10,34 @@ var __export = (all$1) => {
13
10
  };
14
11
 
15
12
  //#endregion
16
- //#region ../../node_modules/.bun/shiki@4.0.2/node_modules/shiki/dist/chunk-CtajNgzt.mjs
13
+ //#region ../../node_modules/.bun/shiki@4.2.0/node_modules/shiki/dist/chunk-BBjsoOtd.mjs
17
14
  var __defProp$1 = Object.defineProperty;
18
15
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
19
16
  var __getOwnPropNames = Object.getOwnPropertyNames;
20
17
  var __hasOwnProp = Object.prototype.hasOwnProperty;
21
18
  var __exportAll = (all$1, no_symbols) => {
22
19
  let target = {};
23
- for (var name in all$1) {
24
- __defProp$1(target, name, {
25
- get: all$1[name],
26
- enumerable: true
27
- });
28
- }
29
- if (!no_symbols) {
30
- __defProp$1(target, Symbol.toStringTag, { value: "Module" });
31
- }
20
+ for (var name in all$1) __defProp$1(target, name, {
21
+ get: all$1[name],
22
+ enumerable: true
23
+ });
24
+ if (!no_symbols) __defProp$1(target, Symbol.toStringTag, { value: "Module" });
32
25
  return target;
33
26
  };
34
27
  var __copyProps = (to, from, except, desc) => {
35
- if (from && typeof from === "object" || typeof from === "function") {
36
- for (var keys = __getOwnPropNames(from), i$2 = 0, n = keys.length, key$1; i$2 < n; i$2++) {
37
- key$1 = keys[i$2];
38
- if (!__hasOwnProp.call(to, key$1) && key$1 !== except) {
39
- __defProp$1(to, key$1, {
40
- get: ((k$2) => from[k$2]).bind(null, key$1),
41
- enumerable: !(desc = __getOwnPropDesc(from, key$1)) || desc.enumerable
42
- });
43
- }
44
- }
28
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$2 = 0, n = keys.length, key$1; i$2 < n; i$2++) {
29
+ key$1 = keys[i$2];
30
+ if (!__hasOwnProp.call(to, key$1) && key$1 !== except) __defProp$1(to, key$1, {
31
+ get: ((k$2) => from[k$2]).bind(null, key$1),
32
+ enumerable: !(desc = __getOwnPropDesc(from, key$1)) || desc.enumerable
33
+ });
45
34
  }
46
35
  return to;
47
36
  };
48
37
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
49
38
 
50
39
  //#endregion
51
- //#region ../../node_modules/.bun/@shikijs+types@4.0.2/node_modules/@shikijs/types/dist/index.mjs
40
+ //#region ../../node_modules/.bun/@shikijs+types@4.2.0/node_modules/@shikijs/types/dist/index.mjs
52
41
  var ShikiError$1 = class extends Error {
53
42
  constructor(message) {
54
43
  super(message);
@@ -2914,7 +2903,7 @@ var Registry = class {
2914
2903
  var INITIAL = StateStackImpl.NULL;
2915
2904
 
2916
2905
  //#endregion
2917
- //#region ../../node_modules/.bun/@shikijs+primitive@4.0.2/node_modules/@shikijs/primitive/dist/index.mjs
2906
+ //#region ../../node_modules/.bun/@shikijs+primitive@4.2.0/node_modules/@shikijs/primitive/dist/index.mjs
2918
2907
  function resolveColorReplacements(theme, options) {
2919
2908
  const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
2920
2909
  const themeName = typeof theme === "string" ? theme : theme.name;
@@ -2926,8 +2915,8 @@ function applyColorReplacements(color, replacements) {
2926
2915
  if (!color) return color;
2927
2916
  return replacements?.[color?.toLowerCase()] || color;
2928
2917
  }
2929
- function toArray(x$1) {
2930
- return Array.isArray(x$1) ? x$1 : [x$1];
2918
+ function toArray(x$2) {
2919
+ return Array.isArray(x$2) ? x$2 : [x$2];
2931
2920
  }
2932
2921
  /**
2933
2922
  * Normalize a getter to a promise.
@@ -2988,9 +2977,10 @@ function isSpecialTheme(theme) {
2988
2977
  * // => [['hello\n', 0], ['world', 6]]
2989
2978
  * ```
2990
2979
  */
2980
+ const RE_NEWLINE = /(\r?\n)/g;
2991
2981
  function splitLines$1(code, preserveEnding = false) {
2992
2982
  if (code.length === 0) return [["", 0]];
2993
- const parts = code.split(/(\r?\n)/g);
2983
+ const parts = code.split(RE_NEWLINE);
2994
2984
  let index = 0;
2995
2985
  const lines = [];
2996
2986
  for (let i$2 = 0; i$2 < parts.length; i$2 += 2) {
@@ -3104,7 +3094,7 @@ function normalizeTheme(rawTheme) {
3104
3094
  * Resolve
3105
3095
  */
3106
3096
  async function resolveLangs(langs) {
3107
- return Array.from(new Set((await Promise.all(langs.filter((l$2) => !isSpecialLang(l$2)).map(async (lang) => await normalizeGetter(lang).then((r$3) => Array.isArray(r$3) ? r$3 : [r$3])))).flat()));
3097
+ return [...new Set((await Promise.all(langs.filter((l$2) => !isSpecialLang(l$2)).map(async (lang) => await normalizeGetter(lang).then((r$3) => Array.isArray(r$3) ? r$3 : [r$3])))).flat())];
3108
3098
  }
3109
3099
  async function resolveThemes(themes) {
3110
3100
  return (await Promise.all(themes.map(async (theme) => isSpecialTheme(theme) ? null : normalizeTheme(await normalizeGetter(theme))))).filter((i$2) => !!i$2);
@@ -3115,13 +3105,17 @@ function resolveLangAlias(name, alias) {
3115
3105
  const resolved = new Set([name]);
3116
3106
  while (alias[name]) {
3117
3107
  name = alias[name];
3118
- if (resolved.has(name)) throw new ShikiError$1(`Circular alias \`${Array.from(resolved).join(" -> ")} -> ${name}\``);
3108
+ if (resolved.has(name)) throw new ShikiError$1(`Circular alias \`${[...resolved].join(" -> ")} -> ${name}\``);
3119
3109
  resolved.add(name);
3120
3110
  }
3121
3111
  }
3122
3112
  return name;
3123
3113
  }
3124
3114
  var Registry$1 = class extends Registry {
3115
+ _resolver;
3116
+ _themes;
3117
+ _langs;
3118
+ _alias;
3125
3119
  _resolvedThemes = /* @__PURE__ */ new Map();
3126
3120
  _resolvedGrammars = /* @__PURE__ */ new Map();
3127
3121
  _langMap = /* @__PURE__ */ new Map();
@@ -3200,7 +3194,7 @@ var Registry$1 = class extends Registry {
3200
3194
  }
3201
3195
  loadLanguages(langs) {
3202
3196
  for (const lang of langs) this.resolveEmbeddedLanguages(lang);
3203
- const langsGraphArray = Array.from(this._langGraph.entries());
3197
+ const langsGraphArray = [...this._langGraph.entries()];
3204
3198
  const missingLangs = langsGraphArray.filter(([_$2, lang]) => !lang);
3205
3199
  if (missingLangs.length) {
3206
3200
  const dependents = langsGraphArray.filter(([_$2, lang]) => {
@@ -3466,6 +3460,8 @@ function getGrammarStack(state, theme) {
3466
3460
  if (!(state instanceof GrammarState)) throw new ShikiError$1("Invalid grammar state");
3467
3461
  return state.getInternalStack(theme);
3468
3462
  }
3463
+ const RE_COMMA = /,/;
3464
+ const RE_SPACE = / /;
3469
3465
  /**
3470
3466
  * Code to tokens, with a simple theme.
3471
3467
  */
@@ -3556,7 +3552,7 @@ function _tokenizeWithTheme(code, grammar, theme, colorMap, options) {
3556
3552
  let selectors;
3557
3553
  switch (typeof setting.scope) {
3558
3554
  case "string":
3559
- selectors = setting.scope.split(/,/).map((scope) => scope.trim());
3555
+ selectors = setting.scope.split(RE_COMMA).map((scope) => scope.trim());
3560
3556
  break;
3561
3557
  case "object":
3562
3558
  selectors = setting.scope;
@@ -3565,7 +3561,7 @@ function _tokenizeWithTheme(code, grammar, theme, colorMap, options) {
3565
3561
  }
3566
3562
  themeSettingsSelectors.push({
3567
3563
  settings: setting,
3568
- selectors: selectors.map((selector) => selector.split(/ /))
3564
+ selectors: selectors.map((selector) => selector.split(RE_SPACE))
3569
3565
  });
3570
3566
  }
3571
3567
  token$1.explanation = [];
@@ -3610,7 +3606,7 @@ function matchesOne(selector, scope) {
3610
3606
  return selector === scope || scope.substring(0, selector.length) === selector && scope[selector.length] === ".";
3611
3607
  }
3612
3608
  function matches(selectors, scope, parentScopes) {
3613
- if (!matchesOne(selectors[selectors.length - 1], scope)) return false;
3609
+ if (!matchesOne(selectors.at(-1), scope)) return false;
3614
3610
  let selectorParentIndex = selectors.length - 2;
3615
3611
  let parentIndex = parentScopes.length - 1;
3616
3612
  while (selectorParentIndex >= 0 && parentIndex >= 0) {
@@ -6526,7 +6522,7 @@ function serializeAttributes(state, properties) {
6526
6522
  */
6527
6523
  function serializeAttribute(state, key$1, value) {
6528
6524
  const info = find(state.schema, key$1);
6529
- const x$1 = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
6525
+ const x$2 = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
6530
6526
  const y$2 = state.settings.allowDangerousCharacters ? 0 : 1;
6531
6527
  let quote = state.quote;
6532
6528
  /** @type {string | undefined} */
@@ -6539,14 +6535,14 @@ function serializeAttribute(state, key$1, value) {
6539
6535
  if (value === null || value === undefined || value === false || typeof value === "number" && Number.isNaN(value)) {
6540
6536
  return "";
6541
6537
  }
6542
- const name = stringifyEntities(info.attribute, Object.assign({}, state.settings.characterReferences, { subset: constants.name[x$1][y$2] }));
6538
+ const name = stringifyEntities(info.attribute, Object.assign({}, state.settings.characterReferences, { subset: constants.name[x$2][y$2] }));
6543
6539
  if (value === true) return name;
6544
6540
  value = Array.isArray(value) ? (info.commaSeparated ? stringify$1 : stringify$2)(value, { padLeft: !state.settings.tightCommaSeparatedLists }) : String(value);
6545
6541
  if (state.settings.collapseEmptyAttributes && !value) return name;
6546
6542
  if (state.settings.preferUnquoted) {
6547
6543
  result = stringifyEntities(value, Object.assign({}, state.settings.characterReferences, {
6548
6544
  attribute: true,
6549
- subset: constants.unquoted[x$1][y$2]
6545
+ subset: constants.unquoted[x$2][y$2]
6550
6546
  }));
6551
6547
  }
6552
6548
  if (result !== value) {
@@ -6554,7 +6550,7 @@ function serializeAttribute(state, key$1, value) {
6554
6550
  quote = state.alternative;
6555
6551
  }
6556
6552
  result = quote + stringifyEntities(value, Object.assign({}, state.settings.characterReferences, {
6557
- subset: (quote === "'" ? constants.single : constants.double)[x$1][y$2],
6553
+ subset: (quote === "'" ? constants.single : constants.double)[x$2][y$2],
6558
6554
  attribute: true
6559
6555
  })) + quote;
6560
6556
  }
@@ -6762,7 +6758,8 @@ function all(parent) {
6762
6758
  }
6763
6759
 
6764
6760
  //#endregion
6765
- //#region ../../node_modules/.bun/@shikijs+core@4.0.2/node_modules/@shikijs/core/dist/index.mjs
6761
+ //#region ../../node_modules/.bun/@shikijs+core@4.2.0/node_modules/@shikijs/core/dist/index.mjs
6762
+ const RE_WHITESPACE = /\s+/g;
6766
6763
  /**
6767
6764
  * Utility to append class to a hast node
6768
6765
  *
@@ -6772,12 +6769,16 @@ function addClassToHast(node, className) {
6772
6769
  if (!className) return node;
6773
6770
  node.properties ||= {};
6774
6771
  node.properties.class ||= [];
6775
- if (typeof node.properties.class === "string") node.properties.class = node.properties.class.split(/\s+/g);
6772
+ if (typeof node.properties.class === "string") node.properties.class = node.properties.class.split(RE_WHITESPACE);
6776
6773
  if (!Array.isArray(node.properties.class)) node.properties.class = [];
6777
- const targets = Array.isArray(className) ? className : className.split(/\s+/g);
6774
+ const targets = Array.isArray(className) ? className : className.split(RE_WHITESPACE);
6778
6775
  for (const c of targets) if (c && !node.properties.class.includes(c)) node.properties.class.push(c);
6779
6776
  return node;
6780
6777
  }
6778
+ const RE_LANG_ATTR = /:?lang=["']([^"']+)["']/g;
6779
+ const RE_CODE_FENCE = /(?:```|~~~)([\w-]+)/g;
6780
+ const RE_LATEX_BEGIN = /\\begin\{([\w-]+)\}/g;
6781
+ const RE_SCRIPT_LANG = /<script\s+(?:type|lang)=["']([^"']+)["']/gi;
6781
6782
  /**
6782
6783
  * Creates a converter between index and position in a code block.
6783
6784
  *
@@ -6788,7 +6789,7 @@ function createPositionConverter(code) {
6788
6789
  function indexToPos(index) {
6789
6790
  if (index === code.length) return {
6790
6791
  line: lines.length - 1,
6791
- character: lines[lines.length - 1].length
6792
+ character: lines.at(-1).length
6792
6793
  };
6793
6794
  let character = index;
6794
6795
  let line = 0;
@@ -6835,28 +6836,27 @@ function createPositionConverter(code) {
6835
6836
  */
6836
6837
  function guessEmbeddedLanguages(code, _lang, highlighter$1) {
6837
6838
  const langs = /* @__PURE__ */ new Set();
6838
- for (const match of code.matchAll(/:?lang=["']([^"']+)["']/g)) {
6839
+ for (const match of code.matchAll(RE_LANG_ATTR)) {
6839
6840
  const lang = match[1].toLowerCase().trim();
6840
6841
  if (lang) langs.add(lang);
6841
6842
  }
6842
- for (const match of code.matchAll(/(?:```|~~~)([\w-]+)/g)) {
6843
+ for (const match of code.matchAll(RE_CODE_FENCE)) {
6843
6844
  const lang = match[1].toLowerCase().trim();
6844
6845
  if (lang) langs.add(lang);
6845
6846
  }
6846
- for (const match of code.matchAll(/\\begin\{([\w-]+)\}/g)) {
6847
+ for (const match of code.matchAll(RE_LATEX_BEGIN)) {
6847
6848
  const lang = match[1].toLowerCase().trim();
6848
6849
  if (lang) langs.add(lang);
6849
6850
  }
6850
- for (const match of code.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)) {
6851
+ for (const match of code.matchAll(RE_SCRIPT_LANG)) {
6851
6852
  const fullType = match[1].toLowerCase().trim();
6852
6853
  const lang = fullType.includes("/") ? fullType.split("/").pop() : fullType;
6853
6854
  if (lang) langs.add(lang);
6854
6855
  }
6855
- if (!highlighter$1) return Array.from(langs);
6856
+ if (!highlighter$1) return [...langs];
6856
6857
  const bundle = highlighter$1.getBundledLanguages();
6857
- return Array.from(langs).filter((l$2) => l$2 && bundle[l$2]);
6858
+ return [...langs].filter((l$2) => l$2 && bundle[l$2]);
6858
6859
  }
6859
- const DEFAULT_COLOR_LIGHT_DARK = "light-dark()";
6860
6860
  const COLOR_KEYS = ["color", "background-color"];
6861
6861
  /**
6862
6862
  * Split a token into multiple tokens by given offsets.
@@ -6885,7 +6885,7 @@ function splitToken(token$1, offsets) {
6885
6885
  * Split 2D tokens array by given breakpoints.
6886
6886
  */
6887
6887
  function splitTokens(tokens, breakpoints) {
6888
- const sorted = Array.from(breakpoints instanceof Set ? breakpoints : new Set(breakpoints)).sort((a$1, b$2) => a$1 - b$2);
6888
+ const sorted = [...breakpoints instanceof Set ? breakpoints : new Set(breakpoints)].sort((a$1, b$2) => a$1 - b$2);
6889
6889
  if (!sorted.length) return tokens;
6890
6890
  return tokens.map((line) => {
6891
6891
  return line.flatMap((token$1) => {
@@ -6911,7 +6911,7 @@ function flatTokenVariants(merged, variantsOrder, cssVariablePrefix, defaultColo
6911
6911
  styles.forEach((cur, idx) => {
6912
6912
  for (const key$1 of styleKeys) {
6913
6913
  const value = cur[key$1] || "inherit";
6914
- if (idx === 0 && defaultColor && COLOR_KEYS.includes(key$1)) if (defaultColor === DEFAULT_COLOR_LIGHT_DARK && styles.length > 1) {
6914
+ if (idx === 0 && defaultColor && COLOR_KEYS.includes(key$1)) if (defaultColor === "light-dark()" && styles.length > 1) {
6915
6915
  const lightIndex = variantsOrder.findIndex((t) => t === "light");
6916
6916
  const darkIndex = variantsOrder.findIndex((t) => t === "dark");
6917
6917
  if (lightIndex === -1 || darkIndex === -1) throw new ShikiError$1("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
@@ -6993,7 +6993,7 @@ function transformerDecorations() {
6993
6993
  code(codeEl) {
6994
6994
  if (!this.options.decorations?.length) return;
6995
6995
  const ctx = getContext(this);
6996
- const lines = Array.from(codeEl.children).filter((i$2) => i$2.type === "element" && i$2.tagName === "span");
6996
+ const lines = [...codeEl.children].filter((i$2) => i$2.type === "element" && i$2.tagName === "span");
6997
6997
  if (lines.length !== ctx.converter.lines.length) throw new ShikiError$1(`Number of lines in code element (${lines.length}) does not match the number of lines in the source (${ctx.converter.lines.length}). Failed to apply decorations.`);
6998
6998
  function applyLineSection(line, start, end, decoration) {
6999
6999
  const lineEl = lines[line];
@@ -7153,8 +7153,8 @@ function findSequence(value, position) {
7153
7153
  function parseColor(sequence) {
7154
7154
  const colorMode = sequence.shift();
7155
7155
  if (colorMode === "2") {
7156
- const rgb = sequence.splice(0, 3).map((x$1) => Number.parseInt(x$1));
7157
- if (rgb.length !== 3 || rgb.some((x$1) => Number.isNaN(x$1))) return;
7156
+ const rgb = sequence.splice(0, 3).map((x$2) => Number.parseInt(x$2));
7157
+ if (rgb.length !== 3 || rgb.some((x$2) => Number.isNaN(x$2))) return;
7158
7158
  return {
7159
7159
  type: "rgb",
7160
7160
  rgb
@@ -7302,7 +7302,7 @@ function createColorPalette(namedColorsMap = defaultNamedColorsMap) {
7302
7302
  return namedColorsMap[name];
7303
7303
  }
7304
7304
  function rgbColor(rgb) {
7305
- return `#${rgb.map((x$1) => Math.max(0, Math.min(x$1, 255)).toString(16).padStart(2, "0")).join("")}`;
7305
+ return `#${rgb.map((x$2) => Math.max(0, Math.min(x$2, 255)).toString(16).padStart(2, "0")).join("")}`;
7306
7306
  }
7307
7307
  let colorTable;
7308
7308
  function getColorTable() {
@@ -7342,6 +7342,8 @@ function createColorPalette(namedColorsMap = defaultNamedColorsMap) {
7342
7342
  }
7343
7343
  return { value };
7344
7344
  }
7345
+ const RE_HEX_COLOR = /#([0-9a-f]{3,8})/i;
7346
+ const RE_CSS_VAR_ANSI = /var\((--[\w-]+-ansi-[\w-]+)\)/;
7345
7347
  /**
7346
7348
  * Default ANSI palette (VSCode compatible fallbacks)
7347
7349
  * Used when the theme does not define terminal.ansi* colors.
@@ -7403,7 +7405,7 @@ function tokenizeAnsiWithTheme(theme, fileContents, options) {
7403
7405
  * Adds 50% alpha to a hex color string or the "-dim" postfix to a CSS variable
7404
7406
  */
7405
7407
  function dimColor(color) {
7406
- const hexMatch = color.match(/#([0-9a-f]{3,8})/i);
7408
+ const hexMatch = color.match(RE_HEX_COLOR);
7407
7409
  if (hexMatch) {
7408
7410
  const hex = hexMatch[1];
7409
7411
  if (hex.length === 8) {
@@ -7423,7 +7425,7 @@ function dimColor(color) {
7423
7425
  return `#${r$3}${r$3}${g}${g}${b$2}${b$2}80`;
7424
7426
  }
7425
7427
  }
7426
- const cssVarMatch = color.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);
7428
+ const cssVarMatch = color.match(RE_CSS_VAR_ANSI);
7427
7429
  if (cssVarMatch) return `var(${cssVarMatch[1]}-dim)`;
7428
7430
  return color;
7429
7431
  }
@@ -7461,7 +7463,7 @@ function codeToTokens(primitive, code, options) {
7461
7463
  if (themes.length === 0) throw new ShikiError$1("`themes` option must not be empty");
7462
7464
  const themeTokens = codeToTokensWithThemes(primitive, code, options, codeToTokensBase$1);
7463
7465
  grammarState = getLastGrammarStateFromMap(themeTokens);
7464
- if (defaultColor && DEFAULT_COLOR_LIGHT_DARK !== defaultColor && !themes.find((t) => t.color === defaultColor)) throw new ShikiError$1(`\`themes\` option must contain the defaultColor key \`${defaultColor}\``);
7466
+ if (defaultColor && "light-dark()" !== defaultColor && !themes.some((t) => t.color === defaultColor)) throw new ShikiError$1(`\`themes\` option must contain the defaultColor key \`${defaultColor}\``);
7465
7467
  const themeRegs = themes.map((t) => primitive.getTheme(t.theme));
7466
7468
  const themesOrder = themes.map((t) => t.color);
7467
7469
  tokens = themeTokens.map((line) => line.map((token$1) => flatTokenVariants(token$1, themesOrder, cssVariablePrefix, defaultColor, colorsRendering)));
@@ -7494,7 +7496,7 @@ function mapThemeColors(themes, themeRegs, themeColorReplacements, cssVariablePr
7494
7496
  const value = applyColorReplacements(themeRegs[idx][property], themeColorReplacements[idx]) || "inherit";
7495
7497
  const cssVar = `${cssVariablePrefix + t.color}${property === "bg" ? "-bg" : ""}:${value}`;
7496
7498
  if (idx === 0 && defaultColor) {
7497
- if (defaultColor === DEFAULT_COLOR_LIGHT_DARK && themes.length > 1) {
7499
+ if (defaultColor === "light-dark()" && themes.length > 1) {
7498
7500
  const lightIndex = themes.findIndex((t$1) => t$1.color === "light");
7499
7501
  const darkIndex = themes.findIndex((t$1) => t$1.color === "dark");
7500
7502
  if (lightIndex === -1 || darkIndex === -1) throw new ShikiError$1("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
@@ -7506,6 +7508,8 @@ function mapThemeColors(themes, themeRegs, themeColorReplacements, cssVariablePr
7506
7508
  return null;
7507
7509
  }).filter((i$2) => !!i$2).join(";");
7508
7510
  }
7511
+ const RE_WHITESPACE_ONLY = /^\s+$/;
7512
+ const RE_LEADING_TRAILING_WHITESPACE = /^(\s*)(.*?)(\s*)$/;
7509
7513
  function codeToHast(primitive, code, options, transformerContext = {
7510
7514
  meta: {},
7511
7515
  options,
@@ -7684,7 +7688,7 @@ function mergeWhitespaceTokens(tokens) {
7684
7688
  let firstOffset;
7685
7689
  line.forEach((token$1, idx) => {
7686
7690
  const couldMerge = !(token$1.fontStyle && (token$1.fontStyle & FontStyle.Underline || token$1.fontStyle & FontStyle.Strikethrough));
7687
- if (couldMerge && token$1.content.match(/^\s+$/) && line[idx + 1]) {
7691
+ if (couldMerge && RE_WHITESPACE_ONLY.test(token$1.content) && line[idx + 1]) {
7688
7692
  if (firstOffset === void 0) firstOffset = token$1.offset;
7689
7693
  carryOnContent += token$1.content;
7690
7694
  } else if (carryOnContent) {
@@ -7707,8 +7711,8 @@ function mergeWhitespaceTokens(tokens) {
7707
7711
  function splitWhitespaceTokens(tokens) {
7708
7712
  return tokens.map((line) => {
7709
7713
  return line.flatMap((token$1) => {
7710
- if (token$1.content.match(/^\s+$/)) return token$1;
7711
- const match = token$1.content.match(/^(\s*)(.*?)(\s*)$/);
7714
+ if (RE_WHITESPACE_ONLY.test(token$1.content)) return token$1;
7715
+ const match = token$1.content.match(RE_LEADING_TRAILING_WHITESPACE);
7712
7716
  if (!match) return token$1;
7713
7717
  const [, leading, content, trailing] = match;
7714
7718
  if (!leading && !trailing) return token$1;
@@ -7737,7 +7741,7 @@ function mergeAdjacentStyledTokens(tokens) {
7737
7741
  newLine.push({ ...token$1 });
7738
7742
  continue;
7739
7743
  }
7740
- const prevToken = newLine[newLine.length - 1];
7744
+ const prevToken = newLine.at(-1);
7741
7745
  const prevStyle = stringifyTokenStyle(prevToken.htmlStyle || getTokenStyleObject(prevToken));
7742
7746
  const currentStyle = stringifyTokenStyle(token$1.htmlStyle || getTokenStyleObject(token$1));
7743
7747
  const isPrevDecorated = prevToken.fontStyle && (prevToken.fontStyle & FontStyle.Underline || prevToken.fontStyle & FontStyle.Strikethrough);
@@ -8129,18 +8133,20 @@ function createCssVariablesTheme(options = {}) {
8129
8133
  }
8130
8134
 
8131
8135
  //#endregion
8132
- //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.0.2/node_modules/@shikijs/engine-javascript/dist/scanner-BFcBmQR1.mjs
8136
+ //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.2.0/node_modules/@shikijs/engine-javascript/dist/scanner-DX8LRFGE.mjs
8133
8137
  const MAX = 4294967295;
8134
8138
  var JavaScriptScanner = class {
8139
+ patterns;
8140
+ options;
8135
8141
  regexps;
8136
8142
  constructor(patterns, options = {}) {
8137
8143
  this.patterns = patterns;
8138
8144
  this.options = options;
8139
- const { forgiving = false, cache, regexConstructor } = options;
8145
+ const { forgiving = false, cache: cache$1, regexConstructor } = options;
8140
8146
  if (!regexConstructor) throw new Error("Option `regexConstructor` is not provided");
8141
8147
  this.regexps = patterns.map((p$1) => {
8142
8148
  if (typeof p$1 !== "string") return p$1;
8143
- const cached = cache?.get(p$1);
8149
+ const cached = cache$1?.get(p$1);
8144
8150
  if (cached) {
8145
8151
  if (cached instanceof RegExp) return cached;
8146
8152
  if (forgiving) return null;
@@ -8148,10 +8154,10 @@ var JavaScriptScanner = class {
8148
8154
  }
8149
8155
  try {
8150
8156
  const regex = regexConstructor(p$1);
8151
- cache?.set(p$1, regex);
8157
+ cache$1?.set(p$1, regex);
8152
8158
  return regex;
8153
8159
  } catch (e) {
8154
- cache?.set(p$1, e);
8160
+ cache$1?.set(p$1, e);
8155
8161
  if (forgiving) return null;
8156
8162
  throw e;
8157
8163
  }
@@ -8204,7 +8210,7 @@ var JavaScriptScanner = class {
8204
8210
  };
8205
8211
 
8206
8212
  //#endregion
8207
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/utils.js
8213
+ //#region ../../node_modules/.bun/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/utils.js
8208
8214
  function r$2(e) {
8209
8215
  if ([...e].length !== 1) throw new Error(`Expected "${e}" to be a single code point`);
8210
8216
  return e.codePointAt(0);
@@ -8234,7 +8240,7 @@ function u(e, t) {
8234
8240
  }
8235
8241
 
8236
8242
  //#endregion
8237
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/tokenizer/tokenize.js
8243
+ //#region ../../node_modules/.bun/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/tokenizer/tokenize.js
8238
8244
  const m$1 = o$1`\[\^?`, b$1 = `c.? | C(?:-.?)?|${o$1`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${o$1`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${o$1`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${o$1`o\{[^\}]*\}?`}|${o$1`\d{1,3}`}`, y$1 = /[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/, C$1 = new RegExp(o$1`
8239
8245
  \\ (?:
8240
8246
  ${b$1}
@@ -8336,7 +8342,7 @@ function F$1(e, n, t, o$2) {
8336
8342
  if (a$1 === "N" || a$1 === "R") return { token: k$1("newline", t, { negate: a$1 === "N" }) };
8337
8343
  if (a$1 === "O") return { token: k$1("any", t) };
8338
8344
  if (a$1 === "X") return { token: k$1("text_segment", t) };
8339
- const r$3 = x(t, { inCharClass: !1 });
8345
+ const r$3 = x$1(t, { inCharClass: !1 });
8340
8346
  return Array.isArray(r$3) ? { tokens: r$3 } : { token: r$3 };
8341
8347
  }
8342
8348
  if (s$1 === "(") {
@@ -8347,13 +8353,13 @@ function F$1(e, n, t, o$2) {
8347
8353
  return { lastIndex: o$2 + 1 };
8348
8354
  }
8349
8355
  if (/^\(\?[-imx]+[:)]$/.test(t)) return { token: L$1(t, e) };
8350
- if (e.pushModX(e.getCurrentModX()), e.numOpenGroups++, t === "(" && !e.captureGroup || t === "(?:") return { token: f$1("group", t) };
8351
- if (t === "(?>") return { token: f$1("atomic", t) };
8352
- if (t === "(?=" || t === "(?!" || t === "(?<=" || t === "(?<!") return { token: f$1(t[2] === "<" ? "lookbehind" : "lookahead", t, { negate: t.endsWith("!") }) };
8353
- if (t === "(" && e.captureGroup || t.startsWith("(?<") && t.endsWith(">") || t.startsWith("(?'") && t.endsWith("'")) return { token: f$1("capturing", t, { ...t !== "(" && { name: t.slice(3, -1) } }) };
8356
+ if (e.pushModX(e.getCurrentModX()), e.numOpenGroups++, t === "(" && !e.captureGroup || t === "(?:") return { token: f("group", t) };
8357
+ if (t === "(?>") return { token: f("atomic", t) };
8358
+ if (t === "(?=" || t === "(?!" || t === "(?<=" || t === "(?<!") return { token: f(t[2] === "<" ? "lookbehind" : "lookahead", t, { negate: t.endsWith("!") }) };
8359
+ if (t === "(" && e.captureGroup || t.startsWith("(?<") && t.endsWith(">") || t.startsWith("(?'") && t.endsWith("'")) return { token: f("capturing", t, { ...t !== "(" && { name: t.slice(3, -1) } }) };
8354
8360
  if (t.startsWith("(?~")) {
8355
8361
  if (t === "(?~|") throw new Error(`Unsupported absence function kind "${t}"`);
8356
- return { token: f$1("absence_repeater", t) };
8362
+ return { token: f("absence_repeater", t) };
8357
8363
  }
8358
8364
  throw t === "(?(" ? new Error(`Unsupported conditional "${t}"`) : new Error(`Invalid or unsupported group option "${t}"`);
8359
8365
  }
@@ -8402,7 +8408,7 @@ function K$1(e, n, t) {
8402
8408
  };
8403
8409
  }
8404
8410
  function X$1(e) {
8405
- if (e[0] === "\\") return x(e, { inCharClass: !0 });
8411
+ if (e[0] === "\\") return x$1(e, { inCharClass: !0 });
8406
8412
  if (e[0] === "[") {
8407
8413
  const n = /\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);
8408
8414
  if (!n || !i.has(n.groups.name)) throw new Error(`Invalid POSIX class "${e}"`);
@@ -8413,7 +8419,7 @@ function X$1(e) {
8413
8419
  }
8414
8420
  return e === "-" ? U$1(e) : e === "&&" ? H(e) : d(r$2(e), e);
8415
8421
  }
8416
- function x(e, { inCharClass: n }) {
8422
+ function x$1(e, { inCharClass: n }) {
8417
8423
  const t = e[1];
8418
8424
  if (t === "c" || t === "C") return Z(e);
8419
8425
  if ("dDhHsSwW".includes(t)) return q(e);
@@ -8526,7 +8532,7 @@ function Q$1(e) {
8526
8532
  raw: e
8527
8533
  };
8528
8534
  }
8529
- function f$1(e, n, t = {}) {
8535
+ function f(e, n, t = {}) {
8530
8536
  return {
8531
8537
  type: "GroupOpen",
8532
8538
  kind: e,
@@ -8587,7 +8593,7 @@ function L$1(e, n) {
8587
8593
  o$2 ??= "";
8588
8594
  const s$1 = (n.getCurrentModX() || t.includes("x")) && !o$2.includes("x"), a$1 = v(t), r$3 = v(o$2), i$2 = {};
8589
8595
  if (a$1 && (i$2.enable = a$1), r$3 && (i$2.disable = r$3), e.endsWith(")")) return n.replaceCurrentModX(s$1), I$1("flags", e, { flags: i$2 });
8590
- if (e.endsWith(":")) return n.pushModX(s$1), n.numOpenGroups++, f$1("group", e, { ...(a$1 || r$3) && { flags: i$2 } });
8596
+ if (e.endsWith(":")) return n.pushModX(s$1), n.numOpenGroups++, f("group", e, { ...(a$1 || r$3) && { flags: i$2 } });
8591
8597
  throw new Error(`Unexpected flag modifier "${e}"`);
8592
8598
  }
8593
8599
  function j(e) {
@@ -8731,7 +8737,7 @@ function te$1(e) {
8731
8737
  }
8732
8738
 
8733
8739
  //#endregion
8734
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/parser/node-utils.js
8740
+ //#region ../../node_modules/.bun/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/parser/node-utils.js
8735
8741
  function o(e, t) {
8736
8742
  if (!Array.isArray(e.body)) throw new Error("Expected node with body array");
8737
8743
  if (e.body.length !== 1) return !1;
@@ -8764,7 +8770,7 @@ const y = new Set([
8764
8770
  ]);
8765
8771
 
8766
8772
  //#endregion
8767
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/parser/parse.js
8773
+ //#region ../../node_modules/.bun/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/parser/parse.js
8768
8774
  function J(e, r$3 = {}) {
8769
8775
  const n = {
8770
8776
  flags: "",
@@ -8779,30 +8785,30 @@ function J(e, r$3 = {}) {
8779
8785
  singleline: !1,
8780
8786
  ...r$3.rules
8781
8787
  }
8782
- }, t = M(e, {
8788
+ }, o$2 = M(e, {
8783
8789
  flags: n.flags,
8784
8790
  rules: {
8785
8791
  captureGroup: n.rules.captureGroup,
8786
8792
  singleline: n.rules.singleline
8787
8793
  }
8788
- }), s$1 = (p$1, N) => {
8789
- const u$1 = t.tokens[o$2.nextIndex];
8790
- switch (o$2.parent = p$1, o$2.nextIndex++, u$1.type) {
8794
+ }), i$2 = (p$1, N) => {
8795
+ const u$1 = o$2.tokens[t.nextIndex];
8796
+ switch (t.parent = p$1, t.nextIndex++, u$1.type) {
8791
8797
  case "Alternator": return b();
8792
8798
  case "Assertion": return W(u$1);
8793
- case "Backreference": return X(u$1, o$2);
8799
+ case "Backreference": return X(u$1, t);
8794
8800
  case "Character": return m(u$1.value, { useLastValid: !!N.isCheckingRangeEnd });
8795
- case "CharacterClassHyphen": return ee(u$1, o$2, N);
8796
- case "CharacterClassOpen": return re(u$1, o$2, N);
8797
- case "CharacterSet": return ne(u$1, o$2);
8801
+ case "CharacterClassHyphen": return ee(u$1, t, N);
8802
+ case "CharacterClassOpen": return re(u$1, t, N);
8803
+ case "CharacterSet": return ne(u$1, t);
8798
8804
  case "Directive": return I(u$1.kind, { flags: u$1.flags });
8799
- case "GroupOpen": return te(u$1, o$2, N);
8805
+ case "GroupOpen": return te(u$1, t, N);
8800
8806
  case "NamedCallout": return U(u$1.kind, u$1.tag, u$1.arguments);
8801
- case "Quantifier": return oe(u$1, o$2);
8802
- case "Subroutine": return ae(u$1, o$2);
8807
+ case "Quantifier": return oe(u$1, t);
8808
+ case "Subroutine": return ae(u$1, t);
8803
8809
  default: throw new Error(`Unexpected token type "${u$1.type}"`);
8804
8810
  }
8805
- }, o$2 = {
8811
+ }, t = {
8806
8812
  capturingGroups: [],
8807
8813
  hasNumberedRef: !1,
8808
8814
  namedGroupsByName: new Map(),
@@ -8813,25 +8819,25 @@ function J(e, r$3 = {}) {
8813
8819
  skipLookbehindValidation: n.skipLookbehindValidation,
8814
8820
  skipPropertyNameValidation: n.skipPropertyNameValidation,
8815
8821
  subroutines: [],
8816
- tokens: t.tokens,
8822
+ tokens: o$2.tokens,
8817
8823
  unicodePropertyMap: n.unicodePropertyMap,
8818
- walk: s$1
8819
- }, i$2 = B(T(t.flags));
8820
- let d$1 = i$2.body[0];
8821
- for (; o$2.nextIndex < t.tokens.length;) {
8822
- const p$1 = s$1(d$1, {});
8823
- p$1.type === "Alternative" ? (i$2.body.push(p$1), d$1 = p$1) : d$1.body.push(p$1);
8824
- }
8825
- const { capturingGroups: a$1, hasNumberedRef: l$2, namedGroupsByName: c, subroutines: f$2 } = o$2;
8824
+ walk: i$2
8825
+ }, d$1 = B(T(o$2.flags));
8826
+ let s$1 = d$1.body[0];
8827
+ for (; t.nextIndex < o$2.tokens.length;) {
8828
+ const p$1 = i$2(s$1, {});
8829
+ p$1.type === "Alternative" ? (d$1.body.push(p$1), s$1 = p$1) : s$1.body.push(p$1);
8830
+ }
8831
+ const { capturingGroups: a$1, hasNumberedRef: l$2, namedGroupsByName: c, subroutines: f$1 } = t;
8826
8832
  if (l$2 && c.size && !n.rules.captureGroup) throw new Error("Numbered backref/subroutine not allowed when using named capture");
8827
- for (const { ref: p$1 } of f$2) if (typeof p$1 == "number") {
8833
+ for (const { ref: p$1 } of f$1) if (typeof p$1 == "number") {
8828
8834
  if (p$1 > a$1.length) throw new Error("Subroutine uses a group number that's not defined");
8829
8835
  p$1 && (a$1[p$1 - 1].isSubroutined = !0);
8830
8836
  } else if (c.has(p$1)) {
8831
8837
  if (c.get(p$1).length > 1) throw new Error(o$1`Subroutine uses a duplicate group name "\g<${p$1}>"`);
8832
8838
  c.get(p$1)[0].isSubroutined = !0;
8833
8839
  } else throw new Error(o$1`Subroutine uses a group name that's not defined "\g<${p$1}>"`);
8834
- return i$2;
8840
+ return d$1;
8835
8841
  }
8836
8842
  function W({ kind: e }) {
8837
8843
  return F(u({
@@ -8848,106 +8854,106 @@ function W({ kind: e }) {
8848
8854
  }[e], `Unexpected assertion kind "${e}"`), { negate: e === o$1`\B` || e === o$1`\Y` });
8849
8855
  }
8850
8856
  function X({ raw: e }, r$3) {
8851
- const n = /^\\k[<']/.test(e), t = n ? e.slice(3, -1) : e.slice(1), s$1 = (o$2, i$2 = !1) => {
8852
- const d$1 = r$3.capturingGroups.length;
8857
+ const n = /^\\k[<']/.test(e), o$2 = n ? e.slice(3, -1) : e.slice(1), i$2 = (t, d$1 = !1) => {
8858
+ const s$1 = r$3.capturingGroups.length;
8853
8859
  let a$1 = !1;
8854
- if (o$2 > d$1) if (r$3.skipBackrefValidation) a$1 = !0;
8860
+ if (t > s$1) if (r$3.skipBackrefValidation) a$1 = !0;
8855
8861
  else throw new Error(`Not enough capturing groups defined to the left "${e}"`);
8856
- return r$3.hasNumberedRef = !0, k(i$2 ? d$1 + 1 - o$2 : o$2, { orphan: a$1 });
8862
+ return r$3.hasNumberedRef = !0, k(d$1 ? s$1 + 1 - t : t, { orphan: a$1 });
8857
8863
  };
8858
8864
  if (n) {
8859
- const o$2 = /^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(t);
8860
- if (o$2) return s$1(+o$2.groups.num, !!o$2.groups.sign);
8861
- if (/[-+]/.test(t)) throw new Error(`Invalid backref name "${e}"`);
8862
- if (!r$3.namedGroupsByName.has(t)) throw new Error(`Group name not defined to the left "${e}"`);
8863
- return k(t);
8865
+ const t = /^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(o$2);
8866
+ if (t) return i$2(+t.groups.num, !!t.groups.sign);
8867
+ if (/[-+]/.test(o$2)) throw new Error(`Invalid backref name "${e}"`);
8868
+ if (!r$3.namedGroupsByName.has(o$2)) throw new Error(`Group name not defined to the left "${e}"`);
8869
+ return k(o$2);
8864
8870
  }
8865
- return s$1(+t);
8871
+ return i$2(+o$2);
8866
8872
  }
8867
8873
  function ee(e, r$3, n) {
8868
- const { tokens: t, walk: s$1 } = r$3, o$2 = r$3.parent, i$2 = o$2.body.at(-1), d$1 = t[r$3.nextIndex];
8869
- if (!n.isCheckingRangeEnd && i$2 && i$2.type !== "CharacterClass" && i$2.type !== "CharacterClassRange" && d$1 && d$1.type !== "CharacterClassOpen" && d$1.type !== "CharacterClassClose" && d$1.type !== "CharacterClassIntersector") {
8870
- const a$1 = s$1(o$2, {
8874
+ const { tokens: o$2, walk: i$2 } = r$3, t = r$3.parent, d$1 = t.body.at(-1), s$1 = o$2[r$3.nextIndex];
8875
+ if (!n.isCheckingRangeEnd && d$1 && d$1.type !== "CharacterClass" && d$1.type !== "CharacterClassRange" && s$1 && s$1.type !== "CharacterClassOpen" && s$1.type !== "CharacterClassClose" && s$1.type !== "CharacterClassIntersector") {
8876
+ const a$1 = i$2(t, {
8871
8877
  ...n,
8872
8878
  isCheckingRangeEnd: !0
8873
8879
  });
8874
- if (i$2.type === "Character" && a$1.type === "Character") return o$2.body.pop(), L(i$2, a$1);
8880
+ if (d$1.type === "Character" && a$1.type === "Character") return t.body.pop(), L(d$1, a$1);
8875
8881
  throw new Error("Invalid character class range");
8876
8882
  }
8877
8883
  return m(r$2("-"));
8878
8884
  }
8879
8885
  function re({ negate: e }, r$3, n) {
8880
- const { tokens: t, walk: s$1 } = r$3, o$2 = t[r$3.nextIndex], i$2 = [C()];
8881
- let d$1 = z(o$2);
8882
- for (; d$1.type !== "CharacterClassClose";) {
8883
- if (d$1.type === "CharacterClassIntersector") i$2.push(C()), r$3.nextIndex++;
8886
+ const { tokens: o$2, walk: i$2 } = r$3, t = [C()], d$1 = o$2[r$3.nextIndex];
8887
+ let s$1 = z(d$1);
8888
+ for (; s$1.type !== "CharacterClassClose";) {
8889
+ if (s$1.type === "CharacterClassIntersector") t.push(C()), r$3.nextIndex++;
8884
8890
  else {
8885
- const l$2 = i$2.at(-1);
8886
- l$2.body.push(s$1(l$2, n));
8891
+ const l$2 = t.at(-1);
8892
+ l$2.body.push(i$2(l$2, n));
8887
8893
  }
8888
- d$1 = z(t[r$3.nextIndex], o$2);
8894
+ s$1 = z(o$2[r$3.nextIndex], d$1);
8889
8895
  }
8890
8896
  const a$1 = C({ negate: e });
8891
- return i$2.length === 1 ? a$1.body = i$2[0].body : (a$1.kind = "intersection", a$1.body = i$2.map((l$2) => l$2.body.length === 1 ? l$2.body[0] : l$2)), r$3.nextIndex++, a$1;
8897
+ return t.length === 1 ? a$1.body = t[0].body : (a$1.kind = "intersection", a$1.body = t.map((l$2) => l$2.body.length === 1 ? l$2.body[0] : l$2)), r$3.nextIndex++, a$1;
8892
8898
  }
8893
- function ne({ kind: e, negate: r$3, value: n }, t) {
8894
- const { normalizeUnknownPropertyNames: s$1, skipPropertyNameValidation: o$2, unicodePropertyMap: i$2 } = t;
8899
+ function ne({ kind: e, negate: r$3, value: n }, o$2) {
8900
+ const { normalizeUnknownPropertyNames: i$2, skipPropertyNameValidation: t, unicodePropertyMap: d$1 } = o$2;
8895
8901
  if (e === "property") {
8896
- const d$1 = w(n);
8897
- if (i.has(d$1) && !i$2?.has(d$1)) e = "posix", n = d$1;
8902
+ const s$1 = w(n);
8903
+ if (i.has(s$1) && !d$1?.has(s$1)) e = "posix", n = s$1;
8898
8904
  else return Q(n, {
8899
8905
  negate: r$3,
8900
- normalizeUnknownPropertyNames: s$1,
8901
- skipPropertyNameValidation: o$2,
8902
- unicodePropertyMap: i$2
8906
+ normalizeUnknownPropertyNames: i$2,
8907
+ skipPropertyNameValidation: t,
8908
+ unicodePropertyMap: d$1
8903
8909
  });
8904
8910
  }
8905
8911
  return e === "posix" ? R(n, { negate: r$3 }) : E(e, { negate: r$3 });
8906
8912
  }
8907
8913
  function te(e, r$3, n) {
8908
- const { tokens: t, capturingGroups: s$1, namedGroupsByName: o$2, skipLookbehindValidation: i$2, walk: d$1 } = r$3, a$1 = ie(e), l$2 = a$1.type === "AbsenceFunction", c = $(a$1), f$2 = c && a$1.negate;
8909
- if (a$1.type === "CapturingGroup" && (s$1.push(a$1), a$1.name && l$1(o$2, a$1.name, []).push(a$1)), l$2 && n.isInAbsenceFunction) throw new Error("Nested absence function not supported by Oniguruma");
8910
- let p$1 = D(t[r$3.nextIndex]);
8914
+ const { tokens: o$2, capturingGroups: i$2, namedGroupsByName: t, skipLookbehindValidation: d$1, walk: s$1 } = r$3, a$1 = ie(e), l$2 = a$1.type === "AbsenceFunction", c = $(a$1), f$1 = c && a$1.negate;
8915
+ if (a$1.type === "CapturingGroup" && (i$2.push(a$1), a$1.name && l$1(t, a$1.name, []).push(a$1)), l$2 && n.isInAbsenceFunction) throw new Error("Nested absence function not supported by Oniguruma");
8916
+ let p$1 = D(o$2[r$3.nextIndex]);
8911
8917
  for (; p$1.type !== "GroupClose";) {
8912
8918
  if (p$1.type === "Alternator") a$1.body.push(b()), r$3.nextIndex++;
8913
8919
  else {
8914
- const N = a$1.body.at(-1), u$1 = d$1(N, {
8920
+ const N = a$1.body.at(-1), u$1 = s$1(N, {
8915
8921
  ...n,
8916
8922
  isInAbsenceFunction: n.isInAbsenceFunction || l$2,
8917
8923
  isInLookbehind: n.isInLookbehind || c,
8918
- isInNegLookbehind: n.isInNegLookbehind || f$2
8924
+ isInNegLookbehind: n.isInNegLookbehind || f$1
8919
8925
  });
8920
- if (N.body.push(u$1), (c || n.isInLookbehind) && !i$2) {
8926
+ if (N.body.push(u$1), (c || n.isInLookbehind) && !d$1) {
8921
8927
  const v$1 = "Lookbehind includes a pattern not allowed by Oniguruma";
8922
- if (f$2 || n.isInNegLookbehind) {
8928
+ if (f$1 || n.isInNegLookbehind) {
8923
8929
  if (M$1(u$1) || u$1.type === "CapturingGroup") throw new Error(v$1);
8924
8930
  } else if (M$1(u$1) || $(u$1) && u$1.negate) throw new Error(v$1);
8925
8931
  }
8926
8932
  }
8927
- p$1 = D(t[r$3.nextIndex]);
8933
+ p$1 = D(o$2[r$3.nextIndex]);
8928
8934
  }
8929
8935
  return r$3.nextIndex++, a$1;
8930
8936
  }
8931
- function oe({ kind: e, min: r$3, max: n }, t) {
8932
- const s$1 = t.parent, o$2 = s$1.body.at(-1);
8933
- if (!o$2 || !s(o$2)) throw new Error("Quantifier requires a repeatable token");
8934
- const i$2 = _(e, r$3, n, o$2);
8935
- return s$1.body.pop(), i$2;
8937
+ function oe({ kind: e, min: r$3, max: n }, o$2) {
8938
+ const i$2 = o$2.parent, t = i$2.body.at(-1);
8939
+ if (!t || !s(t)) throw new Error("Quantifier requires a repeatable token");
8940
+ const d$1 = _(e, r$3, n, t);
8941
+ return i$2.body.pop(), d$1;
8936
8942
  }
8937
8943
  function ae({ raw: e }, r$3) {
8938
- const { capturingGroups: n, subroutines: t } = r$3;
8939
- let s$1 = e.slice(3, -1);
8940
- const o$2 = /^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s$1);
8941
- if (o$2) {
8942
- const d$1 = +o$2.groups.num, a$1 = n.length;
8943
- if (r$3.hasNumberedRef = !0, s$1 = {
8944
- "": d$1,
8945
- "+": a$1 + d$1,
8946
- "-": a$1 + 1 - d$1
8947
- }[o$2.groups.sign], s$1 < 1) throw new Error("Invalid subroutine number");
8948
- } else s$1 === "0" && (s$1 = 0);
8949
- const i$2 = O(s$1);
8950
- return t.push(i$2), i$2;
8944
+ const { capturingGroups: n, subroutines: o$2 } = r$3;
8945
+ let i$2 = e.slice(3, -1);
8946
+ const t = /^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i$2);
8947
+ if (t) {
8948
+ const s$1 = +t.groups.num, a$1 = n.length;
8949
+ if (r$3.hasNumberedRef = !0, i$2 = {
8950
+ "": s$1,
8951
+ "+": a$1 + s$1,
8952
+ "-": a$1 + 1 - s$1
8953
+ }[t.groups.sign], i$2 < 1) throw new Error("Invalid subroutine number");
8954
+ } else i$2 === "0" && (i$2 = 0);
8955
+ const d$1 = O(i$2);
8956
+ return o$2.push(d$1), d$1;
8951
8957
  }
8952
8958
  function G(e, r$3) {
8953
8959
  if (e !== "repeater") throw new Error(`Unexpected absence function kind "${e}"`);
@@ -8999,9 +9005,9 @@ function m(e, r$3) {
8999
9005
  ...r$3
9000
9006
  };
9001
9007
  if (e > 1114111) {
9002
- const t = e.toString(16);
9008
+ const o$2 = e.toString(16);
9003
9009
  if (n.useLastValid) e = 1114111;
9004
- else throw e > 1310719 ? new Error(`Invalid code point out of range "\\x{${t}}"`) : new Error(`Invalid code point out of range in JS "\\x{${t}}"`);
9010
+ else throw e > 1310719 ? new Error(`Invalid code point out of range "\\x{${o$2}}"`) : new Error(`Invalid code point out of range in JS "\\x{${o$2}}"`);
9005
9011
  }
9006
9012
  return {
9007
9013
  type: "Character",
@@ -9030,11 +9036,11 @@ function L(e, r$3) {
9030
9036
  };
9031
9037
  }
9032
9038
  function E(e, r$3) {
9033
- const n = !!r$3?.negate, t = {
9039
+ const n = !!r$3?.negate, o$2 = {
9034
9040
  type: "CharacterSet",
9035
9041
  kind: e
9036
9042
  };
9037
- return (e === "digit" || e === "hex" || e === "newline" || e === "space" || e === "word") && (t.negate = n), (e === "text_segment" || e === "newline" && !n) && (t.variableLength = !0), t;
9043
+ return (e === "digit" || e === "hex" || e === "newline" || e === "space" || e === "word") && (o$2.negate = n), (e === "text_segment" || e === "newline" && !n) && (o$2.variableLength = !0), o$2;
9038
9044
  }
9039
9045
  function I(e, r$3 = {}) {
9040
9046
  if (e === "keep") return {
@@ -9095,14 +9101,14 @@ function R(e, r$3) {
9095
9101
  negate: n
9096
9102
  };
9097
9103
  }
9098
- function _(e, r$3, n, t) {
9104
+ function _(e, r$3, n, o$2) {
9099
9105
  if (r$3 > n) throw new Error("Invalid reversed quantifier range");
9100
9106
  return {
9101
9107
  type: "Quantifier",
9102
9108
  kind: e,
9103
9109
  min: r$3,
9104
9110
  max: n,
9105
- body: t
9111
+ body: o$2
9106
9112
  };
9107
9113
  }
9108
9114
  function B(e, r$3) {
@@ -9126,28 +9132,28 @@ function Q(e, r$3) {
9126
9132
  unicodePropertyMap: null,
9127
9133
  ...r$3
9128
9134
  };
9129
- let t = n.unicodePropertyMap?.get(w(e));
9130
- if (!t) {
9131
- if (n.normalizeUnknownPropertyNames) t = de(e);
9135
+ let o$2 = n.unicodePropertyMap?.get(w(e));
9136
+ if (!o$2) {
9137
+ if (n.normalizeUnknownPropertyNames) o$2 = de(e);
9132
9138
  else if (n.unicodePropertyMap && !n.skipPropertyNameValidation) throw new Error(o$1`Invalid Unicode property "\p{${e}}"`);
9133
9139
  }
9134
9140
  return {
9135
9141
  type: "CharacterSet",
9136
9142
  kind: "property",
9137
- value: t ?? e,
9143
+ value: o$2 ?? e,
9138
9144
  negate: n.negate
9139
9145
  };
9140
9146
  }
9141
- function ie({ flags: e, kind: r$3, name: n, negate: t, number: s$1 }) {
9147
+ function ie({ flags: e, kind: r$3, name: n, negate: o$2, number: i$2 }) {
9142
9148
  switch (r$3) {
9143
9149
  case "absence_repeater": return G("repeater");
9144
9150
  case "atomic": return A({ atomic: !0 });
9145
- case "capturing": return P(s$1, { name: n });
9151
+ case "capturing": return P(i$2, { name: n });
9146
9152
  case "group": return A({ flags: e });
9147
9153
  case "lookahead":
9148
9154
  case "lookbehind": return K({
9149
9155
  behind: r$3 === "lookbehind",
9150
- negate: t
9156
+ negate: o$2
9151
9157
  });
9152
9158
  default: throw new Error(`Unexpected group kind "${r$3}"`);
9153
9159
  }
@@ -9178,16 +9184,17 @@ function w(e) {
9178
9184
  return e.replace(/[- _]+/g, "").toLowerCase();
9179
9185
  }
9180
9186
  function z(e, r$3) {
9181
- return u(e, `${r$3?.type === "Character" && r$3.value === 93 ? "Empty" : "Unclosed"} character class`);
9187
+ const n = r$3;
9188
+ return u(e, `Unclosed character class${n?.type === "Character" && n.value === 93 && n.raw === "]" ? " (started with \"]\")" : ""}`);
9182
9189
  }
9183
9190
  function D(e) {
9184
9191
  return u(e, "Unclosed group");
9185
9192
  }
9186
9193
 
9187
9194
  //#endregion
9188
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/traverser/traverse.js
9195
+ //#region ../../node_modules/.bun/oniguruma-parser@0.12.2/node_modules/oniguruma-parser/dist/traverser/traverse.js
9189
9196
  function S(a$1, v$1, N = null) {
9190
- function u$1(e, s$1) {
9197
+ function b$2(e, s$1) {
9191
9198
  for (let t = 0; t < e.length; t++) {
9192
9199
  const r$3 = n(e[t], s$1, t, e);
9193
9200
  t = Math.max(-1, t + r$3);
@@ -9202,40 +9209,39 @@ function S(a$1, v$1, N = null) {
9202
9209
  container: r$3,
9203
9210
  root: a$1,
9204
9211
  remove() {
9205
- f(r$3).splice(Math.max(0, l(t) + i$2), 1), i$2--, c = !0;
9212
+ x(r$3).splice(Math.max(0, l(t) + i$2), 1), i$2--, c = !0;
9206
9213
  },
9207
9214
  removeAllNextSiblings() {
9208
- return f(r$3).splice(l(t) + 1);
9215
+ return x(r$3).splice(l(t) + 1);
9209
9216
  },
9210
9217
  removeAllPrevSiblings() {
9211
9218
  const o$2 = l(t) + i$2;
9212
- return i$2 -= o$2, f(r$3).splice(0, Math.max(0, o$2));
9219
+ return i$2 -= o$2, x(r$3).splice(0, Math.max(0, o$2));
9213
9220
  },
9214
- replaceWith(o$2, y$2 = {}) {
9215
- const b$2 = !!y$2.traverse;
9216
- r$3 ? r$3[Math.max(0, l(t) + i$2)] = o$2 : u(s$1, "Can't replace root node")[t] = o$2, b$2 && n(o$2, s$1, t, r$3), c = !0;
9221
+ replaceWith(o$2, m$2 = {}) {
9222
+ const y$2 = !!m$2.traverse;
9223
+ r$3 ? r$3[Math.max(0, l(t) + i$2)] = o$2 : u(s$1, "Can't replace root node")[t] = o$2, y$2 && n(o$2, s$1, t, r$3), c = !0;
9217
9224
  },
9218
- replaceWithMultiple(o$2, y$2 = {}) {
9219
- const b$2 = !!y$2.traverse;
9220
- if (f(r$3).splice(Math.max(0, l(t) + i$2), 1, ...o$2), i$2 += o$2.length - 1, b$2) {
9225
+ replaceWithMultiple(o$2, m$2 = {}) {
9226
+ const y$2 = !!m$2.traverse;
9227
+ if (x(r$3).splice(Math.max(0, l(t) + i$2), 1, ...o$2), i$2 += o$2.length - 1, y$2) {
9221
9228
  let g = 0;
9222
- for (let x$1 = 0; x$1 < o$2.length; x$1++) g += n(o$2[x$1], s$1, l(t) + x$1 + g, r$3);
9229
+ for (let p$1 = 0; p$1 < o$2.length; p$1++) g += n(o$2[p$1], s$1, l(t) + p$1 + g, r$3);
9223
9230
  }
9224
9231
  c = !0;
9225
9232
  },
9226
9233
  skip() {
9227
9234
  c = !0;
9228
9235
  }
9229
- }, { type: m$2 } = e, h$1 = v$1["*"], p$1 = v$1[m$2], R$2 = typeof h$1 == "function" ? h$1 : h$1?.enter, P$2 = typeof p$1 == "function" ? p$1 : p$1?.enter;
9230
- if (R$2?.(d$1, N), P$2?.(d$1, N), !c) switch (m$2) {
9236
+ }, { type: f$1 } = e, u$1 = v$1["*"], h$1 = v$1[f$1], R$2 = typeof u$1 == "function" ? u$1 : u$1?.enter, P$2 = typeof h$1 == "function" ? h$1 : h$1?.enter;
9237
+ if (R$2?.(d$1, N), P$2?.(d$1, N), !c) switch (f$1) {
9231
9238
  case "AbsenceFunction":
9232
- case "CapturingGroup":
9233
- case "Group":
9234
- u$1(e.body, e);
9235
- break;
9236
9239
  case "Alternative":
9240
+ case "CapturingGroup":
9237
9241
  case "CharacterClass":
9238
- u$1(e.body, e);
9242
+ case "Group":
9243
+ case "LookaroundAssertion":
9244
+ b$2(e.body, e);
9239
9245
  break;
9240
9246
  case "Assertion":
9241
9247
  case "Backreference":
@@ -9248,22 +9254,19 @@ function S(a$1, v$1, N = null) {
9248
9254
  case "CharacterClassRange":
9249
9255
  n(e.min, e, "min"), n(e.max, e, "max");
9250
9256
  break;
9251
- case "LookaroundAssertion":
9252
- u$1(e.body, e);
9253
- break;
9254
9257
  case "Quantifier":
9255
9258
  n(e.body, e, "body");
9256
9259
  break;
9257
9260
  case "Regex":
9258
- u$1(e.body, e), n(e.flags, e, "flags");
9261
+ b$2(e.body, e), n(e.flags, e, "flags");
9259
9262
  break;
9260
- default: throw new Error(`Unexpected node type "${m$2}"`);
9263
+ default: throw new Error(`Unexpected node type "${f$1}"`);
9261
9264
  }
9262
- return p$1?.exit?.(d$1, N), h$1?.exit?.(d$1, N), i$2;
9265
+ return h$1?.exit?.(d$1, N), u$1?.exit?.(d$1, N), i$2;
9263
9266
  }
9264
9267
  return n(a$1), a$1;
9265
9268
  }
9266
- function f(a$1) {
9269
+ function x(a$1) {
9267
9270
  if (!Array.isArray(a$1)) throw new Error("Container expected");
9268
9271
  return a$1;
9269
9272
  }
@@ -9273,7 +9276,7 @@ function l(a$1) {
9273
9276
  }
9274
9277
 
9275
9278
  //#endregion
9276
- //#region ../../node_modules/.bun/regex@6.0.1/node_modules/regex/src/utils-internals.js
9279
+ //#region ../../node_modules/.bun/regex@6.1.0/node_modules/regex/src/utils-internals.js
9277
9280
  const noncapturingDelim = String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;
9278
9281
  /**
9279
9282
  Updates the array in place by incrementing each value greater than or equal to the threshold.
@@ -9461,13 +9464,16 @@ function getGroupContents(expression, contentsStartPos) {
9461
9464
  }
9462
9465
 
9463
9466
  //#endregion
9464
- //#region ../../node_modules/.bun/regex@6.0.1/node_modules/regex/src/atomic.js
9467
+ //#region ../../node_modules/.bun/regex@6.1.0/node_modules/regex/src/atomic.js
9468
+ /**
9469
+ @import {PluginData, PluginResult} from './regex.js';
9470
+ */
9465
9471
  const atomicPluginToken = new RegExp(String.raw`(?<noncapturingStart>${noncapturingDelim})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`, "gsu");
9466
9472
  /**
9467
9473
  Apply transformations for atomic groups: `(?>…)`.
9468
9474
  @param {string} expression
9469
- @param {import('./regex.js').PluginData} [data]
9470
- @returns {Required<import('./regex.js').PluginResult>}
9475
+ @param {PluginData} [data]
9476
+ @returns {Required<PluginResult>}
9471
9477
  */
9472
9478
  function atomic(expression, data) {
9473
9479
  const hiddenCaptures = data?.hiddenCaptures ?? [];
@@ -9522,7 +9528,7 @@ function atomic(expression, data) {
9522
9528
  if (captureTransfers.size) {
9523
9529
  const newCaptureTransfers = new Map();
9524
9530
  captureTransfers.forEach((from, to) => {
9525
- newCaptureTransfers.set(to >= addedCaptureNum ? to + 1 : to, from.map((f$2) => f$2 >= addedCaptureNum ? f$2 + 1 : f$2));
9531
+ newCaptureTransfers.set(to >= addedCaptureNum ? to + 1 : to, from.map((f$1) => f$1 >= addedCaptureNum ? f$1 + 1 : f$1));
9526
9532
  });
9527
9533
  captureTransfers = newCaptureTransfers;
9528
9534
  }
@@ -9575,7 +9581,7 @@ Transform posessive quantifiers into atomic groups. The posessessive quantifiers
9575
9581
  This follows Java, PCRE, Perl, and Python.
9576
9582
  Possessive quantifiers in Oniguruma and Onigmo are only: `?+`, `*+`, `++`.
9577
9583
  @param {string} expression
9578
- @returns {import('./regex.js').PluginResult}
9584
+ @returns {PluginResult}
9579
9585
  */
9580
9586
  function possessive(expression) {
9581
9587
  if (!new RegExp(`${baseQuantifier}\\+`).test(expression)) {
@@ -9634,7 +9640,7 @@ function possessive(expression) {
9634
9640
  }
9635
9641
 
9636
9642
  //#endregion
9637
- //#region ../../node_modules/.bun/regex@6.0.1/node_modules/regex/src/subclass.js
9643
+ //#region ../../node_modules/.bun/regex@6.1.0/node_modules/regex/src/subclass.js
9638
9644
  /**
9639
9645
  Works the same as JavaScript's native `RegExp` constructor in all contexts, but automatically
9640
9646
  adjusts subpattern matches and indices (with flag `d`) to account for captures added as part of
@@ -9958,18 +9964,18 @@ function mapCaptureTransfers(captureTransfers, left, reps, numCapturesAddedInExp
9958
9964
  const numCapturesAddedInLeft = numCapturesInLeft * reps;
9959
9965
  const newTo = to > recursionDelimCaptureNum + numCapturesInLeft ? to + numCapturesAddedInExpansion : to;
9960
9966
  const newFrom = [];
9961
- for (const f$2 of from) {
9962
- if (f$2 <= recursionDelimCaptureNum) {
9963
- newFrom.push(f$2);
9964
- } else if (f$2 > recursionDelimCaptureNum + numCapturesInLeft + numCapturesInRight) {
9965
- newFrom.push(f$2 + numCapturesAddedInExpansion);
9966
- } else if (f$2 <= recursionDelimCaptureNum + numCapturesInLeft) {
9967
+ for (const f$1 of from) {
9968
+ if (f$1 <= recursionDelimCaptureNum) {
9969
+ newFrom.push(f$1);
9970
+ } else if (f$1 > recursionDelimCaptureNum + numCapturesInLeft + numCapturesInRight) {
9971
+ newFrom.push(f$1 + numCapturesAddedInExpansion);
9972
+ } else if (f$1 <= recursionDelimCaptureNum + numCapturesInLeft) {
9967
9973
  for (let i$2 = 0; i$2 <= reps; i$2++) {
9968
- newFrom.push(f$2 + numCapturesInLeft * i$2);
9974
+ newFrom.push(f$1 + numCapturesInLeft * i$2);
9969
9975
  }
9970
9976
  } else {
9971
9977
  for (let i$2 = 0; i$2 <= reps; i$2++) {
9972
- newFrom.push(f$2 + numCapturesAddedInLeft + numCapturesInRight * i$2);
9978
+ newFrom.push(f$1 + numCapturesAddedInLeft + numCapturesInRight * i$2);
9973
9979
  }
9974
9980
  }
9975
9981
  }
@@ -9981,36 +9987,36 @@ function mapCaptureTransfers(captureTransfers, left, reps, numCapturesAddedInExp
9981
9987
  }
9982
9988
 
9983
9989
  //#endregion
9984
- //#region ../../node_modules/.bun/oniguruma-to-es@4.3.4/node_modules/oniguruma-to-es/dist/esm/index.js
9990
+ //#region ../../node_modules/.bun/oniguruma-to-es@4.3.6/node_modules/oniguruma-to-es/dist/esm/index.js
9985
9991
  var cp = String.fromCodePoint;
9986
9992
  var r = String.raw;
9987
- var envFlags = {
9988
- flagGroups: (() => {
9989
- try {
9990
- new RegExp("(?i:)");
9991
- } catch {
9992
- return false;
9993
- }
9994
- return true;
9995
- })(),
9996
- unicodeSets: (() => {
9997
- try {
9998
- new RegExp("[[]]", "v");
9999
- } catch {
10000
- return false;
10001
- }
10002
- return true;
10003
- })()
10004
- };
9993
+ var envFlags = {};
9994
+ var globalRegExp = globalThis.RegExp;
9995
+ envFlags.flagGroups = (() => {
9996
+ try {
9997
+ new globalRegExp("(?i:)");
9998
+ } catch {
9999
+ return false;
10000
+ }
10001
+ return true;
10002
+ })();
10003
+ envFlags.unicodeSets = (() => {
10004
+ try {
10005
+ new globalRegExp("[[]]", "v");
10006
+ } catch {
10007
+ return false;
10008
+ }
10009
+ return true;
10010
+ })();
10005
10011
  envFlags.bugFlagVLiteralHyphenIsRange = envFlags.unicodeSets ? (() => {
10006
10012
  try {
10007
- new RegExp(r`[\d\-a]`, "v");
10013
+ new globalRegExp(r`[\d\-a]`, "v");
10008
10014
  } catch {
10009
10015
  return true;
10010
10016
  }
10011
10017
  return false;
10012
10018
  })() : false;
10013
- envFlags.bugNestedClassIgnoresNegation = envFlags.unicodeSets && new RegExp("[[^a]]", "v").test("a");
10019
+ envFlags.bugNestedClassIgnoresNegation = envFlags.unicodeSets && new globalRegExp("[[^a]]", "v").test("a");
10014
10020
  function getNewCurrentFlags(current, { enable, disable }) {
10015
10021
  return {
10016
10022
  dotAll: !disable?.dotAll && !!(enable?.dotAll || current.dotAll),
@@ -10492,7 +10498,7 @@ var FirstPassVisitor = {
10492
10498
  "spaceIsAscii",
10493
10499
  "wordIsAscii",
10494
10500
  "textSegmentMode"
10495
- ].forEach((f$2) => delete node[f$2]);
10501
+ ].forEach((f$1) => delete node[f$1]);
10496
10502
  Object.assign(node, {
10497
10503
  global: false,
10498
10504
  hasIndices: false,
@@ -10636,7 +10642,9 @@ var SecondPassVisitor = {
10636
10642
  }
10637
10643
  },
10638
10644
  exit({ node }, { openRefs }) {
10639
- openRefs.delete(node.number);
10645
+ if (openRefs.get(node.number) === node) {
10646
+ openRefs.delete(node.number);
10647
+ }
10640
10648
  }
10641
10649
  },
10642
10650
  Group: {
@@ -11636,7 +11644,7 @@ function toRegExpDetails(pattern, options) {
11636
11644
  }
11637
11645
 
11638
11646
  //#endregion
11639
- //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.0.2/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
11647
+ //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.2.0/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
11640
11648
  /**
11641
11649
  * The default regex constructor for the JavaScript RegExp engine.
11642
11650
  */
@@ -11664,10 +11672,11 @@ function defaultJavaScriptRegexConstructor(pattern, options) {
11664
11672
  * Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
11665
11673
  */
11666
11674
  function createJavaScriptRegexEngine(options = {}) {
11667
- const _options = Object.assign({
11675
+ const _options = {
11668
11676
  target: "auto",
11669
- cache: /* @__PURE__ */ new Map()
11670
- }, options);
11677
+ cache: /* @__PURE__ */ new Map(),
11678
+ ...options
11679
+ };
11671
11680
  _options.regexConstructor ||= (pattern) => defaultJavaScriptRegexConstructor(pattern, { target: _options.target });
11672
11681
  return {
11673
11682
  createScanner(patterns) {
@@ -11680,7 +11689,7 @@ function createJavaScriptRegexEngine(options = {}) {
11680
11689
  }
11681
11690
 
11682
11691
  //#endregion
11683
- //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.0.2/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
11692
+ //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.2.0/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
11684
11693
  /**
11685
11694
  * Raw JavaScript regex engine that only supports precompiled grammars.
11686
11695
  *
@@ -11706,7 +11715,7 @@ function createJavaScriptRawEngine() {
11706
11715
  }
11707
11716
 
11708
11717
  //#endregion
11709
- //#region ../../node_modules/.bun/@shikijs+engine-oniguruma@4.0.2/node_modules/@shikijs/engine-oniguruma/dist/index.mjs
11718
+ //#region ../../node_modules/.bun/@shikijs+engine-oniguruma@4.2.0/node_modules/@shikijs/engine-oniguruma/dist/index.mjs
11710
11719
  var dist_exports = /* @__PURE__ */ __export({
11711
11720
  createOnigurumaEngine: () => createOnigurumaEngine,
11712
11721
  getDefaultWasmLoader: () => getDefaultWasmLoader,
@@ -11725,7 +11734,7 @@ function getHeapMax() {
11725
11734
  function _emscripten_get_now() {
11726
11735
  return typeof performance !== "undefined" ? performance.now() : Date.now();
11727
11736
  }
11728
- const alignUp = (x$1, multiple) => x$1 + (multiple - x$1 % multiple) % multiple;
11737
+ const alignUp = (x$2, multiple) => x$2 + (multiple - x$2 % multiple) % multiple;
11729
11738
  async function main(init) {
11730
11739
  let wasmMemory;
11731
11740
  let buffer;
@@ -11808,10 +11817,10 @@ async function main(init) {
11808
11817
  env: asmLibraryArg,
11809
11818
  wasi_snapshot_preview1: asmLibraryArg
11810
11819
  };
11811
- const exports$1 = await init(info);
11812
- wasmMemory = exports$1.memory;
11820
+ const exports = await init(info);
11821
+ wasmMemory = exports.memory;
11813
11822
  updateGlobalBufferAndViews(wasmMemory.buffer);
11814
- Object.assign(binding, exports$1);
11823
+ Object.assign(binding, exports);
11815
11824
  binding.UTF8ToString = UTF8ToString;
11816
11825
  }
11817
11826
  await createWasm();
@@ -12130,7 +12139,7 @@ async function createOnigurumaEngine(options) {
12130
12139
  }
12131
12140
 
12132
12141
  //#endregion
12133
- //#region ../../node_modules/.bun/shiki@4.0.2/node_modules/shiki/dist/engine-oniguruma.mjs
12142
+ //#region ../../node_modules/.bun/shiki@4.2.0/node_modules/shiki/dist/engine-oniguruma.mjs
12134
12143
  var engine_oniguruma_exports = /* @__PURE__ */ __exportAll({});
12135
12144
  __reExport(engine_oniguruma_exports, dist_exports);
12136
12145
 
@@ -12236,6 +12245,494 @@ function attachResolvedLanguages(resolvedLanguages, highlighter$1) {
12236
12245
  //#region src/highlighter/themes/constants.ts
12237
12246
  const AttachedThemes = new Set();
12238
12247
 
12248
+ //#endregion
12249
+ //#region ../theming/dist/modules/createThemeCollection.js
12250
+ function createThemeCollection(options) {
12251
+ const descriptors = [];
12252
+ const seen = /* @__PURE__ */ new Set();
12253
+ for (const entry of getCollectionEntries(options.themes)) {
12254
+ const themes = isThemeCollectionSource(entry) ? entry.getThemes() : [entry];
12255
+ for (const descriptor of themes) {
12256
+ if (seen.has(descriptor.name)) throw new Error(`Theme collection already contains theme "${descriptor.name}"`);
12257
+ seen.add(descriptor.name);
12258
+ descriptors.push(descriptor);
12259
+ }
12260
+ }
12261
+ const allThemes = Object.freeze([...descriptors]);
12262
+ const lightThemes = Object.freeze(allThemes.filter((descriptor) => descriptor.colorScheme === "light"));
12263
+ const darkThemes = Object.freeze(allThemes.filter((descriptor) => descriptor.colorScheme === "dark"));
12264
+ const themesByName = new Map(allThemes.map((descriptor) => [descriptor.name, descriptor]));
12265
+ const allNames = Object.freeze(allThemes.map((descriptor) => descriptor.name));
12266
+ const lightNames = Object.freeze(lightThemes.map((descriptor) => descriptor.name));
12267
+ const darkNames = Object.freeze(darkThemes.map((descriptor) => descriptor.name));
12268
+ function filteredThemes(filterOptions) {
12269
+ if (filterOptions == null) return allThemes;
12270
+ const { colorScheme, collection } = filterOptions;
12271
+ if (collection == null) {
12272
+ if (colorScheme === "light") return lightThemes;
12273
+ if (colorScheme === "dark") return darkThemes;
12274
+ return allThemes;
12275
+ }
12276
+ return allThemes.filter((descriptor) => {
12277
+ if (descriptor.collection !== collection) return false;
12278
+ return colorScheme == null || descriptor.colorScheme === colorScheme;
12279
+ });
12280
+ }
12281
+ return {
12282
+ getTheme(name) {
12283
+ return themesByName.get(name);
12284
+ },
12285
+ getThemes(themeOptions) {
12286
+ return filteredThemes(themeOptions);
12287
+ },
12288
+ getThemeNames(namesOptions) {
12289
+ if (namesOptions?.collection == null) {
12290
+ if (namesOptions?.colorScheme === "light") return lightNames;
12291
+ if (namesOptions?.colorScheme === "dark") return darkNames;
12292
+ return allNames;
12293
+ }
12294
+ return filteredThemes(namesOptions).map((descriptor) => descriptor.name);
12295
+ },
12296
+ hasTheme(name) {
12297
+ return themesByName.has(name);
12298
+ },
12299
+ orderBy(compare) {
12300
+ return createThemeCollection({ themes: allThemes.map((descriptor, index) => ({
12301
+ descriptor,
12302
+ index
12303
+ })).sort((a$1, b$2) => {
12304
+ const result = compare(a$1.descriptor, b$2.descriptor);
12305
+ if (result !== 0) return result;
12306
+ return a$1.index - b$2.index;
12307
+ }).map((entry) => entry.descriptor) });
12308
+ },
12309
+ pick(names) {
12310
+ const picked = [];
12311
+ const pickedNames = /* @__PURE__ */ new Set();
12312
+ for (const name of names) {
12313
+ if (pickedNames.has(name)) throw new Error(`Theme collection pick already includes theme "${name}"`);
12314
+ pickedNames.add(name);
12315
+ const descriptor = themesByName.get(name);
12316
+ if (descriptor == null) throw new Error(`Theme collection does not contain theme "${name}"`);
12317
+ picked.push(descriptor);
12318
+ }
12319
+ return createThemeCollection({ themes: picked });
12320
+ },
12321
+ registerInto(resolver) {
12322
+ for (const descriptor of allThemes) resolver.registerThemeIfAbsent(descriptor.name, descriptor.load);
12323
+ }
12324
+ };
12325
+ }
12326
+ function getCollectionEntries(input) {
12327
+ if (isThemeCollectionEntry(input)) return [input];
12328
+ return input;
12329
+ }
12330
+ function isThemeCollectionEntry(input) {
12331
+ return isThemeCollectionSource(input) || isThemeDescriptor(input);
12332
+ }
12333
+ function isThemeDescriptor(input) {
12334
+ return typeof input.name === "string" && typeof input.load === "function";
12335
+ }
12336
+ function isThemeCollectionSource(entry) {
12337
+ return typeof entry.getThemes === "function";
12338
+ }
12339
+
12340
+ //#endregion
12341
+ //#region ../theming/dist/modules/createThemeCatalog.js
12342
+ function createThemeCatalog(options) {
12343
+ const collection = createThemeCollection({ themes: options.themes });
12344
+ if (!collection.hasTheme(options.defaultLightThemeName)) throw new Error(`Default light theme "${options.defaultLightThemeName}" is not in the catalog`);
12345
+ if (!collection.hasTheme(options.defaultDarkThemeName)) throw new Error(`Default dark theme "${options.defaultDarkThemeName}" is not in the catalog`);
12346
+ return {
12347
+ ...collection,
12348
+ defaultLightThemeName: options.defaultLightThemeName,
12349
+ defaultDarkThemeName: options.defaultDarkThemeName
12350
+ };
12351
+ }
12352
+
12353
+ //#endregion
12354
+ //#region ../theming/dist/modules/unwrapDefault.js
12355
+ function unwrapDefault(value) {
12356
+ return value !== null && typeof value === "object" && "default" in value ? value.default : value;
12357
+ }
12358
+
12359
+ //#endregion
12360
+ //#region ../theming/dist/modules/createThemeResolver.js
12361
+ var DuplicateThemeError = class extends Error {
12362
+ constructor(name) {
12363
+ super(`Theme "${name}" is already registered`);
12364
+ this.name = "DuplicateThemeError";
12365
+ }
12366
+ };
12367
+ var UnregisteredThemeError = class extends Error {
12368
+ constructor(name) {
12369
+ super(`No loader registered for theme "${name}"`);
12370
+ this.name = "UnregisteredThemeError";
12371
+ }
12372
+ };
12373
+ var UnresolvedThemeError = class extends Error {
12374
+ constructor(name) {
12375
+ super(`Theme "${name}" has not been resolved`);
12376
+ this.name = "UnresolvedThemeError";
12377
+ }
12378
+ };
12379
+ function createThemeResolver() {
12380
+ const loaders = /* @__PURE__ */ new Map();
12381
+ const resolved = /* @__PURE__ */ new Map();
12382
+ const inflight = /* @__PURE__ */ new Map();
12383
+ let cacheGeneration = 0;
12384
+ function registerTheme(name, loader) {
12385
+ if (loaders.has(name)) throw new DuplicateThemeError(name);
12386
+ loaders.set(name, loader);
12387
+ }
12388
+ function registerThemeIfAbsent(name, loader) {
12389
+ if (loaders.has(name)) return false;
12390
+ loaders.set(name, loader);
12391
+ return true;
12392
+ }
12393
+ function hasRegisteredTheme(name) {
12394
+ return loaders.has(name);
12395
+ }
12396
+ function resolveTheme(name) {
12397
+ const cached = resolved.get(name);
12398
+ if (cached !== void 0) return Promise.resolve(cached);
12399
+ const existing = inflight.get(name);
12400
+ if (existing !== void 0) return existing;
12401
+ const loader = loaders.get(name);
12402
+ if (loader === void 0) return Promise.reject(new UnregisteredThemeError(name));
12403
+ const generation = cacheGeneration;
12404
+ const promise = loader().then((result) => {
12405
+ const theme = unwrapDefault(result);
12406
+ if (generation === cacheGeneration) resolved.set(name, theme);
12407
+ if (inflight.get(name) === promise) inflight.delete(name);
12408
+ return theme;
12409
+ }).catch((err) => {
12410
+ if (inflight.get(name) === promise) inflight.delete(name);
12411
+ throw err;
12412
+ });
12413
+ inflight.set(name, promise);
12414
+ return promise;
12415
+ }
12416
+ function resolveThemes$1(names) {
12417
+ return Promise.all(names.map((name) => resolveTheme(name)));
12418
+ }
12419
+ function seedResolvedTheme(name, theme) {
12420
+ resolved.set(name, theme);
12421
+ }
12422
+ function seedResolvedThemes(entries) {
12423
+ for (const [name, theme] of entries) seedResolvedTheme(name, theme);
12424
+ }
12425
+ function getResolvedTheme(name) {
12426
+ return resolved.get(name);
12427
+ }
12428
+ function getResolvedThemes(names) {
12429
+ const themes = [];
12430
+ for (const name of names) {
12431
+ const theme = resolved.get(name);
12432
+ if (theme === void 0) throw new UnresolvedThemeError(name);
12433
+ themes.push(theme);
12434
+ }
12435
+ return themes;
12436
+ }
12437
+ function hasResolvedTheme(name) {
12438
+ return resolved.has(name);
12439
+ }
12440
+ function hasResolvedThemes(names) {
12441
+ for (const name of names) if (!resolved.has(name)) return false;
12442
+ return true;
12443
+ }
12444
+ function getResolvedOrResolveTheme(name) {
12445
+ const cached = resolved.get(name);
12446
+ if (cached !== void 0) return cached;
12447
+ return resolveTheme(name);
12448
+ }
12449
+ function clearResolvedThemes() {
12450
+ cacheGeneration++;
12451
+ resolved.clear();
12452
+ inflight.clear();
12453
+ }
12454
+ return {
12455
+ clearResolvedThemes,
12456
+ getResolvedOrResolveTheme,
12457
+ getResolvedTheme,
12458
+ getResolvedThemes,
12459
+ hasRegisteredTheme,
12460
+ hasResolvedTheme,
12461
+ hasResolvedThemes,
12462
+ registerTheme,
12463
+ registerThemeIfAbsent,
12464
+ resolveTheme,
12465
+ resolveThemes: resolveThemes$1,
12466
+ seedResolvedTheme,
12467
+ seedResolvedThemes
12468
+ };
12469
+ }
12470
+
12471
+ //#endregion
12472
+ //#region ../theming/dist/modules/createThemeController.js
12473
+ const FALLBACK_LIGHT_THEME = "pierre-light";
12474
+ const FALLBACK_DARK_THEME = "pierre-dark";
12475
+ function getStorage() {
12476
+ try {
12477
+ if (typeof globalThis !== "undefined" && globalThis.localStorage != null) return globalThis.localStorage;
12478
+ } catch {}
12479
+ }
12480
+ function createLocalStorageAdapter(storageKey, defaults) {
12481
+ return {
12482
+ load() {
12483
+ const raw$1 = getStorage()?.getItem(storageKey);
12484
+ if (raw$1 == null) return null;
12485
+ try {
12486
+ const parsed = JSON.parse(raw$1);
12487
+ if (parsed.mode == null) return null;
12488
+ return {
12489
+ darkThemeName: parsed.darkThemeName ?? defaults.darkThemeName,
12490
+ lightThemeName: parsed.lightThemeName ?? defaults.lightThemeName,
12491
+ mode: parsed.mode
12492
+ };
12493
+ } catch {
12494
+ return null;
12495
+ }
12496
+ },
12497
+ save(selection) {
12498
+ const storage = getStorage();
12499
+ try {
12500
+ storage?.setItem(storageKey, JSON.stringify(selection));
12501
+ } catch {}
12502
+ }
12503
+ };
12504
+ }
12505
+ function systemPrefersDark() {
12506
+ try {
12507
+ if (typeof globalThis !== "undefined" && globalThis.matchMedia != null) return globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
12508
+ } catch {}
12509
+ return false;
12510
+ }
12511
+ function resolveColorScheme(mode) {
12512
+ if (mode === "dark") return "dark";
12513
+ if (mode === "light") return "light";
12514
+ return systemPrefersDark() ? "dark" : "light";
12515
+ }
12516
+ function createThemeController(options) {
12517
+ const { storageKey, preloadInactive = false } = options;
12518
+ const catalog = "catalog" in options && options.catalog != null ? options.catalog : void 0;
12519
+ const selectedResolver = options.resolver ?? (catalog != null ? createThemeResolver() : void 0);
12520
+ if (selectedResolver == null) throw new Error("createThemeController requires a catalog or resolver");
12521
+ const resolver = selectedResolver;
12522
+ catalog?.registerInto(resolver);
12523
+ const defaultDarkThemeName = options.defaultDarkThemeName ?? catalog?.defaultDarkThemeName ?? FALLBACK_DARK_THEME;
12524
+ const defaultLightThemeName = options.defaultLightThemeName ?? catalog?.defaultLightThemeName ?? FALLBACK_LIGHT_THEME;
12525
+ const persistence = options.persistence ?? (storageKey != null ? createLocalStorageAdapter(storageKey, {
12526
+ darkThemeName: defaultDarkThemeName,
12527
+ lightThemeName: defaultLightThemeName
12528
+ }) : void 0);
12529
+ const initialMode = options.defaultMode ?? "system";
12530
+ let state = {
12531
+ darkThemeName: defaultDarkThemeName,
12532
+ lightThemeName: defaultLightThemeName,
12533
+ mode: initialMode,
12534
+ resolvedTheme: void 0,
12535
+ resolvedColorScheme: resolveColorScheme(initialMode)
12536
+ };
12537
+ const listeners = /* @__PURE__ */ new Set();
12538
+ let activeResolutionId = 0;
12539
+ let pendingSelectionPatch;
12540
+ function notify() {
12541
+ for (const listener of listeners) listener();
12542
+ }
12543
+ function hydrateFromStorage() {
12544
+ const loaded = persistence?.load();
12545
+ if (loaded == null) return;
12546
+ state = {
12547
+ ...state,
12548
+ darkThemeName: loaded.darkThemeName,
12549
+ lightThemeName: loaded.lightThemeName,
12550
+ mode: loaded.mode,
12551
+ resolvedColorScheme: resolveColorScheme(loaded.mode)
12552
+ };
12553
+ }
12554
+ function persist() {
12555
+ persistence?.save({
12556
+ darkThemeName: state.darkThemeName,
12557
+ lightThemeName: state.lightThemeName,
12558
+ mode: state.mode
12559
+ });
12560
+ }
12561
+ function activeThemeNameFor(selection) {
12562
+ return selection.resolvedColorScheme === "dark" ? selection.darkThemeName : selection.lightThemeName;
12563
+ }
12564
+ function intendedState(patch = {}) {
12565
+ return {
12566
+ ...state,
12567
+ ...pendingSelectionPatch,
12568
+ ...patch
12569
+ };
12570
+ }
12571
+ function reportResolutionError(error, context) {
12572
+ if (options.onResolutionError != null) {
12573
+ options.onResolutionError(error, context);
12574
+ return;
12575
+ }
12576
+ console.error(`[theming] Failed to resolve theme "${context.name}" for ${context.colorScheme} color scheme`, error);
12577
+ }
12578
+ function preloadInactiveFor(selection) {
12579
+ if (!preloadInactive) return;
12580
+ const activeName = activeThemeNameFor(selection);
12581
+ const inactive = selection.resolvedColorScheme === "dark" ? selection.lightThemeName : selection.darkThemeName;
12582
+ if (inactive !== activeName && resolver.getResolvedTheme(inactive) === void 0) resolver.resolveTheme(inactive).catch(() => {});
12583
+ }
12584
+ function resolveActive(patch = {}, { notifyPending = false, persistOnSuccess = false } = {}) {
12585
+ const selectionPatch = {
12586
+ ...pendingSelectionPatch,
12587
+ ...patch
12588
+ };
12589
+ const next = intendedState(patch);
12590
+ const name = activeThemeNameFor(next);
12591
+ const colorScheme = next.resolvedColorScheme;
12592
+ const cached = resolver.getResolvedTheme(name);
12593
+ if (cached !== void 0) {
12594
+ activeResolutionId++;
12595
+ pendingSelectionPatch = void 0;
12596
+ state = {
12597
+ ...state,
12598
+ ...selectionPatch,
12599
+ pendingThemeResolution: void 0,
12600
+ resolutionError: void 0,
12601
+ resolvedTheme: cached
12602
+ };
12603
+ if (persistOnSuccess) persist();
12604
+ notify();
12605
+ preloadInactiveFor(state);
12606
+ return;
12607
+ }
12608
+ const resolutionId = ++activeResolutionId;
12609
+ pendingSelectionPatch = selectionPatch;
12610
+ state = {
12611
+ ...state,
12612
+ pendingThemeResolution: {
12613
+ colorScheme,
12614
+ name
12615
+ },
12616
+ resolutionError: void 0
12617
+ };
12618
+ if (notifyPending) notify();
12619
+ resolver.resolveTheme(name).then((theme) => {
12620
+ if (resolutionId !== activeResolutionId) return;
12621
+ const latestIntended = intendedState();
12622
+ if (latestIntended.resolvedColorScheme !== colorScheme || activeThemeNameFor(latestIntended) !== name) return;
12623
+ const patchToCommit = pendingSelectionPatch ?? {};
12624
+ pendingSelectionPatch = void 0;
12625
+ state = {
12626
+ ...state,
12627
+ ...patchToCommit,
12628
+ pendingThemeResolution: void 0,
12629
+ resolutionError: void 0,
12630
+ resolvedTheme: theme
12631
+ };
12632
+ if (persistOnSuccess) persist();
12633
+ notify();
12634
+ preloadInactiveFor(state);
12635
+ }).catch((error) => {
12636
+ if (resolutionId !== activeResolutionId) return;
12637
+ pendingSelectionPatch = void 0;
12638
+ state = {
12639
+ ...state,
12640
+ pendingThemeResolution: void 0,
12641
+ resolutionError: {
12642
+ colorScheme,
12643
+ error,
12644
+ name
12645
+ }
12646
+ };
12647
+ reportResolutionError(error, {
12648
+ colorScheme,
12649
+ name
12650
+ });
12651
+ notify();
12652
+ });
12653
+ }
12654
+ function updateInactiveThemeName(key$1, name) {
12655
+ state = {
12656
+ ...state,
12657
+ [key$1]: name,
12658
+ resolutionError: void 0
12659
+ };
12660
+ persist();
12661
+ notify();
12662
+ preloadInactiveFor(state);
12663
+ }
12664
+ function isSchemeActiveInIntendedState(scheme, patch = {}) {
12665
+ return intendedState(patch).resolvedColorScheme === scheme;
12666
+ }
12667
+ function setActiveSelection(patch) {
12668
+ resolveActive(patch, {
12669
+ notifyPending: true,
12670
+ persistOnSuccess: true
12671
+ });
12672
+ }
12673
+ function setInactiveThemeName(scheme, key$1, name) {
12674
+ if (isSchemeActiveInIntendedState(scheme, { [key$1]: name })) setActiveSelection({ [key$1]: name });
12675
+ else updateInactiveThemeName(key$1, name);
12676
+ }
12677
+ function setMode(mode) {
12678
+ setActiveSelection({
12679
+ mode,
12680
+ resolvedColorScheme: resolveColorScheme(mode)
12681
+ });
12682
+ }
12683
+ function maybeUpdateSystemColorScheme() {
12684
+ if (intendedState().mode !== "system") return;
12685
+ const next = resolveColorScheme("system");
12686
+ if (next !== intendedState().resolvedColorScheme) resolveActive({ resolvedColorScheme: next }, { notifyPending: true });
12687
+ }
12688
+ function isSelectedValue(key$1, value) {
12689
+ return intendedState()[key$1] === value;
12690
+ }
12691
+ let mediaQuery;
12692
+ const handleMediaChange = () => {
12693
+ maybeUpdateSystemColorScheme();
12694
+ };
12695
+ function attachMediaListener() {
12696
+ try {
12697
+ if (typeof globalThis !== "undefined" && globalThis.matchMedia != null) {
12698
+ mediaQuery = globalThis.matchMedia("(prefers-color-scheme: dark)");
12699
+ mediaQuery.addEventListener("change", handleMediaChange);
12700
+ }
12701
+ } catch {}
12702
+ }
12703
+ hydrateFromStorage();
12704
+ attachMediaListener();
12705
+ resolveActive();
12706
+ return {
12707
+ resolver,
12708
+ destroy() {
12709
+ if (mediaQuery != null) {
12710
+ mediaQuery.removeEventListener("change", handleMediaChange);
12711
+ mediaQuery = void 0;
12712
+ }
12713
+ listeners.clear();
12714
+ },
12715
+ getState() {
12716
+ return state;
12717
+ },
12718
+ setColorMode(mode) {
12719
+ if (isSelectedValue("mode", mode)) return;
12720
+ setMode(mode);
12721
+ },
12722
+ setThemeNameForScheme(scheme, name) {
12723
+ const key$1 = scheme === "light" ? "lightThemeName" : "darkThemeName";
12724
+ if (isSelectedValue(key$1, name)) return;
12725
+ setInactiveThemeName(scheme, key$1, name);
12726
+ },
12727
+ subscribe(listener) {
12728
+ listeners.add(listener);
12729
+ return () => {
12730
+ listeners.delete(listener);
12731
+ };
12732
+ }
12733
+ };
12734
+ }
12735
+
12239
12736
  //#endregion
12240
12737
  //#region src/highlighter/themes/themeResolver.ts
12241
12738
  const themeResolver = createThemeResolver();
@@ -14065,7 +14562,10 @@ function cleanLastNewline(contents) {
14065
14562
  }
14066
14563
 
14067
14564
  //#endregion
14068
- //#region ../../node_modules/.bun/@shikijs+transformers@4.0.2/node_modules/@shikijs/transformers/dist/index.mjs
14565
+ //#region ../../node_modules/.bun/@shikijs+transformers@4.2.0/node_modules/@shikijs/transformers/dist/index.mjs
14566
+ const RE_SPLIT_COMMENT = /(\s+\/\/)/;
14567
+ const RE_V1_END_COMMENT_PREFIX = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/;
14568
+ const RE_V3_END_COMMENT_PREFIX = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/;
14069
14569
  /**
14070
14570
  * some comment formats have to be located at the end of line
14071
14571
  * hence we can skip matching them for other tokens
@@ -14091,7 +14591,7 @@ function parseComments(lines, jsx, matchAlgorithm) {
14091
14591
  if (token$1.type !== "text") return element$1;
14092
14592
  const isLast = idx === line.children.length - 1;
14093
14593
  if (!matchToken(token$1.value, isLast)) return element$1;
14094
- const rawSplits = token$1.value.split(/(\s+\/\/)/);
14594
+ const rawSplits = token$1.value.split(RE_SPLIT_COMMENT);
14095
14595
  if (rawSplits.length <= 1) return element$1;
14096
14596
  let splits = [rawSplits[0]];
14097
14597
  for (let i$2 = 1; i$2 < rawSplits.length; i$2 += 2) splits.push(rawSplits[i$2] + (rawSplits[i$2 + 1] || ""));
@@ -14197,12 +14697,22 @@ function matchToken(text$1, isLast) {
14197
14697
  * For matchAlgorithm v1
14198
14698
  */
14199
14699
  function v1ClearEndCommentPrefix(text$1) {
14200
- const match = text$1.match(/(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/);
14700
+ const match = text$1.match(RE_V1_END_COMMENT_PREFIX);
14201
14701
  if (match && match[1].trim().length === 0) return text$1.slice(0, match.index);
14202
14702
  return text$1;
14203
14703
  }
14704
+ /**
14705
+ * Remove empty comment prefixes at line end, e.g. `// `
14706
+ *
14707
+ * For matchAlgorithm v3
14708
+ */
14709
+ function v3ClearEndCommentPrefix(text$1) {
14710
+ const match = text$1.match(RE_V3_END_COMMENT_PREFIX);
14711
+ if (match && match[1].trim().length === 0) return text$1.slice(0, match.index).trimEnd();
14712
+ return text$1;
14713
+ }
14204
14714
  function createCommentNotationTransformer(name, regex, onMatch, matchAlgorithm) {
14205
- if (matchAlgorithm == null) matchAlgorithm = "v3";
14715
+ matchAlgorithm ??= "v3";
14206
14716
  return {
14207
14717
  name,
14208
14718
  code(code) {
@@ -14226,6 +14736,7 @@ function createCommentNotationTransformer(name, regex, onMatch, matchAlgorithm)
14226
14736
  });
14227
14737
  if (!replaced) continue;
14228
14738
  if (matchAlgorithm === "v1") comment$1.info[1] = v1ClearEndCommentPrefix(comment$1.info[1]);
14739
+ else if (matchAlgorithm === "v3") comment$1.info[1] = v3ClearEndCommentPrefix(comment$1.info[1]);
14229
14740
  const isEmpty = comment$1.info[1].trim().length === 0;
14230
14741
  if (isEmpty) comment$1.info[1] = "";
14231
14742
  if (isEmpty && comment$1.isLineCommentOnly) linesToRemove.push(comment$1.line);
@@ -14271,9 +14782,10 @@ function transformerCompactLineOptions(lineOptions = []) {
14271
14782
  }
14272
14783
  };
14273
14784
  }
14785
+ const RE_HIGHLIGHT_LINES = /\{([\d,-]+)\}/;
14274
14786
  function parseMetaHighlightString(meta) {
14275
14787
  if (!meta) return null;
14276
- const match = meta.match(/\{([\d,-]+)\}/);
14788
+ const match = meta.match(RE_HIGHLIGHT_LINES);
14277
14789
  if (!match) return null;
14278
14790
  return match[1].split(",").flatMap((v$1) => {
14279
14791
  const range$1 = v$1.split("-").map((n) => Number.parseInt(n, 10));
@@ -14299,9 +14811,11 @@ function transformerMetaHighlight(options = {}) {
14299
14811
  }
14300
14812
  };
14301
14813
  }
14814
+ const RE_WORD_MATCH = /\/((?:\\.|[^/])+)\//g;
14815
+ const RE_ESCAPE_BACKSLASH = /\\(.)/g;
14302
14816
  function parseMetaHighlightWords(meta) {
14303
14817
  if (!meta) return [];
14304
- return Array.from(meta.matchAll(/\/((?:\\.|[^/])+)\//g)).map((v$1) => v$1[1].replace(/\\(.)/g, "$1"));
14818
+ return [...meta.matchAll(RE_WORD_MATCH)].map((v$1) => v$1[1].replace(RE_ESCAPE_BACKSLASH, "$1"));
14305
14819
  }
14306
14820
  /**
14307
14821
  * Allow using `/word/` in the code snippet meta to mark highlighted words.
@@ -14337,8 +14851,9 @@ function findAllSubstringIndexes(str, substr) {
14337
14851
  }
14338
14852
  return indexes;
14339
14853
  }
14854
+ const RE_ESCAPE_SPECIAL = /[.*+?^${}()|[\]\\]/g;
14340
14855
  function escapeRegExp(str) {
14341
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14856
+ return str.replace(RE_ESCAPE_SPECIAL, "\\$&");
14342
14857
  }
14343
14858
  function transformerNotationMap(options = {}, name = "@shikijs/transformers:notation-map") {
14344
14859
  const { classMap = {}, classActivePre = void 0, classActiveCode = void 0 } = options;
@@ -14470,11 +14985,13 @@ function inheritElement(original, overrides) {
14470
14985
  ...overrides
14471
14986
  };
14472
14987
  }
14988
+ const RE_CODE_WORD = /\s*\[!code word:((?:\\.|[^:\]])+)(:\d+)?\]/;
14989
+ const RE_UNESCAPE = /\\(.)/g;
14473
14990
  function transformerNotationWordHighlight(options = {}) {
14474
14991
  const { classActiveWord = "highlighted-word", classActivePre = void 0 } = options;
14475
- return createCommentNotationTransformer("@shikijs/transformers:notation-highlight-word", /\s*\[!code word:((?:\\.|[^:\]])+)(:\d+)?\]/, function([_$2, word, range$1], _line, comment$1, lines, index) {
14992
+ return createCommentNotationTransformer("@shikijs/transformers:notation-highlight-word", RE_CODE_WORD, function([_$2, word, range$1], _line, comment$1, lines, index) {
14476
14993
  const lineNum = range$1 ? Number.parseInt(range$1.slice(1), 10) : lines.length;
14477
- word = word.replace(/\\(.)/g, "$1");
14994
+ word = word.replace(RE_UNESCAPE, "$1");
14478
14995
  for (let i$2 = index; i$2 < Math.min(index + lineNum, lines.length); i$2++) highlightWordInLine.call(this, lines[i$2], comment$1, word, classActiveWord);
14479
14996
  if (classActivePre) this.addClassToHast(this.pre, classActivePre);
14480
14997
  return true;
@@ -14536,6 +15053,8 @@ function transformerRemoveNotationEscape() {
14536
15053
  }
14537
15054
  };
14538
15055
  }
15056
+ const RE_INDENT_META = /\{indent:(\d+|false)\}/;
15057
+ const RE_NON_BLANK = /[^ \t]/;
14539
15058
  /**
14540
15059
  * Render indentations as separate tokens.
14541
15060
  * Apply with CSS, it can be used to render indent guides visually.
@@ -14544,7 +15063,7 @@ function transformerRenderIndentGuides(options = {}) {
14544
15063
  return {
14545
15064
  name: "@shikijs/transformers:render-indent-guides",
14546
15065
  code(hast) {
14547
- const indent = Number(this.options.meta?.indent ?? this.options.meta?.__raw?.match(/\{indent:(\d+|false)\}/)?.[1] ?? options.indent ?? 2);
15066
+ const indent = Number(this.options.meta?.indent ?? this.options.meta?.__raw?.match(RE_INDENT_META)?.[1] ?? options.indent ?? 2);
14548
15067
  if (Number.isNaN(indent) || indent <= 0) return hast;
14549
15068
  const indentRegex = new RegExp(` {${indent}}| {0,${indent - 1}}\t| {1,}$`, "g");
14550
15069
  const emptyLines = [];
@@ -14557,7 +15076,7 @@ function transformerRenderIndentGuides(options = {}) {
14557
15076
  continue;
14558
15077
  }
14559
15078
  const text$1 = first.children[0];
14560
- const blanks = text$1.value.split(/[^ \t]/, 1)[0];
15079
+ const blanks = text$1.value.split(RE_NON_BLANK, 1)[0];
14561
15080
  const ranges = [];
14562
15081
  for (const match of blanks.matchAll(indentRegex)) {
14563
15082
  const start = match.index;
@@ -14632,6 +15151,7 @@ function splitSpaces(parts, type, renderContinuousSpaces = true) {
14632
15151
  ...parts.slice(parts.length - rightCount)
14633
15152
  ];
14634
15153
  }
15154
+ const RE_SPACE_OR_TAB = /([ \t])/;
14635
15155
  /**
14636
15156
  * Render whitespaces as separate tokens.
14637
15157
  * Apply with CSS, it can be used to render tabs and spaces visually.
@@ -14659,7 +15179,7 @@ function transformerRenderWhitespace(options = {}) {
14659
15179
  if (position === "leading" && index !== 0) return token$1;
14660
15180
  const node = token$1.children[0];
14661
15181
  if (node.type !== "text" || !node.value) return token$1;
14662
- const parts = splitSpaces(node.value.split(/([ \t])/).filter((i$2) => i$2.length), position === "boundary" && index === last && last !== 0 ? "trailing" : position, position !== "trailing" && position !== "leading");
15182
+ const parts = splitSpaces(node.value.split(RE_SPACE_OR_TAB).filter((i$2) => i$2.length), position === "boundary" && index === last && last !== 0 ? "trailing" : position, position !== "trailing" && position !== "leading");
14663
15183
  if (parts.length <= 1) return token$1;
14664
15184
  return parts.map((part) => {
14665
15185
  const clone$1 = {
@@ -15050,6 +15570,207 @@ function formatCSSVariablePrefix(type) {
15050
15570
  return `--${type === "token" ? "diffs-token" : "diffs"}-`;
15051
15571
  }
15052
15572
 
15573
+ //#endregion
15574
+ //#region ../theming/dist/modules/color.js
15575
+ /**
15576
+ * Canonical color/contrast primitives
15577
+ */
15578
+ const MIN_READABLE_RATIO = 3;
15579
+ const MIN_MUTED_RATIO = 4.5;
15580
+ const HEX_TRANSPARENT_RE = /^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i;
15581
+ const ALPHA_ZERO_RE = /^0(?:\.0+)?%?$/;
15582
+ function getFunctionalAlpha(color) {
15583
+ const openParen = color.indexOf("(");
15584
+ if (openParen <= 0 || !color.endsWith(")")) return;
15585
+ const fn = color.slice(0, openParen).trim();
15586
+ if (!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(fn)) return;
15587
+ const inner = color.slice(openParen + 1, -1).trim();
15588
+ if (inner.length === 0) return;
15589
+ const slashIndex = inner.lastIndexOf("/");
15590
+ if (slashIndex !== -1) return inner.slice(slashIndex + 1).trim();
15591
+ if (/^(?:rgba|hsla)$/i.test(fn)) {
15592
+ const parts = inner.split(",");
15593
+ if (parts.length === 4) return parts[3]?.trim();
15594
+ }
15595
+ }
15596
+ function parseHexRgba(color) {
15597
+ const match = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(color.trim());
15598
+ if (match == null) return null;
15599
+ const hex = match[1];
15600
+ let expanded;
15601
+ let alpha = 1;
15602
+ if (hex.length === 3) expanded = hex.split("").map((c) => c + c).join("");
15603
+ else if (hex.length === 6) expanded = hex;
15604
+ else {
15605
+ expanded = hex.slice(0, 6);
15606
+ alpha = parseInt(hex.slice(6, 8), 16) / 255;
15607
+ }
15608
+ return [
15609
+ parseInt(expanded.slice(0, 2), 16),
15610
+ parseInt(expanded.slice(2, 4), 16),
15611
+ parseInt(expanded.slice(4, 6), 16),
15612
+ alpha
15613
+ ];
15614
+ }
15615
+ function relativeLuminance(color) {
15616
+ if (color == null) return null;
15617
+ const rgba = parseHexRgba(color);
15618
+ if (rgba == null) return null;
15619
+ const r$3 = rgba[0] / 255;
15620
+ const g = rgba[1] / 255;
15621
+ const b$2 = rgba[2] / 255;
15622
+ const channel = (v$1) => v$1 <= .03928 ? v$1 / 12.92 : ((v$1 + .055) / 1.055) ** 2.4;
15623
+ return .2126 * channel(r$3) + .7152 * channel(g) + .0722 * channel(b$2);
15624
+ }
15625
+ function contrastRatio(a$1, b$2) {
15626
+ const [hi, lo] = a$1 > b$2 ? [a$1, b$2] : [b$2, a$1];
15627
+ return (hi + .05) / (lo + .05);
15628
+ }
15629
+ function compositeOverBg(fgColor, bgColor) {
15630
+ if (bgColor == null) return void 0;
15631
+ const fgParts = parseHexRgba(fgColor);
15632
+ const bgParts = parseHexRgba(bgColor);
15633
+ if (fgParts == null || bgParts == null) return void 0;
15634
+ const [fr, fg, fb, fa] = fgParts;
15635
+ const [br, bg, bb] = bgParts;
15636
+ return "#" + [
15637
+ Math.round(fr * fa + br * (1 - fa)),
15638
+ Math.round(fg * fa + bg * (1 - fa)),
15639
+ Math.round(fb * fa + bb * (1 - fa))
15640
+ ].map((v$1) => v$1.toString(16).padStart(2, "0")).join("");
15641
+ }
15642
+ function isFullyTransparent(color) {
15643
+ if (color == null) return false;
15644
+ const normalized = color.trim().toLowerCase();
15645
+ if (normalized === "transparent") return true;
15646
+ if (HEX_TRANSPARENT_RE.test(normalized)) return true;
15647
+ const alpha = getFunctionalAlpha(normalized);
15648
+ return alpha != null && ALPHA_ZERO_RE.test(alpha);
15649
+ }
15650
+ function isDarkSurface(bg, fgHint) {
15651
+ const fromBg = relativeLuminance(bg);
15652
+ if (fromBg != null) return fromBg < .4;
15653
+ const fromFg = relativeLuminance(fgHint);
15654
+ return fromFg != null ? fromFg > .6 : false;
15655
+ }
15656
+ function surfacesMatch(a$1, b$2) {
15657
+ if (a$1 == null || b$2 == null) return false;
15658
+ if (a$1.trim().toLowerCase() === b$2.trim().toLowerCase()) return true;
15659
+ const la = relativeLuminance(a$1);
15660
+ const lb = relativeLuminance(b$2);
15661
+ if (la == null || lb == null) return false;
15662
+ return Math.abs(la - lb) < .06;
15663
+ }
15664
+ function hoverWouldEraseText(hover, bg, fg) {
15665
+ if (bg == null || fg == null) return false;
15666
+ const hoverL = relativeLuminance(hover);
15667
+ const bgL = relativeLuminance(bg);
15668
+ const fgL = relativeLuminance(fg);
15669
+ if (hoverL == null || bgL == null || fgL == null) return false;
15670
+ return Math.abs(hoverL - fgL) < Math.abs(hoverL - bgL);
15671
+ }
15672
+ function pickReadableForeground(bg, candidates) {
15673
+ const bgL = relativeLuminance(bg);
15674
+ const firstDefined = candidates.find((candidate) => candidate != null && candidate !== "");
15675
+ if (bgL == null) return firstDefined;
15676
+ let best;
15677
+ let bestRatio = -1;
15678
+ for (const candidate of candidates) {
15679
+ if (candidate == null || candidate === "") continue;
15680
+ const candidateL = relativeLuminance(candidate);
15681
+ if (candidateL == null) continue;
15682
+ const ratio = contrastRatio(bgL, candidateL);
15683
+ if (ratio >= MIN_READABLE_RATIO) return candidate;
15684
+ if (ratio > bestRatio) {
15685
+ best = candidate;
15686
+ bestRatio = ratio;
15687
+ }
15688
+ }
15689
+ return best ?? firstDefined;
15690
+ }
15691
+ function deriveMutedFg(primaryFg, bg) {
15692
+ if (bg == null) return primaryFg;
15693
+ const fgParts = parseHexRgba(primaryFg);
15694
+ const bgParts = parseHexRgba(bg);
15695
+ const bgL = relativeLuminance(bg);
15696
+ if (fgParts == null || bgParts == null || bgL == null) return `color-mix(in srgb, ${primaryFg} 70%, ${bg})`;
15697
+ const [fr, fg2, fb] = fgParts;
15698
+ const [br, bg3, bb] = bgParts;
15699
+ for (const weight of [
15700
+ .6,
15701
+ .7,
15702
+ .8,
15703
+ .9
15704
+ ]) {
15705
+ const hex = "#" + [
15706
+ Math.round(fr * weight + br * (1 - weight)),
15707
+ Math.round(fg2 * weight + bg3 * (1 - weight)),
15708
+ Math.round(fb * weight + bb * (1 - weight))
15709
+ ].map((v$1) => v$1.toString(16).padStart(2, "0")).join("");
15710
+ const L$2 = relativeLuminance(hex);
15711
+ if (L$2 != null && contrastRatio(bgL, L$2) >= MIN_MUTED_RATIO) return hex;
15712
+ }
15713
+ return primaryFg;
15714
+ }
15715
+
15716
+ //#endregion
15717
+ //#region ../theming/dist/modules/normalizeThemeColors.js
15718
+ const cache = /* @__PURE__ */ new WeakMap();
15719
+ function normalizeThemeColors(theme) {
15720
+ const cached = cache.get(theme);
15721
+ if (cached != null) return cached;
15722
+ const originalColors = theme.colors ?? {};
15723
+ const colors = { ...originalColors };
15724
+ const editorBackground = originalColors["editor.background"] ?? theme.bg;
15725
+ const editorForeground = originalColors["editor.foreground"] ?? theme.fg;
15726
+ const sidebarBackground = originalColors["sideBar.background"] ?? editorBackground;
15727
+ const sidebarForeground = originalColors["sideBar.foreground"] ?? editorForeground;
15728
+ fill(colors, "editor.background", editorBackground);
15729
+ fill(colors, "editor.foreground", editorForeground);
15730
+ fill(colors, "sideBar.background", sidebarBackground);
15731
+ fill(colors, "sideBar.foreground", sidebarForeground);
15732
+ fill(colors, "input.background", originalColors["input.background"] ?? sidebarBackground);
15733
+ fill(colors, "sideBarSectionHeader.foreground", originalColors["sideBarSectionHeader.foreground"] ?? sidebarForeground);
15734
+ fill(colors, "list.activeSelectionForeground", originalColors["list.activeSelectionForeground"] ?? sidebarForeground);
15735
+ fill(colors, "gitDecoration.addedResourceForeground", firstColor(originalColors["gitDecoration.addedResourceForeground"], originalColors["terminal.ansiGreen"], originalColors["editorGutter.addedBackground"]));
15736
+ fill(colors, "gitDecoration.modifiedResourceForeground", firstColor(originalColors["gitDecoration.modifiedResourceForeground"], originalColors["terminal.ansiBlue"], originalColors["editorGutter.modifiedBackground"]));
15737
+ fill(colors, "gitDecoration.deletedResourceForeground", firstColor(originalColors["gitDecoration.deletedResourceForeground"], originalColors["terminal.ansiRed"], originalColors["editorGutter.deletedBackground"]));
15738
+ const focusRing = (isFullyTransparent(originalColors["list.focusOutline"]) ? void 0 : originalColors["list.focusOutline"]) ?? (isFullyTransparent(originalColors["focusBorder"]) ? void 0 : originalColors["focusBorder"]);
15739
+ if (focusRing != null) colors["list.focusOutline"] = focusRing;
15740
+ else delete colors["list.focusOutline"];
15741
+ const hover = originalColors["list.hoverBackground"];
15742
+ if (hover != null && (matchesSurface(hover, sidebarBackground) || hoverWouldEraseText(hover, sidebarBackground, sidebarForeground))) delete colors["list.hoverBackground"];
15743
+ const result = Object.freeze({
15744
+ ...theme,
15745
+ colors: Object.freeze(colors)
15746
+ });
15747
+ cache.set(theme, result);
15748
+ return result;
15749
+ }
15750
+ function fill(colors, key$1, value) {
15751
+ if (value != null && value !== "") colors[key$1] = value;
15752
+ }
15753
+ function firstColor(...candidates) {
15754
+ for (const candidate of candidates) if (candidate != null && candidate !== "") return candidate;
15755
+ }
15756
+ function matchesSurface(color, surface) {
15757
+ return surface != null && color.toLowerCase() === surface.toLowerCase();
15758
+ }
15759
+
15760
+ //#endregion
15761
+ //#region ../theming/dist/color.js
15762
+ const colorUtils = {
15763
+ compositeOverBg,
15764
+ contrastRatio,
15765
+ deriveMutedFg,
15766
+ hoverWouldEraseText,
15767
+ isDarkSurface,
15768
+ isFullyTransparent,
15769
+ pickReadableForeground,
15770
+ relativeLuminance,
15771
+ surfacesMatch
15772
+ };
15773
+
15053
15774
  //#endregion
15054
15775
  //#region src/utils/getHighlighterThemeStyles.ts
15055
15776
  function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highlighter$1, prefix }) {
@@ -16164,7 +16885,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
16164
16885
  transformers,
16165
16886
  decorations: undefined,
16166
16887
  defaultColor: false,
16167
- cssVariablePrefix: formatCSSVariablePrefix("token")
16888
+ cssVariablePrefix: formatCSSVariablePrefix("token"),
16889
+ tokenizeTimeLimit: 0
16168
16890
  } : {
16169
16891
  ...options,
16170
16892
  lang: "text",
@@ -16172,7 +16894,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
16172
16894
  transformers,
16173
16895
  decorations: undefined,
16174
16896
  defaultColor: false,
16175
- cssVariablePrefix: formatCSSVariablePrefix("token")
16897
+ cssVariablePrefix: formatCSSVariablePrefix("token"),
16898
+ tokenizeTimeLimit: 0
16176
16899
  };
16177
16900
  })();
16178
16901
  const deletionLines = (() => {
@@ -16295,7 +17018,8 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
16295
17018
  transformers,
16296
17019
  defaultColor: false,
16297
17020
  cssVariablePrefix: formatCSSVariablePrefix("token"),
16298
- tokenizeMaxLineLength
17021
+ tokenizeMaxLineLength,
17022
+ tokenizeTimeLimit: 0
16299
17023
  };
16300
17024
  }
16301
17025
  return {
@@ -16304,7 +17028,8 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
16304
17028
  transformers,
16305
17029
  defaultColor: false,
16306
17030
  cssVariablePrefix: formatCSSVariablePrefix("token"),
16307
- tokenizeMaxLineLength
17031
+ tokenizeMaxLineLength,
17032
+ tokenizeTimeLimit: 0
16308
17033
  };
16309
17034
  })();
16310
17035
  const highlightedLines = getLineNodes(highlighter$1.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? splitFileContents(file.contents), startingLine, totalLines) : cleanLastNewline(file.contents), hastConfig));
@@ -16445,7 +17170,7 @@ function getHighlighter(preferredHighlighter = "shiki-js") {
16445
17170
  highlighter ??= createHighlighterCore({
16446
17171
  themes: [],
16447
17172
  langs: [],
16448
- engine: preferredHighlighter === "shiki-wasm" ? createOnigurumaEngine(import("./wasm-BaDzIkIn.js")) : createJavaScriptRegexEngine()
17173
+ engine: preferredHighlighter === "shiki-wasm" ? createOnigurumaEngine(import("./wasm-qE0LgnY3.js")) : createJavaScriptRegexEngine()
16449
17174
  });
16450
17175
  return highlighter;
16451
17176
  }