@getpinax/widget 0.0.0-stage → 1.0.0-beta.1

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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +267 -2
  3. package/dist/api.d.ts +62 -0
  4. package/dist/capture/breadcrumbs.d.ts +49 -0
  5. package/dist/capture/console.d.ts +17 -0
  6. package/dist/capture/env.d.ts +25 -0
  7. package/dist/capture/network.d.ts +23 -0
  8. package/dist/capture/ring.d.ts +14 -0
  9. package/dist/capture/signature.d.ts +2 -0
  10. package/dist/capture/text.d.ts +7 -0
  11. package/dist/capture/ua.d.ts +13 -0
  12. package/dist/chunks/editor-DbHLGwOA.mjs +1368 -0
  13. package/dist/chunks/privacy-DmU6v5Fr.mjs +39 -0
  14. package/dist/chunks/recorder-BUtEB_em.mjs +2859 -0
  15. package/dist/chunks/text-8QYEyRYs.mjs +18 -0
  16. package/dist/chunks/widget-CkR1Ptzb.mjs +961 -0
  17. package/dist/editor/annotator.d.ts +20 -0
  18. package/dist/editor/capture.d.ts +28 -0
  19. package/dist/editor/encode.d.ts +7 -0
  20. package/dist/editor/index.d.ts +5 -0
  21. package/dist/editor/mask.d.ts +29 -0
  22. package/dist/editor/pii.d.ts +22 -0
  23. package/dist/editor/shapes.d.ts +31 -0
  24. package/dist/editor-loader.d.ts +6 -0
  25. package/dist/editor-loader.embed.d.ts +5 -0
  26. package/dist/fixcheck.d.ts +31 -0
  27. package/dist/index.d.ts +46 -0
  28. package/dist/mount.d.ts +8 -0
  29. package/dist/navigation.d.ts +1 -0
  30. package/dist/paths.d.ts +4 -0
  31. package/dist/pinax-editor.js +1417 -0
  32. package/dist/pinax-recorder.js +2902 -0
  33. package/dist/pinax.js +113 -0
  34. package/dist/pinax.mjs +1041 -0
  35. package/dist/preview.d.ts +35 -0
  36. package/dist/preview.mjs +54 -0
  37. package/dist/privacy.d.ts +22 -0
  38. package/dist/queue.d.ts +9 -0
  39. package/dist/replay/buffer.d.ts +40 -0
  40. package/dist/replay/recorder.d.ts +15 -0
  41. package/dist/replay/sanitize.d.ts +13 -0
  42. package/dist/report.d.ts +109 -0
  43. package/dist/segment.d.ts +31 -0
  44. package/dist/settings.d.ts +31 -0
  45. package/dist/types.d.ts +137 -0
  46. package/dist/ui/color.d.ts +7 -0
  47. package/dist/ui/dom.d.ts +14 -0
  48. package/dist/ui/styles.d.ts +3 -0
  49. package/dist/ui/widget.d.ts +161 -0
  50. package/package.json +73 -4
@@ -0,0 +1,2859 @@
1
+ import { o as e } from "./privacy-DmU6v5Fr.mjs";
2
+ import { n as t } from "./text-8QYEyRYs.mjs";
3
+ // node_modules/@rrweb/record/dist/record.js
4
+ var n = Object.defineProperty, r = (e, t, r) => t in e ? n(e, t, {
5
+ enumerable: !0,
6
+ configurable: !0,
7
+ writable: !0,
8
+ value: r
9
+ }) : e[t] = r, i = (e, t, n) => r(e, typeof t == "symbol" ? t : t + "", n), a = /* @__PURE__ */ ((e) => (e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot", e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom", e[e.Plugin = 6] = "Plugin", e[e.Asset = 7] = "Asset", e))(a || {}), o = /* @__PURE__ */ ((e) => (e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction", e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input", e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction", e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation", e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration", e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet", e[e.CustomElement = 16] = "CustomElement", e))(o || {}), s = /* @__PURE__ */ ((e) => (e[e.MouseUp = 0] = "MouseUp", e[e.MouseDown = 1] = "MouseDown", e[e.Click = 2] = "Click", e[e.ContextMenu = 3] = "ContextMenu", e[e.DblClick = 4] = "DblClick", e[e.Focus = 5] = "Focus", e[e.Blur = 6] = "Blur", e[e.TouchStart = 7] = "TouchStart", e[e.TouchMove_Departed = 8] = "TouchMove_Departed", e[e.TouchEnd = 9] = "TouchEnd", e[e.TouchCancel = 10] = "TouchCancel", e))(s || {}), c = /* @__PURE__ */ ((e) => (e[e.Mouse = 0] = "Mouse", e[e.Pen = 1] = "Pen", e[e.Touch = 2] = "Touch", e))(c || {}), l = /* @__PURE__ */ ((e) => (e[e["2D"] = 0] = "2D", e[e.WebGL = 1] = "WebGL", e[e.WebGL2 = 2] = "WebGL2", e))(l || {}), u = /* @__PURE__ */ ((e) => (e[e.Play = 0] = "Play", e[e.Pause = 1] = "Pause", e[e.Seeked = 2] = "Seeked", e[e.VolumeChange = 3] = "VolumeChange", e[e.RateChange = 4] = "RateChange", e))(u || {}), d = /* @__PURE__ */ ((e) => (e[e.Document = 0] = "Document", e[e.DocumentType = 1] = "DocumentType", e[e.Element = 2] = "Element", e[e.Text = 3] = "Text", e[e.CDATA = 4] = "CDATA", e[e.Comment = 5] = "Comment", e))(d || {}), f = {
10
+ Node: [
11
+ "childNodes",
12
+ "parentNode",
13
+ "parentElement",
14
+ "textContent",
15
+ "ownerDocument",
16
+ "firstChild",
17
+ "lastChild",
18
+ "nextSibling",
19
+ "previousSibling"
20
+ ],
21
+ ShadowRoot: ["host", "styleSheets"],
22
+ Element: [
23
+ "shadowRoot",
24
+ "querySelector",
25
+ "querySelectorAll"
26
+ ],
27
+ MutationObserver: []
28
+ }, p = {
29
+ Node: ["contains", "getRootNode"],
30
+ ShadowRoot: ["getSelection"],
31
+ Element: [],
32
+ MutationObserver: ["constructor"]
33
+ }, m = {}, h = {}, g = () => !!globalThis.Zone;
34
+ function _(e) {
35
+ if (m[e]) return m[e];
36
+ let t = globalThis[e], n = t.prototype, r = e in f ? f[e] : void 0, i = !!(r && r.every((e) => !!(Object.getOwnPropertyDescriptor(n, e)?.get)?.toString().includes("[native code]"))), a = e in p ? p[e] : void 0, o = !!(a && a.every((e) => typeof n[e] == "function" && n[e]?.toString().includes("[native code]")));
37
+ if (i && o && !g()) return m[e] = t.prototype, t.prototype;
38
+ try {
39
+ let r = document.createElement("iframe");
40
+ r.style.display = "none", document.body.appendChild(r);
41
+ let i = r.contentWindow;
42
+ if (!i) return t.prototype;
43
+ let a = i[e].prototype;
44
+ if (!a) return r.remove(), n;
45
+ let o = navigator.userAgent;
46
+ return o.includes("Safari") && !o.includes("Chrome") ? (r.classList.add("rr-block"), r.setAttribute("__rrwebUntaintedMutationObserver", ""), h[e] = () => r.remove()) : r.remove(), m[e] = a;
47
+ } catch {
48
+ return n;
49
+ }
50
+ }
51
+ var v = {};
52
+ function y(e, t, n) {
53
+ let r = v[e]?.[n];
54
+ if (r) return r.call(t);
55
+ let i = _(e), a = Object.getOwnPropertyDescriptor(i, n)?.get;
56
+ return a ? ((v[e] || (v[e] = {}))[n] = a, a.call(t)) : t[n];
57
+ }
58
+ var b = {};
59
+ function x(e, t, n) {
60
+ let r = `${e}.${String(n)}`;
61
+ if (b[r]) return b[r].bind(t);
62
+ let i = _(e)[n];
63
+ return typeof i == "function" ? (b[r] = i, i.bind(t)) : t[n];
64
+ }
65
+ function S(e) {
66
+ return y("Node", e, "ownerDocument");
67
+ }
68
+ function C(e) {
69
+ return y("Node", e, "childNodes");
70
+ }
71
+ function w(e) {
72
+ return y("Node", e, "parentNode");
73
+ }
74
+ function ee(e) {
75
+ return y("Node", e, "parentElement");
76
+ }
77
+ function T(e) {
78
+ return y("Node", e, "textContent");
79
+ }
80
+ function E(e) {
81
+ return y("Node", e, "firstChild");
82
+ }
83
+ function D(e) {
84
+ return y("Node", e, "lastChild");
85
+ }
86
+ function O(e) {
87
+ return y("Node", e, "nextSibling");
88
+ }
89
+ function k(e) {
90
+ return y("Node", e, "previousSibling");
91
+ }
92
+ function A(e, t) {
93
+ return x("Node", e, "contains")(t);
94
+ }
95
+ function te(e) {
96
+ return x("Node", e, "getRootNode")();
97
+ }
98
+ function ne(e) {
99
+ return !e || !("host" in e) ? null : y("ShadowRoot", e, "host");
100
+ }
101
+ function re(e) {
102
+ return e.styleSheets;
103
+ }
104
+ function j(e) {
105
+ return !e || !("shadowRoot" in e) ? null : y("Element", e, "shadowRoot");
106
+ }
107
+ function ie(e, t) {
108
+ return y("Element", e, "querySelector")(t);
109
+ }
110
+ function ae(e, t) {
111
+ return y("Element", e, "querySelectorAll")(t);
112
+ }
113
+ function oe() {
114
+ return [_("MutationObserver").constructor, h.MutationObserver ?? (() => {})];
115
+ }
116
+ var M = Date.now;
117
+ /* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString()) || (M = () => (/* @__PURE__ */ new Date()).getTime());
118
+ function N(e, t, n) {
119
+ try {
120
+ if (!(t in e)) return () => {};
121
+ let r = e[t], i = n(r);
122
+ return typeof i == "function" && (i.prototype = i.prototype || {}, Object.defineProperties(i, { __rrweb_original__: {
123
+ enumerable: !1,
124
+ value: r
125
+ } })), e[t] = i, () => {
126
+ e[t] = r;
127
+ };
128
+ } catch {
129
+ return () => {};
130
+ }
131
+ }
132
+ var P = {
133
+ ownerDocument: S,
134
+ childNodes: C,
135
+ parentNode: w,
136
+ parentElement: ee,
137
+ textContent: T,
138
+ firstChild: E,
139
+ lastChild: D,
140
+ nextSibling: O,
141
+ previousSibling: k,
142
+ contains: A,
143
+ getRootNode: te,
144
+ host: ne,
145
+ styleSheets: re,
146
+ shadowRoot: j,
147
+ querySelector: ie,
148
+ querySelectorAll: ae,
149
+ nowTimestamp: M,
150
+ mutationObserverCtor: oe,
151
+ patch: N
152
+ };
153
+ function se(e) {
154
+ return e.nodeType === e.ELEMENT_NODE;
155
+ }
156
+ function F(e) {
157
+ let t = e && "host" in e && "mode" in e && P.host(e) || null;
158
+ return !!(t && "shadowRoot" in t && P.shadowRoot(t) === e);
159
+ }
160
+ function I(e) {
161
+ return Object.prototype.toString.call(e) === "[object ShadowRoot]";
162
+ }
163
+ function ce(e) {
164
+ 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;
165
+ }
166
+ function L(e) {
167
+ let { cssText: t } = e;
168
+ if (t.split("\"").length < 3) return t;
169
+ let n = ["@import", `url(${JSON.stringify(e.href)})`];
170
+ 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(" ") + ";";
171
+ }
172
+ function R(e) {
173
+ try {
174
+ let t = e.rules || e.cssRules;
175
+ if (!t) return null;
176
+ let n = e.href;
177
+ return !n && e.ownerNode && (n = e.ownerNode.baseURI), ce(Array.from(t, (e) => le(e, n)).join(""));
178
+ } catch {
179
+ return null;
180
+ }
181
+ }
182
+ function le(e, t) {
183
+ if (ue(e)) {
184
+ let t;
185
+ try {
186
+ t = R(e.styleSheet) || L(e);
187
+ } catch {
188
+ t = e.cssText;
189
+ }
190
+ return e.styleSheet.href ? we(t, e.styleSheet.href) : t;
191
+ }
192
+ {
193
+ let n = e.cssText;
194
+ return de(e) && e.selectorText.includes(":") && (n = z(n)), t ? we(n, t) : n;
195
+ }
196
+ }
197
+ function z(e) {
198
+ return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm, "$1\\$2");
199
+ }
200
+ function ue(e) {
201
+ return "styleSheet" in e;
202
+ }
203
+ function de(e) {
204
+ return "selectorText" in e;
205
+ }
206
+ var fe = class {
207
+ constructor() {
208
+ i(this, "idNodeMap", /* @__PURE__ */ new Map()), i(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
209
+ }
210
+ getId(e) {
211
+ return e ? this.getMeta(e)?.id ?? -1 : -1;
212
+ }
213
+ getNode(e) {
214
+ return this.idNodeMap.get(e) || null;
215
+ }
216
+ getIds() {
217
+ return Array.from(this.idNodeMap.keys());
218
+ }
219
+ getMeta(e) {
220
+ return this.nodeMetaMap.get(e) || null;
221
+ }
222
+ removeNodeFromMap(e) {
223
+ let t = this.getId(e);
224
+ this.idNodeMap.delete(t), e.childNodes && e.childNodes.forEach((e) => this.removeNodeFromMap(e));
225
+ }
226
+ has(e) {
227
+ return this.idNodeMap.has(e);
228
+ }
229
+ hasNode(e) {
230
+ return this.nodeMetaMap.has(e);
231
+ }
232
+ add(e, t) {
233
+ let n = t.id;
234
+ this.idNodeMap.set(n, e), this.nodeMetaMap.set(e, t);
235
+ }
236
+ replace(e, t) {
237
+ let n = this.getNode(e);
238
+ if (n) {
239
+ let e = this.nodeMetaMap.get(n);
240
+ e && this.nodeMetaMap.set(t, e);
241
+ }
242
+ this.idNodeMap.set(e, t);
243
+ }
244
+ reset() {
245
+ this.idNodeMap = /* @__PURE__ */ new Map(), this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
246
+ }
247
+ };
248
+ function pe() {
249
+ return new fe();
250
+ }
251
+ function me({ element: e, maskInputOptions: t, tagName: n, type: r, value: i, maskInputFn: a }) {
252
+ let o = i || "", s = r && B(r);
253
+ return (t[n.toLowerCase()] || s && t[s]) && (o = a ? a(o, e) : "*".repeat(o.length)), o;
254
+ }
255
+ function B(e) {
256
+ return e.toLowerCase();
257
+ }
258
+ var he = "__rrweb_original__";
259
+ function ge(e) {
260
+ let t = e.getContext("2d");
261
+ if (!t) return !0;
262
+ for (let n = 0; n < e.width; n += 50) for (let r = 0; r < e.height; r += 50) {
263
+ let i = t.getImageData, a = he in i ? i[he] : i;
264
+ 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;
265
+ }
266
+ return !0;
267
+ }
268
+ function _e(e) {
269
+ let t = e.type;
270
+ return e.hasAttribute("data-rr-is-password") ? "password" : t ? B(t) : null;
271
+ }
272
+ function ve(e, t) {
273
+ let n;
274
+ try {
275
+ n = new URL(e, t ?? window.location.href);
276
+ } catch {
277
+ return null;
278
+ }
279
+ return n.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1] ?? null;
280
+ }
281
+ function ye(e) {
282
+ let t = "";
283
+ return t = e.indexOf("//") > -1 ? e.split("/").slice(0, 3).join("/") : e.split("/")[0], t = t.split("?")[0], t;
284
+ }
285
+ var be = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm, xe = /^(?:[a-z+]+:)?\/\//i, Se = /^www\..*/i, Ce = /^(data:)([^,]*),(.*)/i;
286
+ function we(e, t) {
287
+ return (e || "").replace(be, (e, n, r, i, a, o) => {
288
+ let s = r || a || o, c = n || i || "";
289
+ if (!s) return e;
290
+ if (xe.test(s) || Se.test(s) || Ce.test(s)) return `url(${c}${s}${c})`;
291
+ if (s[0] === "/") return `url(${c}${ye(t) + s}${c})`;
292
+ let l = s.split("#")[0], u = s.substring(l.length), d = t.split("#")[0].split("/"), f = l.split("/");
293
+ d.pop();
294
+ for (let e of f) if (e === ".") continue;
295
+ else e === ".." ? d.pop() : d.push(e);
296
+ return `url(${c}${d.join("/")}${u}${c})`;
297
+ });
298
+ }
299
+ var Te = "(?:/\\*[^*]*\\*/)|[\\s;]", Ee = RegExp(`${Te}|\\b(0)px?`, "g"), De = new RegExp(Te, "g");
300
+ function Oe(e, t = !1) {
301
+ return t ? e.replace(De, "") : e.replace(Ee, "$1");
302
+ }
303
+ function ke(e, t, n = !1) {
304
+ let r = Array.from(t.childNodes), i = [], a = 0;
305
+ if (r.length > 1 && e && typeof e == "string") {
306
+ let t = Oe(e, n), o = t.length / e.length;
307
+ for (let s = 1; s < r.length; s++) if (r[s].textContent && typeof r[s].textContent == "string") {
308
+ let c = Oe(r[s].textContent, n), l = 3;
309
+ for (; l < c.length && (c[l].match(/[a-zA-Z0-9]/) || c.indexOf(c.substring(0, l), 1) !== -1); l++);
310
+ for (; l < c.length; l++) {
311
+ let u = c.substring(0, l), d = t.split(u), f = -1;
312
+ if (d.length === 2) f = d[0].length;
313
+ else if (d.length > 2 && d[0] === "" && r[s - 1].textContent !== "") f = t.indexOf(u, 1);
314
+ else if (d.length === 1) {
315
+ if (u = u.substring(0, u.length - 1), d = t.split(u), d.length <= 1) return i.push(e), i;
316
+ l = 101;
317
+ } else l === c.length - 1 && (f = t.indexOf(u));
318
+ if (d.length >= 2 && l > 100) {
319
+ let e = r[s - 1].textContent;
320
+ if (e && typeof e == "string") {
321
+ let n = Oe(e).length;
322
+ f = t.indexOf(u, n);
323
+ }
324
+ f === -1 && (f = d[0].length);
325
+ }
326
+ if (f !== -1) {
327
+ let s = Math.floor(f / o);
328
+ for (; s > 0 && s < e.length;) {
329
+ if (a += 1, a > 50 * r.length) return i.push(e), i;
330
+ let c = Oe(e.substring(0, s), n);
331
+ if (c.length === f) {
332
+ i.push(e.substring(0, s)), e = e.substring(s), t = t.substring(f);
333
+ break;
334
+ }
335
+ c.length < f ? s += Math.max(1, Math.floor((f - c.length) / o)) : s -= Math.max(1, Math.floor((c.length - f) * o));
336
+ }
337
+ break;
338
+ }
339
+ }
340
+ }
341
+ }
342
+ return i.push(e), i;
343
+ }
344
+ function Ae(e, t) {
345
+ return ke(e, t).join("/* rr_split */");
346
+ }
347
+ var je = 1, Me = /* @__PURE__ */ RegExp("[^a-z0-9-_:]"), Ne = -2;
348
+ function Pe() {
349
+ return je++;
350
+ }
351
+ function Fe(e) {
352
+ if (e instanceof HTMLFormElement) return "form";
353
+ let t = B(e.tagName);
354
+ return Me.test(t) ? "div" : t;
355
+ }
356
+ var V, Ie, Le = /^[^ \t\n\r\u000c]+/, Re = /^[, \t\n\r\u000c]+/;
357
+ function ze(e, t) {
358
+ if (t.trim() === "") return t;
359
+ let n = 0;
360
+ function r(e) {
361
+ let r, i = e.exec(t.substring(n));
362
+ return i ? (r = i[0], n += r.length, r) : "";
363
+ }
364
+ let i = [];
365
+ for (; r(Re), !(n >= t.length);) {
366
+ let a = r(Le);
367
+ if (a.slice(-1) === ",") a = Ve(e, a.substring(0, a.length - 1)), i.push(a);
368
+ else {
369
+ let r = "";
370
+ a = Ve(e, a);
371
+ let o = !1;
372
+ for (;;) {
373
+ let e = t.charAt(n);
374
+ if (e === "") {
375
+ i.push((a + r).trim());
376
+ break;
377
+ }
378
+ if (o) e === ")" && (o = !1);
379
+ else {
380
+ if (e === ",") {
381
+ n += 1, i.push((a + r).trim());
382
+ break;
383
+ }
384
+ e === "(" && (o = !0);
385
+ }
386
+ r += e, n += 1;
387
+ }
388
+ }
389
+ }
390
+ return i.join(", ");
391
+ }
392
+ var Be = /* @__PURE__ */ new WeakMap();
393
+ function Ve(e, t) {
394
+ return !t || t.trim() === "" ? t : Ue(e, t);
395
+ }
396
+ function He(e) {
397
+ return !!(e.tagName === "svg" || e.ownerSVGElement);
398
+ }
399
+ function Ue(e, t) {
400
+ let n = Be.get(e);
401
+ if (n || (n = e.createElement("a"), Be.set(e, n)), !t) t = "";
402
+ else if (t.startsWith("blob:") || t.startsWith("data:")) return t;
403
+ return n.setAttribute("href", t), n.href;
404
+ }
405
+ function We(e, t, n, r) {
406
+ return r && (n === "src" || n === "href" && (t !== "use" || r[0] !== "#") || n === "xlink:href" && r[0] !== "#" || n === "background" && [
407
+ "table",
408
+ "td",
409
+ "th"
410
+ ].includes(t) ? Ve(e, r) : n === "srcset" ? ze(e, r) : n === "style" ? we(r, Ue(e)) : t === "object" && n === "data" ? Ve(e, r) : r);
411
+ }
412
+ function Ge(e, t, n) {
413
+ return ["video", "audio"].includes(e) && B(t) === "autoplay";
414
+ }
415
+ function Ke(e, t, n) {
416
+ try {
417
+ if (typeof t == "string") {
418
+ if (e.classList.contains(t)) return !0;
419
+ } else for (let n = e.classList.length; n--;) {
420
+ let r = e.classList[n];
421
+ if (t.test(r)) return !0;
422
+ }
423
+ if (n) return e.matches(n);
424
+ } catch {}
425
+ return !1;
426
+ }
427
+ function qe(e, t, n) {
428
+ if (!e) return !1;
429
+ if (e.nodeType !== e.ELEMENT_NODE) return n ? qe(P.parentNode(e), t, n) : !1;
430
+ for (let n = e.classList.length; n--;) {
431
+ let r = e.classList[n];
432
+ if (t.test(r)) return !0;
433
+ }
434
+ return n ? qe(P.parentNode(e), t, n) : !1;
435
+ }
436
+ function Je(e, t, n, r) {
437
+ let i;
438
+ if (se(e)) {
439
+ if (i = e, !P.childNodes(i).length) return !1;
440
+ } else if (P.parentElement(e) === null) return !1;
441
+ else i = P.parentElement(e);
442
+ try {
443
+ if (typeof t == "string") {
444
+ if (r) {
445
+ if (i.closest(`.${t}`)) return !0;
446
+ } else if (i.classList.contains(t)) return !0;
447
+ } else if (qe(i, t, r)) return !0;
448
+ if (n) {
449
+ if (r) {
450
+ if (i.closest(n)) return !0;
451
+ } else if (i.matches(n)) return !0;
452
+ }
453
+ } catch {}
454
+ return !1;
455
+ }
456
+ function Ye(e, t, n) {
457
+ let r = e.contentWindow;
458
+ if (!r) return;
459
+ let i = !1, a;
460
+ try {
461
+ a = r.document.readyState;
462
+ } catch {
463
+ return;
464
+ }
465
+ if (a !== "complete") {
466
+ let r = setTimeout(() => {
467
+ i || (t(), i = !0);
468
+ }, n);
469
+ e.addEventListener("load", () => {
470
+ clearTimeout(r), i = !0, t();
471
+ });
472
+ return;
473
+ }
474
+ let o = "about:blank";
475
+ if (r.location.href !== o || e.src === o || e.src === "") return setTimeout(t, 0), e.addEventListener("load", t);
476
+ e.addEventListener("load", t);
477
+ }
478
+ function Xe(e, t, n) {
479
+ let r = !1, i;
480
+ try {
481
+ i = e.sheet;
482
+ } catch {
483
+ return;
484
+ }
485
+ if (i) return;
486
+ let a = setTimeout(() => {
487
+ r || (t(), r = !0);
488
+ }, n);
489
+ e.addEventListener("load", () => {
490
+ clearTimeout(a), r = !0, t();
491
+ });
492
+ }
493
+ function Ze(e, t) {
494
+ let { doc: n, mirror: r, blockClass: i, blockSelector: a, needsMask: o, inlineStylesheet: s, maskInputOptions: c = {}, maskTextFn: l, maskInputFn: u, dataURLOptions: f = {}, inlineImages: p, recordCanvas: m, keepIframeSrcFn: h, newlyAddedElement: g = !1, cssCaptured: _ = !1 } = t, v = Qe(n, r);
495
+ switch (e.nodeType) {
496
+ case e.DOCUMENT_NODE: return e.compatMode === "CSS1Compat" ? {
497
+ type: d.Document,
498
+ childNodes: []
499
+ } : {
500
+ type: d.Document,
501
+ childNodes: [],
502
+ compatMode: e.compatMode
503
+ };
504
+ case e.DOCUMENT_TYPE_NODE: return {
505
+ type: d.DocumentType,
506
+ name: e.name,
507
+ publicId: e.publicId,
508
+ systemId: e.systemId,
509
+ rootId: v
510
+ };
511
+ case e.ELEMENT_NODE: return et(e, {
512
+ doc: n,
513
+ blockClass: i,
514
+ blockSelector: a,
515
+ inlineStylesheet: s,
516
+ maskInputOptions: c,
517
+ maskInputFn: u,
518
+ dataURLOptions: f,
519
+ inlineImages: p,
520
+ recordCanvas: m,
521
+ keepIframeSrcFn: h,
522
+ newlyAddedElement: g,
523
+ rootId: v
524
+ });
525
+ case e.TEXT_NODE: return $e(e, {
526
+ doc: n,
527
+ needsMask: o,
528
+ maskTextFn: l,
529
+ rootId: v,
530
+ cssCaptured: _
531
+ });
532
+ case e.CDATA_SECTION_NODE: return {
533
+ type: d.CDATA,
534
+ textContent: "",
535
+ rootId: v
536
+ };
537
+ case e.COMMENT_NODE: return {
538
+ type: d.Comment,
539
+ textContent: P.textContent(e) || "",
540
+ rootId: v
541
+ };
542
+ default: return !1;
543
+ }
544
+ }
545
+ function Qe(e, t) {
546
+ if (!t.hasNode(e)) return;
547
+ let n = t.getId(e);
548
+ return n === 1 ? void 0 : n;
549
+ }
550
+ function $e(e, t) {
551
+ let { needsMask: n, maskTextFn: r, rootId: i, cssCaptured: a } = t, o = P.parentNode(e), s = o && o.tagName, c = "", l = s === "STYLE" || void 0, u = s === "SCRIPT" || void 0;
552
+ return u ? c = "SCRIPT_PLACEHOLDER" : a || (c = P.textContent(e), l && c && (c = we(c, Ue(t.doc)))), !l && !u && c && n && (c = r ? r(c, P.parentElement(e)) : c.replace(/[\S]/g, "*")), {
553
+ type: d.Text,
554
+ textContent: c || "",
555
+ rootId: i
556
+ };
557
+ }
558
+ function et(e, t) {
559
+ let { doc: n, blockClass: r, blockSelector: i, inlineStylesheet: a, maskInputOptions: o = {}, maskInputFn: s, dataURLOptions: c = {}, inlineImages: l, recordCanvas: u, keepIframeSrcFn: f, newlyAddedElement: p = !1, rootId: m } = t, h = Ke(e, r, i), g = Fe(e), _ = {}, v = e.attributes.length;
560
+ for (let t = 0; t < v; t++) {
561
+ let r = e.attributes[t];
562
+ Ge(g, r.name, r.value) || (_[r.name] = We(n, g, B(r.name), r.value));
563
+ }
564
+ if (g === "link" && a) {
565
+ let t = Array.from(n.styleSheets).find((t) => t.href === e.href), r = null;
566
+ t && (r = R(t)), r && (delete _.rel, delete _.href, _._cssText = r);
567
+ }
568
+ if (g === "style" && e.sheet) {
569
+ let t = R(e.sheet);
570
+ t && (e.childNodes.length > 1 && (t = Ae(t, e)), _._cssText = t);
571
+ }
572
+ if ([
573
+ "input",
574
+ "textarea",
575
+ "select"
576
+ ].includes(g)) {
577
+ let t = e.value, n = e.checked;
578
+ _.type !== "radio" && _.type !== "checkbox" && _.type !== "submit" && _.type !== "button" && t ? _.value = me({
579
+ element: e,
580
+ type: _e(e),
581
+ tagName: g,
582
+ value: t,
583
+ maskInputOptions: o,
584
+ maskInputFn: s
585
+ }) : n && (_.checked = n);
586
+ }
587
+ 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" && u) {
588
+ if (e.__context === "2d") ge(e) || (_.rr_dataURL = e.toDataURL(c.type, c.quality));
589
+ else if (!("__context" in e)) {
590
+ let t = e.toDataURL(c.type, c.quality), r = n.createElement("canvas");
591
+ r.width = e.width, r.height = e.height, t !== r.toDataURL(c.type, c.quality) && (_.rr_dataURL = t);
592
+ }
593
+ }
594
+ if (g === "img" && l) {
595
+ V || (V = n.createElement("canvas"), Ie = V.getContext("2d"));
596
+ let t = e, r = t.currentSrc || t.getAttribute("src") || "<unknown-src>", i = t.crossOrigin, a = () => {
597
+ t.removeEventListener("load", a);
598
+ try {
599
+ V.width = t.naturalWidth, V.height = t.naturalHeight, Ie.drawImage(t, 0, 0), _.rr_dataURL = V.toDataURL(c.type, c.quality);
600
+ } catch (e) {
601
+ if (t.crossOrigin !== "anonymous") {
602
+ t.crossOrigin = "anonymous", t.complete && t.naturalWidth !== 0 ? a() : t.addEventListener("load", a);
603
+ return;
604
+ }
605
+ console.warn(`Cannot inline img src=${r}! Error: ${e}`);
606
+ }
607
+ t.crossOrigin === "anonymous" && (i ? _.crossOrigin = i : t.removeAttribute("crossorigin"));
608
+ };
609
+ t.complete && t.naturalWidth !== 0 ? a() : t.addEventListener("load", a);
610
+ }
611
+ if (["audio", "video"].includes(g)) {
612
+ let t = _;
613
+ t.rr_mediaState = e.paused ? "paused" : "played", t.rr_mediaCurrentTime = e.currentTime, t.rr_mediaPlaybackRate = e.playbackRate, t.rr_mediaMuted = e.muted, t.rr_mediaLoop = e.loop, t.rr_mediaVolume = e.volume;
614
+ }
615
+ if (p || (e.scrollLeft && (_.rr_scrollLeft = e.scrollLeft), e.scrollTop && (_.rr_scrollTop = e.scrollTop)), h) {
616
+ let { width: t, height: n } = e.getBoundingClientRect();
617
+ _ = {
618
+ class: _.class,
619
+ rr_width: `${t}px`,
620
+ rr_height: `${n}px`
621
+ };
622
+ }
623
+ g === "iframe" && !f(_.src) && (e.contentDocument || (_.rr_src = _.src), delete _.src);
624
+ let y;
625
+ try {
626
+ customElements.get(g) && (y = !0);
627
+ } catch {}
628
+ return {
629
+ type: d.Element,
630
+ tagName: g,
631
+ attributes: _,
632
+ childNodes: [],
633
+ isSVG: He(e) || void 0,
634
+ needBlock: h,
635
+ rootId: m,
636
+ isCustom: y
637
+ };
638
+ }
639
+ function H(e) {
640
+ return e == null ? "" : e.toLowerCase();
641
+ }
642
+ function tt(e) {
643
+ return e === !0 || e === "all" ? {
644
+ script: !0,
645
+ comment: !0,
646
+ headFavicon: !0,
647
+ headWhitespace: !0,
648
+ headMetaSocial: !0,
649
+ headMetaRobots: !0,
650
+ headMetaHttpEquiv: !0,
651
+ headMetaVerification: !0,
652
+ headMetaAuthorship: e === "all",
653
+ headMetaDescKeywords: e === "all",
654
+ headTitleMutations: e === "all"
655
+ } : e || {};
656
+ }
657
+ function nt(e, t) {
658
+ return !!(t.comment && e.type === d.Comment || e.type === d.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" && ve(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"))));
659
+ }
660
+ function U(e, t) {
661
+ let { doc: n, mirror: r, blockClass: i, blockSelector: a, maskTextClass: o, maskTextSelector: s, skipChild: c = !1, inlineStylesheet: l = !0, maskInputOptions: u = {}, 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;
662
+ T || (T = Je(e, o, s, T === void 0));
663
+ let D = Ze(e, {
664
+ doc: n,
665
+ mirror: r,
666
+ blockClass: i,
667
+ blockSelector: a,
668
+ needsMask: T,
669
+ inlineStylesheet: l,
670
+ maskInputOptions: u,
671
+ maskTextFn: f,
672
+ maskInputFn: p,
673
+ dataURLOptions: h,
674
+ inlineImages: g,
675
+ recordCanvas: _,
676
+ keepIframeSrcFn: C,
677
+ newlyAddedElement: w,
678
+ cssCaptured: ee
679
+ });
680
+ if (!D) return console.warn(e, "not serialized"), null;
681
+ let O;
682
+ O = r.hasNode(e) ? r.getId(e) : nt(D, m) || !E && D.type === d.Text && !D.textContent.replace(/^\s+|\s+$/gm, "").length ? Ne : Pe();
683
+ let k = Object.assign(D, { id: O });
684
+ if (r.add(e, k), O === Ne) return null;
685
+ v && v(e);
686
+ let A = !c;
687
+ if (k.type === d.Element) {
688
+ A = A && !k.needBlock, delete k.needBlock;
689
+ let t = P.shadowRoot(e);
690
+ t && I(t) && (k.isShadowHost = !0);
691
+ }
692
+ if ((k.type === d.Document || k.type === d.Element) && A) {
693
+ m.headWhitespace && k.type === d.Element && k.tagName === "head" && (E = !1);
694
+ let t = {
695
+ doc: n,
696
+ mirror: r,
697
+ blockClass: i,
698
+ blockSelector: a,
699
+ needsMask: T,
700
+ maskTextClass: o,
701
+ maskTextSelector: s,
702
+ skipChild: c,
703
+ inlineStylesheet: l,
704
+ maskInputOptions: u,
705
+ maskTextFn: f,
706
+ maskInputFn: p,
707
+ slimDOMOptions: m,
708
+ dataURLOptions: h,
709
+ inlineImages: g,
710
+ recordCanvas: _,
711
+ preserveWhiteSpace: E,
712
+ onSerialize: v,
713
+ onIframeLoad: y,
714
+ iframeLoadTimeout: b,
715
+ onStylesheetLoad: x,
716
+ stylesheetLoadTimeout: S,
717
+ keepIframeSrcFn: C,
718
+ cssCaptured: !1
719
+ };
720
+ if (k.type !== d.Element || k.tagName !== "textarea" || k.attributes.value === void 0) {
721
+ k.type === d.Element && k.attributes._cssText !== void 0 && typeof k.attributes._cssText == "string" && (t.cssCaptured = !0);
722
+ for (let n of Array.from(P.childNodes(e))) {
723
+ let e = U(n, t);
724
+ e && k.childNodes.push(e);
725
+ }
726
+ }
727
+ let w = null;
728
+ if (se(e) && (w = P.shadowRoot(e))) for (let e of Array.from(P.childNodes(w))) {
729
+ let n = U(e, t);
730
+ n && (I(w) && (n.isShadow = !0), k.childNodes.push(n));
731
+ }
732
+ }
733
+ let te = P.parentNode(e);
734
+ return te && F(te) && I(te) && (k.isShadow = !0), k.type === d.Element && k.tagName === "iframe" && Ye(e, () => {
735
+ let t = e.contentDocument;
736
+ if (t && y) {
737
+ let n = U(t, {
738
+ doc: t,
739
+ mirror: r,
740
+ blockClass: i,
741
+ blockSelector: a,
742
+ needsMask: T,
743
+ maskTextClass: o,
744
+ maskTextSelector: s,
745
+ skipChild: !1,
746
+ inlineStylesheet: l,
747
+ maskInputOptions: u,
748
+ maskTextFn: f,
749
+ maskInputFn: p,
750
+ slimDOMOptions: m,
751
+ dataURLOptions: h,
752
+ inlineImages: g,
753
+ recordCanvas: _,
754
+ preserveWhiteSpace: E,
755
+ onSerialize: v,
756
+ onIframeLoad: y,
757
+ iframeLoadTimeout: b,
758
+ onStylesheetLoad: x,
759
+ stylesheetLoadTimeout: S,
760
+ keepIframeSrcFn: C
761
+ });
762
+ n && y(e, n);
763
+ }
764
+ }, b), k.type === d.Element && k.tagName === "link" && typeof k.attributes.rel == "string" && (k.attributes.rel === "stylesheet" || k.attributes.rel === "preload" && typeof k.attributes.href == "string" && ve(k.attributes.href) === "css") && Xe(e, () => {
765
+ if (x) {
766
+ let t = U(e, {
767
+ doc: n,
768
+ mirror: r,
769
+ blockClass: i,
770
+ blockSelector: a,
771
+ needsMask: T,
772
+ maskTextClass: o,
773
+ maskTextSelector: s,
774
+ skipChild: !1,
775
+ inlineStylesheet: l,
776
+ maskInputOptions: u,
777
+ maskTextFn: f,
778
+ maskInputFn: p,
779
+ slimDOMOptions: m,
780
+ dataURLOptions: h,
781
+ inlineImages: g,
782
+ recordCanvas: _,
783
+ preserveWhiteSpace: E,
784
+ onSerialize: v,
785
+ onIframeLoad: y,
786
+ iframeLoadTimeout: b,
787
+ onStylesheetLoad: x,
788
+ stylesheetLoadTimeout: S,
789
+ keepIframeSrcFn: C
790
+ });
791
+ t && x(e, t);
792
+ }
793
+ }, S), k;
794
+ }
795
+ function rt(e, t) {
796
+ let { mirror: n = new fe(), 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;
797
+ return U(e, {
798
+ doc: e,
799
+ mirror: n,
800
+ blockClass: r,
801
+ blockSelector: i,
802
+ maskTextClass: a,
803
+ maskTextSelector: o,
804
+ skipChild: !1,
805
+ inlineStylesheet: s,
806
+ maskInputOptions: u === !0 ? {
807
+ color: !0,
808
+ date: !0,
809
+ "datetime-local": !0,
810
+ email: !0,
811
+ month: !0,
812
+ number: !0,
813
+ range: !0,
814
+ search: !0,
815
+ tel: !0,
816
+ text: !0,
817
+ time: !0,
818
+ url: !0,
819
+ week: !0,
820
+ textarea: !0,
821
+ select: !0,
822
+ password: !0
823
+ } : u === !1 ? { password: !0 } : u,
824
+ maskTextFn: d,
825
+ maskInputFn: f,
826
+ slimDOMOptions: tt(p),
827
+ dataURLOptions: m,
828
+ inlineImages: c,
829
+ recordCanvas: l,
830
+ preserveWhiteSpace: h,
831
+ onSerialize: g,
832
+ onIframeLoad: _,
833
+ iframeLoadTimeout: v,
834
+ onStylesheetLoad: y,
835
+ stylesheetLoadTimeout: b,
836
+ keepIframeSrcFn: x,
837
+ newlyAddedElement: !1
838
+ });
839
+ }
840
+ var it = class e {
841
+ constructor(...e) {
842
+ i(this, "parentElement", null), i(this, "parentNode", null), i(this, "ownerDocument"), i(this, "firstChild", null), i(this, "lastChild", null), i(this, "previousSibling", null), i(this, "nextSibling", null), i(this, "ELEMENT_NODE", 1), i(this, "TEXT_NODE", 3), i(this, "nodeType"), i(this, "nodeName"), i(this, "RRNodeType");
843
+ }
844
+ get childNodes() {
845
+ let e = [], t = this.firstChild;
846
+ for (; t;) e.push(t), t = t.nextSibling;
847
+ return e;
848
+ }
849
+ contains(t) {
850
+ if (!(t instanceof e) || t.ownerDocument !== this.ownerDocument) return !1;
851
+ if (t === this) return !0;
852
+ for (; t.parentNode;) {
853
+ if (t.parentNode === this) return !0;
854
+ t = t.parentNode;
855
+ }
856
+ return !1;
857
+ }
858
+ appendChild(e) {
859
+ throw Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.");
860
+ }
861
+ insertBefore(e, t) {
862
+ throw Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.");
863
+ }
864
+ removeChild(e) {
865
+ throw Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.");
866
+ }
867
+ toString() {
868
+ return "RRNode";
869
+ }
870
+ };
871
+ function W(e, t, n = document) {
872
+ let r = {
873
+ capture: !0,
874
+ passive: !0
875
+ };
876
+ return n.addEventListener(e, t, r), () => n.removeEventListener(e, t, r);
877
+ }
878
+ 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.", at = {
879
+ map: {},
880
+ getId() {
881
+ return console.error(G), -1;
882
+ },
883
+ getNode() {
884
+ return console.error(G), null;
885
+ },
886
+ removeNodeFromMap() {
887
+ console.error(G);
888
+ },
889
+ has() {
890
+ return console.error(G), !1;
891
+ },
892
+ reset() {
893
+ console.error(G);
894
+ }
895
+ };
896
+ typeof window < "u" && window.Proxy && window.Reflect && (at = new Proxy(at, { get(e, t, n) {
897
+ return t === "map" && console.error(G), Reflect.get(e, t, n);
898
+ } }));
899
+ function K(e, t, n = {}) {
900
+ let r = null, i = 0;
901
+ return function(...a) {
902
+ let o = Date.now();
903
+ !i && n.leading === !1 && (i = o);
904
+ let s = t - (o - i), c = this;
905
+ s <= 0 || s > t ? (r && (clearTimeout(r), r = null), i = o, e.apply(c, a)) : !r && n.trailing !== !1 && (r = setTimeout(() => {
906
+ i = n.leading === !1 ? 0 : Date.now(), r = null, e.apply(c, a);
907
+ }, s));
908
+ };
909
+ }
910
+ function ot(e, t, n, r, i = window) {
911
+ let a = i.Object.getOwnPropertyDescriptor(e, t);
912
+ return i.Object.defineProperty(e, t, r ? n : { set(e) {
913
+ setTimeout(() => {
914
+ n.set.call(this, e);
915
+ }, 0), a && a.set && a.set.call(this, e);
916
+ } }), () => ot(e, t, a || {}, !0);
917
+ }
918
+ function st(e) {
919
+ let t = e.document;
920
+ return {
921
+ left: t.scrollingElement ? t.scrollingElement.scrollLeft : e.pageXOffset === void 0 ? t.documentElement.scrollLeft || t?.body && P.parentElement(t.body)?.scrollLeft || t?.body?.scrollLeft || 0 : e.pageXOffset,
922
+ top: t.scrollingElement ? t.scrollingElement.scrollTop : e.pageYOffset === void 0 ? t?.documentElement.scrollTop || t?.body && P.parentElement(t.body)?.scrollTop || t?.body?.scrollTop || 0 : e.pageYOffset
923
+ };
924
+ }
925
+ function ct() {
926
+ return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;
927
+ }
928
+ function lt() {
929
+ return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;
930
+ }
931
+ function ut(e) {
932
+ return e ? e.nodeType === e.ELEMENT_NODE ? e : P.parentElement(e) : null;
933
+ }
934
+ function q(e, t, n, r) {
935
+ if (!e) return !1;
936
+ let i = ut(e);
937
+ if (!i) return !1;
938
+ try {
939
+ if (typeof t == "string") {
940
+ if (i.classList.contains(t) || r && i.closest("." + t) !== null) return !0;
941
+ } else if (qe(i, t, r)) return !0;
942
+ } catch {}
943
+ return !!(n && (i.matches(n) || r && i.closest(n) !== null));
944
+ }
945
+ function dt(e, t) {
946
+ return t.getId(e) !== -1;
947
+ }
948
+ function ft(e, t, n) {
949
+ return e.tagName === "TITLE" && n.headTitleMutations ? !0 : t.getId(e) === Ne;
950
+ }
951
+ function pt(e, t) {
952
+ if (F(e)) return !1;
953
+ let n = t.getId(e);
954
+ if (!t.has(n)) return !0;
955
+ let r = P.parentNode(e);
956
+ return r && r.nodeType === e.DOCUMENT_NODE ? !1 : !r || pt(r, t);
957
+ }
958
+ function mt(e) {
959
+ return !!e.changedTouches;
960
+ }
961
+ function ht(e = window) {
962
+ "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);
963
+ }
964
+ function gt(e, t) {
965
+ return !!(e.nodeName === "IFRAME" && t.getMeta(e));
966
+ }
967
+ function _t(e, t) {
968
+ return !!(e.nodeName === "LINK" && e.nodeType === e.ELEMENT_NODE && e.getAttribute && e.getAttribute("rel") === "stylesheet" && t.getMeta(e));
969
+ }
970
+ function vt(e) {
971
+ return e ? e instanceof it && "shadowRoot" in e ? !!e.shadowRoot : !!P.shadowRoot(e) : !1;
972
+ }
973
+ var yt = class {
974
+ constructor() {
975
+ i(this, "id", 1), i(this, "styleIDMap", /* @__PURE__ */ new WeakMap()), i(this, "idStyleMap", /* @__PURE__ */ new Map());
976
+ }
977
+ getId(e) {
978
+ return this.styleIDMap.get(e) ?? -1;
979
+ }
980
+ has(e) {
981
+ return this.styleIDMap.has(e);
982
+ }
983
+ add(e, t) {
984
+ if (this.has(e)) return this.getId(e);
985
+ let n;
986
+ return n = t === void 0 ? this.id++ : t, this.styleIDMap.set(e, n), this.idStyleMap.set(n, e), n;
987
+ }
988
+ getStyle(e) {
989
+ return this.idStyleMap.get(e) || null;
990
+ }
991
+ reset() {
992
+ this.styleIDMap = /* @__PURE__ */ new WeakMap(), this.idStyleMap = /* @__PURE__ */ new Map(), this.id = 1;
993
+ }
994
+ generateId() {
995
+ return this.id++;
996
+ }
997
+ };
998
+ function bt(e) {
999
+ let t = null;
1000
+ return "getRootNode" in e && P.getRootNode(e)?.nodeType === Node.DOCUMENT_FRAGMENT_NODE && P.host(P.getRootNode(e)) && (t = P.host(P.getRootNode(e))), t;
1001
+ }
1002
+ function xt(e) {
1003
+ let t = e, n;
1004
+ for (; n = bt(t);) t = n;
1005
+ return t;
1006
+ }
1007
+ function St(e) {
1008
+ let t = P.ownerDocument(e);
1009
+ if (!t) return !1;
1010
+ let n = xt(e);
1011
+ return P.contains(t, n);
1012
+ }
1013
+ function Ct(e) {
1014
+ let t = P.ownerDocument(e);
1015
+ return t ? P.contains(t, e) || St(e) : !1;
1016
+ }
1017
+ var wt = (e, t) => `${e}@${t}`, Tt = class {
1018
+ constructor() {
1019
+ i(this, "frozen", !1), i(this, "locked", !1), i(this, "texts", []), i(this, "attributes", []), i(this, "attributeMap", /* @__PURE__ */ new WeakMap()), i(this, "removes", []), i(this, "mapRemoves", []), i(this, "movedMap", {}), i(this, "addedSet", /* @__PURE__ */ new Set()), i(this, "movedSet", /* @__PURE__ */ new Set()), i(this, "droppedSet", /* @__PURE__ */ new Set()), i(this, "removesSubTreeCache", /* @__PURE__ */ new Set()), i(this, "mutationCb"), i(this, "blockClass"), i(this, "blockSelector"), i(this, "maskTextClass"), i(this, "maskTextSelector"), i(this, "inlineStylesheet"), i(this, "maskInputOptions"), i(this, "maskTextFn"), i(this, "maskInputFn"), i(this, "keepIframeSrcFn"), i(this, "recordCanvas"), i(this, "inlineImages"), i(this, "slimDOMOptions"), i(this, "dataURLOptions"), i(this, "doc"), i(this, "mirror"), i(this, "iframeManager"), i(this, "stylesheetManager"), i(this, "shadowDomManager"), i(this, "canvasManager"), i(this, "processedNodeManager"), i(this, "unattachedDoc"), i(this, "processMutations", (e) => {
1020
+ e.forEach(this.processMutation), this.emit();
1021
+ }), i(this, "emit", () => {
1022
+ if (this.frozen || this.locked) return;
1023
+ let e = [], t = /* @__PURE__ */ new Set();
1024
+ for (; this.mapRemoves.length;) this.mirror.removeNodeFromMap(this.mapRemoves.shift());
1025
+ for (let e of this.movedSet) {
1026
+ let t = P.parentNode(e);
1027
+ (!this.removesSubTreeCache.has(t) || this.movedSet.has(t)) && this.addedSet.add(e);
1028
+ }
1029
+ let n = null, r = null, i = -1, a = null, o = !1, s = /* @__PURE__ */ new Set(), c = this.addedSet.values(), l = c.next();
1030
+ for (; this.addedSet.size;) {
1031
+ if (n !== null && this.addedSet.has(P.previousSibling(n))) a = n, n = P.previousSibling(n);
1032
+ else {
1033
+ for (this.addedSet.has(l.value) || (l = c.next()), n = l.value; r = P.parentNode(n), this.addedSet.has(r);) n = r;
1034
+ if (s.has(r)) r = null;
1035
+ else if (r) {
1036
+ if (Ct(r) ? (o = Ot(this.droppedSet, r) || this.removesSubTreeCache.has(r), o && Ot(this.movedSet, n) && (o = !1)) : o = !0, this.addedSet.has(P.lastChild(r))) n = P.lastChild(r), a = null;
1037
+ else for (; a = P.nextSibling(n), this.addedSet.has(a);) n = a;
1038
+ if (i = F(r) ? this.mirror.getId(bt(n)) : this.mirror.getId(r), i === -1 && r.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1039
+ let e = P.host(r);
1040
+ i = this.mirror.getId(e);
1041
+ }
1042
+ }
1043
+ }
1044
+ if (this.addedSet.delete(n), !r || i === -1) {
1045
+ s.add(n);
1046
+ continue;
1047
+ }
1048
+ if (o) {
1049
+ this.droppedSet.add(n);
1050
+ continue;
1051
+ }
1052
+ let u = !1;
1053
+ if (n.nodeType === Node.TEXT_NODE) {
1054
+ let e = r.tagName;
1055
+ if (e === "TEXTAREA") continue;
1056
+ e === "STYLE" && t.has(i) && (u = !0);
1057
+ }
1058
+ let d = a ? this.mirror.getId(a) : null;
1059
+ for (; d === Ne;) a = a && P.nextSibling(a), d = a && this.mirror.getId(a);
1060
+ if (d === -1) {
1061
+ console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:", a), n = null;
1062
+ continue;
1063
+ }
1064
+ let f = U(n, {
1065
+ doc: this.doc,
1066
+ mirror: this.mirror,
1067
+ blockClass: this.blockClass,
1068
+ blockSelector: this.blockSelector,
1069
+ maskTextClass: this.maskTextClass,
1070
+ maskTextSelector: this.maskTextSelector,
1071
+ skipChild: !0,
1072
+ newlyAddedElement: !0,
1073
+ inlineStylesheet: this.inlineStylesheet,
1074
+ maskInputOptions: this.maskInputOptions,
1075
+ maskTextFn: this.maskTextFn,
1076
+ maskInputFn: this.maskInputFn,
1077
+ slimDOMOptions: this.slimDOMOptions,
1078
+ dataURLOptions: this.dataURLOptions,
1079
+ recordCanvas: this.recordCanvas,
1080
+ inlineImages: this.inlineImages,
1081
+ onSerialize: (e) => {
1082
+ gt(e, this.mirror) && this.iframeManager.addIframe(e), _t(e, this.mirror) && this.stylesheetManager.trackLinkElement(e), vt(n) && this.shadowDomManager.addShadowRoot(P.shadowRoot(n), this.doc);
1083
+ },
1084
+ onIframeLoad: (e, t) => {
1085
+ this.iframeManager.attachIframe(e, t), this.shadowDomManager.observeAttachShadow(e);
1086
+ },
1087
+ onStylesheetLoad: (e, t) => {
1088
+ this.stylesheetManager.attachLinkElement(e, t);
1089
+ },
1090
+ cssCaptured: u
1091
+ });
1092
+ f && (e.push({
1093
+ parentId: i,
1094
+ nextId: d,
1095
+ node: f
1096
+ }), t.add(f.id));
1097
+ }
1098
+ let u = {
1099
+ texts: this.texts.map((e) => {
1100
+ let t = e.node, n = P.parentNode(t);
1101
+ return n && n.tagName === "TEXTAREA" && this.genTextAreaValueMutation(n), {
1102
+ id: this.mirror.getId(t),
1103
+ value: e.value
1104
+ };
1105
+ }).filter((e) => !t.has(e.id)).filter((e) => this.mirror.has(e.id)),
1106
+ attributes: this.attributes.map((e) => {
1107
+ let { attributes: t } = e;
1108
+ if (typeof t.style == "string") {
1109
+ let n = JSON.stringify(e.styleDiff), r = JSON.stringify(e._unchangedStyles);
1110
+ n.length < t.style.length && (n + r).split("var(").length === t.style.split("var(").length && (t.style = e.styleDiff);
1111
+ }
1112
+ return {
1113
+ id: this.mirror.getId(e.node),
1114
+ attributes: t
1115
+ };
1116
+ }).filter((e) => !t.has(e.id)).filter((e) => this.mirror.has(e.id)),
1117
+ removes: this.removes,
1118
+ adds: e
1119
+ };
1120
+ (u.texts.length || u.attributes.length || u.removes.length || u.adds.length) && (this.texts = [], this.attributes = [], this.attributeMap = /* @__PURE__ */ new WeakMap(), this.removes = [], this.addedSet = /* @__PURE__ */ new Set(), this.movedSet = /* @__PURE__ */ new Set(), this.droppedSet = /* @__PURE__ */ new Set(), this.removesSubTreeCache = /* @__PURE__ */ new Set(), this.movedMap = {}, this.mutationCb(u));
1121
+ }), i(this, "genTextAreaValueMutation", (e) => {
1122
+ let t = this.attributeMap.get(e);
1123
+ t || (t = {
1124
+ node: e,
1125
+ attributes: {},
1126
+ styleDiff: {},
1127
+ _unchangedStyles: {}
1128
+ }, this.attributes.push(t), this.attributeMap.set(e, t));
1129
+ let n = Array.from(P.childNodes(e), (e) => P.textContent(e) || "").join("");
1130
+ t.attributes.value = me({
1131
+ element: e,
1132
+ maskInputOptions: this.maskInputOptions,
1133
+ tagName: e.tagName,
1134
+ type: _e(e),
1135
+ value: n,
1136
+ maskInputFn: this.maskInputFn
1137
+ });
1138
+ }), i(this, "processMutation", (e) => {
1139
+ if (!ft(e.target, this.mirror, this.slimDOMOptions)) switch (e.type) {
1140
+ case "characterData": {
1141
+ let t = P.textContent(e.target);
1142
+ !q(e.target, this.blockClass, this.blockSelector, !1) && t !== e.oldValue && this.texts.push({
1143
+ value: Je(e.target, this.maskTextClass, this.maskTextSelector, !0) && t ? this.maskTextFn ? this.maskTextFn(t, ut(e.target)) : t.replace(/[\S]/g, "*") : t,
1144
+ node: e.target
1145
+ });
1146
+ break;
1147
+ }
1148
+ case "attributes": {
1149
+ let t = e.target, n = B(t.tagName), r = e.attributeName, i = e.target.getAttribute(r);
1150
+ if (r === "value") {
1151
+ let e = _e(t);
1152
+ i = me({
1153
+ element: t,
1154
+ maskInputOptions: this.maskInputOptions,
1155
+ tagName: t.tagName,
1156
+ type: e,
1157
+ value: i,
1158
+ maskInputFn: this.maskInputFn
1159
+ });
1160
+ }
1161
+ if (q(e.target, this.blockClass, this.blockSelector, !1) || i === e.oldValue) return;
1162
+ let a = this.attributeMap.get(e.target);
1163
+ if (n === "iframe" && r === "src" && !this.keepIframeSrcFn(i)) {
1164
+ if (!t.contentDocument) r = "rr_src";
1165
+ else return;
1166
+ }
1167
+ if (a || (a = {
1168
+ node: e.target,
1169
+ attributes: {},
1170
+ styleDiff: {},
1171
+ _unchangedStyles: {}
1172
+ }, this.attributes.push(a), this.attributeMap.set(e.target, a)), r === "type" && n === "input" && (e.oldValue || "").toLowerCase() === "password" && t.setAttribute("data-rr-is-password", "true"), !Ge(n, r)) {
1173
+ if (a.attributes[r] = We(this.doc, n, B(r), i), r === "style") {
1174
+ if (!this.unattachedDoc) try {
1175
+ this.unattachedDoc = document.implementation.createHTMLDocument();
1176
+ } catch {
1177
+ this.unattachedDoc = this.doc;
1178
+ }
1179
+ let n = this.unattachedDoc.createElement("span");
1180
+ e.oldValue && n.setAttribute("style", e.oldValue);
1181
+ for (let e of Array.from(t.style)) {
1182
+ let r = t.style.getPropertyValue(e), i = t.style.getPropertyPriority(e);
1183
+ r !== n.style.getPropertyValue(e) || i !== n.style.getPropertyPriority(e) ? i === "" ? a.styleDiff[e] = r : a.styleDiff[e] = [r, i] : a._unchangedStyles[e] = [r, i];
1184
+ }
1185
+ for (let e of Array.from(n.style)) t.style.getPropertyValue(e) === "" && (a.styleDiff[e] = !1);
1186
+ } else r === "open" && t.tagName === "DIALOG" && (t.matches("dialog:modal") ? a.attributes.rr_open_mode = "modal" : a.attributes.rr_open_mode = "non-modal");
1187
+ }
1188
+ break;
1189
+ }
1190
+ case "childList":
1191
+ if (q(e.target, this.blockClass, this.blockSelector, !0)) return;
1192
+ if (e.target.tagName === "TEXTAREA") {
1193
+ this.genTextAreaValueMutation(e.target);
1194
+ return;
1195
+ }
1196
+ e.addedNodes.forEach((t) => this.genAdds(t, e.target)), e.removedNodes.forEach((t) => {
1197
+ let n = this.mirror.getId(t), r = F(e.target) ? this.mirror.getId(P.host(e.target)) : this.mirror.getId(e.target);
1198
+ q(e.target, this.blockClass, this.blockSelector, !1) || ft(t, this.mirror, this.slimDOMOptions) || !dt(t, this.mirror) || (this.addedSet.has(t) ? (Et(this.addedSet, t), this.droppedSet.add(t)) : this.addedSet.has(e.target) && n === -1 || pt(e.target, this.mirror) || (this.movedSet.has(t) && this.movedMap[wt(n, r)] ? Et(this.movedSet, t) : (this.removes.push({
1199
+ parentId: r,
1200
+ id: n,
1201
+ isShadow: F(e.target) && I(e.target) ? !0 : void 0
1202
+ }), Dt(t, this.removesSubTreeCache))), this.mapRemoves.push(t));
1203
+ });
1204
+ }
1205
+ }), i(this, "genAdds", (e, t) => {
1206
+ if (!this.processedNodeManager.inOtherBuffer(e, this) && !(this.addedSet.has(e) || this.movedSet.has(e))) {
1207
+ if (this.mirror.hasNode(e)) {
1208
+ if (ft(e, this.mirror, this.slimDOMOptions)) return;
1209
+ this.movedSet.add(e);
1210
+ let n = null;
1211
+ t && this.mirror.hasNode(t) && (n = this.mirror.getId(t)), n && n !== -1 && (this.movedMap[wt(this.mirror.getId(e), n)] = !0);
1212
+ } else this.addedSet.add(e), this.droppedSet.delete(e);
1213
+ q(e, this.blockClass, this.blockSelector, !1) || (P.childNodes(e).forEach((e) => this.genAdds(e)), vt(e) && P.childNodes(P.shadowRoot(e)).forEach((t) => {
1214
+ this.processedNodeManager.add(t, this), this.genAdds(t, e);
1215
+ }));
1216
+ }
1217
+ });
1218
+ }
1219
+ init(e) {
1220
+ [
1221
+ "mutationCb",
1222
+ "blockClass",
1223
+ "blockSelector",
1224
+ "maskTextClass",
1225
+ "maskTextSelector",
1226
+ "inlineStylesheet",
1227
+ "maskInputOptions",
1228
+ "maskTextFn",
1229
+ "maskInputFn",
1230
+ "keepIframeSrcFn",
1231
+ "recordCanvas",
1232
+ "inlineImages",
1233
+ "slimDOMOptions",
1234
+ "dataURLOptions",
1235
+ "doc",
1236
+ "mirror",
1237
+ "iframeManager",
1238
+ "stylesheetManager",
1239
+ "shadowDomManager",
1240
+ "canvasManager",
1241
+ "processedNodeManager"
1242
+ ].forEach((t) => {
1243
+ this[t] = e[t];
1244
+ });
1245
+ }
1246
+ freeze() {
1247
+ this.frozen = !0, this.canvasManager.freeze();
1248
+ }
1249
+ unfreeze() {
1250
+ this.frozen = !1, this.canvasManager.unfreeze(), this.emit();
1251
+ }
1252
+ isFrozen() {
1253
+ return this.frozen;
1254
+ }
1255
+ lock() {
1256
+ this.locked = !0, this.canvasManager.lock();
1257
+ }
1258
+ unlock() {
1259
+ this.locked = !1, this.canvasManager.unlock(), this.emit();
1260
+ }
1261
+ reset() {
1262
+ this.shadowDomManager.reset(), this.canvasManager.reset();
1263
+ }
1264
+ };
1265
+ function Et(e, t) {
1266
+ e.delete(t), P.childNodes(t).forEach((t) => Et(e, t));
1267
+ }
1268
+ function Dt(e, t) {
1269
+ let n = [e];
1270
+ for (; n.length;) {
1271
+ let e = n.pop();
1272
+ t.has(e) || (t.add(e), P.childNodes(e).forEach((e) => n.push(e)));
1273
+ }
1274
+ }
1275
+ function Ot(e, t) {
1276
+ return e.size !== 0 && kt(e, t);
1277
+ }
1278
+ function kt(e, t) {
1279
+ if (e.has(t)) return !0;
1280
+ let n = P.parentNode(t);
1281
+ return n ? kt(e, n) : !1;
1282
+ }
1283
+ var At;
1284
+ function jt(e) {
1285
+ At = e;
1286
+ }
1287
+ function Mt() {
1288
+ At = void 0;
1289
+ }
1290
+ var J = (e) => At ? (...t) => {
1291
+ try {
1292
+ return e(...t);
1293
+ } catch (e) {
1294
+ if (At && At(e) === !0) return;
1295
+ throw e;
1296
+ }
1297
+ } : e, Y = [];
1298
+ function Nt(e) {
1299
+ try {
1300
+ if ("composedPath" in e) {
1301
+ let t = e.composedPath();
1302
+ if (t.length) return t[0];
1303
+ } else if ("path" in e && e.path.length) return e.path[0];
1304
+ } catch {}
1305
+ return e && e.target;
1306
+ }
1307
+ function Pt(e, t) {
1308
+ let n = new Tt();
1309
+ Y.push(n), n.init(e);
1310
+ let [r, i] = oe(), a = new r(J(n.processMutations.bind(n)));
1311
+ return a.observe(t, {
1312
+ attributes: !0,
1313
+ attributeOldValue: !0,
1314
+ characterData: !0,
1315
+ characterDataOldValue: !0,
1316
+ childList: !0,
1317
+ subtree: !0
1318
+ }), [a, i];
1319
+ }
1320
+ function Ft({ mousemoveCb: e, sampling: t, doc: n, mirror: r }) {
1321
+ if (t.mousemove === !1) return () => {};
1322
+ let i = typeof t.mousemove == "number" ? t.mousemove : 50, a = typeof t.mousemoveCallback == "number" ? t.mousemoveCallback : 500, s = [], c, l = K(J((t) => {
1323
+ let n = Date.now() - c;
1324
+ e(s.map((e) => (e.timeOffset -= n, e)), t), s = [], c = null;
1325
+ }), a), u = J(K(J((e) => {
1326
+ let t = Nt(e), { clientX: n, clientY: i } = mt(e) ? e.changedTouches[0] : e;
1327
+ c || (c = M()), s.push({
1328
+ x: n,
1329
+ y: i,
1330
+ id: r.getId(t),
1331
+ timeOffset: M() - c
1332
+ }), l(typeof DragEvent < "u" && e instanceof DragEvent ? o.Drag : e instanceof MouseEvent ? o.MouseMove : o.TouchMove);
1333
+ }), i, { trailing: !1 })), d = [
1334
+ W("mousemove", u, n),
1335
+ W("touchmove", u, n),
1336
+ W("drag", u, n)
1337
+ ];
1338
+ return J(() => {
1339
+ d.forEach((e) => e());
1340
+ });
1341
+ }
1342
+ function It({ mouseInteractionCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: a }) {
1343
+ if (a.mouseInteraction === !1) return () => {};
1344
+ let o = a.mouseInteraction === !0 || a.mouseInteraction === void 0 ? {} : a.mouseInteraction, l = [], u = null, d = (t) => (a) => {
1345
+ let o = Nt(a);
1346
+ if (q(o, r, i, !0)) return;
1347
+ let l = null, d = t;
1348
+ if ("pointerType" in a) {
1349
+ switch (a.pointerType) {
1350
+ case "mouse":
1351
+ l = c.Mouse;
1352
+ break;
1353
+ case "touch":
1354
+ l = c.Touch;
1355
+ break;
1356
+ case "pen": l = c.Pen;
1357
+ }
1358
+ l === c.Touch ? s[t] === s.MouseDown ? d = "TouchStart" : s[t] === s.MouseUp && (d = "TouchEnd") : c.Pen;
1359
+ } else mt(a) && (l = c.Touch);
1360
+ l === null ? s[t] === s.Click && (l = u, u = null) : (u = l, (d.startsWith("Touch") && l === c.Touch || d.startsWith("Mouse") && l === c.Mouse) && (l = null));
1361
+ let f = mt(a) ? a.changedTouches[0] : a;
1362
+ if (!f) return;
1363
+ let p = n.getId(o), { clientX: m, clientY: h } = f;
1364
+ J(e)({
1365
+ type: s[d],
1366
+ id: p,
1367
+ x: m,
1368
+ y: h,
1369
+ ...l !== null && { pointerType: l }
1370
+ });
1371
+ };
1372
+ return Object.keys(s).filter((e) => Number.isNaN(Number(e)) && !e.endsWith("_Departed") && o[e] !== !1).forEach((e) => {
1373
+ let n = B(e), r = d(e);
1374
+ if (window.PointerEvent) switch (s[e]) {
1375
+ case s.MouseDown:
1376
+ case s.MouseUp:
1377
+ n = n.replace("mouse", "pointer");
1378
+ break;
1379
+ case s.TouchStart:
1380
+ case s.TouchEnd: return;
1381
+ }
1382
+ l.push(W(n, r, t));
1383
+ }), J(() => {
1384
+ l.forEach((e) => e());
1385
+ });
1386
+ }
1387
+ function Lt({ scrollCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, sampling: a }) {
1388
+ return W("scroll", J(K(J((a) => {
1389
+ let o = Nt(a);
1390
+ if (!o || q(o, r, i, !0)) return;
1391
+ let s = n.getId(o);
1392
+ if (o === t && t.defaultView) {
1393
+ let n = st(t.defaultView);
1394
+ e({
1395
+ id: s,
1396
+ x: n.left,
1397
+ y: n.top
1398
+ });
1399
+ } else e({
1400
+ id: s,
1401
+ x: o.scrollLeft,
1402
+ y: o.scrollTop
1403
+ });
1404
+ }), a.scroll || 100)), t);
1405
+ }
1406
+ function Rt({ viewportResizeCb: e }, { win: t }) {
1407
+ let n = -1, r = -1;
1408
+ return W("resize", J(K(J(() => {
1409
+ let t = ct(), i = lt();
1410
+ (n !== t || r !== i) && (e({
1411
+ width: Number(i),
1412
+ height: Number(t)
1413
+ }), n = t, r = i);
1414
+ }), 200)), t);
1415
+ }
1416
+ var zt = [
1417
+ "INPUT",
1418
+ "TEXTAREA",
1419
+ "SELECT"
1420
+ ], Bt = /* @__PURE__ */ new WeakMap();
1421
+ function Vt({ inputCb: e, doc: t, mirror: n, blockClass: r, blockSelector: i, ignoreClass: a, ignoreSelector: o, maskInputOptions: s, maskInputFn: c, sampling: l, userTriggeredOnInput: u }) {
1422
+ function d(e) {
1423
+ let n = Nt(e), l = e.isTrusted, d = n && n.tagName;
1424
+ if (n && d === "OPTION" && (n = P.parentElement(n)), !n || !d || zt.indexOf(d) < 0 || q(n, r, i, !0) || n.classList.contains(a) || o && n.matches(o)) return;
1425
+ let p = n.value, m = !1, h = _e(n) || "";
1426
+ h === "radio" || h === "checkbox" ? m = n.checked : (s[d.toLowerCase()] || s[h]) && (p = me({
1427
+ element: n,
1428
+ maskInputOptions: s,
1429
+ tagName: d,
1430
+ type: h,
1431
+ value: p,
1432
+ maskInputFn: c
1433
+ })), f(n, u ? {
1434
+ text: p,
1435
+ isChecked: m,
1436
+ userTriggered: l
1437
+ } : {
1438
+ text: p,
1439
+ isChecked: m
1440
+ });
1441
+ let g = n.name;
1442
+ h === "radio" && g && m && t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach((e) => {
1443
+ if (e !== n) {
1444
+ let t = e.value;
1445
+ f(e, u ? {
1446
+ text: t,
1447
+ isChecked: !m,
1448
+ userTriggered: !1
1449
+ } : {
1450
+ text: t,
1451
+ isChecked: !m
1452
+ });
1453
+ }
1454
+ });
1455
+ }
1456
+ function f(t, r) {
1457
+ let i = Bt.get(t);
1458
+ if (!i || i.text !== r.text || i.isChecked !== r.isChecked) {
1459
+ Bt.set(t, r);
1460
+ let i = n.getId(t);
1461
+ J(e)({
1462
+ ...r,
1463
+ id: i
1464
+ });
1465
+ }
1466
+ }
1467
+ let p = (l.input === "last" ? ["change"] : ["input", "change"]).map((e) => W(e, J(d), t)), m = t.defaultView;
1468
+ if (!m) return () => {
1469
+ p.forEach((e) => e());
1470
+ };
1471
+ let h = m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype, "value"), g = [
1472
+ [m.HTMLInputElement.prototype, "value"],
1473
+ [m.HTMLInputElement.prototype, "checked"],
1474
+ [m.HTMLSelectElement.prototype, "value"],
1475
+ [m.HTMLTextAreaElement.prototype, "value"],
1476
+ [m.HTMLSelectElement.prototype, "selectedIndex"],
1477
+ [m.HTMLOptionElement.prototype, "selected"]
1478
+ ];
1479
+ return h && h.set && p.push(...g.map((e) => ot(e[0], e[1], { set() {
1480
+ J(d)({
1481
+ target: this,
1482
+ isTrusted: !1
1483
+ });
1484
+ } }, !1, m))), J(() => {
1485
+ p.forEach((e) => e());
1486
+ });
1487
+ }
1488
+ function Ht(e) {
1489
+ let t = [];
1490
+ function n(e, t) {
1491
+ if (Qt("CSSGroupingRule") && e.parentRule instanceof CSSGroupingRule || Qt("CSSMediaRule") && e.parentRule instanceof CSSMediaRule || Qt("CSSSupportsRule") && e.parentRule instanceof CSSSupportsRule || Qt("CSSConditionRule") && e.parentRule instanceof CSSConditionRule) {
1492
+ let r = Array.from(e.parentRule.cssRules).indexOf(e);
1493
+ return t.unshift(r), n(e.parentRule, t);
1494
+ }
1495
+ if (e.parentStyleSheet) {
1496
+ let n = Array.from(e.parentStyleSheet.cssRules).indexOf(e);
1497
+ t.unshift(n);
1498
+ }
1499
+ return t;
1500
+ }
1501
+ return n(e, t);
1502
+ }
1503
+ function X(e, t, n) {
1504
+ let r, i;
1505
+ return e ? (e.ownerNode ? r = t.getId(e.ownerNode) : i = n.getId(e), {
1506
+ styleId: i,
1507
+ id: r
1508
+ }) : {};
1509
+ }
1510
+ function Ut({ styleSheetRuleCb: e, mirror: t, stylesheetManager: n }, { win: r }) {
1511
+ if (!r.CSSStyleSheet || !r.CSSStyleSheet.prototype) return () => {};
1512
+ let i = r.CSSStyleSheet.prototype.insertRule;
1513
+ r.CSSStyleSheet.prototype.insertRule = new Proxy(i, { apply: J((r, i, a) => {
1514
+ let [o, s] = a, { id: c, styleId: l } = X(i, t, n.styleMirror);
1515
+ return (c && c !== -1 || l && l !== -1) && e({
1516
+ id: c,
1517
+ styleId: l,
1518
+ adds: [{
1519
+ rule: o,
1520
+ index: s
1521
+ }]
1522
+ }), r.apply(i, a);
1523
+ }) }), r.CSSStyleSheet.prototype.addRule = function(e, t, n = this.cssRules.length) {
1524
+ let i = `${e} { ${t} }`;
1525
+ return r.CSSStyleSheet.prototype.insertRule.apply(this, [i, n]);
1526
+ };
1527
+ let a = r.CSSStyleSheet.prototype.deleteRule;
1528
+ r.CSSStyleSheet.prototype.deleteRule = new Proxy(a, { apply: J((r, i, a) => {
1529
+ let [o] = a, { id: s, styleId: c } = X(i, t, n.styleMirror);
1530
+ return (s && s !== -1 || c && c !== -1) && e({
1531
+ id: s,
1532
+ styleId: c,
1533
+ removes: [{ index: o }]
1534
+ }), r.apply(i, a);
1535
+ }) }), r.CSSStyleSheet.prototype.removeRule = function(e) {
1536
+ return r.CSSStyleSheet.prototype.deleteRule.apply(this, [e]);
1537
+ };
1538
+ let o;
1539
+ r.CSSStyleSheet.prototype.replace && (o = r.CSSStyleSheet.prototype.replace, r.CSSStyleSheet.prototype.replace = new Proxy(o, { apply: J((r, i, a) => {
1540
+ let [o] = a, { id: s, styleId: c } = X(i, t, n.styleMirror);
1541
+ return (s && s !== -1 || c && c !== -1) && e({
1542
+ id: s,
1543
+ styleId: c,
1544
+ replace: o
1545
+ }), r.apply(i, a);
1546
+ }) }));
1547
+ let s;
1548
+ r.CSSStyleSheet.prototype.replaceSync && (s = r.CSSStyleSheet.prototype.replaceSync, r.CSSStyleSheet.prototype.replaceSync = new Proxy(s, { apply: J((r, i, a) => {
1549
+ let [o] = a, { id: s, styleId: c } = X(i, t, n.styleMirror);
1550
+ return (s && s !== -1 || c && c !== -1) && e({
1551
+ id: s,
1552
+ styleId: c,
1553
+ replaceSync: o
1554
+ }), r.apply(i, a);
1555
+ }) }));
1556
+ let c = {};
1557
+ $t("CSSGroupingRule") ? c.CSSGroupingRule = r.CSSGroupingRule : ($t("CSSMediaRule") && (c.CSSMediaRule = r.CSSMediaRule), $t("CSSConditionRule") && (c.CSSConditionRule = r.CSSConditionRule), $t("CSSSupportsRule") && (c.CSSSupportsRule = r.CSSSupportsRule));
1558
+ let l = {};
1559
+ return Object.entries(c).forEach(([r, i]) => {
1560
+ l[r] = {
1561
+ insertRule: i.prototype.insertRule,
1562
+ deleteRule: i.prototype.deleteRule
1563
+ }, i.prototype.insertRule = new Proxy(l[r].insertRule, { apply: J((r, i, a) => {
1564
+ let [o, s] = a, { id: c, styleId: l } = X(i.parentStyleSheet, t, n.styleMirror);
1565
+ return (c && c !== -1 || l && l !== -1) && e({
1566
+ id: c,
1567
+ styleId: l,
1568
+ adds: [{
1569
+ rule: o,
1570
+ index: [...Ht(i), s || 0]
1571
+ }]
1572
+ }), r.apply(i, a);
1573
+ }) }), i.prototype.deleteRule = new Proxy(l[r].deleteRule, { apply: J((r, i, a) => {
1574
+ let [o] = a, { id: s, styleId: c } = X(i.parentStyleSheet, t, n.styleMirror);
1575
+ return (s && s !== -1 || c && c !== -1) && e({
1576
+ id: s,
1577
+ styleId: c,
1578
+ removes: [{ index: [...Ht(i), o] }]
1579
+ }), r.apply(i, a);
1580
+ }) });
1581
+ }), J(() => {
1582
+ 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]) => {
1583
+ t.prototype.insertRule = l[e].insertRule, t.prototype.deleteRule = l[e].deleteRule;
1584
+ });
1585
+ });
1586
+ }
1587
+ function Wt({ mirror: e, stylesheetManager: t }, n) {
1588
+ let r = null;
1589
+ r = n.nodeName === "#document" ? e.getId(n) : e.getId(P.host(n));
1590
+ let i = n.nodeName === "#document" ? n.defaultView?.Document : n.ownerDocument?.defaultView?.ShadowRoot, a = i?.prototype ? Object.getOwnPropertyDescriptor(i?.prototype, "adoptedStyleSheets") : void 0;
1591
+ return r === null || r === -1 || !i || !a ? () => {} : (Object.defineProperty(n, "adoptedStyleSheets", {
1592
+ configurable: a.configurable,
1593
+ enumerable: a.enumerable,
1594
+ get() {
1595
+ return a.get?.call(this);
1596
+ },
1597
+ set(e) {
1598
+ let n = a.set?.call(this, e);
1599
+ if (r !== null && r !== -1) try {
1600
+ t.adoptStyleSheets(e, r);
1601
+ } catch {}
1602
+ return n;
1603
+ }
1604
+ }), J(() => {
1605
+ Object.defineProperty(n, "adoptedStyleSheets", {
1606
+ configurable: a.configurable,
1607
+ enumerable: a.enumerable,
1608
+ get: a.get,
1609
+ set: a.set
1610
+ });
1611
+ }));
1612
+ }
1613
+ function Gt({ styleDeclarationCb: e, mirror: t, ignoreCSSAttributes: n, stylesheetManager: r }, { win: i }) {
1614
+ let a = i.CSSStyleDeclaration.prototype.setProperty;
1615
+ i.CSSStyleDeclaration.prototype.setProperty = new Proxy(a, { apply: J((i, o, s) => {
1616
+ let [c, l, u] = s;
1617
+ if (n.has(c)) return a.apply(o, [
1618
+ c,
1619
+ l,
1620
+ u
1621
+ ]);
1622
+ let { id: d, styleId: f } = X(o.parentRule?.parentStyleSheet, t, r.styleMirror);
1623
+ return (d && d !== -1 || f && f !== -1) && e({
1624
+ id: d,
1625
+ styleId: f,
1626
+ set: {
1627
+ property: c,
1628
+ value: l,
1629
+ priority: u
1630
+ },
1631
+ index: Ht(o.parentRule)
1632
+ }), i.apply(o, s);
1633
+ }) });
1634
+ let o = i.CSSStyleDeclaration.prototype.removeProperty;
1635
+ return i.CSSStyleDeclaration.prototype.removeProperty = new Proxy(o, { apply: J((i, a, s) => {
1636
+ let [c] = s;
1637
+ if (n.has(c)) return o.apply(a, [c]);
1638
+ let { id: l, styleId: u } = X(a.parentRule?.parentStyleSheet, t, r.styleMirror);
1639
+ return (l && l !== -1 || u && u !== -1) && e({
1640
+ id: l,
1641
+ styleId: u,
1642
+ remove: { property: c },
1643
+ index: Ht(a.parentRule)
1644
+ }), i.apply(a, s);
1645
+ }) }), J(() => {
1646
+ i.CSSStyleDeclaration.prototype.setProperty = a, i.CSSStyleDeclaration.prototype.removeProperty = o;
1647
+ });
1648
+ }
1649
+ function Kt({ mediaInteractionCb: e, blockClass: t, blockSelector: n, mirror: r, sampling: i, doc: a }) {
1650
+ let o = J((a) => K(J((i) => {
1651
+ let o = Nt(i);
1652
+ if (!o || q(o, t, n, !0)) return;
1653
+ let { currentTime: s, volume: c, muted: l, playbackRate: u, loop: d } = o;
1654
+ e({
1655
+ type: a,
1656
+ id: r.getId(o),
1657
+ currentTime: s,
1658
+ volume: c,
1659
+ muted: l,
1660
+ playbackRate: u,
1661
+ loop: d
1662
+ });
1663
+ }), i.media || 500)), s = [
1664
+ W("play", o(u.Play), a),
1665
+ W("pause", o(u.Pause), a),
1666
+ W("seeked", o(u.Seeked), a),
1667
+ W("volumechange", o(u.VolumeChange), a),
1668
+ W("ratechange", o(u.RateChange), a)
1669
+ ];
1670
+ return J(() => {
1671
+ s.forEach((e) => e());
1672
+ });
1673
+ }
1674
+ function qt({ fontCb: e, doc: t }) {
1675
+ let n = t.defaultView;
1676
+ if (!n) return () => {};
1677
+ let r = [], i = /* @__PURE__ */ new WeakMap(), a = n.FontFace;
1678
+ n.FontFace = function(e, t, n) {
1679
+ let r = new a(e, t, n);
1680
+ return i.set(r, {
1681
+ family: e,
1682
+ buffer: typeof t != "string",
1683
+ descriptors: n,
1684
+ fontSource: typeof t == "string" ? t : JSON.stringify(Array.from(new Uint8Array(t)))
1685
+ }), r;
1686
+ };
1687
+ let o = N(t.fonts, "add", function(t) {
1688
+ return function(n) {
1689
+ return setTimeout(J(() => {
1690
+ let t = i.get(n);
1691
+ t && (e(t), i.delete(n));
1692
+ }), 0), t.apply(this, [n]);
1693
+ };
1694
+ });
1695
+ return r.push(() => {
1696
+ n.FontFace = a;
1697
+ }), r.push(o), J(() => {
1698
+ r.forEach((e) => e());
1699
+ });
1700
+ }
1701
+ function Jt(e) {
1702
+ let { doc: t, mirror: n, blockClass: r, blockSelector: i, selectionCb: a } = e, o = !0, s = J(() => {
1703
+ let e = t.getSelection();
1704
+ if (!e || o && e?.isCollapsed) return;
1705
+ o = e.isCollapsed || !1;
1706
+ let s = [], c = e.rangeCount || 0;
1707
+ for (let t = 0; t < c; t++) {
1708
+ let { startContainer: a, startOffset: o, endContainer: c, endOffset: l } = e.getRangeAt(t);
1709
+ q(a, r, i, !0) || q(c, r, i, !0) || s.push({
1710
+ start: n.getId(a),
1711
+ startOffset: o,
1712
+ end: n.getId(c),
1713
+ endOffset: l
1714
+ });
1715
+ }
1716
+ a({ ranges: s });
1717
+ });
1718
+ return s(), W("selectionchange", s);
1719
+ }
1720
+ function Yt({ doc: e, customElementCb: t }) {
1721
+ let n = e.defaultView;
1722
+ return !n || !n.customElements ? () => {} : N(n.customElements, "define", function(e) {
1723
+ return function(n, r, i) {
1724
+ try {
1725
+ t({ define: { name: n } });
1726
+ } catch {
1727
+ console.warn(`Custom element callback failed for ${n}`);
1728
+ }
1729
+ return e.apply(this, [
1730
+ n,
1731
+ r,
1732
+ i
1733
+ ]);
1734
+ };
1735
+ });
1736
+ }
1737
+ function Xt(e, t) {
1738
+ 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;
1739
+ e.mutationCb = (...e) => {
1740
+ t.mutation && t.mutation(...e), n(...e);
1741
+ }, e.mousemoveCb = (...e) => {
1742
+ t.mousemove && t.mousemove(...e), r(...e);
1743
+ }, e.mouseInteractionCb = (...e) => {
1744
+ t.mouseInteraction && t.mouseInteraction(...e), i(...e);
1745
+ }, e.scrollCb = (...e) => {
1746
+ t.scroll && t.scroll(...e), a(...e);
1747
+ }, e.viewportResizeCb = (...e) => {
1748
+ t.viewportResize && t.viewportResize(...e), o(...e);
1749
+ }, e.inputCb = (...e) => {
1750
+ t.input && t.input(...e), s(...e);
1751
+ }, e.mediaInteractionCb = (...e) => {
1752
+ t.mediaInteaction && t.mediaInteaction(...e), c(...e);
1753
+ }, e.styleSheetRuleCb = (...e) => {
1754
+ t.styleSheetRule && t.styleSheetRule(...e), l(...e);
1755
+ }, e.styleDeclarationCb = (...e) => {
1756
+ t.styleDeclaration && t.styleDeclaration(...e), u(...e);
1757
+ }, e.canvasMutationCb = (...e) => {
1758
+ t.canvasMutation && t.canvasMutation(...e), d(...e);
1759
+ }, e.fontCb = (...e) => {
1760
+ t.font && t.font(...e), f(...e);
1761
+ }, e.selectionCb = (...e) => {
1762
+ t.selection && t.selection(...e), p(...e);
1763
+ }, e.customElementCb = (...e) => {
1764
+ t.customElement && t.customElement(...e), m(...e);
1765
+ };
1766
+ }
1767
+ function Zt(e, t = {}) {
1768
+ let n = e.doc.defaultView;
1769
+ if (!n) return () => {};
1770
+ Xt(e, t);
1771
+ let r, i = () => {};
1772
+ e.recordDOM && ([r, i] = Pt(e, e.doc));
1773
+ let a = Ft(e), o = It(e), s = Lt(e), c = Rt(e, { win: n }), l = Vt(e), u = Kt(e), d = () => {}, f = () => {}, p = () => {}, m = () => {};
1774
+ e.recordDOM && (d = Ut(e, { win: n }), f = Wt(e, e.doc), p = Gt(e, { win: n }), e.collectFonts && (m = qt(e)));
1775
+ let h = Jt(e), g = Yt(e), _ = [];
1776
+ for (let t of e.plugins) _.push(t.observer(t.callback, n, t.options));
1777
+ return J(() => {
1778
+ Y.forEach((e) => e.reset()), r?.disconnect(), i(), a(), o(), s(), c(), l(), u(), d(), f(), p(), m(), h(), g(), _.forEach((e) => e());
1779
+ });
1780
+ }
1781
+ function Qt(e) {
1782
+ return window[e] !== void 0;
1783
+ }
1784
+ function $t(e) {
1785
+ return !!(window[e] !== void 0 && window[e].prototype && "insertRule" in window[e].prototype && "deleteRule" in window[e].prototype);
1786
+ }
1787
+ for (var en = class {
1788
+ constructor(e) {
1789
+ i(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap()), i(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap()), this.generateIdFn = e;
1790
+ }
1791
+ getId(e, t, n, r) {
1792
+ let i = n || this.getIdToRemoteIdMap(e), a = r || this.getRemoteIdToIdMap(e), o = i.get(t);
1793
+ return o || (o = this.generateIdFn(), i.set(t, o), a.set(o, t)), o;
1794
+ }
1795
+ getIds(e, t) {
1796
+ let n = this.getIdToRemoteIdMap(e), r = this.getRemoteIdToIdMap(e);
1797
+ return t.map((t) => this.getId(e, t, n, r));
1798
+ }
1799
+ getRemoteId(e, t, n) {
1800
+ let r = n || this.getRemoteIdToIdMap(e);
1801
+ return typeof t == "number" ? r.get(t) || -1 : t;
1802
+ }
1803
+ getRemoteIds(e, t) {
1804
+ let n = this.getRemoteIdToIdMap(e);
1805
+ return t.map((t) => this.getRemoteId(e, t, n));
1806
+ }
1807
+ reset(e) {
1808
+ e ? (this.iframeIdToRemoteIdMap.delete(e), this.iframeRemoteIdToIdMap.delete(e)) : (this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(), this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap());
1809
+ }
1810
+ getIdToRemoteIdMap(e) {
1811
+ let t = this.iframeIdToRemoteIdMap.get(e);
1812
+ return t || (t = /* @__PURE__ */ new Map(), this.iframeIdToRemoteIdMap.set(e, t)), t;
1813
+ }
1814
+ getRemoteIdToIdMap(e) {
1815
+ let t = this.iframeRemoteIdToIdMap.get(e);
1816
+ return t || (t = /* @__PURE__ */ new Map(), this.iframeRemoteIdToIdMap.set(e, t)), t;
1817
+ }
1818
+ }, tn = class {
1819
+ constructor(e) {
1820
+ i(this, "iframes", /* @__PURE__ */ new WeakMap()), i(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap()), i(this, "crossOriginIframeMirror", new en(Pe)), i(this, "crossOriginIframeStyleMirror"), i(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap()), i(this, "mirror"), i(this, "mutationCb"), i(this, "wrappedEmit"), i(this, "loadListener"), i(this, "stylesheetManager"), i(this, "recordCrossOriginIframes"), this.mutationCb = e.mutationCb, this.wrappedEmit = e.wrappedEmit, this.stylesheetManager = e.stylesheetManager, this.recordCrossOriginIframes = e.recordCrossOriginIframes, this.crossOriginIframeStyleMirror = new en(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)), this.mirror = e.mirror, this.recordCrossOriginIframes && window.addEventListener("message", this.handleMessage.bind(this));
1821
+ }
1822
+ addIframe(e) {
1823
+ this.iframes.set(e, !0), e.contentWindow && this.crossOriginIframeMap.set(e.contentWindow, e);
1824
+ }
1825
+ addLoadListener(e) {
1826
+ this.loadListener = e;
1827
+ }
1828
+ attachIframe(e, t) {
1829
+ var n, r;
1830
+ this.mutationCb({
1831
+ adds: [{
1832
+ parentId: this.mirror.getId(e),
1833
+ nextId: null,
1834
+ node: t
1835
+ }],
1836
+ removes: [],
1837
+ texts: [],
1838
+ attributes: [],
1839
+ isAttachIframe: !0
1840
+ }), this.recordCrossOriginIframes && ((n = e.contentWindow) == null || n.addEventListener("message", this.handleMessage.bind(this))), (r = this.loadListener) == null || r.call(this, e), e.contentDocument && e.contentDocument.adoptedStyleSheets && e.contentDocument.adoptedStyleSheets.length > 0 && this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets, this.mirror.getId(e.contentDocument));
1841
+ }
1842
+ handleMessage(e) {
1843
+ let t = e;
1844
+ if (t.data.type !== "rrweb" || t.origin !== t.data.origin || !e.source) return;
1845
+ let n = this.crossOriginIframeMap.get(e.source);
1846
+ if (!n) return;
1847
+ let r = this.transformCrossOriginEvent(n, t.data.event);
1848
+ r && this.wrappedEmit(r, t.data.isCheckout);
1849
+ }
1850
+ transformCrossOriginEvent(e, t) {
1851
+ var n;
1852
+ switch (t.type) {
1853
+ case a.FullSnapshot: {
1854
+ this.crossOriginIframeMirror.reset(e), this.crossOriginIframeStyleMirror.reset(e), this.replaceIdOnNode(t.data.node, e);
1855
+ let n = t.data.node.id;
1856
+ return this.crossOriginIframeRootIdMap.set(e, n), this.patchRootIdOnNode(t.data.node, n), {
1857
+ timestamp: t.timestamp,
1858
+ type: a.IncrementalSnapshot,
1859
+ data: {
1860
+ source: o.Mutation,
1861
+ adds: [{
1862
+ parentId: this.mirror.getId(e),
1863
+ nextId: null,
1864
+ node: t.data.node
1865
+ }],
1866
+ removes: [],
1867
+ texts: [],
1868
+ attributes: [],
1869
+ isAttachIframe: !0
1870
+ }
1871
+ };
1872
+ }
1873
+ case a.Meta:
1874
+ case a.Load:
1875
+ case a.DomContentLoaded: return !1;
1876
+ case a.Plugin: return t;
1877
+ case a.Custom: return this.replaceIds(t.data.payload, e, [
1878
+ "id",
1879
+ "parentId",
1880
+ "previousId",
1881
+ "nextId"
1882
+ ]), t;
1883
+ case a.IncrementalSnapshot: switch (t.data.source) {
1884
+ case o.Mutation: return t.data.adds.forEach((t) => {
1885
+ this.replaceIds(t, e, [
1886
+ "parentId",
1887
+ "nextId",
1888
+ "previousId"
1889
+ ]), this.replaceIdOnNode(t.node, e);
1890
+ let n = this.crossOriginIframeRootIdMap.get(e);
1891
+ n && this.patchRootIdOnNode(t.node, n);
1892
+ }), t.data.removes.forEach((t) => {
1893
+ this.replaceIds(t, e, ["parentId", "id"]);
1894
+ }), t.data.attributes.forEach((t) => {
1895
+ this.replaceIds(t, e, ["id"]);
1896
+ }), t.data.texts.forEach((t) => {
1897
+ this.replaceIds(t, e, ["id"]);
1898
+ }), t;
1899
+ case o.Drag:
1900
+ case o.TouchMove:
1901
+ case o.MouseMove: return t.data.positions.forEach((t) => {
1902
+ this.replaceIds(t, e, ["id"]);
1903
+ }), t;
1904
+ case o.ViewportResize: return !1;
1905
+ case o.MediaInteraction:
1906
+ case o.MouseInteraction:
1907
+ case o.Scroll:
1908
+ case o.CanvasMutation:
1909
+ case o.Input: return this.replaceIds(t.data, e, ["id"]), t;
1910
+ case o.StyleSheetRule:
1911
+ case o.StyleDeclaration: return this.replaceIds(t.data, e, ["id"]), this.replaceStyleIds(t.data, e, ["styleId"]), t;
1912
+ case o.Font: return t;
1913
+ case o.Selection: return t.data.ranges.forEach((t) => {
1914
+ this.replaceIds(t, e, ["start", "end"]);
1915
+ }), t;
1916
+ case o.AdoptedStyleSheet: return this.replaceIds(t.data, e, ["id"]), this.replaceStyleIds(t.data, e, ["styleIds"]), (n = t.data.styles) == null || n.forEach((t) => {
1917
+ this.replaceStyleIds(t, e, ["styleId"]);
1918
+ }), t;
1919
+ }
1920
+ }
1921
+ return !1;
1922
+ }
1923
+ replace(e, t, n, r) {
1924
+ for (let i of r) (Array.isArray(t[i]) || typeof t[i] == "number") && (t[i] = Array.isArray(t[i]) ? e.getIds(n, t[i]) : e.getId(n, t[i]));
1925
+ return t;
1926
+ }
1927
+ replaceIds(e, t, n) {
1928
+ return this.replace(this.crossOriginIframeMirror, e, t, n);
1929
+ }
1930
+ replaceStyleIds(e, t, n) {
1931
+ return this.replace(this.crossOriginIframeStyleMirror, e, t, n);
1932
+ }
1933
+ replaceIdOnNode(e, t) {
1934
+ this.replaceIds(e, t, ["id", "rootId"]), "childNodes" in e && e.childNodes.forEach((e) => {
1935
+ this.replaceIdOnNode(e, t);
1936
+ });
1937
+ }
1938
+ patchRootIdOnNode(e, t) {
1939
+ e.type !== d.Document && !e.rootId && (e.rootId = t), "childNodes" in e && e.childNodes.forEach((e) => {
1940
+ this.patchRootIdOnNode(e, t);
1941
+ });
1942
+ }
1943
+ }, nn = class {
1944
+ constructor(e) {
1945
+ i(this, "shadowDoms", /* @__PURE__ */ new WeakSet()), i(this, "mutationCb"), i(this, "scrollCb"), i(this, "bypassOptions"), i(this, "mirror"), i(this, "restoreHandlers", []), this.mutationCb = e.mutationCb, this.scrollCb = e.scrollCb, this.bypassOptions = e.bypassOptions, this.mirror = e.mirror, this.init();
1946
+ }
1947
+ init() {
1948
+ this.reset(), this.patchAttachShadow(Element, document);
1949
+ }
1950
+ addShadowRoot(e, t) {
1951
+ if (!I(e) || this.shadowDoms.has(e)) return;
1952
+ this.shadowDoms.add(e);
1953
+ let [n] = Pt({
1954
+ ...this.bypassOptions,
1955
+ doc: t,
1956
+ mutationCb: this.mutationCb,
1957
+ mirror: this.mirror,
1958
+ shadowDomManager: this
1959
+ }, e);
1960
+ this.restoreHandlers.push(() => n.disconnect()), this.restoreHandlers.push(Lt({
1961
+ ...this.bypassOptions,
1962
+ scrollCb: this.scrollCb,
1963
+ doc: e,
1964
+ mirror: this.mirror
1965
+ })), setTimeout(() => {
1966
+ e.adoptedStyleSheets && e.adoptedStyleSheets.length > 0 && this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets, this.mirror.getId(P.host(e))), this.restoreHandlers.push(Wt({
1967
+ mirror: this.mirror,
1968
+ stylesheetManager: this.bypassOptions.stylesheetManager
1969
+ }, e));
1970
+ }, 0);
1971
+ }
1972
+ observeAttachShadow(e) {
1973
+ e.contentWindow && e.contentDocument && this.patchAttachShadow(e.contentWindow.Element, e.contentDocument);
1974
+ }
1975
+ patchAttachShadow(e, t) {
1976
+ let n = this;
1977
+ this.restoreHandlers.push(N(e.prototype, "attachShadow", function(e) {
1978
+ return function(r) {
1979
+ let i = e.call(this, r), a = P.shadowRoot(this);
1980
+ return a && Ct(this) && n.addShadowRoot(a, t), i;
1981
+ };
1982
+ }));
1983
+ }
1984
+ reset() {
1985
+ this.restoreHandlers.forEach((e) => {
1986
+ try {
1987
+ e();
1988
+ } catch {}
1989
+ }), this.restoreHandlers = [], this.shadowDoms = /* @__PURE__ */ new WeakSet();
1990
+ }
1991
+ }, Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", rn = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256), an = 0; an < Z.length; an++) rn[Z.charCodeAt(an)] = an;
1992
+ var on = function(e) {
1993
+ var t = new Uint8Array(e), n, r = t.length, i = "";
1994
+ for (n = 0; n < r; n += 3) i += Z[t[n] >> 2], i += Z[(t[n] & 3) << 4 | t[n + 1] >> 4], i += Z[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], i += Z[t[n + 2] & 63];
1995
+ return r % 3 == 2 ? i = i.substring(0, i.length - 1) + "=" : r % 3 == 1 && (i = i.substring(0, i.length - 2) + "=="), i;
1996
+ }, sn = /* @__PURE__ */ new Map();
1997
+ function cn(e, t) {
1998
+ let n = sn.get(e);
1999
+ return n || (n = /* @__PURE__ */ new Map(), sn.set(e, n)), n.has(t) || n.set(t, []), n.get(t);
2000
+ }
2001
+ var ln = (e, t, n) => {
2002
+ if (!e || !(fn(e, t) || typeof e == "object")) return;
2003
+ let r = e.constructor.name, i = cn(n, r), a = i.indexOf(e);
2004
+ return a === -1 && (a = i.length, i.push(e)), a;
2005
+ };
2006
+ function un(e, t, n) {
2007
+ if (e instanceof Array) return e.map((e) => un(e, t, n));
2008
+ if (e === null) return e;
2009
+ 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 {
2010
+ rr_type: e.constructor.name,
2011
+ args: [Object.values(e)]
2012
+ };
2013
+ if (e instanceof ArrayBuffer) return {
2014
+ rr_type: e.constructor.name,
2015
+ base64: on(e)
2016
+ };
2017
+ if (e instanceof DataView) return {
2018
+ rr_type: e.constructor.name,
2019
+ args: [
2020
+ un(e.buffer, t, n),
2021
+ e.byteOffset,
2022
+ e.byteLength
2023
+ ]
2024
+ };
2025
+ if (e instanceof HTMLImageElement) {
2026
+ let t = e.constructor.name, { src: n } = e;
2027
+ return {
2028
+ rr_type: t,
2029
+ src: n
2030
+ };
2031
+ }
2032
+ return e instanceof HTMLCanvasElement ? {
2033
+ rr_type: "HTMLImageElement",
2034
+ src: e.toDataURL()
2035
+ } : e instanceof ImageData ? {
2036
+ rr_type: e.constructor.name,
2037
+ args: [
2038
+ un(e.data, t, n),
2039
+ e.width,
2040
+ e.height
2041
+ ]
2042
+ } : fn(e, t) || typeof e == "object" ? {
2043
+ rr_type: e.constructor.name,
2044
+ index: ln(e, t, n)
2045
+ } : e;
2046
+ }
2047
+ var dn = (e, t, n) => e.map((e) => un(e, t, n)), fn = (e, t) => !![
2048
+ "WebGLActiveInfo",
2049
+ "WebGLBuffer",
2050
+ "WebGLFramebuffer",
2051
+ "WebGLProgram",
2052
+ "WebGLRenderbuffer",
2053
+ "WebGLShader",
2054
+ "WebGLShaderPrecisionFormat",
2055
+ "WebGLTexture",
2056
+ "WebGLUniformLocation",
2057
+ "WebGLVertexArrayObject",
2058
+ "WebGLVertexArrayObjectOES"
2059
+ ].filter((e) => typeof t[e] == "function").find((n) => e instanceof t[n]);
2060
+ function pn(e, t, n, r) {
2061
+ let i = [], a = Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);
2062
+ for (let o of a) try {
2063
+ if (typeof t.CanvasRenderingContext2D.prototype[o] != "function") continue;
2064
+ let a = N(t.CanvasRenderingContext2D.prototype, o, function(i) {
2065
+ return function(...a) {
2066
+ return q(this.canvas, n, r, !0) || setTimeout(() => {
2067
+ let n = dn(a, t, this);
2068
+ e(this.canvas, {
2069
+ type: l["2D"],
2070
+ property: o,
2071
+ args: n
2072
+ });
2073
+ }, 0), i.apply(this, a);
2074
+ };
2075
+ });
2076
+ i.push(a);
2077
+ } catch {
2078
+ let n = ot(t.CanvasRenderingContext2D.prototype, o, { set(t) {
2079
+ e(this.canvas, {
2080
+ type: l["2D"],
2081
+ property: o,
2082
+ args: [t],
2083
+ setter: !0
2084
+ });
2085
+ } });
2086
+ i.push(n);
2087
+ }
2088
+ return () => {
2089
+ i.forEach((e) => e());
2090
+ };
2091
+ }
2092
+ function mn(e) {
2093
+ return e === "experimental-webgl" ? "webgl" : e;
2094
+ }
2095
+ function hn(e, t, n, r) {
2096
+ let i = [];
2097
+ try {
2098
+ let a = N(e.HTMLCanvasElement.prototype, "getContext", function(e) {
2099
+ return function(i, ...a) {
2100
+ if (!q(this, t, n, !0)) {
2101
+ let e = mn(i);
2102
+ if ("__context" in this || (this.__context = e), r && ["webgl", "webgl2"].includes(e)) {
2103
+ if (a[0] && typeof a[0] == "object") {
2104
+ let e = a[0];
2105
+ e.preserveDrawingBuffer || (e.preserveDrawingBuffer = !0);
2106
+ } else a.splice(0, 1, { preserveDrawingBuffer: !0 });
2107
+ }
2108
+ }
2109
+ return e.apply(this, [i, ...a]);
2110
+ };
2111
+ });
2112
+ i.push(a);
2113
+ } catch {
2114
+ console.error("failed to patch HTMLCanvasElement.prototype.getContext");
2115
+ }
2116
+ return () => {
2117
+ i.forEach((e) => e());
2118
+ };
2119
+ }
2120
+ function gn(e, t, n, r, i, a) {
2121
+ let o = [], s = Object.getOwnPropertyNames(e);
2122
+ for (let c of s) if (![
2123
+ "isContextLost",
2124
+ "canvas",
2125
+ "drawingBufferWidth",
2126
+ "drawingBufferHeight"
2127
+ ].includes(c)) try {
2128
+ if (typeof e[c] != "function") continue;
2129
+ let s = N(e, c, function(e) {
2130
+ return function(...o) {
2131
+ let s = e.apply(this, o);
2132
+ if (ln(s, a, this), "tagName" in this.canvas && !q(this.canvas, r, i, !0)) {
2133
+ let e = dn(o, a, this), r = {
2134
+ type: t,
2135
+ property: c,
2136
+ args: e
2137
+ };
2138
+ n(this.canvas, r);
2139
+ }
2140
+ return s;
2141
+ };
2142
+ });
2143
+ o.push(s);
2144
+ } catch {
2145
+ let r = ot(e, c, { set(e) {
2146
+ n(this.canvas, {
2147
+ type: t,
2148
+ property: c,
2149
+ args: [e],
2150
+ setter: !0
2151
+ });
2152
+ } });
2153
+ o.push(r);
2154
+ }
2155
+ return o;
2156
+ }
2157
+ function _n(e, t, n, r) {
2158
+ let i = [];
2159
+ return t.WebGLRenderingContext !== void 0 && i.push(...gn(t.WebGLRenderingContext.prototype, l.WebGL, e, n, r, t)), t.WebGL2RenderingContext !== void 0 && i.push(...gn(t.WebGL2RenderingContext.prototype, l.WebGL2, e, n, r, t)), () => {
2160
+ i.forEach((e) => e());
2161
+ };
2162
+ }
2163
+ var vn = "(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", yn = typeof self < "u" && self.Blob && new Blob([vn], { type: "text/javascript;charset=utf-8" });
2164
+ function bn(e) {
2165
+ let t;
2166
+ try {
2167
+ if (t = yn && (self.URL || self.webkitURL).createObjectURL(yn), !t) throw "";
2168
+ let n = new Worker(t, { name: e?.name });
2169
+ return n.addEventListener("error", () => {
2170
+ (self.URL || self.webkitURL).revokeObjectURL(t);
2171
+ }), n;
2172
+ } catch {
2173
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(vn), { name: e?.name });
2174
+ } finally {
2175
+ t && (self.URL || self.webkitURL).revokeObjectURL(t);
2176
+ }
2177
+ }
2178
+ var xn = class {
2179
+ constructor(e) {
2180
+ i(this, "pendingCanvasMutations", /* @__PURE__ */ new Map()), i(this, "rafStamps", {
2181
+ latestId: 0,
2182
+ invokeId: null
2183
+ }), i(this, "mirror"), i(this, "mutationCb"), i(this, "resetObservers"), i(this, "frozen", !1), i(this, "locked", !1), i(this, "processMutation", (e, t) => {
2184
+ (this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId || !this.rafStamps.invokeId) && (this.rafStamps.invokeId = this.rafStamps.latestId), this.pendingCanvasMutations.has(e) || this.pendingCanvasMutations.set(e, []), this.pendingCanvasMutations.get(e).push(t);
2185
+ });
2186
+ let { sampling: t = "all", win: n, blockClass: r, blockSelector: a, recordCanvas: o, dataURLOptions: s } = e;
2187
+ this.mutationCb = e.mutationCb, this.mirror = e.mirror, o && t === "all" && this.initCanvasMutationObserver(n, r, a), o && typeof t == "number" && this.initCanvasFPSObserver(t, n, r, a, { dataURLOptions: s });
2188
+ }
2189
+ reset() {
2190
+ this.pendingCanvasMutations.clear(), this.resetObservers && this.resetObservers();
2191
+ }
2192
+ freeze() {
2193
+ this.frozen = !0;
2194
+ }
2195
+ unfreeze() {
2196
+ this.frozen = !1;
2197
+ }
2198
+ lock() {
2199
+ this.locked = !0;
2200
+ }
2201
+ unlock() {
2202
+ this.locked = !1;
2203
+ }
2204
+ initCanvasFPSObserver(e, t, n, r, i) {
2205
+ let a = hn(t, n, r, !0), o = /* @__PURE__ */ new Map(), s = new bn();
2206
+ s.onmessage = (e) => {
2207
+ let { id: t } = e.data;
2208
+ if (o.set(t, !1), !("base64" in e.data)) return;
2209
+ let { base64: n, type: r, width: i, height: a } = e.data;
2210
+ this.mutationCb({
2211
+ id: t,
2212
+ type: l["2D"],
2213
+ commands: [{
2214
+ property: "clearRect",
2215
+ args: [
2216
+ 0,
2217
+ 0,
2218
+ i,
2219
+ a
2220
+ ]
2221
+ }, {
2222
+ property: "drawImage",
2223
+ args: [
2224
+ {
2225
+ rr_type: "ImageBitmap",
2226
+ args: [{
2227
+ rr_type: "Blob",
2228
+ data: [{
2229
+ rr_type: "ArrayBuffer",
2230
+ base64: n
2231
+ }],
2232
+ type: r
2233
+ }]
2234
+ },
2235
+ 0,
2236
+ 0
2237
+ ]
2238
+ }]
2239
+ });
2240
+ };
2241
+ let c = 1e3 / e, u = 0, d, f = () => {
2242
+ let e = [];
2243
+ return t.document.querySelectorAll("canvas").forEach((t) => {
2244
+ q(t, n, r, !0) || e.push(t);
2245
+ }), e;
2246
+ }, p = (e) => {
2247
+ u && e - u < c || (u = e, f().forEach(async (e) => {
2248
+ let t = this.mirror.getId(e);
2249
+ if (o.get(t) || e.width === 0 || e.height === 0) return;
2250
+ if (o.set(t, !0), ["webgl", "webgl2"].includes(e.__context)) {
2251
+ let t = e.getContext(e.__context);
2252
+ t?.getContextAttributes()?.preserveDrawingBuffer === !1 && t.clear(t.COLOR_BUFFER_BIT);
2253
+ }
2254
+ let n = await createImageBitmap(e);
2255
+ s.postMessage({
2256
+ id: t,
2257
+ bitmap: n,
2258
+ width: e.width,
2259
+ height: e.height,
2260
+ dataURLOptions: i.dataURLOptions
2261
+ }, [n]);
2262
+ })), d = requestAnimationFrame(p);
2263
+ };
2264
+ d = requestAnimationFrame(p), this.resetObservers = () => {
2265
+ a(), cancelAnimationFrame(d);
2266
+ };
2267
+ }
2268
+ initCanvasMutationObserver(e, t, n) {
2269
+ this.startRAFTimestamping(), this.startPendingCanvasMutationFlusher();
2270
+ let r = hn(e, t, n, !1), i = pn(this.processMutation.bind(this), e, t, n), a = _n(this.processMutation.bind(this), e, t, n);
2271
+ this.resetObservers = () => {
2272
+ r(), i(), a();
2273
+ };
2274
+ }
2275
+ startPendingCanvasMutationFlusher() {
2276
+ requestAnimationFrame(() => this.flushPendingCanvasMutations());
2277
+ }
2278
+ startRAFTimestamping() {
2279
+ let e = (t) => {
2280
+ this.rafStamps.latestId = t, requestAnimationFrame(e);
2281
+ };
2282
+ requestAnimationFrame(e);
2283
+ }
2284
+ flushPendingCanvasMutations() {
2285
+ this.pendingCanvasMutations.forEach((e, t) => {
2286
+ let n = this.mirror.getId(t);
2287
+ this.flushPendingCanvasMutationFor(t, n);
2288
+ }), requestAnimationFrame(() => this.flushPendingCanvasMutations());
2289
+ }
2290
+ flushPendingCanvasMutationFor(e, t) {
2291
+ if (this.frozen || this.locked) return;
2292
+ let n = this.pendingCanvasMutations.get(e);
2293
+ if (!n || t === -1) return;
2294
+ let r = n.map((e) => {
2295
+ let { type: t, ...n } = e;
2296
+ return n;
2297
+ }), { type: i } = n[0];
2298
+ this.mutationCb({
2299
+ id: t,
2300
+ type: i,
2301
+ commands: r
2302
+ }), this.pendingCanvasMutations.delete(e);
2303
+ }
2304
+ }, Sn = class {
2305
+ constructor(e) {
2306
+ i(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet()), i(this, "mutationCb"), i(this, "adoptedStyleSheetCb"), i(this, "styleMirror", new yt()), this.mutationCb = e.mutationCb, this.adoptedStyleSheetCb = e.adoptedStyleSheetCb;
2307
+ }
2308
+ attachLinkElement(e, t) {
2309
+ "_cssText" in t.attributes && this.mutationCb({
2310
+ adds: [],
2311
+ removes: [],
2312
+ texts: [],
2313
+ attributes: [{
2314
+ id: t.id,
2315
+ attributes: t.attributes
2316
+ }]
2317
+ }), this.trackLinkElement(e);
2318
+ }
2319
+ trackLinkElement(e) {
2320
+ this.trackedLinkElements.has(e) || (this.trackedLinkElements.add(e), this.trackStylesheetInLinkElement(e));
2321
+ }
2322
+ adoptStyleSheets(e, t) {
2323
+ if (e.length === 0) return;
2324
+ let n = {
2325
+ id: t,
2326
+ styleIds: []
2327
+ }, r = [];
2328
+ for (let t of e) {
2329
+ let e;
2330
+ this.styleMirror.has(t) ? e = this.styleMirror.getId(t) : (e = this.styleMirror.add(t), r.push({
2331
+ styleId: e,
2332
+ rules: Array.from(t.rules || CSSRule, (e, n) => ({
2333
+ rule: le(e, t.href),
2334
+ index: n
2335
+ }))
2336
+ })), n.styleIds.push(e);
2337
+ }
2338
+ r.length > 0 && (n.styles = r), this.adoptedStyleSheetCb(n);
2339
+ }
2340
+ reset() {
2341
+ this.styleMirror.reset(), this.trackedLinkElements = /* @__PURE__ */ new WeakSet();
2342
+ }
2343
+ trackStylesheetInLinkElement(e) {}
2344
+ }, Cn = class {
2345
+ constructor() {
2346
+ i(this, "nodeMap", /* @__PURE__ */ new WeakMap()), i(this, "active", !1);
2347
+ }
2348
+ inOtherBuffer(e, t) {
2349
+ let n = this.nodeMap.get(e);
2350
+ return n && Array.from(n).some((e) => e !== t);
2351
+ }
2352
+ add(e, t) {
2353
+ this.active || (this.active = !0, requestAnimationFrame(() => {
2354
+ this.nodeMap = /* @__PURE__ */ new WeakMap(), this.active = !1;
2355
+ })), this.nodeMap.set(e, (this.nodeMap.get(e) || /* @__PURE__ */ new Set()).add(t));
2356
+ }
2357
+ destroy() {}
2358
+ }, Q, wn, Tn, En = !1;
2359
+ try {
2360
+ if (Array.from([1], (e) => e * 2)[0] !== 2) {
2361
+ let e = document.createElement("iframe");
2362
+ document.body.appendChild(e), Array.from = e.contentWindow?.Array.from || Array.from, document.body.removeChild(e);
2363
+ }
2364
+ } catch (e) {
2365
+ console.debug("Unable to override Array.from", e);
2366
+ }
2367
+ var $ = pe();
2368
+ function Dn(e = {}) {
2369
+ let { emit: t, checkoutEveryNms: n, checkoutEveryNth: r, blockClass: i = "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: te = /* @__PURE__ */ new Set([]), errorHandler: ne } = e;
2370
+ jt(ne);
2371
+ let re = !ee || window.parent === window, j = !1;
2372
+ if (!re) try {
2373
+ window.parent.document && (j = !1);
2374
+ } catch {
2375
+ j = !0;
2376
+ }
2377
+ if (re && !t) throw Error("emit function is required");
2378
+ if (!re && !j) return () => {};
2379
+ S !== void 0 && b.mousemove === void 0 && (b.mousemove = S), $.reset();
2380
+ let ie = p === !0 ? {
2381
+ color: !0,
2382
+ date: !0,
2383
+ "datetime-local": !0,
2384
+ email: !0,
2385
+ month: !0,
2386
+ number: !0,
2387
+ range: !0,
2388
+ search: !0,
2389
+ tel: !0,
2390
+ text: !0,
2391
+ time: !0,
2392
+ url: !0,
2393
+ week: !0,
2394
+ textarea: !0,
2395
+ select: !0,
2396
+ password: !0
2397
+ } : m === void 0 ? { password: !0 } : m, ae = tt(h);
2398
+ ht();
2399
+ let oe, N = 0, se = (e) => {
2400
+ for (let t of k || []) t.eventProcessor && (e = t.eventProcessor(e));
2401
+ return y && !j && (e = y(e)), e;
2402
+ };
2403
+ Q = (e, i) => {
2404
+ let s = e;
2405
+ if (s.timestamp = M(), Y[0]?.isFrozen() && s.type !== a.FullSnapshot && (s.type !== a.IncrementalSnapshot || s.data.source !== o.Mutation) && Y.forEach((e) => e.unfreeze()), re) t?.(se(s), i);
2406
+ else if (j) {
2407
+ let e = {
2408
+ type: "rrweb",
2409
+ event: se(s),
2410
+ origin: window.location.origin,
2411
+ isCheckout: i
2412
+ };
2413
+ window.parent.postMessage(e, "*");
2414
+ }
2415
+ if (s.type === a.FullSnapshot) oe = s, N = 0;
2416
+ else if (s.type === a.IncrementalSnapshot) {
2417
+ if (s.data.source === o.Mutation && s.data.isAttachIframe) return;
2418
+ N++;
2419
+ let e = r && N >= r, t = n && s.timestamp - oe.timestamp > n;
2420
+ (e || t) && wn(!0);
2421
+ }
2422
+ };
2423
+ let F = (e) => {
2424
+ Q({
2425
+ type: a.IncrementalSnapshot,
2426
+ data: {
2427
+ source: o.Mutation,
2428
+ ...e
2429
+ }
2430
+ });
2431
+ }, I = (e) => Q({
2432
+ type: a.IncrementalSnapshot,
2433
+ data: {
2434
+ source: o.Scroll,
2435
+ ...e
2436
+ }
2437
+ }), ce = (e) => Q({
2438
+ type: a.IncrementalSnapshot,
2439
+ data: {
2440
+ source: o.CanvasMutation,
2441
+ ...e
2442
+ }
2443
+ }), L = new Sn({
2444
+ mutationCb: F,
2445
+ adoptedStyleSheetCb: (e) => Q({
2446
+ type: a.IncrementalSnapshot,
2447
+ data: {
2448
+ source: o.AdoptedStyleSheet,
2449
+ ...e
2450
+ }
2451
+ })
2452
+ }), R = new tn({
2453
+ mirror: $,
2454
+ mutationCb: F,
2455
+ stylesheetManager: L,
2456
+ recordCrossOriginIframes: ee,
2457
+ wrappedEmit: Q
2458
+ });
2459
+ for (let e of k || []) e.getMirror && e.getMirror({
2460
+ nodeMirror: $,
2461
+ crossOriginIframeMirror: R.crossOriginIframeMirror,
2462
+ crossOriginIframeStyleMirror: R.crossOriginIframeStyleMirror
2463
+ });
2464
+ let le = new Cn();
2465
+ Tn = new xn({
2466
+ recordCanvas: w,
2467
+ mutationCb: ce,
2468
+ win: window,
2469
+ blockClass: i,
2470
+ blockSelector: s,
2471
+ mirror: $,
2472
+ sampling: b.canvas,
2473
+ dataURLOptions: x
2474
+ });
2475
+ let z = new nn({
2476
+ mutationCb: F,
2477
+ scrollCb: I,
2478
+ bypassOptions: {
2479
+ blockClass: i,
2480
+ blockSelector: s,
2481
+ maskTextClass: u,
2482
+ maskTextSelector: d,
2483
+ inlineStylesheet: f,
2484
+ maskInputOptions: ie,
2485
+ dataURLOptions: x,
2486
+ maskTextFn: _,
2487
+ maskInputFn: g,
2488
+ recordCanvas: w,
2489
+ inlineImages: O,
2490
+ sampling: b,
2491
+ slimDOMOptions: ae,
2492
+ iframeManager: R,
2493
+ stylesheetManager: L,
2494
+ canvasManager: Tn,
2495
+ keepIframeSrcFn: A,
2496
+ processedNodeManager: le
2497
+ },
2498
+ mirror: $
2499
+ });
2500
+ wn = (e = !1) => {
2501
+ if (!C) return;
2502
+ Q({
2503
+ type: a.Meta,
2504
+ data: {
2505
+ href: window.location.href,
2506
+ width: lt(),
2507
+ height: ct()
2508
+ }
2509
+ }, e), L.reset(), z.init(), Y.forEach((e) => e.lock());
2510
+ let t = rt(document, {
2511
+ mirror: $,
2512
+ blockClass: i,
2513
+ blockSelector: s,
2514
+ maskTextClass: u,
2515
+ maskTextSelector: d,
2516
+ inlineStylesheet: f,
2517
+ maskAllInputs: ie,
2518
+ maskTextFn: _,
2519
+ maskInputFn: g,
2520
+ slimDOM: ae,
2521
+ dataURLOptions: x,
2522
+ recordCanvas: w,
2523
+ inlineImages: O,
2524
+ onSerialize: (e) => {
2525
+ gt(e, $) && R.addIframe(e), _t(e, $) && L.trackLinkElement(e), vt(e) && z.addShadowRoot(P.shadowRoot(e), document);
2526
+ },
2527
+ onIframeLoad: (e, t) => {
2528
+ R.attachIframe(e, t), z.observeAttachShadow(e);
2529
+ },
2530
+ onStylesheetLoad: (e, t) => {
2531
+ L.attachLinkElement(e, t);
2532
+ },
2533
+ keepIframeSrcFn: A
2534
+ });
2535
+ if (!t) return console.warn("Failed to snapshot the document");
2536
+ Q({
2537
+ type: a.FullSnapshot,
2538
+ data: {
2539
+ node: t,
2540
+ initialOffset: st(window)
2541
+ }
2542
+ }, e), Y.forEach((e) => e.unlock()), document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0 && L.adoptStyleSheets(document.adoptedStyleSheets, $.getId(document));
2543
+ };
2544
+ try {
2545
+ let e = [], t = (e) => J(Zt)({
2546
+ mutationCb: F,
2547
+ mousemoveCb: (e, t) => Q({
2548
+ type: a.IncrementalSnapshot,
2549
+ data: {
2550
+ source: t,
2551
+ positions: e
2552
+ }
2553
+ }),
2554
+ mouseInteractionCb: (e) => Q({
2555
+ type: a.IncrementalSnapshot,
2556
+ data: {
2557
+ source: o.MouseInteraction,
2558
+ ...e
2559
+ }
2560
+ }),
2561
+ scrollCb: I,
2562
+ viewportResizeCb: (e) => Q({
2563
+ type: a.IncrementalSnapshot,
2564
+ data: {
2565
+ source: o.ViewportResize,
2566
+ ...e
2567
+ }
2568
+ }),
2569
+ inputCb: (e) => Q({
2570
+ type: a.IncrementalSnapshot,
2571
+ data: {
2572
+ source: o.Input,
2573
+ ...e
2574
+ }
2575
+ }),
2576
+ mediaInteractionCb: (e) => Q({
2577
+ type: a.IncrementalSnapshot,
2578
+ data: {
2579
+ source: o.MediaInteraction,
2580
+ ...e
2581
+ }
2582
+ }),
2583
+ styleSheetRuleCb: (e) => Q({
2584
+ type: a.IncrementalSnapshot,
2585
+ data: {
2586
+ source: o.StyleSheetRule,
2587
+ ...e
2588
+ }
2589
+ }),
2590
+ styleDeclarationCb: (e) => Q({
2591
+ type: a.IncrementalSnapshot,
2592
+ data: {
2593
+ source: o.StyleDeclaration,
2594
+ ...e
2595
+ }
2596
+ }),
2597
+ canvasMutationCb: ce,
2598
+ fontCb: (e) => Q({
2599
+ type: a.IncrementalSnapshot,
2600
+ data: {
2601
+ source: o.Font,
2602
+ ...e
2603
+ }
2604
+ }),
2605
+ selectionCb: (e) => {
2606
+ Q({
2607
+ type: a.IncrementalSnapshot,
2608
+ data: {
2609
+ source: o.Selection,
2610
+ ...e
2611
+ }
2612
+ });
2613
+ },
2614
+ customElementCb: (e) => {
2615
+ Q({
2616
+ type: a.IncrementalSnapshot,
2617
+ data: {
2618
+ source: o.CustomElement,
2619
+ ...e
2620
+ }
2621
+ });
2622
+ },
2623
+ blockClass: i,
2624
+ ignoreClass: c,
2625
+ ignoreSelector: l,
2626
+ maskTextClass: u,
2627
+ maskTextSelector: d,
2628
+ maskInputOptions: ie,
2629
+ inlineStylesheet: f,
2630
+ sampling: b,
2631
+ recordDOM: C,
2632
+ recordCanvas: w,
2633
+ inlineImages: O,
2634
+ userTriggeredOnInput: E,
2635
+ collectFonts: D,
2636
+ doc: e,
2637
+ maskInputFn: g,
2638
+ maskTextFn: _,
2639
+ keepIframeSrcFn: A,
2640
+ blockSelector: s,
2641
+ slimDOMOptions: ae,
2642
+ dataURLOptions: x,
2643
+ mirror: $,
2644
+ iframeManager: R,
2645
+ stylesheetManager: L,
2646
+ shadowDomManager: z,
2647
+ processedNodeManager: le,
2648
+ canvasManager: Tn,
2649
+ ignoreCSSAttributes: te,
2650
+ plugins: (k?.filter((e) => e.observer))?.map((e) => ({
2651
+ observer: e.observer,
2652
+ options: e.options,
2653
+ callback: (t) => Q({
2654
+ type: a.Plugin,
2655
+ data: {
2656
+ plugin: e.name,
2657
+ payload: t
2658
+ }
2659
+ })
2660
+ })) || []
2661
+ }, v);
2662
+ R.addLoadListener((n) => {
2663
+ try {
2664
+ e.push(t(n.contentDocument));
2665
+ } catch (e) {
2666
+ console.warn(e);
2667
+ }
2668
+ });
2669
+ let n = () => {
2670
+ wn(), e.push(t(document)), En = !0;
2671
+ };
2672
+ return ["interactive", "complete"].includes(document.readyState) ? n() : (e.push(W("DOMContentLoaded", () => {
2673
+ Q({
2674
+ type: a.DomContentLoaded,
2675
+ data: {}
2676
+ }), T === "DOMContentLoaded" && n();
2677
+ })), e.push(W("load", () => {
2678
+ Q({
2679
+ type: a.Load,
2680
+ data: {}
2681
+ }), T === "load" && n();
2682
+ }, window))), () => {
2683
+ e.forEach((e) => {
2684
+ try {
2685
+ e();
2686
+ } catch (e) {
2687
+ String(e).toLowerCase().includes("cross-origin") || console.warn(e);
2688
+ }
2689
+ }), le.destroy(), En = !1, Mt();
2690
+ };
2691
+ } catch (e) {
2692
+ console.warn(e);
2693
+ }
2694
+ }
2695
+ Dn.addCustomEvent = (e, t) => {
2696
+ if (!En) throw Error("please add custom event after start recording");
2697
+ Q({
2698
+ type: a.Custom,
2699
+ data: {
2700
+ tag: e,
2701
+ payload: t
2702
+ }
2703
+ });
2704
+ }, Dn.freezePage = () => {
2705
+ Y.forEach((e) => e.freeze());
2706
+ }, Dn.takeFullSnapshot = (e) => {
2707
+ if (!En) throw Error("please take full snapshot after start recording");
2708
+ wn(e);
2709
+ }, Dn.mirror = $;
2710
+ var On = class {
2711
+ constructor(e = 3e4, t = Date.now, n = 5e4) {
2712
+ this.windowMs = e, this.now = t, this.maxEvents = n, this.segments = [];
2713
+ }
2714
+ push(e) {
2715
+ e.type !== 4 && this.segments.length || this.segments.push([]), this.segments[this.segments.length - 1].push(e), this.trim();
2716
+ }
2717
+ trim() {
2718
+ let e = this.now() - this.windowMs;
2719
+ for (; this.segments.length > 1 && (this.segments[1][0]?.timestamp ?? Infinity) <= e;) this.segments.shift();
2720
+ for (; this.segments.length > 1 && this.count() > this.maxEvents;) this.segments.shift();
2721
+ }
2722
+ count() {
2723
+ let e = 0;
2724
+ for (let t of this.segments) e += t.length;
2725
+ return e;
2726
+ }
2727
+ events(e = Infinity) {
2728
+ this.trim();
2729
+ let t = Math.max(0, this.segments.length - e);
2730
+ return this.segments.slice(t).flat();
2731
+ }
2732
+ get segmentCount() {
2733
+ return this.segments.length;
2734
+ }
2735
+ clear() {
2736
+ this.segments = [];
2737
+ }
2738
+ };
2739
+ function kn(e) {
2740
+ let t = "", n = 32768;
2741
+ for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
2742
+ return btoa(t);
2743
+ }
2744
+ async function An(e) {
2745
+ if (typeof CompressionStream != "function") return null;
2746
+ try {
2747
+ let t = new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));
2748
+ return new Uint8Array(await new Response(t).arrayBuffer());
2749
+ } catch {
2750
+ return null;
2751
+ }
2752
+ }
2753
+ // src/replay/sanitize.ts
2754
+ var jn = /* @__PURE__ */ new Set([
2755
+ "href",
2756
+ "src",
2757
+ "action",
2758
+ "formaction",
2759
+ "poster",
2760
+ "cite",
2761
+ "data",
2762
+ "background",
2763
+ "longdesc",
2764
+ "ping",
2765
+ "xlink:href"
2766
+ ]), Mn = (e) => e === "style" || e === "_cssText" || e.startsWith("rr_");
2767
+ function Nn(n, r) {
2768
+ let i = n.trim();
2769
+ return !i || /^(data|blob):/i.test(i) ? n : i.startsWith("#") ? "#" : e(t(i, r));
2770
+ }
2771
+ function Pn(e, t) {
2772
+ return e.split(",").map((e) => {
2773
+ let [n, ...r] = e.trim().split(/\s+/);
2774
+ return n ? [Nn(n, t), ...r].join(" ") : e;
2775
+ }).join(", ");
2776
+ }
2777
+ function Fn(t, n, r) {
2778
+ let i = {}, a = n?.toLowerCase() === "input" && String(t.type ?? "").toLowerCase() === "hidden";
2779
+ for (let n in t) {
2780
+ let o = t[n], s = n.toLowerCase();
2781
+ a && s === "value" || (i[n] = typeof o != "string" || Mn(s) ? o : jn.has(s) ? Nn(o, r) : s === "srcset" ? Pn(o, r) : e(o));
2782
+ }
2783
+ return i;
2784
+ }
2785
+ function In(e, t = typeof location > "u" ? void 0 : location.href) {
2786
+ return JSON.stringify(e, function(e, n) {
2787
+ if (e === "attributes" && n && typeof n == "object" && !Array.isArray(n)) return Fn(n, this.tagName, t);
2788
+ if (e === "data" && this.type === 4 && n && typeof n == "object" && typeof n.href == "string") {
2789
+ let e = n;
2790
+ return {
2791
+ ...e,
2792
+ href: Nn(e.href, t)
2793
+ };
2794
+ }
2795
+ return n;
2796
+ });
2797
+ }
2798
+ // src/replay/recorder.ts
2799
+ var Ln = 3e4, Rn = 1e4, zn = "[contenteditable]:not([contenteditable=false])";
2800
+ function Bn(t = {}) {
2801
+ let n = new On(Ln), r = Dn({
2802
+ emit: (e) => {
2803
+ try {
2804
+ n.push(e);
2805
+ } catch {}
2806
+ },
2807
+ checkoutEveryNms: Rn,
2808
+ maskAllInputs: !0,
2809
+ blockClass: "pinax-mask",
2810
+ blockSelector: [
2811
+ "[data-pinax-mask]",
2812
+ "input[type=hidden]",
2813
+ t.exclude
2814
+ ].filter(Boolean).join(","),
2815
+ maskTextClass: "pinax-mask",
2816
+ maskTextSelector: "*",
2817
+ maskTextFn: (t, n) => {
2818
+ try {
2819
+ return n?.closest?.(`${zn},[data-pinax-mask],.pinax-mask`) ? t.replace(/\S/g, "*") : e(t);
2820
+ } catch {
2821
+ return t.replace(/\S/g, "*");
2822
+ }
2823
+ },
2824
+ slimDOMOptions: "all",
2825
+ recordCanvas: !1,
2826
+ collectFonts: !1,
2827
+ inlineImages: !1,
2828
+ sampling: {
2829
+ mousemove: 50,
2830
+ scroll: 150,
2831
+ media: 800,
2832
+ input: "last"
2833
+ },
2834
+ errorHandler: () => !0
2835
+ });
2836
+ return {
2837
+ async exportReplay(e) {
2838
+ let t = n.segmentCount;
2839
+ for (let r = t; r >= 1; r--) {
2840
+ let t = n.events(r);
2841
+ if (!t.length) return null;
2842
+ let i = await An(In(t));
2843
+ if (!i) return null;
2844
+ let a = kn(i);
2845
+ if (a.length <= e) return a;
2846
+ }
2847
+ return null;
2848
+ },
2849
+ stop() {
2850
+ try {
2851
+ r?.();
2852
+ } catch {}
2853
+ n.clear();
2854
+ }
2855
+ };
2856
+ }
2857
+ export { Rn as CHECKOUT_MS, Ln as WINDOW_MS, Bn as startRecorder };
2858
+
2859
+ //# sourceMappingURL=recorder-BUtEB_em.mjs.map