@pierre/diffs 1.2.6 → 1.3.0-beta.1

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 (165) hide show
  1. package/dist/components/CodeView.d.ts +0 -1
  2. package/dist/components/CodeView.d.ts.map +1 -1
  3. package/dist/components/CodeView.js +0 -23
  4. package/dist/components/CodeView.js.map +1 -1
  5. package/dist/components/File.d.ts +7 -2
  6. package/dist/components/File.d.ts.map +1 -1
  7. package/dist/components/File.js +36 -2
  8. package/dist/components/File.js.map +1 -1
  9. package/dist/components/FileDiff.d.ts +8 -2
  10. package/dist/components/FileDiff.d.ts.map +1 -1
  11. package/dist/components/FileDiff.js +73 -1
  12. package/dist/components/FileDiff.js.map +1 -1
  13. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  14. package/dist/components/UnresolvedFile.js +2 -2
  15. package/dist/components/VirtualizedFile.d.ts +2 -1
  16. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  17. package/dist/components/VirtualizedFile.js +48 -48
  18. package/dist/components/VirtualizedFile.js.map +1 -1
  19. package/dist/components/VirtualizedFileDiff.js +42 -22
  20. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  21. package/dist/components/Virtualizer.d.ts +1 -1
  22. package/dist/components/Virtualizer.d.ts.map +1 -1
  23. package/dist/components/Virtualizer.js +3 -5
  24. package/dist/components/Virtualizer.js.map +1 -1
  25. package/dist/constants.d.ts.map +1 -1
  26. package/dist/editor/command.d.ts +6 -0
  27. package/dist/editor/command.d.ts.map +1 -0
  28. package/dist/editor/command.js +31 -0
  29. package/dist/editor/command.js.map +1 -0
  30. package/dist/editor/css.d.ts +6 -0
  31. package/dist/editor/css.d.ts.map +1 -0
  32. package/dist/editor/css.js +218 -0
  33. package/dist/editor/css.js.map +1 -0
  34. package/dist/editor/editStack.d.ts +66 -0
  35. package/dist/editor/editStack.d.ts.map +1 -0
  36. package/dist/editor/editStack.js +218 -0
  37. package/dist/editor/editStack.js.map +1 -0
  38. package/dist/editor/editor.d.ts +22 -0
  39. package/dist/editor/editor.d.ts.map +1 -0
  40. package/dist/editor/editor.js +1323 -0
  41. package/dist/editor/editor.js.map +1 -0
  42. package/dist/editor/index.d.ts +3 -0
  43. package/dist/editor/index.js +4 -0
  44. package/dist/editor/lineAnnotations.d.ts +8 -0
  45. package/dist/editor/lineAnnotations.d.ts.map +1 -0
  46. package/dist/editor/lineAnnotations.js +32 -0
  47. package/dist/editor/lineAnnotations.js.map +1 -0
  48. package/dist/editor/pieceTable.d.ts +33 -0
  49. package/dist/editor/pieceTable.d.ts.map +1 -0
  50. package/dist/editor/pieceTable.js +590 -0
  51. package/dist/editor/pieceTable.js.map +1 -0
  52. package/dist/editor/platform.d.ts +12 -0
  53. package/dist/editor/platform.d.ts.map +1 -0
  54. package/dist/editor/platform.js +44 -0
  55. package/dist/editor/platform.js.map +1 -0
  56. package/dist/editor/quickEdit.d.ts +29 -0
  57. package/dist/editor/quickEdit.d.ts.map +1 -0
  58. package/dist/editor/quickEdit.js +81 -0
  59. package/dist/editor/quickEdit.js.map +1 -0
  60. package/dist/editor/searchPanel.d.ts +30 -0
  61. package/dist/editor/searchPanel.d.ts.map +1 -0
  62. package/dist/editor/searchPanel.js +219 -0
  63. package/dist/editor/searchPanel.js.map +1 -0
  64. package/dist/editor/selection.d.ts +126 -0
  65. package/dist/editor/selection.d.ts.map +1 -0
  66. package/dist/editor/selection.js +900 -0
  67. package/dist/editor/selection.js.map +1 -0
  68. package/dist/editor/textDocument.d.ts +139 -0
  69. package/dist/editor/textDocument.d.ts.map +1 -0
  70. package/dist/editor/textDocument.js +202 -0
  71. package/dist/editor/textDocument.js.map +1 -0
  72. package/dist/editor/textMeasure.d.ts +32 -0
  73. package/dist/editor/textMeasure.d.ts.map +1 -0
  74. package/dist/editor/textMeasure.js +108 -0
  75. package/dist/editor/textMeasure.js.map +1 -0
  76. package/dist/editor/tokenzier.d.ts +37 -0
  77. package/dist/editor/tokenzier.d.ts.map +1 -0
  78. package/dist/editor/tokenzier.js +348 -0
  79. package/dist/editor/tokenzier.js.map +1 -0
  80. package/dist/editor/utils.d.ts +16 -0
  81. package/dist/editor/utils.d.ts.map +1 -0
  82. package/dist/editor/utils.js +37 -0
  83. package/dist/editor/utils.js.map +1 -0
  84. package/dist/index.d.ts +2 -2
  85. package/dist/index.js +2 -2
  86. package/dist/react/EditorContext.d.ts +16 -0
  87. package/dist/react/EditorContext.d.ts.map +1 -0
  88. package/dist/react/EditorContext.js +26 -0
  89. package/dist/react/EditorContext.js.map +1 -0
  90. package/dist/react/File.d.ts +2 -1
  91. package/dist/react/File.d.ts.map +1 -1
  92. package/dist/react/File.js +3 -2
  93. package/dist/react/File.js.map +1 -1
  94. package/dist/react/FileDiff.d.ts +3 -1
  95. package/dist/react/FileDiff.d.ts.map +1 -1
  96. package/dist/react/FileDiff.js +3 -2
  97. package/dist/react/FileDiff.js.map +1 -1
  98. package/dist/react/MultiFileDiff.d.ts +3 -1
  99. package/dist/react/MultiFileDiff.d.ts.map +1 -1
  100. package/dist/react/MultiFileDiff.js +3 -2
  101. package/dist/react/MultiFileDiff.js.map +1 -1
  102. package/dist/react/PatchDiff.d.ts +3 -1
  103. package/dist/react/PatchDiff.d.ts.map +1 -1
  104. package/dist/react/PatchDiff.js +3 -2
  105. package/dist/react/PatchDiff.js.map +1 -1
  106. package/dist/react/index.d.ts +3 -2
  107. package/dist/react/index.js +2 -1
  108. package/dist/react/jsx.d.ts +0 -1
  109. package/dist/react/jsx.d.ts.map +1 -1
  110. package/dist/react/types.d.ts +1 -0
  111. package/dist/react/types.d.ts.map +1 -1
  112. package/dist/react/types.js +0 -1
  113. package/dist/react/utils/useFileDiffInstance.d.ts +3 -1
  114. package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
  115. package/dist/react/utils/useFileDiffInstance.js +31 -5
  116. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  117. package/dist/react/utils/useFileInstance.d.ts +4 -1
  118. package/dist/react/utils/useFileInstance.d.ts.map +1 -1
  119. package/dist/react/utils/useFileInstance.js +30 -5
  120. package/dist/react/utils/useFileInstance.js.map +1 -1
  121. package/dist/renderers/DiffHunksRenderer.d.ts +2 -2
  122. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  123. package/dist/renderers/DiffHunksRenderer.js +9 -5
  124. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  125. package/dist/renderers/FileRenderer.d.ts +5 -1
  126. package/dist/renderers/FileRenderer.d.ts.map +1 -1
  127. package/dist/renderers/FileRenderer.js +108 -41
  128. package/dist/renderers/FileRenderer.js.map +1 -1
  129. package/dist/ssr/index.d.ts +2 -2
  130. package/dist/style.js +1 -1
  131. package/dist/style.js.map +1 -1
  132. package/dist/types.d.ts +45 -1
  133. package/dist/types.d.ts.map +1 -1
  134. package/dist/utils/cleanLastNewline.js +6 -1
  135. package/dist/utils/cleanLastNewline.js.map +1 -1
  136. package/dist/utils/computeEstimatedDiffHeights.js +20 -9
  137. package/dist/utils/computeEstimatedDiffHeights.js.map +1 -1
  138. package/dist/utils/computeFileOffsets.d.ts +13 -0
  139. package/dist/utils/computeFileOffsets.d.ts.map +1 -0
  140. package/dist/utils/computeFileOffsets.js +33 -0
  141. package/dist/utils/computeFileOffsets.js.map +1 -0
  142. package/dist/utils/createTransformerWithState.js +9 -0
  143. package/dist/utils/createTransformerWithState.js.map +1 -1
  144. package/dist/utils/iterateOverDiff.js +182 -147
  145. package/dist/utils/iterateOverDiff.js.map +1 -1
  146. package/dist/utils/renderDiffWithHighlighter.js +1 -1
  147. package/dist/utils/renderFileWithHighlighter.js +5 -14
  148. package/dist/utils/renderFileWithHighlighter.js.map +1 -1
  149. package/dist/utils/virtualDiffLayout.d.ts +2 -23
  150. package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
  151. package/dist/utils/virtualDiffLayout.js +1 -41
  152. package/dist/utils/virtualDiffLayout.js.map +1 -1
  153. package/dist/worker/WorkerPoolManager.js +1 -1
  154. package/dist/worker/{wasm-BaDzIkIn.js → wasm-D4DU5jgR.js} +2 -2
  155. package/dist/worker/wasm-D4DU5jgR.js.map +1 -0
  156. package/dist/worker/worker-portable.js +349 -363
  157. package/dist/worker/worker-portable.js.map +1 -1
  158. package/dist/worker/worker.js +222 -243
  159. package/dist/worker/worker.js.map +1 -1
  160. package/package.json +9 -1
  161. package/dist/utils/iterateOverFile.d.ts +0 -50
  162. package/dist/utils/iterateOverFile.d.ts.map +0 -1
  163. package/dist/utils/iterateOverFile.js +0 -49
  164. package/dist/utils/iterateOverFile.js.map +0 -1
  165. package/dist/worker/wasm-BaDzIkIn.js.map +0 -1
@@ -10,7 +10,7 @@ var __export = (all$1) => {
10
10
  };
11
11
 
12
12
  //#endregion
13
- //#region ../../node_modules/.bun/shiki@4.0.2/node_modules/shiki/dist/chunk-CtajNgzt.mjs
13
+ //#region ../../node_modules/shiki/dist/chunk-CtajNgzt.mjs
14
14
  var __defProp$1 = Object.defineProperty;
15
15
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
16
16
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -45,7 +45,7 @@ var __copyProps = (to, from, except, desc) => {
45
45
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
46
46
 
47
47
  //#endregion
48
- //#region ../../node_modules/.bun/@shikijs+types@4.0.2/node_modules/@shikijs/types/dist/index.mjs
48
+ //#region ../../node_modules/@shikijs/types/dist/index.mjs
49
49
  var ShikiError$1 = class extends Error {
50
50
  constructor(message) {
51
51
  super(message);
@@ -54,7 +54,7 @@ var ShikiError$1 = class extends Error {
54
54
  };
55
55
 
56
56
  //#endregion
57
- //#region ../../node_modules/.bun/@shikijs+vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.js
57
+ //#region ../../node_modules/@shikijs/vscode-textmate/dist/index.js
58
58
  function clone(something) {
59
59
  return doClone(something);
60
60
  }
@@ -2911,7 +2911,7 @@ var Registry = class {
2911
2911
  var INITIAL = StateStackImpl.NULL;
2912
2912
 
2913
2913
  //#endregion
2914
- //#region ../../node_modules/.bun/@shikijs+primitive@4.0.2/node_modules/@shikijs/primitive/dist/index.mjs
2914
+ //#region ../../node_modules/@shikijs/primitive/dist/index.mjs
2915
2915
  function resolveColorReplacements(theme, options) {
2916
2916
  const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
2917
2917
  const themeName = typeof theme === "string" ? theme : theme.name;
@@ -3710,7 +3710,7 @@ function alignThemesTokenization(...themes) {
3710
3710
  }
3711
3711
 
3712
3712
  //#endregion
3713
- //#region ../../node_modules/.bun/html-void-elements@3.0.0/node_modules/html-void-elements/index.js
3713
+ //#region ../../node_modules/html-void-elements/index.js
3714
3714
  /**
3715
3715
  * List of HTML void tag names.
3716
3716
  *
@@ -3740,7 +3740,7 @@ const htmlVoidElements = [
3740
3740
  ];
3741
3741
 
3742
3742
  //#endregion
3743
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/schema.js
3743
+ //#region ../../node_modules/property-information/lib/util/schema.js
3744
3744
  /**
3745
3745
  * @import {Schema as SchemaType, Space} from 'property-information'
3746
3746
  */
@@ -3769,7 +3769,7 @@ Schema.prototype.property = {};
3769
3769
  Schema.prototype.space = undefined;
3770
3770
 
3771
3771
  //#endregion
3772
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/merge.js
3772
+ //#region ../../node_modules/property-information/lib/util/merge.js
3773
3773
  /**
3774
3774
  * @param {ReadonlyArray<Schema>} definitions
3775
3775
  * Definitions.
@@ -3791,7 +3791,7 @@ function merge(definitions, space) {
3791
3791
  }
3792
3792
 
3793
3793
  //#endregion
3794
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/normalize.js
3794
+ //#region ../../node_modules/property-information/lib/normalize.js
3795
3795
  /**
3796
3796
  * Get the cleaned case insensitive form of an attribute or property.
3797
3797
  *
@@ -3806,7 +3806,7 @@ function normalize(value) {
3806
3806
  }
3807
3807
 
3808
3808
  //#endregion
3809
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/info.js
3809
+ //#region ../../node_modules/property-information/lib/util/info.js
3810
3810
  /**
3811
3811
  * @import {Info as InfoType} from 'property-information'
3812
3812
  */
@@ -3839,7 +3839,7 @@ Info.prototype.spaceSeparated = false;
3839
3839
  Info.prototype.space = undefined;
3840
3840
 
3841
3841
  //#endregion
3842
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/types.js
3842
+ //#region ../../node_modules/property-information/lib/util/types.js
3843
3843
  var types_exports = /* @__PURE__ */ __export({
3844
3844
  boolean: () => boolean,
3845
3845
  booleanish: () => booleanish,
@@ -3862,7 +3862,7 @@ function increment() {
3862
3862
  }
3863
3863
 
3864
3864
  //#endregion
3865
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/defined-info.js
3865
+ //#region ../../node_modules/property-information/lib/util/defined-info.js
3866
3866
  const checks = Object.keys(types_exports);
3867
3867
  var DefinedInfo = class extends Info {
3868
3868
  /**
@@ -3910,7 +3910,7 @@ function mark(values, key$1, value) {
3910
3910
  }
3911
3911
 
3912
3912
  //#endregion
3913
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/create.js
3913
+ //#region ../../node_modules/property-information/lib/util/create.js
3914
3914
  /**
3915
3915
  * @param {Definition} definition
3916
3916
  * Definition.
@@ -3935,7 +3935,7 @@ function create(definition) {
3935
3935
  }
3936
3936
 
3937
3937
  //#endregion
3938
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/aria.js
3938
+ //#region ../../node_modules/property-information/lib/aria.js
3939
3939
  const aria = create({
3940
3940
  properties: {
3941
3941
  ariaActiveDescendant: null,
@@ -3994,7 +3994,7 @@ const aria = create({
3994
3994
  });
3995
3995
 
3996
3996
  //#endregion
3997
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/case-sensitive-transform.js
3997
+ //#region ../../node_modules/property-information/lib/util/case-sensitive-transform.js
3998
3998
  /**
3999
3999
  * @param {Record<string, string>} attributes
4000
4000
  * Attributes.
@@ -4008,7 +4008,7 @@ function caseSensitiveTransform(attributes, attribute) {
4008
4008
  }
4009
4009
 
4010
4010
  //#endregion
4011
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/util/case-insensitive-transform.js
4011
+ //#region ../../node_modules/property-information/lib/util/case-insensitive-transform.js
4012
4012
  /**
4013
4013
  * @param {Record<string, string>} attributes
4014
4014
  * Attributes.
@@ -4022,7 +4022,7 @@ function caseInsensitiveTransform(attributes, property) {
4022
4022
  }
4023
4023
 
4024
4024
  //#endregion
4025
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/html.js
4025
+ //#region ../../node_modules/property-information/lib/html.js
4026
4026
  const html$3 = create({
4027
4027
  attributes: {
4028
4028
  acceptcharset: "accept-charset",
@@ -4335,7 +4335,7 @@ const html$3 = create({
4335
4335
  });
4336
4336
 
4337
4337
  //#endregion
4338
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/svg.js
4338
+ //#region ../../node_modules/property-information/lib/svg.js
4339
4339
  const svg$1 = create({
4340
4340
  attributes: {
4341
4341
  accentHeight: "accent-height",
@@ -4894,7 +4894,7 @@ const svg$1 = create({
4894
4894
  });
4895
4895
 
4896
4896
  //#endregion
4897
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/xlink.js
4897
+ //#region ../../node_modules/property-information/lib/xlink.js
4898
4898
  const xlink = create({
4899
4899
  properties: {
4900
4900
  xLinkActuate: null,
@@ -4912,7 +4912,7 @@ const xlink = create({
4912
4912
  });
4913
4913
 
4914
4914
  //#endregion
4915
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/xmlns.js
4915
+ //#region ../../node_modules/property-information/lib/xmlns.js
4916
4916
  const xmlns = create({
4917
4917
  attributes: { xmlnsxlink: "xmlns:xlink" },
4918
4918
  properties: {
@@ -4924,7 +4924,7 @@ const xmlns = create({
4924
4924
  });
4925
4925
 
4926
4926
  //#endregion
4927
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/xml.js
4927
+ //#region ../../node_modules/property-information/lib/xml.js
4928
4928
  const xml = create({
4929
4929
  properties: {
4930
4930
  xmlBase: null,
@@ -4938,7 +4938,7 @@ const xml = create({
4938
4938
  });
4939
4939
 
4940
4940
  //#endregion
4941
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/hast-to-react.js
4941
+ //#region ../../node_modules/property-information/lib/hast-to-react.js
4942
4942
  /**
4943
4943
  * Special cases for React (`Record<string, string>`).
4944
4944
  *
@@ -4971,7 +4971,7 @@ const hastToReact = {
4971
4971
  };
4972
4972
 
4973
4973
  //#endregion
4974
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/lib/find.js
4974
+ //#region ../../node_modules/property-information/lib/find.js
4975
4975
  const cap = /[A-Z]/g;
4976
4976
  const dash = /-[a-z]/g;
4977
4977
  const valid = /^data[-\w.:]+$/i;
@@ -5050,7 +5050,7 @@ function camelcase($0) {
5050
5050
  }
5051
5051
 
5052
5052
  //#endregion
5053
- //#region ../../node_modules/.bun/property-information@7.1.0/node_modules/property-information/index.js
5053
+ //#region ../../node_modules/property-information/index.js
5054
5054
  const html = merge([
5055
5055
  aria,
5056
5056
  html$3,
@@ -5067,7 +5067,7 @@ const svg = merge([
5067
5067
  ], "svg");
5068
5068
 
5069
5069
  //#endregion
5070
- //#region ../../node_modules/.bun/zwitch@2.0.4/node_modules/zwitch/index.js
5070
+ //#region ../../node_modules/zwitch/index.js
5071
5071
  /**
5072
5072
  * @callback Handler
5073
5073
  * Handle a value, with a certain ID field set to a certain value.
@@ -5175,7 +5175,7 @@ function zwitch(key$1, options) {
5175
5175
  }
5176
5176
 
5177
5177
  //#endregion
5178
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/core.js
5178
+ //#region ../../node_modules/stringify-entities/lib/core.js
5179
5179
  /**
5180
5180
  * @typedef CoreOptions
5181
5181
  * @property {ReadonlyArray<string>} [subset=[]]
@@ -5257,7 +5257,7 @@ function charactersToExpression(subset) {
5257
5257
  }
5258
5258
 
5259
5259
  //#endregion
5260
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-hexadecimal.js
5260
+ //#region ../../node_modules/stringify-entities/lib/util/to-hexadecimal.js
5261
5261
  const hexadecimalRegex = /[\dA-Fa-f]/;
5262
5262
  /**
5263
5263
  * Configurable ways to encode characters as hexadecimal references.
@@ -5273,7 +5273,7 @@ function toHexadecimal(code, next, omit) {
5273
5273
  }
5274
5274
 
5275
5275
  //#endregion
5276
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-decimal.js
5276
+ //#region ../../node_modules/stringify-entities/lib/util/to-decimal.js
5277
5277
  const decimalRegex = /\d/;
5278
5278
  /**
5279
5279
  * Configurable ways to encode characters as decimal references.
@@ -5289,7 +5289,7 @@ function toDecimal(code, next, omit) {
5289
5289
  }
5290
5290
 
5291
5291
  //#endregion
5292
- //#region ../../node_modules/.bun/character-entities-legacy@3.0.0/node_modules/character-entities-legacy/index.js
5292
+ //#region ../../node_modules/character-entities-legacy/index.js
5293
5293
  /**
5294
5294
  * List of legacy HTML named character references that don’t need a trailing semicolon.
5295
5295
  *
@@ -5405,7 +5405,7 @@ const characterEntitiesLegacy = [
5405
5405
  ];
5406
5406
 
5407
5407
  //#endregion
5408
- //#region ../../node_modules/.bun/character-entities-html4@2.1.0/node_modules/character-entities-html4/index.js
5408
+ //#region ../../node_modules/character-entities-html4/index.js
5409
5409
  /**
5410
5410
  * Map of named character references from HTML 4.
5411
5411
  *
@@ -5667,7 +5667,7 @@ const characterEntitiesHtml4 = {
5667
5667
  };
5668
5668
 
5669
5669
  //#endregion
5670
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/constant/dangerous.js
5670
+ //#region ../../node_modules/stringify-entities/lib/constant/dangerous.js
5671
5671
  /**
5672
5672
  * List of legacy (that don’t need a trailing `;`) named references which could,
5673
5673
  * depending on what follows them, turn into a different meaning
@@ -5686,7 +5686,7 @@ const dangerous = [
5686
5686
  ];
5687
5687
 
5688
5688
  //#endregion
5689
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/to-named.js
5689
+ //#region ../../node_modules/stringify-entities/lib/util/to-named.js
5690
5690
  const own$1 = {}.hasOwnProperty;
5691
5691
  /**
5692
5692
  * `characterEntitiesHtml4` but inverted.
@@ -5725,7 +5725,7 @@ function toNamed(code, next, omit, attribute) {
5725
5725
  }
5726
5726
 
5727
5727
  //#endregion
5728
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/format-smart.js
5728
+ //#region ../../node_modules/stringify-entities/lib/util/format-smart.js
5729
5729
  /**
5730
5730
  * Configurable ways to encode a character yielding pretty or small results.
5731
5731
  *
@@ -5751,7 +5751,7 @@ function formatSmart(code, next, options) {
5751
5751
  }
5752
5752
 
5753
5753
  //#endregion
5754
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/util/format-basic.js
5754
+ //#region ../../node_modules/stringify-entities/lib/util/format-basic.js
5755
5755
  /**
5756
5756
  * The smallest way to encode a character.
5757
5757
  *
@@ -5763,7 +5763,7 @@ function formatBasic(code) {
5763
5763
  }
5764
5764
 
5765
5765
  //#endregion
5766
- //#region ../../node_modules/.bun/stringify-entities@4.0.4/node_modules/stringify-entities/lib/index.js
5766
+ //#region ../../node_modules/stringify-entities/lib/index.js
5767
5767
  /**
5768
5768
  * Encode special characters in `value`.
5769
5769
  *
@@ -5792,7 +5792,7 @@ function stringifyEntitiesLight(value, options) {
5792
5792
  }
5793
5793
 
5794
5794
  //#endregion
5795
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/comment.js
5795
+ //#region ../../node_modules/hast-util-to-html/lib/handle/comment.js
5796
5796
  const htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g;
5797
5797
  const bogusCommentEntitySubset = [">"];
5798
5798
  const commentEntitySubset = ["<", ">"];
@@ -5821,7 +5821,7 @@ function comment(node, _1, _2, state) {
5821
5821
  }
5822
5822
 
5823
5823
  //#endregion
5824
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/doctype.js
5824
+ //#region ../../node_modules/hast-util-to-html/lib/handle/doctype.js
5825
5825
  /**
5826
5826
  * @import {Doctype, Parents} from 'hast'
5827
5827
  * @import {State} from '../index.js'
@@ -5845,7 +5845,7 @@ function doctype(_1, _2, _3, state) {
5845
5845
  }
5846
5846
 
5847
5847
  //#endregion
5848
- //#region ../../node_modules/.bun/ccount@2.0.1/node_modules/ccount/index.js
5848
+ //#region ../../node_modules/ccount/index.js
5849
5849
  /**
5850
5850
  * Count how often a character (or substring) is used in a string.
5851
5851
  *
@@ -5871,7 +5871,7 @@ function ccount(value, character) {
5871
5871
  }
5872
5872
 
5873
5873
  //#endregion
5874
- //#region ../../node_modules/.bun/comma-separated-tokens@2.0.3/node_modules/comma-separated-tokens/index.js
5874
+ //#region ../../node_modules/comma-separated-tokens/index.js
5875
5875
  /**
5876
5876
  * @typedef Options
5877
5877
  * Configuration for `stringify`.
@@ -5931,7 +5931,7 @@ function stringify$1(values, options) {
5931
5931
  }
5932
5932
 
5933
5933
  //#endregion
5934
- //#region ../../node_modules/.bun/space-separated-tokens@2.0.2/node_modules/space-separated-tokens/index.js
5934
+ //#region ../../node_modules/space-separated-tokens/index.js
5935
5935
  /**
5936
5936
  * Parse space-separated tokens to an array of strings.
5937
5937
  *
@@ -5957,7 +5957,7 @@ function stringify$2(values) {
5957
5957
  }
5958
5958
 
5959
5959
  //#endregion
5960
- //#region ../../node_modules/.bun/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/lib/index.js
5960
+ //#region ../../node_modules/hast-util-whitespace/lib/index.js
5961
5961
  /**
5962
5962
  * @typedef {import('hast').Nodes} Nodes
5963
5963
  */
@@ -5985,7 +5985,7 @@ function empty(value) {
5985
5985
  }
5986
5986
 
5987
5987
  //#endregion
5988
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/util/siblings.js
5988
+ //#region ../../node_modules/hast-util-to-html/lib/omission/util/siblings.js
5989
5989
  const siblingAfter = siblings(1);
5990
5990
  const siblingBefore = siblings(-1);
5991
5991
  /** @type {Array<RootContent>} */
@@ -6026,7 +6026,7 @@ function siblings(increment$1) {
6026
6026
  }
6027
6027
 
6028
6028
  //#endregion
6029
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/omission.js
6029
+ //#region ../../node_modules/hast-util-to-html/lib/omission/omission.js
6030
6030
  /**
6031
6031
  * @import {Element, Parents} from 'hast'
6032
6032
  */
@@ -6066,7 +6066,7 @@ function omission(handlers) {
6066
6066
  }
6067
6067
 
6068
6068
  //#endregion
6069
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/closing.js
6069
+ //#region ../../node_modules/hast-util-to-html/lib/omission/closing.js
6070
6070
  const closing = omission({
6071
6071
  body: body$1,
6072
6072
  caption: headOrColgroupOrCaption,
@@ -6329,7 +6329,7 @@ function cells(_$2, index, parent) {
6329
6329
  }
6330
6330
 
6331
6331
  //#endregion
6332
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/omission/opening.js
6332
+ //#region ../../node_modules/hast-util-to-html/lib/omission/opening.js
6333
6333
  const opening = omission({
6334
6334
  body,
6335
6335
  colgroup,
@@ -6426,7 +6426,7 @@ function tbody(node, index, parent) {
6426
6426
  }
6427
6427
 
6428
6428
  //#endregion
6429
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/element.js
6429
+ //#region ../../node_modules/hast-util-to-html/lib/handle/element.js
6430
6430
  /**
6431
6431
  * Maps of subsets.
6432
6432
  *
@@ -6559,7 +6559,7 @@ function serializeAttribute(state, key$1, value) {
6559
6559
  }
6560
6560
 
6561
6561
  //#endregion
6562
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/text.js
6562
+ //#region ../../node_modules/hast-util-to-html/lib/handle/text.js
6563
6563
  const textEntitySubset = ["<", "&"];
6564
6564
  /**
6565
6565
  * Serialize a text node.
@@ -6580,7 +6580,7 @@ function text(node, _$2, parent, state) {
6580
6580
  }
6581
6581
 
6582
6582
  //#endregion
6583
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/raw.js
6583
+ //#region ../../node_modules/hast-util-to-html/lib/handle/raw.js
6584
6584
  /**
6585
6585
  * Serialize a raw node.
6586
6586
  *
@@ -6600,7 +6600,7 @@ function raw(node, index, parent, state) {
6600
6600
  }
6601
6601
 
6602
6602
  //#endregion
6603
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/root.js
6603
+ //#region ../../node_modules/hast-util-to-html/lib/handle/root.js
6604
6604
  /**
6605
6605
  * @import {Parents, Root} from 'hast'
6606
6606
  * @import {State} from '../index.js'
@@ -6624,7 +6624,7 @@ function root(node, _1, _2, state) {
6624
6624
  }
6625
6625
 
6626
6626
  //#endregion
6627
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/handle/index.js
6627
+ //#region ../../node_modules/hast-util-to-html/lib/handle/index.js
6628
6628
  /**
6629
6629
  * @type {(node: Nodes, index: number | undefined, parent: Parents | undefined, state: State) => string}
6630
6630
  */
@@ -6665,7 +6665,7 @@ function unknown(node_) {
6665
6665
  }
6666
6666
 
6667
6667
  //#endregion
6668
- //#region ../../node_modules/.bun/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js
6668
+ //#region ../../node_modules/hast-util-to-html/lib/index.js
6669
6669
  /** @type {Options} */
6670
6670
  const emptyOptions = {};
6671
6671
  /** @type {CharacterReferences} */
@@ -6759,7 +6759,7 @@ function all(parent) {
6759
6759
  }
6760
6760
 
6761
6761
  //#endregion
6762
- //#region ../../node_modules/.bun/@shikijs+core@4.0.2/node_modules/@shikijs/core/dist/index.mjs
6762
+ //#region ../../node_modules/@shikijs/core/dist/index.mjs
6763
6763
  /**
6764
6764
  * Utility to append class to a hast node
6765
6765
  *
@@ -8126,7 +8126,7 @@ function createCssVariablesTheme(options = {}) {
8126
8126
  }
8127
8127
 
8128
8128
  //#endregion
8129
- //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.0.2/node_modules/@shikijs/engine-javascript/dist/scanner-BFcBmQR1.mjs
8129
+ //#region ../../node_modules/@shikijs/engine-javascript/dist/scanner-BFcBmQR1.mjs
8130
8130
  const MAX = 4294967295;
8131
8131
  var JavaScriptScanner = class {
8132
8132
  regexps;
@@ -8201,7 +8201,7 @@ var JavaScriptScanner = class {
8201
8201
  };
8202
8202
 
8203
8203
  //#endregion
8204
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/utils.js
8204
+ //#region ../../node_modules/oniguruma-parser/dist/utils.js
8205
8205
  function r$2(e) {
8206
8206
  if ([...e].length !== 1) throw new Error(`Expected "${e}" to be a single code point`);
8207
8207
  return e.codePointAt(0);
@@ -8231,7 +8231,7 @@ function u(e, t) {
8231
8231
  }
8232
8232
 
8233
8233
  //#endregion
8234
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/tokenizer/tokenize.js
8234
+ //#region ../../node_modules/oniguruma-parser/dist/tokenizer/tokenize.js
8235
8235
  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`
8236
8236
  \\ (?:
8237
8237
  ${b$1}
@@ -8728,7 +8728,7 @@ function te$1(e) {
8728
8728
  }
8729
8729
 
8730
8730
  //#endregion
8731
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/parser/node-utils.js
8731
+ //#region ../../node_modules/oniguruma-parser/dist/parser/node-utils.js
8732
8732
  function o(e, t) {
8733
8733
  if (!Array.isArray(e.body)) throw new Error("Expected node with body array");
8734
8734
  if (e.body.length !== 1) return !1;
@@ -8761,7 +8761,7 @@ const y = new Set([
8761
8761
  ]);
8762
8762
 
8763
8763
  //#endregion
8764
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/parser/parse.js
8764
+ //#region ../../node_modules/oniguruma-parser/dist/parser/parse.js
8765
8765
  function J(e, r$3 = {}) {
8766
8766
  const n = {
8767
8767
  flags: "",
@@ -9182,7 +9182,7 @@ function D(e) {
9182
9182
  }
9183
9183
 
9184
9184
  //#endregion
9185
- //#region ../../node_modules/.bun/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/traverser/traverse.js
9185
+ //#region ../../node_modules/oniguruma-parser/dist/traverser/traverse.js
9186
9186
  function S(a$1, v$1, N = null) {
9187
9187
  function u$1(e, s$1) {
9188
9188
  for (let t = 0; t < e.length; t++) {
@@ -9270,7 +9270,7 @@ function l(a$1) {
9270
9270
  }
9271
9271
 
9272
9272
  //#endregion
9273
- //#region ../../node_modules/.bun/regex@6.0.1/node_modules/regex/src/utils-internals.js
9273
+ //#region ../../node_modules/regex/src/utils-internals.js
9274
9274
  const noncapturingDelim = String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;
9275
9275
  /**
9276
9276
  Updates the array in place by incrementing each value greater than or equal to the threshold.
@@ -9296,7 +9296,7 @@ function spliceStr(str, pos, oldValue, newValue) {
9296
9296
  }
9297
9297
 
9298
9298
  //#endregion
9299
- //#region ../../node_modules/.bun/regex-utilities@2.3.0/node_modules/regex-utilities/src/index.js
9299
+ //#region ../../node_modules/regex-utilities/src/index.js
9300
9300
  const Context = Object.freeze({
9301
9301
  DEFAULT: "DEFAULT",
9302
9302
  CHAR_CLASS: "CHAR_CLASS"
@@ -9458,13 +9458,16 @@ function getGroupContents(expression, contentsStartPos) {
9458
9458
  }
9459
9459
 
9460
9460
  //#endregion
9461
- //#region ../../node_modules/.bun/regex@6.0.1/node_modules/regex/src/atomic.js
9461
+ //#region ../../node_modules/regex/src/atomic.js
9462
+ /**
9463
+ @import {PluginData, PluginResult} from './regex.js';
9464
+ */
9462
9465
  const atomicPluginToken = new RegExp(String.raw`(?<noncapturingStart>${noncapturingDelim})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`, "gsu");
9463
9466
  /**
9464
9467
  Apply transformations for atomic groups: `(?>…)`.
9465
9468
  @param {string} expression
9466
- @param {import('./regex.js').PluginData} [data]
9467
- @returns {Required<import('./regex.js').PluginResult>}
9469
+ @param {PluginData} [data]
9470
+ @returns {Required<PluginResult>}
9468
9471
  */
9469
9472
  function atomic(expression, data) {
9470
9473
  const hiddenCaptures = data?.hiddenCaptures ?? [];
@@ -9572,7 +9575,7 @@ Transform posessive quantifiers into atomic groups. The posessessive quantifiers
9572
9575
  This follows Java, PCRE, Perl, and Python.
9573
9576
  Possessive quantifiers in Oniguruma and Onigmo are only: `?+`, `*+`, `++`.
9574
9577
  @param {string} expression
9575
- @returns {import('./regex.js').PluginResult}
9578
+ @returns {PluginResult}
9576
9579
  */
9577
9580
  function possessive(expression) {
9578
9581
  if (!new RegExp(`${baseQuantifier}\\+`).test(expression)) {
@@ -9631,7 +9634,7 @@ function possessive(expression) {
9631
9634
  }
9632
9635
 
9633
9636
  //#endregion
9634
- //#region ../../node_modules/.bun/regex@6.0.1/node_modules/regex/src/subclass.js
9637
+ //#region ../../node_modules/regex/src/subclass.js
9635
9638
  /**
9636
9639
  Works the same as JavaScript's native `RegExp` constructor in all contexts, but automatically
9637
9640
  adjusts subpattern matches and indices (with flag `d`) to account for captures added as part of
@@ -9721,7 +9724,7 @@ function createCaptureMap$1(hiddenCaptures) {
9721
9724
  }
9722
9725
 
9723
9726
  //#endregion
9724
- //#region ../../node_modules/.bun/regex-recursion@6.0.2/node_modules/regex-recursion/src/index.js
9727
+ //#region ../../node_modules/regex-recursion/src/index.js
9725
9728
  const r$1 = String.raw;
9726
9729
  const gRToken = r$1`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`;
9727
9730
  const recursiveToken = r$1`\(\?R=(?<rDepth>[^\)]+)\)|${gRToken}`;
@@ -9978,7 +9981,7 @@ function mapCaptureTransfers(captureTransfers, left, reps, numCapturesAddedInExp
9978
9981
  }
9979
9982
 
9980
9983
  //#endregion
9981
- //#region ../../node_modules/.bun/oniguruma-to-es@4.3.4/node_modules/oniguruma-to-es/dist/esm/index.js
9984
+ //#region ../../node_modules/oniguruma-to-es/dist/esm/index.js
9982
9985
  var cp = String.fromCodePoint;
9983
9986
  var r = String.raw;
9984
9987
  var envFlags = {
@@ -11633,7 +11636,7 @@ function toRegExpDetails(pattern, options) {
11633
11636
  }
11634
11637
 
11635
11638
  //#endregion
11636
- //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.0.2/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
11639
+ //#region ../../node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
11637
11640
  /**
11638
11641
  * The default regex constructor for the JavaScript RegExp engine.
11639
11642
  */
@@ -11677,7 +11680,7 @@ function createJavaScriptRegexEngine(options = {}) {
11677
11680
  }
11678
11681
 
11679
11682
  //#endregion
11680
- //#region ../../node_modules/.bun/@shikijs+engine-javascript@4.0.2/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
11683
+ //#region ../../node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs
11681
11684
  /**
11682
11685
  * Raw JavaScript regex engine that only supports precompiled grammars.
11683
11686
  *
@@ -11703,7 +11706,7 @@ function createJavaScriptRawEngine() {
11703
11706
  }
11704
11707
 
11705
11708
  //#endregion
11706
- //#region ../../node_modules/.bun/@shikijs+engine-oniguruma@4.0.2/node_modules/@shikijs/engine-oniguruma/dist/index.mjs
11709
+ //#region ../../node_modules/@shikijs/engine-oniguruma/dist/index.mjs
11707
11710
  var dist_exports = /* @__PURE__ */ __export({
11708
11711
  createOnigurumaEngine: () => createOnigurumaEngine,
11709
11712
  getDefaultWasmLoader: () => getDefaultWasmLoader,
@@ -12127,7 +12130,7 @@ async function createOnigurumaEngine(options) {
12127
12130
  }
12128
12131
 
12129
12132
  //#endregion
12130
- //#region ../../node_modules/.bun/shiki@4.0.2/node_modules/shiki/dist/engine-oniguruma.mjs
12133
+ //#region ../../node_modules/shiki/dist/engine-oniguruma.mjs
12131
12134
  var engine_oniguruma_exports = /* @__PURE__ */ __exportAll({});
12132
12135
  __reExport(engine_oniguruma_exports, dist_exports);
12133
12136
 
@@ -12665,7 +12668,7 @@ function getCustomExtensionsMap() {
12665
12668
  }
12666
12669
 
12667
12670
  //#endregion
12668
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/base.js
12671
+ //#region ../../node_modules/diff/libesm/diff/base.js
12669
12672
  var Diff = class {
12670
12673
  diff(oldStr, newStr, options = {}) {
12671
12674
  let callback;
@@ -12889,7 +12892,7 @@ var Diff = class {
12889
12892
  };
12890
12893
 
12891
12894
  //#endregion
12892
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/character.js
12895
+ //#region ../../node_modules/diff/libesm/diff/character.js
12893
12896
  var CharacterDiff = class extends Diff {};
12894
12897
  const characterDiff = new CharacterDiff();
12895
12898
  function diffChars(oldStr, newStr, options) {
@@ -12897,7 +12900,7 @@ function diffChars(oldStr, newStr, options) {
12897
12900
  }
12898
12901
 
12899
12902
  //#endregion
12900
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/util/string.js
12903
+ //#region ../../node_modules/diff/libesm/util/string.js
12901
12904
  function longestCommonPrefix(str1, str2) {
12902
12905
  let i$2;
12903
12906
  for (i$2 = 0; i$2 < str1.length && i$2 < str2.length; i$2++) {
@@ -13006,7 +13009,7 @@ function leadingWs(string) {
13006
13009
  }
13007
13010
 
13008
13011
  //#endregion
13009
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/word.js
13012
+ //#region ../../node_modules/diff/libesm/diff/word.js
13010
13013
  const extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";
13011
13014
  const tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
13012
13015
  var WordDiff = class extends Diff {
@@ -13160,7 +13163,7 @@ function diffWordsWithSpace(oldStr, newStr, options) {
13160
13163
  }
13161
13164
 
13162
13165
  //#endregion
13163
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/util/params.js
13166
+ //#region ../../node_modules/diff/libesm/util/params.js
13164
13167
  function generateOptions(options, defaults) {
13165
13168
  if (typeof options === "function") {
13166
13169
  defaults.callback = options;
@@ -13176,7 +13179,7 @@ function generateOptions(options, defaults) {
13176
13179
  }
13177
13180
 
13178
13181
  //#endregion
13179
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/line.js
13182
+ //#region ../../node_modules/diff/libesm/diff/line.js
13180
13183
  var LineDiff = class extends Diff {
13181
13184
  constructor() {
13182
13185
  super(...arguments);
@@ -13229,7 +13232,7 @@ function tokenize(value, options) {
13229
13232
  }
13230
13233
 
13231
13234
  //#endregion
13232
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/sentence.js
13235
+ //#region ../../node_modules/diff/libesm/diff/sentence.js
13233
13236
  function isSentenceEndPunct(char) {
13234
13237
  return char == "." || char == "!" || char == "?";
13235
13238
  }
@@ -13262,7 +13265,7 @@ function diffSentences(oldStr, newStr, options) {
13262
13265
  }
13263
13266
 
13264
13267
  //#endregion
13265
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/css.js
13268
+ //#region ../../node_modules/diff/libesm/diff/css.js
13266
13269
  var CssDiff = class extends Diff {
13267
13270
  tokenize(value) {
13268
13271
  return value.split(/([{}:;,]|\s+)/);
@@ -13274,7 +13277,7 @@ function diffCss(oldStr, newStr, options) {
13274
13277
  }
13275
13278
 
13276
13279
  //#endregion
13277
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/json.js
13280
+ //#region ../../node_modules/diff/libesm/diff/json.js
13278
13281
  var JsonDiff = class extends Diff {
13279
13282
  constructor() {
13280
13283
  super(...arguments);
@@ -13348,7 +13351,7 @@ function canonicalize(obj, stack, replacementStack, replacer, key$1) {
13348
13351
  }
13349
13352
 
13350
13353
  //#endregion
13351
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/diff/array.js
13354
+ //#region ../../node_modules/diff/libesm/diff/array.js
13352
13355
  var ArrayDiff = class extends Diff {
13353
13356
  tokenize(value) {
13354
13357
  return value.slice();
@@ -13366,7 +13369,7 @@ function diffArrays(oldArr, newArr, options) {
13366
13369
  }
13367
13370
 
13368
13371
  //#endregion
13369
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/patch/line-endings.js
13372
+ //#region ../../node_modules/diff/libesm/patch/line-endings.js
13370
13373
  function unixToWin(patch) {
13371
13374
  if (Array.isArray(patch)) {
13372
13375
  return patch.map((p$1) => unixToWin(p$1));
@@ -13406,7 +13409,7 @@ function isWin(patch) {
13406
13409
  }
13407
13410
 
13408
13411
  //#endregion
13409
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/patch/parse.js
13412
+ //#region ../../node_modules/diff/libesm/patch/parse.js
13410
13413
  /**
13411
13414
  * Parses a patch into structured data, in the same structure returned by `structuredPatch`.
13412
13415
  *
@@ -13517,7 +13520,7 @@ function parsePatch(uniDiff) {
13517
13520
  }
13518
13521
 
13519
13522
  //#endregion
13520
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/util/distance-iterator.js
13523
+ //#region ../../node_modules/diff/libesm/util/distance-iterator.js
13521
13524
  function distance_iterator_default(start, minLine, maxLine) {
13522
13525
  let wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
13523
13526
  return function iterator() {
@@ -13547,7 +13550,7 @@ function distance_iterator_default(start, minLine, maxLine) {
13547
13550
  }
13548
13551
 
13549
13552
  //#endregion
13550
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/patch/apply.js
13553
+ //#region ../../node_modules/diff/libesm/patch/apply.js
13551
13554
  /**
13552
13555
  * attempts to apply a unified diff patch.
13553
13556
  *
@@ -13766,7 +13769,7 @@ function applyPatches(uniDiff, options) {
13766
13769
  }
13767
13770
 
13768
13771
  //#endregion
13769
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/patch/reverse.js
13772
+ //#region ../../node_modules/diff/libesm/patch/reverse.js
13770
13773
  function reversePatch(structuredPatch$1) {
13771
13774
  if (Array.isArray(structuredPatch$1)) {
13772
13775
  return structuredPatch$1.map((patch) => reversePatch(patch)).reverse();
@@ -13797,7 +13800,7 @@ function reversePatch(structuredPatch$1) {
13797
13800
  }
13798
13801
 
13799
13802
  //#endregion
13800
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/patch/create.js
13803
+ //#region ../../node_modules/diff/libesm/patch/create.js
13801
13804
  const INCLUDE_HEADERS = {
13802
13805
  includeIndex: true,
13803
13806
  includeUnderline: true,
@@ -14001,7 +14004,7 @@ function splitLines(text$1) {
14001
14004
  }
14002
14005
 
14003
14006
  //#endregion
14004
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/convert/dmp.js
14007
+ //#region ../../node_modules/diff/libesm/convert/dmp.js
14005
14008
  /**
14006
14009
  * converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
14007
14010
  */
@@ -14023,7 +14026,7 @@ function convertChangesToDMP(changes) {
14023
14026
  }
14024
14027
 
14025
14028
  //#endregion
14026
- //#region ../../node_modules/.bun/diff@8.0.3/node_modules/diff/libesm/convert/xml.js
14029
+ //#region ../../node_modules/diff/libesm/convert/xml.js
14027
14030
  /**
14028
14031
  * converts a list of change objects to a serialized XML format
14029
14032
  */
@@ -14057,11 +14060,18 @@ function escapeHTML(s$1) {
14057
14060
  //#endregion
14058
14061
  //#region src/utils/cleanLastNewline.ts
14059
14062
  function cleanLastNewline(contents) {
14060
- return contents.replace(/\n$|\r\n$/, "");
14063
+ let end = contents.length;
14064
+ if (contents.charCodeAt(end - 1) === 10) {
14065
+ end--;
14066
+ if (contents.charCodeAt(end - 1) === 13) {
14067
+ end--;
14068
+ }
14069
+ }
14070
+ return contents.slice(0, end);
14061
14071
  }
14062
14072
 
14063
14073
  //#endregion
14064
- //#region ../../node_modules/.bun/@shikijs+transformers@4.0.2/node_modules/@shikijs/transformers/dist/index.mjs
14074
+ //#region ../../node_modules/@shikijs/transformers/dist/index.mjs
14065
14075
  /**
14066
14076
  * some comment formats have to be located at the end of line
14067
14077
  * hence we can skip matching them for other tokens
@@ -15001,6 +15011,19 @@ function createTransformerWithState(useTokenTransformer = false, useCSSClasses =
15001
15011
  if (useCSSClasses) {
15002
15012
  transformers.push(tokenStyleNormalizer, toClass);
15003
15013
  }
15014
+ if (useTokenTransformer) {
15015
+ transformers.push({ line: (node) => {
15016
+ if (node.type === "element" && node.children.length === 0) {
15017
+ node.children.push({
15018
+ type: "element",
15019
+ tagName: "br",
15020
+ properties: {},
15021
+ children: []
15022
+ });
15023
+ }
15024
+ return node;
15025
+ } });
15026
+ }
15004
15027
  return {
15005
15028
  state,
15006
15029
  transformers,
@@ -15168,60 +15191,6 @@ function getExpandedRegion({ isPartial, rangeSize, expandedHunks, hunkIndex, col
15168
15191
  renderAll
15169
15192
  };
15170
15193
  }
15171
- function hasTrailingContext(fileDiff) {
15172
- const lastHunk = fileDiff.hunks[fileDiff.hunks.length - 1];
15173
- if (lastHunk == null || fileDiff.isPartial || fileDiff.additionLines.length === 0 || fileDiff.deletionLines.length === 0) {
15174
- return false;
15175
- }
15176
- const additionRemaining = fileDiff.additionLines.length - (lastHunk.additionLineIndex + lastHunk.additionCount);
15177
- const deletionRemaining = fileDiff.deletionLines.length - (lastHunk.deletionLineIndex + lastHunk.deletionCount);
15178
- return additionRemaining > 0 || deletionRemaining > 0;
15179
- }
15180
- function getTrailingContextRangeSize({ fileDiff, errorPrefix }) {
15181
- const lastHunk = fileDiff.hunks[fileDiff.hunks.length - 1];
15182
- if (lastHunk == null || fileDiff.isPartial || fileDiff.additionLines.length === 0 || fileDiff.deletionLines.length === 0) {
15183
- return 0;
15184
- }
15185
- const additionRemaining = fileDiff.additionLines.length - (lastHunk.additionLineIndex + lastHunk.additionCount);
15186
- const deletionRemaining = fileDiff.deletionLines.length - (lastHunk.deletionLineIndex + lastHunk.deletionCount);
15187
- if (additionRemaining <= 0 && deletionRemaining <= 0) {
15188
- return 0;
15189
- }
15190
- if (additionRemaining !== deletionRemaining) {
15191
- throw new Error(`${errorPrefix}: trailing context mismatch (additions=${additionRemaining}, deletions=${deletionRemaining}) for ${fileDiff.name}`);
15192
- }
15193
- return Math.min(additionRemaining, deletionRemaining);
15194
- }
15195
- function getTrailingExpandedRegion({ fileDiff, hunkIndex, expandedHunks, collapsedContextThreshold, errorPrefix }) {
15196
- if (hunkIndex !== fileDiff.hunks.length - 1) {
15197
- return undefined;
15198
- }
15199
- const trailingRangeSize = getTrailingContextRangeSize({
15200
- fileDiff,
15201
- errorPrefix
15202
- });
15203
- if (trailingRangeSize <= 0) {
15204
- return undefined;
15205
- }
15206
- if (expandedHunks === true || trailingRangeSize <= collapsedContextThreshold) {
15207
- return {
15208
- fromStart: trailingRangeSize,
15209
- fromEnd: 0,
15210
- rangeSize: trailingRangeSize,
15211
- collapsedLines: 0,
15212
- renderAll: true
15213
- };
15214
- }
15215
- const region = expandedHunks?.get(fileDiff.hunks.length);
15216
- const fromStart = Math.min(Math.max(region?.fromStart ?? 0, 0), trailingRangeSize);
15217
- return {
15218
- fromStart,
15219
- fromEnd: 0,
15220
- rangeSize: trailingRangeSize,
15221
- collapsedLines: trailingRangeSize - fromStart,
15222
- renderAll: fromStart >= trailingRangeSize
15223
- };
15224
- }
15225
15194
  function getHunkSeparatorHeight({ type, metrics }) {
15226
15195
  return metrics.hunkSeparatorHeight ?? getDefaultHunkSeparatorHeight(type);
15227
15196
  }
@@ -15296,12 +15265,12 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15296
15265
  collapsedContextThreshold
15297
15266
  });
15298
15267
  const state = {
15268
+ finalHunk: diff.hunks.at(-1),
15299
15269
  viewportStart: startingLine,
15300
15270
  viewportEnd: startingLine + totalLines,
15301
15271
  isWindowedHighlight: startingLine > 0 || totalLines < Infinity,
15302
15272
  splitCount: iterationStart.splitCount,
15303
15273
  unifiedCount: iterationStart.unifiedCount,
15304
- finalHunkIndex: diff.hunks.length - 1,
15305
15274
  shouldBreak() {
15306
15275
  if (!state.isWindowedHighlight) {
15307
15276
  return false;
@@ -15386,13 +15355,24 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15386
15355
  hunkIndex,
15387
15356
  collapsedContextThreshold
15388
15357
  });
15389
- const trailingRegion = hunkIndex === state.finalHunkIndex ? getTrailingExpandedRegion({
15390
- fileDiff: diff,
15391
- hunkIndex,
15392
- expandedHunks,
15393
- collapsedContextThreshold,
15394
- errorPrefix: "iterateOverDiff"
15395
- }) : undefined;
15358
+ const trailingRegion = (() => {
15359
+ if (hunk !== state.finalHunk || !hasFinalCollapsedHunk(diff)) {
15360
+ return undefined;
15361
+ }
15362
+ const additionRemaining = diff.additionLines.length - (hunk.additionLineIndex + hunk.additionCount);
15363
+ const deletionRemaining = diff.deletionLines.length - (hunk.deletionLineIndex + hunk.deletionCount);
15364
+ if (additionRemaining !== deletionRemaining) {
15365
+ throw new Error(`iterateOverDiff: trailing context mismatch (additions=${additionRemaining}, deletions=${deletionRemaining}) for ${diff.name}`);
15366
+ }
15367
+ const trailingRangeSize = Math.min(additionRemaining, deletionRemaining);
15368
+ return getExpandedRegion({
15369
+ isPartial: diff.isPartial,
15370
+ rangeSize: trailingRangeSize,
15371
+ expandedHunks,
15372
+ hunkIndex: diff.hunks.length,
15373
+ collapsedContextThreshold
15374
+ });
15375
+ })();
15396
15376
  const expandedLineCount = leadingRegion.fromStart + leadingRegion.fromEnd;
15397
15377
  function getTrailingCollapsedAfter(unifiedLineIndex$1, splitLineIndex$1) {
15398
15378
  if (trailingRegion == null || trailingRegion.collapsedLines <= 0 || trailingRegion.fromStart + trailingRegion.fromEnd > 0) {
@@ -15403,13 +15383,13 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15403
15383
  }
15404
15384
  return splitLineIndex$1 === hunk.splitLineStart + hunk.splitLineCount - 1 ? trailingRegion.collapsedLines : 0;
15405
15385
  }
15406
- let consumedCollapsed = leadingRegion.collapsedLines === 0;
15407
- function consumePendingCollapsed() {
15408
- if (consumedCollapsed) {
15386
+ function getPendingCollapsed() {
15387
+ if (leadingRegion.collapsedLines === 0) {
15409
15388
  return 0;
15410
15389
  }
15411
- consumedCollapsed = true;
15412
- return leadingRegion.collapsedLines;
15390
+ const value = leadingRegion.collapsedLines;
15391
+ leadingRegion.collapsedLines = 0;
15392
+ return value;
15413
15393
  }
15414
15394
  if (!state.shouldSkip(expandedLineCount, expandedLineCount)) {
15415
15395
  let unifiedLineIndex$1 = hunk.unifiedLineStart - leadingRegion.rangeSize;
@@ -15418,30 +15398,44 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15418
15398
  let additionLineIndex$1 = hunk.additionLineIndex - leadingRegion.rangeSize;
15419
15399
  let deletionLineNumber$1 = hunk.deletionStart - leadingRegion.rangeSize;
15420
15400
  let additionLineNumber$1 = hunk.additionStart - leadingRegion.rangeSize;
15421
- if (walkContextLines(state, leadingRegion.fromStart, diffStyle, (index) => {
15422
- return state.emit({
15423
- hunkIndex,
15424
- hunk,
15425
- collapsedBefore: 0,
15426
- collapsedAfter: 0,
15427
- type: "context-expanded",
15428
- deletionLine: {
15429
- lineNumber: deletionLineNumber$1 + index,
15430
- lineIndex: deletionLineIndex$1 + index,
15431
- noEOFCR: false,
15432
- unifiedLineIndex: unifiedLineIndex$1 + index,
15433
- splitLineIndex: splitLineIndex$1 + index
15434
- },
15435
- additionLine: {
15436
- unifiedLineIndex: unifiedLineIndex$1 + index,
15437
- splitLineIndex: splitLineIndex$1 + index,
15438
- lineIndex: additionLineIndex$1 + index,
15439
- lineNumber: additionLineNumber$1 + index,
15440
- noEOFCR: false
15401
+ const [startIndex, endIndex] = getEqualLineIterationRange(state, leadingRegion.fromStart, diffStyle);
15402
+ if (startIndex > 0) {
15403
+ state.incrementCounts(startIndex, startIndex);
15404
+ }
15405
+ let index = startIndex;
15406
+ while (index < leadingRegion.fromStart) {
15407
+ if (index >= endIndex) {
15408
+ state.incrementCounts(leadingRegion.fromStart - index, leadingRegion.fromStart - index);
15409
+ break;
15410
+ }
15411
+ if (state.isInWindow(0, 0)) {
15412
+ if (state.emit({
15413
+ hunkIndex,
15414
+ hunk,
15415
+ collapsedBefore: 0,
15416
+ collapsedAfter: 0,
15417
+ type: "context-expanded",
15418
+ deletionLine: {
15419
+ lineNumber: deletionLineNumber$1 + index,
15420
+ lineIndex: deletionLineIndex$1 + index,
15421
+ noEOFCR: false,
15422
+ unifiedLineIndex: unifiedLineIndex$1 + index,
15423
+ splitLineIndex: splitLineIndex$1 + index
15424
+ },
15425
+ additionLine: {
15426
+ unifiedLineIndex: unifiedLineIndex$1 + index,
15427
+ splitLineIndex: splitLineIndex$1 + index,
15428
+ lineIndex: additionLineIndex$1 + index,
15429
+ lineNumber: additionLineNumber$1 + index,
15430
+ noEOFCR: false
15431
+ }
15432
+ })) {
15433
+ break hunkIterator;
15441
15434
  }
15442
- });
15443
- })) {
15444
- break hunkIterator;
15435
+ } else {
15436
+ state.incrementCounts(1, 1);
15437
+ }
15438
+ index++;
15445
15439
  }
15446
15440
  unifiedLineIndex$1 = hunk.unifiedLineStart - leadingRegion.fromEnd;
15447
15441
  splitLineIndex$1 = hunk.splitLineStart - leadingRegion.fromEnd;
@@ -15449,36 +15443,48 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15449
15443
  additionLineIndex$1 = hunk.additionLineIndex - leadingRegion.fromEnd;
15450
15444
  deletionLineNumber$1 = hunk.deletionStart - leadingRegion.fromEnd;
15451
15445
  additionLineNumber$1 = hunk.additionStart - leadingRegion.fromEnd;
15452
- if (walkContextLines(state, leadingRegion.fromEnd, diffStyle, (index) => {
15453
- return state.emit({
15454
- hunkIndex,
15455
- hunk,
15456
- collapsedBefore: consumePendingCollapsed(),
15457
- collapsedAfter: 0,
15458
- type: "context-expanded",
15459
- deletionLine: {
15460
- lineNumber: deletionLineNumber$1 + index,
15461
- lineIndex: deletionLineIndex$1 + index,
15462
- noEOFCR: false,
15463
- unifiedLineIndex: unifiedLineIndex$1 + index,
15464
- splitLineIndex: splitLineIndex$1 + index
15465
- },
15466
- additionLine: {
15467
- unifiedLineIndex: unifiedLineIndex$1 + index,
15468
- splitLineIndex: splitLineIndex$1 + index,
15469
- lineIndex: additionLineIndex$1 + index,
15470
- lineNumber: additionLineNumber$1 + index,
15471
- noEOFCR: false
15446
+ const [fromEndStartIndex, fromEndEndIndex] = getEqualLineIterationRange(state, leadingRegion.fromEnd, diffStyle);
15447
+ if (fromEndStartIndex > 0) {
15448
+ state.incrementCounts(fromEndStartIndex, fromEndStartIndex);
15449
+ }
15450
+ index = fromEndStartIndex;
15451
+ while (index < leadingRegion.fromEnd) {
15452
+ if (index >= fromEndEndIndex) {
15453
+ state.incrementCounts(leadingRegion.fromEnd - index, leadingRegion.fromEnd - index);
15454
+ break;
15455
+ }
15456
+ if (state.isInWindow(0, 0)) {
15457
+ if (state.emit({
15458
+ hunkIndex,
15459
+ hunk,
15460
+ collapsedBefore: getPendingCollapsed(),
15461
+ collapsedAfter: 0,
15462
+ type: "context-expanded",
15463
+ deletionLine: {
15464
+ lineNumber: deletionLineNumber$1 + index,
15465
+ lineIndex: deletionLineIndex$1 + index,
15466
+ noEOFCR: false,
15467
+ unifiedLineIndex: unifiedLineIndex$1 + index,
15468
+ splitLineIndex: splitLineIndex$1 + index
15469
+ },
15470
+ additionLine: {
15471
+ unifiedLineIndex: unifiedLineIndex$1 + index,
15472
+ splitLineIndex: splitLineIndex$1 + index,
15473
+ lineIndex: additionLineIndex$1 + index,
15474
+ lineNumber: additionLineNumber$1 + index,
15475
+ noEOFCR: false
15476
+ }
15477
+ })) {
15478
+ break hunkIterator;
15472
15479
  }
15473
- });
15474
- }, () => {
15475
- consumePendingCollapsed();
15476
- })) {
15477
- break hunkIterator;
15480
+ } else {
15481
+ state.incrementCounts(1, 1);
15482
+ }
15483
+ index++;
15478
15484
  }
15479
15485
  } else {
15480
15486
  state.incrementCounts(expandedLineCount, expandedLineCount);
15481
- consumePendingCollapsed();
15487
+ getPendingCollapsed();
15482
15488
  }
15483
15489
  let unifiedLineIndex = hunk.unifiedLineStart;
15484
15490
  let splitLineIndex = hunk.splitLineStart;
@@ -15494,39 +15500,51 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15494
15500
  const isLastContent = content === lastContent;
15495
15501
  if (content.type === "context") {
15496
15502
  if (!state.shouldSkip(content.lines, content.lines)) {
15497
- if (walkContextLines(state, content.lines, diffStyle, (index) => {
15498
- const isLastLine = isLastContent && index === content.lines - 1;
15499
- const unifiedRowIndex = unifiedLineIndex + index;
15500
- const splitRowIndex = splitLineIndex + index;
15501
- return state.emit({
15502
- hunkIndex,
15503
- hunk,
15504
- collapsedBefore: consumePendingCollapsed(),
15505
- collapsedAfter: getTrailingCollapsedAfter(unifiedRowIndex, splitRowIndex),
15506
- type: "context",
15507
- deletionLine: {
15508
- lineNumber: deletionLineNumber + index,
15509
- lineIndex: deletionLineIndex + index,
15510
- noEOFCR: isLastLine && hunk.noEOFCRDeletions,
15511
- unifiedLineIndex: unifiedRowIndex,
15512
- splitLineIndex: splitRowIndex
15513
- },
15514
- additionLine: {
15515
- unifiedLineIndex: unifiedRowIndex,
15516
- splitLineIndex: splitRowIndex,
15517
- lineIndex: additionLineIndex + index,
15518
- lineNumber: additionLineNumber + index,
15519
- noEOFCR: isLastLine && hunk.noEOFCRAdditions
15503
+ const [startIndex, endIndex] = getEqualLineIterationRange(state, content.lines, diffStyle);
15504
+ if (startIndex > 0) {
15505
+ state.incrementCounts(startIndex, startIndex);
15506
+ }
15507
+ let index = startIndex;
15508
+ while (index < content.lines) {
15509
+ if (index >= endIndex) {
15510
+ state.incrementCounts(content.lines - index, content.lines - index);
15511
+ break;
15512
+ }
15513
+ if (state.isInWindow(0, 0)) {
15514
+ const isLastLine = isLastContent && index === content.lines - 1;
15515
+ const unifiedRowIndex = unifiedLineIndex + index;
15516
+ const splitRowIndex = splitLineIndex + index;
15517
+ if (state.emit({
15518
+ hunkIndex,
15519
+ hunk,
15520
+ collapsedBefore: getPendingCollapsed(),
15521
+ collapsedAfter: getTrailingCollapsedAfter(unifiedRowIndex, splitRowIndex),
15522
+ type: "context",
15523
+ deletionLine: {
15524
+ lineNumber: deletionLineNumber + index,
15525
+ lineIndex: deletionLineIndex + index,
15526
+ noEOFCR: isLastLine && hunk.noEOFCRDeletions,
15527
+ unifiedLineIndex: unifiedRowIndex,
15528
+ splitLineIndex: splitRowIndex
15529
+ },
15530
+ additionLine: {
15531
+ unifiedLineIndex: unifiedRowIndex,
15532
+ splitLineIndex: splitRowIndex,
15533
+ lineIndex: additionLineIndex + index,
15534
+ lineNumber: additionLineNumber + index,
15535
+ noEOFCR: isLastLine && hunk.noEOFCRAdditions
15536
+ }
15537
+ })) {
15538
+ break hunkIterator;
15520
15539
  }
15521
- });
15522
- }, () => {
15523
- consumePendingCollapsed();
15524
- })) {
15525
- break hunkIterator;
15540
+ } else {
15541
+ state.incrementCounts(1, 1);
15542
+ }
15543
+ index++;
15526
15544
  }
15527
15545
  } else {
15528
15546
  state.incrementCounts(content.lines, content.lines);
15529
- consumePendingCollapsed();
15547
+ getPendingCollapsed();
15530
15548
  }
15531
15549
  unifiedLineIndex += content.lines;
15532
15550
  splitLineIndex += content.lines;
@@ -15540,10 +15558,6 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15540
15558
  const shouldSkipChange = state.shouldSkip(unifiedCount, splitCount);
15541
15559
  if (!shouldSkipChange) {
15542
15560
  const iterationRanges = getChangeIterationRanges(state, content, diffStyle);
15543
- const firstRangeStart = iterationRanges[0]?.[0] ?? 0;
15544
- if (firstRangeStart > 0) {
15545
- consumePendingCollapsed();
15546
- }
15547
15561
  for (const [rangeStart, rangeEnd] of iterationRanges) {
15548
15562
  for (let index = rangeStart; index < rangeEnd; index++) {
15549
15563
  const unifiedRowIndex = unifiedLineIndex + index;
@@ -15552,7 +15566,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15552
15566
  if (state.emit(getChangeLineData({
15553
15567
  hunkIndex,
15554
15568
  hunk,
15555
- collapsedBefore: consumePendingCollapsed(),
15569
+ collapsedBefore: getPendingCollapsed(),
15556
15570
  collapsedAfter,
15557
15571
  diffStyle,
15558
15572
  index,
@@ -15572,7 +15586,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15572
15586
  }
15573
15587
  }
15574
15588
  }
15575
- consumePendingCollapsed();
15589
+ getPendingCollapsed();
15576
15590
  state.incrementCounts(unifiedCount, splitCount);
15577
15591
  unifiedLineIndex += unifiedCount;
15578
15592
  splitLineIndex += splitCount;
@@ -15585,31 +15599,48 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
15585
15599
  if (trailingRegion != null) {
15586
15600
  const { collapsedLines, fromStart, fromEnd } = trailingRegion;
15587
15601
  const len = fromStart + fromEnd;
15588
- if (walkContextLines(state, len, diffStyle, (index) => {
15589
- const isLastLine = index === len - 1;
15590
- return state.emit({
15591
- hunkIndex: diff.hunks.length,
15592
- hunk: undefined,
15593
- collapsedBefore: 0,
15594
- collapsedAfter: isLastLine ? collapsedLines : 0,
15595
- type: "context-expanded",
15596
- deletionLine: {
15597
- lineNumber: deletionLineNumber + index,
15598
- lineIndex: deletionLineIndex + index,
15599
- noEOFCR: false,
15600
- unifiedLineIndex: unifiedLineIndex + index,
15601
- splitLineIndex: splitLineIndex + index
15602
- },
15603
- additionLine: {
15604
- unifiedLineIndex: unifiedLineIndex + index,
15605
- splitLineIndex: splitLineIndex + index,
15606
- lineIndex: additionLineIndex + index,
15607
- lineNumber: additionLineNumber + index,
15608
- noEOFCR: false
15602
+ const [startIndex, endIndex] = getEqualLineIterationRange(state, len, diffStyle);
15603
+ if (startIndex > 0) {
15604
+ state.incrementCounts(startIndex, startIndex);
15605
+ }
15606
+ let index = startIndex;
15607
+ while (index < len) {
15608
+ if (state.shouldBreak()) {
15609
+ break hunkIterator;
15610
+ }
15611
+ if (index >= endIndex) {
15612
+ state.incrementCounts(len - index, len - index);
15613
+ break;
15614
+ }
15615
+ if (state.isInWindow(0, 0)) {
15616
+ const isLastLine = index === len - 1;
15617
+ if (state.emit({
15618
+ hunkIndex: diff.hunks.length,
15619
+ hunk: undefined,
15620
+ collapsedBefore: 0,
15621
+ collapsedAfter: isLastLine ? collapsedLines : 0,
15622
+ type: "context-expanded",
15623
+ deletionLine: {
15624
+ lineNumber: deletionLineNumber + index,
15625
+ lineIndex: deletionLineIndex + index,
15626
+ noEOFCR: false,
15627
+ unifiedLineIndex: unifiedLineIndex + index,
15628
+ splitLineIndex: splitLineIndex + index
15629
+ },
15630
+ additionLine: {
15631
+ unifiedLineIndex: unifiedLineIndex + index,
15632
+ splitLineIndex: splitLineIndex + index,
15633
+ lineIndex: additionLineIndex + index,
15634
+ lineNumber: additionLineNumber + index,
15635
+ noEOFCR: false
15636
+ }
15637
+ })) {
15638
+ break hunkIterator;
15609
15639
  }
15610
- });
15611
- }, undefined, () => state.shouldBreak())) {
15612
- break hunkIterator;
15640
+ } else {
15641
+ state.incrementCounts(1, 1);
15642
+ }
15643
+ index++;
15613
15644
  }
15614
15645
  }
15615
15646
  }
@@ -15688,14 +15719,15 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
15688
15719
  const leadingCount = leadingRegion.fromStart + leadingRegion.fromEnd;
15689
15720
  splitCount += leadingCount + hunk.splitLineCount;
15690
15721
  unifiedCount += leadingCount + hunk.unifiedLineCount;
15691
- const trailingRegion = index === finalHunkIndex ? getTrailingExpandedRegion({
15692
- fileDiff: diff,
15693
- hunkIndex: index,
15694
- expandedHunks,
15695
- collapsedContextThreshold,
15696
- errorPrefix: "iterateOverDiff"
15697
- }) : undefined;
15698
- if (trailingRegion != null) {
15722
+ if (index === finalHunkIndex && hasFinalCollapsedHunk(diff)) {
15723
+ const trailingRangeSize = getTrailingRangeSize(diff, hunk);
15724
+ const trailingRegion = getExpandedRegion({
15725
+ isPartial: diff.isPartial,
15726
+ rangeSize: trailingRangeSize,
15727
+ expandedHunks,
15728
+ hunkIndex: diff.hunks.length,
15729
+ collapsedContextThreshold
15730
+ });
15699
15731
  const trailingCount = trailingRegion.fromStart + trailingRegion.fromEnd;
15700
15732
  splitCount += trailingCount;
15701
15733
  unifiedCount += trailingCount;
@@ -15707,7 +15739,7 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
15707
15739
  }
15708
15740
  return prefixCounts;
15709
15741
  }
15710
- function getContextLineIterationBounds(state, count, diffStyle) {
15742
+ function getEqualLineIterationRange(state, count, diffStyle) {
15711
15743
  if (!state.isWindowedHighlight || count <= 0) {
15712
15744
  return [0, count];
15713
15745
  }
@@ -15737,31 +15769,20 @@ function getContextLineIterationBounds(state, count, diffStyle) {
15737
15769
  }
15738
15770
  return [start, end];
15739
15771
  }
15740
- function walkContextLines(state, count, diffStyle, callback, onSkippedStart, shouldBreak) {
15741
- const [startIndex, endIndex] = getContextLineIterationBounds(state, count, diffStyle);
15742
- if (startIndex > 0) {
15743
- state.incrementCounts(startIndex, startIndex);
15744
- onSkippedStart?.();
15772
+ function getTrailingRangeSize(diff, hunk) {
15773
+ const additionRemaining = diff.additionLines.length - (hunk.additionLineIndex + hunk.additionCount);
15774
+ const deletionRemaining = diff.deletionLines.length - (hunk.deletionLineIndex + hunk.deletionCount);
15775
+ if (additionRemaining !== deletionRemaining) {
15776
+ throw new Error(`iterateOverDiff: trailing context mismatch (additions=${additionRemaining}, deletions=${deletionRemaining}) for ${diff.name}`);
15745
15777
  }
15746
- let index = startIndex;
15747
- while (index < count) {
15748
- if (shouldBreak?.() === true) {
15749
- return true;
15750
- }
15751
- if (index >= endIndex) {
15752
- state.incrementCounts(count - index, count - index);
15753
- break;
15754
- }
15755
- if (state.isInWindow(0, 0)) {
15756
- if (callback(index) === true) {
15757
- return true;
15758
- }
15759
- } else {
15760
- state.incrementCounts(1, 1);
15761
- }
15762
- index++;
15778
+ return Math.min(additionRemaining, deletionRemaining);
15779
+ }
15780
+ function hasFinalCollapsedHunk(diff) {
15781
+ const lastHunk = diff.hunks.at(-1);
15782
+ if (lastHunk == null || diff.isPartial || diff.additionLines.length === 0 || diff.deletionLines.length === 0) {
15783
+ return false;
15763
15784
  }
15764
- return false;
15785
+ return lastHunk.additionLineIndex + lastHunk.additionCount < diff.additionLines.length || lastHunk.deletionLineIndex + lastHunk.deletionCount < diff.deletionLines.length;
15765
15786
  }
15766
15787
  function getChangeIterationRanges(state, content, diffStyle) {
15767
15788
  if (!state.isWindowedHighlight) {
@@ -16193,67 +16214,37 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
16193
16214
  }
16194
16215
 
16195
16216
  //#endregion
16196
- //#region src/utils/iterateOverFile.ts
16217
+ //#region src/utils/computeFileOffsets.ts
16218
+ const LINE_FEED = 10;
16219
+ const CARRIAGE_RETURN = 13;
16197
16220
  /**
16198
- * Iterates over lines in a file with optional windowing support.
16199
- *
16200
- * Similar to `iterateOverDiff` but simplified for linear file content.
16201
- * Supports viewport windowing for virtualization scenarios.
16202
- *
16203
- * @param props - Configuration for iteration
16204
- * @param props.lines - Pre-split array of lines (use splitFileContents() to create from string)
16205
- * @param props.startingLine - Optional starting line index (0-based, default: 0)
16206
- * @param props.totalLines - Optional max lines to iterate (default: Infinity)
16207
- * @param props.callback - Callback invoked for each line in the window.
16208
- * Return `true` to stop iteration early.
16209
- *
16210
- * @example
16211
- * ```typescript
16212
- * const lines = splitFileContents('line1\nline2\nline3');
16213
- * iterateOverFile({
16214
- * lines,
16215
- * startingLine: 0,
16216
- * totalLines: 10,
16217
- * callback: ({ lineIndex, lineNumber, content, isLastLine }) => {
16218
- * console.log(`Line ${lineNumber}: ${content}`);
16219
- * if (content.includes('stop')) return true; // Stop iteration
16220
- * }
16221
- * });
16222
- * ```
16221
+ * Computes line start offsets for a string.
16223
16222
  */
16224
- function iterateOverFile({ lines, startingLine = 0, totalLines = Infinity, callback }) {
16225
- const len = Math.min(startingLine + totalLines, lines.length);
16226
- const lastLineIndex = (() => {
16227
- const lastLine = lines.at(-1);
16228
- if (lastLine === "" || lastLine === "\n" || lastLine === "\r\n" || lastLine === "\r") {
16229
- return Math.max(0, lines.length - 2);
16230
- }
16231
- return lines.length - 1;
16232
- })();
16233
- for (let lineIndex = startingLine; lineIndex < len; lineIndex++) {
16234
- const isLastLine = lineIndex === lastLineIndex;
16235
- if (callback({
16236
- lineIndex,
16237
- lineNumber: lineIndex + 1,
16238
- content: lines[lineIndex],
16239
- isLastLine
16240
- }) === true || isLastLine) {
16241
- break;
16223
+ function computeLineOffsets(contents) {
16224
+ const offsets = [0];
16225
+ for (let i$2 = 0; i$2 < contents.length; i$2++) {
16226
+ const char = contents.charCodeAt(i$2);
16227
+ if (char === LINE_FEED || char === CARRIAGE_RETURN) {
16228
+ if (char === CARRIAGE_RETURN && i$2 + 1 < contents.length && contents.charCodeAt(i$2 + 1) === LINE_FEED) {
16229
+ i$2++;
16230
+ }
16231
+ offsets.push(i$2 + 1);
16242
16232
  }
16243
16233
  }
16234
+ return offsets;
16244
16235
  }
16245
-
16246
- //#endregion
16247
- //#region src/utils/splitFileContents.ts
16248
16236
  /**
16249
- * Splits file contents into lines using the same logic as diff parsing.
16250
- * - Preserves trailing newlines on each line
16251
- *
16252
- * @param contents - The raw file contents string
16253
- * @returns Array of lines with newlines preserved
16237
+ * Splits file contents into lines aligned with {@link computeLineOffsets}.
16238
+ * Unlike splitFileContents, a trailing newline produces a final empty line.
16254
16239
  */
16255
- function splitFileContents(contents) {
16256
- return contents !== "" ? contents.split(SPLIT_WITH_NEWLINES) : [];
16240
+ function linesFromFileContents(contents) {
16241
+ const offsets = computeLineOffsets(contents);
16242
+ const lines = Array.from({ length: offsets.length }, (_$2, i$2) => {
16243
+ const start = offsets[i$2];
16244
+ const end = offsets[i$2 + 1] ?? contents.length;
16245
+ return contents.slice(start, end);
16246
+ });
16247
+ return lines;
16257
16248
  }
16258
16249
 
16259
16250
  //#endregion
@@ -16300,7 +16291,7 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
16300
16291
  tokenizeMaxLineLength
16301
16292
  };
16302
16293
  })();
16303
- const highlightedLines = getLineNodes(highlighter$1.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? splitFileContents(file.contents), startingLine, totalLines) : cleanLastNewline(file.contents), hastConfig));
16294
+ const highlightedLines = getLineNodes(highlighter$1.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? linesFromFileContents(file.contents), startingLine, totalLines) : file.contents, hastConfig));
16304
16295
  const code = isWindowedHighlight ? new Array(startingLine) : highlightedLines;
16305
16296
  if (isWindowedHighlight) {
16306
16297
  code.push(...highlightedLines);
@@ -16312,16 +16303,11 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
16312
16303
  };
16313
16304
  }
16314
16305
  function extractWindowedFileContent(lines, startingLine, totalLines) {
16315
- let windowContent = "";
16316
- iterateOverFile({
16317
- lines,
16318
- startingLine,
16319
- totalLines,
16320
- callback({ content }) {
16321
- windowContent += content;
16322
- }
16323
- });
16324
- return windowContent;
16306
+ if (lines.length === 0) {
16307
+ return "";
16308
+ }
16309
+ const endLine = Math.min(startingLine + totalLines, lines.length);
16310
+ return lines.slice(startingLine, endLine).join("");
16325
16311
  }
16326
16312
 
16327
16313
  //#endregion
@@ -16438,7 +16424,7 @@ function getHighlighter(preferredHighlighter = "shiki-js") {
16438
16424
  highlighter ??= createHighlighterCore({
16439
16425
  themes: [],
16440
16426
  langs: [],
16441
- engine: preferredHighlighter === "shiki-wasm" ? createOnigurumaEngine(import("./wasm-BaDzIkIn.js")) : createJavaScriptRegexEngine()
16427
+ engine: preferredHighlighter === "shiki-wasm" ? createOnigurumaEngine(import("./wasm-D4DU5jgR.js")) : createJavaScriptRegexEngine()
16442
16428
  });
16443
16429
  return highlighter;
16444
16430
  }