@highlight-run/rrweb 2.0.1 → 2.0.6
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/plugins/console-record.js +12 -655
- package/dist/plugins/console-record.min.js +12 -15
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +4 -293
- package/dist/plugins/console-replay.min.js +4 -15
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/plugins/sequential-id-record.js +1 -33
- package/dist/plugins/sequential-id-record.min.js +1 -1
- package/dist/plugins/sequential-id-record.min.js.map +1 -1
- package/dist/plugins/sequential-id-replay.js +1 -37
- package/dist/plugins/sequential-id-replay.min.js +1 -1
- package/dist/plugins/sequential-id-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.js +3 -747
- package/dist/record/rrweb-record-pack.min.js +3 -15
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +4 -3318
- package/dist/record/rrweb-record.min.js +4 -15
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.css +1 -0
- package/dist/replay/rrweb-replay-unpack.js +5 -4614
- package/dist/replay/rrweb-replay-unpack.min.js +5 -17
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.css +1 -0
- package/dist/replay/rrweb-replay.js +5 -4204
- package/dist/replay/rrweb-replay.min.js +5 -17
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.css +1 -0
- package/dist/rrweb-all.js +16 -8696
- package/dist/rrweb-all.min.js +16 -17
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.css +1 -0
- package/dist/rrweb.js +6 -7282
- package/dist/rrweb.min.js +6 -17
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
- package/es/rrweb/all.css +1 -0
- package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
- package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
- package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
- package/es/rrweb/packages/rrweb/src/index.js +6 -4
- package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
- package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
- package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
- package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
- package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
- package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
- package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
- package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
- package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
- package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
- package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
- package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
- package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
- package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
- package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
- package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
- package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
- package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
- package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
- package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
- package/es/rrweb/packages/rrweb/src/types.js +72 -72
- package/es/rrweb/packages/rrweb/src/utils.js +312 -506
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +190 -72
- package/lib/plugins/console-record.js +469 -627
- package/lib/plugins/console-replay.js +198 -268
- package/lib/plugins/sequential-id-record.js +19 -20
- package/lib/plugins/sequential-id-replay.js +25 -25
- package/lib/record/rrweb-record-pack.js +184 -139
- package/lib/record/rrweb-record.js +2467 -2425
- package/lib/replay/rrweb-replay-unpack.css +1 -0
- package/lib/replay/rrweb-replay-unpack.js +3798 -3344
- package/lib/replay/rrweb-replay.css +1 -0
- package/lib/replay/rrweb-replay.js +3743 -3289
- package/lib/rrweb-all.css +1 -0
- package/lib/rrweb-all.js +6721 -6249
- package/lib/rrweb.css +1 -0
- package/lib/rrweb.js +6151 -5632
- package/package.json +14 -13
- package/typings/packer/base.d.ts +1 -1
- package/typings/plugins/console/record/index.d.ts +1 -1
- package/typings/plugins/console/record/stringify.d.ts +1 -1
- package/typings/plugins/sequential-id/record/index.d.ts +1 -1
- package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
- package/typings/record/iframe-manager.d.ts +3 -3
- package/typings/record/index.d.ts +1 -1
- package/typings/record/mutation.d.ts +2 -1
- package/typings/record/observers/canvas/2d.d.ts +2 -1
- package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
- package/typings/record/observers/canvas/canvas.d.ts +1 -1
- package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
- package/typings/record/observers/canvas/webgl.d.ts +2 -1
- package/typings/record/shadow-dom-manager.d.ts +2 -1
- package/typings/record/stylesheet-manager.d.ts +12 -0
- package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
- package/typings/replay/canvas/2d.d.ts +3 -3
- package/typings/replay/canvas/deserialize-args.d.ts +7 -0
- package/typings/replay/canvas/index.d.ts +4 -3
- package/typings/replay/canvas/webgl.d.ts +3 -5
- package/typings/replay/index.d.ts +7 -10
- package/typings/types.d.ts +45 -17
- package/typings/utils.d.ts +17 -44
- package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
- package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
- package/typings/replay/virtual-styles.d.ts +0 -43
|
@@ -1,3318 +1,4 @@
|
|
|
1
|
-
var rrwebRecord = (function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/*! *****************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
|
|
7
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
purpose with or without fee is hereby granted.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
***************************************************************************** */
|
|
18
|
-
|
|
19
|
-
var __assign = function() {
|
|
20
|
-
__assign = Object.assign || function __assign(t) {
|
|
21
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
22
|
-
s = arguments[i];
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
|
-
return __assign.apply(this, arguments);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __rest(s, e) {
|
|
31
|
-
var t = {};
|
|
32
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
33
|
-
t[p] = s[p];
|
|
34
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
35
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
36
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
37
|
-
t[p[i]] = s[p[i]];
|
|
38
|
-
}
|
|
39
|
-
return t;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function __values(o) {
|
|
43
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
44
|
-
if (m) return m.call(o);
|
|
45
|
-
if (o && typeof o.length === "number") return {
|
|
46
|
-
next: function () {
|
|
47
|
-
if (o && i >= o.length) o = void 0;
|
|
48
|
-
return { value: o && o[i++], done: !o };
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function __read(o, n) {
|
|
55
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
56
|
-
if (!m) return o;
|
|
57
|
-
var i = m.call(o), r, ar = [], e;
|
|
58
|
-
try {
|
|
59
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
60
|
-
}
|
|
61
|
-
catch (error) { e = { error: error }; }
|
|
62
|
-
finally {
|
|
63
|
-
try {
|
|
64
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
65
|
-
}
|
|
66
|
-
finally { if (e) throw e.error; }
|
|
67
|
-
}
|
|
68
|
-
return ar;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function __spreadArray(to, from, pack) {
|
|
72
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
73
|
-
if (ar || !(i in from)) {
|
|
74
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
75
|
-
ar[i] = from[i];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var NodeType;
|
|
82
|
-
(function (NodeType) {
|
|
83
|
-
NodeType[NodeType["Document"] = 0] = "Document";
|
|
84
|
-
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
85
|
-
NodeType[NodeType["Element"] = 2] = "Element";
|
|
86
|
-
NodeType[NodeType["Text"] = 3] = "Text";
|
|
87
|
-
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
88
|
-
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
89
|
-
})(NodeType || (NodeType = {}));
|
|
90
|
-
|
|
91
|
-
function isElement(n) {
|
|
92
|
-
return n.nodeType === n.ELEMENT_NODE;
|
|
93
|
-
}
|
|
94
|
-
function isShadowRoot(n) {
|
|
95
|
-
var _a;
|
|
96
|
-
var host = (_a = n) === null || _a === void 0 ? void 0 : _a.host;
|
|
97
|
-
return Boolean(host && host.shadowRoot && host.shadowRoot === n);
|
|
98
|
-
}
|
|
99
|
-
function maskInputValue(_a) {
|
|
100
|
-
var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
|
|
101
|
-
var text = value || '';
|
|
102
|
-
if (maskInputOptions[tagName.toLowerCase()] ||
|
|
103
|
-
maskInputOptions[type]) {
|
|
104
|
-
if (maskInputFn) {
|
|
105
|
-
text = maskInputFn(text);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
text = '*'.repeat(text.length);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return text;
|
|
112
|
-
}
|
|
113
|
-
var ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__';
|
|
114
|
-
function is2DCanvasBlank(canvas) {
|
|
115
|
-
var ctx = canvas.getContext('2d');
|
|
116
|
-
if (!ctx)
|
|
117
|
-
return true;
|
|
118
|
-
var chunkSize = 50;
|
|
119
|
-
for (var x = 0; x < canvas.width; x += chunkSize) {
|
|
120
|
-
for (var y = 0; y < canvas.height; y += chunkSize) {
|
|
121
|
-
var getImageData = ctx.getImageData;
|
|
122
|
-
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData
|
|
123
|
-
? getImageData[ORIGINAL_ATTRIBUTE_NAME]
|
|
124
|
-
: getImageData;
|
|
125
|
-
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
|
|
126
|
-
if (pixelBuffer.some(function (pixel) { return pixel !== 0; }))
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
function obfuscateText(text) {
|
|
133
|
-
text = text.replace(/[^ -~]+/g, '');
|
|
134
|
-
text =
|
|
135
|
-
(text === null || text === void 0 ? void 0 : text.split(' ').map(function (word) { return Math.random().toString(20).substr(2, word.length); }).join(' ')) || '';
|
|
136
|
-
return text;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var _id = 1;
|
|
140
|
-
var tagNameRegex = new RegExp('[^a-z0-9-_:]');
|
|
141
|
-
var IGNORED_NODE = -2;
|
|
142
|
-
function genId() {
|
|
143
|
-
return _id++;
|
|
144
|
-
}
|
|
145
|
-
function getValidTagName(element) {
|
|
146
|
-
if (element instanceof HTMLFormElement) {
|
|
147
|
-
return 'form';
|
|
148
|
-
}
|
|
149
|
-
var processedTagName = element.tagName.toLowerCase().trim();
|
|
150
|
-
if (tagNameRegex.test(processedTagName)) {
|
|
151
|
-
return 'div';
|
|
152
|
-
}
|
|
153
|
-
return processedTagName;
|
|
154
|
-
}
|
|
155
|
-
function getCssRulesString(s) {
|
|
156
|
-
try {
|
|
157
|
-
var rules = s.rules || s.cssRules;
|
|
158
|
-
return rules ? Array.from(rules).map(getCssRuleString).join('') : null;
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function getCssRuleString(rule) {
|
|
165
|
-
var cssStringified = rule.cssText;
|
|
166
|
-
if (isCSSImportRule(rule)) {
|
|
167
|
-
try {
|
|
168
|
-
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
|
|
169
|
-
}
|
|
170
|
-
catch (_a) {
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return cssStringified;
|
|
174
|
-
}
|
|
175
|
-
function isCSSImportRule(rule) {
|
|
176
|
-
return 'styleSheet' in rule;
|
|
177
|
-
}
|
|
178
|
-
function stringifyStyleSheet(sheet) {
|
|
179
|
-
return sheet.cssRules
|
|
180
|
-
? Array.from(sheet.cssRules)
|
|
181
|
-
.map(function (rule) { return rule.cssText || ''; })
|
|
182
|
-
.join('')
|
|
183
|
-
: '';
|
|
184
|
-
}
|
|
185
|
-
function extractOrigin(url) {
|
|
186
|
-
var origin = '';
|
|
187
|
-
if (url.indexOf('//') > -1) {
|
|
188
|
-
origin = url.split('/').slice(0, 3).join('/');
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
origin = url.split('/')[0];
|
|
192
|
-
}
|
|
193
|
-
origin = origin.split('?')[0];
|
|
194
|
-
return origin;
|
|
195
|
-
}
|
|
196
|
-
var canvasService;
|
|
197
|
-
var canvasCtx;
|
|
198
|
-
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
199
|
-
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
|
|
200
|
-
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
201
|
-
function absoluteToStylesheet(cssText, href) {
|
|
202
|
-
return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
|
|
203
|
-
var filePath = path1 || path2 || path3;
|
|
204
|
-
var maybeQuote = quote1 || quote2 || '';
|
|
205
|
-
if (!filePath) {
|
|
206
|
-
return origin;
|
|
207
|
-
}
|
|
208
|
-
if (!RELATIVE_PATH.test(filePath)) {
|
|
209
|
-
return "url(" + maybeQuote + filePath + maybeQuote + ")";
|
|
210
|
-
}
|
|
211
|
-
if (DATA_URI.test(filePath)) {
|
|
212
|
-
return "url(" + maybeQuote + filePath + maybeQuote + ")";
|
|
213
|
-
}
|
|
214
|
-
if (filePath[0] === '/') {
|
|
215
|
-
return "url(" + maybeQuote + (extractOrigin(href) + filePath) + maybeQuote + ")";
|
|
216
|
-
}
|
|
217
|
-
var stack = href.split('/');
|
|
218
|
-
var parts = filePath.split('/');
|
|
219
|
-
stack.pop();
|
|
220
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
221
|
-
var part = parts_1[_i];
|
|
222
|
-
if (part === '.') {
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
else if (part === '..') {
|
|
226
|
-
stack.pop();
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
stack.push(part);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return "url(" + maybeQuote + stack.join('/') + maybeQuote + ")";
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
236
|
-
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
237
|
-
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
238
|
-
if (attributeValue.trim() === '') {
|
|
239
|
-
return attributeValue;
|
|
240
|
-
}
|
|
241
|
-
var pos = 0;
|
|
242
|
-
function collectCharacters(regEx) {
|
|
243
|
-
var chars;
|
|
244
|
-
var match = regEx.exec(attributeValue.substring(pos));
|
|
245
|
-
if (match) {
|
|
246
|
-
chars = match[0];
|
|
247
|
-
pos += chars.length;
|
|
248
|
-
return chars;
|
|
249
|
-
}
|
|
250
|
-
return '';
|
|
251
|
-
}
|
|
252
|
-
var output = [];
|
|
253
|
-
while (true) {
|
|
254
|
-
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
255
|
-
if (pos >= attributeValue.length) {
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
259
|
-
if (url.slice(-1) === ',') {
|
|
260
|
-
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
261
|
-
output.push(url);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
var descriptorsStr = '';
|
|
265
|
-
url = absoluteToDoc(doc, url);
|
|
266
|
-
var inParens = false;
|
|
267
|
-
while (true) {
|
|
268
|
-
var c = attributeValue.charAt(pos);
|
|
269
|
-
if (c === '') {
|
|
270
|
-
output.push((url + descriptorsStr).trim());
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
else if (!inParens) {
|
|
274
|
-
if (c === ',') {
|
|
275
|
-
pos += 1;
|
|
276
|
-
output.push((url + descriptorsStr).trim());
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
else if (c === '(') {
|
|
280
|
-
inParens = true;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
if (c === ')') {
|
|
285
|
-
inParens = false;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
descriptorsStr += c;
|
|
289
|
-
pos += 1;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return output.join(', ');
|
|
294
|
-
}
|
|
295
|
-
function absoluteToDoc(doc, attributeValue) {
|
|
296
|
-
if (!attributeValue || attributeValue.trim() === '') {
|
|
297
|
-
return attributeValue;
|
|
298
|
-
}
|
|
299
|
-
var a = doc.createElement('a');
|
|
300
|
-
a.href = attributeValue;
|
|
301
|
-
return a.href;
|
|
302
|
-
}
|
|
303
|
-
function isSVGElement(el) {
|
|
304
|
-
return Boolean(el.tagName === 'svg' || el.ownerSVGElement);
|
|
305
|
-
}
|
|
306
|
-
function getHref() {
|
|
307
|
-
var a = document.createElement('a');
|
|
308
|
-
a.href = '';
|
|
309
|
-
return a.href;
|
|
310
|
-
}
|
|
311
|
-
function transformAttribute(doc, tagName, name, value) {
|
|
312
|
-
if (name === 'src' || (name === 'href' && value)) {
|
|
313
|
-
return absoluteToDoc(doc, value);
|
|
314
|
-
}
|
|
315
|
-
else if (name === 'xlink:href' && value && value[0] !== '#') {
|
|
316
|
-
return absoluteToDoc(doc, value);
|
|
317
|
-
}
|
|
318
|
-
else if (name === 'background' &&
|
|
319
|
-
value &&
|
|
320
|
-
(tagName === 'table' || tagName === 'td' || tagName === 'th')) {
|
|
321
|
-
return absoluteToDoc(doc, value);
|
|
322
|
-
}
|
|
323
|
-
else if (name === 'srcset' && value) {
|
|
324
|
-
return getAbsoluteSrcsetString(doc, value);
|
|
325
|
-
}
|
|
326
|
-
else if (name === 'style' && value) {
|
|
327
|
-
return absoluteToStylesheet(value, getHref());
|
|
328
|
-
}
|
|
329
|
-
else if (tagName === 'object' && name === 'data' && value) {
|
|
330
|
-
return absoluteToDoc(doc, value);
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
333
|
-
return value;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
337
|
-
if (typeof blockClass === 'string') {
|
|
338
|
-
if (element.classList.contains(blockClass)) {
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
for (var eIndex = 0; eIndex < element.classList.length; eIndex++) {
|
|
344
|
-
var className = element.classList[eIndex];
|
|
345
|
-
if (blockClass.test(className)) {
|
|
346
|
-
return true;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
if (blockSelector) {
|
|
351
|
-
return element.matches(blockSelector);
|
|
352
|
-
}
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
function needMaskingText(node, maskTextClass, maskTextSelector) {
|
|
356
|
-
if (!node) {
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
if (node.nodeType === node.ELEMENT_NODE) {
|
|
360
|
-
if (typeof maskTextClass === 'string') {
|
|
361
|
-
if (node.classList.contains(maskTextClass)) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
for (var eIndex = 0; eIndex < node.classList.length; eIndex++) {
|
|
367
|
-
var className = node.classList[eIndex];
|
|
368
|
-
if (maskTextClass.test(className)) {
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
if (maskTextSelector) {
|
|
374
|
-
if (node.matches(maskTextSelector)) {
|
|
375
|
-
return true;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
|
|
379
|
-
}
|
|
380
|
-
if (node.nodeType === node.TEXT_NODE) {
|
|
381
|
-
return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
|
|
382
|
-
}
|
|
383
|
-
return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
|
|
384
|
-
}
|
|
385
|
-
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
386
|
-
var win = iframeEl.contentWindow;
|
|
387
|
-
if (!win) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
var fired = false;
|
|
391
|
-
var readyState;
|
|
392
|
-
try {
|
|
393
|
-
readyState = win.document.readyState;
|
|
394
|
-
}
|
|
395
|
-
catch (error) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
if (readyState !== 'complete') {
|
|
399
|
-
var timer_1 = setTimeout(function () {
|
|
400
|
-
if (!fired) {
|
|
401
|
-
listener();
|
|
402
|
-
fired = true;
|
|
403
|
-
}
|
|
404
|
-
}, iframeLoadTimeout);
|
|
405
|
-
iframeEl.addEventListener('load', function () {
|
|
406
|
-
clearTimeout(timer_1);
|
|
407
|
-
fired = true;
|
|
408
|
-
listener();
|
|
409
|
-
});
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
var blankUrl = 'about:blank';
|
|
413
|
-
if (win.location.href !== blankUrl ||
|
|
414
|
-
iframeEl.src === blankUrl ||
|
|
415
|
-
iframeEl.src === '') {
|
|
416
|
-
setTimeout(listener, 0);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
iframeEl.addEventListener('load', listener);
|
|
420
|
-
}
|
|
421
|
-
function serializeNode(n, options) {
|
|
422
|
-
var _a;
|
|
423
|
-
var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
424
|
-
var rootId;
|
|
425
|
-
if (doc.__sn) {
|
|
426
|
-
var docId = doc.__sn.id;
|
|
427
|
-
rootId = docId === 1 ? undefined : docId;
|
|
428
|
-
}
|
|
429
|
-
switch (n.nodeType) {
|
|
430
|
-
case n.DOCUMENT_NODE:
|
|
431
|
-
if (n.compatMode !== 'CSS1Compat') {
|
|
432
|
-
return {
|
|
433
|
-
type: NodeType.Document,
|
|
434
|
-
childNodes: [],
|
|
435
|
-
compatMode: n.compatMode,
|
|
436
|
-
rootId: rootId
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
else {
|
|
440
|
-
return {
|
|
441
|
-
type: NodeType.Document,
|
|
442
|
-
childNodes: [],
|
|
443
|
-
rootId: rootId
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
case n.DOCUMENT_TYPE_NODE:
|
|
447
|
-
return {
|
|
448
|
-
type: NodeType.DocumentType,
|
|
449
|
-
name: n.name,
|
|
450
|
-
publicId: n.publicId,
|
|
451
|
-
systemId: n.systemId,
|
|
452
|
-
rootId: rootId
|
|
453
|
-
};
|
|
454
|
-
case n.ELEMENT_NODE:
|
|
455
|
-
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
456
|
-
var tagName = getValidTagName(n);
|
|
457
|
-
var attributes_1 = {};
|
|
458
|
-
for (var _i = 0, _d = Array.from(n.attributes); _i < _d.length; _i++) {
|
|
459
|
-
var _e = _d[_i], name_1 = _e.name, value = _e.value;
|
|
460
|
-
attributes_1[name_1] = transformAttribute(doc, tagName, name_1, value);
|
|
461
|
-
}
|
|
462
|
-
if (tagName === 'link' && inlineStylesheet) {
|
|
463
|
-
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
464
|
-
return s.href === n.href;
|
|
465
|
-
});
|
|
466
|
-
var cssText = null;
|
|
467
|
-
if (stylesheet) {
|
|
468
|
-
cssText = getCssRulesString(stylesheet);
|
|
469
|
-
}
|
|
470
|
-
if (cssText) {
|
|
471
|
-
delete attributes_1.rel;
|
|
472
|
-
delete attributes_1.href;
|
|
473
|
-
attributes_1._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
if (tagName === 'style' &&
|
|
477
|
-
n.sheet &&
|
|
478
|
-
!(n.innerText ||
|
|
479
|
-
n.textContent ||
|
|
480
|
-
'').trim().length) {
|
|
481
|
-
var cssText = getCssRulesString(n.sheet);
|
|
482
|
-
if (cssText) {
|
|
483
|
-
attributes_1._cssText = absoluteToStylesheet(cssText, getHref());
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
if (tagName === 'input' ||
|
|
487
|
-
tagName === 'textarea' ||
|
|
488
|
-
tagName === 'select') {
|
|
489
|
-
var value = n.value;
|
|
490
|
-
if (attributes_1.type !== 'radio' &&
|
|
491
|
-
attributes_1.type !== 'checkbox' &&
|
|
492
|
-
attributes_1.type !== 'submit' &&
|
|
493
|
-
attributes_1.type !== 'button' &&
|
|
494
|
-
value) {
|
|
495
|
-
attributes_1.value = maskInputValue({
|
|
496
|
-
type: attributes_1.type,
|
|
497
|
-
tagName: tagName,
|
|
498
|
-
value: value,
|
|
499
|
-
maskInputOptions: maskInputOptions,
|
|
500
|
-
maskInputFn: maskInputFn
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
else if (n.checked) {
|
|
504
|
-
attributes_1.checked = n.checked;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
if (tagName === 'option') {
|
|
508
|
-
if (n.selected && !maskInputOptions['select']) {
|
|
509
|
-
attributes_1.selected = true;
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
delete attributes_1.selected;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
if (tagName === 'canvas' && recordCanvas) {
|
|
516
|
-
if (n.__context === '2d') {
|
|
517
|
-
if (!is2DCanvasBlank(n)) {
|
|
518
|
-
attributes_1.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
else if (!('__context' in n)) {
|
|
522
|
-
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
523
|
-
var blankCanvas = document.createElement('canvas');
|
|
524
|
-
blankCanvas.width = n.width;
|
|
525
|
-
blankCanvas.height = n.height;
|
|
526
|
-
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
527
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
528
|
-
attributes_1.rr_dataURL = canvasDataURL;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
if (tagName === 'img' && inlineImages) {
|
|
533
|
-
if (!canvasService) {
|
|
534
|
-
canvasService = doc.createElement('canvas');
|
|
535
|
-
canvasCtx = canvasService.getContext('2d');
|
|
536
|
-
}
|
|
537
|
-
var image_1 = n;
|
|
538
|
-
var oldValue_1 = image_1.crossOrigin;
|
|
539
|
-
image_1.crossOrigin = 'anonymous';
|
|
540
|
-
var recordInlineImage = function () {
|
|
541
|
-
try {
|
|
542
|
-
canvasService.width = image_1.naturalWidth;
|
|
543
|
-
canvasService.height = image_1.naturalHeight;
|
|
544
|
-
canvasCtx.drawImage(image_1, 0, 0);
|
|
545
|
-
attributes_1.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
546
|
-
}
|
|
547
|
-
catch (err) {
|
|
548
|
-
console.warn("Cannot inline img src=" + image_1.currentSrc + "! Error: " + err);
|
|
549
|
-
}
|
|
550
|
-
oldValue_1
|
|
551
|
-
? (attributes_1.crossOrigin = oldValue_1)
|
|
552
|
-
: delete attributes_1.crossOrigin;
|
|
553
|
-
};
|
|
554
|
-
if (image_1.complete && image_1.naturalWidth !== 0)
|
|
555
|
-
recordInlineImage();
|
|
556
|
-
else
|
|
557
|
-
image_1.onload = recordInlineImage;
|
|
558
|
-
}
|
|
559
|
-
if (tagName === 'audio' || tagName === 'video') {
|
|
560
|
-
attributes_1.rr_mediaState = n.paused
|
|
561
|
-
? 'paused'
|
|
562
|
-
: 'played';
|
|
563
|
-
attributes_1.rr_mediaCurrentTime = n.currentTime;
|
|
564
|
-
}
|
|
565
|
-
if (n.scrollLeft) {
|
|
566
|
-
attributes_1.rr_scrollLeft = n.scrollLeft;
|
|
567
|
-
}
|
|
568
|
-
if (n.scrollTop) {
|
|
569
|
-
attributes_1.rr_scrollTop = n.scrollTop;
|
|
570
|
-
}
|
|
571
|
-
if (needBlock || (tagName === 'img' && enableStrictPrivacy)) {
|
|
572
|
-
var _f = n.getBoundingClientRect(), width = _f.width, height = _f.height;
|
|
573
|
-
attributes_1 = {
|
|
574
|
-
"class": attributes_1["class"],
|
|
575
|
-
rr_width: width + "px",
|
|
576
|
-
rr_height: height + "px"
|
|
577
|
-
};
|
|
578
|
-
needBlock = true;
|
|
579
|
-
}
|
|
580
|
-
if (tagName === 'iframe' && !keepIframeSrcFn(attributes_1.src)) {
|
|
581
|
-
if (!n.contentDocument) {
|
|
582
|
-
attributes_1.rr_src = attributes_1.src;
|
|
583
|
-
}
|
|
584
|
-
delete attributes_1.src;
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
type: NodeType.Element,
|
|
588
|
-
tagName: tagName,
|
|
589
|
-
attributes: attributes_1,
|
|
590
|
-
childNodes: [],
|
|
591
|
-
isSVG: isSVGElement(n) || undefined,
|
|
592
|
-
needBlock: needBlock,
|
|
593
|
-
rootId: rootId
|
|
594
|
-
};
|
|
595
|
-
case n.TEXT_NODE:
|
|
596
|
-
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
597
|
-
var textContent = n.textContent;
|
|
598
|
-
var isStyle = parentTagName === 'STYLE' ? true : undefined;
|
|
599
|
-
var isScript = parentTagName === 'SCRIPT' ? true : undefined;
|
|
600
|
-
var textContentHandled = false;
|
|
601
|
-
if (isStyle && textContent) {
|
|
602
|
-
try {
|
|
603
|
-
if (n.nextSibling || n.previousSibling) {
|
|
604
|
-
}
|
|
605
|
-
else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
606
|
-
textContent = stringifyStyleSheet(n.parentNode.sheet);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
catch (err) {
|
|
610
|
-
console.warn("Cannot get CSS styles from text's parentNode. Error: " + err, n);
|
|
611
|
-
}
|
|
612
|
-
textContent = absoluteToStylesheet(textContent, getHref());
|
|
613
|
-
textContentHandled = true;
|
|
614
|
-
}
|
|
615
|
-
if (isScript) {
|
|
616
|
-
textContent = 'SCRIPT_PLACEHOLDER';
|
|
617
|
-
textContentHandled = true;
|
|
618
|
-
}
|
|
619
|
-
else if (parentTagName === 'NOSCRIPT') {
|
|
620
|
-
textContent = '';
|
|
621
|
-
textContentHandled = true;
|
|
622
|
-
}
|
|
623
|
-
if (!isStyle &&
|
|
624
|
-
!isScript &&
|
|
625
|
-
needMaskingText(n, maskTextClass, maskTextSelector) &&
|
|
626
|
-
textContent) {
|
|
627
|
-
textContent = maskTextFn
|
|
628
|
-
? maskTextFn(textContent)
|
|
629
|
-
: textContent.replace(/[\S]/g, '*');
|
|
630
|
-
}
|
|
631
|
-
if (enableStrictPrivacy && !textContentHandled && parentTagName) {
|
|
632
|
-
var IGNORE_TAG_NAMES = new Set([
|
|
633
|
-
'HEAD',
|
|
634
|
-
'TITLE',
|
|
635
|
-
'STYLE',
|
|
636
|
-
'SCRIPT',
|
|
637
|
-
'HTML',
|
|
638
|
-
'BODY',
|
|
639
|
-
'NOSCRIPT',
|
|
640
|
-
]);
|
|
641
|
-
if (!IGNORE_TAG_NAMES.has(parentTagName) && textContent) {
|
|
642
|
-
textContent = obfuscateText(textContent);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
return {
|
|
646
|
-
type: NodeType.Text,
|
|
647
|
-
textContent: textContent || '',
|
|
648
|
-
isStyle: isStyle,
|
|
649
|
-
rootId: rootId
|
|
650
|
-
};
|
|
651
|
-
case n.CDATA_SECTION_NODE:
|
|
652
|
-
return {
|
|
653
|
-
type: NodeType.CDATA,
|
|
654
|
-
textContent: '',
|
|
655
|
-
rootId: rootId
|
|
656
|
-
};
|
|
657
|
-
case n.COMMENT_NODE:
|
|
658
|
-
return {
|
|
659
|
-
type: NodeType.Comment,
|
|
660
|
-
textContent: n.textContent || '',
|
|
661
|
-
rootId: rootId
|
|
662
|
-
};
|
|
663
|
-
default:
|
|
664
|
-
return false;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
function lowerIfExists(maybeAttr) {
|
|
668
|
-
if (maybeAttr === undefined) {
|
|
669
|
-
return '';
|
|
670
|
-
}
|
|
671
|
-
else {
|
|
672
|
-
return maybeAttr.toLowerCase();
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
676
|
-
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
677
|
-
return true;
|
|
678
|
-
}
|
|
679
|
-
else if (sn.type === NodeType.Element) {
|
|
680
|
-
if (slimDOMOptions.script &&
|
|
681
|
-
(sn.tagName === 'script' ||
|
|
682
|
-
(sn.tagName === 'link' &&
|
|
683
|
-
sn.attributes.rel === 'preload' &&
|
|
684
|
-
sn.attributes.as === 'script') ||
|
|
685
|
-
(sn.tagName === 'link' &&
|
|
686
|
-
sn.attributes.rel === 'prefetch' &&
|
|
687
|
-
typeof sn.attributes.href === 'string' &&
|
|
688
|
-
sn.attributes.href.endsWith('.js')))) {
|
|
689
|
-
return true;
|
|
690
|
-
}
|
|
691
|
-
else if (slimDOMOptions.headFavicon &&
|
|
692
|
-
((sn.tagName === 'link' && sn.attributes.rel === 'shortcut icon') ||
|
|
693
|
-
(sn.tagName === 'meta' &&
|
|
694
|
-
(lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) ||
|
|
695
|
-
lowerIfExists(sn.attributes.name) === 'application-name' ||
|
|
696
|
-
lowerIfExists(sn.attributes.rel) === 'icon' ||
|
|
697
|
-
lowerIfExists(sn.attributes.rel) === 'apple-touch-icon' ||
|
|
698
|
-
lowerIfExists(sn.attributes.rel) === 'shortcut icon')))) {
|
|
699
|
-
return true;
|
|
700
|
-
}
|
|
701
|
-
else if (sn.tagName === 'meta') {
|
|
702
|
-
if (slimDOMOptions.headMetaDescKeywords &&
|
|
703
|
-
lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
704
|
-
return true;
|
|
705
|
-
}
|
|
706
|
-
else if (slimDOMOptions.headMetaSocial &&
|
|
707
|
-
(lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||
|
|
708
|
-
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) ||
|
|
709
|
-
lowerIfExists(sn.attributes.name) === 'pinterest')) {
|
|
710
|
-
return true;
|
|
711
|
-
}
|
|
712
|
-
else if (slimDOMOptions.headMetaRobots &&
|
|
713
|
-
(lowerIfExists(sn.attributes.name) === 'robots' ||
|
|
714
|
-
lowerIfExists(sn.attributes.name) === 'googlebot' ||
|
|
715
|
-
lowerIfExists(sn.attributes.name) === 'bingbot')) {
|
|
716
|
-
return true;
|
|
717
|
-
}
|
|
718
|
-
else if (slimDOMOptions.headMetaHttpEquiv &&
|
|
719
|
-
sn.attributes['http-equiv'] !== undefined) {
|
|
720
|
-
return true;
|
|
721
|
-
}
|
|
722
|
-
else if (slimDOMOptions.headMetaAuthorship &&
|
|
723
|
-
(lowerIfExists(sn.attributes.name) === 'author' ||
|
|
724
|
-
lowerIfExists(sn.attributes.name) === 'generator' ||
|
|
725
|
-
lowerIfExists(sn.attributes.name) === 'framework' ||
|
|
726
|
-
lowerIfExists(sn.attributes.name) === 'publisher' ||
|
|
727
|
-
lowerIfExists(sn.attributes.name) === 'progid' ||
|
|
728
|
-
lowerIfExists(sn.attributes.property).match(/^article:/) ||
|
|
729
|
-
lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
730
|
-
return true;
|
|
731
|
-
}
|
|
732
|
-
else if (slimDOMOptions.headMetaVerification &&
|
|
733
|
-
(lowerIfExists(sn.attributes.name) === 'google-site-verification' ||
|
|
734
|
-
lowerIfExists(sn.attributes.name) === 'yandex-verification' ||
|
|
735
|
-
lowerIfExists(sn.attributes.name) === 'csrf-token' ||
|
|
736
|
-
lowerIfExists(sn.attributes.name) === 'p:domain_verify' ||
|
|
737
|
-
lowerIfExists(sn.attributes.name) === 'verify-v1' ||
|
|
738
|
-
lowerIfExists(sn.attributes.name) === 'verification' ||
|
|
739
|
-
lowerIfExists(sn.attributes.name) === 'shopify-checkout-api-token')) {
|
|
740
|
-
return true;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
return false;
|
|
745
|
-
}
|
|
746
|
-
function serializeNodeWithId(n, options) {
|
|
747
|
-
var doc = options.doc, map = options.map, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, _h = options.keepIframeSrcFn, keepIframeSrcFn = _h === void 0 ? function () { return false; } : _h, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
748
|
-
var _j = options.preserveWhiteSpace, preserveWhiteSpace = _j === void 0 ? true : _j;
|
|
749
|
-
var _serializedNode = serializeNode(n, {
|
|
750
|
-
doc: doc,
|
|
751
|
-
blockClass: blockClass,
|
|
752
|
-
blockSelector: blockSelector,
|
|
753
|
-
maskTextClass: maskTextClass,
|
|
754
|
-
maskTextSelector: maskTextSelector,
|
|
755
|
-
inlineStylesheet: inlineStylesheet,
|
|
756
|
-
maskInputOptions: maskInputOptions,
|
|
757
|
-
maskTextFn: maskTextFn,
|
|
758
|
-
maskInputFn: maskInputFn,
|
|
759
|
-
dataURLOptions: dataURLOptions,
|
|
760
|
-
inlineImages: inlineImages,
|
|
761
|
-
recordCanvas: recordCanvas,
|
|
762
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
763
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
764
|
-
});
|
|
765
|
-
if (!_serializedNode) {
|
|
766
|
-
console.warn(n, 'not serialized');
|
|
767
|
-
return null;
|
|
768
|
-
}
|
|
769
|
-
var id;
|
|
770
|
-
if ('__sn' in n) {
|
|
771
|
-
id = n.__sn.id;
|
|
772
|
-
}
|
|
773
|
-
else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||
|
|
774
|
-
(!preserveWhiteSpace &&
|
|
775
|
-
_serializedNode.type === NodeType.Text &&
|
|
776
|
-
!_serializedNode.isStyle &&
|
|
777
|
-
!_serializedNode.textContent.replace(/^\s+|\s+$/gm, '').length)) {
|
|
778
|
-
id = IGNORED_NODE;
|
|
779
|
-
}
|
|
780
|
-
else {
|
|
781
|
-
id = genId();
|
|
782
|
-
}
|
|
783
|
-
var serializedNode = Object.assign(_serializedNode, { id: id });
|
|
784
|
-
n.__sn = serializedNode;
|
|
785
|
-
if (id === IGNORED_NODE) {
|
|
786
|
-
return null;
|
|
787
|
-
}
|
|
788
|
-
map[id] = n;
|
|
789
|
-
if (onSerialize) {
|
|
790
|
-
onSerialize(n);
|
|
791
|
-
}
|
|
792
|
-
var recordChild = !skipChild;
|
|
793
|
-
if (serializedNode.type === NodeType.Element) {
|
|
794
|
-
recordChild = recordChild && !serializedNode.needBlock;
|
|
795
|
-
if (serializedNode.needBlock && serializedNode.tagName === 'img') {
|
|
796
|
-
var clone = n.cloneNode();
|
|
797
|
-
clone.src = '';
|
|
798
|
-
map[id] = clone;
|
|
799
|
-
}
|
|
800
|
-
delete serializedNode.needBlock;
|
|
801
|
-
if (n.shadowRoot)
|
|
802
|
-
serializedNode.isShadowHost = true;
|
|
803
|
-
}
|
|
804
|
-
if ((serializedNode.type === NodeType.Document ||
|
|
805
|
-
serializedNode.type === NodeType.Element) &&
|
|
806
|
-
recordChild) {
|
|
807
|
-
if (slimDOMOptions.headWhitespace &&
|
|
808
|
-
_serializedNode.type === NodeType.Element &&
|
|
809
|
-
_serializedNode.tagName === 'head') {
|
|
810
|
-
preserveWhiteSpace = false;
|
|
811
|
-
}
|
|
812
|
-
var bypassOptions = {
|
|
813
|
-
doc: doc,
|
|
814
|
-
map: map,
|
|
815
|
-
blockClass: blockClass,
|
|
816
|
-
blockSelector: blockSelector,
|
|
817
|
-
maskTextClass: maskTextClass,
|
|
818
|
-
maskTextSelector: maskTextSelector,
|
|
819
|
-
skipChild: skipChild,
|
|
820
|
-
inlineStylesheet: inlineStylesheet,
|
|
821
|
-
maskInputOptions: maskInputOptions,
|
|
822
|
-
maskTextFn: maskTextFn,
|
|
823
|
-
maskInputFn: maskInputFn,
|
|
824
|
-
slimDOMOptions: slimDOMOptions,
|
|
825
|
-
dataURLOptions: dataURLOptions,
|
|
826
|
-
inlineImages: inlineImages,
|
|
827
|
-
recordCanvas: recordCanvas,
|
|
828
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
829
|
-
onSerialize: onSerialize,
|
|
830
|
-
onIframeLoad: onIframeLoad,
|
|
831
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
832
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
833
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
834
|
-
};
|
|
835
|
-
for (var _i = 0, _k = Array.from(n.childNodes); _i < _k.length; _i++) {
|
|
836
|
-
var childN = _k[_i];
|
|
837
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
838
|
-
if (serializedChildNode) {
|
|
839
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
if (isElement(n) && n.shadowRoot) {
|
|
843
|
-
for (var _l = 0, _m = Array.from(n.shadowRoot.childNodes); _l < _m.length; _l++) {
|
|
844
|
-
var childN = _m[_l];
|
|
845
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
846
|
-
if (serializedChildNode) {
|
|
847
|
-
serializedChildNode.isShadow = true;
|
|
848
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
if (n.parentNode && isShadowRoot(n.parentNode)) {
|
|
854
|
-
serializedNode.isShadow = true;
|
|
855
|
-
}
|
|
856
|
-
if (serializedNode.type === NodeType.Element &&
|
|
857
|
-
serializedNode.tagName === 'iframe') {
|
|
858
|
-
onceIframeLoaded(n, function () {
|
|
859
|
-
var iframeDoc = n.contentDocument;
|
|
860
|
-
if (iframeDoc && onIframeLoad) {
|
|
861
|
-
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
862
|
-
doc: iframeDoc,
|
|
863
|
-
map: map,
|
|
864
|
-
blockClass: blockClass,
|
|
865
|
-
blockSelector: blockSelector,
|
|
866
|
-
maskTextClass: maskTextClass,
|
|
867
|
-
maskTextSelector: maskTextSelector,
|
|
868
|
-
skipChild: false,
|
|
869
|
-
inlineStylesheet: inlineStylesheet,
|
|
870
|
-
maskInputOptions: maskInputOptions,
|
|
871
|
-
maskTextFn: maskTextFn,
|
|
872
|
-
maskInputFn: maskInputFn,
|
|
873
|
-
slimDOMOptions: slimDOMOptions,
|
|
874
|
-
dataURLOptions: dataURLOptions,
|
|
875
|
-
inlineImages: inlineImages,
|
|
876
|
-
recordCanvas: recordCanvas,
|
|
877
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
878
|
-
onSerialize: onSerialize,
|
|
879
|
-
onIframeLoad: onIframeLoad,
|
|
880
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
881
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
882
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
883
|
-
});
|
|
884
|
-
if (serializedIframeNode) {
|
|
885
|
-
onIframeLoad(n, serializedIframeNode);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
}, iframeLoadTimeout);
|
|
889
|
-
}
|
|
890
|
-
return serializedNode;
|
|
891
|
-
}
|
|
892
|
-
function snapshot(n, options) {
|
|
893
|
-
var _a = options || {}, _b = _a.blockClass, blockClass = _b === void 0 ? 'highlight-block' : _b, _c = _a.blockSelector, blockSelector = _c === void 0 ? null : _c, _d = _a.maskTextClass, maskTextClass = _d === void 0 ? 'highlight-mask' : _d, _e = _a.maskTextSelector, maskTextSelector = _e === void 0 ? null : _e, _f = _a.inlineStylesheet, inlineStylesheet = _f === void 0 ? true : _f, _g = _a.inlineImages, inlineImages = _g === void 0 ? false : _g, _h = _a.recordCanvas, recordCanvas = _h === void 0 ? false : _h, _j = _a.maskAllInputs, maskAllInputs = _j === void 0 ? false : _j, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _k = _a.slimDOM, slimDOM = _k === void 0 ? false : _k, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, _l = _a.keepIframeSrcFn, keepIframeSrcFn = _l === void 0 ? function () { return false; } : _l, _m = _a.enableStrictPrivacy, enableStrictPrivacy = _m === void 0 ? false : _m;
|
|
894
|
-
var idNodeMap = {};
|
|
895
|
-
var maskInputOptions = maskAllInputs === true
|
|
896
|
-
? {
|
|
897
|
-
color: true,
|
|
898
|
-
date: true,
|
|
899
|
-
'datetime-local': true,
|
|
900
|
-
email: true,
|
|
901
|
-
month: true,
|
|
902
|
-
number: true,
|
|
903
|
-
range: true,
|
|
904
|
-
search: true,
|
|
905
|
-
tel: true,
|
|
906
|
-
text: true,
|
|
907
|
-
time: true,
|
|
908
|
-
url: true,
|
|
909
|
-
week: true,
|
|
910
|
-
textarea: true,
|
|
911
|
-
select: true,
|
|
912
|
-
password: true
|
|
913
|
-
}
|
|
914
|
-
: maskAllInputs === false
|
|
915
|
-
? {
|
|
916
|
-
password: true
|
|
917
|
-
}
|
|
918
|
-
: maskAllInputs;
|
|
919
|
-
var slimDOMOptions = slimDOM === true || slimDOM === 'all'
|
|
920
|
-
?
|
|
921
|
-
{
|
|
922
|
-
script: true,
|
|
923
|
-
comment: true,
|
|
924
|
-
headFavicon: true,
|
|
925
|
-
headWhitespace: true,
|
|
926
|
-
headMetaDescKeywords: slimDOM === 'all',
|
|
927
|
-
headMetaSocial: true,
|
|
928
|
-
headMetaRobots: true,
|
|
929
|
-
headMetaHttpEquiv: true,
|
|
930
|
-
headMetaAuthorship: true,
|
|
931
|
-
headMetaVerification: true
|
|
932
|
-
}
|
|
933
|
-
: slimDOM === false
|
|
934
|
-
? {}
|
|
935
|
-
: slimDOM;
|
|
936
|
-
return [
|
|
937
|
-
serializeNodeWithId(n, {
|
|
938
|
-
doc: n,
|
|
939
|
-
map: idNodeMap,
|
|
940
|
-
blockClass: blockClass,
|
|
941
|
-
blockSelector: blockSelector,
|
|
942
|
-
maskTextClass: maskTextClass,
|
|
943
|
-
maskTextSelector: maskTextSelector,
|
|
944
|
-
skipChild: false,
|
|
945
|
-
inlineStylesheet: inlineStylesheet,
|
|
946
|
-
maskInputOptions: maskInputOptions,
|
|
947
|
-
maskTextFn: maskTextFn,
|
|
948
|
-
maskInputFn: maskInputFn,
|
|
949
|
-
slimDOMOptions: slimDOMOptions,
|
|
950
|
-
dataURLOptions: dataURLOptions,
|
|
951
|
-
inlineImages: inlineImages,
|
|
952
|
-
recordCanvas: recordCanvas,
|
|
953
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
954
|
-
onSerialize: onSerialize,
|
|
955
|
-
onIframeLoad: onIframeLoad,
|
|
956
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
957
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
958
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
959
|
-
}),
|
|
960
|
-
idNodeMap,
|
|
961
|
-
];
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
var EventType;
|
|
965
|
-
(function (EventType) {
|
|
966
|
-
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
967
|
-
EventType[EventType["Load"] = 1] = "Load";
|
|
968
|
-
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
969
|
-
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
970
|
-
EventType[EventType["Meta"] = 4] = "Meta";
|
|
971
|
-
EventType[EventType["Custom"] = 5] = "Custom";
|
|
972
|
-
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
973
|
-
})(EventType || (EventType = {}));
|
|
974
|
-
var IncrementalSource;
|
|
975
|
-
(function (IncrementalSource) {
|
|
976
|
-
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
977
|
-
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
978
|
-
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
979
|
-
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
980
|
-
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
981
|
-
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
982
|
-
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
983
|
-
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
984
|
-
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
985
|
-
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
986
|
-
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
987
|
-
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
988
|
-
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
989
|
-
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
990
|
-
})(IncrementalSource || (IncrementalSource = {}));
|
|
991
|
-
var MouseInteractions;
|
|
992
|
-
(function (MouseInteractions) {
|
|
993
|
-
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
994
|
-
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
995
|
-
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
996
|
-
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
997
|
-
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
998
|
-
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
999
|
-
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
1000
|
-
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
1001
|
-
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
1002
|
-
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
1003
|
-
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
1004
|
-
})(MouseInteractions || (MouseInteractions = {}));
|
|
1005
|
-
var CanvasContext;
|
|
1006
|
-
(function (CanvasContext) {
|
|
1007
|
-
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
1008
|
-
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
1009
|
-
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
1010
|
-
})(CanvasContext || (CanvasContext = {}));
|
|
1011
|
-
var MediaInteractions;
|
|
1012
|
-
(function (MediaInteractions) {
|
|
1013
|
-
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
1014
|
-
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
1015
|
-
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
1016
|
-
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
1017
|
-
})(MediaInteractions || (MediaInteractions = {}));
|
|
1018
|
-
var ReplayerEvents;
|
|
1019
|
-
(function (ReplayerEvents) {
|
|
1020
|
-
ReplayerEvents["Start"] = "start";
|
|
1021
|
-
ReplayerEvents["Pause"] = "pause";
|
|
1022
|
-
ReplayerEvents["Resume"] = "resume";
|
|
1023
|
-
ReplayerEvents["Resize"] = "resize";
|
|
1024
|
-
ReplayerEvents["Finish"] = "finish";
|
|
1025
|
-
ReplayerEvents["FullsnapshotRebuilded"] = "fullsnapshot-rebuilded";
|
|
1026
|
-
ReplayerEvents["LoadStylesheetStart"] = "load-stylesheet-start";
|
|
1027
|
-
ReplayerEvents["LoadStylesheetEnd"] = "load-stylesheet-end";
|
|
1028
|
-
ReplayerEvents["SkipStart"] = "skip-start";
|
|
1029
|
-
ReplayerEvents["SkipEnd"] = "skip-end";
|
|
1030
|
-
ReplayerEvents["MouseInteraction"] = "mouse-interaction";
|
|
1031
|
-
ReplayerEvents["EventCast"] = "event-cast";
|
|
1032
|
-
ReplayerEvents["CustomEvent"] = "custom-event";
|
|
1033
|
-
ReplayerEvents["Flush"] = "flush";
|
|
1034
|
-
ReplayerEvents["StateChange"] = "state-change";
|
|
1035
|
-
ReplayerEvents["PlayBack"] = "play-back";
|
|
1036
|
-
})(ReplayerEvents || (ReplayerEvents = {}));
|
|
1037
|
-
|
|
1038
|
-
function on(type, fn, target) {
|
|
1039
|
-
if (target === void 0) { target = document; }
|
|
1040
|
-
var options = { capture: true, passive: true };
|
|
1041
|
-
target.addEventListener(type, fn, options);
|
|
1042
|
-
return function () { return target.removeEventListener(type, fn, options); };
|
|
1043
|
-
}
|
|
1044
|
-
function createMirror() {
|
|
1045
|
-
return {
|
|
1046
|
-
map: {},
|
|
1047
|
-
getId: function (n) {
|
|
1048
|
-
if (!n || !n.__sn) {
|
|
1049
|
-
return -1;
|
|
1050
|
-
}
|
|
1051
|
-
return n.__sn.id;
|
|
1052
|
-
},
|
|
1053
|
-
getNode: function (id) {
|
|
1054
|
-
return this.map[id] || null;
|
|
1055
|
-
},
|
|
1056
|
-
removeNodeFromMap: function (n) {
|
|
1057
|
-
var _this = this;
|
|
1058
|
-
var id = n.__sn && n.__sn.id;
|
|
1059
|
-
delete this.map[id];
|
|
1060
|
-
if (n.childNodes) {
|
|
1061
|
-
n.childNodes.forEach(function (child) {
|
|
1062
|
-
return _this.removeNodeFromMap(child);
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
},
|
|
1066
|
-
has: function (id) {
|
|
1067
|
-
return this.map.hasOwnProperty(id);
|
|
1068
|
-
},
|
|
1069
|
-
reset: function () {
|
|
1070
|
-
this.map = {};
|
|
1071
|
-
},
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
var DEPARTED_MIRROR_ACCESS_WARNING = 'Please stop import mirror directly. Instead of that,' +
|
|
1075
|
-
'\r\n' +
|
|
1076
|
-
'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +
|
|
1077
|
-
'\r\n' +
|
|
1078
|
-
'or you can use record.mirror to access the mirror instance during recording.';
|
|
1079
|
-
var _mirror = {
|
|
1080
|
-
map: {},
|
|
1081
|
-
getId: function () {
|
|
1082
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1083
|
-
return -1;
|
|
1084
|
-
},
|
|
1085
|
-
getNode: function () {
|
|
1086
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1087
|
-
return null;
|
|
1088
|
-
},
|
|
1089
|
-
removeNodeFromMap: function () {
|
|
1090
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1091
|
-
},
|
|
1092
|
-
has: function () {
|
|
1093
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1094
|
-
return false;
|
|
1095
|
-
},
|
|
1096
|
-
reset: function () {
|
|
1097
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1098
|
-
},
|
|
1099
|
-
};
|
|
1100
|
-
if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
1101
|
-
_mirror = new Proxy(_mirror, {
|
|
1102
|
-
get: function (target, prop, receiver) {
|
|
1103
|
-
if (prop === 'map') {
|
|
1104
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1105
|
-
}
|
|
1106
|
-
return Reflect.get(target, prop, receiver);
|
|
1107
|
-
},
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
function throttle(func, wait, options) {
|
|
1111
|
-
if (options === void 0) { options = {}; }
|
|
1112
|
-
var timeout = null;
|
|
1113
|
-
var previous = 0;
|
|
1114
|
-
return function (arg) {
|
|
1115
|
-
var now = Date.now();
|
|
1116
|
-
if (!previous && options.leading === false) {
|
|
1117
|
-
previous = now;
|
|
1118
|
-
}
|
|
1119
|
-
var remaining = wait - (now - previous);
|
|
1120
|
-
var context = this;
|
|
1121
|
-
var args = arguments;
|
|
1122
|
-
if (remaining <= 0 || remaining > wait) {
|
|
1123
|
-
if (timeout) {
|
|
1124
|
-
clearTimeout(timeout);
|
|
1125
|
-
timeout = null;
|
|
1126
|
-
}
|
|
1127
|
-
previous = now;
|
|
1128
|
-
func.apply(context, args);
|
|
1129
|
-
}
|
|
1130
|
-
else if (!timeout && options.trailing !== false) {
|
|
1131
|
-
timeout = setTimeout(function () {
|
|
1132
|
-
previous = options.leading === false ? 0 : Date.now();
|
|
1133
|
-
timeout = null;
|
|
1134
|
-
func.apply(context, args);
|
|
1135
|
-
}, remaining);
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
}
|
|
1139
|
-
function hookSetter(target, key, d, isRevoked, win) {
|
|
1140
|
-
if (win === void 0) { win = window; }
|
|
1141
|
-
var original = win.Object.getOwnPropertyDescriptor(target, key);
|
|
1142
|
-
win.Object.defineProperty(target, key, isRevoked
|
|
1143
|
-
? d
|
|
1144
|
-
: {
|
|
1145
|
-
set: function (value) {
|
|
1146
|
-
var _this = this;
|
|
1147
|
-
setTimeout(function () {
|
|
1148
|
-
d.set.call(_this, value);
|
|
1149
|
-
}, 0);
|
|
1150
|
-
if (original && original.set) {
|
|
1151
|
-
original.set.call(this, value);
|
|
1152
|
-
}
|
|
1153
|
-
},
|
|
1154
|
-
});
|
|
1155
|
-
return function () { return hookSetter(target, key, original || {}, true); };
|
|
1156
|
-
}
|
|
1157
|
-
function patch(source, name, replacement) {
|
|
1158
|
-
try {
|
|
1159
|
-
if (!(name in source)) {
|
|
1160
|
-
return function () { };
|
|
1161
|
-
}
|
|
1162
|
-
var original_1 = source[name];
|
|
1163
|
-
var wrapped = replacement(original_1);
|
|
1164
|
-
if (typeof wrapped === 'function') {
|
|
1165
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
1166
|
-
Object.defineProperties(wrapped, {
|
|
1167
|
-
__rrweb_original__: {
|
|
1168
|
-
enumerable: false,
|
|
1169
|
-
value: original_1,
|
|
1170
|
-
},
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
source[name] = wrapped;
|
|
1174
|
-
return function () {
|
|
1175
|
-
source[name] = original_1;
|
|
1176
|
-
};
|
|
1177
|
-
}
|
|
1178
|
-
catch (_a) {
|
|
1179
|
-
return function () { };
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
function getWindowHeight() {
|
|
1183
|
-
return (window.innerHeight ||
|
|
1184
|
-
(document.documentElement && document.documentElement.clientHeight) ||
|
|
1185
|
-
(document.body && document.body.clientHeight));
|
|
1186
|
-
}
|
|
1187
|
-
function getWindowWidth() {
|
|
1188
|
-
return (window.innerWidth ||
|
|
1189
|
-
(document.documentElement && document.documentElement.clientWidth) ||
|
|
1190
|
-
(document.body && document.body.clientWidth));
|
|
1191
|
-
}
|
|
1192
|
-
var isCanvasNode = function (node) {
|
|
1193
|
-
try {
|
|
1194
|
-
if (node instanceof HTMLElement) {
|
|
1195
|
-
return node.tagName === 'CANVAS';
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
catch (_a) {
|
|
1199
|
-
return false;
|
|
1200
|
-
}
|
|
1201
|
-
return false;
|
|
1202
|
-
};
|
|
1203
|
-
function isBlocked(node, blockClass) {
|
|
1204
|
-
if (!node) {
|
|
1205
|
-
return false;
|
|
1206
|
-
}
|
|
1207
|
-
if (node.nodeType === node.ELEMENT_NODE) {
|
|
1208
|
-
var needBlock_1 = false;
|
|
1209
|
-
if (typeof blockClass === 'string') {
|
|
1210
|
-
if (node.closest !== undefined) {
|
|
1211
|
-
return node.closest('.' + blockClass) !== null;
|
|
1212
|
-
}
|
|
1213
|
-
else {
|
|
1214
|
-
needBlock_1 = node.classList.contains(blockClass);
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
else {
|
|
1218
|
-
node.classList.forEach(function (className) {
|
|
1219
|
-
if (blockClass.test(className)) {
|
|
1220
|
-
needBlock_1 = true;
|
|
1221
|
-
}
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
return needBlock_1 || isBlocked(node.parentNode, blockClass);
|
|
1225
|
-
}
|
|
1226
|
-
if (node.nodeType === node.TEXT_NODE) {
|
|
1227
|
-
return isBlocked(node.parentNode, blockClass);
|
|
1228
|
-
}
|
|
1229
|
-
return isBlocked(node.parentNode, blockClass);
|
|
1230
|
-
}
|
|
1231
|
-
function isIgnored(n) {
|
|
1232
|
-
if ('__sn' in n) {
|
|
1233
|
-
return n.__sn.id === IGNORED_NODE;
|
|
1234
|
-
}
|
|
1235
|
-
return false;
|
|
1236
|
-
}
|
|
1237
|
-
function isAncestorRemoved(target, mirror) {
|
|
1238
|
-
if (isShadowRoot(target)) {
|
|
1239
|
-
return false;
|
|
1240
|
-
}
|
|
1241
|
-
var id = mirror.getId(target);
|
|
1242
|
-
if (!mirror.has(id)) {
|
|
1243
|
-
return true;
|
|
1244
|
-
}
|
|
1245
|
-
if (target.parentNode &&
|
|
1246
|
-
target.parentNode.nodeType === target.DOCUMENT_NODE) {
|
|
1247
|
-
return false;
|
|
1248
|
-
}
|
|
1249
|
-
if (!target.parentNode) {
|
|
1250
|
-
return true;
|
|
1251
|
-
}
|
|
1252
|
-
return isAncestorRemoved(target.parentNode, mirror);
|
|
1253
|
-
}
|
|
1254
|
-
function isTouchEvent(event) {
|
|
1255
|
-
return Boolean(event.changedTouches);
|
|
1256
|
-
}
|
|
1257
|
-
function polyfill(win) {
|
|
1258
|
-
if (win === void 0) { win = window; }
|
|
1259
|
-
if ('NodeList' in win && !win.NodeList.prototype.forEach) {
|
|
1260
|
-
win.NodeList.prototype.forEach = Array.prototype
|
|
1261
|
-
.forEach;
|
|
1262
|
-
}
|
|
1263
|
-
if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {
|
|
1264
|
-
win.DOMTokenList.prototype.forEach = Array.prototype
|
|
1265
|
-
.forEach;
|
|
1266
|
-
}
|
|
1267
|
-
if (!Node.prototype.contains) {
|
|
1268
|
-
Node.prototype.contains = function contains(node) {
|
|
1269
|
-
if (!(0 in arguments)) {
|
|
1270
|
-
throw new TypeError('1 argument is required');
|
|
1271
|
-
}
|
|
1272
|
-
do {
|
|
1273
|
-
if (this === node) {
|
|
1274
|
-
return true;
|
|
1275
|
-
}
|
|
1276
|
-
} while ((node = node && node.parentNode));
|
|
1277
|
-
return false;
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
function isIframeINode(node) {
|
|
1282
|
-
if ('__sn' in node) {
|
|
1283
|
-
return (node.__sn.type === NodeType.Element && node.__sn.tagName === 'iframe');
|
|
1284
|
-
}
|
|
1285
|
-
return false;
|
|
1286
|
-
}
|
|
1287
|
-
function hasShadowRoot(n) {
|
|
1288
|
-
return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
function isNodeInLinkedList(n) {
|
|
1292
|
-
return '__ln' in n;
|
|
1293
|
-
}
|
|
1294
|
-
var DoubleLinkedList = (function () {
|
|
1295
|
-
function DoubleLinkedList() {
|
|
1296
|
-
this.length = 0;
|
|
1297
|
-
this.head = null;
|
|
1298
|
-
}
|
|
1299
|
-
DoubleLinkedList.prototype.get = function (position) {
|
|
1300
|
-
if (position >= this.length) {
|
|
1301
|
-
throw new Error('Position outside of list range');
|
|
1302
|
-
}
|
|
1303
|
-
var current = this.head;
|
|
1304
|
-
for (var index = 0; index < position; index++) {
|
|
1305
|
-
current = (current === null || current === void 0 ? void 0 : current.next) || null;
|
|
1306
|
-
}
|
|
1307
|
-
return current;
|
|
1308
|
-
};
|
|
1309
|
-
DoubleLinkedList.prototype.addNode = function (n) {
|
|
1310
|
-
var node = {
|
|
1311
|
-
value: n,
|
|
1312
|
-
previous: null,
|
|
1313
|
-
next: null,
|
|
1314
|
-
};
|
|
1315
|
-
n.__ln = node;
|
|
1316
|
-
if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) {
|
|
1317
|
-
var current = n.previousSibling.__ln.next;
|
|
1318
|
-
node.next = current;
|
|
1319
|
-
node.previous = n.previousSibling.__ln;
|
|
1320
|
-
n.previousSibling.__ln.next = node;
|
|
1321
|
-
if (current) {
|
|
1322
|
-
current.previous = node;
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
else if (n.nextSibling &&
|
|
1326
|
-
isNodeInLinkedList(n.nextSibling) &&
|
|
1327
|
-
n.nextSibling.__ln.previous) {
|
|
1328
|
-
var current = n.nextSibling.__ln.previous;
|
|
1329
|
-
node.previous = current;
|
|
1330
|
-
node.next = n.nextSibling.__ln;
|
|
1331
|
-
n.nextSibling.__ln.previous = node;
|
|
1332
|
-
if (current) {
|
|
1333
|
-
current.next = node;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
else {
|
|
1337
|
-
if (this.head) {
|
|
1338
|
-
this.head.previous = node;
|
|
1339
|
-
}
|
|
1340
|
-
node.next = this.head;
|
|
1341
|
-
this.head = node;
|
|
1342
|
-
}
|
|
1343
|
-
this.length++;
|
|
1344
|
-
};
|
|
1345
|
-
DoubleLinkedList.prototype.removeNode = function (n) {
|
|
1346
|
-
var current = n.__ln;
|
|
1347
|
-
if (!this.head) {
|
|
1348
|
-
return;
|
|
1349
|
-
}
|
|
1350
|
-
if (!current.previous) {
|
|
1351
|
-
this.head = current.next;
|
|
1352
|
-
if (this.head) {
|
|
1353
|
-
this.head.previous = null;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
else {
|
|
1357
|
-
current.previous.next = current.next;
|
|
1358
|
-
if (current.next) {
|
|
1359
|
-
current.next.previous = current.previous;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
if (n.__ln) {
|
|
1363
|
-
delete n.__ln;
|
|
1364
|
-
}
|
|
1365
|
-
this.length--;
|
|
1366
|
-
};
|
|
1367
|
-
return DoubleLinkedList;
|
|
1368
|
-
}());
|
|
1369
|
-
var moveKey = function (id, parentId) { return "".concat(id, "@").concat(parentId); };
|
|
1370
|
-
function isINode(n) {
|
|
1371
|
-
return '__sn' in n;
|
|
1372
|
-
}
|
|
1373
|
-
var MutationBuffer = (function () {
|
|
1374
|
-
function MutationBuffer() {
|
|
1375
|
-
var _this = this;
|
|
1376
|
-
this.frozen = false;
|
|
1377
|
-
this.locked = false;
|
|
1378
|
-
this.texts = [];
|
|
1379
|
-
this.attributes = [];
|
|
1380
|
-
this.removes = [];
|
|
1381
|
-
this.mapRemoves = [];
|
|
1382
|
-
this.movedMap = {};
|
|
1383
|
-
this.addedSet = new Set();
|
|
1384
|
-
this.movedSet = new Set();
|
|
1385
|
-
this.droppedSet = new Set();
|
|
1386
|
-
this.processMutations = function (mutations) {
|
|
1387
|
-
mutations.forEach(_this.processMutation);
|
|
1388
|
-
_this.emit();
|
|
1389
|
-
};
|
|
1390
|
-
this.emit = function () {
|
|
1391
|
-
var e_1, _a, e_2, _b;
|
|
1392
|
-
if (_this.frozen || _this.locked) {
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
|
-
var adds = [];
|
|
1396
|
-
var addList = new DoubleLinkedList();
|
|
1397
|
-
var getNextId = function (n) {
|
|
1398
|
-
var ns = n;
|
|
1399
|
-
var nextId = IGNORED_NODE;
|
|
1400
|
-
while (nextId === IGNORED_NODE) {
|
|
1401
|
-
ns = ns && ns.nextSibling;
|
|
1402
|
-
nextId = ns && _this.mirror.getId(ns);
|
|
1403
|
-
}
|
|
1404
|
-
return nextId;
|
|
1405
|
-
};
|
|
1406
|
-
var pushAdd = function (n) {
|
|
1407
|
-
var _a, _b, _c, _d, _e;
|
|
1408
|
-
var shadowHost = n.getRootNode
|
|
1409
|
-
? (_a = n.getRootNode()) === null || _a === void 0 ? void 0 : _a.host
|
|
1410
|
-
: null;
|
|
1411
|
-
var rootShadowHost = shadowHost;
|
|
1412
|
-
while ((_c = (_b = rootShadowHost === null || rootShadowHost === void 0 ? void 0 : rootShadowHost.getRootNode) === null || _b === void 0 ? void 0 : _b.call(rootShadowHost)) === null || _c === void 0 ? void 0 : _c.host)
|
|
1413
|
-
rootShadowHost =
|
|
1414
|
-
((_e = (_d = rootShadowHost === null || rootShadowHost === void 0 ? void 0 : rootShadowHost.getRootNode) === null || _d === void 0 ? void 0 : _d.call(rootShadowHost)) === null || _e === void 0 ? void 0 : _e.host) ||
|
|
1415
|
-
null;
|
|
1416
|
-
var notInDoc = !_this.doc.contains(n) &&
|
|
1417
|
-
(rootShadowHost === null || !_this.doc.contains(rootShadowHost));
|
|
1418
|
-
if (!n.parentNode || notInDoc) {
|
|
1419
|
-
return;
|
|
1420
|
-
}
|
|
1421
|
-
var parentId = isShadowRoot(n.parentNode)
|
|
1422
|
-
? _this.mirror.getId(shadowHost)
|
|
1423
|
-
: _this.mirror.getId(n.parentNode);
|
|
1424
|
-
var nextId = getNextId(n);
|
|
1425
|
-
if (parentId === -1 || nextId === -1) {
|
|
1426
|
-
return addList.addNode(n);
|
|
1427
|
-
}
|
|
1428
|
-
var sn = serializeNodeWithId(n, {
|
|
1429
|
-
doc: _this.doc,
|
|
1430
|
-
map: _this.mirror.map,
|
|
1431
|
-
blockClass: _this.blockClass,
|
|
1432
|
-
blockSelector: _this.blockSelector,
|
|
1433
|
-
maskTextClass: _this.maskTextClass,
|
|
1434
|
-
maskTextSelector: _this.maskTextSelector,
|
|
1435
|
-
skipChild: true,
|
|
1436
|
-
inlineStylesheet: _this.inlineStylesheet,
|
|
1437
|
-
maskInputOptions: _this.maskInputOptions,
|
|
1438
|
-
maskTextFn: _this.maskTextFn,
|
|
1439
|
-
maskInputFn: _this.maskInputFn,
|
|
1440
|
-
slimDOMOptions: _this.slimDOMOptions,
|
|
1441
|
-
recordCanvas: _this.recordCanvas,
|
|
1442
|
-
inlineImages: _this.inlineImages,
|
|
1443
|
-
enableStrictPrivacy: _this.enableStrictPrivacy,
|
|
1444
|
-
onSerialize: function (currentN) {
|
|
1445
|
-
if (isIframeINode(currentN)) {
|
|
1446
|
-
_this.iframeManager.addIframe(currentN);
|
|
1447
|
-
}
|
|
1448
|
-
if (hasShadowRoot(n)) {
|
|
1449
|
-
_this.shadowDomManager.addShadowRoot(n.shadowRoot, document);
|
|
1450
|
-
}
|
|
1451
|
-
},
|
|
1452
|
-
onIframeLoad: function (iframe, childSn) {
|
|
1453
|
-
_this.iframeManager.attachIframe(iframe, childSn);
|
|
1454
|
-
_this.shadowDomManager.observeAttachShadow(iframe);
|
|
1455
|
-
},
|
|
1456
|
-
});
|
|
1457
|
-
if (sn) {
|
|
1458
|
-
adds.push({
|
|
1459
|
-
parentId: parentId,
|
|
1460
|
-
nextId: nextId,
|
|
1461
|
-
node: sn,
|
|
1462
|
-
});
|
|
1463
|
-
}
|
|
1464
|
-
};
|
|
1465
|
-
while (_this.mapRemoves.length) {
|
|
1466
|
-
_this.mirror.removeNodeFromMap(_this.mapRemoves.shift());
|
|
1467
|
-
}
|
|
1468
|
-
try {
|
|
1469
|
-
for (var _c = __values(_this.movedSet), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1470
|
-
var n = _d.value;
|
|
1471
|
-
if (isParentRemoved(_this.removes, n, _this.mirror) &&
|
|
1472
|
-
!_this.movedSet.has(n.parentNode)) {
|
|
1473
|
-
continue;
|
|
1474
|
-
}
|
|
1475
|
-
pushAdd(n);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1479
|
-
finally {
|
|
1480
|
-
try {
|
|
1481
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1482
|
-
}
|
|
1483
|
-
finally { if (e_1) throw e_1.error; }
|
|
1484
|
-
}
|
|
1485
|
-
try {
|
|
1486
|
-
for (var _e = __values(_this.addedSet), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1487
|
-
var n = _f.value;
|
|
1488
|
-
if (!isAncestorInSet(_this.droppedSet, n) &&
|
|
1489
|
-
!isParentRemoved(_this.removes, n, _this.mirror)) {
|
|
1490
|
-
pushAdd(n);
|
|
1491
|
-
}
|
|
1492
|
-
else if (isAncestorInSet(_this.movedSet, n)) {
|
|
1493
|
-
pushAdd(n);
|
|
1494
|
-
}
|
|
1495
|
-
else {
|
|
1496
|
-
_this.droppedSet.add(n);
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1501
|
-
finally {
|
|
1502
|
-
try {
|
|
1503
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1504
|
-
}
|
|
1505
|
-
finally { if (e_2) throw e_2.error; }
|
|
1506
|
-
}
|
|
1507
|
-
var candidate = null;
|
|
1508
|
-
while (addList.length) {
|
|
1509
|
-
var node = null;
|
|
1510
|
-
if (candidate) {
|
|
1511
|
-
var parentId = _this.mirror.getId(candidate.value.parentNode);
|
|
1512
|
-
var nextId = getNextId(candidate.value);
|
|
1513
|
-
if (parentId !== -1 && nextId !== -1) {
|
|
1514
|
-
node = candidate;
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
if (!node) {
|
|
1518
|
-
for (var index = addList.length - 1; index >= 0; index--) {
|
|
1519
|
-
var _node = addList.get(index);
|
|
1520
|
-
if (_node) {
|
|
1521
|
-
var parentId = _this.mirror.getId(_node.value.parentNode);
|
|
1522
|
-
var nextId = getNextId(_node.value);
|
|
1523
|
-
if (parentId !== -1 && nextId !== -1) {
|
|
1524
|
-
node = _node;
|
|
1525
|
-
break;
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
if (!node) {
|
|
1531
|
-
while (addList.head) {
|
|
1532
|
-
addList.removeNode(addList.head.value);
|
|
1533
|
-
}
|
|
1534
|
-
break;
|
|
1535
|
-
}
|
|
1536
|
-
candidate = node.previous;
|
|
1537
|
-
addList.removeNode(node.value);
|
|
1538
|
-
pushAdd(node.value);
|
|
1539
|
-
}
|
|
1540
|
-
var payload = {
|
|
1541
|
-
texts: _this.texts
|
|
1542
|
-
.map(function (text) {
|
|
1543
|
-
var value = text.value;
|
|
1544
|
-
if (_this.enableStrictPrivacy && value) {
|
|
1545
|
-
value = obfuscateText(value);
|
|
1546
|
-
}
|
|
1547
|
-
return {
|
|
1548
|
-
id: _this.mirror.getId(text.node),
|
|
1549
|
-
value: value,
|
|
1550
|
-
};
|
|
1551
|
-
})
|
|
1552
|
-
.filter(function (text) { return _this.mirror.has(text.id); }),
|
|
1553
|
-
attributes: _this.attributes
|
|
1554
|
-
.map(function (attribute) { return ({
|
|
1555
|
-
id: _this.mirror.getId(attribute.node),
|
|
1556
|
-
attributes: attribute.attributes,
|
|
1557
|
-
}); })
|
|
1558
|
-
.filter(function (attribute) { return _this.mirror.has(attribute.id); }),
|
|
1559
|
-
removes: _this.removes,
|
|
1560
|
-
adds: adds,
|
|
1561
|
-
};
|
|
1562
|
-
if (!payload.texts.length &&
|
|
1563
|
-
!payload.attributes.length &&
|
|
1564
|
-
!payload.removes.length &&
|
|
1565
|
-
!payload.adds.length) {
|
|
1566
|
-
return;
|
|
1567
|
-
}
|
|
1568
|
-
_this.texts = [];
|
|
1569
|
-
_this.attributes = [];
|
|
1570
|
-
_this.removes = [];
|
|
1571
|
-
_this.addedSet = new Set();
|
|
1572
|
-
_this.movedSet = new Set();
|
|
1573
|
-
_this.droppedSet = new Set();
|
|
1574
|
-
_this.movedMap = {};
|
|
1575
|
-
_this.mutationCb(payload);
|
|
1576
|
-
};
|
|
1577
|
-
this.processMutation = function (m) {
|
|
1578
|
-
var e_3, _a, e_4, _b;
|
|
1579
|
-
if (isIgnored(m.target)) {
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
switch (m.type) {
|
|
1583
|
-
case 'characterData': {
|
|
1584
|
-
var value = m.target.textContent;
|
|
1585
|
-
if (!isBlocked(m.target, _this.blockClass) && value !== m.oldValue) {
|
|
1586
|
-
_this.texts.push({
|
|
1587
|
-
value: needMaskingText(m.target, _this.maskTextClass, _this.maskTextSelector) && value
|
|
1588
|
-
? _this.maskTextFn
|
|
1589
|
-
? _this.maskTextFn(value)
|
|
1590
|
-
: value.replace(/[\S]/g, '*')
|
|
1591
|
-
: value,
|
|
1592
|
-
node: m.target,
|
|
1593
|
-
});
|
|
1594
|
-
}
|
|
1595
|
-
break;
|
|
1596
|
-
}
|
|
1597
|
-
case 'attributes': {
|
|
1598
|
-
var target = m.target;
|
|
1599
|
-
var value = m.target.getAttribute(m.attributeName);
|
|
1600
|
-
if (m.attributeName === 'value') {
|
|
1601
|
-
value = maskInputValue({
|
|
1602
|
-
maskInputOptions: _this.maskInputOptions,
|
|
1603
|
-
tagName: m.target.tagName,
|
|
1604
|
-
type: m.target.getAttribute('type'),
|
|
1605
|
-
value: value,
|
|
1606
|
-
maskInputFn: _this.maskInputFn,
|
|
1607
|
-
});
|
|
1608
|
-
}
|
|
1609
|
-
if (isBlocked(m.target, _this.blockClass) || value === m.oldValue) {
|
|
1610
|
-
return;
|
|
1611
|
-
}
|
|
1612
|
-
var item = _this.attributes.find(function (a) { return a.node === m.target; });
|
|
1613
|
-
if (!item) {
|
|
1614
|
-
item = {
|
|
1615
|
-
node: m.target,
|
|
1616
|
-
attributes: {},
|
|
1617
|
-
};
|
|
1618
|
-
_this.attributes.push(item);
|
|
1619
|
-
}
|
|
1620
|
-
if (m.attributeName === 'style') {
|
|
1621
|
-
var old = _this.doc.createElement('span');
|
|
1622
|
-
if (m.oldValue) {
|
|
1623
|
-
old.setAttribute('style', m.oldValue);
|
|
1624
|
-
}
|
|
1625
|
-
if (item.attributes.style === undefined ||
|
|
1626
|
-
item.attributes.style === null) {
|
|
1627
|
-
item.attributes.style = {};
|
|
1628
|
-
}
|
|
1629
|
-
var styleObj = item.attributes.style;
|
|
1630
|
-
try {
|
|
1631
|
-
for (var _c = __values(Array.from(target.style)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1632
|
-
var pname = _d.value;
|
|
1633
|
-
var newValue = target.style.getPropertyValue(pname);
|
|
1634
|
-
var newPriority = target.style.getPropertyPriority(pname);
|
|
1635
|
-
if (newValue !== old.style.getPropertyValue(pname) ||
|
|
1636
|
-
newPriority !== old.style.getPropertyPriority(pname)) {
|
|
1637
|
-
if (newPriority === '') {
|
|
1638
|
-
styleObj[pname] = newValue;
|
|
1639
|
-
}
|
|
1640
|
-
else {
|
|
1641
|
-
styleObj[pname] = [newValue, newPriority];
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1647
|
-
finally {
|
|
1648
|
-
try {
|
|
1649
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1650
|
-
}
|
|
1651
|
-
finally { if (e_3) throw e_3.error; }
|
|
1652
|
-
}
|
|
1653
|
-
try {
|
|
1654
|
-
for (var _e = __values(Array.from(old.style)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1655
|
-
var pname = _f.value;
|
|
1656
|
-
if (target.style.getPropertyValue(pname) === '') {
|
|
1657
|
-
styleObj[pname] = false;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1662
|
-
finally {
|
|
1663
|
-
try {
|
|
1664
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1665
|
-
}
|
|
1666
|
-
finally { if (e_4) throw e_4.error; }
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
else {
|
|
1670
|
-
var tagName = m.target.tagName;
|
|
1671
|
-
if (tagName === 'INPUT') {
|
|
1672
|
-
var node = m.target;
|
|
1673
|
-
if (node.type === 'password') {
|
|
1674
|
-
item.attributes['value'] = '*'.repeat(node.value.length);
|
|
1675
|
-
break;
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
item.attributes[m.attributeName] = transformAttribute(_this.doc, m.target.tagName, m.attributeName, value);
|
|
1679
|
-
}
|
|
1680
|
-
break;
|
|
1681
|
-
}
|
|
1682
|
-
case 'childList': {
|
|
1683
|
-
m.addedNodes.forEach(function (n) { return _this.genAdds(n, m.target); });
|
|
1684
|
-
m.removedNodes.forEach(function (n) {
|
|
1685
|
-
var nodeId = _this.mirror.getId(n);
|
|
1686
|
-
var parentId = isShadowRoot(m.target)
|
|
1687
|
-
? _this.mirror.getId(m.target.host)
|
|
1688
|
-
: _this.mirror.getId(m.target);
|
|
1689
|
-
if (isBlocked(m.target, _this.blockClass) || isIgnored(n)) {
|
|
1690
|
-
return;
|
|
1691
|
-
}
|
|
1692
|
-
if (_this.addedSet.has(n)) {
|
|
1693
|
-
deepDelete(_this.addedSet, n);
|
|
1694
|
-
_this.droppedSet.add(n);
|
|
1695
|
-
}
|
|
1696
|
-
else if (_this.addedSet.has(m.target) && nodeId === -1) ;
|
|
1697
|
-
else if (isAncestorRemoved(m.target, _this.mirror)) ;
|
|
1698
|
-
else if (_this.movedSet.has(n) &&
|
|
1699
|
-
_this.movedMap[moveKey(nodeId, parentId)]) {
|
|
1700
|
-
deepDelete(_this.movedSet, n);
|
|
1701
|
-
}
|
|
1702
|
-
else {
|
|
1703
|
-
_this.removes.push({
|
|
1704
|
-
parentId: parentId,
|
|
1705
|
-
id: nodeId,
|
|
1706
|
-
isShadow: isShadowRoot(m.target) ? true : undefined,
|
|
1707
|
-
});
|
|
1708
|
-
}
|
|
1709
|
-
_this.mapRemoves.push(n);
|
|
1710
|
-
});
|
|
1711
|
-
break;
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
};
|
|
1715
|
-
this.genAdds = function (n, target) {
|
|
1716
|
-
if (target && isBlocked(target, _this.blockClass)) {
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
if (isINode(n)) {
|
|
1720
|
-
if (isIgnored(n)) {
|
|
1721
|
-
return;
|
|
1722
|
-
}
|
|
1723
|
-
_this.movedSet.add(n);
|
|
1724
|
-
var targetId = null;
|
|
1725
|
-
if (target && isINode(target)) {
|
|
1726
|
-
targetId = target.__sn.id;
|
|
1727
|
-
}
|
|
1728
|
-
if (targetId) {
|
|
1729
|
-
_this.movedMap[moveKey(n.__sn.id, targetId)] = true;
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
else {
|
|
1733
|
-
_this.addedSet.add(n);
|
|
1734
|
-
_this.droppedSet.delete(n);
|
|
1735
|
-
}
|
|
1736
|
-
if (!isBlocked(n, _this.blockClass))
|
|
1737
|
-
n.childNodes.forEach(function (childN) { return _this.genAdds(childN); });
|
|
1738
|
-
};
|
|
1739
|
-
}
|
|
1740
|
-
MutationBuffer.prototype.init = function (options) {
|
|
1741
|
-
var _this = this;
|
|
1742
|
-
[
|
|
1743
|
-
'mutationCb',
|
|
1744
|
-
'blockClass',
|
|
1745
|
-
'blockSelector',
|
|
1746
|
-
'maskTextClass',
|
|
1747
|
-
'maskTextSelector',
|
|
1748
|
-
'inlineStylesheet',
|
|
1749
|
-
'maskInputOptions',
|
|
1750
|
-
'maskTextFn',
|
|
1751
|
-
'maskInputFn',
|
|
1752
|
-
'recordCanvas',
|
|
1753
|
-
'inlineImages',
|
|
1754
|
-
'slimDOMOptions',
|
|
1755
|
-
'doc',
|
|
1756
|
-
'mirror',
|
|
1757
|
-
'iframeManager',
|
|
1758
|
-
'shadowDomManager',
|
|
1759
|
-
'canvasManager',
|
|
1760
|
-
'enableStrictPrivacy',
|
|
1761
|
-
].forEach(function (key) {
|
|
1762
|
-
_this[key] = options[key];
|
|
1763
|
-
});
|
|
1764
|
-
};
|
|
1765
|
-
MutationBuffer.prototype.freeze = function () {
|
|
1766
|
-
this.frozen = true;
|
|
1767
|
-
this.canvasManager.freeze();
|
|
1768
|
-
};
|
|
1769
|
-
MutationBuffer.prototype.unfreeze = function () {
|
|
1770
|
-
this.frozen = false;
|
|
1771
|
-
this.canvasManager.unfreeze();
|
|
1772
|
-
this.emit();
|
|
1773
|
-
};
|
|
1774
|
-
MutationBuffer.prototype.isFrozen = function () {
|
|
1775
|
-
return this.frozen;
|
|
1776
|
-
};
|
|
1777
|
-
MutationBuffer.prototype.lock = function () {
|
|
1778
|
-
this.locked = true;
|
|
1779
|
-
this.canvasManager.lock();
|
|
1780
|
-
};
|
|
1781
|
-
MutationBuffer.prototype.unlock = function () {
|
|
1782
|
-
this.locked = false;
|
|
1783
|
-
this.canvasManager.unlock();
|
|
1784
|
-
this.emit();
|
|
1785
|
-
};
|
|
1786
|
-
MutationBuffer.prototype.reset = function () {
|
|
1787
|
-
this.shadowDomManager.reset();
|
|
1788
|
-
this.canvasManager.reset();
|
|
1789
|
-
};
|
|
1790
|
-
return MutationBuffer;
|
|
1791
|
-
}());
|
|
1792
|
-
function deepDelete(addsSet, n) {
|
|
1793
|
-
addsSet.delete(n);
|
|
1794
|
-
n.childNodes.forEach(function (childN) { return deepDelete(addsSet, childN); });
|
|
1795
|
-
}
|
|
1796
|
-
function isParentRemoved(removes, n, mirror) {
|
|
1797
|
-
var parentNode = n.parentNode;
|
|
1798
|
-
if (!parentNode) {
|
|
1799
|
-
return false;
|
|
1800
|
-
}
|
|
1801
|
-
var parentId = mirror.getId(parentNode);
|
|
1802
|
-
if (removes.some(function (r) { return r.id === parentId; })) {
|
|
1803
|
-
return true;
|
|
1804
|
-
}
|
|
1805
|
-
return isParentRemoved(removes, parentNode, mirror);
|
|
1806
|
-
}
|
|
1807
|
-
function isAncestorInSet(set, n) {
|
|
1808
|
-
var parentNode = n.parentNode;
|
|
1809
|
-
if (!parentNode) {
|
|
1810
|
-
return false;
|
|
1811
|
-
}
|
|
1812
|
-
if (set.has(parentNode)) {
|
|
1813
|
-
return true;
|
|
1814
|
-
}
|
|
1815
|
-
return isAncestorInSet(set, parentNode);
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
var mutationBuffers = [];
|
|
1819
|
-
var isCSSGroupingRuleSupported = typeof CSSGroupingRule !== 'undefined';
|
|
1820
|
-
var isCSSMediaRuleSupported = typeof CSSMediaRule !== 'undefined';
|
|
1821
|
-
var isCSSSupportsRuleSupported = typeof CSSSupportsRule !== 'undefined';
|
|
1822
|
-
var isCSSConditionRuleSupported = typeof CSSConditionRule !== 'undefined';
|
|
1823
|
-
function getEventTarget(event) {
|
|
1824
|
-
try {
|
|
1825
|
-
if ('composedPath' in event) {
|
|
1826
|
-
var path = event.composedPath();
|
|
1827
|
-
if (path.length) {
|
|
1828
|
-
return path[0];
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
else if ('path' in event && event.path.length) {
|
|
1832
|
-
return event.path[0];
|
|
1833
|
-
}
|
|
1834
|
-
return event.target;
|
|
1835
|
-
}
|
|
1836
|
-
catch (_a) {
|
|
1837
|
-
return event.target;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
function initMutationObserver(options, rootEl) {
|
|
1841
|
-
var _a, _b;
|
|
1842
|
-
var mutationBuffer = new MutationBuffer();
|
|
1843
|
-
mutationBuffers.push(mutationBuffer);
|
|
1844
|
-
mutationBuffer.init(options);
|
|
1845
|
-
var mutationObserverCtor = window.MutationObserver ||
|
|
1846
|
-
window.__rrMutationObserver;
|
|
1847
|
-
var angularZoneSymbol = (_b = (_a = window === null || window === void 0 ? void 0 : window.Zone) === null || _a === void 0 ? void 0 : _a.__symbol__) === null || _b === void 0 ? void 0 : _b.call(_a, 'MutationObserver');
|
|
1848
|
-
if (angularZoneSymbol &&
|
|
1849
|
-
window[angularZoneSymbol]) {
|
|
1850
|
-
mutationObserverCtor = window[angularZoneSymbol];
|
|
1851
|
-
}
|
|
1852
|
-
var observer = new mutationObserverCtor(mutationBuffer.processMutations.bind(mutationBuffer));
|
|
1853
|
-
observer.observe(rootEl, {
|
|
1854
|
-
attributes: true,
|
|
1855
|
-
attributeOldValue: true,
|
|
1856
|
-
characterData: true,
|
|
1857
|
-
characterDataOldValue: true,
|
|
1858
|
-
childList: true,
|
|
1859
|
-
subtree: true,
|
|
1860
|
-
});
|
|
1861
|
-
return observer;
|
|
1862
|
-
}
|
|
1863
|
-
function initMoveObserver(_a) {
|
|
1864
|
-
var mousemoveCb = _a.mousemoveCb, sampling = _a.sampling, doc = _a.doc, mirror = _a.mirror;
|
|
1865
|
-
if (sampling.mousemove === false) {
|
|
1866
|
-
return function () { };
|
|
1867
|
-
}
|
|
1868
|
-
var threshold = typeof sampling.mousemove === 'number' ? sampling.mousemove : 50;
|
|
1869
|
-
var callbackThreshold = typeof sampling.mousemoveCallback === 'number'
|
|
1870
|
-
? sampling.mousemoveCallback
|
|
1871
|
-
: 500;
|
|
1872
|
-
var positions = [];
|
|
1873
|
-
var timeBaseline;
|
|
1874
|
-
var wrappedCb = throttle(function (source) {
|
|
1875
|
-
var totalOffset = Date.now() - timeBaseline;
|
|
1876
|
-
mousemoveCb(positions.map(function (p) {
|
|
1877
|
-
p.timeOffset -= totalOffset;
|
|
1878
|
-
return p;
|
|
1879
|
-
}), source);
|
|
1880
|
-
positions = [];
|
|
1881
|
-
timeBaseline = null;
|
|
1882
|
-
}, callbackThreshold);
|
|
1883
|
-
var updatePosition = throttle(function (evt) {
|
|
1884
|
-
var target = getEventTarget(evt);
|
|
1885
|
-
var _a = isTouchEvent(evt)
|
|
1886
|
-
? evt.changedTouches[0]
|
|
1887
|
-
: evt, clientX = _a.clientX, clientY = _a.clientY;
|
|
1888
|
-
if (!timeBaseline) {
|
|
1889
|
-
timeBaseline = Date.now();
|
|
1890
|
-
}
|
|
1891
|
-
positions.push({
|
|
1892
|
-
x: clientX,
|
|
1893
|
-
y: clientY,
|
|
1894
|
-
id: mirror.getId(target),
|
|
1895
|
-
timeOffset: Date.now() - timeBaseline,
|
|
1896
|
-
});
|
|
1897
|
-
wrappedCb(typeof DragEvent !== 'undefined' && evt instanceof DragEvent
|
|
1898
|
-
? IncrementalSource.Drag
|
|
1899
|
-
: evt instanceof MouseEvent
|
|
1900
|
-
? IncrementalSource.MouseMove
|
|
1901
|
-
: IncrementalSource.TouchMove);
|
|
1902
|
-
}, threshold, {
|
|
1903
|
-
trailing: false,
|
|
1904
|
-
});
|
|
1905
|
-
var handlers = [
|
|
1906
|
-
on('mousemove', updatePosition, doc),
|
|
1907
|
-
on('touchmove', updatePosition, doc),
|
|
1908
|
-
on('drag', updatePosition, doc),
|
|
1909
|
-
];
|
|
1910
|
-
return function () {
|
|
1911
|
-
handlers.forEach(function (h) { return h(); });
|
|
1912
|
-
};
|
|
1913
|
-
}
|
|
1914
|
-
function initMouseInteractionObserver(_a) {
|
|
1915
|
-
var mouseInteractionCb = _a.mouseInteractionCb, doc = _a.doc, mirror = _a.mirror, blockClass = _a.blockClass, sampling = _a.sampling;
|
|
1916
|
-
if (sampling.mouseInteraction === false) {
|
|
1917
|
-
return function () { };
|
|
1918
|
-
}
|
|
1919
|
-
var disableMap = sampling.mouseInteraction === true ||
|
|
1920
|
-
sampling.mouseInteraction === undefined
|
|
1921
|
-
? {}
|
|
1922
|
-
: sampling.mouseInteraction;
|
|
1923
|
-
var handlers = [];
|
|
1924
|
-
var getHandler = function (eventKey) {
|
|
1925
|
-
return function (event) {
|
|
1926
|
-
var target = getEventTarget(event);
|
|
1927
|
-
if (isBlocked(target, blockClass) ||
|
|
1928
|
-
isCanvasNode(target)) {
|
|
1929
|
-
return;
|
|
1930
|
-
}
|
|
1931
|
-
var e = isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
1932
|
-
if (!e) {
|
|
1933
|
-
return;
|
|
1934
|
-
}
|
|
1935
|
-
var id = mirror.getId(target);
|
|
1936
|
-
var clientX = e.clientX, clientY = e.clientY;
|
|
1937
|
-
mouseInteractionCb({
|
|
1938
|
-
type: MouseInteractions[eventKey],
|
|
1939
|
-
id: id,
|
|
1940
|
-
x: clientX,
|
|
1941
|
-
y: clientY,
|
|
1942
|
-
});
|
|
1943
|
-
};
|
|
1944
|
-
};
|
|
1945
|
-
Object.keys(MouseInteractions)
|
|
1946
|
-
.filter(function (key) {
|
|
1947
|
-
return Number.isNaN(Number(key)) &&
|
|
1948
|
-
!key.endsWith('_Departed') &&
|
|
1949
|
-
disableMap[key] !== false;
|
|
1950
|
-
})
|
|
1951
|
-
.forEach(function (eventKey) {
|
|
1952
|
-
var eventName = eventKey.toLowerCase();
|
|
1953
|
-
var handler = getHandler(eventKey);
|
|
1954
|
-
handlers.push(on(eventName, handler, doc));
|
|
1955
|
-
});
|
|
1956
|
-
return function () {
|
|
1957
|
-
handlers.forEach(function (h) { return h(); });
|
|
1958
|
-
};
|
|
1959
|
-
}
|
|
1960
|
-
function initScrollObserver(_a) {
|
|
1961
|
-
var scrollCb = _a.scrollCb, doc = _a.doc, mirror = _a.mirror, blockClass = _a.blockClass, sampling = _a.sampling;
|
|
1962
|
-
var updatePosition = throttle(function (evt) {
|
|
1963
|
-
var target = getEventTarget(evt);
|
|
1964
|
-
if (!target || isBlocked(target, blockClass)) {
|
|
1965
|
-
return;
|
|
1966
|
-
}
|
|
1967
|
-
var id = mirror.getId(target);
|
|
1968
|
-
if (target === doc) {
|
|
1969
|
-
var scrollEl = (doc.scrollingElement || doc.documentElement);
|
|
1970
|
-
scrollCb({
|
|
1971
|
-
id: id,
|
|
1972
|
-
x: scrollEl.scrollLeft,
|
|
1973
|
-
y: scrollEl.scrollTop,
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
1976
|
-
else {
|
|
1977
|
-
scrollCb({
|
|
1978
|
-
id: id,
|
|
1979
|
-
x: target.scrollLeft,
|
|
1980
|
-
y: target.scrollTop,
|
|
1981
|
-
});
|
|
1982
|
-
}
|
|
1983
|
-
}, sampling.scroll || 100);
|
|
1984
|
-
return on('scroll', updatePosition, doc);
|
|
1985
|
-
}
|
|
1986
|
-
function initViewportResizeObserver(_a) {
|
|
1987
|
-
var viewportResizeCb = _a.viewportResizeCb;
|
|
1988
|
-
var lastH = -1;
|
|
1989
|
-
var lastW = -1;
|
|
1990
|
-
var updateDimension = throttle(function () {
|
|
1991
|
-
var height = getWindowHeight();
|
|
1992
|
-
var width = getWindowWidth();
|
|
1993
|
-
if (lastH !== height || lastW !== width) {
|
|
1994
|
-
viewportResizeCb({
|
|
1995
|
-
width: Number(width),
|
|
1996
|
-
height: Number(height),
|
|
1997
|
-
});
|
|
1998
|
-
lastH = height;
|
|
1999
|
-
lastW = width;
|
|
2000
|
-
}
|
|
2001
|
-
}, 200);
|
|
2002
|
-
return on('resize', updateDimension, window);
|
|
2003
|
-
}
|
|
2004
|
-
function wrapEventWithUserTriggeredFlag(v, enable) {
|
|
2005
|
-
var value = __assign({}, v);
|
|
2006
|
-
if (!enable)
|
|
2007
|
-
delete value.userTriggered;
|
|
2008
|
-
return value;
|
|
2009
|
-
}
|
|
2010
|
-
var INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
|
2011
|
-
var lastInputValueMap = new WeakMap();
|
|
2012
|
-
function initInputObserver(_a) {
|
|
2013
|
-
var inputCb = _a.inputCb, doc = _a.doc, mirror = _a.mirror, blockClass = _a.blockClass, ignoreClass = _a.ignoreClass, maskInputOptions = _a.maskInputOptions, maskInputFn = _a.maskInputFn, sampling = _a.sampling, userTriggeredOnInput = _a.userTriggeredOnInput;
|
|
2014
|
-
function eventHandler(event) {
|
|
2015
|
-
var target = getEventTarget(event);
|
|
2016
|
-
var userTriggered = event.isTrusted;
|
|
2017
|
-
if (target && target.tagName === 'OPTION')
|
|
2018
|
-
target = target.parentElement;
|
|
2019
|
-
if (!target ||
|
|
2020
|
-
!target.tagName ||
|
|
2021
|
-
INPUT_TAGS.indexOf(target.tagName) < 0 ||
|
|
2022
|
-
isBlocked(target, blockClass)) {
|
|
2023
|
-
return;
|
|
2024
|
-
}
|
|
2025
|
-
var type = target.type;
|
|
2026
|
-
if (target.classList.contains(ignoreClass)) {
|
|
2027
|
-
return;
|
|
2028
|
-
}
|
|
2029
|
-
var text = target.value;
|
|
2030
|
-
var isChecked = false;
|
|
2031
|
-
if (type === 'radio' || type === 'checkbox') {
|
|
2032
|
-
isChecked = target.checked;
|
|
2033
|
-
}
|
|
2034
|
-
else if (maskInputOptions[target.tagName.toLowerCase()] ||
|
|
2035
|
-
maskInputOptions[type]) {
|
|
2036
|
-
text = maskInputValue({
|
|
2037
|
-
maskInputOptions: maskInputOptions,
|
|
2038
|
-
tagName: target.tagName,
|
|
2039
|
-
type: type,
|
|
2040
|
-
value: text,
|
|
2041
|
-
maskInputFn: maskInputFn,
|
|
2042
|
-
});
|
|
2043
|
-
}
|
|
2044
|
-
cbWithDedup(target, wrapEventWithUserTriggeredFlag({ text: text, isChecked: isChecked, userTriggered: userTriggered }, userTriggeredOnInput));
|
|
2045
|
-
var name = target.name;
|
|
2046
|
-
if (type === 'radio' && name && isChecked) {
|
|
2047
|
-
doc
|
|
2048
|
-
.querySelectorAll("input[type=\"radio\"][name=\"".concat(name, "\"]"))
|
|
2049
|
-
.forEach(function (el) {
|
|
2050
|
-
if (el !== target) {
|
|
2051
|
-
cbWithDedup(el, wrapEventWithUserTriggeredFlag({
|
|
2052
|
-
text: el.value,
|
|
2053
|
-
isChecked: !isChecked,
|
|
2054
|
-
userTriggered: false,
|
|
2055
|
-
}, userTriggeredOnInput));
|
|
2056
|
-
}
|
|
2057
|
-
});
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
function cbWithDedup(target, v) {
|
|
2061
|
-
var lastInputValue = lastInputValueMap.get(target);
|
|
2062
|
-
if (!lastInputValue ||
|
|
2063
|
-
lastInputValue.text !== v.text ||
|
|
2064
|
-
lastInputValue.isChecked !== v.isChecked) {
|
|
2065
|
-
lastInputValueMap.set(target, v);
|
|
2066
|
-
var id = mirror.getId(target);
|
|
2067
|
-
inputCb(__assign(__assign({}, v), { id: id }));
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
var events = sampling.input === 'last' ? ['change'] : ['input', 'change'];
|
|
2071
|
-
var handlers = events.map(function (eventName) { return on(eventName, eventHandler, doc); });
|
|
2072
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
|
2073
|
-
var hookProperties = [
|
|
2074
|
-
[HTMLInputElement.prototype, 'value'],
|
|
2075
|
-
[HTMLInputElement.prototype, 'checked'],
|
|
2076
|
-
[HTMLSelectElement.prototype, 'value'],
|
|
2077
|
-
[HTMLTextAreaElement.prototype, 'value'],
|
|
2078
|
-
[HTMLSelectElement.prototype, 'selectedIndex'],
|
|
2079
|
-
[HTMLOptionElement.prototype, 'selected'],
|
|
2080
|
-
];
|
|
2081
|
-
if (propertyDescriptor && propertyDescriptor.set) {
|
|
2082
|
-
handlers.push.apply(handlers, __spreadArray([], __read(hookProperties.map(function (p) {
|
|
2083
|
-
return hookSetter(p[0], p[1], {
|
|
2084
|
-
set: function () {
|
|
2085
|
-
eventHandler({ target: this });
|
|
2086
|
-
},
|
|
2087
|
-
});
|
|
2088
|
-
})), false));
|
|
2089
|
-
}
|
|
2090
|
-
return function () {
|
|
2091
|
-
handlers.forEach(function (h) { return h(); });
|
|
2092
|
-
};
|
|
2093
|
-
}
|
|
2094
|
-
function getNestedCSSRulePositions(rule) {
|
|
2095
|
-
var positions = [];
|
|
2096
|
-
function recurse(childRule, pos) {
|
|
2097
|
-
if ((isCSSGroupingRuleSupported &&
|
|
2098
|
-
childRule.parentRule instanceof CSSGroupingRule) ||
|
|
2099
|
-
(isCSSMediaRuleSupported &&
|
|
2100
|
-
childRule.parentRule instanceof CSSMediaRule) ||
|
|
2101
|
-
(isCSSSupportsRuleSupported &&
|
|
2102
|
-
childRule.parentRule instanceof CSSSupportsRule) ||
|
|
2103
|
-
(isCSSConditionRuleSupported &&
|
|
2104
|
-
childRule.parentRule instanceof CSSConditionRule)) {
|
|
2105
|
-
var rules = Array.from(childRule.parentRule.cssRules);
|
|
2106
|
-
var index = rules.indexOf(childRule);
|
|
2107
|
-
pos.unshift(index);
|
|
2108
|
-
}
|
|
2109
|
-
else {
|
|
2110
|
-
var rules = Array.from(childRule.parentStyleSheet.cssRules);
|
|
2111
|
-
var index = rules.indexOf(childRule);
|
|
2112
|
-
pos.unshift(index);
|
|
2113
|
-
}
|
|
2114
|
-
return pos;
|
|
2115
|
-
}
|
|
2116
|
-
return recurse(rule, positions);
|
|
2117
|
-
}
|
|
2118
|
-
function initStyleSheetObserver(_a, _b) {
|
|
2119
|
-
var styleSheetRuleCb = _a.styleSheetRuleCb, mirror = _a.mirror;
|
|
2120
|
-
var win = _b.win;
|
|
2121
|
-
var insertRule = win.CSSStyleSheet.prototype.insertRule;
|
|
2122
|
-
win.CSSStyleSheet.prototype.insertRule = function (rule, index) {
|
|
2123
|
-
var id = mirror.getId(this.ownerNode);
|
|
2124
|
-
if (id !== -1) {
|
|
2125
|
-
styleSheetRuleCb({
|
|
2126
|
-
id: id,
|
|
2127
|
-
adds: [{ rule: rule, index: index }],
|
|
2128
|
-
});
|
|
2129
|
-
}
|
|
2130
|
-
return insertRule.apply(this, arguments);
|
|
2131
|
-
};
|
|
2132
|
-
var deleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
2133
|
-
win.CSSStyleSheet.prototype.deleteRule = function (index) {
|
|
2134
|
-
var id = mirror.getId(this.ownerNode);
|
|
2135
|
-
if (id !== -1) {
|
|
2136
|
-
styleSheetRuleCb({
|
|
2137
|
-
id: id,
|
|
2138
|
-
removes: [{ index: index }],
|
|
2139
|
-
});
|
|
2140
|
-
}
|
|
2141
|
-
return deleteRule.apply(this, arguments);
|
|
2142
|
-
};
|
|
2143
|
-
var supportedNestedCSSRuleTypes = {};
|
|
2144
|
-
if (isCSSGroupingRuleSupported) {
|
|
2145
|
-
supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;
|
|
2146
|
-
}
|
|
2147
|
-
else {
|
|
2148
|
-
if (isCSSMediaRuleSupported) {
|
|
2149
|
-
supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;
|
|
2150
|
-
}
|
|
2151
|
-
if (isCSSConditionRuleSupported) {
|
|
2152
|
-
supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;
|
|
2153
|
-
}
|
|
2154
|
-
if (isCSSSupportsRuleSupported) {
|
|
2155
|
-
supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
var unmodifiedFunctions = {};
|
|
2159
|
-
Object.entries(supportedNestedCSSRuleTypes).forEach(function (_a) {
|
|
2160
|
-
var _b = __read(_a, 2), typeKey = _b[0], type = _b[1];
|
|
2161
|
-
unmodifiedFunctions[typeKey] = {
|
|
2162
|
-
insertRule: type.prototype.insertRule,
|
|
2163
|
-
deleteRule: type.prototype.deleteRule,
|
|
2164
|
-
};
|
|
2165
|
-
type.prototype.insertRule = function (rule, index) {
|
|
2166
|
-
var id = mirror.getId(this.parentStyleSheet.ownerNode);
|
|
2167
|
-
if (id !== -1) {
|
|
2168
|
-
styleSheetRuleCb({
|
|
2169
|
-
id: id,
|
|
2170
|
-
adds: [
|
|
2171
|
-
{
|
|
2172
|
-
rule: rule,
|
|
2173
|
-
index: __spreadArray(__spreadArray([], __read(getNestedCSSRulePositions(this)), false), [
|
|
2174
|
-
index || 0,
|
|
2175
|
-
], false),
|
|
2176
|
-
},
|
|
2177
|
-
],
|
|
2178
|
-
});
|
|
2179
|
-
}
|
|
2180
|
-
return unmodifiedFunctions[typeKey].insertRule.apply(this, arguments);
|
|
2181
|
-
};
|
|
2182
|
-
type.prototype.deleteRule = function (index) {
|
|
2183
|
-
var id = mirror.getId(this.parentStyleSheet.ownerNode);
|
|
2184
|
-
if (id !== -1) {
|
|
2185
|
-
styleSheetRuleCb({
|
|
2186
|
-
id: id,
|
|
2187
|
-
removes: [{ index: __spreadArray(__spreadArray([], __read(getNestedCSSRulePositions(this)), false), [index], false) }],
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
return unmodifiedFunctions[typeKey].deleteRule.apply(this, arguments);
|
|
2191
|
-
};
|
|
2192
|
-
});
|
|
2193
|
-
return function () {
|
|
2194
|
-
win.CSSStyleSheet.prototype.insertRule = insertRule;
|
|
2195
|
-
win.CSSStyleSheet.prototype.deleteRule = deleteRule;
|
|
2196
|
-
Object.entries(supportedNestedCSSRuleTypes).forEach(function (_a) {
|
|
2197
|
-
var _b = __read(_a, 2), typeKey = _b[0], type = _b[1];
|
|
2198
|
-
type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
|
|
2199
|
-
type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
|
|
2200
|
-
});
|
|
2201
|
-
};
|
|
2202
|
-
}
|
|
2203
|
-
function initStyleDeclarationObserver(_a, _b) {
|
|
2204
|
-
var styleDeclarationCb = _a.styleDeclarationCb, mirror = _a.mirror;
|
|
2205
|
-
var win = _b.win;
|
|
2206
|
-
var setProperty = win.CSSStyleDeclaration.prototype.setProperty;
|
|
2207
|
-
win.CSSStyleDeclaration.prototype.setProperty = function (property, value, priority) {
|
|
2208
|
-
var _a, _b;
|
|
2209
|
-
var id = mirror.getId((_b = (_a = this.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet) === null || _b === void 0 ? void 0 : _b.ownerNode);
|
|
2210
|
-
if (id !== -1) {
|
|
2211
|
-
styleDeclarationCb({
|
|
2212
|
-
id: id,
|
|
2213
|
-
set: {
|
|
2214
|
-
property: property,
|
|
2215
|
-
value: value,
|
|
2216
|
-
priority: priority,
|
|
2217
|
-
},
|
|
2218
|
-
index: getNestedCSSRulePositions(this.parentRule),
|
|
2219
|
-
});
|
|
2220
|
-
}
|
|
2221
|
-
return setProperty.apply(this, arguments);
|
|
2222
|
-
};
|
|
2223
|
-
var removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
2224
|
-
win.CSSStyleDeclaration.prototype.removeProperty = function (property) {
|
|
2225
|
-
var _a, _b;
|
|
2226
|
-
var id = mirror.getId((_b = (_a = this.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet) === null || _b === void 0 ? void 0 : _b.ownerNode);
|
|
2227
|
-
if (id !== -1) {
|
|
2228
|
-
styleDeclarationCb({
|
|
2229
|
-
id: id,
|
|
2230
|
-
remove: {
|
|
2231
|
-
property: property,
|
|
2232
|
-
},
|
|
2233
|
-
index: getNestedCSSRulePositions(this.parentRule),
|
|
2234
|
-
});
|
|
2235
|
-
}
|
|
2236
|
-
return removeProperty.apply(this, arguments);
|
|
2237
|
-
};
|
|
2238
|
-
return function () {
|
|
2239
|
-
win.CSSStyleDeclaration.prototype.setProperty = setProperty;
|
|
2240
|
-
win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
|
|
2241
|
-
};
|
|
2242
|
-
}
|
|
2243
|
-
function initMediaInteractionObserver(_a) {
|
|
2244
|
-
var mediaInteractionCb = _a.mediaInteractionCb, blockClass = _a.blockClass, mirror = _a.mirror, sampling = _a.sampling;
|
|
2245
|
-
var handler = function (type) {
|
|
2246
|
-
return throttle(function (event) {
|
|
2247
|
-
var target = getEventTarget(event);
|
|
2248
|
-
if (!target || isBlocked(target, blockClass)) {
|
|
2249
|
-
return;
|
|
2250
|
-
}
|
|
2251
|
-
var _a = target, currentTime = _a.currentTime, volume = _a.volume, muted = _a.muted;
|
|
2252
|
-
mediaInteractionCb({
|
|
2253
|
-
type: type,
|
|
2254
|
-
id: mirror.getId(target),
|
|
2255
|
-
currentTime: currentTime,
|
|
2256
|
-
volume: volume,
|
|
2257
|
-
muted: muted,
|
|
2258
|
-
});
|
|
2259
|
-
}, sampling.media || 500);
|
|
2260
|
-
};
|
|
2261
|
-
var handlers = [
|
|
2262
|
-
on('play', handler(0)),
|
|
2263
|
-
on('pause', handler(1)),
|
|
2264
|
-
on('seeked', handler(2)),
|
|
2265
|
-
on('volumechange', handler(3)),
|
|
2266
|
-
];
|
|
2267
|
-
return function () {
|
|
2268
|
-
handlers.forEach(function (h) { return h(); });
|
|
2269
|
-
};
|
|
2270
|
-
}
|
|
2271
|
-
function initFontObserver(_a) {
|
|
2272
|
-
var fontCb = _a.fontCb, doc = _a.doc;
|
|
2273
|
-
var win = doc.defaultView;
|
|
2274
|
-
if (!win) {
|
|
2275
|
-
return function () { };
|
|
2276
|
-
}
|
|
2277
|
-
var handlers = [];
|
|
2278
|
-
var fontMap = new WeakMap();
|
|
2279
|
-
var originalFontFace = win.FontFace;
|
|
2280
|
-
win.FontFace = function FontFace(family, source, descriptors) {
|
|
2281
|
-
var fontFace = new originalFontFace(family, source, descriptors);
|
|
2282
|
-
fontMap.set(fontFace, {
|
|
2283
|
-
family: family,
|
|
2284
|
-
buffer: typeof source !== 'string',
|
|
2285
|
-
descriptors: descriptors,
|
|
2286
|
-
fontSource: typeof source === 'string'
|
|
2287
|
-
? source
|
|
2288
|
-
:
|
|
2289
|
-
JSON.stringify(Array.from(new Uint8Array(source))),
|
|
2290
|
-
});
|
|
2291
|
-
return fontFace;
|
|
2292
|
-
};
|
|
2293
|
-
var restoreHandler = patch(doc.fonts, 'add', function (original) {
|
|
2294
|
-
return function (fontFace) {
|
|
2295
|
-
setTimeout(function () {
|
|
2296
|
-
var p = fontMap.get(fontFace);
|
|
2297
|
-
if (p) {
|
|
2298
|
-
fontCb(p);
|
|
2299
|
-
fontMap.delete(fontFace);
|
|
2300
|
-
}
|
|
2301
|
-
}, 0);
|
|
2302
|
-
return original.apply(this, [fontFace]);
|
|
2303
|
-
};
|
|
2304
|
-
});
|
|
2305
|
-
handlers.push(function () {
|
|
2306
|
-
win.FontFace = originalFontFace;
|
|
2307
|
-
});
|
|
2308
|
-
handlers.push(restoreHandler);
|
|
2309
|
-
return function () {
|
|
2310
|
-
handlers.forEach(function (h) { return h(); });
|
|
2311
|
-
};
|
|
2312
|
-
}
|
|
2313
|
-
function mergeHooks(o, hooks) {
|
|
2314
|
-
var mutationCb = o.mutationCb, mousemoveCb = o.mousemoveCb, mouseInteractionCb = o.mouseInteractionCb, scrollCb = o.scrollCb, viewportResizeCb = o.viewportResizeCb, inputCb = o.inputCb, mediaInteractionCb = o.mediaInteractionCb, styleSheetRuleCb = o.styleSheetRuleCb, styleDeclarationCb = o.styleDeclarationCb, canvasMutationCb = o.canvasMutationCb, fontCb = o.fontCb;
|
|
2315
|
-
o.mutationCb = function () {
|
|
2316
|
-
var p = [];
|
|
2317
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2318
|
-
p[_i] = arguments[_i];
|
|
2319
|
-
}
|
|
2320
|
-
if (hooks.mutation) {
|
|
2321
|
-
hooks.mutation.apply(hooks, __spreadArray([], __read(p), false));
|
|
2322
|
-
}
|
|
2323
|
-
mutationCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2324
|
-
};
|
|
2325
|
-
o.mousemoveCb = function () {
|
|
2326
|
-
var p = [];
|
|
2327
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2328
|
-
p[_i] = arguments[_i];
|
|
2329
|
-
}
|
|
2330
|
-
if (hooks.mousemove) {
|
|
2331
|
-
hooks.mousemove.apply(hooks, __spreadArray([], __read(p), false));
|
|
2332
|
-
}
|
|
2333
|
-
mousemoveCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2334
|
-
};
|
|
2335
|
-
o.mouseInteractionCb = function () {
|
|
2336
|
-
var p = [];
|
|
2337
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2338
|
-
p[_i] = arguments[_i];
|
|
2339
|
-
}
|
|
2340
|
-
if (hooks.mouseInteraction) {
|
|
2341
|
-
hooks.mouseInteraction.apply(hooks, __spreadArray([], __read(p), false));
|
|
2342
|
-
}
|
|
2343
|
-
mouseInteractionCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2344
|
-
};
|
|
2345
|
-
o.scrollCb = function () {
|
|
2346
|
-
var p = [];
|
|
2347
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2348
|
-
p[_i] = arguments[_i];
|
|
2349
|
-
}
|
|
2350
|
-
if (hooks.scroll) {
|
|
2351
|
-
hooks.scroll.apply(hooks, __spreadArray([], __read(p), false));
|
|
2352
|
-
}
|
|
2353
|
-
scrollCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2354
|
-
};
|
|
2355
|
-
o.viewportResizeCb = function () {
|
|
2356
|
-
var p = [];
|
|
2357
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2358
|
-
p[_i] = arguments[_i];
|
|
2359
|
-
}
|
|
2360
|
-
if (hooks.viewportResize) {
|
|
2361
|
-
hooks.viewportResize.apply(hooks, __spreadArray([], __read(p), false));
|
|
2362
|
-
}
|
|
2363
|
-
viewportResizeCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2364
|
-
};
|
|
2365
|
-
o.inputCb = function () {
|
|
2366
|
-
var p = [];
|
|
2367
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2368
|
-
p[_i] = arguments[_i];
|
|
2369
|
-
}
|
|
2370
|
-
if (hooks.input) {
|
|
2371
|
-
hooks.input.apply(hooks, __spreadArray([], __read(p), false));
|
|
2372
|
-
}
|
|
2373
|
-
inputCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2374
|
-
};
|
|
2375
|
-
o.mediaInteractionCb = function () {
|
|
2376
|
-
var p = [];
|
|
2377
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2378
|
-
p[_i] = arguments[_i];
|
|
2379
|
-
}
|
|
2380
|
-
if (hooks.mediaInteaction) {
|
|
2381
|
-
hooks.mediaInteaction.apply(hooks, __spreadArray([], __read(p), false));
|
|
2382
|
-
}
|
|
2383
|
-
mediaInteractionCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2384
|
-
};
|
|
2385
|
-
o.styleSheetRuleCb = function () {
|
|
2386
|
-
var p = [];
|
|
2387
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2388
|
-
p[_i] = arguments[_i];
|
|
2389
|
-
}
|
|
2390
|
-
if (hooks.styleSheetRule) {
|
|
2391
|
-
hooks.styleSheetRule.apply(hooks, __spreadArray([], __read(p), false));
|
|
2392
|
-
}
|
|
2393
|
-
styleSheetRuleCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2394
|
-
};
|
|
2395
|
-
o.styleDeclarationCb = function () {
|
|
2396
|
-
var p = [];
|
|
2397
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2398
|
-
p[_i] = arguments[_i];
|
|
2399
|
-
}
|
|
2400
|
-
if (hooks.styleDeclaration) {
|
|
2401
|
-
hooks.styleDeclaration.apply(hooks, __spreadArray([], __read(p), false));
|
|
2402
|
-
}
|
|
2403
|
-
styleDeclarationCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2404
|
-
};
|
|
2405
|
-
o.canvasMutationCb = function () {
|
|
2406
|
-
var p = [];
|
|
2407
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2408
|
-
p[_i] = arguments[_i];
|
|
2409
|
-
}
|
|
2410
|
-
if (hooks.canvasMutation) {
|
|
2411
|
-
hooks.canvasMutation.apply(hooks, __spreadArray([], __read(p), false));
|
|
2412
|
-
}
|
|
2413
|
-
canvasMutationCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2414
|
-
};
|
|
2415
|
-
o.fontCb = function () {
|
|
2416
|
-
var p = [];
|
|
2417
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2418
|
-
p[_i] = arguments[_i];
|
|
2419
|
-
}
|
|
2420
|
-
if (hooks.font) {
|
|
2421
|
-
hooks.font.apply(hooks, __spreadArray([], __read(p), false));
|
|
2422
|
-
}
|
|
2423
|
-
fontCb.apply(void 0, __spreadArray([], __read(p), false));
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2426
|
-
function initObservers(o, hooks) {
|
|
2427
|
-
var e_1, _a;
|
|
2428
|
-
if (hooks === void 0) { hooks = {}; }
|
|
2429
|
-
var currentWindow = o.doc.defaultView;
|
|
2430
|
-
if (!currentWindow) {
|
|
2431
|
-
return function () { };
|
|
2432
|
-
}
|
|
2433
|
-
mergeHooks(o, hooks);
|
|
2434
|
-
var mutationObserver = initMutationObserver(o, o.doc);
|
|
2435
|
-
var mousemoveHandler = initMoveObserver(o);
|
|
2436
|
-
var mouseInteractionHandler = initMouseInteractionObserver(o);
|
|
2437
|
-
var scrollHandler = initScrollObserver(o);
|
|
2438
|
-
var viewportResizeHandler = initViewportResizeObserver(o);
|
|
2439
|
-
var inputHandler = initInputObserver(o);
|
|
2440
|
-
var mediaInteractionHandler = initMediaInteractionObserver(o);
|
|
2441
|
-
var styleSheetObserver = initStyleSheetObserver(o, { win: currentWindow });
|
|
2442
|
-
var styleDeclarationObserver = initStyleDeclarationObserver(o, {
|
|
2443
|
-
win: currentWindow,
|
|
2444
|
-
});
|
|
2445
|
-
var fontObserver = o.collectFonts ? initFontObserver(o) : function () { };
|
|
2446
|
-
var pluginHandlers = [];
|
|
2447
|
-
try {
|
|
2448
|
-
for (var _b = __values(o.plugins), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2449
|
-
var plugin = _c.value;
|
|
2450
|
-
pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2454
|
-
finally {
|
|
2455
|
-
try {
|
|
2456
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2457
|
-
}
|
|
2458
|
-
finally { if (e_1) throw e_1.error; }
|
|
2459
|
-
}
|
|
2460
|
-
return function () {
|
|
2461
|
-
mutationBuffers.forEach(function (b) { return b.reset(); });
|
|
2462
|
-
mutationObserver.disconnect();
|
|
2463
|
-
mousemoveHandler();
|
|
2464
|
-
mouseInteractionHandler();
|
|
2465
|
-
scrollHandler();
|
|
2466
|
-
viewportResizeHandler();
|
|
2467
|
-
inputHandler();
|
|
2468
|
-
mediaInteractionHandler();
|
|
2469
|
-
styleSheetObserver();
|
|
2470
|
-
styleDeclarationObserver();
|
|
2471
|
-
fontObserver();
|
|
2472
|
-
pluginHandlers.forEach(function (h) { return h(); });
|
|
2473
|
-
};
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
var IframeManager = (function () {
|
|
2477
|
-
function IframeManager(options) {
|
|
2478
|
-
this.iframes = new WeakMap();
|
|
2479
|
-
this.mutationCb = options.mutationCb;
|
|
2480
|
-
}
|
|
2481
|
-
IframeManager.prototype.addIframe = function (iframeEl) {
|
|
2482
|
-
this.iframes.set(iframeEl, true);
|
|
2483
|
-
};
|
|
2484
|
-
IframeManager.prototype.addLoadListener = function (cb) {
|
|
2485
|
-
this.loadListener = cb;
|
|
2486
|
-
};
|
|
2487
|
-
IframeManager.prototype.attachIframe = function (iframeEl, childSn) {
|
|
2488
|
-
var _a;
|
|
2489
|
-
this.mutationCb({
|
|
2490
|
-
adds: [
|
|
2491
|
-
{
|
|
2492
|
-
parentId: iframeEl.__sn.id,
|
|
2493
|
-
nextId: null,
|
|
2494
|
-
node: childSn,
|
|
2495
|
-
},
|
|
2496
|
-
],
|
|
2497
|
-
removes: [],
|
|
2498
|
-
texts: [],
|
|
2499
|
-
attributes: [],
|
|
2500
|
-
isAttachIframe: true,
|
|
2501
|
-
});
|
|
2502
|
-
(_a = this.loadListener) === null || _a === void 0 ? void 0 : _a.call(this, iframeEl);
|
|
2503
|
-
};
|
|
2504
|
-
return IframeManager;
|
|
2505
|
-
}());
|
|
2506
|
-
|
|
2507
|
-
var ShadowDomManager = (function () {
|
|
2508
|
-
function ShadowDomManager(options) {
|
|
2509
|
-
this.restorePatches = [];
|
|
2510
|
-
this.mutationCb = options.mutationCb;
|
|
2511
|
-
this.scrollCb = options.scrollCb;
|
|
2512
|
-
this.bypassOptions = options.bypassOptions;
|
|
2513
|
-
this.mirror = options.mirror;
|
|
2514
|
-
var manager = this;
|
|
2515
|
-
this.restorePatches.push(patch(HTMLElement.prototype, 'attachShadow', function (original) {
|
|
2516
|
-
return function () {
|
|
2517
|
-
var shadowRoot = original.apply(this, arguments);
|
|
2518
|
-
if (this.shadowRoot)
|
|
2519
|
-
manager.addShadowRoot(this.shadowRoot, this.ownerDocument);
|
|
2520
|
-
return shadowRoot;
|
|
2521
|
-
};
|
|
2522
|
-
}));
|
|
2523
|
-
}
|
|
2524
|
-
ShadowDomManager.prototype.addShadowRoot = function (shadowRoot, doc) {
|
|
2525
|
-
initMutationObserver(__assign(__assign({}, this.bypassOptions), { doc: doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
|
|
2526
|
-
initScrollObserver(__assign(__assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror }));
|
|
2527
|
-
};
|
|
2528
|
-
ShadowDomManager.prototype.observeAttachShadow = function (iframeElement) {
|
|
2529
|
-
if (iframeElement.contentWindow) {
|
|
2530
|
-
var manager_1 = this;
|
|
2531
|
-
this.restorePatches.push(patch(iframeElement.contentWindow.HTMLElement.prototype, 'attachShadow', function (original) {
|
|
2532
|
-
return function () {
|
|
2533
|
-
var shadowRoot = original.apply(this, arguments);
|
|
2534
|
-
if (this.shadowRoot)
|
|
2535
|
-
manager_1.addShadowRoot(this.shadowRoot, iframeElement.contentDocument);
|
|
2536
|
-
return shadowRoot;
|
|
2537
|
-
};
|
|
2538
|
-
}));
|
|
2539
|
-
}
|
|
2540
|
-
};
|
|
2541
|
-
ShadowDomManager.prototype.reset = function () {
|
|
2542
|
-
this.restorePatches.forEach(function (restorePatch) { return restorePatch(); });
|
|
2543
|
-
};
|
|
2544
|
-
return ShadowDomManager;
|
|
2545
|
-
}());
|
|
2546
|
-
|
|
2547
|
-
function initCanvas2DMutationObserver(cb, win, blockClass, mirror) {
|
|
2548
|
-
var e_1, _a;
|
|
2549
|
-
var handlers = [];
|
|
2550
|
-
var props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
|
|
2551
|
-
var _loop_1 = function (prop) {
|
|
2552
|
-
try {
|
|
2553
|
-
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== 'function') {
|
|
2554
|
-
return "continue";
|
|
2555
|
-
}
|
|
2556
|
-
var restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function (original) {
|
|
2557
|
-
return function () {
|
|
2558
|
-
var _this = this;
|
|
2559
|
-
var args = [];
|
|
2560
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2561
|
-
args[_i] = arguments[_i];
|
|
2562
|
-
}
|
|
2563
|
-
if (!isBlocked(this.canvas, blockClass)) {
|
|
2564
|
-
setTimeout(function () {
|
|
2565
|
-
var recordArgs = __spreadArray([], __read(args), false);
|
|
2566
|
-
if (prop === 'drawImage') {
|
|
2567
|
-
if (recordArgs[0] &&
|
|
2568
|
-
recordArgs[0] instanceof HTMLCanvasElement) {
|
|
2569
|
-
var canvas = recordArgs[0];
|
|
2570
|
-
var ctx = canvas.getContext('2d');
|
|
2571
|
-
var imgd = ctx === null || ctx === void 0 ? void 0 : ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
2572
|
-
var pix = imgd === null || imgd === void 0 ? void 0 : imgd.data;
|
|
2573
|
-
recordArgs[0] = JSON.stringify(pix);
|
|
2574
|
-
}
|
|
2575
|
-
}
|
|
2576
|
-
cb(_this.canvas, {
|
|
2577
|
-
type: CanvasContext['2D'],
|
|
2578
|
-
property: prop,
|
|
2579
|
-
args: recordArgs,
|
|
2580
|
-
});
|
|
2581
|
-
}, 0);
|
|
2582
|
-
}
|
|
2583
|
-
return original.apply(this, args);
|
|
2584
|
-
};
|
|
2585
|
-
});
|
|
2586
|
-
handlers.push(restoreHandler);
|
|
2587
|
-
}
|
|
2588
|
-
catch (_b) {
|
|
2589
|
-
var hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop, {
|
|
2590
|
-
set: function (v) {
|
|
2591
|
-
cb(this.canvas, {
|
|
2592
|
-
type: CanvasContext['2D'],
|
|
2593
|
-
property: prop,
|
|
2594
|
-
args: [v],
|
|
2595
|
-
setter: true,
|
|
2596
|
-
});
|
|
2597
|
-
},
|
|
2598
|
-
});
|
|
2599
|
-
handlers.push(hookHandler);
|
|
2600
|
-
}
|
|
2601
|
-
};
|
|
2602
|
-
try {
|
|
2603
|
-
for (var props2D_1 = __values(props2D), props2D_1_1 = props2D_1.next(); !props2D_1_1.done; props2D_1_1 = props2D_1.next()) {
|
|
2604
|
-
var prop = props2D_1_1.value;
|
|
2605
|
-
_loop_1(prop);
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2609
|
-
finally {
|
|
2610
|
-
try {
|
|
2611
|
-
if (props2D_1_1 && !props2D_1_1.done && (_a = props2D_1.return)) _a.call(props2D_1);
|
|
2612
|
-
}
|
|
2613
|
-
finally { if (e_1) throw e_1.error; }
|
|
2614
|
-
}
|
|
2615
|
-
return function () {
|
|
2616
|
-
handlers.forEach(function (h) { return h(); });
|
|
2617
|
-
};
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
function initCanvasContextObserver(win, blockClass) {
|
|
2621
|
-
var handlers = [];
|
|
2622
|
-
try {
|
|
2623
|
-
var restoreHandler = patch(win.HTMLCanvasElement.prototype, 'getContext', function (original) {
|
|
2624
|
-
return function (contextType) {
|
|
2625
|
-
var args = [];
|
|
2626
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2627
|
-
args[_i - 1] = arguments[_i];
|
|
2628
|
-
}
|
|
2629
|
-
if (!isBlocked(this, blockClass)) {
|
|
2630
|
-
if (!('__context' in this))
|
|
2631
|
-
this.__context = contextType;
|
|
2632
|
-
}
|
|
2633
|
-
return original.apply(this, __spreadArray([contextType], __read(args), false));
|
|
2634
|
-
};
|
|
2635
|
-
});
|
|
2636
|
-
handlers.push(restoreHandler);
|
|
2637
|
-
}
|
|
2638
|
-
catch (_a) {
|
|
2639
|
-
console.error('failed to patch HTMLCanvasElement.prototype.getContext');
|
|
2640
|
-
}
|
|
2641
|
-
return function () {
|
|
2642
|
-
handlers.forEach(function (h) { return h(); });
|
|
2643
|
-
};
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
/*
|
|
2647
|
-
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
|
|
2648
|
-
* Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
|
|
2649
|
-
* Released under MIT License
|
|
2650
|
-
*/
|
|
2651
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2652
|
-
// Use a lookup table to find the index.
|
|
2653
|
-
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
|
2654
|
-
for (var i = 0; i < chars.length; i++) {
|
|
2655
|
-
lookup[chars.charCodeAt(i)] = i;
|
|
2656
|
-
}
|
|
2657
|
-
var encode = function (arraybuffer) {
|
|
2658
|
-
var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
|
|
2659
|
-
for (i = 0; i < len; i += 3) {
|
|
2660
|
-
base64 += chars[bytes[i] >> 2];
|
|
2661
|
-
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
2662
|
-
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
2663
|
-
base64 += chars[bytes[i + 2] & 63];
|
|
2664
|
-
}
|
|
2665
|
-
if (len % 3 === 2) {
|
|
2666
|
-
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
2667
|
-
}
|
|
2668
|
-
else if (len % 3 === 1) {
|
|
2669
|
-
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
2670
|
-
}
|
|
2671
|
-
return base64;
|
|
2672
|
-
};
|
|
2673
|
-
|
|
2674
|
-
var webGLVarMap = new Map();
|
|
2675
|
-
function variableListFor(ctx, ctor) {
|
|
2676
|
-
var contextMap = webGLVarMap.get(ctx);
|
|
2677
|
-
if (!contextMap) {
|
|
2678
|
-
contextMap = new Map();
|
|
2679
|
-
webGLVarMap.set(ctx, contextMap);
|
|
2680
|
-
}
|
|
2681
|
-
if (!contextMap.has(ctor)) {
|
|
2682
|
-
contextMap.set(ctor, []);
|
|
2683
|
-
}
|
|
2684
|
-
return contextMap.get(ctor);
|
|
2685
|
-
}
|
|
2686
|
-
var saveWebGLVar = function (value, win, ctx) {
|
|
2687
|
-
if (!value ||
|
|
2688
|
-
!(isInstanceOfWebGLObject(value, win) || typeof value === 'object'))
|
|
2689
|
-
return;
|
|
2690
|
-
var name = value.constructor.name;
|
|
2691
|
-
var list = variableListFor(ctx, name);
|
|
2692
|
-
var index = list.indexOf(value);
|
|
2693
|
-
if (index === -1) {
|
|
2694
|
-
index = list.length;
|
|
2695
|
-
list.push(value);
|
|
2696
|
-
}
|
|
2697
|
-
return index;
|
|
2698
|
-
};
|
|
2699
|
-
function serializeArg(value, win, ctx) {
|
|
2700
|
-
if (value instanceof Array) {
|
|
2701
|
-
return value.map(function (arg) { return serializeArg(arg, win, ctx); });
|
|
2702
|
-
}
|
|
2703
|
-
else if (value === null) {
|
|
2704
|
-
return value;
|
|
2705
|
-
}
|
|
2706
|
-
else if (value instanceof Float32Array ||
|
|
2707
|
-
value instanceof Float64Array ||
|
|
2708
|
-
value instanceof Int32Array ||
|
|
2709
|
-
value instanceof Uint32Array ||
|
|
2710
|
-
value instanceof Uint8Array ||
|
|
2711
|
-
value instanceof Uint16Array ||
|
|
2712
|
-
value instanceof Int16Array ||
|
|
2713
|
-
value instanceof Int8Array ||
|
|
2714
|
-
value instanceof Uint8ClampedArray) {
|
|
2715
|
-
var name_1 = value.constructor.name;
|
|
2716
|
-
return {
|
|
2717
|
-
rr_type: name_1,
|
|
2718
|
-
args: [Object.values(value)],
|
|
2719
|
-
};
|
|
2720
|
-
}
|
|
2721
|
-
else if (value instanceof ArrayBuffer) {
|
|
2722
|
-
var name_2 = value.constructor.name;
|
|
2723
|
-
var base64 = encode(value);
|
|
2724
|
-
return {
|
|
2725
|
-
rr_type: name_2,
|
|
2726
|
-
base64: base64,
|
|
2727
|
-
};
|
|
2728
|
-
}
|
|
2729
|
-
else if (value instanceof DataView) {
|
|
2730
|
-
var name_3 = value.constructor.name;
|
|
2731
|
-
return {
|
|
2732
|
-
rr_type: name_3,
|
|
2733
|
-
args: [
|
|
2734
|
-
serializeArg(value.buffer, win, ctx),
|
|
2735
|
-
value.byteOffset,
|
|
2736
|
-
value.byteLength,
|
|
2737
|
-
],
|
|
2738
|
-
};
|
|
2739
|
-
}
|
|
2740
|
-
else if (value instanceof HTMLImageElement) {
|
|
2741
|
-
var name_4 = value.constructor.name;
|
|
2742
|
-
var src = value.src;
|
|
2743
|
-
return {
|
|
2744
|
-
rr_type: name_4,
|
|
2745
|
-
src: src,
|
|
2746
|
-
};
|
|
2747
|
-
}
|
|
2748
|
-
else if (value instanceof ImageData) {
|
|
2749
|
-
var name_5 = value.constructor.name;
|
|
2750
|
-
return {
|
|
2751
|
-
rr_type: name_5,
|
|
2752
|
-
args: [serializeArg(value.data, win, ctx), value.width, value.height],
|
|
2753
|
-
};
|
|
2754
|
-
}
|
|
2755
|
-
else if (isInstanceOfWebGLObject(value, win) || typeof value === 'object') {
|
|
2756
|
-
var name_6 = value.constructor.name;
|
|
2757
|
-
var index = saveWebGLVar(value, win, ctx);
|
|
2758
|
-
return {
|
|
2759
|
-
rr_type: name_6,
|
|
2760
|
-
index: index,
|
|
2761
|
-
};
|
|
2762
|
-
}
|
|
2763
|
-
return value;
|
|
2764
|
-
}
|
|
2765
|
-
var serializeArgs = function (args, win, ctx) {
|
|
2766
|
-
return __spreadArray([], __read(args), false).map(function (arg) { return serializeArg(arg, win, ctx); });
|
|
2767
|
-
};
|
|
2768
|
-
var isInstanceOfWebGLObject = function (value, win) {
|
|
2769
|
-
var webGLConstructorNames = [
|
|
2770
|
-
'WebGLActiveInfo',
|
|
2771
|
-
'WebGLBuffer',
|
|
2772
|
-
'WebGLFramebuffer',
|
|
2773
|
-
'WebGLProgram',
|
|
2774
|
-
'WebGLRenderbuffer',
|
|
2775
|
-
'WebGLShader',
|
|
2776
|
-
'WebGLShaderPrecisionFormat',
|
|
2777
|
-
'WebGLTexture',
|
|
2778
|
-
'WebGLUniformLocation',
|
|
2779
|
-
'WebGLVertexArrayObject',
|
|
2780
|
-
'WebGLVertexArrayObjectOES',
|
|
2781
|
-
];
|
|
2782
|
-
var supportedWebGLConstructorNames = webGLConstructorNames.filter(function (name) { return typeof win[name] === 'function'; });
|
|
2783
|
-
return Boolean(supportedWebGLConstructorNames.find(function (name) { return value instanceof win[name]; }));
|
|
2784
|
-
};
|
|
2785
|
-
|
|
2786
|
-
function patchGLPrototype(prototype, type, cb, blockClass, mirror, win) {
|
|
2787
|
-
var e_1, _a;
|
|
2788
|
-
var handlers = [];
|
|
2789
|
-
var props = Object.getOwnPropertyNames(prototype);
|
|
2790
|
-
var _loop_1 = function (prop) {
|
|
2791
|
-
try {
|
|
2792
|
-
if (typeof prototype[prop] !== 'function') {
|
|
2793
|
-
return "continue";
|
|
2794
|
-
}
|
|
2795
|
-
var restoreHandler = patch(prototype, prop, function (original) {
|
|
2796
|
-
return function () {
|
|
2797
|
-
var args = [];
|
|
2798
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2799
|
-
args[_i] = arguments[_i];
|
|
2800
|
-
}
|
|
2801
|
-
var result = original.apply(this, args);
|
|
2802
|
-
saveWebGLVar(result, win, prototype);
|
|
2803
|
-
if (!isBlocked(this.canvas, blockClass)) {
|
|
2804
|
-
var id = mirror.getId(this.canvas);
|
|
2805
|
-
var recordArgs = serializeArgs(__spreadArray([], __read(args), false), win, prototype);
|
|
2806
|
-
var mutation = {
|
|
2807
|
-
type: type,
|
|
2808
|
-
property: prop,
|
|
2809
|
-
args: recordArgs,
|
|
2810
|
-
};
|
|
2811
|
-
cb(this.canvas, mutation);
|
|
2812
|
-
}
|
|
2813
|
-
return result;
|
|
2814
|
-
};
|
|
2815
|
-
});
|
|
2816
|
-
handlers.push(restoreHandler);
|
|
2817
|
-
}
|
|
2818
|
-
catch (_b) {
|
|
2819
|
-
var hookHandler = hookSetter(prototype, prop, {
|
|
2820
|
-
set: function (v) {
|
|
2821
|
-
cb(this.canvas, {
|
|
2822
|
-
type: type,
|
|
2823
|
-
property: prop,
|
|
2824
|
-
args: [v],
|
|
2825
|
-
setter: true,
|
|
2826
|
-
});
|
|
2827
|
-
},
|
|
2828
|
-
});
|
|
2829
|
-
handlers.push(hookHandler);
|
|
2830
|
-
}
|
|
2831
|
-
};
|
|
2832
|
-
try {
|
|
2833
|
-
for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
|
|
2834
|
-
var prop = props_1_1.value;
|
|
2835
|
-
_loop_1(prop);
|
|
2836
|
-
}
|
|
2837
|
-
}
|
|
2838
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2839
|
-
finally {
|
|
2840
|
-
try {
|
|
2841
|
-
if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
|
|
2842
|
-
}
|
|
2843
|
-
finally { if (e_1) throw e_1.error; }
|
|
2844
|
-
}
|
|
2845
|
-
return handlers;
|
|
2846
|
-
}
|
|
2847
|
-
function initCanvasWebGLMutationObserver(cb, win, blockClass, mirror) {
|
|
2848
|
-
var handlers = [];
|
|
2849
|
-
handlers.push.apply(handlers, __spreadArray([], __read(patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, mirror, win)), false));
|
|
2850
|
-
if (typeof win.WebGL2RenderingContext !== 'undefined') {
|
|
2851
|
-
handlers.push.apply(handlers, __spreadArray([], __read(patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, mirror, win)), false));
|
|
2852
|
-
}
|
|
2853
|
-
return function () {
|
|
2854
|
-
handlers.forEach(function (h) { return h(); });
|
|
2855
|
-
};
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
var CanvasManager = (function () {
|
|
2859
|
-
function CanvasManager(options) {
|
|
2860
|
-
this.pendingCanvasMutations = new Map();
|
|
2861
|
-
this.rafStamps = { latestId: 0, invokeId: null };
|
|
2862
|
-
this.frozen = false;
|
|
2863
|
-
this.locked = false;
|
|
2864
|
-
this.processMutation = function (target, mutation) {
|
|
2865
|
-
var newFrame = this.rafStamps.invokeId &&
|
|
2866
|
-
this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
2867
|
-
if (newFrame || !this.rafStamps.invokeId)
|
|
2868
|
-
this.rafStamps.invokeId = this.rafStamps.latestId;
|
|
2869
|
-
if (!this.pendingCanvasMutations.has(target)) {
|
|
2870
|
-
this.pendingCanvasMutations.set(target, []);
|
|
2871
|
-
}
|
|
2872
|
-
this.pendingCanvasMutations.get(target).push(mutation);
|
|
2873
|
-
};
|
|
2874
|
-
this.mutationCb = options.mutationCb;
|
|
2875
|
-
this.mirror = options.mirror;
|
|
2876
|
-
if (options.recordCanvas === true)
|
|
2877
|
-
this.initCanvasMutationObserver(options.win, options.blockClass);
|
|
2878
|
-
}
|
|
2879
|
-
CanvasManager.prototype.reset = function () {
|
|
2880
|
-
this.pendingCanvasMutations.clear();
|
|
2881
|
-
this.resetObservers && this.resetObservers();
|
|
2882
|
-
};
|
|
2883
|
-
CanvasManager.prototype.freeze = function () {
|
|
2884
|
-
this.frozen = true;
|
|
2885
|
-
};
|
|
2886
|
-
CanvasManager.prototype.unfreeze = function () {
|
|
2887
|
-
this.frozen = false;
|
|
2888
|
-
};
|
|
2889
|
-
CanvasManager.prototype.lock = function () {
|
|
2890
|
-
this.locked = true;
|
|
2891
|
-
};
|
|
2892
|
-
CanvasManager.prototype.unlock = function () {
|
|
2893
|
-
this.locked = false;
|
|
2894
|
-
};
|
|
2895
|
-
CanvasManager.prototype.initCanvasMutationObserver = function (win, blockClass) {
|
|
2896
|
-
this.startRAFTimestamping();
|
|
2897
|
-
this.startPendingCanvasMutationFlusher();
|
|
2898
|
-
var canvasContextReset = initCanvasContextObserver(win, blockClass);
|
|
2899
|
-
var canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, this.mirror);
|
|
2900
|
-
var canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, this.mirror);
|
|
2901
|
-
this.resetObservers = function () {
|
|
2902
|
-
canvasContextReset();
|
|
2903
|
-
canvas2DReset();
|
|
2904
|
-
canvasWebGL1and2Reset();
|
|
2905
|
-
};
|
|
2906
|
-
};
|
|
2907
|
-
CanvasManager.prototype.startPendingCanvasMutationFlusher = function () {
|
|
2908
|
-
var _this = this;
|
|
2909
|
-
requestAnimationFrame(function () { return _this.flushPendingCanvasMutations(); });
|
|
2910
|
-
};
|
|
2911
|
-
CanvasManager.prototype.startRAFTimestamping = function () {
|
|
2912
|
-
var _this = this;
|
|
2913
|
-
var setLatestRAFTimestamp = function (timestamp) {
|
|
2914
|
-
_this.rafStamps.latestId = timestamp;
|
|
2915
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
2916
|
-
};
|
|
2917
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
2918
|
-
};
|
|
2919
|
-
CanvasManager.prototype.flushPendingCanvasMutations = function () {
|
|
2920
|
-
var _this = this;
|
|
2921
|
-
this.pendingCanvasMutations.forEach(function (values, canvas) {
|
|
2922
|
-
var id = _this.mirror.getId(canvas);
|
|
2923
|
-
_this.flushPendingCanvasMutationFor(canvas, id);
|
|
2924
|
-
});
|
|
2925
|
-
requestAnimationFrame(function () { return _this.flushPendingCanvasMutations(); });
|
|
2926
|
-
};
|
|
2927
|
-
CanvasManager.prototype.flushPendingCanvasMutationFor = function (canvas, id) {
|
|
2928
|
-
if (this.frozen || this.locked) {
|
|
2929
|
-
return;
|
|
2930
|
-
}
|
|
2931
|
-
var valuesWithType = this.pendingCanvasMutations.get(canvas);
|
|
2932
|
-
if (!valuesWithType || id === -1)
|
|
2933
|
-
return;
|
|
2934
|
-
var values = valuesWithType.map(function (value) {
|
|
2935
|
-
value.type; var rest = __rest(value, ["type"]);
|
|
2936
|
-
return rest;
|
|
2937
|
-
});
|
|
2938
|
-
var type = valuesWithType[0].type;
|
|
2939
|
-
this.mutationCb({ id: id, type: type, commands: values });
|
|
2940
|
-
this.pendingCanvasMutations.delete(canvas);
|
|
2941
|
-
};
|
|
2942
|
-
return CanvasManager;
|
|
2943
|
-
}());
|
|
2944
|
-
|
|
2945
|
-
function wrapEvent(e) {
|
|
2946
|
-
return __assign(__assign({}, e), { timestamp: Date.now() });
|
|
2947
|
-
}
|
|
2948
|
-
var wrappedEmit;
|
|
2949
|
-
var takeFullSnapshot;
|
|
2950
|
-
var mirror = createMirror();
|
|
2951
|
-
function record(options) {
|
|
2952
|
-
if (options === void 0) { options = {}; }
|
|
2953
|
-
var emit = options.emit, checkoutEveryNms = options.checkoutEveryNms, checkoutEveryNth = options.checkoutEveryNth, _a = options.blockClass, blockClass = _a === void 0 ? 'highlight-block' : _a, _b = options.blockSelector, blockSelector = _b === void 0 ? null : _b, _c = options.ignoreClass, ignoreClass = _c === void 0 ? 'highlight-ignore' : _c, _d = options.maskTextClass, maskTextClass = _d === void 0 ? 'highlight-mask' : _d, _e = options.maskTextSelector, maskTextSelector = _e === void 0 ? null : _e, _f = options.inlineStylesheet, inlineStylesheet = _f === void 0 ? true : _f, maskAllInputs = options.maskAllInputs, _maskInputOptions = options.maskInputOptions, _slimDOMOptions = options.slimDOMOptions, maskInputFn = options.maskInputFn, maskTextFn = options.maskTextFn, hooks = options.hooks, packFn = options.packFn, _g = options.sampling, sampling = _g === void 0 ? {} : _g, mousemoveWait = options.mousemoveWait, _h = options.recordCanvas, recordCanvas = _h === void 0 ? false : _h, _j = options.userTriggeredOnInput, userTriggeredOnInput = _j === void 0 ? false : _j, _k = options.collectFonts, collectFonts = _k === void 0 ? false : _k, _l = options.inlineImages, inlineImages = _l === void 0 ? false : _l, plugins = options.plugins, _m = options.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function () { return false; } : _m, _o = options.enableStrictPrivacy, enableStrictPrivacy = _o === void 0 ? false : _o;
|
|
2954
|
-
if (!emit) {
|
|
2955
|
-
throw new Error('emit function is required');
|
|
2956
|
-
}
|
|
2957
|
-
if (mousemoveWait !== undefined && sampling.mousemove === undefined) {
|
|
2958
|
-
sampling.mousemove = mousemoveWait;
|
|
2959
|
-
}
|
|
2960
|
-
var maskInputOptions = maskAllInputs === true
|
|
2961
|
-
? {
|
|
2962
|
-
color: true,
|
|
2963
|
-
date: true,
|
|
2964
|
-
'datetime-local': true,
|
|
2965
|
-
email: true,
|
|
2966
|
-
month: true,
|
|
2967
|
-
number: true,
|
|
2968
|
-
range: true,
|
|
2969
|
-
search: true,
|
|
2970
|
-
tel: true,
|
|
2971
|
-
text: true,
|
|
2972
|
-
time: true,
|
|
2973
|
-
url: true,
|
|
2974
|
-
week: true,
|
|
2975
|
-
textarea: true,
|
|
2976
|
-
select: true,
|
|
2977
|
-
password: true,
|
|
2978
|
-
}
|
|
2979
|
-
: _maskInputOptions !== undefined
|
|
2980
|
-
? _maskInputOptions
|
|
2981
|
-
: { password: true };
|
|
2982
|
-
var slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === 'all'
|
|
2983
|
-
? {
|
|
2984
|
-
script: true,
|
|
2985
|
-
comment: true,
|
|
2986
|
-
headFavicon: true,
|
|
2987
|
-
headWhitespace: true,
|
|
2988
|
-
headMetaSocial: true,
|
|
2989
|
-
headMetaRobots: true,
|
|
2990
|
-
headMetaHttpEquiv: true,
|
|
2991
|
-
headMetaVerification: true,
|
|
2992
|
-
headMetaAuthorship: _slimDOMOptions === 'all',
|
|
2993
|
-
headMetaDescKeywords: _slimDOMOptions === 'all',
|
|
2994
|
-
}
|
|
2995
|
-
: _slimDOMOptions
|
|
2996
|
-
? _slimDOMOptions
|
|
2997
|
-
: {};
|
|
2998
|
-
polyfill();
|
|
2999
|
-
var lastFullSnapshotEvent;
|
|
3000
|
-
var incrementalSnapshotCount = 0;
|
|
3001
|
-
var eventProcessor = function (e) {
|
|
3002
|
-
var e_1, _a;
|
|
3003
|
-
try {
|
|
3004
|
-
for (var _b = __values(plugins || []), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3005
|
-
var plugin = _c.value;
|
|
3006
|
-
if (plugin.eventProcessor) {
|
|
3007
|
-
e = plugin.eventProcessor(e);
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
}
|
|
3011
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3012
|
-
finally {
|
|
3013
|
-
try {
|
|
3014
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3015
|
-
}
|
|
3016
|
-
finally { if (e_1) throw e_1.error; }
|
|
3017
|
-
}
|
|
3018
|
-
if (packFn) {
|
|
3019
|
-
e = packFn(e);
|
|
3020
|
-
}
|
|
3021
|
-
return e;
|
|
3022
|
-
};
|
|
3023
|
-
wrappedEmit = function (e, isCheckout) {
|
|
3024
|
-
var _a;
|
|
3025
|
-
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
3026
|
-
e.type !== EventType.FullSnapshot &&
|
|
3027
|
-
!(e.type === EventType.IncrementalSnapshot &&
|
|
3028
|
-
e.data.source === IncrementalSource.Mutation)) {
|
|
3029
|
-
mutationBuffers.forEach(function (buf) { return buf.unfreeze(); });
|
|
3030
|
-
}
|
|
3031
|
-
emit(eventProcessor(e), isCheckout);
|
|
3032
|
-
if (e.type === EventType.FullSnapshot) {
|
|
3033
|
-
lastFullSnapshotEvent = e;
|
|
3034
|
-
incrementalSnapshotCount = 0;
|
|
3035
|
-
}
|
|
3036
|
-
else if (e.type === EventType.IncrementalSnapshot) {
|
|
3037
|
-
if (e.data.source === IncrementalSource.Mutation &&
|
|
3038
|
-
e.data.isAttachIframe) {
|
|
3039
|
-
return;
|
|
3040
|
-
}
|
|
3041
|
-
incrementalSnapshotCount++;
|
|
3042
|
-
var exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
3043
|
-
var exceedTime = checkoutEveryNms &&
|
|
3044
|
-
e.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
3045
|
-
if (exceedCount || exceedTime) {
|
|
3046
|
-
takeFullSnapshot(true);
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
};
|
|
3050
|
-
var wrappedMutationEmit = function (m) {
|
|
3051
|
-
wrappedEmit(wrapEvent({
|
|
3052
|
-
type: EventType.IncrementalSnapshot,
|
|
3053
|
-
data: __assign({ source: IncrementalSource.Mutation }, m),
|
|
3054
|
-
}));
|
|
3055
|
-
};
|
|
3056
|
-
var wrappedScrollEmit = function (p) {
|
|
3057
|
-
return wrappedEmit(wrapEvent({
|
|
3058
|
-
type: EventType.IncrementalSnapshot,
|
|
3059
|
-
data: __assign({ source: IncrementalSource.Scroll }, p),
|
|
3060
|
-
}));
|
|
3061
|
-
};
|
|
3062
|
-
var wrappedCanvasMutationEmit = function (p) {
|
|
3063
|
-
return wrappedEmit(wrapEvent({
|
|
3064
|
-
type: EventType.IncrementalSnapshot,
|
|
3065
|
-
data: __assign({ source: IncrementalSource.CanvasMutation }, p),
|
|
3066
|
-
}));
|
|
3067
|
-
};
|
|
3068
|
-
var iframeManager = new IframeManager({
|
|
3069
|
-
mutationCb: wrappedMutationEmit,
|
|
3070
|
-
});
|
|
3071
|
-
var canvasManager = new CanvasManager({
|
|
3072
|
-
recordCanvas: recordCanvas,
|
|
3073
|
-
mutationCb: wrappedCanvasMutationEmit,
|
|
3074
|
-
win: window,
|
|
3075
|
-
blockClass: blockClass,
|
|
3076
|
-
mirror: mirror,
|
|
3077
|
-
});
|
|
3078
|
-
var shadowDomManager = new ShadowDomManager({
|
|
3079
|
-
mutationCb: wrappedMutationEmit,
|
|
3080
|
-
scrollCb: wrappedScrollEmit,
|
|
3081
|
-
bypassOptions: {
|
|
3082
|
-
blockClass: blockClass,
|
|
3083
|
-
blockSelector: blockSelector,
|
|
3084
|
-
maskTextClass: maskTextClass,
|
|
3085
|
-
maskTextSelector: maskTextSelector,
|
|
3086
|
-
inlineStylesheet: inlineStylesheet,
|
|
3087
|
-
maskInputOptions: maskInputOptions,
|
|
3088
|
-
maskTextFn: maskTextFn,
|
|
3089
|
-
maskInputFn: maskInputFn,
|
|
3090
|
-
recordCanvas: recordCanvas,
|
|
3091
|
-
inlineImages: inlineImages,
|
|
3092
|
-
sampling: sampling,
|
|
3093
|
-
slimDOMOptions: slimDOMOptions,
|
|
3094
|
-
iframeManager: iframeManager,
|
|
3095
|
-
canvasManager: canvasManager,
|
|
3096
|
-
enableStrictPrivacy: enableStrictPrivacy
|
|
3097
|
-
},
|
|
3098
|
-
mirror: mirror,
|
|
3099
|
-
});
|
|
3100
|
-
takeFullSnapshot = function (isCheckout) {
|
|
3101
|
-
var _a, _b, _c, _d;
|
|
3102
|
-
if (isCheckout === void 0) { isCheckout = false; }
|
|
3103
|
-
wrappedEmit(wrapEvent({
|
|
3104
|
-
type: EventType.Meta,
|
|
3105
|
-
data: {
|
|
3106
|
-
href: window.location.href,
|
|
3107
|
-
width: getWindowWidth(),
|
|
3108
|
-
height: getWindowHeight(),
|
|
3109
|
-
},
|
|
3110
|
-
}), isCheckout);
|
|
3111
|
-
mutationBuffers.forEach(function (buf) { return buf.lock(); });
|
|
3112
|
-
var _e = __read(snapshot(document, {
|
|
3113
|
-
blockClass: blockClass,
|
|
3114
|
-
blockSelector: blockSelector,
|
|
3115
|
-
maskTextClass: maskTextClass,
|
|
3116
|
-
maskTextSelector: maskTextSelector,
|
|
3117
|
-
inlineStylesheet: inlineStylesheet,
|
|
3118
|
-
maskAllInputs: maskInputOptions,
|
|
3119
|
-
maskTextFn: maskTextFn,
|
|
3120
|
-
slimDOM: slimDOMOptions,
|
|
3121
|
-
recordCanvas: recordCanvas,
|
|
3122
|
-
inlineImages: inlineImages,
|
|
3123
|
-
enableStrictPrivacy: enableStrictPrivacy,
|
|
3124
|
-
onSerialize: function (n) {
|
|
3125
|
-
if (isIframeINode(n)) {
|
|
3126
|
-
iframeManager.addIframe(n);
|
|
3127
|
-
}
|
|
3128
|
-
if (hasShadowRoot(n)) {
|
|
3129
|
-
shadowDomManager.addShadowRoot(n.shadowRoot, document);
|
|
3130
|
-
}
|
|
3131
|
-
},
|
|
3132
|
-
onIframeLoad: function (iframe, childSn) {
|
|
3133
|
-
iframeManager.attachIframe(iframe, childSn);
|
|
3134
|
-
shadowDomManager.observeAttachShadow(iframe);
|
|
3135
|
-
},
|
|
3136
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
3137
|
-
}), 2), node = _e[0], idNodeMap = _e[1];
|
|
3138
|
-
if (!node) {
|
|
3139
|
-
return console.warn('Failed to snapshot the document');
|
|
3140
|
-
}
|
|
3141
|
-
mirror.map = idNodeMap;
|
|
3142
|
-
wrappedEmit(wrapEvent({
|
|
3143
|
-
type: EventType.FullSnapshot,
|
|
3144
|
-
data: {
|
|
3145
|
-
node: node,
|
|
3146
|
-
initialOffset: {
|
|
3147
|
-
left: window.pageXOffset !== undefined
|
|
3148
|
-
? window.pageXOffset
|
|
3149
|
-
: (document === null || document === void 0 ? void 0 : document.documentElement.scrollLeft) ||
|
|
3150
|
-
((_b = (_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.scrollLeft) ||
|
|
3151
|
-
(document === null || document === void 0 ? void 0 : document.body.scrollLeft) ||
|
|
3152
|
-
0,
|
|
3153
|
-
top: window.pageYOffset !== undefined
|
|
3154
|
-
? window.pageYOffset
|
|
3155
|
-
: (document === null || document === void 0 ? void 0 : document.documentElement.scrollTop) ||
|
|
3156
|
-
((_d = (_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.scrollTop) ||
|
|
3157
|
-
(document === null || document === void 0 ? void 0 : document.body.scrollTop) ||
|
|
3158
|
-
0,
|
|
3159
|
-
},
|
|
3160
|
-
},
|
|
3161
|
-
}));
|
|
3162
|
-
mutationBuffers.forEach(function (buf) { return buf.unlock(); });
|
|
3163
|
-
};
|
|
3164
|
-
try {
|
|
3165
|
-
var handlers_1 = [];
|
|
3166
|
-
handlers_1.push(on('DOMContentLoaded', function () {
|
|
3167
|
-
wrappedEmit(wrapEvent({
|
|
3168
|
-
type: EventType.DomContentLoaded,
|
|
3169
|
-
data: {},
|
|
3170
|
-
}));
|
|
3171
|
-
}));
|
|
3172
|
-
var observe_1 = function (doc) {
|
|
3173
|
-
var _a;
|
|
3174
|
-
return initObservers({
|
|
3175
|
-
mutationCb: wrappedMutationEmit,
|
|
3176
|
-
mousemoveCb: function (positions, source) {
|
|
3177
|
-
return wrappedEmit(wrapEvent({
|
|
3178
|
-
type: EventType.IncrementalSnapshot,
|
|
3179
|
-
data: {
|
|
3180
|
-
source: source,
|
|
3181
|
-
positions: positions,
|
|
3182
|
-
},
|
|
3183
|
-
}));
|
|
3184
|
-
},
|
|
3185
|
-
mouseInteractionCb: function (d) {
|
|
3186
|
-
return wrappedEmit(wrapEvent({
|
|
3187
|
-
type: EventType.IncrementalSnapshot,
|
|
3188
|
-
data: __assign({ source: IncrementalSource.MouseInteraction }, d),
|
|
3189
|
-
}));
|
|
3190
|
-
},
|
|
3191
|
-
scrollCb: wrappedScrollEmit,
|
|
3192
|
-
viewportResizeCb: function (d) {
|
|
3193
|
-
return wrappedEmit(wrapEvent({
|
|
3194
|
-
type: EventType.IncrementalSnapshot,
|
|
3195
|
-
data: __assign({ source: IncrementalSource.ViewportResize }, d),
|
|
3196
|
-
}));
|
|
3197
|
-
},
|
|
3198
|
-
inputCb: function (v) {
|
|
3199
|
-
return wrappedEmit(wrapEvent({
|
|
3200
|
-
type: EventType.IncrementalSnapshot,
|
|
3201
|
-
data: __assign({ source: IncrementalSource.Input }, v),
|
|
3202
|
-
}));
|
|
3203
|
-
},
|
|
3204
|
-
mediaInteractionCb: function (p) {
|
|
3205
|
-
return wrappedEmit(wrapEvent({
|
|
3206
|
-
type: EventType.IncrementalSnapshot,
|
|
3207
|
-
data: __assign({ source: IncrementalSource.MediaInteraction }, p),
|
|
3208
|
-
}));
|
|
3209
|
-
},
|
|
3210
|
-
styleSheetRuleCb: function (r) {
|
|
3211
|
-
return wrappedEmit(wrapEvent({
|
|
3212
|
-
type: EventType.IncrementalSnapshot,
|
|
3213
|
-
data: __assign({ source: IncrementalSource.StyleSheetRule }, r),
|
|
3214
|
-
}));
|
|
3215
|
-
},
|
|
3216
|
-
styleDeclarationCb: function (r) {
|
|
3217
|
-
return wrappedEmit(wrapEvent({
|
|
3218
|
-
type: EventType.IncrementalSnapshot,
|
|
3219
|
-
data: __assign({ source: IncrementalSource.StyleDeclaration }, r),
|
|
3220
|
-
}));
|
|
3221
|
-
},
|
|
3222
|
-
canvasMutationCb: wrappedCanvasMutationEmit,
|
|
3223
|
-
fontCb: function (p) {
|
|
3224
|
-
return wrappedEmit(wrapEvent({
|
|
3225
|
-
type: EventType.IncrementalSnapshot,
|
|
3226
|
-
data: __assign({ source: IncrementalSource.Font }, p),
|
|
3227
|
-
}));
|
|
3228
|
-
},
|
|
3229
|
-
blockClass: blockClass,
|
|
3230
|
-
ignoreClass: ignoreClass,
|
|
3231
|
-
maskTextClass: maskTextClass,
|
|
3232
|
-
maskTextSelector: maskTextSelector,
|
|
3233
|
-
maskInputOptions: maskInputOptions,
|
|
3234
|
-
inlineStylesheet: inlineStylesheet,
|
|
3235
|
-
sampling: sampling,
|
|
3236
|
-
recordCanvas: recordCanvas,
|
|
3237
|
-
inlineImages: inlineImages,
|
|
3238
|
-
userTriggeredOnInput: userTriggeredOnInput,
|
|
3239
|
-
collectFonts: collectFonts,
|
|
3240
|
-
doc: doc,
|
|
3241
|
-
maskInputFn: maskInputFn,
|
|
3242
|
-
maskTextFn: maskTextFn,
|
|
3243
|
-
blockSelector: blockSelector,
|
|
3244
|
-
slimDOMOptions: slimDOMOptions,
|
|
3245
|
-
mirror: mirror,
|
|
3246
|
-
iframeManager: iframeManager,
|
|
3247
|
-
shadowDomManager: shadowDomManager,
|
|
3248
|
-
canvasManager: canvasManager,
|
|
3249
|
-
enableStrictPrivacy: enableStrictPrivacy,
|
|
3250
|
-
plugins: ((_a = plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (p) { return p.observer; })) === null || _a === void 0 ? void 0 : _a.map(function (p) { return ({
|
|
3251
|
-
observer: p.observer,
|
|
3252
|
-
options: p.options,
|
|
3253
|
-
callback: function (payload) {
|
|
3254
|
-
return wrappedEmit(wrapEvent({
|
|
3255
|
-
type: EventType.Plugin,
|
|
3256
|
-
data: {
|
|
3257
|
-
plugin: p.name,
|
|
3258
|
-
payload: payload,
|
|
3259
|
-
},
|
|
3260
|
-
}));
|
|
3261
|
-
},
|
|
3262
|
-
}); })) || [],
|
|
3263
|
-
}, hooks);
|
|
3264
|
-
};
|
|
3265
|
-
iframeManager.addLoadListener(function (iframeEl) {
|
|
3266
|
-
handlers_1.push(observe_1(iframeEl.contentDocument));
|
|
3267
|
-
});
|
|
3268
|
-
var init_1 = function () {
|
|
3269
|
-
takeFullSnapshot();
|
|
3270
|
-
handlers_1.push(observe_1(document));
|
|
3271
|
-
};
|
|
3272
|
-
if (document.readyState === 'interactive' ||
|
|
3273
|
-
document.readyState === 'complete') {
|
|
3274
|
-
init_1();
|
|
3275
|
-
}
|
|
3276
|
-
else {
|
|
3277
|
-
handlers_1.push(on('load', function () {
|
|
3278
|
-
wrappedEmit(wrapEvent({
|
|
3279
|
-
type: EventType.Load,
|
|
3280
|
-
data: {},
|
|
3281
|
-
}));
|
|
3282
|
-
init_1();
|
|
3283
|
-
}, window));
|
|
3284
|
-
}
|
|
3285
|
-
return function () {
|
|
3286
|
-
handlers_1.forEach(function (h) { return h(); });
|
|
3287
|
-
};
|
|
3288
|
-
}
|
|
3289
|
-
catch (error) {
|
|
3290
|
-
console.warn(error);
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
|
-
record.addCustomEvent = function (tag, payload) {
|
|
3294
|
-
if (!wrappedEmit) {
|
|
3295
|
-
return;
|
|
3296
|
-
}
|
|
3297
|
-
wrappedEmit(wrapEvent({
|
|
3298
|
-
type: EventType.Custom,
|
|
3299
|
-
data: {
|
|
3300
|
-
tag: tag,
|
|
3301
|
-
payload: payload,
|
|
3302
|
-
},
|
|
3303
|
-
}));
|
|
3304
|
-
};
|
|
3305
|
-
record.freezePage = function () {
|
|
3306
|
-
mutationBuffers.forEach(function (buf) { return buf.freeze(); });
|
|
3307
|
-
};
|
|
3308
|
-
record.takeFullSnapshot = function (isCheckout) {
|
|
3309
|
-
if (!takeFullSnapshot) {
|
|
3310
|
-
throw new Error('please take full snapshot after start recording');
|
|
3311
|
-
}
|
|
3312
|
-
takeFullSnapshot(isCheckout);
|
|
3313
|
-
};
|
|
3314
|
-
record.mirror = mirror;
|
|
3315
|
-
|
|
3316
|
-
return record;
|
|
3317
|
-
|
|
3318
|
-
}());
|
|
1
|
+
var rrwebRecord=function(){"use strict";var R;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(R||(R={}));function ge(t){return t.nodeType===t.ELEMENT_NODE}function dt(t){var e,n=(e=t)===null||e===void 0?void 0:e.host;return Boolean(n&&n.shadowRoot&&n.shadowRoot===t)}var Dt=function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var n;if(!e)return-1;var r=(n=this.getMeta(e))===null||n===void 0?void 0:n.id;return r??-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var n=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(o){return n.removeNodeFromMap(o)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,n){var r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)},t.prototype.replace=function(e,n){this.idNodeMap.set(e,n)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t}();function be(){return new Dt}function Mt(t){var e=t.maskInputOptions,n=t.tagName,r=t.type,o=t.value,s=t.maskInputFn,l=o||"";return(e[n.toLowerCase()]||e[r])&&(s?l=s(l):l="*".repeat(l.length)),l}var Ft="__rrweb_original__";function Se(t){var e=t.getContext("2d");if(!e)return!0;for(var n=50,r=0;r<t.width;r+=n)for(var o=0;o<t.height;o+=n){var s=e.getImageData,l=Ft in s?s[Ft]:s,a=new Uint32Array(l.call(e,r,o,Math.min(n,t.width-r),Math.min(n,t.height-o)).data.buffer);if(a.some(function(i){return i!==0}))return!1}return!0}function Pt(t){return t=t.replace(/[^ -~]+/g,""),t=t?.split(" ").map(function(e){return Math.random().toString(20).substr(2,e.length)}).join(" ")||"",t}var Ce=1,ke=new RegExp("[^a-z0-9-_:]"),pt=-2;function Ie(){return Ce++}function we(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return ke.test(e)?"div":e}function Tt(t){try{var e=t.rules||t.cssRules;return e?Array.from(e).map(Me).join(""):null}catch{return null}}function Me(t){var e=t.cssText;if(Te(t))try{e=Tt(t.styleSheet)||e}catch{}return e}function Te(t){return"styleSheet"in t}function Ne(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Oe(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var ot,At,Le=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,xe=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Re=/^(data:)([^,]*),(.*)/i;function gt(t,e){return(t||"").replace(Le,function(n,r,o,s,l,a){var i=o||l||a,c=r||s||"";if(!i)return n;if(!xe.test(i)||Re.test(i))return"url("+c+i+c+")";if(i[0]==="/")return"url("+c+(Oe(e)+i)+c+")";var d=e.split("/"),p=i.split("/");d.pop();for(var f=0,u=p;f<u.length;f++){var h=u[f];h!=="."&&(h===".."?d.pop():d.push(h))}return"url("+c+d.join("/")+c+")"})}var Ee=/^[^ \t\n\r\u000c]+/,De=/^[, \t\n\r\u000c]+/;function Fe(t,e){if(e.trim()==="")return e;var n=0;function r(c){var d,p=c.exec(e.substring(n));return p?(d=p[0],n+=d.length,d):""}for(var o=[];r(De),!(n>=e.length);){var s=r(Ee);if(s.slice(-1)===",")s=bt(t,s.substring(0,s.length-1)),o.push(s);else{var l="";s=bt(t,s);for(var a=!1;;){var i=e.charAt(n);if(i===""){o.push((s+l).trim());break}else if(a)i===")"&&(a=!1);else if(i===","){n+=1,o.push((s+l).trim());break}else i==="("&&(a=!0);l+=i,n+=1}}}return o.join(", ")}function bt(t,e){if(!e||e.trim()==="")return e;var n=t.createElement("a");return n.href=e,n.href}function Pe(t){return Boolean(t.tagName==="svg"||t.ownerSVGElement)}function Nt(){var t=document.createElement("a");return t.href="",t.href}function _t(t,e,n,r){return n==="src"||n==="href"&&r||n==="xlink:href"&&r&&r[0]!=="#"||n==="background"&&r&&(e==="table"||e==="td"||e==="th")?bt(t,r):n==="srcset"&&r?Fe(t,r):n==="style"&&r?gt(r,Nt()):e==="object"&&n==="data"&&r?bt(t,r):r}function Ae(t,e,n){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var r=0;r<t.classList.length;r++){var o=t.classList[r];if(e.test(o))return!0}return n?t.matches(n):!1}function St(t,e,n){if(!t)return!1;if(t.nodeType===t.ELEMENT_NODE){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var r=0;r<t.classList.length;r++){var o=t.classList[r];if(e.test(o))return!0}return n&&t.matches(n)?!0:St(t.parentNode,e,n)}return t.nodeType,t.TEXT_NODE,St(t.parentNode,e,n)}function _e(t,e,n){var r=t.contentWindow;if(r){var o=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){var l=setTimeout(function(){o||(e(),o=!0)},n);t.addEventListener("load",function(){clearTimeout(l),o=!0,e()});return}var a="about:blank";if(r.location.href!==a||t.src===a||t.src===""){setTimeout(e,0);return}t.addEventListener("load",e)}}function We(t){return t.getAttribute("href")?t.sheet!==null:!0}function Ge(t,e,n){var r=!1,o;try{o=t.sheet}catch{return}if(!o){var s=setTimeout(function(){r||(e(),r=!0)},n);t.addEventListener("load",function(){clearTimeout(s),r=!0,e()})}}function Ve(t,e){var n,r=e.doc,o=e.mirror,s=e.blockClass,l=e.blockSelector,a=e.maskTextClass,i=e.maskTextSelector,c=e.inlineStylesheet,d=e.maskInputOptions,p=d===void 0?{}:d,f=e.maskTextFn,u=e.maskInputFn,h=e.dataURLOptions,m=h===void 0?{}:h,C=e.inlineImages,O=e.recordCanvas,E=e.keepIframeSrcFn,I=e.enableStrictPrivacy,T;if(o.getMeta(r)){var B=o.getId(r);T=B===1?void 0:B}switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:R.Document,childNodes:[],compatMode:t.compatMode,rootId:T}:{type:R.Document,childNodes:[],rootId:T};case t.DOCUMENT_TYPE_NODE:return{type:R.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:T};case t.ELEMENT_NODE:for(var G=Ae(t,s,l),w=we(t),y={},J=t.attributes.length,V=0;V<J;V++){var j=t.attributes[V];y[j.name]=_t(r,w,j.name,j.value)}if(w==="link"&&c){var $=Array.from(r.styleSheets).find(function(nt){return nt.href===t.href}),A=null;$&&(A=Tt($)),A&&(delete y.rel,delete y.href,y._cssText=gt(A,$.href))}if(w==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var A=Tt(t.sheet);A&&(y._cssText=gt(A,Nt()))}if(w==="input"||w==="textarea"||w==="select"){var Q=t.value;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&Q?y.value=Mt({type:y.type,tagName:w,value:Q,maskInputOptions:p,maskInputFn:u}):t.checked&&(y.checked=t.checked)}if(w==="option"&&(t.selected&&!p.select?y.selected=!0:delete y.selected),w==="canvas"&&O){if(t.__context==="2d")Se(t)||(y.rr_dataURL=t.toDataURL(m.type,m.quality));else if(!("__context"in t)){var z=t.toDataURL(m.type,m.quality),Z=document.createElement("canvas");Z.width=t.width,Z.height=t.height;var q=Z.toDataURL(m.type,m.quality);z!==q&&(y.rr_dataURL=z)}}if(w==="img"&&C){ot||(ot=r.createElement("canvas"),At=ot.getContext("2d"));var N=t,U=N.crossOrigin;N.crossOrigin="anonymous";var X=function(){try{ot.width=N.naturalWidth,ot.height=N.naturalHeight,At.drawImage(N,0,0),y.rr_dataURL=ot.toDataURL(m.type,m.quality)}catch(nt){console.warn("Cannot inline img src="+N.currentSrc+"! Error: "+nt)}U?y.crossOrigin=U:N.removeAttribute("crossorigin")};N.complete&&N.naturalWidth!==0?X():N.onload=X}if((w==="audio"||w==="video")&&(y.rr_mediaState=t.paused?"paused":"played",y.rr_mediaCurrentTime=t.currentTime),t.scrollLeft&&(y.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(y.rr_scrollTop=t.scrollTop),G||w==="img"&&I){var S=t.getBoundingClientRect(),v=S.width,_=S.height;y={class:y.class,rr_width:v+"px",rr_height:_+"px"},G=!0}return w==="iframe"&&!E(y.src)&&(t.contentDocument||(y.rr_src=y.src),delete y.src),{type:R.Element,tagName:w,attributes:y,childNodes:[],isSVG:Pe(t)||void 0,needBlock:G,rootId:T};case t.TEXT_NODE:var F=t.parentNode&&t.parentNode.tagName,g=t.textContent,H=F==="STYLE"?!0:void 0,b=F==="SCRIPT"?!0:void 0,k=!1;if(H&&g){try{t.nextSibling||t.previousSibling||!((n=t.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(g=Ne(t.parentNode.sheet))}catch(nt){console.warn("Cannot get CSS styles from text's parentNode. Error: "+nt,t)}g=gt(g,Nt()),k=!0}if(b?(g="SCRIPT_PLACEHOLDER",k=!0):F==="NOSCRIPT"&&(g="",k=!0),!H&&!b&&St(t,a,i)&&g&&(g=f?f(g):g.replace(/[\S]/g,"*")),I&&!k&&F){var tt=new Set(["HEAD","TITLE","STYLE","SCRIPT","HTML","BODY","NOSCRIPT"]);!tt.has(F)&&g&&(g=Pt(g))}return{type:R.Text,textContent:g||"",isStyle:H,rootId:T};case t.CDATA_SECTION_NODE:return{type:R.CDATA,textContent:"",rootId:T};case t.COMMENT_NODE:return{type:R.Comment,textContent:t.textContent||"",rootId:T};default:return!1}}function M(t){return t===void 0?"":t.toLowerCase()}function je(t,e){return!!(e.comment&&t.type===R.Comment||t.type===R.Element&&(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js"))||e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(M(t.attributes.name).match(/^msapplication-tile(image|color)$/)||M(t.attributes.name)==="application-name"||M(t.attributes.rel)==="icon"||M(t.attributes.rel)==="apple-touch-icon"||M(t.attributes.rel)==="shortcut icon"))||t.tagName==="meta"&&(e.headMetaDescKeywords&&M(t.attributes.name).match(/^description|keywords$/)||e.headMetaSocial&&(M(t.attributes.property).match(/^(og|twitter|fb):/)||M(t.attributes.name).match(/^(og|twitter):/)||M(t.attributes.name)==="pinterest")||e.headMetaRobots&&(M(t.attributes.name)==="robots"||M(t.attributes.name)==="googlebot"||M(t.attributes.name)==="bingbot")||e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0||e.headMetaAuthorship&&(M(t.attributes.name)==="author"||M(t.attributes.name)==="generator"||M(t.attributes.name)==="framework"||M(t.attributes.name)==="publisher"||M(t.attributes.name)==="progid"||M(t.attributes.property).match(/^article:/)||M(t.attributes.property).match(/^product:/))||e.headMetaVerification&&(M(t.attributes.name)==="google-site-verification"||M(t.attributes.name)==="yandex-verification"||M(t.attributes.name)==="csrf-token"||M(t.attributes.name)==="p:domain_verify"||M(t.attributes.name)==="verify-v1"||M(t.attributes.name)==="verification"||M(t.attributes.name)==="shopify-checkout-api-token"))))}function at(t,e){var n=e.doc,r=e.mirror,o=e.blockClass,s=e.blockSelector,l=e.maskTextClass,a=e.maskTextSelector,i=e.skipChild,c=i===void 0?!1:i,d=e.inlineStylesheet,p=d===void 0?!0:d,f=e.maskInputOptions,u=f===void 0?{}:f,h=e.maskTextFn,m=e.maskInputFn,C=e.slimDOMOptions,O=e.dataURLOptions,E=O===void 0?{}:O,I=e.inlineImages,T=I===void 0?!1:I,B=e.recordCanvas,G=B===void 0?!1:B,w=e.onSerialize,y=e.onIframeLoad,J=e.iframeLoadTimeout,V=J===void 0?5e3:J,j=e.onStylesheetLoad,$=e.stylesheetLoadTimeout,A=$===void 0?5e3:$,Q=e.keepIframeSrcFn,z=Q===void 0?function(){return!1}:Q,Z=e.enableStrictPrivacy,q=e.preserveWhiteSpace,N=q===void 0?!0:q,U=Ve(t,{doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:l,maskTextSelector:a,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:m,dataURLOptions:E,inlineImages:T,recordCanvas:G,keepIframeSrcFn:z,enableStrictPrivacy:Z});if(!U)return console.warn(t,"not serialized"),null;var X;if(r.hasNode(t)?X=r.getId(t):je(U,C)||!N&&U.type===R.Text&&!U.isStyle&&!U.textContent.replace(/^\s+|\s+$/gm,"").length?X=pt:X=Ie(),X===pt)return null;var S=Object.assign(U,{id:X});r.add(t,S),w&&w(t);var v=!c;if(S.type===R.Element){if(v=v&&!S.needBlock,S.needBlock&&S.tagName==="img"){var _=t.cloneNode();_.src="",r.add(_,S)}delete S.needBlock,t.shadowRoot&&(S.isShadowHost=!0)}if((S.type===R.Document||S.type===R.Element)&&v){C.headWhitespace&&S.type===R.Element&&S.tagName==="head"&&(N=!1);for(var F={doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:l,maskTextSelector:a,skipChild:c,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:C,dataURLOptions:E,inlineImages:T,recordCanvas:G,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:y,iframeLoadTimeout:V,onStylesheetLoad:j,stylesheetLoadTimeout:A,keepIframeSrcFn:z,enableStrictPrivacy:Z},g=0,H=Array.from(t.childNodes);g<H.length;g++){var b=H[g],k=at(b,F);k&&S.childNodes.push(k)}if(ge(t)&&t.shadowRoot)for(var tt=0,nt=Array.from(t.shadowRoot.childNodes);tt<nt.length;tt++){var b=nt[tt],k=at(b,F);k&&(k.isShadow=!0,S.childNodes.push(k))}}return t.parentNode&&dt(t.parentNode)&&(S.isShadow=!0),S.type===R.Element&&S.tagName==="iframe"&&_e(t,function(){var ut=t.contentDocument;if(ut&&y){var ve=at(ut,{doc:ut,mirror:r,blockClass:o,blockSelector:s,maskTextClass:l,maskTextSelector:a,skipChild:!1,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:C,dataURLOptions:E,inlineImages:T,recordCanvas:G,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:y,iframeLoadTimeout:V,keepIframeSrcFn:z,enableStrictPrivacy:Z});ve&&y(t,ve)}},V),S.type===R.Element&&S.tagName==="link"&&S.attributes.rel==="stylesheet"&&(Ge(t,function(){if(j){var ut=at(t,{doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:l,maskTextSelector:a,skipChild:!1,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:C,dataURLOptions:E,inlineImages:T,recordCanvas:G,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:y,onStylesheetLoad:j,iframeLoadTimeout:V,keepIframeSrcFn:z,enableStrictPrivacy:Z});ut&&j(t,ut)}},A),We(t)===!1)?null:S}function ze(t,e){var n=e||{},r=n.mirror,o=r===void 0?new Dt:r,s=n.blockClass,l=s===void 0?"highlight-block":s,a=n.blockSelector,i=a===void 0?null:a,c=n.maskTextClass,d=c===void 0?"highlight-mask":c,p=n.maskTextSelector,f=p===void 0?null:p,u=n.inlineStylesheet,h=u===void 0?!0:u,m=n.inlineImages,C=m===void 0?!1:m,O=n.recordCanvas,E=O===void 0?!1:O,I=n.maskAllInputs,T=I===void 0?!1:I,B=n.maskTextFn,G=n.maskInputFn,w=n.slimDOM,y=w===void 0?!1:w,J=n.dataURLOptions,V=n.preserveWhiteSpace,j=n.onSerialize,$=n.onIframeLoad,A=n.iframeLoadTimeout,Q=n.onStylesheetLoad,z=n.stylesheetLoadTimeout,Z=n.keepIframeSrcFn,q=Z===void 0?function(){return!1}:Z,N=n.enableStrictPrivacy,U=N===void 0?!1:N,X=T===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:T===!1?{password:!0}:T,S=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:y===!1?{}:y;return at(t,{doc:t,mirror:o,blockClass:l,blockSelector:i,maskTextClass:d,maskTextSelector:f,skipChild:!1,inlineStylesheet:h,maskInputOptions:X,maskTextFn:B,maskInputFn:G,slimDOMOptions:S,dataURLOptions:J,inlineImages:C,recordCanvas:E,preserveWhiteSpace:V,onSerialize:j,onIframeLoad:$,iframeLoadTimeout:A,onStylesheetLoad:Q,stylesheetLoadTimeout:z,keepIframeSrcFn:q,enableStrictPrivacy:U})}function Y(t,e,n=document){const r={capture:!0,passive:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}const st=`Please stop import mirror directly. Instead of that,\r
|
|
2
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Wt={map:{},getId(){return console.error(st),-1},getNode(){return console.error(st),null},removeNodeFromMap(){console.error(st)},has(){return console.error(st),!1},reset(){console.error(st)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Wt=new Proxy(Wt,{get(t,e,n){return e==="map"&&console.error(st),Reflect.get(t,e,n)}}));function ht(t,e,n={}){let r=null,o=0;return function(s){const l=Date.now();!o&&n.leading===!1&&(o=l);const a=e-(l-o),i=this,c=arguments;a<=0||a>e?(r&&(clearTimeout(r),r=null),o=l,t.apply(i,c)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{o=n.leading===!1?0:Date.now(),r=null,t.apply(i,c)},a))}}function Ct(t,e,n,r,o=window){const s=o.Object.getOwnPropertyDescriptor(t,e);return o.Object.defineProperty(t,e,r?n:{set(l){setTimeout(()=>{n.set.call(this,l)},0),s&&s.set&&s.set.call(this,l)}}),()=>Ct(t,e,s||{},!0)}function it(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=o,()=>{t[e]=r}}catch{return()=>{}}}function Gt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Vt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}const Ze=t=>{try{if(t instanceof HTMLElement)return t.tagName==="CANVAS"}catch{return!1}return!1};function W(t,e){if(!t)return!1;if(t.nodeType===t.ELEMENT_NODE){let n=!1;if(typeof e=="string"){if(t.closest!==void 0)return t.closest("."+e)!==null;n=t.classList.contains(e)}else t.classList.forEach(r=>{e.test(r)&&(n=!0)});return n||W(t.parentNode,e)}return t.nodeType,t.TEXT_NODE,W(t.parentNode,e)}function Ue(t,e){return e.getId(t)!==-1}function Ot(t,e){return e.getId(t)===pt}function jt(t,e){if(dt(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?jt(t.parentNode,e):!0:!0}function zt(t){return Boolean(t.changedTouches)}function He(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do if(this===e)return!0;while(e=e&&e.parentNode);return!1})}function Zt(t,e){return Boolean(t.nodeName==="IFRAME"&&e.getMeta(t))}function Ye(t,e){return Boolean(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Ut(t){return Boolean(t?.shadowRoot)}var L=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(L||{}),P=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t))(P||{}),Lt=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Lt||{}),lt=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(lt||{}),mt=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t))(mt||{}),Be=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t))(Be||{});function Ht(t){return"__ln"in t}class Xe{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=n?.next||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&Ht(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&Ht(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;this.length++}removeNode(e){const n=e.__ln;!this.head||(n.previous?(n.previous.next=n.next,n.next&&(n.next.previous=n.previous)):(this.head=n.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const Yt=(t,e)=>`${t}@${e}`;class Ke{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Xe,r=a=>{let i=a,c=pt;for(;c===pt;)i=i&&i.nextSibling,c=i&&this.mirror.getId(i);return c},o=a=>{var i,c,d,p,f;const u=a.getRootNode?(i=a.getRootNode())==null?void 0:i.host:null;let h=u;for(;(d=(c=h?.getRootNode)==null?void 0:c.call(h))!=null&&d.host;)h=((f=(p=h?.getRootNode)==null?void 0:p.call(h))==null?void 0:f.host)||null;const m=!this.doc.contains(a)&&(!h||!this.doc.contains(h));if(!a.parentNode||m)return;const C=dt(a.parentNode)?this.mirror.getId(u):this.mirror.getId(a.parentNode),O=r(a);if(C===-1||O===-1)return n.addNode(a);const E=at(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,enableStrictPrivacy:this.enableStrictPrivacy,onSerialize:I=>{Zt(I,this.mirror)&&this.iframeManager.addIframe(I),Ye(I,this.mirror)&&this.stylesheetManager.addStylesheet(I),Ut(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,document)},onIframeLoad:(I,T)=>{this.iframeManager.attachIframe(I,T,this.mirror),this.shadowDomManager.observeAttachShadow(I)},onStylesheetLoad:(I,T)=>{this.stylesheetManager.attachStylesheet(I,T,this.mirror)}});E&&e.push({parentId:C,nextId:O,node:E})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of Array.from(this.movedSet.values()))Rt(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||o(a);for(const a of Array.from(this.addedSet.values()))!Et(this.droppedSet,a)&&!Rt(this.removes,a,this.mirror)||Et(this.movedSet,a)?o(a):this.droppedSet.add(a);let s=null;for(;n.length;){let a=null;if(s){const i=this.mirror.getId(s.value.parentNode),c=r(s.value);i!==-1&&c!==-1&&(a=s)}if(!a)for(let i=n.length-1;i>=0;i--){const c=n.get(i);if(c){const d=this.mirror.getId(c.value.parentNode),p=r(c.value);if(d!==-1&&p!==-1){a=c;break}}}if(!a){for(;n.head;)n.removeNode(n.head.value);break}s=a.previous,n.removeNode(a.value),o(a.value)}const l={texts:this.texts.map(a=>{let i=a.value;return this.enableStrictPrivacy&&i&&(i=Pt(i)),{id:this.mirror.getId(a.node),value:i}}).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>({id:this.mirror.getId(a.node),attributes:a.attributes})).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.processMutation=e=>{if(!Ot(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!W(e.target,this.blockClass)&&n!==e.oldValue&&this.texts.push({value:St(e.target,this.maskTextClass,this.maskTextSelector)&&n?this.maskTextFn?this.maskTextFn(n):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(r=Mt({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),W(e.target,this.blockClass)||r===e.oldValue)return;let o=this.attributes.find(s=>s.node===e.target);if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),e.attributeName==="style"){const s=this.doc.createElement("span");e.oldValue&&s.setAttribute("style",e.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});const l=o.attributes.style;for(const a of Array.from(n.style)){const i=n.style.getPropertyValue(a),c=n.style.getPropertyPriority(a);(i!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a))&&(c===""?l[a]=i:l[a]=[i,c])}for(const a of Array.from(s.style))n.style.getPropertyValue(a)===""&&(l[a]=!1)}else{if(e.target.tagName==="INPUT"){const s=e.target;if(s.type==="password"){o.attributes.value="*".repeat(s.value.length);break}}o.attributes[e.attributeName]=_t(this.doc,e.target.tagName,e.attributeName,r)}break}case"childList":{e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),o=dt(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);W(e.target,this.blockClass)||Ot(n,this.mirror)||!Ue(n,this.mirror)||(this.addedSet.has(n)?(xt(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||jt(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Yt(r,o)]?xt(this.movedSet,n):this.removes.push({parentId:o,id:r,isShadow:dt(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!(n&&W(n,this.blockClass))){if(this.mirror.getMeta(e)){if(Ot(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.getMeta(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Yt(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);W(e,this.blockClass)||e.childNodes.forEach(r=>this.genAdds(r))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","recordCanvas","inlineImages","slimDOMOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","enableStrictPrivacy"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function xt(t,e){t.delete(e),e.childNodes.forEach(n=>xt(t,n))}function Rt(t,e,n){const{parentNode:r}=e;if(!r)return!1;const o=n.getId(r);return t.some(s=>s.id===o)?!0:Rt(t,r,n)}function Et(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:Et(t,n):!1}var $e=Object.defineProperty,Je=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,Bt=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,tn=Object.prototype.propertyIsEnumerable,Xt=(t,e,n)=>e in t?$e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kt=(t,e)=>{for(var n in e||(e={}))qe.call(e,n)&&Xt(t,n,e[n]);if(Bt)for(var n of Bt(e))tn.call(e,n)&&Xt(t,n,e[n]);return t},en=(t,e)=>Je(t,Qe(e));const rt=[],$t=typeof CSSGroupingRule<"u",Jt=typeof CSSMediaRule<"u",Qt=typeof CSSSupportsRule<"u",qt=typeof CSSConditionRule<"u";function ft(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch{return t.target}}function te(t,e){var n,r;const o=new Ke;rt.push(o),o.init(t);let s=window.MutationObserver||window.__rrMutationObserver;const l=(r=(n=window?.Zone)==null?void 0:n.__symbol__)==null?void 0:r.call(n,"MutationObserver");l&&window[l]&&(s=window[l]);const a=new s(o.processMutations.bind(o));return a.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function nn({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let l=[],a;const i=ht(p=>{const f=Date.now()-a;t(l.map(u=>(u.timeOffset-=f,u)),p),l=[],a=null},s),c=ht(p=>{const f=ft(p),{clientX:u,clientY:h}=zt(p)?p.changedTouches[0]:p;a||(a=Date.now()),l.push({x:u,y:h,id:r.getId(f),timeOffset:Date.now()-a}),i(typeof DragEvent<"u"&&p instanceof DragEvent?P.Drag:p instanceof MouseEvent?P.MouseMove:P.TouchMove)},o,{trailing:!1}),d=[Y("mousemove",c,n),Y("touchmove",c,n),Y("drag",c,n)];return()=>{d.forEach(p=>p())}}function rn({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[],a=i=>c=>{const d=ft(c);if(W(d,r)||Ze(d))return;const p=zt(c)?c.changedTouches[0]:c;if(!p)return;const f=n.getId(d),{clientX:u,clientY:h}=p;t({type:Lt[i],id:f,x:u,y:h})};return Object.keys(Lt).filter(i=>Number.isNaN(Number(i))&&!i.endsWith("_Departed")&&s[i]!==!1).forEach(i=>{const c=i.toLowerCase(),d=a(i);l.push(Y(c,d,e))}),()=>{l.forEach(i=>i())}}function ee({scrollCb:t,doc:e,mirror:n,blockClass:r,sampling:o}){const s=ht(l=>{const a=ft(l);if(!a||W(a,r))return;const i=n.getId(a);if(a===e){const c=e.scrollingElement||e.documentElement;t({id:i,x:c.scrollLeft,y:c.scrollTop})}else t({id:i,x:a.scrollLeft,y:a.scrollTop})},o.scroll||100);return Y("scroll",s,e)}function on({viewportResizeCb:t}){let e=-1,n=-1;const r=ht(()=>{const o=Gt(),s=Vt();(e!==o||n!==s)&&(t({width:Number(s),height:Number(o)}),e=o,n=s)},200);return Y("resize",r,window)}function ne(t,e){const n=Kt({},t);return e||delete n.userTriggered,n}const an=["INPUT","TEXTAREA","SELECT"],re=new WeakMap;function sn({inputCb:t,doc:e,mirror:n,blockClass:r,ignoreClass:o,maskInputOptions:s,maskInputFn:l,sampling:a,userTriggeredOnInput:i}){function c(h){let m=ft(h);const C=h.isTrusted;if(m&&m.tagName==="OPTION"&&(m=m.parentElement),!m||!m.tagName||an.indexOf(m.tagName)<0||W(m,r))return;const O=m.type;if(m.classList.contains(o))return;let E=m.value,I=!1;O==="radio"||O==="checkbox"?I=m.checked:(s[m.tagName.toLowerCase()]||s[O])&&(E=Mt({maskInputOptions:s,tagName:m.tagName,type:O,value:E,maskInputFn:l})),d(m,ne({text:E,isChecked:I,userTriggered:C},i));const T=m.name;O==="radio"&&T&&I&&e.querySelectorAll(`input[type="radio"][name="${T}"]`).forEach(B=>{B!==m&&d(B,ne({text:B.value,isChecked:!I,userTriggered:!1},i))})}function d(h,m){const C=re.get(h);if(!C||C.text!==m.text||C.isChecked!==m.isChecked){re.set(h,m);const O=n.getId(h);t(en(Kt({},m),{id:O}))}}const p=(a.input==="last"?["change"]:["input","change"]).map(h=>Y(h,c,e)),f=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),u=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"],[HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...u.map(h=>Ct(h[0],h[1],{set(){c({target:this})}}))),()=>{p.forEach(h=>h())}}function kt(t){const e=[];function n(r,o){if($t&&r.parentRule instanceof CSSGroupingRule||Jt&&r.parentRule instanceof CSSMediaRule||Qt&&r.parentRule instanceof CSSSupportsRule||qt&&r.parentRule instanceof CSSConditionRule){const s=Array.from(r.parentRule.cssRules).indexOf(r);o.unshift(s)}else{const s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);o.unshift(s)}return o}return n(t,e)}function ln({styleSheetRuleCb:t,mirror:e},{win:n}){const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(a,i){const c=e.getId(this.ownerNode);return c!==-1&&t({id:c,adds:[{rule:a,index:i}]}),r.apply(this,arguments)};const o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(a){const i=e.getId(this.ownerNode);return i!==-1&&t({id:i,removes:[{index:a}]}),o.apply(this,arguments)};const s={};$t?s.CSSGroupingRule=n.CSSGroupingRule:(Jt&&(s.CSSMediaRule=n.CSSMediaRule),qt&&(s.CSSConditionRule=n.CSSConditionRule),Qt&&(s.CSSSupportsRule=n.CSSSupportsRule));const l={};return Object.entries(s).forEach(([a,i])=>{l[a]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=function(c,d){const p=e.getId(this.parentStyleSheet.ownerNode);return p!==-1&&t({id:p,adds:[{rule:c,index:[...kt(this),d||0]}]}),l[a].insertRule.apply(this,arguments)},i.prototype.deleteRule=function(c){const d=e.getId(this.parentStyleSheet.ownerNode);return d!==-1&&t({id:d,removes:[{index:[...kt(this),c]}]}),l[a].deleteRule.apply(this,arguments)}}),()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,Object.entries(s).forEach(([a,i])=>{i.prototype.insertRule=l[a].insertRule,i.prototype.deleteRule=l[a].deleteRule})}}function cn({styleDeclarationCb:t,mirror:e},{win:n}){const r=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=function(s,l,a){var i,c;const d=e.getId((c=(i=this.parentRule)==null?void 0:i.parentStyleSheet)==null?void 0:c.ownerNode);return d!==-1&&t({id:d,set:{property:s,value:l,priority:a},index:kt(this.parentRule)}),r.apply(this,arguments)};const o=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=function(s){var l,a;const i=e.getId((a=(l=this.parentRule)==null?void 0:l.parentStyleSheet)==null?void 0:a.ownerNode);return i!==-1&&t({id:i,remove:{property:s},index:kt(this.parentRule)}),o.apply(this,arguments)},()=>{n.CSSStyleDeclaration.prototype.setProperty=r,n.CSSStyleDeclaration.prototype.removeProperty=o}}function un({mediaInteractionCb:t,blockClass:e,mirror:n,sampling:r}){const o=l=>ht(a=>{const i=ft(a);if(!i||W(i,e))return;const{currentTime:c,volume:d,muted:p}=i;t({type:l,id:n.getId(i),currentTime:c,volume:d,muted:p})},r.media||500),s=[Y("play",o(mt.Play)),Y("pause",o(mt.Pause)),Y("seeked",o(mt.Seeked)),Y("volumechange",o(mt.VolumeChange))];return()=>{s.forEach(l=>l())}}function dn({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(a,i,c){const d=new s(a,i,c);return o.set(d,{family:a,buffer:typeof i!="string",descriptors:c,fontSource:typeof i=="string"?i:JSON.stringify(Array.from(new Uint8Array(i)))}),d};const l=it(e.fonts,"add",function(a){return function(i){return setTimeout(()=>{const c=o.get(i);c&&(t(c),o.delete(i))},0),a.apply(this,[i])}});return r.push(()=>{n.FontFace=s}),r.push(l),()=>{r.forEach(a=>a())}}function pn(t,e){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:l,inputCb:a,mediaInteractionCb:i,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:p,fontCb:f}=t;t.mutationCb=(...u)=>{e.mutation&&e.mutation(...u),n(...u)},t.mousemoveCb=(...u)=>{e.mousemove&&e.mousemove(...u),r(...u)},t.mouseInteractionCb=(...u)=>{e.mouseInteraction&&e.mouseInteraction(...u),o(...u)},t.scrollCb=(...u)=>{e.scroll&&e.scroll(...u),s(...u)},t.viewportResizeCb=(...u)=>{e.viewportResize&&e.viewportResize(...u),l(...u)},t.inputCb=(...u)=>{e.input&&e.input(...u),a(...u)},t.mediaInteractionCb=(...u)=>{e.mediaInteaction&&e.mediaInteaction(...u),i(...u)},t.styleSheetRuleCb=(...u)=>{e.styleSheetRule&&e.styleSheetRule(...u),c(...u)},t.styleDeclarationCb=(...u)=>{e.styleDeclaration&&e.styleDeclaration(...u),d(...u)},t.canvasMutationCb=(...u)=>{e.canvasMutation&&e.canvasMutation(...u),p(...u)},t.fontCb=(...u)=>{e.font&&e.font(...u),f(...u)}}function hn(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};pn(t,e);const r=te(t,t.doc),o=nn(t),s=rn(t),l=ee(t),a=on(t),i=sn(t),c=un(t),d=ln(t,{win:n}),p=cn(t,{win:n}),f=t.collectFonts?dn(t):()=>{},u=[];for(const h of t.plugins)u.push(h.observer(h.callback,n,h.options));return()=>{rt.forEach(h=>h.reset()),r.disconnect(),o(),s(),l(),a(),i(),c(),d(),p(),f(),u.forEach(h=>h())}}class mn{constructor(e){this.iframes=new WeakMap,this.mutationCb=e.mutationCb}addIframe(e){this.iframes.set(e,!0)}addLoadListener(e){this.loadListener=e}attachIframe(e,n,r){var o;this.mutationCb({adds:[{parentId:r.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(o=this.loadListener)==null||o.call(this,e)}}var fn=Object.defineProperty,yn=Object.defineProperties,vn=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,gn=Object.prototype.hasOwnProperty,bn=Object.prototype.propertyIsEnumerable,ae=(t,e,n)=>e in t?fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,se=(t,e)=>{for(var n in e||(e={}))gn.call(e,n)&&ae(t,n,e[n]);if(oe)for(var n of oe(e))bn.call(e,n)&&ae(t,n,e[n]);return t},ie=(t,e)=>yn(t,vn(e));class Sn{constructor(e){this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const n=this;this.restorePatches.push(it(HTMLElement.prototype,"attachShadow",function(r){return function(){const o=r.apply(this,arguments);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,this.ownerDocument),o}}))}addShadowRoot(e,n){te(ie(se({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),ee(ie(se({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}observeAttachShadow(e){if(e.contentWindow){const n=this;this.restorePatches.push(it(e.contentWindow.HTMLElement.prototype,"attachShadow",function(r){return function(){const o=r.apply(this,arguments);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,e.contentDocument),o}}))}}reset(){this.restorePatches.forEach(e=>e())}}for(var ct="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cn=typeof Uint8Array>"u"?[]:new Uint8Array(256),It=0;It<ct.length;It++)Cn[ct.charCodeAt(It)]=It;var kn=function(t){var e=new Uint8Array(t),n,r=e.length,o="";for(n=0;n<r;n+=3)o+=ct[e[n]>>2],o+=ct[(e[n]&3)<<4|e[n+1]>>4],o+=ct[(e[n+1]&15)<<2|e[n+2]>>6],o+=ct[e[n+2]&63];return r%3===2?o=o.substring(0,o.length-1)+"=":r%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const le=new Map;function In(t,e){let n=le.get(t);return n||(n=new Map,le.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}const ce=(t,e,n)=>{if(!t||!(de(t,e)||typeof t=="object"))return;const r=t.constructor.name,o=In(n,r);let s=o.indexOf(t);return s===-1&&(s=o.length,o.push(t)),s};function wt(t,e,n){if(t instanceof Array)return t.map(r=>wt(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){const r=t.constructor.name,o=kn(t);return{rr_type:r,base64:o}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[wt(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const r=t.constructor.name,{src:o}=t;return{rr_type:r,src:o}}else if(t instanceof HTMLCanvasElement){const r="HTMLImageElement",o=t.toDataURL();return{rr_type:r,src:o}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[wt(t.data,e,n),t.width,t.height]};if(de(t,e)||typeof t=="object"){const r=t.constructor.name,o=ce(t,e,n);return{rr_type:r,index:o}}}}return t}const ue=(t,e,n)=>[...t].map(r=>wt(r,e,n)),de=(t,e)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(r=>typeof e[r]=="function");return Boolean(n.find(r=>t instanceof e[r]))};function wn(t,e,n,r){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const l of s)try{if(typeof e.CanvasRenderingContext2D.prototype[l]!="function")continue;const a=it(e.CanvasRenderingContext2D.prototype,l,function(i){return function(...c){return W(this.canvas,n)||setTimeout(()=>{const d=ue([...c],e,this);t(this.canvas,{type:lt["2D"],property:l,args:d})},0),i.apply(this,c)}});o.push(a)}catch{const i=Ct(e.CanvasRenderingContext2D.prototype,l,{set(c){t(this.canvas,{type:lt["2D"],property:l,args:[c],setter:!0})}});o.push(i)}return()=>{o.forEach(l=>l())}}function pe(t,e){const n=[];try{const r=it(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(s,...l){return W(this,e)||"__context"in this||(this.__context=s),o.apply(this,[s,...l])}});n.push(r)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(r=>r())}}function he(t,e,n,r,o,s){const l=[],a=Object.getOwnPropertyNames(t);for(const i of a)try{if(typeof t[i]!="function")continue;const c=it(t,i,function(d){return function(...p){const f=d.apply(this,p);if(ce(f,s,t),!W(this.canvas,r)){const u=o.getId(this.canvas),h=ue([...p],s,t),m={type:e,property:i,args:h};n(this.canvas,m)}return f}});l.push(c)}catch{const d=Ct(t,i,{set(p){n(this.canvas,{type:e,property:i,args:[p],setter:!0})}});l.push(d)}return l}function Mn(t,e,n,r){const o=[];return o.push(...he(e.WebGLRenderingContext.prototype,lt.WebGL,t,n,r,e)),typeof e.WebGL2RenderingContext<"u"&&o.push(...he(e.WebGL2RenderingContext.prototype,lt.WebGL2,t,n,r,e)),()=>{o.forEach(s=>s())}}function Tn(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),o=0,s=n.length;o<s;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function Nn(t,e,n){var r=e===void 0?null:e,o=n===void 0?!1:n,s=Tn(t,o),l=s.indexOf(`
|
|
4
|
+
`,10)+1,a=s.substring(l)+(r?"//# sourceMappingURL="+r:""),i=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(i)}function On(t,e,n){var r;return function(s){return r=r||Nn(t,e,n),new Worker(r,s)}}var Ln=On("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Zm9yKHZhciByPSJBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvIixsPXR5cGVvZiBVaW50OEFycmF5PiJ1Ij9bXTpuZXcgVWludDhBcnJheSgyNTYpLGY9MDtmPHIubGVuZ3RoO2YrKylsW3IuY2hhckNvZGVBdChmKV09Zjt2YXIgZD1mdW5jdGlvbihzKXt2YXIgZT1uZXcgVWludDhBcnJheShzKSxuLGE9ZS5sZW5ndGgsdD0iIjtmb3Iobj0wO248YTtuKz0zKXQrPXJbZVtuXT4+Ml0sdCs9clsoZVtuXSYzKTw8NHxlW24rMV0+PjRdLHQrPXJbKGVbbisxXSYxNSk8PDJ8ZVtuKzJdPj42XSx0Kz1yW2VbbisyXSY2M107cmV0dXJuIGElMz09PTI/dD10LnN1YnN0cmluZygwLHQubGVuZ3RoLTEpKyI9IjphJTM9PT0xJiYodD10LnN1YnN0cmluZygwLHQubGVuZ3RoLTIpKyI9PSIpLHR9O2NvbnN0IGM9bmV3IE1hcCx1PW5ldyBNYXA7YXN5bmMgZnVuY3Rpb24gcChzLGUpe2NvbnN0IG49YCR7c30tJHtlfWA7aWYodS5oYXMobikpcmV0dXJuIHUuZ2V0KG4pO2NvbnN0IGE9bmV3IE9mZnNjcmVlbkNhbnZhcyhzLGUpO2EuZ2V0Q29udGV4dCgiMmQiKTtjb25zdCB0PWF3YWl0KGF3YWl0IGEuY29udmVydFRvQmxvYigpKS5hcnJheUJ1ZmZlcigpLGc9ZCh0KTtyZXR1cm4gdS5zZXQobixnKSxnfWNvbnN0IGk9c2VsZjtpLm9ubWVzc2FnZT1hc3luYyBmdW5jdGlvbihzKXtpZighKCJPZmZzY3JlZW5DYW52YXMiaW4gZ2xvYmFsVGhpcykpcmV0dXJuIGkucG9zdE1lc3NhZ2Uoe2lkOnMuZGF0YS5pZH0pO2NvbnN0e2lkOmUsYml0bWFwOm4sd2lkdGg6YSxoZWlnaHQ6dH09cy5kYXRhLGc9cChhLHQpLGg9bmV3IE9mZnNjcmVlbkNhbnZhcyhhLHQpO2guZ2V0Q29udGV4dCgiMmQiKS5kcmF3SW1hZ2UobiwwLDApLG4uY2xvc2UoKTtjb25zdCB3PWF3YWl0IGguY29udmVydFRvQmxvYigpLHk9dy50eXBlLGI9YXdhaXQgdy5hcnJheUJ1ZmZlcigpLG89ZChiKTtpZighYy5oYXMoZSkmJmF3YWl0IGc9PT1vKXJldHVybiBjLnNldChlLG8pLGkucG9zdE1lc3NhZ2Uoe2lkOmV9KTtpZihjLmdldChlKT09PW8pcmV0dXJuIGkucG9zdE1lc3NhZ2Uoe2lkOmV9KTtpLnBvc3RNZXNzYWdlKHtpZDplLHR5cGU6eSxiYXNlNjQ6byx3aWR0aDphLGhlaWdodDp0fSksYy5zZXQoZSxvKX19KSgpOwoK",null,!1),me=Object.getOwnPropertySymbols,xn=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable,En=(t,e)=>{var n={};for(var r in t)xn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&me)for(var r of me(t))e.indexOf(r)<0&&Rn.call(t,r)&&(n[r]=t[r]);return n},Dn=(t,e,n)=>new Promise((r,o)=>{var s=i=>{try{a(n.next(i))}catch(c){o(c)}},l=i=>{try{a(n.throw(i))}catch(c){o(c)}},a=i=>i.done?r(i.value):Promise.resolve(i.value).then(s,l);a((n=n.apply(t,e)).next())});class Fn{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=function(l,a){(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(a)};const{sampling:n="all",win:r,blockClass:o,recordCanvas:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&n==="all"&&this.initCanvasMutationObserver(r,o),s&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,o)}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,n,r){const o=pe(n,r),s=new Map,l=new Ln;l.onmessage=p=>{const{id:f}=p.data;if(s.set(f,!1),!("base64"in p.data))return;const{base64:u,type:h,width:m,height:C}=p.data;this.mutationCb({id:f,type:lt["2D"],commands:[{property:"clearRect",args:[0,0,m,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:u}],type:h}]},0,0]}]})};const a=1e3/e;let i=0,c;const d=p=>{if(i&&p-i<a){c=requestAnimationFrame(d);return}i=p,n.document.querySelectorAll(`canvas:not(.${r} *)`).forEach(f=>Dn(this,null,function*(){var u;const h=this.mirror.getId(f);if(s.get(h))return;if(s.set(h,!0),["webgl","webgl2"].includes(f.__context)){const C=f.getContext(f.__context);((u=C?.getContextAttributes())==null?void 0:u.preserveDrawingBuffer)===!1&&C?.clear(C.COLOR_BUFFER_BIT)}const m=yield createImageBitmap(f);l.postMessage({id:h,bitmap:m,width:f.width,height:f.height},[m])})),c=requestAnimationFrame(d)};c=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=pe(e,n),o=wn(this.processMutation.bind(this),e,n,this.mirror),s=Mn(this.processMutation.bind(this),e,n,this.mirror);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=n=>{this.rafStamps.latestId=n,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||n===-1)return;const o=r.map(l=>En(l,["type"])),{type:s}=r[0];this.mutationCb({id:n,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class Pn{constructor(e){this.trackedStylesheets=new WeakSet,this.mutationCb=e.mutationCb}addStylesheet(e){this.trackedStylesheets.has(e)||(this.trackedStylesheets.add(e),this.trackStylesheet(e))}trackStylesheet(e){}attachStylesheet(e,n,r){this.mutationCb({adds:[{parentId:r.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[]}),this.addStylesheet(e)}}var An=Object.defineProperty,_n=Object.defineProperties,Wn=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,Gn=Object.prototype.hasOwnProperty,Vn=Object.prototype.propertyIsEnumerable,ye=(t,e,n)=>e in t?An(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K=(t,e)=>{for(var n in e||(e={}))Gn.call(e,n)&&ye(t,n,e[n]);if(fe)for(var n of fe(e))Vn.call(e,n)&&ye(t,n,e[n]);return t},jn=(t,e)=>_n(t,Wn(e));function D(t){return jn(K({},t),{timestamp:Date.now()})}let x,yt;const et=be();function vt(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="highlight-block",blockSelector:s=null,ignoreClass:l="highlight-ignore",maskTextClass:a="highlight-mask",maskTextSelector:i=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:f,maskInputFn:u,maskTextFn:h,hooks:m,packFn:C,sampling:O={},mousemoveWait:E,recordCanvas:I=!1,userTriggeredOnInput:T=!1,collectFonts:B=!1,inlineImages:G=!1,plugins:w,keepIframeSrcFn:y=()=>!1,enableStrictPrivacy:J=!1}=t;if(!e)throw new Error("emit function is required");E!==void 0&&O.mousemove===void 0&&(O.mousemove=E),et.reset();const V=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},j=f===!0||f==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};He();let $,A=0;const Q=v=>{for(const _ of w||[])_.eventProcessor&&(v=_.eventProcessor(v));return C&&(v=C(v)),v};x=(v,_)=>{var F;if(((F=rt[0])==null?void 0:F.isFrozen())&&v.type!==L.FullSnapshot&&!(v.type===L.IncrementalSnapshot&&v.data.source===P.Mutation)&&rt.forEach(g=>g.unfreeze()),e(Q(v),_),v.type===L.FullSnapshot)$=v,A=0;else if(v.type===L.IncrementalSnapshot){if(v.data.source===P.Mutation&&v.data.isAttachIframe)return;A++;const g=r&&A>=r,H=n&&v.timestamp-$.timestamp>n;(g||H)&&yt(!0)}};const z=v=>{x(D({type:L.IncrementalSnapshot,data:K({source:P.Mutation},v)}))},Z=v=>x(D({type:L.IncrementalSnapshot,data:K({source:P.Scroll},v)})),q=v=>x(D({type:L.IncrementalSnapshot,data:K({source:P.CanvasMutation},v)})),N=new mn({mutationCb:z}),U=new Pn({mutationCb:z}),X=new Fn({recordCanvas:I,mutationCb:q,win:window,blockClass:o,mirror:et,sampling:O.canvas}),S=new Sn({mutationCb:z,scrollCb:Z,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,inlineStylesheet:c,maskInputOptions:V,maskTextFn:h,maskInputFn:u,recordCanvas:I,inlineImages:G,sampling:O,slimDOMOptions:j,iframeManager:N,stylesheetManager:U,canvasManager:X,enableStrictPrivacy:J},mirror:et});yt=(v=!1)=>{var _,F,g,H;x(D({type:L.Meta,data:{href:window.location.href,width:Vt(),height:Gt()}}),v),rt.forEach(k=>k.lock());const b=ze(document,{mirror:et,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,inlineStylesheet:c,maskAllInputs:V,maskTextFn:h,slimDOM:j,recordCanvas:I,inlineImages:G,enableStrictPrivacy:J,onSerialize:k=>{Zt(k,et)&&N.addIframe(k),Ut(k)&&S.addShadowRoot(k.shadowRoot,document)},onIframeLoad:(k,tt)=>{N.attachIframe(k,tt,et),S.observeAttachShadow(k)},onStylesheetLoad:(k,tt)=>{this.stylesheetManager.attachStylesheet(k,tt,this.mirror)},keepIframeSrcFn:y});if(!b)return console.warn("Failed to snapshot the document");x(D({type:L.FullSnapshot,data:{node:b,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:document?.documentElement.scrollLeft||((F=(_=document?.body)==null?void 0:_.parentElement)==null?void 0:F.scrollLeft)||document?.body.scrollLeft||0,top:window.pageYOffset!==void 0?window.pageYOffset:document?.documentElement.scrollTop||((H=(g=document?.body)==null?void 0:g.parentElement)==null?void 0:H.scrollTop)||document?.body.scrollTop||0}}})),rt.forEach(k=>k.unlock())};try{const v=[];v.push(Y("DOMContentLoaded",()=>{x(D({type:L.DomContentLoaded,data:{}}))}));const _=g=>{var H;return hn({mutationCb:z,mousemoveCb:(b,k)=>x(D({type:L.IncrementalSnapshot,data:{source:k,positions:b}})),mouseInteractionCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.MouseInteraction},b)})),scrollCb:Z,viewportResizeCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.ViewportResize},b)})),inputCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.Input},b)})),mediaInteractionCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.MediaInteraction},b)})),styleSheetRuleCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.StyleSheetRule},b)})),styleDeclarationCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.StyleDeclaration},b)})),canvasMutationCb:q,fontCb:b=>x(D({type:L.IncrementalSnapshot,data:K({source:P.Font},b)})),blockClass:o,ignoreClass:l,maskTextClass:a,maskTextSelector:i,maskInputOptions:V,inlineStylesheet:c,sampling:O,recordCanvas:I,inlineImages:G,userTriggeredOnInput:T,collectFonts:B,doc:g,maskInputFn:u,maskTextFn:h,blockSelector:s,slimDOMOptions:j,mirror:et,iframeManager:N,stylesheetManager:U,shadowDomManager:S,canvasManager:X,enableStrictPrivacy:J,plugins:((H=w?.filter(b=>b.observer))==null?void 0:H.map(b=>({observer:b.observer,options:b.options,callback:k=>x(D({type:L.Plugin,data:{plugin:b.name,payload:k}}))})))||[]},m)};N.addLoadListener(g=>{v.push(_(g.contentDocument))});const F=()=>{yt(),v.push(_(document))};return document.readyState==="interactive"||document.readyState==="complete"?F():v.push(Y("load",()=>{x(D({type:L.Load,data:{}})),F()},window)),()=>{v.forEach(g=>g())}}catch(v){console.warn(v)}}return vt.addCustomEvent=(t,e)=>{!x||x(D({type:L.Custom,data:{tag:t,payload:e}}))},vt.freezePage=()=>{rt.forEach(t=>t.freeze())},vt.takeFullSnapshot=t=>{if(!yt)throw new Error("please take full snapshot after start recording");yt(t)},vt.mirror=et,vt}();
|