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.
 
 
 
 

1 lines
172 KiB

{"version":3,"sources":["/source-files/jsondiffpatch/node_modules/fiberglass/node_modules/browserify/node_modules/browser-pack/_prelude.js","/source-files/jsondiffpatch/src/main-full.js","/source-files/jsondiffpatch/src/environment.js","/source-files/jsondiffpatch/src/main.js","/source-files/jsondiffpatch/public/external/diff_match_patch_uncompressed.js","/source-files/jsondiffpatch/src/diffpatcher.js","/source-files/jsondiffpatch/src/date-reviver.js","/source-files/jsondiffpatch/src/processor.js","/source-files/jsondiffpatch/src/pipe.js","/source-files/jsondiffpatch/src/contexts/diff.js","/source-files/jsondiffpatch/src/contexts/patch.js","/source-files/jsondiffpatch/src/contexts/reverse.js","/source-files/jsondiffpatch/src/filters/trivial.js","/source-files/jsondiffpatch/src/clone.js","/source-files/jsondiffpatch/src/filters/nested.js","/source-files/jsondiffpatch/src/filters/arrays.js","/source-files/jsondiffpatch/src/filters/dates.js","/source-files/jsondiffpatch/src/filters/texts.js","/source-files/jsondiffpatch/src/contexts/context.js","/source-files/jsondiffpatch/src/filters/lcs.js"],"names":["environment","require","isBrowser","window","diff_match_patch","module","exports","DiffPatcher","create","options","dateReviver","defaultInstance","diff","apply","arguments","patch","unpatch","reverse","clone","homepage","version","packageInfoModuleName","packageInfo","formatterModuleName","formatters","console","this","Diff_Timeout","Diff_EditCost","Match_Threshold","Match_Distance","Patch_DeleteThreshold","Patch_Margin","Match_MaxBits","DIFF_DELETE","DIFF_INSERT","DIFF_EQUAL","Diff","prototype","diff_main","text1","text2","opt_checklines","opt_deadline","Number","MAX_VALUE","Date","getTime","deadline","Error","checklines","commonlength","diff_commonPrefix","commonprefix","substring","diff_commonSuffix","commonsuffix","length","diffs","diff_compute_","unshift","push","diff_cleanupMerge","longtext","shorttext","i","indexOf","hm","diff_halfMatch_","text1_a","text1_b","text2_a","text2_b","mid_common","diffs_a","diffs_b","concat","diff_lineMode_","diff_bisect_","a","diff_linesToChars_","linearray","diff_charsToLines_","diff_cleanupSemantic","pointer","count_delete","count_insert","text_delete","text_insert","splice","j","pop","text1_length","text2_length","max_d","Math","ceil","v_offset","v_length","v1","Array","v2","x","delta","front","k1start","k1end","k2start","k2end","d","k1","x1","k1_offset","y1","charAt","k2_offset","x2","diff_bisectSplit_","k2","y2","y","text1a","text2a","text1b","text2b","diffsb","diff_linesToCharsMunge_","text","chars","lineStart","lineEnd","lineArrayLength","lineArray","line","lineHash","hasOwnProperty","undefined","String","fromCharCode","chars1","chars2","charCodeAt","join","pointermin","pointermax","min","pointermid","pointerstart","floor","pointerend","diff_commonOverlap_","text_length","best","pattern","found","diff_halfMatchI_","best_longtext_a","best_longtext_b","best_shorttext_a","best_shorttext_b","seed","best_common","prefixLength","dmp","suffixLength","hm1","hm2","changes","equalities","equalitiesLength","lastequality","length_insertions1","length_deletions1","length_insertions2","length_deletions2","max","diff_cleanupSemanticLossless","deletion","insertion","overlap_length","diff_cleanupSemanticScore_","one","two","score","match","punctuation","whitespace","linebreak","blanklineEnd","blanklineStart","equality1","edit","equality2","commonOffset","commonString","bestEquality1","bestEdit","bestEquality2","bestScore","diff_cleanupEfficiency","pre_ins","pre_del","post_ins","post_del","diff_xIndex","loc","last_chars1","last_chars2","diff_prettyHtml","html","pattern_amp","pattern_lt","pattern_gt","pattern_para","op","data","replace","diff_text1","diff_text2","diff_levenshtein","levenshtein","insertions","deletions","diff_toDelta","encodeURI","diff_fromDelta","diffsLength","tokens","split","param","decodeURI","ex","n","parseInt","isNaN","match_main","match_bitap_","match_bitapScore_","e","accuracy","proximity","abs","s","match_alphabet_","score_threshold","best_loc","lastIndexOf","matchmask","bin_min","bin_mid","last_rd","bin_max","start","finish","rd","charMatch","patch_addContext_","start2","length1","padding","prefix","suffix","start1","length2","patch_make","opt_b","opt_c","patches","patch_obj","patchDiffLength","char_count1","char_count2","prepatch_text","postpatch_text","diff_type","diff_text","patch_deepCopy","patchesCopy","patchCopy","slice","patch_apply","nullPadding","patch_addPadding","patch_splitMax","results","start_loc","expected_loc","end_loc","index2","index1","mod","paddingLength","extraLength","patch_size","bigpatch","precontext","empty","shift","postcontext","patch_toText","patch_fromText","textline","textPointer","patchHeader","m","sign","toString","coords1","coords2","Processor","Pipe","DiffContext","PatchContext","ReverseContext","trivial","nested","arrays","dates","texts","processor","pipe","append","collectChildrenDiffFilter","diffFilter","objectsDiffFilter","shouldHaveResult","collectChildrenPatchFilter","patchFilter","collectChildrenReverseFilter","reverseFilter","left","right","process","value","key","parts","exec","UTC","selfOptions","pipes","name","input","context","lastPipe","lastContext","nextPipe","nextAfterChildren","next","hasResult","result","filters","debug","index","filter","log","filterName","exiting","resultCheck","msg","prepend","list","names","after","params","call","before","clear","should","error","noResult","Context","defaultClone","setResult","cloneDiffValues","isArray","exit","leftType","rightType","leftIsArray","rightIsArray","RegExp","regexArgs","cloneRegExp","re","regexMatch","arg","map","cloned","Object","children","child","childName","_t","propertyFilter","arraysHaveMatchByRef","array1","array2","len1","len2","val1","val2","matchItems","value1","value2","objectHash","matchByPosition","hash1","hash2","hashCache1","hashCache2","lcs","ARRAY_MOVE","arrayIndexOf","array","item","matchContext","commonHead","commonTail","trimmed1","trimmed2","seq","get","removedItems","indices1","detectMove","includeValueOnMove","removedItemsLength","indexOnArray2","indices2","isMove","removeItemIndex1","compare","numerically","b","numericallyBy","toRemove","toInsert","toModify","sort","indexDiff","removedValue","toInsertLength","toModifyLength","modification","newName","substr","reverseArrayDeltaIndex","itemDelta","reverseIndex","deltaIndex","deltaItem","moveFromIndex","moveToIndex","deleteIndex","TEXT_DIFF","DEFAULT_MIN_LENGTH","cachedDiffPatch","getDiffMatchPatch","required","instance","dmpModuleName","err","diff_match_patch_not_found","txt1","txt2","textPatchFailed","minLength","textDiff","diffMatchPatch","textDeltaReverse","l","lines","lineTmp","lineHeader","lineAdd","lineRemove","header","headerRegex","switchTo","parent","root","defaultMatch","lengthMatrix","matrix","backtrack","sequence","subsequence"],"mappings":"AAAA;ACAA,GA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Q,GAAI/T,OAAM+Q,EAAKoB,KAAO,UAElC,MADA4B,GAAMC,UAAW,EACXD,IAGHtV,OAGTpB,QAAQgT,KAAOA;;AD9Gf,GAAID,WAAY,SAAmB5S,GACjCiB,KAAKwT,YAAczU,MACnBiB,KAAKyT,SAGP9B,WAAU/Q,UAAU7B,QAAU,SAASA,GAIrC,MAHIA,KACFiB,KAAKwT,YAAczU,GAEdiB,KAAKwT,aAGd7B,UAAU/Q,UAAU0R,KAAO,SAASoB,EAAMpB,GACxC,GAAoB,gBAAToB,GAAmB,CAC5B,GAAoB,mBAATpB,GACT,MAAOtS,MAAKyT,MAAMC,EAElB1T,MAAKyT,MAAMC,GAAQpB,EAGvB,GAAIoB,GAAQA,EAAKA,KAAM,CAErB,GADApB,EAAOoB,EACHpB,EAAKD,YAAcrS,KAAQ,MAAOsS,EACtCtS,MAAKyT,MAAMnB,EAAKoB,MAAQpB,EAG1B,MADAA,GAAKD,UAAYrS,KACVsS,GAGTX,UAAU/Q,UAAUsS,QAAU,SAASS,EAAOrB,GAC5C,GAAIsB,GAAUD,CACdC,GAAQ7U,QAAUiB,KAAKjB,SAGvB,KAFA,GACI8U,GAAUC,EADVC,EAAWzB,GAAQqB,EAAMrB,MAAQ,UAE9ByB,GACoC,mBAA9BH,GAAQI,oBAEjBJ,EAAQK,KAAOL,EAAQI,kBACvBJ,EAAQI,kBAAoB,MAGN,gBAAbD,KACTA,EAAW/T,KAAKsS,KAAKyB,IAEvBA,EAASb,QAAQU,GACjBE,EAAcF,EACdC,EAAWE,EACXA,EAAW,KACPH,GACEA,EAAQK,OACVL,EAAUA,EAAQK,KAClBF,EAAWD,EAAYC,UAAYH,EAAQtB,MAAQuB,EAIzD,OAAOD,GAAQM,UAAYN,EAAQO,OAASrN,QAG9ClI,QAAQ+S,UAAYA","file":"bundle.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})","var environment = require('./environment');\n\nif (environment.isBrowser) {\n /* global window */\n /* jshint camelcase: false */\n window.diff_match_patch = require('../public/external/diff_match_patch_uncompressed');\n /* jshint camelcase: true */\n}\n\nmodule.exports = require('./main');\n","\nexports.isBrowser = typeof window !== 'undefined';\n","\nvar environment = require('./environment');\n\nvar DiffPatcher = require('./diffpatcher').DiffPatcher;\nexports.DiffPatcher = DiffPatcher;\n\nexports.create = function(options){\n return new DiffPatcher(options);\n};\n\nexports.dateReviver = require('./date-reviver');\n\nvar defaultInstance;\n\nexports.diff = function() {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.diff.apply(defaultInstance, arguments);\n};\n\nexports.patch = function() {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.patch.apply(defaultInstance, arguments);\n};\n\nexports.unpatch = function() {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.unpatch.apply(defaultInstance, arguments);\n};\n\nexports.reverse = function() {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.reverse.apply(defaultInstance, arguments);\n};\n\nexports.clone = function() {\n if (!defaultInstance) {\n defaultInstance = new DiffPatcher();\n }\n return defaultInstance.clone.apply(defaultInstance, arguments);\n};\n\n\nif (environment.isBrowser) {\n exports.homepage = '{{package-homepage}}';\n exports.version = '{{package-version}}';\n} else {\n var packageInfoModuleName = '../package.json';\n var packageInfo = require(packageInfoModuleName);\n exports.homepage = packageInfo.homepage;\n exports.version = packageInfo.version;\n\n var formatterModuleName = './formatters';\n var formatters = require(formatterModuleName);\n exports.formatters = formatters;\n // shortcut for console\n exports.console = formatters.console;\n}\n","/**\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @fileoverview Computes the difference between two texts to create a patch.\n * Applies the patch onto another text, allowing for errors.\n * @author fraser@google.com (Neil Fraser)\n */\n\n/**\n * Class containing the diff, match and patch methods.\n * @constructor\n */\nfunction diff_match_patch() {\n\n // Defaults.\n // Redefine these in your program to override the defaults.\n\n // Number of seconds to map a diff before giving up (0 for infinity).\n this.Diff_Timeout = 1.0;\n // Cost of an empty edit operation in terms of edit characters.\n this.Diff_EditCost = 4;\n // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n this.Match_Threshold = 0.5;\n // How far to search for a match (0 = exact location, 1000+ = broad match).\n // A match this many characters away from the expected location will add\n // 1.0 to the score (0.0 is a perfect match).\n this.Match_Distance = 1000;\n // When deleting a large block of text (over ~64 characters), how close does\n // the contents have to match the expected contents. (0.0 = perfection,\n // 1.0 = very loose). Note that Match_Threshold controls how closely the\n // end points of a delete need to match.\n this.Patch_DeleteThreshold = 0.5;\n // Chunk size for context length.\n this.Patch_Margin = 4;\n\n // The number of bits in an int.\n this.Match_MaxBits = 32;\n}\n\n\n// DIFF FUNCTIONS\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n/** @typedef {!Array.<number|string>} */\ndiff_match_patch.Diff;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {boolean=} opt_checklines Optional speedup flag. If present and false,\n * then don't run a line-level diff first to identify the changed areas.\n * Defaults to true, which does a faster, slightly less optimal diff.\n * @param {number} opt_deadline Optional time when the diff should be complete\n * by. Used internally for recursive calls. Users should set DiffTimeout\n * instead.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,\n opt_deadline) {\n // Set a deadline by which time the diff must be complete.\n if (typeof opt_deadline == 'undefined') {\n if (this.Diff_Timeout <= 0) {\n opt_deadline = Number.MAX_VALUE;\n } else {\n opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000;\n }\n }\n var deadline = opt_deadline;\n\n // Check for null inputs.\n if (text1 == null || text2 == null) {\n throw new Error('Null input. (diff_main)');\n }\n\n // Check for equality (speedup).\n if (text1 == text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n if (typeof opt_checklines == 'undefined') {\n opt_checklines = true;\n }\n var checklines = opt_checklines;\n\n // Trim off common prefix (speedup).\n var commonlength = this.diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = this.diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = this.diff_compute_(text1, text2, checklines, deadline);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n this.diff_cleanupMerge(diffs);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {boolean} checklines Speedup flag. If false, then don't run a\n * line-level diff first to identify the changed areas.\n * If true, then run a faster, slightly less optimal diff.\n * @param {number} deadline Time when the diff should be complete by.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,\n deadline) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i != -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [[DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length == 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n longtext = shorttext = null; // Garbage collect.\n\n // Check to see if the problem can be split in two.\n var hm = this.diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);\n var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n if (checklines && text1.length > 100 && text2.length > 100) {\n return this.diff_lineMode_(text1, text2, deadline);\n }\n\n return this.diff_bisect_(text1, text2, deadline);\n};\n\n\n/**\n * Do a quick line-level diff on both strings, then rediff the parts for\n * greater accuracy.\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} deadline Time when the diff should be complete by.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {\n // Scan the text on a line-by-line basis first.\n var a = this.diff_linesToChars_(text1, text2);\n text1 = /** @type {string} */(a[0]);\n text2 = /** @type {string} */(a[1]);\n var linearray = /** @type {!Array.<string>} */(a[2]);\n\n var diffs = this.diff_bisect_(text1, text2, deadline);\n\n // Convert the diff back to original text.\n this.diff_charsToLines_(diffs, linearray);\n // Eliminate freak matches (e.g. blank lines)\n this.diff_cleanupSemantic(diffs);\n\n // Rediff any replacement blocks, this time character-by-character.\n // Add a dummy entry at the end.\n diffs.push([DIFF_EQUAL, '']);\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n while (pointer < diffs.length) {\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n count_insert++;\n text_insert += diffs[pointer][1];\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n break;\n case DIFF_EQUAL:\n // Upon reaching an equality, check for prior redundancies.\n if (count_delete >= 1 && count_insert >= 1) {\n // Delete the offending records and add the merged ones.\n var a = this.diff_main(text_delete, text_insert, false, deadline);\n diffs.splice(pointer - count_delete - count_insert,\n count_delete + count_insert);\n pointer = pointer - count_delete - count_insert;\n for (var j = a.length - 1; j >= 0; j--) {\n diffs.splice(pointer, 0, a[j]);\n }\n pointer = pointer + a.length;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n pointer++;\n }\n diffs.pop(); // Remove the dummy entry at the end.\n\n return diffs;\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} deadline Time at which to bail if not yet complete.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 != 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Bail out if deadline is reached.\n if ((new Date()).getTime() > deadline) {\n break;\n }\n\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 == -d || k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1]) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) == text2.charAt(y1)) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 == -d || k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1]) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) ==\n text2.charAt(text2_length - y2 - 1)) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @param {number} deadline Time at which to bail if not yet complete.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @private\n */\ndiff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y,\n deadline) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = this.diff_main(text1a, text2a, false, deadline);\n var diffsb = this.diff_main(text1b, text2b, false, deadline);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Split two texts into an array of strings. Reduce the texts to a string of\n * hashes where each Unicode character represents one line.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {!Array.<string|!Array.<string>>} Three element Array, containing the\n * encoded text1, the encoded text2 and the array of unique strings. The\n * zeroth element of the array of unique strings is intentionally blank.\n * @private\n */\ndiff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {\n var lineArray = []; // e.g. lineArray[4] == 'Hello\\n'\n var lineHash = {}; // e.g. lineHash['Hello\\n'] == 4\n\n // '\\x00' is a valid character, but various debuggers don't like it.\n // So we'll insert a junk entry to avoid generating a null character.\n lineArray[0] = '';\n\n /**\n * Split a text into an array of strings. Reduce the texts to a string of\n * hashes where each Unicode character represents one line.\n * Modifies linearray and linehash through being a closure.\n * @param {string} text String to encode.\n * @return {string} Encoded string.\n * @private\n */\n function diff_linesToCharsMunge_(text) {\n var chars = '';\n // Walk the text, pulling out a substring for each line.\n // text.split('\\n') would would temporarily double our memory footprint.\n // Modifying text would create many large strings to garbage collect.\n var lineStart = 0;\n var lineEnd = -1;\n // Keeping our own length variable is faster than looking it up.\n var lineArrayLength = lineArray.length;\n while (lineEnd < text.length - 1) {\n lineEnd = text.indexOf('\\n', lineStart);\n if (lineEnd == -1) {\n lineEnd = text.length - 1;\n }\n var line = text.substring(lineStart, lineEnd + 1);\n lineStart = lineEnd + 1;\n\n if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :\n (lineHash[line] !== undefined)) {\n chars += String.fromCharCode(lineHash[line]);\n } else {\n chars += String.fromCharCode(lineArrayLength);\n lineHash[line] = lineArrayLength;\n lineArray[lineArrayLength++] = line;\n }\n }\n return chars;\n }\n\n var chars1 = diff_linesToCharsMunge_(text1);\n var chars2 = diff_linesToCharsMunge_(text2);\n return [chars1, chars2, lineArray];\n};\n\n\n/**\n * Rehydrate the text in a diff from a string of line hashes to real lines of\n * text.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @param {!Array.<string>} lineArray Array of unique strings.\n * @private\n */\ndiff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {\n for (var x = 0; x < diffs.length; x++) {\n var chars = diffs[x][1];\n var text = [];\n for (var y = 0; y < chars.length; y++) {\n text[y] = lineArray[chars.charCodeAt(y)];\n }\n diffs[x][1] = text.join('');\n }\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\ndiff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\ndiff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 ||\n text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n return pointermid;\n};\n\n\n/**\n * Determine if the suffix of one string is the prefix of another.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of the first\n * string and the start of the second string.\n * @private\n */\ndiff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n // Eliminate the null case.\n if (text1_length == 0 || text2_length == 0) {\n return 0;\n }\n // Truncate the longer string.\n if (text1_length > text2_length) {\n text1 = text1.substring(text1_length - text2_length);\n } else if (text1_length < text2_length) {\n text2 = text2.substring(0, text1_length);\n }\n var text_length = Math.min(text1_length, text2_length);\n // Quick check for the worst case.\n if (text1 == text2) {\n return text_length;\n }\n\n // Start by looking for a single character match\n // and increase length until no match is found.\n // Performance analysis: http://neil.fraser.name/news/2010/11/04/\n var best = 0;\n var length = 1;\n while (true) {\n var pattern = text1.substring(text_length - length);\n var found = text2.indexOf(pattern);\n if (found == -1) {\n return best;\n }\n length += found;\n if (found == 0 || text1.substring(text_length - length) ==\n text2.substring(0, length)) {\n best = length;\n length++;\n }\n }\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.<string>} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n * @private\n */\ndiff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {\n if (this.Diff_Timeout <= 0) {\n // Don't risk returning a non-optimal diff if we have unlimited time.\n return null;\n }\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n var dmp = this; // 'this' becomes 'window' in a closure.\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.<string>} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) != -1) {\n var prefixLength = dmp.diff_commonPrefix(longtext.substring(i),\n shorttext.substring(j));\n var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i),\n shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(j - suffixLength, j) +\n shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext,\n Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext,\n Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reduce the number of edits by eliminating semantically trivial equalities.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {\n var changes = false;\n var equalities = []; // Stack of indices where equalities are found.\n var equalitiesLength = 0; // Keeping our own length var is faster in JS.\n /** @type {?string} */\n var lastequality = null; // Always equal to equalities[equalitiesLength-1][1]\n var pointer = 0; // Index of current position.\n // Number of characters that changed prior to the equality.\n var length_insertions1 = 0;\n var length_deletions1 = 0;\n // Number of characters that changed after the equality.\n var length_insertions2 = 0;\n var length_deletions2 = 0;\n while (pointer < diffs.length) {\n if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.\n equalities[equalitiesLength++] = pointer;\n length_insertions1 = length_insertions2;\n length_deletions1 = length_deletions2;\n length_insertions2 = 0;\n length_deletions2 = 0;\n lastequality = /** @type {string} */(diffs[pointer][1]);\n } else { // An insertion or deletion.\n if (diffs[pointer][0] == DIFF_INSERT) {\n length_insertions2 += diffs[pointer][1].length;\n } else {\n length_deletions2 += diffs[pointer][1].length;\n }\n // Eliminate an equality that is smaller or equal to the edits on both\n // sides of it.\n if (lastequality !== null && (lastequality.length <=\n Math.max(length_insertions1, length_deletions1)) &&\n (lastequality.length <= Math.max(length_insertions2,\n length_deletions2))) {\n // Duplicate record.\n diffs.splice(equalities[equalitiesLength - 1], 0,\n [DIFF_DELETE, lastequality]);\n // Change second copy to insert.\n diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;\n // Throw away the equality we just deleted.\n equalitiesLength--;\n // Throw away the previous equality (it needs to be reevaluated).\n equalitiesLength--;\n pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;\n length_insertions1 = 0; // Reset the counters.\n length_deletions1 = 0;\n length_insertions2 = 0;\n length_deletions2 = 0;\n lastequality = null;\n changes = true;\n }\n }\n pointer++;\n }\n\n // Normalize the diff.\n if (changes) {\n this.diff_cleanupMerge(diffs);\n }\n this.diff_cleanupSemanticLossless(diffs);\n\n // Find any overlaps between deletions and insertions.\n // e.g: <del>abcxxx</del><ins>xxxdef</ins>\n // -> <del>abc</del>xxx<ins>def</ins>\n // Only extract an overlap if it is as big as the edit ahead or behind it.\n pointer = 1;\n while (pointer < diffs.length) {\n if (diffs[pointer - 1][0] == DIFF_DELETE &&\n diffs[pointer][0] == DIFF_INSERT) {\n var deletion = /** @type {string} */(diffs[pointer - 1][1]);\n var insertion = /** @type {string} */(diffs[pointer][1]);\n var overlap_length = this.diff_commonOverlap_(deletion, insertion);\n if (overlap_length >= deletion.length / 2 ||\n overlap_length >= insertion.length / 2) {\n // Overlap found. Insert an equality and trim the surrounding edits.\n diffs.splice(pointer, 0,\n [DIFF_EQUAL, insertion.substring(0, overlap_length)]);\n diffs[pointer - 1][1] =\n deletion.substring(0, deletion.length - overlap_length);\n diffs[pointer + 1][1] = insertion.substring(overlap_length);\n pointer++;\n }\n pointer++;\n }\n pointer++;\n }\n};\n\n\n/**\n * Look for single edits surrounded on both sides by equalities\n * which can be shifted sideways to align the edit to a word boundary.\n * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {\n // Define some regex patterns for matching boundaries.\n var punctuation = /[^a-zA-Z0-9]/;\n var whitespace = /\\s/;\n var linebreak = /[\\r\\n]/;\n var blanklineEnd = /\\n\\r?\\n$/;\n var blanklineStart = /^\\r?\\n\\r?\\n/;\n\n /**\n * Given two strings, compute a score representing whether the internal\n * boundary falls on logical boundaries.\n * Scores range from 5 (best) to 0 (worst).\n * Closure, makes reference to regex patterns defined above.\n * @param {string} one First string.\n * @param {string} two Second string.\n * @return {number} The score.\n * @private\n */\n function diff_cleanupSemanticScore_(one, two) {\n if (!one || !two) {\n // Edges are the best.\n return 5;\n }\n\n // Each port of this function behaves slightly differently due to\n // subtle differences in each language's definition of things like\n // 'whitespace'. Since this function's purpose is largely cosmetic,\n // the choice has been made to use each language's native features\n // rather than force total conformity.\n var score = 0;\n // One point for non-alphanumeric.\n if (one.charAt(one.length - 1).match(punctuation) ||\n two.charAt(0).match(punctuation)) {\n score++;\n // Two points for whitespace.\n if (one.charAt(one.length - 1).match(whitespace) ||\n two.charAt(0).match(whitespace)) {\n score++;\n // Three points for line breaks.\n if (one.charAt(one.length - 1).match(linebreak) ||\n two.charAt(0).match(linebreak)) {\n score++;\n // Four points for blank lines.\n if (one.match(blanklineEnd) || two.match(blanklineStart)) {\n score++;\n }\n }\n }\n }\n return score;\n }\n\n var pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] == DIFF_EQUAL &&\n diffs[pointer + 1][0] == DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n var equality1 = /** @type {string} */(diffs[pointer - 1][1]);\n var edit = /** @type {string} */(diffs[pointer][1]);\n var equality2 = /** @type {string} */(diffs[pointer + 1][1]);\n\n // First, shift the edit as far left as possible.\n var commonOffset = this.diff_commonSuffix(equality1, edit);\n if (commonOffset) {\n var commonString = edit.substring(edit.length - commonOffset);\n equality1 = equality1.substring(0, equality1.length - commonOffset);\n edit = commonString + edit.substring(0, edit.length - commonOffset);\n equality2 = commonString + equality2;\n }\n\n // Second, step character by character right, looking for the best fit.\n var bestEquality1 = equality1;\n var bestEdit = edit;\n var bestEquality2 = equality2;\n var bestScore = diff_cleanupSemanticScore_(equality1, edit) +\n diff_cleanupSemanticScore_(edit, equality2);\n while (edit.charAt(0) === equality2.charAt(0)) {\n equality1 += edit.charAt(0);\n edit = edit.substring(1) + equality2.charAt(0);\n equality2 = equality2.substring(1);\n var score = diff_cleanupSemanticScore_(equality1, edit) +\n diff_cleanupSemanticScore_(edit, equality2);\n // The >= encourages trailing rather than leading whitespace on edits.\n if (score >= bestScore) {\n bestScore = score;\n bestEquality1 = equality1;\n bestEdit = edit;\n bestEquality2 = equality2;\n }\n }\n\n if (diffs[pointer - 1][1] != bestEquality1) {\n // We have an improvement, save it back to the diff.\n if (bestEquality1) {\n diffs[pointer - 1][1] = bestEquality1;\n } else {\n diffs.splice(pointer - 1, 1);\n pointer--;\n }\n diffs[pointer][1] = bestEdit;\n if (bestEquality2) {\n diffs[pointer + 1][1] = bestEquality2;\n } else {\n diffs.splice(pointer + 1, 1);\n pointer--;\n }\n }\n }\n pointer++;\n }\n};\n\n\n/**\n * Reduce the number of edits by eliminating operationally trivial equalities.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {\n var changes = false;\n var equalities = []; // Stack of indices where equalities are found.\n var equalitiesLength = 0; // Keeping our own length var is faster in JS.\n var lastequality = ''; // Always equal to equalities[equalitiesLength-1][1]\n var pointer = 0; // Index of current position.\n // Is there an insertion operation before the last equality.\n var pre_ins = false;\n // Is there a deletion operation before the last equality.\n var pre_del = false;\n // Is there an insertion operation after the last equality.\n var post_ins = false;\n // Is there a deletion operation after the last equality.\n var post_del = false;\n while (pointer < diffs.length) {\n if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.\n if (diffs[pointer][1].length < this.Diff_EditCost &&\n (post_ins || post_del)) {\n // Candidate found.\n equalities[equalitiesLength++] = pointer;\n pre_ins = post_ins;\n pre_del = post_del;\n lastequality = diffs[pointer][1];\n } else {\n // Not a candidate, and can never become one.\n equalitiesLength = 0;\n lastequality = '';\n }\n post_ins = post_del = false;\n } else { // An insertion or deletion.\n if (diffs[pointer][0] == DIFF_DELETE) {\n post_del = true;\n } else {\n post_ins = true;\n }\n /*\n * Five types to be split:\n * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>\n * <ins>A</ins>X<ins>C</ins><del>D</del>\n * <ins>A</ins><del>B</del>X<ins>C</ins>\n * <ins>A</del>X<ins>C</ins><del>D</del>\n * <ins>A</ins><del>B</del>X<del>C</del>\n */\n if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||\n ((lastequality.length < this.Diff_EditCost / 2) &&\n (pre_ins + pre_del + post_ins + post_del) == 3))) {\n // Duplicate record.\n diffs.splice(equalities[equalitiesLength - 1], 0,\n [DIFF_DELETE, lastequality]);\n // Change second copy to insert.\n diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;\n equalitiesLength--; // Throw away the equality we just deleted;\n lastequality = '';\n if (pre_ins && pre_del) {\n // No changes made which could affect previous entry, keep going.\n post_ins = post_del = true;\n equalitiesLength = 0;\n } else {\n equalitiesLength--; // Throw away the previous equality.\n pointer = equalitiesLength > 0 ?\n equalities[equalitiesLength - 1] : -1;\n post_ins = post_del = false;\n }\n changes = true;\n }\n }\n pointer++;\n }\n\n if (changes) {\n this.diff_cleanupMerge(diffs);\n }\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n */\ndiff_match_patch.prototype.diff_cleanupMerge = function(diffs) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n // Upon reaching an equality, check for prior redundancies.\n if (count_delete + count_insert > 1) {\n if (count_delete !== 0 && count_insert !== 0) {\n // Factor out any common prefixies.\n commonlength = this.diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if ((pointer - count_delete - count_insert) > 0 &&\n diffs[pointer - count_delete - count_insert - 1][0] ==\n DIFF_EQUAL) {\n diffs[pointer - count_delete - count_insert - 1][1] +=\n text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL,\n text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixies.\n commonlength = this.diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] = text_insert.substring(text_insert.length -\n commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length -\n commonlength);\n text_delete = text_delete.substring(0, text_delete.length -\n commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n if (count_delete === 0) {\n diffs.splice(pointer - count_delete - count_insert,\n count_delete + count_insert, [DIFF_INSERT, text_insert]);\n } else if (count_insert === 0) {\n diffs.splice(pointer - count_delete - count_insert,\n count_delete + count_insert, [DIFF_DELETE, text_delete]);\n } else {\n diffs.splice(pointer - count_delete - count_insert,\n count_delete + count_insert, [DIFF_DELETE, text_delete],\n [DIFF_INSERT, text_insert]);\n }\n pointer = pointer - count_delete - count_insert +\n (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;\n } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] == DIFF_EQUAL &&\n diffs[pointer + 1][0] == DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n this.diff_cleanupMerge(diffs);\n }\n};\n\n\n/**\n * loc is a location in text1, compute and return the equivalent location in\n * text2.\n * e.g. 'The cat' vs 'The big cat', 1->1, 5->8\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @param {number} loc Location within text1.\n * @return {number} Location within text2.\n */\ndiff_match_patch.prototype.diff_xIndex = function(diffs, loc) {\n var chars1 = 0;\n var chars2 = 0;\n var last_chars1 = 0;\n var last_chars2 = 0;\n var x;\n for (x = 0; x < diffs.length; x++) {\n if (diffs[x][0] !== DIFF_INSERT) { // Equality or deletion.\n chars1 += diffs[x][1].length;\n }\n if (diffs[x][0] !== DIFF_DELETE) { // Equality or insertion.\n chars2 += diffs[x][1].length;\n }\n if (chars1 > loc) { // Overshot the location.\n break;\n }\n last_chars1 = chars1;\n last_chars2 = chars2;\n }\n // Was the location was deleted?\n if (diffs.length != x && diffs[x][0] === DIFF_DELETE) {\n return last_chars2;\n }\n // Add the remaining character length.\n return last_chars2 + (loc - last_chars1);\n};\n\n\n/**\n * Convert a diff array into a pretty HTML report.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} HTML representation.\n */\ndiff_match_patch.prototype.diff_prettyHtml = function(diffs) {\n var html = [];\n var i = 0;\n var pattern_amp = /&/g;\n var pattern_lt = /</g;\n var pattern_gt = />/g;\n var pattern_para = /\\n/g;\n for (var x = 0; x < diffs.length; x++) {\n var op = diffs[x][0]; // Operation (insert, delete, equal)\n var data = diffs[x][1]; // Text of change.\n var text = data.replace(pattern_amp, '&amp;').replace(pattern_lt, '&lt;')\n .replace(pattern_gt, '&gt;').replace(pattern_para, '&para;<br>');\n switch (op) {\n case DIFF_INSERT:\n html[x] = '<ins style=\"background:#e6ffe6;\">' + text + '</ins>';\n break;\n case DIFF_DELETE:\n html[x] = '<del style=\"background:#ffe6e6;\">' + text + '</del>';\n break;\n case DIFF_EQUAL:\n html[x] = '<span>' + text + '</span>';\n break;\n }\n if (op !== DIFF_DELETE) {\n i += data.length;\n }\n }\n return html.join('');\n};\n\n\n/**\n * Compute and return the source text (all equalities and deletions).\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} Source text.\n */\ndiff_match_patch.prototype.diff_text1 = function(diffs) {\n var text = [];\n for (var x = 0; x < diffs.length; x++) {\n if (diffs[x][0] !== DIFF_INSERT) {\n text[x] = diffs[x][1];\n }\n }\n return text.join('');\n};\n\n\n/**\n * Compute and return the destination text (all equalities and insertions).\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} Destination text.\n */\ndiff_match_patch.prototype.diff_text2 = function(diffs) {\n var text = [];\n for (var x = 0; x < diffs.length; x++) {\n if (diffs[x][0] !== DIFF_DELETE) {\n text[x] = diffs[x][1];\n }\n }\n return text.join('');\n};\n\n\n/**\n * Compute the Levenshtein distance; the number of inserted, deleted or\n * substituted characters.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {number} Number of changes.\n */\ndiff_match_patch.prototype.diff_levenshtein = function(diffs) {\n var levenshtein = 0;\n var insertions = 0;\n var deletions = 0;\n for (var x = 0; x < diffs.length; x++) {\n var op = diffs[x][0];\n var data = diffs[x][1];\n switch (op) {\n case DIFF_INSERT:\n insertions += data.length;\n break;\n case DIFF_DELETE:\n deletions += data.length;\n break;\n case DIFF_EQUAL:\n // A deletion and an insertion is one substitution.\n levenshtein += Math.max(insertions, deletions);\n insertions = 0;\n deletions = 0;\n break;\n }\n }\n levenshtein += Math.max(insertions, deletions);\n return levenshtein;\n};\n\n\n/**\n * Crush the diff into an encoded string which describes the operations\n * required to transform text1 into text2.\n * E.g. =3\\t-2\\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'.\n * Operations are tab-separated. Inserted text is escaped using %xx notation.\n * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n * @return {string} Delta text.\n */\ndiff_match_patch.prototype.diff_toDelta = function(diffs) {\n var text = [];\n for (var x = 0; x < diffs.length; x++) {\n switch (diffs[x][0]) {\n case DIFF_INSERT:\n text[x] = '+' + encodeURI(diffs[x][1]);\n break;\n case DIFF_DELETE:\n text[x] = '-' + diffs[x][1].length;\n break;\n case DIFF_EQUAL:\n text[x] = '=' + diffs[x][1].length;\n break;\n }\n }\n return text.join('\\t').replace(/%20/g, ' ');\n};\n\n\n/**\n * Given the original text1, and an encoded string which describes the\n * operations required to transform text1 into text2, compute the full diff.\n * @param {string} text1 Source string for the diff.\n * @param {string} delta Delta text.\n * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n * @throws {!Error} If invalid input.\n */\ndiff_match_patch.prototype.diff_fromDelta = function(text1, delta) {\n var diffs = [];\n var diffsLength = 0; // Keeping our own length var is faster in JS.\n var pointer = 0; // Cursor in text1\n var tokens = delta.split(/\\t/g);\n for (var x = 0; x < tokens.length; x++) {\n // Each token begins with a one character parameter which specifies the\n // operation of this token (delete, insert, equality).\n var param = tokens[x].substring(1);\n switch (tokens[x].charAt(0)) {\n case '+':\n try {\n diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];\n } catch (ex) {\n // Malformed URI sequence.\n throw new Error('Illegal escape in diff_fromDelta: ' + param);\n }\n break;\n case '-':\n // Fall through.\n case '=':\n var n = parseInt(param, 10);\n if (isNaN(n) || n < 0) {\n throw new Error('Invalid number in diff_fromDelta: ' + param);\n }\n var text = text1.substring(pointer, pointer += n);\n if (tokens[x].charAt(0) == '=') {\n diffs[diffsLength++] = [DIFF_EQUAL, text];\n } else {\n diffs[diffsLength++] = [DIFF_DELETE, text];\n }\n break;\n default:\n // Blank tokens are ok (from a trailing \\t).\n // Anything else is an error.\n if (tokens[x]) {\n throw new Error('Invalid diff operation in diff_fromDelta: ' +\n tokens[x]);\n }\n }\n }\n if (pointer != text1.length) {\n throw new Error('Delta length (' + pointer +\n ') does not equal source text length (' + text1.length + ').');\n }\n return diffs;\n};\n\n\n// MATCH FUNCTIONS\n\n\n/**\n * Locate the best instance of 'pattern' in 'text' near 'loc'.\n * @param {string} text The text to search.\n * @param {string} pattern The pattern to search for.\n * @param {number} loc The location to search around.\n * @return {number} Best match index or -1.\n */\ndiff_match_patch.prototype.match_main = function(text, pattern, loc) {\n // Check for null inputs.\n if (text == null || pattern == null || loc == null) {\n throw new Error('Null input. (match_main)');\n }\n\n loc = Math.max(0, Math.min(loc, text.length));\n if (text == pattern) {\n // Shortcut (potentially not guaranteed by the algorithm)\n return 0;\n } else if (!text.length) {\n // Nothing to match.\n return -1;\n } else if (text.substring(loc, loc + pattern.length) == pattern) {\n // Perfect match at the perfect spot! (Includes case of null pattern)\n return loc;\n } else {\n // Do a fuzzy compare.\n return this.match_bitap_(text, pattern, loc);\n }\n};\n\n\n/**\n * Locate the best instance of 'pattern' in 'text' near 'loc' using the\n * Bitap algorithm.\n * @param {string} text The text to search.\n * @param {string} pattern The pattern to search for.\n * @param {number} loc The location to search around.\n * @return {number} Best match index or -1.\n * @private\n */\ndiff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {\n if (pattern.length > this.Match_MaxBits) {\n throw new Error('Pattern too long for this browser.');\n }\n\n // Initialise the alphabet.\n var s = this.match_alphabet_(pattern);\n\n var dmp = this; // 'this' becomes 'window' in a closure.\n\n /**\n * Compute and return the score for a match with e errors and x location.\n * Accesses loc and pattern through being a closure.\n * @param {number} e Number of errors in match.\n * @param {number} x Location of match.\n * @return {number} Overall score for match (0.0 = good, 1.0 = bad).\n * @private\n */\n function match_bitapScore_(e, x) {\n var accuracy = e / pattern.length;\n var proximity = Math.abs(loc - x);\n if (!dmp.Match_Distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n }\n return accuracy + (proximity / dmp.Match_Distance);\n }\n\n // Highest score beyond which we give up.\n var score_threshold = this.Match_Threshold;\n // Is there a nearby exact match? (speedup)\n var best_loc = text.indexOf(pattern, loc);\n if (best_loc != -1) {\n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);\n // What about in the other direction? (speedup)\n best_loc = text.lastIndexOf(pattern, loc + pattern.length);\n if (best_loc != -1) {\n score_threshold =\n Math.min(match_bitapScore_(0, best_loc), score_threshold);\n }\n }\n\n // Initialise the bit arrays.\n var matchmask = 1 << (pattern.length - 1);\n best_loc = -1;\n\n var bin_min, bin_mid;\n var bin_max = pattern.length + text.length;\n var last_rd;\n for (var d = 0; d < pattern.length; d++) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from 'loc' we can stray at this\n // error level.\n bin_min = 0;\n bin_mid = bin_max;\n while (bin_min < bin_mid) {\n if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {\n bin_min = bin_mid;\n } else {\n bin_max = bin_mid;\n }\n bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);\n }\n // Use the result from this iteration as the maximum for the next.\n bin_max = bin_mid;\n var start = Math.max(1, loc - bin_mid + 1);\n var finish = Math.min(loc + bin_mid, text.length) + pattern.length;\n\n var rd = Array(finish + 2);\n rd[finish + 1] = (1 << d) - 1;\n for (var j = finish; j >= start; j--) {\n // The alphabet (s) is a sparse hash, so the following line generates\n // warnings.\n var charMatch = s[text.charAt(j - 1)];\n if (d === 0) { // First pass: exact match.\n rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;\n } else { // Subsequent passes: fuzzy match.\n rd[j] = ((rd[j + 1] << 1) | 1) & charMatch |\n (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |\n last_rd[j + 1];\n }\n if (rd[j] & matchmask) {\n var score = match_bitapScore_(d, j - 1);\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (score <= score_threshold) {\n // Told you so.\n score_threshold = score;\n best_loc = j - 1;\n if (best_loc > loc) {\n // When passing loc, don't exceed our current distance from loc.\n start = Math.max(1, 2 * loc - best_loc);\n } else {\n // Already passed loc, downhill from here on in.\n break;\n }\n }\n }\n }\n // No hope for a (better) match at greater error levels.\n if (match_bitapScore_(d + 1, loc) > score_threshold) {\n break;\n }\n last_rd = rd;\n }\n return best_loc;\n};\n\n\n/**\n * Initialise the alphabet for the Bitap algorithm.\n * @param {string} pattern The text to encode.\n * @return {!Object} Hash of character locations.\n * @private\n */\ndiff_match_patch.prototype.match_alphabet_ = function(pattern) {\n var s = {};\n for (var i = 0; i < pattern.length; i++) {\n s[pattern.charAt(i)] = 0;\n }\n for (var i = 0; i < pattern.length; i++) {\n s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);\n }\n return s;\n};\n\n\n// PATCH FUNCTIONS\n\n\n/**\n * Increase the context until it is unique,\n * but don't let the pattern expand beyond Match_MaxBits.\n * @param {!diff_match_patch.patch_obj} patch The patch to grow.\n * @param {string} text Source text.\n * @private\n */\ndiff_match_patch.prototype.patch_addContext_ = function(patch, text) {\n if (text.length == 0) {\n return;\n }\n var pattern = text.substring(patch.start2, patch.start2 + patch.length1);\n var padding = 0;\n\n // Look for the first and last matches of pattern in text. If two different\n // matches are found, increase the pattern length.\n while (text.indexOf(pattern) != text.lastIndexOf(pattern) &&\n pattern.length < this.Match_MaxBits - this.Patch_Margin -\n this.Patch_Margin) {\n padding += this.Patch_Margin;\n pattern = text.substring(patch.start2 - padding,\n patch.start2 + patch.length1 + padding);\n }\n // Add one chunk for good luck.\n padding += this.Patch_Margin;\n\n // Add the prefix.\n var prefix = text.substring(patch.start2 - padding, patch.start2);\n if (prefix) {\n patch.diffs.unshift([DIFF_EQUAL, prefix]);\n }\n // Add the suffix.\n var suffix = text.substring(patch.start2 + patch.length1,\n patch.start2 + patch.length1 + padding);\n if (suffix) {\n patch.diffs.push([DIFF_EQUAL, suffix]);\n }\n\n // Roll back the start points.\n patch.start1 -= prefix.length;\n patch.start2 -= prefix.length;\n // Extend the lengths.\n patch.length1 += prefix.length + suffix.length;\n patch.length2 += prefix.length + suffix.length;\n};\n\n\n/**\n * Compute a list of patches to turn text1 into text2.\n * Use diffs if provided, otherwise compute it ourselves.\n * There are four ways to call this function, depending on what data is\n * available to the caller:\n * Method 1:\n * a = text1, b = text2\n * Method 2:\n * a = diffs\n * Method 3 (optimal):\n * a = text1, b = diffs\n * Method 4 (deprecated, use method 3):\n * a = text1, b = text2, c = diffs\n *\n * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or\n * Array of diff tuples for text1 to text2 (method 2).\n * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or\n * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).\n * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples\n * for text1 to text2 (method 4) or undefined (methods 1,2,3).\n * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.\n */\ndiff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {\n var text1, diffs;\n if (typeof a == 'string' && typeof opt_b == 'string' &&\n typeof opt_c == 'undefined') {\n // Method 1: text1, text2\n // Compute diffs from text1 and text2.\n text1 = /** @type {string} */(a);\n diffs = this.diff_main(text1, /** @type {string} */(opt_b), true);\n if (diffs.length > 2) {\n this.diff_cleanupSemantic(diffs);\n this.diff_cleanupEfficiency(diffs);\n }\n } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' &&\n typeof opt_c == 'undefined') {\n // Method 2: diffs\n // Compute text1 from diffs.\n diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(a);\n text1 = this.diff_text1(diffs);\n } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' &&\n typeof opt_c == 'undefined') {\n // Method 3: text1, diffs\n text1 = /** @type {string} */(a);\n diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_b);\n } else if (typeof a == 'string' && typeof opt_b == 'string' &&\n opt_c && typeof opt_c == 'object') {\n // Method 4: text1, text2, diffs\n // text2 is not used.\n text1 = /** @type {string} */(a);\n diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_c);\n } else {\n throw new Error('Unknown call format to patch_make.');\n }\n\n if (diffs.length === 0) {\n return []; // Get rid of the null case.\n }\n var patches = [];\n var patch = new diff_match_patch.patch_obj();\n var patchDiffLength = 0; // Keeping our own length var is faster in JS.\n var char_count1 = 0; // Number of characters into the text1 string.\n var char_count2 = 0; // Number of characters into the text2 string.\n // Start with text1 (prepatch_text) and apply the diffs until we arrive at\n // text2 (postpatch_text). We recreate the patches one by one to determine\n // context info.\n var prepatch_text = text1;\n var postpatch_text = text1;\n for (var x = 0; x < diffs.length; x++) {\n var diff_type = diffs[x][0];\n var diff_text = diffs[x][1];\n\n if (!patchDiffLength && diff_type !== DIFF_EQUAL) {\n // A new patch starts here.\n patch.start1 = char_count1;\n patch.start2 = char_count2;\n }\n\n switch (diff_type) {\n case DIFF_INSERT:\n patch.diffs[patchDiffLength++] = diffs[x];\n patch.length2 += diff_text.length;\n postpatch_text = postpatch_text.substring(0, char_count2) + diff_text +\n postpatch_text.substring(char_count2);\n break;\n case DIFF_DELETE:\n patch.length1 += diff_text.length;\n patch.diffs[patchDiffLength++] = diffs[x];\n postpatch_text = postpatch_text.substring(0, char_count2) +\n postpatch_text.substring(char_count2 +\n diff_text.length);\n break;\n case DIFF_EQUAL:\n if (diff_text.length <= 2 * this.Patch_Margin &&\n patchDiffLength && diffs.length != x + 1) {\n // Small equality inside a patch.\n patch.diffs[patchDiffLength++] = diffs[x];\n patch.length1 += diff_text.length;\n patch.length2 += diff_text.length;\n } else if (diff_text.length >= 2 * this.Patch_Margin) {\n // Time for a new patch.\n if (patchDiffLength) {\n this.patch_addContext_(patch, prepatch_text);\n patches.push(patch);\n patch = new diff_match_patch.patch_obj();\n patchDiffLength = 0;\n // Unlike Unidiff, our patch lists have a rolling context.\n // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff\n // Update prepatch text & pos to reflect the application of the\n // just completed patch.\n prepatch_text = postpatch_text;\n char_count1 = char_count2;\n }\n }\n break;\n }\n\n // Update the current character count.\n if (diff_type !== DIFF_INSERT) {\n char_count1 += diff_text.length;\n }\n if (diff_type !== DIFF_DELETE) {\n char_count2 += diff_text.length;\n }\n }\n // Pick up the leftover patch if not empty.\n if (patchDiffLength) {\n this.patch_addContext_(patch, prepatch_text);\n patches.push(patch);\n }\n\n return patches;\n};\n\n\n/**\n * Given an array of patches, return another array that is identical.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.\n */\ndiff_match_patch.prototype.patch_deepCopy = function(patches) {\n // Making deep copies is hard in JavaScript.\n var patchesCopy = [];\n for (var x = 0; x < patches.length; x++) {\n var patch = patches[x];\n var patchCopy = new diff_match_patch.patch_obj();\n patchCopy.diffs = [];\n for (var y = 0; y < patch.diffs.length; y++) {\n patchCopy.diffs[y] = patch.diffs[y].slice();\n }\n patchCopy.start1 = patch.start1;\n patchCopy.start2 = patch.start2;\n patchCopy.length1 = patch.length1;\n patchCopy.length2 = patch.length2;\n patchesCopy[x] = patchCopy;\n }\n return patchesCopy;\n};\n\n\n/**\n * Merge a set of patches onto the text. Return a patched text, as well\n * as a list of true/false values indicating which patches were applied.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @param {string} text Old text.\n * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the\n * new text and an array of boolean values.\n */\ndiff_match_patch.prototype.patch_apply = function(patches, text) {\n if (patches.length == 0) {\n return [text, []];\n }\n\n // Deep copy the patches so that no changes are made to originals.\n patches = this.patch_deepCopy(patches);\n\n var nullPadding = this.patch_addPadding(patches);\n text = nullPadding + text + nullPadding;\n\n this.patch_splitMax(patches);\n // delta keeps track of the offset between the expected and actual location\n // of the previous patch. If there are patches expected at positions 10 and\n // 20, but the first patch was found at 12, delta is 2 and the second patch\n // has an effective expected position of 22.\n var delta = 0;\n var results = [];\n for (var x = 0; x < patches.length; x++) {\n var expected_loc = patches[x].start2 + delta;\n var text1 = this.diff_text1(patches[x].diffs);\n var start_loc;\n var end_loc = -1;\n if (text1.length > this.Match_MaxBits) {\n // patch_splitMax will only provide an oversized pattern in the case of\n // a monster delete.\n start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits),\n expected_loc);\n if (start_loc != -1) {\n end_loc = this.match_main(text,\n text1.substring(text1.length - this.Match_MaxBits),\n expected_loc + text1.length - this.Match_MaxBits);\n if (end_loc == -1 || start_loc >= end_loc) {\n // Can't find valid trailing context. Drop this patch.\n start_loc = -1;\n }\n }\n } else {\n start_loc = this.match_main(text, text1, expected_loc);\n }\n if (start_loc == -1) {\n // No match found. :(\n results[x] = false;\n // Subtract the delta for this failed patch from subsequent patches.\n delta -= patches[x].length2 - patches[x].length1;\n } else {\n // Found a match. :)\n results[x] = true;\n delta = start_loc - expected_loc;\n var text2;\n if (end_loc == -1) {\n text2 = text.substring(start_loc, start_loc + text1.length);\n } else {\n text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);\n }\n if (text1 == text2) {\n // Perfect match, just shove the replacement text in.\n text = text.substring(0, start_loc) +\n this.diff_text2(patches[x].diffs) +\n text.substring(start_loc + text1.length);\n } else {\n // Imperfect match. Run a diff to get a framework of equivalent\n // indices.\n var diffs = this.diff_main(text1, text2, false);\n if (text1.length > this.Match_MaxBits &&\n this.diff_levenshtein(diffs) / text1.length >\n this.Patch_DeleteThreshold) {\n // The end points match, but the content is unacceptably bad.\n results[x] = false;\n } else {\n this.diff_cleanupSemanticLossless(diffs);\n var index1 = 0;\n var index2;\n for (var y = 0; y < patches[x].diffs.length; y++) {\n var mod = patches[x].diffs[y];\n if (mod[0] !== DIFF_EQUAL) {\n index2 = this.diff_xIndex(diffs, index1);\n }\n if (mod[0] === DIFF_INSERT) { // Insertion\n text = text.substring(0, start_loc + index2) + mod[1] +\n text.substring(start_loc + index2);\n } else if (mod[0] === DIFF_DELETE) { // Deletion\n text = text.substring(0, start_loc + index2) +\n text.substring(start_loc + this.diff_xIndex(diffs,\n index1 + mod[1].length));\n }\n if (mod[0] !== DIFF_DELETE) {\n index1 += mod[1].length;\n }\n }\n }\n }\n }\n }\n // Strip the padding off.\n text = text.substring(nullPadding.length, text.length - nullPadding.length);\n return [text, results];\n};\n\n\n/**\n * Add some padding on text start and end so that edges can match something.\n * Intended to be called only from within patch_apply.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @return {string} The padding string added to each side.\n */\ndiff_match_patch.prototype.patch_addPadding = function(patches) {\n var paddingLength = this.Patch_Margin;\n var nullPadding = '';\n for (var x = 1; x <= paddingLength; x++) {\n nullPadding += String.fromCharCode(x);\n }\n\n // Bump all the patches forward.\n for (var x = 0; x < patches.length; x++) {\n patches[x].start1 += paddingLength;\n patches[x].start2 += paddingLength;\n }\n\n // Add some padding on start of first diff.\n var patch = patches[0];\n var diffs = patch.diffs;\n if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {\n // Add nullPadding equality.\n diffs.unshift([DIFF_EQUAL, nullPadding]);\n patch.start1 -= paddingLength; // Should be 0.\n patch.start2 -= paddingLength; // Should be 0.\n patch.length1 += paddingLength;\n patch.length2 += paddingLength;\n } else if (paddingLength > diffs[0][1].length) {\n // Grow first equality.\n var extraLength = paddingLength - diffs[0][1].length;\n diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];\n patch.start1 -= extraLength;\n patch.start2 -= extraLength;\n patch.length1 += extraLength;\n patch.length2 += extraLength;\n }\n\n // Add some padding on end of last diff.\n patch = patches[patches.length - 1];\n diffs = patch.diffs;\n if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {\n // Add nullPadding equality.\n diffs.push([DIFF_EQUAL, nullPadding]);\n patch.length1 += paddingLength;\n patch.length2 += paddingLength;\n } else if (paddingLength > diffs[diffs.length - 1][1].length) {\n // Grow last equality.\n var extraLength = paddingLength - diffs[diffs.length - 1][1].length;\n diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);\n patch.length1 += extraLength;\n patch.length2 += extraLength;\n }\n\n return nullPadding;\n};\n\n\n/**\n * Look through the patches and break up any which are longer than the maximum\n * limit of the match algorithm.\n * Intended to be called only from within patch_apply.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n */\ndiff_match_patch.prototype.patch_splitMax = function(patches) {\n var patch_size = this.Match_MaxBits;\n for (var x = 0; x < patches.length; x++) {\n if (patches[x].length1 > patch_size) {\n var bigpatch = patches[x];\n // Remove the big old patch.\n patches.splice(x--, 1);\n var start1 = bigpatch.start1;\n var start2 = bigpatch.start2;\n var precontext = '';\n while (bigpatch.diffs.length !== 0) {\n // Create one of several smaller patches.\n var patch = new diff_match_patch.patch_obj();\n var empty = true;\n patch.start1 = start1 - precontext.length;\n patch.start2 = start2 - precontext.length;\n if (precontext !== '') {\n patch.length1 = patch.length2 = precontext.length;\n patch.diffs.push([DIFF_EQUAL, precontext]);\n }\n while (bigpatch.diffs.length !== 0 &&\n patch.length1 < patch_size - this.Patch_Margin) {\n var diff_type = bigpatch.diffs[0][0];\n var diff_text = bigpatch.diffs[0][1];\n if (diff_type === DIFF_INSERT) {\n // Insertions are harmless.\n patch.length2 += diff_text.length;\n start2 += diff_text.length;\n patch.diffs.push(bigpatch.diffs.shift());\n empty = false;\n } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 &&\n patch.diffs[0][0] == DIFF_EQUAL &&\n diff_text.length > 2 * patch_size) {\n // This is a large deletion. Let it pass in one chunk.\n patch.length1 += diff_text.length;\n start1 += diff_text.length;\n empty = false;\n patch.diffs.push([diff_type, diff_text]);\n bigpatch.diffs.shift();\n } else {\n // Deletion or equality. Only take as much as we can stomach.\n diff_text = diff_text.substring(0,\n patch_size - patch.length1 - this.Patch_Margin);\n patch.length1 += diff_text.length;\n start1 += diff_text.length;\n if (diff_type === DIFF_EQUAL) {\n patch.length2 += diff_text.length;\n start2 += diff_text.length;\n } else {\n empty = false;\n }\n patch.diffs.push([diff_type, diff_text]);\n if (diff_text == bigpatch.diffs[0][1]) {\n bigpatch.diffs.shift();\n } else {\n bigpatch.diffs[0][1] =\n bigpatch.diffs[0][1].substring(diff_text.length);\n }\n }\n }\n // Compute the head context for the next patch.\n precontext = this.diff_text2(patch.diffs);\n precontext =\n precontext.substring(precontext.length - this.Patch_Margin);\n // Append the end context for this patch.\n var postcontext = this.diff_text1(bigpatch.diffs)\n .substring(0, this.Patch_Margin);\n if (postcontext !== '') {\n patch.length1 += postcontext.length;\n patch.length2 += postcontext.length;\n if (patch.diffs.length !== 0 &&\n patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {\n patch.diffs[patch.diffs.length - 1][1] += postcontext;\n } else {\n patch.diffs.push([DIFF_EQUAL, postcontext]);\n }\n }\n if (!empty) {\n patches.splice(++x, 0, patch);\n }\n }\n }\n }\n};\n\n\n/**\n * Take a list of patches and return a textual representation.\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of patch objects.\n * @return {string} Text representation of patches.\n */\ndiff_match_patch.prototype.patch_toText = function(patches) {\n var text = [];\n for (var x = 0; x < patches.length; x++) {\n text[x] = patches[x];\n }\n return text.join('');\n};\n\n\n/**\n * Parse a textual representation of patches and return a list of patch objects.\n * @param {string} textline Text representation of patches.\n * @return {!Array.<!diff_match_patch.patch_obj>} Array of patch objects.\n * @throws {!Error} If invalid input.\n */\ndiff_match_patch.prototype.patch_fromText = function(textline) {\n var patches = [];\n if (!textline) {\n return patches;\n }\n var text = textline.split('\\n');\n var textPointer = 0;\n var patchHeader = /^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$/;\n while (textPointer < text.length) {\n var m = text[textPointer].match(patchHeader);\n if (!m) {\n throw new Error('Invalid patch string: ' + text[textPointer]);\n }\n var patch = new diff_match_patch.patch_obj();\n patches.push(patch);\n patch.start1 = parseInt(m[1], 10);\n if (m[2] === '') {\n patch.start1--;\n patch.length1 = 1;\n } else if (m[2] == '0') {\n patch.length1 = 0;\n } else {\n patch.start1--;\n patch.length1 = parseInt(m[2], 10);\n }\n\n patch.start2 = parseInt(m[3], 10);\n if (m[4] === '') {\n patch.start2--;\n patch.length2 = 1;\n } else if (m[4] == '0') {\n patch.length2 = 0;\n } else {\n patch.start2--;\n patch.length2 = parseInt(m[4], 10);\n }\n textPointer++;\n\n while (textPointer < text.length) {\n var sign = text[textPointer].charAt(0);\n try {\n var line = decodeURI(text[textPointer].substring(1));\n } catch (ex) {\n // Malformed URI sequence.\n throw new Error('Illegal escape in patch_fromText: ' + line);\n }\n if (sign == '-') {\n // Deletion.\n patch.diffs.push([DIFF_DELETE, line]);\n } else if (sign == '+') {\n // Insertion.\n patch.diffs.push([DIFF_INSERT, line]);\n } else if (sign == ' ') {\n // Minor equality.\n patch.diffs.push([DIFF_EQUAL, line]);\n } else if (sign == '@') {\n // Start of next patch.\n break;\n } else if (sign === '') {\n // Blank line? Whatever.\n } else {\n // WTF?\n throw new Error('Invalid patch mode \"' + sign + '\" in: ' + line);\n }\n textPointer++;\n }\n }\n return patches;\n};\n\n\n/**\n * Class representing one patch operation.\n * @constructor\n */\ndiff_match_patch.patch_obj = function() {\n /** @type {!Array.<!diff_match_patch.Diff>} */\n this.diffs = [];\n /** @type {?number} */\n this.start1 = null;\n /** @type {?number} */\n this.start2 = null;\n /** @type {number} */\n this.length1 = 0;\n /** @type {number} */\n this.length2 = 0;\n};\n\n\n/**\n * Emmulate GNU diff's format.\n * Header: @@ -382,8 +481,9 @@\n * Indicies are printed as 1-based, not 0-based.\n * @return {string} The GNU diff string.\n */\ndiff_match_patch.patch_obj.prototype.toString = function() {\n var coords1, coords2;\n if (this.length1 === 0) {\n coords1 = this.start1 + ',0';\n } else if (this.length1 == 1) {\n coords1 = this.start1 + 1;\n } else {\n coords1 = (this.start1 + 1) + ',' + this.length1;\n }\n if (this.length2 === 0) {\n coords2 = this.start2 + ',0';\n } else if (this.length2 == 1) {\n coords2 = this.start2 + 1;\n } else {\n coords2 = (this.start2 + 1) + ',' + this.length2;\n }\n var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\\n'];\n var op;\n // Escape the body of the patch with %xx notation.\n for (var x = 0; x < this.diffs.length; x++) {\n switch (this.diffs[x][0]) {\n case DIFF_INSERT:\n op = '+';\n break;\n case DIFF_DELETE:\n op = '-';\n break;\n case DIFF_EQUAL:\n op = ' ';\n break;\n }\n text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\\n';\n }\n return text.join('').replace(/%20/g, ' ');\n};\n\n\n// Export these global variables so that they survive Google's JS compiler.\n// In a browser, 'this' will be 'window'.\n// In node.js 'this' will be a global object.\nthis['diff_match_patch'] = diff_match_patch;\nthis['DIFF_DELETE'] = DIFF_DELETE;\nthis['DIFF_INSERT'] = DIFF_INSERT;\nthis['DIFF_EQUAL'] = DIFF_EQUAL;\n\n","var Processor = require('./processor').Processor;\nvar Pipe = require('./pipe').Pipe;\nvar DiffContext = require('./contexts/diff').DiffContext;\nvar PatchContext = require('./contexts/patch').PatchContext;\nvar ReverseContext = require('./contexts/reverse').ReverseContext;\n\nvar clone = require('./clone');\n\nvar trivial = require('./filters/trivial');\nvar nested = require('./filters/nested');\nvar arrays = require('./filters/arrays');\nvar dates = require('./filters/dates');\nvar texts = require('./filters/texts');\n\nvar DiffPatcher = function DiffPatcher(options) {\n this.processor = new Processor(options);\n this.processor.pipe(new Pipe('diff').append(\n nested.collectChildrenDiffFilter,\n trivial.diffFilter,\n dates.diffFilter,\n texts.diffFilter,\n nested.objectsDiffFilter,\n arrays.diffFilter\n ).shouldHaveResult());\n this.processor.pipe(new Pipe('patch').append(\n nested.collectChildrenPatchFilter,\n arrays.collectChildrenPatchFilter,\n trivial.patchFilter,\n texts.patchFilter,\n nested.patchFilter,\n arrays.patchFilter\n ).shouldHaveResult());\n this.processor.pipe(new Pipe('reverse').append(\n nested.collectChildrenReverseFilter,\n arrays.collectChildrenReverseFilter,\n trivial.reverseFilter,\n texts.reverseFilter,\n nested.reverseFilter,\n arrays.reverseFilter\n ).shouldHaveResult());\n};\n\nDiffPatcher.prototype.options = function() {\n return this.processor.options.apply(this.processor, arguments);\n};\n\nDiffPatcher.prototype.diff = function(left, right) {\n return this.processor.process(new DiffContext(left, right));\n};\n\nDiffPatcher.prototype.patch = function(left, delta) {\n return this.processor.process(new PatchContext(left, delta));\n};\n\nDiffPatcher.prototype.reverse = function(delta) {\n return this.processor.process(new ReverseContext(delta));\n};\n\nDiffPatcher.prototype.unpatch = function(right, delta) {\n return this.patch(right, this.reverse(delta));\n};\n\nDiffPatcher.prototype.clone = function(value) {\n return clone(value);\n};\n\nexports.DiffPatcher = DiffPatcher;\n","// use as 2nd parameter for JSON.parse to revive Date instances\nmodule.exports = function dateReviver(key, value) {\n var parts;\n if (typeof value === 'string') {\n parts = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d*))?(Z|([+\\-])(\\d{2}):(\\d{2}))$/.exec(value);\n if (parts) {\n return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4], +parts[5], +parts[6], +(parts[7] || 0)));\n }\n }\n return value;\n};\n","\nvar Processor = function Processor(options){\n this.selfOptions = options || {};\n this.pipes = {};\n};\n\nProcessor.prototype.options = function(options) {\n if (options) {\n this.selfOptions = options;\n }\n return this.selfOptions;\n};\n\nProcessor.prototype.pipe = function(name, pipe) {\n if (typeof name === 'string') {\n if (typeof pipe === 'undefined') {\n return this.pipes[name];\n } else {\n this.pipes[name] = pipe;\n }\n }\n if (name && name.name) {\n pipe = name;\n if (pipe.processor === this) { return pipe; }\n this.pipes[pipe.name] = pipe;\n }\n pipe.processor = this;\n return pipe;\n};\n\nProcessor.prototype.process = function(input, pipe) {\n var context = input;\n context.options = this.options();\n var nextPipe = pipe || input.pipe || 'default';\n var lastPipe, lastContext;\n while (nextPipe) {\n if (typeof context.nextAfterChildren !== 'undefined') {\n // children processed and coming back to parent\n context.next = context.nextAfterChildren;\n context.nextAfterChildren = null;\n }\n\n if (typeof nextPipe === 'string') {\n nextPipe = this.pipe(nextPipe);\n }\n nextPipe.process(context);\n lastContext = context;\n lastPipe = nextPipe;\n nextPipe = null;\n if (context) {\n if (context.next) {\n context = context.next;\n nextPipe = lastContext.nextPipe || context.pipe || lastPipe;\n }\n }\n }\n return context.hasResult ? context.result : undefined;\n};\n\nexports.Processor = Processor;\n","var Pipe = function Pipe(name) {\n this.name = name;\n this.filters = [];\n};\n\nPipe.prototype.process = function(input) {\n if (!this.processor) {\n throw new Error('add this pipe to a processor before using it');\n }\n var debug = this.debug;\n var length = this.filters.length;\n var context = input;\n for (var index = 0; index < length; index++) {\n var filter = this.filters[index];\n if (debug) {\n this.log('filter: ' + filter.filterName);\n }\n filter(context);\n if (typeof context === 'object' && context.exiting) {\n context.exiting = false;\n break;\n }\n }\n if (!context.next && this.resultCheck) {\n this.resultCheck(context);\n }\n};\n\nPipe.prototype.log = function(msg) {\n console.log('[jsondiffpatch] ' + this.name + ' pipe, ' + msg);\n};\n\nPipe.prototype.append = function() {\n this.filters.push.apply(this.filters, arguments);\n return this;\n};\n\nPipe.prototype.prepend = function() {\n this.filters.unshift.apply(this.filters, arguments);\n return this;\n};\n\nPipe.prototype.indexOf = function(filterName) {\n if (!filterName) {\n throw new Error('a filter name is required');\n }\n for (var index = 0; index < this.filters.length; index++) {\n var filter = this.filters[index];\n if (filter.filterName === filterName) {\n return index;\n }\n }\n throw new Error('filter not found: ' + filterName);\n};\n\nPipe.prototype.list = function() {\n var names = [];\n for (var index = 0; index < this.filters.length; index++) {\n var filter = this.filters[index];\n names.push(filter.filterName);\n }\n return names;\n};\n\nPipe.prototype.after = function(filterName) {\n var index = this.indexOf(filterName);\n var params = Array.prototype.slice.call(arguments, 1);\n if (!params.length) {\n throw new Error('a filter is required');\n }\n params.unshift(index + 1, 0);\n Array.prototype.splice.apply(this.filters, params);\n return this;\n};\n\nPipe.prototype.before = function(filterName) {\n var index = this.indexOf(filterName);\n var params = Array.prototype.slice.call(arguments, 1);\n if (!params.length) {\n throw new Error('a filter is required');\n }\n params.unshift(index, 0);\n Array.prototype.splice.apply(this.filters, params);\n return this;\n};\n\nPipe.prototype.clear = function() {\n this.filters.length = 0;\n return this;\n};\n\nPipe.prototype.shouldHaveResult = function(should) {\n if (should === false) {\n this.resultCheck = null;\n return;\n }\n if (this.resultCheck) {\n return;\n }\n var pipe = this;\n this.resultCheck = function(context) {\n if (!context.hasResult) {\n console.log(context);\n var error = new Error(pipe.name + ' failed');\n error.noResult = true;\n throw error;\n }\n };\n return this;\n};\n\nexports.Pipe = Pipe;\n","var Context = require('./context').Context;\nvar defaultClone = require('../clone');\n\nvar DiffContext = function DiffContext(left, right) {\n this.left = left;\n this.right = right;\n this.pipe = 'diff';\n};\n\nDiffContext.prototype = new Context();\n\nDiffContext.prototype.setResult = function(result) {\n if (this.options.cloneDiffValues && typeof result === 'object') {\n var clone = typeof this.options.cloneDiffValues === 'function' ?\n this.options.cloneDiffValues : defaultClone;\n if (typeof result[0] === 'object') {\n result[0] = clone(result[0]);\n }\n if (typeof result[1] === 'object') {\n result[1] = clone(result[1]);\n }\n }\n return Context.prototype.setResult.apply(this, arguments);\n};\n\nexports.DiffContext = DiffContext;\n","var Context = require('./context').Context;\n\nvar PatchContext = function PatchContext(left, delta) {\n this.left = left;\n this.delta = delta;\n this.pipe = 'patch';\n};\n\nPatchContext.prototype = new Context();\n\nexports.PatchContext = PatchContext;\n","var Context = require('./context').Context;\n\nvar ReverseContext = function ReverseContext(delta) {\n this.delta = delta;\n this.pipe = 'reverse';\n};\n\nReverseContext.prototype = new Context();\n\nexports.ReverseContext = ReverseContext;\n","var isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nvar diffFilter = function trivialMatchesDiffFilter(context) {\n if (context.left === context.right) {\n context.setResult(undefined).exit();\n return;\n }\n if (typeof context.left === 'undefined') {\n if (typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.setResult([context.right]).exit();\n return;\n }\n if (typeof context.right === 'undefined') {\n context.setResult([context.left, 0, 0]).exit();\n return;\n }\n if (typeof context.left === 'function' || typeof context.right === 'function') {\n throw new Error('functions are not supported');\n }\n context.leftType = context.left === null ? 'null' : typeof context.left;\n context.rightType = context.right === null ? 'null' : typeof context.right;\n if (context.leftType !== context.rightType) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'boolean' || context.leftType === 'number') {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n if (context.leftType === 'object') {\n context.leftIsArray = isArray(context.left);\n }\n if (context.rightType === 'object') {\n context.rightIsArray = isArray(context.right);\n }\n if (context.leftIsArray !== context.rightIsArray) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n\n if (context.left instanceof RegExp) {\n if (context.right instanceof RegExp) {\n context.setResult([context.left.toString(), context.right.toString()]).exit();\n } else {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n }\n};\ndiffFilter.filterName = 'trivial';\n\nvar patchFilter = function trivialMatchesPatchFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.left).exit();\n return;\n }\n context.nested = !isArray(context.delta);\n if (context.nested) {\n return;\n }\n if (context.delta.length === 1) {\n context.setResult(context.delta[0]).exit();\n return;\n }\n if (context.delta.length === 2) {\n if (context.left instanceof RegExp) {\n var regexArgs = /^\\/(.*)\\/([gimyu]+)$/.exec(context.delta[1]);\n if (regexArgs) {\n context.setResult(new RegExp(regexArgs[1], regexArgs[2])).exit();\n return;\n }\n }\n context.setResult(context.delta[1]).exit();\n return;\n }\n if (context.delta.length === 3 && context.delta[2] === 0) {\n context.setResult(undefined).exit();\n return;\n }\n};\npatchFilter.filterName = 'trivial';\n\nvar reverseFilter = function trivialReferseFilter(context) {\n if (typeof context.delta === 'undefined') {\n context.setResult(context.delta).exit();\n return;\n }\n context.nested = !isArray(context.delta);\n if (context.nested) {\n return;\n }\n if (context.delta.length === 1) {\n context.setResult([context.delta[0], 0, 0]).exit();\n return;\n }\n if (context.delta.length === 2) {\n context.setResult([context.delta[1], context.delta[0]]).exit();\n return;\n }\n if (context.delta.length === 3 && context.delta[2] === 0) {\n context.setResult([context.delta[0]]).exit();\n return;\n }\n};\nreverseFilter.filterName = 'trivial';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n","\nvar isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nfunction cloneRegExp(re) {\n var regexMatch = /^\\/(.*)\\/([gimyu]*)$/.exec(re.toString());\n return new RegExp(regexMatch[1], regexMatch[2]);\n}\n\nfunction clone(arg) {\n if (typeof arg !== 'object') {\n return arg;\n }\n if (arg === null) {\n return null;\n }\n if (isArray(arg)) {\n return arg.map(clone);\n }\n if (arg instanceof Date) {\n return new Date(arg.getTime());\n }\n if (arg instanceof RegExp) {\n return cloneRegExp(arg);\n }\n var cloned = {};\n for (var name in arg) {\n if (Object.prototype.hasOwnProperty.call(arg, name)) {\n cloned[name] = clone(arg[name]);\n }\n }\n return cloned;\n}\n\nmodule.exports = clone;\n","var DiffContext = require('../contexts/diff').DiffContext;\nvar PatchContext = require('../contexts/patch').PatchContext;\nvar ReverseContext = require('../contexts/reverse').ReverseContext;\n\nvar collectChildrenDiffFilter = function collectChildrenDiffFilter(context) {\n if (!context || !context.children) {\n return;\n }\n var length = context.children.length;\n var child;\n var result = context.result;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (typeof child.result === 'undefined') {\n continue;\n }\n result = result || {};\n result[child.childName] = child.result;\n }\n if (result && context.leftIsArray) {\n result._t = 'a';\n }\n context.setResult(result).exit();\n};\ncollectChildrenDiffFilter.filterName = 'collectChildren';\n\nvar objectsDiffFilter = function objectsDiffFilter(context) {\n if (context.leftIsArray || context.leftType !== 'object') {\n return;\n }\n\n var name, child, propertyFilter = context.options.propertyFilter;\n for (name in context.left) {\n if (!Object.prototype.hasOwnProperty.call(context.left, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n child = new DiffContext(context.left[name], context.right[name]);\n context.push(child, name);\n }\n for (name in context.right) {\n if (!Object.prototype.hasOwnProperty.call(context.right, name)) {\n continue;\n }\n if (propertyFilter && !propertyFilter(name, context)) {\n continue;\n }\n if (typeof context.left[name] === 'undefined') {\n child = new DiffContext(undefined, context.right[name]);\n context.push(child, name);\n }\n }\n\n if (!context.children || context.children.length === 0) {\n context.setResult(undefined).exit();\n return;\n }\n context.exit();\n};\nobjectsDiffFilter.filterName = 'objects';\n\nvar patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var name, child;\n for (name in context.delta) {\n child = new PatchContext(context.left[name], context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\npatchFilter.filterName = 'objects';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var length = context.children.length;\n var child;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (Object.prototype.hasOwnProperty.call(context.left, child.childName) && child.result === undefined) {\n delete context.left[child.childName];\n } else if (context.left[child.childName] !== child.result) {\n context.left[child.childName] = child.result;\n }\n }\n context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'collectChildren';\n\nvar reverseFilter = function nestedReverseFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var name, child;\n for (name in context.delta) {\n child = new ReverseContext(context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'objects';\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t) {\n return;\n }\n var length = context.children.length;\n var child;\n var delta = {};\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n if (delta[child.childName] !== child.result) {\n delta[child.childName] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'collectChildren';\n\nexports.collectChildrenDiffFilter = collectChildrenDiffFilter;\nexports.objectsDiffFilter = objectsDiffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n","var DiffContext = require('../contexts/diff').DiffContext;\nvar PatchContext = require('../contexts/patch').PatchContext;\nvar ReverseContext = require('../contexts/reverse').ReverseContext;\n\nvar lcs = require('./lcs');\n\nvar ARRAY_MOVE = 3;\n\nvar isArray = (typeof Array.isArray === 'function') ?\n // use native function\n Array.isArray :\n // use instanceof operator\n function(a) {\n return a instanceof Array;\n };\n\nvar arrayIndexOf = typeof Array.prototype.indexOf === 'function' ?\n function(array, item) {\n return array.indexOf(item);\n } : function(array, item) {\n var length = array.length;\n for (var i = 0; i < length; i++) {\n if (array[i] === item) {\n return i;\n }\n }\n return -1;\n };\n\nfunction arraysHaveMatchByRef(array1, array2, len1, len2) {\n for (var index1 = 0; index1 < len1; index1++) {\n var val1 = array1[index1];\n for (var index2 = 0; index2 < len2; index2++) {\n var val2 = array2[index2];\n if (index1 !== index2 && val1 === val2) {\n return true;\n }\n }\n }\n}\n\nfunction matchItems(array1, array2, index1, index2, context) {\n var value1 = array1[index1];\n var value2 = array2[index2];\n if (value1 === value2) {\n return true;\n }\n if (typeof value1 !== 'object' || typeof value2 !== 'object') {\n return false;\n }\n var objectHash = context.objectHash;\n if (!objectHash) {\n // no way to match objects was provided, try match by position\n return context.matchByPosition && index1 === index2;\n }\n var hash1;\n var hash2;\n if (typeof index1 === 'number') {\n context.hashCache1 = context.hashCache1 || [];\n hash1 = context.hashCache1[index1];\n if (typeof hash1 === 'undefined') {\n context.hashCache1[index1] = hash1 = objectHash(value1, index1);\n }\n } else {\n hash1 = objectHash(value1);\n }\n if (typeof hash1 === 'undefined') {\n return false;\n }\n if (typeof index2 === 'number') {\n context.hashCache2 = context.hashCache2 || [];\n hash2 = context.hashCache2[index2];\n if (typeof hash2 === 'undefined') {\n context.hashCache2[index2] = hash2 = objectHash(value2, index2);\n }\n } else {\n hash2 = objectHash(value2);\n }\n if (typeof hash2 === 'undefined') {\n return false;\n }\n return hash1 === hash2;\n}\n\nvar diffFilter = function arraysDiffFilter(context) {\n if (!context.leftIsArray) {\n return;\n }\n\n var matchContext = {\n objectHash: context.options && context.options.objectHash,\n matchByPosition: context.options && context.options.matchByPosition\n };\n var commonHead = 0;\n var commonTail = 0;\n var index;\n var index1;\n var index2;\n var array1 = context.left;\n var array2 = context.right;\n var len1 = array1.length;\n var len2 = array2.length;\n\n var child;\n\n if (len1 > 0 && len2 > 0 && !matchContext.objectHash &&\n typeof matchContext.matchByPosition !== 'boolean') {\n matchContext.matchByPosition = !arraysHaveMatchByRef(array1, array2, len1, len2);\n }\n\n // separate common head\n while (commonHead < len1 && commonHead < len2 &&\n matchItems(array1, array2, commonHead, commonHead, matchContext)) {\n index = commonHead;\n child = new DiffContext(context.left[index], context.right[index]);\n context.push(child, index);\n commonHead++;\n }\n // separate common tail\n while (commonTail + commonHead < len1 && commonTail + commonHead < len2 &&\n matchItems(array1, array2, len1 - 1 - commonTail, len2 - 1 - commonTail, matchContext)) {\n index1 = len1 - 1 - commonTail;\n index2 = len2 - 1 - commonTail;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n commonTail++;\n }\n var result;\n if (commonHead + commonTail === len1) {\n if (len1 === len2) {\n // arrays are identical\n context.setResult(undefined).exit();\n return;\n }\n // trivial case, a block (1 or more consecutive items) was added\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len2 - commonTail; index++) {\n result[index] = [array2[index]];\n }\n context.setResult(result).exit();\n return;\n }\n if (commonHead + commonTail === len2) {\n // trivial case, a block (1 or more consecutive items) was removed\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n result['_' + index] = [array1[index], 0, 0];\n }\n context.setResult(result).exit();\n return;\n }\n // reset hash cache\n delete matchContext.hashCache1;\n delete matchContext.hashCache2;\n\n // diff is not trivial, find the LCS (Longest Common Subsequence)\n var trimmed1 = array1.slice(commonHead, len1 - commonTail);\n var trimmed2 = array2.slice(commonHead, len2 - commonTail);\n var seq = lcs.get(\n trimmed1, trimmed2,\n matchItems,\n matchContext\n );\n var removedItems = [];\n result = result || {\n _t: 'a'\n };\n for (index = commonHead; index < len1 - commonTail; index++) {\n if (arrayIndexOf(seq.indices1, index - commonHead) < 0) {\n // removed\n result['_' + index] = [array1[index], 0, 0];\n removedItems.push(index);\n }\n }\n\n var detectMove = true;\n if (context.options && context.options.arrays && context.options.arrays.detectMove === false) {\n detectMove = false;\n }\n var includeValueOnMove = false;\n if (context.options && context.options.arrays && context.options.arrays.includeValueOnMove) {\n includeValueOnMove = true;\n }\n\n var removedItemsLength = removedItems.length;\n for (index = commonHead; index < len2 - commonTail; index++) {\n var indexOnArray2 = arrayIndexOf(seq.indices2, index - commonHead);\n if (indexOnArray2 < 0) {\n // added, try to match with a removed item and register as position move\n var isMove = false;\n if (detectMove && removedItemsLength > 0) {\n for (var removeItemIndex1 = 0; removeItemIndex1 < removedItemsLength; removeItemIndex1++) {\n index1 = removedItems[removeItemIndex1];\n if (matchItems(trimmed1, trimmed2, index1 - commonHead,\n index - commonHead, matchContext)) {\n // store position move as: [originalValue, newPosition, ARRAY_MOVE]\n result['_' + index1].splice(1, 2, index, ARRAY_MOVE);\n if (!includeValueOnMove) {\n // don't include moved value on diff, to save bytes\n result['_' + index1][0] = '';\n }\n\n index2 = index;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n removedItems.splice(removeItemIndex1, 1);\n isMove = true;\n break;\n }\n }\n }\n if (!isMove) {\n // added\n result[index] = [array2[index]];\n }\n } else {\n // match, do inner diff\n index1 = seq.indices1[indexOnArray2] + commonHead;\n index2 = seq.indices2[indexOnArray2] + commonHead;\n child = new DiffContext(context.left[index1], context.right[index2]);\n context.push(child, index2);\n }\n }\n\n context.setResult(result).exit();\n\n};\ndiffFilter.filterName = 'arrays';\n\nvar compare = {\n numerically: function(a, b) {\n return a - b;\n },\n numericallyBy: function(name) {\n return function(a, b) {\n return a[name] - b[name];\n };\n }\n};\n\nvar patchFilter = function nestedPatchFilter(context) {\n if (!context.nested) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var index, index1;\n\n var delta = context.delta;\n var array = context.left;\n\n // first, separate removals, insertions and modifications\n var toRemove = [];\n var toInsert = [];\n var toModify = [];\n for (index in delta) {\n if (index !== '_t') {\n if (index[0] === '_') {\n // removed item from original array\n if (delta[index][2] === 0 || delta[index][2] === ARRAY_MOVE) {\n toRemove.push(parseInt(index.slice(1), 10));\n } else {\n throw new Error('only removal or move can be applied at original array indices' +\n ', invalid diff type: ' + delta[index][2]);\n }\n } else {\n if (delta[index].length === 1) {\n // added item at new array\n toInsert.push({\n index: parseInt(index, 10),\n value: delta[index][0]\n });\n } else {\n // modified item at new array\n toModify.push({\n index: parseInt(index, 10),\n delta: delta[index]\n });\n }\n }\n }\n }\n\n // remove items, in reverse order to avoid sawing our own floor\n toRemove = toRemove.sort(compare.numerically);\n for (index = toRemove.length - 1; index >= 0; index--) {\n index1 = toRemove[index];\n var indexDiff = delta['_' + index1];\n var removedValue = array.splice(index1, 1)[0];\n if (indexDiff[2] === ARRAY_MOVE) {\n // reinsert later\n toInsert.push({\n index: indexDiff[1],\n value: removedValue\n });\n }\n }\n\n // insert items, in reverse order to avoid moving our own floor\n toInsert = toInsert.sort(compare.numericallyBy('index'));\n var toInsertLength = toInsert.length;\n for (index = 0; index < toInsertLength; index++) {\n var insertion = toInsert[index];\n array.splice(insertion.index, 0, insertion.value);\n }\n\n // apply modifications\n var toModifyLength = toModify.length;\n var child;\n if (toModifyLength > 0) {\n for (index = 0; index < toModifyLength; index++) {\n var modification = toModify[index];\n child = new PatchContext(context.left[modification.index], modification.delta);\n context.push(child, modification.index);\n }\n }\n\n if (!context.children) {\n context.setResult(context.left).exit();\n return;\n }\n context.exit();\n};\npatchFilter.filterName = 'arrays';\n\nvar collectChildrenPatchFilter = function collectChildrenPatchFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var length = context.children.length;\n var child;\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n context.left[child.childName] = child.result;\n }\n context.setResult(context.left).exit();\n};\ncollectChildrenPatchFilter.filterName = 'arraysCollectChildren';\n\nvar reverseFilter = function arraysReverseFilter(context) {\n if (!context.nested) {\n if (context.delta[2] === ARRAY_MOVE) {\n context.newName = '_' + context.delta[1];\n context.setResult([context.delta[0], parseInt(context.childName.substr(1), 10), ARRAY_MOVE]).exit();\n }\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var name, child;\n for (name in context.delta) {\n if (name === '_t') {\n continue;\n }\n child = new ReverseContext(context.delta[name]);\n context.push(child, name);\n }\n context.exit();\n};\nreverseFilter.filterName = 'arrays';\n\nvar reverseArrayDeltaIndex = function(delta, index, itemDelta) {\n if (typeof index === 'string' && index[0] === '_') {\n return parseInt(index.substr(1), 10);\n } else if (isArray(itemDelta) && itemDelta[2] === 0) {\n return '_' + index;\n }\n\n var reverseIndex = +index;\n for (var deltaIndex in delta) {\n var deltaItem = delta[deltaIndex];\n if (isArray(deltaItem)) {\n if (deltaItem[2] === ARRAY_MOVE) {\n var moveFromIndex = parseInt(deltaIndex.substr(1), 10);\n var moveToIndex = deltaItem[1];\n if (moveToIndex === +index) {\n return moveFromIndex;\n }\n if (moveFromIndex <= reverseIndex && moveToIndex > reverseIndex) {\n reverseIndex++;\n } else if (moveFromIndex >= reverseIndex && moveToIndex < reverseIndex) {\n reverseIndex--;\n }\n } else if (deltaItem[2] === 0) {\n var deleteIndex = parseInt(deltaIndex.substr(1), 10);\n if (deleteIndex <= reverseIndex) {\n reverseIndex++;\n }\n } else if (deltaItem.length === 1 && deltaIndex <= reverseIndex) {\n reverseIndex--;\n }\n }\n }\n\n return reverseIndex;\n};\n\nvar collectChildrenReverseFilter = function collectChildrenReverseFilter(context) {\n if (!context || !context.children) {\n return;\n }\n if (context.delta._t !== 'a') {\n return;\n }\n var length = context.children.length;\n var child;\n var delta = {\n _t: 'a'\n };\n\n for (var index = 0; index < length; index++) {\n child = context.children[index];\n var name = child.newName;\n if (typeof name === 'undefined') {\n name = reverseArrayDeltaIndex(context.delta, child.childName, child.result);\n }\n if (delta[name] !== child.result) {\n delta[name] = child.result;\n }\n }\n context.setResult(delta).exit();\n};\ncollectChildrenReverseFilter.filterName = 'arraysCollectChildren';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.collectChildrenPatchFilter = collectChildrenPatchFilter;\nexports.reverseFilter = reverseFilter;\nexports.collectChildrenReverseFilter = collectChildrenReverseFilter;\n","var diffFilter = function datesDiffFilter(context) {\n if (context.left instanceof Date) {\n if (context.right instanceof Date) {\n if (context.left.getTime() !== context.right.getTime()) {\n context.setResult([context.left, context.right]);\n } else {\n context.setResult(undefined);\n }\n } else {\n context.setResult([context.left, context.right]);\n }\n context.exit();\n } else if (context.right instanceof Date) {\n context.setResult([context.left, context.right]).exit();\n }\n};\ndiffFilter.filterName = 'dates';\n\nexports.diffFilter = diffFilter;\n","/* global diff_match_patch */\nvar TEXT_DIFF = 2;\nvar DEFAULT_MIN_LENGTH = 60;\nvar cachedDiffPatch = null;\n\nvar getDiffMatchPatch = function(required) {\n /*jshint camelcase: false */\n\n if (!cachedDiffPatch) {\n var instance;\n if (typeof diff_match_patch !== 'undefined') {\n // already loaded, probably a browser\n instance = typeof diff_match_patch === 'function' ?\n new diff_match_patch() : new diff_match_patch.diff_match_patch();\n } else if (typeof require === 'function') {\n try {\n var dmpModuleName = 'diff_match_patch_uncompressed';\n var dmp = require('../../public/external/' + dmpModuleName);\n instance = new dmp.diff_match_patch();\n } catch (err) {\n instance = null;\n }\n }\n if (!instance) {\n if (!required) {\n return null;\n }\n var error = new Error('text diff_match_patch library not found');\n error.diff_match_patch_not_found = true;\n throw error;\n }\n cachedDiffPatch = {\n diff: function(txt1, txt2) {\n return instance.patch_toText(instance.patch_make(txt1, txt2));\n },\n patch: function(txt1, patch) {\n var results = instance.patch_apply(instance.patch_fromText(patch), txt1);\n for (var i = 0; i < results[1].length; i++) {\n if (!results[1][i]) {\n var error = new Error('text patch failed');\n error.textPatchFailed = true;\n }\n }\n return results[0];\n }\n };\n }\n return cachedDiffPatch;\n};\n\nvar diffFilter = function textsDiffFilter(context) {\n if (context.leftType !== 'string') {\n return;\n }\n var minLength = (context.options && context.options.textDiff &&\n context.options.textDiff.minLength) || DEFAULT_MIN_LENGTH;\n if (context.left.length < minLength ||\n context.right.length < minLength) {\n context.setResult([context.left, context.right]).exit();\n return;\n }\n // large text, try to use a text-diff algorithm\n var diffMatchPatch = getDiffMatchPatch();\n if (!diffMatchPatch) {\n // diff-match-patch library not available, fallback to regular string replace\n context.setResult([context.left, context.right]).exit();\n return;\n }\n var diff = diffMatchPatch.diff;\n context.setResult([diff(context.left, context.right), 0, TEXT_DIFF]).exit();\n};\ndiffFilter.filterName = 'texts';\n\nvar patchFilter = function textsPatchFilter(context) {\n if (context.nested) {\n return;\n }\n if (context.delta[2] !== TEXT_DIFF) {\n return;\n }\n\n // text-diff, use a text-patch algorithm\n var patch = getDiffMatchPatch(true).patch;\n context.setResult(patch(context.left, context.delta[0])).exit();\n};\npatchFilter.filterName = 'texts';\n\nvar textDeltaReverse = function(delta) {\n var i, l, lines, line, lineTmp, header = null,\n headerRegex = /^@@ +\\-(\\d+),(\\d+) +\\+(\\d+),(\\d+) +@@$/,\n lineHeader, lineAdd, lineRemove;\n lines = delta.split('\\n');\n for (i = 0, l = lines.length; i < l; i++) {\n line = lines[i];\n var lineStart = line.slice(0, 1);\n if (lineStart === '@') {\n header = headerRegex.exec(line);\n lineHeader = i;\n lineAdd = null;\n lineRemove = null;\n\n // fix header\n lines[lineHeader] = '@@ -' + header[3] + ',' + header[4] + ' +' + header[1] + ',' + header[2] + ' @@';\n } else if (lineStart === '+') {\n lineAdd = i;\n lines[i] = '-' + lines[i].slice(1);\n if (lines[i - 1].slice(0, 1) === '+') {\n // swap lines to keep default order (-+)\n lineTmp = lines[i];\n lines[i] = lines[i - 1];\n lines[i - 1] = lineTmp;\n }\n } else if (lineStart === '-') {\n lineRemove = i;\n lines[i] = '+' + lines[i].slice(1);\n }\n }\n return lines.join('\\n');\n};\n\nvar reverseFilter = function textsReverseFilter(context) {\n if (context.nested) {\n return;\n }\n if (context.delta[2] !== TEXT_DIFF) {\n return;\n }\n\n // text-diff, use a text-diff algorithm\n context.setResult([textDeltaReverse(context.delta[0]), 0, TEXT_DIFF]).exit();\n};\nreverseFilter.filterName = 'texts';\n\nexports.diffFilter = diffFilter;\nexports.patchFilter = patchFilter;\nexports.reverseFilter = reverseFilter;\n","\nvar Pipe = require('../pipe').Pipe;\n\nvar Context = function Context(){\n};\n\nContext.prototype.setResult = function(result) {\n\tthis.result = result;\n\tthis.hasResult = true;\n\treturn this;\n};\n\nContext.prototype.exit = function() {\n\tthis.exiting = true;\n\treturn this;\n};\n\nContext.prototype.switchTo = function(next, pipe) {\n\tif (typeof next === 'string' || next instanceof Pipe) {\n\t\tthis.nextPipe = next;\n\t} else {\n\t\tthis.next = next;\n\t\tif (pipe) {\n\t\t\tthis.nextPipe = pipe;\n\t\t}\n\t}\n\treturn this;\n};\n\nContext.prototype.push = function(child, name) {\n\tchild.parent = this;\n\tif (typeof name !== 'undefined') {\n\t\tchild.childName = name;\n\t}\n\tchild.root = this.root || this;\n\tchild.options = child.options || this.options;\n\tif (!this.children) {\n\t\tthis.children = [child];\n\t\tthis.nextAfterChildren = this.next || null;\n\t\tthis.next = child;\n\t} else {\n\t\tthis.children[this.children.length - 1].next = child;\n\t\tthis.children.push(child);\n\t}\n\tchild.next = this;\n\treturn this;\n};\n\nexports.Context = Context;\n","/*\n\nLCS implementation that supports arrays or strings\n\nreference: http://en.wikipedia.org/wiki/Longest_common_subsequence_problem\n\n*/\n\nvar defaultMatch = function(array1, array2, index1, index2) {\n return array1[index1] === array2[index2];\n};\n\nvar lengthMatrix = function(array1, array2, match, context) {\n var len1 = array1.length;\n var len2 = array2.length;\n var x, y;\n\n // initialize empty matrix of len1+1 x len2+1\n var matrix = [len1 + 1];\n for (x = 0; x < len1 + 1; x++) {\n matrix[x] = [len2 + 1];\n for (y = 0; y < len2 + 1; y++) {\n matrix[x][y] = 0;\n }\n }\n matrix.match = match;\n // save sequence lengths for each coordinate\n for (x = 1; x < len1 + 1; x++) {\n for (y = 1; y < len2 + 1; y++) {\n if (match(array1, array2, x - 1, y - 1, context)) {\n matrix[x][y] = matrix[x - 1][y - 1] + 1;\n } else {\n matrix[x][y] = Math.max(matrix[x - 1][y], matrix[x][y - 1]);\n }\n }\n }\n return matrix;\n};\n\nvar backtrack = function(matrix, array1, array2, index1, index2, context) {\n if (index1 === 0 || index2 === 0) {\n return {\n sequence: [],\n indices1: [],\n indices2: []\n };\n }\n\n if (matrix.match(array1, array2, index1 - 1, index2 - 1, context)) {\n var subsequence = backtrack(matrix, array1, array2, index1 - 1, index2 - 1, context);\n subsequence.sequence.push(array1[index1 - 1]);\n subsequence.indices1.push(index1 - 1);\n subsequence.indices2.push(index2 - 1);\n return subsequence;\n }\n\n if (matrix[index1][index2 - 1] > matrix[index1 - 1][index2]) {\n return backtrack(matrix, array1, array2, index1, index2 - 1, context);\n } else {\n return backtrack(matrix, array1, array2, index1 - 1, index2, context);\n }\n};\n\nvar get = function(array1, array2, match, context) {\n context = context || {};\n var matrix = lengthMatrix(array1, array2, match || defaultMatch, context);\n var result = backtrack(matrix, array1, array2, array1.length, array2.length, context);\n if (typeof array1 === 'string' && typeof array2 === 'string') {\n result.sequence = result.sequence.join('');\n }\n return result;\n};\n\nexports.get = get;\n"]}