@posthog/rrweb-snapshot 0.0.41 → 0.0.43
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/record-B2nV9UFB.js +995 -0
- package/dist/record-B2nV9UFB.js.map +1 -0
- package/dist/record-oACzRSl-.cjs +994 -0
- package/dist/record-oACzRSl-.cjs.map +1 -0
- package/dist/record-oACzRSl-.umd.cjs +1569 -0
- package/dist/record-oACzRSl-.umd.cjs.map +7 -0
- package/dist/record-oACzRSl-.umd.min.cjs +20 -0
- package/dist/record-oACzRSl-.umd.min.cjs.map +7 -0
- package/dist/record.cjs +13 -986
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +29 -1003
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +955 -929
- package/dist/record.umd.cjs.map +3 -3
- package/dist/record.umd.min.cjs +1 -1
- package/dist/record.umd.min.cjs.map +4 -4
- package/dist/rrweb-snapshot.cjs +2 -1
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.d.cts +2 -0
- package/dist/rrweb-snapshot.d.ts +2 -0
- package/dist/rrweb-snapshot.js +24 -23
- package/dist/rrweb-snapshot.umd.cjs +10 -26
- package/dist/rrweb-snapshot.umd.cjs.map +2 -2
- package/dist/rrweb-snapshot.umd.min.cjs +11 -11
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +3 -3
package/dist/record.cjs
CHANGED
|
@@ -1,980 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const record = require("./record-oACzRSl-.cjs");
|
|
3
4
|
const types = require("./types-B7TTv7Jc.cjs");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return "div";
|
|
17
|
-
}
|
|
18
|
-
return processedTagName;
|
|
19
|
-
}
|
|
20
|
-
let canvasService;
|
|
21
|
-
let canvasCtx;
|
|
22
|
-
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
23
|
-
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
24
|
-
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
25
|
-
if (attributeValue.trim() === "") {
|
|
26
|
-
return attributeValue;
|
|
27
|
-
}
|
|
28
|
-
let pos = 0;
|
|
29
|
-
function collectCharacters(regEx) {
|
|
30
|
-
let chars;
|
|
31
|
-
const match = regEx.exec(attributeValue.substring(pos));
|
|
32
|
-
if (match) {
|
|
33
|
-
chars = match[0];
|
|
34
|
-
pos += chars.length;
|
|
35
|
-
return chars;
|
|
36
|
-
}
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
const output = [];
|
|
40
|
-
while (true) {
|
|
41
|
-
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
42
|
-
if (pos >= attributeValue.length) {
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
let url = collectCharacters(SRCSET_NOT_SPACES);
|
|
46
|
-
if (url.slice(-1) === ",") {
|
|
47
|
-
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
48
|
-
output.push(url);
|
|
49
|
-
} else {
|
|
50
|
-
let descriptorsStr = "";
|
|
51
|
-
url = absoluteToDoc(doc, url);
|
|
52
|
-
let inParens = false;
|
|
53
|
-
while (true) {
|
|
54
|
-
const c = attributeValue.charAt(pos);
|
|
55
|
-
if (c === "") {
|
|
56
|
-
output.push((url + descriptorsStr).trim());
|
|
57
|
-
break;
|
|
58
|
-
} else if (!inParens) {
|
|
59
|
-
if (c === ",") {
|
|
60
|
-
pos += 1;
|
|
61
|
-
output.push((url + descriptorsStr).trim());
|
|
62
|
-
break;
|
|
63
|
-
} else if (c === "(") {
|
|
64
|
-
inParens = true;
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
if (c === ")") {
|
|
68
|
-
inParens = false;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
descriptorsStr += c;
|
|
72
|
-
pos += 1;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return output.join(", ");
|
|
77
|
-
}
|
|
78
|
-
const cachedDocument = /* @__PURE__ */ new WeakMap();
|
|
79
|
-
function absoluteToDoc(doc, attributeValue) {
|
|
80
|
-
if (!attributeValue || attributeValue.trim() === "") {
|
|
81
|
-
return attributeValue;
|
|
82
|
-
}
|
|
83
|
-
return getHref(doc, attributeValue);
|
|
84
|
-
}
|
|
85
|
-
function isSVGElement(el) {
|
|
86
|
-
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
87
|
-
}
|
|
88
|
-
function getHref(doc, customHref) {
|
|
89
|
-
let a = cachedDocument.get(doc);
|
|
90
|
-
if (!a) {
|
|
91
|
-
a = doc.createElement("a");
|
|
92
|
-
cachedDocument.set(doc, a);
|
|
93
|
-
}
|
|
94
|
-
if (!customHref) {
|
|
95
|
-
customHref = "";
|
|
96
|
-
} else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) {
|
|
97
|
-
return customHref;
|
|
98
|
-
}
|
|
99
|
-
a.setAttribute("href", customHref);
|
|
100
|
-
return a.href;
|
|
101
|
-
}
|
|
102
|
-
function transformAttribute(doc, tagName, name, value, element, dataURLOptions) {
|
|
103
|
-
if (!value) {
|
|
104
|
-
return value;
|
|
105
|
-
}
|
|
106
|
-
if (name === "src" || name === "href" && !(tagName === "use" && value[0] === "#")) {
|
|
107
|
-
const transformedValue = absoluteToDoc(doc, value);
|
|
108
|
-
if (tagName === "img" && transformedValue.startsWith("data:") && element) {
|
|
109
|
-
const img = element;
|
|
110
|
-
let processedDataURL = transformedValue;
|
|
111
|
-
if ((dataURLOptions == null ? void 0 : dataURLOptions.type) || (dataURLOptions == null ? void 0 : dataURLOptions.quality) !== void 0) {
|
|
112
|
-
processedDataURL = types.recompressBase64Image(
|
|
113
|
-
img,
|
|
114
|
-
transformedValue,
|
|
115
|
-
dataURLOptions.type,
|
|
116
|
-
dataURLOptions.quality
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
if (dataURLOptions == null ? void 0 : dataURLOptions.maxBase64ImageLength) {
|
|
120
|
-
processedDataURL = types.checkDataURLSize(
|
|
121
|
-
processedDataURL,
|
|
122
|
-
dataURLOptions.maxBase64ImageLength
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return processedDataURL;
|
|
126
|
-
}
|
|
127
|
-
return transformedValue;
|
|
128
|
-
} else if (name === "xlink:href" && value[0] !== "#") {
|
|
129
|
-
return absoluteToDoc(doc, value);
|
|
130
|
-
} else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
131
|
-
return absoluteToDoc(doc, value);
|
|
132
|
-
} else if (name === "srcset") {
|
|
133
|
-
return getAbsoluteSrcsetString(doc, value);
|
|
134
|
-
} else if (name === "style") {
|
|
135
|
-
return types.absolutifyURLs(value, getHref(doc));
|
|
136
|
-
} else if (tagName === "object" && name === "data") {
|
|
137
|
-
return absoluteToDoc(doc, value);
|
|
138
|
-
}
|
|
139
|
-
return value;
|
|
140
|
-
}
|
|
141
|
-
function ignoreAttribute(tagName, name, _value) {
|
|
142
|
-
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
143
|
-
}
|
|
144
|
-
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
145
|
-
try {
|
|
146
|
-
if (typeof blockClass === "string") {
|
|
147
|
-
if (element.classList.contains(blockClass)) {
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
} else {
|
|
151
|
-
for (let eIndex = element.classList.length; eIndex--; ) {
|
|
152
|
-
const className = element.classList[eIndex];
|
|
153
|
-
if (blockClass.test(className)) {
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (blockSelector) {
|
|
159
|
-
return element.matches(blockSelector);
|
|
160
|
-
}
|
|
161
|
-
} catch (e) {
|
|
162
|
-
}
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
function classMatchesRegex(node, regex, checkAncestors) {
|
|
166
|
-
if (!node) return false;
|
|
167
|
-
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
168
|
-
if (!checkAncestors) return false;
|
|
169
|
-
return classMatchesRegex(types.index.parentNode(node), regex, checkAncestors);
|
|
170
|
-
}
|
|
171
|
-
for (let eIndex = node.classList.length; eIndex--; ) {
|
|
172
|
-
const className = node.classList[eIndex];
|
|
173
|
-
if (regex.test(className)) {
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (!checkAncestors) return false;
|
|
178
|
-
return classMatchesRegex(types.index.parentNode(node), regex, checkAncestors);
|
|
179
|
-
}
|
|
180
|
-
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
181
|
-
let el;
|
|
182
|
-
if (types.isElement(node)) {
|
|
183
|
-
el = node;
|
|
184
|
-
if (!types.index.childNodes(el).length) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
} else if (types.index.parentElement(node) === null) {
|
|
188
|
-
return false;
|
|
189
|
-
} else {
|
|
190
|
-
el = types.index.parentElement(node);
|
|
191
|
-
}
|
|
192
|
-
try {
|
|
193
|
-
if (typeof maskTextClass === "string") {
|
|
194
|
-
if (checkAncestors) {
|
|
195
|
-
if (el.closest(`.${maskTextClass}`)) return true;
|
|
196
|
-
} else {
|
|
197
|
-
if (el.classList.contains(maskTextClass)) return true;
|
|
198
|
-
}
|
|
199
|
-
} else {
|
|
200
|
-
if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;
|
|
201
|
-
}
|
|
202
|
-
if (maskTextSelector) {
|
|
203
|
-
if (checkAncestors) {
|
|
204
|
-
if (el.closest(maskTextSelector)) return true;
|
|
205
|
-
} else {
|
|
206
|
-
if (el.matches(maskTextSelector)) return true;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
} catch (e) {
|
|
210
|
-
}
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
214
|
-
const win = iframeEl.contentWindow;
|
|
215
|
-
if (!win) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
let fired = false;
|
|
219
|
-
let readyState;
|
|
220
|
-
try {
|
|
221
|
-
readyState = win.document.readyState;
|
|
222
|
-
} catch (error) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (readyState !== "complete") {
|
|
226
|
-
const timer = setTimeout(() => {
|
|
227
|
-
if (!fired) {
|
|
228
|
-
listener();
|
|
229
|
-
fired = true;
|
|
230
|
-
}
|
|
231
|
-
}, iframeLoadTimeout);
|
|
232
|
-
iframeEl.addEventListener("load", () => {
|
|
233
|
-
clearTimeout(timer);
|
|
234
|
-
fired = true;
|
|
235
|
-
listener();
|
|
236
|
-
});
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const blankUrl = "about:blank";
|
|
240
|
-
if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
241
|
-
setTimeout(listener, 0);
|
|
242
|
-
return iframeEl.addEventListener("load", listener);
|
|
243
|
-
}
|
|
244
|
-
iframeEl.addEventListener("load", listener);
|
|
245
|
-
}
|
|
246
|
-
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
247
|
-
let fired = false;
|
|
248
|
-
let styleSheetLoaded;
|
|
249
|
-
try {
|
|
250
|
-
styleSheetLoaded = link.sheet;
|
|
251
|
-
} catch (error) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (styleSheetLoaded) return;
|
|
255
|
-
const timer = setTimeout(() => {
|
|
256
|
-
if (!fired) {
|
|
257
|
-
listener();
|
|
258
|
-
fired = true;
|
|
259
|
-
}
|
|
260
|
-
}, styleSheetLoadTimeout);
|
|
261
|
-
link.addEventListener("load", () => {
|
|
262
|
-
clearTimeout(timer);
|
|
263
|
-
fired = true;
|
|
264
|
-
listener();
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
function serializeNode(n, options) {
|
|
268
|
-
const {
|
|
269
|
-
doc,
|
|
270
|
-
mirror,
|
|
271
|
-
blockClass,
|
|
272
|
-
blockSelector,
|
|
273
|
-
needsMask,
|
|
274
|
-
inlineStylesheet,
|
|
275
|
-
maskInputOptions = {},
|
|
276
|
-
maskTextFn,
|
|
277
|
-
maskInputFn,
|
|
278
|
-
dataURLOptions = {},
|
|
279
|
-
inlineImages,
|
|
280
|
-
recordCanvas,
|
|
281
|
-
keepIframeSrcFn,
|
|
282
|
-
newlyAddedElement = false
|
|
283
|
-
} = options;
|
|
284
|
-
const rootId = getRootId(doc, mirror);
|
|
285
|
-
switch (n.nodeType) {
|
|
286
|
-
case n.DOCUMENT_NODE:
|
|
287
|
-
if (n.compatMode !== "CSS1Compat") {
|
|
288
|
-
return {
|
|
289
|
-
type: types.NodeType$1.Document,
|
|
290
|
-
childNodes: [],
|
|
291
|
-
compatMode: n.compatMode
|
|
292
|
-
// probably "BackCompat"
|
|
293
|
-
};
|
|
294
|
-
} else {
|
|
295
|
-
return {
|
|
296
|
-
type: types.NodeType$1.Document,
|
|
297
|
-
childNodes: []
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
case n.DOCUMENT_TYPE_NODE:
|
|
301
|
-
return {
|
|
302
|
-
type: types.NodeType$1.DocumentType,
|
|
303
|
-
name: n.name,
|
|
304
|
-
publicId: n.publicId,
|
|
305
|
-
systemId: n.systemId,
|
|
306
|
-
rootId
|
|
307
|
-
};
|
|
308
|
-
case n.ELEMENT_NODE:
|
|
309
|
-
return serializeElementNode(n, {
|
|
310
|
-
doc,
|
|
311
|
-
blockClass,
|
|
312
|
-
blockSelector,
|
|
313
|
-
inlineStylesheet,
|
|
314
|
-
maskInputOptions,
|
|
315
|
-
maskInputFn,
|
|
316
|
-
dataURLOptions,
|
|
317
|
-
inlineImages,
|
|
318
|
-
recordCanvas,
|
|
319
|
-
keepIframeSrcFn,
|
|
320
|
-
newlyAddedElement,
|
|
321
|
-
rootId
|
|
322
|
-
});
|
|
323
|
-
case n.TEXT_NODE:
|
|
324
|
-
return serializeTextNode(n, {
|
|
325
|
-
doc,
|
|
326
|
-
needsMask,
|
|
327
|
-
maskTextFn,
|
|
328
|
-
rootId
|
|
329
|
-
});
|
|
330
|
-
case n.CDATA_SECTION_NODE:
|
|
331
|
-
return {
|
|
332
|
-
type: types.NodeType$1.CDATA,
|
|
333
|
-
textContent: "",
|
|
334
|
-
rootId
|
|
335
|
-
};
|
|
336
|
-
case n.COMMENT_NODE:
|
|
337
|
-
return {
|
|
338
|
-
type: types.NodeType$1.Comment,
|
|
339
|
-
textContent: types.index.textContent(n) || "",
|
|
340
|
-
rootId
|
|
341
|
-
};
|
|
342
|
-
default:
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function getRootId(doc, mirror) {
|
|
347
|
-
if (!mirror.hasNode(doc)) return void 0;
|
|
348
|
-
const docId = mirror.getId(doc);
|
|
349
|
-
return docId === 1 ? void 0 : docId;
|
|
350
|
-
}
|
|
351
|
-
function serializeTextNode(n, options) {
|
|
352
|
-
var _a;
|
|
353
|
-
const { needsMask, maskTextFn, rootId } = options;
|
|
354
|
-
const parent = types.index.parentNode(n);
|
|
355
|
-
const parentTagName = parent && parent.tagName;
|
|
356
|
-
let text = types.index.textContent(n);
|
|
357
|
-
const isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
358
|
-
const isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
359
|
-
if (isStyle && text) {
|
|
360
|
-
try {
|
|
361
|
-
if (n.nextSibling || n.previousSibling) {
|
|
362
|
-
} else if ((_a = parent.sheet) == null ? void 0 : _a.cssRules) {
|
|
363
|
-
text = types.stringifyStylesheet(parent.sheet);
|
|
364
|
-
}
|
|
365
|
-
} catch (err) {
|
|
366
|
-
console.warn(
|
|
367
|
-
`Cannot get CSS styles from text's parentNode. Error: ${err}`,
|
|
368
|
-
n
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
text = types.absolutifyURLs(text, getHref(options.doc));
|
|
372
|
-
}
|
|
373
|
-
if (isScript) {
|
|
374
|
-
text = "SCRIPT_PLACEHOLDER";
|
|
375
|
-
}
|
|
376
|
-
if (!isStyle && !isScript && text && needsMask) {
|
|
377
|
-
text = maskTextFn ? maskTextFn(text, types.index.parentElement(n)) : text.replace(/[\S]/g, "*");
|
|
378
|
-
}
|
|
379
|
-
return {
|
|
380
|
-
type: types.NodeType$1.Text,
|
|
381
|
-
textContent: text || "",
|
|
382
|
-
isStyle,
|
|
383
|
-
rootId
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
function findStylesheet(doc, href) {
|
|
387
|
-
return Array.from(doc.styleSheets).find((s) => s.href === href);
|
|
388
|
-
}
|
|
389
|
-
function hrefFrom(n) {
|
|
390
|
-
return n.href;
|
|
391
|
-
}
|
|
392
|
-
function serializeElementNode(n, options) {
|
|
393
|
-
var _a, _b;
|
|
394
|
-
const {
|
|
395
|
-
doc,
|
|
396
|
-
blockClass,
|
|
397
|
-
blockSelector,
|
|
398
|
-
inlineStylesheet,
|
|
399
|
-
maskInputOptions = {},
|
|
400
|
-
maskInputFn,
|
|
401
|
-
dataURLOptions = {},
|
|
402
|
-
inlineImages,
|
|
403
|
-
recordCanvas,
|
|
404
|
-
keepIframeSrcFn,
|
|
405
|
-
newlyAddedElement = false,
|
|
406
|
-
rootId
|
|
407
|
-
} = options;
|
|
408
|
-
const needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
409
|
-
const tagName = getValidTagName(n);
|
|
410
|
-
let attributes = {};
|
|
411
|
-
const len = n.attributes.length;
|
|
412
|
-
for (let i = 0; i < len; i++) {
|
|
413
|
-
const attr = n.attributes[i];
|
|
414
|
-
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
415
|
-
attributes[attr.name] = transformAttribute(
|
|
416
|
-
doc,
|
|
417
|
-
tagName,
|
|
418
|
-
types.toLowerCase(attr.name),
|
|
419
|
-
attr.value,
|
|
420
|
-
n,
|
|
421
|
-
dataURLOptions
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
if (tagName === "link" && inlineStylesheet) {
|
|
426
|
-
const href = hrefFrom(n);
|
|
427
|
-
if (href) {
|
|
428
|
-
let stylesheet = findStylesheet(doc, href);
|
|
429
|
-
if (!stylesheet && href.includes(".css")) {
|
|
430
|
-
const rootDomain = window.location.origin;
|
|
431
|
-
const stylesheetPath = href.replace(window.location.href, "");
|
|
432
|
-
const potentialStylesheetHref = rootDomain + "/" + stylesheetPath;
|
|
433
|
-
stylesheet = findStylesheet(doc, potentialStylesheetHref);
|
|
434
|
-
}
|
|
435
|
-
let cssText = null;
|
|
436
|
-
if (stylesheet) {
|
|
437
|
-
cssText = types.stringifyStylesheet(stylesheet);
|
|
438
|
-
}
|
|
439
|
-
if (cssText) {
|
|
440
|
-
delete attributes.rel;
|
|
441
|
-
delete attributes.href;
|
|
442
|
-
attributes._cssText = cssText;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
if (tagName === "style" && n.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
|
|
447
|
-
!(n.innerText || types.index.textContent(n) || "").trim().length) {
|
|
448
|
-
const cssText = types.stringifyStylesheet(
|
|
449
|
-
n.sheet
|
|
450
|
-
);
|
|
451
|
-
if (cssText) {
|
|
452
|
-
attributes._cssText = cssText;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
|
456
|
-
const value = n.value;
|
|
457
|
-
const checked = n.checked;
|
|
458
|
-
if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {
|
|
459
|
-
attributes.value = types.maskInputValue({
|
|
460
|
-
element: n,
|
|
461
|
-
type: types.getInputType(n),
|
|
462
|
-
tagName,
|
|
463
|
-
value,
|
|
464
|
-
maskInputOptions,
|
|
465
|
-
maskInputFn
|
|
466
|
-
});
|
|
467
|
-
} else if (checked) {
|
|
468
|
-
attributes.checked = checked;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (tagName === "option") {
|
|
472
|
-
if (n.selected && !maskInputOptions["select"]) {
|
|
473
|
-
attributes.selected = true;
|
|
474
|
-
} else {
|
|
475
|
-
delete attributes.selected;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
if (tagName === "dialog" && n.open) {
|
|
479
|
-
try {
|
|
480
|
-
attributes.rr_open_mode = n.matches("dialog:modal") ? "modal" : "non-modal";
|
|
481
|
-
} catch {
|
|
482
|
-
attributes.rr_open_mode = "modal";
|
|
483
|
-
attributes.ph_rr_could_not_detect_modal = true;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
if (tagName === "canvas" && recordCanvas) {
|
|
487
|
-
if (n.__context === "2d") {
|
|
488
|
-
if (!types.is2DCanvasBlank(n)) {
|
|
489
|
-
attributes.rr_dataURL = n.toDataURL(
|
|
490
|
-
dataURLOptions.type,
|
|
491
|
-
dataURLOptions.quality
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
} else if (!("__context" in n)) {
|
|
495
|
-
const canvasDataURL = n.toDataURL(
|
|
496
|
-
dataURLOptions.type,
|
|
497
|
-
dataURLOptions.quality
|
|
498
|
-
);
|
|
499
|
-
const blankCanvas = doc.createElement("canvas");
|
|
500
|
-
blankCanvas.width = n.width;
|
|
501
|
-
blankCanvas.height = n.height;
|
|
502
|
-
const blankCanvasDataURL = blankCanvas.toDataURL(
|
|
503
|
-
dataURLOptions.type,
|
|
504
|
-
dataURLOptions.quality
|
|
505
|
-
);
|
|
506
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
507
|
-
attributes.rr_dataURL = canvasDataURL;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
if (tagName === "img" && inlineImages) {
|
|
512
|
-
if (!canvasService) {
|
|
513
|
-
canvasService = doc.createElement("canvas");
|
|
514
|
-
canvasCtx = canvasService.getContext("2d");
|
|
515
|
-
}
|
|
516
|
-
const image = n;
|
|
517
|
-
const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
518
|
-
const priorCrossOrigin = image.crossOrigin;
|
|
519
|
-
const recordInlineImage = () => {
|
|
520
|
-
image.removeEventListener("load", recordInlineImage);
|
|
521
|
-
try {
|
|
522
|
-
canvasService.width = image.naturalWidth;
|
|
523
|
-
canvasService.height = image.naturalHeight;
|
|
524
|
-
canvasCtx.drawImage(image, 0, 0);
|
|
525
|
-
attributes.rr_dataURL = canvasService.toDataURL(
|
|
526
|
-
dataURLOptions.type,
|
|
527
|
-
dataURLOptions.quality
|
|
528
|
-
);
|
|
529
|
-
} catch (err) {
|
|
530
|
-
if (image.crossOrigin !== "anonymous") {
|
|
531
|
-
image.crossOrigin = "anonymous";
|
|
532
|
-
if (image.complete && image.naturalWidth !== 0)
|
|
533
|
-
recordInlineImage();
|
|
534
|
-
else image.addEventListener("load", recordInlineImage);
|
|
535
|
-
return;
|
|
536
|
-
} else {
|
|
537
|
-
console.warn(
|
|
538
|
-
`Cannot inline img src=${imageSrc}! Error: ${err}`
|
|
539
|
-
);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
if (image.crossOrigin === "anonymous") {
|
|
543
|
-
priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
if (image.complete && image.naturalWidth !== 0) recordInlineImage();
|
|
547
|
-
else image.addEventListener("load", recordInlineImage);
|
|
548
|
-
}
|
|
549
|
-
if (tagName === "audio" || tagName === "video") {
|
|
550
|
-
const mediaAttributes = attributes;
|
|
551
|
-
mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
|
|
552
|
-
mediaAttributes.rr_mediaCurrentTime = n.currentTime;
|
|
553
|
-
mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
|
|
554
|
-
mediaAttributes.rr_mediaMuted = n.muted;
|
|
555
|
-
mediaAttributes.rr_mediaLoop = n.loop;
|
|
556
|
-
mediaAttributes.rr_mediaVolume = n.volume;
|
|
557
|
-
}
|
|
558
|
-
if (!newlyAddedElement) {
|
|
559
|
-
if (n.scrollLeft) {
|
|
560
|
-
attributes.rr_scrollLeft = n.scrollLeft;
|
|
561
|
-
}
|
|
562
|
-
if (n.scrollTop) {
|
|
563
|
-
attributes.rr_scrollTop = n.scrollTop;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
if (needBlock) {
|
|
567
|
-
const { width, height, left, top } = n.getBoundingClientRect();
|
|
568
|
-
attributes = {
|
|
569
|
-
class: attributes.class,
|
|
570
|
-
rr_width: `${width}px`,
|
|
571
|
-
rr_height: `${height}px`,
|
|
572
|
-
rr_left: `${Math.floor(left + (((_a = doc.defaultView) == null ? void 0 : _a.scrollX) || 0))}px`,
|
|
573
|
-
rr_top: `${Math.floor(top + (((_b = doc.defaultView) == null ? void 0 : _b.scrollY) || 0))}px`
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
|
|
577
|
-
if (!n.contentDocument) {
|
|
578
|
-
attributes.rr_src = attributes.src;
|
|
579
|
-
}
|
|
580
|
-
delete attributes.src;
|
|
581
|
-
}
|
|
582
|
-
let isCustomElement;
|
|
583
|
-
try {
|
|
584
|
-
if (customElements.get(tagName)) isCustomElement = true;
|
|
585
|
-
} catch (e) {
|
|
586
|
-
}
|
|
587
|
-
return {
|
|
588
|
-
type: types.NodeType$1.Element,
|
|
589
|
-
tagName,
|
|
590
|
-
attributes,
|
|
591
|
-
childNodes: [],
|
|
592
|
-
isSVG: isSVGElement(n) || void 0,
|
|
593
|
-
needBlock,
|
|
594
|
-
rootId,
|
|
595
|
-
isCustom: isCustomElement
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
function lowerIfExists(maybeAttr) {
|
|
599
|
-
if (maybeAttr === void 0 || maybeAttr === null) {
|
|
600
|
-
return "";
|
|
601
|
-
} else {
|
|
602
|
-
return maybeAttr.toLowerCase();
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
606
|
-
if (slimDOMOptions.comment && sn.type === types.NodeType$1.Comment) {
|
|
607
|
-
return true;
|
|
608
|
-
} else if (sn.type === types.NodeType$1.Element) {
|
|
609
|
-
if (slimDOMOptions.script && // script tag
|
|
610
|
-
(sn.tagName === "script" || // (module)preload link
|
|
611
|
-
sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
|
|
612
|
-
sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && types.extractFileExtension(sn.attributes.href) === "js")) {
|
|
613
|
-
return true;
|
|
614
|
-
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
|
|
615
|
-
/^msapplication-tile(image|color)$/
|
|
616
|
-
) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
|
|
617
|
-
return true;
|
|
618
|
-
} else if (sn.tagName === "meta") {
|
|
619
|
-
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
620
|
-
return true;
|
|
621
|
-
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
|
|
622
|
-
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
623
|
-
return true;
|
|
624
|
-
} else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
|
|
625
|
-
return true;
|
|
626
|
-
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
627
|
-
return true;
|
|
628
|
-
} else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
629
|
-
return true;
|
|
630
|
-
} else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {
|
|
631
|
-
return true;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
const DEFAULT_MAX_DEPTH = 50;
|
|
638
|
-
let _maxDepthWarned = false;
|
|
639
|
-
let _maxDepthReached = false;
|
|
640
|
-
function wasMaxDepthReached() {
|
|
641
|
-
return _maxDepthReached;
|
|
642
|
-
}
|
|
643
|
-
function serializeNodeWithId(n, options) {
|
|
644
|
-
const {
|
|
645
|
-
doc,
|
|
646
|
-
mirror,
|
|
647
|
-
blockClass,
|
|
648
|
-
blockSelector,
|
|
649
|
-
maskTextClass,
|
|
650
|
-
maskTextSelector,
|
|
651
|
-
skipChild = false,
|
|
652
|
-
inlineStylesheet = true,
|
|
653
|
-
maskInputOptions = {},
|
|
654
|
-
maskTextFn,
|
|
655
|
-
maskInputFn,
|
|
656
|
-
slimDOMOptions,
|
|
657
|
-
dataURLOptions = {},
|
|
658
|
-
inlineImages = false,
|
|
659
|
-
recordCanvas = false,
|
|
660
|
-
onSerialize,
|
|
661
|
-
onIframeLoad,
|
|
662
|
-
iframeLoadTimeout = 5e3,
|
|
663
|
-
onStylesheetLoad,
|
|
664
|
-
stylesheetLoadTimeout = 5e3,
|
|
665
|
-
keepIframeSrcFn = () => false,
|
|
666
|
-
newlyAddedElement = false,
|
|
667
|
-
depth = 0,
|
|
668
|
-
maxDepth = DEFAULT_MAX_DEPTH
|
|
669
|
-
} = options;
|
|
670
|
-
let { needsMask } = options;
|
|
671
|
-
let { preserveWhiteSpace = true } = options;
|
|
672
|
-
if (depth >= maxDepth) {
|
|
673
|
-
_maxDepthReached = true;
|
|
674
|
-
if (!_maxDepthWarned) {
|
|
675
|
-
_maxDepthWarned = true;
|
|
676
|
-
console.warn(
|
|
677
|
-
`[rrweb-snapshot] DOM tree depth exceeded max depth of ${maxDepth}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`
|
|
678
|
-
);
|
|
679
|
-
}
|
|
680
|
-
return null;
|
|
681
|
-
}
|
|
682
|
-
if (!needsMask) {
|
|
683
|
-
const checkAncestors = needsMask === void 0;
|
|
684
|
-
needsMask = needMaskingText(
|
|
685
|
-
n,
|
|
686
|
-
maskTextClass,
|
|
687
|
-
maskTextSelector,
|
|
688
|
-
checkAncestors
|
|
689
|
-
);
|
|
690
|
-
}
|
|
691
|
-
const _serializedNode = serializeNode(n, {
|
|
692
|
-
doc,
|
|
693
|
-
mirror,
|
|
694
|
-
blockClass,
|
|
695
|
-
blockSelector,
|
|
696
|
-
needsMask,
|
|
697
|
-
inlineStylesheet,
|
|
698
|
-
maskInputOptions,
|
|
699
|
-
maskTextFn,
|
|
700
|
-
maskInputFn,
|
|
701
|
-
dataURLOptions,
|
|
702
|
-
inlineImages,
|
|
703
|
-
recordCanvas,
|
|
704
|
-
keepIframeSrcFn,
|
|
705
|
-
newlyAddedElement
|
|
706
|
-
});
|
|
707
|
-
if (!_serializedNode) {
|
|
708
|
-
console.warn(n, "not serialized");
|
|
709
|
-
return null;
|
|
710
|
-
}
|
|
711
|
-
let id;
|
|
712
|
-
if (mirror.hasNode(n)) {
|
|
713
|
-
id = mirror.getId(n);
|
|
714
|
-
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === types.NodeType$1.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
715
|
-
id = IGNORED_NODE;
|
|
716
|
-
} else {
|
|
717
|
-
id = genId();
|
|
718
|
-
}
|
|
719
|
-
const serializedNode = Object.assign(_serializedNode, { id });
|
|
720
|
-
mirror.add(n, serializedNode);
|
|
721
|
-
if (id === IGNORED_NODE) {
|
|
722
|
-
return null;
|
|
723
|
-
}
|
|
724
|
-
if (onSerialize) {
|
|
725
|
-
onSerialize(n);
|
|
726
|
-
}
|
|
727
|
-
let recordChild = !skipChild;
|
|
728
|
-
if (serializedNode.type === types.NodeType$1.Element) {
|
|
729
|
-
recordChild = recordChild && !serializedNode.needBlock;
|
|
730
|
-
delete serializedNode.needBlock;
|
|
731
|
-
const shadowRootEl = types.index.shadowRoot(n);
|
|
732
|
-
if (shadowRootEl && types.isNativeShadowDom(shadowRootEl))
|
|
733
|
-
serializedNode.isShadowHost = true;
|
|
734
|
-
}
|
|
735
|
-
if ((serializedNode.type === types.NodeType$1.Document || serializedNode.type === types.NodeType$1.Element) && recordChild) {
|
|
736
|
-
if (slimDOMOptions.headWhitespace && serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "head") {
|
|
737
|
-
preserveWhiteSpace = false;
|
|
738
|
-
}
|
|
739
|
-
const bypassOptions = {
|
|
740
|
-
doc,
|
|
741
|
-
mirror,
|
|
742
|
-
blockClass,
|
|
743
|
-
blockSelector,
|
|
744
|
-
needsMask,
|
|
745
|
-
maskTextClass,
|
|
746
|
-
maskTextSelector,
|
|
747
|
-
skipChild,
|
|
748
|
-
inlineStylesheet,
|
|
749
|
-
maskInputOptions,
|
|
750
|
-
maskTextFn,
|
|
751
|
-
maskInputFn,
|
|
752
|
-
slimDOMOptions,
|
|
753
|
-
dataURLOptions,
|
|
754
|
-
inlineImages,
|
|
755
|
-
recordCanvas,
|
|
756
|
-
preserveWhiteSpace,
|
|
757
|
-
onSerialize,
|
|
758
|
-
onIframeLoad,
|
|
759
|
-
iframeLoadTimeout,
|
|
760
|
-
onStylesheetLoad,
|
|
761
|
-
stylesheetLoadTimeout,
|
|
762
|
-
keepIframeSrcFn,
|
|
763
|
-
depth: depth + 1,
|
|
764
|
-
maxDepth
|
|
765
|
-
};
|
|
766
|
-
if (serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
767
|
-
else {
|
|
768
|
-
for (const childN of Array.from(types.index.childNodes(n))) {
|
|
769
|
-
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
770
|
-
if (serializedChildNode) {
|
|
771
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
let shadowRootEl = null;
|
|
776
|
-
if (types.isElement(n) && (shadowRootEl = types.index.shadowRoot(n))) {
|
|
777
|
-
for (const childN of Array.from(types.index.childNodes(shadowRootEl))) {
|
|
778
|
-
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
779
|
-
if (serializedChildNode) {
|
|
780
|
-
types.isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
|
|
781
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
const parent = types.index.parentNode(n);
|
|
787
|
-
if (parent && types.isShadowRoot(parent) && types.isNativeShadowDom(parent)) {
|
|
788
|
-
serializedNode.isShadow = true;
|
|
789
|
-
}
|
|
790
|
-
if (serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "iframe") {
|
|
791
|
-
onceIframeLoaded(
|
|
792
|
-
n,
|
|
793
|
-
() => {
|
|
794
|
-
const iframeDoc = n.contentDocument;
|
|
795
|
-
if (iframeDoc && onIframeLoad) {
|
|
796
|
-
const serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
797
|
-
doc: iframeDoc,
|
|
798
|
-
mirror,
|
|
799
|
-
blockClass,
|
|
800
|
-
blockSelector,
|
|
801
|
-
needsMask,
|
|
802
|
-
maskTextClass,
|
|
803
|
-
maskTextSelector,
|
|
804
|
-
skipChild: false,
|
|
805
|
-
inlineStylesheet,
|
|
806
|
-
maskInputOptions,
|
|
807
|
-
maskTextFn,
|
|
808
|
-
maskInputFn,
|
|
809
|
-
slimDOMOptions,
|
|
810
|
-
dataURLOptions,
|
|
811
|
-
inlineImages,
|
|
812
|
-
recordCanvas,
|
|
813
|
-
preserveWhiteSpace,
|
|
814
|
-
onSerialize,
|
|
815
|
-
onIframeLoad,
|
|
816
|
-
iframeLoadTimeout,
|
|
817
|
-
onStylesheetLoad,
|
|
818
|
-
stylesheetLoadTimeout,
|
|
819
|
-
keepIframeSrcFn,
|
|
820
|
-
depth: depth + 1,
|
|
821
|
-
maxDepth
|
|
822
|
-
});
|
|
823
|
-
if (serializedIframeNode) {
|
|
824
|
-
onIframeLoad(
|
|
825
|
-
n,
|
|
826
|
-
serializedIframeNode
|
|
827
|
-
);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
iframeLoadTimeout
|
|
832
|
-
);
|
|
833
|
-
}
|
|
834
|
-
if (serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && types.extractFileExtension(serializedNode.attributes.href) === "css")) {
|
|
835
|
-
onceStylesheetLoaded(
|
|
836
|
-
n,
|
|
837
|
-
() => {
|
|
838
|
-
if (onStylesheetLoad) {
|
|
839
|
-
const serializedLinkNode = serializeNodeWithId(n, {
|
|
840
|
-
doc,
|
|
841
|
-
mirror,
|
|
842
|
-
blockClass,
|
|
843
|
-
blockSelector,
|
|
844
|
-
needsMask,
|
|
845
|
-
maskTextClass,
|
|
846
|
-
maskTextSelector,
|
|
847
|
-
skipChild: false,
|
|
848
|
-
inlineStylesheet,
|
|
849
|
-
maskInputOptions,
|
|
850
|
-
maskTextFn,
|
|
851
|
-
maskInputFn,
|
|
852
|
-
slimDOMOptions,
|
|
853
|
-
dataURLOptions,
|
|
854
|
-
inlineImages,
|
|
855
|
-
recordCanvas,
|
|
856
|
-
preserveWhiteSpace,
|
|
857
|
-
onSerialize,
|
|
858
|
-
onIframeLoad,
|
|
859
|
-
iframeLoadTimeout,
|
|
860
|
-
onStylesheetLoad,
|
|
861
|
-
stylesheetLoadTimeout,
|
|
862
|
-
keepIframeSrcFn,
|
|
863
|
-
depth,
|
|
864
|
-
maxDepth
|
|
865
|
-
});
|
|
866
|
-
if (serializedLinkNode) {
|
|
867
|
-
onStylesheetLoad(
|
|
868
|
-
n,
|
|
869
|
-
serializedLinkNode
|
|
870
|
-
);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
},
|
|
874
|
-
stylesheetLoadTimeout
|
|
875
|
-
);
|
|
876
|
-
}
|
|
877
|
-
return serializedNode;
|
|
878
|
-
}
|
|
879
|
-
function snapshot(n, options) {
|
|
880
|
-
const {
|
|
881
|
-
mirror = new types.Mirror(),
|
|
882
|
-
blockClass = "rr-block",
|
|
883
|
-
blockSelector = null,
|
|
884
|
-
maskTextClass = "rr-mask",
|
|
885
|
-
maskTextSelector = null,
|
|
886
|
-
inlineStylesheet = true,
|
|
887
|
-
inlineImages = false,
|
|
888
|
-
recordCanvas = false,
|
|
889
|
-
maskAllInputs = false,
|
|
890
|
-
maskTextFn,
|
|
891
|
-
maskInputFn,
|
|
892
|
-
slimDOM = false,
|
|
893
|
-
dataURLOptions,
|
|
894
|
-
preserveWhiteSpace,
|
|
895
|
-
onSerialize,
|
|
896
|
-
onIframeLoad,
|
|
897
|
-
iframeLoadTimeout,
|
|
898
|
-
onStylesheetLoad,
|
|
899
|
-
stylesheetLoadTimeout,
|
|
900
|
-
keepIframeSrcFn = () => false,
|
|
901
|
-
maxDepth
|
|
902
|
-
} = options || {};
|
|
903
|
-
const maskInputOptions = maskAllInputs === true ? {
|
|
904
|
-
color: true,
|
|
905
|
-
date: true,
|
|
906
|
-
"datetime-local": true,
|
|
907
|
-
email: true,
|
|
908
|
-
month: true,
|
|
909
|
-
number: true,
|
|
910
|
-
range: true,
|
|
911
|
-
search: true,
|
|
912
|
-
tel: true,
|
|
913
|
-
text: true,
|
|
914
|
-
time: true,
|
|
915
|
-
url: true,
|
|
916
|
-
week: true,
|
|
917
|
-
textarea: true,
|
|
918
|
-
select: true,
|
|
919
|
-
password: true
|
|
920
|
-
} : maskAllInputs === false ? {
|
|
921
|
-
password: true
|
|
922
|
-
} : maskAllInputs;
|
|
923
|
-
const slimDOMOptions = slimDOM === true || slimDOM === "all" ? (
|
|
924
|
-
// if true: set of sensible options that should not throw away any information
|
|
925
|
-
{
|
|
926
|
-
script: true,
|
|
927
|
-
comment: true,
|
|
928
|
-
headFavicon: true,
|
|
929
|
-
headWhitespace: true,
|
|
930
|
-
headMetaDescKeywords: slimDOM === "all",
|
|
931
|
-
// destructive
|
|
932
|
-
headMetaSocial: true,
|
|
933
|
-
headMetaRobots: true,
|
|
934
|
-
headMetaHttpEquiv: true,
|
|
935
|
-
headMetaAuthorship: true,
|
|
936
|
-
headMetaVerification: true
|
|
937
|
-
}
|
|
938
|
-
) : slimDOM === false ? {} : slimDOM;
|
|
939
|
-
return serializeNodeWithId(n, {
|
|
940
|
-
doc: n,
|
|
941
|
-
mirror,
|
|
942
|
-
blockClass,
|
|
943
|
-
blockSelector,
|
|
944
|
-
maskTextClass,
|
|
945
|
-
maskTextSelector,
|
|
946
|
-
skipChild: false,
|
|
947
|
-
inlineStylesheet,
|
|
948
|
-
maskInputOptions,
|
|
949
|
-
maskTextFn,
|
|
950
|
-
maskInputFn,
|
|
951
|
-
slimDOMOptions,
|
|
952
|
-
dataURLOptions,
|
|
953
|
-
inlineImages,
|
|
954
|
-
recordCanvas,
|
|
955
|
-
preserveWhiteSpace,
|
|
956
|
-
onSerialize,
|
|
957
|
-
onIframeLoad,
|
|
958
|
-
iframeLoadTimeout,
|
|
959
|
-
onStylesheetLoad,
|
|
960
|
-
stylesheetLoadTimeout,
|
|
961
|
-
keepIframeSrcFn,
|
|
962
|
-
newlyAddedElement: false,
|
|
963
|
-
maxDepth
|
|
964
|
-
});
|
|
965
|
-
}
|
|
966
|
-
function visitSnapshot(node, onVisit) {
|
|
967
|
-
function walk(current) {
|
|
968
|
-
onVisit(current);
|
|
969
|
-
if (current.type === types.NodeType$1.Document || current.type === types.NodeType$1.Element) {
|
|
970
|
-
current.childNodes.forEach(walk);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
walk(node);
|
|
974
|
-
}
|
|
975
|
-
function cleanupSnapshot() {
|
|
976
|
-
_id = 1;
|
|
977
|
-
}
|
|
5
|
+
exports.DEFAULT_MAX_DEPTH = record.DEFAULT_MAX_DEPTH;
|
|
6
|
+
exports.IGNORED_NODE = record.IGNORED_NODE;
|
|
7
|
+
exports.classMatchesRegex = record.classMatchesRegex;
|
|
8
|
+
exports.cleanupSnapshot = record.cleanupSnapshot;
|
|
9
|
+
exports.genId = record.genId;
|
|
10
|
+
exports.ignoreAttribute = record.ignoreAttribute;
|
|
11
|
+
exports.needMaskingText = record.needMaskingText;
|
|
12
|
+
exports.serializeNodeWithId = record.serializeNodeWithId;
|
|
13
|
+
exports.snapshot = record.snapshot;
|
|
14
|
+
exports.transformAttribute = record.transformAttribute;
|
|
15
|
+
exports.visitSnapshot = record.visitSnapshot;
|
|
16
|
+
exports.wasMaxDepthReached = record.wasMaxDepthReached;
|
|
978
17
|
exports.Mirror = types.Mirror;
|
|
979
18
|
exports.NodeType = types.NodeType;
|
|
980
19
|
exports.absolutifyURLs = types.absolutifyURLs;
|
|
@@ -996,16 +35,4 @@ exports.recompressBase64Image = types.recompressBase64Image;
|
|
|
996
35
|
exports.stringifyRule = types.stringifyRule;
|
|
997
36
|
exports.stringifyStylesheet = types.stringifyStylesheet;
|
|
998
37
|
exports.toLowerCase = types.toLowerCase;
|
|
999
|
-
exports.DEFAULT_MAX_DEPTH = DEFAULT_MAX_DEPTH;
|
|
1000
|
-
exports.IGNORED_NODE = IGNORED_NODE;
|
|
1001
|
-
exports.classMatchesRegex = classMatchesRegex;
|
|
1002
|
-
exports.cleanupSnapshot = cleanupSnapshot;
|
|
1003
|
-
exports.genId = genId;
|
|
1004
|
-
exports.ignoreAttribute = ignoreAttribute;
|
|
1005
|
-
exports.needMaskingText = needMaskingText;
|
|
1006
|
-
exports.serializeNodeWithId = serializeNodeWithId;
|
|
1007
|
-
exports.snapshot = snapshot;
|
|
1008
|
-
exports.transformAttribute = transformAttribute;
|
|
1009
|
-
exports.visitSnapshot = visitSnapshot;
|
|
1010
|
-
exports.wasMaxDepthReached = wasMaxDepthReached;
|
|
1011
38
|
//# sourceMappingURL=record.cjs.map
|