@wf-financing/ui 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1225 +0,0 @@
1
- import { s as O, C as b, b as Tt, i as j, g as V, N as S, P as q, S as Et, a as G, c as yt, d as Nt, e as J, r as wt, f as Mt, h as vt, j as It, k as Q, t as M, l as Z, m as tt, n as A, o as C, p as et, q as v, u as nt, v as st, w as Rt, x as Ct, y as R, z as D, R as xt, A as bt, B as x, D as _t, E as Dt, F as Lt, G as At, H as zt, I as Ot, J as Vt, K as Pt, L as kt, M as Ft, O as Bt, Q as Ut, T as Ht, U as Gt, V as Wt, W as Yt, X as $t, Y as Xt } from "./index-DgBzPfcG.mjs";
2
- const P = /* @__PURE__ */ new WeakMap();
3
- function w(t) {
4
- return P.has(t);
5
- }
6
- function Kt(t) {
7
- let n = t;
8
- for (; n; ) {
9
- if (!w(n) && !j(n))
10
- return !1;
11
- n = V(n);
12
- }
13
- return !0;
14
- }
15
- function g(t) {
16
- return P.get(t);
17
- }
18
- function jt(t, n) {
19
- P.set(t, n);
20
- }
21
- function k(t, n) {
22
- const e = t.tagName, o = t.value;
23
- if (O(t, n)) {
24
- const s = t.type;
25
- return e === "INPUT" && (s === "button" || s === "submit" || s === "reset") ? o : !o || e === "OPTION" ? void 0 : b;
26
- }
27
- if (e === "OPTION" || e === "SELECT")
28
- return t.value;
29
- if (!(e !== "INPUT" && e !== "TEXTAREA"))
30
- return o;
31
- }
32
- const qt = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm, Jt = /^[A-Za-z]+:|^\/\//, Qt = /^["']?data:.*,/i;
33
- function Zt(t, n) {
34
- return t.replace(qt, (e, o, s, r, a, i) => {
35
- const u = s || a || i;
36
- if (!n || !u || Jt.test(u) || Qt.test(u))
37
- return e;
38
- const f = o || r || "";
39
- return `url(${f}${te(u, n)}${f})`;
40
- });
41
- }
42
- function te(t, n) {
43
- try {
44
- return Tt(t, n).href;
45
- } catch {
46
- return t;
47
- }
48
- }
49
- const ee = /[^a-z1-6-_]/;
50
- function ot(t) {
51
- const n = t.toLowerCase().trim();
52
- return ee.test(n) ? "div" : n;
53
- }
54
- function W(t, n) {
55
- return `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' style='background-color:silver'%3E%3C/svg%3E`;
56
- }
57
- const N = {
58
- FullSnapshot: 2,
59
- IncrementalSnapshot: 3,
60
- Meta: 4,
61
- Focus: 6,
62
- ViewEnd: 7,
63
- VisualViewport: 8,
64
- FrustrationRecord: 9
65
- }, I = {
66
- Document: 0,
67
- DocumentType: 1,
68
- Element: 2,
69
- Text: 3,
70
- CDATA: 4,
71
- DocumentFragment: 11
72
- }, T = {
73
- Mutation: 0,
74
- MouseMove: 1,
75
- MouseInteraction: 2,
76
- Scroll: 3,
77
- ViewportResize: 4,
78
- Input: 5,
79
- TouchMove: 6,
80
- MediaInteraction: 7,
81
- StyleSheetRule: 8
82
- // CanvasMutation : 9,
83
- // Font : 10,
84
- }, E = {
85
- MouseUp: 0,
86
- MouseDown: 1,
87
- Click: 2,
88
- ContextMenu: 3,
89
- DblClick: 4,
90
- Focus: 5,
91
- Blur: 6,
92
- TouchStart: 7,
93
- TouchEnd: 9
94
- }, Y = {
95
- Play: 0,
96
- Pause: 1
97
- };
98
- function rt(t) {
99
- if (!(t === void 0 || t.length === 0))
100
- return t.map((n) => {
101
- const e = n.cssRules || n.rules;
102
- return {
103
- cssRules: Array.from(e, (r) => r.cssText),
104
- disabled: n.disabled || void 0,
105
- media: n.media.length > 0 ? Array.from(n.media) : void 0
106
- };
107
- });
108
- }
109
- const ne = 1e6;
110
- function it(t, n, e, o) {
111
- if (n === S.HIDDEN)
112
- return null;
113
- const s = t.getAttribute(e);
114
- if (n === S.MASK && e !== q && !Et.includes(e) && e !== o.actionNameAttribute) {
115
- const r = t.tagName;
116
- switch (e) {
117
- // Mask Attribute text content
118
- case "title":
119
- case "alt":
120
- case "placeholder":
121
- return b;
122
- }
123
- if (r === "IMG" && (e === "src" || e === "srcset")) {
124
- const a = t;
125
- if (a.naturalWidth > 0)
126
- return W(a.naturalWidth, a.naturalHeight);
127
- const { width: i, height: u } = t.getBoundingClientRect();
128
- return i > 0 || u > 0 ? W(i, u) : G;
129
- }
130
- if (r === "SOURCE" && (e === "src" || e === "srcset"))
131
- return G;
132
- if (r === "A" && e === "href")
133
- return b;
134
- if (s && e.startsWith("data-"))
135
- return b;
136
- if (r === "IFRAME" && e === "srcdoc")
137
- return b;
138
- }
139
- return !s || typeof s != "string" ? s : yt(s, ne);
140
- }
141
- function F() {
142
- return {
143
- cssText: {
144
- count: 0,
145
- max: 0,
146
- sum: 0
147
- },
148
- serializationDuration: {
149
- count: 0,
150
- max: 0,
151
- sum: 0
152
- }
153
- };
154
- }
155
- function L(t, n, e) {
156
- t[n].count += 1, t[n].max = Math.max(t[n].max, e), t[n].sum += e;
157
- }
158
- function se(t, n) {
159
- for (const e of ["cssText", "serializationDuration"])
160
- t[e].count += n[e].count, t[e].max = Math.max(t[e].max, n[e].max), t[e].sum += n[e].sum;
161
- }
162
- function oe(t, n, e) {
163
- if (n === S.HIDDEN)
164
- return {};
165
- const o = {}, s = ot(t.tagName), r = t.ownerDocument;
166
- for (let c = 0; c < t.attributes.length; c += 1) {
167
- const l = t.attributes.item(c).name, m = it(t, n, l, e.configuration);
168
- m !== null && (o[l] = m);
169
- }
170
- if (t.value && (s === "textarea" || s === "select" || s === "option" || s === "input")) {
171
- const c = k(t, n);
172
- c !== void 0 && (o.value = c);
173
- }
174
- if (s === "option" && n === S.ALLOW) {
175
- const c = t;
176
- c.selected && (o.selected = c.selected);
177
- }
178
- if (s === "link") {
179
- const c = Array.from(r.styleSheets).find((l) => l.href === t.href), d = z(c);
180
- d && c && (L(e.serializationContext.serializationStats, "cssText", d.length), o._cssText = d);
181
- }
182
- if (s === "style" && t.sheet) {
183
- const c = z(t.sheet);
184
- c && (L(e.serializationContext.serializationStats, "cssText", c.length), o._cssText = c);
185
- }
186
- const a = t;
187
- if (s === "input" && (a.type === "radio" || a.type === "checkbox") && (n === S.ALLOW ? o.checked = !!a.checked : O(a, n) && delete o.checked), s === "audio" || s === "video") {
188
- const c = t;
189
- o.rr_mediaState = c.paused ? "paused" : "played";
190
- }
191
- let i, u;
192
- const f = e.serializationContext;
193
- switch (f.status) {
194
- case 0:
195
- i = Math.round(t.scrollTop), u = Math.round(t.scrollLeft), (i || u) && f.elementsScrollPositions.set(t, { scrollTop: i, scrollLeft: u });
196
- break;
197
- case 1:
198
- f.elementsScrollPositions.has(t) && ({ scrollTop: i, scrollLeft: u } = f.elementsScrollPositions.get(t));
199
- break;
200
- }
201
- return u && (o.rr_scrollLeft = u), i && (o.rr_scrollTop = i), o;
202
- }
203
- function z(t) {
204
- if (!t)
205
- return null;
206
- let n;
207
- try {
208
- n = t.rules || t.cssRules;
209
- } catch {
210
- }
211
- if (!n)
212
- return null;
213
- const e = Array.from(n, Nt() ? re : at).join("");
214
- return Zt(e, t.href);
215
- }
216
- function re(t) {
217
- if (ae(t) && t.selectorText.includes(":")) {
218
- const n = /(\[[\w-]+[^\\])(:[^\]]+\])/g;
219
- return t.cssText.replace(n, "$1\\$2");
220
- }
221
- return at(t);
222
- }
223
- function at(t) {
224
- return ie(t) && z(t.styleSheet) || t.cssText;
225
- }
226
- function ie(t) {
227
- return "styleSheet" in t;
228
- }
229
- function ae(t) {
230
- return "selectorText" in t;
231
- }
232
- function B(t, n) {
233
- const e = le(t, n);
234
- if (!e)
235
- return null;
236
- const o = g(t) || ce(), s = e;
237
- return s.id = o, jt(t, o), n.serializedNodeIds && n.serializedNodeIds.add(o), s;
238
- }
239
- let ue = 1;
240
- function ce() {
241
- return ue++;
242
- }
243
- function U(t, n) {
244
- const e = [];
245
- return Q(t, (o) => {
246
- const s = B(o, n);
247
- s && e.push(s);
248
- }), e;
249
- }
250
- function le(t, n) {
251
- switch (t.nodeType) {
252
- case t.DOCUMENT_NODE:
253
- return de(t, n);
254
- case t.DOCUMENT_FRAGMENT_NODE:
255
- return fe(t, n);
256
- case t.DOCUMENT_TYPE_NODE:
257
- return pe(t);
258
- case t.ELEMENT_NODE:
259
- return he(t, n);
260
- case t.TEXT_NODE:
261
- return Se(t, n);
262
- case t.CDATA_SECTION_NODE:
263
- return ge();
264
- }
265
- }
266
- function de(t, n) {
267
- return {
268
- type: I.Document,
269
- childNodes: U(t, n),
270
- adoptedStyleSheets: rt(t.adoptedStyleSheets)
271
- };
272
- }
273
- function fe(t, n) {
274
- const e = j(t);
275
- return e && n.serializationContext.shadowRootsController.addShadowRoot(t), {
276
- type: I.DocumentFragment,
277
- childNodes: U(t, n),
278
- isShadowRoot: e,
279
- adoptedStyleSheets: e ? rt(t.adoptedStyleSheets) : void 0
280
- };
281
- }
282
- function pe(t) {
283
- return {
284
- type: I.DocumentType,
285
- name: t.name,
286
- publicId: t.publicId,
287
- systemId: t.systemId
288
- };
289
- }
290
- function he(t, n) {
291
- const e = ot(t.tagName), o = me(t) || void 0, s = wt(Mt(t), n.parentNodePrivacyLevel);
292
- if (s === S.HIDDEN) {
293
- const { width: i, height: u } = t.getBoundingClientRect();
294
- return {
295
- type: I.Element,
296
- tagName: e,
297
- attributes: {
298
- rr_width: `${i}px`,
299
- rr_height: `${u}px`,
300
- [q]: vt
301
- },
302
- childNodes: [],
303
- isSVG: o
304
- };
305
- }
306
- if (s === S.IGNORE)
307
- return;
308
- const r = oe(t, s, n);
309
- let a = [];
310
- if (It(t) && // Do not serialize style children as the css rules are already in the _cssText attribute
311
- e !== "style") {
312
- let i;
313
- n.parentNodePrivacyLevel === s && n.ignoreWhiteSpace === (e === "head") ? i = n : i = {
314
- ...n,
315
- parentNodePrivacyLevel: s,
316
- ignoreWhiteSpace: e === "head"
317
- }, a = U(t, i);
318
- }
319
- return {
320
- type: I.Element,
321
- tagName: e,
322
- attributes: r,
323
- childNodes: a,
324
- isSVG: o
325
- };
326
- }
327
- function me(t) {
328
- return t.tagName === "svg" || t instanceof SVGElement;
329
- }
330
- function Se(t, n) {
331
- const e = J(t, n.ignoreWhiteSpace || !1, n.parentNodePrivacyLevel);
332
- if (e !== void 0)
333
- return {
334
- type: I.Text,
335
- textContent: e
336
- };
337
- }
338
- function ge() {
339
- return {
340
- type: I.CDATA,
341
- textContent: ""
342
- };
343
- }
344
- function Te(t, n, e) {
345
- const o = M(), s = B(t, {
346
- serializationContext: e,
347
- parentNodePrivacyLevel: n.defaultPrivacyLevel,
348
- configuration: n
349
- });
350
- return L(e.serializationStats, "serializationDuration", Z(o, M())), s;
351
- }
352
- function ut(t) {
353
- return !!t.changedTouches;
354
- }
355
- function _(t) {
356
- return t.composed === !0 && tt(t.target) ? t.composedPath()[0] : t.target;
357
- }
358
- const $ = 25;
359
- function Ee(t) {
360
- return Math.abs(t.pageTop - t.offsetTop - window.scrollY) > $ || Math.abs(t.pageLeft - t.offsetLeft - window.scrollX) > $;
361
- }
362
- const ye = (t, n) => {
363
- const e = window.visualViewport, o = {
364
- layoutViewportX: t,
365
- layoutViewportY: n,
366
- visualViewportX: t,
367
- visualViewportY: n
368
- };
369
- if (e)
370
- Ee(e) ? (o.layoutViewportX = Math.round(t + e.offsetLeft), o.layoutViewportY = Math.round(n + e.offsetTop)) : (o.visualViewportX = Math.round(t - e.offsetLeft), o.visualViewportY = Math.round(n - e.offsetTop));
371
- else return o;
372
- return o;
373
- }, ct = (t) => ({
374
- scale: t.scale,
375
- offsetLeft: t.offsetLeft,
376
- offsetTop: t.offsetTop,
377
- pageLeft: t.pageLeft,
378
- pageTop: t.pageTop,
379
- height: t.height,
380
- width: t.width
381
- });
382
- function y(t, n) {
383
- return {
384
- data: {
385
- source: t,
386
- ...n
387
- },
388
- type: N.IncrementalSnapshot,
389
- timestamp: M()
390
- };
391
- }
392
- const Ne = 50;
393
- function we(t, n) {
394
- const { throttled: e, cancel: o } = A((r) => {
395
- const a = _(r);
396
- if (w(a)) {
397
- const i = lt(r);
398
- if (!i)
399
- return;
400
- const u = {
401
- id: g(a),
402
- timeOffset: 0,
403
- x: i.x,
404
- y: i.y
405
- };
406
- n(y(ut(r) ? T.TouchMove : T.MouseMove, { positions: [u] }));
407
- }
408
- }, Ne, {
409
- trailing: !1
410
- }), { stop: s } = C(t, document, [
411
- "mousemove",
412
- "touchmove"
413
- /* DOM_EVENT.TOUCH_MOVE */
414
- ], e, {
415
- capture: !0,
416
- passive: !0
417
- });
418
- return {
419
- stop: () => {
420
- s(), o();
421
- }
422
- };
423
- }
424
- function lt(t) {
425
- let { clientX: n, clientY: e } = ut(t) ? t.changedTouches[0] : t;
426
- if (window.visualViewport) {
427
- const { visualViewportX: o, visualViewportY: s } = ye(n, e);
428
- n = o, e = s;
429
- }
430
- if (!Number.isFinite(n) || !Number.isFinite(e)) {
431
- t.isTrusted && et("mouse/touch event without x/y");
432
- return;
433
- }
434
- return { x: n, y: e };
435
- }
436
- const X = {
437
- // Listen for pointerup DOM events instead of mouseup for MouseInteraction/MouseUp records. This
438
- // allows to reference such records from Frustration records.
439
- //
440
- // In the context of supporting Mobile Session Replay, we introduced `PointerInteraction` records
441
- // used by the Mobile SDKs in place of `MouseInteraction`. In the future, we should replace
442
- // `MouseInteraction` by `PointerInteraction` in the Browser SDK so we have an uniform way to
443
- // convey such interaction. This would cleanly solve the issue since we would have
444
- // `PointerInteraction/Up` records that we could reference from `Frustration` records.
445
- pointerup: E.MouseUp,
446
- mousedown: E.MouseDown,
447
- click: E.Click,
448
- contextmenu: E.ContextMenu,
449
- dblclick: E.DblClick,
450
- focus: E.Focus,
451
- blur: E.Blur,
452
- touchstart: E.TouchStart,
453
- touchend: E.TouchEnd
454
- };
455
- function Me(t, n, e) {
456
- const o = (s) => {
457
- const r = _(s);
458
- if (v(r, t.defaultPrivacyLevel) === S.HIDDEN || !w(r))
459
- return;
460
- const a = g(r), i = X[s.type];
461
- let u;
462
- if (i !== E.Blur && i !== E.Focus) {
463
- const c = lt(s);
464
- if (!c)
465
- return;
466
- u = { id: a, type: i, x: c.x, y: c.y };
467
- } else
468
- u = { id: a, type: i };
469
- const f = {
470
- id: e.getIdForEvent(s),
471
- ...y(T.MouseInteraction, u)
472
- };
473
- n(f);
474
- };
475
- return C(t, document, Object.keys(X), o, {
476
- capture: !0,
477
- passive: !0
478
- });
479
- }
480
- const ve = 100;
481
- function dt(t, n, e, o = document) {
482
- const { throttled: s, cancel: r } = A((i) => {
483
- const u = _(i);
484
- if (!u || v(u, t.defaultPrivacyLevel) === S.HIDDEN || !w(u))
485
- return;
486
- const f = g(u), c = u === document ? {
487
- scrollTop: nt(),
488
- scrollLeft: st()
489
- } : {
490
- scrollTop: Math.round(u.scrollTop),
491
- scrollLeft: Math.round(u.scrollLeft)
492
- };
493
- e.set(u, c), n(y(T.Scroll, {
494
- id: f,
495
- x: c.scrollLeft,
496
- y: c.scrollTop
497
- }));
498
- }, ve), { stop: a } = Rt(t, o, "scroll", s, {
499
- capture: !0,
500
- passive: !0
501
- });
502
- return {
503
- stop: () => {
504
- a(), r();
505
- }
506
- };
507
- }
508
- const Ie = 200;
509
- function Re(t, n) {
510
- const e = Ct(t).subscribe((o) => {
511
- n(y(T.ViewportResize, o));
512
- });
513
- return {
514
- stop: () => {
515
- e.unsubscribe();
516
- }
517
- };
518
- }
519
- function Ce(t, n) {
520
- const e = window.visualViewport;
521
- if (!e)
522
- return { stop: R };
523
- const { throttled: o, cancel: s } = A(() => {
524
- n({
525
- data: ct(e),
526
- type: N.VisualViewport,
527
- timestamp: M()
528
- });
529
- }, Ie, {
530
- trailing: !1
531
- }), { stop: r } = C(t, e, [
532
- "resize",
533
- "scroll"
534
- /* DOM_EVENT.SCROLL */
535
- ], o, {
536
- capture: !0,
537
- passive: !0
538
- });
539
- return {
540
- stop: () => {
541
- r(), s();
542
- }
543
- };
544
- }
545
- function xe(t, n) {
546
- return C(t, document, [
547
- "play",
548
- "pause"
549
- /* DOM_EVENT.PAUSE */
550
- ], (e) => {
551
- const o = _(e);
552
- !o || v(o, t.defaultPrivacyLevel) === S.HIDDEN || !w(o) || n(y(T.MediaInteraction, {
553
- id: g(o),
554
- type: e.type === "play" ? Y.Play : Y.Pause
555
- }));
556
- }, {
557
- capture: !0,
558
- passive: !0
559
- });
560
- }
561
- function be(t) {
562
- function n(s, r) {
563
- s && w(s.ownerNode) && r(g(s.ownerNode));
564
- }
565
- const e = [
566
- D(CSSStyleSheet.prototype, "insertRule", ({ target: s, parameters: [r, a] }) => {
567
- n(s, (i) => t(y(T.StyleSheetRule, {
568
- id: i,
569
- adds: [{ rule: r, index: a }]
570
- })));
571
- }),
572
- D(CSSStyleSheet.prototype, "deleteRule", ({ target: s, parameters: [r] }) => {
573
- n(s, (a) => t(y(T.StyleSheetRule, {
574
- id: a,
575
- removes: [{ index: r }]
576
- })));
577
- })
578
- ];
579
- typeof CSSGroupingRule < "u" ? o(CSSGroupingRule) : (o(CSSMediaRule), o(CSSSupportsRule));
580
- function o(s) {
581
- e.push(D(s.prototype, "insertRule", ({ target: r, parameters: [a, i] }) => {
582
- n(r.parentStyleSheet, (u) => {
583
- const f = K(r);
584
- f && (f.push(i || 0), t(y(T.StyleSheetRule, {
585
- id: u,
586
- adds: [{ rule: a, index: f }]
587
- })));
588
- });
589
- }), D(s.prototype, "deleteRule", ({ target: r, parameters: [a] }) => {
590
- n(r.parentStyleSheet, (i) => {
591
- const u = K(r);
592
- u && (u.push(a), t(y(T.StyleSheetRule, {
593
- id: i,
594
- removes: [{ index: u }]
595
- })));
596
- });
597
- }));
598
- }
599
- return {
600
- stop: () => {
601
- e.forEach((s) => s.stop());
602
- }
603
- };
604
- }
605
- function K(t) {
606
- const n = [];
607
- let e = t;
608
- for (; e.parentRule; ) {
609
- const a = Array.from(e.parentRule.cssRules).indexOf(e);
610
- n.unshift(a), e = e.parentRule;
611
- }
612
- if (!e.parentStyleSheet)
613
- return;
614
- const s = Array.from(e.parentStyleSheet.cssRules).indexOf(e);
615
- return n.unshift(s), n;
616
- }
617
- function _e(t, n) {
618
- return C(t, window, [
619
- "focus",
620
- "blur"
621
- /* DOM_EVENT.BLUR */
622
- ], () => {
623
- n({
624
- data: { has_focus: document.hasFocus() },
625
- type: N.Focus,
626
- timestamp: M()
627
- });
628
- });
629
- }
630
- function De(t, n, e) {
631
- const o = t.subscribe(12, (s) => {
632
- var r, a;
633
- s.rawRumEvent.type === xt.ACTION && s.rawRumEvent.action.type === bt.CLICK && (!((a = (r = s.rawRumEvent.action.frustration) === null || r === void 0 ? void 0 : r.type) === null || a === void 0) && a.length) && "events" in s.domainContext && s.domainContext.events && s.domainContext.events.length && n({
634
- timestamp: s.rawRumEvent.date,
635
- type: N.FrustrationRecord,
636
- data: {
637
- frustrationTypes: s.rawRumEvent.action.frustration.type,
638
- recordIds: s.domainContext.events.map((i) => e.getIdForEvent(i))
639
- }
640
- });
641
- });
642
- return {
643
- stop: () => {
644
- o.unsubscribe();
645
- }
646
- };
647
- }
648
- function Le(t, n) {
649
- const e = t.subscribe(5, () => {
650
- n({
651
- timestamp: M(),
652
- type: N.ViewEnd
653
- });
654
- });
655
- return {
656
- stop: () => {
657
- e.unsubscribe();
658
- }
659
- };
660
- }
661
- function ft(t, n, e = document) {
662
- const o = t.defaultPrivacyLevel, s = /* @__PURE__ */ new WeakMap(), r = e !== document, { stop: a } = C(
663
- t,
664
- e,
665
- // The 'input' event bubbles across shadow roots, so we don't have to listen for it on shadow
666
- // roots since it will be handled by the event listener that we did add to the document. Only
667
- // the 'change' event is blocked and needs to be handled on shadow roots.
668
- r ? [
669
- "change"
670
- /* DOM_EVENT.CHANGE */
671
- ] : [
672
- "input",
673
- "change"
674
- /* DOM_EVENT.CHANGE */
675
- ],
676
- (c) => {
677
- const d = _(c);
678
- (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement || d instanceof HTMLSelectElement) && u(d);
679
- },
680
- {
681
- capture: !0,
682
- passive: !0
683
- }
684
- );
685
- let i;
686
- if (r)
687
- i = R;
688
- else {
689
- const c = [
690
- x(HTMLInputElement.prototype, "value", u),
691
- x(HTMLInputElement.prototype, "checked", u),
692
- x(HTMLSelectElement.prototype, "value", u),
693
- x(HTMLTextAreaElement.prototype, "value", u),
694
- x(HTMLSelectElement.prototype, "selectedIndex", u)
695
- ];
696
- i = () => {
697
- c.forEach((d) => d.stop());
698
- };
699
- }
700
- return {
701
- stop: () => {
702
- i(), a();
703
- }
704
- };
705
- function u(c) {
706
- const d = v(c, o);
707
- if (d === S.HIDDEN)
708
- return;
709
- const l = c.type;
710
- let m;
711
- if (l === "radio" || l === "checkbox") {
712
- if (O(c, d))
713
- return;
714
- m = { isChecked: c.checked };
715
- } else {
716
- const p = k(c, d);
717
- if (p === void 0)
718
- return;
719
- m = { text: p };
720
- }
721
- f(c, m);
722
- const h = c.name;
723
- l === "radio" && h && c.checked && document.querySelectorAll(`input[type="radio"][name="${CSS.escape(h)}"]`).forEach((p) => {
724
- p !== c && f(p, { isChecked: !1 });
725
- });
726
- }
727
- function f(c, d) {
728
- if (!w(c))
729
- return;
730
- const l = s.get(c);
731
- (!l || l.text !== d.text || l.isChecked !== d.isChecked) && (s.set(c, d), n(y(T.Input, {
732
- id: g(c),
733
- ...d
734
- })));
735
- }
736
- }
737
- const Ae = 100, ze = 16;
738
- function Oe(t) {
739
- let n = R, e = [];
740
- function o() {
741
- n(), t(e), e = [];
742
- }
743
- const { throttled: s, cancel: r } = A(o, ze, {
744
- leading: !1
745
- });
746
- return {
747
- addMutations: (a) => {
748
- e.length === 0 && (n = _t(s, { timeout: Ae })), e.push(...a);
749
- },
750
- flush: o,
751
- stop: () => {
752
- n(), r();
753
- }
754
- };
755
- }
756
- function pt(t, n, e, o) {
757
- const s = Dt();
758
- if (!s)
759
- return { stop: R, flush: R };
760
- const r = Oe((i) => {
761
- Ve(i.concat(a.takeRecords()), t, n, e);
762
- }), a = new s(Lt(r.addMutations));
763
- return a.observe(o, {
764
- attributeOldValue: !0,
765
- attributes: !0,
766
- characterData: !0,
767
- characterDataOldValue: !0,
768
- childList: !0,
769
- subtree: !0
770
- }), {
771
- stop: () => {
772
- a.disconnect(), r.stop();
773
- },
774
- flush: () => {
775
- r.flush();
776
- }
777
- };
778
- }
779
- function Ve(t, n, e, o) {
780
- const s = /* @__PURE__ */ new Map();
781
- t.filter((l) => l.type === "childList").forEach((l) => {
782
- l.removedNodes.forEach((m) => {
783
- ht(m, o.removeShadowRoot);
784
- });
785
- });
786
- const r = t.filter((l) => l.target.isConnected && Kt(l.target) && v(l.target, e.defaultPrivacyLevel, s) !== S.HIDDEN), a = F(), { adds: i, removes: u, hasBeenSerialized: f } = Pe(r.filter((l) => l.type === "childList"), e, a, o, s), c = ke(r.filter((l) => l.type === "characterData" && !f(l.target)), e, s), d = Fe(r.filter((l) => l.type === "attributes" && !f(l.target)), e, s);
787
- !c.length && !d.length && !u.length && !i.length || n(y(T.Mutation, { adds: i, removes: u, texts: c, attributes: d }), a);
788
- }
789
- function Pe(t, n, e, o, s) {
790
- const r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
791
- for (const h of t)
792
- h.addedNodes.forEach((p) => {
793
- r.add(p);
794
- }), h.removedNodes.forEach((p) => {
795
- r.has(p) || a.set(p, h.target), r.delete(p);
796
- });
797
- const i = Array.from(r);
798
- Be(i);
799
- const u = /* @__PURE__ */ new Set(), f = {
800
- status: 2,
801
- serializationStats: e,
802
- shadowRootsController: o
803
- }, c = [];
804
- for (const h of i) {
805
- if (l(h))
806
- continue;
807
- const p = v(h.parentNode, n.defaultPrivacyLevel, s);
808
- if (p === S.HIDDEN || p === S.IGNORE)
809
- continue;
810
- const St = M(), H = B(h, {
811
- serializedNodeIds: u,
812
- parentNodePrivacyLevel: p,
813
- serializationContext: f,
814
- configuration: n
815
- });
816
- if (L(e, "serializationDuration", Z(St, M())), !H)
817
- continue;
818
- const gt = V(h);
819
- c.push({
820
- nextId: m(h),
821
- parentId: g(gt),
822
- node: H
823
- });
824
- }
825
- const d = [];
826
- return a.forEach((h, p) => {
827
- w(p) && d.push({
828
- parentId: g(h),
829
- id: g(p)
830
- });
831
- }), { adds: c, removes: d, hasBeenSerialized: l };
832
- function l(h) {
833
- return w(h) && u.has(g(h));
834
- }
835
- function m(h) {
836
- let p = h.nextSibling;
837
- for (; p; ) {
838
- if (w(p))
839
- return g(p);
840
- p = p.nextSibling;
841
- }
842
- return null;
843
- }
844
- }
845
- function ke(t, n, e) {
846
- var o;
847
- const s = [], r = /* @__PURE__ */ new Set(), a = t.filter((i) => r.has(i.target) ? !1 : (r.add(i.target), !0));
848
- for (const i of a) {
849
- if (i.target.textContent === i.oldValue)
850
- continue;
851
- const f = v(V(i.target), n.defaultPrivacyLevel, e);
852
- f === S.HIDDEN || f === S.IGNORE || s.push({
853
- id: g(i.target),
854
- // TODO: pass a valid "ignoreWhiteSpace" argument
855
- value: (o = J(i.target, !1, f)) !== null && o !== void 0 ? o : null
856
- });
857
- }
858
- return s;
859
- }
860
- function Fe(t, n, e) {
861
- const o = [], s = /* @__PURE__ */ new Map(), r = t.filter((i) => {
862
- const u = s.get(i.target);
863
- return u && u.has(i.attributeName) ? !1 : (u ? u.add(i.attributeName) : s.set(i.target, /* @__PURE__ */ new Set([i.attributeName])), !0);
864
- }), a = /* @__PURE__ */ new Map();
865
- for (const i of r) {
866
- if (i.target.getAttribute(i.attributeName) === i.oldValue)
867
- continue;
868
- const f = v(i.target, n.defaultPrivacyLevel, e), c = it(i.target, f, i.attributeName, n);
869
- let d;
870
- if (i.attributeName === "value") {
871
- const m = k(i.target, f);
872
- if (m === void 0)
873
- continue;
874
- d = m;
875
- } else typeof c == "string" ? d = c : d = null;
876
- let l = a.get(i.target);
877
- l || (l = {
878
- id: g(i.target),
879
- attributes: {}
880
- }, o.push(l), a.set(i.target, l)), l.attributes[i.attributeName] = d;
881
- }
882
- return o;
883
- }
884
- function Be(t) {
885
- t.sort((n, e) => {
886
- const o = n.compareDocumentPosition(e);
887
- return o & Node.DOCUMENT_POSITION_CONTAINED_BY ? -1 : o & Node.DOCUMENT_POSITION_CONTAINS || o & Node.DOCUMENT_POSITION_FOLLOWING ? 1 : o & Node.DOCUMENT_POSITION_PRECEDING ? -1 : 0;
888
- });
889
- }
890
- function ht(t, n) {
891
- tt(t) && n(t.shadowRoot), Q(t, (e) => ht(e, n));
892
- }
893
- function Ue() {
894
- const t = /* @__PURE__ */ new WeakMap();
895
- return {
896
- set(n, e) {
897
- n === document && !document.scrollingElement || t.set(n === document ? document.scrollingElement : n, e);
898
- },
899
- get(n) {
900
- return t.get(n);
901
- },
902
- has(n) {
903
- return t.has(n);
904
- }
905
- };
906
- }
907
- const He = (t, n, e) => {
908
- const o = /* @__PURE__ */ new Map(), s = {
909
- addShadowRoot: (r) => {
910
- if (o.has(r))
911
- return;
912
- const a = pt(n, t, s, r), i = ft(t, n, r), u = dt(t, n, e, r);
913
- o.set(r, {
914
- flush: () => a.flush(),
915
- stop: () => {
916
- a.stop(), i.stop(), u.stop();
917
- }
918
- });
919
- },
920
- removeShadowRoot: (r) => {
921
- const a = o.get(r);
922
- a && (a.stop(), o.delete(r));
923
- },
924
- stop: () => {
925
- o.forEach(({ stop: r }) => r());
926
- },
927
- flush: () => {
928
- o.forEach(({ flush: r }) => r());
929
- }
930
- };
931
- return s;
932
- };
933
- function Ge(t, n, e, o, s, r) {
934
- const a = (u, f) => {
935
- const { width: c, height: d } = At();
936
- r({
937
- data: {
938
- height: d,
939
- href: window.location.href,
940
- width: c
941
- },
942
- type: N.Meta,
943
- timestamp: u
944
- }), r({
945
- data: {
946
- has_focus: document.hasFocus()
947
- },
948
- type: N.Focus,
949
- timestamp: u
950
- });
951
- const l = F();
952
- r({
953
- data: {
954
- node: Te(document, o, {
955
- status: f,
956
- elementsScrollPositions: t,
957
- serializationStats: l,
958
- shadowRootsController: n
959
- }),
960
- initialOffset: {
961
- left: st(),
962
- top: nt()
963
- }
964
- },
965
- type: N.FullSnapshot,
966
- timestamp: u
967
- }, l), window.visualViewport && r({
968
- data: ct(window.visualViewport),
969
- type: N.VisualViewport,
970
- timestamp: u
971
- });
972
- };
973
- a(
974
- M(),
975
- 0
976
- /* SerializationContextStatus.INITIAL_FULL_SNAPSHOT */
977
- );
978
- const { unsubscribe: i } = e.subscribe(2, (u) => {
979
- s(), a(
980
- u.startClocks.timeStamp,
981
- 1
982
- /* SerializationContextStatus.SUBSEQUENT_FULL_SNAPSHOT */
983
- );
984
- });
985
- return {
986
- stop: i
987
- };
988
- }
989
- function We() {
990
- const t = /* @__PURE__ */ new WeakMap();
991
- let n = 1;
992
- return {
993
- getIdForEvent(e) {
994
- return t.has(e) || t.set(e, n++), t.get(e);
995
- }
996
- };
997
- }
998
- function Ye(t) {
999
- const { emit: n, configuration: e, lifeCycle: o } = t;
1000
- if (!n)
1001
- throw new Error("emit function is required");
1002
- const s = (l, m) => {
1003
- n(l, m), zt("record", { record: l });
1004
- const h = t.viewHistory.findView();
1005
- Ot(h.id);
1006
- }, r = Ue(), a = He(e, s, r), { stop: i } = Ge(r, a, o, e, u, s);
1007
- function u() {
1008
- a.flush(), c.flush();
1009
- }
1010
- const f = We(), c = pt(s, e, a, document), d = [
1011
- c,
1012
- we(e, s),
1013
- Me(e, s, f),
1014
- dt(e, s, r, document),
1015
- Re(e, s),
1016
- ft(e, s),
1017
- xe(e, s),
1018
- be(s),
1019
- _e(e, s),
1020
- Ce(e, s),
1021
- De(o, s, f),
1022
- Le(o, (l) => {
1023
- u(), s(l);
1024
- })
1025
- ];
1026
- return {
1027
- stop: () => {
1028
- a.stop(), d.forEach((l) => l.stop()), i();
1029
- },
1030
- flushMutations: u,
1031
- shadowRootsController: a
1032
- };
1033
- }
1034
- function $e(t, n, e, o) {
1035
- const s = new FormData();
1036
- s.append("segment", new Blob([t], {
1037
- type: "application/octet-stream"
1038
- }), `${n.session.id}-${n.start}`);
1039
- const r = {
1040
- raw_segment_size: o,
1041
- compressed_segment_size: t.byteLength,
1042
- ...n
1043
- }, a = JSON.stringify(r);
1044
- return s.append("event", new Blob([a], { type: "application/json" })), {
1045
- data: s,
1046
- bytesCount: t.byteLength,
1047
- cssText: e.cssText,
1048
- isFullSnapshot: n.index_in_view === 0,
1049
- rawSize: o,
1050
- recordCount: n.records_count,
1051
- serializationDuration: e.serializationDuration
1052
- };
1053
- }
1054
- function Xe({ context: t, creationReason: n, encoder: e }) {
1055
- let o = 0;
1056
- const s = t.view.id, r = Vt(s), a = {
1057
- start: 1 / 0,
1058
- end: -1 / 0,
1059
- creation_reason: n,
1060
- records_count: 0,
1061
- has_full_snapshot: !1,
1062
- index_in_view: r,
1063
- source: "browser",
1064
- ...t
1065
- }, i = F();
1066
- Pt(s);
1067
- function u(c, d, l) {
1068
- a.start = Math.min(a.start, c.timestamp), a.end = Math.max(a.end, c.timestamp), a.records_count += 1, a.has_full_snapshot || (a.has_full_snapshot = c.type === N.FullSnapshot), d && se(i, d);
1069
- const m = e.isEmpty ? '{"records":[' : ",";
1070
- e.write(m + JSON.stringify(c), (h) => {
1071
- o += h, l(o);
1072
- });
1073
- }
1074
- function f(c) {
1075
- if (e.isEmpty)
1076
- throw new Error("Empty segment flushed");
1077
- e.write(`],${JSON.stringify(a).slice(1)}
1078
- `), e.finish((d) => {
1079
- kt(a.view.id, d.rawBytesCount), c(a, i, d);
1080
- });
1081
- }
1082
- return { addRecord: u, flush: f };
1083
- }
1084
- const Ke = 5 * Ht;
1085
- let mt = 6e4;
1086
- function je(t, n, e, o, s, r) {
1087
- return qe(t, () => Je(n.applicationId, e, o), s, r);
1088
- }
1089
- function qe(t, n, e, o) {
1090
- let s = {
1091
- status: 0,
1092
- nextSegmentCreationReason: "init"
1093
- };
1094
- const { unsubscribe: r } = t.subscribe(2, () => {
1095
- i("view_change");
1096
- }), { unsubscribe: a } = t.subscribe(11, (u) => {
1097
- i(u.reason);
1098
- });
1099
- function i(u) {
1100
- s.status === 1 && (s.segment.flush((f, c, d) => {
1101
- const l = $e(d.output, f, c, d.rawBytesCount);
1102
- Ft(u) ? e.sendOnExit(l) : e.send(l);
1103
- }), Bt(s.expirationTimeoutId)), u !== "stop" ? s = {
1104
- status: 0,
1105
- nextSegmentCreationReason: u
1106
- } : s = {
1107
- status: 2
1108
- };
1109
- }
1110
- return {
1111
- addRecord: (u, f) => {
1112
- if (s.status !== 2) {
1113
- if (s.status === 0) {
1114
- const c = n();
1115
- if (!c)
1116
- return;
1117
- s = {
1118
- status: 1,
1119
- segment: Xe({ encoder: o, context: c, creationReason: s.nextSegmentCreationReason }),
1120
- expirationTimeoutId: Ut(() => {
1121
- i("segment_duration_limit");
1122
- }, Ke)
1123
- };
1124
- }
1125
- s.segment.addRecord(u, f, (c) => {
1126
- c > mt && i("segment_bytes_limit");
1127
- });
1128
- }
1129
- },
1130
- stop: () => {
1131
- i("stop"), r(), a();
1132
- }
1133
- };
1134
- }
1135
- function Je(t, n, e) {
1136
- const o = n.findTrackedSession(), s = e.findView();
1137
- if (!(!o || !s))
1138
- return {
1139
- application: {
1140
- id: t
1141
- },
1142
- session: {
1143
- id: o.id
1144
- },
1145
- view: {
1146
- id: s.id
1147
- }
1148
- };
1149
- }
1150
- const Qe = "Segment network request metrics";
1151
- function Ze(t, n, e) {
1152
- if (!(n.enabled && Gt(t.replayTelemetrySampleRate)))
1153
- return { stop: R };
1154
- const { unsubscribe: s } = e.subscribe((r) => {
1155
- if (r.type === "failure" || r.type === "queue-full" || r.type === "success" && r.payload.isFullSnapshot) {
1156
- const a = tn(r.type, r.bandwidth, r.payload);
1157
- Wt(Qe, { metrics: a });
1158
- }
1159
- });
1160
- return {
1161
- stop: s
1162
- };
1163
- }
1164
- function tn(t, n, e) {
1165
- return {
1166
- cssText: {
1167
- count: e.cssText.count,
1168
- max: e.cssText.max,
1169
- sum: e.cssText.sum
1170
- },
1171
- isFullSnapshot: e.isFullSnapshot,
1172
- ongoingRequests: {
1173
- count: n.ongoingRequestCount,
1174
- totalSize: n.ongoingByteCount
1175
- },
1176
- recordCount: e.recordCount,
1177
- result: t,
1178
- serializationDuration: {
1179
- count: e.serializationDuration.count,
1180
- max: e.serializationDuration.max,
1181
- sum: e.serializationDuration.sum
1182
- },
1183
- size: {
1184
- compressed: e.bytesCount,
1185
- raw: e.rawSize
1186
- }
1187
- };
1188
- }
1189
- function en(t) {
1190
- const n = Yt();
1191
- return {
1192
- addRecord: (e) => {
1193
- const o = t.findView();
1194
- n.send("record", e, o.id);
1195
- }
1196
- };
1197
- }
1198
- function sn(t, n, e, o, s, r, a) {
1199
- const i = [], u = (l) => {
1200
- t.notify(14, { error: l }), et("Error reported to customer", { "error.message": l.message });
1201
- }, f = a || $t([n.sessionReplayEndpointBuilder], mt, u);
1202
- let c;
1203
- if (Xt())
1204
- ({ addRecord: c } = en(o));
1205
- else {
1206
- const l = je(t, n, e, o, f, s);
1207
- c = l.addRecord, i.push(l.stop);
1208
- const m = Ze(n, r, f.observable);
1209
- i.push(m.stop);
1210
- }
1211
- const { stop: d } = Ye({
1212
- emit: c,
1213
- configuration: n,
1214
- lifeCycle: t,
1215
- viewHistory: o
1216
- });
1217
- return i.push(d), {
1218
- stop: () => {
1219
- i.forEach((l) => l());
1220
- }
1221
- };
1222
- }
1223
- export {
1224
- sn as startRecording
1225
- };