2017-05-28 00:38:50 +02:00
|
|
|
|
/*!
|
|
|
|
|
|
2018-09-20 02:56:13 +02:00
|
|
|
|
diff v3.5.0
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
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;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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*/;
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 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
|
|
|
|
|
*/
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJEaWZmIiwiZGlmZkNoYXJzIiwiZGlmZldvcmRzIiwiZGlmZldvcmRzV2l0aFNwYWNlIiwiZGlmZkxpbmVzIiwiZGlmZlRyaW1tZWRMaW5lcyIsImRpZmZTZW50ZW5jZXMiLCJkaWZmQ3NzIiwiZGlmZkpzb24iLCJkaWZmQXJyYXlzIiwic3RydWN0dXJlZFBhdGNoIiwiY3JlYXRlVHdvRmlsZXNQYXRjaCIsImNyZWF0ZVBhdGNoIiwiYXBwbHlQYXRjaCIsImFwcGx5UGF0Y2hlcyIsInBhcnNlUGF0Y2giLCJtZXJnZSIsImNvbnZlcnRDaGFuZ2VzVG9ETVAiLCJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2Fub25pY2FsaXplIl0sIm1hcHBpbmdzIjoiOzs7Ozt1QkFnQkE7Ozs7dUJBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBRUE7O0FBQ0E7O0FBRUE7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2hhcnMsXG4gIGRpZmZXb3JkcyxcbiAgZGlmZldvcmRzV2l0aFNwYWNlLFxuICBkaWZmTGluZXMsXG4gIGRpZmZUcmltbWVkTGluZXMsXG4gIGRpZmZTZW50ZW5jZXMsXG5cbiAgZGlmZkNzcyxcbiAgZGlmZkpzb24sXG5cbiAgZGlmZkFycmF5cyxcblxuICBzdHJ1Y3R1cmVkUGF0Y2gsXG4gIGNyZWF0ZVR3b0ZpbGVzUGF0Y2gsXG4gIGNyZWF0ZVBhdGNoLFxuICBhcHBseVBhdGNoLFxuICBhcHBseVBhdGNoZXMsXG4gIHBhcnNlUGF0Y2gsXG4gIG1lcmdlLFxuICBjb252ZXJ0Q2hhbmdlc1RvRE1QLFxuICBjb252ZXJ0Q2hhbmdlc1RvWE1MLFxuICBjYW5vbmljYWxpemVcbn07XG4iXX0=
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 1 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports['default'] = /*istanbul ignore end*/Diff;
|
|
|
|
|
function Diff() {}
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
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] : {};
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
if (this.options.comparator) {
|
|
|
|
|
return this.options.comparator(left, right);
|
|
|
|
|
} else {
|
|
|
|
|
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
|
|
|
}
|
2017-05-28 00:38:50 +02:00
|
|
|
|
},
|
|
|
|
|
/*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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
// Special case handle for when one terminal is ignored (i.e. whitespace).
|
|
|
|
|
// For this case we merge the terminal into the prior string and drop the change.
|
|
|
|
|
// This is only available for string mode.
|
2017-05-28 00:38:50 +02:00
|
|
|
|
var lastComponent = components[componentLen - 1];
|
2017-12-10 21:51:33 +01:00
|
|
|
|
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
components[componentLen - 2].value += lastComponent.value;
|
|
|
|
|
components.pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return components;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clonePath(path) {
|
|
|
|
|
return { newPos: path.newPos, components: path.components.slice(0) };
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3Ny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lBQUksQ0FBQ2UsTUFBRCxJQUFXLENBQUNDLFNBQWhCLEVBQTJCO0FBQ3pCO0FBQ0FiLG1CQUFTUSxZQUFULElBQXlCakIsU0FBekI7QUFDQTtBQUNEOztBQUVEO0FBQ0E7QUFDQTtBQUNBLFlBQUksQ0FBQ3FCLE1BQUQsSUFBWUMsYUFBYUgsUUFBUVQsTUFBUixHQUFpQlUsV0FBV1YsTUFBekQsRUFBa0U7QUFDaEVRLHFCQUFXSyxVQUFVSCxVQUFWLENBQVg7QUFDQXhCLGVBQUs0QixhQUFMLENBQW1CTixTQUFTUCxVQUE1QixFQUF3Q1gsU0FBeEMsRUFBbUQsSUFBbkQ7QUFDRCxTQUhELE1BR087QUFDTGtCLHFCQUFXQyxPQUFYLENBREssQ0FDaUI7QUFDdEJELG1CQUFTUixNQUFUO0FBQ0FkLGVBQUs0QixhQUFMLENBQW1CTixTQUFTUCxVQUE1QixFQUF3QyxJQUF4QyxFQUE4Q1gsU0FBOUM7QUFDRDs7QUFFRFksa0JBQVNoQixLQUFLaUIsYUFBTCxDQUFtQkssUUFBbkIsRUFBNkJ6QixTQUE3QixFQUF3Q0QsU0FBeEMsRUFBbUR5QixZQUFuRCxDQUFUOztBQUVBO0FBQ0EsWUFBSUMsU0FBU1IsTUFBVCxHQUFrQixDQUFsQixJQUF1Qk4sTUFBdkIsSUFBaUNRLFVBQVMsQ0FBVCxJQUFjTixNQUFuRCxFQUEyRDtBQUN6RCxpQkFBT1QsS0FBSzRCLFlBQVk3QixJQUFaLEVBQWtCc0IsU0FBU1
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 2 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2017-08-14 05:01:11 +02:00
|
|
|
|
function diffChars(oldStr, newStr, options) {
|
|
|
|
|
return characterDiff.diff(oldStr, newStr, options);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6WyJkaWZmQ2hhcnMiLCJjaGFyYWN0ZXJEaWZmIiwib2xkU3RyIiwibmV3U3RyIiwib3B0aW9ucyIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBR2dCQSxTLEdBQUFBLFM7O0FBSGhCOzs7Ozs7dUJBRU8sSUFBTUMseUZBQWdCLHdFQUF0QjtBQUNBLFNBQVNELFNBQVQsQ0FBbUJFLE1BQW5CLEVBQTJCQyxNQUEzQixFQUFtQ0MsT0FBbkMsRUFBNEM7QUFBRSxTQUFPSCxjQUFjSSxJQUFkLENBQW1CSCxNQUFuQixFQUEyQkMsTUFBM0IsRUFBbUNDLE9BQW5DLENBQVA7QUFBcUQiLCJmaWxlIjoiY2hhcmFjdGVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IERpZmYgZnJvbSAnLi9iYXNlJztcblxuZXhwb3J0IGNvbnN0IGNoYXJhY3RlckRpZmYgPSBuZXcgRGlmZigpO1xuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDaGFycyhvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucykgeyByZXR1cm4gY2hhcmFjdGVyRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTsgfVxuIl19
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 3 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
|
2017-05-28 00:38:50 +02:00
|
|
|
|
//
|
|
|
|
|
// 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/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
wordDiff.equals = function (left, right) {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
if (this.options.ignoreCase) {
|
|
|
|
|
left = left.toLowerCase();
|
|
|
|
|
right = right.toLowerCase();
|
|
|
|
|
}
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
function diffWords(oldStr, newStr, options) {
|
|
|
|
|
options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
|
2017-05-28 00:38:50 +02:00
|
|
|
|
return wordDiff.diff(oldStr, newStr, options);
|
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
|
|
function diffWordsWithSpace(oldStr, newStr, options) {
|
|
|
|
|
return wordDiff.diff(oldStr, newStr, options);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOlsiZGlmZldvcmRzIiwiZGlmZldvcmRzV2l0aFNwYWNlIiwiZXh0ZW5kZWRXb3JkQ2hhcnMiLCJyZVdoaXRlc3BhY2UiLCJ3b3JkRGlmZiIsImVxdWFscyIsImxlZnQiLCJyaWdodCIsIm9wdGlvbnMiLCJpZ25vcmVDYXNlIiwidG9Mb3dlckNhc2UiLCJpZ25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G5cbmNvbnN0IHJlV2hpdGVzcGFjZSA9IC9cXFMvO1xuXG5leHBvcnQgY29uc3Qgd29yZERpZmYgPSBuZXcgRGlmZigpO1xud29yZERpZmYuZXF1YWxzID0gZnVuY3Rpb24obGVmdCwgcmlnaHQpIHtcbiAgaWYgKHRoaXMub3B0aW9ucy5pZ25vcmVDYXNlKSB7XG4gICAgbGVmdCA9IGxlZnQudG9Mb3dlckNhc2UoKTtcbiAgICByaWdodCA9IHJpZ2h0LnRvTG93ZXJDYXNlKCk7XG4gIH1cbiAgcmV0dXJuIGxlZnQgPT09IHJpZ2h0IHx8ICh0aGlzLm9wdGlvbnMuaWdub3JlV2hpdGVzcGFjZSAmJiAhcmVXaGl0ZXNwYWNlLnRlc3QobGVmdCkgJiYgIXJlV2hpdGVzcGFjZS50ZXN0KHJpZ2h0KSk7XG59O1xud29yZERpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICBsZXQgdG9rZW5zID0gdmFsdWUuc3BsaXQoLyhcXHMrfFxcYikvKTtcblxuICAvLyBKb2luIHRoZSBib3VuZGFyeSBzcGxpdHMgdGhhdC
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 4 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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)) {
|
|
|
|
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XG4gICAgZm9yIChsZXQgbmFtZSBpbiBvcHRpb25zKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkobmFtZSkpIHtcbiAgICAgICAgZGVmYXVsdHNbbmFtZV0gPSBvcHRpb25zW25hbWVdO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICByZXR1cm4gZGVmYXVsdHM7XG59XG4iXX0=
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 5 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOlsiZGlmZkxpbmVzIiwiZGlmZlRyaW1tZWRMaW5lcyIsImx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|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 6 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
sentenceDiff.tokenize = function (value) {
|
|
|
|
|
return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffSentences(oldStr, newStr, callback) {
|
|
|
|
|
return sentenceDiff.diff(oldStr, newStr, callback);
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbImRpZmZTZW50ZW5jZXMiLCJzZW50ZW5jZURpZmYiLCJ0b2tlbml6ZSIsInZhbHVlIiwic3BsaXQiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwibWFwcGluZ3MiOiI7Ozs7Z0NBUWdCQSxhLEdBQUFBLGE7O0FBUmhCOzs7Ozs7dUJBR08sSUFBTUMsdUZBQWUsd0VBQXJCO0FBQ1BBLGFBQWFDLFFBQWIsR0FBd0IsVUFBU0MsS0FBVCxFQUFnQjtBQUN0QyxTQUFPQSxNQUFNQyxLQUFOLENBQVksdUJBQVosQ0FBUDtBQUNELENBRkQ7O0FBSU8sU0FBU0osYUFBVCxDQUF1QkssTUFBdkIsRUFBK0JDLE1BQS9CLEVBQXVDQyxRQUF2QyxFQUFpRDtBQUFFLFNBQU9OLGFBQWFPLElBQWIsQ0FBa0JILE1BQWxCLEVBQTBCQyxNQUExQixFQUFrQ0MsUUFBbEMsQ0FBUDtBQUFxRCIsImZpbGUiOiJzZW50ZW5jZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cblxuZXhwb3J0IGNvbnN0IHNlbnRlbmNlRGlmZiA9IG5ldyBEaWZmKCk7XG5zZW50ZW5jZURpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhcXFMuKz9bLiE/XSkoPz1cXHMrfCQpLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZlNlbnRlbmNlcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIHNlbnRlbmNlRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdfQ==
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 7 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
cssDiff.tokenize = function (value) {
|
|
|
|
|
return value.split(/([{}:;,]|\s+)/);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffCss(oldStr, newStr, callback) {
|
|
|
|
|
return cssDiff.diff(oldStr, newStr, callback);
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6WyJkaWZmQ3NzIiwiY3NzRGlmZiIsInRva2VuaXplIiwidmFsdWUiLCJzcGxpdCIsIm9sZFN0ciIsIm5ld1N0ciIsImNhbGxiYWNrIiwiZGlmZiJdLCJtYXBwaW5ncyI6Ijs7OztnQ0FPZ0JBLE8sR0FBQUEsTzs7QUFQaEI7Ozs7Ozt1QkFFTyxJQUFNQyw2RUFBVSx3RUFBaEI7QUFDUEEsUUFBUUMsUUFBUixHQUFtQixVQUFTQyxLQUFULEVBQWdCO0FBQ2pDLFNBQU9BLE1BQU1DLEtBQU4sQ0FBWSxlQUFaLENBQVA7QUFDRCxDQUZEOztBQUlPLFNBQVNKLE9BQVQsQ0FBaUJLLE1BQWpCLEVBQXlCQyxNQUF6QixFQUFpQ0MsUUFBakMsRUFBMkM7QUFBRSxTQUFPTixRQUFRTyxJQUFSLENBQWFILE1BQWIsRUFBcUJDLE1BQXJCLEVBQTZCQyxRQUE3QixDQUFQO0FBQWdEIiwiZmlsZSI6ImNzcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjc3NEaWZmID0gbmV3IERpZmYoKTtcbmNzc0RpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhbe306OyxdfFxccyspLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkNzcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIGNzc0RpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG4iXX0=
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 8 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.jsonDiff = undefined;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
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; };
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
// 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;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
jsonDiff.castInput = function (value) {
|
2018-09-20 02:56:13 +02:00
|
|
|
|
/*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
|
|
|
|
|
undefinedReplacement = _options.undefinedReplacement,
|
|
|
|
|
_options$stringifyRep = _options.stringifyReplacer,
|
|
|
|
|
stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
|
|
|
|
|
return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
|
|
|
|
|
);
|
|
|
|
|
} : _options$stringifyRep;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2018-09-20 02:56:13 +02:00
|
|
|
|
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
|
2017-05-28 00:38:50 +02:00
|
|
|
|
};
|
|
|
|
|
jsonDiff.equals = function (left, right) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
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'))
|
2017-05-28 00:38:50 +02:00
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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
|
2018-09-20 02:56:13 +02:00
|
|
|
|
// object that is already on the "stack" of items being processed. Accepts an optional replacer
|
|
|
|
|
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
stack = stack || [];
|
|
|
|
|
replacementStack = replacementStack || [];
|
|
|
|
|
|
2018-09-20 02:56:13 +02:00
|
|
|
|
if (replacer) {
|
|
|
|
|
obj = replacer(key, obj);
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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) {
|
2018-09-20 02:56:13 +02:00
|
|
|
|
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
|
|
|
|
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 = [],
|
2018-09-20 02:56:13 +02:00
|
|
|
|
_key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
for (_key in obj) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* istanbul ignore else */
|
2018-09-20 02:56:13 +02:00
|
|
|
|
if (obj.hasOwnProperty(_key)) {
|
|
|
|
|
sortedKeys.push(_key);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sortedKeys.sort();
|
|
|
|
|
for (i = 0; i < sortedKeys.length; i += 1) {
|
2018-09-20 02:56:13 +02:00
|
|
|
|
_key = sortedKeys[i];
|
|
|
|
|
canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
|
|
|
|
stack.pop();
|
|
|
|
|
replacementStack.pop();
|
|
|
|
|
} else {
|
|
|
|
|
canonicalizedObj = obj;
|
|
|
|
|
}
|
|
|
|
|
return canonicalizedObj;
|
|
|
|
|
}
|
2018-09-20 02:56:13 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOlsiZGlmZkpzb24iLCJjYW5vbmljYWxpemUiLCJvYmplY3RQcm90b3R5cGVUb1N0cmluZyIsIk9iamVjdCIsInByb3RvdHlwZSIsInRvU3RyaW5nIiwianNvbkRpZmYiLCJ1c2VMb25nZXN0VG9rZW4iLCJ0b2tlbml6ZSIsImNhc3RJbnB1dCIsInZhbHVlIiwib3B0aW9ucyIsInVuZGVmaW5lZFJlcGxhY2VtZW50Iiwic3RyaW5naWZ5UmVwbGFjZXIiLCJrIiwidiIsIkpTT04iLCJzdHJpbmdpZnkiLCJlcXVhbHMiLCJsZWZ0IiwicmlnaHQiLCJjYWxsIiwicmVwbGFjZSIsIm9sZE9iaiIsIm5ld09iaiIsImRpZmYiLCJvYmoiLCJzdGFjayIsInJlcGxhY2VtZW50U3RhY2siLCJyZXBsYWNlciIsImtleSIsImkiLCJsZW5ndGgiLCJjYW5vbmljYWxpemVkT2JqIiwicHVzaCIsIkFycmF5IiwicG9wIiwidG9KU09OIiwic29ydGVkS2V5cyIsImhhc093blByb3BlcnR5Iiwic29ydCJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztnQ0FxQmdCQSxRLEdBQUFBLFE7eURBSUFDLFksR0FBQUEsWTs7QUF6QmhCOzs7O3VCQUNBOzs7O3VCQUVBLElBQU1DLDBCQUEwQkMsT0FBT0MsU0FBUCxDQUFpQkMsUUFBakQ7O0FBR08sSUFBTUMsK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0FBQ0QsU0FBT08sZ0JBQVA7QUFDRCIsImZpbGUiOiJqc29uLm
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 9 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
|
2018-09-20 02:56:13 +02:00
|
|
|
|
arrayDiff.tokenize = function (value) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
return value.slice();
|
|
|
|
|
};
|
2018-09-20 02:56:13 +02:00
|
|
|
|
arrayDiff.join = arrayDiff.removeEmpty = function (value) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
return value;
|
|
|
|
|
};
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
function diffArrays(oldArr, newArr, callback) {
|
|
|
|
|
return arrayDiff.diff(oldArr, newArr, callback);
|
|
|
|
|
}
|
2018-09-20 02:56:13 +02:00
|
|
|
|
//# sour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R1cm4gdmFsdWU7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkFycmF5cyhvbGRBcnIsIG5ld0FyciwgY2FsbGJhY2spIHsgcmV0dXJuIGFycmF5RGlmZi5kaWZmKG9sZEFyciwgbmV3QXJyLCBjYWxsYmFjayk7IH1cbiJdfQ==
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 10 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/function applyPatch(source, uniDiff) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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],
|
2018-09-20 02:56:13 +02:00
|
|
|
|
operation = line.length > 0 ? line[0] : ' ',
|
|
|
|
|
content = line.length > 0 ? line.substr(1) : line;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var diffOffset = 0;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
for (var _i = 0; _i < hunks.length; _i++) {
|
|
|
|
|
var _hunk = hunks[_i],
|
2017-08-14 05:01:11 +02:00
|
|
|
|
_toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
|
|
|
|
|
diffOffset += _hunk.newLines - _hunk.oldLines;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
if (_toPos < 0) {
|
|
|
|
|
// Creating a new file
|
|
|
|
|
_toPos = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-28 00:38:50 +02:00
|
|
|
|
for (var j = 0; j < _hunk.lines.length; j++) {
|
|
|
|
|
var line = _hunk.lines[j],
|
2018-09-20 02:56:13 +02:00
|
|
|
|
operation = line.length > 0 ? line[0] : ' ',
|
|
|
|
|
content = line.length > 0 ? line.substr(1) : line,
|
2017-05-28 00:38:50 +02:00
|
|
|
|
delimiter = _hunk.linedelimiters[j];
|
|
|
|
|
|
|
|
|
|
if (operation === ' ') {
|
|
|
|
|
_toPos++;
|
|
|
|
|
} else if (operation === '-') {
|
|
|
|
|
lines.splice(_toPos, 1);
|
|
|
|
|
delimiters.splice(_toPos, 1);
|
|
|
|
|
/* istanbul ignore else */
|
|
|
|
|
} else if (operation === '+') {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
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;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
}
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
}
|
2018-09-20 02:56:13 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6WyJhcHBseVBhdGNoIiwiYXBwbHlQYXRjaGVzIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJBcnJheSIsImlzQXJyYXkiLCJsZW5ndGgiLCJFcnJvciIsImxpbmVzIiwic3BsaXQiLCJkZWxpbWl0ZXJzIiwibWF0Y2giLCJodW5rcyIsImNvbXBhcmVMaW5lIiwibGluZU51bWJlciIsImxpbmUiLCJvcGVyYXRpb24iLCJwYXRjaENvbnRlbnQiLCJlcnJvckNvdW50IiwiZnV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PQUFLLElBQUlQLEtBQUksQ0FBYixFQUFnQkEsS0FBSWxCLE1BQU1OLE1BQTFCLEVBQWtDd0IsSUFBbEMsRUFBdUM7QUFDckMsUUFBSUwsUUFBT2IsTUFBTWtCLEVBQU4sQ0FBWDtBQUFBLFFBQ0lKLFNBQVFELE1BQUtTLFFBQUwsR0FBZ0JULE1BQUtKLE1BQXJCLEdBQThCZ0IsVUFBOUIsR0FBMkMsQ0FEdkQ7QUFFQUEsa0JBQWNaLE1BQUthLFFBQUwsR0FBZ0JiLE1BQUtPLFFBQW5DOztBQUVBLFFBQUlOLFNBQVEsQ0FBWixFQUFlO0FBQUU7QUFDZkEsZUFBUSxDQUFSO0FBQ0Q7O0FBRUQsU0FBSyxJQUFJQyxJQUFJLENBQWIsRUFBZ0JBLElBQUlGLE1BQUtqQixLQUFMLENBQVdGLE1BQS9CLEVBQXVDcUIsR0FBdkMsRUFBNEM7QUFDMUMsVUFBSVosT0FBT1UsTUFBS2pCLEtBQUwsQ0FBV2
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 11 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/parsePatch = parsePatch;
|
|
|
|
|
function parsePatch(uniDiff) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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) {
|
2018-09-20 02:56:13 +02:00
|
|
|
|
var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
if (fileHeader) {
|
|
|
|
|
var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
|
2018-09-20 02:56:13 +02:00
|
|
|
|
var data = fileHeader[2].split('\t', 2);
|
|
|
|
|
var fileName = data[0].replace(/\\\\/g, '\\');
|
2017-08-14 05:01:11 +02:00
|
|
|
|
if (/^".*"$/.test(fileName)) {
|
|
|
|
|
fileName = fileName.substr(1, fileName.length - 2);
|
|
|
|
|
}
|
|
|
|
|
index[keyPrefix + 'FileName'] = fileName;
|
2018-09-20 02:56:13 +02:00
|
|
|
|
index[keyPrefix + 'Header'] = (data[1] || '').trim();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2018-09-20 02:56:13 +02:00
|
|
|
|
var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
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|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 12 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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();
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
// We tried to fit hunk before text beginning and beyond text length, then
|
2017-05-28 00:38:50 +02:00
|
|
|
|
// hunk can't fit on the text. Return undefined
|
|
|
|
|
};
|
|
|
|
|
};
|
2017-12-10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c3RhcnQgKyBsb2NhbE9mZnNldCA8PSBtYXhMaW5lKSB7XG4gICAgICAgIHJldHVybiBsb2NhbE9mZnNldDtcbiAgICAgIH1cblxuICAgICAgZm9yd2FyZEV4aGF1c3RlZCA9IHRydWU7XG4gICAgfVxuXG4gICAgaWYgKCFiYWNrd2FyZEV4aGF1c3RlZCkge1xuICAgICAgaWYgKCFmb3J3YXJkRXhoYXVzdGVkKSB7XG4gICAgICAgIHdhbnRGb3J3YXJkID0gdHJ1ZTtcbiAgICAgIH1cblxuICAgICAgLy8gQ2hlY2sgaWYgdHJ5aW5nIHRvIGZpdCBiZWZvcmUgdGV4dCBiZWdpbm5pbmcsIGFuZCBpZiBub3QsIGNoZWNrIGl0IGZpdHNcbiAgICAgIC8vIGJlZm9yZSBvZmZzZXQgbG9jYXRpb25cbiAgICAgIGlmIChtaW5MaW5lIDw9IHN0YXJ0IC0gbG9jYWxPZmZzZXQpIHtcbiAgICAgICAgcmV0dXJuIC1sb2NhbE9mZnNldCsrO1xuICAgICAgfVxuXG4gICAgICBiYWNrd2FyZEV4aGF1c3RlZCA9IHRydWU7XG4gICAgICByZXR1cm4gaXRlcmF0b3IoKTtcbiAgICB9XG5cbiAgICAvLyBXZSB0cmllZCB0byBmaXQgaHVuayBiZWZvcmUgdGV4dCBiZWdpbm5pbmcgYW5kIGJleW9uZCB0ZXh0IGxlbmd0aCwgdGhlblxuICAgIC8vIGh1bmsgY2FuJ3QgZml0IG9uIHRoZSB0ZXh0LiBSZXR1cm4gdW5kZWZpbmVkXG4gIH07XG59XG4iXX0=
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/* 13 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*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); } }
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/function calcLineCount(hunk) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
|
|
|
|
|
oldLines = _calcOldNewLineCount.oldLines,
|
|
|
|
|
newLines = _calcOldNewLineCount.newLines;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
if (oldLines !== undefined) {
|
|
|
|
|
hunk.oldLines = oldLines;
|
|
|
|
|
} else {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
delete hunk.oldLines;
|
2017-12-10 21:51:33 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newLines !== undefined) {
|
|
|
|
|
hunk.newLines = newLines;
|
|
|
|
|
} else {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
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] === ' ') {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _hunk$lines;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/ // Mine inserted
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/*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] === ' ') {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _hunk$lines2;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/ // Theirs inserted
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/*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)) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _hunk$lines3;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*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));
|
2017-08-14 05:01:11 +02:00
|
|
|
|
return;
|
|
|
|
|
} else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _hunk$lines4;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*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));
|
2017-08-14 05:01:11 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _hunk$lines5;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*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));
|
2017-08-14 05:01:11 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conflict(hunk, myChanges, theirChanges);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removal(hunk, mine, their, swap) {
|
|
|
|
|
var myChanges = collectChange(mine),
|
|
|
|
|
theirChanges = collectContext(their, myChanges);
|
|
|
|
|
if (theirChanges.merged) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _hunk$lines6;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*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));
|
2017-08-14 05:01:11 +02:00
|
|
|
|
} 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;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
function calcOldNewLineCount(lines) {
|
|
|
|
|
var oldLines = 0;
|
|
|
|
|
var newLines = 0;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
lines.forEach(function (line) {
|
|
|
|
|
if (typeof line !== 'string') {
|
|
|
|
|
var myCount = calcOldNewLineCount(line.mine);
|
|
|
|
|
var theirCount = calcOldNewLineCount(line.theirs);
|
|
|
|
|
|
|
|
|
|
if (oldLines !== undefined) {
|
|
|
|
|
if (myCount.oldLines === theirCount.oldLines) {
|
|
|
|
|
oldLines += myCount.oldLines;
|
|
|
|
|
} else {
|
|
|
|
|
oldLines = undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newLines !== undefined) {
|
|
|
|
|
if (myCount.newLines === theirCount.newLines) {
|
|
|
|
|
newLines += myCount.newLines;
|
|
|
|
|
} else {
|
|
|
|
|
newLines = undefined;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
|
|
|
|
|
newLines++;
|
|
|
|
|
}
|
|
|
|
|
if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
|
|
|
|
|
oldLines++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return { oldLines: oldLines, newLines: newLines };
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9tZXJnZS5qcyJdLCJuYW1lcyI6WyJjYWxjTGluZUNvdW50IiwibWVyZ2UiLCJodW5rIiwiY2FsY09sZE5ld0xpbmVDb3VudCIsImxpbmVzIiwib2xkTGluZXMiLCJuZXdMaW5lcyIsInVuZGVmaW5lZCIsIm1pbmUiLCJ0aGVpcnMiLCJiYXNlIiwibG9hZFBhdGNoIiwicmV0IiwiaW5kZXgiLCJuZXdGaWxlTmFtZSIsImZpbGVOYW1lQ2hhbmdlZCIsIm9sZEZpbGVOYW1lIiwib2xkSGVhZGVyIiwibmV3SGVhZGVyIiwic2VsZWN0RmllbGQiLCJodW5rcyIsIm1pbmVJbmRleCIsInRoZWlyc0luZGV4IiwibWluZU9mZnNldCIsInRoZWlyc09mZnNldCIsImxlbmd0aCIsIm1pbmVDdXJyZW50Iiwib2xkU3RhcnQiLCJJbmZpbml0eSIsInRoZWlyc0N1cnJlbnQiLCJodW5rQmVmb3JlIiwicHVzaCIsImNsb25lSHVuayIsIm1lcmdlZEh1bmsiLCJNYXRoIiwibWluIiwibmV3U3RhcnQiLCJtZXJnZUxpbmVzIiwicGFyYW0iLCJ0ZXN0IiwiRXJyb3IiLCJwYXRjaCIsImNvbmZsaWN0IiwiY2hlY2siLCJvZmZzZXQiLCJtaW5lTGluZXMiLCJ0aGVpck9mZnNldCIsInRoZWlyTGluZXMiLCJ0aGVpciIsImluc2VydExlYWRpbmciLCJ0aGVpckN1cnJlbnQiLCJtdXR1YWxDaGFuZ2UiLC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FQUF1QkgsVU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 14 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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*/;
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*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); } }
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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;
|
2017-12-10 21:51:33 +01:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
var current = diff[i],
|
|
|
|
|
lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
|
|
|
|
current.lines = lines;
|
|
|
|
|
|
|
|
|
|
if (current.added || current.removed) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _curRange;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/ // If we have previous context, start with that
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _curRange2;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/ // Overlapping
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/*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 {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/var _curRange3;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore end*/ // end the range and output
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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++) {
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOlsic3RydWN0dXJlZFBhdGNoIiwiY3JlYXRlVHdvRmlsZXNQYXRjaCIsImNyZWF0ZVBhdGNoIiwib2xkRmlsZU5hbWUiLCJuZXdGaWxlTmFtZSIsIm9sZFN0ciIsIm5ld1N0ciIsIm9sZEhlYWRlciIsIm5ld0hlYWRlciIsIm9wdGlvbnMiLCJjb250ZXh0IiwiZGlmZiIsInB1c2giLCJ2YWx1ZSIsImxpbmVzIiwiY29udGV4dExpbmVzIiwibWFwIiwiZW50cnkiLCJodW5rcyIsIm9sZFJhbmdlU3RhcnQiLCJuZXdSYW5nZVN0YXJ0IiwiY3VyUmFuZ2UiLCJvbGRMaW5lIiwibmV3TGluZSIsImkiLCJjdXJyZW50IiwicmVwbGFjZSIsInNwbGl0IiwiYWRkZWQiLCJyZW1vdmVkIiwicHJldiIsInNsaWNlIiwibGVuZ3RoIiwiY29udGV4dFNpemUiLCJNYXRoIiwibWluIiwiaHVuayIsIm9sZFN0YXJ0Iiwib2xkTGluZXMiLCJuZXdTdGF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QSxnQkFBSXNDLGdCQUFpQixNQUFNRCxJQUFOLENBQVdwQyxNQUFYLENBQXJCO0FBQ0EsZ0JBQUlRLE1BQU1rQixNQUFOLElBQWdCLENBQWhCLElBQXFCLENBQUNTLGFBQTFCLEVBQXlDO0FBQ3ZDO0FBQ0FwQix1QkFBU3VCLE1BQVQsQ0FBZ0JSLEtBQUtFLFFBQXJCLEVBQStCLENBQS9CLEVBQWtDLDhCQUFsQztBQUNELGFBSEQsTUFHTyxJQUFJLENBQUNHLGFBQUQsSUFBa0
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 15 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
|
|
/*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;
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjoz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N0aW9uIGFycmF5U3RhcnRzV2l0aChhcnJheSwgc3RhcnQpIHtcbiAgaWYgKHN0YXJ0Lmxlbmd0aCA+IGFycmF5Lmxlbmd0aCkge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgc3RhcnQubGVuZ3RoOyBpKyspIHtcbiAgICBpZiAoc3RhcnRbaV0gIT09IGFycmF5W2ldKSB7XG4gICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIHRydWU7XG59XG4iXX0=
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 16 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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;
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMapping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bmdlcykge1xuICBsZXQgcmV0ID0gW10sXG4gICAgICBjaGFuZ2UsXG4gICAgICBvcGVyYXRpb247XG4gIGZvciAobGV0IGkgPSAwOyBpIDwgY2hhbmdlcy5sZW5ndGg7IGkrKykge1xuICAgIGNoYW5nZSA9IGNoYW5nZXNbaV07XG4gICAgaWYgKGNoYW5nZS5hZGRlZCkge1xuICAgICAgb3BlcmF0aW9uID0gMTtcbiAgICB9IGVsc2UgaWYgKGNoYW5nZS5yZW1vdmVkKSB7XG4gICAgICBvcGVyYXRpb24gPSAtMTtcbiAgICB9IGVsc2Uge1xuICAgICAgb3BlcmF0aW9uID0gMDtcbiAgICB9XG5cbiAgICByZXQucHVzaChbb3BlcmF0aW9uLCBjaGFuZ2UudmFsdWVdKTtcbiAgfVxuICByZXR1cm4gcmV0O1xufVxuIl19
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ }),
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 17 */
|
2017-12-10 21:51:33 +01:00
|
|
|
|
/***/ (function(module, exports) {
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*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;
|
|
|
|
|
}
|
2017-12-10 21:51:33 +01:00
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2hhbmdlcyIsInJldCIsImkiLCJsZW5ndGgiLCJjaGFuZ2UiLCJhZGRlZCIsInB1c2giLCJyZW1vdmVkIiwiZXNjYXBlSFRNTCIsInZhbHVlIiwiam9pbiIsInMiLCJuIiwicmVwbGFjZSJdLCJtYXBwaW5ncyI6Ijs7O2dDQUFnQkEsbUIsR0FBQUEsbUI7QUFBVCxTQUFTQSxtQkFBVCxDQUE2QkMsT0FBN0IsRUFBc0M7QUFDM0MsTUFBSUMsTUFBTSxFQUFWO0FBQ0EsT0FBSyxJQUFJQyxJQUFJLENBQWIsRUFBZ0JBLElBQUlGLFFBQVFHLE1BQTVCLEVBQW9DRCxHQUFwQyxFQUF5QztBQUN2QyxRQUFJRSxTQUFTSixRQUFRRSxDQUFSLENBQWI7QUFDQSxRQUFJRSxPQUFPQyxLQUFYLEVBQWtCO0FBQ2hCSixVQUFJSyxJQUFKLENBQVMsT0FBVDtBQUNELEtBRkQsTUFFTyxJQUFJRixPQUFPRyxPQUFYLEVBQW9CO0FBQ3pCTixVQUFJSyxJQUFKLENBQVMsT0FBVDtBQUNEOztBQUVETCxRQUFJSyxJQUFKLENBQVNFLFdBQVdKLE9BQU9LLEtBQWxCLENBQ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