@mime8/recorder 0.1.1 → 0.3.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 +63 -2
- package/dist/recorder.iife.js +3 -3
- package/dist/recorder.js +1945 -1171
- package/dist/recorder.umd.cjs +3 -3
- package/package.json +10 -5
package/dist/recorder.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.mime8={}))})(this,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 C(e){return v(`Node`,e,`parentNode`)}function w(e){return v(`Node`,e,`parentElement`)}function ee(e){return v(`Node`,e,`textContent`)}function T(e,t){return b(`Node`,e,`contains`)(t)}function E(e){return b(`Node`,e,`getRootNode`)()}function D(e){return!e||!(`host`in e)?null:v(`ShadowRoot`,e,`host`)}function O(e){return e.styleSheets}function k(e){return!e||!(`shadowRoot`in e)?null:v(`Element`,e,`shadowRoot`)}function A(e,t){return v(`Element`,e,`querySelector`)(t)}function te(e,t){return v(`Element`,e,`querySelectorAll`)(t)}function ne(){return[g(`MutationObserver`).constructor,m.MutationObserver??(()=>{})]}var re=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(re=()=>new Date().getTime());function j(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,()=>{e[t]=r}}catch{return()=>{}}}var M={ownerDocument:x,childNodes:S,parentNode:C,parentElement:w,textContent:ee,contains:T,getRootNode:E,host:D,styleSheets:O,shadowRoot:k,querySelector:A,querySelectorAll:te,nowTimestamp:re,mutationObserverCtor:ne,patch:j};function N(e){return e.nodeType===e.ELEMENT_NODE}function P(e){let t=e&&`host`in e&&`mode`in e&&M.host(e)||null;return!!(t&&`shadowRoot`in t&&M.shadowRoot(t)===e)}function F(e){return Object.prototype.toString.call(e)===`[object ShadowRoot]`}function ie(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 ae(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 oe(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),ie(Array.from(t,e=>I(e,n)).join(``))}catch{return null}}function I(e,t){if(ce(e)){let t;try{t=oe(e.styleSheet)||ae(e)}catch{t=e.cssText}return e.styleSheet.href?ye(t,e.styleSheet.href):t}else{let n=e.cssText;return L(e)&&e.selectorText.includes(`:`)&&(n=se(n)),t?ye(n,t):n}}function se(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function ce(e){return`styleSheet`in e}function L(e){return`selectorText`in e}var R=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 le(){return new R}function z({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:a}){let o=i||``,s=r&&B(r);return(t[n.toLowerCase()]||s&&t[s])&&(o=a?a(o,e):`*`.repeat(o.length)),o}function B(e){return e.toLowerCase()}var ue=`__rrweb_original__`;function de(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=ue in i?i[ue]: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 fe(e){let t=e.type;return e.hasAttribute(`data-rr-is-password`)?`password`:t?B(t):null}function pe(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 me(e){let t=``;return t=e.indexOf(`//`)>-1?e.split(`/`).slice(0,3).join(`/`):e.split(`/`)[0],t=t.split(`?`)[0],t}var he=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ge=/^(?:[a-z+]+:)?\/\//i,_e=/^www\..*/i,ve=/^(data:)([^,]*),(.*)/i;function ye(e,t){return(e||``).replace(he,(e,n,r,i,a,o)=>{let s=r||a||o,c=n||i||``;if(!s)return e;if(ge.test(s)||_e.test(s)||ve.test(s))return`url(${c}${s}${c})`;if(s[0]===`/`)return`url(${c}${me(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 be(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``).replace(/0px/g,`0`)}function xe(e,t,n=!1){let r=Array.from(t.childNodes),i=[],a=0;if(r.length>1&&e&&typeof e==`string`){let t=be(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=be(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=be(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=be(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 Se(e,t){return xe(e,t).join(`/* rr_split */`)}var Ce=1,we=RegExp(`[^a-z0-9-_:]`),Te=-2;function Ee(){return Ce++}function De(e){if(e instanceof HTMLFormElement)return`form`;let t=B(e.tagName);return we.test(t)?`div`:t}var V,Oe,ke=/^[^ \t\n\r\u000c]+/,Ae=/^[, \t\n\r\u000c]+/;function je(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(Ae),!(n>=t.length);){let a=r(ke);if(a.slice(-1)===`,`)a=Ne(e,a.substring(0,a.length-1)),i.push(a);else{let r=``;a=Ne(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 Me=new WeakMap;function Ne(e,t){return!t||t.trim()===``?t:Fe(e,t)}function Pe(e){return!!(e.tagName===`svg`||e.ownerSVGElement)}function Fe(e,t){let n=Me.get(e);if(n||(n=e.createElement(`a`),Me.set(e,n)),!t)t=``;else if(t.startsWith(`blob:`)||t.startsWith(`data:`))return t;return n.setAttribute(`href`,t),n.href}function Ie(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)?Ne(e,r):n===`srcset`?je(e,r):n===`style`?ye(r,Fe(e)):t===`object`&&n===`data`?Ne(e,r):r)}function Le(e,t,n){return[`video`,`audio`].includes(e)&&t===`autoplay`}function Re(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 ze(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?ze(M.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?ze(M.parentNode(e),t,n):!1}function Be(e,t,n,r){let i;if(N(e)){if(i=e,!M.childNodes(i).length)return!1}else if(M.parentElement(e)===null)return!1;else i=M.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(ze(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 Ve(e,t,n){let r=e.contentWindow;if(!r)return;let i=!1,a;try{a=r.document.readyState}catch{return}if(a!==`complete`){let r=setTimeout(()=>{i||=(t(),!0)},n);e.addEventListener(`load`,()=>{clearTimeout(r),i=!0,t()});return}let o=`about:blank`;if(r.location.href!==o||e.src===o||e.src===``)return setTimeout(t,0),e.addEventListener(`load`,t);e.addEventListener(`load`,t)}function He(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;let a=setTimeout(()=>{r||=(t(),!0)},n);e.addEventListener(`load`,()=>{clearTimeout(a),r=!0,t()})}function Ue(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=We(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 Ke(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 Ge(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:M.textContent(e)||``,rootId:v};default:return!1}}function We(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function Ge(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:a}=t,o=M.parentNode(e),s=o&&o.tagName,c=``,l=s===`STYLE`||void 0,d=s===`SCRIPT`||void 0;return d?c=`SCRIPT_PLACEHOLDER`:a||(c=M.textContent(e),l&&c&&(c=ye(c,Fe(t.doc)))),!l&&!d&&c&&n&&(c=r?r(c,M.parentElement(e)):c.replace(/[\S]/g,`*`)),{type:u.Text,textContent:c||``,rootId:i}}function Ke(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=Re(e,r,i),g=De(e),_={},v=e.attributes.length;for(let t=0;t<v;t++){let r=e.attributes[t];Le(g,r.name,r.value)||(_[r.name]=Ie(n,g,B(r.name),r.value))}if(g===`link`&&a){let t=Array.from(n.styleSheets).find(t=>t.href===e.href),r=null;t&&(r=oe(t)),r&&(delete _.rel,delete _.href,_._cssText=r)}if(g===`style`&&e.sheet){let t=oe(e.sheet);t&&(e.childNodes.length>1&&(t=Se(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=z({element:e,type:fe(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`)de(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){V||(V=n.createElement(`canvas`),Oe=V.getContext(`2d`));let t=e,r=t.currentSrc||t.getAttribute(`src`)||`<unknown-src>`,i=t.crossOrigin,a=()=>{t.removeEventListener(`load`,a);try{V.width=t.naturalWidth,V.height=t.naturalHeight,Oe.drawImage(t,0,0),_.rr_dataURL=V.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:Pe(e)||void 0,needBlock:h,rootId:m,isCustom:y}}function H(e){return e==null?``:e.toLowerCase()}function qe(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 Je(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`&&pe(e.attributes.href)===`js`)||t.headFavicon&&(e.tagName===`link`&&e.attributes.rel===`shortcut icon`||e.tagName===`meta`&&(H(e.attributes.name).match(/^msapplication-tile(image|color)$/)||H(e.attributes.name)===`application-name`||H(e.attributes.rel)===`icon`||H(e.attributes.rel)===`apple-touch-icon`||H(e.attributes.rel)===`shortcut icon`))||e.tagName===`meta`&&(t.headMetaDescKeywords&&H(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(H(e.attributes.property).match(/^(og|twitter|fb):/)||H(e.attributes.name).match(/^(og|twitter):/)||H(e.attributes.name)===`pinterest`)||t.headMetaRobots&&(H(e.attributes.name)===`robots`||H(e.attributes.name)===`googlebot`||H(e.attributes.name)===`bingbot`)||t.headMetaHttpEquiv&&e.attributes[`http-equiv`]!==void 0||t.headMetaAuthorship&&(H(e.attributes.name)===`author`||H(e.attributes.name)===`generator`||H(e.attributes.name)===`framework`||H(e.attributes.name)===`publisher`||H(e.attributes.name)===`progid`||H(e.attributes.property).match(/^article:/)||H(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(H(e.attributes.name)===`google-site-verification`||H(e.attributes.name)===`yandex-verification`||H(e.attributes.name)===`csrf-token`||H(e.attributes.name)===`p:domain_verify`||H(e.attributes.name)===`verify-v1`||H(e.attributes.name)===`verification`||H(e.attributes.name)===`shopify-checkout-api-token`))))}function Ye(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:C=()=>!1,newlyAddedElement:w=!1,cssCaptured:ee=!1}=t,{needsMask:T}=t,{preserveWhiteSpace:E=!0}=t;T||=Be(e,o,s,T===void 0);let D=Ue(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,dataURLOptions:h,inlineImages:g,recordCanvas:_,keepIframeSrcFn:C,newlyAddedElement:w,cssCaptured:ee});if(!D)return console.warn(e,`not serialized`),null;let O;O=r.hasNode(e)?r.getId(e):Je(D,m)||!E&&D.type===u.Text&&!D.textContent.replace(/^\s+|\s+$/gm,``).length?Te:Ee();let k=Object.assign(D,{id:O});if(r.add(e,k),O===Te)return null;v&&v(e);let A=!c;if(k.type===u.Element){A&&=!k.needBlock,delete k.needBlock;let t=M.shadowRoot(e);t&&F(t)&&(k.isShadowHost=!0)}if((k.type===u.Document||k.type===u.Element)&&A){m.headWhitespace&&k.type===u.Element&&k.tagName===`head`&&(E=!1);let t={doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:c,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:E,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:C,cssCaptured:!1};if(k.type!==u.Element||k.tagName!==`textarea`||k.attributes.value===void 0){k.type===u.Element&&k.attributes._cssText!==void 0&&typeof k.attributes._cssText==`string`&&(t.cssCaptured=!0);for(let n of Array.from(M.childNodes(e))){let e=Ye(n,t);e&&k.childNodes.push(e)}}let w=null;if(N(e)&&(w=M.shadowRoot(e)))for(let e of Array.from(M.childNodes(w))){let n=Ye(e,t);n&&(F(w)&&(n.isShadow=!0),k.childNodes.push(n))}}let te=M.parentNode(e);return te&&P(te)&&F(te)&&(k.isShadow=!0),k.type===u.Element&&k.tagName===`iframe`&&Ve(e,()=>{let t=e.contentDocument;if(t&&y){let n=Ye(t,{doc:t,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:E,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:C});n&&y(e,n)}},b),k.type===u.Element&&k.tagName===`link`&&typeof k.attributes.rel==`string`&&(k.attributes.rel===`stylesheet`||k.attributes.rel===`preload`&&typeof k.attributes.href==`string`&&pe(k.attributes.href)===`css`)&&He(e,()=>{if(x){let t=Ye(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:E,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:C});t&&x(e,t)}},S),k}function Xe(e,t){let{mirror:n=new R,blockClass:r=`rr-block`,blockSelector:i=null,maskTextClass:a=`rr-mask`,maskTextSelector:o=null,inlineStylesheet:s=!0,inlineImages:c=!1,recordCanvas:l=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:f,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:x=()=>!1}=t;return Ye(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:qe(p),dataURLOptions:m,inlineImages:c,recordCanvas:l,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:x,newlyAddedElement:!1})}var Ze=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 U(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var W=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.mime8={}))})(this,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 C(e){return v(`Node`,e,`parentNode`)}function w(e){return v(`Node`,e,`parentElement`)}function ee(e){return v(`Node`,e,`textContent`)}function T(e,t){return b(`Node`,e,`contains`)(t)}function te(e){return b(`Node`,e,`getRootNode`)()}function ne(e){return!e||!(`host`in e)?null:v(`ShadowRoot`,e,`host`)}function E(e){return e.styleSheets}function D(e){return!e||!(`shadowRoot`in e)?null:v(`Element`,e,`shadowRoot`)}function re(e,t){return v(`Element`,e,`querySelector`)(t)}function ie(e,t){return v(`Element`,e,`querySelectorAll`)(t)}function ae(){return[g(`MutationObserver`).constructor,m.MutationObserver??(()=>{})]}var oe=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(oe=()=>new Date().getTime());function O(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,()=>{V||(e[t]=r)}}catch{return()=>{}}}var k={ownerDocument:x,childNodes:S,parentNode:C,parentElement:w,textContent:ee,contains:T,getRootNode:te,host:ne,styleSheets:E,shadowRoot:D,querySelector:re,querySelectorAll:ie,nowTimestamp:oe,mutationObserverCtor:ae,patch:O};function A(e){return e.nodeType===e.ELEMENT_NODE}function j(e){let t=e&&`host`in e&&`mode`in e&&k.host(e)||null;return!!(t&&`shadowRoot`in t&&k.shadowRoot(t)===e)}function M(e){return Object.prototype.toString.call(e)===`[object ShadowRoot]`}function se(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 ce(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 le(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),se(Array.from(t,e=>ue(e,n)).join(``))}catch{return null}}function ue(e,t){if(fe(e)){let t;try{t=le(e.styleSheet)||ce(e)}catch{t=e.cssText}return e.styleSheet.href?Ce(t,e.styleSheet.href):t}else{let n=e.cssText;return N(e)&&e.selectorText.includes(`:`)&&(n=de(n)),t?Ce(n,t):n}}function de(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function fe(e){return`styleSheet`in e}function N(e){return`selectorText`in e}var P=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 pe(){return new P}function F({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:a}){let o=i||``,s=r&&I(r);return(t[n.toLowerCase()]||s&&t[s])&&(o=a?a(o,e):`*`.repeat(o.length)),o}function I(e){return e.toLowerCase()}var me=`__rrweb_original__`;function he(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=me in i?i[me]: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 ge(e){let t=e.type;return e.hasAttribute(`data-rr-is-password`)?`password`:t?I(t):null}function _e(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 ve(e){let t=``;return t=e.indexOf(`//`)>-1?e.split(`/`).slice(0,3).join(`/`):e.split(`/`)[0],t=t.split(`?`)[0],t}var ye=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,be=/^(?:[a-z+]+:)?\/\//i,xe=/^www\..*/i,Se=/^(data:)([^,]*),(.*)/i;function Ce(e,t){return(e||``).replace(ye,(e,n,r,i,a,o)=>{let s=r||a||o,c=n||i||``;if(!s)return e;if(be.test(s)||xe.test(s)||Se.test(s))return`url(${c}${s}${c})`;if(s[0]===`/`)return`url(${c}${ve(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 we(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``).replace(/0px/g,`0`)}function Te(e,t,n=!1){let r=Array.from(t.childNodes),i=[],a=0;if(r.length>1&&e&&typeof e==`string`){let t=we(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=we(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=we(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=we(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 Ee(e,t){return Te(e,t).join(`/* rr_split */`)}var De=1,Oe=RegExp(`[^a-z0-9-_:]`),ke=-2;function Ae(){return De++}function je(e){if(e instanceof HTMLFormElement)return`form`;let t=I(e.tagName);return Oe.test(t)?`div`:t}var Me,Ne,Pe=/^[^ \t\n\r\u000c]+/,Fe=/^[, \t\n\r\u000c]+/;function Ie(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(Fe),!(n>=t.length);){let a=r(Pe);if(a.slice(-1)===`,`)a=Re(e,a.substring(0,a.length-1)),i.push(a);else{let r=``;a=Re(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 Le=new WeakMap;function Re(e,t){return!t||t.trim()===``?t:Be(e,t)}function ze(e){return!!(e.tagName===`svg`||e.ownerSVGElement)}function Be(e,t){let n=Le.get(e);if(n||(n=e.createElement(`a`),Le.set(e,n)),!t)t=``;else if(t.startsWith(`blob:`)||t.startsWith(`data:`))return t;return n.setAttribute(`href`,t),n.href}function Ve(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)?Re(e,r):n===`srcset`?Ie(e,r):n===`style`?Ce(r,Be(e)):t===`object`&&n===`data`?Re(e,r):r)}function He(e,t,n){return[`video`,`audio`].includes(e)&&t===`autoplay`}function Ue(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 We(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?We(k.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?We(k.parentNode(e),t,n):!1}function Ge(e,t,n,r){let i;if(A(e)){if(i=e,!k.childNodes(i).length)return!1}else if(k.parentElement(e)===null)return!1;else i=k.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(We(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 Ke(e,t,n){let r=t;t=H(()=>V||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 qe(e,t,n){let r=t;t=H(()=>V||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 Je(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=Ye(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 Ze(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 Xe(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:k.textContent(e)||``,rootId:v};default:return!1}}function Ye(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function Xe(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:a}=t,o=k.parentNode(e),s=o&&o.tagName,c=``,l=s===`STYLE`||void 0,d=s===`SCRIPT`||void 0;return d?c=`SCRIPT_PLACEHOLDER`:a||(c=k.textContent(e),l&&c&&(c=Ce(c,Be(t.doc)))),!l&&!d&&c&&n&&(c=r?r(c,k.parentElement(e)):c.replace(/[\S]/g,`*`)),{type:u.Text,textContent:c||``,rootId:i}}function Ze(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=Ue(e,r,i),g=je(e),_={},v=e.attributes.length;for(let t=0;t<v;t++){let r=e.attributes[t];He(g,r.name,r.value)||(_[r.name]=Ve(n,g,I(r.name),r.value))}if(g===`link`&&a){let t=Array.from(n.styleSheets).find(t=>t.href===e.href),r=null;t&&(r=le(t)),r&&(delete _.rel,delete _.href,_._cssText=r)}if(g===`style`&&e.sheet){let t=le(e.sheet);t&&(e.childNodes.length>1&&(t=Ee(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=F({element:e,type:ge(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`)he(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){Me||(Me=n.createElement(`canvas`),Ne=Me.getContext(`2d`));let t=e,r=t.currentSrc||t.getAttribute(`src`)||`<unknown-src>`,i=t.crossOrigin,a=()=>{t.removeEventListener(`load`,a);try{Me.width=t.naturalWidth,Me.height=t.naturalHeight,Ne.drawImage(t,0,0),_.rr_dataURL=Me.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:ze(e)||void 0,needBlock:h,rootId:m,isCustom:y}}function L(e){return e==null?``:e.toLowerCase()}function Qe(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 $e(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`&&_e(e.attributes.href)===`js`)||t.headFavicon&&(e.tagName===`link`&&e.attributes.rel===`shortcut icon`||e.tagName===`meta`&&(L(e.attributes.name).match(/^msapplication-tile(image|color)$/)||L(e.attributes.name)===`application-name`||L(e.attributes.rel)===`icon`||L(e.attributes.rel)===`apple-touch-icon`||L(e.attributes.rel)===`shortcut icon`))||e.tagName===`meta`&&(t.headMetaDescKeywords&&L(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(L(e.attributes.property).match(/^(og|twitter|fb):/)||L(e.attributes.name).match(/^(og|twitter):/)||L(e.attributes.name)===`pinterest`)||t.headMetaRobots&&(L(e.attributes.name)===`robots`||L(e.attributes.name)===`googlebot`||L(e.attributes.name)===`bingbot`)||t.headMetaHttpEquiv&&e.attributes[`http-equiv`]!==void 0||t.headMetaAuthorship&&(L(e.attributes.name)===`author`||L(e.attributes.name)===`generator`||L(e.attributes.name)===`framework`||L(e.attributes.name)===`publisher`||L(e.attributes.name)===`progid`||L(e.attributes.property).match(/^article:/)||L(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(L(e.attributes.name)===`google-site-verification`||L(e.attributes.name)===`yandex-verification`||L(e.attributes.name)===`csrf-token`||L(e.attributes.name)===`p:domain_verify`||L(e.attributes.name)===`verify-v1`||L(e.attributes.name)===`verification`||L(e.attributes.name)===`shopify-checkout-api-token`))))}function et(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:C=()=>!1,newlyAddedElement:w=!1,cssCaptured:ee=!1}=t,{needsMask:T}=t,{preserveWhiteSpace:te=!0}=t;T||=Ge(e,o,s,T===void 0);let ne=Je(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,dataURLOptions:h,inlineImages:g,recordCanvas:_,keepIframeSrcFn:C,newlyAddedElement:w,cssCaptured:ee});if(!ne)return console.warn(e,`not serialized`),null;let E;E=r.hasNode(e)?r.getId(e):$e(ne,m)||!te&&ne.type===u.Text&&!ne.textContent.replace(/^\s+|\s+$/gm,``).length?ke:Ae();let D=Object.assign(ne,{id:E});if(r.add(e,D),E===ke)return null;v&&v(e);let re=!c;if(D.type===u.Element){re&&=!D.needBlock,delete D.needBlock;let t=k.shadowRoot(e);t&&M(t)&&(D.isShadowHost=!0)}if((D.type===u.Document||D.type===u.Element)&&re){m.headWhitespace&&D.type===u.Element&&D.tagName===`head`&&(te=!1);let t={doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:c,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:te,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:C,cssCaptured:!1};if(D.type!==u.Element||D.tagName!==`textarea`||D.attributes.value===void 0){D.type===u.Element&&D.attributes._cssText!==void 0&&typeof D.attributes._cssText==`string`&&(t.cssCaptured=!0);for(let n of Array.from(k.childNodes(e))){let e=et(n,t);e&&D.childNodes.push(e)}}let w=null;if(A(e)&&(w=k.shadowRoot(e)))for(let e of Array.from(k.childNodes(w))){let n=et(e,t);n&&(M(w)&&(n.isShadow=!0),D.childNodes.push(n))}}let ie=k.parentNode(e);return ie&&j(ie)&&M(ie)&&(D.isShadow=!0),D.type===u.Element&&D.tagName===`iframe`&&Ke(e,()=>{let t=e.contentDocument;if(t&&y){let n=et(t,{doc:t,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:te,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:C});n&&y(e,n)}},b),D.type===u.Element&&D.tagName===`link`&&typeof D.attributes.rel==`string`&&(D.attributes.rel===`stylesheet`||D.attributes.rel===`preload`&&typeof D.attributes.href==`string`&&_e(D.attributes.href)===`css`)&&qe(e,()=>{if(x){let t=et(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:d,maskTextFn:f,maskInputFn:p,slimDOMOptions:m,dataURLOptions:h,inlineImages:g,recordCanvas:_,preserveWhiteSpace:te,onSerialize:v,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:x,stylesheetLoadTimeout:S,keepIframeSrcFn:C});t&&x(e,t)}},S),D}function tt(e,t){let{mirror:n=new P,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 et(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:Qe(p),dataURLOptions:m,inlineImages:c,recordCanvas:l,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:x,newlyAddedElement:!1})}var nt=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 R(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var rt=`Please stop import mirror directly. Instead of that,\r
|
|
2
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.`,Qe={map:{},getId(){return console.error(W),-1},getNode(){return console.error(W),null},removeNodeFromMap(){console.error(W)},has(){return console.error(W),!1},reset(){console.error(W)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(Qe=new Proxy(Qe,{get(e,t,n){return t===`map`&&console.error(W),Reflect.get(e,t,n)}}));function $e(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,e.apply(c,a)},s))}}function et(e,t,n,r,i=window){let a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),a&&a.set&&a.set.call(this,e)}}),()=>et(e,t,a||{},!0)}function tt(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset===void 0?t.documentElement.scrollLeft||t?.body&&M.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&&M.parentElement(t.body)?.scrollTop||t?.body?.scrollTop||0:e.pageYOffset}}function nt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function rt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function it(e){return e?e.nodeType===e.ELEMENT_NODE?e:M.parentElement(e):null}function G(e,t,n,r){if(!e)return!1;let i=it(e);if(!i)return!1;try{if(typeof t==`string`){if(i.classList.contains(t)||r&&i.closest(`.`+t)!==null)return!0}else if(ze(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function at(e,t){return t.getId(e)!==-1}function ot(e,t,n){return e.tagName===`TITLE`&&n.headTitleMutations?!0:t.getId(e)===Te}function st(e,t){if(P(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=M.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:!r||st(r,t)}function ct(e){return!!e.changedTouches}function lt(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 ut(e,t){return!!(e.nodeName===`IFRAME`&&t.getMeta(e))}function dt(e,t){return!!(e.nodeName===`LINK`&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute(`rel`)===`stylesheet`&&t.getMeta(e))}function ft(e){return e?e instanceof Ze&&`shadowRoot`in e?!!e.shadowRoot:!!M.shadowRoot(e):!1}var pt=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 mt(e){let t=null;return`getRootNode`in e&&M.getRootNode(e)?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&M.host(M.getRootNode(e))&&(t=M.host(M.getRootNode(e))),t}function ht(e){let t=e,n;for(;n=mt(t);)t=n;return t}function gt(e){let t=M.ownerDocument(e);if(!t)return!1;let n=ht(e);return M.contains(t,n)}function _t(e){let t=M.ownerDocument(e);return t?M.contains(t,e)||gt(e):!1}function vt(e){return`__ln`in e}var yt=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&&vt(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&&vt(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--)}},bt=(e,t)=>`${e}@${t}`,xt=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 yt,r=e=>{let t=e,n=Te;for(;n===Te;)t&&=t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{let a=M.parentNode(i);if(!a||!_t(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=P(a)?this.mirror.getId(mt(i)):this.mirror.getId(a),c=r(i);if(s===-1||c===-1)return n.addNode(i);let l=Ye(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=>{ut(e,this.mirror)&&this.iframeManager.addIframe(e),dt(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ft(i)&&this.shadowDomManager.addShadowRoot(M.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)wt(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(M.parentNode(e))||i(e);for(let e of this.addedSet)!Et(this.droppedSet,e)&&!wt(this.removesSubTreeCache,e,this.mirror)||Et(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(M.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(M.parentNode(n.value));if(r(n.value)===-1)continue;if(t!==-1){e=n;break}else{let t=n.value,r=M.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let t=M.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=M.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(M.childNodes(e),e=>M.textContent(e)||``).join(``);t.attributes.value=z({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:fe(e),value:n,maskInputFn:this.maskInputFn})}),r(this,`processMutation`,e=>{if(!ot(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case`characterData`:{let t=M.textContent(e.target);!G(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Be(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,it(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=fe(t);r=z({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(G(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`),!Le(t.tagName,n))if(i.attributes[n]=Ie(this.doc,B(t.tagName),B(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(G(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=P(e.target)?this.mirror.getId(M.host(e.target)):this.mirror.getId(e.target);G(e.target,this.blockClass,this.blockSelector,!1)||ot(t,this.mirror,this.slimDOMOptions)||!at(t,this.mirror)||(this.addedSet.has(t)?(St(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&n===-1||st(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[bt(n,r)]?St(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:P(e.target)&&F(e.target)?!0:void 0}),Ct(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(ot(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[bt(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);G(e,this.blockClass,this.blockSelector,!1)||(M.childNodes(e).forEach(e=>this.genAdds(e)),ft(e)&&M.childNodes(M.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 St(e,t){e.delete(t),M.childNodes(t).forEach(t=>St(e,t))}function Ct(e,t){let n=[e];for(;n.length;){let e=n.pop();t.has(e)||(t.add(e),M.childNodes(e).forEach(e=>n.push(e)))}}function wt(e,t,n){return e.size!==0&&Tt(e,t)}function Tt(e,t,n){let r=M.parentNode(t);return r?e.has(r):!1}function Et(e,t){return e.size!==0&&Dt(e,t)}function Dt(e,t){let n=M.parentNode(t);return n?e.has(n)?!0:Dt(e,n):!1}var Ot;function kt(e){Ot=e}function At(){Ot=void 0}var K=e=>Ot?(...t)=>{try{return e(...t)}catch(e){if(Ot&&Ot(e)===!0)return;throw e}}:e,q=[];function jt(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 Mt(e,t){let n=new xt;q.push(n),n.init(e);let[r,i]=ne(),a=new r(K(n.processMutations.bind(n)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[a,i]}function Nt({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=$e(K(t=>{let n=Date.now()-c;e(s.map(e=>(e.timeOffset-=n,e)),t),s=[],c=null}),o),u=K($e(K(e=>{let t=jt(e),{clientX:n,clientY:i}=ct(e)?e.changedTouches[0]:e;c||=re(),s.push({x:n,y:i,id:r.getId(t),timeOffset:re()-c}),l(typeof DragEvent<`u`&&e instanceof DragEvent?a.Drag:e instanceof MouseEvent?a.MouseMove:a.TouchMove)}),i,{trailing:!1})),d=[U(`mousemove`,u,n),U(`touchmove`,u,n),U(`drag`,u,n)];return K(()=>{d.forEach(e=>e())})}function Pt({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=jt(a);if(G(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 ct(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=ct(a)?a.changedTouches[0]:a;if(!f)return;let p=n.getId(c),{clientX:m,clientY:h}=f;K(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=B(e),r=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(U(n,r,t))}),K(()=>{l.forEach(e=>e())})}function Ft({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){return U(`scroll`,K($e(K(a=>{let o=jt(a);if(!o||G(o,r,i,!0))return;let s=n.getId(o);if(o===t&&t.defaultView){let n=tt(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 It({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return U(`resize`,K($e(K(()=>{let t=nt(),i=rt();(n!==t||r!==i)&&(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}var Lt=[`INPUT`,`TEXTAREA`,`SELECT`],Rt=new WeakMap;function zt({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=jt(e),l=e.isTrusted,d=n&&n.tagName;if(n&&d===`OPTION`&&(n=M.parentElement(n)),!n||!d||Lt.indexOf(d)<0||G(n,r,i,!0)||n.classList.contains(a)||o&&n.matches(o))return;let p=n.value,m=!1,h=fe(n)||``;h===`radio`||h===`checkbox`?m=n.checked:(s[d.toLowerCase()]||s[h])&&(p=z({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=Rt.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Rt.set(t,r);let i=n.getId(t);K(e)({...r,id:i})}}let p=(l.input===`last`?[`change`]:[`input`,`change`]).map(e=>U(e,K(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=>et(e[0],e[1],{set(){K(d)({target:this,isTrusted:!1})}},!1,m))),K(()=>{p.forEach(e=>e())})}function Bt(e){let t=[];function n(e,t){if(Xt(`CSSGroupingRule`)&&e.parentRule instanceof CSSGroupingRule||Xt(`CSSMediaRule`)&&e.parentRule instanceof CSSMediaRule||Xt(`CSSSupportsRule`)&&e.parentRule instanceof CSSSupportsRule||Xt(`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 J(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Vt({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:K((r,i,a)=>{let[o,s]=a,{id:c,styleId:l}=J(i,t,n.styleMirror);return(c&&c!==-1||l&&l!==-1)&&e({id:c,styleId:l,adds:[{rule:o,index:s}]}),r.apply(i,a)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){let i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};let a=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:K((r,i,a)=>{let[o]=a,{id:s,styleId:c}=J(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,removes:[{index:o}]}),r.apply(i,a)})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:K((r,i,a)=>{let[o]=a,{id:s,styleId:c}=J(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,replace:o}),r.apply(i,a)})}));let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:K((r,i,a)=>{let[o]=a,{id:s,styleId:c}=J(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,replaceSync:o}),r.apply(i,a)})}));let c={};Zt(`CSSGroupingRule`)?c.CSSGroupingRule=r.CSSGroupingRule:(Zt(`CSSMediaRule`)&&(c.CSSMediaRule=r.CSSMediaRule),Zt(`CSSConditionRule`)&&(c.CSSConditionRule=r.CSSConditionRule),Zt(`CSSSupportsRule`)&&(c.CSSSupportsRule=r.CSSSupportsRule));let l={};return Object.entries(c).forEach(([r,i])=>{l[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(l[r].insertRule,{apply:K((r,i,a)=>{let[o,s]=a,{id:c,styleId:l}=J(i.parentStyleSheet,t,n.styleMirror);return(c&&c!==-1||l&&l!==-1)&&e({id:c,styleId:l,adds:[{rule:o,index:[...Bt(i),s||0]}]}),r.apply(i,a)})}),i.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:K((r,i,a)=>{let[o]=a,{id:s,styleId:c}=J(i.parentStyleSheet,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,removes:[{index:[...Bt(i),o]}]}),r.apply(i,a)})})}),K(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=a,o&&(r.CSSStyleSheet.prototype.replace=o),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})})}function Ht({mirror:e,stylesheetManager:t},n){let r=null;r=n.nodeName===`#document`?e.getId(n):e.getId(M.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(r!==null&&r!==-1)try{t.adoptStyleSheets(e,r)}catch{}return n}}),K(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Ut({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:K((i,o,s)=>{let[c,l,u]=s;if(n.has(c))return a.apply(o,[c,l,u]);let{id:d,styleId:f}=J(o.parentRule?.parentStyleSheet,t,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,set:{property:c,value:l,priority:u},index:Bt(o.parentRule)}),i.apply(o,s)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:K((i,a,s)=>{let[c]=s;if(n.has(c))return o.apply(a,[c]);let{id:l,styleId:u}=J(a.parentRule?.parentStyleSheet,t,r.styleMirror);return(l&&l!==-1||u&&u!==-1)&&e({id:l,styleId:u,remove:{property:c},index:Bt(a.parentRule)}),i.apply(a,s)})}),K(()=>{i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Wt({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:a}){let o=K(a=>$e(K(i=>{let o=jt(i);if(!o||G(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=[U(`play`,o(l.Play),a),U(`pause`,o(l.Pause),a),U(`seeked`,o(l.Seeked),a),U(`volumechange`,o(l.VolumeChange),a),U(`ratechange`,o(l.RateChange),a)];return K(()=>{s.forEach(e=>e())})}function Gt({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=j(t.fonts,`add`,function(t){return function(n){return setTimeout(K(()=>{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),K(()=>{r.forEach(e=>e())})}function Kt(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:a}=e,o=!0,s=K(()=>{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);G(a,r,i,!0)||G(c,r,i,!0)||s.push({start:n.getId(a),startOffset:o,end:n.getId(c),endOffset:l})}a({ranges:s})});return s(),U(`selectionchange`,s)}function qt({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:j(n.customElements,`define`,function(e){return function(n,r,i){try{t({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,i])}})}function Jt(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 Yt(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};Jt(e,t);let r,i=()=>{};e.recordDOM&&([r,i]=Mt(e,e.doc));let a=Nt(e),o=Pt(e),s=Ft(e),c=It(e,{win:n}),l=zt(e),u=Wt(e),d=()=>{},f=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(d=Vt(e,{win:n}),f=Ht(e,e.doc),p=Ut(e,{win:n}),e.collectFonts&&(m=Gt(e)));let h=Kt(e),g=qt(e),_=[];for(let t of e.plugins)_.push(t.observer(t.callback,n,t.options));return K(()=>{q.forEach(e=>e.reset()),r?.disconnect(),i(),a(),o(),s(),c(),l(),u(),d(),f(),p(),m(),h(),g(),_.forEach(e=>e())})}function Xt(e){return window[e]!==void 0}function Zt(e){return!!(window[e]!==void 0&&window[e].prototype&&`insertRule`in window[e].prototype&&`deleteRule`in window[e].prototype)}for(var Qt=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}},$t=class{constructor(e){r(this,`iframes`,new WeakMap),r(this,`crossOriginIframeMap`,new WeakMap),r(this,`crossOriginIframeMirror`,new Qt(Ee)),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 Qt(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)})}},en=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(!F(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let[n]=Mt({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Ft({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(M.host(e))),this.restoreHandlers.push(Ht({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(j(e.prototype,`attachShadow`,function(e){return function(r){let i=e.call(this,r),a=M.shadowRoot(this);return a&&_t(this)&&n.addShadowRoot(a,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Y=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,tn=typeof Uint8Array>`u`?[]:new Uint8Array(256),nn=0;nn<Y.length;nn++)tn[Y.charCodeAt(nn)]=nn;var rn=function(e){var t=new Uint8Array(e),n,r=t.length,i=``;for(n=0;n<r;n+=3)i+=Y[t[n]>>2],i+=Y[(t[n]&3)<<4|t[n+1]>>4],i+=Y[(t[n+1]&15)<<2|t[n+2]>>6],i+=Y[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},an=new Map;function on(e,t){let n=an.get(e);return n||(n=new Map,an.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var sn=(e,t,n)=>{if(!e||!(un(e,t)||typeof e==`object`))return;let r=e.constructor.name,i=on(n,r),a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function cn(e,t,n){if(e instanceof Array)return e.map(e=>cn(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:rn(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[cn(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:[cn(e.data,t,n),e.width,e.height]};else if(un(e,t)||typeof e==`object`)return{rr_type:e.constructor.name,index:sn(e,t,n)};return e}var ln=(e,t,n)=>e.map(e=>cn(e,t,n)),un=(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 dn(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=j(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...a){return G(this.canvas,n,r,!0)||setTimeout(()=>{let n=ln(a,t,this);e(this.canvas,{type:c[`2D`],property:o,args:n})},0),i.apply(this,a)}});i.push(a)}catch{let n=et(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 fn(e){return e===`experimental-webgl`?`webgl`:e}function pn(e,t,n,r){let i=[];try{let a=j(e.HTMLCanvasElement.prototype,`getContext`,function(e){return function(i,...a){if(!G(this,t,n,!0)){let e=fn(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 mn(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=j(e,c,function(e){return function(...o){let s=e.apply(this,o);if(sn(s,a,this),`tagName`in this.canvas&&!G(this.canvas,r,i,!0)){let e=ln(o,a,this),r={type:t,property:c,args:e};n(this.canvas,r)}return s}});o.push(s)}catch{let r=et(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});o.push(r)}return o}function hn(e,t,n,r){let i=[];return t.WebGLRenderingContext!==void 0&&i.push(...mn(t.WebGLRenderingContext.prototype,c.WebGL,e,n,r,t)),t.WebGL2RenderingContext!==void 0&&i.push(...mn(t.WebGL2RenderingContext.prototype,c.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}var gn=`(function() {
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,it={map:{},getId(){return console.error(rt),-1},getNode(){return console.error(rt),null},removeNodeFromMap(){console.error(rt)},has(){return console.error(rt),!1},reset(){console.error(rt)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(it=new Proxy(it,{get(e,t,n){return t===`map`&&console.error(rt),Reflect.get(e,t,n)}}));function at(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,V||e.apply(c,a)},s))}}function ot(e,t,n,r,i=window){let a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){V||setTimeout(()=>{V||n.set.call(this,e)},0),a&&a.set&&a.set.call(this,e)}}),()=>V||ot(e,t,a||{},!0)}function st(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset===void 0?t.documentElement.scrollLeft||t?.body&&k.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&&k.parentElement(t.body)?.scrollTop||t?.body?.scrollTop||0:e.pageYOffset}}function ct(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function lt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ut(e){return e?e.nodeType===e.ELEMENT_NODE?e:k.parentElement(e):null}function z(e,t,n,r){if(!e)return!1;let i=ut(e);if(!i)return!1;try{if(typeof t==`string`){if(i.classList.contains(t)||r&&i.closest(`.`+t)!==null)return!0}else if(We(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function dt(e,t){return t.getId(e)!==-1}function ft(e,t,n){return e.tagName===`TITLE`&&n.headTitleMutations?!0:t.getId(e)===ke}function pt(e,t){if(j(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=k.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:!r||pt(r,t)}function mt(e){return!!e.changedTouches}function ht(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 gt(e,t){return!!(e.nodeName===`IFRAME`&&t.getMeta(e))}function _t(e,t){return!!(e.nodeName===`LINK`&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute(`rel`)===`stylesheet`&&t.getMeta(e))}function vt(e){return e?e instanceof nt&&`shadowRoot`in e?!!e.shadowRoot:!!k.shadowRoot(e):!1}var yt=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 bt(e){let t=null;return`getRootNode`in e&&k.getRootNode(e)?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&k.host(k.getRootNode(e))&&(t=k.host(k.getRootNode(e))),t}function xt(e){let t=e,n;for(;n=bt(t);)t=n;return t}function St(e){let t=k.ownerDocument(e);if(!t)return!1;let n=xt(e);return k.contains(t,n)}function Ct(e){let t=k.ownerDocument(e);return t?k.contains(t,e)||St(e):!1}function wt(e){return`__ln`in e}var Tt=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&&wt(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&&wt(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--)}},Et=(e,t)=>`${e}@${t}`,Dt=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 Tt,r=e=>{let t=e,n=ke;for(;n===ke;)t&&=t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{let a=k.parentNode(i);if(!a||!Ct(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=j(a)?this.mirror.getId(bt(i)):this.mirror.getId(a),c=r(i);if(s===-1||c===-1)return n.addNode(i);let l=et(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=>{gt(e,this.mirror)&&this.iframeManager.addIframe(e),_t(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),vt(i)&&this.shadowDomManager.addShadowRoot(k.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)At(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(k.parentNode(e))||i(e);for(let e of this.addedSet)!Mt(this.droppedSet,e)&&!At(this.removesSubTreeCache,e,this.mirror)||Mt(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(k.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(k.parentNode(n.value));if(r(n.value)===-1)continue;if(t!==-1){e=n;break}else{let t=n.value,r=k.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let t=k.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=k.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(k.childNodes(e),e=>k.textContent(e)||``).join(``);t.attributes.value=F({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:ge(e),value:n,maskInputFn:this.maskInputFn})}),r(this,`processMutation`,e=>{if(!ft(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case`characterData`:{let t=k.textContent(e.target);!z(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:Ge(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ut(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=ge(t);r=F({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(z(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`),!He(t.tagName,n))if(i.attributes[n]=Ve(this.doc,I(t.tagName),I(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(z(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=j(e.target)?this.mirror.getId(k.host(e.target)):this.mirror.getId(e.target);z(e.target,this.blockClass,this.blockSelector,!1)||ft(t,this.mirror,this.slimDOMOptions)||!dt(t,this.mirror)||(this.addedSet.has(t)?(Ot(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&n===-1||pt(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Et(n,r)]?Ot(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:j(e.target)&&M(e.target)?!0:void 0}),kt(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(ft(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[Et(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);z(e,this.blockClass,this.blockSelector,!1)||(k.childNodes(e).forEach(e=>this.genAdds(e)),vt(e)&&k.childNodes(k.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 Ot(e,t){e.delete(t),k.childNodes(t).forEach(t=>Ot(e,t))}function kt(e,t){let n=[e];for(;n.length;){let e=n.pop();t.has(e)||(t.add(e),k.childNodes(e).forEach(e=>n.push(e)))}}function At(e,t,n){return e.size!==0&&jt(e,t)}function jt(e,t,n){let r=k.parentNode(t);return r?e.has(r):!1}function Mt(e,t){return e.size!==0&&Nt(e,t)}function Nt(e,t){let n=k.parentNode(t);return n?e.has(n)?!0:Nt(e,n):!1}var B,V=!1,Pt;function Ft(e){B=e}var H=e=>B?(...t)=>{try{return e(...t)}catch(e){if(B&&B(e)===!0)return;throw e}}:e;function U(e,t){let n=H(t);return new Proxy(e,{apply(e,t,r){return V||n(t,r),e.apply(t,r)}})}var W=[];function It(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 Lt(e,t){let n=new Dt;W.push(n),n.init(e);let[r,i]=ae(),a=new r(H(e=>{Pt&&Pt(e)===!1||n.processMutations(e)}));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[a,i]}function Rt({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=at(H(t=>{let n=Date.now()-c;e(s.map(e=>(e.timeOffset-=n,e)),t),s=[],c=null}),o),u=H(at(H(e=>{let t=It(e),{clientX:n,clientY:i}=mt(e)?e.changedTouches[0]:e;c||=oe(),s.push({x:n,y:i,id:r.getId(t),timeOffset:oe()-c}),l(typeof DragEvent<`u`&&e instanceof DragEvent?a.Drag:e instanceof MouseEvent?a.MouseMove:a.TouchMove)}),i,{trailing:!1})),d=[R(`mousemove`,u,n),R(`touchmove`,u,n),R(`drag`,u,n)];return H(()=>{d.forEach(e=>e())})}function zt({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=It(a);if(z(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 mt(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=mt(a)?a.changedTouches[0]:a;if(!f)return;let p=n.getId(c),{clientX:m,clientY:h}=f;H(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=I(e),r=H(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(R(n,r,t))}),H(()=>{l.forEach(e=>e())})}function Bt({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){return R(`scroll`,H(at(H(a=>{let o=It(a);if(!o||z(o,r,i,!0))return;let s=n.getId(o);if(o===t&&t.defaultView){let n=st(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 Vt({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return R(`resize`,H(at(H(()=>{let t=ct(),i=lt();(n!==t||r!==i)&&(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}var Ht=[`INPUT`,`TEXTAREA`,`SELECT`],Ut=new WeakMap;function Wt({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=It(e),l=e.isTrusted,d=n&&n.tagName;if(n&&d===`OPTION`&&(n=k.parentElement(n)),!n||!d||Ht.indexOf(d)<0||z(n,r,i,!0)||n.classList.contains(a)||o&&n.matches(o))return;let p=n.value,m=!1,h=ge(n)||``;h===`radio`||h===`checkbox`?m=n.checked:(s[d.toLowerCase()]||s[h])&&(p=F({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=Ut.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Ut.set(t,r);let i=n.getId(t);H(e)({...r,id:i})}}let p=(l.input===`last`?[`change`]:[`input`,`change`]).map(e=>R(e,H(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=>ot(e[0],e[1],{set(){H(d)({target:this,isTrusted:!1})}},!1,m))),H(()=>{p.forEach(e=>e())})}function Gt(e){let t=[];function n(e,t){if(nn(`CSSGroupingRule`)&&e.parentRule instanceof CSSGroupingRule||nn(`CSSMediaRule`)&&e.parentRule instanceof CSSMediaRule||nn(`CSSSupportsRule`)&&e.parentRule instanceof CSSSupportsRule||nn(`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 Kt(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function qt({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=(r,i)=>{let{id:a,styleId:o}=Kt(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=U(a,(e,[t,n])=>i(e,{adds:[{rule:t,index:n}]}));let o=r.CSSStyleSheet.prototype.addRule;r.CSSStyleSheet.prototype.addRule=o?U(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=U(s,(e,[t])=>i(e,{removes:[{index:t}]}));let c=r.CSSStyleSheet.prototype.removeRule;r.CSSStyleSheet.prototype.removeRule=c?U(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=U(l,(e,[t])=>i(e,{replace:t})));let u;r.CSSStyleSheet.prototype.replaceSync&&(u=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=U(u,(e,[t])=>i(e,{replaceSync:t})));let d={};rn(`CSSGroupingRule`)?d.CSSGroupingRule=r.CSSGroupingRule:(rn(`CSSMediaRule`)&&(d.CSSMediaRule=r.CSSMediaRule),rn(`CSSConditionRule`)&&(d.CSSConditionRule=r.CSSConditionRule),rn(`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=U(f[e].insertRule,(e,[t,n])=>i(e.parentStyleSheet,{adds:[{rule:t,index:[...Gt(e),n||0]}]})),t.prototype.deleteRule=U(f[e].deleteRule,(e,[t])=>i(e.parentStyleSheet,{removes:[{index:[...Gt(e),t]}]}))}),H(()=>{V||(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 Jt({mirror:e,stylesheetManager:t},n){let r=null;r=n.nodeName===`#document`?e.getId(n):e.getId(k.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(!V&&r!==null&&r!==-1)try{t.adoptStyleSheets(e,r)}catch{}return n}}),H(()=>{V||Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Yt({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=U(a,(i,a)=>{let[o,s,c]=a;if(n.has(o))return;let{id:l,styleId:u}=Kt(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:Gt(i.parentRule)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=U(o,(i,a)=>{let[o]=a;if(n.has(o))return;let{id:s,styleId:c}=Kt(i.parentRule?.parentStyleSheet,t,r.styleMirror);(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,remove:{property:o},index:Gt(i.parentRule)})}),H(()=>{V||(i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=o)})}function Xt({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:a}){let o=H(a=>at(H(i=>{let o=It(i);if(!o||z(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=[R(`play`,o(l.Play),a),R(`pause`,o(l.Pause),a),R(`seeked`,o(l.Seeked),a),R(`volumechange`,o(l.VolumeChange),a),R(`ratechange`,o(l.RateChange),a)];return H(()=>{s.forEach(e=>e())})}function Zt({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=O(t.fonts,`add`,function(t){return function(n){return setTimeout(H(()=>{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),H(()=>{r.forEach(e=>e())})}function Qt(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:a}=e,o=!0,s=H(()=>{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);z(a,r,i,!0)||z(c,r,i,!0)||s.push({start:n.getId(a),startOffset:o,end:n.getId(c),endOffset:l})}a({ranges:s})});return s(),R(`selectionchange`,s)}function $t({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:O(n.customElements,`define`,function(e){return function(n,r,i){if(!V)try{t({define:{name:n}})}catch(e){B&&B(e)===!0||console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,i])}})}function en(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 tn(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};en(e,t);let r,i=()=>{};e.recordDOM&&([r,i]=Lt(e,e.doc));let a=Rt(e),o=zt(e),s=Bt(e),c=Vt(e,{win:n}),l=Wt(e),u=Xt(e),d=()=>{},f=()=>{},p=()=>{},m=()=>{};e.recordDOM&&(d=qt(e,{win:n}),f=Jt(e,e.doc),p=Yt(e,{win:n}),e.collectFonts&&(m=Zt(e)));let h=Qt(e),g=$t(e),_=[];for(let t of e.plugins)_.push(t.observer(t.callback,n,t.options));return H(()=>{W.forEach(e=>e.reset()),r?.disconnect(),i(),a(),o(),s(),c(),l(),u(),d(),f(),p(),m(),h(),g(),_.forEach(e=>e())})}function nn(e){return window[e]!==void 0}function rn(e){return!!(window[e]!==void 0&&window[e].prototype&&`insertRule`in window[e].prototype&&`deleteRule`in window[e].prototype)}for(var an=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}},on=class{constructor(e){r(this,`iframes`,new WeakMap),r(this,`crossOriginIframeMap`,new WeakMap),r(this,`crossOriginIframeMirror`,new an(Ae)),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 an(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)})}},sn=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(!M(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let[n]=Lt({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Bt({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(H(()=>{V||(e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(k.host(e))),this.restoreHandlers.push(Jt({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(O(e.prototype,`attachShadow`,function(e){return function(r){let i=e.call(this,r);return V||H(()=>{let e=k.shadowRoot(this);e&&Ct(this)&&n.addShadowRoot(e,t)})(),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},cn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ln=typeof Uint8Array>`u`?[]:new Uint8Array(256),un=0;un<cn.length;un++)ln[cn.charCodeAt(un)]=un;var dn=function(e){var t=new Uint8Array(e),n,r=t.length,i=``;for(n=0;n<r;n+=3)i+=cn[t[n]>>2],i+=cn[(t[n]&3)<<4|t[n+1]>>4],i+=cn[(t[n+1]&15)<<2|t[n+2]>>6],i+=cn[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},fn=new Map;function pn(e,t){let n=fn.get(e);return n||(n=new Map,fn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var mn=(e,t,n)=>{if(!e||!(_n(e,t)||typeof e==`object`))return;let r=e.constructor.name,i=pn(n,r),a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function hn(e,t,n){if(e instanceof Array)return e.map(e=>hn(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:dn(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[hn(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:[hn(e.data,t,n),e.width,e.height]};else if(_n(e,t)||typeof e==`object`)return{rr_type:e.constructor.name,index:mn(e,t,n)};return e}var gn=(e,t,n)=>e.map(e=>hn(e,t,n)),_n=(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 vn(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=O(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...a){return z(this.canvas,n,r,!0)||setTimeout(()=>{let n=gn(a,t,this);e(this.canvas,{type:c[`2D`],property:o,args:n})},0),i.apply(this,a)}});i.push(a)}catch{let n=ot(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 yn(e){return e===`experimental-webgl`?`webgl`:e}function bn(e,t,n,r){let i=[];try{let a=O(e.HTMLCanvasElement.prototype,`getContext`,function(e){return function(i,...a){if(!z(this,t,n,!0)){let e=yn(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 xn(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=O(e,c,function(e){return function(...o){let s=e.apply(this,o);if(mn(s,a,this),`tagName`in this.canvas&&!z(this.canvas,r,i,!0)){let e=gn(o,a,this),r={type:t,property:c,args:e};n(this.canvas,r)}return s}});o.push(s)}catch{let r=ot(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});o.push(r)}return o}function Sn(e,t,n,r){let i=[];return t.WebGLRenderingContext!==void 0&&i.push(...xn(t.WebGLRenderingContext.prototype,c.WebGL,e,n,r,t)),t.WebGL2RenderingContext!==void 0&&i.push(...xn(t.WebGL2RenderingContext.prototype,c.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}var Cn=`(function() {
|
|
4
4
|
"use strict";
|
|
5
5
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
6
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
@@ -75,4 +75,4 @@ or you can use record.mirror to access the mirror instance during recording.`,Qe
|
|
|
75
75
|
};
|
|
76
76
|
})();
|
|
77
77
|
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
78
|
-
`,_n=typeof self<`u`&&self.Blob&&new Blob([gn],{type:`text/javascript;charset=utf-8`});function vn(e){let t;try{if(t=_n&&(self.URL||self.webkitURL).createObjectURL(_n),!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(gn),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var yn=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=pn(t,n,r,!0),o=new Map,s=new vn;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=>{G(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=pn(e,t,n,!1),i=dn(this.processMutation.bind(this),e,t,n),a=hn(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)}},bn=class{constructor(e){r(this,`trackedLinkElements`,new WeakSet),r(this,`mutationCb`),r(this,`adoptedStyleSheetCb`),r(this,`styleMirror`,new pt),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:I(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){}},xn=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(){}},X,Sn,Cn,wn=!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 Z=le();function Tn(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:C=!0,recordCanvas:w=!1,recordCrossOriginIframes:ee=!1,recordAfter:T=e.recordAfter===`DOMContentLoaded`?e.recordAfter:`load`,userTriggeredOnInput:E=!1,collectFonts:D=!1,inlineImages:O=!1,plugins:k,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:te=new Set([]),errorHandler:ne}=e;kt(ne);let j=!ee||window.parent===window,N=!1;if(!j)try{window.parent.document&&(N=!1)}catch{N=!0}if(j&&!t)throw Error(`emit function is required`);if(!j&&!N)return()=>{};S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),Z.reset();let P=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,F=qe(h);lt();let ie,ae=0,oe=e=>{for(let t of k||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!N&&(e=y(e)),e};X=(e,o)=>{let s=e;if(s.timestamp=re(),q[0]?.isFrozen()&&s.type!==i.FullSnapshot&&(s.type!==i.IncrementalSnapshot||s.data.source!==a.Mutation)&&q.forEach(e=>e.unfreeze()),j)t?.(oe(s),o);else if(N){let e={type:`rrweb`,event:oe(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,`*`)}if(s.type===i.FullSnapshot)ie=s,ae=0;else if(s.type===i.IncrementalSnapshot){if(s.data.source===a.Mutation&&s.data.isAttachIframe)return;ae++;let e=r&&ae>=r,t=n&&s.timestamp-ie.timestamp>n;(e||t)&&Sn(!0)}};let I=e=>{X({type:i.IncrementalSnapshot,data:{source:a.Mutation,...e}})},se=e=>X({type:i.IncrementalSnapshot,data:{source:a.Scroll,...e}}),ce=e=>X({type:i.IncrementalSnapshot,data:{source:a.CanvasMutation,...e}}),L=new bn({mutationCb:I,adoptedStyleSheetCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.AdoptedStyleSheet,...e}})}),R=new $t({mirror:Z,mutationCb:I,stylesheetManager:L,recordCrossOriginIframes:ee,wrappedEmit:X});for(let e of k||[])e.getMirror&&e.getMirror({nodeMirror:Z,crossOriginIframeMirror:R.crossOriginIframeMirror,crossOriginIframeStyleMirror:R.crossOriginIframeStyleMirror});let le=new xn;Cn=new yn({recordCanvas:w,mutationCb:ce,win:window,blockClass:o,blockSelector:s,mirror:Z,sampling:b.canvas,dataURLOptions:x});let z=new en({mutationCb:I,scrollCb:se,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:u,maskTextSelector:d,inlineStylesheet:f,maskInputOptions:P,dataURLOptions:x,maskTextFn:_,maskInputFn:g,recordCanvas:w,inlineImages:O,sampling:b,slimDOMOptions:F,iframeManager:R,stylesheetManager:L,canvasManager:Cn,keepIframeSrcFn:A,processedNodeManager:le},mirror:Z});Sn=(e=!1)=>{if(!C)return;X({type:i.Meta,data:{href:window.location.href,width:rt(),height:nt()}},e),L.reset(),z.init(),q.forEach(e=>e.lock());let t=Xe(document,{mirror:Z,blockClass:o,blockSelector:s,maskTextClass:u,maskTextSelector:d,inlineStylesheet:f,maskAllInputs:P,maskTextFn:_,maskInputFn:g,slimDOM:F,dataURLOptions:x,recordCanvas:w,inlineImages:O,onSerialize:e=>{ut(e,Z)&&R.addIframe(e),dt(e,Z)&&L.trackLinkElement(e),ft(e)&&z.addShadowRoot(M.shadowRoot(e),document)},onIframeLoad:(e,t)=>{R.attachIframe(e,t),z.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{L.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn(`Failed to snapshot the document`);X({type:i.FullSnapshot,data:{node:t,initialOffset:tt(window)}},e),q.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&L.adoptStyleSheets(document.adoptedStyleSheets,Z.getId(document))};try{let e=[],t=e=>K(Yt)({mutationCb:I,mousemoveCb:(e,t)=>X({type:i.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.MouseInteraction,...e}}),scrollCb:se,viewportResizeCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.ViewportResize,...e}}),inputCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.Input,...e}}),mediaInteractionCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.MediaInteraction,...e}}),styleSheetRuleCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.StyleSheetRule,...e}}),styleDeclarationCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.StyleDeclaration,...e}}),canvasMutationCb:ce,fontCb:e=>X({type:i.IncrementalSnapshot,data:{source:a.Font,...e}}),selectionCb:e=>{X({type:i.IncrementalSnapshot,data:{source:a.Selection,...e}})},customElementCb:e=>{X({type:i.IncrementalSnapshot,data:{source:a.CustomElement,...e}})},blockClass:o,ignoreClass:c,ignoreSelector:l,maskTextClass:u,maskTextSelector:d,maskInputOptions:P,inlineStylesheet:f,sampling:b,recordDOM:C,recordCanvas:w,inlineImages:O,userTriggeredOnInput:E,collectFonts:D,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:A,blockSelector:s,slimDOMOptions:F,dataURLOptions:x,mirror:Z,iframeManager:R,stylesheetManager:L,shadowDomManager:z,processedNodeManager:le,canvasManager:Cn,ignoreCSSAttributes:te,plugins:(k?.filter(e=>e.observer))?.map(e=>({observer:e.observer,options:e.options,callback:t=>X({type:i.Plugin,data:{plugin:e.name,payload:t}})}))||[]},v);R.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}});let n=()=>{Sn(),e.push(t(document)),wn=!0};return[`interactive`,`complete`].includes(document.readyState)?n():(e.push(U(`DOMContentLoaded`,()=>{X({type:i.DomContentLoaded,data:{}}),T===`DOMContentLoaded`&&n()})),e.push(U(`load`,()=>{X({type:i.Load,data:{}}),T===`load`&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(e){String(e).toLowerCase().includes(`cross-origin`)||console.warn(e)}}),le.destroy(),wn=!1,At()}}catch(e){console.warn(e)}}Tn.addCustomEvent=(e,t)=>{if(!wn)throw Error(`please add custom event after start recording`);X({type:i.Custom,data:{tag:e,payload:t}})},Tn.freezePage=()=>{q.forEach(e=>e.freeze())},Tn.takeFullSnapshot=e=>{if(!wn)throw Error(`please take full snapshot after start recording`);Sn(e)},Tn.mirror=Z;var En=2;function Dn(e,t=e=>e){let n=[],r=0,i=1/0,a=-1/0,o=!1,s=new Set,c=null;function l(){n=[],r=0,i=1/0,a=-1/0,o=!1,s=new Set,c=null}return{push(l){let u=JSON.stringify(l);e.events.push(l),n.push(u),r+=u.length,i=Math.min(i,l.timestamp),a=Math.max(a,l.timestamp),l.type===En&&(o=!0);let d=location.href;d!==c&&(s.add(t(d)),c=d)},bytes:()=>r,take(){if(e.events.length===0)return null;let t={events:e.events,json:`{"events":[${n.join(`,`)}]}`,parts:n,bytes:r,start:i,end:a,hasFullSnapshot:o,urls:[...s]};return e.events=[],l(),t},restore(t){e.events=[...t.events,...e.events],n=[...t.parts,...n],r+=t.bytes,i=Math.min(i,t.start),a=Math.max(a,t.end),o||=t.hasFullSnapshot,s=new Set([...t.urls,...s])}}}var Q={collectorUrl:`https://api.mime8.com`,recorderVersion:`0.1.1`,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}],earlyUploadBytes:256*1024,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 On(e){let t=e.network??{},n=t.redact??{};return{...Q,projectKey:e.projectKey,collectorUrl:e.collectorUrl??Q.collectorUrl,ignoreUrls:[...Q.ignoreUrls,...t.ignoreUrls??[]],maxBodySize:t.maxBodySize??Q.maxBodySize,redact:[...Q.redact,...(n.headers??[]).map(e=>({header:e})),...(n.queryParams??[]).map(e=>({queryParam:e})),...(n.bodyFields??[]).map(e=>({bodyField:e}))],beforeRecord:t.beforeRecord,streamingTypes:[...Q.streamingTypes],mediaTypes:[...Q.mediaTypes]}}var kn=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});function An(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 jn(e){try{return{text:kn.decode(e)}}catch{return{base64:An(e)}}}function Mn(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 Nn(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 Pn(){let e=new Uint8Array;return{push(t){let n=Nn(e,t),r=Mn(n);try{let t=kn.decode(n.subarray(0,r));return e=n.slice(r),t?{text:t}:null}catch{return e=new Uint8Array,{base64:An(n)}}},end(){if(e.length===0)return null;let t=jn(e);return e=new Uint8Array,t}}}function Fn(e,t){return e>t.maxBodySize?{omitted:`too-large`,size:e}:null}function In(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 Ln(e,t){return e.length*3<=t.maxBodySize?null:Fn(In(e),t)}async function Rn(e,t,n=!1){let r=Fn(e.size,t);if(r)return r;let i=new Uint8Array(await e.arrayBuffer());return n?{base64:An(i)}:jn(i)}function zn(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 Bn(e,t){if(e!=null){if(typeof e==`string`||e instanceof URLSearchParams){let n=e.toString();return Ln(n,t)??{text:n}}if(e instanceof FormData)return{form:zn(e)};if(e instanceof Blob)return Rn(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 Fn(n.byteLength,t)??jn(n)}return e instanceof ReadableStream?{omitted:`stream`}:{omitted:`unreadable`}}}function Vn(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 Hn(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 $(e){try{e()}catch{}}function Un(e){return e instanceof Error||e instanceof DOMException?e.message:String(e)}function Wn(e,t,n){let r=e.navigator;if(typeof r.sendBeacon!=`function`)return;let i=r.sendBeacon.bind(r),a=e=>$(()=>t.emit(e));r.sendBeacon=function(e,r){let o=i(e,r);return $(()=>{let i=new URL(String(e),document.baseURI).href;if(t.ignores(i))return;let s=t.nextId(),c=Date.now(),l=Vn(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=Bn(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 Gn(e,t,n){return n.find(n=>e.matchMedia(`(${t}: ${n})`).matches)??`unknown`}function Kn(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:Gn(e,`hover`,[`hover`,`none`]),anyHover:Gn(e,`any-hover`,[`hover`,`none`]),pointer:Gn(e,`pointer`,[`fine`,`coarse`,`none`]),anyPointer:Gn(e,`any-pointer`,[`fine`,`coarse`,`none`]),maxTouchPoints:t.maxTouchPoints,screen:{width:n.width,height:n.height}}}var qn=`mime8/environment@1`;function Jn(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 Yn=`mime8/keys@1`,Xn=`mime8/network@1`,Zn=`mime8/storage@1`,Qn=`mime8/storage-change@1`;function $n(e,t,n){let r=e=>{try{e()}catch{}},i=e,a=e=>{let t=null;return r(()=>{e===i.localStorage?t=`local`:e===i.sessionStorage&&(t=`session`)}),t},o=i.Storage.prototype,{setItem:s,removeItem:c,clear:l}=o;return o.setItem=function(e,i){let o=Reflect.apply(s,this,arguments);return r(()=>{let r=a(this);if(r){let a=String(i);t({by:`app`,area:r,op:`set`,key:String(e),size:a.length,hash:n(a)})}}),o},o.removeItem=function(e){let n=!1;r(()=>{n=this.getItem(e)!==null});let i=Reflect.apply(c,this,arguments);return r(()=>{let r=a(this);r&&n&&t({by:`app`,area:r,op:`remove`,key:String(e)})}),i},o.clear=function(){let e=!0;r(()=>{e=this.length===0});let n=Reflect.apply(l,this,arguments);return r(()=>{let n=a(this);n&&!e&&t({by:`app`,area:n,op:`clear`})}),n},{setItem:s,removeItem:c,clear:l}}var er=new Set([`Enter`,`Escape`,`Tab`,`Backspace`,`Delete`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),tr=new Set([`button`,`submit`,`reset`,`checkbox`,`radio`]),nr=new Set([`button`,`checkbox`,`switch`,`menuitem`]);function rr(e){return e instanceof Element?e instanceof HTMLButtonElement?!0:e instanceof HTMLInputElement?tr.has(e.type):nr.has(e.getAttribute(`role`)??``):!1}function ir(e,t){if(e.isComposing||e.key===`Process`||e.keyCode===229)return!1;if(er.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 rr(t);let a=e.getModifierState(`AltGraph`)||n&&i||i&&!r;return(n||r)&&!a}return n||r||i}function ar(e,t,n){let r=e=>$(()=>{let r=e.composedPath()[0];ir(e,r)&&t({type:6,timestamp:Date.now(),data:{plugin:Yn,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 or=EventTarget.prototype.addEventListener;function sr(e,t){let n=e.EventSource;if(typeof n!=`function`)return;let r=new WeakMap,i=e=>$(()=>t.emit(e));function a(e,t,n){n===`open`||n===`error`||t.subscribed.has(n)||(t.subscribed.add(n),or.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),$(()=>{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}),or.call(this,`open`,()=>i({type:`sse-open`,t:Date.now(),id:n})),or.call(this,`error`,()=>i({type:`sse-error`,readyState:this.readyState,t:Date.now(),id:n})),a(this,e,`message`)})}close(){$(()=>{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){$(()=>{let t=r.get(this);t&&a(this,t,e)}),or.call(this,e,t,n)}}),Object.defineProperty(o,"name",{value:`EventSource`}),e.EventSource=o}function cr(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 lr=new Set([`DELETE`,`GET`,`HEAD`,`OPTIONS`,`POST`,`PUT`]);function ur(e){let t=e.toUpperCase();return lr.has(t)?t:e}function dr(e){return[...e]}function fr(e){return e instanceof DOMException||e instanceof Error?e.name:void 0}function pr(e,t){return fr(e)===`TimeoutError`||fr(t?.reason)===`TimeoutError`?`timeout`:fr(e)===`AbortError`||t?.aborted===!0?`abort`:`network`}async function mr(e,t){if(!e.body)return;let n=await Hn(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:zn(await new Response(n,{headers:{"content-type":r}}).formData())}}catch{}return jn(n)}function hr(e){return e!==void 0&&!(e instanceof Headers)&&!Array.isArray(e)&&typeof e[Symbol.iterator]==`function`?new Headers:new Headers(e)}function gr(e,t,n){let r=t?.headers?hr(t.headers):new Headers(e.headers);if(n&&!r.has(`content-type`)){let e=Vn(t?.body);e&&r.set(`content-type`,e)}return r}function _r(e,t,n){if(e instanceof Request){let r=t?.body!==void 0&&t.body!==null,i=r?null:e.clone();return{method:ur(t?.method??e.method),headers:dr(gr(e,t,r)),body:i?mr(i,n):Bn(t?.body,n),signal:t?.signal??e.signal}}let r=hr(t?.headers),i=r.has(`content-type`)?null:Vn(t?.body);return i&&r.set(`content-type`,i),{method:ur(t?.method??`GET`),headers:dr(r),body:Bn(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 yr(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}=_r(e,r,n),d=e=>$(()=>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:pr(e,u),message:Un(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 Hn(t.body,n.maxBodySize);if(r){d({type:`http-end`,body:jn(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=Pn(),i=null,o=0,s=!1,c=e=>$(()=>{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){$(()=>{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:dr(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(cr(t,n.mediaTypes)){d({type:`http-end`,body:{omitted:`media`},t:Date.now(),id:a});return}if(cr(t,n.streamingTypes)&&e.body)return h(e,e.body);m(e)}}}async function a(t,n){let a=null;$(()=>{a=i(t,n)});let o;try{o=await r.call(e,t,n)}catch(e){let t=a;throw $(()=>t?.failed(e)),e}let s=a,c=o;return $(()=>{c=s?.responded(o)??o}),c}e.fetch=a}var br=[`RTCPeerConnection`,`Worker`,`SharedWorker`,`WebTransport`,`WebSocketStream`];function xr(e,t){for(let n of br){let r=e[n];if(typeof r!=`function`)continue;let i=class extends r{constructor(...e){super(...e),$(()=>{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 Sr(e,t){return e.lastIndex=0,e.test(t)}function Cr(e,t){return typeof e==`string`?e.toLowerCase()===t.toLowerCase():e instanceof RegExp?Sr(e,t):e(t)}function wr(e,t){return typeof e==`string`?t.startsWith(e):e instanceof RegExp?Sr(e,t):e(t)}var Tr=`[redacted]`;function Er(e){return Tr}function Dr(e){try{return decodeURIComponent(e.replaceAll(`+`,` `))}catch{return e}}function Or(e,t){let n=!1,r=e.split(`&`).map(e=>{let r=e.indexOf(`=`);if(r===-1)return e;let i=e.slice(0,r);return Cr(t,Dr(i))?(n=!0,`${i}=${Er(e.slice(r+1))}`):e});return n?r.join(`&`):e}function kr(e,t,n,r){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===`"`)return a(t);if(o!==`{`&&o!==`[`){let n=t;for(;n<e.length&&!/[\s,\]}]/.test(e[n]);)n++;return n}let s=o===`{`?`}`:`]`,c=i(t+1);for(;e[c]!==s;){if(o===`{`){let t=a(c),o=JSON.parse(e.slice(c,t));c=i(i(t)+1);let s=kr(e,c,n,r);Cr(r,o)&&n.push([c,s]),c=s}else c=kr(e,c,n,r);c=i(c),e[c]===`,`&&(c=i(c+1))}return c+1}function Ar(e,t){try{JSON.parse(e)}catch{return e}let n=[];if(kr(e,e.search(/\S/),n,t),n.length===0)return e;n.sort((e,t)=>e[0]-t[0]);let r=``,i=0;for(let[t,a]of n)t<i||(r+=`${e.slice(i,t)}"${Tr}"`,i=a);return r+e.slice(i)}var jr=/^[^\s=&]+=[^\s&]*(?:&[^\s=&]+=[^\s&]*)*$/;function Mr(e){return(e.find(([e])=>e===`content-type`)?.[1]??``).split(`;`)[0].trim().toLowerCase()===`application/x-www-form-urlencoded`}function Nr(e,t,n=!1){if(`text`in e){let r=n?Or(e.text,t):Ar(e.text,t);return r===e.text?e:{text:r}}return`form`in e&&e.form.some(e=>Cr(t,e.name))?{form:e.form.map(e=>Cr(t,e.name)?{name:e.name,value:Tr}:e)}:e}var Pr={is:e=>`bodyField`in e,apply(e,t){let n=t.bodyField;switch(e.type){case`http-request`:{if(!e.body)return e;let t=Nr(e.body,n,Mr(e.headers));return t===e.body?e:{...e,body:t}}case`http-end`:{if(!e.body)return e;let t=`text`in e.body&&jr.test(e.body.text),r=Nr(e.body,n,t);return r===e.body?e:{...e,body:r}}case`ws-send`:case`ws-message`:{let t=Nr(e.data,n);return t===e.data?e:{...e,data:t}}case`sse-message`:{let t=Ar(e.data,n);return t===e.data?e:{...e,data:t}}default:return e}}};function Fr(e,t){return e.some(([e])=>Cr(t,e))?e.map(([e,n])=>Cr(t,e)?[e,Er(n)]:[e,n]):e}var Ir={is:e=>`header`in e,apply(e,t){if(e.type!==`http-request`&&e.type!==`http-response`)return e;let n=Fr(e.headers,t.header);return n===e.headers?e:{...e,headers:n}}};function Lr(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)+Or(r.slice(o+1),t)),i===null)return a;let s=i.indexOf(`?`),c=i;return s===-1?i.includes(`=`)&&(c=Or(i,t)):c=i.slice(0,s+1)+Or(i.slice(s+1),t),`${a}#${c}`}var Rr={is:e=>`queryParam`in e,apply(e,t){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=Lr(e.url,t.queryParam);return n===e.url?e:{...e,url:n}}default:return e}}},zr=[Ir,Rr,Pr],Br=/^([a-z][a-z\d+.-]*:\/\/[^/?#@:]*:)[^/?#@]*@/i;function Vr(e){return e.replace(Br,`$1${Tr}@`)}function Hr(e,t){let n=e;if(`url`in n&&n.url!==void 0){let e=Vr(n.url);e!==n.url&&(n={...n,url:e})}for(let e of t){let t=zr.find(t=>t.is(e));t&&(n=t.apply(n,e))}return n}function Ur(e,t){let n=Vr(e);for(let e of t)Rr.is(e)&&(n=Lr(n,e.queryParam));return n}function Wr(e,t){let n=0,r=0;return{ignores:t=>e.ignoreUrls.some(e=>wr(e,t)),nextId:()=>r++,place:()=>n++,emit(r){try{let i=Hr(r,e.redact);if(e.beforeRecord&&(i=e.beforeRecord(i)),!i)return;t({...i,n:i.n??n++})}catch{}}}}var Gr=EventTarget.prototype.addEventListener;function Kr(e,t,n){let r=e.WebSocket;if(typeof r!=`function`)return;let i=new WeakMap,a=e=>$(()=>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();Rn(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=Ln(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:An(e)}}else c={omitted:`unreadable`};a({type:e,data:c,t:s,id:i})}class c extends r{constructor(e,n){super(e,n),$(()=>{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}),Gr.call(this,`open`,()=>a({type:`ws-open`,protocol:this.protocol,extensions:this.extensions,t:Date.now(),id:r})),Gr.call(this,`message`,e=>$(()=>s(`ws-message`,e.data,r))),Gr.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})}),Gr.call(this,`error`,()=>a({type:`ws-error`,t:Date.now(),id:r}))})}send(e){$(()=>{let t=i.get(this);t&&this.readyState===r.OPEN&&s(`ws-send`,e,t.id)}),super.send(e)}close(e,t){$(()=>{let e=i.get(this);e&&(e.byApp=!0)}),super.close(e,t)}}Object.defineProperty(c,"name",{value:`WebSocket`}),e.WebSocket=c}function qr(e,t,n){let r=e=>$(()=>t({type:6,timestamp:Date.now(),data:{plugin:Qn,payload:e}}));$n(e,r,Jn),e.addEventListener(`storage`,t=>$(()=>{if(t.storageArea===e.localStorage)if(t.key===null)r({by:`other-tab`,area:`local`,op:`clear`});else if(t.newValue===null)r({by:`other-tab`,area:`local`,op:`remove`,key:t.key});else{let e=t.newValue.length,i=e>n.maxBodySize?null:t.newValue;r({by:`other-tab`,area:`local`,op:`set`,key:t.key,value:i,size:e})}})),e.cookieStore?.addEventListener(`change`,e=>$(()=>{let{changed:t,deleted:n}=e;for(let e of t)r({by:`cookie`,op:`set`,cookie:Jr(e)});for(let e of n)r({by:`cookie`,op:`remove`,name:e.name??``,domain:e.domain??null,path:e.path??`/`})}))}function Jr(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 Yr(e){let t=new Headers;for(let[n,r]of e)t.append(n,r);return[...t]}function Xr(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 Zr(e){let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)}function Qr(e,t,n){let r=e.XMLHttpRequest.prototype,{open:i,setRequestHeader:a,send:o}=r,s=new WeakMap,c=new WeakSet,l=e=>$(()=>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!==Zr(t.url),headers:Yr(Xr(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(cr(e.getResponseHeader(`content-type`),n.mediaTypes)){a({omitted:`media`});return}switch(e.responseType){case``:case`text`:{let t=e.responseText;a(Ln(t,n)??{text:t});return}case`json`:{let r=e.response,a=Date.now(),o=t.place();setTimeout(()=>$(()=>{let e=JSON.stringify(r);l({type:`http-end`,body:Ln(e,n)??{text:e},t:a,id:i,n:o})}));return}case`arraybuffer`:{let t=new Uint8Array(e.response);a(u(t.byteLength)??jn(t));return}case`blob`:{let r=Date.now(),a=t.place();Rn(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`,()=>$(()=>{let t=s.get(e);t?.sent&&e.readyState===XMLHttpRequest.HEADERS_RECEIVED&&d(e,t)})),e.addEventListener(`load`,()=>$(()=>{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,()=>$(()=>{let t=s.get(e);t?.sent&&f(t,n)}))}}r.open=function(...e){return $(()=>{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:ur(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),$(()=>s.get(this)?.headers.push([e.toLowerCase(),t]))},r.send=function(e){return $(()=>{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:Vn(e);d&&u.push([`content-type`,d]);let f=Yr(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=Bn(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)}}function $r(e){return{type:6,timestamp:e.t,data:{plugin:Xn,payload:e}}}function ei(e,t){return{type:6,timestamp:t,data:{plugin:Zn,payload:e}}}function ti(e,t){return{type:6,timestamp:t,data:{plugin:qn,payload:e}}}async function ni(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 ri=64*1024,ii=1024;function ai(e){return e>=400&&e<500&&e!==408&&e!==429}function oi(e,t,n,r){let i=`${e.collectorUrl}/api/projects/${e.projectKey}/sessions/${t}/chunks`,a=0,o=null;async function s(t,o){let s=n.take();if(s)try{let{json:n}=s,c=await ni(n),l={version:1,sequenceNumber:a,sentAt:Date.now(),start:s.start,end:s.end,eventCount:s.events.length,hasFullSnapshot:s.hasFullSnapshot,reason:t,urls:s.urls,recorderVersion:e.recorderVersion,rawBytes:n.length},u=JSON.stringify(l),d=()=>{let e=new FormData;return e.append(`metadata`,new Blob([u],{type:`application/json`})),e.append(`events`,new Blob([c],{type:`application/gzip`})),e},f=o&&c.byteLength+u.length+ii<=ri,p=e=>r(i,{method:`POST`,body:d(),keepalive:e}),m=await p(f).catch(e=>{if(f&&e instanceof TypeError)return p(!1);throw e});if(!m.ok&&!ai(m.status))throw Error(`Collector responded ${m.status}`);a++}catch{n.restore(s)}}async function c(t,r){for(;o;){if(!r)return;await o}o=s(t,r);try{await o}finally{o=null}n.bytes()>=e.earlyUploadBytes&&c(`size`,!1)}return setInterval(()=>{c(`interval`,!1)},e.uploadInterval),{flush:({final:e=!1}={})=>c(e?`hidden`:`interval`,e),notify(){!o&&n.bytes()>=e.earlyUploadBytes&&c(`size`,!1)}}}function si(){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 ci=4;function li(){let e=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);if(r!==null){let n=e.getItem(r);n!==null&&t.push({key:r,value:n})}}return t};return{localStorage:window.localStorage?e(localStorage):[],sessionStorage:window.sessionStorage?e(sessionStorage):[],cookies:document.cookie??``}}function ui(e){if(!e?.projectKey)throw Error(`mime8.init: projectKey is required`);if(window.mime8Replay===!0||window.__mime8)return;let t=On(e),n=window.fetch.bind(window);window.__mime8={sessionId:si(),events:[]};let r=e=>Ur(e,t.redact),i=Dn(window.__mime8,r),a=Date.now();i.push(ei(li(),a)),$(()=>i.push(ti(Kn(),a)));let o=oi(t,window.__mime8.sessionId,i,n),s=Wr(t,e=>{i.push($r(e)),o.notify()});yr(window,s,t),Qr(window,s,t),Wn(window,s,t),sr(window,s),Kr(window,s,t),xr(window,s),ar(document,e=>{i.push(e),o.notify()},e=>{let t=Tn.mirror.getId(e);return t>0?t:null}),qr(window,e=>{i.push(e),o.notify()},t),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&o.flush({final:!0})});let c=()=>{Tn({emit(e){e.type===ci&&(e={...e,data:{...e.data,href:r(e.data.href)}}),i.push(e),o.notify()}})};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,c):c()}e.init=ui});
|
|
78
|
+
`,wn=typeof self<`u`&&self.Blob&&new Blob([Cn],{type:`text/javascript;charset=utf-8`});function Tn(e){let t;try{if(t=wn&&(self.URL||self.webkitURL).createObjectURL(wn),!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(Cn),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var En=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=bn(t,n,r,!0),o=new Map,s=new Tn;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=>{z(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=bn(e,t,n,!1),i=vn(this.processMutation.bind(this),e,t,n),a=Sn(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)}},Dn=class{constructor(e){r(this,`trackedLinkElements`,new WeakSet),r(this,`mutationCb`),r(this,`adoptedStyleSheetCb`),r(this,`styleMirror`,new yt),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:ue(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){}},On=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(){}},G,kn,An,jn=!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 K=pe();function q(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:C=!0,recordCanvas:w=!1,recordCrossOriginIframes:ee=!1,recordAfter:T=e.recordAfter===`DOMContentLoaded`?e.recordAfter:`load`,userTriggeredOnInput:te=!1,collectFonts:ne=!1,inlineImages:E=!1,plugins:D,keepIframeSrcFn:re=()=>!1,ignoreCSSAttributes:ie=new Set([]),errorHandler:ae}=e;if(V)return()=>{};Pt=e.onMutation,Ft(ae);let O=!ee||window.parent===window,A=!1;if(!O)try{window.parent.document&&(A=!1)}catch{A=!0}if(O&&!t)throw Error(`emit function is required`);if(!O&&!A)return()=>{};S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),K.reset();let j=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,M=Qe(h);ht();let se,ce=0,le=e=>{for(let t of D||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!A&&(e=y(e)),e};G=(e,o)=>{let s=e;if(s.timestamp=oe(),W[0]?.isFrozen()&&s.type!==i.FullSnapshot&&(s.type!==i.IncrementalSnapshot||s.data.source!==a.Mutation)&&W.forEach(e=>e.unfreeze()),O)t?.(le(s),o);else if(A){let e={type:`rrweb`,event:le(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,`*`)}if(s.type===i.FullSnapshot)se=s,ce=0;else if(s.type===i.IncrementalSnapshot){if(s.data.source===a.Mutation&&s.data.isAttachIframe)return;ce++;let e=r&&ce>=r,t=n&&s.timestamp-se.timestamp>n;(e||t)&&kn(!0)}};let ue=e=>{G({type:i.IncrementalSnapshot,data:{source:a.Mutation,...e}})},de=e=>G({type:i.IncrementalSnapshot,data:{source:a.Scroll,...e}}),fe=e=>G({type:i.IncrementalSnapshot,data:{source:a.CanvasMutation,...e}}),N=new Dn({mutationCb:ue,adoptedStyleSheetCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.AdoptedStyleSheet,...e}})}),P=new on({mirror:K,mutationCb:ue,stylesheetManager:N,recordCrossOriginIframes:ee,wrappedEmit:G});for(let e of D||[])e.getMirror&&e.getMirror({nodeMirror:K,crossOriginIframeMirror:P.crossOriginIframeMirror,crossOriginIframeStyleMirror:P.crossOriginIframeStyleMirror});let pe=new On;An=new En({recordCanvas:w,mutationCb:fe,win:window,blockClass:o,blockSelector:s,mirror:K,sampling:b.canvas,dataURLOptions:x});let F=new sn({mutationCb:ue,scrollCb:de,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:u,maskTextSelector:d,inlineStylesheet:f,maskInputOptions:j,dataURLOptions:x,maskTextFn:_,maskInputFn:g,recordCanvas:w,inlineImages:E,sampling:b,slimDOMOptions:M,iframeManager:P,stylesheetManager:N,canvasManager:An,keepIframeSrcFn:re,processedNodeManager:pe},mirror:K});kn=(e=!1)=>{if(!C)return;G({type:i.Meta,data:{href:window.location.href,width:lt(),height:ct()}},e),N.reset(),F.init(),W.forEach(e=>e.lock());let t=tt(document,{mirror:K,blockClass:o,blockSelector:s,maskTextClass:u,maskTextSelector:d,inlineStylesheet:f,maskAllInputs:j,maskTextFn:_,maskInputFn:g,slimDOM:M,dataURLOptions:x,recordCanvas:w,inlineImages:E,onSerialize:e=>{gt(e,K)&&P.addIframe(e),_t(e,K)&&N.trackLinkElement(e),vt(e)&&F.addShadowRoot(k.shadowRoot(e),document)},onIframeLoad:(e,t)=>{P.attachIframe(e,t),F.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{N.attachLinkElement(e,t)},keepIframeSrcFn:re});if(!t)return console.warn(`Failed to snapshot the document`);G({type:i.FullSnapshot,data:{node:t,initialOffset:st(window)}},e),W.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&N.adoptStyleSheets(document.adoptedStyleSheets,K.getId(document))};try{let e=[],t=e=>H(tn)({mutationCb:ue,mousemoveCb:(e,t)=>G({type:i.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.MouseInteraction,...e}}),scrollCb:de,viewportResizeCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.ViewportResize,...e}}),inputCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.Input,...e}}),mediaInteractionCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.MediaInteraction,...e}}),styleSheetRuleCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.StyleSheetRule,...e}}),styleDeclarationCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.StyleDeclaration,...e}}),canvasMutationCb:fe,fontCb:e=>G({type:i.IncrementalSnapshot,data:{source:a.Font,...e}}),selectionCb:e=>{G({type:i.IncrementalSnapshot,data:{source:a.Selection,...e}})},customElementCb:e=>{G({type:i.IncrementalSnapshot,data:{source:a.CustomElement,...e}})},blockClass:o,ignoreClass:c,ignoreSelector:l,maskTextClass:u,maskTextSelector:d,maskInputOptions:j,inlineStylesheet:f,sampling:b,recordDOM:C,recordCanvas:w,inlineImages:E,userTriggeredOnInput:te,collectFonts:ne,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:re,blockSelector:s,slimDOMOptions:M,dataURLOptions:x,mirror:K,iframeManager:P,stylesheetManager:N,shadowDomManager:F,processedNodeManager:pe,canvasManager:An,ignoreCSSAttributes:ie,plugins:(D?.filter(e=>e.observer))?.map(e=>({observer:e.observer,options:e.options,callback:t=>G({type:i.Plugin,data:{plugin:e.name,payload:t}})}))||[]},v);P.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){B&&B(e)===!0||console.warn(e)}});let n=()=>{kn(),e.push(t(document)),jn=!0};return[`interactive`,`complete`].includes(document.readyState)?n():(e.push(R(`DOMContentLoaded`,()=>{G({type:i.DomContentLoaded,data:{}}),T===`DOMContentLoaded`&&n()})),e.push(R(`load`,()=>{G({type:i.Load,data:{}}),T===`load`&&n()},window))),()=>{V=!0,e.forEach(e=>{try{e()}catch(e){!String(e).toLowerCase().includes(`cross-origin`)&&!(B&&B(e)===!0)&&console.warn(e)}}),pe.destroy(),K.reset(),N.reset(),jn=!1}}catch(e){B&&B(e)===!0||console.warn(e)}}q.addCustomEvent=(e,t)=>{if(!jn)throw Error(`please add custom event after start recording`);G({type:i.Custom,data:{tag:e,payload:t}})},q.freezePage=()=>{W.forEach(e=>e.freeze())},q.takeFullSnapshot=e=>{if(!jn)throw Error(`please take full snapshot after start recording`);kn(e)},q.mirror=K;var Mn=`mime8/drag@1`,Nn=`mime8/end@1`,Pn=`mime8/environment@1`;function Fn(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 In=`mime8/keys@1`,Ln=`mime8/rrweb-error@1`,Rn=`mime8/network@1`,zn=`mime8/storage@1`,Bn=`mime8/storage-change@1`;function Vn(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 Hn(e){return{type:6,timestamp:e.t,data:{plugin:Rn,payload:e}}}function Un(e,t){return{type:6,timestamp:t,data:{plugin:zn,payload:e}}}function Wn(e,t){return{type:6,timestamp:t,data:{plugin:Pn,payload:e}}}function Gn(e,t){return{type:6,timestamp:t,data:{plugin:Nn,payload:e}}}var Kn=2,qn=3,Jn=5,Yn=e=>e.reduce((e,t)=>e+t.length,0);function Xn(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===Kn,input:n.type===qn&&c?.source===Jn,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(Gn({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-=Yn(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:Yn(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,closed:()=>l}}var J={collectorUrl:`https://api.mime8.com`,recorderVersion:`0.3.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,idleTimeout:30*6e4,maxDuration:60*6e4,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`]},Zn=6e4;function Qn(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>=Zn?e:t}function $n(e){let t=e.network??{},n=t.redact??{},r=e.session??{};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,idleTimeout:Qn(r.idleTimeout,J.idleTimeout),maxDuration:Qn(r.maxDuration,J.maxDuration),streamingTypes:[...J.streamingTypes],mediaTypes:[...J.mediaTypes]}}function Y(e){try{e()}catch{}}function er(e){return e instanceof Error||e instanceof DOMException?e.message:String(e)}var tr=[`pointerdown`,`keydown`,`wheel`,`touchstart`,`input`];function nr(e,t){let n=e=>{e.isTrusted&&Y(t)};for(let t of tr)e.addEventListener(t,n,{capture:!0,passive:!0})}var rr=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});function ir(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 ar(e){try{return{text:rr.decode(e)}}catch{return{base64:ir(e)}}}function or(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 sr(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 cr(){let e=new Uint8Array;return{push(t){let n=sr(e,t),r=or(n);try{let t=rr.decode(n.subarray(0,r));return e=n.slice(r),t?{text:t}:null}catch{return e=new Uint8Array,{base64:ir(n)}}},end(){if(e.length===0)return null;let t=ar(e);return e=new Uint8Array,t}}}function lr(e,t){return e>t.maxBodySize?{omitted:`too-large`,size:e}:null}function ur(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 dr(e,t){return e.length*3<=t.maxBodySize?null:lr(ur(e),t)}async function fr(e,t,n=!1){let r=lr(e.size,t);if(r)return r;let i=new Uint8Array(await e.arrayBuffer());return n?{base64:ir(i)}:ar(i)}function pr(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 mr(e,t){if(e!=null){if(typeof e==`string`||e instanceof URLSearchParams){let n=e.toString();return dr(n,t)??{text:n}}if(e instanceof FormData)return{form:pr(e)};if(e instanceof Blob)return fr(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 lr(n.byteLength,t)??ar(n)}return e instanceof ReadableStream?{omitted:`stream`}:{omitted:`unreadable`}}}function hr(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 gr(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 _r(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=hr(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=mr(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}}var vr=3;function yr(e){let t=new Set;for(let n=br(e);n;n=br(n))t.add(n);return{node:e,around:t}}function br(e){return e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}function xr(e,t,n,r){for(let i of e.elementsFromPoint(t,n))if(!r||!(i===r.node||r.around.has(i)||r.node.contains(i)))return i;return null}function Sr(e,t,n){let r=null,i=!1,a=(i,a)=>{let{clientX:o,clientY:s}=a,c=xr(e.document,o,s,r?.press??null),l={end:i,x:o,y:s,over:c?n(c):null};t({type:6,timestamp:Date.now(),data:{plugin:Mn,payload:l}})},o={pointerdown:e=>{let t=e;if(t.pointerType!==`mouse`||t.button!==0)return;let n=t.composedPath()[0];r={press:n instanceof Node?yr(n):null,x:t.clientX,y:t.clientY},i=!1},drop:e=>{i=!0,a(`drop`,e)},dragend:e=>{i||a(`cancel`,e),r=null,i=!1},pointerup:e=>{let t=e;t.pointerType!==`mouse`||!r||((Math.abs(t.clientX-r.x)>=vr||Math.abs(t.clientY-r.y)>=vr)&&a(`release`,t),r=null)}},s={capture:!0,passive:!0},c=Object.entries(o).map(([t,n])=>{let r=e=>{e.isTrusted&&Y(()=>n(e))};return e.addEventListener(t,r,s),[t,r]});return()=>{for(let[t,n]of c)e.removeEventListener(t,n,s)}}function Cr(e,t,n){return n.find(n=>e.matchMedia(`(${t}: ${n})`).matches)??`unknown`}function wr(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:Cr(e,`hover`,[`hover`,`none`]),anyHover:Cr(e,`any-hover`,[`hover`,`none`]),pointer:Cr(e,`pointer`,[`fine`,`coarse`,`none`]),anyPointer:Cr(e,`any-pointer`,[`fine`,`coarse`,`none`]),maxTouchPoints:t.maxTouchPoints,screen:{width:n.width,height:n.height}}}var Tr=new Set([`Enter`,`Escape`,`Tab`,`Backspace`,`Delete`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),Er=new Set([`button`,`submit`,`reset`,`checkbox`,`radio`]),Dr=new Set([`button`,`checkbox`,`switch`,`menuitem`]);function Or(e){return e instanceof Element?e instanceof HTMLButtonElement?!0:e instanceof HTMLInputElement?Er.has(e.type):Dr.has(e.getAttribute(`role`)??``):!1}function kr(e,t){if(e.isComposing||e.key===`Process`||e.keyCode===229)return!1;if(Tr.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 Or(t);let a=e.getModifierState(`AltGraph`)||n&&i||i&&!r;return(n||r)&&!a}return n||r||i}function Ar(e,t,n){let r=e=>Y(()=>{let r=e.composedPath()[0];kr(e,r)&&t({type:6,timestamp:Date.now(),data:{plugin:In,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 jr=3,Mr=2,Nr=5,Pr=2,Fr=new Set([`click`,`dblclick`,`contextmenu`,`mousedown`,`mouseup`,`pointerdown`,`pointerup`,`touchstart`,`touchend`,`beforeinput`,`input`,`change`,`submit`]),Ir=new Set([`keydown`,`keyup`,`keypress`]);function Lr(e){return e?.isTrusted?Ir.has(e.type)?kr(e,e.composedPath()[0]):Fr.has(e.type):!1}function Rr(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]:Lr(e.event)}),r.push(i);try{return n.apply(this,t)}finally{r.pop()}}t.click=a;let o=t=>{if(t.source===Nr)return t.userTriggered!==!1||!i||e.event!==void 0?null:{byApp:!0};if(t.source!==Mr||t.type!==Pr)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!==jr)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 zr=EventTarget.prototype.addEventListener;function Br(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),zr.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}),zr.call(this,`open`,()=>i({type:`sse-open`,t:Date.now(),id:n})),zr.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)}),zr.call(this,e,t,n)}}),Object.defineProperty(o,"name",{value:`EventSource`}),e.EventSource=o}function Vr(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 Hr=new Set([`DELETE`,`GET`,`HEAD`,`OPTIONS`,`POST`,`PUT`]);function Ur(e){let t=e.toUpperCase();return Hr.has(t)?t:e}function Wr(e){return[...e]}function Gr(e){return e instanceof DOMException||e instanceof Error?e.name:void 0}function Kr(e,t){return Gr(e)===`TimeoutError`||Gr(t?.reason)===`TimeoutError`?`timeout`:Gr(e)===`AbortError`||t?.aborted===!0?`abort`:`network`}async function qr(e,t){if(!e.body)return;let n=await gr(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:pr(await new Response(n,{headers:{"content-type":r}}).formData())}}catch{}return ar(n)}function Jr(e){return e!==void 0&&!(e instanceof Headers)&&!Array.isArray(e)&&typeof e[Symbol.iterator]==`function`?new Headers:new Headers(e)}function Yr(e,t,n){let r=t?.headers?Jr(t.headers):new Headers(e.headers);if(n&&!r.has(`content-type`)){let e=hr(t?.body);e&&r.set(`content-type`,e)}return r}function Xr(e,t,n){if(e instanceof Request){let r=t?.body!==void 0&&t.body!==null,i=r?null:e.clone();return{method:Ur(t?.method??e.method),headers:Wr(Yr(e,t,r)),body:i?qr(i,n):mr(t?.body,n),signal:t?.signal??e.signal}}let r=Jr(t?.headers),i=r.has(`content-type`)?null:hr(t?.body);return i&&r.set(`content-type`,i),{method:Ur(t?.method??`GET`),headers:Wr(r),body:mr(t?.body,n),signal:t?.signal}}function Zr(e){return e instanceof Request?e.url:new URL(e instanceof URL?e.href:String(e),document.baseURI).href}function Qr(e,t,n){let r=e.fetch;function i(e,r){let i=Zr(e);if(t.ignores(i))return null;let a=t.nextId(),o=Date.now(),{method:s,headers:c,body:l,signal:u}=Xr(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:Kr(e,u),message:er(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 gr(t.body,n.maxBodySize);if(r){d({type:`http-end`,body:ar(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=cr(),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:Wr(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(Vr(t,n.mediaTypes)){d({type:`http-end`,body:{omitted:`media`},t:Date.now(),id:a});return}if(Vr(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 $r=[`RTCPeerConnection`,`Worker`,`SharedWorker`,`WebTransport`,`WebSocketStream`];function ei(e,t){for(let n of $r){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 ti(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 ni(e,t,n){return r=>{let i=!1;return Y(()=>{if(n()){i=!0;return}ti(r,e)>e&&(t(r.length),i=!0)}),!i}}function ri(e,t){return e.lastIndex=0,e.test(t)}function X(e,t){return typeof e==`string`?e.toLowerCase()===t.toLowerCase():e instanceof RegExp?ri(e,t):e(t)}function ii(e,t){return typeof e==`string`?t.startsWith(e):e instanceof RegExp?ri(e,t):e(t)}var Z=`[redacted]`,Q=()=>{};function ai(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=ai(e,c,n,r)}else c=ai(e,c,n);c=i(c),e[c]===`,`&&(c=i(c+1))}return n(r,t,c+1),c+1}function oi(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 si(e){if(!e.startsWith(`"`))return null;let t=JSON.parse(e);return/^\s*[[{]/.test(t)&&ci(t)?t:null}function ci(e){try{return JSON.parse(e),!0}catch{return!1}}var li=e=>/^\s*[[{]/.test(e)&&ci(e),ui=e=>/^\s*"/.test(e)&&ci(e);function di(e,t){let n=[];return ai(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])}),oi(e,n)}function fi(e,t,n){if(!ci(e))return e;let r=[];return ai(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,di(s,n)]):r.push([a,o,JSON.stringify(n(s))]);return}let c=si(s);if(c===null)return;let l=fi(c,t,n);l!==c&&r.push([a,o,JSON.stringify(l)])}),oi(e,r)}var pi=/^([\w-]+)\.([\w-]+)\.([\w-]*)$/,mi=`cmVkYWN0ZWQ`;function hi(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 gi(e){let t=``;for(let n of new TextEncoder().encode(e))t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function _i(e){try{let t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}catch{return null}}function vi(e,t=Q){let n=r=>{let i=pi.exec(r);if(!i)return null;let o=_i(hi(i[1]))?.alg,s=hi(i[2]);if(typeof o!=`string`||!_i(s))return null;let c=Z;if(i[3]!==``&&o.toLowerCase()!==`none`){let t=s;for(let n of e)t=fi(t,n,a);t=$(t,n);let r=t===s?i[2]:gi(t);c=`${i[1]}.${r}.${mi}`}return t(r,c),c},r=e=>(t(e,Z),Z),i=e=>n(e)??r(e),a=e=>{if(li(e))return di(e,a);if(ui(e))return JSON.stringify(a(JSON.parse(e)));let t=yi.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 yi=/^(?:([A-Za-z][\w-]*) )?([\w-]+\.[\w-]+\.[\w-]*)$/,bi=/^[^\s=&]+=[^\s&]*(?:&[^\s=&]+=[^\s&]*)*$/,xi=/(?:(?<=%[0-9A-Fa-f]{2})|(?<![\w.%-]))[\w-]+\.[\w-]+\.[\w-]*(?![\w-]|\.[\w-])/g;function $(e,t){return e.includes(`.`)?e.replace(xi,e=>t(e)??e):e}function Si(e,t,{plusIsSpace:n=!0}={}){let r=Ti(e,n);if(r===e)return null;let i=$(r,t);return i===r?null:encodeURIComponent(i)}function Ci(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 wi(e){return e.flatMap(e=>`bodyField`in e?[e.bodyField]:[])}function Ti(e,t=!0){try{return decodeURIComponent(t?e.replaceAll(`+`,` `):e)}catch{return e}}function Ei(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,Ti(a))?(r=!0,`${a}=${n(e.slice(i+1))}`):e});return r?i.join(`&`):e}function Di(e){return(e.find(([e])=>e===`content-type`)?.[1]??``).split(`;`)[0].trim().toLowerCase()===`application/x-www-form-urlencoded`}function Oi(e,t,n,r=!1){if(`text`in e){let i=r?Ei(e.text,t,n):fi(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 ki={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=Oi(e.body,r,n,Di(e.headers));return t===e.body?e:{...e,body:t}}case`http-end`:{if(!e.body)return e;let t=`text`in e.body&&bi.test(e.body.text),i=Oi(e.body,r,n,t);return i===e.body?e:{...e,body:i}}case`ws-send`:case`ws-message`:{let t=Oi(e.data,r,n);return t===e.data?e:{...e,data:t}}case`sse-message`:{let t=fi(e.data,r,n);return t===e.data?e:{...e,data:t}}default:return e}}};function Ai(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 ji(e,t,n,r){return e.some(([e])=>X(t,e))?e.map(([e,i])=>X(t,e)?(Ai(e,i,r),[e,n(i)]):[e,i]):e}var Mi={is:e=>`header`in e,apply(e,t,n,r){if(e.type!==`http-request`&&e.type!==`http-response`)return e;let i=ji(e.headers,t.header,n,r);return i===e.headers?e:{...e,headers:i}}},Ni=e=>t=>(e(t,Z),Z);function Pi(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 Fi(e,t,n=Q){return Pi(e,e=>Ei(e,t,Ni(n)))}function Ii(e,t){let n=e=>Ci(e,e=>$(Li(e),t)===Li(e)?null:Z),r=e=>$(e,t).split(`/`).map(e=>Si(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 Li(e){try{return decodeURIComponent(e.replaceAll(`+`,` `))}catch{return e}}var Ri={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=Fi(e.url,t.queryParam,r);return n===e.url?e:{...e,url:n}}default:return e}}},zi=[Mi,Ri,ki],Bi=/^([a-z][a-z\d+.-]*:\/\/[^/?#@:]*:)([^/?#@]*)@/i;function Vi(e,t){let n=Bi.exec(e);return n?(t(n[2],Z),`${n[1]}${Z}@${e.slice(n[0].length)}`):e}function Hi(e,t,n=Q){let r=e;if(`url`in r&&r.url!==void 0){let e=Vi(r.url,n);e!==r.url&&(r={...r,url:e})}let{replace:i,field:a,jwt:o}=vi(wi(t),n);for(let e of t){let t=zi.find(t=>t.is(e));t&&(r=t.apply(r,e,`bodyField`in e?a:i,n))}return Ui(r,o)}function Ui(e,t){let n=e=>{if(`text`in e){let n=$(e.text,t);return bi.test(n)&&(n=Ci(n,e=>Si(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=Ii(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 Wi(e,t,n=Q){let r=Vi(e,n);for(let e of t)Ri.is(e)&&(r=Fi(r,e.queryParam,n));return Ii(r,vi(wi(t),n).jwt)}function Gi(e,t,n=()=>!1,r=Q){let i=0,a=0;return{ignores:t=>n()||e.ignoreUrls.some(e=>ii(e,t)),nextId:()=>a++,place:()=>i++,emit(n){try{let a=Hi(n,e.redact,r);if(e.beforeRecord&&(a=e.beforeRecord(a)),!a)return;t({...a,n:a.n??i++})}catch{}}}}var Ki=3,qi=/^(?:[A-Z][A-Za-z]{0,58})?Error$/;function Ji(e){let t;try{t=e?.name}catch{}return typeof t==`string`&&qi.test(t)?t:`other`}function Yi(e){let t=new Set;return(n,r)=>Y(()=>{let i=Ji(n),a=`${i} ${r}`;t.size>=Ki||t.has(a)||(t.add(a),e({type:6,timestamp:Date.now(),data:{plugin:Ln,payload:{name:i,during:r}}}))})}var Xi=EventTarget.prototype.addEventListener;function Zi(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();fr(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=dr(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:ir(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}),Xi.call(this,`open`,()=>a({type:`ws-open`,protocol:this.protocol,extensions:this.extensions,t:Date.now(),id:r})),Xi.call(this,`message`,e=>Y(()=>s(`ws-message`,e.data,r))),Xi.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})}),Xi.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 Qi=/^(?:__Host-|__Secure-)?(?:session|sid|connect\.sid|phpsessid|jsessionid|asp\.net_sessionid|.+_session)$/i;function $i(e,t,n,r=Q){let i=wi(n),{replace:a,field:o,jwt:s}=vi(i,r);if(X(Qi,e))return a(t);if(i.some(t=>X(t,e)))return o(t);if(li(t)){let e=t;for(let t of i)e=fi(e,t,o);return $(e,s)}return $(t,s)}function ea(e,t,n,r){(X(Qi,e)||wi(n).some(t=>X(t,e))||t.includes(`.eyJ`))&&$i(e,t,n,r)}function ta(e,t,n,r=Q){let i=na(t);if(i===null||i===t)return $i(e,t,n,r);let a=$i(e,i,n,r);return a===i?t:ia(a)}function na(e){try{return decodeURIComponent(e)}catch{return null}}var ra=/[%;,\s"\\\p{Cc}\P{ASCII}]/gu,ia=e=>e.replace(ra,encodeURIComponent);function aa(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=ta(i,a,t,n);return r<0?o:`${i}=${o}`}).join(`; `)}function oa(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:$i(a,i,t,n)})}}return r};return{localStorage:e.localStorage?r(e.localStorage):[],sessionStorage:e.sessionStorage?r(e.sessionStorage):[],cookies:aa(e.document.cookie??``,t,n)}}function sa(e,t,n,r=Q){let i=e=>Y(()=>t({type:6,timestamp:Date.now(),data:{plugin:Bn,payload:e}}));Vn(e,i,Fn,(e,t)=>{t.length<=n.maxBodySize&&ea(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:$i(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=ca(e);t.value=ta(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 ca(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 la(e){let t=new Headers;for(let[n,r]of e)t.append(n,r);return[...t]}function ua(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 da(e){let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)}function fa(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!==da(t.url),headers:la(ua(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(Vr(e.getResponseHeader(`content-type`),n.mediaTypes)){a({omitted:`media`});return}switch(e.responseType){case``:case`text`:{let t=e.responseText;a(dr(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:dr(e,n)??{text:e},t:a,id:i,n:o})}));return}case`arraybuffer`:{let t=new Uint8Array(e.response);a(u(t.byteLength)??ar(t));return}case`blob`:{let r=Date.now(),a=t.place();fr(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:Ur(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:hr(e);d&&u.push([`content-type`,d]);let f=la(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=mr(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 pa=8,ma=4096,ha=256,ga=`.cmVkYWN0ZWQ`,_a=/^(?:bearer|basic|token|bot|apikey|digest|negotiate) +(\S+)$/i;function va(e){return e.length<pa||e.length>ma||/^[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(ga)}function ya(e){return e.replace(/[a-z]/g,`x`).replace(/[A-Z]/g,`X`).replace(/\d/g,`0`)}var ba=31,xa=1;for(let e=1;e<pa;e++)xa=Math.imul(xa,ba);var Sa=65536;function Ca(e,t){let n=0;for(let r=0;r<pa;r++)n=Math.imul(n,ba)+e.charCodeAt(t+r)|0;return n}function wa(e){let t=new Uint8Array(8192),n=new Map;for(let r of e){let e=Ca(r,0),i=e&Sa-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<pa)return;let a=Ca(r,0);for(let e=0;;e++){let o=a&Sa-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+pa>=r.length)return;let s=Math.imul(r.charCodeAt(e),xa);a=Math.imul(a-s,ba)+r.charCodeAt(e+pa)|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 Ta=new Set([2,3,4]),Ea=3,Da=5,Oa=e=>{try{return decodeURIComponent(e)}catch{return null}};function ka(e){let t=e.data;return e.type===Ea&&t.source===Da?t:null}function Aa(e){let t=new Map,n=null,r=new Map,i=(e,r)=>{if(!va(e))return;let i=t.get(e);t.delete(e),t.size>=ha&&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=_a.exec(n)?.[1];r&&i(r,Z);for(let e of new Set([Oa(n),Oa(n.replaceAll(`+`,` `))]))e!==null&&e!==n&&i(e,Z)}catch{}},{jwt:o}=vi(wi(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]`?ya(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??=wa(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(!Ta.has(e[t].type))continue;let n=i[t],u=ka(e[t]),d=u?.text;if(u?.id!==void 0&&d&&d.length>=pa&&!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=ka(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=ka(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]`?ya(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)=>Ta.has(e.type)?[t]:[])}}}}function ja(e,t,n){return n-e.lastInput>=t.idleTimeout?`idle`:n-e.start>=t.maxDuration?`duration`:null}function Ma(e,t){return Math.min(e.lastInput+t.idleTimeout,e.start+t.maxDuration)}var Na=2**31-1;function Pa(e,t,n){let r=Date.now(),i={start:r,lastInput:r},a=!0,o=!1,s;function c(){clearTimeout(s);let t=Math.min(Math.max(0,Ma(i,e)-Date.now()),Na);s=setTimeout(u,t)}function l(){a=!0,i.start=Date.now(),n(),o||c()}function u(){if(o||!a)return;let n=ja(i,e,Date.now());if(!n){c();return}a=!1,t(n),n===`duration`&&!o&&l()}return c(),{input(){if(o)return;let n=Date.now(),r=a?ja(i,e,n):null;r&&(a=!1,clearTimeout(s),t(r)),i.lastInput=n,!a&&!o&&l()},stop(){o=!0,a=!1,clearTimeout(s)}}}async function Fa(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 Ia=64*1024,La=1024;function Ra(e){return e>=400&&e<500&&e!==408&&e!==429}var za=1e4,Ba=5*6e4,Va=10*6e4;function Ha(e){let t=e.headers.get(`Retry-After`)?.trim();return t&&/^\d+$/.test(t)?Number(t)*1e3:null}function Ua(e,t,n,r,i=()=>{}){let a=`${e.collectorUrl}/api/projects/${e.projectKey}/sessions/${t}/chunks`,o=0,s=null,c=0,l=0,u=!1;function d(e){l++;let t=e??Math.min(za*2**(l-1),Ba);c=Date.now()+t}async function f(t,i){let s=n.take(t===`interval`?{hold:e.uploadInterval}:{});if(!s)return;let f=!1;try{if(u)return;let{json:p}=s,m=await Fa(p),h={version:1,sequenceNumber:o,sentAt:Date.now(),start:s.start,end:s.end,eventCount:s.events.length,hasFullSnapshot:s.hasFullSnapshot,reason:t,urls:s.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=i&&m.byteLength+g.length+La<=Ia,y=e=>r(a,{method:`POST`,body:_(),keepalive:e}),b=await y(v).catch(e=>{if(v&&e instanceof TypeError)return y(!1);throw e});if(!b.ok&&!Ra(b.status)){let e=Ha(b);if(e!==null&&e>Va){u=!0,n.close();return}d(e),f=!0;return}o++,l=0,c=0}catch{d(null),f=!0}finally{f?n.restore(s):n.release(s)}}async function p(t,r,i=r){if(!(!r&&Date.now()<c)){for(;s;){if(!i)return;await s}s=f(t,r);try{await s}finally{s=null}n.bytes()>=e.earlyUploadBytes&&p(`size`,!1)}}let m=setInterval(()=>{if(n.closed()&&n.bytes()===0&&!s){clearInterval(m),i();return}p(`interval`,!1)},e.uploadInterval);return{flush:({final:e=!1}={})=>p(e?`hidden`:`interval`,e),drain:()=>p(`interval`,!1,!0),notify(){!s&&n.bytes()>=e.earlyUploadBytes&&p(`size`,!1)}}}function Wa(){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 Ga=4,Ka=3,qa=5;function Ja(e){if(!e?.projectKey)throw Error(`mime8.init: projectKey is required`);if(window.mime8Replay===!0||window.__mime8)return;let t=$n(e),n=window.fetch.bind(window),r=Aa(t.redact),i=e=>Wi(e,t.redact,r.note),a=null,o=new Set,s=!1,c,l;function u(){s=!0,a=null,l?.stop(),queueMicrotask(()=>Y(()=>c?.()))}function d(e){let t=a;t&&(t.buffer.push(e),t.transport.notify())}function f(){let e={sessionId:Wa(),events:[]};window.__mime8=e;let s={timed:!1};s.buffer=Xn(e,i,t.maxBufferBytes,()=>{s.timed||u()},(e,t)=>r.scrubChunk(e,t)),s.transport=Ua(t,e.sessionId,s.buffer,n,()=>o.delete(s.transport)),o.add(s.transport),s.noteRrwebError=Yi(d),a=s;let c=Date.now();d(Un(oa(window,t.redact,r.note),c)),Y(()=>d(Wn(wr(),c)))}function p(e){let n=a;if(!n)return;a=null,n.timed=!0;let r=e===`idle`?t.idleTimeout:t.maxDuration;n.buffer.end(Gn({reason:e,limit:r},Date.now())),n.transport.drain()}f();let m=ni(t.maxBatchChanges,e=>{let n=a;n&&(n.buffer.end(Gn({reason:`mutations`,limit:t.maxBatchChanges,records:e},Date.now())),n.transport.notify())},()=>s||a===null),h=Gi(t,e=>d(Hn(e)),()=>s,r.note);Qr(window,h,t),fa(window,h,t),_r(window,h,t),Br(window,h),Zi(window,h,t),ei(window,h);let g=Rr(window),_=e=>{let t=q.mirror.getId(e);return t>0?t:null};Ar(document,d,_),Sr(window,d,_),sa(window,d,t,r.note);let v=!1;function y(){if(!s&&(f(),v))try{q.mirror.reset(),q.takeFullSnapshot()}catch(e){a?.noteRrwebError(e,`start`)}}l=Pa(t,e=>Y(()=>p(e)),()=>Y(y)),nr(window,()=>l?.input()),document.addEventListener(`visibilitychange`,()=>{if(document.visibilityState===`hidden`)for(let e of o)e.flush({final:!0})});let b=()=>{try{if(s)return;c=q({errorHandler:e=>(a?.noteRrwebError(e,v?`recording`:`start`),!0),onMutation:m,userTriggeredOnInput:!0,emit:e=>Y(()=>{a&&(e.type!==Ka||e.data.source!==qa||e.data.id!==-1)&&(e.type===Ga&&(e={...e,data:{...e.data,href:i(e.data.href)}}),e=g.mark(e),d(e))})}),v=!0}catch(e){a?.noteRrwebError(e,`start`)}};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,b):b()}e.init=Ja});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mime8/recorder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Records real user sessions in the browser for mime8 visual regression testing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mime8",
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"visual-regression"
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/atfzl/mime8.git",
|
|
15
|
+
"directory": "packages/recorder"
|
|
16
|
+
},
|
|
12
17
|
"files": [
|
|
13
18
|
"dist",
|
|
14
19
|
"THIRD_PARTY_LICENSES"
|
|
@@ -29,13 +34,13 @@
|
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
31
36
|
"@playwright/test": "^1.62.0",
|
|
32
|
-
"@rrweb/record": "
|
|
37
|
+
"@rrweb/record": "2.1.1",
|
|
33
38
|
"@rrweb/types": "^2.1.1",
|
|
34
39
|
"@vitest/browser-playwright": "4.1.10",
|
|
35
40
|
"playwright": "^1.62.0",
|
|
36
41
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.6",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
42
|
+
"testkit": "0.0.0",
|
|
43
|
+
"protocol": "0.0.0"
|
|
39
44
|
},
|
|
40
45
|
"scripts": {
|
|
41
46
|
"predev": "vp build",
|
|
@@ -45,7 +50,7 @@
|
|
|
45
50
|
"preview": "vp preview",
|
|
46
51
|
"test": "vp test",
|
|
47
52
|
"pretest:e2e": "vp run build",
|
|
48
|
-
"test:e2e": "playwright test -c test/e2e/playwright.config.ts",
|
|
53
|
+
"test:e2e": "node ../ci/src/main.ts lock --what 'recorder e2e' -- playwright test -c test/e2e/playwright.config.ts",
|
|
49
54
|
"test:e2e:dev": "concurrently 'vp run build:watch' 'playwright test -c test/e2e/playwright.config.ts --ui'"
|
|
50
55
|
}
|
|
51
56
|
}
|