@mime8/recorder 0.1.0 → 0.2.0

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/recorder.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@rrweb+record@2.1.1/node_modules/@rrweb/record/dist/record.js
1
+ //#region ../../node_modules/.pnpm/@rrweb+record@2.1.1_patch_hash=fa16df54649b4e6e85687ab1b7ab89acf81c5570bea708e822c452a2c6e24f72/node_modules/@rrweb/record/dist/record.js
2
2
  var e = Object.defineProperty, t = (t, n, r) => n in t ? e(t, n, {
3
3
  enumerable: !0,
4
4
  configurable: !0,
@@ -89,15 +89,15 @@ function O(e) {
89
89
  function k(e, t) {
90
90
  return _("Element", e, "querySelector")(t);
91
91
  }
92
- function A(e, t) {
92
+ function te(e, t) {
93
93
  return _("Element", e, "querySelectorAll")(t);
94
94
  }
95
- function j() {
95
+ function ne() {
96
96
  return [h("MutationObserver").constructor, p.MutationObserver ?? (() => {})];
97
97
  }
98
- var te = Date.now;
99
- /* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString()) || (te = () => (/* @__PURE__ */ new Date()).getTime());
100
- function M(e, t, n) {
98
+ var re = Date.now;
99
+ /* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString()) || (re = () => (/* @__PURE__ */ new Date()).getTime());
100
+ function A(e, t, n) {
101
101
  try {
102
102
  if (!(t in e)) return () => {};
103
103
  let r = e[t], i = n(r);
@@ -105,13 +105,13 @@ function M(e, t, n) {
105
105
  enumerable: !1,
106
106
  value: r
107
107
  } })), e[t] = i, () => {
108
- e[t] = r;
108
+ H || (e[t] = r);
109
109
  };
110
110
  } catch {
111
111
  return () => {};
112
112
  }
113
113
  }
114
- var N = {
114
+ var j = {
115
115
  ownerDocument: b,
116
116
  childNodes: x,
117
117
  parentNode: S,
@@ -123,64 +123,64 @@ var N = {
123
123
  styleSheets: D,
124
124
  shadowRoot: O,
125
125
  querySelector: k,
126
- querySelectorAll: A,
127
- nowTimestamp: te,
128
- mutationObserverCtor: j,
129
- patch: M
126
+ querySelectorAll: te,
127
+ nowTimestamp: re,
128
+ mutationObserverCtor: ne,
129
+ patch: A
130
130
  };
131
- function P(e) {
131
+ function ie(e) {
132
132
  return e.nodeType === e.ELEMENT_NODE;
133
133
  }
134
- function F(e) {
135
- let t = e && "host" in e && "mode" in e && N.host(e) || null;
136
- return !!(t && "shadowRoot" in t && N.shadowRoot(t) === e);
134
+ function M(e) {
135
+ let t = e && "host" in e && "mode" in e && j.host(e) || null;
136
+ return !!(t && "shadowRoot" in t && j.shadowRoot(t) === e);
137
137
  }
138
- function I(e) {
138
+ function N(e) {
139
139
  return Object.prototype.toString.call(e) === "[object ShadowRoot]";
140
140
  }
141
- function ne(e) {
141
+ function ae(e) {
142
142
  return e.includes(" background-clip: text;") && !e.includes(" -webkit-background-clip: text;") && (e = e.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;")), e;
143
143
  }
144
- function re(e) {
144
+ function oe(e) {
145
145
  let { cssText: t } = e;
146
146
  if (t.split("\"").length < 3) return t;
147
147
  let n = ["@import", `url(${JSON.stringify(e.href)})`];
148
148
  return e.layerName === "" ? n.push("layer") : e.layerName && n.push(`layer(${e.layerName})`), e.supportsText && n.push(`supports(${e.supportsText})`), e.media.length && n.push(e.media.mediaText), n.join(" ") + ";";
149
149
  }
150
- function ie(e) {
150
+ function se(e) {
151
151
  try {
152
152
  let t = e.rules || e.cssRules;
153
153
  if (!t) return null;
154
154
  let n = e.href;
155
- return !n && e.ownerNode && (n = e.ownerNode.baseURI), ne(Array.from(t, (e) => ae(e, n)).join(""));
155
+ return !n && e.ownerNode && (n = e.ownerNode.baseURI), ae(Array.from(t, (e) => ce(e, n)).join(""));
156
156
  } catch {
157
157
  return null;
158
158
  }
159
159
  }
160
- function ae(e, t) {
161
- if (se(e)) {
160
+ function ce(e, t) {
161
+ if (ue(e)) {
162
162
  let t;
163
163
  try {
164
- t = ie(e.styleSheet) || re(e);
164
+ t = se(e.styleSheet) || oe(e);
165
165
  } catch {
166
166
  t = e.cssText;
167
167
  }
168
- return e.styleSheet.href ? ve(t, e.styleSheet.href) : t;
168
+ return e.styleSheet.href ? xe(t, e.styleSheet.href) : t;
169
169
  } else {
170
170
  let n = e.cssText;
171
- return ce(e) && e.selectorText.includes(":") && (n = oe(n)), t ? ve(n, t) : n;
171
+ return de(e) && e.selectorText.includes(":") && (n = le(n)), t ? xe(n, t) : n;
172
172
  }
173
173
  }
174
- function oe(e) {
174
+ function le(e) {
175
175
  return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm, "$1\\$2");
176
176
  }
177
- function se(e) {
177
+ function ue(e) {
178
178
  return "styleSheet" in e;
179
179
  }
180
- function ce(e) {
180
+ function de(e) {
181
181
  return "selectorText" in e;
182
182
  }
183
- var L = class {
183
+ var P = class {
184
184
  constructor() {
185
185
  n(this, "idNodeMap", /* @__PURE__ */ new Map()), n(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
186
186
  }
@@ -222,31 +222,31 @@ var L = class {
222
222
  this.idNodeMap = /* @__PURE__ */ new Map(), this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
223
223
  }
224
224
  };
225
- function R() {
226
- return new L();
225
+ function F() {
226
+ return new P();
227
227
  }
228
- function z({ element: e, maskInputOptions: t, tagName: n, type: r, value: i, maskInputFn: a }) {
229
- let o = i || "", s = r && B(r);
228
+ function I({ element: e, maskInputOptions: t, tagName: n, type: r, value: i, maskInputFn: a }) {
229
+ let o = i || "", s = r && L(r);
230
230
  return (t[n.toLowerCase()] || s && t[s]) && (o = a ? a(o, e) : "*".repeat(o.length)), o;
231
231
  }
232
- function B(e) {
232
+ function L(e) {
233
233
  return e.toLowerCase();
234
234
  }
235
- var le = "__rrweb_original__";
236
- function ue(e) {
235
+ var fe = "__rrweb_original__";
236
+ function pe(e) {
237
237
  let t = e.getContext("2d");
238
238
  if (!t) return !0;
239
239
  for (let n = 0; n < e.width; n += 50) for (let r = 0; r < e.height; r += 50) {
240
- let i = t.getImageData, a = le in i ? i[le] : i;
240
+ let i = t.getImageData, a = fe in i ? i[fe] : i;
241
241
  if (new Uint32Array(a.call(t, n, r, Math.min(50, e.width - n), Math.min(50, e.height - r)).data.buffer).some((e) => e !== 0)) return !1;
242
242
  }
243
243
  return !0;
244
244
  }
245
- function de(e) {
245
+ function me(e) {
246
246
  let t = e.type;
247
- return e.hasAttribute("data-rr-is-password") ? "password" : t ? B(t) : null;
247
+ return e.hasAttribute("data-rr-is-password") ? "password" : t ? L(t) : null;
248
248
  }
249
- function fe(e, t) {
249
+ function he(e, t) {
250
250
  let n;
251
251
  try {
252
252
  n = new URL(e, t ?? window.location.href);
@@ -255,17 +255,17 @@ function fe(e, t) {
255
255
  }
256
256
  return n.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1] ?? null;
257
257
  }
258
- function pe(e) {
258
+ function ge(e) {
259
259
  let t = "";
260
260
  return t = e.indexOf("//") > -1 ? e.split("/").slice(0, 3).join("/") : e.split("/")[0], t = t.split("?")[0], t;
261
261
  }
262
- var me = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm, he = /^(?:[a-z+]+:)?\/\//i, ge = /^www\..*/i, _e = /^(data:)([^,]*),(.*)/i;
263
- function ve(e, t) {
264
- return (e || "").replace(me, (e, n, r, i, a, o) => {
262
+ var _e = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm, ve = /^(?:[a-z+]+:)?\/\//i, ye = /^www\..*/i, be = /^(data:)([^,]*),(.*)/i;
263
+ function xe(e, t) {
264
+ return (e || "").replace(_e, (e, n, r, i, a, o) => {
265
265
  let s = r || a || o, c = n || i || "";
266
266
  if (!s) return e;
267
- if (he.test(s) || ge.test(s) || _e.test(s)) return `url(${c}${s}${c})`;
268
- if (s[0] === "/") return `url(${c}${pe(t) + s}${c})`;
267
+ if (ve.test(s) || ye.test(s) || be.test(s)) return `url(${c}${s}${c})`;
268
+ if (s[0] === "/") return `url(${c}${ge(t) + s}${c})`;
269
269
  let l = s.split("#")[0], u = s.substring(l.length), d = t.split("#")[0].split("/"), f = l.split("/");
270
270
  d.pop();
271
271
  for (let e of f) if (e === ".") continue;
@@ -273,15 +273,15 @@ function ve(e, t) {
273
273
  return `url(${c}${d.join("/")}${u}${c})`;
274
274
  });
275
275
  }
276
- function ye(e, t = !1) {
276
+ function Se(e, t = !1) {
277
277
  return t ? e.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "") : e.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
278
278
  }
279
- function be(e, t, n = !1) {
279
+ function Ce(e, t, n = !1) {
280
280
  let r = Array.from(t.childNodes), i = [], a = 0;
281
281
  if (r.length > 1 && e && typeof e == "string") {
282
- let t = ye(e, n), o = t.length / e.length;
282
+ let t = Se(e, n), o = t.length / e.length;
283
283
  for (let s = 1; s < r.length; s++) if (r[s].textContent && typeof r[s].textContent == "string") {
284
- let c = ye(r[s].textContent, n), l = 3;
284
+ let c = Se(r[s].textContent, n), l = 3;
285
285
  for (; l < c.length && (c[l].match(/[a-zA-Z0-9]/) || c.indexOf(c.substring(0, l), 1) !== -1); l++);
286
286
  for (; l < c.length; l++) {
287
287
  let u = c.substring(0, l), d = t.split(u), f = -1;
@@ -294,7 +294,7 @@ function be(e, t, n = !1) {
294
294
  if (d.length >= 2 && l > 100) {
295
295
  let e = r[s - 1].textContent;
296
296
  if (e && typeof e == "string") {
297
- let n = ye(e).length;
297
+ let n = Se(e).length;
298
298
  f = t.indexOf(u, n);
299
299
  }
300
300
  f === -1 && (f = d[0].length);
@@ -303,7 +303,7 @@ function be(e, t, n = !1) {
303
303
  let s = Math.floor(f / o);
304
304
  for (; s > 0 && s < e.length;) {
305
305
  if (a += 1, a > 50 * r.length) return i.push(e), i;
306
- let c = ye(e.substring(0, s), n);
306
+ let c = Se(e.substring(0, s), n);
307
307
  if (c.length === f) {
308
308
  i.push(e.substring(0, s)), e = e.substring(s), t = t.substring(f);
309
309
  break;
@@ -316,20 +316,20 @@ function be(e, t, n = !1) {
316
316
  }
317
317
  return i.push(e), i;
318
318
  }
319
- function xe(e, t) {
320
- return be(e, t).join("/* rr_split */");
319
+ function we(e, t) {
320
+ return Ce(e, t).join("/* rr_split */");
321
321
  }
322
- var Se = 1, Ce = /* @__PURE__ */ RegExp("[^a-z0-9-_:]"), we = -2;
323
- function Te() {
324
- return Se++;
322
+ var Te = 1, Ee = /* @__PURE__ */ RegExp("[^a-z0-9-_:]"), De = -2;
323
+ function Oe() {
324
+ return Te++;
325
325
  }
326
- function Ee(e) {
326
+ function ke(e) {
327
327
  if (e instanceof HTMLFormElement) return "form";
328
- let t = B(e.tagName);
329
- return Ce.test(t) ? "div" : t;
328
+ let t = L(e.tagName);
329
+ return Ee.test(t) ? "div" : t;
330
330
  }
331
- var V, De, Oe = /^[^ \t\n\r\u000c]+/, ke = /^[, \t\n\r\u000c]+/;
332
- function Ae(e, t) {
331
+ var Ae, je, Me = /^[^ \t\n\r\u000c]+/, Ne = /^[, \t\n\r\u000c]+/;
332
+ function Pe(e, t) {
333
333
  if (t.trim() === "") return t;
334
334
  let n = 0;
335
335
  function r(e) {
@@ -337,12 +337,12 @@ function Ae(e, t) {
337
337
  return i ? (r = i[0], n += r.length, r) : "";
338
338
  }
339
339
  let i = [];
340
- for (; r(ke), !(n >= t.length);) {
341
- let a = r(Oe);
342
- if (a.slice(-1) === ",") a = Me(e, a.substring(0, a.length - 1)), i.push(a);
340
+ for (; r(Ne), !(n >= t.length);) {
341
+ let a = r(Me);
342
+ if (a.slice(-1) === ",") a = Ie(e, a.substring(0, a.length - 1)), i.push(a);
343
343
  else {
344
344
  let r = "";
345
- a = Me(e, a);
345
+ a = Ie(e, a);
346
346
  let o = !1;
347
347
  for (;;) {
348
348
  let e = t.charAt(n);
@@ -360,30 +360,30 @@ function Ae(e, t) {
360
360
  }
361
361
  return i.join(", ");
362
362
  }
363
- var je = /* @__PURE__ */ new WeakMap();
364
- function Me(e, t) {
365
- return !t || t.trim() === "" ? t : Pe(e, t);
363
+ var Fe = /* @__PURE__ */ new WeakMap();
364
+ function Ie(e, t) {
365
+ return !t || t.trim() === "" ? t : Re(e, t);
366
366
  }
367
- function Ne(e) {
367
+ function Le(e) {
368
368
  return !!(e.tagName === "svg" || e.ownerSVGElement);
369
369
  }
370
- function Pe(e, t) {
371
- let n = je.get(e);
372
- if (n || (n = e.createElement("a"), je.set(e, n)), !t) t = "";
370
+ function Re(e, t) {
371
+ let n = Fe.get(e);
372
+ if (n || (n = e.createElement("a"), Fe.set(e, n)), !t) t = "";
373
373
  else if (t.startsWith("blob:") || t.startsWith("data:")) return t;
374
374
  return n.setAttribute("href", t), n.href;
375
375
  }
376
- function Fe(e, t, n, r) {
376
+ function ze(e, t, n, r) {
377
377
  return r && (n === "src" || n === "href" && (t !== "use" || r[0] !== "#") || n === "xlink:href" && r[0] !== "#" || n === "background" && [
378
378
  "table",
379
379
  "td",
380
380
  "th"
381
- ].includes(t) ? Me(e, r) : n === "srcset" ? Ae(e, r) : n === "style" ? ve(r, Pe(e)) : t === "object" && n === "data" ? Me(e, r) : r);
381
+ ].includes(t) ? Ie(e, r) : n === "srcset" ? Pe(e, r) : n === "style" ? xe(r, Re(e)) : t === "object" && n === "data" ? Ie(e, r) : r);
382
382
  }
383
- function Ie(e, t, n) {
383
+ function Be(e, t, n) {
384
384
  return ["video", "audio"].includes(e) && t === "autoplay";
385
385
  }
386
- function Le(e, t, n) {
386
+ function Ve(e, t, n) {
387
387
  try {
388
388
  if (typeof t == "string") {
389
389
  if (e.classList.contains(t)) return !0;
@@ -395,27 +395,27 @@ function Le(e, t, n) {
395
395
  } catch {}
396
396
  return !1;
397
397
  }
398
- function Re(e, t, n) {
398
+ function He(e, t, n) {
399
399
  if (!e) return !1;
400
- if (e.nodeType !== e.ELEMENT_NODE) return n ? Re(N.parentNode(e), t, n) : !1;
400
+ if (e.nodeType !== e.ELEMENT_NODE) return n ? He(j.parentNode(e), t, n) : !1;
401
401
  for (let n = e.classList.length; n--;) {
402
402
  let r = e.classList[n];
403
403
  if (t.test(r)) return !0;
404
404
  }
405
- return n ? Re(N.parentNode(e), t, n) : !1;
405
+ return n ? He(j.parentNode(e), t, n) : !1;
406
406
  }
407
- function ze(e, t, n, r) {
407
+ function Ue(e, t, n, r) {
408
408
  let i;
409
- if (P(e)) {
410
- if (i = e, !N.childNodes(i).length) return !1;
411
- } else if (N.parentElement(e) === null) return !1;
412
- else i = N.parentElement(e);
409
+ if (ie(e)) {
410
+ if (i = e, !j.childNodes(i).length) return !1;
411
+ } else if (j.parentElement(e) === null) return !1;
412
+ else i = j.parentElement(e);
413
413
  try {
414
414
  if (typeof t == "string") {
415
415
  if (r) {
416
416
  if (i.closest(`.${t}`)) return !0;
417
417
  } else if (i.classList.contains(t)) return !0;
418
- } else if (Re(i, t, r)) return !0;
418
+ } else if (He(i, t, r)) return !0;
419
419
  if (n) {
420
420
  if (r) {
421
421
  if (i.closest(n)) return !0;
@@ -424,45 +424,49 @@ function ze(e, t, n, r) {
424
424
  } catch {}
425
425
  return !1;
426
426
  }
427
- function Be(e, t, n) {
428
- let r = e.contentWindow;
429
- if (!r) return;
430
- let i = !1, a;
427
+ function We(e, t, n) {
428
+ let r = t;
429
+ t = U(() => H || r());
430
+ let i = e.contentWindow;
431
+ if (!i) return;
432
+ let a = !1, o;
431
433
  try {
432
- a = r.document.readyState;
434
+ o = i.document.readyState;
433
435
  } catch {
434
436
  return;
435
437
  }
436
- if (a !== "complete") {
438
+ if (o !== "complete") {
437
439
  let r = setTimeout(() => {
438
- i ||= (t(), !0);
440
+ a ||= (t(), !0);
439
441
  }, n);
440
442
  e.addEventListener("load", () => {
441
- clearTimeout(r), i = !0, t();
443
+ clearTimeout(r), a = !0, t();
442
444
  });
443
445
  return;
444
446
  }
445
- let o = "about:blank";
446
- if (r.location.href !== o || e.src === o || e.src === "") return setTimeout(t, 0), e.addEventListener("load", t);
447
+ let s = "about:blank";
448
+ if (i.location.href !== s || e.src === s || e.src === "") return setTimeout(t, 0), e.addEventListener("load", t);
447
449
  e.addEventListener("load", t);
448
450
  }
449
- function Ve(e, t, n) {
450
- let r = !1, i;
451
+ function Ge(e, t, n) {
452
+ let r = t;
453
+ t = U(() => H || r());
454
+ let i = !1, a;
451
455
  try {
452
- i = e.sheet;
456
+ a = e.sheet;
453
457
  } catch {
454
458
  return;
455
459
  }
456
- if (i) return;
457
- let a = setTimeout(() => {
458
- r ||= (t(), !0);
460
+ if (a) return;
461
+ let o = setTimeout(() => {
462
+ i ||= (t(), !0);
459
463
  }, n);
460
464
  e.addEventListener("load", () => {
461
- clearTimeout(a), r = !0, t();
465
+ clearTimeout(o), i = !0, t();
462
466
  });
463
467
  }
464
- function He(e, t) {
465
- let { doc: n, mirror: r, blockClass: i, blockSelector: a, needsMask: o, inlineStylesheet: s, maskInputOptions: c = {}, maskTextFn: u, maskInputFn: d, dataURLOptions: f = {}, inlineImages: p, recordCanvas: m, keepIframeSrcFn: h, newlyAddedElement: g = !1, cssCaptured: _ = !1 } = t, v = Ue(n, r);
468
+ function Ke(e, t) {
469
+ let { doc: n, mirror: r, blockClass: i, blockSelector: a, needsMask: o, inlineStylesheet: s, maskInputOptions: c = {}, maskTextFn: u, maskInputFn: d, dataURLOptions: f = {}, inlineImages: p, recordCanvas: m, keepIframeSrcFn: h, newlyAddedElement: g = !1, cssCaptured: _ = !1 } = t, v = qe(n, r);
466
470
  switch (e.nodeType) {
467
471
  case e.DOCUMENT_NODE: return e.compatMode === "CSS1Compat" ? {
468
472
  type: l.Document,
@@ -479,7 +483,7 @@ function He(e, t) {
479
483
  systemId: e.systemId,
480
484
  rootId: v
481
485
  };
482
- case e.ELEMENT_NODE: return Ge(e, {
486
+ case e.ELEMENT_NODE: return Ye(e, {
483
487
  doc: n,
484
488
  blockClass: i,
485
489
  blockSelector: a,
@@ -493,7 +497,7 @@ function He(e, t) {
493
497
  newlyAddedElement: g,
494
498
  rootId: v
495
499
  });
496
- case e.TEXT_NODE: return We(e, {
500
+ case e.TEXT_NODE: return Je(e, {
497
501
  doc: n,
498
502
  needsMask: o,
499
503
  maskTextFn: u,
@@ -507,38 +511,38 @@ function He(e, t) {
507
511
  };
508
512
  case e.COMMENT_NODE: return {
509
513
  type: l.Comment,
510
- textContent: N.textContent(e) || "",
514
+ textContent: j.textContent(e) || "",
511
515
  rootId: v
512
516
  };
513
517
  default: return !1;
514
518
  }
515
519
  }
516
- function Ue(e, t) {
520
+ function qe(e, t) {
517
521
  if (!t.hasNode(e)) return;
518
522
  let n = t.getId(e);
519
523
  return n === 1 ? void 0 : n;
520
524
  }
521
- function We(e, t) {
522
- let { needsMask: n, maskTextFn: r, rootId: i, cssCaptured: a } = t, o = N.parentNode(e), s = o && o.tagName, c = "", u = s === "STYLE" || void 0, d = s === "SCRIPT" || void 0;
523
- return d ? c = "SCRIPT_PLACEHOLDER" : a || (c = N.textContent(e), u && c && (c = ve(c, Pe(t.doc)))), !u && !d && c && n && (c = r ? r(c, N.parentElement(e)) : c.replace(/[\S]/g, "*")), {
525
+ function Je(e, t) {
526
+ let { needsMask: n, maskTextFn: r, rootId: i, cssCaptured: a } = t, o = j.parentNode(e), s = o && o.tagName, c = "", u = s === "STYLE" || void 0, d = s === "SCRIPT" || void 0;
527
+ return d ? c = "SCRIPT_PLACEHOLDER" : a || (c = j.textContent(e), u && c && (c = xe(c, Re(t.doc)))), !u && !d && c && n && (c = r ? r(c, j.parentElement(e)) : c.replace(/[\S]/g, "*")), {
524
528
  type: l.Text,
525
529
  textContent: c || "",
526
530
  rootId: i
527
531
  };
528
532
  }
529
- function Ge(e, t) {
530
- let { doc: n, blockClass: r, blockSelector: i, inlineStylesheet: a, maskInputOptions: o = {}, maskInputFn: s, dataURLOptions: c = {}, inlineImages: u, recordCanvas: d, keepIframeSrcFn: f, newlyAddedElement: p = !1, rootId: m } = t, h = Le(e, r, i), g = Ee(e), _ = {}, v = e.attributes.length;
533
+ function Ye(e, t) {
534
+ let { doc: n, blockClass: r, blockSelector: i, inlineStylesheet: a, maskInputOptions: o = {}, maskInputFn: s, dataURLOptions: c = {}, inlineImages: u, recordCanvas: d, keepIframeSrcFn: f, newlyAddedElement: p = !1, rootId: m } = t, h = Ve(e, r, i), g = ke(e), _ = {}, v = e.attributes.length;
531
535
  for (let t = 0; t < v; t++) {
532
536
  let r = e.attributes[t];
533
- Ie(g, r.name, r.value) || (_[r.name] = Fe(n, g, B(r.name), r.value));
537
+ Be(g, r.name, r.value) || (_[r.name] = ze(n, g, L(r.name), r.value));
534
538
  }
535
539
  if (g === "link" && a) {
536
540
  let t = Array.from(n.styleSheets).find((t) => t.href === e.href), r = null;
537
- t && (r = ie(t)), r && (delete _.rel, delete _.href, _._cssText = r);
541
+ t && (r = se(t)), r && (delete _.rel, delete _.href, _._cssText = r);
538
542
  }
539
543
  if (g === "style" && e.sheet) {
540
- let t = ie(e.sheet);
541
- t && (e.childNodes.length > 1 && (t = xe(t, e)), _._cssText = t);
544
+ let t = se(e.sheet);
545
+ t && (e.childNodes.length > 1 && (t = we(t, e)), _._cssText = t);
542
546
  }
543
547
  if ([
544
548
  "input",
@@ -546,9 +550,9 @@ function Ge(e, t) {
546
550
  "select"
547
551
  ].includes(g)) {
548
552
  let t = e.value, n = e.checked;
549
- _.type !== "radio" && _.type !== "checkbox" && _.type !== "submit" && _.type !== "button" && t ? _.value = z({
553
+ _.type !== "radio" && _.type !== "checkbox" && _.type !== "submit" && _.type !== "button" && t ? _.value = I({
550
554
  element: e,
551
- type: de(e),
555
+ type: me(e),
552
556
  tagName: g,
553
557
  value: t,
554
558
  maskInputOptions: o,
@@ -556,18 +560,18 @@ function Ge(e, t) {
556
560
  }) : n && (_.checked = n);
557
561
  }
558
562
  if (g === "option" && (e.selected && !o.select ? _.selected = !0 : delete _.selected), g === "dialog" && e.open && (_.rr_open_mode = e.matches("dialog:modal") ? "modal" : "non-modal"), g === "canvas" && d) {
559
- if (e.__context === "2d") ue(e) || (_.rr_dataURL = e.toDataURL(c.type, c.quality));
563
+ if (e.__context === "2d") pe(e) || (_.rr_dataURL = e.toDataURL(c.type, c.quality));
560
564
  else if (!("__context" in e)) {
561
565
  let t = e.toDataURL(c.type, c.quality), r = n.createElement("canvas");
562
566
  r.width = e.width, r.height = e.height, t !== r.toDataURL(c.type, c.quality) && (_.rr_dataURL = t);
563
567
  }
564
568
  }
565
569
  if (g === "img" && u) {
566
- V || (V = n.createElement("canvas"), De = V.getContext("2d"));
570
+ Ae || (Ae = n.createElement("canvas"), je = Ae.getContext("2d"));
567
571
  let t = e, r = t.currentSrc || t.getAttribute("src") || "<unknown-src>", i = t.crossOrigin, a = () => {
568
572
  t.removeEventListener("load", a);
569
573
  try {
570
- V.width = t.naturalWidth, V.height = t.naturalHeight, De.drawImage(t, 0, 0), _.rr_dataURL = V.toDataURL(c.type, c.quality);
574
+ Ae.width = t.naturalWidth, Ae.height = t.naturalHeight, je.drawImage(t, 0, 0), _.rr_dataURL = Ae.toDataURL(c.type, c.quality);
571
575
  } catch (e) {
572
576
  if (t.crossOrigin !== "anonymous") {
573
577
  t.crossOrigin = "anonymous", t.complete && t.naturalWidth !== 0 ? a() : t.addEventListener("load", a);
@@ -600,16 +604,16 @@ function Ge(e, t) {
600
604
  tagName: g,
601
605
  attributes: _,
602
606
  childNodes: [],
603
- isSVG: Ne(e) || void 0,
607
+ isSVG: Le(e) || void 0,
604
608
  needBlock: h,
605
609
  rootId: m,
606
610
  isCustom: y
607
611
  };
608
612
  }
609
- function H(e) {
613
+ function R(e) {
610
614
  return e == null ? "" : e.toLowerCase();
611
615
  }
612
- function Ke(e) {
616
+ function Xe(e) {
613
617
  return e === !0 || e === "all" ? {
614
618
  script: !0,
615
619
  comment: !0,
@@ -624,13 +628,13 @@ function Ke(e) {
624
628
  headTitleMutations: e === "all"
625
629
  } : e || {};
626
630
  }
627
- function qe(e, t) {
628
- return !!(t.comment && e.type === l.Comment || e.type === l.Element && (t.script && (e.tagName === "script" || e.tagName === "link" && (e.attributes.rel === "preload" && e.attributes.as === "script" || e.attributes.rel === "modulepreload") || e.tagName === "link" && e.attributes.rel === "prefetch" && typeof e.attributes.href == "string" && fe(e.attributes.href) === "js") || t.headFavicon && (e.tagName === "link" && e.attributes.rel === "shortcut icon" || e.tagName === "meta" && (H(e.attributes.name).match(/^msapplication-tile(image|color)$/) || H(e.attributes.name) === "application-name" || H(e.attributes.rel) === "icon" || H(e.attributes.rel) === "apple-touch-icon" || H(e.attributes.rel) === "shortcut icon")) || e.tagName === "meta" && (t.headMetaDescKeywords && H(e.attributes.name).match(/^description|keywords$/) || t.headMetaSocial && (H(e.attributes.property).match(/^(og|twitter|fb):/) || H(e.attributes.name).match(/^(og|twitter):/) || H(e.attributes.name) === "pinterest") || t.headMetaRobots && (H(e.attributes.name) === "robots" || H(e.attributes.name) === "googlebot" || H(e.attributes.name) === "bingbot") || t.headMetaHttpEquiv && e.attributes["http-equiv"] !== void 0 || t.headMetaAuthorship && (H(e.attributes.name) === "author" || H(e.attributes.name) === "generator" || H(e.attributes.name) === "framework" || H(e.attributes.name) === "publisher" || H(e.attributes.name) === "progid" || H(e.attributes.property).match(/^article:/) || H(e.attributes.property).match(/^product:/)) || t.headMetaVerification && (H(e.attributes.name) === "google-site-verification" || H(e.attributes.name) === "yandex-verification" || H(e.attributes.name) === "csrf-token" || H(e.attributes.name) === "p:domain_verify" || H(e.attributes.name) === "verify-v1" || H(e.attributes.name) === "verification" || H(e.attributes.name) === "shopify-checkout-api-token"))));
631
+ function Ze(e, t) {
632
+ return !!(t.comment && e.type === l.Comment || e.type === l.Element && (t.script && (e.tagName === "script" || e.tagName === "link" && (e.attributes.rel === "preload" && e.attributes.as === "script" || e.attributes.rel === "modulepreload") || e.tagName === "link" && e.attributes.rel === "prefetch" && typeof e.attributes.href == "string" && he(e.attributes.href) === "js") || t.headFavicon && (e.tagName === "link" && e.attributes.rel === "shortcut icon" || e.tagName === "meta" && (R(e.attributes.name).match(/^msapplication-tile(image|color)$/) || R(e.attributes.name) === "application-name" || R(e.attributes.rel) === "icon" || R(e.attributes.rel) === "apple-touch-icon" || R(e.attributes.rel) === "shortcut icon")) || e.tagName === "meta" && (t.headMetaDescKeywords && R(e.attributes.name).match(/^description|keywords$/) || t.headMetaSocial && (R(e.attributes.property).match(/^(og|twitter|fb):/) || R(e.attributes.name).match(/^(og|twitter):/) || R(e.attributes.name) === "pinterest") || t.headMetaRobots && (R(e.attributes.name) === "robots" || R(e.attributes.name) === "googlebot" || R(e.attributes.name) === "bingbot") || t.headMetaHttpEquiv && e.attributes["http-equiv"] !== void 0 || t.headMetaAuthorship && (R(e.attributes.name) === "author" || R(e.attributes.name) === "generator" || R(e.attributes.name) === "framework" || R(e.attributes.name) === "publisher" || R(e.attributes.name) === "progid" || R(e.attributes.property).match(/^article:/) || R(e.attributes.property).match(/^product:/)) || t.headMetaVerification && (R(e.attributes.name) === "google-site-verification" || R(e.attributes.name) === "yandex-verification" || R(e.attributes.name) === "csrf-token" || R(e.attributes.name) === "p:domain_verify" || R(e.attributes.name) === "verify-v1" || R(e.attributes.name) === "verification" || R(e.attributes.name) === "shopify-checkout-api-token"))));
629
633
  }
630
- function U(e, t) {
634
+ function Qe(e, t) {
631
635
  let { doc: n, mirror: r, blockClass: i, blockSelector: a, maskTextClass: o, maskTextSelector: s, skipChild: c = !1, inlineStylesheet: u = !0, maskInputOptions: d = {}, maskTextFn: f, maskInputFn: p, slimDOMOptions: m, dataURLOptions: h = {}, inlineImages: g = !1, recordCanvas: _ = !1, onSerialize: v, onIframeLoad: y, iframeLoadTimeout: b = 5e3, onStylesheetLoad: x, stylesheetLoadTimeout: S = 5e3, keepIframeSrcFn: C = () => !1, newlyAddedElement: w = !1, cssCaptured: ee = !1 } = t, { needsMask: T } = t, { preserveWhiteSpace: E = !0 } = t;
632
- T ||= ze(e, o, s, T === void 0);
633
- let D = He(e, {
636
+ T ||= Ue(e, o, s, T === void 0);
637
+ let D = Ke(e, {
634
638
  doc: n,
635
639
  mirror: r,
636
640
  blockClass: i,
@@ -649,17 +653,17 @@ function U(e, t) {
649
653
  });
650
654
  if (!D) return console.warn(e, "not serialized"), null;
651
655
  let O;
652
- O = r.hasNode(e) ? r.getId(e) : qe(D, m) || !E && D.type === l.Text && !D.textContent.replace(/^\s+|\s+$/gm, "").length ? we : Te();
656
+ O = r.hasNode(e) ? r.getId(e) : Ze(D, m) || !E && D.type === l.Text && !D.textContent.replace(/^\s+|\s+$/gm, "").length ? De : Oe();
653
657
  let k = Object.assign(D, { id: O });
654
- if (r.add(e, k), O === we) return null;
658
+ if (r.add(e, k), O === De) return null;
655
659
  v && v(e);
656
- let A = !c;
660
+ let te = !c;
657
661
  if (k.type === l.Element) {
658
- A &&= !k.needBlock, delete k.needBlock;
659
- let t = N.shadowRoot(e);
660
- t && I(t) && (k.isShadowHost = !0);
662
+ te &&= !k.needBlock, delete k.needBlock;
663
+ let t = j.shadowRoot(e);
664
+ t && N(t) && (k.isShadowHost = !0);
661
665
  }
662
- if ((k.type === l.Document || k.type === l.Element) && A) {
666
+ if ((k.type === l.Document || k.type === l.Element) && te) {
663
667
  m.headWhitespace && k.type === l.Element && k.tagName === "head" && (E = !1);
664
668
  let t = {
665
669
  doc: n,
@@ -689,22 +693,22 @@ function U(e, t) {
689
693
  };
690
694
  if (k.type !== l.Element || k.tagName !== "textarea" || k.attributes.value === void 0) {
691
695
  k.type === l.Element && k.attributes._cssText !== void 0 && typeof k.attributes._cssText == "string" && (t.cssCaptured = !0);
692
- for (let n of Array.from(N.childNodes(e))) {
693
- let e = U(n, t);
696
+ for (let n of Array.from(j.childNodes(e))) {
697
+ let e = Qe(n, t);
694
698
  e && k.childNodes.push(e);
695
699
  }
696
700
  }
697
701
  let w = null;
698
- if (P(e) && (w = N.shadowRoot(e))) for (let e of Array.from(N.childNodes(w))) {
699
- let n = U(e, t);
700
- n && (I(w) && (n.isShadow = !0), k.childNodes.push(n));
702
+ if (ie(e) && (w = j.shadowRoot(e))) for (let e of Array.from(j.childNodes(w))) {
703
+ let n = Qe(e, t);
704
+ n && (N(w) && (n.isShadow = !0), k.childNodes.push(n));
701
705
  }
702
706
  }
703
- let j = N.parentNode(e);
704
- return j && F(j) && I(j) && (k.isShadow = !0), k.type === l.Element && k.tagName === "iframe" && Be(e, () => {
707
+ let ne = j.parentNode(e);
708
+ return ne && M(ne) && N(ne) && (k.isShadow = !0), k.type === l.Element && k.tagName === "iframe" && We(e, () => {
705
709
  let t = e.contentDocument;
706
710
  if (t && y) {
707
- let n = U(t, {
711
+ let n = Qe(t, {
708
712
  doc: t,
709
713
  mirror: r,
710
714
  blockClass: i,
@@ -731,9 +735,9 @@ function U(e, t) {
731
735
  });
732
736
  n && y(e, n);
733
737
  }
734
- }, b), k.type === l.Element && k.tagName === "link" && typeof k.attributes.rel == "string" && (k.attributes.rel === "stylesheet" || k.attributes.rel === "preload" && typeof k.attributes.href == "string" && fe(k.attributes.href) === "css") && Ve(e, () => {
738
+ }, b), k.type === l.Element && k.tagName === "link" && typeof k.attributes.rel == "string" && (k.attributes.rel === "stylesheet" || k.attributes.rel === "preload" && typeof k.attributes.href == "string" && he(k.attributes.href) === "css") && Ge(e, () => {
735
739
  if (x) {
736
- let t = U(e, {
740
+ let t = Qe(e, {
737
741
  doc: n,
738
742
  mirror: r,
739
743
  blockClass: i,
@@ -762,9 +766,9 @@ function U(e, t) {
762
766
  }
763
767
  }, S), k;
764
768
  }
765
- function Je(e, t) {
766
- let { mirror: n = new L(), blockClass: r = "rr-block", blockSelector: i = null, maskTextClass: a = "rr-mask", maskTextSelector: o = null, inlineStylesheet: s = !0, inlineImages: c = !1, recordCanvas: l = !1, maskAllInputs: u = !1, maskTextFn: d, maskInputFn: f, slimDOM: p = !1, dataURLOptions: m, preserveWhiteSpace: h, onSerialize: g, onIframeLoad: _, iframeLoadTimeout: v, onStylesheetLoad: y, stylesheetLoadTimeout: b, keepIframeSrcFn: x = () => !1 } = t;
767
- return U(e, {
769
+ function $e(e, t) {
770
+ let { mirror: n = new P(), blockClass: r = "rr-block", blockSelector: i = null, maskTextClass: a = "rr-mask", maskTextSelector: o = null, inlineStylesheet: s = !0, inlineImages: c = !1, recordCanvas: l = !1, maskAllInputs: u = !1, maskTextFn: d, maskInputFn: f, slimDOM: p = !1, dataURLOptions: m, preserveWhiteSpace: h, onSerialize: g, onIframeLoad: _, iframeLoadTimeout: v, onStylesheetLoad: y, stylesheetLoadTimeout: b, keepIframeSrcFn: x = () => !1 } = t;
771
+ return Qe(e, {
768
772
  doc: e,
769
773
  mirror: n,
770
774
  blockClass: r,
@@ -793,7 +797,7 @@ function Je(e, t) {
793
797
  } : u === !1 ? { password: !0 } : u,
794
798
  maskTextFn: d,
795
799
  maskInputFn: f,
796
- slimDOMOptions: Ke(p),
800
+ slimDOMOptions: Xe(p),
797
801
  dataURLOptions: m,
798
802
  inlineImages: c,
799
803
  recordCanvas: l,
@@ -807,7 +811,7 @@ function Je(e, t) {
807
811
  newlyAddedElement: !1
808
812
  });
809
813
  }
810
- var Ye = class e {
814
+ var et = class e {
811
815
  constructor(...e) {
812
816
  n(this, "parentElement", null), n(this, "parentNode", null), n(this, "ownerDocument"), n(this, "firstChild", null), n(this, "lastChild", null), n(this, "previousSibling", null), n(this, "nextSibling", null), n(this, "ELEMENT_NODE", 1), n(this, "TEXT_NODE", 3), n(this, "nodeType"), n(this, "nodeName"), n(this, "RRNodeType");
813
817
  }
@@ -838,109 +842,109 @@ var Ye = class e {
838
842
  return "RRNode";
839
843
  }
840
844
  };
841
- function W(e, t, n = document) {
845
+ function z(e, t, n = document) {
842
846
  let r = {
843
847
  capture: !0,
844
848
  passive: !0
845
849
  };
846
850
  return n.addEventListener(e, t, r), () => n.removeEventListener(e, t, r);
847
851
  }
848
- var G = "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.", Xe = {
852
+ var tt = "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.", nt = {
849
853
  map: {},
850
854
  getId() {
851
- return console.error(G), -1;
855
+ return console.error(tt), -1;
852
856
  },
853
857
  getNode() {
854
- return console.error(G), null;
858
+ return console.error(tt), null;
855
859
  },
856
860
  removeNodeFromMap() {
857
- console.error(G);
861
+ console.error(tt);
858
862
  },
859
863
  has() {
860
- return console.error(G), !1;
864
+ return console.error(tt), !1;
861
865
  },
862
866
  reset() {
863
- console.error(G);
867
+ console.error(tt);
864
868
  }
865
869
  };
866
- typeof window < "u" && window.Proxy && window.Reflect && (Xe = new Proxy(Xe, { get(e, t, n) {
867
- return t === "map" && console.error(G), Reflect.get(e, t, n);
870
+ typeof window < "u" && window.Proxy && window.Reflect && (nt = new Proxy(nt, { get(e, t, n) {
871
+ return t === "map" && console.error(tt), Reflect.get(e, t, n);
868
872
  } }));
869
- function Ze(e, t, n = {}) {
873
+ function rt(e, t, n = {}) {
870
874
  let r = null, i = 0;
871
875
  return function(...a) {
872
876
  let o = Date.now();
873
877
  !i && n.leading === !1 && (i = o);
874
878
  let s = t - (o - i), c = this;
875
879
  s <= 0 || s > t ? (r &&= (clearTimeout(r), null), i = o, e.apply(c, a)) : !r && n.trailing !== !1 && (r = setTimeout(() => {
876
- i = n.leading === !1 ? 0 : Date.now(), r = null, e.apply(c, a);
880
+ i = n.leading === !1 ? 0 : Date.now(), r = null, H || e.apply(c, a);
877
881
  }, s));
878
882
  };
879
883
  }
880
- function Qe(e, t, n, r, i = window) {
884
+ function it(e, t, n, r, i = window) {
881
885
  let a = i.Object.getOwnPropertyDescriptor(e, t);
882
886
  return i.Object.defineProperty(e, t, r ? n : { set(e) {
883
- setTimeout(() => {
884
- n.set.call(this, e);
887
+ H || setTimeout(() => {
888
+ H || n.set.call(this, e);
885
889
  }, 0), a && a.set && a.set.call(this, e);
886
- } }), () => Qe(e, t, a || {}, !0);
890
+ } }), () => H || it(e, t, a || {}, !0);
887
891
  }
888
- function $e(e) {
892
+ function at(e) {
889
893
  let t = e.document;
890
894
  return {
891
- left: t.scrollingElement ? t.scrollingElement.scrollLeft : e.pageXOffset === void 0 ? t.documentElement.scrollLeft || t?.body && N.parentElement(t.body)?.scrollLeft || t?.body?.scrollLeft || 0 : e.pageXOffset,
892
- top: t.scrollingElement ? t.scrollingElement.scrollTop : e.pageYOffset === void 0 ? t?.documentElement.scrollTop || t?.body && N.parentElement(t.body)?.scrollTop || t?.body?.scrollTop || 0 : e.pageYOffset
895
+ left: t.scrollingElement ? t.scrollingElement.scrollLeft : e.pageXOffset === void 0 ? t.documentElement.scrollLeft || t?.body && j.parentElement(t.body)?.scrollLeft || t?.body?.scrollLeft || 0 : e.pageXOffset,
896
+ top: t.scrollingElement ? t.scrollingElement.scrollTop : e.pageYOffset === void 0 ? t?.documentElement.scrollTop || t?.body && j.parentElement(t.body)?.scrollTop || t?.body?.scrollTop || 0 : e.pageYOffset
893
897
  };
894
898
  }
895
- function et() {
899
+ function ot() {
896
900
  return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;
897
901
  }
898
- function tt() {
902
+ function st() {
899
903
  return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;
900
904
  }
901
- function nt(e) {
902
- return e ? e.nodeType === e.ELEMENT_NODE ? e : N.parentElement(e) : null;
905
+ function ct(e) {
906
+ return e ? e.nodeType === e.ELEMENT_NODE ? e : j.parentElement(e) : null;
903
907
  }
904
- function K(e, t, n, r) {
908
+ function B(e, t, n, r) {
905
909
  if (!e) return !1;
906
- let i = nt(e);
910
+ let i = ct(e);
907
911
  if (!i) return !1;
908
912
  try {
909
913
  if (typeof t == "string") {
910
914
  if (i.classList.contains(t) || r && i.closest("." + t) !== null) return !0;
911
- } else if (Re(i, t, r)) return !0;
915
+ } else if (He(i, t, r)) return !0;
912
916
  } catch {}
913
917
  return !!(n && (i.matches(n) || r && i.closest(n) !== null));
914
918
  }
915
- function rt(e, t) {
919
+ function lt(e, t) {
916
920
  return t.getId(e) !== -1;
917
921
  }
918
- function it(e, t, n) {
919
- return e.tagName === "TITLE" && n.headTitleMutations ? !0 : t.getId(e) === we;
922
+ function ut(e, t, n) {
923
+ return e.tagName === "TITLE" && n.headTitleMutations ? !0 : t.getId(e) === De;
920
924
  }
921
- function at(e, t) {
922
- if (F(e)) return !1;
925
+ function dt(e, t) {
926
+ if (M(e)) return !1;
923
927
  let n = t.getId(e);
924
928
  if (!t.has(n)) return !0;
925
- let r = N.parentNode(e);
926
- return r && r.nodeType === e.DOCUMENT_NODE ? !1 : !r || at(r, t);
929
+ let r = j.parentNode(e);
930
+ return r && r.nodeType === e.DOCUMENT_NODE ? !1 : !r || dt(r, t);
927
931
  }
928
- function ot(e) {
932
+ function ft(e) {
929
933
  return !!e.changedTouches;
930
934
  }
931
- function st(e = window) {
935
+ function pt(e = window) {
932
936
  "NodeList" in e && !e.NodeList.prototype.forEach && (e.NodeList.prototype.forEach = Array.prototype.forEach), "DOMTokenList" in e && !e.DOMTokenList.prototype.forEach && (e.DOMTokenList.prototype.forEach = Array.prototype.forEach);
933
937
  }
934
- function ct(e, t) {
938
+ function mt(e, t) {
935
939
  return !!(e.nodeName === "IFRAME" && t.getMeta(e));
936
940
  }
937
- function lt(e, t) {
941
+ function ht(e, t) {
938
942
  return !!(e.nodeName === "LINK" && e.nodeType === e.ELEMENT_NODE && e.getAttribute && e.getAttribute("rel") === "stylesheet" && t.getMeta(e));
939
943
  }
940
- function ut(e) {
941
- return e ? e instanceof Ye && "shadowRoot" in e ? !!e.shadowRoot : !!N.shadowRoot(e) : !1;
944
+ function gt(e) {
945
+ return e ? e instanceof et && "shadowRoot" in e ? !!e.shadowRoot : !!j.shadowRoot(e) : !1;
942
946
  }
943
- var dt = class {
947
+ var _t = class {
944
948
  constructor() {
945
949
  n(this, "id", 1), n(this, "styleIDMap", /* @__PURE__ */ new WeakMap()), n(this, "idStyleMap", /* @__PURE__ */ new Map());
946
950
  }
@@ -965,29 +969,29 @@ var dt = class {
965
969
  return this.id++;
966
970
  }
967
971
  };
968
- function ft(e) {
972
+ function vt(e) {
969
973
  let t = null;
970
- return "getRootNode" in e && N.getRootNode(e)?.nodeType === Node.DOCUMENT_FRAGMENT_NODE && N.host(N.getRootNode(e)) && (t = N.host(N.getRootNode(e))), t;
974
+ return "getRootNode" in e && j.getRootNode(e)?.nodeType === Node.DOCUMENT_FRAGMENT_NODE && j.host(j.getRootNode(e)) && (t = j.host(j.getRootNode(e))), t;
971
975
  }
972
- function pt(e) {
976
+ function yt(e) {
973
977
  let t = e, n;
974
- for (; n = ft(t);) t = n;
978
+ for (; n = vt(t);) t = n;
975
979
  return t;
976
980
  }
977
- function mt(e) {
978
- let t = N.ownerDocument(e);
981
+ function bt(e) {
982
+ let t = j.ownerDocument(e);
979
983
  if (!t) return !1;
980
- let n = pt(e);
981
- return N.contains(t, n);
984
+ let n = yt(e);
985
+ return j.contains(t, n);
982
986
  }
983
- function ht(e) {
984
- let t = N.ownerDocument(e);
985
- return t ? N.contains(t, e) || mt(e) : !1;
987
+ function xt(e) {
988
+ let t = j.ownerDocument(e);
989
+ return t ? j.contains(t, e) || bt(e) : !1;
986
990
  }
987
- function gt(e) {
991
+ function St(e) {
988
992
  return "__ln" in e;
989
993
  }
990
- var _t = class {
994
+ var Ct = class {
991
995
  constructor() {
992
996
  n(this, "length", 0), n(this, "head", null), n(this, "tail", null);
993
997
  }
@@ -1003,10 +1007,10 @@ var _t = class {
1003
1007
  previous: null,
1004
1008
  next: null
1005
1009
  };
1006
- if (e.__ln = t, e.previousSibling && gt(e.previousSibling)) {
1010
+ if (e.__ln = t, e.previousSibling && St(e.previousSibling)) {
1007
1011
  let n = e.previousSibling.__ln.next;
1008
1012
  t.next = n, t.previous = e.previousSibling.__ln, e.previousSibling.__ln.next = t, n && (n.previous = t);
1009
- } else if (e.nextSibling && gt(e.nextSibling) && e.nextSibling.__ln.previous) {
1013
+ } else if (e.nextSibling && St(e.nextSibling) && e.nextSibling.__ln.previous) {
1010
1014
  let n = e.nextSibling.__ln.previous;
1011
1015
  t.previous = n, t.next = e.nextSibling.__ln, e.nextSibling.__ln.previous = t, n && (n.next = t);
1012
1016
  } else this.head && (this.head.previous = t), t.next = this.head, this.head = t;
@@ -1016,28 +1020,28 @@ var _t = class {
1016
1020
  let t = e.__ln;
1017
1021
  this.head && (t.previous ? (t.previous.next = t.next, t.next ? t.next.previous = t.previous : this.tail = t.previous) : (this.head = t.next, this.head ? this.head.previous = null : this.tail = null), e.__ln && delete e.__ln, this.length--);
1018
1022
  }
1019
- }, vt = (e, t) => `${e}@${t}`, yt = class {
1023
+ }, wt = (e, t) => `${e}@${t}`, Tt = class {
1020
1024
  constructor() {
1021
1025
  n(this, "frozen", !1), n(this, "locked", !1), n(this, "texts", []), n(this, "attributes", []), n(this, "attributeMap", /* @__PURE__ */ new WeakMap()), n(this, "removes", []), n(this, "mapRemoves", []), n(this, "movedMap", {}), n(this, "addedSet", /* @__PURE__ */ new Set()), n(this, "movedSet", /* @__PURE__ */ new Set()), n(this, "droppedSet", /* @__PURE__ */ new Set()), n(this, "removesSubTreeCache", /* @__PURE__ */ new Set()), n(this, "mutationCb"), n(this, "blockClass"), n(this, "blockSelector"), n(this, "maskTextClass"), n(this, "maskTextSelector"), n(this, "inlineStylesheet"), n(this, "maskInputOptions"), n(this, "maskTextFn"), n(this, "maskInputFn"), n(this, "keepIframeSrcFn"), n(this, "recordCanvas"), n(this, "inlineImages"), n(this, "slimDOMOptions"), n(this, "dataURLOptions"), n(this, "doc"), n(this, "mirror"), n(this, "iframeManager"), n(this, "stylesheetManager"), n(this, "shadowDomManager"), n(this, "canvasManager"), n(this, "processedNodeManager"), n(this, "unattachedDoc"), n(this, "processMutations", (e) => {
1022
1026
  e.forEach(this.processMutation), this.emit();
1023
1027
  }), n(this, "emit", () => {
1024
1028
  if (this.frozen || this.locked) return;
1025
- let e = [], t = /* @__PURE__ */ new Set(), n = new _t(), r = (e) => {
1026
- let t = e, n = we;
1027
- for (; n === we;) t &&= t.nextSibling, n = t && this.mirror.getId(t);
1029
+ let e = [], t = /* @__PURE__ */ new Set(), n = new Ct(), r = (e) => {
1030
+ let t = e, n = De;
1031
+ for (; n === De;) t &&= t.nextSibling, n = t && this.mirror.getId(t);
1028
1032
  return n;
1029
1033
  }, i = (i) => {
1030
- let a = N.parentNode(i);
1031
- if (!a || !ht(i)) return;
1034
+ let a = j.parentNode(i);
1035
+ if (!a || !xt(i)) return;
1032
1036
  let o = !1;
1033
1037
  if (i.nodeType === Node.TEXT_NODE) {
1034
1038
  let e = a.tagName;
1035
1039
  if (e === "TEXTAREA") return;
1036
1040
  e === "STYLE" && this.addedSet.has(a) && (o = !0);
1037
1041
  }
1038
- let s = F(a) ? this.mirror.getId(ft(i)) : this.mirror.getId(a), c = r(i);
1042
+ let s = M(a) ? this.mirror.getId(vt(i)) : this.mirror.getId(a), c = r(i);
1039
1043
  if (s === -1 || c === -1) return n.addNode(i);
1040
- let l = U(i, {
1044
+ let l = Qe(i, {
1041
1045
  doc: this.doc,
1042
1046
  mirror: this.mirror,
1043
1047
  blockClass: this.blockClass,
@@ -1055,7 +1059,7 @@ var _t = class {
1055
1059
  recordCanvas: this.recordCanvas,
1056
1060
  inlineImages: this.inlineImages,
1057
1061
  onSerialize: (e) => {
1058
- ct(e, this.mirror) && this.iframeManager.addIframe(e), lt(e, this.mirror) && this.stylesheetManager.trackLinkElement(e), ut(i) && this.shadowDomManager.addShadowRoot(N.shadowRoot(i), this.doc);
1062
+ mt(e, this.mirror) && this.iframeManager.addIframe(e), ht(e, this.mirror) && this.stylesheetManager.trackLinkElement(e), gt(i) && this.shadowDomManager.addShadowRoot(j.shadowRoot(i), this.doc);
1059
1063
  },
1060
1064
  onIframeLoad: (e, t) => {
1061
1065
  this.iframeManager.attachIframe(e, t), this.shadowDomManager.observeAttachShadow(e);
@@ -1072,13 +1076,13 @@ var _t = class {
1072
1076
  }), t.add(l.id));
1073
1077
  };
1074
1078
  for (; this.mapRemoves.length;) this.mirror.removeNodeFromMap(this.mapRemoves.shift());
1075
- for (let e of this.movedSet) St(this.removesSubTreeCache, e, this.mirror) && !this.movedSet.has(N.parentNode(e)) || i(e);
1076
- for (let e of this.addedSet) !wt(this.droppedSet, e) && !St(this.removesSubTreeCache, e, this.mirror) || wt(this.movedSet, e) ? i(e) : this.droppedSet.add(e);
1079
+ for (let e of this.movedSet) Ot(this.removesSubTreeCache, e, this.mirror) && !this.movedSet.has(j.parentNode(e)) || i(e);
1080
+ for (let e of this.addedSet) !At(this.droppedSet, e) && !Ot(this.removesSubTreeCache, e, this.mirror) || At(this.movedSet, e) ? i(e) : this.droppedSet.add(e);
1077
1081
  let a = null;
1078
1082
  for (; n.length;) {
1079
1083
  let e = null;
1080
1084
  if (a) {
1081
- let t = this.mirror.getId(N.parentNode(a.value)), n = r(a.value);
1085
+ let t = this.mirror.getId(j.parentNode(a.value)), n = r(a.value);
1082
1086
  t !== -1 && n !== -1 && (e = a);
1083
1087
  }
1084
1088
  if (!e) {
@@ -1086,15 +1090,15 @@ var _t = class {
1086
1090
  for (; t;) {
1087
1091
  let n = t;
1088
1092
  if (t = t.previous, n) {
1089
- let t = this.mirror.getId(N.parentNode(n.value));
1093
+ let t = this.mirror.getId(j.parentNode(n.value));
1090
1094
  if (r(n.value) === -1) continue;
1091
1095
  if (t !== -1) {
1092
1096
  e = n;
1093
1097
  break;
1094
1098
  } else {
1095
- let t = n.value, r = N.parentNode(t);
1099
+ let t = n.value, r = j.parentNode(t);
1096
1100
  if (r && r.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1097
- let t = N.host(r);
1101
+ let t = j.host(r);
1098
1102
  if (this.mirror.getId(t) !== -1) {
1099
1103
  e = n;
1100
1104
  break;
@@ -1112,7 +1116,7 @@ var _t = class {
1112
1116
  }
1113
1117
  let o = {
1114
1118
  texts: this.texts.map((e) => {
1115
- let t = e.node, n = N.parentNode(t);
1119
+ let t = e.node, n = j.parentNode(t);
1116
1120
  return n && n.tagName === "TEXTAREA" && this.genTextAreaValueMutation(n), {
1117
1121
  id: this.mirror.getId(t),
1118
1122
  value: e.value
@@ -1141,21 +1145,21 @@ var _t = class {
1141
1145
  styleDiff: {},
1142
1146
  _unchangedStyles: {}
1143
1147
  }, this.attributes.push(t), this.attributeMap.set(e, t));
1144
- let n = Array.from(N.childNodes(e), (e) => N.textContent(e) || "").join("");
1145
- t.attributes.value = z({
1148
+ let n = Array.from(j.childNodes(e), (e) => j.textContent(e) || "").join("");
1149
+ t.attributes.value = I({
1146
1150
  element: e,
1147
1151
  maskInputOptions: this.maskInputOptions,
1148
1152
  tagName: e.tagName,
1149
- type: de(e),
1153
+ type: me(e),
1150
1154
  value: n,
1151
1155
  maskInputFn: this.maskInputFn
1152
1156
  });
1153
1157
  }), n(this, "processMutation", (e) => {
1154
- if (!it(e.target, this.mirror, this.slimDOMOptions)) switch (e.type) {
1158
+ if (!ut(e.target, this.mirror, this.slimDOMOptions)) switch (e.type) {
1155
1159
  case "characterData": {
1156
- let t = N.textContent(e.target);
1157
- !K(e.target, this.blockClass, this.blockSelector, !1) && t !== e.oldValue && this.texts.push({
1158
- value: ze(e.target, this.maskTextClass, this.maskTextSelector, !0) && t ? this.maskTextFn ? this.maskTextFn(t, nt(e.target)) : t.replace(/[\S]/g, "*") : t,
1160
+ let t = j.textContent(e.target);
1161
+ !B(e.target, this.blockClass, this.blockSelector, !1) && t !== e.oldValue && this.texts.push({
1162
+ value: Ue(e.target, this.maskTextClass, this.maskTextSelector, !0) && t ? this.maskTextFn ? this.maskTextFn(t, ct(e.target)) : t.replace(/[\S]/g, "*") : t,
1159
1163
  node: e.target
1160
1164
  });
1161
1165
  break;
@@ -1163,8 +1167,8 @@ var _t = class {
1163
1167
  case "attributes": {
1164
1168
  let t = e.target, n = e.attributeName, r = e.target.getAttribute(n);
1165
1169
  if (n === "value") {
1166
- let e = de(t);
1167
- r = z({
1170
+ let e = me(t);
1171
+ r = I({
1168
1172
  element: t,
1169
1173
  maskInputOptions: this.maskInputOptions,
1170
1174
  tagName: t.tagName,
@@ -1173,7 +1177,7 @@ var _t = class {
1173
1177
  maskInputFn: this.maskInputFn
1174
1178
  });
1175
1179
  }
1176
- if (K(e.target, this.blockClass, this.blockSelector, !1) || r === e.oldValue) return;
1180
+ if (B(e.target, this.blockClass, this.blockSelector, !1) || r === e.oldValue) return;
1177
1181
  let i = this.attributeMap.get(e.target);
1178
1182
  if (t.tagName === "IFRAME" && n === "src" && !this.keepIframeSrcFn(r)) if (!t.contentDocument) n = "rr_src";
1179
1183
  else return;
@@ -1182,7 +1186,7 @@ var _t = class {
1182
1186
  attributes: {},
1183
1187
  styleDiff: {},
1184
1188
  _unchangedStyles: {}
1185
- }, this.attributes.push(i), this.attributeMap.set(e.target, i)), n === "type" && t.tagName === "INPUT" && (e.oldValue || "").toLowerCase() === "password" && t.setAttribute("data-rr-is-password", "true"), !Ie(t.tagName, n)) if (i.attributes[n] = Fe(this.doc, B(t.tagName), B(n), r), n === "style") {
1189
+ }, this.attributes.push(i), this.attributeMap.set(e.target, i)), n === "type" && t.tagName === "INPUT" && (e.oldValue || "").toLowerCase() === "password" && t.setAttribute("data-rr-is-password", "true"), !Be(t.tagName, n)) if (i.attributes[n] = ze(this.doc, L(t.tagName), L(n), r), n === "style") {
1186
1190
  if (!this.unattachedDoc) try {
1187
1191
  this.unattachedDoc = document.implementation.createHTMLDocument();
1188
1192
  } catch {
@@ -1199,30 +1203,30 @@ var _t = class {
1199
1203
  break;
1200
1204
  }
1201
1205
  case "childList":
1202
- if (K(e.target, this.blockClass, this.blockSelector, !0)) return;
1206
+ if (B(e.target, this.blockClass, this.blockSelector, !0)) return;
1203
1207
  if (e.target.tagName === "TEXTAREA") {
1204
1208
  this.genTextAreaValueMutation(e.target);
1205
1209
  return;
1206
1210
  }
1207
1211
  e.addedNodes.forEach((t) => this.genAdds(t, e.target)), e.removedNodes.forEach((t) => {
1208
- let n = this.mirror.getId(t), r = F(e.target) ? this.mirror.getId(N.host(e.target)) : this.mirror.getId(e.target);
1209
- K(e.target, this.blockClass, this.blockSelector, !1) || it(t, this.mirror, this.slimDOMOptions) || !rt(t, this.mirror) || (this.addedSet.has(t) ? (bt(this.addedSet, t), this.droppedSet.add(t)) : this.addedSet.has(e.target) && n === -1 || at(e.target, this.mirror) || (this.movedSet.has(t) && this.movedMap[vt(n, r)] ? bt(this.movedSet, t) : (this.removes.push({
1212
+ let n = this.mirror.getId(t), r = M(e.target) ? this.mirror.getId(j.host(e.target)) : this.mirror.getId(e.target);
1213
+ B(e.target, this.blockClass, this.blockSelector, !1) || ut(t, this.mirror, this.slimDOMOptions) || !lt(t, this.mirror) || (this.addedSet.has(t) ? (Et(this.addedSet, t), this.droppedSet.add(t)) : this.addedSet.has(e.target) && n === -1 || dt(e.target, this.mirror) || (this.movedSet.has(t) && this.movedMap[wt(n, r)] ? Et(this.movedSet, t) : (this.removes.push({
1210
1214
  parentId: r,
1211
1215
  id: n,
1212
- isShadow: F(e.target) && I(e.target) ? !0 : void 0
1213
- }), xt(t, this.removesSubTreeCache))), this.mapRemoves.push(t));
1216
+ isShadow: M(e.target) && N(e.target) ? !0 : void 0
1217
+ }), Dt(t, this.removesSubTreeCache))), this.mapRemoves.push(t));
1214
1218
  });
1215
1219
  break;
1216
1220
  }
1217
1221
  }), n(this, "genAdds", (e, t) => {
1218
1222
  if (!this.processedNodeManager.inOtherBuffer(e, this) && !(this.addedSet.has(e) || this.movedSet.has(e))) {
1219
1223
  if (this.mirror.hasNode(e)) {
1220
- if (it(e, this.mirror, this.slimDOMOptions)) return;
1224
+ if (ut(e, this.mirror, this.slimDOMOptions)) return;
1221
1225
  this.movedSet.add(e);
1222
1226
  let n = null;
1223
- t && this.mirror.hasNode(t) && (n = this.mirror.getId(t)), n && n !== -1 && (this.movedMap[vt(this.mirror.getId(e), n)] = !0);
1227
+ t && this.mirror.hasNode(t) && (n = this.mirror.getId(t)), n && n !== -1 && (this.movedMap[wt(this.mirror.getId(e), n)] = !0);
1224
1228
  } else this.addedSet.add(e), this.droppedSet.delete(e);
1225
- K(e, this.blockClass, this.blockSelector, !1) || (N.childNodes(e).forEach((e) => this.genAdds(e)), ut(e) && N.childNodes(N.shadowRoot(e)).forEach((t) => {
1229
+ B(e, this.blockClass, this.blockSelector, !1) || (j.childNodes(e).forEach((e) => this.genAdds(e)), gt(e) && j.childNodes(j.shadowRoot(e)).forEach((t) => {
1226
1230
  this.processedNodeManager.add(t, this), this.genAdds(t, e);
1227
1231
  }));
1228
1232
  }
@@ -1274,46 +1278,50 @@ var _t = class {
1274
1278
  this.shadowDomManager.reset(), this.canvasManager.reset();
1275
1279
  }
1276
1280
  };
1277
- function bt(e, t) {
1278
- e.delete(t), N.childNodes(t).forEach((t) => bt(e, t));
1281
+ function Et(e, t) {
1282
+ e.delete(t), j.childNodes(t).forEach((t) => Et(e, t));
1279
1283
  }
1280
- function xt(e, t) {
1284
+ function Dt(e, t) {
1281
1285
  let n = [e];
1282
1286
  for (; n.length;) {
1283
1287
  let e = n.pop();
1284
- t.has(e) || (t.add(e), N.childNodes(e).forEach((e) => n.push(e)));
1288
+ t.has(e) || (t.add(e), j.childNodes(e).forEach((e) => n.push(e)));
1285
1289
  }
1286
1290
  }
1287
- function St(e, t, n) {
1288
- return e.size !== 0 && Ct(e, t);
1291
+ function Ot(e, t, n) {
1292
+ return e.size !== 0 && kt(e, t);
1289
1293
  }
1290
- function Ct(e, t, n) {
1291
- let r = N.parentNode(t);
1294
+ function kt(e, t, n) {
1295
+ let r = j.parentNode(t);
1292
1296
  return r ? e.has(r) : !1;
1293
1297
  }
1294
- function wt(e, t) {
1295
- return e.size !== 0 && Tt(e, t);
1296
- }
1297
- function Tt(e, t) {
1298
- let n = N.parentNode(t);
1299
- return n ? e.has(n) ? !0 : Tt(e, n) : !1;
1298
+ function At(e, t) {
1299
+ return e.size !== 0 && jt(e, t);
1300
1300
  }
1301
- var Et;
1302
- function Dt(e) {
1303
- Et = e;
1301
+ function jt(e, t) {
1302
+ let n = j.parentNode(t);
1303
+ return n ? e.has(n) ? !0 : jt(e, n) : !1;
1304
1304
  }
1305
- function Ot() {
1306
- Et = void 0;
1305
+ var V, H = !1, Mt;
1306
+ function Nt(e) {
1307
+ V = e;
1307
1308
  }
1308
- var q = (e) => Et ? (...t) => {
1309
+ var U = (e) => V ? (...t) => {
1309
1310
  try {
1310
1311
  return e(...t);
1311
1312
  } catch (e) {
1312
- if (Et && Et(e) === !0) return;
1313
+ if (V && V(e) === !0) return;
1313
1314
  throw e;
1314
1315
  }
1315
- } : e, J = [];
1316
- function kt(e) {
1316
+ } : e;
1317
+ function W(e, t) {
1318
+ let n = U(t);
1319
+ return new Proxy(e, { apply(e, t, r) {
1320
+ return H || n(t, r), e.apply(t, r);
1321
+ } });
1322
+ }
1323
+ var G = [];
1324
+ function Pt(e) {
1317
1325
  try {
1318
1326
  if ("composedPath" in e) {
1319
1327
  let t = e.composedPath();
@@ -1322,10 +1330,12 @@ function kt(e) {
1322
1330
  } catch {}
1323
1331
  return e && e.target;
1324
1332
  }
1325
- function At(e, t) {
1326
- let n = new yt();
1327
- J.push(n), n.init(e);
1328
- let [r, i] = j(), a = new r(q(n.processMutations.bind(n)));
1333
+ function Ft(e, t) {
1334
+ let n = new Tt();
1335
+ G.push(n), n.init(e);
1336
+ let [r, i] = ne(), a = new r(U((e) => {
1337
+ Mt && Mt(e) === !1 || n.processMutations(e);
1338
+ }));
1329
1339
  return a.observe(t, {
1330
1340
  attributes: !0,
1331
1341
  attributeOldValue: !0,
@@ -1335,33 +1345,33 @@ function At(e, t) {
1335
1345
  subtree: !0
1336
1346
  }), [a, i];
1337
1347
  }
1338
- function jt({ mousemoveCb: e, sampling: t, doc: n, mirror: r }) {
1348
+ function It({ mousemoveCb: e, sampling: t, doc: n, mirror: r }) {
1339
1349
  if (t.mousemove === !1) return () => {};
1340
- let a = typeof t.mousemove == "number" ? t.mousemove : 50, o = typeof t.mousemoveCallback == "number" ? t.mousemoveCallback : 500, s = [], c, l = Ze(q((t) => {
1350
+ let a = typeof t.mousemove == "number" ? t.mousemove : 50, o = typeof t.mousemoveCallback == "number" ? t.mousemoveCallback : 500, s = [], c, l = rt(U((t) => {
1341
1351
  let n = Date.now() - c;
1342
1352
  e(s.map((e) => (e.timeOffset -= n, e)), t), s = [], c = null;
1343
- }), o), u = q(Ze(q((e) => {
1344
- let t = kt(e), { clientX: n, clientY: a } = ot(e) ? e.changedTouches[0] : e;
1345
- c ||= te(), s.push({
1353
+ }), o), u = U(rt(U((e) => {
1354
+ let t = Pt(e), { clientX: n, clientY: a } = ft(e) ? e.changedTouches[0] : e;
1355
+ c ||= re(), s.push({
1346
1356
  x: n,
1347
1357
  y: a,
1348
1358
  id: r.getId(t),
1349
- timeOffset: te() - c
1359
+ timeOffset: re() - c
1350
1360
  }), l(typeof DragEvent < "u" && e instanceof DragEvent ? i.Drag : e instanceof MouseEvent ? i.MouseMove : i.TouchMove);
1351
1361
  }), a, { trailing: !1 })), d = [
1352
- W("mousemove", u, n),
1353
- W("touchmove", u, n),
1354
- W("drag", u, n)
1362
+ z("mousemove", u, n),
1363
+ z("touchmove", u, n),
1364
+ z("drag", u, n)
1355
1365
  ];
1356
- return q(() => {
1366
+ return U(() => {
1357
1367
  d.forEach((e) => e());
1358
1368
  });
1359
1369
  }
1360
- function Mt({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: s }) {
1370
+ function Lt({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: s }) {
1361
1371
  if (s.mouseInteraction === !1) return () => {};
1362
1372
  let c = s.mouseInteraction === !0 || s.mouseInteraction === void 0 ? {} : s.mouseInteraction, l = [], u = null, d = (t) => (s) => {
1363
- let c = kt(s);
1364
- if (K(c, r, i, !0)) return;
1373
+ let c = Pt(s);
1374
+ if (B(c, r, i, !0)) return;
1365
1375
  let l = null, d = t;
1366
1376
  if ("pointerType" in s) {
1367
1377
  switch (s.pointerType) {
@@ -1376,12 +1386,12 @@ function Mt({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSele
1376
1386
  break;
1377
1387
  }
1378
1388
  l === o.Touch ? a[t] === a.MouseDown ? d = "TouchStart" : a[t] === a.MouseUp && (d = "TouchEnd") : o.Pen;
1379
- } else ot(s) && (l = o.Touch);
1389
+ } else ft(s) && (l = o.Touch);
1380
1390
  l === null ? a[t] === a.Click && (l = u, u = null) : (u = l, (d.startsWith("Touch") && l === o.Touch || d.startsWith("Mouse") && l === o.Mouse) && (l = null));
1381
- let f = ot(s) ? s.changedTouches[0] : s;
1391
+ let f = ft(s) ? s.changedTouches[0] : s;
1382
1392
  if (!f) return;
1383
1393
  let p = n.getId(c), { clientX: m, clientY: h } = f;
1384
- q(e)({
1394
+ U(e)({
1385
1395
  type: a[d],
1386
1396
  id: p,
1387
1397
  x: m,
@@ -1390,7 +1400,7 @@ function Mt({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSele
1390
1400
  });
1391
1401
  };
1392
1402
  return Object.keys(a).filter((e) => Number.isNaN(Number(e)) && !e.endsWith("_Departed") && c[e] !== !1).forEach((e) => {
1393
- let n = B(e), r = d(e);
1403
+ let n = L(e), r = U(d(e));
1394
1404
  if (window.PointerEvent) switch (a[e]) {
1395
1405
  case a.MouseDown:
1396
1406
  case a.MouseUp:
@@ -1399,18 +1409,18 @@ function Mt({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSele
1399
1409
  case a.TouchStart:
1400
1410
  case a.TouchEnd: return;
1401
1411
  }
1402
- l.push(W(n, r, t));
1403
- }), q(() => {
1412
+ l.push(z(n, r, t));
1413
+ }), U(() => {
1404
1414
  l.forEach((e) => e());
1405
1415
  });
1406
1416
  }
1407
- function Nt({ scrollCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: a }) {
1408
- return W("scroll", q(Ze(q((a) => {
1409
- let o = kt(a);
1410
- if (!o || K(o, r, i, !0)) return;
1417
+ function Rt({ scrollCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: a }) {
1418
+ return z("scroll", U(rt(U((a) => {
1419
+ let o = Pt(a);
1420
+ if (!o || B(o, r, i, !0)) return;
1411
1421
  let s = n.getId(o);
1412
1422
  if (o === t && t.defaultView) {
1413
- let n = $e(t.defaultView);
1423
+ let n = at(t.defaultView);
1414
1424
  e({
1415
1425
  id: s,
1416
1426
  x: n.left,
@@ -1423,27 +1433,27 @@ function Nt({ scrollCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, s
1423
1433
  });
1424
1434
  }), a.scroll || 100)), t);
1425
1435
  }
1426
- function Pt({ viewportResizeCb: e }, { win: t }) {
1436
+ function zt({ viewportResizeCb: e }, { win: t }) {
1427
1437
  let n = -1, r = -1;
1428
- return W("resize", q(Ze(q(() => {
1429
- let t = et(), i = tt();
1438
+ return z("resize", U(rt(U(() => {
1439
+ let t = ot(), i = st();
1430
1440
  (n !== t || r !== i) && (e({
1431
1441
  width: Number(i),
1432
1442
  height: Number(t)
1433
1443
  }), n = t, r = i);
1434
1444
  }), 200)), t);
1435
1445
  }
1436
- var Ft = [
1446
+ var Bt = [
1437
1447
  "INPUT",
1438
1448
  "TEXTAREA",
1439
1449
  "SELECT"
1440
- ], It = /* @__PURE__ */ new WeakMap();
1441
- function Lt({ inputCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, ignoreClass: a, ignoreSelector: o, maskInputOptions: s, maskInputFn: c, sampling: l, userTriggeredOnInput: u }) {
1450
+ ], Vt = /* @__PURE__ */ new WeakMap();
1451
+ function Ht({ inputCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, ignoreClass: a, ignoreSelector: o, maskInputOptions: s, maskInputFn: c, sampling: l, userTriggeredOnInput: u }) {
1442
1452
  function d(e) {
1443
- let n = kt(e), l = e.isTrusted, d = n && n.tagName;
1444
- if (n && d === "OPTION" && (n = N.parentElement(n)), !n || !d || Ft.indexOf(d) < 0 || K(n, r, i, !0) || n.classList.contains(a) || o && n.matches(o)) return;
1445
- let p = n.value, m = !1, h = de(n) || "";
1446
- h === "radio" || h === "checkbox" ? m = n.checked : (s[d.toLowerCase()] || s[h]) && (p = z({
1453
+ let n = Pt(e), l = e.isTrusted, d = n && n.tagName;
1454
+ if (n && d === "OPTION" && (n = j.parentElement(n)), !n || !d || Bt.indexOf(d) < 0 || B(n, r, i, !0) || n.classList.contains(a) || o && n.matches(o)) return;
1455
+ let p = n.value, m = !1, h = me(n) || "";
1456
+ h === "radio" || h === "checkbox" ? m = n.checked : (s[d.toLowerCase()] || s[h]) && (p = I({
1447
1457
  element: n,
1448
1458
  maskInputOptions: s,
1449
1459
  tagName: d,
@@ -1474,17 +1484,17 @@ function Lt({ inputCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, ig
1474
1484
  });
1475
1485
  }
1476
1486
  function f(t, r) {
1477
- let i = It.get(t);
1487
+ let i = Vt.get(t);
1478
1488
  if (!i || i.text !== r.text || i.isChecked !== r.isChecked) {
1479
- It.set(t, r);
1489
+ Vt.set(t, r);
1480
1490
  let i = n.getId(t);
1481
- q(e)({
1491
+ U(e)({
1482
1492
  ...r,
1483
1493
  id: i
1484
1494
  });
1485
1495
  }
1486
1496
  }
1487
- let p = (l.input === "last" ? ["change"] : ["input", "change"]).map((e) => W(e, q(d), t)), m = t.defaultView;
1497
+ let p = (l.input === "last" ? ["change"] : ["input", "change"]).map((e) => z(e, U(d), t)), m = t.defaultView;
1488
1498
  if (!m) return () => {
1489
1499
  p.forEach((e) => e());
1490
1500
  };
@@ -1496,19 +1506,19 @@ function Lt({ inputCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, ig
1496
1506
  [m.HTMLSelectElement.prototype, "selectedIndex"],
1497
1507
  [m.HTMLOptionElement.prototype, "selected"]
1498
1508
  ];
1499
- return h && h.set && p.push(...g.map((e) => Qe(e[0], e[1], { set() {
1500
- q(d)({
1509
+ return h && h.set && p.push(...g.map((e) => it(e[0], e[1], { set() {
1510
+ U(d)({
1501
1511
  target: this,
1502
1512
  isTrusted: !1
1503
1513
  });
1504
- } }, !1, m))), q(() => {
1514
+ } }, !1, m))), U(() => {
1505
1515
  p.forEach((e) => e());
1506
1516
  });
1507
1517
  }
1508
- function Rt(e) {
1518
+ function Ut(e) {
1509
1519
  let t = [];
1510
1520
  function n(e, t) {
1511
- if (Jt("CSSGroupingRule") && e.parentRule instanceof CSSGroupingRule || Jt("CSSMediaRule") && e.parentRule instanceof CSSMediaRule || Jt("CSSSupportsRule") && e.parentRule instanceof CSSSupportsRule || Jt("CSSConditionRule") && e.parentRule instanceof CSSConditionRule) {
1521
+ if (en("CSSGroupingRule") && e.parentRule instanceof CSSGroupingRule || en("CSSMediaRule") && e.parentRule instanceof CSSMediaRule || en("CSSSupportsRule") && e.parentRule instanceof CSSSupportsRule || en("CSSConditionRule") && e.parentRule instanceof CSSConditionRule) {
1512
1522
  let r = Array.from(e.parentRule.cssRules).indexOf(e);
1513
1523
  return t.unshift(r), n(e.parentRule, t);
1514
1524
  } else if (e.parentStyleSheet) {
@@ -1519,93 +1529,65 @@ function Rt(e) {
1519
1529
  }
1520
1530
  return n(e, t);
1521
1531
  }
1522
- function Y(e, t, n) {
1532
+ function Wt(e, t, n) {
1523
1533
  let r, i;
1524
1534
  return e ? (e.ownerNode ? r = t.getId(e.ownerNode) : i = n.getId(e), {
1525
1535
  styleId: i,
1526
1536
  id: r
1527
1537
  }) : {};
1528
1538
  }
1529
- function zt({ styleSheetRuleCb: e, mirror: t, stylesheetManager: n }, { win: r }) {
1539
+ function Gt({ styleSheetRuleCb: e, mirror: t, stylesheetManager: n }, { win: r }) {
1530
1540
  if (!r.CSSStyleSheet || !r.CSSStyleSheet.prototype) return () => {};
1531
- let i = r.CSSStyleSheet.prototype.insertRule;
1532
- r.CSSStyleSheet.prototype.insertRule = new Proxy(i, { apply: q((r, i, a) => {
1533
- let [o, s] = a, { id: c, styleId: l } = Y(i, t, n.styleMirror);
1534
- return (c && c !== -1 || l && l !== -1) && e({
1535
- id: c,
1536
- styleId: l,
1537
- adds: [{
1538
- rule: o,
1539
- index: s
1540
- }]
1541
- }), r.apply(i, a);
1542
- }) }), r.CSSStyleSheet.prototype.addRule = function(e, t, n = this.cssRules.length) {
1541
+ let i = (r, i) => {
1542
+ let { id: a, styleId: o } = Wt(r, t, n.styleMirror);
1543
+ (a && a !== -1 || o && o !== -1) && e({
1544
+ id: a,
1545
+ styleId: o,
1546
+ ...i
1547
+ });
1548
+ }, a = r.CSSStyleSheet.prototype.insertRule;
1549
+ r.CSSStyleSheet.prototype.insertRule = W(a, (e, [t, n]) => i(e, { adds: [{
1550
+ rule: t,
1551
+ index: n
1552
+ }] }));
1553
+ let o = r.CSSStyleSheet.prototype.addRule;
1554
+ r.CSSStyleSheet.prototype.addRule = o ? W(o, (e, [t, n, r = e.cssRules.length]) => i(e, { adds: [{
1555
+ rule: `${t} { ${n} }`,
1556
+ index: r
1557
+ }] })) : function(e, t, n = this.cssRules.length) {
1543
1558
  let i = `${e} { ${t} }`;
1544
1559
  return r.CSSStyleSheet.prototype.insertRule.apply(this, [i, n]);
1545
1560
  };
1546
- let a = r.CSSStyleSheet.prototype.deleteRule;
1547
- r.CSSStyleSheet.prototype.deleteRule = new Proxy(a, { apply: q((r, i, a) => {
1548
- let [o] = a, { id: s, styleId: c } = Y(i, t, n.styleMirror);
1549
- return (s && s !== -1 || c && c !== -1) && e({
1550
- id: s,
1551
- styleId: c,
1552
- removes: [{ index: o }]
1553
- }), r.apply(i, a);
1554
- }) }), r.CSSStyleSheet.prototype.removeRule = function(e) {
1561
+ let s = r.CSSStyleSheet.prototype.deleteRule;
1562
+ r.CSSStyleSheet.prototype.deleteRule = W(s, (e, [t]) => i(e, { removes: [{ index: t }] }));
1563
+ let c = r.CSSStyleSheet.prototype.removeRule;
1564
+ r.CSSStyleSheet.prototype.removeRule = c ? W(c, (e, [t]) => i(e, { removes: [{ index: t }] })) : function(e) {
1555
1565
  return r.CSSStyleSheet.prototype.deleteRule.apply(this, [e]);
1556
1566
  };
1557
- let o;
1558
- r.CSSStyleSheet.prototype.replace && (o = r.CSSStyleSheet.prototype.replace, r.CSSStyleSheet.prototype.replace = new Proxy(o, { apply: q((r, i, a) => {
1559
- let [o] = a, { id: s, styleId: c } = Y(i, t, n.styleMirror);
1560
- return (s && s !== -1 || c && c !== -1) && e({
1561
- id: s,
1562
- styleId: c,
1563
- replace: o
1564
- }), r.apply(i, a);
1565
- }) }));
1566
- let s;
1567
- r.CSSStyleSheet.prototype.replaceSync && (s = r.CSSStyleSheet.prototype.replaceSync, r.CSSStyleSheet.prototype.replaceSync = new Proxy(s, { apply: q((r, i, a) => {
1568
- let [o] = a, { id: s, styleId: c } = Y(i, t, n.styleMirror);
1569
- return (s && s !== -1 || c && c !== -1) && e({
1570
- id: s,
1571
- styleId: c,
1572
- replaceSync: o
1573
- }), r.apply(i, a);
1574
- }) }));
1575
- let c = {};
1576
- Yt("CSSGroupingRule") ? c.CSSGroupingRule = r.CSSGroupingRule : (Yt("CSSMediaRule") && (c.CSSMediaRule = r.CSSMediaRule), Yt("CSSConditionRule") && (c.CSSConditionRule = r.CSSConditionRule), Yt("CSSSupportsRule") && (c.CSSSupportsRule = r.CSSSupportsRule));
1577
- let l = {};
1578
- return Object.entries(c).forEach(([r, i]) => {
1579
- l[r] = {
1580
- insertRule: i.prototype.insertRule,
1581
- deleteRule: i.prototype.deleteRule
1582
- }, i.prototype.insertRule = new Proxy(l[r].insertRule, { apply: q((r, i, a) => {
1583
- let [o, s] = a, { id: c, styleId: l } = Y(i.parentStyleSheet, t, n.styleMirror);
1584
- return (c && c !== -1 || l && l !== -1) && e({
1585
- id: c,
1586
- styleId: l,
1587
- adds: [{
1588
- rule: o,
1589
- index: [...Rt(i), s || 0]
1590
- }]
1591
- }), r.apply(i, a);
1592
- }) }), i.prototype.deleteRule = new Proxy(l[r].deleteRule, { apply: q((r, i, a) => {
1593
- let [o] = a, { id: s, styleId: c } = Y(i.parentStyleSheet, t, n.styleMirror);
1594
- return (s && s !== -1 || c && c !== -1) && e({
1595
- id: s,
1596
- styleId: c,
1597
- removes: [{ index: [...Rt(i), o] }]
1598
- }), r.apply(i, a);
1599
- }) });
1600
- }), q(() => {
1601
- r.CSSStyleSheet.prototype.insertRule = i, r.CSSStyleSheet.prototype.deleteRule = a, o && (r.CSSStyleSheet.prototype.replace = o), s && (r.CSSStyleSheet.prototype.replaceSync = s), Object.entries(c).forEach(([e, t]) => {
1602
- t.prototype.insertRule = l[e].insertRule, t.prototype.deleteRule = l[e].deleteRule;
1603
- });
1567
+ let l;
1568
+ r.CSSStyleSheet.prototype.replace && (l = r.CSSStyleSheet.prototype.replace, r.CSSStyleSheet.prototype.replace = W(l, (e, [t]) => i(e, { replace: t })));
1569
+ let u;
1570
+ r.CSSStyleSheet.prototype.replaceSync && (u = r.CSSStyleSheet.prototype.replaceSync, r.CSSStyleSheet.prototype.replaceSync = W(u, (e, [t]) => i(e, { replaceSync: t })));
1571
+ let d = {};
1572
+ tn("CSSGroupingRule") ? d.CSSGroupingRule = r.CSSGroupingRule : (tn("CSSMediaRule") && (d.CSSMediaRule = r.CSSMediaRule), tn("CSSConditionRule") && (d.CSSConditionRule = r.CSSConditionRule), tn("CSSSupportsRule") && (d.CSSSupportsRule = r.CSSSupportsRule));
1573
+ let f = {};
1574
+ return Object.entries(d).forEach(([e, t]) => {
1575
+ f[e] = {
1576
+ insertRule: t.prototype.insertRule,
1577
+ deleteRule: t.prototype.deleteRule
1578
+ }, t.prototype.insertRule = W(f[e].insertRule, (e, [t, n]) => i(e.parentStyleSheet, { adds: [{
1579
+ rule: t,
1580
+ index: [...Ut(e), n || 0]
1581
+ }] })), t.prototype.deleteRule = W(f[e].deleteRule, (e, [t]) => i(e.parentStyleSheet, { removes: [{ index: [...Ut(e), t] }] }));
1582
+ }), U(() => {
1583
+ H || (r.CSSStyleSheet.prototype.insertRule = a, r.CSSStyleSheet.prototype.deleteRule = s, o && (r.CSSStyleSheet.prototype.addRule = o), c && (r.CSSStyleSheet.prototype.removeRule = c), l && (r.CSSStyleSheet.prototype.replace = l), u && (r.CSSStyleSheet.prototype.replaceSync = u), Object.entries(d).forEach(([e, t]) => {
1584
+ t.prototype.insertRule = f[e].insertRule, t.prototype.deleteRule = f[e].deleteRule;
1585
+ }));
1604
1586
  });
1605
1587
  }
1606
- function Bt({ mirror: e, stylesheetManager: t }, n) {
1588
+ function Kt({ mirror: e, stylesheetManager: t }, n) {
1607
1589
  let r = null;
1608
- r = n.nodeName === "#document" ? e.getId(n) : e.getId(N.host(n));
1590
+ r = n.nodeName === "#document" ? e.getId(n) : e.getId(j.host(n));
1609
1591
  let i = n.nodeName === "#document" ? n.defaultView?.Document : n.ownerDocument?.defaultView?.ShadowRoot, a = i?.prototype ? Object.getOwnPropertyDescriptor(i?.prototype, "adoptedStyleSheets") : void 0;
1610
1592
  return r === null || r === -1 || !i || !a ? () => {} : (Object.defineProperty(n, "adoptedStyleSheets", {
1611
1593
  configurable: a.configurable,
@@ -1615,13 +1597,13 @@ function Bt({ mirror: e, stylesheetManager: t }, n) {
1615
1597
  },
1616
1598
  set(e) {
1617
1599
  let n = a.set?.call(this, e);
1618
- if (r !== null && r !== -1) try {
1600
+ if (!H && r !== null && r !== -1) try {
1619
1601
  t.adoptStyleSheets(e, r);
1620
1602
  } catch {}
1621
1603
  return n;
1622
1604
  }
1623
- }), q(() => {
1624
- Object.defineProperty(n, "adoptedStyleSheets", {
1605
+ }), U(() => {
1606
+ H || Object.defineProperty(n, "adoptedStyleSheets", {
1625
1607
  configurable: a.configurable,
1626
1608
  enumerable: a.enumerable,
1627
1609
  get: a.get,
@@ -1629,46 +1611,42 @@ function Bt({ mirror: e, stylesheetManager: t }, n) {
1629
1611
  });
1630
1612
  }));
1631
1613
  }
1632
- function Vt({ styleDeclarationCb: e, mirror: t, ignoreCSSAttributes: n, stylesheetManager: r }, { win: i }) {
1614
+ function qt({ styleDeclarationCb: e, mirror: t, ignoreCSSAttributes: n, stylesheetManager: r }, { win: i }) {
1633
1615
  let a = i.CSSStyleDeclaration.prototype.setProperty;
1634
- i.CSSStyleDeclaration.prototype.setProperty = new Proxy(a, { apply: q((i, o, s) => {
1635
- let [c, l, u] = s;
1636
- if (n.has(c)) return a.apply(o, [
1637
- c,
1638
- l,
1639
- u
1640
- ]);
1641
- let { id: d, styleId: f } = Y(o.parentRule?.parentStyleSheet, t, r.styleMirror);
1642
- return (d && d !== -1 || f && f !== -1) && e({
1643
- id: d,
1644
- styleId: f,
1616
+ i.CSSStyleDeclaration.prototype.setProperty = W(a, (i, a) => {
1617
+ let [o, s, c] = a;
1618
+ if (n.has(o)) return;
1619
+ let { id: l, styleId: u } = Wt(i.parentRule?.parentStyleSheet, t, r.styleMirror);
1620
+ (l && l !== -1 || u && u !== -1) && e({
1621
+ id: l,
1622
+ styleId: u,
1645
1623
  set: {
1646
- property: c,
1647
- value: l,
1648
- priority: u
1624
+ property: o,
1625
+ value: s,
1626
+ priority: c
1649
1627
  },
1650
- index: Rt(o.parentRule)
1651
- }), i.apply(o, s);
1652
- }) });
1628
+ index: Ut(i.parentRule)
1629
+ });
1630
+ });
1653
1631
  let o = i.CSSStyleDeclaration.prototype.removeProperty;
1654
- return i.CSSStyleDeclaration.prototype.removeProperty = new Proxy(o, { apply: q((i, a, s) => {
1655
- let [c] = s;
1656
- if (n.has(c)) return o.apply(a, [c]);
1657
- let { id: l, styleId: u } = Y(a.parentRule?.parentStyleSheet, t, r.styleMirror);
1658
- return (l && l !== -1 || u && u !== -1) && e({
1659
- id: l,
1660
- styleId: u,
1661
- remove: { property: c },
1662
- index: Rt(a.parentRule)
1663
- }), i.apply(a, s);
1664
- }) }), q(() => {
1665
- i.CSSStyleDeclaration.prototype.setProperty = a, i.CSSStyleDeclaration.prototype.removeProperty = o;
1632
+ return i.CSSStyleDeclaration.prototype.removeProperty = W(o, (i, a) => {
1633
+ let [o] = a;
1634
+ if (n.has(o)) return;
1635
+ let { id: s, styleId: c } = Wt(i.parentRule?.parentStyleSheet, t, r.styleMirror);
1636
+ (s && s !== -1 || c && c !== -1) && e({
1637
+ id: s,
1638
+ styleId: c,
1639
+ remove: { property: o },
1640
+ index: Ut(i.parentRule)
1641
+ });
1642
+ }), U(() => {
1643
+ H || (i.CSSStyleDeclaration.prototype.setProperty = a, i.CSSStyleDeclaration.prototype.removeProperty = o);
1666
1644
  });
1667
1645
  }
1668
- function Ht({ mediaInteractionCb: e, blockClass: t, blockSelector: n, mirror: r, sampling: i, doc: a }) {
1669
- let o = q((a) => Ze(q((i) => {
1670
- let o = kt(i);
1671
- if (!o || K(o, t, n, !0)) return;
1646
+ function Jt({ mediaInteractionCb: e, blockClass: t, blockSelector: n, mirror: r, sampling: i, doc: a }) {
1647
+ let o = U((a) => rt(U((i) => {
1648
+ let o = Pt(i);
1649
+ if (!o || B(o, t, n, !0)) return;
1672
1650
  let { currentTime: s, volume: c, muted: l, playbackRate: u, loop: d } = o;
1673
1651
  e({
1674
1652
  type: a,
@@ -1680,17 +1658,17 @@ function Ht({ mediaInteractionCb: e, blockClass: t, blockSelector: n, mirror: r,
1680
1658
  loop: d
1681
1659
  });
1682
1660
  }), i.media || 500)), s = [
1683
- W("play", o(c.Play), a),
1684
- W("pause", o(c.Pause), a),
1685
- W("seeked", o(c.Seeked), a),
1686
- W("volumechange", o(c.VolumeChange), a),
1687
- W("ratechange", o(c.RateChange), a)
1661
+ z("play", o(c.Play), a),
1662
+ z("pause", o(c.Pause), a),
1663
+ z("seeked", o(c.Seeked), a),
1664
+ z("volumechange", o(c.VolumeChange), a),
1665
+ z("ratechange", o(c.RateChange), a)
1688
1666
  ];
1689
- return q(() => {
1667
+ return U(() => {
1690
1668
  s.forEach((e) => e());
1691
1669
  });
1692
1670
  }
1693
- function Ut({ fontCb: e, doc: t }) {
1671
+ function Yt({ fontCb: e, doc: t }) {
1694
1672
  let n = t.defaultView;
1695
1673
  if (!n) return () => {};
1696
1674
  let r = [], i = /* @__PURE__ */ new WeakMap(), a = n.FontFace;
@@ -1703,9 +1681,9 @@ function Ut({ fontCb: e, doc: t }) {
1703
1681
  fontSource: typeof t == "string" ? t : JSON.stringify(Array.from(new Uint8Array(t)))
1704
1682
  }), r;
1705
1683
  };
1706
- let o = M(t.fonts, "add", function(t) {
1684
+ let o = A(t.fonts, "add", function(t) {
1707
1685
  return function(n) {
1708
- return setTimeout(q(() => {
1686
+ return setTimeout(U(() => {
1709
1687
  let t = i.get(n);
1710
1688
  t && (e(t), i.delete(n));
1711
1689
  }), 0), t.apply(this, [n]);
@@ -1713,19 +1691,19 @@ function Ut({ fontCb: e, doc: t }) {
1713
1691
  });
1714
1692
  return r.push(() => {
1715
1693
  n.FontFace = a;
1716
- }), r.push(o), q(() => {
1694
+ }), r.push(o), U(() => {
1717
1695
  r.forEach((e) => e());
1718
1696
  });
1719
1697
  }
1720
- function Wt(e) {
1721
- let { doc: t, mirror: n, blockClass: r, blockSelector: i, selectionCb: a } = e, o = !0, s = q(() => {
1698
+ function Xt(e) {
1699
+ let { doc: t, mirror: n, blockClass: r, blockSelector: i, selectionCb: a } = e, o = !0, s = U(() => {
1722
1700
  let e = t.getSelection();
1723
1701
  if (!e || o && e?.isCollapsed) return;
1724
1702
  o = e.isCollapsed || !1;
1725
1703
  let s = [], c = e.rangeCount || 0;
1726
1704
  for (let t = 0; t < c; t++) {
1727
1705
  let { startContainer: a, startOffset: o, endContainer: c, endOffset: l } = e.getRangeAt(t);
1728
- K(a, r, i, !0) || K(c, r, i, !0) || s.push({
1706
+ B(a, r, i, !0) || B(c, r, i, !0) || s.push({
1729
1707
  start: n.getId(a),
1730
1708
  startOffset: o,
1731
1709
  end: n.getId(c),
@@ -1734,16 +1712,16 @@ function Wt(e) {
1734
1712
  }
1735
1713
  a({ ranges: s });
1736
1714
  });
1737
- return s(), W("selectionchange", s);
1715
+ return s(), z("selectionchange", s);
1738
1716
  }
1739
- function Gt({ doc: e, customElementCb: t }) {
1717
+ function Zt({ doc: e, customElementCb: t }) {
1740
1718
  let n = e.defaultView;
1741
- return !n || !n.customElements ? () => {} : M(n.customElements, "define", function(e) {
1719
+ return !n || !n.customElements ? () => {} : A(n.customElements, "define", function(e) {
1742
1720
  return function(n, r, i) {
1743
- try {
1721
+ if (!H) try {
1744
1722
  t({ define: { name: n } });
1745
- } catch {
1746
- console.warn(`Custom element callback failed for ${n}`);
1723
+ } catch (e) {
1724
+ V && V(e) === !0 || console.warn(`Custom element callback failed for ${n}`);
1747
1725
  }
1748
1726
  return e.apply(this, [
1749
1727
  n,
@@ -1753,7 +1731,7 @@ function Gt({ doc: e, customElementCb: t }) {
1753
1731
  };
1754
1732
  });
1755
1733
  }
1756
- function Kt(e, t) {
1734
+ function Qt(e, t) {
1757
1735
  let { mutationCb: n, mousemoveCb: r, mouseInteractionCb: i, scrollCb: a, viewportResizeCb: o, inputCb: s, mediaInteractionCb: c, styleSheetRuleCb: l, styleDeclarationCb: u, canvasMutationCb: d, fontCb: f, selectionCb: p, customElementCb: m } = e;
1758
1736
  e.mutationCb = (...e) => {
1759
1737
  t.mutation && t.mutation(...e), n(...e);
@@ -1783,27 +1761,27 @@ function Kt(e, t) {
1783
1761
  t.customElement && t.customElement(...e), m(...e);
1784
1762
  };
1785
1763
  }
1786
- function qt(e, t = {}) {
1764
+ function $t(e, t = {}) {
1787
1765
  let n = e.doc.defaultView;
1788
1766
  if (!n) return () => {};
1789
- Kt(e, t);
1767
+ Qt(e, t);
1790
1768
  let r, i = () => {};
1791
- e.recordDOM && ([r, i] = At(e, e.doc));
1792
- let a = jt(e), o = Mt(e), s = Nt(e), c = Pt(e, { win: n }), l = Lt(e), u = Ht(e), d = () => {}, f = () => {}, p = () => {}, m = () => {};
1793
- e.recordDOM && (d = zt(e, { win: n }), f = Bt(e, e.doc), p = Vt(e, { win: n }), e.collectFonts && (m = Ut(e)));
1794
- let h = Wt(e), g = Gt(e), _ = [];
1769
+ e.recordDOM && ([r, i] = Ft(e, e.doc));
1770
+ let a = It(e), o = Lt(e), s = Rt(e), c = zt(e, { win: n }), l = Ht(e), u = Jt(e), d = () => {}, f = () => {}, p = () => {}, m = () => {};
1771
+ e.recordDOM && (d = Gt(e, { win: n }), f = Kt(e, e.doc), p = qt(e, { win: n }), e.collectFonts && (m = Yt(e)));
1772
+ let h = Xt(e), g = Zt(e), _ = [];
1795
1773
  for (let t of e.plugins) _.push(t.observer(t.callback, n, t.options));
1796
- return q(() => {
1797
- J.forEach((e) => e.reset()), r?.disconnect(), i(), a(), o(), s(), c(), l(), u(), d(), f(), p(), m(), h(), g(), _.forEach((e) => e());
1774
+ return U(() => {
1775
+ G.forEach((e) => e.reset()), r?.disconnect(), i(), a(), o(), s(), c(), l(), u(), d(), f(), p(), m(), h(), g(), _.forEach((e) => e());
1798
1776
  });
1799
1777
  }
1800
- function Jt(e) {
1778
+ function en(e) {
1801
1779
  return window[e] !== void 0;
1802
1780
  }
1803
- function Yt(e) {
1781
+ function tn(e) {
1804
1782
  return !!(window[e] !== void 0 && window[e].prototype && "insertRule" in window[e].prototype && "deleteRule" in window[e].prototype);
1805
1783
  }
1806
- for (var Xt = class {
1784
+ for (var nn = class {
1807
1785
  constructor(e) {
1808
1786
  n(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap()), n(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap()), this.generateIdFn = e;
1809
1787
  }
@@ -1838,9 +1816,9 @@ for (var Xt = class {
1838
1816
  let t = this.iframeRemoteIdToIdMap.get(e);
1839
1817
  return t || (t = /* @__PURE__ */ new Map(), this.iframeRemoteIdToIdMap.set(e, t)), t;
1840
1818
  }
1841
- }, Zt = class {
1819
+ }, rn = class {
1842
1820
  constructor(e) {
1843
- n(this, "iframes", /* @__PURE__ */ new WeakMap()), n(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap()), n(this, "crossOriginIframeMirror", new Xt(Te)), n(this, "crossOriginIframeStyleMirror"), n(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap()), n(this, "mirror"), n(this, "mutationCb"), n(this, "wrappedEmit"), n(this, "loadListener"), n(this, "stylesheetManager"), n(this, "recordCrossOriginIframes"), this.mutationCb = e.mutationCb, this.wrappedEmit = e.wrappedEmit, this.stylesheetManager = e.stylesheetManager, this.recordCrossOriginIframes = e.recordCrossOriginIframes, this.crossOriginIframeStyleMirror = new Xt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)), this.mirror = e.mirror, this.recordCrossOriginIframes && window.addEventListener("message", this.handleMessage.bind(this));
1821
+ n(this, "iframes", /* @__PURE__ */ new WeakMap()), n(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap()), n(this, "crossOriginIframeMirror", new nn(Oe)), n(this, "crossOriginIframeStyleMirror"), n(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap()), n(this, "mirror"), n(this, "mutationCb"), n(this, "wrappedEmit"), n(this, "loadListener"), n(this, "stylesheetManager"), n(this, "recordCrossOriginIframes"), this.mutationCb = e.mutationCb, this.wrappedEmit = e.wrappedEmit, this.stylesheetManager = e.stylesheetManager, this.recordCrossOriginIframes = e.recordCrossOriginIframes, this.crossOriginIframeStyleMirror = new nn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)), this.mirror = e.mirror, this.recordCrossOriginIframes && window.addEventListener("message", this.handleMessage.bind(this));
1844
1822
  }
1845
1823
  addIframe(e) {
1846
1824
  this.iframes.set(e, !0), e.contentWindow && this.crossOriginIframeMap.set(e.contentWindow, e);
@@ -1963,7 +1941,7 @@ for (var Xt = class {
1963
1941
  this.patchRootIdOnNode(e, t);
1964
1942
  });
1965
1943
  }
1966
- }, Qt = class {
1944
+ }, an = class {
1967
1945
  constructor(e) {
1968
1946
  n(this, "shadowDoms", /* @__PURE__ */ new WeakSet()), n(this, "mutationCb"), n(this, "scrollCb"), n(this, "bypassOptions"), n(this, "mirror"), n(this, "restoreHandlers", []), this.mutationCb = e.mutationCb, this.scrollCb = e.scrollCb, this.bypassOptions = e.bypassOptions, this.mirror = e.mirror, this.init();
1969
1947
  }
@@ -1971,36 +1949,39 @@ for (var Xt = class {
1971
1949
  this.reset(), this.patchAttachShadow(Element, document);
1972
1950
  }
1973
1951
  addShadowRoot(e, t) {
1974
- if (!I(e) || this.shadowDoms.has(e)) return;
1952
+ if (!N(e) || this.shadowDoms.has(e)) return;
1975
1953
  this.shadowDoms.add(e);
1976
- let [n] = At({
1954
+ let [n] = Ft({
1977
1955
  ...this.bypassOptions,
1978
1956
  doc: t,
1979
1957
  mutationCb: this.mutationCb,
1980
1958
  mirror: this.mirror,
1981
1959
  shadowDomManager: this
1982
1960
  }, e);
1983
- this.restoreHandlers.push(() => n.disconnect()), this.restoreHandlers.push(Nt({
1961
+ this.restoreHandlers.push(() => n.disconnect()), this.restoreHandlers.push(Rt({
1984
1962
  ...this.bypassOptions,
1985
1963
  scrollCb: this.scrollCb,
1986
1964
  doc: e,
1987
1965
  mirror: this.mirror
1988
- })), setTimeout(() => {
1989
- e.adoptedStyleSheets && e.adoptedStyleSheets.length > 0 && this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets, this.mirror.getId(N.host(e))), this.restoreHandlers.push(Bt({
1966
+ })), setTimeout(U(() => {
1967
+ H || (e.adoptedStyleSheets && e.adoptedStyleSheets.length > 0 && this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets, this.mirror.getId(j.host(e))), this.restoreHandlers.push(Kt({
1990
1968
  mirror: this.mirror,
1991
1969
  stylesheetManager: this.bypassOptions.stylesheetManager
1992
- }, e));
1993
- }, 0);
1970
+ }, e)));
1971
+ }), 0);
1994
1972
  }
1995
1973
  observeAttachShadow(e) {
1996
1974
  !e.contentWindow || !e.contentDocument || this.patchAttachShadow(e.contentWindow.Element, e.contentDocument);
1997
1975
  }
1998
1976
  patchAttachShadow(e, t) {
1999
1977
  let n = this;
2000
- this.restoreHandlers.push(M(e.prototype, "attachShadow", function(e) {
1978
+ this.restoreHandlers.push(A(e.prototype, "attachShadow", function(e) {
2001
1979
  return function(r) {
2002
- let i = e.call(this, r), a = N.shadowRoot(this);
2003
- return a && ht(this) && n.addShadowRoot(a, t), i;
1980
+ let i = e.call(this, r);
1981
+ return H || U(() => {
1982
+ let e = j.shadowRoot(this);
1983
+ e && xt(this) && n.addShadowRoot(e, t);
1984
+ })(), i;
2004
1985
  };
2005
1986
  }));
2006
1987
  }
@@ -2011,23 +1992,23 @@ for (var Xt = class {
2011
1992
  } catch {}
2012
1993
  }), this.restoreHandlers = [], this.shadowDoms = /* @__PURE__ */ new WeakSet();
2013
1994
  }
2014
- }, $t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", en = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256), tn = 0; tn < $t.length; tn++) en[$t.charCodeAt(tn)] = tn;
2015
- var nn = function(e) {
1995
+ }, on = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", sn = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256), cn = 0; cn < on.length; cn++) sn[on.charCodeAt(cn)] = cn;
1996
+ var ln = function(e) {
2016
1997
  var t = new Uint8Array(e), n, r = t.length, i = "";
2017
- for (n = 0; n < r; n += 3) i += $t[t[n] >> 2], i += $t[(t[n] & 3) << 4 | t[n + 1] >> 4], i += $t[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], i += $t[t[n + 2] & 63];
1998
+ for (n = 0; n < r; n += 3) i += on[t[n] >> 2], i += on[(t[n] & 3) << 4 | t[n + 1] >> 4], i += on[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], i += on[t[n + 2] & 63];
2018
1999
  return r % 3 == 2 ? i = i.substring(0, i.length - 1) + "=" : r % 3 == 1 && (i = i.substring(0, i.length - 2) + "=="), i;
2019
- }, rn = /* @__PURE__ */ new Map();
2020
- function an(e, t) {
2021
- let n = rn.get(e);
2022
- return n || (n = /* @__PURE__ */ new Map(), rn.set(e, n)), n.has(t) || n.set(t, []), n.get(t);
2023
- }
2024
- var on = (e, t, n) => {
2025
- if (!e || !(ln(e, t) || typeof e == "object")) return;
2026
- let r = e.constructor.name, i = an(n, r), a = i.indexOf(e);
2000
+ }, un = /* @__PURE__ */ new Map();
2001
+ function dn(e, t) {
2002
+ let n = un.get(e);
2003
+ return n || (n = /* @__PURE__ */ new Map(), un.set(e, n)), n.has(t) || n.set(t, []), n.get(t);
2004
+ }
2005
+ var fn = (e, t, n) => {
2006
+ if (!e || !(hn(e, t) || typeof e == "object")) return;
2007
+ let r = e.constructor.name, i = dn(n, r), a = i.indexOf(e);
2027
2008
  return a === -1 && (a = i.length, i.push(e)), a;
2028
2009
  };
2029
- function sn(e, t, n) {
2030
- if (e instanceof Array) return e.map((e) => sn(e, t, n));
2010
+ function pn(e, t, n) {
2011
+ if (e instanceof Array) return e.map((e) => pn(e, t, n));
2031
2012
  if (e === null) return e;
2032
2013
  if (e instanceof Float32Array || e instanceof Float64Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Uint8Array || e instanceof Uint16Array || e instanceof Int16Array || e instanceof Int8Array || e instanceof Uint8ClampedArray) return {
2033
2014
  rr_type: e.constructor.name,
@@ -2035,12 +2016,12 @@ function sn(e, t, n) {
2035
2016
  };
2036
2017
  if (e instanceof ArrayBuffer) return {
2037
2018
  rr_type: e.constructor.name,
2038
- base64: nn(e)
2019
+ base64: ln(e)
2039
2020
  };
2040
2021
  if (e instanceof DataView) return {
2041
2022
  rr_type: e.constructor.name,
2042
2023
  args: [
2043
- sn(e.buffer, t, n),
2024
+ pn(e.buffer, t, n),
2044
2025
  e.byteOffset,
2045
2026
  e.byteLength
2046
2027
  ]
@@ -2058,18 +2039,18 @@ function sn(e, t, n) {
2058
2039
  else if (e instanceof ImageData) return {
2059
2040
  rr_type: e.constructor.name,
2060
2041
  args: [
2061
- sn(e.data, t, n),
2042
+ pn(e.data, t, n),
2062
2043
  e.width,
2063
2044
  e.height
2064
2045
  ]
2065
2046
  };
2066
- else if (ln(e, t) || typeof e == "object") return {
2047
+ else if (hn(e, t) || typeof e == "object") return {
2067
2048
  rr_type: e.constructor.name,
2068
- index: on(e, t, n)
2049
+ index: fn(e, t, n)
2069
2050
  };
2070
2051
  return e;
2071
2052
  }
2072
- var cn = (e, t, n) => e.map((e) => sn(e, t, n)), ln = (e, t) => !![
2053
+ var mn = (e, t, n) => e.map((e) => pn(e, t, n)), hn = (e, t) => !![
2073
2054
  "WebGLActiveInfo",
2074
2055
  "WebGLBuffer",
2075
2056
  "WebGLFramebuffer",
@@ -2082,14 +2063,14 @@ var cn = (e, t, n) => e.map((e) => sn(e, t, n)), ln = (e, t) => !![
2082
2063
  "WebGLVertexArrayObject",
2083
2064
  "WebGLVertexArrayObjectOES"
2084
2065
  ].filter((e) => typeof t[e] == "function").find((n) => e instanceof t[n]);
2085
- function un(e, t, n, r) {
2066
+ function gn(e, t, n, r) {
2086
2067
  let i = [], a = Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);
2087
2068
  for (let o of a) try {
2088
2069
  if (typeof t.CanvasRenderingContext2D.prototype[o] != "function") continue;
2089
- let a = M(t.CanvasRenderingContext2D.prototype, o, function(i) {
2070
+ let a = A(t.CanvasRenderingContext2D.prototype, o, function(i) {
2090
2071
  return function(...a) {
2091
- return K(this.canvas, n, r, !0) || setTimeout(() => {
2092
- let n = cn(a, t, this);
2072
+ return B(this.canvas, n, r, !0) || setTimeout(() => {
2073
+ let n = mn(a, t, this);
2093
2074
  e(this.canvas, {
2094
2075
  type: s["2D"],
2095
2076
  property: o,
@@ -2100,7 +2081,7 @@ function un(e, t, n, r) {
2100
2081
  });
2101
2082
  i.push(a);
2102
2083
  } catch {
2103
- let n = Qe(t.CanvasRenderingContext2D.prototype, o, { set(t) {
2084
+ let n = it(t.CanvasRenderingContext2D.prototype, o, { set(t) {
2104
2085
  e(this.canvas, {
2105
2086
  type: s["2D"],
2106
2087
  property: o,
@@ -2114,16 +2095,16 @@ function un(e, t, n, r) {
2114
2095
  i.forEach((e) => e());
2115
2096
  };
2116
2097
  }
2117
- function dn(e) {
2098
+ function _n(e) {
2118
2099
  return e === "experimental-webgl" ? "webgl" : e;
2119
2100
  }
2120
- function fn(e, t, n, r) {
2101
+ function vn(e, t, n, r) {
2121
2102
  let i = [];
2122
2103
  try {
2123
- let a = M(e.HTMLCanvasElement.prototype, "getContext", function(e) {
2104
+ let a = A(e.HTMLCanvasElement.prototype, "getContext", function(e) {
2124
2105
  return function(i, ...a) {
2125
- if (!K(this, t, n, !0)) {
2126
- let e = dn(i);
2106
+ if (!B(this, t, n, !0)) {
2107
+ let e = _n(i);
2127
2108
  if ("__context" in this || (this.__context = e), r && ["webgl", "webgl2"].includes(e)) if (a[0] && typeof a[0] == "object") {
2128
2109
  let e = a[0];
2129
2110
  e.preserveDrawingBuffer ||= !0;
@@ -2140,7 +2121,7 @@ function fn(e, t, n, r) {
2140
2121
  i.forEach((e) => e());
2141
2122
  };
2142
2123
  }
2143
- function pn(e, t, n, r, i, a) {
2124
+ function yn(e, t, n, r, i, a) {
2144
2125
  let o = [], s = Object.getOwnPropertyNames(e);
2145
2126
  for (let c of s) if (![
2146
2127
  "isContextLost",
@@ -2149,11 +2130,11 @@ function pn(e, t, n, r, i, a) {
2149
2130
  "drawingBufferHeight"
2150
2131
  ].includes(c)) try {
2151
2132
  if (typeof e[c] != "function") continue;
2152
- let s = M(e, c, function(e) {
2133
+ let s = A(e, c, function(e) {
2153
2134
  return function(...o) {
2154
2135
  let s = e.apply(this, o);
2155
- if (on(s, a, this), "tagName" in this.canvas && !K(this.canvas, r, i, !0)) {
2156
- let e = cn(o, a, this), r = {
2136
+ if (fn(s, a, this), "tagName" in this.canvas && !B(this.canvas, r, i, !0)) {
2137
+ let e = mn(o, a, this), r = {
2157
2138
  type: t,
2158
2139
  property: c,
2159
2140
  args: e
@@ -2165,7 +2146,7 @@ function pn(e, t, n, r, i, a) {
2165
2146
  });
2166
2147
  o.push(s);
2167
2148
  } catch {
2168
- let r = Qe(e, c, { set(e) {
2149
+ let r = it(e, c, { set(e) {
2169
2150
  n(this.canvas, {
2170
2151
  type: t,
2171
2152
  property: c,
@@ -2177,28 +2158,28 @@ function pn(e, t, n, r, i, a) {
2177
2158
  }
2178
2159
  return o;
2179
2160
  }
2180
- function mn(e, t, n, r) {
2161
+ function bn(e, t, n, r) {
2181
2162
  let i = [];
2182
- return t.WebGLRenderingContext !== void 0 && i.push(...pn(t.WebGLRenderingContext.prototype, s.WebGL, e, n, r, t)), t.WebGL2RenderingContext !== void 0 && i.push(...pn(t.WebGL2RenderingContext.prototype, s.WebGL2, e, n, r, t)), () => {
2163
+ return t.WebGLRenderingContext !== void 0 && i.push(...yn(t.WebGLRenderingContext.prototype, s.WebGL, e, n, r, t)), t.WebGL2RenderingContext !== void 0 && i.push(...yn(t.WebGL2RenderingContext.prototype, s.WebGL2, e, n, r, t)), () => {
2183
2164
  i.forEach((e) => e());
2184
2165
  };
2185
2166
  }
2186
- var hn = "(function() {\n \"use strict\";\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if (\"OffscreenCanvas\" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext(\"2d\");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return \"\";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if (\"OffscreenCanvas\" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext(\"2d\");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n", gn = typeof self < "u" && self.Blob && new Blob([hn], { type: "text/javascript;charset=utf-8" });
2187
- function _n(e) {
2167
+ var xn = "(function() {\n \"use strict\";\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if (\"OffscreenCanvas\" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext(\"2d\");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return \"\";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if (\"OffscreenCanvas\" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext(\"2d\");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n", Sn = typeof self < "u" && self.Blob && new Blob([xn], { type: "text/javascript;charset=utf-8" });
2168
+ function Cn(e) {
2188
2169
  let t;
2189
2170
  try {
2190
- if (t = gn && (self.URL || self.webkitURL).createObjectURL(gn), !t) throw "";
2171
+ if (t = Sn && (self.URL || self.webkitURL).createObjectURL(Sn), !t) throw "";
2191
2172
  let n = new Worker(t, { name: e?.name });
2192
2173
  return n.addEventListener("error", () => {
2193
2174
  (self.URL || self.webkitURL).revokeObjectURL(t);
2194
2175
  }), n;
2195
2176
  } catch {
2196
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(hn), { name: e?.name });
2177
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(xn), { name: e?.name });
2197
2178
  } finally {
2198
2179
  t && (self.URL || self.webkitURL).revokeObjectURL(t);
2199
2180
  }
2200
2181
  }
2201
- var vn = class {
2182
+ var wn = class {
2202
2183
  constructor(e) {
2203
2184
  n(this, "pendingCanvasMutations", /* @__PURE__ */ new Map()), n(this, "rafStamps", {
2204
2185
  latestId: 0,
@@ -2225,7 +2206,7 @@ var vn = class {
2225
2206
  this.locked = !1;
2226
2207
  }
2227
2208
  initCanvasFPSObserver(e, t, n, r, i) {
2228
- let a = fn(t, n, r, !0), o = /* @__PURE__ */ new Map(), c = new _n();
2209
+ let a = vn(t, n, r, !0), o = /* @__PURE__ */ new Map(), c = new Cn();
2229
2210
  c.onmessage = (e) => {
2230
2211
  let { id: t } = e.data;
2231
2212
  if (o.set(t, !1), !("base64" in e.data)) return;
@@ -2264,7 +2245,7 @@ var vn = class {
2264
2245
  let l = 1e3 / e, u = 0, d, f = () => {
2265
2246
  let e = [];
2266
2247
  return t.document.querySelectorAll("canvas").forEach((t) => {
2267
- K(t, n, r, !0) || e.push(t);
2248
+ B(t, n, r, !0) || e.push(t);
2268
2249
  }), e;
2269
2250
  }, p = (e) => {
2270
2251
  if (u && e - u < l) {
@@ -2294,7 +2275,7 @@ var vn = class {
2294
2275
  }
2295
2276
  initCanvasMutationObserver(e, t, n) {
2296
2277
  this.startRAFTimestamping(), this.startPendingCanvasMutationFlusher();
2297
- let r = fn(e, t, n, !1), i = un(this.processMutation.bind(this), e, t, n), a = mn(this.processMutation.bind(this), e, t, n);
2278
+ let r = vn(e, t, n, !1), i = gn(this.processMutation.bind(this), e, t, n), a = bn(this.processMutation.bind(this), e, t, n);
2298
2279
  this.resetObservers = () => {
2299
2280
  r(), i(), a();
2300
2281
  };
@@ -2328,9 +2309,9 @@ var vn = class {
2328
2309
  commands: r
2329
2310
  }), this.pendingCanvasMutations.delete(e);
2330
2311
  }
2331
- }, yn = class {
2312
+ }, Tn = class {
2332
2313
  constructor(e) {
2333
- n(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet()), n(this, "mutationCb"), n(this, "adoptedStyleSheetCb"), n(this, "styleMirror", new dt()), this.mutationCb = e.mutationCb, this.adoptedStyleSheetCb = e.adoptedStyleSheetCb;
2314
+ n(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet()), n(this, "mutationCb"), n(this, "adoptedStyleSheetCb"), n(this, "styleMirror", new _t()), this.mutationCb = e.mutationCb, this.adoptedStyleSheetCb = e.adoptedStyleSheetCb;
2334
2315
  }
2335
2316
  attachLinkElement(e, t) {
2336
2317
  "_cssText" in t.attributes && this.mutationCb({
@@ -2357,7 +2338,7 @@ var vn = class {
2357
2338
  this.styleMirror.has(t) ? e = this.styleMirror.getId(t) : (e = this.styleMirror.add(t), r.push({
2358
2339
  styleId: e,
2359
2340
  rules: Array.from(t.rules || CSSRule, (e, n) => ({
2360
- rule: ae(e, t.href),
2341
+ rule: ce(e, t.href),
2361
2342
  index: n
2362
2343
  }))
2363
2344
  })), n.styleIds.push(e);
@@ -2368,7 +2349,7 @@ var vn = class {
2368
2349
  this.styleMirror.reset(), this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
2369
2350
  }
2370
2351
  trackStylesheetInLinkElement(e) {}
2371
- }, bn = class {
2352
+ }, En = class {
2372
2353
  constructor() {
2373
2354
  n(this, "nodeMap", /* @__PURE__ */ new WeakMap()), n(this, "active", !1);
2374
2355
  }
@@ -2382,7 +2363,7 @@ var vn = class {
2382
2363
  })), this.nodeMap.set(e, (this.nodeMap.get(e) || /* @__PURE__ */ new Set()).add(t));
2383
2364
  }
2384
2365
  destroy() {}
2385
- }, X, xn, Sn, Cn = !1;
2366
+ }, K, Dn, On, kn = !1;
2386
2367
  try {
2387
2368
  if (Array.from([1], (e) => e * 2)[0] !== 2) {
2388
2369
  let e = document.createElement("iframe");
@@ -2391,20 +2372,21 @@ try {
2391
2372
  } catch (e) {
2392
2373
  console.debug("Unable to override Array.from", e);
2393
2374
  }
2394
- var Z = R();
2395
- function wn(e = {}) {
2396
- let { emit: t, checkoutEveryNms: n, checkoutEveryNth: a, blockClass: o = "rr-block", blockSelector: s = null, ignoreClass: c = "rr-ignore", ignoreSelector: l = null, maskTextClass: u = "rr-mask", maskTextSelector: d = null, inlineStylesheet: f = !0, maskAllInputs: p, maskInputOptions: m, slimDOMOptions: h, maskInputFn: g, maskTextFn: _, hooks: v, packFn: y, sampling: b = {}, dataURLOptions: x = {}, mousemoveWait: S, recordDOM: C = !0, recordCanvas: w = !1, recordCrossOriginIframes: ee = !1, recordAfter: T = e.recordAfter === "DOMContentLoaded" ? e.recordAfter : "load", userTriggeredOnInput: E = !1, collectFonts: D = !1, inlineImages: O = !1, plugins: k, keepIframeSrcFn: A = () => !1, ignoreCSSAttributes: j = /* @__PURE__ */ new Set([]), errorHandler: M } = e;
2397
- Dt(M);
2398
- let P = !ee || window.parent === window, F = !1;
2399
- if (!P) try {
2400
- window.parent.document && (F = !1);
2375
+ var q = F();
2376
+ function An(e = {}) {
2377
+ let { emit: t, checkoutEveryNms: n, checkoutEveryNth: a, blockClass: o = "rr-block", blockSelector: s = null, ignoreClass: c = "rr-ignore", ignoreSelector: l = null, maskTextClass: u = "rr-mask", maskTextSelector: d = null, inlineStylesheet: f = !0, maskAllInputs: p, maskInputOptions: m, slimDOMOptions: h, maskInputFn: g, maskTextFn: _, hooks: v, packFn: y, sampling: b = {}, dataURLOptions: x = {}, mousemoveWait: S, recordDOM: C = !0, recordCanvas: w = !1, recordCrossOriginIframes: ee = !1, recordAfter: T = e.recordAfter === "DOMContentLoaded" ? e.recordAfter : "load", userTriggeredOnInput: E = !1, collectFonts: D = !1, inlineImages: O = !1, plugins: k, keepIframeSrcFn: te = () => !1, ignoreCSSAttributes: ne = /* @__PURE__ */ new Set([]), errorHandler: A } = e;
2378
+ if (H) return () => {};
2379
+ Mt = e.onMutation, Nt(A);
2380
+ let ie = !ee || window.parent === window, M = !1;
2381
+ if (!ie) try {
2382
+ window.parent.document && (M = !1);
2401
2383
  } catch {
2402
- F = !0;
2384
+ M = !0;
2403
2385
  }
2404
- if (P && !t) throw Error("emit function is required");
2405
- if (!P && !F) return () => {};
2406
- S !== void 0 && b.mousemove === void 0 && (b.mousemove = S), Z.reset();
2407
- let I = p === !0 ? {
2386
+ if (ie && !t) throw Error("emit function is required");
2387
+ if (!ie && !M) return () => {};
2388
+ S !== void 0 && b.mousemove === void 0 && (b.mousemove = S), q.reset();
2389
+ let N = p === !0 ? {
2408
2390
  color: !0,
2409
2391
  date: !0,
2410
2392
  "datetime-local": !0,
@@ -2421,208 +2403,208 @@ function wn(e = {}) {
2421
2403
  textarea: !0,
2422
2404
  select: !0,
2423
2405
  password: !0
2424
- } : m === void 0 ? { password: !0 } : m, ne = Ke(h);
2425
- st();
2426
- let re, ie = 0, ae = (e) => {
2406
+ } : m === void 0 ? { password: !0 } : m, ae = Xe(h);
2407
+ pt();
2408
+ let oe, se = 0, ce = (e) => {
2427
2409
  for (let t of k || []) t.eventProcessor && (e = t.eventProcessor(e));
2428
- return y && !F && (e = y(e)), e;
2410
+ return y && !M && (e = y(e)), e;
2429
2411
  };
2430
- X = (e, o) => {
2412
+ K = (e, o) => {
2431
2413
  let s = e;
2432
- if (s.timestamp = te(), J[0]?.isFrozen() && s.type !== r.FullSnapshot && (s.type !== r.IncrementalSnapshot || s.data.source !== i.Mutation) && J.forEach((e) => e.unfreeze()), P) t?.(ae(s), o);
2433
- else if (F) {
2414
+ if (s.timestamp = re(), G[0]?.isFrozen() && s.type !== r.FullSnapshot && (s.type !== r.IncrementalSnapshot || s.data.source !== i.Mutation) && G.forEach((e) => e.unfreeze()), ie) t?.(ce(s), o);
2415
+ else if (M) {
2434
2416
  let e = {
2435
2417
  type: "rrweb",
2436
- event: ae(s),
2418
+ event: ce(s),
2437
2419
  origin: window.location.origin,
2438
2420
  isCheckout: o
2439
2421
  };
2440
2422
  window.parent.postMessage(e, "*");
2441
2423
  }
2442
- if (s.type === r.FullSnapshot) re = s, ie = 0;
2424
+ if (s.type === r.FullSnapshot) oe = s, se = 0;
2443
2425
  else if (s.type === r.IncrementalSnapshot) {
2444
2426
  if (s.data.source === i.Mutation && s.data.isAttachIframe) return;
2445
- ie++;
2446
- let e = a && ie >= a, t = n && s.timestamp - re.timestamp > n;
2447
- (e || t) && xn(!0);
2427
+ se++;
2428
+ let e = a && se >= a, t = n && s.timestamp - oe.timestamp > n;
2429
+ (e || t) && Dn(!0);
2448
2430
  }
2449
2431
  };
2450
- let oe = (e) => {
2451
- X({
2432
+ let le = (e) => {
2433
+ K({
2452
2434
  type: r.IncrementalSnapshot,
2453
2435
  data: {
2454
2436
  source: i.Mutation,
2455
2437
  ...e
2456
2438
  }
2457
2439
  });
2458
- }, se = (e) => X({
2440
+ }, ue = (e) => K({
2459
2441
  type: r.IncrementalSnapshot,
2460
2442
  data: {
2461
2443
  source: i.Scroll,
2462
2444
  ...e
2463
2445
  }
2464
- }), ce = (e) => X({
2446
+ }), de = (e) => K({
2465
2447
  type: r.IncrementalSnapshot,
2466
2448
  data: {
2467
2449
  source: i.CanvasMutation,
2468
2450
  ...e
2469
2451
  }
2470
- }), L = new yn({
2471
- mutationCb: oe,
2472
- adoptedStyleSheetCb: (e) => X({
2452
+ }), P = new Tn({
2453
+ mutationCb: le,
2454
+ adoptedStyleSheetCb: (e) => K({
2473
2455
  type: r.IncrementalSnapshot,
2474
2456
  data: {
2475
2457
  source: i.AdoptedStyleSheet,
2476
2458
  ...e
2477
2459
  }
2478
2460
  })
2479
- }), R = new Zt({
2480
- mirror: Z,
2481
- mutationCb: oe,
2482
- stylesheetManager: L,
2461
+ }), F = new rn({
2462
+ mirror: q,
2463
+ mutationCb: le,
2464
+ stylesheetManager: P,
2483
2465
  recordCrossOriginIframes: ee,
2484
- wrappedEmit: X
2466
+ wrappedEmit: K
2485
2467
  });
2486
2468
  for (let e of k || []) e.getMirror && e.getMirror({
2487
- nodeMirror: Z,
2488
- crossOriginIframeMirror: R.crossOriginIframeMirror,
2489
- crossOriginIframeStyleMirror: R.crossOriginIframeStyleMirror
2469
+ nodeMirror: q,
2470
+ crossOriginIframeMirror: F.crossOriginIframeMirror,
2471
+ crossOriginIframeStyleMirror: F.crossOriginIframeStyleMirror
2490
2472
  });
2491
- let z = new bn();
2492
- Sn = new vn({
2473
+ let I = new En();
2474
+ On = new wn({
2493
2475
  recordCanvas: w,
2494
- mutationCb: ce,
2476
+ mutationCb: de,
2495
2477
  win: window,
2496
2478
  blockClass: o,
2497
2479
  blockSelector: s,
2498
- mirror: Z,
2480
+ mirror: q,
2499
2481
  sampling: b.canvas,
2500
2482
  dataURLOptions: x
2501
2483
  });
2502
- let B = new Qt({
2503
- mutationCb: oe,
2504
- scrollCb: se,
2484
+ let L = new an({
2485
+ mutationCb: le,
2486
+ scrollCb: ue,
2505
2487
  bypassOptions: {
2506
2488
  blockClass: o,
2507
2489
  blockSelector: s,
2508
2490
  maskTextClass: u,
2509
2491
  maskTextSelector: d,
2510
2492
  inlineStylesheet: f,
2511
- maskInputOptions: I,
2493
+ maskInputOptions: N,
2512
2494
  dataURLOptions: x,
2513
2495
  maskTextFn: _,
2514
2496
  maskInputFn: g,
2515
2497
  recordCanvas: w,
2516
2498
  inlineImages: O,
2517
2499
  sampling: b,
2518
- slimDOMOptions: ne,
2519
- iframeManager: R,
2520
- stylesheetManager: L,
2521
- canvasManager: Sn,
2522
- keepIframeSrcFn: A,
2523
- processedNodeManager: z
2500
+ slimDOMOptions: ae,
2501
+ iframeManager: F,
2502
+ stylesheetManager: P,
2503
+ canvasManager: On,
2504
+ keepIframeSrcFn: te,
2505
+ processedNodeManager: I
2524
2506
  },
2525
- mirror: Z
2507
+ mirror: q
2526
2508
  });
2527
- xn = (e = !1) => {
2509
+ Dn = (e = !1) => {
2528
2510
  if (!C) return;
2529
- X({
2511
+ K({
2530
2512
  type: r.Meta,
2531
2513
  data: {
2532
2514
  href: window.location.href,
2533
- width: tt(),
2534
- height: et()
2515
+ width: st(),
2516
+ height: ot()
2535
2517
  }
2536
- }, e), L.reset(), B.init(), J.forEach((e) => e.lock());
2537
- let t = Je(document, {
2538
- mirror: Z,
2518
+ }, e), P.reset(), L.init(), G.forEach((e) => e.lock());
2519
+ let t = $e(document, {
2520
+ mirror: q,
2539
2521
  blockClass: o,
2540
2522
  blockSelector: s,
2541
2523
  maskTextClass: u,
2542
2524
  maskTextSelector: d,
2543
2525
  inlineStylesheet: f,
2544
- maskAllInputs: I,
2526
+ maskAllInputs: N,
2545
2527
  maskTextFn: _,
2546
2528
  maskInputFn: g,
2547
- slimDOM: ne,
2529
+ slimDOM: ae,
2548
2530
  dataURLOptions: x,
2549
2531
  recordCanvas: w,
2550
2532
  inlineImages: O,
2551
2533
  onSerialize: (e) => {
2552
- ct(e, Z) && R.addIframe(e), lt(e, Z) && L.trackLinkElement(e), ut(e) && B.addShadowRoot(N.shadowRoot(e), document);
2534
+ mt(e, q) && F.addIframe(e), ht(e, q) && P.trackLinkElement(e), gt(e) && L.addShadowRoot(j.shadowRoot(e), document);
2553
2535
  },
2554
2536
  onIframeLoad: (e, t) => {
2555
- R.attachIframe(e, t), B.observeAttachShadow(e);
2537
+ F.attachIframe(e, t), L.observeAttachShadow(e);
2556
2538
  },
2557
2539
  onStylesheetLoad: (e, t) => {
2558
- L.attachLinkElement(e, t);
2540
+ P.attachLinkElement(e, t);
2559
2541
  },
2560
- keepIframeSrcFn: A
2542
+ keepIframeSrcFn: te
2561
2543
  });
2562
2544
  if (!t) return console.warn("Failed to snapshot the document");
2563
- X({
2545
+ K({
2564
2546
  type: r.FullSnapshot,
2565
2547
  data: {
2566
2548
  node: t,
2567
- initialOffset: $e(window)
2549
+ initialOffset: at(window)
2568
2550
  }
2569
- }, e), J.forEach((e) => e.unlock()), document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0 && L.adoptStyleSheets(document.adoptedStyleSheets, Z.getId(document));
2551
+ }, e), G.forEach((e) => e.unlock()), document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0 && P.adoptStyleSheets(document.adoptedStyleSheets, q.getId(document));
2570
2552
  };
2571
2553
  try {
2572
- let e = [], t = (e) => q(qt)({
2573
- mutationCb: oe,
2574
- mousemoveCb: (e, t) => X({
2554
+ let e = [], t = (e) => U($t)({
2555
+ mutationCb: le,
2556
+ mousemoveCb: (e, t) => K({
2575
2557
  type: r.IncrementalSnapshot,
2576
2558
  data: {
2577
2559
  source: t,
2578
2560
  positions: e
2579
2561
  }
2580
2562
  }),
2581
- mouseInteractionCb: (e) => X({
2563
+ mouseInteractionCb: (e) => K({
2582
2564
  type: r.IncrementalSnapshot,
2583
2565
  data: {
2584
2566
  source: i.MouseInteraction,
2585
2567
  ...e
2586
2568
  }
2587
2569
  }),
2588
- scrollCb: se,
2589
- viewportResizeCb: (e) => X({
2570
+ scrollCb: ue,
2571
+ viewportResizeCb: (e) => K({
2590
2572
  type: r.IncrementalSnapshot,
2591
2573
  data: {
2592
2574
  source: i.ViewportResize,
2593
2575
  ...e
2594
2576
  }
2595
2577
  }),
2596
- inputCb: (e) => X({
2578
+ inputCb: (e) => K({
2597
2579
  type: r.IncrementalSnapshot,
2598
2580
  data: {
2599
2581
  source: i.Input,
2600
2582
  ...e
2601
2583
  }
2602
2584
  }),
2603
- mediaInteractionCb: (e) => X({
2585
+ mediaInteractionCb: (e) => K({
2604
2586
  type: r.IncrementalSnapshot,
2605
2587
  data: {
2606
2588
  source: i.MediaInteraction,
2607
2589
  ...e
2608
2590
  }
2609
2591
  }),
2610
- styleSheetRuleCb: (e) => X({
2592
+ styleSheetRuleCb: (e) => K({
2611
2593
  type: r.IncrementalSnapshot,
2612
2594
  data: {
2613
2595
  source: i.StyleSheetRule,
2614
2596
  ...e
2615
2597
  }
2616
2598
  }),
2617
- styleDeclarationCb: (e) => X({
2599
+ styleDeclarationCb: (e) => K({
2618
2600
  type: r.IncrementalSnapshot,
2619
2601
  data: {
2620
2602
  source: i.StyleDeclaration,
2621
2603
  ...e
2622
2604
  }
2623
2605
  }),
2624
- canvasMutationCb: ce,
2625
- fontCb: (e) => X({
2606
+ canvasMutationCb: de,
2607
+ fontCb: (e) => K({
2626
2608
  type: r.IncrementalSnapshot,
2627
2609
  data: {
2628
2610
  source: i.Font,
@@ -2630,7 +2612,7 @@ function wn(e = {}) {
2630
2612
  }
2631
2613
  }),
2632
2614
  selectionCb: (e) => {
2633
- X({
2615
+ K({
2634
2616
  type: r.IncrementalSnapshot,
2635
2617
  data: {
2636
2618
  source: i.Selection,
@@ -2639,7 +2621,7 @@ function wn(e = {}) {
2639
2621
  });
2640
2622
  },
2641
2623
  customElementCb: (e) => {
2642
- X({
2624
+ K({
2643
2625
  type: r.IncrementalSnapshot,
2644
2626
  data: {
2645
2627
  source: i.CustomElement,
@@ -2652,7 +2634,7 @@ function wn(e = {}) {
2652
2634
  ignoreSelector: l,
2653
2635
  maskTextClass: u,
2654
2636
  maskTextSelector: d,
2655
- maskInputOptions: I,
2637
+ maskInputOptions: N,
2656
2638
  inlineStylesheet: f,
2657
2639
  sampling: b,
2658
2640
  recordDOM: C,
@@ -2663,21 +2645,21 @@ function wn(e = {}) {
2663
2645
  doc: e,
2664
2646
  maskInputFn: g,
2665
2647
  maskTextFn: _,
2666
- keepIframeSrcFn: A,
2648
+ keepIframeSrcFn: te,
2667
2649
  blockSelector: s,
2668
- slimDOMOptions: ne,
2650
+ slimDOMOptions: ae,
2669
2651
  dataURLOptions: x,
2670
- mirror: Z,
2671
- iframeManager: R,
2672
- stylesheetManager: L,
2673
- shadowDomManager: B,
2674
- processedNodeManager: z,
2675
- canvasManager: Sn,
2676
- ignoreCSSAttributes: j,
2652
+ mirror: q,
2653
+ iframeManager: F,
2654
+ stylesheetManager: P,
2655
+ shadowDomManager: L,
2656
+ processedNodeManager: I,
2657
+ canvasManager: On,
2658
+ ignoreCSSAttributes: ne,
2677
2659
  plugins: (k?.filter((e) => e.observer))?.map((e) => ({
2678
2660
  observer: e.observer,
2679
2661
  options: e.options,
2680
- callback: (t) => X({
2662
+ callback: (t) => K({
2681
2663
  type: r.Plugin,
2682
2664
  data: {
2683
2665
  plugin: e.name,
@@ -2686,102 +2668,265 @@ function wn(e = {}) {
2686
2668
  })
2687
2669
  })) || []
2688
2670
  }, v);
2689
- R.addLoadListener((n) => {
2671
+ F.addLoadListener((n) => {
2690
2672
  try {
2691
2673
  e.push(t(n.contentDocument));
2692
2674
  } catch (e) {
2693
- console.warn(e);
2675
+ V && V(e) === !0 || console.warn(e);
2694
2676
  }
2695
2677
  });
2696
2678
  let n = () => {
2697
- xn(), e.push(t(document)), Cn = !0;
2679
+ Dn(), e.push(t(document)), kn = !0;
2698
2680
  };
2699
- return ["interactive", "complete"].includes(document.readyState) ? n() : (e.push(W("DOMContentLoaded", () => {
2700
- X({
2681
+ return ["interactive", "complete"].includes(document.readyState) ? n() : (e.push(z("DOMContentLoaded", () => {
2682
+ K({
2701
2683
  type: r.DomContentLoaded,
2702
2684
  data: {}
2703
2685
  }), T === "DOMContentLoaded" && n();
2704
- })), e.push(W("load", () => {
2705
- X({
2686
+ })), e.push(z("load", () => {
2687
+ K({
2706
2688
  type: r.Load,
2707
2689
  data: {}
2708
2690
  }), T === "load" && n();
2709
2691
  }, window))), () => {
2710
- e.forEach((e) => {
2692
+ H = !0, e.forEach((e) => {
2711
2693
  try {
2712
2694
  e();
2713
2695
  } catch (e) {
2714
- String(e).toLowerCase().includes("cross-origin") || console.warn(e);
2696
+ !String(e).toLowerCase().includes("cross-origin") && !(V && V(e) === !0) && console.warn(e);
2715
2697
  }
2716
- }), z.destroy(), Cn = !1, Ot();
2698
+ }), I.destroy(), q.reset(), P.reset(), kn = !1;
2717
2699
  };
2718
2700
  } catch (e) {
2719
- console.warn(e);
2701
+ V && V(e) === !0 || console.warn(e);
2720
2702
  }
2721
2703
  }
2722
- wn.addCustomEvent = (e, t) => {
2723
- if (!Cn) throw Error("please add custom event after start recording");
2724
- X({
2704
+ An.addCustomEvent = (e, t) => {
2705
+ if (!kn) throw Error("please add custom event after start recording");
2706
+ K({
2725
2707
  type: r.Custom,
2726
2708
  data: {
2727
2709
  tag: e,
2728
2710
  payload: t
2729
2711
  }
2730
2712
  });
2731
- }, wn.freezePage = () => {
2732
- J.forEach((e) => e.freeze());
2733
- }, wn.takeFullSnapshot = (e) => {
2734
- if (!Cn) throw Error("please take full snapshot after start recording");
2735
- xn(e);
2736
- }, wn.mirror = Z;
2713
+ }, An.freezePage = () => {
2714
+ G.forEach((e) => e.freeze());
2715
+ }, An.takeFullSnapshot = (e) => {
2716
+ if (!kn) throw Error("please take full snapshot after start recording");
2717
+ Dn(e);
2718
+ }, An.mirror = q;
2719
+ //#endregion
2720
+ //#region ../protocol/src/end.ts
2721
+ var jn = "mime8/end@1", Mn = "mime8/environment@1";
2722
+ //#endregion
2723
+ //#region ../protocol/src/hash.ts
2724
+ function Nn(e) {
2725
+ let t = 2166136261;
2726
+ for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
2727
+ return (t >>> 0).toString(16).padStart(8, "0");
2728
+ }
2729
+ //#endregion
2730
+ //#region ../protocol/src/keys.ts
2731
+ var Pn = "mime8/keys@1", Fn = "mime8/rrweb-error@1", In = "mime8/network@1", Ln = "mime8/storage@1", Rn = "mime8/storage-change@1";
2732
+ //#endregion
2733
+ //#region ../protocol/src/storage-wrap.ts
2734
+ function zn(e, t, n, r) {
2735
+ let i = (e) => {
2736
+ try {
2737
+ e();
2738
+ } catch {}
2739
+ }, a = e, o = (e) => {
2740
+ let t = null;
2741
+ return i(() => {
2742
+ e === a.localStorage ? t = "local" : e === a.sessionStorage && (t = "session");
2743
+ }), t;
2744
+ }, s = a.Storage.prototype, { setItem: c, removeItem: l, clear: u } = s;
2745
+ return s.setItem = function(e, a) {
2746
+ let s = Reflect.apply(c, this, arguments);
2747
+ return i(() => {
2748
+ let i = o(this);
2749
+ if (i) {
2750
+ let o = String(a);
2751
+ t({
2752
+ by: "app",
2753
+ area: i,
2754
+ op: "set",
2755
+ key: String(e),
2756
+ size: o.length,
2757
+ hash: n(o)
2758
+ }), r?.(String(e), o);
2759
+ }
2760
+ }), s;
2761
+ }, s.removeItem = function(e) {
2762
+ let n = !1;
2763
+ i(() => {
2764
+ n = this.getItem(e) !== null;
2765
+ });
2766
+ let r = Reflect.apply(l, this, arguments);
2767
+ return i(() => {
2768
+ let r = o(this);
2769
+ r && n && t({
2770
+ by: "app",
2771
+ area: r,
2772
+ op: "remove",
2773
+ key: String(e)
2774
+ });
2775
+ }), r;
2776
+ }, s.clear = function() {
2777
+ let e = !0;
2778
+ i(() => {
2779
+ e = this.length === 0;
2780
+ });
2781
+ let n = Reflect.apply(u, this, arguments);
2782
+ return i(() => {
2783
+ let n = o(this);
2784
+ n && !e && t({
2785
+ by: "app",
2786
+ area: n,
2787
+ op: "clear"
2788
+ });
2789
+ }), n;
2790
+ }, {
2791
+ setItem: c,
2792
+ removeItem: l,
2793
+ clear: u
2794
+ };
2795
+ }
2796
+ //#endregion
2797
+ //#region src/upload/stream.ts
2798
+ function Bn(e) {
2799
+ return {
2800
+ type: 6,
2801
+ timestamp: e.t,
2802
+ data: {
2803
+ plugin: In,
2804
+ payload: e
2805
+ }
2806
+ };
2807
+ }
2808
+ function Vn(e, t) {
2809
+ return {
2810
+ type: 6,
2811
+ timestamp: t,
2812
+ data: {
2813
+ plugin: Ln,
2814
+ payload: e
2815
+ }
2816
+ };
2817
+ }
2818
+ function Hn(e, t) {
2819
+ return {
2820
+ type: 6,
2821
+ timestamp: t,
2822
+ data: {
2823
+ plugin: Mn,
2824
+ payload: e
2825
+ }
2826
+ };
2827
+ }
2828
+ function Un(e, t) {
2829
+ return {
2830
+ type: 6,
2831
+ timestamp: t,
2832
+ data: {
2833
+ plugin: jn,
2834
+ payload: e
2835
+ }
2836
+ };
2837
+ }
2737
2838
  //#endregion
2738
2839
  //#region src/upload/buffer.ts
2739
- var Tn = 2;
2740
- function En(e, t = (e) => e) {
2741
- let n = [], r = 0, i = Infinity, a = -Infinity, o = !1, s = /* @__PURE__ */ new Set(), c = null;
2742
- function l() {
2743
- n = [], r = 0, i = Infinity, a = -Infinity, o = !1, s = /* @__PURE__ */ new Set(), c = null;
2840
+ var Wn = 2, Gn = 3, Kn = 5, qn = (e) => e.reduce((e, t) => e + t.length, 0);
2841
+ function Jn(e, t = (e) => e, n = Infinity, r = () => {}, i = () => []) {
2842
+ let a = [], o = [], s = 0, c = 0, l = !1, u = null, d = "", f = /* @__PURE__ */ new WeakMap();
2843
+ function p() {
2844
+ l || (l = !0, r());
2845
+ }
2846
+ function m(n, r) {
2847
+ let i = location.href;
2848
+ i !== u && (u = i, d = t(i));
2849
+ let c = n.data;
2850
+ e.events.push(n), a.push(r), o.push({
2851
+ timestamp: n.timestamp,
2852
+ full: n.type === Wn,
2853
+ input: n.type === Gn && c?.source === Kn,
2854
+ url: d
2855
+ }), s += r.length;
2856
+ }
2857
+ function h(e) {
2858
+ l || (m(e, JSON.stringify(e)), p());
2744
2859
  }
2745
2860
  return {
2746
- push(l) {
2747
- let u = JSON.stringify(l);
2748
- e.events.push(l), n.push(u), r += u.length, i = Math.min(i, l.timestamp), a = Math.max(a, l.timestamp), l.type === Tn && (o = !0);
2749
- let d = location.href;
2750
- d !== c && (s.add(t(d)), c = d);
2861
+ push(e) {
2862
+ if (l) return;
2863
+ let t = JSON.stringify(e);
2864
+ if (s + c + t.length > n) {
2865
+ h(Un({
2866
+ reason: "buffer",
2867
+ limitBytes: n,
2868
+ eventBytes: t.length
2869
+ }, Date.now()));
2870
+ return;
2871
+ }
2872
+ m(e, t);
2751
2873
  },
2752
- bytes: () => r,
2753
- take() {
2754
- if (e.events.length === 0) return null;
2755
- let t = {
2756
- events: e.events,
2757
- json: `{"events":[${n.join(",")}]}`,
2758
- parts: n,
2759
- bytes: r,
2760
- start: i,
2761
- end: a,
2762
- hasFullSnapshot: o,
2763
- urls: [...s]
2874
+ bytes: () => s,
2875
+ take({ hold: t = 0 } = {}) {
2876
+ let n = e.events.length;
2877
+ if (t > 0) {
2878
+ let e = Date.now() - t, r = o.findIndex((t) => t.input && t.timestamp >= e);
2879
+ r !== -1 && (n = r);
2880
+ }
2881
+ if (n === 0) return null;
2882
+ let r = e.events.slice(0, n), l = a.slice(0, n), u = o.slice(0, n);
2883
+ e.events = e.events.slice(n), a = a.slice(n), o = o.slice(n), s -= qn(l);
2884
+ let d = new Set(i(r, l));
2885
+ if (d.size > 0) {
2886
+ let e = (e, t) => !d.has(t);
2887
+ r.splice(0, r.length, ...r.filter(e)), l.splice(0, l.length, ...l.filter(e)), u = u.filter(e);
2888
+ }
2889
+ if (r.length === 0) return null;
2890
+ let p = Infinity, m = -Infinity;
2891
+ for (let { timestamp: e } of u) p = Math.min(p, e), m = Math.max(m, e);
2892
+ let h = {
2893
+ events: r,
2894
+ json: `{"events":[${l.join(",")}]}`,
2895
+ parts: l,
2896
+ bytes: qn(l),
2897
+ start: p,
2898
+ end: m,
2899
+ hasFullSnapshot: u.some((e) => e.full),
2900
+ urls: [...new Set(u.map((e) => e.url))]
2764
2901
  };
2765
- return e.events = [], l(), t;
2902
+ return c += h.bytes, f.set(h, u), h;
2766
2903
  },
2767
2904
  restore(t) {
2768
- e.events = [...t.events, ...e.events], n = [...t.parts, ...n], r += t.bytes, i = Math.min(i, t.start), a = Math.max(a, t.end), o ||= t.hasFullSnapshot, s = /* @__PURE__ */ new Set([...t.urls, ...s]);
2769
- }
2905
+ c -= t.bytes, e.events = [...t.events, ...e.events], a = [...t.parts, ...a], o = [...f.get(t) ?? [], ...o], s += t.bytes;
2906
+ },
2907
+ release(e) {
2908
+ c -= e.bytes;
2909
+ },
2910
+ end: h,
2911
+ close: p
2770
2912
  };
2771
2913
  }
2772
2914
  //#endregion
2773
2915
  //#region src/config.ts
2774
- var Q = {
2916
+ var J = {
2775
2917
  collectorUrl: "https://api.mime8.com",
2776
- recorderVersion: "0.1.0",
2918
+ recorderVersion: "0.2.0",
2777
2919
  ignoreUrls: [],
2778
2920
  maxBodySize: 1024 * 1024,
2779
2921
  redact: [
2780
2922
  { header: /authorization|cookie|token|secret|api-?key|forwarded/i },
2781
2923
  { queryParam: /token|secret|password|api_?key|signature|credential/i },
2782
- { bodyField: /password|passwd|secret|token|api_?key/i }
2924
+ { bodyField: /password|passwd|secret|token|api_?key/i },
2925
+ { bodyField: /^hash$/i }
2783
2926
  ],
2784
2927
  earlyUploadBytes: 256 * 1024,
2928
+ maxBufferBytes: 5 * 1024 * 1024,
2929
+ maxBatchChanges: 1e4,
2785
2930
  uploadInterval: 1e4,
2786
2931
  streamingTypes: [
2787
2932
  "text/event-stream",
@@ -2804,45 +2949,45 @@ var Q = {
2804
2949
  "application/wasm"
2805
2950
  ]
2806
2951
  };
2807
- function Dn(e) {
2952
+ function Yn(e) {
2808
2953
  let t = e.network ?? {}, n = t.redact ?? {};
2809
2954
  return {
2810
- ...Q,
2955
+ ...J,
2811
2956
  projectKey: e.projectKey,
2812
- collectorUrl: e.collectorUrl ?? Q.collectorUrl,
2813
- ignoreUrls: [...Q.ignoreUrls, ...t.ignoreUrls ?? []],
2814
- maxBodySize: t.maxBodySize ?? Q.maxBodySize,
2957
+ collectorUrl: e.collectorUrl ?? J.collectorUrl,
2958
+ ignoreUrls: [...J.ignoreUrls, ...t.ignoreUrls ?? []],
2959
+ maxBodySize: t.maxBodySize ?? J.maxBodySize,
2815
2960
  redact: [
2816
- ...Q.redact,
2961
+ ...J.redact,
2817
2962
  ...(n.headers ?? []).map((e) => ({ header: e })),
2818
2963
  ...(n.queryParams ?? []).map((e) => ({ queryParam: e })),
2819
2964
  ...(n.bodyFields ?? []).map((e) => ({ bodyField: e }))
2820
2965
  ],
2821
2966
  beforeRecord: t.beforeRecord,
2822
- streamingTypes: [...Q.streamingTypes],
2823
- mediaTypes: [...Q.mediaTypes]
2967
+ streamingTypes: [...J.streamingTypes],
2968
+ mediaTypes: [...J.mediaTypes]
2824
2969
  };
2825
2970
  }
2826
2971
  //#endregion
2827
2972
  //#region src/capture/body.ts
2828
- var On = new TextDecoder("utf-8", {
2973
+ var Xn = new TextDecoder("utf-8", {
2829
2974
  fatal: !0,
2830
2975
  ignoreBOM: !0
2831
2976
  });
2832
- function kn(e) {
2977
+ function Zn(e) {
2833
2978
  if (typeof e.toBase64 == "function") return e.toBase64();
2834
2979
  let t = "";
2835
2980
  for (let n = 0; n < e.length; n += 32768) t += String.fromCharCode(...e.subarray(n, n + 32768));
2836
2981
  return btoa(t);
2837
2982
  }
2838
- function An(e) {
2983
+ function Qn(e) {
2839
2984
  try {
2840
- return { text: On.decode(e) };
2985
+ return { text: Xn.decode(e) };
2841
2986
  } catch {
2842
- return { base64: kn(e) };
2987
+ return { base64: Zn(e) };
2843
2988
  }
2844
2989
  }
2845
- function jn(e) {
2990
+ function $n(e) {
2846
2991
  for (let t = e.length - 1; t >= Math.max(0, e.length - 3); t--) {
2847
2992
  let n = e[t];
2848
2993
  if ((n & 192) == 128) continue;
@@ -2851,37 +2996,37 @@ function jn(e) {
2851
2996
  }
2852
2997
  return e.length;
2853
2998
  }
2854
- function Mn(e, t) {
2999
+ function er(e, t) {
2855
3000
  if (e.length === 0) return t;
2856
3001
  let n = new Uint8Array(e.length + t.length);
2857
3002
  return n.set(e), n.set(t, e.length), n;
2858
3003
  }
2859
- function Nn() {
3004
+ function tr() {
2860
3005
  let e = /* @__PURE__ */ new Uint8Array();
2861
3006
  return {
2862
3007
  push(t) {
2863
- let n = Mn(e, t), r = jn(n);
3008
+ let n = er(e, t), r = $n(n);
2864
3009
  try {
2865
- let t = On.decode(n.subarray(0, r));
3010
+ let t = Xn.decode(n.subarray(0, r));
2866
3011
  return e = n.slice(r), t ? { text: t } : null;
2867
3012
  } catch {
2868
- return e = /* @__PURE__ */ new Uint8Array(), { base64: kn(n) };
3013
+ return e = /* @__PURE__ */ new Uint8Array(), { base64: Zn(n) };
2869
3014
  }
2870
3015
  },
2871
3016
  end() {
2872
3017
  if (e.length === 0) return null;
2873
- let t = An(e);
3018
+ let t = Qn(e);
2874
3019
  return e = /* @__PURE__ */ new Uint8Array(), t;
2875
3020
  }
2876
3021
  };
2877
3022
  }
2878
- function Pn(e, t) {
3023
+ function nr(e, t) {
2879
3024
  return e > t.maxBodySize ? {
2880
3025
  omitted: "too-large",
2881
3026
  size: e
2882
3027
  } : null;
2883
3028
  }
2884
- function Fn(e) {
3029
+ function rr(e) {
2885
3030
  let t = 0;
2886
3031
  for (let n = 0; n < e.length; n++) {
2887
3032
  let r = e.charCodeAt(n);
@@ -2889,16 +3034,16 @@ function Fn(e) {
2889
3034
  }
2890
3035
  return t;
2891
3036
  }
2892
- function In(e, t) {
2893
- return e.length * 3 <= t.maxBodySize ? null : Pn(Fn(e), t);
3037
+ function ir(e, t) {
3038
+ return e.length * 3 <= t.maxBodySize ? null : nr(rr(e), t);
2894
3039
  }
2895
- async function Ln(e, t, n = !1) {
2896
- let r = Pn(e.size, t);
3040
+ async function ar(e, t, n = !1) {
3041
+ let r = nr(e.size, t);
2897
3042
  if (r) return r;
2898
3043
  let i = new Uint8Array(await e.arrayBuffer());
2899
- return n ? { base64: kn(i) } : An(i);
3044
+ return n ? { base64: Zn(i) } : Qn(i);
2900
3045
  }
2901
- function Rn(e) {
3046
+ function or(e) {
2902
3047
  let t = [];
2903
3048
  return e.forEach((e, n) => {
2904
3049
  t.push(typeof e == "string" ? {
@@ -2914,25 +3059,25 @@ function Rn(e) {
2914
3059
  });
2915
3060
  }), t;
2916
3061
  }
2917
- function zn(e, t) {
3062
+ function sr(e, t) {
2918
3063
  if (e != null) {
2919
3064
  if (typeof e == "string" || e instanceof URLSearchParams) {
2920
3065
  let n = e.toString();
2921
- return In(n, t) ?? { text: n };
3066
+ return ir(n, t) ?? { text: n };
2922
3067
  }
2923
- if (e instanceof FormData) return { form: Rn(e) };
2924
- if (e instanceof Blob) return Ln(e, t);
3068
+ if (e instanceof FormData) return { form: or(e) };
3069
+ if (e instanceof Blob) return ar(e, t);
2925
3070
  if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) {
2926
3071
  let n = e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
2927
- return Pn(n.byteLength, t) ?? An(n);
3072
+ return nr(n.byteLength, t) ?? Qn(n);
2928
3073
  }
2929
3074
  return e instanceof ReadableStream ? { omitted: "stream" } : { omitted: "unreadable" };
2930
3075
  }
2931
3076
  }
2932
- function Bn(e) {
3077
+ function cr(e) {
2933
3078
  return typeof e == "string" ? "text/plain;charset=UTF-8" : e instanceof URLSearchParams ? "application/x-www-form-urlencoded;charset=UTF-8" : e instanceof FormData ? "multipart/form-data" : e instanceof Blob && e.type || null;
2934
3079
  }
2935
- async function Vn(e, t) {
3080
+ async function lr(e, t) {
2936
3081
  let n = e.getReader(), r = [], i = 0;
2937
3082
  for (let e = await n.read(); !e.done; e = await n.read()) {
2938
3083
  if (i += e.value.byteLength, i > t) return n.cancel().catch(() => {}), null;
@@ -2944,26 +3089,26 @@ async function Vn(e, t) {
2944
3089
  }
2945
3090
  //#endregion
2946
3091
  //#region src/util/quietly.ts
2947
- function $(e) {
3092
+ function Y(e) {
2948
3093
  try {
2949
3094
  e();
2950
3095
  } catch {}
2951
3096
  }
2952
- function Hn(e) {
3097
+ function ur(e) {
2953
3098
  return e instanceof Error || e instanceof DOMException ? e.message : String(e);
2954
3099
  }
2955
3100
  //#endregion
2956
3101
  //#region src/capture/beacon.ts
2957
- function Un(e, t, n) {
3102
+ function dr(e, t, n) {
2958
3103
  let r = e.navigator;
2959
3104
  if (typeof r.sendBeacon != "function") return;
2960
- let i = r.sendBeacon.bind(r), a = (e) => $(() => t.emit(e));
3105
+ let i = r.sendBeacon.bind(r), a = (e) => Y(() => t.emit(e));
2961
3106
  r.sendBeacon = function(e, r) {
2962
3107
  let o = i(e, r);
2963
- return $(() => {
3108
+ return Y(() => {
2964
3109
  let i = new URL(String(e), document.baseURI).href;
2965
3110
  if (t.ignores(i)) return;
2966
- let s = t.nextId(), c = Date.now(), l = Bn(r), u = (e) => ({
3111
+ let s = t.nextId(), c = Date.now(), l = cr(r), u = (e) => ({
2967
3112
  type: "http-request",
2968
3113
  api: "beacon",
2969
3114
  method: "POST",
@@ -2973,7 +3118,7 @@ function Un(e, t, n) {
2973
3118
  queued: o,
2974
3119
  t: c,
2975
3120
  id: s
2976
- }), d = zn(r, n);
3121
+ }), d = sr(r, n);
2977
3122
  if (d instanceof Promise) {
2978
3123
  let e = t.place();
2979
3124
  d.catch(() => ({ omitted: "unreadable" })).then((t) => a({
@@ -2986,10 +3131,10 @@ function Un(e, t, n) {
2986
3131
  }
2987
3132
  //#endregion
2988
3133
  //#region src/capture/environment.ts
2989
- function Wn(e, t, n) {
3134
+ function fr(e, t, n) {
2990
3135
  return n.find((n) => e.matchMedia(`(${t}: ${n})`).matches) ?? "unknown";
2991
3136
  }
2992
- function Gn(e = window) {
3137
+ function pr(e = window) {
2993
3138
  let { navigator: t, screen: n } = e;
2994
3139
  return {
2995
3140
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -2998,14 +3143,14 @@ function Gn(e = window) {
2998
3143
  userAgent: t.userAgent,
2999
3144
  colorScheme: e.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light",
3000
3145
  reducedMotion: e.matchMedia("(prefers-reduced-motion: reduce)").matches,
3001
- hover: Wn(e, "hover", ["hover", "none"]),
3002
- anyHover: Wn(e, "any-hover", ["hover", "none"]),
3003
- pointer: Wn(e, "pointer", [
3146
+ hover: fr(e, "hover", ["hover", "none"]),
3147
+ anyHover: fr(e, "any-hover", ["hover", "none"]),
3148
+ pointer: fr(e, "pointer", [
3004
3149
  "fine",
3005
3150
  "coarse",
3006
3151
  "none"
3007
3152
  ]),
3008
- anyPointer: Wn(e, "any-pointer", [
3153
+ anyPointer: fr(e, "any-pointer", [
3009
3154
  "fine",
3010
3155
  "coarse",
3011
3156
  "none"
@@ -3018,85 +3163,8 @@ function Gn(e = window) {
3018
3163
  };
3019
3164
  }
3020
3165
  //#endregion
3021
- //#region ../protocol/src/environment.ts
3022
- var Kn = "mime8/environment@1";
3023
- //#endregion
3024
- //#region ../protocol/src/hash.ts
3025
- function qn(e) {
3026
- let t = 2166136261;
3027
- for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
3028
- return (t >>> 0).toString(16).padStart(8, "0");
3029
- }
3030
- //#endregion
3031
- //#region ../protocol/src/keys.ts
3032
- var Jn = "mime8/keys@1", Yn = "mime8/network@1", Xn = "mime8/storage@1", Zn = "mime8/storage-change@1";
3033
- //#endregion
3034
- //#region ../protocol/src/storage-wrap.ts
3035
- function Qn(e, t, n) {
3036
- let r = (e) => {
3037
- try {
3038
- e();
3039
- } catch {}
3040
- }, i = e, a = (e) => {
3041
- let t = null;
3042
- return r(() => {
3043
- e === i.localStorage ? t = "local" : e === i.sessionStorage && (t = "session");
3044
- }), t;
3045
- }, o = i.Storage.prototype, { setItem: s, removeItem: c, clear: l } = o;
3046
- return o.setItem = function(e, i) {
3047
- let o = Reflect.apply(s, this, arguments);
3048
- return r(() => {
3049
- let r = a(this);
3050
- if (r) {
3051
- let a = String(i);
3052
- t({
3053
- by: "app",
3054
- area: r,
3055
- op: "set",
3056
- key: String(e),
3057
- size: a.length,
3058
- hash: n(a)
3059
- });
3060
- }
3061
- }), o;
3062
- }, o.removeItem = function(e) {
3063
- let n = !1;
3064
- r(() => {
3065
- n = this.getItem(e) !== null;
3066
- });
3067
- let i = Reflect.apply(c, this, arguments);
3068
- return r(() => {
3069
- let r = a(this);
3070
- r && n && t({
3071
- by: "app",
3072
- area: r,
3073
- op: "remove",
3074
- key: String(e)
3075
- });
3076
- }), i;
3077
- }, o.clear = function() {
3078
- let e = !0;
3079
- r(() => {
3080
- e = this.length === 0;
3081
- });
3082
- let n = Reflect.apply(l, this, arguments);
3083
- return r(() => {
3084
- let n = a(this);
3085
- n && !e && t({
3086
- by: "app",
3087
- area: n,
3088
- op: "clear"
3089
- });
3090
- }), n;
3091
- }, {
3092
- setItem: s,
3093
- removeItem: c,
3094
- clear: l
3095
- };
3096
- }
3097
- //#endregion
3098
3166
  //#region src/capture/keys.ts
3099
- var $n = /* @__PURE__ */ new Set([
3167
+ var mr = /* @__PURE__ */ new Set([
3100
3168
  "Enter",
3101
3169
  "Escape",
3102
3170
  "Tab",
@@ -3110,40 +3178,40 @@ var $n = /* @__PURE__ */ new Set([
3110
3178
  "End",
3111
3179
  "PageUp",
3112
3180
  "PageDown"
3113
- ]), er = /* @__PURE__ */ new Set([
3181
+ ]), hr = /* @__PURE__ */ new Set([
3114
3182
  "button",
3115
3183
  "submit",
3116
3184
  "reset",
3117
3185
  "checkbox",
3118
3186
  "radio"
3119
- ]), tr = /* @__PURE__ */ new Set([
3187
+ ]), gr = /* @__PURE__ */ new Set([
3120
3188
  "button",
3121
3189
  "checkbox",
3122
3190
  "switch",
3123
3191
  "menuitem"
3124
3192
  ]);
3125
- function nr(e) {
3126
- return e instanceof Element ? e instanceof HTMLButtonElement ? !0 : e instanceof HTMLInputElement ? er.has(e.type) : tr.has(e.getAttribute("role") ?? "") : !1;
3193
+ function _r(e) {
3194
+ return e instanceof Element ? e instanceof HTMLButtonElement ? !0 : e instanceof HTMLInputElement ? hr.has(e.type) : gr.has(e.getAttribute("role") ?? "") : !1;
3127
3195
  }
3128
- function rr(e, t) {
3196
+ function vr(e, t) {
3129
3197
  if (e.isComposing || e.key === "Process" || e.keyCode === 229) return !1;
3130
- if ($n.has(e.key)) return !0;
3198
+ if (mr.has(e.key)) return !0;
3131
3199
  let { ctrlKey: n, metaKey: r, altKey: i } = e;
3132
3200
  if (/^.$/u.test(e.key)) {
3133
- if (e.key === " " && !n && !r && !i) return nr(t);
3201
+ if (e.key === " " && !n && !r && !i) return _r(t);
3134
3202
  let a = e.getModifierState("AltGraph") || n && i || i && !r;
3135
3203
  return (n || r) && !a;
3136
3204
  }
3137
3205
  return n || r || i;
3138
3206
  }
3139
- function ir(e, t, n) {
3140
- let r = (e) => $(() => {
3207
+ function yr(e, t, n) {
3208
+ let r = (e) => Y(() => {
3141
3209
  let r = e.composedPath()[0];
3142
- rr(e, r) && t({
3210
+ vr(e, r) && t({
3143
3211
  type: 6,
3144
3212
  timestamp: Date.now(),
3145
3213
  data: {
3146
- plugin: Jn,
3214
+ plugin: Pn,
3147
3215
  payload: {
3148
3216
  key: e.key,
3149
3217
  code: e.code,
@@ -3163,14 +3231,82 @@ function ir(e, t, n) {
3163
3231
  return e.addEventListener("keydown", r, i), () => e.removeEventListener("keydown", r, i);
3164
3232
  }
3165
3233
  //#endregion
3234
+ //#region src/capture/user-made.ts
3235
+ var br = 3, xr = 2, Sr = 5, Cr = 2, wr = /* @__PURE__ */ new Set([
3236
+ "click",
3237
+ "dblclick",
3238
+ "contextmenu",
3239
+ "mousedown",
3240
+ "mouseup",
3241
+ "pointerdown",
3242
+ "pointerup",
3243
+ "touchstart",
3244
+ "touchend",
3245
+ "beforeinput",
3246
+ "input",
3247
+ "change",
3248
+ "submit"
3249
+ ]), Tr = /* @__PURE__ */ new Set([
3250
+ "keydown",
3251
+ "keyup",
3252
+ "keypress"
3253
+ ]);
3254
+ function Er(e) {
3255
+ return e?.isTrusted ? Tr.has(e.type) ? vr(e, e.composedPath()[0]) : wr.has(e.type) : !1;
3256
+ }
3257
+ function Dr(e) {
3258
+ let t = e.HTMLElement.prototype, n = t.click, r = [], i = "event" in e;
3259
+ function a(...t) {
3260
+ let i = !1;
3261
+ Y(() => {
3262
+ i = r.length > 0 ? r[r.length - 1] : Er(e.event);
3263
+ }), r.push(i);
3264
+ try {
3265
+ return n.apply(this, t);
3266
+ } finally {
3267
+ r.pop();
3268
+ }
3269
+ }
3270
+ t.click = a;
3271
+ let o = (t) => {
3272
+ if (t.source === Sr) return t.userTriggered !== !1 || !i || e.event !== void 0 ? null : { byApp: !0 };
3273
+ if (t.source !== xr || t.type !== Cr) return null;
3274
+ let n = e.event;
3275
+ if (n?.type !== "click") return null;
3276
+ let a = { userTriggered: n.isTrusted };
3277
+ return !n.isTrusted && r[r.length - 1] === !0 && (a.byApp = !0), a;
3278
+ };
3279
+ return {
3280
+ mark: (e) => {
3281
+ if (e.type !== br) return e;
3282
+ let t;
3283
+ try {
3284
+ t = o(e.data);
3285
+ } catch {
3286
+ t = null;
3287
+ }
3288
+ return t ? {
3289
+ ...e,
3290
+ data: {
3291
+ ...e.data,
3292
+ ...t
3293
+ }
3294
+ } : e;
3295
+ },
3296
+ uninstall: () => {
3297
+ t.click = n;
3298
+ }
3299
+ };
3300
+ }
3301
+ //#endregion
3166
3302
  //#region src/capture/eventsource.ts
3167
- var ar = EventTarget.prototype.addEventListener;
3168
- function or(e, t) {
3303
+ var Or = EventTarget.prototype.addEventListener;
3304
+ function kr(e, t) {
3169
3305
  let n = e.EventSource;
3170
3306
  if (typeof n != "function") return;
3171
- let r = /* @__PURE__ */ new WeakMap(), i = (e) => $(() => t.emit(e));
3307
+ let r = /* @__PURE__ */ new WeakMap(), i = (e) => Y(() => t.emit(e));
3172
3308
  function a(e, t, n) {
3173
- n === "open" || n === "error" || t.subscribed.has(n) || (t.subscribed.add(n), ar.call(e, n, (e) => {
3309
+ n === "open" || n === "error" || t.subscribed.has(n) || (t.subscribed.add(n), Or.call(e, n, (e) => {
3174
3310
  let r = e;
3175
3311
  i({
3176
3312
  type: "sse-message",
@@ -3184,7 +3320,7 @@ function or(e, t) {
3184
3320
  }
3185
3321
  class o extends n {
3186
3322
  constructor(e, n) {
3187
- super(e, n), $(() => {
3323
+ super(e, n), Y(() => {
3188
3324
  if (t.ignores(this.url)) return;
3189
3325
  let e = {
3190
3326
  id: t.nextId(),
@@ -3198,11 +3334,11 @@ function or(e, t) {
3198
3334
  withCredentials: this.withCredentials,
3199
3335
  t: Date.now(),
3200
3336
  id: n
3201
- }), ar.call(this, "open", () => i({
3337
+ }), Or.call(this, "open", () => i({
3202
3338
  type: "sse-open",
3203
3339
  t: Date.now(),
3204
3340
  id: n
3205
- })), ar.call(this, "error", () => i({
3341
+ })), Or.call(this, "error", () => i({
3206
3342
  type: "sse-error",
3207
3343
  readyState: this.readyState,
3208
3344
  t: Date.now(),
@@ -3211,7 +3347,7 @@ function or(e, t) {
3211
3347
  });
3212
3348
  }
3213
3349
  close() {
3214
- $(() => {
3350
+ Y(() => {
3215
3351
  let e = r.get(this);
3216
3352
  e && this.readyState !== n.CLOSED && i({
3217
3353
  type: "sse-close",
@@ -3225,23 +3361,23 @@ function or(e, t) {
3225
3361
  configurable: !0,
3226
3362
  writable: !0,
3227
3363
  value: function(e, t, n) {
3228
- $(() => {
3364
+ Y(() => {
3229
3365
  let t = r.get(this);
3230
3366
  t && a(this, t, e);
3231
- }), ar.call(this, e, t, n);
3367
+ }), Or.call(this, e, t, n);
3232
3368
  }
3233
3369
  }), Object.defineProperty(o, "name", { value: "EventSource" }), e.EventSource = o;
3234
3370
  }
3235
3371
  //#endregion
3236
3372
  //#region src/capture/content-type.ts
3237
- function sr(e, t) {
3373
+ function Ar(e, t) {
3238
3374
  if (!e) return !1;
3239
3375
  let n = e.split(";")[0].trim().toLowerCase();
3240
3376
  return t.some((e) => e.endsWith("/") ? n.startsWith(e) : e.startsWith("+") ? n.endsWith(e) : n === e);
3241
3377
  }
3242
3378
  //#endregion
3243
3379
  //#region src/capture/method.ts
3244
- var cr = /* @__PURE__ */ new Set([
3380
+ var jr = /* @__PURE__ */ new Set([
3245
3381
  "DELETE",
3246
3382
  "GET",
3247
3383
  "HEAD",
@@ -3249,69 +3385,69 @@ var cr = /* @__PURE__ */ new Set([
3249
3385
  "POST",
3250
3386
  "PUT"
3251
3387
  ]);
3252
- function lr(e) {
3388
+ function Mr(e) {
3253
3389
  let t = e.toUpperCase();
3254
- return cr.has(t) ? t : e;
3390
+ return jr.has(t) ? t : e;
3255
3391
  }
3256
3392
  //#endregion
3257
3393
  //#region src/capture/fetch.ts
3258
- function ur(e) {
3394
+ function Nr(e) {
3259
3395
  return [...e];
3260
3396
  }
3261
- function dr(e) {
3397
+ function Pr(e) {
3262
3398
  return e instanceof DOMException || e instanceof Error ? e.name : void 0;
3263
3399
  }
3264
- function fr(e, t) {
3265
- return dr(e) === "TimeoutError" || dr(t?.reason) === "TimeoutError" ? "timeout" : dr(e) === "AbortError" || t?.aborted === !0 ? "abort" : "network";
3400
+ function Fr(e, t) {
3401
+ return Pr(e) === "TimeoutError" || Pr(t?.reason) === "TimeoutError" ? "timeout" : Pr(e) === "AbortError" || t?.aborted === !0 ? "abort" : "network";
3266
3402
  }
3267
- async function pr(e, t) {
3403
+ async function Ir(e, t) {
3268
3404
  if (!e.body) return;
3269
- let n = await Vn(e.body, t.maxBodySize);
3405
+ let n = await lr(e.body, t.maxBodySize);
3270
3406
  if (!n) return { omitted: "too-large" };
3271
3407
  let r = e.headers.get("content-type");
3272
3408
  if (r?.toLowerCase().startsWith("multipart/form-data")) try {
3273
- return { form: Rn(await new Response(n, { headers: { "content-type": r } }).formData()) };
3409
+ return { form: or(await new Response(n, { headers: { "content-type": r } }).formData()) };
3274
3410
  } catch {}
3275
- return An(n);
3411
+ return Qn(n);
3276
3412
  }
3277
- function mr(e) {
3413
+ function Lr(e) {
3278
3414
  return e !== void 0 && !(e instanceof Headers) && !Array.isArray(e) && typeof e[Symbol.iterator] == "function" ? new Headers() : new Headers(e);
3279
3415
  }
3280
- function hr(e, t, n) {
3281
- let r = t?.headers ? mr(t.headers) : new Headers(e.headers);
3416
+ function Rr(e, t, n) {
3417
+ let r = t?.headers ? Lr(t.headers) : new Headers(e.headers);
3282
3418
  if (n && !r.has("content-type")) {
3283
- let e = Bn(t?.body);
3419
+ let e = cr(t?.body);
3284
3420
  e && r.set("content-type", e);
3285
3421
  }
3286
3422
  return r;
3287
3423
  }
3288
- function gr(e, t, n) {
3424
+ function zr(e, t, n) {
3289
3425
  if (e instanceof Request) {
3290
3426
  let r = t?.body !== void 0 && t.body !== null, i = r ? null : e.clone();
3291
3427
  return {
3292
- method: lr(t?.method ?? e.method),
3293
- headers: ur(hr(e, t, r)),
3294
- body: i ? pr(i, n) : zn(t?.body, n),
3428
+ method: Mr(t?.method ?? e.method),
3429
+ headers: Nr(Rr(e, t, r)),
3430
+ body: i ? Ir(i, n) : sr(t?.body, n),
3295
3431
  signal: t?.signal ?? e.signal
3296
3432
  };
3297
3433
  }
3298
- let r = mr(t?.headers), i = r.has("content-type") ? null : Bn(t?.body);
3434
+ let r = Lr(t?.headers), i = r.has("content-type") ? null : cr(t?.body);
3299
3435
  return i && r.set("content-type", i), {
3300
- method: lr(t?.method ?? "GET"),
3301
- headers: ur(r),
3302
- body: zn(t?.body, n),
3436
+ method: Mr(t?.method ?? "GET"),
3437
+ headers: Nr(r),
3438
+ body: sr(t?.body, n),
3303
3439
  signal: t?.signal
3304
3440
  };
3305
3441
  }
3306
- function _r(e) {
3442
+ function Br(e) {
3307
3443
  return e instanceof Request ? e.url : new URL(e instanceof URL ? e.href : String(e), document.baseURI).href;
3308
3444
  }
3309
- function vr(e, t, n) {
3445
+ function Vr(e, t, n) {
3310
3446
  let r = e.fetch;
3311
3447
  function i(e, r) {
3312
- let i = _r(e);
3448
+ let i = Br(e);
3313
3449
  if (t.ignores(i)) return null;
3314
- let a = t.nextId(), o = Date.now(), { method: s, headers: c, body: l, signal: u } = gr(e, r, n), d = (e) => $(() => t.emit(e)), f = (e) => ({
3450
+ let a = t.nextId(), o = Date.now(), { method: s, headers: c, body: l, signal: u } = zr(e, r, n), d = (e) => Y(() => t.emit(e)), f = (e) => ({
3315
3451
  type: "http-request",
3316
3452
  api: "fetch",
3317
3453
  method: s,
@@ -3330,8 +3466,8 @@ function vr(e, t, n) {
3330
3466
  } else d(f(l));
3331
3467
  let p = (e) => d({
3332
3468
  type: "http-error",
3333
- reason: fr(e, u),
3334
- message: Hn(e),
3469
+ reason: Fr(e, u),
3470
+ message: ur(e),
3335
3471
  t: Date.now(),
3336
3472
  id: a
3337
3473
  });
@@ -3346,11 +3482,11 @@ function vr(e, t, n) {
3346
3482
  return;
3347
3483
  }
3348
3484
  try {
3349
- let r = await Vn(t.body, n.maxBodySize);
3485
+ let r = await lr(t.body, n.maxBodySize);
3350
3486
  if (r) {
3351
3487
  d({
3352
3488
  type: "http-end",
3353
- body: An(r),
3489
+ body: Qn(r),
3354
3490
  t: Date.now(),
3355
3491
  id: a
3356
3492
  });
@@ -3371,7 +3507,7 @@ function vr(e, t, n) {
3371
3507
  }
3372
3508
  }
3373
3509
  function h(e, t) {
3374
- let r = Nn(), i = null, o = 0, s = !1, c = (e) => $(() => {
3510
+ let r = tr(), i = null, o = 0, s = !1, c = (e) => Y(() => {
3375
3511
  if (s) return;
3376
3512
  if (o += e.byteLength, o > n.maxBodySize) {
3377
3513
  s = !0;
@@ -3396,7 +3532,7 @@ function vr(e, t, n) {
3396
3532
  return;
3397
3533
  }
3398
3534
  if (t.done) {
3399
- $(() => {
3535
+ Y(() => {
3400
3536
  let e = s ? null : r.end();
3401
3537
  e && d({
3402
3538
  type: "http-chunk",
@@ -3443,7 +3579,7 @@ function vr(e, t, n) {
3443
3579
  url: e.url || i,
3444
3580
  redirected: e.redirected,
3445
3581
  fetchType: e.type,
3446
- headers: ur(e.headers),
3582
+ headers: Nr(e.headers),
3447
3583
  t: Date.now(),
3448
3584
  id: a
3449
3585
  }), e.type === "opaque" || e.type === "opaqueredirect") {
@@ -3455,7 +3591,7 @@ function vr(e, t, n) {
3455
3591
  return;
3456
3592
  }
3457
3593
  let t = e.headers.get("content-type");
3458
- if (sr(t, n.mediaTypes)) {
3594
+ if (Ar(t, n.mediaTypes)) {
3459
3595
  d({
3460
3596
  type: "http-end",
3461
3597
  body: { omitted: "media" },
@@ -3464,14 +3600,14 @@ function vr(e, t, n) {
3464
3600
  });
3465
3601
  return;
3466
3602
  }
3467
- if (sr(t, n.streamingTypes) && e.body) return h(e, e.body);
3603
+ if (Ar(t, n.streamingTypes) && e.body) return h(e, e.body);
3468
3604
  m(e);
3469
3605
  }
3470
3606
  };
3471
3607
  }
3472
3608
  async function a(t, n) {
3473
3609
  let a = null;
3474
- $(() => {
3610
+ Y(() => {
3475
3611
  a = i(t, n);
3476
3612
  });
3477
3613
  let o;
@@ -3479,10 +3615,10 @@ function vr(e, t, n) {
3479
3615
  o = await r.call(e, t, n);
3480
3616
  } catch (e) {
3481
3617
  let t = a;
3482
- throw $(() => t?.failed(e)), e;
3618
+ throw Y(() => t?.failed(e)), e;
3483
3619
  }
3484
3620
  let s = a, c = o;
3485
- return $(() => {
3621
+ return Y(() => {
3486
3622
  c = s?.responded(o) ?? o;
3487
3623
  }), c;
3488
3624
  }
@@ -3490,20 +3626,20 @@ function vr(e, t, n) {
3490
3626
  }
3491
3627
  //#endregion
3492
3628
  //#region src/capture/markers.ts
3493
- var yr = [
3629
+ var Hr = [
3494
3630
  "RTCPeerConnection",
3495
3631
  "Worker",
3496
3632
  "SharedWorker",
3497
3633
  "WebTransport",
3498
3634
  "WebSocketStream"
3499
3635
  ];
3500
- function br(e, t) {
3501
- for (let n of yr) {
3636
+ function Ur(e, t) {
3637
+ for (let n of Hr) {
3502
3638
  let r = e[n];
3503
3639
  if (typeof r != "function") continue;
3504
3640
  let i = class extends r {
3505
3641
  constructor(...e) {
3506
- super(...e), $(() => {
3642
+ super(...e), Y(() => {
3507
3643
  let [r] = e, i = typeof r == "string" || r instanceof URL ? new URL(String(r), document.baseURI).href : void 0;
3508
3644
  t.emit({
3509
3645
  type: "marker",
@@ -3518,41 +3654,46 @@ function br(e, t) {
3518
3654
  }
3519
3655
  }
3520
3656
  //#endregion
3521
- //#region src/redact/matcher.ts
3522
- function xr(e, t) {
3523
- return e.lastIndex = 0, e.test(t);
3524
- }
3525
- function Sr(e, t) {
3526
- return typeof e == "string" ? e.toLowerCase() === t.toLowerCase() : e instanceof RegExp ? xr(e, t) : e(t);
3657
+ //#region src/capture/mutation-guard.ts
3658
+ function Wr(e, t) {
3659
+ if (e.length > t) return e.length;
3660
+ let n = e.length;
3661
+ for (let r of e) {
3662
+ let e = r.addedNodes;
3663
+ for (let r = 0; r < e.length; r++) {
3664
+ let i = e[r];
3665
+ if (n += i.nodeType === Node.ELEMENT_NODE ? 1 + i.getElementsByTagName("*").length : 1, n > t) return n;
3666
+ }
3667
+ }
3668
+ return n;
3527
3669
  }
3528
- function Cr(e, t) {
3529
- return typeof e == "string" ? t.startsWith(e) : e instanceof RegExp ? xr(e, t) : e(t);
3670
+ function Gr(e, t, n) {
3671
+ return (r) => {
3672
+ let i = !1;
3673
+ return Y(() => {
3674
+ if (n()) {
3675
+ i = !0;
3676
+ return;
3677
+ }
3678
+ Wr(r, e) > e && (t(r.length), i = !0);
3679
+ }), !i;
3680
+ };
3530
3681
  }
3531
3682
  //#endregion
3532
- //#region src/redact/kind.ts
3533
- var wr = "[redacted]";
3534
- function Tr(e) {
3535
- return wr;
3683
+ //#region src/redact/matcher.ts
3684
+ function Kr(e, t) {
3685
+ return e.lastIndex = 0, e.test(t);
3536
3686
  }
3537
- function Er(e) {
3538
- try {
3539
- return decodeURIComponent(e.replaceAll("+", " "));
3540
- } catch {
3541
- return e;
3542
- }
3687
+ function X(e, t) {
3688
+ return typeof e == "string" ? e.toLowerCase() === t.toLowerCase() : e instanceof RegExp ? Kr(e, t) : e(t);
3543
3689
  }
3544
- function Dr(e, t) {
3545
- let n = !1, r = e.split("&").map((e) => {
3546
- let r = e.indexOf("=");
3547
- if (r === -1) return e;
3548
- let i = e.slice(0, r);
3549
- return Sr(t, Er(i)) ? (n = !0, `${i}=${Tr(e.slice(r + 1))}`) : e;
3550
- });
3551
- return n ? r.join("&") : e;
3690
+ function qr(e, t) {
3691
+ return typeof e == "string" ? t.startsWith(e) : e instanceof RegExp ? Kr(e, t) : e(t);
3552
3692
  }
3553
3693
  //#endregion
3554
- //#region src/redact/body-field.ts
3555
- function Or(e, t, n, r) {
3694
+ //#region src/redact/json.ts
3695
+ var Z = "[redacted]", Q = () => {};
3696
+ function Jr(e, t, n, r = null) {
3556
3697
  let i = (t) => {
3557
3698
  for (; /\s/.test(e[t] ?? "");) t++;
3558
3699
  return t;
@@ -3560,59 +3701,201 @@ function Or(e, t, n, r) {
3560
3701
  for (t++; e[t] !== "\""; t++) e[t] === "\\" && t++;
3561
3702
  return t + 1;
3562
3703
  }, o = e[t];
3563
- if (o === "\"") return a(t);
3704
+ if (o === "\"") {
3705
+ let e = a(t);
3706
+ return n(r, t, e), e;
3707
+ }
3564
3708
  if (o !== "{" && o !== "[") {
3565
- let n = t;
3566
- for (; n < e.length && !/[\s,\]}]/.test(e[n]);) n++;
3567
- return n;
3709
+ let i = t;
3710
+ for (; i < e.length && !/[\s,\]}]/.test(e[i]);) i++;
3711
+ return n(r, t, i), i;
3568
3712
  }
3569
3713
  let s = o === "{" ? "}" : "]", c = i(t + 1);
3570
3714
  for (; e[c] !== s;) {
3571
3715
  if (o === "{") {
3572
- let t = a(c), o = JSON.parse(e.slice(c, t));
3573
- c = i(i(t) + 1);
3574
- let s = Or(e, c, n, r);
3575
- Sr(r, o) && n.push([c, s]), c = s;
3576
- } else c = Or(e, c, n, r);
3716
+ let t = a(c), r = JSON.parse(e.slice(c, t));
3717
+ c = i(i(t) + 1), c = Jr(e, c, n, r);
3718
+ } else c = Jr(e, c, n);
3577
3719
  c = i(c), e[c] === "," && (c = i(c + 1));
3578
3720
  }
3579
- return c + 1;
3721
+ return n(r, t, c + 1), c + 1;
3580
3722
  }
3581
- function kr(e, t) {
3723
+ function Yr(e, t) {
3724
+ if (t.length === 0) return e;
3725
+ t.sort((e, t) => e[0] - t[0] || t[1] - e[1]);
3726
+ let n = "", r = 0;
3727
+ for (let [i, a, o] of t) i < r || (n += `${e.slice(r, i)}${o}`, r = a);
3728
+ return n + e.slice(r);
3729
+ }
3730
+ function Xr(e) {
3731
+ if (!e.startsWith("\"")) return null;
3732
+ let t = JSON.parse(e);
3733
+ return /^\s*[[{]/.test(t) && Zr(t) ? t : null;
3734
+ }
3735
+ function Zr(e) {
3582
3736
  try {
3583
- JSON.parse(e);
3737
+ return JSON.parse(e), !0;
3584
3738
  } catch {
3585
- return e;
3739
+ return !1;
3586
3740
  }
3741
+ }
3742
+ var Qr = (e) => /^\s*[[{]/.test(e) && Zr(e), $r = (e) => /^\s*"/.test(e) && Zr(e);
3743
+ function ei(e, t) {
3587
3744
  let n = [];
3588
- if (Or(e, e.search(/\S/), n, t), n.length === 0) return e;
3589
- n.sort((e, t) => e[0] - t[0]);
3590
- let r = "", i = 0;
3591
- for (let [t, a] of n) t < i || (r += `${e.slice(i, t)}"${wr}"`, i = a);
3592
- return r + e.slice(i);
3593
- }
3594
- var Ar = /^[^\s=&]+=[^\s&]*(?:&[^\s=&]+=[^\s&]*)*$/;
3595
- function jr(e) {
3745
+ return Jr(e, e.search(/\S/), (r, i, a) => {
3746
+ let o = e.slice(i, a);
3747
+ if (!o.startsWith("\"")) return;
3748
+ let s = JSON.stringify(t(JSON.parse(o)));
3749
+ s !== o && n.push([
3750
+ i,
3751
+ a,
3752
+ s
3753
+ ]);
3754
+ }), Yr(e, n);
3755
+ }
3756
+ function ti(e, t, n) {
3757
+ if (!Zr(e)) return e;
3758
+ let r = [];
3759
+ return Jr(e, e.search(/\S/), (i, a, o) => {
3760
+ let s = e.slice(a, o);
3761
+ if (i !== null && X(t, i)) {
3762
+ s.startsWith("\"") ? r.push([
3763
+ a,
3764
+ o,
3765
+ JSON.stringify(n(JSON.parse(s)))
3766
+ ]) : s.startsWith("{") || s.startsWith("[") ? r.push([
3767
+ a,
3768
+ o,
3769
+ ei(s, n)
3770
+ ]) : r.push([
3771
+ a,
3772
+ o,
3773
+ JSON.stringify(n(s))
3774
+ ]);
3775
+ return;
3776
+ }
3777
+ let c = Xr(s);
3778
+ if (c === null) return;
3779
+ let l = ti(c, t, n);
3780
+ l !== c && r.push([
3781
+ a,
3782
+ o,
3783
+ JSON.stringify(l)
3784
+ ]);
3785
+ }), Yr(e, r);
3786
+ }
3787
+ //#endregion
3788
+ //#region src/redact/kind.ts
3789
+ var ni = /^([\w-]+)\.([\w-]+)\.([\w-]*)$/, ri = "cmVkYWN0ZWQ";
3790
+ function ii(e) {
3791
+ try {
3792
+ let t = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
3793
+ return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(t, (e) => e.charCodeAt(0)));
3794
+ } catch {
3795
+ return null;
3796
+ }
3797
+ }
3798
+ function ai(e) {
3799
+ let t = "";
3800
+ for (let n of new TextEncoder().encode(e)) t += String.fromCharCode(n);
3801
+ return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3802
+ }
3803
+ function oi(e) {
3804
+ try {
3805
+ let t = e === null ? null : JSON.parse(e);
3806
+ return typeof t == "object" && t && !Array.isArray(t) ? t : null;
3807
+ } catch {
3808
+ return null;
3809
+ }
3810
+ }
3811
+ function si(e, t = Q) {
3812
+ let n = (r) => {
3813
+ let i = ni.exec(r);
3814
+ if (!i) return null;
3815
+ let o = oi(ii(i[1]))?.alg, s = ii(i[2]);
3816
+ if (typeof o != "string" || !oi(s)) return null;
3817
+ let c = Z;
3818
+ if (i[3] !== "" && o.toLowerCase() !== "none") {
3819
+ let t = s;
3820
+ for (let n of e) t = ti(t, n, a);
3821
+ t = $(t, n);
3822
+ let r = t === s ? i[2] : ai(t);
3823
+ c = `${i[1]}.${r}.${ri}`;
3824
+ }
3825
+ return t(r, c), c;
3826
+ }, r = (e) => (t(e, Z), Z), i = (e) => n(e) ?? r(e), a = (e) => {
3827
+ if (Qr(e)) return ei(e, a);
3828
+ if ($r(e)) return JSON.stringify(a(JSON.parse(e)));
3829
+ let t = ci.exec(e), i = t && n(t[2]);
3830
+ return i ? t[1] === void 0 ? i : `${t[1]} ${i}` : r(e);
3831
+ };
3832
+ return {
3833
+ replace: i,
3834
+ field: a,
3835
+ jwt: n
3836
+ };
3837
+ }
3838
+ var ci = /^(?:([A-Za-z][\w-]*) )?([\w-]+\.[\w-]+\.[\w-]*)$/, li = /^[^\s=&]+=[^\s&]*(?:&[^\s=&]+=[^\s&]*)*$/, ui = /(?:(?<=%[0-9A-Fa-f]{2})|(?<![\w.%-]))[\w-]+\.[\w-]+\.[\w-]*(?![\w-]|\.[\w-])/g;
3839
+ function $(e, t) {
3840
+ return e.includes(".") ? e.replace(ui, (e) => t(e) ?? e) : e;
3841
+ }
3842
+ function di(e, t, { plusIsSpace: n = !0 } = {}) {
3843
+ let r = mi(e, n);
3844
+ if (r === e) return null;
3845
+ let i = $(r, t);
3846
+ return i === r ? null : encodeURIComponent(i);
3847
+ }
3848
+ function fi(e, t) {
3849
+ let n = !1, r = e.split("&").map((e) => {
3850
+ let r = e.indexOf("=");
3851
+ if (r === -1) return e;
3852
+ let i = t(e.slice(r + 1));
3853
+ return i === null ? e : (n = !0, `${e.slice(0, r)}=${i}`);
3854
+ });
3855
+ return n ? r.join("&") : e;
3856
+ }
3857
+ function pi(e) {
3858
+ return e.flatMap((e) => "bodyField" in e ? [e.bodyField] : []);
3859
+ }
3860
+ function mi(e, t = !0) {
3861
+ try {
3862
+ return decodeURIComponent(t ? e.replaceAll("+", " ") : e);
3863
+ } catch {
3864
+ return e;
3865
+ }
3866
+ }
3867
+ function hi(e, t, n) {
3868
+ let r = !1, i = e.split("&").map((e) => {
3869
+ let i = e.indexOf("=");
3870
+ if (i === -1) return e;
3871
+ let a = e.slice(0, i);
3872
+ return X(t, mi(a)) ? (r = !0, `${a}=${n(e.slice(i + 1))}`) : e;
3873
+ });
3874
+ return r ? i.join("&") : e;
3875
+ }
3876
+ //#endregion
3877
+ //#region src/redact/body-field.ts
3878
+ function gi(e) {
3596
3879
  return (e.find(([e]) => e === "content-type")?.[1] ?? "").split(";")[0].trim().toLowerCase() === "application/x-www-form-urlencoded";
3597
3880
  }
3598
- function Mr(e, t, n = !1) {
3881
+ function _i(e, t, n, r = !1) {
3599
3882
  if ("text" in e) {
3600
- let r = n ? Dr(e.text, t) : kr(e.text, t);
3601
- return r === e.text ? e : { text: r };
3883
+ let i = r ? hi(e.text, t, n) : ti(e.text, t, n);
3884
+ return i === e.text ? e : { text: i };
3602
3885
  }
3603
- return "form" in e && e.form.some((e) => Sr(t, e.name)) ? { form: e.form.map((e) => Sr(t, e.name) ? {
3886
+ return "form" in e && e.form.some((e) => X(t, e.name)) ? { form: e.form.map((e) => X(t, e.name) ? {
3604
3887
  name: e.name,
3605
- value: wr
3888
+ value: "value" in e ? n(e.value) : Z
3606
3889
  } : e) } : e;
3607
3890
  }
3608
- var Nr = {
3891
+ var vi = {
3609
3892
  is: (e) => "bodyField" in e,
3610
- apply(e, t) {
3611
- let n = t.bodyField;
3893
+ apply(e, t, n) {
3894
+ let r = t.bodyField;
3612
3895
  switch (e.type) {
3613
3896
  case "http-request": {
3614
3897
  if (!e.body) return e;
3615
- let t = Mr(e.body, n, jr(e.headers));
3898
+ let t = _i(e.body, r, n, gi(e.headers));
3616
3899
  return t === e.body ? e : {
3617
3900
  ...e,
3618
3901
  body: t
@@ -3620,22 +3903,22 @@ var Nr = {
3620
3903
  }
3621
3904
  case "http-end": {
3622
3905
  if (!e.body) return e;
3623
- let t = "text" in e.body && Ar.test(e.body.text), r = Mr(e.body, n, t);
3624
- return r === e.body ? e : {
3906
+ let t = "text" in e.body && li.test(e.body.text), i = _i(e.body, r, n, t);
3907
+ return i === e.body ? e : {
3625
3908
  ...e,
3626
- body: r
3909
+ body: i
3627
3910
  };
3628
3911
  }
3629
3912
  case "ws-send":
3630
3913
  case "ws-message": {
3631
- let t = Mr(e.data, n);
3914
+ let t = _i(e.data, r, n);
3632
3915
  return t === e.data ? e : {
3633
3916
  ...e,
3634
3917
  data: t
3635
3918
  };
3636
3919
  }
3637
3920
  case "sse-message": {
3638
- let t = kr(e.data, n);
3921
+ let t = ti(e.data, r, n);
3639
3922
  return t === e.data ? e : {
3640
3923
  ...e,
3641
3924
  data: t
@@ -3647,31 +3930,54 @@ var Nr = {
3647
3930
  };
3648
3931
  //#endregion
3649
3932
  //#region src/redact/header.ts
3650
- function Pr(e, t) {
3651
- return e.some(([e]) => Sr(t, e)) ? e.map(([e, n]) => Sr(t, e) ? [e, Tr(n)] : [e, n]) : e;
3933
+ function yi(e, t, n) {
3934
+ if (e.toLowerCase() === "cookie") for (let e of t.split(/;\s*/)) {
3935
+ let t = e.indexOf("=");
3936
+ t !== -1 && n(e.slice(t + 1), Z);
3937
+ }
3652
3938
  }
3653
- var Fr = {
3939
+ function bi(e, t, n, r) {
3940
+ return e.some(([e]) => X(t, e)) ? e.map(([e, i]) => X(t, e) ? (yi(e, i, r), [e, n(i)]) : [e, i]) : e;
3941
+ }
3942
+ var xi = {
3654
3943
  is: (e) => "header" in e,
3655
- apply(e, t) {
3944
+ apply(e, t, n, r) {
3656
3945
  if (e.type !== "http-request" && e.type !== "http-response") return e;
3657
- let n = Pr(e.headers, t.header);
3658
- return n === e.headers ? e : {
3946
+ let i = bi(e.headers, t.header, n, r);
3947
+ return i === e.headers ? e : {
3659
3948
  ...e,
3660
- headers: n
3949
+ headers: i
3661
3950
  };
3662
3951
  }
3663
- };
3664
- //#endregion
3665
- //#region src/redact/query-param.ts
3666
- function Ir(e, t) {
3952
+ }, Si = (e) => (t) => (e(t, Z), Z);
3953
+ function Ci(e, t) {
3667
3954
  let n = e.indexOf("#"), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? null : e.slice(n + 1), a = r, o = r.indexOf("?");
3668
- if (o !== -1 && (a = r.slice(0, o + 1) + Dr(r.slice(o + 1), t)), i === null) return a;
3955
+ if (o !== -1 && (a = r.slice(0, o + 1) + t(r.slice(o + 1))), i === null) return a;
3669
3956
  let s = i.indexOf("?"), c = i;
3670
- return s === -1 ? i.includes("=") && (c = Dr(i, t)) : c = i.slice(0, s + 1) + Dr(i.slice(s + 1), t), `${a}#${c}`;
3957
+ return s === -1 ? i.includes("=") && (c = t(i)) : c = i.slice(0, s + 1) + t(i.slice(s + 1)), `${a}#${c}`;
3958
+ }
3959
+ function wi(e, t, n = Q) {
3960
+ return Ci(e, (e) => hi(e, t, Si(n)));
3961
+ }
3962
+ function Ti(e, t) {
3963
+ let n = (e) => fi(e, (e) => $(Ei(e), t) === Ei(e) ? null : Z), r = (e) => $(e, t).split("/").map((e) => di(e, t, { plusIsSpace: !1 }) ?? e).join("/"), i = (e) => {
3964
+ let t = e.indexOf("?");
3965
+ return t === -1 ? r(e) : r(e.slice(0, t)) + "?" + n(e.slice(t + 1));
3966
+ }, a = e.indexOf("#");
3967
+ if (a === -1) return i(e);
3968
+ let o = e.slice(a + 1), s = !o.includes("?") && o.includes("=") ? n(o) : i(o);
3969
+ return `${i(e.slice(0, a))}#${s}`;
3671
3970
  }
3672
- var Lr = {
3971
+ function Ei(e) {
3972
+ try {
3973
+ return decodeURIComponent(e.replaceAll("+", " "));
3974
+ } catch {
3975
+ return e;
3976
+ }
3977
+ }
3978
+ var Di = {
3673
3979
  is: (e) => "queryParam" in e,
3674
- apply(e, t) {
3980
+ apply(e, t, n, r) {
3675
3981
  switch (e.type) {
3676
3982
  case "http-request":
3677
3983
  case "http-response":
@@ -3679,7 +3985,7 @@ var Lr = {
3679
3985
  case "ws-connect":
3680
3986
  case "marker": {
3681
3987
  if (e.url === void 0) return e;
3682
- let n = Ir(e.url, t.queryParam);
3988
+ let n = wi(e.url, t.queryParam, r);
3683
3989
  return n === e.url ? e : {
3684
3990
  ...e,
3685
3991
  url: n
@@ -3688,61 +3994,150 @@ var Lr = {
3688
3994
  default: return e;
3689
3995
  }
3690
3996
  }
3691
- }, Rr = [
3692
- Fr,
3693
- Lr,
3694
- Nr
3695
- ], zr = /^([a-z][a-z\d+.-]*:\/\/[^/?#@:]*:)[^/?#@]*@/i;
3696
- function Br(e) {
3697
- return e.replace(zr, `$1${wr}@`);
3698
- }
3699
- function Vr(e, t) {
3700
- let n = e;
3701
- if ("url" in n && n.url !== void 0) {
3702
- let e = Br(n.url);
3703
- e !== n.url && (n = {
3704
- ...n,
3997
+ }, Oi = [
3998
+ xi,
3999
+ Di,
4000
+ vi
4001
+ ], ki = /^([a-z][a-z\d+.-]*:\/\/[^/?#@:]*:)([^/?#@]*)@/i;
4002
+ function Ai(e, t) {
4003
+ let n = ki.exec(e);
4004
+ return n ? (t(n[2], Z), `${n[1]}${Z}@${e.slice(n[0].length)}`) : e;
4005
+ }
4006
+ function ji(e, t, n = Q) {
4007
+ let r = e;
4008
+ if ("url" in r && r.url !== void 0) {
4009
+ let e = Ai(r.url, n);
4010
+ e !== r.url && (r = {
4011
+ ...r,
3705
4012
  url: e
3706
4013
  });
3707
4014
  }
4015
+ let { replace: i, field: a, jwt: o } = si(pi(t), n);
3708
4016
  for (let e of t) {
3709
- let t = Rr.find((t) => t.is(e));
3710
- t && (n = t.apply(n, e));
4017
+ let t = Oi.find((t) => t.is(e));
4018
+ t && (r = t.apply(r, e, "bodyField" in e ? a : i, n));
3711
4019
  }
3712
- return n;
4020
+ return Mi(r, o);
3713
4021
  }
3714
- function Hr(e, t) {
3715
- let n = Br(e);
3716
- for (let e of t) Lr.is(e) && (n = Ir(n, e.queryParam));
3717
- return n;
4022
+ function Mi(e, t) {
4023
+ let n = (e) => {
4024
+ if ("text" in e) {
4025
+ let n = $(e.text, t);
4026
+ return li.test(n) && (n = fi(n, (e) => di(e, t))), n === e.text ? e : { text: n };
4027
+ }
4028
+ let n = (e) => $(e, t);
4029
+ return "form" in e && e.form.some((e) => "value" in e && n(e.value) !== e.value) ? { form: e.form.map((e) => "value" in e ? {
4030
+ name: e.name,
4031
+ value: n(e.value)
4032
+ } : e) } : e;
4033
+ }, r = (e) => e.some(([, e]) => $(e, t) !== e) ? e.map(([e, n]) => [e, $(n, t)]) : e, i = e;
4034
+ if ("url" in i && i.url !== void 0) {
4035
+ let e = Ti(i.url, t);
4036
+ e !== i.url && (i = {
4037
+ ...i,
4038
+ url: e
4039
+ });
4040
+ }
4041
+ switch (i.type) {
4042
+ case "http-request": {
4043
+ let e = i.body && n(i.body), t = r(i.headers);
4044
+ return e === i.body && t === i.headers ? i : {
4045
+ ...i,
4046
+ headers: t,
4047
+ ...e ? { body: e } : {}
4048
+ };
4049
+ }
4050
+ case "http-response": {
4051
+ let e = r(i.headers);
4052
+ return e === i.headers ? i : {
4053
+ ...i,
4054
+ headers: e
4055
+ };
4056
+ }
4057
+ case "http-end": {
4058
+ let e = i.body && n(i.body);
4059
+ return e === i.body ? i : {
4060
+ ...i,
4061
+ body: e
4062
+ };
4063
+ }
4064
+ case "ws-send":
4065
+ case "ws-message": {
4066
+ let e = n(i.data);
4067
+ return e === i.data ? i : {
4068
+ ...i,
4069
+ data: e
4070
+ };
4071
+ }
4072
+ case "sse-message": {
4073
+ let e = $(i.data, t);
4074
+ return e === i.data ? i : {
4075
+ ...i,
4076
+ data: e
4077
+ };
4078
+ }
4079
+ default: return i;
4080
+ }
4081
+ }
4082
+ function Ni(e, t, n = Q) {
4083
+ let r = Ai(e, n);
4084
+ for (let e of t) Di.is(e) && (r = wi(r, e.queryParam, n));
4085
+ return Ti(r, si(pi(t), n).jwt);
3718
4086
  }
3719
4087
  //#endregion
3720
4088
  //#region src/capture/pipeline.ts
3721
- function Ur(e, t) {
3722
- let n = 0, r = 0;
4089
+ function Pi(e, t, n = () => !1, r = Q) {
4090
+ let i = 0, a = 0;
3723
4091
  return {
3724
- ignores: (t) => e.ignoreUrls.some((e) => Cr(e, t)),
3725
- nextId: () => r++,
3726
- place: () => n++,
3727
- emit(r) {
4092
+ ignores: (t) => n() || e.ignoreUrls.some((e) => qr(e, t)),
4093
+ nextId: () => a++,
4094
+ place: () => i++,
4095
+ emit(n) {
3728
4096
  try {
3729
- let i = Vr(r, e.redact);
3730
- if (e.beforeRecord && (i = e.beforeRecord(i)), !i) return;
4097
+ let a = ji(n, e.redact, r);
4098
+ if (e.beforeRecord && (a = e.beforeRecord(a)), !a) return;
3731
4099
  t({
3732
- ...i,
3733
- n: i.n ?? n++
4100
+ ...a,
4101
+ n: a.n ?? i++
3734
4102
  });
3735
4103
  } catch {}
3736
4104
  }
3737
4105
  };
3738
4106
  }
3739
4107
  //#endregion
4108
+ //#region src/capture/rrweb-errors.ts
4109
+ var Fi = 3, Ii = /^(?:[A-Z][A-Za-z]{0,58})?Error$/;
4110
+ function Li(e) {
4111
+ let t;
4112
+ try {
4113
+ t = e?.name;
4114
+ } catch {}
4115
+ return typeof t == "string" && Ii.test(t) ? t : "other";
4116
+ }
4117
+ function Ri(e) {
4118
+ let t = /* @__PURE__ */ new Set();
4119
+ return (n, r) => Y(() => {
4120
+ let i = Li(n), a = `${i} ${r}`;
4121
+ t.size >= Fi || t.has(a) || (t.add(a), e({
4122
+ type: 6,
4123
+ timestamp: Date.now(),
4124
+ data: {
4125
+ plugin: Fn,
4126
+ payload: {
4127
+ name: i,
4128
+ during: r
4129
+ }
4130
+ }
4131
+ }));
4132
+ });
4133
+ }
4134
+ //#endregion
3740
4135
  //#region src/capture/websocket.ts
3741
- var Wr = EventTarget.prototype.addEventListener;
3742
- function Gr(e, t, n) {
4136
+ var zi = EventTarget.prototype.addEventListener;
4137
+ function Bi(e, t, n) {
3743
4138
  let r = e.WebSocket;
3744
4139
  if (typeof r != "function") return;
3745
- let i = /* @__PURE__ */ new WeakMap(), a = (e) => $(() => t.emit(e));
4140
+ let i = /* @__PURE__ */ new WeakMap(), a = (e) => Y(() => t.emit(e));
3746
4141
  function o(e) {
3747
4142
  return e > n.maxBodySize ? {
3748
4143
  omitted: "too-large",
@@ -3753,7 +4148,7 @@ function Gr(e, t, n) {
3753
4148
  let s = Date.now();
3754
4149
  if (r instanceof Blob) {
3755
4150
  let o = t.place();
3756
- Ln(r, n, !0).catch(() => ({ omitted: "unreadable" })).then((t) => a({
4151
+ ar(r, n, !0).catch(() => ({ omitted: "unreadable" })).then((t) => a({
3757
4152
  type: e,
3758
4153
  data: t,
3759
4154
  t: s,
@@ -3763,10 +4158,10 @@ function Gr(e, t, n) {
3763
4158
  return;
3764
4159
  }
3765
4160
  let c;
3766
- if (typeof r == "string") c = In(r, n) ?? { text: r };
4161
+ if (typeof r == "string") c = ir(r, n) ?? { text: r };
3767
4162
  else if (r instanceof ArrayBuffer || ArrayBuffer.isView(r)) {
3768
4163
  let e = r instanceof ArrayBuffer ? new Uint8Array(r) : new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
3769
- c = o(e.byteLength) ?? { base64: kn(e) };
4164
+ c = o(e.byteLength) ?? { base64: Zn(e) };
3770
4165
  } else c = { omitted: "unreadable" };
3771
4166
  a({
3772
4167
  type: e,
@@ -3777,7 +4172,7 @@ function Gr(e, t, n) {
3777
4172
  }
3778
4173
  class c extends r {
3779
4174
  constructor(e, n) {
3780
- super(e, n), $(() => {
4175
+ super(e, n), Y(() => {
3781
4176
  if (t.ignores(this.url)) return;
3782
4177
  let e = {
3783
4178
  id: t.nextId(),
@@ -3791,13 +4186,13 @@ function Gr(e, t, n) {
3791
4186
  protocols: n === void 0 ? [] : [n].flat(),
3792
4187
  t: Date.now(),
3793
4188
  id: r
3794
- }), Wr.call(this, "open", () => a({
4189
+ }), zi.call(this, "open", () => a({
3795
4190
  type: "ws-open",
3796
4191
  protocol: this.protocol,
3797
4192
  extensions: this.extensions,
3798
4193
  t: Date.now(),
3799
4194
  id: r
3800
- })), Wr.call(this, "message", (e) => $(() => s("ws-message", e.data, r))), Wr.call(this, "close", (t) => {
4195
+ })), zi.call(this, "message", (e) => Y(() => s("ws-message", e.data, r))), zi.call(this, "close", (t) => {
3801
4196
  let n = t;
3802
4197
  a({
3803
4198
  type: "ws-close",
@@ -3808,7 +4203,7 @@ function Gr(e, t, n) {
3808
4203
  t: Date.now(),
3809
4204
  id: r
3810
4205
  });
3811
- }), Wr.call(this, "error", () => a({
4206
+ }), zi.call(this, "error", () => a({
3812
4207
  type: "ws-error",
3813
4208
  t: Date.now(),
3814
4209
  id: r
@@ -3816,13 +4211,13 @@ function Gr(e, t, n) {
3816
4211
  });
3817
4212
  }
3818
4213
  send(e) {
3819
- $(() => {
4214
+ Y(() => {
3820
4215
  let t = i.get(this);
3821
4216
  t && this.readyState === r.OPEN && s("ws-send", e, t.id);
3822
4217
  }), super.send(e);
3823
4218
  }
3824
4219
  close(e, t) {
3825
- $(() => {
4220
+ Y(() => {
3826
4221
  let e = i.get(this);
3827
4222
  e && (e.byApp = !0);
3828
4223
  }), super.close(e, t);
@@ -3831,47 +4226,110 @@ function Gr(e, t, n) {
3831
4226
  Object.defineProperty(c, "name", { value: "WebSocket" }), e.WebSocket = c;
3832
4227
  }
3833
4228
  //#endregion
4229
+ //#region src/redact/storage.ts
4230
+ var Vi = /^(?:__Host-|__Secure-)?(?:session|sid|connect\.sid|phpsessid|jsessionid|asp\.net_sessionid|.+_session)$/i;
4231
+ function Hi(e, t, n, r = Q) {
4232
+ let i = pi(n), { replace: a, field: o, jwt: s } = si(i, r);
4233
+ if (X(Vi, e)) return a(t);
4234
+ if (i.some((t) => X(t, e))) return o(t);
4235
+ if (Qr(t)) {
4236
+ let e = t;
4237
+ for (let t of i) e = ti(e, t, o);
4238
+ return $(e, s);
4239
+ }
4240
+ return $(t, s);
4241
+ }
4242
+ function Ui(e, t, n, r) {
4243
+ (X(Vi, e) || pi(n).some((t) => X(t, e)) || t.includes(".eyJ")) && Hi(e, t, n, r);
4244
+ }
4245
+ function Wi(e, t, n, r = Q) {
4246
+ let i = Gi(t);
4247
+ if (i === null || i === t) return Hi(e, t, n, r);
4248
+ let a = Hi(e, i, n, r);
4249
+ return a === i ? t : qi(a);
4250
+ }
4251
+ function Gi(e) {
4252
+ try {
4253
+ return decodeURIComponent(e);
4254
+ } catch {
4255
+ return null;
4256
+ }
4257
+ }
4258
+ var Ki = /[%;,\s"\\\p{Cc}\P{ASCII}]/gu, qi = (e) => e.replace(Ki, encodeURIComponent);
4259
+ function Ji(e, t, n = Q) {
4260
+ return e === "" ? e : e.split("; ").map((e) => {
4261
+ let r = e.indexOf("="), [i, a] = r < 0 ? ["", e] : [e.slice(0, r), e.slice(r + 1)], o = Wi(i, a, t, n);
4262
+ return r < 0 ? o : `${i}=${o}`;
4263
+ }).join("; ");
4264
+ }
4265
+ //#endregion
3834
4266
  //#region src/capture/storage.ts
3835
- function Kr(e, t, n) {
3836
- let r = (e) => $(() => t({
4267
+ function Yi(e, t, n = Q) {
4268
+ let r = (e) => {
4269
+ let r = [];
4270
+ for (let i = 0; i < e.length; i++) {
4271
+ let a = e.key(i);
4272
+ if (a !== null) {
4273
+ let i = e.getItem(a);
4274
+ i !== null && r.push({
4275
+ key: a,
4276
+ value: Hi(a, i, t, n)
4277
+ });
4278
+ }
4279
+ }
4280
+ return r;
4281
+ };
4282
+ return {
4283
+ localStorage: e.localStorage ? r(e.localStorage) : [],
4284
+ sessionStorage: e.sessionStorage ? r(e.sessionStorage) : [],
4285
+ cookies: Ji(e.document.cookie ?? "", t, n)
4286
+ };
4287
+ }
4288
+ function Xi(e, t, n, r = Q) {
4289
+ let i = (e) => Y(() => t({
3837
4290
  type: 6,
3838
4291
  timestamp: Date.now(),
3839
4292
  data: {
3840
- plugin: Zn,
4293
+ plugin: Rn,
3841
4294
  payload: e
3842
4295
  }
3843
4296
  }));
3844
- Qn(e, r, qn), e.addEventListener("storage", (t) => $(() => {
3845
- if (t.storageArea === e.localStorage) if (t.key === null) r({
4297
+ zn(e, i, Nn, (e, t) => {
4298
+ t.length <= n.maxBodySize && Ui(e, t, n.redact, r);
4299
+ }), e.addEventListener("storage", (t) => Y(() => {
4300
+ if (t.storageArea === e.localStorage) if (t.key === null) i({
3846
4301
  by: "other-tab",
3847
4302
  area: "local",
3848
4303
  op: "clear"
3849
4304
  });
3850
- else if (t.newValue === null) r({
4305
+ else if (t.newValue === null) i({
3851
4306
  by: "other-tab",
3852
4307
  area: "local",
3853
4308
  op: "remove",
3854
4309
  key: t.key
3855
4310
  });
3856
4311
  else {
3857
- let e = t.newValue.length, i = e > n.maxBodySize ? null : t.newValue;
3858
- r({
4312
+ let e = t.newValue.length, a = e > n.maxBodySize ? null : Hi(t.key, t.newValue, n.redact, r);
4313
+ i({
3859
4314
  by: "other-tab",
3860
4315
  area: "local",
3861
4316
  op: "set",
3862
4317
  key: t.key,
3863
- value: i,
4318
+ value: a,
3864
4319
  size: e
3865
4320
  });
3866
4321
  }
3867
- })), e.cookieStore?.addEventListener("change", (e) => $(() => {
3868
- let { changed: t, deleted: n } = e;
3869
- for (let e of t) r({
3870
- by: "cookie",
3871
- op: "set",
3872
- cookie: qr(e)
3873
- });
3874
- for (let e of n) r({
4322
+ })), e.cookieStore?.addEventListener("change", (e) => Y(() => {
4323
+ let { changed: t, deleted: a } = e;
4324
+ for (let e of t) {
4325
+ let t = Zi(e);
4326
+ t.value = Wi(t.name, t.value, n.redact, r), i({
4327
+ by: "cookie",
4328
+ op: "set",
4329
+ cookie: t
4330
+ });
4331
+ }
4332
+ for (let e of a) i({
3875
4333
  by: "cookie",
3876
4334
  op: "remove",
3877
4335
  name: e.name ?? "",
@@ -3880,7 +4338,7 @@ function Kr(e, t, n) {
3880
4338
  });
3881
4339
  }));
3882
4340
  }
3883
- function qr(e) {
4341
+ function Zi(e) {
3884
4342
  let t = e.sameSite === "strict" || e.sameSite === "none" ? e.sameSite : "lax";
3885
4343
  return {
3886
4344
  name: e.name ?? "",
@@ -3894,23 +4352,23 @@ function qr(e) {
3894
4352
  }
3895
4353
  //#endregion
3896
4354
  //#region src/capture/xhr.ts
3897
- function Jr(e) {
4355
+ function Qi(e) {
3898
4356
  let t = new Headers();
3899
4357
  for (let [n, r] of e) t.append(n, r);
3900
4358
  return [...t];
3901
4359
  }
3902
- function Yr(e) {
4360
+ function $i(e) {
3903
4361
  return e.trim().split(/[\r\n]+/).filter(Boolean).map((e) => {
3904
4362
  let t = e.indexOf(":");
3905
4363
  return [e.slice(0, t).trim(), e.slice(t + 1).trim()];
3906
4364
  });
3907
4365
  }
3908
- function Xr(e) {
4366
+ function ea(e) {
3909
4367
  let t = e.indexOf("#");
3910
4368
  return t === -1 ? e : e.slice(0, t);
3911
4369
  }
3912
- function Zr(e, t, n) {
3913
- let r = e.XMLHttpRequest.prototype, { open: i, setRequestHeader: a, send: o } = r, s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakSet(), l = (e) => $(() => t.emit(e));
4370
+ function ta(e, t, n) {
4371
+ let r = e.XMLHttpRequest.prototype, { open: i, setRequestHeader: a, send: o } = r, s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakSet(), l = (e) => Y(() => t.emit(e));
3914
4372
  function u(e) {
3915
4373
  return e > n.maxBodySize ? {
3916
4374
  omitted: "too-large",
@@ -3923,8 +4381,8 @@ function Zr(e, t, n) {
3923
4381
  status: e.status,
3924
4382
  statusText: e.statusText,
3925
4383
  url: e.responseURL || t.url,
3926
- redirected: !!e.responseURL && e.responseURL !== Xr(t.url),
3927
- headers: Jr(Yr(e.getAllResponseHeaders())),
4384
+ redirected: !!e.responseURL && e.responseURL !== ea(t.url),
4385
+ headers: Qi($i(e.getAllResponseHeaders())),
3928
4386
  t: Date.now(),
3929
4387
  id: t.id
3930
4388
  }));
@@ -3947,7 +4405,7 @@ function Zr(e, t, n) {
3947
4405
  t: Date.now(),
3948
4406
  id: i
3949
4407
  });
3950
- if (sr(e.getResponseHeader("content-type"), n.mediaTypes)) {
4408
+ if (Ar(e.getResponseHeader("content-type"), n.mediaTypes)) {
3951
4409
  a({ omitted: "media" });
3952
4410
  return;
3953
4411
  }
@@ -3955,16 +4413,16 @@ function Zr(e, t, n) {
3955
4413
  case "":
3956
4414
  case "text": {
3957
4415
  let t = e.responseText;
3958
- a(In(t, n) ?? { text: t });
4416
+ a(ir(t, n) ?? { text: t });
3959
4417
  return;
3960
4418
  }
3961
4419
  case "json": {
3962
4420
  let r = e.response, a = Date.now(), o = t.place();
3963
- setTimeout(() => $(() => {
4421
+ setTimeout(() => Y(() => {
3964
4422
  let e = JSON.stringify(r);
3965
4423
  l({
3966
4424
  type: "http-end",
3967
- body: In(e, n) ?? { text: e },
4425
+ body: ir(e, n) ?? { text: e },
3968
4426
  t: a,
3969
4427
  id: i,
3970
4428
  n: o
@@ -3974,12 +4432,12 @@ function Zr(e, t, n) {
3974
4432
  }
3975
4433
  case "arraybuffer": {
3976
4434
  let t = new Uint8Array(e.response);
3977
- a(u(t.byteLength) ?? An(t));
4435
+ a(u(t.byteLength) ?? Qn(t));
3978
4436
  return;
3979
4437
  }
3980
4438
  case "blob": {
3981
4439
  let r = Date.now(), a = t.place();
3982
- Ln(e.response, n).catch(() => ({ omitted: "unreadable" })).then((e) => l({
4440
+ ar(e.response, n).catch(() => ({ omitted: "unreadable" })).then((e) => l({
3983
4441
  type: "http-end",
3984
4442
  body: e,
3985
4443
  t: r,
@@ -3993,10 +4451,10 @@ function Zr(e, t, n) {
3993
4451
  }
3994
4452
  function m(e) {
3995
4453
  if (!c.has(e)) {
3996
- c.add(e), e.addEventListener("readystatechange", () => $(() => {
4454
+ c.add(e), e.addEventListener("readystatechange", () => Y(() => {
3997
4455
  let t = s.get(e);
3998
4456
  t?.sent && e.readyState === XMLHttpRequest.HEADERS_RECEIVED && d(e, t);
3999
- })), e.addEventListener("load", () => $(() => {
4457
+ })), e.addEventListener("load", () => Y(() => {
4000
4458
  let t = s.get(e);
4001
4459
  t?.sent && e.readyState === XMLHttpRequest.DONE && p(e, t);
4002
4460
  }));
@@ -4004,20 +4462,20 @@ function Zr(e, t, n) {
4004
4462
  error: "network",
4005
4463
  abort: "abort",
4006
4464
  timeout: "timeout"
4007
- })) e.addEventListener(t, () => $(() => {
4465
+ })) e.addEventListener(t, () => Y(() => {
4008
4466
  let t = s.get(e);
4009
4467
  t?.sent && f(t, n);
4010
4468
  }));
4011
4469
  }
4012
4470
  }
4013
4471
  r.open = function(...e) {
4014
- return $(() => {
4472
+ return Y(() => {
4015
4473
  let n = s.get(this);
4016
4474
  n?.sent && !n.ended && (this.readyState === XMLHttpRequest.DONE ? p(this, n) : f(n, "abort"));
4017
4475
  let [r, i] = e, a = new URL(String(i), document.baseURI).href;
4018
4476
  s.set(this, t.ignores(a) ? null : {
4019
4477
  id: t.nextId(),
4020
- method: lr(r),
4478
+ method: Mr(r),
4021
4479
  url: a,
4022
4480
  headers: [],
4023
4481
  sent: !1,
@@ -4026,15 +4484,15 @@ function Zr(e, t, n) {
4026
4484
  });
4027
4485
  }), Reflect.apply(i, this, e);
4028
4486
  }, r.setRequestHeader = function(e, t) {
4029
- a.call(this, e, t), $(() => s.get(this)?.headers.push([e.toLowerCase(), t]));
4487
+ a.call(this, e, t), Y(() => s.get(this)?.headers.push([e.toLowerCase(), t]));
4030
4488
  }, r.send = function(e) {
4031
- return $(() => {
4489
+ return Y(() => {
4032
4490
  let r = s.get(this);
4033
4491
  if (!r || r.sent || this.readyState !== XMLHttpRequest.OPENED) return;
4034
4492
  r.sent = !0;
4035
- let i = Date.now(), { id: a, method: o, url: c } = r, u = [...r.headers], d = u.some(([e]) => e === "content-type") ? null : Bn(e);
4493
+ let i = Date.now(), { id: a, method: o, url: c } = r, u = [...r.headers], d = u.some(([e]) => e === "content-type") ? null : cr(e);
4036
4494
  d && u.push(["content-type", d]);
4037
- let f = Jr(u);
4495
+ let f = Qi(u);
4038
4496
  m(this);
4039
4497
  let p = (e) => ({
4040
4498
  type: "http-request",
@@ -4045,7 +4503,7 @@ function Zr(e, t, n) {
4045
4503
  ...e ? { body: e } : {},
4046
4504
  t: i,
4047
4505
  id: a
4048
- }), h = zn(e, n);
4506
+ }), h = sr(e, n);
4049
4507
  if (h instanceof Promise) {
4050
4508
  let e = t.place();
4051
4509
  h.catch(() => ({ omitted: "unreadable" })).then((t) => l({
@@ -4057,40 +4515,163 @@ function Zr(e, t, n) {
4057
4515
  };
4058
4516
  }
4059
4517
  //#endregion
4060
- //#region src/upload/stream.ts
4061
- function Qr(e) {
4062
- return {
4063
- type: 6,
4064
- timestamp: e.t,
4065
- data: {
4066
- plugin: Yn,
4067
- payload: e
4518
+ //#region src/redact/scrub.ts
4519
+ var na = 8, ra = 4096, ia = 256, aa = ".cmVkYWN0ZWQ", oa = /^(?:bearer|basic|token|bot|apikey|digest|negotiate) +(\S+)$/i;
4520
+ function sa(e) {
4521
+ return e.length < na || e.length > ra || /^[A-Za-z]{1,11}$/.test(e) || /^\d{1,11}$/.test(e) || new Set(e).size < 5 ? !1 : e !== "[redacted]" && e !== "[object Object]" && !e.endsWith(aa);
4522
+ }
4523
+ function ca(e) {
4524
+ return e.replace(/[a-z]/g, "x").replace(/[A-Z]/g, "X").replace(/\d/g, "0");
4525
+ }
4526
+ var la = 31, ua = 1;
4527
+ for (let e = 1; e < na; e++) ua = Math.imul(ua, la);
4528
+ var da = 65536;
4529
+ function fa(e, t) {
4530
+ let n = 0;
4531
+ for (let r = 0; r < na; r++) n = Math.imul(n, la) + e.charCodeAt(t + r) | 0;
4532
+ return n;
4533
+ }
4534
+ function pa(e) {
4535
+ let t = /* @__PURE__ */ new Uint8Array(8192), n = /* @__PURE__ */ new Map();
4536
+ for (let r of e) {
4537
+ let e = fa(r, 0), i = e & da - 1;
4538
+ t[i >> 3] |= 1 << (i & 7);
4539
+ let a = n.get(e);
4540
+ a ? a.push(r) : n.set(e, [r]);
4541
+ }
4542
+ let r = (r, i) => {
4543
+ if (e.length === 0 || r.length < na) return;
4544
+ let a = fa(r, 0);
4545
+ for (let e = 0;; e++) {
4546
+ let o = a & da - 1;
4547
+ if (t[o >> 3] & 1 << (o & 7)) {
4548
+ for (let t of n.get(a) ?? []) if (r.startsWith(t, e) && i(t)) return;
4549
+ }
4550
+ if (e + na >= r.length) return;
4551
+ let s = Math.imul(r.charCodeAt(e), ua);
4552
+ a = Math.imul(a - s, la) + r.charCodeAt(e + na) | 0;
4068
4553
  }
4069
4554
  };
4070
- }
4071
- function $r(e, t) {
4072
4555
  return {
4073
- type: 6,
4074
- timestamp: t,
4075
- data: {
4076
- plugin: Xn,
4077
- payload: e
4556
+ any(e) {
4557
+ let t = !1;
4558
+ return r(e, () => t = !0), t;
4559
+ },
4560
+ all(e) {
4561
+ let t = /* @__PURE__ */ new Set();
4562
+ return r(e, (e) => (t.add(e), !1)), t;
4078
4563
  }
4079
4564
  };
4080
4565
  }
4081
- function ei(e, t) {
4566
+ var ma = /* @__PURE__ */ new Set([
4567
+ 2,
4568
+ 3,
4569
+ 4
4570
+ ]), ha = 3, ga = 5, _a = (e) => {
4571
+ try {
4572
+ return decodeURIComponent(e);
4573
+ } catch {
4574
+ return null;
4575
+ }
4576
+ };
4577
+ function va(e) {
4578
+ let t = e.data;
4579
+ return e.type === ha && t.source === ga ? t : null;
4580
+ }
4581
+ function ya(e) {
4582
+ let t = /* @__PURE__ */ new Map(), n = null, r = /* @__PURE__ */ new Map(), i = (e, r) => {
4583
+ if (!sa(e)) return;
4584
+ let i = t.get(e);
4585
+ t.delete(e), t.size >= ia && t.delete(t.keys().next().value);
4586
+ let a = i && i.replacement !== "[redacted]" ? i.replacement : r;
4587
+ t.set(e, {
4588
+ value: e,
4589
+ needle: JSON.stringify(e).slice(1, -1),
4590
+ replacement: a
4591
+ }), n = null;
4592
+ }, a = (e, t) => {
4593
+ try {
4594
+ if (e === t) return;
4595
+ let n = e.trim();
4596
+ i(n, t);
4597
+ let r = oa.exec(n)?.[1];
4598
+ r && i(r, Z);
4599
+ for (let e of /* @__PURE__ */ new Set([_a(n), _a(n.replaceAll("+", " "))])) e !== null && e !== n && i(e, Z);
4600
+ } catch {}
4601
+ }, { jwt: o } = si(pi(e), a), s = (e, t, n) => {
4602
+ let r = e.includes(".eyJ") ? $(e, o) : e;
4603
+ for (let e of t) {
4604
+ if (!r.includes(e.value)) continue;
4605
+ let t = n && e.replacement === "[redacted]" ? ca(e.value) : e.replacement;
4606
+ r = r.split(e.value).join(t);
4607
+ }
4608
+ return r;
4609
+ }, c = (e, t, n) => {
4610
+ if (typeof e == "string") return s(e, t, !1);
4611
+ if (Array.isArray(e)) return e.map((e) => c(e, t, !1));
4612
+ if (typeof e != "object" || !e) return e;
4613
+ let r = e;
4614
+ for (let [e, i] of Object.entries(r)) if (typeof i == "string") r[e] = s(i, t, n && e === "text");
4615
+ else if (e === "attributes" && typeof i == "object" && i) if (Array.isArray(i)) r[e] = c(i, t, !1);
4616
+ else {
4617
+ let e = i;
4618
+ for (let [n, r] of Object.entries(e)) e[n] = typeof r == "string" ? s(r, t, n === "value") : c(r, t, !1);
4619
+ }
4620
+ else r[e] = c(i, t, !1);
4621
+ return r;
4622
+ };
4623
+ function l(e, i) {
4624
+ let a = [...t.values()];
4625
+ a.sort((e, t) => t.value.length - e.value.length), n ??= pa(a.map((e) => e.needle));
4626
+ let o = n, s = [], l = (t, n) => {
4627
+ e[t] = n, i[t] = JSON.stringify(n);
4628
+ };
4629
+ for (let t = 0; t < i.length; t++) {
4630
+ if (!ma.has(e[t].type)) continue;
4631
+ let n = i[t], u = va(e[t]), d = u?.text;
4632
+ if (u?.id !== void 0 && d && d.length >= na && !r.has(u.id)) {
4633
+ let e = a.find((e) => e.value.startsWith(d));
4634
+ e && r.set(u.id, e);
4635
+ }
4636
+ try {
4637
+ let e = n.includes(".eyJ"), i = o.all(n);
4638
+ if (i.size === 0 && !e) continue;
4639
+ let s = a.filter((e) => i.has(e.needle)), u = JSON.parse(n), d = va(u), f = d?.text;
4640
+ if (c(u.data, s, d !== null), d?.id !== void 0 && typeof f == "string") {
4641
+ let e = s.find((e) => f.includes(e.value));
4642
+ e && r.set(d.id, e);
4643
+ }
4644
+ JSON.stringify(u) !== n && l(t, u);
4645
+ } catch {
4646
+ s.push(t);
4647
+ }
4648
+ }
4649
+ if (r.size === 0) return s;
4650
+ for (let t = 0; t < e.length; t++) {
4651
+ let n = va(e[t]);
4652
+ if (n?.id === void 0 || !n.text) continue;
4653
+ let a = r.get(n.id);
4654
+ if (!a || n.text === a.value || !a.value.startsWith(n.text)) continue;
4655
+ let o = a.replacement === "[redacted]" ? ca(a.value) : a.replacement, s = JSON.parse(i[t]);
4656
+ s.data.text = o.slice(0, n.text.length), l(t, s);
4657
+ }
4658
+ return s;
4659
+ }
4082
4660
  return {
4083
- type: 6,
4084
- timestamp: t,
4085
- data: {
4086
- plugin: Kn,
4087
- payload: e
4661
+ note: a,
4662
+ size: () => t.size,
4663
+ scrubChunk(e, t) {
4664
+ try {
4665
+ return l(e, t);
4666
+ } catch {
4667
+ return e.flatMap((e, t) => ma.has(e.type) ? [t] : []);
4668
+ }
4088
4669
  }
4089
4670
  };
4090
4671
  }
4091
4672
  //#endregion
4092
4673
  //#region src/upload/gzip.ts
4093
- async function ti(e) {
4674
+ async function ba(e) {
4094
4675
  let t = new TextEncoder().encode(e), n = new ReadableStream({ start(e) {
4095
4676
  e.enqueue(t), e.close();
4096
4677
  } }).pipeThrough(new CompressionStream("gzip")).getReader(), r = [], i = 0;
@@ -4101,69 +4682,94 @@ async function ti(e) {
4101
4682
  }
4102
4683
  //#endregion
4103
4684
  //#region src/upload/uploader.ts
4104
- var ni = 64 * 1024, ri = 1024;
4105
- function ii(e) {
4685
+ var xa = 64 * 1024, Sa = 1024;
4686
+ function Ca(e) {
4106
4687
  return e >= 400 && e < 500 && e !== 408 && e !== 429;
4107
4688
  }
4108
- function ai(e, t, n, r) {
4109
- let i = `${e.collectorUrl}/api/projects/${e.projectKey}/sessions/${t}/chunks`, a = 0, o = null;
4110
- async function s(t, o) {
4111
- let s = n.take();
4112
- if (s) try {
4113
- let { json: n } = s, c = await ti(n), l = {
4689
+ var wa = 1e4, Ta = 5 * 6e4, Ea = 10 * 6e4;
4690
+ function Da(e) {
4691
+ let t = e.headers.get("Retry-After")?.trim();
4692
+ return t && /^\d+$/.test(t) ? Number(t) * 1e3 : null;
4693
+ }
4694
+ function Oa(e, t, n, r) {
4695
+ let i = `${e.collectorUrl}/api/projects/${e.projectKey}/sessions/${t}/chunks`, a = 0, o = null, s = 0, c = 0, l = !1;
4696
+ function u(e) {
4697
+ c++;
4698
+ let t = e ?? Math.min(wa * 2 ** (c - 1), Ta);
4699
+ s = Date.now() + t;
4700
+ }
4701
+ async function d(t, o) {
4702
+ let d = n.take(t === "interval" ? { hold: e.uploadInterval } : {});
4703
+ if (!d) return;
4704
+ let f = !1;
4705
+ try {
4706
+ if (l) return;
4707
+ let { json: p } = d, m = await ba(p), h = {
4114
4708
  version: 1,
4115
4709
  sequenceNumber: a,
4116
4710
  sentAt: Date.now(),
4117
- start: s.start,
4118
- end: s.end,
4119
- eventCount: s.events.length,
4120
- hasFullSnapshot: s.hasFullSnapshot,
4711
+ start: d.start,
4712
+ end: d.end,
4713
+ eventCount: d.events.length,
4714
+ hasFullSnapshot: d.hasFullSnapshot,
4121
4715
  reason: t,
4122
- urls: s.urls,
4716
+ urls: d.urls,
4123
4717
  recorderVersion: e.recorderVersion,
4124
- rawBytes: n.length
4125
- }, u = JSON.stringify(l), d = () => {
4718
+ rawBytes: p.length
4719
+ }, g = JSON.stringify(h), _ = () => {
4126
4720
  let e = new FormData();
4127
- return e.append("metadata", new Blob([u], { type: "application/json" })), e.append("events", new Blob([c], { type: "application/gzip" })), e;
4128
- }, f = o && c.byteLength + u.length + ri <= ni, p = (e) => r(i, {
4721
+ return e.append("metadata", new Blob([g], { type: "application/json" })), e.append("events", new Blob([m], { type: "application/gzip" })), e;
4722
+ }, v = o && m.byteLength + g.length + Sa <= xa, y = (e) => r(i, {
4129
4723
  method: "POST",
4130
- body: d(),
4724
+ body: _(),
4131
4725
  keepalive: e
4132
- }), m = await p(f).catch((e) => {
4133
- if (f && e instanceof TypeError) return p(!1);
4726
+ }), b = await y(v).catch((e) => {
4727
+ if (v && e instanceof TypeError) return y(!1);
4134
4728
  throw e;
4135
4729
  });
4136
- if (!m.ok && !ii(m.status)) throw Error(`Collector responded ${m.status}`);
4137
- a++;
4730
+ if (!b.ok && !Ca(b.status)) {
4731
+ let e = Da(b);
4732
+ if (e !== null && e > Ea) {
4733
+ l = !0, n.close();
4734
+ return;
4735
+ }
4736
+ u(e), f = !0;
4737
+ return;
4738
+ }
4739
+ a++, c = 0, s = 0;
4138
4740
  } catch {
4139
- n.restore(s);
4741
+ u(null), f = !0;
4742
+ } finally {
4743
+ f ? n.restore(d) : n.release(d);
4140
4744
  }
4141
4745
  }
4142
- async function c(t, r) {
4143
- for (; o;) {
4144
- if (!r) return;
4145
- await o;
4146
- }
4147
- o = s(t, r);
4148
- try {
4149
- await o;
4150
- } finally {
4151
- o = null;
4746
+ async function f(t, r) {
4747
+ if (!(!r && Date.now() < s)) {
4748
+ for (; o;) {
4749
+ if (!r) return;
4750
+ await o;
4751
+ }
4752
+ o = d(t, r);
4753
+ try {
4754
+ await o;
4755
+ } finally {
4756
+ o = null;
4757
+ }
4758
+ n.bytes() >= e.earlyUploadBytes && f("size", !1);
4152
4759
  }
4153
- n.bytes() >= e.earlyUploadBytes && c("size", !1);
4154
4760
  }
4155
4761
  return setInterval(() => {
4156
- c("interval", !1);
4762
+ f("interval", !1);
4157
4763
  }, e.uploadInterval), {
4158
- flush: ({ final: e = !1 } = {}) => c(e ? "hidden" : "interval", e),
4764
+ flush: ({ final: e = !1 } = {}) => f(e ? "hidden" : "interval", e),
4159
4765
  notify() {
4160
- !o && n.bytes() >= e.earlyUploadBytes && c("size", !1);
4766
+ !o && n.bytes() >= e.earlyUploadBytes && f("size", !1);
4161
4767
  }
4162
4768
  };
4163
4769
  }
4164
4770
  //#endregion
4165
4771
  //#region src/util/uuid.ts
4166
- function oi() {
4772
+ function ka() {
4167
4773
  let e = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), t = Date.now();
4168
4774
  for (let n = 0; n < 6; n++) e[n] = Math.floor(t / 2 ** (8 * (5 - n))) % 256;
4169
4775
  e[6] = e[6] & 15 | 112, e[8] = e[8] & 63 | 128;
@@ -4172,63 +4778,64 @@ function oi() {
4172
4778
  }
4173
4779
  //#endregion
4174
4780
  //#region src/init.ts
4175
- var si = 4;
4176
- function ci() {
4177
- let e = (e) => {
4178
- let t = [];
4179
- for (let n = 0; n < e.length; n++) {
4180
- let r = e.key(n);
4181
- if (r !== null) {
4182
- let n = e.getItem(r);
4183
- n !== null && t.push({
4184
- key: r,
4185
- value: n
4186
- });
4187
- }
4188
- }
4189
- return t;
4190
- };
4191
- return {
4192
- localStorage: window.localStorage ? e(localStorage) : [],
4193
- sessionStorage: window.sessionStorage ? e(sessionStorage) : [],
4194
- cookies: document.cookie ?? ""
4195
- };
4196
- }
4197
- function li(e) {
4781
+ var Aa = 4, ja = 3, Ma = 5;
4782
+ function Na(e) {
4198
4783
  if (!e?.projectKey) throw Error("mime8.init: projectKey is required");
4199
4784
  if (window.mime8Replay === !0 || window.__mime8) return;
4200
- let t = Dn(e), n = window.fetch.bind(window);
4785
+ let t = Yn(e), n = window.fetch.bind(window);
4201
4786
  window.__mime8 = {
4202
- sessionId: oi(),
4787
+ sessionId: ka(),
4203
4788
  events: []
4204
4789
  };
4205
- let r = (e) => Hr(e, t.redact), i = En(window.__mime8, r), a = Date.now();
4206
- i.push($r(ci(), a)), $(() => i.push(ei(Gn(), a)));
4207
- let o = ai(t, window.__mime8.sessionId, i, n), s = Ur(t, (e) => {
4208
- i.push(Qr(e)), o.notify();
4209
- });
4210
- vr(window, s, t), Zr(window, s, t), Un(window, s, t), or(window, s), Gr(window, s, t), br(window, s), ir(document, (e) => {
4211
- i.push(e), o.notify();
4790
+ let r = ya(t.redact), i = (e) => Ni(e, t.redact, r.note), a = !1, o, s = Jn(window.__mime8, i, t.maxBufferBytes, () => {
4791
+ a = !0, queueMicrotask(() => Y(() => o?.()));
4792
+ }, (e, t) => r.scrubChunk(e, t)), c = Date.now();
4793
+ s.push(Vn(Yi(window, t.redact, r.note), c)), Y(() => s.push(Hn(pr(), c)));
4794
+ let l = Oa(t, window.__mime8.sessionId, s, n), u = Gr(t.maxBatchChanges, (e) => {
4795
+ s.end(Un({
4796
+ reason: "mutations",
4797
+ limit: t.maxBatchChanges,
4798
+ records: e
4799
+ }, Date.now())), l.notify();
4800
+ }, () => a), d = Pi(t, (e) => {
4801
+ s.push(Bn(e)), l.notify();
4802
+ }, () => a, r.note);
4803
+ Vr(window, d, t), ta(window, d, t), dr(window, d, t), kr(window, d), Bi(window, d, t), Ur(window, d);
4804
+ let f = Dr(window);
4805
+ yr(document, (e) => {
4806
+ s.push(e), l.notify();
4212
4807
  }, (e) => {
4213
- let t = wn.mirror.getId(e);
4808
+ let t = An.mirror.getId(e);
4214
4809
  return t > 0 ? t : null;
4215
- }), Kr(window, (e) => {
4216
- i.push(e), o.notify();
4217
- }, t), document.addEventListener("visibilitychange", () => {
4218
- document.visibilityState === "hidden" && o.flush({ final: !0 });
4810
+ }), Xi(window, (e) => {
4811
+ s.push(e), l.notify();
4812
+ }, t, r.note), document.addEventListener("visibilitychange", () => {
4813
+ document.visibilityState === "hidden" && l.flush({ final: !0 });
4219
4814
  });
4220
- let c = () => {
4221
- wn({ emit(e) {
4222
- e.type === si && (e = {
4223
- ...e,
4224
- data: {
4225
- ...e.data,
4226
- href: r(e.data.href)
4227
- }
4228
- }), i.push(e), o.notify();
4229
- } });
4815
+ let p = Ri((e) => {
4816
+ s.push(e), l.notify();
4817
+ }), m = !1, h = () => {
4818
+ try {
4819
+ if (a) return;
4820
+ o = An({
4821
+ errorHandler: (e) => (p(e, m ? "recording" : "start"), !0),
4822
+ onMutation: u,
4823
+ userTriggeredOnInput: !0,
4824
+ emit: (e) => Y(() => {
4825
+ (e.type !== ja || e.data.source !== Ma || e.data.id !== -1) && (e.type === Aa && (e = {
4826
+ ...e,
4827
+ data: {
4828
+ ...e.data,
4829
+ href: i(e.data.href)
4830
+ }
4831
+ }), e = f.mark(e), s.push(e), l.notify());
4832
+ })
4833
+ }), m = !0;
4834
+ } catch (e) {
4835
+ p(e, "start");
4836
+ }
4230
4837
  };
4231
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", c) : c();
4838
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", h) : h();
4232
4839
  }
4233
4840
  //#endregion
4234
- export { li as init };
4841
+ export { Na as init };