@askdepth/replay 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,158 @@
1
+ import { RRWebEvent, ReplayUploadPayload } from '@askdepth/contracts';
2
+ export { CompressionAlgorithm, RRWebEvent, ReplaySliceManifest, ReplayUploadPayload } from '@askdepth/contracts';
3
+
4
+ /** How long a session slice stays in memory before older mutations are dropped. */
5
+ declare const REPLAY_WINDOW_MS = 45000;
6
+ /** rrweb full-snapshot checkpoint interval. Matches the ring window so a slice always has a baseline. */
7
+ declare const CHECKOUT_EVERY_MS = 45000;
8
+ declare const DESKTOP_MAX_BYTES: number;
9
+ /** 1.5 MiB for mobile browsers and WebKit. */
10
+ declare const MOBILE_MAX_BYTES: number;
11
+ /** Flash uploads larger than this are split into ordered parts.
12
+ * Kept under 45 KiB so base64-encoded payload + manifest JSON fits inside the browser's 64 KiB keepalive limit. */
13
+ declare const CHUNK_BYTES: number;
14
+ /** Synchronous mutation handling must stay inside one frame. */
15
+ declare const FRAME_BUDGET_MS = 8;
16
+
17
+ /** Chromium desktop keeps 3 MiB. WebKit and mobile browsers keep 1.5 MiB. */
18
+ declare function maxBufferBytes(userAgent: string): number;
19
+
20
+ interface Compressed {
21
+ bytes: Uint8Array;
22
+ algorithm: 'gzip' | 'deflate' | 'none';
23
+ }
24
+ /** Prefer the native gzip stream. Old WebKit falls back to fflate. */
25
+ declare function compressBytes(input: Uint8Array, mode?: 'auto' | 'fflate' | 'none'): Promise<Compressed>;
26
+
27
+ interface RecorderHandle {
28
+ stop: () => void;
29
+ checkpoint: () => void;
30
+ }
31
+ interface ReplayEngineConfig {
32
+ sessionId: string;
33
+ environment: string;
34
+ endpoint: string;
35
+ windowMs?: number;
36
+ checkoutEveryNms?: number;
37
+ maxBytes?: number;
38
+ now?: () => number;
39
+ clock?: () => number;
40
+ schedule?: (fn: () => void) => void;
41
+ fetchImpl?: typeof fetch;
42
+ recorder?: (emit: (event: RRWebEvent) => void) => RecorderHandle;
43
+ compress?: (input: Uint8Array) => Promise<Compressed>;
44
+ memoryPressure?: () => boolean;
45
+ userAgent?: string;
46
+ }
47
+ interface ReplayInstance {
48
+ start: () => void;
49
+ stop: () => void;
50
+ push: (event: RRWebEvent) => void;
51
+ dump: () => RRWebEvent[];
52
+ flash: (anomalyId: string, triggerTimestamp?: number) => Promise<ReplayUploadPayload[]>;
53
+ }
54
+ declare function createReplayEngine(config: ReplayEngineConfig): ReplayInstance;
55
+
56
+ /** Redact card, email, phone, JWT, Bearer, and document numbers without mutating text lengths artificially. */
57
+ declare function maskText(text: string): string;
58
+ /** Text inputs keep their length as stars unless a PII pattern replaces the whole secret. */
59
+ declare function maskInputValue(value: string): string;
60
+ /** Stateful event sanitizer maintaining masked node IDs across snapshots and incremental mutations. */
61
+ declare class EventSanitizer {
62
+ private maskedIds;
63
+ private blockedIds;
64
+ clear(): void;
65
+ sanitize(event: RRWebEvent): RRWebEvent;
66
+ private sanitizeIncremental;
67
+ private sanitizeNode;
68
+ }
69
+ declare function createEventSanitizer(): EventSanitizer;
70
+ /** Mask PII on an rrweb event before it is allowed into the ring buffer. */
71
+ declare function sanitizeEvent(event: RRWebEvent): RRWebEvent;
72
+
73
+ interface RecordEmit {
74
+ (event: RRWebEvent, isCheckout?: boolean): void;
75
+ }
76
+ /** Recorder options shared by the live rrweb session. */
77
+ declare function createRecordOptions(args: {
78
+ emit: RecordEmit;
79
+ checkoutEveryNms?: number;
80
+ userAgent?: string;
81
+ maskTextSelector?: string;
82
+ }): {
83
+ emit: RecordEmit;
84
+ checkoutEveryNms: number;
85
+ inlineStylesheet: boolean;
86
+ collectFonts: boolean;
87
+ inlineImages: boolean;
88
+ recordCanvas: boolean;
89
+ maskAllInputs: boolean;
90
+ maskInputFn: (value: string) => string;
91
+ maskTextFn: (value: string) => string;
92
+ maskTextSelector: string;
93
+ maskTextClass: string;
94
+ blockSelector: string;
95
+ blockClass: string;
96
+ sampling: {
97
+ mousemove: number | boolean;
98
+ mouseInteraction: {
99
+ MouseUp: boolean;
100
+ MouseDown: boolean;
101
+ Click: boolean;
102
+ ContextMenu: boolean;
103
+ DblClick: boolean;
104
+ Focus: boolean;
105
+ Blur: boolean;
106
+ TouchStart: boolean;
107
+ TouchEnd: boolean;
108
+ TouchCancel: boolean;
109
+ };
110
+ scroll: number;
111
+ input: "last";
112
+ };
113
+ };
114
+
115
+ /**
116
+ * FIFO of the last 45 seconds plus a protected FullSnapshot slot.
117
+ * Invariant: DOM structural mutations after baseline are never evicted from the
118
+ * middle of the stream, preventing broken DOM references during replay.
119
+ * Memory pressure drops mousemove and intermediate scrolls.
120
+ */
121
+ declare class RingBuffer {
122
+ readonly windowMs: number;
123
+ readonly maxBytes: number;
124
+ private readonly now;
125
+ private readonly onPressure?;
126
+ private items;
127
+ private bytes;
128
+ baseline: RRWebEvent | null;
129
+ constructor(opts?: {
130
+ windowMs?: number;
131
+ maxBytes?: number;
132
+ now?: () => number;
133
+ onPressure?: () => void;
134
+ });
135
+ get byteLength(): number;
136
+ clear(): void;
137
+ push(event: RRWebEvent): void;
138
+ /**
139
+ * Drop events outside active window.
140
+ * When a baseline is active, DOM mutations between baseline and window cutoff
141
+ * are preserved so the replay tree can always be reconstructed without missing node IDs.
142
+ */
143
+ evict(): void;
144
+ /** Tab hidden or memory warning: pointer trails are the first thing to go. */
145
+ dropPointerSamples(): void;
146
+ toArray(): RRWebEvent[];
147
+ /**
148
+ * Slice for upload.
149
+ * Guarantees baseline first, followed by all structural DOM mutations from baseline
150
+ * to trigger, and pointer/scroll events inside [trigger - window, trigger].
151
+ */
152
+ slice(triggerTimestamp: number): RRWebEvent[];
153
+ private evictByMemory;
154
+ private removeAt;
155
+ private recount;
156
+ }
157
+
158
+ export { CHECKOUT_EVERY_MS, CHUNK_BYTES, DESKTOP_MAX_BYTES, EventSanitizer, FRAME_BUDGET_MS, MOBILE_MAX_BYTES, REPLAY_WINDOW_MS, type ReplayEngineConfig, type ReplayInstance, RingBuffer, compressBytes, createEventSanitizer, createRecordOptions, createReplayEngine, maskInputValue, maskText, maxBufferBytes, sanitizeEvent };
@@ -0,0 +1,158 @@
1
+ import { RRWebEvent, ReplayUploadPayload } from '@askdepth/contracts';
2
+ export { CompressionAlgorithm, RRWebEvent, ReplaySliceManifest, ReplayUploadPayload } from '@askdepth/contracts';
3
+
4
+ /** How long a session slice stays in memory before older mutations are dropped. */
5
+ declare const REPLAY_WINDOW_MS = 45000;
6
+ /** rrweb full-snapshot checkpoint interval. Matches the ring window so a slice always has a baseline. */
7
+ declare const CHECKOUT_EVERY_MS = 45000;
8
+ declare const DESKTOP_MAX_BYTES: number;
9
+ /** 1.5 MiB for mobile browsers and WebKit. */
10
+ declare const MOBILE_MAX_BYTES: number;
11
+ /** Flash uploads larger than this are split into ordered parts.
12
+ * Kept under 45 KiB so base64-encoded payload + manifest JSON fits inside the browser's 64 KiB keepalive limit. */
13
+ declare const CHUNK_BYTES: number;
14
+ /** Synchronous mutation handling must stay inside one frame. */
15
+ declare const FRAME_BUDGET_MS = 8;
16
+
17
+ /** Chromium desktop keeps 3 MiB. WebKit and mobile browsers keep 1.5 MiB. */
18
+ declare function maxBufferBytes(userAgent: string): number;
19
+
20
+ interface Compressed {
21
+ bytes: Uint8Array;
22
+ algorithm: 'gzip' | 'deflate' | 'none';
23
+ }
24
+ /** Prefer the native gzip stream. Old WebKit falls back to fflate. */
25
+ declare function compressBytes(input: Uint8Array, mode?: 'auto' | 'fflate' | 'none'): Promise<Compressed>;
26
+
27
+ interface RecorderHandle {
28
+ stop: () => void;
29
+ checkpoint: () => void;
30
+ }
31
+ interface ReplayEngineConfig {
32
+ sessionId: string;
33
+ environment: string;
34
+ endpoint: string;
35
+ windowMs?: number;
36
+ checkoutEveryNms?: number;
37
+ maxBytes?: number;
38
+ now?: () => number;
39
+ clock?: () => number;
40
+ schedule?: (fn: () => void) => void;
41
+ fetchImpl?: typeof fetch;
42
+ recorder?: (emit: (event: RRWebEvent) => void) => RecorderHandle;
43
+ compress?: (input: Uint8Array) => Promise<Compressed>;
44
+ memoryPressure?: () => boolean;
45
+ userAgent?: string;
46
+ }
47
+ interface ReplayInstance {
48
+ start: () => void;
49
+ stop: () => void;
50
+ push: (event: RRWebEvent) => void;
51
+ dump: () => RRWebEvent[];
52
+ flash: (anomalyId: string, triggerTimestamp?: number) => Promise<ReplayUploadPayload[]>;
53
+ }
54
+ declare function createReplayEngine(config: ReplayEngineConfig): ReplayInstance;
55
+
56
+ /** Redact card, email, phone, JWT, Bearer, and document numbers without mutating text lengths artificially. */
57
+ declare function maskText(text: string): string;
58
+ /** Text inputs keep their length as stars unless a PII pattern replaces the whole secret. */
59
+ declare function maskInputValue(value: string): string;
60
+ /** Stateful event sanitizer maintaining masked node IDs across snapshots and incremental mutations. */
61
+ declare class EventSanitizer {
62
+ private maskedIds;
63
+ private blockedIds;
64
+ clear(): void;
65
+ sanitize(event: RRWebEvent): RRWebEvent;
66
+ private sanitizeIncremental;
67
+ private sanitizeNode;
68
+ }
69
+ declare function createEventSanitizer(): EventSanitizer;
70
+ /** Mask PII on an rrweb event before it is allowed into the ring buffer. */
71
+ declare function sanitizeEvent(event: RRWebEvent): RRWebEvent;
72
+
73
+ interface RecordEmit {
74
+ (event: RRWebEvent, isCheckout?: boolean): void;
75
+ }
76
+ /** Recorder options shared by the live rrweb session. */
77
+ declare function createRecordOptions(args: {
78
+ emit: RecordEmit;
79
+ checkoutEveryNms?: number;
80
+ userAgent?: string;
81
+ maskTextSelector?: string;
82
+ }): {
83
+ emit: RecordEmit;
84
+ checkoutEveryNms: number;
85
+ inlineStylesheet: boolean;
86
+ collectFonts: boolean;
87
+ inlineImages: boolean;
88
+ recordCanvas: boolean;
89
+ maskAllInputs: boolean;
90
+ maskInputFn: (value: string) => string;
91
+ maskTextFn: (value: string) => string;
92
+ maskTextSelector: string;
93
+ maskTextClass: string;
94
+ blockSelector: string;
95
+ blockClass: string;
96
+ sampling: {
97
+ mousemove: number | boolean;
98
+ mouseInteraction: {
99
+ MouseUp: boolean;
100
+ MouseDown: boolean;
101
+ Click: boolean;
102
+ ContextMenu: boolean;
103
+ DblClick: boolean;
104
+ Focus: boolean;
105
+ Blur: boolean;
106
+ TouchStart: boolean;
107
+ TouchEnd: boolean;
108
+ TouchCancel: boolean;
109
+ };
110
+ scroll: number;
111
+ input: "last";
112
+ };
113
+ };
114
+
115
+ /**
116
+ * FIFO of the last 45 seconds plus a protected FullSnapshot slot.
117
+ * Invariant: DOM structural mutations after baseline are never evicted from the
118
+ * middle of the stream, preventing broken DOM references during replay.
119
+ * Memory pressure drops mousemove and intermediate scrolls.
120
+ */
121
+ declare class RingBuffer {
122
+ readonly windowMs: number;
123
+ readonly maxBytes: number;
124
+ private readonly now;
125
+ private readonly onPressure?;
126
+ private items;
127
+ private bytes;
128
+ baseline: RRWebEvent | null;
129
+ constructor(opts?: {
130
+ windowMs?: number;
131
+ maxBytes?: number;
132
+ now?: () => number;
133
+ onPressure?: () => void;
134
+ });
135
+ get byteLength(): number;
136
+ clear(): void;
137
+ push(event: RRWebEvent): void;
138
+ /**
139
+ * Drop events outside active window.
140
+ * When a baseline is active, DOM mutations between baseline and window cutoff
141
+ * are preserved so the replay tree can always be reconstructed without missing node IDs.
142
+ */
143
+ evict(): void;
144
+ /** Tab hidden or memory warning: pointer trails are the first thing to go. */
145
+ dropPointerSamples(): void;
146
+ toArray(): RRWebEvent[];
147
+ /**
148
+ * Slice for upload.
149
+ * Guarantees baseline first, followed by all structural DOM mutations from baseline
150
+ * to trigger, and pointer/scroll events inside [trigger - window, trigger].
151
+ */
152
+ slice(triggerTimestamp: number): RRWebEvent[];
153
+ private evictByMemory;
154
+ private removeAt;
155
+ private recount;
156
+ }
157
+
158
+ export { CHECKOUT_EVERY_MS, CHUNK_BYTES, DESKTOP_MAX_BYTES, EventSanitizer, FRAME_BUDGET_MS, MOBILE_MAX_BYTES, REPLAY_WINDOW_MS, type ReplayEngineConfig, type ReplayInstance, RingBuffer, compressBytes, createEventSanitizer, createRecordOptions, createReplayEngine, maskInputValue, maskText, maxBufferBytes, sanitizeEvent };
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ var ze=45e3,Xe=45e3,wt=3145728,vn=Math.floor(1572864),Ct=45*1024,Mt=8,ue=2,Je=3,Ke=0,Qe=1;var rr=3;var et=6;var nr=typeof TextEncoder<"u"?new TextEncoder:void 0;function Rt(e){if(nr)return nr.encode(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)&255;return t}function tt(e){return Rt(JSON.stringify(e)).length}function ir(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function sr(e,t){if(e.byteLength<=t)return [e];let r=[];for(let n=0;n<e.byteLength;n+=t)r.push(e.subarray(n,Math.min(n+t,e.byteLength)));return r}function Ue(e){let t=/Mobi|Android|iPhone|iPad|iPod/i.test(e),r=/AppleWebKit/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Android/i.test(e);return t||r?Math.floor(1.5*1024*1024):3*1024*1024}var ce=Uint8Array,ae=Uint16Array,Ot=Int32Array,At=new ce([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Nt=new ce([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),or=new ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cr=function(e,t){for(var r=new ae(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Ot(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return {b:r,r:i}},fr=cr(At,2),bn=fr.b,It=fr.r;bn[28]=258,It[258]=28;var hr=cr(Nt,0),ar=hr.r,xt=new ae(32768);for(P=0;P<32768;++P)de=(P&43690)>>1|(P&21845)<<1,de=(de&52428)>>2|(de&13107)<<2,de=(de&61680)>>4|(de&3855)<<4,xt[P]=((de&65280)>>8|(de&255)<<8)>>1;var de,P,Be=(function(e,t,r){for(var n=e.length,i=0,s=new ae(t);i<n;++i)e[i]&&++s[e[i]-1];var o=new ae(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var c;for(c=new ae(n),i=0;i<n;++i)e[i]&&(c[i]=xt[o[e[i]-1]++]>>15-e[i]);return c}),Ce=new ce(288);for(P=0;P<144;++P)Ce[P]=8;var P;for(P=144;P<256;++P)Ce[P]=9;var P;for(P=256;P<280;++P)Ce[P]=7;var P;for(P=280;P<288;++P)Ce[P]=8;var P,rt=new ce(32);for(P=0;P<32;++P)rt[P]=5;var P,Sn=Be(Ce,9);var wn=Be(rt,5);var dr=function(e){return (e+7)/8|0},Cn=function(e,t,r){return (r==null||r>e.length)&&(r=e.length),new ce(e.subarray(t,r))};var pe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8;},Pe=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16;},Et=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return {t:mr,l:0};if(i==1){var o=new ce(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(I,x){return I.f-x.f}),r.push({s:-1,f:25001});var c=r[0],a=r[1],f=0,l=1,h=2;for(r[0]={s:-1,f:c.f+a.f,l:c,r:a};l!=i-1;)c=r[r[f].f<r[h].f?f++:h++],a=r[f!=l&&r[f].f<r[h].f?f++:h++],r[l++]={s:-1,f:c.f+a.f,l:c,r:a};for(var d=s[0].s,n=1;n<i;++n)s[n].s>d&&(d=s[n].s);var p=new ae(d+1),m=kt(r[l-1],p,0);if(m>t){var n=0,u=0,v=m-t,C=1<<v;for(s.sort(function(x,k){return p[k.s]-p[x.s]||x.f-k.f});n<i;++n){var b=s[n].s;if(p[b]>t)u+=C-(1<<m-p[b]),p[b]=t;else break}for(u>>=v;u>0;){var y=s[n].s;p[y]<t?u-=1<<t-p[y]++-1:++n;}for(;n>=0&&u;--n){var M=s[n].s;p[M]==t&&(--p[M],++u);}m=t;}return {t:new ce(p),l:m}},kt=function(e,t,r){return e.s==-1?Math.max(kt(e.l,t,r+1),kt(e.r,t,r+1)):t[e.s]=r},lr=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ae(++t),n=0,i=e[0],s=1,o=function(a){r[n++]=a;},c=1;c<=t;++c)if(e[c]==i&&c!=t)++s;else {if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0);}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0);}for(;s--;)o(i);s=1,i=e[c];}return {c:r.subarray(0,n),n:t}},Fe=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},pr=function(e,t,r){var n=r.length,i=dr(t+2);e[i]=n&255,e[i+1]=n>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<n;++s)e[i+s+4]=r[s];return (i+4+n)*8},ur=function(e,t,r,n,i,s,o,c,a,f,l){pe(t,l++,r),++i[256];for(var h=Et(i,15),d=h.t,p=h.l,m=Et(s,15),u=m.t,v=m.l,C=lr(d),b=C.c,y=C.n,M=lr(u),I=M.c,x=M.n,k=new ae(19),E=0;E<b.length;++E)++k[b[E]&31];for(var E=0;E<I.length;++E)++k[I[E]&31];for(var R=Et(k,7),B=R.t,A=R.l,T=19;T>4&&!B[or[T-1]];--T);var S=f+5<<3,L=Fe(i,Ce)+Fe(s,rt)+o,j=Fe(i,d)+Fe(s,u)+o+14+3*T+Fe(k,B)+2*k[16]+3*k[17]+7*k[18];if(a>=0&&S<=L&&S<=j)return pr(t,l,e.subarray(a,a+f));var U,N,q,Z;if(pe(t,l,1+(j<L)),l+=2,j<L){U=Be(d,p),N=d,q=Be(u,v),Z=u;var ye=Be(B,A);pe(t,l,y-257),pe(t,l+5,x-1),pe(t,l+10,T-4),l+=14;for(var E=0;E<T;++E)pe(t,l+3*E,B[or[E]]);l+=3*T;for(var J=[b,I],he=0;he<2;++he)for(var Q=J[he],E=0;E<Q.length;++E){var K=Q[E]&31;pe(t,l,ye[K]),l+=B[K],K>15&&(pe(t,l,Q[E]>>5&127),l+=Q[E]>>12);}}else U=Sn,N=Ce,q=wn,Z=rt;for(var E=0;E<c;++E){var V=n[E];if(V>255){var K=V>>18&31;Pe(t,l,U[K+257]),l+=N[K+257],K>7&&(pe(t,l,V>>23&31),l+=At[K]);var X=V&31;Pe(t,l,q[X]),l+=Z[X],X>3&&(Pe(t,l,V>>5&8191),l+=Nt[X]);}else Pe(t,l,U[V]),l+=N[V];}return Pe(t,l,U[256]),l+N[256]},Mn=new Ot([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),mr=new ce(0),Rn=function(e,t,r,n,i,s){var o=s.z||e.length,c=new ce(n+o+5*(1+Math.ceil(o/7e3))+i),a=c.subarray(n,c.length-i),f=s.l,l=(s.r||0)&7;if(t){l&&(a[0]=s.r>>3);for(var h=Mn[t-1],d=h>>13,p=h&8191,m=(1<<r)-1,u=s.p||new ae(32768),v=s.h||new ae(m+1),C=Math.ceil(r/3),b=2*C,y=function(H){return (e[H]^e[H+1]<<C^e[H+2]<<b)&m},M=new Ot(25e3),I=new ae(288),x=new ae(32),k=0,E=0,R=s.i||0,B=0,A=s.w||0,T=0;R+2<o;++R){var S=y(R),L=R&32767,j=v[S];if(u[L]=j,v[S]=L,A<=R){var U=o-R;if((k>7e3||B>24576)&&(U>423||!f)){l=ur(e,a,0,M,I,x,E,B,T,R-T,l),B=k=E=0,T=R;for(var N=0;N<286;++N)I[N]=0;for(var N=0;N<30;++N)x[N]=0;}var q=2,Z=0,ye=p,J=L-j&32767;if(U>2&&S==y(R-J))for(var he=Math.min(d,U)-1,Q=Math.min(32767,R),K=Math.min(258,U);J<=Q&&--ye&&L!=j;){if(e[R+q]==e[R+q-J]){for(var V=0;V<K&&e[R+V]==e[R+V-J];++V);if(V>q){if(q=V,Z=J,V>he)break;for(var X=Math.min(J,V-2),re=0,N=0;N<X;++N){var ne=R-J+N&32767,Se=u[ne],we=ne-Se&32767;we>re&&(re=we,j=ne);}}}L=j,j=u[L],J+=L-j&32767;}if(Z){M[B++]=268435456|It[q]<<18|ar[Z];var _=It[q]&31,ie=ar[Z]&31;E+=At[_]+Nt[ie],++I[257+_],++x[ie],A=R+q,++k;}else M[B++]=e[R],++I[e[R]];}}for(R=Math.max(R,A);R<o;++R)M[B++]=e[R],++I[e[R]];l=ur(e,a,f,M,I,x,E,B,T,R-T,l),f||(s.r=l&7|a[l/8|0]<<3,l-=7,s.h=v,s.p=u,s.i=R,s.w=A);}else {for(var R=s.w||0;R<o+f;R+=65535){var W=R+65535;W>=o&&(a[l/8|0]=f,W=o),l=pr(a,l+1,e.subarray(R,W));}s.i=o;}return Cn(c,0,n+dr(l)+i)},En=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r;}return e})(),In=function(){var e=-1;return {p:function(t){for(var r=e,n=0;n<t.length;++n)r=En[r&255^t[n]]^r>>>8;e=r;},d:function(){return ~e}}};var xn=function(e,t,r,n,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new ce(s.length+e.length);o.set(s),o.set(e,s.length),e=o,i.w=s.length;}return Rn(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,i)};var Tt=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8;},kn=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&Tt(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n);}};var Tn=function(e){return 10+(e.filename?e.filename.length+1:0)};function yr(e,t){t||(t={});var r=In(),n=e.length;r.p(e);var i=xn(e,t,Tn(t),8),s=i.length;return kn(i,t),Tt(i,s-8,r.d()),Tt(i,s-4,n),i}var On=typeof TextDecoder<"u"&&new TextDecoder,An=0;try{On.decode(mr,{stream:!0}),An=1;}catch{}async function Nn(e){let t=new Uint8Array(e.byteLength);t.set(e);let r=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=await new Response(r).arrayBuffer();return new Uint8Array(n)}async function Dt(e,t="auto"){if(t==="none"||e.byteLength===0)return {bytes:e,algorithm:"none"};if(t!=="fflate"&&typeof CompressionStream=="function")try{return {bytes:await Nn(e),algorithm:"gzip"}}catch{}try{return {bytes:yr(e),algorithm:"gzip"}}catch{return {bytes:e,algorithm:"none"}}}var Dn=Object.defineProperty,Ln=(e,t,r)=>t in e?Dn(e,t,{enumerable:true,configurable:true,writable:true,value:r}):e[t]=r,g=(e,t,r)=>Ln(e,typeof t!="symbol"?t+"":t,r),gr,z=(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))(z||{}),O=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(O||{}),se=(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))(se||{}),me=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(me||{}),De=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(De||{}),ke=(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))(ke||{}),Y=(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))(Y||{}),vr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},br={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},nt={},Ar={},_n=()=>!!globalThis.Zone;function Xt(e){if(nt[e])return nt[e];let t=globalThis[e],r=t.prototype,n=e in vr?vr[e]:void 0,i=!!(n&&n.every(c=>{var a,f;return !!((f=(a=Object.getOwnPropertyDescriptor(r,c))==null?void 0:a.get)!=null&&f.toString().includes("[native code]"))})),s=e in br?br[e]:void 0,o=!!(s&&s.every(c=>{var a;return typeof r[c]=="function"&&((a=r[c])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!_n())return nt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let a=c.contentWindow;if(!a)return t.prototype;let f=a[e].prototype;if(!f)return c.remove(),r;let l=navigator.userAgent;return l.includes("Safari")&&!l.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Ar[e]=()=>c.remove()):c.remove(),nt[e]=f}catch{return r}}var Lt={};function le(e,t,r){var n,i;let s=(n=Lt[e])==null?void 0:n[r];if(s)return s.call(t);let o=Xt(e),c=(i=Object.getOwnPropertyDescriptor(o,r))==null?void 0:i.get;return c?((Lt[e]||(Lt[e]={}))[r]=c,c.call(t)):t[r]}var _t={};function Nr(e,t,r){let n=`${e}.${String(r)}`;if(_t[n])return _t[n].bind(t);let s=Xt(e)[r];return typeof s!="function"?t[r]:(_t[n]=s,s.bind(t))}function zn(e){return le("Node",e,"ownerDocument")}function Un(e){return le("Node",e,"childNodes")}function Pn(e){return le("Node",e,"parentNode")}function Fn(e){return le("Node",e,"parentElement")}function Bn(e){return le("Node",e,"textContent")}function Wn(e){return le("Node",e,"firstChild")}function Hn(e){return le("Node",e,"lastChild")}function Gn(e){return le("Node",e,"nextSibling")}function jn(e){return le("Node",e,"previousSibling")}function Vn(e,t){return Nr("Node",e,"contains")(t)}function $n(e){return Nr("Node",e,"getRootNode")()}function qn(e){return !e||!("host"in e)?null:le("ShadowRoot",e,"host")}function Zn(e){return e.styleSheets}function Yn(e){return !e||!("shadowRoot"in e)?null:le("Element",e,"shadowRoot")}function Xn(e,t){return le("Element",e,"querySelector")(t)}function Jn(e,t){return le("Element",e,"querySelectorAll")(t)}function Dr(){return [Xt("MutationObserver").constructor,Ar.MutationObserver??(()=>{})]}var Ve=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ve=()=>new Date().getTime());function Re(e,t,r){try{if(!(t in e))return ()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n;}}catch{return ()=>{}}}var w={ownerDocument:zn,childNodes:Un,parentNode:Pn,parentElement:Fn,textContent:Bn,firstChild:Wn,lastChild:Hn,nextSibling:Gn,previousSibling:jn,contains:Vn,getRootNode:$n,host:qn,styleSheets:Zn,shadowRoot:Yn,querySelector:Xn,querySelectorAll:Jn,nowTimestamp:Ve,mutationObserverCtor:Dr,patch:Re};function Lr(e){return e.nodeType===e.ELEMENT_NODE}function He(e){let t=e&&"host"in e&&"mode"in e&&w.host(e)||null;return !!(t&&"shadowRoot"in t&&w.shadowRoot(t)===e)}function Ge(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Kn(e){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}function Qn(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Pt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>_r(i,r)).join("");return Kn(n)}catch{return null}}function _r(e,t){if(ti(e)){let r;try{r=Pt(e.styleSheet)||Qn(e);}catch{r=e.cssText;}return e.styleSheet.href?ht(r,e.styleSheet.href):r}else {let r=e.cssText;return ri(e)&&e.selectorText.includes(":")&&(r=ei(r)),t?ht(r,t):r}}function ei(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function ti(e){return "styleSheet"in e}function ri(e){return "selectorText"in e}var ut=class{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap);}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n));}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r);}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i);}this.idNodeMap.set(t,r);}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}};function ni(){return new ut}function ct({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:s}){let o=i||"",c=n&&ve(n);return (t[r.toLowerCase()]||c&&t[c])&&(s?o=s(o,e):o="*".repeat(o.length)),o}function ve(e){return e.toLowerCase()}var Sr="__rrweb_original__";function ii(e){let t=e.getContext("2d");if(!t)return true;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let s=t.getImageData,o=Sr in s?s[Sr]:s;if(new Uint32Array(o.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(a=>a!==0))return false}return true}function ft(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ve(t):null}function zr(e,t){let r;try{r=new URL(e,t??window.location.href);}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function si(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var oi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ai=/^(?:[a-z+]+:)?\/\//i,li=/^www\..*/i,ui=/^(data:)([^,]*),(.*)/i;function ht(e,t){return (e||"").replace(oi,(r,n,i,s,o,c)=>{let a=i||o||c,f=n||s||"";if(!a)return r;if(ai.test(a)||li.test(a))return `url(${f}${a}${f})`;if(ui.test(a))return `url(${f}${a}${f})`;if(a[0]==="/")return `url(${f}${si(t)+a}${f})`;let l=a.split("#")[0],h=a.substring(l.length),d=t.split("#")[0].split("/"),p=l.split("/");d.pop();for(let m of p)m!=="."&&(m===".."?d.pop():d.push(m));return `url(${f}${d.join("/")}${h}${f})`})}function it(e,t=false){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function ci(e,t,r=false){let n=Array.from(t.childNodes),i=[],s=0;if(n.length>1&&e&&typeof e=="string"){let o=it(e,r),c=o.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&typeof n[a].textContent=="string"){let f=it(n[a].textContent,r),l=100,h=3;for(;h<f.length&&(f[h].match(/[a-zA-Z0-9]/)||f.indexOf(f.substring(0,h),1)!==-1);h++);for(;h<f.length;h++){let d=f.substring(0,h),p=o.split(d),m=-1;if(p.length===2)m=p[0].length;else if(p.length>2&&p[0]===""&&n[a-1].textContent!=="")m=o.indexOf(d,1);else if(p.length===1){if(d=d.substring(0,d.length-1),p=o.split(d),p.length<=1)return i.push(e),i;h=l+1;}else h===f.length-1&&(m=o.indexOf(d));if(p.length>=2&&h>l){let u=n[a-1].textContent;if(u&&typeof u=="string"){let v=it(u).length;m=o.indexOf(d,v);}m===-1&&(m=p[0].length);}if(m!==-1){let u=Math.floor(m/c);for(;u>0&&u<e.length;){if(s+=1,s>50*n.length)return i.push(e),i;let v=it(e.substring(0,u),r);if(v.length===m){i.push(e.substring(0,u)),e=e.substring(u),o=o.substring(m);break}else v.length<m?u+=Math.max(1,Math.floor((m-v.length)/c)):u-=Math.max(1,Math.floor((v.length-m)*c));}break}}}}return i.push(e),i}function fi(e,t){return ci(e,t).join("/* rr_split */")}var hi=1,di=new RegExp("[^a-z0-9-_:]"),dt=-2;function Ur(){return hi++}function pi(e){if(e instanceof HTMLFormElement)return "form";let t=ve(e.tagName);return di.test(t)?"div":t}var xe,wr,mi=/^[^ \t\n\r\u000c]+/,yi=/^[, \t\n\r\u000c]+/;function gi(e,t){if(t.trim()==="")return t;let r=0;function n(s){let o,c=s.exec(t.substring(r));return c?(o=c[0],r+=o.length,o):""}let i=[];for(;n(yi),!(r>=t.length);){let s=n(mi);if(s.slice(-1)===",")s=Oe(e,s.substring(0,s.length-1)),i.push(s);else {let o="";s=Oe(e,s);let c=false;for(;;){let a=t.charAt(r);if(a===""){i.push((s+o).trim());break}else if(c)a===")"&&(c=false);else if(a===","){r+=1,i.push((s+o).trim());break}else a==="("&&(c=true);o+=a,r+=1;}}}return i.join(", ")}var Cr=new WeakMap;function Oe(e,t){return !t||t.trim()===""?t:Jt(e,t)}function vi(e){return !!(e.tagName==="svg"||e.ownerSVGElement)}function Jt(e,t){let r=Cr.get(e);if(r||(r=e.createElement("a"),Cr.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Pr(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Oe(e,n):r==="srcset"?gi(e,n):r==="style"?ht(n,Jt(e)):t==="object"&&r==="data"?Oe(e,n):n)}function Fr(e,t,r){return ["video","audio"].includes(e)&&ve(t)==="autoplay"}function bi(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return !0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return !0}if(r)return e.matches(r)}catch{}return false}function pt(e,t,r){if(!e)return false;if(e.nodeType!==e.ELEMENT_NODE)return r?pt(w.parentNode(e),t,r):false;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return true}return r?pt(w.parentNode(e),t,r):false}function Br(e,t,r,n){let i;if(Lr(e)){if(i=e,!w.childNodes(i).length)return false}else {if(w.parentElement(e)===null)return false;i=w.parentElement(e);}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return !0}else if(i.classList.contains(t))return !0}else if(pt(i,t,n))return !0;if(r){if(n){if(i.closest(r))return !0}else if(i.matches(r))return !0}}catch{}return false}function Si(e,t,r){let n=e.contentWindow;if(!n)return;let i=false,s;try{s=n.document.readyState;}catch{return}if(s!=="complete"){let c=setTimeout(()=>{i||(t(),i=true);},r);e.addEventListener("load",()=>{clearTimeout(c),i=true,t();});return}let o="about:blank";if(n.location.href!==o||e.src===o||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t);}function wi(e,t,r){let n=false,i;try{i=e.sheet;}catch{return}if(i)return;let s=setTimeout(()=>{n||(t(),n=true);},r);e.addEventListener("load",()=>{clearTimeout(s),n=true,t();});}function Ci(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:o,inlineStylesheet:c,maskInputOptions:a={},maskTextFn:f,maskInputFn:l,dataURLOptions:h={},inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:u=false,cssCaptured:v=false}=t,C=Mi(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Y.Document,childNodes:[],compatMode:e.compatMode}:{type:Y.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return {type:Y.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return Ei(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:c,maskInputOptions:a,maskInputFn:l,dataURLOptions:h,inlineImages:d,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:u,rootId:C});case e.TEXT_NODE:return Ri(e,{doc:r,needsMask:o,maskTextFn:f,rootId:C,cssCaptured:v});case e.CDATA_SECTION_NODE:return {type:Y.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return {type:Y.Comment,textContent:w.textContent(e)||"",rootId:C};default:return false}}function Mi(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Ri(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:s}=t,o=w.parentNode(e),c=o&&o.tagName,a="",f=c==="STYLE"?true:void 0,l=c==="SCRIPT"?true:void 0;return l?a="SCRIPT_PLACEHOLDER":s||(a=w.textContent(e),f&&a&&(a=ht(a,Jt(t.doc)))),!f&&!l&&a&&r&&(a=n?n(a,w.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Y.Text,textContent:a||"",rootId:i}}function Ei(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:s,maskInputOptions:o={},maskInputFn:c,dataURLOptions:a={},inlineImages:f,recordCanvas:l,keepIframeSrcFn:h,newlyAddedElement:d=false,rootId:p}=t,m=bi(e,n,i),u=pi(e),v={},C=e.attributes.length;for(let y=0;y<C;y++){let M=e.attributes[y];Fr(u,M.name,M.value)||(v[M.name]=Pr(r,u,ve(M.name),M.value));}if(u==="link"&&s){let y=Array.from(r.styleSheets).find(I=>I.href===e.href),M=null;y&&(M=Pt(y)),M&&(delete v.rel,delete v.href,v._cssText=M);}if(u==="style"&&e.sheet){let y=Pt(e.sheet);y&&(e.childNodes.length>1&&(y=fi(y,e)),v._cssText=y);}if(["input","textarea","select"].includes(u)){let y=e.value,M=e.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&y?v.value=ct({element:e,type:ft(e),tagName:u,value:y,maskInputOptions:o,maskInputFn:c}):M&&(v.checked=M);}if(u==="option"&&(e.selected&&!o.select?v.selected=true:delete v.selected),u==="dialog"&&e.open&&(v.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),u==="canvas"&&l){if(e.__context==="2d")ii(e)||(v.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let y=e.toDataURL(a.type,a.quality),M=r.createElement("canvas");M.width=e.width,M.height=e.height;let I=M.toDataURL(a.type,a.quality);y!==I&&(v.rr_dataURL=y);}}if(u==="img"&&f){xe||(xe=r.createElement("canvas"),wr=xe.getContext("2d"));let y=e,M=y.currentSrc||y.getAttribute("src")||"<unknown-src>",I=y.crossOrigin,x=()=>{y.removeEventListener("load",x);try{xe.width=y.naturalWidth,xe.height=y.naturalHeight,wr.drawImage(y,0,0),v.rr_dataURL=xe.toDataURL(a.type,a.quality);}catch(k){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);return}else console.warn(`Cannot inline img src=${M}! Error: ${k}`);}y.crossOrigin==="anonymous"&&(I?v.crossOrigin=I:y.removeAttribute("crossorigin"));};y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);}if(["audio","video"].includes(u)){let y=v;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume;}if(d||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),m){let{width:y,height:M}=e.getBoundingClientRect();v={class:v.class,rr_width:`${y}px`,rr_height:`${M}px`};}u==="iframe"&&!h(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src);let b;try{customElements.get(u)&&(b=!0);}catch{}return {type:Y.Element,tagName:u,attributes:v,childNodes:[],isSVG:vi(e)||void 0,needBlock:m,rootId:p,isCustom:b}}function G(e){return e==null?"":e.toLowerCase()}function Wr(e){return e===true||e==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Ii(e,t){if(t.comment&&e.type===Y.Comment)return true;if(e.type===Y.Element){if(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"&&zr(e.attributes.href)==="js"))return true;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(G(e.attributes.name).match(/^msapplication-tile(image|color)$/)||G(e.attributes.name)==="application-name"||G(e.attributes.rel)==="icon"||G(e.attributes.rel)==="apple-touch-icon"||G(e.attributes.rel)==="shortcut icon")))return true;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&G(e.attributes.name).match(/^description|keywords$/))return true;if(t.headMetaSocial&&(G(e.attributes.property).match(/^(og|twitter|fb):/)||G(e.attributes.name).match(/^(og|twitter):/)||G(e.attributes.name)==="pinterest"))return true;if(t.headMetaRobots&&(G(e.attributes.name)==="robots"||G(e.attributes.name)==="googlebot"||G(e.attributes.name)==="bingbot"))return true;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return true;if(t.headMetaAuthorship&&(G(e.attributes.name)==="author"||G(e.attributes.name)==="generator"||G(e.attributes.name)==="framework"||G(e.attributes.name)==="publisher"||G(e.attributes.name)==="progid"||G(e.attributes.property).match(/^article:/)||G(e.attributes.property).match(/^product:/)))return true;if(t.headMetaVerification&&(G(e.attributes.name)==="google-site-verification"||G(e.attributes.name)==="yandex-verification"||G(e.attributes.name)==="csrf-token"||G(e.attributes.name)==="p:domain_verify"||G(e.attributes.name)==="verify-v1"||G(e.attributes.name)==="verification"||G(e.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function Ae(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:o,maskTextSelector:c,skipChild:a=false,inlineStylesheet:f=true,maskInputOptions:l={},maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m={},inlineImages:u=false,recordCanvas:v=false,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y=5e3,onStylesheetLoad:M,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>false,newlyAddedElement:k=false,cssCaptured:E=false}=t,{needsMask:R}=t,{preserveWhiteSpace:B=true}=t;R||(R=Br(e,o,c,R===void 0));let A=Ci(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,dataURLOptions:m,inlineImages:u,recordCanvas:v,keepIframeSrcFn:x,newlyAddedElement:k,cssCaptured:E});if(!A)return console.warn(e,"not serialized"),null;let T;n.hasNode(e)?T=n.getId(e):Ii(A,p)||!B&&A.type===Y.Text&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?T=dt:T=Ur();let S=Object.assign(A,{id:T});if(n.add(e,S),T===dt)return null;C&&C(e);let L=!a;if(S.type===Y.Element){L=L&&!S.needBlock,delete S.needBlock;let U=w.shadowRoot(e);U&&Ge(U)&&(S.isShadowHost=true);}if((S.type===Y.Document||S.type===Y.Element)&&L){p.headWhitespace&&S.type===Y.Element&&S.tagName==="head"&&(B=false);let U={doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:c,skipChild:a,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:u,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x,cssCaptured:false};if(!(S.type===Y.Element&&S.tagName==="textarea"&&S.attributes.value!==void 0)){S.type===Y.Element&&S.attributes._cssText!==void 0&&typeof S.attributes._cssText=="string"&&(U.cssCaptured=true);for(let q of Array.from(w.childNodes(e))){let Z=Ae(q,U);Z&&S.childNodes.push(Z);}}let N=null;if(Lr(e)&&(N=w.shadowRoot(e)))for(let q of Array.from(w.childNodes(N))){let Z=Ae(q,U);Z&&(Ge(N)&&(Z.isShadow=true),S.childNodes.push(Z));}}let j=w.parentNode(e);return j&&He(j)&&Ge(j)&&(S.isShadow=true),S.type===Y.Element&&S.tagName==="iframe"&&Si(e,()=>{let U=e.contentDocument;if(U&&b){let N=Ae(U,{doc:U,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:c,skipChild:false,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:u,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x});N&&b(e,N);}},y),S.type===Y.Element&&S.tagName==="link"&&typeof S.attributes.rel=="string"&&(S.attributes.rel==="stylesheet"||S.attributes.rel==="preload"&&typeof S.attributes.href=="string"&&zr(S.attributes.href)==="css")&&wi(e,()=>{if(M){let U=Ae(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:R,maskTextClass:o,maskTextSelector:c,skipChild:false,inlineStylesheet:f,maskInputOptions:l,maskTextFn:h,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:u,recordCanvas:v,preserveWhiteSpace:B,onSerialize:C,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:I,keepIframeSrcFn:x});U&&M(e,U);}},I),S}function xi(e,t){let{mirror:r=new ut,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:o=null,inlineStylesheet:c=true,inlineImages:a=false,recordCanvas:f=false,maskAllInputs:l=false,maskTextFn:h,maskInputFn:d,slimDOM:p=false,dataURLOptions:m,preserveWhiteSpace:u,onSerialize:v,onIframeLoad:C,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:I=()=>false}=t,x=l===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:l===false?{password:true}:l,k=Wr(p);return Ae(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:s,maskTextSelector:o,skipChild:false,inlineStylesheet:c,maskInputOptions:x,maskTextFn:h,maskInputFn:d,slimDOMOptions:k,dataURLOptions:m,inlineImages:a,recordCanvas:f,preserveWhiteSpace:u,onSerialize:v,onIframeLoad:C,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:I,newlyAddedElement:false})}var Ft=class e{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType");}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return false;if(t===this)return true}else return false;for(;t.parentNode;){if(t.parentNode===this)return true;t=t.parentNode;}return false}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return "RRNode"}};function ee(e,t,r=document){let n={capture:true,passive:true};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Te=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`,Mr={map:{},getId(){return console.error(Te),-1},getNode(){return console.error(Te),null},removeNodeFromMap(){console.error(Te);},has(){return console.error(Te),false},reset(){console.error(Te);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Mr=new Proxy(Mr,{get(e,t,r){return t==="map"&&console.error(Te),Reflect.get(e,t,r)}}));function $e(e,t,r={}){let n=null,i=0;return function(...s){let o=Date.now();!i&&r.leading===false&&(i=o);let c=t-(o-i),a=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),i=o,e.apply(a,s)):!n&&r.trailing!==false&&(n=setTimeout(()=>{i=r.leading===false?0:Date.now(),n=null,e.apply(a,s);},c));}}function vt(e,t,r,n,i=window){let s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(o){setTimeout(()=>{r.set.call(this,o);},0),s&&s.set&&s.set.call(this,o);}}),()=>vt(e,t,s||{},true)}function Hr(e){var t,r,n,i;let s=e.document;return {left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=w.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((n=w.parentElement(s.body))==null?void 0:n.scrollTop)||((i=s?.body)==null?void 0:i.scrollTop)||0}}function Gr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function jr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Vr(e){return e?e.nodeType===e.ELEMENT_NODE?e:w.parentElement(e):null}function te(e,t,r,n){if(!e)return false;let i=Vr(e);if(!i)return false;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return !0}else if(pt(i,t,n))return !0}catch{}return !!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function ki(e,t){return t.getId(e)!==-1}function zt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?true:t.getId(e)===dt}function $r(e,t){if(He(e))return false;let r=t.getId(e);if(!t.has(r))return true;let n=w.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?false:n?$r(n,t):true}function Bt(e){return !!e.changedTouches}function Ti(e=window){"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);}function qr(e,t){return !!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Zr(e,t){return !!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Wt(e){return e?e instanceof Ft&&"shadowRoot"in e?!!e.shadowRoot:!!w.shadowRoot(e):false}var Ht=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map);}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};function Yr(e){var t;let r=null;return "getRootNode"in e&&((t=w.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&w.host(w.getRootNode(e))&&(r=w.host(w.getRootNode(e))),r}function Oi(e){let t=e,r;for(;r=Yr(t);)t=r;return t}function Ai(e){let t=w.ownerDocument(e);if(!t)return false;let r=Oi(e);return w.contains(t,r)}function Xr(e){let t=w.ownerDocument(e);return t?w.contains(t,e)||Ai(e):false}var Rr=(e,t)=>`${e}@${t}`,Gt=class{constructor(){g(this,"frozen",false),g(this,"locked",false),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit();}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let d of this.movedSet){let p=w.parentNode(d);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(d);}let n=null,i=null,s=-1,o=null,c=false,a=new Set,f=this.addedSet.values(),l=f.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(w.previousSibling(n)))o=n,n=w.previousSibling(n);else {for(this.addedSet.has(l.value)||(l=f.next()),n=l.value;;){if(i=w.parentNode(n),this.addedSet.has(i)){n=i;continue}break}if(a.has(i))i=null;else if(i){if(Xr(i)?(c=Er(this.droppedSet,i)||this.removesSubTreeCache.has(i),c&&Er(this.movedSet,n)&&(c=false)):c=true,this.addedSet.has(w.lastChild(i)))n=w.lastChild(i),o=null;else for(;;){if(o=w.nextSibling(n),this.addedSet.has(o)){n=o;continue}break}if(s=He(i)?this.mirror.getId(Yr(n)):this.mirror.getId(i),s===-1&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let u=w.host(i);s=this.mirror.getId(u);}}}if(this.addedSet.delete(n),!i||s===-1){a.add(n);continue}else if(c){this.droppedSet.add(n);continue}let d=false;if(n.nodeType===Node.TEXT_NODE){let u=i.tagName;if(u==="TEXTAREA")continue;u==="STYLE"&&r.has(s)&&(d=true);}let p=o?this.mirror.getId(o):null;for(;p===dt;)o=o&&w.nextSibling(o),p=o&&this.mirror.getId(o);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",o),n=null;continue}let m=Ae(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:u=>{qr(u,this.mirror)&&this.iframeManager.addIframe(u),Zr(u,this.mirror)&&this.stylesheetManager.trackLinkElement(u),Wt(n)&&this.shadowDomManager.addShadowRoot(w.shadowRoot(n),this.doc);},onIframeLoad:(u,v)=>{this.iframeManager.attachIframe(u,v),this.shadowDomManager.observeAttachShadow(u);},onStylesheetLoad:(u,v)=>{this.stylesheetManager.attachLinkElement(u,v);},cssCaptured:d});m&&(t.push({parentId:s,nextId:p,node:m}),r.add(m.id));}let h={texts:this.texts.map(d=>{let p=d.node,m=w.parentNode(p);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(p),value:d.value}}).filter(d=>!r.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{let{attributes:p}=d;if(typeof p.style=="string"){let m=JSON.stringify(d.styleDiff),u=JSON.stringify(d._unchangedStyles);m.length<p.style.length&&(m+u).split("var(").length===p.style.split("var(").length&&(p.style=d.styleDiff);}return {id:this.mirror.getId(d.node),attributes:p}}).filter(d=>!r.has(d.id)).filter(d=>this.mirror.has(d.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(h));}),g(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(w.childNodes(t),i=>w.textContent(i)||"").join("");r.attributes.value=ct({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ft(t),value:n,maskInputFn:this.maskInputFn});}),g(this,"processMutation",t=>{if(!zt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case "characterData":{let r=w.textContent(t.target);!te(t.target,this.blockClass,this.blockSelector,false)&&r!==t.oldValue&&this.texts.push({value:Br(t.target,this.maskTextClass,this.maskTextSelector,true)&&r?this.maskTextFn?this.maskTextFn(r,Vr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case "attributes":{let r=t.target,n=ve(r.tagName),i=t.attributeName,s=t.target.getAttribute(i);if(i==="value"){let c=ft(r);s=ct({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:s,maskInputFn:this.maskInputFn});}if(te(t.target,this.blockClass,this.blockSelector,false)||s===t.oldValue)return;let o=this.attributeMap.get(t.target);if(n==="iframe"&&i==="src"&&!this.keepIframeSrcFn(s))if(!r.contentDocument)i="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),i==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Fr(n,i))if(o.attributes[i]=Pr(this.doc,n,ve(i),s),i==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument();}catch{this.unattachedDoc=this.doc;}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let a of Array.from(r.style)){let f=r.style.getPropertyValue(a),l=r.style.getPropertyPriority(a);f!==c.style.getPropertyValue(a)||l!==c.style.getPropertyPriority(a)?l===""?o.styleDiff[a]=f:o.styleDiff[a]=[f,l]:o._unchangedStyles[a]=[f,l];}for(let a of Array.from(c.style))r.style.getPropertyValue(a)===""&&(o.styleDiff[a]=false);}else i==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case "childList":{if(te(t.target,this.blockClass,this.blockSelector,true))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=He(t.target)?this.mirror.getId(w.host(t.target)):this.mirror.getId(t.target);te(t.target,this.blockClass,this.blockSelector,false)||zt(r,this.mirror,this.slimDOMOptions)||!ki(r,this.mirror)||(this.addedSet.has(r)?(jt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||$r(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Rr(n,i)]?jt(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:He(t.target)&&Ge(t.target)?true:void 0}),Ni(r,this.removesSubTreeCache))),this.mapRemoves.push(r));});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(zt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Rr(this.mirror.getId(t),n)]=true);}else this.addedSet.add(t),this.droppedSet.delete(t);te(t,this.blockClass,this.blockSelector,false)||(w.childNodes(t).forEach(n=>this.genAdds(n)),Wt(t)&&w.childNodes(w.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t);}));}});}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function jt(e,t){e.delete(t),w.childNodes(t).forEach(r=>jt(e,r));}function Ni(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),w.childNodes(n).forEach(i=>r.push(i)));}}function Er(e,t){return e.size===0?false:Jr(e,t)}function Jr(e,t){if(e.has(t))return true;let r=w.parentNode(t);return r?Jr(e,r):false}var je;function Di(e){je=e;}function Li(){je=void 0;}var D=e=>je?(...r)=>{try{return e(...r)}catch(n){if(je&&je(n)===true)return;throw n}}:e,Me=[];function qe(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Kr(e,t){let r=new Gt;Me.push(r),r.init(e);let[n,i]=Dr(),s=new n(D(r.processMutations.bind(r)));return s.observe(t,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),[s,i]}function _i({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===false)return ()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,o=[],c,a=$e(D(h=>{let d=Date.now()-c;e(o.map(p=>(p.timeOffset-=d,p)),h),o=[],c=null;}),s),f=D($e(D(h=>{let d=qe(h),{clientX:p,clientY:m}=Bt(h)?h.changedTouches[0]:h;c||(c=Ve()),o.push({x:p,y:m,id:n.getId(d),timeOffset:Ve()-c}),a(typeof DragEvent<"u"&&h instanceof DragEvent?O.Drag:h instanceof MouseEvent?O.MouseMove:O.TouchMove);}),i,{trailing:!1})),l=[ee("mousemove",f,r),ee("touchmove",f,r),ee("drag",f,r)];return D(()=>{l.forEach(h=>h());})}function zi({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){if(s.mouseInteraction===false)return ()=>{};let o=s.mouseInteraction===true||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],a=null,f=l=>h=>{let d=qe(h);if(te(d,n,i,true))return;let p=null,m=l;if("pointerType"in h){switch(h.pointerType){case "mouse":p=me.Mouse;break;case "touch":p=me.Touch;break;case "pen":p=me.Pen;break}p===me.Touch?se[l]===se.MouseDown?m="TouchStart":se[l]===se.MouseUp&&(m="TouchEnd"):me.Pen;}else Bt(h)&&(p=me.Touch);p!==null?(a=p,(m.startsWith("Touch")&&p===me.Touch||m.startsWith("Mouse")&&p===me.Mouse)&&(p=null)):se[l]===se.Click&&(p=a,a=null);let u=Bt(h)?h.changedTouches[0]:h;if(!u)return;let v=r.getId(d),{clientX:C,clientY:b}=u;D(e)({type:se[m],id:v,x:C,y:b,...p!==null&&{pointerType:p}});};return Object.keys(se).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&o[l]!==false).forEach(l=>{let h=ve(l),d=f(l);if(window.PointerEvent)switch(se[l]){case se.MouseDown:case se.MouseUp:h=h.replace("mouse","pointer");break;case se.TouchStart:case se.TouchEnd:return}c.push(ee(h,d,t));}),D(()=>{c.forEach(l=>l());})}function Qr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:s}){let o=D($e(D(c=>{let a=qe(c);if(!a||te(a,n,i,!0))return;let f=r.getId(a);if(a===t&&t.defaultView){let l=Hr(t.defaultView);e({id:f,x:l.left,y:l.top});}else e({id:f,x:a.scrollLeft,y:a.scrollTop});}),s.scroll||100));return ee("scroll",o,t)}function Ui({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=D($e(D(()=>{let s=Gr(),o=jr();(r!==s||n!==o)&&(e({width:Number(o),height:Number(s)}),r=s,n=o);}),200));return ee("resize",i,t)}var Pi=["INPUT","TEXTAREA","SELECT"],Ir=new WeakMap;function Fi({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:s,ignoreSelector:o,maskInputOptions:c,maskInputFn:a,sampling:f,userTriggeredOnInput:l}){function h(b){let y=qe(b),M=b.isTrusted,I=y&&y.tagName;if(y&&I==="OPTION"&&(y=w.parentElement(y)),!y||!I||Pi.indexOf(I)<0||te(y,n,i,true)||y.classList.contains(s)||o&&y.matches(o))return;let x=y.value,k=false,E=ft(y)||"";E==="radio"||E==="checkbox"?k=y.checked:(c[I.toLowerCase()]||c[E])&&(x=ct({element:y,maskInputOptions:c,tagName:I,type:E,value:x,maskInputFn:a})),d(y,l?{text:x,isChecked:k,userTriggered:M}:{text:x,isChecked:k});let R=y.name;E==="radio"&&R&&k&&t.querySelectorAll(`input[type="radio"][name="${R}"]`).forEach(B=>{if(B!==y){let A=B.value;d(B,l?{text:A,isChecked:!k,userTriggered:false}:{text:A,isChecked:!k});}});}function d(b,y){let M=Ir.get(b);if(!M||M.text!==y.text||M.isChecked!==y.isChecked){Ir.set(b,y);let I=r.getId(b);D(e)({...y,id:I});}}let m=(f.input==="last"?["change"]:["input","change"]).map(b=>ee(b,D(h),t)),u=t.defaultView;if(!u)return ()=>{m.forEach(b=>b());};let v=u.Object.getOwnPropertyDescriptor(u.HTMLInputElement.prototype,"value"),C=[[u.HTMLInputElement.prototype,"value"],[u.HTMLInputElement.prototype,"checked"],[u.HTMLSelectElement.prototype,"value"],[u.HTMLTextAreaElement.prototype,"value"],[u.HTMLSelectElement.prototype,"selectedIndex"],[u.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&m.push(...C.map(b=>vt(b[0],b[1],{set(){D(h)({target:this,isTrusted:false});}},false,u))),D(()=>{m.forEach(b=>b());})}function mt(e){let t=[];function r(n,i){if(st("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||st("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||st("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||st("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let o=Array.from(n.parentRule.cssRules).indexOf(n);return i.unshift(o),r(n.parentRule,i)}else if(n.parentStyleSheet){let o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(o);}return i}return r(e,t)}function ge(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Bi({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return ()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:D((l,h,d)=>{let[p,m]=d,{id:u,styleId:v}=ge(h,t,r.styleMirror);return (u&&u!==-1||v&&v!==-1)&&e({id:u,styleId:v,adds:[{rule:p,index:m}]}),l.apply(h,d)})}),n.CSSStyleSheet.prototype.addRule=function(l,h,d=this.cssRules.length){let p=`${l} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,d])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:D((l,h,d)=>{let[p]=d,{id:m,styleId:u}=ge(h,t,r.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,removes:[{index:p}]}),l.apply(h,d)})}),n.CSSStyleSheet.prototype.removeRule=function(l){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[l])};let o;n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:D((l,h,d)=>{let[p]=d,{id:m,styleId:u}=ge(h,t,r.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,replace:p}),l.apply(h,d)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:D((l,h,d)=>{let[p]=d,{id:m,styleId:u}=ge(h,t,r.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,replaceSync:p}),l.apply(h,d)})}));let a={};ot("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(ot("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),ot("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),ot("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(a).forEach(([l,h])=>{f[l]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(f[l].insertRule,{apply:D((d,p,m)=>{let[u,v]=m,{id:C,styleId:b}=ge(p.parentStyleSheet,t,r.styleMirror);return (C&&C!==-1||b&&b!==-1)&&e({id:C,styleId:b,adds:[{rule:u,index:[...mt(p),v||0]}]}),d.apply(p,m)})}),h.prototype.deleteRule=new Proxy(f[l].deleteRule,{apply:D((d,p,m)=>{let[u]=m,{id:v,styleId:C}=ge(p.parentStyleSheet,t,r.styleMirror);return (v&&v!==-1||C&&C!==-1)&&e({id:v,styleId:C,removes:[{index:[...mt(p),u]}]}),d.apply(p,m)})});}),D(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=s,o&&(n.CSSStyleSheet.prototype.replace=o),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(a).forEach(([l,h])=>{h.prototype.insertRule=f[l].insertRule,h.prototype.deleteRule=f[l].deleteRule;});})}function en({mirror:e,stylesheetManager:t},r){var n,i,s;let o=null;r.nodeName==="#document"?o=e.getId(r):o=e.getId(w.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(s=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:s.ShadowRoot,a=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!c||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var f;return (f=a.get)==null?void 0:f.call(this)},set(f){var l;let h=(l=a.set)==null?void 0:l.call(this,f);if(o!==null&&o!==-1)try{t.adoptStyleSheets(f,o);}catch{}return h}}),D(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set});}))}function Wi({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:D((c,a,f)=>{var l;let[h,d,p]=f;if(r.has(h))return s.apply(a,[h,d,p]);let{id:m,styleId:u}=ge((l=a.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return (m&&m!==-1||u&&u!==-1)&&e({id:m,styleId:u,set:{property:h,value:d,priority:p},index:mt(a.parentRule)}),c.apply(a,f)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:D((c,a,f)=>{var l;let[h]=f;if(r.has(h))return o.apply(a,[h]);let{id:d,styleId:p}=ge((l=a.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return (d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,remove:{property:h},index:mt(a.parentRule)}),c.apply(a,f)})}),D(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o;})}function Hi({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:s}){let o=D(a=>$e(D(f=>{let l=qe(f);if(!l||te(l,t,r,!0))return;let{currentTime:h,volume:d,muted:p,playbackRate:m,loop:u}=l;e({type:a,id:n.getId(l),currentTime:h,volume:d,muted:p,playbackRate:m,loop:u});}),i.media||500)),c=[ee("play",o(ke.Play),s),ee("pause",o(ke.Pause),s),ee("seeked",o(ke.Seeked),s),ee("volumechange",o(ke.VolumeChange),s),ee("ratechange",o(ke.RateChange),s)];return D(()=>{c.forEach(a=>a());})}function Gi({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return ()=>{};let n=[],i=new WeakMap,s=r.FontFace;r.FontFace=function(a,f,l){let h=new s(a,f,l);return i.set(h,{family:a,buffer:typeof f!="string",descriptors:l,fontSource:typeof f=="string"?f:JSON.stringify(Array.from(new Uint8Array(f)))}),h};let o=Re(t.fonts,"add",function(c){return function(a){return setTimeout(D(()=>{let f=i.get(a);f&&(e(f),i.delete(a));}),0),c.apply(this,[a])}});return n.push(()=>{r.FontFace=s;}),n.push(o),D(()=>{n.forEach(c=>c());})}function ji(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e,o=true,c=D(()=>{let a=t.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let f=[],l=a.rangeCount||0;for(let h=0;h<l;h++){let d=a.getRangeAt(h),{startContainer:p,startOffset:m,endContainer:u,endOffset:v}=d;te(p,n,i,!0)||te(u,n,i,!0)||f.push({start:r.getId(p),startOffset:m,end:r.getId(u),endOffset:v});}s({ranges:f});});return c(),ee("selectionchange",c)}function Vi({doc:e,customElementCb:t}){let r=e.defaultView;return !r||!r.customElements?()=>{}:Re(r.customElements,"define",function(i){return function(s,o,c){try{t({define:{name:s}});}catch{console.warn(`Custom element callback failed for ${s}`);}return i.apply(this,[s,o,c])}})}function $i(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:o,inputCb:c,mediaInteractionCb:a,styleSheetRuleCb:f,styleDeclarationCb:l,canvasMutationCb:h,fontCb:d,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...u)=>{t.mutation&&t.mutation(...u),r(...u);},e.mousemoveCb=(...u)=>{t.mousemove&&t.mousemove(...u),n(...u);},e.mouseInteractionCb=(...u)=>{t.mouseInteraction&&t.mouseInteraction(...u),i(...u);},e.scrollCb=(...u)=>{t.scroll&&t.scroll(...u),s(...u);},e.viewportResizeCb=(...u)=>{t.viewportResize&&t.viewportResize(...u),o(...u);},e.inputCb=(...u)=>{t.input&&t.input(...u),c(...u);},e.mediaInteractionCb=(...u)=>{t.mediaInteaction&&t.mediaInteaction(...u),a(...u);},e.styleSheetRuleCb=(...u)=>{t.styleSheetRule&&t.styleSheetRule(...u),f(...u);},e.styleDeclarationCb=(...u)=>{t.styleDeclaration&&t.styleDeclaration(...u),l(...u);},e.canvasMutationCb=(...u)=>{t.canvasMutation&&t.canvasMutation(...u),h(...u);},e.fontCb=(...u)=>{t.font&&t.font(...u),d(...u);},e.selectionCb=(...u)=>{t.selection&&t.selection(...u),p(...u);},e.customElementCb=(...u)=>{t.customElement&&t.customElement(...u),m(...u);};}function qi(e,t={}){let r=e.doc.defaultView;if(!r)return ()=>{};$i(e,t);let n,i=()=>{};e.recordDOM&&([n,i]=Kr(e,e.doc));let s=_i(e),o=zi(e),c=Qr(e),a=Ui(e,{win:r}),f=Fi(e),l=Hi(e),h=()=>{},d=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(h=Bi(e,{win:r}),d=en(e,e.doc),p=Wi(e,{win:r}),e.collectFonts&&(m=Gi(e)));let u=ji(e),v=Vi(e),C=[];for(let b of e.plugins)C.push(b.observer(b.callback,r,b.options));return D(()=>{Me.forEach(b=>b.reset()),n?.disconnect(),i(),s(),o(),c(),a(),f(),l(),h(),d(),p(),m(),u(),v(),C.forEach(b=>b());})}function st(e){return typeof window[e]<"u"}function ot(e){return !!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var yt=class{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t;}getId(t,r,n,i){let s=n||this.getIdToRemoteIdMap(t),o=i||this.getRemoteIdToIdMap(t),c=s.get(r);return c||(c=this.generateIdFn(),s.set(r,c),o.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=i.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t);}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Vt=class{constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new yt(Ur)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new yt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(t){this.iframes.set(t,true),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t);}addLoadListener(t){this.loadListener=t;}attachIframe(t,r){var n,i;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument));}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let s=this.transformCrossOriginEvent(i,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout);}transformCrossOriginEvent(t,r){var n;switch(r.type){case z.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:z.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}}}case z.Meta:case z.Load:case z.DomContentLoaded:return false;case z.Plugin:return r;case z.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case z.IncrementalSnapshot:switch(r.data.source){case O.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(i.node,s);}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"]);}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"]);}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case O.Drag:case O.TouchMove:case O.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"]);}),r;case O.ViewportResize:return false;case O.MediaInteraction:case O.MouseInteraction:case O.Scroll:case O.CanvasMutation:case O.Input:return this.replaceIds(r.data,t,["id"]),r;case O.StyleSheetRule:case O.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case O.Font:return r;case O.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"]);}),r;case O.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"]);}),r}}return false}replace(t,r,n,i){for(let s of i)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}patchRootIdOnNode(t,r){t.type!==Y.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r);});}},$t=class{constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init();}init(){this.reset(),this.patchAttachShadow(Element,document);}addShadowRoot(t,r){if(!Ge(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[n]=Kr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Qr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(w.host(t))),this.restoreHandlers.push(en({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t));},0);}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument);}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Re(t.prototype,"attachShadow",function(i){return function(s){let o=i.call(this,s),c=w.shadowRoot(this);return c&&Xr(this)&&n.addShadowRoot(c,r),o}}));}reset(){this.restoreHandlers.forEach(t=>{try{t();}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet;}},Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(We=0;We<Ne.length;We++)Zi[Ne.charCodeAt(We)]=We;var We,Yi=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=Ne[t[r]>>2],i+=Ne[(t[r]&3)<<4|t[r+1]>>4],i+=Ne[(t[r+1]&15)<<2|t[r+2]>>6],i+=Ne[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i},xr=new Map;function Xi(e,t){let r=xr.get(e);return r||(r=new Map,xr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var tn=(e,t,r)=>{if(!e||!(nn(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=Xi(r,n),s=i.indexOf(e);return s===-1&&(s=i.length,i.push(e)),s};function at(e,t,r){if(e instanceof Array)return e.map(n=>at(n,t,r));if(e===null)return e;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 {rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,i=Yi(e);return {rr_type:n,base64:i}}else {if(e instanceof DataView)return {rr_type:e.constructor.name,args:[at(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return {rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return {rr_type:n,src:i}}else {if(e instanceof ImageData)return {rr_type:e.constructor.name,args:[at(e.data,t,r),e.width,e.height]};if(nn(e,t)||typeof e=="object"){let n=e.constructor.name,i=tn(e,t,r);return {rr_type:n,index:i}}}}return e}var rn=(e,t,r)=>e.map(n=>at(n,t,r)),nn=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Ji(e,t,r,n){let i=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of s)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!="function")continue;let c=Re(t.CanvasRenderingContext2D.prototype,o,function(a){return function(...f){return te(this.canvas,r,n,!0)||setTimeout(()=>{let l=rn(f,t,this);e(this.canvas,{type:De["2D"],property:o,args:l});},0),a.apply(this,f)}});i.push(c);}catch{let c=vt(t.CanvasRenderingContext2D.prototype,o,{set(a){e(this.canvas,{type:De["2D"],property:o,args:[a],setter:true});}});i.push(c);}return ()=>{i.forEach(o=>o());}}function Ki(e){return e==="experimental-webgl"?"webgl":e}function kr(e,t,r,n){let i=[];try{let s=Re(e.HTMLCanvasElement.prototype,"getContext",function(o){return function(c,...a){if(!te(this,t,r,!0)){let f=Ki(c);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(a[0]&&typeof a[0]=="object"){let l=a[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0);}else a.splice(0,1,{preserveDrawingBuffer:!0});}return o.apply(this,[c,...a])}});i.push(s);}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{i.forEach(s=>s());}}function Tr(e,t,r,n,i,s){let o=[],c=Object.getOwnPropertyNames(e);for(let a of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let f=Re(e,a,function(l){return function(...h){let d=l.apply(this,h);if(tn(d,s,this),"tagName"in this.canvas&&!te(this.canvas,n,i,!0)){let p=rn(h,s,this),m={type:t,property:a,args:p};r(this.canvas,m);}return d}});o.push(f);}catch{let f=vt(e,a,{set(l){r(this.canvas,{type:t,property:a,args:[l],setter:true});}});o.push(f);}return o}function Qi(e,t,r,n){let i=[];return typeof t.WebGLRenderingContext<"u"&&i.push(...Tr(t.WebGLRenderingContext.prototype,De.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Tr(t.WebGL2RenderingContext.prototype,De.WebGL2,e,r,n,t)),()=>{i.forEach(s=>s());}}var sn=`(function() {
4
+ "use strict";
5
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
6
+ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
7
+ for (var i = 0; i < chars.length; i++) {
8
+ lookup[chars.charCodeAt(i)] = i;
9
+ }
10
+ var encode = function(arraybuffer) {
11
+ var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
12
+ for (i2 = 0; i2 < len; i2 += 3) {
13
+ base64 += chars[bytes[i2] >> 2];
14
+ base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
15
+ base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
16
+ base64 += chars[bytes[i2 + 2] & 63];
17
+ }
18
+ if (len % 3 === 2) {
19
+ base64 = base64.substring(0, base64.length - 1) + "=";
20
+ } else if (len % 3 === 1) {
21
+ base64 = base64.substring(0, base64.length - 2) + "==";
22
+ }
23
+ return base64;
24
+ };
25
+ const lastBlobMap = /* @__PURE__ */ new Map();
26
+ const transparentBlobMap = /* @__PURE__ */ new Map();
27
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
28
+ const id = \`\${width}-\${height}\`;
29
+ if ("OffscreenCanvas" in globalThis) {
30
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
31
+ const offscreen = new OffscreenCanvas(width, height);
32
+ offscreen.getContext("2d");
33
+ const blob = await offscreen.convertToBlob(dataURLOptions);
34
+ const arrayBuffer = await blob.arrayBuffer();
35
+ const base64 = encode(arrayBuffer);
36
+ transparentBlobMap.set(id, base64);
37
+ return base64;
38
+ } else {
39
+ return "";
40
+ }
41
+ }
42
+ const worker = self;
43
+ worker.onmessage = async function(e) {
44
+ if ("OffscreenCanvas" in globalThis) {
45
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
46
+ const transparentBase64 = getTransparentBlobFor(
47
+ width,
48
+ height,
49
+ dataURLOptions
50
+ );
51
+ const offscreen = new OffscreenCanvas(width, height);
52
+ const ctx = offscreen.getContext("2d");
53
+ ctx.drawImage(bitmap, 0, 0);
54
+ bitmap.close();
55
+ const blob = await offscreen.convertToBlob(dataURLOptions);
56
+ const type = blob.type;
57
+ const arrayBuffer = await blob.arrayBuffer();
58
+ const base64 = encode(arrayBuffer);
59
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
60
+ lastBlobMap.set(id, base64);
61
+ return worker.postMessage({ id });
62
+ }
63
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
64
+ worker.postMessage({
65
+ id,
66
+ type,
67
+ base64,
68
+ width,
69
+ height
70
+ });
71
+ lastBlobMap.set(id, base64);
72
+ } else {
73
+ return worker.postMessage({ id: e.data.id });
74
+ }
75
+ };
76
+ })();
77
+ //# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
78
+ `,Or=typeof self<"u"&&self.Blob&&new Blob([sn],{type:"text/javascript;charset=utf-8"});function es(e){let t;try{if(t=Or&&(self.URL||self.webkitURL).createObjectURL(Or),!t)throw "";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t);}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(sn),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t);}}var qt=class{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",false),g(this,"locked",false),g(this,"processMutation",(a,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(f);});let{sampling:r="all",win:n,blockClass:i,blockSelector:s,recordCanvas:o,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&r==="all"&&this.initCanvasMutationObserver(n,i,s),o&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,s,{dataURLOptions:c});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(t,r,n,i,s){let o=kr(r,n,i,true),c=new Map,a=new es;a.onmessage=m=>{let{id:u}=m.data;if(c.set(u,false),!("base64"in m.data))return;let{base64:v,type:C,width:b,height:y}=m.data;this.mutationCb({id:u,type:De["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:C}]},0,0]}]});};let f=1e3/t,l=0,h,d=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(u=>{te(u,n,i,true)||m.push(u);}),m},p=m=>{if(l&&m-l<f){h=requestAnimationFrame(p);return}l=m,d().forEach(async u=>{var v;let C=this.mirror.getId(u);if(c.get(C)||u.width===0||u.height===0)return;if(c.set(C,true),["webgl","webgl2"].includes(u.__context)){let y=u.getContext(u.__context);((v=y?.getContextAttributes())==null?void 0:v.preserveDrawingBuffer)===false&&y.clear(y.COLOR_BUFFER_BIT);}let b=await createImageBitmap(u);a.postMessage({id:C,bitmap:b,width:u.width,height:u.height,dataURLOptions:s.dataURLOptions},[b]);}),h=requestAnimationFrame(p);};h=requestAnimationFrame(p),this.resetObservers=()=>{o(),cancelAnimationFrame(h);};}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=kr(t,r,n,false),s=Ji(this.processMutation.bind(this),t,r,n),o=Qi(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),s(),o();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t);};requestAnimationFrame(t);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(o=>{let{type:c,...a}=o;return a}),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:i}),this.pendingCanvasMutations.delete(t);}},Zt=class{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new Ht),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb;}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t);}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t));}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},i=[];for(let s of t){let o;this.styleMirror.has(s)?o=this.styleMirror.getId(s):(o=this.styleMirror.add(s),i.push({styleId:o,rules:Array.from(s.rules||CSSRule,(c,a)=>({rule:_r(c,s.href),index:a}))})),n.styleIds.push(o);}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(t){}},Yt=class{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",false);}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=true,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=false;})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r));}destroy(){}},$,lt,Ut,gt=false;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((gr=e.contentWindow)==null?void 0:gr.Array.from)||Array.from,document.body.removeChild(e);}}catch(e){console.debug("Unable to override Array.from",e);}var fe=ni();function Ee(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:s=null,ignoreClass:o="rr-ignore",ignoreSelector:c=null,maskTextClass:a="rr-mask",maskTextSelector:f=null,inlineStylesheet:l=true,maskAllInputs:h,maskInputOptions:d,slimDOMOptions:p,maskInputFn:m,maskTextFn:u,hooks:v,packFn:C,sampling:b={},dataURLOptions:y={},mousemoveWait:M,recordDOM:I=true,recordCanvas:x=false,recordCrossOriginIframes:k=false,recordAfter:E=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:R=false,collectFonts:B=false,inlineImages:A=false,plugins:T,keepIframeSrcFn:S=()=>false,ignoreCSSAttributes:L=new Set([]),errorHandler:j}=e;Di(j);let U=k?window.parent===window:true,N=false;if(!U)try{window.parent.document&&(N=!1);}catch{N=true;}if(U&&!t)throw new Error("emit function is required");if(!U&&!N)return ()=>{};M!==void 0&&b.mousemove===void 0&&(b.mousemove=M),fe.reset();let q=h===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:d!==void 0?d:{password:true},Z=Wr(p);Ti();let ye,J=0,he=_=>{for(let ie of T||[])ie.eventProcessor&&(_=ie.eventProcessor(_));return C&&!N&&(_=C(_)),_};$=(_,ie)=>{var W;let H=_;if(H.timestamp=Ve(),(W=Me[0])!=null&&W.isFrozen()&&H.type!==z.FullSnapshot&&!(H.type===z.IncrementalSnapshot&&H.data.source===O.Mutation)&&Me.forEach(oe=>oe.unfreeze()),U)t?.(he(H),ie);else if(N){let oe={type:"rrweb",event:he(H),origin:window.location.origin,isCheckout:ie};window.parent.postMessage(oe,"*");}if(H.type===z.FullSnapshot)ye=H,J=0;else if(H.type===z.IncrementalSnapshot){if(H.data.source===O.Mutation&&H.data.isAttachIframe)return;J++;let oe=n&&J>=n,F=r&&H.timestamp-ye.timestamp>r;(oe||F)&&lt(true);}};let Q=_=>{$({type:z.IncrementalSnapshot,data:{source:O.Mutation,..._}});},K=_=>$({type:z.IncrementalSnapshot,data:{source:O.Scroll,..._}}),V=_=>$({type:z.IncrementalSnapshot,data:{source:O.CanvasMutation,..._}}),X=_=>$({type:z.IncrementalSnapshot,data:{source:O.AdoptedStyleSheet,..._}}),re=new Zt({mutationCb:Q,adoptedStyleSheetCb:X}),ne=new Vt({mirror:fe,mutationCb:Q,stylesheetManager:re,recordCrossOriginIframes:k,wrappedEmit:$});for(let _ of T||[])_.getMirror&&_.getMirror({nodeMirror:fe,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});let Se=new Yt;Ut=new qt({recordCanvas:x,mutationCb:V,win:window,blockClass:i,blockSelector:s,mirror:fe,sampling:b.canvas,dataURLOptions:y});let we=new $t({mutationCb:Q,scrollCb:K,bypassOptions:{blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:f,inlineStylesheet:l,maskInputOptions:q,dataURLOptions:y,maskTextFn:u,maskInputFn:m,recordCanvas:x,inlineImages:A,sampling:b,slimDOMOptions:Z,iframeManager:ne,stylesheetManager:re,canvasManager:Ut,keepIframeSrcFn:S,processedNodeManager:Se},mirror:fe});lt=(_=false)=>{if(!I)return;$({type:z.Meta,data:{href:window.location.href,width:jr(),height:Gr()}},_),re.reset(),we.init(),Me.forEach(W=>W.lock());let ie=xi(document,{mirror:fe,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:f,inlineStylesheet:l,maskAllInputs:q,maskTextFn:u,maskInputFn:m,slimDOM:Z,dataURLOptions:y,recordCanvas:x,inlineImages:A,onSerialize:W=>{qr(W,fe)&&ne.addIframe(W),Zr(W,fe)&&re.trackLinkElement(W),Wt(W)&&we.addShadowRoot(w.shadowRoot(W),document);},onIframeLoad:(W,H)=>{ne.attachIframe(W,H),we.observeAttachShadow(W);},onStylesheetLoad:(W,H)=>{re.attachLinkElement(W,H);},keepIframeSrcFn:S});if(!ie)return console.warn("Failed to snapshot the document");$({type:z.FullSnapshot,data:{node:ie,initialOffset:Hr(window)}},_),Me.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,fe.getId(document));};try{let _=[],ie=H=>{var oe;return D(qi)({mutationCb:Q,mousemoveCb:(F,St)=>$({type:z.IncrementalSnapshot,data:{source:St,positions:F}}),mouseInteractionCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.MouseInteraction,...F}}),scrollCb:K,viewportResizeCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.ViewportResize,...F}}),inputCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.Input,...F}}),mediaInteractionCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.MediaInteraction,...F}}),styleSheetRuleCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.StyleSheetRule,...F}}),styleDeclarationCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.StyleDeclaration,...F}}),canvasMutationCb:V,fontCb:F=>$({type:z.IncrementalSnapshot,data:{source:O.Font,...F}}),selectionCb:F=>{$({type:z.IncrementalSnapshot,data:{source:O.Selection,...F}});},customElementCb:F=>{$({type:z.IncrementalSnapshot,data:{source:O.CustomElement,...F}});},blockClass:i,ignoreClass:o,ignoreSelector:c,maskTextClass:a,maskTextSelector:f,maskInputOptions:q,inlineStylesheet:l,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:A,userTriggeredOnInput:R,collectFonts:B,doc:H,maskInputFn:m,maskTextFn:u,keepIframeSrcFn:S,blockSelector:s,slimDOMOptions:Z,dataURLOptions:y,mirror:fe,iframeManager:ne,stylesheetManager:re,shadowDomManager:we,processedNodeManager:Se,canvasManager:Ut,ignoreCSSAttributes:L,plugins:((oe=T?.filter(F=>F.observer))==null?void 0:oe.map(F=>({observer:F.observer,options:F.options,callback:St=>$({type:z.Plugin,data:{plugin:F.name,payload:St}})})))||[]},v)};ne.addLoadListener(H=>{try{_.push(ie(H.contentDocument));}catch(oe){console.warn(oe);}});let W=()=>{lt(),_.push(ie(document)),gt=!0;};return ["interactive","complete"].includes(document.readyState)?W():(_.push(ee("DOMContentLoaded",()=>{$({type:z.DomContentLoaded,data:{}}),E==="DOMContentLoaded"&&W();})),_.push(ee("load",()=>{$({type:z.Load,data:{}}),E==="load"&&W();},window))),()=>{_.forEach(H=>{try{H();}catch(oe){String(oe).toLowerCase().includes("cross-origin")||console.warn(oe);}}),Se.destroy(),gt=!1,Li();}}catch(_){console.warn(_);}}Ee.addCustomEvent=(e,t)=>{if(!gt)throw new Error("please add custom event after start recording");$({type:z.Custom,data:{tag:e,payload:t}});};Ee.freezePage=()=>{Me.forEach(e=>e.freeze());};Ee.takeFullSnapshot=e=>{if(!gt)throw new Error("please take full snapshot after start recording");lt(e);};Ee.mirror=fe;var ts=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,on=/(?:\+\d{1,3}[\s.-]?)?(?:\(?\d{2,4}\)?[\s.-])\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g,rs=/\b(?:паспорт|passport|ssn)\s*[:#-]?\s*[A-Z0-9][A-Z0-9\s-]{4,}\b/gi,ns=/\b\d{4}\s\d{6}\b/g,is=/(?<!\d)(?:\d[ -]?){12,18}\d(?!\d)/g,an=/\b(?:card|карта|cc|pan)\s*[:#-]?\s*([0-9][0-9 -]{11,20}[0-9])\b/gi,ss=/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\b/g,os=/\bBearer\s+[A-Za-z0-9_\-\.=]{16,}\b/gi,as=/\b(?:api[_-]?key|auth[_-]?token|client[_-]?secret|private[_-]?key)\s*[:=]\s*['"]?[A-Za-z0-9_\-]{16,}['"]?/gi,dn=/token|email|phone|password|secret|key|card|cvv|cvc|ssn|auth/i;function ls(e){let t=0,r=false;for(let n=e.length-1;n>=0;n-=1){let i=e.charCodeAt(n)-48;if(i<0||i>9)return false;r&&(i*=2,i>9&&(i-=9)),t+=i,r=!r;}return t%10===0}function Ie(e,t,r){return e.lastIndex=0,t.replace(e,r)}function Le(e){if(e.length<6)return e;let t=e;return t.includes("eyJ")&&(t=Ie(ss,t,"[REDACTED_JWT]")),/(?:bearer)/i.test(t)&&(t=Ie(os,t,"Bearer [REDACTED_TOKEN]")),/(?:api[_-]?key|auth[_-]?token|client[_-]?secret|private[_-]?key)/i.test(t)&&(t=Ie(as,t,"[REDACTED_SECRET]")),/(?:card|карта|cc|pan)/i.test(t)&&(an.lastIndex=0,t=t.replace(an,(r,n)=>{let i=n.replace(/[ -]/g,"");return i.length>=12&&i.length<=19?r.replace(n,"[REDACTED_CARD]"):r})),/\d{4}/.test(t)&&(t=Ie(is,t,r=>{let n=r.replace(/[ -]/g,"");return n.length<13||n.length>19||!ls(n)?r:"[REDACTED_CARD]"})),t.includes("@")&&(t=Ie(ts,t,"[REDACTED_EMAIL]")),/\d{3,}/.test(t)&&(on.lastIndex=0,t=t.replace(on,r=>{let n=r.replace(/\D/g,"");return n.length<10||n.length>15?r:"[REDACTED_PHONE]"})),/(?:паспорт|passport|ssn)/i.test(t)&&(t=Ie(rs,t,"[REDACTED_DOCUMENT]")),/\d{4}\s\d{6}/.test(t)&&(t=Ie(ns,t,"[REDACTED_DOCUMENT]")),t}function _e(e){let t=Le(e);return t!==e?t:"*".repeat(e.length)}function be(e){return "*".repeat(e.length)}function pn(e){try{let t=/^[a-z][a-z0-9+.-]*:/i.test(e),r=new URL(e,"https://assets.invalid"),n=[];r.searchParams.forEach((i,s)=>{dn.test(s)&&n.push(s);});for(let i of n)r.searchParams.delete(i);return t?r.toString():`${r.pathname}${r.search}${r.hash}`}catch{return e.replace(/([?&])((?:access_)?token|email|phone|password|secret|key|card|cvv|cvc|ssn)=[^&#]*/gi,"$1$2=")}}function us(e){return e.toLowerCase().includes("url(")?e.replace(/url\((['"]?)(.*?)\1\)/gi,(t,r,n)=>`url(${r}${pn(n)}${r})`):e}function ln(e,t){return e.match(new RegExp(`(?:^|;)\\s*${t}\\s*:\\s*([^;]+)`,"i"))?.[1]?.trim()||void 0}function bt(e,t){let r=e.class??e.className;return typeof r!="string"?false:r.split(/\s+/).includes(t)}function un(e){return "data-askdepth-block"in e||"data-rr-block"in e||bt(e,"askdepth-block")||bt(e,"rr-block")}function cn(e){return "data-askdepth-mask"in e||"data-rr-mask"in e||bt(e,"askdepth-mask")||bt(e,"rr-mask")}function fn(e){return "contenteditable"in e&&e.contenteditable!=="false"&&e.contenteditable!==false}function hn(e,t){let r={};for(let[n,i]of Object.entries(e)){if(n==="placeholder"){r[n]="";continue}if(n==="value"&&typeof i=="string"){r[n]=t?be(i):_e(i);continue}if((n==="aria-label"||n==="title"||n==="alt")&&typeof i=="string"){r[n]=t?be(i):Le(i);continue}if((n==="src"||n==="href")&&typeof i=="string"){r[n]=i.includes("?")?pn(i):i;continue}if(n==="style"&&typeof i=="string"){r[n]=us(i);continue}if(n.startsWith("data-")&&dn.test(n)&&typeof i=="string"){r[n]=be(i);continue}r[n]=i;}return r}var Ze=class{maskedIds=new Set;blockedIds=new Set;clear(){this.maskedIds.clear(),this.blockedIds.clear();}sanitize(t){let r=JSON.parse(JSON.stringify(t));if(r.type===2){if(this.clear(),r.data&&typeof r.data=="object"){let n=r.data;n.node&&typeof n.node=="object"&&this.sanitizeNode(n.node,false,false);}return r}return r.type===3&&r.data&&typeof r.data=="object"?(this.sanitizeIncremental(r.data),r):(r.data&&typeof r.data=="object"&&this.sanitizeNode(r.data,false,false),r)}sanitizeIncremental(t){if(Array.isArray(t.removes))for(let r of t.removes)r&&typeof r.id=="number"&&(this.maskedIds.delete(r.id),this.blockedIds.delete(r.id));if(Array.isArray(t.adds)){for(let r of t.adds)if(r&&r.node&&typeof r.node=="object"){let n=typeof r.parentId=="number"&&this.maskedIds.has(r.parentId),i=typeof r.parentId=="number"&&this.blockedIds.has(r.parentId);this.sanitizeNode(r.node,n,i);}}if(Array.isArray(t.attributes)){for(let r of t.attributes)if(r&&typeof r.id=="number"&&r.attributes&&typeof r.attributes=="object"){let n=r.attributes;if(un(n)&&this.blockedIds.add(r.id),this.blockedIds.has(r.id)){let s={"data-askdepth-block":""};"width"in n&&(s.width=n.width),"height"in n&&(s.height=n.height),"rr_width"in n&&(s.rr_width=n.rr_width),"rr_height"in n&&(s.rr_height=n.rr_height),r.attributes=s;continue}(cn(n)||fn(n))&&this.maskedIds.add(r.id);let i=this.maskedIds.has(r.id);r.attributes=hn(n,i);}}if(Array.isArray(t.texts)){for(let r of t.texts)if(r&&typeof r.value=="string"){if(typeof r.id=="number"&&this.blockedIds.has(r.id)){r.value="";continue}let n=typeof r.id=="number"&&this.maskedIds.has(r.id);r.value=n?be(r.value):Le(r.value);}}if(t.source===5&&typeof t.text=="string"){if(typeof t.id=="number"&&this.blockedIds.has(t.id)){t.text="";return}let r=typeof t.id=="number"&&this.maskedIds.has(t.id);t.text=r?be(t.text):_e(t.text);}}sanitizeNode(t,r,n){let i=typeof t.id=="number"?t.id:void 0,s=t.attributes,o=s&&typeof s=="object"&&!Array.isArray(s)?s:null,c=typeof t.tagName=="string"?t.tagName.toLowerCase():"",a=!!(c&&o),f=n||!!(a&&o&&un(o));if(i!==void 0&&f&&this.blockedIds.add(i),a&&o&&f){let d=typeof o.style=="string"?o.style:"",p=o.width??o.rr_width??ln(d,"width")??120,m=o.height??o.rr_height??ln(d,"height")??40;t.childNodes=[];let u={"data-askdepth-block":"",width:p,height:m,rr_width:String(p),rr_height:String(m)};t.attributes=u;return}let l=!!(o&&fn(o)),h=r||l||!!(o&&cn(o));if(i!==void 0&&h&&this.maskedIds.add(i),o&&(t.attributes=hn(o,h)),typeof t.textContent=="string"&&(t.textContent=h?be(t.textContent):Le(t.textContent)),!c&&typeof t.id=="number"&&typeof t.value=="string"&&(t.value=h?be(t.value):Le(t.value)),t.source===5&&typeof t.text=="string"&&(t.text=h?be(t.text):_e(t.text)),Array.isArray(t.childNodes))for(let d of t.childNodes)d&&typeof d=="object"&&this.sanitizeNode(d,h,f);for(let d of ["adds","texts","attributes","removes","node"]){let p=t[d];if(Array.isArray(p))for(let m of p)m&&typeof m=="object"&&this.sanitizeNode(m,h,f);else p&&typeof p=="object"&&this.sanitizeNode(p,h,f);}}};function Kt(){return new Ze}var cs=new Ze;function fs(e){return cs.sanitize(e)}function Qt(e){let t=Ue(e.userAgent??"")<3145728;return {emit:e.emit,checkoutEveryNms:e.checkoutEveryNms??45e3,inlineStylesheet:true,collectFonts:false,inlineImages:false,recordCanvas:false,maskAllInputs:true,maskInputFn:r=>_e(r),maskTextFn:r=>r?r.replace(/[^\s]/g,"*"):"",maskTextSelector:e.maskTextSelector??'[data-askdepth-mask], .askdepth-mask, [contenteditable]:not([contenteditable="false"])',maskTextClass:"askdepth-mask",blockSelector:"[data-askdepth-block], [data-rr-block], .askdepth-block, .rr-block",blockClass:"askdepth-block",sampling:{mousemove:t?false:50,mouseInteraction:{MouseUp:false,MouseDown:true,Click:true,ContextMenu:true,DblClick:false,Focus:false,Blur:false,TouchStart:true,TouchEnd:false,TouchCancel:false},scroll:150,input:"last"}}}function er(e){if(!e.data||typeof e.data!="object")return null;let t=e.data.source;return typeof t=="number"?t:null}function mn(e){let t=er(e);return t===Qe||t===et}function hs(e){return er(e)===rr}function yn(e){return e.type===ue||e.type!==Je?false:er(e)===Ke}var Ye=class{windowMs;maxBytes;now;onPressure;items=[];bytes=0;baseline=null;constructor(t){this.windowMs=t?.windowMs??45e3,this.maxBytes=t?.maxBytes??3145728,this.now=t?.now??(()=>Date.now()),this.onPressure=t?.onPressure;}get byteLength(){return this.bytes}clear(){this.items=[],this.bytes=0,this.baseline=null;}push(t){let r={event:t,bytes:tt(t)};t.type===ue?(this.baseline=t,this.items=this.items.filter(n=>n.event.timestamp>=t.timestamp&&n.event.type!==ue),this.items.unshift(r),this.recount()):(this.items.push(r),this.bytes+=r.bytes),this.evict();}evict(){let t=this.now()-this.windowMs,r=this.baseline?.timestamp;this.items=this.items.filter(n=>n.event.type===ue&&n.event===this.baseline?true:r!==void 0&&n.event.timestamp<r?false:r!==void 0&&yn(n.event)?true:n.event.timestamp>=t),this.recount(),this.evictByMemory();}dropPointerSamples(){let t=this.items.filter(r=>!mn(r.event));t.length!==this.items.length&&(this.items=t,this.recount());}toArray(){return this.items.map(t=>t.event)}slice(t){let r=t-this.windowMs,n=this.baseline&&this.baseline.timestamp<=t?this.baseline:null,i=this.items.map(s=>s.event).filter(s=>n&&s===n||n&&s.timestamp<n.timestamp||s.timestamp>t?false:n&&yn(s)?true:s.timestamp>=r);return n?[n,...i]:i}evictByMemory(){for(;this.bytes>this.maxBytes;){let t=this.items.findIndex(i=>mn(i.event));if(t>=0){this.removeAt(t);continue}let r=this.items.reduce((i,s,o)=>(hs(s.event)&&i.push(o),i),[]),n=r.length>1?r[0]:void 0;if(n!==void 0){this.removeAt(n);continue}this.onPressure&&this.onPressure();break}}removeAt(t){let r=this.items.splice(t,1)[0];r&&(this.bytes-=r.bytes,this.bytes<0&&(this.bytes=0));}recount(){this.bytes=0;for(let t of this.items)this.bytes+=t.bytes;}};var ds=1e4,tr=2;async function gn(e,t,r=fetch){let n=typeof t.payload=="string"?t.payload:ir(t.payload),i=JSON.stringify({manifest:t.manifest,payload:n,part_index:t.part_index,total_parts:t.total_parts}),s=i.length<=64*1024,o=0;for(;o<=tr;){let c=typeof AbortController<"u"?new AbortController:null,a=c?setTimeout(()=>c.abort(),ds):null;try{let f=await r(e,{method:"POST",keepalive:s,headers:{"content-type":"application/json"},body:i,...c?{signal:c.signal}:{}});if(a&&clearTimeout(a),f.ok||f.status<500)return;if(o===tr)throw new Error(`Upload failed with status ${f.status}`);await new Promise(l=>setTimeout(l,150*Math.pow(2,o)));}catch(f){if(a&&clearTimeout(a),o===tr)throw f;await new Promise(l=>setTimeout(l,150*Math.pow(2,o)));}o+=1;}}var ps=500,ms=1e3;function ys(){return typeof performance<"u"?performance.now():Date.now()}function gs(e){typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):queueMicrotask(e);}function vs(){let e=typeof navigator<"u"?navigator:void 0;if(e&&typeof e.deviceMemory=="number"&&e.deviceMemory<=1)return true;let t=performance.memory;return !t||t.jsHeapSizeLimit<=0?false:t.usedJSHeapSize/t.jsHeapSizeLimit>.85}function bs(e){let t=e.now??(()=>Date.now()),r=e.clock??ys,n=e.schedule??gs,i=e.fetchImpl??fetch,s=e.compress??(A=>Dt(A)),o=e.memoryPressure??vs,c=e.userAgent??(typeof navigator<"u"?navigator.userAgent:""),a=e.windowMs??45e3,f=null,l=new Ye({windowMs:a,maxBytes:e.maxBytes??Ue(c),now:t,onPressure:()=>f?.checkpoint()}),h=Kt(),d=[],p=false,m=false,u=null,v=null,C=null,b=0,y=[],M=0,I=()=>{let A=r(),T=0;for(;d.length>0;){if(T>0&&r()-A>=Mt){x();return}let S=d.shift();S&&l.push(S),T+=1,o()&&l.dropPointerSamples();}},x=()=>{p||(p=true,n(()=>{p=false,I();}));},k=A=>{let T=h.sanitize(A);if(T.type===ue){l.push(T);return}if(d.length>=ps){let S=d.filter(L=>{if(L.type===ue||L.type===Je&&L.data?.source===Ke)return true;let j=L.data?.source;return j!==Qe&&j!==et});d.length=0,d.push(...S);}d.push(T),x();},E=()=>{for(p=false;d.length>0;){let A=d.shift();A&&l.push(A);}},R=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&(E(),l.dropPointerSamples());};return {start(){if(!m){if(m=true,typeof document<"u"&&(document.addEventListener("visibilitychange",R),u=()=>document.removeEventListener("visibilitychange",R)),e.recorder){f=e.recorder(k);return}B();}},stop(){m=false,E(),l.clear(),h.clear(),C=null,y=[],f?.stop(),f=null,u?.(),u=null,v?.(),v=null;},push(A){k(A);},dump(){return l.slice(t())},async flash(A,T){let S=T??t();return C||(S-b<ms&&y.length>0?y:(C=(async()=>{try{E();let L=l.slice(S).filter(X=>X.timestamp<=S),j=l.baseline,N=L.filter(X=>X.type!==ue)[0],q=N?.timestamp??j?.timestamp??S,Z=Math.min(a,Math.max(0,S-(N?N.timestamp:S)));if(L.length===0)return [];M+=1;let ye=crypto.randomUUID(),J=JSON.stringify(L),he=Rt(J),Q=await s(he),K=sr(Q.bytes,Ct),V=K.map((X,re)=>{let ne=new Uint8Array(new ArrayBuffer(X.byteLength));return ne.set(X),{manifest:{slice_id:ye,triggering_anomaly_id:A,session_id:e.sessionId,environment:e.environment,start_timestamp:q,trigger_timestamp:S,duration_ms:Z,has_baseline_snapshot:!!j||L.some(Se=>Se.type===ue),events_count:L.length,uncompressed_byte_size:tt(L),compressed_byte_size:Q.bytes.byteLength,compression_algorithm:Q.algorithm,sequence_number:M},payload:ne,part_index:re,total_parts:K.length}});return await Promise.all(V.map(async X=>{try{await gn(e.endpoint,X,i);}catch(re){console.warn("[Askdepth] Failed to upload replay slice",re);}})),b=S,y=V,V}finally{C=null;}})(),C))}};function B(){if(typeof window>"u"||typeof document>"u"||!m)return;let A=Qt({emit:(L,j)=>{if(j&&L.type!==ue){k({...L,type:ue});return}k(L);},...e.checkoutEveryNms!==void 0?{checkoutEveryNms:e.checkoutEveryNms}:{checkoutEveryNms:45e3},userAgent:c}),T=Ee(A),S=()=>{Ee.takeFullSnapshot(true);};f={stop:()=>T?.(),checkpoint:S},v=Ss(S);}}function Ss(e){if(typeof window>"u"||typeof history>"u")return ()=>{};let t=history.pushState,r=history.replaceState,n=0,i=()=>{let o=Date.now();o-n<1e3||(n=o,e());};history.pushState=(...o)=>{t.apply(history,o),i();},history.replaceState=(...o)=>{r.apply(history,o),i();};let s=()=>i();return window.addEventListener("popstate",s),window.addEventListener("hashchange",s),()=>{history.pushState=t,history.replaceState=r,window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s);}}
79
+ export{Xe as CHECKOUT_EVERY_MS,Ct as CHUNK_BYTES,wt as DESKTOP_MAX_BYTES,Ze as EventSanitizer,Mt as FRAME_BUDGET_MS,vn as MOBILE_MAX_BYTES,ze as REPLAY_WINDOW_MS,Ye as RingBuffer,Dt as compressBytes,Kt as createEventSanitizer,Qt as createRecordOptions,bs as createReplayEngine,_e as maskInputValue,Le as maskText,Ue as maxBufferBytes,fs as sanitizeEvent};//# sourceMappingURL=index.js.map
80
+ //# sourceMappingURL=index.js.map