@inkeep/agents-cli 0.63.3 → 0.64.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/index.js +2 -73
  2. package/dist/index.js.map +1 -1
  3. package/dist/{agents-cli/package.js → package.js} +1 -1
  4. package/dist/package.js.map +1 -0
  5. package/dist/program.js +81 -0
  6. package/dist/program.js.map +1 -0
  7. package/dist/utils/version-check.js +1 -1
  8. package/package.json +6 -5
  9. package/dist/agents-cli/package.js.map +0 -1
  10. package/dist/commands/pull-v4/introspect/test-helpers.js +0 -146
  11. package/dist/commands/pull-v4/introspect/test-helpers.js.map +0 -1
  12. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js +0 -19
  13. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js.map +0 -1
  14. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js +0 -181
  15. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js.map +0 -1
  16. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js +0 -9
  17. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js.map +0 -1
  18. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/css.js +0 -13
  19. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/css.js.map +0 -1
  20. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/json.js +0 -61
  21. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/json.js.map +0 -1
  22. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/line.js +0 -38
  23. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/line.js.map +0 -1
  24. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/sentence.js +0 -32
  25. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/sentence.js.map +0 -1
  26. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/word.js +0 -119
  27. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/word.js.map +0 -1
  28. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/index.js +0 -11
  29. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js +0 -142
  30. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js.map +0 -1
  31. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js +0 -64
  32. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js.map +0 -1
@@ -1,142 +0,0 @@
1
- import { diffLines } from "../diff/line.js";
2
-
3
- //#region ../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js
4
- const INCLUDE_HEADERS = {
5
- includeIndex: true,
6
- includeUnderline: true,
7
- includeFileHeaders: true
8
- };
9
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
10
- let optionsObj;
11
- if (!options) optionsObj = {};
12
- else if (typeof options === "function") optionsObj = { callback: options };
13
- else optionsObj = options;
14
- if (typeof optionsObj.context === "undefined") optionsObj.context = 4;
15
- const context = optionsObj.context;
16
- if (optionsObj.newlineIsToken) throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
17
- if (!optionsObj.callback) return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
18
- else {
19
- const { callback } = optionsObj;
20
- diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff) => {
21
- callback(diffLinesResultToPatch(diff));
22
- } }));
23
- }
24
- function diffLinesResultToPatch(diff) {
25
- if (!diff) return;
26
- diff.push({
27
- value: "",
28
- lines: []
29
- });
30
- function contextLines(lines) {
31
- return lines.map(function(entry) {
32
- return " " + entry;
33
- });
34
- }
35
- const hunks = [];
36
- let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
37
- for (let i = 0; i < diff.length; i++) {
38
- const current = diff[i], lines = current.lines || splitLines(current.value);
39
- current.lines = lines;
40
- if (current.added || current.removed) {
41
- if (!oldRangeStart) {
42
- const prev = diff[i - 1];
43
- oldRangeStart = oldLine;
44
- newRangeStart = newLine;
45
- if (prev) {
46
- curRange = context > 0 ? contextLines(prev.lines.slice(-context)) : [];
47
- oldRangeStart -= curRange.length;
48
- newRangeStart -= curRange.length;
49
- }
50
- }
51
- for (const line of lines) curRange.push((current.added ? "+" : "-") + line);
52
- if (current.added) newLine += lines.length;
53
- else oldLine += lines.length;
54
- } else {
55
- if (oldRangeStart) if (lines.length <= context * 2 && i < diff.length - 2) for (const line of contextLines(lines)) curRange.push(line);
56
- else {
57
- const contextSize = Math.min(lines.length, context);
58
- for (const line of contextLines(lines.slice(0, contextSize))) curRange.push(line);
59
- const hunk = {
60
- oldStart: oldRangeStart,
61
- oldLines: oldLine - oldRangeStart + contextSize,
62
- newStart: newRangeStart,
63
- newLines: newLine - newRangeStart + contextSize,
64
- lines: curRange
65
- };
66
- hunks.push(hunk);
67
- oldRangeStart = 0;
68
- newRangeStart = 0;
69
- curRange = [];
70
- }
71
- oldLine += lines.length;
72
- newLine += lines.length;
73
- }
74
- }
75
- for (const hunk of hunks) for (let i = 0; i < hunk.lines.length; i++) if (hunk.lines[i].endsWith("\n")) hunk.lines[i] = hunk.lines[i].slice(0, -1);
76
- else {
77
- hunk.lines.splice(i + 1, 0, "\");
78
- i++;
79
- }
80
- return {
81
- oldFileName,
82
- newFileName,
83
- oldHeader,
84
- newHeader,
85
- hunks
86
- };
87
- }
88
- }
89
- /**
90
- * creates a unified diff patch.
91
- * @param patch either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`)
92
- */
93
- function formatPatch(patch, headerOptions) {
94
- if (!headerOptions) headerOptions = INCLUDE_HEADERS;
95
- if (Array.isArray(patch)) {
96
- if (patch.length > 1 && !headerOptions.includeFileHeaders) 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?)");
97
- return patch.map((p) => formatPatch(p, headerOptions)).join("\n");
98
- }
99
- const ret = [];
100
- if (headerOptions.includeIndex && patch.oldFileName == patch.newFileName) ret.push("Index: " + patch.oldFileName);
101
- if (headerOptions.includeUnderline) ret.push("===================================================================");
102
- if (headerOptions.includeFileHeaders) {
103
- ret.push("--- " + patch.oldFileName + (typeof patch.oldHeader === "undefined" ? "" : " " + patch.oldHeader));
104
- ret.push("+++ " + patch.newFileName + (typeof patch.newHeader === "undefined" ? "" : " " + patch.newHeader));
105
- }
106
- for (let i = 0; i < patch.hunks.length; i++) {
107
- const hunk = patch.hunks[i];
108
- if (hunk.oldLines === 0) hunk.oldStart -= 1;
109
- if (hunk.newLines === 0) hunk.newStart -= 1;
110
- ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
111
- for (const line of hunk.lines) ret.push(line);
112
- }
113
- return ret.join("\n") + "\n";
114
- }
115
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
116
- if (typeof options === "function") options = { callback: options };
117
- if (!(options === null || options === void 0 ? void 0 : options.callback)) {
118
- const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
119
- if (!patchObj) return;
120
- return formatPatch(patchObj, options === null || options === void 0 ? void 0 : options.headerOptions);
121
- } else {
122
- const { callback } = options;
123
- structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options), { callback: (patchObj) => {
124
- if (!patchObj) callback(void 0);
125
- else callback(formatPatch(patchObj, options.headerOptions));
126
- } }));
127
- }
128
- }
129
- /**
130
- * Split `text` into an array of lines, including the trailing newline character (where present)
131
- */
132
- function splitLines(text) {
133
- const hasTrailingNl = text.endsWith("\n");
134
- const result = text.split("\n").map((line) => line + "\n");
135
- if (hasTrailingNl) result.pop();
136
- else result.push(result.pop().slice(0, -1));
137
- return result;
138
- }
139
-
140
- //#endregion
141
- export { INCLUDE_HEADERS, createTwoFilesPatch, formatPatch, structuredPatch };
142
- //# sourceMappingURL=create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js"],"sourcesContent":["import { diffLines } from '../diff/line.js';\nexport const INCLUDE_HEADERS = {\n includeIndex: true,\n includeUnderline: true,\n includeFileHeaders: true\n};\nexport const FILE_HEADERS_ONLY = {\n includeIndex: false,\n includeUnderline: false,\n includeFileHeaders: true\n};\nexport const OMIT_HEADERS = {\n includeIndex: false,\n includeUnderline: false,\n includeFileHeaders: false\n};\nexport function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n let optionsObj;\n if (!options) {\n optionsObj = {};\n }\n else if (typeof options === 'function') {\n optionsObj = { callback: options };\n }\n else {\n optionsObj = options;\n }\n if (typeof optionsObj.context === 'undefined') {\n optionsObj.context = 4;\n }\n // We copy this into its own variable to placate TypeScript, which thinks\n // optionsObj.context might be undefined in the callbacks below.\n const context = optionsObj.context;\n // @ts-expect-error (runtime check for something that is correctly a static type error)\n if (optionsObj.newlineIsToken) {\n throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions');\n }\n if (!optionsObj.callback) {\n return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));\n }\n else {\n const { callback } = optionsObj;\n diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff) => {\n const patch = diffLinesResultToPatch(diff);\n // TypeScript is unhappy without the cast because it does not understand that `patch` may\n // be undefined here only if `callback` is StructuredPatchCallbackAbortable:\n callback(patch);\n } }));\n }\n function diffLinesResultToPatch(diff) {\n // STEP 1: Build up the patch with no \"\\" lines and with the arrays\n // of lines containing trailing newline characters. We'll tidy up later...\n if (!diff) {\n return;\n }\n diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier\n function contextLines(lines) {\n return lines.map(function (entry) { return ' ' + entry; });\n }\n const hunks = [];\n let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;\n for (let i = 0; i < diff.length; i++) {\n const current = diff[i], lines = current.lines || splitLines(current.value);\n current.lines = lines;\n if (current.added || current.removed) {\n // If we have previous context, start with that\n if (!oldRangeStart) {\n const prev = diff[i - 1];\n oldRangeStart = oldLine;\n newRangeStart = newLine;\n if (prev) {\n curRange = context > 0 ? contextLines(prev.lines.slice(-context)) : [];\n oldRangeStart -= curRange.length;\n newRangeStart -= curRange.length;\n }\n }\n // Output our changes\n for (const line of lines) {\n curRange.push((current.added ? '+' : '-') + line);\n }\n // Track the updated file position\n if (current.added) {\n newLine += lines.length;\n }\n else {\n oldLine += lines.length;\n }\n }\n else {\n // Identical context lines. Track line changes\n if (oldRangeStart) {\n // Close out any changes that have been output (or join overlapping)\n if (lines.length <= context * 2 && i < diff.length - 2) {\n // Overlapping\n for (const line of contextLines(lines)) {\n curRange.push(line);\n }\n }\n else {\n // end the range and output\n const contextSize = Math.min(lines.length, context);\n for (const line of contextLines(lines.slice(0, contextSize))) {\n curRange.push(line);\n }\n const hunk = {\n oldStart: oldRangeStart,\n oldLines: (oldLine - oldRangeStart + contextSize),\n newStart: newRangeStart,\n newLines: (newLine - newRangeStart + contextSize),\n lines: curRange\n };\n hunks.push(hunk);\n oldRangeStart = 0;\n newRangeStart = 0;\n curRange = [];\n }\n }\n oldLine += lines.length;\n newLine += lines.length;\n }\n }\n // Step 2: eliminate the trailing `\\n` from each line of each hunk, and, where needed, add\n // \"\\".\n for (const hunk of hunks) {\n for (let i = 0; i < hunk.lines.length; i++) {\n if (hunk.lines[i].endsWith('\\n')) {\n hunk.lines[i] = hunk.lines[i].slice(0, -1);\n }\n else {\n hunk.lines.splice(i + 1, 0, '\\\');\n i++; // Skip the line we just added, then continue iterating\n }\n }\n }\n return {\n oldFileName: oldFileName, newFileName: newFileName,\n oldHeader: oldHeader, newHeader: newHeader,\n hunks: hunks\n };\n }\n}\n/**\n * creates a unified diff patch.\n * @param patch either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`)\n */\nexport function formatPatch(patch, headerOptions) {\n if (!headerOptions) {\n headerOptions = INCLUDE_HEADERS;\n }\n if (Array.isArray(patch)) {\n if (patch.length > 1 && !headerOptions.includeFileHeaders) {\n throw new Error('Cannot omit file headers on a multi-file patch. '\n + '(The result would be unparseable; how would a tool trying to apply '\n + 'the patch know which changes are to which file?)');\n }\n return patch.map(p => formatPatch(p, headerOptions)).join('\\n');\n }\n const ret = [];\n if (headerOptions.includeIndex && patch.oldFileName == patch.newFileName) {\n ret.push('Index: ' + patch.oldFileName);\n }\n if (headerOptions.includeUnderline) {\n ret.push('===================================================================');\n }\n if (headerOptions.includeFileHeaders) {\n ret.push('--- ' + patch.oldFileName + (typeof patch.oldHeader === 'undefined' ? '' : '\\t' + patch.oldHeader));\n ret.push('+++ ' + patch.newFileName + (typeof patch.newHeader === 'undefined' ? '' : '\\t' + patch.newHeader));\n }\n for (let i = 0; i < patch.hunks.length; i++) {\n const hunk = patch.hunks[i];\n // Unified Diff Format quirk: If the chunk size is 0,\n // the first number is one lower than one would expect.\n // https://www.artima.com/weblogs/viewpost.jsp?thread=164293\n if (hunk.oldLines === 0) {\n hunk.oldStart -= 1;\n }\n if (hunk.newLines === 0) {\n hunk.newStart -= 1;\n }\n ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines\n + ' +' + hunk.newStart + ',' + hunk.newLines\n + ' @@');\n for (const line of hunk.lines) {\n ret.push(line);\n }\n }\n return ret.join('\\n') + '\\n';\n}\nexport function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {\n if (typeof options === 'function') {\n options = { callback: options };\n }\n if (!(options === null || options === void 0 ? void 0 : options.callback)) {\n const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);\n if (!patchObj) {\n return;\n }\n return formatPatch(patchObj, options === null || options === void 0 ? void 0 : options.headerOptions);\n }\n else {\n const { callback } = options;\n structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options), { callback: patchObj => {\n if (!patchObj) {\n callback(undefined);\n }\n else {\n callback(formatPatch(patchObj, options.headerOptions));\n }\n } }));\n }\n}\nexport function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {\n return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);\n}\n/**\n * Split `text` into an array of lines, including the trailing newline character (where present)\n */\nfunction splitLines(text) {\n const hasTrailingNl = text.endsWith('\\n');\n const result = text.split('\\n').map(line => line + '\\n');\n if (hasTrailingNl) {\n result.pop();\n }\n else {\n result.push(result.pop().slice(0, -1));\n }\n return result;\n}\n"],"x_google_ignoreList":[0],"mappings":";;;AACA,MAAa,kBAAkB;CAC3B,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACvB;AAWD,SAAgB,gBAAgB,aAAa,aAAa,QAAQ,QAAQ,WAAW,WAAW,SAAS;CACrG,IAAI;AACJ,KAAI,CAAC,QACD,cAAa,EAAE;UAEV,OAAO,YAAY,WACxB,cAAa,EAAE,UAAU,SAAS;KAGlC,cAAa;AAEjB,KAAI,OAAO,WAAW,YAAY,YAC9B,YAAW,UAAU;CAIzB,MAAM,UAAU,WAAW;AAE3B,KAAI,WAAW,eACX,OAAM,IAAI,MAAM,8FAA8F;AAElH,KAAI,CAAC,WAAW,SACZ,QAAO,uBAAuB,UAAU,QAAQ,QAAQ,WAAW,CAAC;MAEnE;EACD,MAAM,EAAE,aAAa;AACrB,YAAU,QAAQ,QAAQ,OAAO,OAAO,OAAO,OAAO,EAAE,EAAE,WAAW,EAAE,EAA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) if (str1[i] != str2[i]) return str1.slice(0, i);
5
- return str1.slice(0, i);
6
- }
7
- function longestCommonSuffix(str1, str2) {
8
- let i;
9
- if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) return "";
10
- for (i = 0; i < str1.length && i < str2.length; i++) if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) return str1.slice(-i);
11
- return str1.slice(-i);
12
- }
13
- function replacePrefix(string, oldPrefix, newPrefix) {
14
- if (string.slice(0, oldPrefix.length) != oldPrefix) throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);
15
- return newPrefix + string.slice(oldPrefix.length);
16
- }
17
- function replaceSuffix(string, oldSuffix, newSuffix) {
18
- if (!oldSuffix) return string + newSuffix;
19
- if (string.slice(-oldSuffix.length) != oldSuffix) throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);
20
- return string.slice(0, -oldSuffix.length) + newSuffix;
21
- }
22
- function removePrefix(string, oldPrefix) {
23
- return replacePrefix(string, oldPrefix, "");
24
- }
25
- function removeSuffix(string, oldSuffix) {
26
- return replaceSuffix(string, oldSuffix, "");
27
- }
28
- function maximumOverlap(string1, string2) {
29
- return string2.slice(0, overlapCount(string1, string2));
30
- }
31
- function overlapCount(a, b) {
32
- let startA = 0;
33
- if (a.length > b.length) startA = a.length - b.length;
34
- let endB = b.length;
35
- if (a.length < b.length) endB = a.length;
36
- const map = Array(endB);
37
- let k = 0;
38
- map[0] = 0;
39
- for (let j = 1; j < endB; j++) {
40
- if (b[j] == b[k]) map[j] = map[k];
41
- else map[j] = k;
42
- while (k > 0 && b[j] != b[k]) k = map[k];
43
- if (b[j] == b[k]) k++;
44
- }
45
- k = 0;
46
- for (let i = startA; i < a.length; i++) {
47
- while (k > 0 && a[i] != b[k]) k = map[k];
48
- if (a[i] == b[k]) k++;
49
- }
50
- return k;
51
- }
52
- function trailingWs(string) {
53
- let i;
54
- for (i = string.length - 1; i >= 0; i--) if (!string[i].match(/\s/)) break;
55
- return string.substring(i + 1);
56
- }
57
- function leadingWs(string) {
58
- const match = string.match(/^\s*/);
59
- return match ? match[0] : "";
60
- }
61
-
62
- //#endregion
63
- export { leadingWs, longestCommonPrefix, longestCommonSuffix, maximumOverlap, removePrefix, removeSuffix, replacePrefix, replaceSuffix, trailingWs };
64
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js"],"sourcesContent":["export function longestCommonPrefix(str1, str2) {\n let i;\n for (i = 0; i < str1.length && i < str2.length; i++) {\n if (str1[i] != str2[i]) {\n return str1.slice(0, i);\n }\n }\n return str1.slice(0, i);\n}\nexport function longestCommonSuffix(str1, str2) {\n let i;\n // Unlike longestCommonPrefix, we need a special case to handle all scenarios\n // where we return the empty string since str1.slice(-0) will return the\n // entire string.\n if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {\n return '';\n }\n for (i = 0; i < str1.length && i < str2.length; i++) {\n if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {\n return str1.slice(-i);\n }\n }\n return str1.slice(-i);\n}\nexport function replacePrefix(string, oldPrefix, newPrefix) {\n if (string.slice(0, oldPrefix.length) != oldPrefix) {\n throw Error(`string ${JSON.stringify(string)} doesn't start with prefix ${JSON.stringify(oldPrefix)}; this is a bug`);\n }\n return newPrefix + string.slice(oldPrefix.length);\n}\nexport function replaceSuffix(string, oldSuffix, newSuffix) {\n if (!oldSuffix) {\n return string + newSuffix;\n }\n if (string.slice(-oldSuffix.length) != oldSuffix) {\n throw Error(`string ${JSON.stringify(string)} doesn't end with suffix ${JSON.stringify(oldSuffix)}; this is a bug`);\n }\n return string.slice(0, -oldSuffix.length) + newSuffix;\n}\nexport function removePrefix(string, oldPrefix) {\n return replacePrefix(string, oldPrefix, '');\n}\nexport function removeSuffix(string, oldSuffix) {\n return replaceSuffix(string, oldSuffix, '');\n}\nexport function maximumOverlap(string1, string2) {\n return string2.slice(0, overlapCount(string1, string2));\n}\n// Nicked from https://stackoverflow.com/a/60422853/1709587\nfunction overlapCount(a, b) {\n // Deal with cases where the strings differ in length\n let startA = 0;\n if (a.length > b.length) {\n startA = a.length - b.length;\n }\n let endB = b.length;\n if (a.length < b.length) {\n endB = a.length;\n }\n // Create a back-reference for each index\n // that should be followed in case of a mismatch.\n // We only need B to make these references:\n const map = Array(endB);\n let k = 0; // Index that lags behind j\n map[0] = 0;\n for (let j = 1; j < endB; j++) {\n if (b[j] == b[k]) {\n map[j] = map[k]; // skip over the same character (optional optimisation)\n }\n else {\n map[j] = k;\n }\n while (k > 0 && b[j] != b[k]) {\n k = map[k];\n }\n if (b[j] == b[k]) {\n k++;\n }\n }\n // Phase 2: use these references while iterating over A\n k = 0;\n for (let i = startA; i < a.length; i++) {\n while (k > 0 && a[i] != b[k]) {\n k = map[k];\n }\n if (a[i] == b[k]) {\n k++;\n }\n }\n return k;\n}\n/**\n * Returns true if the string consistently uses Windows line endings.\n */\nexport function hasOnlyWinLineEndings(string) {\n return string.includes('\\r\\n') && !string.startsWith('\\n') && !string.match(/[^\\r]\\n/);\n}\n/**\n * Returns true if the string consistently uses Unix line endings.\n */\nexport function hasOnlyUnixLineEndings(string) {\n return !string.includes('\\r\\n') && string.includes('\\n');\n}\nexport function trailingWs(string) {\n // Yes, this looks overcomplicated and dumb - why not replace the whole function with\n // return string.match(/\\s*$/)[0]\n // you ask? Because:\n // 1. the trap described at https://markamery.com/blog/quadratic-time-regexes/ would mean doing\n // this would cause this function to take O(n²) time in the worst case (specifically when\n // there is a massive run of NON-TRAILING whitespace in `string`), and\n // 2. the fix proposed in the same blog post, of using a negative lookbehind, is incompatible\n // with old Safari versions that we'd like to not break if possible (see\n // https://github.com/kpdecker/jsdiff/pull/550)\n // It feels absurd to do this with an explicit loop instead of a regex, but I really can't see a\n // better way that doesn't result in broken behaviour.\n let i;\n for (i = string.length - 1; i >= 0; i--) {\n if (!string[i].match(/\\s/)) {\n break;\n }\n }\n return string.substring(i + 1);\n}\nexport function leadingWs(string) {\n // Thankfully the annoying considerations described in trailingWs don't apply here:\n const match = string.match(/^\\s*/);\n return match ? match[0] : '';\n}\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAgB,oBAAoB,MAAM,MAAM;CAC5C,IAAI;AACJ,MAAK,IAAI,GAAG,IAAI,KAAK,UAAU,IAAI,KAAK,QAAQ,IAC5C,KAAI,KAAK,MAAM,KAAK,GAChB,QAAO,KAAK,MAAM,GAAG,EAAE;AAG/B,QAAO,KAAK,MAAM,GAAG,EAAE;;AAE3B,SAAgB,oBAAoB,MAAM,MAAM;CAC5C,IAAI;AAIJ,KAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,KAAK,SAAS,MAAM,KAAK,KAAK,SAAS,GAC9D,QAAO;AAEX,MAAK,IAAI,GAAG,IAAI,KAAK,UAAU,IAAI,KAAK,QAAQ,IAC5C,KAAI,KAAK,KAAK,UAAU,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,IACvD,QAAO,KAAK,MAAM,CAAC,EAAE;AAG7B,QAAO,KAAK,MAAM,CAAC,EAAE;;AAEzB,SAAgB,cAAc,QAAQ,WAAW,WAAW;AACxD,KAAI,OAAO,MAAM,GAAG,UAAU,OAAO,IAAI,UACrC,OAAM,MAAM,UAAU,KAAK,UAAU,OAAO,CAAC,6BAA6B,KAAK,UAAU,UAAU,CAAC,iBAAiB;AAEzH,QAAO,YAAY,OAAO,MAAM,UAAU,OAAO;;AAErD,SAAgB,cAAc,QAAQ,WAAW,WAAW;AACxD,KAAI,CAAC,UACD,QAAO,SAAS;AAEpB,KAAI,OAAO,MAAM,CAAC,UAAU,OAAO,IAAI,UACnC,OAAM,MAAM,UAAU,KAAK,UAAU,OAAO,CAAC,2BAA2B,KAAK,UAAU,UAAU,CAAC,iBAAiB;AAEvH,QAAO,OAAO,MAAM,GAAG,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