@forsakringskassan/docs-generator 2.28.1 → 2.28.3

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.
@@ -16310,21 +16310,6 @@ function commonjsRequire(path) {
16310
16310
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
16311
16311
  }
16312
16312
 
16313
- var registerTs = {};
16314
-
16315
- var hasRequiredRegisterTs;
16316
-
16317
- function requireRegisterTs () {
16318
- if (hasRequiredRegisterTs) return registerTs;
16319
- hasRequiredRegisterTs = 1;
16320
- if (typeof commonjsRequire !== 'undefined') {
16321
- require$$0$1.registerTS(() => require$$1);
16322
- }
16323
- return registerTs;
16324
- }
16325
-
16326
- requireRegisterTs();
16327
-
16328
16313
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16329
16314
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16330
16315
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -20757,6 +20742,21 @@ const closest = (str, arr) => {
20757
20742
  return arr[min_index];
20758
20743
  };
20759
20744
 
20745
+ var registerTs = {};
20746
+
20747
+ var hasRequiredRegisterTs;
20748
+
20749
+ function requireRegisterTs () {
20750
+ if (hasRequiredRegisterTs) return registerTs;
20751
+ hasRequiredRegisterTs = 1;
20752
+ if (typeof commonjsRequire !== 'undefined') {
20753
+ require$$0$1.registerTS(() => require$$1);
20754
+ }
20755
+ return registerTs;
20756
+ }
20757
+
20758
+ requireRegisterTs();
20759
+
20760
20760
  var ciInfo = {};
20761
20761
 
20762
20762
  var require$$0 = [
@@ -24929,7 +24929,7 @@ class LanguageUtil {
24929
24929
  return found || [];
24930
24930
  }
24931
24931
  toResolveHierarchy(code, fallbackCode) {
24932
- const fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
24932
+ const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
24933
24933
  const codes = [];
24934
24934
  const addCode = c => {
24935
24935
  if (!c) return;
@@ -28470,14 +28470,11 @@ function deflist_plugin (md) {
28470
28470
  md.block.ruler.before('paragraph', 'deflist', deflist, { alt: ['paragraph', 'reference', 'blockquote'] });
28471
28471
  }
28472
28472
 
28473
- var Diff = /** @class */ (function () {
28474
- function Diff() {
28475
- }
28476
- Diff.prototype.diff = function (oldStr, newStr,
28473
+ class Diff {
28474
+ diff(oldStr, newStr,
28477
28475
  // Type below is not accurate/complete - see above for full possibilities - but it compiles
28478
- options) {
28479
- if (options === void 0) { options = {}; }
28480
- var callback;
28476
+ options = {}) {
28477
+ let callback;
28481
28478
  if (typeof options === 'function') {
28482
28479
  callback = options;
28483
28480
  options = {};
@@ -28486,17 +28483,16 @@ var Diff = /** @class */ (function () {
28486
28483
  callback = options.callback;
28487
28484
  }
28488
28485
  // Allow subclasses to massage the input prior to running
28489
- var oldString = this.castInput(oldStr, options);
28490
- var newString = this.castInput(newStr, options);
28491
- var oldTokens = this.removeEmpty(this.tokenize(oldString, options));
28492
- var newTokens = this.removeEmpty(this.tokenize(newString, options));
28486
+ const oldString = this.castInput(oldStr, options);
28487
+ const newString = this.castInput(newStr, options);
28488
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
28489
+ const newTokens = this.removeEmpty(this.tokenize(newString, options));
28493
28490
  return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
28494
- };
28495
- Diff.prototype.diffWithOptionsObj = function (oldTokens, newTokens, options, callback) {
28496
- var _this = this;
28491
+ }
28492
+ diffWithOptionsObj(oldTokens, newTokens, options, callback) {
28497
28493
  var _a;
28498
- var done = function (value) {
28499
- value = _this.postProcess(value, options);
28494
+ const done = (value) => {
28495
+ value = this.postProcess(value, options);
28500
28496
  if (callback) {
28501
28497
  setTimeout(function () { callback(value); }, 0);
28502
28498
  return undefined;
@@ -28505,17 +28501,17 @@ var Diff = /** @class */ (function () {
28505
28501
  return value;
28506
28502
  }
28507
28503
  };
28508
- var newLen = newTokens.length, oldLen = oldTokens.length;
28509
- var editLength = 1;
28510
- var maxEditLength = newLen + oldLen;
28504
+ const newLen = newTokens.length, oldLen = oldTokens.length;
28505
+ let editLength = 1;
28506
+ let maxEditLength = newLen + oldLen;
28511
28507
  if (options.maxEditLength != null) {
28512
28508
  maxEditLength = Math.min(maxEditLength, options.maxEditLength);
28513
28509
  }
28514
- var maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
28515
- var abortAfterTimestamp = Date.now() + maxExecutionTime;
28516
- var bestPath = [{ oldPos: -1, lastComponent: undefined }];
28510
+ const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
28511
+ const abortAfterTimestamp = Date.now() + maxExecutionTime;
28512
+ const bestPath = [{ oldPos: -1, lastComponent: undefined }];
28517
28513
  // Seed editLength = 0, i.e. the content starts with the same values
28518
- var newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
28514
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
28519
28515
  if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
28520
28516
  // Identity per the equality and tokenizer
28521
28517
  return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
@@ -28537,24 +28533,24 @@ var Diff = /** @class */ (function () {
28537
28533
  // where the new text simply appends d characters on the end of the
28538
28534
  // original text of length n, the true Myers algorithm will take O(n+d^2)
28539
28535
  // time while this optimization needs only O(n+d) time.
28540
- var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
28536
+ let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
28541
28537
  // Main worker method. checks all permutations of a given edit length for acceptance.
28542
- var execEditLength = function () {
28543
- for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
28544
- var basePath = void 0;
28545
- var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
28538
+ const execEditLength = () => {
28539
+ for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
28540
+ let basePath;
28541
+ const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
28546
28542
  if (removePath) {
28547
28543
  // No one else is going to attempt to use this value, clear it
28548
28544
  // @ts-expect-error - perf optimisation. This type-violating value will never be read.
28549
28545
  bestPath[diagonalPath - 1] = undefined;
28550
28546
  }
28551
- var canAdd = false;
28547
+ let canAdd = false;
28552
28548
  if (addPath) {
28553
28549
  // what newPos will be after we do an insertion:
28554
- var addPathNewPos = addPath.oldPos - diagonalPath;
28550
+ const addPathNewPos = addPath.oldPos - diagonalPath;
28555
28551
  canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
28556
28552
  }
28557
- var canRemove = removePath && removePath.oldPos + 1 < oldLen;
28553
+ const canRemove = removePath && removePath.oldPos + 1 < oldLen;
28558
28554
  if (!canAdd && !canRemove) {
28559
28555
  // If this path is a terminal then prune
28560
28556
  // @ts-expect-error - perf optimisation. This type-violating value will never be read.
@@ -28565,15 +28561,15 @@ var Diff = /** @class */ (function () {
28565
28561
  // path whose position in the old string is the farthest from the origin
28566
28562
  // and does not pass the bounds of the diff graph
28567
28563
  if (!canRemove || (canAdd && removePath.oldPos < addPath.oldPos)) {
28568
- basePath = _this.addToPath(addPath, true, false, 0, options);
28564
+ basePath = this.addToPath(addPath, true, false, 0, options);
28569
28565
  }
28570
28566
  else {
28571
- basePath = _this.addToPath(removePath, false, true, 1, options);
28567
+ basePath = this.addToPath(removePath, false, true, 1, options);
28572
28568
  }
28573
- newPos = _this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
28569
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
28574
28570
  if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
28575
28571
  // If we have hit the end of both strings, then we are done
28576
- return done(_this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
28572
+ return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
28577
28573
  }
28578
28574
  else {
28579
28575
  bestPath[diagonalPath] = basePath;
@@ -28605,15 +28601,15 @@ var Diff = /** @class */ (function () {
28605
28601
  }
28606
28602
  else {
28607
28603
  while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
28608
- var ret = execEditLength();
28604
+ const ret = execEditLength();
28609
28605
  if (ret) {
28610
28606
  return ret;
28611
28607
  }
28612
28608
  }
28613
28609
  }
28614
- };
28615
- Diff.prototype.addToPath = function (path, added, removed, oldPosInc, options) {
28616
- var last = path.lastComponent;
28610
+ }
28611
+ addToPath(path, added, removed, oldPosInc, options) {
28612
+ const last = path.lastComponent;
28617
28613
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
28618
28614
  return {
28619
28615
  oldPos: path.oldPos + oldPosInc,
@@ -28626,10 +28622,10 @@ var Diff = /** @class */ (function () {
28626
28622
  lastComponent: { count: 1, added: added, removed: removed, previousComponent: last }
28627
28623
  };
28628
28624
  }
28629
- };
28630
- Diff.prototype.extractCommon = function (basePath, newTokens, oldTokens, diagonalPath, options) {
28631
- var newLen = newTokens.length, oldLen = oldTokens.length;
28632
- var oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
28625
+ }
28626
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
28627
+ const newLen = newTokens.length, oldLen = oldTokens.length;
28628
+ let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
28633
28629
  while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
28634
28630
  newPos++;
28635
28631
  oldPos++;
@@ -28643,8 +28639,8 @@ var Diff = /** @class */ (function () {
28643
28639
  }
28644
28640
  basePath.oldPos = oldPos;
28645
28641
  return newPos;
28646
- };
28647
- Diff.prototype.equals = function (left, right, options) {
28642
+ }
28643
+ equals(left, right, options) {
28648
28644
  if (options.comparator) {
28649
28645
  return options.comparator(left, right);
28650
28646
  }
@@ -28652,48 +28648,44 @@ var Diff = /** @class */ (function () {
28652
28648
  return left === right
28653
28649
  || (!!options.ignoreCase && left.toLowerCase() === right.toLowerCase());
28654
28650
  }
28655
- };
28656
- Diff.prototype.removeEmpty = function (array) {
28657
- var ret = [];
28658
- for (var i = 0; i < array.length; i++) {
28651
+ }
28652
+ removeEmpty(array) {
28653
+ const ret = [];
28654
+ for (let i = 0; i < array.length; i++) {
28659
28655
  if (array[i]) {
28660
28656
  ret.push(array[i]);
28661
28657
  }
28662
28658
  }
28663
28659
  return ret;
28664
- };
28660
+ }
28665
28661
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
28666
- Diff.prototype.castInput = function (value, options) {
28662
+ castInput(value, options) {
28667
28663
  return value;
28668
- };
28664
+ }
28669
28665
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
28670
- Diff.prototype.tokenize = function (value, options) {
28666
+ tokenize(value, options) {
28671
28667
  return Array.from(value);
28672
- };
28673
- Diff.prototype.join = function (chars) {
28668
+ }
28669
+ join(chars) {
28674
28670
  // Assumes ValueT is string, which is the case for most subclasses.
28675
28671
  // When it's false, e.g. in diffArrays, this method needs to be overridden (e.g. with a no-op)
28676
28672
  // Yes, the casts are verbose and ugly, because this pattern - of having the base class SORT OF
28677
28673
  // assume tokens and values are strings, but not completely - is weird and janky.
28678
28674
  return chars.join('');
28679
- };
28680
- Diff.prototype.postProcess = function (changeObjects,
28675
+ }
28676
+ postProcess(changeObjects,
28681
28677
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
28682
28678
  options) {
28683
28679
  return changeObjects;
28684
- };
28685
- Object.defineProperty(Diff.prototype, "useLongestToken", {
28686
- get: function () {
28687
- return false;
28688
- },
28689
- enumerable: false,
28690
- configurable: true
28691
- });
28692
- Diff.prototype.buildValues = function (lastComponent, newTokens, oldTokens) {
28680
+ }
28681
+ get useLongestToken() {
28682
+ return false;
28683
+ }
28684
+ buildValues(lastComponent, newTokens, oldTokens) {
28693
28685
  // First we convert our linked list of components in reverse order to an
28694
28686
  // array in the right order:
28695
- var components = [];
28696
- var nextComponent;
28687
+ const components = [];
28688
+ let nextComponent;
28697
28689
  while (lastComponent) {
28698
28690
  components.push(lastComponent);
28699
28691
  nextComponent = lastComponent.previousComponent;
@@ -28701,15 +28693,15 @@ var Diff = /** @class */ (function () {
28701
28693
  lastComponent = nextComponent;
28702
28694
  }
28703
28695
  components.reverse();
28704
- var componentLen = components.length;
28705
- var componentPos = 0, newPos = 0, oldPos = 0;
28696
+ const componentLen = components.length;
28697
+ let componentPos = 0, newPos = 0, oldPos = 0;
28706
28698
  for (; componentPos < componentLen; componentPos++) {
28707
- var component = components[componentPos];
28699
+ const component = components[componentPos];
28708
28700
  if (!component.removed) {
28709
28701
  if (!component.added && this.useLongestToken) {
28710
- var value = newTokens.slice(newPos, newPos + component.count);
28702
+ let value = newTokens.slice(newPos, newPos + component.count);
28711
28703
  value = value.map(function (value, i) {
28712
- var oldValue = oldTokens[oldPos + i];
28704
+ const oldValue = oldTokens[oldPos + i];
28713
28705
  return oldValue.length > value.length ? oldValue : value;
28714
28706
  });
28715
28707
  component.value = this.join(value);
@@ -28729,462 +28721,15 @@ var Diff = /** @class */ (function () {
28729
28721
  }
28730
28722
  }
28731
28723
  return components;
28732
- };
28733
- return Diff;
28734
- }());
28735
-
28736
- var __extends$6 = (undefined && undefined.__extends) || (function () {
28737
- var extendStatics = function (d, b) {
28738
- extendStatics = Object.setPrototypeOf ||
28739
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28740
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
28741
- return extendStatics(d, b);
28742
- };
28743
- return function (d, b) {
28744
- if (typeof b !== "function" && b !== null)
28745
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
28746
- extendStatics(d, b);
28747
- function __() { this.constructor = d; }
28748
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28749
- };
28750
- })();
28751
- var CharacterDiff = /** @class */ (function (_super) {
28752
- __extends$6(CharacterDiff, _super);
28753
- function CharacterDiff() {
28754
- return _super !== null && _super.apply(this, arguments) || this;
28755
- }
28756
- return CharacterDiff;
28757
- }(Diff));
28758
- new CharacterDiff();
28759
-
28760
- function longestCommonPrefix(str1, str2) {
28761
- var i;
28762
- for (i = 0; i < str1.length && i < str2.length; i++) {
28763
- if (str1[i] != str2[i]) {
28764
- return str1.slice(0, i);
28765
- }
28766
28724
  }
28767
- return str1.slice(0, i);
28768
- }
28769
- function longestCommonSuffix(str1, str2) {
28770
- var i;
28771
- // Unlike longestCommonPrefix, we need a special case to handle all scenarios
28772
- // where we return the empty string since str1.slice(-0) will return the
28773
- // entire string.
28774
- if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
28775
- return '';
28776
- }
28777
- for (i = 0; i < str1.length && i < str2.length; i++) {
28778
- if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
28779
- return str1.slice(-i);
28780
- }
28781
- }
28782
- return str1.slice(-i);
28783
- }
28784
- function replacePrefix(string, oldPrefix, newPrefix) {
28785
- if (string.slice(0, oldPrefix.length) != oldPrefix) {
28786
- throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
28787
- }
28788
- return newPrefix + string.slice(oldPrefix.length);
28789
- }
28790
- function replaceSuffix(string, oldSuffix, newSuffix) {
28791
- if (!oldSuffix) {
28792
- return string + newSuffix;
28793
- }
28794
- if (string.slice(-oldSuffix.length) != oldSuffix) {
28795
- throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
28796
- }
28797
- return string.slice(0, -oldSuffix.length) + newSuffix;
28798
- }
28799
- function removePrefix(string, oldPrefix) {
28800
- return replacePrefix(string, oldPrefix, '');
28801
- }
28802
- function removeSuffix(string, oldSuffix) {
28803
- return replaceSuffix(string, oldSuffix, '');
28804
- }
28805
- function maximumOverlap(string1, string2) {
28806
- return string2.slice(0, overlapCount(string1, string2));
28807
- }
28808
- // Nicked from https://stackoverflow.com/a/60422853/1709587
28809
- function overlapCount(a, b) {
28810
- // Deal with cases where the strings differ in length
28811
- var startA = 0;
28812
- if (a.length > b.length) {
28813
- startA = a.length - b.length;
28814
- }
28815
- var endB = b.length;
28816
- if (a.length < b.length) {
28817
- endB = a.length;
28818
- }
28819
- // Create a back-reference for each index
28820
- // that should be followed in case of a mismatch.
28821
- // We only need B to make these references:
28822
- var map = Array(endB);
28823
- var k = 0; // Index that lags behind j
28824
- map[0] = 0;
28825
- for (var j = 1; j < endB; j++) {
28826
- if (b[j] == b[k]) {
28827
- map[j] = map[k]; // skip over the same character (optional optimisation)
28828
- }
28829
- else {
28830
- map[j] = k;
28831
- }
28832
- while (k > 0 && b[j] != b[k]) {
28833
- k = map[k];
28834
- }
28835
- if (b[j] == b[k]) {
28836
- k++;
28837
- }
28838
- }
28839
- // Phase 2: use these references while iterating over A
28840
- k = 0;
28841
- for (var i = startA; i < a.length; i++) {
28842
- while (k > 0 && a[i] != b[k]) {
28843
- k = map[k];
28844
- }
28845
- if (a[i] == b[k]) {
28846
- k++;
28847
- }
28848
- }
28849
- return k;
28850
- }
28851
- function trailingWs(string) {
28852
- // Yes, this looks overcomplicated and dumb - why not replace the whole function with
28853
- // return string match(/\s*$/)[0]
28854
- // you ask? Because:
28855
- // 1. the trap described at https://markamery.com/blog/quadratic-time-regexes/ would mean doing
28856
- // this would cause this function to take O(n²) time in the worst case (specifically when
28857
- // there is a massive run of NON-TRAILING whitespace in `string`), and
28858
- // 2. the fix proposed in the same blog post, of using a negative lookbehind, is incompatible
28859
- // with old Safari versions that we'd like to not break if possible (see
28860
- // https://github.com/kpdecker/jsdiff/pull/550)
28861
- // It feels absurd to do this with an explicit loop instead of a regex, but I really can't see a
28862
- // better way that doesn't result in broken behaviour.
28863
- var i;
28864
- for (i = string.length - 1; i >= 0; i--) {
28865
- if (!string[i].match(/\s/)) {
28866
- break;
28867
- }
28868
- }
28869
- return string.substring(i + 1);
28870
- }
28871
- function leadingWs(string) {
28872
- // Thankfully the annoying considerations described in trailingWs don't apply here:
28873
- var match = string.match(/^\s*/);
28874
- return match ? match[0] : '';
28875
28725
  }
28876
28726
 
28877
- var __extends$5 = (undefined && undefined.__extends) || (function () {
28878
- var extendStatics = function (d, b) {
28879
- extendStatics = Object.setPrototypeOf ||
28880
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28881
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
28882
- return extendStatics(d, b);
28883
- };
28884
- return function (d, b) {
28885
- if (typeof b !== "function" && b !== null)
28886
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
28887
- extendStatics(d, b);
28888
- function __() { this.constructor = d; }
28889
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28890
- };
28891
- })();
28892
- // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
28893
- //
28894
- // Ranges and exceptions:
28895
- // Latin-1 Supplement, 0080–00FF
28896
- // - U+00D7 × Multiplication sign
28897
- // - U+00F7 ÷ Division sign
28898
- // Latin Extended-A, 0100–017F
28899
- // Latin Extended-B, 0180–024F
28900
- // IPA Extensions, 0250–02AF
28901
- // Spacing Modifier Letters, 02B0–02FF
28902
- // - U+02C7 ˇ &#711; Caron
28903
- // - U+02D8 ˘ &#728; Breve
28904
- // - U+02D9 ˙ &#729; Dot Above
28905
- // - U+02DA ˚ &#730; Ring Above
28906
- // - U+02DB ˛ &#731; Ogonek
28907
- // - U+02DC ˜ &#732; Small Tilde
28908
- // - U+02DD ˝ &#733; Double Acute Accent
28909
- // Latin Extended Additional, 1E00–1EFF
28910
- var extendedWordChars = 'a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}';
28911
- // Each token is one of the following:
28912
- // - A punctuation mark plus the surrounding whitespace
28913
- // - A word plus the surrounding whitespace
28914
- // - Pure whitespace (but only in the special case where this the entire text
28915
- // is just whitespace)
28916
- //
28917
- // We have to include surrounding whitespace in the tokens because the two
28918
- // alternative approaches produce horribly broken results:
28919
- // * If we just discard the whitespace, we can't fully reproduce the original
28920
- // text from the sequence of tokens and any attempt to render the diff will
28921
- // get the whitespace wrong.
28922
- // * If we have separate tokens for whitespace, then in a typical text every
28923
- // second token will be a single space character. But this often results in
28924
- // the optimal diff between two texts being a perverse one that preserves
28925
- // the spaces between words but deletes and reinserts actual common words.
28926
- // See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640
28927
- // for an example.
28928
- //
28929
- // Keeping the surrounding whitespace of course has implications for .equals
28930
- // and .join, not just .tokenize.
28931
- // This regex does NOT fully implement the tokenization rules described above.
28932
- // Instead, it gives runs of whitespace their own "token". The tokenize method
28933
- // then handles stitching whitespace tokens onto adjacent word or punctuation
28934
- // tokens.
28935
- var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug');
28936
- var WordDiff = /** @class */ (function (_super) {
28937
- __extends$5(WordDiff, _super);
28938
- function WordDiff() {
28939
- return _super !== null && _super.apply(this, arguments) || this;
28940
- }
28941
- WordDiff.prototype.equals = function (left, right, options) {
28942
- if (options.ignoreCase) {
28943
- left = left.toLowerCase();
28944
- right = right.toLowerCase();
28945
- }
28946
- return left.trim() === right.trim();
28947
- };
28948
- WordDiff.prototype.tokenize = function (value, options) {
28949
- if (options === void 0) { options = {}; }
28950
- var parts;
28951
- if (options.intlSegmenter) {
28952
- var segmenter = options.intlSegmenter;
28953
- if (segmenter.resolvedOptions().granularity != 'word') {
28954
- throw new Error('The segmenter passed must have a granularity of "word"');
28955
- }
28956
- parts = Array.from(segmenter.segment(value), function (segment) { return segment.segment; });
28957
- }
28958
- else {
28959
- parts = value.match(tokenizeIncludingWhitespace) || [];
28960
- }
28961
- var tokens = [];
28962
- var prevPart = null;
28963
- parts.forEach(function (part) {
28964
- if ((/\s/).test(part)) {
28965
- if (prevPart == null) {
28966
- tokens.push(part);
28967
- }
28968
- else {
28969
- tokens.push(tokens.pop() + part);
28970
- }
28971
- }
28972
- else if (prevPart != null && (/\s/).test(prevPart)) {
28973
- if (tokens[tokens.length - 1] == prevPart) {
28974
- tokens.push(tokens.pop() + part);
28975
- }
28976
- else {
28977
- tokens.push(prevPart + part);
28978
- }
28979
- }
28980
- else {
28981
- tokens.push(part);
28982
- }
28983
- prevPart = part;
28984
- });
28985
- return tokens;
28986
- };
28987
- WordDiff.prototype.join = function (tokens) {
28988
- // Tokens being joined here will always have appeared consecutively in the
28989
- // same text, so we can simply strip off the leading whitespace from all the
28990
- // tokens except the first (and except any whitespace-only tokens - but such
28991
- // a token will always be the first and only token anyway) and then join them
28992
- // and the whitespace around words and punctuation will end up correct.
28993
- return tokens.map(function (token, i) {
28994
- if (i == 0) {
28995
- return token;
28996
- }
28997
- else {
28998
- return token.replace((/^\s+/), '');
28999
- }
29000
- }).join('');
29001
- };
29002
- WordDiff.prototype.postProcess = function (changes, options) {
29003
- if (!changes || options.oneChangePerToken) {
29004
- return changes;
29005
- }
29006
- var lastKeep = null;
29007
- // Change objects representing any insertion or deletion since the last
29008
- // "keep" change object. There can be at most one of each.
29009
- var insertion = null;
29010
- var deletion = null;
29011
- changes.forEach(function (change) {
29012
- if (change.added) {
29013
- insertion = change;
29014
- }
29015
- else if (change.removed) {
29016
- deletion = change;
29017
- }
29018
- else {
29019
- if (insertion || deletion) { // May be false at start of text
29020
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
29021
- }
29022
- lastKeep = change;
29023
- insertion = null;
29024
- deletion = null;
29025
- }
29026
- });
29027
- if (insertion || deletion) {
29028
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
29029
- }
29030
- return changes;
29031
- };
29032
- return WordDiff;
29033
- }(Diff));
29034
- new WordDiff();
29035
- function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
29036
- // Before returning, we tidy up the leading and trailing whitespace of the
29037
- // change objects to eliminate cases where trailing whitespace in one object
29038
- // is repeated as leading whitespace in the next.
29039
- // Below are examples of the outcomes we want here to explain the code.
29040
- // I=insert, K=keep, D=delete
29041
- // 1. diffing 'foo bar baz' vs 'foo baz'
29042
- // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'
29043
- // After cleanup, we want: K:'foo ' D:'bar ' K:'baz'
29044
- //
29045
- // 2. Diffing 'foo bar baz' vs 'foo qux baz'
29046
- // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz'
29047
- // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz'
29048
- //
29049
- // 3. Diffing 'foo\nbar baz' vs 'foo baz'
29050
- // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz'
29051
- // After cleanup, we want K'foo' D:'\nbar' K:' baz'
29052
- //
29053
- // 4. Diffing 'foo baz' vs 'foo\nbar baz'
29054
- // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz'
29055
- // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz'
29056
- // but don't actually manage this currently (the pre-cleanup change
29057
- // objects don't contain enough information to make it possible).
29058
- //
29059
- // 5. Diffing 'foo bar baz' vs 'foo baz'
29060
- // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'
29061
- // After cleanup, we want K:'foo ' D:' bar ' K:'baz'
29062
- //
29063
- // Our handling is unavoidably imperfect in the case where there's a single
29064
- // indel between keeps and the whitespace has changed. For instance, consider
29065
- // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change
29066
- // object to represent the insertion of the space character (which isn't even
29067
- // a token), we have no way to avoid losing information about the texts'
29068
- // original whitespace in the result we return. Still, we do our best to
29069
- // output something that will look sensible if we e.g. print it with
29070
- // insertions in green and deletions in red.
29071
- // Between two "keep" change objects (or before the first or after the last
29072
- // change object), we can have either:
29073
- // * A "delete" followed by an "insert"
29074
- // * Just an "insert"
29075
- // * Just a "delete"
29076
- // We handle the three cases separately.
29077
- if (deletion && insertion) {
29078
- var oldWsPrefix = leadingWs(deletion.value);
29079
- var oldWsSuffix = trailingWs(deletion.value);
29080
- var newWsPrefix = leadingWs(insertion.value);
29081
- var newWsSuffix = trailingWs(insertion.value);
29082
- if (startKeep) {
29083
- var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
29084
- startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
29085
- deletion.value = removePrefix(deletion.value, commonWsPrefix);
29086
- insertion.value = removePrefix(insertion.value, commonWsPrefix);
29087
- }
29088
- if (endKeep) {
29089
- var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
29090
- endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
29091
- deletion.value = removeSuffix(deletion.value, commonWsSuffix);
29092
- insertion.value = removeSuffix(insertion.value, commonWsSuffix);
29093
- }
29094
- }
29095
- else if (insertion) {
29096
- // The whitespaces all reflect what was in the new text rather than
29097
- // the old, so we essentially have no information about whitespace
29098
- // insertion or deletion. We just want to dedupe the whitespace.
29099
- // We do that by having each change object keep its trailing
29100
- // whitespace and deleting duplicate leading whitespace where
29101
- // present.
29102
- if (startKeep) {
29103
- var ws = leadingWs(insertion.value);
29104
- insertion.value = insertion.value.substring(ws.length);
29105
- }
29106
- if (endKeep) {
29107
- var ws = leadingWs(endKeep.value);
29108
- endKeep.value = endKeep.value.substring(ws.length);
29109
- }
29110
- // otherwise we've got a deletion and no insertion
29111
- }
29112
- else if (startKeep && endKeep) {
29113
- var newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
29114
- // Any whitespace that comes straight after startKeep in both the old and
29115
- // new texts, assign to startKeep and remove from the deletion.
29116
- var newWsStart = longestCommonPrefix(newWsFull, delWsStart);
29117
- deletion.value = removePrefix(deletion.value, newWsStart);
29118
- // Any whitespace that comes straight before endKeep in both the old and
29119
- // new texts, and hasn't already been assigned to startKeep, assign to
29120
- // endKeep and remove from the deletion.
29121
- var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
29122
- deletion.value = removeSuffix(deletion.value, newWsEnd);
29123
- endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
29124
- // If there's any whitespace from the new text that HASN'T already been
29125
- // assigned, assign it to the start:
29126
- startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
29127
- }
29128
- else if (endKeep) {
29129
- // We are at the start of the text. Preserve all the whitespace on
29130
- // endKeep, and just remove whitespace from the end of deletion to the
29131
- // extent that it overlaps with the start of endKeep.
29132
- var endKeepWsPrefix = leadingWs(endKeep.value);
29133
- var deletionWsSuffix = trailingWs(deletion.value);
29134
- var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
29135
- deletion.value = removeSuffix(deletion.value, overlap);
29136
- }
29137
- else if (startKeep) {
29138
- // We are at the END of the text. Preserve all the whitespace on
29139
- // startKeep, and just remove whitespace from the start of deletion to
29140
- // the extent that it overlaps with the end of startKeep.
29141
- var startKeepWsSuffix = trailingWs(startKeep.value);
29142
- var deletionWsPrefix = leadingWs(deletion.value);
29143
- var overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
29144
- deletion.value = removePrefix(deletion.value, overlap);
29145
- }
29146
- }
29147
- var WordsWithSpaceDiff = /** @class */ (function (_super) {
29148
- __extends$5(WordsWithSpaceDiff, _super);
29149
- function WordsWithSpaceDiff() {
29150
- return _super !== null && _super.apply(this, arguments) || this;
29151
- }
29152
- WordsWithSpaceDiff.prototype.tokenize = function (value) {
29153
- // Slightly different to the tokenizeIncludingWhitespace regex used above in
29154
- // that this one treats each individual newline as a distinct tokens, rather
29155
- // than merging them into other surrounding whitespace. This was requested
29156
- // in https://github.com/kpdecker/jsdiff/issues/180 &
29157
- // https://github.com/kpdecker/jsdiff/issues/211
29158
- var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug');
29159
- return value.match(regex) || [];
29160
- };
29161
- return WordsWithSpaceDiff;
29162
- }(Diff));
29163
- new WordsWithSpaceDiff();
29164
-
29165
- var __extends$4 = (undefined && undefined.__extends) || (function () {
29166
- var extendStatics = function (d, b) {
29167
- extendStatics = Object.setPrototypeOf ||
29168
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29169
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29170
- return extendStatics(d, b);
29171
- };
29172
- return function (d, b) {
29173
- if (typeof b !== "function" && b !== null)
29174
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29175
- extendStatics(d, b);
29176
- function __() { this.constructor = d; }
29177
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29178
- };
29179
- })();
29180
- var LineDiff = /** @class */ (function (_super) {
29181
- __extends$4(LineDiff, _super);
29182
- function LineDiff() {
29183
- var _this = _super !== null && _super.apply(this, arguments) || this;
29184
- _this.tokenize = tokenize;
29185
- return _this;
29186
- }
29187
- LineDiff.prototype.equals = function (left, right, options) {
28727
+ class LineDiff extends Diff {
28728
+ constructor() {
28729
+ super(...arguments);
28730
+ this.tokenize = tokenize;
28731
+ }
28732
+ equals(left, right, options) {
29188
28733
  // If we're ignoring whitespace, we need to normalise lines by stripping
29189
28734
  // whitespace before checking equality. (This has an annoying interaction
29190
28735
  // with newlineIsToken that requires special handling: if newlines get their
@@ -29208,11 +28753,10 @@ var LineDiff = /** @class */ (function (_super) {
29208
28753
  right = right.slice(0, -1);
29209
28754
  }
29210
28755
  }
29211
- return _super.prototype.equals.call(this, left, right, options);
29212
- };
29213
- return LineDiff;
29214
- }(Diff));
29215
- var lineDiff = new LineDiff();
28756
+ return super.equals(left, right, options);
28757
+ }
28758
+ }
28759
+ const lineDiff = new LineDiff();
29216
28760
  function diffLines(oldStr, newStr, options) {
29217
28761
  return lineDiff.diff(oldStr, newStr, options);
29218
28762
  }
@@ -29222,14 +28766,14 @@ function tokenize(value, options) {
29222
28766
  // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
29223
28767
  value = value.replace(/\r\n/g, '\n');
29224
28768
  }
29225
- var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
28769
+ const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
29226
28770
  // Ignore the final empty token that occurs if the string ends with a new line
29227
28771
  if (!linesAndNewlines[linesAndNewlines.length - 1]) {
29228
28772
  linesAndNewlines.pop();
29229
28773
  }
29230
28774
  // Merge the content and line separators into single tokens
29231
- for (var i = 0; i < linesAndNewlines.length; i++) {
29232
- var line = linesAndNewlines[i];
28775
+ for (let i = 0; i < linesAndNewlines.length; i++) {
28776
+ const line = linesAndNewlines[i];
29233
28777
  if (i % 2 && !options.newlineIsToken) {
29234
28778
  retLines[retLines.length - 1] += line;
29235
28779
  }
@@ -29240,100 +28784,24 @@ function tokenize(value, options) {
29240
28784
  return retLines;
29241
28785
  }
29242
28786
 
29243
- var __extends$3 = (undefined && undefined.__extends) || (function () {
29244
- var extendStatics = function (d, b) {
29245
- extendStatics = Object.setPrototypeOf ||
29246
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29247
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29248
- return extendStatics(d, b);
29249
- };
29250
- return function (d, b) {
29251
- if (typeof b !== "function" && b !== null)
29252
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29253
- extendStatics(d, b);
29254
- function __() { this.constructor = d; }
29255
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29256
- };
29257
- })();
29258
- var SentenceDiff = /** @class */ (function (_super) {
29259
- __extends$3(SentenceDiff, _super);
29260
- function SentenceDiff() {
29261
- return _super !== null && _super.apply(this, arguments) || this;
29262
- }
29263
- SentenceDiff.prototype.tokenize = function (value) {
29264
- return value.split(/(?<=[.!?])(\s+|$)/);
29265
- };
29266
- return SentenceDiff;
29267
- }(Diff));
29268
- new SentenceDiff();
29269
-
29270
- var __extends$2 = (undefined && undefined.__extends) || (function () {
29271
- var extendStatics = function (d, b) {
29272
- extendStatics = Object.setPrototypeOf ||
29273
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29274
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29275
- return extendStatics(d, b);
29276
- };
29277
- return function (d, b) {
29278
- if (typeof b !== "function" && b !== null)
29279
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29280
- extendStatics(d, b);
29281
- function __() { this.constructor = d; }
29282
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29283
- };
29284
- })();
29285
- var CssDiff = /** @class */ (function (_super) {
29286
- __extends$2(CssDiff, _super);
29287
- function CssDiff() {
29288
- return _super !== null && _super.apply(this, arguments) || this;
29289
- }
29290
- CssDiff.prototype.tokenize = function (value) {
29291
- return value.split(/([{}:;,]|\s+)/);
29292
- };
29293
- return CssDiff;
29294
- }(Diff));
29295
- new CssDiff();
29296
-
29297
- var __extends$1 = (undefined && undefined.__extends) || (function () {
29298
- var extendStatics = function (d, b) {
29299
- extendStatics = Object.setPrototypeOf ||
29300
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29301
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29302
- return extendStatics(d, b);
29303
- };
29304
- return function (d, b) {
29305
- if (typeof b !== "function" && b !== null)
29306
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29307
- extendStatics(d, b);
29308
- function __() { this.constructor = d; }
29309
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29310
- };
29311
- })();
29312
- var JsonDiff = /** @class */ (function (_super) {
29313
- __extends$1(JsonDiff, _super);
29314
- function JsonDiff() {
29315
- var _this = _super !== null && _super.apply(this, arguments) || this;
29316
- _this.tokenize = tokenize;
29317
- return _this;
29318
- }
29319
- Object.defineProperty(JsonDiff.prototype, "useLongestToken", {
29320
- get: function () {
29321
- // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
29322
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
29323
- return true;
29324
- },
29325
- enumerable: false,
29326
- configurable: true
29327
- });
29328
- JsonDiff.prototype.castInput = function (value, options) {
29329
- var undefinedReplacement = options.undefinedReplacement, _a = options.stringifyReplacer, stringifyReplacer = _a === void 0 ? function (k, v) { return typeof v === 'undefined' ? undefinedReplacement : v; } : _a;
28787
+ class JsonDiff extends Diff {
28788
+ constructor() {
28789
+ super(...arguments);
28790
+ this.tokenize = tokenize;
28791
+ }
28792
+ get useLongestToken() {
28793
+ // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
28794
+ // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
28795
+ return true;
28796
+ }
28797
+ castInput(value, options) {
28798
+ const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === 'undefined' ? undefinedReplacement : v } = options;
29330
28799
  return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, ' ');
29331
- };
29332
- JsonDiff.prototype.equals = function (left, right, options) {
29333
- return _super.prototype.equals.call(this, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options);
29334
- };
29335
- return JsonDiff;
29336
- }(Diff));
28800
+ }
28801
+ equals(left, right, options) {
28802
+ return super.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options);
28803
+ }
28804
+ }
29337
28805
  new JsonDiff();
29338
28806
  // This function handles the presence of circular references by bailing out when encountering an
29339
28807
  // object that is already on the "stack" of items being processed. Accepts an optional replacer
@@ -29343,13 +28811,13 @@ function canonicalize(obj, stack, replacementStack, replacer, key) {
29343
28811
  if (replacer) {
29344
28812
  obj = replacer(key === undefined ? '' : key, obj);
29345
28813
  }
29346
- var i;
28814
+ let i;
29347
28815
  for (i = 0; i < stack.length; i += 1) {
29348
28816
  if (stack[i] === obj) {
29349
28817
  return replacementStack[i];
29350
28818
  }
29351
28819
  }
29352
- var canonicalizedObj;
28820
+ let canonicalizedObj;
29353
28821
  if ('[object Array]' === Object.prototype.toString.call(obj)) {
29354
28822
  stack.push(obj);
29355
28823
  canonicalizedObj = new Array(obj.length);
@@ -29368,18 +28836,18 @@ function canonicalize(obj, stack, replacementStack, replacer, key) {
29368
28836
  stack.push(obj);
29369
28837
  canonicalizedObj = {};
29370
28838
  replacementStack.push(canonicalizedObj);
29371
- var sortedKeys = [];
29372
- var key_1;
29373
- for (key_1 in obj) {
28839
+ const sortedKeys = [];
28840
+ let key;
28841
+ for (key in obj) {
29374
28842
  /* istanbul ignore else */
29375
- if (Object.prototype.hasOwnProperty.call(obj, key_1)) {
29376
- sortedKeys.push(key_1);
28843
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
28844
+ sortedKeys.push(key);
29377
28845
  }
29378
28846
  }
29379
28847
  sortedKeys.sort();
29380
28848
  for (i = 0; i < sortedKeys.length; i += 1) {
29381
- key_1 = sortedKeys[i];
29382
- canonicalizedObj[key_1] = canonicalize(obj[key_1], stack, replacementStack, replacer, key_1);
28849
+ key = sortedKeys[i];
28850
+ canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack, replacer, key);
29383
28851
  }
29384
28852
  stack.pop();
29385
28853
  replacementStack.pop();
@@ -29390,76 +28858,8 @@ function canonicalize(obj, stack, replacementStack, replacer, key) {
29390
28858
  return canonicalizedObj;
29391
28859
  }
29392
28860
 
29393
- var __extends = (undefined && undefined.__extends) || (function () {
29394
- var extendStatics = function (d, b) {
29395
- extendStatics = Object.setPrototypeOf ||
29396
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29397
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29398
- return extendStatics(d, b);
29399
- };
29400
- return function (d, b) {
29401
- if (typeof b !== "function" && b !== null)
29402
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29403
- extendStatics(d, b);
29404
- function __() { this.constructor = d; }
29405
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29406
- };
29407
- })();
29408
- var ArrayDiff = /** @class */ (function (_super) {
29409
- __extends(ArrayDiff, _super);
29410
- function ArrayDiff() {
29411
- return _super !== null && _super.apply(this, arguments) || this;
29412
- }
29413
- ArrayDiff.prototype.tokenize = function (value) {
29414
- return value.slice();
29415
- };
29416
- ArrayDiff.prototype.join = function (value) {
29417
- return value;
29418
- };
29419
- ArrayDiff.prototype.removeEmpty = function (value) {
29420
- return value;
29421
- };
29422
- return ArrayDiff;
29423
- }(Diff));
29424
- new ArrayDiff();
29425
-
29426
- var __assign$2 = (undefined && undefined.__assign) || function () {
29427
- __assign$2 = Object.assign || function(t) {
29428
- for (var s, i = 1, n = arguments.length; i < n; i++) {
29429
- s = arguments[i];
29430
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29431
- t[p] = s[p];
29432
- }
29433
- return t;
29434
- };
29435
- return __assign$2.apply(this, arguments);
29436
- };
29437
-
29438
- var __assign$1 = (undefined && undefined.__assign) || function () {
29439
- __assign$1 = Object.assign || function(t) {
29440
- for (var s, i = 1, n = arguments.length; i < n; i++) {
29441
- s = arguments[i];
29442
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29443
- t[p] = s[p];
29444
- }
29445
- return t;
29446
- };
29447
- return __assign$1.apply(this, arguments);
29448
- };
29449
-
29450
- var __assign = (undefined && undefined.__assign) || function () {
29451
- __assign = Object.assign || function(t) {
29452
- for (var s, i = 1, n = arguments.length; i < n; i++) {
29453
- s = arguments[i];
29454
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29455
- t[p] = s[p];
29456
- }
29457
- return t;
29458
- };
29459
- return __assign.apply(this, arguments);
29460
- };
29461
28861
  function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
29462
- var optionsObj;
28862
+ let optionsObj;
29463
28863
  if (!options) {
29464
28864
  optionsObj = {};
29465
28865
  }
@@ -29474,7 +28874,7 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29474
28874
  }
29475
28875
  // We copy this into its own variable to placate TypeScript, which thinks
29476
28876
  // optionsObj.context might be undefined in the callbacks below.
29477
- var context = optionsObj.context;
28877
+ const context = optionsObj.context;
29478
28878
  // @ts-expect-error (runtime check for something that is correctly a static type error)
29479
28879
  if (optionsObj.newlineIsToken) {
29480
28880
  throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions');
@@ -29483,12 +28883,12 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29483
28883
  return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
29484
28884
  }
29485
28885
  else {
29486
- var callback_1 = optionsObj.callback;
29487
- diffLines(oldStr, newStr, __assign(__assign({}, optionsObj), { callback: function (diff) {
29488
- var patch = diffLinesResultToPatch(diff);
28886
+ const { callback } = optionsObj;
28887
+ diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff) => {
28888
+ const patch = diffLinesResultToPatch(diff);
29489
28889
  // TypeScript is unhappy without the cast because it does not understand that `patch` may
29490
28890
  // be undefined here only if `callback` is StructuredPatchCallbackAbortable:
29491
- callback_1(patch);
28891
+ callback(patch);
29492
28892
  } }));
29493
28893
  }
29494
28894
  function diffLinesResultToPatch(diff) {
@@ -29501,15 +28901,15 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29501
28901
  function contextLines(lines) {
29502
28902
  return lines.map(function (entry) { return ' ' + entry; });
29503
28903
  }
29504
- var hunks = [];
29505
- var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
29506
- for (var i = 0; i < diff.length; i++) {
29507
- var current = diff[i], lines = current.lines || splitLines(current.value);
28904
+ const hunks = [];
28905
+ let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
28906
+ for (let i = 0; i < diff.length; i++) {
28907
+ const current = diff[i], lines = current.lines || splitLines(current.value);
29508
28908
  current.lines = lines;
29509
28909
  if (current.added || current.removed) {
29510
28910
  // If we have previous context, start with that
29511
28911
  if (!oldRangeStart) {
29512
- var prev = diff[i - 1];
28912
+ const prev = diff[i - 1];
29513
28913
  oldRangeStart = oldLine;
29514
28914
  newRangeStart = newLine;
29515
28915
  if (prev) {
@@ -29519,8 +28919,7 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29519
28919
  }
29520
28920
  }
29521
28921
  // Output our changes
29522
- for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
29523
- var line = lines_1[_i];
28922
+ for (const line of lines) {
29524
28923
  curRange.push((current.added ? '+' : '-') + line);
29525
28924
  }
29526
28925
  // Track the updated file position
@@ -29537,19 +28936,17 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29537
28936
  // Close out any changes that have been output (or join overlapping)
29538
28937
  if (lines.length <= context * 2 && i < diff.length - 2) {
29539
28938
  // Overlapping
29540
- for (var _a = 0, _b = contextLines(lines); _a < _b.length; _a++) {
29541
- var line = _b[_a];
28939
+ for (const line of contextLines(lines)) {
29542
28940
  curRange.push(line);
29543
28941
  }
29544
28942
  }
29545
28943
  else {
29546
28944
  // end the range and output
29547
- var contextSize = Math.min(lines.length, context);
29548
- for (var _c = 0, _d = contextLines(lines.slice(0, contextSize)); _c < _d.length; _c++) {
29549
- var line = _d[_c];
28945
+ const contextSize = Math.min(lines.length, context);
28946
+ for (const line of contextLines(lines.slice(0, contextSize))) {
29550
28947
  curRange.push(line);
29551
28948
  }
29552
- var hunk = {
28949
+ const hunk = {
29553
28950
  oldStart: oldRangeStart,
29554
28951
  oldLines: (oldLine - oldRangeStart + contextSize),
29555
28952
  newStart: newRangeStart,
@@ -29568,9 +28965,8 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29568
28965
  }
29569
28966
  // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add
29570
28967
  // "".
29571
- for (var _e = 0, hunks_1 = hunks; _e < hunks_1.length; _e++) {
29572
- var hunk = hunks_1[_e];
29573
- for (var i = 0; i < hunk.lines.length; i++) {
28968
+ for (const hunk of hunks) {
28969
+ for (let i = 0; i < hunk.lines.length; i++) {
29574
28970
  if (hunk.lines[i].endsWith('\n')) {
29575
28971
  hunk.lines[i] = hunk.lines[i].slice(0, -1);
29576
28972
  }
@@ -29595,15 +28991,15 @@ function formatPatch(patch) {
29595
28991
  if (Array.isArray(patch)) {
29596
28992
  return patch.map(formatPatch).join('\n');
29597
28993
  }
29598
- var ret = [];
28994
+ const ret = [];
29599
28995
  if (patch.oldFileName == patch.newFileName) {
29600
28996
  ret.push('Index: ' + patch.oldFileName);
29601
28997
  }
29602
28998
  ret.push('===================================================================');
29603
28999
  ret.push('--- ' + patch.oldFileName + (typeof patch.oldHeader === 'undefined' ? '' : '\t' + patch.oldHeader));
29604
29000
  ret.push('+++ ' + patch.newFileName + (typeof patch.newHeader === 'undefined' ? '' : '\t' + patch.newHeader));
29605
- for (var i = 0; i < patch.hunks.length; i++) {
29606
- var hunk = patch.hunks[i];
29001
+ for (let i = 0; i < patch.hunks.length; i++) {
29002
+ const hunk = patch.hunks[i];
29607
29003
  // Unified Diff Format quirk: If the chunk size is 0,
29608
29004
  // the first number is one lower than one would expect.
29609
29005
  // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
@@ -29616,8 +29012,7 @@ function formatPatch(patch) {
29616
29012
  ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines
29617
29013
  + ' +' + hunk.newStart + ',' + hunk.newLines
29618
29014
  + ' @@');
29619
- for (var _i = 0, _a = hunk.lines; _i < _a.length; _i++) {
29620
- var line = _a[_i];
29015
+ for (const line of hunk.lines) {
29621
29016
  ret.push(line);
29622
29017
  }
29623
29018
  }
@@ -29628,20 +29023,20 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
29628
29023
  options = { callback: options };
29629
29024
  }
29630
29025
  if (!(options === null || options === void 0 ? void 0 : options.callback)) {
29631
- var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
29026
+ const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
29632
29027
  if (!patchObj) {
29633
29028
  return;
29634
29029
  }
29635
29030
  return formatPatch(patchObj);
29636
29031
  }
29637
29032
  else {
29638
- var callback_2 = options.callback;
29639
- structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, __assign(__assign({}, options), { callback: function (patchObj) {
29033
+ const { callback } = options;
29034
+ structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options), { callback: patchObj => {
29640
29035
  if (!patchObj) {
29641
- callback_2(undefined);
29036
+ callback(undefined);
29642
29037
  }
29643
29038
  else {
29644
- callback_2(formatPatch(patchObj));
29039
+ callback(formatPatch(patchObj));
29645
29040
  }
29646
29041
  } }));
29647
29042
  }
@@ -29650,8 +29045,8 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
29650
29045
  * Split `text` into an array of lines, including the trailing newline character (where present)
29651
29046
  */
29652
29047
  function splitLines(text) {
29653
- var hasTrailingNl = text.endsWith('\n');
29654
- var result = text.split('\n').map(function (line) { return line + '\n'; });
29048
+ const hasTrailingNl = text.endsWith('\n');
29049
+ const result = text.split('\n').map(line => line + '\n');
29655
29050
  if (hasTrailingNl) {
29656
29051
  result.pop();
29657
29052
  }
@@ -56764,5 +56159,5 @@ function requireSrc () {
56764
56159
  var srcExports = requireSrc();
56765
56160
  var tinylr = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
56766
56161
 
56767
- export { HighlightJS as H, MarkdownIt as M, deflist_plugin as a, closest as b, createTwoFilesPatch as c, dedent as d, distance as e, fm as f, globSync as g, glob as h, isCI as i, moduleImporter as j, cliProgress as k, createInstance as l, minimatch as m, fse as n, tinylr as t, watch$1 as w };
56768
- //# sourceMappingURL=vendor-IOoC49Xw.mjs.map
56162
+ export { HighlightJS as H, MarkdownIt as M, createTwoFilesPatch as a, deflist_plugin as b, commonjsRequire as c, dedent as d, closest as e, distance as f, globSync as g, fm as h, isCI as i, glob as j, moduleImporter as k, cliProgress as l, minimatch as m, createInstance as n, fse as o, tinylr as t, watch$1 as w };
56163
+ //# sourceMappingURL=vendor-DufRLcxZ.mjs.map