@hanzlaa/rcode 3.4.5 → 3.4.6

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.
package/dist/rcode.js CHANGED
@@ -12093,302 +12093,289 @@ var require_semver2 = __commonJS({
12093
12093
  }
12094
12094
  });
12095
12095
 
12096
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js
12096
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/base.js
12097
12097
  var require_base = __commonJS({
12098
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/base.js"(exports2) {
12098
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/base.js"(exports2) {
12099
12099
  "use strict";
12100
- Object.defineProperty(exports2, "__esModule", {
12101
- value: true
12102
- });
12103
- exports2["default"] = Diff;
12104
- function Diff() {
12105
- }
12106
- Diff.prototype = {
12107
- /*istanbul ignore start*/
12108
- /*istanbul ignore end*/
12109
- diff: function diff(oldString, newString) {
12110
- var _options$timeout;
12111
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
12112
- var callback = options.callback;
12113
- if (typeof options === "function") {
12114
- callback = options;
12115
- options = {};
12116
- }
12117
- var self = this;
12118
- function done(value) {
12119
- value = self.postProcess(value, options);
12120
- if (callback) {
12121
- setTimeout(function() {
12122
- callback(value);
12123
- }, 0);
12124
- return true;
12125
- } else {
12126
- return value;
12127
- }
12128
- }
12129
- oldString = this.castInput(oldString, options);
12130
- newString = this.castInput(newString, options);
12131
- oldString = this.removeEmpty(this.tokenize(oldString, options));
12132
- newString = this.removeEmpty(this.tokenize(newString, options));
12133
- var newLen = newString.length, oldLen = oldString.length;
12134
- var editLength = 1;
12135
- var maxEditLength = newLen + oldLen;
12136
- if (options.maxEditLength != null) {
12137
- maxEditLength = Math.min(maxEditLength, options.maxEditLength);
12138
- }
12139
- var maxExecutionTime = (
12140
- /*istanbul ignore start*/
12141
- (_options$timeout = /*istanbul ignore end*/
12142
- options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity
12143
- );
12144
- var abortAfterTimestamp = Date.now() + maxExecutionTime;
12145
- var bestPath = [{
12146
- oldPos: -1,
12147
- lastComponent: void 0
12148
- }];
12149
- var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options);
12150
- if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
12151
- return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken));
12152
- }
12153
- var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
12154
- function execEditLength() {
12155
- for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
12156
- var basePath = (
12157
- /*istanbul ignore start*/
12158
- void 0
12159
- );
12160
- var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
12161
- if (removePath) {
12162
- bestPath[diagonalPath - 1] = void 0;
12163
- }
12164
- var canAdd = false;
12165
- if (addPath) {
12166
- var addPathNewPos = addPath.oldPos - diagonalPath;
12167
- canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
12168
- }
12169
- var canRemove = removePath && removePath.oldPos + 1 < oldLen;
12170
- if (!canAdd && !canRemove) {
12171
- bestPath[diagonalPath] = void 0;
12172
- continue;
12173
- }
12174
- if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
12175
- basePath = self.addToPath(addPath, true, false, 0, options);
12100
+ Object.defineProperty(exports2, "__esModule", { value: true });
12101
+ var Diff = (
12102
+ /** @class */
12103
+ (function() {
12104
+ function Diff2() {
12105
+ }
12106
+ Diff2.prototype.diff = function(oldStr, newStr, options) {
12107
+ if (options === void 0) {
12108
+ options = {};
12109
+ }
12110
+ var callback;
12111
+ if (typeof options === "function") {
12112
+ callback = options;
12113
+ options = {};
12114
+ } else if ("callback" in options) {
12115
+ callback = options.callback;
12116
+ }
12117
+ var oldString = this.castInput(oldStr, options);
12118
+ var newString = this.castInput(newStr, options);
12119
+ var oldTokens = this.removeEmpty(this.tokenize(oldString, options));
12120
+ var newTokens = this.removeEmpty(this.tokenize(newString, options));
12121
+ return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
12122
+ };
12123
+ Diff2.prototype.diffWithOptionsObj = function(oldTokens, newTokens, options, callback) {
12124
+ var _this = this;
12125
+ var _a;
12126
+ var done = function(value) {
12127
+ value = _this.postProcess(value, options);
12128
+ if (callback) {
12129
+ setTimeout(function() {
12130
+ callback(value);
12131
+ }, 0);
12132
+ return void 0;
12176
12133
  } else {
12177
- basePath = self.addToPath(removePath, false, true, 1, options);
12134
+ return value;
12178
12135
  }
12179
- newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options);
12180
- if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
12181
- return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
12182
- } else {
12183
- bestPath[diagonalPath] = basePath;
12184
- if (basePath.oldPos + 1 >= oldLen) {
12185
- maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
12136
+ };
12137
+ var newLen = newTokens.length, oldLen = oldTokens.length;
12138
+ var editLength = 1;
12139
+ var maxEditLength = newLen + oldLen;
12140
+ if (options.maxEditLength != null) {
12141
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
12142
+ }
12143
+ var maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
12144
+ var abortAfterTimestamp = Date.now() + maxExecutionTime;
12145
+ var bestPath = [{ oldPos: -1, lastComponent: void 0 }];
12146
+ var newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
12147
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
12148
+ return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
12149
+ }
12150
+ var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
12151
+ var execEditLength = function() {
12152
+ for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
12153
+ var basePath = void 0;
12154
+ var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
12155
+ if (removePath) {
12156
+ bestPath[diagonalPath - 1] = void 0;
12186
12157
  }
12187
- if (newPos + 1 >= newLen) {
12188
- minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
12158
+ var canAdd = false;
12159
+ if (addPath) {
12160
+ var addPathNewPos = addPath.oldPos - diagonalPath;
12161
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
12189
12162
  }
12190
- }
12191
- }
12192
- editLength++;
12193
- }
12194
- if (callback) {
12195
- (function exec() {
12196
- setTimeout(function() {
12197
- if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
12198
- return callback();
12163
+ var canRemove = removePath && removePath.oldPos + 1 < oldLen;
12164
+ if (!canAdd && !canRemove) {
12165
+ bestPath[diagonalPath] = void 0;
12166
+ continue;
12199
12167
  }
12200
- if (!execEditLength()) {
12201
- exec();
12168
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
12169
+ basePath = _this.addToPath(addPath, true, false, 0, options);
12170
+ } else {
12171
+ basePath = _this.addToPath(removePath, false, true, 1, options);
12172
+ }
12173
+ newPos = _this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
12174
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
12175
+ return done(_this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
12176
+ } else {
12177
+ bestPath[diagonalPath] = basePath;
12178
+ if (basePath.oldPos + 1 >= oldLen) {
12179
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
12180
+ }
12181
+ if (newPos + 1 >= newLen) {
12182
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
12183
+ }
12202
12184
  }
12203
- }, 0);
12204
- })();
12205
- } else {
12206
- while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
12207
- var ret = execEditLength();
12208
- if (ret) {
12209
- return ret;
12210
- }
12211
- }
12212
- }
12213
- },
12214
- /*istanbul ignore start*/
12215
- /*istanbul ignore end*/
12216
- addToPath: function addToPath(path2, added, removed, oldPosInc, options) {
12217
- var last = path2.lastComponent;
12218
- if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
12219
- return {
12220
- oldPos: path2.oldPos + oldPosInc,
12221
- lastComponent: {
12222
- count: last.count + 1,
12223
- added,
12224
- removed,
12225
- previousComponent: last.previousComponent
12226
12185
  }
12186
+ editLength++;
12227
12187
  };
12228
- } else {
12229
- return {
12230
- oldPos: path2.oldPos + oldPosInc,
12231
- lastComponent: {
12232
- count: 1,
12233
- added,
12234
- removed,
12235
- previousComponent: last
12188
+ if (callback) {
12189
+ (function exec() {
12190
+ setTimeout(function() {
12191
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
12192
+ return callback(void 0);
12193
+ }
12194
+ if (!execEditLength()) {
12195
+ exec();
12196
+ }
12197
+ }, 0);
12198
+ })();
12199
+ } else {
12200
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
12201
+ var ret = execEditLength();
12202
+ if (ret) {
12203
+ return ret;
12204
+ }
12236
12205
  }
12237
- };
12238
- }
12239
- },
12240
- /*istanbul ignore start*/
12241
- /*istanbul ignore end*/
12242
- extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) {
12243
- var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
12244
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) {
12245
- newPos++;
12246
- oldPos++;
12247
- commonCount++;
12248
- if (options.oneChangePerToken) {
12249
- basePath.lastComponent = {
12250
- count: 1,
12251
- previousComponent: basePath.lastComponent,
12252
- added: false,
12253
- removed: false
12206
+ }
12207
+ };
12208
+ Diff2.prototype.addToPath = function(path2, added, removed, oldPosInc, options) {
12209
+ var last = path2.lastComponent;
12210
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
12211
+ return {
12212
+ oldPos: path2.oldPos + oldPosInc,
12213
+ lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
12214
+ };
12215
+ } else {
12216
+ return {
12217
+ oldPos: path2.oldPos + oldPosInc,
12218
+ lastComponent: { count: 1, added, removed, previousComponent: last }
12254
12219
  };
12255
12220
  }
12256
- }
12257
- if (commonCount && !options.oneChangePerToken) {
12258
- basePath.lastComponent = {
12259
- count: commonCount,
12260
- previousComponent: basePath.lastComponent,
12261
- added: false,
12262
- removed: false
12263
- };
12264
- }
12265
- basePath.oldPos = oldPos;
12266
- return newPos;
12267
- },
12268
- /*istanbul ignore start*/
12269
- /*istanbul ignore end*/
12270
- equals: function equals(left, right, options) {
12271
- if (options.comparator) {
12272
- return options.comparator(left, right);
12273
- } else {
12274
- return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase();
12275
- }
12276
- },
12277
- /*istanbul ignore start*/
12278
- /*istanbul ignore end*/
12279
- removeEmpty: function removeEmpty(array) {
12280
- var ret = [];
12281
- for (var i = 0; i < array.length; i++) {
12282
- if (array[i]) {
12283
- ret.push(array[i]);
12221
+ };
12222
+ Diff2.prototype.extractCommon = function(basePath, newTokens, oldTokens, diagonalPath, options) {
12223
+ var newLen = newTokens.length, oldLen = oldTokens.length;
12224
+ var oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
12225
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
12226
+ newPos++;
12227
+ oldPos++;
12228
+ commonCount++;
12229
+ if (options.oneChangePerToken) {
12230
+ basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
12231
+ }
12284
12232
  }
12285
- }
12286
- return ret;
12287
- },
12288
- /*istanbul ignore start*/
12289
- /*istanbul ignore end*/
12290
- castInput: function castInput(value) {
12291
- return value;
12292
- },
12293
- /*istanbul ignore start*/
12294
- /*istanbul ignore end*/
12295
- tokenize: function tokenize(value) {
12296
- return Array.from(value);
12297
- },
12298
- /*istanbul ignore start*/
12299
- /*istanbul ignore end*/
12300
- join: function join(chars) {
12301
- return chars.join("");
12302
- },
12303
- /*istanbul ignore start*/
12304
- /*istanbul ignore end*/
12305
- postProcess: function postProcess(changeObjects) {
12306
- return changeObjects;
12307
- }
12308
- };
12309
- function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
12310
- var components = [];
12311
- var nextComponent;
12312
- while (lastComponent) {
12313
- components.push(lastComponent);
12314
- nextComponent = lastComponent.previousComponent;
12315
- delete lastComponent.previousComponent;
12316
- lastComponent = nextComponent;
12317
- }
12318
- components.reverse();
12319
- var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
12320
- for (; componentPos < componentLen; componentPos++) {
12321
- var component = components[componentPos];
12322
- if (!component.removed) {
12323
- if (!component.added && useLongestToken) {
12324
- var value = newString.slice(newPos, newPos + component.count);
12325
- value = value.map(function(value2, i) {
12326
- var oldValue = oldString[oldPos + i];
12327
- return oldValue.length > value2.length ? oldValue : value2;
12328
- });
12329
- component.value = diff.join(value);
12233
+ if (commonCount && !options.oneChangePerToken) {
12234
+ basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
12235
+ }
12236
+ basePath.oldPos = oldPos;
12237
+ return newPos;
12238
+ };
12239
+ Diff2.prototype.equals = function(left, right, options) {
12240
+ if (options.comparator) {
12241
+ return options.comparator(left, right);
12330
12242
  } else {
12331
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
12243
+ return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
12332
12244
  }
12333
- newPos += component.count;
12334
- if (!component.added) {
12335
- oldPos += component.count;
12245
+ };
12246
+ Diff2.prototype.removeEmpty = function(array) {
12247
+ var ret = [];
12248
+ for (var i = 0; i < array.length; i++) {
12249
+ if (array[i]) {
12250
+ ret.push(array[i]);
12251
+ }
12336
12252
  }
12337
- } else {
12338
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
12339
- oldPos += component.count;
12340
- }
12341
- }
12342
- return components;
12343
- }
12253
+ return ret;
12254
+ };
12255
+ Diff2.prototype.castInput = function(value, options) {
12256
+ return value;
12257
+ };
12258
+ Diff2.prototype.tokenize = function(value, options) {
12259
+ return Array.from(value);
12260
+ };
12261
+ Diff2.prototype.join = function(chars) {
12262
+ return chars.join("");
12263
+ };
12264
+ Diff2.prototype.postProcess = function(changeObjects, options) {
12265
+ return changeObjects;
12266
+ };
12267
+ Object.defineProperty(Diff2.prototype, "useLongestToken", {
12268
+ get: function() {
12269
+ return false;
12270
+ },
12271
+ enumerable: false,
12272
+ configurable: true
12273
+ });
12274
+ Diff2.prototype.buildValues = function(lastComponent, newTokens, oldTokens) {
12275
+ var components = [];
12276
+ var nextComponent;
12277
+ while (lastComponent) {
12278
+ components.push(lastComponent);
12279
+ nextComponent = lastComponent.previousComponent;
12280
+ delete lastComponent.previousComponent;
12281
+ lastComponent = nextComponent;
12282
+ }
12283
+ components.reverse();
12284
+ var componentLen = components.length;
12285
+ var componentPos = 0, newPos = 0, oldPos = 0;
12286
+ for (; componentPos < componentLen; componentPos++) {
12287
+ var component = components[componentPos];
12288
+ if (!component.removed) {
12289
+ if (!component.added && this.useLongestToken) {
12290
+ var value = newTokens.slice(newPos, newPos + component.count);
12291
+ value = value.map(function(value2, i) {
12292
+ var oldValue = oldTokens[oldPos + i];
12293
+ return oldValue.length > value2.length ? oldValue : value2;
12294
+ });
12295
+ component.value = this.join(value);
12296
+ } else {
12297
+ component.value = this.join(newTokens.slice(newPos, newPos + component.count));
12298
+ }
12299
+ newPos += component.count;
12300
+ if (!component.added) {
12301
+ oldPos += component.count;
12302
+ }
12303
+ } else {
12304
+ component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
12305
+ oldPos += component.count;
12306
+ }
12307
+ }
12308
+ return components;
12309
+ };
12310
+ return Diff2;
12311
+ })()
12312
+ );
12313
+ exports2.default = Diff;
12344
12314
  }
12345
12315
  });
12346
12316
 
12347
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js
12317
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/character.js
12348
12318
  var require_character = __commonJS({
12349
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/character.js"(exports2) {
12319
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/character.js"(exports2) {
12350
12320
  "use strict";
12351
- Object.defineProperty(exports2, "__esModule", {
12352
- value: true
12353
- });
12321
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
12322
+ var extendStatics = function(d, b) {
12323
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12324
+ d2.__proto__ = b2;
12325
+ } || function(d2, b2) {
12326
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
12327
+ };
12328
+ return extendStatics(d, b);
12329
+ };
12330
+ return function(d, b) {
12331
+ if (typeof b !== "function" && b !== null)
12332
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12333
+ extendStatics(d, b);
12334
+ function __() {
12335
+ this.constructor = d;
12336
+ }
12337
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12338
+ };
12339
+ })();
12340
+ Object.defineProperty(exports2, "__esModule", { value: true });
12354
12341
  exports2.characterDiff = void 0;
12355
12342
  exports2.diffChars = diffChars;
12356
- var _base = _interopRequireDefault(require_base());
12357
- function _interopRequireDefault(obj) {
12358
- return obj && obj.__esModule ? obj : { "default": obj };
12359
- }
12360
- var characterDiff = (
12361
- /*istanbul ignore start*/
12362
- exports2.characterDiff = /*istanbul ignore end*/
12363
- new /*istanbul ignore start*/
12364
- _base[
12365
- /*istanbul ignore start*/
12366
- "default"
12367
- /*istanbul ignore end*/
12368
- ]()
12343
+ var base_js_1 = require_base();
12344
+ var CharacterDiff = (
12345
+ /** @class */
12346
+ (function(_super) {
12347
+ __extends(CharacterDiff2, _super);
12348
+ function CharacterDiff2() {
12349
+ return _super !== null && _super.apply(this, arguments) || this;
12350
+ }
12351
+ return CharacterDiff2;
12352
+ })(base_js_1.default)
12369
12353
  );
12354
+ exports2.characterDiff = new CharacterDiff();
12370
12355
  function diffChars(oldStr, newStr, options) {
12371
- return characterDiff.diff(oldStr, newStr, options);
12356
+ return exports2.characterDiff.diff(oldStr, newStr, options);
12372
12357
  }
12373
12358
  }
12374
12359
  });
12375
12360
 
12376
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js
12361
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/util/string.js
12377
12362
  var require_string2 = __commonJS({
12378
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/string.js"(exports2) {
12363
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/util/string.js"(exports2) {
12379
12364
  "use strict";
12380
- Object.defineProperty(exports2, "__esModule", {
12381
- value: true
12382
- });
12383
- exports2.hasOnlyUnixLineEndings = hasOnlyUnixLineEndings;
12384
- exports2.hasOnlyWinLineEndings = hasOnlyWinLineEndings;
12365
+ Object.defineProperty(exports2, "__esModule", { value: true });
12385
12366
  exports2.longestCommonPrefix = longestCommonPrefix;
12386
12367
  exports2.longestCommonSuffix = longestCommonSuffix;
12387
- exports2.maximumOverlap = maximumOverlap;
12388
- exports2.removePrefix = removePrefix;
12389
- exports2.removeSuffix = removeSuffix;
12390
12368
  exports2.replacePrefix = replacePrefix;
12391
12369
  exports2.replaceSuffix = replaceSuffix;
12370
+ exports2.removePrefix = removePrefix;
12371
+ exports2.removeSuffix = removeSuffix;
12372
+ exports2.maximumOverlap = maximumOverlap;
12373
+ exports2.hasOnlyWinLineEndings = hasOnlyWinLineEndings;
12374
+ exports2.hasOnlyUnixLineEndings = hasOnlyUnixLineEndings;
12375
+ exports2.segment = segment;
12376
+ exports2.trailingWs = trailingWs;
12377
+ exports2.leadingWs = leadingWs;
12378
+ exports2.leadingAndTrailingWs = leadingAndTrailingWs;
12392
12379
  function longestCommonPrefix(str1, str2) {
12393
12380
  var i;
12394
12381
  for (i = 0; i < str1.length && i < str2.length; i++) {
@@ -12412,14 +12399,7 @@ var require_string2 = __commonJS({
12412
12399
  }
12413
12400
  function replacePrefix(string, oldPrefix, newPrefix) {
12414
12401
  if (string.slice(0, oldPrefix.length) != oldPrefix) {
12415
- throw Error(
12416
- /*istanbul ignore start*/
12417
- "string ".concat(
12418
- /*istanbul ignore end*/
12419
- JSON.stringify(string),
12420
- " doesn't start with prefix "
12421
- ).concat(JSON.stringify(oldPrefix), "; this is a bug")
12422
- );
12402
+ throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
12423
12403
  }
12424
12404
  return newPrefix + string.slice(oldPrefix.length);
12425
12405
  }
@@ -12428,14 +12408,7 @@ var require_string2 = __commonJS({
12428
12408
  return string + newSuffix;
12429
12409
  }
12430
12410
  if (string.slice(-oldSuffix.length) != oldSuffix) {
12431
- throw Error(
12432
- /*istanbul ignore start*/
12433
- "string ".concat(
12434
- /*istanbul ignore end*/
12435
- JSON.stringify(string),
12436
- " doesn't end with suffix "
12437
- ).concat(JSON.stringify(oldSuffix), "; this is a bug")
12438
- );
12411
+ throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
12439
12412
  }
12440
12413
  return string.slice(0, -oldSuffix.length) + newSuffix;
12441
12414
  }
@@ -12490,293 +12463,259 @@ var require_string2 = __commonJS({
12490
12463
  function hasOnlyUnixLineEndings(string) {
12491
12464
  return !string.includes("\r\n") && string.includes("\n");
12492
12465
  }
12466
+ function segment(string, segmenter) {
12467
+ var parts = [];
12468
+ for (var _i = 0, _a = Array.from(segmenter.segment(string)); _i < _a.length; _i++) {
12469
+ var segmentObj = _a[_i];
12470
+ var segment_1 = segmentObj.segment;
12471
+ if (parts.length && /\s/.test(parts[parts.length - 1]) && /\s/.test(segment_1)) {
12472
+ parts[parts.length - 1] += segment_1;
12473
+ } else {
12474
+ parts.push(segment_1);
12475
+ }
12476
+ }
12477
+ return parts;
12478
+ }
12479
+ function trailingWs(string, segmenter) {
12480
+ if (segmenter) {
12481
+ return leadingAndTrailingWs(string, segmenter)[1];
12482
+ }
12483
+ var i;
12484
+ for (i = string.length - 1; i >= 0; i--) {
12485
+ if (!string[i].match(/\s/)) {
12486
+ break;
12487
+ }
12488
+ }
12489
+ return string.substring(i + 1);
12490
+ }
12491
+ function leadingWs(string, segmenter) {
12492
+ if (segmenter) {
12493
+ return leadingAndTrailingWs(string, segmenter)[0];
12494
+ }
12495
+ var match = string.match(/^\s*/);
12496
+ return match ? match[0] : "";
12497
+ }
12498
+ function leadingAndTrailingWs(string, segmenter) {
12499
+ if (!segmenter) {
12500
+ return [leadingWs(string), trailingWs(string)];
12501
+ }
12502
+ if (segmenter.resolvedOptions().granularity != "word") {
12503
+ throw new Error('The segmenter passed must have a granularity of "word"');
12504
+ }
12505
+ var segments = segment(string, segmenter);
12506
+ var firstSeg = segments[0];
12507
+ var lastSeg = segments[segments.length - 1];
12508
+ var head = /\s/.test(firstSeg) ? firstSeg : "";
12509
+ var tail = /\s/.test(lastSeg) ? lastSeg : "";
12510
+ return [head, tail];
12511
+ }
12493
12512
  }
12494
12513
  });
12495
12514
 
12496
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js
12515
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/word.js
12497
12516
  var require_word = __commonJS({
12498
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/word.js"(exports2) {
12517
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/word.js"(exports2) {
12499
12518
  "use strict";
12500
- Object.defineProperty(exports2, "__esModule", {
12501
- value: true
12502
- });
12519
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
12520
+ var extendStatics = function(d, b) {
12521
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12522
+ d2.__proto__ = b2;
12523
+ } || function(d2, b2) {
12524
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
12525
+ };
12526
+ return extendStatics(d, b);
12527
+ };
12528
+ return function(d, b) {
12529
+ if (typeof b !== "function" && b !== null)
12530
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12531
+ extendStatics(d, b);
12532
+ function __() {
12533
+ this.constructor = d;
12534
+ }
12535
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12536
+ };
12537
+ })();
12538
+ Object.defineProperty(exports2, "__esModule", { value: true });
12539
+ exports2.wordsWithSpaceDiff = exports2.wordDiff = void 0;
12503
12540
  exports2.diffWords = diffWords;
12504
12541
  exports2.diffWordsWithSpace = diffWordsWithSpace;
12505
- exports2.wordWithSpaceDiff = exports2.wordDiff = void 0;
12506
- var _base = _interopRequireDefault(require_base());
12507
- var _string = require_string2();
12508
- function _interopRequireDefault(obj) {
12509
- return obj && obj.__esModule ? obj : { "default": obj };
12510
- }
12511
- 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}";
12512
- var tokenizeIncludingWhitespace = new RegExp(
12513
- /*istanbul ignore start*/
12514
- "[".concat(
12515
- /*istanbul ignore end*/
12516
- extendedWordChars,
12517
- "]+|\\s+|[^"
12518
- ).concat(extendedWordChars, "]"),
12519
- "ug"
12520
- );
12521
- var wordDiff = (
12522
- /*istanbul ignore start*/
12523
- exports2.wordDiff = /*istanbul ignore end*/
12524
- new /*istanbul ignore start*/
12525
- _base[
12526
- /*istanbul ignore start*/
12527
- "default"
12528
- /*istanbul ignore end*/
12529
- ]()
12530
- );
12531
- wordDiff.equals = function(left, right, options) {
12532
- if (options.ignoreCase) {
12533
- left = left.toLowerCase();
12534
- right = right.toLowerCase();
12535
- }
12536
- return left.trim() === right.trim();
12537
- };
12538
- wordDiff.tokenize = function(value) {
12539
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12540
- var parts;
12541
- if (options.intlSegmenter) {
12542
- if (options.intlSegmenter.resolvedOptions().granularity != "word") {
12543
- throw new Error('The segmenter passed must have a granularity of "word"');
12544
- }
12545
- parts = Array.from(options.intlSegmenter.segment(value), function(segment) {
12546
- return (
12547
- /*istanbul ignore end*/
12548
- segment.segment
12549
- );
12550
- });
12551
- } else {
12552
- parts = value.match(tokenizeIncludingWhitespace) || [];
12553
- }
12554
- var tokens = [];
12555
- var prevPart = null;
12556
- parts.forEach(function(part) {
12557
- if (/\s/.test(part)) {
12558
- if (prevPart == null) {
12559
- tokens.push(part);
12560
- } else {
12561
- tokens.push(tokens.pop() + part);
12562
- }
12563
- } else if (/\s/.test(prevPart)) {
12564
- if (tokens[tokens.length - 1] == prevPart) {
12565
- tokens.push(tokens.pop() + part);
12542
+ var base_js_1 = require_base();
12543
+ var string_js_1 = require_string2();
12544
+ var 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}";
12545
+ var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), "ug");
12546
+ var WordDiff = (
12547
+ /** @class */
12548
+ (function(_super) {
12549
+ __extends(WordDiff2, _super);
12550
+ function WordDiff2() {
12551
+ return _super !== null && _super.apply(this, arguments) || this;
12552
+ }
12553
+ WordDiff2.prototype.equals = function(left, right, options) {
12554
+ if (options.ignoreCase) {
12555
+ left = left.toLowerCase();
12556
+ right = right.toLowerCase();
12557
+ }
12558
+ return left.trim() === right.trim();
12559
+ };
12560
+ WordDiff2.prototype.tokenize = function(value, options) {
12561
+ if (options === void 0) {
12562
+ options = {};
12563
+ }
12564
+ var parts;
12565
+ if (options.intlSegmenter) {
12566
+ var segmenter = options.intlSegmenter;
12567
+ if (segmenter.resolvedOptions().granularity != "word") {
12568
+ throw new Error('The segmenter passed must have a granularity of "word"');
12569
+ }
12570
+ parts = (0, string_js_1.segment)(value, segmenter);
12566
12571
  } else {
12567
- tokens.push(prevPart + part);
12568
- }
12569
- } else {
12570
- tokens.push(part);
12571
- }
12572
- prevPart = part;
12573
- });
12574
- return tokens;
12575
- };
12576
- wordDiff.join = function(tokens) {
12577
- return tokens.map(function(token, i) {
12578
- if (i == 0) {
12579
- return token;
12580
- } else {
12581
- return token.replace(/^\s+/, "");
12582
- }
12583
- }).join("");
12584
- };
12585
- wordDiff.postProcess = function(changes, options) {
12586
- if (!changes || options.oneChangePerToken) {
12587
- return changes;
12588
- }
12589
- var lastKeep = null;
12590
- var insertion = null;
12591
- var deletion = null;
12592
- changes.forEach(function(change) {
12593
- if (change.added) {
12594
- insertion = change;
12595
- } else if (change.removed) {
12596
- deletion = change;
12597
- } else {
12572
+ parts = value.match(tokenizeIncludingWhitespace) || [];
12573
+ }
12574
+ var tokens = [];
12575
+ var prevPart = null;
12576
+ parts.forEach(function(part) {
12577
+ if (/\s/.test(part)) {
12578
+ if (prevPart == null) {
12579
+ tokens.push(part);
12580
+ } else {
12581
+ tokens.push(tokens.pop() + part);
12582
+ }
12583
+ } else if (prevPart != null && /\s/.test(prevPart)) {
12584
+ if (tokens[tokens.length - 1] == prevPart) {
12585
+ tokens.push(tokens.pop() + part);
12586
+ } else {
12587
+ tokens.push(prevPart + part);
12588
+ }
12589
+ } else {
12590
+ tokens.push(part);
12591
+ }
12592
+ prevPart = part;
12593
+ });
12594
+ return tokens;
12595
+ };
12596
+ WordDiff2.prototype.join = function(tokens) {
12597
+ return tokens.map(function(token, i) {
12598
+ if (i == 0) {
12599
+ return token;
12600
+ } else {
12601
+ return token.replace(/^\s+/, "");
12602
+ }
12603
+ }).join("");
12604
+ };
12605
+ WordDiff2.prototype.postProcess = function(changes, options) {
12606
+ if (!changes || options.oneChangePerToken) {
12607
+ return changes;
12608
+ }
12609
+ var lastKeep = null;
12610
+ var insertion = null;
12611
+ var deletion = null;
12612
+ changes.forEach(function(change) {
12613
+ if (change.added) {
12614
+ insertion = change;
12615
+ } else if (change.removed) {
12616
+ deletion = change;
12617
+ } else {
12618
+ if (insertion || deletion) {
12619
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options.intlSegmenter);
12620
+ }
12621
+ lastKeep = change;
12622
+ insertion = null;
12623
+ deletion = null;
12624
+ }
12625
+ });
12598
12626
  if (insertion || deletion) {
12599
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
12627
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options.intlSegmenter);
12600
12628
  }
12601
- lastKeep = change;
12602
- insertion = null;
12603
- deletion = null;
12604
- }
12605
- });
12606
- if (insertion || deletion) {
12607
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
12608
- }
12609
- return changes;
12610
- };
12629
+ return changes;
12630
+ };
12631
+ return WordDiff2;
12632
+ })(base_js_1.default)
12633
+ );
12634
+ exports2.wordDiff = new WordDiff();
12611
12635
  function diffWords(oldStr, newStr, options) {
12612
- if (
12613
- /*istanbul ignore start*/
12614
- /*istanbul ignore end*/
12615
- (options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace
12616
- ) {
12636
+ if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) {
12617
12637
  return diffWordsWithSpace(oldStr, newStr, options);
12618
12638
  }
12619
- return wordDiff.diff(oldStr, newStr, options);
12639
+ return exports2.wordDiff.diff(oldStr, newStr, options);
12620
12640
  }
12621
- function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
12641
+ function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep, segmenter) {
12622
12642
  if (deletion && insertion) {
12623
- var oldWsPrefix = deletion.value.match(/^\s*/)[0];
12624
- var oldWsSuffix = deletion.value.match(/\s*$/)[0];
12625
- var newWsPrefix = insertion.value.match(/^\s*/)[0];
12626
- var newWsSuffix = insertion.value.match(/\s*$/)[0];
12643
+ var _a = (0, string_js_1.leadingAndTrailingWs)(deletion.value, segmenter), oldWsPrefix = _a[0], oldWsSuffix = _a[1];
12644
+ var _b = (0, string_js_1.leadingAndTrailingWs)(insertion.value, segmenter), newWsPrefix = _b[0], newWsSuffix = _b[1];
12627
12645
  if (startKeep) {
12628
- var commonWsPrefix = (
12629
- /*istanbul ignore start*/
12630
- (0, /*istanbul ignore end*/
12631
- /*istanbul ignore start*/
12632
- _string.longestCommonPrefix)(oldWsPrefix, newWsPrefix)
12633
- );
12634
- startKeep.value = /*istanbul ignore start*/
12635
- (0, /*istanbul ignore end*/
12636
- /*istanbul ignore start*/
12637
- _string.replaceSuffix)(startKeep.value, newWsPrefix, commonWsPrefix);
12638
- deletion.value = /*istanbul ignore start*/
12639
- (0, /*istanbul ignore end*/
12640
- /*istanbul ignore start*/
12641
- _string.removePrefix)(deletion.value, commonWsPrefix);
12642
- insertion.value = /*istanbul ignore start*/
12643
- (0, /*istanbul ignore end*/
12644
- /*istanbul ignore start*/
12645
- _string.removePrefix)(insertion.value, commonWsPrefix);
12646
+ var commonWsPrefix = (0, string_js_1.longestCommonPrefix)(oldWsPrefix, newWsPrefix);
12647
+ startKeep.value = (0, string_js_1.replaceSuffix)(startKeep.value, newWsPrefix, commonWsPrefix);
12648
+ deletion.value = (0, string_js_1.removePrefix)(deletion.value, commonWsPrefix);
12649
+ insertion.value = (0, string_js_1.removePrefix)(insertion.value, commonWsPrefix);
12646
12650
  }
12647
12651
  if (endKeep) {
12648
- var commonWsSuffix = (
12649
- /*istanbul ignore start*/
12650
- (0, /*istanbul ignore end*/
12651
- /*istanbul ignore start*/
12652
- _string.longestCommonSuffix)(oldWsSuffix, newWsSuffix)
12653
- );
12654
- endKeep.value = /*istanbul ignore start*/
12655
- (0, /*istanbul ignore end*/
12656
- /*istanbul ignore start*/
12657
- _string.replacePrefix)(endKeep.value, newWsSuffix, commonWsSuffix);
12658
- deletion.value = /*istanbul ignore start*/
12659
- (0, /*istanbul ignore end*/
12660
- /*istanbul ignore start*/
12661
- _string.removeSuffix)(deletion.value, commonWsSuffix);
12662
- insertion.value = /*istanbul ignore start*/
12663
- (0, /*istanbul ignore end*/
12664
- /*istanbul ignore start*/
12665
- _string.removeSuffix)(insertion.value, commonWsSuffix);
12652
+ var commonWsSuffix = (0, string_js_1.longestCommonSuffix)(oldWsSuffix, newWsSuffix);
12653
+ endKeep.value = (0, string_js_1.replacePrefix)(endKeep.value, newWsSuffix, commonWsSuffix);
12654
+ deletion.value = (0, string_js_1.removeSuffix)(deletion.value, commonWsSuffix);
12655
+ insertion.value = (0, string_js_1.removeSuffix)(insertion.value, commonWsSuffix);
12666
12656
  }
12667
12657
  } else if (insertion) {
12668
12658
  if (startKeep) {
12669
- insertion.value = insertion.value.replace(/^\s*/, "");
12659
+ var ws = (0, string_js_1.leadingWs)(insertion.value, segmenter);
12660
+ insertion.value = insertion.value.substring(ws.length);
12670
12661
  }
12671
12662
  if (endKeep) {
12672
- endKeep.value = endKeep.value.replace(/^\s*/, "");
12663
+ var ws = (0, string_js_1.leadingWs)(endKeep.value, segmenter);
12664
+ endKeep.value = endKeep.value.substring(ws.length);
12673
12665
  }
12674
12666
  } else if (startKeep && endKeep) {
12675
- var newWsFull = endKeep.value.match(/^\s*/)[0], delWsStart = deletion.value.match(/^\s*/)[0], delWsEnd = deletion.value.match(/\s*$/)[0];
12676
- var newWsStart = (
12677
- /*istanbul ignore start*/
12678
- (0, /*istanbul ignore end*/
12679
- /*istanbul ignore start*/
12680
- _string.longestCommonPrefix)(newWsFull, delWsStart)
12681
- );
12682
- deletion.value = /*istanbul ignore start*/
12683
- (0, /*istanbul ignore end*/
12684
- /*istanbul ignore start*/
12685
- _string.removePrefix)(deletion.value, newWsStart);
12686
- var newWsEnd = (
12687
- /*istanbul ignore start*/
12688
- (0, /*istanbul ignore end*/
12689
- /*istanbul ignore start*/
12690
- _string.longestCommonSuffix)(
12691
- /*istanbul ignore start*/
12692
- (0, /*istanbul ignore end*/
12693
- /*istanbul ignore start*/
12694
- _string.removePrefix)(newWsFull, newWsStart),
12695
- delWsEnd
12696
- )
12697
- );
12698
- deletion.value = /*istanbul ignore start*/
12699
- (0, /*istanbul ignore end*/
12700
- /*istanbul ignore start*/
12701
- _string.removeSuffix)(deletion.value, newWsEnd);
12702
- endKeep.value = /*istanbul ignore start*/
12703
- (0, /*istanbul ignore end*/
12704
- /*istanbul ignore start*/
12705
- _string.replacePrefix)(endKeep.value, newWsFull, newWsEnd);
12706
- startKeep.value = /*istanbul ignore start*/
12707
- (0, /*istanbul ignore end*/
12708
- /*istanbul ignore start*/
12709
- _string.replaceSuffix)(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
12667
+ var newWsFull = (0, string_js_1.leadingWs)(endKeep.value, segmenter), _c = (0, string_js_1.leadingAndTrailingWs)(deletion.value, segmenter), delWsStart = _c[0], delWsEnd = _c[1];
12668
+ var newWsStart = (0, string_js_1.longestCommonPrefix)(newWsFull, delWsStart);
12669
+ deletion.value = (0, string_js_1.removePrefix)(deletion.value, newWsStart);
12670
+ var newWsEnd = (0, string_js_1.longestCommonSuffix)((0, string_js_1.removePrefix)(newWsFull, newWsStart), delWsEnd);
12671
+ deletion.value = (0, string_js_1.removeSuffix)(deletion.value, newWsEnd);
12672
+ endKeep.value = (0, string_js_1.replacePrefix)(endKeep.value, newWsFull, newWsEnd);
12673
+ startKeep.value = (0, string_js_1.replaceSuffix)(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
12710
12674
  } else if (endKeep) {
12711
- var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0];
12712
- var deletionWsSuffix = deletion.value.match(/\s*$/)[0];
12713
- var overlap = (
12714
- /*istanbul ignore start*/
12715
- (0, /*istanbul ignore end*/
12716
- /*istanbul ignore start*/
12717
- _string.maximumOverlap)(deletionWsSuffix, endKeepWsPrefix)
12718
- );
12719
- deletion.value = /*istanbul ignore start*/
12720
- (0, /*istanbul ignore end*/
12721
- /*istanbul ignore start*/
12722
- _string.removeSuffix)(deletion.value, overlap);
12675
+ var endKeepWsPrefix = (0, string_js_1.leadingWs)(endKeep.value, segmenter);
12676
+ var deletionWsSuffix = (0, string_js_1.trailingWs)(deletion.value, segmenter);
12677
+ var overlap = (0, string_js_1.maximumOverlap)(deletionWsSuffix, endKeepWsPrefix);
12678
+ deletion.value = (0, string_js_1.removeSuffix)(deletion.value, overlap);
12723
12679
  } else if (startKeep) {
12724
- var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0];
12725
- var deletionWsPrefix = deletion.value.match(/^\s*/)[0];
12726
- var _overlap = (
12727
- /*istanbul ignore start*/
12728
- (0, /*istanbul ignore end*/
12729
- /*istanbul ignore start*/
12730
- _string.maximumOverlap)(startKeepWsSuffix, deletionWsPrefix)
12731
- );
12732
- deletion.value = /*istanbul ignore start*/
12733
- (0, /*istanbul ignore end*/
12734
- /*istanbul ignore start*/
12735
- _string.removePrefix)(deletion.value, _overlap);
12736
- }
12737
- }
12738
- var wordWithSpaceDiff = (
12739
- /*istanbul ignore start*/
12740
- exports2.wordWithSpaceDiff = /*istanbul ignore end*/
12741
- new /*istanbul ignore start*/
12742
- _base[
12743
- /*istanbul ignore start*/
12744
- "default"
12745
- /*istanbul ignore end*/
12746
- ]()
12680
+ var startKeepWsSuffix = (0, string_js_1.trailingWs)(startKeep.value, segmenter);
12681
+ var deletionWsPrefix = (0, string_js_1.leadingWs)(deletion.value, segmenter);
12682
+ var overlap = (0, string_js_1.maximumOverlap)(startKeepWsSuffix, deletionWsPrefix);
12683
+ deletion.value = (0, string_js_1.removePrefix)(deletion.value, overlap);
12684
+ }
12685
+ }
12686
+ var WordsWithSpaceDiff = (
12687
+ /** @class */
12688
+ (function(_super) {
12689
+ __extends(WordsWithSpaceDiff2, _super);
12690
+ function WordsWithSpaceDiff2() {
12691
+ return _super !== null && _super.apply(this, arguments) || this;
12692
+ }
12693
+ WordsWithSpaceDiff2.prototype.tokenize = function(value) {
12694
+ var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
12695
+ return value.match(regex) || [];
12696
+ };
12697
+ return WordsWithSpaceDiff2;
12698
+ })(base_js_1.default)
12747
12699
  );
12748
- wordWithSpaceDiff.tokenize = function(value) {
12749
- var regex = new RegExp(
12750
- /*istanbul ignore start*/
12751
- "(\\r?\\n)|[".concat(
12752
- /*istanbul ignore end*/
12753
- extendedWordChars,
12754
- "]+|[^\\S\\n\\r]+|[^"
12755
- ).concat(extendedWordChars, "]"),
12756
- "ug"
12757
- );
12758
- return value.match(regex) || [];
12759
- };
12700
+ exports2.wordsWithSpaceDiff = new WordsWithSpaceDiff();
12760
12701
  function diffWordsWithSpace(oldStr, newStr, options) {
12761
- return wordWithSpaceDiff.diff(oldStr, newStr, options);
12702
+ return exports2.wordsWithSpaceDiff.diff(oldStr, newStr, options);
12762
12703
  }
12763
12704
  }
12764
12705
  });
12765
12706
 
12766
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js
12707
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/util/params.js
12767
12708
  var require_params = __commonJS({
12768
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/params.js"(exports2) {
12709
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/util/params.js"(exports2) {
12769
12710
  "use strict";
12770
- Object.defineProperty(exports2, "__esModule", {
12771
- value: true
12772
- });
12711
+ Object.defineProperty(exports2, "__esModule", { value: true });
12773
12712
  exports2.generateOptions = generateOptions;
12774
12713
  function generateOptions(options, defaults) {
12775
12714
  if (typeof options === "function") {
12776
12715
  defaults.callback = options;
12777
12716
  } else if (options) {
12778
12717
  for (var name in options) {
12779
- if (options.hasOwnProperty(name)) {
12718
+ if (Object.prototype.hasOwnProperty.call(options, name)) {
12780
12719
  defaults[name] = options[name];
12781
12720
  }
12782
12721
  }
@@ -12786,32 +12725,75 @@ var require_params = __commonJS({
12786
12725
  }
12787
12726
  });
12788
12727
 
12789
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js
12728
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/line.js
12790
12729
  var require_line = __commonJS({
12791
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/line.js"(exports2) {
12730
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/line.js"(exports2) {
12792
12731
  "use strict";
12793
- Object.defineProperty(exports2, "__esModule", {
12794
- value: true
12795
- });
12732
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
12733
+ var extendStatics = function(d, b) {
12734
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12735
+ d2.__proto__ = b2;
12736
+ } || function(d2, b2) {
12737
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
12738
+ };
12739
+ return extendStatics(d, b);
12740
+ };
12741
+ return function(d, b) {
12742
+ if (typeof b !== "function" && b !== null)
12743
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12744
+ extendStatics(d, b);
12745
+ function __() {
12746
+ this.constructor = d;
12747
+ }
12748
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12749
+ };
12750
+ })();
12751
+ Object.defineProperty(exports2, "__esModule", { value: true });
12752
+ exports2.lineDiff = void 0;
12796
12753
  exports2.diffLines = diffLines;
12797
12754
  exports2.diffTrimmedLines = diffTrimmedLines;
12798
- exports2.lineDiff = void 0;
12799
- var _base = _interopRequireDefault(require_base());
12800
- var _params = require_params();
12801
- function _interopRequireDefault(obj) {
12802
- return obj && obj.__esModule ? obj : { "default": obj };
12803
- }
12804
- var lineDiff = (
12805
- /*istanbul ignore start*/
12806
- exports2.lineDiff = /*istanbul ignore end*/
12807
- new /*istanbul ignore start*/
12808
- _base[
12809
- /*istanbul ignore start*/
12810
- "default"
12811
- /*istanbul ignore end*/
12812
- ]()
12755
+ exports2.tokenize = tokenize;
12756
+ var base_js_1 = require_base();
12757
+ var params_js_1 = require_params();
12758
+ var LineDiff = (
12759
+ /** @class */
12760
+ (function(_super) {
12761
+ __extends(LineDiff2, _super);
12762
+ function LineDiff2() {
12763
+ var _this = _super !== null && _super.apply(this, arguments) || this;
12764
+ _this.tokenize = tokenize;
12765
+ return _this;
12766
+ }
12767
+ LineDiff2.prototype.equals = function(left, right, options) {
12768
+ if (options.ignoreWhitespace) {
12769
+ if (!options.newlineIsToken || !left.includes("\n")) {
12770
+ left = left.trim();
12771
+ }
12772
+ if (!options.newlineIsToken || !right.includes("\n")) {
12773
+ right = right.trim();
12774
+ }
12775
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
12776
+ if (left.endsWith("\n")) {
12777
+ left = left.slice(0, -1);
12778
+ }
12779
+ if (right.endsWith("\n")) {
12780
+ right = right.slice(0, -1);
12781
+ }
12782
+ }
12783
+ return _super.prototype.equals.call(this, left, right, options);
12784
+ };
12785
+ return LineDiff2;
12786
+ })(base_js_1.default)
12813
12787
  );
12814
- lineDiff.tokenize = function(value, options) {
12788
+ exports2.lineDiff = new LineDiff();
12789
+ function diffLines(oldStr, newStr, options) {
12790
+ return exports2.lineDiff.diff(oldStr, newStr, options);
12791
+ }
12792
+ function diffTrimmedLines(oldStr, newStr, options) {
12793
+ options = (0, params_js_1.generateOptions)(options, { ignoreWhitespace: true });
12794
+ return exports2.lineDiff.diff(oldStr, newStr, options);
12795
+ }
12796
+ function tokenize(value, options) {
12815
12797
  if (options.stripTrailingCr) {
12816
12798
  value = value.replace(/\r\n/g, "\n");
12817
12799
  }
@@ -12828,179 +12810,191 @@ var require_line = __commonJS({
12828
12810
  }
12829
12811
  }
12830
12812
  return retLines;
12831
- };
12832
- lineDiff.equals = function(left, right, options) {
12833
- if (options.ignoreWhitespace) {
12834
- if (!options.newlineIsToken || !left.includes("\n")) {
12835
- left = left.trim();
12836
- }
12837
- if (!options.newlineIsToken || !right.includes("\n")) {
12838
- right = right.trim();
12839
- }
12840
- } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
12841
- if (left.endsWith("\n")) {
12842
- left = left.slice(0, -1);
12843
- }
12844
- if (right.endsWith("\n")) {
12845
- right = right.slice(0, -1);
12846
- }
12847
- }
12848
- return (
12849
- /*istanbul ignore start*/
12850
- _base[
12851
- /*istanbul ignore start*/
12852
- "default"
12853
- /*istanbul ignore end*/
12854
- ].prototype.equals.call(this, left, right, options)
12855
- );
12856
- };
12857
- function diffLines(oldStr, newStr, callback) {
12858
- return lineDiff.diff(oldStr, newStr, callback);
12859
- }
12860
- function diffTrimmedLines(oldStr, newStr, callback) {
12861
- var options = (
12862
- /*istanbul ignore start*/
12863
- (0, /*istanbul ignore end*/
12864
- /*istanbul ignore start*/
12865
- _params.generateOptions)(callback, {
12866
- ignoreWhitespace: true
12867
- })
12868
- );
12869
- return lineDiff.diff(oldStr, newStr, options);
12870
12813
  }
12871
12814
  }
12872
12815
  });
12873
12816
 
12874
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js
12817
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/sentence.js
12875
12818
  var require_sentence = __commonJS({
12876
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/sentence.js"(exports2) {
12819
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/sentence.js"(exports2) {
12877
12820
  "use strict";
12878
- Object.defineProperty(exports2, "__esModule", {
12879
- value: true
12880
- });
12881
- exports2.diffSentences = diffSentences;
12821
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
12822
+ var extendStatics = function(d, b) {
12823
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12824
+ d2.__proto__ = b2;
12825
+ } || function(d2, b2) {
12826
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
12827
+ };
12828
+ return extendStatics(d, b);
12829
+ };
12830
+ return function(d, b) {
12831
+ if (typeof b !== "function" && b !== null)
12832
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12833
+ extendStatics(d, b);
12834
+ function __() {
12835
+ this.constructor = d;
12836
+ }
12837
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12838
+ };
12839
+ })();
12840
+ Object.defineProperty(exports2, "__esModule", { value: true });
12882
12841
  exports2.sentenceDiff = void 0;
12883
- var _base = _interopRequireDefault(require_base());
12884
- function _interopRequireDefault(obj) {
12885
- return obj && obj.__esModule ? obj : { "default": obj };
12886
- }
12887
- var sentenceDiff = (
12888
- /*istanbul ignore start*/
12889
- exports2.sentenceDiff = /*istanbul ignore end*/
12890
- new /*istanbul ignore start*/
12891
- _base[
12892
- /*istanbul ignore start*/
12893
- "default"
12894
- /*istanbul ignore end*/
12895
- ]()
12842
+ exports2.diffSentences = diffSentences;
12843
+ var base_js_1 = require_base();
12844
+ function isSentenceEndPunct(char) {
12845
+ return char == "." || char == "!" || char == "?";
12846
+ }
12847
+ var SentenceDiff = (
12848
+ /** @class */
12849
+ (function(_super) {
12850
+ __extends(SentenceDiff2, _super);
12851
+ function SentenceDiff2() {
12852
+ return _super !== null && _super.apply(this, arguments) || this;
12853
+ }
12854
+ SentenceDiff2.prototype.tokenize = function(value) {
12855
+ var _a;
12856
+ var result = [];
12857
+ var tokenStartI = 0;
12858
+ for (var i = 0; i < value.length; i++) {
12859
+ if (i == value.length - 1) {
12860
+ result.push(value.slice(tokenStartI));
12861
+ break;
12862
+ }
12863
+ if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
12864
+ result.push(value.slice(tokenStartI, i + 1));
12865
+ i = tokenStartI = i + 1;
12866
+ while ((_a = value[i + 1]) === null || _a === void 0 ? void 0 : _a.match(/\s/)) {
12867
+ i++;
12868
+ }
12869
+ result.push(value.slice(tokenStartI, i + 1));
12870
+ tokenStartI = i + 1;
12871
+ }
12872
+ }
12873
+ return result;
12874
+ };
12875
+ return SentenceDiff2;
12876
+ })(base_js_1.default)
12896
12877
  );
12897
- sentenceDiff.tokenize = function(value) {
12898
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
12899
- };
12900
- function diffSentences(oldStr, newStr, callback) {
12901
- return sentenceDiff.diff(oldStr, newStr, callback);
12878
+ exports2.sentenceDiff = new SentenceDiff();
12879
+ function diffSentences(oldStr, newStr, options) {
12880
+ return exports2.sentenceDiff.diff(oldStr, newStr, options);
12902
12881
  }
12903
12882
  }
12904
12883
  });
12905
12884
 
12906
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js
12885
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/css.js
12907
12886
  var require_css = __commonJS({
12908
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/css.js"(exports2) {
12887
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/css.js"(exports2) {
12909
12888
  "use strict";
12910
- Object.defineProperty(exports2, "__esModule", {
12911
- value: true
12912
- });
12889
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
12890
+ var extendStatics = function(d, b) {
12891
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12892
+ d2.__proto__ = b2;
12893
+ } || function(d2, b2) {
12894
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
12895
+ };
12896
+ return extendStatics(d, b);
12897
+ };
12898
+ return function(d, b) {
12899
+ if (typeof b !== "function" && b !== null)
12900
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12901
+ extendStatics(d, b);
12902
+ function __() {
12903
+ this.constructor = d;
12904
+ }
12905
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12906
+ };
12907
+ })();
12908
+ Object.defineProperty(exports2, "__esModule", { value: true });
12913
12909
  exports2.cssDiff = void 0;
12914
12910
  exports2.diffCss = diffCss;
12915
- var _base = _interopRequireDefault(require_base());
12916
- function _interopRequireDefault(obj) {
12917
- return obj && obj.__esModule ? obj : { "default": obj };
12918
- }
12919
- var cssDiff = (
12920
- /*istanbul ignore start*/
12921
- exports2.cssDiff = /*istanbul ignore end*/
12922
- new /*istanbul ignore start*/
12923
- _base[
12924
- /*istanbul ignore start*/
12925
- "default"
12926
- /*istanbul ignore end*/
12927
- ]()
12911
+ var base_js_1 = require_base();
12912
+ var CssDiff = (
12913
+ /** @class */
12914
+ (function(_super) {
12915
+ __extends(CssDiff2, _super);
12916
+ function CssDiff2() {
12917
+ return _super !== null && _super.apply(this, arguments) || this;
12918
+ }
12919
+ CssDiff2.prototype.tokenize = function(value) {
12920
+ return value.split(/([{}:;,]|\s+)/);
12921
+ };
12922
+ return CssDiff2;
12923
+ })(base_js_1.default)
12928
12924
  );
12929
- cssDiff.tokenize = function(value) {
12930
- return value.split(/([{}:;,]|\s+)/);
12931
- };
12932
- function diffCss(oldStr, newStr, callback) {
12933
- return cssDiff.diff(oldStr, newStr, callback);
12925
+ exports2.cssDiff = new CssDiff();
12926
+ function diffCss(oldStr, newStr, options) {
12927
+ return exports2.cssDiff.diff(oldStr, newStr, options);
12934
12928
  }
12935
12929
  }
12936
12930
  });
12937
12931
 
12938
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js
12932
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/json.js
12939
12933
  var require_json = __commonJS({
12940
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/json.js"(exports2) {
12934
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/json.js"(exports2) {
12941
12935
  "use strict";
12942
- Object.defineProperty(exports2, "__esModule", {
12943
- value: true
12944
- });
12945
- exports2.canonicalize = canonicalize;
12946
- exports2.diffJson = diffJson;
12936
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
12937
+ var extendStatics = function(d, b) {
12938
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
12939
+ d2.__proto__ = b2;
12940
+ } || function(d2, b2) {
12941
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
12942
+ };
12943
+ return extendStatics(d, b);
12944
+ };
12945
+ return function(d, b) {
12946
+ if (typeof b !== "function" && b !== null)
12947
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12948
+ extendStatics(d, b);
12949
+ function __() {
12950
+ this.constructor = d;
12951
+ }
12952
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12953
+ };
12954
+ })();
12955
+ Object.defineProperty(exports2, "__esModule", { value: true });
12947
12956
  exports2.jsonDiff = void 0;
12948
- var _base = _interopRequireDefault(require_base());
12949
- var _line = require_line();
12950
- function _interopRequireDefault(obj) {
12951
- return obj && obj.__esModule ? obj : { "default": obj };
12952
- }
12953
- function _typeof(o) {
12954
- "@babel/helpers - typeof";
12955
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
12956
- return typeof o2;
12957
- } : function(o2) {
12958
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
12959
- }, _typeof(o);
12960
- }
12961
- var jsonDiff = (
12962
- /*istanbul ignore start*/
12963
- exports2.jsonDiff = /*istanbul ignore end*/
12964
- new /*istanbul ignore start*/
12965
- _base[
12966
- /*istanbul ignore start*/
12967
- "default"
12968
- /*istanbul ignore end*/
12969
- ]()
12957
+ exports2.diffJson = diffJson;
12958
+ exports2.canonicalize = canonicalize;
12959
+ var base_js_1 = require_base();
12960
+ var line_js_1 = require_line();
12961
+ var JsonDiff = (
12962
+ /** @class */
12963
+ (function(_super) {
12964
+ __extends(JsonDiff2, _super);
12965
+ function JsonDiff2() {
12966
+ var _this = _super !== null && _super.apply(this, arguments) || this;
12967
+ _this.tokenize = line_js_1.tokenize;
12968
+ return _this;
12969
+ }
12970
+ Object.defineProperty(JsonDiff2.prototype, "useLongestToken", {
12971
+ get: function() {
12972
+ return true;
12973
+ },
12974
+ enumerable: false,
12975
+ configurable: true
12976
+ });
12977
+ JsonDiff2.prototype.castInput = function(value, options) {
12978
+ var undefinedReplacement = options.undefinedReplacement, _a = options.stringifyReplacer, stringifyReplacer = _a === void 0 ? function(k, v) {
12979
+ return typeof v === "undefined" ? undefinedReplacement : v;
12980
+ } : _a;
12981
+ return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
12982
+ };
12983
+ JsonDiff2.prototype.equals = function(left, right, options) {
12984
+ return _super.prototype.equals.call(this, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
12985
+ };
12986
+ return JsonDiff2;
12987
+ })(base_js_1.default)
12970
12988
  );
12971
- jsonDiff.useLongestToken = true;
12972
- jsonDiff.tokenize = /*istanbul ignore start*/
12973
- _line.lineDiff.tokenize;
12974
- jsonDiff.castInput = function(value, options) {
12975
- var undefinedReplacement = options.undefinedReplacement, _options$stringifyRep = (
12976
- /*istanbul ignore end*/
12977
- options.stringifyReplacer
12978
- ), stringifyReplacer = _options$stringifyRep === void 0 ? function(k, v) {
12979
- return (
12980
- /*istanbul ignore end*/
12981
- typeof v === "undefined" ? undefinedReplacement : v
12982
- );
12983
- } : _options$stringifyRep;
12984
- return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
12985
- };
12986
- jsonDiff.equals = function(left, right, options) {
12987
- return (
12988
- /*istanbul ignore start*/
12989
- _base[
12990
- /*istanbul ignore start*/
12991
- "default"
12992
- /*istanbul ignore end*/
12993
- ].prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options)
12994
- );
12995
- };
12996
- function diffJson(oldObj, newObj, options) {
12997
- return jsonDiff.diff(oldObj, newObj, options);
12989
+ exports2.jsonDiff = new JsonDiff();
12990
+ function diffJson(oldStr, newStr, options) {
12991
+ return exports2.jsonDiff.diff(oldStr, newStr, options);
12998
12992
  }
12999
12993
  function canonicalize(obj, stack, replacementStack, replacer, key) {
13000
12994
  stack = stack || [];
13001
12995
  replacementStack = replacementStack || [];
13002
12996
  if (replacer) {
13003
- obj = replacer(key, obj);
12997
+ obj = replacer(key === void 0 ? "" : key, obj);
13004
12998
  }
13005
12999
  var i;
13006
13000
  for (i = 0; i < stack.length; i += 1) {
@@ -13014,7 +13008,7 @@ var require_json = __commonJS({
13014
13008
  canonicalizedObj = new Array(obj.length);
13015
13009
  replacementStack.push(canonicalizedObj);
13016
13010
  for (i = 0; i < obj.length; i += 1) {
13017
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
13011
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
13018
13012
  }
13019
13013
  stack.pop();
13020
13014
  replacementStack.pop();
@@ -13023,26 +13017,21 @@ var require_json = __commonJS({
13023
13017
  if (obj && obj.toJSON) {
13024
13018
  obj = obj.toJSON();
13025
13019
  }
13026
- if (
13027
- /*istanbul ignore start*/
13028
- _typeof(
13029
- /*istanbul ignore end*/
13030
- obj
13031
- ) === "object" && obj !== null
13032
- ) {
13020
+ if (typeof obj === "object" && obj !== null) {
13033
13021
  stack.push(obj);
13034
13022
  canonicalizedObj = {};
13035
13023
  replacementStack.push(canonicalizedObj);
13036
- var sortedKeys = [], _key;
13037
- for (_key in obj) {
13038
- if (Object.prototype.hasOwnProperty.call(obj, _key)) {
13039
- sortedKeys.push(_key);
13024
+ var sortedKeys = [];
13025
+ var key_1;
13026
+ for (key_1 in obj) {
13027
+ if (Object.prototype.hasOwnProperty.call(obj, key_1)) {
13028
+ sortedKeys.push(key_1);
13040
13029
  }
13041
13030
  }
13042
13031
  sortedKeys.sort();
13043
13032
  for (i = 0; i < sortedKeys.length; i += 1) {
13044
- _key = sortedKeys[i];
13045
- canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
13033
+ key_1 = sortedKeys[i];
13034
+ canonicalizedObj[key_1] = canonicalize(obj[key_1], stack, replacementStack, replacer, key_1);
13046
13035
  }
13047
13036
  stack.pop();
13048
13037
  replacementStack.pop();
@@ -13054,183 +13043,114 @@ var require_json = __commonJS({
13054
13043
  }
13055
13044
  });
13056
13045
 
13057
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js
13046
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/array.js
13058
13047
  var require_array2 = __commonJS({
13059
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/diff/array.js"(exports2) {
13048
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/diff/array.js"(exports2) {
13060
13049
  "use strict";
13061
- Object.defineProperty(exports2, "__esModule", {
13062
- value: true
13063
- });
13050
+ var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
13051
+ var extendStatics = function(d, b) {
13052
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
13053
+ d2.__proto__ = b2;
13054
+ } || function(d2, b2) {
13055
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
13056
+ };
13057
+ return extendStatics(d, b);
13058
+ };
13059
+ return function(d, b) {
13060
+ if (typeof b !== "function" && b !== null)
13061
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13062
+ extendStatics(d, b);
13063
+ function __() {
13064
+ this.constructor = d;
13065
+ }
13066
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13067
+ };
13068
+ })();
13069
+ Object.defineProperty(exports2, "__esModule", { value: true });
13064
13070
  exports2.arrayDiff = void 0;
13065
13071
  exports2.diffArrays = diffArrays;
13066
- var _base = _interopRequireDefault(require_base());
13067
- function _interopRequireDefault(obj) {
13068
- return obj && obj.__esModule ? obj : { "default": obj };
13069
- }
13070
- var arrayDiff = (
13071
- /*istanbul ignore start*/
13072
- exports2.arrayDiff = /*istanbul ignore end*/
13073
- new /*istanbul ignore start*/
13074
- _base[
13075
- /*istanbul ignore start*/
13076
- "default"
13077
- /*istanbul ignore end*/
13078
- ]()
13072
+ var base_js_1 = require_base();
13073
+ var ArrayDiff = (
13074
+ /** @class */
13075
+ (function(_super) {
13076
+ __extends(ArrayDiff2, _super);
13077
+ function ArrayDiff2() {
13078
+ return _super !== null && _super.apply(this, arguments) || this;
13079
+ }
13080
+ ArrayDiff2.prototype.tokenize = function(value) {
13081
+ return value.slice();
13082
+ };
13083
+ ArrayDiff2.prototype.join = function(value) {
13084
+ return value;
13085
+ };
13086
+ ArrayDiff2.prototype.removeEmpty = function(value) {
13087
+ return value;
13088
+ };
13089
+ return ArrayDiff2;
13090
+ })(base_js_1.default)
13079
13091
  );
13080
- arrayDiff.tokenize = function(value) {
13081
- return value.slice();
13082
- };
13083
- arrayDiff.join = arrayDiff.removeEmpty = function(value) {
13084
- return value;
13085
- };
13086
- function diffArrays(oldArr, newArr, callback) {
13087
- return arrayDiff.diff(oldArr, newArr, callback);
13092
+ exports2.arrayDiff = new ArrayDiff();
13093
+ function diffArrays(oldArr, newArr, options) {
13094
+ return exports2.arrayDiff.diff(oldArr, newArr, options);
13088
13095
  }
13089
13096
  }
13090
13097
  });
13091
13098
 
13092
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js
13099
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/line-endings.js
13093
13100
  var require_line_endings = __commonJS({
13094
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/line-endings.js"(exports2) {
13101
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/line-endings.js"(exports2) {
13095
13102
  "use strict";
13096
- Object.defineProperty(exports2, "__esModule", {
13097
- value: true
13098
- });
13099
- exports2.isUnix = isUnix;
13100
- exports2.isWin = isWin;
13103
+ var __assign = exports2 && exports2.__assign || function() {
13104
+ __assign = Object.assign || function(t) {
13105
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
13106
+ s = arguments[i];
13107
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13108
+ t[p] = s[p];
13109
+ }
13110
+ return t;
13111
+ };
13112
+ return __assign.apply(this, arguments);
13113
+ };
13114
+ Object.defineProperty(exports2, "__esModule", { value: true });
13101
13115
  exports2.unixToWin = unixToWin;
13102
13116
  exports2.winToUnix = winToUnix;
13103
- function _typeof(o) {
13104
- "@babel/helpers - typeof";
13105
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
13106
- return typeof o2;
13107
- } : function(o2) {
13108
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
13109
- }, _typeof(o);
13110
- }
13111
- function ownKeys(e, r) {
13112
- var t = Object.keys(e);
13113
- if (Object.getOwnPropertySymbols) {
13114
- var o = Object.getOwnPropertySymbols(e);
13115
- r && (o = o.filter(function(r2) {
13116
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
13117
- })), t.push.apply(t, o);
13118
- }
13119
- return t;
13120
- }
13121
- function _objectSpread(e) {
13122
- for (var r = 1; r < arguments.length; r++) {
13123
- var t = null != arguments[r] ? arguments[r] : {};
13124
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
13125
- _defineProperty(e, r2, t[r2]);
13126
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
13127
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
13128
- });
13129
- }
13130
- return e;
13131
- }
13132
- function _defineProperty(obj, key, value) {
13133
- key = _toPropertyKey(key);
13134
- if (key in obj) {
13135
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
13136
- } else {
13137
- obj[key] = value;
13138
- }
13139
- return obj;
13140
- }
13141
- function _toPropertyKey(t) {
13142
- var i = _toPrimitive(t, "string");
13143
- return "symbol" == _typeof(i) ? i : i + "";
13144
- }
13145
- function _toPrimitive(t, r) {
13146
- if ("object" != _typeof(t) || !t) return t;
13147
- var e = t[Symbol.toPrimitive];
13148
- if (void 0 !== e) {
13149
- var i = e.call(t, r || "default");
13150
- if ("object" != _typeof(i)) return i;
13151
- throw new TypeError("@@toPrimitive must return a primitive value.");
13152
- }
13153
- return ("string" === r ? String : Number)(t);
13154
- }
13117
+ exports2.isUnix = isUnix;
13118
+ exports2.isWin = isWin;
13155
13119
  function unixToWin(patch) {
13156
13120
  if (Array.isArray(patch)) {
13157
- return patch.map(unixToWin);
13158
- }
13159
- return (
13160
- /*istanbul ignore start*/
13161
- _objectSpread(_objectSpread(
13162
- {},
13163
- /*istanbul ignore end*/
13164
- patch
13165
- ), {}, {
13166
- hunks: patch.hunks.map(function(hunk) {
13167
- return _objectSpread(_objectSpread(
13168
- {},
13169
- /*istanbul ignore end*/
13170
- hunk
13171
- ), {}, {
13172
- lines: hunk.lines.map(function(line, i) {
13173
- var _hunk$lines;
13174
- return (
13175
- /*istanbul ignore end*/
13176
- line.startsWith("\\") || line.endsWith("\r") || /*istanbul ignore start*/
13177
- (_hunk$lines = /*istanbul ignore end*/
13178
- hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && /*istanbul ignore start*/
13179
- _hunk$lines.startsWith("\\") ? line : line + "\r"
13180
- );
13181
- })
13182
- });
13183
- })
13184
- })
13185
- );
13121
+ return patch.map(function(p) {
13122
+ return unixToWin(p);
13123
+ });
13124
+ }
13125
+ return __assign(__assign({}, patch), { hunks: patch.hunks.map(function(hunk) {
13126
+ return __assign(__assign({}, hunk), { lines: hunk.lines.map(function(line, i) {
13127
+ var _a;
13128
+ return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === void 0 ? void 0 : _a.startsWith("\\")) ? line : line + "\r";
13129
+ }) });
13130
+ }) });
13186
13131
  }
13187
13132
  function winToUnix(patch) {
13188
13133
  if (Array.isArray(patch)) {
13189
- return patch.map(winToUnix);
13190
- }
13191
- return (
13192
- /*istanbul ignore start*/
13193
- _objectSpread(_objectSpread(
13194
- {},
13195
- /*istanbul ignore end*/
13196
- patch
13197
- ), {}, {
13198
- hunks: patch.hunks.map(function(hunk) {
13199
- return _objectSpread(_objectSpread(
13200
- {},
13201
- /*istanbul ignore end*/
13202
- hunk
13203
- ), {}, {
13204
- lines: hunk.lines.map(function(line) {
13205
- return (
13206
- /*istanbul ignore end*/
13207
- line.endsWith("\r") ? line.substring(0, line.length - 1) : line
13208
- );
13209
- })
13210
- });
13211
- })
13212
- })
13213
- );
13134
+ return patch.map(function(p) {
13135
+ return winToUnix(p);
13136
+ });
13137
+ }
13138
+ return __assign(__assign({}, patch), { hunks: patch.hunks.map(function(hunk) {
13139
+ return __assign(__assign({}, hunk), { lines: hunk.lines.map(function(line) {
13140
+ return line.endsWith("\r") ? line.substring(0, line.length - 1) : line;
13141
+ }) });
13142
+ }) });
13214
13143
  }
13215
13144
  function isUnix(patch) {
13216
13145
  if (!Array.isArray(patch)) {
13217
13146
  patch = [patch];
13218
13147
  }
13219
13148
  return !patch.some(function(index) {
13220
- return (
13221
- /*istanbul ignore end*/
13222
- index.hunks.some(function(hunk) {
13223
- return (
13224
- /*istanbul ignore end*/
13225
- hunk.lines.some(function(line) {
13226
- return (
13227
- /*istanbul ignore end*/
13228
- !line.startsWith("\\") && line.endsWith("\r")
13229
- );
13230
- })
13231
- );
13232
- })
13233
- );
13149
+ return index.hunks.some(function(hunk) {
13150
+ return hunk.lines.some(function(line) {
13151
+ return !line.startsWith("\\") && line.endsWith("\r");
13152
+ });
13153
+ });
13234
13154
  });
13235
13155
  }
13236
13156
  function isWin(patch) {
@@ -13238,67 +13158,43 @@ var require_line_endings = __commonJS({
13238
13158
  patch = [patch];
13239
13159
  }
13240
13160
  return patch.some(function(index) {
13241
- return (
13242
- /*istanbul ignore end*/
13243
- index.hunks.some(function(hunk) {
13244
- return (
13245
- /*istanbul ignore end*/
13246
- hunk.lines.some(function(line) {
13247
- return (
13248
- /*istanbul ignore end*/
13249
- line.endsWith("\r")
13250
- );
13251
- })
13252
- );
13253
- })
13254
- );
13161
+ return index.hunks.some(function(hunk) {
13162
+ return hunk.lines.some(function(line) {
13163
+ return line.endsWith("\r");
13164
+ });
13165
+ });
13255
13166
  }) && patch.every(function(index) {
13256
- return (
13257
- /*istanbul ignore end*/
13258
- index.hunks.every(function(hunk) {
13259
- return (
13260
- /*istanbul ignore end*/
13261
- hunk.lines.every(function(line, i) {
13262
- var _hunk$lines2;
13263
- return (
13264
- /*istanbul ignore end*/
13265
- line.startsWith("\\") || line.endsWith("\r") || /*istanbul ignore start*/
13266
- ((_hunk$lines2 = /*istanbul ignore end*/
13267
- hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : (
13268
- /*istanbul ignore start*/
13269
- _hunk$lines2.startsWith("\\")
13270
- ))
13271
- );
13272
- })
13273
- );
13274
- })
13275
- );
13167
+ return index.hunks.every(function(hunk) {
13168
+ return hunk.lines.every(function(line, i) {
13169
+ var _a;
13170
+ return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === void 0 ? void 0 : _a.startsWith("\\"));
13171
+ });
13172
+ });
13276
13173
  });
13277
13174
  }
13278
13175
  }
13279
13176
  });
13280
13177
 
13281
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js
13178
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/parse.js
13282
13179
  var require_parse4 = __commonJS({
13283
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/parse.js"(exports2) {
13180
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/parse.js"(exports2) {
13284
13181
  "use strict";
13285
- Object.defineProperty(exports2, "__esModule", {
13286
- value: true
13287
- });
13182
+ Object.defineProperty(exports2, "__esModule", { value: true });
13288
13183
  exports2.parsePatch = parsePatch;
13289
13184
  function parsePatch(uniDiff) {
13290
- var diffstr = uniDiff.split(/\n/), list = [], i = 0;
13185
+ var diffstr = uniDiff.split(/\n/), list = [];
13186
+ var i = 0;
13291
13187
  function parseIndex() {
13292
13188
  var index = {};
13293
13189
  list.push(index);
13294
13190
  while (i < diffstr.length) {
13295
13191
  var line = diffstr[i];
13296
- if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
13192
+ if (/^(---|\+\+\+|@@)\s/.test(line)) {
13297
13193
  break;
13298
13194
  }
13299
- var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
13300
- if (header) {
13301
- index.index = header[1];
13195
+ var headerMatch = /^(?:Index:|diff(?: -r \w+)+)\s+/.exec(line);
13196
+ if (headerMatch) {
13197
+ index.index = line.substring(headerMatch[0].length).trim();
13302
13198
  }
13303
13199
  i++;
13304
13200
  }
@@ -13306,33 +13202,38 @@ var require_parse4 = __commonJS({
13306
13202
  parseFileHeader(index);
13307
13203
  index.hunks = [];
13308
13204
  while (i < diffstr.length) {
13309
- var _line = diffstr[i];
13310
- if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) {
13205
+ var line = diffstr[i];
13206
+ if (/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(line)) {
13311
13207
  break;
13312
- } else if (/^@@/.test(_line)) {
13208
+ } else if (/^@@/.test(line)) {
13313
13209
  index.hunks.push(parseHunk());
13314
- } else if (_line) {
13315
- throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(_line));
13210
+ } else if (line) {
13211
+ throw new Error("Unknown line " + (i + 1) + " " + JSON.stringify(line));
13316
13212
  } else {
13317
13213
  i++;
13318
13214
  }
13319
13215
  }
13320
13216
  }
13321
13217
  function parseFileHeader(index) {
13322
- var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]);
13323
- if (fileHeader) {
13324
- var keyPrefix = fileHeader[1] === "---" ? "old" : "new";
13325
- var data = fileHeader[2].split(" ", 2);
13218
+ var fileHeaderMatch = /^(---|\+\+\+)\s+/.exec(diffstr[i]);
13219
+ if (fileHeaderMatch) {
13220
+ var prefix = fileHeaderMatch[1], data = diffstr[i].substring(3).trim().split(" ", 2), header = (data[1] || "").trim();
13326
13221
  var fileName = data[0].replace(/\\\\/g, "\\");
13327
- if (/^".*"$/.test(fileName)) {
13222
+ if (fileName.startsWith('"') && fileName.endsWith('"')) {
13328
13223
  fileName = fileName.substr(1, fileName.length - 2);
13329
13224
  }
13330
- index[keyPrefix + "FileName"] = fileName;
13331
- index[keyPrefix + "Header"] = (data[1] || "").trim();
13225
+ if (prefix === "---") {
13226
+ index.oldFileName = fileName;
13227
+ index.oldHeader = header;
13228
+ } else {
13229
+ index.newFileName = fileName;
13230
+ index.newHeader = header;
13231
+ }
13332
13232
  i++;
13333
13233
  }
13334
13234
  }
13335
13235
  function parseHunk() {
13236
+ var _a;
13336
13237
  var chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
13337
13238
  var hunk = {
13338
13239
  oldStart: +chunkHeader[1],
@@ -13348,11 +13249,7 @@ var require_parse4 = __commonJS({
13348
13249
  hunk.newStart += 1;
13349
13250
  }
13350
13251
  var addCount = 0, removeCount = 0;
13351
- for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || /*istanbul ignore start*/
13352
- (_diffstr$i = /*istanbul ignore end*/
13353
- diffstr[i]) !== null && _diffstr$i !== void 0 && /*istanbul ignore start*/
13354
- _diffstr$i.startsWith("\\")); i++) {
13355
- var _diffstr$i;
13252
+ for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a = diffstr[i]) === null || _a === void 0 ? void 0 : _a.startsWith("\\"))); i++) {
13356
13253
  var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
13357
13254
  if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
13358
13255
  hunk.lines.push(diffstr[i]);
@@ -13365,14 +13262,7 @@ var require_parse4 = __commonJS({
13365
13262
  removeCount++;
13366
13263
  }
13367
13264
  } else {
13368
- throw new Error(
13369
- /*istanbul ignore start*/
13370
- "Hunk at line ".concat(
13371
- /*istanbul ignore end*/
13372
- chunkHeaderIndex + 1,
13373
- " contained invalid line "
13374
- ).concat(diffstr[i])
13375
- );
13265
+ throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i]));
13376
13266
  }
13377
13267
  }
13378
13268
  if (!addCount && hunk.newLines === 1) {
@@ -13397,15 +13287,13 @@ var require_parse4 = __commonJS({
13397
13287
  }
13398
13288
  });
13399
13289
 
13400
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js
13290
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/util/distance-iterator.js
13401
13291
  var require_distance_iterator = __commonJS({
13402
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/distance-iterator.js"(exports2) {
13292
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/util/distance-iterator.js"(exports2) {
13403
13293
  "use strict";
13404
- Object.defineProperty(exports2, "__esModule", {
13405
- value: true
13406
- });
13407
- exports2["default"] = _default;
13408
- function _default(start, minLine, maxLine) {
13294
+ Object.defineProperty(exports2, "__esModule", { value: true });
13295
+ exports2.default = default_1;
13296
+ function default_1(start, minLine, maxLine) {
13409
13297
  var wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
13410
13298
  return function iterator() {
13411
13299
  if (wantForward && !forwardExhausted) {
@@ -13429,76 +13317,55 @@ var require_distance_iterator = __commonJS({
13429
13317
  backwardExhausted = true;
13430
13318
  return iterator();
13431
13319
  }
13320
+ return void 0;
13432
13321
  };
13433
13322
  }
13434
13323
  }
13435
13324
  });
13436
13325
 
13437
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js
13326
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/apply.js
13438
13327
  var require_apply = __commonJS({
13439
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/apply.js"(exports2) {
13328
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/apply.js"(exports2) {
13440
13329
  "use strict";
13441
- Object.defineProperty(exports2, "__esModule", {
13442
- value: true
13443
- });
13330
+ Object.defineProperty(exports2, "__esModule", { value: true });
13444
13331
  exports2.applyPatch = applyPatch;
13445
13332
  exports2.applyPatches = applyPatches;
13446
- var _string = require_string2();
13447
- var _lineEndings = require_line_endings();
13448
- var _parse = require_parse4();
13449
- var _distanceIterator = _interopRequireDefault(require_distance_iterator());
13450
- function _interopRequireDefault(obj) {
13451
- return obj && obj.__esModule ? obj : { "default": obj };
13452
- }
13453
- function applyPatch(source, uniDiff) {
13454
- var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
13455
- if (typeof uniDiff === "string") {
13456
- uniDiff = /*istanbul ignore start*/
13457
- (0, /*istanbul ignore end*/
13458
- /*istanbul ignore start*/
13459
- _parse.parsePatch)(uniDiff);
13460
- }
13461
- if (Array.isArray(uniDiff)) {
13462
- if (uniDiff.length > 1) {
13463
- throw new Error("applyPatch only works with a single input.");
13464
- }
13465
- uniDiff = uniDiff[0];
13333
+ var string_js_1 = require_string2();
13334
+ var line_endings_js_1 = require_line_endings();
13335
+ var parse_js_1 = require_parse4();
13336
+ var distance_iterator_js_1 = require_distance_iterator();
13337
+ function applyPatch(source, patch, options) {
13338
+ if (options === void 0) {
13339
+ options = {};
13340
+ }
13341
+ var patches;
13342
+ if (typeof patch === "string") {
13343
+ patches = (0, parse_js_1.parsePatch)(patch);
13344
+ } else if (Array.isArray(patch)) {
13345
+ patches = patch;
13346
+ } else {
13347
+ patches = [patch];
13348
+ }
13349
+ if (patches.length > 1) {
13350
+ throw new Error("applyPatch only works with a single input.");
13351
+ }
13352
+ return applyStructuredPatch(source, patches[0], options);
13353
+ }
13354
+ function applyStructuredPatch(source, patch, options) {
13355
+ if (options === void 0) {
13356
+ options = {};
13466
13357
  }
13467
13358
  if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) {
13468
- if (
13469
- /*istanbul ignore start*/
13470
- (0, /*istanbul ignore end*/
13471
- /*istanbul ignore start*/
13472
- _string.hasOnlyWinLineEndings)(source) && /*istanbul ignore start*/
13473
- (0, /*istanbul ignore end*/
13474
- /*istanbul ignore start*/
13475
- _lineEndings.isUnix)(uniDiff)
13476
- ) {
13477
- uniDiff = /*istanbul ignore start*/
13478
- (0, /*istanbul ignore end*/
13479
- /*istanbul ignore start*/
13480
- _lineEndings.unixToWin)(uniDiff);
13481
- } else if (
13482
- /*istanbul ignore start*/
13483
- (0, /*istanbul ignore end*/
13484
- /*istanbul ignore start*/
13485
- _string.hasOnlyUnixLineEndings)(source) && /*istanbul ignore start*/
13486
- (0, /*istanbul ignore end*/
13487
- /*istanbul ignore start*/
13488
- _lineEndings.isWin)(uniDiff)
13489
- ) {
13490
- uniDiff = /*istanbul ignore start*/
13491
- (0, /*istanbul ignore end*/
13492
- /*istanbul ignore start*/
13493
- _lineEndings.winToUnix)(uniDiff);
13494
- }
13495
- }
13496
- var lines = source.split("\n"), hunks = uniDiff.hunks, compareLine = options.compareLine || function(lineNumber, line2, operation, patchContent) {
13497
- return (
13498
- /*istanbul ignore end*/
13499
- line2 === patchContent
13500
- );
13501
- }, fuzzFactor = options.fuzzFactor || 0, minLine = 0;
13359
+ if ((0, string_js_1.hasOnlyWinLineEndings)(source) && (0, line_endings_js_1.isUnix)(patch)) {
13360
+ patch = (0, line_endings_js_1.unixToWin)(patch);
13361
+ } else if ((0, string_js_1.hasOnlyUnixLineEndings)(source) && (0, line_endings_js_1.isWin)(patch)) {
13362
+ patch = (0, line_endings_js_1.winToUnix)(patch);
13363
+ }
13364
+ }
13365
+ var lines = source.split("\n"), hunks = patch.hunks, compareLine = options.compareLine || (function(lineNumber, line2, operation, patchContent) {
13366
+ return line2 === patchContent;
13367
+ }), fuzzFactor = options.fuzzFactor || 0;
13368
+ var minLine = 0;
13502
13369
  if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) {
13503
13370
  throw new Error("fuzzFactor must be a non-negative integer");
13504
13371
  }
@@ -13534,11 +13401,19 @@ var require_apply = __commonJS({
13534
13401
  return false;
13535
13402
  }
13536
13403
  }
13537
- function applyHunk(hunkLines, toPos2, maxErrors2) {
13538
- var hunkLinesI = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
13539
- var lastContextLineMatched = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
13540
- var patchedLines = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [];
13541
- var patchedLinesLength = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0;
13404
+ function applyHunk(hunkLines, toPos2, maxErrors2, hunkLinesI, lastContextLineMatched, patchedLines, patchedLinesLength) {
13405
+ if (hunkLinesI === void 0) {
13406
+ hunkLinesI = 0;
13407
+ }
13408
+ if (lastContextLineMatched === void 0) {
13409
+ lastContextLineMatched = true;
13410
+ }
13411
+ if (patchedLines === void 0) {
13412
+ patchedLines = [];
13413
+ }
13414
+ if (patchedLinesLength === void 0) {
13415
+ patchedLinesLength = 0;
13416
+ }
13542
13417
  var nConsecutiveOldContextLines = 0;
13543
13418
  var nextContextLineMustMatch = false;
13544
13419
  for (; hunkLinesI < hunkLines.length; hunkLinesI++) {
@@ -13590,29 +13465,14 @@ var require_apply = __commonJS({
13590
13465
  }
13591
13466
  var resultLines = [];
13592
13467
  var prevHunkOffset = 0;
13593
- for (var _i = 0; _i < hunks.length; _i++) {
13594
- var hunk = hunks[_i];
13595
- var hunkResult = (
13596
- /*istanbul ignore start*/
13597
- void 0
13598
- );
13468
+ for (var i = 0; i < hunks.length; i++) {
13469
+ var hunk = hunks[i];
13470
+ var hunkResult = void 0;
13599
13471
  var maxLine = lines.length - hunk.oldLines + fuzzFactor;
13600
- var toPos = (
13601
- /*istanbul ignore start*/
13602
- void 0
13603
- );
13472
+ var toPos = void 0;
13604
13473
  for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) {
13605
13474
  toPos = hunk.oldStart + prevHunkOffset - 1;
13606
- var iterator = (
13607
- /*istanbul ignore start*/
13608
- (0, /*istanbul ignore end*/
13609
- /*istanbul ignore start*/
13610
- _distanceIterator[
13611
- /*istanbul ignore start*/
13612
- "default"
13613
- /*istanbul ignore end*/
13614
- ])(toPos, minLine, maxLine)
13615
- );
13475
+ var iterator = (0, distance_iterator_js_1.default)(toPos, minLine, maxLine);
13616
13476
  for (; toPos !== void 0; toPos = iterator()) {
13617
13477
  hunkResult = applyHunk(hunk.lines, toPos, maxErrors);
13618
13478
  if (hunkResult) {
@@ -13626,31 +13486,26 @@ var require_apply = __commonJS({
13626
13486
  if (!hunkResult) {
13627
13487
  return false;
13628
13488
  }
13629
- for (var _i2 = minLine; _i2 < toPos; _i2++) {
13630
- resultLines.push(lines[_i2]);
13489
+ for (var i_1 = minLine; i_1 < toPos; i_1++) {
13490
+ resultLines.push(lines[i_1]);
13631
13491
  }
13632
- for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) {
13633
- var _line = hunkResult.patchedLines[_i3];
13634
- resultLines.push(_line);
13492
+ for (var i_2 = 0; i_2 < hunkResult.patchedLines.length; i_2++) {
13493
+ var line = hunkResult.patchedLines[i_2];
13494
+ resultLines.push(line);
13635
13495
  }
13636
13496
  minLine = hunkResult.oldLineLastI + 1;
13637
13497
  prevHunkOffset = toPos + 1 - hunk.oldStart;
13638
13498
  }
13639
- for (var _i4 = minLine; _i4 < lines.length; _i4++) {
13640
- resultLines.push(lines[_i4]);
13499
+ for (var i = minLine; i < lines.length; i++) {
13500
+ resultLines.push(lines[i]);
13641
13501
  }
13642
13502
  return resultLines.join("\n");
13643
13503
  }
13644
13504
  function applyPatches(uniDiff, options) {
13645
- if (typeof uniDiff === "string") {
13646
- uniDiff = /*istanbul ignore start*/
13647
- (0, /*istanbul ignore end*/
13648
- /*istanbul ignore start*/
13649
- _parse.parsePatch)(uniDiff);
13650
- }
13505
+ var spDiff = typeof uniDiff === "string" ? (0, parse_js_1.parsePatch)(uniDiff) : uniDiff;
13651
13506
  var currentIndex = 0;
13652
13507
  function processIndex() {
13653
- var index = uniDiff[currentIndex++];
13508
+ var index = spDiff[currentIndex++];
13654
13509
  if (!index) {
13655
13510
  return options.complete();
13656
13511
  }
@@ -13672,182 +13527,142 @@ var require_apply = __commonJS({
13672
13527
  }
13673
13528
  });
13674
13529
 
13675
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js
13676
- var require_create = __commonJS({
13677
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/create.js"(exports2) {
13530
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/reverse.js
13531
+ var require_reverse = __commonJS({
13532
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/reverse.js"(exports2) {
13678
13533
  "use strict";
13679
- Object.defineProperty(exports2, "__esModule", {
13680
- value: true
13681
- });
13682
- exports2.createPatch = createPatch;
13683
- exports2.createTwoFilesPatch = createTwoFilesPatch;
13684
- exports2.formatPatch = formatPatch;
13685
- exports2.structuredPatch = structuredPatch;
13686
- var _line = require_line();
13687
- function _typeof(o) {
13688
- "@babel/helpers - typeof";
13689
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
13690
- return typeof o2;
13691
- } : function(o2) {
13692
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
13693
- }, _typeof(o);
13694
- }
13695
- function _toConsumableArray(arr) {
13696
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
13697
- }
13698
- function _nonIterableSpread() {
13699
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13700
- }
13701
- function _unsupportedIterableToArray(o, minLen) {
13702
- if (!o) return;
13703
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
13704
- var n = Object.prototype.toString.call(o).slice(8, -1);
13705
- if (n === "Object" && o.constructor) n = o.constructor.name;
13706
- if (n === "Map" || n === "Set") return Array.from(o);
13707
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
13708
- }
13709
- function _iterableToArray(iter) {
13710
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
13711
- }
13712
- function _arrayWithoutHoles(arr) {
13713
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
13714
- }
13715
- function _arrayLikeToArray(arr, len) {
13716
- if (len == null || len > arr.length) len = arr.length;
13717
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
13718
- return arr2;
13719
- }
13720
- function ownKeys(e, r) {
13721
- var t = Object.keys(e);
13722
- if (Object.getOwnPropertySymbols) {
13723
- var o = Object.getOwnPropertySymbols(e);
13724
- r && (o = o.filter(function(r2) {
13725
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
13726
- })), t.push.apply(t, o);
13727
- }
13728
- return t;
13729
- }
13730
- function _objectSpread(e) {
13731
- for (var r = 1; r < arguments.length; r++) {
13732
- var t = null != arguments[r] ? arguments[r] : {};
13733
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
13734
- _defineProperty(e, r2, t[r2]);
13735
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
13736
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
13737
- });
13738
- }
13739
- return e;
13740
- }
13741
- function _defineProperty(obj, key, value) {
13742
- key = _toPropertyKey(key);
13743
- if (key in obj) {
13744
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
13745
- } else {
13746
- obj[key] = value;
13747
- }
13748
- return obj;
13749
- }
13750
- function _toPropertyKey(t) {
13751
- var i = _toPrimitive(t, "string");
13752
- return "symbol" == _typeof(i) ? i : i + "";
13753
- }
13754
- function _toPrimitive(t, r) {
13755
- if ("object" != _typeof(t) || !t) return t;
13756
- var e = t[Symbol.toPrimitive];
13757
- if (void 0 !== e) {
13758
- var i = e.call(t, r || "default");
13759
- if ("object" != _typeof(i)) return i;
13760
- throw new TypeError("@@toPrimitive must return a primitive value.");
13534
+ var __assign = exports2 && exports2.__assign || function() {
13535
+ __assign = Object.assign || function(t) {
13536
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
13537
+ s = arguments[i];
13538
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13539
+ t[p] = s[p];
13540
+ }
13541
+ return t;
13542
+ };
13543
+ return __assign.apply(this, arguments);
13544
+ };
13545
+ Object.defineProperty(exports2, "__esModule", { value: true });
13546
+ exports2.reversePatch = reversePatch;
13547
+ function reversePatch(structuredPatch) {
13548
+ if (Array.isArray(structuredPatch)) {
13549
+ return structuredPatch.map(function(patch) {
13550
+ return reversePatch(patch);
13551
+ }).reverse();
13761
13552
  }
13762
- return ("string" === r ? String : Number)(t);
13553
+ return __assign(__assign({}, structuredPatch), { oldFileName: structuredPatch.newFileName, oldHeader: structuredPatch.newHeader, newFileName: structuredPatch.oldFileName, newHeader: structuredPatch.oldHeader, hunks: structuredPatch.hunks.map(function(hunk) {
13554
+ return {
13555
+ oldLines: hunk.newLines,
13556
+ oldStart: hunk.newStart,
13557
+ newLines: hunk.oldLines,
13558
+ newStart: hunk.oldStart,
13559
+ lines: hunk.lines.map(function(l) {
13560
+ if (l.startsWith("-")) {
13561
+ return "+".concat(l.slice(1));
13562
+ }
13563
+ if (l.startsWith("+")) {
13564
+ return "-".concat(l.slice(1));
13565
+ }
13566
+ return l;
13567
+ })
13568
+ };
13569
+ }) });
13763
13570
  }
13571
+ }
13572
+ });
13573
+
13574
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/create.js
13575
+ var require_create = __commonJS({
13576
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/patch/create.js"(exports2) {
13577
+ "use strict";
13578
+ var __assign = exports2 && exports2.__assign || function() {
13579
+ __assign = Object.assign || function(t) {
13580
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
13581
+ s = arguments[i];
13582
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13583
+ t[p] = s[p];
13584
+ }
13585
+ return t;
13586
+ };
13587
+ return __assign.apply(this, arguments);
13588
+ };
13589
+ Object.defineProperty(exports2, "__esModule", { value: true });
13590
+ exports2.OMIT_HEADERS = exports2.FILE_HEADERS_ONLY = exports2.INCLUDE_HEADERS = void 0;
13591
+ exports2.structuredPatch = structuredPatch;
13592
+ exports2.formatPatch = formatPatch;
13593
+ exports2.createTwoFilesPatch = createTwoFilesPatch;
13594
+ exports2.createPatch = createPatch;
13595
+ var line_js_1 = require_line();
13596
+ exports2.INCLUDE_HEADERS = {
13597
+ includeIndex: true,
13598
+ includeUnderline: true,
13599
+ includeFileHeaders: true
13600
+ };
13601
+ exports2.FILE_HEADERS_ONLY = {
13602
+ includeIndex: false,
13603
+ includeUnderline: false,
13604
+ includeFileHeaders: true
13605
+ };
13606
+ exports2.OMIT_HEADERS = {
13607
+ includeIndex: false,
13608
+ includeUnderline: false,
13609
+ includeFileHeaders: false
13610
+ };
13764
13611
  function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
13612
+ var optionsObj;
13765
13613
  if (!options) {
13766
- options = {};
13767
- }
13768
- if (typeof options === "function") {
13769
- options = {
13770
- callback: options
13771
- };
13614
+ optionsObj = {};
13615
+ } else if (typeof options === "function") {
13616
+ optionsObj = { callback: options };
13617
+ } else {
13618
+ optionsObj = options;
13772
13619
  }
13773
- if (typeof options.context === "undefined") {
13774
- options.context = 4;
13620
+ if (typeof optionsObj.context === "undefined") {
13621
+ optionsObj.context = 4;
13775
13622
  }
13776
- if (options.newlineIsToken) {
13623
+ var context = optionsObj.context;
13624
+ if (optionsObj.newlineIsToken) {
13777
13625
  throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
13778
13626
  }
13779
- if (!options.callback) {
13780
- return diffLinesResultToPatch(
13781
- /*istanbul ignore start*/
13782
- (0, /*istanbul ignore end*/
13783
- /*istanbul ignore start*/
13784
- _line.diffLines)(oldStr, newStr, options)
13785
- );
13627
+ if (!optionsObj.callback) {
13628
+ return diffLinesResultToPatch((0, line_js_1.diffLines)(oldStr, newStr, optionsObj));
13786
13629
  } else {
13787
- var _options = (
13788
- /*istanbul ignore end*/
13789
- options
13790
- ), _callback = _options.callback;
13791
- (0, /*istanbul ignore end*/
13792
- /*istanbul ignore start*/
13793
- _line.diffLines)(
13794
- oldStr,
13795
- newStr,
13796
- /*istanbul ignore start*/
13797
- _objectSpread(_objectSpread(
13798
- {},
13799
- /*istanbul ignore end*/
13800
- options
13801
- ), {}, {
13802
- callback: function callback(diff) {
13803
- var patch = diffLinesResultToPatch(diff);
13804
- _callback(patch);
13805
- }
13806
- })
13807
- );
13630
+ var callback_1 = optionsObj.callback;
13631
+ (0, line_js_1.diffLines)(oldStr, newStr, __assign(__assign({}, optionsObj), { callback: function(diff) {
13632
+ var patch = diffLinesResultToPatch(diff);
13633
+ callback_1(patch);
13634
+ } }));
13808
13635
  }
13809
13636
  function diffLinesResultToPatch(diff) {
13810
13637
  if (!diff) {
13811
13638
  return;
13812
13639
  }
13813
- diff.push({
13814
- value: "",
13815
- lines: []
13816
- });
13817
- function contextLines(lines) {
13818
- return lines.map(function(entry) {
13640
+ diff.push({ value: "", lines: [] });
13641
+ function contextLines(lines2) {
13642
+ return lines2.map(function(entry) {
13819
13643
  return " " + entry;
13820
13644
  });
13821
13645
  }
13822
13646
  var hunks = [];
13823
13647
  var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
13824
- var _loop = function _loop2() {
13648
+ for (var i = 0; i < diff.length; i++) {
13825
13649
  var current = diff[i], lines = current.lines || splitLines(current.value);
13826
13650
  current.lines = lines;
13827
13651
  if (current.added || current.removed) {
13828
- var _curRange;
13829
13652
  if (!oldRangeStart) {
13830
13653
  var prev = diff[i - 1];
13831
13654
  oldRangeStart = oldLine;
13832
13655
  newRangeStart = newLine;
13833
13656
  if (prev) {
13834
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
13657
+ curRange = context > 0 ? contextLines(prev.lines.slice(-context)) : [];
13835
13658
  oldRangeStart -= curRange.length;
13836
13659
  newRangeStart -= curRange.length;
13837
13660
  }
13838
13661
  }
13839
- (_curRange = /*istanbul ignore end*/
13840
- curRange).push.apply(
13841
- /*istanbul ignore start*/
13842
- _curRange,
13843
- /*istanbul ignore start*/
13844
- _toConsumableArray(
13845
- /*istanbul ignore end*/
13846
- lines.map(function(entry) {
13847
- return (current.added ? "+" : "-") + entry;
13848
- })
13849
- )
13850
- );
13662
+ for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
13663
+ var line = lines_1[_i];
13664
+ curRange.push((current.added ? "+" : "-") + line);
13665
+ }
13851
13666
  if (current.added) {
13852
13667
  newLine += lines.length;
13853
13668
  } else {
@@ -13855,39 +13670,25 @@ var require_create = __commonJS({
13855
13670
  }
13856
13671
  } else {
13857
13672
  if (oldRangeStart) {
13858
- if (lines.length <= options.context * 2 && i < diff.length - 2) {
13859
- var _curRange2;
13860
- (_curRange2 = /*istanbul ignore end*/
13861
- curRange).push.apply(
13862
- /*istanbul ignore start*/
13863
- _curRange2,
13864
- /*istanbul ignore start*/
13865
- _toConsumableArray(
13866
- /*istanbul ignore end*/
13867
- contextLines(lines)
13868
- )
13869
- );
13673
+ if (lines.length <= context * 2 && i < diff.length - 2) {
13674
+ for (var _a = 0, _b = contextLines(lines); _a < _b.length; _a++) {
13675
+ var line = _b[_a];
13676
+ curRange.push(line);
13677
+ }
13870
13678
  } else {
13871
- var _curRange3;
13872
- var contextSize = Math.min(lines.length, options.context);
13873
- (_curRange3 = /*istanbul ignore end*/
13874
- curRange).push.apply(
13875
- /*istanbul ignore start*/
13876
- _curRange3,
13877
- /*istanbul ignore start*/
13878
- _toConsumableArray(
13879
- /*istanbul ignore end*/
13880
- contextLines(lines.slice(0, contextSize))
13881
- )
13882
- );
13883
- var _hunk = {
13679
+ var contextSize = Math.min(lines.length, context);
13680
+ for (var _c = 0, _d = contextLines(lines.slice(0, contextSize)); _c < _d.length; _c++) {
13681
+ var line = _d[_c];
13682
+ curRange.push(line);
13683
+ }
13684
+ var hunk = {
13884
13685
  oldStart: oldRangeStart,
13885
13686
  oldLines: oldLine - oldRangeStart + contextSize,
13886
13687
  newStart: newRangeStart,
13887
13688
  newLines: newLine - newRangeStart + contextSize,
13888
13689
  lines: curRange
13889
13690
  };
13890
- hunks.push(_hunk);
13691
+ hunks.push(hunk);
13891
13692
  oldRangeStart = 0;
13892
13693
  newRangeStart = 0;
13893
13694
  curRange = [];
@@ -13896,30 +13697,15 @@ var require_create = __commonJS({
13896
13697
  oldLine += lines.length;
13897
13698
  newLine += lines.length;
13898
13699
  }
13899
- };
13900
- for (var i = 0; i < diff.length; i++) {
13901
- _loop();
13902
13700
  }
13903
- for (
13904
- var _i = 0, _hunks = (
13905
- /*istanbul ignore end*/
13906
- hunks
13907
- );
13908
- /*istanbul ignore start*/
13909
- _i < _hunks.length;
13910
- /*istanbul ignore start*/
13911
- _i++
13912
- ) {
13913
- var hunk = (
13914
- /*istanbul ignore start*/
13915
- _hunks[_i]
13916
- );
13917
- for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) {
13918
- if (hunk.lines[_i2].endsWith("\n")) {
13919
- hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1);
13701
+ for (var _e = 0, hunks_1 = hunks; _e < hunks_1.length; _e++) {
13702
+ var hunk = hunks_1[_e];
13703
+ for (var i = 0; i < hunk.lines.length; i++) {
13704
+ if (hunk.lines[i].endsWith("\n")) {
13705
+ hunk.lines[i] = hunk.lines[i].slice(0, -1);
13920
13706
  } else {
13921
- hunk.lines.splice(_i2 + 1, 0, "\");
13922
- _i2++;
13707
+ hunk.lines.splice(i + 1, 0, "\");
13708
+ i++;
13923
13709
  }
13924
13710
  }
13925
13711
  }
@@ -13932,19 +13718,31 @@ var require_create = __commonJS({
13932
13718
  };
13933
13719
  }
13934
13720
  }
13935
- function formatPatch(diff) {
13936
- if (Array.isArray(diff)) {
13937
- return diff.map(formatPatch).join("\n");
13721
+ function formatPatch(patch, headerOptions) {
13722
+ if (!headerOptions) {
13723
+ headerOptions = exports2.INCLUDE_HEADERS;
13724
+ }
13725
+ if (Array.isArray(patch)) {
13726
+ if (patch.length > 1 && !headerOptions.includeFileHeaders) {
13727
+ throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");
13728
+ }
13729
+ return patch.map(function(p) {
13730
+ return formatPatch(p, headerOptions);
13731
+ }).join("\n");
13938
13732
  }
13939
13733
  var ret = [];
13940
- if (diff.oldFileName == diff.newFileName) {
13941
- ret.push("Index: " + diff.oldFileName);
13942
- }
13943
- ret.push("===================================================================");
13944
- ret.push("--- " + diff.oldFileName + (typeof diff.oldHeader === "undefined" ? "" : " " + diff.oldHeader));
13945
- ret.push("+++ " + diff.newFileName + (typeof diff.newHeader === "undefined" ? "" : " " + diff.newHeader));
13946
- for (var i = 0; i < diff.hunks.length; i++) {
13947
- var hunk = diff.hunks[i];
13734
+ if (headerOptions.includeIndex && patch.oldFileName == patch.newFileName) {
13735
+ ret.push("Index: " + patch.oldFileName);
13736
+ }
13737
+ if (headerOptions.includeUnderline) {
13738
+ ret.push("===================================================================");
13739
+ }
13740
+ if (headerOptions.includeFileHeaders) {
13741
+ ret.push("--- " + patch.oldFileName + (typeof patch.oldHeader === "undefined" ? "" : " " + patch.oldHeader));
13742
+ ret.push("+++ " + patch.newFileName + (typeof patch.newHeader === "undefined" ? "" : " " + patch.newHeader));
13743
+ }
13744
+ for (var i = 0; i < patch.hunks.length; i++) {
13745
+ var hunk = patch.hunks[i];
13948
13746
  if (hunk.oldLines === 0) {
13949
13747
  hunk.oldStart -= 1;
13950
13748
  }
@@ -13952,53 +13750,32 @@ var require_create = __commonJS({
13952
13750
  hunk.newStart -= 1;
13953
13751
  }
13954
13752
  ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
13955
- ret.push.apply(ret, hunk.lines);
13753
+ for (var _i = 0, _a = hunk.lines; _i < _a.length; _i++) {
13754
+ var line = _a[_i];
13755
+ ret.push(line);
13756
+ }
13956
13757
  }
13957
13758
  return ret.join("\n") + "\n";
13958
13759
  }
13959
13760
  function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
13960
- var _options2;
13961
13761
  if (typeof options === "function") {
13962
- options = {
13963
- callback: options
13964
- };
13762
+ options = { callback: options };
13965
13763
  }
13966
- if (!/*istanbul ignore start*/
13967
- ((_options2 = /*istanbul ignore end*/
13968
- options) !== null && _options2 !== void 0 && /*istanbul ignore start*/
13969
- _options2.callback)) {
13764
+ if (!(options === null || options === void 0 ? void 0 : options.callback)) {
13970
13765
  var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
13971
13766
  if (!patchObj) {
13972
13767
  return;
13973
13768
  }
13974
- return formatPatch(patchObj);
13769
+ return formatPatch(patchObj, options === null || options === void 0 ? void 0 : options.headerOptions);
13975
13770
  } else {
13976
- var _options3 = (
13977
- /*istanbul ignore end*/
13978
- options
13979
- ), _callback2 = _options3.callback;
13980
- structuredPatch(
13981
- oldFileName,
13982
- newFileName,
13983
- oldStr,
13984
- newStr,
13985
- oldHeader,
13986
- newHeader,
13987
- /*istanbul ignore start*/
13988
- _objectSpread(_objectSpread(
13989
- {},
13990
- /*istanbul ignore end*/
13991
- options
13992
- ), {}, {
13993
- callback: function callback(patchObj2) {
13994
- if (!patchObj2) {
13995
- _callback2();
13996
- } else {
13997
- _callback2(formatPatch(patchObj2));
13998
- }
13999
- }
14000
- })
14001
- );
13771
+ var callback_2 = options.callback;
13772
+ structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, __assign(__assign({}, options), { callback: function(patchObj2) {
13773
+ if (!patchObj2) {
13774
+ callback_2(void 0);
13775
+ } else {
13776
+ callback_2(formatPatch(patchObj2, options.headerOptions));
13777
+ }
13778
+ } }));
14002
13779
  }
14003
13780
  }
14004
13781
  function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
@@ -14007,10 +13784,7 @@ var require_create = __commonJS({
14007
13784
  function splitLines(text) {
14008
13785
  var hasTrailingNl = text.endsWith("\n");
14009
13786
  var result = text.split("\n").map(function(line) {
14010
- return (
14011
- /*istanbul ignore end*/
14012
- line + "\n"
14013
- );
13787
+ return line + "\n";
14014
13788
  });
14015
13789
  if (hasTrailingNl) {
14016
13790
  result.pop();
@@ -14022,576 +13796,15 @@ var require_create = __commonJS({
14022
13796
  }
14023
13797
  });
14024
13798
 
14025
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js
14026
- var require_array3 = __commonJS({
14027
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/util/array.js"(exports2) {
14028
- "use strict";
14029
- Object.defineProperty(exports2, "__esModule", {
14030
- value: true
14031
- });
14032
- exports2.arrayEqual = arrayEqual;
14033
- exports2.arrayStartsWith = arrayStartsWith;
14034
- function arrayEqual(a, b) {
14035
- if (a.length !== b.length) {
14036
- return false;
14037
- }
14038
- return arrayStartsWith(a, b);
14039
- }
14040
- function arrayStartsWith(array, start) {
14041
- if (start.length > array.length) {
14042
- return false;
14043
- }
14044
- for (var i = 0; i < start.length; i++) {
14045
- if (start[i] !== array[i]) {
14046
- return false;
14047
- }
14048
- }
14049
- return true;
14050
- }
14051
- }
14052
- });
14053
-
14054
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js
14055
- var require_merge = __commonJS({
14056
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/merge.js"(exports2) {
14057
- "use strict";
14058
- Object.defineProperty(exports2, "__esModule", {
14059
- value: true
14060
- });
14061
- exports2.calcLineCount = calcLineCount;
14062
- exports2.merge = merge;
14063
- var _create = require_create();
14064
- var _parse = require_parse4();
14065
- var _array = require_array3();
14066
- function _toConsumableArray(arr) {
14067
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
14068
- }
14069
- function _nonIterableSpread() {
14070
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14071
- }
14072
- function _unsupportedIterableToArray(o, minLen) {
14073
- if (!o) return;
14074
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
14075
- var n = Object.prototype.toString.call(o).slice(8, -1);
14076
- if (n === "Object" && o.constructor) n = o.constructor.name;
14077
- if (n === "Map" || n === "Set") return Array.from(o);
14078
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
14079
- }
14080
- function _iterableToArray(iter) {
14081
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14082
- }
14083
- function _arrayWithoutHoles(arr) {
14084
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
14085
- }
14086
- function _arrayLikeToArray(arr, len) {
14087
- if (len == null || len > arr.length) len = arr.length;
14088
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
14089
- return arr2;
14090
- }
14091
- function calcLineCount(hunk) {
14092
- var _calcOldNewLineCount = (
14093
- /*istanbul ignore end*/
14094
- calcOldNewLineCount(hunk.lines)
14095
- ), oldLines = _calcOldNewLineCount.oldLines, newLines = _calcOldNewLineCount.newLines;
14096
- if (oldLines !== void 0) {
14097
- hunk.oldLines = oldLines;
14098
- } else {
14099
- delete hunk.oldLines;
14100
- }
14101
- if (newLines !== void 0) {
14102
- hunk.newLines = newLines;
14103
- } else {
14104
- delete hunk.newLines;
14105
- }
14106
- }
14107
- function merge(mine, theirs, base) {
14108
- mine = loadPatch(mine, base);
14109
- theirs = loadPatch(theirs, base);
14110
- var ret = {};
14111
- if (mine.index || theirs.index) {
14112
- ret.index = mine.index || theirs.index;
14113
- }
14114
- if (mine.newFileName || theirs.newFileName) {
14115
- if (!fileNameChanged(mine)) {
14116
- ret.oldFileName = theirs.oldFileName || mine.oldFileName;
14117
- ret.newFileName = theirs.newFileName || mine.newFileName;
14118
- ret.oldHeader = theirs.oldHeader || mine.oldHeader;
14119
- ret.newHeader = theirs.newHeader || mine.newHeader;
14120
- } else if (!fileNameChanged(theirs)) {
14121
- ret.oldFileName = mine.oldFileName;
14122
- ret.newFileName = mine.newFileName;
14123
- ret.oldHeader = mine.oldHeader;
14124
- ret.newHeader = mine.newHeader;
14125
- } else {
14126
- ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
14127
- ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
14128
- ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
14129
- ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
14130
- }
14131
- }
14132
- ret.hunks = [];
14133
- var mineIndex = 0, theirsIndex = 0, mineOffset = 0, theirsOffset = 0;
14134
- while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
14135
- var mineCurrent = mine.hunks[mineIndex] || {
14136
- oldStart: Infinity
14137
- }, theirsCurrent = theirs.hunks[theirsIndex] || {
14138
- oldStart: Infinity
14139
- };
14140
- if (hunkBefore(mineCurrent, theirsCurrent)) {
14141
- ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
14142
- mineIndex++;
14143
- theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
14144
- } else if (hunkBefore(theirsCurrent, mineCurrent)) {
14145
- ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
14146
- theirsIndex++;
14147
- mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
14148
- } else {
14149
- var mergedHunk = {
14150
- oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
14151
- oldLines: 0,
14152
- newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
14153
- newLines: 0,
14154
- lines: []
14155
- };
14156
- mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
14157
- theirsIndex++;
14158
- mineIndex++;
14159
- ret.hunks.push(mergedHunk);
14160
- }
14161
- }
14162
- return ret;
14163
- }
14164
- function loadPatch(param, base) {
14165
- if (typeof param === "string") {
14166
- if (/^@@/m.test(param) || /^Index:/m.test(param)) {
14167
- return (
14168
- /*istanbul ignore start*/
14169
- (0, /*istanbul ignore end*/
14170
- /*istanbul ignore start*/
14171
- _parse.parsePatch)(param)[0]
14172
- );
14173
- }
14174
- if (!base) {
14175
- throw new Error("Must provide a base reference or pass in a patch");
14176
- }
14177
- return (
14178
- /*istanbul ignore start*/
14179
- (0, /*istanbul ignore end*/
14180
- /*istanbul ignore start*/
14181
- _create.structuredPatch)(void 0, void 0, base, param)
14182
- );
14183
- }
14184
- return param;
14185
- }
14186
- function fileNameChanged(patch) {
14187
- return patch.newFileName && patch.newFileName !== patch.oldFileName;
14188
- }
14189
- function selectField(index, mine, theirs) {
14190
- if (mine === theirs) {
14191
- return mine;
14192
- } else {
14193
- index.conflict = true;
14194
- return {
14195
- mine,
14196
- theirs
14197
- };
14198
- }
14199
- }
14200
- function hunkBefore(test, check) {
14201
- return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
14202
- }
14203
- function cloneHunk(hunk, offset) {
14204
- return {
14205
- oldStart: hunk.oldStart,
14206
- oldLines: hunk.oldLines,
14207
- newStart: hunk.newStart + offset,
14208
- newLines: hunk.newLines,
14209
- lines: hunk.lines
14210
- };
14211
- }
14212
- function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
14213
- var mine = {
14214
- offset: mineOffset,
14215
- lines: mineLines,
14216
- index: 0
14217
- }, their = {
14218
- offset: theirOffset,
14219
- lines: theirLines,
14220
- index: 0
14221
- };
14222
- insertLeading(hunk, mine, their);
14223
- insertLeading(hunk, their, mine);
14224
- while (mine.index < mine.lines.length && their.index < their.lines.length) {
14225
- var mineCurrent = mine.lines[mine.index], theirCurrent = their.lines[their.index];
14226
- if ((mineCurrent[0] === "-" || mineCurrent[0] === "+") && (theirCurrent[0] === "-" || theirCurrent[0] === "+")) {
14227
- mutualChange(hunk, mine, their);
14228
- } else if (mineCurrent[0] === "+" && theirCurrent[0] === " ") {
14229
- var _hunk$lines;
14230
- (_hunk$lines = /*istanbul ignore end*/
14231
- hunk.lines).push.apply(
14232
- /*istanbul ignore start*/
14233
- _hunk$lines,
14234
- /*istanbul ignore start*/
14235
- _toConsumableArray(
14236
- /*istanbul ignore end*/
14237
- collectChange(mine)
14238
- )
14239
- );
14240
- } else if (theirCurrent[0] === "+" && mineCurrent[0] === " ") {
14241
- var _hunk$lines2;
14242
- (_hunk$lines2 = /*istanbul ignore end*/
14243
- hunk.lines).push.apply(
14244
- /*istanbul ignore start*/
14245
- _hunk$lines2,
14246
- /*istanbul ignore start*/
14247
- _toConsumableArray(
14248
- /*istanbul ignore end*/
14249
- collectChange(their)
14250
- )
14251
- );
14252
- } else if (mineCurrent[0] === "-" && theirCurrent[0] === " ") {
14253
- removal(hunk, mine, their);
14254
- } else if (theirCurrent[0] === "-" && mineCurrent[0] === " ") {
14255
- removal(hunk, their, mine, true);
14256
- } else if (mineCurrent === theirCurrent) {
14257
- hunk.lines.push(mineCurrent);
14258
- mine.index++;
14259
- their.index++;
14260
- } else {
14261
- conflict(hunk, collectChange(mine), collectChange(their));
14262
- }
14263
- }
14264
- insertTrailing(hunk, mine);
14265
- insertTrailing(hunk, their);
14266
- calcLineCount(hunk);
14267
- }
14268
- function mutualChange(hunk, mine, their) {
14269
- var myChanges = collectChange(mine), theirChanges = collectChange(their);
14270
- if (allRemoves(myChanges) && allRemoves(theirChanges)) {
14271
- if (
14272
- /*istanbul ignore start*/
14273
- (0, /*istanbul ignore end*/
14274
- /*istanbul ignore start*/
14275
- _array.arrayStartsWith)(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)
14276
- ) {
14277
- var _hunk$lines3;
14278
- (_hunk$lines3 = /*istanbul ignore end*/
14279
- hunk.lines).push.apply(
14280
- /*istanbul ignore start*/
14281
- _hunk$lines3,
14282
- /*istanbul ignore start*/
14283
- _toConsumableArray(
14284
- /*istanbul ignore end*/
14285
- myChanges
14286
- )
14287
- );
14288
- return;
14289
- } else if (
14290
- /*istanbul ignore start*/
14291
- (0, /*istanbul ignore end*/
14292
- /*istanbul ignore start*/
14293
- _array.arrayStartsWith)(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)
14294
- ) {
14295
- var _hunk$lines4;
14296
- (_hunk$lines4 = /*istanbul ignore end*/
14297
- hunk.lines).push.apply(
14298
- /*istanbul ignore start*/
14299
- _hunk$lines4,
14300
- /*istanbul ignore start*/
14301
- _toConsumableArray(
14302
- /*istanbul ignore end*/
14303
- theirChanges
14304
- )
14305
- );
14306
- return;
14307
- }
14308
- } else if (
14309
- /*istanbul ignore start*/
14310
- (0, /*istanbul ignore end*/
14311
- /*istanbul ignore start*/
14312
- _array.arrayEqual)(myChanges, theirChanges)
14313
- ) {
14314
- var _hunk$lines5;
14315
- (_hunk$lines5 = /*istanbul ignore end*/
14316
- hunk.lines).push.apply(
14317
- /*istanbul ignore start*/
14318
- _hunk$lines5,
14319
- /*istanbul ignore start*/
14320
- _toConsumableArray(
14321
- /*istanbul ignore end*/
14322
- myChanges
14323
- )
14324
- );
14325
- return;
14326
- }
14327
- conflict(hunk, myChanges, theirChanges);
14328
- }
14329
- function removal(hunk, mine, their, swap) {
14330
- var myChanges = collectChange(mine), theirChanges = collectContext(their, myChanges);
14331
- if (theirChanges.merged) {
14332
- var _hunk$lines6;
14333
- (_hunk$lines6 = /*istanbul ignore end*/
14334
- hunk.lines).push.apply(
14335
- /*istanbul ignore start*/
14336
- _hunk$lines6,
14337
- /*istanbul ignore start*/
14338
- _toConsumableArray(
14339
- /*istanbul ignore end*/
14340
- theirChanges.merged
14341
- )
14342
- );
14343
- } else {
14344
- conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
14345
- }
14346
- }
14347
- function conflict(hunk, mine, their) {
14348
- hunk.conflict = true;
14349
- hunk.lines.push({
14350
- conflict: true,
14351
- mine,
14352
- theirs: their
14353
- });
14354
- }
14355
- function insertLeading(hunk, insert, their) {
14356
- while (insert.offset < their.offset && insert.index < insert.lines.length) {
14357
- var line = insert.lines[insert.index++];
14358
- hunk.lines.push(line);
14359
- insert.offset++;
14360
- }
14361
- }
14362
- function insertTrailing(hunk, insert) {
14363
- while (insert.index < insert.lines.length) {
14364
- var line = insert.lines[insert.index++];
14365
- hunk.lines.push(line);
14366
- }
14367
- }
14368
- function collectChange(state) {
14369
- var ret = [], operation = state.lines[state.index][0];
14370
- while (state.index < state.lines.length) {
14371
- var line = state.lines[state.index];
14372
- if (operation === "-" && line[0] === "+") {
14373
- operation = "+";
14374
- }
14375
- if (operation === line[0]) {
14376
- ret.push(line);
14377
- state.index++;
14378
- } else {
14379
- break;
14380
- }
14381
- }
14382
- return ret;
14383
- }
14384
- function collectContext(state, matchChanges) {
14385
- var changes = [], merged = [], matchIndex = 0, contextChanges = false, conflicted = false;
14386
- while (matchIndex < matchChanges.length && state.index < state.lines.length) {
14387
- var change = state.lines[state.index], match = matchChanges[matchIndex];
14388
- if (match[0] === "+") {
14389
- break;
14390
- }
14391
- contextChanges = contextChanges || change[0] !== " ";
14392
- merged.push(match);
14393
- matchIndex++;
14394
- if (change[0] === "+") {
14395
- conflicted = true;
14396
- while (change[0] === "+") {
14397
- changes.push(change);
14398
- change = state.lines[++state.index];
14399
- }
14400
- }
14401
- if (match.substr(1) === change.substr(1)) {
14402
- changes.push(change);
14403
- state.index++;
14404
- } else {
14405
- conflicted = true;
14406
- }
14407
- }
14408
- if ((matchChanges[matchIndex] || "")[0] === "+" && contextChanges) {
14409
- conflicted = true;
14410
- }
14411
- if (conflicted) {
14412
- return changes;
14413
- }
14414
- while (matchIndex < matchChanges.length) {
14415
- merged.push(matchChanges[matchIndex++]);
14416
- }
14417
- return {
14418
- merged,
14419
- changes
14420
- };
14421
- }
14422
- function allRemoves(changes) {
14423
- return changes.reduce(function(prev, change) {
14424
- return prev && change[0] === "-";
14425
- }, true);
14426
- }
14427
- function skipRemoveSuperset(state, removeChanges, delta) {
14428
- for (var i = 0; i < delta; i++) {
14429
- var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
14430
- if (state.lines[state.index + i] !== " " + changeContent) {
14431
- return false;
14432
- }
14433
- }
14434
- state.index += delta;
14435
- return true;
14436
- }
14437
- function calcOldNewLineCount(lines) {
14438
- var oldLines = 0;
14439
- var newLines = 0;
14440
- lines.forEach(function(line) {
14441
- if (typeof line !== "string") {
14442
- var myCount = calcOldNewLineCount(line.mine);
14443
- var theirCount = calcOldNewLineCount(line.theirs);
14444
- if (oldLines !== void 0) {
14445
- if (myCount.oldLines === theirCount.oldLines) {
14446
- oldLines += myCount.oldLines;
14447
- } else {
14448
- oldLines = void 0;
14449
- }
14450
- }
14451
- if (newLines !== void 0) {
14452
- if (myCount.newLines === theirCount.newLines) {
14453
- newLines += myCount.newLines;
14454
- } else {
14455
- newLines = void 0;
14456
- }
14457
- }
14458
- } else {
14459
- if (newLines !== void 0 && (line[0] === "+" || line[0] === " ")) {
14460
- newLines++;
14461
- }
14462
- if (oldLines !== void 0 && (line[0] === "-" || line[0] === " ")) {
14463
- oldLines++;
14464
- }
14465
- }
14466
- });
14467
- return {
14468
- oldLines,
14469
- newLines
14470
- };
14471
- }
14472
- }
14473
- });
14474
-
14475
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js
14476
- var require_reverse = __commonJS({
14477
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/patch/reverse.js"(exports2) {
14478
- "use strict";
14479
- Object.defineProperty(exports2, "__esModule", {
14480
- value: true
14481
- });
14482
- exports2.reversePatch = reversePatch;
14483
- function _typeof(o) {
14484
- "@babel/helpers - typeof";
14485
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
14486
- return typeof o2;
14487
- } : function(o2) {
14488
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
14489
- }, _typeof(o);
14490
- }
14491
- function ownKeys(e, r) {
14492
- var t = Object.keys(e);
14493
- if (Object.getOwnPropertySymbols) {
14494
- var o = Object.getOwnPropertySymbols(e);
14495
- r && (o = o.filter(function(r2) {
14496
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
14497
- })), t.push.apply(t, o);
14498
- }
14499
- return t;
14500
- }
14501
- function _objectSpread(e) {
14502
- for (var r = 1; r < arguments.length; r++) {
14503
- var t = null != arguments[r] ? arguments[r] : {};
14504
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
14505
- _defineProperty(e, r2, t[r2]);
14506
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
14507
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
14508
- });
14509
- }
14510
- return e;
14511
- }
14512
- function _defineProperty(obj, key, value) {
14513
- key = _toPropertyKey(key);
14514
- if (key in obj) {
14515
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
14516
- } else {
14517
- obj[key] = value;
14518
- }
14519
- return obj;
14520
- }
14521
- function _toPropertyKey(t) {
14522
- var i = _toPrimitive(t, "string");
14523
- return "symbol" == _typeof(i) ? i : i + "";
14524
- }
14525
- function _toPrimitive(t, r) {
14526
- if ("object" != _typeof(t) || !t) return t;
14527
- var e = t[Symbol.toPrimitive];
14528
- if (void 0 !== e) {
14529
- var i = e.call(t, r || "default");
14530
- if ("object" != _typeof(i)) return i;
14531
- throw new TypeError("@@toPrimitive must return a primitive value.");
14532
- }
14533
- return ("string" === r ? String : Number)(t);
14534
- }
14535
- function reversePatch(structuredPatch) {
14536
- if (Array.isArray(structuredPatch)) {
14537
- return structuredPatch.map(reversePatch).reverse();
14538
- }
14539
- return (
14540
- /*istanbul ignore start*/
14541
- _objectSpread(_objectSpread(
14542
- {},
14543
- /*istanbul ignore end*/
14544
- structuredPatch
14545
- ), {}, {
14546
- oldFileName: structuredPatch.newFileName,
14547
- oldHeader: structuredPatch.newHeader,
14548
- newFileName: structuredPatch.oldFileName,
14549
- newHeader: structuredPatch.oldHeader,
14550
- hunks: structuredPatch.hunks.map(function(hunk) {
14551
- return {
14552
- oldLines: hunk.newLines,
14553
- oldStart: hunk.newStart,
14554
- newLines: hunk.oldLines,
14555
- newStart: hunk.oldStart,
14556
- lines: hunk.lines.map(function(l) {
14557
- if (l.startsWith("-")) {
14558
- return (
14559
- /*istanbul ignore start*/
14560
- "+".concat(
14561
- /*istanbul ignore end*/
14562
- l.slice(1)
14563
- )
14564
- );
14565
- }
14566
- if (l.startsWith("+")) {
14567
- return (
14568
- /*istanbul ignore start*/
14569
- "-".concat(
14570
- /*istanbul ignore end*/
14571
- l.slice(1)
14572
- )
14573
- );
14574
- }
14575
- return l;
14576
- })
14577
- };
14578
- })
14579
- })
14580
- );
14581
- }
14582
- }
14583
- });
14584
-
14585
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js
13799
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/convert/dmp.js
14586
13800
  var require_dmp = __commonJS({
14587
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/dmp.js"(exports2) {
13801
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/convert/dmp.js"(exports2) {
14588
13802
  "use strict";
14589
- Object.defineProperty(exports2, "__esModule", {
14590
- value: true
14591
- });
13803
+ Object.defineProperty(exports2, "__esModule", { value: true });
14592
13804
  exports2.convertChangesToDMP = convertChangesToDMP;
14593
13805
  function convertChangesToDMP(changes) {
14594
- var ret = [], change, operation;
13806
+ var ret = [];
13807
+ var change, operation;
14595
13808
  for (var i = 0; i < changes.length; i++) {
14596
13809
  change = changes[i];
14597
13810
  if (change.added) {
@@ -14608,13 +13821,11 @@ var require_dmp = __commonJS({
14608
13821
  }
14609
13822
  });
14610
13823
 
14611
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js
13824
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/convert/xml.js
14612
13825
  var require_xml = __commonJS({
14613
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/convert/xml.js"(exports2) {
13826
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/convert/xml.js"(exports2) {
14614
13827
  "use strict";
14615
- Object.defineProperty(exports2, "__esModule", {
14616
- value: true
14617
- });
13828
+ Object.defineProperty(exports2, "__esModule", { value: true });
14618
13829
  exports2.convertChangesToXML = convertChangesToXML;
14619
13830
  function convertChangesToXML(changes) {
14620
13831
  var ret = [];
@@ -14645,163 +13856,120 @@ var require_xml = __commonJS({
14645
13856
  }
14646
13857
  });
14647
13858
 
14648
- // node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js
14649
- var require_lib = __commonJS({
14650
- "node_modules/.pnpm/diff@7.0.0/node_modules/diff/lib/index.js"(exports2) {
13859
+ // node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/index.js
13860
+ var require_libcjs = __commonJS({
13861
+ "node_modules/.pnpm/diff@8.0.4/node_modules/diff/libcjs/index.js"(exports2) {
14651
13862
  "use strict";
14652
- Object.defineProperty(exports2, "__esModule", {
14653
- value: true
14654
- });
14655
- Object.defineProperty(exports2, "Diff", {
14656
- enumerable: true,
14657
- get: function get() {
14658
- return _base["default"];
14659
- }
14660
- });
14661
- Object.defineProperty(exports2, "applyPatch", {
14662
- enumerable: true,
14663
- get: function get() {
14664
- return _apply.applyPatch;
14665
- }
14666
- });
14667
- Object.defineProperty(exports2, "applyPatches", {
14668
- enumerable: true,
14669
- get: function get() {
14670
- return _apply.applyPatches;
14671
- }
14672
- });
14673
- Object.defineProperty(exports2, "canonicalize", {
14674
- enumerable: true,
14675
- get: function get() {
14676
- return _json.canonicalize;
14677
- }
14678
- });
14679
- Object.defineProperty(exports2, "convertChangesToDMP", {
14680
- enumerable: true,
14681
- get: function get() {
14682
- return _dmp.convertChangesToDMP;
14683
- }
14684
- });
14685
- Object.defineProperty(exports2, "convertChangesToXML", {
14686
- enumerable: true,
14687
- get: function get() {
14688
- return _xml.convertChangesToXML;
14689
- }
14690
- });
14691
- Object.defineProperty(exports2, "createPatch", {
14692
- enumerable: true,
14693
- get: function get() {
14694
- return _create.createPatch;
14695
- }
14696
- });
14697
- Object.defineProperty(exports2, "createTwoFilesPatch", {
14698
- enumerable: true,
14699
- get: function get() {
14700
- return _create.createTwoFilesPatch;
14701
- }
14702
- });
14703
- Object.defineProperty(exports2, "diffArrays", {
14704
- enumerable: true,
14705
- get: function get() {
14706
- return _array.diffArrays;
14707
- }
14708
- });
14709
- Object.defineProperty(exports2, "diffChars", {
14710
- enumerable: true,
14711
- get: function get() {
14712
- return _character.diffChars;
14713
- }
14714
- });
14715
- Object.defineProperty(exports2, "diffCss", {
14716
- enumerable: true,
14717
- get: function get() {
14718
- return _css.diffCss;
14719
- }
14720
- });
14721
- Object.defineProperty(exports2, "diffJson", {
14722
- enumerable: true,
14723
- get: function get() {
14724
- return _json.diffJson;
14725
- }
14726
- });
14727
- Object.defineProperty(exports2, "diffLines", {
14728
- enumerable: true,
14729
- get: function get() {
14730
- return _line.diffLines;
14731
- }
14732
- });
14733
- Object.defineProperty(exports2, "diffSentences", {
14734
- enumerable: true,
14735
- get: function get() {
14736
- return _sentence.diffSentences;
14737
- }
14738
- });
14739
- Object.defineProperty(exports2, "diffTrimmedLines", {
14740
- enumerable: true,
14741
- get: function get() {
14742
- return _line.diffTrimmedLines;
14743
- }
14744
- });
14745
- Object.defineProperty(exports2, "diffWords", {
14746
- enumerable: true,
14747
- get: function get() {
14748
- return _word.diffWords;
14749
- }
14750
- });
14751
- Object.defineProperty(exports2, "diffWordsWithSpace", {
14752
- enumerable: true,
14753
- get: function get() {
14754
- return _word.diffWordsWithSpace;
14755
- }
14756
- });
14757
- Object.defineProperty(exports2, "formatPatch", {
14758
- enumerable: true,
14759
- get: function get() {
14760
- return _create.formatPatch;
14761
- }
14762
- });
14763
- Object.defineProperty(exports2, "merge", {
14764
- enumerable: true,
14765
- get: function get() {
14766
- return _merge.merge;
14767
- }
14768
- });
14769
- Object.defineProperty(exports2, "parsePatch", {
14770
- enumerable: true,
14771
- get: function get() {
14772
- return _parse.parsePatch;
14773
- }
14774
- });
14775
- Object.defineProperty(exports2, "reversePatch", {
14776
- enumerable: true,
14777
- get: function get() {
14778
- return _reverse.reversePatch;
14779
- }
14780
- });
14781
- Object.defineProperty(exports2, "structuredPatch", {
14782
- enumerable: true,
14783
- get: function get() {
14784
- return _create.structuredPatch;
14785
- }
14786
- });
14787
- var _base = _interopRequireDefault(require_base());
14788
- var _character = require_character();
14789
- var _word = require_word();
14790
- var _line = require_line();
14791
- var _sentence = require_sentence();
14792
- var _css = require_css();
14793
- var _json = require_json();
14794
- var _array = require_array2();
14795
- var _apply = require_apply();
14796
- var _parse = require_parse4();
14797
- var _merge = require_merge();
14798
- var _reverse = require_reverse();
14799
- var _create = require_create();
14800
- var _dmp = require_dmp();
14801
- var _xml = require_xml();
14802
- function _interopRequireDefault(obj) {
14803
- return obj && obj.__esModule ? obj : { "default": obj };
14804
- }
13863
+ Object.defineProperty(exports2, "__esModule", { value: true });
13864
+ exports2.canonicalize = exports2.convertChangesToXML = exports2.convertChangesToDMP = exports2.reversePatch = exports2.parsePatch = exports2.applyPatches = exports2.applyPatch = exports2.OMIT_HEADERS = exports2.FILE_HEADERS_ONLY = exports2.INCLUDE_HEADERS = exports2.formatPatch = exports2.createPatch = exports2.createTwoFilesPatch = exports2.structuredPatch = exports2.arrayDiff = exports2.diffArrays = exports2.jsonDiff = exports2.diffJson = exports2.cssDiff = exports2.diffCss = exports2.sentenceDiff = exports2.diffSentences = exports2.diffTrimmedLines = exports2.lineDiff = exports2.diffLines = exports2.wordsWithSpaceDiff = exports2.diffWordsWithSpace = exports2.wordDiff = exports2.diffWords = exports2.characterDiff = exports2.diffChars = exports2.Diff = void 0;
13865
+ var base_js_1 = require_base();
13866
+ exports2.Diff = base_js_1.default;
13867
+ var character_js_1 = require_character();
13868
+ Object.defineProperty(exports2, "diffChars", { enumerable: true, get: function() {
13869
+ return character_js_1.diffChars;
13870
+ } });
13871
+ Object.defineProperty(exports2, "characterDiff", { enumerable: true, get: function() {
13872
+ return character_js_1.characterDiff;
13873
+ } });
13874
+ var word_js_1 = require_word();
13875
+ Object.defineProperty(exports2, "diffWords", { enumerable: true, get: function() {
13876
+ return word_js_1.diffWords;
13877
+ } });
13878
+ Object.defineProperty(exports2, "diffWordsWithSpace", { enumerable: true, get: function() {
13879
+ return word_js_1.diffWordsWithSpace;
13880
+ } });
13881
+ Object.defineProperty(exports2, "wordDiff", { enumerable: true, get: function() {
13882
+ return word_js_1.wordDiff;
13883
+ } });
13884
+ Object.defineProperty(exports2, "wordsWithSpaceDiff", { enumerable: true, get: function() {
13885
+ return word_js_1.wordsWithSpaceDiff;
13886
+ } });
13887
+ var line_js_1 = require_line();
13888
+ Object.defineProperty(exports2, "diffLines", { enumerable: true, get: function() {
13889
+ return line_js_1.diffLines;
13890
+ } });
13891
+ Object.defineProperty(exports2, "diffTrimmedLines", { enumerable: true, get: function() {
13892
+ return line_js_1.diffTrimmedLines;
13893
+ } });
13894
+ Object.defineProperty(exports2, "lineDiff", { enumerable: true, get: function() {
13895
+ return line_js_1.lineDiff;
13896
+ } });
13897
+ var sentence_js_1 = require_sentence();
13898
+ Object.defineProperty(exports2, "diffSentences", { enumerable: true, get: function() {
13899
+ return sentence_js_1.diffSentences;
13900
+ } });
13901
+ Object.defineProperty(exports2, "sentenceDiff", { enumerable: true, get: function() {
13902
+ return sentence_js_1.sentenceDiff;
13903
+ } });
13904
+ var css_js_1 = require_css();
13905
+ Object.defineProperty(exports2, "diffCss", { enumerable: true, get: function() {
13906
+ return css_js_1.diffCss;
13907
+ } });
13908
+ Object.defineProperty(exports2, "cssDiff", { enumerable: true, get: function() {
13909
+ return css_js_1.cssDiff;
13910
+ } });
13911
+ var json_js_1 = require_json();
13912
+ Object.defineProperty(exports2, "diffJson", { enumerable: true, get: function() {
13913
+ return json_js_1.diffJson;
13914
+ } });
13915
+ Object.defineProperty(exports2, "canonicalize", { enumerable: true, get: function() {
13916
+ return json_js_1.canonicalize;
13917
+ } });
13918
+ Object.defineProperty(exports2, "jsonDiff", { enumerable: true, get: function() {
13919
+ return json_js_1.jsonDiff;
13920
+ } });
13921
+ var array_js_1 = require_array2();
13922
+ Object.defineProperty(exports2, "diffArrays", { enumerable: true, get: function() {
13923
+ return array_js_1.diffArrays;
13924
+ } });
13925
+ Object.defineProperty(exports2, "arrayDiff", { enumerable: true, get: function() {
13926
+ return array_js_1.arrayDiff;
13927
+ } });
13928
+ var apply_js_1 = require_apply();
13929
+ Object.defineProperty(exports2, "applyPatch", { enumerable: true, get: function() {
13930
+ return apply_js_1.applyPatch;
13931
+ } });
13932
+ Object.defineProperty(exports2, "applyPatches", { enumerable: true, get: function() {
13933
+ return apply_js_1.applyPatches;
13934
+ } });
13935
+ var parse_js_1 = require_parse4();
13936
+ Object.defineProperty(exports2, "parsePatch", { enumerable: true, get: function() {
13937
+ return parse_js_1.parsePatch;
13938
+ } });
13939
+ var reverse_js_1 = require_reverse();
13940
+ Object.defineProperty(exports2, "reversePatch", { enumerable: true, get: function() {
13941
+ return reverse_js_1.reversePatch;
13942
+ } });
13943
+ var create_js_1 = require_create();
13944
+ Object.defineProperty(exports2, "structuredPatch", { enumerable: true, get: function() {
13945
+ return create_js_1.structuredPatch;
13946
+ } });
13947
+ Object.defineProperty(exports2, "createTwoFilesPatch", { enumerable: true, get: function() {
13948
+ return create_js_1.createTwoFilesPatch;
13949
+ } });
13950
+ Object.defineProperty(exports2, "createPatch", { enumerable: true, get: function() {
13951
+ return create_js_1.createPatch;
13952
+ } });
13953
+ Object.defineProperty(exports2, "formatPatch", { enumerable: true, get: function() {
13954
+ return create_js_1.formatPatch;
13955
+ } });
13956
+ Object.defineProperty(exports2, "INCLUDE_HEADERS", { enumerable: true, get: function() {
13957
+ return create_js_1.INCLUDE_HEADERS;
13958
+ } });
13959
+ Object.defineProperty(exports2, "FILE_HEADERS_ONLY", { enumerable: true, get: function() {
13960
+ return create_js_1.FILE_HEADERS_ONLY;
13961
+ } });
13962
+ Object.defineProperty(exports2, "OMIT_HEADERS", { enumerable: true, get: function() {
13963
+ return create_js_1.OMIT_HEADERS;
13964
+ } });
13965
+ var dmp_js_1 = require_dmp();
13966
+ Object.defineProperty(exports2, "convertChangesToDMP", { enumerable: true, get: function() {
13967
+ return dmp_js_1.convertChangesToDMP;
13968
+ } });
13969
+ var xml_js_1 = require_xml();
13970
+ Object.defineProperty(exports2, "convertChangesToXML", { enumerable: true, get: function() {
13971
+ return xml_js_1.convertChangesToXML;
13972
+ } });
14805
13973
  }
14806
13974
  });
14807
13975
 
@@ -15783,7 +14951,7 @@ var require_install = __commonJS({
15783
14951
  var fg = require_out4();
15784
14952
  var { z } = require_zod();
15785
14953
  var semver = require_semver2();
15786
- var { createTwoFilesPatch } = require_lib();
14954
+ var { createTwoFilesPatch } = require_libcjs();
15787
14955
  var clack = require_dist3();
15788
14956
  var ok = (s) => pc.green("\u2713") + " " + s;
15789
14957
  var fail = (s) => pc.red("\u2717") + " " + s;
@@ -15849,7 +15017,10 @@ var require_install = __commonJS({
15849
15017
  // #252 — skip update-notifier check
15850
15018
  noUpdateCheck: false,
15851
15019
  // #381 — skip backup tarball on --force-overwrite (CI escape hatch)
15852
- noBackup: false
15020
+ noBackup: false,
15021
+ // #199 — git pre-commit hook. null = install if .git/ present (default).
15022
+ // Set false by --no-git-hooks, true by --git-hooks.
15023
+ gitHooks: null
15853
15024
  };
15854
15025
  const positional = [];
15855
15026
  for (let i = 0; i < argv.length; i++) {
@@ -15875,6 +15046,8 @@ var require_install = __commonJS({
15875
15046
  else if (arg === "--accept-all") opts.acceptAll = true;
15876
15047
  else if (arg === "--no-update-check") opts.noUpdateCheck = true;
15877
15048
  else if (arg === "--no-backup") opts.noBackup = true;
15049
+ else if (arg === "--no-git-hooks") opts.gitHooks = false;
15050
+ else if (arg === "--git-hooks") opts.gitHooks = true;
15878
15051
  else if (!arg.startsWith("--")) positional.push(arg);
15879
15052
  }
15880
15053
  if (positional[0]) {
@@ -16048,7 +15221,7 @@ Installs (IDE-specific):
16048
15221
  case "claude":
16049
15222
  return {
16050
15223
  agentsDir: path2.join(target, ".claude", "agents"),
16051
- commandsDir: path2.join(target, ".claude", "commands", "rihal"),
15224
+ commandsDir: path2.join(target, ".claude", "commands"),
16052
15225
  workflowsDir: path2.join(target, ".rihal", "workflows"),
16053
15226
  referencesDir: path2.join(target, ".rihal", "references"),
16054
15227
  binDir: path2.join(target, ".rihal", "bin")
@@ -16299,6 +15472,67 @@ Say "plan a sprint" or run \`/rihal-sprint-planning\` to break Phase 01 into sto
16299
15472
  return { action: "skipped-error", error: err.message };
16300
15473
  }
16301
15474
  }
15475
+ function ensureRcodePreCommitHook(target, options = {}) {
15476
+ if (options.gitHooks === false) return { action: "skipped-flag" };
15477
+ const gitDir = path2.join(target, ".git");
15478
+ if (!fs2.existsSync(gitDir) || !fs2.statSync(gitDir).isDirectory()) {
15479
+ return { action: "skipped-no-git" };
15480
+ }
15481
+ const BEGIN = "# ===== rcode-managed pre-commit block =====";
15482
+ const END = "# ===== end rcode pre-commit block =====";
15483
+ const BLOCK = [
15484
+ "",
15485
+ BEGIN,
15486
+ "# Auto-syncs .rihal/state.json when planning files change.",
15487
+ "# Added by rcode install \u2014 safe to re-run (idempotent).",
15488
+ 'if git diff --cached --name-only | grep -qE "^\\.planning/|^\\.rihal/brain/sources\\.yaml$"; then',
15489
+ " if [ -x .rihal/bin/rihal-tools.cjs ]; then",
15490
+ " node .rihal/bin/rihal-tools.cjs state sync --from-disk > /dev/null 2>&1 || true",
15491
+ " git add .rihal/state.json 2>/dev/null || true",
15492
+ " fi",
15493
+ "fi",
15494
+ END,
15495
+ ""
15496
+ ].join("\n");
15497
+ const hooksDir = path2.join(gitDir, "hooks");
15498
+ const hookPath = path2.join(hooksDir, "pre-commit");
15499
+ try {
15500
+ let spliceBlock2 = function(text, newBlock) {
15501
+ const start = text.indexOf(BEGIN);
15502
+ if (start < 0) return null;
15503
+ const endIdx = text.indexOf(END, start);
15504
+ if (endIdx < 0) return null;
15505
+ let sliceStart = start;
15506
+ if (sliceStart > 0 && text[sliceStart - 1] === "\n") sliceStart -= 1;
15507
+ let sliceEnd = endIdx + END.length;
15508
+ if (text[sliceEnd] === "\n") sliceEnd += 1;
15509
+ return text.slice(0, sliceStart) + newBlock + text.slice(sliceEnd);
15510
+ };
15511
+ var spliceBlock = spliceBlock2;
15512
+ fs2.mkdirSync(hooksDir, { recursive: true });
15513
+ if (!fs2.existsSync(hookPath)) {
15514
+ fs2.writeFileSync(hookPath, `#!/bin/sh
15515
+ ${BLOCK}`);
15516
+ fs2.chmodSync(hookPath, 493);
15517
+ return { action: "created" };
15518
+ }
15519
+ const existing = fs2.readFileSync(hookPath, "utf8");
15520
+ if (existing.includes(BEGIN)) {
15521
+ const rewritten = spliceBlock2(existing, BLOCK);
15522
+ if (rewritten !== null && rewritten !== existing) {
15523
+ fs2.writeFileSync(hookPath, rewritten);
15524
+ fs2.chmodSync(hookPath, 493);
15525
+ return { action: "updated" };
15526
+ }
15527
+ return { action: "already-present" };
15528
+ }
15529
+ fs2.writeFileSync(hookPath, existing + BLOCK);
15530
+ fs2.chmodSync(hookPath, 493);
15531
+ return { action: "appended" };
15532
+ } catch (err) {
15533
+ return { action: "skipped-error", error: err.message };
15534
+ }
15535
+ }
16302
15536
  function installBrainScaffold(packageRoot, target) {
16303
15537
  const srcDir = path2.join(packageRoot, "rihal", "brain");
16304
15538
  const destDir = path2.join(target, ".rihal", "brain");
@@ -16433,7 +15667,8 @@ Say "plan a sprint" or run \`/rihal-sprint-planning\` to break Phase 01 into sto
16433
15667
  for (const f of walkFiles(path2.join(SOURCE_ROOT, "commands"))) {
16434
15668
  const rel = path2.relative(path2.join(SOURCE_ROOT, "commands"), f);
16435
15669
  const ext = ide === "cursor" ? ".mdc" : ".md";
16436
- const outName = path2.basename(f, ".md") + ext;
15670
+ const baseName = path2.basename(f, ".md");
15671
+ const outName = ide === "claude" ? `rihal-${baseName}${ext}` : baseName + ext;
16437
15672
  plan.push({ src: f, rel: path2.join(relCommands, path2.dirname(rel), outName), ide, cursor: ide === "cursor" });
16438
15673
  }
16439
15674
  const agentRulesDir = path2.join(target, ".rihal", "agents-rules");
@@ -16490,7 +15725,7 @@ Say "plan a sprint" or run \`/rihal-sprint-planning\` to break Phase 01 into sto
16490
15725
  }
16491
15726
  for (const a of mod.agents) allowed.add(path2.join(".claude", "agents", a));
16492
15727
  for (const w of mod.workflows) allowed.add(path2.join(".rihal", "workflows", w));
16493
- for (const c of mod.commands) allowed.add(path2.join(".claude", "commands", "rihal", c));
15728
+ for (const c of mod.commands) allowed.add(path2.join(".claude", "commands", `rihal-${c}`));
16494
15729
  for (const r of mod.references) allowed.add(path2.join(".rihal", "references", r));
16495
15730
  }
16496
15731
  return plan.filter((entry) => {
@@ -17051,6 +16286,7 @@ Say "plan a sprint" or run \`/rihal-sprint-planning\` to break Phase 01 into sto
17051
16286
  const starterSeeded = seedStarterPlanning(opts.target, opts.projectName);
17052
16287
  installBrainScaffold(PACKAGE_ROOT2, opts.target);
17053
16288
  const gitignoreReport = ensureRcodeGitignore(opts.target, { commitPlanning: opts.commitPlanning });
16289
+ const hookReport = ensureRcodePreCommitHook(opts.target, { gitHooks: opts.gitHooks });
17054
16290
  let brainReport = null;
17055
16291
  try {
17056
16292
  const { execFileSync } = require("child_process");
@@ -17091,6 +16327,18 @@ Say "plan a sprint" or run \`/rihal-sprint-planning\` to break Phase 01 into sto
17091
16327
  }[gitignoreReport.action] || ".gitignore unchanged";
17092
16328
  console.log(" " + dim(gitMsg));
17093
16329
  }
16330
+ if (hookReport) {
16331
+ const hookMsg = {
16332
+ "created": "pre-commit hook installed (.git/hooks/pre-commit)",
16333
+ "appended": "pre-commit hook updated \u2014 rcode block appended",
16334
+ "already-present": "pre-commit hook rcode block already present",
16335
+ "updated": "pre-commit hook rcode block refreshed",
16336
+ "skipped-flag": "pre-commit hook skipped (--no-git-hooks)",
16337
+ "skipped-no-git": "pre-commit hook skipped (no .git/ directory)",
16338
+ "skipped-error": `pre-commit hook skipped (${hookReport.error})`
16339
+ }[hookReport.action] || "pre-commit hook unchanged";
16340
+ console.log(" " + dim(hookMsg));
16341
+ }
17094
16342
  if (skipped > 0) console.log(" " + dim(`${skipped} files skipped (unchanged)`));
17095
16343
  if (preserved > 0 && opts.nonDestructive) {
17096
16344
  console.log("");
@@ -17121,7 +16369,11 @@ Say "plan a sprint" or run \`/rihal-sprint-planning\` to break Phase 01 into sto
17121
16369
  agentCount = fs2.readdirSync(agentsDir).filter((f) => (f.startsWith("rihal-") || f.startsWith("rcode-")) && (f.endsWith(".md") || f.endsWith(".mdc"))).length;
17122
16370
  }
17123
16371
  if (fs2.existsSync(commandsDir)) {
17124
- commandCount = fs2.readdirSync(commandsDir).filter((f) => f.endsWith(".md") || f.endsWith(".mdc")).length;
16372
+ commandCount = fs2.readdirSync(commandsDir).filter((f) => f.startsWith("rihal-") && (f.endsWith(".md") || f.endsWith(".mdc"))).length;
16373
+ }
16374
+ const legacyColonDir = path2.join(opts.target, ".claude", "commands", "rihal");
16375
+ if (primaryIde === "claude" && fs2.existsSync(legacyColonDir)) {
16376
+ fs2.rmSync(legacyColonDir, { recursive: true, force: true });
17125
16377
  }
17126
16378
  } catch {
17127
16379
  }
@@ -18553,6 +17805,11 @@ var require_uninstall = __commonJS({
18553
17805
  console.log(`\u2139 .rihal/ state was preserved. /rihal-init will detect this on reinstall.`);
18554
17806
  console.log(` For a fully clean slate next time, use: rcode uninstall --purge`);
18555
17807
  }
17808
+ console.log();
17809
+ console.log(`\u{1F4A1} IDE reload required:`);
17810
+ console.log(` VS Code / Cursor: Cmd+Shift+P \u2192 "Developer: Reload Window"`);
17811
+ console.log(` If commands still appear after reload, check ~/.claude/commands/ for`);
17812
+ console.log(` any globally-installed rihal-* items (rcode does not touch global installs).`);
18556
17813
  console.log(`
18557
17814
  To reinstall later:`);
18558
17815
  console.log(` rcode install`);