Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

diff.min.js 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. /*!
  2. diff v3.5.0
  3. Software License Agreement (BSD License)
  4. Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above
  9. copyright notice, this list of conditions and the
  10. following disclaimer.
  11. * Redistributions in binary form must reproduce the above
  12. copyright notice, this list of conditions and the
  13. following disclaimer in the documentation and/or other
  14. materials provided with the distribution.
  15. * Neither the name of Kevin Decker nor the names of its
  16. contributors may be used to endorse or promote products
  17. derived from this software without specific prior
  18. written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  20. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  21. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  25. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  26. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. @license
  28. */
  29. !function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.JsDiff=b():a.JsDiff=b()}(this,function(){/******/
  30. return function(a){/******/
  31. // The require function
  32. /******/
  33. function b(d){/******/
  34. // Check if module is in cache
  35. /******/
  36. if(c[d])/******/
  37. return c[d].exports;/******/
  38. // Create a new module (and put it into the cache)
  39. /******/
  40. var e=c[d]={/******/
  41. exports:{},/******/
  42. id:d,/******/
  43. loaded:!1};/******/
  44. // Return the exports of the module
  45. /******/
  46. /******/
  47. // Execute the module function
  48. /******/
  49. /******/
  50. // Flag the module as loaded
  51. /******/
  52. return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}// webpackBootstrap
  53. /******/
  54. // The module cache
  55. /******/
  56. var c={};/******/
  57. // Load entry module and return exports
  58. /******/
  59. /******/
  60. // expose the modules object (__webpack_modules__)
  61. /******/
  62. /******/
  63. // expose the module cache
  64. /******/
  65. /******/
  66. // __webpack_public_path__
  67. /******/
  68. return b.m=a,b.c=c,b.p="",b(0)}([/* 0 */
  69. /***/
  70. function(a,b,c){/*istanbul ignore start*/
  71. "use strict";/*istanbul ignore start*/
  72. function d(a){return a&&a.__esModule?a:{"default":a}}b.__esModule=!0,b.canonicalize=b.convertChangesToXML=b.convertChangesToDMP=b.merge=b.parsePatch=b.applyPatches=b.applyPatch=b.createPatch=b.createTwoFilesPatch=b.structuredPatch=b.diffArrays=b.diffJson=b.diffCss=b.diffSentences=b.diffTrimmedLines=b.diffLines=b.diffWordsWithSpace=b.diffWords=b.diffChars=b.Diff=void 0;/*istanbul ignore end*/
  73. var/*istanbul ignore start*/e=c(1),f=d(e),/*istanbul ignore start*/g=c(2),/*istanbul ignore start*/h=c(3),/*istanbul ignore start*/i=c(5),/*istanbul ignore start*/j=c(6),/*istanbul ignore start*/k=c(7),/*istanbul ignore start*/l=c(8),/*istanbul ignore start*/m=c(9),/*istanbul ignore start*/n=c(10),/*istanbul ignore start*/o=c(11),/*istanbul ignore start*/p=c(13),/*istanbul ignore start*/q=c(14),/*istanbul ignore start*/r=c(16),/*istanbul ignore start*/s=c(17);/* See LICENSE file for terms of use */
  74. /*
  75. * Text diff implementation.
  76. *
  77. * This library supports the following APIS:
  78. * JsDiff.diffChars: Character by character diff
  79. * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
  80. * JsDiff.diffLines: Line based diff
  81. *
  82. * JsDiff.diffCss: Diff targeted at CSS content
  83. *
  84. * These methods are based on the implementation proposed in
  85. * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
  86. * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
  87. */
  88. b.Diff=f["default"],/*istanbul ignore start*/
  89. b.diffChars=g.diffChars,/*istanbul ignore start*/
  90. b.diffWords=h.diffWords,/*istanbul ignore start*/
  91. b.diffWordsWithSpace=h.diffWordsWithSpace,/*istanbul ignore start*/
  92. b.diffLines=i.diffLines,/*istanbul ignore start*/
  93. b.diffTrimmedLines=i.diffTrimmedLines,/*istanbul ignore start*/
  94. b.diffSentences=j.diffSentences,/*istanbul ignore start*/
  95. b.diffCss=k.diffCss,/*istanbul ignore start*/
  96. b.diffJson=l.diffJson,/*istanbul ignore start*/
  97. b.diffArrays=m.diffArrays,/*istanbul ignore start*/
  98. b.structuredPatch=q.structuredPatch,/*istanbul ignore start*/
  99. b.createTwoFilesPatch=q.createTwoFilesPatch,/*istanbul ignore start*/
  100. b.createPatch=q.createPatch,/*istanbul ignore start*/
  101. b.applyPatch=n.applyPatch,/*istanbul ignore start*/
  102. b.applyPatches=n.applyPatches,/*istanbul ignore start*/
  103. b.parsePatch=o.parsePatch,/*istanbul ignore start*/
  104. b.merge=p.merge,/*istanbul ignore start*/
  105. b.convertChangesToDMP=r.convertChangesToDMP,/*istanbul ignore start*/
  106. b.convertChangesToXML=s.convertChangesToXML,/*istanbul ignore start*/
  107. b.canonicalize=l.canonicalize},/* 1 */
  108. /***/
  109. function(a,b){/*istanbul ignore start*/
  110. "use strict";function c(){}function d(a,b,c,d,e){for(var f=0,g=b.length,h=0,i=0;f<g;f++){var j=b[f];if(j.removed){
  111. // Reverse add and remove so removes are output first to match common convention
  112. // The diffing algorithm is tied to add then remove output and this is the simplest
  113. // route to get the desired output with minimal overhead.
  114. if(j.value=a.join(d.slice(i,i+j.count)),i+=j.count,f&&b[f-1].added){var k=b[f-1];b[f-1]=b[f],b[f]=k}}else{if(!j.added&&e){var l=c.slice(h,h+j.count);l=l.map(function(a,b){var c=d[i+b];return c.length>a.length?c:a}),j.value=a.join(l)}else j.value=a.join(c.slice(h,h+j.count));h+=j.count,
  115. // Common case
  116. j.added||(i+=j.count)}}
  117. // Special case handle for when one terminal is ignored (i.e. whitespace).
  118. // For this case we merge the terminal into the prior string and drop the change.
  119. // This is only available for string mode.
  120. var m=b[g-1];return g>1&&"string"==typeof m.value&&(m.added||m.removed)&&a.equals("",m.value)&&(b[g-2].value+=m.value,b.pop()),b}function e(a){return{newPos:a.newPos,components:a.components.slice(0)}}b.__esModule=!0,b["default"]=/*istanbul ignore end*/c,c.prototype={/*istanbul ignore start*/
  121. /*istanbul ignore end*/
  122. diff:function(a,b){function c(a){return h?(setTimeout(function(){h(void 0,a)},0),!0):a}
  123. // Main worker method. checks all permutations of a given edit length for acceptance.
  124. function f(){for(var f=-1*l;f<=l;f+=2){var g=/*istanbul ignore start*/void 0,h=n[f-1],m=n[f+1],o=(m?m.newPos:0)-f;h&&(
  125. // No one else is going to attempt to use this value, clear it
  126. n[f-1]=void 0);var p=h&&h.newPos+1<j,q=m&&0<=o&&o<k;if(p||q){
  127. // If we have hit the end of both strings, then we are done
  128. if(
  129. // Select the diagonal that we want to branch from. We select the prior
  130. // path whose position in the new string is the farthest from the origin
  131. // and does not pass the bounds of the diff graph
  132. !p||q&&h.newPos<m.newPos?(g=e(m),i.pushComponent(g.components,void 0,!0)):(g=h,// No need to clone, we've pulled it from the list
  133. g.newPos++,i.pushComponent(g.components,!0,void 0)),o=i.extractCommon(g,b,a,f),g.newPos+1>=j&&o+1>=k)return c(d(i,g.components,b,a,i.useLongestToken));
  134. // Otherwise track this path as a potential candidate and continue.
  135. n[f]=g}else
  136. // If this path is a terminal then prune
  137. n[f]=void 0}l++}/*istanbul ignore start*/
  138. var/*istanbul ignore end*/g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},h=g.callback;"function"==typeof g&&(h=g,g={}),this.options=g;var i=this;
  139. // Allow subclasses to massage the input prior to running
  140. a=this.castInput(a),b=this.castInput(b),a=this.removeEmpty(this.tokenize(a)),b=this.removeEmpty(this.tokenize(b));var j=b.length,k=a.length,l=1,m=j+k,n=[{newPos:-1,components:[]}],o=this.extractCommon(n[0],b,a,0);if(n[0].newPos+1>=j&&o+1>=k)
  141. // Identity per the equality and tokenizer
  142. return c([{value:this.join(b),count:b.length}]);
  143. // Performs the length of edit iteration. Is a bit fugly as this has to support the
  144. // sync and async mode which is never fun. Loops over execEditLength until a value
  145. // is produced.
  146. if(h)!function q(){setTimeout(function(){
  147. // This should not happen, but we want to be safe.
  148. /* istanbul ignore next */
  149. // This should not happen, but we want to be safe.
  150. /* istanbul ignore next */
  151. return l>m?h():void(f()||q())},0)}();else for(;l<=m;){var p=f();if(p)return p}},/*istanbul ignore start*/
  152. /*istanbul ignore end*/
  153. pushComponent:function(a,b,c){var d=a[a.length-1];d&&d.added===b&&d.removed===c?
  154. // We need to clone here as the component clone operation is just
  155. // as shallow array clone
  156. a[a.length-1]={count:d.count+1,added:b,removed:c}:a.push({count:1,added:b,removed:c})},/*istanbul ignore start*/
  157. /*istanbul ignore end*/
  158. extractCommon:function(a,b,c,d){for(var e=b.length,f=c.length,g=a.newPos,h=g-d,i=0;g+1<e&&h+1<f&&this.equals(b[g+1],c[h+1]);)g++,h++,i++;return i&&a.components.push({count:i}),a.newPos=g,h},/*istanbul ignore start*/
  159. /*istanbul ignore end*/
  160. equals:function(a,b){return this.options.comparator?this.options.comparator(a,b):a===b||this.options.ignoreCase&&a.toLowerCase()===b.toLowerCase()},/*istanbul ignore start*/
  161. /*istanbul ignore end*/
  162. removeEmpty:function(a){for(var b=[],c=0;c<a.length;c++)a[c]&&b.push(a[c]);return b},/*istanbul ignore start*/
  163. /*istanbul ignore end*/
  164. castInput:function(a){return a},/*istanbul ignore start*/
  165. /*istanbul ignore end*/
  166. tokenize:function(a){return a.split("")},/*istanbul ignore start*/
  167. /*istanbul ignore end*/
  168. join:function(a){return a.join("")}}},/* 2 */
  169. /***/
  170. function(a,b,c){/*istanbul ignore start*/
  171. "use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.characterDiff=void 0,b.diffChars=e;var/*istanbul ignore start*/f=c(1),g=d(f),h=/*istanbul ignore start*/b.characterDiff=new/*istanbul ignore start*/g["default"]},/* 3 */
  172. /***/
  173. function(a,b,c){/*istanbul ignore start*/
  174. "use strict";/*istanbul ignore start*/
  175. function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){/*istanbul ignore start*/
  176. return c=(0,i.generateOptions)(c,{ignoreWhitespace:!0}),l.diff(a,b,c)}function f(a,b,c){return l.diff(a,b,c)}b.__esModule=!0,b.wordDiff=void 0,b.diffWords=e,/*istanbul ignore start*/
  177. b.diffWordsWithSpace=f;var/*istanbul ignore start*/g=c(1),h=d(g),/*istanbul ignore start*/i=c(4),j=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,k=/\S/,l=/*istanbul ignore start*/b.wordDiff=new/*istanbul ignore start*/h["default"];l.equals=function(a,b){return this.options.ignoreCase&&(a=a.toLowerCase(),b=b.toLowerCase()),a===b||this.options.ignoreWhitespace&&!k.test(a)&&!k.test(b)},l.tokenize=function(a){
  178. // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
  179. for(var b=a.split(/(\s+|\b)/),c=0;c<b.length-1;c++)
  180. // If we have an empty string in the next field and we have only word chars before and after, merge
  181. !b[c+1]&&b[c+2]&&j.test(b[c])&&j.test(b[c+2])&&(b[c]+=b[c+2],b.splice(c+1,2),c--);return b}},/* 4 */
  182. /***/
  183. function(a,b){/*istanbul ignore start*/
  184. "use strict";function c(a,b){if("function"==typeof a)b.callback=a;else if(a)for(var c in a)/* istanbul ignore else */
  185. a.hasOwnProperty(c)&&(b[c]=a[c]);return b}b.__esModule=!0,b.generateOptions=c},/* 5 */
  186. /***/
  187. function(a,b,c){/*istanbul ignore start*/
  188. "use strict";/*istanbul ignore start*/
  189. function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return j.diff(a,b,c)}function f(a,b,c){var d=/*istanbul ignore start*/(0,i.generateOptions)(c,{ignoreWhitespace:!0});return j.diff(a,b,d)}b.__esModule=!0,b.lineDiff=void 0,b.diffLines=e,/*istanbul ignore start*/
  190. b.diffTrimmedLines=f;var/*istanbul ignore start*/g=c(1),h=d(g),/*istanbul ignore start*/i=c(4),j=/*istanbul ignore start*/b.lineDiff=new/*istanbul ignore start*/h["default"];j.tokenize=function(a){var b=[],c=a.split(/(\n|\r\n)/);
  191. // Ignore the final empty token that occurs if the string ends with a new line
  192. c[c.length-1]||c.pop();
  193. // Merge the content and line separators into single tokens
  194. for(var d=0;d<c.length;d++){var e=c[d];d%2&&!this.options.newlineIsToken?b[b.length-1]+=e:(this.options.ignoreWhitespace&&(e=e.trim()),b.push(e))}return b}},/* 6 */
  195. /***/
  196. function(a,b,c){/*istanbul ignore start*/
  197. "use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.sentenceDiff=void 0,b.diffSentences=e;var/*istanbul ignore start*/f=c(1),g=d(f),h=/*istanbul ignore start*/b.sentenceDiff=new/*istanbul ignore start*/g["default"];h.tokenize=function(a){return a.split(/(\S.+?[.!?])(?=\s+|$)/)}},/* 7 */
  198. /***/
  199. function(a,b,c){/*istanbul ignore start*/
  200. "use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.cssDiff=void 0,b.diffCss=e;var/*istanbul ignore start*/f=c(1),g=d(f),h=/*istanbul ignore start*/b.cssDiff=new/*istanbul ignore start*/g["default"];h.tokenize=function(a){return a.split(/([{}:;,]|\s+)/)}},/* 8 */
  201. /***/
  202. function(a,b,c){/*istanbul ignore start*/
  203. "use strict";/*istanbul ignore start*/
  204. function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return l.diff(a,b,c)}
  205. // This function handles the presence of circular references by bailing out when encountering an
  206. // object that is already on the "stack" of items being processed. Accepts an optional replacer
  207. function f(a,b,c,d,e){b=b||[],c=c||[],d&&(a=d(e,a));var h=/*istanbul ignore start*/void 0;for(h=0;h<b.length;h+=1)if(b[h]===a)return c[h];var i=/*istanbul ignore start*/void 0;if("[object Array]"===k.call(a)){for(b.push(a),i=new Array(a.length),c.push(i),h=0;h<a.length;h+=1)i[h]=f(a[h],b,c,d,e);return b.pop(),c.pop(),i}if(a&&a.toJSON&&(a=a.toJSON()),/*istanbul ignore start*/"object"===("undefined"==typeof/*istanbul ignore end*/a?"undefined":g(a))&&null!==a){b.push(a),i={},c.push(i);var j=[],l=/*istanbul ignore start*/void 0;for(l in a)/* istanbul ignore else */
  208. a.hasOwnProperty(l)&&j.push(l);for(j.sort(),h=0;h<j.length;h+=1)l=j[h],i[l]=f(a[l],b,c,d,l);b.pop(),c.pop()}else i=a;return i}b.__esModule=!0,b.jsonDiff=void 0;var g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};b.diffJson=e,/*istanbul ignore start*/
  209. b.canonicalize=f;var/*istanbul ignore start*/h=c(1),i=d(h),/*istanbul ignore start*/j=c(5),k=Object.prototype.toString,l=/*istanbul ignore start*/b.jsonDiff=new/*istanbul ignore start*/i["default"];
  210. // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
  211. // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
  212. l.useLongestToken=!0,l.tokenize=/*istanbul ignore start*/j.lineDiff.tokenize,l.castInput=function(a){/*istanbul ignore start*/
  213. var b=/*istanbul ignore end*/this.options,c=b.undefinedReplacement,d=b.stringifyReplacer,e=void 0===d?function(a,b){/*istanbul ignore end*/
  214. return"undefined"==typeof b?c:b}:d;return"string"==typeof a?a:JSON.stringify(f(a,null,null,e),e," ")},l.equals=function(a,b){/*istanbul ignore start*/
  215. return i["default"].prototype.equals.call(l,a.replace(/,([\r\n])/g,"$1"),b.replace(/,([\r\n])/g,"$1"))}},/* 9 */
  216. /***/
  217. function(a,b,c){/*istanbul ignore start*/
  218. "use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return h.diff(a,b,c)}b.__esModule=!0,b.arrayDiff=void 0,b.diffArrays=e;var/*istanbul ignore start*/f=c(1),g=d(f),h=/*istanbul ignore start*/b.arrayDiff=new/*istanbul ignore start*/g["default"];h.tokenize=function(a){return a.slice()},h.join=h.removeEmpty=function(a){return a}},/* 10 */
  219. /***/
  220. function(a,b,c){/*istanbul ignore start*/
  221. "use strict";function d(a){return a&&a.__esModule?a:{"default":a}}/*istanbul ignore end*/
  222. function e(a,b){/**
  223. * Checks if the hunk exactly fits on the provided location
  224. */
  225. function c(a,b){for(var c=0;c<a.lines.length;c++){var d=a.lines[c],f=d.length>0?d[0]:" ",g=d.length>0?d.substr(1):d;if(" "===f||"-"===f){
  226. // Context sanity check
  227. if(!j(b+1,e[b],f,g)&&(k++,k>l))return!1;b++}}return!0}/*istanbul ignore start*/
  228. var/*istanbul ignore end*/d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof b&&(b=/*istanbul ignore start*/(0,g.parsePatch)(b)),Array.isArray(b)){if(b.length>1)throw new Error("applyPatch only works with a single input.");b=b[0]}
  229. // Search best fit offsets for each hunk based on the previous ones
  230. for(var e=a.split(/\r\n|[\n\v\f\r\x85]/),f=a.match(/\r\n|[\n\v\f\r\x85]/g)||[],h=b.hunks,j=d.compareLine||function(a,b,c,d){/*istanbul ignore end*/
  231. return b===d},k=0,l=d.fuzzFactor||0,m=0,n=0,o=/*istanbul ignore start*/void 0,p=/*istanbul ignore start*/void 0,q=0;q<h.length;q++){for(var r=h[q],s=e.length-r.oldLines,t=0,u=n+r.oldStart-1,v=/*istanbul ignore start*/(0,i["default"])(u,m,s);void 0!==t;t=v())if(c(r,u+t)){r.offset=n+=t;break}if(void 0===t)return!1;
  232. // Set lower text limit to end of the current hunk, so next ones don't try
  233. // to fit over already patched text
  234. m=r.offset+r.oldStart+r.oldLines}for(var w=0,x=0;x<h.length;x++){var y=h[x],z=y.oldStart+y.offset+w-1;w+=y.newLines-y.oldLines,z<0&&(
  235. // Creating a new file
  236. z=0);for(var A=0;A<y.lines.length;A++){var B=y.lines[A],C=B.length>0?B[0]:" ",D=B.length>0?B.substr(1):B,E=y.linedelimiters[A];if(" "===C)z++;else if("-"===C)e.splice(z,1),f.splice(z,1);else if("+"===C)e.splice(z,0,D),f.splice(z,0,E),z++;else if("\\"===C){var F=y.lines[A-1]?y.lines[A-1][0]:null;"+"===F?o=!0:"-"===F&&(p=!0)}}}
  237. // Handle EOFNL insertion/removal
  238. if(o)for(;!e[e.length-1];)e.pop(),f.pop();else p&&(e.push(""),f.push("\n"));for(var G=0;G<e.length-1;G++)e[G]=e[G]+f[G];return e.join("")}
  239. // Wrapper that supports multiple file patches via callbacks.
  240. function f(a,b){function c(){var f=a[d++];return f?void b.loadFile(f,function(a,d){if(a)return b.complete(a);var g=e(d,f,b);b.patched(f,g,function(a){return a?b.complete(a):void c()})}):b.complete()}"string"==typeof a&&(a=/*istanbul ignore start*/(0,g.parsePatch)(a));var d=0;c()}b.__esModule=!0,b.applyPatch=e,/*istanbul ignore start*/
  241. b.applyPatches=f;var/*istanbul ignore start*/g=c(11),/*istanbul ignore start*/h=c(12),i=d(h)},/* 11 */
  242. /***/
  243. function(a,b){/*istanbul ignore start*/
  244. "use strict";function c(a){function b(){var a={};
  245. // Parse diff metadata
  246. for(h.push(a);i<f.length;){var b=f[i];
  247. // File header found, end parsing diff metadata
  248. if(/^(\-\-\-|\+\+\+|@@)\s/.test(b))break;
  249. // Diff index
  250. var g=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(b);g&&(a.index=g[1]),i++}for(
  251. // Parse file headers if they are defined. Unified diff requires them, but
  252. // there's no technical issues to have an isolated hunk without file header
  253. c(a),c(a),
  254. // Parse hunks
  255. a.hunks=[];i<f.length;){var j=f[i];if(/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(j))break;if(/^@@/.test(j))a.hunks.push(d());else{if(j&&e.strict)
  256. // Ignore unexpected content unless in strict mode
  257. throw new Error("Unknown line "+(i+1)+" "+JSON.stringify(j));i++}}}
  258. // Parses the --- and +++ headers, if none are found, no lines
  259. // are consumed.
  260. function c(a){var b=/^(---|\+\+\+)\s+(.*)$/.exec(f[i]);if(b){var c="---"===b[1]?"old":"new",d=b[2].split("\t",2),e=d[0].replace(/\\\\/g,"\\");/^".*"$/.test(e)&&(e=e.substr(1,e.length-2)),a[c+"FileName"]=e,a[c+"Header"]=(d[1]||"").trim(),i++}}
  261. // Parses a hunk
  262. // This assumes that we are at the start of a hunk.
  263. function d(){for(var a=i,b=f[i++],c=b.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),d={oldStart:+c[1],oldLines:+c[2]||1,newStart:+c[3],newLines:+c[4]||1,lines:[],linedelimiters:[]},h=0,j=0;i<f.length&&!(0===f[i].indexOf("--- ")&&i+2<f.length&&0===f[i+1].indexOf("+++ ")&&0===f[i+2].indexOf("@@"));i++){var k=0==f[i].length&&i!=f.length-1?" ":f[i][0];if("+"!==k&&"-"!==k&&" "!==k&&"\\"!==k)break;d.lines.push(f[i]),d.linedelimiters.push(g[i]||"\n"),"+"===k?h++:"-"===k?j++:" "===k&&(h++,j++)}
  264. // Perform optional sanity checking
  265. if(
  266. // Handle the empty block count case
  267. h||1!==d.newLines||(d.newLines=0),j||1!==d.oldLines||(d.oldLines=0),e.strict){if(h!==d.newLines)throw new Error("Added line count did not match for hunk at line "+(a+1));if(j!==d.oldLines)throw new Error("Removed line count did not match for hunk at line "+(a+1))}return d}for(/*istanbul ignore start*/
  268. var/*istanbul ignore end*/e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=a.split(/\r\n|[\n\v\f\r\x85]/),g=a.match(/\r\n|[\n\v\f\r\x85]/g)||[],h=[],i=0;i<f.length;)b();return h}b.__esModule=!0,b.parsePatch=c},/* 12 */
  269. /***/
  270. function(a,b){/*istanbul ignore start*/
  271. "use strict";b.__esModule=!0,b["default"]=/*istanbul ignore end*/function(a,b,c){var d=!0,e=!1,f=!1,g=1;return function h(){if(d&&!f){
  272. // Check if trying to fit beyond text length, and if not, check it fits
  273. // after offset location (or desired location on first iteration)
  274. if(e?g++:d=!1,a+g<=c)return g;f=!0}if(!e)
  275. // Check if trying to fit before text beginning, and if not, check it fits
  276. // before offset location
  277. // Check if trying to fit before text beginning, and if not, check it fits
  278. // before offset location
  279. return f||(d=!0),b<=a-g?-g++:(e=!0,h())}}},/* 13 */
  280. /***/
  281. function(a,b,c){/*istanbul ignore start*/
  282. "use strict";/*istanbul ignore start*/
  283. function d(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}/*istanbul ignore end*/
  284. function e(a){/*istanbul ignore start*/
  285. var b=/*istanbul ignore end*/v(a.lines),c=b.oldLines,d=b.newLines;void 0!==c?a.oldLines=c:delete a.oldLines,void 0!==d?a.newLines=d:delete a.newLines}function f(a,b,c){a=g(a,c),b=g(b,c);var d={};
  286. // For index we just let it pass through as it doesn't have any necessary meaning.
  287. // Leaving sanity checks on this to the API consumer that may know more about the
  288. // meaning in their own context.
  289. (a.index||b.index)&&(d.index=a.index||b.index),(a.newFileName||b.newFileName)&&(h(a)?h(b)?(
  290. // Both changed... figure it out
  291. d.oldFileName=i(d,a.oldFileName,b.oldFileName),d.newFileName=i(d,a.newFileName,b.newFileName),d.oldHeader=i(d,a.oldHeader,b.oldHeader),d.newHeader=i(d,a.newHeader,b.newHeader)):(
  292. // No header or no change in theirs, use ours
  293. d.oldFileName=a.oldFileName,d.newFileName=a.newFileName,d.oldHeader=a.oldHeader,d.newHeader=a.newHeader):(
  294. // No header or no change in ours, use theirs (and ours if theirs does not exist)
  295. d.oldFileName=b.oldFileName||a.oldFileName,d.newFileName=b.newFileName||a.newFileName,d.oldHeader=b.oldHeader||a.oldHeader,d.newHeader=b.newHeader||a.newHeader)),d.hunks=[];for(var e=0,f=0,m=0,n=0;e<a.hunks.length||f<b.hunks.length;){var o=a.hunks[e]||{oldStart:1/0},p=b.hunks[f]||{oldStart:1/0};if(j(o,p))
  296. // This patch does not overlap with any of the others, yay.
  297. d.hunks.push(k(o,m)),e++,n+=o.newLines-o.oldLines;else if(j(p,o))
  298. // This patch does not overlap with any of the others, yay.
  299. d.hunks.push(k(p,n)),f++,m+=p.newLines-p.oldLines;else{
  300. // Overlap, merge as best we can
  301. var q={oldStart:Math.min(o.oldStart,p.oldStart),oldLines:0,newStart:Math.min(o.newStart+m,p.oldStart+n),newLines:0,lines:[]};l(q,o.oldStart,o.lines,p.oldStart,p.lines),f++,e++,d.hunks.push(q)}}return d}function g(a,b){if("string"==typeof a){if(/^@@/m.test(a)||/^Index:/m.test(a))/*istanbul ignore start*/
  302. return(0,x.parsePatch)(a)[0];if(!b)throw new Error("Must provide a base reference or pass in a patch");/*istanbul ignore start*/
  303. return(0,w.structuredPatch)(void 0,void 0,b,a)}return a}function h(a){return a.newFileName&&a.newFileName!==a.oldFileName}function i(a,b,c){return b===c?b:(a.conflict=!0,{mine:b,theirs:c})}function j(a,b){return a.oldStart<b.oldStart&&a.oldStart+a.oldLines<b.oldStart}function k(a,b){return{oldStart:a.oldStart,oldLines:a.oldLines,newStart:a.newStart+b,newLines:a.newLines,lines:a.lines}}function l(a,b,c,f,g){
  304. // This will generally result in a conflicted hunk, but there are cases where the context
  305. // is the only overlap where we can successfully merge the content here.
  306. var h={offset:b,lines:c,index:0},i={offset:f,lines:g,index:0};
  307. // Now in the overlap content. Scan through and select the best changes from each.
  308. for(
  309. // Handle any leading content
  310. p(a,h,i),p(a,i,h);h.index<h.lines.length&&i.index<i.lines.length;){var j=h.lines[h.index],k=i.lines[i.index];if("-"!==j[0]&&"+"!==j[0]||"-"!==k[0]&&"+"!==k[0])if("+"===j[0]&&" "===k[0]){/*istanbul ignore start*/
  311. var l;/*istanbul ignore end*/
  312. // Mine inserted
  313. /*istanbul ignore start*/
  314. (l=/*istanbul ignore end*/a.lines).push.apply(/*istanbul ignore start*/l,/*istanbul ignore start*/d(/*istanbul ignore end*/r(h)))}else if("+"===k[0]&&" "===j[0]){/*istanbul ignore start*/
  315. var s;/*istanbul ignore end*/
  316. // Theirs inserted
  317. /*istanbul ignore start*/
  318. (s=/*istanbul ignore end*/a.lines).push.apply(/*istanbul ignore start*/s,/*istanbul ignore start*/d(/*istanbul ignore end*/r(i)))}else"-"===j[0]&&" "===k[0]?
  319. // Mine removed or edited
  320. n(a,h,i):"-"===k[0]&&" "===j[0]?
  321. // Their removed or edited
  322. n(a,i,h,!0):j===k?(
  323. // Context identity
  324. a.lines.push(j),h.index++,i.index++):
  325. // Context mismatch
  326. o(a,r(h),r(i));else
  327. // Both modified ...
  328. m(a,h,i)}
  329. // Now push anything that may be remaining
  330. q(a,h),q(a,i),e(a)}function m(a,b,c){var e=r(b),f=r(c);if(t(e)&&t(f)){
  331. // Special case for remove changes that are supersets of one another
  332. if(/*istanbul ignore start*/(0,y.arrayStartsWith)(e,f)&&u(c,e,e.length-f.length)){/*istanbul ignore start*/
  333. var g;/*istanbul ignore end*/
  334. /*istanbul ignore start*/
  335. /*istanbul ignore end*/
  336. /*istanbul ignore start*/
  337. /*istanbul ignore start*/
  338. /*istanbul ignore end*/
  339. return void(g=a.lines).push.apply(g,d(e))}if(/*istanbul ignore start*/(0,y.arrayStartsWith)(f,e)&&u(b,f,f.length-e.length)){/*istanbul ignore start*/
  340. var h;/*istanbul ignore end*/
  341. /*istanbul ignore start*/
  342. /*istanbul ignore end*/
  343. /*istanbul ignore start*/
  344. /*istanbul ignore start*/
  345. /*istanbul ignore end*/
  346. return void(h=a.lines).push.apply(h,d(f))}}else if(/*istanbul ignore start*/(0,y.arrayEqual)(e,f)){/*istanbul ignore start*/
  347. var i;/*istanbul ignore end*/
  348. /*istanbul ignore start*/
  349. /*istanbul ignore end*/
  350. /*istanbul ignore start*/
  351. /*istanbul ignore start*/
  352. /*istanbul ignore end*/
  353. return void(i=a.lines).push.apply(i,d(e))}o(a,e,f)}function n(a,b,c,e){var f=r(b),g=s(c,f);if(g.merged){/*istanbul ignore start*/
  354. var h;/*istanbul ignore end*/
  355. /*istanbul ignore start*/
  356. (h=/*istanbul ignore end*/a.lines).push.apply(/*istanbul ignore start*/h,/*istanbul ignore start*/d(/*istanbul ignore end*/g.merged))}else o(a,e?g:f,e?f:g)}function o(a,b,c){a.conflict=!0,a.lines.push({conflict:!0,mine:b,theirs:c})}function p(a,b,c){for(;b.offset<c.offset&&b.index<b.lines.length;){var d=b.lines[b.index++];a.lines.push(d),b.offset++}}function q(a,b){for(;b.index<b.lines.length;){var c=b.lines[b.index++];a.lines.push(c)}}function r(a){for(var b=[],c=a.lines[a.index][0];a.index<a.lines.length;){var d=a.lines[a.index];if(
  357. // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
  358. "-"===c&&"+"===d[0]&&(c="+"),c!==d[0])break;b.push(d),a.index++}return b}function s(a,b){for(var c=[],d=[],e=0,f=!1,g=!1;e<b.length&&a.index<a.lines.length;){var h=a.lines[a.index],i=b[e];
  359. // Once we've hit our add, then we are done
  360. if("+"===i[0])break;
  361. // Consume any additions in the other block as a conflict to attempt
  362. // to pull in the remaining context after this
  363. if(f=f||" "!==h[0],d.push(i),e++,"+"===h[0])for(g=!0;"+"===h[0];)c.push(h),h=a.lines[++a.index];i.substr(1)===h.substr(1)?(c.push(h),a.index++):g=!0}if("+"===(b[e]||"")[0]&&f&&(g=!0),g)return c;for(;e<b.length;)d.push(b[e++]);return{merged:d,changes:c}}function t(a){return a.reduce(function(a,b){return a&&"-"===b[0]},!0)}function u(a,b,c){for(var d=0;d<c;d++){var e=b[b.length-c+d].substr(1);if(a.lines[a.index+d]!==" "+e)return!1}return a.index+=c,!0}function v(a){var b=0,c=0;return a.forEach(function(a){if("string"!=typeof a){var d=v(a.mine),e=v(a.theirs);void 0!==b&&(d.oldLines===e.oldLines?b+=d.oldLines:b=void 0),void 0!==c&&(d.newLines===e.newLines?c+=d.newLines:c=void 0)}else void 0===c||"+"!==a[0]&&" "!==a[0]||c++,void 0===b||"-"!==a[0]&&" "!==a[0]||b++}),{oldLines:b,newLines:c}}b.__esModule=!0,b.calcLineCount=e,/*istanbul ignore start*/
  364. b.merge=f;var/*istanbul ignore start*/w=c(14),/*istanbul ignore start*/x=c(11),/*istanbul ignore start*/y=c(15)},/* 14 */
  365. /***/
  366. function(a,b,c){/*istanbul ignore start*/
  367. "use strict";/*istanbul ignore start*/
  368. function d(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}/*istanbul ignore end*/
  369. function e(a,b,c,e,f,g,i){// Append an empty value to make cleanup easier
  370. function j(a){return a.map(function(a){return" "+a})}i||(i={}),"undefined"==typeof i.context&&(i.context=4);var k=/*istanbul ignore start*/(0,h.diffLines)(c,e,i);k.push({value:"",lines:[]});for(var l=[],m=0,n=0,o=[],p=1,q=1,r=function(/*istanbul ignore end*/a){var b=k[a],f=b.lines||b.value.replace(/\n$/,"").split("\n");if(b.lines=f,b.added||b.removed){/*istanbul ignore start*/
  371. var g;/*istanbul ignore end*/
  372. // If we have previous context, start with that
  373. if(!m){var h=k[a-1];m=p,n=q,h&&(o=i.context>0?j(h.lines.slice(-i.context)):[],m-=o.length,n-=o.length)}
  374. // Output our changes
  375. /*istanbul ignore start*/
  376. (g=/*istanbul ignore end*/o).push.apply(/*istanbul ignore start*/g,/*istanbul ignore start*/d(/*istanbul ignore end*/f.map(function(a){return(b.added?"+":"-")+a}))),
  377. // Track the updated file position
  378. b.added?q+=f.length:p+=f.length}else{
  379. // Identical context lines. Track line changes
  380. if(m)
  381. // Close out any changes that have been output (or join overlapping)
  382. if(f.length<=2*i.context&&a<k.length-2){/*istanbul ignore start*/
  383. var r;/*istanbul ignore end*/
  384. // Overlapping
  385. /*istanbul ignore start*/
  386. (r=/*istanbul ignore end*/o).push.apply(/*istanbul ignore start*/r,/*istanbul ignore start*/d(/*istanbul ignore end*/j(f)))}else{/*istanbul ignore start*/
  387. var s,t=Math.min(f.length,i.context);/*istanbul ignore start*/
  388. (s=/*istanbul ignore end*/o).push.apply(/*istanbul ignore start*/s,/*istanbul ignore start*/d(/*istanbul ignore end*/j(f.slice(0,t))));var u={oldStart:m,oldLines:p-m+t,newStart:n,newLines:q-n+t,lines:o};if(a>=k.length-2&&f.length<=i.context){
  389. // EOF is inside this hunk
  390. var v=/\n$/.test(c),w=/\n$/.test(e);0!=f.length||v?v&&w||o.push("\\ No newline at end of file"):
  391. // special case: old has no eol and no trailing context; no-nl can end up before adds
  392. o.splice(u.oldLines,0,"\\ No newline at end of file")}l.push(u),m=0,n=0,o=[]}p+=f.length,q+=f.length}},s=0;s<k.length;s++)/*istanbul ignore start*/
  393. r(/*istanbul ignore end*/s);return{oldFileName:a,newFileName:b,oldHeader:f,newHeader:g,hunks:l}}function f(a,b,c,d,f,g,h){var i=e(a,b,c,d,f,g,h),j=[];a==b&&j.push("Index: "+a),j.push("==================================================================="),j.push("--- "+i.oldFileName+("undefined"==typeof i.oldHeader?"":"\t"+i.oldHeader)),j.push("+++ "+i.newFileName+("undefined"==typeof i.newHeader?"":"\t"+i.newHeader));for(var k=0;k<i.hunks.length;k++){var l=i.hunks[k];j.push("@@ -"+l.oldStart+","+l.oldLines+" +"+l.newStart+","+l.newLines+" @@"),j.push.apply(j,l.lines)}return j.join("\n")+"\n"}function g(a,b,c,d,e,g){return f(a,a,b,c,d,e,g)}b.__esModule=!0,b.structuredPatch=e,/*istanbul ignore start*/
  394. b.createTwoFilesPatch=f,/*istanbul ignore start*/
  395. b.createPatch=g;var/*istanbul ignore start*/h=c(5)},/* 15 */
  396. /***/
  397. function(a,b){/*istanbul ignore start*/
  398. "use strict";function c(a,b){return a.length===b.length&&d(a,b)}function d(a,b){if(b.length>a.length)return!1;for(var c=0;c<b.length;c++)if(b[c]!==a[c])return!1;return!0}b.__esModule=!0,b.arrayEqual=c,/*istanbul ignore start*/
  399. b.arrayStartsWith=d},/* 16 */
  400. /***/
  401. function(a,b){/*istanbul ignore start*/
  402. "use strict";
  403. // See: http://code.google.com/p/google-diff-match-patch/wiki/API
  404. function c(a){for(var b=[],c=/*istanbul ignore start*/void 0,d=/*istanbul ignore start*/void 0,e=0;e<a.length;e++)c=a[e],d=c.added?1:c.removed?-1:0,b.push([d,c.value]);return b}b.__esModule=!0,b.convertChangesToDMP=c},/* 17 */
  405. /***/
  406. function(a,b){/*istanbul ignore start*/
  407. "use strict";function c(a){for(var b=[],c=0;c<a.length;c++){var e=a[c];e.added?b.push("<ins>"):e.removed&&b.push("<del>"),b.push(d(e.value)),e.added?b.push("</ins>"):e.removed&&b.push("</del>")}return b.join("")}function d(a){var b=a;return b=b.replace(/&/g,"&amp;"),b=b.replace(/</g,"&lt;"),b=b.replace(/>/g,"&gt;"),b=b.replace(/"/g,"&quot;")}b.__esModule=!0,b.convertChangesToXML=c}])});