@anyreplay/browser 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -30,6 +30,7 @@ __export(src_exports, {
30
30
  TRACK_TAG: () => TRACK_TAG,
31
31
  Transport: () => Transport,
32
32
  createRecorder: () => createRecorder,
33
+ forgetVisitor: () => forgetVisitor,
33
34
  hashToUnitInterval: () => hashToUnitInterval,
34
35
  isSampledIn: () => isSampledIn,
35
36
  resolveIdentity: () => resolveIdentity,
@@ -40,8 +41,3634 @@ __export(src_exports, {
40
41
  });
41
42
  module.exports = __toCommonJS(src_exports);
42
43
 
43
- // src/recorder.ts
44
- var import_rrweb = require("rrweb");
44
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js
45
+ var NodeType;
46
+ (function(NodeType2) {
47
+ NodeType2[NodeType2["Document"] = 0] = "Document";
48
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
49
+ NodeType2[NodeType2["Element"] = 2] = "Element";
50
+ NodeType2[NodeType2["Text"] = 3] = "Text";
51
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
52
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
53
+ })(NodeType || (NodeType = {}));
54
+ function isElement(n) {
55
+ return n.nodeType === n.ELEMENT_NODE;
56
+ }
57
+ function isShadowRoot(n) {
58
+ var host = n === null || n === void 0 ? void 0 : n.host;
59
+ return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n);
60
+ }
61
+ function isNativeShadowDom(shadowRoot) {
62
+ return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]";
63
+ }
64
+ function fixBrowserCompatibilityIssuesInCSS(cssText) {
65
+ if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
66
+ cssText = cssText.replace(" background-clip: text;", " -webkit-background-clip: text; background-clip: text;");
67
+ }
68
+ return cssText;
69
+ }
70
+ function getCssRulesString(s) {
71
+ try {
72
+ var rules = s.rules || s.cssRules;
73
+ return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules).map(getCssRuleString).join("")) : null;
74
+ } catch (error) {
75
+ return null;
76
+ }
77
+ }
78
+ function getCssRuleString(rule) {
79
+ var cssStringified = rule.cssText;
80
+ if (isCSSImportRule(rule)) {
81
+ try {
82
+ cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
83
+ } catch (_a) {
84
+ }
85
+ }
86
+ return cssStringified;
87
+ }
88
+ function isCSSImportRule(rule) {
89
+ return "styleSheet" in rule;
90
+ }
91
+ var Mirror = function() {
92
+ function Mirror2() {
93
+ this.idNodeMap = /* @__PURE__ */ new Map();
94
+ this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
95
+ }
96
+ Mirror2.prototype.getId = function(n) {
97
+ var _a;
98
+ if (!n)
99
+ return -1;
100
+ var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
101
+ return id !== null && id !== void 0 ? id : -1;
102
+ };
103
+ Mirror2.prototype.getNode = function(id) {
104
+ return this.idNodeMap.get(id) || null;
105
+ };
106
+ Mirror2.prototype.getIds = function() {
107
+ return Array.from(this.idNodeMap.keys());
108
+ };
109
+ Mirror2.prototype.getMeta = function(n) {
110
+ return this.nodeMetaMap.get(n) || null;
111
+ };
112
+ Mirror2.prototype.removeNodeFromMap = function(n) {
113
+ var _this = this;
114
+ var id = this.getId(n);
115
+ this.idNodeMap["delete"](id);
116
+ if (n.childNodes) {
117
+ n.childNodes.forEach(function(childNode) {
118
+ return _this.removeNodeFromMap(childNode);
119
+ });
120
+ }
121
+ };
122
+ Mirror2.prototype.has = function(id) {
123
+ return this.idNodeMap.has(id);
124
+ };
125
+ Mirror2.prototype.hasNode = function(node) {
126
+ return this.nodeMetaMap.has(node);
127
+ };
128
+ Mirror2.prototype.add = function(n, meta) {
129
+ var id = meta.id;
130
+ this.idNodeMap.set(id, n);
131
+ this.nodeMetaMap.set(n, meta);
132
+ };
133
+ Mirror2.prototype.replace = function(id, n) {
134
+ var oldNode = this.getNode(id);
135
+ if (oldNode) {
136
+ var meta = this.nodeMetaMap.get(oldNode);
137
+ if (meta)
138
+ this.nodeMetaMap.set(n, meta);
139
+ }
140
+ this.idNodeMap.set(id, n);
141
+ };
142
+ Mirror2.prototype.reset = function() {
143
+ this.idNodeMap = /* @__PURE__ */ new Map();
144
+ this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
145
+ };
146
+ return Mirror2;
147
+ }();
148
+ function createMirror() {
149
+ return new Mirror();
150
+ }
151
+ function maskInputValue(_a) {
152
+ var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
153
+ var text = value || "";
154
+ if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {
155
+ if (maskInputFn) {
156
+ text = maskInputFn(text);
157
+ } else {
158
+ text = "*".repeat(text.length);
159
+ }
160
+ }
161
+ return text;
162
+ }
163
+ var ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
164
+ function is2DCanvasBlank(canvas) {
165
+ var ctx = canvas.getContext("2d");
166
+ if (!ctx)
167
+ return true;
168
+ var chunkSize = 50;
169
+ for (var x = 0; x < canvas.width; x += chunkSize) {
170
+ for (var y = 0; y < canvas.height; y += chunkSize) {
171
+ var getImageData = ctx.getImageData;
172
+ var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
173
+ var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
174
+ if (pixelBuffer.some(function(pixel) {
175
+ return pixel !== 0;
176
+ }))
177
+ return false;
178
+ }
179
+ }
180
+ return true;
181
+ }
182
+ var _id = 1;
183
+ var tagNameRegex = new RegExp("[^a-z0-9-_:]");
184
+ var IGNORED_NODE = -2;
185
+ function genId() {
186
+ return _id++;
187
+ }
188
+ function getValidTagName(element) {
189
+ if (element instanceof HTMLFormElement) {
190
+ return "form";
191
+ }
192
+ var processedTagName = element.tagName.toLowerCase().trim();
193
+ if (tagNameRegex.test(processedTagName)) {
194
+ return "div";
195
+ }
196
+ return processedTagName;
197
+ }
198
+ function stringifyStyleSheet(sheet) {
199
+ return sheet.cssRules ? Array.from(sheet.cssRules).map(function(rule) {
200
+ return rule.cssText || "";
201
+ }).join("") : "";
202
+ }
203
+ function extractOrigin(url) {
204
+ var origin = "";
205
+ if (url.indexOf("//") > -1) {
206
+ origin = url.split("/").slice(0, 3).join("/");
207
+ } else {
208
+ origin = url.split("/")[0];
209
+ }
210
+ origin = origin.split("?")[0];
211
+ return origin;
212
+ }
213
+ var canvasService;
214
+ var canvasCtx;
215
+ var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
216
+ var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
217
+ var DATA_URI = /^(data:)([^,]*),(.*)/i;
218
+ function absoluteToStylesheet(cssText, href) {
219
+ return (cssText || "").replace(URL_IN_CSS_REF, function(origin, quote1, path1, quote2, path2, path3) {
220
+ var filePath = path1 || path2 || path3;
221
+ var maybeQuote = quote1 || quote2 || "";
222
+ if (!filePath) {
223
+ return origin;
224
+ }
225
+ if (!RELATIVE_PATH.test(filePath)) {
226
+ return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
227
+ }
228
+ if (DATA_URI.test(filePath)) {
229
+ return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
230
+ }
231
+ if (filePath[0] === "/") {
232
+ return "url(".concat(maybeQuote).concat(extractOrigin(href) + filePath).concat(maybeQuote, ")");
233
+ }
234
+ var stack = href.split("/");
235
+ var parts = filePath.split("/");
236
+ stack.pop();
237
+ for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
238
+ var part = parts_1[_i];
239
+ if (part === ".") {
240
+ continue;
241
+ } else if (part === "..") {
242
+ stack.pop();
243
+ } else {
244
+ stack.push(part);
245
+ }
246
+ }
247
+ return "url(".concat(maybeQuote).concat(stack.join("/")).concat(maybeQuote, ")");
248
+ });
249
+ }
250
+ var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
251
+ var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
252
+ function getAbsoluteSrcsetString(doc, attributeValue) {
253
+ if (attributeValue.trim() === "") {
254
+ return attributeValue;
255
+ }
256
+ var pos = 0;
257
+ function collectCharacters(regEx) {
258
+ var chars2;
259
+ var match = regEx.exec(attributeValue.substring(pos));
260
+ if (match) {
261
+ chars2 = match[0];
262
+ pos += chars2.length;
263
+ return chars2;
264
+ }
265
+ return "";
266
+ }
267
+ var output = [];
268
+ while (true) {
269
+ collectCharacters(SRCSET_COMMAS_OR_SPACES);
270
+ if (pos >= attributeValue.length) {
271
+ break;
272
+ }
273
+ var url = collectCharacters(SRCSET_NOT_SPACES);
274
+ if (url.slice(-1) === ",") {
275
+ url = absoluteToDoc(doc, url.substring(0, url.length - 1));
276
+ output.push(url);
277
+ } else {
278
+ var descriptorsStr = "";
279
+ url = absoluteToDoc(doc, url);
280
+ var inParens = false;
281
+ while (true) {
282
+ var c = attributeValue.charAt(pos);
283
+ if (c === "") {
284
+ output.push((url + descriptorsStr).trim());
285
+ break;
286
+ } else if (!inParens) {
287
+ if (c === ",") {
288
+ pos += 1;
289
+ output.push((url + descriptorsStr).trim());
290
+ break;
291
+ } else if (c === "(") {
292
+ inParens = true;
293
+ }
294
+ } else {
295
+ if (c === ")") {
296
+ inParens = false;
297
+ }
298
+ }
299
+ descriptorsStr += c;
300
+ pos += 1;
301
+ }
302
+ }
303
+ }
304
+ return output.join(", ");
305
+ }
306
+ function absoluteToDoc(doc, attributeValue) {
307
+ if (!attributeValue || attributeValue.trim() === "") {
308
+ return attributeValue;
309
+ }
310
+ var a = doc.createElement("a");
311
+ a.href = attributeValue;
312
+ return a.href;
313
+ }
314
+ function isSVGElement(el) {
315
+ return Boolean(el.tagName === "svg" || el.ownerSVGElement);
316
+ }
317
+ function getHref() {
318
+ var a = document.createElement("a");
319
+ a.href = "";
320
+ return a.href;
321
+ }
322
+ function transformAttribute(doc, tagName, name, value) {
323
+ if (name === "src" || name === "href" && value && !(tagName === "use" && value[0] === "#")) {
324
+ return absoluteToDoc(doc, value);
325
+ } else if (name === "xlink:href" && value && value[0] !== "#") {
326
+ return absoluteToDoc(doc, value);
327
+ } else if (name === "background" && value && (tagName === "table" || tagName === "td" || tagName === "th")) {
328
+ return absoluteToDoc(doc, value);
329
+ } else if (name === "srcset" && value) {
330
+ return getAbsoluteSrcsetString(doc, value);
331
+ } else if (name === "style" && value) {
332
+ return absoluteToStylesheet(value, getHref());
333
+ } else if (tagName === "object" && name === "data" && value) {
334
+ return absoluteToDoc(doc, value);
335
+ } else {
336
+ return value;
337
+ }
338
+ }
339
+ function _isBlockedElement(element, blockClass, blockSelector) {
340
+ if (typeof blockClass === "string") {
341
+ if (element.classList.contains(blockClass)) {
342
+ return true;
343
+ }
344
+ } else {
345
+ for (var eIndex = element.classList.length; eIndex--; ) {
346
+ var className = element.classList[eIndex];
347
+ if (blockClass.test(className)) {
348
+ return true;
349
+ }
350
+ }
351
+ }
352
+ if (blockSelector) {
353
+ return element.matches(blockSelector);
354
+ }
355
+ return false;
356
+ }
357
+ function classMatchesRegex(node, regex, checkAncestors) {
358
+ if (!node)
359
+ return false;
360
+ if (node.nodeType !== node.ELEMENT_NODE) {
361
+ if (!checkAncestors)
362
+ return false;
363
+ return classMatchesRegex(node.parentNode, regex, checkAncestors);
364
+ }
365
+ for (var eIndex = node.classList.length; eIndex--; ) {
366
+ var className = node.classList[eIndex];
367
+ if (regex.test(className)) {
368
+ return true;
369
+ }
370
+ }
371
+ if (!checkAncestors)
372
+ return false;
373
+ return classMatchesRegex(node.parentNode, regex, checkAncestors);
374
+ }
375
+ function needMaskingText(node, maskTextClass, maskTextSelector) {
376
+ var el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
377
+ if (el === null)
378
+ return false;
379
+ if (typeof maskTextClass === "string") {
380
+ if (el.classList.contains(maskTextClass))
381
+ return true;
382
+ if (el.closest(".".concat(maskTextClass)))
383
+ return true;
384
+ } else {
385
+ if (classMatchesRegex(el, maskTextClass, true))
386
+ return true;
387
+ }
388
+ if (maskTextSelector) {
389
+ if (el.matches(maskTextSelector))
390
+ return true;
391
+ if (el.closest(maskTextSelector))
392
+ return true;
393
+ }
394
+ return false;
395
+ }
396
+ function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
397
+ var win = iframeEl.contentWindow;
398
+ if (!win) {
399
+ return;
400
+ }
401
+ var fired = false;
402
+ var readyState;
403
+ try {
404
+ readyState = win.document.readyState;
405
+ } catch (error) {
406
+ return;
407
+ }
408
+ if (readyState !== "complete") {
409
+ var timer_1 = setTimeout(function() {
410
+ if (!fired) {
411
+ listener();
412
+ fired = true;
413
+ }
414
+ }, iframeLoadTimeout);
415
+ iframeEl.addEventListener("load", function() {
416
+ clearTimeout(timer_1);
417
+ fired = true;
418
+ listener();
419
+ });
420
+ return;
421
+ }
422
+ var blankUrl = "about:blank";
423
+ if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
424
+ setTimeout(listener, 0);
425
+ return iframeEl.addEventListener("load", listener);
426
+ }
427
+ iframeEl.addEventListener("load", listener);
428
+ }
429
+ function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
430
+ var fired = false;
431
+ var styleSheetLoaded;
432
+ try {
433
+ styleSheetLoaded = link.sheet;
434
+ } catch (error) {
435
+ return;
436
+ }
437
+ if (styleSheetLoaded)
438
+ return;
439
+ var timer = setTimeout(function() {
440
+ if (!fired) {
441
+ listener();
442
+ fired = true;
443
+ }
444
+ }, styleSheetLoadTimeout);
445
+ link.addEventListener("load", function() {
446
+ clearTimeout(timer);
447
+ fired = true;
448
+ listener();
449
+ });
450
+ }
451
+ function serializeNode(n, options) {
452
+ var doc = options.doc, mirror2 = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c;
453
+ var rootId = getRootId(doc, mirror2);
454
+ switch (n.nodeType) {
455
+ case n.DOCUMENT_NODE:
456
+ if (n.compatMode !== "CSS1Compat") {
457
+ return {
458
+ type: NodeType.Document,
459
+ childNodes: [],
460
+ compatMode: n.compatMode
461
+ };
462
+ } else {
463
+ return {
464
+ type: NodeType.Document,
465
+ childNodes: []
466
+ };
467
+ }
468
+ case n.DOCUMENT_TYPE_NODE:
469
+ return {
470
+ type: NodeType.DocumentType,
471
+ name: n.name,
472
+ publicId: n.publicId,
473
+ systemId: n.systemId,
474
+ rootId
475
+ };
476
+ case n.ELEMENT_NODE:
477
+ return serializeElementNode(n, {
478
+ doc,
479
+ blockClass,
480
+ blockSelector,
481
+ inlineStylesheet,
482
+ maskInputOptions,
483
+ maskInputFn,
484
+ dataURLOptions,
485
+ inlineImages,
486
+ recordCanvas,
487
+ keepIframeSrcFn,
488
+ newlyAddedElement,
489
+ rootId
490
+ });
491
+ case n.TEXT_NODE:
492
+ return serializeTextNode(n, {
493
+ maskTextClass,
494
+ maskTextSelector,
495
+ maskTextFn,
496
+ rootId
497
+ });
498
+ case n.CDATA_SECTION_NODE:
499
+ return {
500
+ type: NodeType.CDATA,
501
+ textContent: "",
502
+ rootId
503
+ };
504
+ case n.COMMENT_NODE:
505
+ return {
506
+ type: NodeType.Comment,
507
+ textContent: n.textContent || "",
508
+ rootId
509
+ };
510
+ default:
511
+ return false;
512
+ }
513
+ }
514
+ function getRootId(doc, mirror2) {
515
+ if (!mirror2.hasNode(doc))
516
+ return void 0;
517
+ var docId = mirror2.getId(doc);
518
+ return docId === 1 ? void 0 : docId;
519
+ }
520
+ function serializeTextNode(n, options) {
521
+ var _a;
522
+ var maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, maskTextFn = options.maskTextFn, rootId = options.rootId;
523
+ var parentTagName = n.parentNode && n.parentNode.tagName;
524
+ var textContent = n.textContent;
525
+ var isStyle = parentTagName === "STYLE" ? true : void 0;
526
+ var isScript = parentTagName === "SCRIPT" ? true : void 0;
527
+ if (isStyle && textContent) {
528
+ try {
529
+ if (n.nextSibling || n.previousSibling) {
530
+ } else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
531
+ textContent = stringifyStyleSheet(n.parentNode.sheet);
532
+ }
533
+ } catch (err) {
534
+ console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(err), n);
535
+ }
536
+ textContent = absoluteToStylesheet(textContent, getHref());
537
+ }
538
+ if (isScript) {
539
+ textContent = "SCRIPT_PLACEHOLDER";
540
+ }
541
+ if (!isStyle && !isScript && textContent && needMaskingText(n, maskTextClass, maskTextSelector)) {
542
+ textContent = maskTextFn ? maskTextFn(textContent) : textContent.replace(/[\S]/g, "*");
543
+ }
544
+ return {
545
+ type: NodeType.Text,
546
+ textContent: textContent || "",
547
+ isStyle,
548
+ rootId
549
+ };
550
+ }
551
+ function serializeElementNode(n, options) {
552
+ var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, inlineStylesheet = options.inlineStylesheet, _a = options.maskInputOptions, maskInputOptions = _a === void 0 ? {} : _a, maskInputFn = options.maskInputFn, _b = options.dataURLOptions, dataURLOptions = _b === void 0 ? {} : _b, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, _c = options.newlyAddedElement, newlyAddedElement = _c === void 0 ? false : _c, rootId = options.rootId;
553
+ var needBlock = _isBlockedElement(n, blockClass, blockSelector);
554
+ var tagName = getValidTagName(n);
555
+ var attributes = {};
556
+ var len = n.attributes.length;
557
+ for (var i = 0; i < len; i++) {
558
+ var attr = n.attributes[i];
559
+ attributes[attr.name] = transformAttribute(doc, tagName, attr.name, attr.value);
560
+ }
561
+ if (tagName === "link" && inlineStylesheet) {
562
+ var stylesheet = Array.from(doc.styleSheets).find(function(s) {
563
+ return s.href === n.href;
564
+ });
565
+ var cssText = null;
566
+ if (stylesheet) {
567
+ cssText = getCssRulesString(stylesheet);
568
+ }
569
+ if (cssText) {
570
+ delete attributes.rel;
571
+ delete attributes.href;
572
+ attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href);
573
+ }
574
+ }
575
+ if (tagName === "style" && n.sheet && !(n.innerText || n.textContent || "").trim().length) {
576
+ var cssText = getCssRulesString(n.sheet);
577
+ if (cssText) {
578
+ attributes._cssText = absoluteToStylesheet(cssText, getHref());
579
+ }
580
+ }
581
+ if (tagName === "input" || tagName === "textarea" || tagName === "select") {
582
+ var value = n.value;
583
+ var checked = n.checked;
584
+ if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {
585
+ attributes.value = maskInputValue({
586
+ type: attributes.type,
587
+ tagName,
588
+ value,
589
+ maskInputOptions,
590
+ maskInputFn
591
+ });
592
+ } else if (checked) {
593
+ attributes.checked = checked;
594
+ }
595
+ }
596
+ if (tagName === "option") {
597
+ if (n.selected && !maskInputOptions["select"]) {
598
+ attributes.selected = true;
599
+ } else {
600
+ delete attributes.selected;
601
+ }
602
+ }
603
+ if (tagName === "canvas" && recordCanvas) {
604
+ if (n.__context === "2d") {
605
+ if (!is2DCanvasBlank(n)) {
606
+ attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
607
+ }
608
+ } else if (!("__context" in n)) {
609
+ var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
610
+ var blankCanvas = document.createElement("canvas");
611
+ blankCanvas.width = n.width;
612
+ blankCanvas.height = n.height;
613
+ var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
614
+ if (canvasDataURL !== blankCanvasDataURL) {
615
+ attributes.rr_dataURL = canvasDataURL;
616
+ }
617
+ }
618
+ }
619
+ if (tagName === "img" && inlineImages) {
620
+ if (!canvasService) {
621
+ canvasService = doc.createElement("canvas");
622
+ canvasCtx = canvasService.getContext("2d");
623
+ }
624
+ var image_1 = n;
625
+ var oldValue_1 = image_1.crossOrigin;
626
+ image_1.crossOrigin = "anonymous";
627
+ var recordInlineImage = function() {
628
+ try {
629
+ canvasService.width = image_1.naturalWidth;
630
+ canvasService.height = image_1.naturalHeight;
631
+ canvasCtx.drawImage(image_1, 0, 0);
632
+ attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
633
+ } catch (err) {
634
+ console.warn("Cannot inline img src=".concat(image_1.currentSrc, "! Error: ").concat(err));
635
+ }
636
+ oldValue_1 ? attributes.crossOrigin = oldValue_1 : image_1.removeAttribute("crossorigin");
637
+ };
638
+ if (image_1.complete && image_1.naturalWidth !== 0)
639
+ recordInlineImage();
640
+ else
641
+ image_1.onload = recordInlineImage;
642
+ }
643
+ if (tagName === "audio" || tagName === "video") {
644
+ attributes.rr_mediaState = n.paused ? "paused" : "played";
645
+ attributes.rr_mediaCurrentTime = n.currentTime;
646
+ }
647
+ if (!newlyAddedElement) {
648
+ if (n.scrollLeft) {
649
+ attributes.rr_scrollLeft = n.scrollLeft;
650
+ }
651
+ if (n.scrollTop) {
652
+ attributes.rr_scrollTop = n.scrollTop;
653
+ }
654
+ }
655
+ if (needBlock) {
656
+ var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
657
+ attributes = {
658
+ "class": attributes["class"],
659
+ rr_width: "".concat(width, "px"),
660
+ rr_height: "".concat(height, "px")
661
+ };
662
+ }
663
+ if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
664
+ if (!n.contentDocument) {
665
+ attributes.rr_src = attributes.src;
666
+ }
667
+ delete attributes.src;
668
+ }
669
+ return {
670
+ type: NodeType.Element,
671
+ tagName,
672
+ attributes,
673
+ childNodes: [],
674
+ isSVG: isSVGElement(n) || void 0,
675
+ needBlock,
676
+ rootId
677
+ };
678
+ }
679
+ function lowerIfExists(maybeAttr) {
680
+ if (maybeAttr === void 0) {
681
+ return "";
682
+ } else {
683
+ return maybeAttr.toLowerCase();
684
+ }
685
+ }
686
+ function slimDOMExcluded(sn, slimDOMOptions) {
687
+ if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
688
+ return true;
689
+ } else if (sn.type === NodeType.Element) {
690
+ if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && sn.attributes.href.endsWith(".js"))) {
691
+ return true;
692
+ } 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"))) {
693
+ return true;
694
+ } else if (sn.tagName === "meta") {
695
+ if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
696
+ return true;
697
+ } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
698
+ return true;
699
+ } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
700
+ return true;
701
+ } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
702
+ return true;
703
+ } 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:/))) {
704
+ return true;
705
+ } 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")) {
706
+ return true;
707
+ }
708
+ }
709
+ }
710
+ return false;
711
+ }
712
+ function serializeNodeWithId(n, options) {
713
+ var doc = options.doc, mirror2 = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5e3 : _g, onStylesheetLoad = options.onStylesheetLoad, _h = options.stylesheetLoadTimeout, stylesheetLoadTimeout = _h === void 0 ? 5e3 : _h, _j = options.keepIframeSrcFn, keepIframeSrcFn = _j === void 0 ? function() {
714
+ return false;
715
+ } : _j, _k = options.newlyAddedElement, newlyAddedElement = _k === void 0 ? false : _k;
716
+ var _l = options.preserveWhiteSpace, preserveWhiteSpace = _l === void 0 ? true : _l;
717
+ var _serializedNode = serializeNode(n, {
718
+ doc,
719
+ mirror: mirror2,
720
+ blockClass,
721
+ blockSelector,
722
+ maskTextClass,
723
+ maskTextSelector,
724
+ inlineStylesheet,
725
+ maskInputOptions,
726
+ maskTextFn,
727
+ maskInputFn,
728
+ dataURLOptions,
729
+ inlineImages,
730
+ recordCanvas,
731
+ keepIframeSrcFn,
732
+ newlyAddedElement
733
+ });
734
+ if (!_serializedNode) {
735
+ console.warn(n, "not serialized");
736
+ return null;
737
+ }
738
+ var id;
739
+ if (mirror2.hasNode(n)) {
740
+ id = mirror2.getId(n);
741
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
742
+ id = IGNORED_NODE;
743
+ } else {
744
+ id = genId();
745
+ }
746
+ var serializedNode = Object.assign(_serializedNode, { id });
747
+ mirror2.add(n, serializedNode);
748
+ if (id === IGNORED_NODE) {
749
+ return null;
750
+ }
751
+ if (onSerialize) {
752
+ onSerialize(n);
753
+ }
754
+ var recordChild = !skipChild;
755
+ if (serializedNode.type === NodeType.Element) {
756
+ recordChild = recordChild && !serializedNode.needBlock;
757
+ delete serializedNode.needBlock;
758
+ var shadowRoot = n.shadowRoot;
759
+ if (shadowRoot && isNativeShadowDom(shadowRoot))
760
+ serializedNode.isShadowHost = true;
761
+ }
762
+ if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {
763
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === "head") {
764
+ preserveWhiteSpace = false;
765
+ }
766
+ var bypassOptions = {
767
+ doc,
768
+ mirror: mirror2,
769
+ blockClass,
770
+ blockSelector,
771
+ maskTextClass,
772
+ maskTextSelector,
773
+ skipChild,
774
+ inlineStylesheet,
775
+ maskInputOptions,
776
+ maskTextFn,
777
+ maskInputFn,
778
+ slimDOMOptions,
779
+ dataURLOptions,
780
+ inlineImages,
781
+ recordCanvas,
782
+ preserveWhiteSpace,
783
+ onSerialize,
784
+ onIframeLoad,
785
+ iframeLoadTimeout,
786
+ onStylesheetLoad,
787
+ stylesheetLoadTimeout,
788
+ keepIframeSrcFn
789
+ };
790
+ for (var _i = 0, _m = Array.from(n.childNodes); _i < _m.length; _i++) {
791
+ var childN = _m[_i];
792
+ var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
793
+ if (serializedChildNode) {
794
+ serializedNode.childNodes.push(serializedChildNode);
795
+ }
796
+ }
797
+ if (isElement(n) && n.shadowRoot) {
798
+ for (var _o = 0, _p = Array.from(n.shadowRoot.childNodes); _o < _p.length; _o++) {
799
+ var childN = _p[_o];
800
+ var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
801
+ if (serializedChildNode) {
802
+ isNativeShadowDom(n.shadowRoot) && (serializedChildNode.isShadow = true);
803
+ serializedNode.childNodes.push(serializedChildNode);
804
+ }
805
+ }
806
+ }
807
+ }
808
+ if (n.parentNode && isShadowRoot(n.parentNode) && isNativeShadowDom(n.parentNode)) {
809
+ serializedNode.isShadow = true;
810
+ }
811
+ if (serializedNode.type === NodeType.Element && serializedNode.tagName === "iframe") {
812
+ onceIframeLoaded(n, function() {
813
+ var iframeDoc = n.contentDocument;
814
+ if (iframeDoc && onIframeLoad) {
815
+ var serializedIframeNode = serializeNodeWithId(iframeDoc, {
816
+ doc: iframeDoc,
817
+ mirror: mirror2,
818
+ blockClass,
819
+ blockSelector,
820
+ maskTextClass,
821
+ maskTextSelector,
822
+ skipChild: false,
823
+ inlineStylesheet,
824
+ maskInputOptions,
825
+ maskTextFn,
826
+ maskInputFn,
827
+ slimDOMOptions,
828
+ dataURLOptions,
829
+ inlineImages,
830
+ recordCanvas,
831
+ preserveWhiteSpace,
832
+ onSerialize,
833
+ onIframeLoad,
834
+ iframeLoadTimeout,
835
+ onStylesheetLoad,
836
+ stylesheetLoadTimeout,
837
+ keepIframeSrcFn
838
+ });
839
+ if (serializedIframeNode) {
840
+ onIframeLoad(n, serializedIframeNode);
841
+ }
842
+ }
843
+ }, iframeLoadTimeout);
844
+ }
845
+ if (serializedNode.type === NodeType.Element && serializedNode.tagName === "link" && serializedNode.attributes.rel === "stylesheet") {
846
+ onceStylesheetLoaded(n, function() {
847
+ if (onStylesheetLoad) {
848
+ var serializedLinkNode = serializeNodeWithId(n, {
849
+ doc,
850
+ mirror: mirror2,
851
+ blockClass,
852
+ blockSelector,
853
+ maskTextClass,
854
+ maskTextSelector,
855
+ skipChild: false,
856
+ inlineStylesheet,
857
+ maskInputOptions,
858
+ maskTextFn,
859
+ maskInputFn,
860
+ slimDOMOptions,
861
+ dataURLOptions,
862
+ inlineImages,
863
+ recordCanvas,
864
+ preserveWhiteSpace,
865
+ onSerialize,
866
+ onIframeLoad,
867
+ iframeLoadTimeout,
868
+ onStylesheetLoad,
869
+ stylesheetLoadTimeout,
870
+ keepIframeSrcFn
871
+ });
872
+ if (serializedLinkNode) {
873
+ onStylesheetLoad(n, serializedLinkNode);
874
+ }
875
+ }
876
+ }, stylesheetLoadTimeout);
877
+ }
878
+ return serializedNode;
879
+ }
880
+ function snapshot(n, options) {
881
+ var _a = options || {}, _b = _a.mirror, mirror2 = _b === void 0 ? new Mirror() : _b, _c = _a.blockClass, blockClass = _c === void 0 ? "rr-block" : _c, _d = _a.blockSelector, blockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? "rr-mask" : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.inlineStylesheet, inlineStylesheet = _g === void 0 ? true : _g, _h = _a.inlineImages, inlineImages = _h === void 0 ? false : _h, _j = _a.recordCanvas, recordCanvas = _j === void 0 ? false : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? false : _k, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _l = _a.slimDOM, slimDOM = _l === void 0 ? false : _l, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, onStylesheetLoad = _a.onStylesheetLoad, stylesheetLoadTimeout = _a.stylesheetLoadTimeout, _m = _a.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function() {
882
+ return false;
883
+ } : _m;
884
+ var maskInputOptions = maskAllInputs === true ? {
885
+ color: true,
886
+ date: true,
887
+ "datetime-local": true,
888
+ email: true,
889
+ month: true,
890
+ number: true,
891
+ range: true,
892
+ search: true,
893
+ tel: true,
894
+ text: true,
895
+ time: true,
896
+ url: true,
897
+ week: true,
898
+ textarea: true,
899
+ select: true,
900
+ password: true
901
+ } : maskAllInputs === false ? {
902
+ password: true
903
+ } : maskAllInputs;
904
+ var slimDOMOptions = slimDOM === true || slimDOM === "all" ? {
905
+ script: true,
906
+ comment: true,
907
+ headFavicon: true,
908
+ headWhitespace: true,
909
+ headMetaDescKeywords: slimDOM === "all",
910
+ headMetaSocial: true,
911
+ headMetaRobots: true,
912
+ headMetaHttpEquiv: true,
913
+ headMetaAuthorship: true,
914
+ headMetaVerification: true
915
+ } : slimDOM === false ? {} : slimDOM;
916
+ return serializeNodeWithId(n, {
917
+ doc: n,
918
+ mirror: mirror2,
919
+ blockClass,
920
+ blockSelector,
921
+ maskTextClass,
922
+ maskTextSelector,
923
+ skipChild: false,
924
+ inlineStylesheet,
925
+ maskInputOptions,
926
+ maskTextFn,
927
+ maskInputFn,
928
+ slimDOMOptions,
929
+ dataURLOptions,
930
+ inlineImages,
931
+ recordCanvas,
932
+ preserveWhiteSpace,
933
+ onSerialize,
934
+ onIframeLoad,
935
+ iframeLoadTimeout,
936
+ onStylesheetLoad,
937
+ stylesheetLoadTimeout,
938
+ keepIframeSrcFn,
939
+ newlyAddedElement: false
940
+ });
941
+ }
942
+ var HOVER_SELECTOR = /([^\\]):hover/;
943
+ var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, "g");
944
+
945
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/utils.js
946
+ function on(type, fn, target = document) {
947
+ const options = { capture: true, passive: true };
948
+ target.addEventListener(type, fn, options);
949
+ return () => target.removeEventListener(type, fn, options);
950
+ }
951
+ var DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";
952
+ var _mirror = {
953
+ map: {},
954
+ getId() {
955
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
956
+ return -1;
957
+ },
958
+ getNode() {
959
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
960
+ return null;
961
+ },
962
+ removeNodeFromMap() {
963
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
964
+ },
965
+ has() {
966
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
967
+ return false;
968
+ },
969
+ reset() {
970
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
971
+ }
972
+ };
973
+ if (typeof window !== "undefined" && window.Proxy && window.Reflect) {
974
+ _mirror = new Proxy(_mirror, {
975
+ get(target, prop, receiver) {
976
+ if (prop === "map") {
977
+ console.error(DEPARTED_MIRROR_ACCESS_WARNING);
978
+ }
979
+ return Reflect.get(target, prop, receiver);
980
+ }
981
+ });
982
+ }
983
+ function throttle(func, wait, options = {}) {
984
+ let timeout = null;
985
+ let previous = 0;
986
+ return function(...args) {
987
+ const now = Date.now();
988
+ if (!previous && options.leading === false) {
989
+ previous = now;
990
+ }
991
+ const remaining = wait - (now - previous);
992
+ const context = this;
993
+ if (remaining <= 0 || remaining > wait) {
994
+ if (timeout) {
995
+ clearTimeout(timeout);
996
+ timeout = null;
997
+ }
998
+ previous = now;
999
+ func.apply(context, args);
1000
+ } else if (!timeout && options.trailing !== false) {
1001
+ timeout = setTimeout(() => {
1002
+ previous = options.leading === false ? 0 : Date.now();
1003
+ timeout = null;
1004
+ func.apply(context, args);
1005
+ }, remaining);
1006
+ }
1007
+ };
1008
+ }
1009
+ function hookSetter(target, key, d, isRevoked, win = window) {
1010
+ const original = win.Object.getOwnPropertyDescriptor(target, key);
1011
+ win.Object.defineProperty(target, key, isRevoked ? d : {
1012
+ set(value) {
1013
+ setTimeout(() => {
1014
+ d.set.call(this, value);
1015
+ }, 0);
1016
+ if (original && original.set) {
1017
+ original.set.call(this, value);
1018
+ }
1019
+ }
1020
+ });
1021
+ return () => hookSetter(target, key, original || {}, true);
1022
+ }
1023
+ function patch(source, name, replacement) {
1024
+ try {
1025
+ if (!(name in source)) {
1026
+ return () => {
1027
+ };
1028
+ }
1029
+ const original = source[name];
1030
+ const wrapped = replacement(original);
1031
+ if (typeof wrapped === "function") {
1032
+ wrapped.prototype = wrapped.prototype || {};
1033
+ Object.defineProperties(wrapped, {
1034
+ __rrweb_original__: {
1035
+ enumerable: false,
1036
+ value: original
1037
+ }
1038
+ });
1039
+ }
1040
+ source[name] = wrapped;
1041
+ return () => {
1042
+ source[name] = original;
1043
+ };
1044
+ } catch (_a) {
1045
+ return () => {
1046
+ };
1047
+ }
1048
+ }
1049
+ function getWindowHeight() {
1050
+ return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;
1051
+ }
1052
+ function getWindowWidth() {
1053
+ return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;
1054
+ }
1055
+ function isBlocked(node, blockClass, blockSelector, checkAncestors) {
1056
+ if (!node) {
1057
+ return false;
1058
+ }
1059
+ const el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
1060
+ if (!el)
1061
+ return false;
1062
+ if (typeof blockClass === "string") {
1063
+ if (el.classList.contains(blockClass))
1064
+ return true;
1065
+ if (checkAncestors && el.closest("." + blockClass) !== null)
1066
+ return true;
1067
+ } else {
1068
+ if (classMatchesRegex(el, blockClass, checkAncestors))
1069
+ return true;
1070
+ }
1071
+ if (blockSelector) {
1072
+ if (node.matches(blockSelector))
1073
+ return true;
1074
+ if (checkAncestors && el.closest(blockSelector) !== null)
1075
+ return true;
1076
+ }
1077
+ return false;
1078
+ }
1079
+ function isSerialized(n, mirror2) {
1080
+ return mirror2.getId(n) !== -1;
1081
+ }
1082
+ function isIgnored(n, mirror2) {
1083
+ return mirror2.getId(n) === IGNORED_NODE;
1084
+ }
1085
+ function isAncestorRemoved(target, mirror2) {
1086
+ if (isShadowRoot(target)) {
1087
+ return false;
1088
+ }
1089
+ const id = mirror2.getId(target);
1090
+ if (!mirror2.has(id)) {
1091
+ return true;
1092
+ }
1093
+ if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) {
1094
+ return false;
1095
+ }
1096
+ if (!target.parentNode) {
1097
+ return true;
1098
+ }
1099
+ return isAncestorRemoved(target.parentNode, mirror2);
1100
+ }
1101
+ function isTouchEvent(event) {
1102
+ return Boolean(event.changedTouches);
1103
+ }
1104
+ function polyfill(win = window) {
1105
+ if ("NodeList" in win && !win.NodeList.prototype.forEach) {
1106
+ win.NodeList.prototype.forEach = Array.prototype.forEach;
1107
+ }
1108
+ if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) {
1109
+ win.DOMTokenList.prototype.forEach = Array.prototype.forEach;
1110
+ }
1111
+ if (!Node.prototype.contains) {
1112
+ Node.prototype.contains = (...args) => {
1113
+ let node = args[0];
1114
+ if (!(0 in args)) {
1115
+ throw new TypeError("1 argument is required");
1116
+ }
1117
+ do {
1118
+ if (this === node) {
1119
+ return true;
1120
+ }
1121
+ } while (node = node && node.parentNode);
1122
+ return false;
1123
+ };
1124
+ }
1125
+ }
1126
+ function isSerializedIframe(n, mirror2) {
1127
+ return Boolean(n.nodeName === "IFRAME" && mirror2.getMeta(n));
1128
+ }
1129
+ function isSerializedStylesheet(n, mirror2) {
1130
+ return Boolean(n.nodeName === "LINK" && n.nodeType === n.ELEMENT_NODE && n.getAttribute && n.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n));
1131
+ }
1132
+ function hasShadowRoot(n) {
1133
+ return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
1134
+ }
1135
+ var StyleSheetMirror = class {
1136
+ constructor() {
1137
+ this.id = 1;
1138
+ this.styleIDMap = /* @__PURE__ */ new WeakMap();
1139
+ this.idStyleMap = /* @__PURE__ */ new Map();
1140
+ }
1141
+ getId(stylesheet) {
1142
+ var _a;
1143
+ return (_a = this.styleIDMap.get(stylesheet)) !== null && _a !== void 0 ? _a : -1;
1144
+ }
1145
+ has(stylesheet) {
1146
+ return this.styleIDMap.has(stylesheet);
1147
+ }
1148
+ add(stylesheet, id) {
1149
+ if (this.has(stylesheet))
1150
+ return this.getId(stylesheet);
1151
+ let newId;
1152
+ if (id === void 0) {
1153
+ newId = this.id++;
1154
+ } else
1155
+ newId = id;
1156
+ this.styleIDMap.set(stylesheet, newId);
1157
+ this.idStyleMap.set(newId, stylesheet);
1158
+ return newId;
1159
+ }
1160
+ getStyle(id) {
1161
+ return this.idStyleMap.get(id) || null;
1162
+ }
1163
+ reset() {
1164
+ this.styleIDMap = /* @__PURE__ */ new WeakMap();
1165
+ this.idStyleMap = /* @__PURE__ */ new Map();
1166
+ this.id = 1;
1167
+ }
1168
+ generateId() {
1169
+ return this.id++;
1170
+ }
1171
+ };
1172
+
1173
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/types/dist/types.js
1174
+ var EventType = /* @__PURE__ */ ((EventType2) => {
1175
+ EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
1176
+ EventType2[EventType2["Load"] = 1] = "Load";
1177
+ EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
1178
+ EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
1179
+ EventType2[EventType2["Meta"] = 4] = "Meta";
1180
+ EventType2[EventType2["Custom"] = 5] = "Custom";
1181
+ EventType2[EventType2["Plugin"] = 6] = "Plugin";
1182
+ return EventType2;
1183
+ })(EventType || {});
1184
+ var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
1185
+ IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
1186
+ IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
1187
+ IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
1188
+ IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
1189
+ IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
1190
+ IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
1191
+ IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
1192
+ IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
1193
+ IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
1194
+ IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
1195
+ IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
1196
+ IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
1197
+ IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
1198
+ IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
1199
+ IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
1200
+ IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
1201
+ return IncrementalSource2;
1202
+ })(IncrementalSource || {});
1203
+ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
1204
+ MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
1205
+ MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
1206
+ MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
1207
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
1208
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
1209
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
1210
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
1211
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
1212
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
1213
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
1214
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
1215
+ return MouseInteractions2;
1216
+ })(MouseInteractions || {});
1217
+ var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
1218
+ CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
1219
+ CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
1220
+ CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
1221
+ return CanvasContext2;
1222
+ })(CanvasContext || {});
1223
+
1224
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/mutation.js
1225
+ function isNodeInLinkedList(n) {
1226
+ return "__ln" in n;
1227
+ }
1228
+ var DoubleLinkedList = class {
1229
+ constructor() {
1230
+ this.length = 0;
1231
+ this.head = null;
1232
+ }
1233
+ get(position) {
1234
+ if (position >= this.length) {
1235
+ throw new Error("Position outside of list range");
1236
+ }
1237
+ let current = this.head;
1238
+ for (let index = 0; index < position; index++) {
1239
+ current = (current === null || current === void 0 ? void 0 : current.next) || null;
1240
+ }
1241
+ return current;
1242
+ }
1243
+ addNode(n) {
1244
+ const node = {
1245
+ value: n,
1246
+ previous: null,
1247
+ next: null
1248
+ };
1249
+ n.__ln = node;
1250
+ if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) {
1251
+ const current = n.previousSibling.__ln.next;
1252
+ node.next = current;
1253
+ node.previous = n.previousSibling.__ln;
1254
+ n.previousSibling.__ln.next = node;
1255
+ if (current) {
1256
+ current.previous = node;
1257
+ }
1258
+ } else if (n.nextSibling && isNodeInLinkedList(n.nextSibling) && n.nextSibling.__ln.previous) {
1259
+ const current = n.nextSibling.__ln.previous;
1260
+ node.previous = current;
1261
+ node.next = n.nextSibling.__ln;
1262
+ n.nextSibling.__ln.previous = node;
1263
+ if (current) {
1264
+ current.next = node;
1265
+ }
1266
+ } else {
1267
+ if (this.head) {
1268
+ this.head.previous = node;
1269
+ }
1270
+ node.next = this.head;
1271
+ this.head = node;
1272
+ }
1273
+ this.length++;
1274
+ }
1275
+ removeNode(n) {
1276
+ const current = n.__ln;
1277
+ if (!this.head) {
1278
+ return;
1279
+ }
1280
+ if (!current.previous) {
1281
+ this.head = current.next;
1282
+ if (this.head) {
1283
+ this.head.previous = null;
1284
+ }
1285
+ } else {
1286
+ current.previous.next = current.next;
1287
+ if (current.next) {
1288
+ current.next.previous = current.previous;
1289
+ }
1290
+ }
1291
+ if (n.__ln) {
1292
+ delete n.__ln;
1293
+ }
1294
+ this.length--;
1295
+ }
1296
+ };
1297
+ var moveKey = (id, parentId) => `${id}@${parentId}`;
1298
+ var MutationBuffer = class {
1299
+ constructor() {
1300
+ this.frozen = false;
1301
+ this.locked = false;
1302
+ this.texts = [];
1303
+ this.attributes = [];
1304
+ this.removes = [];
1305
+ this.mapRemoves = [];
1306
+ this.movedMap = {};
1307
+ this.addedSet = /* @__PURE__ */ new Set();
1308
+ this.movedSet = /* @__PURE__ */ new Set();
1309
+ this.droppedSet = /* @__PURE__ */ new Set();
1310
+ this.processMutations = (mutations) => {
1311
+ mutations.forEach(this.processMutation);
1312
+ this.emit();
1313
+ };
1314
+ this.emit = () => {
1315
+ if (this.frozen || this.locked) {
1316
+ return;
1317
+ }
1318
+ const adds = [];
1319
+ const addList = new DoubleLinkedList();
1320
+ const getNextId = (n) => {
1321
+ let ns = n;
1322
+ let nextId = IGNORED_NODE;
1323
+ while (nextId === IGNORED_NODE) {
1324
+ ns = ns && ns.nextSibling;
1325
+ nextId = ns && this.mirror.getId(ns);
1326
+ }
1327
+ return nextId;
1328
+ };
1329
+ const pushAdd = (n) => {
1330
+ var _a, _b, _c, _d;
1331
+ let shadowHost = null;
1332
+ if (((_b = (_a = n.getRootNode) === null || _a === void 0 ? void 0 : _a.call(n)) === null || _b === void 0 ? void 0 : _b.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && n.getRootNode().host)
1333
+ shadowHost = n.getRootNode().host;
1334
+ let rootShadowHost = shadowHost;
1335
+ while (((_d = (_c = rootShadowHost === null || rootShadowHost === void 0 ? void 0 : rootShadowHost.getRootNode) === null || _c === void 0 ? void 0 : _c.call(rootShadowHost)) === null || _d === void 0 ? void 0 : _d.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && rootShadowHost.getRootNode().host)
1336
+ rootShadowHost = rootShadowHost.getRootNode().host;
1337
+ const notInDoc = !this.doc.contains(n) && (!rootShadowHost || !this.doc.contains(rootShadowHost));
1338
+ if (!n.parentNode || notInDoc) {
1339
+ return;
1340
+ }
1341
+ const parentId = isShadowRoot(n.parentNode) ? this.mirror.getId(shadowHost) : this.mirror.getId(n.parentNode);
1342
+ const nextId = getNextId(n);
1343
+ if (parentId === -1 || nextId === -1) {
1344
+ return addList.addNode(n);
1345
+ }
1346
+ const sn = serializeNodeWithId(n, {
1347
+ doc: this.doc,
1348
+ mirror: this.mirror,
1349
+ blockClass: this.blockClass,
1350
+ blockSelector: this.blockSelector,
1351
+ maskTextClass: this.maskTextClass,
1352
+ maskTextSelector: this.maskTextSelector,
1353
+ skipChild: true,
1354
+ newlyAddedElement: true,
1355
+ inlineStylesheet: this.inlineStylesheet,
1356
+ maskInputOptions: this.maskInputOptions,
1357
+ maskTextFn: this.maskTextFn,
1358
+ maskInputFn: this.maskInputFn,
1359
+ slimDOMOptions: this.slimDOMOptions,
1360
+ dataURLOptions: this.dataURLOptions,
1361
+ recordCanvas: this.recordCanvas,
1362
+ inlineImages: this.inlineImages,
1363
+ onSerialize: (currentN) => {
1364
+ if (isSerializedIframe(currentN, this.mirror)) {
1365
+ this.iframeManager.addIframe(currentN);
1366
+ }
1367
+ if (isSerializedStylesheet(currentN, this.mirror)) {
1368
+ this.stylesheetManager.trackLinkElement(currentN);
1369
+ }
1370
+ if (hasShadowRoot(n)) {
1371
+ this.shadowDomManager.addShadowRoot(n.shadowRoot, this.doc);
1372
+ }
1373
+ },
1374
+ onIframeLoad: (iframe, childSn) => {
1375
+ this.iframeManager.attachIframe(iframe, childSn);
1376
+ this.shadowDomManager.observeAttachShadow(iframe);
1377
+ },
1378
+ onStylesheetLoad: (link, childSn) => {
1379
+ this.stylesheetManager.attachLinkElement(link, childSn);
1380
+ }
1381
+ });
1382
+ if (sn) {
1383
+ adds.push({
1384
+ parentId,
1385
+ nextId,
1386
+ node: sn
1387
+ });
1388
+ }
1389
+ };
1390
+ while (this.mapRemoves.length) {
1391
+ this.mirror.removeNodeFromMap(this.mapRemoves.shift());
1392
+ }
1393
+ for (const n of Array.from(this.movedSet.values())) {
1394
+ if (isParentRemoved(this.removes, n, this.mirror) && !this.movedSet.has(n.parentNode)) {
1395
+ continue;
1396
+ }
1397
+ pushAdd(n);
1398
+ }
1399
+ for (const n of Array.from(this.addedSet.values())) {
1400
+ if (!isAncestorInSet(this.droppedSet, n) && !isParentRemoved(this.removes, n, this.mirror)) {
1401
+ pushAdd(n);
1402
+ } else if (isAncestorInSet(this.movedSet, n)) {
1403
+ pushAdd(n);
1404
+ } else {
1405
+ this.droppedSet.add(n);
1406
+ }
1407
+ }
1408
+ let candidate = null;
1409
+ while (addList.length) {
1410
+ let node = null;
1411
+ if (candidate) {
1412
+ const parentId = this.mirror.getId(candidate.value.parentNode);
1413
+ const nextId = getNextId(candidate.value);
1414
+ if (parentId !== -1 && nextId !== -1) {
1415
+ node = candidate;
1416
+ }
1417
+ }
1418
+ if (!node) {
1419
+ for (let index = addList.length - 1; index >= 0; index--) {
1420
+ const _node = addList.get(index);
1421
+ if (_node) {
1422
+ const parentId = this.mirror.getId(_node.value.parentNode);
1423
+ const nextId = getNextId(_node.value);
1424
+ if (nextId === -1)
1425
+ continue;
1426
+ else if (parentId !== -1) {
1427
+ node = _node;
1428
+ break;
1429
+ } else {
1430
+ const unhandledNode = _node.value;
1431
+ if (unhandledNode.parentNode && unhandledNode.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1432
+ const shadowHost = unhandledNode.parentNode.host;
1433
+ const parentId2 = this.mirror.getId(shadowHost);
1434
+ if (parentId2 !== -1) {
1435
+ node = _node;
1436
+ break;
1437
+ }
1438
+ }
1439
+ }
1440
+ }
1441
+ }
1442
+ }
1443
+ if (!node) {
1444
+ while (addList.head) {
1445
+ addList.removeNode(addList.head.value);
1446
+ }
1447
+ break;
1448
+ }
1449
+ candidate = node.previous;
1450
+ addList.removeNode(node.value);
1451
+ pushAdd(node.value);
1452
+ }
1453
+ const payload = {
1454
+ texts: this.texts.map((text) => ({
1455
+ id: this.mirror.getId(text.node),
1456
+ value: text.value
1457
+ })).filter((text) => this.mirror.has(text.id)),
1458
+ attributes: this.attributes.map((attribute) => ({
1459
+ id: this.mirror.getId(attribute.node),
1460
+ attributes: attribute.attributes
1461
+ })).filter((attribute) => this.mirror.has(attribute.id)),
1462
+ removes: this.removes,
1463
+ adds
1464
+ };
1465
+ if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {
1466
+ return;
1467
+ }
1468
+ this.texts = [];
1469
+ this.attributes = [];
1470
+ this.removes = [];
1471
+ this.addedSet = /* @__PURE__ */ new Set();
1472
+ this.movedSet = /* @__PURE__ */ new Set();
1473
+ this.droppedSet = /* @__PURE__ */ new Set();
1474
+ this.movedMap = {};
1475
+ this.mutationCb(payload);
1476
+ };
1477
+ this.processMutation = (m) => {
1478
+ if (isIgnored(m.target, this.mirror)) {
1479
+ return;
1480
+ }
1481
+ switch (m.type) {
1482
+ case "characterData": {
1483
+ const value = m.target.textContent;
1484
+ if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) && value !== m.oldValue) {
1485
+ this.texts.push({
1486
+ value: needMaskingText(m.target, this.maskTextClass, this.maskTextSelector) && value ? this.maskTextFn ? this.maskTextFn(value) : value.replace(/[\S]/g, "*") : value,
1487
+ node: m.target
1488
+ });
1489
+ }
1490
+ break;
1491
+ }
1492
+ case "attributes": {
1493
+ const target = m.target;
1494
+ let value = m.target.getAttribute(m.attributeName);
1495
+ if (m.attributeName === "value") {
1496
+ value = maskInputValue({
1497
+ maskInputOptions: this.maskInputOptions,
1498
+ tagName: m.target.tagName,
1499
+ type: m.target.getAttribute("type"),
1500
+ value,
1501
+ maskInputFn: this.maskInputFn
1502
+ });
1503
+ }
1504
+ if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || value === m.oldValue) {
1505
+ return;
1506
+ }
1507
+ let item = this.attributes.find((a) => a.node === m.target);
1508
+ if (target.tagName === "IFRAME" && m.attributeName === "src" && !this.keepIframeSrcFn(value)) {
1509
+ if (!target.contentDocument) {
1510
+ m.attributeName = "rr_src";
1511
+ } else {
1512
+ return;
1513
+ }
1514
+ }
1515
+ if (!item) {
1516
+ item = {
1517
+ node: m.target,
1518
+ attributes: {}
1519
+ };
1520
+ this.attributes.push(item);
1521
+ }
1522
+ if (m.attributeName === "style") {
1523
+ const old = this.doc.createElement("span");
1524
+ if (m.oldValue) {
1525
+ old.setAttribute("style", m.oldValue);
1526
+ }
1527
+ if (item.attributes.style === void 0 || item.attributes.style === null) {
1528
+ item.attributes.style = {};
1529
+ }
1530
+ const styleObj = item.attributes.style;
1531
+ for (const pname of Array.from(target.style)) {
1532
+ const newValue = target.style.getPropertyValue(pname);
1533
+ const newPriority = target.style.getPropertyPriority(pname);
1534
+ if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {
1535
+ if (newPriority === "") {
1536
+ styleObj[pname] = newValue;
1537
+ } else {
1538
+ styleObj[pname] = [newValue, newPriority];
1539
+ }
1540
+ }
1541
+ }
1542
+ for (const pname of Array.from(old.style)) {
1543
+ if (target.style.getPropertyValue(pname) === "") {
1544
+ styleObj[pname] = false;
1545
+ }
1546
+ }
1547
+ } else {
1548
+ item.attributes[m.attributeName] = transformAttribute(this.doc, target.tagName, m.attributeName, value);
1549
+ }
1550
+ break;
1551
+ }
1552
+ case "childList": {
1553
+ if (isBlocked(m.target, this.blockClass, this.blockSelector, true))
1554
+ return;
1555
+ m.addedNodes.forEach((n) => this.genAdds(n, m.target));
1556
+ m.removedNodes.forEach((n) => {
1557
+ const nodeId = this.mirror.getId(n);
1558
+ const parentId = isShadowRoot(m.target) ? this.mirror.getId(m.target.host) : this.mirror.getId(m.target);
1559
+ if (isBlocked(m.target, this.blockClass, this.blockSelector, false) || isIgnored(n, this.mirror) || !isSerialized(n, this.mirror)) {
1560
+ return;
1561
+ }
1562
+ if (this.addedSet.has(n)) {
1563
+ deepDelete(this.addedSet, n);
1564
+ this.droppedSet.add(n);
1565
+ } else if (this.addedSet.has(m.target) && nodeId === -1) ;
1566
+ else if (isAncestorRemoved(m.target, this.mirror)) ;
1567
+ else if (this.movedSet.has(n) && this.movedMap[moveKey(nodeId, parentId)]) {
1568
+ deepDelete(this.movedSet, n);
1569
+ } else {
1570
+ this.removes.push({
1571
+ parentId,
1572
+ id: nodeId,
1573
+ isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0
1574
+ });
1575
+ }
1576
+ this.mapRemoves.push(n);
1577
+ });
1578
+ break;
1579
+ }
1580
+ }
1581
+ };
1582
+ this.genAdds = (n, target) => {
1583
+ if (this.mirror.hasNode(n)) {
1584
+ if (isIgnored(n, this.mirror)) {
1585
+ return;
1586
+ }
1587
+ this.movedSet.add(n);
1588
+ let targetId = null;
1589
+ if (target && this.mirror.hasNode(target)) {
1590
+ targetId = this.mirror.getId(target);
1591
+ }
1592
+ if (targetId && targetId !== -1) {
1593
+ this.movedMap[moveKey(this.mirror.getId(n), targetId)] = true;
1594
+ }
1595
+ } else {
1596
+ this.addedSet.add(n);
1597
+ this.droppedSet.delete(n);
1598
+ }
1599
+ if (!isBlocked(n, this.blockClass, this.blockSelector, false))
1600
+ n.childNodes.forEach((childN) => this.genAdds(childN));
1601
+ };
1602
+ }
1603
+ init(options) {
1604
+ [
1605
+ "mutationCb",
1606
+ "blockClass",
1607
+ "blockSelector",
1608
+ "maskTextClass",
1609
+ "maskTextSelector",
1610
+ "inlineStylesheet",
1611
+ "maskInputOptions",
1612
+ "maskTextFn",
1613
+ "maskInputFn",
1614
+ "keepIframeSrcFn",
1615
+ "recordCanvas",
1616
+ "inlineImages",
1617
+ "slimDOMOptions",
1618
+ "dataURLOptions",
1619
+ "doc",
1620
+ "mirror",
1621
+ "iframeManager",
1622
+ "stylesheetManager",
1623
+ "shadowDomManager",
1624
+ "canvasManager"
1625
+ ].forEach((key) => {
1626
+ this[key] = options[key];
1627
+ });
1628
+ }
1629
+ freeze() {
1630
+ this.frozen = true;
1631
+ this.canvasManager.freeze();
1632
+ }
1633
+ unfreeze() {
1634
+ this.frozen = false;
1635
+ this.canvasManager.unfreeze();
1636
+ this.emit();
1637
+ }
1638
+ isFrozen() {
1639
+ return this.frozen;
1640
+ }
1641
+ lock() {
1642
+ this.locked = true;
1643
+ this.canvasManager.lock();
1644
+ }
1645
+ unlock() {
1646
+ this.locked = false;
1647
+ this.canvasManager.unlock();
1648
+ this.emit();
1649
+ }
1650
+ reset() {
1651
+ this.shadowDomManager.reset();
1652
+ this.canvasManager.reset();
1653
+ }
1654
+ };
1655
+ function deepDelete(addsSet, n) {
1656
+ addsSet.delete(n);
1657
+ n.childNodes.forEach((childN) => deepDelete(addsSet, childN));
1658
+ }
1659
+ function isParentRemoved(removes, n, mirror2) {
1660
+ if (removes.length === 0)
1661
+ return false;
1662
+ return _isParentRemoved(removes, n, mirror2);
1663
+ }
1664
+ function _isParentRemoved(removes, n, mirror2) {
1665
+ const { parentNode } = n;
1666
+ if (!parentNode) {
1667
+ return false;
1668
+ }
1669
+ const parentId = mirror2.getId(parentNode);
1670
+ if (removes.some((r) => r.id === parentId)) {
1671
+ return true;
1672
+ }
1673
+ return _isParentRemoved(removes, parentNode, mirror2);
1674
+ }
1675
+ function isAncestorInSet(set, n) {
1676
+ if (set.size === 0)
1677
+ return false;
1678
+ return _isAncestorInSet(set, n);
1679
+ }
1680
+ function _isAncestorInSet(set, n) {
1681
+ const { parentNode } = n;
1682
+ if (!parentNode) {
1683
+ return false;
1684
+ }
1685
+ if (set.has(parentNode)) {
1686
+ return true;
1687
+ }
1688
+ return _isAncestorInSet(set, parentNode);
1689
+ }
1690
+
1691
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observer.js
1692
+ var mutationBuffers = [];
1693
+ var isCSSGroupingRuleSupported = typeof CSSGroupingRule !== "undefined";
1694
+ var isCSSMediaRuleSupported = typeof CSSMediaRule !== "undefined";
1695
+ var isCSSSupportsRuleSupported = typeof CSSSupportsRule !== "undefined";
1696
+ var isCSSConditionRuleSupported = typeof CSSConditionRule !== "undefined";
1697
+ function getEventTarget(event) {
1698
+ try {
1699
+ if ("composedPath" in event) {
1700
+ const path = event.composedPath();
1701
+ if (path.length) {
1702
+ return path[0];
1703
+ }
1704
+ } else if ("path" in event && event.path.length) {
1705
+ return event.path[0];
1706
+ }
1707
+ return event.target;
1708
+ } catch (_a) {
1709
+ return event.target;
1710
+ }
1711
+ }
1712
+ function initMutationObserver(options, rootEl) {
1713
+ var _a, _b;
1714
+ const mutationBuffer = new MutationBuffer();
1715
+ mutationBuffers.push(mutationBuffer);
1716
+ mutationBuffer.init(options);
1717
+ let mutationObserverCtor = window.MutationObserver || window.__rrMutationObserver;
1718
+ const angularZoneSymbol = (_b = (_a = window === null || window === void 0 ? void 0 : window.Zone) === null || _a === void 0 ? void 0 : _a.__symbol__) === null || _b === void 0 ? void 0 : _b.call(_a, "MutationObserver");
1719
+ if (angularZoneSymbol && window[angularZoneSymbol]) {
1720
+ mutationObserverCtor = window[angularZoneSymbol];
1721
+ }
1722
+ const observer = new mutationObserverCtor(mutationBuffer.processMutations.bind(mutationBuffer));
1723
+ observer.observe(rootEl, {
1724
+ attributes: true,
1725
+ attributeOldValue: true,
1726
+ characterData: true,
1727
+ characterDataOldValue: true,
1728
+ childList: true,
1729
+ subtree: true
1730
+ });
1731
+ return observer;
1732
+ }
1733
+ function initMoveObserver({ mousemoveCb, sampling, doc, mirror: mirror2 }) {
1734
+ if (sampling.mousemove === false) {
1735
+ return () => {
1736
+ };
1737
+ }
1738
+ const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50;
1739
+ const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500;
1740
+ let positions = [];
1741
+ let timeBaseline;
1742
+ const wrappedCb = throttle((source) => {
1743
+ const totalOffset = Date.now() - timeBaseline;
1744
+ mousemoveCb(positions.map((p) => {
1745
+ p.timeOffset -= totalOffset;
1746
+ return p;
1747
+ }), source);
1748
+ positions = [];
1749
+ timeBaseline = null;
1750
+ }, callbackThreshold);
1751
+ const updatePosition = throttle((evt) => {
1752
+ const target = getEventTarget(evt);
1753
+ const { clientX, clientY } = isTouchEvent(evt) ? evt.changedTouches[0] : evt;
1754
+ if (!timeBaseline) {
1755
+ timeBaseline = Date.now();
1756
+ }
1757
+ positions.push({
1758
+ x: clientX,
1759
+ y: clientY,
1760
+ id: mirror2.getId(target),
1761
+ timeOffset: Date.now() - timeBaseline
1762
+ });
1763
+ wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove);
1764
+ }, threshold, {
1765
+ trailing: false
1766
+ });
1767
+ const handlers = [
1768
+ on("mousemove", updatePosition, doc),
1769
+ on("touchmove", updatePosition, doc),
1770
+ on("drag", updatePosition, doc)
1771
+ ];
1772
+ return () => {
1773
+ handlers.forEach((h) => h());
1774
+ };
1775
+ }
1776
+ function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror: mirror2, blockClass, blockSelector, sampling }) {
1777
+ if (sampling.mouseInteraction === false) {
1778
+ return () => {
1779
+ };
1780
+ }
1781
+ const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;
1782
+ const handlers = [];
1783
+ const getHandler = (eventKey) => {
1784
+ return (event) => {
1785
+ const target = getEventTarget(event);
1786
+ if (isBlocked(target, blockClass, blockSelector, true)) {
1787
+ return;
1788
+ }
1789
+ const e = isTouchEvent(event) ? event.changedTouches[0] : event;
1790
+ if (!e) {
1791
+ return;
1792
+ }
1793
+ const id = mirror2.getId(target);
1794
+ const { clientX, clientY } = e;
1795
+ mouseInteractionCb({
1796
+ type: MouseInteractions[eventKey],
1797
+ id,
1798
+ x: clientX,
1799
+ y: clientY
1800
+ });
1801
+ };
1802
+ };
1803
+ Object.keys(MouseInteractions).filter((key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false).forEach((eventKey) => {
1804
+ const eventName = eventKey.toLowerCase();
1805
+ const handler = getHandler(eventKey);
1806
+ handlers.push(on(eventName, handler, doc));
1807
+ });
1808
+ return () => {
1809
+ handlers.forEach((h) => h());
1810
+ };
1811
+ }
1812
+ function initScrollObserver({ scrollCb, doc, mirror: mirror2, blockClass, blockSelector, sampling }) {
1813
+ const updatePosition = throttle((evt) => {
1814
+ const target = getEventTarget(evt);
1815
+ if (!target || isBlocked(target, blockClass, blockSelector, true)) {
1816
+ return;
1817
+ }
1818
+ const id = mirror2.getId(target);
1819
+ if (target === doc) {
1820
+ const scrollEl = doc.scrollingElement || doc.documentElement;
1821
+ scrollCb({
1822
+ id,
1823
+ x: scrollEl.scrollLeft,
1824
+ y: scrollEl.scrollTop
1825
+ });
1826
+ } else {
1827
+ scrollCb({
1828
+ id,
1829
+ x: target.scrollLeft,
1830
+ y: target.scrollTop
1831
+ });
1832
+ }
1833
+ }, sampling.scroll || 100);
1834
+ return on("scroll", updatePosition, doc);
1835
+ }
1836
+ function initViewportResizeObserver({ viewportResizeCb }) {
1837
+ let lastH = -1;
1838
+ let lastW = -1;
1839
+ const updateDimension = throttle(() => {
1840
+ const height = getWindowHeight();
1841
+ const width = getWindowWidth();
1842
+ if (lastH !== height || lastW !== width) {
1843
+ viewportResizeCb({
1844
+ width: Number(width),
1845
+ height: Number(height)
1846
+ });
1847
+ lastH = height;
1848
+ lastW = width;
1849
+ }
1850
+ }, 200);
1851
+ return on("resize", updateDimension, window);
1852
+ }
1853
+ function wrapEventWithUserTriggeredFlag(v, enable) {
1854
+ const value = Object.assign({}, v);
1855
+ if (!enable)
1856
+ delete value.userTriggered;
1857
+ return value;
1858
+ }
1859
+ var INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
1860
+ var lastInputValueMap = /* @__PURE__ */ new WeakMap();
1861
+ function initInputObserver({ inputCb, doc, mirror: mirror2, blockClass, blockSelector, ignoreClass, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput }) {
1862
+ function eventHandler(event) {
1863
+ let target = getEventTarget(event);
1864
+ const userTriggered = event.isTrusted;
1865
+ if (target && target.tagName === "OPTION")
1866
+ target = target.parentElement;
1867
+ if (!target || !target.tagName || INPUT_TAGS.indexOf(target.tagName) < 0 || isBlocked(target, blockClass, blockSelector, true)) {
1868
+ return;
1869
+ }
1870
+ const type = target.type;
1871
+ if (target.classList.contains(ignoreClass)) {
1872
+ return;
1873
+ }
1874
+ let text = target.value;
1875
+ let isChecked = false;
1876
+ if (type === "radio" || type === "checkbox") {
1877
+ isChecked = target.checked;
1878
+ } else if (maskInputOptions[target.tagName.toLowerCase()] || maskInputOptions[type]) {
1879
+ text = maskInputValue({
1880
+ maskInputOptions,
1881
+ tagName: target.tagName,
1882
+ type,
1883
+ value: text,
1884
+ maskInputFn
1885
+ });
1886
+ }
1887
+ cbWithDedup(target, wrapEventWithUserTriggeredFlag({ text, isChecked, userTriggered }, userTriggeredOnInput));
1888
+ const name = target.name;
1889
+ if (type === "radio" && name && isChecked) {
1890
+ doc.querySelectorAll(`input[type="radio"][name="${name}"]`).forEach((el) => {
1891
+ if (el !== target) {
1892
+ cbWithDedup(el, wrapEventWithUserTriggeredFlag({
1893
+ text: el.value,
1894
+ isChecked: !isChecked,
1895
+ userTriggered: false
1896
+ }, userTriggeredOnInput));
1897
+ }
1898
+ });
1899
+ }
1900
+ }
1901
+ function cbWithDedup(target, v) {
1902
+ const lastInputValue = lastInputValueMap.get(target);
1903
+ if (!lastInputValue || lastInputValue.text !== v.text || lastInputValue.isChecked !== v.isChecked) {
1904
+ lastInputValueMap.set(target, v);
1905
+ const id = mirror2.getId(target);
1906
+ inputCb(Object.assign(Object.assign({}, v), { id }));
1907
+ }
1908
+ }
1909
+ const events = sampling.input === "last" ? ["change"] : ["input", "change"];
1910
+ const handlers = events.map((eventName) => on(eventName, eventHandler, doc));
1911
+ const currentWindow = doc.defaultView;
1912
+ if (!currentWindow) {
1913
+ return () => {
1914
+ handlers.forEach((h) => h());
1915
+ };
1916
+ }
1917
+ const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(currentWindow.HTMLInputElement.prototype, "value");
1918
+ const hookProperties = [
1919
+ [currentWindow.HTMLInputElement.prototype, "value"],
1920
+ [currentWindow.HTMLInputElement.prototype, "checked"],
1921
+ [currentWindow.HTMLSelectElement.prototype, "value"],
1922
+ [currentWindow.HTMLTextAreaElement.prototype, "value"],
1923
+ [currentWindow.HTMLSelectElement.prototype, "selectedIndex"],
1924
+ [currentWindow.HTMLOptionElement.prototype, "selected"]
1925
+ ];
1926
+ if (propertyDescriptor && propertyDescriptor.set) {
1927
+ handlers.push(...hookProperties.map((p) => hookSetter(p[0], p[1], {
1928
+ set() {
1929
+ eventHandler({ target: this });
1930
+ }
1931
+ }, false, currentWindow)));
1932
+ }
1933
+ return () => {
1934
+ handlers.forEach((h) => h());
1935
+ };
1936
+ }
1937
+ function getNestedCSSRulePositions(rule) {
1938
+ const positions = [];
1939
+ function recurse(childRule, pos) {
1940
+ if (isCSSGroupingRuleSupported && childRule.parentRule instanceof CSSGroupingRule || isCSSMediaRuleSupported && childRule.parentRule instanceof CSSMediaRule || isCSSSupportsRuleSupported && childRule.parentRule instanceof CSSSupportsRule || isCSSConditionRuleSupported && childRule.parentRule instanceof CSSConditionRule) {
1941
+ const rules = Array.from(childRule.parentRule.cssRules);
1942
+ const index = rules.indexOf(childRule);
1943
+ pos.unshift(index);
1944
+ } else if (childRule.parentStyleSheet) {
1945
+ const rules = Array.from(childRule.parentStyleSheet.cssRules);
1946
+ const index = rules.indexOf(childRule);
1947
+ pos.unshift(index);
1948
+ }
1949
+ return pos;
1950
+ }
1951
+ return recurse(rule, positions);
1952
+ }
1953
+ function getIdAndStyleId(sheet, mirror2, styleMirror) {
1954
+ let id, styleId;
1955
+ if (!sheet)
1956
+ return {};
1957
+ if (sheet.ownerNode)
1958
+ id = mirror2.getId(sheet.ownerNode);
1959
+ else
1960
+ styleId = styleMirror.getId(sheet);
1961
+ return {
1962
+ styleId,
1963
+ id
1964
+ };
1965
+ }
1966
+ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {
1967
+ const insertRule = win.CSSStyleSheet.prototype.insertRule;
1968
+ win.CSSStyleSheet.prototype.insertRule = function(rule, index) {
1969
+ const { id, styleId } = getIdAndStyleId(this, mirror2, stylesheetManager.styleMirror);
1970
+ if (id && id !== -1 || styleId && styleId !== -1) {
1971
+ styleSheetRuleCb({
1972
+ id,
1973
+ styleId,
1974
+ adds: [{ rule, index }]
1975
+ });
1976
+ }
1977
+ return insertRule.apply(this, [rule, index]);
1978
+ };
1979
+ const deleteRule = win.CSSStyleSheet.prototype.deleteRule;
1980
+ win.CSSStyleSheet.prototype.deleteRule = function(index) {
1981
+ const { id, styleId } = getIdAndStyleId(this, mirror2, stylesheetManager.styleMirror);
1982
+ if (id && id !== -1 || styleId && styleId !== -1) {
1983
+ styleSheetRuleCb({
1984
+ id,
1985
+ styleId,
1986
+ removes: [{ index }]
1987
+ });
1988
+ }
1989
+ return deleteRule.apply(this, [index]);
1990
+ };
1991
+ let replace;
1992
+ if (win.CSSStyleSheet.prototype.replace) {
1993
+ replace = win.CSSStyleSheet.prototype.replace;
1994
+ win.CSSStyleSheet.prototype.replace = function(text) {
1995
+ const { id, styleId } = getIdAndStyleId(this, mirror2, stylesheetManager.styleMirror);
1996
+ if (id && id !== -1 || styleId && styleId !== -1) {
1997
+ styleSheetRuleCb({
1998
+ id,
1999
+ styleId,
2000
+ replace: text
2001
+ });
2002
+ }
2003
+ return replace.apply(this, [text]);
2004
+ };
2005
+ }
2006
+ let replaceSync;
2007
+ if (win.CSSStyleSheet.prototype.replaceSync) {
2008
+ replaceSync = win.CSSStyleSheet.prototype.replaceSync;
2009
+ win.CSSStyleSheet.prototype.replaceSync = function(text) {
2010
+ const { id, styleId } = getIdAndStyleId(this, mirror2, stylesheetManager.styleMirror);
2011
+ if (id && id !== -1 || styleId && styleId !== -1) {
2012
+ styleSheetRuleCb({
2013
+ id,
2014
+ styleId,
2015
+ replaceSync: text
2016
+ });
2017
+ }
2018
+ return replaceSync.apply(this, [text]);
2019
+ };
2020
+ }
2021
+ const supportedNestedCSSRuleTypes = {};
2022
+ if (isCSSGroupingRuleSupported) {
2023
+ supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;
2024
+ } else {
2025
+ if (isCSSMediaRuleSupported) {
2026
+ supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;
2027
+ }
2028
+ if (isCSSConditionRuleSupported) {
2029
+ supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;
2030
+ }
2031
+ if (isCSSSupportsRuleSupported) {
2032
+ supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;
2033
+ }
2034
+ }
2035
+ const unmodifiedFunctions = {};
2036
+ Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
2037
+ unmodifiedFunctions[typeKey] = {
2038
+ insertRule: type.prototype.insertRule,
2039
+ deleteRule: type.prototype.deleteRule
2040
+ };
2041
+ type.prototype.insertRule = function(rule, index) {
2042
+ const { id, styleId } = getIdAndStyleId(this.parentStyleSheet, mirror2, stylesheetManager.styleMirror);
2043
+ if (id && id !== -1 || styleId && styleId !== -1) {
2044
+ styleSheetRuleCb({
2045
+ id,
2046
+ styleId,
2047
+ adds: [
2048
+ {
2049
+ rule,
2050
+ index: [
2051
+ ...getNestedCSSRulePositions(this),
2052
+ index || 0
2053
+ ]
2054
+ }
2055
+ ]
2056
+ });
2057
+ }
2058
+ return unmodifiedFunctions[typeKey].insertRule.apply(this, [rule, index]);
2059
+ };
2060
+ type.prototype.deleteRule = function(index) {
2061
+ const { id, styleId } = getIdAndStyleId(this.parentStyleSheet, mirror2, stylesheetManager.styleMirror);
2062
+ if (id && id !== -1 || styleId && styleId !== -1) {
2063
+ styleSheetRuleCb({
2064
+ id,
2065
+ styleId,
2066
+ removes: [
2067
+ { index: [...getNestedCSSRulePositions(this), index] }
2068
+ ]
2069
+ });
2070
+ }
2071
+ return unmodifiedFunctions[typeKey].deleteRule.apply(this, [index]);
2072
+ };
2073
+ });
2074
+ return () => {
2075
+ win.CSSStyleSheet.prototype.insertRule = insertRule;
2076
+ win.CSSStyleSheet.prototype.deleteRule = deleteRule;
2077
+ replace && (win.CSSStyleSheet.prototype.replace = replace);
2078
+ replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);
2079
+ Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
2080
+ type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
2081
+ type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
2082
+ });
2083
+ };
2084
+ }
2085
+ function initAdoptedStyleSheetObserver({ mirror: mirror2, stylesheetManager }, host) {
2086
+ var _a, _b, _c;
2087
+ let hostId = null;
2088
+ if (host.nodeName === "#document")
2089
+ hostId = mirror2.getId(host);
2090
+ else
2091
+ hostId = mirror2.getId(host.host);
2092
+ const patchTarget = host.nodeName === "#document" ? (_a = host.defaultView) === null || _a === void 0 ? void 0 : _a.Document : (_c = (_b = host.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) === null || _c === void 0 ? void 0 : _c.ShadowRoot;
2093
+ const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget.prototype, "adoptedStyleSheets");
2094
+ if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)
2095
+ return () => {
2096
+ };
2097
+ Object.defineProperty(host, "adoptedStyleSheets", {
2098
+ configurable: originalPropertyDescriptor.configurable,
2099
+ enumerable: originalPropertyDescriptor.enumerable,
2100
+ get() {
2101
+ var _a2;
2102
+ return (_a2 = originalPropertyDescriptor.get) === null || _a2 === void 0 ? void 0 : _a2.call(this);
2103
+ },
2104
+ set(sheets) {
2105
+ var _a2;
2106
+ const result = (_a2 = originalPropertyDescriptor.set) === null || _a2 === void 0 ? void 0 : _a2.call(this, sheets);
2107
+ if (hostId !== null && hostId !== -1) {
2108
+ try {
2109
+ stylesheetManager.adoptStyleSheets(sheets, hostId);
2110
+ } catch (e) {
2111
+ }
2112
+ }
2113
+ return result;
2114
+ }
2115
+ });
2116
+ return () => {
2117
+ Object.defineProperty(host, "adoptedStyleSheets", {
2118
+ configurable: originalPropertyDescriptor.configurable,
2119
+ enumerable: originalPropertyDescriptor.enumerable,
2120
+ get: originalPropertyDescriptor.get,
2121
+ set: originalPropertyDescriptor.set
2122
+ });
2123
+ };
2124
+ }
2125
+ function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ignoreCSSAttributes, stylesheetManager }, { win }) {
2126
+ const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
2127
+ win.CSSStyleDeclaration.prototype.setProperty = function(property, value, priority) {
2128
+ var _a;
2129
+ if (ignoreCSSAttributes.has(property)) {
2130
+ return setProperty.apply(this, [property, value, priority]);
2131
+ }
2132
+ const { id, styleId } = getIdAndStyleId((_a = this.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror2, stylesheetManager.styleMirror);
2133
+ if (id && id !== -1 || styleId && styleId !== -1) {
2134
+ styleDeclarationCb({
2135
+ id,
2136
+ styleId,
2137
+ set: {
2138
+ property,
2139
+ value,
2140
+ priority
2141
+ },
2142
+ index: getNestedCSSRulePositions(this.parentRule)
2143
+ });
2144
+ }
2145
+ return setProperty.apply(this, [property, value, priority]);
2146
+ };
2147
+ const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
2148
+ win.CSSStyleDeclaration.prototype.removeProperty = function(property) {
2149
+ var _a;
2150
+ if (ignoreCSSAttributes.has(property)) {
2151
+ return removeProperty.apply(this, [property]);
2152
+ }
2153
+ const { id, styleId } = getIdAndStyleId((_a = this.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror2, stylesheetManager.styleMirror);
2154
+ if (id && id !== -1 || styleId && styleId !== -1) {
2155
+ styleDeclarationCb({
2156
+ id,
2157
+ styleId,
2158
+ remove: {
2159
+ property
2160
+ },
2161
+ index: getNestedCSSRulePositions(this.parentRule)
2162
+ });
2163
+ }
2164
+ return removeProperty.apply(this, [property]);
2165
+ };
2166
+ return () => {
2167
+ win.CSSStyleDeclaration.prototype.setProperty = setProperty;
2168
+ win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
2169
+ };
2170
+ }
2171
+ function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSelector, mirror: mirror2, sampling }) {
2172
+ const handler = (type) => throttle((event) => {
2173
+ const target = getEventTarget(event);
2174
+ if (!target || isBlocked(target, blockClass, blockSelector, true)) {
2175
+ return;
2176
+ }
2177
+ const { currentTime, volume, muted, playbackRate } = target;
2178
+ mediaInteractionCb({
2179
+ type,
2180
+ id: mirror2.getId(target),
2181
+ currentTime,
2182
+ volume,
2183
+ muted,
2184
+ playbackRate
2185
+ });
2186
+ }, sampling.media || 500);
2187
+ const handlers = [
2188
+ on("play", handler(0)),
2189
+ on("pause", handler(1)),
2190
+ on("seeked", handler(2)),
2191
+ on("volumechange", handler(3)),
2192
+ on("ratechange", handler(4))
2193
+ ];
2194
+ return () => {
2195
+ handlers.forEach((h) => h());
2196
+ };
2197
+ }
2198
+ function initFontObserver({ fontCb, doc }) {
2199
+ const win = doc.defaultView;
2200
+ if (!win) {
2201
+ return () => {
2202
+ };
2203
+ }
2204
+ const handlers = [];
2205
+ const fontMap = /* @__PURE__ */ new WeakMap();
2206
+ const originalFontFace = win.FontFace;
2207
+ win.FontFace = function FontFace(family, source, descriptors) {
2208
+ const fontFace = new originalFontFace(family, source, descriptors);
2209
+ fontMap.set(fontFace, {
2210
+ family,
2211
+ buffer: typeof source !== "string",
2212
+ descriptors,
2213
+ fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source)))
2214
+ });
2215
+ return fontFace;
2216
+ };
2217
+ const restoreHandler = patch(doc.fonts, "add", function(original) {
2218
+ return function(fontFace) {
2219
+ setTimeout(() => {
2220
+ const p = fontMap.get(fontFace);
2221
+ if (p) {
2222
+ fontCb(p);
2223
+ fontMap.delete(fontFace);
2224
+ }
2225
+ }, 0);
2226
+ return original.apply(this, [fontFace]);
2227
+ };
2228
+ });
2229
+ handlers.push(() => {
2230
+ win.FontFace = originalFontFace;
2231
+ });
2232
+ handlers.push(restoreHandler);
2233
+ return () => {
2234
+ handlers.forEach((h) => h());
2235
+ };
2236
+ }
2237
+ function initSelectionObserver(param) {
2238
+ const { doc, mirror: mirror2, blockClass, blockSelector, selectionCb } = param;
2239
+ let collapsed = true;
2240
+ const updateSelection = () => {
2241
+ const selection = doc.getSelection();
2242
+ if (!selection || collapsed && (selection === null || selection === void 0 ? void 0 : selection.isCollapsed))
2243
+ return;
2244
+ collapsed = selection.isCollapsed || false;
2245
+ const ranges = [];
2246
+ const count = selection.rangeCount || 0;
2247
+ for (let i = 0; i < count; i++) {
2248
+ const range = selection.getRangeAt(i);
2249
+ const { startContainer, startOffset, endContainer, endOffset } = range;
2250
+ const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);
2251
+ if (blocked)
2252
+ continue;
2253
+ ranges.push({
2254
+ start: mirror2.getId(startContainer),
2255
+ startOffset,
2256
+ end: mirror2.getId(endContainer),
2257
+ endOffset
2258
+ });
2259
+ }
2260
+ selectionCb({ ranges });
2261
+ };
2262
+ updateSelection();
2263
+ return on("selectionchange", updateSelection);
2264
+ }
2265
+ function mergeHooks(o, hooks) {
2266
+ const { mutationCb, mousemoveCb, mouseInteractionCb, scrollCb, viewportResizeCb, inputCb, mediaInteractionCb, styleSheetRuleCb, styleDeclarationCb, canvasMutationCb, fontCb, selectionCb } = o;
2267
+ o.mutationCb = (...p) => {
2268
+ if (hooks.mutation) {
2269
+ hooks.mutation(...p);
2270
+ }
2271
+ mutationCb(...p);
2272
+ };
2273
+ o.mousemoveCb = (...p) => {
2274
+ if (hooks.mousemove) {
2275
+ hooks.mousemove(...p);
2276
+ }
2277
+ mousemoveCb(...p);
2278
+ };
2279
+ o.mouseInteractionCb = (...p) => {
2280
+ if (hooks.mouseInteraction) {
2281
+ hooks.mouseInteraction(...p);
2282
+ }
2283
+ mouseInteractionCb(...p);
2284
+ };
2285
+ o.scrollCb = (...p) => {
2286
+ if (hooks.scroll) {
2287
+ hooks.scroll(...p);
2288
+ }
2289
+ scrollCb(...p);
2290
+ };
2291
+ o.viewportResizeCb = (...p) => {
2292
+ if (hooks.viewportResize) {
2293
+ hooks.viewportResize(...p);
2294
+ }
2295
+ viewportResizeCb(...p);
2296
+ };
2297
+ o.inputCb = (...p) => {
2298
+ if (hooks.input) {
2299
+ hooks.input(...p);
2300
+ }
2301
+ inputCb(...p);
2302
+ };
2303
+ o.mediaInteractionCb = (...p) => {
2304
+ if (hooks.mediaInteaction) {
2305
+ hooks.mediaInteaction(...p);
2306
+ }
2307
+ mediaInteractionCb(...p);
2308
+ };
2309
+ o.styleSheetRuleCb = (...p) => {
2310
+ if (hooks.styleSheetRule) {
2311
+ hooks.styleSheetRule(...p);
2312
+ }
2313
+ styleSheetRuleCb(...p);
2314
+ };
2315
+ o.styleDeclarationCb = (...p) => {
2316
+ if (hooks.styleDeclaration) {
2317
+ hooks.styleDeclaration(...p);
2318
+ }
2319
+ styleDeclarationCb(...p);
2320
+ };
2321
+ o.canvasMutationCb = (...p) => {
2322
+ if (hooks.canvasMutation) {
2323
+ hooks.canvasMutation(...p);
2324
+ }
2325
+ canvasMutationCb(...p);
2326
+ };
2327
+ o.fontCb = (...p) => {
2328
+ if (hooks.font) {
2329
+ hooks.font(...p);
2330
+ }
2331
+ fontCb(...p);
2332
+ };
2333
+ o.selectionCb = (...p) => {
2334
+ if (hooks.selection) {
2335
+ hooks.selection(...p);
2336
+ }
2337
+ selectionCb(...p);
2338
+ };
2339
+ }
2340
+ function initObservers(o, hooks = {}) {
2341
+ const currentWindow = o.doc.defaultView;
2342
+ if (!currentWindow) {
2343
+ return () => {
2344
+ };
2345
+ }
2346
+ mergeHooks(o, hooks);
2347
+ const mutationObserver = initMutationObserver(o, o.doc);
2348
+ const mousemoveHandler = initMoveObserver(o);
2349
+ const mouseInteractionHandler = initMouseInteractionObserver(o);
2350
+ const scrollHandler = initScrollObserver(o);
2351
+ const viewportResizeHandler = initViewportResizeObserver(o);
2352
+ const inputHandler = initInputObserver(o);
2353
+ const mediaInteractionHandler = initMediaInteractionObserver(o);
2354
+ const styleSheetObserver = initStyleSheetObserver(o, { win: currentWindow });
2355
+ const adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o, o.doc);
2356
+ const styleDeclarationObserver = initStyleDeclarationObserver(o, {
2357
+ win: currentWindow
2358
+ });
2359
+ const fontObserver = o.collectFonts ? initFontObserver(o) : () => {
2360
+ };
2361
+ const selectionObserver = initSelectionObserver(o);
2362
+ const pluginHandlers = [];
2363
+ for (const plugin of o.plugins) {
2364
+ pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
2365
+ }
2366
+ return () => {
2367
+ mutationBuffers.forEach((b) => b.reset());
2368
+ mutationObserver.disconnect();
2369
+ mousemoveHandler();
2370
+ mouseInteractionHandler();
2371
+ scrollHandler();
2372
+ viewportResizeHandler();
2373
+ inputHandler();
2374
+ mediaInteractionHandler();
2375
+ styleSheetObserver();
2376
+ adoptedStyleSheetObserver();
2377
+ styleDeclarationObserver();
2378
+ fontObserver();
2379
+ selectionObserver();
2380
+ pluginHandlers.forEach((h) => h());
2381
+ };
2382
+ }
2383
+
2384
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/cross-origin-iframe-mirror.js
2385
+ var CrossOriginIframeMirror = class {
2386
+ constructor(generateIdFn) {
2387
+ this.generateIdFn = generateIdFn;
2388
+ this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();
2389
+ this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();
2390
+ }
2391
+ getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {
2392
+ const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);
2393
+ const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);
2394
+ let id = idToRemoteIdMap.get(remoteId);
2395
+ if (!id) {
2396
+ id = this.generateIdFn();
2397
+ idToRemoteIdMap.set(remoteId, id);
2398
+ remoteIdToIdMap.set(id, remoteId);
2399
+ }
2400
+ return id;
2401
+ }
2402
+ getIds(iframe, remoteId) {
2403
+ const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);
2404
+ const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
2405
+ return remoteId.map((id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap));
2406
+ }
2407
+ getRemoteId(iframe, id, map) {
2408
+ const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);
2409
+ if (typeof id !== "number")
2410
+ return id;
2411
+ const remoteId = remoteIdToIdMap.get(id);
2412
+ if (!remoteId)
2413
+ return -1;
2414
+ return remoteId;
2415
+ }
2416
+ getRemoteIds(iframe, ids) {
2417
+ const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
2418
+ return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));
2419
+ }
2420
+ reset(iframe) {
2421
+ if (!iframe) {
2422
+ this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();
2423
+ this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();
2424
+ return;
2425
+ }
2426
+ this.iframeIdToRemoteIdMap.delete(iframe);
2427
+ this.iframeRemoteIdToIdMap.delete(iframe);
2428
+ }
2429
+ getIdToRemoteIdMap(iframe) {
2430
+ let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);
2431
+ if (!idToRemoteIdMap) {
2432
+ idToRemoteIdMap = /* @__PURE__ */ new Map();
2433
+ this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);
2434
+ }
2435
+ return idToRemoteIdMap;
2436
+ }
2437
+ getRemoteIdToIdMap(iframe) {
2438
+ let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);
2439
+ if (!remoteIdToIdMap) {
2440
+ remoteIdToIdMap = /* @__PURE__ */ new Map();
2441
+ this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);
2442
+ }
2443
+ return remoteIdToIdMap;
2444
+ }
2445
+ };
2446
+
2447
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/iframe-manager.js
2448
+ var IframeManager = class {
2449
+ constructor(options) {
2450
+ this.iframes = /* @__PURE__ */ new WeakMap();
2451
+ this.crossOriginIframeMap = /* @__PURE__ */ new WeakMap();
2452
+ this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);
2453
+ this.mutationCb = options.mutationCb;
2454
+ this.wrappedEmit = options.wrappedEmit;
2455
+ this.stylesheetManager = options.stylesheetManager;
2456
+ this.recordCrossOriginIframes = options.recordCrossOriginIframes;
2457
+ this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror));
2458
+ this.mirror = options.mirror;
2459
+ if (this.recordCrossOriginIframes) {
2460
+ window.addEventListener("message", this.handleMessage.bind(this));
2461
+ }
2462
+ }
2463
+ addIframe(iframeEl) {
2464
+ this.iframes.set(iframeEl, true);
2465
+ if (iframeEl.contentWindow)
2466
+ this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);
2467
+ }
2468
+ addLoadListener(cb) {
2469
+ this.loadListener = cb;
2470
+ }
2471
+ attachIframe(iframeEl, childSn) {
2472
+ var _a;
2473
+ this.mutationCb({
2474
+ adds: [
2475
+ {
2476
+ parentId: this.mirror.getId(iframeEl),
2477
+ nextId: null,
2478
+ node: childSn
2479
+ }
2480
+ ],
2481
+ removes: [],
2482
+ texts: [],
2483
+ attributes: [],
2484
+ isAttachIframe: true
2485
+ });
2486
+ (_a = this.loadListener) === null || _a === void 0 ? void 0 : _a.call(this, iframeEl);
2487
+ if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0)
2488
+ this.stylesheetManager.adoptStyleSheets(iframeEl.contentDocument.adoptedStyleSheets, this.mirror.getId(iframeEl.contentDocument));
2489
+ }
2490
+ handleMessage(message) {
2491
+ if (message.data.type === "rrweb") {
2492
+ const iframeSourceWindow = message.source;
2493
+ if (!iframeSourceWindow)
2494
+ return;
2495
+ const iframeEl = this.crossOriginIframeMap.get(message.source);
2496
+ if (!iframeEl)
2497
+ return;
2498
+ const transformedEvent = this.transformCrossOriginEvent(iframeEl, message.data.event);
2499
+ if (transformedEvent)
2500
+ this.wrappedEmit(transformedEvent, message.data.isCheckout);
2501
+ }
2502
+ }
2503
+ transformCrossOriginEvent(iframeEl, e) {
2504
+ var _a;
2505
+ switch (e.type) {
2506
+ case EventType.FullSnapshot: {
2507
+ this.crossOriginIframeMirror.reset(iframeEl);
2508
+ this.crossOriginIframeStyleMirror.reset(iframeEl);
2509
+ this.replaceIdOnNode(e.data.node, iframeEl);
2510
+ return {
2511
+ timestamp: e.timestamp,
2512
+ type: EventType.IncrementalSnapshot,
2513
+ data: {
2514
+ source: IncrementalSource.Mutation,
2515
+ adds: [
2516
+ {
2517
+ parentId: this.mirror.getId(iframeEl),
2518
+ nextId: null,
2519
+ node: e.data.node
2520
+ }
2521
+ ],
2522
+ removes: [],
2523
+ texts: [],
2524
+ attributes: [],
2525
+ isAttachIframe: true
2526
+ }
2527
+ };
2528
+ }
2529
+ case EventType.Meta:
2530
+ case EventType.Load:
2531
+ case EventType.DomContentLoaded: {
2532
+ return false;
2533
+ }
2534
+ case EventType.Plugin: {
2535
+ return e;
2536
+ }
2537
+ case EventType.Custom: {
2538
+ this.replaceIds(e.data.payload, iframeEl, ["id", "parentId", "previousId", "nextId"]);
2539
+ return e;
2540
+ }
2541
+ case EventType.IncrementalSnapshot: {
2542
+ switch (e.data.source) {
2543
+ case IncrementalSource.Mutation: {
2544
+ e.data.adds.forEach((n) => {
2545
+ this.replaceIds(n, iframeEl, [
2546
+ "parentId",
2547
+ "nextId",
2548
+ "previousId"
2549
+ ]);
2550
+ this.replaceIdOnNode(n.node, iframeEl);
2551
+ });
2552
+ e.data.removes.forEach((n) => {
2553
+ this.replaceIds(n, iframeEl, ["parentId", "id"]);
2554
+ });
2555
+ e.data.attributes.forEach((n) => {
2556
+ this.replaceIds(n, iframeEl, ["id"]);
2557
+ });
2558
+ e.data.texts.forEach((n) => {
2559
+ this.replaceIds(n, iframeEl, ["id"]);
2560
+ });
2561
+ return e;
2562
+ }
2563
+ case IncrementalSource.Drag:
2564
+ case IncrementalSource.TouchMove:
2565
+ case IncrementalSource.MouseMove: {
2566
+ e.data.positions.forEach((p) => {
2567
+ this.replaceIds(p, iframeEl, ["id"]);
2568
+ });
2569
+ return e;
2570
+ }
2571
+ case IncrementalSource.ViewportResize: {
2572
+ return false;
2573
+ }
2574
+ case IncrementalSource.MediaInteraction:
2575
+ case IncrementalSource.MouseInteraction:
2576
+ case IncrementalSource.Scroll:
2577
+ case IncrementalSource.CanvasMutation:
2578
+ case IncrementalSource.Input: {
2579
+ this.replaceIds(e.data, iframeEl, ["id"]);
2580
+ return e;
2581
+ }
2582
+ case IncrementalSource.StyleSheetRule:
2583
+ case IncrementalSource.StyleDeclaration: {
2584
+ this.replaceIds(e.data, iframeEl, ["id"]);
2585
+ this.replaceStyleIds(e.data, iframeEl, ["styleId"]);
2586
+ return e;
2587
+ }
2588
+ case IncrementalSource.Font: {
2589
+ return e;
2590
+ }
2591
+ case IncrementalSource.Selection: {
2592
+ e.data.ranges.forEach((range) => {
2593
+ this.replaceIds(range, iframeEl, ["start", "end"]);
2594
+ });
2595
+ return e;
2596
+ }
2597
+ case IncrementalSource.AdoptedStyleSheet: {
2598
+ this.replaceIds(e.data, iframeEl, ["id"]);
2599
+ this.replaceStyleIds(e.data, iframeEl, ["styleIds"]);
2600
+ (_a = e.data.styles) === null || _a === void 0 ? void 0 : _a.forEach((style) => {
2601
+ this.replaceStyleIds(style, iframeEl, ["styleId"]);
2602
+ });
2603
+ return e;
2604
+ }
2605
+ }
2606
+ }
2607
+ }
2608
+ }
2609
+ replace(iframeMirror, obj, iframeEl, keys) {
2610
+ for (const key of keys) {
2611
+ if (!Array.isArray(obj[key]) && typeof obj[key] !== "number")
2612
+ continue;
2613
+ if (Array.isArray(obj[key])) {
2614
+ obj[key] = iframeMirror.getIds(iframeEl, obj[key]);
2615
+ } else {
2616
+ obj[key] = iframeMirror.getId(iframeEl, obj[key]);
2617
+ }
2618
+ }
2619
+ return obj;
2620
+ }
2621
+ replaceIds(obj, iframeEl, keys) {
2622
+ return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);
2623
+ }
2624
+ replaceStyleIds(obj, iframeEl, keys) {
2625
+ return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);
2626
+ }
2627
+ replaceIdOnNode(node, iframeEl) {
2628
+ this.replaceIds(node, iframeEl, ["id"]);
2629
+ if ("childNodes" in node) {
2630
+ node.childNodes.forEach((child) => {
2631
+ this.replaceIdOnNode(child, iframeEl);
2632
+ });
2633
+ }
2634
+ }
2635
+ };
2636
+
2637
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js
2638
+ var ShadowDomManager = class {
2639
+ constructor(options) {
2640
+ this.shadowDoms = /* @__PURE__ */ new WeakSet();
2641
+ this.restorePatches = [];
2642
+ this.mutationCb = options.mutationCb;
2643
+ this.scrollCb = options.scrollCb;
2644
+ this.bypassOptions = options.bypassOptions;
2645
+ this.mirror = options.mirror;
2646
+ const manager = this;
2647
+ this.restorePatches.push(patch(Element.prototype, "attachShadow", function(original) {
2648
+ return function(option) {
2649
+ const shadowRoot = original.call(this, option);
2650
+ if (this.shadowRoot)
2651
+ manager.addShadowRoot(this.shadowRoot, this.ownerDocument);
2652
+ return shadowRoot;
2653
+ };
2654
+ }));
2655
+ }
2656
+ addShadowRoot(shadowRoot, doc) {
2657
+ if (!isNativeShadowDom(shadowRoot))
2658
+ return;
2659
+ if (this.shadowDoms.has(shadowRoot))
2660
+ return;
2661
+ this.shadowDoms.add(shadowRoot);
2662
+ initMutationObserver(Object.assign(Object.assign({}, this.bypassOptions), { doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
2663
+ initScrollObserver(Object.assign(Object.assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror }));
2664
+ setTimeout(() => {
2665
+ if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length > 0)
2666
+ this.bypassOptions.stylesheetManager.adoptStyleSheets(shadowRoot.adoptedStyleSheets, this.mirror.getId(shadowRoot.host));
2667
+ initAdoptedStyleSheetObserver({
2668
+ mirror: this.mirror,
2669
+ stylesheetManager: this.bypassOptions.stylesheetManager
2670
+ }, shadowRoot);
2671
+ }, 0);
2672
+ }
2673
+ observeAttachShadow(iframeElement) {
2674
+ if (iframeElement.contentWindow) {
2675
+ const manager = this;
2676
+ this.restorePatches.push(patch(iframeElement.contentWindow.HTMLElement.prototype, "attachShadow", function(original) {
2677
+ return function(option) {
2678
+ const shadowRoot = original.call(this, option);
2679
+ if (this.shadowRoot)
2680
+ manager.addShadowRoot(this.shadowRoot, iframeElement.contentDocument);
2681
+ return shadowRoot;
2682
+ };
2683
+ }));
2684
+ }
2685
+ }
2686
+ reset() {
2687
+ this.restorePatches.forEach((restorePatch) => restorePatch());
2688
+ this.shadowDoms = /* @__PURE__ */ new WeakSet();
2689
+ }
2690
+ };
2691
+
2692
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/ext/tslib/tslib.es6.js
2693
+ function __rest(s, e) {
2694
+ var t = {};
2695
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2696
+ t[p] = s[p];
2697
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
2698
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2699
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2700
+ t[p[i]] = s[p[i]];
2701
+ }
2702
+ return t;
2703
+ }
2704
+ function __awaiter(thisArg, _arguments, P, generator) {
2705
+ function adopt(value) {
2706
+ return value instanceof P ? value : new P(function(resolve) {
2707
+ resolve(value);
2708
+ });
2709
+ }
2710
+ return new (P || (P = Promise))(function(resolve, reject) {
2711
+ function fulfilled(value) {
2712
+ try {
2713
+ step(generator.next(value));
2714
+ } catch (e) {
2715
+ reject(e);
2716
+ }
2717
+ }
2718
+ function rejected(value) {
2719
+ try {
2720
+ step(generator["throw"](value));
2721
+ } catch (e) {
2722
+ reject(e);
2723
+ }
2724
+ }
2725
+ function step(result) {
2726
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
2727
+ }
2728
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2729
+ });
2730
+ }
2731
+
2732
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/ext/base64-arraybuffer/dist/base64-arraybuffer.es5.js
2733
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2734
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
2735
+ for (i = 0; i < chars.length; i++) {
2736
+ lookup[chars.charCodeAt(i)] = i;
2737
+ }
2738
+ var i;
2739
+ var encode = function(arraybuffer) {
2740
+ var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";
2741
+ for (i = 0; i < len; i += 3) {
2742
+ base64 += chars[bytes[i] >> 2];
2743
+ base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];
2744
+ base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];
2745
+ base64 += chars[bytes[i + 2] & 63];
2746
+ }
2747
+ if (len % 3 === 2) {
2748
+ base64 = base64.substring(0, base64.length - 1) + "=";
2749
+ } else if (len % 3 === 1) {
2750
+ base64 = base64.substring(0, base64.length - 2) + "==";
2751
+ }
2752
+ return base64;
2753
+ };
2754
+
2755
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js
2756
+ var canvasVarMap = /* @__PURE__ */ new Map();
2757
+ function variableListFor(ctx, ctor) {
2758
+ let contextMap = canvasVarMap.get(ctx);
2759
+ if (!contextMap) {
2760
+ contextMap = /* @__PURE__ */ new Map();
2761
+ canvasVarMap.set(ctx, contextMap);
2762
+ }
2763
+ if (!contextMap.has(ctor)) {
2764
+ contextMap.set(ctor, []);
2765
+ }
2766
+ return contextMap.get(ctor);
2767
+ }
2768
+ var saveWebGLVar = (value, win, ctx) => {
2769
+ if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === "object"))
2770
+ return;
2771
+ const name = value.constructor.name;
2772
+ const list = variableListFor(ctx, name);
2773
+ let index = list.indexOf(value);
2774
+ if (index === -1) {
2775
+ index = list.length;
2776
+ list.push(value);
2777
+ }
2778
+ return index;
2779
+ };
2780
+ function serializeArg(value, win, ctx) {
2781
+ if (value instanceof Array) {
2782
+ return value.map((arg) => serializeArg(arg, win, ctx));
2783
+ } else if (value === null) {
2784
+ return value;
2785
+ } else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {
2786
+ const name = value.constructor.name;
2787
+ return {
2788
+ rr_type: name,
2789
+ args: [Object.values(value)]
2790
+ };
2791
+ } else if (value instanceof ArrayBuffer) {
2792
+ const name = value.constructor.name;
2793
+ const base64 = encode(value);
2794
+ return {
2795
+ rr_type: name,
2796
+ base64
2797
+ };
2798
+ } else if (value instanceof DataView) {
2799
+ const name = value.constructor.name;
2800
+ return {
2801
+ rr_type: name,
2802
+ args: [
2803
+ serializeArg(value.buffer, win, ctx),
2804
+ value.byteOffset,
2805
+ value.byteLength
2806
+ ]
2807
+ };
2808
+ } else if (value instanceof HTMLImageElement) {
2809
+ const name = value.constructor.name;
2810
+ const { src } = value;
2811
+ return {
2812
+ rr_type: name,
2813
+ src
2814
+ };
2815
+ } else if (value instanceof HTMLCanvasElement) {
2816
+ const name = "HTMLImageElement";
2817
+ const src = value.toDataURL();
2818
+ return {
2819
+ rr_type: name,
2820
+ src
2821
+ };
2822
+ } else if (value instanceof ImageData) {
2823
+ const name = value.constructor.name;
2824
+ return {
2825
+ rr_type: name,
2826
+ args: [serializeArg(value.data, win, ctx), value.width, value.height]
2827
+ };
2828
+ } else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
2829
+ const name = value.constructor.name;
2830
+ const index = saveWebGLVar(value, win, ctx);
2831
+ return {
2832
+ rr_type: name,
2833
+ index
2834
+ };
2835
+ }
2836
+ return value;
2837
+ }
2838
+ var serializeArgs = (args, win, ctx) => {
2839
+ return [...args].map((arg) => serializeArg(arg, win, ctx));
2840
+ };
2841
+ var isInstanceOfWebGLObject = (value, win) => {
2842
+ const webGLConstructorNames = [
2843
+ "WebGLActiveInfo",
2844
+ "WebGLBuffer",
2845
+ "WebGLFramebuffer",
2846
+ "WebGLProgram",
2847
+ "WebGLRenderbuffer",
2848
+ "WebGLShader",
2849
+ "WebGLShaderPrecisionFormat",
2850
+ "WebGLTexture",
2851
+ "WebGLUniformLocation",
2852
+ "WebGLVertexArrayObject",
2853
+ "WebGLVertexArrayObjectOES"
2854
+ ];
2855
+ const supportedWebGLConstructorNames = webGLConstructorNames.filter((name) => typeof win[name] === "function");
2856
+ return Boolean(supportedWebGLConstructorNames.find((name) => value instanceof win[name]));
2857
+ };
2858
+
2859
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js
2860
+ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
2861
+ const handlers = [];
2862
+ const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
2863
+ for (const prop of props2D) {
2864
+ try {
2865
+ if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {
2866
+ continue;
2867
+ }
2868
+ const restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function(original) {
2869
+ return function(...args) {
2870
+ if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
2871
+ setTimeout(() => {
2872
+ const recordArgs = serializeArgs([...args], win, this);
2873
+ cb(this.canvas, {
2874
+ type: CanvasContext["2D"],
2875
+ property: prop,
2876
+ args: recordArgs
2877
+ });
2878
+ }, 0);
2879
+ }
2880
+ return original.apply(this, args);
2881
+ };
2882
+ });
2883
+ handlers.push(restoreHandler);
2884
+ } catch (_a) {
2885
+ const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop, {
2886
+ set(v) {
2887
+ cb(this.canvas, {
2888
+ type: CanvasContext["2D"],
2889
+ property: prop,
2890
+ args: [v],
2891
+ setter: true
2892
+ });
2893
+ }
2894
+ });
2895
+ handlers.push(hookHandler);
2896
+ }
2897
+ }
2898
+ return () => {
2899
+ handlers.forEach((h) => h());
2900
+ };
2901
+ }
2902
+
2903
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js
2904
+ function initCanvasContextObserver(win, blockClass, blockSelector) {
2905
+ const handlers = [];
2906
+ try {
2907
+ const restoreHandler = patch(win.HTMLCanvasElement.prototype, "getContext", function(original) {
2908
+ return function(contextType, ...args) {
2909
+ if (!isBlocked(this, blockClass, blockSelector, true)) {
2910
+ if (!("__context" in this))
2911
+ this.__context = contextType;
2912
+ }
2913
+ return original.apply(this, [contextType, ...args]);
2914
+ };
2915
+ });
2916
+ handlers.push(restoreHandler);
2917
+ } catch (_a) {
2918
+ console.error("failed to patch HTMLCanvasElement.prototype.getContext");
2919
+ }
2920
+ return () => {
2921
+ handlers.forEach((h) => h());
2922
+ };
2923
+ }
2924
+
2925
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js
2926
+ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, mirror2, win) {
2927
+ const handlers = [];
2928
+ const props = Object.getOwnPropertyNames(prototype);
2929
+ for (const prop of props) {
2930
+ if ([
2931
+ "isContextLost",
2932
+ "canvas",
2933
+ "drawingBufferWidth",
2934
+ "drawingBufferHeight"
2935
+ ].includes(prop)) {
2936
+ continue;
2937
+ }
2938
+ try {
2939
+ if (typeof prototype[prop] !== "function") {
2940
+ continue;
2941
+ }
2942
+ const restoreHandler = patch(prototype, prop, function(original) {
2943
+ return function(...args) {
2944
+ const result = original.apply(this, args);
2945
+ saveWebGLVar(result, win, this);
2946
+ if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
2947
+ const recordArgs = serializeArgs([...args], win, this);
2948
+ const mutation = {
2949
+ type,
2950
+ property: prop,
2951
+ args: recordArgs
2952
+ };
2953
+ cb(this.canvas, mutation);
2954
+ }
2955
+ return result;
2956
+ };
2957
+ });
2958
+ handlers.push(restoreHandler);
2959
+ } catch (_a) {
2960
+ const hookHandler = hookSetter(prototype, prop, {
2961
+ set(v) {
2962
+ cb(this.canvas, {
2963
+ type,
2964
+ property: prop,
2965
+ args: [v],
2966
+ setter: true
2967
+ });
2968
+ }
2969
+ });
2970
+ handlers.push(hookHandler);
2971
+ }
2972
+ }
2973
+ return handlers;
2974
+ }
2975
+ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, mirror2) {
2976
+ const handlers = [];
2977
+ handlers.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, mirror2, win));
2978
+ if (typeof win.WebGL2RenderingContext !== "undefined") {
2979
+ handlers.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, mirror2, win));
2980
+ }
2981
+ return () => {
2982
+ handlers.forEach((h) => h());
2983
+ };
2984
+ }
2985
+
2986
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js
2987
+ var WorkerClass = null;
2988
+ try {
2989
+ WorkerThreads = typeof module !== "undefined" && typeof module.require === "function" && module.require("worker_threads") || typeof __non_webpack_require__ === "function" && __non_webpack_require__("worker_threads") || typeof require === "function" && require("worker_threads");
2990
+ WorkerClass = WorkerThreads.Worker;
2991
+ } catch (e) {
2992
+ }
2993
+ var WorkerThreads;
2994
+
2995
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js
2996
+ function decodeBase64(base64, enableUnicode) {
2997
+ return Buffer.from(base64, "base64").toString(enableUnicode ? "utf16" : "utf8");
2998
+ }
2999
+ function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
3000
+ var sourcemap = sourcemapArg === void 0 ? null : sourcemapArg;
3001
+ var enableUnicode = enableUnicodeArg === void 0 ? false : enableUnicodeArg;
3002
+ var source = decodeBase64(base64, enableUnicode);
3003
+ var start = source.indexOf("\n", 10) + 1;
3004
+ var body = source.substring(start) + (sourcemap ? "//# sourceMappingURL=" + sourcemap : "");
3005
+ return function WorkerFactory2(options) {
3006
+ return new WorkerClass(body, Object.assign({}, options, { eval: true }));
3007
+ };
3008
+ }
3009
+
3010
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js
3011
+ function decodeBase642(base64, enableUnicode) {
3012
+ var binaryString = atob(base64);
3013
+ if (enableUnicode) {
3014
+ var binaryView = new Uint8Array(binaryString.length);
3015
+ for (var i = 0, n = binaryString.length; i < n; ++i) {
3016
+ binaryView[i] = binaryString.charCodeAt(i);
3017
+ }
3018
+ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
3019
+ }
3020
+ return binaryString;
3021
+ }
3022
+ function createURL(base64, sourcemapArg, enableUnicodeArg) {
3023
+ var sourcemap = sourcemapArg === void 0 ? null : sourcemapArg;
3024
+ var enableUnicode = enableUnicodeArg === void 0 ? false : enableUnicodeArg;
3025
+ var source = decodeBase642(base64, enableUnicode);
3026
+ var start = source.indexOf("\n", 10) + 1;
3027
+ var body = source.substring(start) + (sourcemap ? "//# sourceMappingURL=" + sourcemap : "");
3028
+ var blob = new Blob([body], { type: "application/javascript" });
3029
+ return URL.createObjectURL(blob);
3030
+ }
3031
+ function createBase64WorkerFactory2(base64, sourcemapArg, enableUnicodeArg) {
3032
+ var url;
3033
+ return function WorkerFactory2(options) {
3034
+ url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
3035
+ return new Worker(url, options);
3036
+ };
3037
+ }
3038
+
3039
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js
3040
+ var kIsNodeJS = Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]";
3041
+ function isNodeJS() {
3042
+ return kIsNodeJS;
3043
+ }
3044
+
3045
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js
3046
+ function createBase64WorkerFactory3(base64, sourcemapArg, enableUnicodeArg) {
3047
+ if (isNodeJS()) {
3048
+ return createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg);
3049
+ }
3050
+ return createBase64WorkerFactory2(base64, sourcemapArg, enableUnicodeArg);
3051
+ }
3052
+
3053
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/_virtual/image-bitmap-data-url-worker.js
3054
+ var WorkerFactory = createBase64WorkerFactory3("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=", null, false);
3055
+
3056
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js
3057
+ var CanvasManager = class {
3058
+ constructor(options) {
3059
+ this.pendingCanvasMutations = /* @__PURE__ */ new Map();
3060
+ this.rafStamps = { latestId: 0, invokeId: null };
3061
+ this.frozen = false;
3062
+ this.locked = false;
3063
+ this.processMutation = (target, mutation) => {
3064
+ const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
3065
+ if (newFrame || !this.rafStamps.invokeId)
3066
+ this.rafStamps.invokeId = this.rafStamps.latestId;
3067
+ if (!this.pendingCanvasMutations.has(target)) {
3068
+ this.pendingCanvasMutations.set(target, []);
3069
+ }
3070
+ this.pendingCanvasMutations.get(target).push(mutation);
3071
+ };
3072
+ const { sampling = "all", win, blockClass, blockSelector, recordCanvas, dataURLOptions } = options;
3073
+ this.mutationCb = options.mutationCb;
3074
+ this.mirror = options.mirror;
3075
+ if (recordCanvas && sampling === "all")
3076
+ this.initCanvasMutationObserver(win, blockClass, blockSelector);
3077
+ if (recordCanvas && typeof sampling === "number")
3078
+ this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {
3079
+ dataURLOptions
3080
+ });
3081
+ }
3082
+ reset() {
3083
+ this.pendingCanvasMutations.clear();
3084
+ this.resetObservers && this.resetObservers();
3085
+ }
3086
+ freeze() {
3087
+ this.frozen = true;
3088
+ }
3089
+ unfreeze() {
3090
+ this.frozen = false;
3091
+ }
3092
+ lock() {
3093
+ this.locked = true;
3094
+ }
3095
+ unlock() {
3096
+ this.locked = false;
3097
+ }
3098
+ initCanvasFPSObserver(fps, win, blockClass, blockSelector, options) {
3099
+ const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
3100
+ const snapshotInProgressMap = /* @__PURE__ */ new Map();
3101
+ const worker = new WorkerFactory();
3102
+ worker.onmessage = (e) => {
3103
+ const { id } = e.data;
3104
+ snapshotInProgressMap.set(id, false);
3105
+ if (!("base64" in e.data))
3106
+ return;
3107
+ const { base64, type, width, height } = e.data;
3108
+ this.mutationCb({
3109
+ id,
3110
+ type: CanvasContext["2D"],
3111
+ commands: [
3112
+ {
3113
+ property: "clearRect",
3114
+ args: [0, 0, width, height]
3115
+ },
3116
+ {
3117
+ property: "drawImage",
3118
+ args: [
3119
+ {
3120
+ rr_type: "ImageBitmap",
3121
+ args: [
3122
+ {
3123
+ rr_type: "Blob",
3124
+ data: [{ rr_type: "ArrayBuffer", base64 }],
3125
+ type
3126
+ }
3127
+ ]
3128
+ },
3129
+ 0,
3130
+ 0
3131
+ ]
3132
+ }
3133
+ ]
3134
+ });
3135
+ };
3136
+ const timeBetweenSnapshots = 1e3 / fps;
3137
+ let lastSnapshotTime = 0;
3138
+ let rafId;
3139
+ const getCanvas = () => {
3140
+ const matchedCanvas = [];
3141
+ win.document.querySelectorAll("canvas").forEach((canvas) => {
3142
+ if (!isBlocked(canvas, blockClass, blockSelector, true)) {
3143
+ matchedCanvas.push(canvas);
3144
+ }
3145
+ });
3146
+ return matchedCanvas;
3147
+ };
3148
+ const takeCanvasSnapshots = (timestamp) => {
3149
+ if (lastSnapshotTime && timestamp - lastSnapshotTime < timeBetweenSnapshots) {
3150
+ rafId = requestAnimationFrame(takeCanvasSnapshots);
3151
+ return;
3152
+ }
3153
+ lastSnapshotTime = timestamp;
3154
+ getCanvas().forEach((canvas) => __awaiter(this, void 0, void 0, function* () {
3155
+ var _a;
3156
+ const id = this.mirror.getId(canvas);
3157
+ if (snapshotInProgressMap.get(id))
3158
+ return;
3159
+ snapshotInProgressMap.set(id, true);
3160
+ if (["webgl", "webgl2"].includes(canvas.__context)) {
3161
+ const context = canvas.getContext(canvas.__context);
3162
+ if (((_a = context === null || context === void 0 ? void 0 : context.getContextAttributes()) === null || _a === void 0 ? void 0 : _a.preserveDrawingBuffer) === false) {
3163
+ context === null || context === void 0 ? void 0 : context.clear(context.COLOR_BUFFER_BIT);
3164
+ }
3165
+ }
3166
+ const bitmap = yield createImageBitmap(canvas);
3167
+ worker.postMessage({
3168
+ id,
3169
+ bitmap,
3170
+ width: canvas.width,
3171
+ height: canvas.height,
3172
+ dataURLOptions: options.dataURLOptions
3173
+ }, [bitmap]);
3174
+ }));
3175
+ rafId = requestAnimationFrame(takeCanvasSnapshots);
3176
+ };
3177
+ rafId = requestAnimationFrame(takeCanvasSnapshots);
3178
+ this.resetObservers = () => {
3179
+ canvasContextReset();
3180
+ cancelAnimationFrame(rafId);
3181
+ };
3182
+ }
3183
+ initCanvasMutationObserver(win, blockClass, blockSelector) {
3184
+ this.startRAFTimestamping();
3185
+ this.startPendingCanvasMutationFlusher();
3186
+ const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
3187
+ const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector);
3188
+ const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, this.mirror);
3189
+ this.resetObservers = () => {
3190
+ canvasContextReset();
3191
+ canvas2DReset();
3192
+ canvasWebGL1and2Reset();
3193
+ };
3194
+ }
3195
+ startPendingCanvasMutationFlusher() {
3196
+ requestAnimationFrame(() => this.flushPendingCanvasMutations());
3197
+ }
3198
+ startRAFTimestamping() {
3199
+ const setLatestRAFTimestamp = (timestamp) => {
3200
+ this.rafStamps.latestId = timestamp;
3201
+ requestAnimationFrame(setLatestRAFTimestamp);
3202
+ };
3203
+ requestAnimationFrame(setLatestRAFTimestamp);
3204
+ }
3205
+ flushPendingCanvasMutations() {
3206
+ this.pendingCanvasMutations.forEach((values, canvas) => {
3207
+ const id = this.mirror.getId(canvas);
3208
+ this.flushPendingCanvasMutationFor(canvas, id);
3209
+ });
3210
+ requestAnimationFrame(() => this.flushPendingCanvasMutations());
3211
+ }
3212
+ flushPendingCanvasMutationFor(canvas, id) {
3213
+ if (this.frozen || this.locked) {
3214
+ return;
3215
+ }
3216
+ const valuesWithType = this.pendingCanvasMutations.get(canvas);
3217
+ if (!valuesWithType || id === -1)
3218
+ return;
3219
+ const values = valuesWithType.map((value) => {
3220
+ const rest = __rest(value, ["type"]);
3221
+ return rest;
3222
+ });
3223
+ const { type } = valuesWithType[0];
3224
+ this.mutationCb({ id, type, commands: values });
3225
+ this.pendingCanvasMutations.delete(canvas);
3226
+ }
3227
+ };
3228
+
3229
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js
3230
+ var StylesheetManager = class {
3231
+ constructor(options) {
3232
+ this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
3233
+ this.styleMirror = new StyleSheetMirror();
3234
+ this.mutationCb = options.mutationCb;
3235
+ this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;
3236
+ }
3237
+ attachLinkElement(linkEl, childSn) {
3238
+ if ("_cssText" in childSn.attributes)
3239
+ this.mutationCb({
3240
+ adds: [],
3241
+ removes: [],
3242
+ texts: [],
3243
+ attributes: [
3244
+ {
3245
+ id: childSn.id,
3246
+ attributes: childSn.attributes
3247
+ }
3248
+ ]
3249
+ });
3250
+ this.trackLinkElement(linkEl);
3251
+ }
3252
+ trackLinkElement(linkEl) {
3253
+ if (this.trackedLinkElements.has(linkEl))
3254
+ return;
3255
+ this.trackedLinkElements.add(linkEl);
3256
+ this.trackStylesheetInLinkElement(linkEl);
3257
+ }
3258
+ adoptStyleSheets(sheets, hostId) {
3259
+ if (sheets.length === 0)
3260
+ return;
3261
+ const adoptedStyleSheetData = {
3262
+ id: hostId,
3263
+ styleIds: []
3264
+ };
3265
+ const styles = [];
3266
+ for (const sheet of sheets) {
3267
+ let styleId;
3268
+ if (!this.styleMirror.has(sheet)) {
3269
+ styleId = this.styleMirror.add(sheet);
3270
+ const rules = Array.from(sheet.rules || CSSRule);
3271
+ styles.push({
3272
+ styleId,
3273
+ rules: rules.map((r, index) => {
3274
+ return {
3275
+ rule: getCssRuleString(r),
3276
+ index
3277
+ };
3278
+ })
3279
+ });
3280
+ } else
3281
+ styleId = this.styleMirror.getId(sheet);
3282
+ adoptedStyleSheetData.styleIds.push(styleId);
3283
+ }
3284
+ if (styles.length > 0)
3285
+ adoptedStyleSheetData.styles = styles;
3286
+ this.adoptedStyleSheetCb(adoptedStyleSheetData);
3287
+ }
3288
+ reset() {
3289
+ this.styleMirror.reset();
3290
+ this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
3291
+ }
3292
+ trackStylesheetInLinkElement(linkEl) {
3293
+ }
3294
+ };
3295
+
3296
+ // ../../node_modules/.pnpm/rrweb@2.0.0-alpha.4/node_modules/rrweb/es/rrweb/packages/rrweb/src/record/index.js
3297
+ function wrapEvent(e) {
3298
+ return Object.assign(Object.assign({}, e), { timestamp: Date.now() });
3299
+ }
3300
+ var wrappedEmit;
3301
+ var takeFullSnapshot;
3302
+ var canvasManager;
3303
+ var recording = false;
3304
+ var mirror = createMirror();
3305
+ function record(options = {}) {
3306
+ const { emit, checkoutEveryNms, checkoutEveryNth, blockClass = "rr-block", blockSelector = null, ignoreClass = "rr-ignore", maskTextClass = "rr-mask", maskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskInputFn, maskTextFn, hooks, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordCanvas = false, recordCrossOriginIframes = false, userTriggeredOnInput = false, collectFonts = false, inlineImages = false, plugins, keepIframeSrcFn = () => false, ignoreCSSAttributes = /* @__PURE__ */ new Set([]) } = options;
3307
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
3308
+ let passEmitsToParent = false;
3309
+ if (!inEmittingFrame) {
3310
+ try {
3311
+ window.parent.document;
3312
+ passEmitsToParent = false;
3313
+ } catch (e) {
3314
+ passEmitsToParent = true;
3315
+ }
3316
+ }
3317
+ if (inEmittingFrame && !emit) {
3318
+ throw new Error("emit function is required");
3319
+ }
3320
+ if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {
3321
+ sampling.mousemove = mousemoveWait;
3322
+ }
3323
+ mirror.reset();
3324
+ const maskInputOptions = maskAllInputs === true ? {
3325
+ color: true,
3326
+ date: true,
3327
+ "datetime-local": true,
3328
+ email: true,
3329
+ month: true,
3330
+ number: true,
3331
+ range: true,
3332
+ search: true,
3333
+ tel: true,
3334
+ text: true,
3335
+ time: true,
3336
+ url: true,
3337
+ week: true,
3338
+ textarea: true,
3339
+ select: true,
3340
+ password: true
3341
+ } : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };
3342
+ const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? {
3343
+ script: true,
3344
+ comment: true,
3345
+ headFavicon: true,
3346
+ headWhitespace: true,
3347
+ headMetaSocial: true,
3348
+ headMetaRobots: true,
3349
+ headMetaHttpEquiv: true,
3350
+ headMetaVerification: true,
3351
+ headMetaAuthorship: _slimDOMOptions === "all",
3352
+ headMetaDescKeywords: _slimDOMOptions === "all"
3353
+ } : _slimDOMOptions ? _slimDOMOptions : {};
3354
+ polyfill();
3355
+ let lastFullSnapshotEvent;
3356
+ let incrementalSnapshotCount = 0;
3357
+ const eventProcessor = (e) => {
3358
+ for (const plugin of plugins || []) {
3359
+ if (plugin.eventProcessor) {
3360
+ e = plugin.eventProcessor(e);
3361
+ }
3362
+ }
3363
+ if (packFn) {
3364
+ e = packFn(e);
3365
+ }
3366
+ return e;
3367
+ };
3368
+ wrappedEmit = (e, isCheckout) => {
3369
+ var _a;
3370
+ if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) && e.type !== EventType.FullSnapshot && !(e.type === EventType.IncrementalSnapshot && e.data.source === IncrementalSource.Mutation)) {
3371
+ mutationBuffers.forEach((buf) => buf.unfreeze());
3372
+ }
3373
+ if (inEmittingFrame) {
3374
+ emit === null || emit === void 0 ? void 0 : emit(eventProcessor(e), isCheckout);
3375
+ } else if (passEmitsToParent) {
3376
+ const message = {
3377
+ type: "rrweb",
3378
+ event: eventProcessor(e),
3379
+ isCheckout
3380
+ };
3381
+ window.parent.postMessage(message, "*");
3382
+ }
3383
+ if (e.type === EventType.FullSnapshot) {
3384
+ lastFullSnapshotEvent = e;
3385
+ incrementalSnapshotCount = 0;
3386
+ } else if (e.type === EventType.IncrementalSnapshot) {
3387
+ if (e.data.source === IncrementalSource.Mutation && e.data.isAttachIframe) {
3388
+ return;
3389
+ }
3390
+ incrementalSnapshotCount++;
3391
+ const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
3392
+ const exceedTime = checkoutEveryNms && e.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
3393
+ if (exceedCount || exceedTime) {
3394
+ takeFullSnapshot(true);
3395
+ }
3396
+ }
3397
+ };
3398
+ const wrappedMutationEmit = (m) => {
3399
+ wrappedEmit(wrapEvent({
3400
+ type: EventType.IncrementalSnapshot,
3401
+ data: Object.assign({ source: IncrementalSource.Mutation }, m)
3402
+ }));
3403
+ };
3404
+ const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
3405
+ type: EventType.IncrementalSnapshot,
3406
+ data: Object.assign({ source: IncrementalSource.Scroll }, p)
3407
+ }));
3408
+ const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
3409
+ type: EventType.IncrementalSnapshot,
3410
+ data: Object.assign({ source: IncrementalSource.CanvasMutation }, p)
3411
+ }));
3412
+ const wrappedAdoptedStyleSheetEmit = (a) => wrappedEmit(wrapEvent({
3413
+ type: EventType.IncrementalSnapshot,
3414
+ data: Object.assign({ source: IncrementalSource.AdoptedStyleSheet }, a)
3415
+ }));
3416
+ const stylesheetManager = new StylesheetManager({
3417
+ mutationCb: wrappedMutationEmit,
3418
+ adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit
3419
+ });
3420
+ const iframeManager = new IframeManager({
3421
+ mirror,
3422
+ mutationCb: wrappedMutationEmit,
3423
+ stylesheetManager,
3424
+ recordCrossOriginIframes,
3425
+ wrappedEmit
3426
+ });
3427
+ for (const plugin of plugins || []) {
3428
+ if (plugin.getMirror)
3429
+ plugin.getMirror({
3430
+ nodeMirror: mirror,
3431
+ crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,
3432
+ crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror
3433
+ });
3434
+ }
3435
+ canvasManager = new CanvasManager({
3436
+ recordCanvas,
3437
+ mutationCb: wrappedCanvasMutationEmit,
3438
+ win: window,
3439
+ blockClass,
3440
+ blockSelector,
3441
+ mirror,
3442
+ sampling: sampling.canvas,
3443
+ dataURLOptions
3444
+ });
3445
+ const shadowDomManager = new ShadowDomManager({
3446
+ mutationCb: wrappedMutationEmit,
3447
+ scrollCb: wrappedScrollEmit,
3448
+ bypassOptions: {
3449
+ blockClass,
3450
+ blockSelector,
3451
+ maskTextClass,
3452
+ maskTextSelector,
3453
+ inlineStylesheet,
3454
+ maskInputOptions,
3455
+ dataURLOptions,
3456
+ maskTextFn,
3457
+ maskInputFn,
3458
+ recordCanvas,
3459
+ inlineImages,
3460
+ sampling,
3461
+ slimDOMOptions,
3462
+ iframeManager,
3463
+ stylesheetManager,
3464
+ canvasManager,
3465
+ keepIframeSrcFn
3466
+ },
3467
+ mirror
3468
+ });
3469
+ takeFullSnapshot = (isCheckout = false) => {
3470
+ var _a, _b, _c, _d, _e, _f;
3471
+ wrappedEmit(wrapEvent({
3472
+ type: EventType.Meta,
3473
+ data: {
3474
+ href: window.location.href,
3475
+ width: getWindowWidth(),
3476
+ height: getWindowHeight()
3477
+ }
3478
+ }), isCheckout);
3479
+ stylesheetManager.reset();
3480
+ mutationBuffers.forEach((buf) => buf.lock());
3481
+ const node = snapshot(document, {
3482
+ mirror,
3483
+ blockClass,
3484
+ blockSelector,
3485
+ maskTextClass,
3486
+ maskTextSelector,
3487
+ inlineStylesheet,
3488
+ maskAllInputs: maskInputOptions,
3489
+ maskTextFn,
3490
+ slimDOM: slimDOMOptions,
3491
+ dataURLOptions,
3492
+ recordCanvas,
3493
+ inlineImages,
3494
+ onSerialize: (n) => {
3495
+ if (isSerializedIframe(n, mirror)) {
3496
+ iframeManager.addIframe(n);
3497
+ }
3498
+ if (isSerializedStylesheet(n, mirror)) {
3499
+ stylesheetManager.trackLinkElement(n);
3500
+ }
3501
+ if (hasShadowRoot(n)) {
3502
+ shadowDomManager.addShadowRoot(n.shadowRoot, document);
3503
+ }
3504
+ },
3505
+ onIframeLoad: (iframe, childSn) => {
3506
+ iframeManager.attachIframe(iframe, childSn);
3507
+ shadowDomManager.observeAttachShadow(iframe);
3508
+ },
3509
+ onStylesheetLoad: (linkEl, childSn) => {
3510
+ stylesheetManager.attachLinkElement(linkEl, childSn);
3511
+ },
3512
+ keepIframeSrcFn
3513
+ });
3514
+ if (!node) {
3515
+ return console.warn("Failed to snapshot the document");
3516
+ }
3517
+ wrappedEmit(wrapEvent({
3518
+ type: EventType.FullSnapshot,
3519
+ data: {
3520
+ node,
3521
+ initialOffset: {
3522
+ left: window.pageXOffset !== void 0 ? window.pageXOffset : (document === null || document === void 0 ? void 0 : document.documentElement.scrollLeft) || ((_b = (_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.scrollLeft) || ((_c = document === null || document === void 0 ? void 0 : document.body) === null || _c === void 0 ? void 0 : _c.scrollLeft) || 0,
3523
+ top: window.pageYOffset !== void 0 ? window.pageYOffset : (document === null || document === void 0 ? void 0 : document.documentElement.scrollTop) || ((_e = (_d = document === null || document === void 0 ? void 0 : document.body) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.scrollTop) || ((_f = document === null || document === void 0 ? void 0 : document.body) === null || _f === void 0 ? void 0 : _f.scrollTop) || 0
3524
+ }
3525
+ }
3526
+ }));
3527
+ mutationBuffers.forEach((buf) => buf.unlock());
3528
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
3529
+ stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document));
3530
+ };
3531
+ try {
3532
+ const handlers = [];
3533
+ handlers.push(on("DOMContentLoaded", () => {
3534
+ wrappedEmit(wrapEvent({
3535
+ type: EventType.DomContentLoaded,
3536
+ data: {}
3537
+ }));
3538
+ }));
3539
+ const observe = (doc) => {
3540
+ var _a;
3541
+ return initObservers({
3542
+ mutationCb: wrappedMutationEmit,
3543
+ mousemoveCb: (positions, source) => wrappedEmit(wrapEvent({
3544
+ type: EventType.IncrementalSnapshot,
3545
+ data: {
3546
+ source,
3547
+ positions
3548
+ }
3549
+ })),
3550
+ mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
3551
+ type: EventType.IncrementalSnapshot,
3552
+ data: Object.assign({ source: IncrementalSource.MouseInteraction }, d)
3553
+ })),
3554
+ scrollCb: wrappedScrollEmit,
3555
+ viewportResizeCb: (d) => wrappedEmit(wrapEvent({
3556
+ type: EventType.IncrementalSnapshot,
3557
+ data: Object.assign({ source: IncrementalSource.ViewportResize }, d)
3558
+ })),
3559
+ inputCb: (v) => wrappedEmit(wrapEvent({
3560
+ type: EventType.IncrementalSnapshot,
3561
+ data: Object.assign({ source: IncrementalSource.Input }, v)
3562
+ })),
3563
+ mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
3564
+ type: EventType.IncrementalSnapshot,
3565
+ data: Object.assign({ source: IncrementalSource.MediaInteraction }, p)
3566
+ })),
3567
+ styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
3568
+ type: EventType.IncrementalSnapshot,
3569
+ data: Object.assign({ source: IncrementalSource.StyleSheetRule }, r)
3570
+ })),
3571
+ styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
3572
+ type: EventType.IncrementalSnapshot,
3573
+ data: Object.assign({ source: IncrementalSource.StyleDeclaration }, r)
3574
+ })),
3575
+ canvasMutationCb: wrappedCanvasMutationEmit,
3576
+ fontCb: (p) => wrappedEmit(wrapEvent({
3577
+ type: EventType.IncrementalSnapshot,
3578
+ data: Object.assign({ source: IncrementalSource.Font }, p)
3579
+ })),
3580
+ selectionCb: (p) => {
3581
+ wrappedEmit(wrapEvent({
3582
+ type: EventType.IncrementalSnapshot,
3583
+ data: Object.assign({ source: IncrementalSource.Selection }, p)
3584
+ }));
3585
+ },
3586
+ blockClass,
3587
+ ignoreClass,
3588
+ maskTextClass,
3589
+ maskTextSelector,
3590
+ maskInputOptions,
3591
+ inlineStylesheet,
3592
+ sampling,
3593
+ recordCanvas,
3594
+ inlineImages,
3595
+ userTriggeredOnInput,
3596
+ collectFonts,
3597
+ doc,
3598
+ maskInputFn,
3599
+ maskTextFn,
3600
+ keepIframeSrcFn,
3601
+ blockSelector,
3602
+ slimDOMOptions,
3603
+ dataURLOptions,
3604
+ mirror,
3605
+ iframeManager,
3606
+ stylesheetManager,
3607
+ shadowDomManager,
3608
+ canvasManager,
3609
+ ignoreCSSAttributes,
3610
+ plugins: ((_a = plugins === null || plugins === void 0 ? void 0 : plugins.filter((p) => p.observer)) === null || _a === void 0 ? void 0 : _a.map((p) => ({
3611
+ observer: p.observer,
3612
+ options: p.options,
3613
+ callback: (payload) => wrappedEmit(wrapEvent({
3614
+ type: EventType.Plugin,
3615
+ data: {
3616
+ plugin: p.name,
3617
+ payload
3618
+ }
3619
+ }))
3620
+ }))) || []
3621
+ }, hooks);
3622
+ };
3623
+ iframeManager.addLoadListener((iframeEl) => {
3624
+ handlers.push(observe(iframeEl.contentDocument));
3625
+ });
3626
+ const init = () => {
3627
+ takeFullSnapshot();
3628
+ handlers.push(observe(document));
3629
+ recording = true;
3630
+ };
3631
+ if (document.readyState === "interactive" || document.readyState === "complete") {
3632
+ init();
3633
+ } else {
3634
+ handlers.push(on("load", () => {
3635
+ wrappedEmit(wrapEvent({
3636
+ type: EventType.Load,
3637
+ data: {}
3638
+ }));
3639
+ init();
3640
+ }, window));
3641
+ }
3642
+ return () => {
3643
+ handlers.forEach((h) => h());
3644
+ recording = false;
3645
+ };
3646
+ } catch (error) {
3647
+ console.warn(error);
3648
+ }
3649
+ }
3650
+ record.addCustomEvent = (tag, payload) => {
3651
+ if (!recording) {
3652
+ throw new Error("please add custom event after start recording");
3653
+ }
3654
+ wrappedEmit(wrapEvent({
3655
+ type: EventType.Custom,
3656
+ data: {
3657
+ tag,
3658
+ payload
3659
+ }
3660
+ }));
3661
+ };
3662
+ record.freezePage = () => {
3663
+ mutationBuffers.forEach((buf) => buf.freeze());
3664
+ };
3665
+ record.takeFullSnapshot = (isCheckout) => {
3666
+ if (!recording) {
3667
+ throw new Error("please take full snapshot after start recording");
3668
+ }
3669
+ takeFullSnapshot(isCheckout);
3670
+ };
3671
+ record.mirror = mirror;
45
3672
 
46
3673
  // src/config.ts
47
3674
  var DEFAULTS = {
@@ -413,6 +4040,10 @@ function reserveSeq(session, next) {
413
4040
  function touchSession(session, now = Date.now()) {
414
4041
  session.set(SESSION_TS_KEY, String(now));
415
4042
  }
4043
+ function forgetVisitor(local, session) {
4044
+ local.remove(VISITOR_KEY);
4045
+ for (const key of [SESSION_KEY, SESSION_TS_KEY, SEQ_KEY, PAGE_KEY, COOLDOWN_KEY]) session.remove(key);
4046
+ }
416
4047
 
417
4048
  // src/recorder.ts
418
4049
  var RAGE_CLICK_COUNT = 3;
@@ -423,37 +4054,22 @@ function createRecorder(rawOptions) {
423
4054
  const options = resolveOptions(rawOptions);
424
4055
  const local = safeStorage(() => globalThis.localStorage);
425
4056
  const session = safeStorage(() => globalThis.sessionStorage);
426
- const identity = resolveIdentity(local, session);
427
4057
  let status = "idle";
4058
+ let identity;
4059
+ let transport;
428
4060
  let stopRecording;
429
- let pageCount = identity.pageCount;
430
- if (!isSampledIn(identity.visitorId, options.sampleRate)) {
431
- return inertHandle("sampled-out", identity.sessionId);
432
- }
433
- if (inCooldown(session)) {
434
- if (options.debug) console.warn("[anyreplay] not recording: ingest refused a new session recently");
435
- return inertHandle("stopped", identity.sessionId);
436
- }
437
- const transport = new Transport(
438
- options,
439
- {
440
- projectKey: options.projectKey,
441
- sessionId: identity.sessionId,
442
- visitorId: identity.visitorId,
443
- initialSeq: identity.nextSeq
444
- },
445
- {
446
- onSeqReserved: (next) => reserveSeq(session, next),
447
- onStopped: (reason) => {
448
- status = "stopped";
449
- stopRecording == null ? void 0 : stopRecording();
450
- stopRecording = void 0;
451
- if (reason === "rejected_402") startCooldown(session);
452
- if (options.debug) console.warn(`[anyreplay] recording stopped: ${reason}`);
453
- }
454
- }
455
- );
456
- const collectMeta = () => ({
4061
+ let pageCount = 0;
4062
+ let pendingTraits;
4063
+ const sendIdentity = (who, traits) => {
4064
+ void fetch(`${options.ingestUrl}/v1/ingest/identify`, {
4065
+ method: "POST",
4066
+ headers: { "Content-Type": "application/json" },
4067
+ credentials: "omit",
4068
+ body: JSON.stringify({ projectKey: options.projectKey, sessionId: who.sessionId, ...traits })
4069
+ }).catch(() => {
4070
+ });
4071
+ };
4072
+ const collectMeta = (who) => ({
457
4073
  startedAt: Date.now(),
458
4074
  url: safeLocation(),
459
4075
  lang: typeof navigator !== "undefined" ? navigator.language : void 0,
@@ -463,10 +4079,10 @@ function createRecorder(rawOptions) {
463
4079
  referrer: typeof document !== "undefined" ? document.referrer || void 0 : void 0,
464
4080
  // The cap is a decision about starting a session, so it goes only where
465
4081
  // ingest makes that decision: chunk 0. A resumed page starts later.
466
- ...options.maxSessionsPerMonth !== void 0 && identity.nextSeq === 0 ? { sessionCap: options.maxSessionsPerMonth } : {}
4082
+ ...options.maxSessionsPerMonth !== void 0 && who.nextSeq === 0 ? { sessionCap: options.maxSessionsPerMonth } : {}
467
4083
  });
468
4084
  const recentClicks = [];
469
- const noteInteraction = (event) => {
4085
+ const noteInteraction = (event, channel) => {
470
4086
  var _a;
471
4087
  const data = event.data;
472
4088
  if (event.type !== 3 || (data == null ? void 0 : data.source) !== 2 || typeof data.x !== "number") return;
@@ -478,7 +4094,7 @@ function createRecorder(rawOptions) {
478
4094
  const clustered = recentClicks.every(
479
4095
  (c) => Math.abs(c.x - first.x) < RAGE_CLICK_RADIUS_PX && Math.abs(c.y - first.y) < RAGE_CLICK_RADIUS_PX
480
4096
  );
481
- if (clustered) transport.mergeFlags({ hasRageClick: true });
4097
+ if (clustered) channel.mergeFlags({ hasRageClick: true });
482
4098
  }
483
4099
  };
484
4100
  const pending = [];
@@ -490,7 +4106,7 @@ function createRecorder(rawOptions) {
490
4106
  try {
491
4107
  while (pending.length > 0) {
492
4108
  const next = pending[0];
493
- import_rrweb.record.addCustomEvent(next.tag, next.payload);
4109
+ record.addCustomEvent(next.tag, next.payload);
494
4110
  pending.shift();
495
4111
  }
496
4112
  } catch (e) {
@@ -506,10 +4122,10 @@ function createRecorder(rawOptions) {
506
4122
  }
507
4123
  };
508
4124
  const emitCustom = (tag, payload) => {
509
- if (status === "stopped") return;
4125
+ if (status === "stopped" || status === "sampled-out") return;
510
4126
  if (status === "recording") {
511
4127
  try {
512
- import_rrweb.record.addCustomEvent(tag, payload);
4128
+ record.addCustomEvent(tag, payload);
513
4129
  return;
514
4130
  } catch (e) {
515
4131
  }
@@ -520,28 +4136,61 @@ function createRecorder(rawOptions) {
520
4136
  }
521
4137
  pending.push({ tag, payload });
522
4138
  };
523
- let lastUrl = safeLocation();
524
- const noteNavigation = () => {
4139
+ let lastUrl;
4140
+ const noteNavigation = (channel) => {
525
4141
  const url = safeLocation();
526
4142
  if (!url || url === lastUrl) return;
527
4143
  lastUrl = url;
528
4144
  pageCount += 1;
529
4145
  notePageCount(session, pageCount);
530
- transport.mergeFlags({ pageCount });
4146
+ channel.mergeFlags({ pageCount });
531
4147
  emitCustom(NAVIGATE_TAG, { url, title: typeof document !== "undefined" ? document.title : "" });
532
4148
  };
533
4149
  const begin = () => {
534
- if (status === "recording" || status === "stopped") return;
4150
+ if (status !== "idle" && status !== "awaiting-consent") return;
4151
+ const who = resolveIdentity(local, session);
4152
+ identity = who;
4153
+ pageCount = who.pageCount;
4154
+ if (!isSampledIn(who.visitorId, options.sampleRate)) {
4155
+ status = "sampled-out";
4156
+ return;
4157
+ }
4158
+ if (inCooldown(session)) {
4159
+ status = "stopped";
4160
+ if (options.debug) console.warn("[anyreplay] not recording: ingest refused a new session recently");
4161
+ return;
4162
+ }
4163
+ const channel = new Transport(
4164
+ options,
4165
+ {
4166
+ projectKey: options.projectKey,
4167
+ sessionId: who.sessionId,
4168
+ visitorId: who.visitorId,
4169
+ initialSeq: who.nextSeq
4170
+ },
4171
+ {
4172
+ onSeqReserved: (next) => reserveSeq(session, next),
4173
+ onStopped: (reason) => {
4174
+ status = "stopped";
4175
+ stopRecording == null ? void 0 : stopRecording();
4176
+ stopRecording = void 0;
4177
+ if (reason === "rejected_402") startCooldown(session);
4178
+ if (options.debug) console.warn(`[anyreplay] recording stopped: ${reason}`);
4179
+ }
4180
+ }
4181
+ );
4182
+ transport = channel;
535
4183
  status = "recording";
536
- transport.setMeta(collectMeta());
537
- transport.mergeFlags({ pageCount });
538
- transport.start();
539
- stopRecording = (0, import_rrweb.record)({
4184
+ lastUrl = safeLocation();
4185
+ channel.setMeta(collectMeta(who));
4186
+ channel.mergeFlags({ pageCount });
4187
+ channel.start();
4188
+ stopRecording = record({
540
4189
  emit: (event) => {
541
4190
  const typed = event;
542
- noteInteraction(typed);
4191
+ noteInteraction(typed, channel);
543
4192
  touchSession(session, typed.timestamp);
544
- transport.push(typed);
4193
+ channel.push(typed);
545
4194
  drainPending();
546
4195
  },
547
4196
  maskAllInputs: options.maskAllInputs,
@@ -554,29 +4203,33 @@ function createRecorder(rawOptions) {
554
4203
  collectFonts: false
555
4204
  });
556
4205
  drainPending();
557
- attachLifecycleHooks();
4206
+ if (pendingTraits) {
4207
+ sendIdentity(who, pendingTraits);
4208
+ pendingTraits = void 0;
4209
+ }
4210
+ attachLifecycleHooks(channel);
558
4211
  };
559
- const attachLifecycleHooks = () => {
4212
+ const attachLifecycleHooks = (channel) => {
560
4213
  if (typeof window === "undefined") return;
561
4214
  window.addEventListener("pagehide", () => {
562
- transport.flushWithBeacon();
4215
+ channel.flushWithBeacon();
563
4216
  }, { capture: true });
564
4217
  document.addEventListener("visibilitychange", () => {
565
- if (document.visibilityState === "hidden") transport.flushWithBeacon();
4218
+ if (document.visibilityState === "hidden") channel.flushWithBeacon();
566
4219
  });
567
- window.addEventListener("error", () => transport.mergeFlags({ hasError: true }));
568
- window.addEventListener("unhandledrejection", () => transport.mergeFlags({ hasError: true }));
569
- const patch = (method) => {
4220
+ window.addEventListener("error", () => channel.mergeFlags({ hasError: true }));
4221
+ window.addEventListener("unhandledrejection", () => channel.mergeFlags({ hasError: true }));
4222
+ const patch2 = (method) => {
570
4223
  const original = history[method].bind(history);
571
4224
  history[method] = function patched(...args) {
572
4225
  const result = original(...args);
573
- noteNavigation();
4226
+ noteNavigation(channel);
574
4227
  return result;
575
4228
  };
576
4229
  };
577
- patch("pushState");
578
- patch("replaceState");
579
- window.addEventListener("popstate", noteNavigation);
4230
+ patch2("pushState");
4231
+ patch2("replaceState");
4232
+ window.addEventListener("popstate", () => noteNavigation(channel));
580
4233
  };
581
4234
  if (options.requireConsent) {
582
4235
  status = "awaiting-consent";
@@ -585,24 +4238,28 @@ function createRecorder(rawOptions) {
585
4238
  }
586
4239
  return {
587
4240
  status: () => status,
588
- sessionId: () => identity.sessionId,
4241
+ sessionId: () => {
4242
+ var _a;
4243
+ return (_a = identity == null ? void 0 : identity.sessionId) != null ? _a : null;
4244
+ },
589
4245
  consent: (granted) => {
590
- if (granted) begin();
591
- else transport.stop("consent_withdrawn");
4246
+ if (granted) {
4247
+ begin();
4248
+ return;
4249
+ }
4250
+ transport == null ? void 0 : transport.stop("consent_withdrawn");
4251
+ if (status === "idle" || status === "awaiting-consent") status = "stopped";
4252
+ pendingTraits = void 0;
4253
+ forgetVisitor(local, session);
592
4254
  },
593
4255
  identify: (traits) => {
594
4256
  if (!traits.userId && !traits.email) return;
595
- void fetch(`${options.ingestUrl}/v1/ingest/identify`, {
596
- method: "POST",
597
- headers: { "Content-Type": "application/json" },
598
- credentials: "omit",
599
- body: JSON.stringify({
600
- projectKey: options.projectKey,
601
- sessionId: identity.sessionId,
602
- ...traits
603
- })
604
- }).catch(() => {
605
- });
4257
+ if (identity && transport) {
4258
+ sendIdentity(identity, traits);
4259
+ return;
4260
+ }
4261
+ if (status === "idle" || status === "awaiting-consent") pendingTraits = traits;
4262
+ else if (options.debug) console.warn("[anyreplay] identify() ignored: not recording");
606
4263
  },
607
4264
  track: (name, properties) => {
608
4265
  const payload = validateTrack(name, properties);
@@ -612,8 +4269,15 @@ function createRecorder(rawOptions) {
612
4269
  }
613
4270
  emitCustom(TRACK_TAG, payload);
614
4271
  },
615
- stop: () => transport.stop("stopped_by_page"),
616
- flush: () => transport.flush()
4272
+ stop: () => {
4273
+ transport == null ? void 0 : transport.stop("stopped_by_page");
4274
+ if (status === "idle" || status === "awaiting-consent") status = "stopped";
4275
+ pendingTraits = void 0;
4276
+ },
4277
+ flush: () => {
4278
+ var _a;
4279
+ return (_a = transport == null ? void 0 : transport.flush()) != null ? _a : Promise.resolve();
4280
+ }
617
4281
  };
618
4282
  }
619
4283
  function safeLocation() {
@@ -623,22 +4287,6 @@ function safeLocation() {
623
4287
  return void 0;
624
4288
  }
625
4289
  }
626
- function inertHandle(status, sessionId) {
627
- return {
628
- status: () => status,
629
- sessionId: () => sessionId,
630
- consent: () => {
631
- },
632
- identify: () => {
633
- },
634
- track: () => {
635
- },
636
- stop: () => {
637
- },
638
- flush: async () => {
639
- }
640
- };
641
- }
642
4290
  // Annotate the CommonJS export names for ESM import in node:
643
4291
  0 && (module.exports = {
644
4292
  ConfigError,
@@ -649,6 +4297,7 @@ function inertHandle(status, sessionId) {
649
4297
  TRACK_TAG,
650
4298
  Transport,
651
4299
  createRecorder,
4300
+ forgetVisitor,
652
4301
  hashToUnitInterval,
653
4302
  isSampledIn,
654
4303
  resolveIdentity,
@@ -657,4 +4306,22 @@ function inertHandle(status, sessionId) {
657
4306
  uuidv4,
658
4307
  validateTrack
659
4308
  });
4309
+ /*! Bundled license information:
4310
+
4311
+ rrweb/es/rrweb/ext/tslib/tslib.es6.js:
4312
+ (*! *****************************************************************************
4313
+ Copyright (c) Microsoft Corporation.
4314
+
4315
+ Permission to use, copy, modify, and/or distribute this software for any
4316
+ purpose with or without fee is hereby granted.
4317
+
4318
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4319
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4320
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4321
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4322
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4323
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4324
+ PERFORMANCE OF THIS SOFTWARE.
4325
+ ***************************************************************************** *)
4326
+ */
660
4327
  //# sourceMappingURL=index.cjs.map