1802 lines
174 KiB
JavaScript
Executable File
1802 lines
174 KiB
JavaScript
Executable File
/*!
|
||
|
||
diff v3.3.1
|
||
|
||
Software License Agreement (BSD License)
|
||
|
||
Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
|
||
|
||
All rights reserved.
|
||
|
||
Redistribution and use of this software in source and binary forms, with or without modification,
|
||
are permitted provided that the following conditions are met:
|
||
|
||
* Redistributions of source code must retain the above
|
||
copyright notice, this list of conditions and the
|
||
following disclaimer.
|
||
|
||
* Redistributions in binary form must reproduce the above
|
||
copyright notice, this list of conditions and the
|
||
following disclaimer in the documentation and/or other
|
||
materials provided with the distribution.
|
||
|
||
* Neither the name of Kevin Decker nor the names of its
|
||
contributors may be used to endorse or promote products
|
||
derived from this software without specific prior
|
||
written permission.
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
@license
|
||
*/
|
||
(function webpackUniversalModuleDefinition(root, factory) {
|
||
if(typeof exports === 'object' && typeof module === 'object')
|
||
module.exports = factory();
|
||
else if(typeof define === 'function' && define.amd)
|
||
define([], factory);
|
||
else if(typeof exports === 'object')
|
||
exports["JsDiff"] = factory();
|
||
else
|
||
root["JsDiff"] = factory();
|
||
})(this, function() {
|
||
return /******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId])
|
||
/******/ return installedModules[moduleId].exports;
|
||
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ exports: {},
|
||
/******/ id: moduleId,
|
||
/******/ loaded: false
|
||
/******/ };
|
||
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.loaded = true;
|
||
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
|
||
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(0);
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ([
|
||
/* 0 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
|
||
|
||
/*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
/*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/* See LICENSE file for terms of use */
|
||
|
||
/*
|
||
* Text diff implementation.
|
||
*
|
||
* This library supports the following APIS:
|
||
* JsDiff.diffChars: Character by character diff
|
||
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
||
* JsDiff.diffLines: Line based diff
|
||
*
|
||
* JsDiff.diffCss: Diff targeted at CSS content
|
||
*
|
||
* These methods are based on the implementation proposed in
|
||
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
||
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
||
*/
|
||
exports. /*istanbul ignore end*/Diff = _base2['default'];
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChanges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0Q2hhbmdlc1RvWE1MLFxuICBjYW5vbmljYWxpemVcbn07XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 1 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports['default'] = /*istanbul ignore end*/Diff;
|
||
function Diff() {}
|
||
|
||
Diff.prototype = {
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
|
||
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||
|
||
var callback = options.callback;
|
||
if (typeof options === 'function') {
|
||
callback = options;
|
||
options = {};
|
||
}
|
||
this.options = options;
|
||
|
||
var self = this;
|
||
|
||
function done(value) {
|
||
if (callback) {
|
||
setTimeout(function () {
|
||
callback(undefined, value);
|
||
}, 0);
|
||
return true;
|
||
} else {
|
||
return value;
|
||
}
|
||
}
|
||
|
||
// Allow subclasses to massage the input prior to running
|
||
oldString = this.castInput(oldString);
|
||
newString = this.castInput(newString);
|
||
|
||
oldString = this.removeEmpty(this.tokenize(oldString));
|
||
newString = this.removeEmpty(this.tokenize(newString));
|
||
|
||
var newLen = newString.length,
|
||
oldLen = oldString.length;
|
||
var editLength = 1;
|
||
var maxEditLength = newLen + oldLen;
|
||
var bestPath = [{ newPos: -1, components: [] }];
|
||
|
||
// Seed editLength = 0, i.e. the content starts with the same values
|
||
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
||
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
||
// 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.
|
||
function execEditLength() {
|
||
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
||
var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
||
var addPath = bestPath[diagonalPath - 1],
|
||
removePath = bestPath[diagonalPath + 1],
|
||
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
||
if (addPath) {
|
||
// 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;
|
||
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
|
||
// and does not pass the bounds of the diff graph
|
||
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
||
basePath = clonePath(removePath);
|
||
self.pushComponent(basePath.components, undefined, true);
|
||
} else {
|
||
basePath = addPath; // No need to clone, we've pulled it from the list
|
||
basePath.newPos++;
|
||
self.pushComponent(basePath.components, true, undefined);
|
||
}
|
||
|
||
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
||
|
||
// If we have hit the end of both strings, then we are done
|
||
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
||
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
||
} else {
|
||
// Otherwise track this path as a potential candidate and continue.
|
||
bestPath[diagonalPath] = basePath;
|
||
}
|
||
}
|
||
|
||
editLength++;
|
||
}
|
||
|
||
// Performs the length of edit iteration. Is a bit fugly as this has to support the
|
||
// sync and async mode which is never fun. Loops over execEditLength until a value
|
||
// is produced.
|
||
if (callback) {
|
||
(function exec() {
|
||
setTimeout(function () {
|
||
// This should not happen, but we want to be safe.
|
||
/* istanbul ignore next */
|
||
if (editLength > maxEditLength) {
|
||
return callback();
|
||
}
|
||
|
||
if (!execEditLength()) {
|
||
exec();
|
||
}
|
||
}, 0);
|
||
})();
|
||
} else {
|
||
while (editLength <= maxEditLength) {
|
||
var ret = execEditLength();
|
||
if (ret) {
|
||
return ret;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
|
||
var last = components[components.length - 1];
|
||
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 };
|
||
} else {
|
||
components.push({ count: 1, added: added, removed: removed });
|
||
}
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
||
var newLen = newString.length,
|
||
oldLen = oldString.length,
|
||
newPos = basePath.newPos,
|
||
oldPos = newPos - diagonalPath,
|
||
commonCount = 0;
|
||
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
||
newPos++;
|
||
oldPos++;
|
||
commonCount++;
|
||
}
|
||
|
||
if (commonCount) {
|
||
basePath.components.push({ count: commonCount });
|
||
}
|
||
|
||
basePath.newPos = newPos;
|
||
return oldPos;
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
|
||
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
|
||
var ret = [];
|
||
for (var i = 0; i < array.length; i++) {
|
||
if (array[i]) {
|
||
ret.push(array[i]);
|
||
}
|
||
}
|
||
return ret;
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
|
||
return value;
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
|
||
return value.split('');
|
||
},
|
||
/*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
|
||
return chars.join('');
|
||
}
|
||
};
|
||
|
||
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
||
var componentPos = 0,
|
||
componentLen = components.length,
|
||
newPos = 0,
|
||
oldPos = 0;
|
||
|
||
for (; componentPos < componentLen; componentPos++) {
|
||
var component = components[componentPos];
|
||
if (!component.removed) {
|
||
if (!component.added && useLongestToken) {
|
||
var value = newString.slice(newPos, newPos + component.count);
|
||
value = value.map(function (value, i) {
|
||
var oldValue = oldString[oldPos + i];
|
||
return oldValue.length > value.length ? oldValue : value;
|
||
});
|
||
|
||
component.value = diff.join(value);
|
||
} else {
|
||
component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
||
}
|
||
newPos += component.count;
|
||
|
||
// Common case
|
||
if (!component.added) {
|
||
oldPos += component.count;
|
||
}
|
||
} else {
|
||
component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
||
oldPos += component.count;
|
||
|
||
// Reverse add and remove so removes are output first to match common convention
|
||
// The diffing algorithm is tied to add then remove output and this is the simplest
|
||
// route to get the desired output with minimal overhead.
|
||
if (componentPos && components[componentPos - 1].added) {
|
||
var tmp = components[componentPos - 1];
|
||
components[componentPos - 1] = components[componentPos];
|
||
components[componentPos] = tmp;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Special case handle for when one terminal is ignored. For this case we merge the
|
||
// terminal into the prior string and drop the change.
|
||
var lastComponent = components[componentLen - 1];
|
||
if (componentLen > 1 && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
||
components[componentLen - 2].value += lastComponent.value;
|
||
components.pop();
|
||
}
|
||
|
||
return components;
|
||
}
|
||
|
||
function clonePath(path) {
|
||
return { newPos: path.newPos, components: path.components.slice(0) };
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOlsiRGlmZiIsInByb3RvdHlwZSIsImRpZmYiLCJvbGRTdHJpbmciLCJuZXdTdHJpbmciLCJvcHRpb25zIiwiY2FsbGJhY2siLC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
||
/* 2 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.characterDiff = undefined;
|
||
exports. /*istanbul ignore end*/diffChars = diffChars;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
function diffChars(oldStr, newStr, options) {
|
||
return characterDiff.diff(oldStr, newStr, options);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6WyJkaWZmQ2hhcnMiLCJjaGFyYWN0ZXJEaWZmIiwib2xkU3RyIiwibmV3U3RyIiwib3B0aW9ucyIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBR2dCQSxTLEdBQUFBLFM7O0FBSGhCOzs7Ozs7dUJBRU8sSUFBTUMseUZBQWdCLHdFQUF0QjtBQUNBLFNBQVNELFNBQVQsQ0FBbUJFLE1BQW5CLEVBQTJCQyxNQUEzQixFQUFtQ0MsT0FBbkMsRUFBNEM7QUFBRSxTQUFPSCxjQUFjSSxJQUFkLENBQW1CSCxNQUFuQixFQUEyQkMsTUFBM0IsRUFBbUNDLE9BQW5DLENBQVA7QUFBcUQiLCJmaWxlIjoiY2hhcmFjdGVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IERpZmYgZnJvbSAnLi9iYXNlJztcblxuZXhwb3J0IGNvbnN0IGNoYXJhY3RlckRpZmYgPSBuZXcgRGlmZigpO1xuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDaGFycyhvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykgeyByZXR1cm4gY2hhcmFjdGVyRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTsgfVxuIl19
|
||
|
||
|
||
/***/ }),
|
||
/* 3 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.wordDiff = undefined;
|
||
exports. /*istanbul ignore end*/diffWords = diffWords;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
/*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
|
||
//
|
||
// Ranges and exceptions:
|
||
// Latin-1 Supplement, 0080–00FF
|
||
// - U+00D7 × Multiplication sign
|
||
// - U+00F7 ÷ Division sign
|
||
// Latin Extended-A, 0100–017F
|
||
// Latin Extended-B, 0180–024F
|
||
// IPA Extensions, 0250–02AF
|
||
// Spacing Modifier Letters, 02B0–02FF
|
||
// - U+02C7 ˇ ˇ Caron
|
||
// - U+02D8 ˘ ˘ Breve
|
||
// - U+02D9 ˙ ˙ Dot Above
|
||
// - U+02DA ˚ ˚ Ring Above
|
||
// - U+02DB ˛ ˛ Ogonek
|
||
// - U+02DC ˜ ˜ Small Tilde
|
||
// - U+02DD ˝ ˝ Double Acute Accent
|
||
// Latin Extended Additional, 1E00–1EFF
|
||
var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
|
||
|
||
var reWhitespace = /\S/;
|
||
|
||
var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
wordDiff.equals = function (left, right) {
|
||
if (this.options.ignoreCase) {
|
||
left = left.toLowerCase();
|
||
right = right.toLowerCase();
|
||
}
|
||
return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
|
||
};
|
||
wordDiff.tokenize = function (value) {
|
||
var tokens = value.split(/(\s+|\b)/);
|
||
|
||
// Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
|
||
for (var i = 0; i < tokens.length - 1; i++) {
|
||
// If we have an empty string in the next field and we have only word chars before and after, merge
|
||
if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
|
||
tokens[i] += tokens[i + 2];
|
||
tokens.splice(i + 1, 2);
|
||
i--;
|
||
}
|
||
}
|
||
|
||
return tokens;
|
||
};
|
||
|
||
function diffWords(oldStr, newStr, options) {
|
||
options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
|
||
return wordDiff.diff(oldStr, newStr, options);
|
||
}
|
||
|
||
function diffWordsWithSpace(oldStr, newStr, options) {
|
||
return wordDiff.diff(oldStr, newStr, options);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOlsiZGlmZldvcmRzIiwiZGlmZldvcmRzV2l0aFNwYWNlIiwiZXh0ZW5kZWRXb3JkQ2hhcnMiLCJyZVdoaXRlc3BhY2UiLCJ3b3JkRGlmZiIsImVxdWFscyIsImxlZnQiLCJyaWdodCIsIm9wdGlvbnMiLC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nMudGVzdCh0b2tlbnNbaV0pXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaSArIDJdKSkge1xuICAgICAgdG9rZW5zW2ldICs9IHRva2Vuc1tpICsgMl07XG4gICAgICB0b2tlbnMuc3BsaWNlKGkgKyAxLCAyKTtcbiAgICAgIGktLTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gdG9rZW5zO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3JkcyhvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykge1xuICBvcHRpb25zID0gZ2VuZXJhdGVPcHRpb25zKG9wdGlvbnMsIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiB3b3JkRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3Jkc1dpdGhTcGFjZShvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykge1xuICByZXR1cm4gd29yZERpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucyk7XG59XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 4 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/generateOptions = generateOptions;
|
||
function generateOptions(options, defaults) {
|
||
if (typeof options === 'function') {
|
||
defaults.callback = options;
|
||
} else if (options) {
|
||
for (var name in options) {
|
||
/* istanbul ignore else */
|
||
if (options.hasOwnProperty(name)) {
|
||
defaults[name] = options[name];
|
||
}
|
||
}
|
||
}
|
||
return defaults;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6WyJnZW5lcm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4gZGVmYXVsdHM7XG59XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 5 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.lineDiff = undefined;
|
||
exports. /*istanbul ignore end*/diffLines = diffLines;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
/*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
lineDiff.tokenize = function (value) {
|
||
var retLines = [],
|
||
linesAndNewlines = value.split(/(\n|\r\n)/);
|
||
|
||
// Ignore the final empty token that occurs if the string ends with a new line
|
||
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
||
linesAndNewlines.pop();
|
||
}
|
||
|
||
// Merge the content and line separators into single tokens
|
||
for (var i = 0; i < linesAndNewlines.length; i++) {
|
||
var line = linesAndNewlines[i];
|
||
|
||
if (i % 2 && !this.options.newlineIsToken) {
|
||
retLines[retLines.length - 1] += line;
|
||
} else {
|
||
if (this.options.ignoreWhitespace) {
|
||
line = line.trim();
|
||
}
|
||
retLines.push(line);
|
||
}
|
||
}
|
||
|
||
return retLines;
|
||
};
|
||
|
||
function diffLines(oldStr, newStr, callback) {
|
||
return lineDiff.diff(oldStr, newStr, callback);
|
||
}
|
||
function diffTrimmedLines(oldStr, newStr, callback) {
|
||
var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
|
||
return lineDiff.diff(oldStr, newStr, options);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOlsiZGlmZkxpbmVzIiwiZGlmZlRyaW1tZWRMaW5lcyIsImxpbmVEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInJldExpbmVzIiwibGluZXNBbmROZXdsaW5lcyIsInNwbGl0IiwibGVuZ3RoIiwicG9wIiwiaSIsImxpbmUiLCJvcHRpb25zIiwibmV3bGluZUlzVG9rZW4iLCJpZ25vcmVXaGl0ZXNwYWNlIiwidHJpbSIsInB1c2giLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBOEJnQkEsUyxHQUFBQSxTO3lEQUNBQyxnQixHQUFBQSxnQjs7QUEvQmhCOzs7O3VCQUNBOzs7O3VCQUVPLElBQU1DLCtFQUFXLHdFQUFqQjtBQUNQQSxTQUFTQyxRQUFULEdBQW9CLFVBQVNDLEtBQVQsRUFBZ0I7QUFDbEMsTUFBSUMsV0FBVyxFQUFmO0FBQUEsTUFDSUMsbUJBQW1CRixNQUFNRyxLQUFOLENBQVksV0FBWixDQUR2Qjs7QUFHQTtBQUNBLE1BQUksQ0FBQ0QsaUJBQWlCQSxpQkFBaUJFLE1BQWpCLEdBQTBCLENBQTNDLENBQUwsRUFBb0Q7QUFDbERGLHFCQUFpQkcsR0FBakI7QUFDRDs7QUFFRDtBQUNBLE9BQUssSUFBSUMsSUFBSSxDQUFiLEVBQWdCQSxJQUFJSixpQkFBaUJFLE1BQXJDLEVBQTZDRSxHQUE3QyxFQUFrRDtBQUNoRCxRQUFJQyxPQUFPTCxpQkFBaUJJLENBQWpCLENBQVg7O0FBRUEsUUFBSUEsSUFBSSxDQUFKLElBQV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MgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ==
|
||
|
||
|
||
/***/ }),
|
||
/* 6 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.sentenceDiff = undefined;
|
||
exports. /*istanbul ignore end*/diffSentences = diffSentences;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
sentenceDiff.tokenize = function (value) {
|
||
return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
||
};
|
||
|
||
function diffSentences(oldStr, newStr, callback) {
|
||
return sentenceDiff.diff(oldStr, newStr, callback);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbImRpZmZTZW50ZW5jZXMiLCJzZW50ZW5jZURpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic3BsaXQiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBUWdCQSxhLEdBQUFBLGE7O0FBUmhCOzs7Ozs7dUJBR08sSUFBTUMsdUZBQWUsd0VBQXJCO0FBQ1BBLGFBQWFDLFFBQWIsR0FBd0IsVUFBU0MsS0FBVCxFQUFnQjtBQUN0QyxTQUFPQSxNQUFNQyxLQUFOLENBQVksdUJBQVosQ0FBUDtBQUNELENBRkQ7O0FBSU8sU0FBU0osYUFBVCxDQUF1QkssTUFBdkIsRUFBK0JDLE1BQS9CLEVBQXVDQyxRQUF2QyxFQUFpRDtBQUFFLFNBQU9OLGFBQWFPLElBQWIsQ0FBa0JILE1BQWxCLEVBQTBCQyxNQUExQixFQUFrQ0MsUUFBbEMsQ0FBUDtBQUFxRCIsImZpbGUiOiJzZW50ZW5jZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cblxuZXhwb3J0IGNvbnN0IHNlbnRlbmNlRGlmZiA9IG5ldyBEaWZmKCk7XG5zZW50ZW5jZURpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhcXFMuKz9bLiE/XSkoPz1cXHMrfCQpLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZlNlbnRlbmNlcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIHNlbnRlbmNlRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdfQ==
|
||
|
||
|
||
/***/ }),
|
||
/* 7 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.cssDiff = undefined;
|
||
exports. /*istanbul ignore end*/diffCss = diffCss;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
cssDiff.tokenize = function (value) {
|
||
return value.split(/([{}:;,]|\s+)/);
|
||
};
|
||
|
||
function diffCss(oldStr, newStr, callback) {
|
||
return cssDiff.diff(oldStr, newStr, callback);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6WyJkaWZmQ3NzIiwiY3NzRGlmZiIsInRva2VuaXplIiwidmFsdWUiLCJzcGxpdCIsIm9sZFN0ciIsIm5ld1N0ciIsImNhbGxiYWNrIiwiZGlmZiJdLCJtYXBwaW5ncyI6Ijs7OztnQ0FPZ0JBLE8sR0FBQUEsTzs7QUFQaEI7Ozs7Ozt1QkFFTyxJQUFNQyw2RUFBVSx3RUFBaEI7QUFDUEEsUUFBUUMsUUFBUixHQUFtQixVQUFTQyxLQUFULEVBQWdCO0FBQ2pDLFNBQU9BLE1BQU1DLEtBQU4sQ0FBWSxlQUFaLENBQVA7QUFDRCxDQUZEOztBQUlPLFNBQVNKLE9BQVQsQ0FBaUJLLE1BQWpCLEVBQXlCQyxNQUF6QixFQUFpQ0MsUUFBakMsRUFBMkM7QUFBRSxTQUFPTixRQUFRTyxJQUFSLENBQWFILE1BQWIsRUFBcUJDLE1BQXJCLEVBQTZCQyxRQUE3QixDQUFQO0FBQWdEIiwiZmlsZSI6ImNzcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjc3NEaWZmID0gbmV3IERpZmYoKTtcbmNzc0RpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhbe306OyxdfFxccyspLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkNzcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIGNzc0RpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 8 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.jsonDiff = undefined;
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||
|
||
exports. /*istanbul ignore end*/diffJson = diffJson;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
/*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
|
||
|
||
var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
|
||
// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
|
||
jsonDiff.useLongestToken = true;
|
||
|
||
jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
|
||
jsonDiff.castInput = function (value) {
|
||
/*istanbul ignore start*/var /*istanbul ignore end*/undefinedReplacement = this.options.undefinedReplacement;
|
||
|
||
|
||
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), function (k, v) {
|
||
if (typeof v === 'undefined') {
|
||
return undefinedReplacement;
|
||
}
|
||
|
||
return v;
|
||
}, ' ');
|
||
};
|
||
jsonDiff.equals = function (left, right) {
|
||
return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
|
||
);
|
||
};
|
||
|
||
function diffJson(oldObj, newObj, options) {
|
||
return jsonDiff.diff(oldObj, newObj, options);
|
||
}
|
||
|
||
// This function handles the presence of circular references by bailing out when encountering an
|
||
// object that is already on the "stack" of items being processed.
|
||
function canonicalize(obj, stack, replacementStack) {
|
||
stack = stack || [];
|
||
replacementStack = replacementStack || [];
|
||
|
||
var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
||
|
||
for (i = 0; i < stack.length; i += 1) {
|
||
if (stack[i] === obj) {
|
||
return replacementStack[i];
|
||
}
|
||
}
|
||
|
||
var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
||
|
||
if ('[object Array]' === objectPrototypeToString.call(obj)) {
|
||
stack.push(obj);
|
||
canonicalizedObj = new Array(obj.length);
|
||
replacementStack.push(canonicalizedObj);
|
||
for (i = 0; i < obj.length; i += 1) {
|
||
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
|
||
}
|
||
stack.pop();
|
||
replacementStack.pop();
|
||
return canonicalizedObj;
|
||
}
|
||
|
||
if (obj && obj.toJSON) {
|
||
obj = obj.toJSON();
|
||
}
|
||
|
||
if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
|
||
stack.push(obj);
|
||
canonicalizedObj = {};
|
||
replacementStack.push(canonicalizedObj);
|
||
var sortedKeys = [],
|
||
key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
||
for (key in obj) {
|
||
/* istanbul ignore else */
|
||
if (obj.hasOwnProperty(key)) {
|
||
sortedKeys.push(key);
|
||
}
|
||
}
|
||
sortedKeys.sort();
|
||
for (i = 0; i < sortedKeys.length; i += 1) {
|
||
key = sortedKeys[i];
|
||
canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
|
||
}
|
||
stack.pop();
|
||
replacementStack.pop();
|
||
} else {
|
||
canonicalizedObj = obj;
|
||
}
|
||
return canonicalizedObj;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOlsiZGlmZkpzb24iLCJjYW5vbmljYWxpemUiLCJvYmplY3RQcm90b3R5cGVUb1N0cmluZyIsIk9iamVjdCIsInByb3RvdHlwZSIsInRvU3RyaW5nIiwianNvbkRpZmYiLCJ1c2VMb25nZXN0VG9rZW4iLCJ0b2tlbml6ZSIsImNhc3RJbnB1dCIsInZhbHVlIiwidW5kZWZpbmVkUmVwbGFjZW1lbnQiLCJvcHRpb25zIiwiSlNPTiIsInN0cmluZ2lmeSIsImsiLCJ2IiwiZXF1YWxzIiwibGVmdCIsInJpZ2h0IiwiY2FsbCIsInJlcGxhY2UiLCJvbGRPYmoiLCJuZXdPYmoiLCJkaWZmIiwib2JqIiwic3RhY2siLCJyZXBsYWNlbWVudFN0YWNrIiwiaSIsImxlbmd0aCIsImNhbm9uaWNhbGl6ZWRPYmoiLCJwdXNoIiwiQXJyYXkiLCJwb3AiLCJ0b0pTT04iLCJzb3J0ZWRLZXlzIiwia2V5IiwiaGFzT3duUHJvcGVydHkiLCJzb3J0Il0sIm1hcHBpbmdzIjoiOzs7Ozs7O2dDQTJCZ0JBLFEsR0FBQUEsUTt5REFJQUMsWSxHQUFBQSxZOztBQS9CaEI7Ozs7dUJBQ0E7Ozs7dUJBRUEsSUFBTUMsMEJBQTBCQyxPQUFPQyxTQUFQLENBQWlCQyxRQUFqRDs7QUFHTyxJ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xuICAgIHN0YWNrLnBvcCgpO1xuICAgIHJlcGxhY2VtZW50U3RhY2sucG9wKCk7XG4gICAgcmV0dXJuIGNhbm9uaWNhbGl6ZWRPYmo7XG4gIH1cblxuICBpZiAob2JqICYmIG9iai50b0pTT04pIHtcbiAgICBvYmogPSBvYmoudG9KU09OKCk7XG4gIH1cblxuICBpZiAodHlwZW9mIG9iaiA9PT0gJ29iamVjdCcgJiYgb2JqICE9PSBudWxsKSB7XG4gICAgc3RhY2sucHVzaChvYmopO1xuICAgIGNhbm9uaWNhbGl6ZWRPYmogPSB7fTtcbiAgICByZXBsYWNlbWVudFN0YWNrLnB1c2goY2Fub25pY2FsaXplZE9iaik7XG4gICAgbGV0IHNvcnRlZEtleXMgPSBbXSxcbiAgICAgICAga2V5O1xuICAgIGZvciAoa2V5IGluIG9iaikge1xuICAgICAgLyogaXN0YW5idWwgaWdub3JlIGVsc2UgKi9cbiAgICAgIGlmIChvYmouaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICBzb3J0ZWRLZXlzLnB1c2goa2V5KTtcbiAgICAgIH1cbiAgICB9XG4gICAgc29ydGVkS2V5cy5zb3J0KCk7XG4gICAgZm9yIChpID0gMDsgaSA8IHNvcnRlZEtleXMubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgIGtleSA9IHNvcnRlZEtleXNbaV07XG4gICAgICBjYW5vbmljYWxpemVkT2JqW2tleV0gPSBjYW5vbmljYWxpemUob2JqW2tleV0sIHN0YWNrLCByZXBsYWNlbWVudFN0YWNrKTtcbiAgICB9XG4gICAgc3RhY2sucG9wKCk7XG4gICAgcmVwbGFjZW1lbnRTdGFjay5wb3AoKTtcbiAgfSBlbHNlIHtcbiAgICBjYW5vbmljYWxpemVkT2JqID0gb2JqO1xuICB9XG4gIHJldHVybiBjYW5vbmljYWxpemVkT2JqO1xufVxuIl19
|
||
|
||
|
||
/***/ }),
|
||
/* 9 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports.arrayDiff = undefined;
|
||
exports. /*istanbul ignore end*/diffArrays = diffArrays;
|
||
|
||
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
||
arrayDiff.tokenize = arrayDiff.join = function (value) {
|
||
return value.slice();
|
||
};
|
||
|
||
function diffArrays(oldArr, newArr, callback) {
|
||
return arrayDiff.diff(oldArr, newArr, callback);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2FycmF5LmpzIl0sIm5hbWVzIjpbImRpZmZBcnJheXMiLCJhcnJheURpZmYiLCJ0b2tlbml6ZSIsImpvaW4iLCJ2YWx1ZSIsInNsaWNlIiwib2xkQXJyIiwibmV3QXJyIiwiY2FsbGJhY2siLCJkaWZmIl0sIm1hcHBpbmdzIjoiOzs7O2dDQU9nQkEsVSxHQUFBQSxVOztBQVBoQjs7Ozs7O3VCQUVPLElBQU1DLGlGQUFZLHdFQUFsQjtBQUNQQSxVQUFVQyxRQUFWLEdBQXFCRCxVQUFVRSxJQUFWLEdBQWlCLFVBQVNDLEtBQVQsRUFBZ0I7QUFDcEQsU0FBT0EsTUFBTUMsS0FBTixFQUFQO0FBQ0QsQ0FGRDs7QUFJTyxTQUFTTCxVQUFULENBQW9CTSxNQUFwQixFQUE0QkMsTUFBNUIsRUFBb0NDLFFBQXBDLEVBQThDO0FBQUUsU0FBT1AsVUFBVVEsSUFBVixDQUFlSCxNQUFmLEVBQXVCQyxNQUF2QixFQUErQkMsUUFBL0IsQ0FBUDtBQUFrRCIsImZpbGUiOiJhcnJheS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBhcnJheURpZmYgPSBuZXcgRGlmZigpO1xuYXJyYXlEaWZmLnRva2VuaXplID0gYXJyYXlEaWZmLmpvaW4gPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc2xpY2UoKTtcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBkaWZmQXJyYXlzKG9sZEFyciwgbmV3QXJyLCBjYWxsYmFjaykgeyByZXR1cm4gYXJyYXlEaWZmLmRpZmYob2xkQXJyLCBuZXdBcnIsIGNhbGxiYWNrKTsgfVxuIl19
|
||
|
||
|
||
/***/ }),
|
||
/* 10 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/applyPatch = applyPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
|
||
|
||
var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||
|
||
/*istanbul ignore end*/function applyPatch(source, uniDiff) {
|
||
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||
|
||
if (typeof uniDiff === 'string') {
|
||
uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
|
||
}
|
||
|
||
if (Array.isArray(uniDiff)) {
|
||
if (uniDiff.length > 1) {
|
||
throw new Error('applyPatch only works with a single input.');
|
||
}
|
||
|
||
uniDiff = uniDiff[0];
|
||
}
|
||
|
||
// Apply the diff to the input
|
||
var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
|
||
delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
|
||
hunks = uniDiff.hunks,
|
||
compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
|
||
return (/*istanbul ignore end*/line === patchContent
|
||
);
|
||
},
|
||
errorCount = 0,
|
||
fuzzFactor = options.fuzzFactor || 0,
|
||
minLine = 0,
|
||
offset = 0,
|
||
removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
|
||
addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
||
|
||
/**
|
||
* Checks if the hunk exactly fits on the provided location
|
||
*/
|
||
function hunkFits(hunk, toPos) {
|
||
for (var j = 0; j < hunk.lines.length; j++) {
|
||
var line = hunk.lines[j],
|
||
operation = line[0],
|
||
content = line.substr(1);
|
||
|
||
if (operation === ' ' || operation === '-') {
|
||
// Context sanity check
|
||
if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
|
||
errorCount++;
|
||
|
||
if (errorCount > fuzzFactor) {
|
||
return false;
|
||
}
|
||
}
|
||
toPos++;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
// Search best fit offsets for each hunk based on the previous ones
|
||
for (var i = 0; i < hunks.length; i++) {
|
||
var hunk = hunks[i],
|
||
maxLine = lines.length - hunk.oldLines,
|
||
localOffset = 0,
|
||
toPos = offset + hunk.oldStart - 1;
|
||
|
||
var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
|
||
|
||
for (; localOffset !== undefined; localOffset = iterator()) {
|
||
if (hunkFits(hunk, toPos + localOffset)) {
|
||
hunk.offset = offset += localOffset;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (localOffset === undefined) {
|
||
return false;
|
||
}
|
||
|
||
// Set lower text limit to end of the current hunk, so next ones don't try
|
||
// to fit over already patched text
|
||
minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
|
||
}
|
||
|
||
// Apply patch hunks
|
||
var diffOffset = 0;
|
||
for (var _i = 0; _i < hunks.length; _i++) {
|
||
var _hunk = hunks[_i],
|
||
_toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
|
||
diffOffset += _hunk.newLines - _hunk.oldLines;
|
||
|
||
if (_toPos < 0) {
|
||
// Creating a new file
|
||
_toPos = 0;
|
||
}
|
||
|
||
for (var j = 0; j < _hunk.lines.length; j++) {
|
||
var line = _hunk.lines[j],
|
||
operation = line[0],
|
||
content = line.substr(1),
|
||
delimiter = _hunk.linedelimiters[j];
|
||
|
||
if (operation === ' ') {
|
||
_toPos++;
|
||
} else if (operation === '-') {
|
||
lines.splice(_toPos, 1);
|
||
delimiters.splice(_toPos, 1);
|
||
/* istanbul ignore else */
|
||
} else if (operation === '+') {
|
||
lines.splice(_toPos, 0, content);
|
||
delimiters.splice(_toPos, 0, delimiter);
|
||
_toPos++;
|
||
} else if (operation === '\\') {
|
||
var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
|
||
if (previousOperation === '+') {
|
||
removeEOFNL = true;
|
||
} else if (previousOperation === '-') {
|
||
addEOFNL = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Handle EOFNL insertion/removal
|
||
if (removeEOFNL) {
|
||
while (!lines[lines.length - 1]) {
|
||
lines.pop();
|
||
delimiters.pop();
|
||
}
|
||
} else if (addEOFNL) {
|
||
lines.push('');
|
||
delimiters.push('\n');
|
||
}
|
||
for (var _k = 0; _k < lines.length - 1; _k++) {
|
||
lines[_k] = lines[_k] + delimiters[_k];
|
||
}
|
||
return lines.join('');
|
||
}
|
||
|
||
// Wrapper that supports multiple file patches via callbacks.
|
||
function applyPatches(uniDiff, options) {
|
||
if (typeof uniDiff === 'string') {
|
||
uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
|
||
}
|
||
|
||
var currentIndex = 0;
|
||
function processIndex() {
|
||
var index = uniDiff[currentIndex++];
|
||
if (!index) {
|
||
return options.complete();
|
||
}
|
||
|
||
options.loadFile(index, function (err, data) {
|
||
if (err) {
|
||
return options.complete(err);
|
||
}
|
||
|
||
var updatedContent = applyPatch(data, index, options);
|
||
options.patched(index, updatedContent, function (err) {
|
||
if (err) {
|
||
return options.complete(err);
|
||
}
|
||
|
||
processIndex();
|
||
});
|
||
});
|
||
}
|
||
processIndex();
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwiYXBwbHlQYXRjaGVzIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJBcnJheSIsImlzQXJyYXkiLCJsZW5ndGgiLCJFcnJvciIsImxpbmVzIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJodW5rcyIsImNvbXBhcmVMaW5lIiwibGluZU51bWJlciIsImxpbmUiLCJvcGVyYXRpb24iLCJwYXRjaENvbnRlbnQiLCJlcnJvckNvdW50IiwiZnV6ekZhY3RvciIsIm1pbkxpbmUiLCJvZmZzZXQiLCJyZW1vdmVFT0ZOTCIsImFkZEVPRk5MIiwiaHVua0ZpdHMiLCJodW5rIiwidG9Qb3MiLCJqIiwiY29udGVudCIsInN1YnN0ciIsImkiLCJtYXhMaW5lIiwib2xkTGluZXMiLCJsb2NhbE9mZnNldCIsIm9sZFN0YXJ0IiwiaXRlcmF0b3IiLCJ1bmRlZmluZWQiLCJkaWZmT2Zmc2V0IiwibmV3TGluZXMiLCJkZWxpbWl0ZXIiLCJsaW5lZGVsaW1pdGVycyIsInNwbGljZSIsInByZXZpb3VzT3BlcmF0aW9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3VwcG9ydHMgbXVsdGlwbGUgZmlsZSBwYXRjaGVzIHZpYSBjYWxsYmFja3MuXG5leHBvcnQgZnVuY3Rpb24gYXBwbHlQYXRjaGVzKHVuaURpZmYsIG9wdGlvbnMpIHtcbiAgaWYgKHR5cGVvZiB1bmlEaWZmID09PSAnc3RyaW5nJykge1xuICAgIHVuaURpZmYgPSBwYXJzZVBhdGNoKHVuaURpZmYpO1xuICB9XG5cbiAgbGV0IGN1cnJlbnRJbmRleCA9IDA7XG4gIGZ1bmN0aW9uIHByb2Nlc3NJbmRleCgpIHtcbiAgICBsZXQgaW5kZXggPSB1bmlEaWZmW2N1cnJlbnRJbmRleCsrXTtcbiAgICBpZiAoIWluZGV4KSB7XG4gICAgICByZXR1cm4gb3B0aW9ucy5jb21wbGV0ZSgpO1xuICAgIH1cblxuICAgIG9wdGlvbnMubG9hZEZpbGUoaW5kZXgsIGZ1bmN0aW9uKGVyciwgZGF0YSkge1xuICAgICAgaWYgKGVycikge1xuICAgICAgICByZXR1cm4gb3B0aW9ucy5jb21wbGV0ZShlcnIpO1xuICAgICAgfVxuXG4gICAgICBsZXQgdXBkYXRlZENvbnRlbnQgPSBhcHBseVBhdGNoKGRhdGEsIGluZGV4LCBvcHRpb25zKTtcbiAgICAgIG9wdGlvbnMucGF0Y2hlZChpbmRleCwgdXBkYXRlZENvbnRlbnQsIGZ1bmN0aW9uKGVycikge1xuICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgcmV0dXJuIG9wdGlvbnMuY29tcGxldGUoZXJyKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHByb2Nlc3NJbmRleCgpO1xuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cbiAgcHJvY2Vzc0luZGV4KCk7XG59XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 11 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/parsePatch = parsePatch;
|
||
function parsePatch(uniDiff) {
|
||
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
|
||
var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
|
||
delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
|
||
list = [],
|
||
i = 0;
|
||
|
||
function parseIndex() {
|
||
var index = {};
|
||
list.push(index);
|
||
|
||
// Parse diff metadata
|
||
while (i < diffstr.length) {
|
||
var line = diffstr[i];
|
||
|
||
// File header found, end parsing diff metadata
|
||
if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
|
||
break;
|
||
}
|
||
|
||
// Diff index
|
||
var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
|
||
if (header) {
|
||
index.index = header[1];
|
||
}
|
||
|
||
i++;
|
||
}
|
||
|
||
// Parse file headers if they are defined. Unified diff requires them, but
|
||
// there's no technical issues to have an isolated hunk without file header
|
||
parseFileHeader(index);
|
||
parseFileHeader(index);
|
||
|
||
// Parse hunks
|
||
index.hunks = [];
|
||
|
||
while (i < diffstr.length) {
|
||
var _line = diffstr[i];
|
||
|
||
if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
|
||
break;
|
||
} else if (/^@@/.test(_line)) {
|
||
index.hunks.push(parseHunk());
|
||
} else if (_line && options.strict) {
|
||
// Ignore unexpected content unless in strict mode
|
||
throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
|
||
} else {
|
||
i++;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Parses the --- and +++ headers, if none are found, no lines
|
||
// are consumed.
|
||
function parseFileHeader(index) {
|
||
var headerPattern = /^(---|\+\+\+)\s+([\S ]*)(?:\t(.*?)\s*)?$/;
|
||
var fileHeader = headerPattern.exec(diffstr[i]);
|
||
if (fileHeader) {
|
||
var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
|
||
var fileName = fileHeader[2].replace(/\\\\/g, '\\');
|
||
if (/^".*"$/.test(fileName)) {
|
||
fileName = fileName.substr(1, fileName.length - 2);
|
||
}
|
||
index[keyPrefix + 'FileName'] = fileName;
|
||
index[keyPrefix + 'Header'] = fileHeader[3];
|
||
|
||
i++;
|
||
}
|
||
}
|
||
|
||
// Parses a hunk
|
||
// This assumes that we are at the start of a hunk.
|
||
function parseHunk() {
|
||
var chunkHeaderIndex = i,
|
||
chunkHeaderLine = diffstr[i++],
|
||
chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
||
|
||
var hunk = {
|
||
oldStart: +chunkHeader[1],
|
||
oldLines: +chunkHeader[2] || 1,
|
||
newStart: +chunkHeader[3],
|
||
newLines: +chunkHeader[4] || 1,
|
||
lines: [],
|
||
linedelimiters: []
|
||
};
|
||
|
||
var addCount = 0,
|
||
removeCount = 0;
|
||
for (; i < diffstr.length; i++) {
|
||
// Lines starting with '---' could be mistaken for the "remove line" operation
|
||
// But they could be the header for the next file. Therefore prune such cases out.
|
||
if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
|
||
break;
|
||
}
|
||
var operation = diffstr[i][0];
|
||
|
||
if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
|
||
hunk.lines.push(diffstr[i]);
|
||
hunk.linedelimiters.push(delimiters[i] || '\n');
|
||
|
||
if (operation === '+') {
|
||
addCount++;
|
||
} else if (operation === '-') {
|
||
removeCount++;
|
||
} else if (operation === ' ') {
|
||
addCount++;
|
||
removeCount++;
|
||
}
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
|
||
// Handle the empty block count case
|
||
if (!addCount && hunk.newLines === 1) {
|
||
hunk.newLines = 0;
|
||
}
|
||
if (!removeCount && hunk.oldLines === 1) {
|
||
hunk.oldLines = 0;
|
||
}
|
||
|
||
// Perform optional sanity checking
|
||
if (options.strict) {
|
||
if (addCount !== hunk.newLines) {
|
||
throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
|
||
}
|
||
if (removeCount !== hunk.oldLines) {
|
||
throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
|
||
}
|
||
}
|
||
|
||
return hunk;
|
||
}
|
||
|
||
while (i < diffstr.length) {
|
||
parseIndex();
|
||
}
|
||
|
||
return list;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6WyJwYXJzZVBhdGNoIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJkaWZmc3RyIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJsaXN0IiwiaSIsInBhcnNlSW5kZXgiLCJpbmRleCIsInB1c2giLCJsZW5ndGgiLCJsaW5lIiwidGVzdCIsImhlYWRlciIsImV4ZWMiLCJwYXJzZUZpbGVIZWFkZXIiLCJodW5rcyIsInBhcnNlSHVuayIsInN0cmljdCIsIkVycm9yIiwiSlNPTiIsInN0cmluZ2lmeSIsImhlYWRlclBhdHRlcm4iLCJmaWxlSGVhZGVyIiwia2V5UHJlZml4IiwiZmlsZU5hbWUiLCJyZXBsYWNlIiwic3Vic3RyIiwiY2h1bmtIZWFkZXJJbmRleCIsImNodW5rSGVhZGVyTGluZSIsImNodW5rSGVhZGVyIiwiaHVuayIsIm9sZFN0YXJ0Iiwib2xkTGluZXMiLCJuZXdTdGFydCIsIm5ld0xpbmVzIiwibGluZXMiLCJsaW5lZGVsaW1pdGVycyIsImFkZENvdW50IiwicmVtb3ZlQ291bnQiLCJpbmRleE9mIiwib3BlcmF0aW9uIl0sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCQSxVLEdBQUFBLFU7QUFBVCxTQUFTQSxVQUFULENBQW9CQyx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luZXMucHVzaChkaWZmc3RyW2ldKTtcbiAgICAgICAgaHVuay5saW5lZGVsaW1pdGVycy5wdXNoKGRlbGltaXRlcnNbaV0gfHwgJ1xcbicpO1xuXG4gICAgICAgIGlmIChvcGVyYXRpb24gPT09ICcrJykge1xuICAgICAgICAgIGFkZENvdW50Kys7XG4gICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnLScpIHtcbiAgICAgICAgICByZW1vdmVDb3VudCsrO1xuICAgICAgICB9IGVsc2UgaWYgKG9wZXJhdGlvbiA9PT0gJyAnKSB7XG4gICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgICByZW1vdmVDb3VudCsrO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9XG5cbiAgICAvLyBIYW5kbGUgdGhlIGVtcHR5IGJsb2NrIGNvdW50IGNhc2VcbiAgICBpZiAoIWFkZENvdW50ICYmIGh1bmsubmV3TGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsubmV3TGluZXMgPSAwO1xuICAgIH1cbiAgICBpZiAoIXJlbW92ZUNvdW50ICYmIGh1bmsub2xkTGluZXMgPT09IDEpIHtcbiAgICAgIGh1bmsub2xkTGluZXMgPSAwO1xuICAgIH1cblxuICAgIC8vIFBlcmZvcm0gb3B0aW9uYWwgc2FuaXR5IGNoZWNraW5nXG4gICAgaWYgKG9wdGlvbnMuc3RyaWN0KSB7XG4gICAgICBpZiAoYWRkQ291bnQgIT09IGh1bmsubmV3TGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdBZGRlZCBsaW5lIGNvdW50IGRpZCBub3QgbWF0Y2ggZm9yIGh1bmsgYXQgbGluZSAnICsgKGNodW5rSGVhZGVySW5kZXggKyAxKSk7XG4gICAgICB9XG4gICAgICBpZiAocmVtb3ZlQ291bnQgIT09IGh1bmsub2xkTGluZXMpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdSZW1vdmVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gaHVuaztcbiAgfVxuXG4gIHdoaWxlIChpIDwgZGlmZnN0ci5sZW5ndGgpIHtcbiAgICBwYXJzZUluZGV4KCk7XG4gIH1cblxuICByZXR1cm4gbGlzdDtcbn1cbiJdfQ==
|
||
|
||
|
||
/***/ }),
|
||
/* 12 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/"use strict";
|
||
|
||
exports.__esModule = true;
|
||
|
||
exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
|
||
var wantForward = true,
|
||
backwardExhausted = false,
|
||
forwardExhausted = false,
|
||
localOffset = 1;
|
||
|
||
return function iterator() {
|
||
if (wantForward && !forwardExhausted) {
|
||
if (backwardExhausted) {
|
||
localOffset++;
|
||
} else {
|
||
wantForward = false;
|
||
}
|
||
|
||
// Check if trying to fit beyond text length, and if not, check it fits
|
||
// after offset location (or desired location on first iteration)
|
||
if (start + localOffset <= maxLine) {
|
||
return localOffset;
|
||
}
|
||
|
||
forwardExhausted = true;
|
||
}
|
||
|
||
if (!backwardExhausted) {
|
||
if (!forwardExhausted) {
|
||
wantForward = true;
|
||
}
|
||
|
||
// Check if trying to fit before text beginning, and if not, check it fits
|
||
// before offset location
|
||
if (minLine <= start - localOffset) {
|
||
return -localOffset++;
|
||
}
|
||
|
||
backwardExhausted = true;
|
||
return iterator();
|
||
}
|
||
|
||
// We tried to fit hunk before text beginning and beyond text length, then
|
||
// hunk can't fit on the text. Return undefined
|
||
};
|
||
};
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhdG9yLmpzIl0sIm5hbWVz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4gICAgaWYgKCFiYWNrd2FyZEV4aGF1c3RlZCkge1xuICAgICAgaWYgKCFmb3J3YXJkRXhoYXVzdGVkKSB7XG4gICAgICAgIHdhbnRGb3J3YXJkID0gdHJ1ZTtcbiAgICAgIH1cblxuICAgICAgLy8gQ2hlY2sgaWYgdHJ5aW5nIHRvIGZpdCBiZWZvcmUgdGV4dCBiZWdpbm5pbmcsIGFuZCBpZiBub3QsIGNoZWNrIGl0IGZpdHNcbiAgICAgIC8vIGJlZm9yZSBvZmZzZXQgbG9jYXRpb25cbiAgICAgIGlmIChtaW5MaW5lIDw9IHN0YXJ0IC0gbG9jYWxPZmZzZXQpIHtcbiAgICAgICAgcmV0dXJuIC1sb2NhbE9mZnNldCsrO1xuICAgICAgfVxuXG4gICAgICBiYWNrd2FyZEV4aGF1c3RlZCA9IHRydWU7XG4gICAgICByZXR1cm4gaXRlcmF0b3IoKTtcbiAgICB9XG5cbiAgICAvLyBXZSB0cmllZCB0byBmaXQgaHVuayBiZWZvcmUgdGV4dCBiZWdpbm5pbmcgYW5kIGJleW9uZCB0ZXh0IGxlbmd0aCwgdGhlblxuICAgIC8vIGh1bmsgY2FuJ3QgZml0IG9uIHRoZSB0ZXh0LiBSZXR1cm4gdW5kZWZpbmVkXG4gIH07XG59XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 13 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
|
||
|
||
var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
|
||
|
||
var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||
|
||
/*istanbul ignore end*/function calcLineCount(hunk) {
|
||
var conflicted = false;
|
||
|
||
hunk.oldLines = 0;
|
||
hunk.newLines = 0;
|
||
|
||
hunk.lines.forEach(function (line) {
|
||
if (typeof line !== 'string') {
|
||
conflicted = true;
|
||
return;
|
||
}
|
||
|
||
if (line[0] === '+' || line[0] === ' ') {
|
||
hunk.newLines++;
|
||
}
|
||
if (line[0] === '-' || line[0] === ' ') {
|
||
hunk.oldLines++;
|
||
}
|
||
});
|
||
|
||
if (conflicted) {
|
||
delete hunk.oldLines;
|
||
delete hunk.newLines;
|
||
}
|
||
}
|
||
|
||
function merge(mine, theirs, base) {
|
||
mine = loadPatch(mine, base);
|
||
theirs = loadPatch(theirs, base);
|
||
|
||
var ret = {};
|
||
|
||
// For index we just let it pass through as it doesn't have any necessary meaning.
|
||
// Leaving sanity checks on this to the API consumer that may know more about the
|
||
// meaning in their own context.
|
||
if (mine.index || theirs.index) {
|
||
ret.index = mine.index || theirs.index;
|
||
}
|
||
|
||
if (mine.newFileName || theirs.newFileName) {
|
||
if (!fileNameChanged(mine)) {
|
||
// No header or no change in ours, use theirs (and ours if theirs does not exist)
|
||
ret.oldFileName = theirs.oldFileName || mine.oldFileName;
|
||
ret.newFileName = theirs.newFileName || mine.newFileName;
|
||
ret.oldHeader = theirs.oldHeader || mine.oldHeader;
|
||
ret.newHeader = theirs.newHeader || mine.newHeader;
|
||
} else if (!fileNameChanged(theirs)) {
|
||
// No header or no change in theirs, use ours
|
||
ret.oldFileName = mine.oldFileName;
|
||
ret.newFileName = mine.newFileName;
|
||
ret.oldHeader = mine.oldHeader;
|
||
ret.newHeader = mine.newHeader;
|
||
} else {
|
||
// Both changed... figure it out
|
||
ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
|
||
ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
|
||
ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
|
||
ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
|
||
}
|
||
}
|
||
|
||
ret.hunks = [];
|
||
|
||
var mineIndex = 0,
|
||
theirsIndex = 0,
|
||
mineOffset = 0,
|
||
theirsOffset = 0;
|
||
|
||
while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
|
||
var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
|
||
theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
|
||
|
||
if (hunkBefore(mineCurrent, theirsCurrent)) {
|
||
// This patch does not overlap with any of the others, yay.
|
||
ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
|
||
mineIndex++;
|
||
theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
|
||
} else if (hunkBefore(theirsCurrent, mineCurrent)) {
|
||
// This patch does not overlap with any of the others, yay.
|
||
ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
|
||
theirsIndex++;
|
||
mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
|
||
} else {
|
||
// Overlap, merge as best we can
|
||
var mergedHunk = {
|
||
oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
|
||
oldLines: 0,
|
||
newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
|
||
newLines: 0,
|
||
lines: []
|
||
};
|
||
mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
|
||
theirsIndex++;
|
||
mineIndex++;
|
||
|
||
ret.hunks.push(mergedHunk);
|
||
}
|
||
}
|
||
|
||
return ret;
|
||
}
|
||
|
||
function loadPatch(param, base) {
|
||
if (typeof param === 'string') {
|
||
if (/^@@/m.test(param) || /^Index:/m.test(param)) {
|
||
return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
|
||
);
|
||
}
|
||
|
||
if (!base) {
|
||
throw new Error('Must provide a base reference or pass in a patch');
|
||
}
|
||
return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
|
||
);
|
||
}
|
||
|
||
return param;
|
||
}
|
||
|
||
function fileNameChanged(patch) {
|
||
return patch.newFileName && patch.newFileName !== patch.oldFileName;
|
||
}
|
||
|
||
function selectField(index, mine, theirs) {
|
||
if (mine === theirs) {
|
||
return mine;
|
||
} else {
|
||
index.conflict = true;
|
||
return { mine: mine, theirs: theirs };
|
||
}
|
||
}
|
||
|
||
function hunkBefore(test, check) {
|
||
return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
|
||
}
|
||
|
||
function cloneHunk(hunk, offset) {
|
||
return {
|
||
oldStart: hunk.oldStart, oldLines: hunk.oldLines,
|
||
newStart: hunk.newStart + offset, newLines: hunk.newLines,
|
||
lines: hunk.lines
|
||
};
|
||
}
|
||
|
||
function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
|
||
// This will generally result in a conflicted hunk, but there are cases where the context
|
||
// is the only overlap where we can successfully merge the content here.
|
||
var mine = { offset: mineOffset, lines: mineLines, index: 0 },
|
||
their = { offset: theirOffset, lines: theirLines, index: 0 };
|
||
|
||
// Handle any leading content
|
||
insertLeading(hunk, mine, their);
|
||
insertLeading(hunk, their, mine);
|
||
|
||
// Now in the overlap content. Scan through and select the best changes from each.
|
||
while (mine.index < mine.lines.length && their.index < their.lines.length) {
|
||
var mineCurrent = mine.lines[mine.index],
|
||
theirCurrent = their.lines[their.index];
|
||
|
||
if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
|
||
// Both modified ...
|
||
mutualChange(hunk, mine, their);
|
||
} else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
|
||
/*istanbul ignore start*/var _hunk$lines;
|
||
|
||
/*istanbul ignore end*/ // Mine inserted
|
||
/*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
|
||
} else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
|
||
/*istanbul ignore start*/var _hunk$lines2;
|
||
|
||
/*istanbul ignore end*/ // Theirs inserted
|
||
/*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
|
||
} else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
|
||
// Mine removed or edited
|
||
removal(hunk, mine, their);
|
||
} else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
|
||
// Their removed or edited
|
||
removal(hunk, their, mine, true);
|
||
} else if (mineCurrent === theirCurrent) {
|
||
// Context identity
|
||
hunk.lines.push(mineCurrent);
|
||
mine.index++;
|
||
their.index++;
|
||
} else {
|
||
// Context mismatch
|
||
conflict(hunk, collectChange(mine), collectChange(their));
|
||
}
|
||
}
|
||
|
||
// Now push anything that may be remaining
|
||
insertTrailing(hunk, mine);
|
||
insertTrailing(hunk, their);
|
||
|
||
calcLineCount(hunk);
|
||
}
|
||
|
||
function mutualChange(hunk, mine, their) {
|
||
var myChanges = collectChange(mine),
|
||
theirChanges = collectChange(their);
|
||
|
||
if (allRemoves(myChanges) && allRemoves(theirChanges)) {
|
||
// Special case for remove changes that are supersets of one another
|
||
if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
|
||
/*istanbul ignore start*/var _hunk$lines3;
|
||
|
||
/*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
|
||
return;
|
||
} else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
|
||
/*istanbul ignore start*/var _hunk$lines4;
|
||
|
||
/*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
|
||
return;
|
||
}
|
||
} else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
|
||
/*istanbul ignore start*/var _hunk$lines5;
|
||
|
||
/*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
|
||
return;
|
||
}
|
||
|
||
conflict(hunk, myChanges, theirChanges);
|
||
}
|
||
|
||
function removal(hunk, mine, their, swap) {
|
||
var myChanges = collectChange(mine),
|
||
theirChanges = collectContext(their, myChanges);
|
||
if (theirChanges.merged) {
|
||
/*istanbul ignore start*/var _hunk$lines6;
|
||
|
||
/*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
|
||
} else {
|
||
conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
|
||
}
|
||
}
|
||
|
||
function conflict(hunk, mine, their) {
|
||
hunk.conflict = true;
|
||
hunk.lines.push({
|
||
conflict: true,
|
||
mine: mine,
|
||
theirs: their
|
||
});
|
||
}
|
||
|
||
function insertLeading(hunk, insert, their) {
|
||
while (insert.offset < their.offset && insert.index < insert.lines.length) {
|
||
var line = insert.lines[insert.index++];
|
||
hunk.lines.push(line);
|
||
insert.offset++;
|
||
}
|
||
}
|
||
function insertTrailing(hunk, insert) {
|
||
while (insert.index < insert.lines.length) {
|
||
var line = insert.lines[insert.index++];
|
||
hunk.lines.push(line);
|
||
}
|
||
}
|
||
|
||
function collectChange(state) {
|
||
var ret = [],
|
||
operation = state.lines[state.index][0];
|
||
while (state.index < state.lines.length) {
|
||
var line = state.lines[state.index];
|
||
|
||
// Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
|
||
if (operation === '-' && line[0] === '+') {
|
||
operation = '+';
|
||
}
|
||
|
||
if (operation === line[0]) {
|
||
ret.push(line);
|
||
state.index++;
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
|
||
return ret;
|
||
}
|
||
function collectContext(state, matchChanges) {
|
||
var changes = [],
|
||
merged = [],
|
||
matchIndex = 0,
|
||
contextChanges = false,
|
||
conflicted = false;
|
||
while (matchIndex < matchChanges.length && state.index < state.lines.length) {
|
||
var change = state.lines[state.index],
|
||
match = matchChanges[matchIndex];
|
||
|
||
// Once we've hit our add, then we are done
|
||
if (match[0] === '+') {
|
||
break;
|
||
}
|
||
|
||
contextChanges = contextChanges || change[0] !== ' ';
|
||
|
||
merged.push(match);
|
||
matchIndex++;
|
||
|
||
// Consume any additions in the other block as a conflict to attempt
|
||
// to pull in the remaining context after this
|
||
if (change[0] === '+') {
|
||
conflicted = true;
|
||
|
||
while (change[0] === '+') {
|
||
changes.push(change);
|
||
change = state.lines[++state.index];
|
||
}
|
||
}
|
||
|
||
if (match.substr(1) === change.substr(1)) {
|
||
changes.push(change);
|
||
state.index++;
|
||
} else {
|
||
conflicted = true;
|
||
}
|
||
}
|
||
|
||
if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
|
||
conflicted = true;
|
||
}
|
||
|
||
if (conflicted) {
|
||
return changes;
|
||
}
|
||
|
||
while (matchIndex < matchChanges.length) {
|
||
merged.push(matchChanges[matchIndex++]);
|
||
}
|
||
|
||
return {
|
||
merged: merged,
|
||
changes: changes
|
||
};
|
||
}
|
||
|
||
function allRemoves(changes) {
|
||
return changes.reduce(function (prev, change) {
|
||
return prev && change[0] === '-';
|
||
}, true);
|
||
}
|
||
function skipRemoveSuperset(state, removeChanges, delta) {
|
||
for (var i = 0; i < delta; i++) {
|
||
var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
|
||
if (state.lines[state.index + i] !== ' ' + changeContent) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
state.index += delta;
|
||
return true;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9tZXJnZS5qcyJdLCJuYW1lcyI6WyJjYWxjTGluZUNvdW50IiwibWVyZ2UiLCJodW5rIiwiY29uZmxpY3RlZCIsIm9sZExpbmVzIiwibmV3TGluZXMiLCJsaW5lcyIsImZvckVhY2giLCJsaW5lIiwibWluZSIsInRoZWlycyIsImJhc2UiLCJsb2FkUGF0Y2giLCJyZXQiLCJpbmRleCIsIm5ld0ZpbGVOYW1lIiwiZmlsZU5hbWVDaGFuZ2VkIiwib2xkRmlsZU5hbWUiLCJvbGRIZWFkZXIiLCJuZXdIZWFkZXIiLCJzZWxlY3RGaWVsZCIsImh1bmtzIiwibWluZUluZGV4IiwidGhlaXJzSW5kZXgiLCJtaW5lT2Zmc2V0IiwidGhlaXJzT2Zmc2V0IiwibGVuZ3RoIiwibWluZUN1cnJlbnQiLCJvbGRTdGFydCIsIkluZmluaX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ZmxpY3RlZCA9IHRydWU7XG4gIH1cblxuICBpZiAoY29uZmxpY3RlZCkge1xuICAgIHJldHVybiBjaGFuZ2VzO1xuICB9XG5cbiAgd2hpbGUgKG1hdGNoSW5kZXggPCBtYXRjaENoYW5nZXMubGVuZ3RoKSB7XG4gICAgbWVyZ2VkLnB1c2gobWF0Y2hDaGFuZ2VzW21hdGNoSW5kZXgrK10pO1xuICB9XG5cbiAgcmV0dXJuIHtcbiAgICBtZXJnZWQsXG4gICAgY2hhbmdlc1xuICB9O1xufVxuXG5mdW5jdGlvbiBhbGxSZW1vdmVzKGNoYW5nZXMpIHtcbiAgcmV0dXJuIGNoYW5nZXMucmVkdWNlKGZ1bmN0aW9uKHByZXYsIGNoYW5nZSkge1xuICAgIHJldHVybiBwcmV2ICYmIGNoYW5nZVswXSA9PT0gJy0nO1xuICB9LCB0cnVlKTtcbn1cbmZ1bmN0aW9uIHNraXBSZW1vdmVTdXBlcnNldChzdGF0ZSwgcmVtb3ZlQ2hhbmdlcywgZGVsdGEpIHtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBkZWx0YTsgaSsrKSB7XG4gICAgbGV0IGNoYW5nZUNvbnRlbnQgPSByZW1vdmVDaGFuZ2VzW3JlbW92ZUNoYW5nZXMubGVuZ3RoIC0gZGVsdGEgKyBpXS5zdWJzdHIoMSk7XG4gICAgaWYgKHN0YXRlLmxpbmVzW3N0YXRlLmluZGV4ICsgaV0gIT09ICcgJyArIGNoYW5nZUNvbnRlbnQpIHtcbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gIH1cblxuICBzdGF0ZS5pbmRleCArPSBkZWx0YTtcbiAgcmV0dXJuIHRydWU7XG59XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 14 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
|
||
|
||
var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
||
|
||
/*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
||
|
||
/*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
||
if (!options) {
|
||
options = {};
|
||
}
|
||
if (typeof options.context === 'undefined') {
|
||
options.context = 4;
|
||
}
|
||
|
||
var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
|
||
diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
|
||
|
||
function contextLines(lines) {
|
||
return lines.map(function (entry) {
|
||
return ' ' + entry;
|
||
});
|
||
}
|
||
|
||
var hunks = [];
|
||
var oldRangeStart = 0,
|
||
newRangeStart = 0,
|
||
curRange = [],
|
||
oldLine = 1,
|
||
newLine = 1;
|
||
|
||
/*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
|
||
var current = diff[i],
|
||
lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
||
current.lines = lines;
|
||
|
||
if (current.added || current.removed) {
|
||
/*istanbul ignore start*/var _curRange;
|
||
|
||
/*istanbul ignore end*/ // If we have previous context, start with that
|
||
if (!oldRangeStart) {
|
||
var prev = diff[i - 1];
|
||
oldRangeStart = oldLine;
|
||
newRangeStart = newLine;
|
||
|
||
if (prev) {
|
||
curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
|
||
oldRangeStart -= curRange.length;
|
||
newRangeStart -= curRange.length;
|
||
}
|
||
}
|
||
|
||
// Output our changes
|
||
/*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
|
||
return (current.added ? '+' : '-') + entry;
|
||
})));
|
||
|
||
// Track the updated file position
|
||
if (current.added) {
|
||
newLine += lines.length;
|
||
} else {
|
||
oldLine += lines.length;
|
||
}
|
||
} else {
|
||
// Identical context lines. Track line changes
|
||
if (oldRangeStart) {
|
||
// Close out any changes that have been output (or join overlapping)
|
||
if (lines.length <= options.context * 2 && i < diff.length - 2) {
|
||
/*istanbul ignore start*/var _curRange2;
|
||
|
||
/*istanbul ignore end*/ // Overlapping
|
||
/*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
|
||
} else {
|
||
/*istanbul ignore start*/var _curRange3;
|
||
|
||
/*istanbul ignore end*/ // end the range and output
|
||
var contextSize = Math.min(lines.length, options.context);
|
||
/*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
|
||
|
||
var hunk = {
|
||
oldStart: oldRangeStart,
|
||
oldLines: oldLine - oldRangeStart + contextSize,
|
||
newStart: newRangeStart,
|
||
newLines: newLine - newRangeStart + contextSize,
|
||
lines: curRange
|
||
};
|
||
if (i >= diff.length - 2 && lines.length <= options.context) {
|
||
// EOF is inside this hunk
|
||
var oldEOFNewline = /\n$/.test(oldStr);
|
||
var newEOFNewline = /\n$/.test(newStr);
|
||
if (lines.length == 0 && !oldEOFNewline) {
|
||
// special case: old has no eol and no trailing context; no-nl can end up before adds
|
||
curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
|
||
} else if (!oldEOFNewline || !newEOFNewline) {
|
||
curRange.push('\\ No newline at end of file');
|
||
}
|
||
}
|
||
hunks.push(hunk);
|
||
|
||
oldRangeStart = 0;
|
||
newRangeStart = 0;
|
||
curRange = [];
|
||
}
|
||
}
|
||
oldLine += lines.length;
|
||
newLine += lines.length;
|
||
}
|
||
};
|
||
|
||
for (var i = 0; i < diff.length; i++) {
|
||
/*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
|
||
}
|
||
|
||
return {
|
||
oldFileName: oldFileName, newFileName: newFileName,
|
||
oldHeader: oldHeader, newHeader: newHeader,
|
||
hunks: hunks
|
||
};
|
||
}
|
||
|
||
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
||
var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
|
||
|
||
var ret = [];
|
||
if (oldFileName == newFileName) {
|
||
ret.push('Index: ' + oldFileName);
|
||
}
|
||
ret.push('===================================================================');
|
||
ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
|
||
ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
|
||
|
||
for (var i = 0; i < diff.hunks.length; i++) {
|
||
var hunk = diff.hunks[i];
|
||
ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
|
||
ret.push.apply(ret, hunk.lines);
|
||
}
|
||
|
||
return ret.join('\n') + '\n';
|
||
}
|
||
|
||
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
|
||
return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYX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J0ICsgJywnICsgaHVuay5uZXdMaW5lc1xuICAgICAgKyAnIEBAJ1xuICAgICk7XG4gICAgcmV0LnB1c2guYXBwbHkocmV0LCBodW5rLmxpbmVzKTtcbiAgfVxuXG4gIHJldHVybiByZXQuam9pbignXFxuJykgKyAnXFxuJztcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGNyZWF0ZVBhdGNoKGZpbGVOYW1lLCBvbGRTdHIsIG5ld1N0ciwgb2xkSGVhZGVyLCBuZXdIZWFkZXIsIG9wdGlvbnMpIHtcbiAgcmV0dXJuIGNyZWF0ZVR3b0ZpbGVzUGF0Y2goZmlsZU5hbWUsIGZpbGVOYW1lLCBvbGRTdHIsIG5ld1N0ciwgb2xkSGVhZGVyLCBuZXdIZWFkZXIsIG9wdGlvbnMpO1xufVxuIl19
|
||
|
||
|
||
/***/ }),
|
||
/* 15 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/"use strict";
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
|
||
/*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
|
||
function arrayEqual(a, b) {
|
||
if (a.length !== b.length) {
|
||
return false;
|
||
}
|
||
|
||
return arrayStartsWith(a, b);
|
||
}
|
||
|
||
function arrayStartsWith(array, start) {
|
||
if (start.length > array.length) {
|
||
return false;
|
||
}
|
||
|
||
for (var i = 0; i < start.length; i++) {
|
||
if (start[i] !== array[i]) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
return true;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2FycmF5LmpzIl0sIm5hbWVzIjpbImFycmF5RXF1YWwiLCJhcnJheVN0YXJ0c1dpdGgiLCJhIiwiYiIsImxlbmd0aCIsImFycmF5Iiwic3RhcnQiLCJpIl0sIm1hcHBpbmdzIj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cnQubGVuZ3RoOyBpKyspIHtcbiAgICBpZiAoc3RhcnRbaV0gIT09IGFycmF5W2ldKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIHRydWU7XG59XG4iXX0=
|
||
|
||
|
||
/***/ }),
|
||
/* 16 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/"use strict";
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
|
||
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
||
function convertChangesToDMP(changes) {
|
||
var ret = [],
|
||
change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
|
||
operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
||
for (var i = 0; i < changes.length; i++) {
|
||
change = changes[i];
|
||
if (change.added) {
|
||
operation = 1;
|
||
} else if (change.removed) {
|
||
operation = -1;
|
||
} else {
|
||
operation = 0;
|
||
}
|
||
|
||
ret.push([operation, change.value]);
|
||
}
|
||
return ret;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L2RtcC5qcyJdLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvRE1QIiwiY2hhbmdlcyIsInJldCIsImNoYW5nZSIsIm9wZXJhdGlvbiIsImkiLCJsZW5ndGgiLCJhZGRlZCIsInJlbW92ZWQiLCJwdXNoIiwidmFsdWUiXSwibWFwcGluZ3MiOiI7OztnQ0FDZ0JBLG1CLEdBQUFBLG1CO0FBRGhCO0FBQ08sU0FBU0EsbUJBQVQsQ0FBNkJDLE9BQTdCLEVBQXNDO0FBQzNDLE1BQUlDLE1BQU0sRUFBVjtBQUFBLE1BQ0lDLHdDQURKO0FBQUEsTUFFSUMsMkNBRko7QUFHQSxPQUFLLElBQUlDLElBQUksQ0FBYixFQU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/* 17 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/*istanbul ignore start*/'use strict';
|
||
|
||
exports.__esModule = true;
|
||
exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
|
||
function convertChangesToXML(changes) {
|
||
var ret = [];
|
||
for (var i = 0; i < changes.length; i++) {
|
||
var change = changes[i];
|
||
if (change.added) {
|
||
ret.push('<ins>');
|
||
} else if (change.removed) {
|
||
ret.push('<del>');
|
||
}
|
||
|
||
ret.push(escapeHTML(change.value));
|
||
|
||
if (change.added) {
|
||
ret.push('</ins>');
|
||
} else if (change.removed) {
|
||
ret.push('</del>');
|
||
}
|
||
}
|
||
return ret.join('');
|
||
}
|
||
|
||
function escapeHTML(s) {
|
||
var n = s;
|
||
n = n.replace(/&/g, '&');
|
||
n = n.replace(/</g, '<');
|
||
n = n.replace(/>/g, '>');
|
||
n = n.replace(/"/g, '"');
|
||
|
||
return n;
|
||
}
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2hhbmdlcyIsInJldCIsImkiLCJsZW5ndGgiLCJjaGFuZ2UiLCJhZGRlZCIsInB1c2giLCJyZW1vdmVkIiwiZXNjYXBlSFRNTCIsInZhbHVlIiwiam9pbiIsInMiLCJuIiwicmVwbGFjZSJdLCJtYXBwaW5ncyI6Ijs7O2dDQUFnQkEsbUIsR0FBQUEsbUI7QUFBVCxTQUFTQSxtQkFBVCxDQUE2QkMsT0FBN0IsRUFBc0M7QUFDM0MsTUFBSUMsTUFBTSxFQUFWO0FBQ0EsT0FBSyxJQUFJQyxJQUFJLENBQWIsRUFBZ0JBLElBQUlGLFFBQVFHLE1BQTVCLEVBQW9DRCxHQUFwQyxFQUF5QztBQUN2QyxRQUFJRSxTQUFTSixRQUFRRSxDQUFSLENBQWI7QU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