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
65 KiB
1 lines
65 KiB
{"version":3,"sources":["/source-files/jsondiffpatch/node_modules/fiberglass/node_modules/browserify/node_modules/browser-pack/_prelude.js","/source-files/jsondiffpatch/src/main.js","/source-files/jsondiffpatch/src/environment.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/clone.js","/source-files/jsondiffpatch/src/filters/trivial.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","DiffPatcher","exports","create","options","dateReviver","defaultInstance","diff","apply","arguments","patch","unpatch","reverse","clone","isBrowser","homepage","version","packageInfoModuleName","packageInfo","formatterModuleName","formatters","console","window","Processor","Pipe","DiffContext","PatchContext","ReverseContext","trivial","nested","arrays","dates","texts","this","processor","pipe","append","collectChildrenDiffFilter","diffFilter","objectsDiffFilter","shouldHaveResult","collectChildrenPatchFilter","patchFilter","collectChildrenReverseFilter","reverseFilter","prototype","left","right","process","delta","value","module","key","parts","exec","Date","UTC","selfOptions","pipes","name","input","context","lastPipe","lastContext","nextPipe","nextAfterChildren","next","hasResult","result","undefined","filters","Error","debug","length","index","filter","log","filterName","exiting","resultCheck","msg","push","prepend","unshift","indexOf","list","names","after","params","Array","slice","call","splice","before","clear","should","error","noResult","Context","defaultClone","setResult","cloneDiffValues","cloneRegExp","re","regexMatch","toString","RegExp","arg","isArray","map","getTime","cloned","Object","hasOwnProperty","a","exit","leftType","rightType","leftIsArray","rightIsArray","regexArgs","children","child","childName","_t","propertyFilter","arraysHaveMatchByRef","array1","array2","len1","len2","index1","val1","index2","val2","matchItems","value1","value2","objectHash","matchByPosition","hash1","hash2","hashCache1","hashCache2","lcs","ARRAY_MOVE","arrayIndexOf","array","item","i","matchContext","commonHead","commonTail","trimmed1","trimmed2","seq","get","removedItems","indices1","detectMove","includeValueOnMove","removedItemsLength","indexOnArray2","indices2","isMove","removeItemIndex1","compare","numerically","b","numericallyBy","toRemove","toInsert","toModify","parseInt","sort","indexDiff","removedValue","toInsertLength","insertion","toModifyLength","modification","newName","substr","reverseArrayDeltaIndex","itemDelta","reverseIndex","deltaIndex","deltaItem","moveFromIndex","moveToIndex","deleteIndex","TEXT_DIFF","DEFAULT_MIN_LENGTH","cachedDiffPatch","getDiffMatchPatch","required","instance","diff_match_patch","dmpModuleName","dmp","err","diff_match_patch_not_found","txt1","txt2","patch_toText","patch_make","results","patch_apply","patch_fromText","textPatchFailed","minLength","textDiff","diffMatchPatch","textDeltaReverse","l","lines","line","lineTmp","lineHeader","lineAdd","lineRemove","header","headerRegex","split","lineStart","join","switchTo","parent","root","defaultMatch","lengthMatrix","match","x","y","matrix","Math","max","backtrack","sequence","subsequence"],"mappings":"AAAA;ACCA,GAAIA,aAAcC,QAAQ,iBAEtBC,YAAcD,QAAQ,iBAAiBC,WAC3CC,SAAQD,YAAcA,YAEtBC,QAAQC,OAAS,SAASC,GACxB,MAAO,IAAIH,aAAYG,IAGzBF,QAAQG,YAAcL,QAAQ,iBAE9B,IAAIM,gBAsCJ,IApCAJ,QAAQK,KAAO,WAIb,MAHKD,mBACHA,gBAAkB,GAAIL,cAEjBK,gBAAgBC,KAAKC,MAAMF,gBAAiBG,YAGrDP,QAAQQ,MAAQ,WAId,MAHKJ,mBACHA,gBAAkB,GAAIL,cAEjBK,gBAAgBI,MAAMF,MAAMF,gBAAiBG,YAGtDP,QAAQS,QAAU,WAIhB,MAHKL,mBACHA,gBAAkB,GAAI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F,EACdC,EAAWE,EACXA,EAAW,KACPH,GACEA,EAAQK,OACVL,EAAUA,EAAQK,KAClBF,EAAWD,EAAYC,UAAYH,EAAQ1B,MAAQ2B,EAIzD,OAAOD,GAAQM,UAAYN,EAAQO,OAASC,QAG9CnE,QAAQqB,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})","\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","\nexports.isBrowser = typeof window !== 'undefined';\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","\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 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","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"]} |