@mime8/recorder 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ Records real user sessions in your web app and sends them to mime8. mime8 replay
7
7
  Load it before any of your app's code, as early in `<head>` as you can, so it sees the first requests:
8
8
 
9
9
  ```html
10
- <script src="https://cdn.jsdelivr.net/npm/@mime8/recorder@0.1.0/dist/recorder.umd.cjs"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/@mime8/recorder@0.2.0/dist/recorder.iife.js"></script>
11
11
  <script>
12
12
  mime8.init({ projectKey: "pk_…" });
13
13
  </script>
@@ -25,6 +25,52 @@ import { init } from "@mime8/recorder";
25
25
  init({ projectKey: "pk_…" });
26
26
  ```
27
27
 
28
+ Start it only where your real users are. mime8 takes sessions for your project only from the origins listed for it, so a session recorded anywhere else (your CI's end-to-end tests, a local preview, a staging copy) is refused. Guard `init` when the same build runs in those places:
29
+
30
+ ```js
31
+ if (location.hostname === "app.example.com") init({ projectKey: "pk_…" });
32
+ ```
33
+
34
+ ## When mime8 replays your app
35
+
36
+ mime8 replays recorded sessions on your base branch's build and on your pull request's build, and compares them. Anything the build bakes in that differs on every build, such as a version string, a build id or commit hash, an update check ("a new version is available") or a "what's new" banner, would show as a change on every pull request. Under replay, `window.mime8.replaying` is `true`, so your app can leave those out:
37
+
38
+ ```js
39
+ if (window.mime8?.replaying) hideVersion();
40
+ ```
41
+
42
+ Outside replay it's `undefined`: with the script tag, `window.mime8` is the recorder, which has no `replaying`; with the npm package there's no `window.mime8` at all.
43
+
44
+ What your app does differently under replay is your choice, and mime8 compares what it shows then. Whatever you hide or skip there isn't tested, so keep it to what changes with every build.
45
+
46
+ ### Holding the replay
47
+
48
+ Replay runs your app's timers and answers its requests from the recording, and waits for both before each step and screenshot. Work it can't see, such as a Web Worker, IndexedDB or WebAssembly loading, may still be going on. Hold the replay around it:
49
+
50
+ ```js
51
+ window.mime8?.pause?.();
52
+ try {
53
+ await loadFromIndexedDb();
54
+ } finally {
55
+ window.mime8?.resume?.();
56
+ }
57
+ ```
58
+
59
+ - Each `pause()` needs its own `resume()`. Outside replay neither exists, hence `?.()`.
60
+ - While paused, your app's clock stands still: no timer fires, not even `setTimeout(fn, 0)`. Call `resume()` when the work itself finishes, never from a timer.
61
+ - A pause holds the replay for at most 30 seconds. mime8 then ends it and goes on, and the report says so on the step.
62
+ - Work done with timers or requests needs no pause.
63
+
64
+ In TypeScript, declare the global:
65
+
66
+ ```ts
67
+ declare global {
68
+ interface Window {
69
+ mime8?: { replaying?: boolean; pause?(): void; resume?(): void };
70
+ }
71
+ }
72
+ ```
73
+
28
74
  ## Options
29
75
 
30
76
  - `projectKey` (required): your project's public key.
@@ -35,3 +81,7 @@ init({ projectKey: "pk_…" });
35
81
  - `network.beforeRecord`: a function that sees each recorded request last; return it, a changed copy, or `null` to drop it.
36
82
 
37
83
  A string matches a name exactly (ignoring case), or a URL as a prefix; a RegExp is tested; a function decides.
84
+
85
+ ## What is removed from the page
86
+
87
+ When a redaction rule replaces a value in a request, a response, storage or a cookie, the recorder also removes that value from what it records of the page: its text, its attributes and what is typed into it. Page text becomes `[redacted]`. A typed value is replaced by one of the same length and shape (`ada@example.com` becomes `xxx@xxxxxxx.xxx`), so forms still validate when mime8 replays them. Values shorter than 8 characters, single words and short numbers are left as they are. The value is matched only as the recorder saw it redacted, and only in what is recorded after the redaction or shortly before it, up to about 10 seconds. Page text is otherwise recorded as it is: text your server renders into the page, and values no rule names, are not removed. Password fields are always masked.
@@ -0,0 +1,78 @@
1
+ var mime8=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r=(e,t,r)=>n(e,typeof t==`symbol`?t:t+``,r),i=(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))(i||{}),a=(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))(a||{}),o=(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))(o||{}),s=(e=>(e[e.Mouse=0]=`Mouse`,e[e.Pen=1]=`Pen`,e[e.Touch=2]=`Touch`,e))(s||{}),c=(e=>(e[e[`2D`]=0]=`2D`,e[e.WebGL=1]=`WebGL`,e[e.WebGL2=2]=`WebGL2`,e))(c||{}),l=(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))(l||{}),u=(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))(u||{}),d={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},f={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},p={},m={},h=()=>!!globalThis.Zone;function g(e){if(p[e])return p[e];let t=globalThis[e],n=t.prototype,r=e in d?d[e]:void 0,i=!!(r&&r.every(e=>!!(Object.getOwnPropertyDescriptor(n,e)?.get)?.toString().includes(`[native code]`))),a=e in f?f[e]:void 0,o=!!(a&&a.every(e=>typeof n[e]==`function`&&n[e]?.toString().includes(`[native code]`)));if(i&&o&&!h())return p[e]=t.prototype,t.prototype;try{let r=document.createElement(`iframe`);r.style.display=`none`,document.body.appendChild(r);let i=r.contentWindow;if(!i)return t.prototype;let a=i[e].prototype;if(!a)return r.remove(),n;let o=navigator.userAgent;return o.includes(`Safari`)&&!o.includes(`Chrome`)?(r.classList.add(`rr-block`),r.setAttribute(`__rrwebUntaintedMutationObserver`,``),m[e]=()=>r.remove()):r.remove(),p[e]=a}catch{return n}}var _={};function v(e,t,n){let r=`${e}.${String(n)}`;if(_[r])return _[r].call(t);let i=g(e),a=Object.getOwnPropertyDescriptor(i,n)?.get;return a?(_[r]=a,a.call(t)):t[n]}var y={};function b(e,t,n){let r=`${e}.${String(n)}`;if(y[r])return y[r].bind(t);let i=g(e)[n];return typeof i==`function`?(y[r]=i,i.bind(t)):t[n]}function x(e){return v(`Node`,e,`ownerDocument`)}function S(e){return v(`Node`,e,`childNodes`)}function ee(e){return v(`Node`,e,`parentNode`)}function C(e){return v(`Node`,e,`parentElement`)}function te(e){return v(`Node`,e,`textContent`)}function w(e,t){return b(`Node`,e,`contains`)(t)}function T(e){return b(`Node`,e,`getRootNode`)()}function E(e){return!e||!(`host`in e)?null:v(`ShadowRoot`,e,`host`)}function D(e){return e.styleSheets}function O(e){return!e||!(`shadowRoot`in e)?null:v(`Element`,e,`shadowRoot`)}function ne(e,t){return v(`Element`,e,`querySelector`)(t)}function re(e,t){return v(`Element`,e,`querySelectorAll`)(t)}function ie(){return[g(`MutationObserver`).constructor,m.MutationObserver??(()=>{})]}var ae=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ae=()=>new Date().getTime());function k(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i==`function`&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{H||(e[t]=r)}}catch{return()=>{}}}var A={ownerDocument:x,childNodes:S,parentNode:ee,parentElement:C,textContent:te,contains:w,getRootNode:T,host:E,styleSheets:D,shadowRoot:O,querySelector:ne,querySelectorAll:re,nowTimestamp:ae,mutationObserverCtor:ie,patch:k};function j(e){return e.nodeType===e.ELEMENT_NODE}function M(e){let t=e&&`host`in e&&`mode`in e&&A.host(e)||null;return!!(t&&`shadowRoot`in t&&A.shadowRoot(t)===e)}function N(e){return Object.prototype.toString.call(e)===`[object ShadowRoot]`}function oe(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 se(e){let{cssText:t}=e;if(t.split(`"`).length<3)return t;let n=[`@import`,`url(${JSON.stringify(e.href)})`];return e.layerName===``?n.push(`layer`):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(` `)+`;`}function ce(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),oe(Array.from(t,e=>le(e,n)).join(``))}catch{return null}}function le(e,t){if(de(e)){let t;try{t=ce(e.styleSheet)||se(e)}catch{t=e.cssText}return e.styleSheet.href?Se(t,e.styleSheet.href):t}else{let n=e.cssText;return P(e)&&e.selectorText.includes(`:`)&&(n=ue(n)),t?Se(n,t):n}}function ue(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function de(e){return`styleSheet`in e}function P(e){return`selectorText`in e}var F=class{constructor(){r(this,`idNodeMap`,new Map),r(this,`nodeMetaMap`,new WeakMap)}getId(e){return e?this.getMeta(e)?.id??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){let n=this.getNode(e);if(n){let e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function fe(){return new F}function I({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:a}){let o=i||``,s=r&&L(r);return(t[n.toLowerCase()]||s&&t[s])&&(o=a?a(o,e):`*`.repeat(o.length)),o}function L(e){return e.toLowerCase()}var pe=`__rrweb_original__`;function me(e){let t=e.getContext(`2d`);if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){let i=t.getImageData,a=pe in i?i[pe]:i;if(new Uint32Array(a.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some(e=>e!==0))return!1}return!0}function he(e){let t=e.type;return e.hasAttribute(`data-rr-is-password`)?`password`:t?L(t):null}function ge(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}return n.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1]??null}function _e(e){let t=``;return t=e.indexOf(`//`)>-1?e.split(`/`).slice(0,3).join(`/`):e.split(`/`)[0],t=t.split(`?`)[0],t}var ve=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ye=/^(?:[a-z+]+:)?\/\//i,be=/^www\..*/i,xe=/^(data:)([^,]*),(.*)/i;function Se(e,t){return(e||``).replace(ve,(e,n,r,i,a,o)=>{let s=r||a||o,c=n||i||``;if(!s)return e;if(ye.test(s)||be.test(s)||xe.test(s))return`url(${c}${s}${c})`;if(s[0]===`/`)return`url(${c}${_e(t)+s}${c})`;let l=s.split(`#`)[0],u=s.substring(l.length),d=t.split(`#`)[0].split(`/`),f=l.split(`/`);d.pop();for(let e of f)if(e===`.`)continue;else e===`..`?d.pop():d.push(e);return`url(${c}${d.join(`/`)}${u}${c})`})}function Ce(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``).replace(/0px/g,`0`)}function we(e,t,n=!1){let r=Array.from(t.childNodes),i=[],a=0;if(r.length>1&&e&&typeof e==`string`){let t=Ce(e,n),o=t.length/e.length;for(let s=1;s<r.length;s++)if(r[s].textContent&&typeof r[s].textContent==`string`){let c=Ce(r[s].textContent,n),l=3;for(;l<c.length&&(c[l].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,l),1)!==-1);l++);for(;l<c.length;l++){let u=c.substring(0,l),d=t.split(u),f=-1;if(d.length===2)f=d[0].length;else if(d.length>2&&d[0]===``&&r[s-1].textContent!==``)f=t.indexOf(u,1);else if(d.length===1){if(u=u.substring(0,u.length-1),d=t.split(u),d.length<=1)return i.push(e),i;l=101}else l===c.length-1&&(f=t.indexOf(u));if(d.length>=2&&l>100){let e=r[s-1].textContent;if(e&&typeof e==`string`){let n=Ce(e).length;f=t.indexOf(u,n)}f===-1&&(f=d[0].length)}if(f!==-1){let s=Math.floor(f/o);for(;s>0&&s<e.length;){if(a+=1,a>50*r.length)return i.push(e),i;let c=Ce(e.substring(0,s),n);if(c.length===f){i.push(e.substring(0,s)),e=e.substring(s),t=t.substring(f);break}else c.length<f?s+=Math.max(1,Math.floor((f-c.length)/o)):s-=Math.max(1,Math.floor((c.length-f)*o))}break}}}}return i.push(e),i}function Te(e,t){return we(e,t).join(`/* rr_split */`)}var Ee=1,De=RegExp(`[^a-z0-9-_:]`),Oe=-2;function ke(){return Ee++}function Ae(e){if(e instanceof HTMLFormElement)return`form`;let t=L(e.tagName);return De.test(t)?`div`:t}var je,Me,Ne=/^[^ \t\n\r\u000c]+/,Pe=/^[, \t\n\r\u000c]+/;function Fe(e,t){if(t.trim()===``)return t;let n=0;function r(e){let r,i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):``}let i=[];for(;r(Pe),!(n>=t.length);){let a=r(Ne);if(a.slice(-1)===`,`)a=Le(e,a.substring(0,a.length-1)),i.push(a);else{let r=``;a=Le(e,a);let o=!1;for(;;){let e=t.charAt(n);if(e===``){i.push((a+r).trim());break}else if(o)e===`)`&&(o=!1);else if(e===`,`){n+=1,i.push((a+r).trim());break}else e===`(`&&(o=!0);r+=e,n+=1}}}return i.join(`, `)}var Ie=new WeakMap;function Le(e,t){return!t||t.trim()===``?t:ze(e,t)}function Re(e){return!!(e.tagName===`svg`||e.ownerSVGElement)}function ze(e,t){let n=Ie.get(e);if(n||(n=e.createElement(`a`),Ie.set(e,n)),!t)t=``;else if(t.startsWith(`blob:`)||t.startsWith(`data:`))return t;return n.setAttribute(`href`,t),n.href}function Be(e,t,n,r){return r&&(n===`src`||n===`href`&&(t!==`use`||r[0]!==`#`)||n===`xlink:href`&&r[0]!==`#`||n===`background`&&[`table`,`td`,`th`].includes(t)?Le(e,r):n===`srcset`?Fe(e,r):n===`style`?Se(r,ze(e)):t===`object`&&n===`data`?Le(e,r):r)}function Ve(e,t,n){return[`video`,`audio`].includes(e)&&t===`autoplay`}function He(e,t,n){try{if(typeof t==`string`){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch{}return!1}function Ue(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Ue(A.parentNode(e),t,n):!1;for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}return n?Ue(A.parentNode(e),t,n):!1}function We(e,t,n,r){let i;if(j(e)){if(i=e,!A.childNodes(i).length)return!1}else if(A.parentElement(e)===null)return!1;else i=A.parentElement(e);try{if(typeof t==`string`){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Ue(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function Ge(e,t,n){let r=t;t=U(()=>H||r());let i=e.contentWindow;if(!i)return;let a=!1,o;try{o=i.document.readyState}catch{return}if(o!==`complete`){let r=setTimeout(()=>{a||=(t(),!0)},n);e.addEventListener(`load`,()=>{clearTimeout(r),a=!0,t()});return}let s=`about:blank`;if(i.location.href!==s||e.src===s||e.src===``)return setTimeout(t,0),e.addEventListener(`load`,t);e.addEventListener(`load`,t)}function Ke(e,t,n){let r=t;t=U(()=>H||r());let i=!1,a;try{a=e.sheet}catch{return}if(a)return;let o=setTimeout(()=>{i||=(t(),!0)},n);e.addEventListener(`load`,()=>{clearTimeout(o),i=!0,t()})}function qe(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:o,inlineStylesheet:s,maskInputOptions:c={},maskTextFn:l,maskInputFn:d,dataURLOptions:f={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:h,newlyAddedElement:g=!1,cssCaptured:_=!1}=t,v=Je(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode===`CSS1Compat`?{type:u.Document,childNodes:[]}:{type:u.Document,childNodes:[],compatMode:e.compatMode};case e.DOCUMENT_TYPE_NODE:return{type:u.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return Xe(e,{doc:n,blockClass:i,blockSelector:a,inlineStylesheet:s,maskInputOptions:c,maskInputFn:d,dataURLOptions:f,inlineImages:p,recordCanvas:m,keepIframeSrcFn:h,newlyAddedElement:g,rootId:v});case e.TEXT_NODE:return Ye(e,{doc:n,needsMask:o,maskTextFn:l,rootId:v,cssCaptured:_});case e.CDATA_SECTION_NODE:return{type:u.CDATA,textContent:``,rootId:v};case e.COMMENT_NODE:return{type:u.Comment,textContent:A.textContent(e)||``,rootId:v};default:return!1}}function Je(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function Ye(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:a}=t,o=A.parentNode(e),s=o&&o.tagName,c=``,l=s===`STYLE`||void 0,d=s===`SCRIPT`||void 0;return d?c=`SCRIPT_PLACEHOLDER`:a||(c=A.textContent(e),l&&c&&(c=Se(c,ze(t.doc)))),!l&&!d&&c&&n&&(c=r?r(c,A.parentElement(e)):c.replace(/[\S]/g,`*`)),{type:u.Text,textContent:c||``,rootId:i}}function Xe(e,t){let{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:a,maskInputOptions:o={},maskInputFn:s,dataURLOptions:c={},inlineImages:l,recordCanvas:d,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:m}=t,h=He(e,r,i),g=Ae(e),_={},v=e.attributes.length;for(let t=0;t<v;t++){let r=e.attributes[t];Ve(g,r.name,r.value)||(_[r.name]=Be(n,g,L(r.name),r.value))}if(g===`link`&&a){let t=Array.from(n.styleSheets).find(t=>t.href===e.href),r=null;t&&(r=ce(t)),r&&(delete _.rel,delete _.href,_._cssText=r)}if(g===`style`&&e.sheet){let t=ce(e.sheet);t&&(e.childNodes.length>1&&(t=Te(t,e)),_._cssText=t)}if([`input`,`textarea`,`select`].includes(g)){let t=e.value,n=e.checked;_.type!==`radio`&&_.type!==`checkbox`&&_.type!==`submit`&&_.type!==`button`&&t?_.value=I({element:e,type:he(e),tagName:g,value:t,maskInputOptions:o,maskInputFn:s}):n&&(_.checked=n)}if(g===`option`&&(e.selected&&!o.select?_.selected=!0:delete _.selected),g===`dialog`&&e.open&&(_.rr_open_mode=e.matches(`dialog:modal`)?`modal`:`non-modal`),g===`canvas`&&d){if(e.__context===`2d`)me(e)||(_.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!(`__context`in e)){let t=e.toDataURL(c.type,c.quality),r=n.createElement(`canvas`);r.width=e.width,r.height=e.height,t!==r.toDataURL(c.type,c.quality)&&(_.rr_dataURL=t)}}if(g===`img`&&l){je||(je=n.createElement(`canvas`),Me=je.getContext(`2d`));let t=e,r=t.currentSrc||t.getAttribute(`src`)||`<unknown-src>`,i=t.crossOrigin,a=()=>{t.removeEventListener(`load`,a);try{je.width=t.naturalWidth,je.height=t.naturalHeight,Me.drawImage(t,0,0),_.rr_dataURL=je.toDataURL(c.type,c.quality)}catch(e){if(t.crossOrigin!==`anonymous`){t.crossOrigin=`anonymous`,t.complete&&t.naturalWidth!==0?a():t.addEventListener(`load`,a);return}else console.warn(`Cannot inline img src=${r}! Error: ${e}`)}t.crossOrigin===`anonymous`&&(i?_.crossOrigin=i:t.removeAttribute(`crossorigin`))};t.complete&&t.naturalWidth!==0?a():t.addEventListener(`load`,a)}if([`audio`,`video`].includes(g)){let t=_;t.rr_mediaState=e.paused?`paused`:`played`,t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(_.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(_.rr_scrollTop=e.scrollTop)),h){let{width:t,height:n}=e.getBoundingClientRect();_={class:_.class,rr_width:`${t}px`,rr_height:`${n}px`}}g===`iframe`&&!f(_.src)&&(e.contentDocument||(_.rr_src=_.src),delete _.src);let y;try{customElements.get(g)&&(y=!0)}catch{}return{type:u.Element,tagName:g,attributes:_,childNodes:[],isSVG:Re(e)||void 0,needBlock:h,rootId:m,isCustom:y}}function R(e){return e==null?``:e.toLowerCase()}function Ze(e){return e===!0||e===`all`?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e===`all`,headMetaDescKeywords:e===`all`,headTitleMutations:e===`all`}:e||{}}function Qe(e,t){return!!(t.comment&&e.type===u.Comment||e.type===u.Element&&(t.script&&(e.tagName===`script`||e.tagName===`link`&&(e.attributes.rel===`preload`&&e.attributes.as===`script`||e.attributes.rel===`modulepreload`)||e.tagName===`link`&&e.attributes.rel===`prefetch`&&typeof e.attributes.href==`string`&&ge(e.attributes.href)===`js`)||t.headFavicon&&(e.tagName===`link`&&e.attributes.rel===`shortcut icon`||e.tagName===`meta`&&(R(e.attributes.name).match(/^msapplication-tile(image|color)$/)||R(e.attributes.name)===`application-name`||R(e.attributes.rel)===`icon`||R(e.attributes.rel)===`apple-touch-icon`||R(e.attributes.rel)===`shortcut icon`))||e.tagName===`meta`&&(t.headMetaDescKeywords&&R(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(R(e.attributes.property).match(/^(og|twitter|fb):/)||R(e.attributes.name).match(/^(og|twitter):/)||R(e.attributes.name)===`pinterest`)||t.headMetaRobots&&(R(e.attributes.name)===`robots`||R(e.attributes.name)===`googlebot`||R(e.attributes.name)===`bingbot`)||t.headMetaHttpEquiv&&e.attributes[`http-equiv`]!==void 0||t.headMetaAuthorship&&(R(e.attributes.name)===`author`||R(e.attributes.name)===`generator`||R(e.attributes.name)===`framework`||R(e.attributes.name)===`publisher`||R(e.attributes.name)===`progid`||R(e.attributes.property).match(/^article:/)||R(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(R(e.attributes.name)===`google-site-verification`||R(e.attributes.name)===`yandex-verification`||R(e.attributes.name)===`csrf-token`||R(e.attributes.name)===`p:domain_verify`||R(e.attributes.name)===`verify-v1`||R(e.attributes.name)===`verification`||R(e.attributes.name)===`shopify-checkout-api-token`))))}function $e(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:a,maskTextClass:o,maskTextSelector:s,skipChild:c=!1,inlineStylesheet:l=!0,maskInputOptions:d={},maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h={},inlineImages:g=!1,recordCanvas:_=!1,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b=5e3,onStylesheetLoad:x,stylesheetLoadTimeout:S=5e3,keepIframeSrcFn:ee=()=>!1,newlyAddedElement:C=!1,cssCaptured:te=!1}=t,{needsMask:w}=t,{preserveWhiteSpace:T=!0}=t;w||=We(e,o,s,w===void 0);let E=qe(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:w,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,dataURLOptions:h,inlineImages:g,recordCanvas:_,keepIframeSrcFn:ee,newlyAddedElement:C,cssCaptured:te});if(!E)return console.warn(e,`not serialized`),null;let D;D=r.hasNode(e)?r.getId(e):Qe(E,m)||!T&&E.type===u.Text&&!E.textContent.replace(/^\s+|\s+$/gm,``).length?Oe:ke();let O=Object.assign(E,{id:D});if(r.add(e,O),D===Oe)return null;v&&v(e);let ne=!c;if(O.type===u.Element){ne&&=!O.needBlock,delete O.needBlock;let t=A.shadowRoot(e);t&&N(t)&&(O.isShadowHost=!0)}if((O.type===u.Document||O.type===u.Element)&&ne){m.headWhitespace&&O.type===u.Element&&O.tagName===`head`&&(T=!1);let t={doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:w,maskTextClass:o,maskTextSelector:s,skipChild:c,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:ee,cssCaptured:!1};if(O.type!==u.Element||O.tagName!==`textarea`||O.attributes.value===void 0){O.type===u.Element&&O.attributes._cssText!==void 0&&typeof O.attributes._cssText==`string`&&(t.cssCaptured=!0);for(let n of Array.from(A.childNodes(e))){let e=$e(n,t);e&&O.childNodes.push(e)}}let C=null;if(j(e)&&(C=A.shadowRoot(e)))for(let e of Array.from(A.childNodes(C))){let n=$e(e,t);n&&(N(C)&&(n.isShadow=!0),O.childNodes.push(n))}}let re=A.parentNode(e);return re&&M(re)&&N(re)&&(O.isShadow=!0),O.type===u.Element&&O.tagName===`iframe`&&Ge(e,()=>{let t=e.contentDocument;if(t&&y){let n=$e(t,{doc:t,mirror:r,blockClass:i,blockSelector:a,needsMask:w,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:ee});n&&y(e,n)}},b),O.type===u.Element&&O.tagName===`link`&&typeof O.attributes.rel==`string`&&(O.attributes.rel===`stylesheet`||O.attributes.rel===`preload`&&typeof O.attributes.href==`string`&&ge(O.attributes.href)===`css`)&&Ke(e,()=>{if(x){let t=$e(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:w,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:ee});t&&x(e,t)}},S),O}function et(e,t){let{mirror:n=new F,blockClass:r=`rr-block`,blockSelector:i=null,maskTextClass:a=`rr-mask`,maskTextSelector:o=null,inlineStylesheet:s=!0,inlineImages:c=!1,recordCanvas:l=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:f,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:x=()=>!1}=t;return $e(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:s,maskInputOptions:u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u===!1?{password:!0}:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:Ze(p),dataURLOptions:m,inlineImages:c,recordCanvas:l,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:x,newlyAddedElement:!1})}var tt=class e{constructor(...e){r(this,`parentElement`,null),r(this,`parentNode`,null),r(this,`ownerDocument`),r(this,`firstChild`,null),r(this,`lastChild`,null),r(this,`previousSibling`,null),r(this,`nextSibling`,null),r(this,`ELEMENT_NODE`,1),r(this,`TEXT_NODE`,3),r(this,`nodeType`),r(this,`nodeName`),r(this,`RRNodeType`)}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e)||t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`)}insertBefore(e,t){throw Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`)}removeChild(e){throw Error(`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`)}toString(){return`RRNode`}};function z(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var nt=`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.`,rt={map:{},getId(){return console.error(nt),-1},getNode(){return console.error(nt),null},removeNodeFromMap(){console.error(nt)},has(){return console.error(nt),!1},reset(){console.error(nt)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(rt=new Proxy(rt,{get(e,t,n){return t===`map`&&console.error(nt),Reflect.get(e,t,n)}}));function it(e,t,n={}){let r=null,i=0;return function(...a){let o=Date.now();!i&&n.leading===!1&&(i=o);let s=t-(o-i),c=this;s<=0||s>t?(r&&=(clearTimeout(r),null),i=o,e.apply(c,a)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,H||e.apply(c,a)},s))}}function at(e,t,n,r,i=window){let a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){H||setTimeout(()=>{H||n.set.call(this,e)},0),a&&a.set&&a.set.call(this,e)}}),()=>H||at(e,t,a||{},!0)}function ot(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset===void 0?t.documentElement.scrollLeft||t?.body&&A.parentElement(t.body)?.scrollLeft||t?.body?.scrollLeft||0:e.pageXOffset,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset===void 0?t?.documentElement.scrollTop||t?.body&&A.parentElement(t.body)?.scrollTop||t?.body?.scrollTop||0:e.pageYOffset}}function st(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ct(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function lt(e){return e?e.nodeType===e.ELEMENT_NODE?e:A.parentElement(e):null}function B(e,t,n,r){if(!e)return!1;let i=lt(e);if(!i)return!1;try{if(typeof t==`string`){if(i.classList.contains(t)||r&&i.closest(`.`+t)!==null)return!0}else if(Ue(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function ut(e,t){return t.getId(e)!==-1}function dt(e,t,n){return e.tagName===`TITLE`&&n.headTitleMutations?!0:t.getId(e)===Oe}function ft(e,t){if(M(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=A.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:!r||ft(r,t)}function pt(e){return!!e.changedTouches}function mt(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 ht(e,t){return!!(e.nodeName===`IFRAME`&&t.getMeta(e))}function gt(e,t){return!!(e.nodeName===`LINK`&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute(`rel`)===`stylesheet`&&t.getMeta(e))}function _t(e){return e?e instanceof tt&&`shadowRoot`in e?!!e.shadowRoot:!!A.shadowRoot(e):!1}var vt=class{constructor(){r(this,`id`,1),r(this,`styleIDMap`,new WeakMap),r(this,`idStyleMap`,new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=t===void 0?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function yt(e){let t=null;return`getRootNode`in e&&A.getRootNode(e)?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&A.host(A.getRootNode(e))&&(t=A.host(A.getRootNode(e))),t}function bt(e){let t=e,n;for(;n=yt(t);)t=n;return t}function xt(e){let t=A.ownerDocument(e);if(!t)return!1;let n=bt(e);return A.contains(t,n)}function St(e){let t=A.ownerDocument(e);return t?A.contains(t,e)||xt(e):!1}function Ct(e){return`__ln`in e}var wt=class{constructor(){r(this,`length`,0),r(this,`head`,null),r(this,`tail`,null)}get(e){if(e>=this.length)throw Error(`Position outside of list range`);let t=this.head;for(let n=0;n<e;n++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Ct(e.previousSibling)){let n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Ct(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Tt=(e,t)=>`${e}@${t}`,Et=class{constructor(){r(this,`frozen`,!1),r(this,`locked`,!1),r(this,`texts`,[]),r(this,`attributes`,[]),r(this,`attributeMap`,new WeakMap),r(this,`removes`,[]),r(this,`mapRemoves`,[]),r(this,`movedMap`,{}),r(this,`addedSet`,new Set),r(this,`movedSet`,new Set),r(this,`droppedSet`,new Set),r(this,`removesSubTreeCache`,new Set),r(this,`mutationCb`),r(this,`blockClass`),r(this,`blockSelector`),r(this,`maskTextClass`),r(this,`maskTextSelector`),r(this,`inlineStylesheet`),r(this,`maskInputOptions`),r(this,`maskTextFn`),r(this,`maskInputFn`),r(this,`keepIframeSrcFn`),r(this,`recordCanvas`),r(this,`inlineImages`),r(this,`slimDOMOptions`),r(this,`dataURLOptions`),r(this,`doc`),r(this,`mirror`),r(this,`iframeManager`),r(this,`stylesheetManager`),r(this,`shadowDomManager`),r(this,`canvasManager`),r(this,`processedNodeManager`),r(this,`unattachedDoc`),r(this,`processMutations`,e=>{e.forEach(this.processMutation),this.emit()}),r(this,`emit`,()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,n=new wt,r=e=>{let t=e,n=Oe;for(;n===Oe;)t&&=t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{let a=A.parentNode(i);if(!a||!St(i))return;let o=!1;if(i.nodeType===Node.TEXT_NODE){let e=a.tagName;if(e===`TEXTAREA`)return;e===`STYLE`&&this.addedSet.has(a)&&(o=!0)}let s=M(a)?this.mirror.getId(yt(i)):this.mirror.getId(a),c=r(i);if(s===-1||c===-1)return n.addNode(i);let l=$e(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,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:e=>{ht(e,this.mirror)&&this.iframeManager.addIframe(e),gt(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),_t(i)&&this.shadowDomManager.addShadowRoot(A.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:o});l&&(e.push({parentId:s,nextId:c,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let e of this.movedSet)kt(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(A.parentNode(e))||i(e);for(let e of this.addedSet)!jt(this.droppedSet,e)&&!kt(this.removesSubTreeCache,e,this.mirror)||jt(this.movedSet,e)?i(e):this.droppedSet.add(e);let a=null;for(;n.length;){let e=null;if(a){let t=this.mirror.getId(A.parentNode(a.value)),n=r(a.value);t!==-1&&n!==-1&&(e=a)}if(!e){let t=n.tail;for(;t;){let n=t;if(t=t.previous,n){let t=this.mirror.getId(A.parentNode(n.value));if(r(n.value)===-1)continue;if(t!==-1){e=n;break}else{let t=n.value,r=A.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let t=A.host(r);if(this.mirror.getId(t)!==-1){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}a=e.previous,n.removeNode(e.value),i(e.value)}let o={texts:this.texts.map(e=>{let t=e.node,n=A.parentNode(t);return n&&n.tagName===`TEXTAREA`&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{let{attributes:t}=e;if(typeof t.style==`string`){let n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split(`var(`).length===t.style.split(`var(`).length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};!o.texts.length&&!o.attributes.length&&!o.removes.length&&!o.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(o))}),r(this,`genTextAreaValueMutation`,e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let n=Array.from(A.childNodes(e),e=>A.textContent(e)||``).join(``);t.attributes.value=I({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:he(e),value:n,maskInputFn:this.maskInputFn})}),r(this,`processMutation`,e=>{if(!dt(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case`characterData`:{let t=A.textContent(e.target);!B(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:We(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,lt(e.target)):t.replace(/[\S]/g,`*`):t,node:e.target});break}case`attributes`:{let t=e.target,n=e.attributeName,r=e.target.getAttribute(n);if(n===`value`){let e=he(t);r=I({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(B(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if(t.tagName===`IFRAME`&&n===`src`&&!this.keepIframeSrcFn(r))if(!t.contentDocument)n=`rr_src`;else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),n===`type`&&t.tagName===`INPUT`&&(e.oldValue||``).toLowerCase()===`password`&&t.setAttribute(`data-rr-is-password`,`true`),!Ve(t.tagName,n))if(i.attributes[n]=Be(this.doc,L(t.tagName),L(n),r),n===`style`){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let n=this.unattachedDoc.createElement(`span`);e.oldValue&&n.setAttribute(`style`,e.oldValue);for(let e of Array.from(t.style)){let r=t.style.getPropertyValue(e),a=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||a!==n.style.getPropertyPriority(e)?a===``?i.styleDiff[e]=r:i.styleDiff[e]=[r,a]:i._unchangedStyles[e]=[r,a]}for(let e of Array.from(n.style))t.style.getPropertyValue(e)===``&&(i.styleDiff[e]=!1)}else n===`open`&&t.tagName===`DIALOG`&&(t.matches(`dialog:modal`)?i.attributes.rr_open_mode=`modal`:i.attributes.rr_open_mode=`non-modal`);break}case`childList`:if(B(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName===`TEXTAREA`){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let n=this.mirror.getId(t),r=M(e.target)?this.mirror.getId(A.host(e.target)):this.mirror.getId(e.target);B(e.target,this.blockClass,this.blockSelector,!1)||dt(t,this.mirror,this.slimDOMOptions)||!ut(t,this.mirror)||(this.addedSet.has(t)?(Dt(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&n===-1||ft(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Tt(n,r)]?Dt(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:M(e.target)&&N(e.target)?!0:void 0}),Ot(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}),r(this,`genAdds`,(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(dt(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&n!==-1&&(this.movedMap[Tt(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);B(e,this.blockClass,this.blockSelector,!1)||(A.childNodes(e).forEach(e=>this.genAdds(e)),_t(e)&&A.childNodes(A.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){[`mutationCb`,`blockClass`,`blockSelector`,`maskTextClass`,`maskTextSelector`,`inlineStylesheet`,`maskInputOptions`,`maskTextFn`,`maskInputFn`,`keepIframeSrcFn`,`recordCanvas`,`inlineImages`,`slimDOMOptions`,`dataURLOptions`,`doc`,`mirror`,`iframeManager`,`stylesheetManager`,`shadowDomManager`,`canvasManager`,`processedNodeManager`].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Dt(e,t){e.delete(t),A.childNodes(t).forEach(t=>Dt(e,t))}function Ot(e,t){let n=[e];for(;n.length;){let e=n.pop();t.has(e)||(t.add(e),A.childNodes(e).forEach(e=>n.push(e)))}}function kt(e,t,n){return e.size!==0&&At(e,t)}function At(e,t,n){let r=A.parentNode(t);return r?e.has(r):!1}function jt(e,t){return e.size!==0&&Mt(e,t)}function Mt(e,t){let n=A.parentNode(t);return n?e.has(n)?!0:Mt(e,n):!1}var V,H=!1,Nt;function Pt(e){V=e}var U=e=>V?(...t)=>{try{return e(...t)}catch(e){if(V&&V(e)===!0)return;throw e}}:e;function W(e,t){let n=U(t);return new Proxy(e,{apply(e,t,r){return H||n(t,r),e.apply(t,r)}})}var G=[];function Ft(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 It(e,t){let n=new Et;G.push(n),n.init(e);let[r,i]=ie(),a=new r(U(e=>{Nt&&Nt(e)===!1||n.processMutations(e)}));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[a,i]}function Lt({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove==`number`?t.mousemove:50,o=typeof t.mousemoveCallback==`number`?t.mousemoveCallback:500,s=[],c,l=it(U(t=>{let n=Date.now()-c;e(s.map(e=>(e.timeOffset-=n,e)),t),s=[],c=null}),o),u=U(it(U(e=>{let t=Ft(e),{clientX:n,clientY:i}=pt(e)?e.changedTouches[0]:e;c||=ae(),s.push({x:n,y:i,id:r.getId(t),timeOffset:ae()-c}),l(typeof DragEvent<`u`&&e instanceof DragEvent?a.Drag:e instanceof MouseEvent?a.MouseMove:a.TouchMove)}),i,{trailing:!1})),d=[z(`mousemove`,u,n),z(`touchmove`,u,n),z(`drag`,u,n)];return U(()=>{d.forEach(e=>e())})}function Rt({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};let c=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,l=[],u=null,d=t=>a=>{let c=Ft(a);if(B(c,r,i,!0))return;let l=null,d=t;if(`pointerType`in a){switch(a.pointerType){case`mouse`:l=s.Mouse;break;case`touch`:l=s.Touch;break;case`pen`:l=s.Pen;break}l===s.Touch?o[t]===o.MouseDown?d=`TouchStart`:o[t]===o.MouseUp&&(d=`TouchEnd`):s.Pen}else pt(a)&&(l=s.Touch);l===null?o[t]===o.Click&&(l=u,u=null):(u=l,(d.startsWith(`Touch`)&&l===s.Touch||d.startsWith(`Mouse`)&&l===s.Mouse)&&(l=null));let f=pt(a)?a.changedTouches[0]:a;if(!f)return;let p=n.getId(c),{clientX:m,clientY:h}=f;U(e)({type:o[d],id:p,x:m,y:h,...l!==null&&{pointerType:l}})};return Object.keys(o).filter(e=>Number.isNaN(Number(e))&&!e.endsWith(`_Departed`)&&c[e]!==!1).forEach(e=>{let n=L(e),r=U(d(e));if(window.PointerEvent)switch(o[e]){case o.MouseDown:case o.MouseUp:n=n.replace(`mouse`,`pointer`);break;case o.TouchStart:case o.TouchEnd:return}l.push(z(n,r,t))}),U(()=>{l.forEach(e=>e())})}function zt({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){return z(`scroll`,U(it(U(a=>{let o=Ft(a);if(!o||B(o,r,i,!0))return;let s=n.getId(o);if(o===t&&t.defaultView){let n=ot(t.defaultView);e({id:s,x:n.left,y:n.top})}else e({id:s,x:o.scrollLeft,y:o.scrollTop})}),a.scroll||100)),t)}function Bt({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return z(`resize`,U(it(U(()=>{let t=st(),i=ct();(n!==t||r!==i)&&(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}var Vt=[`INPUT`,`TEXTAREA`,`SELECT`],Ht=new WeakMap;function Ut({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:a,ignoreSelector:o,maskInputOptions:s,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function d(e){let n=Ft(e),l=e.isTrusted,d=n&&n.tagName;if(n&&d===`OPTION`&&(n=A.parentElement(n)),!n||!d||Vt.indexOf(d)<0||B(n,r,i,!0)||n.classList.contains(a)||o&&n.matches(o))return;let p=n.value,m=!1,h=he(n)||``;h===`radio`||h===`checkbox`?m=n.checked:(s[d.toLowerCase()]||s[h])&&(p=I({element:n,maskInputOptions:s,tagName:d,type:h,value:p,maskInputFn:c})),f(n,u?{text:p,isChecked:m,userTriggered:l}:{text:p,isChecked:m});let g=n.name;h===`radio`&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==n){let t=e.value;f(e,u?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}})}function f(t,r){let i=Ht.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Ht.set(t,r);let i=n.getId(t);U(e)({...r,id:i})}}let p=(l.input===`last`?[`change`]:[`input`,`change`]).map(e=>z(e,U(d),t)),m=t.defaultView;if(!m)return()=>{p.forEach(e=>e())};let h=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,`value`),g=[[m.HTMLInputElement.prototype,`value`],[m.HTMLInputElement.prototype,`checked`],[m.HTMLSelectElement.prototype,`value`],[m.HTMLTextAreaElement.prototype,`value`],[m.HTMLSelectElement.prototype,`selectedIndex`],[m.HTMLOptionElement.prototype,`selected`]];return h&&h.set&&p.push(...g.map(e=>at(e[0],e[1],{set(){U(d)({target:this,isTrusted:!1})}},!1,m))),U(()=>{p.forEach(e=>e())})}function Wt(e){let t=[];function n(e,t){if(tn(`CSSGroupingRule`)&&e.parentRule instanceof CSSGroupingRule||tn(`CSSMediaRule`)&&e.parentRule instanceof CSSMediaRule||tn(`CSSSupportsRule`)&&e.parentRule instanceof CSSSupportsRule||tn(`CSSConditionRule`)&&e.parentRule instanceof CSSConditionRule){let r=Array.from(e.parentRule.cssRules).indexOf(e);return t.unshift(r),n(e.parentRule,t)}else if(e.parentStyleSheet){let n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}return n(e,t)}function Gt(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Kt({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=(r,i)=>{let{id:a,styleId:o}=Gt(r,t,n.styleMirror);(a&&a!==-1||o&&o!==-1)&&e({id:a,styleId:o,...i})},a=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=W(a,(e,[t,n])=>i(e,{adds:[{rule:t,index:n}]}));let o=r.CSSStyleSheet.prototype.addRule;r.CSSStyleSheet.prototype.addRule=o?W(o,(e,[t,n,r=e.cssRules.length])=>i(e,{adds:[{rule:`${t} { ${n} }`,index:r}]})):function(e,t,n=this.cssRules.length){let i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};let s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=W(s,(e,[t])=>i(e,{removes:[{index:t}]}));let c=r.CSSStyleSheet.prototype.removeRule;r.CSSStyleSheet.prototype.removeRule=c?W(c,(e,[t])=>i(e,{removes:[{index:t}]})):function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])};let l;r.CSSStyleSheet.prototype.replace&&(l=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=W(l,(e,[t])=>i(e,{replace:t})));let u;r.CSSStyleSheet.prototype.replaceSync&&(u=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=W(u,(e,[t])=>i(e,{replaceSync:t})));let d={};nn(`CSSGroupingRule`)?d.CSSGroupingRule=r.CSSGroupingRule:(nn(`CSSMediaRule`)&&(d.CSSMediaRule=r.CSSMediaRule),nn(`CSSConditionRule`)&&(d.CSSConditionRule=r.CSSConditionRule),nn(`CSSSupportsRule`)&&(d.CSSSupportsRule=r.CSSSupportsRule));let f={};return Object.entries(d).forEach(([e,t])=>{f[e]={insertRule:t.prototype.insertRule,deleteRule:t.prototype.deleteRule},t.prototype.insertRule=W(f[e].insertRule,(e,[t,n])=>i(e.parentStyleSheet,{adds:[{rule:t,index:[...Wt(e),n||0]}]})),t.prototype.deleteRule=W(f[e].deleteRule,(e,[t])=>i(e.parentStyleSheet,{removes:[{index:[...Wt(e),t]}]}))}),U(()=>{H||(r.CSSStyleSheet.prototype.insertRule=a,r.CSSStyleSheet.prototype.deleteRule=s,o&&(r.CSSStyleSheet.prototype.addRule=o),c&&(r.CSSStyleSheet.prototype.removeRule=c),l&&(r.CSSStyleSheet.prototype.replace=l),u&&(r.CSSStyleSheet.prototype.replaceSync=u),Object.entries(d).forEach(([e,t])=>{t.prototype.insertRule=f[e].insertRule,t.prototype.deleteRule=f[e].deleteRule}))})}function qt({mirror:e,stylesheetManager:t},n){let r=null;r=n.nodeName===`#document`?e.getId(n):e.getId(A.host(n));let i=n.nodeName===`#document`?n.defaultView?.Document:n.ownerDocument?.defaultView?.ShadowRoot,a=i?.prototype?Object.getOwnPropertyDescriptor(i?.prototype,`adoptedStyleSheets`):void 0;return r===null||r===-1||!i||!a?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){return a.get?.call(this)},set(e){let n=a.set?.call(this,e);if(!H&&r!==null&&r!==-1)try{t.adoptStyleSheets(e,r)}catch{}return n}}),U(()=>{H||Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Jt({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=W(a,(i,a)=>{let[o,s,c]=a;if(n.has(o))return;let{id:l,styleId:u}=Gt(i.parentRule?.parentStyleSheet,t,r.styleMirror);(l&&l!==-1||u&&u!==-1)&&e({id:l,styleId:u,set:{property:o,value:s,priority:c},index:Wt(i.parentRule)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=W(o,(i,a)=>{let[o]=a;if(n.has(o))return;let{id:s,styleId:c}=Gt(i.parentRule?.parentStyleSheet,t,r.styleMirror);(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,remove:{property:o},index:Wt(i.parentRule)})}),U(()=>{H||(i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=o)})}function Yt({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:a}){let o=U(a=>it(U(i=>{let o=Ft(i);if(!o||B(o,t,n,!0))return;let{currentTime:s,volume:c,muted:l,playbackRate:u,loop:d}=o;e({type:a,id:r.getId(o),currentTime:s,volume:c,muted:l,playbackRate:u,loop:d})}),i.media||500)),s=[z(`play`,o(l.Play),a),z(`pause`,o(l.Pause),a),z(`seeked`,o(l.Seeked),a),z(`volumechange`,o(l.VolumeChange),a),z(`ratechange`,o(l.RateChange),a)];return U(()=>{s.forEach(e=>e())})}function Xt({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,a=n.FontFace;n.FontFace=function(e,t,n){let r=new a(e,t,n);return i.set(r,{family:e,buffer:typeof t!=`string`,descriptors:n,fontSource:typeof t==`string`?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};let o=k(t.fonts,`add`,function(t){return function(n){return setTimeout(U(()=>{let t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=a}),r.push(o),U(()=>{r.forEach(e=>e())})}function Zt(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:a}=e,o=!0,s=U(()=>{let e=t.getSelection();if(!e||o&&e?.isCollapsed)return;o=e.isCollapsed||!1;let s=[],c=e.rangeCount||0;for(let t=0;t<c;t++){let{startContainer:a,startOffset:o,endContainer:c,endOffset:l}=e.getRangeAt(t);B(a,r,i,!0)||B(c,r,i,!0)||s.push({start:n.getId(a),startOffset:o,end:n.getId(c),endOffset:l})}a({ranges:s})});return s(),z(`selectionchange`,s)}function Qt({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:k(n.customElements,`define`,function(e){return function(n,r,i){if(!H)try{t({define:{name:n}})}catch(e){V&&V(e)===!0||console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,i])}})}function $t(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:a,viewportResizeCb:o,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:f,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),s(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...e)}}function en(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};$t(e,t);let r,i=()=>{};e.recordDOM&&([r,i]=It(e,e.doc));let a=Lt(e),o=Rt(e),s=zt(e),c=Bt(e,{win:n}),l=Ut(e),u=Yt(e),d=()=>{},f=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(d=Kt(e,{win:n}),f=qt(e,e.doc),p=Jt(e,{win:n}),e.collectFonts&&(m=Xt(e)));let h=Zt(e),g=Qt(e),_=[];for(let t of e.plugins)_.push(t.observer(t.callback,n,t.options));return U(()=>{G.forEach(e=>e.reset()),r?.disconnect(),i(),a(),o(),s(),c(),l(),u(),d(),f(),p(),m(),h(),g(),_.forEach(e=>e())})}function tn(e){return window[e]!==void 0}function nn(e){return!!(window[e]!==void 0&&window[e].prototype&&`insertRule`in window[e].prototype&&`deleteRule`in window[e].prototype)}for(var rn=class{constructor(e){r(this,`iframeIdToRemoteIdMap`,new WeakMap),r(this,`iframeRemoteIdToIdMap`,new WeakMap),this.generateIdFn=e}getId(e,t,n,r){let i=n||this.getIdToRemoteIdMap(e),a=r||this.getRemoteIdToIdMap(e),o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),a.set(o,t)),o}getIds(e,t){let n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){let r=n||this.getRemoteIdToIdMap(e);return typeof t==`number`?r.get(t)||-1:t}getRemoteIds(e,t){let n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},an=class{constructor(e){r(this,`iframes`,new WeakMap),r(this,`crossOriginIframeMap`,new WeakMap),r(this,`crossOriginIframeMirror`,new rn(ke)),r(this,`crossOriginIframeStyleMirror`),r(this,`crossOriginIframeRootIdMap`,new WeakMap),r(this,`mirror`),r(this,`mutationCb`),r(this,`wrappedEmit`),r(this,`loadListener`),r(this,`stylesheetManager`),r(this,`recordCrossOriginIframes`),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new rn(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener(`message`,this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=e.contentWindow)==null||n.addEventListener(`message`,this.handleMessage.bind(this))),(r=this.loadListener)==null||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!==`rrweb`||t.origin!==t.data.origin||!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case i.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:i.IncrementalSnapshot,data:{source:a.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case i.Meta:case i.Load:case i.DomContentLoaded:return!1;case i.Plugin:return t;case i.Custom:return this.replaceIds(t.data.payload,e,[`id`,`parentId`,`previousId`,`nextId`]),t;case i.IncrementalSnapshot:switch(t.data.source){case a.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,[`parentId`,`nextId`,`previousId`]),this.replaceIdOnNode(t.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,[`parentId`,`id`])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,[`id`])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,[`id`])}),t;case a.Drag:case a.TouchMove:case a.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,[`id`])}),t;case a.ViewportResize:return!1;case a.MediaInteraction:case a.MouseInteraction:case a.Scroll:case a.CanvasMutation:case a.Input:return this.replaceIds(t.data,e,[`id`]),t;case a.StyleSheetRule:case a.StyleDeclaration:return this.replaceIds(t.data,e,[`id`]),this.replaceStyleIds(t.data,e,[`styleId`]),t;case a.Font:return t;case a.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,[`start`,`end`])}),t;case a.AdoptedStyleSheet:return this.replaceIds(t.data,e,[`id`]),this.replaceStyleIds(t.data,e,[`styleIds`]),(n=t.data.styles)==null||n.forEach(t=>{this.replaceStyleIds(t,e,[`styleId`])}),t}}return!1}replace(e,t,n,r){for(let i of r)!Array.isArray(t[i])&&typeof t[i]!=`number`||(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,[`id`,`rootId`]),`childNodes`in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type!==u.Document&&!e.rootId&&(e.rootId=t),`childNodes`in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},on=class{constructor(e){r(this,`shadowDoms`,new WeakSet),r(this,`mutationCb`),r(this,`scrollCb`),r(this,`bypassOptions`),r(this,`mirror`),r(this,`restoreHandlers`,[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!N(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let[n]=It({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(zt({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(U(()=>{H||(e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(A.host(e))),this.restoreHandlers.push(qt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)))}),0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let n=this;this.restoreHandlers.push(k(e.prototype,`attachShadow`,function(e){return function(r){let i=e.call(this,r);return H||U(()=>{let e=A.shadowRoot(this);e&&St(this)&&n.addShadowRoot(e,t)})(),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},sn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,cn=typeof Uint8Array>`u`?[]:new Uint8Array(256),ln=0;ln<sn.length;ln++)cn[sn.charCodeAt(ln)]=ln;var un=function(e){var t=new Uint8Array(e),n,r=t.length,i=``;for(n=0;n<r;n+=3)i+=sn[t[n]>>2],i+=sn[(t[n]&3)<<4|t[n+1]>>4],i+=sn[(t[n+1]&15)<<2|t[n+2]>>6],i+=sn[t[n+2]&63];return r%3==2?i=i.substring(0,i.length-1)+`=`:r%3==1&&(i=i.substring(0,i.length-2)+`==`),i},dn=new Map;function fn(e,t){let n=dn.get(e);return n||(n=new Map,dn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var pn=(e,t,n)=>{if(!e||!(gn(e,t)||typeof e==`object`))return;let r=e.constructor.name,i=fn(n,r),a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function mn(e,t,n){if(e instanceof Array)return e.map(e=>mn(e,t,n));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)return{rr_type:e.constructor.name,base64:un(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[mn(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}else if(e instanceof HTMLCanvasElement)return{rr_type:`HTMLImageElement`,src:e.toDataURL()};else if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[mn(e.data,t,n),e.width,e.height]};else if(gn(e,t)||typeof e==`object`)return{rr_type:e.constructor.name,index:pn(e,t,n)};return e}var hn=(e,t,n)=>e.map(e=>mn(e,t,n)),gn=(e,t)=>!![`WebGLActiveInfo`,`WebGLBuffer`,`WebGLFramebuffer`,`WebGLProgram`,`WebGLRenderbuffer`,`WebGLShader`,`WebGLShaderPrecisionFormat`,`WebGLTexture`,`WebGLUniformLocation`,`WebGLVertexArrayObject`,`WebGLVertexArrayObjectOES`].filter(e=>typeof t[e]==`function`).find(n=>e instanceof t[n]);function _n(e,t,n,r){let i=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of a)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!=`function`)continue;let a=k(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...a){return B(this.canvas,n,r,!0)||setTimeout(()=>{let n=hn(a,t,this);e(this.canvas,{type:c[`2D`],property:o,args:n})},0),i.apply(this,a)}});i.push(a)}catch{let n=at(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:c[`2D`],property:o,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}function vn(e){return e===`experimental-webgl`?`webgl`:e}function yn(e,t,n,r){let i=[];try{let a=k(e.HTMLCanvasElement.prototype,`getContext`,function(e){return function(i,...a){if(!B(this,t,n,!0)){let e=vn(i);if(`__context`in this||(this.__context=e),r&&[`webgl`,`webgl2`].includes(e))if(a[0]&&typeof a[0]==`object`){let e=a[0];e.preserveDrawingBuffer||=!0}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...a])}});i.push(a)}catch{console.error(`failed to patch HTMLCanvasElement.prototype.getContext`)}return()=>{i.forEach(e=>e())}}function bn(e,t,n,r,i,a){let o=[],s=Object.getOwnPropertyNames(e);for(let c of s)if(![`isContextLost`,`canvas`,`drawingBufferWidth`,`drawingBufferHeight`].includes(c))try{if(typeof e[c]!=`function`)continue;let s=k(e,c,function(e){return function(...o){let s=e.apply(this,o);if(pn(s,a,this),`tagName`in this.canvas&&!B(this.canvas,r,i,!0)){let e=hn(o,a,this),r={type:t,property:c,args:e};n(this.canvas,r)}return s}});o.push(s)}catch{let r=at(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});o.push(r)}return o}function xn(e,t,n,r){let i=[];return t.WebGLRenderingContext!==void 0&&i.push(...bn(t.WebGLRenderingContext.prototype,c.WebGL,e,n,r,t)),t.WebGL2RenderingContext!==void 0&&i.push(...bn(t.WebGL2RenderingContext.prototype,c.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}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
+ `,Cn=typeof self<`u`&&self.Blob&&new Blob([Sn],{type:`text/javascript;charset=utf-8`});function wn(e){let t;try{if(t=Cn&&(self.URL||self.webkitURL).createObjectURL(Cn),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Sn),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Tn=class{constructor(e){r(this,`pendingCanvasMutations`,new Map),r(this,`rafStamps`,{latestId:0,invokeId:null}),r(this,`mirror`),r(this,`mutationCb`),r(this,`resetObservers`),r(this,`frozen`,!1),r(this,`locked`,!1),r(this,`processMutation`,(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});let{sampling:t=`all`,win:n,blockClass:i,blockSelector:a,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t===`all`&&this.initCanvasMutationObserver(n,i,a),o&&typeof t==`number`&&this.initCanvasFPSObserver(t,n,i,a,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,i){let a=yn(t,n,r,!0),o=new Map,s=new wn;s.onmessage=e=>{let{id:t}=e.data;if(o.set(t,!1),!(`base64`in e.data))return;let{base64:n,type:r,width:i,height:a}=e.data;this.mutationCb({id:t,type:c[`2D`],commands:[{property:`clearRect`,args:[0,0,i,a]},{property:`drawImage`,args:[{rr_type:`ImageBitmap`,args:[{rr_type:`Blob`,data:[{rr_type:`ArrayBuffer`,base64:n}],type:r}]},0,0]}]})};let l=1e3/e,u=0,d,f=()=>{let e=[];return t.document.querySelectorAll(`canvas`).forEach(t=>{B(t,n,r,!0)||e.push(t)}),e},p=e=>{if(u&&e-u<l){d=requestAnimationFrame(p);return}u=e,f().forEach(async e=>{let t=this.mirror.getId(e);if(o.get(t)||e.width===0||e.height===0)return;if(o.set(t,!0),[`webgl`,`webgl2`].includes(e.__context)){let t=e.getContext(e.__context);t?.getContextAttributes()?.preserveDrawingBuffer===!1&&t.clear(t.COLOR_BUFFER_BIT)}let n=await createImageBitmap(e);s.postMessage({id:t,bitmap:n,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[n])}),d=requestAnimationFrame(p)};d=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let r=yn(e,t,n,!1),i=_n(this.processMutation.bind(this),e,t,n),a=xn(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),i(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||t===-1)return;let r=n.map(e=>{let{type:t,...n}=e;return n}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}},En=class{constructor(e){r(this,`trackedLinkElements`,new WeakSet),r(this,`mutationCb`),r(this,`adoptedStyleSheetCb`),r(this,`styleMirror`,new vt),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){`_cssText`in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let n={id:t,styleIds:[]},r=[];for(let t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,(e,n)=>({rule:le(e,t.href),index:n}))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Dn=class{constructor(){r(this,`nodeMap`,new WeakMap),r(this,`active`,!1)}inOtherBuffer(e,t){let n=this.nodeMap.get(e);return n&&Array.from(n).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},K,On,kn,An=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement(`iframe`);document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug(`Unable to override Array.from`,e)}var q=fe();function jn(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o=`rr-block`,blockSelector:s=null,ignoreClass:c=`rr-ignore`,ignoreSelector:l=null,maskTextClass:u=`rr-mask`,maskTextSelector:d=null,inlineStylesheet:f=!0,maskAllInputs:p,maskInputOptions:m,slimDOMOptions:h,maskInputFn:g,maskTextFn:_,hooks:v,packFn:y,sampling:b={},dataURLOptions:x={},mousemoveWait:S,recordDOM:ee=!0,recordCanvas:C=!1,recordCrossOriginIframes:te=!1,recordAfter:w=e.recordAfter===`DOMContentLoaded`?e.recordAfter:`load`,userTriggeredOnInput:T=!1,collectFonts:E=!1,inlineImages:D=!1,plugins:O,keepIframeSrcFn:ne=()=>!1,ignoreCSSAttributes:re=new Set([]),errorHandler:ie}=e;if(H)return()=>{};Nt=e.onMutation,Pt(ie);let k=!te||window.parent===window,j=!1;if(!k)try{window.parent.document&&(j=!1)}catch{j=!0}if(k&&!t)throw Error(`emit function is required`);if(!k&&!j)return()=>{};S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),q.reset();let M=p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m===void 0?{password:!0}:m,N=Ze(h);mt();let oe,se=0,ce=e=>{for(let t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!j&&(e=y(e)),e};K=(e,o)=>{let s=e;if(s.timestamp=ae(),G[0]?.isFrozen()&&s.type!==i.FullSnapshot&&(s.type!==i.IncrementalSnapshot||s.data.source!==a.Mutation)&&G.forEach(e=>e.unfreeze()),k)t?.(ce(s),o);else if(j){let e={type:`rrweb`,event:ce(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,`*`)}if(s.type===i.FullSnapshot)oe=s,se=0;else if(s.type===i.IncrementalSnapshot){if(s.data.source===a.Mutation&&s.data.isAttachIframe)return;se++;let e=r&&se>=r,t=n&&s.timestamp-oe.timestamp>n;(e||t)&&On(!0)}};let le=e=>{K({type:i.IncrementalSnapshot,data:{source:a.Mutation,...e}})},ue=e=>K({type:i.IncrementalSnapshot,data:{source:a.Scroll,...e}}),de=e=>K({type:i.IncrementalSnapshot,data:{source:a.CanvasMutation,...e}}),P=new En({mutationCb:le,adoptedStyleSheetCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.AdoptedStyleSheet,...e}})}),F=new an({mirror:q,mutationCb:le,stylesheetManager:P,recordCrossOriginIframes:te,wrappedEmit:K});for(let e of O||[])e.getMirror&&e.getMirror({nodeMirror:q,crossOriginIframeMirror:F.crossOriginIframeMirror,crossOriginIframeStyleMirror:F.crossOriginIframeStyleMirror});let fe=new Dn;kn=new Tn({recordCanvas:C,mutationCb:de,win:window,blockClass:o,blockSelector:s,mirror:q,sampling:b.canvas,dataURLOptions:x});let I=new on({mutationCb:le,scrollCb:ue,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:u,maskTextSelector:d,inlineStylesheet:f,maskInputOptions:M,dataURLOptions:x,maskTextFn:_,maskInputFn:g,recordCanvas:C,inlineImages:D,sampling:b,slimDOMOptions:N,iframeManager:F,stylesheetManager:P,canvasManager:kn,keepIframeSrcFn:ne,processedNodeManager:fe},mirror:q});On=(e=!1)=>{if(!ee)return;K({type:i.Meta,data:{href:window.location.href,width:ct(),height:st()}},e),P.reset(),I.init(),G.forEach(e=>e.lock());let t=et(document,{mirror:q,blockClass:o,blockSelector:s,maskTextClass:u,maskTextSelector:d,inlineStylesheet:f,maskAllInputs:M,maskTextFn:_,maskInputFn:g,slimDOM:N,dataURLOptions:x,recordCanvas:C,inlineImages:D,onSerialize:e=>{ht(e,q)&&F.addIframe(e),gt(e,q)&&P.trackLinkElement(e),_t(e)&&I.addShadowRoot(A.shadowRoot(e),document)},onIframeLoad:(e,t)=>{F.attachIframe(e,t),I.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{P.attachLinkElement(e,t)},keepIframeSrcFn:ne});if(!t)return console.warn(`Failed to snapshot the document`);K({type:i.FullSnapshot,data:{node:t,initialOffset:ot(window)}},e),G.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,q.getId(document))};try{let e=[],t=e=>U(en)({mutationCb:le,mousemoveCb:(e,t)=>K({type:i.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.MouseInteraction,...e}}),scrollCb:ue,viewportResizeCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.ViewportResize,...e}}),inputCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.Input,...e}}),mediaInteractionCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.MediaInteraction,...e}}),styleSheetRuleCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.StyleSheetRule,...e}}),styleDeclarationCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.StyleDeclaration,...e}}),canvasMutationCb:de,fontCb:e=>K({type:i.IncrementalSnapshot,data:{source:a.Font,...e}}),selectionCb:e=>{K({type:i.IncrementalSnapshot,data:{source:a.Selection,...e}})},customElementCb:e=>{K({type:i.IncrementalSnapshot,data:{source:a.CustomElement,...e}})},blockClass:o,ignoreClass:c,ignoreSelector:l,maskTextClass:u,maskTextSelector:d,maskInputOptions:M,inlineStylesheet:f,sampling:b,recordDOM:ee,recordCanvas:C,inlineImages:D,userTriggeredOnInput:T,collectFonts:E,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:ne,blockSelector:s,slimDOMOptions:N,dataURLOptions:x,mirror:q,iframeManager:F,stylesheetManager:P,shadowDomManager:I,processedNodeManager:fe,canvasManager:kn,ignoreCSSAttributes:re,plugins:(O?.filter(e=>e.observer))?.map(e=>({observer:e.observer,options:e.options,callback:t=>K({type:i.Plugin,data:{plugin:e.name,payload:t}})}))||[]},v);F.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){V&&V(e)===!0||console.warn(e)}});let n=()=>{On(),e.push(t(document)),An=!0};return[`interactive`,`complete`].includes(document.readyState)?n():(e.push(z(`DOMContentLoaded`,()=>{K({type:i.DomContentLoaded,data:{}}),w===`DOMContentLoaded`&&n()})),e.push(z(`load`,()=>{K({type:i.Load,data:{}}),w===`load`&&n()},window))),()=>{H=!0,e.forEach(e=>{try{e()}catch(e){!String(e).toLowerCase().includes(`cross-origin`)&&!(V&&V(e)===!0)&&console.warn(e)}}),fe.destroy(),q.reset(),P.reset(),An=!1}}catch(e){V&&V(e)===!0||console.warn(e)}}jn.addCustomEvent=(e,t)=>{if(!An)throw Error(`please add custom event after start recording`);K({type:i.Custom,data:{tag:e,payload:t}})},jn.freezePage=()=>{G.forEach(e=>e.freeze())},jn.takeFullSnapshot=e=>{if(!An)throw Error(`please take full snapshot after start recording`);On(e)},jn.mirror=q;var Mn=`mime8/end@1`,Nn=`mime8/environment@1`;function Pn(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}var Fn=`mime8/keys@1`,In=`mime8/rrweb-error@1`,Ln=`mime8/network@1`,Rn=`mime8/storage@1`,zn=`mime8/storage-change@1`;function Bn(e,t,n,r){let i=e=>{try{e()}catch{}},a=e,o=e=>{let t=null;return i(()=>{e===a.localStorage?t=`local`:e===a.sessionStorage&&(t=`session`)}),t},s=a.Storage.prototype,{setItem:c,removeItem:l,clear:u}=s;return s.setItem=function(e,a){let s=Reflect.apply(c,this,arguments);return i(()=>{let i=o(this);if(i){let o=String(a);t({by:`app`,area:i,op:`set`,key:String(e),size:o.length,hash:n(o)}),r?.(String(e),o)}}),s},s.removeItem=function(e){let n=!1;i(()=>{n=this.getItem(e)!==null});let r=Reflect.apply(l,this,arguments);return i(()=>{let r=o(this);r&&n&&t({by:`app`,area:r,op:`remove`,key:String(e)})}),r},s.clear=function(){let e=!0;i(()=>{e=this.length===0});let n=Reflect.apply(u,this,arguments);return i(()=>{let n=o(this);n&&!e&&t({by:`app`,area:n,op:`clear`})}),n},{setItem:c,removeItem:l,clear:u}}function Vn(e){return{type:6,timestamp:e.t,data:{plugin:Ln,payload:e}}}function Hn(e,t){return{type:6,timestamp:t,data:{plugin:Rn,payload:e}}}function Un(e,t){return{type:6,timestamp:t,data:{plugin:Nn,payload:e}}}function Wn(e,t){return{type:6,timestamp:t,data:{plugin:Mn,payload:e}}}var Gn=2,Kn=3,qn=5,Jn=e=>e.reduce((e,t)=>e+t.length,0);function Yn(e,t=e=>e,n=1/0,r=()=>{},i=()=>[]){let a=[],o=[],s=0,c=0,l=!1,u=null,d=``,f=new WeakMap;function p(){l||(l=!0,r())}function m(n,r){let i=location.href;i!==u&&(u=i,d=t(i));let c=n.data;e.events.push(n),a.push(r),o.push({timestamp:n.timestamp,full:n.type===Gn,input:n.type===Kn&&c?.source===qn,url:d}),s+=r.length}function h(e){l||(m(e,JSON.stringify(e)),p())}return{push(e){if(l)return;let t=JSON.stringify(e);if(s+c+t.length>n){h(Wn({reason:`buffer`,limitBytes:n,eventBytes:t.length},Date.now()));return}m(e,t)},bytes:()=>s,take({hold:t=0}={}){let n=e.events.length;if(t>0){let e=Date.now()-t,r=o.findIndex(t=>t.input&&t.timestamp>=e);r!==-1&&(n=r)}if(n===0)return null;let r=e.events.slice(0,n),l=a.slice(0,n),u=o.slice(0,n);e.events=e.events.slice(n),a=a.slice(n),o=o.slice(n),s-=Jn(l);let d=new Set(i(r,l));if(d.size>0){let e=(e,t)=>!d.has(t);r.splice(0,r.length,...r.filter(e)),l.splice(0,l.length,...l.filter(e)),u=u.filter(e)}if(r.length===0)return null;let p=1/0,m=-1/0;for(let{timestamp:e}of u)p=Math.min(p,e),m=Math.max(m,e);let h={events:r,json:`{"events":[${l.join(`,`)}]}`,parts:l,bytes:Jn(l),start:p,end:m,hasFullSnapshot:u.some(e=>e.full),urls:[...new Set(u.map(e=>e.url))]};return c+=h.bytes,f.set(h,u),h},restore(t){c-=t.bytes,e.events=[...t.events,...e.events],a=[...t.parts,...a],o=[...f.get(t)??[],...o],s+=t.bytes},release(e){c-=e.bytes},end:h,close:p}}var J={collectorUrl:`https://api.mime8.com`,recorderVersion:`0.2.0`,ignoreUrls:[],maxBodySize:1024*1024,redact:[{header:/authorization|cookie|token|secret|api-?key|forwarded/i},{queryParam:/token|secret|password|api_?key|signature|credential/i},{bodyField:/password|passwd|secret|token|api_?key/i},{bodyField:/^hash$/i}],earlyUploadBytes:256*1024,maxBufferBytes:5*1024*1024,maxBatchChanges:1e4,uploadInterval:1e4,streamingTypes:[`text/event-stream`,`application/x-ndjson`,`application/jsonl`,`multipart/mixed`,`text/x-component`,`application/grpc-web`,`application/grpc-web+proto`,`application/grpc-web-text`,`application/grpc-web-text+proto`,`application/connect+proto`,`application/connect+json`],mediaTypes:[`image/`,`audio/`,`video/`,`font/`,`application/wasm`]};function Xn(e){let t=e.network??{},n=t.redact??{};return{...J,projectKey:e.projectKey,collectorUrl:e.collectorUrl??J.collectorUrl,ignoreUrls:[...J.ignoreUrls,...t.ignoreUrls??[]],maxBodySize:t.maxBodySize??J.maxBodySize,redact:[...J.redact,...(n.headers??[]).map(e=>({header:e})),...(n.queryParams??[]).map(e=>({queryParam:e})),...(n.bodyFields??[]).map(e=>({bodyField:e}))],beforeRecord:t.beforeRecord,streamingTypes:[...J.streamingTypes],mediaTypes:[...J.mediaTypes]}}var Zn=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});function Qn(e){if(typeof e.toBase64==`function`)return e.toBase64();let t=``;for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}function $n(e){try{return{text:Zn.decode(e)}}catch{return{base64:Qn(e)}}}function er(e){for(let t=e.length-1;t>=Math.max(0,e.length-3);t--){let n=e[t];if((n&192)==128)continue;let r=n>=240?4:n>=224?3:n>=192?2:1;return e.length-t<r?t:e.length}return e.length}function tr(e,t){if(e.length===0)return t;let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function nr(){let e=new Uint8Array;return{push(t){let n=tr(e,t),r=er(n);try{let t=Zn.decode(n.subarray(0,r));return e=n.slice(r),t?{text:t}:null}catch{return e=new Uint8Array,{base64:Qn(n)}}},end(){if(e.length===0)return null;let t=$n(e);return e=new Uint8Array,t}}}function rr(e,t){return e>t.maxBodySize?{omitted:`too-large`,size:e}:null}function ir(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&n+1<e.length?(t+=4,n++):t+=3}return t}function ar(e,t){return e.length*3<=t.maxBodySize?null:rr(ir(e),t)}async function or(e,t,n=!1){let r=rr(e.size,t);if(r)return r;let i=new Uint8Array(await e.arrayBuffer());return n?{base64:Qn(i)}:$n(i)}function sr(e){let t=[];return e.forEach((e,n)=>{t.push(typeof e==`string`?{name:n,value:e}:{name:n,file:{name:e.name,type:e.type,size:e.size}})}),t}function cr(e,t){if(e!=null){if(typeof e==`string`||e instanceof URLSearchParams){let n=e.toString();return ar(n,t)??{text:n}}if(e instanceof FormData)return{form:sr(e)};if(e instanceof Blob)return or(e,t);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return rr(n.byteLength,t)??$n(n)}return e instanceof ReadableStream?{omitted:`stream`}:{omitted:`unreadable`}}}function lr(e){return typeof e==`string`?`text/plain;charset=UTF-8`:e instanceof URLSearchParams?`application/x-www-form-urlencoded;charset=UTF-8`:e instanceof FormData?`multipart/form-data`:e instanceof Blob&&e.type||null}async function ur(e,t){let n=e.getReader(),r=[],i=0;for(let e=await n.read();!e.done;e=await n.read()){if(i+=e.value.byteLength,i>t)return n.cancel().catch(()=>{}),null;r.push(e.value)}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.byteLength;return a}function Y(e){try{e()}catch{}}function dr(e){return e instanceof Error||e instanceof DOMException?e.message:String(e)}function fr(e,t,n){let r=e.navigator;if(typeof r.sendBeacon!=`function`)return;let i=r.sendBeacon.bind(r),a=e=>Y(()=>t.emit(e));r.sendBeacon=function(e,r){let o=i(e,r);return Y(()=>{let i=new URL(String(e),document.baseURI).href;if(t.ignores(i))return;let s=t.nextId(),c=Date.now(),l=lr(r),u=e=>({type:`http-request`,api:`beacon`,method:`POST`,url:i,headers:l?[[`content-type`,l]]:[],...e?{body:e}:{},queued:o,t:c,id:s}),d=cr(r,n);if(d instanceof Promise){let e=t.place();d.catch(()=>({omitted:`unreadable`})).then(t=>a({...u(t),n:e}))}else a(u(d))}),o}}function pr(e,t,n){return n.find(n=>e.matchMedia(`(${t}: ${n})`).matches)??`unknown`}function mr(e=window){let{navigator:t,screen:n}=e;return{timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,languages:t.languages?[...t.languages]:[t.language],devicePixelRatio:e.devicePixelRatio,userAgent:t.userAgent,colorScheme:e.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,reducedMotion:e.matchMedia(`(prefers-reduced-motion: reduce)`).matches,hover:pr(e,`hover`,[`hover`,`none`]),anyHover:pr(e,`any-hover`,[`hover`,`none`]),pointer:pr(e,`pointer`,[`fine`,`coarse`,`none`]),anyPointer:pr(e,`any-pointer`,[`fine`,`coarse`,`none`]),maxTouchPoints:t.maxTouchPoints,screen:{width:n.width,height:n.height}}}var hr=new Set([`Enter`,`Escape`,`Tab`,`Backspace`,`Delete`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),gr=new Set([`button`,`submit`,`reset`,`checkbox`,`radio`]),_r=new Set([`button`,`checkbox`,`switch`,`menuitem`]);function vr(e){return e instanceof Element?e instanceof HTMLButtonElement?!0:e instanceof HTMLInputElement?gr.has(e.type):_r.has(e.getAttribute(`role`)??``):!1}function yr(e,t){if(e.isComposing||e.key===`Process`||e.keyCode===229)return!1;if(hr.has(e.key))return!0;let{ctrlKey:n,metaKey:r,altKey:i}=e;if(/^.$/u.test(e.key)){if(e.key===` `&&!n&&!r&&!i)return vr(t);let a=e.getModifierState(`AltGraph`)||n&&i||i&&!r;return(n||r)&&!a}return n||r||i}function br(e,t,n){let r=e=>Y(()=>{let r=e.composedPath()[0];yr(e,r)&&t({type:6,timestamp:Date.now(),data:{plugin:Fn,payload:{key:e.key,code:e.code,alt:e.altKey,ctrl:e.ctrlKey,meta:e.metaKey,shift:e.shiftKey,repeat:e.repeat,id:r instanceof Node?n(r):null}}})}),i={capture:!0,passive:!0};return e.addEventListener(`keydown`,r,i),()=>e.removeEventListener(`keydown`,r,i)}var xr=3,Sr=2,Cr=5,wr=2,Tr=new Set([`click`,`dblclick`,`contextmenu`,`mousedown`,`mouseup`,`pointerdown`,`pointerup`,`touchstart`,`touchend`,`beforeinput`,`input`,`change`,`submit`]),Er=new Set([`keydown`,`keyup`,`keypress`]);function Dr(e){return e?.isTrusted?Er.has(e.type)?yr(e,e.composedPath()[0]):Tr.has(e.type):!1}function Or(e){let t=e.HTMLElement.prototype,n=t.click,r=[],i=`event`in e;function a(...t){let i=!1;Y(()=>{i=r.length>0?r[r.length-1]:Dr(e.event)}),r.push(i);try{return n.apply(this,t)}finally{r.pop()}}t.click=a;let o=t=>{if(t.source===Cr)return t.userTriggered!==!1||!i||e.event!==void 0?null:{byApp:!0};if(t.source!==Sr||t.type!==wr)return null;let n=e.event;if(n?.type!==`click`)return null;let a={userTriggered:n.isTrusted};return!n.isTrusted&&r[r.length-1]===!0&&(a.byApp=!0),a};return{mark:e=>{if(e.type!==xr)return e;let t;try{t=o(e.data)}catch{t=null}return t?{...e,data:{...e.data,...t}}:e},uninstall:()=>{t.click=n}}}var kr=EventTarget.prototype.addEventListener;function Ar(e,t){let n=e.EventSource;if(typeof n!=`function`)return;let r=new WeakMap,i=e=>Y(()=>t.emit(e));function a(e,t,n){n===`open`||n===`error`||t.subscribed.has(n)||(t.subscribed.add(n),kr.call(e,n,e=>{let r=e;i({type:`sse-message`,event:n,data:String(r.data),lastEventId:r.lastEventId,t:Date.now(),id:t.id})}))}class o extends n{constructor(e,n){super(e,n),Y(()=>{if(t.ignores(this.url))return;let e={id:t.nextId(),subscribed:new Set};r.set(this,e);let{id:n}=e;i({type:`sse-connect`,url:this.url,withCredentials:this.withCredentials,t:Date.now(),id:n}),kr.call(this,`open`,()=>i({type:`sse-open`,t:Date.now(),id:n})),kr.call(this,`error`,()=>i({type:`sse-error`,readyState:this.readyState,t:Date.now(),id:n})),a(this,e,`message`)})}close(){Y(()=>{let e=r.get(this);e&&this.readyState!==n.CLOSED&&i({type:`sse-close`,t:Date.now(),id:e.id})}),super.close()}}Object.defineProperty(o.prototype,"addEventListener",{configurable:!0,writable:!0,value:function(e,t,n){Y(()=>{let t=r.get(this);t&&a(this,t,e)}),kr.call(this,e,t,n)}}),Object.defineProperty(o,"name",{value:`EventSource`}),e.EventSource=o}function jr(e,t){if(!e)return!1;let n=e.split(`;`)[0].trim().toLowerCase();return t.some(e=>e.endsWith(`/`)?n.startsWith(e):e.startsWith(`+`)?n.endsWith(e):n===e)}var Mr=new Set([`DELETE`,`GET`,`HEAD`,`OPTIONS`,`POST`,`PUT`]);function Nr(e){let t=e.toUpperCase();return Mr.has(t)?t:e}function Pr(e){return[...e]}function Fr(e){return e instanceof DOMException||e instanceof Error?e.name:void 0}function Ir(e,t){return Fr(e)===`TimeoutError`||Fr(t?.reason)===`TimeoutError`?`timeout`:Fr(e)===`AbortError`||t?.aborted===!0?`abort`:`network`}async function Lr(e,t){if(!e.body)return;let n=await ur(e.body,t.maxBodySize);if(!n)return{omitted:`too-large`};let r=e.headers.get(`content-type`);if(r?.toLowerCase().startsWith(`multipart/form-data`))try{return{form:sr(await new Response(n,{headers:{"content-type":r}}).formData())}}catch{}return $n(n)}function Rr(e){return e!==void 0&&!(e instanceof Headers)&&!Array.isArray(e)&&typeof e[Symbol.iterator]==`function`?new Headers:new Headers(e)}function zr(e,t,n){let r=t?.headers?Rr(t.headers):new Headers(e.headers);if(n&&!r.has(`content-type`)){let e=lr(t?.body);e&&r.set(`content-type`,e)}return r}function Br(e,t,n){if(e instanceof Request){let r=t?.body!==void 0&&t.body!==null,i=r?null:e.clone();return{method:Nr(t?.method??e.method),headers:Pr(zr(e,t,r)),body:i?Lr(i,n):cr(t?.body,n),signal:t?.signal??e.signal}}let r=Rr(t?.headers),i=r.has(`content-type`)?null:lr(t?.body);return i&&r.set(`content-type`,i),{method:Nr(t?.method??`GET`),headers:Pr(r),body:cr(t?.body,n),signal:t?.signal}}function Vr(e){return e instanceof Request?e.url:new URL(e instanceof URL?e.href:String(e),document.baseURI).href}function Hr(e,t,n){let r=e.fetch;function i(e,r){let i=Vr(e);if(t.ignores(i))return null;let a=t.nextId(),o=Date.now(),{method:s,headers:c,body:l,signal:u}=Br(e,r,n),d=e=>Y(()=>t.emit(e)),f=e=>({type:`http-request`,api:`fetch`,method:s,url:i,headers:c,...e?{body:e}:{},t:o,id:a});if(l instanceof Promise){let e=t.place();l.catch(()=>void 0).then(t=>d({...f(t),n:e}))}else d(f(l));let p=e=>d({type:`http-error`,reason:Ir(e,u),message:dr(e),t:Date.now(),id:a});async function m(e){let t=e.clone();if(!t.body){d({type:`http-end`,t:Date.now(),id:a});return}try{let r=await ur(t.body,n.maxBodySize);if(r){d({type:`http-end`,body:$n(r),t:Date.now(),id:a});return}let i=Number(e.headers.get(`content-length`));d({type:`http-end`,body:Number.isFinite(i)&&i>0?{omitted:`too-large`,size:i}:{omitted:`too-large`},t:Date.now(),id:a})}catch(e){p(e)}}function h(e,t){let r=nr(),i=null,o=0,s=!1,c=e=>Y(()=>{if(s)return;if(o+=e.byteLength,o>n.maxBodySize){s=!0;return}let t=r.push(e);t&&d({type:`http-chunk`,data:t,t:Date.now(),id:a})}),l=new ReadableStream({type:`bytes`,async pull(e){for(i??=t.getReader();;){let t;try{t=await i.read()}catch(t){p(t),e.error(t);return}if(t.done){Y(()=>{let e=s?null:r.end();e&&d({type:`http-chunk`,data:e,t:Date.now(),id:a}),d({type:`http-end`,...s?{truncated:!0}:{},t:Date.now(),id:a})}),e.close();return}if(t.value.byteLength!==0){c(t.value),e.enqueue(new Uint8Array(t.value));return}}},cancel(e){return p(new DOMException(String(e??`cancelled`),`AbortError`)),(i??t).cancel(e)}}),u=new Response(l,{status:e.status,statusText:e.statusText,headers:e.headers});for(let t of[`url`,`redirected`,`type`])Object.defineProperty(u,t,{value:e[t]});return u}return{failed:p,responded(e){if(d({type:`http-response`,status:e.status,statusText:e.statusText,url:e.url||i,redirected:e.redirected,fetchType:e.type,headers:Pr(e.headers),t:Date.now(),id:a}),e.type===`opaque`||e.type===`opaqueredirect`){d({type:`http-end`,t:Date.now(),id:a});return}let t=e.headers.get(`content-type`);if(jr(t,n.mediaTypes)){d({type:`http-end`,body:{omitted:`media`},t:Date.now(),id:a});return}if(jr(t,n.streamingTypes)&&e.body)return h(e,e.body);m(e)}}}async function a(t,n){let a=null;Y(()=>{a=i(t,n)});let o;try{o=await r.call(e,t,n)}catch(e){let t=a;throw Y(()=>t?.failed(e)),e}let s=a,c=o;return Y(()=>{c=s?.responded(o)??o}),c}e.fetch=a}var Ur=[`RTCPeerConnection`,`Worker`,`SharedWorker`,`WebTransport`,`WebSocketStream`];function Wr(e,t){for(let n of Ur){let r=e[n];if(typeof r!=`function`)continue;let i=class extends r{constructor(...e){super(...e),Y(()=>{let[r]=e,i=typeof r==`string`||r instanceof URL?new URL(String(r),document.baseURI).href:void 0;t.emit({type:`marker`,api:n,...i?{url:i}:{},t:Date.now()})})}};Object.defineProperty(i,"name",{value:n}),e[n]=i}}function Gr(e,t){if(e.length>t)return e.length;let n=e.length;for(let r of e){let e=r.addedNodes;for(let r=0;r<e.length;r++){let i=e[r];if(n+=i.nodeType===Node.ELEMENT_NODE?1+i.getElementsByTagName(`*`).length:1,n>t)return n}}return n}function Kr(e,t,n){return r=>{let i=!1;return Y(()=>{if(n()){i=!0;return}Gr(r,e)>e&&(t(r.length),i=!0)}),!i}}function qr(e,t){return e.lastIndex=0,e.test(t)}function X(e,t){return typeof e==`string`?e.toLowerCase()===t.toLowerCase():e instanceof RegExp?qr(e,t):e(t)}function Jr(e,t){return typeof e==`string`?t.startsWith(e):e instanceof RegExp?qr(e,t):e(t)}var Z=`[redacted]`,Q=()=>{};function Yr(e,t,n,r=null){let i=t=>{for(;/\s/.test(e[t]??``);)t++;return t},a=t=>{for(t++;e[t]!==`"`;t++)e[t]===`\\`&&t++;return t+1},o=e[t];if(o===`"`){let e=a(t);return n(r,t,e),e}if(o!==`{`&&o!==`[`){let i=t;for(;i<e.length&&!/[\s,\]}]/.test(e[i]);)i++;return n(r,t,i),i}let s=o===`{`?`}`:`]`,c=i(t+1);for(;e[c]!==s;){if(o===`{`){let t=a(c),r=JSON.parse(e.slice(c,t));c=i(i(t)+1),c=Yr(e,c,n,r)}else c=Yr(e,c,n);c=i(c),e[c]===`,`&&(c=i(c+1))}return n(r,t,c+1),c+1}function Xr(e,t){if(t.length===0)return e;t.sort((e,t)=>e[0]-t[0]||t[1]-e[1]);let n=``,r=0;for(let[i,a,o]of t)i<r||(n+=`${e.slice(r,i)}${o}`,r=a);return n+e.slice(r)}function Zr(e){if(!e.startsWith(`"`))return null;let t=JSON.parse(e);return/^\s*[[{]/.test(t)&&Qr(t)?t:null}function Qr(e){try{return JSON.parse(e),!0}catch{return!1}}var $r=e=>/^\s*[[{]/.test(e)&&Qr(e),ei=e=>/^\s*"/.test(e)&&Qr(e);function ti(e,t){let n=[];return Yr(e,e.search(/\S/),(r,i,a)=>{let o=e.slice(i,a);if(!o.startsWith(`"`))return;let s=JSON.stringify(t(JSON.parse(o)));s!==o&&n.push([i,a,s])}),Xr(e,n)}function ni(e,t,n){if(!Qr(e))return e;let r=[];return Yr(e,e.search(/\S/),(i,a,o)=>{let s=e.slice(a,o);if(i!==null&&X(t,i)){s.startsWith(`"`)?r.push([a,o,JSON.stringify(n(JSON.parse(s)))]):s.startsWith(`{`)||s.startsWith(`[`)?r.push([a,o,ti(s,n)]):r.push([a,o,JSON.stringify(n(s))]);return}let c=Zr(s);if(c===null)return;let l=ni(c,t,n);l!==c&&r.push([a,o,JSON.stringify(l)])}),Xr(e,r)}var ri=/^([\w-]+)\.([\w-]+)\.([\w-]*)$/,ii=`cmVkYWN0ZWQ`;function ai(e){try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return new TextDecoder(`utf-8`,{fatal:!0}).decode(Uint8Array.from(t,e=>e.charCodeAt(0)))}catch{return null}}function oi(e){let t=``;for(let n of new TextEncoder().encode(e))t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function si(e){try{let t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}catch{return null}}function ci(e,t=Q){let n=r=>{let i=ri.exec(r);if(!i)return null;let o=si(ai(i[1]))?.alg,s=ai(i[2]);if(typeof o!=`string`||!si(s))return null;let c=Z;if(i[3]!==``&&o.toLowerCase()!==`none`){let t=s;for(let n of e)t=ni(t,n,a);t=$(t,n);let r=t===s?i[2]:oi(t);c=`${i[1]}.${r}.${ii}`}return t(r,c),c},r=e=>(t(e,Z),Z),i=e=>n(e)??r(e),a=e=>{if($r(e))return ti(e,a);if(ei(e))return JSON.stringify(a(JSON.parse(e)));let t=li.exec(e),i=t&&n(t[2]);return i?t[1]===void 0?i:`${t[1]} ${i}`:r(e)};return{replace:i,field:a,jwt:n}}var li=/^(?:([A-Za-z][\w-]*) )?([\w-]+\.[\w-]+\.[\w-]*)$/,ui=/^[^\s=&]+=[^\s&]*(?:&[^\s=&]+=[^\s&]*)*$/,di=/(?:(?<=%[0-9A-Fa-f]{2})|(?<![\w.%-]))[\w-]+\.[\w-]+\.[\w-]*(?![\w-]|\.[\w-])/g;function $(e,t){return e.includes(`.`)?e.replace(di,e=>t(e)??e):e}function fi(e,t,{plusIsSpace:n=!0}={}){let r=hi(e,n);if(r===e)return null;let i=$(r,t);return i===r?null:encodeURIComponent(i)}function pi(e,t){let n=!1,r=e.split(`&`).map(e=>{let r=e.indexOf(`=`);if(r===-1)return e;let i=t(e.slice(r+1));return i===null?e:(n=!0,`${e.slice(0,r)}=${i}`)});return n?r.join(`&`):e}function mi(e){return e.flatMap(e=>`bodyField`in e?[e.bodyField]:[])}function hi(e,t=!0){try{return decodeURIComponent(t?e.replaceAll(`+`,` `):e)}catch{return e}}function gi(e,t,n){let r=!1,i=e.split(`&`).map(e=>{let i=e.indexOf(`=`);if(i===-1)return e;let a=e.slice(0,i);return X(t,hi(a))?(r=!0,`${a}=${n(e.slice(i+1))}`):e});return r?i.join(`&`):e}function _i(e){return(e.find(([e])=>e===`content-type`)?.[1]??``).split(`;`)[0].trim().toLowerCase()===`application/x-www-form-urlencoded`}function vi(e,t,n,r=!1){if(`text`in e){let i=r?gi(e.text,t,n):ni(e.text,t,n);return i===e.text?e:{text:i}}return`form`in e&&e.form.some(e=>X(t,e.name))?{form:e.form.map(e=>X(t,e.name)?{name:e.name,value:`value`in e?n(e.value):Z}:e)}:e}var yi={is:e=>`bodyField`in e,apply(e,t,n){let r=t.bodyField;switch(e.type){case`http-request`:{if(!e.body)return e;let t=vi(e.body,r,n,_i(e.headers));return t===e.body?e:{...e,body:t}}case`http-end`:{if(!e.body)return e;let t=`text`in e.body&&ui.test(e.body.text),i=vi(e.body,r,n,t);return i===e.body?e:{...e,body:i}}case`ws-send`:case`ws-message`:{let t=vi(e.data,r,n);return t===e.data?e:{...e,data:t}}case`sse-message`:{let t=ni(e.data,r,n);return t===e.data?e:{...e,data:t}}default:return e}}};function bi(e,t,n){if(e.toLowerCase()===`cookie`)for(let e of t.split(/;\s*/)){let t=e.indexOf(`=`);t!==-1&&n(e.slice(t+1),Z)}}function xi(e,t,n,r){return e.some(([e])=>X(t,e))?e.map(([e,i])=>X(t,e)?(bi(e,i,r),[e,n(i)]):[e,i]):e}var Si={is:e=>`header`in e,apply(e,t,n,r){if(e.type!==`http-request`&&e.type!==`http-response`)return e;let i=xi(e.headers,t.header,n,r);return i===e.headers?e:{...e,headers:i}}},Ci=e=>t=>(e(t,Z),Z);function wi(e,t){let n=e.indexOf(`#`),r=n===-1?e:e.slice(0,n),i=n===-1?null:e.slice(n+1),a=r,o=r.indexOf(`?`);if(o!==-1&&(a=r.slice(0,o+1)+t(r.slice(o+1))),i===null)return a;let s=i.indexOf(`?`),c=i;return s===-1?i.includes(`=`)&&(c=t(i)):c=i.slice(0,s+1)+t(i.slice(s+1)),`${a}#${c}`}function Ti(e,t,n=Q){return wi(e,e=>gi(e,t,Ci(n)))}function Ei(e,t){let n=e=>pi(e,e=>$(Di(e),t)===Di(e)?null:Z),r=e=>$(e,t).split(`/`).map(e=>fi(e,t,{plusIsSpace:!1})??e).join(`/`),i=e=>{let t=e.indexOf(`?`);return t===-1?r(e):r(e.slice(0,t))+`?`+n(e.slice(t+1))},a=e.indexOf(`#`);if(a===-1)return i(e);let o=e.slice(a+1),s=!o.includes(`?`)&&o.includes(`=`)?n(o):i(o);return`${i(e.slice(0,a))}#${s}`}function Di(e){try{return decodeURIComponent(e.replaceAll(`+`,` `))}catch{return e}}var Oi={is:e=>`queryParam`in e,apply(e,t,n,r){switch(e.type){case`http-request`:case`http-response`:case`sse-connect`:case`ws-connect`:case`marker`:{if(e.url===void 0)return e;let n=Ti(e.url,t.queryParam,r);return n===e.url?e:{...e,url:n}}default:return e}}},ki=[Si,Oi,yi],Ai=/^([a-z][a-z\d+.-]*:\/\/[^/?#@:]*:)([^/?#@]*)@/i;function ji(e,t){let n=Ai.exec(e);return n?(t(n[2],Z),`${n[1]}${Z}@${e.slice(n[0].length)}`):e}function Mi(e,t,n=Q){let r=e;if(`url`in r&&r.url!==void 0){let e=ji(r.url,n);e!==r.url&&(r={...r,url:e})}let{replace:i,field:a,jwt:o}=ci(mi(t),n);for(let e of t){let t=ki.find(t=>t.is(e));t&&(r=t.apply(r,e,`bodyField`in e?a:i,n))}return Ni(r,o)}function Ni(e,t){let n=e=>{if(`text`in e){let n=$(e.text,t);return ui.test(n)&&(n=pi(n,e=>fi(e,t))),n===e.text?e:{text:n}}let n=e=>$(e,t);return`form`in e&&e.form.some(e=>`value`in e&&n(e.value)!==e.value)?{form:e.form.map(e=>`value`in e?{name:e.name,value:n(e.value)}:e)}:e},r=e=>e.some(([,e])=>$(e,t)!==e)?e.map(([e,n])=>[e,$(n,t)]):e,i=e;if(`url`in i&&i.url!==void 0){let e=Ei(i.url,t);e!==i.url&&(i={...i,url:e})}switch(i.type){case`http-request`:{let e=i.body&&n(i.body),t=r(i.headers);return e===i.body&&t===i.headers?i:{...i,headers:t,...e?{body:e}:{}}}case`http-response`:{let e=r(i.headers);return e===i.headers?i:{...i,headers:e}}case`http-end`:{let e=i.body&&n(i.body);return e===i.body?i:{...i,body:e}}case`ws-send`:case`ws-message`:{let e=n(i.data);return e===i.data?i:{...i,data:e}}case`sse-message`:{let e=$(i.data,t);return e===i.data?i:{...i,data:e}}default:return i}}function Pi(e,t,n=Q){let r=ji(e,n);for(let e of t)Oi.is(e)&&(r=Ti(r,e.queryParam,n));return Ei(r,ci(mi(t),n).jwt)}function Fi(e,t,n=()=>!1,r=Q){let i=0,a=0;return{ignores:t=>n()||e.ignoreUrls.some(e=>Jr(e,t)),nextId:()=>a++,place:()=>i++,emit(n){try{let a=Mi(n,e.redact,r);if(e.beforeRecord&&(a=e.beforeRecord(a)),!a)return;t({...a,n:a.n??i++})}catch{}}}}var Ii=3,Li=/^(?:[A-Z][A-Za-z]{0,58})?Error$/;function Ri(e){let t;try{t=e?.name}catch{}return typeof t==`string`&&Li.test(t)?t:`other`}function zi(e){let t=new Set;return(n,r)=>Y(()=>{let i=Ri(n),a=`${i} ${r}`;t.size>=Ii||t.has(a)||(t.add(a),e({type:6,timestamp:Date.now(),data:{plugin:In,payload:{name:i,during:r}}}))})}var Bi=EventTarget.prototype.addEventListener;function Vi(e,t,n){let r=e.WebSocket;if(typeof r!=`function`)return;let i=new WeakMap,a=e=>Y(()=>t.emit(e));function o(e){return e>n.maxBodySize?{omitted:`too-large`,size:e}:null}function s(e,r,i){let s=Date.now();if(r instanceof Blob){let o=t.place();or(r,n,!0).catch(()=>({omitted:`unreadable`})).then(t=>a({type:e,data:t,t:s,id:i,n:o}));return}let c;if(typeof r==`string`)c=ar(r,n)??{text:r};else if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)){let e=r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength);c=o(e.byteLength)??{base64:Qn(e)}}else c={omitted:`unreadable`};a({type:e,data:c,t:s,id:i})}class c extends r{constructor(e,n){super(e,n),Y(()=>{if(t.ignores(this.url))return;let e={id:t.nextId(),byApp:!1};i.set(this,e);let{id:r}=e;a({type:`ws-connect`,url:this.url,protocols:n===void 0?[]:[n].flat(),t:Date.now(),id:r}),Bi.call(this,`open`,()=>a({type:`ws-open`,protocol:this.protocol,extensions:this.extensions,t:Date.now(),id:r})),Bi.call(this,`message`,e=>Y(()=>s(`ws-message`,e.data,r))),Bi.call(this,`close`,t=>{let n=t;a({type:`ws-close`,code:n.code,reason:n.reason,wasClean:n.wasClean,byApp:e.byApp,t:Date.now(),id:r})}),Bi.call(this,`error`,()=>a({type:`ws-error`,t:Date.now(),id:r}))})}send(e){Y(()=>{let t=i.get(this);t&&this.readyState===r.OPEN&&s(`ws-send`,e,t.id)}),super.send(e)}close(e,t){Y(()=>{let e=i.get(this);e&&(e.byApp=!0)}),super.close(e,t)}}Object.defineProperty(c,"name",{value:`WebSocket`}),e.WebSocket=c}var Hi=/^(?:__Host-|__Secure-)?(?:session|sid|connect\.sid|phpsessid|jsessionid|asp\.net_sessionid|.+_session)$/i;function Ui(e,t,n,r=Q){let i=mi(n),{replace:a,field:o,jwt:s}=ci(i,r);if(X(Hi,e))return a(t);if(i.some(t=>X(t,e)))return o(t);if($r(t)){let e=t;for(let t of i)e=ni(e,t,o);return $(e,s)}return $(t,s)}function Wi(e,t,n,r){(X(Hi,e)||mi(n).some(t=>X(t,e))||t.includes(`.eyJ`))&&Ui(e,t,n,r)}function Gi(e,t,n,r=Q){let i=Ki(t);if(i===null||i===t)return Ui(e,t,n,r);let a=Ui(e,i,n,r);return a===i?t:Ji(a)}function Ki(e){try{return decodeURIComponent(e)}catch{return null}}var qi=/[%;,\s"\\\p{Cc}\P{ASCII}]/gu,Ji=e=>e.replace(qi,encodeURIComponent);function Yi(e,t,n=Q){return e===``?e:e.split(`; `).map(e=>{let r=e.indexOf(`=`),[i,a]=r<0?[``,e]:[e.slice(0,r),e.slice(r+1)],o=Gi(i,a,t,n);return r<0?o:`${i}=${o}`}).join(`; `)}function Xi(e,t,n=Q){let r=e=>{let r=[];for(let i=0;i<e.length;i++){let a=e.key(i);if(a!==null){let i=e.getItem(a);i!==null&&r.push({key:a,value:Ui(a,i,t,n)})}}return r};return{localStorage:e.localStorage?r(e.localStorage):[],sessionStorage:e.sessionStorage?r(e.sessionStorage):[],cookies:Yi(e.document.cookie??``,t,n)}}function Zi(e,t,n,r=Q){let i=e=>Y(()=>t({type:6,timestamp:Date.now(),data:{plugin:zn,payload:e}}));Bn(e,i,Pn,(e,t)=>{t.length<=n.maxBodySize&&Wi(e,t,n.redact,r)}),e.addEventListener(`storage`,t=>Y(()=>{if(t.storageArea===e.localStorage)if(t.key===null)i({by:`other-tab`,area:`local`,op:`clear`});else if(t.newValue===null)i({by:`other-tab`,area:`local`,op:`remove`,key:t.key});else{let e=t.newValue.length,a=e>n.maxBodySize?null:Ui(t.key,t.newValue,n.redact,r);i({by:`other-tab`,area:`local`,op:`set`,key:t.key,value:a,size:e})}})),e.cookieStore?.addEventListener(`change`,e=>Y(()=>{let{changed:t,deleted:a}=e;for(let e of t){let t=Qi(e);t.value=Gi(t.name,t.value,n.redact,r),i({by:`cookie`,op:`set`,cookie:t})}for(let e of a)i({by:`cookie`,op:`remove`,name:e.name??``,domain:e.domain??null,path:e.path??`/`})}))}function Qi(e){let t=e.sameSite===`strict`||e.sameSite===`none`?e.sameSite:`lax`;return{name:e.name??``,value:e.value??``,domain:e.domain??null,path:e.path??`/`,expires:e.expires??null,secure:e.secure??!1,sameSite:t}}function $i(e){let t=new Headers;for(let[n,r]of e)t.append(n,r);return[...t]}function ea(e){return e.trim().split(/[\r\n]+/).filter(Boolean).map(e=>{let t=e.indexOf(`:`);return[e.slice(0,t).trim(),e.slice(t+1).trim()]})}function ta(e){let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)}function na(e,t,n){let r=e.XMLHttpRequest.prototype,{open:i,setRequestHeader:a,send:o}=r,s=new WeakMap,c=new WeakSet,l=e=>Y(()=>t.emit(e));function u(e){return e>n.maxBodySize?{omitted:`too-large`,size:e}:null}function d(e,t){t.responded||(t.responded=!0,l({type:`http-response`,status:e.status,statusText:e.statusText,url:e.responseURL||t.url,redirected:!!e.responseURL&&e.responseURL!==ta(t.url),headers:$i(ea(e.getAllResponseHeaders())),t:Date.now(),id:t.id}))}function f(e,t){e.ended||(e.ended=!0,l({type:`http-error`,reason:t,message:``,t:Date.now(),id:e.id}))}function p(e,r){if(r.ended)return;r.ended=!0,d(e,r);let{id:i}=r,a=e=>l({type:`http-end`,body:e,t:Date.now(),id:i});if(jr(e.getResponseHeader(`content-type`),n.mediaTypes)){a({omitted:`media`});return}switch(e.responseType){case``:case`text`:{let t=e.responseText;a(ar(t,n)??{text:t});return}case`json`:{let r=e.response,a=Date.now(),o=t.place();setTimeout(()=>Y(()=>{let e=JSON.stringify(r);l({type:`http-end`,body:ar(e,n)??{text:e},t:a,id:i,n:o})}));return}case`arraybuffer`:{let t=new Uint8Array(e.response);a(u(t.byteLength)??$n(t));return}case`blob`:{let r=Date.now(),a=t.place();or(e.response,n).catch(()=>({omitted:`unreadable`})).then(e=>l({type:`http-end`,body:e,t:r,id:i,n:a}));return}default:a({omitted:`unreadable`})}}function m(e){if(!c.has(e)){c.add(e),e.addEventListener(`readystatechange`,()=>Y(()=>{let t=s.get(e);t?.sent&&e.readyState===XMLHttpRequest.HEADERS_RECEIVED&&d(e,t)})),e.addEventListener(`load`,()=>Y(()=>{let t=s.get(e);t?.sent&&e.readyState===XMLHttpRequest.DONE&&p(e,t)}));for(let[t,n]of Object.entries({error:`network`,abort:`abort`,timeout:`timeout`}))e.addEventListener(t,()=>Y(()=>{let t=s.get(e);t?.sent&&f(t,n)}))}}r.open=function(...e){return Y(()=>{let n=s.get(this);n?.sent&&!n.ended&&(this.readyState===XMLHttpRequest.DONE?p(this,n):f(n,`abort`));let[r,i]=e,a=new URL(String(i),document.baseURI).href;s.set(this,t.ignores(a)?null:{id:t.nextId(),method:Nr(r),url:a,headers:[],sent:!1,responded:!1,ended:!1})}),Reflect.apply(i,this,e)},r.setRequestHeader=function(e,t){a.call(this,e,t),Y(()=>s.get(this)?.headers.push([e.toLowerCase(),t]))},r.send=function(e){return Y(()=>{let r=s.get(this);if(!r||r.sent||this.readyState!==XMLHttpRequest.OPENED)return;r.sent=!0;let i=Date.now(),{id:a,method:o,url:c}=r,u=[...r.headers],d=u.some(([e])=>e===`content-type`)?null:lr(e);d&&u.push([`content-type`,d]);let f=$i(u);m(this);let p=e=>({type:`http-request`,api:`xhr`,method:o,url:c,headers:f,...e?{body:e}:{},t:i,id:a}),h=cr(e,n);if(h instanceof Promise){let e=t.place();h.catch(()=>({omitted:`unreadable`})).then(t=>l({...p(t),n:e}))}else l(p(h))}),o.call(this,e)}}var ra=8,ia=4096,aa=256,oa=`.cmVkYWN0ZWQ`,sa=/^(?:bearer|basic|token|bot|apikey|digest|negotiate) +(\S+)$/i;function ca(e){return e.length<ra||e.length>ia||/^[A-Za-z]{1,11}$/.test(e)||/^\d{1,11}$/.test(e)||new Set(e).size<5?!1:e!==`[redacted]`&&e!==`[object Object]`&&!e.endsWith(oa)}function la(e){return e.replace(/[a-z]/g,`x`).replace(/[A-Z]/g,`X`).replace(/\d/g,`0`)}var ua=31,da=1;for(let e=1;e<ra;e++)da=Math.imul(da,ua);var fa=65536;function pa(e,t){let n=0;for(let r=0;r<ra;r++)n=Math.imul(n,ua)+e.charCodeAt(t+r)|0;return n}function ma(e){let t=new Uint8Array(8192),n=new Map;for(let r of e){let e=pa(r,0),i=e&fa-1;t[i>>3]|=1<<(i&7);let a=n.get(e);a?a.push(r):n.set(e,[r])}let r=(r,i)=>{if(e.length===0||r.length<ra)return;let a=pa(r,0);for(let e=0;;e++){let o=a&fa-1;if(t[o>>3]&1<<(o&7)){for(let t of n.get(a)??[])if(r.startsWith(t,e)&&i(t))return}if(e+ra>=r.length)return;let s=Math.imul(r.charCodeAt(e),da);a=Math.imul(a-s,ua)+r.charCodeAt(e+ra)|0}};return{any(e){let t=!1;return r(e,()=>t=!0),t},all(e){let t=new Set;return r(e,e=>(t.add(e),!1)),t}}}var ha=new Set([2,3,4]),ga=3,_a=5,va=e=>{try{return decodeURIComponent(e)}catch{return null}};function ya(e){let t=e.data;return e.type===ga&&t.source===_a?t:null}function ba(e){let t=new Map,n=null,r=new Map,i=(e,r)=>{if(!ca(e))return;let i=t.get(e);t.delete(e),t.size>=aa&&t.delete(t.keys().next().value);let a=i&&i.replacement!==`[redacted]`?i.replacement:r;t.set(e,{value:e,needle:JSON.stringify(e).slice(1,-1),replacement:a}),n=null},a=(e,t)=>{try{if(e===t)return;let n=e.trim();i(n,t);let r=sa.exec(n)?.[1];r&&i(r,Z);for(let e of new Set([va(n),va(n.replaceAll(`+`,` `))]))e!==null&&e!==n&&i(e,Z)}catch{}},{jwt:o}=ci(mi(e),a),s=(e,t,n)=>{let r=e.includes(`.eyJ`)?$(e,o):e;for(let e of t){if(!r.includes(e.value))continue;let t=n&&e.replacement===`[redacted]`?la(e.value):e.replacement;r=r.split(e.value).join(t)}return r},c=(e,t,n)=>{if(typeof e==`string`)return s(e,t,!1);if(Array.isArray(e))return e.map(e=>c(e,t,!1));if(typeof e!=`object`||!e)return e;let r=e;for(let[e,i]of Object.entries(r))if(typeof i==`string`)r[e]=s(i,t,n&&e===`text`);else if(e===`attributes`&&typeof i==`object`&&i)if(Array.isArray(i))r[e]=c(i,t,!1);else{let e=i;for(let[n,r]of Object.entries(e))e[n]=typeof r==`string`?s(r,t,n===`value`):c(r,t,!1)}else r[e]=c(i,t,!1);return r};function l(e,i){let a=[...t.values()];a.sort((e,t)=>t.value.length-e.value.length),n??=ma(a.map(e=>e.needle));let o=n,s=[],l=(t,n)=>{e[t]=n,i[t]=JSON.stringify(n)};for(let t=0;t<i.length;t++){if(!ha.has(e[t].type))continue;let n=i[t],u=ya(e[t]),d=u?.text;if(u?.id!==void 0&&d&&d.length>=ra&&!r.has(u.id)){let e=a.find(e=>e.value.startsWith(d));e&&r.set(u.id,e)}try{let e=n.includes(`.eyJ`),i=o.all(n);if(i.size===0&&!e)continue;let s=a.filter(e=>i.has(e.needle)),u=JSON.parse(n),d=ya(u),f=d?.text;if(c(u.data,s,d!==null),d?.id!==void 0&&typeof f==`string`){let e=s.find(e=>f.includes(e.value));e&&r.set(d.id,e)}JSON.stringify(u)!==n&&l(t,u)}catch{s.push(t)}}if(r.size===0)return s;for(let t=0;t<e.length;t++){let n=ya(e[t]);if(n?.id===void 0||!n.text)continue;let a=r.get(n.id);if(!a||n.text===a.value||!a.value.startsWith(n.text))continue;let o=a.replacement===`[redacted]`?la(a.value):a.replacement,s=JSON.parse(i[t]);s.data.text=o.slice(0,n.text.length),l(t,s)}return s}return{note:a,size:()=>t.size,scrubChunk(e,t){try{return l(e,t)}catch{return e.flatMap((e,t)=>ha.has(e.type)?[t]:[])}}}}async function xa(e){let t=new TextEncoder().encode(e),n=new ReadableStream({start(e){e.enqueue(t),e.close()}}).pipeThrough(new CompressionStream(`gzip`)).getReader(),r=[],i=0;for(let e=await n.read();!e.done;e=await n.read())r.push(e.value),i+=e.value.byteLength;let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.byteLength;return a}var Sa=64*1024,Ca=1024;function wa(e){return e>=400&&e<500&&e!==408&&e!==429}var Ta=1e4,Ea=5*6e4,Da=10*6e4;function Oa(e){let t=e.headers.get(`Retry-After`)?.trim();return t&&/^\d+$/.test(t)?Number(t)*1e3:null}function ka(e,t,n,r){let i=`${e.collectorUrl}/api/projects/${e.projectKey}/sessions/${t}/chunks`,a=0,o=null,s=0,c=0,l=!1;function u(e){c++;let t=e??Math.min(Ta*2**(c-1),Ea);s=Date.now()+t}async function d(t,o){let d=n.take(t===`interval`?{hold:e.uploadInterval}:{});if(!d)return;let f=!1;try{if(l)return;let{json:p}=d,m=await xa(p),h={version:1,sequenceNumber:a,sentAt:Date.now(),start:d.start,end:d.end,eventCount:d.events.length,hasFullSnapshot:d.hasFullSnapshot,reason:t,urls:d.urls,recorderVersion:e.recorderVersion,rawBytes:p.length},g=JSON.stringify(h),_=()=>{let e=new FormData;return e.append(`metadata`,new Blob([g],{type:`application/json`})),e.append(`events`,new Blob([m],{type:`application/gzip`})),e},v=o&&m.byteLength+g.length+Ca<=Sa,y=e=>r(i,{method:`POST`,body:_(),keepalive:e}),b=await y(v).catch(e=>{if(v&&e instanceof TypeError)return y(!1);throw e});if(!b.ok&&!wa(b.status)){let e=Oa(b);if(e!==null&&e>Da){l=!0,n.close();return}u(e),f=!0;return}a++,c=0,s=0}catch{u(null),f=!0}finally{f?n.restore(d):n.release(d)}}async function f(t,r){if(!(!r&&Date.now()<s)){for(;o;){if(!r)return;await o}o=d(t,r);try{await o}finally{o=null}n.bytes()>=e.earlyUploadBytes&&f(`size`,!1)}}return setInterval(()=>{f(`interval`,!1)},e.uploadInterval),{flush:({final:e=!1}={})=>f(e?`hidden`:`interval`,e),notify(){!o&&n.bytes()>=e.earlyUploadBytes&&f(`size`,!1)}}}function Aa(){let e=crypto.getRandomValues(new Uint8Array(16)),t=Date.now();for(let n=0;n<6;n++)e[n]=Math.floor(t/2**(8*(5-n)))%256;e[6]=e[6]&15|112,e[8]=e[8]&63|128;let n=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var ja=4,Ma=3,Na=5;function Pa(e){if(!e?.projectKey)throw Error(`mime8.init: projectKey is required`);if(window.mime8Replay===!0||window.__mime8)return;let t=Xn(e),n=window.fetch.bind(window);window.__mime8={sessionId:Aa(),events:[]};let r=ba(t.redact),i=e=>Pi(e,t.redact,r.note),a=!1,o,s=Yn(window.__mime8,i,t.maxBufferBytes,()=>{a=!0,queueMicrotask(()=>Y(()=>o?.()))},(e,t)=>r.scrubChunk(e,t)),c=Date.now();s.push(Hn(Xi(window,t.redact,r.note),c)),Y(()=>s.push(Un(mr(),c)));let l=ka(t,window.__mime8.sessionId,s,n),u=Kr(t.maxBatchChanges,e=>{s.end(Wn({reason:`mutations`,limit:t.maxBatchChanges,records:e},Date.now())),l.notify()},()=>a),d=Fi(t,e=>{s.push(Vn(e)),l.notify()},()=>a,r.note);Hr(window,d,t),na(window,d,t),fr(window,d,t),Ar(window,d),Vi(window,d,t),Wr(window,d);let f=Or(window);br(document,e=>{s.push(e),l.notify()},e=>{let t=jn.mirror.getId(e);return t>0?t:null}),Zi(window,e=>{s.push(e),l.notify()},t,r.note),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&l.flush({final:!0})});let p=zi(e=>{s.push(e),l.notify()}),m=!1,h=()=>{try{if(a)return;o=jn({errorHandler:e=>(p(e,m?`recording`:`start`),!0),onMutation:u,userTriggeredOnInput:!0,emit:e=>Y(()=>{(e.type!==Ma||e.data.source!==Na||e.data.id!==-1)&&(e.type===ja&&(e={...e,data:{...e.data,href:i(e.data.href)}}),e=f.mark(e),s.push(e),l.notify())})}),m=!0}catch(e){p(e,`start`)}};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,h):h()}return e.init=Pa,e})({});