@coralogix/browser 2.8.5 → 2.8.7
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 +15 -0
- package/index.esm.js +2 -3
- package/index.esm2.js +622 -797
- package/package.json +1 -1
- package/sessionRecorder.esm.js +28 -1291
- package/src/constants.d.ts +0 -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/otel/otel.consts.d.ts +0 -10
- package/src/session/session.model.d.ts +0 -40
- package/src/session/sessionManager.d.ts +1 -0
- package/src/tools/addEventListener.d.ts +0 -7
- package/src/tools/getZoneJsOriginalDom.d.ts +0 -3
- package/src/types.d.ts +0 -87
- package/src/utils/array.d.ts +0 -9
- package/src/utils/general.d.ts +0 -6
- package/src/utils/object.d.ts +0 -26
- package/src/utils/string.d.ts +0 -4
- package/src/version.d.ts +1 -1
package/sessionRecorder.esm.js
CHANGED
|
@@ -1,1281 +1,22 @@
|
|
|
1
|
-
import { __awaiter, __generator, __assign } from '
|
|
2
|
-
import {
|
|
1
|
+
import { _ as __awaiter, a as __generator, C as CxGlobal, r as reportInternalEvent, b as __assign, g as getSdkConfig, S as SESSION_RECORDER_SEGMENTS_MAP, c as getNowTime, d as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, M as MAX_BATCH_TIME_MS, R as Request, e as SESSION_RECORDING_DEFAULT_HEADERS, f as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, h as SESSION_RECORDER_KEY, i as MAX_MUTATIONS_FOR_SESSION_RECORDING, j as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE } from './index.esm2.js';
|
|
2
|
+
import { EventType } from '@rrweb/types';
|
|
3
3
|
import { record } from 'rrweb';
|
|
4
|
+
import { snapshot } from 'rrweb-snapshot';
|
|
4
5
|
import { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record';
|
|
5
6
|
import '@opentelemetry/sdk-trace-base';
|
|
6
7
|
import '@opentelemetry/sdk-trace-web';
|
|
7
8
|
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';
|
|
12
13
|
import '@opentelemetry/api';
|
|
13
14
|
import '@opentelemetry/propagator-b3';
|
|
14
15
|
import '@opentelemetry/propagator-aws-xray';
|
|
15
16
|
|
|
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 = /* @__PURE__ */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
|
-
|
|
134
|
-
var __defProp = Object.defineProperty;
|
|
135
|
-
var __defNormalProp = function __defNormalProp(obj, key, value) {
|
|
136
|
-
return key in obj ? __defProp(obj, key, {
|
|
137
|
-
enumerable: true,
|
|
138
|
-
configurable: true,
|
|
139
|
-
writable: true,
|
|
140
|
-
value: value
|
|
141
|
-
}) : obj[key] = value;
|
|
142
|
-
};
|
|
143
|
-
var __publicField = function __publicField(obj, key, value) {
|
|
144
|
-
__defNormalProp(obj, _typeof(key) !== "symbol" ? key + "" : key, value);
|
|
145
|
-
return value;
|
|
146
|
-
};
|
|
147
|
-
var NodeType = /* @__PURE__ */function (NodeType2) {
|
|
148
|
-
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
149
|
-
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
150
|
-
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
151
|
-
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
152
|
-
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
153
|
-
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
154
|
-
return NodeType2;
|
|
155
|
-
}(NodeType || {});
|
|
156
|
-
function isElement(n) {
|
|
157
|
-
return n.nodeType === n.ELEMENT_NODE;
|
|
158
|
-
}
|
|
159
|
-
function isShadowRoot(n) {
|
|
160
|
-
var host = n == null ? void 0 : n.host;
|
|
161
|
-
return Boolean((host == null ? void 0 : host.shadowRoot) === n);
|
|
162
|
-
}
|
|
163
|
-
function isNativeShadowDom(shadowRoot) {
|
|
164
|
-
return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]";
|
|
165
|
-
}
|
|
166
|
-
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
167
|
-
if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
|
|
168
|
-
cssText = cssText.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;");
|
|
169
|
-
}
|
|
170
|
-
return cssText;
|
|
171
|
-
}
|
|
172
|
-
function escapeImportStatement(rule) {
|
|
173
|
-
var cssText = rule.cssText;
|
|
174
|
-
if (cssText.split('"').length < 3) return cssText;
|
|
175
|
-
var statement = ["@import", "url(".concat(JSON.stringify(rule.href), ")")];
|
|
176
|
-
if (rule.layerName === "") {
|
|
177
|
-
statement.push("layer");
|
|
178
|
-
} else if (rule.layerName) {
|
|
179
|
-
statement.push("layer(".concat(rule.layerName, ")"));
|
|
180
|
-
}
|
|
181
|
-
if (rule.supportsText) {
|
|
182
|
-
statement.push("supports(".concat(rule.supportsText, ")"));
|
|
183
|
-
}
|
|
184
|
-
if (rule.media.length) {
|
|
185
|
-
statement.push(rule.media.mediaText);
|
|
186
|
-
}
|
|
187
|
-
return statement.join(" ") + ";";
|
|
188
|
-
}
|
|
189
|
-
function stringifyStylesheet(s) {
|
|
190
|
-
try {
|
|
191
|
-
var rules = s.rules || s.cssRules;
|
|
192
|
-
return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null;
|
|
193
|
-
} catch (error) {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function stringifyRule(rule) {
|
|
198
|
-
var importStringified;
|
|
199
|
-
if (isCSSImportRule(rule)) {
|
|
200
|
-
try {
|
|
201
|
-
importStringified =
|
|
202
|
-
// for same-origin stylesheets,
|
|
203
|
-
// we can access the imported stylesheet rules directly
|
|
204
|
-
stringifyStylesheet(rule.styleSheet) ||
|
|
205
|
-
// work around browser issues with the raw string `@import url(...)` statement
|
|
206
|
-
escapeImportStatement(rule);
|
|
207
|
-
} catch (error) {}
|
|
208
|
-
} else if (isCSSStyleRule(rule) && rule.selectorText.includes(":")) {
|
|
209
|
-
return fixSafariColons(rule.cssText);
|
|
210
|
-
}
|
|
211
|
-
return importStringified || rule.cssText;
|
|
212
|
-
}
|
|
213
|
-
function fixSafariColons(cssStringified) {
|
|
214
|
-
var regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
|
|
215
|
-
return cssStringified.replace(regex, "$1\\$2");
|
|
216
|
-
}
|
|
217
|
-
function isCSSImportRule(rule) {
|
|
218
|
-
return "styleSheet" in rule;
|
|
219
|
-
}
|
|
220
|
-
function isCSSStyleRule(rule) {
|
|
221
|
-
return "selectorText" in rule;
|
|
222
|
-
}
|
|
223
|
-
var Mirror = /*#__PURE__*/function () {
|
|
224
|
-
function Mirror() {
|
|
225
|
-
_classCallCheck(this, Mirror);
|
|
226
|
-
__publicField(this, "idNodeMap", /* @__PURE__ */new Map());
|
|
227
|
-
__publicField(this, "nodeMetaMap", /* @__PURE__ */new WeakMap());
|
|
228
|
-
}
|
|
229
|
-
return _createClass(Mirror, [{
|
|
230
|
-
key: "getId",
|
|
231
|
-
value: function getId(n) {
|
|
232
|
-
var _a;
|
|
233
|
-
if (!n) return -1;
|
|
234
|
-
var id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
|
|
235
|
-
return id !== null && id !== void 0 ? id : -1;
|
|
236
|
-
}
|
|
237
|
-
}, {
|
|
238
|
-
key: "getNode",
|
|
239
|
-
value: function getNode(id) {
|
|
240
|
-
return this.idNodeMap.get(id) || null;
|
|
241
|
-
}
|
|
242
|
-
}, {
|
|
243
|
-
key: "getIds",
|
|
244
|
-
value: function getIds() {
|
|
245
|
-
return Array.from(this.idNodeMap.keys());
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "getMeta",
|
|
249
|
-
value: function getMeta(n) {
|
|
250
|
-
return this.nodeMetaMap.get(n) || null;
|
|
251
|
-
}
|
|
252
|
-
// removes the node from idNodeMap
|
|
253
|
-
// doesn't remove the node from nodeMetaMap
|
|
254
|
-
}, {
|
|
255
|
-
key: "removeNodeFromMap",
|
|
256
|
-
value: function removeNodeFromMap(n) {
|
|
257
|
-
var _this = this;
|
|
258
|
-
var id = this.getId(n);
|
|
259
|
-
this.idNodeMap["delete"](id);
|
|
260
|
-
if (n.childNodes) {
|
|
261
|
-
n.childNodes.forEach(function (childNode) {
|
|
262
|
-
return _this.removeNodeFromMap(childNode);
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}, {
|
|
267
|
-
key: "has",
|
|
268
|
-
value: function has(id) {
|
|
269
|
-
return this.idNodeMap.has(id);
|
|
270
|
-
}
|
|
271
|
-
}, {
|
|
272
|
-
key: "hasNode",
|
|
273
|
-
value: function hasNode(node) {
|
|
274
|
-
return this.nodeMetaMap.has(node);
|
|
275
|
-
}
|
|
276
|
-
}, {
|
|
277
|
-
key: "add",
|
|
278
|
-
value: function add(n, meta) {
|
|
279
|
-
var id = meta.id;
|
|
280
|
-
this.idNodeMap.set(id, n);
|
|
281
|
-
this.nodeMetaMap.set(n, meta);
|
|
282
|
-
}
|
|
283
|
-
}, {
|
|
284
|
-
key: "replace",
|
|
285
|
-
value: function replace(id, n) {
|
|
286
|
-
var oldNode = this.getNode(id);
|
|
287
|
-
if (oldNode) {
|
|
288
|
-
var meta = this.nodeMetaMap.get(oldNode);
|
|
289
|
-
if (meta) this.nodeMetaMap.set(n, meta);
|
|
290
|
-
}
|
|
291
|
-
this.idNodeMap.set(id, n);
|
|
292
|
-
}
|
|
293
|
-
}, {
|
|
294
|
-
key: "reset",
|
|
295
|
-
value: function reset() {
|
|
296
|
-
this.idNodeMap = /* @__PURE__ */new Map();
|
|
297
|
-
this.nodeMetaMap = /* @__PURE__ */new WeakMap();
|
|
298
|
-
}
|
|
299
|
-
}]);
|
|
300
|
-
}();
|
|
301
|
-
function maskInputValue(_ref) {
|
|
302
|
-
var element = _ref.element,
|
|
303
|
-
maskInputOptions = _ref.maskInputOptions,
|
|
304
|
-
tagName = _ref.tagName,
|
|
305
|
-
type = _ref.type,
|
|
306
|
-
value = _ref.value,
|
|
307
|
-
maskInputFn = _ref.maskInputFn;
|
|
308
|
-
var text = value || "";
|
|
309
|
-
var actualType = type && toLowerCase(type);
|
|
310
|
-
if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {
|
|
311
|
-
if (maskInputFn) {
|
|
312
|
-
text = maskInputFn(text, element);
|
|
313
|
-
} else {
|
|
314
|
-
text = "*".repeat(text.length);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return text;
|
|
318
|
-
}
|
|
319
|
-
function toLowerCase(str) {
|
|
320
|
-
return str.toLowerCase();
|
|
321
|
-
}
|
|
322
|
-
var ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
|
|
323
|
-
function is2DCanvasBlank(canvas) {
|
|
324
|
-
var ctx = canvas.getContext("2d");
|
|
325
|
-
if (!ctx) return true;
|
|
326
|
-
var chunkSize = 50;
|
|
327
|
-
for (var x = 0; x < canvas.width; x += chunkSize) {
|
|
328
|
-
for (var y = 0; y < canvas.height; y += chunkSize) {
|
|
329
|
-
var getImageData = ctx.getImageData;
|
|
330
|
-
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
|
|
331
|
-
var pixelBuffer = new Uint32Array(
|
|
332
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
333
|
-
originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
|
|
334
|
-
if (pixelBuffer.some(function (pixel) {
|
|
335
|
-
return pixel !== 0;
|
|
336
|
-
})) return false;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
function getInputType(element) {
|
|
342
|
-
var type = element.type;
|
|
343
|
-
return element.hasAttribute("data-rr-is-password") ? "password" : type ?
|
|
344
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
345
|
-
toLowerCase(type) : null;
|
|
346
|
-
}
|
|
347
|
-
function extractFileExtension(path, baseURL) {
|
|
348
|
-
var _ref2;
|
|
349
|
-
var url;
|
|
350
|
-
try {
|
|
351
|
-
url = new URL(path, baseURL !== null && baseURL !== void 0 ? baseURL : window.location.href);
|
|
352
|
-
} catch (err) {
|
|
353
|
-
return null;
|
|
354
|
-
}
|
|
355
|
-
var regex = /\.([0-9a-z]+)(?:$)/i;
|
|
356
|
-
var match = url.pathname.match(regex);
|
|
357
|
-
return (_ref2 = match == null ? void 0 : match[1]) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
358
|
-
}
|
|
359
|
-
var _id = 1;
|
|
360
|
-
var tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
361
|
-
var IGNORED_NODE = -2;
|
|
362
|
-
function genId() {
|
|
363
|
-
return _id++;
|
|
364
|
-
}
|
|
365
|
-
function getValidTagName(element) {
|
|
366
|
-
if (element instanceof HTMLFormElement) {
|
|
367
|
-
return "form";
|
|
368
|
-
}
|
|
369
|
-
var processedTagName = toLowerCase(element.tagName);
|
|
370
|
-
if (tagNameRegex.test(processedTagName)) {
|
|
371
|
-
return "div";
|
|
372
|
-
}
|
|
373
|
-
return processedTagName;
|
|
374
|
-
}
|
|
375
|
-
function extractOrigin(url) {
|
|
376
|
-
var origin = "";
|
|
377
|
-
if (url.indexOf("//") > -1) {
|
|
378
|
-
origin = url.split("/").slice(0, 3).join("/");
|
|
379
|
-
} else {
|
|
380
|
-
origin = url.split("/")[0];
|
|
381
|
-
}
|
|
382
|
-
origin = origin.split("?")[0];
|
|
383
|
-
return origin;
|
|
384
|
-
}
|
|
385
|
-
var canvasService;
|
|
386
|
-
var canvasCtx;
|
|
387
|
-
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
388
|
-
var URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
|
|
389
|
-
var URL_WWW_MATCH = /^www\..*/i;
|
|
390
|
-
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
391
|
-
function absoluteToStylesheet(cssText, href) {
|
|
392
|
-
return (cssText || "").replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
|
|
393
|
-
var filePath = path1 || path2 || path3;
|
|
394
|
-
var maybeQuote = quote1 || quote2 || "";
|
|
395
|
-
if (!filePath) {
|
|
396
|
-
return origin;
|
|
397
|
-
}
|
|
398
|
-
if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
|
|
399
|
-
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
400
|
-
}
|
|
401
|
-
if (DATA_URI.test(filePath)) {
|
|
402
|
-
return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
|
|
403
|
-
}
|
|
404
|
-
if (filePath[0] === "/") {
|
|
405
|
-
return "url(".concat(maybeQuote).concat(extractOrigin(href) + filePath).concat(maybeQuote, ")");
|
|
406
|
-
}
|
|
407
|
-
var stack = href.split("/");
|
|
408
|
-
var parts = filePath.split("/");
|
|
409
|
-
stack.pop();
|
|
410
|
-
var _iterator = _createForOfIteratorHelper(parts),
|
|
411
|
-
_step;
|
|
412
|
-
try {
|
|
413
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
414
|
-
var part = _step.value;
|
|
415
|
-
if (part === ".") {
|
|
416
|
-
continue;
|
|
417
|
-
} else if (part === "..") {
|
|
418
|
-
stack.pop();
|
|
419
|
-
} else {
|
|
420
|
-
stack.push(part);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
} catch (err) {
|
|
424
|
-
_iterator.e(err);
|
|
425
|
-
} finally {
|
|
426
|
-
_iterator.f();
|
|
427
|
-
}
|
|
428
|
-
return "url(".concat(maybeQuote).concat(stack.join("/")).concat(maybeQuote, ")");
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
432
|
-
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
433
|
-
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
434
|
-
if (attributeValue.trim() === "") {
|
|
435
|
-
return attributeValue;
|
|
436
|
-
}
|
|
437
|
-
var pos = 0;
|
|
438
|
-
function collectCharacters(regEx) {
|
|
439
|
-
var chars;
|
|
440
|
-
var match = regEx.exec(attributeValue.substring(pos));
|
|
441
|
-
if (match) {
|
|
442
|
-
chars = match[0];
|
|
443
|
-
pos += chars.length;
|
|
444
|
-
return chars;
|
|
445
|
-
}
|
|
446
|
-
return "";
|
|
447
|
-
}
|
|
448
|
-
var output = [];
|
|
449
|
-
while (true) {
|
|
450
|
-
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
451
|
-
if (pos >= attributeValue.length) {
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
|
-
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
455
|
-
if (url.slice(-1) === ",") {
|
|
456
|
-
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
457
|
-
output.push(url);
|
|
458
|
-
} else {
|
|
459
|
-
var descriptorsStr = "";
|
|
460
|
-
url = absoluteToDoc(doc, url);
|
|
461
|
-
var inParens = false;
|
|
462
|
-
while (true) {
|
|
463
|
-
var c = attributeValue.charAt(pos);
|
|
464
|
-
if (c === "") {
|
|
465
|
-
output.push((url + descriptorsStr).trim());
|
|
466
|
-
break;
|
|
467
|
-
} else if (!inParens) {
|
|
468
|
-
if (c === ",") {
|
|
469
|
-
pos += 1;
|
|
470
|
-
output.push((url + descriptorsStr).trim());
|
|
471
|
-
break;
|
|
472
|
-
} else if (c === "(") {
|
|
473
|
-
inParens = true;
|
|
474
|
-
}
|
|
475
|
-
} else {
|
|
476
|
-
if (c === ")") {
|
|
477
|
-
inParens = false;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
descriptorsStr += c;
|
|
481
|
-
pos += 1;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return output.join(", ");
|
|
486
|
-
}
|
|
487
|
-
var cachedDocument = /* @__PURE__ */new WeakMap();
|
|
488
|
-
function absoluteToDoc(doc, attributeValue) {
|
|
489
|
-
if (!attributeValue || attributeValue.trim() === "") {
|
|
490
|
-
return attributeValue;
|
|
491
|
-
}
|
|
492
|
-
return getHref(doc, attributeValue);
|
|
493
|
-
}
|
|
494
|
-
function isSVGElement(el) {
|
|
495
|
-
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
496
|
-
}
|
|
497
|
-
function getHref(doc, customHref) {
|
|
498
|
-
var a = cachedDocument.get(doc);
|
|
499
|
-
if (!a) {
|
|
500
|
-
a = doc.createElement("a");
|
|
501
|
-
cachedDocument.set(doc, a);
|
|
502
|
-
}
|
|
503
|
-
if (!customHref) {
|
|
504
|
-
customHref = "";
|
|
505
|
-
} else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) {
|
|
506
|
-
return customHref;
|
|
507
|
-
}
|
|
508
|
-
a.setAttribute("href", customHref);
|
|
509
|
-
return a.href;
|
|
510
|
-
}
|
|
511
|
-
function transformAttribute(doc, tagName, name, value) {
|
|
512
|
-
if (!value) {
|
|
513
|
-
return value;
|
|
514
|
-
}
|
|
515
|
-
if (name === "src" || name === "href" && !(tagName === "use" && value[0] === "#")) {
|
|
516
|
-
return absoluteToDoc(doc, value);
|
|
517
|
-
} else if (name === "xlink:href" && value[0] !== "#") {
|
|
518
|
-
return absoluteToDoc(doc, value);
|
|
519
|
-
} else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
520
|
-
return absoluteToDoc(doc, value);
|
|
521
|
-
} else if (name === "srcset") {
|
|
522
|
-
return getAbsoluteSrcsetString(doc, value);
|
|
523
|
-
} else if (name === "style") {
|
|
524
|
-
return absoluteToStylesheet(value, getHref(doc));
|
|
525
|
-
} else if (tagName === "object" && name === "data") {
|
|
526
|
-
return absoluteToDoc(doc, value);
|
|
527
|
-
}
|
|
528
|
-
return value;
|
|
529
|
-
}
|
|
530
|
-
function ignoreAttribute(tagName, name, _value) {
|
|
531
|
-
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
532
|
-
}
|
|
533
|
-
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
534
|
-
try {
|
|
535
|
-
if (typeof blockClass === "string") {
|
|
536
|
-
if (element.classList.contains(blockClass)) {
|
|
537
|
-
return true;
|
|
538
|
-
}
|
|
539
|
-
} else {
|
|
540
|
-
for (var eIndex = element.classList.length; eIndex--;) {
|
|
541
|
-
var className = element.classList[eIndex];
|
|
542
|
-
if (blockClass.test(className)) {
|
|
543
|
-
return true;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
if (blockSelector) {
|
|
548
|
-
return element.matches(blockSelector);
|
|
549
|
-
}
|
|
550
|
-
} catch (e) {}
|
|
551
|
-
return false;
|
|
552
|
-
}
|
|
553
|
-
function classMatchesRegex(node, regex, checkAncestors) {
|
|
554
|
-
if (!node) return false;
|
|
555
|
-
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
556
|
-
if (!checkAncestors) return false;
|
|
557
|
-
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
558
|
-
}
|
|
559
|
-
for (var eIndex = node.classList.length; eIndex--;) {
|
|
560
|
-
var className = node.classList[eIndex];
|
|
561
|
-
if (regex.test(className)) {
|
|
562
|
-
return true;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (!checkAncestors) return false;
|
|
566
|
-
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
567
|
-
}
|
|
568
|
-
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
569
|
-
try {
|
|
570
|
-
var el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
|
|
571
|
-
if (el === null) return false;
|
|
572
|
-
if (typeof maskTextClass === "string") {
|
|
573
|
-
if (checkAncestors) {
|
|
574
|
-
if (el.closest(".".concat(maskTextClass))) return true;
|
|
575
|
-
} else {
|
|
576
|
-
if (el.classList.contains(maskTextClass)) return true;
|
|
577
|
-
}
|
|
578
|
-
} else {
|
|
579
|
-
if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;
|
|
580
|
-
}
|
|
581
|
-
if (maskTextSelector) {
|
|
582
|
-
if (checkAncestors) {
|
|
583
|
-
if (el.closest(maskTextSelector)) return true;
|
|
584
|
-
} else {
|
|
585
|
-
if (el.matches(maskTextSelector)) return true;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
} catch (e) {}
|
|
589
|
-
return false;
|
|
590
|
-
}
|
|
591
|
-
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
592
|
-
var win = iframeEl.contentWindow;
|
|
593
|
-
if (!win) {
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
var fired = false;
|
|
597
|
-
var readyState;
|
|
598
|
-
try {
|
|
599
|
-
readyState = win.document.readyState;
|
|
600
|
-
} catch (error) {
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
if (readyState !== "complete") {
|
|
604
|
-
var timer = setTimeout(function () {
|
|
605
|
-
if (!fired) {
|
|
606
|
-
listener();
|
|
607
|
-
fired = true;
|
|
608
|
-
}
|
|
609
|
-
}, iframeLoadTimeout);
|
|
610
|
-
iframeEl.addEventListener("load", function () {
|
|
611
|
-
clearTimeout(timer);
|
|
612
|
-
fired = true;
|
|
613
|
-
listener();
|
|
614
|
-
});
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
|
-
var blankUrl = "about:blank";
|
|
618
|
-
if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
619
|
-
setTimeout(listener, 0);
|
|
620
|
-
return iframeEl.addEventListener("load", listener);
|
|
621
|
-
}
|
|
622
|
-
iframeEl.addEventListener("load", listener);
|
|
623
|
-
}
|
|
624
|
-
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
625
|
-
var fired = false;
|
|
626
|
-
var styleSheetLoaded;
|
|
627
|
-
try {
|
|
628
|
-
styleSheetLoaded = link.sheet;
|
|
629
|
-
} catch (error) {
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
if (styleSheetLoaded) return;
|
|
633
|
-
var timer = setTimeout(function () {
|
|
634
|
-
if (!fired) {
|
|
635
|
-
listener();
|
|
636
|
-
fired = true;
|
|
637
|
-
}
|
|
638
|
-
}, styleSheetLoadTimeout);
|
|
639
|
-
link.addEventListener("load", function () {
|
|
640
|
-
clearTimeout(timer);
|
|
641
|
-
fired = true;
|
|
642
|
-
listener();
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
function serializeNode(n, options) {
|
|
646
|
-
var doc = options.doc,
|
|
647
|
-
mirror = options.mirror,
|
|
648
|
-
blockClass = options.blockClass,
|
|
649
|
-
blockSelector = options.blockSelector,
|
|
650
|
-
needsMask = options.needsMask,
|
|
651
|
-
inlineStylesheet = options.inlineStylesheet,
|
|
652
|
-
_options$maskInputOpt = options.maskInputOptions,
|
|
653
|
-
maskInputOptions = _options$maskInputOpt === void 0 ? {} : _options$maskInputOpt,
|
|
654
|
-
maskTextFn = options.maskTextFn,
|
|
655
|
-
maskInputFn = options.maskInputFn,
|
|
656
|
-
_options$dataURLOptio = options.dataURLOptions,
|
|
657
|
-
dataURLOptions = _options$dataURLOptio === void 0 ? {} : _options$dataURLOptio,
|
|
658
|
-
inlineImages = options.inlineImages,
|
|
659
|
-
recordCanvas = options.recordCanvas,
|
|
660
|
-
keepIframeSrcFn = options.keepIframeSrcFn,
|
|
661
|
-
_options$newlyAddedEl = options.newlyAddedElement,
|
|
662
|
-
newlyAddedElement = _options$newlyAddedEl === void 0 ? false : _options$newlyAddedEl;
|
|
663
|
-
var rootId = getRootId(doc, mirror);
|
|
664
|
-
switch (n.nodeType) {
|
|
665
|
-
case n.DOCUMENT_NODE:
|
|
666
|
-
if (n.compatMode !== "CSS1Compat") {
|
|
667
|
-
return {
|
|
668
|
-
type: NodeType.Document,
|
|
669
|
-
childNodes: [],
|
|
670
|
-
compatMode: n.compatMode
|
|
671
|
-
// probably "BackCompat"
|
|
672
|
-
};
|
|
673
|
-
} else {
|
|
674
|
-
return {
|
|
675
|
-
type: NodeType.Document,
|
|
676
|
-
childNodes: []
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
case n.DOCUMENT_TYPE_NODE:
|
|
680
|
-
return {
|
|
681
|
-
type: NodeType.DocumentType,
|
|
682
|
-
name: n.name,
|
|
683
|
-
publicId: n.publicId,
|
|
684
|
-
systemId: n.systemId,
|
|
685
|
-
rootId: rootId
|
|
686
|
-
};
|
|
687
|
-
case n.ELEMENT_NODE:
|
|
688
|
-
return serializeElementNode(n, {
|
|
689
|
-
doc: doc,
|
|
690
|
-
blockClass: blockClass,
|
|
691
|
-
blockSelector: blockSelector,
|
|
692
|
-
inlineStylesheet: inlineStylesheet,
|
|
693
|
-
maskInputOptions: maskInputOptions,
|
|
694
|
-
maskInputFn: maskInputFn,
|
|
695
|
-
dataURLOptions: dataURLOptions,
|
|
696
|
-
inlineImages: inlineImages,
|
|
697
|
-
recordCanvas: recordCanvas,
|
|
698
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
699
|
-
newlyAddedElement: newlyAddedElement,
|
|
700
|
-
rootId: rootId
|
|
701
|
-
});
|
|
702
|
-
case n.TEXT_NODE:
|
|
703
|
-
return serializeTextNode(n, {
|
|
704
|
-
doc: doc,
|
|
705
|
-
needsMask: needsMask,
|
|
706
|
-
maskTextFn: maskTextFn,
|
|
707
|
-
rootId: rootId
|
|
708
|
-
});
|
|
709
|
-
case n.CDATA_SECTION_NODE:
|
|
710
|
-
return {
|
|
711
|
-
type: NodeType.CDATA,
|
|
712
|
-
textContent: "",
|
|
713
|
-
rootId: rootId
|
|
714
|
-
};
|
|
715
|
-
case n.COMMENT_NODE:
|
|
716
|
-
return {
|
|
717
|
-
type: NodeType.Comment,
|
|
718
|
-
textContent: n.textContent || "",
|
|
719
|
-
rootId: rootId
|
|
720
|
-
};
|
|
721
|
-
default:
|
|
722
|
-
return false;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
function getRootId(doc, mirror) {
|
|
726
|
-
if (!mirror.hasNode(doc)) return void 0;
|
|
727
|
-
var docId = mirror.getId(doc);
|
|
728
|
-
return docId === 1 ? void 0 : docId;
|
|
729
|
-
}
|
|
730
|
-
function serializeTextNode(n, options) {
|
|
731
|
-
var _a;
|
|
732
|
-
var needsMask = options.needsMask,
|
|
733
|
-
maskTextFn = options.maskTextFn,
|
|
734
|
-
rootId = options.rootId;
|
|
735
|
-
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
736
|
-
var textContent = n.textContent;
|
|
737
|
-
var isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
738
|
-
var isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
739
|
-
if (isStyle && textContent) {
|
|
740
|
-
try {
|
|
741
|
-
if (n.nextSibling || n.previousSibling) {} else if ((_a = n.parentNode.sheet) == null ? void 0 : _a.cssRules) {
|
|
742
|
-
textContent = stringifyStylesheet(n.parentNode.sheet);
|
|
743
|
-
}
|
|
744
|
-
} catch (err) {
|
|
745
|
-
console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(err), n);
|
|
746
|
-
}
|
|
747
|
-
textContent = absoluteToStylesheet(textContent, getHref(options.doc));
|
|
748
|
-
}
|
|
749
|
-
if (isScript) {
|
|
750
|
-
textContent = "SCRIPT_PLACEHOLDER";
|
|
751
|
-
}
|
|
752
|
-
if (!isStyle && !isScript && textContent && needsMask) {
|
|
753
|
-
textContent = maskTextFn ? maskTextFn(textContent, n.parentElement) : textContent.replace(/[\S]/g, "*");
|
|
754
|
-
}
|
|
755
|
-
return {
|
|
756
|
-
type: NodeType.Text,
|
|
757
|
-
textContent: textContent || "",
|
|
758
|
-
isStyle: isStyle,
|
|
759
|
-
rootId: rootId
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
function serializeElementNode(n, options) {
|
|
763
|
-
var doc = options.doc,
|
|
764
|
-
blockClass = options.blockClass,
|
|
765
|
-
blockSelector = options.blockSelector,
|
|
766
|
-
inlineStylesheet = options.inlineStylesheet,
|
|
767
|
-
_options$maskInputOpt2 = options.maskInputOptions,
|
|
768
|
-
maskInputOptions = _options$maskInputOpt2 === void 0 ? {} : _options$maskInputOpt2,
|
|
769
|
-
maskInputFn = options.maskInputFn,
|
|
770
|
-
_options$dataURLOptio2 = options.dataURLOptions,
|
|
771
|
-
dataURLOptions = _options$dataURLOptio2 === void 0 ? {} : _options$dataURLOptio2,
|
|
772
|
-
inlineImages = options.inlineImages,
|
|
773
|
-
recordCanvas = options.recordCanvas,
|
|
774
|
-
keepIframeSrcFn = options.keepIframeSrcFn,
|
|
775
|
-
_options$newlyAddedEl2 = options.newlyAddedElement,
|
|
776
|
-
newlyAddedElement = _options$newlyAddedEl2 === void 0 ? false : _options$newlyAddedEl2,
|
|
777
|
-
rootId = options.rootId;
|
|
778
|
-
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
779
|
-
var tagName = getValidTagName(n);
|
|
780
|
-
var attributes2 = {};
|
|
781
|
-
var len = n.attributes.length;
|
|
782
|
-
for (var i = 0; i < len; i++) {
|
|
783
|
-
var attr = n.attributes[i];
|
|
784
|
-
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
785
|
-
attributes2[attr.name] = transformAttribute(doc, tagName, toLowerCase(attr.name), attr.value);
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
if (tagName === "link" && inlineStylesheet) {
|
|
789
|
-
var stylesheet = Array.from(doc.styleSheets).find(function (s) {
|
|
790
|
-
return s.href === n.href;
|
|
791
|
-
});
|
|
792
|
-
var cssText = null;
|
|
793
|
-
if (stylesheet) {
|
|
794
|
-
cssText = stringifyStylesheet(stylesheet);
|
|
795
|
-
}
|
|
796
|
-
if (cssText) {
|
|
797
|
-
delete attributes2.rel;
|
|
798
|
-
delete attributes2.href;
|
|
799
|
-
attributes2._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
if (tagName === "style" && n.sheet &&
|
|
803
|
-
// TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
|
|
804
|
-
!(n.innerText || n.textContent || "").trim().length) {
|
|
805
|
-
var _cssText = stringifyStylesheet(n.sheet);
|
|
806
|
-
if (_cssText) {
|
|
807
|
-
attributes2._cssText = absoluteToStylesheet(_cssText, getHref(doc));
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
|
811
|
-
var value = n.value;
|
|
812
|
-
var checked = n.checked;
|
|
813
|
-
if (attributes2.type !== "radio" && attributes2.type !== "checkbox" && attributes2.type !== "submit" && attributes2.type !== "button" && value) {
|
|
814
|
-
attributes2.value = maskInputValue({
|
|
815
|
-
element: n,
|
|
816
|
-
type: getInputType(n),
|
|
817
|
-
tagName: tagName,
|
|
818
|
-
value: value,
|
|
819
|
-
maskInputOptions: maskInputOptions,
|
|
820
|
-
maskInputFn: maskInputFn
|
|
821
|
-
});
|
|
822
|
-
} else if (checked) {
|
|
823
|
-
attributes2.checked = checked;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
if (tagName === "option") {
|
|
827
|
-
if (n.selected && !maskInputOptions["select"]) {
|
|
828
|
-
attributes2.selected = true;
|
|
829
|
-
} else {
|
|
830
|
-
delete attributes2.selected;
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
if (tagName === "canvas" && recordCanvas) {
|
|
834
|
-
if (n.__context === "2d") {
|
|
835
|
-
if (!is2DCanvasBlank(n)) {
|
|
836
|
-
attributes2.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
837
|
-
}
|
|
838
|
-
} else if (!("__context" in n)) {
|
|
839
|
-
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
840
|
-
var blankCanvas = doc.createElement("canvas");
|
|
841
|
-
blankCanvas.width = n.width;
|
|
842
|
-
blankCanvas.height = n.height;
|
|
843
|
-
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
844
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
845
|
-
attributes2.rr_dataURL = canvasDataURL;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
if (tagName === "img" && inlineImages) {
|
|
850
|
-
if (!canvasService) {
|
|
851
|
-
canvasService = doc.createElement("canvas");
|
|
852
|
-
canvasCtx = canvasService.getContext("2d");
|
|
853
|
-
}
|
|
854
|
-
var image = n;
|
|
855
|
-
var imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
856
|
-
var priorCrossOrigin = image.crossOrigin;
|
|
857
|
-
var _recordInlineImage = function recordInlineImage() {
|
|
858
|
-
image.removeEventListener("load", _recordInlineImage);
|
|
859
|
-
try {
|
|
860
|
-
canvasService.width = image.naturalWidth;
|
|
861
|
-
canvasService.height = image.naturalHeight;
|
|
862
|
-
canvasCtx.drawImage(image, 0, 0);
|
|
863
|
-
attributes2.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
864
|
-
} catch (err) {
|
|
865
|
-
if (image.crossOrigin !== "anonymous") {
|
|
866
|
-
image.crossOrigin = "anonymous";
|
|
867
|
-
if (image.complete && image.naturalWidth !== 0) _recordInlineImage();else image.addEventListener("load", _recordInlineImage);
|
|
868
|
-
return;
|
|
869
|
-
} else {
|
|
870
|
-
console.warn("Cannot inline img src=".concat(imageSrc, "! Error: ").concat(err));
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
if (image.crossOrigin === "anonymous") {
|
|
874
|
-
priorCrossOrigin ? attributes2.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
if (image.complete && image.naturalWidth !== 0) _recordInlineImage();else image.addEventListener("load", _recordInlineImage);
|
|
878
|
-
}
|
|
879
|
-
if (tagName === "audio" || tagName === "video") {
|
|
880
|
-
var mediaAttributes = attributes2;
|
|
881
|
-
mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
|
|
882
|
-
mediaAttributes.rr_mediaCurrentTime = n.currentTime;
|
|
883
|
-
mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
|
|
884
|
-
mediaAttributes.rr_mediaMuted = n.muted;
|
|
885
|
-
mediaAttributes.rr_mediaLoop = n.loop;
|
|
886
|
-
mediaAttributes.rr_mediaVolume = n.volume;
|
|
887
|
-
}
|
|
888
|
-
if (!newlyAddedElement) {
|
|
889
|
-
if (n.scrollLeft) {
|
|
890
|
-
attributes2.rr_scrollLeft = n.scrollLeft;
|
|
891
|
-
}
|
|
892
|
-
if (n.scrollTop) {
|
|
893
|
-
attributes2.rr_scrollTop = n.scrollTop;
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
if (needBlock) {
|
|
897
|
-
var _n$getBoundingClientR = n.getBoundingClientRect(),
|
|
898
|
-
width = _n$getBoundingClientR.width,
|
|
899
|
-
height = _n$getBoundingClientR.height;
|
|
900
|
-
attributes2 = {
|
|
901
|
-
"class": attributes2["class"],
|
|
902
|
-
rr_width: "".concat(width, "px"),
|
|
903
|
-
rr_height: "".concat(height, "px")
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
if (tagName === "iframe" && !keepIframeSrcFn(attributes2.src)) {
|
|
907
|
-
if (!n.contentDocument) {
|
|
908
|
-
attributes2.rr_src = attributes2.src;
|
|
909
|
-
}
|
|
910
|
-
delete attributes2.src;
|
|
911
|
-
}
|
|
912
|
-
var isCustomElement;
|
|
913
|
-
try {
|
|
914
|
-
if (customElements.get(tagName)) isCustomElement = true;
|
|
915
|
-
} catch (e) {}
|
|
916
|
-
return {
|
|
917
|
-
type: NodeType.Element,
|
|
918
|
-
tagName: tagName,
|
|
919
|
-
attributes: attributes2,
|
|
920
|
-
childNodes: [],
|
|
921
|
-
isSVG: isSVGElement(n) || void 0,
|
|
922
|
-
needBlock: needBlock,
|
|
923
|
-
rootId: rootId,
|
|
924
|
-
isCustom: isCustomElement
|
|
925
|
-
};
|
|
926
|
-
}
|
|
927
|
-
function lowerIfExists(maybeAttr) {
|
|
928
|
-
if (maybeAttr === void 0 || maybeAttr === null) {
|
|
929
|
-
return "";
|
|
930
|
-
} else {
|
|
931
|
-
return maybeAttr.toLowerCase();
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
935
|
-
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
936
|
-
return true;
|
|
937
|
-
} else if (sn.type === NodeType.Element) {
|
|
938
|
-
if (slimDOMOptions.script && (
|
|
939
|
-
// script tag
|
|
940
|
-
sn.tagName === "script" ||
|
|
941
|
-
// (module)preload link
|
|
942
|
-
sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" ||
|
|
943
|
-
// prefetch link
|
|
944
|
-
sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
|
|
945
|
-
return true;
|
|
946
|
-
} 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"))) {
|
|
947
|
-
return true;
|
|
948
|
-
} else if (sn.tagName === "meta") {
|
|
949
|
-
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
950
|
-
return true;
|
|
951
|
-
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||
|
|
952
|
-
// og = opengraph (facebook)
|
|
953
|
-
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
954
|
-
return true;
|
|
955
|
-
} else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
|
|
956
|
-
return true;
|
|
957
|
-
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
958
|
-
return true;
|
|
959
|
-
} 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:/))) {
|
|
960
|
-
return true;
|
|
961
|
-
} 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")) {
|
|
962
|
-
return true;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
return false;
|
|
967
|
-
}
|
|
968
|
-
function serializeNodeWithId(n, options) {
|
|
969
|
-
var doc = options.doc,
|
|
970
|
-
mirror = options.mirror,
|
|
971
|
-
blockClass = options.blockClass,
|
|
972
|
-
blockSelector = options.blockSelector,
|
|
973
|
-
maskTextClass = options.maskTextClass,
|
|
974
|
-
maskTextSelector = options.maskTextSelector,
|
|
975
|
-
_options$skipChild = options.skipChild,
|
|
976
|
-
skipChild = _options$skipChild === void 0 ? false : _options$skipChild,
|
|
977
|
-
_options$inlineStyles = options.inlineStylesheet,
|
|
978
|
-
inlineStylesheet = _options$inlineStyles === void 0 ? true : _options$inlineStyles,
|
|
979
|
-
_options$maskInputOpt3 = options.maskInputOptions,
|
|
980
|
-
maskInputOptions = _options$maskInputOpt3 === void 0 ? {} : _options$maskInputOpt3,
|
|
981
|
-
maskTextFn = options.maskTextFn,
|
|
982
|
-
maskInputFn = options.maskInputFn,
|
|
983
|
-
slimDOMOptions = options.slimDOMOptions,
|
|
984
|
-
_options$dataURLOptio3 = options.dataURLOptions,
|
|
985
|
-
dataURLOptions = _options$dataURLOptio3 === void 0 ? {} : _options$dataURLOptio3,
|
|
986
|
-
_options$inlineImages = options.inlineImages,
|
|
987
|
-
inlineImages = _options$inlineImages === void 0 ? false : _options$inlineImages,
|
|
988
|
-
_options$recordCanvas = options.recordCanvas,
|
|
989
|
-
recordCanvas = _options$recordCanvas === void 0 ? false : _options$recordCanvas,
|
|
990
|
-
onSerialize = options.onSerialize,
|
|
991
|
-
onIframeLoad = options.onIframeLoad,
|
|
992
|
-
_options$iframeLoadTi = options.iframeLoadTimeout,
|
|
993
|
-
iframeLoadTimeout = _options$iframeLoadTi === void 0 ? 5e3 : _options$iframeLoadTi,
|
|
994
|
-
onStylesheetLoad = options.onStylesheetLoad,
|
|
995
|
-
_options$stylesheetLo = options.stylesheetLoadTimeout,
|
|
996
|
-
stylesheetLoadTimeout = _options$stylesheetLo === void 0 ? 5e3 : _options$stylesheetLo,
|
|
997
|
-
_options$keepIframeSr = options.keepIframeSrcFn,
|
|
998
|
-
keepIframeSrcFn = _options$keepIframeSr === void 0 ? function () {
|
|
999
|
-
return false;
|
|
1000
|
-
} : _options$keepIframeSr,
|
|
1001
|
-
_options$newlyAddedEl3 = options.newlyAddedElement,
|
|
1002
|
-
newlyAddedElement = _options$newlyAddedEl3 === void 0 ? false : _options$newlyAddedEl3;
|
|
1003
|
-
var needsMask = options.needsMask;
|
|
1004
|
-
var _options$preserveWhit = options.preserveWhiteSpace,
|
|
1005
|
-
preserveWhiteSpace = _options$preserveWhit === void 0 ? true : _options$preserveWhit;
|
|
1006
|
-
if (!needsMask && n.childNodes) {
|
|
1007
|
-
var checkAncestors = needsMask === void 0;
|
|
1008
|
-
needsMask = needMaskingText(n, maskTextClass, maskTextSelector, checkAncestors);
|
|
1009
|
-
}
|
|
1010
|
-
var _serializedNode = serializeNode(n, {
|
|
1011
|
-
doc: doc,
|
|
1012
|
-
mirror: mirror,
|
|
1013
|
-
blockClass: blockClass,
|
|
1014
|
-
blockSelector: blockSelector,
|
|
1015
|
-
needsMask: needsMask,
|
|
1016
|
-
inlineStylesheet: inlineStylesheet,
|
|
1017
|
-
maskInputOptions: maskInputOptions,
|
|
1018
|
-
maskTextFn: maskTextFn,
|
|
1019
|
-
maskInputFn: maskInputFn,
|
|
1020
|
-
dataURLOptions: dataURLOptions,
|
|
1021
|
-
inlineImages: inlineImages,
|
|
1022
|
-
recordCanvas: recordCanvas,
|
|
1023
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
1024
|
-
newlyAddedElement: newlyAddedElement
|
|
1025
|
-
});
|
|
1026
|
-
if (!_serializedNode) {
|
|
1027
|
-
console.warn(n, "not serialized");
|
|
1028
|
-
return null;
|
|
1029
|
-
}
|
|
1030
|
-
var id;
|
|
1031
|
-
if (mirror.hasNode(n)) {
|
|
1032
|
-
id = mirror.getId(n);
|
|
1033
|
-
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
1034
|
-
id = IGNORED_NODE;
|
|
1035
|
-
} else {
|
|
1036
|
-
id = genId();
|
|
1037
|
-
}
|
|
1038
|
-
var serializedNode2 = _extends(_serializedNode, {
|
|
1039
|
-
id: id
|
|
1040
|
-
});
|
|
1041
|
-
mirror.add(n, serializedNode2);
|
|
1042
|
-
if (id === IGNORED_NODE) {
|
|
1043
|
-
return null;
|
|
1044
|
-
}
|
|
1045
|
-
if (onSerialize) {
|
|
1046
|
-
onSerialize(n);
|
|
1047
|
-
}
|
|
1048
|
-
var recordChild = !skipChild;
|
|
1049
|
-
if (serializedNode2.type === NodeType.Element) {
|
|
1050
|
-
recordChild = recordChild && !serializedNode2.needBlock;
|
|
1051
|
-
delete serializedNode2.needBlock;
|
|
1052
|
-
var shadowRoot = n.shadowRoot;
|
|
1053
|
-
if (shadowRoot && isNativeShadowDom(shadowRoot)) serializedNode2.isShadowHost = true;
|
|
1054
|
-
}
|
|
1055
|
-
if ((serializedNode2.type === NodeType.Document || serializedNode2.type === NodeType.Element) && recordChild) {
|
|
1056
|
-
if (slimDOMOptions.headWhitespace && serializedNode2.type === NodeType.Element && serializedNode2.tagName === "head") {
|
|
1057
|
-
preserveWhiteSpace = false;
|
|
1058
|
-
}
|
|
1059
|
-
var bypassOptions = {
|
|
1060
|
-
doc: doc,
|
|
1061
|
-
mirror: mirror,
|
|
1062
|
-
blockClass: blockClass,
|
|
1063
|
-
blockSelector: blockSelector,
|
|
1064
|
-
needsMask: needsMask,
|
|
1065
|
-
maskTextClass: maskTextClass,
|
|
1066
|
-
maskTextSelector: maskTextSelector,
|
|
1067
|
-
skipChild: skipChild,
|
|
1068
|
-
inlineStylesheet: inlineStylesheet,
|
|
1069
|
-
maskInputOptions: maskInputOptions,
|
|
1070
|
-
maskTextFn: maskTextFn,
|
|
1071
|
-
maskInputFn: maskInputFn,
|
|
1072
|
-
slimDOMOptions: slimDOMOptions,
|
|
1073
|
-
dataURLOptions: dataURLOptions,
|
|
1074
|
-
inlineImages: inlineImages,
|
|
1075
|
-
recordCanvas: recordCanvas,
|
|
1076
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
1077
|
-
onSerialize: onSerialize,
|
|
1078
|
-
onIframeLoad: onIframeLoad,
|
|
1079
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
1080
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
1081
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1082
|
-
keepIframeSrcFn: keepIframeSrcFn
|
|
1083
|
-
};
|
|
1084
|
-
if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "textarea" && serializedNode2.attributes.value !== void 0) ;else {
|
|
1085
|
-
for (var _i = 0, _Array$from = Array.from(n.childNodes); _i < _Array$from.length; _i++) {
|
|
1086
|
-
var childN = _Array$from[_i];
|
|
1087
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
1088
|
-
if (serializedChildNode) {
|
|
1089
|
-
serializedNode2.childNodes.push(serializedChildNode);
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
if (isElement(n) && n.shadowRoot) {
|
|
1094
|
-
for (var _i2 = 0, _Array$from2 = Array.from(n.shadowRoot.childNodes); _i2 < _Array$from2.length; _i2++) {
|
|
1095
|
-
var _childN = _Array$from2[_i2];
|
|
1096
|
-
var _serializedChildNode = serializeNodeWithId(_childN, bypassOptions);
|
|
1097
|
-
if (_serializedChildNode) {
|
|
1098
|
-
isNativeShadowDom(n.shadowRoot) && (_serializedChildNode.isShadow = true);
|
|
1099
|
-
serializedNode2.childNodes.push(_serializedChildNode);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
if (n.parentNode && isShadowRoot(n.parentNode) && isNativeShadowDom(n.parentNode)) {
|
|
1105
|
-
serializedNode2.isShadow = true;
|
|
1106
|
-
}
|
|
1107
|
-
if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "iframe") {
|
|
1108
|
-
onceIframeLoaded(n, function () {
|
|
1109
|
-
var iframeDoc = n.contentDocument;
|
|
1110
|
-
if (iframeDoc && onIframeLoad) {
|
|
1111
|
-
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
1112
|
-
doc: iframeDoc,
|
|
1113
|
-
mirror: mirror,
|
|
1114
|
-
blockClass: blockClass,
|
|
1115
|
-
blockSelector: blockSelector,
|
|
1116
|
-
needsMask: needsMask,
|
|
1117
|
-
maskTextClass: maskTextClass,
|
|
1118
|
-
maskTextSelector: maskTextSelector,
|
|
1119
|
-
skipChild: false,
|
|
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 (serializedIframeNode) {
|
|
1137
|
-
onIframeLoad(n, serializedIframeNode);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
}, iframeLoadTimeout);
|
|
1141
|
-
}
|
|
1142
|
-
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")) {
|
|
1143
|
-
onceStylesheetLoaded(n, function () {
|
|
1144
|
-
if (onStylesheetLoad) {
|
|
1145
|
-
var serializedLinkNode = serializeNodeWithId(n, {
|
|
1146
|
-
doc: doc,
|
|
1147
|
-
mirror: mirror,
|
|
1148
|
-
blockClass: blockClass,
|
|
1149
|
-
blockSelector: blockSelector,
|
|
1150
|
-
needsMask: needsMask,
|
|
1151
|
-
maskTextClass: maskTextClass,
|
|
1152
|
-
maskTextSelector: maskTextSelector,
|
|
1153
|
-
skipChild: false,
|
|
1154
|
-
inlineStylesheet: inlineStylesheet,
|
|
1155
|
-
maskInputOptions: maskInputOptions,
|
|
1156
|
-
maskTextFn: maskTextFn,
|
|
1157
|
-
maskInputFn: maskInputFn,
|
|
1158
|
-
slimDOMOptions: slimDOMOptions,
|
|
1159
|
-
dataURLOptions: dataURLOptions,
|
|
1160
|
-
inlineImages: inlineImages,
|
|
1161
|
-
recordCanvas: recordCanvas,
|
|
1162
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
1163
|
-
onSerialize: onSerialize,
|
|
1164
|
-
onIframeLoad: onIframeLoad,
|
|
1165
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
1166
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
1167
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1168
|
-
keepIframeSrcFn: keepIframeSrcFn
|
|
1169
|
-
});
|
|
1170
|
-
if (serializedLinkNode) {
|
|
1171
|
-
onStylesheetLoad(n, serializedLinkNode);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}, stylesheetLoadTimeout);
|
|
1175
|
-
}
|
|
1176
|
-
return serializedNode2;
|
|
1177
|
-
}
|
|
1178
|
-
function snapshot(n, options) {
|
|
1179
|
-
var _ref3 = options || {},
|
|
1180
|
-
_ref3$mirror = _ref3.mirror,
|
|
1181
|
-
mirror = _ref3$mirror === void 0 ? new Mirror() : _ref3$mirror,
|
|
1182
|
-
_ref3$blockClass = _ref3.blockClass,
|
|
1183
|
-
blockClass = _ref3$blockClass === void 0 ? "rr-block" : _ref3$blockClass,
|
|
1184
|
-
_ref3$blockSelector = _ref3.blockSelector,
|
|
1185
|
-
blockSelector = _ref3$blockSelector === void 0 ? null : _ref3$blockSelector,
|
|
1186
|
-
_ref3$maskTextClass = _ref3.maskTextClass,
|
|
1187
|
-
maskTextClass = _ref3$maskTextClass === void 0 ? "rr-mask" : _ref3$maskTextClass,
|
|
1188
|
-
_ref3$maskTextSelecto = _ref3.maskTextSelector,
|
|
1189
|
-
maskTextSelector = _ref3$maskTextSelecto === void 0 ? null : _ref3$maskTextSelecto,
|
|
1190
|
-
_ref3$inlineStyleshee = _ref3.inlineStylesheet,
|
|
1191
|
-
inlineStylesheet = _ref3$inlineStyleshee === void 0 ? true : _ref3$inlineStyleshee,
|
|
1192
|
-
_ref3$inlineImages = _ref3.inlineImages,
|
|
1193
|
-
inlineImages = _ref3$inlineImages === void 0 ? false : _ref3$inlineImages,
|
|
1194
|
-
_ref3$recordCanvas = _ref3.recordCanvas,
|
|
1195
|
-
recordCanvas = _ref3$recordCanvas === void 0 ? false : _ref3$recordCanvas,
|
|
1196
|
-
_ref3$maskAllInputs = _ref3.maskAllInputs,
|
|
1197
|
-
maskAllInputs = _ref3$maskAllInputs === void 0 ? false : _ref3$maskAllInputs,
|
|
1198
|
-
maskTextFn = _ref3.maskTextFn,
|
|
1199
|
-
maskInputFn = _ref3.maskInputFn,
|
|
1200
|
-
_ref3$slimDOM = _ref3.slimDOM,
|
|
1201
|
-
slimDOM = _ref3$slimDOM === void 0 ? false : _ref3$slimDOM,
|
|
1202
|
-
dataURLOptions = _ref3.dataURLOptions,
|
|
1203
|
-
preserveWhiteSpace = _ref3.preserveWhiteSpace,
|
|
1204
|
-
onSerialize = _ref3.onSerialize,
|
|
1205
|
-
onIframeLoad = _ref3.onIframeLoad,
|
|
1206
|
-
iframeLoadTimeout = _ref3.iframeLoadTimeout,
|
|
1207
|
-
onStylesheetLoad = _ref3.onStylesheetLoad,
|
|
1208
|
-
stylesheetLoadTimeout = _ref3.stylesheetLoadTimeout,
|
|
1209
|
-
_ref3$keepIframeSrcFn = _ref3.keepIframeSrcFn,
|
|
1210
|
-
keepIframeSrcFn = _ref3$keepIframeSrcFn === void 0 ? function () {
|
|
1211
|
-
return false;
|
|
1212
|
-
} : _ref3$keepIframeSrcFn;
|
|
1213
|
-
var maskInputOptions = maskAllInputs === true ? {
|
|
1214
|
-
color: true,
|
|
1215
|
-
date: true,
|
|
1216
|
-
"datetime-local": true,
|
|
1217
|
-
email: true,
|
|
1218
|
-
month: true,
|
|
1219
|
-
number: true,
|
|
1220
|
-
range: true,
|
|
1221
|
-
search: true,
|
|
1222
|
-
tel: true,
|
|
1223
|
-
text: true,
|
|
1224
|
-
time: true,
|
|
1225
|
-
url: true,
|
|
1226
|
-
week: true,
|
|
1227
|
-
textarea: true,
|
|
1228
|
-
select: true,
|
|
1229
|
-
password: true
|
|
1230
|
-
} : maskAllInputs === false ? {
|
|
1231
|
-
password: true
|
|
1232
|
-
} : maskAllInputs;
|
|
1233
|
-
var slimDOMOptions = slimDOM === true || slimDOM === "all" ?
|
|
1234
|
-
// if true: set of sensible options that should not throw away any information
|
|
1235
|
-
{
|
|
1236
|
-
script: true,
|
|
1237
|
-
comment: true,
|
|
1238
|
-
headFavicon: true,
|
|
1239
|
-
headWhitespace: true,
|
|
1240
|
-
headMetaDescKeywords: slimDOM === "all",
|
|
1241
|
-
// destructive
|
|
1242
|
-
headMetaSocial: true,
|
|
1243
|
-
headMetaRobots: true,
|
|
1244
|
-
headMetaHttpEquiv: true,
|
|
1245
|
-
headMetaAuthorship: true,
|
|
1246
|
-
headMetaVerification: true
|
|
1247
|
-
} : slimDOM === false ? {} : slimDOM;
|
|
1248
|
-
return serializeNodeWithId(n, {
|
|
1249
|
-
doc: n,
|
|
1250
|
-
mirror: mirror,
|
|
1251
|
-
blockClass: blockClass,
|
|
1252
|
-
blockSelector: blockSelector,
|
|
1253
|
-
maskTextClass: maskTextClass,
|
|
1254
|
-
maskTextSelector: maskTextSelector,
|
|
1255
|
-
skipChild: false,
|
|
1256
|
-
inlineStylesheet: inlineStylesheet,
|
|
1257
|
-
maskInputOptions: maskInputOptions,
|
|
1258
|
-
maskTextFn: maskTextFn,
|
|
1259
|
-
maskInputFn: maskInputFn,
|
|
1260
|
-
slimDOMOptions: slimDOMOptions,
|
|
1261
|
-
dataURLOptions: dataURLOptions,
|
|
1262
|
-
inlineImages: inlineImages,
|
|
1263
|
-
recordCanvas: recordCanvas,
|
|
1264
|
-
preserveWhiteSpace: preserveWhiteSpace,
|
|
1265
|
-
onSerialize: onSerialize,
|
|
1266
|
-
onIframeLoad: onIframeLoad,
|
|
1267
|
-
iframeLoadTimeout: iframeLoadTimeout,
|
|
1268
|
-
onStylesheetLoad: onStylesheetLoad,
|
|
1269
|
-
stylesheetLoadTimeout: stylesheetLoadTimeout,
|
|
1270
|
-
keepIframeSrcFn: keepIframeSrcFn,
|
|
1271
|
-
newlyAddedElement: false
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
// @ts-nocheck
|
|
1276
17
|
function getWorkerString() {
|
|
1277
18
|
var _this = this;
|
|
1278
|
-
var MAX_CHUNK_SIZE = 1024 * 1024;
|
|
19
|
+
var MAX_CHUNK_SIZE = 1024 * 1024;
|
|
1279
20
|
var ERROR_MESSAGE = 'Coralogix Browser SDK - Error from session recording worker:\n';
|
|
1280
21
|
importScriptWithFallback('https://cdn.rum-ingress-coralogix.com/coralogix/browser/latest/pako_deflate.es5.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako_deflate.es5.min.js');
|
|
1281
22
|
self.onmessage = function (_a) {
|
|
@@ -1352,7 +93,7 @@ function getWorkerString() {
|
|
|
1352
93
|
}
|
|
1353
94
|
}
|
|
1354
95
|
|
|
1355
|
-
var WorkerManager =
|
|
96
|
+
var WorkerManager = (function () {
|
|
1356
97
|
function WorkerManager() {
|
|
1357
98
|
}
|
|
1358
99
|
WorkerManager.prototype.loadAndCreateWorker = function (workerUrl) {
|
|
@@ -1362,11 +103,11 @@ var WorkerManager = /** @class */ (function () {
|
|
|
1362
103
|
switch (_b.label) {
|
|
1363
104
|
case 0:
|
|
1364
105
|
_b.trys.push([0, 4, , 5]);
|
|
1365
|
-
if (!workerUrl) return [3
|
|
1366
|
-
return [4
|
|
106
|
+
if (!workerUrl) return [3, 2];
|
|
107
|
+
return [4, this.loadWorkerScript(workerUrl)];
|
|
1367
108
|
case 1:
|
|
1368
109
|
_a = _b.sent();
|
|
1369
|
-
return [3
|
|
110
|
+
return [3, 3];
|
|
1370
111
|
case 2:
|
|
1371
112
|
_a = "(".concat(getWorkerString.toString(), ")()");
|
|
1372
113
|
_b.label = 3;
|
|
@@ -1376,12 +117,12 @@ var WorkerManager = /** @class */ (function () {
|
|
|
1376
117
|
type: 'application/javascript',
|
|
1377
118
|
});
|
|
1378
119
|
blobUrl = URL.createObjectURL(workerBlob);
|
|
1379
|
-
return [2
|
|
120
|
+
return [2, new Worker(blobUrl)];
|
|
1380
121
|
case 4:
|
|
1381
122
|
error_1 = _b.sent();
|
|
1382
123
|
console.warn("CoralogixRum: Error creating worker ".concat(error_1));
|
|
1383
|
-
return [2
|
|
1384
|
-
case 5: return [2
|
|
124
|
+
return [2, undefined];
|
|
125
|
+
case 5: return [2];
|
|
1385
126
|
}
|
|
1386
127
|
});
|
|
1387
128
|
});
|
|
@@ -1393,20 +134,20 @@ var WorkerManager = /** @class */ (function () {
|
|
|
1393
134
|
switch (_a.label) {
|
|
1394
135
|
case 0:
|
|
1395
136
|
_a.trys.push([0, 3, , 4]);
|
|
1396
|
-
return [4
|
|
137
|
+
return [4, fetch(this.getFullWorkerUrl(url))];
|
|
1397
138
|
case 1:
|
|
1398
139
|
response = _a.sent();
|
|
1399
140
|
if (!response.ok) {
|
|
1400
141
|
console.warn("CoralogixRum: Error fetching custom web worker");
|
|
1401
|
-
return [2
|
|
142
|
+
return [2, ''];
|
|
1402
143
|
}
|
|
1403
|
-
return [4
|
|
1404
|
-
case 2: return [2
|
|
144
|
+
return [4, response.text()];
|
|
145
|
+
case 2: return [2, _a.sent()];
|
|
1405
146
|
case 3:
|
|
1406
147
|
_a.sent();
|
|
1407
148
|
console.warn("CoralogixRum: Error fetching custom web worker");
|
|
1408
|
-
return [2
|
|
1409
|
-
case 4: return [2
|
|
149
|
+
return [2, ''];
|
|
150
|
+
case 4: return [2];
|
|
1410
151
|
}
|
|
1411
152
|
});
|
|
1412
153
|
});
|
|
@@ -1420,7 +161,7 @@ var WorkerManager = /** @class */ (function () {
|
|
|
1420
161
|
return WorkerManager;
|
|
1421
162
|
}());
|
|
1422
163
|
|
|
1423
|
-
var SessionRecorder =
|
|
164
|
+
var SessionRecorder = (function () {
|
|
1424
165
|
function SessionRecorder(sessionManager, recordConfig) {
|
|
1425
166
|
var _this = this;
|
|
1426
167
|
var _a;
|
|
@@ -1470,23 +211,23 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1470
211
|
switch (_c.label) {
|
|
1471
212
|
case 0:
|
|
1472
213
|
_c.trys.push([0, 4, , 5]);
|
|
1473
|
-
if (!!this.isErrorOccurred) return [3
|
|
1474
|
-
return [4
|
|
214
|
+
if (!!this.isErrorOccurred) return [3, 2];
|
|
215
|
+
return [4, ((_b = this.request) === null || _b === void 0 ? void 0 : _b.send(formData))];
|
|
1475
216
|
case 1:
|
|
1476
217
|
_a = _c.sent();
|
|
1477
|
-
return [3
|
|
218
|
+
return [3, 3];
|
|
1478
219
|
case 2:
|
|
1479
220
|
_a = undefined;
|
|
1480
221
|
_c.label = 3;
|
|
1481
222
|
case 3:
|
|
1482
223
|
response = _a;
|
|
1483
224
|
this.handleSessionRecordingResponse(response);
|
|
1484
|
-
return [3
|
|
225
|
+
return [3, 5];
|
|
1485
226
|
case 4:
|
|
1486
227
|
_c.sent();
|
|
1487
228
|
this.handleSessionRecordingResponse();
|
|
1488
|
-
return [3
|
|
1489
|
-
case 5: return [2
|
|
229
|
+
return [3, 5];
|
|
230
|
+
case 5: return [2];
|
|
1490
231
|
}
|
|
1491
232
|
});
|
|
1492
233
|
}); };
|
|
@@ -1549,11 +290,11 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1549
290
|
return __awaiter(this, void 0, void 0, function () {
|
|
1550
291
|
return __generator(this, function (_a) {
|
|
1551
292
|
switch (_a.label) {
|
|
1552
|
-
case 0: return [4
|
|
293
|
+
case 0: return [4, this.isWorkerReady];
|
|
1553
294
|
case 1:
|
|
1554
295
|
_a.sent();
|
|
1555
296
|
if (!this.sessionWorker || this.recordRef) {
|
|
1556
|
-
return [2
|
|
297
|
+
return [2];
|
|
1557
298
|
}
|
|
1558
299
|
if (this.debugMode) {
|
|
1559
300
|
console.debug('Coralogix Browser SDK - Session recording started');
|
|
@@ -1565,7 +306,7 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1565
306
|
this.recordingStopDueToTimeout = false;
|
|
1566
307
|
this.recordRef = record(this.recordConfig);
|
|
1567
308
|
this.startBatchingRecords();
|
|
1568
|
-
return [2
|
|
309
|
+
return [2];
|
|
1569
310
|
}
|
|
1570
311
|
});
|
|
1571
312
|
});
|
|
@@ -1631,7 +372,6 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1631
372
|
SessionRecorder.prototype.prepareRecordConfig = function (recordConfig) {
|
|
1632
373
|
var _a;
|
|
1633
374
|
var _b = recordConfig || {}, excludeDOMOptions = _b.excludeDOMOptions, recordConsoleEvents = _b.recordConsoleEvents;
|
|
1634
|
-
// @ts-ignore
|
|
1635
375
|
this.recordConfig = __assign(__assign({}, recordConfig), { emit: this.handleRecordEvent, checkoutEveryNms: this.onlySessionWithErrorMode
|
|
1636
376
|
? this.maxRecordTimeForSessionWithError
|
|
1637
377
|
: undefined, slimDOMOptions: __assign(__assign({}, excludeDOMOptions), { script: (_a = excludeDOMOptions === null || excludeDOMOptions === void 0 ? void 0 : excludeDOMOptions.script) !== null && _a !== void 0 ? _a : true }), plugins: recordConsoleEvents ? [getRecordConsolePlugin()] : [] });
|
|
@@ -1645,7 +385,6 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1645
385
|
return;
|
|
1646
386
|
}
|
|
1647
387
|
var shouldAddNewSnapshot = !!isCheckout && event.type === EventType.Meta;
|
|
1648
|
-
// Add new snapshot to the cache
|
|
1649
388
|
if (shouldAddNewSnapshot) {
|
|
1650
389
|
this.recordEventsForSessionWithError.push([]);
|
|
1651
390
|
}
|
|
@@ -1663,7 +402,6 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1663
402
|
this.resetBatching();
|
|
1664
403
|
}
|
|
1665
404
|
else {
|
|
1666
|
-
// If no error occurred, we need to keep only the last 2 snapshots
|
|
1667
405
|
this.recordEventsForSessionWithError = [beforeLast, last];
|
|
1668
406
|
}
|
|
1669
407
|
};
|
|
@@ -1735,7 +473,6 @@ var SessionRecorder = /** @class */ (function () {
|
|
|
1735
473
|
};
|
|
1736
474
|
SessionRecorder.prototype.handleSessionRecordingResponse = function (response) {
|
|
1737
475
|
if (response === null || response === void 0 ? void 0 : response.ok) {
|
|
1738
|
-
// If the response is ok, we can assume that the recording was successful and no error occurred
|
|
1739
476
|
this.hasRecording = true;
|
|
1740
477
|
this.isErrorOccurred = false;
|
|
1741
478
|
}
|