happo 2.8.1 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/happo/public/026c001beac0620bb23a.worker.js +50 -0
- data/lib/happo/public/05ad45a945afc6882286.worker.js +56 -0
- data/lib/happo/public/0dd329b74ed90a207896.worker.js +56 -0
- data/lib/happo/public/174b944ab9e9053c766d.worker.js +56 -0
- data/lib/happo/public/196b75660e2791fda25a.worker.js +56 -0
- data/lib/happo/public/1d5c0eb9c479f44f0ec2.worker.js +56 -0
- data/lib/happo/public/1d6c41b4828b191ae315.worker.js +56 -0
- data/lib/happo/public/212269d558f1f8b1bc63.worker.js +56 -0
- data/lib/happo/public/25426637d793045ccb77.worker.js +56 -0
- data/lib/happo/public/28537ac53e64479763ba.worker.js +56 -0
- data/lib/happo/public/30e3af0e8f974da2885c.worker.js +56 -0
- data/lib/happo/public/32fc2a09f98d30cb2a06.worker.js +56 -0
- data/lib/happo/public/33c43f9f1296a6c3b236.worker.js +56 -0
- data/lib/happo/public/3a6592504d8ee1810017.worker.js +56 -0
- data/lib/happo/public/3a8bedd3121a2cdacb6d.worker.js +56 -0
- data/lib/happo/public/3d9ed68ca315896c8ec7.worker.js +56 -0
- data/lib/happo/public/3da88471c60703398f95.worker.js +56 -0
- data/lib/happo/public/40c1aadf458bda245630.worker.js +1 -0
- data/lib/happo/public/41749e1ff9db63f87a1e.worker.js +56 -0
- data/lib/happo/public/42bc2c20d61979a23a2f.worker.js +56 -0
- data/lib/happo/public/447f3bfe79be8a67b9cc.worker.js +56 -0
- data/lib/happo/public/4580dd75ba5a064f4366.worker.js +56 -0
- data/lib/happo/public/4975b25fe791d85e9827.worker.js +56 -0
- data/lib/happo/public/4b23fa5d7875a8fba618.worker.js +56 -0
- data/lib/happo/public/4ecbb720788698ce7a9b.worker.js +56 -0
- data/lib/happo/public/4ef2e26b666b08b7411a.worker.js +56 -0
- data/lib/happo/public/51ac7ca571ae07cd9d7a.worker.js +56 -0
- data/lib/happo/public/531d99f56a3343cee5f8.worker.js +56 -0
- data/lib/happo/public/53e6a60c2cf0558157a7.worker.js +56 -0
- data/lib/happo/public/55d488167040d5350534.worker.js +56 -0
- data/lib/happo/public/588f7a6b784ef2b87932.worker.js +56 -0
- data/lib/happo/public/59d03b8990473ae492e0.worker.js +56 -0
- data/lib/happo/public/5aded6f9af816e819a2b.worker.js +56 -0
- data/lib/happo/public/5e6771e4a41f597c26a9.worker.js +56 -0
- data/lib/happo/public/61e924aed1761ec05ca0.worker.js +56 -0
- data/lib/happo/public/65e7608bb10d0f2250d1.worker.js +56 -0
- data/lib/happo/public/6a71a1273a0cf4065e1e.worker.js +56 -0
- data/lib/happo/public/727ca4589d56ddcb9c7f.worker.js +56 -0
- data/lib/happo/public/769883a4d5abfa7384d4.worker.js +56 -0
- data/lib/happo/public/78fea81d29830297df57.worker.js +56 -0
- data/lib/happo/public/7bf45d52cf57b1949851.worker.js +56 -0
- data/lib/happo/public/7d4a4086de8530abe101.worker.js +56 -0
- data/lib/happo/public/7e330bc3ee246ab39910.worker.js +56 -0
- data/lib/happo/public/84f3a66517b77798456d.worker.js +56 -0
- data/lib/happo/public/856dbe98c40d8f4bd452.worker.js +56 -0
- data/lib/happo/public/90a4b81e4d7c2da63973.worker.js +56 -0
- data/lib/happo/public/92dd03e7cbe827a2df45.worker.js +56 -0
- data/lib/happo/public/94976fe48214f2bc68d6.worker.js +56 -0
- data/lib/happo/public/95f3e6e7eec59c0af3e5.worker.js +56 -0
- data/lib/happo/public/96c4c2f5df8175649a67.worker.js +56 -0
- data/lib/happo/public/973a6ae106ac4e664858.worker.js +56 -0
- data/lib/happo/public/989e9ba236891bdfcf46.worker.js +56 -0
- data/lib/happo/public/HappoApp.bundle.js +1 -2
- data/lib/happo/public/a50e9af74a422839a15c.worker.js +56 -0
- data/lib/happo/public/ad4fdfa82741585ce164.worker.js +56 -0
- data/lib/happo/public/ae0622a81101951ac112.worker.js +56 -0
- data/lib/happo/public/ae223678cdbfac88d9be.worker.js +56 -0
- data/lib/happo/public/b441a6c1393a5d39b5ff.worker.js +56 -0
- data/lib/happo/public/b4c84506199d5745d950.worker.js +56 -0
- data/lib/happo/public/b5176c936b696653a407.worker.js +56 -0
- data/lib/happo/public/b86b963a72892d8f0fd1.worker.js +56 -0
- data/lib/happo/public/ba50214d2b6ac001493b.worker.js +56 -0
- data/lib/happo/public/bb6413d1cea030ba7a1e.worker.js +56 -0
- data/lib/happo/public/bc084ad60fb7dbbe0818.worker.js +56 -0
- data/lib/happo/public/c15e6b44ae496af6af9b.worker.js +56 -0
- data/lib/happo/public/c4393394848f5242932e.worker.js +56 -0
- data/lib/happo/public/c60ceaff7849b394e27a.worker.js +56 -0
- data/lib/happo/public/c67c76de1e4def5019d5.worker.js +56 -0
- data/lib/happo/public/c7969739b50b79043b86.worker.js +56 -0
- data/lib/happo/public/cc82d7609935eb1d2738.worker.js +56 -0
- data/lib/happo/public/d135dda9b0318be75e3c.worker.js +56 -0
- data/lib/happo/public/d2aded5d63912f5b7e1b.worker.js +56 -0
- data/lib/happo/public/d2be644581f8f67b207d.worker.js +56 -0
- data/lib/happo/public/d6e037d3891cfb95fbca.worker.js +50 -0
- data/lib/happo/public/d7440908d264133044bb.worker.js +56 -0
- data/lib/happo/public/da071c51e9a641ed805c.worker.js +56 -0
- data/lib/happo/public/dbe8eef9555ef0d43469.worker.js +56 -0
- data/lib/happo/public/e1cbbfd7a3d705049eb0.worker.js +56 -0
- data/lib/happo/public/e3882591e6710cf03ed4.worker.js +56 -0
- data/lib/happo/public/e414c768d66b9bcf86bb.worker.js +56 -0
- data/lib/happo/public/e85bc4bb461158f5561d.worker.js +56 -0
- data/lib/happo/public/ed6256235d0a2b11aaf6.worker.js +56 -0
- data/lib/happo/public/edcc84bf4483670ba23e.worker.js +56 -0
- data/lib/happo/public/f3d33d482a4326121c45.worker.js +56 -0
- data/lib/happo/public/f67e23a954230ea878be.worker.js +56 -0
- data/lib/happo/public/f800c3a1d9200926bde6.worker.js +56 -0
- data/lib/happo/public/f8954fa2849952175e2c.worker.js +56 -0
- data/lib/happo/public/fde5a206ff86c3d7ab10.worker.js +56 -0
- data/lib/happo/public/globe-current.png +0 -0
- data/lib/happo/public/globe-previous.png +0 -0
- data/lib/happo/server.rb +7 -0
- data/lib/happo/version.rb +1 -1
- metadata +91 -3
- data/lib/happo/public/happo-logo.svg +0 -1
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0a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wgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n console.log(memo);\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var aLength = a.length;\n var bLength = b.length;\n var ai = aLength;\n var bi = bLength;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n ai--;\n bi--;\n var diffI = aLength - ai - (bLength - bi);\n console.log(ai, bi, diffI);\n if (diffI < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(diffI)))));\n } else if (diffI > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(Math.abs(diffI)))));\n }\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n applySolution(lcsSolution, a, b);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5nd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zZSBpZiAoZGlmZkkgPiAwKSB7XG4gICAgICAgIGEuc3BsaWNlKGFpLCAwLCAuLi5wbGFjZWhvbGRlcnMoTWF0aC5hYnMoZGlmZkkpKSk7XG4gICAgICB9XG4gICAgfSBlbHNlIGlmIChtb3ZlbWVudCA9PT0gTU9WRU1FTlQuaG9yaXpvbnRhbCkge1xuICAgICAgYmktLTtcbiAgICB9IGVsc2UgaWYgKG1vdmVtZW50ID09PSBNT1ZFTUVOVC52ZXJ0aWNhbCkge1xuICAgICAgYWktLTtcbiAgICB9XG4gICAgbW92ZW1lbnQgPSBzb2x1dGlvblthaV1bYmldO1xuICB9XG59XG5cbi8qKlxuICogQ29tcHV0ZXMgdGhlIGxvbmdlc3QgY29tbW9uIHN1YnNlcXVlbmNlIG9mIHR3byBhcnJheXMsIHRoZW4gdXNlcyB0aGF0XG4gKiBzb2x1dGlvbiB0byBpbmplY3QgZ2FwcyBpbnRvIHRoZSBhcnJheXMsIG1ha2luZyB0aGVtIGFsaWduIG9uIGNvbW1vblxuICogc3Vic2VxdWVuY2VzLlxuICpcbiAqIEBwYXJhbSB7QXJyYXl9IGFcbiAqIEBwYXJhbSB7QXJyYXl9IGJcbiAqL1xuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gYWxpZ25BcnJheXMoYSwgYikge1xuICBjb25zdCBsY3NTb2x1dGlvbiA9IGxvbmdlc3RDb21tb25TdWJzZXF1ZW5jZShhLCBiKTtcbiAgYXBwbHlTb2x1dGlvbihsY3NTb2x1dGlvbiwgYSwgYik7XG59XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy9hbGlnbkFycmF5cy5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0aCIsImFkZEV2ZW50TGlzdGVuZXIiLCJyZXN1bHQiLCJjbG9zZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUEsU0FBU0EsY0FBVCxPQUFpREMsWUFBakQsRUFBK0Q7QUFBQSxNQUFyQ0MsSUFBcUMsUUFBckNBLElBQXFDO0FBQUEsTUFBL0JDLEtBQStCLFFBQS9CQSxLQUErQjtBQUFBLE1BQXhCQyxNQUF3QixRQUF4QkEsTUFBd0I7O0FBQzdEO0F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+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\n/**\n * Creates a 2d matrix of a certain size.\n *\n * @param {number} height\n * @param {number} width\n * @return {Array<Array>}\n */\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\n/**\n * Compute a solution matrix to find the longest common subsequence between two\n * arrays. Adapted from\n * http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n *\n * @param {Array} a\n * @param {Array} b\n * @return {Array<Array>} a matrix containing MOVEMENT markers\n */\nfunction longestCommonSubsequence(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No solution found\n return null;\n }\n return solution;\n}\n\n/**\n * Constructs an array of placeholder strings, e.g.\n * ['x', 'x', 'x'].\n *\n * @param {number} count\n * @return Array<String>\n */\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.splice.apply(shorterArray, [0, 0].concat(_toConsumableArray(placeholders(Math.abs(aLength - bLength)))));\n}\n\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n ai--;\n bi--;\n changes = 0;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n applyPadding(a, b);\n}\n\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n } else {\n applyPadding(a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWd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AgYXBwbHlQYWRkaW5nKGEsIGIpO1xufVxuXG4vKipcbiAqIENvbXB1dGVzIHRoZSBsb25nZXN0IGNvbW1vbiBzdWJzZXF1ZW5jZSBvZiB0d28gYXJyYXlzLCB0aGVuIHVzZXMgdGhhdFxuICogc29sdXRpb24gdG8gaW5qZWN0IGdhcHMgaW50byB0aGUgYXJyYXlzLCBtYWtpbmcgdGhlbSBhbGlnbiBvbiBjb21tb25cbiAqIHN1YnNlcXVlbmNlcy5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhXG4gKiBAcGFyYW0ge0FycmF5fSBiXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGFsaWduQXJyYXlzKGEsIGIpIHtcbiAgY29uc3QgbGNzU29sdXRpb24gPSBsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UoYSwgYik7XG4gIGlmIChsY3NTb2x1dGlvbikge1xuICAgIGFwcGx5U29sdXRpb24obGNzU29sdXRpb24sIGEsIGIpO1xuICB9IGVsc2Uge1xuICAgIGFwcGx5UGFkZGluZyhhLCBiKTtcbiAgfVxufVxuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvYWxpZ25BcnJheXMuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXI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Sh7IHByb2dyZXNzOiA4NSB9KTtcblxuICByZXR1cm4ge1xuICAgIGN1cnJlbnREYXRhOiB7XG4gICAgICBkYXRhOiBjdXJyZW50SW1hZ2VEYXRhLFxuICAgICAgaGVpZ2h0OiBjdXJyZW50SW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICAgIHByZXZpb3VzRGF0YToge1xuICAgICAgZGF0YTogcHJldmlvdXNJbWFnZURhdGEsXG4gICAgICBoZWlnaHQ6IHByZXZpb3VzSW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICB9O1xufVxuXG5zZWxmLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No soltuion found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n function applyChange() {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n changes = 0;\n }\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n applyChange();\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n if (ai !== bi) {\n b.splice.apply(b, [0, 0].concat(_toConsumableArray(placeholders(ai))));\n a.splice.apply(a, [0, 0].concat(_toConsumableArray(placeholders(bi))));\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n } else {\n applyPadding(a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5ndGgiLCJiTGVuZ3RoIiwibWVtbyIsInNvbHV0aW9uIiwiaiIsIk1hdGgiLCJtYXgiLCJwbGFjZWhvbGRlcnMiLCJjb3VudCIsInJlc3VsdCIsImFwcGx5U29sdXRpb24iLCJtb3ZlbWVudCIsImFpIiwiYmkiLCJjaGFuZ2VzIiwiYXBwb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G4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -1,2 +1 @@
|
|
1
|
-
!function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var o=r(1),i=n(o),a=r(24),u=n(a),s=r(10),l=n(s);document.addEventListener("DOMContentLoaded",function(){u["default"].render(i["default"].createElement(l["default"],window.APP_PROPS),document.getElementById("react-root"))})},function(e,t){e.exports=React},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t["default"]={description:n.PropTypes.string.isRequired,viewport:n.PropTypes.string.isRequired,previous:n.PropTypes.string,current:n.PropTypes.string.isRequired,height:n.PropTypes.number.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.to;return a["default"].createElement("a",{className:"InlineLink",href:"#"+r},t)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i);o.propTypes={children:i.PropTypes.node.isRequired,to:i.PropTypes.string.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.image;return a["default"].createElement("h3",{id:(0,p["default"])(t)},a["default"].createElement(s["default"],{to:(0,p["default"])(t)},t.description," @ ",t.viewport))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),s=n(u),l=r(2),f=n(l),c=r(19),p=n(c);o.propTypes={image:i.PropTypes.shape(f["default"]).isRequired}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={DIFF:"Diff",SIDE_BY_SIDE:"Side-by-side",SWIPE:"Swipe"}},function(e,t){var r=window.URL||window.webkitURL;e.exports=function(e,t){try{try{var n;try{var o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;n=new o,n.append(e),n=n.getBlob()}catch(i){n=new Blob([e])}return new Worker(r.createObjectURL(n))}catch(i){return new Worker("data:application/javascript,"+encodeURIComponent(e))}}catch(i){return new Worker(t)}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),l=n(s),f=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={keepMounted:e.visible},r}return a(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){e.visible!==this.props.visible&&this.setState({keepMounted:!0})}},{key:"render",value:function(){var e=this.props.visible,t=this.state.keepMounted;return e||t?l["default"].createElement("div",{style:{display:e?"block":"none"}},this.props.children):null}}]),t}(l["default"].Component);t["default"]=f,f.propTypes={children:s.PropTypes.node.isRequired,visible:s.PropTypes.bool}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){var t=e.image,r=e.selectedView,n=e.onClick,o=t.height+t.height/10;return f["default"].createElement("div",null,f["default"].createElement(p["default"],{image:t}),f["default"].createElement("div",{className:"Diff__buttons"},Object.keys(g["default"]).map(function(e){return g["default"][e]}).map(function(e,t){var o=["Diff__button"];return 0===t?o.push("Diff__button--first"):t===Object.keys(g["default"]).length-1&&o.push("Diff__button--last"),f["default"].createElement("button",{key:e,className:o.join(" "),"aria-pressed":e===r,onClick:function(){n(e)}},e)})),f["default"].createElement("div",{className:"Diff__images",style:{minHeight:o}},f["default"].createElement(h["default"],{image:t,selectedView:r})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=t.DiffController=void 0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(1),f=n(l),c=r(4),p=n(c),d=r(14),h=n(d),v=r(5),g=n(v),y=r(2),m=n(y),b=t.DiffController=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={selectedView:g["default"].DIFF},r.handleClick=r.handleClick.bind(r),r}return a(t,e),s(t,[{key:"handleClick",value:function(e){this.setState({selectedView:e})}},{key:"render",value:function(){return f["default"].createElement(u,{image:this.props.image,selectedView:this.state.selectedView,onClick:this.handleClick})}}]),t}(f["default"].Component);b.propTypes={image:l.PropTypes.shape(m["default"]).isRequired},t["default"]=u,u.propTypes={image:l.PropTypes.shape(m["default"]).isRequired,onClick:l.PropTypes.func.isRequired,selectedView:l.PropTypes.oneOf(Object.keys(g["default"]).map(function(e){return g["default"][e]})).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.images;return t.length?a["default"].createElement("div",null,a["default"].createElement("h2",{id:"diffs"},a["default"].createElement(l["default"],{to:"diffs"},"Diffs (",t.length,")")),t.map(function(e){return a["default"].createElement(u.DiffController,{key:e.current,image:e})})):null}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(8),s=r(3),l=n(s),f=r(2),c=n(f);o.propTypes={images:i.PropTypes.arrayOf(i.PropTypes.shape(c["default"])).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.pageTitle,r=e.generatedAt,n=e.diffImages,o=e.newImages,i=e.triggeredByUrl;return a["default"].createElement("div",null,a["default"].createElement("header",{className:"HappoDiffs__header"},a["default"].createElement("h1",{className:"HappoDiffs__headerTitle"},t),a["default"].createElement("div",null,"Generated: ",r),i&&a["default"].createElement("div",null,"Triggered by:"," ",a["default"].createElement("a",{href:i},i))),a["default"].createElement("main",{className:"HappoDiffs__main"},a["default"].createElement(s["default"],{images:n}),a["default"].createElement(f["default"],{images:o})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(9),s=n(u),l=r(13),f=n(l),c=r(2),p=n(c);o.propTypes={pageTitle:i.PropTypes.string.isRequired,diffImages:i.PropTypes.arrayOf(p["default"]).isRequired,newImages:i.PropTypes.arrayOf(p["default"]).isRequired,generatedAt:i.PropTypes.string.isRequired,triggeredByUrl:i.PropTypes.string}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(s){o=!0,i=s}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(1),f=n(l),c=r(21),p=n(c),d=r(16),h=n(d),v=r(18),g=n(v),y=r(23),m=r(22),b=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={progress:0,width:0,height:0},r.initialize=r.initialize.bind(r),r}return a(t,e),s(t,[{key:"initialize",value:function(){var e=this,t=this.props,r=t.previous,n=t.current;Promise.all([(0,g["default"])(r),(0,g["default"])(n)]).then(function(t){var r=u(t,2),n=r[0],o=r[1];e.setState({progress:10,width:n.width,height:n.height}),e.computeDiffs({previousData:n,currentData:o})})}},{key:"computeDiffs",value:function(e){var t=this,r=e.previousData,n=e.currentData,o=new m;o.addEventListener("message",function(e){var r=e.data,n=r.previousData,o=r.currentData,i=r.progress;return n?(t.setState({width:n.width,height:n.height}),void t.constructDiffImage({previousData:n,currentData:o})):void t.setState({progress:i})}),o.postMessage({previousData:r,currentData:n})}},{key:"constructDiffImage",value:function(e){var t=this,r=e.previousData,n=e.currentData,o=new y;o.addEventListener("message",function(e){var r=e.data,n=r.data,o=r.width,i=r.height;t.setState({progress:99,width:o,height:i});var a=t.canvas.getContext("2d"),u=a.createImageData(o,i);u.data.set(n),a.putImageData(u,0,0),t.setState({progress:100})}),o.postMessage({previousImageData:r.data,currentImageData:n.data})}},{key:"render",value:function(){var e=this,t=this.state,r=t.width,n=t.height,o=t.progress;return f["default"].createElement("div",{style:{height:n,width:r}},o>0&&o<100&&f["default"].createElement(h["default"],{value:o}),0===o&&f["default"].createElement(p["default"],{onEnter:this.initialize,scrollableAncestor:window,bottomOffset:"-50%",topOffset:"-70%"}),f["default"].createElement("canvas",{ref:function(t){e.canvas=t},width:r,height:n}))}}]),t}(f["default"].Component);t["default"]=b,b.propTypes={previous:l.PropTypes.string.isRequired,current:l.PropTypes.string.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.image;return a["default"].createElement("div",null,a["default"].createElement(s["default"],{image:t}),a["default"].createElement("div",{className:"NewImage__image",style:{minHeight:t.height}},a["default"].createElement("img",{role:"presentation",src:t.current})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(4),s=n(u),l=r(2),f=n(l);o.propTypes={image:i.PropTypes.shape(f["default"]).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.images;return t.length?a["default"].createElement("div",null,a["default"].createElement("h2",{id:"new"},a["default"].createElement(s["default"],{to:"new"},"New examples (",t.length,")")),t.map(function(e){return a["default"].createElement(f["default"],{key:e.current,image:e})})):null}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),s=n(u),l=r(12),f=n(l),c=r(2),p=n(c);o.propTypes={images:i.PropTypes.arrayOf(i.PropTypes.shape(p["default"])).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.image,r=e.selectedView;return a["default"].createElement("div",null,a["default"].createElement(s["default"],{visible:r===g["default"].SIDE_BY_SIDE},a["default"].createElement(p["default"],{previous:t.previous,current:t.current})),a["default"].createElement(s["default"],{visible:r===g["default"].DIFF},a["default"].createElement(f["default"],{previous:t.previous,current:t.current})),a["default"].createElement(s["default"],{visible:r===g["default"].SWIPE},a["default"].createElement(h["default"],{previous:t.previous,current:t.current})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(7),s=n(u),l=r(11),f=n(l),c=r(15),p=n(c),d=r(17),h=n(d),v=r(5),g=n(v),y=r(2),m=n(y);o.propTypes={image:i.PropTypes.shape(m["default"]).isRequired,selectedView:i.PropTypes.oneOf(Object.keys(g["default"]).map(function(e){return g["default"][e]})).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.previous,r=e.current;return a["default"].createElement("div",{className:"SideBySide"},a["default"].createElement("img",{className:"SideBySide__image",role:"presentation",src:t,title:"Before"})," ",a["default"].createElement("img",{className:"SideBySide__image",role:"presentation",src:r,title:"After"}))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i);o.propTypes={previous:i.PropTypes.string.isRequired,current:i.PropTypes.string.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),l=n(s),f=500,c=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={currentValue:0,visible:!1},r.tick=r.tick.bind(r),r.tick(0),setTimeout(function(){r.setState({visible:!0})},f),r}return a(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){clearTimeout(this.timeout),this.tick(e.value)}},{key:"tick",value:function(e){var t=this,r=this.state.currentValue,n=e-r;this.setState({currentValue:r+.8*n}),this.timeout=setTimeout(function(){t.tick(e)},1e3)}},{key:"render",value:function(){var e=this.state,t=e.currentValue,r=e.visible;return l["default"].createElement("div",{style:{opacity:r?1:0},className:"SmoothProgress"},l["default"].createElement("div",{style:{transform:"translateX(-"+(100-t)+"%)"},className:"SmoothProgress__bar"}))}}]),t}(l["default"].PureComponent);t["default"]=c,c.propTypes={value:s.PropTypes.number.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),l=n(s),f=r(20),c=n(f),p=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={cursorLeft:0,height:"auto",width:"auto"},r.handleMouseMove=r.handleMouseMove.bind(r),r}return a(t,e),u(t,[{key:"componentWillMount",value:function(){var e=this;this.updateSize(this.props).then(function(t){var r=t.width;e.setState({cursorLeft:r/2})})}},{key:"componentWillReceiveProps",value:function(e){this.updateSize(e)}},{key:"updateSize",value:function(e){var t=this,r=e.current,n=e.previous,o=(0,c["default"])(r,n).then(function(e){var r=e.width,n=e.height;return t.setState({width:r,height:n}),{width:r,height:n}});return Promise.resolve(o)}},{key:"handleMouseMove",value:function(e){this.setState({cursorLeft:e.pageX-e.target.offsetLeft})}},{key:"render",value:function(){var e=this.props,t=e.previous,r=e.current,n=this.state,o=n.cursorLeft,i=n.height,a=n.width;return l["default"].createElement("div",{className:"Swiper",style:{height:i,width:a},onMouseMove:this.handleMouseMove},l["default"].createElement("div",{className:"Swiper__image",style:{width:o}},l["default"].createElement("img",{src:t,role:"presentation"})),l["default"].createElement("div",{className:"Swiper__image",style:{transform:"translateX("+o+"px)",width:a-o}},l["default"].createElement("img",{src:r,style:{transform:"translateX(-"+o+"px)"},role:"presentation"})),l["default"].createElement("div",{className:"Swiper__cursor",style:{transform:"translateX("+o+"px)"}}))}}]),t}(l["default"].Component);t["default"]=p,p.propTypes={previous:s.PropTypes.string.isRequired,current:s.PropTypes.string.isRequired}},function(e,t){"use strict";function r(e){return new Promise(function(t){var r=new Image;r.onload=function(){var e=r.width,n=r.height,o=document.createElement("canvas");o.width=e,o.height=n;var i=o.getContext("2d");i.drawImage(r,0,0);var a=i.getImageData(0,0,e,n).data;t({width:e,height:n,data:a})},r.src=e})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(e){return btoa(e.description+e.viewport)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function n(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var o={};return new Promise(function(e,n){function i(e){n(e)}function a(n){var i=this.width,a=this.height;if(o[n]={width:i,height:a},Object.keys(o).length>=t.length){var u=Object.keys(o).map(function(e){return o[e]}),s=Math.max.apply(Math,r(u.map(function(e){return e.width}))),l=Math.max.apply(Math,r(u.map(function(e){return e.height})));e({width:s,height:l})}}t.forEach(function(e,t){var r=new Image;r.onerror=i,r.onload=a.bind(r,t),r.src=e})})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(){console.log(arguments)}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(t,"__esModule",{value:!0});var l=r(1),f=n(l),c={above:"above",inside:"inside",below:"below",invisible:"invisible"},p={debug:l.PropTypes.bool,onEnter:l.PropTypes.func,onLeave:l.PropTypes.func,onPositionChange:l.PropTypes.func,fireOnRapidScroll:l.PropTypes.bool,scrollableAncestor:l.PropTypes.any,throttleHandler:l.PropTypes.func,topOffset:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.number]),bottomOffset:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.number])},d={topOffset:"0px",bottomOffset:"0px",onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0,throttleHandler:function(e){return e}},h=function(e){function t(e){o(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e));return r.refElement=function(e){return r._ref=e},r}return a(t,e),s(t,[{key:"componentWillMount",value:function(){if(this.props.scrollableParent)throw new Error("The `scrollableParent` prop has changed name to `scrollableAncestor`.")}},{key:"componentDidMount",value:function(){t.getWindow()&&(this._handleScroll=this.props.throttleHandler(this._handleScroll.bind(this)),this.scrollableAncestor=this._findScrollableAncestor(),this.props.debug&&u("scrollableAncestor",this.scrollableAncestor),this.scrollableAncestor.addEventListener("scroll",this._handleScroll),window.addEventListener("resize",this._handleScroll),this._handleScroll(null))}},{key:"componentDidUpdate",value:function(){t.getWindow()&&this._handleScroll(null)}},{key:"componentWillUnmount",value:function(){t.getWindow()&&(this.scrollableAncestor&&this.scrollableAncestor.removeEventListener("scroll",this._handleScroll),window.removeEventListener("resize",this._handleScroll))}},{key:"_findScrollableAncestor",value:function(){if(this.props.scrollableAncestor)return this.props.scrollableAncestor;for(var e=this._ref;e.parentNode;)if(e=e.parentNode,e!==document&&e!==document.documentElement){var t=window.getComputedStyle(e),r=t.getPropertyValue("overflow-y")||t.getPropertyValue("overflow");if("auto"===r||"scroll"===r)return e}return window}},{key:"_handleScroll",value:function(e){if(this._ref){var t=this._getBounds(),r=this._currentPosition(t),n=this._previousPosition||null;if(this.props.debug&&(u("currentPosition",r),u("previousPosition",n)),this._previousPosition=r,n!==r){var o={currentPosition:r,previousPosition:n,event:e,waypointTop:t.waypointTop,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom};this.props.onPositionChange.call(this,o),r===c.inside?this.props.onEnter.call(this,o):n===c.inside&&this.props.onLeave.call(this,o);var i=n===c.below&&r===c.above,a=n===c.above&&r===c.below;this.props.fireOnRapidScroll&&(i||a)&&(this.props.onEnter.call(this,{currentPosition:c.inside,previousPosition:n,event:e,waypointTop:t.waypointTop,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}),this.props.onLeave.call(this,{currentPosition:r,previousPosition:c.inside,event:e,waypointTop:t.waypointTop,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}))}}}},{key:"_computeOffsetPixels",value:function(e,t){var r=this._parseOffsetAsPixels(e);if("number"==typeof r)return r;var n=this._parseOffsetAsPercentage(e);return"number"==typeof n?n*t:void 0}},{key:"_parseOffsetAsPixels",value:function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}},{key:"_parseOffsetAsPercentage",value:function(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}},{key:"_getBounds",value:function(){var e=this._ref.getBoundingClientRect().top,t=void 0,r=void 0;this.scrollableAncestor===window?(t=window.innerHeight,r=0):(t=this.scrollableAncestor.offsetHeight,r=this.scrollableAncestor.getBoundingClientRect().top),this.props.debug&&(u("waypoint top",e),u("scrollableAncestor height",t),u("scrollableAncestor scrollTop",r));var n=this.props,o=n.bottomOffset,i=n.topOffset,a=this._computeOffsetPixels(i,t),s=this._computeOffsetPixels(o,t),l=r+t;return{waypointTop:e,viewportTop:r+a,viewportBottom:l-s}}},{key:"_currentPosition",value:function(e){return e.viewportBottom-e.viewportTop===0?t.invisible:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom?t.inside:e.viewportBottom<e.waypointTop?t.below:e.waypointTop<e.viewportTop?t.above:t.invisible}},{key:"render",value:function(){return f["default"].createElement("span",{ref:this.refElement,style:{fontSize:0}})}}]),t}(f["default"].Component);t["default"]=h,h.propTypes=p,h.above=c.above,h.below=c.below,h.inside=c.inside,h.invisible=c.invisible,h.getWindow=function(){if("undefined"!=typeof window)return window},h.defaultProps=d,h.displayName="Waypoint",e.exports=t["default"]},function(e,t,r){e.exports=function(){return r(6)('!function(t){function r(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var e={};return r.m=t,r.c=e,r.p="",r(0)}([function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function a(t,r){for(var e=t.data,n=t.width,a=t.height,i=4*n,u=[],f=0;f<a;f++){for(var o=new Uint8ClampedArray(i+4*r),l=0;l<i;l++)o[l]=e[f*i+l];u.push(o)}return u}function i(t){var r=t.previousData,e=t.currentData,n=t.previousImageData,a=t.currentImageData;if(r.width!==e.width){var i=[0,r.height];return i.length=e.height+2,[i]}var u=n.map(JSON.stringify);self.postMessage({progress:40});var f=a.map(JSON.stringify);return self.postMessage({progress:60}),o["default"].diff(u,f)}function u(t){var r=t.previousData,e=t.currentData,n=Math.max(r.width,e.width),u=new Uint8ClampedArray(4*n),f=a(r,n-r.width),o=a(e,n-e.width);self.postMessage({progress:20});var l=i({previousData:r,currentData:e,previousImageData:f,currentImageData:o});self.postMessage({progress:85}),l.forEach(function(t){for(var r=t[0],e=t[1],n=t.length-2,a=0;a<Math.max(e,n);a++)a<e||f.splice(r+a,0,u)}),self.postMessage({progress:95});for(var s=l.length-1;s>=0;s--)for(var c=l[s],h=c[0],g=c[1],p=c.length-2,v=0;v<Math.max(g,p);v++)v<p||o.splice(h+v,0,u);return self.postMessage({progress:98}),{currentData:{data:o,height:o.length,width:n},previousData:{data:f,height:f.length,width:n}}}var f=e(1),o=n(f);self.addEventListener("message",function(t){var r=t.data,e=r.previousData,n=r.currentData,a=u({previousData:e,currentData:n});self.postMessage(a),self.close()})},function(t,r){function e(t){return t[0]}function n(t){return t[t.length-1]}function a(t){return t.slice(1)}function i(t){return t.pop()}function u(t){return t.length}function f(t,r){for(var e=0;e<t.length;e++)if(r(t[e]))return!0;return!1}function o(t){return t.reduce(function(t,r){return t+r.length+r[1]+1},0)}function l(t,r){return o(t)<=o(r)?t:r}function s(t,r){if(t&&!r)return!1;if(Array.isArray(t)&&t.length!=r.length)return!1;if(t&&"object"==typeof t){for(var e in t)if(!s(t[e],r[e]))return!1;for(var e in r)if(!s(t[e],r[e]))return!1;return!0}return t==r}function c(t){return 1==t.length?t[0]:[].slice.call(t)}function h(t,r){function e(e){var a=-1;n=0;for(var i=e;i<t.length;i++)r(t[e],t[i])||(a=i,n++);return n>1?-1:a}var n,a=e(0);return-1!=a?a:(e(1),0==n?0:-1)}var r=t.exports=function(t,r){function o(t){p.length;for(var r in p){var e=p[r]&&p[r](t);if(e)return e}return t.splice(1,1),{"?":t}}var g=t&&t.equal||s;r=r||{},r.lcs=function v(){function t(t,r){return t.length+":"+r.length}function r(i,u){if(!i.length||!u.length)return[];if(n[t(i,u)])return n[t(i,u)];if(g(i[0],u[0]))return[e(i)].concat(r(a(i),a(u)));var f=r(a(i),u),o=r(i,a(u));return n[t(i,u)]=f.length>o.length?f:o}var n={},i=c(arguments),u=i[0],f=i[1];if(i.length>2)return i.push(v(i.shift(),i.shift())),v(i);for(var o=0,l=0,s=0;s<u.length&&s<f.length&&g(u[s],f[s]);s++)o=s+1;if(u.length===o)return u.slice();for(var s=0;s<u.length-o&&s<f.length-o&&g(u[u.length-1-s],f[f.length-1-s]);s++)l=s;var h=u.slice(o,u.length-l),p=f.slice(o,f.length-l);return u.slice(0,o).concat(r(h,p)).concat(u.slice(u.length-l))},r.chunk=function(t,e){function a(t){return!(t.length&&!o.length||!t.length&&o.length)&&(g(n(t),n(o))||t.length+o.length===0)}for(var t=t.map(function(t){return t.slice()}),o=r.lcs.apply(null,t),l=[o].concat(t);f(t,u);){for(;t.every(a)&&t.every(u);)l.forEach(i);var s=!1,c=t.map(function(t){for(var r=[];!a(t);)r.unshift(i(t)),s=!0;return r});s&&e(t[0].length,c)}},r.optimisticDiff=function(t,r){for(var e=Math.max(t.length,r.length),n=Math.min(t.length,r.length),a=[],i=0;i<e;i++)if(t[i]!==r[i]){for(var u=[i,0],f=0;t[i]!==r[i]&&i<n;)u[1]=++f,u.push(r[i++]);i>=n&&(t.length>r.length?u[1]+=t.length-r.length:t.length<r.length&&(u=u.concat(r.slice(t.length)))),a.push(u)}return a},r.diff=function(t,e){var n=r.optimisticDiff(t,e),a=[];return r.chunk([t,e],function(t,r){var e=r.shift().length,n=r.shift();a.push([t,e].concat(n))}),l(n,a)},r.patch=function(t,r,e){return e!==!0&&(t=t.slice(t)),r.forEach(function(r){[].splice.apply(t,r)}),t},r.merge=function(){var t=c(arguments),e=r.diff3(t);return r.patch(t[0],e)},r.diff3=function(){var t=c(arguments),e=[];return r.chunk(t,function(t,r){var n=r[0],a=o(r);g(n,a)||e.push([t,n.length].concat(a))}),e},r.oddOneOut=function(t){t=t.slice(),t.unshift(t.splice(1,1)[0]);var r=h(t,g);return 0==r?t[1]:~r?t[r]:void 0},r.insertMergeOverDelete=function(t){t=t.slice(),t.splice(1,1);for(var r,e=0;e<t.length;e++)if(t[e].length){if(r)return;r=t[e]}return r};var p=t&&t.rules||[r.oddOneOut,r.insertMergeOverDelete];return r};r(null,r)}]);',r.p+"a8bfebcafc4935d15b00.worker.js")}},function(e,t,r){e.exports=function(){return r(6)('!function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return d*(e+1)+t*e+r}var a=r(3),f=n(a),o=[100,100,100,255],i=[0,200,0,255],l=[255,0,0,255],d=80,s=16;self.addEventListener("message",function(e){for(var t=e.data,r=t.previousImageData,n=t.currentImageData,a=r[0].length,c=r.length,p=(d+a)*c,v=new Uint8ClampedArray(p),M=0;M<c;M++){for(var _=!1,h=0;h<a;h+=4){var x=(0,f["default"])([r[M][h],r[M][h+1],r[M][h+2],r[M][h+3]],[n[M][h],n[M][h+1],n[M][h+2],n[M][h+3]]),g=x.diff,w=x.pixel;g>0&&(_=!0);var A=u(M,a,h);v[A+0]=w[0],v[A+1]=w[1],v[A+2]=w[2],v[A+3]=w[3]}var E=void 0;E=0===r[M][3]?i:0===n[M][3]?l:_?o:null;for(var m=0;m<d-s;m+=4)if(null!==E){var D=u(M,a,m)-d;v[D+0]=E[0],v[D+1]=E[1],v[D+2]=E[2],v[D+3]=E[3]}}self.postMessage({data:v,width:(d+a)/4,height:c}),self.close()})},function(e,t){"use strict";function r(e){return 255===e[3]}function n(e){return 0===e[3]}function u(e,t){var r=e*t+128;return(r>>8)+r>>8}function a(e,t){if(r(e)||n(t))return e;if(n(e))return t;var a=u(255-e[3],t[3]);return[u(e[3],e[0])+u(a,t[0]),u(e[3],e[1])+u(a,t[1]),u(e[3],e[2])+u(a,t[2]),e[3]+a]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=a},function(e,t){"use strict";function r(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)+Math.pow(e[3]-t[3],2))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;t.MAX_EUCLIDEAN_DISTANCE=Math.sqrt(4*Math.pow(255,2))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){var r=(0,i["default"])(e,t)/o.MAX_EUCLIDEAN_DISTANCE;return 0===r?{diff:r,pixel:(0,f["default"])([t[0],t[1],t[2],40],l)}:{diff:r,pixel:(0,f["default"])([179,54,130,255*Math.max(.2,r)],l)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=u;var a=r(1),f=n(a),o=r(2),i=n(o),l=[255,255,255,255]}]);',r.p+"c2297ce40f0d071ec173.worker.js");
|
2
|
-
}},function(e,t){e.exports=ReactDOM}]);
|
1
|
+
!function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var o=r(1),i=n(o),a=r(24),u=n(a),s=r(10),l=n(s);document.addEventListener("DOMContentLoaded",function(){u["default"].render(i["default"].createElement(l["default"],window.APP_PROPS),document.getElementById("react-root"))})},function(e,t){e.exports=React},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1);t["default"]={description:n.PropTypes.string.isRequired,viewport:n.PropTypes.string.isRequired,previous:n.PropTypes.string,current:n.PropTypes.string.isRequired,height:n.PropTypes.number.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.children,r=e.to;return a["default"].createElement("a",{className:"InlineLink",href:"#"+r},t)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i);o.propTypes={children:i.PropTypes.node.isRequired,to:i.PropTypes.string.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.image;return a["default"].createElement("h3",{id:(0,p["default"])(t)},a["default"].createElement(s["default"],{to:(0,p["default"])(t)},t.description," @ ",t.viewport))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),s=n(u),l=r(2),c=n(l),f=r(19),p=n(f);o.propTypes={image:i.PropTypes.shape(c["default"]).isRequired}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={DIFF:"Diff",SIDE_BY_SIDE:"Side-by-side",SWIPE:"Swipe"}},function(e,t){var r=window.URL||window.webkitURL;e.exports=function(e,t){try{try{var n;try{var o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;n=new o,n.append(e),n=n.getBlob()}catch(i){n=new Blob([e])}return new Worker(r.createObjectURL(n))}catch(i){return new Worker("data:application/javascript,"+encodeURIComponent(e))}}catch(i){return new Worker(t)}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),l=n(s),c=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={keepMounted:e.visible},r}return a(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){e.visible!==this.props.visible&&this.setState({keepMounted:!0})}},{key:"render",value:function(){var e=this.props.visible,t=this.state.keepMounted;return e||t?l["default"].createElement("div",{style:{display:e?"block":"none"}},this.props.children):null}}]),t}(l["default"].Component);t["default"]=c,c.propTypes={children:s.PropTypes.node.isRequired,visible:s.PropTypes.bool}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){var t=e.image,r=e.selectedView,n=e.onClick,o=t.height+t.height/10;return c["default"].createElement("div",null,c["default"].createElement(p["default"],{image:t}),c["default"].createElement("div",{className:"Diff__buttons"},Object.keys(y["default"]).map(function(e){return y["default"][e]}).map(function(e,t){var o=["Diff__button"];return 0===t?o.push("Diff__button--first"):t===Object.keys(y["default"]).length-1&&o.push("Diff__button--last"),c["default"].createElement("button",{key:e,className:o.join(" "),"aria-pressed":e===r,onClick:function(){n(e)}},e)})),c["default"].createElement("div",{className:"Diff__images",style:{minHeight:o}},c["default"].createElement(h["default"],{image:t,selectedView:r})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=t.DiffController=void 0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(1),c=n(l),f=r(4),p=n(f),d=r(14),h=n(d),v=r(5),y=n(v),m=r(2),g=n(m),b=t.DiffController=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={selectedView:y["default"].DIFF},r.handleClick=r.handleClick.bind(r),r}return a(t,e),s(t,[{key:"handleClick",value:function(e){this.setState({selectedView:e})}},{key:"render",value:function(){return c["default"].createElement(u,{image:this.props.image,selectedView:this.state.selectedView,onClick:this.handleClick})}}]),t}(c["default"].Component);b.propTypes={image:l.PropTypes.shape(g["default"]).isRequired},t["default"]=u,u.propTypes={image:l.PropTypes.shape(g["default"]).isRequired,onClick:l.PropTypes.func.isRequired,selectedView:l.PropTypes.oneOf(Object.keys(y["default"]).map(function(e){return y["default"][e]})).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.images;return t.length?a["default"].createElement("div",null,a["default"].createElement("h2",{id:"diffs"},a["default"].createElement(l["default"],{to:"diffs"},"Diffs (",t.length,")")),t.map(function(e){return a["default"].createElement(u.DiffController,{key:e.current,image:e})})):null}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(8),s=r(3),l=n(s),c=r(2),f=n(c);o.propTypes={images:i.PropTypes.arrayOf(i.PropTypes.shape(f["default"])).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.pageTitle,r=e.generatedAt,n=e.diffImages,o=e.newImages,i=e.triggeredByUrl;return a["default"].createElement("div",null,a["default"].createElement("header",{className:"HappoDiffs__header"},a["default"].createElement("h1",{className:"HappoDiffs__headerTitle"},t),a["default"].createElement("div",null,"Generated: ",r),i&&a["default"].createElement("div",null,"Triggered by:"," ",a["default"].createElement("a",{href:i},i))),a["default"].createElement("main",{className:"HappoDiffs__main"},a["default"].createElement(s["default"],{images:n}),a["default"].createElement(c["default"],{images:o})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(9),s=n(u),l=r(13),c=n(l),f=r(2),p=n(f);o.propTypes={pageTitle:i.PropTypes.string.isRequired,diffImages:i.PropTypes.arrayOf(p["default"]).isRequired,newImages:i.PropTypes.arrayOf(p["default"]).isRequired,generatedAt:i.PropTypes.string.isRequired,triggeredByUrl:i.PropTypes.string}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(s){o=!0,i=s}finally{try{!n&&u["return"]&&u["return"]()}finally{if(o)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(1),c=n(l),f=r(21),p=n(f),d=r(16),h=n(d),v=r(18),y=n(v),m=r(23),g=r(22),b=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={progress:0,width:0,height:0},r.initialize=r.initialize.bind(r),r}return a(t,e),s(t,[{key:"initialize",value:function(){var e=this,t=this.props,r=t.previous,n=t.current;Promise.all([(0,y["default"])(r),(0,y["default"])(n)]).then(function(t){var r=u(t,2),n=r[0],o=r[1];e.setState({progress:10,width:n.width,height:n.height}),e.computeDiffs({previousData:n,currentData:o})})}},{key:"computeDiffs",value:function(e){var t=this,r=e.previousData,n=e.currentData,o=new g;o.addEventListener("message",function(e){var r=e.data,n=r.previousData,o=r.currentData,i=r.progress;return n?(t.setState({width:n.width,height:n.height}),void t.constructDiffImage({previousData:n,currentData:o})):void t.setState({progress:i})}),o.postMessage({previousData:r,currentData:n})}},{key:"constructDiffImage",value:function(e){var t=this,r=e.previousData,n=e.currentData,o=new m;o.addEventListener("message",function(e){var r=e.data,n=r.data,o=r.width,i=r.height;t.setState({progress:99,width:o,height:i});var a=t.canvas.getContext("2d"),u=a.createImageData(o,i);u.data.set(n),a.putImageData(u,0,0),t.setState({progress:100})}),o.postMessage({previousImageData:r.data,currentImageData:n.data})}},{key:"render",value:function(){var e=this,t=this.state,r=t.width,n=t.height,o=t.progress;return c["default"].createElement("div",{style:{height:n,width:r}},o>0&&o<100&&c["default"].createElement(h["default"],{value:o}),0===o&&c["default"].createElement(p["default"],{onEnter:this.initialize,scrollableAncestor:window,bottomOffset:"-50%",topOffset:"-70%"}),c["default"].createElement("canvas",{ref:function(t){e.canvas=t},width:r,height:n}))}}]),t}(c["default"].Component);t["default"]=b,b.propTypes={previous:l.PropTypes.string.isRequired,current:l.PropTypes.string.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.image;return a["default"].createElement("div",null,a["default"].createElement(s["default"],{image:t}),a["default"].createElement("div",{className:"NewImage__image",style:{minHeight:t.height}},a["default"].createElement("img",{role:"presentation",src:t.current})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(4),s=n(u),l=r(2),c=n(l);o.propTypes={image:i.PropTypes.shape(c["default"]).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.images;return t.length?a["default"].createElement("div",null,a["default"].createElement("h2",{id:"new"},a["default"].createElement(s["default"],{to:"new"},"New examples (",t.length,")")),t.map(function(e){return a["default"].createElement(c["default"],{key:e.current,image:e})})):null}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(3),s=n(u),l=r(12),c=n(l),f=r(2),p=n(f);o.propTypes={images:i.PropTypes.arrayOf(i.PropTypes.shape(p["default"])).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.image,r=e.selectedView;return a["default"].createElement("div",null,a["default"].createElement(s["default"],{visible:r===y["default"].SIDE_BY_SIDE},a["default"].createElement(p["default"],{previous:t.previous,current:t.current})),a["default"].createElement(s["default"],{visible:r===y["default"].DIFF},a["default"].createElement(c["default"],{previous:t.previous,current:t.current})),a["default"].createElement(s["default"],{visible:r===y["default"].SWIPE},a["default"].createElement(h["default"],{previous:t.previous,current:t.current})))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i),u=r(7),s=n(u),l=r(11),c=n(l),f=r(15),p=n(f),d=r(17),h=n(d),v=r(5),y=n(v),m=r(2),g=n(m);o.propTypes={image:i.PropTypes.shape(g["default"]).isRequired,selectedView:i.PropTypes.oneOf(Object.keys(y["default"]).map(function(e){return y["default"][e]})).isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.previous,r=e.current;return a["default"].createElement("div",{className:"SideBySide"},a["default"].createElement("img",{className:"SideBySide__image",role:"presentation",src:t,title:"Before"})," ",a["default"].createElement("img",{className:"SideBySide__image",role:"presentation",src:r,title:"After"}))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(1),a=n(i);o.propTypes={previous:i.PropTypes.string.isRequired,current:i.PropTypes.string.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),l=n(s),c=500,f=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={currentValue:0,visible:!1},r.tick=r.tick.bind(r),r.tick(0),setTimeout(function(){r.setState({visible:!0})},c),r}return a(t,e),u(t,[{key:"componentWillReceiveProps",value:function(e){clearTimeout(this.timeout),this.tick(e.value)}},{key:"tick",value:function(e){var t=this,r=this.state.currentValue,n=e-r;this.setState({currentValue:r+.8*n}),this.timeout=setTimeout(function(){t.tick(e)},1e3)}},{key:"render",value:function(){var e=this.state,t=e.currentValue,r=e.visible;return l["default"].createElement("div",{style:{opacity:r?1:0},className:"SmoothProgress"},l["default"].createElement("div",{style:{transform:"translateX(-"+(100-t)+"%)"},className:"SmoothProgress__bar"}))}}]),t}(l["default"].PureComponent);t["default"]=f,f.propTypes={value:s.PropTypes.number.isRequired}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),l=n(s),c=r(20),f=n(c),p=function(e){function t(e){o(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={cursorLeft:0,height:"auto",width:"auto"},r.handleMouseMove=r.handleMouseMove.bind(r),r}return a(t,e),u(t,[{key:"componentWillMount",value:function(){var e=this;this.updateSize(this.props).then(function(t){var r=t.width;e.setState({cursorLeft:r/2})})}},{key:"componentWillReceiveProps",value:function(e){this.updateSize(e)}},{key:"updateSize",value:function(e){var t=this,r=e.current,n=e.previous,o=(0,f["default"])(r,n).then(function(e){var r=e.width,n=e.height;return t.setState({width:r,height:n}),{width:r,height:n}});return Promise.resolve(o)}},{key:"handleMouseMove",value:function(e){this.setState({cursorLeft:e.pageX-e.target.offsetLeft})}},{key:"render",value:function(){var e=this.props,t=e.previous,r=e.current,n=this.state,o=n.cursorLeft,i=n.height,a=n.width;return l["default"].createElement("div",{className:"Swiper",style:{height:i,width:a},onMouseMove:this.handleMouseMove},l["default"].createElement("div",{className:"Swiper__image",style:{width:o}},l["default"].createElement("img",{src:t,role:"presentation"})),l["default"].createElement("div",{className:"Swiper__image",style:{transform:"translateX("+o+"px)",width:a-o}},l["default"].createElement("img",{src:r,style:{transform:"translateX(-"+o+"px)"},role:"presentation"})),l["default"].createElement("div",{className:"Swiper__cursor",style:{transform:"translateX("+o+"px)"}}))}}]),t}(l["default"].Component);t["default"]=p,p.propTypes={previous:s.PropTypes.string.isRequired,current:s.PropTypes.string.isRequired}},function(e,t){"use strict";function r(e){return new Promise(function(t){var r=new Image;r.onload=function(){var e=r.width,n=r.height,o=document.createElement("canvas");o.width=e,o.height=n;var i=o.getContext("2d");i.drawImage(r,0,0);var a=i.getImageData(0,0,e,n).data;t({width:e,height:n,data:a})},r.src=e})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(e){return btoa(e.description+e.viewport)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function n(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var o={};return new Promise(function(e,n){function i(e){n(e)}function a(n){var i=this.width,a=this.height;if(o[n]={width:i,height:a},Object.keys(o).length>=t.length){var u=Object.keys(o).map(function(e){return o[e]}),s=Math.max.apply(Math,r(u.map(function(e){return e.width}))),l=Math.max.apply(Math,r(u.map(function(e){return e.height})));e({width:s,height:l})}}t.forEach(function(e,t){var r=new Image;r.onerror=i,r.onload=a.bind(r,t),r.src=e})})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(){console.log(arguments)}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();Object.defineProperty(t,"__esModule",{value:!0});var l=r(1),c=n(l),f={above:"above",inside:"inside",below:"below",invisible:"invisible"},p={debug:l.PropTypes.bool,onEnter:l.PropTypes.func,onLeave:l.PropTypes.func,onPositionChange:l.PropTypes.func,fireOnRapidScroll:l.PropTypes.bool,scrollableAncestor:l.PropTypes.any,throttleHandler:l.PropTypes.func,topOffset:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.number]),bottomOffset:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.number])},d={topOffset:"0px",bottomOffset:"0px",onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0,throttleHandler:function(e){return e}},h=function(e){function t(e){o(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e));return r.refElement=function(e){return r._ref=e},r}return a(t,e),s(t,[{key:"componentWillMount",value:function(){if(this.props.scrollableParent)throw new Error("The `scrollableParent` prop has changed name to `scrollableAncestor`.")}},{key:"componentDidMount",value:function(){t.getWindow()&&(this._handleScroll=this.props.throttleHandler(this._handleScroll.bind(this)),this.scrollableAncestor=this._findScrollableAncestor(),this.props.debug&&u("scrollableAncestor",this.scrollableAncestor),this.scrollableAncestor.addEventListener("scroll",this._handleScroll),window.addEventListener("resize",this._handleScroll),this._handleScroll(null))}},{key:"componentDidUpdate",value:function(){t.getWindow()&&this._handleScroll(null)}},{key:"componentWillUnmount",value:function(){t.getWindow()&&(this.scrollableAncestor&&this.scrollableAncestor.removeEventListener("scroll",this._handleScroll),window.removeEventListener("resize",this._handleScroll))}},{key:"_findScrollableAncestor",value:function(){if(this.props.scrollableAncestor)return this.props.scrollableAncestor;for(var e=this._ref;e.parentNode;)if(e=e.parentNode,e!==document&&e!==document.documentElement){var t=window.getComputedStyle(e),r=t.getPropertyValue("overflow-y")||t.getPropertyValue("overflow");if("auto"===r||"scroll"===r)return e}return window}},{key:"_handleScroll",value:function(e){if(this._ref){var t=this._getBounds(),r=this._currentPosition(t),n=this._previousPosition||null;if(this.props.debug&&(u("currentPosition",r),u("previousPosition",n)),this._previousPosition=r,n!==r){var o={currentPosition:r,previousPosition:n,event:e,waypointTop:t.waypointTop,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom};this.props.onPositionChange.call(this,o),r===f.inside?this.props.onEnter.call(this,o):n===f.inside&&this.props.onLeave.call(this,o);var i=n===f.below&&r===f.above,a=n===f.above&&r===f.below;this.props.fireOnRapidScroll&&(i||a)&&(this.props.onEnter.call(this,{currentPosition:f.inside,previousPosition:n,event:e,waypointTop:t.waypointTop,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}),this.props.onLeave.call(this,{currentPosition:r,previousPosition:f.inside,event:e,waypointTop:t.waypointTop,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}))}}}},{key:"_computeOffsetPixels",value:function(e,t){var r=this._parseOffsetAsPixels(e);if("number"==typeof r)return r;var n=this._parseOffsetAsPercentage(e);return"number"==typeof n?n*t:void 0}},{key:"_parseOffsetAsPixels",value:function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}},{key:"_parseOffsetAsPercentage",value:function(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}},{key:"_getBounds",value:function(){var e=this._ref.getBoundingClientRect().top,t=void 0,r=void 0;this.scrollableAncestor===window?(t=window.innerHeight,r=0):(t=this.scrollableAncestor.offsetHeight,r=this.scrollableAncestor.getBoundingClientRect().top),this.props.debug&&(u("waypoint top",e),u("scrollableAncestor height",t),u("scrollableAncestor scrollTop",r));var n=this.props,o=n.bottomOffset,i=n.topOffset,a=this._computeOffsetPixels(i,t),s=this._computeOffsetPixels(o,t),l=r+t;return{waypointTop:e,viewportTop:r+a,viewportBottom:l-s}}},{key:"_currentPosition",value:function(e){return e.viewportBottom-e.viewportTop===0?t.invisible:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom?t.inside:e.viewportBottom<e.waypointTop?t.below:e.waypointTop<e.viewportTop?t.above:t.invisible}},{key:"render",value:function(){return c["default"].createElement("span",{ref:this.refElement,style:{fontSize:0}})}}]),t}(c["default"].Component);t["default"]=h,h.propTypes=p,h.above=f.above,h.below=f.below,h.inside=f.inside,h.invisible=f.invisible,h.getWindow=function(){if("undefined"!=typeof window)return window},h.defaultProps=d,h.displayName="Waypoint",e.exports=t["default"]},function(e,t,r){e.exports=function(){return r(6)('!function(t){function r(e){if(a[e])return a[e].exports;var n=a[e]={exports:{},id:e,loaded:!1};return t[e].call(n.exports,n,n.exports,r),n.loaded=!0,n.exports}var a={};return r.m=t,r.c=a,r.p="",r(0)}([function(t,r,a){"use strict";function e(t){return t&&t.__esModule?t:{"default":t}}function n(t,r){for(var a=t.data,e=t.width,n=t.height,o=4*e,i=[],s=0;s<n;s++){for(var l=new Uint8ClampedArray(o+4*r),u=0;u<o;u++)l[u]=a[s*o+u];i.push(l)}return i}function o(t){var r=t.previousImageData,a=t.currentImageData,e=t.maxWidth,n=r.map(JSON.stringify);self.postMessage({progress:40});var o=a.map(JSON.stringify);self.postMessage({progress:60}),(0,l["default"])(n,o);var i=new Uint8ClampedArray(4*e);n.forEach(function(t,a){"+"===t&&r.splice(a,0,i)}),o.forEach(function(t,r){"+"===t&&a.splice(r,0,i)})}function i(t){var r=t.previousData,a=t.currentData,e=Math.max(r.width,a.width),i=n(r,e-r.width),s=n(a,e-a.width);return self.postMessage({progress:20}),o({previousImageData:i,currentImageData:s,maxWidth:e}),self.postMessage({progress:85}),{currentData:{data:s,height:s.length,width:e},previousData:{data:i,height:i.length,width:e}}}var s=a(1),l=e(s);self.addEventListener("message",function(t){var r=t.data,a=r.previousData,e=r.currentData,n=i({previousData:a,currentData:e});self.postMessage(n),self.close()})},function(t,r){"use strict";function a(t){if(Array.isArray(t)){for(var r=0,a=Array(t.length);r<t.length;r++)a[r]=t[r];return a}return Array.from(t)}function e(t,r){for(var a=new Array(t),e=0;e<a.length;e++)a[e]=new Int32Array(r);return a}function n(t,r){for(var a=t.length,n=r.length,o=e(a+1,n+1),i=e(a+1,n+1),s=1;s<=a;s++)for(var u=1;u<=n;u++)t[s-1]===r[u-1]?(o[s][u]=o[s-1][u-1]+1,i[s][u]=l.diagonal):(o[s][u]=Math.max(o[s-1][u],o[s][u-1]),o[s][u]===o[s-1][u]?i[s][u]=l.vertical:i[s][u]=l.horizontal);return i}function o(t){return new Array(t).fill(u)}function i(t,r,e){for(var n=t[r.length][e.length],i=r.length,s=e.length,u=0;n!==l.none;)n===l.diagonal?(u<0?e.splice.apply(e,[s,0].concat(a(o(Math.abs(u))))):u>0&&r.splice.apply(r,[i,0].concat(a(o(u)))),i--,s--,u=0):n===l.horizontal?(s--,u++):n===l.vertical&&(i--,u--),n=t[i][s];var c=r.length,f=e.length,h=c>f?e:r;h.splice.apply(h,[0,0].concat(a(o(Math.abs(c-f)))))}function s(t,r){var a=n(t,r);i(a,t,r)}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=s;var l={none:0,diagonal:1,vertical:2,horizontal:3},u="+"}]);',r.p+"40c1aadf458bda245630.worker.js")}},function(e,t,r){e.exports=function(){return r(6)('!function(e){function t(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return e[n].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t,r){return d*(e+1)+t*e+r}var a=r(3),f=n(a),o=[100,100,100,255],i=[0,200,0,255],l=[255,0,0,255],d=80,s=16;self.addEventListener("message",function(e){for(var t=e.data,r=t.previousImageData,n=t.currentImageData,a=r[0].length,c=r.length,p=(d+a)*c,v=new Uint8ClampedArray(p),M=0;M<c;M++){for(var _=!1,h=0;h<a;h+=4){var x=(0,f["default"])([r[M][h],r[M][h+1],r[M][h+2],r[M][h+3]],[n[M][h],n[M][h+1],n[M][h+2],n[M][h+3]]),g=x.diff,w=x.pixel;g>0&&(_=!0);var A=u(M,a,h);v[A+0]=w[0],v[A+1]=w[1],v[A+2]=w[2],v[A+3]=w[3]}var E=void 0;E=0===r[M][3]?i:0===n[M][3]?l:_?o:null;for(var m=0;m<d-s;m+=4)if(null!==E){var D=u(M,a,m)-d;v[D+0]=E[0],v[D+1]=E[1],v[D+2]=E[2],v[D+3]=E[3]}}self.postMessage({data:v,width:(d+a)/4,height:c}),self.close()})},function(e,t){"use strict";function r(e){return 255===e[3]}function n(e){return 0===e[3]}function u(e,t){var r=e*t+128;return(r>>8)+r>>8}function a(e,t){if(r(e)||n(t))return e;if(n(e))return t;var a=u(255-e[3],t[3]);return[u(e[3],e[0])+u(a,t[0]),u(e[3],e[1])+u(a,t[1]),u(e[3],e[2])+u(a,t[2]),e[3]+a]}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=a},function(e,t){"use strict";function r(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2)+Math.pow(e[3]-t[3],2))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;t.MAX_EUCLIDEAN_DISTANCE=Math.sqrt(4*Math.pow(255,2))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function u(e,t){var r=(0,i["default"])(e,t)/o.MAX_EUCLIDEAN_DISTANCE;return 0===r?{diff:r,pixel:(0,f["default"])([t[0],t[1],t[2],40],l)}:{diff:r,pixel:(0,f["default"])([179,54,130,255*Math.max(.2,r)],l)}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=u;var a=r(1),f=n(a),o=r(2),i=n(o),l=[255,255,255,255]}]);',r.p+"c2297ce40f0d071ec173.worker.js")}},function(e,t){e.exports=ReactDOM}]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dG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KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No solution found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n ai--;\n bi--;\n changes = 0;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n applyPadding(a, b);\n var lcsSolution = longestCommonSubsequence(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi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]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImZvckVhY2giLCJoYXNoZWRMaW5lIiwiaSIsInNwbGljZSIsImNvbXB1dGVBbmRJbmplY3REaWZmcyIsInByZXZpb3VzRGF0YSIsImN1cnJlbnREYXRhIiwiTWF0aCIsIm1heCIsImxlbmd0aCIsImFkZEV2ZW50TGlzdGVuZXIiLCJyZXN1bHQiLCJjbG9zZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUEsU0FBU0EsY0FBVCxPQUFpREMsWUFBakQsRUFBK0Q7QUFBQSxNQUFyQ0MsSUFBcUMsUUFBckNBLElBQXFDO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Zmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No solution found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n ai--;\n bi--;\n changes = 0;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = b.length;\n var shorterArray = aLength > bLength ? b : a;\n shorterArray.push.apply(shorterArray, _toConsumableArray(placeholders(Math.abs(aLength - bLength))));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n applyPadding(a, b);\n if (lcsSolution) {\n applySolution(lcsSolution, a, b);\n }\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2Ui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/IGIgOiBhO1xuICBzaG9ydGVyQXJyYXkucHVzaCguLi5wbGFjZWhvbGRlcnMoTWF0aC5hYnMoYUxlbmd0aCAtIGJMZW5ndGgpKSk7XG59XG4vKipcbiAqIENvbXB1dGVzIHRoZSBsb25nZXN0IGNvbW1vbiBzdWJzZXF1ZW5jZSBvZiB0d28gYXJyYXlzLCB0aGVuIHVzZXMgdGhhdFxuICogc29sdXRpb24gdG8gaW5qZWN0IGdhcHMgaW50byB0aGUgYXJyYXlzLCBtYWtpbmcgdGhlbSBhbGlnbiBvbiBjb21tb25cbiAqIHN1YnNlcXVlbmNlcy5cbiAqXG4gKiBAcGFyYW0ge0FycmF5fSBhXG4gKiBAcGFyYW0ge0FycmF5fSBiXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGFsaWduQXJyYXlzKGEsIGIpIHtcbiAgY29uc3QgbGNzU29sdXRpb24gPSBsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UoYSwgYik7XG4gIGFwcGx5UGFkZGluZyhhLCBiKTtcbiAgaWYgKGxjc1NvbHV0aW9uKSB7XG4gICAgYXBwbHlTb2x1dGlvbihsY3NTb2x1dGlvbiwgYSwgYik7XG4gIH1cbn1cblxuXG5cbi8qKiBXRUJQQUNLIEZPT1RFUiAqKlxuICoqIC4vanMvc3JjL2FsaWduQXJyYXlzLmpzXG4gKiovIl0sInNvdXJjZVJvb3QiOiIifQ==");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6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YSxcbiAgICBtYXhXaWR0aCxcbiAgfSk7XG5cbiAgc2VsZi5wb3N0TWVzc2FnZSh7IHByb2dyZXNzOiA4NSB9KTtcblxuICByZXR1cm4ge1xuICAgIGN1cnJlbnREYXRhOiB7XG4gICAgICBkYXRhOiBjdXJyZW50SW1hZ2VEYXRhLFxuICAgICAgaGVpZ2h0OiBjdXJyZW50SW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICAgIHByZXZpb3VzRGF0YToge1xuICAgICAgZGF0YTogcHJldmlvdXNJbWFnZURhdGEsXG4gICAgICBoZWlnaHQ6IHByZXZpb3VzSW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICB9O1xufVxuXG5zZWxmLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n if (memo[aLength][bLength] === 0) {\n // No soltuion found\n return null;\n }\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n\n var changes = 0;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n if (changes < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(changes)))));\n } else if (changes > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(changes))));\n }\n ai--;\n bi--;\n changes = 0;\n } else if (movement === MOVEMENT.horizontal) {\n bi--;\n changes++;\n } else if (movement === MOVEMENT.vertical) {\n ai--;\n changes--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * To be called for arrays that share nothing in common.\n *\n * Note that this will MUTATE the arrays,\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction applyPadding(a, b) {\n var aLength = a.length;\n var bLength = bLength;\n\n var shorterArray = aLength > bLength ? b : a;\n\n shorterArray.push(placeholders(Math.abs(aLength - bLength)));\n}\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n if (!lcsSolution) {\n applyPadding(a, b);\n }\n applySolution(lcsSolution, a, b);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5ndGgiLCJiTGVuZ3RoIiwibWVtbyIsInNvbHV0aW9uIiwiaiIsIk1hdGgiLCJtYXgiLCJwbGFjZWhvbGRlcnMiLCJjb3VudCIsInJlc3VsdCIsImFwcGx5U29sdXRpb24iLCJtb3ZlbWVudCIsImFpIiwiYmkiLCJjaGFuZ2VzIiwic3BsaWNlIiwiYWJzIiwiYXBwbHlQYWRkaW5nIiwic2hvcnRlckFycmF5IiwicHVzaCIsImxjc1NvbHV0a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qIHNvbHV0aW9uIHRvIGluamVjdCBnYXBzIGludG8gdGhlIGFycmF5cywgbWFraW5nIHRoZW0gYWxpZ24gb24gY29tbW9uXG4gKiBzdWJzZXF1ZW5jZXMuXG4gKlxuICogQHBhcmFtIHtBcnJheX0gYVxuICogQHBhcmFtIHtBcnJheX0gYlxuICovXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBhbGlnbkFycmF5cyhhLCBiKSB7XG4gIGNvbnN0IGxjc1NvbHV0aW9uID0gbG9uZ2VzdENvbW1vblN1YnNlcXVlbmNlKGEsIGIpO1xuICBpZiAoIWxjc1NvbHV0aW9uKSB7XG4gICAgYXBwbHlQYWRkaW5nKGEsIGIpO1xuICB9XG4gIGFwcGx5U29sdXRpb24obGNzU29sdXRpb24sIGEsIGIpO1xufVxuXG5cblxuLyoqIFdFQlBBQ0sgRk9PVEVSICoqXG4gKiogLi9qcy9zcmMvYWxpZ25BcnJheXMuanNcbiAqKi8iXSwic291cmNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1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biAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICAgIHByZXZpb3VzRGF0YToge1xuICAgICAgZGF0YTogcHJldmlvdXNJbWFnZURhdGEsXG4gICAgICBoZWlnaHQ6IHByZXZpb3VzSW1hZ2VEYXRhLmxlbmd0aCxcbiAgICAgIHdpZHRoOiBtYXhXaWR0aCxcbiAgICB9LFxuICB9O1xufVxuXG5zZWxmLmFkZEV2ZW50TGlzdGVuZXIoJ21lc3NhZ2UnLCAoeyBkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n console.log(memo);\n return solution;\n}\n\nfunction placeholders(count) {\n var result = new Array(count);\n for (var i = 0; i < count; i++) {\n result[i] = '+';\n }\n return result;\n}\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n var diffI = ai - bi;\n console.log(ai, bi, diffI);\n if (diffI < 0) {\n b.splice.apply(b, [bi, 0].concat(_toConsumableArray(placeholders(Math.abs(diffI)))));\n } else if (diffI > 0) {\n a.splice.apply(a, [ai, 0].concat(_toConsumableArray(placeholders(Math.abs(diffI)))));\n }\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n ai--;\n } else if (movement === MOVEMENT.vertical) {\n bi--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n applySolution(lcsSolution, a, b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mNlUm9vdCI6IiJ9");
|
54
|
+
|
55
|
+
/***/ }
|
56
|
+
/******/ ]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ exports: {},
|
15
|
+
/******/ id: moduleId,
|
16
|
+
/******/ loaded: false
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.loaded = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // __webpack_public_path__
|
37
|
+
/******/ __webpack_require__.p = "";
|
38
|
+
|
39
|
+
/******/ // Load entry module and return exports
|
40
|
+
/******/ return __webpack_require__(0);
|
41
|
+
/******/ })
|
42
|
+
/************************************************************************/
|
43
|
+
/******/ ([
|
44
|
+
/* 0 */
|
45
|
+
/***/ function(module, exports, __webpack_require__) {
|
46
|
+
|
47
|
+
eval("'use strict';\n\nvar _alignArrays = __webpack_require__(1);\n\nvar _alignArrays2 = _interopRequireDefault(_alignArrays);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction imageTo2DArray(_ref, paddingRight) {\n var data = _ref.data;\n var width = _ref.width;\n var height = _ref.height;\n\n // The imageData is a 1D array. Each element in the array corresponds to a\n // decimal value that represents one of the RGBA channels for that pixel.\n var rowSize = width * 4;\n\n var newData = [];\n for (var row = 0; row < height; row++) {\n var pixelsInRow = new Uint8ClampedArray(rowSize + paddingRight * 4);\n for (var location = 0; location < rowSize; location++) {\n pixelsInRow[location] = data[row * rowSize + location];\n }\n newData.push(pixelsInRow);\n }\n return newData;\n}\n\nfunction align(_ref2) {\n var previousImageData = _ref2.previousImageData;\n var currentImageData = _ref2.currentImageData;\n var maxWidth = _ref2.maxWidth;\n\n var hashedPreviousData = previousImageData.map(JSON.stringify);\n self.postMessage({ progress: 40 });\n var hashedCurrentData = currentImageData.map(JSON.stringify);\n self.postMessage({ progress: 60 });\n\n (0, _alignArrays2.default)(hashedPreviousData, hashedCurrentData);\n\n var transparentLine = new Uint8ClampedArray(maxWidth * 4);\n\n // Iterate backwards and cancel out common transparent lines.\n for (var i = hashedPreviousData.length - 1; i > 0; i--) {\n var hashedPreviousLine = hashedPreviousData[i];\n var hashedCurrentLine = hashedCurrentData[i];\n\n if (hashedPreviousLine === '+' && hashedCurrentLine === '+') {\n console.log('removing');\n hashedPreviousData.splice(i, 1);\n hashedCurrentData.splice(i, 1);\n }\n }\n\n hashedPreviousData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n previousImageData.splice(i, 0, transparentLine);\n }\n });\n\n hashedCurrentData.forEach(function (hashedLine, i) {\n if (hashedLine === '+') {\n currentImageData.splice(i, 0, transparentLine);\n }\n });\n}\n\n/**\n * Takes two 2d images, computes the diff between the two, and injects pixels to\n * both in order to:\n * a) make both images the same height\n * b) properly visualize differences\n *\n * Please note that this method MUTATES data.\n *\n * @param {Array} previousData\n * @param {Array} currentData\n */\nfunction computeAndInjectDiffs(_ref3) {\n var previousData = _ref3.previousData;\n var currentData = _ref3.currentData;\n\n var maxWidth = Math.max(previousData.width, currentData.width);\n\n var previousImageData = imageTo2DArray(previousData, maxWidth - previousData.width);\n\n var currentImageData = imageTo2DArray(currentData, maxWidth - currentData.width);\n\n self.postMessage({ progress: 20 });\n\n align({\n previousImageData: previousImageData,\n currentImageData: currentImageData,\n maxWidth: maxWidth\n });\n\n self.postMessage({ progress: 85 });\n\n return {\n currentData: {\n data: currentImageData,\n height: currentImageData.length,\n width: maxWidth\n },\n previousData: {\n data: previousImageData,\n height: previousImageData.length,\n width: maxWidth\n }\n };\n}\n\nself.addEventListener('message', function (_ref4) {\n var _ref4$data = _ref4.data;\n var previousData = _ref4$data.previousData;\n var currentData = _ref4$data.currentData;\n\n var result = computeAndInjectDiffs({ previousData: previousData, currentData: currentData });\n self.postMessage(result);\n self.close();\n});//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvd29ya2Vycy9Db21wdXRlQW5kSW5qZWN0RGlmZnNXb3JrZXIuanM/ZGRiNSJdLCJuYW1lcyI6WyJpbWFnZVRvMkRBcnJheSIsInBhZGRpbmdSaWdodCIsImRhdGEiLCJ3aWR0aCIsImhlaWdodCIsInJvd1NpemUiLCJuZXdEYXRhIiwicm93IiwicGl4ZWxzSW5Sb3ciLCJVaW50OENsYW1wZWRBcnJheSIsImxvY2F0aW9uIiwicHVzaCIsImFsaWduIiwicHJldmlvdXNJbWFnZURhdGEiLCJjdXJyZW50SW1hZ2VEYXRhIiwibWF4V2lkdGgiLCJoYXNoZWRQcmV2aW91c0RhdGEiLCJtYXAiLCJKU09OIiwic3RyaW5naWZ5Iiwic2VsZiIsInBvc3RNZXNzYWdlIiwicHJvZ3Jlc3MiLCJoYXNoZWRDdXJyZW50RGF0YSIsInRyYW5zcGFyZW50TGluZSIsImkiLCJsZW5ndGgiLCJoYXNoZWRQcmV2aW91c0xpbmUiLCJoYXNoZWRDdXJyZW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BkYXRhOiB7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSB9KSA9PiB7XG4gIGNvbnN0IHJlc3VsdCA9IGNvbXB1dGVBbmRJbmplY3REaWZmcyh7IHByZXZpb3VzRGF0YSwgY3VycmVudERhdGEgfSk7XG4gIHNlbGYucG9zdE1lc3NhZ2UocmVzdWx0KTtcbiAgc2VsZi5jbG9zZSgpO1xufSk7XG5cblxuXG4vKiogV0VCUEFDSyBGT09URVIgKipcbiAqKiAuL2pzL3NyYy93b3JrZXJzL0NvbXB1dGVBbmRJbmplY3REaWZmc1dvcmtlci5qc1xuICoqLyJdLCJzb3VyY2VSb290IjoiIn0=");
|
48
|
+
|
49
|
+
/***/ },
|
50
|
+
/* 1 */
|
51
|
+
/***/ function(module, exports) {
|
52
|
+
|
53
|
+
eval("'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = alignArrays;\nvar MOVEMENT = {\n none: 0,\n diagonal: 1,\n vertical: 2,\n horizontal: 3\n};\n\nfunction initMatrix(height, width) {\n var rows = new Array(height);\n for (var i = 0; i < rows.length; i++) {\n rows[i] = new Int32Array(width);\n }\n return rows;\n}\n\nfunction longestCommonSubsequence(a, b) {\n // adapted from\n // http://algorithms.tutorialhorizon.com/dynamic-programming-longest-common-subsequence/\n var aLength = a.length;\n var bLength = b.length;\n var memo = initMatrix(aLength + 1, bLength + 1);\n var solution = initMatrix(aLength + 1, bLength + 1);\n\n // Loop and find the solution\n for (var i = 1; i <= aLength; i++) {\n for (var j = 1; j <= bLength; j++) {\n if (a[i - 1] === b[j - 1]) {\n // diagonal\n memo[i][j] = memo[i - 1][j - 1] + 1;\n solution[i][j] = MOVEMENT.diagonal;\n } else {\n memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);\n if (memo[i][j] === memo[i - 1][j]) {\n solution[i][j] = MOVEMENT.vertical;\n } else {\n solution[i][j] = MOVEMENT.horizontal;\n }\n }\n }\n }\n return solution;\n}\n\n/**\n * Apply an lcs solution to arrays. Note that this will MUTATE the arrays,\n * injecting \"+\" where gaps are needed.\n *\n * @param {Array<Array>} solution as computed by `longestCommonSubsequence`\n * @param {Array} a\n * @param {Array} b\n */\nfunction applySolution(solution, a, b) {\n var movement = solution[a.length][b.length];\n var ai = a.length;\n var bi = b.length;\n\n while (movement !== MOVEMENT.none) {\n if (movement === MOVEMENT.diagonal) {\n ai--;\n bi--;\n } else if (movement === MOVEMENT.horizontal) {\n a.splice([ai], 0, '+');\n bi--;\n } else if (movement === MOVEMENT.vertical) {\n b.splice([bi], 0, '+');\n ai--;\n }\n movement = solution[ai][bi];\n }\n}\n\n/**\n * Computes the longest common subsequence of two arrays, then uses that\n * solution to inject gaps into the arrays, making them align on common\n * subsequences.\n *\n * @param {Array} a\n * @param {Array} b\n */\nfunction alignArrays(a, b) {\n var lcsSolution = longestCommonSubsequence(a, b);\n applySolution(lcsSolution, a, b);\n}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9qcy9zcmMvYWxpZ25BcnJheXMuanM/MDFiNyJdLCJuYW1lcyI6WyJhbGlnbkFycmF5cyIsIk1PVkVNRU5UIiwibm9uZSIsImRpYWdvbmFsIiwidmVydGljYWwiLCJob3Jpem9udGFsIiwiaW5pdE1hdHJpeCIsImhlaWdodCIsIndpZHRoIiwicm93cyIsIkFycmF5IiwiaSIsImxlbmd0aCIsIkludDMyQXJyYXkiLCJsb25nZXN0Q29tbW9uU3Vic2VxdWVuY2UiLCJhIiwiYiIsImFMZW5ndGgiLCJiTGVuZ3RoIiwibWVtbyIsInNvbHV0aW9uIiwiaiIsIk1hdGgiLCJtYXgiLCJhcHBseVNvbHV0aW9uIiwibW92ZW1lbnQiLCJhaSIsImJpIiwic3BsaWNlIiwibGNzU29sdXRpb24iXSwibWFwcGluZ3MiOiI7Ozs7O2tCQStFd0JBLFc7QUEvRXhCLElBQU1DLFdBQVc7QUFD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