@highlight-run/rrweb 1.1.17 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-bitmap-data-url-worker.worker.js +257 -0
- package/dist/image-bitmap-data-url-worker.worker.js.map +1 -0
- package/dist/image-bitmap-data-url.worker.worker.js +2 -0
- package/dist/image-bitmap-data-url.worker.worker.js.map +1 -0
- package/dist/image-bitmap-data-url.worker.worker.worker.js +2 -0
- package/dist/image-bitmap-data-url.worker.worker.worker.js.map +1 -0
- package/dist/index.js +2 -5
- package/dist/index.js.LICENSE.txt +14 -0
- package/dist/index.js.map +1 -1
- package/dist/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
- package/dist/record/workers/image-bitmap-data-url.worker.d.ts +5 -0
- package/dist/replay/canvas/deserialize-args.d.ts +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ var __webpack_modules__ = ({
|
|
4
|
+
|
|
5
|
+
/***/ "./node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js":
|
|
6
|
+
/*!************************************************************************!*\
|
|
7
|
+
!*** ./node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js ***!
|
|
8
|
+
\************************************************************************/
|
|
9
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10
|
+
|
|
11
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13
|
+
/* harmony export */ "decode": () => (/* binding */ decode),
|
|
14
|
+
/* harmony export */ "encode": () => (/* binding */ encode)
|
|
15
|
+
/* harmony export */ });
|
|
16
|
+
/*
|
|
17
|
+
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
|
|
18
|
+
* Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
|
|
19
|
+
* Released under MIT License
|
|
20
|
+
*/
|
|
21
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
22
|
+
// Use a lookup table to find the index.
|
|
23
|
+
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
|
24
|
+
for (var i = 0; i < chars.length; i++) {
|
|
25
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
26
|
+
}
|
|
27
|
+
var encode = function (arraybuffer) {
|
|
28
|
+
var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
|
|
29
|
+
for (i = 0; i < len; i += 3) {
|
|
30
|
+
base64 += chars[bytes[i] >> 2];
|
|
31
|
+
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
32
|
+
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
33
|
+
base64 += chars[bytes[i + 2] & 63];
|
|
34
|
+
}
|
|
35
|
+
if (len % 3 === 2) {
|
|
36
|
+
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
37
|
+
}
|
|
38
|
+
else if (len % 3 === 1) {
|
|
39
|
+
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
40
|
+
}
|
|
41
|
+
return base64;
|
|
42
|
+
};
|
|
43
|
+
var decode = function (base64) {
|
|
44
|
+
var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
45
|
+
if (base64[base64.length - 1] === '=') {
|
|
46
|
+
bufferLength--;
|
|
47
|
+
if (base64[base64.length - 2] === '=') {
|
|
48
|
+
bufferLength--;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
|
|
52
|
+
for (i = 0; i < len; i += 4) {
|
|
53
|
+
encoded1 = lookup[base64.charCodeAt(i)];
|
|
54
|
+
encoded2 = lookup[base64.charCodeAt(i + 1)];
|
|
55
|
+
encoded3 = lookup[base64.charCodeAt(i + 2)];
|
|
56
|
+
encoded4 = lookup[base64.charCodeAt(i + 3)];
|
|
57
|
+
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
58
|
+
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
59
|
+
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
60
|
+
}
|
|
61
|
+
return arraybuffer;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=base64-arraybuffer.es5.js.map
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/***/ }),
|
|
69
|
+
|
|
70
|
+
/***/ "./node_modules/ts-loader/index.js!./src/record/workers/image-bitmap-data-url-worker.ts":
|
|
71
|
+
/*!**********************************************************************************************!*\
|
|
72
|
+
!*** ./node_modules/ts-loader/index.js!./src/record/workers/image-bitmap-data-url-worker.ts ***!
|
|
73
|
+
\**********************************************************************************************/
|
|
74
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
78
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
79
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
80
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
81
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
82
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
83
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
87
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
88
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
89
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
90
|
+
function step(op) {
|
|
91
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
92
|
+
while (_) try {
|
|
93
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
94
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
95
|
+
switch (op[0]) {
|
|
96
|
+
case 0: case 1: t = op; break;
|
|
97
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
98
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
99
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
100
|
+
default:
|
|
101
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
102
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
103
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
104
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
105
|
+
if (t[2]) _.ops.pop();
|
|
106
|
+
_.trys.pop(); continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
110
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
114
|
+
var base64_arraybuffer_1 = __webpack_require__(/*! base64-arraybuffer */ "./node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js");
|
|
115
|
+
var lastBlobMap = new Map();
|
|
116
|
+
var transparentBlobMap = new Map();
|
|
117
|
+
function getTransparentBlobFor(width, height) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
var id, offscreen, blob, arrayBuffer, base64;
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
id = "".concat(width, "-").concat(height);
|
|
124
|
+
if (transparentBlobMap.has(id))
|
|
125
|
+
return [2, transparentBlobMap.get(id)];
|
|
126
|
+
offscreen = new OffscreenCanvas(width, height);
|
|
127
|
+
offscreen.getContext('2d');
|
|
128
|
+
return [4, offscreen.convertToBlob()];
|
|
129
|
+
case 1:
|
|
130
|
+
blob = _a.sent();
|
|
131
|
+
return [4, blob.arrayBuffer()];
|
|
132
|
+
case 2:
|
|
133
|
+
arrayBuffer = _a.sent();
|
|
134
|
+
base64 = (0, base64_arraybuffer_1.encode)(arrayBuffer);
|
|
135
|
+
transparentBlobMap.set(id, base64);
|
|
136
|
+
return [2, base64];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
var worker = self;
|
|
142
|
+
worker.onmessage = function (e) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var _a, id, bitmap, width, height, transparentBase64, offscreen, ctx, blob, type, arrayBuffer, base64, _b;
|
|
145
|
+
return __generator(this, function (_c) {
|
|
146
|
+
switch (_c.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
if (!('OffscreenCanvas' in globalThis))
|
|
149
|
+
return [2, worker.postMessage({ id: e.data.id })];
|
|
150
|
+
_a = e.data, id = _a.id, bitmap = _a.bitmap, width = _a.width, height = _a.height;
|
|
151
|
+
transparentBase64 = getTransparentBlobFor(width, height);
|
|
152
|
+
offscreen = new OffscreenCanvas(width, height);
|
|
153
|
+
ctx = offscreen.getContext('2d');
|
|
154
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
155
|
+
bitmap.close();
|
|
156
|
+
return [4, offscreen.convertToBlob()];
|
|
157
|
+
case 1:
|
|
158
|
+
blob = _c.sent();
|
|
159
|
+
type = blob.type;
|
|
160
|
+
return [4, blob.arrayBuffer()];
|
|
161
|
+
case 2:
|
|
162
|
+
arrayBuffer = _c.sent();
|
|
163
|
+
base64 = (0, base64_arraybuffer_1.encode)(arrayBuffer);
|
|
164
|
+
_b = !lastBlobMap.has(id);
|
|
165
|
+
if (!_b) return [3, 4];
|
|
166
|
+
return [4, transparentBase64];
|
|
167
|
+
case 3:
|
|
168
|
+
_b = (_c.sent()) === base64;
|
|
169
|
+
_c.label = 4;
|
|
170
|
+
case 4:
|
|
171
|
+
if (_b) {
|
|
172
|
+
lastBlobMap.set(id, base64);
|
|
173
|
+
return [2, worker.postMessage({ id: id })];
|
|
174
|
+
}
|
|
175
|
+
if (lastBlobMap.get(id) === base64)
|
|
176
|
+
return [2, worker.postMessage({ id: id })];
|
|
177
|
+
worker.postMessage({
|
|
178
|
+
id: id,
|
|
179
|
+
type: type,
|
|
180
|
+
base64: base64,
|
|
181
|
+
width: width,
|
|
182
|
+
height: height,
|
|
183
|
+
});
|
|
184
|
+
lastBlobMap.set(id, base64);
|
|
185
|
+
return [2];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
/***/ })
|
|
193
|
+
|
|
194
|
+
/******/ });
|
|
195
|
+
/************************************************************************/
|
|
196
|
+
/******/ // The module cache
|
|
197
|
+
/******/ var __webpack_module_cache__ = {};
|
|
198
|
+
/******/
|
|
199
|
+
/******/ // The require function
|
|
200
|
+
/******/ function __webpack_require__(moduleId) {
|
|
201
|
+
/******/ // Check if module is in cache
|
|
202
|
+
/******/ if(__webpack_module_cache__[moduleId]) {
|
|
203
|
+
/******/ return __webpack_module_cache__[moduleId].exports;
|
|
204
|
+
/******/ }
|
|
205
|
+
/******/ // Create a new module (and put it into the cache)
|
|
206
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
207
|
+
/******/ // no module.id needed
|
|
208
|
+
/******/ // no module.loaded needed
|
|
209
|
+
/******/ exports: {}
|
|
210
|
+
/******/ };
|
|
211
|
+
/******/
|
|
212
|
+
/******/ // Execute the module function
|
|
213
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
214
|
+
/******/
|
|
215
|
+
/******/ // Return the exports of the module
|
|
216
|
+
/******/ return module.exports;
|
|
217
|
+
/******/ }
|
|
218
|
+
/******/
|
|
219
|
+
/************************************************************************/
|
|
220
|
+
/******/ /* webpack/runtime/define property getters */
|
|
221
|
+
/******/ (() => {
|
|
222
|
+
/******/ // define getter functions for harmony exports
|
|
223
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
224
|
+
/******/ for(var key in definition) {
|
|
225
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
226
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
227
|
+
/******/ }
|
|
228
|
+
/******/ }
|
|
229
|
+
/******/ };
|
|
230
|
+
/******/ })();
|
|
231
|
+
/******/
|
|
232
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
233
|
+
/******/ (() => {
|
|
234
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
235
|
+
/******/ })();
|
|
236
|
+
/******/
|
|
237
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
238
|
+
/******/ (() => {
|
|
239
|
+
/******/ // define __esModule on exports
|
|
240
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
241
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
242
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
243
|
+
/******/ }
|
|
244
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
245
|
+
/******/ };
|
|
246
|
+
/******/ })();
|
|
247
|
+
/******/
|
|
248
|
+
/************************************************************************/
|
|
249
|
+
/******/
|
|
250
|
+
/******/ // startup
|
|
251
|
+
/******/ // Load entry module and return exports
|
|
252
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
253
|
+
/******/ var __webpack_exports__ = __webpack_require__("./node_modules/ts-loader/index.js!./src/record/workers/image-bitmap-data-url-worker.ts");
|
|
254
|
+
/******/
|
|
255
|
+
/******/ })()
|
|
256
|
+
;
|
|
257
|
+
//# sourceMappingURL=image-bitmap-data-url-worker.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://highlightLib/./node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js","webpack://highlightLib/./src/record/workers/image-bitmap-data-url-worker.ts","webpack://highlightLib/webpack/bootstrap","webpack://highlightLib/webpack/runtime/define property getters","webpack://highlightLib/webpack/runtime/hasOwnProperty shorthand","webpack://highlightLib/webpack/runtime/make namespace object","webpack://highlightLib/webpack/startup"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE0B;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjDA,6IAA4C;AAM5C,IAAM,WAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;AACnD,IAAM,kBAAkB,GAAwB,IAAI,GAAG,EAAE,CAAC;AAiB1D,SAAe,qBAAqB,CAClC,KAAa,EACb,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CAAC,aAAa,EAAE;;oBAAtC,IAAI,GAAG,SAA+B;oBACtC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;oBACH,WAAM,IAAI,CAAC,WAAW,EAAE;;oBAAtC,WAAW,GAAG,SAAwB;oBACtC,MAAM,GAAG,+BAAM,EAAC,WAAW,CAAC,CAAC;oBAI/B,MAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;6BAApB,cAAoB;oBAAK,WAAM,iBAAiB;;oBAAxB,MAAC,SAAuB,CAAC,KAAK,MAAM;;;oBAAhE,QAAkE;wBAChE,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;wBAC5B,WAAO,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,MAAE,CAAC,EAAC;qBACnC;oBAED,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,MAAM;wBAAE,WAAO,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,MAAE,CAAC,EAAC;oBACtE,MAAM,CAAC,WAAW,CAAC;wBACjB,EAAE;wBACF,IAAI;wBACJ,MAAM;wBACN,KAAK;wBACL,MAAM;qBACP,CAAC,CAAC;oBACH,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;;;;;CAC7B,CAAC;;;;;;;UC5EF;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,wCAAwC,yCAAyC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;;UCNA;UACA;UACA;UACA","file":"image-bitmap-data-url-worker.worker.js","sourcesContent":["/*\n * base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>\n * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>\n * Released under MIT License\n */\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n// Use a lookup table to find the index.\nvar lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\nvar encode = function (arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';\n for (i = 0; i < len; i += 3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + '=';\n }\n else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + '==';\n }\n return base64;\n};\nvar decode = function (base64) {\n var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return arraybuffer;\n};\n\nexport { decode, encode };\n//# sourceMappingURL=base64-arraybuffer.es5.js.map\n","import { encode } from 'base64-arraybuffer';\nimport {\n ImageBitmapDataURLWorkerParams,\n ImageBitmapDataURLWorkerResponse,\n} from '../../types';\n\nconst lastBlobMap: Map<number, string> = new Map();\nconst transparentBlobMap: Map<string, string> = new Map();\n\nexport interface ImageBitmapDataURLRequestWorker {\n postMessage: (\n message: ImageBitmapDataURLWorkerParams,\n transfer?: [ImageBitmap],\n ) => void;\n onmessage: (message: MessageEvent<ImageBitmapDataURLWorkerResponse>) => void;\n}\n\ninterface ImageBitmapDataURLResponseWorker {\n onmessage:\n | null\n | ((message: MessageEvent<ImageBitmapDataURLWorkerParams>) => void);\n postMessage(e: ImageBitmapDataURLWorkerResponse): void;\n}\n\nasync function getTransparentBlobFor(\n width: number,\n height: number,\n): Promise<string> {\n const id = `${width}-${height}`;\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id)!;\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext('2d'); // creates rendering context for `converToBlob`\n const blob = await offscreen.convertToBlob(); // takes a while\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer); // cpu intensive\n transparentBlobMap.set(id, base64);\n return base64;\n}\n\n// `as any` because: https://github.com/Microsoft/TypeScript/issues/20595\nconst worker: ImageBitmapDataURLResponseWorker = self;\n\nworker.onmessage = async function (e) {\n if (!('OffscreenCanvas' in globalThis))\n return worker.postMessage({ id: e.data.id });\n\n const { id, bitmap, width, height } = e.data;\n\n const transparentBase64 = getTransparentBlobFor(width, height);\n\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext('2d')!;\n\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(); // takes a while\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer); // cpu intensive\n\n // on first try we should check if canvas is transparent,\n // no need to save it's contents in that case\n if (!lastBlobMap.has(id) && (await transparentBase64) === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id }); // unchanged\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height,\n });\n lastBlobMap.set(id, base64);\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./node_modules/ts-loader/index.js!./src/record/workers/image-bitmap-data-url-worker.ts\");\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(()=>{"use strict";var r={477:r=>{r.exports=function(r,t,e,o){var n=self||window;try{try{var i;try{i=new n.Blob([r])}catch(t){(i=new(n.BlobBuilder||n.WebKitBlobBuilder||n.MozBlobBuilder||n.MSBlobBuilder)).append(r),i=i.getBlob()}var c=n.URL||n.webkitURL,a=c.createObjectURL(i),p=new n[t](a,e);return c.revokeObjectURL(a),p}catch(o){return new n[t]("data:application/javascript,".concat(encodeURIComponent(r)),e)}}catch(r){if(!o)throw Error("Inline worker is not supported");return new n[t](o,e)}}}},t={};function e(o){if(t[o])return t[o].exports;var n=t[o]={exports:{}};return r[o](n,n.exports,e),n.exports}e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(r){if("object"==typeof window)return window}}(),(()=>{var r;e.g.importScripts&&(r=e.g.location+"");var t=e.g.document;if(!r&&t&&(t.currentScript&&(r=t.currentScript.src),!r)){var o=t.getElementsByTagName("script");o.length&&(r=o[o.length-1].src)}if(!r)throw new Error("Automatic publicPath is not supported in this browser");r=r.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),e.p=r})(),e(477)})();
|
|
2
|
+
//# sourceMappingURL=image-bitmap-data-url.worker.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://highlightLib/./node_modules/worker-loader/dist/runtime/inline.js","webpack://highlightLib/webpack/bootstrap","webpack://highlightLib/webpack/runtime/global","webpack://highlightLib/webpack/runtime/publicPath","webpack://highlightLib/./src/record/workers/image-bitmap-data-url.worker.ts"],"names":["module","exports","content","workerConstructor","workerOptions","url","globalScope","self","window","blob","Blob","e","BlobBuilder","WebKitBlobBuilder","MozBlobBuilder","MSBlobBuilder","append","getBlob","URL","webkitURL","objectURL","createObjectURL","worker","revokeObjectURL","concat","encodeURIComponent","Error","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","g","globalThis","this","Function","scriptUrl","importScripts","location","document","currentScript","src","scripts","getElementsByTagName","length","replace","p"],"mappings":"kCAKAA,EAAOC,QAAU,SAAUC,EAASC,EAAmBC,EAAeC,GACpE,IAAIC,EAAcC,MAAQC,OAE1B,IACE,IACE,IAAIC,EAEJ,IAEEA,EAAO,IAAIH,EAAYI,KAAK,CAACR,IAC7B,MAAOS,IAGPF,EAAO,IADWH,EAAYM,aAAeN,EAAYO,mBAAqBP,EAAYQ,gBAAkBR,EAAYS,gBAEnHC,OAAOd,GACZO,EAAOA,EAAKQ,UAGd,IAAIC,EAAMZ,EAAYY,KAAOZ,EAAYa,UACrCC,EAAYF,EAAIG,gBAAgBZ,GAChCa,EAAS,IAAIhB,EAAYH,GAAmBiB,EAAWhB,GAE3D,OADAc,EAAIK,gBAAgBH,GACbE,EACP,MAAOX,GACP,OAAO,IAAIL,EAAYH,GAAmB,+BAA+BqB,OAAOC,mBAAmBvB,IAAWE,IAEhH,MAAOO,GACP,IAAKN,EACH,MAAMqB,MAAM,kCAGd,OAAO,IAAIpB,EAAYH,GAAmBE,EAAKD,OCnC/CuB,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAU5B,QAG3C,IAAID,EAAS2B,EAAyBE,GAAY,CAGjD5B,QAAS,IAOV,OAHA6B,EAAoBD,GAAU7B,EAAQA,EAAOC,QAAS2B,GAG/C5B,EAAOC,QCpBf2B,EAAoBG,EAAI,WACvB,GAA0B,iBAAfC,WAAyB,OAAOA,WAC3C,IACC,OAAOC,MAAQ,IAAIC,SAAS,cAAb,GACd,MAAOvB,GACR,GAAsB,iBAAXH,OAAqB,OAAOA,QALjB,G,MCAxB,IAAI2B,EACAP,EAAoBG,EAAEK,gBAAeD,EAAYP,EAAoBG,EAAEM,SAAW,IACtF,IAAIC,EAAWV,EAAoBG,EAAEO,SACrC,IAAKH,GAAaG,IACbA,EAASC,gBACZJ,EAAYG,EAASC,cAAcC,MAC/BL,GAAW,CACf,IAAIM,EAAUH,EAASI,qBAAqB,UACzCD,EAAQE,SAAQR,EAAYM,EAAQA,EAAQE,OAAS,GAAGH,KAK7D,IAAKL,EAAW,MAAM,IAAIT,MAAM,yDAChCS,EAAYA,EAAUS,QAAQ,OAAQ,IAAIA,QAAQ,QAAS,IAAIA,QAAQ,YAAa,KACpFhB,EAAoBiB,EAAIV,G,GCdxB,Q","file":"image-bitmap-data-url.worker.worker.js","sourcesContent":["\"use strict\";\n\n/* eslint-env browser */\n\n/* eslint-disable no-undef, no-use-before-define, new-cap */\nmodule.exports = function (content, workerConstructor, workerOptions, url) {\n var globalScope = self || window;\n\n try {\n try {\n var blob;\n\n try {\n // New API\n blob = new globalScope.Blob([content]);\n } catch (e) {\n // BlobBuilder = Deprecated, but widely implemented\n var BlobBuilder = globalScope.BlobBuilder || globalScope.WebKitBlobBuilder || globalScope.MozBlobBuilder || globalScope.MSBlobBuilder;\n blob = new BlobBuilder();\n blob.append(content);\n blob = blob.getBlob();\n }\n\n var URL = globalScope.URL || globalScope.webkitURL;\n var objectURL = URL.createObjectURL(blob);\n var worker = new globalScope[workerConstructor](objectURL, workerOptions);\n URL.revokeObjectURL(objectURL);\n return worker;\n } catch (e) {\n return new globalScope[workerConstructor](\"data:application/javascript,\".concat(encodeURIComponent(content)), workerOptions);\n }\n } catch (e) {\n if (!url) {\n throw Error(\"Inline worker is not supported\");\n }\n\n return new globalScope[workerConstructor](url, workerOptions);\n }\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","\nimport worker from \"!!../../../node_modules/worker-loader/dist/runtime/inline.js\";\n\nexport default function Worker_fn() {\n return worker(\"(()=>{\\\"use strict\\\";var e={247:(e,t,n)=>{n.r(t),n.d(t,{decode:()=>s,encode:()=>i});for(var r=\\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\\\",o=\\\"undefined\\\"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<r.length;a++)o[r.charCodeAt(a)]=a;var i=function(e){var t,n=new Uint8Array(e),o=n.length,a=\\\"\\\";for(t=0;t<o;t+=3)a+=r[n[t]>>2],a+=r[(3&n[t])<<4|n[t+1]>>4],a+=r[(15&n[t+1])<<2|n[t+2]>>6],a+=r[63&n[t+2]];return o%3==2?a=a.substring(0,a.length-1)+\\\"=\\\":o%3==1&&(a=a.substring(0,a.length-2)+\\\"==\\\"),a},s=function(e){var t,n,r,a,i,s=.75*e.length,c=e.length,u=0;\\\"=\\\"===e[e.length-1]&&(s--,\\\"=\\\"===e[e.length-2]&&s--);var l=new ArrayBuffer(s),f=new Uint8Array(l);for(t=0;t<c;t+=4)n=o[e.charCodeAt(t)],r=o[e.charCodeAt(t+1)],a=o[e.charCodeAt(t+2)],i=o[e.charCodeAt(t+3)],f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|a>>2,f[u++]=(3&a)<<6|63&i;return l}},212:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},\\\"function\\\"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError(\\\"Generator is already executing.\\\");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,\\\"__esModule\\\",{value:!0});var a=n(247),i=new Map,s=new Map,c=self;console.log(\\\"worker initialized\\\"),c.onmessage=function(e){return r(this,void 0,void 0,(function(){var t,n,u,l,f,d,h,p,y,b,g,v;return o(this,(function(w){switch(w.label){case 0:return\\\"OffscreenCanvas\\\"in globalThis?(t=e.data,n=t.id,u=t.bitmap,l=t.width,f=t.height,d=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i,c;return o(this,(function(o){switch(o.label){case 0:return n=\\\"\\\".concat(e,\\\"-\\\").concat(t),s.has(n)?[2,s.get(n)]:((r=new OffscreenCanvas(e,t)).getContext(\\\"2d\\\"),[4,r.convertToBlob()]);case 1:return[4,o.sent().arrayBuffer()];case 2:return i=o.sent(),c=(0,a.encode)(i),s.set(n,c),[2,c]}}))}))}(l,f),(h=new OffscreenCanvas(l,f)).getContext(\\\"2d\\\").drawImage(u,0,0),u.close(),[4,h.convertToBlob()]):[2,c.postMessage({id:e.data.id})];case 1:return p=w.sent(),y=p.type,[4,p.arrayBuffer()];case 2:return b=w.sent(),g=(0,a.encode)(b),(v=!i.has(n))?[4,d]:[3,4];case 3:v=w.sent()===g,w.label=4;case 4:return v?(i.set(n,g),[2,c.postMessage({id:n})]):i.get(n)===g?[2,c.postMessage({id:n})]:(c.postMessage({id:n,type:y,base64:g,width:l,height:f}),i.set(n,g),[2])}}))}))}}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{\\\"undefined\\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\\"Module\\\"}),Object.defineProperty(e,\\\"__esModule\\\",{value:!0})},n(212)})();\\n//# sourceMappingURL=image-bitmap-data-url.worker.worker.worker.js.map\", \"Worker\", undefined, __webpack_public_path__ + \"image-bitmap-data-url.worker.worker.worker.js\");\n}\n"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(()=>{"use strict";var e={247:(e,t,n)=>{n.r(t),n.d(t,{decode:()=>s,encode:()=>i});for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<r.length;a++)o[r.charCodeAt(a)]=a;var i=function(e){var t,n=new Uint8Array(e),o=n.length,a="";for(t=0;t<o;t+=3)a+=r[n[t]>>2],a+=r[(3&n[t])<<4|n[t+1]>>4],a+=r[(15&n[t+1])<<2|n[t+2]>>6],a+=r[63&n[t+2]];return o%3==2?a=a.substring(0,a.length-1)+"=":o%3==1&&(a=a.substring(0,a.length-2)+"=="),a},s=function(e){var t,n,r,a,i,s=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var l=new ArrayBuffer(s),f=new Uint8Array(l);for(t=0;t<c;t+=4)n=o[e.charCodeAt(t)],r=o[e.charCodeAt(t+1)],a=o[e.charCodeAt(t+2)],i=o[e.charCodeAt(t+3)],f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|a>>2,f[u++]=(3&a)<<6|63&i;return l}},212:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(247),i=new Map,s=new Map,c=self;console.log("worker initialized"),c.onmessage=function(e){return r(this,void 0,void 0,(function(){var t,n,u,l,f,d,h,p,y,b,g,v;return o(this,(function(w){switch(w.label){case 0:return"OffscreenCanvas"in globalThis?(t=e.data,n=t.id,u=t.bitmap,l=t.width,f=t.height,d=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i,c;return o(this,(function(o){switch(o.label){case 0:return n="".concat(e,"-").concat(t),s.has(n)?[2,s.get(n)]:((r=new OffscreenCanvas(e,t)).getContext("2d"),[4,r.convertToBlob()]);case 1:return[4,o.sent().arrayBuffer()];case 2:return i=o.sent(),c=(0,a.encode)(i),s.set(n,c),[2,c]}}))}))}(l,f),(h=new OffscreenCanvas(l,f)).getContext("2d").drawImage(u,0,0),u.close(),[4,h.convertToBlob()]):[2,c.postMessage({id:e.data.id})];case 1:return p=w.sent(),y=p.type,[4,p.arrayBuffer()];case 2:return b=w.sent(),g=(0,a.encode)(b),(v=!i.has(n))?[4,d]:[3,4];case 3:v=w.sent()===g,w.label=4;case 4:return v?(i.set(n,g),[2,c.postMessage({id:n})]):i.get(n)===g?[2,c.postMessage({id:n})]:(c.postMessage({id:n,type:y,base64:g,width:l,height:f}),i.set(n,g),[2])}}))}))}}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(212)})();
|
|
2
|
+
//# sourceMappingURL=image-bitmap-data-url.worker.worker.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://highlightLib/./node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js","webpack://highlightLib/./src/record/workers/image-bitmap-data-url.worker.ts","webpack://highlightLib/webpack/bootstrap","webpack://highlightLib/webpack/runtime/define property getters","webpack://highlightLib/webpack/runtime/hasOwnProperty shorthand","webpack://highlightLib/webpack/runtime/make namespace object","webpack://highlightLib/webpack/startup"],"names":["chars","lookup","Uint8Array","i","length","charCodeAt","encode","arraybuffer","bytes","len","base64","substring","decode","encoded1","encoded2","encoded3","encoded4","bufferLength","p","ArrayBuffer","lastBlobMap","Map","transparentBlobMap","worker","self","console","log","onmessage","e","globalThis","data","id","bitmap","width","height","transparentBase64","has","get","offscreen","OffscreenCanvas","getContext","convertToBlob","arrayBuffer","set","getTransparentBlobFor","drawImage","close","postMessage","blob","type","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","call","d","definition","key","o","Object","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","value"],"mappings":"kFAQA,IAHA,IAAIA,EAAQ,mEAERC,EAA+B,oBAAfC,WAA6B,GAAK,IAAIA,WAAW,KAC5DC,EAAI,EAAGA,EAAIH,EAAMI,OAAQD,IAC9BF,EAAOD,EAAMK,WAAWF,IAAMA,EAElC,IAAIG,EAAS,SAAUC,GACnB,IAAyCJ,EAArCK,EAAQ,IAAIN,WAAWK,GAAiBE,EAAMD,EAAMJ,OAAQM,EAAS,GACzE,IAAKP,EAAI,EAAGA,EAAIM,EAAKN,GAAK,EACtBO,GAAUV,EAAMQ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D,QCnBfF,EAAoBM,EAAI,CAACJ,EAASK,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEP,EAASM,IAC5EE,OAAOC,eAAeT,EAASM,EAAK,CAAEI,YAAY,EAAM1B,IAAKqB,EAAWC,MCJ3ER,EAAoBS,EAAI,CAACI,EAAKC,IAAUJ,OAAOK,UAAUC,eAAeX,KAAKQ,EAAKC,GCClFd,EAAoBiB,EAAKf,IACH,oBAAXgB,QAA0BA,OAAOC,aAC1CT,OAAOC,eAAeT,EAASgB,OAAOC,YAAa,CAAEC,MAAO,WAE7DV,OAAOC,eAAeT,EAAS,aAAc,CAAEkB,OAAO,KCF7BpB,EAAoB,M","file":"image-bitmap-data-url.worker.worker.worker.js","sourcesContent":["/*\n * base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>\n * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>\n * Released under MIT License\n */\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n// Use a lookup table to find the index.\nvar lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\nvar encode = function (arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';\n for (i = 0; i < len; i += 3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + '=';\n }\n else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + '==';\n }\n return base64;\n};\nvar decode = function (base64) {\n var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return arraybuffer;\n};\n\nexport { decode, encode };\n//# sourceMappingURL=base64-arraybuffer.es5.js.map\n","import { encode } from 'base64-arraybuffer';\nimport {\n ImageBitmapDataURLWorkerParams,\n ImageBitmapDataURLWorkerResponse,\n} from '../../types';\n\nconst lastBlobMap: Map<number, string> = new Map();\nconst transparentBlobMap: Map<string, string> = new Map();\n\nexport interface ImageBitmapDataURLRequestWorker {\n postMessage: (\n message: ImageBitmapDataURLWorkerParams,\n transfer?: [ImageBitmap],\n ) => void;\n onmessage: (message: MessageEvent<ImageBitmapDataURLWorkerResponse>) => void;\n}\n\ninterface ImageBitmapDataURLResponseWorker {\n onmessage:\n | null\n | ((message: MessageEvent<ImageBitmapDataURLWorkerParams>) => void);\n postMessage(e: ImageBitmapDataURLWorkerResponse): void;\n}\n\nasync function getTransparentBlobFor(\n width: number,\n height: number,\n): Promise<string> {\n const id = `${width}-${height}`;\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id)!;\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext('2d'); // creates rendering context for `converToBlob`\n const blob = await offscreen.convertToBlob(); // takes a while\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer); // cpu intensive\n transparentBlobMap.set(id, base64);\n return base64;\n}\n\n// `as any` because: https://github.com/Microsoft/TypeScript/issues/20595\nconst worker: ImageBitmapDataURLResponseWorker = self;\nconsole.log('worker initialized');\n\nworker.onmessage = async function (e) {\n if (!('OffscreenCanvas' in globalThis))\n return worker.postMessage({ id: e.data.id });\n\n const { id, bitmap, width, height } = e.data;\n\n const transparentBase64 = getTransparentBlobFor(width, height);\n\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext('2d')!;\n\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(); // takes a while\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer); // cpu intensive\n\n // on first try we should check if canvas is transparent,\n // no need to save it's contents in that case\n if (!lastBlobMap.has(id) && (await transparentBase64) === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id }); // unchanged\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height,\n });\n lastBlobMap.set(id, base64);\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(212);\n"],"sourceRoot":""}
|
package/dist/index.js
CHANGED
|
@@ -3207,7 +3207,6 @@ var Replayer = (function () {
|
|
|
3207
3207
|
};
|
|
3208
3208
|
Replayer.prototype.replaceEvents = function (events) {
|
|
3209
3209
|
var e_4, _a;
|
|
3210
|
-
var _this = this;
|
|
3211
3210
|
try {
|
|
3212
3211
|
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
3213
3212
|
var event_1 = events_1_1.value;
|
|
@@ -3224,9 +3223,7 @@ var Replayer = (function () {
|
|
|
3224
3223
|
}
|
|
3225
3224
|
finally { if (e_4) throw e_4.error; }
|
|
3226
3225
|
}
|
|
3227
|
-
|
|
3228
|
-
return _this.service.send({ type: 'REPLACE_EVENTS', payload: { events: events } });
|
|
3229
|
-
});
|
|
3226
|
+
this.service.send({ type: 'REPLACE_EVENTS', payload: { events: events } });
|
|
3230
3227
|
};
|
|
3231
3228
|
Replayer.prototype.enableInteract = function () {
|
|
3232
3229
|
this.iframe.setAttribute('scrolling', 'auto');
|
|
@@ -4878,7 +4875,7 @@ function createPlayerService(context, _a) {
|
|
|
4878
4875
|
var _loop_2 = function (event_4) {
|
|
4879
4876
|
timer_1.addDelay(event_4, baselineTime);
|
|
4880
4877
|
curEvents.push(event_4);
|
|
4881
|
-
if (event_4.timestamp >= baselineTime) {
|
|
4878
|
+
if (event_4.timestamp >= timer.timeOffset + baselineTime) {
|
|
4882
4879
|
var castFn_2 = getCastFn(event_4, false);
|
|
4883
4880
|
actions.push({
|
|
4884
4881
|
doAction: function () {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|