Bump the npm group with 3 updates (#2303)
* --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: sinon dependency-type: direct:development update-type: version-update:semver-major dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
ebd27c09f6
commit
b1bd8da5e7
212 changed files with 11182 additions and 16383 deletions
169
node_modules/diff/lib/diff/base.js
generated
vendored
169
node_modules/diff/lib/diff/base.js
generated
vendored
File diff suppressed because one or more lines are too long
7
node_modules/diff/lib/diff/line.js
generated
vendored
7
node_modules/diff/lib/diff/line.js
generated
vendored
|
|
@ -39,6 +39,11 @@ exports.lineDiff = lineDiff;
|
|||
|
||||
/*istanbul ignore end*/
|
||||
lineDiff.tokenize = function (value) {
|
||||
if (this.options.stripTrailingCr) {
|
||||
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
|
||||
value = value.replace(/\r\n/g, '\n');
|
||||
}
|
||||
|
||||
var retLines = [],
|
||||
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
|
||||
|
||||
|
|
@ -86,4 +91,4 @@ function diffTrimmedLines(oldStr, newStr, callback) {
|
|||
});
|
||||
return lineDiff.diff(oldStr, newStr, options);
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOlsibGluZURpZmYiLCJEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInJldExpbmVzIiwibGluZXNBbmROZXdsaW5l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G5leHBvcnQgZnVuY3Rpb24gZGlmZlRyaW1tZWRMaW5lcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ==
|
||||
|
|
|
|||
258
node_modules/diff/lib/index.es6.js
generated
vendored
258
node_modules/diff/lib/index.es6.js
generated
vendored
|
|
@ -1,6 +1,8 @@
|
|||
function Diff() {}
|
||||
Diff.prototype = {
|
||||
diff: function diff(oldString, newString) {
|
||||
var _options$timeout;
|
||||
|
||||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var callback = options.callback;
|
||||
|
||||
|
|
@ -37,64 +39,96 @@ Diff.prototype = {
|
|||
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
||||
}
|
||||
|
||||
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
|
||||
var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
||||
var bestPath = [{
|
||||
newPos: -1,
|
||||
components: []
|
||||
oldPos: -1,
|
||||
lastComponent: undefined
|
||||
}]; // Seed editLength = 0, i.e. the content starts with the same values
|
||||
|
||||
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
|
||||
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
||||
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
||||
// Identity per the equality and tokenizer
|
||||
return done([{
|
||||
value: this.join(newString),
|
||||
count: newString.length
|
||||
}]);
|
||||
} // Main worker method. checks all permutations of a given edit length for acceptance.
|
||||
} // Once we hit the right edge of the edit graph on some diagonal k, we can
|
||||
// definitely reach the end of the edit graph in no more than k edits, so
|
||||
// there's no point in considering any moves to diagonal k+1 any more (from
|
||||
// which we're guaranteed to need at least k+1 more edits).
|
||||
// Similarly, once we've reached the bottom of the edit graph, there's no
|
||||
// point considering moves to lower diagonals.
|
||||
// We record this fact by setting minDiagonalToConsider and
|
||||
// maxDiagonalToConsider to some finite value once we've hit the edge of
|
||||
// the edit graph.
|
||||
// This optimization is not faithful to the original algorithm presented in
|
||||
// Myers's paper, which instead pointlessly extends D-paths off the end of
|
||||
// the edit graph - see page 7 of Myers's paper which notes this point
|
||||
// explicitly and illustrates it with a diagram. This has major performance
|
||||
// implications for some common scenarios. For instance, to compute a diff
|
||||
// where the new text simply appends d characters on the end of the
|
||||
// original text of length n, the true Myers algorithm will take O(n+d^2)
|
||||
// time while this optimization needs only O(n+d) time.
|
||||
|
||||
|
||||
var minDiagonalToConsider = -Infinity,
|
||||
maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance.
|
||||
|
||||
function execEditLength() {
|
||||
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
||||
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
||||
var basePath = void 0;
|
||||
var removePath = bestPath[diagonalPath - 1],
|
||||
addPath = bestPath[diagonalPath + 1];
|
||||
|
||||
var addPath = bestPath[diagonalPath - 1],
|
||||
removePath = bestPath[diagonalPath + 1],
|
||||
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
||||
|
||||
if (addPath) {
|
||||
if (removePath) {
|
||||
// No one else is going to attempt to use this value, clear it
|
||||
bestPath[diagonalPath - 1] = undefined;
|
||||
}
|
||||
|
||||
var canAdd = addPath && addPath.newPos + 1 < newLen,
|
||||
canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
|
||||
var canAdd = false;
|
||||
|
||||
if (addPath) {
|
||||
// what newPos will be after we do an insertion:
|
||||
var addPathNewPos = addPath.oldPos - diagonalPath;
|
||||
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
||||
}
|
||||
|
||||
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
||||
|
||||
if (!canAdd && !canRemove) {
|
||||
// If this path is a terminal then prune
|
||||
bestPath[diagonalPath] = undefined;
|
||||
continue;
|
||||
} // Select the diagonal that we want to branch from. We select the prior
|
||||
// path whose position in the new string is the farthest from the origin
|
||||
// path whose position in the old string is the farthest from the origin
|
||||
// and does not pass the bounds of the diff graph
|
||||
// TODO: Remove the `+ 1` here to make behavior match Myers algorithm
|
||||
// and prefer to order removals before insertions.
|
||||
|
||||
|
||||
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
||||
basePath = clonePath(removePath);
|
||||
self.pushComponent(basePath.components, undefined, true);
|
||||
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
|
||||
basePath = self.addToPath(addPath, true, undefined, 0);
|
||||
} else {
|
||||
basePath = addPath; // No need to clone, we've pulled it from the list
|
||||
|
||||
basePath.newPos++;
|
||||
self.pushComponent(basePath.components, true, undefined);
|
||||
basePath = self.addToPath(removePath, undefined, true, 1);
|
||||
}
|
||||
|
||||
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
|
||||
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
||||
|
||||
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
||||
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
||||
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
||||
// If we have hit the end of both strings, then we are done
|
||||
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
||||
} else {
|
||||
// Otherwise track this path as a potential candidate and continue.
|
||||
bestPath[diagonalPath] = basePath;
|
||||
|
||||
if (basePath.oldPos + 1 >= oldLen) {
|
||||
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
||||
}
|
||||
|
||||
if (newPos + 1 >= newLen) {
|
||||
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +142,7 @@ Diff.prototype = {
|
|||
if (callback) {
|
||||
(function exec() {
|
||||
setTimeout(function () {
|
||||
if (editLength > maxEditLength) {
|
||||
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +152,7 @@ Diff.prototype = {
|
|||
}, 0);
|
||||
})();
|
||||
} else {
|
||||
while (editLength <= maxEditLength) {
|
||||
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
||||
var ret = execEditLength();
|
||||
|
||||
if (ret) {
|
||||
|
|
@ -127,30 +161,36 @@ Diff.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
pushComponent: function pushComponent(components, added, removed) {
|
||||
var last = components[components.length - 1];
|
||||
addToPath: function addToPath(path, added, removed, oldPosInc) {
|
||||
var last = path.lastComponent;
|
||||
|
||||
if (last && last.added === added && last.removed === removed) {
|
||||
// We need to clone here as the component clone operation is just
|
||||
// as shallow array clone
|
||||
components[components.length - 1] = {
|
||||
count: last.count + 1,
|
||||
added: added,
|
||||
removed: removed
|
||||
return {
|
||||
oldPos: path.oldPos + oldPosInc,
|
||||
lastComponent: {
|
||||
count: last.count + 1,
|
||||
added: added,
|
||||
removed: removed,
|
||||
previousComponent: last.previousComponent
|
||||
}
|
||||
};
|
||||
} else {
|
||||
components.push({
|
||||
count: 1,
|
||||
added: added,
|
||||
removed: removed
|
||||
});
|
||||
return {
|
||||
oldPos: path.oldPos + oldPosInc,
|
||||
lastComponent: {
|
||||
count: 1,
|
||||
added: added,
|
||||
removed: removed,
|
||||
previousComponent: last
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
||||
var newLen = newString.length,
|
||||
oldLen = oldString.length,
|
||||
newPos = basePath.newPos,
|
||||
oldPos = newPos - diagonalPath,
|
||||
oldPos = basePath.oldPos,
|
||||
newPos = oldPos - diagonalPath,
|
||||
commonCount = 0;
|
||||
|
||||
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
||||
|
|
@ -160,13 +200,14 @@ Diff.prototype = {
|
|||
}
|
||||
|
||||
if (commonCount) {
|
||||
basePath.components.push({
|
||||
count: commonCount
|
||||
});
|
||||
basePath.lastComponent = {
|
||||
count: commonCount,
|
||||
previousComponent: basePath.lastComponent
|
||||
};
|
||||
}
|
||||
|
||||
basePath.newPos = newPos;
|
||||
return oldPos;
|
||||
basePath.oldPos = oldPos;
|
||||
return newPos;
|
||||
},
|
||||
equals: function equals(left, right) {
|
||||
if (this.options.comparator) {
|
||||
|
|
@ -197,7 +238,20 @@ Diff.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
||||
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
|
||||
// First we convert our linked list of components in reverse order to an
|
||||
// array in the right order:
|
||||
var components = [];
|
||||
var nextComponent;
|
||||
|
||||
while (lastComponent) {
|
||||
components.push(lastComponent);
|
||||
nextComponent = lastComponent.previousComponent;
|
||||
delete lastComponent.previousComponent;
|
||||
lastComponent = nextComponent;
|
||||
}
|
||||
|
||||
components.reverse();
|
||||
var componentPos = 0,
|
||||
componentLen = components.length,
|
||||
newPos = 0,
|
||||
|
|
@ -240,23 +294,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) {
|
|||
// This is only available for string mode.
|
||||
|
||||
|
||||
var lastComponent = components[componentLen - 1];
|
||||
var finalComponent = components[componentLen - 1];
|
||||
|
||||
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
||||
components[componentLen - 2].value += lastComponent.value;
|
||||
if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) {
|
||||
components[componentLen - 2].value += finalComponent.value;
|
||||
components.pop();
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function clonePath(path) {
|
||||
return {
|
||||
newPos: path.newPos,
|
||||
components: path.components.slice(0)
|
||||
};
|
||||
}
|
||||
|
||||
var characterDiff = new Diff();
|
||||
function diffChars(oldStr, newStr, options) {
|
||||
return characterDiff.diff(oldStr, newStr, options);
|
||||
|
|
@ -337,6 +384,11 @@ function diffWordsWithSpace(oldStr, newStr, options) {
|
|||
var lineDiff = new Diff();
|
||||
|
||||
lineDiff.tokenize = function (value) {
|
||||
if (this.options.stripTrailingCr) {
|
||||
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
|
||||
value = value.replace(/\r\n/g, '\n');
|
||||
}
|
||||
|
||||
var retLines = [],
|
||||
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
|
||||
|
||||
|
|
@ -408,6 +460,55 @@ function _typeof(obj) {
|
|||
return _typeof(obj);
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function ownKeys(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
||||
});
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
function _objectSpread2(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
|
||||
if (i % 2) {
|
||||
ownKeys(Object(source), true).forEach(function (key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
} else if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys(Object(source)).forEach(function (key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function _toConsumableArray(arr) {
|
||||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
||||
}
|
||||
|
|
@ -840,7 +941,7 @@ function applyPatch(source, uniDiff) {
|
|||
var line = _hunk.lines[j],
|
||||
operation = line.length > 0 ? line[0] : ' ',
|
||||
content = line.length > 0 ? line.substr(1) : line,
|
||||
delimiter = _hunk.linedelimiters[j];
|
||||
delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
|
||||
|
||||
if (operation === ' ') {
|
||||
_toPos++;
|
||||
|
|
@ -1047,6 +1148,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
|
|||
};
|
||||
}
|
||||
function formatPatch(diff) {
|
||||
if (Array.isArray(diff)) {
|
||||
return diff.map(formatPatch).join('\n');
|
||||
}
|
||||
|
||||
var ret = [];
|
||||
|
||||
if (diff.oldFileName == diff.newFileName) {
|
||||
|
|
@ -1502,6 +1607,39 @@ function calcOldNewLineCount(lines) {
|
|||
};
|
||||
}
|
||||
|
||||
function reversePatch(structuredPatch) {
|
||||
if (Array.isArray(structuredPatch)) {
|
||||
return structuredPatch.map(reversePatch).reverse();
|
||||
}
|
||||
|
||||
return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
|
||||
oldFileName: structuredPatch.newFileName,
|
||||
oldHeader: structuredPatch.newHeader,
|
||||
newFileName: structuredPatch.oldFileName,
|
||||
newHeader: structuredPatch.oldHeader,
|
||||
hunks: structuredPatch.hunks.map(function (hunk) {
|
||||
return {
|
||||
oldLines: hunk.newLines,
|
||||
oldStart: hunk.newStart,
|
||||
newLines: hunk.oldLines,
|
||||
newStart: hunk.oldStart,
|
||||
linedelimiters: hunk.linedelimiters,
|
||||
lines: hunk.lines.map(function (l) {
|
||||
if (l.startsWith('-')) {
|
||||
return "+".concat(l.slice(1));
|
||||
}
|
||||
|
||||
if (l.startsWith('+')) {
|
||||
return "-".concat(l.slice(1));
|
||||
}
|
||||
|
||||
return l;
|
||||
})
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
||||
function convertChangesToDMP(changes) {
|
||||
var ret = [],
|
||||
|
|
@ -1558,4 +1696,4 @@ function escapeHTML(s) {
|
|||
return n;
|
||||
}
|
||||
|
||||
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, merge, parsePatch, structuredPatch };
|
||||
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, formatPatch, merge, parsePatch, reversePatch, structuredPatch };
|
||||
|
|
|
|||
20
node_modules/diff/lib/index.js
generated
vendored
20
node_modules/diff/lib/index.js
generated
vendored
|
|
@ -94,6 +94,12 @@ Object.defineProperty(exports, "merge", {
|
|||
return _merge.merge;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "reversePatch", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _reverse.reversePatch;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "structuredPatch", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
|
|
@ -112,6 +118,12 @@ Object.defineProperty(exports, "createPatch", {
|
|||
return _create.createPatch;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "formatPatch", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _create.formatPatch;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "convertChangesToDMP", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
|
|
@ -192,6 +204,12 @@ _merge = require("./patch/merge")
|
|||
/*istanbul ignore end*/
|
||||
;
|
||||
|
||||
var
|
||||
/*istanbul ignore start*/
|
||||
_reverse = require("./patch/reverse")
|
||||
/*istanbul ignore end*/
|
||||
;
|
||||
|
||||
var
|
||||
/*istanbul ignore start*/
|
||||
_create = require("./patch/create")
|
||||
|
|
@ -213,4 +231,4 @@ _xml = require("./convert/xml")
|
|||
/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
/*istanbul ignore end*/
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQWdCQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7Q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G4gIGRpZmZDaGFycyxcbiAgZGlmZldvcmRzLFxuICBkaWZmV29yZHNXaXRoU3BhY2UsXG4gIGRpZmZMaW5lcyxcbiAgZGlmZlRyaW1tZWRMaW5lcyxcbiAgZGlmZlNlbnRlbmNlcyxcblxuICBkaWZmQ3NzLFxuICBkaWZmSnNvbixcblxuICBkaWZmQXJyYXlzLFxuXG4gIHN0cnVjdHVyZWRQYXRjaCxcbiAgY3JlYXRlVHdvRmlsZXNQYXRjaCxcbiAgY3JlYXRlUGF0Y2gsXG4gIGZvcm1hdFBhdGNoLFxuICBhcHBseVBhdGNoLFxuICBhcHBseVBhdGNoZXMsXG4gIHBhcnNlUGF0Y2gsXG4gIG1lcmdlLFxuICByZXZlcnNlUGF0Y2gsXG4gIGNvbnZlcnRDaGFuZ2VzVG9ETVAsXG4gIGNvbnZlcnRDaGFuZ2VzVG9YTUwsXG4gIGNhbm9uaWNhbGl6ZVxufTtcbiJdfQ==
|
||||
|
|
|
|||
258
node_modules/diff/lib/index.mjs
generated
vendored
258
node_modules/diff/lib/index.mjs
generated
vendored
|
|
@ -1,6 +1,8 @@
|
|||
function Diff() {}
|
||||
Diff.prototype = {
|
||||
diff: function diff(oldString, newString) {
|
||||
var _options$timeout;
|
||||
|
||||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
var callback = options.callback;
|
||||
|
||||
|
|
@ -37,64 +39,96 @@ Diff.prototype = {
|
|||
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
||||
}
|
||||
|
||||
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
|
||||
var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
||||
var bestPath = [{
|
||||
newPos: -1,
|
||||
components: []
|
||||
oldPos: -1,
|
||||
lastComponent: undefined
|
||||
}]; // Seed editLength = 0, i.e. the content starts with the same values
|
||||
|
||||
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||||
|
||||
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
||||
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
||||
// Identity per the equality and tokenizer
|
||||
return done([{
|
||||
value: this.join(newString),
|
||||
count: newString.length
|
||||
}]);
|
||||
} // Main worker method. checks all permutations of a given edit length for acceptance.
|
||||
} // Once we hit the right edge of the edit graph on some diagonal k, we can
|
||||
// definitely reach the end of the edit graph in no more than k edits, so
|
||||
// there's no point in considering any moves to diagonal k+1 any more (from
|
||||
// which we're guaranteed to need at least k+1 more edits).
|
||||
// Similarly, once we've reached the bottom of the edit graph, there's no
|
||||
// point considering moves to lower diagonals.
|
||||
// We record this fact by setting minDiagonalToConsider and
|
||||
// maxDiagonalToConsider to some finite value once we've hit the edge of
|
||||
// the edit graph.
|
||||
// This optimization is not faithful to the original algorithm presented in
|
||||
// Myers's paper, which instead pointlessly extends D-paths off the end of
|
||||
// the edit graph - see page 7 of Myers's paper which notes this point
|
||||
// explicitly and illustrates it with a diagram. This has major performance
|
||||
// implications for some common scenarios. For instance, to compute a diff
|
||||
// where the new text simply appends d characters on the end of the
|
||||
// original text of length n, the true Myers algorithm will take O(n+d^2)
|
||||
// time while this optimization needs only O(n+d) time.
|
||||
|
||||
|
||||
var minDiagonalToConsider = -Infinity,
|
||||
maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance.
|
||||
|
||||
function execEditLength() {
|
||||
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
||||
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
||||
var basePath = void 0;
|
||||
var removePath = bestPath[diagonalPath - 1],
|
||||
addPath = bestPath[diagonalPath + 1];
|
||||
|
||||
var addPath = bestPath[diagonalPath - 1],
|
||||
removePath = bestPath[diagonalPath + 1],
|
||||
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
||||
|
||||
if (addPath) {
|
||||
if (removePath) {
|
||||
// No one else is going to attempt to use this value, clear it
|
||||
bestPath[diagonalPath - 1] = undefined;
|
||||
}
|
||||
|
||||
var canAdd = addPath && addPath.newPos + 1 < newLen,
|
||||
canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
|
||||
var canAdd = false;
|
||||
|
||||
if (addPath) {
|
||||
// what newPos will be after we do an insertion:
|
||||
var addPathNewPos = addPath.oldPos - diagonalPath;
|
||||
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
||||
}
|
||||
|
||||
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
||||
|
||||
if (!canAdd && !canRemove) {
|
||||
// If this path is a terminal then prune
|
||||
bestPath[diagonalPath] = undefined;
|
||||
continue;
|
||||
} // Select the diagonal that we want to branch from. We select the prior
|
||||
// path whose position in the new string is the farthest from the origin
|
||||
// path whose position in the old string is the farthest from the origin
|
||||
// and does not pass the bounds of the diff graph
|
||||
// TODO: Remove the `+ 1` here to make behavior match Myers algorithm
|
||||
// and prefer to order removals before insertions.
|
||||
|
||||
|
||||
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
||||
basePath = clonePath(removePath);
|
||||
self.pushComponent(basePath.components, undefined, true);
|
||||
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
|
||||
basePath = self.addToPath(addPath, true, undefined, 0);
|
||||
} else {
|
||||
basePath = addPath; // No need to clone, we've pulled it from the list
|
||||
|
||||
basePath.newPos++;
|
||||
self.pushComponent(basePath.components, true, undefined);
|
||||
basePath = self.addToPath(removePath, undefined, true, 1);
|
||||
}
|
||||
|
||||
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
|
||||
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
||||
|
||||
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
||||
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
||||
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
||||
// If we have hit the end of both strings, then we are done
|
||||
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
||||
} else {
|
||||
// Otherwise track this path as a potential candidate and continue.
|
||||
bestPath[diagonalPath] = basePath;
|
||||
|
||||
if (basePath.oldPos + 1 >= oldLen) {
|
||||
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
||||
}
|
||||
|
||||
if (newPos + 1 >= newLen) {
|
||||
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +142,7 @@ Diff.prototype = {
|
|||
if (callback) {
|
||||
(function exec() {
|
||||
setTimeout(function () {
|
||||
if (editLength > maxEditLength) {
|
||||
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +152,7 @@ Diff.prototype = {
|
|||
}, 0);
|
||||
})();
|
||||
} else {
|
||||
while (editLength <= maxEditLength) {
|
||||
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
||||
var ret = execEditLength();
|
||||
|
||||
if (ret) {
|
||||
|
|
@ -127,30 +161,36 @@ Diff.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
pushComponent: function pushComponent(components, added, removed) {
|
||||
var last = components[components.length - 1];
|
||||
addToPath: function addToPath(path, added, removed, oldPosInc) {
|
||||
var last = path.lastComponent;
|
||||
|
||||
if (last && last.added === added && last.removed === removed) {
|
||||
// We need to clone here as the component clone operation is just
|
||||
// as shallow array clone
|
||||
components[components.length - 1] = {
|
||||
count: last.count + 1,
|
||||
added: added,
|
||||
removed: removed
|
||||
return {
|
||||
oldPos: path.oldPos + oldPosInc,
|
||||
lastComponent: {
|
||||
count: last.count + 1,
|
||||
added: added,
|
||||
removed: removed,
|
||||
previousComponent: last.previousComponent
|
||||
}
|
||||
};
|
||||
} else {
|
||||
components.push({
|
||||
count: 1,
|
||||
added: added,
|
||||
removed: removed
|
||||
});
|
||||
return {
|
||||
oldPos: path.oldPos + oldPosInc,
|
||||
lastComponent: {
|
||||
count: 1,
|
||||
added: added,
|
||||
removed: removed,
|
||||
previousComponent: last
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
||||
var newLen = newString.length,
|
||||
oldLen = oldString.length,
|
||||
newPos = basePath.newPos,
|
||||
oldPos = newPos - diagonalPath,
|
||||
oldPos = basePath.oldPos,
|
||||
newPos = oldPos - diagonalPath,
|
||||
commonCount = 0;
|
||||
|
||||
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
||||
|
|
@ -160,13 +200,14 @@ Diff.prototype = {
|
|||
}
|
||||
|
||||
if (commonCount) {
|
||||
basePath.components.push({
|
||||
count: commonCount
|
||||
});
|
||||
basePath.lastComponent = {
|
||||
count: commonCount,
|
||||
previousComponent: basePath.lastComponent
|
||||
};
|
||||
}
|
||||
|
||||
basePath.newPos = newPos;
|
||||
return oldPos;
|
||||
basePath.oldPos = oldPos;
|
||||
return newPos;
|
||||
},
|
||||
equals: function equals(left, right) {
|
||||
if (this.options.comparator) {
|
||||
|
|
@ -197,7 +238,20 @@ Diff.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
||||
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
|
||||
// First we convert our linked list of components in reverse order to an
|
||||
// array in the right order:
|
||||
var components = [];
|
||||
var nextComponent;
|
||||
|
||||
while (lastComponent) {
|
||||
components.push(lastComponent);
|
||||
nextComponent = lastComponent.previousComponent;
|
||||
delete lastComponent.previousComponent;
|
||||
lastComponent = nextComponent;
|
||||
}
|
||||
|
||||
components.reverse();
|
||||
var componentPos = 0,
|
||||
componentLen = components.length,
|
||||
newPos = 0,
|
||||
|
|
@ -240,23 +294,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) {
|
|||
// This is only available for string mode.
|
||||
|
||||
|
||||
var lastComponent = components[componentLen - 1];
|
||||
var finalComponent = components[componentLen - 1];
|
||||
|
||||
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
||||
components[componentLen - 2].value += lastComponent.value;
|
||||
if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) {
|
||||
components[componentLen - 2].value += finalComponent.value;
|
||||
components.pop();
|
||||
}
|
||||
|
||||
return components;
|
||||
}
|
||||
|
||||
function clonePath(path) {
|
||||
return {
|
||||
newPos: path.newPos,
|
||||
components: path.components.slice(0)
|
||||
};
|
||||
}
|
||||
|
||||
var characterDiff = new Diff();
|
||||
function diffChars(oldStr, newStr, options) {
|
||||
return characterDiff.diff(oldStr, newStr, options);
|
||||
|
|
@ -337,6 +384,11 @@ function diffWordsWithSpace(oldStr, newStr, options) {
|
|||
var lineDiff = new Diff();
|
||||
|
||||
lineDiff.tokenize = function (value) {
|
||||
if (this.options.stripTrailingCr) {
|
||||
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
|
||||
value = value.replace(/\r\n/g, '\n');
|
||||
}
|
||||
|
||||
var retLines = [],
|
||||
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
|
||||
|
||||
|
|
@ -408,6 +460,55 @@ function _typeof(obj) {
|
|||
return _typeof(obj);
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function ownKeys(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
||||
});
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
function _objectSpread2(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
|
||||
if (i % 2) {
|
||||
ownKeys(Object(source), true).forEach(function (key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
} else if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys(Object(source)).forEach(function (key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function _toConsumableArray(arr) {
|
||||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
||||
}
|
||||
|
|
@ -840,7 +941,7 @@ function applyPatch(source, uniDiff) {
|
|||
var line = _hunk.lines[j],
|
||||
operation = line.length > 0 ? line[0] : ' ',
|
||||
content = line.length > 0 ? line.substr(1) : line,
|
||||
delimiter = _hunk.linedelimiters[j];
|
||||
delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
|
||||
|
||||
if (operation === ' ') {
|
||||
_toPos++;
|
||||
|
|
@ -1047,6 +1148,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
|
|||
};
|
||||
}
|
||||
function formatPatch(diff) {
|
||||
if (Array.isArray(diff)) {
|
||||
return diff.map(formatPatch).join('\n');
|
||||
}
|
||||
|
||||
var ret = [];
|
||||
|
||||
if (diff.oldFileName == diff.newFileName) {
|
||||
|
|
@ -1502,6 +1607,39 @@ function calcOldNewLineCount(lines) {
|
|||
};
|
||||
}
|
||||
|
||||
function reversePatch(structuredPatch) {
|
||||
if (Array.isArray(structuredPatch)) {
|
||||
return structuredPatch.map(reversePatch).reverse();
|
||||
}
|
||||
|
||||
return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
|
||||
oldFileName: structuredPatch.newFileName,
|
||||
oldHeader: structuredPatch.newHeader,
|
||||
newFileName: structuredPatch.oldFileName,
|
||||
newHeader: structuredPatch.oldHeader,
|
||||
hunks: structuredPatch.hunks.map(function (hunk) {
|
||||
return {
|
||||
oldLines: hunk.newLines,
|
||||
oldStart: hunk.newStart,
|
||||
newLines: hunk.oldLines,
|
||||
newStart: hunk.oldStart,
|
||||
linedelimiters: hunk.linedelimiters,
|
||||
lines: hunk.lines.map(function (l) {
|
||||
if (l.startsWith('-')) {
|
||||
return "+".concat(l.slice(1));
|
||||
}
|
||||
|
||||
if (l.startsWith('+')) {
|
||||
return "-".concat(l.slice(1));
|
||||
}
|
||||
|
||||
return l;
|
||||
})
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
||||
function convertChangesToDMP(changes) {
|
||||
var ret = [],
|
||||
|
|
@ -1558,4 +1696,4 @@ function escapeHTML(s) {
|
|||
return n;
|
||||
}
|
||||
|
||||
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, merge, parsePatch, structuredPatch };
|
||||
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, formatPatch, merge, parsePatch, reversePatch, structuredPatch };
|
||||
|
|
|
|||
4
node_modules/diff/lib/patch/apply.js
generated
vendored
4
node_modules/diff/lib/patch/apply.js
generated
vendored
File diff suppressed because one or more lines are too long
6
node_modules/diff/lib/patch/create.js
generated
vendored
6
node_modules/diff/lib/patch/create.js
generated
vendored
File diff suppressed because one or more lines are too long
63
node_modules/diff/lib/patch/reverse.js
generated
vendored
Normal file
63
node_modules/diff/lib/patch/reverse.js
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*istanbul ignore start*/
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.reversePatch = reversePatch;
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
/*istanbul ignore end*/
|
||||
function reversePatch(structuredPatch) {
|
||||
if (Array.isArray(structuredPatch)) {
|
||||
return structuredPatch.map(reversePatch).reverse();
|
||||
}
|
||||
|
||||
return (
|
||||
/*istanbul ignore start*/
|
||||
_objectSpread(_objectSpread({},
|
||||
/*istanbul ignore end*/
|
||||
structuredPatch), {}, {
|
||||
oldFileName: structuredPatch.newFileName,
|
||||
oldHeader: structuredPatch.newHeader,
|
||||
newFileName: structuredPatch.oldFileName,
|
||||
newHeader: structuredPatch.oldHeader,
|
||||
hunks: structuredPatch.hunks.map(function (hunk) {
|
||||
return {
|
||||
oldLines: hunk.newLines,
|
||||
oldStart: hunk.newStart,
|
||||
newLines: hunk.oldLines,
|
||||
newStart: hunk.oldStart,
|
||||
linedelimiters: hunk.linedelimiters,
|
||||
lines: hunk.lines.map(function (l) {
|
||||
if (l.startsWith('-')) {
|
||||
return (
|
||||
/*istanbul ignore start*/
|
||||
"+".concat(
|
||||
/*istanbul ignore end*/
|
||||
l.slice(1))
|
||||
);
|
||||
}
|
||||
|
||||
if (l.startsWith('+')) {
|
||||
return (
|
||||
/*istanbul ignore start*/
|
||||
"-".concat(
|
||||
/*istanbul ignore end*/
|
||||
l.slice(1))
|
||||
);
|
||||
}
|
||||
|
||||
return l;
|
||||
})
|
||||
};
|
||||
})
|
||||
})
|
||||
);
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9yZXZlcnNlLmpzIl0sIm5hbWVzIjpbInJldmVyc2VQYXRjaCIsInN0cnVjdHVyZWRQYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIsInJldmVyc2UiLCJvbGRGaWxlTmFtZSIsIm5ld0ZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwiaHVua3MiLCJodW5rIiwib2xkTGluZXMiLCJuZXdMaW5lcyIsIm9sZFN0YXJ0IiwibmV3U3RhcnQiLCJsaW5lZGVsaW1pdGVycyIsImxpbmVzIiwibCIsInN0YXJ0c1dpdGgiLCJzbGljZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7O0FBQU8sU0FBU0EsWUFBVCx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ay5vbGRTdGFydCxcbiAgICAgICAgbGluZWRlbGltaXRlcnM6IGh1bmsubGluZWRlbGltaXRlcnMsXG4gICAgICAgIGxpbmVzOiBodW5rLmxpbmVzLm1hcChsID0+IHtcbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCctJykpIHsgcmV0dXJuIGArJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCcrJykpIHsgcmV0dXJuIGAtJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICByZXR1cm4gbDtcbiAgICAgICAgfSlcbiAgICAgIH07XG4gICAgfSlcbiAgfTtcbn1cbiJdfQ==
|
||||
Loading…
Add table
Add a link
Reference in a new issue