@ansidev-oss/vitepress-theme-ansidev 1.0.12 → 1.2.0

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