@coralogix/browser 2.8.6 → 2.8.8
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/CHANGELOG.md +14 -0
- package/index.esm.js +3 -2
- package/index.esm2.js +396 -476
- package/package.json +1 -1
- package/sessionRecorder.esm.js +1311 -4
- package/src/custom-spans/custom-spans.consts.d.ts +1 -0
- package/src/custom-spans/custom-spans.utils.d.ts +4 -0
- package/src/session/sessionManager.d.ts +1 -0
- package/src/version.d.ts +1 -1
package/sessionRecorder.esm.js
CHANGED
|
@@ -1,19 +1,1326 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
+
import { C as CxGlobal, r as reportInternalEvent, g as getSdkConfig, S as SESSION_RECORDER_SEGMENTS_MAP, a as getNowTime, b as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, M as MAX_BATCH_TIME_MS, R as Request, c as SESSION_RECORDING_DEFAULT_HEADERS, d as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, e as SESSION_RECORDER_KEY, f as MAX_MUTATIONS_FOR_SESSION_RECORDING, h as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE } from './index.esm2.js';
|
|
3
3
|
import { record } from 'rrweb';
|
|
4
|
-
import { snapshot } from 'rrweb-snapshot';
|
|
5
4
|
import { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record';
|
|
6
5
|
import '@opentelemetry/sdk-trace-base';
|
|
7
6
|
import '@opentelemetry/sdk-trace-web';
|
|
8
7
|
import '@opentelemetry/instrumentation';
|
|
8
|
+
import 'error-stack-parser';
|
|
9
9
|
import '@opentelemetry/instrumentation-fetch';
|
|
10
10
|
import '@opentelemetry/instrumentation-xml-http-request';
|
|
11
11
|
import 'web-vitals/attribution';
|
|
12
|
-
import '@opentelemetry/core';
|
|
13
12
|
import '@opentelemetry/api';
|
|
14
13
|
import '@opentelemetry/propagator-b3';
|
|
15
14
|
import '@opentelemetry/propagator-aws-xray';
|
|
16
15
|
|
|
16
|
+
function _arrayLikeToArray(r, a) {
|
|
17
|
+
(null == a || a > r.length) && (a = r.length);
|
|
18
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
19
|
+
return n;
|
|
20
|
+
}
|
|
21
|
+
function _classCallCheck(a, n) {
|
|
22
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
23
|
+
}
|
|
24
|
+
function _defineProperties(e, r) {
|
|
25
|
+
for (var t = 0; t < r.length; t++) {
|
|
26
|
+
var o = r[t];
|
|
27
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function _createClass(e, r, t) {
|
|
31
|
+
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
32
|
+
writable: false
|
|
33
|
+
}), e;
|
|
34
|
+
}
|
|
35
|
+
function _createForOfIteratorHelper(r, e) {
|
|
36
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
37
|
+
if (!t) {
|
|
38
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
39
|
+
t && (r = t);
|
|
40
|
+
var n = 0,
|
|
41
|
+
F = function () {};
|
|
42
|
+
return {
|
|
43
|
+
s: F,
|
|
44
|
+
n: function () {
|
|
45
|
+
return n >= r.length ? {
|
|
46
|
+
done: true
|
|
47
|
+
} : {
|
|
48
|
+
done: false,
|
|
49
|
+
value: r[n++]
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
e: function (r) {
|
|
53
|
+
throw r;
|
|
54
|
+
},
|
|
55
|
+
f: F
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
59
|
+
}
|
|
60
|
+
var o,
|
|
61
|
+
a = true,
|
|
62
|
+
u = false;
|
|
63
|
+
return {
|
|
64
|
+
s: function () {
|
|
65
|
+
t = t.call(r);
|
|
66
|
+
},
|
|
67
|
+
n: function () {
|
|
68
|
+
var r = t.next();
|
|
69
|
+
return a = r.done, r;
|
|
70
|
+
},
|
|
71
|
+
e: function (r) {
|
|
72
|
+
u = true, o = r;
|
|
73
|
+
},
|
|
74
|
+
f: function () {
|
|
75
|
+
try {
|
|
76
|
+
a || null == t.return || t.return();
|
|
77
|
+
} finally {
|
|
78
|
+
if (u) throw o;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function _extends() {
|
|
84
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
85
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
86
|
+
var t = arguments[e];
|
|
87
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
88
|
+
}
|
|
89
|
+
return n;
|
|
90
|
+
}, _extends.apply(null, arguments);
|
|
91
|
+
}
|
|
92
|
+
function _toPrimitive(t, r) {
|
|
93
|
+
if ("object" != typeof t || !t) return t;
|
|
94
|
+
var e = t[Symbol.toPrimitive];
|
|
95
|
+
if (void 0 !== e) {
|
|
96
|
+
var i = e.call(t, r);
|
|
97
|
+
if ("object" != typeof i) return i;
|
|
98
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
99
|
+
}
|
|
100
|
+
return (String )(t);
|
|
101
|
+
}
|
|
102
|
+
function _toPropertyKey(t) {
|
|
103
|
+
var i = _toPrimitive(t, "string");
|
|
104
|
+
return "symbol" == typeof i ? i : i + "";
|
|
105
|
+
}
|
|
106
|
+
function _typeof(o) {
|
|
107
|
+
"@babel/helpers - typeof";
|
|
108
|
+
|
|
109
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
110
|
+
return typeof o;
|
|
111
|
+
} : function (o) {
|
|
112
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
113
|
+
}, _typeof(o);
|
|
114
|
+
}
|
|
115
|
+
function _unsupportedIterableToArray(r, a) {
|
|
116
|
+
if (r) {
|
|
117
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
118
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
119
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var EventType = function (EventType2) {
|
|
124
|
+
EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
125
|
+
EventType2[EventType2["Load"] = 1] = "Load";
|
|
126
|
+
EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
|
|
127
|
+
EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
128
|
+
EventType2[EventType2["Meta"] = 4] = "Meta";
|
|
129
|
+
EventType2[EventType2["Custom"] = 5] = "Custom";
|
|
130
|
+
EventType2[EventType2["Plugin"] = 6] = "Plugin";
|
|
131
|
+
return EventType2;
|
|
132
|
+
}(EventType || {});
|
|
133
|
+
var IncrementalSource = function (IncrementalSource2) {
|
|
134
|
+
IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
|
|
135
|
+
IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
|
|
136
|
+
IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
|
|
137
|
+
IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
|
|
138
|
+
IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
|
|
139
|
+
IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
|
|
140
|
+
IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
|
|
141
|
+
IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
|
|
142
|
+
IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
143
|
+
IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
|
|
144
|
+
IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
|
|
145
|
+
IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
|
|
146
|
+
IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
|
|
147
|
+
IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
148
|
+
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
149
|
+
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
150
|
+
IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
|
|
151
|
+
return IncrementalSource2;
|
|
152
|
+
}(IncrementalSource || {});
|
|
153
|
+
var MouseInteractions = function (MouseInteractions2) {
|
|
154
|
+
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
155
|
+
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
156
|
+
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
157
|
+
MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
|
|
158
|
+
MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
|
|
159
|
+
MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
|
|
160
|
+
MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
|
|
161
|
+
MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
|
|
162
|
+
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
163
|
+
MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
|
|
164
|
+
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
165
|
+
return MouseInteractions2;
|
|
166
|
+
}(MouseInteractions || {});
|
|
167
|
+
var PointerTypes = function (PointerTypes2) {
|
|
168
|
+
PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse";
|
|
169
|
+
PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen";
|
|
170
|
+
PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
|
|
171
|
+
return PointerTypes2;
|
|
172
|
+
}(PointerTypes || {});
|
|
173
|
+
var CanvasContext = function (CanvasContext2) {
|
|
174
|
+
CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
|
|
175
|
+
CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
|
|
176
|
+
CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
|
|
177
|
+
return CanvasContext2;
|
|
178
|
+
}(CanvasContext || {});
|
|
179
|
+
var MediaInteractions = function (MediaInteractions2) {
|
|
180
|
+
MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
|
|
181
|
+
MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
|
|
182
|
+
MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
|
|
183
|
+
MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
|
|
184
|
+
MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
|
|
185
|
+
return MediaInteractions2;
|
|
186
|
+
}(MediaInteractions || {});
|
|
187
|
+
var ReplayerEvents = function (ReplayerEvents2) {
|
|
188
|
+
ReplayerEvents2["Start"] = "start";
|
|
189
|
+
ReplayerEvents2["Pause"] = "pause";
|
|
190
|
+
ReplayerEvents2["Resume"] = "resume";
|
|
191
|
+
ReplayerEvents2["Resize"] = "resize";
|
|
192
|
+
ReplayerEvents2["Finish"] = "finish";
|
|
193
|
+
ReplayerEvents2["FullsnapshotRebuilded"] = "fullsnapshot-rebuilded";
|
|
194
|
+
ReplayerEvents2["LoadStylesheetStart"] = "load-stylesheet-start";
|
|
195
|
+
ReplayerEvents2["LoadStylesheetEnd"] = "load-stylesheet-end";
|
|
196
|
+
ReplayerEvents2["SkipStart"] = "skip-start";
|
|
197
|
+
ReplayerEvents2["SkipEnd"] = "skip-end";
|
|
198
|
+
ReplayerEvents2["MouseInteraction"] = "mouse-interaction";
|
|
199
|
+
ReplayerEvents2["EventCast"] = "event-cast";
|
|
200
|
+
ReplayerEvents2["CustomEvent"] = "custom-event";
|
|
201
|
+
ReplayerEvents2["Flush"] = "flush";
|
|
202
|
+
ReplayerEvents2["StateChange"] = "state-change";
|
|
203
|
+
ReplayerEvents2["PlayBack"] = "play-back";
|
|
204
|
+
ReplayerEvents2["Destroy"] = "destroy";
|
|
205
|
+
return ReplayerEvents2;
|
|
206
|
+
}(ReplayerEvents || {});
|
|
207
|
+
|
|
208
|
+
var __defProp = Object.defineProperty;
|
|
209
|
+
var __defNormalProp = function __defNormalProp(obj, key, value) {
|
|
210
|
+
return key in obj ? __defProp(obj, key, {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
configurable: true,
|
|
213
|
+
writable: true,
|
|
214
|
+
value: value
|
|
215
|
+
}) : obj[key] = value;
|
|
216
|
+
};
|
|
217
|
+
var __publicField = function __publicField(obj, key, value) {
|
|
218
|
+
__defNormalProp(obj, _typeof(key) !== "symbol" ? key + "" : key, value);
|
|
219
|
+
return value;
|
|
220
|
+
};
|
|
221
|
+
var NodeType = function (NodeType2) {
|
|
222
|
+
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
223
|
+
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
224
|
+
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
225
|
+
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
226
|
+
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
227
|
+
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
228
|
+
return NodeType2;
|
|
229
|
+
}(NodeType || {});
|
|
230
|
+
function isElement(n) {
|
|
231
|
+
return n.nodeType === n.ELEMENT_NODE;
|
|
232
|
+
}
|
|
233
|
+
function isShadowRoot(n) {
|
|
234
|
+
var host = n == null ? void 0 : n.host;
|
|
235
|
+
return Boolean((host == null ? void 0 : host.shadowRoot) === n);
|
|
236
|
+
}
|
|
237
|
+
function isNativeShadowDom(shadowRoot) {
|
|
238
|
+
return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]";
|
|
239
|
+
}
|
|
240
|
+
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
241
|
+
if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
|
|
242
|
+
cssText = cssText.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;");
|
|
243
|
+
}
|
|
244
|
+
return cssText;
|
|
245
|
+
}
|
|
246
|
+
function escapeImportStatement(rule) {
|
|
247
|
+
var cssText = rule.cssText;
|
|
248
|
+
if (cssText.split('"').length < 3) return cssText;
|
|
249
|
+
var statement = ["@import", "url(".concat(JSON.stringify(rule.href), ")")];
|
|
250
|
+
if (rule.layerName === "") {
|
|
251
|
+
statement.push("layer");
|
|
252
|
+
} else if (rule.layerName) {
|
|
253
|
+
statement.push("layer(".concat(rule.layerName, ")"));
|
|
254
|
+
}
|
|
255
|
+
if (rule.supportsText) {
|
|
256
|
+
statement.push("supports(".concat(rule.supportsText, ")"));
|
|
257
|
+
}
|
|
258
|
+
if (rule.media.length) {
|
|
259
|
+
statement.push(rule.media.mediaText);
|
|
260
|
+
}
|
|
261
|
+
return statement.join(" ") + ";";
|
|
262
|
+
}
|
|
263
|
+
function stringifyStylesheet(s) {
|
|
264
|
+
try {
|
|
265
|
+
var rules = s.rules || s.cssRules;
|
|
266
|
+
return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function stringifyRule(rule) {
|
|
272
|
+
var importStringified;
|
|
273
|
+
if (isCSSImportRule(rule)) {
|
|
274
|
+
try {
|
|
275
|
+
importStringified = stringifyStylesheet(rule.styleSheet) || escapeImportStatement(rule);
|
|
276
|
+
} catch (error) {}
|
|
277
|
+
} else if (isCSSStyleRule(rule) && rule.selectorText.includes(":")) {
|
|
278
|
+
return fixSafariColons(rule.cssText);
|
|
279
|
+
}
|
|
280
|
+
return importStringified || rule.cssText;
|
|
281
|
+
}
|
|
282
|
+
function fixSafariColons(cssStringified) {
|
|
283
|
+
var regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
|
|
284
|
+
return cssStringified.replace(regex, "$1\\$2");
|
|
285
|
+
}
|
|
286
|
+
function isCSSImportRule(rule) {
|
|
287
|
+
return "styleSheet" in rule;
|
|
288
|
+
}
|
|
289
|
+
function isCSSStyleRule(rule) {
|
|
290
|
+
return "selectorText" in rule;
|
|
291
|
+
}
|
|
292
|
+
var Mirror = function () {
|
|
293
|
+
function Mirror() {
|
|
294
|
+
_classCallCheck(this, Mirror);
|
|
295
|
+
__publicField(this, "idNodeMap", new Map());
|
|
296
|
+
__publicField(this, "nodeMetaMap", new WeakMap());
|
|
297
|
+
}
|
|
298
|
+
return _createClass(Mirror, [{
|
|
299
|
+
key: "getId",
|
|
300
|
+
value: function getId(n) {
|
|
301
|
+
var _a;
|
|
302
|
+
if (!n) return -1;
|
|
303
|
+
var id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
|
|
304
|
+
return id !== null && id !== void 0 ? id : -1;
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "getNode",
|
|
308
|
+
value: function getNode(id) {
|
|
309
|
+
return this.idNodeMap.get(id) || null;
|
|
310
|
+
}
|
|
311
|
+
}, {
|
|
312
|
+
key: "getIds",
|
|
313
|
+
value: function getIds() {
|
|
314
|
+
return Array.from(this.idNodeMap.keys());
|
|
315
|
+
}
|
|
316
|
+
}, {
|
|
317
|
+
key: "getMeta",
|
|
318
|
+
value: function getMeta(n) {
|
|
319
|
+
return this.nodeMetaMap.get(n) || null;
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
key: "removeNodeFromMap",
|
|
323
|
+
value: function removeNodeFromMap(n) {
|
|
324
|
+
var _this = this;
|
|
325
|
+
var id = this.getId(n);
|
|
326
|
+
this.idNodeMap["delete"](id);
|
|
327
|
+
if (n.childNodes) {
|
|
328
|
+
n.childNodes.forEach(function (childNode) {
|
|
329
|
+
return _this.removeNodeFromMap(childNode);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}, {
|
|
334
|
+
key: "has",
|
|
335
|
+
value: function has(id) {
|
|
336
|
+
return this.idNodeMap.has(id);
|
|
337
|
+
}
|
|
338
|
+
}, {
|
|
339
|
+
key: "hasNode",
|
|
340
|
+
value: function hasNode(node) {
|
|
341
|
+
return this.nodeMetaMap.has(node);
|
|
342
|
+
}
|
|
343
|
+
}, {
|
|
344
|
+
key: "add",
|
|
345
|
+
value: function add(n, meta) {
|
|
346
|
+
var id = meta.id;
|
|
347
|
+
this.idNodeMap.set(id, n);
|
|
348
|
+
this.nodeMetaMap.set(n, meta);
|
|
349
|
+
}
|
|
350
|
+
}, {
|
|
351
|
+
key: "replace",
|
|
352
|
+
value: function replace(id, n) {
|
|
353
|
+
var oldNode = this.getNode(id);
|
|
354
|
+
if (oldNode) {
|
|
355
|
+
var meta = this.nodeMetaMap.get(oldNode);
|
|
356
|
+
if (meta) this.nodeMetaMap.set(n, meta);
|
|
357
|
+
}
|
|
358
|
+
this.idNodeMap.set(id, n);
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "reset",
|
|
362
|
+
value: function reset() {
|
|
363
|
+
this.idNodeMap = new Map();
|
|
364
|
+
this.nodeMetaMap = new WeakMap();
|
|
365
|
+
}
|
|
366
|
+
}]);
|
|
367
|
+
}();
|
|
368
|
+
function maskInputValue(_ref) {
|
|
369
|
+
var element = _ref.element,
|
|
370
|
+
maskInputOptions = _ref.maskInputOptions,
|
|
371
|
+
tagName = _ref.tagName,
|
|
372
|
+
type = _ref.type,
|
|
373
|
+
value = _ref.value,
|
|
374
|
+
maskInputFn = _ref.maskInputFn;
|
|
375
|
+
var text = value || "";
|
|
376
|
+
var actualType = type && toLowerCase(type);
|
|
377
|
+
if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {
|
|
378
|
+
if (maskInputFn) {
|
|
379
|
+
text = maskInputFn(text, element);
|
|
380
|
+
} else {
|
|
381
|
+
text = "*".repeat(text.length);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return text;
|
|
385
|
+
}
|
|
386
|
+
function toLowerCase(str) {
|
|
387
|
+
return str.toLowerCase();
|
|
388
|
+
}
|
|
389
|
+
var ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
|
|
390
|
+
function is2DCanvasBlank(canvas) {
|
|
391
|
+
var ctx = canvas.getContext("2d");
|
|
392
|
+
if (!ctx) return true;
|
|
393
|
+
var chunkSize = 50;
|
|
394
|
+
for (var x = 0; x < canvas.width; x += chunkSize) {
|
|
395
|
+
for (var y = 0; y < canvas.height; y += chunkSize) {
|
|
396
|
+
var getImageData = ctx.getImageData;
|
|
397
|
+
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
|
|
398
|
+
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
|
|
399
|
+
if (pixelBuffer.some(function (pixel) {
|
|
400
|
+
return pixel !== 0;
|
|
401
|
+
})) return false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
function getInputType(element) {
|
|
407
|
+
var type = element.type;
|
|
408
|
+
return element.hasAttribute("data-rr-is-password") ? "password" : type ? toLowerCase(type) : null;
|
|
409
|
+
}
|
|
410
|
+
function extractFileExtension(path, baseURL) {
|
|
411
|
+
var _ref2;
|
|
412
|
+
var url;
|
|
413
|
+
try {
|
|
414
|
+
url = new URL(path, baseURL !== null && baseURL !== void 0 ? baseURL : window.location.href);
|
|
415
|
+
} catch (err) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
var regex = /\.([0-9a-z]+)(?:$)/i;
|
|
419
|
+
var match = url.pathname.match(regex);
|
|
420
|
+
return (_ref2 = match == null ? void 0 : match[1]) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
421
|
+
}
|
|
422
|
+
var _id = 1;
|
|
423
|
+
var tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
424
|
+
var IGNORED_NODE = -2;
|
|
425
|
+
function genId() {
|
|
426
|
+
return _id++;
|
|
427
|
+
}
|
|
428
|
+
function getValidTagName(element) {
|
|
429
|
+
if (element instanceof HTMLFormElement) {
|
|
430
|
+
return "form";
|
|
431
|
+
}
|
|
432
|
+
var processedTagName = toLowerCase(element.tagName);
|
|
433
|
+
if (tagNameRegex.test(processedTagName)) {
|
|
434
|
+
return "div";
|
|
435
|
+
}
|
|
436
|
+
return processedTagName;
|
|
437
|
+
}
|
|
438
|
+
function extractOrigin(url) {
|
|
439
|
+
var origin = "";
|
|
440
|
+
if (url.indexOf("//") > -1) {
|
|
441
|
+
origin = url.split("/").slice(0, 3).join("/");
|
|
442
|
+
} else {
|
|
443
|
+
origin = url.split("/")[0];
|
|
444
|
+
}
|
|
445
|
+
origin = origin.split("?")[0];
|
|
446
|
+
return origin;
|
|
447
|
+
}
|
|
448
|
+
var canvasService;
|
|
449
|
+
var canvasCtx;
|
|
450
|
+
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
451
|
+
var URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
|
|
452
|
+
var URL_WWW_MATCH = /^www\..*/i;
|
|
453
|
+
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
454
|
+
function absoluteToStylesheet(cssText, href) {
|
|
455
|
+
return (cssText || "").replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
|
|
456
|
+
var filePath = path1 || path2 || path3;
|
|
457
|
+
var maybeQuote = quote1 || quote2 || "";
|
|
458
|
+
if (!filePath) {
|
|
459
|
+
return origin;
|
|
460
|
+
}
|
|
461
|
+
if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
|
|
462
|
+
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
463
|
+
}
|
|
464
|
+
if (DATA_URI.test(filePath)) {
|
|
465
|
+
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
466
|
+
}
|
|
467
|
+
if (filePath[0] === "/") {
|
|
468
|
+
return "url(".concat(maybeQuote).concat(extractOrigin(href) + filePath).concat(maybeQuote, ")");
|
|
469
|
+
}
|
|
470
|
+
var stack = href.split("/");
|
|
471
|
+
var parts = filePath.split("/");
|
|
472
|
+
stack.pop();
|
|
473
|
+
var _iterator = _createForOfIteratorHelper(parts),
|
|
474
|
+
_step;
|
|
475
|
+
try {
|
|
476
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
477
|
+
var part = _step.value;
|
|
478
|
+
if (part === ".") {
|
|
479
|
+
continue;
|
|
480
|
+
} else if (part === "..") {
|
|
481
|
+
stack.pop();
|
|
482
|
+
} else {
|
|
483
|
+
stack.push(part);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
} catch (err) {
|
|
487
|
+
_iterator.e(err);
|
|
488
|
+
} finally {
|
|
489
|
+
_iterator.f();
|
|
490
|
+
}
|
|
491
|
+
return "url(".concat(maybeQuote).concat(stack.join("/")).concat(maybeQuote, ")");
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
495
|
+
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
496
|
+
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
497
|
+
if (attributeValue.trim() === "") {
|
|
498
|
+
return attributeValue;
|
|
499
|
+
}
|
|
500
|
+
var pos = 0;
|
|
501
|
+
function collectCharacters(regEx) {
|
|
502
|
+
var chars;
|
|
503
|
+
var match = regEx.exec(attributeValue.substring(pos));
|
|
504
|
+
if (match) {
|
|
505
|
+
chars = match[0];
|
|
506
|
+
pos += chars.length;
|
|
507
|
+
return chars;
|
|
508
|
+
}
|
|
509
|
+
return "";
|
|
510
|
+
}
|
|
511
|
+
var output = [];
|
|
512
|
+
while (true) {
|
|
513
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
514
|
+
if (pos >= attributeValue.length) {
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
518
|
+
if (url.slice(-1) === ",") {
|
|
519
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
520
|
+
output.push(url);
|
|
521
|
+
} else {
|
|
522
|
+
var descriptorsStr = "";
|
|
523
|
+
url = absoluteToDoc(doc, url);
|
|
524
|
+
var inParens = false;
|
|
525
|
+
while (true) {
|
|
526
|
+
var c = attributeValue.charAt(pos);
|
|
527
|
+
if (c === "") {
|
|
528
|
+
output.push((url + descriptorsStr).trim());
|
|
529
|
+
break;
|
|
530
|
+
} else if (!inParens) {
|
|
531
|
+
if (c === ",") {
|
|
532
|
+
pos += 1;
|
|
533
|
+
output.push((url + descriptorsStr).trim());
|
|
534
|
+
break;
|
|
535
|
+
} else if (c === "(") {
|
|
536
|
+
inParens = true;
|
|
537
|
+
}
|
|
538
|
+
} else {
|
|
539
|
+
if (c === ")") {
|
|
540
|
+
inParens = false;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
descriptorsStr += c;
|
|
544
|
+
pos += 1;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return output.join(", ");
|
|
549
|
+
}
|
|
550
|
+
var cachedDocument = new WeakMap();
|
|
551
|
+
function absoluteToDoc(doc, attributeValue) {
|
|
552
|
+
if (!attributeValue || attributeValue.trim() === "") {
|
|
553
|
+
return attributeValue;
|
|
554
|
+
}
|
|
555
|
+
return getHref(doc, attributeValue);
|
|
556
|
+
}
|
|
557
|
+
function isSVGElement(el) {
|
|
558
|
+
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
559
|
+
}
|
|
560
|
+
function getHref(doc, customHref) {
|
|
561
|
+
var a = cachedDocument.get(doc);
|
|
562
|
+
if (!a) {
|
|
563
|
+
a = doc.createElement("a");
|
|
564
|
+
cachedDocument.set(doc, a);
|
|
565
|
+
}
|
|
566
|
+
if (!customHref) {
|
|
567
|
+
customHref = "";
|
|
568
|
+
} else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) {
|
|
569
|
+
return customHref;
|
|
570
|
+
}
|
|
571
|
+
a.setAttribute("href", customHref);
|
|
572
|
+
return a.href;
|
|
573
|
+
}
|
|
574
|
+
function transformAttribute(doc, tagName, name, value) {
|
|
575
|
+
if (!value) {
|
|
576
|
+
return value;
|
|
577
|
+
}
|
|
578
|
+
if (name === "src" || name === "href" && !(tagName === "use" && value[0] === "#")) {
|
|
579
|
+
return absoluteToDoc(doc, value);
|
|
580
|
+
} else if (name === "xlink:href" && value[0] !== "#") {
|
|
581
|
+
return absoluteToDoc(doc, value);
|
|
582
|
+
} else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
583
|
+
return absoluteToDoc(doc, value);
|
|
584
|
+
} else if (name === "srcset") {
|
|
585
|
+
return getAbsoluteSrcsetString(doc, value);
|
|
586
|
+
} else if (name === "style") {
|
|
587
|
+
return absoluteToStylesheet(value, getHref(doc));
|
|
588
|
+
} else if (tagName === "object" && name === "data") {
|
|
589
|
+
return absoluteToDoc(doc, value);
|
|
590
|
+
}
|
|
591
|
+
return value;
|
|
592
|
+
}
|
|
593
|
+
function ignoreAttribute(tagName, name, _value) {
|
|
594
|
+
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
595
|
+
}
|
|
596
|
+
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
597
|
+
try {
|
|
598
|
+
if (typeof blockClass === "string") {
|
|
599
|
+
if (element.classList.contains(blockClass)) {
|
|
600
|
+
return true;
|
|
601
|
+
}
|
|
602
|
+
} else {
|
|
603
|
+
for (var eIndex = element.classList.length; eIndex--;) {
|
|
604
|
+
var className = element.classList[eIndex];
|
|
605
|
+
if (blockClass.test(className)) {
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (blockSelector) {
|
|
611
|
+
return element.matches(blockSelector);
|
|
612
|
+
}
|
|
613
|
+
} catch (e) {}
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
function classMatchesRegex(node, regex, checkAncestors) {
|
|
617
|
+
if (!node) return false;
|
|
618
|
+
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
619
|
+
if (!checkAncestors) return false;
|
|
620
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
621
|
+
}
|
|
622
|
+
for (var eIndex = node.classList.length; eIndex--;) {
|
|
623
|
+
var className = node.classList[eIndex];
|
|
624
|
+
if (regex.test(className)) {
|
|
625
|
+
return true;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (!checkAncestors) return false;
|
|
629
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
630
|
+
}
|
|
631
|
+
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
632
|
+
try {
|
|
633
|
+
var el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
|
|
634
|
+
if (el === null) return false;
|
|
635
|
+
if (typeof maskTextClass === "string") {
|
|
636
|
+
if (checkAncestors) {
|
|
637
|
+
if (el.closest(".".concat(maskTextClass))) return true;
|
|
638
|
+
} else {
|
|
639
|
+
if (el.classList.contains(maskTextClass)) return true;
|
|
640
|
+
}
|
|
641
|
+
} else {
|
|
642
|
+
if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;
|
|
643
|
+
}
|
|
644
|
+
if (maskTextSelector) {
|
|
645
|
+
if (checkAncestors) {
|
|
646
|
+
if (el.closest(maskTextSelector)) return true;
|
|
647
|
+
} else {
|
|
648
|
+
if (el.matches(maskTextSelector)) return true;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
} catch (e) {}
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
655
|
+
var win = iframeEl.contentWindow;
|
|
656
|
+
if (!win) {
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
var fired = false;
|
|
660
|
+
var readyState;
|
|
661
|
+
try {
|
|
662
|
+
readyState = win.document.readyState;
|
|
663
|
+
} catch (error) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
if (readyState !== "complete") {
|
|
667
|
+
var timer = setTimeout(function () {
|
|
668
|
+
if (!fired) {
|
|
669
|
+
listener();
|
|
670
|
+
fired = true;
|
|
671
|
+
}
|
|
672
|
+
}, iframeLoadTimeout);
|
|
673
|
+
iframeEl.addEventListener("load", function () {
|
|
674
|
+
clearTimeout(timer);
|
|
675
|
+
fired = true;
|
|
676
|
+
listener();
|
|
677
|
+
});
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
var blankUrl = "about:blank";
|
|
681
|
+
if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
682
|
+
setTimeout(listener, 0);
|
|
683
|
+
return iframeEl.addEventListener("load", listener);
|
|
684
|
+
}
|
|
685
|
+
iframeEl.addEventListener("load", listener);
|
|
686
|
+
}
|
|
687
|
+
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
688
|
+
var fired = false;
|
|
689
|
+
var styleSheetLoaded;
|
|
690
|
+
try {
|
|
691
|
+
styleSheetLoaded = link.sheet;
|
|
692
|
+
} catch (error) {
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
if (styleSheetLoaded) return;
|
|
696
|
+
var timer = setTimeout(function () {
|
|
697
|
+
if (!fired) {
|
|
698
|
+
listener();
|
|
699
|
+
fired = true;
|
|
700
|
+
}
|
|
701
|
+
}, styleSheetLoadTimeout);
|
|
702
|
+
link.addEventListener("load", function () {
|
|
703
|
+
clearTimeout(timer);
|
|
704
|
+
fired = true;
|
|
705
|
+
listener();
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
function serializeNode(n, options) {
|
|
709
|
+
var doc = options.doc,
|
|
710
|
+
mirror = options.mirror,
|
|
711
|
+
blockClass = options.blockClass,
|
|
712
|
+
blockSelector = options.blockSelector,
|
|
713
|
+
needsMask = options.needsMask,
|
|
714
|
+
inlineStylesheet = options.inlineStylesheet,
|
|
715
|
+
_options$maskInputOpt = options.maskInputOptions,
|
|
716
|
+
maskInputOptions = _options$maskInputOpt === void 0 ? {} : _options$maskInputOpt,
|
|
717
|
+
maskTextFn = options.maskTextFn,
|
|
718
|
+
maskInputFn = options.maskInputFn,
|
|
719
|
+
_options$dataURLOptio = options.dataURLOptions,
|
|
720
|
+
dataURLOptions = _options$dataURLOptio === void 0 ? {} : _options$dataURLOptio,
|
|
721
|
+
inlineImages = options.inlineImages,
|
|
722
|
+
recordCanvas = options.recordCanvas,
|
|
723
|
+
keepIframeSrcFn = options.keepIframeSrcFn,
|
|
724
|
+
_options$newlyAddedEl = options.newlyAddedElement,
|
|
725
|
+
newlyAddedElement = _options$newlyAddedEl === void 0 ? false : _options$newlyAddedEl;
|
|
726
|
+
var rootId = getRootId(doc, mirror);
|
|
727
|
+
switch (n.nodeType) {
|
|
728
|
+
case n.DOCUMENT_NODE:
|
|
729
|
+
if (n.compatMode !== "CSS1Compat") {
|
|
730
|
+
return {
|
|
731
|
+
type: NodeType.Document,
|
|
732
|
+
childNodes: [],
|
|
733
|
+
compatMode: n.compatMode
|
|
734
|
+
};
|
|
735
|
+
} else {
|
|
736
|
+
return {
|
|
737
|
+
type: NodeType.Document,
|
|
738
|
+
childNodes: []
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
case n.DOCUMENT_TYPE_NODE:
|
|
742
|
+
return {
|
|
743
|
+
type: NodeType.DocumentType,
|
|
744
|
+
name: n.name,
|
|
745
|
+
publicId: n.publicId,
|
|
746
|
+
systemId: n.systemId,
|
|
747
|
+
rootId: rootId
|
|
748
|
+
};
|
|
749
|
+
case n.ELEMENT_NODE:
|
|
750
|
+
return serializeElementNode(n, {
|
|
751
|
+
doc: doc,
|
|
752
|
+
blockClass: blockClass,
|
|
753
|
+
blockSelector: blockSelector,
|
|
754
|
+
inlineStylesheet: inlineStylesheet,
|
|
755
|
+
maskInputOptions: maskInputOptions,
|
|
756
|
+
maskInputFn: maskInputFn,
|
|
757
|
+
dataURLOptions: dataURLOptions,
|
|
758
|
+
inlineImages: inlineImages,
|
|
759
|
+
recordCanvas: recordCanvas,
|
|
760
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
761
|
+
newlyAddedElement: newlyAddedElement,
|
|
762
|
+
rootId: rootId
|
|
763
|
+
});
|
|
764
|
+
case n.TEXT_NODE:
|
|
765
|
+
return serializeTextNode(n, {
|
|
766
|
+
doc: doc,
|
|
767
|
+
needsMask: needsMask,
|
|
768
|
+
maskTextFn: maskTextFn,
|
|
769
|
+
rootId: rootId
|
|
770
|
+
});
|
|
771
|
+
case n.CDATA_SECTION_NODE:
|
|
772
|
+
return {
|
|
773
|
+
type: NodeType.CDATA,
|
|
774
|
+
textContent: "",
|
|
775
|
+
rootId: rootId
|
|
776
|
+
};
|
|
777
|
+
case n.COMMENT_NODE:
|
|
778
|
+
return {
|
|
779
|
+
type: NodeType.Comment,
|
|
780
|
+
textContent: n.textContent || "",
|
|
781
|
+
rootId: rootId
|
|
782
|
+
};
|
|
783
|
+
default:
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
function getRootId(doc, mirror) {
|
|
788
|
+
if (!mirror.hasNode(doc)) return void 0;
|
|
789
|
+
var docId = mirror.getId(doc);
|
|
790
|
+
return docId === 1 ? void 0 : docId;
|
|
791
|
+
}
|
|
792
|
+
function serializeTextNode(n, options) {
|
|
793
|
+
var _a;
|
|
794
|
+
var needsMask = options.needsMask,
|
|
795
|
+
maskTextFn = options.maskTextFn,
|
|
796
|
+
rootId = options.rootId;
|
|
797
|
+
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
798
|
+
var textContent = n.textContent;
|
|
799
|
+
var isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
800
|
+
var isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
801
|
+
if (isStyle && textContent) {
|
|
802
|
+
try {
|
|
803
|
+
if (n.nextSibling || n.previousSibling) {} else if ((_a = n.parentNode.sheet) == null ? void 0 : _a.cssRules) {
|
|
804
|
+
textContent = stringifyStylesheet(n.parentNode.sheet);
|
|
805
|
+
}
|
|
806
|
+
} catch (err) {
|
|
807
|
+
console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(err), n);
|
|
808
|
+
}
|
|
809
|
+
textContent = absoluteToStylesheet(textContent, getHref(options.doc));
|
|
810
|
+
}
|
|
811
|
+
if (isScript) {
|
|
812
|
+
textContent = "SCRIPT_PLACEHOLDER";
|
|
813
|
+
}
|
|
814
|
+
if (!isStyle && !isScript && textContent && needsMask) {
|
|
815
|
+
textContent = maskTextFn ? maskTextFn(textContent, n.parentElement) : textContent.replace(/[\S]/g, "*");
|
|
816
|
+
}
|
|
817
|
+
return {
|
|
818
|
+
type: NodeType.Text,
|
|
819
|
+
textContent: textContent || "",
|
|
820
|
+
isStyle: isStyle,
|
|
821
|
+
rootId: rootId
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
function serializeElementNode(n, options) {
|
|
825
|
+
var doc = options.doc,
|
|
826
|
+
blockClass = options.blockClass,
|
|
827
|
+
blockSelector = options.blockSelector,
|
|
828
|
+
inlineStylesheet = options.inlineStylesheet,
|
|
829
|
+
_options$maskInputOpt2 = options.maskInputOptions,
|
|
830
|
+
maskInputOptions = _options$maskInputOpt2 === void 0 ? {} : _options$maskInputOpt2,
|
|
831
|
+
maskInputFn = options.maskInputFn,
|
|
832
|
+
_options$dataURLOptio2 = options.dataURLOptions,
|
|
833
|
+
dataURLOptions = _options$dataURLOptio2 === void 0 ? {} : _options$dataURLOptio2,
|
|
834
|
+
inlineImages = options.inlineImages,
|
|
835
|
+
recordCanvas = options.recordCanvas,
|
|
836
|
+
keepIframeSrcFn = options.keepIframeSrcFn,
|
|
837
|
+
_options$newlyAddedEl2 = options.newlyAddedElement,
|
|
838
|
+
newlyAddedElement = _options$newlyAddedEl2 === void 0 ? false : _options$newlyAddedEl2,
|
|
839
|
+
rootId = options.rootId;
|
|
840
|
+
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
841
|
+
var tagName = getValidTagName(n);
|
|
842
|
+
var attributes2 = {};
|
|
843
|
+
var len = n.attributes.length;
|
|
844
|
+
for (var i = 0; i < len; i++) {
|
|
845
|
+
var attr = n.attributes[i];
|
|
846
|
+
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
847
|
+
attributes2[attr.name] = transformAttribute(doc, tagName, toLowerCase(attr.name), attr.value);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (tagName === "link" && inlineStylesheet) {
|
|
851
|
+
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
852
|
+
return s.href === n.href;
|
|
853
|
+
});
|
|
854
|
+
var cssText = null;
|
|
855
|
+
if (stylesheet) {
|
|
856
|
+
cssText = stringifyStylesheet(stylesheet);
|
|
857
|
+
}
|
|
858
|
+
if (cssText) {
|
|
859
|
+
delete attributes2.rel;
|
|
860
|
+
delete attributes2.href;
|
|
861
|
+
attributes2._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
if (tagName === "style" && n.sheet && !(n.innerText || n.textContent || "").trim().length) {
|
|
865
|
+
var _cssText = stringifyStylesheet(n.sheet);
|
|
866
|
+
if (_cssText) {
|
|
867
|
+
attributes2._cssText = absoluteToStylesheet(_cssText, getHref(doc));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
|
871
|
+
var value = n.value;
|
|
872
|
+
var checked = n.checked;
|
|
873
|
+
if (attributes2.type !== "radio" && attributes2.type !== "checkbox" && attributes2.type !== "submit" && attributes2.type !== "button" && value) {
|
|
874
|
+
attributes2.value = maskInputValue({
|
|
875
|
+
element: n,
|
|
876
|
+
type: getInputType(n),
|
|
877
|
+
tagName: tagName,
|
|
878
|
+
value: value,
|
|
879
|
+
maskInputOptions: maskInputOptions,
|
|
880
|
+
maskInputFn: maskInputFn
|
|
881
|
+
});
|
|
882
|
+
} else if (checked) {
|
|
883
|
+
attributes2.checked = checked;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
if (tagName === "option") {
|
|
887
|
+
if (n.selected && !maskInputOptions["select"]) {
|
|
888
|
+
attributes2.selected = true;
|
|
889
|
+
} else {
|
|
890
|
+
delete attributes2.selected;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
if (tagName === "canvas" && recordCanvas) {
|
|
894
|
+
if (n.__context === "2d") {
|
|
895
|
+
if (!is2DCanvasBlank(n)) {
|
|
896
|
+
attributes2.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
897
|
+
}
|
|
898
|
+
} else if (!("__context" in n)) {
|
|
899
|
+
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
900
|
+
var blankCanvas = doc.createElement("canvas");
|
|
901
|
+
blankCanvas.width = n.width;
|
|
902
|
+
blankCanvas.height = n.height;
|
|
903
|
+
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
904
|
+
if (canvasDataURL !== blankCanvasDataURL) {
|
|
905
|
+
attributes2.rr_dataURL = canvasDataURL;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (tagName === "img" && inlineImages) {
|
|
910
|
+
if (!canvasService) {
|
|
911
|
+
canvasService = doc.createElement("canvas");
|
|
912
|
+
canvasCtx = canvasService.getContext("2d");
|
|
913
|
+
}
|
|
914
|
+
var image = n;
|
|
915
|
+
var imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
916
|
+
var priorCrossOrigin = image.crossOrigin;
|
|
917
|
+
var _recordInlineImage = function recordInlineImage() {
|
|
918
|
+
image.removeEventListener("load", _recordInlineImage);
|
|
919
|
+
try {
|
|
920
|
+
canvasService.width = image.naturalWidth;
|
|
921
|
+
canvasService.height = image.naturalHeight;
|
|
922
|
+
canvasCtx.drawImage(image, 0, 0);
|
|
923
|
+
attributes2.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
924
|
+
} catch (err) {
|
|
925
|
+
if (image.crossOrigin !== "anonymous") {
|
|
926
|
+
image.crossOrigin = "anonymous";
|
|
927
|
+
if (image.complete && image.naturalWidth !== 0) _recordInlineImage();else image.addEventListener("load", _recordInlineImage);
|
|
928
|
+
return;
|
|
929
|
+
} else {
|
|
930
|
+
console.warn("Cannot inline img src=".concat(imageSrc, "! Error: ").concat(err));
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
if (image.crossOrigin === "anonymous") {
|
|
934
|
+
priorCrossOrigin ? attributes2.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
if (image.complete && image.naturalWidth !== 0) _recordInlineImage();else image.addEventListener("load", _recordInlineImage);
|
|
938
|
+
}
|
|
939
|
+
if (tagName === "audio" || tagName === "video") {
|
|
940
|
+
var mediaAttributes = attributes2;
|
|
941
|
+
mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
|
|
942
|
+
mediaAttributes.rr_mediaCurrentTime = n.currentTime;
|
|
943
|
+
mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
|
|
944
|
+
mediaAttributes.rr_mediaMuted = n.muted;
|
|
945
|
+
mediaAttributes.rr_mediaLoop = n.loop;
|
|
946
|
+
mediaAttributes.rr_mediaVolume = n.volume;
|
|
947
|
+
}
|
|
948
|
+
if (!newlyAddedElement) {
|
|
949
|
+
if (n.scrollLeft) {
|
|
950
|
+
attributes2.rr_scrollLeft = n.scrollLeft;
|
|
951
|
+
}
|
|
952
|
+
if (n.scrollTop) {
|
|
953
|
+
attributes2.rr_scrollTop = n.scrollTop;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
if (needBlock) {
|
|
957
|
+
var _n$getBoundingClientR = n.getBoundingClientRect(),
|
|
958
|
+
width = _n$getBoundingClientR.width,
|
|
959
|
+
height = _n$getBoundingClientR.height;
|
|
960
|
+
attributes2 = {
|
|
961
|
+
"class": attributes2["class"],
|
|
962
|
+
rr_width: "".concat(width, "px"),
|
|
963
|
+
rr_height: "".concat(height, "px")
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
if (tagName === "iframe" && !keepIframeSrcFn(attributes2.src)) {
|
|
967
|
+
if (!n.contentDocument) {
|
|
968
|
+
attributes2.rr_src = attributes2.src;
|
|
969
|
+
}
|
|
970
|
+
delete attributes2.src;
|
|
971
|
+
}
|
|
972
|
+
var isCustomElement;
|
|
973
|
+
try {
|
|
974
|
+
if (customElements.get(tagName)) isCustomElement = true;
|
|
975
|
+
} catch (e) {}
|
|
976
|
+
return {
|
|
977
|
+
type: NodeType.Element,
|
|
978
|
+
tagName: tagName,
|
|
979
|
+
attributes: attributes2,
|
|
980
|
+
childNodes: [],
|
|
981
|
+
isSVG: isSVGElement(n) || void 0,
|
|
982
|
+
needBlock: needBlock,
|
|
983
|
+
rootId: rootId,
|
|
984
|
+
isCustom: isCustomElement
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
function lowerIfExists(maybeAttr) {
|
|
988
|
+
if (maybeAttr === void 0 || maybeAttr === null) {
|
|
989
|
+
return "";
|
|
990
|
+
} else {
|
|
991
|
+
return maybeAttr.toLowerCase();
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
995
|
+
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
996
|
+
return true;
|
|
997
|
+
} else if (sn.type === NodeType.Element) {
|
|
998
|
+
if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
|
|
999
|
+
return true;
|
|
1000
|
+
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
|
|
1001
|
+
return true;
|
|
1002
|
+
} else if (sn.tagName === "meta") {
|
|
1003
|
+
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
1004
|
+
return true;
|
|
1005
|
+
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
1006
|
+
return true;
|
|
1007
|
+
} else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
|
|
1008
|
+
return true;
|
|
1009
|
+
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
1010
|
+
return true;
|
|
1011
|
+
} 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:/))) {
|
|
1012
|
+
return true;
|
|
1013
|
+
} 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")) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
return false;
|
|
1019
|
+
}
|
|
1020
|
+
function serializeNodeWithId(n, options) {
|
|
1021
|
+
var doc = options.doc,
|
|
1022
|
+
mirror = options.mirror,
|
|
1023
|
+
blockClass = options.blockClass,
|
|
1024
|
+
blockSelector = options.blockSelector,
|
|
1025
|
+
maskTextClass = options.maskTextClass,
|
|
1026
|
+
maskTextSelector = options.maskTextSelector,
|
|
1027
|
+
_options$skipChild = options.skipChild,
|
|
1028
|
+
skipChild = _options$skipChild === void 0 ? false : _options$skipChild,
|
|
1029
|
+
_options$inlineStyles = options.inlineStylesheet,
|
|
1030
|
+
inlineStylesheet = _options$inlineStyles === void 0 ? true : _options$inlineStyles,
|
|
1031
|
+
_options$maskInputOpt3 = options.maskInputOptions,
|
|
1032
|
+
maskInputOptions = _options$maskInputOpt3 === void 0 ? {} : _options$maskInputOpt3,
|
|
1033
|
+
maskTextFn = options.maskTextFn,
|
|
1034
|
+
maskInputFn = options.maskInputFn,
|
|
1035
|
+
slimDOMOptions = options.slimDOMOptions,
|
|
1036
|
+
_options$dataURLOptio3 = options.dataURLOptions,
|
|
1037
|
+
dataURLOptions = _options$dataURLOptio3 === void 0 ? {} : _options$dataURLOptio3,
|
|
1038
|
+
_options$inlineImages = options.inlineImages,
|
|
1039
|
+
inlineImages = _options$inlineImages === void 0 ? false : _options$inlineImages,
|
|
1040
|
+
_options$recordCanvas = options.recordCanvas,
|
|
1041
|
+
recordCanvas = _options$recordCanvas === void 0 ? false : _options$recordCanvas,
|
|
1042
|
+
onSerialize = options.onSerialize,
|
|
1043
|
+
onIframeLoad = options.onIframeLoad,
|
|
1044
|
+
_options$iframeLoadTi = options.iframeLoadTimeout,
|
|
1045
|
+
iframeLoadTimeout = _options$iframeLoadTi === void 0 ? 5e3 : _options$iframeLoadTi,
|
|
1046
|
+
onStylesheetLoad = options.onStylesheetLoad,
|
|
1047
|
+
_options$stylesheetLo = options.stylesheetLoadTimeout,
|
|
1048
|
+
stylesheetLoadTimeout = _options$stylesheetLo === void 0 ? 5e3 : _options$stylesheetLo,
|
|
1049
|
+
_options$keepIframeSr = options.keepIframeSrcFn,
|
|
1050
|
+
keepIframeSrcFn = _options$keepIframeSr === void 0 ? function () {
|
|
1051
|
+
return false;
|
|
1052
|
+
} : _options$keepIframeSr,
|
|
1053
|
+
_options$newlyAddedEl3 = options.newlyAddedElement,
|
|
1054
|
+
newlyAddedElement = _options$newlyAddedEl3 === void 0 ? false : _options$newlyAddedEl3;
|
|
1055
|
+
var needsMask = options.needsMask;
|
|
1056
|
+
var _options$preserveWhit = options.preserveWhiteSpace,
|
|
1057
|
+
preserveWhiteSpace = _options$preserveWhit === void 0 ? true : _options$preserveWhit;
|
|
1058
|
+
if (!needsMask && n.childNodes) {
|
|
1059
|
+
var checkAncestors = needsMask === void 0;
|
|
1060
|
+
needsMask = needMaskingText(n, maskTextClass, maskTextSelector, checkAncestors);
|
|
1061
|
+
}
|
|
1062
|
+
var _serializedNode = serializeNode(n, {
|
|
1063
|
+
doc: doc,
|
|
1064
|
+
mirror: mirror,
|
|
1065
|
+
blockClass: blockClass,
|
|
1066
|
+
blockSelector: blockSelector,
|
|
1067
|
+
needsMask: needsMask,
|
|
1068
|
+
inlineStylesheet: inlineStylesheet,
|
|
1069
|
+
maskInputOptions: maskInputOptions,
|
|
1070
|
+
maskTextFn: maskTextFn,
|
|
1071
|
+
maskInputFn: maskInputFn,
|
|
1072
|
+
dataURLOptions: dataURLOptions,
|
|
1073
|
+
inlineImages: inlineImages,
|
|
1074
|
+
recordCanvas: recordCanvas,
|
|
1075
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
1076
|
+
newlyAddedElement: newlyAddedElement
|
|
1077
|
+
});
|
|
1078
|
+
if (!_serializedNode) {
|
|
1079
|
+
console.warn(n, "not serialized");
|
|
1080
|
+
return null;
|
|
1081
|
+
}
|
|
1082
|
+
var id;
|
|
1083
|
+
if (mirror.hasNode(n)) {
|
|
1084
|
+
id = mirror.getId(n);
|
|
1085
|
+
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
1086
|
+
id = IGNORED_NODE;
|
|
1087
|
+
} else {
|
|
1088
|
+
id = genId();
|
|
1089
|
+
}
|
|
1090
|
+
var serializedNode2 = _extends(_serializedNode, {
|
|
1091
|
+
id: id
|
|
1092
|
+
});
|
|
1093
|
+
mirror.add(n, serializedNode2);
|
|
1094
|
+
if (id === IGNORED_NODE) {
|
|
1095
|
+
return null;
|
|
1096
|
+
}
|
|
1097
|
+
if (onSerialize) {
|
|
1098
|
+
onSerialize(n);
|
|
1099
|
+
}
|
|
1100
|
+
var recordChild = !skipChild;
|
|
1101
|
+
if (serializedNode2.type === NodeType.Element) {
|
|
1102
|
+
recordChild = recordChild && !serializedNode2.needBlock;
|
|
1103
|
+
delete serializedNode2.needBlock;
|
|
1104
|
+
var shadowRoot = n.shadowRoot;
|
|
1105
|
+
if (shadowRoot && isNativeShadowDom(shadowRoot)) serializedNode2.isShadowHost = true;
|
|
1106
|
+
}
|
|
1107
|
+
if ((serializedNode2.type === NodeType.Document || serializedNode2.type === NodeType.Element) && recordChild) {
|
|
1108
|
+
if (slimDOMOptions.headWhitespace && serializedNode2.type === NodeType.Element && serializedNode2.tagName === "head") {
|
|
1109
|
+
preserveWhiteSpace = false;
|
|
1110
|
+
}
|
|
1111
|
+
var bypassOptions = {
|
|
1112
|
+
doc: doc,
|
|
1113
|
+
mirror: mirror,
|
|
1114
|
+
blockClass: blockClass,
|
|
1115
|
+
blockSelector: blockSelector,
|
|
1116
|
+
needsMask: needsMask,
|
|
1117
|
+
maskTextClass: maskTextClass,
|
|
1118
|
+
maskTextSelector: maskTextSelector,
|
|
1119
|
+
skipChild: skipChild,
|
|
1120
|
+
inlineStylesheet: inlineStylesheet,
|
|
1121
|
+
maskInputOptions: maskInputOptions,
|
|
1122
|
+
maskTextFn: maskTextFn,
|
|
1123
|
+
maskInputFn: maskInputFn,
|
|
1124
|
+
slimDOMOptions: slimDOMOptions,
|
|
1125
|
+
dataURLOptions: dataURLOptions,
|
|
1126
|
+
inlineImages: inlineImages,
|
|
1127
|
+
recordCanvas: recordCanvas,
|
|
1128
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1129
|
+
onSerialize: onSerialize,
|
|
1130
|
+
onIframeLoad: onIframeLoad,
|
|
1131
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1132
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1133
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1134
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
1135
|
+
};
|
|
1136
|
+
if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "textarea" && serializedNode2.attributes.value !== void 0) ;else {
|
|
1137
|
+
for (var _i = 0, _Array$from = Array.from(n.childNodes); _i < _Array$from.length; _i++) {
|
|
1138
|
+
var childN = _Array$from[_i];
|
|
1139
|
+
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
1140
|
+
if (serializedChildNode) {
|
|
1141
|
+
serializedNode2.childNodes.push(serializedChildNode);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
if (isElement(n) && n.shadowRoot) {
|
|
1146
|
+
for (var _i2 = 0, _Array$from2 = Array.from(n.shadowRoot.childNodes); _i2 < _Array$from2.length; _i2++) {
|
|
1147
|
+
var _childN = _Array$from2[_i2];
|
|
1148
|
+
var _serializedChildNode = serializeNodeWithId(_childN, bypassOptions);
|
|
1149
|
+
if (_serializedChildNode) {
|
|
1150
|
+
isNativeShadowDom(n.shadowRoot) && (_serializedChildNode.isShadow = true);
|
|
1151
|
+
serializedNode2.childNodes.push(_serializedChildNode);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
if (n.parentNode && isShadowRoot(n.parentNode) && isNativeShadowDom(n.parentNode)) {
|
|
1157
|
+
serializedNode2.isShadow = true;
|
|
1158
|
+
}
|
|
1159
|
+
if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "iframe") {
|
|
1160
|
+
onceIframeLoaded(n, function () {
|
|
1161
|
+
var iframeDoc = n.contentDocument;
|
|
1162
|
+
if (iframeDoc && onIframeLoad) {
|
|
1163
|
+
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
1164
|
+
doc: iframeDoc,
|
|
1165
|
+
mirror: mirror,
|
|
1166
|
+
blockClass: blockClass,
|
|
1167
|
+
blockSelector: blockSelector,
|
|
1168
|
+
needsMask: needsMask,
|
|
1169
|
+
maskTextClass: maskTextClass,
|
|
1170
|
+
maskTextSelector: maskTextSelector,
|
|
1171
|
+
skipChild: false,
|
|
1172
|
+
inlineStylesheet: inlineStylesheet,
|
|
1173
|
+
maskInputOptions: maskInputOptions,
|
|
1174
|
+
maskTextFn: maskTextFn,
|
|
1175
|
+
maskInputFn: maskInputFn,
|
|
1176
|
+
slimDOMOptions: slimDOMOptions,
|
|
1177
|
+
dataURLOptions: dataURLOptions,
|
|
1178
|
+
inlineImages: inlineImages,
|
|
1179
|
+
recordCanvas: recordCanvas,
|
|
1180
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1181
|
+
onSerialize: onSerialize,
|
|
1182
|
+
onIframeLoad: onIframeLoad,
|
|
1183
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1184
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1185
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1186
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
1187
|
+
});
|
|
1188
|
+
if (serializedIframeNode) {
|
|
1189
|
+
onIframeLoad(n, serializedIframeNode);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}, iframeLoadTimeout);
|
|
1193
|
+
}
|
|
1194
|
+
if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "link" && typeof serializedNode2.attributes.rel === "string" && (serializedNode2.attributes.rel === "stylesheet" || serializedNode2.attributes.rel === "preload" && typeof serializedNode2.attributes.href === "string" && extractFileExtension(serializedNode2.attributes.href) === "css")) {
|
|
1195
|
+
onceStylesheetLoaded(n, function () {
|
|
1196
|
+
if (onStylesheetLoad) {
|
|
1197
|
+
var serializedLinkNode = serializeNodeWithId(n, {
|
|
1198
|
+
doc: doc,
|
|
1199
|
+
mirror: mirror,
|
|
1200
|
+
blockClass: blockClass,
|
|
1201
|
+
blockSelector: blockSelector,
|
|
1202
|
+
needsMask: needsMask,
|
|
1203
|
+
maskTextClass: maskTextClass,
|
|
1204
|
+
maskTextSelector: maskTextSelector,
|
|
1205
|
+
skipChild: false,
|
|
1206
|
+
inlineStylesheet: inlineStylesheet,
|
|
1207
|
+
maskInputOptions: maskInputOptions,
|
|
1208
|
+
maskTextFn: maskTextFn,
|
|
1209
|
+
maskInputFn: maskInputFn,
|
|
1210
|
+
slimDOMOptions: slimDOMOptions,
|
|
1211
|
+
dataURLOptions: dataURLOptions,
|
|
1212
|
+
inlineImages: inlineImages,
|
|
1213
|
+
recordCanvas: recordCanvas,
|
|
1214
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1215
|
+
onSerialize: onSerialize,
|
|
1216
|
+
onIframeLoad: onIframeLoad,
|
|
1217
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1218
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1219
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1220
|
+
keepIframeSrcFn: keepIframeSrcFn
|
|
1221
|
+
});
|
|
1222
|
+
if (serializedLinkNode) {
|
|
1223
|
+
onStylesheetLoad(n, serializedLinkNode);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}, stylesheetLoadTimeout);
|
|
1227
|
+
}
|
|
1228
|
+
return serializedNode2;
|
|
1229
|
+
}
|
|
1230
|
+
function snapshot(n, options) {
|
|
1231
|
+
var _ref3 = options || {},
|
|
1232
|
+
_ref3$mirror = _ref3.mirror,
|
|
1233
|
+
mirror = _ref3$mirror === void 0 ? new Mirror() : _ref3$mirror,
|
|
1234
|
+
_ref3$blockClass = _ref3.blockClass,
|
|
1235
|
+
blockClass = _ref3$blockClass === void 0 ? "rr-block" : _ref3$blockClass,
|
|
1236
|
+
_ref3$blockSelector = _ref3.blockSelector,
|
|
1237
|
+
blockSelector = _ref3$blockSelector === void 0 ? null : _ref3$blockSelector,
|
|
1238
|
+
_ref3$maskTextClass = _ref3.maskTextClass,
|
|
1239
|
+
maskTextClass = _ref3$maskTextClass === void 0 ? "rr-mask" : _ref3$maskTextClass,
|
|
1240
|
+
_ref3$maskTextSelecto = _ref3.maskTextSelector,
|
|
1241
|
+
maskTextSelector = _ref3$maskTextSelecto === void 0 ? null : _ref3$maskTextSelecto,
|
|
1242
|
+
_ref3$inlineStyleshee = _ref3.inlineStylesheet,
|
|
1243
|
+
inlineStylesheet = _ref3$inlineStyleshee === void 0 ? true : _ref3$inlineStyleshee,
|
|
1244
|
+
_ref3$inlineImages = _ref3.inlineImages,
|
|
1245
|
+
inlineImages = _ref3$inlineImages === void 0 ? false : _ref3$inlineImages,
|
|
1246
|
+
_ref3$recordCanvas = _ref3.recordCanvas,
|
|
1247
|
+
recordCanvas = _ref3$recordCanvas === void 0 ? false : _ref3$recordCanvas,
|
|
1248
|
+
_ref3$maskAllInputs = _ref3.maskAllInputs,
|
|
1249
|
+
maskAllInputs = _ref3$maskAllInputs === void 0 ? false : _ref3$maskAllInputs,
|
|
1250
|
+
maskTextFn = _ref3.maskTextFn,
|
|
1251
|
+
maskInputFn = _ref3.maskInputFn,
|
|
1252
|
+
_ref3$slimDOM = _ref3.slimDOM,
|
|
1253
|
+
slimDOM = _ref3$slimDOM === void 0 ? false : _ref3$slimDOM,
|
|
1254
|
+
dataURLOptions = _ref3.dataURLOptions,
|
|
1255
|
+
preserveWhiteSpace = _ref3.preserveWhiteSpace,
|
|
1256
|
+
onSerialize = _ref3.onSerialize,
|
|
1257
|
+
onIframeLoad = _ref3.onIframeLoad,
|
|
1258
|
+
iframeLoadTimeout = _ref3.iframeLoadTimeout,
|
|
1259
|
+
onStylesheetLoad = _ref3.onStylesheetLoad,
|
|
1260
|
+
stylesheetLoadTimeout = _ref3.stylesheetLoadTimeout,
|
|
1261
|
+
_ref3$keepIframeSrcFn = _ref3.keepIframeSrcFn,
|
|
1262
|
+
keepIframeSrcFn = _ref3$keepIframeSrcFn === void 0 ? function () {
|
|
1263
|
+
return false;
|
|
1264
|
+
} : _ref3$keepIframeSrcFn;
|
|
1265
|
+
var maskInputOptions = maskAllInputs === true ? {
|
|
1266
|
+
color: true,
|
|
1267
|
+
date: true,
|
|
1268
|
+
"datetime-local": true,
|
|
1269
|
+
email: true,
|
|
1270
|
+
month: true,
|
|
1271
|
+
number: true,
|
|
1272
|
+
range: true,
|
|
1273
|
+
search: true,
|
|
1274
|
+
tel: true,
|
|
1275
|
+
text: true,
|
|
1276
|
+
time: true,
|
|
1277
|
+
url: true,
|
|
1278
|
+
week: true,
|
|
1279
|
+
textarea: true,
|
|
1280
|
+
select: true,
|
|
1281
|
+
password: true
|
|
1282
|
+
} : maskAllInputs === false ? {
|
|
1283
|
+
password: true
|
|
1284
|
+
} : maskAllInputs;
|
|
1285
|
+
var slimDOMOptions = slimDOM === true || slimDOM === "all" ? {
|
|
1286
|
+
script: true,
|
|
1287
|
+
comment: true,
|
|
1288
|
+
headFavicon: true,
|
|
1289
|
+
headWhitespace: true,
|
|
1290
|
+
headMetaDescKeywords: slimDOM === "all",
|
|
1291
|
+
headMetaSocial: true,
|
|
1292
|
+
headMetaRobots: true,
|
|
1293
|
+
headMetaHttpEquiv: true,
|
|
1294
|
+
headMetaAuthorship: true,
|
|
1295
|
+
headMetaVerification: true
|
|
1296
|
+
} : slimDOM === false ? {} : slimDOM;
|
|
1297
|
+
return serializeNodeWithId(n, {
|
|
1298
|
+
doc: n,
|
|
1299
|
+
mirror: mirror,
|
|
1300
|
+
blockClass: blockClass,
|
|
1301
|
+
blockSelector: blockSelector,
|
|
1302
|
+
maskTextClass: maskTextClass,
|
|
1303
|
+
maskTextSelector: maskTextSelector,
|
|
1304
|
+
skipChild: false,
|
|
1305
|
+
inlineStylesheet: inlineStylesheet,
|
|
1306
|
+
maskInputOptions: maskInputOptions,
|
|
1307
|
+
maskTextFn: maskTextFn,
|
|
1308
|
+
maskInputFn: maskInputFn,
|
|
1309
|
+
slimDOMOptions: slimDOMOptions,
|
|
1310
|
+
dataURLOptions: dataURLOptions,
|
|
1311
|
+
inlineImages: inlineImages,
|
|
1312
|
+
recordCanvas: recordCanvas,
|
|
1313
|
+
preserveWhiteSpace: preserveWhiteSpace,
|
|
1314
|
+
onSerialize: onSerialize,
|
|
1315
|
+
onIframeLoad: onIframeLoad,
|
|
1316
|
+
iframeLoadTimeout: iframeLoadTimeout,
|
|
1317
|
+
onStylesheetLoad: onStylesheetLoad,
|
|
1318
|
+
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1319
|
+
keepIframeSrcFn: keepIframeSrcFn,
|
|
1320
|
+
newlyAddedElement: false
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
|
|
17
1324
|
function getWorkerString() {
|
|
18
1325
|
var _this = this;
|
|
19
1326
|
var MAX_CHUNK_SIZE = 1024 * 1024;
|